/** * Only allow one instance of the callback to run at a time for a given `scope` values. */ export declare function withLock(scope: ValidLockScope, callback: () => Promise | ReturnType): Promise; export declare function withLock(scope: ValidLockScope, acquireLockSignal: AbortSignal | undefined, callback: () => Promise | ReturnType): Promise; /** * Check if a lock is currently active for a given `scope` values. */ export declare function isLockActive(scope: ValidLockScope): boolean; /** * Acquire a lock for a given `scope` values. */ export declare function acquireLock(scope: ValidLockScope, acquireLockSignal?: AbortSignal): Promise>; /** * Wait for a lock to be released for a given `scope` values. */ export declare function waitForLockRelease(scope: ValidLockScope, signal?: AbortSignal): Promise; export type Lock = { scope: Scope; dispose(): void; [Symbol.dispose](): void; }; /** * Ensure that the scope array contains at least one object, otherwise it will be `never`. */ export type ValidLockScope = IncludesObject extends true ? Readonly : InvalidScopeError<"Scope array must include at least one object reference">; type IncludesObject = true extends ({ [K in keyof T]: readonly [T[K]] extends readonly [object] ? true : false; }[keyof T]) ? true : false; type InvalidScopeError = readonly unknown[] & { error: Message; __error: never; }; export {}; //# sourceMappingURL=withLock.d.ts.map