@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,590 @@
|
|
|
1
|
+
// {{name}} — a FlowRunner service.
|
|
2
|
+
//
|
|
3
|
+
// A working to-do list service: create lists, add and update tasks, tick them off, read them back. Drop
|
|
4
|
+
// these actions straight into a flow and they do what they say.
|
|
5
|
+
//
|
|
6
|
+
// STORAGE IS IN MEMORY. Lists live in the `storage` map below, in the pod's RAM. They survive for as long
|
|
7
|
+
// as the pod does and are gone after a restart or redeploy — that is deliberate, so the demo needs no
|
|
8
|
+
// database. Swap `storage` for real API calls (see the HTTP Request action for how `apiRequest` works)
|
|
9
|
+
// when you build the real thing.
|
|
10
|
+
|
|
11
|
+
const z = Flowrunner.z
|
|
12
|
+
|
|
13
|
+
// ─── In-memory state ─────────────────────────────────────────────────────────
|
|
14
|
+
// The whole "database". The functions that read and write it are at the BOTTOM of this file, where
|
|
15
|
+
// module-level helpers belong — so the service’s shape reads first and its plumbing last.
|
|
16
|
+
|
|
17
|
+
const storage = {
|
|
18
|
+
lists : new Map(),
|
|
19
|
+
nextId : { list: 1, task: 1 },
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// ─── The extension ───────────────────────────────────────────────────────────
|
|
23
|
+
|
|
24
|
+
const ext = Flowrunner.createExtension({
|
|
25
|
+
id : '{{id}}',
|
|
26
|
+
name : '{{name}}',
|
|
27
|
+
description: '{{description}}',
|
|
28
|
+
logo : '/icon.svg',
|
|
29
|
+
|
|
30
|
+
// [primary, secondary] — the node's colours in the flow editor.
|
|
31
|
+
appearanceColors: ['#4f46e5', '#a5b4fc'],
|
|
32
|
+
|
|
33
|
+
// {{#if useFilesApi}}
|
|
34
|
+
// Provisions `ctx.files` in every handler — see the Export List action at the bottom.
|
|
35
|
+
usesFileStorage: true,
|
|
36
|
+
// {{/if}}
|
|
37
|
+
|
|
38
|
+
// Workspace configuration. `owner` is the only required field — everything else has a default.
|
|
39
|
+
configItems: z.object({
|
|
40
|
+
owner : z.string().label('Owner').describe('Stamped on every list and task this service creates.'),
|
|
41
|
+
defaultPriority: z.enum(['low', 'normal', 'high']).optional().default('normal').label('Default Priority'),
|
|
42
|
+
maxTasksPerList: z.number().optional().default(50).label('Max Tasks Per List'),
|
|
43
|
+
autoCreateList : z.boolean().optional().default(false).label('Auto-create Missing Lists')
|
|
44
|
+
.describe('When on, Add Task creates the list instead of failing if it does not exist yet.'),
|
|
45
|
+
defaultTags : z.text().optional().label('Default Tags').describe('One tag per line, added to every new task.'),
|
|
46
|
+
// Sent by the HTTP Request action when "Use Stored Auth" is on.
|
|
47
|
+
//
|
|
48
|
+
// There is also a `.shared()` plugin that moves a field to a global config tier shared by every
|
|
49
|
+
// workspace — deliberately not used here: custom extensions deployed with this CLI have per-app config
|
|
50
|
+
// ONLY, so a `.shared()` field would never be filled in. It is for shared (global) extensions.
|
|
51
|
+
proxyAuthToken : z.string().optional().label('Proxy Auth Token'),
|
|
52
|
+
}),
|
|
53
|
+
|
|
54
|
+
// Runs once per invocation; whatever it returns is `context` in every handler. Note `maxTasksPerList`:
|
|
55
|
+
// a z.number() config field RENDERS as a text box, but the value is converted to the declared type before
|
|
56
|
+
// your schema validates it — so it arrives as a number and needs no conversion here.
|
|
57
|
+
initContext: ({ config }) => ({
|
|
58
|
+
owner : config.owner,
|
|
59
|
+
defaultPriority: config.defaultPriority,
|
|
60
|
+
maxTasks : config.maxTasksPerList,
|
|
61
|
+
autoCreateList : config.autoCreateList,
|
|
62
|
+
defaultTags : (config.defaultTags || '').split('\n').map(tag => tag.trim()).filter(Boolean),
|
|
63
|
+
authToken : config.proxyAuthToken,
|
|
64
|
+
}),
|
|
65
|
+
|
|
66
|
+
// The one place HTTP happens — used by the HTTP Request action. Centralizes header handling, error
|
|
67
|
+
// normalization and logging so handlers stay declarative.
|
|
68
|
+
// The argument shape is yours to define; the runtime only injects `context` and `logger`.
|
|
69
|
+
apiRequest: async ({ url, method = 'get', headers = {}, query, body, withAuth, context, logger }) => {
|
|
70
|
+
logger.debug(`[${ method.toUpperCase() }] ${ url }`)
|
|
71
|
+
|
|
72
|
+
const allHeaders = withAuth && context.authToken
|
|
73
|
+
? { Authorization: `Bearer ${ context.authToken }`, ...headers }
|
|
74
|
+
: headers
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
return await Flowrunner.Request[method.toLowerCase()](url)
|
|
78
|
+
.set(allHeaders)
|
|
79
|
+
.query(query)
|
|
80
|
+
.send(body)
|
|
81
|
+
} catch (error) {
|
|
82
|
+
logger.error(`Request to ${ url } failed: ${ error.message }`)
|
|
83
|
+
|
|
84
|
+
throw error
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
// Bound helpers, available as `helpers` in every handler.
|
|
89
|
+
helpers: ({ context }) => ({
|
|
90
|
+
// A new task, with the config defaults already folded in.
|
|
91
|
+
buildTask: input => ({
|
|
92
|
+
id : nextId('task'),
|
|
93
|
+
title : input.title,
|
|
94
|
+
notes : input.notes || '',
|
|
95
|
+
completed : false,
|
|
96
|
+
priority : input.priority || context.defaultPriority,
|
|
97
|
+
dueDate : input.dueDate ? input.dueDate.toISOString() : null,
|
|
98
|
+
tags : [...context.defaultTags, ...(input.tags || [])],
|
|
99
|
+
fields : input.fields || {},
|
|
100
|
+
createdBy : context.owner,
|
|
101
|
+
createdAt : new Date().toISOString(),
|
|
102
|
+
completedAt: null,
|
|
103
|
+
}),
|
|
104
|
+
}),
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
// ─── Dictionaries ────────────────────────────────────────────────────────────
|
|
108
|
+
// These fill the dropdowns in the flow editor. Bind one to a param with `.dictionary(ref)`.
|
|
109
|
+
|
|
110
|
+
// The minimal form — no criteria, so it can be loaded at any time.
|
|
111
|
+
const getListsDictionary = ext.dictionary({
|
|
112
|
+
id : 'getListsDictionary',
|
|
113
|
+
label : 'Lists',
|
|
114
|
+
description: 'Every to-do list currently in memory.',
|
|
115
|
+
execute : ({ search }) => [...storage.lists.values()]
|
|
116
|
+
.filter(list => !search || list.name.toLowerCase().includes(search.toLowerCase()))
|
|
117
|
+
.map(list => ({ label: list.name, value: list.id, note: `${ list.tasks.size } task(s)` })),
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
// With criteria: any param bound to this dictionary automatically gets `dependsOn: ['listId']`, so the
|
|
121
|
+
// console reloads the task options whenever the chosen list changes. Paginated through `cursor`.
|
|
122
|
+
const PAGE_SIZE = 25
|
|
123
|
+
|
|
124
|
+
const getTasksDictionary = ext.dictionary({
|
|
125
|
+
id : 'getTasksDictionary',
|
|
126
|
+
label : 'Tasks',
|
|
127
|
+
description: 'Tasks belonging to the selected list.',
|
|
128
|
+
criteria : z.object({
|
|
129
|
+
listId: z.string().label('List').dictionary(getListsDictionary),
|
|
130
|
+
}),
|
|
131
|
+
result : { items: [{ label: 'Buy milk', value: 'task-1' }], cursor: null },
|
|
132
|
+
execute : ({ search, cursor, criteria }) => {
|
|
133
|
+
const matching = [...requireList(criteria.listId).tasks.values()]
|
|
134
|
+
.filter(task => !search || task.title.toLowerCase().includes(search.toLowerCase()))
|
|
135
|
+
|
|
136
|
+
const offset = Number(cursor) || 0
|
|
137
|
+
const page = matching.slice(offset, offset + PAGE_SIZE)
|
|
138
|
+
|
|
139
|
+
return {
|
|
140
|
+
items : page.map(task => ({
|
|
141
|
+
label: task.title,
|
|
142
|
+
value: task.id,
|
|
143
|
+
note : task.completed ? 'completed' : task.priority,
|
|
144
|
+
})),
|
|
145
|
+
cursor: offset + PAGE_SIZE < matching.length ? String(offset + PAGE_SIZE) : null,
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
// ─── Shared result shapes ────────────────────────────────────────────────────
|
|
151
|
+
// A `result` is normally the literal sample object itself — see every action below. A zod schema with
|
|
152
|
+
// `.example()` earns its place only where the SAME shape is returned by several actions, as here: Add
|
|
153
|
+
// Task, Update Task and Mark Task Completed all answer with a task. The reuse is the justification, not
|
|
154
|
+
// the typing — the platform publishes the example either way.
|
|
155
|
+
|
|
156
|
+
const TASK_SAMPLE = {
|
|
157
|
+
id : 'task-1',
|
|
158
|
+
title : 'Buy milk',
|
|
159
|
+
notes : 'Whole, not skimmed',
|
|
160
|
+
completed : false,
|
|
161
|
+
priority : 'normal',
|
|
162
|
+
dueDate : '2026-02-01T00:00:00.000Z',
|
|
163
|
+
tags : ['groceries'],
|
|
164
|
+
fields : { 'Story Points': '3' },
|
|
165
|
+
createdBy : 'ops@example.com',
|
|
166
|
+
createdAt : '2026-01-31T08:00:00.000Z',
|
|
167
|
+
completedAt: null,
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const taskResult = z.object({
|
|
171
|
+
id : z.string(),
|
|
172
|
+
title : z.string(),
|
|
173
|
+
notes : z.string(),
|
|
174
|
+
completed : z.boolean(),
|
|
175
|
+
priority : z.string(),
|
|
176
|
+
dueDate : z.string().nullable(),
|
|
177
|
+
tags : z.array(z.string()),
|
|
178
|
+
fields : z.record(z.string(), z.string()),
|
|
179
|
+
createdBy : z.string(),
|
|
180
|
+
createdAt : z.string(),
|
|
181
|
+
completedAt: z.string().nullable(),
|
|
182
|
+
}).example(TASK_SAMPLE)
|
|
183
|
+
|
|
184
|
+
// ─── Lists ───────────────────────────────────────────────────────────────────
|
|
185
|
+
|
|
186
|
+
ext.addAction({
|
|
187
|
+
category : 'Lists',
|
|
188
|
+
id : 'createList',
|
|
189
|
+
label : 'Create List',
|
|
190
|
+
description: 'Creates a to-do list.',
|
|
191
|
+
params : z.object({
|
|
192
|
+
name : z.string().label('Name'),
|
|
193
|
+
description : z.text().optional().label('Description'),
|
|
194
|
+
// Each label here becomes an extra input on Add Task for this list — see `dynamicParams` below.
|
|
195
|
+
customFields: z.array(z.string()).optional().label('Custom Fields')
|
|
196
|
+
.describe('Extra per-task fields, e.g. "Story Points". They appear as inputs on Add Task.'),
|
|
197
|
+
}),
|
|
198
|
+
// `result` is the literal sample `execute` returns — the object, nothing else.
|
|
199
|
+
result : {
|
|
200
|
+
id : 'list-1',
|
|
201
|
+
name : 'Groceries',
|
|
202
|
+
description : 'Weekly shop',
|
|
203
|
+
customFields: ['Story Points'],
|
|
204
|
+
createdBy : 'ops@example.com',
|
|
205
|
+
createdAt : '2026-01-31T08:00:00.000Z',
|
|
206
|
+
taskCount : 0,
|
|
207
|
+
openCount : 0,
|
|
208
|
+
},
|
|
209
|
+
execute : ({ params, context }) => {
|
|
210
|
+
const list = {
|
|
211
|
+
id : nextId('list'),
|
|
212
|
+
name : params.name,
|
|
213
|
+
description : params.description || '',
|
|
214
|
+
customFields: params.customFields || [],
|
|
215
|
+
createdBy : context.owner,
|
|
216
|
+
createdAt : new Date().toISOString(),
|
|
217
|
+
tasks : new Map(),
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
storage.lists.set(list.id, list)
|
|
221
|
+
|
|
222
|
+
return serializeList(list)
|
|
223
|
+
},
|
|
224
|
+
})
|
|
225
|
+
|
|
226
|
+
// `result` as a literal array — the simplest form, and it makes the return type a LIST.
|
|
227
|
+
ext.addAction({
|
|
228
|
+
category : 'Lists',
|
|
229
|
+
id : 'getLists',
|
|
230
|
+
label : 'Get Lists',
|
|
231
|
+
description: 'Returns every list, newest first.',
|
|
232
|
+
params : z.object({}),
|
|
233
|
+
result : [{
|
|
234
|
+
id : 'list-1',
|
|
235
|
+
name : 'Groceries',
|
|
236
|
+
description : 'Weekly shop',
|
|
237
|
+
customFields: ['Story Points'],
|
|
238
|
+
createdBy : 'ops@example.com',
|
|
239
|
+
createdAt : '2026-01-31T08:00:00.000Z',
|
|
240
|
+
taskCount : 2,
|
|
241
|
+
openCount : 1,
|
|
242
|
+
}],
|
|
243
|
+
execute : () => [...storage.lists.values()].reverse().map(serializeList),
|
|
244
|
+
})
|
|
245
|
+
|
|
246
|
+
ext.addAction({
|
|
247
|
+
category : 'Lists',
|
|
248
|
+
id : 'getList',
|
|
249
|
+
label : 'Get List',
|
|
250
|
+
description: 'Returns one list with its task counts.',
|
|
251
|
+
params : z.object({
|
|
252
|
+
listId: z.string().label('List').dictionary(getListsDictionary),
|
|
253
|
+
}),
|
|
254
|
+
result : {
|
|
255
|
+
id : 'list-1',
|
|
256
|
+
name : 'Groceries',
|
|
257
|
+
description : 'Weekly shop',
|
|
258
|
+
customFields: ['Story Points'],
|
|
259
|
+
createdBy : 'ops@example.com',
|
|
260
|
+
createdAt : '2026-01-31T08:00:00.000Z',
|
|
261
|
+
taskCount : 2,
|
|
262
|
+
openCount : 1,
|
|
263
|
+
},
|
|
264
|
+
execute : ({ params }) => serializeList(requireList(params.listId)),
|
|
265
|
+
})
|
|
266
|
+
|
|
267
|
+
ext.addAction({
|
|
268
|
+
category : 'Lists',
|
|
269
|
+
id : 'deleteList',
|
|
270
|
+
label : 'Delete List',
|
|
271
|
+
description: 'Deletes a list and every task in it.',
|
|
272
|
+
params : z.object({
|
|
273
|
+
listId: z.string().label('List').dictionary(getListsDictionary),
|
|
274
|
+
}),
|
|
275
|
+
result : { deleted: true, removedTasks: 2 },
|
|
276
|
+
execute : ({ params, logger }) => {
|
|
277
|
+
const list = requireList(params.listId)
|
|
278
|
+
const removedTasks = list.tasks.size
|
|
279
|
+
|
|
280
|
+
storage.lists.delete(list.id)
|
|
281
|
+
logger.info(`Deleted list ${ list.id } with ${ removedTasks } task(s)`)
|
|
282
|
+
|
|
283
|
+
return { deleted: true, removedTasks }
|
|
284
|
+
},
|
|
285
|
+
})
|
|
286
|
+
|
|
287
|
+
// ─── Tasks ───────────────────────────────────────────────────────────────────
|
|
288
|
+
|
|
289
|
+
ext.addAction({
|
|
290
|
+
category : 'Tasks',
|
|
291
|
+
id : 'addTask',
|
|
292
|
+
label : 'Add Task',
|
|
293
|
+
description : 'Adds a task to a list.',
|
|
294
|
+
params : z.object({
|
|
295
|
+
listId : z.string().label('List').dictionary(getListsDictionary),
|
|
296
|
+
title : z.string().label('Title'),
|
|
297
|
+
notes : z.text().optional().label('Notes'),
|
|
298
|
+
priority: z.enum(['low', 'normal', 'high']).optional().label('Priority')
|
|
299
|
+
.describe('Falls back to the Default Priority config value.'),
|
|
300
|
+
dueDate : z.coerce.date().optional().label('Due Date'),
|
|
301
|
+
tags : z.array(z.string()).optional().label('Tags'),
|
|
302
|
+
}),
|
|
303
|
+
// The list's Custom Fields become real inputs here. `criteria` is what the console watches: pick a
|
|
304
|
+
// different list and these fields are regenerated.
|
|
305
|
+
dynamicParams: {
|
|
306
|
+
criteria: z.object({ listId: z.string().optional() }),
|
|
307
|
+
resolve : ({ criteria }) => {
|
|
308
|
+
const list = criteria.listId && storage.lists.get(criteria.listId)
|
|
309
|
+
const shape = {}
|
|
310
|
+
|
|
311
|
+
for (const label of list ? list.customFields : []) {
|
|
312
|
+
shape[customFieldKey(label)] = z.string().optional().label(label)
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return z.object(shape)
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
result : taskResult,
|
|
319
|
+
execute : ({ params, context, helpers }) => {
|
|
320
|
+
let list = storage.lists.get(params.listId)
|
|
321
|
+
|
|
322
|
+
if (!list && context.autoCreateList) {
|
|
323
|
+
list = {
|
|
324
|
+
id : params.listId,
|
|
325
|
+
name : params.listId,
|
|
326
|
+
description : '',
|
|
327
|
+
customFields: [],
|
|
328
|
+
createdBy : context.owner,
|
|
329
|
+
createdAt : new Date().toISOString(),
|
|
330
|
+
tasks : new Map(),
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
storage.lists.set(list.id, list)
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
if (!list) {
|
|
337
|
+
throw new Error(`List "${ params.listId }" does not exist. Turn on Auto-create Missing Lists to create it.`)
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
if (list.tasks.size >= context.maxTasks) {
|
|
341
|
+
throw new Error(`List "${ list.id }" already holds ${ context.maxTasks } tasks (Max Tasks Per List)`)
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// The generated custom-field values arrive as ordinary top-level params.
|
|
345
|
+
const fields = {}
|
|
346
|
+
|
|
347
|
+
for (const label of list.customFields) {
|
|
348
|
+
const value = params[customFieldKey(label)]
|
|
349
|
+
|
|
350
|
+
if (value !== undefined) {
|
|
351
|
+
fields[label] = value
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
const task = helpers.buildTask({ ...params, fields })
|
|
356
|
+
|
|
357
|
+
list.tasks.set(task.id, task)
|
|
358
|
+
|
|
359
|
+
return task
|
|
360
|
+
},
|
|
361
|
+
})
|
|
362
|
+
|
|
363
|
+
ext.addAction({
|
|
364
|
+
category : 'Tasks',
|
|
365
|
+
id : 'updateTask',
|
|
366
|
+
label : 'Update Task',
|
|
367
|
+
description: 'Changes a task. Only the fields you fill in are touched.',
|
|
368
|
+
params : z.object({
|
|
369
|
+
listId : z.string().label('List').dictionary(getListsDictionary),
|
|
370
|
+
taskId : z.string().label('Task').dictionary(getTasksDictionary),
|
|
371
|
+
title : z.string().optional().label('Title'),
|
|
372
|
+
notes : z.text().optional().label('Notes'),
|
|
373
|
+
priority: z.enum(['low', 'normal', 'high']).optional().label('Priority'),
|
|
374
|
+
dueDate : z.coerce.date().optional().label('Due Date'),
|
|
375
|
+
}),
|
|
376
|
+
result : taskResult,
|
|
377
|
+
execute : ({ params }) => {
|
|
378
|
+
const task = requireTask(params.listId, params.taskId)
|
|
379
|
+
|
|
380
|
+
if (params.title !== undefined) {
|
|
381
|
+
task.title = params.title
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
if (params.notes !== undefined) {
|
|
385
|
+
task.notes = params.notes
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
if (params.priority !== undefined) {
|
|
389
|
+
task.priority = params.priority
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
if (params.dueDate !== undefined) {
|
|
393
|
+
task.dueDate = params.dueDate.toISOString()
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
return task
|
|
397
|
+
},
|
|
398
|
+
})
|
|
399
|
+
|
|
400
|
+
ext.addAction({
|
|
401
|
+
category : 'Tasks',
|
|
402
|
+
id : 'completeTask',
|
|
403
|
+
label : 'Mark Task Completed',
|
|
404
|
+
description: 'Ticks a task off, or un-ticks it.',
|
|
405
|
+
params : z.object({
|
|
406
|
+
listId : z.string().label('List').dictionary(getListsDictionary),
|
|
407
|
+
taskId : z.string().label('Task').dictionary(getTasksDictionary),
|
|
408
|
+
completed: z.boolean().optional().default(true).label('Completed'),
|
|
409
|
+
}),
|
|
410
|
+
result : taskResult,
|
|
411
|
+
execute : ({ params }) => {
|
|
412
|
+
const task = requireTask(params.listId, params.taskId)
|
|
413
|
+
|
|
414
|
+
task.completed = params.completed
|
|
415
|
+
task.completedAt = params.completed ? new Date().toISOString() : null
|
|
416
|
+
|
|
417
|
+
return task
|
|
418
|
+
},
|
|
419
|
+
})
|
|
420
|
+
|
|
421
|
+
ext.addAction({
|
|
422
|
+
category : 'Tasks',
|
|
423
|
+
id : 'deleteTask',
|
|
424
|
+
label : 'Delete Task',
|
|
425
|
+
description: 'Removes a task from a list.',
|
|
426
|
+
params : z.object({
|
|
427
|
+
listId: z.string().label('List').dictionary(getListsDictionary),
|
|
428
|
+
taskId: z.string().label('Task').dictionary(getTasksDictionary),
|
|
429
|
+
}),
|
|
430
|
+
result : { deleted: true },
|
|
431
|
+
execute : ({ params }) => {
|
|
432
|
+
const list = requireList(params.listId)
|
|
433
|
+
|
|
434
|
+
requireTask(params.listId, params.taskId)
|
|
435
|
+
list.tasks.delete(params.taskId)
|
|
436
|
+
|
|
437
|
+
return { deleted: true }
|
|
438
|
+
},
|
|
439
|
+
})
|
|
440
|
+
|
|
441
|
+
ext.addAction({
|
|
442
|
+
category : 'Tasks',
|
|
443
|
+
id : 'getTasks',
|
|
444
|
+
label : 'Get Tasks',
|
|
445
|
+
description: 'Returns the tasks of a list, optionally filtered by status.',
|
|
446
|
+
params : z.object({
|
|
447
|
+
listId: z.string().label('List').dictionary(getListsDictionary),
|
|
448
|
+
// `.labels()` shows a readable label per VALUE. The element stores the value, so renaming a label
|
|
449
|
+
// leaves every saved flow working.
|
|
450
|
+
status: z.enum(['all', 'completed', 'pending'])
|
|
451
|
+
.labels({ all: 'All', completed: 'Completed', pending: 'Not completed' })
|
|
452
|
+
.default('all').label('Status'),
|
|
453
|
+
search: z.string().optional().label('Search'),
|
|
454
|
+
limit : z.number().optional().default(50).label('Limit'),
|
|
455
|
+
}),
|
|
456
|
+
// A literal ARRAY, which is what makes the return type a LIST. `taskResult` cannot be used here: a
|
|
457
|
+
// zod `result` always publishes as OBJECT, whatever the schema says.
|
|
458
|
+
result : [TASK_SAMPLE],
|
|
459
|
+
execute : ({ params }) => {
|
|
460
|
+
const tasks = [...requireList(params.listId).tasks.values()]
|
|
461
|
+
// `status` is the MAPPED value here ('all' / 'completed' / 'pending'), never the label.
|
|
462
|
+
.filter(task => params.status === 'all' || (params.status === 'completed') === task.completed)
|
|
463
|
+
.filter(task => !params.search || task.title.toLowerCase().includes(params.search.toLowerCase()))
|
|
464
|
+
|
|
465
|
+
return tasks.slice(0, params.limit)
|
|
466
|
+
},
|
|
467
|
+
})
|
|
468
|
+
|
|
469
|
+
// ─── HTTP ────────────────────────────────────────────────────────────────────
|
|
470
|
+
|
|
471
|
+
// The one action that leaves the pod, and the reason `apiRequest` exists above. A real integration would
|
|
472
|
+
// have every action go through `apiRequest` against its vendor's API; here the URL is yours to supply.
|
|
473
|
+
ext.addAction({
|
|
474
|
+
category : 'HTTP',
|
|
475
|
+
id : 'httpRequest',
|
|
476
|
+
label : 'HTTP Request',
|
|
477
|
+
description: 'Sends an HTTP request and returns the response.',
|
|
478
|
+
params : z.object({
|
|
479
|
+
url : z.string().label('URL'),
|
|
480
|
+
method : z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE']).default('GET').label('Method'),
|
|
481
|
+
headers : z.text().optional().label('Headers').describe('One "Name: value" per line.'),
|
|
482
|
+
body : z.text().optional().label('Body'),
|
|
483
|
+
useStoredAuth: z.boolean().optional().default(false).label('Use Stored Auth')
|
|
484
|
+
.describe('Send the shared Proxy Auth Token as a Bearer header.'),
|
|
485
|
+
}),
|
|
486
|
+
// `result` as a LOADER function — the sample genuinely depends on the params, so it cannot be a literal.
|
|
487
|
+
result : ({ params }) => (params.method === 'DELETE'
|
|
488
|
+
? { ok: true }
|
|
489
|
+
: { id: 1, title: 'Whatever the endpoint returns' }),
|
|
490
|
+
execute : ({ params, apiRequest }) => {
|
|
491
|
+
const headers = Object.fromEntries(
|
|
492
|
+
(params.headers || '')
|
|
493
|
+
.split('\n')
|
|
494
|
+
.map(line => line.trim())
|
|
495
|
+
.filter(Boolean)
|
|
496
|
+
.map(line => {
|
|
497
|
+
const separator = line.indexOf(':')
|
|
498
|
+
|
|
499
|
+
return [line.slice(0, separator).trim(), line.slice(separator + 1).trim()]
|
|
500
|
+
})
|
|
501
|
+
.filter(([name]) => name)
|
|
502
|
+
)
|
|
503
|
+
|
|
504
|
+
return apiRequest({
|
|
505
|
+
url : params.url,
|
|
506
|
+
method : params.method,
|
|
507
|
+
headers,
|
|
508
|
+
withAuth: params.useStoredAuth,
|
|
509
|
+
body : params.body ? JSON.parse(params.body) : undefined,
|
|
510
|
+
})
|
|
511
|
+
},
|
|
512
|
+
})
|
|
513
|
+
|
|
514
|
+
// {{#if useFilesApi}}
|
|
515
|
+
// ─── Files ───────────────────────────────────────────────────────────────────
|
|
516
|
+
// `files` and `filesScope` are in the handler context bag because `usesFileStorage: true` is set above.
|
|
517
|
+
// (`filesScope` is always there — it is just the layer names — but `files` needs the opt-in.)
|
|
518
|
+
ext.addAction({
|
|
519
|
+
category : 'Lists',
|
|
520
|
+
id : 'exportList',
|
|
521
|
+
label : 'Export List',
|
|
522
|
+
description: 'Writes a list and its tasks to a JSON file in the workspace file storage.',
|
|
523
|
+
params : z.object({
|
|
524
|
+
listId : z.string().label('List').dictionary(getListsDictionary),
|
|
525
|
+
filename: z.string().optional().default('list.json').label('File name'),
|
|
526
|
+
}),
|
|
527
|
+
result : { url: 'https://files.example.invalid/list.json', size: 128 },
|
|
528
|
+
execute : async ({ params, files, filesScope }) => {
|
|
529
|
+
const list = requireList(params.listId)
|
|
530
|
+
const payload = { ...serializeList(list), tasks: [...list.tasks.values()] }
|
|
531
|
+
|
|
532
|
+
const saved = await files.uploadFile(Buffer.from(JSON.stringify(payload, null, 2)), {
|
|
533
|
+
// `filesScope` names the storage layers: WORKSPACE, FLOW or EXECUTION.
|
|
534
|
+
scope : filesScope.FLOW,
|
|
535
|
+
filename : params.filename,
|
|
536
|
+
generateUrl: true,
|
|
537
|
+
ttl : 3600,
|
|
538
|
+
})
|
|
539
|
+
|
|
540
|
+
return { url: saved.url, size: saved.size }
|
|
541
|
+
},
|
|
542
|
+
})
|
|
543
|
+
// {{/if}}
|
|
544
|
+
|
|
545
|
+
// ─── Helpers ─────────────────────────────────────────────────────────────────
|
|
546
|
+
// Module-level helpers: no `ctx`, so they are plain function declarations at the end of the file.
|
|
547
|
+
// Declarations hoist, which is what lets the actions above call them.
|
|
548
|
+
|
|
549
|
+
function nextId(kind) {
|
|
550
|
+
return `${ kind }-${ storage.nextId[kind]++ }`
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
function requireList(listId) {
|
|
554
|
+
const list = storage.lists.get(listId)
|
|
555
|
+
|
|
556
|
+
if (!list) {
|
|
557
|
+
throw new Error(`List "${ listId }" does not exist`)
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
return list
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
function requireTask(listId, taskId) {
|
|
564
|
+
const task = requireList(listId).tasks.get(taskId)
|
|
565
|
+
|
|
566
|
+
if (!task) {
|
|
567
|
+
throw new Error(`Task "${ taskId }" does not exist in list "${ listId }"`)
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
return task
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
// What a list looks like to a flow — the tasks Map itself never leaves the service.
|
|
574
|
+
function serializeList(list) {
|
|
575
|
+
return {
|
|
576
|
+
id : list.id,
|
|
577
|
+
name : list.name,
|
|
578
|
+
description : list.description,
|
|
579
|
+
customFields: list.customFields,
|
|
580
|
+
createdBy : list.createdBy,
|
|
581
|
+
createdAt : list.createdAt,
|
|
582
|
+
taskCount : list.tasks.size,
|
|
583
|
+
openCount : [...list.tasks.values()].filter(task => !task.completed).length,
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
// Turns a custom field label into a usable param name: "Story Points" → "cf_story_points".
|
|
588
|
+
function customFieldKey(label) {
|
|
589
|
+
return `cf_${ label.toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/^_|_$/g, '') }`
|
|
590
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "demo-todo-list",
|
|
3
|
+
"label": "Demo To-do List",
|
|
4
|
+
"description": "A working to-do list service \u2014 lists, tasks, completion, plus a generic HTTP Request action.",
|
|
5
|
+
"prompts": [
|
|
6
|
+
{
|
|
7
|
+
"name": "id",
|
|
8
|
+
"label": "Service id",
|
|
9
|
+
"type": "string",
|
|
10
|
+
"default": "demo-todo-list",
|
|
11
|
+
"validate": "serviceId",
|
|
12
|
+
"hint": "Becomes the services/<id>/ folder and the service id, which is frozen once deployed."
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "name",
|
|
16
|
+
"label": "Display name",
|
|
17
|
+
"type": "string",
|
|
18
|
+
"default": "{{id|titleCase}}",
|
|
19
|
+
"validate": "nonEmpty"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"values": {
|
|
23
|
+
"description": "Manage to-do lists and tasks from a flow.",
|
|
24
|
+
"useFilesApi": true
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
{
|
|
28
|
+
"from": "package.json",
|
|
29
|
+
"to": "package.json"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"from": "src/index.js",
|
|
33
|
+
"to": "src/index.js"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"from": "README.md",
|
|
37
|
+
"to": "README.md"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"from": "public/icon.svg",
|
|
41
|
+
"to": "public/icon.svg"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|