From fa09bf2c11689baaa803ccdf7fa99cfb39ae5487 Mon Sep 17 00:00:00 2001 From: Filadelfo Date: Thu, 11 Jan 2024 16:09:55 -0300 Subject: [PATCH 1/2] Type saveJSON response, inferred from http.put method --- src/clients/infra/VBase.ts | 6 +++--- src/responses.ts | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/clients/infra/VBase.ts b/src/clients/infra/VBase.ts index 291ab918e..1e3dd949f 100644 --- a/src/clients/infra/VBase.ts +++ b/src/clients/infra/VBase.ts @@ -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' @@ -118,7 +118,7 @@ export class VBase extends InfraClient { return { ...response, data: conflictsMergedData } as IOResponse } catch (resolverError) { const typedResolverError = resolverError as { status?: number; message: string } - + if (typedResolverError?.status === 404) { return this.http.getRaw(routes.File(bucket, path), { 'X-Vtex-Detect-Conflicts': false, @@ -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(routes.File(bucket, path), data, {headers, metric, tracing: { requestSpanNameSuffix: metric, ...tracingConfig?.tracing, }}) diff --git a/src/responses.ts b/src/responses.ts index f2e6cd368..d1f235cf8 100644 --- a/src/responses.ts +++ b/src/responses.ts @@ -86,3 +86,5 @@ export interface HousekeeperStatesAndUpdates { state: HouseKeeperState updates: HouseKeeperUpdates } + +export type VBaseSaveResponse = FileListItem[] From fa02101c407e96baa5178b4bf8cca192be65d6fe Mon Sep 17 00:00:00 2001 From: Filadelfo Date: Thu, 11 Jan 2024 16:40:18 -0300 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 059e7eae0..c79aaebe6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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