@botpress/cli 6.8.6 → 6.8.8

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@6.8.6 build /home/runner/work/botpress/botpress/packages/cli
2
+ > @botpress/cli@6.8.8 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@6.8.6 build:types /home/runner/work/botpress/botpress/packages/cli
6
+ > @botpress/cli@6.8.8 build:types /home/runner/work/botpress/botpress/packages/cli
7
7
  > tsc -p ./tsconfig.build.json
8
8
 
9
9
 
10
- > @botpress/cli@6.8.6 bundle /home/runner/work/botpress/botpress/packages/cli
10
+ > @botpress/cli@6.8.8 bundle /home/runner/work/botpress/botpress/packages/cli
11
11
  > ts-node -T build.ts
12
12
 
13
13
 
14
- > @botpress/cli@6.8.6 template:gen /home/runner/work/botpress/botpress/packages/cli
14
+ > @botpress/cli@6.8.8 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 v6.8.6
17
+ 🤖 Botpress CLI v6.8.8
18
18
  ● Checking if cli is up to date
19
- 🤖 Botpress CLI v6.8.6
19
+ 🤖 Botpress CLI v6.8.8
20
20
  ● Checking if cli is up to date
21
- 🤖 Botpress CLI v6.8.6
21
+ 🤖 Botpress CLI v6.8.8
22
22
  ● Checking if cli is up to date
23
- 🤖 Botpress CLI v6.8.6
23
+ 🤖 Botpress CLI v6.8.8
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
+ ○ Generating typings for bot...
29
+ ✓ Typings available at .botpress
30
+
28
31
  ● Checking if sdk is up to date
29
32
  ○ Generating typings for integration hello-world...
30
33
  ○ Generating typings for integration empty-integration...
31
34
  ✓ Typings available at .botpress
32
35
 
33
- ○ Generating typings for plugin empty-plugin...
34
- ✓ Typings available at .botpress
35
-
36
36
  ✓ Typings available at .botpress
37
37
 
38
- ○ Generating typings for bot...
38
+ ○ Generating typings for plugin empty-plugin...
39
39
  ✓ Typings available at .botpress
40
40
 
41
- 🤖 Botpress CLI v6.8.6
41
+ 🤖 Botpress CLI v6.8.8
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...
@@ -771,16 +771,20 @@ class ProjectCommand extends import_global_command.GlobalCommand {
771
771
  }
