Function: claimKey()
claimKey<
DB>(tx,request):Promise<IdempotencyClaim>
Defined in: packages/persistence/src/idempotency.ts:125
Claims a key for the scope's actor, inside the mutation's own transaction.
The claim is an INSERT ... ON CONFLICT DO NOTHING, so two concurrent first
requests serialise on the unique index: the second waits for the first to commit,
then sees a replay. Use read committed (the default); a snapshot isolation level
would not see the winner's row.
Type Parameters
DB
DB extends IdempotencyTables
Parameters
tx
Open<DB>
The open transaction of the mutation, tenant or platform.
request
Key, contract and request hash.
Returns
Promise<IdempotencyClaim>
new, replay or conflict.
Throws
invalid_input for a malformed key or hash.