@powerhousedao/workflow 6.2.3-dev.79 → 6.2.3-dev.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/browser/BlockSelector-DFX-DZHl.js.map +1 -1
  2. package/dist/browser/document-models/index.js +2 -2
  3. package/dist/browser/document-models/workflow/index.js +3 -3
  4. package/dist/browser/{document-models-B2IDRvBZ.js → document-models-DUSvG-I2.js} +2 -2
  5. package/dist/browser/{document-models-B2IDRvBZ.js.map → document-models-DUSvG-I2.js.map} +1 -1
  6. package/dist/browser/{editor-B1-_KRbr.js → editor-BhHN0OWh.js} +2 -2
  7. package/dist/browser/{editor-B1-_KRbr.js.map → editor-BhHN0OWh.js.map} +1 -1
  8. package/dist/browser/{editor-DPGuck1V.js → editor-CnW8q20z.js} +8 -8
  9. package/dist/browser/editor-CnW8q20z.js.map +1 -0
  10. package/dist/browser/{editor-DBcq58Fr.js → editor-NLSJ5rWx.js} +10 -7
  11. package/dist/browser/editor-NLSJ5rWx.js.map +1 -0
  12. package/dist/browser/editors/connection-editor/module.js +1 -1
  13. package/dist/browser/editors/workflow-editor/module.js +1 -1
  14. package/dist/browser/editors/workflow-studio/module.js +1 -1
  15. package/dist/browser/index.js +2 -2
  16. package/dist/browser/{module-DFCANOuI.js → module-DxRdnkW2.js} +47 -5
  17. package/dist/browser/module-DxRdnkW2.js.map +1 -0
  18. package/dist/browser/reactor/index.js +2 -2
  19. package/dist/browser/{trigger-text-B2mo1fiB.js → trigger-text-BIeZ9W1H.js} +22 -2
  20. package/dist/browser/trigger-text-BIeZ9W1H.js.map +1 -0
  21. package/dist/browser/{upgrade-manifests-B62uqKVp.js → upgrade-manifests-bahiFXsr.js} +2 -2
  22. package/dist/browser/{upgrade-manifests-B62uqKVp.js.map → upgrade-manifests-bahiFXsr.js.map} +1 -1
  23. package/dist/browser/{workflow-DjTleFFO.js → workflow-DZt1eS1f.js} +4 -3
  24. package/dist/browser/workflow-DZt1eS1f.js.map +1 -0
  25. package/dist/node/BlockSelector-DosVPXzD.mjs.map +1 -1
  26. package/dist/node/document-models/index.mjs +2 -2
  27. package/dist/node/document-models/workflow/index.mjs +3 -3
  28. package/dist/node/{editor-DM9cnkfv.mjs → editor-C3OhQ_xs.mjs} +10 -7
  29. package/dist/node/editor-C3OhQ_xs.mjs.map +1 -0
  30. package/dist/node/{editor-BIpWFiaF.mjs → editor-D4-ZHfHJ.mjs} +2 -2
  31. package/dist/node/{editor-BIpWFiaF.mjs.map → editor-D4-ZHfHJ.mjs.map} +1 -1
  32. package/dist/node/{editor-DF1FOgnC.mjs → editor-D9S3pWvR.mjs} +8 -8
  33. package/dist/node/editor-D9S3pWvR.mjs.map +1 -0
  34. package/dist/node/editors/connection-editor/module.mjs +1 -1
  35. package/dist/node/editors/workflow-editor/module.mjs +1 -1
  36. package/dist/node/editors/workflow-studio/module.mjs +1 -1
  37. package/dist/node/index.mjs +2 -2
  38. package/dist/node/{module-DV3LLvxo.mjs → module-D9Zx5Zow.mjs} +47 -5
  39. package/dist/node/module-D9Zx5Zow.mjs.map +1 -0
  40. package/dist/node/pieces/reactor/descriptor.json +37 -2
  41. package/dist/node/pieces/reactor/index.mjs +1 -1
  42. package/dist/node/pieces/reactor/package.json +2 -2
  43. package/dist/node/{trigger-text-BRqIHmRS.mjs → trigger-text-CmYejeFN.mjs} +22 -2
  44. package/dist/node/trigger-text-CmYejeFN.mjs.map +1 -0
  45. package/dist/node/{upgrade-manifests-CO9zzPnE.mjs → upgrade-manifests-VF8Jt_YR.mjs} +2 -2
  46. package/dist/node/{upgrade-manifests-CO9zzPnE.mjs.map → upgrade-manifests-VF8Jt_YR.mjs.map} +1 -1
  47. package/dist/node/{workflow-BS5m4jtr.mjs → workflow-DqF9VsBQ.mjs} +4 -3
  48. package/dist/node/workflow-DqF9VsBQ.mjs.map +1 -0
  49. package/dist/powerhouse.manifest.json +2 -2
  50. package/dist/style.css +1 -1
  51. package/dist/types/document-models/document-models.d.ts +1 -0
  52. package/dist/types/document-models/document-models.d.ts.map +1 -1
  53. package/dist/types/document-models/workflow/v1/actions.d.ts +1 -0
  54. package/dist/types/document-models/workflow/v1/actions.d.ts.map +1 -1
  55. package/dist/types/document-models/workflow/v1/gen/document-model.d.ts.map +1 -1
  56. package/dist/types/document-models/workflow/v1/gen/document-schema.d.ts +3 -0
  57. package/dist/types/document-models/workflow/v1/gen/document-schema.d.ts.map +1 -1
  58. package/dist/types/document-models/workflow/v1/gen/ph-factories.d.ts.map +1 -1
  59. package/dist/types/document-models/workflow/v1/gen/reducer.d.ts.map +1 -1
  60. package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts +16 -0
  61. package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts.map +1 -1
  62. package/dist/types/document-models/workflow/v1/gen/schema/zod.d.ts +3 -1
  63. package/dist/types/document-models/workflow/v1/gen/schema/zod.d.ts.map +1 -1
  64. package/dist/types/document-models/workflow/v1/gen/utils.d.ts.map +1 -1
  65. package/dist/types/document-models/workflow/v1/gen/workflow/actions.d.ts +6 -2
  66. package/dist/types/document-models/workflow/v1/gen/workflow/actions.d.ts.map +1 -1
  67. package/dist/types/document-models/workflow/v1/gen/workflow/creators.d.ts +3 -2
  68. package/dist/types/document-models/workflow/v1/gen/workflow/creators.d.ts.map +1 -1
  69. package/dist/types/document-models/workflow/v1/gen/workflow/operations.d.ts +2 -1
  70. package/dist/types/document-models/workflow/v1/gen/workflow/operations.d.ts.map +1 -1
  71. package/dist/types/document-models/workflow/v1/module.d.ts +1 -0
  72. package/dist/types/document-models/workflow/v1/module.d.ts.map +1 -1
  73. package/dist/types/document-models/workflow/v1/src/reducers/workflow.d.ts.map +1 -1
  74. package/dist/types/document-models/workflow/v1/tests/managed-by.test.d.ts +2 -0
  75. package/dist/types/document-models/workflow/v1/tests/managed-by.test.d.ts.map +1 -0
  76. package/dist/types/editors/shared/DocumentErrorBoundary.d.ts.map +1 -1
  77. package/dist/types/editors/workflow-editor/document/useWorkflowModel.d.ts.map +1 -1
  78. package/dist/types/editors/workflow-editor/ui/PublishControls.d.ts +4 -0
  79. package/dist/types/editors/workflow-editor/ui/PublishControls.d.ts.map +1 -1
  80. package/dist/types/editors/workflow-editor/ui/WorkflowEditorApp.d.ts.map +1 -1
  81. package/dist/types/editors/workflow-editor/ui/model.d.ts +5 -0
  82. package/dist/types/editors/workflow-editor/ui/model.d.ts.map +1 -1
  83. package/dist/types/pieces/reactor/index.d.ts.map +1 -1
  84. package/dist/types/pieces/reactor/lib/actions/index-query.d.ts +12 -0
  85. package/dist/types/pieces/reactor/lib/actions/index-query.d.ts.map +1 -0
  86. package/dist/types/pieces/reactor/lib/input-schema.d.ts.map +1 -1
  87. package/package.json +8 -8
  88. package/dist/browser/editor-DBcq58Fr.js.map +0 -1
  89. package/dist/browser/editor-DPGuck1V.js.map +0 -1
  90. package/dist/browser/module-DFCANOuI.js.map +0 -1
  91. package/dist/browser/trigger-text-B2mo1fiB.js.map +0 -1
  92. package/dist/browser/workflow-DjTleFFO.js.map +0 -1
  93. package/dist/node/editor-DF1FOgnC.mjs.map +0 -1
  94. package/dist/node/editor-DM9cnkfv.mjs.map +0 -1
  95. package/dist/node/module-DV3LLvxo.mjs.map +0 -1
  96. package/dist/node/trigger-text-BRqIHmRS.mjs.map +0 -1
  97. package/dist/node/workflow-BS5m4jtr.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"module-DV3LLvxo.mjs","names":["z","workflowWorkflowActions","workflowTriggerActions","workflowStepsActions","workflowEdgesActions","workflowVariablesActions","workflowPolicyActions","workflowRuntimeActions","workflowPublishingActions","utils","genUtils","customUtils"],"sources":["../../document-models/workflow/v1/gen/schema/zod.ts","../../document-models/workflow/v1/gen/edges/creators.ts","../../document-models/workflow/v1/gen/policy/creators.ts","../../document-models/workflow/v1/gen/publishing/creators.ts","../../document-models/workflow/v1/gen/runtime/creators.ts","../../document-models/workflow/v1/gen/steps/creators.ts","../../document-models/workflow/v1/gen/trigger/creators.ts","../../document-models/workflow/v1/gen/variables/creators.ts","../../document-models/workflow/v1/gen/workflow/creators.ts","../../document-models/workflow/v1/actions.ts","../../document-models/workflow/v1/gen/document-model.ts","../../document-models/workflow/v1/gen/edges/error.ts","../../document-models/workflow/v1/src/reducers/edges.ts","../../document-models/workflow/v1/src/reducers/policy.ts","../../document-models/workflow/v1/gen/publishing/error.ts","../../document-models/workflow/v1/src/helpers.ts","../../document-models/workflow/v1/src/reducers/publishing.ts","../../document-models/workflow/v1/gen/runtime/error.ts","../../document-models/workflow/v1/src/reducers/runtime.ts","../../document-models/workflow/v1/gen/steps/error.ts","../../document-models/workflow/v1/src/reducers/steps.ts","../../document-models/workflow/v1/gen/trigger/error.ts","../../document-models/workflow/v1/src/reducers/trigger.ts","../../document-models/workflow/v1/gen/variables/error.ts","../../document-models/workflow/v1/src/reducers/variables.ts","../../document-models/workflow/v1/gen/workflow/error.ts","../../document-models/workflow/v1/src/reducers/workflow.ts","../../document-models/workflow/v1/gen/reducer.ts","../../document-models/workflow/upgrades/versions.ts","../../document-models/workflow/upgrades/upgrade-manifest.ts","../../document-models/workflow/v1/gen/document-type.ts","../../document-models/workflow/v1/gen/document-schema.ts","../../document-models/workflow/v1/gen/utils.ts","../../document-models/workflow/v1/src/utils.ts","../../document-models/workflow/v1/utils.ts","../../document-models/workflow/v1/module.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-object-type */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport * as z from \"zod\";\nimport type {\n AddEdgeInput,\n AddStepInput,\n AddStepPositionInput,\n AddStepPropertySettingInput,\n AddStepRetryPolicyInput,\n BackoffKind,\n ClearTriggerInput,\n ConcurrencyMode,\n FailureMode,\n Point,\n PropertyMode,\n PropertySetting,\n PublishWorkflowInput,\n PublishedWorkflow,\n RemoveEdgeInput,\n RemoveStepInput,\n RemoveVariableInput,\n RetryPolicy,\n RevertToPublishedInput,\n RunStatus,\n SetLastRunInput,\n SetLastTestInput,\n SetPolicyInput,\n SetPolicyRetryPolicyInput,\n SetStepConfigInput,\n SetStepConfigPropertySettingInput,\n SetTriggerConfigInput,\n SetTriggerConfigPropertySettingInput,\n SetTriggerConnectionInput,\n SetTriggerInput,\n SetTriggerPieceVersionInput,\n SetTriggerPropertySettingInput,\n SetVariableInput,\n SetWorkflowDescriptionInput,\n SetWorkflowNameInput,\n SetWorkflowStatusInput,\n StepTestRecord,\n TriggerBinding,\n UpdateStepInput,\n UpdateStepPositionInput,\n UpdateStepRetryPolicyInput,\n VariableType,\n WorkflowEdge,\n WorkflowPolicy,\n WorkflowState,\n WorkflowStatus,\n WorkflowStep,\n WorkflowVariable,\n} from \"./types.js\";\n\ntype Properties<T> = Required<{\n [K in keyof T]: z.ZodType<T[K]>;\n}>;\n\ntype definedNonNullAny = {};\n\nexport const isDefinedNonNullAny = (v: any): v is definedNonNullAny =>\n v !== undefined && v !== null;\n\nexport const definedNonNullAnySchema = z\n .any()\n .refine((v) => isDefinedNonNullAny(v));\n\nexport const BackoffKindSchema = z.enum([\"EXPONENTIAL\", \"FIXED\"]);\n\nexport const ConcurrencyModeSchema = z.enum([\"PARALLEL\", \"QUEUE\", \"SINGLETON\"]);\n\nexport const FailureModeSchema = z.enum([\"IGNORE\", \"NOTIFY\", \"PARK\"]);\n\nexport const PropertyModeSchema = z.enum([\"EXPRESSION\", \"MANUAL\"]);\n\nexport const RunStatusSchema = z.enum([\n \"CANCELLED\",\n \"FAILED\",\n \"PARKED\",\n \"PENDING\",\n \"RUNNING\",\n \"SUCCEEDED\",\n \"WAITING\",\n]);\n\nexport const VariableTypeSchema = z.enum([\n \"BOOLEAN\",\n \"JSON\",\n \"NUMBER\",\n \"SECRET\",\n \"TEXT\",\n]);\n\nexport const WorkflowStatusSchema = z.enum([\n \"ARCHIVED\",\n \"DISABLED\",\n \"DRAFT\",\n \"ENABLED\",\n]);\n\nexport function AddEdgeInputSchema(): z.ZodObject<Properties<AddEdgeInput>> {\n return z.object({\n condition: z.string().nullish(),\n from: z.string(),\n id: z.string(),\n port: z.string(),\n to: z.string(),\n });\n}\n\nexport function AddStepInputSchema(): z.ZodObject<Properties<AddStepInput>> {\n return z.object({\n actionName: z.string(),\n config: z.unknown(),\n connectionId: z.string().nullish(),\n id: z.string(),\n idempotencyKeyExpression: z.string().nullish(),\n key: z.string(),\n name: z.string(),\n pieceName: z.string(),\n pieceVersion: z.string(),\n position: z.lazy(() => AddStepPositionInputSchema().nullish()),\n propertySettings: z\n .array(z.lazy(() => AddStepPropertySettingInputSchema()))\n .nullish(),\n reactorConnectionId: z.string().nullish(),\n retry: z.lazy(() => AddStepRetryPolicyInputSchema().nullish()),\n skip: z.boolean().nullish(),\n timeoutSeconds: z.number().nullish(),\n });\n}\n\nexport function AddStepPositionInputSchema(): z.ZodObject<\n Properties<AddStepPositionInput>\n> {\n return z.object({\n x: z.number(),\n y: z.number(),\n });\n}\n\nexport function AddStepPropertySettingInputSchema(): z.ZodObject<\n Properties<AddStepPropertySettingInput>\n> {\n return z.object({\n mode: PropertyModeSchema,\n prop: z.string(),\n schema: z.unknown().nullish(),\n });\n}\n\nexport function AddStepRetryPolicyInputSchema(): z.ZodObject<\n Properties<AddStepRetryPolicyInput>\n> {\n return z.object({\n backoff: BackoffKindSchema,\n initialDelaySeconds: z.number(),\n maxAttempts: z.number(),\n maxDelaySeconds: z.number(),\n retryOn: z.array(z.string()),\n });\n}\n\nexport function ClearTriggerInputSchema(): z.ZodObject<\n Properties<ClearTriggerInput>\n> {\n return z.object({\n _: z.boolean().nullish(),\n });\n}\n\nexport function PointSchema(): z.ZodObject<Properties<Point>> {\n return z.object({\n __typename: z.literal(\"Point\").optional(),\n x: z.number(),\n y: z.number(),\n });\n}\n\nexport function PropertySettingSchema(): z.ZodObject<\n Properties<PropertySetting>\n> {\n return z.object({\n __typename: z.literal(\"PropertySetting\").optional(),\n mode: PropertyModeSchema,\n prop: z.string(),\n schema: z.unknown().nullish(),\n });\n}\n\nexport function PublishWorkflowInputSchema(): z.ZodObject<\n Properties<PublishWorkflowInput>\n> {\n return z.object({\n publishedAt: z.iso.datetime(),\n });\n}\n\nexport function PublishedWorkflowSchema(): z.ZodObject<\n Properties<PublishedWorkflow>\n> {\n return z.object({\n __typename: z.literal(\"PublishedWorkflow\").optional(),\n edges: z.array(z.lazy(() => WorkflowEdgeSchema())),\n policy: z.lazy(() => WorkflowPolicySchema()),\n publishedAt: z.iso.datetime(),\n steps: z.array(z.lazy(() => WorkflowStepSchema())),\n trigger: z.lazy(() => TriggerBindingSchema().nullish()),\n variables: z.array(z.lazy(() => WorkflowVariableSchema())),\n version: z.number(),\n });\n}\n\nexport function RemoveEdgeInputSchema(): z.ZodObject<\n Properties<RemoveEdgeInput>\n> {\n return z.object({\n id: z.string(),\n });\n}\n\nexport function RemoveStepInputSchema(): z.ZodObject<\n Properties<RemoveStepInput>\n> {\n return z.object({\n id: z.string(),\n });\n}\n\nexport function RemoveVariableInputSchema(): z.ZodObject<\n Properties<RemoveVariableInput>\n> {\n return z.object({\n id: z.string(),\n });\n}\n\nexport function RetryPolicySchema(): z.ZodObject<Properties<RetryPolicy>> {\n return z.object({\n __typename: z.literal(\"RetryPolicy\").optional(),\n backoff: BackoffKindSchema,\n initialDelaySeconds: z.number(),\n maxAttempts: z.number(),\n maxDelaySeconds: z.number(),\n retryOn: z.array(z.string()),\n });\n}\n\nexport function RevertToPublishedInputSchema(): z.ZodObject<\n Properties<RevertToPublishedInput>\n> {\n return z.object({\n _: z.boolean().nullish(),\n });\n}\n\nexport function SetLastRunInputSchema(): z.ZodObject<\n Properties<SetLastRunInput>\n> {\n return z.object({\n lastRunAt: z.iso.datetime(),\n lastRunStatus: RunStatusSchema,\n });\n}\n\nexport function SetLastTestInputSchema(): z.ZodObject<\n Properties<SetLastTestInput>\n> {\n return z.object({\n id: z.string(),\n runId: z.string(),\n testedAt: z.iso.datetime(),\n });\n}\n\nexport function SetPolicyInputSchema(): z.ZodObject<\n Properties<SetPolicyInput>\n> {\n return z.object({\n concurrency: ConcurrencyModeSchema.nullish(),\n defaultRetry: z.lazy(() => SetPolicyRetryPolicyInputSchema().nullish()),\n journalAsDocument: z.boolean().nullish(),\n maxParallelRuns: z.number().nullish(),\n maxSuspensionDays: z.number().nullish(),\n onFailure: FailureModeSchema.nullish(),\n retainRunsDays: z.number().nullish(),\n runTimeoutSeconds: z.number().nullish(),\n });\n}\n\nexport function SetPolicyRetryPolicyInputSchema(): z.ZodObject<\n Properties<SetPolicyRetryPolicyInput>\n> {\n return z.object({\n backoff: BackoffKindSchema,\n initialDelaySeconds: z.number(),\n maxAttempts: z.number(),\n maxDelaySeconds: z.number(),\n retryOn: z.array(z.string()),\n });\n}\n\nexport function SetStepConfigInputSchema(): z.ZodObject<\n Properties<SetStepConfigInput>\n> {\n return z.object({\n config: z.unknown(),\n id: z.string(),\n propertySettings: z\n .array(z.lazy(() => SetStepConfigPropertySettingInputSchema()))\n .nullish(),\n });\n}\n\nexport function SetStepConfigPropertySettingInputSchema(): z.ZodObject<\n Properties<SetStepConfigPropertySettingInput>\n> {\n return z.object({\n mode: PropertyModeSchema,\n prop: z.string(),\n schema: z.unknown().nullish(),\n });\n}\n\nexport function SetTriggerConfigInputSchema(): z.ZodObject<\n Properties<SetTriggerConfigInput>\n> {\n return z.object({\n config: z.unknown(),\n propertySettings: z\n .array(z.lazy(() => SetTriggerConfigPropertySettingInputSchema()))\n .nullish(),\n });\n}\n\nexport function SetTriggerConfigPropertySettingInputSchema(): z.ZodObject<\n Properties<SetTriggerConfigPropertySettingInput>\n> {\n return z.object({\n mode: PropertyModeSchema,\n prop: z.string(),\n schema: z.unknown().nullish(),\n });\n}\n\nexport function SetTriggerConnectionInputSchema(): z.ZodObject<\n Properties<SetTriggerConnectionInput>\n> {\n return z.object({\n connectionId: z.string().nullish(),\n reactorConnectionId: z.string().nullish(),\n });\n}\n\nexport function SetTriggerInputSchema(): z.ZodObject<\n Properties<SetTriggerInput>\n> {\n return z.object({\n config: z.unknown(),\n connectionId: z.string().nullish(),\n id: z.string(),\n pieceName: z.string(),\n pieceVersion: z.string(),\n propertySettings: z\n .array(z.lazy(() => SetTriggerPropertySettingInputSchema()))\n .nullish(),\n reactorConnectionId: z.string().nullish(),\n triggerName: z.string(),\n });\n}\n\nexport function SetTriggerPieceVersionInputSchema(): z.ZodObject<\n Properties<SetTriggerPieceVersionInput>\n> {\n return z.object({\n pieceVersion: z.string(),\n });\n}\n\nexport function SetTriggerPropertySettingInputSchema(): z.ZodObject<\n Properties<SetTriggerPropertySettingInput>\n> {\n return z.object({\n mode: PropertyModeSchema,\n prop: z.string(),\n schema: z.unknown().nullish(),\n });\n}\n\nexport function SetVariableInputSchema(): z.ZodObject<\n Properties<SetVariableInput>\n> {\n return z.object({\n description: z.string().nullish(),\n id: z.string(),\n key: z.string(),\n type: VariableTypeSchema.nullish(),\n value: z.unknown().nullish(),\n });\n}\n\nexport function SetWorkflowDescriptionInputSchema(): z.ZodObject<\n Properties<SetWorkflowDescriptionInput>\n> {\n return z.object({\n description: z.string().nullish(),\n });\n}\n\nexport function SetWorkflowNameInputSchema(): z.ZodObject<\n Properties<SetWorkflowNameInput>\n> {\n return z.object({\n name: z.string(),\n });\n}\n\nexport function SetWorkflowStatusInputSchema(): z.ZodObject<\n Properties<SetWorkflowStatusInput>\n> {\n return z.object({\n status: WorkflowStatusSchema,\n });\n}\n\nexport function StepTestRecordSchema(): z.ZodObject<\n Properties<StepTestRecord>\n> {\n return z.object({\n __typename: z.literal(\"StepTestRecord\").optional(),\n runId: z.string(),\n testedAt: z.iso.datetime(),\n });\n}\n\nexport function TriggerBindingSchema(): z.ZodObject<\n Properties<TriggerBinding>\n> {\n return z.object({\n __typename: z.literal(\"TriggerBinding\").optional(),\n config: z.unknown(),\n connectionId: z.string().nullish(),\n id: z.string(),\n lastTest: z.lazy(() => StepTestRecordSchema().nullish()),\n pieceName: z.string(),\n pieceVersion: z.string(),\n propertySettings: z.array(z.lazy(() => PropertySettingSchema())).nullish(),\n reactorConnectionId: z.string().nullish(),\n triggerName: z.string(),\n updatedAt: z.iso.datetime().nullish(),\n });\n}\n\nexport function UpdateStepInputSchema(): z.ZodObject<\n Properties<UpdateStepInput>\n> {\n return z.object({\n actionName: z.string().nullish(),\n config: z.unknown().nullish(),\n connectionId: z.string().nullish(),\n id: z.string(),\n idempotencyKeyExpression: z.string().nullish(),\n key: z.string().nullish(),\n name: z.string().nullish(),\n pieceName: z.string().nullish(),\n pieceVersion: z.string().nullish(),\n position: z.lazy(() => UpdateStepPositionInputSchema().nullish()),\n reactorConnectionId: z.string().nullish(),\n retry: z.lazy(() => UpdateStepRetryPolicyInputSchema().nullish()),\n skip: z.boolean().nullish(),\n timeoutSeconds: z.number().nullish(),\n });\n}\n\nexport function UpdateStepPositionInputSchema(): z.ZodObject<\n Properties<UpdateStepPositionInput>\n> {\n return z.object({\n x: z.number(),\n y: z.number(),\n });\n}\n\nexport function UpdateStepRetryPolicyInputSchema(): z.ZodObject<\n Properties<UpdateStepRetryPolicyInput>\n> {\n return z.object({\n backoff: BackoffKindSchema,\n initialDelaySeconds: z.number(),\n maxAttempts: z.number(),\n maxDelaySeconds: z.number(),\n retryOn: z.array(z.string()),\n });\n}\n\nexport function WorkflowEdgeSchema(): z.ZodObject<Properties<WorkflowEdge>> {\n return z.object({\n __typename: z.literal(\"WorkflowEdge\").optional(),\n condition: z.string().nullish(),\n from: z.string(),\n id: z.string(),\n port: z.string(),\n to: z.string(),\n });\n}\n\nexport function WorkflowPolicySchema(): z.ZodObject<\n Properties<WorkflowPolicy>\n> {\n return z.object({\n __typename: z.literal(\"WorkflowPolicy\").optional(),\n concurrency: ConcurrencyModeSchema,\n defaultRetry: z.lazy(() => RetryPolicySchema()),\n journalAsDocument: z.boolean(),\n maxParallelRuns: z.number().nullish(),\n maxSuspensionDays: z.number(),\n onFailure: FailureModeSchema,\n retainRunsDays: z.number(),\n runTimeoutSeconds: z.number(),\n });\n}\n\nexport function WorkflowStateSchema(): z.ZodObject<Properties<WorkflowState>> {\n return z.object({\n __typename: z.literal(\"WorkflowState\").optional(),\n description: z.string().nullish(),\n edges: z.array(z.lazy(() => WorkflowEdgeSchema())),\n lastRunAt: z.iso.datetime().nullish(),\n lastRunStatus: RunStatusSchema.nullish(),\n name: z.string(),\n policy: z.lazy(() => WorkflowPolicySchema()),\n published: z.lazy(() => PublishedWorkflowSchema().nullish()),\n status: WorkflowStatusSchema,\n steps: z.array(z.lazy(() => WorkflowStepSchema())),\n trigger: z.lazy(() => TriggerBindingSchema().nullish()),\n variables: z.array(z.lazy(() => WorkflowVariableSchema())),\n version: z.number(),\n });\n}\n\nexport function WorkflowStepSchema(): z.ZodObject<Properties<WorkflowStep>> {\n return z.object({\n __typename: z.literal(\"WorkflowStep\").optional(),\n actionName: z.string(),\n config: z.unknown(),\n connectionId: z.string().nullish(),\n id: z.string(),\n idempotencyKeyExpression: z.string().nullish(),\n key: z.string(),\n lastTest: z.lazy(() => StepTestRecordSchema().nullish()),\n name: z.string(),\n pieceName: z.string(),\n pieceVersion: z.string(),\n position: z.lazy(() => PointSchema().nullish()),\n propertySettings: z.array(z.lazy(() => PropertySettingSchema())).nullish(),\n reactorConnectionId: z.string().nullish(),\n retry: z.lazy(() => RetryPolicySchema().nullish()),\n skip: z.boolean().nullish(),\n timeoutSeconds: z.number().nullish(),\n updatedAt: z.iso.datetime().nullish(),\n });\n}\n\nexport function WorkflowVariableSchema(): z.ZodObject<\n Properties<WorkflowVariable>\n> {\n return z.object({\n __typename: z.literal(\"WorkflowVariable\").optional(),\n description: z.string().nullish(),\n id: z.string(),\n key: z.string(),\n type: VariableTypeSchema.nullish(),\n value: z.unknown().nullish(),\n });\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport { AddEdgeInputSchema, RemoveEdgeInputSchema } from \"../schema/zod.js\";\nimport type { AddEdgeInput, RemoveEdgeInput } from \"../types.js\";\nimport type { AddEdgeAction, RemoveEdgeAction } from \"./actions.js\";\n\nexport const addEdge = (input: AddEdgeInput) =>\n createAction<AddEdgeAction>(\n \"ADD_EDGE\",\n { ...input },\n undefined,\n AddEdgeInputSchema,\n \"global\",\n );\n\nexport const removeEdge = (input: RemoveEdgeInput) =>\n createAction<RemoveEdgeAction>(\n \"REMOVE_EDGE\",\n { ...input },\n undefined,\n RemoveEdgeInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport { SetPolicyInputSchema } from \"../schema/zod.js\";\nimport type { SetPolicyInput } from \"../types.js\";\nimport type { SetPolicyAction } from \"./actions.js\";\n\nexport const setPolicy = (input: SetPolicyInput) =>\n createAction<SetPolicyAction>(\n \"SET_POLICY\",\n { ...input },\n undefined,\n SetPolicyInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n PublishWorkflowInputSchema,\n RevertToPublishedInputSchema,\n} from \"../schema/zod.js\";\nimport type { PublishWorkflowInput, RevertToPublishedInput } from \"../types.js\";\nimport type {\n PublishWorkflowAction,\n RevertToPublishedAction,\n} from \"./actions.js\";\n\nexport const publishWorkflow = (input: PublishWorkflowInput) =>\n createAction<PublishWorkflowAction>(\n \"PUBLISH_WORKFLOW\",\n { ...input },\n undefined,\n PublishWorkflowInputSchema,\n \"global\",\n );\n\nexport const revertToPublished = (input: RevertToPublishedInput) =>\n createAction<RevertToPublishedAction>(\n \"REVERT_TO_PUBLISHED\",\n { ...input },\n undefined,\n RevertToPublishedInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n SetLastRunInputSchema,\n SetLastTestInputSchema,\n} from \"../schema/zod.js\";\nimport type { SetLastRunInput, SetLastTestInput } from \"../types.js\";\nimport type { SetLastRunAction, SetLastTestAction } from \"./actions.js\";\n\nexport const setLastRun = (input: SetLastRunInput) =>\n createAction<SetLastRunAction>(\n \"SET_LAST_RUN\",\n { ...input },\n undefined,\n SetLastRunInputSchema,\n \"global\",\n );\n\nexport const setLastTest = (input: SetLastTestInput) =>\n createAction<SetLastTestAction>(\n \"SET_LAST_TEST\",\n { ...input },\n undefined,\n SetLastTestInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n AddStepInputSchema,\n RemoveStepInputSchema,\n SetStepConfigInputSchema,\n UpdateStepInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n AddStepInput,\n RemoveStepInput,\n SetStepConfigInput,\n UpdateStepInput,\n} from \"../types.js\";\nimport type {\n AddStepAction,\n RemoveStepAction,\n SetStepConfigAction,\n UpdateStepAction,\n} from \"./actions.js\";\n\nexport const addStep = (input: AddStepInput) =>\n createAction<AddStepAction>(\n \"ADD_STEP\",\n { ...input },\n undefined,\n AddStepInputSchema,\n \"global\",\n );\n\nexport const updateStep = (input: UpdateStepInput) =>\n createAction<UpdateStepAction>(\n \"UPDATE_STEP\",\n { ...input },\n undefined,\n UpdateStepInputSchema,\n \"global\",\n );\n\nexport const removeStep = (input: RemoveStepInput) =>\n createAction<RemoveStepAction>(\n \"REMOVE_STEP\",\n { ...input },\n undefined,\n RemoveStepInputSchema,\n \"global\",\n );\n\nexport const setStepConfig = (input: SetStepConfigInput) =>\n createAction<SetStepConfigAction>(\n \"SET_STEP_CONFIG\",\n { ...input },\n undefined,\n SetStepConfigInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n ClearTriggerInputSchema,\n SetTriggerConfigInputSchema,\n SetTriggerConnectionInputSchema,\n SetTriggerInputSchema,\n SetTriggerPieceVersionInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n ClearTriggerInput,\n SetTriggerConfigInput,\n SetTriggerConnectionInput,\n SetTriggerInput,\n SetTriggerPieceVersionInput,\n} from \"../types.js\";\nimport type {\n ClearTriggerAction,\n SetTriggerAction,\n SetTriggerConfigAction,\n SetTriggerConnectionAction,\n SetTriggerPieceVersionAction,\n} from \"./actions.js\";\n\nexport const setTrigger = (input: SetTriggerInput) =>\n createAction<SetTriggerAction>(\n \"SET_TRIGGER\",\n { ...input },\n undefined,\n SetTriggerInputSchema,\n \"global\",\n );\n\nexport const clearTrigger = (input: ClearTriggerInput) =>\n createAction<ClearTriggerAction>(\n \"CLEAR_TRIGGER\",\n { ...input },\n undefined,\n ClearTriggerInputSchema,\n \"global\",\n );\n\nexport const setTriggerConfig = (input: SetTriggerConfigInput) =>\n createAction<SetTriggerConfigAction>(\n \"SET_TRIGGER_CONFIG\",\n { ...input },\n undefined,\n SetTriggerConfigInputSchema,\n \"global\",\n );\n\nexport const setTriggerConnection = (input: SetTriggerConnectionInput) =>\n createAction<SetTriggerConnectionAction>(\n \"SET_TRIGGER_CONNECTION\",\n { ...input },\n undefined,\n SetTriggerConnectionInputSchema,\n \"global\",\n );\n\nexport const setTriggerPieceVersion = (input: SetTriggerPieceVersionInput) =>\n createAction<SetTriggerPieceVersionAction>(\n \"SET_TRIGGER_PIECE_VERSION\",\n { ...input },\n undefined,\n SetTriggerPieceVersionInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n RemoveVariableInputSchema,\n SetVariableInputSchema,\n} from \"../schema/zod.js\";\nimport type { RemoveVariableInput, SetVariableInput } from \"../types.js\";\nimport type { RemoveVariableAction, SetVariableAction } from \"./actions.js\";\n\nexport const setVariable = (input: SetVariableInput) =>\n createAction<SetVariableAction>(\n \"SET_VARIABLE\",\n { ...input },\n undefined,\n SetVariableInputSchema,\n \"global\",\n );\n\nexport const removeVariable = (input: RemoveVariableInput) =>\n createAction<RemoveVariableAction>(\n \"REMOVE_VARIABLE\",\n { ...input },\n undefined,\n RemoveVariableInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n SetWorkflowDescriptionInputSchema,\n SetWorkflowNameInputSchema,\n SetWorkflowStatusInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n SetWorkflowDescriptionInput,\n SetWorkflowNameInput,\n SetWorkflowStatusInput,\n} from \"../types.js\";\nimport type {\n SetWorkflowDescriptionAction,\n SetWorkflowNameAction,\n SetWorkflowStatusAction,\n} from \"./actions.js\";\n\nexport const setWorkflowName = (input: SetWorkflowNameInput) =>\n createAction<SetWorkflowNameAction>(\n \"SET_WORKFLOW_NAME\",\n { ...input },\n undefined,\n SetWorkflowNameInputSchema,\n \"global\",\n );\n\nexport const setWorkflowDescription = (input: SetWorkflowDescriptionInput) =>\n createAction<SetWorkflowDescriptionAction>(\n \"SET_WORKFLOW_DESCRIPTION\",\n { ...input },\n undefined,\n SetWorkflowDescriptionInputSchema,\n \"global\",\n );\n\nexport const setWorkflowStatus = (input: SetWorkflowStatusInput) =>\n createAction<SetWorkflowStatusAction>(\n \"SET_WORKFLOW_STATUS\",\n { ...input },\n undefined,\n SetWorkflowStatusInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { baseActions } from \"document-model\";\nimport {\n workflowEdgesActions,\n workflowPolicyActions,\n workflowPublishingActions,\n workflowRuntimeActions,\n workflowStepsActions,\n workflowTriggerActions,\n workflowVariablesActions,\n workflowWorkflowActions,\n} from \"./gen/creators.js\";\n\n/** Actions for the Workflow document model */\n\nexport const actions = {\n ...baseActions,\n ...workflowWorkflowActions,\n ...workflowTriggerActions,\n ...workflowStepsActions,\n ...workflowEdgesActions,\n ...workflowVariablesActions,\n ...workflowPolicyActions,\n ...workflowRuntimeActions,\n ...workflowPublishingActions,\n};\n","import type { DocumentModelGlobalState } from \"document-model\";\n\nexport const documentModel: DocumentModelGlobalState = {\n id: \"powerhouse/workflow\",\n name: \"Workflow\",\n author: {\n name: \"Powerhouse\",\n website: \"https://www.powerhouse.inc\",\n },\n extension: \".flow\",\n description:\n \"Workflow definition: trigger, steps, edges, variables and execution policy for the Powerhouse workflow automation runtime.\",\n specifications: [\n {\n state: {\n local: {\n schema: \"\",\n examples: [],\n initialValue: \"\",\n },\n global: {\n schema:\n 'enum WorkflowStatus {\\n DRAFT\\n ENABLED\\n DISABLED\\n ARCHIVED\\n}\\n\\nenum RunStatus {\\n PENDING\\n RUNNING\\n WAITING\\n SUCCEEDED\\n FAILED\\n CANCELLED\\n PARKED\\n}\\n\\nenum ConcurrencyMode {\\n SINGLETON\\n QUEUE\\n PARALLEL\\n}\\n\\nenum FailureMode {\\n PARK\\n NOTIFY\\n IGNORE\\n}\\n\\nenum BackoffKind {\\n FIXED\\n EXPONENTIAL\\n}\\n\\ntype RetryPolicy {\\n \"Attempts, not retries: 1 is no retry. Clamped to 10 by the runtime, since each attempt re-runs a side effect and holds the run\\'s worker slot.\"\\n maxAttempts: Int!\\n backoff: BackoffKind!\\n initialDelaySeconds: Int!\\n maxDelaySeconds: Int!\\n \"Error classes that are retryable, matched against the error\\'s class name or anywhere in its message, case-insensitively. EMPTY admits every error: an empty list with maxAttempts > 1 means retry, not never-retry.\"\\n retryOn: [String!]!\\n}\\n\\nenum PropertyMode {\\n \"The field\\'s own control.\"\\n MANUAL\\n \"The author switched the field to a free {{\\u2026}} expression.\"\\n EXPRESSION\\n}\\n\\ntype PropertySetting {\\n prop: String!\\n mode: PropertyMode!\\n \"Resolved DynamicProperties children, options stripped.\"\\n schema: Unknown\\n}\\n\\n\"Reference to the latest test run in the run store.\"\\ntype StepTestRecord {\\n runId: String!\\n testedAt: DateTime!\\n}\\n\\n\"Layout only. The runtime ignores it.\"\\ntype Point {\\n x: Float!\\n y: Float!\\n}\\n\\ntype TriggerBinding {\\n id: OID!\\n \"Package name of the trigger\\'s piece, e.g. \\'@powerhousedao/piece-core\\' or \\'@acme/piece-imap\\'.\"\\n pieceName: String!\\n \"Exact semver of the piece, e.g. \\'1.2.0\\'.\"\\n pieceVersion: String!\\n \"Trigger name within the piece, e.g. \\'schedule\\' or \\'new_message\\'.\"\\n triggerName: String!\\n \"Connection document id, when the trigger\\'s connector requires one.\"\\n connectionId: PHID\\n \"Reactor connection document id, when the trigger declares requireReactor.\"\\n reactorConnectionId: PHID\\n \"Validated against the trigger\\'s configSchema.\"\\n config: Unknown!\\n propertySettings: [PropertySetting!]\\n lastTest: StepTestRecord\\n \"Timestamp of the last real edit; a lastTest before it is stale.\"\\n updatedAt: DateTime\\n}\\n\\ntype WorkflowStep {\\n id: OID!\\n \"Author-visible label; unique within the workflow; used in expressions.\"\\n key: String!\\n name: String!\\n \"Package name of the step\\'s piece, e.g. \\'@powerhousedao/piece-core\\' or \\'@activepieces/piece-http\\'.\"\\n pieceName: String!\\n \"Exact semver of the piece, e.g. \\'0.11.19\\'.\"\\n pieceVersion: String!\\n \"Action name within the piece, e.g. \\'branch\\' or \\'send_request\\'.\"\\n actionName: String!\\n connectionId: PHID\\n \"Reactor connection document id, when the action declares requireReactor.\"\\n reactorConnectionId: PHID\\n config: Unknown!\\n \"ENFORCED. Per-step override of the workflow default retry policy.\"\\n retry: RetryPolicy\\n \"ENFORCED. Also raises the cap on each host call the step\\'s piece makes, which is never shorter than the step\\'s own timeout.\"\\n timeoutSeconds: Int\\n \"NOT YET ENFORCED. Expression yielding a stable key; two executions with the same key are one side effect. A fire is deduplicated on its trigger operation or a trigger item\\'s _dedupe_key, never on a step expression.\"\\n idempotencyKeyExpression: String\\n position: Point\\n propertySettings: [PropertySetting!]\\n lastTest: StepTestRecord\\n \"Skipped steps are passed over at run time.\"\\n skip: Boolean\\n \"Timestamp of the last real edit; a lastTest before it is stale.\"\\n updatedAt: DateTime\\n}\\n\\ntype WorkflowEdge {\\n id: OID!\\n \"Source step id, or the trigger id for the entry edge.\"\\n from: OID!\\n to: OID!\\n \"Output port of the source, one it declares: \\'next\\' and \\'error\\' for a piece action, \\'next\\' for the trigger, \\'true\\', \\'false\\' and \\'error\\' for a branch.\"\\n port: String!\\n \"Optional guard expression; the edge is taken only when it evaluates truthy.\"\\n condition: String\\n}\\n\\nenum VariableType {\\n TEXT\\n NUMBER\\n BOOLEAN\\n JSON\\n \"value is a secret-provider handle (the format of a connection SecretRef.ref), never the plaintext.\"\\n SECRET\\n}\\n\\ntype WorkflowVariable {\\n id: OID!\\n \"Name used in expressions.\"\\n key: String!\\n \"The value a run reads as variables.<key>.\"\\n value: Unknown\\n description: String\\n \"Null means untyped; consumers infer the kind of value it holds.\"\\n type: VariableType\\n}\\n\\ntype WorkflowPolicy {\\n \"ENFORCED. SINGLETON drops a firing while a run is active (journaled CANCELLED, not dropped silently); QUEUE serialises; PARALLEL runs concurrently.\"\\n concurrency: ConcurrencyMode!\\n \"ENFORCED under PARALLEL: how many runs of this workflow may execute at once; null is unbounded. SINGLETON and QUEUE are 1 by definition.\"\\n maxParallelRuns: Int\\n \"ENFORCED. Checked between steps and while a retry waits; past it the run ends CANCELLED.\"\\n runTimeoutSeconds: Int!\\n \"NOT YET ENFORCED. Bounds how long a run may stay suspended on a waitpoint - but nothing suspends: waitpoints, run.pause and generateResumeUrl all throw, so there is no suspended state to bound.\"\\n maxSuspensionDays: Int!\\n \"ENFORCED. The fallback for a step with no retry of its own.\"\\n defaultRetry: RetryPolicy!\\n \"ENFORCED. What happens to a run whose steps have all failed terminally: PARK takes the trigger out of the supervisor\\'s ENABLED set until the workflow is re-published or re-enabled, NOTIFY logs at error level (the only notification channel this engine has), IGNORE does nothing.\"\\n onFailure: FailureMode!\\n \"NOT YET ENFORCED per workflow. Retention is a journal-wide sweep on the relational handle, which has no reactor read to resolve a per-workflow window with; PH_WORKFLOWS_RUN_RETENTION_DAYS (30 days by default) is the control that applies.\"\\n retainRunsDays: Int!\\n \"NOT YET ENFORCED. The run journal is relational; there is no run document model to write.\"\\n journalAsDocument: Boolean!\\n}\\n\\n\"Snapshot of the draft taken by PUBLISH_WORKFLOW.\"\\ntype PublishedWorkflow {\\n \"Draft version the snapshot was taken at.\"\\n version: Int!\\n publishedAt: DateTime!\\n trigger: TriggerBinding\\n steps: [WorkflowStep!]!\\n edges: [WorkflowEdge!]!\\n variables: [WorkflowVariable!]!\\n policy: WorkflowPolicy!\\n}\\n\\ntype WorkflowState {\\n name: String!\\n description: String\\n \"Only ENABLED workflows get trigger instances.\"\\n status: WorkflowStatus!\\n \"Bumped on every draft edit; REVERT_TO_PUBLISHED resets it to published.version. A run records the version it executed.\"\\n version: Int!\\n trigger: TriggerBinding\\n steps: [WorkflowStep!]!\\n edges: [WorkflowEdge!]!\\n variables: [WorkflowVariable!]!\\n policy: WorkflowPolicy!\\n \"Last published snapshot; version !== published.version means unpublished changes.\"\\n published: PublishedWorkflow\\n \"Denormalised for inspectors; written by the runtime.\"\\n lastRunAt: DateTime\\n lastRunStatus: RunStatus\\n}',\n examples: [],\n initialValue:\n '{\\n \"name\": \"\",\\n \"description\": null,\\n \"status\": \"DRAFT\",\\n \"version\": 0,\\n \"trigger\": null,\\n \"steps\": [],\\n \"edges\": [],\\n \"variables\": [],\\n \"policy\": {\\n \"concurrency\": \"QUEUE\",\\n \"maxParallelRuns\": null,\\n \"runTimeoutSeconds\": 3600,\\n \"maxSuspensionDays\": 30,\\n \"defaultRetry\": {\\n \"maxAttempts\": 1,\\n \"backoff\": \"FIXED\",\\n \"initialDelaySeconds\": 5,\\n \"maxDelaySeconds\": 300,\\n \"retryOn\": []\\n },\\n \"onFailure\": \"PARK\",\\n \"retainRunsDays\": 30,\\n \"journalAsDocument\": false\\n },\\n \"published\": null,\\n \"lastRunAt\": null,\\n \"lastRunStatus\": null\\n}',\n },\n },\n modules: [\n {\n id: \"2bcbeac5-6a42-4dd7-ad9a-a11401acfa67\",\n name: \"workflow\",\n description: \"Workflow identity and lifecycle status.\",\n operations: [\n {\n id: \"63c4df18-df11-4f17-8afa-69da90129dd9\",\n name: \"SET_WORKFLOW_NAME\",\n description: \"Sets the workflow name.\",\n schema: \"input SetWorkflowNameInput {\\n name: String!\\n}\",\n template: \"Sets the workflow name.\",\n reducer: \"state.name = action.input.name;\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"2875c3ae-6fc6-4ebb-9274-6f8318227945\",\n name: \"SET_WORKFLOW_DESCRIPTION\",\n description: \"Sets or clears the workflow description.\",\n schema:\n \"input SetWorkflowDescriptionInput {\\n description: String\\n}\",\n template: \"Sets or clears the workflow description.\",\n reducer: \"state.description = action.input.description || null;\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"6b4f8fb2-db70-4707-985d-47cff171dbec\",\n name: \"SET_WORKFLOW_STATUS\",\n description:\n \"Sets the lifecycle status. The trigger supervisor watches this to create or tear down trigger instances.\",\n schema:\n \"input SetWorkflowStatusInput {\\n status: WorkflowStatus!\\n}\",\n template:\n \"Sets the lifecycle status. The trigger supervisor watches this to create or tear down trigger instances.\",\n reducer: \"state.status = action.input.status;\",\n errors: [\n {\n id: \"ceb06c52-61b3-4c92-826f-9d2f87fb64d6\",\n name: \"WorkflowNotPublishedError\",\n code: \"WORKFLOW_NOT_PUBLISHED\",\n description:\n \"ENABLED needs a published snapshot; publish the workflow first.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"e1dc35a8-a050-4773-a6a2-6b41f0a6210c\",\n name: \"trigger\",\n description: \"Binding of the workflow's single trigger.\",\n operations: [\n {\n id: \"f1f2ac35-7d6f-4b2c-b1a4-f220f290fdad\",\n name: \"SET_TRIGGER\",\n description:\n \"Sets or replaces the trigger binding. Omitted propertySettings and lastTest carry over when the id, piece, version and trigger name are unchanged.\",\n schema:\n \"input SetTriggerPropertySettingInput {\\n prop: String!\\n mode: PropertyMode!\\n schema: Unknown\\n}\\n\\ninput SetTriggerInput {\\n id: OID!\\n pieceName: String!\\n pieceVersion: String!\\n triggerName: String!\\n connectionId: PHID\\n reactorConnectionId: PHID\\n config: Unknown!\\n propertySettings: [SetTriggerPropertySettingInput!]\\n}\",\n template:\n \"Sets or replaces the trigger binding. Omitted propertySettings and lastTest carry over when the id, piece, version and trigger name are unchanged.\",\n reducer:\n \"state.trigger = {\\n id: action.input.id,\\n pieceName: action.input.pieceName,\\n pieceVersion: action.input.pieceVersion,\\n triggerName: action.input.triggerName,\\n connectionId: action.input.connectionId || null,\\n config: action.input.config,\\n filter: action.input.filter ?? null,\\n};\\nstate.version += 1;\",\n errors: [\n {\n id: \"2191e673-e5b7-4e27-921d-3534f95fc095\",\n name: \"InvalidTriggerBlockError\",\n code: \"INVALID_TRIGGER_BLOCK\",\n description:\n \"The trigger names no piece or trigger, or its piece version is not an exact semver.\",\n template: \"\",\n },\n {\n id: \"cf3fced2-61c0-41a1-a0de-664ee00b2e25\",\n name: \"TriggerConfigNotObjectError\",\n code: \"TRIGGER_CONFIG_NOT_OBJECT\",\n description: \"The trigger's config is not a JSON object.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"351e16a9-78c3-4466-a25f-e8b09eb0b956\",\n name: \"CLEAR_TRIGGER\",\n description: \"Removes the trigger binding.\",\n schema: \"input ClearTriggerInput {\\n _: Boolean\\n}\",\n template: \"Removes the trigger binding.\",\n reducer:\n 'if (!state.trigger) {\\n throw new TriggerNotSetError(\"Workflow has no trigger to clear\");\\n}\\nstate.trigger = null;\\nstate.version += 1;',\n errors: [\n {\n id: \"fe485734-5e01-4af9-aaa9-adcc45e3160a\",\n name: \"TriggerNotSetError\",\n code: \"TRIGGER_NOT_SET\",\n description: \"The workflow has no trigger binding to clear.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"0a3d9845-efae-4044-b982-e7c653d1c40f\",\n name: \"SET_TRIGGER_CONFIG\",\n description:\n \"Replaces the trigger's block configuration, and optionally its property settings. The binding and connections stay as they are.\",\n schema:\n \"input SetTriggerConfigPropertySettingInput {\\n prop: String!\\n mode: PropertyMode!\\n schema: Unknown\\n}\\n\\ninput SetTriggerConfigInput {\\n config: Unknown!\\n propertySettings: [SetTriggerConfigPropertySettingInput!]\\n}\",\n template:\n \"Replaces the trigger's block configuration, and optionally its property settings. The binding and connections stay as they are.\",\n reducer: \"\",\n errors: [\n {\n id: \"b7896214-5bca-45ce-ac86-81da570070e7\",\n name: \"ConfigTriggerNotSetError\",\n code: \"CONFIG_TRIGGER_NOT_SET\",\n description: \"The workflow has no trigger to configure.\",\n template: \"\",\n },\n {\n id: \"ca5698b1-74c6-4abf-9712-db3010fa61cd\",\n name: \"SetTriggerConfigNotObjectError\",\n code: \"SET_TRIGGER_CONFIG_NOT_OBJECT\",\n description: \"The trigger's config is not a JSON object.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"14cb5145-22b9-47b9-8356-1fc59b52bf4b\",\n name: \"SET_TRIGGER_CONNECTION\",\n description:\n \"Sets the trigger's connections. Null clears one; an omitted one stays as it is.\",\n schema:\n \"input SetTriggerConnectionInput {\\n connectionId: PHID\\n reactorConnectionId: PHID\\n}\",\n template:\n \"Sets the trigger's connections. Null clears one; an omitted one stays as it is.\",\n reducer: \"\",\n errors: [\n {\n id: \"dc9f0c47-5091-44ae-b3f9-c9f658a50ce3\",\n name: \"ConnectionTriggerNotSetError\",\n code: \"CONNECTION_TRIGGER_NOT_SET\",\n description: \"The workflow has no trigger to connect.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"7ea44254-4aa1-4019-a2ce-0576418bcde0\",\n name: \"SET_TRIGGER_PIECE_VERSION\",\n description:\n \"Moves the trigger to another version of its piece, keeping its config, connections and property settings.\",\n schema:\n \"input SetTriggerPieceVersionInput {\\n pieceVersion: String!\\n}\",\n template:\n \"Moves the trigger to another version of its piece, keeping its config, connections and property settings.\",\n reducer: \"\",\n errors: [\n {\n id: \"f530e924-bfdd-4588-b7f5-73d087f162c2\",\n name: \"VersionTriggerNotSetError\",\n code: \"VERSION_TRIGGER_NOT_SET\",\n description: \"The workflow has no trigger to update.\",\n template: \"\",\n },\n {\n id: \"2e0bb17c-418b-459a-96e7-c0fc341fea46\",\n name: \"InvalidTriggerPieceVersionError\",\n code: \"INVALID_TRIGGER_PIECE_VERSION\",\n description: \"The piece version is not an exact semver.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"e3c8b542-657d-44b9-ad8c-472f8e01dbbf\",\n name: \"steps\",\n description: \"Step instances of blocks in the workflow graph.\",\n operations: [\n {\n id: \"d71c412f-9c48-4c1d-9d5b-f7c3cd18cecc\",\n name: \"ADD_STEP\",\n description: \"Adds a step to the workflow graph.\",\n schema:\n \"input AddStepRetryPolicyInput {\\n maxAttempts: Int!\\n backoff: BackoffKind!\\n initialDelaySeconds: Int!\\n maxDelaySeconds: Int!\\n retryOn: [String!]!\\n}\\n\\ninput AddStepPositionInput {\\n x: Float!\\n y: Float!\\n}\\n\\ninput AddStepPropertySettingInput {\\n prop: String!\\n mode: PropertyMode!\\n schema: Unknown\\n}\\n\\ninput AddStepInput {\\n id: OID!\\n key: String!\\n name: String!\\n pieceName: String!\\n pieceVersion: String!\\n actionName: String!\\n connectionId: PHID\\n reactorConnectionId: PHID\\n config: Unknown!\\n retry: AddStepRetryPolicyInput\\n timeoutSeconds: Int\\n idempotencyKeyExpression: String\\n position: AddStepPositionInput\\n skip: Boolean\\n propertySettings: [AddStepPropertySettingInput!]\\n}\",\n template: \"Adds a step to the workflow graph.\",\n reducer:\n 'if (state.steps.some((step) => step.id === action.input.id)) {\\n throw new DuplicateStepIdError(\"A step with this id already exists\");\\n}\\nif (state.steps.some((step) => step.key === action.input.key)) {\\n throw new DuplicateStepKeyError(\"A step with this key already exists\");\\n}\\nstate.steps.push({\\n id: action.input.id,\\n key: action.input.key,\\n name: action.input.name,\\n pieceName: action.input.pieceName,\\n pieceVersion: action.input.pieceVersion,\\n actionName: action.input.actionName,\\n connectionId: action.input.connectionId || null,\\n config: action.input.config,\\n retry: action.input.retry ?? null,\\n timeoutSeconds: action.input.timeoutSeconds ?? null,\\n idempotencyKeyExpression: action.input.idempotencyKeyExpression || null,\\n position: action.input.position ?? null,\\n});\\nstate.version += 1;',\n errors: [\n {\n id: \"9f42bbac-54a9-42bc-b6e6-86f158d1a474\",\n name: \"DuplicateStepIdError\",\n code: \"DUPLICATE_STEP_ID\",\n description: \"A step with the given id already exists.\",\n template: \"\",\n },\n {\n id: \"e9ef62ad-2b63-43f7-ac25-b0ab81f833c5\",\n name: \"DuplicateStepKeyError\",\n code: \"DUPLICATE_STEP_KEY\",\n description: \"A step with the given key already exists.\",\n template: \"\",\n },\n {\n id: \"62bbe509-cb42-47b4-92a9-9f407cee5128\",\n name: \"InvalidStepBlockError\",\n code: \"INVALID_STEP_BLOCK\",\n description:\n \"The step names no piece or action, or its piece version is not an exact semver.\",\n template: \"\",\n },\n {\n id: \"a802cfa8-43e7-4d4d-a1eb-13f6406dde63\",\n name: \"StepConfigNotObjectError\",\n code: \"STEP_CONFIG_NOT_OBJECT\",\n description: \"The new step's config is not a JSON object.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"12b4dad9-4a89-4a94-b2ff-fadbf492f555\",\n name: \"UPDATE_STEP\",\n description: \"Updates the provided fields of an existing step.\",\n schema:\n \"input UpdateStepRetryPolicyInput {\\n maxAttempts: Int!\\n backoff: BackoffKind!\\n initialDelaySeconds: Int!\\n maxDelaySeconds: Int!\\n retryOn: [String!]!\\n}\\n\\ninput UpdateStepPositionInput {\\n x: Float!\\n y: Float!\\n}\\n\\ninput UpdateStepInput {\\n id: OID!\\n key: String\\n name: String\\n pieceName: String\\n pieceVersion: String\\n actionName: String\\n connectionId: PHID\\n reactorConnectionId: PHID\\n config: Unknown\\n retry: UpdateStepRetryPolicyInput\\n timeoutSeconds: Int\\n idempotencyKeyExpression: String\\n position: UpdateStepPositionInput\\n skip: Boolean\\n}\",\n template: \"Updates the provided fields of an existing step.\",\n reducer:\n 'const step = state.steps.find((step) => step.id === action.input.id);\\nif (!step) {\\n throw new StepNotFoundError(\"Step not found\");\\n}\\nif (action.input.key) {\\n const conflict = state.steps.some(\\n (other) => other.key === action.input.key && other.id !== action.input.id,\\n );\\n if (conflict) {\\n throw new StepKeyConflictError(\"Another step already uses this key\");\\n }\\n step.key = action.input.key;\\n}\\nif (action.input.name) step.name = action.input.name;\\nif (action.input.pieceName) step.pieceName = action.input.pieceName;\\nif (action.input.pieceVersion) step.pieceVersion = action.input.pieceVersion;\\nif (action.input.actionName) step.actionName = action.input.actionName;\\nif (action.input.connectionId) step.connectionId = action.input.connectionId;\\nif (action.input.config !== undefined && action.input.config !== null) {\\n step.config = action.input.config;\\n}\\n// For the optional runtime fields null clears; undefined leaves as is.\\nif (action.input.retry !== undefined) {\\n step.retry = action.input.retry ?? null;\\n}\\nif (action.input.timeoutSeconds !== undefined) {\\n step.timeoutSeconds = action.input.timeoutSeconds ?? null;\\n}\\nif (action.input.idempotencyKeyExpression !== undefined) {\\n step.idempotencyKeyExpression = action.input.idempotencyKeyExpression || null;\\n}\\nif (action.input.position) step.position = action.input.position;\\nstate.version += 1;',\n errors: [\n {\n id: \"2f3f0a0b-555a-4350-86b4-5e7e86de8b8a\",\n name: \"StepNotFoundError\",\n code: \"STEP_NOT_FOUND\",\n description: \"No step exists with the given id.\",\n template: \"\",\n },\n {\n id: \"74f45aaf-68ae-49a9-bd3c-d1e5a50b0ea3\",\n name: \"StepKeyConflictError\",\n code: \"STEP_KEY_CONFLICT\",\n description: \"Another step already uses the given key.\",\n template: \"\",\n },\n {\n id: \"3db35060-c54a-445d-9202-3613bf90c8f4\",\n name: \"InvalidUpdateBlockError\",\n code: \"INVALID_UPDATE_BLOCK\",\n description:\n \"The update leaves the step with no piece or action, or with a piece version that is not an exact semver.\",\n template: \"\",\n },\n {\n id: \"3841fa5a-d989-43d0-90fa-dfb224f3c463\",\n name: \"UpdateConfigNotObjectError\",\n code: \"UPDATE_CONFIG_NOT_OBJECT\",\n description: \"The step's new config is not a JSON object.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"d01c89ca-3934-43b5-9540-9e45b415c772\",\n name: \"REMOVE_STEP\",\n description: \"Removes a step and every edge attached to it.\",\n schema: \"input RemoveStepInput {\\n id: OID!\\n}\",\n template: \"Removes a step and every edge attached to it.\",\n reducer:\n 'const index = state.steps.findIndex((step) => step.id === action.input.id);\\nif (index === -1) {\\n throw new RemoveStepNotFoundError(\"Step not found\");\\n}\\nstate.steps.splice(index, 1);\\nstate.edges = state.edges.filter(\\n (edge) => edge.from !== action.input.id && edge.to !== action.input.id,\\n);\\nstate.version += 1;',\n errors: [\n {\n id: \"2bc5f26f-975b-46a0-9df9-1dbac5bbd6eb\",\n name: \"RemoveStepNotFoundError\",\n code: \"REMOVE_STEP_NOT_FOUND\",\n description: \"No step exists with the given id.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"c83eb80e-8086-40e5-b8ed-fe3f72b664a6\",\n name: \"SET_STEP_CONFIG\",\n description:\n \"Replaces a step's block configuration, and optionally its property settings.\",\n schema:\n \"input SetStepConfigPropertySettingInput {\\n prop: String!\\n mode: PropertyMode!\\n schema: Unknown\\n}\\n\\ninput SetStepConfigInput {\\n id: OID!\\n config: Unknown!\\n propertySettings: [SetStepConfigPropertySettingInput!]\\n}\",\n template:\n \"Replaces a step's block configuration, and optionally its property settings.\",\n reducer:\n 'const step = state.steps.find((step) => step.id === action.input.id);\\nif (!step) {\\n throw new ConfigStepNotFoundError(\"Step not found\");\\n}\\nstep.config = action.input.config;\\nstate.version += 1;',\n errors: [\n {\n id: \"8ba30ce9-510e-4765-9955-23b4d76595ab\",\n name: \"ConfigStepNotFoundError\",\n code: \"CONFIG_STEP_NOT_FOUND\",\n description: \"No step exists with the given id.\",\n template: \"\",\n },\n {\n id: \"f6d05410-a1a8-4cab-8d7c-ea14506aa479\",\n name: \"SetConfigNotObjectError\",\n code: \"SET_CONFIG_NOT_OBJECT\",\n description: \"The step's config is not a JSON object.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"5f6223ad-23d1-4e2c-9680-8fd91234d785\",\n name: \"edges\",\n description: \"Directed edges between steps (and from the trigger).\",\n operations: [\n {\n id: \"293bcd32-7c85-42c9-846a-8c4ecde33154\",\n name: \"ADD_EDGE\",\n description:\n \"Adds an edge. The source may be a step or the trigger; the target must be a step.\",\n schema:\n \"input AddEdgeInput {\\n id: OID!\\n from: OID!\\n to: OID!\\n port: String!\\n condition: String\\n}\",\n template:\n \"Adds an edge. The source may be a step or the trigger; the target must be a step.\",\n reducer:\n 'if (state.edges.some((edge) => edge.id === action.input.id)) {\\n throw new DuplicateEdgeIdError(\"An edge with this id already exists\");\\n}\\nconst fromExists =\\n state.steps.some((step) => step.id === action.input.from) ||\\n state.trigger?.id === action.input.from;\\nif (!fromExists) {\\n throw new EdgeSourceNotFoundError(\"Edge source step or trigger not found\");\\n}\\nif (!state.steps.some((step) => step.id === action.input.to)) {\\n throw new EdgeTargetNotFoundError(\"Edge target step not found\");\\n}\\nif (wouldCycle(state.edges, action.input.from, action.input.to)) {\\n throw new EdgeCycleError(\"Edge would create a cycle in the workflow graph\");\\n}\\nstate.edges.push({\\n id: action.input.id,\\n from: action.input.from,\\n to: action.input.to,\\n port: action.input.port,\\n condition: action.input.condition || null,\\n});\\nstate.version += 1;',\n errors: [\n {\n id: \"aa22b9b5-bbd7-4d80-b6b6-573c5f761ed7\",\n name: \"DuplicateEdgeIdError\",\n code: \"DUPLICATE_EDGE_ID\",\n description: \"An edge with the given id already exists.\",\n template: \"\",\n },\n {\n id: \"5207d810-062d-4b83-82e3-e3f89d905a83\",\n name: \"EdgeSourceNotFoundError\",\n code: \"EDGE_SOURCE_NOT_FOUND\",\n description:\n \"The edge source references no existing step or trigger.\",\n template: \"\",\n },\n {\n id: \"39149b92-84b9-4429-a631-4d7e1981270c\",\n name: \"EdgeTargetNotFoundError\",\n code: \"EDGE_TARGET_NOT_FOUND\",\n description: \"The edge target references no existing step.\",\n template: \"\",\n },\n {\n id: \"6e4a5f2b-3c7d-4e19-9a2b-8d0c1f5e7a6b\",\n name: \"EdgeCycleError\",\n code: \"EDGE_CYCLE\",\n description:\n \"The edge would create a cycle in the workflow graph.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"ba545d3b-796d-4af3-b4c6-016401a691ff\",\n name: \"REMOVE_EDGE\",\n description: \"Removes an edge.\",\n schema: \"input RemoveEdgeInput {\\n id: OID!\\n}\",\n template: \"Removes an edge.\",\n reducer:\n 'const index = state.edges.findIndex((edge) => edge.id === action.input.id);\\nif (index === -1) {\\n throw new EdgeNotFoundError(\"Edge not found\");\\n}\\nstate.edges.splice(index, 1);\\nstate.version += 1;',\n errors: [\n {\n id: \"b7e2ffa4-7775-460d-aae8-0d82dce5ffcf\",\n name: \"EdgeNotFoundError\",\n code: \"EDGE_NOT_FOUND\",\n description: \"No edge exists with the given id.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"c003c578-94fd-40d1-8964-ea151ee56486\",\n name: \"variables\",\n description: \"Workflow-level inputs and defaults.\",\n operations: [\n {\n id: \"50745ece-569a-4d49-b649-8ec2de3dd2d9\",\n name: \"SET_VARIABLE\",\n description:\n \"Creates the variable with this id, or updates it (its key included). Keys are unique.\",\n schema:\n 'input SetVariableInput {\\n id: OID!\\n key: String!\\n value: Unknown\\n description: String\\n \"Undefined leaves an existing variable\\'s type unchanged; null clears it.\"\\n type: VariableType\\n}',\n template: \"Creates or updates a variable, keyed by its key.\",\n reducer:\n \"const existing = state.variables.find(\\n (variable) => variable.key === action.input.key,\\n);\\nif (existing) {\\n existing.value = action.input.value ?? null;\\n if (action.input.description) existing.description = action.input.description;\\n} else {\\n state.variables.push({\\n id: action.input.id,\\n key: action.input.key,\\n value: action.input.value ?? null,\\n description: action.input.description || null,\\n });\\n}\\nstate.version += 1;\",\n errors: [\n {\n id: \"50fa86ce-2616-47d3-9e9a-225c63efc08c\",\n name: \"SecretVariableValueError\",\n code: \"SECRET_VARIABLE_VALUE\",\n description:\n \"A SECRET variable's value must be a secret reference string or null.\",\n template: \"\",\n },\n {\n id: \"868842e4-3df4-4e62-9b98-adf70cd1acbb\",\n name: \"DuplicateVariableKeyError\",\n code: \"DUPLICATE_VARIABLE_KEY\",\n description: \"Another variable already uses the given key.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"d85b2b0a-085b-482e-a4be-401fa7e5faa2\",\n name: \"REMOVE_VARIABLE\",\n description: \"Removes a variable.\",\n schema: \"input RemoveVariableInput {\\n id: OID!\\n}\",\n template: \"Removes a variable.\",\n reducer:\n 'const index = state.variables.findIndex(\\n (variable) => variable.id === action.input.id,\\n);\\nif (index === -1) {\\n throw new VariableNotFoundError(\"Variable not found\");\\n}\\nstate.variables.splice(index, 1);\\nstate.version += 1;',\n errors: [\n {\n id: \"2b1913d2-6490-48f5-8bdb-5ec8e062c855\",\n name: \"VariableNotFoundError\",\n code: \"VARIABLE_NOT_FOUND\",\n description: \"No variable exists with the given id.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"956e2432-13b1-417a-b932-4286082ef7d4\",\n name: \"policy\",\n description: \"Execution policy for runs of this workflow.\",\n operations: [\n {\n id: \"e0a331e7-a4b0-4b93-8af7-d25e602932b8\",\n name: \"SET_POLICY\",\n description:\n \"Updates the provided fields of the execution policy.\",\n schema:\n \"input SetPolicyRetryPolicyInput {\\n maxAttempts: Int!\\n backoff: BackoffKind!\\n initialDelaySeconds: Int!\\n maxDelaySeconds: Int!\\n retryOn: [String!]!\\n}\\n\\ninput SetPolicyInput {\\n concurrency: ConcurrencyMode\\n maxParallelRuns: Int\\n runTimeoutSeconds: Int\\n maxSuspensionDays: Int\\n defaultRetry: SetPolicyRetryPolicyInput\\n onFailure: FailureMode\\n retainRunsDays: Int\\n journalAsDocument: Boolean\\n}\",\n template: \"Updates the provided fields of the execution policy.\",\n reducer:\n \"if (action.input.concurrency) state.policy.concurrency = action.input.concurrency;\\nif (action.input.maxParallelRuns !== undefined && action.input.maxParallelRuns !== null) {\\n state.policy.maxParallelRuns = action.input.maxParallelRuns;\\n}\\nif (action.input.runTimeoutSeconds !== undefined && action.input.runTimeoutSeconds !== null) {\\n state.policy.runTimeoutSeconds = action.input.runTimeoutSeconds;\\n}\\nif (action.input.maxSuspensionDays !== undefined && action.input.maxSuspensionDays !== null) {\\n state.policy.maxSuspensionDays = action.input.maxSuspensionDays;\\n}\\nif (action.input.defaultRetry) state.policy.defaultRetry = action.input.defaultRetry;\\nif (action.input.onFailure) state.policy.onFailure = action.input.onFailure;\\nif (action.input.retainRunsDays !== undefined && action.input.retainRunsDays !== null) {\\n state.policy.retainRunsDays = action.input.retainRunsDays;\\n}\\nif (action.input.journalAsDocument !== undefined && action.input.journalAsDocument !== null) {\\n state.policy.journalAsDocument = action.input.journalAsDocument;\\n}\\nstate.version += 1;\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"4c4656ac-62bb-498a-9a64-567a8e09ac09\",\n name: \"runtime\",\n description: \"Denormalised run info written by the workflow runtime.\",\n operations: [\n {\n id: \"cdaf7978-b846-4c3e-ae30-c5d87eac66a4\",\n name: \"SET_LAST_RUN\",\n description: \"Records the outcome of the most recent run.\",\n schema:\n \"input SetLastRunInput {\\n lastRunAt: DateTime!\\n lastRunStatus: RunStatus!\\n}\",\n template: \"Records the outcome of the most recent run.\",\n reducer:\n \"state.lastRunAt = action.input.lastRunAt;\\nstate.lastRunStatus = action.input.lastRunStatus;\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"a370b78b-53b6-4344-9a92-a600d8eda77e\",\n name: \"SET_LAST_TEST\",\n description:\n \"Records the latest test run of a step or the trigger. Does not bump version.\",\n schema:\n 'input SetLastTestInput {\\n \"Step id or trigger id.\"\\n id: OID!\\n runId: String!\\n testedAt: DateTime!\\n}',\n template:\n \"Records the latest test run of a step or the trigger. Does not bump version.\",\n reducer: \"\",\n errors: [\n {\n id: \"53f18e15-1623-4cd0-8be4-44d4286d5eab\",\n name: \"LastTestTargetNotFoundError\",\n code: \"LAST_TEST_TARGET_NOT_FOUND\",\n description: \"No step or trigger exists with the given id.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"d08ad3f2-8985-4b36-baae-4b870407bba8\",\n name: \"publishing\",\n description: \"Draft versus published snapshot of the workflow.\",\n operations: [\n {\n id: \"a0cc29cc-259a-4bc8-814d-0847883700eb\",\n name: \"PUBLISH_WORKFLOW\",\n description:\n \"Snapshots the draft trigger, steps, edges, variables and policy into published at the current version.\",\n schema:\n \"input PublishWorkflowInput {\\n publishedAt: DateTime!\\n}\",\n template:\n \"Snapshots the draft trigger, steps, edges, variables and policy into published at the current version.\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"b4642462-2652-4a6e-a6ba-8e299d830d92\",\n name: \"REVERT_TO_PUBLISHED\",\n description:\n \"Replaces the draft with the published snapshot and resets version to published.version.\",\n schema: \"input RevertToPublishedInput {\\n _: Boolean\\n}\",\n template:\n \"Replaces the draft with the published snapshot and resets version to published.version.\",\n reducer: \"\",\n errors: [\n {\n id: \"f0056b3a-549d-4063-b8e5-2978279168e7\",\n name: \"NothingPublishedError\",\n code: \"NOTHING_PUBLISHED\",\n description: \"The workflow has never been published.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n ],\n version: 1,\n changeLog: [],\n },\n ],\n};\n","export type ErrorCode =\n | \"DuplicateEdgeIdError\"\n | \"EdgeSourceNotFoundError\"\n | \"EdgeTargetNotFoundError\"\n | \"EdgeCycleError\"\n | \"EdgeNotFoundError\";\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class DuplicateEdgeIdError extends Error implements ReducerError {\n errorCode = \"DuplicateEdgeIdError\" as ErrorCode;\n constructor(message = \"DuplicateEdgeIdError\") {\n super(message);\n }\n}\n\nexport class EdgeSourceNotFoundError extends Error implements ReducerError {\n errorCode = \"EdgeSourceNotFoundError\" as ErrorCode;\n constructor(message = \"EdgeSourceNotFoundError\") {\n super(message);\n }\n}\n\nexport class EdgeTargetNotFoundError extends Error implements ReducerError {\n errorCode = \"EdgeTargetNotFoundError\" as ErrorCode;\n constructor(message = \"EdgeTargetNotFoundError\") {\n super(message);\n }\n}\n\nexport class EdgeCycleError extends Error implements ReducerError {\n errorCode = \"EdgeCycleError\" as ErrorCode;\n constructor(message = \"EdgeCycleError\") {\n super(message);\n }\n}\n\nexport class EdgeNotFoundError extends Error implements ReducerError {\n errorCode = \"EdgeNotFoundError\" as ErrorCode;\n constructor(message = \"EdgeNotFoundError\") {\n super(message);\n }\n}\n\nexport const errors = {\n AddEdge: {\n DuplicateEdgeIdError,\n EdgeSourceNotFoundError,\n EdgeTargetNotFoundError,\n EdgeCycleError,\n },\n\n RemoveEdge: { EdgeNotFoundError },\n};\n","import type {\n WorkflowEdge,\n WorkflowEdgesOperations,\n} from \"document-models/workflow/v1\";\nimport {\n DuplicateEdgeIdError,\n EdgeCycleError,\n EdgeNotFoundError,\n EdgeSourceNotFoundError,\n EdgeTargetNotFoundError,\n} from \"../../gen/edges/error.js\";\n\n// True when `to` already reaches `from` via existing edges, i.e. the new\n// from->to edge would close a cycle (mirrors the editor's acyclicTargets).\nfunction wouldCycle(edges: WorkflowEdge[], from: string, to: string): boolean {\n const seen = new Set<string>([to]);\n const queue = [to];\n while (queue.length > 0) {\n const current = queue.pop()!;\n if (current === from) return true;\n for (const edge of edges) {\n if (edge.from === current && !seen.has(edge.to)) {\n seen.add(edge.to);\n queue.push(edge.to);\n }\n }\n }\n return false;\n}\n\nexport const workflowEdgesOperations: WorkflowEdgesOperations = {\n addEdgeOperation(state, action) {\n // Ports go unchecked: they are declared in descriptors, and a reducer has none.\n if (state.edges.some((edge) => edge.id === action.input.id)) {\n throw new DuplicateEdgeIdError(\"An edge with this id already exists\");\n }\n const fromExists =\n state.steps.some((step) => step.id === action.input.from) ||\n state.trigger?.id === action.input.from;\n if (!fromExists) {\n throw new EdgeSourceNotFoundError(\n \"Edge source step or trigger not found\",\n );\n }\n if (!state.steps.some((step) => step.id === action.input.to)) {\n throw new EdgeTargetNotFoundError(\"Edge target step not found\");\n }\n if (wouldCycle(state.edges, action.input.from, action.input.to)) {\n throw new EdgeCycleError(\n \"Edge would create a cycle in the workflow graph\",\n );\n }\n state.edges.push({\n id: action.input.id,\n from: action.input.from,\n to: action.input.to,\n port: action.input.port,\n condition: action.input.condition || null,\n });\n state.version += 1;\n },\n removeEdgeOperation(state, action) {\n const index = state.edges.findIndex((edge) => edge.id === action.input.id);\n if (index === -1) {\n throw new EdgeNotFoundError(\"Edge not found\");\n }\n state.edges.splice(index, 1);\n state.version += 1;\n },\n};\n","import type { WorkflowPolicyOperations } from \"document-models/workflow/v1\";\n\nexport const workflowPolicyOperations: WorkflowPolicyOperations = {\n setPolicyOperation(state, action) {\n if (action.input.concurrency)\n state.policy.concurrency = action.input.concurrency;\n if (\n action.input.maxParallelRuns !== undefined &&\n action.input.maxParallelRuns !== null\n ) {\n state.policy.maxParallelRuns = action.input.maxParallelRuns;\n }\n if (\n action.input.runTimeoutSeconds !== undefined &&\n action.input.runTimeoutSeconds !== null\n ) {\n state.policy.runTimeoutSeconds = action.input.runTimeoutSeconds;\n }\n if (\n action.input.maxSuspensionDays !== undefined &&\n action.input.maxSuspensionDays !== null\n ) {\n state.policy.maxSuspensionDays = action.input.maxSuspensionDays;\n }\n if (action.input.defaultRetry)\n state.policy.defaultRetry = action.input.defaultRetry;\n if (action.input.onFailure) state.policy.onFailure = action.input.onFailure;\n if (\n action.input.retainRunsDays !== undefined &&\n action.input.retainRunsDays !== null\n ) {\n state.policy.retainRunsDays = action.input.retainRunsDays;\n }\n if (\n action.input.journalAsDocument !== undefined &&\n action.input.journalAsDocument !== null\n ) {\n state.policy.journalAsDocument = action.input.journalAsDocument;\n }\n state.version += 1;\n },\n};\n","export type ErrorCode = \"NothingPublishedError\";\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class NothingPublishedError extends Error implements ReducerError {\n errorCode = \"NothingPublishedError\" as ErrorCode;\n constructor(message = \"NothingPublishedError\") {\n super(message);\n }\n}\n\nexport const errors = {\n RevertToPublished: { NothingPublishedError },\n};\n","import { isExactVersion } from \"@powerhousedao/pieces-framework/block-type\";\nimport type {\n PropertyMode,\n PropertySetting,\n TriggerBinding,\n WorkflowGlobalState,\n WorkflowStep,\n} from \"../gen/types.js\";\n\n// Why a block reference can't be stored, or undefined when it can: every\n// block names its piece and itself, and pins an exact piece version.\nexport function invalidBlock(\n kind: \"action\" | \"trigger\",\n block: {\n pieceName?: string | null;\n pieceVersion?: string | null;\n name?: string | null;\n },\n): string | undefined {\n if (!block.pieceName) return `The ${kind} names no piece`;\n if (!block.name) return `The ${kind} names no ${kind} of ${block.pieceName}`;\n if (!block.pieceVersion || !isExactVersion(block.pieceVersion)) {\n return `\"${block.pieceVersion ?? \"\"}\" is not an exact semver version of ${block.pieceName}`;\n }\n return undefined;\n}\n\nexport function findStepOrTrigger(\n state: WorkflowGlobalState,\n id: string,\n): WorkflowStep | TriggerBinding | undefined {\n if (state.trigger?.id === id) return state.trigger;\n return state.steps.find((step) => step.id === id);\n}\n\nexport function toPropertySettings(\n input: readonly { prop: string; mode: PropertyMode; schema?: unknown }[],\n): PropertySetting[] {\n return input.map((setting) => ({\n prop: setting.prop,\n mode: setting.mode,\n schema: setting.schema ?? null,\n }));\n}\n\n// Plain copy that is safe to take from an immer draft.\nexport function cloneJson<T>(value: T): T {\n return JSON.parse(JSON.stringify(value)) as T;\n}\n\n// Block config is always a JSON object: a string or array is a writer's bug.\nexport function isConfigObject(config: unknown): boolean {\n return (\n config !== null && typeof config === \"object\" && !Array.isArray(config)\n );\n}\n","import type { WorkflowPublishingOperations } from \"document-models/workflow/v1\";\nimport { NothingPublishedError } from \"../../gen/publishing/error.js\";\nimport { cloneJson } from \"../helpers.js\";\n\nexport const workflowPublishingOperations: WorkflowPublishingOperations = {\n publishWorkflowOperation(state, action) {\n state.published = cloneJson({\n version: state.version,\n publishedAt: action.input.publishedAt,\n trigger: state.trigger,\n steps: state.steps,\n edges: state.edges,\n variables: state.variables,\n policy: state.policy,\n });\n },\n revertToPublishedOperation(state, _action) {\n if (!state.published) {\n throw new NothingPublishedError(\"Workflow has never been published\");\n }\n const snapshot = cloneJson(state.published);\n state.trigger = snapshot.trigger;\n state.steps = snapshot.steps;\n state.edges = snapshot.edges;\n state.variables = snapshot.variables;\n state.policy = snapshot.policy;\n state.version = snapshot.version;\n },\n};\n","export type ErrorCode = \"LastTestTargetNotFoundError\";\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class LastTestTargetNotFoundError extends Error implements ReducerError {\n errorCode = \"LastTestTargetNotFoundError\" as ErrorCode;\n constructor(message = \"LastTestTargetNotFoundError\") {\n super(message);\n }\n}\n\nexport const errors = {\n SetLastTest: { LastTestTargetNotFoundError },\n};\n","import type { WorkflowRuntimeOperations } from \"document-models/workflow/v1\";\nimport { LastTestTargetNotFoundError } from \"../../gen/runtime/error.js\";\nimport { findStepOrTrigger } from \"../helpers.js\";\n\nexport const workflowRuntimeOperations: WorkflowRuntimeOperations = {\n setLastRunOperation(state, action) {\n state.lastRunAt = action.input.lastRunAt;\n state.lastRunStatus = action.input.lastRunStatus;\n },\n setLastTestOperation(state, action) {\n const target = findStepOrTrigger(state, action.input.id);\n if (!target) {\n throw new LastTestTargetNotFoundError(\"Step or trigger not found\");\n }\n target.lastTest = {\n runId: action.input.runId,\n testedAt: action.input.testedAt,\n };\n },\n};\n","export type ErrorCode =\n | \"DuplicateStepIdError\"\n | \"DuplicateStepKeyError\"\n | \"InvalidStepBlockError\"\n | \"StepConfigNotObjectError\"\n | \"StepNotFoundError\"\n | \"StepKeyConflictError\"\n | \"InvalidUpdateBlockError\"\n | \"UpdateConfigNotObjectError\"\n | \"RemoveStepNotFoundError\"\n | \"ConfigStepNotFoundError\"\n | \"SetConfigNotObjectError\";\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class DuplicateStepIdError extends Error implements ReducerError {\n errorCode = \"DuplicateStepIdError\" as ErrorCode;\n constructor(message = \"DuplicateStepIdError\") {\n super(message);\n }\n}\n\nexport class DuplicateStepKeyError extends Error implements ReducerError {\n errorCode = \"DuplicateStepKeyError\" as ErrorCode;\n constructor(message = \"DuplicateStepKeyError\") {\n super(message);\n }\n}\n\nexport class InvalidStepBlockError extends Error implements ReducerError {\n errorCode = \"InvalidStepBlockError\" as ErrorCode;\n constructor(message = \"InvalidStepBlockError\") {\n super(message);\n }\n}\n\nexport class StepConfigNotObjectError extends Error implements ReducerError {\n errorCode = \"StepConfigNotObjectError\" as ErrorCode;\n constructor(message = \"StepConfigNotObjectError\") {\n super(message);\n }\n}\n\nexport class StepNotFoundError extends Error implements ReducerError {\n errorCode = \"StepNotFoundError\" as ErrorCode;\n constructor(message = \"StepNotFoundError\") {\n super(message);\n }\n}\n\nexport class StepKeyConflictError extends Error implements ReducerError {\n errorCode = \"StepKeyConflictError\" as ErrorCode;\n constructor(message = \"StepKeyConflictError\") {\n super(message);\n }\n}\n\nexport class InvalidUpdateBlockError extends Error implements ReducerError {\n errorCode = \"InvalidUpdateBlockError\" as ErrorCode;\n constructor(message = \"InvalidUpdateBlockError\") {\n super(message);\n }\n}\n\nexport class UpdateConfigNotObjectError extends Error implements ReducerError {\n errorCode = \"UpdateConfigNotObjectError\" as ErrorCode;\n constructor(message = \"UpdateConfigNotObjectError\") {\n super(message);\n }\n}\n\nexport class RemoveStepNotFoundError extends Error implements ReducerError {\n errorCode = \"RemoveStepNotFoundError\" as ErrorCode;\n constructor(message = \"RemoveStepNotFoundError\") {\n super(message);\n }\n}\n\nexport class ConfigStepNotFoundError extends Error implements ReducerError {\n errorCode = \"ConfigStepNotFoundError\" as ErrorCode;\n constructor(message = \"ConfigStepNotFoundError\") {\n super(message);\n }\n}\n\nexport class SetConfigNotObjectError extends Error implements ReducerError {\n errorCode = \"SetConfigNotObjectError\" as ErrorCode;\n constructor(message = \"SetConfigNotObjectError\") {\n super(message);\n }\n}\n\nexport const errors = {\n AddStep: {\n DuplicateStepIdError,\n DuplicateStepKeyError,\n InvalidStepBlockError,\n StepConfigNotObjectError,\n },\n\n UpdateStep: {\n StepNotFoundError,\n StepKeyConflictError,\n InvalidUpdateBlockError,\n UpdateConfigNotObjectError,\n },\n\n RemoveStep: { RemoveStepNotFoundError },\n\n SetStepConfig: { ConfigStepNotFoundError, SetConfigNotObjectError },\n};\n","import type { WorkflowStepsOperations } from \"document-models/workflow/v1\";\nimport {\n ConfigStepNotFoundError,\n DuplicateStepIdError,\n DuplicateStepKeyError,\n InvalidStepBlockError,\n InvalidUpdateBlockError,\n RemoveStepNotFoundError,\n SetConfigNotObjectError,\n StepConfigNotObjectError,\n StepKeyConflictError,\n StepNotFoundError,\n UpdateConfigNotObjectError,\n} from \"../../gen/steps/error.js\";\nimport {\n invalidBlock,\n isConfigObject,\n toPropertySettings,\n} from \"../helpers.js\";\n\nexport const workflowStepsOperations: WorkflowStepsOperations = {\n addStepOperation(state, action) {\n if (state.steps.some((step) => step.id === action.input.id)) {\n throw new DuplicateStepIdError(\"A step with this id already exists\");\n }\n if (state.steps.some((step) => step.key === action.input.key)) {\n throw new DuplicateStepKeyError(\"A step with this key already exists\");\n }\n const invalid = invalidBlock(\"action\", {\n pieceName: action.input.pieceName,\n pieceVersion: action.input.pieceVersion,\n name: action.input.actionName,\n });\n if (invalid) throw new InvalidStepBlockError(invalid);\n if (!isConfigObject(action.input.config)) {\n throw new StepConfigNotObjectError(\"A step config must be an object\");\n }\n state.steps.push({\n id: action.input.id,\n key: action.input.key,\n name: action.input.name,\n pieceName: action.input.pieceName,\n pieceVersion: action.input.pieceVersion,\n actionName: action.input.actionName,\n connectionId: action.input.connectionId || null,\n reactorConnectionId: action.input.reactorConnectionId || null,\n config: action.input.config,\n retry: action.input.retry ?? null,\n timeoutSeconds: action.input.timeoutSeconds ?? null,\n idempotencyKeyExpression: action.input.idempotencyKeyExpression || null,\n position: action.input.position ?? null,\n propertySettings: action.input.propertySettings\n ? toPropertySettings(action.input.propertySettings)\n : null,\n lastTest: null,\n skip: action.input.skip ?? null,\n updatedAt: action.timestampUtcMs,\n });\n state.version += 1;\n },\n updateStepOperation(state, action) {\n const step = state.steps.find((step) => step.id === action.input.id);\n if (!step) {\n throw new StepNotFoundError(\"Step not found\");\n }\n // Null or undefined leaves a field as it is; the result must still be valid.\n const pieceName = action.input.pieceName ?? step.pieceName;\n const pieceVersion = action.input.pieceVersion ?? step.pieceVersion;\n const actionName = action.input.actionName ?? step.actionName;\n const invalid = invalidBlock(\"action\", {\n pieceName,\n pieceVersion,\n name: actionName,\n });\n if (invalid) throw new InvalidUpdateBlockError(invalid);\n const { config } = action.input;\n if (config !== undefined && config !== null && !isConfigObject(config)) {\n throw new UpdateConfigNotObjectError(\"A step config must be an object\");\n }\n if (action.input.key) {\n const conflict = state.steps.some(\n (other) =>\n other.key === action.input.key && other.id !== action.input.id,\n );\n if (conflict) {\n throw new StepKeyConflictError(\"Another step already uses this key\");\n }\n step.key = action.input.key;\n }\n if (action.input.name) step.name = action.input.name;\n step.pieceName = pieceName;\n step.pieceVersion = pieceVersion;\n step.actionName = actionName;\n // null clears a connection; undefined leaves it unchanged.\n if (action.input.connectionId !== undefined)\n step.connectionId = action.input.connectionId || null;\n if (action.input.reactorConnectionId !== undefined)\n step.reactorConnectionId = action.input.reactorConnectionId || null;\n if (action.input.config !== undefined && action.input.config !== null) {\n step.config = action.input.config;\n }\n // For the optional runtime fields null clears; undefined leaves as is.\n if (action.input.retry !== undefined) {\n step.retry = action.input.retry ?? null;\n }\n if (action.input.timeoutSeconds !== undefined) {\n step.timeoutSeconds = action.input.timeoutSeconds ?? null;\n }\n if (action.input.idempotencyKeyExpression !== undefined) {\n step.idempotencyKeyExpression =\n action.input.idempotencyKeyExpression || null;\n }\n if (action.input.position !== undefined) {\n step.position = action.input.position ?? null;\n }\n if (action.input.skip !== undefined) {\n step.skip = action.input.skip ?? null;\n }\n step.updatedAt = action.timestampUtcMs;\n state.version += 1;\n },\n removeStepOperation(state, action) {\n const index = state.steps.findIndex((step) => step.id === action.input.id);\n if (index === -1) {\n throw new RemoveStepNotFoundError(\"Step not found\");\n }\n state.steps.splice(index, 1);\n state.edges = state.edges.filter(\n (edge) => edge.from !== action.input.id && edge.to !== action.input.id,\n );\n state.version += 1;\n },\n setStepConfigOperation(state, action) {\n const step = state.steps.find((step) => step.id === action.input.id);\n if (!step) {\n throw new ConfigStepNotFoundError(\"Step not found\");\n }\n if (!isConfigObject(action.input.config)) {\n throw new SetConfigNotObjectError(\"A step config must be an object\");\n }\n if (JSON.stringify(step.config) !== JSON.stringify(action.input.config)) {\n step.updatedAt = action.timestampUtcMs;\n }\n step.config = action.input.config;\n // Undefined leaves the settings unchanged; null clears them.\n if (action.input.propertySettings !== undefined) {\n step.propertySettings = action.input.propertySettings\n ? toPropertySettings(action.input.propertySettings)\n : null;\n }\n state.version += 1;\n },\n};\n","export type ErrorCode =\n | \"InvalidTriggerBlockError\"\n | \"TriggerConfigNotObjectError\"\n | \"TriggerNotSetError\"\n | \"ConfigTriggerNotSetError\"\n | \"SetTriggerConfigNotObjectError\"\n | \"ConnectionTriggerNotSetError\"\n | \"VersionTriggerNotSetError\"\n | \"InvalidTriggerPieceVersionError\";\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class InvalidTriggerBlockError extends Error implements ReducerError {\n errorCode = \"InvalidTriggerBlockError\" as ErrorCode;\n constructor(message = \"InvalidTriggerBlockError\") {\n super(message);\n }\n}\n\nexport class TriggerConfigNotObjectError extends Error implements ReducerError {\n errorCode = \"TriggerConfigNotObjectError\" as ErrorCode;\n constructor(message = \"TriggerConfigNotObjectError\") {\n super(message);\n }\n}\n\nexport class TriggerNotSetError extends Error implements ReducerError {\n errorCode = \"TriggerNotSetError\" as ErrorCode;\n constructor(message = \"TriggerNotSetError\") {\n super(message);\n }\n}\n\nexport class ConfigTriggerNotSetError extends Error implements ReducerError {\n errorCode = \"ConfigTriggerNotSetError\" as ErrorCode;\n constructor(message = \"ConfigTriggerNotSetError\") {\n super(message);\n }\n}\n\nexport class SetTriggerConfigNotObjectError\n extends Error\n implements ReducerError\n{\n errorCode = \"SetTriggerConfigNotObjectError\" as ErrorCode;\n constructor(message = \"SetTriggerConfigNotObjectError\") {\n super(message);\n }\n}\n\nexport class ConnectionTriggerNotSetError\n extends Error\n implements ReducerError\n{\n errorCode = \"ConnectionTriggerNotSetError\" as ErrorCode;\n constructor(message = \"ConnectionTriggerNotSetError\") {\n super(message);\n }\n}\n\nexport class VersionTriggerNotSetError extends Error implements ReducerError {\n errorCode = \"VersionTriggerNotSetError\" as ErrorCode;\n constructor(message = \"VersionTriggerNotSetError\") {\n super(message);\n }\n}\n\nexport class InvalidTriggerPieceVersionError\n extends Error\n implements ReducerError\n{\n errorCode = \"InvalidTriggerPieceVersionError\" as ErrorCode;\n constructor(message = \"InvalidTriggerPieceVersionError\") {\n super(message);\n }\n}\n\nexport const errors = {\n SetTrigger: { InvalidTriggerBlockError, TriggerConfigNotObjectError },\n\n ClearTrigger: { TriggerNotSetError },\n\n SetTriggerConfig: {\n ConfigTriggerNotSetError,\n SetTriggerConfigNotObjectError,\n },\n\n SetTriggerConnection: { ConnectionTriggerNotSetError },\n\n SetTriggerPieceVersion: {\n VersionTriggerNotSetError,\n InvalidTriggerPieceVersionError,\n },\n};\n","import type { WorkflowTriggerOperations } from \"document-models/workflow/v1\";\nimport {\n ConfigTriggerNotSetError,\n ConnectionTriggerNotSetError,\n InvalidTriggerBlockError,\n InvalidTriggerPieceVersionError,\n SetTriggerConfigNotObjectError,\n TriggerConfigNotObjectError,\n TriggerNotSetError,\n VersionTriggerNotSetError,\n} from \"../../gen/trigger/error.js\";\nimport {\n invalidBlock,\n isConfigObject,\n toPropertySettings,\n} from \"../helpers.js\";\n\nexport const workflowTriggerOperations: WorkflowTriggerOperations = {\n setTriggerOperation(state, action) {\n const { input } = action;\n const invalid = invalidBlock(\"trigger\", {\n pieceName: input.pieceName,\n pieceVersion: input.pieceVersion,\n name: input.triggerName,\n });\n if (invalid) throw new InvalidTriggerBlockError(invalid);\n if (!isConfigObject(input.config)) {\n throw new TriggerConfigNotObjectError(\n \"The trigger config must be an object\",\n );\n }\n // Same binding: omitted settings and last test carry over.\n const current = state.trigger;\n const previous =\n current &&\n current.id === input.id &&\n current.pieceName === input.pieceName &&\n current.pieceVersion === input.pieceVersion &&\n current.triggerName === input.triggerName\n ? current\n : null;\n state.trigger = {\n id: input.id,\n pieceName: input.pieceName,\n pieceVersion: input.pieceVersion,\n triggerName: input.triggerName,\n connectionId: input.connectionId || null,\n reactorConnectionId: input.reactorConnectionId || null,\n config: input.config,\n propertySettings:\n input.propertySettings === undefined\n ? (previous?.propertySettings ?? null)\n : input.propertySettings\n ? toPropertySettings(input.propertySettings)\n : null,\n lastTest: previous?.lastTest ?? null,\n updatedAt: action.timestampUtcMs,\n };\n state.version += 1;\n },\n clearTriggerOperation(state, _action) {\n if (!state.trigger) {\n throw new TriggerNotSetError(\"Workflow has no trigger to clear\");\n }\n const triggerId = state.trigger.id;\n state.trigger = null;\n state.edges = state.edges.filter((edge) => edge.from !== triggerId);\n state.version += 1;\n },\n setTriggerConfigOperation(state, action) {\n const trigger = state.trigger;\n if (!trigger) {\n throw new ConfigTriggerNotSetError(\n \"Workflow has no trigger to configure\",\n );\n }\n if (!isConfigObject(action.input.config)) {\n throw new SetTriggerConfigNotObjectError(\n \"The trigger config must be an object\",\n );\n }\n if (\n JSON.stringify(trigger.config) !== JSON.stringify(action.input.config)\n ) {\n trigger.updatedAt = action.timestampUtcMs;\n }\n trigger.config = action.input.config;\n // Undefined leaves the settings unchanged; null clears them.\n if (action.input.propertySettings !== undefined) {\n trigger.propertySettings = action.input.propertySettings\n ? toPropertySettings(action.input.propertySettings)\n : null;\n }\n state.version += 1;\n },\n setTriggerConnectionOperation(state, action) {\n const trigger = state.trigger;\n if (!trigger) {\n throw new ConnectionTriggerNotSetError(\n \"Workflow has no trigger to connect\",\n );\n }\n // null clears a connection; undefined leaves it unchanged.\n if (action.input.connectionId !== undefined)\n trigger.connectionId = action.input.connectionId || null;\n if (action.input.reactorConnectionId !== undefined)\n trigger.reactorConnectionId = action.input.reactorConnectionId || null;\n trigger.updatedAt = action.timestampUtcMs;\n state.version += 1;\n },\n setTriggerPieceVersionOperation(state, action) {\n const trigger = state.trigger;\n if (!trigger) {\n throw new VersionTriggerNotSetError(\"Workflow has no trigger to update\");\n }\n const invalid = invalidBlock(\"trigger\", {\n pieceName: trigger.pieceName,\n pieceVersion: action.input.pieceVersion,\n name: trigger.triggerName,\n });\n if (invalid) throw new InvalidTriggerPieceVersionError(invalid);\n if (trigger.pieceVersion === action.input.pieceVersion) return;\n trigger.pieceVersion = action.input.pieceVersion;\n // A test of the old version says nothing about the new one.\n trigger.lastTest = null;\n trigger.updatedAt = action.timestampUtcMs;\n state.version += 1;\n },\n};\n","export type ErrorCode =\n | \"SecretVariableValueError\"\n | \"DuplicateVariableKeyError\"\n | \"VariableNotFoundError\";\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class SecretVariableValueError extends Error implements ReducerError {\n errorCode = \"SecretVariableValueError\" as ErrorCode;\n constructor(message = \"SecretVariableValueError\") {\n super(message);\n }\n}\n\nexport class DuplicateVariableKeyError extends Error implements ReducerError {\n errorCode = \"DuplicateVariableKeyError\" as ErrorCode;\n constructor(message = \"DuplicateVariableKeyError\") {\n super(message);\n }\n}\n\nexport class VariableNotFoundError extends Error implements ReducerError {\n errorCode = \"VariableNotFoundError\" as ErrorCode;\n constructor(message = \"VariableNotFoundError\") {\n super(message);\n }\n}\n\nexport const errors = {\n SetVariable: { SecretVariableValueError, DuplicateVariableKeyError },\n\n RemoveVariable: { VariableNotFoundError },\n};\n","import type { WorkflowVariablesOperations } from \"document-models/workflow/v1\";\nimport {\n DuplicateVariableKeyError,\n SecretVariableValueError,\n VariableNotFoundError,\n} from \"../../gen/variables/error.js\";\n\nexport const workflowVariablesOperations: WorkflowVariablesOperations = {\n setVariableOperation(state, action) {\n // Upserted by id; the key may change, but no two variables share one.\n const existing = state.variables.find(\n (variable) => variable.id === action.input.id,\n );\n const taken = state.variables.some(\n (variable) =>\n variable.key === action.input.key && variable.id !== action.input.id,\n );\n if (taken) {\n throw new DuplicateVariableKeyError(\n `Another variable already uses the key \"${action.input.key}\"`,\n );\n }\n const value = action.input.value ?? null;\n const type =\n action.input.type === undefined\n ? (existing?.type ?? null)\n : action.input.type;\n if (type === \"SECRET\" && value !== null && typeof value !== \"string\") {\n throw new SecretVariableValueError(\n \"A SECRET variable's value must be a secret reference string\",\n );\n }\n if (existing) {\n existing.key = action.input.key;\n existing.value = value;\n existing.type = type;\n // Undefined leaves it unchanged; an explicit null or \"\" clears it.\n if (action.input.description !== undefined) {\n existing.description = action.input.description || null;\n }\n } else {\n state.variables.push({\n id: action.input.id,\n key: action.input.key,\n value,\n description: action.input.description || null,\n type,\n });\n }\n state.version += 1;\n },\n removeVariableOperation(state, action) {\n const index = state.variables.findIndex(\n (variable) => variable.id === action.input.id,\n );\n if (index === -1) {\n throw new VariableNotFoundError(\"Variable not found\");\n }\n state.variables.splice(index, 1);\n state.version += 1;\n },\n};\n","export type ErrorCode = \"WorkflowNotPublishedError\";\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class WorkflowNotPublishedError extends Error implements ReducerError {\n errorCode = \"WorkflowNotPublishedError\" as ErrorCode;\n constructor(message = \"WorkflowNotPublishedError\") {\n super(message);\n }\n}\n\nexport const errors = {\n SetWorkflowStatus: { WorkflowNotPublishedError },\n};\n","import type { WorkflowWorkflowOperations } from \"document-models/workflow/v1\";\nimport { WorkflowNotPublishedError } from \"../../gen/workflow/error.js\";\n\nexport const workflowWorkflowOperations: WorkflowWorkflowOperations = {\n setWorkflowNameOperation(state, action) {\n state.name = action.input.name;\n },\n setWorkflowDescriptionOperation(state, action) {\n state.description = action.input.description || null;\n },\n setWorkflowStatusOperation(state, action) {\n // Runs execute the published snapshot, so there must be one to run.\n if (action.input.status === \"ENABLED\" && !state.published) {\n throw new WorkflowNotPublishedError(\n \"Publish the workflow before enabling it\",\n );\n }\n state.status = action.input.status;\n },\n};\n","/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-argument */\nimport type { Reducer, StateReducer } from \"document-model\";\nimport { createReducer, isDocumentAction } from \"document-model\";\nimport type { WorkflowPHState } from \"document-models/workflow/v1\";\n\nimport { workflowEdgesOperations } from \"../src/reducers/edges.js\";\nimport { workflowPolicyOperations } from \"../src/reducers/policy.js\";\nimport { workflowPublishingOperations } from \"../src/reducers/publishing.js\";\nimport { workflowRuntimeOperations } from \"../src/reducers/runtime.js\";\nimport { workflowStepsOperations } from \"../src/reducers/steps.js\";\nimport { workflowTriggerOperations } from \"../src/reducers/trigger.js\";\nimport { workflowVariablesOperations } from \"../src/reducers/variables.js\";\nimport { workflowWorkflowOperations } from \"../src/reducers/workflow.js\";\n\nimport {\n AddEdgeInputSchema,\n AddStepInputSchema,\n ClearTriggerInputSchema,\n PublishWorkflowInputSchema,\n RemoveEdgeInputSchema,\n RemoveStepInputSchema,\n RemoveVariableInputSchema,\n RevertToPublishedInputSchema,\n SetLastRunInputSchema,\n SetLastTestInputSchema,\n SetPolicyInputSchema,\n SetStepConfigInputSchema,\n SetTriggerConfigInputSchema,\n SetTriggerConnectionInputSchema,\n SetTriggerInputSchema,\n SetTriggerPieceVersionInputSchema,\n SetVariableInputSchema,\n SetWorkflowDescriptionInputSchema,\n SetWorkflowNameInputSchema,\n SetWorkflowStatusInputSchema,\n UpdateStepInputSchema,\n} from \"./schema/zod.js\";\n\nconst schemaMemo = new Map<() => unknown, unknown>();\n\nfunction memoizedSchema<T>(makeSchema: () => T): T {\n let schema = schemaMemo.get(makeSchema) as T | undefined;\n if (schema === undefined) {\n schema = makeSchema();\n schemaMemo.set(makeSchema, schema);\n }\n return schema;\n}\n\nconst stateReducer: StateReducer<WorkflowPHState> = (\n state,\n action,\n dispatch,\n) => {\n if (isDocumentAction(action)) {\n return state;\n }\n switch (action.type) {\n case \"SET_WORKFLOW_NAME\": {\n memoizedSchema(SetWorkflowNameInputSchema).parse(action.input);\n\n workflowWorkflowOperations.setWorkflowNameOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_WORKFLOW_DESCRIPTION\": {\n memoizedSchema(SetWorkflowDescriptionInputSchema).parse(action.input);\n\n workflowWorkflowOperations.setWorkflowDescriptionOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_WORKFLOW_STATUS\": {\n memoizedSchema(SetWorkflowStatusInputSchema).parse(action.input);\n\n workflowWorkflowOperations.setWorkflowStatusOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_TRIGGER\": {\n memoizedSchema(SetTriggerInputSchema).parse(action.input);\n\n workflowTriggerOperations.setTriggerOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"CLEAR_TRIGGER\": {\n memoizedSchema(ClearTriggerInputSchema).parse(action.input);\n\n workflowTriggerOperations.clearTriggerOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_TRIGGER_CONFIG\": {\n memoizedSchema(SetTriggerConfigInputSchema).parse(action.input);\n\n workflowTriggerOperations.setTriggerConfigOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_TRIGGER_CONNECTION\": {\n memoizedSchema(SetTriggerConnectionInputSchema).parse(action.input);\n\n workflowTriggerOperations.setTriggerConnectionOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_TRIGGER_PIECE_VERSION\": {\n memoizedSchema(SetTriggerPieceVersionInputSchema).parse(action.input);\n\n workflowTriggerOperations.setTriggerPieceVersionOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"ADD_STEP\": {\n memoizedSchema(AddStepInputSchema).parse(action.input);\n\n workflowStepsOperations.addStepOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"UPDATE_STEP\": {\n memoizedSchema(UpdateStepInputSchema).parse(action.input);\n\n workflowStepsOperations.updateStepOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_STEP\": {\n memoizedSchema(RemoveStepInputSchema).parse(action.input);\n\n workflowStepsOperations.removeStepOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_STEP_CONFIG\": {\n memoizedSchema(SetStepConfigInputSchema).parse(action.input);\n\n workflowStepsOperations.setStepConfigOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"ADD_EDGE\": {\n memoizedSchema(AddEdgeInputSchema).parse(action.input);\n\n workflowEdgesOperations.addEdgeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_EDGE\": {\n memoizedSchema(RemoveEdgeInputSchema).parse(action.input);\n\n workflowEdgesOperations.removeEdgeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_VARIABLE\": {\n memoizedSchema(SetVariableInputSchema).parse(action.input);\n\n workflowVariablesOperations.setVariableOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_VARIABLE\": {\n memoizedSchema(RemoveVariableInputSchema).parse(action.input);\n\n workflowVariablesOperations.removeVariableOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_POLICY\": {\n memoizedSchema(SetPolicyInputSchema).parse(action.input);\n\n workflowPolicyOperations.setPolicyOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_LAST_RUN\": {\n memoizedSchema(SetLastRunInputSchema).parse(action.input);\n\n workflowRuntimeOperations.setLastRunOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_LAST_TEST\": {\n memoizedSchema(SetLastTestInputSchema).parse(action.input);\n\n workflowRuntimeOperations.setLastTestOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"PUBLISH_WORKFLOW\": {\n memoizedSchema(PublishWorkflowInputSchema).parse(action.input);\n\n workflowPublishingOperations.publishWorkflowOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REVERT_TO_PUBLISHED\": {\n memoizedSchema(RevertToPublishedInputSchema).parse(action.input);\n\n workflowPublishingOperations.revertToPublishedOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n default:\n return state;\n }\n};\n\nexport const reducer: Reducer<WorkflowPHState> = createReducer(stateReducer);\n","export const supportedVersions = [1] as const;\n\nexport const latestVersion = supportedVersions[0];\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { UpgradeManifest } from \"document-model\";\nimport { latestVersion, supportedVersions } from \"./versions.js\";\n\nexport const workflowUpgradeManifest: UpgradeManifest<\n typeof supportedVersions\n> = {\n documentType: \"powerhouse/workflow\",\n latestVersion,\n supportedVersions,\n upgrades: {},\n};\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nexport const workflowDocumentType = \"powerhouse/workflow\";\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport {\n BaseDocumentHeaderSchema,\n BaseDocumentStateSchema,\n} from \"document-model\";\nimport { z } from \"zod\";\nimport { workflowDocumentType } from \"./document-type.js\";\nimport { WorkflowStateSchema } from \"./schema/zod.js\";\nimport type { WorkflowDocument, WorkflowPHState } from \"./types.js\";\n\n/** Schema for validating the header object of a Workflow document */\nexport const WorkflowDocumentHeaderSchema = BaseDocumentHeaderSchema.extend({\n documentType: z.literal(workflowDocumentType),\n});\n\n/** Schema for validating the state object of a Workflow document */\nexport const WorkflowPHStateSchema = BaseDocumentStateSchema.extend({\n global: WorkflowStateSchema(),\n});\n\nexport const WorkflowDocumentSchema = z.object({\n header: WorkflowDocumentHeaderSchema,\n state: WorkflowPHStateSchema,\n initialState: WorkflowPHStateSchema,\n});\n\n/** Simple helper function to check if a state object is a Workflow document state object */\nexport function isWorkflowState(state: unknown): state is WorkflowPHState {\n return WorkflowPHStateSchema.safeParse(state).success;\n}\n\n/** Simple helper function to assert that a document state object is a Workflow document state object */\nexport function assertIsWorkflowState(\n state: unknown,\n): asserts state is WorkflowPHState {\n WorkflowPHStateSchema.parse(state);\n}\n\n/** Simple helper function to check if a document is a Workflow document */\nexport function isWorkflowDocument(\n document: unknown,\n): document is WorkflowDocument {\n return WorkflowDocumentSchema.safeParse(document).success;\n}\n\n/** Simple helper function to assert that a document is a Workflow document */\nexport function assertIsWorkflowDocument(\n document: unknown,\n): asserts document is WorkflowDocument {\n WorkflowDocumentSchema.parse(document);\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelUtils, PHBaseState, Reducer } from \"document-model\";\nimport {\n baseCreateDocument,\n baseLoadFromInputVersioned,\n baseSaveToFileHandle,\n createBaseState,\n} from \"document-model\";\nimport { workflowUpgradeManifest } from \"../../upgrades/upgrade-manifest.js\";\nimport {\n assertIsWorkflowDocument,\n assertIsWorkflowState,\n isWorkflowDocument,\n isWorkflowState,\n} from \"./document-schema.js\";\nimport { workflowDocumentType } from \"./document-type.js\";\nimport { reducer } from \"./reducer.js\";\nimport type {\n WorkflowGlobalState,\n WorkflowLocalState,\n WorkflowPHState,\n} from \"./types.js\";\n\nexport const initialGlobalState: WorkflowGlobalState = {\n name: \"\",\n description: null,\n status: \"DRAFT\",\n version: 0,\n trigger: null,\n steps: [],\n edges: [],\n variables: [],\n policy: {\n concurrency: \"QUEUE\",\n maxParallelRuns: null,\n runTimeoutSeconds: 3600,\n maxSuspensionDays: 30,\n defaultRetry: {\n maxAttempts: 1,\n backoff: \"FIXED\",\n initialDelaySeconds: 5,\n maxDelaySeconds: 300,\n retryOn: [],\n },\n onFailure: \"PARK\",\n retainRunsDays: 30,\n journalAsDocument: false,\n },\n published: null,\n lastRunAt: null,\n lastRunStatus: null,\n};\nexport const initialLocalState: WorkflowLocalState = {};\n\nexport const utils: DocumentModelUtils<WorkflowPHState> = {\n fileExtension: \".flow\",\n createState(state) {\n return {\n ...createBaseState(state?.auth, { version: 1, ...state?.document }),\n global: { ...initialGlobalState, ...state?.global },\n local: { ...initialLocalState, ...state?.local },\n };\n },\n createDocument(state) {\n return baseCreateDocument(utils.createState, state, workflowDocumentType);\n },\n saveToFileHandle(document, input) {\n return baseSaveToFileHandle(document, input);\n },\n loadFromInput(input) {\n return baseLoadFromInputVersioned(input, {\n reducers: { 1: reducer as unknown as Reducer<PHBaseState> },\n upgradeManifest: workflowUpgradeManifest,\n });\n },\n isStateOfType(state) {\n return isWorkflowState(state);\n },\n assertIsStateOfType(state) {\n return assertIsWorkflowState(state);\n },\n isDocumentOfType(document) {\n return isWorkflowDocument(document);\n },\n assertIsDocumentOfType(document) {\n return assertIsWorkflowDocument(document);\n },\n};\n","export {};\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelUtils } from \"document-model\";\nimport type { WorkflowPHState } from \"./gen/types.js\";\nimport { utils as genUtils } from \"./gen/utils.js\";\nimport * as customUtils from \"./src/utils.js\";\n\n/** Utils for the Workflow document model */\nexport const utils: DocumentModelUtils<WorkflowPHState> = {\n ...genUtils,\n ...customUtils,\n};\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelModule } from \"document-model\";\nimport { createState, defaultBaseState } from \"document-model\";\nimport { actions } from \"./actions.js\";\nimport { documentModel } from \"./gen/document-model.js\";\nimport { reducer } from \"./gen/reducer.js\";\nimport type { WorkflowPHState } from \"./gen/types.js\";\nimport { utils } from \"./utils.js\";\n\n/** Document model module for the Workflow document type */\nexport const Workflow = {\n version: 1,\n reducer,\n actions,\n utils,\n documentModel: createState(defaultBaseState(), documentModel),\n} as const satisfies DocumentModelModule<WorkflowPHState>;\n"],"mappings":";;;;;;AA4DA,MAAa,uBAAuB,MAClC,MAAM,KAAA,KAAa,MAAM;AAE3B,MAAa,0BAA0BA,IACpC,IAAI,CAAC,CACL,QAAQ,MAAM,oBAAoB,CAAC,CAAC;AAEvC,MAAa,oBAAoBA,IAAE,KAAK,CAAC,eAAe,OAAO,CAAC;AAEhE,MAAa,wBAAwBA,IAAE,KAAK;CAAC;CAAY;CAAS;AAAW,CAAC;AAE9E,MAAa,oBAAoBA,IAAE,KAAK;CAAC;CAAU;CAAU;AAAM,CAAC;AAEpE,MAAa,qBAAqBA,IAAE,KAAK,CAAC,cAAc,QAAQ,CAAC;AAEjE,MAAa,kBAAkBA,IAAE,KAAK;CACpC;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAa,qBAAqBA,IAAE,KAAK;CACvC;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAa,uBAAuBA,IAAE,KAAK;CACzC;CACA;CACA;CACA;AACF,CAAC;AAED,SAAgB,qBAA4D;CAC1E,OAAOA,IAAE,OAAO;EACd,WAAWA,IAAE,OAAO,CAAC,CAAC,QAAQ;EAC9B,MAAMA,IAAE,OAAO;EACf,IAAIA,IAAE,OAAO;EACb,MAAMA,IAAE,OAAO;EACf,IAAIA,IAAE,OAAO;CACf,CAAC;AACH;AAEA,SAAgB,qBAA4D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AAM,GACX,KAAA,GACA,4BACA,QACF;AAEF,MAAa,0BAA0B,UACrC,aACE,4BACA,EAAE,GAAG,MAAM,GACX,KAAA,GACA,mCACA,QACF;AAEF,MAAa,qBAAqB,UAChC,aACE,uBACA,EAAE,GAAG,MAAM,GACX,KAAA,GACA,8BACA,QACF;;;;;;;;AC5BF,MAAa,UAAU;CACrB,GAAG;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;AACL;;;AC1BA,MAAa,gBAA0C;CACrD,IAAI;CACJ,MAAM;CACN,QAAQ;EACN,MAAM;EACN,SAAS;CACX;CACA,WAAW;CACX,aACE;CACF,gBAAgB,CACd;EACE,OAAO;GACL,OAAO;IACL,QAAQ;IACR,UAAU,CAAC;IACX,cAAc;GAChB;GACA,QAAQ;IACN,QACE;IACF,UAAU,CAAC;IACX,cACE;GACJ;EACF;EACA,SAAS;GACP;IACE,IAAI;IACJ,MAAM;IACN,aAAa;IACb,YAAY;KACV;MACE,IAAI;MACJ,MAAM;MACN,aAAa;MACb,QAAQ;MACR,UAAU;MACV,SAAS;MACT,QAAQ,CAAC;MACT,UAAU,CAAC;MACX,OAAO;KACT;KACA;MACE,IAAI;MACJ,MAAM;MACN,aAAa;MACb,QACE;MACF,UAAU;MACV,SAAS;MACT,QAAQ,CAAC;MACT,UAAU,CAAC;MACX,OAAO;KACT;KACA;MACE,IAAI;MACJ,MAAM;MACN,aACE;MACF,QACE;MACF,UACE;MACF,SAAS;MACT,QAAQ,CACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aACE;OACF,UAAU;MACZ,CACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;IACF;GACF;GACA;IACE,IAAI;IACJ,MAAM;IACN,aAAa;IACb,YAAY;KACV;MACE,IAAI;MACJ,MAAM;MACN,aACE;MACF,QACE;MACF,UACE;MACF,SACE;MACF,QAAQ,CACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aACE;OACF,UAAU;MACZ,GACA;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ,CACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;KACA;MACE,IAAI;MACJ,MAAM;MACN,aAAa;MACb,QAAQ;MACR,UAAU;MACV,SACE;MACF,QAAQ,CACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ,CACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;KACA;MACE,IAAI;MACJ,MAAM;MACN,aACE;MACF,QACE;MACF,UACE;MACF,SAAS;MACT,QAAQ,CACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ,GACA;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ,CACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;KACA;MACE,IAAI;MACJ,MAAM;MACN,aACE;MACF,QACE;MACF,UACE;MACF,SAAS;MACT,QAAQ,CACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ,CACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;KACA;MACE,IAAI;MACJ,MAAM;MACN,aACE;MACF,QACE;MACF,UACE;MACF,SAAS;MACT,QAAQ,CACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ,GACA;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ,CACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;IACF;GACF;GACA;IACE,IAAI;IACJ,MAAM;IACN,aAAa;IACb,YAAY;KACV;MACE,IAAI;MACJ,MAAM;MACN,aAAa;MACb,QACE;MACF,UAAU;MACV,SACE;MACF,QAAQ;OACN;QACE,IAAI;QACJ,MAAM;QACN,MAAM;QACN,aAAa;QACb,UAAU;OACZ;OACA;QACE,IAAI;QACJ,MAAM;QACN,MAAM;QACN,aAAa;QACb,UAAU;OACZ;OACA;QACE,IAAI;QACJ,MAAM;QACN,MAAM;QACN,aACE;QACF,UAAU;OACZ;OACA;QACE,IAAI;QACJ,MAAM;QACN,MAAM;QACN,aAAa;QACb,UAAU;OACZ;MACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;KACA;MACE,IAAI;MACJ,MAAM;MACN,aAAa;MACb,QACE;MACF,UAAU;MACV,SACE;MACF,QAAQ;OACN;QACE,IAAI;QACJ,MAAM;QACN,MAAM;QACN,aAAa;QACb,UAAU;OACZ;OACA;QACE,IAAI;QACJ,MAAM;QACN,MAAM;QACN,aAAa;QACb,UAAU;OACZ;OACA;QACE,IAAI;QACJ,MAAM;QACN,MAAM;QACN,aACE;QACF,UAAU;OACZ;OACA;QACE,IAAI;QACJ,MAAM;QACN,MAAM;QACN,aAAa;QACb,UAAU;OACZ;MACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;KACA;MACE,IAAI;MACJ,MAAM;MACN,aAAa;MACb,QAAQ;MACR,UAAU;MACV,SACE;MACF,QAAQ,CACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ,CACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;KACA;MACE,IAAI;MACJ,MAAM;MACN,aACE;MACF,QACE;MACF,UACE;MACF,SACE;MACF,QAAQ,CACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ,GACA;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ,CACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;IACF;GACF;GACA;IACE,IAAI;IACJ,MAAM;IACN,aAAa;IACb,YAAY,CACV;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QACE;KACF,UACE;KACF,SACE;KACF,QAAQ;MACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ;MACA;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aACE;OACF,UAAU;MACZ;MACA;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ;MACA;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aACE;OACF,UAAU;MACZ;KACF;KACA,UAAU,CAAC;KACX,OAAO;IACT,GACA;KACE,IAAI;KACJ,MAAM;KACN,aAAa;KACb,QAAQ;KACR,UAAU;KACV,SACE;KACF,QAAQ,CACN;MACE,IAAI;MACJ,MAAM;MACN,MAAM;MACN,aAAa;MACb,UAAU;KACZ,CACF;KACA,UAAU,CAAC;KACX,OAAO;IACT,CACF;GACF;GACA;IACE,IAAI;IACJ,MAAM;IACN,aAAa;IACb,YAAY,CACV;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QACE;KACF,UAAU;KACV,SACE;KACF,QAAQ,CACN;MACE,IAAI;MACJ,MAAM;MACN,MAAM;MACN,aACE;MACF,UAAU;KACZ,GACA;MACE,IAAI;MACJ,MAAM;MACN,MAAM;MACN,aAAa;MACb,UAAU;KACZ,CACF;KACA,UAAU,CAAC;KACX,OAAO;IACT,GACA;KACE,IAAI;KACJ,MAAM;KACN,aAAa;KACb,QAAQ;KACR,UAAU;KACV,SACE;KACF,QAAQ,CACN;MACE,IAAI;MACJ,MAAM;MACN,MAAM;MACN,aAAa;MACb,UAAU;KACZ,CACF;KACA,UAAU,CAAC;KACX,OAAO;IACT,CACF;GACF;GACA;IACE,IAAI;IACJ,MAAM;IACN,aAAa;IACb,YAAY,CACV;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QACE;KACF,UAAU;KACV,SACE;KACF,QAAQ,CAAC;KACT,UAAU,CAAC;KACX,OAAO;IACT,CACF;GACF;GACA;IACE,IAAI;IACJ,MAAM;IACN,aAAa;IACb,YAAY,CACV;KACE,IAAI;KACJ,MAAM;KACN,aAAa;KACb,QACE;KACF,UAAU;KACV,SACE;KACF,Q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nB,OAAO,2BAA2B,OAAO;GACvC,UAAU,EAAE,GAAG,QAA2C;GAC1D,iBAAiB;EACnB,CAAC;CACH;CACA,cAAc,OAAO;EACnB,OAAO,gBAAgB,KAAK;CAC9B;CACA,oBAAoB,OAAO;EACzB,OAAO,sBAAsB,KAAK;CACpC;CACA,iBAAiB,UAAU;EACzB,OAAO,mBAAmB,QAAQ;CACpC;CACA,uBAAuB,UAAU;EAC/B,OAAO,yBAAyB,QAAQ;CAC1C;AACF;;;;;;;AEhFA,MAAa,QAA6C;CACxD,GAAGC;CACH,GAAGC;AACL;;;;ACAA,MAAa,WAAW;CACtB,SAAS;CACT;CACA;CACA;CACA,eAAe,YAAY,iBAAiB,GAAG,aAAa;AAC9D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"trigger-text-BRqIHmRS.mjs","names":[],"sources":["../../editors/workflow-editor/ui/model.ts","../../editors/workflow-editor/ui/PublishControls.tsx","../../editors/workflow-editor/ui/StepError.tsx","../../editors/shared/document-ref.tsx","../../editors/shared/data-viewer.tsx","../../editors/workflow-editor/ui/trigger-text.ts"],"sourcesContent":["// Plain view model + callbacks; no document-model imports so the UI layer\n// stays independent of Powerhouse document plumbing.\nimport type { AddedBlock } from \"./add-follow-up.js\";\nimport type { BlockForm } from \"./forms.js\";\n\nexport type WorkflowStatusValue = \"DRAFT\" | \"ENABLED\" | \"DISABLED\" | \"ARCHIVED\";\n\nexport interface PointModel {\n x: number;\n y: number;\n}\n\nexport type PropertyModeValue = \"MANUAL\" | \"EXPRESSION\";\n\nexport interface PropertySettingModel {\n prop: string;\n mode: PropertyModeValue;\n // A DYNAMIC prop's resolved children, options stripped.\n schema?: unknown;\n}\n\nexport interface TestRecordModel {\n runId: string;\n testedAt: string;\n}\n\n// Editor bookkeeping on a step or the trigger; absent on older documents.\nexport interface BlockStateModel {\n propertySettings?: PropertySettingModel[] | null;\n lastTest?: TestRecordModel | null;\n updatedAt?: string | null;\n}\n\nexport interface TriggerModel extends BlockStateModel {\n id: string;\n pieceName: string;\n pieceVersion: string;\n triggerName: string;\n config: unknown;\n connectionId: string | null;\n // A REACTOR connection, for a trigger that declares requireReactor.\n reactorConnectionId?: string | null;\n}\n\nexport type BackoffKindValue = \"FIXED\" | \"EXPONENTIAL\";\n\nexport interface RetryPolicyModel {\n maxAttempts: number;\n backoff: BackoffKindValue;\n initialDelaySeconds: number;\n maxDelaySeconds: number;\n retryOn: string[];\n}\n\nexport interface StepModel extends BlockStateModel {\n id: string;\n key: string;\n name: string;\n pieceName: string;\n pieceVersion: string;\n actionName: string;\n connectionId: string | null;\n // A REACTOR connection, for an action that declares requireReactor.\n reactorConnectionId?: string | null;\n config: unknown;\n retry: RetryPolicyModel | null;\n timeoutSeconds: number | null;\n idempotencyKeyExpression: string | null;\n position: PointModel | null;\n skip?: boolean;\n}\n\nexport interface EdgeModel {\n id: string;\n from: string;\n to: string;\n port: string;\n condition: string | null;\n}\n\nexport type VariableTypeValue =\n | \"TEXT\"\n | \"NUMBER\"\n | \"BOOLEAN\"\n | \"JSON\"\n | \"SECRET\";\n\nexport interface VariableModel {\n id: string;\n key: string;\n value: unknown;\n description: string | null;\n // Null means untyped: the type is inferred from the value.\n type?: VariableTypeValue | null;\n}\n\nexport interface PublishedBlockModel {\n id: string;\n // The step's name, or \"Trigger\".\n label: string;\n pieceName: string;\n pieceVersion: string;\n kind: \"action\" | \"trigger\";\n name: string;\n reactorConnectionId: string | null;\n}\n\nexport interface PublishedModel {\n version: number;\n publishedAt: string;\n // The snapshot's blocks, trigger first; what actually runs.\n blocks?: PublishedBlockModel[];\n}\n\nexport interface WorkflowModel {\n name: string;\n description?: string | null;\n status: WorkflowStatusValue;\n version: number;\n trigger: TriggerModel | null;\n steps: StepModel[];\n edges: EdgeModel[];\n variables: VariableModel[];\n published?: PublishedModel | null;\n // Writes nothing, bookkeeping included.\n readOnly?: boolean;\n}\n\n// The side panel's id for the variables editor, beside step and trigger ids.\nexport const VARIABLES_VIEW = \"__variables\";\n\n/** Query params of the editor's view: the open panel and its tab. */\nexport const STEP_PARAM = \"step\";\nexport const TAB_PARAM = \"tab\";\n\n// Unpublished changes: never published, or edited since.\nexport function hasDraftChanges(\n model: Pick<WorkflowModel, \"version\" | \"published\">,\n): boolean {\n return !model.published || model.published.version !== model.version;\n}\n\nexport interface AddStepInputModel {\n key: string;\n name: string;\n pieceName: string;\n pieceVersion: string;\n actionName: string;\n config: unknown;\n position?: PointModel;\n}\n\nexport interface UpdateStepInputModel {\n id: string;\n key?: string;\n name?: string;\n // \"Update to vZ\" edits only pieceVersion.\n pieceName?: string;\n pieceVersion?: string;\n actionName?: string;\n // null clears the step's connection.\n connectionId?: string | null;\n reactorConnectionId?: string | null;\n config?: unknown;\n // null clears each of these; undefined leaves them unchanged.\n retry?: RetryPolicyModel | null;\n timeoutSeconds?: number | null;\n idempotencyKeyExpression?: string | null;\n position?: PointModel;\n skip?: boolean;\n}\n\n// Field modes and DYNAMIC schemas ride along with the config edit they\n// belong to; undefined leaves them as they are.\nexport interface ConfigExtras {\n propertySettings?: PropertySettingModel[];\n}\n\nexport interface WorkflowEditorCallbacks {\n setName: (name: string) => void;\n setDescription: (description: string) => void;\n setStatus: (status: WorkflowStatusValue) => void;\n setTrigger: (\n input: {\n pieceName: string;\n pieceVersion: string;\n triggerName: string;\n config: unknown;\n connectionId?: string | null;\n reactorConnectionId?: string | null;\n } & ConfigExtras,\n ) => AddedBlock;\n // Field-level trigger edits: each leaves the trigger's other fields alone.\n setTriggerConfig: (config: unknown, extras?: ConfigExtras) => void;\n // null clears a connection; undefined leaves it unchanged.\n setTriggerConnection: (input: {\n connectionId?: string | null;\n reactorConnectionId?: string | null;\n }) => void;\n setTriggerPieceVersion: (pieceVersion: string) => void;\n clearTrigger: () => void;\n addStep: (input: AddStepInputModel) => AddedBlock;\n updateStep: (input: UpdateStepInputModel) => void;\n setStepConfig: (id: string, config: unknown, extras?: ConfigExtras) => void;\n // Snapshots the draft and turns the workflow on; resolves once applied.\n publish: () => Promise<void>;\n discardChanges: () => void;\n removeStep: (id: string) => void;\n addEdge: (input: {\n from: string;\n to: string;\n port: string;\n condition?: string;\n }) => void;\n removeEdge: (id: string) => void;\n // Upserts by id; no id adds a variable. Keys are unique.\n setVariable: (input: {\n id?: string;\n key: string;\n value: unknown;\n description?: string;\n // Undefined leaves the type as is; null clears it.\n type?: VariableTypeValue | null;\n }) => void;\n removeVariable: (id: string) => void;\n // Composite operations backing the canvas add buttons.\n // `port` is the inserted block's own port the old edge's target hangs off.\n insertStepOnEdge: (\n edgeId: string,\n input: AddStepInputModel,\n port: string,\n ) => AddedBlock | undefined;\n appendStep: (\n fromId: string,\n port: string,\n input: AddStepInputModel,\n ) => AddedBlock;\n // Completes a block added before its form loaded: the defaults still unset\n // and the port it continues on. Nothing when the block is gone.\n completeBlock: (added: AddedBlock, form: BlockForm) => void;\n // Copies a step with its config and advanced settings, detached from the\n // graph so no port ends up with two edges.\n duplicateStep: (id: string) => void;\n // Re-parents a step onto a port, keeping whatever follows it.\n moveStep: (move: {\n stepId: string;\n toParentId: string;\n port: string;\n }) => void;\n}\n\n// Slugified step key derived from a label, suffixed until it is free.\nexport function uniqueStepKey(taken: string[], label: string): string {\n const base =\n label\n .toLowerCase()\n .replaceAll(/[^a-z0-9]+/g, \"_\")\n .replaceAll(/^_+|_+$/g, \"\") || \"step\";\n const keys = new Set(taken);\n let key = base;\n let suffix = 2;\n while (keys.has(key)) key = `${base}_${suffix++}`;\n return key;\n}\n","// Publishing, the Activepieces way: a draft that is always editable, a\n// Publish that snapshots it, and an on/off switch for the published flow.\nimport { useState } from \"react\";\nimport { Button, Toggle, Tooltip } from \"../../shared/controls.js\";\nimport {\n hasDraftChanges,\n type WorkflowEditorCallbacks,\n type WorkflowModel,\n type WorkflowStatusValue,\n} from \"./model.js\";\nimport type { WorkflowReadiness } from \"./validation.js\";\n\n// Under enforcement a publish must be signed, or its runs reach no documents.\nexport interface PublishSignIn {\n required: boolean;\n pending: boolean;\n login: () => void;\n}\n\nfunction blockedReason(readiness: WorkflowReadiness): string {\n if (!readiness.hasTrigger) return \"Add a trigger first\";\n if (readiness.firstIncomplete) return \"You have incomplete steps\";\n return \"Checking the steps…\";\n}\n\nexport function usePublish(callbacks: WorkflowEditorCallbacks) {\n const [publishing, setPublishing] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const publish = () => {\n if (publishing) return;\n setPublishing(true);\n setError(null);\n callbacks\n .publish()\n .catch((cause: unknown) =>\n setError(cause instanceof Error ? cause.message : String(cause)),\n )\n .finally(() => setPublishing(false));\n };\n return { publishing, error, publish };\n}\n\nexport function PublishButton(props: {\n model: WorkflowModel;\n readiness: WorkflowReadiness;\n publishing: boolean;\n onPublish: () => void;\n onSelect: (id: string) => void;\n size?: \"sm\" | \"md\";\n signIn?: PublishSignIn;\n}) {\n const { model, readiness } = props;\n if (props.signIn?.required) {\n return (\n <Tooltip content=\"This Switchboard enforces document permissions, so a publish must be signed\">\n <Button\n size={props.size ?? \"sm\"}\n variant=\"primary\"\n disabled={props.signIn.pending}\n onClick={props.signIn.login}\n >\n Sign in to publish\n </Button>\n </Tooltip>\n );\n }\n const incomplete = !readiness.ready;\n const changes = hasDraftChanges(model);\n const target = readiness.firstIncomplete;\n const select = () => {\n if (target) props.onSelect(target);\n };\n return (\n <Tooltip\n enabled={incomplete}\n content={\n <button\n type=\"button\"\n className=\"font-medium text-wf-warn hover:underline\"\n onClick={select}\n >\n {blockedReason(readiness)}\n </button>\n }\n >\n {/* The disabled button passes clicks through to this wrapper. */}\n <span className=\"inline-flex\" onClick={incomplete ? select : undefined}>\n <Button\n size={props.size ?? \"sm\"}\n variant=\"primary\"\n disabled={incomplete || !changes || props.publishing}\n title={!changes && !incomplete ? \"No unpublished changes\" : undefined}\n onClick={props.onPublish}\n >\n {props.publishing ? \"Publishing…\" : \"Publish\"}\n </Button>\n </span>\n </Tooltip>\n );\n}\n\n// A dot and a word: Draft until first published, then Published, or\n// Unpublished changes once the draft moves on.\nexport function PublishState(props: {\n model: Pick<WorkflowModel, \"version\" | \"published\">;\n}) {\n const draft = hasDraftChanges(props.model);\n return (\n <span\n className=\"flex shrink-0 items-center gap-1.5 whitespace-nowrap text-xs text-muted-foreground\"\n title={\n props.model.published\n ? `Published ${new Date(props.model.published.publishedAt).toLocaleString()}`\n : \"Never published\"\n }\n >\n <span\n aria-hidden\n className={`h-2 w-2 rounded-full ${draft ? \"bg-wf-warn\" : \"bg-wf-ok\"}`}\n />\n <span>\n {!props.model.published\n ? \"Draft\"\n : draft\n ? \"Unpublished changes\"\n : \"Published\"}\n </span>\n {props.model.published && draft ? (\n <span className=\"text-muted-foreground/80\">\n · v{props.model.published.version} live\n </span>\n ) : null}\n </span>\n );\n}\n\nexport function StatusToggle(props: {\n published: boolean;\n status: WorkflowStatusValue;\n onChange: (status: WorkflowStatusValue) => void;\n tooltipSide?: \"below\" | \"left\";\n}) {\n // Nothing runs until the first publish.\n const allowed = props.published;\n const on = props.status === \"ENABLED\";\n return (\n <Tooltip\n enabled={!allowed}\n content=\"Publish the workflow first\"\n align=\"end\"\n side={props.tooltipSide}\n >\n <span className=\"flex items-center gap-2 text-xs text-muted-foreground\">\n <Toggle\n checked={on}\n disabled={!allowed}\n label={on ? \"Turn the workflow off\" : \"Turn the workflow on\"}\n onChange={(checked) =>\n props.onChange(checked ? \"ENABLED\" : \"DISABLED\")\n }\n />\n <span className=\"w-6\">{on ? \"On\" : \"Off\"}</span>\n </span>\n </Tooltip>\n );\n}\n\n// The live snapshot's blocks that need a reactor connection and bind none.\nexport function PublishedMissingNote(props: { missing: readonly string[] }) {\n if (props.missing.length === 0) return null;\n return (\n <span\n role=\"alert\"\n aria-label=\"Published version incomplete\"\n className=\"shrink-0 whitespace-nowrap rounded-full bg-wf-warn/12 px-2 py-0.5 text-xs text-wf-warn\"\n title={`The published version is missing a reactor connection on: ${props.missing.join(\", \")}`}\n >\n Live version incomplete\n </span>\n );\n}\n\n// Why the runtime won't give the published workflow reactor access.\nexport function ReactorDenialNote(props: { denial: string | null }) {\n if (!props.denial) return null;\n return (\n <span\n role=\"alert\"\n aria-label=\"Reactor access denied\"\n className=\"max-w-80 truncate rounded-full bg-wf-warn/12 px-2 py-0.5 text-xs text-wf-warn\"\n title={props.denial}\n >\n No reactor access: {props.denial}\n </span>\n );\n}\n\nexport function DraftBanner(props: {\n model: WorkflowModel;\n readiness: WorkflowReadiness;\n publishing: boolean;\n error: string | null;\n onPublish: () => void;\n onDiscard: () => void;\n onSelect: (id: string) => void;\n signIn?: PublishSignIn;\n}) {\n if (!hasDraftChanges(props.model)) return null;\n const { readiness } = props;\n const target = readiness.firstIncomplete;\n return (\n <div\n role=\"status\"\n className=\"pointer-events-auto flex items-center gap-3 rounded-lg border border-solid border-foreground/10 bg-card py-1.5 pl-3 pr-1.5 text-[13px] shadow-sm\"\n >\n <span className=\"h-2 w-2 shrink-0 rounded-full bg-wf-warn\" aria-hidden />\n <span className=\"text-foreground\">You have unpublished changes</span>\n {props.error ? (\n <span className=\"text-xs text-wf-fail\">{props.error}</span>\n ) : null}\n {!readiness.hasTrigger || target ? (\n <span className=\"flex items-center gap-1.5 text-xs text-wf-warn\">\n <span>{target ? \"Incomplete steps\" : \"No trigger yet\"}</span>\n {target ? (\n <button\n type=\"button\"\n className=\"font-medium underline underline-offset-2 hover:no-underline\"\n onClick={() => props.onSelect(target)}\n >\n Show\n </button>\n ) : null}\n </span>\n ) : null}\n <span className=\"flex items-center gap-1\">\n {props.model.published ? (\n <Button size=\"sm\" variant=\"ghost\" onClick={props.onDiscard}>\n Discard changes\n </Button>\n ) : null}\n <PublishButton\n model={props.model}\n readiness={readiness}\n publishing={props.publishing}\n onPublish={props.onPublish}\n onSelect={props.onSelect}\n signIn={props.signIn}\n />\n </span>\n </div>\n );\n}\n","// A step's error from a run.\nexport function StepError(props: { error: string }) {\n return (\n <pre className=\"overflow-auto whitespace-pre-wrap rounded-md bg-wf-fail/10 p-2.5 text-xs text-wf-fail\">\n {props.error}\n </pre>\n );\n}\n","// The documents a run's data references: the run journal keeps a reference\n// (id, type, branch, revision) in place of a document's state.\nimport type { DocumentReference } from \"@powerhousedao/pieces-framework/workflow\";\nimport { useSetSelectedNode } from \"@powerhousedao/reactor-browser\";\nimport { Button } from \"./controls.js\";\n\n// Beyond this many, the rest are counted.\nconst SHOWN = 3;\n\nfunction shortId(id: string): string {\n return id.length > 16 ? `${id.slice(0, 6)}…${id.slice(-6)}` : id;\n}\n\nfunction revisionText(reference: DocumentReference): string {\n const scopes = Object.entries(reference.revision)\n .map(([scope, count]) => `${scope} ${count}`)\n .join(\" · \");\n return reference.branch === \"main\"\n ? scopes\n : `${reference.branch}: ${scopes}`;\n}\n\nfunction DocumentRefRow(props: { reference: DocumentReference }) {\n const { reference } = props;\n const setSelectedNode = useSetSelectedNode();\n return (\n <li\n aria-label={`Document ${reference.documentId}`}\n className=\"flex items-center gap-2\"\n >\n <div className=\"min-w-0 flex-1 text-xs\">\n <div className=\"flex min-w-0 items-baseline gap-1.5\">\n <span className=\"truncate font-medium text-foreground\">\n {reference.documentType}\n </span>\n <span\n className=\"shrink-0 font-mono text-[11px] text-muted-foreground\"\n title={reference.documentId}\n >\n {shortId(reference.documentId)}\n </span>\n </div>\n <div className=\"truncate text-[11px] text-muted-foreground\">\n Revision {revisionText(reference)}\n </div>\n </div>\n <Button\n size=\"sm\"\n onClick={() => setSelectedNode(reference.documentId)}\n aria-label={`Open document ${reference.documentId}`}\n >\n Open document\n </Button>\n </li>\n );\n}\n\nexport function DocumentRefs(props: { references: DocumentReference[] }) {\n const { references } = props;\n const hidden = references.length - SHOWN;\n return (\n <div\n role=\"group\"\n aria-label=\"Document references\"\n className=\"flex flex-col gap-1.5\"\n >\n <ul className=\"m-0 flex list-none flex-col gap-1.5 p-0\">\n {references.slice(0, SHOWN).map((reference, index) => (\n <DocumentRefRow\n key={`${reference.documentId}-${index}`}\n reference={reference}\n />\n ))}\n </ul>\n {hidden > 0 ? (\n <p className=\"text-[11px] text-muted-foreground\">\n and {hidden} more in the data below\n </p>\n ) : null}\n <p className=\"text-[11px] text-muted-foreground\">\n The run kept a reference, not the state. Opening shows the document as\n it is now: past revisions can&apos;t be read yet (#3179).\n </p>\n </div>\n );\n}\n","// A run's data (a step's input or output, a trigger payload) as a foldable\n// tree, with a raw JSON view and, given a root, per-key {{references}}.\nimport {\n DOCUMENT_REF_KEY,\n documentRefsIn,\n isDocumentRefMarker,\n} from \"@powerhousedao/pieces-framework/workflow\";\nimport { lazy, Suspense, useState } from \"react\";\nimport { IconButton } from \"./controls.js\";\nimport { DocumentRefs } from \"./document-ref.js\";\n\nconst DataTree = lazy(() => import(\"./data-tree.js\"));\n\nfunction stringify(value: unknown): string {\n try {\n // undefined for functions and symbols, despite the typing.\n return (JSON.stringify(value, null, 2) as string | undefined) ?? \"\";\n } catch {\n return String(value as string);\n }\n}\n\nfunction isEmpty(value: unknown): boolean {\n if (value === undefined || value === null) return true;\n if (typeof value === \"object\") return Object.keys(value).length === 0;\n return false;\n}\n\nfunction RawJson(props: { text: string }) {\n return (\n <pre className=\"max-h-72 overflow-auto whitespace-pre-wrap break-words font-mono text-xs text-foreground\">\n {props.text}\n </pre>\n );\n}\n\n// Stands in while the tree's chunk loads.\nfunction TreeSkeleton() {\n return (\n <div\n role=\"status\"\n aria-label=\"Loading data\"\n className=\"flex animate-pulse flex-col gap-2 py-1\"\n >\n {[\"w-2/5\", \"w-3/5\", \"w-1/2\", \"w-1/3\"].map((width, index) => (\n <span\n key={width}\n className={`h-2.5 rounded bg-muted ${width}`}\n style={{ marginLeft: index === 0 ? 0 : 16 }}\n />\n ))}\n </div>\n );\n}\n\nexport function DataViewer(props: {\n label: string;\n value: unknown;\n // Expression prefix for this value, e.g. \"steps.fetch.output\".\n root?: string;\n emptyText?: string;\n}) {\n const [raw, setRaw] = useState(false);\n const [copied, setCopied] = useState(false);\n const empty = isEmpty(props.value);\n const text = stringify(props.value);\n const tree = typeof props.value === \"object\" && props.value !== null;\n const references = tree ? documentRefsIn(props.value) : [];\n // A whole value that is a reference shows as one; its other keys stay a tree.\n const treeValue = isDocumentRefMarker(props.value)\n ? Object.fromEntries(\n Object.entries(props.value).filter(([key]) => key !== DOCUMENT_REF_KEY),\n )\n : props.value;\n\n return (\n <section\n aria-label={props.label}\n className=\"min-w-0 rounded-md border border-solid border-border bg-card\"\n >\n <header className=\"flex h-8 items-center gap-1 border-b border-solid border-border pl-3 pr-1\">\n <h4 className=\"mr-auto text-xs font-medium text-foreground\">\n {props.label}\n </h4>\n {!empty && tree ? (\n <button\n type=\"button\"\n aria-pressed={raw}\n className=\"rounded px-1.5 py-0.5 text-[11px] text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40\"\n onClick={() => setRaw((value) => !value)}\n >\n {raw ? \"Tree\" : \"JSON\"}\n </button>\n ) : null}\n {!empty ? (\n <IconButton\n icon={copied ? \"check\" : \"copy\"}\n label={`Copy ${props.label.toLowerCase()} as JSON`}\n onClick={() => {\n void navigator.clipboard.writeText(text).then(() => {\n setCopied(true);\n setTimeout(() => setCopied(false), 1500);\n });\n }}\n />\n ) : null}\n </header>\n <div className=\"px-3 py-2\">\n {empty ? (\n <p className=\"text-xs text-muted-foreground\">\n {props.emptyText ?? \"Nothing\"}\n </p>\n ) : !tree ? (\n <p className=\"break-words font-mono text-xs text-foreground\">\n {text}\n </p>\n ) : raw ? (\n <RawJson text={text} />\n ) : (\n <div className=\"flex flex-col gap-2\">\n {references.length > 0 ? (\n <DocumentRefs references={references} />\n ) : null}\n {isEmpty(treeValue) ? null : (\n <div className=\"max-h-72 overflow-auto\">\n <Suspense fallback={<TreeSkeleton />}>\n <DataTree value={treeValue as object} root={props.root} />\n </Suspense>\n </div>\n )}\n </div>\n )}\n </div>\n </section>\n );\n}\n","// Plain-language descriptions of when a workflow starts: \"Every day at\n// 08:00 UTC\" rather than \"0 8 * * *\". Unknown shapes fall back to the raw text.\nimport { blockKey } from \"@powerhousedao/pieces-framework/block-type\";\nimport { blockMeta } from \"./block-meta.js\";\nimport {\n MANUAL_TRIGGER,\n REACTOR_PIECE,\n SCHEDULE_TRIGGER,\n WEBHOOK_TRIGGER,\n} from \"./blocks.js\";\nimport { parseScheduleConfig } from \"@powerhousedao/pieces-framework/workflow\";\n\nconst WEEKDAYS = [\n \"Sunday\",\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\",\n];\n\nconst UNIT_LABEL: Record<string, [string, string]> = {\n minutes: [\"minute\", \"minutes\"],\n hours: [\"hour\", \"hours\"],\n days: [\"day\", \"days\"],\n};\n\nfunction isInt(field: string): boolean {\n return /^\\d+$/.test(field);\n}\n\nfunction clock(hour: string, minute: string): string {\n return `${hour.padStart(2, \"0\")}:${minute.padStart(2, \"0\")}`;\n}\n\nfunction dayList(field: string): string | undefined {\n if (field === \"1-5\") return \"on weekdays\";\n if (field === \"0,6\" || field === \"6,0\") return \"at weekends\";\n const days = field.split(\",\");\n if (!days.every((day) => isInt(day) && Number(day) <= 7)) return undefined;\n const names = days.map((day) => WEEKDAYS[Number(day) % 7]);\n if (names.length === 1) return `every ${names[0]}`;\n return `on ${names.slice(0, -1).join(\", \")} and ${names[names.length - 1]}`;\n}\n\n/** Describes a five-field cron expression, or returns undefined. */\nexport function describeCron(cron: string): string | undefined {\n const fields = cron.trim().split(/\\s+/);\n if (fields.length !== 5) return undefined;\n const [minute, hour, dayOfMonth, month, dayOfWeek] = fields;\n if (month !== \"*\") return undefined;\n\n const everyMinutes = /^\\*\\/(\\d+)$/.exec(minute);\n if (everyMinutes && hour === \"*\" && dayOfMonth === \"*\" && dayOfWeek === \"*\") {\n const n = Number(everyMinutes[1]);\n return n === 1 ? \"Every minute\" : `Every ${n} minutes`;\n }\n if (minute === \"*\" && hour === \"*\" && dayOfMonth === \"*\" && dayOfWeek === \"*\")\n return \"Every minute\";\n if (isInt(minute) && hour === \"*\" && dayOfMonth === \"*\" && dayOfWeek === \"*\")\n return minute === \"0\"\n ? \"Every hour, on the hour\"\n : `Every hour at ${minute.padStart(2, \"0\")} past`;\n\n const everyHours = /^\\*\\/(\\d+)$/.exec(hour);\n if (isInt(minute) && everyHours && dayOfMonth === \"*\" && dayOfWeek === \"*\") {\n return `Every ${everyHours[1]} hours`;\n }\n if (!isInt(minute) || !isInt(hour)) return undefined;\n const at = clock(hour, minute);\n\n if (dayOfMonth === \"*\" && dayOfWeek === \"*\") return `Every day at ${at}`;\n if (dayOfMonth === \"*\") {\n const days = dayList(dayOfWeek);\n return days\n ? `${days.charAt(0).toUpperCase()}${days.slice(1)} at ${at}`\n : undefined;\n }\n if (isInt(dayOfMonth) && dayOfWeek === \"*\") {\n return `Every month on day ${dayOfMonth} at ${at}`;\n }\n return undefined;\n}\n\nexport function describeSchedule(config: unknown): string {\n let schedule;\n try {\n schedule = parseScheduleConfig(config);\n } catch {\n return \"On a schedule that does not parse\";\n }\n if (schedule.mode === \"interval\") {\n const unit = UNIT_LABEL[schedule.unit];\n return schedule.every === 1\n ? `Every ${unit[0]}`\n : `Every ${schedule.every} ${unit[1]}`;\n }\n const described = describeCron(schedule.cron);\n return described\n ? `${described} ${schedule.timezone}`\n : `On schedule ${schedule.cron}`;\n}\n\n// A literal config value; an expression or a blank says nothing to show.\nfunction literal(config: unknown, key: string): string | undefined {\n if (!config || typeof config !== \"object\") return undefined;\n const value = (config as Record<string, unknown>)[key];\n if (typeof value !== \"string\") return undefined;\n const text = value.trim();\n return text && !text.includes(\"{{\") ? text : undefined;\n}\n\n// \"umh/production-ledger\" reads as \"Production Ledger\".\nfunction documentTypeLabel(documentType: string): string {\n const name = documentType.split(\"/\").pop() ?? documentType;\n return name\n .split(/[-_\\s]+/)\n .filter(Boolean)\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \");\n}\n\n// \"APPROVE_ORDER\" reads as \"Approve order\".\nfunction actionTypeLabel(actionType: string): string {\n const words = actionType\n .toLowerCase()\n .split(/[_\\s]+/)\n .filter(Boolean);\n const text = words.join(\" \");\n return text.charAt(0).toUpperCase() + text.slice(1);\n}\n\n/** Describes a reactor document trigger by what it filters on. */\nexport function describeDocumentTrigger(\n triggerName: string,\n config: unknown,\n): string | undefined {\n const documentType = literal(config, \"documentType\");\n const label = documentType ? documentTypeLabel(documentType) : \"\";\n const subject = label\n ? `${/^[AEIOU]/.test(label) ? \"an\" : \"a\"} ${label}`\n : literal(config, \"documentId\")\n ? \"its document\"\n : \"a document\";\n switch (triggerName) {\n case \"document-event\": {\n const actionType = literal(config, \"actionType\");\n return actionType\n ? `When ${actionTypeLabel(actionType)} runs on ${subject}`\n : `When ${subject} changes`;\n }\n case \"document-created\":\n return `When ${subject} is created`;\n case \"document-deleted\":\n return `When ${subject} is deleted`;\n default:\n return undefined;\n }\n}\n\n/** When a workflow starts, from its trigger. */\nexport function describeTrigger(\n trigger:\n | { pieceName: string; triggerName: string; config: unknown }\n | null\n | undefined,\n): string {\n if (!trigger) return \"Never starts: no trigger\";\n const block = {\n pieceName: trigger.pieceName,\n kind: \"trigger\" as const,\n name: trigger.triggerName,\n };\n switch (blockKey(block)) {\n case blockKey(MANUAL_TRIGGER):\n return \"Manual\";\n case blockKey(WEBHOOK_TRIGGER):\n return \"When its webhook is called\";\n case blockKey(SCHEDULE_TRIGGER):\n return describeSchedule(trigger.config);\n default: {\n if (trigger.pieceName === REACTOR_PIECE) {\n const described = describeDocumentTrigger(\n trigger.triggerName,\n trigger.config,\n );\n if (described) return described;\n }\n const meta = blockMeta(block);\n const piece = meta.subtitle.replace(/ · Trigger$/, \"\");\n return `${meta.displayName} in ${piece}`;\n }\n }\n}\n"],"mappings":";;;;;;;AAiIA,MAAa,iBAAiB;;AAG9B,MAAa,aAAa;AAI1B,SAAgB,gBACd,OACS;CACT,OAAO,CAAC,MAAM,aAAa,MAAM,UAAU,YAAY,MAAM;AAC/D;AAgHA,SAAgB,cAAc,OAAiB,OAAuB;CACpE,MAAM,OACJ,MACG,YAAY,CAAC,CACb,WAAW,eAAe,GAAG,CAAC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AQ;EACzB,SACE;CACJ;AACF;;AAGA,SAAgB,gBACd,SAIQ;CACR,IAAI,CAAC,SAAS,OAAO;CACrB,MAAM,QAAQ;EACZ,WAAW,QAAQ;EACnB,MAAM;EACN,MAAM,QAAQ;CAChB;CACA,QAAQ,SAAS,KAAK,GAAtB;EACE,KAAK,SAAS,cAAc,GAC1B,OAAO;EACT,KAAK,SAAS,eAAe,GAC3B,OAAO;EACT,KAAK,SAAS,gBAAgB,GAC5B,OAAO,iBAAiB,QAAQ,MAAM;EACxC,SAAS;GACP,IAAI,QAAQ,cAAA,gCAA6B;IACvC,MAAM,YAAY,wBAChB,QAAQ,aACR,QAAQ,MACV;IACA,IAAI,WAAW,OAAO;GACxB;GACA,MAAM,OAAO,UAAU,KAAK;GAC5B,MAAM,QAAQ,KAAK,SAAS,QAAQ,eAAe,EAAE;GACrD,OAAO,GAAG,KAAK,YAAY,MAAM;EACnC;CACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"workflow-BS5m4jtr.mjs","names":["createState"],"sources":["../../document-models/workflow/v1/gen/controller.ts","../../document-models/workflow/v1/gen/ph-factories.ts","../../document-models/workflow/v1/hooks.ts"],"sourcesContent":["/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { PHDocumentController } from \"document-model\";\nimport { Workflow } from \"../module.js\";\nimport type { WorkflowAction, WorkflowPHState } from \"./types.js\";\n\nexport const WorkflowController = PHDocumentController.forDocumentModel<\n WorkflowPHState,\n WorkflowAction\n>(Workflow);\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n * Factory methods for creating WorkflowDocument instances\n */\nimport type { PHAuthState, PHBaseState, PHDocumentState } from \"document-model\";\nimport { createBaseState, defaultBaseState } from \"document-model\";\nimport type {\n WorkflowDocument,\n WorkflowGlobalState,\n WorkflowLocalState,\n WorkflowPHState,\n} from \"./types.js\";\nimport { utils } from \"./utils.js\";\n\nexport function defaultGlobalState(): WorkflowGlobalState {\n return {\n name: \"\",\n description: null,\n status: \"DRAFT\",\n version: 0,\n trigger: null,\n steps: [],\n edges: [],\n variables: [],\n policy: {\n concurrency: \"QUEUE\",\n maxParallelRuns: null,\n runTimeoutSeconds: 3600,\n maxSuspensionDays: 30,\n defaultRetry: {\n maxAttempts: 1,\n backoff: \"FIXED\",\n initialDelaySeconds: 5,\n maxDelaySeconds: 300,\n retryOn: [],\n },\n onFailure: \"PARK\",\n retainRunsDays: 30,\n journalAsDocument: false,\n },\n published: null,\n lastRunAt: null,\n lastRunStatus: null,\n };\n}\n\nexport function defaultLocalState(): WorkflowLocalState {\n return {};\n}\n\nexport function defaultPHState(): WorkflowPHState {\n return {\n ...defaultBaseState(),\n global: defaultGlobalState(),\n local: defaultLocalState(),\n };\n}\n\nexport function createGlobalState(\n state?: Partial<WorkflowGlobalState>,\n): WorkflowGlobalState {\n return {\n ...defaultGlobalState(),\n ...(state || {}),\n };\n}\n\nexport function createLocalState(\n state?: Partial<WorkflowLocalState>,\n): WorkflowLocalState {\n return {\n ...defaultLocalState(),\n ...(state || {}),\n } as WorkflowLocalState;\n}\n\nexport function createState(\n baseState?: Partial<PHBaseState>,\n globalState?: Partial<WorkflowGlobalState>,\n localState?: Partial<WorkflowLocalState>,\n): WorkflowPHState {\n return {\n ...createBaseState(baseState?.auth, baseState?.document),\n global: createGlobalState(globalState),\n local: createLocalState(localState),\n };\n}\n\n/**\n * Creates a WorkflowDocument with custom global and local state\n * This properly handles the PHBaseState requirements while allowing\n * document-specific state to be set.\n */\nexport function createWorkflowDocument(\n state?: Partial<{\n auth?: Partial<PHAuthState>;\n document?: Partial<PHDocumentState>;\n global?: Partial<WorkflowGlobalState>;\n local?: Partial<WorkflowLocalState>;\n }>,\n): WorkflowDocument {\n const document = utils.createDocument(\n createState(\n createBaseState(state?.auth, { version: 1, ...state?.document }),\n state?.global,\n state?.local,\n ),\n );\n\n return document;\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentDispatch } from \"@powerhousedao/reactor-browser\";\nimport {\n useDocumentById,\n useDocumentsInSelectedDrive,\n useDocumentsInSelectedFolder,\n useSelectedDocument,\n} from \"@powerhousedao/reactor-browser\";\nimport type {\n WorkflowAction,\n WorkflowDocument,\n} from \"document-models/workflow/v1\";\nimport {\n assertIsWorkflowDocument,\n isWorkflowDocument,\n} from \"./gen/document-schema.js\";\n\n/** Hook to get a Workflow document by its id */\nexport function useWorkflowDocumentById(\n documentId: string | null | undefined,\n):\n | [WorkflowDocument, DocumentDispatch<WorkflowAction>]\n | [undefined, undefined] {\n const [document, dispatch] = useDocumentById(documentId);\n if (!isWorkflowDocument(document)) return [undefined, undefined];\n return [document, dispatch];\n}\n\n/** Hook to get the selected Workflow document */\nexport function useSelectedWorkflowDocument(): [\n WorkflowDocument,\n DocumentDispatch<WorkflowAction>,\n] {\n const [document, dispatch] = useSelectedDocument();\n\n assertIsWorkflowDocument(document);\n return [document, dispatch] as const;\n}\n\n/** Hook to get all Workflow documents in the selected drive */\nexport function useWorkflowDocumentsInSelectedDrive() {\n const documentsInSelectedDrive = useDocumentsInSelectedDrive();\n return documentsInSelectedDrive?.filter(isWorkflowDocument);\n}\n\n/** Hook to get all Workflow documents in the selected folder */\nexport function useWorkflowDocumentsInSelectedFolder() {\n const documentsInSelectedFolder = useDocumentsInSelectedFolder();\n return documentsInSelectedFolder?.filter(isWorkflowDocument);\n}\n"],"mappings":";;;;;;;;AAQA,MAAa,qBAAqB,qBAAqB,iBAGrD,QAAQ;;;ACIV,SAAgB,qBAA0C;CACxD,OAAO;EACL,MAAM;EACN,aAAa;EACb,QAAQ;EACR,SAAS;EACT,SAAS;EACT,OAAO,CAAC;EACR,OAAO,CAAC;EACR,WAAW,CAAC;EACZ,QAAQ;GACN,aAAa;GACb,iBAAiB;GACjB,mBAAmB;GACnB,mBAAmB;GACnB,cAAc;IACZ,aAAa;IACb,SAAS;IACT,qBAAqB;IACrB,iBAAiB;IACjB,SAAS,CAAC;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