@oomol-lab/open-flow 0.1.0-beta.73 → 0.1.0-beta.74
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 +40 -0
- package/dist/browser/{createResourceDialog-BWJkjiOO.js → createResourceDialog-DI9pL-Yr.js} +2 -2
- package/dist/browser/{dialog-CUy_fwx9.js → dialog-BYJGvItc.js} +54 -19
- package/dist/browser/{flowChanges-CgSnSqqP.js → flowChanges-RL-H4CjD.js} +306 -48
- package/dist/browser/{flowWorkspace-Bf7H-r0t.js → flowWorkspace-BkDsETj0.js} +20745 -20186
- package/dist/browser/preview.css +73 -3
- package/dist/browser/preview.js +21410 -20607
- package/dist/browser/{typeScriptSession-B0hC-C8y.js → typeScriptSession-CSRwWmZm.js} +1 -1
- package/dist/browser/ui.css +72 -2
- package/dist/browser/workbench.css +73 -3
- package/dist/browser/workbench.js +14 -76
- package/dist/browser/{workbenchSelect-C3e4J93X.js → workbenchSelect-BcWPWGzw.js} +1 -1
- package/dist/command/index.js +34 -34
- package/dist/common/authoring.d.ts +1 -1
- package/dist/common/authoringFields.d.ts +1 -1
- package/dist/common/authoringSchema.d.ts +28 -4
- 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 +61 -24
- package/dist/common/control-api.d.ts +4 -3
- package/dist/common/control-api.js +59 -22
- package/dist/common/control-requests.d.ts +2 -1
- package/dist/common/control-requests.js +204 -42
- 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 +3 -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 +75 -23
- 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 +77 -25
- package/dist/common/flow-connectionUsage.d.ts +1 -1
- package/dist/common/flow-encoding.d.ts +1 -1
- package/dist/common/flow-encoding.js +34 -16
- package/dist/common/flow-errorHandling.d.ts +1 -1
- package/dist/common/flow-graph.d.ts +1 -1
- 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 +1 -1
- package/dist/common/flow-semantics.d.ts +1 -1
- package/dist/common/flow-semantics.js +151 -32
- package/dist/common/flow-workflowFile.d.ts +1 -1
- package/dist/common/flowInspection.d.ts +3 -3
- 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 +2 -1
- package/dist/common/mcp.js +59 -22
- package/dist/common/openapi.d.ts +1 -1
- package/dist/common/poll-trigger.d.ts +1 -1
- package/dist/common/run-results.d.ts +8 -1
- package/dist/common/runtime-contract.d.ts +8 -2
- package/dist/common/runtime-contract.js +22 -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 +2 -2
- package/dist/common/scheduler.js +31 -12
- 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 -1
- package/dist/common/webhook-trigger.d.ts +1 -1
- 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 +7 -6
- 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 +1505 -0
- package/src/control/common/authoring.ts +912 -0
- package/src/control/common/authoringCondition.ts +110 -0
- package/src/control/common/authoringDiagnosticFields.ts +136 -0
- package/src/control/common/authoringExamples.ts +192 -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 +404 -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 +80 -0
- package/src/execution/common/events.ts +328 -0
- package/src/execution/common/node-execution.ts +467 -0
- package/src/execution/common/runLifecycle.ts +250 -0
- package/src/execution/common/runtime.ts +563 -0
- package/src/execution/common/scheduler.ts +696 -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 +1036 -0
- package/src/flow/common/changeSchema.ts +783 -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 +892 -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 +474 -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 +75 -0
- package/src/flow/common/workflowFile.ts +97 -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/authBindings.ts +12 -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 +412 -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,112 @@
|
|
|
1
|
+
import { canvasCommandSchema } from '../../canvas/common/commands.ts'
|
|
2
|
+
export { canvasCommandSchema } from '../../canvas/common/commands.ts'
|
|
3
|
+
import { authoringRequestSchema, authoringReadSchema, authoringSearchSchema, authoringSchemaQuery, authoringCheckSchema } from './authoringSchema.ts'
|
|
4
|
+
export * from './authoring.ts'
|
|
5
|
+
import type { JsonValue } from '../../flow/common/change.ts'
|
|
6
|
+
import type { DraftOperation } from './draftOperations.ts'
|
|
7
|
+
|
|
8
|
+
import { waitCommentSchema } from '../../execution/common/wait.ts'
|
|
9
|
+
import { decodeDraftOperations, draftOperationsSchema } from './draftOperations.ts'
|
|
10
|
+
export { decodeDraftOperations, draftOperationsSchema, resolveDraftOperations, type DraftOperation } from './draftOperations.ts'
|
|
11
|
+
import { z } from 'zod'
|
|
12
|
+
import { resourceNameIssue } from '../../flow/common/change.ts'
|
|
13
|
+
import { createEventSourceSchema, updateEventSourceSchema, eventSourceRevisionSchema } from './eventSourceSchemas.ts'
|
|
14
|
+
|
|
15
|
+
export const waitActionBodySchema: { parse(value: unknown): { comment?: string | null } } = z.strictObject({ comment: waitCommentSchema })
|
|
16
|
+
|
|
17
|
+
const json: z.ZodType<JsonValue> = z.json()
|
|
18
|
+
const id = z.string().min(1)
|
|
19
|
+
const version = z.literal(1)
|
|
20
|
+
const flowName = id.refine((value) => value == value.trim() && resourceNameIssue(value) == null, 'Flow name is invalid.')
|
|
21
|
+
const inputs = z.record(z.string(), z.record(z.string(), json))
|
|
22
|
+
const trigger = z.strictObject({ nodeId: id, outputs: z.record(z.string(), json) })
|
|
23
|
+
const schemas = {
|
|
24
|
+
canvas: z.strictObject({ command: canvasCommandSchema, version }),
|
|
25
|
+
authoringCheck: authoringCheckSchema,
|
|
26
|
+
authoringEdit: authoringRequestSchema,
|
|
27
|
+
authoringRead: authoringReadSchema,
|
|
28
|
+
authoringSearch: authoringSearchSchema,
|
|
29
|
+
authoringSchema: authoringSchemaQuery,
|
|
30
|
+
loadOpenApiDocument: z.strictObject({ url: z.string().min(1).max(8192), version }),
|
|
31
|
+
createEventSource: createEventSourceSchema,
|
|
32
|
+
updateEventSource: updateEventSourceSchema,
|
|
33
|
+
eventSourceRevision: eventSourceRevisionSchema,
|
|
34
|
+
importFlow: z.strictObject({ file: json, name: flowName.optional(), teamId: id.optional(), version }),
|
|
35
|
+
createFlow: z.strictObject({ name: flowName, teamId: id.optional(), version }),
|
|
36
|
+
renameFlow: z.strictObject({ name: flowName, version }),
|
|
37
|
+
changeDraft: z.strictObject({ expectedRevisionId: id, operations: z.array(json).min(1), version }),
|
|
38
|
+
repairDraft: z.strictObject({ expectedRevisionId: id, version }),
|
|
39
|
+
upgradeDraft: z.strictObject({ expectedRevisionId: id, version }),
|
|
40
|
+
setEnabled: z.strictObject({ enabled: z.boolean(), expectedPublicationId: id, version }),
|
|
41
|
+
updatePresentation: z.strictObject({ expectedRevision: z.int().positive(), value: z.record(z.string(), json), version }),
|
|
42
|
+
checkFlow: z.strictObject({ engineContract: id, version }),
|
|
43
|
+
publishFlow: z.strictObject({ engineContract: id, expectedLivePublicationId: id.nullable(), version }),
|
|
44
|
+
rollbackFlow: z.strictObject({ expectedLivePublicationId: id, version }),
|
|
45
|
+
createDraftRun: z.strictObject({ engineContract: id, inputs, trigger, version: z.literal(2) }),
|
|
46
|
+
createLiveRun: z.strictObject({ publicationId: id, inputs, trigger, version: z.literal(2) }),
|
|
47
|
+
resolveWait: z.strictObject({ action: z.enum(['approve', 'continue', 'reject']), comment: waitCommentSchema, version }),
|
|
48
|
+
putVariable: z.strictObject({
|
|
49
|
+
value: z.string().refine((value) => new TextEncoder().encode(value).byteLength <= 65_536, 'Variable value is too large.'),
|
|
50
|
+
}),
|
|
51
|
+
queryConnectorAccessCandidates: z.strictObject({
|
|
52
|
+
providerIds: z
|
|
53
|
+
.array(id.max(256))
|
|
54
|
+
.min(1)
|
|
55
|
+
.refine((ids) => new Set(ids).size == ids.length, 'Duplicate provider IDs.'),
|
|
56
|
+
version,
|
|
57
|
+
}),
|
|
58
|
+
removeConnectionUsage: z.strictObject({ connectionId: id, expectedRevisionId: id, expectedAccessRevision: z.int().nonnegative(), version }),
|
|
59
|
+
setConnectorService: z.strictObject({ expectedAccessRevision: z.int().nonnegative(), version }),
|
|
60
|
+
addProviderAccessBinding: z.strictObject({ accessBindingId: id, expectedAccessRevision: z.int().nonnegative(), version }),
|
|
61
|
+
removeProviderAccessBinding: z.strictObject({ accessBindingId: id, expectedAccessRevision: z.int().nonnegative(), version }),
|
|
62
|
+
versionOnly: z.strictObject({ version }),
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function decoder<Value>(schema: z.ZodType<Value>): (value: unknown) => Value {
|
|
66
|
+
return (value) => schema.parse(value)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const controlRequests = {
|
|
70
|
+
canvas: decoder(schemas.canvas),
|
|
71
|
+
authoringCheck: decoder(schemas.authoringCheck),
|
|
72
|
+
authoringEdit: decoder(schemas.authoringEdit),
|
|
73
|
+
authoringRead: decoder(schemas.authoringRead),
|
|
74
|
+
authoringSearch: decoder(schemas.authoringSearch),
|
|
75
|
+
authoringSchema: decoder(schemas.authoringSchema),
|
|
76
|
+
loadOpenApiDocument: decoder(schemas.loadOpenApiDocument),
|
|
77
|
+
createEventSource: decoder(schemas.createEventSource),
|
|
78
|
+
updateEventSource: decoder(schemas.updateEventSource),
|
|
79
|
+
eventSourceRevision: decoder(schemas.eventSourceRevision),
|
|
80
|
+
importFlow: decoder(schemas.importFlow),
|
|
81
|
+
createFlow: decoder(schemas.createFlow),
|
|
82
|
+
renameFlow: decoder(schemas.renameFlow),
|
|
83
|
+
changeDraft(value: unknown): { expectedRevisionId: string; operations: readonly DraftOperation[]; version: 1 } {
|
|
84
|
+
const body = schemas.changeDraft.parse(value)
|
|
85
|
+
return { ...body, operations: decodeDraftOperations(body.operations) }
|
|
86
|
+
},
|
|
87
|
+
repairDraft: decoder(schemas.repairDraft),
|
|
88
|
+
upgradeDraft: decoder(schemas.upgradeDraft),
|
|
89
|
+
setEnabled: decoder(schemas.setEnabled),
|
|
90
|
+
updatePresentation: decoder(schemas.updatePresentation),
|
|
91
|
+
checkFlow: decoder(schemas.checkFlow),
|
|
92
|
+
publishFlow: decoder(schemas.publishFlow),
|
|
93
|
+
rollbackFlow: decoder(schemas.rollbackFlow),
|
|
94
|
+
createDraftRun: decoder(schemas.createDraftRun),
|
|
95
|
+
createLiveRun: decoder(schemas.createLiveRun),
|
|
96
|
+
resolveWait: decoder(schemas.resolveWait),
|
|
97
|
+
putVariable: decoder(schemas.putVariable),
|
|
98
|
+
queryConnectorAccessCandidates: decoder(schemas.queryConnectorAccessCandidates),
|
|
99
|
+
removeConnectionUsage: decoder(schemas.removeConnectionUsage),
|
|
100
|
+
setConnectorService: decoder(schemas.setConnectorService),
|
|
101
|
+
addProviderAccessBinding: decoder(schemas.addProviderAccessBinding),
|
|
102
|
+
removeProviderAccessBinding: decoder(schemas.removeProviderAccessBinding),
|
|
103
|
+
versionOnly: decoder(schemas.versionOnly),
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function controlRequestSchema(name: keyof typeof controlRequests): JsonValue {
|
|
107
|
+
const schema = z.toJSONSchema(schemas[name], { io: 'input' })
|
|
108
|
+
if (name == 'changeDraft') return { ...schema, properties: { ...schema.properties, operations: draftOperationsSchema() } } as unknown as JsonValue
|
|
109
|
+
return schema as JsonValue
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export { authoringExample, authoringExamples } from './authoringExamples.ts'
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
export const resultQuerySchema = z.strictObject({
|
|
4
|
+
pointer: z.string().max(4096).default(''),
|
|
5
|
+
offset: z.number().int().nonnegative().default(0),
|
|
6
|
+
limit: z.number().int().min(1).max(100).default(20),
|
|
7
|
+
maxBytes: z.number().int().min(1).max(1048576).default(15000),
|
|
8
|
+
})
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import type { JsonValue } from '../../flow/common/change.ts'
|
|
2
|
+
|
|
3
|
+
import { z } from 'zod'
|
|
4
|
+
import { resultQuerySchema } from './resultQuery.ts'
|
|
5
|
+
|
|
6
|
+
const json: z.ZodType<JsonValue> = z.json()
|
|
7
|
+
const entry = z.object({
|
|
8
|
+
pointer: z.string(),
|
|
9
|
+
type: z.enum(['object', 'array', 'string', 'number', 'boolean', 'null']),
|
|
10
|
+
length: z.number().int().nonnegative().optional(),
|
|
11
|
+
complete: z.boolean(),
|
|
12
|
+
value: json.optional(),
|
|
13
|
+
})
|
|
14
|
+
const page = entry.extend({
|
|
15
|
+
offset: z.number().int().nonnegative(),
|
|
16
|
+
nextOffset: z.number().int().positive().optional(),
|
|
17
|
+
entries: z.array(entry).optional(),
|
|
18
|
+
})
|
|
19
|
+
const result = z.object({
|
|
20
|
+
resultId: z.string().min(1),
|
|
21
|
+
callId: z.string().min(1),
|
|
22
|
+
toolId: z.string().min(1),
|
|
23
|
+
source: z.discriminatedUnion('kind', [
|
|
24
|
+
z.object({ kind: z.literal('connector'), action: z.string().min(1) }),
|
|
25
|
+
z.object({ kind: z.literal('code') }),
|
|
26
|
+
z.object({ kind: z.literal('workflow'), flowId: z.string().min(1) }),
|
|
27
|
+
]),
|
|
28
|
+
bytes: z.number().int().nonnegative(),
|
|
29
|
+
digest: z.string().regex(/^[a-f0-9]{64}$/),
|
|
30
|
+
createdAt: z.string().datetime(),
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
export type ResultCall =
|
|
34
|
+
| { readonly id: string; readonly kind: 'connector'; readonly action: string; readonly connectionId?: string }
|
|
35
|
+
| { readonly id: string; readonly kind: 'code' }
|
|
36
|
+
| { readonly id: string; readonly kind: 'workflow'; readonly flowId: string }
|
|
37
|
+
|
|
38
|
+
export interface ResultInfo {
|
|
39
|
+
readonly resultId: string
|
|
40
|
+
readonly callId: string
|
|
41
|
+
readonly toolId: string
|
|
42
|
+
readonly source: { readonly kind: 'connector'; readonly action: string } | { readonly kind: 'code' } | { readonly kind: 'workflow'; readonly flowId: string }
|
|
43
|
+
readonly bytes: number
|
|
44
|
+
readonly digest: string
|
|
45
|
+
readonly createdAt: string
|
|
46
|
+
}
|
|
47
|
+
interface ResultEntry {
|
|
48
|
+
readonly pointer: string
|
|
49
|
+
readonly type: 'object' | 'array' | 'string' | 'number' | 'boolean' | 'null'
|
|
50
|
+
readonly length?: number
|
|
51
|
+
readonly complete: boolean
|
|
52
|
+
readonly value?: JsonValue
|
|
53
|
+
}
|
|
54
|
+
export interface ResultPage extends ResultEntry {
|
|
55
|
+
readonly offset: number
|
|
56
|
+
readonly nextOffset?: number
|
|
57
|
+
readonly entries?: readonly ResultEntry[]
|
|
58
|
+
}
|
|
59
|
+
export interface ResultQuery {
|
|
60
|
+
readonly pointer?: string
|
|
61
|
+
readonly offset?: number
|
|
62
|
+
readonly limit?: number
|
|
63
|
+
readonly maxBytes?: number
|
|
64
|
+
}
|
|
65
|
+
const listSchema = z.object({ version: z.literal(1), runId: z.string(), results: z.array(result), nextAfter: z.string().optional() })
|
|
66
|
+
const readSchema = z.object({ version: z.literal(1), runId: z.string(), result, page })
|
|
67
|
+
export function parseResultQuery(value: unknown): Required<ResultQuery> {
|
|
68
|
+
return resultQuerySchema.parse(value)
|
|
69
|
+
}
|
|
70
|
+
export function decodeResultList(value: unknown): {
|
|
71
|
+
readonly version: 1
|
|
72
|
+
readonly runId: string
|
|
73
|
+
readonly results: readonly ResultInfo[]
|
|
74
|
+
readonly nextAfter?: string
|
|
75
|
+
} {
|
|
76
|
+
return listSchema.parse(value)
|
|
77
|
+
}
|
|
78
|
+
export function decodeResultRead(value: unknown): { readonly version: 1; readonly runId: string; readonly result: ResultInfo; readonly page: ResultPage } {
|
|
79
|
+
return readSchema.parse(value)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const encoder = new TextEncoder()
|
|
83
|
+
function bytes(value: unknown): number {
|
|
84
|
+
return encoder.encode(JSON.stringify(value)).byteLength
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function describe(item: JsonValue, path: string): ResultEntry {
|
|
88
|
+
const type = item === null ? 'null' : Array.isArray(item) ? 'array' : (typeof item as 'object' | 'string' | 'number' | 'boolean')
|
|
89
|
+
return {
|
|
90
|
+
pointer: path,
|
|
91
|
+
type,
|
|
92
|
+
...(type == 'array' ? { length: (item as readonly JsonValue[]).length } : {}),
|
|
93
|
+
...(type == 'object' ? { length: Object.keys(item as object).length } : {}),
|
|
94
|
+
complete: false,
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function readResult(value: JsonValue, query: ResultQuery = {}): ResultPage {
|
|
99
|
+
const { pointer, offset, limit, maxBytes } = parseResultQuery(query)
|
|
100
|
+
let selected = value
|
|
101
|
+
if (pointer != '') {
|
|
102
|
+
if (!pointer.startsWith('/')) throw new Error('Result pointer must be a JSON Pointer.')
|
|
103
|
+
for (const part of pointer.slice(1).split('/')) {
|
|
104
|
+
if (/~(?:[^01]|$)/.test(part)) throw new Error('Result pointer has an invalid escape.')
|
|
105
|
+
const key = part.replace(/~1/g, '/').replace(/~0/g, '~')
|
|
106
|
+
if (selected == null || typeof selected != 'object' || !Object.hasOwn(selected, key)) throw new Error('Result path does not exist.')
|
|
107
|
+
if (Array.isArray(selected)) {
|
|
108
|
+
if (!/^(0|[1-9]\d*)$/.test(key)) throw new Error('Invalid result array index.')
|
|
109
|
+
selected = selected[Number(key)]!
|
|
110
|
+
} else selected = (selected as Readonly<Record<string, JsonValue>>)[key]!
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const description = describe(selected, pointer)
|
|
114
|
+
const whole = { ...description, complete: true, offset, value: selected }
|
|
115
|
+
if (
|
|
116
|
+
offset == 0 &&
|
|
117
|
+
(query.limit == null || description.length == null || description.length <= limit) &&
|
|
118
|
+
(typeof selected != 'string' || selected.length <= maxBytes) &&
|
|
119
|
+
bytes(whole) <= maxBytes
|
|
120
|
+
)
|
|
121
|
+
return whole
|
|
122
|
+
const root = description
|
|
123
|
+
if (typeof selected == 'string') {
|
|
124
|
+
let length = 0
|
|
125
|
+
let start = 0
|
|
126
|
+
for (let index = 0; index < selected.length; length++) {
|
|
127
|
+
if (length == offset) start = index
|
|
128
|
+
const point = selected.codePointAt(index)!
|
|
129
|
+
index += point > 0xffff ? 2 : 1
|
|
130
|
+
}
|
|
131
|
+
if (offset >= length) throw new Error('Result offset is out of range.')
|
|
132
|
+
const budget = maxBytes - bytes({ ...root, length, offset, value: '', nextOffset: length })
|
|
133
|
+
let used = 0
|
|
134
|
+
let cursor = start
|
|
135
|
+
let end = offset
|
|
136
|
+
while (cursor < selected.length) {
|
|
137
|
+
const point = selected.codePointAt(cursor)!
|
|
138
|
+
// JSON escapes controls and lone surrogates; valid pairs use four UTF-8 bytes.
|
|
139
|
+
let size
|
|
140
|
+
if (point == 0x22 || point == 0x5c || point == 8 || point == 9 || point == 10 || point == 12 || point == 13) size = 2
|
|
141
|
+
else if (point < 0x20 || (point >= 0xd800 && point <= 0xdfff)) size = 6
|
|
142
|
+
else if (point < 0x80) size = 1
|
|
143
|
+
else if (point < 0x800) size = 2
|
|
144
|
+
else if (point <= 0xffff) size = 3
|
|
145
|
+
else size = 4
|
|
146
|
+
if (used + size > budget) break
|
|
147
|
+
cursor += point > 0xffff ? 2 : 1
|
|
148
|
+
used += size
|
|
149
|
+
end++
|
|
150
|
+
}
|
|
151
|
+
const text = selected.slice(start, cursor)
|
|
152
|
+
if (end == offset) throw new Error('Result byte budget cannot fit a string character and page metadata.')
|
|
153
|
+
return { ...root, complete: offset == 0 && end == length, length, offset, value: text, ...(end < length ? { nextOffset: end } : {}) }
|
|
154
|
+
}
|
|
155
|
+
if (selected == null || typeof selected != 'object') throw new Error('Result cannot be paged.')
|
|
156
|
+
const keys = Object.keys(selected)
|
|
157
|
+
if (offset >= keys.length) throw new Error('Result offset is out of range.')
|
|
158
|
+
const entries: ResultEntry[] = []
|
|
159
|
+
const overhead = bytes({ ...root, offset, entries: [], nextOffset: keys.length })
|
|
160
|
+
let used = overhead
|
|
161
|
+
for (const key of keys.slice(offset, offset + limit)) {
|
|
162
|
+
const path = `${pointer}/${key.replace(/~/g, '~0').replace(/\//g, '~1')}`
|
|
163
|
+
const item = Array.isArray(selected) ? selected[Number(key)]! : (selected as Readonly<Record<string, JsonValue>>)[key]!
|
|
164
|
+
const metadata = describe(item, path)
|
|
165
|
+
const full = { ...metadata, complete: true, value: item }
|
|
166
|
+
const fullBytes = bytes(full)
|
|
167
|
+
const next = overhead + fullBytes <= maxBytes ? full : metadata
|
|
168
|
+
const size = (next === full ? fullBytes : bytes(metadata)) + (entries.length == 0 ? 0 : 1)
|
|
169
|
+
if (used + size > maxBytes) break
|
|
170
|
+
entries.push(next)
|
|
171
|
+
used += size
|
|
172
|
+
}
|
|
173
|
+
if (entries.length == 0) throw new Error('Result property name exceeds the preview limit. Download the full result.')
|
|
174
|
+
const end = offset + entries.length
|
|
175
|
+
return { ...root, offset, entries, ...(end < keys.length ? { nextOffset: end } : {}) }
|
|
176
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Draft, DraftChange, DraftSync, Presentation, RevisionMetadata } from './api.ts'
|
|
2
|
+
|
|
3
|
+
import { decodeRevisionContent } from '../../flow/common/encoding.ts'
|
|
4
|
+
import { integer, invalidResponse, jsonValue, record, string } from './decoding.ts'
|
|
5
|
+
|
|
6
|
+
function revisionMetadata(value: unknown): RevisionMetadata {
|
|
7
|
+
const source = record(value)
|
|
8
|
+
const parentRevisionId = source.parentRevisionId
|
|
9
|
+
if (source.version != 1 || (parentRevisionId !== null && typeof parentRevisionId != 'string')) return invalidResponse()
|
|
10
|
+
return {
|
|
11
|
+
actorId: string(source.actorId),
|
|
12
|
+
createdAt: string(source.createdAt),
|
|
13
|
+
digest: string(source.digest),
|
|
14
|
+
flowId: string(source.flowId),
|
|
15
|
+
modelVersion: integer(source.modelVersion),
|
|
16
|
+
parentRevisionId,
|
|
17
|
+
revisionId: string(source.revisionId),
|
|
18
|
+
version: 1,
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function draft(value: unknown): Draft {
|
|
23
|
+
const source = record(value)
|
|
24
|
+
try {
|
|
25
|
+
return { ...revisionMetadata(source), content: decodeRevisionContent(source.content) }
|
|
26
|
+
} catch {
|
|
27
|
+
return invalidResponse()
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function presentation(value: unknown): Presentation {
|
|
32
|
+
const source = record(value)
|
|
33
|
+
if (source.version != 1 || integer(source.revision) < 1) return invalidResponse()
|
|
34
|
+
return {
|
|
35
|
+
revision: integer(source.revision),
|
|
36
|
+
updatedAt: string(source.updatedAt),
|
|
37
|
+
value: Object.fromEntries(Object.entries(record(source.value)).map(([key, item]) => [key, jsonValue(item)])),
|
|
38
|
+
version: 1,
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function draftChange(value: unknown): DraftChange {
|
|
43
|
+
const source = record(value)
|
|
44
|
+
if (source.version != 1) return invalidResponse()
|
|
45
|
+
return { revision: revisionMetadata(source.revision), version: 1 }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function draftSync(value: unknown): DraftSync {
|
|
49
|
+
const source = record(value)
|
|
50
|
+
if (source.version != 1 || source.kind != 'snapshot') return invalidResponse()
|
|
51
|
+
return { draft: draft(source.draft), kind: 'snapshot', version: 1 }
|
|
52
|
+
}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import type { RunStatus } from '../../execution/common/runLifecycle.ts'
|
|
2
|
+
import type { JsonValue, WaitAction } from '../../flow/common/change.ts'
|
|
3
|
+
import type { Run, RunCancellation, RunChannel, RunDetails, RunInitiator, RunPage, RunResult } from './api.ts'
|
|
4
|
+
|
|
5
|
+
import { runStatuses } from '../../execution/common/runLifecycle.ts'
|
|
6
|
+
import { requiredFields, integer, invalidResponse, record, string } from './decoding.ts'
|
|
7
|
+
|
|
8
|
+
const runStatusSet: ReadonlySet<RunStatus> = new Set(runStatuses)
|
|
9
|
+
|
|
10
|
+
function runStatus(value: unknown): RunStatus {
|
|
11
|
+
return typeof value == 'string' && runStatusSet.has(value as RunStatus) ? (value as RunStatus) : invalidResponse()
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function run(value: unknown): Run {
|
|
15
|
+
const source = record(value)
|
|
16
|
+
const kind = source.source
|
|
17
|
+
const startedAt = source.startedAt
|
|
18
|
+
const finishedAt = source.finishedAt
|
|
19
|
+
if (source.version != 1 || (kind != 'draft' && kind != 'live')) return invalidResponse()
|
|
20
|
+
if (startedAt != null && typeof startedAt != 'string') return invalidResponse()
|
|
21
|
+
if (finishedAt != null && typeof finishedAt != 'string') return invalidResponse()
|
|
22
|
+
return {
|
|
23
|
+
createdAt: string(source.createdAt),
|
|
24
|
+
...(finishedAt == null ? {} : { finishedAt }),
|
|
25
|
+
flowId: string(source.flowId),
|
|
26
|
+
revisionId: string(source.revisionId),
|
|
27
|
+
runId: string(source.runId),
|
|
28
|
+
source: kind as Run['source'],
|
|
29
|
+
...(startedAt == null ? {} : { startedAt }),
|
|
30
|
+
status: runStatus(source.status),
|
|
31
|
+
version: 1,
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function runWaiting(value: unknown) {
|
|
36
|
+
const source = record(value)
|
|
37
|
+
requiredFields(source, ['actions', 'expiresAt', 'nodeId', 'prompt', 'waitId', 'waitingSince'])
|
|
38
|
+
const actions = source.actions
|
|
39
|
+
if (
|
|
40
|
+
!Array.isArray(actions) ||
|
|
41
|
+
!((actions.length == 1 && actions[0] == 'continue') || (actions.length == 2 && actions[0] == 'approve' && actions[1] == 'reject'))
|
|
42
|
+
) {
|
|
43
|
+
return invalidResponse()
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
actions: actions as unknown as readonly ['continue'] | readonly ['approve', 'reject'],
|
|
47
|
+
...(source.autoContinueAt === undefined ? {} : { autoContinueAt: string(source.autoContinueAt) }),
|
|
48
|
+
expiresAt: string(source.expiresAt),
|
|
49
|
+
nodeId: string(source.nodeId),
|
|
50
|
+
prompt: string(source.prompt),
|
|
51
|
+
waitId: string(source.waitId),
|
|
52
|
+
waitingSince: string(source.waitingSince),
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function workflowIdentity(value: unknown) {
|
|
57
|
+
const ref = record(value)
|
|
58
|
+
return {
|
|
59
|
+
flowId: string(ref.flowId),
|
|
60
|
+
runId: string(ref.runId),
|
|
61
|
+
nodeId: string(ref.nodeId),
|
|
62
|
+
executionId: string(ref.executionId),
|
|
63
|
+
...(ref.callId == null ? {} : { callId: string(ref.callId) }),
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function runInitiator(value: unknown): RunInitiator {
|
|
68
|
+
const source = record(value)
|
|
69
|
+
const channels: readonly RunChannel[] = ['workbench', 'cli', 'mcp', 'api', 'trigger', 'workflow']
|
|
70
|
+
if (!channels.includes(source.channel as RunChannel)) return invalidResponse()
|
|
71
|
+
return {
|
|
72
|
+
channel: source.channel as RunChannel,
|
|
73
|
+
...(source.actorId === undefined ? {} : { actorId: string(source.actorId) }),
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function runDetails(value: unknown): RunDetails {
|
|
78
|
+
const source = record(value)
|
|
79
|
+
const summary = run(source)
|
|
80
|
+
const eventsExpiresAt = source.eventsExpiresAt
|
|
81
|
+
if (eventsExpiresAt != null && typeof eventsExpiresAt != 'string') return invalidResponse()
|
|
82
|
+
if (source.waiting !== undefined || !Array.isArray(source.waits)) return invalidResponse()
|
|
83
|
+
const waits = source.waits.map(runWaiting)
|
|
84
|
+
if (
|
|
85
|
+
new Set(waits.map((wait) => wait.waitId)).size != waits.length ||
|
|
86
|
+
(summary.status == 'waiting' && waits.length == 0 && (!Array.isArray(source.calls) || source.calls.length == 0)) ||
|
|
87
|
+
(['completed', 'failed', 'canceled', 'indeterminate'].includes(summary.status) && waits.length > 0)
|
|
88
|
+
)
|
|
89
|
+
return invalidResponse()
|
|
90
|
+
if (source.occurrenceId !== undefined && source.triggerNodeId === undefined) return invalidResponse()
|
|
91
|
+
const state = { status: summary.status, waits }
|
|
92
|
+
if (source.calls !== undefined && !Array.isArray(source.calls)) return invalidResponse()
|
|
93
|
+
const details = {
|
|
94
|
+
...summary,
|
|
95
|
+
...(source.initiator === undefined ? {} : { initiator: runInitiator(source.initiator) }),
|
|
96
|
+
...errorHandling(source),
|
|
97
|
+
...(source.triggerNodeId === undefined ? {} : { triggerNodeId: string(source.triggerNodeId) }),
|
|
98
|
+
...(source.caller === undefined ? {} : { caller: workflowIdentity(source.caller) }),
|
|
99
|
+
...(source.calls === undefined
|
|
100
|
+
? {}
|
|
101
|
+
: {
|
|
102
|
+
calls: (source.calls as unknown[]).map((item) =>
|
|
103
|
+
Object.assign(workflowIdentity(item), { status: record(item).status === null ? null : runStatus(record(item).status) }),
|
|
104
|
+
),
|
|
105
|
+
}),
|
|
106
|
+
closureDigest: string(source.closureDigest),
|
|
107
|
+
engineContract: string(source.engineContract),
|
|
108
|
+
engineDigest: string(source.engineDigest),
|
|
109
|
+
...(eventsExpiresAt == null ? {} : { eventsExpiresAt }),
|
|
110
|
+
modelVersion: integer(source.modelVersion),
|
|
111
|
+
sharedAccessDigest: string(source.sharedAccessDigest),
|
|
112
|
+
revisionDigest: string(source.revisionDigest),
|
|
113
|
+
...state,
|
|
114
|
+
}
|
|
115
|
+
switch (summary.source) {
|
|
116
|
+
case 'draft':
|
|
117
|
+
return { ...details, source: 'draft' }
|
|
118
|
+
case 'live':
|
|
119
|
+
return {
|
|
120
|
+
...details,
|
|
121
|
+
publicationId: string(source.publicationId),
|
|
122
|
+
source: 'live',
|
|
123
|
+
...(source.occurrenceId === undefined ? {} : { occurrenceId: string(source.occurrenceId), triggerNodeId: string(source.triggerNodeId) }),
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function runPage(value: unknown): RunPage {
|
|
129
|
+
const source = record(value)
|
|
130
|
+
const nextCursor = source.nextCursor
|
|
131
|
+
if (source.version != 1 || !Array.isArray(source.runs)) return invalidResponse()
|
|
132
|
+
if (nextCursor != null && typeof nextCursor != 'string') return invalidResponse()
|
|
133
|
+
return {
|
|
134
|
+
flowId: string(source.flowId),
|
|
135
|
+
...(nextCursor == null ? {} : { nextCursor }),
|
|
136
|
+
runs: source.runs.map(run),
|
|
137
|
+
version: 1,
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export function runCancellation(value: unknown): RunCancellation {
|
|
142
|
+
const source = record(value)
|
|
143
|
+
const status = runStatus(source.status)
|
|
144
|
+
if (
|
|
145
|
+
source.version != 1 ||
|
|
146
|
+
typeof source.cancelAccepted != 'boolean' ||
|
|
147
|
+
status == 'queued' ||
|
|
148
|
+
status == 'starting' ||
|
|
149
|
+
status == 'running' ||
|
|
150
|
+
status == 'waiting'
|
|
151
|
+
) {
|
|
152
|
+
return invalidResponse()
|
|
153
|
+
}
|
|
154
|
+
return { cancelAccepted: source.cancelAccepted, runId: string(source.runId), status, version: 1 }
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export function waitResolution(value: unknown) {
|
|
158
|
+
const source = record(value)
|
|
159
|
+
requiredFields(source, ['action', 'comment', 'resolutionAccepted', 'resolvedAt', 'runId', 'status', 'version', 'waitId'])
|
|
160
|
+
const action = source.action
|
|
161
|
+
const resolvedAt = source.resolvedAt
|
|
162
|
+
if (
|
|
163
|
+
source.version != 1 ||
|
|
164
|
+
typeof source.resolutionAccepted != 'boolean' ||
|
|
165
|
+
(source.comment !== null && typeof source.comment != 'string') ||
|
|
166
|
+
(action !== null && action != 'approve' && action != 'continue' && action != 'reject') ||
|
|
167
|
+
(resolvedAt !== null && typeof resolvedAt != 'string') ||
|
|
168
|
+
(action === null) != (resolvedAt === null) ||
|
|
169
|
+
(source.resolutionAccepted && action === null)
|
|
170
|
+
) {
|
|
171
|
+
return invalidResponse()
|
|
172
|
+
}
|
|
173
|
+
return {
|
|
174
|
+
action: action as WaitAction | null,
|
|
175
|
+
comment: source.comment as string | null,
|
|
176
|
+
resolutionAccepted: source.resolutionAccepted,
|
|
177
|
+
resolvedAt: resolvedAt as string | null,
|
|
178
|
+
runId: string(source.runId),
|
|
179
|
+
status: runStatus(source.status),
|
|
180
|
+
version: 1 as const,
|
|
181
|
+
waitId: string(source.waitId),
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export function runResult(value: unknown): RunResult {
|
|
186
|
+
const source = record(value)
|
|
187
|
+
const status = source.status
|
|
188
|
+
if (source.version != 1) return invalidResponse()
|
|
189
|
+
const base = { finishedAt: string(source.finishedAt), runId: string(source.runId), version: 1 as const }
|
|
190
|
+
if (status == 'completed') {
|
|
191
|
+
if (!Object.hasOwn(source, 'result')) return invalidResponse()
|
|
192
|
+
return { ...base, result: source.result as JsonValue, status: 'completed' }
|
|
193
|
+
}
|
|
194
|
+
if (status == 'canceled') return { ...base, status: 'canceled' }
|
|
195
|
+
if (status == 'failed') {
|
|
196
|
+
const error = record(source.error)
|
|
197
|
+
return { ...base, error: runFailure(error), status: 'failed' }
|
|
198
|
+
}
|
|
199
|
+
if (status == 'indeterminate') {
|
|
200
|
+
const error = record(source.error)
|
|
201
|
+
return { ...base, error: runFailure(error), status: 'indeterminate' }
|
|
202
|
+
}
|
|
203
|
+
return invalidResponse()
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function errorHandling(source: Record<string, unknown>): Pick<RunDetails, 'errorDispatches' | 'errorSource'> {
|
|
207
|
+
const errorSource = source.errorSource == null ? undefined : record(source.errorSource)
|
|
208
|
+
if (source.errorDispatches != null && !Array.isArray(source.errorDispatches)) return invalidResponse()
|
|
209
|
+
return {
|
|
210
|
+
...(errorSource == null ? {} : { errorSource: { flowId: string(errorSource.flowId), runId: string(errorSource.runId) } }),
|
|
211
|
+
...(source.errorDispatches == null
|
|
212
|
+
? {}
|
|
213
|
+
: {
|
|
214
|
+
errorDispatches: (source.errorDispatches as unknown[]).map((value) => {
|
|
215
|
+
const dispatch = record(value)
|
|
216
|
+
const flowId = string(dispatch.flowId)
|
|
217
|
+
switch (dispatch.status) {
|
|
218
|
+
case 'pending':
|
|
219
|
+
return { status: 'pending' as const, flowId }
|
|
220
|
+
case 'dispatched':
|
|
221
|
+
return { status: 'dispatched' as const, flowId, runId: string(dispatch.runId) }
|
|
222
|
+
case 'failed':
|
|
223
|
+
return { status: 'failed' as const, flowId, message: string(dispatch.message) }
|
|
224
|
+
default:
|
|
225
|
+
return invalidResponse()
|
|
226
|
+
}
|
|
227
|
+
}),
|
|
228
|
+
}),
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export function runFailure(error: Record<string, unknown>) {
|
|
233
|
+
return {
|
|
234
|
+
code: string(error.code),
|
|
235
|
+
message: string(error.message),
|
|
236
|
+
...(error.nodeId === undefined ? {} : { nodeId: string(error.nodeId) }),
|
|
237
|
+
...(error.jobId === undefined ? {} : { jobId: string(error.jobId) }),
|
|
238
|
+
...(error.path === undefined ? {} : { path: (Array.isArray(error.path) ? error.path : invalidResponse()).map(string) }),
|
|
239
|
+
}
|
|
240
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { TriggerKeySnapshot } from '../../flow/common/change.ts'
|
|
2
|
+
import type { UiLanguage } from '../../localization/common/languages.ts'
|
|
3
|
+
import type { TriggerKeySummary } from './api.ts'
|
|
4
|
+
|
|
5
|
+
import { isUiLanguage } from '../../localization/common/languages.ts'
|
|
6
|
+
import { exact, requiredFields, invalidResponse, record, string } from './decoding.ts'
|
|
7
|
+
import { triggerKey } from './triggerDecoders.ts'
|
|
8
|
+
|
|
9
|
+
export interface TriggerDisplay {
|
|
10
|
+
readonly configInputs: Readonly<Record<string, string>>
|
|
11
|
+
readonly configInputLabels: Readonly<Record<string, string>>
|
|
12
|
+
readonly displayName: string
|
|
13
|
+
readonly description: string
|
|
14
|
+
readonly outputs: Readonly<Record<string, string>>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface TriggerCatalog {
|
|
18
|
+
readonly version: 3
|
|
19
|
+
readonly locale: UiLanguage
|
|
20
|
+
readonly definitions: readonly TriggerKeySnapshot[]
|
|
21
|
+
readonly display: Readonly<Record<string, TriggerDisplay>>
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface TriggerCatalogCache {
|
|
25
|
+
readonly data: TriggerCatalog
|
|
26
|
+
readonly etag: string | null
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function decodeTriggerCatalog(value: unknown): TriggerCatalog {
|
|
30
|
+
const source = record(value)
|
|
31
|
+
requiredFields(source, ['version', 'locale', 'definitions', 'display'])
|
|
32
|
+
if (source.version != 3 || !isUiLanguage(source.locale) || !Array.isArray(source.definitions)) return invalidResponse()
|
|
33
|
+
const definitions = source.definitions.map(triggerKey)
|
|
34
|
+
const entries = record(source.display)
|
|
35
|
+
const keys = new Set(definitions.map((definition) => definition.key))
|
|
36
|
+
if (keys.size != definitions.length || Object.keys(entries).length != keys.size) return invalidResponse()
|
|
37
|
+
const display = Object.fromEntries(
|
|
38
|
+
definitions.map((definition) => {
|
|
39
|
+
const { key } = definition
|
|
40
|
+
const copy = record(entries[key])
|
|
41
|
+
requiredFields(copy, ['configInputs', 'configInputLabels', 'displayName', 'description', 'outputs'])
|
|
42
|
+
return [
|
|
43
|
+
key,
|
|
44
|
+
{
|
|
45
|
+
configInputs: descriptions(
|
|
46
|
+
copy.configInputs,
|
|
47
|
+
definition.configInputs.flatMap((field) => ('handle' in field ? [field.handle] : [])),
|
|
48
|
+
),
|
|
49
|
+
configInputLabels: labels(
|
|
50
|
+
copy.configInputLabels,
|
|
51
|
+
definition.configInputs.flatMap((field) => ('handle' in field ? [field.handle] : [])),
|
|
52
|
+
),
|
|
53
|
+
displayName: string(copy.displayName),
|
|
54
|
+
description: string(copy.description),
|
|
55
|
+
outputs: descriptions(
|
|
56
|
+
copy.outputs,
|
|
57
|
+
definition.outputs.map((field) => field.handle),
|
|
58
|
+
),
|
|
59
|
+
},
|
|
60
|
+
]
|
|
61
|
+
}),
|
|
62
|
+
)
|
|
63
|
+
return { version: 3, locale: source.locale, definitions, display }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function descriptions(value: unknown, handles: readonly string[]): Readonly<Record<string, string>> {
|
|
67
|
+
const source = record(value)
|
|
68
|
+
exact(source, handles)
|
|
69
|
+
return Object.fromEntries(Object.entries(source).map(([handle, description]) => [handle, string(description)]))
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function labels(value: unknown, handles: readonly string[]): Readonly<Record<string, string>> {
|
|
73
|
+
const source = record(value)
|
|
74
|
+
if (Object.keys(source).some((handle) => !handles.includes(handle))) return invalidResponse()
|
|
75
|
+
return Object.fromEntries(
|
|
76
|
+
Object.entries(source).map(([handle, label]) => {
|
|
77
|
+
const text = string(label)
|
|
78
|
+
return text.trim().length == 0 ? invalidResponse() : [handle, text]
|
|
79
|
+
}),
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function searchTriggerKeys(keys: readonly TriggerKeySummary[], query?: string): readonly TriggerKeySummary[] {
|
|
84
|
+
if (query == null) return keys
|
|
85
|
+
const term = query.toLowerCase()
|
|
86
|
+
return keys.filter((item) =>
|
|
87
|
+
[item.description, item.displayName, item.key, item.name, item.provider, item.type].some((value) => value.toLowerCase().includes(term)),
|
|
88
|
+
)
|
|
89
|
+
}
|