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.

70 lines (69 loc) 2.72 kB
/** * @module Lock */ import { type IKey } from "../../namespace/contracts/_module.js"; import { type InferInstance } from "../../utilities/_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: IKey, 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: IKey, 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 refresh 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: IKey, 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 = InferInstance<(typeof LOCK_ERRORS)[keyof typeof LOCK_ERRORS]>; /** * IMPORT_PATH: `"@daiso-tech/core/lock/contracts"` * @group Errors */ export declare function isLockError(value: unknown): value is AllLockErrors;