@oomol-lab/open-flow 0.1.0-beta.73 → 0.1.0-beta.75
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/LICENSE +36 -0
- package/NOTICE +7 -0
- package/README.md +41 -0
- package/dist/browser/{ContentIcon-CUQHjQIw.js → ContentIcon-FCpKiwjp.js} +2 -1
- package/dist/browser/{FlowCanvas-Dtf8_cQp.js → FlowCanvas-dzRBnlUT.js} +1 -1
- package/dist/browser/{createResourceDialog-BWJkjiOO.js → createResourceDialog-BeYDdUl-.js} +2 -2
- package/dist/browser/{dialog-CUy_fwx9.js → dialog-ZtpsFbl4.js} +337 -31
- package/dist/browser/{exportSvg-BOoy7-Db.js → exportSvg-DqXw1yf-.js} +2 -2
- package/dist/browser/{flowChanges-CgSnSqqP.js → flowChanges-b_5UobFj.js} +586 -87
- package/dist/browser/{flowWorkspace-Bf7H-r0t.js → flowWorkspace-ItojZbO4.js} +21162 -20242
- package/dist/browser/preview.css +254 -179
- package/dist/browser/preview.js +22201 -20625
- package/dist/browser/{typeScriptSession-B0hC-C8y.js → typeScriptSession-CSRwWmZm.js} +1 -1
- package/dist/browser/ui.css +72 -2
- package/dist/browser/workbench.css +254 -179
- package/dist/browser/workbench.js +22 -78
- package/dist/browser/{workbenchSelect-C3e4J93X.js → workbenchSelect-M441Lz0d.js} +1 -1
- package/dist/command/index.js +42 -42
- package/dist/common/authoring.d.ts +5 -5
- package/dist/common/authoringExamples.d.ts +3 -2
- package/dist/common/authoringFields.d.ts +1 -1
- package/dist/common/authoringSchema.d.ts +95 -8
- package/dist/common/connector-proxy.d.ts +1 -1
- package/dist/common/control-api-conformance.d.ts +1 -1
- package/dist/common/control-api-conformance.js +119 -31
- package/dist/common/control-api.d.ts +4 -3
- package/dist/common/control-api.js +117 -29
- package/dist/common/control-requests.d.ts +5 -4
- package/dist/common/control-requests.js +437 -103
- package/dist/common/cron-trigger.d.ts +1 -1
- package/dist/common/decision.d.ts +1 -1
- package/dist/common/draftOperations.d.ts +1 -1
- package/dist/common/engine-contract.d.ts +4 -2
- package/dist/common/event-source-definition.d.ts +1 -1
- package/dist/common/flow-agent.d.ts +1 -1
- package/dist/{browser → common}/flow-authoring-node.d.ts +3 -3
- package/dist/{browser → common}/flow-authoring.js +131 -30
- package/dist/{browser → common}/flow-change-schema.d.ts +177 -6
- package/dist/{browser → common}/flow-change.d.ts +35 -15
- package/dist/{browser → common}/flow-change.js +133 -32
- package/dist/common/flow-connectionUsage.d.ts +1 -1
- package/dist/common/flow-encoding.d.ts +1 -1
- package/dist/common/flow-encoding.js +89 -23
- package/dist/common/flow-errorHandling.d.ts +1 -1
- package/dist/common/flow-graph.d.ts +3 -2
- package/dist/common/flow-modules.d.ts +1 -1
- package/dist/common/flow-promptTemplate.d.ts +1 -1
- package/dist/common/flow-retry.d.ts +2 -2
- package/dist/common/flow-semantics.d.ts +1 -1
- package/dist/common/flow-semantics.js +966 -614
- package/dist/common/flow-workflowFile.d.ts +1 -1
- package/dist/common/flowInspection.d.ts +3 -3
- package/dist/common/http-request.d.ts +156 -0
- package/dist/common/http-request.js +5254 -0
- package/dist/common/integration-trigger.d.ts +1 -1
- package/dist/common/licenses.md +118 -1
- package/dist/common/liveDetails.d.ts +1 -1
- package/dist/common/mcp.d.ts +5 -4
- package/dist/common/mcp.js +117 -29
- package/dist/common/openapi.d.ts +1 -1
- package/dist/common/poll-trigger.d.ts +1 -1
- package/dist/common/run-events.js +11 -9
- package/dist/common/run-results.d.ts +8 -1
- package/dist/common/runtime-contract.d.ts +8 -2
- package/dist/common/runtime-contract.js +25 -5
- package/dist/common/scheduler-checkpoint.d.ts +1 -1
- package/dist/common/scheduler-dependencies.d.ts +1 -1
- package/dist/common/scheduler-node-execution.d.ts +1 -1
- package/dist/common/scheduler.d.ts +3 -3
- package/dist/common/scheduler.js +101 -33
- package/dist/common/trigger-catalog.d.ts +1 -1
- package/dist/common/trigger-config-options.d.ts +1 -1
- package/dist/common/trigger-config.d.ts +1 -1
- package/dist/common/trigger-contract.d.ts +2 -2
- package/dist/common/trigger-localization.d.ts +1 -1
- package/dist/common/webhook-response.d.ts +1 -3
- package/dist/common/webhook-trigger.d.ts +1 -1
- package/dist/common/webhook-trigger.js +12 -11
- package/dist/common/workflow.d.ts +17 -1
- package/dist/common/workflow.js +68 -22
- package/dist/index.d.ts +6 -3
- package/package.json +11 -6
- package/skills/open-flow/references/flow-authoring.md +1 -0
- package/skills/open-flow/references/flow-n8n-conversion.md +19 -15
- package/src/base/common/json.ts +90 -0
- package/src/canvas/common/commands.ts +15 -0
- package/src/connector/common/actionSchema.ts +168 -0
- package/src/connector/common/proxy.ts +44 -0
- package/src/control/common/api.ts +1506 -0
- package/src/control/common/authoring.ts +923 -0
- package/src/control/common/authoringCondition.ts +110 -0
- package/src/control/common/authoringDiagnosticFields.ts +136 -0
- package/src/control/common/authoringExamples.ts +200 -0
- package/src/control/common/authoringFields.ts +53 -0
- package/src/control/common/authoringLlm.ts +70 -0
- package/src/control/common/authoringOpenApi.ts +129 -0
- package/src/control/common/authoringSchema.ts +410 -0
- package/src/control/common/authoringTools.ts +123 -0
- package/src/control/common/authoringTriggers.ts +26 -0
- package/src/control/common/checkDecoders.ts +65 -0
- package/src/control/common/conformance.ts +1989 -0
- package/src/control/common/connectorDecoders.ts +370 -0
- package/src/control/common/connectorQueries.ts +61 -0
- package/src/control/common/decoding.ts +60 -0
- package/src/control/common/draftOperations.ts +61 -0
- package/src/control/common/errors.ts +114 -0
- package/src/control/common/eventSourceSchemas.ts +13 -0
- package/src/control/common/eventSources.ts +186 -0
- package/src/control/common/flowDecoders.ts +153 -0
- package/src/control/common/flowInspection.ts +181 -0
- package/src/control/common/flowNotifications.ts +37 -0
- package/src/control/common/liveDetails.ts +124 -0
- package/src/control/common/mcp.ts +241 -0
- package/src/control/common/mcpConformance.ts +142 -0
- package/src/control/common/providerAccess.ts +28 -0
- package/src/control/common/providerIconSprite.ts +42 -0
- package/src/control/common/publicationDecoders.ts +98 -0
- package/src/control/common/random.ts +16 -0
- package/src/control/common/requests.ts +112 -0
- package/src/control/common/resultQuery.ts +8 -0
- package/src/control/common/results.ts +176 -0
- package/src/control/common/revisionDecoders.ts +52 -0
- package/src/control/common/runDecoders.ts +240 -0
- package/src/control/common/triggerCatalog.ts +89 -0
- package/src/control/common/triggerDecoders.ts +175 -0
- package/src/decision/common/decision.ts +168 -0
- package/src/event-source/common/catalog.generated.json +65 -0
- package/src/event-source/common/definition.ts +66 -0
- package/src/event-source/common/index.ts +99 -0
- package/src/execution/common/checkpoint.ts +311 -0
- package/src/execution/common/dependencies.ts +440 -0
- package/src/execution/common/engineContract.ts +84 -0
- package/src/execution/common/events.ts +331 -0
- package/src/execution/common/node-execution.ts +469 -0
- package/src/execution/common/runLifecycle.ts +250 -0
- package/src/execution/common/runtime.ts +563 -0
- package/src/execution/common/scheduler.ts +697 -0
- package/src/execution/common/wait.ts +36 -0
- package/src/flow/common/agent.ts +305 -0
- package/src/flow/common/authoring.ts +30 -0
- package/src/flow/common/change.ts +1037 -0
- package/src/flow/common/changeSchema.ts +792 -0
- package/src/flow/common/codePermissions.ts +2 -0
- package/src/flow/common/condition.ts +265 -0
- package/src/flow/common/connectionUsage.ts +131 -0
- package/src/flow/common/edgeChanges.ts +35 -0
- package/src/flow/common/encoding.ts +437 -0
- package/src/flow/common/errorHandling.ts +34 -0
- package/src/flow/common/graph.ts +898 -0
- package/src/flow/common/inputValue.ts +16 -0
- package/src/flow/common/json.ts +8 -0
- package/src/flow/common/moduleChanges.ts +31 -0
- package/src/flow/common/modules.ts +292 -0
- package/src/flow/common/nodeChanges.ts +762 -0
- package/src/flow/common/portChanges.ts +36 -0
- package/src/flow/common/promptTemplate.ts +15 -0
- package/src/flow/common/retry.ts +20 -0
- package/src/flow/common/schema.ts +162 -0
- package/src/flow/common/schemaCompare.ts +176 -0
- package/src/flow/common/schemaComparer.ts +178 -0
- package/src/flow/common/schemaKeywords.ts +53 -0
- package/src/flow/common/semantics.ts +531 -0
- package/src/flow/common/sourceField.ts +35 -0
- package/src/flow/common/triggerScheduleSchema.ts +8 -0
- package/src/flow/common/wait.ts +30 -0
- package/src/flow/common/webhookMethod.ts +7 -0
- package/src/flow/common/webhookResponse.ts +71 -0
- package/src/flow/common/workflowFile.ts +97 -0
- package/src/http/common/authBindings.ts +12 -0
- package/src/http/common/headers.ts +5 -0
- package/src/http/common/httpRequest.ts +251 -0
- package/src/json-schema-subset/checker/array.ts +142 -0
- package/src/json-schema-subset/checker/cache.ts +57 -0
- package/src/json-schema-subset/checker/checker.ts +230 -0
- package/src/json-schema-subset/checker/enumAndConst.ts +113 -0
- package/src/json-schema-subset/checker/equals.ts +93 -0
- package/src/json-schema-subset/checker/numeric/checker.ts +50 -0
- package/src/json-schema-subset/checker/numeric/float.ts +121 -0
- package/src/json-schema-subset/checker/numeric/index.ts +1 -0
- package/src/json-schema-subset/checker/numeric/integer.ts +119 -0
- package/src/json-schema-subset/checker/numeric/integerNormalizer.ts +72 -0
- package/src/json-schema-subset/checker/object.ts +354 -0
- package/src/json-schema-subset/checker/range.ts +91 -0
- package/src/json-schema-subset/checker/string.ts +60 -0
- package/src/json-schema-subset/checker/tools/index.ts +3 -0
- package/src/json-schema-subset/checker/tools/mark.ts +82 -0
- package/src/json-schema-subset/checker/tools/quantum.ts +106 -0
- package/src/json-schema-subset/checker/tools/range.ts +210 -0
- package/src/json-schema-subset/checker/validator.ts +23 -0
- package/src/json-schema-subset/compiler/array.ts +163 -0
- package/src/json-schema-subset/compiler/combination.ts +109 -0
- package/src/json-schema-subset/compiler/common.ts +99 -0
- package/src/json-schema-subset/compiler/compiler.ts +188 -0
- package/src/json-schema-subset/compiler/enumAndConst.ts +75 -0
- package/src/json-schema-subset/compiler/index.ts +11 -0
- package/src/json-schema-subset/compiler/object.ts +411 -0
- package/src/json-schema-subset/compiler/primitive.ts +144 -0
- package/src/json-schema-subset/compiler/utils.ts +24 -0
- package/src/json-schema-subset/compiler/wrapper.ts +192 -0
- package/src/json-schema-subset/error.ts +55 -0
- package/src/json-schema-subset/expression/calculator.ts +442 -0
- package/src/json-schema-subset/expression/combination.ts +49 -0
- package/src/json-schema-subset/expression/expression.ts +191 -0
- package/src/json-schema-subset/expression/index.ts +25 -0
- package/src/json-schema-subset/expression/result.ts +88 -0
- package/src/json-schema-subset/expression/types.ts +36 -0
- package/src/json-schema-subset/extends/extendsContext.ts +89 -0
- package/src/json-schema-subset/extends/index.ts +2 -0
- package/src/json-schema-subset/extends/types.ts +12 -0
- package/src/json-schema-subset/global.ts +60 -0
- package/src/json-schema-subset/index.ts +8 -0
- package/src/json-schema-subset/preprocessing.ts +74 -0
- package/src/json-schema-subset/types.ts +8 -0
- package/src/json-schema-subset/utils.ts +95 -0
- package/src/localization/common/languages.ts +118 -0
- package/src/localization/common/timeZone.ts +25 -0
- package/src/openapi/common/openapi.ts +459 -0
- package/src/trigger/common/config.ts +56 -0
- package/src/trigger/common/configOptions.ts +15 -0
- package/src/trigger/common/configSchema.ts +8 -0
- package/src/trigger/common/contract.ts +132 -0
- package/src/trigger/common/cron.ts +151 -0
- package/src/trigger/common/integration.ts +498 -0
- package/src/trigger/common/poll.ts +187 -0
- package/src/trigger/common/webhook.ts +413 -0
- package/src/trigger/providers/airtable/locales/fr.json +18 -0
- package/src/trigger/providers/airtable/locales/ja.json +18 -0
- package/src/trigger/providers/airtable/locales/ko.json +18 -0
- package/src/trigger/providers/airtable/locales/ru.json +18 -0
- package/src/trigger/providers/airtable/locales/zh-CN.json +18 -0
- package/src/trigger/providers/airtable/locales/zh-TW.json +18 -0
- package/src/trigger/providers/asana/locales/fr.json +15 -0
- package/src/trigger/providers/asana/locales/ja.json +15 -0
- package/src/trigger/providers/asana/locales/ko.json +15 -0
- package/src/trigger/providers/asana/locales/ru.json +15 -0
- package/src/trigger/providers/asana/locales/zh-CN.json +15 -0
- package/src/trigger/providers/asana/locales/zh-TW.json +15 -0
- package/src/trigger/providers/calendly/locales/fr.json +16 -0
- package/src/trigger/providers/calendly/locales/ja.json +16 -0
- package/src/trigger/providers/calendly/locales/ko.json +16 -0
- package/src/trigger/providers/calendly/locales/ru.json +16 -0
- package/src/trigger/providers/calendly/locales/zh-CN.json +16 -0
- package/src/trigger/providers/calendly/locales/zh-TW.json +16 -0
- package/src/trigger/providers/catalog.generated.json +4996 -0
- package/src/trigger/providers/clickup/locales/fr.json +16 -0
- package/src/trigger/providers/clickup/locales/ja.json +16 -0
- package/src/trigger/providers/clickup/locales/ko.json +16 -0
- package/src/trigger/providers/clickup/locales/ru.json +16 -0
- package/src/trigger/providers/clickup/locales/zh-CN.json +16 -0
- package/src/trigger/providers/clickup/locales/zh-TW.json +16 -0
- package/src/trigger/providers/definitions.ts +19 -0
- package/src/trigger/providers/feishu/locales/fr.json +20 -0
- package/src/trigger/providers/feishu/locales/ja.json +20 -0
- package/src/trigger/providers/feishu/locales/ko.json +20 -0
- package/src/trigger/providers/feishu/locales/ru.json +20 -0
- package/src/trigger/providers/feishu/locales/zh-CN.json +20 -0
- package/src/trigger/providers/feishu/locales/zh-TW.json +20 -0
- package/src/trigger/providers/fieldDescriptions.ts +392 -0
- package/src/trigger/providers/fieldLabels.ts +256 -0
- package/src/trigger/providers/fireflies/locales/fr.json +17 -0
- package/src/trigger/providers/fireflies/locales/ja.json +17 -0
- package/src/trigger/providers/fireflies/locales/ko.json +17 -0
- package/src/trigger/providers/fireflies/locales/ru.json +17 -0
- package/src/trigger/providers/fireflies/locales/zh-CN.json +17 -0
- package/src/trigger/providers/fireflies/locales/zh-TW.json +17 -0
- package/src/trigger/providers/github/locales/fr.json +30 -0
- package/src/trigger/providers/github/locales/ja.json +30 -0
- package/src/trigger/providers/github/locales/ko.json +30 -0
- package/src/trigger/providers/github/locales/ru.json +30 -0
- package/src/trigger/providers/github/locales/zh-CN.json +30 -0
- package/src/trigger/providers/github/locales/zh-TW.json +30 -0
- package/src/trigger/providers/gitlab/locales/fr.json +18 -0
- package/src/trigger/providers/gitlab/locales/ja.json +18 -0
- package/src/trigger/providers/gitlab/locales/ko.json +18 -0
- package/src/trigger/providers/gitlab/locales/ru.json +18 -0
- package/src/trigger/providers/gitlab/locales/zh-CN.json +18 -0
- package/src/trigger/providers/gitlab/locales/zh-TW.json +18 -0
- package/src/trigger/providers/gmail/locales/fr.json +18 -0
- package/src/trigger/providers/gmail/locales/ja.json +18 -0
- package/src/trigger/providers/gmail/locales/ko.json +18 -0
- package/src/trigger/providers/gmail/locales/ru.json +18 -0
- package/src/trigger/providers/gmail/locales/zh-CN.json +18 -0
- package/src/trigger/providers/gmail/locales/zh-TW.json +18 -0
- package/src/trigger/providers/google-calendar/locales/fr.json +15 -0
- package/src/trigger/providers/google-calendar/locales/ja.json +15 -0
- package/src/trigger/providers/google-calendar/locales/ko.json +15 -0
- package/src/trigger/providers/google-calendar/locales/ru.json +15 -0
- package/src/trigger/providers/google-calendar/locales/zh-CN.json +15 -0
- package/src/trigger/providers/google-calendar/locales/zh-TW.json +15 -0
- package/src/trigger/providers/google-drive/locales/fr.json +48 -0
- package/src/trigger/providers/google-drive/locales/ja.json +48 -0
- package/src/trigger/providers/google-drive/locales/ko.json +48 -0
- package/src/trigger/providers/google-drive/locales/ru.json +48 -0
- package/src/trigger/providers/google-drive/locales/zh-CN.json +48 -0
- package/src/trigger/providers/google-drive/locales/zh-TW.json +48 -0
- package/src/trigger/providers/google-sheets/locales/fr.json +19 -0
- package/src/trigger/providers/google-sheets/locales/ja.json +19 -0
- package/src/trigger/providers/google-sheets/locales/ko.json +19 -0
- package/src/trigger/providers/google-sheets/locales/ru.json +19 -0
- package/src/trigger/providers/google-sheets/locales/zh-CN.json +19 -0
- package/src/trigger/providers/google-sheets/locales/zh-TW.json +19 -0
- package/src/trigger/providers/intercom/locales/fr.json +17 -0
- package/src/trigger/providers/intercom/locales/ja.json +17 -0
- package/src/trigger/providers/intercom/locales/ko.json +17 -0
- package/src/trigger/providers/intercom/locales/ru.json +17 -0
- package/src/trigger/providers/intercom/locales/zh-CN.json +17 -0
- package/src/trigger/providers/intercom/locales/zh-TW.json +17 -0
- package/src/trigger/providers/jira/locales/fr.json +17 -0
- package/src/trigger/providers/jira/locales/ja.json +17 -0
- package/src/trigger/providers/jira/locales/ko.json +17 -0
- package/src/trigger/providers/jira/locales/ru.json +17 -0
- package/src/trigger/providers/jira/locales/zh-CN.json +17 -0
- package/src/trigger/providers/jira/locales/zh-TW.json +17 -0
- package/src/trigger/providers/linear/locales/fr.json +13 -0
- package/src/trigger/providers/linear/locales/ja.json +13 -0
- package/src/trigger/providers/linear/locales/ko.json +13 -0
- package/src/trigger/providers/linear/locales/ru.json +13 -0
- package/src/trigger/providers/linear/locales/zh-CN.json +13 -0
- package/src/trigger/providers/linear/locales/zh-TW.json +13 -0
- package/src/trigger/providers/locales/fr.ts +71 -0
- package/src/trigger/providers/locales/ja.ts +71 -0
- package/src/trigger/providers/locales/ko.ts +71 -0
- package/src/trigger/providers/locales/ru.ts +71 -0
- package/src/trigger/providers/locales/zh-CN.ts +71 -0
- package/src/trigger/providers/locales/zh-TW.ts +71 -0
- package/src/trigger/providers/localization.ts +59 -0
- package/src/trigger/providers/notion/locales/fr.json +16 -0
- package/src/trigger/providers/notion/locales/ja.json +16 -0
- package/src/trigger/providers/notion/locales/ko.json +16 -0
- package/src/trigger/providers/notion/locales/ru.json +16 -0
- package/src/trigger/providers/notion/locales/zh-CN.json +16 -0
- package/src/trigger/providers/notion/locales/zh-TW.json +16 -0
- package/src/trigger/providers/one-drive/locales/fr.json +16 -0
- package/src/trigger/providers/one-drive/locales/ja.json +16 -0
- package/src/trigger/providers/one-drive/locales/ko.json +16 -0
- package/src/trigger/providers/one-drive/locales/ru.json +16 -0
- package/src/trigger/providers/one-drive/locales/zh-CN.json +16 -0
- package/src/trigger/providers/one-drive/locales/zh-TW.json +16 -0
- package/src/trigger/providers/outlook/locales/fr.json +18 -0
- package/src/trigger/providers/outlook/locales/ja.json +18 -0
- package/src/trigger/providers/outlook/locales/ko.json +18 -0
- package/src/trigger/providers/outlook/locales/ru.json +18 -0
- package/src/trigger/providers/outlook/locales/zh-CN.json +18 -0
- package/src/trigger/providers/outlook/locales/zh-TW.json +18 -0
- package/src/trigger/providers/pandadoc/locales/fr.json +12 -0
- package/src/trigger/providers/pandadoc/locales/ja.json +12 -0
- package/src/trigger/providers/pandadoc/locales/ko.json +12 -0
- package/src/trigger/providers/pandadoc/locales/ru.json +12 -0
- package/src/trigger/providers/pandadoc/locales/zh-CN.json +12 -0
- package/src/trigger/providers/pandadoc/locales/zh-TW.json +12 -0
- package/src/trigger/providers/pipedrive/locales/fr.json +15 -0
- package/src/trigger/providers/pipedrive/locales/ja.json +15 -0
- package/src/trigger/providers/pipedrive/locales/ko.json +15 -0
- package/src/trigger/providers/pipedrive/locales/ru.json +15 -0
- package/src/trigger/providers/pipedrive/locales/zh-CN.json +15 -0
- package/src/trigger/providers/pipedrive/locales/zh-TW.json +15 -0
- package/src/trigger/providers/remote.ts +163 -0
- package/src/trigger/providers/resend/locales/fr.json +16 -0
- package/src/trigger/providers/resend/locales/ja.json +16 -0
- package/src/trigger/providers/resend/locales/ko.json +16 -0
- package/src/trigger/providers/resend/locales/ru.json +16 -0
- package/src/trigger/providers/resend/locales/zh-CN.json +16 -0
- package/src/trigger/providers/resend/locales/zh-TW.json +16 -0
- package/src/trigger/providers/sentry/locales/fr.json +19 -0
- package/src/trigger/providers/sentry/locales/ja.json +19 -0
- package/src/trigger/providers/sentry/locales/ko.json +19 -0
- package/src/trigger/providers/sentry/locales/ru.json +19 -0
- package/src/trigger/providers/sentry/locales/zh-CN.json +19 -0
- package/src/trigger/providers/sentry/locales/zh-TW.json +19 -0
- package/src/trigger/providers/shopify/locales/fr.json +18 -0
- package/src/trigger/providers/shopify/locales/ja.json +18 -0
- package/src/trigger/providers/shopify/locales/ko.json +18 -0
- package/src/trigger/providers/shopify/locales/ru.json +18 -0
- package/src/trigger/providers/shopify/locales/zh-CN.json +18 -0
- package/src/trigger/providers/shopify/locales/zh-TW.json +18 -0
- package/src/trigger/providers/slack/locales/fr.json +18 -0
- package/src/trigger/providers/slack/locales/ja.json +18 -0
- package/src/trigger/providers/slack/locales/ko.json +18 -0
- package/src/trigger/providers/slack/locales/ru.json +18 -0
- package/src/trigger/providers/slack/locales/zh-CN.json +18 -0
- package/src/trigger/providers/slack/locales/zh-TW.json +18 -0
- package/src/trigger/providers/slackbot/locales/fr.json +23 -0
- package/src/trigger/providers/slackbot/locales/ja.json +23 -0
- package/src/trigger/providers/slackbot/locales/ko.json +23 -0
- package/src/trigger/providers/slackbot/locales/ru.json +23 -0
- package/src/trigger/providers/slackbot/locales/zh-CN.json +23 -0
- package/src/trigger/providers/slackbot/locales/zh-TW.json +23 -0
- package/src/trigger/providers/source-events.ts +25 -0
- package/src/trigger/providers/stripe/locales/fr.json +17 -0
- package/src/trigger/providers/stripe/locales/ja.json +17 -0
- package/src/trigger/providers/stripe/locales/ko.json +17 -0
- package/src/trigger/providers/stripe/locales/ru.json +17 -0
- package/src/trigger/providers/stripe/locales/zh-CN.json +17 -0
- package/src/trigger/providers/stripe/locales/zh-TW.json +17 -0
- package/src/trigger/providers/tally/locales/fr.json +12 -0
- package/src/trigger/providers/tally/locales/ja.json +12 -0
- package/src/trigger/providers/tally/locales/ko.json +12 -0
- package/src/trigger/providers/tally/locales/ru.json +12 -0
- package/src/trigger/providers/tally/locales/zh-CN.json +12 -0
- package/src/trigger/providers/tally/locales/zh-TW.json +12 -0
- package/src/trigger/providers/telegram/locales/fr.json +17 -0
- package/src/trigger/providers/telegram/locales/ja.json +17 -0
- package/src/trigger/providers/telegram/locales/ko.json +17 -0
- package/src/trigger/providers/telegram/locales/ru.json +17 -0
- package/src/trigger/providers/telegram/locales/zh-CN.json +17 -0
- package/src/trigger/providers/telegram/locales/zh-TW.json +17 -0
- package/src/trigger/providers/typeform/locales/fr.json +12 -0
- package/src/trigger/providers/typeform/locales/ja.json +12 -0
- package/src/trigger/providers/typeform/locales/ko.json +12 -0
- package/src/trigger/providers/typeform/locales/ru.json +12 -0
- package/src/trigger/providers/typeform/locales/zh-CN.json +12 -0
- package/src/trigger/providers/typeform/locales/zh-TW.json +12 -0
- package/src/trigger/providers/vercel/locales/fr.json +18 -0
- package/src/trigger/providers/vercel/locales/ja.json +18 -0
- package/src/trigger/providers/vercel/locales/ko.json +18 -0
- package/src/trigger/providers/vercel/locales/ru.json +18 -0
- package/src/trigger/providers/vercel/locales/zh-CN.json +18 -0
- package/src/trigger/providers/vercel/locales/zh-TW.json +18 -0
- package/src/trigger/providers/woocommerce/locales/fr.json +19 -0
- package/src/trigger/providers/woocommerce/locales/ja.json +19 -0
- package/src/trigger/providers/woocommerce/locales/ko.json +19 -0
- package/src/trigger/providers/woocommerce/locales/ru.json +19 -0
- package/src/trigger/providers/woocommerce/locales/zh-CN.json +19 -0
- package/src/trigger/providers/woocommerce/locales/zh-TW.json +19 -0
- package/src/trigger/providers/zendesk/locales/fr.json +15 -0
- package/src/trigger/providers/zendesk/locales/ja.json +15 -0
- package/src/trigger/providers/zendesk/locales/ko.json +15 -0
- package/src/trigger/providers/zendesk/locales/ru.json +15 -0
- package/src/trigger/providers/zendesk/locales/zh-CN.json +15 -0
- package/src/trigger/providers/zendesk/locales/zh-TW.json +15 -0
- package/src/trigger/providers/zoom/locales/fr.json +17 -0
- package/src/trigger/providers/zoom/locales/ja.json +17 -0
- package/src/trigger/providers/zoom/locales/ko.json +17 -0
- package/src/trigger/providers/zoom/locales/ru.json +17 -0
- package/src/trigger/providers/zoom/locales/zh-CN.json +17 -0
- package/src/trigger/providers/zoom/locales/zh-TW.json +17 -0
- package/src/types/index.ts +112 -0
- package/src/workflow/common/workflow.ts +273 -0
- package/dist/browser/lib-DrKav3HG.js +0 -11403
- /package/dist/{browser → common}/flow-authoring-edge.d.ts +0 -0
- /package/dist/{browser → common}/flow-authoring-module.d.ts +0 -0
- /package/dist/{browser → common}/flow-authoring.d.ts +0 -0
- /package/dist/{browser → common}/flow-input-value.d.ts +0 -0
- /package/dist/{browser → common}/webhook-method.d.ts +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CreateEventSource, UpdateEventSource } from './eventSources.ts'
|
|
2
|
+
|
|
3
|
+
import { z } from 'zod'
|
|
4
|
+
import catalog from '../../trigger/providers/catalog.generated.json' with { type: 'json' }
|
|
5
|
+
|
|
6
|
+
function requestSchema(schema: unknown): z.ZodObject {
|
|
7
|
+
return (z.fromJSONSchema(schema as Parameters<typeof z.fromJSONSchema>[0]) as z.ZodObject).extend({ name: z.string().trim().min(1).max(128) })
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const sources = catalog.flatMap((entry) => ('source' in entry && entry.source != null ? [entry.source] : []))
|
|
11
|
+
export const createEventSourceSchema = z.union(sources.map((source) => requestSchema(source.createSchema))) as unknown as z.ZodType<CreateEventSource>
|
|
12
|
+
export const updateEventSourceSchema = requestSchema(sources[0]!.updateSchema) as unknown as z.ZodType<UpdateEventSource>
|
|
13
|
+
export const eventSourceRevisionSchema = z.strictObject({ version: z.literal(1), expectedRevision: z.int().positive() })
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
const id = z.string().min(1).max(256)
|
|
4
|
+
const eventType = z.string().regex(/^[a-z][a-z0-9_.:]{0,127}$/)
|
|
5
|
+
const name = z.string().trim().min(1).max(128)
|
|
6
|
+
|
|
7
|
+
const eventSourceSchema = z.object({
|
|
8
|
+
version: z.literal(1),
|
|
9
|
+
sourceId: id,
|
|
10
|
+
revision: z.int().positive(),
|
|
11
|
+
name,
|
|
12
|
+
provider: z.enum(['feishu', 'feishu_app_bot', 'slackbot', 'intercom', 'sentry', 'zoom', 'fireflies', 'jira']),
|
|
13
|
+
appId: id.nullable(),
|
|
14
|
+
workspaceId: id.optional(),
|
|
15
|
+
installationId: id.optional(),
|
|
16
|
+
organizationId: id.optional(),
|
|
17
|
+
projectId: id.optional(),
|
|
18
|
+
projectKey: id.optional(),
|
|
19
|
+
subscriptionStatus: z.enum(['idle', 'pending', 'ready', 'error']).optional(),
|
|
20
|
+
lastError: z.string().optional(),
|
|
21
|
+
signingSecretConfigured: z.boolean().optional(),
|
|
22
|
+
connectionId: id,
|
|
23
|
+
teamId: id.nullable(),
|
|
24
|
+
enabled: z.boolean(),
|
|
25
|
+
eventTypes: z.array(eventType),
|
|
26
|
+
manageSubscriptions: z.boolean().nullable(),
|
|
27
|
+
verificationTokenConfigured: z.boolean().nullable(),
|
|
28
|
+
encryptKeyConfigured: z.boolean().nullable(),
|
|
29
|
+
endpointUrl: z.string().nullable(),
|
|
30
|
+
verifiedAt: z.string().nullable(),
|
|
31
|
+
lastReceivedAt: z.string().nullable(),
|
|
32
|
+
updatedAt: z.string(),
|
|
33
|
+
consumers: z.array(z.object({ flowId: id, flowName: z.string(), triggerNodeId: id })),
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
export const eventSourceViewSchema = eventSourceSchema.pick({
|
|
37
|
+
appId: true,
|
|
38
|
+
workspaceId: true,
|
|
39
|
+
installationId: true,
|
|
40
|
+
organizationId: true,
|
|
41
|
+
projectId: true,
|
|
42
|
+
projectKey: true,
|
|
43
|
+
subscriptionStatus: true,
|
|
44
|
+
lastError: true,
|
|
45
|
+
signingSecretConfigured: true,
|
|
46
|
+
manageSubscriptions: true,
|
|
47
|
+
verificationTokenConfigured: true,
|
|
48
|
+
encryptKeyConfigured: true,
|
|
49
|
+
verifiedAt: true,
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
export interface CreateFeishuEventSource {
|
|
53
|
+
readonly kind?: 'feishu'
|
|
54
|
+
readonly version: 1
|
|
55
|
+
readonly name: string
|
|
56
|
+
readonly connectionId: string
|
|
57
|
+
readonly teamId: string | null
|
|
58
|
+
readonly verificationToken: string
|
|
59
|
+
readonly encryptKey: string
|
|
60
|
+
readonly eventTypes: string[]
|
|
61
|
+
readonly manageSubscriptions: boolean
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface CreateSlackEventSource {
|
|
65
|
+
readonly kind: 'slack'
|
|
66
|
+
readonly version: 1
|
|
67
|
+
readonly name: string
|
|
68
|
+
readonly connectionId: string
|
|
69
|
+
readonly teamId: string | null
|
|
70
|
+
readonly appId: string
|
|
71
|
+
readonly workspaceId: string
|
|
72
|
+
readonly signingSecret: string
|
|
73
|
+
readonly eventTypes: string[]
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface CreateIntercomEventSource {
|
|
77
|
+
readonly kind: 'intercom'
|
|
78
|
+
readonly version: 1
|
|
79
|
+
readonly name: string
|
|
80
|
+
readonly connectionId: string
|
|
81
|
+
readonly teamId: string | null
|
|
82
|
+
readonly appId: string
|
|
83
|
+
readonly signingSecret: string
|
|
84
|
+
readonly eventTypes: string[]
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface CreateSentryEventSource {
|
|
88
|
+
readonly kind: 'sentry'
|
|
89
|
+
readonly version: 1
|
|
90
|
+
readonly name: string
|
|
91
|
+
readonly connectionId: string
|
|
92
|
+
readonly teamId: string | null
|
|
93
|
+
readonly appId: string
|
|
94
|
+
readonly installationId: string
|
|
95
|
+
readonly organizationId: string
|
|
96
|
+
readonly signingSecret: string
|
|
97
|
+
readonly eventTypes: string[]
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface CreateZoomEventSource {
|
|
101
|
+
readonly kind: 'zoom'
|
|
102
|
+
readonly version: 1
|
|
103
|
+
readonly name: string
|
|
104
|
+
readonly connectionId: string
|
|
105
|
+
readonly teamId: string | null
|
|
106
|
+
readonly appId: string
|
|
107
|
+
readonly signingSecret: string
|
|
108
|
+
readonly eventTypes: string[]
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface CreateFirefliesEventSource {
|
|
112
|
+
readonly kind: 'fireflies'
|
|
113
|
+
readonly version: 1
|
|
114
|
+
readonly name: string
|
|
115
|
+
readonly connectionId: string
|
|
116
|
+
readonly teamId: string | null
|
|
117
|
+
readonly signingSecret: string
|
|
118
|
+
readonly eventTypes: string[]
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface CreateJiraEventSource {
|
|
122
|
+
readonly kind: 'jira'
|
|
123
|
+
readonly version: 1
|
|
124
|
+
readonly name: string
|
|
125
|
+
readonly connectionId: string
|
|
126
|
+
readonly teamId: string | null
|
|
127
|
+
readonly project: string
|
|
128
|
+
readonly eventTypes: string[]
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export type CreateEventSource =
|
|
132
|
+
| CreateFeishuEventSource
|
|
133
|
+
| CreateSlackEventSource
|
|
134
|
+
| CreateIntercomEventSource
|
|
135
|
+
| CreateSentryEventSource
|
|
136
|
+
| CreateZoomEventSource
|
|
137
|
+
| CreateFirefliesEventSource
|
|
138
|
+
| CreateJiraEventSource
|
|
139
|
+
|
|
140
|
+
export interface UpdateEventSource {
|
|
141
|
+
readonly signingSecret?: string
|
|
142
|
+
readonly version: 1
|
|
143
|
+
readonly expectedRevision: number
|
|
144
|
+
readonly name: string
|
|
145
|
+
readonly enabled: boolean
|
|
146
|
+
readonly eventTypes: string[]
|
|
147
|
+
readonly verificationToken?: string
|
|
148
|
+
readonly encryptKey?: string
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface EventSource {
|
|
152
|
+
readonly version: 1
|
|
153
|
+
readonly sourceId: string
|
|
154
|
+
readonly revision: number
|
|
155
|
+
readonly name: string
|
|
156
|
+
readonly provider: 'feishu' | 'feishu_app_bot' | 'slackbot' | 'intercom' | 'sentry' | 'zoom' | 'fireflies' | 'jira'
|
|
157
|
+
readonly appId: string | null
|
|
158
|
+
readonly workspaceId?: string
|
|
159
|
+
readonly installationId?: string
|
|
160
|
+
readonly organizationId?: string
|
|
161
|
+
readonly projectId?: string
|
|
162
|
+
readonly projectKey?: string
|
|
163
|
+
readonly subscriptionStatus?: 'idle' | 'pending' | 'ready' | 'error'
|
|
164
|
+
readonly lastError?: string
|
|
165
|
+
readonly signingSecretConfigured?: boolean
|
|
166
|
+
readonly connectionId: string
|
|
167
|
+
readonly teamId: string | null
|
|
168
|
+
readonly enabled: boolean
|
|
169
|
+
readonly eventTypes: string[]
|
|
170
|
+
readonly manageSubscriptions: boolean | null
|
|
171
|
+
readonly verificationTokenConfigured: boolean | null
|
|
172
|
+
readonly encryptKeyConfigured: boolean | null
|
|
173
|
+
readonly endpointUrl: string | null
|
|
174
|
+
readonly verifiedAt: string | null
|
|
175
|
+
readonly lastReceivedAt: string | null
|
|
176
|
+
readonly updatedAt: string
|
|
177
|
+
readonly consumers: { flowId: string; flowName: string; triggerNodeId: string }[]
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export function decodeEventSource(value: unknown): EventSource {
|
|
181
|
+
return eventSourceSchema.parse(value)
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export function decodeEventSources(value: unknown): { readonly version: 1; readonly sources: readonly EventSource[]; readonly teamId?: string | null } {
|
|
185
|
+
return z.object({ version: z.literal(1), sources: z.array(eventSourceSchema), teamId: id.nullable().optional() }).parse(value)
|
|
186
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import type { ErrorListener, Flow, FlowListItem, FlowPage, FlowResources, Variable, VariableListItem, VariableReferences } from './api.ts'
|
|
2
|
+
|
|
3
|
+
import { requiredFields, integer, invalidResponse, record, string } from './decoding.ts'
|
|
4
|
+
|
|
5
|
+
function strings(value: unknown): readonly string[] {
|
|
6
|
+
return Array.isArray(value) ? value.map(string) : invalidResponse()
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function resourceReferences(input: unknown): FlowResources {
|
|
10
|
+
const source = record(input)
|
|
11
|
+
const draft = source.draft === null ? null : record(source.draft)
|
|
12
|
+
const shared = record(source.sharedAccess)
|
|
13
|
+
if (draft != null && !Array.isArray(draft.connections)) return invalidResponse()
|
|
14
|
+
if (!Array.isArray(shared.bindings)) return invalidResponse()
|
|
15
|
+
const accessRevision = integer(shared.accessRevision)
|
|
16
|
+
if (accessRevision < 0) return invalidResponse()
|
|
17
|
+
return {
|
|
18
|
+
draft:
|
|
19
|
+
draft == null
|
|
20
|
+
? null
|
|
21
|
+
: {
|
|
22
|
+
...(draft.calledFlowIds === undefined ? {} : { calledFlowIds: strings(draft.calledFlowIds) }),
|
|
23
|
+
variableNames: strings(draft.variableNames),
|
|
24
|
+
errorSourceFlowIds: strings(draft.errorSourceFlowIds),
|
|
25
|
+
connections: (draft.connections as unknown[]).map((value) => {
|
|
26
|
+
const connection = record(value)
|
|
27
|
+
return { providerId: string(connection.providerId), connectionId: string(connection.connectionId) }
|
|
28
|
+
}),
|
|
29
|
+
},
|
|
30
|
+
sharedAccess: {
|
|
31
|
+
accessRevision,
|
|
32
|
+
providerIds: strings(shared.providerIds),
|
|
33
|
+
bindings: shared.bindings.map((value) => {
|
|
34
|
+
const binding = record(value)
|
|
35
|
+
return {
|
|
36
|
+
providerId: string(binding.providerId),
|
|
37
|
+
connectionId: binding.connectionId === null ? null : string(binding.connectionId),
|
|
38
|
+
accessBindingId: string(binding.accessBindingId),
|
|
39
|
+
}
|
|
40
|
+
}),
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function flow(value: unknown): Flow {
|
|
46
|
+
const source = record(value)
|
|
47
|
+
const status = source.status
|
|
48
|
+
if (source.version != 1) return invalidResponse()
|
|
49
|
+
if (status != 'active' && status != 'retiring') return invalidResponse()
|
|
50
|
+
const target = source.live == null ? undefined : record(source.live)
|
|
51
|
+
if (target != null && (typeof target.enabled != 'boolean' || typeof target.hasStart != 'boolean')) return invalidResponse()
|
|
52
|
+
return {
|
|
53
|
+
...(target == null
|
|
54
|
+
? {}
|
|
55
|
+
: {
|
|
56
|
+
live: {
|
|
57
|
+
enabled: target.enabled as boolean,
|
|
58
|
+
hasStart: target.hasStart as boolean,
|
|
59
|
+
publicationId: string(target.publicationId),
|
|
60
|
+
revisionId: string(target.revisionId),
|
|
61
|
+
},
|
|
62
|
+
}),
|
|
63
|
+
createdAt: string(source.createdAt),
|
|
64
|
+
...(source.connectorTeamId == null ? {} : { connectorTeamId: string(source.connectorTeamId) }),
|
|
65
|
+
draftRevisionId: string(source.draftRevisionId),
|
|
66
|
+
resourceReferences: resourceReferences(source.resourceReferences),
|
|
67
|
+
flowId: string(source.flowId),
|
|
68
|
+
name: string(source.name),
|
|
69
|
+
status: status as Flow['status'],
|
|
70
|
+
updatedAt: string(source.updatedAt),
|
|
71
|
+
version: 1,
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function flowListItem(value: unknown): FlowListItem {
|
|
76
|
+
const source = record(value)
|
|
77
|
+
const referenceCount = integer(source.referenceCount)
|
|
78
|
+
if (referenceCount < 0) return invalidResponse()
|
|
79
|
+
return { ...flow(source), referenceCount }
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function flowPage(value: unknown): FlowPage {
|
|
83
|
+
const source = record(value)
|
|
84
|
+
if (source.version != 1 || !Array.isArray(source.flows)) return invalidResponse()
|
|
85
|
+
const nextCursor = source.nextCursor
|
|
86
|
+
const total = source.total
|
|
87
|
+
if (nextCursor != null && typeof nextCursor != 'string') return invalidResponse()
|
|
88
|
+
if (total != null && !Number.isSafeInteger(total)) return invalidResponse()
|
|
89
|
+
return {
|
|
90
|
+
...(nextCursor == null ? {} : { nextCursor }),
|
|
91
|
+
flows: source.flows.map(flowListItem),
|
|
92
|
+
...(total == null ? {} : { total: total as number }),
|
|
93
|
+
version: 1,
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function variable(value: unknown): Variable {
|
|
98
|
+
const source = record(value)
|
|
99
|
+
requiredFields(source, ['name', 'updatedAt', 'value', 'version'])
|
|
100
|
+
if (source.version != 1 || typeof source.value != 'string') return invalidResponse()
|
|
101
|
+
const updatedAt = string(source.updatedAt)
|
|
102
|
+
try {
|
|
103
|
+
if (new Date(updatedAt).toISOString() != updatedAt) return invalidResponse()
|
|
104
|
+
} catch {
|
|
105
|
+
return invalidResponse()
|
|
106
|
+
}
|
|
107
|
+
return { name: string(source.name), updatedAt, value: source.value, version: 1 }
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function variableListItem(value: unknown): VariableListItem {
|
|
111
|
+
const source = record(value)
|
|
112
|
+
const { referenceCount, ...fields } = source
|
|
113
|
+
const count = integer(referenceCount)
|
|
114
|
+
if (count < 0) return invalidResponse()
|
|
115
|
+
return { ...variable(fields), referenceCount: count }
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function errorListener(value: unknown): ErrorListener {
|
|
119
|
+
const source = record(value)
|
|
120
|
+
if (typeof source.enabled != 'boolean') return invalidResponse()
|
|
121
|
+
return {
|
|
122
|
+
flowId: string(source.flowId),
|
|
123
|
+
flowName: string(source.flowName),
|
|
124
|
+
nodeId: string(source.nodeId),
|
|
125
|
+
nodeName: string(source.nodeName),
|
|
126
|
+
enabled: source.enabled,
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function variableReferences(input: unknown): VariableReferences {
|
|
131
|
+
const source = record(input)
|
|
132
|
+
requiredFields(source, ['version', 'references'])
|
|
133
|
+
if (source.version != 1 || !Array.isArray(source.references)) return invalidResponse()
|
|
134
|
+
return {
|
|
135
|
+
version: 1,
|
|
136
|
+
references: source.references.map((value) => {
|
|
137
|
+
const item = record(value)
|
|
138
|
+
requiredFields(item, ['flowId', 'flowName', 'draft', 'live'])
|
|
139
|
+
if (typeof item.draft != 'boolean') return invalidResponse()
|
|
140
|
+
const live = item.live === null ? null : record(item.live)
|
|
141
|
+
if (live != null) {
|
|
142
|
+
requiredFields(live, ['publicationId', 'enabled'])
|
|
143
|
+
if (typeof live.enabled != 'boolean') return invalidResponse()
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
flowId: string(item.flowId),
|
|
147
|
+
flowName: string(item.flowName),
|
|
148
|
+
draft: item.draft,
|
|
149
|
+
live: live == null ? null : { publicationId: string(live.publicationId), enabled: live.enabled as boolean },
|
|
150
|
+
}
|
|
151
|
+
}),
|
|
152
|
+
}
|
|
153
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import type { ManagedTaskDefinition } from '../../flow/common/change.ts'
|
|
2
|
+
import type { ConditionOperand, Graph, GraphNode, Group, InputPort, RevisionContent } from '../../flow/common/change.ts'
|
|
3
|
+
import type { ConnectorAction, Draft, Flow, Live } from './api.ts'
|
|
4
|
+
|
|
5
|
+
import { nodeInputPorts, nodeOutputPorts } from '../../flow/common/graph.ts'
|
|
6
|
+
|
|
7
|
+
export async function inspectFlowDraft(flow: Flow, readDraft: () => Draft | Promise<Draft>) {
|
|
8
|
+
try {
|
|
9
|
+
return { flow, draft: await readDraft(), version: 1 as const }
|
|
10
|
+
} catch (error) {
|
|
11
|
+
if (!(error instanceof Error) || !('code' in error) || (error.code != 'flow.invalid' && error.code != 'flow.revision-upgrade-required')) throw error
|
|
12
|
+
return {
|
|
13
|
+
flow,
|
|
14
|
+
draft: null,
|
|
15
|
+
draftIssue: { code: error.code, message: error.message, revisionId: flow.draftRevisionId },
|
|
16
|
+
version: 1 as const,
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function flowInspection(inspected: Awaited<ReturnType<typeof inspectFlowDraft>>, live: Live | undefined, full = false) {
|
|
22
|
+
if (inspected.draft == null) return inspected
|
|
23
|
+
if (full) return { ...inspected, live }
|
|
24
|
+
const { flow, draft } = inspected
|
|
25
|
+
const { document, modules } = draft.content
|
|
26
|
+
return {
|
|
27
|
+
flow: { flowId: flow.flowId, name: flow.name, status: flow.status },
|
|
28
|
+
draft: {
|
|
29
|
+
revisionId: draft.revisionId,
|
|
30
|
+
graph: inspectGraph(document.graph),
|
|
31
|
+
bindings: document.bindings,
|
|
32
|
+
modules: Object.fromEntries(Object.entries(modules).map(([id, module]) => [id, { name: module.name, imports: module.imports }])),
|
|
33
|
+
},
|
|
34
|
+
...(live == null
|
|
35
|
+
? {}
|
|
36
|
+
: {
|
|
37
|
+
live: {
|
|
38
|
+
status: live.status,
|
|
39
|
+
hasUnpublishedChanges: live.hasUnpublishedChanges,
|
|
40
|
+
publication:
|
|
41
|
+
live.publication == null
|
|
42
|
+
? null
|
|
43
|
+
: {
|
|
44
|
+
publicationId: live.publication.publicationId,
|
|
45
|
+
revisionId: live.publication.revisionId,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
}),
|
|
49
|
+
version: 1 as const,
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function inspectPorts(ports: readonly (InputPort | Group)[]) {
|
|
54
|
+
return ports.flatMap((port) => ('handle' in port ? [{ handle: port.handle, ...(Object.hasOwn(port, 'value') ? { value: port.value } : {}) }] : []))
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function inspectGraph(graph: Graph) {
|
|
58
|
+
return {
|
|
59
|
+
nodes: Object.fromEntries(Object.entries(graph.nodes).map(([id, node]) => [id, inspectNode(node)])),
|
|
60
|
+
edges: graph.edges,
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function inspectNode(node: GraphNode): Record<string, unknown> {
|
|
65
|
+
const inputs = nodeInputPorts(node)
|
|
66
|
+
const defaults = Object.fromEntries(
|
|
67
|
+
Object.entries(inputs).flatMap(([handle, port]) =>
|
|
68
|
+
Object.hasOwn(port, 'value') && !('inputs' in node && Object.hasOwn(node.inputs, handle)) ? [[handle, port.value]] : [],
|
|
69
|
+
),
|
|
70
|
+
)
|
|
71
|
+
const ports = {
|
|
72
|
+
inputHandles: Object.keys(inputs),
|
|
73
|
+
outputHandles: Object.keys(nodeOutputPorts(node)),
|
|
74
|
+
...(Object.keys(defaults).length == 0 ? {} : { inputDefaults: defaults }),
|
|
75
|
+
}
|
|
76
|
+
switch (node.kind) {
|
|
77
|
+
case 'webhook-response':
|
|
78
|
+
return { ...node, ...ports }
|
|
79
|
+
case 'outputs':
|
|
80
|
+
return { ...node, ...ports, inputs: node.outputMappings }
|
|
81
|
+
case 'task': {
|
|
82
|
+
const { task, additionalInputs: _additional, ...instance } = node
|
|
83
|
+
return {
|
|
84
|
+
...instance,
|
|
85
|
+
...ports,
|
|
86
|
+
...(task == null ? {} : 'executor' in task ? { executor: task.executor } : { moduleId: task.moduleId, capabilities: task.capabilities }),
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
case 'poll':
|
|
90
|
+
case 'integration': {
|
|
91
|
+
const { definition, ...instance } = node
|
|
92
|
+
return {
|
|
93
|
+
...instance,
|
|
94
|
+
...ports,
|
|
95
|
+
definition: {
|
|
96
|
+
key: definition.key,
|
|
97
|
+
provider: definition.provider,
|
|
98
|
+
definitionVersion: definition.definitionVersion,
|
|
99
|
+
configInputs: inspectPorts(definition.configInputs),
|
|
100
|
+
...(definition.type == 'integration' ? { endpoint: definition.endpoint } : {}),
|
|
101
|
+
},
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
case 'webhook': {
|
|
105
|
+
const { bodyFields, ...instance } = node
|
|
106
|
+
return { ...instance, ...ports, bodyFields: inspectPorts(bodyFields) }
|
|
107
|
+
}
|
|
108
|
+
case 'wait':
|
|
109
|
+
case 'approval': {
|
|
110
|
+
const { inputDefinitions: _definitions, ...instance } = node
|
|
111
|
+
return { ...instance, ...ports }
|
|
112
|
+
}
|
|
113
|
+
case 'value':
|
|
114
|
+
return { ...node, ...ports, values: inspectPorts(node.values) }
|
|
115
|
+
case 'condition':
|
|
116
|
+
return {
|
|
117
|
+
...node,
|
|
118
|
+
...ports,
|
|
119
|
+
cases: node.cases.map((branch) => ({
|
|
120
|
+
...branch,
|
|
121
|
+
groups: branch.groups.map((group) => ({
|
|
122
|
+
expressions: group.expressions.map((expression) => ({
|
|
123
|
+
...expression,
|
|
124
|
+
left: inspectOperand(expression.left),
|
|
125
|
+
...(expression.right == null ? {} : { right: inspectOperand(expression.right) }),
|
|
126
|
+
})),
|
|
127
|
+
})),
|
|
128
|
+
})),
|
|
129
|
+
}
|
|
130
|
+
case 'error':
|
|
131
|
+
case 'manual':
|
|
132
|
+
case 'start':
|
|
133
|
+
case 'cron':
|
|
134
|
+
return { ...node, ...ports }
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function inspectOperand(operand: ConditionOperand) {
|
|
139
|
+
if (operand.kind == 'source') return operand
|
|
140
|
+
const { jsonSchema: _, ...value } = operand
|
|
141
|
+
return value
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export function actionSummary(action: ConnectorAction) {
|
|
145
|
+
return {
|
|
146
|
+
actionId: action.actionId,
|
|
147
|
+
authenticated: action.authenticated,
|
|
148
|
+
...(action.defaultConnection == null
|
|
149
|
+
? {}
|
|
150
|
+
: {
|
|
151
|
+
defaultConnection: {
|
|
152
|
+
connectionId: action.defaultConnection.connectionId,
|
|
153
|
+
displayName: action.defaultConnection.displayName,
|
|
154
|
+
status: action.defaultConnection.status,
|
|
155
|
+
},
|
|
156
|
+
}),
|
|
157
|
+
description: action.description,
|
|
158
|
+
name: action.name,
|
|
159
|
+
serviceId: action.serviceId,
|
|
160
|
+
serviceName: action.serviceName,
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export function nodeDetails(
|
|
165
|
+
content: RevisionContent,
|
|
166
|
+
nodeId: string,
|
|
167
|
+
node: GraphNode,
|
|
168
|
+
): {
|
|
169
|
+
node: GraphNode
|
|
170
|
+
nodeId: string
|
|
171
|
+
module?: RevisionContent['modules'][string]
|
|
172
|
+
task?: ManagedTaskDefinition
|
|
173
|
+
} {
|
|
174
|
+
if (node.kind != 'task') return { node, nodeId }
|
|
175
|
+
if ('moduleId' in node.task) {
|
|
176
|
+
const module = content.modules[node.task.moduleId]
|
|
177
|
+
return { node, nodeId, ...(module == null ? {} : { module }) }
|
|
178
|
+
}
|
|
179
|
+
const task = node.task
|
|
180
|
+
return { node, nodeId, ...(task == null ? {} : { task }) }
|
|
181
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { CanvasCommand } from '../../canvas/common/commands.ts'
|
|
2
|
+
|
|
3
|
+
export type FlowCatalogEvent =
|
|
4
|
+
| { readonly kind: 'flows.changed'; readonly version: 1 }
|
|
5
|
+
| { readonly kind: 'flow.created'; readonly flowId: string; readonly version: 1 }
|
|
6
|
+
|
|
7
|
+
export type FlowChangeEvent =
|
|
8
|
+
| {
|
|
9
|
+
readonly kind: 'canvas.command'
|
|
10
|
+
readonly flowId: string
|
|
11
|
+
readonly command: CanvasCommand
|
|
12
|
+
readonly version: 1
|
|
13
|
+
}
|
|
14
|
+
| {
|
|
15
|
+
readonly accessRevision: number
|
|
16
|
+
readonly flowId: string
|
|
17
|
+
readonly kind: 'access.changed'
|
|
18
|
+
readonly version: 1
|
|
19
|
+
}
|
|
20
|
+
| {
|
|
21
|
+
readonly kind: 'draft.changed'
|
|
22
|
+
readonly flowId: string
|
|
23
|
+
readonly revisionId: string
|
|
24
|
+
readonly version: 1
|
|
25
|
+
}
|
|
26
|
+
| {
|
|
27
|
+
readonly flowId: string
|
|
28
|
+
readonly kind: 'run.created'
|
|
29
|
+
readonly runId: string
|
|
30
|
+
readonly version: 1
|
|
31
|
+
}
|
|
32
|
+
| {
|
|
33
|
+
readonly flowId: string
|
|
34
|
+
readonly kind: 'run.changed'
|
|
35
|
+
readonly runId: string
|
|
36
|
+
readonly version: 1
|
|
37
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { RevisionContent } from '../../flow/common/change.ts'
|
|
2
|
+
import type { Publication, TriggerBinding } from './api.ts'
|
|
3
|
+
|
|
4
|
+
import { z } from 'zod'
|
|
5
|
+
import { webhookSupportsBody } from '../../flow/common/webhookMethod.ts'
|
|
6
|
+
import { flowInputFieldsView, authoringConfigurations } from './authoringSchema.ts'
|
|
7
|
+
import { triggerConfiguration } from './authoringTriggers.ts'
|
|
8
|
+
import { invalidResponse, record, string } from './decoding.ts'
|
|
9
|
+
import { publication } from './publicationDecoders.ts'
|
|
10
|
+
import { triggerBinding } from './triggerDecoders.ts'
|
|
11
|
+
|
|
12
|
+
const metadata = { nodeId: z.string().min(1), name: z.string(), description: z.string().optional() }
|
|
13
|
+
const binding = z.unknown().transform(triggerBinding)
|
|
14
|
+
const provider = {
|
|
15
|
+
provider: z.string().min(1),
|
|
16
|
+
inputs: z.record(z.string(), z.discriminatedUnion('kind', [z.object({ kind: z.literal('value'), value: z.json() }), z.object({ kind: z.literal('unset') })])),
|
|
17
|
+
}
|
|
18
|
+
const entrySchema = z.discriminatedUnion('type', [
|
|
19
|
+
z.object({ ...metadata, type: z.literal('start'), config: authoringConfigurations.start }),
|
|
20
|
+
z.object({ ...metadata, type: z.literal('manual'), config: z.object({}) }),
|
|
21
|
+
z.object({ ...metadata, type: z.literal('webhook'), config: authoringConfigurations.webhook, binding }),
|
|
22
|
+
z.object({ ...metadata, type: z.literal('cron'), config: authoringConfigurations.cron, binding }),
|
|
23
|
+
z.object({ ...metadata, type: z.literal('error'), config: authoringConfigurations.error, binding }),
|
|
24
|
+
z.object({ ...metadata, ...provider, type: z.literal('poll'), config: authoringConfigurations.poll, binding }),
|
|
25
|
+
z.object({ ...metadata, ...provider, type: z.literal('integration'), config: authoringConfigurations.integration, binding }),
|
|
26
|
+
])
|
|
27
|
+
|
|
28
|
+
export type LiveEntry = z.infer<typeof entrySchema>
|
|
29
|
+
export type LiveDetails = { readonly flowId: string; readonly version: 1 } & (
|
|
30
|
+
| { readonly inputDefs: null; readonly publication: null; readonly status: 'not-published'; readonly entries: readonly [] }
|
|
31
|
+
| {
|
|
32
|
+
readonly inputDefs: z.infer<typeof flowInputFieldsView>
|
|
33
|
+
readonly publication: Publication
|
|
34
|
+
readonly status: 'runnable' | 'suspended'
|
|
35
|
+
readonly enabled: boolean
|
|
36
|
+
readonly entries: readonly LiveEntry[]
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
/** Project only the selected published definition and its current bindings. */
|
|
41
|
+
export function liveEntries(content: RevisionContent, current: Publication, bindings: readonly TriggerBinding[]): readonly LiveEntry[] {
|
|
42
|
+
const byNode = new Map(
|
|
43
|
+
bindings
|
|
44
|
+
.filter((item) => item.flowId == current.flowId && item.currentPublicationId == current.publicationId && item.currentRevisionId == current.revisionId)
|
|
45
|
+
.map((item) => [item.triggerNodeId, item]),
|
|
46
|
+
)
|
|
47
|
+
const entries = Object.entries(content.document.graph.nodes)
|
|
48
|
+
.toSorted(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
|
|
49
|
+
.flatMap(([nodeId, node]) => {
|
|
50
|
+
if (
|
|
51
|
+
node.kind != 'start' &&
|
|
52
|
+
node.kind != 'manual' &&
|
|
53
|
+
node.kind != 'webhook' &&
|
|
54
|
+
node.kind != 'cron' &&
|
|
55
|
+
node.kind != 'error' &&
|
|
56
|
+
node.kind != 'poll' &&
|
|
57
|
+
node.kind != 'integration'
|
|
58
|
+
)
|
|
59
|
+
return []
|
|
60
|
+
const config = triggerConfiguration(node)
|
|
61
|
+
const value = {
|
|
62
|
+
nodeId,
|
|
63
|
+
name: node.name,
|
|
64
|
+
type: node.kind,
|
|
65
|
+
...(node.description == null ? {} : { description: node.description }),
|
|
66
|
+
config: node.kind == 'webhook' && !webhookSupportsBody(node.method) ? { ...config, body: {} } : config,
|
|
67
|
+
...(node.kind == 'start' || node.kind == 'manual' ? {} : { binding: byNode.get(nodeId) }),
|
|
68
|
+
...(node.kind == 'poll' || node.kind == 'integration' ? { provider: node.definition.provider, inputs: node.config } : {}),
|
|
69
|
+
}
|
|
70
|
+
return [value]
|
|
71
|
+
})
|
|
72
|
+
return decodeEntries(entries, current)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function decodeLiveDetails(value: unknown): LiveDetails {
|
|
76
|
+
const source = record(value)
|
|
77
|
+
const flowId = string(source.flowId)
|
|
78
|
+
if (source.version != 1 || !Array.isArray(source.entries)) return invalidResponse()
|
|
79
|
+
if (source.publication === null) {
|
|
80
|
+
if (source.inputDefs !== null || source.status != 'not-published' || source.entries.length != 0 || Object.hasOwn(source, 'enabled'))
|
|
81
|
+
return invalidResponse()
|
|
82
|
+
return { flowId, inputDefs: null, publication: null, status: 'not-published', entries: [], version: 1 }
|
|
83
|
+
}
|
|
84
|
+
const current = publication(source.publication)
|
|
85
|
+
const status = source.status
|
|
86
|
+
if (current.flowId != flowId || typeof source.enabled != 'boolean') return invalidResponse()
|
|
87
|
+
if (status != 'runnable' && status != 'suspended') return invalidResponse()
|
|
88
|
+
if (!source.enabled && source.status == 'runnable') return invalidResponse()
|
|
89
|
+
const inputDefs = flowInputFieldsView.safeParse(source.inputDefs)
|
|
90
|
+
if (!inputDefs.success) return invalidResponse()
|
|
91
|
+
return {
|
|
92
|
+
flowId,
|
|
93
|
+
inputDefs: inputDefs.data,
|
|
94
|
+
publication: current,
|
|
95
|
+
status: status as 'runnable' | 'suspended',
|
|
96
|
+
enabled: source.enabled,
|
|
97
|
+
entries: decodeEntries(source.entries, current),
|
|
98
|
+
version: 1,
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** Both producers and consumers enforce the same published-entry invariants. */
|
|
103
|
+
function decodeEntries(values: unknown, current: Publication): readonly LiveEntry[] {
|
|
104
|
+
const parsed = z.array(entrySchema).safeParse(values)
|
|
105
|
+
if (!parsed.success) return invalidResponse()
|
|
106
|
+
const ids = new Set<string>()
|
|
107
|
+
for (const entry of parsed.data) {
|
|
108
|
+
if (ids.has(entry.nodeId)) return invalidResponse()
|
|
109
|
+
ids.add(entry.nodeId)
|
|
110
|
+
if (
|
|
111
|
+
entry.type != 'start' &&
|
|
112
|
+
entry.type != 'manual' &&
|
|
113
|
+
(entry.binding.flowId != current.flowId ||
|
|
114
|
+
entry.binding.triggerNodeId != entry.nodeId ||
|
|
115
|
+
entry.binding.kind != entry.type ||
|
|
116
|
+
entry.binding.currentPublicationId != current.publicationId ||
|
|
117
|
+
entry.binding.currentRevisionId != current.revisionId)
|
|
118
|
+
)
|
|
119
|
+
return invalidResponse()
|
|
120
|
+
if (entry.type == 'webhook' && (!entry.binding.endpointUrl || (!webhookSupportsBody(entry.config.method) && Object.keys(entry.config.body).length > 0)))
|
|
121
|
+
return invalidResponse()
|
|
122
|
+
}
|
|
123
|
+
return parsed.data
|
|
124
|
+
}
|