IdempotencyKeyService
internal.internal.IdempotencyKeyService
Properties
__configModule__Record<string, unknown>__container__anyRequired__moduleDeclaration__Record<string, unknown>manager_EntityManagerRequiredtransactionManager_undefined | EntityManagerRequiredAccessors
activeManager_
Protected get activeManager_(): EntityManager
Returns
EntityManager
EntityManagerEntityManagerRequiredInherited from
TransactionBaseService.activeManager_
Methods
atomicPhase_
Protected atomicPhase_<TResult, TError>(work, isolationOrErrorHandler?, maybeErrorHandlerOrDontFail?): Promise<TResult>
Wraps some work within a transactional block. If the service already has a transaction manager attached this will be reused, otherwise a new transaction manager is created.
TResultobjectRequiredTErrorobjectRequiredParameters
work(transactionManager: EntityManager) => Promise<TResult>RequiredisolationOrErrorHandlerIsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail(error: TError) => Promise<void | TResult>Returns
Promise<TResult>
PromisePromise<TResult>RequiredInherited from
TransactionBaseService.atomicPhase_
create
create(payload): Promise<IdempotencyKey>
Creates an idempotency key for a request. If no idempotency key is provided in request, we will create a unique identifier.
Parameters
Returns
Promise<IdempotencyKey>
the created idempotency key
initializeRequest
initializeRequest(headerKey, reqMethod, reqParams, reqPath): Promise<IdempotencyKey>
Execute the initial steps in a idempotent request.
Parameters
headerKeystringRequiredreqMethodstringRequiredreqParamsRecord<string, unknown>RequiredreqPathstringRequiredReturns
Promise<IdempotencyKey>
the existing or created idempotency key
lock
lock(idempotencyKey): Promise<IdempotencyKey>
Locks an idempotency.
Parameters
idempotencyKeystringRequiredReturns
Promise<IdempotencyKey>
result of the update operation
retrieve
retrieve(idempotencyKeyOrSelector): Promise<IdempotencyKey>
Retrieves an idempotency key
Parameters
Returns
Promise<IdempotencyKey>
idempotency key
shouldRetryTransaction_
Protected shouldRetryTransaction_(err): boolean
Parameters
errRecord<string, unknown> | { code: string }RequiredReturns
boolean
booleanbooleanInherited from
TransactionBaseService.shouldRetryTransaction_
update
update(idempotencyKey, update): Promise<IdempotencyKey>
Locks an idempotency.
Parameters
idempotencyKeystringRequiredReturns
Promise<IdempotencyKey>
result of the update operation
withTransaction
withTransaction(transactionManager?): IdempotencyKeyService
Parameters
transactionManagerEntityManagerReturns
Inherited from
TransactionBaseService.withTransaction
workStage
workStage(idempotencyKey, callback): Promise<IdempotencyKey>
Performs an atomic work stage. An atomic work stage contains some related functionality, that needs to be transactionally executed in isolation. An idempotent request will always consist of 2 or more of these phases. The required phases are "started" and "finished".
Parameters
idempotencyKeystringRequiredReturns
Promise<IdempotencyKey>