772
772
  _cloneDefinition = (def, props) => {
773
773
  if (def.type === "integration") {
774
- return new sdk.IntegrationDefinition({ ...def.definition.props, ...props });
774
+ const overrides = props;
775
+ return def.definition.clone?.(overrides) ?? new sdk.IntegrationDefinition({ ...def.definition.props, ...overrides });
775
776
  }
776
777
  if (def.type === "plugin") {
777
- return new sdk.PluginDefinition({ ...def.definition.props, ...props });
778
+ const overrides = props;
779
+ return def.definition.clone?.(overrides) ?? new sdk.PluginDefinition({ ...def.definition.props, ...overrides });
778
780
  }
779
781
  if (def.type === "interface") {
780
- return new sdk.InterfaceDefinition({ ...def.definition.props, ...props });
782
+ const overrides = props;
783
+ return def.definition.clone?.(overrides) ?? new sdk.InterfaceDefinition({ ...def.definition.props, ...overrides });
781
784
  }
782
785
  if (def.type === "bot") {
783
- return new sdk.BotDefinition({ ...def.definition.props, ...props });
786
+ const overrides = props;
787
+ return def.definition.clone?.(overrides) ?? new sdk.BotDefinition({ ...def.definition.props, ...overrides });
784
788
  }
785
789
  def;
786
790
  throw new errors.BotpressCLIError("Unsupported definition type");
@@ -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 * 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 = {\n botId: string\n devId: string\n tunnelId: string\n secrets: {\n [secretName: string]: string\n }\n}\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\ntype ResolvedProjectDefinition =\n | { type: 'bot'; definition: sdk.BotDefinition }\n | { type: 'integration'; definition: sdk.IntegrationDefinition }\n | { type: 'interface'; definition: sdk.InterfaceDefinition }\n | { type: 'plugin'; definition: sdk.PluginDefinition }\n\nexport type ProjectDefinitionLazy =\n | {\n projectType: 'integration'\n resolveProjectDefinition: ProjectDefinitionResolver<Extract<ResolvedProjectDefinition, { type: 'integration' }>>\n }\n | {\n projectType: 'bot'\n resolveProjectDefinition: ProjectDefinitionResolver<Extract<ResolvedProjectDefinition, { type: 'bot' }>>\n }\n | {\n projectType: 'interface'\n resolveProjectDefinition: ProjectDefinitionResolver<Extract<ResolvedProjectDefinition, { type: 'interface' }>>\n }\n | {\n projectType: 'plugin'\n resolveProjectDefinition: ProjectDefinitionResolver<Extract<ResolvedProjectDefinition, { type: 'plugin' }>>\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 public async dispose() {\n // Drop the resolved-definition cache up front so a failed esbuild teardown can't leave stale state behind.\n this._codeCache.clear()\n try {\n await this._buildContext.dispose()\n } catch (thrown: unknown) {\n throw errors.BotpressCLIError.map(thrown)\n }\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 def: { secrets?: Record<string, sdk.SecretDefinition> },\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 } = def\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 the 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\n .mapZodToJsonSchema(integrationDef.configuration, {\n useLegacyZuiTransformer: integrationDef.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: integrationDef.__advanced?.toJSONSchemaOptions,\n })\n .catch((thrown) => {\n throw errors.BotpressCLIError.wrap(\n thrown,\n `Failed to convert ZUI to JSON schema for integration ${integrationDef.name} for configuration`\n )\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(\n integrationDef.configurations,\n async (configuration, configurationName) => ({\n title: configuration.title,\n description: configuration.description,\n schema: await utils.schema\n .mapZodToJsonSchema(configuration, {\n useLegacyZuiTransformer: integrationDef.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: integrationDef.__advanced?.toJSONSchemaOptions,\n })\n .catch((thrown) => {\n throw errors.BotpressCLIError.wrap(\n thrown,\n `Failed to convert ZUI to JSON schema for integration ${integrationDef.name} for configuration ${configurationName}`\n )\n }),\n identifier: {\n required: configuration.identifier?.required,\n linkTemplateScript: await this.readProjectFile(configuration.identifier?.linkTemplateScript),\n },\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 protected async manageWorkspaceHandle(\n api: apiUtils.ApiClient,\n project: Extract<ResolvedProjectDefinition, { type: 'integration' }>\n ): Promise<{ definition: sdk.IntegrationDefinition; workspaceId?: string } | undefined>\n protected async manageWorkspaceHandle(\n api: apiUtils.ApiClient,\n project: Extract<ResolvedProjectDefinition, { type: 'plugin' }>\n ): Promise<{ definition: sdk.PluginDefinition; workspaceId?: string } | undefined>\n protected async manageWorkspaceHandle(\n api: apiUtils.ApiClient,\n project: Extract<ResolvedProjectDefinition, { type: 'integration' | 'plugin' }>\n ): Promise<{ definition: sdk.IntegrationDefinition | sdk.PluginDefinition; workspaceId?: string } | undefined> {\n const { type, definition } = project\n const { name: localName, workspaceHandle: localHandle } = this._parseHandledName(definition.name)\n if (!localHandle && api.isBotpressWorkspace) {\n this.logger.debug('Botpress workspace detected; workspace handle omitted')\n return { definition } // botpress has the right to omit workspace handle\n }\n\n const { handle: remoteHandle, name: workspaceName } = await api.getWorkspace().catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not fetch workspace')\n })\n\n if (localHandle && remoteHandle) {\n let workspaceId: string | undefined = undefined\n if (localHandle !== remoteHandle) {\n const remoteWorkspace = await api.findWorkspaceByHandle(localHandle).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not list workspaces')\n })\n if (!remoteWorkspace) {\n throw new errors.BotpressCLIError(\n `The ${type} handle \"${localHandle}\" is not associated with any of your workspaces.`\n )\n }\n this.logger.warn(\n `Your are logged in to workspace \"${workspaceName}\" but ${type} handle \"${localHandle}\" belongs to \"${remoteWorkspace.name}\".`\n )\n const confirmUseAlternateWorkspace = await this.prompt.confirm(\n `Do you want to deploy ${type} on this workspace instead?`\n )\n if (!confirmUseAlternateWorkspace) {\n throw new errors.BotpressCLIError(\n `Cannot deploy ${type} with handle \"${localHandle}\" on workspace \"${workspaceName}\"`\n )\n }\n\n workspaceId = remoteWorkspace.id\n }\n return { definition, workspaceId }\n }\n\n const workspaceHandleIsMandatoryMsg = `Cannot deploy ${type} without workspace handle`\n\n if (!localHandle && remoteHandle) {\n const confirmAddHandle = await this.prompt.confirm(\n `Your current workspace handle is \"${remoteHandle}\". Do you want to use the name \"${remoteHandle}/${localName}\"?`\n )\n if (!confirmAddHandle) {\n this.logger.log('Aborted')\n return\n }\n const newName = `${remoteHandle}/${localName}`\n return { definition: this._cloneDefinition(project, { name: newName }) }\n }\n\n if (localHandle && !remoteHandle) {\n const { available } = await api.client.checkHandleAvailability({ handle: localHandle }).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not check handle availability')\n })\n\n if (!available) {\n throw new errors.BotpressCLIError(`Handle \"${localHandle}\" is not yours and is not available`)\n }\n\n const confirmClaimHandle = await this.prompt.confirm(\n `Handle \"${localHandle}\" is available. Do you want to claim it for your workspace ${workspaceName}?`\n )\n if (!confirmClaimHandle) {\n throw new errors.BotpressCLIError(workspaceHandleIsMandatoryMsg)\n }\n\n await api.updateWorkspace({ handle: localHandle }).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not claim handle \"${localHandle}\"`)\n })\n\n this.logger.success(`Handle \"${localHandle}\" is now yours!`)\n return { definition }\n }\n\n this.logger.warn(\"It seems you don't have a workspace handle yet.\")\n let claimedHandle: string | undefined = undefined\n do {\n const prompted = await this.prompt.text('Please enter a workspace handle')\n if (!prompted) {\n throw new errors.BotpressCLIError(workspaceHandleIsMandatoryMsg)\n }\n\n const { available, suggestions } = await api.client.checkHandleAvailability({ handle: prompted })\n if (!available) {\n this.logger.warn(`Handle \"${prompted}\" is not available. Suggestions: ${suggestions.join(', ')}`)\n continue\n }\n\n claimedHandle = prompted\n await api.updateWorkspace({ handle: claimedHandle }).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not claim handle \"${claimedHandle}\"`)\n })\n } while (!claimedHandle)\n\n this.logger.success(`Handle \"${claimedHandle}\" is yours!`)\n const newName = `${claimedHandle}/${localName}`\n return { definition: this._cloneDefinition(project, { name: newName }) }\n }\n\n private _cloneDefinition = <T extends ResolvedProjectDefinition>(\n def: T,\n props: Partial<T['definition']['props']>\n ): T['definition'] => {\n if (def.type === 'integration') {\n return new sdk.IntegrationDefinition({ ...def.definition.props, ...props }) as T['definition']\n }\n if (def.type === 'plugin') {\n return new sdk.PluginDefinition({ ...def.definition.props, ...props }) as T['definition']\n }\n if (def.type === 'interface') {\n return new sdk.InterfaceDefinition({ ...def.definition.props, ...props }) as T['definition']\n }\n if (def.type === 'bot') {\n return new sdk.BotDefinition({ ...def.definition.props, ...props }) as T['definition']\n }\n def satisfies never\n throw new errors.BotpressCLIError('Unsupported definition type')\n }\n\n protected _parseHandledName = (artifactName: string): { name: string; workspaceHandle?: string } => {\n const parts = artifactName.split('/')\n if (parts.length > 2) {\n throw new errors.BotpressCLIError(`Invalid name \"${artifactName}\": a single forward slash is allowed`)\n }\n if (parts.length === 2) {\n const [workspaceHandle, name] = parts as [string, string]\n return { name, workspaceHandle }\n }\n const [name] = parts as [string]\n return { name }\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,UAAqB;AAErB,mBAAkB;AAClB,gBAAe;AACf,oBAAc;AACd,oBAAmB;AACnB,eAA0B;AAC1B,cAAyB;AAEzB,aAAwB;AACxB,aAAwB;AACxB,iBAAqE;AAErE,YAAuB;AACvB,4BAA8B;AA0D9B,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,uBAAyC,MAAiB;AAC/D,UAAM,aAAa,KAAK,WAAW,IAAI,IAAI;AAC3C,QAAI,YAAY;AACd,aAAO;AAAA,IACT;AACA,UAAM,SAAS,MAAM,Q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* as client from '@botpress/client'\nimport * 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 = {\n botId: string\n devId: string\n tunnelId: string\n secrets: {\n [secretName: string]: string\n }\n}\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\ntype ResolvedProjectDefinition =\n | { type: 'bot'; definition: sdk.BotDefinition }\n | { type: 'integration'; definition: sdk.IntegrationDefinition }\n | { type: 'interface'; definition: sdk.InterfaceDefinition }\n | { type: 'plugin'; definition: sdk.PluginDefinition }\n\nexport type ProjectDefinitionLazy =\n | {\n projectType: 'integration'\n resolveProjectDefinition: ProjectDefinitionResolver<Extract<ResolvedProjectDefinition, { type: 'integration' }>>\n }\n | {\n projectType: 'bot'\n resolveProjectDefinition: ProjectDefinitionResolver<Extract<ResolvedProjectDefinition, { type: 'bot' }>>\n }\n | {\n projectType: 'interface'\n resolveProjectDefinition: ProjectDefinitionResolver<Extract<ResolvedProjectDefinition, { type: 'interface' }>>\n }\n | {\n projectType: 'plugin'\n resolveProjectDefinition: ProjectDefinitionResolver<Extract<ResolvedProjectDefinition, { type: 'plugin' }>>\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 public async dispose() {\n // Drop the resolved-definition cache up front so a failed esbuild teardown can't leave stale state behind.\n this._codeCache.clear()\n try {\n await this._buildContext.dispose()\n } catch (thrown: unknown) {\n throw errors.BotpressCLIError.map(thrown)\n }\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 def: { secrets?: Record<string, sdk.SecretDefinition> },\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 } = def\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 the 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\n .mapZodToJsonSchema(integrationDef.configuration, {\n useLegacyZuiTransformer: integrationDef.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: integrationDef.__advanced?.toJSONSchemaOptions,\n })\n .catch((thrown) => {\n throw errors.BotpressCLIError.wrap(\n thrown,\n `Failed to convert ZUI to JSON schema for integration ${integrationDef.name} for configuration`\n )\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(\n integrationDef.configurations,\n async (configuration, configurationName) => ({\n title: configuration.title,\n description: configuration.description,\n schema: await utils.schema\n .mapZodToJsonSchema(configuration, {\n useLegacyZuiTransformer: integrationDef.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: integrationDef.__advanced?.toJSONSchemaOptions,\n })\n .catch((thrown) => {\n throw errors.BotpressCLIError.wrap(\n thrown,\n `Failed to convert ZUI to JSON schema for integration ${integrationDef.name} for configuration ${configurationName}`\n )\n }),\n identifier: {\n required: configuration.identifier?.required,\n linkTemplateScript: await this.readProjectFile(configuration.identifier?.linkTemplateScript),\n },\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 protected async manageWorkspaceHandle(\n api: apiUtils.ApiClient,\n project: Extract<ResolvedProjectDefinition, { type: 'integration' }>\n ): Promise<{ definition: sdk.IntegrationDefinition; workspaceId?: string } | undefined>\n protected async manageWorkspaceHandle(\n api: apiUtils.ApiClient,\n project: Extract<ResolvedProjectDefinition, { type: 'plugin' }>\n ): Promise<{ definition: sdk.PluginDefinition; workspaceId?: string } | undefined>\n protected async manageWorkspaceHandle(\n api: apiUtils.ApiClient,\n project: Extract<ResolvedProjectDefinition, { type: 'integration' | 'plugin' }>\n ): Promise<{ definition: sdk.IntegrationDefinition | sdk.PluginDefinition; workspaceId?: string } | undefined> {\n const { type, definition } = project\n const { name: localName, workspaceHandle: localHandle } = this._parseHandledName(definition.name)\n if (!localHandle && api.isBotpressWorkspace) {\n this.logger.debug('Botpress workspace detected; workspace handle omitted')\n return { definition } // botpress has the right to omit workspace handle\n }\n\n const { handle: remoteHandle, name: workspaceName } = await api.getWorkspace().catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not fetch workspace')\n })\n\n if (localHandle && remoteHandle) {\n let workspaceId: string | undefined = undefined\n if (localHandle !== remoteHandle) {\n const remoteWorkspace = await api.findWorkspaceByHandle(localHandle).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not list workspaces')\n })\n if (!remoteWorkspace) {\n throw new errors.BotpressCLIError(\n `The ${type} handle \"${localHandle}\" is not associated with any of your workspaces.`\n )\n }\n this.logger.warn(\n `Your are logged in to workspace \"${workspaceName}\" but ${type} handle \"${localHandle}\" belongs to \"${remoteWorkspace.name}\".`\n )\n const confirmUseAlternateWorkspace = await this.prompt.confirm(\n `Do you want to deploy ${type} on this workspace instead?`\n )\n if (!confirmUseAlternateWorkspace) {\n throw new errors.BotpressCLIError(\n `Cannot deploy ${type} with handle \"${localHandle}\" on workspace \"${workspaceName}\"`\n )\n }\n\n workspaceId = remoteWorkspace.id\n }\n return { definition, workspaceId }\n }\n\n const workspaceHandleIsMandatoryMsg = `Cannot deploy ${type} without workspace handle`\n\n if (!localHandle && remoteHandle) {\n const confirmAddHandle = await this.prompt.confirm(\n `Your current workspace handle is \"${remoteHandle}\". Do you want to use the name \"${remoteHandle}/${localName}\"?`\n )\n if (!confirmAddHandle) {\n this.logger.log('Aborted')\n return\n }\n const newName = `${remoteHandle}/${localName}`\n return { definition: this._cloneDefinition(project, { name: newName }) }\n }\n\n if (localHandle && !remoteHandle) {\n const { available } = await api.client.checkHandleAvailability({ handle: localHandle }).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not check handle availability')\n })\n\n if (!available) {\n throw new errors.BotpressCLIError(`Handle \"${localHandle}\" is not yours and is not available`)\n }\n\n const confirmClaimHandle = await this.prompt.confirm(\n `Handle \"${localHandle}\" is available. Do you want to claim it for your workspace ${workspaceName}?`\n )\n if (!confirmClaimHandle) {\n throw new errors.BotpressCLIError(workspaceHandleIsMandatoryMsg)\n }\n\n await api.updateWorkspace({ handle: localHandle }).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not claim handle \"${localHandle}\"`)\n })\n\n this.logger.success(`Handle \"${localHandle}\" is now yours!`)\n return { definition }\n }\n\n this.logger.warn(\"It seems you don't have a workspace handle yet.\")\n let claimedHandle: string | undefined = undefined\n do {\n const prompted = await this.prompt.text('Please enter a workspace handle')\n if (!prompted) {\n throw new errors.BotpressCLIError(workspaceHandleIsMandatoryMsg)\n }\n\n const { available, suggestions } = await api.client.checkHandleAvailability({ handle: prompted })\n if (!available) {\n this.logger.warn(`Handle \"${prompted}\" is not available. Suggestions: ${suggestions.join(', ')}`)\n continue\n }\n\n claimedHandle = prompted\n await api.updateWorkspace({ handle: claimedHandle }).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not claim handle \"${claimedHandle}\"`)\n })\n } while (!claimedHandle)\n\n this.logger.success(`Handle \"${claimedHandle}\" is yours!`)\n const newName = `${claimedHandle}/${localName}`\n return { definition: this._cloneDefinition(project, { name: newName }) }\n }\n\n private _cloneDefinition = <T extends ResolvedProjectDefinition>(\n def: T,\n props: Partial<T['definition']['props']>\n ): T['definition'] => {\n if (def.type === 'integration') {\n const overrides = props as Partial<sdk.IntegrationDefinitionProps>\n return (def.definition.clone?.(overrides) ??\n new sdk.IntegrationDefinition({ ...def.definition.props, ...overrides })) as T['definition']\n }\n if (def.type === 'plugin') {\n const overrides = props as Partial<sdk.PluginDefinitionProps>\n return (def.definition.clone?.(overrides) ??\n new sdk.PluginDefinition({ ...def.definition.props, ...overrides })) as T['definition']\n }\n if (def.type === 'interface') {\n const overrides = props as Partial<sdk.InterfaceDefinitionProps>\n return (def.definition.clone?.(overrides) ??\n new sdk.InterfaceDefinition({ ...def.definition.props, ...overrides })) as T['definition']\n }\n if (def.type === 'bot') {\n const overrides = props as Partial<sdk.BotDefinitionProps>\n return (def.definition.clone?.(overrides) ??\n new sdk.BotDefinition({ ...def.definition.props, ...overrides })) as T['definition']\n }\n def satisfies never\n throw new errors.BotpressCLIError('Unsupported definition type')\n }\n\n protected _parseHandledName = (artifactName: string): { name: string; workspaceHandle?: string } => {\n const parts = artifactName.split('/')\n if (parts.length > 2) {\n throw new errors.BotpressCLIError(`Invalid name \"${artifactName}\": a single forward slash is allowed`)\n }\n if (parts.length === 2) {\n const [workspaceHandle, name] = parts as [string, string]\n return { name, workspaceHandle }\n }\n const [name] = parts as [string]\n return { name }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,UAAqB;AAErB,mBAAkB;AAClB,gBAAe;AACf,oBAAc;AACd,oBAAmB;AACnB,eAA0B;AAC1B,cAAyB;AAEzB,aAAwB;AACxB,aAAwB;AACxB,iBAAqE;AAErE,YAAuB;AACvB,4BAA8B;AA0D9B,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,cAAA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Q,IAAI,WAAW,QAAQ,SAAS,KACtC,IAAI,IAAI,cAAc,EAAE,GAAG,IAAI,WAAW,OAAO,GAAG,UAAU,CAAC;AAAA,IACnE;AACA;AACA,UAAM,IAAI,OAAO,iBAAiB,6BAA6B;AAAA,EACjE;AAAA,EAEU,oBAAoB,CAAC,iBAAqE;AAClG,UAAM,QAAQ,aAAa,MAAM,GAAG;AACpC,QAAI,MAAM,SAAS,GAAG;AACpB,YAAM,IAAI,OAAO,iBAAiB,iBAAiB,YAAY,sCAAsC;AAAA,IACvG;AACA,QAAI,MAAM,WAAW,GAAG;AACtB,YAAM,CAAC,iBAAiBC,KAAI,IAAI;AAChC,aAAO,EAAE,MAAAA,OAAM,gBAAgB;AAAA,IACjC;AACA,UAAM,CAAC,IAAI,IAAI;AACf,WAAO,EAAE,KAAK;AAAA,EAChB;AACF;",
6
6
  "names": ["_", "fs", "chalk", "config", "semver", "newName", "name"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/cli",
3
- "version": "6.8.6",
3
+ "version": "6.8.8",
4
4
  "description": "Botpress CLI",
5
5
  "scripts": {
6
6
  "build": "pnpm run build:types && pnpm run bundle && pnpm run template:gen",
@@ -28,7 +28,7 @@
28
28
  "@apidevtools/json-schema-ref-parser": "^11.7.0",
29
29
  "@botpress/chat": "0.5.5",
30
30
  "@botpress/client": "1.46.0",
31
- "@botpress/sdk": "6.11.1",
31
+ "@botpress/sdk": "6.13.0",
32
32
  "@bpinternal/const": "^0.1.0",
33
33
  "@bpinternal/tunnel": "^0.1.1",
34
34
  "@bpinternal/verel": "^0.2.0",
@@ -73,5 +73,5 @@
73
73
  "engines": {
74
74
  "node": ">=18.0.0"
75
75
  },
76
- "packageManager": "pnpm@10.12.4"
76
+ "packageManager": "pnpm@10.29.3"
77
77
  }
@@ -6,7 +6,7 @@
6
6
  "private": true,
7
7
  "dependencies": {
8
8
  "@botpress/client": "1.46.0",
9
- "@botpress/sdk": "6.11.1"
9
+ "@botpress/sdk": "6.13.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.46.0",
10
- "@botpress/sdk": "6.11.1"
10
+ "@botpress/sdk": "6.13.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": "6.11.1"
9
+ "@botpress/sdk": "6.13.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.46.0",
10
- "@botpress/sdk": "6.11.1"
10
+ "@botpress/sdk": "6.13.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.46.0",
10
- "@botpress/sdk": "6.11.1",
10
+ "@botpress/sdk": "6.13.0",
11
11
  "axios": "^1.6.8"
12
12
  },
13
13
  "devDependencies": {