UNPKG

@medusajs/index

Version:
33 lines 1.08 kB
import { ILockingModule, Logger } from "@medusajs/types"; export declare class Orchestrator { #private; /** * The current state of the orchestrator */ get state(): "error" | "idle" | "processing" | "completed"; /** * Reference to the currently processed entity */ get current(): string; /** * Reference to the number of entities left for processing */ get remainingCount(): number; constructor(lockingModule: ILockingModule, entities: string[], options: { lockDuration: number; logger: Logger; }); /** * Acquires or renew the lock for a given key. */ renewLock(forKey: string): Promise<boolean>; /** * Run the orchestrator to process the entities one by one. * * - Task runner is the implementation function to execute a task. * Orchestrator has no inbuilt execution logic and it relies on * the task runner for the same. */ process(taskRunner: (entity: string) => Promise<void>): Promise<void>; } //# sourceMappingURL=orchestrator.d.ts.map