@botpress/cli 2.1.1 → 2.1.3
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/.turbo/turbo-build.log +22 -0
- package/dist/api/bot-body.js +89 -0
- package/dist/api/bot-body.js.map +7 -0
- package/dist/api/client.js +169 -0
- package/dist/api/client.js.map +7 -0
- package/dist/api/find-previous-version.js +66 -0
- package/dist/api/find-previous-version.js.map +7 -0
- package/dist/api/find-previous-version.test.js +76 -0
- package/dist/api/find-previous-version.test.js.map +7 -0
- package/dist/api/index.js +23 -0
- package/dist/api/index.js.map +7 -0
- package/dist/api/integration-body.js +146 -0
- package/dist/api/integration-body.js.map +7 -0
- package/dist/api/interface-body.js +95 -0
- package/dist/api/interface-body.js.map +7 -0
- package/dist/api/paging.js +42 -0
- package/dist/api/paging.js.map +7 -0
- package/dist/api/plugin-body.js +84 -0
- package/dist/api/plugin-body.js.map +7 -0
- package/dist/api/types.js +17 -0
- package/dist/api/types.js.map +7 -0
- package/dist/chat/index.js +211 -0
- package/dist/chat/index.js.map +7 -0
- package/dist/code-generation/bot-implementation/bot-implementation.js +116 -0
- package/dist/code-generation/bot-implementation/bot-implementation.js.map +7 -0
- package/dist/code-generation/bot-implementation/bot-plugins/index.js +80 -0
- package/dist/code-generation/bot-implementation/bot-plugins/index.js.map +7 -0
- package/dist/code-generation/bot-implementation/bot-plugins/plugin-module.js +129 -0
- package/dist/code-generation/bot-implementation/bot-plugins/plugin-module.js.map +7 -0
- package/dist/code-generation/bot-implementation/bot-typings/actions-module.js +88 -0
- package/dist/code-generation/bot-implementation/bot-typings/actions-module.js.map +7 -0
- package/dist/code-generation/bot-implementation/bot-typings/events-module.js +63 -0
- package/dist/code-generation/bot-implementation/bot-typings/events-module.js.map +7 -0
- package/dist/code-generation/bot-implementation/bot-typings/index.js +109 -0
- package/dist/code-generation/bot-implementation/bot-typings/index.js.map +7 -0
- package/dist/code-generation/bot-implementation/bot-typings/states-module.js +64 -0
- package/dist/code-generation/bot-implementation/bot-typings/states-module.js.map +7 -0
- package/dist/code-generation/bot-implementation/index.js +66 -0
- package/dist/code-generation/bot-implementation/index.js.map +7 -0
- package/dist/code-generation/consts.js +45 -0
- package/dist/code-generation/consts.js.map +7 -0
- package/dist/code-generation/generators.js +81 -0
- package/dist/code-generation/generators.js.map +7 -0
- package/dist/code-generation/index.js +49 -0
- package/dist/code-generation/index.js.map +7 -0
- package/dist/code-generation/integration-implementation/index.js +70 -0
- package/dist/code-generation/integration-implementation/index.js.map +7 -0
- package/dist/code-generation/integration-implementation/integration-implementation.js +114 -0
- package/dist/code-generation/integration-implementation/integration-implementation.js.map +7 -0
- package/dist/code-generation/integration-implementation/integration-secret.js +78 -0
- package/dist/code-generation/integration-implementation/integration-secret.js.map +7 -0
- package/dist/code-generation/integration-implementation/integration-typings/actions-module.js +88 -0
- package/dist/code-generation/integration-implementation/integration-typings/actions-module.js.map +7 -0
- package/dist/code-generation/integration-implementation/integration-typings/channels-module.js +107 -0
- package/dist/code-generation/integration-implementation/integration-typings/channels-module.js.map +7 -0
- package/dist/code-generation/integration-implementation/integration-typings/configuration-module.js +62 -0
- package/dist/code-generation/integration-implementation/integration-typings/configuration-module.js.map +7 -0
- package/dist/code-generation/integration-implementation/integration-typings/configurations-module.js +70 -0
- package/dist/code-generation/integration-implementation/integration-typings/configurations-module.js.map +7 -0
- package/dist/code-generation/integration-implementation/integration-typings/entities-module.js +63 -0
- package/dist/code-generation/integration-implementation/integration-typings/entities-module.js.map +7 -0
- package/dist/code-generation/integration-implementation/integration-typings/events-module.js +63 -0
- package/dist/code-generation/integration-implementation/integration-typings/events-module.js.map +7 -0
- package/dist/code-generation/integration-implementation/integration-typings/index.js +128 -0
- package/dist/code-generation/integration-implementation/integration-typings/index.js.map +7 -0
- package/dist/code-generation/integration-implementation/integration-typings/states-module.js +64 -0
- package/dist/code-generation/integration-implementation/integration-typings/states-module.js.map +7 -0
- package/dist/code-generation/integration-package/index.js +94 -0
- package/dist/code-generation/integration-package/index.js.map +7 -0
- package/dist/code-generation/integration-package/integration-package-definition/actions-module.js +88 -0
- package/dist/code-generation/integration-package/integration-package-definition/actions-module.js.map +7 -0
- package/dist/code-generation/integration-package/integration-package-definition/channels-module.js +107 -0
- package/dist/code-generation/integration-package/integration-package-definition/channels-module.js.map +7 -0
- package/dist/code-generation/integration-package/integration-package-definition/configuration-module.js +63 -0
- package/dist/code-generation/integration-package/integration-package-definition/configuration-module.js.map +7 -0
- package/dist/code-generation/integration-package/integration-package-definition/configurations-module.js +70 -0
- package/dist/code-generation/integration-package/integration-package-definition/configurations-module.js.map +7 -0
- package/dist/code-generation/integration-package/integration-package-definition/entities-module.js +63 -0
- package/dist/code-generation/integration-package/integration-package-definition/entities-module.js.map +7 -0
- package/dist/code-generation/integration-package/integration-package-definition/events-module.js +66 -0
- package/dist/code-generation/integration-package/integration-package-definition/events-module.js.map +7 -0
- package/dist/code-generation/integration-package/integration-package-definition/index.js +140 -0
- package/dist/code-generation/integration-package/integration-package-definition/index.js.map +7 -0
- package/dist/code-generation/integration-package/integration-package-definition/states-module.js +66 -0
- package/dist/code-generation/integration-package/integration-package-definition/states-module.js.map +7 -0
- package/dist/code-generation/integration-package/integration-package-definition/typings.js +17 -0
- package/dist/code-generation/integration-package/integration-package-definition/typings.js.map +7 -0
- package/dist/code-generation/interface-implementation/index.js +29 -0
- package/dist/code-generation/interface-implementation/index.js.map +7 -0
- package/dist/code-generation/interface-implementation/integration-typings/actions-module.js +88 -0
- package/dist/code-generation/interface-implementation/integration-typings/actions-module.js.map +7 -0
- package/dist/code-generation/interface-implementation/integration-typings/channels-module.js +107 -0
- package/dist/code-generation/interface-implementation/integration-typings/channels-module.js.map +7 -0
- package/dist/code-generation/interface-implementation/integration-typings/entities-module.js +63 -0
- package/dist/code-generation/interface-implementation/integration-typings/entities-module.js.map +7 -0
- package/dist/code-generation/interface-implementation/integration-typings/events-module.js +63 -0
- package/dist/code-generation/interface-implementation/integration-typings/events-module.js.map +7 -0
- package/dist/code-generation/interface-implementation/integration-typings/index.js +121 -0
- package/dist/code-generation/interface-implementation/integration-typings/index.js.map +7 -0
- package/dist/code-generation/interface-package/index.js +94 -0
- package/dist/code-generation/interface-package/index.js.map +7 -0
- package/dist/code-generation/interface-package/interface-package-definition/actions-module.js +88 -0
- package/dist/code-generation/interface-package/interface-package-definition/actions-module.js.map +7 -0
- package/dist/code-generation/interface-package/interface-package-definition/channels-module.js +98 -0
- package/dist/code-generation/interface-package/interface-package-definition/channels-module.js.map +7 -0
- package/dist/code-generation/interface-package/interface-package-definition/entities-module.js +63 -0
- package/dist/code-generation/interface-package/interface-package-definition/entities-module.js.map +7 -0
- package/dist/code-generation/interface-package/interface-package-definition/events-module.js +66 -0
- package/dist/code-generation/interface-package/interface-package-definition/events-module.js.map +7 -0
- package/dist/code-generation/interface-package/interface-package-definition/index.js +104 -0
- package/dist/code-generation/interface-package/interface-package-definition/index.js.map +7 -0
- package/dist/code-generation/interface-package/interface-package-definition/typings.js +17 -0
- package/dist/code-generation/interface-package/interface-package-definition/typings.js.map +7 -0
- package/dist/code-generation/module.js +183 -0
- package/dist/code-generation/module.js.map +7 -0
- package/dist/code-generation/plugin-implementation/index.js +60 -0
- package/dist/code-generation/plugin-implementation/index.js.map +7 -0
- package/dist/code-generation/plugin-implementation/plugin-implementation.js +90 -0
- package/dist/code-generation/plugin-implementation/plugin-implementation.js.map +7 -0
- package/dist/code-generation/plugin-implementation/plugin-typings/actions-module.js +88 -0
- package/dist/code-generation/plugin-implementation/plugin-typings/actions-module.js.map +7 -0
- package/dist/code-generation/plugin-implementation/plugin-typings/configuration-module.js +61 -0
- package/dist/code-generation/plugin-implementation/plugin-typings/configuration-module.js.map +7 -0
- package/dist/code-generation/plugin-implementation/plugin-typings/events-module.js +63 -0
- package/dist/code-generation/plugin-implementation/plugin-typings/events-module.js.map +7 -0
- package/dist/code-generation/plugin-implementation/plugin-typings/index.js +150 -0
- package/dist/code-generation/plugin-implementation/plugin-typings/index.js.map +7 -0
- package/dist/code-generation/plugin-implementation/plugin-typings/states-module.js +64 -0
- package/dist/code-generation/plugin-implementation/plugin-typings/states-module.js.map +7 -0
- package/dist/code-generation/plugin-package/index.js +151 -0
- package/dist/code-generation/plugin-package/index.js.map +7 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/actions-module.js +88 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/actions-module.js.map +7 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/configuration-module.js +56 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/configuration-module.js.map +7 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/events-module.js +66 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/events-module.js.map +7 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/index.js +107 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/index.js.map +7 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/states-module.js +66 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/states-module.js.map +7 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/typings.js +17 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/typings.js.map +7 -0
- package/dist/code-generation/strings.js +115 -0
- package/dist/code-generation/strings.js.map +7 -0
- package/dist/code-generation/typings.js +17 -0
- package/dist/code-generation/typings.js.map +7 -0
- package/dist/command-definitions.js +85 -0
- package/dist/command-definitions.js.map +7 -0
- package/dist/command-implementations/add-command.js +262 -0
- package/dist/command-implementations/add-command.js.map +7 -0
- package/dist/command-implementations/base-command.js +69 -0
- package/dist/command-implementations/base-command.js.map +7 -0
- package/dist/command-implementations/bot-commands.js +117 -0
- package/dist/command-implementations/bot-commands.js.map +7 -0
- package/dist/command-implementations/build-command.js +53 -0
- package/dist/command-implementations/build-command.js.map +7 -0
- package/dist/command-implementations/bundle-command.js +87 -0
- package/dist/command-implementations/bundle-command.js.map +7 -0
- package/dist/command-implementations/chat-command.js +152 -0
- package/dist/command-implementations/chat-command.js.map +7 -0
- package/dist/command-implementations/deploy-command.js +503 -0
- package/dist/command-implementations/deploy-command.js.map +7 -0
- package/dist/command-implementations/dev-command.js +345 -0
- package/dist/command-implementations/dev-command.js.map +7 -0
- package/dist/command-implementations/gen-command.js +110 -0
- package/dist/command-implementations/gen-command.js.map +7 -0
- package/dist/command-implementations/global-command.js +137 -0
- package/dist/command-implementations/global-command.js.map +7 -0
- package/dist/command-implementations/index.js +105 -0
- package/dist/command-implementations/index.js.map +7 -0
- package/dist/command-implementations/init-command.js +162 -0
- package/dist/command-implementations/init-command.js.map +7 -0
- package/dist/command-implementations/integration-commands.js +130 -0
- package/dist/command-implementations/integration-commands.js.map +7 -0
- package/dist/command-implementations/interface-commands.js +110 -0
- package/dist/command-implementations/interface-commands.js.map +7 -0
- package/dist/command-implementations/lint-command.js +151 -0
- package/dist/command-implementations/lint-command.js.map +7 -0
- package/dist/command-implementations/login-command.js +82 -0
- package/dist/command-implementations/login-command.js.map +7 -0
- package/dist/command-implementations/logout-command.js +35 -0
- package/dist/command-implementations/logout-command.js.map +7 -0
- package/dist/command-implementations/plugin-commands.js +111 -0
- package/dist/command-implementations/plugin-commands.js.map +7 -0
- package/dist/command-implementations/project-command.js +383 -0
- package/dist/command-implementations/project-command.js.map +7 -0
- package/dist/command-implementations/read-command.js +70 -0
- package/dist/command-implementations/read-command.js.map +7 -0
- package/dist/command-implementations/serve-command.js +68 -0
- package/dist/command-implementations/serve-command.js.map +7 -0
- package/dist/command-tree.js +60 -0
- package/dist/command-tree.js.map +7 -0
- package/dist/config.js +352 -0
- package/dist/config.js.map +7 -0
- package/dist/consts.js +127 -0
- package/dist/consts.js.map +7 -0
- package/dist/errors.js +202 -0
- package/dist/errors.js.map +7 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +7 -0
- package/dist/init.js +50 -0
- package/dist/init.js.map +7 -0
- package/dist/linter/base-linter.js +75 -0
- package/dist/linter/base-linter.js.map +7 -0
- package/dist/linter/base-linter.test.js +187 -0
- package/dist/linter/base-linter.test.js.map +7 -0
- package/dist/linter/bot-linter.js +35 -0
- package/dist/linter/bot-linter.js.map +7 -0
- package/dist/linter/integration-linter.js +35 -0
- package/dist/linter/integration-linter.js.map +7 -0
- package/dist/linter/interface-linter.js +35 -0
- package/dist/linter/interface-linter.js.map +7 -0
- package/dist/linter/ruleset-tests/bot.ruleset.test.js +358 -0
- package/dist/linter/ruleset-tests/bot.ruleset.test.js.map +7 -0
- package/dist/linter/ruleset-tests/common.js +37 -0
- package/dist/linter/ruleset-tests/common.js.map +7 -0
- package/dist/linter/ruleset-tests/integration.ruleset.test.js +887 -0
- package/dist/linter/ruleset-tests/integration.ruleset.test.js.map +7 -0
- package/dist/linter/ruleset-tests/interface.ruleset.test.js +383 -0
- package/dist/linter/ruleset-tests/interface.ruleset.test.js.map +7 -0
- package/dist/linter/rulesets/bot.ruleset.js +191 -0
- package/dist/linter/rulesets/bot.ruleset.js.map +7 -0
- package/dist/linter/rulesets/integration.ruleset.js +378 -0
- package/dist/linter/rulesets/integration.ruleset.js.map +7 -0
- package/dist/linter/rulesets/interface.ruleset.js +157 -0
- package/dist/linter/rulesets/interface.ruleset.js.map +7 -0
- package/dist/linter/spectral-functions.js +36 -0
- package/dist/linter/spectral-functions.js.map +7 -0
- package/dist/logger/base-logger.js +170 -0
- package/dist/logger/base-logger.js.map +7 -0
- package/dist/logger/index.js +86 -0
- package/dist/logger/index.js.map +7 -0
- package/dist/package-ref.js +107 -0
- package/dist/package-ref.js.map +7 -0
- package/dist/package-ref.test.js +109 -0
- package/dist/package-ref.test.js.map +7 -0
- package/dist/register-yargs.js +91 -0
- package/dist/register-yargs.js.map +7 -0
- package/dist/root.js +41 -0
- package/dist/root.js.map +7 -0
- package/dist/sdk/index.js +22 -0
- package/dist/sdk/index.js.map +7 -0
- package/dist/sdk/resolve-bot-interfaces.js +43 -0
- package/dist/sdk/resolve-bot-interfaces.js.map +7 -0
- package/dist/sdk/resolve-integration-interfaces.js +161 -0
- package/dist/sdk/resolve-integration-interfaces.js.map +7 -0
- package/dist/sdk/validate-bot.js +88 -0
- package/dist/sdk/validate-bot.js.map +7 -0
- package/dist/sdk/validate-integration.js +72 -0
- package/dist/sdk/validate-integration.js.map +7 -0
- package/dist/typings.js +17 -0
- package/dist/typings.js.map +7 -0
- package/dist/utils/cache-utils.js +104 -0
- package/dist/utils/cache-utils.js.map +7 -0
- package/dist/utils/case-utils.js +84 -0
- package/dist/utils/case-utils.js.map +7 -0
- package/dist/utils/case-utils.test.js +75 -0
- package/dist/utils/case-utils.test.js.map +7 -0
- package/dist/utils/esbuild-utils.js +92 -0
- package/dist/utils/esbuild-utils.js.map +7 -0
- package/dist/utils/event-emitter.js +63 -0
- package/dist/utils/event-emitter.js.map +7 -0
- package/dist/utils/file-watcher.js +73 -0
- package/dist/utils/file-watcher.js.map +7 -0
- package/dist/utils/guard-utils.js +32 -0
- package/dist/utils/guard-utils.js.map +7 -0
- package/dist/utils/id-utils.js +59 -0
- package/dist/utils/id-utils.js.map +7 -0
- package/dist/utils/index.js +99 -0
- package/dist/utils/index.js.map +7 -0
- package/dist/utils/object-utils.js +32 -0
- package/dist/utils/object-utils.js.map +7 -0
- package/dist/utils/path-utils.js +106 -0
- package/dist/utils/path-utils.js.map +7 -0
- package/dist/utils/path-utils.test.js +72 -0
- package/dist/utils/path-utils.test.js.map +7 -0
- package/dist/utils/pkgjson-utils.js +57 -0
- package/dist/utils/pkgjson-utils.js.map +7 -0
- package/dist/utils/promise-utils.js +36 -0
- package/dist/utils/promise-utils.js.map +7 -0
- package/dist/utils/promise-utils.test.js +14 -0
- package/dist/utils/promise-utils.test.js.map +7 -0
- package/dist/utils/prompt-utils.js +105 -0
- package/dist/utils/prompt-utils.js.map +7 -0
- package/dist/utils/record-utils.js +118 -0
- package/dist/utils/record-utils.js.map +7 -0
- package/dist/utils/record-utils.test.js +38 -0
- package/dist/utils/record-utils.test.js.map +7 -0
- package/dist/utils/require-utils.js +90 -0
- package/dist/utils/require-utils.js.map +7 -0
- package/dist/utils/require-utils.test.js +54 -0
- package/dist/utils/require-utils.test.js.map +7 -0
- package/dist/utils/schema-utils.js +64 -0
- package/dist/utils/schema-utils.js.map +7 -0
- package/dist/utils/schema-utils.test.js +50 -0
- package/dist/utils/schema-utils.test.js.map +7 -0
- package/dist/utils/semver-utils.js +45 -0
- package/dist/utils/semver-utils.js.map +7 -0
- package/dist/utils/string-utils.js +42 -0
- package/dist/utils/string-utils.js.map +7 -0
- package/dist/utils/template-utils.js +51 -0
- package/dist/utils/template-utils.js.map +7 -0
- package/dist/utils/tunnel-utils.js +129 -0
- package/dist/utils/tunnel-utils.js.map +7 -0
- package/dist/utils/type-utils.js +17 -0
- package/dist/utils/type-utils.js.map +7 -0
- package/dist/utils/url-utils.js +67 -0
- package/dist/utils/url-utils.js.map +7 -0
- package/dist/worker/child-entrypoint.js +58 -0
- package/dist/worker/child-entrypoint.js.map +7 -0
- package/dist/worker/child-wrapper.js +119 -0
- package/dist/worker/child-wrapper.js.map +7 -0
- package/dist/worker/config.js +44 -0
- package/dist/worker/config.js.map +7 -0
- package/dist/worker/index.js +32 -0
- package/dist/worker/index.js.map +7 -0
- package/dist/worker/is-child.js +55 -0
- package/dist/worker/is-child.js.map +7 -0
- package/dist/worker/worker-state.js +71 -0
- package/dist/worker/worker-state.js.map +7 -0
- package/dist/worker/worker.js +91 -0
- package/dist/worker/worker.js.map +7 -0
- package/package.json +3 -3
- package/templates/empty-bot/.botpress/implementation/index.ts +50 -0
- package/templates/empty-bot/.botpress/implementation/plugins/index.ts +11 -0
- package/templates/empty-bot/.botpress/implementation/typings/actions/index.ts +6 -0
- package/templates/empty-bot/.botpress/implementation/typings/events/index.ts +6 -0
- package/templates/empty-bot/.botpress/implementation/typings/index.ts +20 -0
- package/templates/empty-bot/.botpress/implementation/typings/integrations/index.ts +6 -0
- package/templates/empty-bot/.botpress/implementation/typings/states/index.ts +6 -0
- package/templates/empty-bot/.botpress/index.ts +5 -0
- package/templates/empty-bot/package.json +2 -2
- package/templates/empty-integration/.botpress/implementation/index.ts +57 -0
- package/templates/empty-integration/.botpress/implementation/typings/actions/index.ts +6 -0
- package/templates/empty-integration/.botpress/implementation/typings/channels/index.ts +6 -0
- package/templates/empty-integration/.botpress/implementation/typings/configuration/index.ts +2 -0
- package/templates/empty-integration/.botpress/implementation/typings/configurations/index.ts +6 -0
- package/templates/empty-integration/.botpress/implementation/typings/entities/index.ts +6 -0
- package/templates/empty-integration/.botpress/implementation/typings/events/index.ts +6 -0
- package/templates/empty-integration/.botpress/implementation/typings/index.ts +31 -0
- package/templates/empty-integration/.botpress/implementation/typings/states/index.ts +6 -0
- package/templates/empty-integration/.botpress/index.ts +2 -0
- package/templates/empty-integration/.botpress/secrets/index.ts +6 -0
- package/templates/empty-integration/package.json +2 -2
- package/templates/empty-plugin/.botpress/implementation/index.ts +35 -0
- package/templates/empty-plugin/.botpress/implementation/typings/actions/index.ts +6 -0
- package/templates/empty-plugin/.botpress/implementation/typings/configuration/index.ts +2 -0
- package/templates/empty-plugin/.botpress/implementation/typings/events/index.ts +6 -0
- package/templates/empty-plugin/.botpress/implementation/typings/index.ts +26 -0
- package/templates/empty-plugin/.botpress/implementation/typings/integrations/index.ts +6 -0
- package/templates/empty-plugin/.botpress/implementation/typings/interfaces/index.ts +6 -0
- package/templates/empty-plugin/.botpress/implementation/typings/states/index.ts +6 -0
- package/templates/empty-plugin/.botpress/index.ts +1 -0
- package/templates/empty-plugin/package.json +1 -1
- package/templates/hello-world/.botpress/implementation/index.ts +57 -0
- package/templates/hello-world/.botpress/implementation/typings/actions/helloWorld/index.ts +12 -0
- package/templates/hello-world/.botpress/implementation/typings/actions/helloWorld/input.ts +5 -0
- package/templates/hello-world/.botpress/implementation/typings/actions/helloWorld/output.ts +5 -0
- package/templates/hello-world/.botpress/implementation/typings/actions/index.ts +9 -0
- package/templates/hello-world/.botpress/implementation/typings/channels/index.ts +6 -0
- package/templates/hello-world/.botpress/implementation/typings/configuration/index.ts +2 -0
- package/templates/hello-world/.botpress/implementation/typings/configurations/index.ts +6 -0
- package/templates/hello-world/.botpress/implementation/typings/entities/index.ts +6 -0
- package/templates/hello-world/.botpress/implementation/typings/events/index.ts +6 -0
- package/templates/hello-world/.botpress/implementation/typings/index.ts +31 -0
- package/templates/hello-world/.botpress/implementation/typings/states/index.ts +6 -0
- package/templates/hello-world/.botpress/index.ts +2 -0
- package/templates/hello-world/.botpress/secrets/index.ts +6 -0
- package/templates/hello-world/package.json +2 -2
- package/templates/webhook-message/.botpress/implementation/index.ts +57 -0
- package/templates/webhook-message/.botpress/implementation/typings/actions/index.ts +6 -0
- package/templates/webhook-message/.botpress/implementation/typings/channels/index.ts +9 -0
- package/templates/webhook-message/.botpress/implementation/typings/channels/webhook/index.ts +12 -0
- package/templates/webhook-message/.botpress/implementation/typings/channels/webhook/messages/index.ts +9 -0
- package/templates/webhook-message/.botpress/implementation/typings/channels/webhook/messages/text.ts +5 -0
- package/templates/webhook-message/.botpress/implementation/typings/configuration/index.ts +8 -0
- package/templates/webhook-message/.botpress/implementation/typings/configurations/index.ts +6 -0
- package/templates/webhook-message/.botpress/implementation/typings/entities/index.ts +6 -0
- package/templates/webhook-message/.botpress/implementation/typings/events/index.ts +6 -0
- package/templates/webhook-message/.botpress/implementation/typings/index.ts +31 -0
- package/templates/webhook-message/.botpress/implementation/typings/states/index.ts +6 -0
- package/templates/webhook-message/.botpress/index.ts +2 -0
- package/templates/webhook-message/.botpress/secrets/index.ts +6 -0
- package/templates/webhook-message/package.json +2 -2
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var code_generation_exports = {};
|
|
21
|
+
__export(code_generation_exports, {
|
|
22
|
+
generateBotImplementation: () => import_bot_implementation.generateBotImplementation,
|
|
23
|
+
generateIntegrationImplementation: () => import_integration_implementation.generateIntegrationImplementation,
|
|
24
|
+
generateIntegrationPackage: () => import_integration_package.generateIntegrationPackage,
|
|
25
|
+
generateInterfacePackage: () => import_interface_package.generateInterfacePackage,
|
|
26
|
+
generatePluginImplementation: () => import_plugin_implementation.generatePluginImplementation,
|
|
27
|
+
generatePluginPackage: () => import_plugin_package.generatePluginPackage,
|
|
28
|
+
secretEnvVariableName: () => import_integration_secret.secretEnvVariableName
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(code_generation_exports);
|
|
31
|
+
__reExport(code_generation_exports, require("./typings"), module.exports);
|
|
32
|
+
var import_integration_secret = require("./integration-implementation/integration-secret");
|
|
33
|
+
var import_bot_implementation = require("./bot-implementation");
|
|
34
|
+
var import_integration_implementation = require("./integration-implementation");
|
|
35
|
+
var import_plugin_implementation = require("./plugin-implementation");
|
|
36
|
+
var import_integration_package = require("./integration-package");
|
|
37
|
+
var import_interface_package = require("./interface-package");
|
|
38
|
+
var import_plugin_package = require("./plugin-package");
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
generateBotImplementation,
|
|
42
|
+
generateIntegrationImplementation,
|
|
43
|
+
generateIntegrationPackage,
|
|
44
|
+
generateInterfacePackage,
|
|
45
|
+
generatePluginImplementation,
|
|
46
|
+
generatePluginPackage,
|
|
47
|
+
secretEnvVariableName
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/code-generation/index.ts"],
|
|
4
|
+
"sourcesContent": ["export * from './typings'\nexport { secretEnvVariableName } from './integration-implementation/integration-secret'\nexport { generateBotImplementation } from './bot-implementation'\nexport { generateIntegrationImplementation } from './integration-implementation'\nexport { generatePluginImplementation } from './plugin-implementation'\nexport { generateIntegrationPackage } from './integration-package'\nexport { generateInterfacePackage } from './interface-package'\nexport { generatePluginPackage } from './plugin-package'\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAAc,sBAAd;AACA,gCAAsC;AACtC,gCAA0C;AAC1C,wCAAkD;AAClD,mCAA6C;AAC7C,iCAA2C;AAC3C,+BAAyC;AACzC,4BAAsC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var integration_implementation_exports = {};
|
|
30
|
+
__export(integration_implementation_exports, {
|
|
31
|
+
generateIntegrationImplementation: () => generateIntegrationImplementation
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(integration_implementation_exports);
|
|
34
|
+
var consts = __toESM(require("../consts"));
|
|
35
|
+
var import_integration_implementation = require("./integration-implementation");
|
|
36
|
+
var import_integration_secret = require("./integration-secret");
|
|
37
|
+
const generateIntegrationImplementationCls = async (sdkIntegrationDefinition, implPath) => {
|
|
38
|
+
const indexModule = new import_integration_implementation.IntegrationImplementationModule(sdkIntegrationDefinition);
|
|
39
|
+
indexModule.unshift(implPath);
|
|
40
|
+
return indexModule.flatten();
|
|
41
|
+
};
|
|
42
|
+
const generateIntegrationSecrets = async (sdkIntegrationDefinition, secretsPath) => {
|
|
43
|
+
const indexModule = new import_integration_secret.IntegrationSecretIndexModule(sdkIntegrationDefinition);
|
|
44
|
+
indexModule.unshift(secretsPath);
|
|
45
|
+
return indexModule.flatten();
|
|
46
|
+
};
|
|
47
|
+
const generateIntegrationImplementationIndex = async (implPath, secretsPath) => {
|
|
48
|
+
let content = "";
|
|
49
|
+
content += `export * from './${implPath}'
|
|
50
|
+
`;
|
|
51
|
+
content += `export * from './${secretsPath}'
|
|
52
|
+
`;
|
|
53
|
+
return {
|
|
54
|
+
path: consts.INDEX_FILE,
|
|
55
|
+
content
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
const generateIntegrationImplementation = async (sdkIntegrationDefinition) => {
|
|
59
|
+
const implPath = consts.fromOutDir.implementationDir;
|
|
60
|
+
const secretsPath = consts.fromOutDir.secretsDir;
|
|
61
|
+
const implFiles = await generateIntegrationImplementationCls(sdkIntegrationDefinition, implPath);
|
|
62
|
+
const secretFiles = await generateIntegrationSecrets(sdkIntegrationDefinition, secretsPath);
|
|
63
|
+
const indexFile = await generateIntegrationImplementationIndex(implPath, secretsPath);
|
|
64
|
+
return [...implFiles, ...secretFiles, indexFile];
|
|
65
|
+
};
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
generateIntegrationImplementation
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/code-generation/integration-implementation/index.ts"],
|
|
4
|
+
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as consts from '../consts'\nimport * as types from '../typings'\nimport { IntegrationImplementationModule } from './integration-implementation'\nimport { IntegrationSecretIndexModule } from './integration-secret'\n\nconst generateIntegrationImplementationCls = async (\n sdkIntegrationDefinition: sdk.IntegrationDefinition,\n implPath: string\n): Promise<types.File[]> => {\n const indexModule = new IntegrationImplementationModule(sdkIntegrationDefinition)\n indexModule.unshift(implPath)\n return indexModule.flatten()\n}\n\nconst generateIntegrationSecrets = async (\n sdkIntegrationDefinition: sdk.IntegrationDefinition,\n secretsPath: string\n): Promise<types.File[]> => {\n const indexModule = new IntegrationSecretIndexModule(sdkIntegrationDefinition)\n indexModule.unshift(secretsPath)\n return indexModule.flatten()\n}\n\nconst generateIntegrationImplementationIndex = async (implPath: string, secretsPath: string): Promise<types.File> => {\n let content = ''\n content += `export * from './${implPath}'\\n`\n content += `export * from './${secretsPath}'\\n`\n return {\n path: consts.INDEX_FILE,\n content,\n }\n}\n\nexport const generateIntegrationImplementation = async (\n sdkIntegrationDefinition: sdk.IntegrationDefinition\n): Promise<types.File[]> => {\n const implPath = consts.fromOutDir.implementationDir\n const secretsPath = consts.fromOutDir.secretsDir\n const implFiles = await generateIntegrationImplementationCls(sdkIntegrationDefinition, implPath)\n const secretFiles = await generateIntegrationSecrets(sdkIntegrationDefinition, secretsPath)\n const indexFile = await generateIntegrationImplementationIndex(implPath, secretsPath)\n return [...implFiles, ...secretFiles, indexFile]\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;AAExB,wCAAgD;AAChD,gCAA6C;AAE7C,MAAM,uCAAuC,OAC3C,0BACA,aAC0B;AAC1B,QAAM,cAAc,IAAI,kEAAgC,wBAAwB;AAChF,cAAY,QAAQ,QAAQ;AAC5B,SAAO,YAAY,QAAQ;AAC7B;AAEA,MAAM,6BAA6B,OACjC,0BACA,gBAC0B;AAC1B,QAAM,cAAc,IAAI,uDAA6B,wBAAwB;AAC7E,cAAY,QAAQ,WAAW;AAC/B,SAAO,YAAY,QAAQ;AAC7B;AAEA,MAAM,yCAAyC,OAAO,UAAkB,gBAA6C;AACnH,MAAI,UAAU;AACd,aAAW,oBAAoB;AAAA;AAC/B,aAAW,oBAAoB;AAAA;AAC/B,SAAO;AAAA,IACL,MAAM,OAAO;AAAA,IACb;AAAA,EACF;AACF;AAEO,MAAM,oCAAoC,OAC/C,6BAC0B;AAC1B,QAAM,WAAW,OAAO,WAAW;AACnC,QAAM,cAAc,OAAO,WAAW;AACtC,QAAM,YAAY,MAAM,qCAAqC,0BAA0B,QAAQ;AAC/F,QAAM,cAAc,MAAM,2BAA2B,0BAA0B,WAAW;AAC1F,QAAM,YAAY,MAAM,uCAAuC,UAAU,WAAW;AACpF,SAAO,CAAC,GAAG,WAAW,GAAG,aAAa,SAAS;AACjD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var integration_implementation_exports = {};
|
|
30
|
+
__export(integration_implementation_exports, {
|
|
31
|
+
IntegrationImplementationModule: () => IntegrationImplementationModule
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(integration_implementation_exports);
|
|
34
|
+
var consts = __toESM(require("../consts"));
|
|
35
|
+
var import_module = require("../module");
|
|
36
|
+
var import_integration_typings = require("./integration-typings");
|
|
37
|
+
class IntegrationImplementationModule extends import_module.Module {
|
|
38
|
+
_typingsModule;
|
|
39
|
+
constructor(integration) {
|
|
40
|
+
super({
|
|
41
|
+
path: consts.INDEX_FILE,
|
|
42
|
+
exportName: "Integration"
|
|
43
|
+
});
|
|
44
|
+
this._typingsModule = new import_integration_typings.IntegrationTypingsModule(integration);
|
|
45
|
+
this._typingsModule.unshift("typings");
|
|
46
|
+
this.pushDep(this._typingsModule);
|
|
47
|
+
}
|
|
48
|
+
async getContent() {
|
|
49
|
+
let content = "";
|
|
50
|
+
const typingsImport = this._typingsModule.import(this);
|
|
51
|
+
content += [
|
|
52
|
+
consts.GENERATED_HEADER,
|
|
53
|
+
'import * as sdk from "@botpress/sdk"',
|
|
54
|
+
`import * as ${this._typingsModule.name} from "./${typingsImport}"`,
|
|
55
|
+
`export * from "./${typingsImport}"`,
|
|
56
|
+
"",
|
|
57
|
+
`type TIntegration = sdk.DefaultIntegration<${this._typingsModule.name}.${this._typingsModule.exportName}>`,
|
|
58
|
+
"",
|
|
59
|
+
"export type IntegrationProps = sdk.IntegrationProps<TIntegration>",
|
|
60
|
+
"",
|
|
61
|
+
"export class Integration extends sdk.Integration<TIntegration> {}",
|
|
62
|
+
"",
|
|
63
|
+
"export type Client = sdk.IntegrationSpecificClient<TIntegration>",
|
|
64
|
+
"",
|
|
65
|
+
"// extra types",
|
|
66
|
+
"",
|
|
67
|
+
"type Cast<X, Y> = X extends Y ? X : Y",
|
|
68
|
+
"type ValueOf<T> = T[keyof T]",
|
|
69
|
+
"type AsyncFunction = (...args: any[]) => Promise<any>",
|
|
70
|
+
"",
|
|
71
|
+
"export type HandlerProps = Parameters<IntegrationProps['handler']>[0]",
|
|
72
|
+
"",
|
|
73
|
+
"export type ActionProps = {",
|
|
74
|
+
" [K in keyof IntegrationProps['actions']]: Parameters<IntegrationProps['actions'][K]>[0]",
|
|
75
|
+
"}",
|
|
76
|
+
"export type AnyActionProps = ValueOf<ActionProps>",
|
|
77
|
+
"",
|
|
78
|
+
"export type MessageProps = {",
|
|
79
|
+
" [TChannel in keyof IntegrationProps['channels']]: {",
|
|
80
|
+
" [TMessage in keyof IntegrationProps['channels'][TChannel]['messages']]: Parameters<",
|
|
81
|
+
" IntegrationProps['channels'][TChannel]['messages'][TMessage]",
|
|
82
|
+
" >[0]",
|
|
83
|
+
" }",
|
|
84
|
+
"}",
|
|
85
|
+
"export type AnyMessageProps = ValueOf<ValueOf<MessageProps>>",
|
|
86
|
+
"",
|
|
87
|
+
"export type Context = HandlerProps['ctx']",
|
|
88
|
+
"export type Logger = HandlerProps['logger']",
|
|
89
|
+
"",
|
|
90
|
+
"export type AckFunctions = {",
|
|
91
|
+
" [TChannel in keyof MessageProps]: {",
|
|
92
|
+
" [TMessage in keyof MessageProps[TChannel]]: Cast<MessageProps[TChannel][TMessage], AnyMessageProps>['ack']",
|
|
93
|
+
" }",
|
|
94
|
+
"}",
|
|
95
|
+
"export type AnyAckFunction = ValueOf<ValueOf<AckFunctions>>",
|
|
96
|
+
"",
|
|
97
|
+
"export type ClientOperation = ValueOf<{",
|
|
98
|
+
" [K in keyof Client as Client[K] extends AsyncFunction ? K : never]: K",
|
|
99
|
+
"}>",
|
|
100
|
+
"export type ClientRequests = {",
|
|
101
|
+
" [K in ClientOperation]: Parameters<Client[K]>[0]",
|
|
102
|
+
"}",
|
|
103
|
+
"export type ClientResponses = {",
|
|
104
|
+
" [K in ClientOperation]: Awaited<ReturnType<Client[K]>>",
|
|
105
|
+
"}"
|
|
106
|
+
].join("\n");
|
|
107
|
+
return content;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
111
|
+
0 && (module.exports = {
|
|
112
|
+
IntegrationImplementationModule
|
|
113
|
+
});
|
|
114
|
+
//# sourceMappingURL=integration-implementation.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/code-generation/integration-implementation/integration-implementation.ts"],
|
|
4
|
+
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as consts from '../consts'\nimport { Module } from '../module'\nimport { IntegrationTypingsModule } from './integration-typings'\n\nexport class IntegrationImplementationModule extends Module {\n private _typingsModule: IntegrationTypingsModule\n\n public constructor(integration: sdk.IntegrationDefinition) {\n super({\n path: consts.INDEX_FILE,\n exportName: 'Integration',\n })\n this._typingsModule = new IntegrationTypingsModule(integration)\n this._typingsModule.unshift('typings')\n this.pushDep(this._typingsModule)\n }\n\n public async getContent() {\n let content = ''\n\n const typingsImport = this._typingsModule.import(this)\n\n content += [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n `import * as ${this._typingsModule.name} from \"./${typingsImport}\"`,\n `export * from \"./${typingsImport}\"`,\n '',\n `type TIntegration = sdk.DefaultIntegration<${this._typingsModule.name}.${this._typingsModule.exportName}>`,\n '',\n 'export type IntegrationProps = sdk.IntegrationProps<TIntegration>',\n '',\n 'export class Integration extends sdk.Integration<TIntegration> {}',\n '',\n 'export type Client = sdk.IntegrationSpecificClient<TIntegration>',\n '',\n '// extra types',\n '',\n 'type Cast<X, Y> = X extends Y ? X : Y',\n 'type ValueOf<T> = T[keyof T]',\n 'type AsyncFunction = (...args: any[]) => Promise<any>',\n '',\n \"export type HandlerProps = Parameters<IntegrationProps['handler']>[0]\",\n '',\n 'export type ActionProps = {',\n \" [K in keyof IntegrationProps['actions']]: Parameters<IntegrationProps['actions'][K]>[0]\",\n '}',\n 'export type AnyActionProps = ValueOf<ActionProps>',\n '',\n 'export type MessageProps = {',\n \" [TChannel in keyof IntegrationProps['channels']]: {\",\n \" [TMessage in keyof IntegrationProps['channels'][TChannel]['messages']]: Parameters<\",\n \" IntegrationProps['channels'][TChannel]['messages'][TMessage]\",\n ' >[0]',\n ' }',\n '}',\n 'export type AnyMessageProps = ValueOf<ValueOf<MessageProps>>',\n '',\n \"export type Context = HandlerProps['ctx']\",\n \"export type Logger = HandlerProps['logger']\",\n '',\n 'export type AckFunctions = {',\n ' [TChannel in keyof MessageProps]: {',\n \" [TMessage in keyof MessageProps[TChannel]]: Cast<MessageProps[TChannel][TMessage], AnyMessageProps>['ack']\",\n ' }',\n '}',\n 'export type AnyAckFunction = ValueOf<ValueOf<AckFunctions>>',\n '',\n 'export type ClientOperation = ValueOf<{',\n ' [K in keyof Client as Client[K] extends AsyncFunction ? K : never]: K',\n '}>',\n 'export type ClientRequests = {',\n ' [K in ClientOperation]: Parameters<Client[K]>[0]',\n '}',\n 'export type ClientResponses = {',\n ' [K in ClientOperation]: Awaited<ReturnType<Client[K]>>',\n '}',\n ].join('\\n')\n\n return content\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;AACxB,oBAAuB;AACvB,iCAAyC;AAElC,MAAM,wCAAwC,qBAAO;AAAA,EAClD;AAAA,EAED,YAAY,aAAwC;AACzD,UAAM;AAAA,MACJ,MAAM,OAAO;AAAA,MACb,YAAY;AAAA,IACd,CAAC;AACD,SAAK,iBAAiB,IAAI,oDAAyB,WAAW;AAC9D,SAAK,eAAe,QAAQ,SAAS;AACrC,SAAK,QAAQ,KAAK,cAAc;AAAA,EAClC;AAAA,EAEA,MAAa,aAAa;AACxB,QAAI,UAAU;AAEd,UAAM,gBAAgB,KAAK,eAAe,OAAO,IAAI;AAErD,eAAW;AAAA,MACT,OAAO;AAAA,MACP;AAAA,MACA,eAAe,KAAK,eAAe,gBAAgB;AAAA,MACnD,oBAAoB;AAAA,MACpB;AAAA,MACA,8CAA8C,KAAK,eAAe,QAAQ,KAAK,eAAe;AAAA,MAC9F;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,EAAE,KAAK,IAAI;AAEX,WAAO;AAAA,EACT;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var integration_secret_exports = {};
|
|
30
|
+
__export(integration_secret_exports, {
|
|
31
|
+
IntegrationSecretIndexModule: () => IntegrationSecretIndexModule,
|
|
32
|
+
secretEnvVariableName: () => secretEnvVariableName
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(integration_secret_exports);
|
|
35
|
+
var import_utils = require("../../utils");
|
|
36
|
+
var consts = __toESM(require("../consts"));
|
|
37
|
+
var import_module = require("../module");
|
|
38
|
+
const secretEnvVariableName = (secretName) => `SECRET_${import_utils.casing.to.screamingSnakeCase(secretName)}`;
|
|
39
|
+
class IntegrationSecretIndexModule extends import_module.Module {
|
|
40
|
+
constructor(_integration) {
|
|
41
|
+
super({ exportName: "secrets", path: consts.INDEX_FILE });
|
|
42
|
+
this._integration = _integration;
|
|
43
|
+
}
|
|
44
|
+
async getContent() {
|
|
45
|
+
let content = consts.GENERATED_HEADER;
|
|
46
|
+
content += "class Secrets {\n";
|
|
47
|
+
for (const [secretName, { optional }] of Object.entries(this._integration.secrets ?? {})) {
|
|
48
|
+
const envVariableName = secretEnvVariableName(secretName);
|
|
49
|
+
const fieldName = import_utils.casing.to.screamingSnakeCase(secretName);
|
|
50
|
+
if (optional) {
|
|
51
|
+
content += ` public get ${fieldName}(): string | undefined {
|
|
52
|
+
`;
|
|
53
|
+
content += ` const envVarValue = process.env.${envVariableName}
|
|
54
|
+
`;
|
|
55
|
+
content += " return envVarValue\n";
|
|
56
|
+
content += " }\n";
|
|
57
|
+
} else {
|
|
58
|
+
content += ` public get ${fieldName}(): string {
|
|
59
|
+
`;
|
|
60
|
+
content += ` const envVarValue = process.env.${envVariableName}
|
|
61
|
+
`;
|
|
62
|
+
content += ` if (!envVarValue) throw new Error('Missing required secret "${secretName}"')
|
|
63
|
+
`;
|
|
64
|
+
content += " return envVarValue\n";
|
|
65
|
+
content += " }\n";
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
content += "}\n";
|
|
69
|
+
content += "export const secrets = new Secrets()\n";
|
|
70
|
+
return content;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
74
|
+
0 && (module.exports = {
|
|
75
|
+
IntegrationSecretIndexModule,
|
|
76
|
+
secretEnvVariableName
|
|
77
|
+
});
|
|
78
|
+
//# sourceMappingURL=integration-secret.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/code-generation/integration-implementation/integration-secret.ts"],
|
|
4
|
+
"sourcesContent": ["import { IntegrationDefinition } from '@botpress/sdk'\nimport { casing } from '../../utils'\nimport * as consts from '../consts'\nimport { Module } from '../module'\n\nexport const secretEnvVariableName = (secretName: string) => `SECRET_${casing.to.screamingSnakeCase(secretName)}`\n\nexport class IntegrationSecretIndexModule extends Module {\n public constructor(private _integration: IntegrationDefinition) {\n super({ exportName: 'secrets', path: consts.INDEX_FILE })\n }\n\n public async getContent() {\n let content = consts.GENERATED_HEADER\n content += 'class Secrets {\\n'\n for (const [secretName, { optional }] of Object.entries(this._integration.secrets ?? {})) {\n const envVariableName = secretEnvVariableName(secretName)\n const fieldName = casing.to.screamingSnakeCase(secretName)\n\n if (optional) {\n content += ` public get ${fieldName}(): string | undefined {\\n`\n content += ` const envVarValue = process.env.${envVariableName}\\n`\n content += ' return envVarValue\\n'\n content += ' }\\n'\n } else {\n content += ` public get ${fieldName}(): string {\\n`\n content += ` const envVarValue = process.env.${envVariableName}\\n`\n content += ` if (!envVarValue) throw new Error('Missing required secret \"${secretName}\"')\\n`\n content += ' return envVarValue\\n'\n content += ' }\\n'\n }\n }\n content += '}\\n'\n content += 'export const secrets = new Secrets()\\n'\n return content\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAuB;AACvB,aAAwB;AACxB,oBAAuB;AAEhB,MAAM,wBAAwB,CAAC,eAAuB,UAAU,oBAAO,GAAG,mBAAmB,UAAU;AAEvG,MAAM,qCAAqC,qBAAO;AAAA,EAChD,YAAoB,cAAqC;AAC9D,UAAM,EAAE,YAAY,WAAW,MAAM,OAAO,WAAW,CAAC;AAD/B;AAAA,EAE3B;AAAA,EAEA,MAAa,aAAa;AACxB,QAAI,UAAU,OAAO;AACrB,eAAW;AACX,eAAW,CAAC,YAAY,EAAE,SAAS,CAAC,KAAK,OAAO,QAAQ,KAAK,aAAa,WAAW,CAAC,CAAC,GAAG;AACxF,YAAM,kBAAkB,sBAAsB,UAAU;AACxD,YAAM,YAAY,oBAAO,GAAG,mBAAmB,UAAU;AAEzD,UAAI,UAAU;AACZ,mBAAW,gBAAgB;AAAA;AAC3B,mBAAW,uCAAuC;AAAA;AAClD,mBAAW;AACX,mBAAW;AAAA,MACb,OAAO;AACL,mBAAW,gBAAgB;AAAA;AAC3B,mBAAW,uCAAuC;AAAA;AAClD,mBAAW,mEAAmE;AAAA;AAC9E,mBAAW;AACX,mBAAW;AAAA,MACb;AAAA,IACF;AACA,eAAW;AACX,eAAW;AACX,WAAO;AAAA,EACT;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var actions_module_exports = {};
|
|
30
|
+
__export(actions_module_exports, {
|
|
31
|
+
ActionInputModule: () => ActionInputModule,
|
|
32
|
+
ActionModule: () => ActionModule,
|
|
33
|
+
ActionOutputModule: () => ActionOutputModule,
|
|
34
|
+
ActionsModule: () => ActionsModule
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(actions_module_exports);
|
|
37
|
+
var import_generators = require("../../generators");
|
|
38
|
+
var import_module = require("../../module");
|
|
39
|
+
var strings = __toESM(require("../../strings"));
|
|
40
|
+
class ActionInputModule extends import_module.Module {
|
|
41
|
+
constructor(_input) {
|
|
42
|
+
const name = "input";
|
|
43
|
+
const exportName = strings.typeName(name);
|
|
44
|
+
super({ path: `${name}.ts`, exportName });
|
|
45
|
+
this._input = _input;
|
|
46
|
+
}
|
|
47
|
+
async getContent() {
|
|
48
|
+
return (0, import_generators.zuiSchemaToTypeScriptType)(this._input.schema, this.exportName);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
class ActionOutputModule extends import_module.Module {
|
|
52
|
+
constructor(_output) {
|
|
53
|
+
const name = "output";
|
|
54
|
+
const exportName = strings.typeName(name);
|
|
55
|
+
super({ path: `${name}.ts`, exportName });
|
|
56
|
+
this._output = _output;
|
|
57
|
+
}
|
|
58
|
+
async getContent() {
|
|
59
|
+
return (0, import_generators.zuiSchemaToTypeScriptType)(this._output.schema, this.exportName);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
class ActionModule extends import_module.ReExportTypeModule {
|
|
63
|
+
constructor(actionName, action) {
|
|
64
|
+
super({ exportName: strings.typeName(actionName) });
|
|
65
|
+
const inputModule = new ActionInputModule(action.input);
|
|
66
|
+
const outputModule = new ActionOutputModule(action.output);
|
|
67
|
+
this.pushDep(inputModule);
|
|
68
|
+
this.pushDep(outputModule);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
class ActionsModule extends import_module.ReExportTypeModule {
|
|
72
|
+
constructor(actions) {
|
|
73
|
+
super({ exportName: strings.typeName("actions") });
|
|
74
|
+
for (const [actionName, action] of Object.entries(actions)) {
|
|
75
|
+
const module2 = new ActionModule(actionName, action);
|
|
76
|
+
module2.unshift(actionName);
|
|
77
|
+
this.pushDep(module2);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
82
|
+
0 && (module.exports = {
|
|
83
|
+
ActionInputModule,
|
|
84
|
+
ActionModule,
|
|
85
|
+
ActionOutputModule,
|
|
86
|
+
ActionsModule
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=actions-module.js.map
|
package/dist/code-generation/integration-implementation/integration-typings/actions-module.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/code-generation/integration-implementation/integration-typings/actions-module.ts"],
|
|
4
|
+
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport { zuiSchemaToTypeScriptType } from '../../generators'\nimport { Module, ReExportTypeModule } from '../../module'\nimport * as strings from '../../strings'\n\ntype ActionInput = sdk.ActionDefinition['input']\ntype ActionOutput = sdk.ActionDefinition['output']\n\nexport class ActionInputModule extends Module {\n public constructor(private _input: ActionInput) {\n const name = 'input'\n const exportName = strings.typeName(name)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n return zuiSchemaToTypeScriptType(this._input.schema, this.exportName)\n }\n}\n\nexport class ActionOutputModule extends Module {\n public constructor(private _output: ActionOutput) {\n const name = 'output'\n const exportName = strings.typeName(name)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n return zuiSchemaToTypeScriptType(this._output.schema, this.exportName)\n }\n}\n\nexport class ActionModule extends ReExportTypeModule {\n public constructor(actionName: string, action: sdk.ActionDefinition) {\n super({ exportName: strings.typeName(actionName) })\n\n const inputModule = new ActionInputModule(action.input)\n const outputModule = new ActionOutputModule(action.output)\n\n this.pushDep(inputModule)\n this.pushDep(outputModule)\n }\n}\n\nexport class ActionsModule extends ReExportTypeModule {\n public constructor(actions: Record<string, sdk.ActionDefinition>) {\n super({ exportName: strings.typeName('actions') })\n for (const [actionName, action] of Object.entries(actions)) {\n const module = new ActionModule(actionName, action)\n module.unshift(actionName)\n this.pushDep(module)\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAA0C;AAC1C,oBAA2C;AAC3C,cAAyB;AAKlB,MAAM,0BAA0B,qBAAO;AAAA,EACrC,YAAoB,QAAqB;AAC9C,UAAM,OAAO;AACb,UAAM,aAAa,QAAQ,SAAS,IAAI;AACxC,UAAM,EAAE,MAAM,GAAG,WAAW,WAAW,CAAC;AAHf;AAAA,EAI3B;AAAA,EAEA,MAAa,aAAa;AACxB,eAAO,6CAA0B,KAAK,OAAO,QAAQ,KAAK,UAAU;AAAA,EACtE;AACF;AAEO,MAAM,2BAA2B,qBAAO;AAAA,EACtC,YAAoB,SAAuB;AAChD,UAAM,OAAO;AACb,UAAM,aAAa,QAAQ,SAAS,IAAI;AACxC,UAAM,EAAE,MAAM,GAAG,WAAW,WAAW,CAAC;AAHf;AAAA,EAI3B;AAAA,EAEA,MAAa,aAAa;AACxB,eAAO,6CAA0B,KAAK,QAAQ,QAAQ,KAAK,UAAU;AAAA,EACvE;AACF;AAEO,MAAM,qBAAqB,iCAAmB;AAAA,EAC5C,YAAY,YAAoB,QAA8B;AACnE,UAAM,EAAE,YAAY,QAAQ,SAAS,UAAU,EAAE,CAAC;AAElD,UAAM,cAAc,IAAI,kBAAkB,OAAO,KAAK;AACtD,UAAM,eAAe,IAAI,mBAAmB,OAAO,MAAM;AAEzD,SAAK,QAAQ,WAAW;AACxB,SAAK,QAAQ,YAAY;AAAA,EAC3B;AACF;AAEO,MAAM,sBAAsB,iCAAmB;AAAA,EAC7C,YAAY,SAA+C;AAChE,UAAM,EAAE,YAAY,QAAQ,SAAS,SAAS,EAAE,CAAC;AACjD,eAAW,CAAC,YAAY,MAAM,KAAK,OAAO,QAAQ,OAAO,GAAG;AAC1D,YAAMA,UAAS,IAAI,aAAa,YAAY,MAAM;AAClD,MAAAA,QAAO,QAAQ,UAAU;AACzB,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["module"]
|
|
7
|
+
}
|
package/dist/code-generation/integration-implementation/integration-typings/channels-module.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var channels_module_exports = {};
|
|
30
|
+
__export(channels_module_exports, {
|
|
31
|
+
ChannelsModule: () => ChannelsModule
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(channels_module_exports);
|
|
34
|
+
var import_consts = require("../../consts");
|
|
35
|
+
var import_generators = require("../../generators");
|
|
36
|
+
var import_module = require("../../module");
|
|
37
|
+
var strings = __toESM(require("../../strings"));
|
|
38
|
+
class MessageModule extends import_module.Module {
|
|
39
|
+
constructor(name, _message) {
|
|
40
|
+
super({
|
|
41
|
+
path: `${name}.ts`,
|
|
42
|
+
exportName: strings.typeName(name)
|
|
43
|
+
});
|
|
44
|
+
this._message = _message;
|
|
45
|
+
}
|
|
46
|
+
async getContent() {
|
|
47
|
+
return (0, import_generators.zuiSchemaToTypeScriptType)(this._message.schema, this.exportName);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
class MessagesModule extends import_module.ReExportTypeModule {
|
|
51
|
+
constructor(channel) {
|
|
52
|
+
super({ exportName: strings.typeName("messages") });
|
|
53
|
+
for (const [messageName, message] of Object.entries(channel.messages ?? {})) {
|
|
54
|
+
const module2 = new MessageModule(messageName, message);
|
|
55
|
+
this.pushDep(module2);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
class ChannelModule extends import_module.Module {
|
|
60
|
+
constructor(channelName, _channel) {
|
|
61
|
+
super({
|
|
62
|
+
path: import_consts.INDEX_FILE,
|
|
63
|
+
exportName: strings.typeName(channelName)
|
|
64
|
+
});
|
|
65
|
+
this._channel = _channel;
|
|
66
|
+
this._messagesModule = new MessagesModule(_channel);
|
|
67
|
+
this._messagesModule.unshift("messages");
|
|
68
|
+
this.pushDep(this._messagesModule);
|
|
69
|
+
}
|
|
70
|
+
_messagesModule;
|
|
71
|
+
async getContent() {
|
|
72
|
+
const messageImport = this._messagesModule.import(this);
|
|
73
|
+
const conversation = {
|
|
74
|
+
tags: this._channel.conversation?.tags ?? {},
|
|
75
|
+
creation: this._channel.conversation?.creation ?? { enabled: false, requiredTags: [] }
|
|
76
|
+
};
|
|
77
|
+
const message = {
|
|
78
|
+
tags: this._channel.message?.tags ?? {}
|
|
79
|
+
};
|
|
80
|
+
return [
|
|
81
|
+
import_consts.GENERATED_HEADER,
|
|
82
|
+
`import { ${this._messagesModule.exportName} } from './${messageImport}'`,
|
|
83
|
+
`export * from './${messageImport}'`,
|
|
84
|
+
"",
|
|
85
|
+
`export type ${this.exportName} = {`,
|
|
86
|
+
` messages: ${this._messagesModule.exportName}`,
|
|
87
|
+
` message: ${(0, import_generators.stringifySingleLine)(message)}`,
|
|
88
|
+
` conversation: ${(0, import_generators.stringifySingleLine)(conversation)}`,
|
|
89
|
+
"}"
|
|
90
|
+
].join("\n");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
class ChannelsModule extends import_module.ReExportTypeModule {
|
|
94
|
+
constructor(channels) {
|
|
95
|
+
super({ exportName: strings.typeName("channels") });
|
|
96
|
+
for (const [channelName, channel] of Object.entries(channels)) {
|
|
97
|
+
const module2 = new ChannelModule(channelName, channel);
|
|
98
|
+
module2.unshift(channelName);
|
|
99
|
+
this.pushDep(module2);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
104
|
+
0 && (module.exports = {
|
|
105
|
+
ChannelsModule
|
|
106
|
+
});
|
|
107
|
+
//# sourceMappingURL=channels-module.js.map
|
package/dist/code-generation/integration-implementation/integration-typings/channels-module.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/code-generation/integration-implementation/integration-typings/channels-module.ts"],
|
|
4
|
+
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport { GENERATED_HEADER, INDEX_FILE } from '../../consts'\nimport { zuiSchemaToTypeScriptType, stringifySingleLine } from '../../generators'\nimport { Module, ReExportTypeModule } from '../../module'\nimport * as strings from '../../strings'\n\nclass MessageModule extends Module {\n public constructor(name: string, private _message: sdk.MessageDefinition) {\n super({\n path: `${name}.ts`,\n exportName: strings.typeName(name),\n })\n }\n\n public async getContent() {\n return zuiSchemaToTypeScriptType(this._message.schema, this.exportName)\n }\n}\n\nclass MessagesModule extends ReExportTypeModule {\n public constructor(channel: sdk.ChannelDefinition) {\n super({ exportName: strings.typeName('messages') })\n for (const [messageName, message] of Object.entries(channel.messages ?? {})) {\n const module = new MessageModule(messageName, message)\n this.pushDep(module)\n }\n }\n}\n\nclass ChannelModule extends Module {\n private _messagesModule: MessagesModule\n\n public constructor(channelName: string, private _channel: sdk.ChannelDefinition) {\n super({\n path: INDEX_FILE,\n exportName: strings.typeName(channelName),\n })\n\n this._messagesModule = new MessagesModule(_channel)\n this._messagesModule.unshift('messages')\n this.pushDep(this._messagesModule)\n }\n\n public async getContent() {\n const messageImport = this._messagesModule.import(this)\n\n const conversation = {\n tags: this._channel.conversation?.tags ?? {},\n creation: this._channel.conversation?.creation ?? { enabled: false, requiredTags: [] },\n }\n\n const message = {\n tags: this._channel.message?.tags ?? {},\n }\n\n return [\n GENERATED_HEADER,\n `import { ${this._messagesModule.exportName} } from './${messageImport}'`,\n `export * from './${messageImport}'`,\n '',\n `export type ${this.exportName} = {`,\n ` messages: ${this._messagesModule.exportName}`,\n ` message: ${stringifySingleLine(message)}`,\n ` conversation: ${stringifySingleLine(conversation)}`,\n '}',\n ].join('\\n')\n }\n}\n\nexport class ChannelsModule extends ReExportTypeModule {\n public constructor(channels: Record<string, sdk.ChannelDefinition>) {\n super({ exportName: strings.typeName('channels') })\n for (const [channelName, channel] of Object.entries(channels)) {\n const module = new ChannelModule(channelName, channel)\n module.unshift(channelName)\n this.pushDep(module)\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAA6C;AAC7C,wBAA+D;AAC/D,oBAA2C;AAC3C,cAAyB;AAEzB,MAAM,sBAAsB,qBAAO;AAAA,EAC1B,YAAY,MAAsB,UAAiC;AACxE,UAAM;AAAA,MACJ,MAAM,GAAG;AAAA,MACT,YAAY,QAAQ,SAAS,IAAI;AAAA,IACnC,CAAC;AAJsC;AAAA,EAKzC;AAAA,EAEA,MAAa,aAAa;AACxB,eAAO,6CAA0B,KAAK,SAAS,QAAQ,KAAK,UAAU;AAAA,EACxE;AACF;AAEA,MAAM,uBAAuB,iCAAmB;AAAA,EACvC,YAAY,SAAgC;AACjD,UAAM,EAAE,YAAY,QAAQ,SAAS,UAAU,EAAE,CAAC;AAClD,eAAW,CAAC,aAAa,OAAO,KAAK,OAAO,QAAQ,QAAQ,YAAY,CAAC,CAAC,GAAG;AAC3E,YAAMA,UAAS,IAAI,cAAc,aAAa,OAAO;AACrD,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;AAEA,MAAM,sBAAsB,qBAAO;AAAA,EAG1B,YAAY,aAA6B,UAAiC;AAC/E,UAAM;AAAA,MACJ,MAAM;AAAA,MACN,YAAY,QAAQ,SAAS,WAAW;AAAA,IAC1C,CAAC;AAJ6C;AAM9C,SAAK,kBAAkB,IAAI,eAAe,QAAQ;AAClD,SAAK,gBAAgB,QAAQ,UAAU;AACvC,SAAK,QAAQ,KAAK,eAAe;AAAA,EACnC;AAAA,EAXQ;AAAA,EAaR,MAAa,aAAa;AACxB,UAAM,gBAAgB,KAAK,gBAAgB,OAAO,IAAI;AAEtD,UAAM,eAAe;AAAA,MACnB,MAAM,KAAK,SAAS,cAAc,QAAQ,CAAC;AAAA,MAC3C,UAAU,KAAK,SAAS,cAAc,YAAY,EAAE,SAAS,OAAO,cAAc,CAAC,EAAE;AAAA,IACvF;AAEA,UAAM,UAAU;AAAA,MACd,MAAM,KAAK,SAAS,SAAS,QAAQ,CAAC;AAAA,IACxC;AAEA,WAAO;AAAA,MACL;AAAA,MACA,YAAY,KAAK,gBAAgB,wBAAwB;AAAA,MACzD,oBAAoB;AAAA,MACpB;AAAA,MACA,eAAe,KAAK;AAAA,MACpB,eAAe,KAAK,gBAAgB;AAAA,MACpC,kBAAc,uCAAoB,OAAO;AAAA,MACzC,uBAAmB,uCAAoB,YAAY;AAAA,MACnD;AAAA,IACF,EAAE,KAAK,IAAI;AAAA,EACb;AACF;AAEO,MAAM,uBAAuB,iCAAmB;AAAA,EAC9C,YAAY,UAAiD;AAClE,UAAM,EAAE,YAAY,QAAQ,SAAS,UAAU,EAAE,CAAC;AAClD,eAAW,CAAC,aAAa,OAAO,KAAK,OAAO,QAAQ,QAAQ,GAAG;AAC7D,YAAMA,UAAS,IAAI,cAAc,aAAa,OAAO;AACrD,MAAAA,QAAO,QAAQ,WAAW;AAC1B,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["module"]
|
|
7
|
+
}
|
package/dist/code-generation/integration-implementation/integration-typings/configuration-module.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var configuration_module_exports = {};
|
|
30
|
+
__export(configuration_module_exports, {
|
|
31
|
+
DefaultConfigurationModule: () => DefaultConfigurationModule
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(configuration_module_exports);
|
|
34
|
+
var import_consts = require("../../consts");
|
|
35
|
+
var import_generators = require("../../generators");
|
|
36
|
+
var import_module = require("../../module");
|
|
37
|
+
var strings = __toESM(require("../../strings"));
|
|
38
|
+
class DefaultConfigurationModule extends import_module.Module {
|
|
39
|
+
constructor(_configuration) {
|
|
40
|
+
const name = "configuration";
|
|
41
|
+
const exportName = strings.typeName(name);
|
|
42
|
+
super({
|
|
43
|
+
path: import_consts.INDEX_FILE,
|
|
44
|
+
exportName
|
|
45
|
+
});
|
|
46
|
+
this._configuration = _configuration;
|
|
47
|
+
}
|
|
48
|
+
async getContent() {
|
|
49
|
+
if (!this._configuration) {
|
|
50
|
+
return [
|
|
51
|
+
"/** Default Configuration of the Integration */",
|
|
52
|
+
"export type Configuration = Record<string, never>;"
|
|
53
|
+
].join("\n");
|
|
54
|
+
}
|
|
55
|
+
return (0, import_generators.zuiSchemaToTypeScriptType)(this._configuration.schema, this.exportName);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
+
0 && (module.exports = {
|
|
60
|
+
DefaultConfigurationModule
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=configuration-module.js.map
|