@codemation/core 0.0.1
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/README.md +30 -0
- package/dist/EngineExecutionLimitsPolicy-8MEFIYx1.d.cts +160 -0
- package/dist/EngineExecutionLimitsPolicy-BWAXW9D6.d.cts +160 -0
- package/dist/EngineExecutionLimitsPolicy-Bp8PS1Ss.d.cts +159 -0
- package/dist/EngineExecutionLimitsPolicy-CLxcN-D2.d.ts +159 -0
- package/dist/EngineExecutionLimitsPolicy-DZXuix51.d.ts +160 -0
- package/dist/EngineExecutionLimitsPolicy-Gfz6ngFd.d.ts +160 -0
- package/dist/EngineFactory-CBnntY3J.cjs +3152 -0
- package/dist/EngineFactory-CBnntY3J.cjs.map +1 -0
- package/dist/EngineFactory-Cwn3R2YA.js +3087 -0
- package/dist/EngineFactory-Cwn3R2YA.js.map +1 -0
- package/dist/EngineFactory-DWCnNocp.js +3063 -0
- package/dist/EngineFactory-DWCnNocp.js.map +1 -0
- package/dist/EngineFactory-DhPFou4p.cjs +3188 -0
- package/dist/EngineFactory-DhPFou4p.cjs.map +1 -0
- package/dist/EngineFactory-l_9xmBtv.cjs +3190 -0
- package/dist/EngineFactory-l_9xmBtv.cjs.map +1 -0
- package/dist/EngineFactory-w-aOWuqh.js +3089 -0
- package/dist/EngineFactory-w-aOWuqh.js.map +1 -0
- package/dist/InMemoryLiveWorkflowRepository-1J9MHN_I.js +18 -0
- package/dist/InMemoryLiveWorkflowRepository-1J9MHN_I.js.map +1 -0
- package/dist/InMemoryLiveWorkflowRepository-BTzHpQ6e.cjs +151 -0
- package/dist/InMemoryLiveWorkflowRepository-BTzHpQ6e.cjs.map +1 -0
- package/dist/InMemoryLiveWorkflowRepository-BoLNnVLg.js +139 -0
- package/dist/InMemoryLiveWorkflowRepository-BoLNnVLg.js.map +1 -0
- package/dist/InMemoryLiveWorkflowRepository-CULNqv96.d.ts +1300 -0
- package/dist/InMemoryLiveWorkflowRepository-D6eiiXxF.d.cts +1168 -0
- package/dist/InMemoryLiveWorkflowRepository-D7l8cjdZ.d.cts +1130 -0
- package/dist/InMemoryLiveWorkflowRepository-DL7LmC9S.d.ts +1340 -0
- package/dist/InMemoryLiveWorkflowRepository-jnv-OnOP.d.ts +1300 -0
- package/dist/InMemoryLiveWorkflowRepository-xny1_Z6i.cjs +24 -0
- package/dist/InMemoryLiveWorkflowRepository-xny1_Z6i.cjs.map +1 -0
- package/dist/InMemoryLiveWorkflowRepository-xr7b4kvi.d.ts +1338 -0
- package/dist/InMemoryWorkflowCatalog-BIdFpwbK.d.ts +1205 -0
- package/dist/InMemoryWorkflowCatalog-BW00_3N3.d.cts +12 -0
- package/dist/InMemoryWorkflowCatalog-BiYHGoPw.cjs +24 -0
- package/dist/InMemoryWorkflowCatalog-BiYHGoPw.cjs.map +1 -0
- package/dist/InMemoryWorkflowCatalog-BrG0ApMO.d.cts +1115 -0
- package/dist/InMemoryWorkflowCatalog-BzrAr--Y.js +139 -0
- package/dist/InMemoryWorkflowCatalog-BzrAr--Y.js.map +1 -0
- package/dist/InMemoryWorkflowCatalog-C-EJlJ7y.d.cts +1120 -0
- package/dist/InMemoryWorkflowCatalog-C4482bpw.cjs +24 -0
- package/dist/InMemoryWorkflowCatalog-C4482bpw.cjs.map +1 -0
- package/dist/InMemoryWorkflowCatalog-CZ0kZpOv.d.ts +1289 -0
- package/dist/InMemoryWorkflowCatalog-C_ACeLyW.d.cts +1119 -0
- package/dist/InMemoryWorkflowCatalog-CiHWIu5E.d.cts +12 -0
- package/dist/InMemoryWorkflowCatalog-CkH7gkya.js +18 -0
- package/dist/InMemoryWorkflowCatalog-CkH7gkya.js.map +1 -0
- package/dist/InMemoryWorkflowCatalog-CnpZVJM9.d.ts +1205 -0
- package/dist/InMemoryWorkflowCatalog-Cu68S8YR.js +18 -0
- package/dist/InMemoryWorkflowCatalog-Cu68S8YR.js.map +1 -0
- package/dist/InMemoryWorkflowCatalog-D2w9nMj2.cjs +151 -0
- package/dist/InMemoryWorkflowCatalog-D2w9nMj2.cjs.map +1 -0
- package/dist/InMemoryWorkflowCatalog-D5eMxEf7.js +18 -0
- package/dist/InMemoryWorkflowCatalog-D5eMxEf7.js.map +1 -0
- package/dist/InMemoryWorkflowCatalog-D5nCp2yZ.d.ts +1267 -0
- package/dist/InMemoryWorkflowCatalog-DIq0bjqN.d.ts +12 -0
- package/dist/InMemoryWorkflowCatalog-DLgaEaw_.d.ts +1288 -0
- package/dist/InMemoryWorkflowCatalog-DNBFdK-x.d.cts +1120 -0
- package/dist/InMemoryWorkflowCatalog-DQBkCzb7.cjs +24 -0
- package/dist/InMemoryWorkflowCatalog-DQBkCzb7.cjs.map +1 -0
- package/dist/InMemoryWorkflowCatalog-DS4-eX6i.d.cts +1118 -0
- package/dist/InMemoryWorkflowCatalog-DdVfy8MY.d.ts +12 -0
- package/dist/InMemoryWorkflowCatalog-DeVZu3g8.d.ts +12 -0
- package/dist/InMemoryWorkflowCatalog-GxkQjvt5.d.ts +1200 -0
- package/dist/InMemoryWorkflowCatalog-qaVRn1Lc.d.cts +1115 -0
- package/dist/InMemoryWorkflowCatalog-z1aIT4TC.d.cts +12 -0
- package/dist/InMemoryWorkflowRegistry-BBuOovLL.d.ts +1007 -0
- package/dist/InMemoryWorkflowRegistry-BIFnSl3k.d.ts +1201 -0
- package/dist/InMemoryWorkflowRegistry-BnGilthz.d.ts +1137 -0
- package/dist/InMemoryWorkflowRegistry-CEp5I8No.d.ts +1146 -0
- package/dist/InMemoryWorkflowRegistry-CHyMB9jW.d.cts +976 -0
- package/dist/InMemoryWorkflowRegistry-CUN7K86m.d.cts +1061 -0
- package/dist/InMemoryWorkflowRegistry-CVfHyELh.d.cts +971 -0
- package/dist/InMemoryWorkflowRegistry-CXXJrwAr.d.cts +1052 -0
- package/dist/InMemoryWorkflowRegistry-DDGfPTJy.d.ts +1013 -0
- package/dist/InMemoryWorkflowRegistry-DnYSOoT5.d.ts +1120 -0
- package/dist/InMemoryWorkflowRegistry-Dp5GiFF2.d.cts +1035 -0
- package/dist/InMemoryWorkflowRegistry-DypDBeOw.d.cts +1116 -0
- package/dist/InMemoryWorkflowRegistry-SzwJCAxT.d.ts +1012 -0
- package/dist/InMemoryWorkflowRegistry-jupvqyGc.d.cts +977 -0
- package/dist/InMemoryWorkflowRegistry-rAdKVWYT.d.ts +1117 -0
- package/dist/InProcessRetryRunner-BBNPkXjy.d.cts +292 -0
- package/dist/PersistedWorkflowSnapshotFactory-7RkOL3Kg.d.ts +14 -0
- package/dist/PersistedWorkflowSnapshotFactory-BmANa46W.cjs +141 -0
- package/dist/PersistedWorkflowSnapshotFactory-BmANa46W.cjs.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-Bwb_etSt.js +118 -0
- package/dist/PersistedWorkflowSnapshotFactory-Bwb_etSt.js.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-CRkKGNV6.js +123 -0
- package/dist/PersistedWorkflowSnapshotFactory-CRkKGNV6.js.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-CZolnGy5.js +101 -0
- package/dist/PersistedWorkflowSnapshotFactory-CZolnGy5.js.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-Ca_oysOv.cjs +131 -0
- package/dist/PersistedWorkflowSnapshotFactory-Ca_oysOv.cjs.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-CqIcShnX.js +103 -0
- package/dist/PersistedWorkflowSnapshotFactory-CqIcShnX.js.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-D-tBk4_G.js +119 -0
- package/dist/PersistedWorkflowSnapshotFactory-D-tBk4_G.js.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-D4cXl2e2.cjs +131 -0
- package/dist/PersistedWorkflowSnapshotFactory-D4cXl2e2.cjs.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-DINoP12r.cjs +131 -0
- package/dist/PersistedWorkflowSnapshotFactory-DINoP12r.cjs.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-DJAwSuHU.js +103 -0
- package/dist/PersistedWorkflowSnapshotFactory-DJAwSuHU.js.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-DSUjVCcf.cjs +131 -0
- package/dist/PersistedWorkflowSnapshotFactory-DSUjVCcf.cjs.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-DdHuhkDb.cjs +107 -0
- package/dist/PersistedWorkflowSnapshotFactory-DdHuhkDb.cjs.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-Dqc6NHis.js +119 -0
- package/dist/PersistedWorkflowSnapshotFactory-Dqc6NHis.js.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-Dxa2dSrw.cjs +130 -0
- package/dist/PersistedWorkflowSnapshotFactory-Dxa2dSrw.cjs.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-Ep79Ah1G.js +123 -0
- package/dist/PersistedWorkflowSnapshotFactory-Ep79Ah1G.js.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-GyLfRuiJ.js +119 -0
- package/dist/PersistedWorkflowSnapshotFactory-GyLfRuiJ.js.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-HTpBsBzn.js +102 -0
- package/dist/PersistedWorkflowSnapshotFactory-HTpBsBzn.js.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-LVmaaf3t.cjs +141 -0
- package/dist/PersistedWorkflowSnapshotFactory-LVmaaf3t.cjs.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-PZCpo2ZS.js +119 -0
- package/dist/PersistedWorkflowSnapshotFactory-PZCpo2ZS.js.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-UjQ1SJev.cjs +109 -0
- package/dist/PersistedWorkflowSnapshotFactory-UjQ1SJev.cjs.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-Y8kCrhcy.cjs +109 -0
- package/dist/PersistedWorkflowSnapshotFactory-Y8kCrhcy.cjs.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-Z_nB-fmB.cjs +108 -0
- package/dist/PersistedWorkflowSnapshotFactory-Z_nB-fmB.cjs.map +1 -0
- package/dist/RunIntentService-1EE6N8ZL.cjs +963 -0
- package/dist/RunIntentService-1EE6N8ZL.cjs.map +1 -0
- package/dist/RunIntentService-2ivFmNQh.cjs +3462 -0
- package/dist/RunIntentService-2ivFmNQh.cjs.map +1 -0
- package/dist/RunIntentService-B0sUL5q-.js +761 -0
- package/dist/RunIntentService-B0sUL5q-.js.map +1 -0
- package/dist/RunIntentService-BFVbsOcg.js +3131 -0
- package/dist/RunIntentService-BFVbsOcg.js.map +1 -0
- package/dist/RunIntentService-BsBOwpVN.cjs +1051 -0
- package/dist/RunIntentService-BsBOwpVN.cjs.map +1 -0
- package/dist/RunIntentService-CSk3ETyn.js +858 -0
- package/dist/RunIntentService-CSk3ETyn.js.map +1 -0
- package/dist/RunIntentService-Ckn3u3tA.d.cts +326 -0
- package/dist/RunIntentService-DEo6GTTo.d.cts +289 -0
- package/dist/RunIntentService-DKrGtL0B.js +782 -0
- package/dist/RunIntentService-DKrGtL0B.js.map +1 -0
- package/dist/RunIntentService-DNOJc1R7.cjs +942 -0
- package/dist/RunIntentService-DNOJc1R7.cjs.map +1 -0
- package/dist/RunIntentService-Dq3pV53j.d.cts +289 -0
- package/dist/RunIntentService-NKobsfMQ.d.cts +274 -0
- package/dist/WorkflowSnapshotCodec-C3fuuS_R.d.cts +22 -0
- package/dist/WorkflowSnapshotCodec-CUudUo6f.js +123 -0
- package/dist/WorkflowSnapshotCodec-CUudUo6f.js.map +1 -0
- package/dist/WorkflowSnapshotCodec-CuCPQZTc.cjs +129 -0
- package/dist/WorkflowSnapshotCodec-CuCPQZTc.cjs.map +1 -0
- package/dist/WorkflowSnapshotCodec-DLiXQNvV.d.cts +22 -0
- package/dist/WorkflowSnapshotCodec-DNtdrZ7l.d.cts +22 -0
- package/dist/WorkflowSnapshotCodec-DTdWkoW_.d.cts +22 -0
- package/dist/bootstrap/index.cjs +1028 -0
- package/dist/bootstrap/index.cjs.map +1 -0
- package/dist/bootstrap/index.d.cts +311 -0
- package/dist/bootstrap/index.d.ts +83 -0
- package/dist/bootstrap/index.js +994 -0
- package/dist/bootstrap/index.js.map +1 -0
- package/dist/credentialTypes-B5h3dI7r.d.cts +1107 -0
- package/dist/credentialTypes-B9okPCVo.d.cts +963 -0
- package/dist/credentialTypes-BFL70rgZ.d.cts +964 -0
- package/dist/credentialTypes-BGkh1O07.d.ts +1010 -0
- package/dist/credentialTypes-BNLi4Q7u.d.ts +1030 -0
- package/dist/credentialTypes-CeSoZGj3.d.cts +994 -0
- package/dist/credentialTypes-CpHc32Ig.d.cts +984 -0
- package/dist/credentialTypes-D0m7MQQl.d.cts +1107 -0
- package/dist/credentialTypes-D4nL2sUd.d.ts +1000 -0
- package/dist/credentialTypes-DBYK2Qbu.d.ts +999 -0
- package/dist/credentialTypes-DMJVy0r1.d.ts +1000 -0
- package/dist/credentialTypes-DhUAjYQp.d.ts +1020 -0
- package/dist/credentialTypes-gGITj5KL.d.cts +964 -0
- package/dist/credentialTypes-r3KVBJBE.d.cts +974 -0
- package/dist/diTokens-ClO27tjK.cjs +34 -0
- package/dist/diTokens-ClO27tjK.cjs.map +1 -0
- package/dist/diTokens-CoHBkwG6.js +28 -0
- package/dist/diTokens-CoHBkwG6.js.map +1 -0
- package/dist/index-6Doxmfnd.d.ts +857 -0
- package/dist/index-9g6Pfe9Z.d.ts +689 -0
- package/dist/index-AZ72Ej-K.d.ts +920 -0
- package/dist/index-BEk9V-q-.d.ts +667 -0
- package/dist/index-Bjt7_7oS.d.ts +1192 -0
- package/dist/index-CFGxsYXy.d.ts +708 -0
- package/dist/index-C_u8xFgn.d.ts +690 -0
- package/dist/index-CpbfsvOJ.d.ts +1192 -0
- package/dist/index-CsReNJN_.d.ts +859 -0
- package/dist/index-D5iNnXaW.d.ts +667 -0
- package/dist/index-DD_Eft1q.d.ts +708 -0
- package/dist/index-DiSYUe0G.d.ts +1192 -0
- package/dist/index-gIcH60sp.d.ts +674 -0
- package/dist/index.cjs +520 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +345 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +412 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime-BIvd-1JA.cjs +4112 -0
- package/dist/runtime-BIvd-1JA.cjs.map +1 -0
- package/dist/runtime-D3eWKSQK.cjs +3986 -0
- package/dist/runtime-D3eWKSQK.cjs.map +1 -0
- package/dist/runtime-Dvp4xAjg.js +3799 -0
- package/dist/runtime-Dvp4xAjg.js.map +1 -0
- package/dist/runtime-vc76SSAa.js +3685 -0
- package/dist/runtime-vc76SSAa.js.map +1 -0
- package/dist/runtimeTypes-BK0b8SaG.d.cts +884 -0
- package/dist/runtimeTypes-CoYZkYQq.d.cts +851 -0
- package/dist/runtimeTypes-D-Pm0Uas.d.cts +849 -0
- package/dist/testing.cjs +18 -0
- package/dist/testing.cjs.map +1 -0
- package/dist/testing.d.cts +19 -0
- package/dist/testing.d.ts +18 -0
- package/dist/testing.js +16 -0
- package/dist/testing.js.map +1 -0
- package/dist/types-Cb5UK7Y6.d.ts +857 -0
- package/package.json +66 -0
- package/src/ai/AiHost.ts +115 -0
- package/src/binaries/DefaultExecutionBinaryServiceFactory.ts +37 -0
- package/src/binaries/DefaultNodeBinaryAttachmentServiceFactory.ts +120 -0
- package/src/binaries/UnavailableBinaryStorage.ts +19 -0
- package/src/binaries/index.ts +2 -0
- package/src/bootstrap/index.ts +46 -0
- package/src/bootstrap/runtime/EngineRuntimeRegistrar.ts +180 -0
- package/src/bootstrap/runtime/EngineRuntimeRegistration.types.ts +43 -0
- package/src/bootstrap/runtime/index.ts +6 -0
- package/src/browser.ts +8 -0
- package/src/contracts/Clock.ts +10 -0
- package/src/contracts/ExpRetryPolicy.ts +23 -0
- package/src/contracts/NoRetryPolicy.ts +5 -0
- package/src/contracts/RetryPolicy.ts +23 -0
- package/src/contracts/credentialTypes.ts +194 -0
- package/src/contracts/index.ts +6 -0
- package/src/contracts/retryPolicySpec.types.ts +30 -0
- package/src/contracts/runFinishedAtFactory.ts +19 -0
- package/src/contracts/runTypes.ts +314 -0
- package/src/contracts/runtimeTypes.ts +373 -0
- package/src/contracts/webhookTypes.ts +49 -0
- package/src/contracts/workflowActivationPolicy.ts +16 -0
- package/src/contracts/workflowTypes.ts +280 -0
- package/src/di/CoreTokens.ts +60 -0
- package/src/di/index.ts +24 -0
- package/src/events/EventPublishingWorkflowExecutionRepository.ts +67 -0
- package/src/events/InMemoryRunEventBusRegistry.ts +37 -0
- package/src/events/InMemoryRunEventSubscription.ts +9 -0
- package/src/events/NodeEventPublisher.ts +22 -0
- package/src/events/index.ts +4 -0
- package/src/events/runEvents.ts +54 -0
- package/src/execution/ActivationEnqueueService.ts +125 -0
- package/src/execution/CredentialResolverFactory.ts +39 -0
- package/src/execution/DefaultAsyncSleeper.ts +9 -0
- package/src/execution/DefaultExecutionContextFactory.ts +48 -0
- package/src/execution/InProcessRetryRunner.ts +115 -0
- package/src/execution/InProcessRetryRunnerFactory.ts +8 -0
- package/src/execution/NodeActivationRequestComposer.ts +113 -0
- package/src/execution/NodeExecutionSnapshotFactory.ts +152 -0
- package/src/execution/NodeExecutor.ts +43 -0
- package/src/execution/NodeExecutorFactory.ts +10 -0
- package/src/execution/NodeInputsByPortFactory.ts +14 -0
- package/src/execution/NodeInstanceFactory.ts +32 -0
- package/src/execution/NodeInstanceFactoryFactory.ts +9 -0
- package/src/execution/NodeRunStateWriter.ts +185 -0
- package/src/execution/NodeRunStateWriterFactory.ts +29 -0
- package/src/execution/PersistedRunStateTerminalBuilder.ts +25 -0
- package/src/execution/RunStateSemantics.ts +158 -0
- package/src/execution/WorkflowRunExecutionContextFactory.ts +45 -0
- package/src/execution/asyncSleeper.types.ts +3 -0
- package/src/execution/index.ts +26 -0
- package/src/index.ts +18 -0
- package/src/orchestration/Engine.ts +229 -0
- package/src/orchestration/EngineWaiters.ts +37 -0
- package/src/orchestration/RunContinuationService.ts +810 -0
- package/src/orchestration/RunStartService.ts +449 -0
- package/src/orchestration/TriggerRuntimeService.ts +260 -0
- package/src/orchestration/index.ts +5 -0
- package/src/planning/CurrentStateFrontierPlanner.ts +400 -0
- package/src/planning/EngineWorkflowPlanningFactory.ts +63 -0
- package/src/planning/RunQueuePlanner.ts +302 -0
- package/src/planning/WorkflowTopologyPlanner.ts +77 -0
- package/src/planning/index.ts +4 -0
- package/src/policies/WorkflowPolicyErrorServices.ts +38 -0
- package/src/policies/executionLimits/EngineExecutionLimitsPolicy.ts +66 -0
- package/src/policies/executionLimits/EngineExecutionLimitsPolicyFactory.ts +14 -0
- package/src/policies/index.ts +10 -0
- package/src/policies/storage/RunPolicySnapshotFactory.ts +23 -0
- package/src/policies/storage/RunTerminalPersistenceCoordinator.ts +29 -0
- package/src/policies/storage/WorkflowStoragePolicyEvaluator.ts +39 -0
- package/src/runStorage/BinaryBodyBufferReader.ts +57 -0
- package/src/runStorage/BinaryBodyReadableStreamFactory.ts +21 -0
- package/src/runStorage/InMemoryBinaryStorageRegistry.ts +53 -0
- package/src/runStorage/InMemoryRunData.ts +33 -0
- package/src/runStorage/InMemoryRunDataFactory.ts +8 -0
- package/src/runStorage/InMemoryWorkflowExecutionRepository.ts +95 -0
- package/src/runStorage/RunSummaryMapper.ts +17 -0
- package/src/runStorage/index.ts +7 -0
- package/src/runtime/EngineFactory.ts +151 -0
- package/src/runtime/EngineWorkflowRunnerService.ts +39 -0
- package/src/runtime/EngineWorkflowRunnerServiceFactory.ts +11 -0
- package/src/runtime/InMemoryLiveWorkflowRepository.ts +20 -0
- package/src/runtime/RunIntentService.ts +175 -0
- package/src/runtime/RunIntentServiceFactory.ts +11 -0
- package/src/runtime/WorkflowRepositoryWebhookTriggerMatcher.ts +144 -0
- package/src/runtime/WorkflowRepositoryWebhookTriggerMatcherFactory.ts +13 -0
- package/src/runtime/index.ts +9 -0
- package/src/runtime-types/InjectableRuntimeDecoratorComposerRegistry.ts +25 -0
- package/src/runtime-types/PersistedRuntimeTypeMetadataStoreRegistry.ts +46 -0
- package/src/runtime-types/PersistedRuntimeTypeNameResolver.ts +14 -0
- package/src/runtime-types/StackTraceCallSitePathResolver.ts +25 -0
- package/src/runtime-types/persistedRuntimeTypeModelRegistry.ts +33 -0
- package/src/runtime-types/runtimeTypeDecorators.types.ts +46 -0
- package/src/scheduler/ConfigDrivenOffloadPolicy.ts +28 -0
- package/src/scheduler/DefaultDrivingScheduler.ts +100 -0
- package/src/scheduler/HintOnlyOffloadPolicy.ts +9 -0
- package/src/scheduler/InlineDrivingScheduler.ts +145 -0
- package/src/scheduler/InlineDrivingSchedulerFactory.ts +9 -0
- package/src/scheduler/LocalOnlyScheduler.ts +7 -0
- package/src/serialization/ItemsInputNormalizer.ts +36 -0
- package/src/testing/RejectingCredentialSessionService.ts +15 -0
- package/src/testing.ts +6 -0
- package/src/types/index.ts +12 -0
- package/src/workflow/definition/ConnectionInvocationIdFactory.ts +17 -0
- package/src/workflow/definition/ConnectionNodeIdFactory.ts +42 -0
- package/src/workflow/definition/WorkflowExecutableNodeClassifier.ts +71 -0
- package/src/workflow/definition/WorkflowExecutableNodeClassifierFactory.ts +9 -0
- package/src/workflow/dsl/ChainCursorResolver.ts +103 -0
- package/src/workflow/dsl/WhenBuilder.ts +57 -0
- package/src/workflow/dsl/WorkflowBuilder.ts +55 -0
- package/src/workflow/dsl/workflowBuilderTypes.ts +63 -0
- package/src/workflow/graph/DefaultWorkflowGraphFactory.ts +8 -0
- package/src/workflow/graph/ExecutableGraph.ts +24 -0
- package/src/workflow/index.ts +11 -0
- package/src/workflowSnapshots/MissingRuntimeExecutionMarker.ts +5 -0
- package/src/workflowSnapshots/MissingRuntimeFallbacksFactory.ts +27 -0
- package/src/workflowSnapshots/MissingRuntimeNode.ts +12 -0
- package/src/workflowSnapshots/MissingRuntimeNodeConfig.ts +14 -0
- package/src/workflowSnapshots/MissingRuntimeNodeToken.ts +1 -0
- package/src/workflowSnapshots/MissingRuntimeTrigger.ts +16 -0
- package/src/workflowSnapshots/MissingRuntimeTriggerConfig.ts +14 -0
- package/src/workflowSnapshots/MissingRuntimeTriggerToken.ts +1 -0
- package/src/workflowSnapshots/PersistedRuntimeTypeIdFactory.ts +19 -0
- package/src/workflowSnapshots/PersistedWorkflowTokenRegistry.ts +89 -0
- package/src/workflowSnapshots/PersistedWorkflowTokenRegistryFactory.ts +2 -0
- package/src/workflowSnapshots/WorkflowSnapshotCodec.ts +177 -0
- package/src/workflowSnapshots/WorkflowSnapshotResolver.ts +102 -0
- package/src/workflowSnapshots/index.ts +12 -0
- package/tsconfig.json +9 -0
- package/tsdown.config.ts +10 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { CredentialSessionService, NodeExecutionContext, NodeId, WorkflowId } from "../types";
|
|
2
|
+
|
|
3
|
+
export class CredentialResolverFactory {
|
|
4
|
+
constructor(private readonly credentialSessions: CredentialSessionService) {}
|
|
5
|
+
|
|
6
|
+
create(
|
|
7
|
+
workflowId: WorkflowId,
|
|
8
|
+
nodeId: NodeId,
|
|
9
|
+
config?: NodeExecutionContext["config"],
|
|
10
|
+
): NodeExecutionContext["getCredential"] {
|
|
11
|
+
const acceptedTypesBySlot = new Map<string, ReadonlyArray<string>>();
|
|
12
|
+
for (const requirement of config?.getCredentialRequirements?.() ?? []) {
|
|
13
|
+
acceptedTypesBySlot.set(requirement.slotKey, requirement.acceptedTypes);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return async <TSession = unknown>(slotKey: string): Promise<TSession> => {
|
|
17
|
+
try {
|
|
18
|
+
return await this.credentialSessions.getSession<TSession>({
|
|
19
|
+
workflowId,
|
|
20
|
+
nodeId,
|
|
21
|
+
slotKey,
|
|
22
|
+
});
|
|
23
|
+
} catch (error) {
|
|
24
|
+
const acceptedTypes = acceptedTypesBySlot.get(slotKey) ?? [];
|
|
25
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
26
|
+
const alreadyListsAcceptedTypes =
|
|
27
|
+
message.includes("Accepted types:") ||
|
|
28
|
+
message.includes("Accepted credential types:") ||
|
|
29
|
+
message.includes("binding points at an unknown type");
|
|
30
|
+
const acceptedTypesSuffix =
|
|
31
|
+
acceptedTypes.length > 0 && !alreadyListsAcceptedTypes ? ` Accepted types: ${acceptedTypes.join(", ")}.` : "";
|
|
32
|
+
throw new Error(
|
|
33
|
+
`Failed to resolve credential for workflow ${workflowId} node ${nodeId} slot "${slotKey}". ${message}${acceptedTypesSuffix}`,
|
|
34
|
+
{ cause: error },
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
BinaryStorage,
|
|
3
|
+
ExecutionContext,
|
|
4
|
+
ExecutionContextFactory,
|
|
5
|
+
NodeExecutionStatePublisher,
|
|
6
|
+
ParentExecutionRef,
|
|
7
|
+
RunDataSnapshot,
|
|
8
|
+
RunId,
|
|
9
|
+
WorkflowId,
|
|
10
|
+
} from "../types";
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
DefaultExecutionBinaryService,
|
|
14
|
+
UnavailableBinaryStorage,
|
|
15
|
+
} from "../binaries/DefaultExecutionBinaryServiceFactory";
|
|
16
|
+
|
|
17
|
+
export class DefaultExecutionContextFactory implements ExecutionContextFactory {
|
|
18
|
+
constructor(
|
|
19
|
+
private readonly binaryStorage: BinaryStorage = new UnavailableBinaryStorage(),
|
|
20
|
+
private readonly currentDate: () => Date = () => new Date(),
|
|
21
|
+
) {}
|
|
22
|
+
|
|
23
|
+
create(args: {
|
|
24
|
+
runId: RunId;
|
|
25
|
+
workflowId: WorkflowId;
|
|
26
|
+
parent?: ParentExecutionRef;
|
|
27
|
+
subworkflowDepth: number;
|
|
28
|
+
engineMaxNodeActivations: number;
|
|
29
|
+
engineMaxSubworkflowDepth: number;
|
|
30
|
+
data: RunDataSnapshot;
|
|
31
|
+
nodeState?: NodeExecutionStatePublisher;
|
|
32
|
+
getCredential<TSession = unknown>(slotKey: string): Promise<TSession>;
|
|
33
|
+
}): ExecutionContext {
|
|
34
|
+
return {
|
|
35
|
+
runId: args.runId,
|
|
36
|
+
workflowId: args.workflowId,
|
|
37
|
+
parent: args.parent,
|
|
38
|
+
subworkflowDepth: args.subworkflowDepth,
|
|
39
|
+
engineMaxNodeActivations: args.engineMaxNodeActivations,
|
|
40
|
+
engineMaxSubworkflowDepth: args.engineMaxSubworkflowDepth,
|
|
41
|
+
now: this.currentDate,
|
|
42
|
+
data: args.data,
|
|
43
|
+
nodeState: args.nodeState,
|
|
44
|
+
binary: new DefaultExecutionBinaryService(this.binaryStorage, args.workflowId, args.runId, this.currentDate),
|
|
45
|
+
getCredential: args.getCredential,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ExponentialRetryPolicySpec,
|
|
3
|
+
FixedRetryPolicySpec,
|
|
4
|
+
RetryPolicySpec,
|
|
5
|
+
} from "../contracts/retryPolicySpec.types";
|
|
6
|
+
import type { AsyncSleeper } from "./asyncSleeper.types";
|
|
7
|
+
|
|
8
|
+
export type { AsyncSleeper } from "./asyncSleeper.types";
|
|
9
|
+
|
|
10
|
+
type NormalizedPolicy =
|
|
11
|
+
| { readonly kind: "none"; readonly maxAttempts: 1 }
|
|
12
|
+
| { readonly kind: "fixed"; readonly maxAttempts: number; readonly delayMs: number }
|
|
13
|
+
| {
|
|
14
|
+
readonly kind: "exponential";
|
|
15
|
+
readonly maxAttempts: number;
|
|
16
|
+
readonly initialDelayMs: number;
|
|
17
|
+
readonly multiplier: number;
|
|
18
|
+
readonly maxDelayMs?: number;
|
|
19
|
+
readonly jitter?: boolean;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export class InProcessRetryRunner {
|
|
23
|
+
constructor(private readonly sleeper: AsyncSleeper) {}
|
|
24
|
+
|
|
25
|
+
async run<T>(policy: RetryPolicySpec | undefined, work: () => Promise<T>): Promise<T> {
|
|
26
|
+
const spec = InProcessRetryRunner.normalizePolicy(policy);
|
|
27
|
+
let lastError: unknown;
|
|
28
|
+
for (let attempt = 1; attempt <= spec.maxAttempts; attempt++) {
|
|
29
|
+
try {
|
|
30
|
+
return await work();
|
|
31
|
+
} catch (error) {
|
|
32
|
+
lastError = error;
|
|
33
|
+
if (attempt >= spec.maxAttempts) {
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
const delayMs = InProcessRetryRunner.delayAfterFailureMs(spec, attempt);
|
|
37
|
+
await this.sleeper.sleep(delayMs);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
throw lastError instanceof Error ? lastError : new Error(String(lastError));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
private static delayAfterFailureMs(spec: NormalizedPolicy, failedAttempt: number): number {
|
|
44
|
+
if (spec.kind === "none") {
|
|
45
|
+
return 0;
|
|
46
|
+
}
|
|
47
|
+
if (spec.kind === "fixed") {
|
|
48
|
+
return spec.delayMs;
|
|
49
|
+
}
|
|
50
|
+
const exponent = failedAttempt - 1;
|
|
51
|
+
let ms = spec.initialDelayMs * Math.pow(spec.multiplier, exponent);
|
|
52
|
+
if (spec.jitter === true) {
|
|
53
|
+
ms *= 1 + Math.random() * 0.2;
|
|
54
|
+
}
|
|
55
|
+
if (spec.maxDelayMs !== undefined && ms > spec.maxDelayMs) {
|
|
56
|
+
ms = spec.maxDelayMs;
|
|
57
|
+
}
|
|
58
|
+
return Math.max(0, Math.floor(ms));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private static normalizePolicy(policy: RetryPolicySpec | undefined): NormalizedPolicy {
|
|
62
|
+
if (policy === undefined) {
|
|
63
|
+
return { kind: "none", maxAttempts: 1 };
|
|
64
|
+
}
|
|
65
|
+
if (typeof policy !== "object" || policy === null) {
|
|
66
|
+
return { kind: "none", maxAttempts: 1 };
|
|
67
|
+
}
|
|
68
|
+
const kind = (policy as { kind?: unknown }).kind;
|
|
69
|
+
if (kind === "none") {
|
|
70
|
+
return { kind: "none", maxAttempts: 1 };
|
|
71
|
+
}
|
|
72
|
+
if (kind === "fixed") {
|
|
73
|
+
const p = policy as FixedRetryPolicySpec;
|
|
74
|
+
const maxAttempts = InProcessRetryRunner.assertPositiveInt(p.maxAttempts, "fixed.maxAttempts");
|
|
75
|
+
const delayMs = InProcessRetryRunner.assertNonNegativeFinite(p.delayMs, "fixed.delayMs");
|
|
76
|
+
return { kind: "fixed", maxAttempts, delayMs };
|
|
77
|
+
}
|
|
78
|
+
if (kind === "exponential") {
|
|
79
|
+
const p = policy as ExponentialRetryPolicySpec;
|
|
80
|
+
return {
|
|
81
|
+
kind: "exponential",
|
|
82
|
+
maxAttempts: InProcessRetryRunner.assertPositiveInt(p.maxAttempts, "exponential.maxAttempts"),
|
|
83
|
+
initialDelayMs: InProcessRetryRunner.assertNonNegativeFinite(p.initialDelayMs, "exponential.initialDelayMs"),
|
|
84
|
+
multiplier: InProcessRetryRunner.assertMultiplier(p.multiplier),
|
|
85
|
+
maxDelayMs:
|
|
86
|
+
p.maxDelayMs === undefined
|
|
87
|
+
? undefined
|
|
88
|
+
: InProcessRetryRunner.assertNonNegativeFinite(p.maxDelayMs, "exponential.maxDelayMs"),
|
|
89
|
+
jitter: p.jitter === true,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return { kind: "none", maxAttempts: 1 };
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private static assertPositiveInt(value: unknown, label: string): number {
|
|
96
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 1 || !Number.isInteger(value)) {
|
|
97
|
+
throw new Error(`Retry policy ${label} must be a positive integer`);
|
|
98
|
+
}
|
|
99
|
+
return value;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
private static assertNonNegativeFinite(value: unknown, label: string): number {
|
|
103
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
104
|
+
throw new Error(`Retry policy ${label} must be a non-negative finite number`);
|
|
105
|
+
}
|
|
106
|
+
return value;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private static assertMultiplier(value: unknown): number {
|
|
110
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 1) {
|
|
111
|
+
throw new Error(`Retry policy exponential.multiplier must be >= 1`);
|
|
112
|
+
}
|
|
113
|
+
return value;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DefaultAsyncSleeper } from "./DefaultAsyncSleeper";
|
|
2
|
+
import { InProcessRetryRunner } from "./InProcessRetryRunner";
|
|
3
|
+
|
|
4
|
+
export class InProcessRetryRunnerFactory {
|
|
5
|
+
create(defaultAsyncSleeper: DefaultAsyncSleeper): InProcessRetryRunner {
|
|
6
|
+
return new InProcessRetryRunner(defaultAsyncSleeper);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ActivationIdFactory,
|
|
3
|
+
ExecutionContextFactory,
|
|
4
|
+
Items,
|
|
5
|
+
NodeActivationRequest,
|
|
6
|
+
NodeExecutionContext,
|
|
7
|
+
NodeId,
|
|
8
|
+
ParentExecutionRef,
|
|
9
|
+
RunDataFactory,
|
|
10
|
+
RunExecutionOptions,
|
|
11
|
+
RunId,
|
|
12
|
+
WorkflowId,
|
|
13
|
+
} from "../types";
|
|
14
|
+
|
|
15
|
+
import type { PlannedActivation } from "../planning/RunQueuePlanner";
|
|
16
|
+
|
|
17
|
+
import { CredentialResolverFactory } from "./CredentialResolverFactory";
|
|
18
|
+
|
|
19
|
+
type NodeExecutionDefinition = Readonly<{ id: NodeId; config: NodeExecutionContext["config"] }>;
|
|
20
|
+
|
|
21
|
+
type NodeActivationContextArgs = {
|
|
22
|
+
runId: RunId;
|
|
23
|
+
workflowId: WorkflowId;
|
|
24
|
+
parent?: ParentExecutionRef;
|
|
25
|
+
executionOptions?: RunExecutionOptions;
|
|
26
|
+
base: ReturnType<ExecutionContextFactory["create"]>;
|
|
27
|
+
data: ReturnType<RunDataFactory["create"]>;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type SingleDefinitionActivationRequest = NodeActivationContextArgs & {
|
|
31
|
+
definition: NodeExecutionDefinition;
|
|
32
|
+
batchId: string;
|
|
33
|
+
input: Items;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type PlannedNodeActivationRequest = NodeActivationContextArgs & {
|
|
37
|
+
next: PlannedActivation;
|
|
38
|
+
nodeDefinition: NodeExecutionDefinition;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Builds {@link NodeActivationRequest} values shared by workflow starters and continuation.
|
|
43
|
+
*/
|
|
44
|
+
export class NodeActivationRequestComposer {
|
|
45
|
+
constructor(
|
|
46
|
+
private readonly activationIdFactory: ActivationIdFactory,
|
|
47
|
+
private readonly credentialResolverFactory: CredentialResolverFactory,
|
|
48
|
+
) {}
|
|
49
|
+
|
|
50
|
+
createSingleFromDefinition(args: SingleDefinitionActivationRequest): NodeActivationRequest {
|
|
51
|
+
const activationId = this.activationIdFactory.makeActivationId();
|
|
52
|
+
const ctx = this.createNodeExecutionContext(args, args.definition, activationId);
|
|
53
|
+
return {
|
|
54
|
+
kind: "single",
|
|
55
|
+
runId: args.runId,
|
|
56
|
+
activationId,
|
|
57
|
+
workflowId: args.workflowId,
|
|
58
|
+
nodeId: args.definition.id,
|
|
59
|
+
parent: args.parent,
|
|
60
|
+
executionOptions: args.executionOptions,
|
|
61
|
+
batchId: args.batchId,
|
|
62
|
+
input: args.input,
|
|
63
|
+
ctx,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
createFromPlannedActivation(args: PlannedNodeActivationRequest): NodeActivationRequest {
|
|
68
|
+
const activationId = this.activationIdFactory.makeActivationId();
|
|
69
|
+
const ctx = this.createNodeExecutionContext(args, args.nodeDefinition, activationId);
|
|
70
|
+
if (args.next.kind === "multi") {
|
|
71
|
+
return {
|
|
72
|
+
kind: "multi",
|
|
73
|
+
runId: args.runId,
|
|
74
|
+
activationId,
|
|
75
|
+
workflowId: args.workflowId,
|
|
76
|
+
nodeId: args.nodeDefinition.id,
|
|
77
|
+
parent: args.parent,
|
|
78
|
+
executionOptions: args.executionOptions,
|
|
79
|
+
batchId: args.next.batchId,
|
|
80
|
+
inputsByPort: args.next.inputsByPort,
|
|
81
|
+
ctx,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
kind: "single",
|
|
86
|
+
runId: args.runId,
|
|
87
|
+
activationId,
|
|
88
|
+
workflowId: args.workflowId,
|
|
89
|
+
nodeId: args.nodeDefinition.id,
|
|
90
|
+
parent: args.parent,
|
|
91
|
+
executionOptions: args.executionOptions,
|
|
92
|
+
batchId: args.next.batchId,
|
|
93
|
+
input: args.next.input,
|
|
94
|
+
ctx,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private createNodeExecutionContext(
|
|
99
|
+
args: NodeActivationContextArgs,
|
|
100
|
+
definition: NodeExecutionDefinition,
|
|
101
|
+
activationId: string,
|
|
102
|
+
): NodeExecutionContext {
|
|
103
|
+
return {
|
|
104
|
+
...args.base,
|
|
105
|
+
data: args.data,
|
|
106
|
+
nodeId: definition.id,
|
|
107
|
+
activationId,
|
|
108
|
+
config: definition.config,
|
|
109
|
+
binary: args.base.binary.forNode({ nodeId: definition.id, activationId }),
|
|
110
|
+
getCredential: this.credentialResolverFactory.create(args.workflowId, definition.id, definition.config),
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
NodeActivationId,
|
|
3
|
+
NodeExecutionSnapshot,
|
|
4
|
+
NodeId,
|
|
5
|
+
NodeInputsByPort,
|
|
6
|
+
NodeOutputs,
|
|
7
|
+
ParentExecutionRef,
|
|
8
|
+
RunId,
|
|
9
|
+
WorkflowId,
|
|
10
|
+
} from "../types";
|
|
11
|
+
|
|
12
|
+
export class NodeExecutionSnapshotFactory {
|
|
13
|
+
static queued(args: {
|
|
14
|
+
runId: RunId;
|
|
15
|
+
workflowId: WorkflowId;
|
|
16
|
+
nodeId: NodeId;
|
|
17
|
+
activationId: NodeActivationId;
|
|
18
|
+
parent?: ParentExecutionRef;
|
|
19
|
+
queuedAt: string;
|
|
20
|
+
inputsByPort: NodeInputsByPort;
|
|
21
|
+
}): NodeExecutionSnapshot {
|
|
22
|
+
return {
|
|
23
|
+
runId: args.runId,
|
|
24
|
+
workflowId: args.workflowId,
|
|
25
|
+
nodeId: args.nodeId,
|
|
26
|
+
activationId: args.activationId,
|
|
27
|
+
parent: args.parent,
|
|
28
|
+
status: "queued",
|
|
29
|
+
queuedAt: args.queuedAt,
|
|
30
|
+
updatedAt: args.queuedAt,
|
|
31
|
+
inputsByPort: args.inputsByPort,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static running(args: {
|
|
36
|
+
previous?: NodeExecutionSnapshot;
|
|
37
|
+
runId: RunId;
|
|
38
|
+
workflowId: WorkflowId;
|
|
39
|
+
nodeId: NodeId;
|
|
40
|
+
activationId: NodeActivationId;
|
|
41
|
+
parent?: ParentExecutionRef;
|
|
42
|
+
startedAt: string;
|
|
43
|
+
inputsByPort: NodeInputsByPort;
|
|
44
|
+
}): NodeExecutionSnapshot {
|
|
45
|
+
return {
|
|
46
|
+
runId: args.runId,
|
|
47
|
+
workflowId: args.workflowId,
|
|
48
|
+
nodeId: args.nodeId,
|
|
49
|
+
activationId: args.activationId,
|
|
50
|
+
parent: args.parent,
|
|
51
|
+
status: "running",
|
|
52
|
+
queuedAt: args.previous?.queuedAt,
|
|
53
|
+
startedAt: args.startedAt,
|
|
54
|
+
updatedAt: args.startedAt,
|
|
55
|
+
inputsByPort: args.inputsByPort,
|
|
56
|
+
outputs: args.previous?.outputs,
|
|
57
|
+
error: undefined,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
static completed(args: {
|
|
62
|
+
previous?: NodeExecutionSnapshot;
|
|
63
|
+
runId: RunId;
|
|
64
|
+
workflowId: WorkflowId;
|
|
65
|
+
nodeId: NodeId;
|
|
66
|
+
activationId: NodeActivationId;
|
|
67
|
+
parent?: ParentExecutionRef;
|
|
68
|
+
finishedAt: string;
|
|
69
|
+
inputsByPort: NodeInputsByPort;
|
|
70
|
+
outputs: NodeOutputs;
|
|
71
|
+
fromPinnedOutput?: boolean;
|
|
72
|
+
}): NodeExecutionSnapshot {
|
|
73
|
+
const fromPinnedOutput = args.fromPinnedOutput ?? false;
|
|
74
|
+
const startedAt = fromPinnedOutput ? (args.previous?.startedAt ?? args.finishedAt) : args.previous?.startedAt;
|
|
75
|
+
return {
|
|
76
|
+
runId: args.runId,
|
|
77
|
+
workflowId: args.workflowId,
|
|
78
|
+
nodeId: args.nodeId,
|
|
79
|
+
activationId: args.activationId,
|
|
80
|
+
parent: args.parent,
|
|
81
|
+
status: "completed",
|
|
82
|
+
queuedAt: args.previous?.queuedAt,
|
|
83
|
+
startedAt,
|
|
84
|
+
finishedAt: args.finishedAt,
|
|
85
|
+
updatedAt: args.finishedAt,
|
|
86
|
+
inputsByPort: args.inputsByPort,
|
|
87
|
+
outputs: args.outputs,
|
|
88
|
+
usedPinnedOutput: fromPinnedOutput,
|
|
89
|
+
error: undefined,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
static skipped(args: {
|
|
94
|
+
previous?: NodeExecutionSnapshot;
|
|
95
|
+
runId: RunId;
|
|
96
|
+
workflowId: WorkflowId;
|
|
97
|
+
nodeId: NodeId;
|
|
98
|
+
activationId: NodeActivationId;
|
|
99
|
+
parent?: ParentExecutionRef;
|
|
100
|
+
finishedAt: string;
|
|
101
|
+
inputsByPort: NodeInputsByPort;
|
|
102
|
+
outputs: NodeOutputs;
|
|
103
|
+
}): NodeExecutionSnapshot {
|
|
104
|
+
return {
|
|
105
|
+
runId: args.runId,
|
|
106
|
+
workflowId: args.workflowId,
|
|
107
|
+
nodeId: args.nodeId,
|
|
108
|
+
activationId: args.activationId,
|
|
109
|
+
parent: args.parent,
|
|
110
|
+
status: "skipped",
|
|
111
|
+
queuedAt: args.previous?.queuedAt,
|
|
112
|
+
startedAt: args.previous?.startedAt,
|
|
113
|
+
finishedAt: args.finishedAt,
|
|
114
|
+
updatedAt: args.finishedAt,
|
|
115
|
+
inputsByPort: args.inputsByPort,
|
|
116
|
+
outputs: args.outputs,
|
|
117
|
+
error: undefined,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
static failed(args: {
|
|
122
|
+
previous?: NodeExecutionSnapshot;
|
|
123
|
+
runId: RunId;
|
|
124
|
+
workflowId: WorkflowId;
|
|
125
|
+
nodeId: NodeId;
|
|
126
|
+
activationId: NodeActivationId;
|
|
127
|
+
parent?: ParentExecutionRef;
|
|
128
|
+
finishedAt: string;
|
|
129
|
+
inputsByPort: NodeInputsByPort;
|
|
130
|
+
error: Error;
|
|
131
|
+
}): NodeExecutionSnapshot {
|
|
132
|
+
return {
|
|
133
|
+
runId: args.runId,
|
|
134
|
+
workflowId: args.workflowId,
|
|
135
|
+
nodeId: args.nodeId,
|
|
136
|
+
activationId: args.activationId,
|
|
137
|
+
parent: args.parent,
|
|
138
|
+
status: "failed",
|
|
139
|
+
queuedAt: args.previous?.queuedAt,
|
|
140
|
+
startedAt: args.previous?.startedAt,
|
|
141
|
+
finishedAt: args.finishedAt,
|
|
142
|
+
updatedAt: args.finishedAt,
|
|
143
|
+
inputsByPort: args.inputsByPort,
|
|
144
|
+
outputs: undefined,
|
|
145
|
+
error: {
|
|
146
|
+
message: args.error.message,
|
|
147
|
+
name: args.error.name,
|
|
148
|
+
stack: args.error.stack,
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { MultiInputNode, Node, NodeActivationRequest, NodeOutputs, WorkflowNodeInstanceFactory } from "../types";
|
|
2
|
+
|
|
3
|
+
import { InProcessRetryRunner } from "./InProcessRetryRunner";
|
|
4
|
+
|
|
5
|
+
export class NodeExecutor {
|
|
6
|
+
constructor(
|
|
7
|
+
private readonly nodeInstanceFactory: WorkflowNodeInstanceFactory,
|
|
8
|
+
private readonly retryRunner: InProcessRetryRunner,
|
|
9
|
+
) {}
|
|
10
|
+
|
|
11
|
+
async execute(request: NodeActivationRequest): Promise<NodeOutputs> {
|
|
12
|
+
const policy = request.ctx.config.retryPolicy;
|
|
13
|
+
return await this.retryRunner.run(policy, async () => {
|
|
14
|
+
const nodeInstance = this.nodeInstanceFactory.createByType(request.ctx.config.type);
|
|
15
|
+
if (request.kind === "multi") {
|
|
16
|
+
return await this.executeMultiInputNode(request, nodeInstance);
|
|
17
|
+
}
|
|
18
|
+
return await this.executeSingleInputNode(request, nodeInstance);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
private async executeMultiInputNode(
|
|
23
|
+
request: Extract<NodeActivationRequest, { kind: "multi" }>,
|
|
24
|
+
node: unknown,
|
|
25
|
+
): Promise<NodeOutputs> {
|
|
26
|
+
const multiInputNode = node as MultiInputNode;
|
|
27
|
+
if (typeof (multiInputNode as { executeMulti?: unknown }).executeMulti !== "function") {
|
|
28
|
+
throw new Error(`Node ${request.nodeId} does not support executeMulti but received multi-input activation`);
|
|
29
|
+
}
|
|
30
|
+
return await multiInputNode.executeMulti(request.inputsByPort, request.ctx as any);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
private async executeSingleInputNode(
|
|
34
|
+
request: Extract<NodeActivationRequest, { kind: "single" }>,
|
|
35
|
+
node: unknown,
|
|
36
|
+
): Promise<NodeOutputs> {
|
|
37
|
+
const singleInputNode = node as Node;
|
|
38
|
+
if (typeof (singleInputNode as { execute?: unknown }).execute !== "function") {
|
|
39
|
+
throw new Error(`Node ${request.nodeId} does not support execute but received single-input activation`);
|
|
40
|
+
}
|
|
41
|
+
return await singleInputNode.execute(request.input, request.ctx as any);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { WorkflowNodeInstanceFactory } from "../types";
|
|
2
|
+
|
|
3
|
+
import { InProcessRetryRunner } from "./InProcessRetryRunner";
|
|
4
|
+
import { NodeExecutor } from "./NodeExecutor";
|
|
5
|
+
|
|
6
|
+
export class NodeExecutorFactory {
|
|
7
|
+
create(workflowNodeInstanceFactory: WorkflowNodeInstanceFactory, retryRunner: InProcessRetryRunner): NodeExecutor {
|
|
8
|
+
return new NodeExecutor(workflowNodeInstanceFactory, retryRunner);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { NodeActivationRequest, NodeInputsByPort } from "../types";
|
|
2
|
+
|
|
3
|
+
export class NodeInputsByPortFactory {
|
|
4
|
+
static empty(): NodeInputsByPort {
|
|
5
|
+
return {};
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
static fromRequest(request: NodeActivationRequest): NodeInputsByPort {
|
|
9
|
+
if (request.kind === "multi") {
|
|
10
|
+
return request.inputsByPort;
|
|
11
|
+
}
|
|
12
|
+
return { in: request.input };
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { TypeToken } from "../di";
|
|
2
|
+
import type { NodeId, NodeResolver, WorkflowDefinition, WorkflowNodeInstanceFactory } from "../types";
|
|
3
|
+
|
|
4
|
+
import { MissingRuntimeNode, MissingRuntimeTrigger } from "../workflowSnapshots";
|
|
5
|
+
import { MissingRuntimeNodeToken } from "../workflowSnapshots/MissingRuntimeNodeToken";
|
|
6
|
+
import { MissingRuntimeTriggerToken } from "../workflowSnapshots/MissingRuntimeTriggerToken";
|
|
7
|
+
|
|
8
|
+
export class NodeInstanceFactory implements WorkflowNodeInstanceFactory {
|
|
9
|
+
constructor(private readonly nodeResolver: NodeResolver) {}
|
|
10
|
+
|
|
11
|
+
createNodes(workflow: WorkflowDefinition): Map<NodeId, unknown> {
|
|
12
|
+
const nodeInstances = new Map<NodeId, unknown>();
|
|
13
|
+
for (const definition of workflow.nodes) {
|
|
14
|
+
nodeInstances.set(definition.id, this.createNode(definition));
|
|
15
|
+
}
|
|
16
|
+
return nodeInstances;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
createNode(definition: WorkflowDefinition["nodes"][number]): unknown {
|
|
20
|
+
return this.createByType(definition.type);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
createByType(type: TypeToken<unknown>): unknown {
|
|
24
|
+
if (type === MissingRuntimeNodeToken) {
|
|
25
|
+
return new MissingRuntimeNode();
|
|
26
|
+
}
|
|
27
|
+
if (type === MissingRuntimeTriggerToken) {
|
|
28
|
+
return new MissingRuntimeTrigger();
|
|
29
|
+
}
|
|
30
|
+
return this.nodeResolver.resolve(type);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NodeResolver } from "../types";
|
|
2
|
+
|
|
3
|
+
import { NodeInstanceFactory } from "./NodeInstanceFactory";
|
|
4
|
+
|
|
5
|
+
export class NodeInstanceFactoryFactory {
|
|
6
|
+
create(nodeResolver: NodeResolver): NodeInstanceFactory {
|
|
7
|
+
return new NodeInstanceFactory(nodeResolver);
|
|
8
|
+
}
|
|
9
|
+
}
|