UNPKG

syncguard

Version:

Functional TypeScript library for distributed locking across microservices. Prevents race conditions with Redis, PostgreSQL, Firestore, and custom backends. Features automatic lock management, timeout handling, and extensible architecture.

17 lines (16 loc) 595 B
import { LockError } from "../common/backend.js"; /** * Maps PostgreSQL errors to LockError instances. * * @param error - Error from postgres.js * @returns LockError with appropriate code */ export declare function mapPostgresError(error: unknown): LockError; /** * Throws LockError("Aborted") if signal is aborted. * Used for manual AbortSignal checking since postgres.js doesn't natively support it. * * @param signal - Optional AbortSignal to check * @throws {LockError} With code "Aborted" if signal is aborted */ export declare function checkAborted(signal?: AbortSignal): void;