UNPKG

@daiso-tech/core

Version:

The library offers flexible, framework-agnostic solutions for modern web applications, built on adaptable components that integrate seamlessly with popular frameworks like Next Js.

72 lines (71 loc) 2.66 kB
/** * @module Lock */ import { type Key } from "../../namespace/_module.js"; /** * The error is thrown when trying to acquire a lock that is owned by a different owner. * * IMPORT_PATH: `"@daiso-tech/core/lock/contracts"` * @group Errors */ export declare class FailedAcquireLockError extends Error { static create(key: Key, cause?: unknown): FailedAcquireLockError; /** * Note: Do not instantiate `FailedAcquireLockError` directly via the constructor. Use the static `create()` factory method instead. * The constructor remains public only to maintain compatibility with errorPolicy types and prevent type errors. * @internal */ constructor(message: string, cause?: unknown); } /** * The error is thrown when trying to release a lock that is owned by a different owner. * * IMPORT_PATH: `"@daiso-tech/core/lock/contracts"` * @group Errors */ export declare class FailedReleaseLockError extends Error { static create(key: Key, lockId: string, cause?: unknown): FailedReleaseLockError; /** * Note: Do not instantiate `FailedReleaseLockError` directly via the constructor. Use the static `create()` factory method instead. * The constructor remains public only to maintain compatibility with errorPolicy types and prevent type errors. * @internal */ constructor(message: string, cause?: unknown); } /** * The error is thrown when trying to referesh a lock that is owned by a different owner. * * IMPORT_PATH: `"@daiso-tech/core/lock/contracts"` * @group Errors */ export declare class FailedRefreshLockError extends Error { static create(key: Key, lockId: string, cause?: unknown): FailedRefreshLockError; /** * Note: Do not instantiate `FailedRefreshLockError` directly via the constructor. Use the static `create()` factory method instead. * The constructor remains public only to maintain compatibility with errorPolicy types and prevent type errors. * @internal */ constructor(message: string, cause?: unknown); } /** * * IMPORT_PATH: `"@daiso-tech/core/lock/contracts"` * @group Errors */ export declare const LOCK_ERRORS: { readonly FailedAcquire: typeof FailedAcquireLockError; readonly FailedRelease: typeof FailedReleaseLockError; readonly FailedRefresh: typeof FailedRefreshLockError; }; /** * * IMPORT_PATH: `"@daiso-tech/core/lock/contracts"` * @group Errors */ export type AllLockErrors = FailedAcquireLockError | FailedReleaseLockError | FailedRefreshLockError; /** * * IMPORT_PATH: `"@daiso-tech/core/lock/contracts"` * @group Errors */ export declare function isLockError(value: unknown): value is AllLockErrors;