@oomol-lab/open-flow 0.1.0-beta.72 → 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 +90 -42
- 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,88 @@
|
|
|
1
|
+
import type { DeepReadonly } from '../utils.ts'
|
|
2
|
+
|
|
3
|
+
import { deepFreeze } from '../utils.ts'
|
|
4
|
+
|
|
5
|
+
export type ExpressionResult = number
|
|
6
|
+
|
|
7
|
+
export const ExpressionSingleResult = Object.freeze({
|
|
8
|
+
Equals: 0,
|
|
9
|
+
Containing: 1,
|
|
10
|
+
ContainedBy: 2,
|
|
11
|
+
Rejection: 3,
|
|
12
|
+
Intersection: 4,
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
export type ExpressionSingleResult = (typeof ExpressionSingleResult)[keyof typeof ExpressionSingleResult]
|
|
16
|
+
|
|
17
|
+
export const ExpressionEquals = toExpression(ExpressionSingleResult.Equals)
|
|
18
|
+
export const ExpressionContaining = toExpression(ExpressionSingleResult.Containing)
|
|
19
|
+
export const ExpressionContainedBy = toExpression(ExpressionSingleResult.ContainedBy)
|
|
20
|
+
export const ExpressionRejection = toExpression(ExpressionSingleResult.Rejection)
|
|
21
|
+
export const ExpressionIntersection = toExpression(ExpressionSingleResult.Intersection)
|
|
22
|
+
|
|
23
|
+
export const ExpressionMaskList: DeepReadonly<[ExpressionSingleResult, ExpressionResult][]> = deepFreeze([
|
|
24
|
+
[ExpressionSingleResult.Equals, ExpressionEquals],
|
|
25
|
+
[ExpressionSingleResult.Containing, ExpressionContaining],
|
|
26
|
+
[ExpressionSingleResult.ContainedBy, ExpressionContainedBy],
|
|
27
|
+
[ExpressionSingleResult.Rejection, ExpressionRejection],
|
|
28
|
+
[ExpressionSingleResult.Intersection, ExpressionIntersection],
|
|
29
|
+
])
|
|
30
|
+
|
|
31
|
+
export const ExpressionNone = 0
|
|
32
|
+
export const ExpressionAny = ((): ExpressionResult => {
|
|
33
|
+
let expression = ExpressionNone
|
|
34
|
+
for (const [_, mask] of ExpressionMaskList) {
|
|
35
|
+
expression |= mask
|
|
36
|
+
}
|
|
37
|
+
return expression
|
|
38
|
+
})()
|
|
39
|
+
|
|
40
|
+
export function toString(expression: ExpressionResult): string {
|
|
41
|
+
const strList: string[] = [
|
|
42
|
+
hasEquals(expression) ? 'E' : '_',
|
|
43
|
+
hasContaining(expression) ? 'C' : '_',
|
|
44
|
+
hasContainedBy(expression) ? 'B' : '_',
|
|
45
|
+
hasRejection(expression) ? 'R' : '_',
|
|
46
|
+
hasIntersection(expression) ? 'I' : '_',
|
|
47
|
+
]
|
|
48
|
+
return strList.join('')
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function hasEquals(expression: ExpressionResult): boolean {
|
|
52
|
+
return !!(expression & ExpressionEquals)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function hasContaining(expression: ExpressionResult): boolean {
|
|
56
|
+
return !!(expression & ExpressionContaining)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function hasContainedBy(expression: ExpressionResult): boolean {
|
|
60
|
+
return !!(expression & ExpressionContainedBy)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function hasRejection(expression: ExpressionResult): boolean {
|
|
64
|
+
return !!(expression & ExpressionRejection)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function hasIntersection(expression: ExpressionResult): boolean {
|
|
68
|
+
return !!(expression & ExpressionIntersection)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function toExpression(expression: ExpressionSingleResult): ExpressionResult {
|
|
72
|
+
return 1 << expression
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function toSingleExpression(expression: ExpressionResult): ExpressionSingleResult | -1 {
|
|
76
|
+
let result: ExpressionSingleResult | -1 = -1
|
|
77
|
+
for (const [singleResult, mask] of ExpressionMaskList) {
|
|
78
|
+
if (mask & expression) {
|
|
79
|
+
if (result !== -1) {
|
|
80
|
+
// A second single result means that the expression is not singular.
|
|
81
|
+
result = -1
|
|
82
|
+
break
|
|
83
|
+
}
|
|
84
|
+
result = singleResult
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return result
|
|
88
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ExpressionResult } from './result.ts'
|
|
2
|
+
|
|
3
|
+
export type ExpressionDescription<E> =
|
|
4
|
+
| {
|
|
5
|
+
readonly kind: typeof ExpressionKind.Leaf
|
|
6
|
+
}
|
|
7
|
+
| {
|
|
8
|
+
readonly kind: typeof ExpressionKind.Not
|
|
9
|
+
readonly expression: E
|
|
10
|
+
}
|
|
11
|
+
| {
|
|
12
|
+
readonly kind: typeof ExpressionKind.AllOf | typeof ExpressionKind.AnyOf | typeof ExpressionKind.OneOf
|
|
13
|
+
readonly expressions: Iterable<E>
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const ExpressionKind = Object.freeze({
|
|
17
|
+
Leaf: 0,
|
|
18
|
+
Not: 1,
|
|
19
|
+
AllOf: 2,
|
|
20
|
+
AnyOf: 3,
|
|
21
|
+
OneOf: 4,
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
export type ExpressionKind = (typeof ExpressionKind)[keyof typeof ExpressionKind]
|
|
25
|
+
|
|
26
|
+
export type Calculator<E> = (e1: E, e2: E) => ExpressionResult
|
|
27
|
+
export type Equaler<E> = (e1: E, e2: E) => boolean
|
|
28
|
+
export type Describer<E> = (e: E) => ExpressionDescription<E>
|
|
29
|
+
export type CalculationObserver<E> = (e1: E, e2: E, result: ExpressionResult, swapped: boolean) => void
|
|
30
|
+
|
|
31
|
+
export type ExpressionDelegate<E> = {
|
|
32
|
+
readonly describe: Describer<E>
|
|
33
|
+
readonly equals: Equaler<E>
|
|
34
|
+
readonly calculate: Calculator<E>
|
|
35
|
+
readonly observeCalculation?: CalculationObserver<E> | undefined
|
|
36
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { ExpressionResult } from '../expression/index.ts'
|
|
2
|
+
import type { Schema } from '../types.ts'
|
|
3
|
+
import type { ExtendsSchema, ExtendsSchemaClass } from './types.ts'
|
|
4
|
+
|
|
5
|
+
import { toExpression, ExpressionNone, ExpressionSingleResult } from '../expression/index.ts'
|
|
6
|
+
import { createId } from '../utils.ts'
|
|
7
|
+
|
|
8
|
+
export class ExtendsContext {
|
|
9
|
+
private readonly extendsSchemaClasses: readonly ExtendsSchemaClass[]
|
|
10
|
+
|
|
11
|
+
public constructor(extendsSchemaClasses: readonly ExtendsSchemaClass[] = []) {
|
|
12
|
+
this.extendsSchemaClasses = Object.freeze([...extendsSchemaClasses])
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public tryCompiledExtendsSchema(target: object, payload?: unknown): ExtendsSchema | null {
|
|
16
|
+
for (const extendsSchemaClass of this.extendsSchemaClasses) {
|
|
17
|
+
if (extendsSchemaClass.isMatch(target)) {
|
|
18
|
+
return new extendsSchemaClass(createId(), target, payload)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return null
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public isExtendsSchema(target: object): target is ExtendsSchema {
|
|
25
|
+
for (const extendsSchemaClass of this.extendsSchemaClasses) {
|
|
26
|
+
if (target instanceof extendsSchemaClass) {
|
|
27
|
+
return true
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return false
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public calculate(schema1: Schema<unknown>, schema2: Schema<unknown>): ExpressionResult {
|
|
34
|
+
const schemaClass = this.findMatchedClass(schema1, schema2)
|
|
35
|
+
const shouldSwap = !(schema1 instanceof schemaClass)
|
|
36
|
+
|
|
37
|
+
let expressionResult: ExpressionResult = ExpressionNone
|
|
38
|
+
let result: readonly ExpressionSingleResult[]
|
|
39
|
+
|
|
40
|
+
if (shouldSwap) {
|
|
41
|
+
result = (schema2 as ExtendsSchema).compare(schema1)
|
|
42
|
+
} else {
|
|
43
|
+
result = schema1.compare(schema2)
|
|
44
|
+
}
|
|
45
|
+
for (let expression of result) {
|
|
46
|
+
if (shouldSwap) {
|
|
47
|
+
expression = ExtendsContext.swap(expression)
|
|
48
|
+
}
|
|
49
|
+
expressionResult |= toExpression(expression)
|
|
50
|
+
}
|
|
51
|
+
return expressionResult
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public equals(schema1: Schema<unknown>, schema2: Schema<unknown>): boolean {
|
|
55
|
+
const schemaClass = this.findMatchedClass(schema1, schema2)
|
|
56
|
+
const shouldSwap = !(schema1 instanceof schemaClass)
|
|
57
|
+
if (shouldSwap) {
|
|
58
|
+
return (schema2 as ExtendsSchema).equals(schema1)
|
|
59
|
+
} else {
|
|
60
|
+
return schema1.equals(schema2)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
private findMatchedClass(schema1: Schema<unknown>, schema2: Schema<unknown>): ExtendsSchemaClass {
|
|
65
|
+
for (const schemaClass of this.extendsSchemaClasses) {
|
|
66
|
+
if (schema1 instanceof schemaClass) {
|
|
67
|
+
return schemaClass
|
|
68
|
+
}
|
|
69
|
+
if (schema2 instanceof schemaClass) {
|
|
70
|
+
return schemaClass
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
throw new Error('Invalid schema')
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
private static swap(expression: ExpressionSingleResult): ExpressionSingleResult {
|
|
77
|
+
switch (expression) {
|
|
78
|
+
case ExpressionSingleResult.Containing: {
|
|
79
|
+
return ExpressionSingleResult.ContainedBy
|
|
80
|
+
}
|
|
81
|
+
case ExpressionSingleResult.ContainedBy: {
|
|
82
|
+
return ExpressionSingleResult.Containing
|
|
83
|
+
}
|
|
84
|
+
default: {
|
|
85
|
+
return expression
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ExpressionSingleResult } from '../expression/index.ts'
|
|
2
|
+
|
|
3
|
+
export interface ExtendsSchemaClass {
|
|
4
|
+
new (id: number, value: unknown, payload?: unknown): ExtendsSchema
|
|
5
|
+
isMatch(value: unknown): boolean
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface ExtendsSchema {
|
|
9
|
+
readonly id: number
|
|
10
|
+
compare(other: unknown): readonly ExpressionSingleResult[]
|
|
11
|
+
equals(other: unknown): boolean
|
|
12
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { CompilableSchema, InputSchema } from './compiler/index.ts'
|
|
2
|
+
import type { ExtendsSchemaClass } from './extends/index.ts'
|
|
3
|
+
import type { Compiler } from './preprocessing.ts'
|
|
4
|
+
import type { Schema } from './types.ts'
|
|
5
|
+
import type { JSONDelegate } from './types.ts'
|
|
6
|
+
|
|
7
|
+
import { checkWithResult } from './checker/checker.ts'
|
|
8
|
+
import { compile } from './compiler/index.ts'
|
|
9
|
+
import { hasContainedBy, hasContaining, hasEquals, hasIntersection, hasRejection } from './expression/index.ts'
|
|
10
|
+
import { ExtendsContext } from './extends/index.ts'
|
|
11
|
+
import { preprocessSchema, preprocessSchemasPair } from './preprocessing.ts'
|
|
12
|
+
|
|
13
|
+
export type MakingParams<E> = {
|
|
14
|
+
readonly extendsSchemaClasses?: readonly ExtendsSchemaClass[]
|
|
15
|
+
readonly delegate?: JSONDelegate<E>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface SubsetCompare<E> {
|
|
19
|
+
compile(schema: InputSchema, payload?: unknown, printWarnLog?: boolean): Schema<E>
|
|
20
|
+
isSubset(superSchema: CompilableSchema<E>, subSchema: CompilableSchema<E>, printWarnLog?: boolean): SubsetComparison
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface SubsetComparison {
|
|
24
|
+
readonly errorPath?: readonly (string | number)[] | undefined
|
|
25
|
+
readonly result: SubsetCompareResult
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const SubsetCompareResult = Object.freeze({
|
|
29
|
+
True: 0,
|
|
30
|
+
False: 1,
|
|
31
|
+
Unknown: 2,
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
export type SubsetCompareResult = (typeof SubsetCompareResult)[keyof typeof SubsetCompareResult]
|
|
35
|
+
|
|
36
|
+
export function makeSubsetCompare<E = unknown>({ extendsSchemaClasses, delegate }: MakingParams<E> = {}): SubsetCompare<E> {
|
|
37
|
+
const extendsContext = new ExtendsContext(extendsSchemaClasses)
|
|
38
|
+
const comparer: SubsetCompare<E> = Object.freeze({
|
|
39
|
+
compile: (schema: InputSchema, payload?: unknown, printWarnLog?: boolean): Schema<E> => {
|
|
40
|
+
const compiler: Compiler<E> = (candidate) => compile(candidate, extendsContext, payload, delegate)
|
|
41
|
+
return preprocessSchema(schema, compiler, printWarnLog)
|
|
42
|
+
},
|
|
43
|
+
isSubset: (superSchema: CompilableSchema<E>, subSchema: CompilableSchema<E>, printWarnLog = false): SubsetComparison => {
|
|
44
|
+
const compiler: Compiler<E> = (candidate) => compile(candidate, extendsContext, undefined, delegate)
|
|
45
|
+
const [schema1, schema2] = preprocessSchemasPair(superSchema, subSchema, compiler, printWarnLog)
|
|
46
|
+
const { errorPath, expression } = checkWithResult(extendsContext, schema1, schema2)
|
|
47
|
+
const foundTrueExpression = hasEquals(expression) || hasContainedBy(expression)
|
|
48
|
+
const foundFalseExpression = hasContaining(expression) || hasIntersection(expression) || hasRejection(expression)
|
|
49
|
+
|
|
50
|
+
if (foundTrueExpression && !foundFalseExpression) {
|
|
51
|
+
return { result: SubsetCompareResult.True }
|
|
52
|
+
}
|
|
53
|
+
if (!foundTrueExpression && foundFalseExpression) {
|
|
54
|
+
return { errorPath, result: SubsetCompareResult.False }
|
|
55
|
+
}
|
|
56
|
+
return { result: SubsetCompareResult.Unknown }
|
|
57
|
+
},
|
|
58
|
+
})
|
|
59
|
+
return comparer
|
|
60
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { SubsetCompare, SubsetComparison } from './global.ts'
|
|
2
|
+
export type { Schema, JSONDelegate } from './types.ts'
|
|
3
|
+
export type { ExtendsSchema, ExtendsSchemaClass } from './extends/index.ts'
|
|
4
|
+
export type { InputSchema, CompiledSchema } from './compiler/index.ts'
|
|
5
|
+
export type { SchemaError } from './error.ts'
|
|
6
|
+
|
|
7
|
+
export { ExpressionSingleResult } from './expression/index.ts'
|
|
8
|
+
export { makeSubsetCompare, SubsetCompareResult } from './global.ts'
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { CompilableSchema, CompileResult } from './compiler/index.ts'
|
|
2
|
+
import type { CompiledSchemaErrorItem, SchemaErrorItem } from './error.ts'
|
|
3
|
+
import type { Schema } from './types.ts'
|
|
4
|
+
|
|
5
|
+
import { SchemaError, stringifySchemaError } from './error.ts'
|
|
6
|
+
|
|
7
|
+
export type Compiler<E> = (schema: CompilableSchema<E>) => CompileResult<E> | readonly SchemaErrorItem<E>[]
|
|
8
|
+
|
|
9
|
+
export function preprocessSchema<E>(schema: CompilableSchema<E>, compile: Compiler<E>, printWarnLog = false): Schema<E> {
|
|
10
|
+
const schemaResult = compile(schema)
|
|
11
|
+
if (Array.isArray(schemaResult)) {
|
|
12
|
+
const errorItems: SchemaErrorItem[] = []
|
|
13
|
+
collectWithPathPrefix(errorItems, schemaResult, '$')
|
|
14
|
+
throw new SchemaError(errorItems)
|
|
15
|
+
}
|
|
16
|
+
const { schema: compiledSchema, warns } = schemaResult as CompileResult<E>
|
|
17
|
+
if (printWarnLog && warns.length > 0) {
|
|
18
|
+
console.warn(`found ${warns.length} warns after compile schema`)
|
|
19
|
+
for (const warn of warns) {
|
|
20
|
+
console.warn(stringifySchemaError(warn))
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return compiledSchema
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function preprocessSchemasPair<E>(
|
|
27
|
+
schema1: CompilableSchema<E>,
|
|
28
|
+
schema2: CompilableSchema<E>,
|
|
29
|
+
compile: Compiler<E>,
|
|
30
|
+
printWarnLog = false,
|
|
31
|
+
): [Schema<E>, Schema<E>] {
|
|
32
|
+
const schemaResult1 = compile(schema1)
|
|
33
|
+
const schemaResult2 = compile(schema2)
|
|
34
|
+
|
|
35
|
+
if (Array.isArray(schemaResult1) || Array.isArray(schemaResult2)) {
|
|
36
|
+
const errorItems: SchemaErrorItem[] = []
|
|
37
|
+
|
|
38
|
+
if (Array.isArray(schemaResult1)) {
|
|
39
|
+
collectWithPathPrefix(errorItems, schemaResult1, '$1')
|
|
40
|
+
}
|
|
41
|
+
if (Array.isArray(schemaResult2)) {
|
|
42
|
+
collectWithPathPrefix(errorItems, schemaResult2, '$2')
|
|
43
|
+
}
|
|
44
|
+
throw new SchemaError(errorItems)
|
|
45
|
+
}
|
|
46
|
+
const { schema: compiledSchema1, warns: superWarns } = schemaResult1 as CompileResult<E>
|
|
47
|
+
const { schema: compiledSchema2, warns: subWarns } = schemaResult2 as CompileResult<E>
|
|
48
|
+
|
|
49
|
+
if (printWarnLog) {
|
|
50
|
+
if (superWarns.length > 0) {
|
|
51
|
+
console.warn(`found ${superWarns.length} warns after compile superSchema`)
|
|
52
|
+
}
|
|
53
|
+
for (const warn of superWarns) {
|
|
54
|
+
console.warn(stringifySchemaError(warn))
|
|
55
|
+
}
|
|
56
|
+
if (subWarns.length > 0) {
|
|
57
|
+
console.warn(`found ${subWarns.length} warns after compile subSchema`)
|
|
58
|
+
}
|
|
59
|
+
for (const warn of subWarns) {
|
|
60
|
+
console.warn(stringifySchemaError(warn))
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return [compiledSchema1, compiledSchema2]
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function collectWithPathPrefix(errorItems: SchemaErrorItem[], compiledItems: readonly CompiledSchemaErrorItem[], prefix: number | string): void {
|
|
67
|
+
for (const compiledItem of compiledItems) {
|
|
68
|
+
const replacedItem: SchemaErrorItem = {
|
|
69
|
+
...compiledItem,
|
|
70
|
+
path: [prefix, ...compiledItem.path],
|
|
71
|
+
}
|
|
72
|
+
errorItems.push(replacedItem)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CompiledSchema } from './compiler/index.ts'
|
|
2
|
+
import type { ExtendsSchema } from './extends/index.ts'
|
|
3
|
+
|
|
4
|
+
export type Schema<E> = ExtendsSchema | CompiledSchema<E>
|
|
5
|
+
export interface JSONDelegate<E = unknown> {
|
|
6
|
+
isSchema(schema: object): boolean | readonly E[]
|
|
7
|
+
compile(schema: object): (value: unknown) => boolean | readonly E[]
|
|
8
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
export type DeepReadonly<T> = T extends (...args: never[]) => unknown ? T : T extends object ? { readonly [K in keyof T]: DeepReadonly<T[K]> } : T
|
|
2
|
+
|
|
3
|
+
let nextId = 0
|
|
4
|
+
|
|
5
|
+
export function createId(): number {
|
|
6
|
+
const id = nextId
|
|
7
|
+
nextId += 1
|
|
8
|
+
return id
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function deepFreeze<T>(target: T): DeepReadonly<T> {
|
|
12
|
+
if (typeof target === 'object' && target !== null && !Object.isFrozen(target)) {
|
|
13
|
+
for (const key of Object.getOwnPropertyNames(target)) {
|
|
14
|
+
const value: unknown = Reflect.get(target, key)
|
|
15
|
+
deepFreeze(value)
|
|
16
|
+
}
|
|
17
|
+
Object.freeze(target)
|
|
18
|
+
}
|
|
19
|
+
return target as DeepReadonly<T>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function pick<T extends object, K extends keyof T>(target: T, keys: Iterable<K>): { -readonly [P in K]: T[P] } {
|
|
23
|
+
const newTarget: Record<string | number | symbol, unknown> = {}
|
|
24
|
+
for (const key of keys) {
|
|
25
|
+
if (key in target) {
|
|
26
|
+
newTarget[key] = target[key]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return newTarget as Pick<T, K>
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function deepCopy<T>(value: T): T {
|
|
33
|
+
if (typeof value !== 'object' || value === null) {
|
|
34
|
+
return value
|
|
35
|
+
} else if (Array.isArray(value)) {
|
|
36
|
+
const array: unknown[] = []
|
|
37
|
+
for (const [i, element] of value.entries()) {
|
|
38
|
+
array[i] = deepCopy(element)
|
|
39
|
+
}
|
|
40
|
+
return array as T
|
|
41
|
+
} else {
|
|
42
|
+
const newObject: { [key: string]: unknown } = {}
|
|
43
|
+
for (const key in value) {
|
|
44
|
+
newObject[key] = deepCopy(value[key])
|
|
45
|
+
}
|
|
46
|
+
return newObject as T
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
51
|
+
export function isDeepEquals(value1: any, value2: any): boolean {
|
|
52
|
+
if (value1 === value2) {
|
|
53
|
+
return true
|
|
54
|
+
}
|
|
55
|
+
if (value1 === null) {
|
|
56
|
+
return false
|
|
57
|
+
}
|
|
58
|
+
if (typeof value1 !== 'object') {
|
|
59
|
+
return false
|
|
60
|
+
}
|
|
61
|
+
if (typeof value1 !== typeof value2) {
|
|
62
|
+
return false
|
|
63
|
+
}
|
|
64
|
+
if (Array.isArray(value1)) {
|
|
65
|
+
if (!Array.isArray(value2)) {
|
|
66
|
+
return false
|
|
67
|
+
}
|
|
68
|
+
if (value1.length !== value2.length) {
|
|
69
|
+
return false
|
|
70
|
+
}
|
|
71
|
+
for (const [i, value1Element] of value1.entries()) {
|
|
72
|
+
if (!isDeepEquals(value1Element, value2[i])) {
|
|
73
|
+
return false
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
if (Array.isArray(value2)) {
|
|
78
|
+
return false
|
|
79
|
+
}
|
|
80
|
+
for (const key in value1) {
|
|
81
|
+
if (!(key in value2)) {
|
|
82
|
+
return false
|
|
83
|
+
}
|
|
84
|
+
if (!isDeepEquals(value1[key], value2[key])) {
|
|
85
|
+
return false
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
for (const key in value2) {
|
|
89
|
+
if (!(key in value1)) {
|
|
90
|
+
return false
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return true
|
|
95
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
export const uiLanguages = ['en', 'zh-CN', 'zh-TW', 'ja', 'ko', 'ru', 'fr'] as const
|
|
2
|
+
|
|
3
|
+
export type UiLanguage = (typeof uiLanguages)[number]
|
|
4
|
+
|
|
5
|
+
export const defaultUiLanguage: UiLanguage = 'en'
|
|
6
|
+
|
|
7
|
+
/** Endonyms, shown in language pickers regardless of the current UI language. */
|
|
8
|
+
export const uiLanguageNames: Readonly<Record<UiLanguage, string>> = {
|
|
9
|
+
'en': 'English',
|
|
10
|
+
'zh-CN': '简体中文',
|
|
11
|
+
'zh-TW': '繁體中文',
|
|
12
|
+
'ja': '日本語',
|
|
13
|
+
'ko': '한국어',
|
|
14
|
+
'ru': 'Русский',
|
|
15
|
+
'fr': 'Français',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const uiLanguageTags: ReadonlyMap<string, UiLanguage> = new Map(uiLanguages.map((language) => [language.toLowerCase(), language]))
|
|
19
|
+
const traditionalChineseRegions: ReadonlySet<string> = new Set(['hk', 'mo', 'tw'])
|
|
20
|
+
const cjkLanguages: ReadonlySet<UiLanguage> = new Set<UiLanguage>(['zh-CN', 'zh-TW', 'ja', 'ko'])
|
|
21
|
+
|
|
22
|
+
export function isUiLanguage(value: unknown): value is UiLanguage {
|
|
23
|
+
return typeof value == 'string' && uiLanguageTags.get(value.toLowerCase()) == value
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* BCP 47 aware resolution over candidates such as `navigator.languages`: an exact tag match
|
|
28
|
+
* (case-insensitive) wins; for zh an explicit script subtag beats the region (zh-Hant-* to zh-TW,
|
|
29
|
+
* zh-Hans-* to zh-CN), then zh-TW, zh-HK and zh-MO map to zh-TW and any other zh* to zh-CN; en, ja,
|
|
30
|
+
* ko, ru and fr also match on their primary subtag (fr-CA to fr, ja-JP to ja).
|
|
31
|
+
*/
|
|
32
|
+
export function resolveUiLanguage(candidates: Iterable<string | null | undefined>, fallback: UiLanguage = defaultUiLanguage): UiLanguage {
|
|
33
|
+
for (const candidate of candidates) {
|
|
34
|
+
const language = candidate == null ? undefined : matchUiLanguage(candidate)
|
|
35
|
+
if (language != null) return language
|
|
36
|
+
}
|
|
37
|
+
return fallback
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Languages written with CJK scripts: zh-CN, zh-TW, ja and ko. */
|
|
41
|
+
export function isCjkLanguage(language: string): boolean {
|
|
42
|
+
const matched = matchUiLanguage(language)
|
|
43
|
+
return matched != null && cjkLanguages.has(matched)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Lookup order for package-author locale files (`oo-locales/<lang>.json`), which only exist for en
|
|
48
|
+
* and zh-CN today. Traditional Chinese readers prefer Simplified Chinese over English; every other
|
|
49
|
+
* language falls back to English first. The chain never repeats a locale.
|
|
50
|
+
*/
|
|
51
|
+
export function userLocaleFallbackChain(language: string): readonly string[] {
|
|
52
|
+
if (language == 'zh-TW') return ['zh-TW', 'zh-CN', 'en']
|
|
53
|
+
if (language == 'zh-CN') return ['zh-CN', 'en']
|
|
54
|
+
if (language == 'en') return ['en', 'zh-CN']
|
|
55
|
+
return [language, 'en', 'zh-CN']
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function matchUiLanguage(candidate: string): UiLanguage | undefined {
|
|
59
|
+
const tag = candidate.trim().toLowerCase()
|
|
60
|
+
if (tag.length == 0) return undefined
|
|
61
|
+
const exact = uiLanguageTags.get(tag)
|
|
62
|
+
if (exact != null) return exact
|
|
63
|
+
const subtags = tag.split('-')
|
|
64
|
+
if (subtags[0] == 'zh') {
|
|
65
|
+
if (subtags.includes('hant')) return 'zh-TW'
|
|
66
|
+
if (subtags.includes('hans')) return 'zh-CN'
|
|
67
|
+
return subtags.some((subtag) => traditionalChineseRegions.has(subtag)) ? 'zh-TW' : 'zh-CN'
|
|
68
|
+
}
|
|
69
|
+
return uiLanguageTags.get(subtags[0]!)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Resolve metadata query/header preferences using the same language mapping as the UI. */
|
|
73
|
+
export function resolveMetadataLanguage(query: string | undefined, acceptLanguage?: string): UiLanguage {
|
|
74
|
+
if (query != null) {
|
|
75
|
+
const canonical = Intl.getCanonicalLocales(query.trim())[0]
|
|
76
|
+
if (canonical == null) throw new RangeError('locale must be a valid BCP 47 language tag')
|
|
77
|
+
return resolveUiLanguage([canonical])
|
|
78
|
+
}
|
|
79
|
+
const candidates = (acceptLanguage ?? '').split(',').flatMap<{ tag: string; q: number; order: number; language: UiLanguage | undefined }>((part, order) => {
|
|
80
|
+
const [tag, ...parameters] = part.trim().split(';')
|
|
81
|
+
const quality = parameters
|
|
82
|
+
.find((parameter) => parameter.trim().startsWith('q='))
|
|
83
|
+
?.trim()
|
|
84
|
+
.slice(2)
|
|
85
|
+
const q = quality == null ? 1 : Number(quality)
|
|
86
|
+
if (!tag || !Number.isFinite(q) || q < 0 || q > 1) return []
|
|
87
|
+
if (tag == '*') return [{ tag, q, order, language: undefined }]
|
|
88
|
+
try {
|
|
89
|
+
const canonical = Intl.getCanonicalLocales(tag)[0]
|
|
90
|
+
const language = canonical == null ? undefined : matchUiLanguage(canonical)
|
|
91
|
+
return language == null ? [] : [{ tag, q, order, language }]
|
|
92
|
+
} catch {
|
|
93
|
+
return []
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
const preferences = uiLanguages
|
|
97
|
+
.flatMap((language) => {
|
|
98
|
+
const matches = candidates
|
|
99
|
+
.filter((candidate) => candidate.tag == '*' || candidate.language == language)
|
|
100
|
+
.toSorted((a, b) => (b.tag == '*' ? 0 : b.tag.split('-').length) - (a.tag == '*' ? 0 : a.tag.split('-').length) || a.order - b.order)
|
|
101
|
+
const candidate = matches[0]
|
|
102
|
+
return candidate == null || candidate.q == 0 ? [] : [{ language, q: candidate.q, order: candidate.order }]
|
|
103
|
+
})
|
|
104
|
+
.toSorted((a, b) => b.q - a.q || a.order - b.order)
|
|
105
|
+
return preferences[0]?.language ?? defaultUiLanguage
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function importedWorkflowName(language: UiLanguage): string {
|
|
109
|
+
return {
|
|
110
|
+
'en': 'Imported workflow',
|
|
111
|
+
'zh-CN': '导入的工作流',
|
|
112
|
+
'zh-TW': '匯入的工作流',
|
|
113
|
+
'ja': 'インポートしたワークフロー',
|
|
114
|
+
'ko': '가져온 워크플로',
|
|
115
|
+
'fr': 'Workflow importé',
|
|
116
|
+
'ru': 'Импортированный процесс',
|
|
117
|
+
}[language]
|
|
118
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Validate a named timezone using the same runtime data used for date conversion. */
|
|
2
|
+
export function isTimeZone(value: string): boolean {
|
|
3
|
+
try {
|
|
4
|
+
Intl.DateTimeFormat('en', { timeZone: value })
|
|
5
|
+
return true
|
|
6
|
+
} catch {
|
|
7
|
+
return false
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function timeZoneOffsetMinutes(timezone: string, at: Date = new Date()): number | undefined {
|
|
12
|
+
try {
|
|
13
|
+
const offset = new Intl.DateTimeFormat('en-US', { timeZone: timezone, timeZoneName: 'longOffset' })
|
|
14
|
+
.formatToParts(at)
|
|
15
|
+
.find((part) => part.type === 'timeZoneName')?.value
|
|
16
|
+
if (offset == null) return
|
|
17
|
+
if (offset === 'GMT') return 0
|
|
18
|
+
const match = /^GMT([+-])(\d{2}):(\d{2})$/.exec(offset)
|
|
19
|
+
if (match == null) return
|
|
20
|
+
const minutes = Number(match[2]) * 60 + Number(match[3])
|
|
21
|
+
return match[1] === '-' ? -minutes : minutes
|
|
22
|
+
} catch {
|
|
23
|
+
return
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FlowDocument } from '../../flow/common/change.ts'
|
|
2
|
+
|
|
3
|
+
/** Never allow credentials to enter a Revision as literal node inputs. */
|
|
4
|
+
export function assertOpenApiAuthBindings(document: FlowDocument): void {
|
|
5
|
+
for (const node of Object.values(document.graph.nodes)) {
|
|
6
|
+
if (node.kind != 'task' || !('executor' in node.task) || node.task.executor.kind != 'openapi') continue
|
|
7
|
+
for (const [handle, mapping] of Object.entries(node.inputs)) {
|
|
8
|
+
if (handle.startsWith('auth.') && mapping.kind == 'value')
|
|
9
|
+
throw new TypeError('OpenAPI authentication accepts deployment variables and upstream outputs only.')
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|