@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,175 @@
|
|
|
1
|
+
import type { TriggerKeySnapshot } from '../../flow/common/change.ts'
|
|
2
|
+
import type {
|
|
3
|
+
PollTriggerTestResult,
|
|
4
|
+
TriggerActivity,
|
|
5
|
+
TriggerActivityKind,
|
|
6
|
+
TriggerActivityPage,
|
|
7
|
+
TriggerBinding,
|
|
8
|
+
TriggerBindingDetail,
|
|
9
|
+
TriggerKeySummary,
|
|
10
|
+
} from './api.ts'
|
|
11
|
+
|
|
12
|
+
import { configInputsSchema } from '../../trigger/common/configSchema.ts'
|
|
13
|
+
import { integer, invalidResponse, jsonValue, optionalString, record, string } from './decoding.ts'
|
|
14
|
+
|
|
15
|
+
export function triggerKeySummary(value: unknown): TriggerKeySummary {
|
|
16
|
+
const source = record(value)
|
|
17
|
+
const type = source.type
|
|
18
|
+
if (type != 'integration' && type != 'poll') return invalidResponse()
|
|
19
|
+
return {
|
|
20
|
+
description: typeof source.description == 'string' ? source.description : invalidResponse(),
|
|
21
|
+
displayName: string(source.displayName),
|
|
22
|
+
key: string(source.key),
|
|
23
|
+
name: string(source.name),
|
|
24
|
+
provider: string(source.provider),
|
|
25
|
+
type: type as TriggerKeySummary['type'],
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function triggerKey(value: unknown): TriggerKeySnapshot {
|
|
30
|
+
const source = record(value)
|
|
31
|
+
const summary = triggerKeySummary(source)
|
|
32
|
+
const base = {
|
|
33
|
+
configInputs: configInputsSchema.parse(source.configInputs),
|
|
34
|
+
definitionVersion: source.definitionVersion === 2 ? 2 : invalidResponse(),
|
|
35
|
+
description: summary.description,
|
|
36
|
+
displayName: summary.displayName,
|
|
37
|
+
key: summary.key,
|
|
38
|
+
name: summary.name,
|
|
39
|
+
outputs: (Array.isArray(source.outputs) ? source.outputs : invalidResponse()).map((entry) => {
|
|
40
|
+
const port = record(entry)
|
|
41
|
+
return Object.assign(
|
|
42
|
+
{
|
|
43
|
+
handle: string(port.handle),
|
|
44
|
+
jsonSchema: jsonValue(port.jsonSchema),
|
|
45
|
+
nullable: typeof port.nullable === 'boolean' ? port.nullable : invalidResponse(),
|
|
46
|
+
},
|
|
47
|
+
port.description == null ? {} : { description: string(port.description) },
|
|
48
|
+
)
|
|
49
|
+
}),
|
|
50
|
+
provider: summary.provider,
|
|
51
|
+
}
|
|
52
|
+
if (summary.type == 'poll') return { ...base, type: 'poll' }
|
|
53
|
+
const endpoint = record(source.endpoint)
|
|
54
|
+
const body = record(endpoint.body)
|
|
55
|
+
if (!Array.isArray(endpoint.methods) || !Array.isArray(body.formats) || typeof body.allowArray != 'boolean' || typeof body.allowEmpty != 'boolean') {
|
|
56
|
+
return invalidResponse()
|
|
57
|
+
}
|
|
58
|
+
const methods = endpoint.methods.map(string)
|
|
59
|
+
const formats = body.formats.map(string)
|
|
60
|
+
const successStatus = integer(endpoint.successStatus)
|
|
61
|
+
if (
|
|
62
|
+
methods.some((method) => !['DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT'].includes(method)) ||
|
|
63
|
+
formats.some((format) => !['form', 'json', 'multipart', 'text'].includes(format)) ||
|
|
64
|
+
successStatus < 200 ||
|
|
65
|
+
successStatus > 299
|
|
66
|
+
) {
|
|
67
|
+
return invalidResponse()
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
...base,
|
|
71
|
+
endpoint: {
|
|
72
|
+
body: {
|
|
73
|
+
allowArray: body.allowArray,
|
|
74
|
+
allowEmpty: body.allowEmpty,
|
|
75
|
+
formats: formats as Extract<TriggerKeySnapshot, { readonly type: 'integration' }>['endpoint']['body']['formats'],
|
|
76
|
+
},
|
|
77
|
+
methods: methods as Extract<TriggerKeySnapshot, { readonly type: 'integration' }>['endpoint']['methods'],
|
|
78
|
+
successStatus,
|
|
79
|
+
},
|
|
80
|
+
type: 'integration',
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const triggerKinds: ReadonlySet<TriggerBinding['kind']> = new Set(['error', 'cron', 'integration', 'poll', 'webhook'])
|
|
85
|
+
const triggerHealth: ReadonlySet<TriggerBinding['health']> = new Set(['failed', 'healthy', 'initializing', 'needs_reauth', 'suspended'])
|
|
86
|
+
const triggerActivityKinds: ReadonlySet<TriggerActivityKind> = new Set([
|
|
87
|
+
'delivery.failed',
|
|
88
|
+
'health.failed',
|
|
89
|
+
'health.needs_reauth',
|
|
90
|
+
'health.recovered',
|
|
91
|
+
'health.suspended',
|
|
92
|
+
'operator.paused',
|
|
93
|
+
'operator.resumed',
|
|
94
|
+
])
|
|
95
|
+
|
|
96
|
+
export function triggerBinding(value: unknown): TriggerBinding {
|
|
97
|
+
const source = record(value)
|
|
98
|
+
const health = source.health
|
|
99
|
+
const listener = source.listener == null ? undefined : record(source.listener)
|
|
100
|
+
if (listener != null && listener.health != 'healthy' && listener.health != 'failed' && listener.health != 'needs_reauth') return invalidResponse()
|
|
101
|
+
const kind = source.kind
|
|
102
|
+
const runtimeVersion = integer(source.runtimeVersion)
|
|
103
|
+
if (source.version != 1 || typeof health != 'string' || !triggerHealth.has(health as TriggerBinding['health'])) return invalidResponse()
|
|
104
|
+
if (typeof kind != 'string' || !triggerKinds.has(kind as TriggerBinding['kind'])) return invalidResponse()
|
|
105
|
+
if (runtimeVersion <= 0) return invalidResponse()
|
|
106
|
+
return {
|
|
107
|
+
...(source.currentPublicationId == null ? {} : { currentPublicationId: string(source.currentPublicationId) }),
|
|
108
|
+
...(source.currentRevisionId == null ? {} : { currentRevisionId: string(source.currentRevisionId) }),
|
|
109
|
+
...(source.endpointUrl == null ? {} : { endpointUrl: string(source.endpointUrl) }),
|
|
110
|
+
...(listener == null
|
|
111
|
+
? {}
|
|
112
|
+
: {
|
|
113
|
+
listener: {
|
|
114
|
+
health: listener.health as NonNullable<TriggerBinding['listener']>['health'],
|
|
115
|
+
...(listener.lastErrorCode == null ? {} : { lastErrorCode: string(listener.lastErrorCode) }),
|
|
116
|
+
},
|
|
117
|
+
}),
|
|
118
|
+
flowId: string(source.flowId),
|
|
119
|
+
health: health as TriggerBinding['health'],
|
|
120
|
+
kind: kind as TriggerBinding['kind'],
|
|
121
|
+
...(source.lastErrorCode == null ? {} : { lastErrorCode: string(source.lastErrorCode) }),
|
|
122
|
+
runtimeVersion,
|
|
123
|
+
triggerNodeId: string(source.triggerNodeId),
|
|
124
|
+
updatedAt: string(source.updatedAt),
|
|
125
|
+
version: 1,
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function triggerBindingDetail(value: unknown): TriggerBindingDetail {
|
|
130
|
+
const source = record(value)
|
|
131
|
+
if (source.version != 1) return invalidResponse()
|
|
132
|
+
return { binding: triggerBinding(source.binding), version: 1 }
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function triggerActivity(value: unknown): TriggerActivity {
|
|
136
|
+
const source = record(value)
|
|
137
|
+
const kind = source.kind
|
|
138
|
+
if (typeof kind != 'string' || !triggerActivityKinds.has(kind as TriggerActivityKind)) return invalidResponse()
|
|
139
|
+
const errorCode = optionalString(source.errorCode)
|
|
140
|
+
const errorMessage = optionalString(source.errorMessage)
|
|
141
|
+
if (errorMessage != null && errorMessage.length > 512) return invalidResponse()
|
|
142
|
+
return {
|
|
143
|
+
activityId: string(source.activityId),
|
|
144
|
+
createdAt: string(source.createdAt),
|
|
145
|
+
...(errorCode == null ? {} : { errorCode }),
|
|
146
|
+
...(errorMessage == null ? {} : { errorMessage }),
|
|
147
|
+
kind: kind as TriggerActivityKind,
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function triggerActivityPage(value: unknown): TriggerActivityPage {
|
|
152
|
+
const source = record(value)
|
|
153
|
+
const nextCursor = optionalString(source.nextCursor)
|
|
154
|
+
if (source.version != 1 || !Array.isArray(source.activities)) return invalidResponse()
|
|
155
|
+
return {
|
|
156
|
+
activities: source.activities.map(triggerActivity),
|
|
157
|
+
...(nextCursor == null ? {} : { nextCursor }),
|
|
158
|
+
version: 1,
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export function pollTriggerTestResult(value: unknown): PollTriggerTestResult {
|
|
163
|
+
const source = record(value)
|
|
164
|
+
const filtered = integer(source.filtered)
|
|
165
|
+
if (source.version != 1 || !Array.isArray(source.events) || typeof source.hasMore != 'boolean' || filtered < 0) return invalidResponse()
|
|
166
|
+
return {
|
|
167
|
+
events: source.events.map((event) => {
|
|
168
|
+
const object = record(event)
|
|
169
|
+
return Object.fromEntries(Object.entries(object).map(([key, item]) => [key, jsonValue(item)]))
|
|
170
|
+
}),
|
|
171
|
+
filtered,
|
|
172
|
+
hasMore: source.hasMore,
|
|
173
|
+
version: 1,
|
|
174
|
+
}
|
|
175
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import type { InputPort, JsonValue, ManagedTaskDefinition, Port } from '../../flow/common/change.ts'
|
|
2
|
+
|
|
3
|
+
import { dequal } from 'dequal/lite'
|
|
4
|
+
import { matchesSchema } from '../../flow/common/schema.ts'
|
|
5
|
+
|
|
6
|
+
export type DecisionQuestion = { readonly name: string; readonly instructions: string } & (
|
|
7
|
+
| { readonly type: 'noul'; readonly criteria?: { readonly true?: string; readonly false?: string } }
|
|
8
|
+
| { readonly type: 'choice'; readonly criteria: readonly { readonly name: string; readonly description: string }[] }
|
|
9
|
+
| { readonly type: 'score'; readonly criteria: readonly string[] }
|
|
10
|
+
)
|
|
11
|
+
export interface DecisionExecutor {
|
|
12
|
+
readonly kind: 'decision'
|
|
13
|
+
readonly questions: readonly DecisionQuestion[]
|
|
14
|
+
}
|
|
15
|
+
export interface DecisionIssue {
|
|
16
|
+
readonly question?: number
|
|
17
|
+
readonly field: 'questions' | 'name' | 'instructions' | 'criteria' | 'ports'
|
|
18
|
+
readonly message: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const decisionModel = 'typesafe/jev'
|
|
22
|
+
export const decisionLimits = { choice: 255, score: 10 } as const
|
|
23
|
+
|
|
24
|
+
/** Ordered prefixes are shared by authoring, schemas, validation, and execution. */
|
|
25
|
+
export function limitDecisionQuestion(question: DecisionQuestion): DecisionQuestion {
|
|
26
|
+
if (question.type === 'noul' || question.criteria.length <= decisionLimits[question.type]) return question
|
|
27
|
+
if (question.type === 'choice') return { ...question, criteria: question.criteria.slice(0, decisionLimits.choice) }
|
|
28
|
+
return { ...question, criteria: question.criteria.slice(0, decisionLimits.score) }
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function limitDecisionQuestions(questions: readonly DecisionQuestion[]): readonly DecisionQuestion[] {
|
|
32
|
+
const limited = questions.map(limitDecisionQuestion)
|
|
33
|
+
return limited.every((question, i) => question === questions[i]) ? questions : limited
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Loading an oversized task also updates its previously generated output schemas. */
|
|
37
|
+
export function limitDecisionTask(task: ManagedTaskDefinition): ManagedTaskDefinition {
|
|
38
|
+
if (task.executor.kind !== 'decision') return task
|
|
39
|
+
const original = task.executor.questions
|
|
40
|
+
const questions = limitDecisionQuestions(original)
|
|
41
|
+
if (questions === original) return task
|
|
42
|
+
const outputs = task.outputs.map((port) => {
|
|
43
|
+
if (!('handle' in port)) return port
|
|
44
|
+
const index = original.findIndex((question) => question.name === port.handle)
|
|
45
|
+
if (index < 0 || original[index] === questions[index] || !dequal(port.jsonSchema, answerSchema(original[index]!))) return port
|
|
46
|
+
return { ...port, jsonSchema: decisionAnswerSchema(questions[index]!) }
|
|
47
|
+
})
|
|
48
|
+
return { ...task, executor: { ...task.executor, questions }, outputs }
|
|
49
|
+
}
|
|
50
|
+
export const decisionStateSchema: JsonValue = { type: ['string', 'object', 'array'] }
|
|
51
|
+
const probability: JsonValue = { type: 'number', minimum: 0, maximum: 1 }
|
|
52
|
+
export const defaultDecisionQuestion = (name = 'decision1'): DecisionQuestion => ({ name, type: 'noul', instructions: '' })
|
|
53
|
+
|
|
54
|
+
export function decisionQuestionIssues(questions: readonly DecisionQuestion[]): readonly DecisionIssue[] {
|
|
55
|
+
questions = limitDecisionQuestions(questions)
|
|
56
|
+
const issues: DecisionIssue[] = []
|
|
57
|
+
if (!questions.length) issues.push({ field: 'questions', message: 'Add at least one question.' })
|
|
58
|
+
questions.forEach((question, index) => {
|
|
59
|
+
const add = (field: DecisionIssue['field'], message: string) => issues.push({ question: index, field, message })
|
|
60
|
+
if (!question.name.trim() || question.name === '__proto__' || questions.some((other, i) => i !== index && other.name === question.name))
|
|
61
|
+
add('name', 'Question names must be non-empty and unique; __proto__ is reserved.')
|
|
62
|
+
if (!question.instructions.trim()) add('instructions', 'Describe the question to evaluate.')
|
|
63
|
+
if (question.type === 'choice') {
|
|
64
|
+
if (!question.criteria.length) add('criteria', 'Provide between 1 and 255 choices.')
|
|
65
|
+
const names = question.criteria.map((item) => item.name)
|
|
66
|
+
if (names.some((name) => !name.trim() || name === '__proto__') || new Set(names).size !== names.length)
|
|
67
|
+
add('criteria', 'Choice names must be non-empty and unique; __proto__ is reserved.')
|
|
68
|
+
}
|
|
69
|
+
if (question.type === 'score' && (question.criteria.length < 2 || question.criteria.some((level) => !level.trim())))
|
|
70
|
+
add('criteria', 'Provide between 2 and 10 non-empty levels, in increasing order.')
|
|
71
|
+
})
|
|
72
|
+
return issues
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function decisionAnswerSchema(question: DecisionQuestion): JsonValue {
|
|
76
|
+
return answerSchema(limitDecisionQuestion(question))
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function answerSchema(question: DecisionQuestion): JsonValue {
|
|
80
|
+
const properties: Record<string, JsonValue> = { type: { const: question.type } }
|
|
81
|
+
if (question.type === 'noul') properties.noul = probability
|
|
82
|
+
else {
|
|
83
|
+
const keys = question.type === 'choice' ? question.criteria.map((item) => item.name) : question.criteria.map((_, index) => String(index))
|
|
84
|
+
properties.confidence = probability
|
|
85
|
+
properties.probabilities = {
|
|
86
|
+
type: 'object',
|
|
87
|
+
properties: Object.fromEntries(keys.map((key) => [key, probability])),
|
|
88
|
+
required: keys,
|
|
89
|
+
additionalProperties: false,
|
|
90
|
+
}
|
|
91
|
+
if (question.type === 'choice') properties.choice = { type: 'string', ...(keys.length ? { enum: keys } : {}) }
|
|
92
|
+
else {
|
|
93
|
+
properties.score = { type: 'number', minimum: 0, maximum: Math.max(0, keys.length - 1) }
|
|
94
|
+
properties.legend = {
|
|
95
|
+
type: 'object',
|
|
96
|
+
properties: Object.fromEntries(keys.map((key) => [key, { type: 'string' }])),
|
|
97
|
+
required: keys,
|
|
98
|
+
additionalProperties: false,
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return { type: 'object', properties, required: Object.keys(properties) }
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function decisionTask(questions: readonly DecisionQuestion[] = [defaultDecisionQuestion()], name = 'AI Decision'): ManagedTaskDefinition {
|
|
106
|
+
questions = limitDecisionQuestions(questions)
|
|
107
|
+
const inputs: InputPort[] = [
|
|
108
|
+
{ handle: 'target', description: 'Text, object, or array to evaluate across all questions.', jsonSchema: decisionStateSchema, nullable: false },
|
|
109
|
+
]
|
|
110
|
+
const outputs: Port[] = questions.map((question) => ({ handle: question.name, jsonSchema: decisionAnswerSchema(question), nullable: false }))
|
|
111
|
+
return { name, executor: { kind: 'decision', questions }, inputs, outputs }
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function decisionTaskIssues(task: ManagedTaskDefinition): readonly DecisionIssue[] {
|
|
115
|
+
task = limitDecisionTask(task)
|
|
116
|
+
if (task.executor.kind !== 'decision') return []
|
|
117
|
+
const expected = decisionTask(task.executor.questions, task.name)
|
|
118
|
+
return [
|
|
119
|
+
...decisionQuestionIssues(task.executor.questions),
|
|
120
|
+
...(!dequal(task.inputs, expected.inputs) || !dequal(task.outputs, expected.outputs)
|
|
121
|
+
? [{ field: 'ports' as const, message: 'AI Decision ports must match its questions.' }]
|
|
122
|
+
: []),
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function decisionRequest(questions: readonly DecisionQuestion[], state: JsonValue): JsonValue {
|
|
127
|
+
questions = limitDecisionQuestions(questions)
|
|
128
|
+
const issues = decisionQuestionIssues(questions)
|
|
129
|
+
if (issues.length) throw new TypeError(issues[0]!.message)
|
|
130
|
+
if (!matchesSchema(state, decisionStateSchema)) throw new TypeError('Decision state must be text, an object, or an array.')
|
|
131
|
+
return {
|
|
132
|
+
model: decisionModel,
|
|
133
|
+
state,
|
|
134
|
+
questions: Object.fromEntries(
|
|
135
|
+
questions.map((question) => [
|
|
136
|
+
question.name,
|
|
137
|
+
{
|
|
138
|
+
type: question.type,
|
|
139
|
+
instructions: question.instructions,
|
|
140
|
+
...(question.type === 'choice'
|
|
141
|
+
? { criteria: Object.fromEntries(question.criteria.map((item) => [item.name, item.description || null])) }
|
|
142
|
+
: question.criteria == null
|
|
143
|
+
? {}
|
|
144
|
+
: { criteria: question.criteria }),
|
|
145
|
+
},
|
|
146
|
+
]),
|
|
147
|
+
),
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function decisionAnswers(questions: readonly DecisionQuestion[], response: unknown): Readonly<Record<string, JsonValue>> {
|
|
152
|
+
questions = limitDecisionQuestions(questions)
|
|
153
|
+
const source = response as { answers?: unknown } | null
|
|
154
|
+
const answers = source?.answers
|
|
155
|
+
if (answers == null || typeof answers !== 'object' || Array.isArray(answers)) throw new TypeError('The model returned no answers.')
|
|
156
|
+
return Object.fromEntries(
|
|
157
|
+
questions.map((question) => {
|
|
158
|
+
const answer = Object.hasOwn(answers, question.name) ? (answers as Record<string, JsonValue>)[question.name] : undefined
|
|
159
|
+
if (answer === undefined || !matchesSchema(answer, decisionAnswerSchema(question))) throw new TypeError(`Invalid answer for "${question.name}".`)
|
|
160
|
+
if (question.type !== 'noul') {
|
|
161
|
+
const distribution = (answer as Record<string, JsonValue>).probabilities as Record<string, number>
|
|
162
|
+
if (Math.abs(Object.values(distribution).reduce((sum, value) => sum + value, 0) - 1) > 0.0001)
|
|
163
|
+
throw new TypeError(`Invalid probability distribution for "${question.name}".`)
|
|
164
|
+
}
|
|
165
|
+
return [question.name, answer]
|
|
166
|
+
}),
|
|
167
|
+
)
|
|
168
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"key": "feishu_app_bot.on_event",
|
|
4
|
+
"kind": "feishu",
|
|
5
|
+
"provider": "feishu_app_bot",
|
|
6
|
+
"triggerId": "feishu_app_bot.on_event",
|
|
7
|
+
"maximumBodyBytes": 65536,
|
|
8
|
+
"applicationIngress": false,
|
|
9
|
+
"managed": false
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"key": "fireflies.on_meeting_ready",
|
|
13
|
+
"kind": "fireflies",
|
|
14
|
+
"provider": "fireflies",
|
|
15
|
+
"triggerId": "fireflies.on_meeting_ready",
|
|
16
|
+
"maximumBodyBytes": 65536,
|
|
17
|
+
"applicationIngress": false,
|
|
18
|
+
"managed": false
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"key": "intercom.on_conversation_event",
|
|
22
|
+
"kind": "intercom",
|
|
23
|
+
"provider": "intercom",
|
|
24
|
+
"triggerId": "intercom.on_conversation_event",
|
|
25
|
+
"maximumBodyBytes": 65536,
|
|
26
|
+
"applicationIngress": true,
|
|
27
|
+
"managed": false
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"key": "jira.on_issue_event",
|
|
31
|
+
"kind": "jira",
|
|
32
|
+
"provider": "jira",
|
|
33
|
+
"triggerId": "jira.on_issue_event",
|
|
34
|
+
"maximumBodyBytes": 65536,
|
|
35
|
+
"applicationIngress": false,
|
|
36
|
+
"managed": true
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"key": "sentry.on_issue_alert",
|
|
40
|
+
"kind": "sentry",
|
|
41
|
+
"provider": "sentry",
|
|
42
|
+
"triggerId": "sentry.on_issue_alert",
|
|
43
|
+
"maximumBodyBytes": 65536,
|
|
44
|
+
"applicationIngress": true,
|
|
45
|
+
"managed": false
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"key": "slackbot.on_event",
|
|
49
|
+
"kind": "slack",
|
|
50
|
+
"provider": "slackbot",
|
|
51
|
+
"triggerId": "slackbot.on_event",
|
|
52
|
+
"maximumBodyBytes": 65536,
|
|
53
|
+
"applicationIngress": true,
|
|
54
|
+
"managed": false
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"key": "zoom.on_recording_ready",
|
|
58
|
+
"kind": "zoom",
|
|
59
|
+
"provider": "zoom",
|
|
60
|
+
"triggerId": "zoom.on_recording_ready",
|
|
61
|
+
"maximumBodyBytes": 65536,
|
|
62
|
+
"applicationIngress": true,
|
|
63
|
+
"managed": false
|
|
64
|
+
}
|
|
65
|
+
]
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { JsonValue } from '../../flow/common/change.ts'
|
|
2
|
+
|
|
3
|
+
export interface SourceConfiguration {
|
|
4
|
+
readonly identity: string
|
|
5
|
+
readonly eventTypes: string[]
|
|
6
|
+
readonly config: Readonly<Record<string, JsonValue>>
|
|
7
|
+
readonly secrets: Readonly<Record<string, JsonValue>>
|
|
8
|
+
readonly state: Readonly<Record<string, JsonValue>>
|
|
9
|
+
}
|
|
10
|
+
export interface SourceEvent {
|
|
11
|
+
readonly ordering?: { readonly key: string; readonly version: number }
|
|
12
|
+
readonly id: string
|
|
13
|
+
readonly type: string
|
|
14
|
+
readonly payload: Readonly<Record<string, JsonValue>>
|
|
15
|
+
readonly matches: readonly string[]
|
|
16
|
+
}
|
|
17
|
+
export interface SourceSubscription {
|
|
18
|
+
readonly key: string
|
|
19
|
+
readonly config: Readonly<Record<string, JsonValue>>
|
|
20
|
+
}
|
|
21
|
+
export interface EventSourceDefinition {
|
|
22
|
+
readonly kind: string
|
|
23
|
+
readonly provider: string
|
|
24
|
+
readonly triggerId: string
|
|
25
|
+
readonly maximumBodyBytes: number
|
|
26
|
+
readonly applicationIngress: boolean
|
|
27
|
+
readonly managed: boolean
|
|
28
|
+
}
|
|
29
|
+
export type SourceOperation =
|
|
30
|
+
| { readonly action: 'initialize'; readonly input: Readonly<Record<string, JsonValue>> }
|
|
31
|
+
| { readonly action: 'update'; readonly source: SourceConfiguration; readonly input: Readonly<Record<string, JsonValue>> }
|
|
32
|
+
| { readonly action: 'inspect'; readonly source: SourceConfiguration }
|
|
33
|
+
| { readonly action: 'prepare'; readonly source: SourceConfiguration; readonly config: Readonly<Record<string, JsonValue>>; readonly endpointUrl?: string }
|
|
34
|
+
| {
|
|
35
|
+
readonly action: 'receive'
|
|
36
|
+
readonly source: SourceConfiguration
|
|
37
|
+
readonly headers: Readonly<Record<string, string>>
|
|
38
|
+
readonly rawBody: string
|
|
39
|
+
readonly consumers: readonly { readonly id: string; readonly config: Readonly<Record<string, JsonValue>> }[]
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export class SourceIdentityError extends Error {}
|
|
43
|
+
|
|
44
|
+
export interface SourceReference {
|
|
45
|
+
readonly applicationId: string
|
|
46
|
+
readonly sourceId: string
|
|
47
|
+
}
|
|
48
|
+
export type SourceReferenceOperation = { readonly deploymentId: string } & (
|
|
49
|
+
| { readonly action: 'route'; readonly applicationId: string; readonly headers: Readonly<Record<string, string>>; readonly rawBody: string }
|
|
50
|
+
| {
|
|
51
|
+
readonly action: 'create'
|
|
52
|
+
readonly requestKey: string
|
|
53
|
+
readonly input: Readonly<Record<string, JsonValue>>
|
|
54
|
+
}
|
|
55
|
+
| { readonly action: 'get'; readonly reference: SourceReference }
|
|
56
|
+
| { readonly action: 'delete'; readonly reference: SourceReference | { readonly appId?: string; readonly requestKey: string } }
|
|
57
|
+
| {
|
|
58
|
+
readonly action: 'update'
|
|
59
|
+
readonly reference: SourceReference
|
|
60
|
+
readonly expectedRevision: number
|
|
61
|
+
readonly input: Readonly<Record<string, JsonValue>>
|
|
62
|
+
}
|
|
63
|
+
| { readonly action: 'prepare'; readonly reference: SourceReference; readonly config: Readonly<Record<string, JsonValue>>; readonly endpointUrl?: string }
|
|
64
|
+
| { readonly action: 'resource'; readonly reference: SourceReference; readonly key: string; readonly active: boolean }
|
|
65
|
+
| ({ readonly action: 'receive'; readonly reference: SourceReference } & Omit<Extract<SourceOperation, { action: 'receive' }>, 'source' | 'action'>)
|
|
66
|
+
)
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { EventSourceDefinition, SourceConfiguration } from './definition.ts'
|
|
2
|
+
|
|
3
|
+
import { z } from 'zod'
|
|
4
|
+
import { eventSourceViewSchema } from '../../control/common/eventSources.ts'
|
|
5
|
+
import catalog from './catalog.generated.json' with { type: 'json' }
|
|
6
|
+
import { SourceIdentityError } from './definition.ts'
|
|
7
|
+
|
|
8
|
+
export type {
|
|
9
|
+
EventSourceDefinition,
|
|
10
|
+
SourceConfiguration,
|
|
11
|
+
SourceEvent,
|
|
12
|
+
SourceSubscription,
|
|
13
|
+
SourceOperation,
|
|
14
|
+
SourceReference,
|
|
15
|
+
SourceReferenceOperation,
|
|
16
|
+
} from './definition.ts'
|
|
17
|
+
export { SourceIdentityError } from './definition.ts'
|
|
18
|
+
|
|
19
|
+
export function eventSourceDefinition(kind: string): EventSourceDefinition {
|
|
20
|
+
for (const entry of catalog) if (entry.kind === kind) return entry
|
|
21
|
+
throw new SourceIdentityError(`Unknown event source kind: ${kind}`)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const jsonObject = z.record(z.string(), z.json())
|
|
25
|
+
const projectionSchema = z.object({ view: eventSourceViewSchema, ready: z.boolean(), expiresAt: z.number().optional() })
|
|
26
|
+
export const sourceConfigurationSchema = z.object({
|
|
27
|
+
identity: z.string().min(1),
|
|
28
|
+
eventTypes: z.array(z.string()),
|
|
29
|
+
config: jsonObject,
|
|
30
|
+
secrets: jsonObject,
|
|
31
|
+
state: jsonObject.refine((state) => projectionSchema.safeParse(state.projection).success, 'Connector source projection is invalid.'),
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
export function sourceReady(source: SourceConfiguration, now = Date.now()): boolean {
|
|
35
|
+
const projection = projectionSchema.safeParse(source.state.projection)
|
|
36
|
+
return projection.success && projection.data.ready && (projection.data.expiresAt == null || projection.data.expiresAt > now)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function sourceView(source: SourceConfiguration, now = Date.now()): z.infer<typeof eventSourceViewSchema> {
|
|
40
|
+
if (source.state.projection == null)
|
|
41
|
+
return {
|
|
42
|
+
appId: null,
|
|
43
|
+
manageSubscriptions: null,
|
|
44
|
+
verificationTokenConfigured: null,
|
|
45
|
+
encryptKeyConfigured: null,
|
|
46
|
+
verifiedAt: null,
|
|
47
|
+
lastError: 'Source details are unavailable. Restore Connector access and refresh to retry.',
|
|
48
|
+
}
|
|
49
|
+
const projection = projectionSchema.parse(source.state.projection)
|
|
50
|
+
const expired = projection.expiresAt != null && projection.expiresAt <= now
|
|
51
|
+
return {
|
|
52
|
+
...projection.view,
|
|
53
|
+
...(expired ? { subscriptionStatus: 'error', lastError: 'The source subscription expired. Restore Connector access and retry publication.' } : {}),
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const sourceResultSchema = z.object({ source: sourceConfigurationSchema })
|
|
58
|
+
export const preparedSourceSchema = sourceResultSchema.extend({ subscriptions: z.array(z.object({ key: z.string(), config: jsonObject })) })
|
|
59
|
+
export const sourceReceiptSchema = z
|
|
60
|
+
.object({
|
|
61
|
+
source: sourceConfigurationSchema.optional(),
|
|
62
|
+
response: z.object({ status: z.number().int().min(200).max(599), body: z.string(), headers: z.record(z.string(), z.string()) }).optional(),
|
|
63
|
+
event: z
|
|
64
|
+
.object({
|
|
65
|
+
id: z.string().min(1),
|
|
66
|
+
type: z.string().min(1),
|
|
67
|
+
payload: jsonObject,
|
|
68
|
+
matches: z.array(z.string()),
|
|
69
|
+
ordering: z.object({ key: z.string(), version: z.number() }).optional(),
|
|
70
|
+
})
|
|
71
|
+
.optional(),
|
|
72
|
+
})
|
|
73
|
+
.refine((value) => (value.response == null) !== (value.event == null))
|
|
74
|
+
|
|
75
|
+
export type SourceResult = z.infer<typeof sourceResultSchema>
|
|
76
|
+
export type PreparedSource = z.infer<typeof preparedSourceSchema>
|
|
77
|
+
export type SourceReceipt = z.infer<typeof sourceReceiptSchema>
|
|
78
|
+
|
|
79
|
+
export const sourceReferenceSchema = z.object({ applicationId: z.string().min(1), sourceId: z.string().min(1) })
|
|
80
|
+
export const sourceReferenceSnapshotSchema = projectionSchema.extend({
|
|
81
|
+
reference: sourceReferenceSchema,
|
|
82
|
+
revision: z.number().int().positive(),
|
|
83
|
+
eventTypes: z.array(z.string()),
|
|
84
|
+
})
|
|
85
|
+
export const sourceReferenceResultSchema = z.object({ source: sourceReferenceSnapshotSchema })
|
|
86
|
+
export const sourceReferenceDeleteResultSchema = z.object({ deleted: z.literal(true) })
|
|
87
|
+
export const sourceReferenceResourceResultSchema = sourceReferenceResultSchema.extend({ outcome: z.enum(['ready', 'pending']) })
|
|
88
|
+
export const sourceReferenceRouteResultSchema = z.object({
|
|
89
|
+
references: z.array(sourceReferenceSchema),
|
|
90
|
+
response: sourceReceiptSchema.shape.response,
|
|
91
|
+
})
|
|
92
|
+
export const preparedSourceReferenceSchema = sourceReferenceResultSchema.extend({ subscriptions: z.array(z.object({ key: z.string() })) })
|
|
93
|
+
export const sourceReferenceReceiptSchema = z
|
|
94
|
+
.object({
|
|
95
|
+
...sourceReceiptSchema.shape,
|
|
96
|
+
source: sourceReferenceSnapshotSchema.optional(),
|
|
97
|
+
})
|
|
98
|
+
.refine((value) => (value.response == null) !== (value.event == null))
|
|
99
|
+
export type SourceReferenceSnapshot = z.infer<typeof sourceReferenceSnapshotSchema>
|