Skip to content

MemoryLockContractError — @gj-kit/toss-payments-postgresql

A public class from @gj-kit/toss-payments-postgresql/testing. The signature below is taken directly from the 0.5.1 release declaration.

import { MemoryLockContractError } from '@gj-kit/toss-payments-postgresql/testing';
/**
* Thrown by the in-memory aggregate where the PostgreSQL aggregate would deadlock or lose its
* single-transaction guarantee. `code` is the contract; messages carry no keys or secrets.
*
* Nesting is detected through `AsyncLocalStorage`, so it is judged by where a lock API call is
* *started*, not by whether the callback awaits it: a lock call launched inside a callback and
* left un-awaited (for example a "late webhook" fired while the issuance callback still holds
* the lock) is refused exactly like an awaited one, even though PostgreSQL with a pool larger
* than one would queue it and serve it after the commit. This is the fake's deliberate stricter
* direction — it cannot tell the two apart and the awaited form is a real self-deadlock. To model
* a competing caller, start it from outside the callback after a "started" gate, as in the README
* contention example. Work scheduled from a callback that runs *after* the callback settled
* (timers, `setImmediate`) is not nesting and is served normally.
*/
declare class MemoryLockContractError extends Error {
readonly name = "MemoryLockContractError";
readonly code: MemoryLockContractErrorCode;
constructor(code: MemoryLockContractErrorCode, message: string);
}

This declaration is the source of truth for parameters, optionality, generics, return values, and public union/type contracts. Check the package golden path and this subpath’s import conditions for required environment, permission, and error boundaries before calling it.

  • Package: @gj-kit/toss-payments-postgresql
  • Version: 0.5.1
  • Public entry: ./testing
  • Source: GitHub