@powerhousedao/workflow 6.2.3-dev.79 → 6.2.3-dev.81
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.
- package/dist/browser/{BlockSelector-DFX-DZHl.js → BlockSelector-DHVzUGjW.js} +3 -3
- package/dist/browser/BlockSelector-DHVzUGjW.js.map +1 -0
- package/dist/browser/{connection-Ci_pI3kD.js → connection-PaKXHYz9.js} +2 -2
- package/dist/browser/{connection-Ci_pI3kD.js.map → connection-PaKXHYz9.js.map} +1 -1
- package/dist/browser/{connection-form-BuW6qOAF.js → connection-form-D2qAEHsl.js} +33 -13
- package/dist/browser/connection-form-D2qAEHsl.js.map +1 -0
- package/dist/browser/{data-tree-BLn565V5.js → data-tree-BOuPR-2J.js} +2 -2
- package/dist/browser/{data-tree-BLn565V5.js.map → data-tree-BOuPR-2J.js.map} +1 -1
- package/dist/browser/document-models/connection/index.js +2 -2
- package/dist/browser/document-models/index.js +3 -3
- package/dist/browser/document-models/workflow/index.js +3 -3
- package/dist/browser/{document-models-B2IDRvBZ.js → document-models-DSK5cn8B.js} +6 -3
- package/dist/browser/{document-models-B2IDRvBZ.js.map → document-models-DSK5cn8B.js.map} +1 -1
- package/dist/browser/{editor-DBcq58Fr.js → editor--59WtNaj.js} +271 -87
- package/dist/browser/editor--59WtNaj.js.map +1 -0
- package/dist/browser/{editor-B1-_KRbr.js → editor-0XPrGeLT.js} +8 -8
- package/dist/browser/{editor-B1-_KRbr.js.map → editor-0XPrGeLT.js.map} +1 -1
- package/dist/browser/{editor-DPGuck1V.js → editor-BD-5ClkW.js} +10 -10
- package/dist/browser/editor-BD-5ClkW.js.map +1 -0
- package/dist/browser/editors/connection-editor/module.js +1 -1
- package/dist/browser/editors/runtime/index.js +1 -1
- package/dist/browser/editors/workflow-editor/module.js +1 -1
- package/dist/browser/editors/workflow-studio/module.js +1 -1
- package/dist/browser/index.js +5 -5
- package/dist/browser/{module-FuSfFXPT.js → module-DJz6oTX0.js} +56 -56
- package/dist/browser/module-DJz6oTX0.js.map +1 -0
- package/dist/browser/{module-DFCANOuI.js → module-eOpxJVIl.js} +48 -6
- package/dist/browser/module-eOpxJVIl.js.map +1 -0
- package/dist/{node/piece-auth-BS5CtQOG.mjs → browser/piece-auth-63iuNFTs.js} +11 -3
- package/dist/browser/piece-auth-63iuNFTs.js.map +1 -0
- package/dist/browser/reactor/index.js +2 -2
- package/dist/browser/{runtime-queries-C9SoXGm2.js → runtime-queries-LAcyniYz.js} +18 -7
- package/dist/browser/runtime-queries-LAcyniYz.js.map +1 -0
- package/dist/browser/{trigger-text-B2mo1fiB.js → trigger-text-Co-dn9x-.js} +25 -5
- package/dist/browser/trigger-text-Co-dn9x-.js.map +1 -0
- package/dist/browser/upgrade-manifests-CLYUPqBs.js +8 -0
- package/dist/browser/{upgrade-manifests-B62uqKVp.js.map → upgrade-manifests-CLYUPqBs.js.map} +1 -1
- package/dist/browser/{workflow-DjTleFFO.js → workflow-Cn1UP-eJ.js} +4 -3
- package/dist/browser/workflow-Cn1UP-eJ.js.map +1 -0
- package/dist/node/{BlockSelector-DosVPXzD.mjs → BlockSelector-D2UAnFpN.mjs} +3 -3
- package/dist/node/BlockSelector-D2UAnFpN.mjs.map +1 -0
- package/dist/node/{connection-i6ISRY0F.mjs → connection-BZxipUlb.mjs} +2 -2
- package/dist/node/{connection-i6ISRY0F.mjs.map → connection-BZxipUlb.mjs.map} +1 -1
- package/dist/node/{connection-form-Z-pLxxrT.mjs → connection-form-Btmejfyn.mjs} +33 -13
- package/dist/node/connection-form-Btmejfyn.mjs.map +1 -0
- package/dist/node/{data-tree-CqBvXMpm.mjs → data-tree-rZiK2Ev-.mjs} +2 -2
- package/dist/node/{data-tree-CqBvXMpm.mjs.map → data-tree-rZiK2Ev-.mjs.map} +1 -1
- package/dist/node/document-models/connection/index.mjs +2 -2
- package/dist/node/document-models/index.mjs +3 -3
- package/dist/node/document-models/workflow/index.mjs +3 -3
- package/dist/node/{editor-DF1FOgnC.mjs → editor-C_eWGGi8.mjs} +11 -11
- package/dist/node/editor-C_eWGGi8.mjs.map +1 -0
- package/dist/node/{editor-BIpWFiaF.mjs → editor-ChJMxbeM.mjs} +8 -8
- package/dist/node/{editor-BIpWFiaF.mjs.map → editor-ChJMxbeM.mjs.map} +1 -1
- package/dist/node/{editor-DM9cnkfv.mjs → editor-U6trS0QO.mjs} +271 -87
- package/dist/node/editor-U6trS0QO.mjs.map +1 -0
- package/dist/node/editors/connection-editor/module.mjs +1 -1
- package/dist/node/editors/runtime/index.mjs +1 -1
- package/dist/node/editors/workflow-editor/module.mjs +1 -1
- package/dist/node/editors/workflow-studio/module.mjs +1 -1
- package/dist/node/index.mjs +8 -5
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/{module-weVJEMpP.mjs → module-BEEASith.mjs} +56 -56
- package/dist/node/module-BEEASith.mjs.map +1 -0
- package/dist/node/{module-DV3LLvxo.mjs → module-D9Zx5Zow.mjs} +47 -5
- package/dist/node/module-D9Zx5Zow.mjs.map +1 -0
- package/dist/{browser/piece-auth-BS5CtQOG.js → node/piece-auth-C0u0XTO8.mjs} +11 -3
- package/dist/node/piece-auth-C0u0XTO8.mjs.map +1 -0
- package/dist/node/pieces/ai/descriptor.json +788 -0
- package/dist/node/pieces/ai/index.mjs +401 -0
- package/dist/node/pieces/ai/package.json +9 -0
- package/dist/node/pieces/index.mjs +3 -0
- package/dist/node/pieces/index.mjs.map +1 -1
- package/dist/node/pieces/reactor/descriptor.json +37 -2
- package/dist/node/pieces/reactor/index.mjs +39 -250
- package/dist/node/pieces/reactor/package.json +2 -2
- package/dist/node/{runtime-queries-CJSpbsBq.mjs → runtime-queries-CmrHBPRw.mjs} +18 -7
- package/dist/node/runtime-queries-CmrHBPRw.mjs.map +1 -0
- package/dist/node/{trigger-text-BRqIHmRS.mjs → trigger-text-CAiRCG2X.mjs} +25 -5
- package/dist/node/trigger-text-CAiRCG2X.mjs.map +1 -0
- package/dist/node/upgrade-manifests-C4akaA_X.mjs +8 -0
- package/dist/node/{upgrade-manifests-CO9zzPnE.mjs.map → upgrade-manifests-C4akaA_X.mjs.map} +1 -1
- package/dist/node/{workflow-BS5m4jtr.mjs → workflow-DqF9VsBQ.mjs} +4 -3
- package/dist/node/workflow-DqF9VsBQ.mjs.map +1 -0
- package/dist/powerhouse.manifest.json +10 -2
- package/dist/style.css +1 -1
- package/dist/types/document-models/document-models.d.ts +1 -0
- package/dist/types/document-models/document-models.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/actions.d.ts +1 -0
- package/dist/types/document-models/workflow/v1/actions.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/document-model.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/document-schema.d.ts +3 -0
- package/dist/types/document-models/workflow/v1/gen/document-schema.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/ph-factories.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/reducer.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts +16 -0
- package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/schema/zod.d.ts +3 -1
- package/dist/types/document-models/workflow/v1/gen/schema/zod.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/utils.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/workflow/actions.d.ts +6 -2
- package/dist/types/document-models/workflow/v1/gen/workflow/actions.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/workflow/creators.d.ts +3 -2
- package/dist/types/document-models/workflow/v1/gen/workflow/creators.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/workflow/operations.d.ts +2 -1
- package/dist/types/document-models/workflow/v1/gen/workflow/operations.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/module.d.ts +1 -0
- package/dist/types/document-models/workflow/v1/module.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/src/reducers/workflow.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/tests/managed-by.test.d.ts +2 -0
- package/dist/types/document-models/workflow/v1/tests/managed-by.test.d.ts.map +1 -0
- package/dist/types/editors/connection-editor/connection-form.d.ts.map +1 -1
- package/dist/types/editors/connection-editor/piece-auth.d.ts +6 -1
- package/dist/types/editors/connection-editor/piece-auth.d.ts.map +1 -1
- package/dist/types/editors/shared/DocumentErrorBoundary.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/document/useWorkflowModel.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/editor.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/runtime-client.d.ts +3 -1
- package/dist/types/editors/workflow-editor/runtime-client.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/runtime-context.d.ts +1 -1
- package/dist/types/editors/workflow-editor/runtime-context.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/PanelResizer.d.ts +12 -0
- package/dist/types/editors/workflow-editor/ui/PanelResizer.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts +1 -0
- package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/PublishControls.d.ts +4 -0
- package/dist/types/editors/workflow-editor/ui/PublishControls.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/WorkflowEditorApp.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/forms.d.ts +5 -0
- package/dist/types/editors/workflow-editor/ui/forms.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/item-summary.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/item-summary.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/model.d.ts +6 -0
- package/dist/types/editors/workflow-editor/ui/model.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/retry-policy.d.ts +8 -0
- package/dist/types/editors/workflow-editor/ui/retry-policy.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/retry-policy.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/retry-policy.test.d.ts.map +1 -0
- package/dist/types/pieces/ai/ai-actions.test.d.ts +2 -0
- package/dist/types/pieces/ai/ai-actions.test.d.ts.map +1 -0
- package/dist/types/pieces/ai/ai-documents.test.d.ts +2 -0
- package/dist/types/pieces/ai/ai-documents.test.d.ts.map +1 -0
- package/dist/types/pieces/ai/ai.test.d.ts +2 -0
- package/dist/types/pieces/ai/ai.test.d.ts.map +1 -0
- package/dist/types/pieces/ai/index.d.ts +7 -0
- package/dist/types/pieces/ai/index.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/action-schema.d.ts +11 -0
- package/dist/types/pieces/ai/lib/action-schema.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/actions/ask-ai.d.ts +38 -0
- package/dist/types/pieces/ai/lib/actions/ask-ai.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/actions/decide-on-documents.d.ts +45 -0
- package/dist/types/pieces/ai/lib/actions/decide-on-documents.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/actions/decide.d.ts +39 -0
- package/dist/types/pieces/ai/lib/actions/decide.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/actions/extract.d.ts +41 -0
- package/dist/types/pieces/ai/lib/actions/extract.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/actions/propose-actions.d.ts +55 -0
- package/dist/types/pieces/ai/lib/actions/propose-actions.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/actions/summarize.d.ts +38 -0
- package/dist/types/pieces/ai/lib/actions/summarize.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/auth.d.ts +16 -0
- package/dist/types/pieces/ai/lib/auth.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/decision-model.d.ts +17 -0
- package/dist/types/pieces/ai/lib/decision-model.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/documents.d.ts +11 -0
- package/dist/types/pieces/ai/lib/documents.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/model-list.d.ts +8 -0
- package/dist/types/pieces/ai/lib/model-list.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/models.d.ts +19 -0
- package/dist/types/pieces/ai/lib/models.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/props.d.ts +16 -0
- package/dist/types/pieces/ai/lib/props.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/providers.d.ts +9 -0
- package/dist/types/pieces/ai/lib/providers.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/questions.d.ts +7 -0
- package/dist/types/pieces/ai/lib/questions.d.ts.map +1 -0
- package/dist/types/pieces/index.d.ts.map +1 -1
- package/dist/types/pieces/reactor/index.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/document-create.d.ts +4 -2
- package/dist/types/pieces/reactor/lib/actions/document-create.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts +4 -2
- package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/document-find.d.ts +4 -2
- package/dist/types/pieces/reactor/lib/actions/document-find.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/document-get.d.ts +4 -2
- package/dist/types/pieces/reactor/lib/actions/document-get.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/document-schema.d.ts +4 -2
- package/dist/types/pieces/reactor/lib/actions/document-schema.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/document-types.d.ts +3 -1
- package/dist/types/pieces/reactor/lib/actions/document-types.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/index-query.d.ts +14 -0
- package/dist/types/pieces/reactor/lib/actions/index-query.d.ts.map +1 -0
- package/dist/types/pieces/reactor/lib/input-schema.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/reactor.d.ts +12 -0
- package/dist/types/pieces/reactor/lib/reactor.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/writes.d.ts +7 -0
- package/dist/types/pieces/reactor/lib/writes.d.ts.map +1 -0
- package/dist/types/scripts/ui-stack.d.ts +8 -2
- package/dist/types/scripts/ui-stack.d.ts.map +1 -1
- package/package.json +15 -8
- package/dist/browser/BlockSelector-DFX-DZHl.js.map +0 -1
- package/dist/browser/connection-form-BuW6qOAF.js.map +0 -1
- package/dist/browser/editor-DBcq58Fr.js.map +0 -1
- package/dist/browser/editor-DPGuck1V.js.map +0 -1
- package/dist/browser/module-DFCANOuI.js.map +0 -1
- package/dist/browser/module-FuSfFXPT.js.map +0 -1
- package/dist/browser/piece-auth-BS5CtQOG.js.map +0 -1
- package/dist/browser/runtime-queries-C9SoXGm2.js.map +0 -1
- package/dist/browser/trigger-text-B2mo1fiB.js.map +0 -1
- package/dist/browser/upgrade-manifests-B62uqKVp.js +0 -8
- package/dist/browser/workflow-DjTleFFO.js.map +0 -1
- package/dist/node/BlockSelector-DosVPXzD.mjs.map +0 -1
- package/dist/node/connection-form-Z-pLxxrT.mjs.map +0 -1
- package/dist/node/editor-DF1FOgnC.mjs.map +0 -1
- package/dist/node/editor-DM9cnkfv.mjs.map +0 -1
- package/dist/node/module-DV3LLvxo.mjs.map +0 -1
- package/dist/node/module-weVJEMpP.mjs.map +0 -1
- package/dist/node/piece-auth-BS5CtQOG.mjs.map +0 -1
- package/dist/node/runtime-queries-CJSpbsBq.mjs.map +0 -1
- package/dist/node/trigger-text-BRqIHmRS.mjs.map +0 -1
- package/dist/node/upgrade-manifests-CO9zzPnE.mjs +0 -8
- package/dist/node/workflow-BS5m4jtr.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module-DFCANOuI.js","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;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;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;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IAAE,GAAG;IAAmB,GAAG,OAAO;GAAM;EACjD;CACF;CACA,eAAe,OAAO;EACpB,OAAO,mBAAmBA,QAAM,aAAa,OAAO,oBAAoB;CAC1E;CACA,iBAAiB,UAAU,OAAO;EAChC,OAAO,qBAAqB,UAAU,KAAK;CAC7C;CACA,cAAc,OAAO;EACnB,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":"module-FuSfFXPT.js","names":["z","connectionConnectionActions","connectionConfigActions","connectionHealthActions","utils","genUtils","customUtils"],"sources":["../../document-models/connection/v1/gen/schema/zod.ts","../../document-models/connection/v1/src/reactor-connection.ts","../../document-models/connection/v1/gen/config/creators.ts","../../document-models/connection/v1/gen/connection/creators.ts","../../document-models/connection/v1/gen/health/creators.ts","../../document-models/connection/v1/actions.ts","../../document-models/connection/v1/gen/document-model.ts","../../document-models/connection/v1/gen/config/error.ts","../../document-models/connection/v1/src/reducers/config.ts","../../document-models/connection/v1/gen/connection/error.ts","../../document-models/connection/v1/src/reducers/connection.ts","../../document-models/connection/v1/src/reducers/health.ts","../../document-models/connection/v1/gen/reducer.ts","../../document-models/connection/upgrades/versions.ts","../../document-models/connection/upgrades/upgrade-manifest.ts","../../document-models/connection/v1/gen/document-type.ts","../../document-models/connection/v1/gen/document-schema.ts","../../document-models/connection/v1/gen/utils.ts","../../document-models/connection/v1/src/utils.ts","../../document-models/connection/v1/utils.ts","../../document-models/connection/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 ConnectionAuthType,\n ConnectionState,\n ConnectionStatus,\n ReactorConnectionConfig,\n RecordCheckResultInput,\n RemoveConfigValueInput,\n RemoveSecretRefInput,\n SecretRef,\n SetAccountLabelInput,\n SetConfigInput,\n SetConfigValueInput,\n SetConnectionNameInput,\n SetConnectorInput,\n SetSecretRefInput,\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 ConnectionAuthTypeSchema = z.enum([\n \"BASIC_AUTH\",\n \"CUSTOM_AUTH\",\n \"NONE\",\n \"OAUTH2\",\n \"OIDC\",\n \"REACTOR\",\n \"SECRET_TEXT\",\n]);\n\nexport const ConnectionStatusSchema = z.enum([\n \"ERROR\",\n \"OK\",\n \"REVOKED\",\n \"UNCONFIGURED\",\n]);\n\nexport function ConnectionStateSchema(): z.ZodObject<\n Properties<ConnectionState>\n> {\n return z.object({\n __typename: z.literal(\"ConnectionState\").optional(),\n accountLabel: z.string().nullish(),\n authType: ConnectionAuthTypeSchema,\n config: z.unknown(),\n connectorId: z.string(),\n lastCheckedAt: z.iso.datetime().nullish(),\n lastError: z.string().nullish(),\n name: z.string(),\n secretRefs: z.array(z.lazy(() => SecretRefSchema())),\n status: ConnectionStatusSchema,\n });\n}\n\nexport function ReactorConnectionConfigSchema(): z.ZodObject<\n Properties<ReactorConnectionConfig>\n> {\n return z.object({\n __typename: z.literal(\"ReactorConnectionConfig\").optional(),\n access: z.string().nullish(),\n endpoint: z.string(),\n });\n}\n\nexport function RecordCheckResultInputSchema(): z.ZodObject<\n Properties<RecordCheckResultInput>\n> {\n return z.object({\n checkedAt: z.iso.datetime(),\n error: z.string().nullish(),\n status: ConnectionStatusSchema,\n });\n}\n\nexport function RemoveConfigValueInputSchema(): z.ZodObject<\n Properties<RemoveConfigValueInput>\n> {\n return z.object({\n name: z.string(),\n });\n}\n\nexport function RemoveSecretRefInputSchema(): z.ZodObject<\n Properties<RemoveSecretRefInput>\n> {\n return z.object({\n id: z.string(),\n });\n}\n\nexport function SecretRefSchema(): z.ZodObject<Properties<SecretRef>> {\n return z.object({\n __typename: z.literal(\"SecretRef\").optional(),\n id: z.string(),\n name: z.string(),\n ref: z.string(),\n });\n}\n\nexport function SetAccountLabelInputSchema(): z.ZodObject<\n Properties<SetAccountLabelInput>\n> {\n return z.object({\n accountLabel: z.string().nullish(),\n });\n}\n\nexport function SetConfigInputSchema(): z.ZodObject<\n Properties<SetConfigInput>\n> {\n return z.object({\n config: z.unknown(),\n });\n}\n\nexport function SetConfigValueInputSchema(): z.ZodObject<\n Properties<SetConfigValueInput>\n> {\n return z.object({\n name: z.string(),\n value: z.unknown(),\n });\n}\n\nexport function SetConnectionNameInputSchema(): z.ZodObject<\n Properties<SetConnectionNameInput>\n> {\n return z.object({\n name: z.string(),\n });\n}\n\nexport function SetConnectorInputSchema(): z.ZodObject<\n Properties<SetConnectorInput>\n> {\n return z.object({\n authType: ConnectionAuthTypeSchema,\n connectorId: z.string(),\n });\n}\n\nexport function SetSecretRefInputSchema(): z.ZodObject<\n Properties<SetSecretRefInput>\n> {\n return z.object({\n id: z.string(),\n name: z.string(),\n ref: z.string(),\n });\n}\n","import { ReactorConnectionConfigSchema } from \"../gen/schema/zod.js\";\n\n// Reserved for REACTOR connections; any piece may bind it.\nexport const REACTOR_CONNECTOR_ID = \"@powerhousedao/reactor#reactor\";\nexport const REACTOR_LOCAL_ENDPOINT = \"local\";\n\n// A REACTOR connection's config with absent fields left out.\nexport interface ReactorConnectionConfigValue {\n endpoint: typeof REACTOR_LOCAL_ENDPOINT;\n access?: \"read\";\n}\n\nexport type ReactorConnectionConfigResult =\n | { ok: true; config: ReactorConnectionConfigValue }\n | { ok: false; error: string };\n\nconst CONFIG_KEYS = new Set([\"endpoint\", \"access\"]);\n\nexport function isReactorConnectorId(connectorId: string): boolean {\n return connectorId === REACTOR_CONNECTOR_ID;\n}\n\nexport function defaultReactorConnectionConfig(): ReactorConnectionConfigValue {\n return { endpoint: REACTOR_LOCAL_ENDPOINT };\n}\n\n// Unknown keys are refused, so a misspelt field is never ignored.\nexport function parseReactorConnectionConfig(\n config: unknown,\n): ReactorConnectionConfigResult {\n if (config === null || typeof config !== \"object\" || Array.isArray(config)) {\n return {\n ok: false,\n error: \"A reactor connection config must be an object\",\n };\n }\n const unknownKey = Object.keys(config).find((key) => !CONFIG_KEYS.has(key));\n if (unknownKey) {\n return {\n ok: false,\n error: `Unknown reactor connection field \"${unknownKey}\"`,\n };\n }\n const parsed = ReactorConnectionConfigSchema().safeParse(config);\n if (!parsed.success) {\n return { ok: false, error: parsed.error.issues[0]?.message ?? \"Invalid\" };\n }\n const { endpoint, access } = parsed.data;\n if (endpoint !== REACTOR_LOCAL_ENDPOINT) {\n return {\n ok: false,\n error: `Reactor endpoint must be \"${REACTOR_LOCAL_ENDPOINT}\"`,\n };\n }\n if (access !== undefined && access !== null && access !== \"read\") {\n return { ok: false, error: `Reactor access must be \"read\" or absent` };\n }\n const value: ReactorConnectionConfigValue = { endpoint };\n if (access === \"read\") value.access = access;\n return { ok: true, config: value };\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 RemoveConfigValueInputSchema,\n RemoveSecretRefInputSchema,\n SetConfigInputSchema,\n SetConfigValueInputSchema,\n SetSecretRefInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n RemoveConfigValueInput,\n RemoveSecretRefInput,\n SetConfigInput,\n SetConfigValueInput,\n SetSecretRefInput,\n} from \"../types.js\";\nimport type {\n RemoveConfigValueAction,\n RemoveSecretRefAction,\n SetConfigAction,\n SetConfigValueAction,\n SetSecretRefAction,\n} from \"./actions.js\";\n\nexport const setConfig = (input: SetConfigInput) =>\n createAction<SetConfigAction>(\n \"SET_CONFIG\",\n { ...input },\n undefined,\n SetConfigInputSchema,\n \"global\",\n );\n\nexport const setConfigValue = (input: SetConfigValueInput) =>\n createAction<SetConfigValueAction>(\n \"SET_CONFIG_VALUE\",\n { ...input },\n undefined,\n SetConfigValueInputSchema,\n \"global\",\n );\n\nexport const removeConfigValue = (input: RemoveConfigValueInput) =>\n createAction<RemoveConfigValueAction>(\n \"REMOVE_CONFIG_VALUE\",\n { ...input },\n undefined,\n RemoveConfigValueInputSchema,\n \"global\",\n );\n\nexport const setSecretRef = (input: SetSecretRefInput) =>\n createAction<SetSecretRefAction>(\n \"SET_SECRET_REF\",\n { ...input },\n undefined,\n SetSecretRefInputSchema,\n \"global\",\n );\n\nexport const removeSecretRef = (input: RemoveSecretRefInput) =>\n createAction<RemoveSecretRefAction>(\n \"REMOVE_SECRET_REF\",\n { ...input },\n undefined,\n RemoveSecretRefInputSchema,\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 SetAccountLabelInputSchema,\n SetConnectionNameInputSchema,\n SetConnectorInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n SetAccountLabelInput,\n SetConnectionNameInput,\n SetConnectorInput,\n} from \"../types.js\";\nimport type {\n SetAccountLabelAction,\n SetConnectionNameAction,\n SetConnectorAction,\n} from \"./actions.js\";\n\nexport const setConnectionName = (input: SetConnectionNameInput) =>\n createAction<SetConnectionNameAction>(\n \"SET_CONNECTION_NAME\",\n { ...input },\n undefined,\n SetConnectionNameInputSchema,\n \"global\",\n );\n\nexport const setConnector = (input: SetConnectorInput) =>\n createAction<SetConnectorAction>(\n \"SET_CONNECTOR\",\n { ...input },\n undefined,\n SetConnectorInputSchema,\n \"global\",\n );\n\nexport const setAccountLabel = (input: SetAccountLabelInput) =>\n createAction<SetAccountLabelAction>(\n \"SET_ACCOUNT_LABEL\",\n { ...input },\n undefined,\n SetAccountLabelInputSchema,\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 { RecordCheckResultInputSchema } from \"../schema/zod.js\";\nimport type { RecordCheckResultInput } from \"../types.js\";\nimport type { RecordCheckResultAction } from \"./actions.js\";\n\nexport const recordCheckResult = (input: RecordCheckResultInput) =>\n createAction<RecordCheckResultAction>(\n \"RECORD_CHECK_RESULT\",\n { ...input },\n undefined,\n RecordCheckResultInputSchema,\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 connectionConfigActions,\n connectionConnectionActions,\n connectionHealthActions,\n} from \"./gen/creators.js\";\n\n/** Actions for the Connection document model */\n\nexport const actions = {\n ...baseActions,\n ...connectionConnectionActions,\n ...connectionConfigActions,\n ...connectionHealthActions,\n};\n","import type { DocumentModelGlobalState } from \"document-model\";\n\nexport const documentModel: DocumentModelGlobalState = {\n id: \"powerhouse/connection\",\n name: \"Connection\",\n author: {\n name: \"Powerhouse\",\n website: \"https://www.powerhouse.inc\",\n },\n extension: \".conn\",\n description:\n \"A configured connector instance: auth kind, non-secret config and secret handles, shared by many workflows.\",\n specifications: [\n {\n state: {\n local: {\n schema: \"\",\n examples: [],\n initialValue: \"\",\n },\n global: {\n schema:\n 'enum ConnectionAuthType {\\n SECRET_TEXT\\n BASIC_AUTH\\n CUSTOM_AUTH\\n OAUTH2\\n OIDC\\n NONE\\n \"Reactor access for a piece\\'s ctx.reactor; any piece may bind it.\"\\n REACTOR\\n}\\n\\nenum ConnectionStatus {\\n UNCONFIGURED\\n OK\\n ERROR\\n REVOKED\\n}\\n\\ntype SecretRef {\\n id: OID!\\n \"Matches an auth property name in the connector\\'s config schema.\"\\n name: String!\\n \"Opaque handle into the host secret provider. Not the secret.\"\\n ref: String!\\n}\\n\\n\"Config of a REACTOR connection. It holds no secrets.\"\\ntype ReactorConnectionConfig {\\n \"Which reactor the connection reaches; \\'local\\' is the only value.\"\\n endpoint: String!\\n \"\\'read\\' limits the connection to reads; absent allows what the step declares.\"\\n access: String\\n}\\n\\ntype ConnectionState {\\n name: String!\\n \"Fully-qualified connector id: \\'@acme/connector-imap#imap\\'.\"\\n connectorId: String!\\n \"Activepieces auth kind, so a piece\\'s PieceAuth maps directly.\"\\n authType: ConnectionAuthType!\\n \"Non-secret configuration, validated against the connector\\'s auth schema; a ReactorConnectionConfig for REACTOR.\"\\n config: Unknown!\\n \"Secret handles; values never appear in state, operations, or the run journal.\"\\n secretRefs: [SecretRef!]!\\n status: ConnectionStatus!\\n lastCheckedAt: DateTime\\n lastError: String\\n \"Populated by the connector\\'s own metadata call. Display only.\"\\n accountLabel: String\\n}',\n examples: [],\n initialValue:\n '{\\n \"name\": \"\",\\n \"connectorId\": \"\",\\n \"authType\": \"NONE\",\\n \"config\": {},\\n \"secretRefs\": [],\\n \"status\": \"UNCONFIGURED\",\\n \"lastCheckedAt\": null,\\n \"lastError\": null,\\n \"accountLabel\": null\\n}',\n },\n },\n modules: [\n {\n id: \"d723a91b-329c-46c3-acbf-85533c47b5a4\",\n name: \"connection\",\n description: \"Connection identity and connector binding.\",\n operations: [\n {\n id: \"ece5a33d-0bc1-46ff-87f4-c763d298cb3a\",\n name: \"SET_CONNECTION_NAME\",\n description: \"Sets the connection's display name.\",\n schema: \"input SetConnectionNameInput {\\n name: String!\\n}\",\n template: \"Sets the connection's display name.\",\n reducer: \"state.name = action.input.name;\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"e668be97-82c8-433e-8af7-1644cfa25723\",\n name: \"SET_CONNECTOR\",\n description:\n \"Binds the connection to a connector and auth kind; resets status to UNCONFIGURED. REACTOR goes only with the reserved reactor connector id.\",\n schema:\n \"input SetConnectorInput {\\n connectorId: String!\\n authType: ConnectionAuthType!\\n}\",\n template:\n \"Binds the connection to a connector and auth kind; resets status to UNCONFIGURED.\",\n reducer:\n 'state.connectorId = action.input.connectorId;\\nstate.authType = action.input.authType;\\nstate.status = \"UNCONFIGURED\";',\n errors: [\n {\n id: \"6e550820-9d17-447d-9378-a17d38262bc8\",\n name: \"ReservedConnectorError\",\n code: \"RESERVED_CONNECTOR\",\n description:\n \"The reserved reactor connector id goes only with authType REACTOR, and REACTOR only with it.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"01a28e56-4406-4160-9547-f6239e728afd\",\n name: \"SET_ACCOUNT_LABEL\",\n description: \"Sets or clears the display-only account label.\",\n schema:\n \"input SetAccountLabelInput {\\n accountLabel: String\\n}\",\n template: \"Sets or clears the display-only account label.\",\n reducer:\n \"state.accountLabel = action.input.accountLabel || null;\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"728ec59f-db15-4c52-aa9d-fbe1a6d6a6f9\",\n name: \"config\",\n description: \"Non-secret configuration and secret handles.\",\n operations: [\n {\n id: \"c26f7cd8-c280-4e85-be65-83c3c1217358\",\n name: \"SET_CONFIG\",\n description: \"Replaces the non-secret configuration.\",\n schema: \"input SetConfigInput {\\n config: Unknown!\\n}\",\n template: \"Replaces the non-secret configuration.\",\n reducer: \"state.config = action.input.config;\",\n errors: [\n {\n id: \"b9911ea4-4168-4080-b05e-8687928dc309\",\n name: \"InvalidReactorConfigError\",\n code: \"INVALID_REACTOR_CONFIG\",\n description:\n \"A REACTOR connection's config is not a valid ReactorConnectionConfig.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"32f1c6e9-1bba-4c99-bd20-311b16f95fa9\",\n name: \"SET_CONFIG_VALUE\",\n description:\n \"Sets one non-secret config field, leaving the others as they are.\",\n schema:\n \"input SetConfigValueInput {\\n name: String!\\n value: Unknown!\\n}\",\n template:\n \"Sets one non-secret config field, leaving the others as they are.\",\n reducer: \"\",\n errors: [\n {\n id: \"6db3a25a-a3b2-4751-9470-3c122ff9abcd\",\n name: \"InvalidReactorConfigValueError\",\n code: \"INVALID_REACTOR_CONFIG_VALUE\",\n description:\n \"The field would leave a REACTOR connection's config invalid.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"bcb390f6-f8fc-4a09-99e6-1d84b272d7b6\",\n name: \"REMOVE_CONFIG_VALUE\",\n description:\n \"Removes one non-secret config field. Removing an absent field changes nothing.\",\n schema: \"input RemoveConfigValueInput {\\n name: String!\\n}\",\n template:\n \"Removes one non-secret config field. Removing an absent field changes nothing.\",\n reducer: \"\",\n errors: [\n {\n id: \"24496230-4088-4994-a6d5-b7651c718f63\",\n name: \"InvalidReactorConfigRemovalError\",\n code: \"INVALID_REACTOR_CONFIG_REMOVAL\",\n description:\n \"The removal would leave a REACTOR connection's config invalid.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"1a90e020-6dc5-49e0-9be1-732028dd10d3\",\n name: \"SET_SECRET_REF\",\n description:\n \"Creates or updates a secret handle, keyed by its auth property name.\",\n schema:\n \"input SetSecretRefInput {\\n id: OID!\\n name: String!\\n ref: String!\\n}\",\n template:\n \"Creates or updates a secret handle, keyed by its auth property name.\",\n reducer:\n \"const existing = state.secretRefs.find(\\n (secretRef) => secretRef.name === action.input.name,\\n);\\nif (existing) {\\n existing.ref = action.input.ref;\\n} else {\\n state.secretRefs.push({\\n id: action.input.id,\\n name: action.input.name,\\n ref: action.input.ref,\\n });\\n}\",\n errors: [\n {\n id: \"e3c42e5b-80c6-4020-8cfd-2ccc797d82b7\",\n name: \"ReactorSecretRefError\",\n code: \"REACTOR_SECRET_REF\",\n description: \"A REACTOR connection holds no secrets.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"0c7214b1-0494-49d8-913f-39ad59ca2a3b\",\n name: \"REMOVE_SECRET_REF\",\n description: \"Removes a secret handle.\",\n schema: \"input RemoveSecretRefInput {\\n id: OID!\\n}\",\n template: \"Removes a secret handle.\",\n reducer:\n 'const index = state.secretRefs.findIndex(\\n (secretRef) => secretRef.id === action.input.id,\\n);\\nif (index === -1) {\\n throw new SecretRefNotFoundError(\"Secret ref not found\");\\n}\\nstate.secretRefs.splice(index, 1);',\n errors: [\n {\n id: \"0c5d799d-d71d-4a75-ab0e-136ea72f1a3b\",\n name: \"SecretRefNotFoundError\",\n code: \"SECRET_REF_NOT_FOUND\",\n description: \"No secret ref exists with the given id.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"3b02be29-0e8b-400d-ba05-1305e28c86b5\",\n name: \"health\",\n description: \"Connection health, written by connector checks.\",\n operations: [\n {\n id: \"2e8e9df7-3939-425c-9e28-7c8fa5de7d3f\",\n name: \"RECORD_CHECK_RESULT\",\n description:\n \"Records the outcome of a connection check, including revocation.\",\n schema:\n \"input RecordCheckResultInput {\\n status: ConnectionStatus!\\n checkedAt: DateTime!\\n error: String\\n}\",\n template:\n \"Records the outcome of a connection check, including revocation.\",\n reducer:\n \"state.status = action.input.status;\\nstate.lastCheckedAt = action.input.checkedAt;\\nstate.lastError = action.input.error || null;\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n ],\n version: 1,\n changeLog: [],\n },\n ],\n};\n","export type ErrorCode =\n | \"InvalidReactorConfigError\"\n | \"InvalidReactorConfigValueError\"\n | \"InvalidReactorConfigRemovalError\"\n | \"ReactorSecretRefError\"\n | \"SecretRefNotFoundError\";\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class InvalidReactorConfigError extends Error implements ReducerError {\n errorCode = \"InvalidReactorConfigError\" as ErrorCode;\n constructor(message = \"InvalidReactorConfigError\") {\n super(message);\n }\n}\n\nexport class InvalidReactorConfigValueError\n extends Error\n implements ReducerError\n{\n errorCode = \"InvalidReactorConfigValueError\" as ErrorCode;\n constructor(message = \"InvalidReactorConfigValueError\") {\n super(message);\n }\n}\n\nexport class InvalidReactorConfigRemovalError\n extends Error\n implements ReducerError\n{\n errorCode = \"InvalidReactorConfigRemovalError\" as ErrorCode;\n constructor(message = \"InvalidReactorConfigRemovalError\") {\n super(message);\n }\n}\n\nexport class ReactorSecretRefError extends Error implements ReducerError {\n errorCode = \"ReactorSecretRefError\" as ErrorCode;\n constructor(message = \"ReactorSecretRefError\") {\n super(message);\n }\n}\n\nexport class SecretRefNotFoundError extends Error implements ReducerError {\n errorCode = \"SecretRefNotFoundError\" as ErrorCode;\n constructor(message = \"SecretRefNotFoundError\") {\n super(message);\n }\n}\n\nexport const errors = {\n SetConfig: { InvalidReactorConfigError },\n\n SetConfigValue: { InvalidReactorConfigValueError },\n\n RemoveConfigValue: { InvalidReactorConfigRemovalError },\n\n SetSecretRef: { ReactorSecretRefError },\n\n RemoveSecretRef: { SecretRefNotFoundError },\n};\n","import type { ConnectionConfigOperations } from \"document-models/connection/v1\";\nimport {\n InvalidReactorConfigError,\n InvalidReactorConfigRemovalError,\n InvalidReactorConfigValueError,\n ReactorSecretRefError,\n SecretRefNotFoundError,\n} from \"../../gen/config/error.js\";\nimport { parseReactorConnectionConfig } from \"../reactor-connection.js\";\n\nexport const connectionConfigOperations: ConnectionConfigOperations = {\n setConfigOperation(state, action) {\n if (state.authType !== \"REACTOR\") {\n state.config = action.input.config;\n return;\n }\n const parsed = parseReactorConnectionConfig(action.input.config);\n if (!parsed.ok) throw new InvalidReactorConfigError(parsed.error);\n state.config = parsed.config;\n },\n setSecretRefOperation(state, action) {\n if (state.authType === \"REACTOR\") {\n throw new ReactorSecretRefError(\"A reactor connection holds no secrets\");\n }\n const existing = state.secretRefs.find(\n (secretRef) => secretRef.name === action.input.name,\n );\n if (existing) {\n existing.ref = action.input.ref;\n } else {\n state.secretRefs.push({\n id: action.input.id,\n name: action.input.name,\n ref: action.input.ref,\n });\n }\n },\n removeSecretRefOperation(state, action) {\n const index = state.secretRefs.findIndex(\n (secretRef) => secretRef.id === action.input.id,\n );\n if (index === -1) {\n throw new SecretRefNotFoundError(\"Secret ref not found\");\n }\n state.secretRefs.splice(index, 1);\n },\n setConfigValueOperation(state, action) {\n const { name, value } = action.input;\n const config = { ...configRecord(state.config) };\n if (value === undefined) delete config[name];\n else config[name] = value;\n if (state.authType !== \"REACTOR\") {\n state.config = config;\n return;\n }\n const parsed = parseReactorConnectionConfig(config);\n if (!parsed.ok) throw new InvalidReactorConfigValueError(parsed.error);\n state.config = parsed.config;\n },\n removeConfigValueOperation(state, action) {\n const current = configRecord(state.config);\n if (!(action.input.name in current)) return;\n const { [action.input.name]: _removed, ...config } = current;\n if (state.authType !== \"REACTOR\") {\n state.config = config;\n return;\n }\n const parsed = parseReactorConnectionConfig(config);\n if (!parsed.ok) throw new InvalidReactorConfigRemovalError(parsed.error);\n state.config = parsed.config;\n },\n};\n\n// A config that is not an object holds no fields to keep.\nfunction configRecord(config: unknown): Record<string, unknown> {\n return config !== null && typeof config === \"object\" && !Array.isArray(config)\n ? (config as Record<string, unknown>)\n : {};\n}\n","export type ErrorCode = \"ReservedConnectorError\";\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class ReservedConnectorError extends Error implements ReducerError {\n errorCode = \"ReservedConnectorError\" as ErrorCode;\n constructor(message = \"ReservedConnectorError\") {\n super(message);\n }\n}\n\nexport const errors = {\n SetConnector: { ReservedConnectorError },\n};\n","import type { ConnectionConnectionOperations } from \"document-models/connection/v1\";\nimport { ReservedConnectorError } from \"../../gen/connection/error.js\";\nimport {\n defaultReactorConnectionConfig,\n isReactorConnectorId,\n} from \"../reactor-connection.js\";\n\nexport const connectionConnectionOperations: ConnectionConnectionOperations = {\n setConnectionNameOperation(state, action) {\n state.name = action.input.name;\n },\n setConnectorOperation(state, action) {\n const reactor = action.input.authType === \"REACTOR\";\n if (reactor !== isReactorConnectorId(action.input.connectorId)) {\n throw new ReservedConnectorError(\n \"The reactor connector id goes only with authType REACTOR\",\n );\n }\n const rebinding = action.input.connectorId !== state.connectorId;\n state.connectorId = action.input.connectorId;\n state.authType = action.input.authType;\n state.status = \"UNCONFIGURED\";\n // A different connector invalidates the old one's config/secrets/health;\n // a same-connector call (e.g. re-declaring authType) leaves them alone.\n if (rebinding) {\n state.config = reactor ? defaultReactorConnectionConfig() : {};\n state.secretRefs = [];\n state.accountLabel = null;\n state.lastCheckedAt = null;\n state.lastError = null;\n }\n },\n setAccountLabelOperation(state, action) {\n state.accountLabel = action.input.accountLabel || null;\n },\n};\n","import type { ConnectionHealthOperations } from \"document-models/connection/v1\";\n\nexport const connectionHealthOperations: ConnectionHealthOperations = {\n recordCheckResultOperation(state, action) {\n state.status = action.input.status;\n state.lastCheckedAt = action.input.checkedAt;\n state.lastError = action.input.error || null;\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 { ConnectionPHState } from \"document-models/connection/v1\";\n\nimport { connectionConfigOperations } from \"../src/reducers/config.js\";\nimport { connectionConnectionOperations } from \"../src/reducers/connection.js\";\nimport { connectionHealthOperations } from \"../src/reducers/health.js\";\n\nimport {\n RecordCheckResultInputSchema,\n RemoveConfigValueInputSchema,\n RemoveSecretRefInputSchema,\n SetAccountLabelInputSchema,\n SetConfigInputSchema,\n SetConfigValueInputSchema,\n SetConnectionNameInputSchema,\n SetConnectorInputSchema,\n SetSecretRefInputSchema,\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<ConnectionPHState> = (\n state,\n action,\n dispatch,\n) => {\n if (isDocumentAction(action)) {\n return state;\n }\n switch (action.type) {\n case \"SET_CONNECTION_NAME\": {\n memoizedSchema(SetConnectionNameInputSchema).parse(action.input);\n\n connectionConnectionOperations.setConnectionNameOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_CONNECTOR\": {\n memoizedSchema(SetConnectorInputSchema).parse(action.input);\n\n connectionConnectionOperations.setConnectorOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_ACCOUNT_LABEL\": {\n memoizedSchema(SetAccountLabelInputSchema).parse(action.input);\n\n connectionConnectionOperations.setAccountLabelOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_CONFIG\": {\n memoizedSchema(SetConfigInputSchema).parse(action.input);\n\n connectionConfigOperations.setConfigOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_CONFIG_VALUE\": {\n memoizedSchema(SetConfigValueInputSchema).parse(action.input);\n\n connectionConfigOperations.setConfigValueOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_CONFIG_VALUE\": {\n memoizedSchema(RemoveConfigValueInputSchema).parse(action.input);\n\n connectionConfigOperations.removeConfigValueOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_SECRET_REF\": {\n memoizedSchema(SetSecretRefInputSchema).parse(action.input);\n\n connectionConfigOperations.setSecretRefOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_SECRET_REF\": {\n memoizedSchema(RemoveSecretRefInputSchema).parse(action.input);\n\n connectionConfigOperations.removeSecretRefOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"RECORD_CHECK_RESULT\": {\n memoizedSchema(RecordCheckResultInputSchema).parse(action.input);\n\n connectionHealthOperations.recordCheckResultOperation(\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<ConnectionPHState> = 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 connectionUpgradeManifest: UpgradeManifest<\n typeof supportedVersions\n> = {\n documentType: \"powerhouse/connection\",\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 connectionDocumentType = \"powerhouse/connection\";\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 { connectionDocumentType } from \"./document-type.js\";\nimport { ConnectionStateSchema } from \"./schema/zod.js\";\nimport type { ConnectionDocument, ConnectionPHState } from \"./types.js\";\n\n/** Schema for validating the header object of a Connection document */\nexport const ConnectionDocumentHeaderSchema = BaseDocumentHeaderSchema.extend({\n documentType: z.literal(connectionDocumentType),\n});\n\n/** Schema for validating the state object of a Connection document */\nexport const ConnectionPHStateSchema = BaseDocumentStateSchema.extend({\n global: ConnectionStateSchema(),\n});\n\nexport const ConnectionDocumentSchema = z.object({\n header: ConnectionDocumentHeaderSchema,\n state: ConnectionPHStateSchema,\n initialState: ConnectionPHStateSchema,\n});\n\n/** Simple helper function to check if a state object is a Connection document state object */\nexport function isConnectionState(state: unknown): state is ConnectionPHState {\n return ConnectionPHStateSchema.safeParse(state).success;\n}\n\n/** Simple helper function to assert that a document state object is a Connection document state object */\nexport function assertIsConnectionState(\n state: unknown,\n): asserts state is ConnectionPHState {\n ConnectionPHStateSchema.parse(state);\n}\n\n/** Simple helper function to check if a document is a Connection document */\nexport function isConnectionDocument(\n document: unknown,\n): document is ConnectionDocument {\n return ConnectionDocumentSchema.safeParse(document).success;\n}\n\n/** Simple helper function to assert that a document is a Connection document */\nexport function assertIsConnectionDocument(\n document: unknown,\n): asserts document is ConnectionDocument {\n ConnectionDocumentSchema.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 { connectionUpgradeManifest } from \"../../upgrades/upgrade-manifest.js\";\nimport {\n assertIsConnectionDocument,\n assertIsConnectionState,\n isConnectionDocument,\n isConnectionState,\n} from \"./document-schema.js\";\nimport { connectionDocumentType } from \"./document-type.js\";\nimport { reducer } from \"./reducer.js\";\nimport type {\n ConnectionGlobalState,\n ConnectionLocalState,\n ConnectionPHState,\n} from \"./types.js\";\n\nexport const initialGlobalState: ConnectionGlobalState = {\n name: \"\",\n connectorId: \"\",\n authType: \"NONE\",\n config: {},\n secretRefs: [],\n status: \"UNCONFIGURED\",\n lastCheckedAt: null,\n lastError: null,\n accountLabel: null,\n};\nexport const initialLocalState: ConnectionLocalState = {};\n\nexport const utils: DocumentModelUtils<ConnectionPHState> = {\n fileExtension: \".conn\",\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, connectionDocumentType);\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: connectionUpgradeManifest,\n });\n },\n isStateOfType(state) {\n return isConnectionState(state);\n },\n assertIsStateOfType(state) {\n return assertIsConnectionState(state);\n },\n isDocumentOfType(document) {\n return isConnectionDocument(document);\n },\n assertIsDocumentOfType(document) {\n return assertIsConnectionDocument(document);\n },\n};\n","export * from \"./reactor-connection.js\";\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 { ConnectionPHState } from \"./gen/types.js\";\nimport { utils as genUtils } from \"./gen/utils.js\";\nimport * as customUtils from \"./src/utils.js\";\n\n/** Utils for the Connection document model */\nexport const utils: DocumentModelUtils<ConnectionPHState> = {\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 { ConnectionPHState } from \"./gen/types.js\";\nimport { utils } from \"./utils.js\";\n\n/** Document model module for the Connection document type */\nexport const Connection = {\n version: 1,\n reducer,\n actions,\n utils,\n documentModel: createState(defaultBaseState(), documentModel),\n} as const satisfies DocumentModelModule<ConnectionPHState>;\n"],"mappings":";;;;;AA0BA,MAAa,uBAAuB,MAClC,MAAM,KAAA,KAAa,MAAM;AAE3B,MAAa,0BAA0BA,IACpC,IAAI,CAAC,CACL,QAAQ,MAAM,oBAAoB,CAAC,CAAC;AAEvC,MAAa,2BAA2BA,IAAE,KAAK;CAC7C;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAa,yBAAyBA,IAAE,KAAK;CAC3C;CACA;CACA;CACA;AACF,CAAC;AAED,SAAgB,wBAEd;CACA,OAAOA,IAAE,OAAO;EACd,YAAYA,IAAE,QAAQ,iBAAiB,CAAC,CAAC,SAAS;EAClD,cAAcA,IAAE,OAAO,CAAC,CAAC,QAAQ;EACjC,UAAU;EACV,QAAQA,IAAE,QAA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,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,aACE;MACF,QACE;MACF,UACE;MACF,SACE;MACF,QAAQ,CACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aACE;OACF,UAAU;MACZ,CACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;KACA;MACE,IAAI;MACJ,MAAM;MACN,aAAa;MACb,QACE;MACF,UAAU;MACV,SACE;MACF,QAAQ,CAAC;MACT,UAAU,CAAC;MACX,OAAO;KACT;IACF;GACF;GACA;IACE,IAAI;IACJ,MAAM;IACN,aAAa;IACb,YAAY;KACV;MACE,IAAI;MACJ,MAAM;MACN,aAAa;MACb,QAAQ;MACR,UAAU;MACV,SAAS;MACT,QAAQ,CACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aACE;OACF,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,aACE;OACF,UAAU;MACZ,CACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;KACA;MACE,IAAI;MACJ,MAAM;MACN,aACE;MACF,QAAQ;MACR,UACE;MACF,SAAS;MACT,QAAQ,CACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aACE;OACF,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,CACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;KACA;MACE,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A,oBAAoB,OAAO;EACzB,OAAO,wBAAwB,KAAK;CACtC;CACA,iBAAiB,UAAU;EACzB,OAAO,qBAAqB,QAAQ;CACtC;CACA,uBAAuB,UAAU;EAC/B,OAAO,2BAA2B,QAAQ;CAC5C;AACF;;;;;;;;;;;;;AE9DA,MAAa,QAA+C;CAC1D,GAAGC;CACH,GAAGC;AACL;;;;ACAA,MAAa,aAAa;CACxB,SAAS;CACT;CACA;CACA;CACA,eAAe,YAAY,iBAAiB,GAAG,aAAa;AAC9D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"piece-auth-BS5CtQOG.js","names":[],"sources":["../../editors/connection-editor/piece-auth.ts"],"sourcesContent":["// Turns a piece's PieceAuth descriptor into a concrete field plan that maps\n// onto powerhouse/connection state: config fields vs secret refs.\nimport type { ConnectionAuthType } from \"document-models/connection\";\n\nexport interface AuthField {\n name: string;\n displayName: string;\n required: boolean;\n description?: string;\n // Non-secret fields only: SHORT_TEXT | NUMBER | CHECKBOX | STATIC_DROPDOWN.\n inputType?: string;\n options?: { label: string; value: unknown }[];\n}\n\n// A piece auth type this runtime doesn't know: shown, never saved.\nexport const UNKNOWN_AUTH = \"UNKNOWN\";\n\nexport interface AuthPlan {\n authType: ConnectionAuthType | typeof UNKNOWN_AUTH;\n displayName?: string;\n description?: string;\n configFields: AuthField[];\n secretFields: AuthField[];\n // OIDC is declared but not executable by the runtime yet.\n supported: boolean;\n // Signed in through the provider; the token is stored by the switchboard.\n oauth2?: boolean;\n // The piece's own name for an UNKNOWN auth type.\n declaredType?: string;\n}\n\n// Missing means unset, explicitly null, or emptied to \"\" - not `false`/`0`.\nexport function isConfigValueMissing(value: unknown): boolean {\n return value === undefined || value === null || value === \"\";\n}\n\n// Whether every required config/secret field of the plan is filled; pure so\n// it can drive a live re-check as the user edits, not just a one-time mark.\nexport function isAuthComplete(\n plan: AuthPlan,\n config: Record<string, unknown>,\n refs: Map<string, string>,\n): boolean {\n const configOk = plan.configFields.every(\n (field) => !field.required || !isConfigValueMissing(config[field.name]),\n );\n const secretsOk = plan.secretFields.every(\n (field) => !field.required || Boolean(refs.get(field.name)),\n );\n return configOk && secretsOk;\n}\n\ninterface AuthPropDescriptor {\n displayName?: string;\n description?: string;\n required?: boolean;\n type?: string;\n options?: { options?: { label?: string; value?: unknown }[] };\n}\n\ninterface PieceAuthDescriptor {\n type?: string;\n unsupported?: string;\n displayName?: string;\n description?: string;\n required?: boolean;\n // A record in a published listing; a named list from a loaded piece.\n props?:\n | Partial<Record<string, AuthPropDescriptor>>\n | (AuthPropDescriptor & { name?: string })[];\n}\n\n// Names the connection's config and secretRefs use for an OAuth2 app.\nexport const OAUTH_CLIENT_ID = \"client_id\";\nexport const OAUTH_CLIENT_SECRET = \"client_secret\";\nexport const OAUTH_TOKEN = \"token\";\n\nfunction propEntries(\n props: PieceAuthDescriptor[\"props\"],\n): [string, AuthPropDescriptor][] {\n if (Array.isArray(props)) {\n return props.flatMap((prop) => (prop.name ? [[prop.name, prop]] : []));\n }\n return Object.entries(props ?? {}).filter(\n (entry): entry is [string, AuthPropDescriptor] => entry[1] !== undefined,\n );\n}\n\nfunction toField(name: string, prop: AuthPropDescriptor): AuthField {\n return {\n name,\n displayName: prop.displayName ?? name,\n required: prop.required ?? false,\n description: prop.description,\n inputType: prop.type,\n options: prop.options?.options\n ?.filter((option) => option.value !== undefined)\n .map((option) => ({\n label: option.label ?? String(option.value as string),\n value: option.value,\n })),\n };\n}\n\n// Every sign-in method a piece offers, in its order, one per auth type.\nexport function plansFromAuth(auth: unknown): AuthPlan[] {\n const plans = (Array.isArray(auth) ? auth : [auth]).map(planFromAuth);\n return plans.filter(\n (plan, index) =>\n plans.findIndex((other) => other.authType === plan.authType) === index,\n );\n}\n\n// The method a connection signs in with: the one of its auth type when the\n// runtime can run it, otherwise the piece's default.\nexport function planForConnection(\n auth: unknown,\n authType: ConnectionAuthType,\n): AuthPlan {\n return (\n plansFromAuth(auth).find(\n (plan) => plan.authType === authType && plan.supported,\n ) ?? planFromAuth(auth)\n );\n}\n\nexport function planFromAuth(auth: unknown): AuthPlan {\n // Some pieces declare multiple auth methods; prefer one the runtime supports.\n if (Array.isArray(auth)) {\n const plans = auth.map(planFromAuth);\n return (\n plans.find((plan) => plan.supported && plan.authType !== \"NONE\") ??\n plans.at(0) ??\n planFromAuth(null)\n );\n }\n const descriptor = (auth ?? null) as PieceAuthDescriptor | null;\n const plan = planForDescriptor(descriptor);\n // The runtime's own verdict, e.g. a CUSTOM_AUTH that needs token refresh.\n return descriptor?.unsupported ? { ...plan, supported: false } : plan;\n}\n\nfunction planForDescriptor(descriptor: PieceAuthDescriptor | null): AuthPlan {\n const base = {\n displayName: descriptor?.displayName,\n description: descriptor?.description,\n };\n switch (descriptor?.type) {\n case \"SECRET_TEXT\":\n return {\n ...base,\n authType: \"SECRET_TEXT\",\n configFields: [],\n secretFields: [\n {\n name: \"value\",\n displayName: descriptor.displayName ?? \"Secret\",\n required: descriptor.required ?? true,\n description: descriptor.description,\n },\n ],\n supported: true,\n };\n case \"BASIC_AUTH\": {\n const props: Partial<Record<string, AuthPropDescriptor>> =\n Object.fromEntries(propEntries(descriptor.props));\n return {\n ...base,\n authType: \"BASIC_AUTH\",\n configFields: [\n toField(\"username\", props.username ?? { displayName: \"Username\" }),\n ],\n secretFields: [\n toField(\"password\", props.password ?? { displayName: \"Password\" }),\n ],\n supported: true,\n };\n }\n case \"CUSTOM_AUTH\": {\n const entries = propEntries(descriptor.props);\n return {\n ...base,\n authType: \"CUSTOM_AUTH\",\n configFields: entries\n .filter(([, prop]) => prop.type !== \"SECRET_TEXT\")\n .map(([name, prop]) => toField(name, prop)),\n secretFields: entries\n .filter(([, prop]) => prop.type === \"SECRET_TEXT\")\n .map(([name, prop]) => toField(name, prop)),\n supported: true,\n };\n }\n case \"OAUTH2\": {\n const entries = propEntries(descriptor.props);\n return {\n ...base,\n authType: \"OAUTH2\",\n configFields: [\n {\n name: OAUTH_CLIENT_ID,\n displayName: \"Client ID\",\n required: true,\n description: \"From the OAuth app you registered with the service.\",\n },\n ...entries\n .filter(([, prop]) => prop.type !== \"SECRET_TEXT\")\n .map(([name, prop]) => toField(name, prop)),\n ],\n secretFields: [\n {\n name: OAUTH_CLIENT_SECRET,\n displayName: \"Client secret\",\n required: true,\n },\n ...entries\n .filter(([, prop]) => prop.type === \"SECRET_TEXT\")\n .map(([name, prop]) => toField(name, prop)),\n ],\n supported: true,\n oauth2: true,\n };\n }\n case \"OIDC\":\n return {\n ...base,\n authType: \"OIDC\",\n configFields: [],\n secretFields: [],\n supported: false,\n };\n case undefined:\n case \"NONE\":\n return {\n ...base,\n authType: \"NONE\",\n configFields: [],\n secretFields: [],\n supported: true,\n };\n default:\n return {\n ...base,\n authType: UNKNOWN_AUTH,\n declaredType: descriptor?.type,\n configFields: [],\n secretFields: [],\n supported: false,\n };\n }\n}\n\n// \"@activepieces/piece-gotify\" -> \"@activepieces/piece-gotify#gotify\"\nexport function connectorIdForPiece(packageName: string): string {\n const short =\n packageName\n .split(\"/\")\n .pop()\n ?.replace(/^piece-/, \"\") ?? packageName;\n return `${packageName}#${short}`;\n}\n\n// \"<piece package>#<short name>\" -> the package; a bare name is its own.\nexport function packageFromConnectorId(connectorId: string): string {\n const separator = connectorId.lastIndexOf(\"#\");\n if (separator <= 0) return connectorId;\n const spec = connectorId.slice(0, separator);\n const at = spec.indexOf(\"@\", 1);\n return at > 0 ? spec.slice(0, at) : spec;\n}\n"],"mappings":";AAeA,MAAa,eAAe;AAiB5B,SAAgB,qBAAqB,OAAyB;CAC5D,OAAO,UAAU,KAAA,KAAa,UAAU,QAAQ,UAAU;AAC5D;AAIA,SAAgB,eACd,MACA,QACA,MACS;CACT,MAAM,WAAW,KAAK,aAAa,OAChC,UAAU,CAAC,MAAM,YAAY,CAAC,qBAAqB,OAAO,MAAM,KAAK,CACxE;CACA,MAAM,YAAY,KAAK,aAAa,OACjC,UAAU,CAAC,MAAM,YAAY,QAAQ,KAAK,IAAI,MAAM,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