@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,151 @@
|
|
|
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 lint_command_exports = {};
|
|
30
|
+
__export(lint_command_exports, {
|
|
31
|
+
LintCommand: () => LintCommand
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(lint_command_exports);
|
|
34
|
+
var import_sdk = require("@botpress/sdk");
|
|
35
|
+
var import_bot_body = require("../api/bot-body");
|
|
36
|
+
var import_integration_body = require("../api/integration-body");
|
|
37
|
+
var import_interface_body = require("../api/interface-body");
|
|
38
|
+
var errors = __toESM(require("../errors"));
|
|
39
|
+
var import_bot_linter = require("../linter/bot-linter");
|
|
40
|
+
var import_integration_linter = require("../linter/integration-linter");
|
|
41
|
+
var import_interface_linter = require("../linter/interface-linter");
|
|
42
|
+
var import_sdk2 = require("../sdk");
|
|
43
|
+
var import_project_command = require("./project-command");
|
|
44
|
+
class LintCommand extends import_project_command.ProjectCommand {
|
|
45
|
+
async run() {
|
|
46
|
+
const projectDef = await this.readProjectDefinitionFromFS();
|
|
47
|
+
if (projectDef.bpLintDisabled) {
|
|
48
|
+
this.logger.warn(
|
|
49
|
+
'Linting is disabled for this project because of a bplint directive. To enable linting, remove the "bplint-disable" directive from the project definition file'
|
|
50
|
+
);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
switch (projectDef.type) {
|
|
54
|
+
case "integration":
|
|
55
|
+
return this._runLintForIntegration(projectDef.definition);
|
|
56
|
+
case "bot":
|
|
57
|
+
return this._runLintForBot(projectDef.definition);
|
|
58
|
+
case "interface":
|
|
59
|
+
return this._runLintForInterface(projectDef.definition);
|
|
60
|
+
default:
|
|
61
|
+
throw new errors.UnsupportedProjectType();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async _runLintForInterface(definition) {
|
|
65
|
+
for (const [actionName, actionDef] of Object.entries(definition.actions)) {
|
|
66
|
+
definition.actions[actionName] = this._dereferenceActionDefinition(actionDef);
|
|
67
|
+
}
|
|
68
|
+
for (const [eventName, eventDef] of Object.entries(definition.events)) {
|
|
69
|
+
definition.events[eventName] = this._dereferenceEventDefinition(eventDef);
|
|
70
|
+
}
|
|
71
|
+
const parsedInterfaceDefinition = await (0, import_interface_body.prepareCreateInterfaceBody)(definition);
|
|
72
|
+
const linter = new import_interface_linter.InterfaceLinter(parsedInterfaceDefinition);
|
|
73
|
+
await linter.lint();
|
|
74
|
+
linter.logResults(this.logger);
|
|
75
|
+
if (linter.hasErrors()) {
|
|
76
|
+
throw new errors.BotpressCLIError("Interface definition contains linting errors");
|
|
77
|
+
}
|
|
78
|
+
this.logger.success("Interface definition is valid");
|
|
79
|
+
}
|
|
80
|
+
async _runLintForBot(definition) {
|
|
81
|
+
const strippedDefinition = this._stripAutoGeneratedContentFromBot(definition);
|
|
82
|
+
const parsedBotDefinition = await (0, import_bot_body.prepareCreateBotBody)(strippedDefinition);
|
|
83
|
+
const linter = new import_bot_linter.BotLinter(parsedBotDefinition);
|
|
84
|
+
await linter.lint();
|
|
85
|
+
linter.logResults(this.logger);
|
|
86
|
+
if (linter.hasErrors()) {
|
|
87
|
+
throw new errors.BotpressCLIError("Bot definition contains linting errors");
|
|
88
|
+
}
|
|
89
|
+
this.logger.success("Bot definition is valid");
|
|
90
|
+
}
|
|
91
|
+
_stripAutoGeneratedContentFromBot(definition) {
|
|
92
|
+
return {
|
|
93
|
+
...definition,
|
|
94
|
+
integrations: {}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
async _runLintForIntegration(definition) {
|
|
98
|
+
const strippedDefinition = this._stripAutoGeneratedContentFromIntegration(definition);
|
|
99
|
+
const parsedIntegrationDefinition = await (0, import_integration_body.prepareCreateIntegrationBody)(strippedDefinition);
|
|
100
|
+
const linter = new import_integration_linter.IntegrationLinter({ ...parsedIntegrationDefinition, secrets: strippedDefinition.secrets });
|
|
101
|
+
await linter.lint();
|
|
102
|
+
linter.logResults(this.logger);
|
|
103
|
+
if (linter.hasErrors()) {
|
|
104
|
+
throw new errors.BotpressCLIError("Integration definition contains linting errors");
|
|
105
|
+
}
|
|
106
|
+
this.logger.success("Integration definition is valid");
|
|
107
|
+
}
|
|
108
|
+
_stripAutoGeneratedContentFromIntegration(definition) {
|
|
109
|
+
const { actionNames, eventNames } = this._getAutoGeneratedContentOfIntegration(definition);
|
|
110
|
+
return {
|
|
111
|
+
...definition,
|
|
112
|
+
actions: Object.fromEntries(Object.entries(definition.actions ?? {}).filter(([key]) => !actionNames.has(key))),
|
|
113
|
+
events: Object.fromEntries(Object.entries(definition.events ?? {}).filter(([key]) => !eventNames.has(key)))
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
_getAutoGeneratedContentOfIntegration(definition) {
|
|
117
|
+
const actionNames = /* @__PURE__ */ new Set();
|
|
118
|
+
const eventNames = /* @__PURE__ */ new Set();
|
|
119
|
+
const interfacesStatements = (0, import_sdk2.getImplementationStatements)(definition);
|
|
120
|
+
for (const iface of Object.values(interfacesStatements)) {
|
|
121
|
+
for (const actionDefinition of Object.values(iface.actions)) {
|
|
122
|
+
actionNames.add(actionDefinition.name);
|
|
123
|
+
}
|
|
124
|
+
for (const eventDefinition of Object.values(iface.events)) {
|
|
125
|
+
eventNames.add(eventDefinition.name);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return { actionNames, eventNames };
|
|
129
|
+
}
|
|
130
|
+
_dereferenceActionDefinition = (actionDef) => {
|
|
131
|
+
const inputRefs = actionDef.input.schema.getReferences();
|
|
132
|
+
const outputRefs = actionDef.output.schema.getReferences();
|
|
133
|
+
const inputRefSchemas = Object.fromEntries(inputRefs.map((ref) => [ref, this._replaceRef(ref)]));
|
|
134
|
+
const outputRefSchemas = Object.fromEntries(outputRefs.map((ref) => [ref, this._replaceRef(ref)]));
|
|
135
|
+
actionDef.input.schema = actionDef.input.schema.dereference(inputRefSchemas);
|
|
136
|
+
actionDef.output.schema = actionDef.output.schema.dereference(outputRefSchemas);
|
|
137
|
+
return actionDef;
|
|
138
|
+
};
|
|
139
|
+
_dereferenceEventDefinition = (eventDef) => {
|
|
140
|
+
const refs = eventDef.schema.getReferences();
|
|
141
|
+
const refSchemas = Object.fromEntries(refs.map((ref) => [ref, this._replaceRef(ref)]));
|
|
142
|
+
eventDef.schema = eventDef.schema.dereference(refSchemas);
|
|
143
|
+
return eventDef;
|
|
144
|
+
};
|
|
145
|
+
_replaceRef = (refUri) => import_sdk.z.object({}).title(refUri).describe(refUri);
|
|
146
|
+
}
|
|
147
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
148
|
+
0 && (module.exports = {
|
|
149
|
+
LintCommand
|
|
150
|
+
});
|
|
151
|
+
//# sourceMappingURL=lint-command.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/command-implementations/lint-command.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n type IntegrationDefinition,\n type BotDefinition,\n type InterfaceDefinition,\n ActionDefinition,\n z,\n EventDefinition,\n} from '@botpress/sdk'\nimport { prepareCreateBotBody } from '../api/bot-body'\nimport { prepareCreateIntegrationBody } from '../api/integration-body'\nimport { prepareCreateInterfaceBody } from '../api/interface-body'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport { BotLinter } from '../linter/bot-linter'\nimport { IntegrationLinter } from '../linter/integration-linter'\nimport { InterfaceLinter } from '../linter/interface-linter'\nimport { getImplementationStatements } from '../sdk'\nimport { ProjectCommand } from './project-command'\n\nexport type LintCommandDefinition = typeof commandDefinitions.lint\nexport class LintCommand extends ProjectCommand<LintCommandDefinition> {\n public async run(): Promise<void> {\n const projectDef = await this.readProjectDefinitionFromFS()\n if (projectDef.bpLintDisabled) {\n this.logger.warn(\n 'Linting is disabled for this project because of a bplint directive. To enable linting, remove the \"bplint-disable\" directive from the project definition file'\n )\n return\n }\n\n switch (projectDef.type) {\n case 'integration':\n return this._runLintForIntegration(projectDef.definition)\n case 'bot':\n return this._runLintForBot(projectDef.definition)\n case 'interface':\n return this._runLintForInterface(projectDef.definition)\n default:\n throw new errors.UnsupportedProjectType()\n }\n }\n\n private async _runLintForInterface(definition: InterfaceDefinition): Promise<void> {\n for (const [actionName, actionDef] of Object.entries(definition.actions)) {\n definition.actions[actionName] = this._dereferenceActionDefinition(actionDef)\n }\n\n for (const [eventName, eventDef] of Object.entries(definition.events)) {\n definition.events[eventName] = this._dereferenceEventDefinition(eventDef)\n }\n\n const parsedInterfaceDefinition = await prepareCreateInterfaceBody(definition)\n const linter = new InterfaceLinter(parsedInterfaceDefinition)\n\n await linter.lint()\n linter.logResults(this.logger)\n\n if (linter.hasErrors()) {\n throw new errors.BotpressCLIError('Interface definition contains linting errors')\n }\n\n this.logger.success('Interface definition is valid')\n }\n\n private async _runLintForBot(definition: BotDefinition): Promise<void> {\n const strippedDefinition = this._stripAutoGeneratedContentFromBot(definition)\n const parsedBotDefinition = await prepareCreateBotBody(strippedDefinition)\n const linter = new BotLinter(parsedBotDefinition)\n\n await linter.lint()\n linter.logResults(this.logger)\n\n if (linter.hasErrors()) {\n throw new errors.BotpressCLIError('Bot definition contains linting errors')\n }\n\n this.logger.success('Bot definition is valid')\n }\n\n private _stripAutoGeneratedContentFromBot(definition: BotDefinition) {\n return {\n ...definition,\n integrations: {},\n } as BotDefinition\n }\n\n private async _runLintForIntegration(definition: IntegrationDefinition): Promise<void> {\n const strippedDefinition = this._stripAutoGeneratedContentFromIntegration(definition)\n const parsedIntegrationDefinition = await prepareCreateIntegrationBody(strippedDefinition)\n const linter = new IntegrationLinter({ ...parsedIntegrationDefinition, secrets: strippedDefinition.secrets })\n\n await linter.lint()\n linter.logResults(this.logger)\n\n if (linter.hasErrors()) {\n throw new errors.BotpressCLIError('Integration definition contains linting errors')\n }\n\n this.logger.success('Integration definition is valid')\n }\n\n private _stripAutoGeneratedContentFromIntegration(definition: IntegrationDefinition) {\n const { actionNames, eventNames } = this._getAutoGeneratedContentOfIntegration(definition)\n\n return {\n ...definition,\n actions: Object.fromEntries(Object.entries(definition.actions ?? {}).filter(([key]) => !actionNames.has(key))),\n events: Object.fromEntries(Object.entries(definition.events ?? {}).filter(([key]) => !eventNames.has(key))),\n } as IntegrationDefinition\n }\n\n private _getAutoGeneratedContentOfIntegration(definition: IntegrationDefinition) {\n const actionNames = new Set<string>()\n const eventNames = new Set<string>()\n\n const interfacesStatements = getImplementationStatements(definition)\n for (const iface of Object.values(interfacesStatements)) {\n for (const actionDefinition of Object.values(iface.actions)) {\n actionNames.add(actionDefinition.name)\n }\n for (const eventDefinition of Object.values(iface.events)) {\n eventNames.add(eventDefinition.name)\n }\n }\n\n return { actionNames, eventNames } as const\n }\n\n private _dereferenceActionDefinition = (actionDef: ActionDefinition): ActionDefinition => {\n const inputRefs = actionDef.input.schema.getReferences()\n const outputRefs = actionDef.output.schema.getReferences()\n\n const inputRefSchemas = Object.fromEntries(inputRefs.map((ref) => [ref, this._replaceRef(ref)]))\n const outputRefSchemas = Object.fromEntries(outputRefs.map((ref) => [ref, this._replaceRef(ref)]))\n\n actionDef.input.schema = actionDef.input.schema.dereference(inputRefSchemas) as z.ZodObject\n actionDef.output.schema = actionDef.output.schema.dereference(outputRefSchemas) as z.ZodObject\n\n return actionDef\n }\n\n private _dereferenceEventDefinition = (eventDef: EventDefinition): EventDefinition => {\n const refs = eventDef.schema.getReferences()\n\n const refSchemas = Object.fromEntries(refs.map((ref) => [ref, this._replaceRef(ref)]))\n\n eventDef.schema = eventDef.schema.dereference(refSchemas) as z.ZodObject\n\n return eventDef\n }\n\n private _replaceRef = (refUri: string): z.ZodObject => z.object({}).title(refUri).describe(refUri)\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAOO;AACP,sBAAqC;AACrC,8BAA6C;AAC7C,4BAA2C;AAE3C,aAAwB;AACxB,wBAA0B;AAC1B,gCAAkC;AAClC,8BAAgC;AAChC,IAAAA,cAA4C;AAC5C,6BAA+B;AAGxB,MAAM,oBAAoB,sCAAsC;AAAA,EACrE,MAAa,MAAqB;AAChC,UAAM,aAAa,MAAM,KAAK,4BAA4B;AAC1D,QAAI,WAAW,gBAAgB;AAC7B,WAAK,OAAO;AAAA,QACV;AAAA,MACF;AACA;AAAA,IACF;AAEA,YAAQ,WAAW,MAAM;AAAA,MACvB,KAAK;AACH,eAAO,KAAK,uBAAuB,WAAW,UAAU;AAAA,MAC1D,KAAK;AACH,eAAO,KAAK,eAAe,WAAW,UAAU;AAAA,MAClD,KAAK;AACH,eAAO,KAAK,qBAAqB,WAAW,UAAU;AAAA,MACxD;AACE,cAAM,IAAI,OAAO,uBAAuB;AAAA,IAC5C;AAAA,EACF;AAAA,EAEA,MAAc,qBAAqB,YAAgD;AACjF,eAAW,CAAC,YAAY,SAAS,KAAK,OAAO,QAAQ,WAAW,OAAO,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AAC,CAAC,CAAC;AAEjG,cAAU,MAAM,SAAS,UAAU,MAAM,OAAO,YAAY,eAAe;AAC3E,cAAU,OAAO,SAAS,UAAU,OAAO,OAAO,YAAY,gBAAgB;AAE9E,WAAO;AAAA,EACT;AAAA,EAEQ,8BAA8B,CAAC,aAA+C;AACpF,UAAM,OAAO,SAAS,OAAO,cAAc;AAE3C,UAAM,aAAa,OAAO,YAAY,KAAK,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,YAAY,GAAG,CAAC,CAAC,CAAC;AAErF,aAAS,SAAS,SAAS,OAAO,YAAY,UAAU;AAExD,WAAO;AAAA,EACT;AAAA,EAEQ,cAAc,CAAC,WAAgC,aAAE,OAAO,CAAC,CAAC,EAAE,MAAM,MAAM,EAAE,SAAS,MAAM;AACnG;",
|
|
6
|
+
"names": ["import_sdk"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
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 login_command_exports = {};
|
|
30
|
+
__export(login_command_exports, {
|
|
31
|
+
LoginCommand: () => LoginCommand
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(login_command_exports);
|
|
34
|
+
var client = __toESM(require("@botpress/client"));
|
|
35
|
+
var paging = __toESM(require("../api/paging"));
|
|
36
|
+
var errors = __toESM(require("../errors"));
|
|
37
|
+
var import_global_command = require("./global-command");
|
|
38
|
+
class LoginCommand extends import_global_command.GlobalCommand {
|
|
39
|
+
async run() {
|
|
40
|
+
const promptedToken = await this.globalCache.sync("token", this.argv.token, async (previousToken) => {
|
|
41
|
+
const prompted = await this.prompt.text("Enter your Personal Access Token", {
|
|
42
|
+
initial: previousToken
|
|
43
|
+
});
|
|
44
|
+
if (!prompted) {
|
|
45
|
+
throw new errors.ParamRequiredError("Personal Access Token");
|
|
46
|
+
}
|
|
47
|
+
return prompted;
|
|
48
|
+
});
|
|
49
|
+
const promptedWorkspaceId = await this.globalCache.sync("workspaceId", this.argv.workspaceId, async (defaultId) => {
|
|
50
|
+
const tmpClient = new client.Client({ apiUrl: this.argv.apiUrl, token: promptedToken });
|
|
51
|
+
const userWorkspaces = await paging.listAllPages(tmpClient.listWorkspaces, (r) => r.workspaces).catch((thrown) => {
|
|
52
|
+
throw errors.BotpressCLIError.wrap(thrown, "Could not list workspaces");
|
|
53
|
+
});
|
|
54
|
+
if (userWorkspaces.length === 0) {
|
|
55
|
+
throw new errors.NoWorkspacesFoundError();
|
|
56
|
+
}
|
|
57
|
+
const initial = userWorkspaces.find((ws) => ws.id === defaultId);
|
|
58
|
+
const prompted = await this.prompt.select("Which workspace do you want to login to?", {
|
|
59
|
+
initial: initial && { title: initial.name, value: initial.id },
|
|
60
|
+
choices: userWorkspaces.map((ws) => ({ title: ws.name, value: ws.id }))
|
|
61
|
+
});
|
|
62
|
+
if (!prompted) {
|
|
63
|
+
throw new errors.ParamRequiredError("Workspace Id");
|
|
64
|
+
}
|
|
65
|
+
return prompted;
|
|
66
|
+
});
|
|
67
|
+
await this.globalCache.set("apiUrl", this.argv.apiUrl);
|
|
68
|
+
const api = this.api.newClient(
|
|
69
|
+
{ apiUrl: this.argv.apiUrl, token: promptedToken, workspaceId: promptedWorkspaceId },
|
|
70
|
+
this.logger
|
|
71
|
+
);
|
|
72
|
+
await api.testLogin().catch((thrown) => {
|
|
73
|
+
throw errors.BotpressCLIError.wrap(thrown, "Login failed. Please check your credentials");
|
|
74
|
+
});
|
|
75
|
+
this.logger.success("Logged In");
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
79
|
+
0 && (module.exports = {
|
|
80
|
+
LoginCommand
|
|
81
|
+
});
|
|
82
|
+
//# sourceMappingURL=login-command.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/command-implementations/login-command.ts"],
|
|
4
|
+
"sourcesContent": ["import * as client from '@botpress/client'\nimport * as paging from '../api/paging'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport { GlobalCommand } from './global-command'\n\nexport type LoginCommandDefinition = typeof commandDefinitions.login\nexport class LoginCommand extends GlobalCommand<LoginCommandDefinition> {\n public async run(): Promise<void> {\n const promptedToken = await this.globalCache.sync('token', this.argv.token, async (previousToken) => {\n const prompted = await this.prompt.text('Enter your Personal Access Token', {\n initial: previousToken,\n })\n\n if (!prompted) {\n throw new errors.ParamRequiredError('Personal Access Token')\n }\n\n return prompted\n })\n\n const promptedWorkspaceId = await this.globalCache.sync('workspaceId', this.argv.workspaceId, async (defaultId) => {\n const tmpClient = new client.Client({ apiUrl: this.argv.apiUrl, token: promptedToken }) // no workspaceId yet\n const userWorkspaces = await paging\n .listAllPages(tmpClient.listWorkspaces, (r) => r.workspaces)\n .catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not list workspaces')\n })\n\n if (userWorkspaces.length === 0) {\n throw new errors.NoWorkspacesFoundError()\n }\n\n const initial = userWorkspaces.find((ws) => ws.id === defaultId)\n\n const prompted = await this.prompt.select('Which workspace do you want to login to?', {\n initial: initial && { title: initial.name, value: initial.id },\n choices: userWorkspaces.map((ws) => ({ title: ws.name, value: ws.id })),\n })\n\n if (!prompted) {\n throw new errors.ParamRequiredError('Workspace Id')\n }\n\n return prompted\n })\n\n await this.globalCache.set('apiUrl', this.argv.apiUrl)\n\n const api = this.api.newClient(\n { apiUrl: this.argv.apiUrl, token: promptedToken, workspaceId: promptedWorkspaceId },\n this.logger\n )\n\n await api.testLogin().catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, 'Login failed. Please check your credentials')\n })\n\n this.logger.success('Logged In')\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,aAAwB;AAExB,aAAwB;AACxB,4BAA8B;AAGvB,MAAM,qBAAqB,oCAAsC;AAAA,EACtE,MAAa,MAAqB;AAChC,UAAM,gBAAgB,MAAM,KAAK,YAAY,KAAK,SAAS,KAAK,KAAK,OAAO,OAAO,kBAAkB;AACnG,YAAM,WAAW,MAAM,KAAK,OAAO,KAAK,oCAAoC;AAAA,QAC1E,SAAS;AAAA,MACX,CAAC;AAED,UAAI,CAAC,UAAU;AACb,cAAM,IAAI,O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[]
|
|
7
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var logout_command_exports = {};
|
|
20
|
+
__export(logout_command_exports, {
|
|
21
|
+
LogoutCommand: () => LogoutCommand
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(logout_command_exports);
|
|
24
|
+
var import_global_command = require("./global-command");
|
|
25
|
+
class LogoutCommand extends import_global_command.GlobalCommand {
|
|
26
|
+
async run() {
|
|
27
|
+
await this.globalCache.clear();
|
|
28
|
+
this.logger.success("Logged Out");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
LogoutCommand
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=logout-command.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/command-implementations/logout-command.ts"],
|
|
4
|
+
"sourcesContent": ["import type commandDefinitions from '../command-definitions'\nimport { GlobalCommand } from './global-command'\n\nexport type LogoutCommandDefinition = typeof commandDefinitions.logout\nexport class LogoutCommand extends GlobalCommand<LogoutCommandDefinition> {\n public async run(): Promise<void> {\n await this.globalCache.clear()\n this.logger.success('Logged Out')\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,4BAA8B;AAGvB,MAAM,sBAAsB,oCAAuC;AAAA,EACxE,MAAa,MAAqB;AAChC,UAAM,KAAK,YAAY,MAAM;AAC7B,SAAK,OAAO,QAAQ,YAAY;AAAA,EAClC;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
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 plugin_commands_exports = {};
|
|
30
|
+
__export(plugin_commands_exports, {
|
|
31
|
+
DeletePluginCommand: () => DeletePluginCommand,
|
|
32
|
+
GetPluginCommand: () => GetPluginCommand,
|
|
33
|
+
ListPluginsCommand: () => ListPluginsCommand
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(plugin_commands_exports);
|
|
36
|
+
var import_chalk = __toESM(require("chalk"));
|
|
37
|
+
var errors = __toESM(require("../errors"));
|
|
38
|
+
var import_package_ref = require("../package-ref");
|
|
39
|
+
var utils = __toESM(require("../utils"));
|
|
40
|
+
var import_global_command = require("./global-command");
|
|
41
|
+
class GetPluginCommand extends import_global_command.GlobalCommand {
|
|
42
|
+
async run() {
|
|
43
|
+
const api = await this.ensureLoginAndCreateClient(this.argv);
|
|
44
|
+
const parsedRef = (0, import_package_ref.parsePackageRef)(this.argv.pluginRef);
|
|
45
|
+
if (!parsedRef) {
|
|
46
|
+
throw new errors.InvalidPackageReferenceError(this.argv.pluginRef);
|
|
47
|
+
}
|
|
48
|
+
if (parsedRef.type === "path") {
|
|
49
|
+
throw new errors.BotpressCLIError("Cannot get local plugin");
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
const plugin = await api.findPublicPlugin(parsedRef);
|
|
53
|
+
if (plugin) {
|
|
54
|
+
this.logger.success(`Plugin ${import_chalk.default.bold(this.argv.pluginRef)}:`);
|
|
55
|
+
this.logger.json(utils.object.omit(plugin, "code"));
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
} catch (thrown) {
|
|
59
|
+
throw errors.BotpressCLIError.wrap(thrown, `Could not get plugin ${this.argv.pluginRef}`);
|
|
60
|
+
}
|
|
61
|
+
throw new errors.BotpressCLIError(`Plugin ${this.argv.pluginRef} not found`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
class ListPluginsCommand extends import_global_command.GlobalCommand {
|
|
65
|
+
async run() {
|
|
66
|
+
const api = await this.ensureLoginAndCreateClient(this.argv);
|
|
67
|
+
const lister = (req) => api.client.listPlugins({ nextToken: req.nextToken });
|
|
68
|
+
try {
|
|
69
|
+
const plugins = await api.listAllPages(lister, (r) => r.plugins);
|
|
70
|
+
this.logger.success("Plugins:");
|
|
71
|
+
this.logger.json(plugins);
|
|
72
|
+
} catch (thrown) {
|
|
73
|
+
throw errors.BotpressCLIError.wrap(thrown, "Could not list plugins");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
class DeletePluginCommand extends import_global_command.GlobalCommand {
|
|
78
|
+
async run() {
|
|
79
|
+
const api = await this.ensureLoginAndCreateClient(this.argv);
|
|
80
|
+
const parsedRef = (0, import_package_ref.parsePackageRef)(this.argv.pluginRef);
|
|
81
|
+
if (!parsedRef) {
|
|
82
|
+
throw new errors.InvalidPackageReferenceError(this.argv.pluginRef);
|
|
83
|
+
}
|
|
84
|
+
if (parsedRef.type === "path") {
|
|
85
|
+
throw new errors.BotpressCLIError("Cannot delete local plugin");
|
|
86
|
+
}
|
|
87
|
+
let plugin;
|
|
88
|
+
try {
|
|
89
|
+
plugin = await api.findPublicPlugin(parsedRef);
|
|
90
|
+
} catch (thrown) {
|
|
91
|
+
throw errors.BotpressCLIError.wrap(thrown, `Could not get plugin ${this.argv.pluginRef}`);
|
|
92
|
+
}
|
|
93
|
+
if (!plugin) {
|
|
94
|
+
throw new errors.BotpressCLIError(`Plugin ${this.argv.pluginRef} not found`);
|
|
95
|
+
}
|
|
96
|
+
try {
|
|
97
|
+
await api.client.deletePlugin({ id: plugin.id });
|
|
98
|
+
} catch (thrown) {
|
|
99
|
+
throw errors.BotpressCLIError.wrap(thrown, `Could not delete plugin ${this.argv.pluginRef}`);
|
|
100
|
+
}
|
|
101
|
+
this.logger.success(`Plugin ${import_chalk.default.bold(this.argv.pluginRef)} deleted`);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
106
|
+
0 && (module.exports = {
|
|
107
|
+
DeletePluginCommand,
|
|
108
|
+
GetPluginCommand,
|
|
109
|
+
ListPluginsCommand
|
|
110
|
+
});
|
|
111
|
+
//# sourceMappingURL=plugin-commands.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/command-implementations/plugin-commands.ts"],
|
|
4
|
+
"sourcesContent": ["import type * as client from '@botpress/client'\nimport chalk from 'chalk'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport { parsePackageRef } from '../package-ref'\nimport * as utils from '../utils'\nimport { GlobalCommand } from './global-command'\n\nexport type GetPluginCommandDefinition = typeof commandDefinitions.plugins.subcommands.get\nexport class GetPluginCommand extends GlobalCommand<GetPluginCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n const parsedRef = parsePackageRef(this.argv.pluginRef)\n if (!parsedRef) {\n throw new errors.InvalidPackageReferenceError(this.argv.pluginRef)\n }\n if (parsedRef.type === 'path') {\n throw new errors.BotpressCLIError('Cannot get local plugin')\n }\n\n try {\n const plugin = await api.findPublicPlugin(parsedRef)\n if (plugin) {\n this.logger.success(`Plugin ${chalk.bold(this.argv.pluginRef)}:`)\n this.logger.json(utils.object.omit(plugin, 'code'))\n return\n }\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not get plugin ${this.argv.pluginRef}`)\n }\n\n throw new errors.BotpressCLIError(`Plugin ${this.argv.pluginRef} not found`)\n }\n}\n\nexport type ListPluginsCommandDefinition = typeof commandDefinitions.plugins.subcommands.list\nexport class ListPluginsCommand extends GlobalCommand<ListPluginsCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n\n const lister = (req: { nextToken?: string }) => api.client.listPlugins({ nextToken: req.nextToken })\n\n try {\n const plugins = await api.listAllPages(lister, (r) => r.plugins)\n\n this.logger.success('Plugins:')\n this.logger.json(plugins)\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not list plugins')\n }\n }\n}\n\nexport type DeletePluginCommandDefinition = typeof commandDefinitions.plugins.subcommands.delete\nexport class DeletePluginCommand extends GlobalCommand<DeletePluginCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n const parsedRef = parsePackageRef(this.argv.pluginRef)\n if (!parsedRef) {\n throw new errors.InvalidPackageReferenceError(this.argv.pluginRef)\n }\n if (parsedRef.type === 'path') {\n throw new errors.BotpressCLIError('Cannot delete local plugin')\n }\n\n let plugin: client.Plugin | undefined\n try {\n plugin = await api.findPublicPlugin(parsedRef)\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not get plugin ${this.argv.pluginRef}`)\n }\n\n if (!plugin) {\n throw new errors.BotpressCLIError(`Plugin ${this.argv.pluginRef} not found`)\n }\n\n try {\n await api.client.deletePlugin({ id: plugin.id })\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not delete plugin ${this.argv.pluginRef}`)\n }\n\n this.logger.success(`Plugin ${chalk.bold(this.argv.pluginRef)} deleted`)\n return\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAElB,aAAwB;AACxB,yBAAgC;AAChC,YAAuB;AACvB,4BAA8B;AAGvB,MAAM,yBAAyB,oCAA0C;AAAA,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