@botpress/cli 5.2.2 → 5.4.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.
@@ -1,44 +1,44 @@
1
1
 
2
- > @botpress/cli@5.2.2 build /home/runner/work/botpress/botpress/packages/cli
2
+ > @botpress/cli@5.4.0 build /home/runner/work/botpress/botpress/packages/cli
3
3
  > pnpm run build:types && pnpm run bundle && pnpm run template:gen
4
4
 
5
5
 
6
- > @botpress/cli@5.2.2 build:types /home/runner/work/botpress/botpress/packages/cli
6
+ > @botpress/cli@5.4.0 build:types /home/runner/work/botpress/botpress/packages/cli
7
7
  > tsc -p ./tsconfig.build.json
8
8
 
9
9
 
10
- > @botpress/cli@5.2.2 bundle /home/runner/work/botpress/botpress/packages/cli
10
+ > @botpress/cli@5.4.0 bundle /home/runner/work/botpress/botpress/packages/cli
11
11
  > ts-node -T build.ts
12
12
 
13
13
 
14
- > @botpress/cli@5.2.2 template:gen /home/runner/work/botpress/botpress/packages/cli
14
+ > @botpress/cli@5.4.0 template:gen /home/runner/work/botpress/botpress/packages/cli
15
15
  > pnpm -r --stream -F @bp-templates/* exec bp gen
16
16
 
17
- 🤖 Botpress CLI v5.2.2
17
+ 🤖 Botpress CLI v5.4.0
18
+ 🤖 Botpress CLI v5.4.0
18
19
  ● Checking if cli is up to date
19
- 🤖 Botpress CLI v5.2.2
20
20
  ● Checking if cli is up to date
21
- 🤖 Botpress CLI v5.2.2
21
+ 🤖 Botpress CLI v5.4.0
22
22
  ● Checking if cli is up to date
23
- 🤖 Botpress CLI v5.2.2
23
+ 🤖 Botpress CLI v5.4.0
24
24
  ● Checking if cli is up to date
25
25
  ● Checking if sdk is up to date
26
26
  ● Checking if sdk is up to date
27
27
  ● Checking if sdk is up to date
28
28
  ● Checking if sdk is up to date
29
- ○ Generating typings for plugin empty-plugin...
30
29
  ○ Generating typings for bot...
31
- ○ Generating typings for integration hello-world...
32
30
  ✓ Typings available at .botpress
33
31
 
32
+ ○ Generating typings for plugin empty-plugin...
34
33
  ✓ Typings available at .botpress
35
34
 
36
35
  ○ Generating typings for integration empty-integration...
36
+ ○ Generating typings for integration hello-world...
37
37
  ✓ Typings available at .botpress
38
38
 
39
39
  ✓ Typings available at .botpress
40
40
 
41
- 🤖 Botpress CLI v5.2.2
41
+ 🤖 Botpress CLI v5.4.0
42
42
  ● Checking if cli is up to date
43
43
  ● Checking if sdk is up to date
44
44
  ○ Generating typings for integration webhook-message...
@@ -239,9 +239,9 @@ class ProjectCommand extends import_global_command.GlobalCommand {
239
239
  this.logger.log("Integrations:");
240
240
  for (const [alias, integration] of Object.entries(bot.integrations)) {
241
241
  if (integration.enabled) {
242
- this.logger.log(`${alias}:`, { prefix: { symbol: "\u2192", indent: 2 } });
242
+ this.logger.log(`${alias} ${integration.version}:`, { prefix: { symbol: "\u2192", indent: 2 } });
243
243
  } else {
244
- this.logger.log(`${alias} ${import_chalk.default.italic("(disabled)")}:`, {
244
+ this.logger.log(`${alias} ${integration.version} ${import_chalk.default.italic("(disabled)")}:`, {
245
245
  prefix: { symbol: "\u2192", indent: 2 }
246
246
  });
247
247
  }
@@ -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 chalk from 'chalk'\nimport fs from 'fs'\nimport _ from 'lodash'\nimport semver from 'semver'\nimport * as apiUtils from '../api'\nimport * as codegen from '../code-generation'\nimport * as config from '../config'\nimport * as consts from '../consts'\nimport * as errors from '../errors'\nimport { validateIntegrationDefinition, validateBotDefinition } 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; tunnelId: string }\n\ntype ConfigurableProjectPaths = { workDir: string }\ntype ConstantProjectPaths = typeof consts.fromWorkDir\ntype AllProjectPaths = ConfigurableProjectPaths & ConstantProjectPaths\n\ntype LintIgnoredConfig = { bpLintDisabled?: boolean }\n\nexport type ProjectType = ProjectDefinition['type']\nexport type ProjectDefinition = LintIgnoredConfig &\n (\n | { type: 'integration'; definition: sdk.IntegrationDefinition }\n | { type: 'interface'; definition: sdk.InterfaceDefinition }\n | { type: 'bot'; definition: sdk.BotDefinition }\n | { type: 'plugin'; definition: sdk.PluginDefinition }\n )\n\ntype ProjectDefinitionResolver<T> = () => Promise<LintIgnoredConfig & T>\n\nexport type ProjectDefinitionLazy =\n | {\n projectType: 'integration'\n resolveProjectDefinition: ProjectDefinitionResolver<{\n type: 'integration'\n definition: sdk.IntegrationDefinition\n }>\n }\n | {\n projectType: 'bot'\n resolveProjectDefinition: ProjectDefinitionResolver<{ type: 'bot'; definition: sdk.BotDefinition }>\n }\n | {\n projectType: 'interface'\n resolveProjectDefinition: ProjectDefinitionResolver<{ type: 'interface'; definition: sdk.InterfaceDefinition }>\n }\n | {\n projectType: 'plugin'\n resolveProjectDefinition: ProjectDefinitionResolver<{ type: 'plugin'; definition: sdk.PluginDefinition }>\n }\n\ntype UpdatedBot = client.Bot\n\ntype ClientIntegrationDefinitions = Record<string, client.Integration>\ntype ClientIntegration = client.Bot['integrations'][string]\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 super({\n workDir: absWorkDir,\n ..._.mapValues(consts.fromWorkDir, (p) => utils.path.absoluteFrom(absWorkDir, p)),\n })\n }\n}\n\nexport class ProjectDefinitionContext {\n private _codeCache: Map<string, object> = new Map()\n private _buildContext: utils.esbuild.BuildEntrypointContext = new utils.esbuild.BuildEntrypointContext()\n\n public getOrResolveDefinition<T extends object>(code: string): T {\n const definition = this._codeCache.get(code)\n if (definition) {\n return definition as T\n }\n const result = utils.require.requireJsCode<{ default: object }>(code)\n this._codeCache.set(code, result.default)\n return result.default as T\n }\n\n public rebuildEntrypoint(...args: Parameters<utils.esbuild.BuildEntrypointContext['rebuild']>) {\n return this._buildContext.rebuild(...args)\n }\n}\n\ntype ResolvedDependency = { id: string }\ntype DependencyCacheKey = `${'integration' | 'plugin' | 'interface'}:${string}@${string}`\n\nexport abstract class ProjectCommand<C extends ProjectCommandDefinition> extends GlobalCommand<C> {\n protected projectContext: ProjectDefinitionContext = new ProjectDefinitionContext()\n private _dependencyCache = new Map<DependencyCacheKey, ResolvedDependency>()\n\n public setProjectContext(projectContext: ProjectDefinitionContext) {\n this.projectContext = projectContext\n return this\n }\n\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 private _readProjectType(projectPaths: ProjectPaths): ProjectType {\n const abs = projectPaths.abs\n if (fs.existsSync(abs.integrationDefinition)) {\n return 'integration'\n }\n if (fs.existsSync(abs.interfaceDefinition)) {\n return 'interface'\n }\n if (fs.existsSync(abs.botDefinition)) {\n return 'bot'\n }\n if (fs.existsSync(abs.pluginDefinition)) {\n return 'plugin'\n }\n throw new errors.UnsupportedProjectType()\n }\n\n protected readProjectDefinitionFromFS(): ProjectDefinitionLazy {\n try {\n const type = this._readProjectType(this.projectPaths)\n if (type === 'integration') {\n return {\n projectType: 'integration',\n resolveProjectDefinition: async () => ({\n type: 'integration',\n ...(await this._readIntegrationDefinitionFromFS(this.projectPaths)),\n }),\n }\n }\n if (type === 'plugin') {\n return {\n projectType: 'plugin',\n resolveProjectDefinition: async () => ({\n type: 'plugin',\n ...(await this._readPluginDefinitionFromFS(this.projectPaths)),\n }),\n }\n }\n if (type === 'interface') {\n return {\n projectType: 'interface',\n resolveProjectDefinition: async () => ({\n type: 'interface',\n ...(await this._readInterfaceDefinitionFromFS(this.projectPaths)),\n }),\n }\n }\n if (type === 'bot') {\n return {\n projectType: 'bot',\n resolveProjectDefinition: async () => ({\n type: 'bot',\n ...(await this._readBotDefinitionFromFS(this.projectPaths)),\n }),\n }\n }\n } catch (thrown: unknown) {\n throw errors.BotpressCLIError.wrap(thrown, 'Error while reading project definition')\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<{ definition: sdk.IntegrationDefinition } & LintIgnoredConfig> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.integrationDefinition)) {\n throw new errors.BotpressCLIError('Could not read integration definition')\n }\n\n const bpLintDisabled = await this._isBpLintDisabled(abs.integrationDefinition)\n\n const { outputFiles } = await this.projectContext.rebuildEntrypoint({\n absWorkingDir: abs.workDir,\n entrypoint: rel.integrationDefinition,\n })\n\n const artifact = outputFiles?.[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read integration definition')\n }\n\n const definition = this.projectContext.getOrResolveDefinition<sdk.IntegrationDefinition>(artifact.text)\n validateIntegrationDefinition(definition)\n return { definition, bpLintDisabled }\n }\n\n private async _readInterfaceDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'interfaceDefinition'>\n ): Promise<{ definition: sdk.InterfaceDefinition } & LintIgnoredConfig> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.interfaceDefinition)) {\n throw new errors.BotpressCLIError('Could not read interface definition')\n }\n\n const bpLintDisabled = await this._isBpLintDisabled(abs.interfaceDefinition)\n\n const { outputFiles } = await this.projectContext.rebuildEntrypoint({\n absWorkingDir: abs.workDir,\n entrypoint: rel.interfaceDefinition,\n })\n\n const artifact = outputFiles?.[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read interface definition')\n }\n\n const definition = this.projectContext.getOrResolveDefinition<sdk.InterfaceDefinition>(artifact.text)\n\n return { definition, bpLintDisabled }\n }\n\n private async _readBotDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'botDefinition'>\n ): Promise<{ definition: sdk.BotDefinition } & LintIgnoredConfig> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.botDefinition)) {\n throw new errors.BotpressCLIError('Could not read bot definition')\n }\n\n const bpLintDisabled = await this._isBpLintDisabled(abs.botDefinition)\n\n const { outputFiles } = await this.projectContext.rebuildEntrypoint({\n absWorkingDir: abs.workDir,\n entrypoint: rel.botDefinition,\n })\n\n const artifact = outputFiles?.[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read bot definition')\n }\n\n const definition = this.projectContext.getOrResolveDefinition<sdk.BotDefinition>(artifact.text)\n validateBotDefinition(definition)\n return { definition, bpLintDisabled }\n }\n\n private async _readPluginDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'pluginDefinition'>\n ): Promise<{ definition: sdk.PluginDefinition } & LintIgnoredConfig> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.pluginDefinition)) {\n throw new errors.BotpressCLIError('Could not read plugin definition')\n }\n\n const bpLintDisabled = await this._isBpLintDisabled(abs.pluginDefinition)\n\n const { outputFiles } = await this.projectContext.rebuildEntrypoint({\n absWorkingDir: abs.workDir,\n entrypoint: rel.pluginDefinition,\n })\n\n const artifact = outputFiles?.[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read plugin definition')\n }\n\n const definition = this.projectContext.getOrResolveDefinition<sdk.PluginDefinition>(artifact.text)\n // TODO: validate plugin definition\n return { definition, bpLintDisabled }\n }\n\n private async _isBpLintDisabled(definitionPath: string): Promise<boolean> {\n const tsContent = await fs.promises.readFile(definitionPath, 'utf-8')\n const regex = /\\/\\* bplint-disable \\*\\//\n return regex.test(tsContent)\n }\n\n protected async displayIntegrationUrls({ api, bot }: { api: apiUtils.ApiClient; bot: client.Bot }) {\n if (!_.keys(bot.integrations).length) {\n this.logger.debug('No integrations in bot')\n return\n }\n\n const integrationDefinitions = await utils.records.mapValuesAsync(bot.integrations, async (integration) =>\n api.getPublicOrPrivateIntegration({\n type: 'id',\n id: integration.id,\n })\n )\n\n this.logger.log('Integrations:')\n for (const [alias, integration] of Object.entries(bot.integrations)) {\n if (integration.enabled) {\n this.logger.log(`${alias}:`, { prefix: { symbol: '\u2192', indent: 2 } })\n } else {\n this.logger.log(`${alias} ${chalk.italic('(disabled)')}:`, {\n prefix: { symbol: '\u2192', indent: 2 },\n })\n }\n\n const integrationDefinition = integrationDefinitions[alias]\n const linkTemplateScript = integrationDefinition\n ? this._getLinkTemplateScript({ integration, integrationDefinition })\n : undefined\n this._displayWebhookUrl({ integration, integrationDefinition, linkTemplateScript })\n if (!integrationDefinition) {\n this.logger.debug(\n `No integration definition for integration ${alias} (${integration.name}, ${integration.id}), skipping OAuth or Sandbox links`\n )\n this.logger.line().commit()\n continue\n }\n const isSandbox =\n integration.configurationType === 'sandbox' && !!integrationDefinition.sandbox?.identifierExtractScript\n const showLink = !!linkTemplateScript && (isSandbox || !!integrationDefinition.identifier?.extractScript)\n if (showLink && isSandbox) {\n await this._displaySandboxLinkAndCode({ integration, alias, bot, api, linkTemplateScript })\n } else if (showLink) {\n this._displayAuthorizationLink({ integration, api, linkTemplateScript })\n }\n this.logger.line().commit()\n }\n }\n\n private _getLinkTemplateScript({\n integration,\n integrationDefinition,\n }: {\n integration: ClientIntegration\n integrationDefinition?: ClientIntegrationDefinitions[string]\n }) {\n const config =\n integration.configurationType === null\n ? integrationDefinition?.configuration\n : integrationDefinition?.configurations[integration.configurationType]\n return config?.identifier?.linkTemplateScript\n }\n\n private _displayWebhookUrl({\n integration,\n integrationDefinition,\n linkTemplateScript,\n }: {\n integration: ClientIntegration\n integrationDefinition?: ClientIntegrationDefinitions[string]\n linkTemplateScript?: string\n }) {\n const needsWebhook = !(integrationDefinition?.identifier && linkTemplateScript)\n const logFn = (needsWebhook ? this.logger.log : this.logger.debug).bind(this.logger)\n\n if (integration.enabled) {\n logFn(`${chalk.bold('Webhook')}: ${integration.webhookUrl}`, {\n prefix: { symbol: '\u25CF', indent: 4 },\n })\n } else {\n logFn(`Webhook: ${integration.webhookUrl}`, {\n prefix: { symbol: '\u25CB', indent: 4 },\n })\n }\n }\n\n private _displayAuthorizationLink({\n integration,\n api,\n linkTemplateScript,\n }: {\n integration: ClientIntegration\n api: apiUtils.ApiClient\n linkTemplateScript: string\n }) {\n const authorizationLink = this._getAuthorizationLink({ integration, api, linkTemplateScript })\n const isAuthorized = !!integration.identifier\n const authorizationStatus = integration.identifier ? 'Authorized \u2713' : 'Authorize'\n if (integration.enabled && isAuthorized) {\n this.logger.log(`${chalk.bold(authorizationStatus)} : ${authorizationLink}`, {\n prefix: { symbol: '\u25CF', indent: 4 },\n })\n } else {\n this.logger.log(`${authorizationStatus}: ${authorizationLink}`, {\n prefix: { symbol: '\u25CB', indent: 4 },\n })\n }\n }\n\n private _getLinkTemplateArgs({ integration, api }: { integration: ClientIntegration; api: apiUtils.ApiClient }) {\n // These are the values used by the studio\n let env: 'development' | 'preview' | 'production'\n if (api.url.includes(consts.stagingBotpressDomain)) {\n env = 'preview'\n } else if (api.url.includes(consts.productionBotpressDomain)) {\n env = 'production'\n } else {\n env = 'development'\n }\n return {\n env,\n webhookId: integration.webhookId,\n webhookUrl: api.url.replace('api', 'webhook'),\n }\n }\n\n private _getAuthorizationLink({\n integration,\n api,\n linkTemplateScript,\n }: {\n integration: client.Bot['integrations'][string]\n api: apiUtils.ApiClient\n linkTemplateScript: string\n }) {\n return utils.vrl.getStringResult({\n code: linkTemplateScript,\n data: this._getLinkTemplateArgs({ integration, api }),\n })\n }\n\n private _getSandboxLink({\n shareableId,\n integration,\n api,\n linkTemplateScript,\n }: {\n shareableId: string\n integration: ClientIntegration\n api: apiUtils.ApiClient\n linkTemplateScript: string\n }) {\n return utils.vrl.getStringResult({\n code: linkTemplateScript,\n data: { shareableId, ...this._getLinkTemplateArgs({ integration, api }) },\n })\n }\n\n private async _displaySandboxLinkAndCode({\n integration,\n alias,\n bot,\n api,\n linkTemplateScript,\n }: {\n integration: ClientIntegration\n alias: string\n bot: client.Bot\n api: apiUtils.ApiClient\n linkTemplateScript: string\n }) {\n const shareableId = await api.getOrGenerateShareableId(bot.id, integration.id, alias)\n const sandboxLink = this._getSandboxLink({ shareableId, integration, api, linkTemplateScript })\n const sandboxInstruction = `Send '${shareableId}' to ${sandboxLink}`\n if (integration.enabled) {\n this.logger.log(`${chalk.bold('Sandbox')}: ${sandboxInstruction}`, {\n prefix: { symbol: '\u25CF', indent: 4 },\n })\n } else {\n this.logger.log(`Sandbox: ${sandboxInstruction}`, {\n prefix: { symbol: '\u25CB', indent: 4 },\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 prepareCreateIntegrationBody(\n integrationDef: sdk.IntegrationDefinition\n ): Promise<apiUtils.CreateIntegrationRequestBody> {\n const partialBody = await apiUtils.prepareCreateIntegrationBody(integrationDef)\n\n let code: string | undefined = undefined\n if (fs.existsSync(this.projectPaths.abs.outFileCJS)) {\n code = await this.readProjectFile(this.projectPaths.abs.outFileCJS)\n }\n\n const icon = await this.readProjectFile(integrationDef.icon, 'base64')\n const readme = await this.readProjectFile(integrationDef.readme, 'base64')\n const extractScript = await this.readProjectFile(integrationDef.identifier?.extractScript)\n const fallbackHandlerScript = await this.readProjectFile(integrationDef.identifier?.fallbackHandlerScript)\n return {\n ...partialBody,\n code,\n icon,\n readme,\n identifier: {\n extractScript,\n fallbackHandlerScript,\n },\n configuration: integrationDef.configuration\n ? {\n schema: await utils.schema.mapZodToJsonSchema(integrationDef.configuration, {\n useLegacyZuiTransformer: integrationDef.__advanced?.useLegacyZuiTransformer,\n }),\n identifier: {\n required: integrationDef.configuration.identifier?.required,\n linkTemplateScript: await this.readProjectFile(\n integrationDef.configuration.identifier?.linkTemplateScript\n ),\n },\n }\n : undefined,\n configurations: integrationDef.configurations\n ? await utils.records.mapValuesAsync(integrationDef.configurations, async (configuration) => ({\n title: configuration.title,\n description: configuration.description,\n schema: await utils.schema.mapZodToJsonSchema(configuration, {\n useLegacyZuiTransformer: integrationDef.__advanced?.useLegacyZuiTransformer,\n }),\n identifier: {\n required: configuration.identifier?.required,\n linkTemplateScript: await this.readProjectFile(configuration.identifier?.linkTemplateScript),\n },\n }))\n : undefined,\n }\n }\n\n protected async prepareBotDependencies(\n botDef: sdk.BotDefinition,\n api: apiUtils.ApiClient\n ): Promise<Partial<apiUtils.UpdateBotRequestBody>> {\n const integrations = await this._fetchDependencies({\n deps: botDef.integrations ?? {},\n fetcher: ({ name, version }) => api.getPublicOrPrivateIntegration({ type: 'name', name, version }),\n cacheKey: ({ name, version }) => `integration:${name}@${version}`,\n })\n\n const plugins = await this._fetchDependencies({\n deps: botDef.plugins ?? {},\n fetcher: async ({ name, version }) => await api.getPublicOrPrivatePlugin({ type: 'name', name, version }),\n cacheKey: ({ name, version }) => `plugin:${name}@${version}`,\n })\n\n const pluginsWithBackingIntegrations = await utils.records.mapValuesAsync(plugins, async (plugin) => ({\n ...plugin,\n interfaces: await this._fetchDependencies({\n deps: plugin.interfaces ?? {},\n fetcher: async ({ name, version }) => await api.getPublicOrPrivateIntegration({ name, version, type: 'name' }),\n cacheKey: ({ name, version }) => `interface:${name}@${version}`,\n }),\n integrations: await this._fetchDependencies({\n deps: plugin.integrations ?? {},\n fetcher: async ({ name, version }) => await api.getPublicOrPrivateIntegration({ name, version, type: 'name' }),\n cacheKey: ({ name, version }) => `integration:${name}@${version}`,\n }),\n }))\n\n return {\n integrations: utils.records.mapValues(\n integrations,\n ({ enabled, configurationType, configuration, disabledChannels, id }) =>\n ({\n enabled,\n configurationType,\n configuration,\n disabledChannels,\n integrationId: id,\n }) satisfies NonNullable<apiUtils.UpdateBotRequestBody['integrations']>[string]\n ),\n plugins: utils.records.mapValues(pluginsWithBackingIntegrations, (plugin) => ({\n ...plugin,\n interfaces: utils.records.mapValues(\n plugin.interfaces ?? {},\n (iface) =>\n ({\n integrationId: iface.id,\n integrationAlias: iface.integrationAlias,\n integrationInterfaceAlias: iface.integrationInterfaceAlias,\n }) satisfies NonNullable<\n NonNullable<NonNullable<apiUtils.UpdateBotRequestBody['plugins']>[string]>['interfaces']\n >[string]\n ),\n integrations: utils.records.mapValues(\n plugin.integrations ?? {},\n (integration) =>\n ({\n integrationId: integration.id,\n integrationAlias: integration.integrationAlias,\n }) satisfies NonNullable<\n NonNullable<NonNullable<apiUtils.UpdateBotRequestBody['plugins']>[string]>['integrations']\n >[string]\n ),\n })),\n }\n }\n\n protected async prepareIntegrationDependencies(\n integrationDef: sdk.IntegrationDefinition,\n api: apiUtils.ApiClient\n ): Promise<Partial<apiUtils.CreateIntegrationRequestBody>> {\n const interfaces = await this._fetchDependencies({\n deps: integrationDef.interfaces ?? {},\n fetcher: ({ name, version }) => api.getPublicInterface({ type: 'name', name, version }),\n cacheKey: (dep) => `interface:${dep.name}@${dep.version}`,\n })\n return { interfaces }\n }\n\n protected async preparePluginDependencies(\n pluginDef: sdk.PluginDefinition,\n api: apiUtils.ApiClient\n ): Promise<Partial<apiUtils.CreatePluginRequestBody>> {\n const integrations = await this._fetchDependencies({\n deps: pluginDef.integrations ?? {},\n fetcher: ({ name, version }) => api.getPublicOrPrivateIntegration({ type: 'name', name, version }),\n cacheKey: (dep) => `integration:${dep.name}@${dep.version}`,\n })\n const interfaces = await this._fetchDependencies({\n deps: pluginDef.interfaces ?? {},\n fetcher: ({ name, version }) => api.getPublicInterface({ type: 'name', name, version }),\n cacheKey: (dep) => `interface:${dep.name}@${dep.version}`,\n })\n return {\n dependencies: {\n integrations,\n interfaces,\n },\n }\n }\n\n private _fetchDependencies = async <T extends { id?: string; name: string; version: string }>({\n deps,\n fetcher,\n cacheKey: getCacheKey,\n }: {\n deps: Record<string, T>\n fetcher: (dep: T) => Promise<ResolvedDependency>\n cacheKey: (dep: T) => DependencyCacheKey\n }): Promise<Record<string, T & ResolvedDependency>> => {\n const isRemote = (dep: T): dep is T & ResolvedDependency => dep.id !== undefined\n return utils.records.mapValuesAsync(deps, async (dep): Promise<T & ResolvedDependency> => {\n if (isRemote(dep)) {\n return dep\n }\n\n const cacheKey = getCacheKey(dep)\n const cached = this._dependencyCache.get(cacheKey)\n\n if (cached) {\n return { ...dep, id: cached.id }\n }\n\n const { id } = await fetcher(dep)\n this._dependencyCache.set(cacheKey, { id })\n\n return { ...dep, id }\n })\n }\n\n protected readProjectFile = async (\n filePath: string | undefined,\n encoding: BufferEncoding = 'utf-8'\n ): 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, encoding).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 readProjectPkgJsonResult = await utils.pkgJson.safeReadPackageJson(workDir)\n if (!readProjectPkgJsonResult.success) {\n this.logger.debug(`Could not read package.json at \"${workDir}\": ${readProjectPkgJsonResult.error.message}`)\n return\n }\n\n if (!readProjectPkgJsonResult.pkgJson) {\n this.logger.debug(`Could not find package.json at \"${workDir}\"`)\n return\n }\n\n const { pkgJson: projectPkgJson } = readProjectPkgJsonResult\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.readCLIPkgJson()\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 protected validateIntegrationRegistration(\n updatedBot: UpdatedBot,\n onFailCallback: (failedIntegrations: UpdatedBot['integrations']) => void\n ) {\n let failedIntegrations: UpdatedBot['integrations'] = {}\n for (const [integrationName, integration] of Object.entries(updatedBot.integrations)) {\n if (integration.status === 'registration_failed') {\n failedIntegrations = { ...failedIntegrations, [integrationName]: integration }\n }\n }\n if (Object.ke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GAAG;AAC9C,qBAAe,kBAAkB;AAAA,IACnC;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import type * as client from '@botpress/client'\nimport type * as sdk from '@botpress/sdk'\nimport type { YargsConfig } from '@bpinternal/yargs-extra'\nimport chalk from 'chalk'\nimport fs from 'fs'\nimport _ from 'lodash'\nimport semver from 'semver'\nimport * as apiUtils from '../api'\nimport * as codegen from '../code-generation'\nimport * as config from '../config'\nimport * as consts from '../consts'\nimport * as errors from '../errors'\nimport { validateIntegrationDefinition, validateBotDefinition } 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; tunnelId: string }\n\ntype ConfigurableProjectPaths = { workDir: string }\ntype ConstantProjectPaths = typeof consts.fromWorkDir\ntype AllProjectPaths = ConfigurableProjectPaths & ConstantProjectPaths\n\ntype LintIgnoredConfig = { bpLintDisabled?: boolean }\n\nexport type ProjectType = ProjectDefinition['type']\nexport type ProjectDefinition = LintIgnoredConfig &\n (\n | { type: 'integration'; definition: sdk.IntegrationDefinition }\n | { type: 'interface'; definition: sdk.InterfaceDefinition }\n | { type: 'bot'; definition: sdk.BotDefinition }\n | { type: 'plugin'; definition: sdk.PluginDefinition }\n )\n\ntype ProjectDefinitionResolver<T> = () => Promise<LintIgnoredConfig & T>\n\nexport type ProjectDefinitionLazy =\n | {\n projectType: 'integration'\n resolveProjectDefinition: ProjectDefinitionResolver<{\n type: 'integration'\n definition: sdk.IntegrationDefinition\n }>\n }\n | {\n projectType: 'bot'\n resolveProjectDefinition: ProjectDefinitionResolver<{ type: 'bot'; definition: sdk.BotDefinition }>\n }\n | {\n projectType: 'interface'\n resolveProjectDefinition: ProjectDefinitionResolver<{ type: 'interface'; definition: sdk.InterfaceDefinition }>\n }\n | {\n projectType: 'plugin'\n resolveProjectDefinition: ProjectDefinitionResolver<{ type: 'plugin'; definition: sdk.PluginDefinition }>\n }\n\ntype UpdatedBot = client.Bot\n\ntype ClientIntegrationDefinitions = Record<string, client.Integration>\ntype ClientIntegration = client.Bot['integrations'][string]\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 super({\n workDir: absWorkDir,\n ..._.mapValues(consts.fromWorkDir, (p) => utils.path.absoluteFrom(absWorkDir, p)),\n })\n }\n}\n\nexport class ProjectDefinitionContext {\n private _codeCache: Map<string, object> = new Map()\n private _buildContext: utils.esbuild.BuildEntrypointContext = new utils.esbuild.BuildEntrypointContext()\n\n public getOrResolveDefinition<T extends object>(code: string): T {\n const definition = this._codeCache.get(code)\n if (definition) {\n return definition as T\n }\n const result = utils.require.requireJsCode<{ default: object }>(code)\n this._codeCache.set(code, result.default)\n return result.default as T\n }\n\n public rebuildEntrypoint(...args: Parameters<utils.esbuild.BuildEntrypointContext['rebuild']>) {\n return this._buildContext.rebuild(...args)\n }\n}\n\ntype ResolvedDependency = { id: string }\ntype DependencyCacheKey = `${'integration' | 'plugin' | 'interface'}:${string}@${string}`\n\nexport abstract class ProjectCommand<C extends ProjectCommandDefinition> extends GlobalCommand<C> {\n protected projectContext: ProjectDefinitionContext = new ProjectDefinitionContext()\n private _dependencyCache = new Map<DependencyCacheKey, ResolvedDependency>()\n\n public setProjectContext(projectContext: ProjectDefinitionContext) {\n this.projectContext = projectContext\n return this\n }\n\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 private _readProjectType(projectPaths: ProjectPaths): ProjectType {\n const abs = projectPaths.abs\n if (fs.existsSync(abs.integrationDefinition)) {\n return 'integration'\n }\n if (fs.existsSync(abs.interfaceDefinition)) {\n return 'interface'\n }\n if (fs.existsSync(abs.botDefinition)) {\n return 'bot'\n }\n if (fs.existsSync(abs.pluginDefinition)) {\n return 'plugin'\n }\n throw new errors.UnsupportedProjectType()\n }\n\n protected readProjectDefinitionFromFS(): ProjectDefinitionLazy {\n try {\n const type = this._readProjectType(this.projectPaths)\n if (type === 'integration') {\n return {\n projectType: 'integration',\n resolveProjectDefinition: async () => ({\n type: 'integration',\n ...(await this._readIntegrationDefinitionFromFS(this.projectPaths)),\n }),\n }\n }\n if (type === 'plugin') {\n return {\n projectType: 'plugin',\n resolveProjectDefinition: async () => ({\n type: 'plugin',\n ...(await this._readPluginDefinitionFromFS(this.projectPaths)),\n }),\n }\n }\n if (type === 'interface') {\n return {\n projectType: 'interface',\n resolveProjectDefinition: async () => ({\n type: 'interface',\n ...(await this._readInterfaceDefinitionFromFS(this.projectPaths)),\n }),\n }\n }\n if (type === 'bot') {\n return {\n projectType: 'bot',\n resolveProjectDefinition: async () => ({\n type: 'bot',\n ...(await this._readBotDefinitionFromFS(this.projectPaths)),\n }),\n }\n }\n } catch (thrown: unknown) {\n throw errors.BotpressCLIError.wrap(thrown, 'Error while reading project definition')\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<{ definition: sdk.IntegrationDefinition } & LintIgnoredConfig> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.integrationDefinition)) {\n throw new errors.BotpressCLIError('Could not read integration definition')\n }\n\n const bpLintDisabled = await this._isBpLintDisabled(abs.integrationDefinition)\n\n const { outputFiles } = await this.projectContext.rebuildEntrypoint({\n absWorkingDir: abs.workDir,\n entrypoint: rel.integrationDefinition,\n })\n\n const artifact = outputFiles?.[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read integration definition')\n }\n\n const definition = this.projectContext.getOrResolveDefinition<sdk.IntegrationDefinition>(artifact.text)\n validateIntegrationDefinition(definition)\n return { definition, bpLintDisabled }\n }\n\n private async _readInterfaceDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'interfaceDefinition'>\n ): Promise<{ definition: sdk.InterfaceDefinition } & LintIgnoredConfig> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.interfaceDefinition)) {\n throw new errors.BotpressCLIError('Could not read interface definition')\n }\n\n const bpLintDisabled = await this._isBpLintDisabled(abs.interfaceDefinition)\n\n const { outputFiles } = await this.projectContext.rebuildEntrypoint({\n absWorkingDir: abs.workDir,\n entrypoint: rel.interfaceDefinition,\n })\n\n const artifact = outputFiles?.[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read interface definition')\n }\n\n const definition = this.projectContext.getOrResolveDefinition<sdk.InterfaceDefinition>(artifact.text)\n\n return { definition, bpLintDisabled }\n }\n\n private async _readBotDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'botDefinition'>\n ): Promise<{ definition: sdk.BotDefinition } & LintIgnoredConfig> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.botDefinition)) {\n throw new errors.BotpressCLIError('Could not read bot definition')\n }\n\n const bpLintDisabled = await this._isBpLintDisabled(abs.botDefinition)\n\n const { outputFiles } = await this.projectContext.rebuildEntrypoint({\n absWorkingDir: abs.workDir,\n entrypoint: rel.botDefinition,\n })\n\n const artifact = outputFiles?.[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read bot definition')\n }\n\n const definition = this.projectContext.getOrResolveDefinition<sdk.BotDefinition>(artifact.text)\n validateBotDefinition(definition)\n return { definition, bpLintDisabled }\n }\n\n private async _readPluginDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'pluginDefinition'>\n ): Promise<{ definition: sdk.PluginDefinition } & LintIgnoredConfig> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.pluginDefinition)) {\n throw new errors.BotpressCLIError('Could not read plugin definition')\n }\n\n const bpLintDisabled = await this._isBpLintDisabled(abs.pluginDefinition)\n\n const { outputFiles } = await this.projectContext.rebuildEntrypoint({\n absWorkingDir: abs.workDir,\n entrypoint: rel.pluginDefinition,\n })\n\n const artifact = outputFiles?.[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read plugin definition')\n }\n\n const definition = this.projectContext.getOrResolveDefinition<sdk.PluginDefinition>(artifact.text)\n // TODO: validate plugin definition\n return { definition, bpLintDisabled }\n }\n\n private async _isBpLintDisabled(definitionPath: string): Promise<boolean> {\n const tsContent = await fs.promises.readFile(definitionPath, 'utf-8')\n const regex = /\\/\\* bplint-disable \\*\\//\n return regex.test(tsContent)\n }\n\n protected async displayIntegrationUrls({ api, bot }: { api: apiUtils.ApiClient; bot: client.Bot }) {\n if (!_.keys(bot.integrations).length) {\n this.logger.debug('No integrations in bot')\n return\n }\n\n const integrationDefinitions = await utils.records.mapValuesAsync(bot.integrations, async (integration) =>\n api.getPublicOrPrivateIntegration({\n type: 'id',\n id: integration.id,\n })\n )\n\n this.logger.log('Integrations:')\n for (const [alias, integration] of Object.entries(bot.integrations)) {\n if (integration.enabled) {\n this.logger.log(`${alias} ${integration.version}:`, { prefix: { symbol: '\u2192', indent: 2 } })\n } else {\n this.logger.log(`${alias} ${integration.version} ${chalk.italic('(disabled)')}:`, {\n prefix: { symbol: '\u2192', indent: 2 },\n })\n }\n\n const integrationDefinition = integrationDefinitions[alias]\n const linkTemplateScript = integrationDefinition\n ? this._getLinkTemplateScript({ integration, integrationDefinition })\n : undefined\n this._displayWebhookUrl({ integration, integrationDefinition, linkTemplateScript })\n if (!integrationDefinition) {\n this.logger.debug(\n `No integration definition for integration ${alias} (${integration.name}, ${integration.id}), skipping OAuth or Sandbox links`\n )\n this.logger.line().commit()\n continue\n }\n const isSandbox =\n integration.configurationType === 'sandbox' && !!integrationDefinition.sandbox?.identifierExtractScript\n const showLink = !!linkTemplateScript && (isSandbox || !!integrationDefinition.identifier?.extractScript)\n if (showLink && isSandbox) {\n await this._displaySandboxLinkAndCode({ integration, alias, bot, api, linkTemplateScript })\n } else if (showLink) {\n this._displayAuthorizationLink({ integration, api, linkTemplateScript })\n }\n this.logger.line().commit()\n }\n }\n\n private _getLinkTemplateScript({\n integration,\n integrationDefinition,\n }: {\n integration: ClientIntegration\n integrationDefinition?: ClientIntegrationDefinitions[string]\n }) {\n const config =\n integration.configurationType === null\n ? integrationDefinition?.configuration\n : integrationDefinition?.configurations[integration.configurationType]\n return config?.identifier?.linkTemplateScript\n }\n\n private _displayWebhookUrl({\n integration,\n integrationDefinition,\n linkTemplateScript,\n }: {\n integration: ClientIntegration\n integrationDefinition?: ClientIntegrationDefinitions[string]\n linkTemplateScript?: string\n }) {\n const needsWebhook = !(integrationDefinition?.identifier && linkTemplateScript)\n const logFn = (needsWebhook ? this.logger.log : this.logger.debug).bind(this.logger)\n\n if (integration.enabled) {\n logFn(`${chalk.bold('Webhook')}: ${integration.webhookUrl}`, {\n prefix: { symbol: '\u25CF', indent: 4 },\n })\n } else {\n logFn(`Webhook: ${integration.webhookUrl}`, {\n prefix: { symbol: '\u25CB', indent: 4 },\n })\n }\n }\n\n private _displayAuthorizationLink({\n integration,\n api,\n linkTemplateScript,\n }: {\n integration: ClientIntegration\n api: apiUtils.ApiClient\n linkTemplateScript: string\n }) {\n const authorizationLink = this._getAuthorizationLink({ integration, api, linkTemplateScript })\n const isAuthorized = !!integration.identifier\n const authorizationStatus = integration.identifier ? 'Authorized \u2713' : 'Authorize'\n if (integration.enabled && isAuthorized) {\n this.logger.log(`${chalk.bold(authorizationStatus)} : ${authorizationLink}`, {\n prefix: { symbol: '\u25CF', indent: 4 },\n })\n } else {\n this.logger.log(`${authorizationStatus}: ${authorizationLink}`, {\n prefix: { symbol: '\u25CB', indent: 4 },\n })\n }\n }\n\n private _getLinkTemplateArgs({ integration, api }: { integration: ClientIntegration; api: apiUtils.ApiClient }) {\n // These are the values used by the studio\n let env: 'development' | 'preview' | 'production'\n if (api.url.includes(consts.stagingBotpressDomain)) {\n env = 'preview'\n } else if (api.url.includes(consts.productionBotpressDomain)) {\n env = 'production'\n } else {\n env = 'development'\n }\n return {\n env,\n webhookId: integration.webhookId,\n webhookUrl: api.url.replace('api', 'webhook'),\n }\n }\n\n private _getAuthorizationLink({\n integration,\n api,\n linkTemplateScript,\n }: {\n integration: client.Bot['integrations'][string]\n api: apiUtils.ApiClient\n linkTemplateScript: string\n }) {\n return utils.vrl.getStringResult({\n code: linkTemplateScript,\n data: this._getLinkTemplateArgs({ integration, api }),\n })\n }\n\n private _getSandboxLink({\n shareableId,\n integration,\n api,\n linkTemplateScript,\n }: {\n shareableId: string\n integration: ClientIntegration\n api: apiUtils.ApiClient\n linkTemplateScript: string\n }) {\n return utils.vrl.getStringResult({\n code: linkTemplateScript,\n data: { shareableId, ...this._getLinkTemplateArgs({ integration, api }) },\n })\n }\n\n private async _displaySandboxLinkAndCode({\n integration,\n alias,\n bot,\n api,\n linkTemplateScript,\n }: {\n integration: ClientIntegration\n alias: string\n bot: client.Bot\n api: apiUtils.ApiClient\n linkTemplateScript: string\n }) {\n const shareableId = await api.getOrGenerateShareableId(bot.id, integration.id, alias)\n const sandboxLink = this._getSandboxLink({ shareableId, integration, api, linkTemplateScript })\n const sandboxInstruction = `Send '${shareableId}' to ${sandboxLink}`\n if (integration.enabled) {\n this.logger.log(`${chalk.bold('Sandbox')}: ${sandboxInstruction}`, {\n prefix: { symbol: '\u25CF', indent: 4 },\n })\n } else {\n this.logger.log(`Sandbox: ${sandboxInstruction}`, {\n prefix: { symbol: '\u25CB', indent: 4 },\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 prepareCreateIntegrationBody(\n integrationDef: sdk.IntegrationDefinition\n ): Promise<apiUtils.CreateIntegrationRequestBody> {\n const partialBody = await apiUtils.prepareCreateIntegrationBody(integrationDef)\n\n let code: string | undefined = undefined\n if (fs.existsSync(this.projectPaths.abs.outFileCJS)) {\n code = await this.readProjectFile(this.projectPaths.abs.outFileCJS)\n }\n\n const icon = await this.readProjectFile(integrationDef.icon, 'base64')\n const readme = await this.readProjectFile(integrationDef.readme, 'base64')\n const extractScript = await this.readProjectFile(integrationDef.identifier?.extractScript)\n const fallbackHandlerScript = await this.readProjectFile(integrationDef.identifier?.fallbackHandlerScript)\n return {\n ...partialBody,\n code,\n icon,\n readme,\n identifier: {\n extractScript,\n fallbackHandlerScript,\n },\n configuration: integrationDef.configuration\n ? {\n schema: await utils.schema.mapZodToJsonSchema(integrationDef.configuration, {\n useLegacyZuiTransformer: integrationDef.__advanced?.useLegacyZuiTransformer,\n }),\n identifier: {\n required: integrationDef.configuration.identifier?.required,\n linkTemplateScript: await this.readProjectFile(\n integrationDef.configuration.identifier?.linkTemplateScript\n ),\n },\n }\n : undefined,\n configurations: integrationDef.configurations\n ? await utils.records.mapValuesAsync(integrationDef.configurations, async (configuration) => ({\n title: configuration.title,\n description: configuration.description,\n schema: await utils.schema.mapZodToJsonSchema(configuration, {\n useLegacyZuiTransformer: integrationDef.__advanced?.useLegacyZuiTransformer,\n }),\n identifier: {\n required: configuration.identifier?.required,\n linkTemplateScript: await this.readProjectFile(configuration.identifier?.linkTemplateScript),\n },\n }))\n : undefined,\n }\n }\n\n protected async prepareBotDependencies(\n botDef: sdk.BotDefinition,\n api: apiUtils.ApiClient\n ): Promise<Partial<apiUtils.UpdateBotRequestBody>> {\n const integrations = await this._fetchDependencies({\n deps: botDef.integrations ?? {},\n fetcher: ({ name, version }) => api.getPublicOrPrivateIntegration({ type: 'name', name, version }),\n cacheKey: ({ name, version }) => `integration:${name}@${version}`,\n })\n\n const plugins = await this._fetchDependencies({\n deps: botDef.plugins ?? {},\n fetcher: async ({ name, version }) => await api.getPublicOrPrivatePlugin({ type: 'name', name, version }),\n cacheKey: ({ name, version }) => `plugin:${name}@${version}`,\n })\n\n const pluginsWithBackingIntegrations = await utils.records.mapValuesAsync(plugins, async (plugin) => ({\n ...plugin,\n interfaces: await this._fetchDependencies({\n deps: plugin.interfaces ?? {},\n fetcher: async ({ name, version }) => await api.getPublicOrPrivateIntegration({ name, version, type: 'name' }),\n cacheKey: ({ name, version }) => `interface:${name}@${version}`,\n }),\n integrations: await this._fetchDependencies({\n deps: plugin.integrations ?? {},\n fetcher: async ({ name, version }) => await api.getPublicOrPrivateIntegration({ name, version, type: 'name' }),\n cacheKey: ({ name, version }) => `integration:${name}@${version}`,\n }),\n }))\n\n return {\n integrations: utils.records.mapValues(\n integrations,\n ({ enabled, configurationType, configuration, disabledChannels, id }) =>\n ({\n enabled,\n configurationType,\n configuration,\n disabledChannels,\n integrationId: id,\n }) satisfies NonNullable<apiUtils.UpdateBotRequestBody['integrations']>[string]\n ),\n plugins: utils.records.mapValues(pluginsWithBackingIntegrations, (plugin) => ({\n ...plugin,\n interfaces: utils.records.mapValues(\n plugin.interfaces ?? {},\n (iface) =>\n ({\n integrationId: iface.id,\n integrationAlias: iface.integrationAlias,\n integrationInterfaceAlias: iface.integrationInterfaceAlias,\n }) satisfies NonNullable<\n NonNullable<NonNullable<apiUtils.UpdateBotRequestBody['plugins']>[string]>['interfaces']\n >[string]\n ),\n integrations: utils.records.mapValues(\n plugin.integrations ?? {},\n (integration) =>\n ({\n integrationId: integration.id,\n integrationAlias: integration.integrationAlias,\n }) satisfies NonNullable<\n NonNullable<NonNullable<apiUtils.UpdateBotRequestBody['plugins']>[string]>['integrations']\n >[string]\n ),\n })),\n }\n }\n\n protected async prepareIntegrationDependencies(\n integrationDef: sdk.IntegrationDefinition,\n api: apiUtils.ApiClient\n ): Promise<Partial<apiUtils.CreateIntegrationRequestBody>> {\n const interfaces = await this._fetchDependencies({\n deps: integrationDef.interfaces ?? {},\n fetcher: ({ name, version }) => api.getPublicInterface({ type: 'name', name, version }),\n cacheKey: (dep) => `interface:${dep.name}@${dep.version}`,\n })\n return { interfaces }\n }\n\n protected async preparePluginDependencies(\n pluginDef: sdk.PluginDefinition,\n api: apiUtils.ApiClient\n ): Promise<Partial<apiUtils.CreatePluginRequestBody>> {\n const integrations = await this._fetchDependencies({\n deps: pluginDef.integrations ?? {},\n fetcher: ({ name, version }) => api.getPublicOrPrivateIntegration({ type: 'name', name, version }),\n cacheKey: (dep) => `integration:${dep.name}@${dep.version}`,\n })\n const interfaces = await this._fetchDependencies({\n deps: pluginDef.interfaces ?? {},\n fetcher: ({ name, version }) => api.getPublicInterface({ type: 'name', name, version }),\n cacheKey: (dep) => `interface:${dep.name}@${dep.version}`,\n })\n return {\n dependencies: {\n integrations,\n interfaces,\n },\n }\n }\n\n private _fetchDependencies = async <T extends { id?: string; name: string; version: string }>({\n deps,\n fetcher,\n cacheKey: getCacheKey,\n }: {\n deps: Record<string, T>\n fetcher: (dep: T) => Promise<ResolvedDependency>\n cacheKey: (dep: T) => DependencyCacheKey\n }): Promise<Record<string, T & ResolvedDependency>> => {\n const isRemote = (dep: T): dep is T & ResolvedDependency => dep.id !== undefined\n return utils.records.mapValuesAsync(deps, async (dep): Promise<T & ResolvedDependency> => {\n if (isRemote(dep)) {\n return dep\n }\n\n const cacheKey = getCacheKey(dep)\n const cached = this._dependencyCache.get(cacheKey)\n\n if (cached) {\n return { ...dep, id: cached.id }\n }\n\n const { id } = await fetcher(dep)\n this._dependencyCache.set(cacheKey, { id })\n\n return { ...dep, id }\n })\n }\n\n protected readProjectFile = async (\n filePath: string | undefined,\n encoding: BufferEncoding = 'utf-8'\n ): 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, encoding).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 readProjectPkgJsonResult = await utils.pkgJson.safeReadPackageJson(workDir)\n if (!readProjectPkgJsonResult.success) {\n this.logger.debug(`Could not read package.json at \"${workDir}\": ${readProjectPkgJsonResult.error.message}`)\n return\n }\n\n if (!readProjectPkgJsonResult.pkgJson) {\n this.logger.debug(`Could not find package.json at \"${workDir}\"`)\n return\n }\n\n const { pkgJson: projectPkgJson } = readProjectPkgJsonResult\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.readCLIPkgJson()\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 protected validateIntegrationRegistration(\n updatedBot: UpdatedBot,\n onFailCallback: (failedIntegrations: UpdatedBot['integrations']) => void\n ) {\n let failedIntegrations: UpdatedBot['integrations'] = {}\n for (const [integrationName, integration] of Object.entries(updatedBot.integrations)) {\n if (integration.status === 'registration_failed') {\n failedIntegrations = { ...failedIntegrations, [integrationName]: integration }\n }\n }\n if (Object.keys(failedIntegrations).length > 0) {\n onFailCallback(failedIntegrations)\n }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAkB;AAClB,gBAAe;AACf,oBAAc;AACd,oBAAmB;AACnB,eAA0B;AAC1B,cAAyB;AAEzB,aAAwB;AACxB,aAAwB;AACxB,iBAAqE;AAErE,YAAuB;AACvB,4BAA8B;AAgD9B,MAAM,qBAAqB,MAAM,KAAK,UAAiC;AAAA,EAC9D,YAAY,MAA6C;AAC9D,UAAM,aAAa,MAAM,KAAK,aAAa,MAAM,KAAK,IAAI,GAAG,KAAK,OAAO;AACzE,UAAM;AAAA,MACJ,SAAS;AAAA,MACT,GAAG,cAAAA,QAAE,UAAU,OAAO,aAAa,CAAC,MAAM,MAAM,KAAK,aAAa,YAAY,CAAC,CAAC;AAAA,IAClF,CAAC;AAAA,EACH;AACF;AAEO,MAAM,yBAAyB;AAAA,EAC5B,aAAkC,oBAAI,IAAI;AAAA,EAC1C,gBAAsD,IAAI,MAAM,QAAQ,uBAAuB;AAAA,EAEhG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AG;AAC3C,aAAK,OAAO,MAAM,GAAG,QAAQ,wCAAwC;AACrE;AAAA,MACF;AAEA,WAAK,OAAO,KAAK,aAAAF,QAAM,KAAK,GAAG,QAAQ,yCAAyC,CAAC;AAAA,IACnF,SAAS,QAAQ;AACf,YAAM,MAAM,OAAO,iBAAiB,IAAI,MAAM;AAC9C,WAAK,OAAO,MAAM,yCAAyC,IAAI,OAAO,EAAE;AAAA,IAC1E;AAAA,EACF;AAAA,EACU,gCACR,YACA,gBACA;AACA,QAAI,qBAAiD,CAAC;AACtD,eAAW,CAAC,iBAAiB,WAAW,KAAK,OAAO,QAAQ,WAAW,YAAY,GAAG;AACpF,UAAI,YAAY,WAAW,uBAAuB;AAChD,6BAAqB,EAAE,GAAG,oBAAoB,CAAC,eAAe,GAAG,YAAY;AAAA,MAC/E;AAAA,IACF;AACA,QAAI,OAAO,KAAK,kBAAkB,EAAE,SAAS,GAAG;AAC9C,qBAAe,kBAAkB;AAAA,IACnC;AAAA,EACF;AACF;",
6
6
  "names": ["_", "fs", "chalk", "config", "semver"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/cli",
3
- "version": "5.2.2",
3
+ "version": "5.4.0",
4
4
  "description": "Botpress CLI",
5
5
  "scripts": {
6
6
  "build": "pnpm run build:types && pnpm run bundle && pnpm run template:gen",
@@ -27,7 +27,7 @@
27
27
  "@apidevtools/json-schema-ref-parser": "^11.7.0",
28
28
  "@botpress/chat": "0.5.4",
29
29
  "@botpress/client": "1.29.0",
30
- "@botpress/sdk": "5.1.2",
30
+ "@botpress/sdk": "5.2.0",
31
31
  "@bpinternal/const": "^0.1.0",
32
32
  "@bpinternal/tunnel": "^0.1.1",
33
33
  "@bpinternal/verel": "^0.2.0",
@@ -6,7 +6,7 @@
6
6
  "private": true,
7
7
  "dependencies": {
8
8
  "@botpress/client": "1.29.0",
9
- "@botpress/sdk": "5.1.2"
9
+ "@botpress/sdk": "5.2.0"
10
10
  },
11
11
  "devDependencies": {
12
12
  "@types/node": "^22.16.4",
@@ -7,7 +7,7 @@
7
7
  "private": true,
8
8
  "dependencies": {
9
9
  "@botpress/client": "1.29.0",
10
- "@botpress/sdk": "5.1.2"
10
+ "@botpress/sdk": "5.2.0"
11
11
  },
12
12
  "devDependencies": {
13
13
  "@types/node": "^22.16.4",
@@ -6,7 +6,7 @@
6
6
  },
7
7
  "private": true,
8
8
  "dependencies": {
9
- "@botpress/sdk": "5.1.2"
9
+ "@botpress/sdk": "5.2.0"
10
10
  },
11
11
  "devDependencies": {
12
12
  "@types/node": "^22.16.4",
@@ -7,7 +7,7 @@
7
7
  "private": true,
8
8
  "dependencies": {
9
9
  "@botpress/client": "1.29.0",
10
- "@botpress/sdk": "5.1.2"
10
+ "@botpress/sdk": "5.2.0"
11
11
  },
12
12
  "devDependencies": {
13
13
  "@types/node": "^22.16.4",
@@ -7,7 +7,7 @@
7
7
  "private": true,
8
8
  "dependencies": {
9
9
  "@botpress/client": "1.29.0",
10
- "@botpress/sdk": "5.1.2",
10
+ "@botpress/sdk": "5.2.0",
11
11
  "axios": "^1.6.8"
12
12
  },
13
13
  "devDependencies": {