n8n/packages/cli/src/scheduling/workflow-node-task-payload.ts
n8n-cat-bot[bot] bbc8e83e5d
chore: Share the workflow-node task payload type and guard between the schedule- and poll-trigger tasks (#38038)
Co-authored-by: n8n-cat-bot[bot] <n8n-cat-bot[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-08 09:24:23 +00:00

15 lines
570 B
TypeScript

const isNonEmptyString = (value: unknown): value is string =>
typeof value === 'string' && value !== '';
/** What a task payload carries to name a node inside a workflow. */
export interface WorkflowNodeTaskPayload {
workflowId: string;
nodeId: string;
}
/** Validates the payload snapshot the materializer copied from the job onto the task. */
export const isWorkflowNodeTaskPayload = (
payload: Record<string, unknown>,
): payload is Record<string, unknown> & WorkflowNodeTaskPayload =>
isNonEmptyString(payload.workflowId) && isNonEmptyString(payload.nodeId);