From e923c9ce69f5b5ea43698bd1df67f26783010d1e Mon Sep 17 00:00:00 2001 From: Pierluigi Viti Date: Wed, 20 Dec 2023 17:21:57 +0100 Subject: [PATCH] fix: fix singleton patch with body id --- src/resource.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/resource.ts b/src/resource.ts index c76d2b2..0c5f214 100644 --- a/src/resource.ts +++ b/src/resource.ts @@ -9,6 +9,7 @@ import type { InterceptorManager } from './interceptor' import { ErrorType, SdkError } from './error' import Debug from './debug' +import { CommerceLayerProvisioningStatic } from './static' const debug = Debug('resource') @@ -142,7 +143,7 @@ class ResourceAdapter { async retrieve(resource: ResourceId | ResourceType, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise { - const singleton = !('id' in resource) || !resource.id + const singleton = !('id' in resource) || CommerceLayerProvisioningStatic.isSingleton(resource.type) debug('retrieve:%s %o, %O, %O', (singleton? ' singleton,' : ''), resource, params || {}, options || {}) @@ -199,7 +200,7 @@ class ResourceAdapter { async update(resource: U & ResourceId, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise { - const singleton = !('id' in resource) || !resource.id + const singleton = !('id' in resource) || CommerceLayerProvisioningStatic.isSingleton(resource.type) debug('update:%s %o, %O, %O', (singleton? ' singleton,' : ''), resource, params || {}, options || {})