Skip to content

Commit

Permalink
Merge pull request #555 from vtex/fix/save-json-return-type
Browse files Browse the repository at this point in the history
Fix/save json return type
  • Loading branch information
filafb authored Jan 29, 2024
2 parents da787a8 + fa02101 commit 7e02297
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed
- Return type for the saveJSON method of VBase client

## [6.46.0] - 2023-10-25
### Added
- Add disk cache steps and retry count to tracing
Expand Down
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 7e02297

Please sign in to comment.