import { ExecutionPolicyConcurrency, ExecutionPolicyDefInput, ExecutionPolicyExactInstance, ExecutionPolicyGroupOptions, ExecutionPolicyInstance, ExecutionPolicyWildcardInstance, ResolvedExecutionPolicyInstance } from "./execution-policy.types.mjs"; //#region src/configure/services/workflow/execution-policy.d.ts type ResolveKey = Def extends { key: infer K extends string; } ? K : Fallback; type ResolveMatchType = Def extends { matchType: infer M extends "exact" | "prefix"; } ? M : "exact"; /** * Define a single workflow job function execution policy. * * Use this when declaring a policy outside the * {@link defineWorkflowExecutionPolicies} builder — for example, when the * runtime key prefix needs to differ from the corresponding workspace-unique * name. * * When `matchType: "prefix"` is set, the returned instance has `keyFor(suffix)` * instead of a directly-usable `key` (see {@link ExecutionPolicyWildcardInstance}). * @param name - Workspace-unique name. Must match `^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$`. * @param def - Optional overrides for `key` (defaults to `name`), `matchType`, `separator` (the `keyFor` join character, defaults to `.`), and concurrency * @returns An execution policy instance * @example * export const perTenant = defineWorkflowExecutionPolicy("tenant-api", { * matchType: "prefix", * concurrencyPolicy: { maxConcurrentExecutions: 3 }, * }); * * perTenant.keyFor(tenantId); // "tenant-api." */ export declare function defineWorkflowExecutionPolicy & { separator?: string; }) | undefined = undefined>(name: N, def?: D): ResolvedExecutionPolicyInstance, ResolveMatchType>; /** * Define a group of workflow job function execution policies. Property names * become the workspace-unique `name` and default `key` verbatim, matching the * mental model of {@link createWaitPoints}. Provide `name` / `key` explicitly * to override the property-name default (for example, when the property name * is not valid for the execution policy grammar or when the runtime key * prefix needs to differ). * * When `matchType: "prefix"` is set, the returned instance has `keyFor(suffix)` * instead of a directly-usable `key` (see {@link ExecutionPolicyWildcardInstance}). * `matchType` can be combined with an explicit `key`, or left to apply to * the property-name-derived prefix. * * The return type mirrors the builder's return type so JSDoc on each property * is preserved in IDE autocompletion. * @param builder - Callback that receives a `define` factory and returns a record of policies * @param options - Group-wide options; `separator` overrides the `.` `keyFor` uses to join the prefix and suffix for every prefix policy in the group * @returns The same object returned by the builder (with `name` / `key` resolved on each instance) * @example * export const executionPolicies = defineWorkflowExecutionPolicies((define) => ({ * premium: define({ concurrencyPolicy: { maxConcurrentExecutions: 5 } }), * "tenant-api": define({ * matchType: "prefix", * concurrencyPolicy: { maxConcurrentExecutions: 3 }, * }), * })); * * // In a workflow job body: * await worker.start(args, { * executionPolicyKey: executionPolicies.premium.key, * }); * await worker.start(args, { * executionPolicyKey: executionPolicies["tenant-api"].keyFor(input.tenantId), * }); */ export declare function defineWorkflowExecutionPolicies>(builder: (define: (def?: D) => ResolvedExecutionPolicyInstance, ResolveMatchType>) => T, options?: ExecutionPolicyGroupOptions): T; //#endregion export type { ExecutionPolicyConcurrency, ExecutionPolicyDefInput, ExecutionPolicyExactInstance, ExecutionPolicyGroupOptions, ExecutionPolicyInstance, ExecutionPolicyWildcardInstance, ResolvedExecutionPolicyInstance };