UNPKG

@dossierhq/core

Version:

The core Dossier library used by clients and server alike, used to interact with schema and entities directly, as well as remotely through a client.

17 lines (16 loc) 846 B
import { ErrorType, type ErrorResult, type PromiseResult } from '../ErrorResult.js'; import type { AdvisoryLockOptions, Component, Entity } from '../Types.js'; import type { DossierClient } from './DossierClient.js'; interface AdvisoryLockHelperOptions extends AdvisoryLockOptions { acquireInterval: number; renewInterval: number; } type AdvisoryLockHelperStatus = { active: true; renewError: null; } | { active: false; renewError: ErrorResult<unknown, typeof ErrorType.Generic>; }; export declare function withAdvisoryLock<TOk, TError extends ErrorType>(client: DossierClient<Entity<string, object>, Component<string, object>>, name: string, options: AdvisoryLockHelperOptions, callback: (status: AdvisoryLockHelperStatus) => PromiseResult<TOk, TError>): PromiseResult<TOk, TError | typeof ErrorType.Generic>; export {};