Skip to content

Commit

Permalink
fix: fix singleton patch with body id
Browse files Browse the repository at this point in the history
  • Loading branch information
pviti committed Dec 20, 2023
1 parent ca338e6 commit e923c9c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')


Expand Down Expand Up @@ -142,7 +143,7 @@ class ResourceAdapter {

async retrieve<R extends Resource>(resource: ResourceId | ResourceType, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R> {

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 || {})

Expand Down Expand Up @@ -199,7 +200,7 @@ class ResourceAdapter {

async update<U extends ResourceUpdate, R extends Resource>(resource: U & ResourceId, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R> {

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 || {})

Expand Down

0 comments on commit e923c9c

Please sign in to comment.