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.

18 lines (17 loc) 1.15 kB
// SPDX-FileCopyrightText: 2025-present Kriasoft // SPDX-License-Identifier: MIT export { acquireHandle, decorateAcquireResult } from "./common/disposable.js"; // Configuration Constants export { BACKEND_DEFAULTS, BACKEND_LIMITS, FENCE_THRESHOLDS, LOCK_DEFAULTS, MAX_KEY_LENGTH_BYTES, RESERVE_BYTES, } from "./common/constants.js"; // Core Functions and Classes export { LockError } from "./common/errors.js"; export { normalizeAndValidateKey, validateLockId, } from "./common/validation.js"; export { generateLockId, hashKey, makeStorageKey } from "./common/crypto.js"; // Primary lock API with automatic retry and cleanup export { lock } from "./common/auto-lock.js"; // Diagnostic helpers for lock inspection and ownership verification export { getById, getByIdRaw, getByKey, getByKeyRaw, hasFence, owns, sanitizeLockInfo, } from "./common/helpers.js"; // Telemetry - Opt-in observability decorator (ADR-007) export { withTelemetry } from "./common/telemetry.js"; // Time Predicates - Backend implementations use these for lock expiry checks export { calculateRedisServerTimeMs, isLive, TIME_TOLERANCE_MS, } from "./common/time-predicates.js";