本页还没有译文
本页 44 段还没译成한국어,下面显示的是英文原文。WorkflowBuilder
还没翻译译自英文(tanstack.com)本页 44 段都还没译
Interface: WorkflowBuilder<TInputSchema, TOutputSchema, TStateSchema, TCtxExt>
Defined in: packages/workflow-core/src/define/define-workflow.ts:84
Type Parameters
TInputSchema
TInputSchema extends SchemaInput | undefined
TOutputSchema
TOutputSchema extends SchemaInput | undefined
TStateSchema
TStateSchema extends SchemaInput | undefined
TCtxExt
TCtxExt = unknown
Properties
handler()
handler: <TActualOutput>(fn) => WorkflowDefinition<InferInput<TInputSchema>, TActualOutput, InferState<TStateSchema>>;Defined in: packages/workflow-core/src/define/define-workflow.ts:124
Finalize the workflow with its handler. The handler receives the fully-typed ctx — input, state, durable primitives, plus every field added by registered middleware.
The handler's actual return type narrows the workflow's
TOutput: writing return { orderId, reference } makes the
workflow definition carry that exact shape, no annotation needed.
When output: z.object(...) is declared, the return type is
constrained by the schema but the narrower inferred type wins for
consumers of WorkflowOutput<typeof wf>.
Type Parameters
TActualOutput
TActualOutput extends unknown
Parameters
fn
(ctx) => Promise<TActualOutput>
Returns
WorkflowDefinition<InferInput<TInputSchema>, TActualOutput, InferState<TStateSchema>>
middleware()
middleware: <TMiddlewares>(middlewares) => WorkflowBuilder<TInputSchema, TOutputSchema, TStateSchema, TCtxExt & UnionToIntersection<TMiddlewares[number] extends Middleware<any, TExtension> ? TExtension : never>>;Defined in: packages/workflow-core/src/define/define-workflow.ts:94
Register middlewares that extend the ctx for the handler. Each middleware's added fields are intersected into the ctx type.
Type Parameters
TMiddlewares
TMiddlewares extends readonly AnyMiddleware[]
Parameters
middlewares
TMiddlewares
Returns
WorkflowBuilder<TInputSchema, TOutputSchema, TStateSchema, TCtxExt & UnionToIntersection<TMiddlewares[number] extends Middleware<any, TExtension> ? TExtension : never>>
previousVersions()
previousVersions: (versions) => WorkflowBuilder<TInputSchema, TOutputSchema, TStateSchema, TCtxExt>;Defined in: packages/workflow-core/src/define/define-workflow.ts:108
Register prior workflow versions that may still have in-flight runs. Resume calls for a run started under one of these versions route to that version's handler.
Parameters
versions
readonly AnyWorkflowDefinition[]
Returns
WorkflowBuilder<TInputSchema, TOutputSchema, TStateSchema, TCtxExt>