@flowrunner/cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +148 -0
- package/ai-docs/instructions/service-code-format/01-service-structure.md +180 -0
- package/ai-docs/instructions/service-code-format/02-zod-types.md +260 -0
- package/ai-docs/instructions/service-code-format/03-parameters.md +193 -0
- package/ai-docs/instructions/service-code-format/04-http-requests.md +257 -0
- package/ai-docs/instructions/service-code-format/05-dictionaries.md +103 -0
- package/ai-docs/instructions/service-code-format/06-oauth2.md +42 -0
- package/ai-docs/instructions/service-code-format/07-actions.md +171 -0
- package/ai-docs/instructions/service-code-format/08-polling-triggers.md +54 -0
- package/ai-docs/instructions/service-code-format/09-realtime-triggers.md +269 -0
- package/ai-docs/instructions/service-code-format/10-files-api.md +148 -0
- package/ai-docs/instructions/service-code-format/11-output-model.md +142 -0
- package/ai-docs/instructions/service-code-format/12-service-readme.md +69 -0
- package/ai-docs/instructions/service-code-format/13-runtime-contracts.md +193 -0
- package/ai-docs/instructions/service-code-format/14-reference-service.md +341 -0
- package/ai-docs/instructions/service-code-format/15-unit-tests.md +361 -0
- package/ai-docs/instructions/service-code-format/16-gotchas.md +201 -0
- package/ai-docs/instructions/service-code-format/17-client-certificates.md +162 -0
- package/ai-docs/instructions/service-code-format/18-test-recipes.md +160 -0
- package/ai-docs/instructions/service-code-format/README.md +120 -0
- package/ai-docs/providers/claude/agents/flowrunner-service-code-engineer.md +139 -0
- package/ai-docs/providers/claude/agents/flowrunner-service-test-engineer.md +497 -0
- package/ai-docs/providers/claude/main-orchestrator-segment.md +51 -0
- package/bin/flowrunner.js +66 -0
- package/bin/resolve-local.js +98 -0
- package/dist/cli.js +10972 -0
- package/dist/cli.js.map +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +10131 -0
- package/dist/index.js.map +7 -0
- package/dist/types/flow-extension-runner/src/common/config.d.ts +12 -0
- package/dist/types/flow-extension-runner/src/common/constants.d.ts +9 -0
- package/dist/types/flow-extension-runner/src/common/context-files.d.ts +107 -0
- package/dist/types/flow-extension-runner/src/common/context.d.ts +6 -0
- package/dist/types/flow-extension-runner/src/common/types.d.ts +11 -0
- package/dist/types/flow-extension-runner/src/errors/base.d.ts +17 -0
- package/dist/types/flow-extension-runner/src/errors/codes.d.ts +17 -0
- package/dist/types/flow-extension-runner/src/errors/errors.d.ts +48 -0
- package/dist/types/flow-extension-runner/src/errors/index.d.ts +3 -0
- package/dist/types/flow-extension-runner/src/global.d.ts +34 -0
- package/dist/types/flow-extension-runner/src/index.d.ts +15 -0
- package/dist/types/flow-extension-runner/src/namespace.d.ts +3 -0
- package/dist/types/flow-extension-runner/src/v1/config.d.ts +3 -0
- package/dist/types/flow-extension-runner/src/v1/constants.d.ts +4 -0
- package/dist/types/flow-extension-runner/src/v1/index.d.ts +11 -0
- package/dist/types/flow-extension-runner/src/v1/namespace.d.ts +9 -0
- package/dist/types/flow-extension-runner/src/v1/service.d.ts +29 -0
- package/dist/types/flow-extension-runner/src/v1/types.d.ts +13 -0
- package/dist/types/flow-extension-runner/src/v2/actions/action-method.d.ts +34 -0
- package/dist/types/flow-extension-runner/src/v2/context/execution-context.d.ts +25 -0
- package/dist/types/flow-extension-runner/src/v2/context/logger.d.ts +2 -0
- package/dist/types/flow-extension-runner/src/v2/context/method-input.d.ts +27 -0
- package/dist/types/flow-extension-runner/src/v2/context/proxies.d.ts +1 -0
- package/dist/types/flow-extension-runner/src/v2/create-extension.d.ts +2 -0
- package/dist/types/flow-extension-runner/src/v2/crypto.d.ts +6 -0
- package/dist/types/flow-extension-runner/src/v2/dictionaries/dictionary-method.d.ts +24 -0
- package/dist/types/flow-extension-runner/src/v2/dictionaries/payload-schema.d.ts +10 -0
- package/dist/types/flow-extension-runner/src/v2/extension.d.ts +51 -0
- package/dist/types/flow-extension-runner/src/v2/index.d.ts +39 -0
- package/dist/types/flow-extension-runner/src/v2/loaders/loader-method.d.ts +31 -0
- package/dist/types/flow-extension-runner/src/v2/loaders/loader-owner.d.ts +17 -0
- package/dist/types/flow-extension-runner/src/v2/loaders/payload-schema.d.ts +3 -0
- package/dist/types/flow-extension-runner/src/v2/method.d.ts +22 -0
- package/dist/types/flow-extension-runner/src/v2/model/field-mapper.d.ts +10 -0
- package/dist/types/flow-extension-runner/src/v2/model/method-model.d.ts +3 -0
- package/dist/types/flow-extension-runner/src/v2/model/model-types.d.ts +70 -0
- package/dist/types/flow-extension-runner/src/v2/model/params-model.d.ts +16 -0
- package/dist/types/flow-extension-runner/src/v2/oauth/method-names.d.ts +5 -0
- package/dist/types/flow-extension-runner/src/v2/oauth/oauth2.d.ts +9 -0
- package/dist/types/flow-extension-runner/src/v2/oauth/system-params.d.ts +6 -0
- package/dist/types/flow-extension-runner/src/v2/oauth/types.d.ts +54 -0
- package/dist/types/flow-extension-runner/src/v2/params/config-params.d.ts +14 -0
- package/dist/types/flow-extension-runner/src/v2/params/files-options.d.ts +58 -0
- package/dist/types/flow-extension-runner/src/v2/params/index.d.ts +19 -0
- package/dist/types/flow-extension-runner/src/v2/params/json/checks.d.ts +26 -0
- package/dist/types/flow-extension-runner/src/v2/params/json/decode.d.ts +24 -0
- package/dist/types/flow-extension-runner/src/v2/params/json/encode.d.ts +20 -0
- package/dist/types/flow-extension-runner/src/v2/params/json/types.d.ts +86 -0
- package/dist/types/flow-extension-runner/src/v2/params/json/values.d.ts +5 -0
- package/dist/types/flow-extension-runner/src/v2/params/method-params.d.ts +17 -0
- package/dist/types/flow-extension-runner/src/v2/params/params.d.ts +26 -0
- package/dist/types/flow-extension-runner/src/v2/params/schema/assert-object-schema.d.ts +6 -0
- package/dist/types/flow-extension-runner/src/v2/params/schema/assert-supported-schema.d.ts +8 -0
- package/dist/types/flow-extension-runner/src/v2/params/schema/coerce.d.ts +54 -0
- package/dist/types/flow-extension-runner/src/v2/params/schema/dates.d.ts +40 -0
- package/dist/types/flow-extension-runner/src/v2/params/schema/defaults.d.ts +36 -0
- package/dist/types/flow-extension-runner/src/v2/params/schema/field-plan.d.ts +33 -0
- package/dist/types/flow-extension-runner/src/v2/params/schema/introspect.d.ts +58 -0
- package/dist/types/flow-extension-runner/src/v2/params/schema/labels.d.ts +3 -0
- package/dist/types/flow-extension-runner/src/v2/params/schema/messages.d.ts +16 -0
- package/dist/types/flow-extension-runner/src/v2/params/schema/normalize.d.ts +8 -0
- package/dist/types/flow-extension-runner/src/v2/params/schema/parse.d.ts +7 -0
- package/dist/types/flow-extension-runner/src/v2/params/types.d.ts +29 -0
- package/dist/types/flow-extension-runner/src/v2/params/widget-types.d.ts +40 -0
- package/dist/types/flow-extension-runner/src/v2/params/zod.d.ts +86 -0
- package/dist/types/flow-extension-runner/src/v2/path.d.ts +1 -0
- package/dist/types/flow-extension-runner/src/v2/polling-triggers/mechanisms.d.ts +19 -0
- package/dist/types/flow-extension-runner/src/v2/polling-triggers/method-names.d.ts +1 -0
- package/dist/types/flow-extension-runner/src/v2/polling-triggers/polling-triggers.d.ts +11 -0
- package/dist/types/flow-extension-runner/src/v2/polling-triggers/system-params.d.ts +7 -0
- package/dist/types/flow-extension-runner/src/v2/polling-triggers/trigger-method.d.ts +25 -0
- package/dist/types/flow-extension-runner/src/v2/polling-triggers/types.d.ts +46 -0
- package/dist/types/flow-extension-runner/src/v2/realtime-triggers/method-names.d.ts +7 -0
- package/dist/types/flow-extension-runner/src/v2/realtime-triggers/realtime-setup.d.ts +10 -0
- package/dist/types/flow-extension-runner/src/v2/realtime-triggers/system-params.d.ts +29 -0
- package/dist/types/flow-extension-runner/src/v2/realtime-triggers/trigger-method.d.ts +33 -0
- package/dist/types/flow-extension-runner/src/v2/realtime-triggers/types.d.ts +147 -0
- package/dist/types/flow-extension-runner/src/v2/realtime-triggers/verify.d.ts +2 -0
- package/dist/types/flow-extension-runner/src/v2/registry.d.ts +20 -0
- package/dist/types/flow-extension-runner/src/v2/result.d.ts +13 -0
- package/dist/types/flow-extension-runner/src/v2/system-method.d.ts +41 -0
- package/dist/types/flow-extension-runner/src/v2/types.d.ts +126 -0
- package/dist/types/jsdoc-parser/src/custom-type-defs/files.d.ts +2 -0
- package/dist/types/jsdoc-parser/src/index.d.ts +2 -0
- package/dist/types/jsdoc-parser/src/lib.d.ts +42 -0
- package/dist/types/jsdoc-parser/src/types.d.ts +2 -0
- package/dist/types/packages/cli/src/api/console-client.d.ts +69 -0
- package/dist/types/packages/cli/src/constants/index.d.ts +5 -0
- package/dist/types/packages/cli/src/constants/packaging.d.ts +7 -0
- package/dist/types/packages/cli/src/constants/project.d.ts +9 -0
- package/dist/types/packages/cli/src/constants/providers.d.ts +30 -0
- package/dist/types/packages/cli/src/constants/server.d.ts +29 -0
- package/dist/types/packages/cli/src/constants/testing.d.ts +32 -0
- package/dist/types/packages/cli/src/errors.d.ts +131 -0
- package/dist/types/packages/cli/src/index.d.ts +29 -0
- package/dist/types/packages/cli/src/operations/deploy/discover-services.d.ts +26 -0
- package/dist/types/packages/cli/src/operations/deploy/hash.d.ts +1 -0
- package/dist/types/packages/cli/src/operations/deploy/index.d.ts +94 -0
- package/dist/types/packages/cli/src/operations/deploy/public-files.d.ts +20 -0
- package/dist/types/packages/cli/src/operations/deploy/select.d.ts +9 -0
- package/dist/types/packages/cli/src/operations/deploy/zip.d.ts +1 -0
- package/dist/types/packages/cli/src/operations/init/answers.d.ts +35 -0
- package/dist/types/packages/cli/src/operations/init/create-service.d.ts +39 -0
- package/dist/types/packages/cli/src/operations/init/index.d.ts +79 -0
- package/dist/types/packages/cli/src/operations/init/testing.d.ts +13 -0
- package/dist/types/packages/cli/src/operations/init-claude/index.d.ts +40 -0
- package/dist/types/packages/cli/src/operations/init-claude/segment.d.ts +25 -0
- package/dist/types/packages/cli/src/operations/login.d.ts +38 -0
- package/dist/types/packages/cli/src/operations/logout.d.ts +19 -0
- package/dist/types/packages/cli/src/operations/pull/extract.d.ts +23 -0
- package/dist/types/packages/cli/src/operations/pull/index.d.ts +87 -0
- package/dist/types/packages/cli/src/operations/server-target.d.ts +14 -0
- package/dist/types/packages/cli/src/operations/types.d.ts +20 -0
- package/dist/types/packages/cli/src/operations/use-server.d.ts +17 -0
- package/dist/types/packages/cli/src/project/auth.d.ts +41 -0
- package/dist/types/packages/cli/src/project/config.d.ts +31 -0
- package/dist/types/packages/cli/src/project/token.d.ts +5 -0
- package/dist/types/packages/cli/src/server/index.d.ts +14 -0
- package/dist/types/packages/cli/src/server/pages.d.ts +2 -0
- package/dist/types/packages/cli/src/server/routes/callback.d.ts +6 -0
- package/dist/types/packages/cli/src/server/types.d.ts +12 -0
- package/dist/types/packages/cli/src/templates/index.d.ts +8 -0
- package/dist/types/packages/cli/src/templates/manifest.d.ts +97 -0
- package/dist/types/packages/cli/src/templates/package-root.d.ts +3 -0
- package/dist/types/packages/cli/src/templates/paths.d.ts +3 -0
- package/dist/types/packages/cli/src/templates/registry.d.ts +13 -0
- package/dist/types/packages/cli/src/templates/render.d.ts +13 -0
- package/dist/types/packages/cli/src/templates/scaffold.d.ts +25 -0
- package/dist/types/packages/cli/src/utils/invocation.d.ts +28 -0
- package/dist/types/packages/cli/src/utils/open-browser.d.ts +2 -0
- package/dist/types/shared/src/constants/ai-agent-tools.d.ts +20 -0
- package/dist/types/shared/src/constants/ai.d.ts +11 -0
- package/dist/types/shared/src/constants/api-keys.d.ts +1 -0
- package/dist/types/shared/src/constants/app.d.ts +58 -0
- package/dist/types/shared/src/constants/billing.d.ts +16 -0
- package/dist/types/shared/src/constants/compliances.d.ts +3 -0
- package/dist/types/shared/src/constants/data-types.d.ts +26 -0
- package/dist/types/shared/src/constants/error-codes.d.ts +16 -0
- package/dist/types/shared/src/constants/flow.d.ts +12 -0
- package/dist/types/shared/src/constants/index.d.ts +16 -0
- package/dist/types/shared/src/constants/knowledge-base.d.ts +13 -0
- package/dist/types/shared/src/constants/notification-types.d.ts +985 -0
- package/dist/types/shared/src/constants/notifications.d.ts +10 -0
- package/dist/types/shared/src/constants/patterns.d.ts +28 -0
- package/dist/types/shared/src/constants/retry-policy.d.ts +30 -0
- package/dist/types/shared/src/constants/severity.d.ts +9 -0
- package/dist/types/shared/src/constants/shared-extensions-search.d.ts +6 -0
- package/dist/types/shared/src/constants/shared-extensions.d.ts +35 -0
- package/dist/types/shared/src/constants/zod.d.ts +2 -0
- package/dist/types/shared/src/errors/api.d.ts +4 -0
- package/dist/types/shared/src/errors/base.d.ts +38 -0
- package/dist/types/shared/src/errors/common.d.ts +39 -0
- package/dist/types/shared/src/errors/index.d.ts +13 -0
- package/dist/types/shared/src/errors/k8s.d.ts +4 -0
- package/dist/types/shared/src/errors/message.d.ts +48 -0
- package/dist/types/shared/src/errors/open-search.d.ts +4 -0
- package/dist/types/shared/src/errors/s3.d.ts +11 -0
- package/dist/types/shared/src/extensions/zod.d.ts +25 -0
- package/dist/types/shared/src/scheme/account/dto.d.ts +60 -0
- package/dist/types/shared/src/scheme/account/index.d.ts +1 -0
- package/dist/types/shared/src/scheme/ai-agent-tools/dto.d.ts +69 -0
- package/dist/types/shared/src/scheme/ai-agent-tools/index.d.ts +2 -0
- package/dist/types/shared/src/scheme/ai-agent-tools/parameters.d.ts +7 -0
- package/dist/types/shared/src/scheme/ai-router/dto.d.ts +23 -0
- package/dist/types/shared/src/scheme/ai-router/index.d.ts +2 -0
- package/dist/types/shared/src/scheme/api-keys/dto.d.ts +28 -0
- package/dist/types/shared/src/scheme/api-keys/index.d.ts +2 -0
- package/dist/types/shared/src/scheme/app/index.d.ts +1 -0
- package/dist/types/shared/src/scheme/app/java.dto.d.ts +6 -0
- package/dist/types/shared/src/scheme/billing/index.d.ts +1 -0
- package/dist/types/shared/src/scheme/billing/java.dto.d.ts +163 -0
- package/dist/types/shared/src/scheme/crm/billing.d.ts +149 -0
- package/dist/types/shared/src/scheme/crm/dto.d.ts +212 -0
- package/dist/types/shared/src/scheme/crm/index.d.ts +3 -0
- package/dist/types/shared/src/scheme/data-types/index.d.ts +1 -0
- package/dist/types/shared/src/scheme/data-types/java.dto.d.ts +23 -0
- package/dist/types/shared/src/scheme/dynamic-forms/dto.d.ts +30 -0
- package/dist/types/shared/src/scheme/dynamic-forms/index.d.ts +2 -0
- package/dist/types/shared/src/scheme/extensions/index.d.ts +1 -0
- package/dist/types/shared/src/scheme/extensions/params-to-zod.d.ts +14 -0
- package/dist/types/shared/src/scheme/flowrunner/custom-elements.d.ts +368 -0
- package/dist/types/shared/src/scheme/flowrunner/index.d.ts +3 -0
- package/dist/types/shared/src/scheme/flowrunner/java.dto.d.ts +628 -0
- package/dist/types/shared/src/scheme/index.d.ts +19 -0
- package/dist/types/shared/src/scheme/integration-connection/dto.d.ts +81 -0
- package/dist/types/shared/src/scheme/integration-connection/index.d.ts +2 -0
- package/dist/types/shared/src/scheme/knowledge-base/dto.d.ts +540 -0
- package/dist/types/shared/src/scheme/knowledge-base/index.d.ts +2 -0
- package/dist/types/shared/src/scheme/mcp-oauth/dto.d.ts +7 -0
- package/dist/types/shared/src/scheme/mcp-oauth/index.d.ts +2 -0
- package/dist/types/shared/src/scheme/notifications/dto.d.ts +111 -0
- package/dist/types/shared/src/scheme/notifications/index.d.ts +3 -0
- package/dist/types/shared/src/scheme/notifications/rest.d.ts +148 -0
- package/dist/types/shared/src/scheme/properties/account.d.ts +3 -0
- package/dist/types/shared/src/scheme/properties/app.d.ts +5 -0
- package/dist/types/shared/src/scheme/properties/billing.d.ts +12 -0
- package/dist/types/shared/src/scheme/properties/common.d.ts +2 -0
- package/dist/types/shared/src/scheme/properties/db.d.ts +8 -0
- package/dist/types/shared/src/scheme/properties/flow-extensions.d.ts +7 -0
- package/dist/types/shared/src/scheme/properties/index.d.ts +7 -0
- package/dist/types/shared/src/scheme/remote-mcp-server/dto.d.ts +278 -0
- package/dist/types/shared/src/scheme/remote-mcp-server/index.d.ts +2 -0
- package/dist/types/shared/src/scheme/shared-extensions/base.d.ts +56 -0
- package/dist/types/shared/src/scheme/shared-extensions/config.d.ts +96 -0
- package/dist/types/shared/src/scheme/shared-extensions/custom-extensions.d.ts +485 -0
- package/dist/types/shared/src/scheme/shared-extensions/extension.d.ts +387 -0
- package/dist/types/shared/src/scheme/shared-extensions/flow-extensions.d.ts +64 -0
- package/dist/types/shared/src/scheme/shared-extensions/index.d.ts +15 -0
- package/dist/types/shared/src/scheme/shared-extensions/light.d.ts +38 -0
- package/dist/types/shared/src/scheme/shared-extensions/logs.d.ts +21 -0
- package/dist/types/shared/src/scheme/shared-extensions/methods.d.ts +80 -0
- package/dist/types/shared/src/scheme/shared-extensions/params-schema.d.ts +47 -0
- package/dist/types/shared/src/scheme/shared-extensions/popular-pool.d.ts +11 -0
- package/dist/types/shared/src/scheme/shared-extensions/resolve.d.ts +364 -0
- package/dist/types/shared/src/scheme/shared-extensions/rest.d.ts +9 -0
- package/dist/types/shared/src/scheme/shared-extensions/search.d.ts +177 -0
- package/dist/types/shared/src/scheme/shared-extensions/service-identity.d.ts +10 -0
- package/dist/types/shared/src/scheme/shared-extensions/service-info.d.ts +15 -0
- package/dist/types/shared/src/scheme/workspace/dto.d.ts +40 -0
- package/dist/types/shared/src/scheme/workspace/index.d.ts +1 -0
- package/dist/types/shared/src/utils/object.d.ts +8 -0
- package/dist/types/shared/src/utils/uuid.d.ts +5 -0
- package/dist/types/shared/src/utils/versions.d.ts +4 -0
- package/dist/types/types/backendless-request.d.ts +40 -0
- package/package.json +66 -0
- package/project-files/jest.config.js +38 -0
- package/project-files/jest.setup.js +24 -0
- package/project-files/sandbox/files-mock.js +654 -0
- package/project-files/sandbox/index.js +32 -0
- package/project-files/sandbox/nock-mock.js +600 -0
- package/project-files/sandbox/service.js +145 -0
- package/runtime/index.d.ts +2 -0
- package/runtime/index.js +5665 -0
- package/runtime/index.js.map +7 -0
- package/runtime/types/flow-extension-runner/src/common/config.d.ts +12 -0
- package/runtime/types/flow-extension-runner/src/common/constants.d.ts +9 -0
- package/runtime/types/flow-extension-runner/src/common/context-files.d.ts +107 -0
- package/runtime/types/flow-extension-runner/src/common/context.d.ts +6 -0
- package/runtime/types/flow-extension-runner/src/common/types.d.ts +11 -0
- package/runtime/types/flow-extension-runner/src/errors/base.d.ts +17 -0
- package/runtime/types/flow-extension-runner/src/errors/codes.d.ts +17 -0
- package/runtime/types/flow-extension-runner/src/errors/errors.d.ts +48 -0
- package/runtime/types/flow-extension-runner/src/errors/index.d.ts +3 -0
- package/runtime/types/flow-extension-runner/src/global.d.ts +34 -0
- package/runtime/types/flow-extension-runner/src/index.d.ts +15 -0
- package/runtime/types/flow-extension-runner/src/namespace.d.ts +3 -0
- package/runtime/types/flow-extension-runner/src/v1/config.d.ts +3 -0
- package/runtime/types/flow-extension-runner/src/v1/constants.d.ts +4 -0
- package/runtime/types/flow-extension-runner/src/v1/index.d.ts +11 -0
- package/runtime/types/flow-extension-runner/src/v1/namespace.d.ts +9 -0
- package/runtime/types/flow-extension-runner/src/v1/service.d.ts +29 -0
- package/runtime/types/flow-extension-runner/src/v1/types.d.ts +13 -0
- package/runtime/types/flow-extension-runner/src/v2/actions/action-method.d.ts +34 -0
- package/runtime/types/flow-extension-runner/src/v2/context/execution-context.d.ts +25 -0
- package/runtime/types/flow-extension-runner/src/v2/context/logger.d.ts +2 -0
- package/runtime/types/flow-extension-runner/src/v2/context/method-input.d.ts +27 -0
- package/runtime/types/flow-extension-runner/src/v2/context/proxies.d.ts +1 -0
- package/runtime/types/flow-extension-runner/src/v2/create-extension.d.ts +2 -0
- package/runtime/types/flow-extension-runner/src/v2/crypto.d.ts +6 -0
- package/runtime/types/flow-extension-runner/src/v2/dictionaries/dictionary-method.d.ts +24 -0
- package/runtime/types/flow-extension-runner/src/v2/dictionaries/payload-schema.d.ts +10 -0
- package/runtime/types/flow-extension-runner/src/v2/extension.d.ts +51 -0
- package/runtime/types/flow-extension-runner/src/v2/index.d.ts +39 -0
- package/runtime/types/flow-extension-runner/src/v2/loaders/loader-method.d.ts +31 -0
- package/runtime/types/flow-extension-runner/src/v2/loaders/loader-owner.d.ts +17 -0
- package/runtime/types/flow-extension-runner/src/v2/loaders/payload-schema.d.ts +3 -0
- package/runtime/types/flow-extension-runner/src/v2/method.d.ts +22 -0
- package/runtime/types/flow-extension-runner/src/v2/model/field-mapper.d.ts +10 -0
- package/runtime/types/flow-extension-runner/src/v2/model/method-model.d.ts +3 -0
- package/runtime/types/flow-extension-runner/src/v2/model/model-types.d.ts +70 -0
- package/runtime/types/flow-extension-runner/src/v2/model/params-model.d.ts +16 -0
- package/runtime/types/flow-extension-runner/src/v2/oauth/method-names.d.ts +5 -0
- package/runtime/types/flow-extension-runner/src/v2/oauth/oauth2.d.ts +9 -0
- package/runtime/types/flow-extension-runner/src/v2/oauth/system-params.d.ts +6 -0
- package/runtime/types/flow-extension-runner/src/v2/oauth/types.d.ts +54 -0
- package/runtime/types/flow-extension-runner/src/v2/params/config-params.d.ts +14 -0
- package/runtime/types/flow-extension-runner/src/v2/params/files-options.d.ts +58 -0
- package/runtime/types/flow-extension-runner/src/v2/params/index.d.ts +19 -0
- package/runtime/types/flow-extension-runner/src/v2/params/json/checks.d.ts +26 -0
- package/runtime/types/flow-extension-runner/src/v2/params/json/decode.d.ts +24 -0
- package/runtime/types/flow-extension-runner/src/v2/params/json/encode.d.ts +20 -0
- package/runtime/types/flow-extension-runner/src/v2/params/json/types.d.ts +86 -0
- package/runtime/types/flow-extension-runner/src/v2/params/json/values.d.ts +5 -0
- package/runtime/types/flow-extension-runner/src/v2/params/method-params.d.ts +17 -0
- package/runtime/types/flow-extension-runner/src/v2/params/params.d.ts +26 -0
- package/runtime/types/flow-extension-runner/src/v2/params/schema/assert-object-schema.d.ts +6 -0
- package/runtime/types/flow-extension-runner/src/v2/params/schema/assert-supported-schema.d.ts +8 -0
- package/runtime/types/flow-extension-runner/src/v2/params/schema/coerce.d.ts +54 -0
- package/runtime/types/flow-extension-runner/src/v2/params/schema/dates.d.ts +40 -0
- package/runtime/types/flow-extension-runner/src/v2/params/schema/defaults.d.ts +36 -0
- package/runtime/types/flow-extension-runner/src/v2/params/schema/field-plan.d.ts +33 -0
- package/runtime/types/flow-extension-runner/src/v2/params/schema/introspect.d.ts +58 -0
- package/runtime/types/flow-extension-runner/src/v2/params/schema/labels.d.ts +3 -0
- package/runtime/types/flow-extension-runner/src/v2/params/schema/messages.d.ts +16 -0
- package/runtime/types/flow-extension-runner/src/v2/params/schema/normalize.d.ts +8 -0
- package/runtime/types/flow-extension-runner/src/v2/params/schema/parse.d.ts +7 -0
- package/runtime/types/flow-extension-runner/src/v2/params/types.d.ts +29 -0
- package/runtime/types/flow-extension-runner/src/v2/params/widget-types.d.ts +40 -0
- package/runtime/types/flow-extension-runner/src/v2/params/zod.d.ts +86 -0
- package/runtime/types/flow-extension-runner/src/v2/path.d.ts +1 -0
- package/runtime/types/flow-extension-runner/src/v2/polling-triggers/mechanisms.d.ts +19 -0
- package/runtime/types/flow-extension-runner/src/v2/polling-triggers/method-names.d.ts +1 -0
- package/runtime/types/flow-extension-runner/src/v2/polling-triggers/polling-triggers.d.ts +11 -0
- package/runtime/types/flow-extension-runner/src/v2/polling-triggers/system-params.d.ts +7 -0
- package/runtime/types/flow-extension-runner/src/v2/polling-triggers/trigger-method.d.ts +25 -0
- package/runtime/types/flow-extension-runner/src/v2/polling-triggers/types.d.ts +46 -0
- package/runtime/types/flow-extension-runner/src/v2/realtime-triggers/method-names.d.ts +7 -0
- package/runtime/types/flow-extension-runner/src/v2/realtime-triggers/realtime-setup.d.ts +10 -0
- package/runtime/types/flow-extension-runner/src/v2/realtime-triggers/system-params.d.ts +29 -0
- package/runtime/types/flow-extension-runner/src/v2/realtime-triggers/trigger-method.d.ts +33 -0
- package/runtime/types/flow-extension-runner/src/v2/realtime-triggers/types.d.ts +147 -0
- package/runtime/types/flow-extension-runner/src/v2/realtime-triggers/verify.d.ts +2 -0
- package/runtime/types/flow-extension-runner/src/v2/registry.d.ts +20 -0
- package/runtime/types/flow-extension-runner/src/v2/result.d.ts +13 -0
- package/runtime/types/flow-extension-runner/src/v2/system-method.d.ts +41 -0
- package/runtime/types/flow-extension-runner/src/v2/types.d.ts +126 -0
- package/runtime/types/jsdoc-parser/src/custom-type-defs/files.d.ts +2 -0
- package/runtime/types/jsdoc-parser/src/index.d.ts +2 -0
- package/runtime/types/jsdoc-parser/src/lib.d.ts +42 -0
- package/runtime/types/jsdoc-parser/src/types.d.ts +2 -0
- package/runtime/types/packages/cli/src/runtime/index.d.ts +5 -0
- package/runtime/types/shared/src/constants/ai-agent-tools.d.ts +20 -0
- package/runtime/types/shared/src/constants/ai.d.ts +11 -0
- package/runtime/types/shared/src/constants/api-keys.d.ts +1 -0
- package/runtime/types/shared/src/constants/app.d.ts +58 -0
- package/runtime/types/shared/src/constants/billing.d.ts +16 -0
- package/runtime/types/shared/src/constants/compliances.d.ts +3 -0
- package/runtime/types/shared/src/constants/data-types.d.ts +26 -0
- package/runtime/types/shared/src/constants/error-codes.d.ts +16 -0
- package/runtime/types/shared/src/constants/flow.d.ts +12 -0
- package/runtime/types/shared/src/constants/index.d.ts +16 -0
- package/runtime/types/shared/src/constants/knowledge-base.d.ts +13 -0
- package/runtime/types/shared/src/constants/notification-types.d.ts +985 -0
- package/runtime/types/shared/src/constants/notifications.d.ts +10 -0
- package/runtime/types/shared/src/constants/patterns.d.ts +28 -0
- package/runtime/types/shared/src/constants/retry-policy.d.ts +30 -0
- package/runtime/types/shared/src/constants/severity.d.ts +9 -0
- package/runtime/types/shared/src/constants/shared-extensions-search.d.ts +6 -0
- package/runtime/types/shared/src/constants/shared-extensions.d.ts +35 -0
- package/runtime/types/shared/src/constants/zod.d.ts +2 -0
- package/runtime/types/shared/src/errors/api.d.ts +4 -0
- package/runtime/types/shared/src/errors/base.d.ts +38 -0
- package/runtime/types/shared/src/errors/common.d.ts +39 -0
- package/runtime/types/shared/src/errors/index.d.ts +13 -0
- package/runtime/types/shared/src/errors/k8s.d.ts +4 -0
- package/runtime/types/shared/src/errors/message.d.ts +48 -0
- package/runtime/types/shared/src/errors/open-search.d.ts +4 -0
- package/runtime/types/shared/src/errors/s3.d.ts +11 -0
- package/runtime/types/shared/src/extensions/zod.d.ts +25 -0
- package/runtime/types/shared/src/scheme/account/dto.d.ts +60 -0
- package/runtime/types/shared/src/scheme/account/index.d.ts +1 -0
- package/runtime/types/shared/src/scheme/ai-agent-tools/dto.d.ts +69 -0
- package/runtime/types/shared/src/scheme/ai-agent-tools/index.d.ts +2 -0
- package/runtime/types/shared/src/scheme/ai-agent-tools/parameters.d.ts +7 -0
- package/runtime/types/shared/src/scheme/ai-router/dto.d.ts +23 -0
- package/runtime/types/shared/src/scheme/ai-router/index.d.ts +2 -0
- package/runtime/types/shared/src/scheme/api-keys/dto.d.ts +28 -0
- package/runtime/types/shared/src/scheme/api-keys/index.d.ts +2 -0
- package/runtime/types/shared/src/scheme/app/index.d.ts +1 -0
- package/runtime/types/shared/src/scheme/app/java.dto.d.ts +6 -0
- package/runtime/types/shared/src/scheme/billing/index.d.ts +1 -0
- package/runtime/types/shared/src/scheme/billing/java.dto.d.ts +163 -0
- package/runtime/types/shared/src/scheme/crm/billing.d.ts +149 -0
- package/runtime/types/shared/src/scheme/crm/dto.d.ts +212 -0
- package/runtime/types/shared/src/scheme/crm/index.d.ts +3 -0
- package/runtime/types/shared/src/scheme/data-types/index.d.ts +1 -0
- package/runtime/types/shared/src/scheme/data-types/java.dto.d.ts +23 -0
- package/runtime/types/shared/src/scheme/dynamic-forms/dto.d.ts +30 -0
- package/runtime/types/shared/src/scheme/dynamic-forms/index.d.ts +2 -0
- package/runtime/types/shared/src/scheme/extensions/index.d.ts +1 -0
- package/runtime/types/shared/src/scheme/extensions/params-to-zod.d.ts +14 -0
- package/runtime/types/shared/src/scheme/flowrunner/custom-elements.d.ts +368 -0
- package/runtime/types/shared/src/scheme/flowrunner/index.d.ts +3 -0
- package/runtime/types/shared/src/scheme/flowrunner/java.dto.d.ts +628 -0
- package/runtime/types/shared/src/scheme/index.d.ts +19 -0
- package/runtime/types/shared/src/scheme/integration-connection/dto.d.ts +81 -0
- package/runtime/types/shared/src/scheme/integration-connection/index.d.ts +2 -0
- package/runtime/types/shared/src/scheme/knowledge-base/dto.d.ts +540 -0
- package/runtime/types/shared/src/scheme/knowledge-base/index.d.ts +2 -0
- package/runtime/types/shared/src/scheme/mcp-oauth/dto.d.ts +7 -0
- package/runtime/types/shared/src/scheme/mcp-oauth/index.d.ts +2 -0
- package/runtime/types/shared/src/scheme/notifications/dto.d.ts +111 -0
- package/runtime/types/shared/src/scheme/notifications/index.d.ts +3 -0
- package/runtime/types/shared/src/scheme/notifications/rest.d.ts +148 -0
- package/runtime/types/shared/src/scheme/properties/account.d.ts +3 -0
- package/runtime/types/shared/src/scheme/properties/app.d.ts +5 -0
- package/runtime/types/shared/src/scheme/properties/billing.d.ts +12 -0
- package/runtime/types/shared/src/scheme/properties/common.d.ts +2 -0
- package/runtime/types/shared/src/scheme/properties/db.d.ts +8 -0
- package/runtime/types/shared/src/scheme/properties/flow-extensions.d.ts +7 -0
- package/runtime/types/shared/src/scheme/properties/index.d.ts +7 -0
- package/runtime/types/shared/src/scheme/remote-mcp-server/dto.d.ts +278 -0
- package/runtime/types/shared/src/scheme/remote-mcp-server/index.d.ts +2 -0
- package/runtime/types/shared/src/scheme/shared-extensions/base.d.ts +56 -0
- package/runtime/types/shared/src/scheme/shared-extensions/config.d.ts +96 -0
- package/runtime/types/shared/src/scheme/shared-extensions/custom-extensions.d.ts +485 -0
- package/runtime/types/shared/src/scheme/shared-extensions/extension.d.ts +387 -0
- package/runtime/types/shared/src/scheme/shared-extensions/flow-extensions.d.ts +64 -0
- package/runtime/types/shared/src/scheme/shared-extensions/index.d.ts +15 -0
- package/runtime/types/shared/src/scheme/shared-extensions/light.d.ts +38 -0
- package/runtime/types/shared/src/scheme/shared-extensions/logs.d.ts +21 -0
- package/runtime/types/shared/src/scheme/shared-extensions/methods.d.ts +80 -0
- package/runtime/types/shared/src/scheme/shared-extensions/params-schema.d.ts +47 -0
- package/runtime/types/shared/src/scheme/shared-extensions/popular-pool.d.ts +11 -0
- package/runtime/types/shared/src/scheme/shared-extensions/resolve.d.ts +364 -0
- package/runtime/types/shared/src/scheme/shared-extensions/rest.d.ts +9 -0
- package/runtime/types/shared/src/scheme/shared-extensions/search.d.ts +177 -0
- package/runtime/types/shared/src/scheme/shared-extensions/service-identity.d.ts +10 -0
- package/runtime/types/shared/src/scheme/shared-extensions/service-info.d.ts +15 -0
- package/runtime/types/shared/src/scheme/workspace/dto.d.ts +40 -0
- package/runtime/types/shared/src/scheme/workspace/index.d.ts +1 -0
- package/runtime/types/shared/src/utils/object.d.ts +8 -0
- package/runtime/types/shared/src/utils/uuid.d.ts +5 -0
- package/runtime/types/shared/src/utils/versions.d.ts +4 -0
- package/runtime/types/types/backendless-request.d.ts +40 -0
- package/templates/blank/files/README.md +28 -0
- package/templates/blank/files/package.json +8 -0
- package/templates/blank/files/public/icon.svg +5 -0
- package/templates/blank/files/src/index.js +130 -0
- package/templates/blank/template.json +61 -0
- package/templates/demo-todo-list/files/README.md +54 -0
- package/templates/demo-todo-list/files/package.json +8 -0
- package/templates/demo-todo-list/files/public/icon.svg +8 -0
- package/templates/demo-todo-list/files/src/index.js +590 -0
- package/templates/demo-todo-list/template.json +44 -0
- package/templates/qa-test/files/README.md +88 -0
- package/templates/qa-test/files/package.json +8 -0
- package/templates/qa-test/files/public/icon.svg +8 -0
- package/templates/qa-test/files/src/index.js +755 -0
- package/templates/qa-test/template.json +62 -0
|
@@ -0,0 +1,755 @@
|
|
|
1
|
+
// {{name}} — QA harness for custom extensions.
|
|
2
|
+
//
|
|
3
|
+
// Deploy this, then poke it from the console. Every action either ECHOES what it received or reports what
|
|
4
|
+
// the runtime did, so you can watch defaults being applied, values being converted, unknown fields being
|
|
5
|
+
// stripped, dictionaries loading, triggers firing and errors propagating — without a real API anywhere.
|
|
6
|
+
//
|
|
7
|
+
// Each action is named for the ONE thing it proves. If a check fails, the action id tells you what broke.
|
|
8
|
+
//
|
|
9
|
+
// Nothing here calls a third party except "Call An HTTP Endpoint", where you supply the URL.
|
|
10
|
+
// STORAGE IS IN MEMORY and resets when the pod restarts. That is deliberate.
|
|
11
|
+
|
|
12
|
+
const z = Flowrunner.z
|
|
13
|
+
|
|
14
|
+
// Bump this and redeploy to confirm the console is serving the version you just pushed.
|
|
15
|
+
const HARNESS_VERSION = '2.0.0'
|
|
16
|
+
|
|
17
|
+
const ext = Flowrunner.createExtension({
|
|
18
|
+
id : '{{id}}',
|
|
19
|
+
name : '{{name}}',
|
|
20
|
+
description: '{{description}}',
|
|
21
|
+
logo : '/icon.svg',
|
|
22
|
+
|
|
23
|
+
appearanceColors: ['#b45309', '#fcd34d'],
|
|
24
|
+
|
|
25
|
+
usesFileStorage: true,
|
|
26
|
+
|
|
27
|
+
// ─── Config items ──────────────────────────────────────────────────────────
|
|
28
|
+
// {{#if configMode=minimal}}
|
|
29
|
+
// MINIMAL: one required field, so the actions run as soon as it is filled in.
|
|
30
|
+
configItems: z.object({
|
|
31
|
+
apiKey : z.string().label('API Key').describe('Required. Any value — it is only echoed back.'),
|
|
32
|
+
environment: z.enum(['sandbox', 'staging', 'production']).optional().default('sandbox').label('Environment'),
|
|
33
|
+
verbose : z.boolean().optional().default(false).label('Verbose Logging'),
|
|
34
|
+
}),
|
|
35
|
+
// {{/if}}
|
|
36
|
+
// {{#if configMode=full}}
|
|
37
|
+
// FULL MATRIX: every config type crossed with required/optional and with/without a default. All the
|
|
38
|
+
// `required*` fields must be set before any action will run — that is the point of this mode.
|
|
39
|
+
//
|
|
40
|
+
// Three behaviours worth checking here — "Show Config And Context" reports what each value resolved to:
|
|
41
|
+
// • a NUMBER config field renders as a text box, but arrives as a NUMBER — it is converted to the
|
|
42
|
+
// declared type before your schema validates it, so `.min()` / `.int()` are enforced on the number
|
|
43
|
+
// • a BOOLEAN config also accepts the strings 'true' / 'false'
|
|
44
|
+
// • a DATE config depends on which form you declared: `z.coerce.date()` arrives as a real `Date`, while
|
|
45
|
+
// a bare `z.date()` arrives exactly as the form stored it. Both are validated — see
|
|
46
|
+
// "Params — Date Forms" for the whole comparison
|
|
47
|
+
configItems: z.object({
|
|
48
|
+
requiredString: z.string().label('Required String').describe('Required, described, no default.'),
|
|
49
|
+
requiredText : z.text().label('Required Text').describe('Multi-line.'),
|
|
50
|
+
requiredNumber: z.number().label('Required Number').describe('Arrives as a number — check the context.'),
|
|
51
|
+
requiredBool : z.boolean().label('Required Bool'),
|
|
52
|
+
requiredDate : z.coerce.date().label('Required Date'),
|
|
53
|
+
requiredChoice: z.enum(['alpha', 'beta', 'gamma']).label('Required Choice'),
|
|
54
|
+
|
|
55
|
+
optionalString : z.string().optional().label('Optional String'),
|
|
56
|
+
optionalDefault: z.string().optional().default('from-default').label('Optional With Default'),
|
|
57
|
+
optionalNumber : z.number().optional().default(42).label('Optional Number With Default'),
|
|
58
|
+
optionalBool : z.boolean().optional().default(true).label('Optional Bool With Default'),
|
|
59
|
+
optionalChoice : z.enum(['one', 'two']).optional().default('two').label('Optional Choice With Default'),
|
|
60
|
+
}),
|
|
61
|
+
// {{/if}}
|
|
62
|
+
|
|
63
|
+
// Everything the handlers need, derived once. "Show Config And Context" returns this verbatim.
|
|
64
|
+
//
|
|
65
|
+
// NOTE: `oauth` is deliberately NOT read here. This service declares no setupOauth2, so `ctx.oauth` is a
|
|
66
|
+
// proxy that throws on access — touching it in initContext would break every action, not just the one
|
|
67
|
+
// that reads it. "Read OAuth Without Declaring It" exists to demonstrate that failure on purpose.
|
|
68
|
+
initContext: ({ config }) => ({
|
|
69
|
+
resolvedAt : new Date().toISOString(),
|
|
70
|
+
harnessVersion: HARNESS_VERSION,
|
|
71
|
+
// What each config value actually resolved to — numbers arrive as numbers, dates as whatever the form
|
|
72
|
+
// stored (see the configItems notes above).
|
|
73
|
+
configValueTypes: Object.fromEntries(
|
|
74
|
+
Object.entries(config)
|
|
75
|
+
.filter(([, value]) => value !== undefined)
|
|
76
|
+
.map(([key, value]) => [key, value instanceof Date ? 'Date' : typeof value])
|
|
77
|
+
),
|
|
78
|
+
}),
|
|
79
|
+
|
|
80
|
+
// The shared HTTP helper. Only "Call An HTTP Endpoint" uses it, and only against a URL you supply.
|
|
81
|
+
apiRequest: async ({ url, method = 'get', headers = {}, query, body, context, logger }) => {
|
|
82
|
+
logger.debug(`[${ method.toUpperCase() }] ${ url } (harness ${ context.harnessVersion })`)
|
|
83
|
+
|
|
84
|
+
try {
|
|
85
|
+
return await Flowrunner.Request[method.toLowerCase()](url)
|
|
86
|
+
.set(headers)
|
|
87
|
+
.query(query)
|
|
88
|
+
.send(body)
|
|
89
|
+
} catch (error) {
|
|
90
|
+
logger.error(`Request to ${ url } failed: ${ error.message }`)
|
|
91
|
+
|
|
92
|
+
throw error
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
// Three helpers with distinct shapes — sync, async, and one that closes over `context`.
|
|
97
|
+
helpers: ({ context, apiRequest }) => ({
|
|
98
|
+
shout : text => String(text).toUpperCase(),
|
|
99
|
+
stamp : () => `${ context.harnessVersion }@${ context.resolvedAt }`,
|
|
100
|
+
fetchJson: url => apiRequest({ url }),
|
|
101
|
+
}),
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
// ─── In-memory data for the dictionaries and the triggers ────────────────────
|
|
105
|
+
|
|
106
|
+
const PARENTS = [
|
|
107
|
+
{ id: 'p1', name: 'Parent One' },
|
|
108
|
+
{ id: 'p2', name: 'Parent Two' },
|
|
109
|
+
]
|
|
110
|
+
|
|
111
|
+
const CHILDREN = {
|
|
112
|
+
p1: [{ id: 'c1', name: 'Child A' }, { id: 'c2', name: 'Child B' }],
|
|
113
|
+
p2: [{ id: 'c3', name: 'Child C' }],
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// 137 entries — enough that the dropdown has to paginate and search for real.
|
|
117
|
+
const MANY = Array.from({ length: 137 }, (_, index) => ({
|
|
118
|
+
id : `item-${ index + 1 }`,
|
|
119
|
+
name: `Item ${ String(index + 1).padStart(3, '0') }`,
|
|
120
|
+
}))
|
|
121
|
+
|
|
122
|
+
const PAGE_SIZE = 25
|
|
123
|
+
|
|
124
|
+
const matches = (name, search) => !search || name.toLowerCase().includes(search.toLowerCase())
|
|
125
|
+
|
|
126
|
+
// ─── Dictionaries ────────────────────────────────────────────────────────────
|
|
127
|
+
// Four, each showing a different behaviour a dropdown has to survive. Search any of them for gibberish to
|
|
128
|
+
// see the empty state.
|
|
129
|
+
|
|
130
|
+
// The minimal form: no criteria, no sample result, returns a bare array.
|
|
131
|
+
const getParentsDictionary = ext.dictionary({
|
|
132
|
+
id : 'getParentsDictionary',
|
|
133
|
+
label : 'Parents',
|
|
134
|
+
description: 'Two static options. The simplest dictionary there is.',
|
|
135
|
+
execute : ({ search }) => PARENTS
|
|
136
|
+
.filter(parent => matches(parent.name, search))
|
|
137
|
+
.map(parent => ({ label: parent.name, value: parent.id })),
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
// Criteria → consumers auto-derive `dependsOn: ['parentId']`.
|
|
141
|
+
const getChildrenDictionary = ext.dictionary({
|
|
142
|
+
id : 'getChildrenDictionary',
|
|
143
|
+
label : 'Children',
|
|
144
|
+
description: 'Depends on the selected parent — check that changing the parent reloads this.',
|
|
145
|
+
criteria : z.object({
|
|
146
|
+
parentId: z.string().label('Parent').dictionary(getParentsDictionary),
|
|
147
|
+
}),
|
|
148
|
+
result : { items: [{ label: 'Child A', value: 'c1' }], cursor: null },
|
|
149
|
+
execute : ({ criteria, search }) => ({
|
|
150
|
+
items: (CHILDREN[criteria.parentId] || [])
|
|
151
|
+
.filter(child => matches(child.name, search))
|
|
152
|
+
.map(child => ({ label: child.name, value: child.id, note: criteria.parentId })),
|
|
153
|
+
cursor: null,
|
|
154
|
+
}),
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
// Real pagination over 137 items — scroll it, search it, check the cursor is honoured.
|
|
158
|
+
const getPagedDictionary = ext.dictionary({
|
|
159
|
+
id : 'getPagedDictionary',
|
|
160
|
+
label : 'Paged (137 items)',
|
|
161
|
+
description: 'Paginated with a cursor. Scroll to the bottom and check more pages load.',
|
|
162
|
+
execute : ({ search, cursor }) => {
|
|
163
|
+
const matching = MANY.filter(item => matches(item.name, search))
|
|
164
|
+
const offset = Number(cursor) || 0
|
|
165
|
+
const page = matching.slice(offset, offset + PAGE_SIZE)
|
|
166
|
+
|
|
167
|
+
return {
|
|
168
|
+
items : page.map(item => ({ label: item.name, value: item.id, note: `#${ offset + 1 }+` })),
|
|
169
|
+
cursor: offset + PAGE_SIZE < matching.length ? String(offset + PAGE_SIZE) : null,
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
// The state a happy-path dictionary never shows you.
|
|
175
|
+
const getFailingDictionary = ext.dictionary({
|
|
176
|
+
id : 'getFailingDictionary',
|
|
177
|
+
label : 'Failing',
|
|
178
|
+
description: 'Always throws. Check the dropdown surfaces the error instead of hanging.',
|
|
179
|
+
execute : () => {
|
|
180
|
+
throw new Error('QA: this dictionary fails on purpose')
|
|
181
|
+
},
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
// ─── 1. Config ───────────────────────────────────────────────────────────────
|
|
185
|
+
|
|
186
|
+
ext.addAction({
|
|
187
|
+
category : '1. Config',
|
|
188
|
+
id : 'showConfigAndContext',
|
|
189
|
+
label : 'Show Config And Context',
|
|
190
|
+
description: 'The resolved config, the object initContext built, and which deploy is live. Start here.',
|
|
191
|
+
result : { service: '{{id}}', config: {}, context: {} },
|
|
192
|
+
execute : ({ config, context }) => ({
|
|
193
|
+
service: '{{id}}',
|
|
194
|
+
now : new Date().toISOString(),
|
|
195
|
+
config,
|
|
196
|
+
context,
|
|
197
|
+
}),
|
|
198
|
+
})
|
|
199
|
+
|
|
200
|
+
// ─── 2. Params ───────────────────────────────────────────────────────────────
|
|
201
|
+
// Every action here echoes `params` straight back, so what you see is exactly what `execute` received
|
|
202
|
+
// after the runtime normalized, converted and validated the input.
|
|
203
|
+
|
|
204
|
+
ext.addAction({
|
|
205
|
+
category : '2. Params',
|
|
206
|
+
id : 'paramsScalarTypes',
|
|
207
|
+
label : 'Params — Every Scalar Type',
|
|
208
|
+
description: 'One param per scalar type, returned with the JS type each one arrived as.',
|
|
209
|
+
params : z.object({
|
|
210
|
+
string : z.string().label('String'),
|
|
211
|
+
text : z.text().optional().label('Text (multi-line)'),
|
|
212
|
+
number : z.number().optional().label('Number (stepper)'),
|
|
213
|
+
boolean: z.boolean().optional().label('Boolean (toggle)'),
|
|
214
|
+
date : z.coerce.date().optional().label('Date (picker)'),
|
|
215
|
+
email : z.email().optional().label('Email (format-checked)'),
|
|
216
|
+
url : z.url().optional().label('URL (format-checked)'),
|
|
217
|
+
}),
|
|
218
|
+
result : { params: {}, types: {} },
|
|
219
|
+
// `types` is the interesting half: a number typed into the form arrives as a NUMBER, and this date is
|
|
220
|
+
// declared `z.coerce.date()` so it arrives as a real `Date`. Declaring it `z.date()` instead would hand
|
|
221
|
+
// over exactly what the form stored — "Params — Date Forms" puts the two side by side.
|
|
222
|
+
execute : ({ params }) => ({
|
|
223
|
+
params,
|
|
224
|
+
types: Object.fromEntries(
|
|
225
|
+
Object.entries(params).map(([key, value]) => [key, value instanceof Date ? 'Date' : typeof value])
|
|
226
|
+
),
|
|
227
|
+
}),
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
ext.addAction({
|
|
231
|
+
category : '2. Params',
|
|
232
|
+
id : 'paramsOptionality',
|
|
233
|
+
label : 'Params — Optional, Nullable, Nullish, Defaults',
|
|
234
|
+
description: 'Leave every optional field blank. Each modifier resolves a blank the way it declared.',
|
|
235
|
+
params : z.object({
|
|
236
|
+
required : z.string().label('Required'),
|
|
237
|
+
optional : z.string().optional().label('Optional → undefined'),
|
|
238
|
+
nullable : z.string().nullable().label('Nullable → null'),
|
|
239
|
+
nullish : z.string().nullish().label('Nullish → as sent'),
|
|
240
|
+
withDefault : z.string().default('default-value').label('Default → the declared value'),
|
|
241
|
+
optionalDefault: z.number().optional().default(7).label('Optional with default'),
|
|
242
|
+
}),
|
|
243
|
+
result : { params: {}, resolvedTo: {} },
|
|
244
|
+
// The editor sends every untouched field as an explicit `null`; each declaration decides what that
|
|
245
|
+
// becomes. `required` is the only one that fails when left blank.
|
|
246
|
+
execute : ({ params }) => ({
|
|
247
|
+
params,
|
|
248
|
+
resolvedTo: Object.fromEntries(
|
|
249
|
+
['optional', 'nullable', 'nullish', 'withDefault', 'optionalDefault']
|
|
250
|
+
.map(key => [key, params[key] === undefined ? 'undefined' : JSON.stringify(params[key])])
|
|
251
|
+
),
|
|
252
|
+
}),
|
|
253
|
+
})
|
|
254
|
+
|
|
255
|
+
ext.addAction({
|
|
256
|
+
category : '2. Params',
|
|
257
|
+
id : 'paramsCoercion',
|
|
258
|
+
label : 'Params — Values Arrive As Their Declared Type',
|
|
259
|
+
description: 'The form stores text. Type "42" and "true" here and watch them arrive as a number and a boolean.',
|
|
260
|
+
params : z.object({
|
|
261
|
+
count : z.number().int().min(1).label('Whole number ≥ 1'),
|
|
262
|
+
ratio : z.number().label('Any number'),
|
|
263
|
+
enabled: z.boolean().label('Boolean'),
|
|
264
|
+
big : z.bigint().optional().label('Big integer'),
|
|
265
|
+
}),
|
|
266
|
+
result : { params: {}, types: {} },
|
|
267
|
+
execute : ({ params }) => ({
|
|
268
|
+
// BigInt does not survive JSON, so it is stringified for display only.
|
|
269
|
+
params: Object.fromEntries(
|
|
270
|
+
Object.entries(params).map(([key, value]) => [key, typeof value === 'bigint' ? String(value) : value])
|
|
271
|
+
),
|
|
272
|
+
types : Object.fromEntries(Object.entries(params).map(([key, value]) => [key, typeof value])),
|
|
273
|
+
}),
|
|
274
|
+
})
|
|
275
|
+
|
|
276
|
+
ext.addAction({
|
|
277
|
+
category : '2. Params',
|
|
278
|
+
id : 'paramsEnumAndLabelled',
|
|
279
|
+
label : 'Params — Dropdowns, Plain And Labelled',
|
|
280
|
+
description: 'A labelled dropdown shows a label per value. The handler receives the value, so labels are safe to rename.',
|
|
281
|
+
params : z.object({
|
|
282
|
+
plain: z.enum(['red', 'green', 'blue']).optional().label('Plain dropdown'),
|
|
283
|
+
// The element stores the VALUE and the dropdown shows the label, so renaming a label leaves every
|
|
284
|
+
// saved flow working. Compare `plain`, where the value IS the label.
|
|
285
|
+
match: z.enum(['and', 'or'])
|
|
286
|
+
.labels({ and: 'Match all (AND)', or: 'Match any (OR)' })
|
|
287
|
+
.default('and').label('Labelled, with a default'),
|
|
288
|
+
order: z.enum(['asc', 'desc'])
|
|
289
|
+
.labels({ asc: 'Ascending', desc: 'Descending' })
|
|
290
|
+
.optional().label('Labelled, optional'),
|
|
291
|
+
}),
|
|
292
|
+
result : { params: {} },
|
|
293
|
+
execute : ({ params }) => ({ params }),
|
|
294
|
+
})
|
|
295
|
+
|
|
296
|
+
ext.addAction({
|
|
297
|
+
category : '2. Params',
|
|
298
|
+
id : 'paramsDateForms',
|
|
299
|
+
label : 'Params — Date Forms',
|
|
300
|
+
description: 'Every way to declare a date, side by side. Put the SAME value in each and compare the output.',
|
|
301
|
+
params : z.object({
|
|
302
|
+
// Validated, then handed over exactly as sent — converting would invent a time of day and a timezone.
|
|
303
|
+
passThrough: z.date().optional().label('z.date() — as sent')
|
|
304
|
+
.describe('Any date form, e.g. 2024-06-01, 2024-06-01T10:00:00Z or 1717236000000'),
|
|
305
|
+
// The opt-in for a real Date. The only declaration whose inferred type matches what arrives.
|
|
306
|
+
converted : z.coerce.date().optional().label('z.coerce.date() — a Date')
|
|
307
|
+
.describe('Same input, handed over as a Date instance'),
|
|
308
|
+
// These accept any date form too, and reshape it to the string form they declared.
|
|
309
|
+
isoDateTime: z.iso.datetime().optional().label('z.iso.datetime() — widened')
|
|
310
|
+
.describe('Give it 2024-06-01 and watch it become 2024-06-01T00:00:00.000Z'),
|
|
311
|
+
isoDate : z.iso.date().optional().label('z.iso.date() — narrowed')
|
|
312
|
+
.describe('Give it 2024-06-01T23:00:00Z and watch it become 2024-06-01'),
|
|
313
|
+
isoTime : z.iso.time().optional().label('z.iso.time() — narrowed')
|
|
314
|
+
.describe('Give it 2024-06-01T10:00:00Z and watch it become 10:00:00'),
|
|
315
|
+
// The one that does not reshape: a duration is not a point in time.
|
|
316
|
+
isoDuration: z.iso.duration().optional().label('z.iso.duration() — strict')
|
|
317
|
+
.describe('e.g. P1D, PT30M, P3Y6M4D. A date is rejected here'),
|
|
318
|
+
// Bounds compare instants and are reported back as ISO strings, not epoch numbers.
|
|
319
|
+
bounded : z.date()
|
|
320
|
+
.min(new Date('2024-01-01T00:00:00.000Z'))
|
|
321
|
+
.max(new Date('2024-12-31T23:59:59.999Z'))
|
|
322
|
+
.optional()
|
|
323
|
+
.label('z.date() bounded to 2024')
|
|
324
|
+
.describe('1999-01-01 should fail and name the bound as a date'),
|
|
325
|
+
}),
|
|
326
|
+
result : { params: {}, types: {} },
|
|
327
|
+
execute : ({ params }) => ({
|
|
328
|
+
// A Date does not survive JSON, so it is spelled out for display.
|
|
329
|
+
params: Object.fromEntries(
|
|
330
|
+
Object.entries(params).map(([key, value]) => [key, value instanceof Date ? value.toISOString() : value])
|
|
331
|
+
),
|
|
332
|
+
types : Object.fromEntries(
|
|
333
|
+
Object.entries(params).map(([key, value]) => [key, value instanceof Date ? 'Date' : typeof value])
|
|
334
|
+
),
|
|
335
|
+
}),
|
|
336
|
+
})
|
|
337
|
+
|
|
338
|
+
ext.addAction({
|
|
339
|
+
category : '2. Params',
|
|
340
|
+
id : 'paramsListOfPrimitives',
|
|
341
|
+
label : 'Params — List Of Primitives',
|
|
342
|
+
description: 'Repeatable single-value lists. Each entry is converted to the declared element type.',
|
|
343
|
+
params : z.object({
|
|
344
|
+
strings: z.array(z.string()).optional().label('List of strings'),
|
|
345
|
+
numbers: z.array(z.number()).optional().label('List of numbers'),
|
|
346
|
+
flags : z.array(z.boolean()).optional().label('List of booleans'),
|
|
347
|
+
}),
|
|
348
|
+
result : { params: {}, elementTypes: {} },
|
|
349
|
+
execute : ({ params }) => ({
|
|
350
|
+
params,
|
|
351
|
+
elementTypes: Object.fromEntries(
|
|
352
|
+
Object.entries(params).map(([key, value]) => [key, (value || []).map(item => typeof item)])
|
|
353
|
+
),
|
|
354
|
+
}),
|
|
355
|
+
})
|
|
356
|
+
|
|
357
|
+
ext.addAction({
|
|
358
|
+
category : '2. Params',
|
|
359
|
+
id : 'paramsListOfObjects',
|
|
360
|
+
label : 'Params — List Of Objects',
|
|
361
|
+
description: 'Should render as repeatable rows with one input per declared field, not a single text box.',
|
|
362
|
+
params : z.object({
|
|
363
|
+
rows: z.array(z.object({
|
|
364
|
+
sku : z.string().label('SKU'),
|
|
365
|
+
quantity: z.number().optional().label('Quantity'),
|
|
366
|
+
grade : z.enum(['A', 'B', 'C']).optional().label('Grade'),
|
|
367
|
+
owner : z.string().optional().label('Owner').dictionary(getParentsDictionary),
|
|
368
|
+
})).optional().label('Rows'),
|
|
369
|
+
}),
|
|
370
|
+
result : { params: {} },
|
|
371
|
+
// Every control a row can hold: a text box, a stepper, a dropdown and a dictionary lookup.
|
|
372
|
+
execute : ({ params }) => ({ params, rowCount: (params.rows || []).length }),
|
|
373
|
+
})
|
|
374
|
+
|
|
375
|
+
ext.addAction({
|
|
376
|
+
category : '2. Params',
|
|
377
|
+
id : 'paramsListOfChoices',
|
|
378
|
+
label : 'Params — List Of Choices',
|
|
379
|
+
description: 'Repeatable dropdowns. Both forms should offer a picker per row, not a free-text box.',
|
|
380
|
+
params : z.object({
|
|
381
|
+
fromEnum : z.array(z.enum(['red', 'green', 'blue'])).optional().label('From a fixed set'),
|
|
382
|
+
fromDictionary: z.array(z.string().dictionary(getParentsDictionary)).optional().label('From a dictionary'),
|
|
383
|
+
}),
|
|
384
|
+
result : { params: {} },
|
|
385
|
+
execute : ({ params }) => ({ params }),
|
|
386
|
+
})
|
|
387
|
+
|
|
388
|
+
ext.addAction({
|
|
389
|
+
category : '2. Params',
|
|
390
|
+
id : 'paramsNestedObject',
|
|
391
|
+
label : 'Params — Nested Object',
|
|
392
|
+
description: 'A grouped set of fields. Failures report the property that failed, not the group.',
|
|
393
|
+
params : z.object({
|
|
394
|
+
address: z.object({
|
|
395
|
+
city : z.string().label('City'),
|
|
396
|
+
postcode: z.string().optional().label('Postcode'),
|
|
397
|
+
country : z.enum(['UK', 'DE', 'US']).optional().label('Country'),
|
|
398
|
+
}).optional().label('Address'),
|
|
399
|
+
}),
|
|
400
|
+
result : { params: {} },
|
|
401
|
+
execute : ({ params }) => ({ params }),
|
|
402
|
+
})
|
|
403
|
+
|
|
404
|
+
ext.addAction({
|
|
405
|
+
category : '2. Params',
|
|
406
|
+
id : 'paramsFromDictionary',
|
|
407
|
+
label : 'Params — Dictionary-backed',
|
|
408
|
+
description: 'Child depends on parent; paged scrolls; failing shows how a broken dictionary surfaces.',
|
|
409
|
+
params : z.object({
|
|
410
|
+
parentId : z.string().label('Parent').dictionary(getParentsDictionary),
|
|
411
|
+
childId : z.string().optional().label('Child (depends on parent)').dictionary(getChildrenDictionary),
|
|
412
|
+
pagedId : z.string().optional().label('Paged').dictionary(getPagedDictionary),
|
|
413
|
+
failingId: z.string().optional().label('Failing').dictionary(getFailingDictionary),
|
|
414
|
+
}),
|
|
415
|
+
result : { params: {} },
|
|
416
|
+
execute : ({ params }) => ({ params }),
|
|
417
|
+
})
|
|
418
|
+
|
|
419
|
+
ext.addAction({
|
|
420
|
+
category : '2. Params',
|
|
421
|
+
id : 'paramsGeneratedAtRuntime',
|
|
422
|
+
label : 'Params — Generated At Runtime',
|
|
423
|
+
description : 'Picking a parent generates one extra field per child. Change the parent and watch them change.',
|
|
424
|
+
params : z.object({
|
|
425
|
+
parentId: z.string().label('Parent').dictionary(getParentsDictionary),
|
|
426
|
+
}),
|
|
427
|
+
dynamicParams: {
|
|
428
|
+
criteria: z.object({ parentId: z.string().optional() }),
|
|
429
|
+
resolve : ({ criteria }) => {
|
|
430
|
+
const shape = {}
|
|
431
|
+
|
|
432
|
+
for (const child of CHILDREN[criteria.parentId] || []) {
|
|
433
|
+
shape[`field_${ child.id }`] = z.string().optional().label(`Field for ${ child.name }`)
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
return z.object(shape)
|
|
437
|
+
},
|
|
438
|
+
},
|
|
439
|
+
result : { params: {} },
|
|
440
|
+
// Generated fields ride through because the action declares dynamicParams — compare with the next one.
|
|
441
|
+
execute : ({ params }) => ({ params, keys: Object.keys(params) }),
|
|
442
|
+
})
|
|
443
|
+
|
|
444
|
+
ext.addAction({
|
|
445
|
+
category : '2. Params',
|
|
446
|
+
id : 'paramsUnknownStripped',
|
|
447
|
+
label : 'Params — Unknown Fields Are Stripped',
|
|
448
|
+
description: 'Declares one param. Anything else the flow sends should NOT come back.',
|
|
449
|
+
params : z.object({
|
|
450
|
+
keep: z.string().optional().label('Keep'),
|
|
451
|
+
}),
|
|
452
|
+
result : { params: {} },
|
|
453
|
+
execute : ({ params }) => ({ params, keys: Object.keys(params) }),
|
|
454
|
+
})
|
|
455
|
+
|
|
456
|
+
// ─── 3. Results ──────────────────────────────────────────────────────────────
|
|
457
|
+
// One action per `result` FORM, because each publishes a different return type or sample source — that is
|
|
458
|
+
// what downstream blocks bind their fields to.
|
|
459
|
+
|
|
460
|
+
ext.addAction({
|
|
461
|
+
category : '3. Results',
|
|
462
|
+
id : 'returnsObject',
|
|
463
|
+
label : 'Returns — Object',
|
|
464
|
+
description: 'Literal object sample. Published return type: OBJECT.',
|
|
465
|
+
result : { id: 'r1', nested: { ok: true } },
|
|
466
|
+
execute : () => ({ id: 'r1', nested: { ok: true } }),
|
|
467
|
+
})
|
|
468
|
+
|
|
469
|
+
ext.addAction({
|
|
470
|
+
category : '3. Results',
|
|
471
|
+
id : 'returnsList',
|
|
472
|
+
label : 'Returns — List',
|
|
473
|
+
description: 'Literal list sample. Set the size to check large payloads. Published return type: LIST.',
|
|
474
|
+
params : z.object({
|
|
475
|
+
size: z.number().optional().default(3).label('Items'),
|
|
476
|
+
}),
|
|
477
|
+
result : [{ id: 'r1' }],
|
|
478
|
+
execute : ({ params }) => Array.from({ length: params.size }, (_, index) => ({ id: `r${ index + 1 }` })),
|
|
479
|
+
})
|
|
480
|
+
|
|
481
|
+
ext.addAction({
|
|
482
|
+
category : '3. Results',
|
|
483
|
+
id : 'returnsNothing',
|
|
484
|
+
label : 'Returns — Nothing',
|
|
485
|
+
description: 'No `result` declared and nothing returned. Published return type: VOID.',
|
|
486
|
+
execute : () => undefined,
|
|
487
|
+
})
|
|
488
|
+
|
|
489
|
+
ext.addAction({
|
|
490
|
+
category : '3. Results',
|
|
491
|
+
id : 'returnsSampleFromSchema',
|
|
492
|
+
label : 'Returns — Sample From A Schema',
|
|
493
|
+
description: 'The sample comes from .example() on the result schema rather than a literal.',
|
|
494
|
+
result : z.object({
|
|
495
|
+
id : z.string(),
|
|
496
|
+
count: z.number(),
|
|
497
|
+
}).example({ id: 'from-example', count: 3 }),
|
|
498
|
+
execute : () => ({ id: 'from-example', count: 3 }),
|
|
499
|
+
})
|
|
500
|
+
|
|
501
|
+
ext.addAction({
|
|
502
|
+
category : '3. Results',
|
|
503
|
+
id : 'returnsSampleFromLoader',
|
|
504
|
+
label : 'Returns — Sample Computed From Params',
|
|
505
|
+
description: 'The sample is computed from the params — toggle "Detailed" and watch the shape change.',
|
|
506
|
+
params : z.object({
|
|
507
|
+
detailed: z.boolean().optional().default(false).label('Detailed'),
|
|
508
|
+
}),
|
|
509
|
+
result : ({ params }) => (params.detailed
|
|
510
|
+
? { id: 'x', detail: { extra: true, nested: [1, 2, 3] } }
|
|
511
|
+
: { id: 'x' }),
|
|
512
|
+
execute : ({ params }) => (params.detailed ? { id: 'x', detail: { extra: true, nested: [1, 2, 3] } } : { id: 'x' }),
|
|
513
|
+
})
|
|
514
|
+
|
|
515
|
+
// ─── 4. Runtime ──────────────────────────────────────────────────────────────
|
|
516
|
+
|
|
517
|
+
ext.addAction({
|
|
518
|
+
category : '4. Runtime',
|
|
519
|
+
id : 'callHelpers',
|
|
520
|
+
label : 'Call Helpers',
|
|
521
|
+
description: 'Invokes each helper declared on the extension and returns what came back.',
|
|
522
|
+
params : z.object({
|
|
523
|
+
text: z.string().optional().default('hello').label('Text for shout()'),
|
|
524
|
+
}),
|
|
525
|
+
result : { shout: 'HELLO', stamp: '2.0.0@…' },
|
|
526
|
+
execute : ({ params, helpers }) => ({
|
|
527
|
+
shout: helpers.shout(params.text),
|
|
528
|
+
stamp: helpers.stamp(),
|
|
529
|
+
}),
|
|
530
|
+
})
|
|
531
|
+
|
|
532
|
+
ext.addAction({
|
|
533
|
+
category : '4. Runtime',
|
|
534
|
+
id : 'emitLogs',
|
|
535
|
+
label : 'Emit Logs',
|
|
536
|
+
description: 'Writes one line at each level. Check they reach the runtime logs.',
|
|
537
|
+
params : z.object({
|
|
538
|
+
message: z.string().optional().default('QA log line').label('Message'),
|
|
539
|
+
}),
|
|
540
|
+
result : { emitted: ['debug', 'info', 'warn', 'error'] },
|
|
541
|
+
execute : ({ params, logger }) => {
|
|
542
|
+
logger.debug(`debug: ${ params.message }`)
|
|
543
|
+
logger.info(`info: ${ params.message }`)
|
|
544
|
+
logger.warn(`warn: ${ params.message }`)
|
|
545
|
+
logger.error(`error: ${ params.message }`)
|
|
546
|
+
|
|
547
|
+
return { emitted: ['debug', 'info', 'warn', 'error'] }
|
|
548
|
+
},
|
|
549
|
+
})
|
|
550
|
+
|
|
551
|
+
ext.addAction({
|
|
552
|
+
category : '4. Runtime',
|
|
553
|
+
id : 'throwError',
|
|
554
|
+
label : 'Throw An Error',
|
|
555
|
+
description: 'Fails on purpose. Check the message reaches the console and the flow.',
|
|
556
|
+
params : z.object({
|
|
557
|
+
message: z.string().optional().default('QA: deliberate failure').label('Message'),
|
|
558
|
+
}),
|
|
559
|
+
result : { neverReturned: true },
|
|
560
|
+
execute : ({ params }) => {
|
|
561
|
+
throw new Error(params.message)
|
|
562
|
+
},
|
|
563
|
+
})
|
|
564
|
+
|
|
565
|
+
ext.addAction({
|
|
566
|
+
category : '4. Runtime',
|
|
567
|
+
id : 'runLongerThanATimeout',
|
|
568
|
+
label : 'Run Longer Than A Timeout',
|
|
569
|
+
description: 'Sleeps, then returns. Platform policy is no timeout on service code — verify a long run survives.',
|
|
570
|
+
params : z.object({
|
|
571
|
+
seconds: z.number().optional().default(5).label('Seconds'),
|
|
572
|
+
}),
|
|
573
|
+
result : { sleptSeconds: 5 },
|
|
574
|
+
execute : async ({ params, logger }) => {
|
|
575
|
+
logger.info(`Sleeping for ${ params.seconds }s`)
|
|
576
|
+
await new Promise(resolve => setTimeout(resolve, params.seconds * 1000))
|
|
577
|
+
|
|
578
|
+
return { sleptSeconds: params.seconds }
|
|
579
|
+
},
|
|
580
|
+
})
|
|
581
|
+
|
|
582
|
+
ext.addAction({
|
|
583
|
+
category : '4. Runtime',
|
|
584
|
+
id : 'readOauthWithoutDeclaringIt',
|
|
585
|
+
label : 'Read OAuth Without Declaring It',
|
|
586
|
+
description: 'This service declares no OAuth, so reading ctx.oauth should fail loudly rather than return null.',
|
|
587
|
+
result : { accessToken: null },
|
|
588
|
+
execute : ({ oauth }) => ({ accessToken: oauth.accessToken }),
|
|
589
|
+
})
|
|
590
|
+
|
|
591
|
+
// ─── 5. HTTP ─────────────────────────────────────────────────────────────────
|
|
592
|
+
|
|
593
|
+
ext.addAction({
|
|
594
|
+
category : '5. HTTP',
|
|
595
|
+
id : 'callHttpEndpoint',
|
|
596
|
+
label : 'Call An HTTP Endpoint',
|
|
597
|
+
description: 'Runs the shared apiRequest helper against a URL you supply. Try https://httpbin.org/get.',
|
|
598
|
+
params : z.object({
|
|
599
|
+
url : z.url().label('URL').describe('e.g. https://httpbin.org/get'),
|
|
600
|
+
method : z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE']).default('GET').label('Method'),
|
|
601
|
+
headers: z.text().optional().label('Headers').describe('One "Name: value" per line.'),
|
|
602
|
+
body : z.text().optional().label('Body (JSON)'),
|
|
603
|
+
viaHelper: z.boolean().optional().default(false).label('Route through the fetchJson helper'),
|
|
604
|
+
}),
|
|
605
|
+
result : ({ params }) => (params.method === 'DELETE' ? { ok: true } : { whateverTheEndpointReturns: true }),
|
|
606
|
+
execute : ({ params, apiRequest, helpers }) => {
|
|
607
|
+
if (params.viaHelper) {
|
|
608
|
+
return helpers.fetchJson(params.url)
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
const headers = Object.fromEntries(
|
|
612
|
+
(params.headers || '')
|
|
613
|
+
.split('\n')
|
|
614
|
+
.map(line => line.trim())
|
|
615
|
+
.filter(Boolean)
|
|
616
|
+
.map(line => {
|
|
617
|
+
const separator = line.indexOf(':')
|
|
618
|
+
|
|
619
|
+
return [line.slice(0, separator).trim(), line.slice(separator + 1).trim()]
|
|
620
|
+
})
|
|
621
|
+
.filter(([name]) => name)
|
|
622
|
+
)
|
|
623
|
+
|
|
624
|
+
return apiRequest({
|
|
625
|
+
url : params.url,
|
|
626
|
+
method: params.method,
|
|
627
|
+
headers,
|
|
628
|
+
body : params.body ? JSON.parse(params.body) : undefined,
|
|
629
|
+
})
|
|
630
|
+
},
|
|
631
|
+
})
|
|
632
|
+
|
|
633
|
+
// ─── 6. Files ────────────────────────────────────────────────────────────────
|
|
634
|
+
|
|
635
|
+
const SCOPES = ['FLOW', 'EXECUTION', 'WORKSPACE']
|
|
636
|
+
|
|
637
|
+
ext.addAction({
|
|
638
|
+
category : '6. Files',
|
|
639
|
+
id : 'filesRoundTrip',
|
|
640
|
+
label : 'Files — Upload, Read, List, Delete',
|
|
641
|
+
description: 'The whole FilesApi surface in one call. The quickest end-to-end check of file storage.',
|
|
642
|
+
params : z.object({
|
|
643
|
+
filename: z.string().optional().default('qa-roundtrip.txt').label('File name'),
|
|
644
|
+
content : z.text().optional().default('hello from QA').label('Content'),
|
|
645
|
+
scope : z.enum(SCOPES).optional().default('FLOW').label('Scope'),
|
|
646
|
+
keepFile: z.boolean().optional().default(false).label('Keep the file (skip the delete)'),
|
|
647
|
+
}),
|
|
648
|
+
result : { uploaded: {}, fetched: {}, listedCount: 1, deleted: {} },
|
|
649
|
+
execute : async ({ params, files }) => {
|
|
650
|
+
const options = { scope: params.scope }
|
|
651
|
+
|
|
652
|
+
const uploaded = await files.uploadFile(Buffer.from(params.content), {
|
|
653
|
+
...options,
|
|
654
|
+
filename : params.filename,
|
|
655
|
+
overwrite : true,
|
|
656
|
+
generateUrl: true,
|
|
657
|
+
})
|
|
658
|
+
const fetched = await files.get(params.filename, options)
|
|
659
|
+
const listed = await files.list({ ...options, limit: 50 })
|
|
660
|
+
const deleted = params.keepFile ? null : await files.delete(params.filename, options)
|
|
661
|
+
|
|
662
|
+
return { uploaded, fetched, listedCount: listed.files.length, deleted }
|
|
663
|
+
},
|
|
664
|
+
})
|
|
665
|
+
|
|
666
|
+
ext.addAction({
|
|
667
|
+
category : '6. Files',
|
|
668
|
+
id : 'filesUsage',
|
|
669
|
+
label : 'Files — Storage Usage',
|
|
670
|
+
description: 'Workspace storage usage and quota. Run it either side of a round trip.',
|
|
671
|
+
result : { workspaceId: 'w1', usedBytes: 0, quotaBytes: 0, fileCount: 0 },
|
|
672
|
+
execute : ({ files }) => files.usage(),
|
|
673
|
+
})
|
|
674
|
+
|
|
675
|
+
// ─── 7. Polling triggers ─────────────────────────────────────────────────────
|
|
676
|
+
// All three mechanisms, fed by a synthetic source so they fire without a real API. `emitPerPoll` controls
|
|
677
|
+
// how many brand-new items each poll invents — set it to 0 to prove a quiet poll emits nothing.
|
|
678
|
+
|
|
679
|
+
let pollCounter = 0
|
|
680
|
+
let lastStampMs = 0
|
|
681
|
+
|
|
682
|
+
// Strictly increasing, even when two items are generated in the same millisecond. The watermark trigger
|
|
683
|
+
// emits only what is PAST its stored marker, so same-millisecond timestamps would make it look broken when
|
|
684
|
+
// you poll by hand. Real polls are ≥30s apart and never hit this.
|
|
685
|
+
function nextStamp() {
|
|
686
|
+
lastStampMs = Math.max(Date.now(), lastStampMs + 1)
|
|
687
|
+
|
|
688
|
+
return new Date(lastStampMs).toISOString()
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
function syntheticItems(count) {
|
|
692
|
+
return Array.from({ length: count }, () => {
|
|
693
|
+
pollCounter += 1
|
|
694
|
+
|
|
695
|
+
return {
|
|
696
|
+
id : `evt-${ pollCounter }`,
|
|
697
|
+
sequence : pollCounter,
|
|
698
|
+
createdAt: nextStamp(),
|
|
699
|
+
note : `synthetic event ${ pollCounter }`,
|
|
700
|
+
}
|
|
701
|
+
})
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
const emitPerPoll = () => z.object({
|
|
705
|
+
emitPerPoll: z.number().optional().default(1).label('New items per poll'),
|
|
706
|
+
})
|
|
707
|
+
|
|
708
|
+
ext.addPollingTrigger({
|
|
709
|
+
category : '7. Triggers',
|
|
710
|
+
id : 'onNewItemByDedupe',
|
|
711
|
+
label : 'On New Item — by id (dedupe)',
|
|
712
|
+
description: 'Emits ids it has not seen before. Polling interval can be customized (minimum 30 seconds).',
|
|
713
|
+
params : emitPerPoll(),
|
|
714
|
+
result : { id: 'evt-1', sequence: 1, createdAt: '2026-01-01T00:00:00.000Z' },
|
|
715
|
+
fetch : ({ params }) => syntheticItems(params.emitPerPoll ?? 1),
|
|
716
|
+
dedupe : { by: 'id', stateKey: 'seenIds', max: 200 },
|
|
717
|
+
})
|
|
718
|
+
|
|
719
|
+
ext.addPollingTrigger({
|
|
720
|
+
category : '7. Triggers',
|
|
721
|
+
id : 'onNewItemByWatermark',
|
|
722
|
+
label : 'On New Item — by timestamp (watermark)',
|
|
723
|
+
description: 'Emits items newer than the stored marker. Polling interval can be customized (minimum 30 seconds).',
|
|
724
|
+
params : emitPerPoll(),
|
|
725
|
+
result : { id: 'evt-1', createdAt: '2026-01-01T00:00:00.000Z' },
|
|
726
|
+
fetch : ({ params }) => syntheticItems(params.emitPerPoll ?? 1),
|
|
727
|
+
watermark : { by: 'createdAt', stateKey: 'lastCreatedAt' },
|
|
728
|
+
})
|
|
729
|
+
|
|
730
|
+
ext.addPollingTrigger({
|
|
731
|
+
category : '7. Triggers',
|
|
732
|
+
id : 'onNewItemByOwnState',
|
|
733
|
+
label : 'On New Item — managing its own state (poll)',
|
|
734
|
+
description: 'Owns its own state and returns it, so you can watch it advance. '
|
|
735
|
+
+ 'Polling interval can be customized (minimum 30 seconds).',
|
|
736
|
+
params : emitPerPoll(),
|
|
737
|
+
result : { id: 'evt-1', pollNumber: 1 },
|
|
738
|
+
poll : ({ params, state, isLearningMode, logger }) => {
|
|
739
|
+
const events = syntheticItems(params.emitPerPoll ?? 1)
|
|
740
|
+
|
|
741
|
+
// Learning mode runs during setup: return a sample and do NOT persist state.
|
|
742
|
+
if (isLearningMode) {
|
|
743
|
+
return { events: events.slice(0, 1), state: null }
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
const pollNumber = (state?.pollNumber || 0) + 1
|
|
747
|
+
|
|
748
|
+
logger.info(`poll #${ pollNumber } emitting ${ events.length } event(s)`)
|
|
749
|
+
|
|
750
|
+
return {
|
|
751
|
+
events: events.map(event => ({ ...event, pollNumber })),
|
|
752
|
+
state : { pollNumber, lastSequence: pollCounter },
|
|
753
|
+
}
|
|
754
|
+
},
|
|
755
|
+
})
|