@botpress/cli 3.3.3 → 3.5.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 +11 -11
- package/dist/code-generation/bot-implementation/bot-plugins/index.js +3 -3
- package/dist/code-generation/bot-implementation/bot-plugins/index.js.map +2 -2
- package/dist/code-generation/bot-implementation/bot-plugins/plugin-module.js +4 -4
- package/dist/code-generation/bot-implementation/bot-plugins/plugin-module.js.map +2 -2
- package/dist/code-generation/bot-implementation/bot-typings/index.js +11 -2
- package/dist/code-generation/bot-implementation/bot-typings/index.js.map +2 -2
- package/dist/code-generation/bot-implementation/bot-typings/workflows-module.js +104 -0
- package/dist/code-generation/bot-implementation/bot-typings/workflows-module.js.map +7 -0
- package/dist/code-generation/plugin-implementation/plugin-typings/index.js +24 -11
- package/dist/code-generation/plugin-implementation/plugin-typings/index.js.map +2 -2
- package/dist/code-generation/plugin-implementation/plugin-typings/workflows-module.js +104 -0
- package/dist/code-generation/plugin-implementation/plugin-typings/workflows-module.js.map +7 -0
- package/dist/code-generation/typings.js.map +1 -1
- package/dist/command-implementations/deploy-command.js +1 -2
- package/dist/command-implementations/deploy-command.js.map +2 -2
- package/dist/command-implementations/init-command.js +39 -23
- package/dist/command-implementations/init-command.js.map +2 -2
- package/dist/config.js +6 -0
- package/dist/config.js.map +2 -2
- package/dist/consts.js +3 -24
- package/dist/consts.js.map +2 -2
- package/dist/project-templates.js +83 -0
- package/dist/project-templates.js.map +7 -0
- package/dist/sdk/validate-bot.js +5 -1
- package/dist/sdk/validate-bot.js.map +2 -2
- package/dist/sdk/validate-bot.test.js +131 -0
- package/dist/sdk/validate-bot.test.js.map +7 -0
- package/dist/utils/prompt-utils.js +4 -2
- package/dist/utils/prompt-utils.js.map +2 -2
- package/package.json +3 -6
- package/templates/empty-bot/.botpress/implementation/typings/index.ts +3 -0
- package/templates/empty-bot/.botpress/implementation/typings/workflows/index.ts +6 -0
- package/templates/empty-bot/package.json +2 -2
- package/templates/empty-integration/package.json +2 -2
- package/templates/empty-plugin/.botpress/implementation/typings/index.ts +5 -0
- package/templates/empty-plugin/.botpress/implementation/typings/workflows/index.ts +6 -0
- package/templates/empty-plugin/package.json +1 -1
- package/templates/hello-world/package.json +2 -2
- package/templates/webhook-message/package.json +2 -2
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: 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 dryRun = {\n type: 'boolean',\n description: 'Ask the API not to perform the actual operation',\n default: false,\n} as const 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', 'plugin'] 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 positional: true,\n idx: 0,\n} satisfies CommandOption\n\nconst integrationRef = {\n ...packageRef,\n demandOption: true,\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 demandOption: true,\n description: 'The interface ID or name and version. Ex: llm@5.1.0',\n} satisfies CommandOption\n\nconst pluginRef = {\n ...packageRef,\n demandOption: true,\n description: 'The plugin ID or name and version. Ex: knowledge@0.0.1',\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 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 dryRun,\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 package',\n default: consts.defaultInstallPath,\n },\n useDev: {\n type: 'boolean',\n description: 'If a dev version of the package is found, use it',\n default: false,\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 getPluginSchema = {\n ...globalSchema,\n ...credentialsSchema,\n pluginRef,\n} satisfies CommandSchema\n\nconst listPluginsSchema = {\n ...globalSchema,\n ...credentialsSchema,\n} satisfies CommandSchema\n\nconst deletePluginSchema = {\n ...globalSchema,\n ...credentialsSchema,\n pluginRef,\n} satisfies CommandSchema\n\nconst initSchema = {\n ...globalSchema,\n workDir,\n type: { type: 'string', choices: ['bot', 'integration', 'plugin'] as const },\n name: { type: 'string', description: 'The name of the project' },\n} satisfies CommandSchema\n\nconst lintSchema = {\n ...projectSchema,\n} satisfies CommandSchema\n\nconst chatSchema = {\n ...globalSchema,\n ...credentialsSchema,\n chatApiUrl: {\n type: 'string',\n description: 'The URL of the chat server',\n },\n botId: {\n type: 'string',\n positional: true,\n idx: 0,\n description: 'The bot ID to chat with',\n },\n} satisfies CommandSchema\n\n// exports\n\nexport const schemas = {\n global: globalSchema,\n project: projectSchema,\n credentials: credentialsSchema,\n secrets: secretsSchema,\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 getPlugin: getPluginSchema,\n listPlugins: listPluginsSchema,\n deletePlugin: deletePluginSchema,\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 chat: chatSchema,\n} as const\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;
|
|
4
|
+
"sourcesContent": ["import * as consts from './consts'\nimport { ProjectTemplates } from './project-templates'\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 dryRun = {\n type: 'boolean',\n description: 'Ask the API not to perform the actual operation',\n default: false,\n} as const 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', 'plugin'] 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 positional: true,\n idx: 0,\n} satisfies CommandOption\n\nconst integrationRef = {\n ...packageRef,\n demandOption: true,\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 demandOption: true,\n description: 'The interface ID or name and version. Ex: llm@5.1.0',\n} satisfies CommandOption\n\nconst pluginRef = {\n ...packageRef,\n demandOption: true,\n description: 'The plugin ID or name and version. Ex: knowledge@0.0.1',\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 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 dryRun,\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 package',\n default: consts.defaultInstallPath,\n },\n useDev: {\n type: 'boolean',\n description: 'If a dev version of the package is found, use it',\n default: false,\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 getPluginSchema = {\n ...globalSchema,\n ...credentialsSchema,\n pluginRef,\n} satisfies CommandSchema\n\nconst listPluginsSchema = {\n ...globalSchema,\n ...credentialsSchema,\n} satisfies CommandSchema\n\nconst deletePluginSchema = {\n ...globalSchema,\n ...credentialsSchema,\n pluginRef,\n} satisfies CommandSchema\n\nconst initSchema = {\n ...globalSchema,\n workDir,\n type: { type: 'string', choices: ['bot', 'integration', 'plugin'] as const },\n template: {\n type: 'string',\n choices: ProjectTemplates.getAllChoices(),\n description: 'The template to use',\n },\n name: { type: 'string', description: 'The name of the project' },\n} satisfies CommandSchema\n\nconst lintSchema = {\n ...projectSchema,\n} satisfies CommandSchema\n\nconst chatSchema = {\n ...globalSchema,\n ...credentialsSchema,\n chatApiUrl: {\n type: 'string',\n description: 'The URL of the chat server',\n },\n botId: {\n type: 'string',\n positional: true,\n idx: 0,\n description: 'The bot ID to chat with',\n },\n} satisfies CommandSchema\n\n// exports\n\nexport const schemas = {\n global: globalSchema,\n project: projectSchema,\n credentials: credentialsSchema,\n secrets: secretsSchema,\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 getPlugin: getPluginSchema,\n listPlugins: listPluginsSchema,\n deletePlugin: deletePluginSchema,\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 chat: chatSchema,\n} as const\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,+BAAiC;AAKjC,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;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;AAEA,MAAM,SAAS;AAAA,EACb,MAAM;AAAA,EACN,aAAa;AAAA,EACb,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,KAAK;AACP;AAEA,MAAM,cAAc;AAAA,EAClB,MAAM;AAAA,EACN,aACE;AAAA,EACF,SAAS,CAAC,eAAe,aAAa,QAAQ;AAChD;AAEA,MAAM,aAAa;AAAA,EACjB,MAAM;AAAA,EACN,aACE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G;AACL;AAEA,MAAM,aAAa;AAAA,EACjB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,YAAY;AAAA,IACV,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA,OAAO;AAAA,IACL,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,KAAK;AAAA,IACL,aAAa;AAAA,EACf;AACF;AAIO,MAAM,UAAU;AAAA,EACrB,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,aAAa;AAAA,EACb,SAAS;AAAA,EACT,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,WAAW;AAAA,EACX,aAAa;AAAA,EACb,cAAc;AAAA,EACd,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;AAAA,EACN,MAAM;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/consts.js
CHANGED
|
@@ -37,17 +37,12 @@ __export(consts_exports, {
|
|
|
37
37
|
defaultTunnelUrl: () => defaultTunnelUrl,
|
|
38
38
|
defaultWorkDir: () => defaultWorkDir,
|
|
39
39
|
distDirName: () => distDirName,
|
|
40
|
-
emptyBotDirName: () => emptyBotDirName,
|
|
41
|
-
emptyIntegrationDirName: () => emptyIntegrationDirName,
|
|
42
|
-
emptyPluginDirName: () => emptyPluginDirName,
|
|
43
40
|
fromCliRootDir: () => fromCliRootDir,
|
|
44
41
|
fromHomeDir: () => fromHomeDir,
|
|
45
42
|
fromOutDir: () => fromOutDir,
|
|
46
43
|
fromWorkDir: () => fromWorkDir,
|
|
47
|
-
helloWorldIntegrationDirName: () => helloWorldIntegrationDirName,
|
|
48
44
|
installDirName: () => installDirName,
|
|
49
|
-
outDirName: () => outDirName
|
|
50
|
-
webhookMessageIntegrationDirName: () => webhookMessageIntegrationDirName
|
|
45
|
+
outDirName: () => outDirName
|
|
51
46
|
});
|
|
52
47
|
module.exports = __toCommonJS(consts_exports);
|
|
53
48
|
var import_os = __toESM(require("os"));
|
|
@@ -61,21 +56,10 @@ const defaultBotpressAppUrl = "https://app.botpress.cloud";
|
|
|
61
56
|
const defaultTunnelUrl = "https://tunnel.botpress.cloud";
|
|
62
57
|
const defaultChatApiUrl = "https://chat.botpress.cloud";
|
|
63
58
|
const cliRootDir = import_root.CLI_ROOT_DIR;
|
|
64
|
-
const emptyBotDirName = "empty-bot";
|
|
65
|
-
const emptyPluginDirName = "empty-plugin";
|
|
66
|
-
const emptyIntegrationDirName = "empty-integration";
|
|
67
|
-
const helloWorldIntegrationDirName = "hello-world";
|
|
68
|
-
const webhookMessageIntegrationDirName = "webhook-message";
|
|
69
59
|
const installDirName = "bp_modules";
|
|
70
60
|
const outDirName = ".botpress";
|
|
71
61
|
const distDirName = "dist";
|
|
72
|
-
const fromCliRootDir = {
|
|
73
|
-
emptyBotTemplate: import_path.default.join("templates", emptyBotDirName),
|
|
74
|
-
emptyPluginTemplate: import_path.default.join("templates", emptyPluginDirName),
|
|
75
|
-
emptyIntegrationTemplate: import_path.default.join("templates", emptyIntegrationDirName),
|
|
76
|
-
helloWorldIntegrationTemplate: import_path.default.join("templates", helloWorldIntegrationDirName),
|
|
77
|
-
webhookMessageIntegrationTemplate: import_path.default.join("templates", webhookMessageIntegrationDirName)
|
|
78
|
-
};
|
|
62
|
+
const fromCliRootDir = {};
|
|
79
63
|
const fromHomeDir = {
|
|
80
64
|
globalCacheFile: "global.cache.json"
|
|
81
65
|
};
|
|
@@ -114,16 +98,11 @@ const fromWorkDir = {
|
|
|
114
98
|
defaultTunnelUrl,
|
|
115
99
|
defaultWorkDir,
|
|
116
100
|
distDirName,
|
|
117
|
-
emptyBotDirName,
|
|
118
|
-
emptyIntegrationDirName,
|
|
119
|
-
emptyPluginDirName,
|
|
120
101
|
fromCliRootDir,
|
|
121
102
|
fromHomeDir,
|
|
122
103
|
fromOutDir,
|
|
123
104
|
fromWorkDir,
|
|
124
|
-
helloWorldIntegrationDirName,
|
|
125
105
|
installDirName,
|
|
126
|
-
outDirName
|
|
127
|
-
webhookMessageIntegrationDirName
|
|
106
|
+
outDirName
|
|
128
107
|
});
|
|
129
108
|
//# 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')\nexport const defaultWorkDir = process.cwd()\nexport const defaultInstallPath = process.cwd()\nexport const defaultBotpressApiUrl = 'https://api.botpress.cloud'\nexport const defaultBotpressAppUrl = 'https://app.botpress.cloud'\nexport const defaultTunnelUrl = 'https://tunnel.botpress.cloud'\nexport const defaultChatApiUrl = 'https://chat.botpress.cloud'\n\n// not configurable\n\nexport const cliRootDir = CLI_ROOT_DIR\nexport const
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA
|
|
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')\nexport const defaultWorkDir = process.cwd()\nexport const defaultInstallPath = process.cwd()\nexport const defaultBotpressApiUrl = 'https://api.botpress.cloud'\nexport const defaultBotpressAppUrl = 'https://app.botpress.cloud'\nexport const defaultTunnelUrl = 'https://tunnel.botpress.cloud'\nexport const defaultChatApiUrl = 'https://chat.botpress.cloud'\n\n// not configurable\n\nexport const cliRootDir = CLI_ROOT_DIR\nexport const installDirName = 'bp_modules'\nexport const outDirName = '.botpress'\nexport const distDirName = 'dist'\n\nexport const fromCliRootDir = {}\n\nexport const fromHomeDir = {\n globalCacheFile: 'global.cache.json',\n}\n\nexport const fromOutDir = {\n distDir: distDirName,\n outFileCJS: pathlib.join(distDirName, 'index.cjs'),\n outFileESM: pathlib.join(distDirName, 'index.mjs'),\n implementationDir: 'implementation',\n pluginsDir: 'plugins',\n secretsDir: 'secrets',\n projectCacheFile: 'project.cache.json',\n}\n\nexport const fromWorkDir = {\n integrationDefinition: 'integration.definition.ts',\n interfaceDefinition: 'interface.definition.ts',\n botDefinition: 'bot.definition.ts',\n pluginDefinition: 'plugin.definition.ts',\n entryPoint: pathlib.join('src', 'index.ts'),\n outDir: outDirName,\n distDir: pathlib.join(outDirName, fromOutDir.distDir),\n outFileCJS: pathlib.join(outDirName, fromOutDir.outFileCJS),\n outFileESM: pathlib.join(outDirName, fromOutDir.outFileESM),\n implementationDir: pathlib.join(outDirName, fromOutDir.implementationDir),\n pluginsDir: pathlib.join(outDirName, fromOutDir.pluginsDir),\n secretsDir: pathlib.join(outDirName, fromOutDir.secretsDir),\n projectCacheFile: pathlib.join(outDirName, fromOutDir.projectCacheFile),\n}\n"],
|
|
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;AAClE,MAAM,i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ty;
|
|
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 project_templates_exports = {};
|
|
30
|
+
__export(project_templates_exports, {
|
|
31
|
+
ProjectTemplates: () => ProjectTemplates
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(project_templates_exports);
|
|
34
|
+
var consts = __toESM(require("./consts"));
|
|
35
|
+
var utils = __toESM(require("./utils"));
|
|
36
|
+
var ProjectTemplates;
|
|
37
|
+
((ProjectTemplates2) => {
|
|
38
|
+
const _dirNameToAbsPath = (directoryName) => utils.path.join(consts.cliRootDir, "templates", directoryName);
|
|
39
|
+
ProjectTemplates2.templates = {
|
|
40
|
+
bot: [
|
|
41
|
+
{
|
|
42
|
+
fullName: "Empty Bot",
|
|
43
|
+
identifier: "empty",
|
|
44
|
+
defaultProjectName: "empty-bot",
|
|
45
|
+
absolutePath: _dirNameToAbsPath("empty-bot")
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
plugin: [
|
|
49
|
+
{
|
|
50
|
+
fullName: "Empty Plugin",
|
|
51
|
+
identifier: "empty",
|
|
52
|
+
defaultProjectName: "empty-plugin",
|
|
53
|
+
absolutePath: _dirNameToAbsPath("empty-plugin")
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
integration: [
|
|
57
|
+
{
|
|
58
|
+
fullName: "Empty Integration",
|
|
59
|
+
identifier: "empty",
|
|
60
|
+
defaultProjectName: "empty-integration",
|
|
61
|
+
absolutePath: _dirNameToAbsPath("empty-integration")
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
fullName: "Hello World",
|
|
65
|
+
identifier: "hello-world",
|
|
66
|
+
defaultProjectName: "hello-world",
|
|
67
|
+
absolutePath: _dirNameToAbsPath("hello-world")
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
fullName: "Webhook Message",
|
|
71
|
+
identifier: "webhook-message",
|
|
72
|
+
defaultProjectName: "webhook-message",
|
|
73
|
+
absolutePath: _dirNameToAbsPath("webhook-message")
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
};
|
|
77
|
+
ProjectTemplates2.getAllChoices = () => [...new Set(Object.values(ProjectTemplates2.templates).flatMap((t) => t.map((tt) => tt.identifier)))];
|
|
78
|
+
})(ProjectTemplates || (ProjectTemplates = {}));
|
|
79
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
80
|
+
0 && (module.exports = {
|
|
81
|
+
ProjectTemplates
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=project-templates.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/project-templates.ts"],
|
|
4
|
+
"sourcesContent": ["import * as consts from './consts'\nimport * as utils from './utils'\n\nexport namespace ProjectTemplates {\n export type Template = Readonly<{\n fullName: string\n identifier: string\n defaultProjectName: string\n absolutePath: utils.path.AbsolutePath\n }>\n export type TemplateArray = Readonly<[Template, ...Template[]]>\n export type ProjectType = 'bot' | 'plugin' | 'integration'\n\n const _dirNameToAbsPath = (directoryName: string) => utils.path.join(consts.cliRootDir, 'templates', directoryName)\n\n export const templates = {\n bot: [\n {\n fullName: 'Empty Bot',\n identifier: 'empty',\n defaultProjectName: 'empty-bot',\n absolutePath: _dirNameToAbsPath('empty-bot'),\n },\n ],\n plugin: [\n {\n fullName: 'Empty Plugin',\n identifier: 'empty',\n defaultProjectName: 'empty-plugin',\n absolutePath: _dirNameToAbsPath('empty-plugin'),\n },\n ],\n integration: [\n {\n fullName: 'Empty Integration',\n identifier: 'empty',\n defaultProjectName: 'empty-integration',\n absolutePath: _dirNameToAbsPath('empty-integration'),\n },\n {\n fullName: 'Hello World',\n identifier: 'hello-world',\n defaultProjectName: 'hello-world',\n absolutePath: _dirNameToAbsPath('hello-world'),\n },\n {\n fullName: 'Webhook Message',\n identifier: 'webhook-message',\n defaultProjectName: 'webhook-message',\n absolutePath: _dirNameToAbsPath('webhook-message'),\n },\n ],\n } as const satisfies { [k in ProjectType]: TemplateArray }\n\n export const getAllChoices = () => [...new Set(Object.values(templates).flatMap((t) => t.map((tt) => tt.identifier)))]\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,YAAuB;AAEhB,IAAU;AAAA,CAAV,CAAUA,sBAAV;AAUL,QAAM,oBAAoB,CAAC,kBAA0B,MAAM,KAAK,KAAK,OAAO,YAAY,aAAa,aAAa;AAE3G,EAAMA,kBAAA,YAAY;AAAA,IACvB,KAAK;AAAA,MACH;AAAA,QACE,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,oBAAoB;AAAA,QACpB,cAAc,kBAAkB,WAAW;AAAA,MAC7C;AAAA,IACF;AAAA,IACA,QAAQ;AAAA,MACN;AAAA,QACE,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,oBAAoB;AAAA,QACpB,cAAc,kBAAkB,cAAc;AAAA,MAChD;AAAA,IACF;AAAA,IACA,aAAa;AAAA,MACX;AAAA,QACE,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,oBAAoB;AAAA,QACpB,cAAc,kBAAkB,mBAAmB;AAAA,MACrD;AAAA,MACA;AAAA,QACE,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,oBAAoB;AAAA,QACpB,cAAc,kBAAkB,aAAa;AAAA,MAC/C;AAAA,MACA;AAAA,QACE,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,oBAAoB;AAAA,QACpB,cAAc,kBAAkB,iBAAiB;AAAA,MACnD;AAAA,IACF;AAAA,EACF;AAEO,EAAMA,kBAAA,gBAAgB,MAAM,CAAC,GAAG,IAAI,IAAI,OAAO,OAAOA,kBAAA,SAAS,EAAE,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC;AAAA,GAnDtG;",
|
|
6
|
+
"names": ["ProjectTemplates"]
|
|
7
|
+
}
|
package/dist/sdk/validate-bot.js
CHANGED
|
@@ -33,6 +33,7 @@ __export(validate_bot_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(validate_bot_exports);
|
|
34
34
|
var errors = __toESM(require("../errors"));
|
|
35
35
|
var utils = __toESM(require("../utils"));
|
|
36
|
+
const PLUGIN_PREFIX_SEP = "#";
|
|
36
37
|
const validateBotDefinition = (b) => {
|
|
37
38
|
const { actions, events, states } = b;
|
|
38
39
|
const invalidActionNames = _nonCamelCaseKeys(actions ?? {});
|
|
@@ -74,7 +75,10 @@ const validateBotDefinition = (b) => {
|
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
};
|
|
77
|
-
const _nonCamelCaseKeys = (obj) => Object.keys(obj).filter((
|
|
78
|
+
const _nonCamelCaseKeys = (obj) => Object.keys(obj).filter((key) => {
|
|
79
|
+
const tokens = key.split(PLUGIN_PREFIX_SEP, 2);
|
|
80
|
+
return tokens.some((t) => !utils.casing.is.camelCase(t));
|
|
81
|
+
});
|
|
78
82
|
const _hasIntegrationDependency = (b, dep) => {
|
|
79
83
|
const integrationInstances = Object.entries(b.integrations ?? {}).map(([_k, v]) => v);
|
|
80
84
|
return integrationInstances.some(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/sdk/validate-bot.ts"],
|
|
4
|
-
"sourcesContent": ["import type * as sdk from '@botpress/sdk'\nimport * as errors from '../errors'\nimport * as utils from '../utils'\n\ntype PackageRef = { name: string; version: string }\n\nexport const validateBotDefinition = (b: sdk.BotDefinition): void => {\n const { actions, events, states } = b\n\n const invalidActionNames = _nonCamelCaseKeys(actions ?? {})\n if (invalidActionNames.length) {\n throw new errors.BotpressCLIError(\n `The following action names are not in camelCase: ${invalidActionNames.join(', ')}`\n )\n }\n\n const invalidEventNames = _nonCamelCaseKeys(events ?? {})\n if (invalidEventNames.length) {\n throw new errors.BotpressCLIError(`The following event names are not in camelCase: ${invalidEventNames.join(', ')}`)\n }\n\n const invalidStateNames = _nonCamelCaseKeys(states ?? {})\n if (invalidStateNames.length) {\n throw new errors.BotpressCLIError(`The following state names are not in camelCase: ${invalidStateNames.join(', ')}`)\n }\n\n for (const [pluginName, plugin] of Object.entries(b.plugins ?? {})) {\n const integrationDependencies = plugin.definition.integrations ?? {}\n for (const dep of Object.values(integrationDependencies)) {\n if (!_hasIntegrationDependency(b, dep)) {\n throw new errors.BotpressCLIError(\n `Plugin \"${pluginName}\" has a dependency on integration \"${dep.name}@${dep.version}\", but it is not present in the bot definition. Please install it.`\n )\n }\n }\n\n const interfaceDepdencies = plugin.definition.interfaces ?? {}\n for (const dep of Object.values(interfaceDepdencies)) {\n const interfaceImpl = plugin.interfaces[dep.name]\n if (!interfaceImpl) {\n throw new errors.BotpressCLIError(\n `Plugin \"${pluginName}\" has a dependency on interface \"${dep.name}@${dep.version}\", but the bot does not specify an implementation for it.`\n )\n }\n\n if (!_hasIntegrationDependency(b, interfaceImpl)) {\n throw new errors.BotpressCLIError(\n `Integration \"${interfaceImpl.name}@${interfaceImpl.version}\" is not installed in the bot, but specified as an implementation for interface \"${dep.name}@${dep.version}\"`\n )\n }\n }\n }\n}\n\nconst _nonCamelCaseKeys = (obj: Record<string, any>): string[] =>\n Object.keys(obj).filter((
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;AACxB,YAAuB;
|
|
4
|
+
"sourcesContent": ["import type * as sdk from '@botpress/sdk'\nimport * as errors from '../errors'\nimport * as utils from '../utils'\n\ntype PackageRef = { name: string; version: string }\n\nconst PLUGIN_PREFIX_SEP = '#'\n\nexport const validateBotDefinition = (b: sdk.BotDefinition): void => {\n const { actions, events, states } = b\n\n const invalidActionNames = _nonCamelCaseKeys(actions ?? {})\n if (invalidActionNames.length) {\n throw new errors.BotpressCLIError(\n `The following action names are not in camelCase: ${invalidActionNames.join(', ')}`\n )\n }\n\n const invalidEventNames = _nonCamelCaseKeys(events ?? {})\n if (invalidEventNames.length) {\n throw new errors.BotpressCLIError(`The following event names are not in camelCase: ${invalidEventNames.join(', ')}`)\n }\n\n const invalidStateNames = _nonCamelCaseKeys(states ?? {})\n if (invalidStateNames.length) {\n throw new errors.BotpressCLIError(`The following state names are not in camelCase: ${invalidStateNames.join(', ')}`)\n }\n\n for (const [pluginName, plugin] of Object.entries(b.plugins ?? {})) {\n const integrationDependencies = plugin.definition.integrations ?? {}\n for (const dep of Object.values(integrationDependencies)) {\n if (!_hasIntegrationDependency(b, dep)) {\n throw new errors.BotpressCLIError(\n `Plugin \"${pluginName}\" has a dependency on integration \"${dep.name}@${dep.version}\", but it is not present in the bot definition. Please install it.`\n )\n }\n }\n\n const interfaceDepdencies = plugin.definition.interfaces ?? {}\n for (const dep of Object.values(interfaceDepdencies)) {\n const interfaceImpl = plugin.interfaces[dep.name]\n if (!interfaceImpl) {\n throw new errors.BotpressCLIError(\n `Plugin \"${pluginName}\" has a dependency on interface \"${dep.name}@${dep.version}\", but the bot does not specify an implementation for it.`\n )\n }\n\n if (!_hasIntegrationDependency(b, interfaceImpl)) {\n throw new errors.BotpressCLIError(\n `Integration \"${interfaceImpl.name}@${interfaceImpl.version}\" is not installed in the bot, but specified as an implementation for interface \"${dep.name}@${dep.version}\"`\n )\n }\n }\n }\n}\n\nconst _nonCamelCaseKeys = (obj: Record<string, any>): string[] =>\n Object.keys(obj).filter((key) => {\n const tokens: string[] = key.split(PLUGIN_PREFIX_SEP, 2)\n return tokens.some((t) => !utils.casing.is.camelCase(t))\n })\n\nconst _hasIntegrationDependency = (b: sdk.BotDefinition, dep: PackageRef): boolean => {\n const integrationInstances = Object.entries(b.integrations ?? {}).map(([_k, v]) => v)\n return integrationInstances.some(\n (integration) => integration.name === dep.name && integration.version === dep.version\n )\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;AACxB,YAAuB;AAIvB,MAAM,oBAAoB;AAEnB,MAAM,wBAAwB,CAAC,MAA+B;AACnE,QAAM,EAAE,SAAS,QAAQ,OAAO,IAAI;AAEpC,QAAM,qBAAqB,kBAAkB,WAAW,CAAC,CAAC;AAC1D,MAAI,mBAAmB,QAAQ;AAC7B,UAAM,IAAI,OAAO;AAAA,MACf,oDAAoD,mBAAmB,KAAK,IAAI;AAAA,IAClF;AAAA,EACF;AAEA,QAAM,oBAAoB,kBAAkB,U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AC;AACzD,CAAC;AAEH,MAAM,4BAA4B,CAAC,GAAsB,QAA6B;AACpF,QAAM,uBAAuB,OAAO,QAAQ,EAAE,gBAAgB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;AACpF,SAAO,qBAAqB;AAAA,IAC1B,CAAC,gBAAgB,YAAY,SAAS,IAAI,QAAQ,YAAY,YAAY,IAAI;AAAA,EAChF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,131 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var sdk = __toESM(require("@botpress/sdk"));
|
|
25
|
+
var errors = __toESM(require("../errors"));
|
|
26
|
+
var import_vitest = require("vitest");
|
|
27
|
+
var import_validate_bot = require("./validate-bot");
|
|
28
|
+
import_vitest.describe.concurrent("validateBotDefinition", () => {
|
|
29
|
+
(0, import_vitest.it)("should throw an error if action names are not in camelCase", async () => {
|
|
30
|
+
const bot = new sdk.BotDefinition({
|
|
31
|
+
actions: {
|
|
32
|
+
"invalid-action": {
|
|
33
|
+
input: { schema: sdk.z.object({}) },
|
|
34
|
+
output: { schema: sdk.z.object({}) }
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
(0, import_vitest.expect)(() => (0, import_validate_bot.validateBotDefinition)(bot)).toThrowError(errors.BotpressCLIError);
|
|
39
|
+
});
|
|
40
|
+
(0, import_vitest.it)("should throw an error if event names are not in camelCase", async () => {
|
|
41
|
+
const bot = new sdk.BotDefinition({
|
|
42
|
+
events: {
|
|
43
|
+
"invalid-event": {
|
|
44
|
+
schema: sdk.z.object({})
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
(0, import_vitest.expect)(() => (0, import_validate_bot.validateBotDefinition)(bot)).toThrowError(errors.BotpressCLIError);
|
|
49
|
+
});
|
|
50
|
+
(0, import_vitest.it)("should throw an error if state names are not in camelCase", async () => {
|
|
51
|
+
const bot = new sdk.BotDefinition({
|
|
52
|
+
states: {
|
|
53
|
+
"invalid-state": {
|
|
54
|
+
type: "bot",
|
|
55
|
+
schema: sdk.z.object({})
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
(0, import_vitest.expect)(() => (0, import_validate_bot.validateBotDefinition)(bot)).toThrowError(errors.BotpressCLIError);
|
|
60
|
+
});
|
|
61
|
+
(0, import_vitest.it)("should allow plugin prefix in action names", async () => {
|
|
62
|
+
const bot = new sdk.BotDefinition({
|
|
63
|
+
actions: {
|
|
64
|
+
"plugin#action": {
|
|
65
|
+
input: { schema: sdk.z.object({}) },
|
|
66
|
+
output: { schema: sdk.z.object({}) }
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
(0, import_vitest.expect)(() => (0, import_validate_bot.validateBotDefinition)(bot)).not.toThrowError();
|
|
71
|
+
});
|
|
72
|
+
(0, import_vitest.it)("should allow plugin prefix in event names", async () => {
|
|
73
|
+
const bot = new sdk.BotDefinition({
|
|
74
|
+
events: {
|
|
75
|
+
"plugin#event": {
|
|
76
|
+
schema: sdk.z.object({})
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
(0, import_vitest.expect)(() => (0, import_validate_bot.validateBotDefinition)(bot)).not.toThrowError();
|
|
81
|
+
});
|
|
82
|
+
(0, import_vitest.it)("should allow plugin prefix in state names", async () => {
|
|
83
|
+
const bot = new sdk.BotDefinition({
|
|
84
|
+
states: {
|
|
85
|
+
"plugin#state": {
|
|
86
|
+
type: "bot",
|
|
87
|
+
schema: sdk.z.object({})
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
(0, import_vitest.expect)(() => (0, import_validate_bot.validateBotDefinition)(bot)).not.toThrowError();
|
|
92
|
+
});
|
|
93
|
+
(0, import_vitest.it)("should throw an error if plugin prefix is not in camelCase", async () => {
|
|
94
|
+
(0, import_vitest.expect)(
|
|
95
|
+
() => (0, import_validate_bot.validateBotDefinition)(
|
|
96
|
+
new sdk.BotDefinition({
|
|
97
|
+
actions: {
|
|
98
|
+
"my-plugin#actionName": {
|
|
99
|
+
input: { schema: sdk.z.object({}) },
|
|
100
|
+
output: { schema: sdk.z.object({}) }
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
)
|
|
105
|
+
).toThrowError(errors.BotpressCLIError);
|
|
106
|
+
(0, import_vitest.expect)(
|
|
107
|
+
() => (0, import_validate_bot.validateBotDefinition)(
|
|
108
|
+
new sdk.BotDefinition({
|
|
109
|
+
events: {
|
|
110
|
+
"my-plugin#eventName": {
|
|
111
|
+
schema: sdk.z.object({})
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
)
|
|
116
|
+
).toThrowError(errors.BotpressCLIError);
|
|
117
|
+
(0, import_vitest.expect)(
|
|
118
|
+
() => (0, import_validate_bot.validateBotDefinition)(
|
|
119
|
+
new sdk.BotDefinition({
|
|
120
|
+
states: {
|
|
121
|
+
"my-plugin#stateName": {
|
|
122
|
+
type: "bot",
|
|
123
|
+
schema: sdk.z.object({})
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
)
|
|
128
|
+
).toThrowError(errors.BotpressCLIError);
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
//# sourceMappingURL=validate-bot.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/sdk/validate-bot.test.ts"],
|
|
4
|
+
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as errors from '../errors'\nimport { describe, expect, it } from 'vitest'\nimport { validateBotDefinition } from './validate-bot'\n\ndescribe.concurrent('validateBotDefinition', () => {\n it('should throw an error if action names are not in camelCase', async () => {\n const bot = new sdk.BotDefinition({\n actions: {\n 'invalid-action': {\n input: { schema: sdk.z.object({}) },\n output: { schema: sdk.z.object({}) },\n },\n },\n })\n\n expect(() => validateBotDefinition(bot)).toThrowError(errors.BotpressCLIError)\n })\n\n it('should throw an error if event names are not in camelCase', async () => {\n const bot = new sdk.BotDefinition({\n events: {\n 'invalid-event': {\n schema: sdk.z.object({}),\n },\n },\n })\n\n expect(() => validateBotDefinition(bot)).toThrowError(errors.BotpressCLIError)\n })\n\n it('should throw an error if state names are not in camelCase', async () => {\n const bot = new sdk.BotDefinition({\n states: {\n 'invalid-state': {\n type: 'bot',\n schema: sdk.z.object({}),\n },\n },\n })\n\n expect(() => validateBotDefinition(bot)).toThrowError(errors.BotpressCLIError)\n })\n\n it('should allow plugin prefix in action names', async () => {\n const bot = new sdk.BotDefinition({\n actions: {\n 'plugin#action': {\n input: { schema: sdk.z.object({}) },\n output: { schema: sdk.z.object({}) },\n },\n },\n })\n\n expect(() => validateBotDefinition(bot)).not.toThrowError()\n })\n\n it('should allow plugin prefix in event names', async () => {\n const bot = new sdk.BotDefinition({\n events: {\n 'plugin#event': {\n schema: sdk.z.object({}),\n },\n },\n })\n\n expect(() => validateBotDefinition(bot)).not.toThrowError()\n })\n\n it('should allow plugin prefix in state names', async () => {\n const bot = new sdk.BotDefinition({\n states: {\n 'plugin#state': {\n type: 'bot',\n schema: sdk.z.object({}),\n },\n },\n })\n\n expect(() => validateBotDefinition(bot)).not.toThrowError()\n })\n\n it('should throw an error if plugin prefix is not in camelCase', async () => {\n expect(() =>\n validateBotDefinition(\n new sdk.BotDefinition({\n actions: {\n 'my-plugin#actionName': {\n input: { schema: sdk.z.object({}) },\n output: { schema: sdk.z.object({}) },\n },\n },\n })\n )\n ).toThrowError(errors.BotpressCLIError)\n\n expect(() =>\n validateBotDefinition(\n new sdk.BotDefinition({\n events: {\n 'my-plugin#eventName': {\n schema: sdk.z.object({}),\n },\n },\n })\n )\n ).toThrowError(errors.BotpressCLIError)\n\n expect(() =>\n validateBotDefinition(\n new sdk.BotDefinition({\n states: {\n 'my-plugin#stateName': {\n type: 'bot',\n schema: sdk.z.object({}),\n },\n },\n })\n )\n ).toThrowError(errors.BotpressCLIError)\n })\n})\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,UAAqB;AACrB,aAAwB;AACxB,oBAAqC;AACrC,0BAAsC;AAEtC,uBAAS,WAAW,yBAAyB,MAAM;AACjD,wBAAG,8DAA8D,YAAY;AAC3E,UAAM,MAAM,IAAI,IAAI,cAAc;AAAA,MAChC,SAAS;AAAA,QACP,kBAAkB;AAAA,UAChB,OAAO,EAAE,QAAQ,IAAI,EAAE,OAAO,CAAC,CAAC,EAAE;AAAA,UA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AAAA,EACxC,CAAC;AACH,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -71,14 +71,16 @@ class CLIPrompt {
|
|
|
71
71
|
this._logger.debug(`Return default (non-interactive mode): ${message}`);
|
|
72
72
|
return opts?.default;
|
|
73
73
|
}
|
|
74
|
+
const isNumber = typeof opts?.choices?.[0]?.value === "number";
|
|
75
|
+
const transformedChoices = isNumber ? opts?.choices?.map((c) => ({ ...c, value: c.value === 0 ? Symbol.for("0") : c.value })) : opts?.choices;
|
|
74
76
|
const { prompted } = await this._prompts({
|
|
75
77
|
type: "autocomplete",
|
|
76
78
|
name: "prompted",
|
|
77
79
|
message,
|
|
78
80
|
initial: opts?.initial?.value,
|
|
79
|
-
choices:
|
|
81
|
+
choices: transformedChoices
|
|
80
82
|
});
|
|
81
|
-
return prompted ? prompted : void 0;
|
|
83
|
+
return prompted !== void 0 ? isNumber && prompted === Symbol.for("0") ? 0 : prompted : void 0;
|
|
82
84
|
}
|
|
83
85
|
async text(message, opts = {}) {
|
|
84
86
|
if (this._props.confirm) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/prompt-utils.ts"],
|
|
4
|
-
"sourcesContent": ["import prompts from 'prompts'\nimport type { Logger } from '../logger'\n\nexport type CLIPromptsProps = {\n confirm: boolean\n}\n\nexport type CLIPromptsChoice<V extends
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;
|
|
4
|
+
"sourcesContent": ["import prompts from 'prompts'\nimport type { Logger } from '../logger'\n\nexport type CLIPromptsProps = {\n confirm: boolean\n}\n\ntype ChoiceValueType = string | number\n\nexport type CLIPromptsChoice<V extends ChoiceValueType> = {\n title: string\n value: V\n}\n\ntype PasswordOptions = Partial<{\n default: string | undefined\n initial: string\n}>\ntype SelectOptions<V extends ChoiceValueType> = Partial<{\n default: V | undefined\n initial: CLIPromptsChoice<V>\n choices: CLIPromptsChoice<V>[]\n}>\ntype TextOptions = Partial<{\n default: string | undefined\n initial: string\n}>\n\nexport class CLIPrompt {\n public constructor(\n private _props: CLIPromptsProps,\n private _logger: Logger\n ) {}\n\n public async confirm(message: string): Promise<boolean> {\n if (this._props.confirm) {\n this._logger.debug(`Confirming automatically (non-interactive mode): ${message}`)\n return true\n }\n\n const { confirm } = await this._prompts({\n type: 'confirm',\n name: 'confirm',\n message,\n initial: false,\n })\n\n if (!confirm) {\n return false\n }\n return true\n }\n\n public async password(message: string, opts: PasswordOptions = {}): Promise<string | undefined> {\n if (this._props.confirm) {\n this._logger.debug(`Return default (non-interactive mode): ${message}`)\n return opts?.default\n }\n\n const { prompted } = await this._prompts({\n type: 'password',\n name: 'prompted',\n message,\n initial: opts?.initial,\n })\n\n return prompted ? prompted : undefined\n }\n\n public async select<V extends ChoiceValueType = string>(\n message: string,\n opts: SelectOptions<V> = {}\n ): Promise<V | undefined> {\n if (this._props.confirm) {\n this._logger.debug(`Return default (non-interactive mode): ${message}`)\n return opts?.default\n }\n\n // NOTE: whilst Prompts supports string, number, date and boolean values for\n // choices, it behaves unexpectedly when the value is a number and is\n // equal to 0. To work around this, we convert the value to a symbol\n // if it is 0, and then convert it back to a number if it was 0.\n\n const isNumber = typeof opts?.choices?.[0]?.value === 'number'\n const transformedChoices = isNumber\n ? opts?.choices?.map((c) => ({ ...c, value: c.value === 0 ? Symbol.for('0') : c.value }))\n : opts?.choices\n\n const { prompted } = await this._prompts({\n type: 'autocomplete',\n name: 'prompted',\n message,\n initial: opts?.initial?.value,\n choices: transformedChoices as prompts.PromptObject['choices'],\n })\n\n return prompted !== undefined ? (isNumber && prompted === Symbol.for('0') ? 0 : prompted) : undefined\n }\n\n public async text(message: string, opts: TextOptions = {}): Promise<string | undefined> {\n if (this._props.confirm) {\n this._logger.debug(`Return default (non-interactive mode): ${message}`)\n return opts?.default\n }\n\n const { prompted } = await this._prompts({\n type: 'text',\n name: 'prompted',\n message,\n initial: opts?.initial,\n })\n\n return prompted ? prompted : undefined\n }\n\n private _prompts = (...args: Parameters<typeof prompts>): ReturnType<typeof prompts> => {\n this._logger.cleanup()\n return prompts(...args)\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;AA4Bb,MAAM,UAAU;AAAA,EACd,YACG,QACA,SACR;AAFQ;AACA;AAAA,EACP;AAAA,EAEH,MAAa,QAAQ,SAAmC;AACtD,QAAI,KAAK,OAAO,SAAS;AACvB,WAAK,QAAQ,MAAM,oDAAoD,SAAS;AAChF,aAAO;AAAA,IACT;AAEA,UAAM,EAAE,QAAQ,IAAI,MAAM,KAAK,SAAS;AAAA,MACtC,MAAM;AAAA,MACN,MAAM;AAAA,MACN;AAAA,MACA,SAAS;AAAA,IACX,CAAC;AAED,QAAI,CAAC,SAAS;AACZ,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT;AAAA,EAEA,MAAa,SAAS,SAAiB,OAAwB,CAAC,GAAgC;AAC9F,QAAI,KAAK,OAAO,SAAS;AACvB,WAAK,QAAQ,MAAM,0CAA0C,SAAS;AACtE,aAAO,MAAM;AAAA,IACf;AAEA,UAAM,EAAE,SAAS,IAAI,MAAM,KAAK,SAAS;AAAA,MACvC,MAAM;AAAA,MACN,MAAM;AAAA,MACN;AAAA,MACA,SAAS,MAAM;AAAA,IACjB,CAAC;AAED,WAAO,WAAW,WAAW;AAAA,EAC/B;AAAA,EAEA,MAAa,OACX,SACA,OAAyB,CAAC,GACF;AACxB,QAAI,KAAK,OAAO,SAAS;AACvB,WAAK,QAAQ,MAAM,0CAA0C,SAAS;AACtE,aAAO,MAAM;AAAA,IACf;AAOA,UAAM,WAAW,OAAO,MAAM,UAAU,CAAC,GAAG,UAAU;AACtD,UAAM,qBAAqB,WACvB,MAAM,SAAS,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,EAAE,UAAU,IAAI,OAAO,IAAI,GAAG,IAAI,EAAE,MAAM,EAAE,IACtF,MAAM;AAEV,UAAM,EAAE,SAAS,IAAI,MAAM,KAAK,SAAS;AAAA,MACvC,MAAM;AAAA,MACN,MAAM;AAAA,MACN;AAAA,MACA,SAAS,MAAM,SAAS;AAAA,MACxB,SAAS;AAAA,IACX,CAAC;AAED,WAAO,aAAa,SAAa,YAAY,aAAa,OAAO,IAAI,GAAG,IAAI,IAAI,WAAY;AAAA,EAC9F;AAAA,EAEA,MAAa,KAAK,SAAiB,OAAoB,CAAC,GAAgC;AACtF,QAAI,KAAK,OAAO,SAAS;AACvB,WAAK,QAAQ,MAAM,0CAA0C,SAAS;AACtE,aAAO,MAAM;AAAA,IACf;AAEA,UAAM,EAAE,SAAS,IAAI,MAAM,KAAK,SAAS;AAAA,MACvC,MAAM;AAAA,MACN,MAAM;AAAA,MACN;AAAA,MACA,SAAS,MAAM;AAAA,IACjB,CAAC;AAED,WAAO,WAAW,WAAW;AAAA,EAC/B;AAAA,EAEQ,WAAW,IAAI,SAAiE;AACtF,SAAK,QAAQ,QAAQ;AACrB,eAAO,eAAAA,SAAQ,GAAG,IAAI;AAAA,EACxB;AACF;",
|
|
6
6
|
"names": ["prompts"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botpress/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "Botpress CLI",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "pnpm run bundle && pnpm run template:gen",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@apidevtools/json-schema-ref-parser": "^11.7.0",
|
|
23
23
|
"@botpress/chat": "0.5.1",
|
|
24
|
-
"@botpress/client": "0.
|
|
25
|
-
"@botpress/sdk": "3.
|
|
24
|
+
"@botpress/client": "0.48.0",
|
|
25
|
+
"@botpress/sdk": "3.5.0",
|
|
26
26
|
"@bpinternal/const": "^0.1.0",
|
|
27
27
|
"@bpinternal/tunnel": "^0.1.1",
|
|
28
28
|
"@bpinternal/yargs-extra": "^0.0.3",
|
|
@@ -36,7 +36,6 @@
|
|
|
36
36
|
"bluebird": "^3.7.2",
|
|
37
37
|
"boxen": "5.1.2",
|
|
38
38
|
"chalk": "^4.1.2",
|
|
39
|
-
"chokidar": "^3.5.3",
|
|
40
39
|
"dotenv": "^16.4.4",
|
|
41
40
|
"esbuild": "^0.16.12",
|
|
42
41
|
"handlebars": "^4.7.8",
|
|
@@ -44,11 +43,9 @@
|
|
|
44
43
|
"lodash": "^4.17.21",
|
|
45
44
|
"prettier": "^3.4.2",
|
|
46
45
|
"prompts": "^2.4.2",
|
|
47
|
-
"radash": "^9.5.0",
|
|
48
46
|
"semver": "^7.3.8",
|
|
49
47
|
"uuid": "^9.0.0",
|
|
50
48
|
"verror": "^1.10.1",
|
|
51
|
-
"winston": "^3.8.2",
|
|
52
49
|
"yn": "^4.0.0"
|
|
53
50
|
},
|
|
54
51
|
"devDependencies": {
|
|
@@ -7,12 +7,14 @@ import * as events from './events'
|
|
|
7
7
|
import * as states from './states'
|
|
8
8
|
import * as actions from './actions'
|
|
9
9
|
import * as tables from './tables/index'
|
|
10
|
+
import * as workflows from './workflows'
|
|
10
11
|
|
|
11
12
|
export * as integrations from './integrations/index'
|
|
12
13
|
export * as events from './events/index'
|
|
13
14
|
export * as states from './states/index'
|
|
14
15
|
export * as actions from './actions'
|
|
15
16
|
export * as tables from './tables/index'
|
|
17
|
+
export * as workflows from './workflows'
|
|
16
18
|
|
|
17
19
|
export type TBot = {
|
|
18
20
|
integrations: integrations.Integrations
|
|
@@ -20,4 +22,5 @@ export type TBot = {
|
|
|
20
22
|
states: states.States
|
|
21
23
|
actions: actions.Actions
|
|
22
24
|
tables: tables.Tables
|
|
25
|
+
workflows: workflows.Workflows
|
|
23
26
|
}
|
|
@@ -9,6 +9,7 @@ import * as events from './events'
|
|
|
9
9
|
import * as states from './states'
|
|
10
10
|
import * as actions from './actions'
|
|
11
11
|
import * as tables from './tables/index'
|
|
12
|
+
import * as workflows from './workflows'
|
|
12
13
|
|
|
13
14
|
export * as integrations from './integrations/index'
|
|
14
15
|
export * as interfaces from './interfaces/index'
|
|
@@ -17,8 +18,11 @@ export * as events from './events/index'
|
|
|
17
18
|
export * as states from './states/index'
|
|
18
19
|
export * as actions from './actions'
|
|
19
20
|
export * as tables from './tables/index'
|
|
21
|
+
export * as workflows from './workflows'
|
|
20
22
|
|
|
21
23
|
export type TPlugin = {
|
|
24
|
+
name: "empty-plugin"
|
|
25
|
+
version: "1.0.0"
|
|
22
26
|
integrations: integrations.Integrations
|
|
23
27
|
interfaces: interfaces.Interfaces
|
|
24
28
|
configuration: configuration.Configuration
|
|
@@ -26,4 +30,5 @@ export type TPlugin = {
|
|
|
26
30
|
states: states.States
|
|
27
31
|
actions: actions.Actions
|
|
28
32
|
tables: tables.Tables
|
|
33
|
+
workflows: workflows.Workflows
|
|
29
34
|
}
|