@botpress/cli 0.11.6 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +9 -9
- package/dist/api/bot-body.js.map +2 -2
- package/dist/api/client.js +14 -28
- package/dist/api/client.js.map +3 -3
- package/dist/api/find-previous-version.js.map +1 -1
- package/dist/api/index.js +23 -0
- package/dist/api/index.js.map +7 -0
- package/dist/api/interface-body.js +25 -10
- package/dist/api/interface-body.js.map +2 -2
- package/dist/code-generation/bot-implementation/bot-implementation.js +92 -0
- package/dist/code-generation/bot-implementation/bot-implementation.js.map +7 -0
- package/dist/code-generation/{integration-schemas → bot-implementation/bot-typings}/events-module.js +15 -22
- package/dist/code-generation/bot-implementation/bot-typings/events-module.js.map +7 -0
- package/dist/code-generation/bot-implementation/bot-typings/index.js +96 -0
- package/dist/code-generation/bot-implementation/bot-typings/index.js.map +7 -0
- package/dist/code-generation/{integration-schemas → bot-implementation/bot-typings}/states-module.js +17 -22
- package/dist/code-generation/bot-implementation/bot-typings/states-module.js.map +7 -0
- package/dist/code-generation/bot-implementation/index.js +56 -0
- package/dist/code-generation/bot-implementation/index.js.map +7 -0
- package/dist/code-generation/{const.js → consts.js} +9 -4
- package/dist/code-generation/consts.js.map +7 -0
- package/dist/code-generation/generators.js +37 -7
- package/dist/code-generation/generators.js.map +2 -2
- package/dist/code-generation/index.js +15 -105
- package/dist/code-generation/index.js.map +3 -3
- package/dist/code-generation/integration-implementation/index.js +66 -0
- package/dist/code-generation/integration-implementation/index.js.map +7 -0
- package/dist/code-generation/integration-implementation/integration-implementation.js +110 -0
- package/dist/code-generation/integration-implementation/integration-implementation.js.map +7 -0
- package/dist/code-generation/{integration-secret.js → integration-implementation/integration-secret.js} +17 -7
- package/dist/code-generation/integration-implementation/integration-secret.js.map +7 -0
- package/dist/code-generation/{integration-schemas → integration-implementation/integration-typings}/actions-module.js +28 -40
- 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 +103 -0
- package/dist/code-generation/integration-implementation/integration-typings/channels-module.js.map +7 -0
- package/dist/code-generation/{integration-schemas → integration-implementation/integration-typings}/configuration-module.js +18 -20
- package/dist/code-generation/integration-implementation/integration-typings/configuration-module.js.map +7 -0
- package/dist/code-generation/{integration-schemas → integration-implementation/integration-typings}/configurations-module.js +21 -27
- package/dist/code-generation/integration-implementation/integration-typings/configurations-module.js.map +7 -0
- package/dist/code-generation/{integration-schemas → integration-implementation/integration-typings}/entities-module.js +15 -22
- 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 +59 -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 +60 -0
- package/dist/code-generation/integration-implementation/integration-typings/states-module.js.map +7 -0
- package/dist/code-generation/integration-package/index.js +81 -0
- package/dist/code-generation/integration-package/index.js.map +7 -0
- package/dist/code-generation/integration-package/integration-package-definition/actions-module.js +84 -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 +103 -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 +58 -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 +66 -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 +59 -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 +62 -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 +136 -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 +62 -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-package/index.js +81 -0
- package/dist/code-generation/interface-package/index.js.map +7 -0
- package/dist/code-generation/interface-package/interface-package-definition/actions-module.js +84 -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 +94 -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 +59 -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 +62 -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 +100 -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 +60 -16
- package/dist/code-generation/module.js.map +2 -2
- package/dist/code-generation/strings.js +5 -2
- package/dist/code-generation/strings.js.map +2 -2
- package/dist/code-generation/typings.js.map +1 -1
- package/dist/command-implementations/add-command.js +102 -91
- package/dist/command-implementations/add-command.js.map +3 -3
- package/dist/command-implementations/bundle-command.js +16 -9
- package/dist/command-implementations/bundle-command.js.map +2 -2
- package/dist/command-implementations/deploy-command.js +27 -19
- package/dist/command-implementations/deploy-command.js.map +2 -2
- package/dist/command-implementations/dev-command.js +15 -12
- package/dist/command-implementations/dev-command.js.map +2 -2
- package/dist/command-implementations/gen-command.js +31 -12
- package/dist/command-implementations/gen-command.js.map +3 -3
- package/dist/command-implementations/init-command.js +2 -2
- package/dist/command-implementations/init-command.js.map +2 -2
- package/dist/command-implementations/integration-commands.js +5 -5
- package/dist/command-implementations/integration-commands.js.map +2 -2
- package/dist/command-implementations/interface-commands.js +5 -5
- package/dist/command-implementations/interface-commands.js.map +2 -2
- package/dist/command-implementations/lint-command.js +3 -1
- package/dist/command-implementations/lint-command.js.map +3 -3
- package/dist/command-implementations/project-command.js +40 -23
- package/dist/command-implementations/project-command.js.map +3 -3
- package/dist/command-implementations/read-command.js +0 -5
- package/dist/command-implementations/read-command.js.map +2 -2
- package/dist/config.js +22 -7
- package/dist/config.js.map +2 -2
- package/dist/consts.js +15 -6
- package/dist/consts.js.map +2 -2
- package/dist/errors.js +19 -11
- package/dist/errors.js.map +2 -2
- package/dist/logger/index.js +4 -2
- package/dist/logger/index.js.map +2 -2
- package/dist/{integration-ref.js → package-ref.js} +11 -11
- package/dist/package-ref.js.map +7 -0
- package/dist/{integration-ref.test.js → package-ref.test.js} +18 -18
- package/dist/package-ref.test.js.map +7 -0
- package/dist/sdk/index.js +21 -0
- package/dist/sdk/index.js.map +7 -0
- package/dist/sdk/resolve-bot-interfaces.js +38 -0
- package/dist/sdk/resolve-bot-interfaces.js.map +7 -0
- package/dist/sdk/resolve-integration-interfaces.js +148 -0
- package/dist/sdk/resolve-integration-interfaces.js.map +7 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +2 -2
- package/dist/utils/path-utils.js +25 -8
- package/dist/utils/path-utils.js.map +3 -3
- package/dist/utils/path-utils.test.js +69 -0
- package/dist/utils/path-utils.test.js.map +7 -0
- package/dist/utils/record-utils.js +25 -0
- package/dist/utils/record-utils.js.map +3 -3
- package/dist/utils/schema-utils.js +11 -0
- package/dist/utils/schema-utils.js.map +2 -2
- package/dist/utils/schema-utils.test.js +51 -0
- package/dist/utils/schema-utils.test.js.map +7 -0
- package/dist/utils/template-utils.js +47 -0
- package/dist/utils/template-utils.js.map +7 -0
- package/dist/utils/type-utils.js.map +1 -1
- package/e2e/index.ts +2 -0
- package/e2e/tests/install-package.ts +163 -0
- package/e2e/utils.ts +25 -2
- package/package.json +5 -4
- package/templates/empty-bot/.botpress/implementation/index.ts +41 -0
- package/templates/empty-bot/.botpress/implementation/typings/index.ts +17 -0
- package/templates/empty-bot/.botpress/implementation/typings/integrations/index.ts +6 -0
- package/templates/empty-bot/.botpress/index.ts +1 -0
- package/templates/empty-bot/bot.definition.ts +2 -0
- package/templates/{echo-bot → empty-bot}/package.json +2 -2
- package/templates/empty-bot/src/index.ts +5 -0
- package/templates/empty-integration/.botpress/implementation/index.ts +7 -35
- package/templates/empty-integration/.botpress/implementation/typings/configuration/index.ts +2 -0
- package/templates/empty-integration/.botpress/implementation/typings/index.ts +31 -0
- package/templates/empty-integration/package.json +1 -1
- package/templates/hello-world/.botpress/implementation/index.ts +7 -35
- 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/configuration/index.ts +2 -0
- package/templates/hello-world/.botpress/implementation/typings/index.ts +31 -0
- package/templates/hello-world/package.json +1 -1
- package/templates/webhook-message/.botpress/implementation/index.ts +7 -35
- 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/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/package.json +1 -1
- package/dist/code-generation/const.js.map +0 -7
- package/dist/code-generation/integration-implementation.js +0 -192
- package/dist/code-generation/integration-implementation.js.map +0 -7
- package/dist/code-generation/integration-instance.js +0 -185
- package/dist/code-generation/integration-instance.js.map +0 -7
- package/dist/code-generation/integration-schemas/actions-module.js.map +0 -7
- package/dist/code-generation/integration-schemas/channels-module.js +0 -117
- package/dist/code-generation/integration-schemas/channels-module.js.map +0 -7
- package/dist/code-generation/integration-schemas/configuration-module.js.map +0 -7
- package/dist/code-generation/integration-schemas/configurations-module.js.map +0 -7
- package/dist/code-generation/integration-schemas/entities-module.js.map +0 -7
- package/dist/code-generation/integration-schemas/events-module.js.map +0 -7
- package/dist/code-generation/integration-schemas/states-module.js.map +0 -7
- package/dist/code-generation/integration-secret.js.map +0 -7
- package/dist/code-generation/map-integration.js +0 -76
- package/dist/code-generation/map-integration.js.map +0 -7
- package/dist/integration-ref.js.map +0 -7
- package/dist/integration-ref.test.js.map +0 -7
- package/templates/echo-bot/src/index.ts +0 -30
- package/templates/empty-integration/.botpress/implementation/configuration/index.ts +0 -10
- package/templates/hello-world/.botpress/implementation/actions/helloWorld/input.ts +0 -10
- package/templates/hello-world/.botpress/implementation/actions/helloWorld/output.ts +0 -10
- package/templates/hello-world/.botpress/implementation/configuration/index.ts +0 -10
- package/templates/webhook-message/.botpress/implementation/channels/webhook/messages/text.ts +0 -10
- package/templates/webhook-message/.botpress/implementation/configuration/index.ts +0 -13
- /package/templates/{empty-integration/.botpress/implementation → empty-bot/.botpress/implementation/typings}/events/index.ts +0 -0
- /package/templates/{empty-integration/.botpress/implementation → empty-bot/.botpress/implementation/typings}/states/index.ts +0 -0
- /package/templates/{echo-bot → empty-bot}/tsconfig.json +0 -0
- /package/templates/empty-integration/.botpress/implementation/{actions → typings/actions}/index.ts +0 -0
- /package/templates/empty-integration/.botpress/implementation/{channels → typings/channels}/index.ts +0 -0
- /package/templates/empty-integration/.botpress/implementation/{configurations → typings/configurations}/index.ts +0 -0
- /package/templates/empty-integration/.botpress/implementation/{entities → typings/entities}/index.ts +0 -0
- /package/templates/{hello-world/.botpress/implementation → empty-integration/.botpress/implementation/typings}/events/index.ts +0 -0
- /package/templates/{hello-world/.botpress/implementation → empty-integration/.botpress/implementation/typings}/states/index.ts +0 -0
- /package/templates/hello-world/.botpress/implementation/{actions → typings/actions}/helloWorld/index.ts +0 -0
- /package/templates/hello-world/.botpress/implementation/{actions → typings/actions}/index.ts +0 -0
- /package/templates/hello-world/.botpress/implementation/{channels → typings/channels}/index.ts +0 -0
- /package/templates/hello-world/.botpress/implementation/{configurations → typings/configurations}/index.ts +0 -0
- /package/templates/hello-world/.botpress/implementation/{entities → typings/entities}/index.ts +0 -0
- /package/templates/{webhook-message/.botpress/implementation → hello-world/.botpress/implementation/typings}/events/index.ts +0 -0
- /package/templates/{webhook-message/.botpress/implementation → hello-world/.botpress/implementation/typings}/states/index.ts +0 -0
- /package/templates/webhook-message/.botpress/implementation/{actions → typings/actions}/index.ts +0 -0
- /package/templates/webhook-message/.botpress/implementation/{channels → typings/channels}/index.ts +0 -0
- /package/templates/webhook-message/.botpress/implementation/{channels → typings/channels}/webhook/index.ts +0 -0
- /package/templates/webhook-message/.botpress/implementation/{channels → typings/channels}/webhook/messages/index.ts +0 -0
- /package/templates/webhook-message/.botpress/implementation/{configurations → typings/configurations}/index.ts +0 -0
- /package/templates/webhook-message/.botpress/implementation/{entities → typings/entities}/index.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/command-implementations/interface-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 {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAElB,aAAwB;AACxB,
|
|
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 { GlobalCommand } from './global-command'\n\nexport type GetInterfaceCommandDefinition = typeof commandDefinitions.interfaces.subcommands.get\nexport class GetInterfaceCommand extends GlobalCommand<GetInterfaceCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n const parsedRef = parsePackageRef(this.argv.interfaceRef)\n if (!parsedRef) {\n throw new errors.InvalidPackageReferenceError(this.argv.interfaceRef)\n }\n if (parsedRef.type === 'path') {\n throw new errors.BotpressCLIError('Cannot get local interface')\n }\n\n try {\n const intrface = await api.findPublicInterface(parsedRef)\n if (intrface) {\n this.logger.success(`Interface ${chalk.bold(this.argv.interfaceRef)}:`)\n this.logger.json(intrface)\n return\n }\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not get interface ${this.argv.interfaceRef}`)\n }\n\n throw new errors.BotpressCLIError(`Interface ${this.argv.interfaceRef} not found`)\n }\n}\n\nexport type ListInterfacesCommandDefinition = typeof commandDefinitions.interfaces.subcommands.list\nexport class ListInterfacesCommand extends GlobalCommand<ListInterfacesCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n\n const lister = (req: { nextToken?: string }) => api.client.listInterfaces({ nextToken: req.nextToken })\n\n try {\n const interfaces = await api.listAllPages(lister, (r) => r.interfaces)\n\n this.logger.success('Interfaces:')\n this.logger.json(interfaces)\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not list interfaces')\n }\n }\n}\n\nexport type DeleteInterfaceCommandDefinition = typeof commandDefinitions.interfaces.subcommands.delete\nexport class DeleteInterfaceCommand extends GlobalCommand<DeleteInterfaceCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n const parsedRef = parsePackageRef(this.argv.interfaceRef)\n if (!parsedRef) {\n throw new errors.InvalidPackageReferenceError(this.argv.interfaceRef)\n }\n if (parsedRef.type === 'path') {\n throw new errors.BotpressCLIError('Cannot delete local interface')\n }\n\n let intrface: client.Interface | undefined\n try {\n intrface = await api.findPublicInterface(parsedRef)\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not get interface ${this.argv.interfaceRef}`)\n }\n\n if (!intrface) {\n throw new errors.BotpressCLIError(`Interface ${this.argv.interfaceRef} not found`)\n }\n\n try {\n await api.client.deleteInterface({ id: intrface.id })\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not delete interface ${this.argv.interfaceRef}`)\n }\n\n this.logger.success(`Interface ${chalk.bold(this.argv.interfaceRef)} deleted`)\n return\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAElB,aAAwB;AACxB,yBAAgC;AAChC,4BAA8B;AAGvB,MAAM,4BAA4B,oCAA6C;AAAA,EACpF,MAAa,MAAqB;AAChC,UAAM,MAAM,MAAM,KAAK,2BAA2B,KAAK,IAAI;AAC3D,UAAM,gBAAY,oCAAgB,KAAK,KAAK,YAAY;AACxD,QAAI,CAAC,WAAW;AACd,YAAM,IAAI,OAAO,6BAA6B,KAAK,KAAK,YAAY;AAAA,IACtE;AACA,QAAI,UAAU,SAAS,QAAQ;AAC7B,YAAM,IAAI,OAAO,iBAAiB,4BAA4B;AAAA,IAChE;AAEA,QAAI;AACF,YAAM,WAAW,MAAM,IAAI,oBAAoB,SAAS;AACxD,UAAI,UAAU;AACZ,aAAK,OAAO,QAAQ,aAAa,aAAAA,QAAM,KAAK,KAAK,KAAK,YAAY,IAAI;AACtE,aAAK,OAAO,KAAK,QAAQ;AACzB;AAAA,MACF;AAAA,IACF,SAAS,QAAP;AACA,YAAM,OAAO,iBAAiB,KAAK,QAAQ,2BAA2B,KAAK,KAAK,cAAc;AAAA,IAChG;AAEA,UAAM,IAAI,OAAO,iBAAiB,aAAa,KAAK,KAAK,wBAAwB;AAAA,EACnF;AACF;AAGO,MAAM,8BAA8B,oCAA+C;AAAA,EACx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F;AACF;",
|
|
6
6
|
"names": ["chalk"]
|
|
7
7
|
}
|
|
@@ -30,6 +30,7 @@ module.exports = __toCommonJS(lint_command_exports);
|
|
|
30
30
|
var import_integration_body = require("../api/integration-body");
|
|
31
31
|
var errors = __toESM(require("../errors"));
|
|
32
32
|
var import_integration_linter = require("../linter/integration-linter");
|
|
33
|
+
var import_sdk2 = require("../sdk");
|
|
33
34
|
var import_project_command = require("./project-command");
|
|
34
35
|
class LintCommand extends import_project_command.ProjectCommand {
|
|
35
36
|
async run() {
|
|
@@ -63,7 +64,8 @@ class LintCommand extends import_project_command.ProjectCommand {
|
|
|
63
64
|
_getAutoGeneratedContentOfIntegration(definition) {
|
|
64
65
|
const actionNames = /* @__PURE__ */ new Set();
|
|
65
66
|
const eventNames = /* @__PURE__ */ new Set();
|
|
66
|
-
|
|
67
|
+
const interfacesStatements = (0, import_sdk2.getImplementationStatements)(definition);
|
|
68
|
+
for (const iface of Object.values(interfacesStatements)) {
|
|
67
69
|
for (const actionDefinition of Object.values(iface.actions)) {
|
|
68
70
|
actionNames.add(actionDefinition.name);
|
|
69
71
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/command-implementations/lint-command.ts"],
|
|
4
|
-
"sourcesContent": ["import { IntegrationDefinition } from '@botpress/sdk'\nimport { prepareCreateIntegrationBody } from '../api/integration-body'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport { IntegrationLinter } from '../linter/integration-linter'\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\n switch (projectDef.type) {\n case 'integration':\n return this._runLintForIntegration(projectDef.definition)\n case 'bot':\n throw new errors.BotpressCLIError('Bot linting is not yet implemented')\n case 'interface':\n throw new errors.BotpressCLIError('Interface linting is not yet implemented')\n default:\n throw new errors.BotpressCLIError('Unsupported project type')\n }\n }\n\n private async _runLintForIntegration(definition: IntegrationDefinition): Promise<void> {\n const strippedDefinition = this._stripAutoGeneratedContentFromIntegration(definition)\n const parsedIntegrationDefinition = await prepareCreateIntegrationBody(strippedDefinition, { dereference: true })\n const linter = new IntegrationLinter(parsedIntegrationDefinition)\n\n await linter.lint()\n linter.logResults(this.logger)\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 for (const iface of Object.values(
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,8BAA6C;AAE7C,aAAwB;AACxB,gCAAkC;AAClC,6BAA+B;AAGxB,MAAM,oBAAoB,sCAAsC;AAAA,EACrE,MAAa,MAAqB;AAChC,UAAM,aAAa,MAAM,KAAK,4BAA4B;AAE1D,YAAQ,WAAW,MAAM;AAAA,MACvB,KAAK;AACH,eAAO,KAAK,uBAAuB,WAAW,UAAU;AAAA,MAC1D,KAAK;AACH,cAAM,IAAI,OAAO,iBAAiB,oCAAoC;AAAA,MACxE,KAAK;AACH,cAAM,IAAI,OAAO,iBAAiB,0CAA0C;AAAA,MAC9E;AACE,cAAM,IAAI,OAAO,iBAAiB,0BAA0B;AAAA,IAChE;AAAA,EACF;AAAA,EAEA,MAAc,uBAAuB,YAAkD;AACrF,UAAM,qBAAqB,KAAK,0CAA0C,UAAU;AACpF,UAAM,8BAA8B,UAAM,sDAA6B,oBAAoB,EAAE,aAAa,KAAK,CAAC;AAChH,UAAM,SAAS,IAAI,4CAAkB,2BAA2B;AAEhE,UAAM,OAAO,KAAK;AAClB,WAAO,WAAW,KAAK,MAAM;AAAA,EAC/B;AAAA,EAEQ,0CAA0C,YAAmC;AACnF,UAAM,EAAE,aAAa,WAAW,IAAI,KAAK,sCAAsC,UAAU;AAEzF,WAAO;AAAA,MACL,GAAG;AAAA,MACH,SAAS,OAAO,YAAY,OAAO,QAAQ,WAAW,WAAW,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,YAAY,IAAI,GAAG,CAAC,CAAC;AAAA,MAC7G,QAAQ,OAAO,YAAY,OAAO,QAAQ,WAAW,UAAU,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,WAAW,IAAI,GAAG,CAAC,CAAC;AAAA,IAC5G;AAAA,EACF;AAAA,EAEQ,sCAAsC,YAAmC;AAC/E,UAAM,cAAc,oBAAI,IAAY;AACpC,UAAM,aAAa,oBAAI,IAAY;AAEnC,eAAW,SAAS,OAAO,OAAO,
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import { IntegrationDefinition } from '@botpress/sdk'\nimport { prepareCreateIntegrationBody } from '../api/integration-body'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport { IntegrationLinter } from '../linter/integration-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\n switch (projectDef.type) {\n case 'integration':\n return this._runLintForIntegration(projectDef.definition)\n case 'bot':\n throw new errors.BotpressCLIError('Bot linting is not yet implemented')\n case 'interface':\n throw new errors.BotpressCLIError('Interface linting is not yet implemented')\n default:\n throw new errors.BotpressCLIError('Unsupported project type')\n }\n }\n\n private async _runLintForIntegration(definition: IntegrationDefinition): Promise<void> {\n const strippedDefinition = this._stripAutoGeneratedContentFromIntegration(definition)\n const parsedIntegrationDefinition = await prepareCreateIntegrationBody(strippedDefinition, { dereference: true })\n const linter = new IntegrationLinter(parsedIntegrationDefinition)\n\n await linter.lint()\n linter.logResults(this.logger)\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"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,8BAA6C;AAE7C,aAAwB;AACxB,gCAAkC;AAClC,IAAAA,cAA4C;AAC5C,6BAA+B;AAGxB,MAAM,oBAAoB,sCAAsC;AAAA,EACrE,MAAa,MAAqB;AAChC,UAAM,aAAa,MAAM,KAAK,4BAA4B;AAE1D,YAAQ,WAAW,MAAM;AAAA,MACvB,KAAK;AACH,eAAO,KAAK,uBAAuB,WAAW,UAAU;AAAA,MAC1D,KAAK;AACH,cAAM,IAAI,OAAO,iBAAiB,oCAAoC;AAAA,MACxE,KAAK;AACH,cAAM,IAAI,OAAO,iBAAiB,0CAA0C;AAAA,MAC9E;AACE,cAAM,IAAI,OAAO,iBAAiB,0BAA0B;AAAA,IA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ESM(require("chalk"));
|
|
32
32
|
var import_fs = __toESM(require("fs"));
|
|
33
33
|
var import_lodash = __toESM(require("lodash"));
|
|
34
|
-
var import_path = __toESM(require("path"));
|
|
35
34
|
var import_semver = __toESM(require("semver"));
|
|
36
35
|
var codegen = __toESM(require("../code-generation"));
|
|
37
36
|
var consts = __toESM(require("../consts"));
|
|
38
37
|
var errors = __toESM(require("../errors"));
|
|
39
|
-
var
|
|
40
|
-
var
|
|
38
|
+
var import_package_ref = require("../package-ref");
|
|
39
|
+
var import_sdk = require("../sdk");
|
|
41
40
|
var utils = __toESM(require("../utils"));
|
|
42
41
|
var import_global_command = require("./global-command");
|
|
43
42
|
class ProjectPaths extends utils.path.PathStore {
|
|
@@ -65,14 +64,14 @@ class ProjectCommand extends import_global_command.GlobalCommand {
|
|
|
65
64
|
get projectCache() {
|
|
66
65
|
return new utils.cache.FSKeyValueCache(this.projectPaths.abs.projectCacheFile);
|
|
67
66
|
}
|
|
68
|
-
async fetchBotIntegrationInstances(
|
|
69
|
-
const integrationList = (0, import_lodash.default)(
|
|
67
|
+
async fetchBotIntegrationInstances(botDefinition, api) {
|
|
68
|
+
const integrationList = (0, import_lodash.default)(botDefinition.integrations).values().filter(utils.guards.is.defined).value();
|
|
70
69
|
const { remoteInstances, localInstances } = this._splitApiAndLocalIntegrationInstances(integrationList);
|
|
71
70
|
const fetchedInstances = await import_bluebird.default.map(localInstances, async (instance) => {
|
|
72
|
-
const ref = { type: "name", name: instance.name, version: instance.version };
|
|
71
|
+
const ref = { type: "name", name: instance.definition.name, version: instance.definition.version };
|
|
73
72
|
const integration = await api.findIntegration(ref);
|
|
74
73
|
if (!integration) {
|
|
75
|
-
const formattedRef = (0,
|
|
74
|
+
const formattedRef = (0, import_package_ref.formatPackageRef)(ref);
|
|
76
75
|
throw new errors.BotpressCLIError(`Integration "${formattedRef}" not found`);
|
|
77
76
|
}
|
|
78
77
|
return { ...instance, id: integration.id };
|
|
@@ -86,16 +85,17 @@ class ProjectCommand extends import_global_command.GlobalCommand {
|
|
|
86
85
|
_splitApiAndLocalIntegrationInstances(instances) {
|
|
87
86
|
const remoteInstances = [];
|
|
88
87
|
const localInstances = [];
|
|
89
|
-
for (const
|
|
90
|
-
if (id) {
|
|
91
|
-
remoteInstances.push(
|
|
88
|
+
for (const instance of instances) {
|
|
89
|
+
if ("id" in instance) {
|
|
90
|
+
remoteInstances.push(instance);
|
|
92
91
|
} else {
|
|
93
|
-
localInstances.push(
|
|
92
|
+
localInstances.push(instance);
|
|
94
93
|
}
|
|
95
94
|
}
|
|
96
95
|
return { remoteInstances, localInstances };
|
|
97
96
|
}
|
|
98
|
-
async readProjectDefinitionFromFS(
|
|
97
|
+
async readProjectDefinitionFromFS() {
|
|
98
|
+
const projectPaths = this.projectPaths;
|
|
99
99
|
try {
|
|
100
100
|
const integrationDefinition = await this._readIntegrationDefinitionFromFS(projectPaths);
|
|
101
101
|
if (integrationDefinition) {
|
|
@@ -105,12 +105,16 @@ class ProjectCommand extends import_global_command.GlobalCommand {
|
|
|
105
105
|
if (interfaceDefinition) {
|
|
106
106
|
return { type: "interface", definition: interfaceDefinition };
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
const botDefinition = await this._readBotDefinitionFromFS(projectPaths);
|
|
109
|
+
if (botDefinition) {
|
|
110
|
+
return { type: "bot", definition: botDefinition };
|
|
111
|
+
}
|
|
109
112
|
} catch (thrown) {
|
|
110
113
|
throw errors.BotpressCLIError.wrap(thrown, "Error while reading project definition");
|
|
111
114
|
}
|
|
115
|
+
throw new errors.ProjectDefinitionNotFoundError(this.projectPaths.abs.workDir);
|
|
112
116
|
}
|
|
113
|
-
async _readIntegrationDefinitionFromFS(projectPaths
|
|
117
|
+
async _readIntegrationDefinitionFromFS(projectPaths) {
|
|
114
118
|
const abs = projectPaths.abs;
|
|
115
119
|
const rel = projectPaths.rel("workDir");
|
|
116
120
|
if (!import_fs.default.existsSync(abs.integrationDefinition)) {
|
|
@@ -127,11 +131,12 @@ class ProjectCommand extends import_global_command.GlobalCommand {
|
|
|
127
131
|
if (!artifact) {
|
|
128
132
|
throw new errors.BotpressCLIError("Could not read integration definition");
|
|
129
133
|
}
|
|
130
|
-
|
|
131
|
-
(0,
|
|
134
|
+
let { default: definition } = utils.require.requireJsCode(artifact.text);
|
|
135
|
+
definition = (0, import_sdk.resolveInterfaces)(definition);
|
|
136
|
+
(0, import_sdk.validateIntegrationDefinition)(definition);
|
|
132
137
|
return definition;
|
|
133
138
|
}
|
|
134
|
-
async _readInterfaceDefinitionFromFS(projectPaths
|
|
139
|
+
async _readInterfaceDefinitionFromFS(projectPaths) {
|
|
135
140
|
const abs = projectPaths.abs;
|
|
136
141
|
const rel = projectPaths.rel("workDir");
|
|
137
142
|
if (!import_fs.default.existsSync(abs.interfaceDefinition)) {
|
|
@@ -151,13 +156,25 @@ class ProjectCommand extends import_global_command.GlobalCommand {
|
|
|
151
156
|
const { default: definition } = utils.require.requireJsCode(artifact.text);
|
|
152
157
|
return definition;
|
|
153
158
|
}
|
|
154
|
-
async
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
await import_fs.default.promises.writeFile(filePath, file.content);
|
|
159
|
+
async _readBotDefinitionFromFS(projectPaths) {
|
|
160
|
+
const abs = projectPaths.abs;
|
|
161
|
+
const rel = projectPaths.rel("workDir");
|
|
162
|
+
if (!import_fs.default.existsSync(abs.botDefinition)) {
|
|
163
|
+
return;
|
|
160
164
|
}
|
|
165
|
+
const { outputFiles } = await utils.esbuild.buildEntrypoint({
|
|
166
|
+
cwd: abs.workDir,
|
|
167
|
+
outfile: "",
|
|
168
|
+
entrypoint: rel.botDefinition,
|
|
169
|
+
write: false,
|
|
170
|
+
minify: false
|
|
171
|
+
});
|
|
172
|
+
const artifact = outputFiles[0];
|
|
173
|
+
if (!artifact) {
|
|
174
|
+
throw new errors.BotpressCLIError("Could not read bot definition");
|
|
175
|
+
}
|
|
176
|
+
const { default: definition } = utils.require.requireJsCode(artifact.text);
|
|
177
|
+
return (0, import_sdk.resolveBotInterfaces)(definition);
|
|
161
178
|
}
|
|
162
179
|
displayWebhookUrls(bot) {
|
|
163
180
|
if (!import_lodash.default.keys(bot.integrations).length) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/command-implementations/project-command.ts"],
|
|
4
|
-
"sourcesContent": ["import type * as client from '@botpress/client'\nimport type * as sdk from '@botpress/sdk'\nimport type { YargsConfig } from '@bpinternal/yargs-extra'\nimport bluebird from 'bluebird'\nimport chalk from 'chalk'\nimport fs from 'fs'\nimport _ from 'lodash'\nimport pathlib from 'path'\nimport semver from 'semver'\nimport { ApiClient } from '../api/client'\nimport * as codegen from '../code-generation'\nimport type * as config from '../config'\nimport * as consts from '../consts'\nimport * as errors from '../errors'\nimport { formatIntegrationRef, IntegrationRef } from '../integration-ref'\nimport { validateIntegrationDefinition } from '../sdk/validate-integration'\nimport type { CommandArgv, CommandDefinition } from '../typings'\nimport * as utils from '../utils'\nimport { GlobalCommand } from './global-command'\n\nexport type ProjectCommandDefinition = CommandDefinition<typeof config.schemas.project>\nexport type ProjectCache = { botId: string; devId: string }\n\ntype ConfigurableProjectPaths = { entryPoint: string; outDir: string; workDir: string }\ntype ConstantProjectPaths = typeof consts.fromOutDir & typeof consts.fromWorkDir\ntype AllProjectPaths = ConfigurableProjectPaths & ConstantProjectPaths\n\ntype RemoteIntegrationInstance = utils.types.Merge<sdk.IntegrationInstance<any>, { id: string }>\ntype LocalIntegrationInstance = utils.types.Merge<sdk.IntegrationInstance<any>, { id: null }>\n\nexport type ProjectType = ProjectDefinition['type']\nexport type ProjectDefinition =\n | { type: 'integration'; definition: sdk.IntegrationDefinition }\n | { type: 'interface'; definition: sdk.InterfaceDeclaration }\n | { type: 'bot'; definition: null }\n\nclass ProjectPaths extends utils.path.PathStore<keyof AllProjectPaths> {\n public constructor(argv: CommandArgv<ProjectCommandDefinition>) {\n const absWorkDir = utils.path.absoluteFrom(utils.path.cwd(), argv.workDir)\n const absEntrypoint = utils.path.absoluteFrom(absWorkDir, argv.entryPoint)\n const absOutDir = utils.path.absoluteFrom(absWorkDir, argv.outDir)\n super({\n workDir: absWorkDir,\n entryPoint: absEntrypoint,\n outDir: absOutDir,\n ..._.mapValues(consts.fromOutDir, (p) => utils.path.absoluteFrom(absOutDir, p)),\n ..._.mapValues(consts.fromWorkDir, (p) => utils.path.absoluteFrom(absWorkDir, p)),\n })\n }\n}\n\nexport abstract class ProjectCommand<C extends ProjectCommandDefinition> extends GlobalCommand<C> {\n protected override async bootstrap() {\n await super.bootstrap()\n await this._notifyUpdateSdk()\n }\n\n protected get projectPaths() {\n return new ProjectPaths(this.argv)\n }\n\n protected get projectCache() {\n return new utils.cache.FSKeyValueCache<ProjectCache>(this.projectPaths.abs.projectCacheFile)\n }\n\n protected async fetchBotIntegrationInstances(bot: sdk.Bot, api: ApiClient) {\n const integrationList = _(bot.props.integrations).values().filter(utils.guards.is.defined).value()\n\n const { remoteInstances, localInstances } = this._splitApiAndLocalIntegrationInstances(integrationList)\n\n const fetchedInstances: RemoteIntegrationInstance[] = await bluebird.map(localInstances, async (instance) => {\n const ref: IntegrationRef = { type: 'name', name: instance.name, version: instance.version }\n const integration = await api.findIntegration(ref)\n if (!integration) {\n const formattedRef = formatIntegrationRef(ref)\n throw new errors.BotpressCLIError(`Integration \"${formattedRef}\" not found`)\n }\n return { ...instance, id: integration.id }\n })\n\n return _([...fetchedInstances, ...remoteInstances])\n .keyBy((i) => i.id)\n .mapValues(({ enabled, configurationType, configuration }) => ({\n enabled,\n configurationType: configurationType ?? null,\n configuration,\n }))\n .value()\n }\n\n private _splitApiAndLocalIntegrationInstances(instances: sdk.IntegrationInstance<any>[]): {\n remoteInstances: RemoteIntegrationInstance[]\n localInstances: LocalIntegrationInstance[]\n } {\n const remoteInstances: RemoteIntegrationInstance[] = []\n const localInstances: LocalIntegrationInstance[] = []\n for (const { id, ...instance } of instances) {\n if (id) {\n remoteInstances.push({ ...instance, id })\n } else {\n localInstances.push({ ...instance, id: null })\n }\n }\n\n return { remoteInstances, localInstances }\n }\n\n protected async readProjectDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'integrationDefinition' | 'interfaceDefinition'> = this.projectPaths\n ): Promise<ProjectDefinition> {\n try {\n const integrationDefinition = await this._readIntegrationDefinitionFromFS(projectPaths)\n if (integrationDefinition) {\n return { type: 'integration', definition: integrationDefinition }\n }\n const interfaceDefinition = await this._readInterfaceDefinitionFromFS(projectPaths)\n if (interfaceDefinition) {\n return { type: 'interface', definition: interfaceDefinition }\n }\n return { type: 'bot', definition: null }\n } catch (thrown: unknown) {\n throw errors.BotpressCLIError.wrap(thrown, 'Error while reading project definition')\n }\n }\n\n private async _readIntegrationDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'integrationDefinition'> = this.projectPaths\n ): Promise<sdk.IntegrationDefinition | undefined> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.integrationDefinition)) {\n return\n }\n\n const { outputFiles } = await utils.esbuild.buildEntrypoint({\n cwd: abs.workDir,\n outfile: '',\n entrypoint: rel.integrationDefinition,\n write: false,\n minify: false,\n })\n\n const artifact = outputFiles[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read integration definition')\n }\n\n const { default: definition } = utils.require.requireJsCode<{ default: sdk.IntegrationDefinition }>(artifact.text)\n\n validateIntegrationDefinition(definition)\n\n return definition\n }\n\n private async _readInterfaceDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'interfaceDefinition'> = this.projectPaths\n ): Promise<sdk.InterfaceDeclaration | undefined> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.interfaceDefinition)) {\n return\n }\n\n const { outputFiles } = await utils.esbuild.buildEntrypoint({\n cwd: abs.workDir,\n outfile: '',\n entrypoint: rel.interfaceDefinition,\n write: false,\n minify: false,\n })\n\n const artifact = outputFiles[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read interface definition')\n }\n\n const { default: definition } = utils.require.requireJsCode<{ default: sdk.InterfaceDeclaration }>(artifact.text)\n\n return definition\n }\n\n protected async writeGeneratedFilesToOutFolder(files: codegen.File[]) {\n for (const file of files) {\n const filePath = utils.path.absoluteFrom(this.projectPaths.abs.outDir, file.path)\n const dirPath = pathlib.dirname(filePath)\n await fs.promises.mkdir(dirPath, { recursive: true })\n await fs.promises.writeFile(filePath, file.content)\n }\n }\n\n protected displayWebhookUrls(bot: client.Bot) {\n if (!_.keys(bot.integrations).length) {\n this.logger.debug('No integrations in bot')\n return\n }\n\n this.logger.log('Integrations:')\n for (const integration of Object.values(bot.integrations).filter(utils.guards.is.defined)) {\n if (!integration.enabled) {\n this.logger.log(`${chalk.grey(integration.name)} ${chalk.italic('(disabled)')}: ${integration.webhookUrl}`, {\n prefix: { symbol: '\u25CB', indent: 2 },\n })\n } else {\n this.logger.log(`${chalk.bold(integration.name)} : ${integration.webhookUrl}`, {\n prefix: { symbol: '\u25CF', indent: 2 },\n })\n }\n }\n }\n\n protected async promptSecrets(\n integrationDef: sdk.IntegrationDefinition,\n argv: YargsConfig<typeof config.schemas.secrets>,\n opts: { formatEnv?: boolean; knownSecrets?: string[] } = {}\n ): Promise<Record<string, string | null>> {\n const formatEnv = opts.formatEnv ?? false\n const knownSecrets = opts.knownSecrets ?? []\n\n const { secrets: secretDefinitions } = integrationDef\n if (!secretDefinitions) {\n return {}\n }\n\n const secretArgv = this._parseArgvSecrets(argv.secrets)\n const invalidSecret = Object.keys(secretArgv).find((s) => !secretDefinitions[s])\n if (invalidSecret) {\n throw new errors.BotpressCLIError(`Secret ${invalidSecret} is not defined in integration definition`)\n }\n\n const values: Record<string, string | null> = {}\n for (const [secretName, { optional }] of Object.entries(secretDefinitions)) {\n const argvSecret = secretArgv[secretName]\n if (argvSecret) {\n this.logger.debug(`Using secret \"${secretName}\" from argv`)\n values[secretName] = argvSecret\n continue\n }\n\n const alreadyKnown = knownSecrets.includes(secretName)\n let mode: string\n if (alreadyKnown) {\n mode = 'already set'\n } else if (optional) {\n mode = 'optional'\n } else {\n mode = 'required'\n }\n\n const prompted = await this.prompt.text(`Enter value for secret \"${secretName}\" (${mode})`)\n if (prompted) {\n values[secretName] = prompted\n continue\n }\n\n if (alreadyKnown) {\n this.logger.log(`Secret \"${secretName}\" is unchanged`)\n } else if (optional) {\n this.logger.warn(`Secret \"${secretName}\" is unassigned`)\n } else {\n throw new errors.BotpressCLIError(`Secret \"${secretName}\" is required`)\n }\n }\n\n for (const secretName of knownSecrets) {\n const isDefined = secretName in secretDefinitions\n if (isDefined) {\n continue\n }\n const prompted = await this.prompt.confirm(`Secret \"${secretName}\" was removed. Do you wish to delete it?`)\n if (prompted) {\n this.logger.log(`Deleting secret \"${secretName}\"`, { prefix: { symbol: '\u00D7', fg: 'red' } })\n values[secretName] = null\n }\n }\n\n if (!formatEnv) {\n return values\n }\n\n const envVariables = _.mapKeys(values, (_v, k) => codegen.secretEnvVariableName(k))\n return envVariables\n }\n\n protected async readIntegrationConfigDefinition<C extends client.ClientInputs['createIntegration']['configuration']>(\n config: C\n ): Promise<C> {\n if (!config?.identifier) {\n return config\n }\n return {\n ...config,\n identifier: {\n ...config.identifier,\n linkTemplateScript: await this.readProjectFile(config.identifier.linkTemplateScript),\n },\n }\n }\n\n protected readProjectFile = async (filePath: string | undefined): Promise<string | undefined> => {\n if (!filePath) {\n return undefined\n }\n const absoluteFilePath = utils.path.absoluteFrom(this.projectPaths.abs.workDir, filePath)\n return fs.promises.readFile(absoluteFilePath, 'utf-8').catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not read file \"${absoluteFilePath}\"`)\n })\n }\n\n private _parseArgvSecrets(argvSecrets: string[]): Record<string, string> {\n const parsed: Record<string, string> = {}\n for (const secret of argvSecrets) {\n const [key, value] = utils.string.splitOnce(secret, '=')\n if (!value) {\n throw new errors.BotpressCLIError(\n `Secret \"${key}\" is missing a value. Expected format: \"SECRET_NAME=secretValue\"`\n )\n }\n parsed[key!] = value\n }\n\n return parsed\n }\n\n private _notifyUpdateSdk = async (): Promise<void> => {\n try {\n this.logger.debug('Checking if sdk is up to date')\n\n const { workDir } = this.projectPaths.abs\n const projectPkgJson = await utils.pkgJson.readPackageJson(workDir)\n if (!projectPkgJson) {\n this.logger.debug(`Could not find package.json at \"${workDir}\"`)\n return\n }\n\n const sdkPackageName = '@botpress/sdk'\n const actualSdkVersion = utils.pkgJson.findDependency(projectPkgJson, sdkPackageName)\n if (!actualSdkVersion) {\n this.logger.debug(`Could not find dependency \"${sdkPackageName}\" in project package.json`)\n return\n }\n\n if (actualSdkVersion.startsWith('workspace:')) {\n return\n }\n\n const actualCleanedSdkVersion = semver.valid(semver.coerce(actualSdkVersion))\n if (!actualCleanedSdkVersion) {\n this.logger.debug(`Invalid sdk version \"${actualSdkVersion}\" in project package.json`)\n return\n }\n\n const cliPkgJson = await this.readPkgJson()\n const expectedSdkVersion = utils.pkgJson.findDependency(cliPkgJson, sdkPackageName)\n if (!expectedSdkVersion) {\n this.logger.debug(`Could not find dependency \"${sdkPackageName}\" in cli package.json`)\n return\n }\n\n const expectedCleanedSdkVersion = semver.valid(semver.coerce(expectedSdkVersion))\n if (!expectedCleanedSdkVersion) {\n this.logger.debug(`Invalid sdk version \"${expectedSdkVersion}\" in cli package.json`)\n return\n }\n\n if (semver.eq(actualCleanedSdkVersion, expectedCleanedSdkVersion)) {\n return\n }\n\n const diff = semver.diff(actualCleanedSdkVersion, expectedCleanedSdkVersion)\n if (!diff) {\n this.logger.debug(`Could not compare versions \"${actualCleanedSdkVersion}\" and \"${expectedCleanedSdkVersion}\"`)\n return\n }\n\n const errorMsg = `Project SDK version is \"${actualCleanedSdkVersion}\", but expected \"${expectedCleanedSdkVersion}\"`\n if (utils.semver.releases.lt(diff, 'minor')) {\n this.logger.debug(`${errorMsg}. This may cause compatibility issues.`)\n return\n }\n\n this.logger.warn(chalk.bold(`${errorMsg}. This will cause compatibility issues.`))\n } catch (thrown) {\n const err = errors.BotpressCLIError.map(thrown)\n this.logger.debug(`Failed to check if sdk is up to date: ${err.message}`)\n }\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAqB;AACrB,mBAAkB;AAClB,gBAAe;AACf,oBAAc;AACd,
|
|
6
|
-
"names": ["_", "bluebird", "fs", "
|
|
4
|
+
"sourcesContent": ["import type * as client from '@botpress/client'\nimport type * as sdk from '@botpress/sdk'\nimport type { YargsConfig } from '@bpinternal/yargs-extra'\nimport bluebird from 'bluebird'\nimport chalk from 'chalk'\nimport fs from 'fs'\nimport _ from 'lodash'\nimport semver from 'semver'\nimport { ApiClient } from '../api/client'\nimport * as codegen from '../code-generation'\nimport type * as config from '../config'\nimport * as consts from '../consts'\nimport * as errors from '../errors'\nimport { formatPackageRef, PackageRef } from '../package-ref'\nimport { validateIntegrationDefinition, resolveInterfaces, resolveBotInterfaces } from '../sdk'\nimport type { CommandArgv, CommandDefinition } from '../typings'\nimport * as utils from '../utils'\nimport { GlobalCommand } from './global-command'\n\nexport type ProjectCommandDefinition = CommandDefinition<typeof config.schemas.project>\nexport type ProjectCache = { botId: string; devId: string }\n\ntype ConfigurableProjectPaths = { entryPoint: string; outDir: string; workDir: string }\ntype ConstantProjectPaths = typeof consts.fromOutDir & typeof consts.fromWorkDir\ntype AllProjectPaths = ConfigurableProjectPaths & ConstantProjectPaths\n\ntype IntegrationInstance = NonNullable<sdk.BotDefinition['integrations']>[string]\ntype RemoteIntegrationInstance = utils.types.Merge<IntegrationInstance, { id: string }>\ntype LocalIntegrationInstance = utils.types.Merge<IntegrationInstance, { uri?: string }>\ntype BotIntegrationRequest = NonNullable<NonNullable<client.ClientInputs['updateBot']['integrations']>[string]>\n\nexport type ProjectType = ProjectDefinition['type']\nexport type ProjectDefinition =\n | { type: 'integration'; definition: sdk.IntegrationDefinition }\n | { type: 'interface'; definition: sdk.InterfaceDeclaration }\n | { type: 'bot'; definition: sdk.BotDefinition }\n\nclass ProjectPaths extends utils.path.PathStore<keyof AllProjectPaths> {\n public constructor(argv: CommandArgv<ProjectCommandDefinition>) {\n const absWorkDir = utils.path.absoluteFrom(utils.path.cwd(), argv.workDir)\n const absEntrypoint = utils.path.absoluteFrom(absWorkDir, argv.entryPoint)\n const absOutDir = utils.path.absoluteFrom(absWorkDir, argv.outDir)\n super({\n workDir: absWorkDir,\n entryPoint: absEntrypoint,\n outDir: absOutDir,\n ..._.mapValues(consts.fromOutDir, (p) => utils.path.absoluteFrom(absOutDir, p)),\n ..._.mapValues(consts.fromWorkDir, (p) => utils.path.absoluteFrom(absWorkDir, p)),\n })\n }\n}\n\nexport abstract class ProjectCommand<C extends ProjectCommandDefinition> extends GlobalCommand<C> {\n protected override async bootstrap() {\n await super.bootstrap()\n await this._notifyUpdateSdk()\n }\n\n protected get projectPaths() {\n return new ProjectPaths(this.argv)\n }\n\n protected get projectCache() {\n return new utils.cache.FSKeyValueCache<ProjectCache>(this.projectPaths.abs.projectCacheFile)\n }\n\n protected async fetchBotIntegrationInstances(\n botDefinition: sdk.BotDefinition,\n api: ApiClient\n ): Promise<Record<string, BotIntegrationRequest>> {\n const integrationList = _(botDefinition.integrations).values().filter(utils.guards.is.defined).value()\n\n const { remoteInstances, localInstances } = this._splitApiAndLocalIntegrationInstances(integrationList)\n\n const fetchedInstances: RemoteIntegrationInstance[] = await bluebird.map(localInstances, async (instance) => {\n const ref: PackageRef = { type: 'name', name: instance.definition.name, version: instance.definition.version }\n const integration = await api.findIntegration(ref)\n if (!integration) {\n const formattedRef = formatPackageRef(ref)\n throw new errors.BotpressCLIError(`Integration \"${formattedRef}\" not found`)\n }\n return { ...instance, id: integration.id }\n })\n\n return _([...fetchedInstances, ...remoteInstances])\n .keyBy((i) => i.id)\n .mapValues(({ enabled, configurationType, configuration }) => ({\n enabled,\n configurationType: configurationType ?? null,\n configuration,\n }))\n .value()\n }\n\n private _splitApiAndLocalIntegrationInstances(instances: IntegrationInstance[]): {\n remoteInstances: RemoteIntegrationInstance[]\n localInstances: LocalIntegrationInstance[]\n } {\n const remoteInstances: RemoteIntegrationInstance[] = []\n const localInstances: LocalIntegrationInstance[] = []\n for (const instance of instances) {\n if ('id' in instance) {\n remoteInstances.push(instance)\n } else {\n localInstances.push(instance)\n }\n }\n\n return { remoteInstances, localInstances }\n }\n\n protected async readProjectDefinitionFromFS(): Promise<ProjectDefinition> {\n const projectPaths = this.projectPaths\n try {\n const integrationDefinition = await this._readIntegrationDefinitionFromFS(projectPaths)\n if (integrationDefinition) {\n return { type: 'integration', definition: integrationDefinition }\n }\n const interfaceDefinition = await this._readInterfaceDefinitionFromFS(projectPaths)\n if (interfaceDefinition) {\n return { type: 'interface', definition: interfaceDefinition }\n }\n const botDefinition = await this._readBotDefinitionFromFS(projectPaths)\n if (botDefinition) {\n return { type: 'bot', definition: botDefinition }\n }\n } catch (thrown: unknown) {\n throw errors.BotpressCLIError.wrap(thrown, 'Error while reading project definition')\n }\n\n throw new errors.ProjectDefinitionNotFoundError(this.projectPaths.abs.workDir)\n }\n\n private async _readIntegrationDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'integrationDefinition'>\n ): Promise<sdk.IntegrationDefinition | undefined> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.integrationDefinition)) {\n return\n }\n\n const { outputFiles } = await utils.esbuild.buildEntrypoint({\n cwd: abs.workDir,\n outfile: '',\n entrypoint: rel.integrationDefinition,\n write: false,\n minify: false,\n })\n\n const artifact = outputFiles[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read integration definition')\n }\n\n let { default: definition } = utils.require.requireJsCode<{ default: sdk.IntegrationDefinition }>(artifact.text)\n definition = resolveInterfaces(definition)\n validateIntegrationDefinition(definition)\n return definition\n }\n\n private async _readInterfaceDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'interfaceDefinition'>\n ): Promise<sdk.InterfaceDeclaration | undefined> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.interfaceDefinition)) {\n return\n }\n\n const { outputFiles } = await utils.esbuild.buildEntrypoint({\n cwd: abs.workDir,\n outfile: '',\n entrypoint: rel.interfaceDefinition,\n write: false,\n minify: false,\n })\n\n const artifact = outputFiles[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read interface definition')\n }\n\n const { default: definition } = utils.require.requireJsCode<{ default: sdk.InterfaceDeclaration }>(artifact.text)\n\n return definition\n }\n\n private async _readBotDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'botDefinition'>\n ): Promise<sdk.BotDefinition | undefined> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.botDefinition)) {\n return\n }\n\n const { outputFiles } = await utils.esbuild.buildEntrypoint({\n cwd: abs.workDir,\n outfile: '',\n entrypoint: rel.botDefinition,\n write: false,\n minify: false,\n })\n\n const artifact = outputFiles[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read bot definition')\n }\n\n const { default: definition } = utils.require.requireJsCode<{ default: sdk.BotDefinition }>(artifact.text)\n // TODO: validate bot definition\n return resolveBotInterfaces(definition)\n }\n\n protected displayWebhookUrls(bot: client.Bot) {\n if (!_.keys(bot.integrations).length) {\n this.logger.debug('No integrations in bot')\n return\n }\n\n this.logger.log('Integrations:')\n for (const integration of Object.values(bot.integrations).filter(utils.guards.is.defined)) {\n if (!integration.enabled) {\n this.logger.log(`${chalk.grey(integration.name)} ${chalk.italic('(disabled)')}: ${integration.webhookUrl}`, {\n prefix: { symbol: '\u25CB', indent: 2 },\n })\n } else {\n this.logger.log(`${chalk.bold(integration.name)} : ${integration.webhookUrl}`, {\n prefix: { symbol: '\u25CF', indent: 2 },\n })\n }\n }\n }\n\n protected async promptSecrets(\n integrationDef: sdk.IntegrationDefinition,\n argv: YargsConfig<typeof config.schemas.secrets>,\n opts: { formatEnv?: boolean; knownSecrets?: string[] } = {}\n ): Promise<Record<string, string | null>> {\n const formatEnv = opts.formatEnv ?? false\n const knownSecrets = opts.knownSecrets ?? []\n\n const { secrets: secretDefinitions } = integrationDef\n if (!secretDefinitions) {\n return {}\n }\n\n const secretArgv = this._parseArgvSecrets(argv.secrets)\n const invalidSecret = Object.keys(secretArgv).find((s) => !secretDefinitions[s])\n if (invalidSecret) {\n throw new errors.BotpressCLIError(`Secret ${invalidSecret} is not defined in integration definition`)\n }\n\n const values: Record<string, string | null> = {}\n for (const [secretName, { optional }] of Object.entries(secretDefinitions)) {\n const argvSecret = secretArgv[secretName]\n if (argvSecret) {\n this.logger.debug(`Using secret \"${secretName}\" from argv`)\n values[secretName] = argvSecret\n continue\n }\n\n const alreadyKnown = knownSecrets.includes(secretName)\n let mode: string\n if (alreadyKnown) {\n mode = 'already set'\n } else if (optional) {\n mode = 'optional'\n } else {\n mode = 'required'\n }\n\n const prompted = await this.prompt.text(`Enter value for secret \"${secretName}\" (${mode})`)\n if (prompted) {\n values[secretName] = prompted\n continue\n }\n\n if (alreadyKnown) {\n this.logger.log(`Secret \"${secretName}\" is unchanged`)\n } else if (optional) {\n this.logger.warn(`Secret \"${secretName}\" is unassigned`)\n } else {\n throw new errors.BotpressCLIError(`Secret \"${secretName}\" is required`)\n }\n }\n\n for (const secretName of knownSecrets) {\n const isDefined = secretName in secretDefinitions\n if (isDefined) {\n continue\n }\n const prompted = await this.prompt.confirm(`Secret \"${secretName}\" was removed. Do you wish to delete it?`)\n if (prompted) {\n this.logger.log(`Deleting secret \"${secretName}\"`, { prefix: { symbol: '\u00D7', fg: 'red' } })\n values[secretName] = null\n }\n }\n\n if (!formatEnv) {\n return values\n }\n\n const envVariables = _.mapKeys(values, (_v, k) => codegen.secretEnvVariableName(k))\n return envVariables\n }\n\n protected async readIntegrationConfigDefinition<C extends client.ClientInputs['createIntegration']['configuration']>(\n config: C\n ): Promise<C> {\n if (!config?.identifier) {\n return config\n }\n return {\n ...config,\n identifier: {\n ...config.identifier,\n linkTemplateScript: await this.readProjectFile(config.identifier.linkTemplateScript),\n },\n }\n }\n\n protected readProjectFile = async (filePath: string | undefined): Promise<string | undefined> => {\n if (!filePath) {\n return undefined\n }\n const absoluteFilePath = utils.path.absoluteFrom(this.projectPaths.abs.workDir, filePath)\n return fs.promises.readFile(absoluteFilePath, 'utf-8').catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not read file \"${absoluteFilePath}\"`)\n })\n }\n\n private _parseArgvSecrets(argvSecrets: string[]): Record<string, string> {\n const parsed: Record<string, string> = {}\n for (const secret of argvSecrets) {\n const [key, value] = utils.string.splitOnce(secret, '=')\n if (!value) {\n throw new errors.BotpressCLIError(\n `Secret \"${key}\" is missing a value. Expected format: \"SECRET_NAME=secretValue\"`\n )\n }\n parsed[key!] = value\n }\n\n return parsed\n }\n\n private _notifyUpdateSdk = async (): Promise<void> => {\n try {\n this.logger.debug('Checking if sdk is up to date')\n\n const { workDir } = this.projectPaths.abs\n const projectPkgJson = await utils.pkgJson.readPackageJson(workDir)\n if (!projectPkgJson) {\n this.logger.debug(`Could not find package.json at \"${workDir}\"`)\n return\n }\n\n const sdkPackageName = '@botpress/sdk'\n const actualSdkVersion = utils.pkgJson.findDependency(projectPkgJson, sdkPackageName)\n if (!actualSdkVersion) {\n this.logger.debug(`Could not find dependency \"${sdkPackageName}\" in project package.json`)\n return\n }\n\n if (actualSdkVersion.startsWith('workspace:')) {\n return\n }\n\n const actualCleanedSdkVersion = semver.valid(semver.coerce(actualSdkVersion))\n if (!actualCleanedSdkVersion) {\n this.logger.debug(`Invalid sdk version \"${actualSdkVersion}\" in project package.json`)\n return\n }\n\n const cliPkgJson = await this.readPkgJson()\n const expectedSdkVersion = utils.pkgJson.findDependency(cliPkgJson, sdkPackageName)\n if (!expectedSdkVersion) {\n this.logger.debug(`Could not find dependency \"${sdkPackageName}\" in cli package.json`)\n return\n }\n\n const expectedCleanedSdkVersion = semver.valid(semver.coerce(expectedSdkVersion))\n if (!expectedCleanedSdkVersion) {\n this.logger.debug(`Invalid sdk version \"${expectedSdkVersion}\" in cli package.json`)\n return\n }\n\n if (semver.eq(actualCleanedSdkVersion, expectedCleanedSdkVersion)) {\n return\n }\n\n const diff = semver.diff(actualCleanedSdkVersion, expectedCleanedSdkVersion)\n if (!diff) {\n this.logger.debug(`Could not compare versions \"${actualCleanedSdkVersion}\" and \"${expectedCleanedSdkVersion}\"`)\n return\n }\n\n const errorMsg = `Project SDK version is \"${actualCleanedSdkVersion}\", but expected \"${expectedCleanedSdkVersion}\"`\n if (utils.semver.releases.lt(diff, 'minor')) {\n this.logger.debug(`${errorMsg}. This may cause compatibility issues.`)\n return\n }\n\n this.logger.warn(chalk.bold(`${errorMsg}. This will cause compatibility issues.`))\n } catch (thrown) {\n const err = errors.BotpressCLIError.map(thrown)\n this.logger.debug(`Failed to check if sdk is up to date: ${err.message}`)\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAqB;AACrB,mBAAkB;AAClB,gBAAe;AACf,oBAAc;AACd,oBAAmB;AAEnB,cAAyB;AAEzB,aAAwB;AACxB,aAAwB;AACxB,yBAA6C;AAC7C,iBAAuF;AAEvF,YAAuB;AACvB,4BAA8B;AAoB9B,MAAM,qBAAqB,MAAM,KAAK,UAAiC;AAAA,EAC9D,YAAY,MAA6C;AAC9D,UAAM,aAAa,MAAM,KAAK,aAAa,MAAM,KAAK,IAAI,GAAG,KAAK,OAAO;AACzE,UAAM,gBAAgB,MAAM,KAAK,aAAa,YAAY,KAAK,UAAU;AACzE,UAAM,YAAY,MAAM,KAAK,aAAa,YAAY,KAAK,MAAM;AACjE,UAAM;AAAA,MACJ,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,GAAG,cAAAA,QAAE,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C;AAAA,MACF;AAEA,YAAM,0BAA0B,cAAAE,QAAO,MAAM,cAAAA,QAAO,OAAO,gBAAgB,CAAC;AAC5E,UAAI,CAAC,yBAAyB;AAC5B,aAAK,OAAO,MAAM,wBAAwB,2CAA2C;AACrF;AAAA,MACF;AAEA,YAAM,aAAa,MAAM,KAAK,YAAY;AAC1C,YAAM,qBAAqB,MAAM,QAAQ,eAAe,YAAY,cAAc;AAClF,UAAI,CAAC,oBAAoB;AACvB,aAAK,OAAO,MAAM,8BAA8B,qCAAqC;AACrF;AAAA,MACF;AAEA,YAAM,4BAA4B,cAAAA,QAAO,MAAM,cAAAA,QAAO,OAAO,kBAAkB,CAAC;AAChF,UAAI,CAAC,2BAA2B;AAC9B,aAAK,OAAO,MAAM,wBAAwB,yCAAyC;AACnF;AAAA,MACF;AAEA,UAAI,cAAAA,QAAO,GAAG,yBAAyB,yBAAyB,GAAG;AACjE;AAAA,MACF;AAEA,YAAM,OAAO,cAAAA,QAAO,KAAK,yBAAyB,yBAAyB;AAC3E,UAAI,CAAC,MAAM;AACT,aAAK,OAAO,MAAM,+BAA+B,iCAAiC,4BAA4B;AAC9G;AAAA,MACF;AAEA,YAAM,WAAW,2BAA2B,2CAA2C;AACvF,UAAI,MAAM,OAAO,SAAS,GAAG,MAAM,OAAO,GAAG;AAC3C,aAAK,OAAO,MAAM,GAAG,gDAAgD;AACrE;AAAA,MACF;AAEA,WAAK,OAAO,KAAK,aAAAD,QAAM,KAAK,GAAG,iDAAiD,CAAC;AAAA,IACnF,SAAS,QAAP;AACA,YAAM,MAAM,OAAO,iBAAiB,IAAI,MAAM;AAC9C,WAAK,OAAO,MAAM,yCAAyC,IAAI,SAAS;AAAA,IAC1E;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["_", "bluebird", "fs", "chalk", "semver"]
|
|
7
7
|
}
|
|
@@ -30,17 +30,12 @@ module.exports = __toCommonJS(read_command_exports);
|
|
|
30
30
|
var import_integration_body = require("../api/integration-body");
|
|
31
31
|
var import_interface_body = require("../api/interface-body");
|
|
32
32
|
var errors = __toESM(require("../errors"));
|
|
33
|
-
var utils = __toESM(require("../utils"));
|
|
34
33
|
var import_project_command = require("./project-command");
|
|
35
34
|
class ReadCommand extends import_project_command.ProjectCommand {
|
|
36
35
|
async run() {
|
|
37
36
|
const projectDef = await this.readProjectDefinitionFromFS();
|
|
38
37
|
if (projectDef.type === "integration") {
|
|
39
38
|
const parsed = await (0, import_integration_body.prepareCreateIntegrationBody)(projectDef.definition);
|
|
40
|
-
parsed.interfaces = utils.records.mapValues(projectDef.definition.interfaces, (iface) => ({
|
|
41
|
-
id: "...",
|
|
42
|
-
...iface
|
|
43
|
-
}));
|
|
44
39
|
this.logger.json(parsed);
|
|
45
40
|
return;
|
|
46
41
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/command-implementations/read-command.ts"],
|
|
4
|
-
"sourcesContent": ["import { prepareCreateIntegrationBody } from '../api/integration-body'\nimport { prepareCreateInterfaceBody } from '../api/interface-body'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAA6C;AAC7C,4BAA2C;AAE3C,aAAwB;AACxB,
|
|
4
|
+
"sourcesContent": ["import { prepareCreateIntegrationBody } from '../api/integration-body'\nimport { prepareCreateInterfaceBody } from '../api/interface-body'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport { ProjectCommand } from './project-command'\n\nexport type ReadCommandDefinition = typeof commandDefinitions.read\nexport class ReadCommand extends ProjectCommand<ReadCommandDefinition> {\n public async run(): Promise<void> {\n const projectDef = await this.readProjectDefinitionFromFS()\n if (projectDef.type === 'integration') {\n const parsed = await prepareCreateIntegrationBody(projectDef.definition)\n // TODO: maybe display interface implementation statements here\n this.logger.json(parsed)\n return\n }\n if (projectDef.type === 'interface') {\n const parsed = await prepareCreateInterfaceBody(projectDef.definition)\n this.logger.json(parsed)\n return\n }\n\n throw new errors.BotpressCLIError('A bot project has no definition to read')\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAA6C;AAC7C,4BAA2C;AAE3C,aAAwB;AACxB,6BAA+B;AAGxB,MAAM,oBAAoB,sCAAsC;AAAA,EACrE,MAAa,MAAqB;AAChC,UAAM,aAAa,MAAM,KAAK,4BAA4B;AAC1D,QAAI,WAAW,SAAS,eAAe;AACrC,YAAM,SAAS,UAAM,sDAA6B,WAAW,UAAU;AAEvE,WAAK,OAAO,KAAK,MAAM;AACvB;AAAA,IACF;AACA,QAAI,WAAW,SAAS,aAAa;AACnC,YAAM,SAAS,UAAM,kDAA2B,WAAW,UAAU;AACrE,WAAK,OAAO,KAAK,MAAM;AACvB;AAAA,IACF;AAEA,UAAM,IAAI,OAAO,iBAAiB,yCAAyC;AAAA,EAC7E;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/config.js
CHANGED
|
@@ -35,7 +35,7 @@ const port = {
|
|
|
35
35
|
const workDir = {
|
|
36
36
|
type: "string",
|
|
37
37
|
description: "The path to the project",
|
|
38
|
-
default:
|
|
38
|
+
default: consts.defaultWorkDir
|
|
39
39
|
};
|
|
40
40
|
const noBuild = {
|
|
41
41
|
type: "boolean",
|
|
@@ -67,16 +67,25 @@ const botRef = {
|
|
|
67
67
|
positional: true,
|
|
68
68
|
idx: 0
|
|
69
69
|
};
|
|
70
|
-
const
|
|
70
|
+
const packageType = {
|
|
71
|
+
type: "string",
|
|
72
|
+
description: "Either an integration or an interface; helps disambiguate the package type in case both an integration and an interface have the same reference.",
|
|
73
|
+
choices: ["integration", "interface"]
|
|
74
|
+
};
|
|
75
|
+
const packageRef = {
|
|
71
76
|
type: "string",
|
|
72
|
-
description: "The
|
|
77
|
+
description: "The package ID or name with optional version. The package can be either an integration or an interface. Ex: teams, teams@0.2.0, llm@5.1.0",
|
|
73
78
|
demandOption: true,
|
|
74
79
|
positional: true,
|
|
75
80
|
idx: 0
|
|
76
81
|
};
|
|
82
|
+
const integrationRef = {
|
|
83
|
+
...packageRef,
|
|
84
|
+
description: "The integration ID or name with optional version. Ex: teams or teams@0.2.0"
|
|
85
|
+
};
|
|
77
86
|
const interfaceRef = {
|
|
78
|
-
...
|
|
79
|
-
description: "The interface ID or name
|
|
87
|
+
...packageRef,
|
|
88
|
+
description: "The interface ID or name and version. Ex: llm@5.1.0"
|
|
80
89
|
};
|
|
81
90
|
const sourceMap = { type: "boolean", description: "Generate sourcemaps", default: false };
|
|
82
91
|
const minify = { type: "boolean", description: "Minify the bundled code", default: true };
|
|
@@ -179,9 +188,15 @@ const devSchema = {
|
|
|
179
188
|
}
|
|
180
189
|
};
|
|
181
190
|
const addSchema = {
|
|
182
|
-
...
|
|
191
|
+
...globalSchema,
|
|
183
192
|
...credentialsSchema,
|
|
184
|
-
|
|
193
|
+
packageRef,
|
|
194
|
+
packageType,
|
|
195
|
+
installPath: {
|
|
196
|
+
type: "string",
|
|
197
|
+
description: "The path where to install the integration",
|
|
198
|
+
default: consts.defaultInstallPath
|
|
199
|
+
}
|
|
185
200
|
};
|
|
186
201
|
const loginSchema = {
|
|
187
202
|
...globalSchema,
|
package/dist/config.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/config.ts"],
|
|
4
|
-
"sourcesContent": ["import * as consts from './consts'\nimport type { CommandOption, CommandSchema } from './typings'\n\n// command options\n\nconst port = {\n type: 'number',\n description: 'The port to use',\n} satisfies CommandOption\n\nconst workDir = {\n type: 'string',\n description: 'The path to the project',\n default:
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AAKxB,MAAM,OAAO;AAAA,EACX,MAAM;AAAA,EACN,aAAa;AACf;AAEA,MAAM,UAAU;AAAA,EACd,MAAM;AAAA,EACN,aAAa;AAAA,EACb,SAAS,
|
|
4
|
+
"sourcesContent": ["import * as consts from './consts'\nimport type { CommandOption, CommandSchema } from './typings'\n\n// command options\n\nconst port = {\n type: 'number',\n description: 'The port to use',\n} satisfies CommandOption\n\nconst workDir = {\n type: 'string',\n description: 'The path to the project',\n default: consts.defaultWorkDir,\n} satisfies CommandOption\n\nconst noBuild = {\n type: 'boolean',\n description: 'Skip the build step',\n default: false,\n} satisfies CommandOption\n\nconst apiUrl = {\n type: 'string',\n description: 'The URL of the Botpress server',\n} satisfies CommandOption\n\nconst token = {\n type: 'string',\n description: 'You Personal Access Token ',\n} satisfies CommandOption\n\nconst workspaceId = {\n type: 'string',\n description: 'The Workspace Id to deploy to',\n} satisfies CommandOption\n\nconst secrets = {\n type: 'string',\n description: 'Values for the integration secrets',\n array: true,\n default: [],\n} satisfies CommandOption\n\nconst botRef = {\n type: 'string',\n description: 'The bot ID. Bot Name is not supported.',\n demandOption: true,\n positional: true,\n idx: 0,\n} satisfies CommandOption\n\nconst packageType = {\n type: 'string',\n description:\n 'Either an integration or an interface; helps disambiguate the package type in case both an integration and an interface have the same reference.',\n choices: ['integration', 'interface'] as const,\n} satisfies CommandOption\n\nconst packageRef = {\n type: 'string',\n description:\n 'The package ID or name with optional version. The package can be either an integration or an interface. Ex: teams, teams@0.2.0, llm@5.1.0',\n demandOption: true,\n positional: true,\n idx: 0,\n} satisfies CommandOption\n\nconst integrationRef = {\n ...packageRef,\n description: 'The integration ID or name with optional version. Ex: teams or teams@0.2.0',\n} satisfies CommandOption\n\nconst interfaceRef = {\n ...packageRef,\n description: 'The interface ID or name and version. Ex: llm@5.1.0',\n} satisfies CommandOption\n\nconst sourceMap = { type: 'boolean', description: 'Generate sourcemaps', default: false } satisfies CommandOption\n\nconst minify = { type: 'boolean', description: 'Minify the bundled code', default: true } satisfies CommandOption\n\nconst dev = {\n type: 'boolean',\n description: 'List only dev bots / dev integrations',\n default: false,\n} satisfies CommandOption\n\nconst isPublic = {\n type: 'boolean',\n description: 'Weither or not to deploy the integration publicly',\n default: false,\n} satisfies CommandOption\n\n// base schemas\n\nconst globalSchema = {\n verbose: {\n type: 'boolean',\n description: 'Enable verbose logging',\n alias: 'v',\n default: false,\n },\n confirm: {\n type: 'boolean',\n description: 'Confirm all prompts',\n alias: 'y',\n default: false,\n },\n json: {\n type: 'boolean',\n description: 'Prevent logging anything else than raw json in stdout. Useful for piping output to other tools',\n default: false,\n },\n botpressHome: {\n type: 'string',\n description: 'The path to the Botpress home directory',\n default: consts.defaultBotpressHome,\n },\n} satisfies CommandSchema\n\nconst projectSchema = {\n ...globalSchema,\n entryPoint: { type: 'string', description: 'The entry point of the project', default: consts.defaultEntrypoint },\n outDir: { type: 'string', description: 'The output directory', default: consts.defaultOutputFolder },\n workDir,\n} satisfies CommandSchema\n\nconst credentialsSchema = {\n apiUrl,\n workspaceId,\n token,\n} satisfies CommandSchema\n\nconst secretsSchema = {\n secrets,\n} satisfies CommandSchema\n\n// command schemas\n\nconst generateSchema = {\n ...projectSchema,\n} satisfies CommandSchema\n\nconst bundleSchema = {\n ...projectSchema,\n sourceMap,\n minify,\n} satisfies CommandSchema\n\nconst buildSchema = {\n ...projectSchema,\n sourceMap,\n minify,\n} satisfies CommandSchema\n\nconst readSchema = {\n ...projectSchema,\n} satisfies CommandSchema\n\nconst serveSchema = {\n ...projectSchema,\n ...secretsSchema,\n port,\n} satisfies CommandSchema\n\nconst deploySchema = {\n ...projectSchema,\n ...credentialsSchema,\n ...secretsSchema,\n botId: { type: 'string', description: 'The bot ID to deploy. Only used when deploying a bot' },\n noBuild,\n createNewBot: { type: 'boolean', description: 'Create a new bot when deploying. Only used when deploying a bot' },\n sourceMap,\n minify,\n public: isPublic,\n allowDeprecated: {\n type: 'boolean',\n description: 'Allow deprecated features in the project',\n default: false,\n },\n} satisfies CommandSchema\n\nconst devSchema = {\n ...projectSchema,\n ...credentialsSchema,\n ...secretsSchema,\n sourceMap,\n minify,\n port,\n tunnelUrl: {\n type: 'string',\n description: 'The tunnel HTTP URL to use',\n default: consts.defaultTunnelUrl,\n },\n} satisfies CommandSchema\n\nconst addSchema = {\n ...globalSchema,\n ...credentialsSchema,\n packageRef,\n packageType,\n installPath: {\n type: 'string',\n description: 'The path where to install the integration',\n default: consts.defaultInstallPath,\n },\n} satisfies CommandSchema\n\nconst loginSchema = {\n ...globalSchema,\n token,\n workspaceId,\n apiUrl: { ...apiUrl, default: consts.defaultBotpressApiUrl },\n} satisfies CommandSchema\n\nconst logoutSchema = {\n ...globalSchema,\n} satisfies CommandSchema\n\nconst createBotSchema = {\n ...globalSchema,\n ...credentialsSchema,\n name: { type: 'string', description: 'The name of the bot to create' },\n ifNotExists: {\n type: 'boolean',\n description: 'Do not create if a bot with the same name already exists',\n default: false,\n },\n} satisfies CommandSchema\n\nconst getBotSchema = {\n ...globalSchema,\n ...credentialsSchema,\n botRef,\n} satisfies CommandSchema\n\nconst deleteBotSchema = {\n ...globalSchema,\n ...credentialsSchema,\n botRef,\n} satisfies CommandSchema\n\nconst listBotsSchema = {\n ...globalSchema,\n ...credentialsSchema,\n dev,\n} satisfies CommandSchema\n\nconst getIntegrationSchema = {\n ...globalSchema,\n ...credentialsSchema,\n integrationRef,\n} satisfies CommandSchema\n\nconst listIntegrationsSchema = {\n ...globalSchema,\n ...credentialsSchema,\n name: { type: 'string', description: 'The name filter when listing integrations' },\n versionNumber: { type: 'string', description: 'The version filter when listing integrations' },\n dev,\n} satisfies CommandSchema\n\nconst deleteIntegrationSchema = {\n ...globalSchema,\n ...credentialsSchema,\n integrationRef,\n} satisfies CommandSchema\n\nconst getInterfaceSchema = {\n ...globalSchema,\n ...credentialsSchema,\n interfaceRef,\n} satisfies CommandSchema\n\nconst listInterfacesSchema = {\n ...globalSchema,\n ...credentialsSchema,\n} satisfies CommandSchema\n\nconst deleteInterfaceSchema = {\n ...globalSchema,\n ...credentialsSchema,\n interfaceRef,\n} satisfies CommandSchema\n\nconst initSchema = {\n ...globalSchema,\n workDir,\n type: { type: 'string', choices: ['bot', 'integration'] as const },\n name: { type: 'string', description: 'The name of the project' },\n} satisfies CommandSchema\n\nconst lintSchema = {\n ...projectSchema,\n} satisfies CommandSchema\n\n// exports\n\nexport const schemas = {\n global: globalSchema,\n project: projectSchema,\n credentials: credentialsSchema,\n secrets: secretsSchema,\n\n login: loginSchema,\n logout: logoutSchema,\n createBot: createBotSchema,\n getBot: getBotSchema,\n deleteBot: deleteBotSchema,\n listBots: listBotsSchema,\n getIntegration: getIntegrationSchema,\n listIntegrations: listIntegrationsSchema,\n deleteIntegration: deleteIntegrationSchema,\n getInterface: getInterfaceSchema,\n listInterfaces: listInterfacesSchema,\n deleteInterface: deleteInterfaceSchema,\n init: initSchema,\n generate: generateSchema,\n bundle: bundleSchema,\n build: buildSchema,\n read: readSchema,\n serve: serveSchema,\n deploy: deploySchema,\n add: addSchema,\n dev: devSchema,\n lint: lintSchema,\n} as const\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AAKxB,MAAM,OAAO;AAAA,EACX,MAAM;AAAA,EACN,aAAa;AACf;AAEA,MAAM,UAAU;AAAA,EACd,MAAM;AAAA,EACN,aAAa;AAAA,EACb,SAAS,OAAO;AAClB;AAEA,MAAM,UAAU;AAAA,EACd,MAAM;AAAA,EACN,aAAa;AAAA,EACb,SAAS;AACX;AAEA,MAAM,SAAS;AAAA,EACb,MAAM;AAAA,EACN,aAAa;AACf;AAEA,MAAM,QAAQ;AAAA,EACZ,MAAM;AAAA,EACN,aAAa;AACf;AAEA,MAAM,cAAc;AAAA,EAClB,MAAM;AAAA,EACN,aAAa;AACf;AAEA,MAAM,UAAU;AAAA,EACd,MAAM;AAAA,EACN,aAAa;AAAA,EACb,OAAO;AAAA,EACP,SAAS,CAAC;AACZ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,SAAS;AAAA,EAET,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,KAAK;AAAA,EACL,MAAM;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/consts.js
CHANGED
|
@@ -29,15 +29,18 @@ __export(consts_exports, {
|
|
|
29
29
|
defaultBotpressAppUrl: () => defaultBotpressAppUrl,
|
|
30
30
|
defaultBotpressHome: () => defaultBotpressHome,
|
|
31
31
|
defaultEntrypoint: () => defaultEntrypoint,
|
|
32
|
+
defaultInstallPath: () => defaultInstallPath,
|
|
32
33
|
defaultOutputFolder: () => defaultOutputFolder,
|
|
33
34
|
defaultTunnelUrl: () => defaultTunnelUrl,
|
|
34
|
-
|
|
35
|
+
defaultWorkDir: () => defaultWorkDir,
|
|
36
|
+
emptyBotDirName: () => emptyBotDirName,
|
|
35
37
|
emptyIntegrationDirName: () => emptyIntegrationDirName,
|
|
36
38
|
fromCliRootDir: () => fromCliRootDir,
|
|
37
39
|
fromHomeDir: () => fromHomeDir,
|
|
38
40
|
fromOutDir: () => fromOutDir,
|
|
39
41
|
fromWorkDir: () => fromWorkDir,
|
|
40
42
|
helloWorldIntegrationDirName: () => helloWorldIntegrationDirName,
|
|
43
|
+
installDirName: () => installDirName,
|
|
41
44
|
webhookMessageIntegrationDirName: () => webhookMessageIntegrationDirName
|
|
42
45
|
});
|
|
43
46
|
module.exports = __toCommonJS(consts_exports);
|
|
@@ -46,17 +49,20 @@ var import_path = __toESM(require("path"));
|
|
|
46
49
|
var import_root = require("./root");
|
|
47
50
|
const defaultBotpressHome = import_path.default.join(import_os.default.homedir(), ".botpress");
|
|
48
51
|
const defaultOutputFolder = ".botpress";
|
|
52
|
+
const defaultWorkDir = process.cwd();
|
|
53
|
+
const defaultInstallPath = process.cwd();
|
|
49
54
|
const defaultEntrypoint = import_path.default.join("src", "index.ts");
|
|
50
55
|
const defaultBotpressApiUrl = "https://api.botpress.cloud";
|
|
51
56
|
const defaultBotpressAppUrl = "https://app.botpress.cloud";
|
|
52
57
|
const defaultTunnelUrl = "https://tunnel.botpress.cloud";
|
|
53
58
|
const cliRootDir = import_root.CLI_ROOT_DIR;
|
|
54
|
-
const
|
|
59
|
+
const emptyBotDirName = "empty-bot";
|
|
55
60
|
const emptyIntegrationDirName = "empty-integration";
|
|
56
61
|
const helloWorldIntegrationDirName = "hello-world";
|
|
57
62
|
const webhookMessageIntegrationDirName = "webhook-message";
|
|
63
|
+
const installDirName = "bp_modules";
|
|
58
64
|
const fromCliRootDir = {
|
|
59
|
-
|
|
65
|
+
emptyBotTemplate: import_path.default.join("templates", emptyBotDirName),
|
|
60
66
|
emptyIntegrationTemplate: import_path.default.join("templates", emptyIntegrationDirName),
|
|
61
67
|
helloWorldIntegrationTemplate: import_path.default.join("templates", helloWorldIntegrationDirName),
|
|
62
68
|
webhookMessageIntegrationTemplate: import_path.default.join("templates", webhookMessageIntegrationDirName)
|
|
@@ -66,12 +72,12 @@ const fromHomeDir = {
|
|
|
66
72
|
};
|
|
67
73
|
const fromWorkDir = {
|
|
68
74
|
integrationDefinition: "integration.definition.ts",
|
|
69
|
-
interfaceDefinition: "interface.definition.ts"
|
|
75
|
+
interfaceDefinition: "interface.definition.ts",
|
|
76
|
+
botDefinition: "bot.definition.ts"
|
|
70
77
|
};
|
|
71
78
|
const fromOutDir = {
|
|
72
79
|
distDir: "dist",
|
|
73
80
|
outFile: import_path.default.join("dist", "index.js"),
|
|
74
|
-
installDir: "installations",
|
|
75
81
|
implementationDir: "implementation",
|
|
76
82
|
secretsDir: "secrets",
|
|
77
83
|
projectCacheFile: "project.cache.json"
|
|
@@ -83,15 +89,18 @@ const fromOutDir = {
|
|
|
83
89
|
defaultBotpressAppUrl,
|
|
84
90
|
defaultBotpressHome,
|
|
85
91
|
defaultEntrypoint,
|
|
92
|
+
defaultInstallPath,
|
|
86
93
|
defaultOutputFolder,
|
|
87
94
|
defaultTunnelUrl,
|
|
88
|
-
|
|
95
|
+
defaultWorkDir,
|
|
96
|
+
emptyBotDirName,
|
|
89
97
|
emptyIntegrationDirName,
|
|
90
98
|
fromCliRootDir,
|
|
91
99
|
fromHomeDir,
|
|
92
100
|
fromOutDir,
|
|
93
101
|
fromWorkDir,
|
|
94
102
|
helloWorldIntegrationDirName,
|
|
103
|
+
installDirName,
|
|
95
104
|
webhookMessageIntegrationDirName
|
|
96
105
|
});
|
|
97
106
|
//# sourceMappingURL=consts.js.map
|
package/dist/consts.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/consts.ts"],
|
|
4
|
-
"sourcesContent": ["import os from 'os'\nimport pathlib from 'path'\nimport { CLI_ROOT_DIR } from './root'\n\n// configurable\n\nexport const defaultBotpressHome = pathlib.join(os.homedir(), '.botpress')\n\nexport const defaultOutputFolder = '.botpress'\nexport const defaultEntrypoint = pathlib.join('src', 'index.ts')\nexport const defaultBotpressApiUrl = 'https://api.botpress.cloud'\nexport const defaultBotpressAppUrl = 'https://app.botpress.cloud'\nexport const defaultTunnelUrl = 'https://tunnel.botpress.cloud'\n\n// not configurable\n\nexport const cliRootDir = CLI_ROOT_DIR\n\nexport const
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAe;AACf,kBAAoB;AACpB,kBAA6B;AAItB,MAAM,sBAAsB,YAAAA,QAAQ,KAAK,UAAAC,QAAG,QAAQ,GAAG,WAAW;AAElE,MAAM,sBAAsB;AAC5B,MAAM,oBAAoB,YAAAD,QAAQ,KAAK,OAAO,UAAU;AACxD,MAAM,wBAAwB;AAC9B,MAAM,wBAAwB;AAC9B,MAAM,mBAAmB;AAIzB,MAAM,aAAa;AAEnB,MAAM,
|
|
4
|
+
"sourcesContent": ["import os from 'os'\nimport pathlib from 'path'\nimport { CLI_ROOT_DIR } from './root'\n\n// configurable\n\nexport const defaultBotpressHome = pathlib.join(os.homedir(), '.botpress')\n\nexport const defaultOutputFolder = '.botpress'\nexport const defaultWorkDir = process.cwd()\nexport const defaultInstallPath = process.cwd()\nexport const defaultEntrypoint = pathlib.join('src', 'index.ts')\nexport const defaultBotpressApiUrl = 'https://api.botpress.cloud'\nexport const defaultBotpressAppUrl = 'https://app.botpress.cloud'\nexport const defaultTunnelUrl = 'https://tunnel.botpress.cloud'\n\n// not configurable\n\nexport const cliRootDir = CLI_ROOT_DIR\n\nexport const emptyBotDirName = 'empty-bot'\nexport const emptyIntegrationDirName = 'empty-integration'\nexport const helloWorldIntegrationDirName = 'hello-world'\nexport const webhookMessageIntegrationDirName = 'webhook-message'\nexport const installDirName = 'bp_modules'\n\nexport const fromCliRootDir = {\n emptyBotTemplate: pathlib.join('templates', emptyBotDirName),\n emptyIntegrationTemplate: pathlib.join('templates', emptyIntegrationDirName),\n helloWorldIntegrationTemplate: pathlib.join('templates', helloWorldIntegrationDirName),\n webhookMessageIntegrationTemplate: pathlib.join('templates', webhookMessageIntegrationDirName),\n}\n\nexport const fromHomeDir = {\n globalCacheFile: 'global.cache.json',\n}\n\nexport const fromWorkDir = {\n integrationDefinition: 'integration.definition.ts',\n interfaceDefinition: 'interface.definition.ts',\n botDefinition: 'bot.definition.ts',\n}\n\nexport const fromOutDir = {\n distDir: 'dist',\n outFile: pathlib.join('dist', 'index.js'),\n implementationDir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