/** * The structural part of a Cloudflare Workflow instance used to prove that a * failed create call actually left an addressable durable instance behind. */ export interface CloudflareWorkflowInstanceLike { status(): Promise; } /** The structural binding implemented by Cloudflare's `Workflow`. */ export interface CloudflareWorkflowBindingLike = CloudflareWorkflowInstanceLike> { create(input: { id: string; params: TParams; }): Promise; get(id: string): Promise; } export interface EnsureCloudflareWorkflowInstanceResult> { instance: TInstance; /** False only when create failed but the same id was proven readable. */ created: boolean; /** Present on reuse because reading status is the proof the instance exists. */ status?: TStatus; } /** * Create one durable Workflow instance, or prove an instance with the same id * already exists before accepting a create error as an idempotent retry. * * Cloudflare does not expose a stable duplicate-error class. Matching error * text can therefore swallow unrelated failures. This helper uses the durable * resource itself as proof: `get(id).status()` must succeed, otherwise the * original create error is rethrown. */ export declare function ensureCloudflareWorkflowInstance>(binding: CloudflareWorkflowBindingLike, input: { id: string; params: TParams; }): Promise>;