Skip to content

Commit

Permalink
Type saveJSON response, inferred from http.put method
Browse files Browse the repository at this point in the history
  • Loading branch information
filafb committed Jan 11, 2024
1 parent da787a8 commit fa09bf2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/clients/infra/VBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
import {
IgnoreNotFoundRequestConfig,
} from '../../HttpClient/middlewares/notFound'
import { BucketMetadata, FileListItem } from '../../responses'
import { BucketMetadata, FileListItem, VBaseSaveResponse } from '../../responses'
import { IOContext } from '../../service/worker/runtime/typings'
import { InfraClient } from './InfraClient'

Expand Down Expand Up @@ -118,7 +118,7 @@ export class VBase extends InfraClient {
return { ...response, data: conflictsMergedData } as IOResponse<T>
} catch (resolverError) {
const typedResolverError = resolverError as { status?: number; message: string }

if (typedResolverError?.status === 404) {
return this.http.getRaw<T>(routes.File(bucket, path), {
'X-Vtex-Detect-Conflicts': false,
Expand Down Expand Up @@ -165,7 +165,7 @@ export class VBase extends InfraClient {
headers['If-Match'] = ifMatch
}
const metric = 'vbase-save-json'
return this.http.put(routes.File(bucket, path), data, {headers, metric, tracing: {
return this.http.put<VBaseSaveResponse>(routes.File(bucket, path), data, {headers, metric, tracing: {
requestSpanNameSuffix: metric,
...tracingConfig?.tracing,
}})
Expand Down
2 changes: 2 additions & 0 deletions src/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,5 @@ export interface HousekeeperStatesAndUpdates {
state: HouseKeeperState
updates: HouseKeeperUpdates
}

export type VBaseSaveResponse = FileListItem[]

0 comments on commit fa09bf2

Please sign in to comment.