@convex-dev/workflow
Version:
Convex component for durably executing workflows.
11 lines • 489 B
JavaScript
export async function getWorkflow(ctx, workflowId, expectedGenerationNumber) {
const workflow = await ctx.db.get("workflows", workflowId);
if (!workflow) {
throw new Error(`Workflow not found: ${workflowId}`);
}
if (workflow.generationNumber !== expectedGenerationNumber) {
throw new Error(`Invalid generation number: ${expectedGenerationNumber} for workflow ${workflow.name} (${workflowId})`);
}
return workflow;
}
//# sourceMappingURL=model.js.map