@botpress/cli 0.6.1 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -93,18 +93,12 @@ const generateBotIndex = async (installPath, instances) => {
93
93
  const lines = [
94
94
  import_const.GENERATED_HEADER,
95
95
  "import * as sdk from '@botpress/sdk'",
96
- ...instances.map(
97
- (instance) => `import * as ${utils.casing.to.camelCase(instance)} from './${installPath}/${instance}'`
98
- ),
99
- ...instances.map(
100
- (instance) => `export * as ${utils.casing.to.camelCase(instance)} from './${installPath}/${instance}'`
101
- ),
96
+ ...instances.map((i) => `import * as ${utils.casing.to.camelCase(i.name)} from './${installPath}/${i.dirname}'`),
97
+ ...instances.map((i) => `export * as ${utils.casing.to.camelCase(i.name)} from './${installPath}/${i.dirname}'`),
102
98
  "",
103
99
  "type TIntegrations = {",
104
100
  ...instances.map(
105
- (instance) => ` ${utils.casing.to.camelCase(instance)}: ${utils.casing.to.camelCase(instance)}.T${utils.casing.to.pascalCase(
106
- instance
107
- )}`
101
+ (i) => ` "${i.name}": ${utils.casing.to.camelCase(i.name)}.T${utils.casing.to.pascalCase(i.dirname)}`
108
102
  ),
109
103
  "}",
110
104
  "",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/code-generation/index.ts"],
4
- "sourcesContent": ["import type * as client from '@botpress/client'\nimport type * as sdk from '@botpress/sdk'\nimport pathlib from 'path'\nimport * as utils from '../utils'\nimport { GENERATED_HEADER, INDEX_FILE } from './const'\nimport { IntegrationImplementationIndexModule } from './integration-implementation'\nimport { IntegrationInstanceIndexModule } from './integration-instance'\nimport { IntegrationSecretIndexModule } from './integration-secret'\nimport * as mapIntegration from './map-integration'\nimport type * as types from './typings'\n\nexport { File } from './typings'\nexport { secretEnvVariableName } from './integration-secret'\nexport const INTEGRATION_JSON = 'integration.json'\n\nexport const generateIntegrationImplementationTypings = async (\n sdkIntegration: sdk.IntegrationDefinition,\n implementationTypingsPath: string\n): Promise<types.File[]> => {\n const integration = mapIntegration.from.sdk(sdkIntegration)\n const indexModule = await IntegrationImplementationIndexModule.create(integration)\n indexModule.unshift(implementationTypingsPath)\n return indexModule.flatten()\n}\n\nexport const generateIntegrationSecrets = async (\n sdkIntegration: sdk.IntegrationDefinition,\n secretsPath: string\n): Promise<types.File[]> => {\n const indexModule = await IntegrationSecretIndexModule.create(sdkIntegration)\n indexModule.unshift(secretsPath)\n return indexModule.flatten()\n}\n\nexport const generateIntegrationIndex = async (\n implementationTypingsPath: string,\n implementationSecretsPath: string\n): Promise<types.File> => {\n let content = ''\n content += `export * from './${implementationTypingsPath}'\\n`\n content += `export * from './${implementationSecretsPath}'\\n`\n return {\n path: INDEX_FILE,\n content,\n }\n}\n\nexport type IntegrationInstanceJson = {\n name: string\n version: string\n id: string | null\n}\n\nexport const generateIntegrationInstance = async (\n anyIntegration: client.Integration | sdk.IntegrationDefinition,\n installPath: string\n): Promise<types.File[]> => {\n let integration: types.IntegrationDefinition\n if ('id' in anyIntegration) {\n integration = mapIntegration.from.client(anyIntegration)\n } else {\n integration = mapIntegration.from.sdk(anyIntegration)\n }\n\n const indexModule = await IntegrationInstanceIndexModule.create(integration)\n const dirname = utils.casing.to.kebabCase(integration.name)\n indexModule.unshift(installPath, dirname)\n const files = indexModule.flatten()\n\n const { name, version, id } = integration\n const json: IntegrationInstanceJson = {\n name,\n version,\n id,\n }\n files.push({\n path: pathlib.join(installPath, dirname, INTEGRATION_JSON),\n content: JSON.stringify(json, null, 2),\n })\n\n return files\n}\n\nexport const generateBotIndex = async (installPath: string, instances: string[]): Promise<types.File> => {\n const lines: string[] = [\n GENERATED_HEADER,\n \"import * as sdk from '@botpress/sdk'\",\n ...instances.map(\n (instance) => `import * as ${utils.casing.to.camelCase(instance)} from './${installPath}/${instance}'`\n ),\n ...instances.map(\n (instance) => `export * as ${utils.casing.to.camelCase(instance)} from './${installPath}/${instance}'`\n ),\n '',\n 'type TIntegrations = {',\n ...instances.map(\n (instance) =>\n ` ${utils.casing.to.camelCase(instance)}: ${utils.casing.to.camelCase(instance)}.T${utils.casing.to.pascalCase(\n instance\n )}`\n ),\n '}',\n '',\n 'type BaseStates = sdk.Bot extends sdk.Bot<any, infer TStates, any> ? TStates : never',\n 'type BaseEvents = sdk.Bot extends sdk.Bot<any, any, infer TEvents> ? TEvents : never',\n '',\n 'export class Bot<',\n ' TStates extends BaseStates,',\n ' TEvents extends BaseEvents',\n '> extends sdk.Bot<',\n ' TIntegrations,',\n ' TStates,',\n ' TEvents',\n '> {}',\n ]\n\n return {\n path: INDEX_FILE,\n content: lines.join('\\n'),\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAoB;AACpB,YAAuB;AACvB,mBAA6C;AAC7C,wCAAqD;AACrD,kCAA+C;AAC/C,gCAA6C;AAC7C,qBAAgC;AAGhC,qBAAqB;AACrB,IAAAA,6BAAsC;AAC/B,MAAM,mBAAmB;AAEzB,MAAM,2CAA2C,OACtD,gBACA,8BAC0B;AAC1B,QAAM,cAAc,eAAe,KAAK,IAAI,cAAc;AAC1D,QAAM,cAAc,MAAM,uEAAqC,OAAO,WAAW;AACjF,cAAY,QAAQ,yBAAyB;AAC7C,SAAO,YAAY,QAAQ;AAC7B;AAEO,MAAM,6BAA6B,OACxC,gBACA,gBAC0B;AAC1B,QAAM,cAAc,MAAM,uDAA6B,OAAO,cAAc;AAC5E,cAAY,QAAQ,WAAW;AAC/B,SAAO,YAAY,QAAQ;AAC7B;AAEO,MAAM,2BAA2B,OACtC,2BACA,8BACwB;AACxB,MAAI,UAAU;AACd,aAAW,oBAAoB;AAAA;AAC/B,aAAW,oBAAoB;AAAA;AAC/B,SAAO;AAAA,IACL,MAAM;AAAA,IACN;AAAA,EACF;AACF;AAQO,MAAM,8BAA8B,OACzC,gBACA,gBAC0B;AA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O;AAAA,IACL,MAAM;AAAA,IACN,SAAS,MAAM,KAAK,IAAI;AAAA,EAC1B;AACF;",
4
+ "sourcesContent": ["import type * as client from '@botpress/client'\nimport type * as sdk from '@botpress/sdk'\nimport pathlib from 'path'\nimport * as utils from '../utils'\nimport { GENERATED_HEADER, INDEX_FILE } from './const'\nimport { IntegrationImplementationIndexModule } from './integration-implementation'\nimport { IntegrationInstanceIndexModule } from './integration-instance'\nimport { IntegrationSecretIndexModule } from './integration-secret'\nimport * as mapIntegration from './map-integration'\nimport type * as types from './typings'\n\nexport { File } from './typings'\nexport { secretEnvVariableName } from './integration-secret'\nexport const INTEGRATION_JSON = 'integration.json'\n\nexport const generateIntegrationImplementationTypings = async (\n sdkIntegration: sdk.IntegrationDefinition,\n implementationTypingsPath: string\n): Promise<types.File[]> => {\n const integration = mapIntegration.from.sdk(sdkIntegration)\n const indexModule = await IntegrationImplementationIndexModule.create(integration)\n indexModule.unshift(implementationTypingsPath)\n return indexModule.flatten()\n}\n\nexport const generateIntegrationSecrets = async (\n sdkIntegration: sdk.IntegrationDefinition,\n secretsPath: string\n): Promise<types.File[]> => {\n const indexModule = await IntegrationSecretIndexModule.create(sdkIntegration)\n indexModule.unshift(secretsPath)\n return indexModule.flatten()\n}\n\nexport const generateIntegrationIndex = async (\n implementationTypingsPath: string,\n implementationSecretsPath: string\n): Promise<types.File> => {\n let content = ''\n content += `export * from './${implementationTypingsPath}'\\n`\n content += `export * from './${implementationSecretsPath}'\\n`\n return {\n path: INDEX_FILE,\n content,\n }\n}\n\nexport type IntegrationInstanceJson = {\n name: string\n version: string\n id: string | null\n}\n\nexport const generateIntegrationInstance = async (\n anyIntegration: client.Integration | sdk.IntegrationDefinition,\n installPath: string\n): Promise<types.File[]> => {\n let integration: types.IntegrationDefinition\n if ('id' in anyIntegration) {\n integration = mapIntegration.from.client(anyIntegration)\n } else {\n integration = mapIntegration.from.sdk(anyIntegration)\n }\n\n const indexModule = await IntegrationInstanceIndexModule.create(integration)\n const dirname = utils.casing.to.kebabCase(integration.name)\n indexModule.unshift(installPath, dirname)\n const files = indexModule.flatten()\n\n const { name, version, id } = integration\n const json: IntegrationInstanceJson = {\n name,\n version,\n id,\n }\n files.push({\n path: pathlib.join(installPath, dirname, INTEGRATION_JSON),\n content: JSON.stringify(json, null, 2),\n })\n\n return files\n}\n\nexport const generateBotIndex = async (\n installPath: string,\n instances: { name: string; dirname: string }[]\n): Promise<types.File> => {\n const lines: string[] = [\n GENERATED_HEADER,\n \"import * as sdk from '@botpress/sdk'\",\n ...instances.map((i) => `import * as ${utils.casing.to.camelCase(i.name)} from './${installPath}/${i.dirname}'`),\n ...instances.map((i) => `export * as ${utils.casing.to.camelCase(i.name)} from './${installPath}/${i.dirname}'`),\n '',\n 'type TIntegrations = {',\n ...instances.map(\n (i) => ` \"${i.name}\": ${utils.casing.to.camelCase(i.name)}.T${utils.casing.to.pascalCase(i.dirname)}`\n ),\n '}',\n '',\n 'type BaseStates = sdk.Bot extends sdk.Bot<any, infer TStates, any> ? TStates : never',\n 'type BaseEvents = sdk.Bot extends sdk.Bot<any, any, infer TEvents> ? TEvents : never',\n '',\n 'export class Bot<',\n ' TStates extends BaseStates,',\n ' TEvents extends BaseEvents',\n '> extends sdk.Bot<',\n ' TIntegrations,',\n ' TStates,',\n ' TEvents',\n '> {}',\n ]\n\n return {\n path: INDEX_FILE,\n content: lines.join('\\n'),\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAoB;AACpB,YAAuB;AACvB,mBAA6C;AAC7C,wCAAqD;AACrD,kCAA+C;AAC/C,gCAA6C;AAC7C,qBAAgC;AAGhC,qBAAqB;AACrB,IAAAA,6BAAsC;AAC/B,MAAM,mBAAmB;AAEzB,MAAM,2CAA2C,OACtD,gBACA,8BAC0B;AAC1B,QAAM,cAAc,eAAe,KAAK,IAAI,c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A,IAC/G,GAAG,UAAU,IAAI,CAAC,MAAM,eAAe,MAAM,OAAO,GAAG,UAAU,EAAE,IAAI,aAAa,eAAe,EAAE,UAAU;AAAA,IAC/G;AAAA,IACA;AAAA,IACA,GAAG,UAAU;AAAA,MACX,CAAC,MAAM,MAAM,EAAE,UAAU,MAAM,OAAO,GAAG,UAAU,EAAE,IAAI,MAAM,MAAM,OAAO,GAAG,WAAW,EAAE,OAAO;AAAA,IACrG;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS,MAAM,KAAK,IAAI;AAAA,EAC1B;AACF;",
6
6
  "names": ["import_integration_secret", "pathlib"]
7
7
  }
@@ -133,10 +133,7 @@ class AddCommand extends import_project_command.ProjectCommand {
133
133
  }
134
134
  async _generateBotIndex() {
135
135
  const allInstances = await this._listIntegrationInstances();
136
- const indexFile = await codegen.generateBotIndex(
137
- this.projectPaths.rel("outDir").installDir,
138
- allInstances.map((i) => i.dirname)
139
- );
136
+ const indexFile = await codegen.generateBotIndex(this.projectPaths.rel("outDir").installDir, allInstances);
140
137
  await this.writeGeneratedFilesToOutFolder([indexFile]);
141
138
  }
142
139
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/command-implementations/add-command.ts"],
4
- "sourcesContent": ["import type * as client from '@botpress/client'\nimport type * as sdk from '@botpress/sdk'\nimport bluebird from 'bluebird'\nimport chalk from 'chalk'\nimport * as fs from 'fs'\nimport * as pathlib from 'path'\nimport * as codegen from '../code-generation'\nimport type commandDefinitions from '../command-definitions'\nimport * as consts from '../consts'\nimport * as errors from '../errors'\nimport {\n ApiIntegrationRef,\n formatIntegrationRef,\n LocalPathIntegrationRef,\n parseIntegrationRef,\n} from '../integration-ref'\nimport * as utils from '../utils'\nimport { ProjectCommand } from './project-command'\n\ntype IntegrationInstallDir = codegen.IntegrationInstanceJson & {\n dirname: string\n}\n\nexport type AddCommandDefinition = typeof commandDefinitions.add\nexport class AddCommand extends ProjectCommand<AddCommandDefinition> {\n public async run(): Promise<void> {\n const integrationDef = await this.readIntegrationDefinitionFromFS()\n if (integrationDef) {\n throw new errors.ExclusiveBotFeatureError()\n }\n\n const integrationRef = this.argv.integrationRef\n\n const parsedRef = parseIntegrationRef(integrationRef)\n if (!parsedRef) {\n throw new errors.InvalidIntegrationReferenceError(integrationRef)\n }\n\n const integration =\n parsedRef.type === 'path'\n ? await this._fetchLocalIntegration(parsedRef)\n : await this._fetchApiIntegration(parsedRef)\n\n const allInstances = await this._listIntegrationInstances()\n const existingInstance = allInstances.find((i) => i.name === integration.name)\n if (existingInstance) {\n this.logger.warn(`Integration with name \"${integration.name}\" already installed.`)\n const res = await this.prompt.confirm('Do you want to overwrite the existing instance?')\n if (!res) {\n this.logger.log('Aborted')\n return\n }\n\n await this._uninstallIntegration(existingInstance)\n }\n\n await this._generateIntegrationInstance(integration)\n }\n\n private _fetchLocalIntegration = async (\n integrationRef: LocalPathIntegrationRef\n ): Promise<sdk.IntegrationDefinition> => {\n this.logger.warn(\n 'Installing integration from a local path. There is no guarantee that the integration is deployed with the expected schemas.'\n )\n\n const workDir = integrationRef.path\n const pathStore = new utils.path.PathStore<'workDir' | 'definition'>({\n workDir,\n definition: utils.path.absoluteFrom(workDir, consts.fromWorkDir.definition),\n })\n const integrationDefinition = await this.readIntegrationDefinitionFromFS(pathStore)\n if (!integrationDefinition) {\n throw new errors.BotpressCLIError(`Integration definition not found at ${workDir}`)\n }\n return integrationDefinition\n }\n\n private _fetchApiIntegration = async (integrationRef: ApiIntegrationRef): Promise<client.Integration> => {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n const integration = await api.findIntegration(integrationRef)\n if (!integration) {\n const formattedRef = formatIntegrationRef(integrationRef)\n throw new errors.BotpressCLIError(`Integration \"${formattedRef}\" not found`)\n }\n return integration\n }\n\n private async _listIntegrationInstances(): Promise<IntegrationInstallDir[]> {\n const installPath = this.projectPaths.abs.installDir\n if (!fs.existsSync(installPath)) {\n this.logger.debug('Install path does not exist. Skipping listing of integration instances')\n return []\n }\n\n const allFiles = await fs.promises.readdir(installPath)\n const allPaths = allFiles.map((name) => pathlib.join(installPath, name))\n const directories = await bluebird.filter(allPaths, async (path) => {\n const stat = await fs.promises.stat(path)\n return stat.isDirectory()\n })\n\n let jsons = directories.map((root) => ({ root, json: pathlib.join(root, codegen.INTEGRATION_JSON) }))\n jsons = jsons.filter(({ json: x }) => fs.existsSync(x))\n\n return bluebird.map(jsons, async ({ root, json }) => {\n const content: string = await fs.promises.readFile(json, 'utf-8')\n const { name, version, id } = JSON.parse(content) as codegen.IntegrationInstanceJson\n const dirname = pathlib.basename(root)\n return {\n dirname,\n id,\n name,\n version,\n }\n })\n }\n\n private async _uninstallIntegration(instance: IntegrationInstallDir) {\n const installDir = this.projectPaths.abs.installDir\n const instancePath = pathlib.join(installDir, instance.dirname)\n await fs.promises.rm(instancePath, { recursive: true })\n await this._generateBotIndex()\n }\n\n private async _generateIntegrationInstance(integration: client.Integration | sdk.IntegrationDefinition) {\n const line = this.logger.line()\n\n const { name, version } = integration\n line.started(`Installing ${chalk.bold(name)} v${version}...`)\n\n const instanceFiles = await codegen.generateIntegrationInstance(\n integration,\n this.projectPaths.rel('outDir').installDir\n )\n await this.writeGeneratedFilesToOutFolder(instanceFiles)\n await this._generateBotIndex()\n\n const rel = this.projectPaths.rel('workDir')\n line.success(`Installed integration available at ${chalk.grey(rel.outDir)}`)\n }\n\n private async _generateBotIndex() {\n const allInstances = await this._listIntegrationInstances()\n const indexFile = await codegen.generateBotIndex(\n this.projectPaths.rel('outDir').installDir,\n allInstances.map((i) => i.dirname)\n )\n await this.writeGeneratedFilesToOutFolder([indexFile])\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;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Q,SAAS,IAAI;AACrC,aAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,MAAc,sBAAsB,UAAiC;AACnE,UAAM,aAAa,KAAK,aAAa,IAAI;AACzC,UAAM,eAAe,QAAQ,KAAK,YAAY,SAAS,OAAO;AAC9D,UAAM,GAAG,SAAS,GAAG,cAAc,EAAE,WAAW,KAAK,CAAC;AACtD,UAAM,KAAK,kBAAkB;AAAA,EAC/B;AAAA,EAEA,MAAc,6BAA6B,aAA6D;AACtG,UAAM,OAAO,KAAK,OAAO,KAAK;AAE9B,UAAM,EAAE,MAAM,QAAQ,IAAI;AAC1B,SAAK,QAAQ,cAAc,aAAAC,QAAM,KAAK,IAAI,MAAM,YAAY;AAE5D,UAAM,gBAAgB,MAAM,QAAQ;AAAA,MAClC;AAAA,MACA,KAAK,aAAa,IAAI,QAAQ,EAAE;AAAA,IAClC;AACA,UAAM,KAAK,+BAA+B,aAAa;AACvD,UAAM,KAAK,kBAAkB;AAE7B,UAAM,MAAM,KAAK,aAAa,IAAI,SAAS;AAC3C,SAAK,QAAQ,sCAAsC,aAAAA,QAAM,KAAK,IAAI,MAAM,GAAG;AAAA,EAC7E;AAAA,EAEA,MAAc,oBAAoB;AAChC,UAAM,eAAe,MAAM,KAAK,0BAA0B;AAC1D,UAAM,YAAY,MAAM,QAAQ;AAAA,MAC9B,KAAK,aAAa,IAAI,QAAQ,EAAE;AAAA,MAChC,aAAa,IAAI,CAAC,MAAM,EAAE,OAAO;AAAA,IACnC;AACA,UAAM,KAAK,+BAA+B,CAAC,SAAS,CAAC;AAAA,EACvD;AACF;",
4
+ "sourcesContent": ["import type * as client from '@botpress/client'\nimport type * as sdk from '@botpress/sdk'\nimport bluebird from 'bluebird'\nimport chalk from 'chalk'\nimport * as fs from 'fs'\nimport * as pathlib from 'path'\nimport * as codegen from '../code-generation'\nimport type commandDefinitions from '../command-definitions'\nimport * as consts from '../consts'\nimport * as errors from '../errors'\nimport {\n ApiIntegrationRef,\n formatIntegrationRef,\n LocalPathIntegrationRef,\n parseIntegrationRef,\n} from '../integration-ref'\nimport * as utils from '../utils'\nimport { ProjectCommand } from './project-command'\n\ntype IntegrationInstallDir = codegen.IntegrationInstanceJson & {\n dirname: string\n}\n\nexport type AddCommandDefinition = typeof commandDefinitions.add\nexport class AddCommand extends ProjectCommand<AddCommandDefinition> {\n public async run(): Promise<void> {\n const integrationDef = await this.readIntegrationDefinitionFromFS()\n if (integrationDef) {\n throw new errors.ExclusiveBotFeatureError()\n }\n\n const integrationRef = this.argv.integrationRef\n\n const parsedRef = parseIntegrationRef(integrationRef)\n if (!parsedRef) {\n throw new errors.InvalidIntegrationReferenceError(integrationRef)\n }\n\n const integration =\n parsedRef.type === 'path'\n ? await this._fetchLocalIntegration(parsedRef)\n : await this._fetchApiIntegration(parsedRef)\n\n const allInstances = await this._listIntegrationInstances()\n const existingInstance = allInstances.find((i) => i.name === integration.name)\n if (existingInstance) {\n this.logger.warn(`Integration with name \"${integration.name}\" already installed.`)\n const res = await this.prompt.confirm('Do you want to overwrite the existing instance?')\n if (!res) {\n this.logger.log('Aborted')\n return\n }\n\n await this._uninstallIntegration(existingInstance)\n }\n\n await this._generateIntegrationInstance(integration)\n }\n\n private _fetchLocalIntegration = async (\n integrationRef: LocalPathIntegrationRef\n ): Promise<sdk.IntegrationDefinition> => {\n this.logger.warn(\n 'Installing integration from a local path. There is no guarantee that the integration is deployed with the expected schemas.'\n )\n\n const workDir = integrationRef.path\n const pathStore = new utils.path.PathStore<'workDir' | 'definition'>({\n workDir,\n definition: utils.path.absoluteFrom(workDir, consts.fromWorkDir.definition),\n })\n const integrationDefinition = await this.readIntegrationDefinitionFromFS(pathStore)\n if (!integrationDefinition) {\n throw new errors.BotpressCLIError(`Integration definition not found at ${workDir}`)\n }\n return integrationDefinition\n }\n\n private _fetchApiIntegration = async (integrationRef: ApiIntegrationRef): Promise<client.Integration> => {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n const integration = await api.findIntegration(integrationRef)\n if (!integration) {\n const formattedRef = formatIntegrationRef(integrationRef)\n throw new errors.BotpressCLIError(`Integration \"${formattedRef}\" not found`)\n }\n return integration\n }\n\n private async _listIntegrationInstances(): Promise<IntegrationInstallDir[]> {\n const installPath = this.projectPaths.abs.installDir\n if (!fs.existsSync(installPath)) {\n this.logger.debug('Install path does not exist. Skipping listing of integration instances')\n return []\n }\n\n const allFiles = await fs.promises.readdir(installPath)\n const allPaths = allFiles.map((name) => pathlib.join(installPath, name))\n const directories = await bluebird.filter(allPaths, async (path) => {\n const stat = await fs.promises.stat(path)\n return stat.isDirectory()\n })\n\n let jsons = directories.map((root) => ({ root, json: pathlib.join(root, codegen.INTEGRATION_JSON) }))\n jsons = jsons.filter(({ json: x }) => fs.existsSync(x))\n\n return bluebird.map(jsons, async ({ root, json }) => {\n const content: string = await fs.promises.readFile(json, 'utf-8')\n const { name, version, id } = JSON.parse(content) as codegen.IntegrationInstanceJson\n const dirname = pathlib.basename(root)\n return {\n dirname,\n id,\n name,\n version,\n }\n })\n }\n\n private async _uninstallIntegration(instance: IntegrationInstallDir) {\n const installDir = this.projectPaths.abs.installDir\n const instancePath = pathlib.join(installDir, instance.dirname)\n await fs.promises.rm(instancePath, { recursive: true })\n await this._generateBotIndex()\n }\n\n private async _generateIntegrationInstance(integration: client.Integration | sdk.IntegrationDefinition) {\n const line = this.logger.line()\n\n const { name, version } = integration\n line.started(`Installing ${chalk.bold(name)} v${version}...`)\n\n const instanceFiles = await codegen.generateIntegrationInstance(\n integration,\n this.projectPaths.rel('outDir').installDir\n )\n await this.writeGeneratedFilesToOutFolder(instanceFiles)\n await this._generateBotIndex()\n\n const rel = this.projectPaths.rel('workDir')\n line.success(`Installed integration available at ${chalk.grey(rel.outDir)}`)\n }\n\n private async _generateBotIndex() {\n const allInstances = await this._listIntegrationInstances()\n const indexFile = await codegen.generateBotIndex(this.projectPaths.rel('outDir').installDir, allIn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AAO;AAChE,YAAM,EAAE,MAAM,SAAS,GAAG,IAAI,KAAK,MAAM,OAAO;AAChD,YAAM,UAAU,QAAQ,SAAS,IAAI;AACrC,aAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,MAAc,sBAAsB,UAAiC;AACnE,UAAM,aAAa,KAAK,aAAa,IAAI;AACzC,UAAM,eAAe,QAAQ,KAAK,YAAY,SAAS,OAAO;AAC9D,UAAM,GAAG,SAAS,GAAG,cAAc,EAAE,WAAW,KAAK,CAAC;AACtD,UAAM,KAAK,kBAAkB;AAAA,EAC/B;AAAA,EAEA,MAAc,6BAA6B,aAA6D;AACtG,UAAM,OAAO,KAAK,OAAO,KAAK;AAE9B,UAAM,EAAE,MAAM,QAAQ,IAAI;AAC1B,SAAK,QAAQ,cAAc,aAAAC,QAAM,KAAK,IAAI,MAAM,YAAY;AAE5D,UAAM,gBAAgB,MAAM,QAAQ;AAAA,MAClC;AAAA,MACA,KAAK,aAAa,IAAI,QAAQ,EAAE;AAAA,IAClC;AACA,UAAM,KAAK,+BAA+B,aAAa;AACvD,UAAM,KAAK,kBAAkB;AAE7B,UAAM,MAAM,KAAK,aAAa,IAAI,SAAS;AAC3C,SAAK,QAAQ,sCAAsC,aAAAA,QAAM,KAAK,IAAI,MAAM,GAAG;AAAA,EAC7E;AAAA,EAEA,MAAc,oBAAoB;AAChC,UAAM,eAAe,MAAM,KAAK,0BAA0B;AAC1D,UAAM,YAAY,MAAM,QAAQ,iBAAiB,KAAK,aAAa,IAAI,QAAQ,EAAE,YAAY,YAAY;AACzG,UAAM,KAAK,+BAA+B,CAAC,SAAS,CAAC;AAAA,EACvD;AACF;",
6
6
  "names": ["bluebird", "chalk"]
7
7
  }
@@ -68,7 +68,8 @@ class InitCommand extends import_global_command.GlobalCommand {
68
68
  }
69
69
  _copy = async (props) => {
70
70
  const { srcDir, destDir, name } = props;
71
- const destination = pathlib.join(destDir, props.name);
71
+ const dirName = utils.casing.to.kebabCase(name);
72
+ const destination = pathlib.join(destDir, dirName);
72
73
  const exist = await this._checkIfDestinationExists(destination);
73
74
  if (exist) {
74
75
  return;
@@ -76,9 +77,9 @@ class InitCommand extends import_global_command.GlobalCommand {
76
77
  await fs.promises.cp(srcDir, destination, { recursive: true });
77
78
  const pkgJsonPath = pathlib.join(destination, "package.json");
78
79
  const strContent = await fs.promises.readFile(pkgJsonPath, "utf-8");
79
- const { name: _, ...json } = JSON.parse(strContent);
80
+ const { name: _, integrationName: __, ...json } = JSON.parse(strContent);
80
81
  const pkgJsonName = utils.casing.to.snakeCase(name);
81
- const updatedJson = { name: pkgJsonName, ...json };
82
+ const updatedJson = { name: pkgJsonName, integrationName: name, ...json };
82
83
  await fs.promises.writeFile(pkgJsonPath, JSON.stringify(updatedJson, null, 2));
83
84
  };
84
85
  _checkIfDestinationExists = async (destination) => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/command-implementations/init-command.ts"],
4
- "sourcesContent": ["import chalk from 'chalk'\nimport * as fs from 'fs'\nimport * as pathlib from 'path'\nimport type commandDefinitions from '../command-definitions'\nimport * as consts from '../consts'\nimport * as errors from '../errors'\nimport * as utils from '../utils'\nimport { GlobalCommand } from './global-command'\n\nexport type InitCommandDefinition = typeof commandDefinitions.init\nexport class InitCommand extends GlobalCommand<InitCommandDefinition> {\n public async run(): Promise<void> {\n let { type: projectType } = this.argv\n\n if (!projectType) {\n const promptedType = await this.prompt.select('What type of project do you wish to initialize?', {\n choices: (['bot', 'integration'] as const).map((t) => ({ title: t, value: t })),\n })\n\n if (!promptedType) {\n throw new errors.ParamRequiredError('Project Type')\n }\n\n projectType = promptedType\n }\n\n let name = this.argv.name\n if (!name) {\n const defaultName = projectType === 'bot' ? consts.echoBotDirName : consts.emptyIntegrationDirName\n const promptMessage = `What is the name of your ${projectType}?`\n const promptedName = await this.prompt.text(promptMessage, { initial: defaultName })\n if (!promptedName) {\n throw new errors.ParamRequiredError('Project Name')\n }\n name = promptedName\n }\n\n const workDir = utils.path.absoluteFrom(utils.path.cwd(), this.argv.workDir)\n\n if (projectType === 'bot') {\n await this._copy({ srcDir: this.globalPaths.abs.echoBotTemplate, destDir: workDir, name })\n this.logger.success(`Bot project initialized in ${chalk.bold(workDir)}`)\n return\n }\n\n await this._copy({ srcDir: this.globalPaths.abs.emptyIntegrationTemplate, destDir: workDir, name })\n this.logger.success(`Integration project initialized in ${chalk.bold(this.argv.workDir)}`)\n return\n }\n\n private _copy = async (props: { srcDir: string; destDir: string; name: string }) => {\n const { srcDir, destDir, name } = props\n const destination = pathlib.join(destDir, props.name)\n\n const exist = await this._checkIfDestinationExists(destination)\n if (exist) {\n return\n }\n\n await fs.promises.cp(srcDir, destination, { recursive: true })\n\n const pkgJsonPath = pathlib.join(destination, 'package.json')\n const strContent = await fs.promises.readFile(pkgJsonPath, 'utf-8')\n const { name: _, ...json } = JSON.parse(strContent)\n\n const pkgJsonName = utils.casing.to.snakeCase(name)\n const updatedJson = { name: pkgJsonName, ...json }\n await fs.promises.writeFile(pkgJsonPath, JSON.stringify(updatedJson, null, 2))\n }\n\n private _checkIfDestinationExists = async (destination: string) => {\n if (fs.existsSync(destination)) {\n const override = await this.prompt.confirm(\n `Directory ${chalk.bold(destination)} already exists. Do you want to overwrite it?`\n )\n if (!override) {\n this.logger.log('Aborting')\n return true\n }\n }\n return false\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,SAAoB;AACpB,cAAyB;AAEzB,aAAwB;AACxB,aAAwB;AACxB,YAAuB;AACvB,4BAA8B;AAGvB,MAAM,oBAAoB,oCAAqC;AAAA,EACpE,MAAa,MAAqB;AAChC,QAAI,EAAE,MAAM,YAAY,IAAI,KAAK;AAEjC,QAAI,CAAC,aAAa;AAChB,YAAM,eAAe,MAAM,KAAK,OAAO,OAA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,aAAa,EAAE,WAAW,KAAK,CAAC;AAE7D,UAAM,cAAc,QAAQ,KAAK,aAAa,cAAc;AAC5D,UAAM,aAAa,MAAM,GAAG,SAAS,SAAS,aAAa,OAAO;AAClE,UAAM,EAAE,MAAM,MAAM,KAAK,IAAI,KAAK,MAAM,UAAU;AAElD,UAAM,cAAc,MAAM,OAAO,GAAG,UAAU,IAAI;AAClD,UAAM,cAAc,EAAE,MAAM,aAAa,GAAG,KAAK;AACjD,UAAM,GAAG,SAAS,UAAU,aAAa,KAAK,UAAU,aAAa,MAAM,CAAC,CAAC;AAAA,EAC/E;AAAA,EAEQ,4BAA4B,OAAO,gBAAwB;AACjE,QAAI,GAAG,WAAW,WAAW,GAAG;AAC9B,YAAM,WAAW,MAAM,KAAK,OAAO;AAAA,QACjC,aAAa,aAAAA,QAAM,KAAK,WAAW;AAAA,MACrC;AACA,UAAI,CAAC,UAAU;AACb,aAAK,OAAO,IAAI,UAAU;AAC1B,eAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACF;",
4
+ "sourcesContent": ["import chalk from 'chalk'\nimport * as fs from 'fs'\nimport * as pathlib from 'path'\nimport type commandDefinitions from '../command-definitions'\nimport * as consts from '../consts'\nimport * as errors from '../errors'\nimport * as utils from '../utils'\nimport { GlobalCommand } from './global-command'\n\nexport type InitCommandDefinition = typeof commandDefinitions.init\nexport class InitCommand extends GlobalCommand<InitCommandDefinition> {\n public async run(): Promise<void> {\n let { type: projectType } = this.argv\n\n if (!projectType) {\n const promptedType = await this.prompt.select('What type of project do you wish to initialize?', {\n choices: (['bot', 'integration'] as const).map((t) => ({ title: t, value: t })),\n })\n\n if (!promptedType) {\n throw new errors.ParamRequiredError('Project Type')\n }\n\n projectType = promptedType\n }\n\n let name = this.argv.name\n if (!name) {\n const defaultName = projectType === 'bot' ? consts.echoBotDirName : consts.emptyIntegrationDirName\n const promptMessage = `What is the name of your ${projectType}?`\n const promptedName = await this.prompt.text(promptMessage, { initial: defaultName })\n if (!promptedName) {\n throw new errors.ParamRequiredError('Project Name')\n }\n name = promptedName\n }\n\n const workDir = utils.path.absoluteFrom(utils.path.cwd(), this.argv.workDir)\n\n if (projectType === 'bot') {\n await this._copy({ srcDir: this.globalPaths.abs.echoBotTemplate, destDir: workDir, name })\n this.logger.success(`Bot project initialized in ${chalk.bold(workDir)}`)\n return\n }\n\n await this._copy({ srcDir: this.globalPaths.abs.emptyIntegrationTemplate, destDir: workDir, name })\n this.logger.success(`Integration project initialized in ${chalk.bold(this.argv.workDir)}`)\n return\n }\n\n private _copy = async (props: { srcDir: string; destDir: string; name: string }) => {\n const { srcDir, destDir, name } = props\n\n const dirName = utils.casing.to.kebabCase(name)\n const destination = pathlib.join(destDir, dirName)\n\n const exist = await this._checkIfDestinationExists(destination)\n if (exist) {\n return\n }\n\n await fs.promises.cp(srcDir, destination, { recursive: true })\n\n const pkgJsonPath = pathlib.join(destination, 'package.json')\n const strContent = await fs.promises.readFile(pkgJsonPath, 'utf-8')\n const { name: _, integrationName: __, ...json } = JSON.parse(strContent)\n\n const pkgJsonName = utils.casing.to.snakeCase(name)\n const updatedJson = { name: pkgJsonName, integrationName: name, ...json }\n await fs.promises.writeFile(pkgJsonPath, JSON.stringify(updatedJson, null, 2))\n }\n\n private _checkIfDestinationExists = async (destination: string) => {\n if (fs.existsSync(destination)) {\n const override = await this.prompt.confirm(\n `Directory ${chalk.bold(destination)} already exists. Do you want to overwrite it?`\n )\n if (!override) {\n this.logger.log('Aborting')\n return true\n }\n }\n return false\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,SAAoB;AACpB,cAAyB;AAEzB,aAAwB;AACxB,aAAwB;AACxB,YAAuB;AACvB,4BAA8B;AAGvB,MAAM,oBAAoB,oCAAqC;AAAA,EACpE,MAAa,MAAqB;AAChC,QAAI,EAAE,MAAM,YAAY,IAAI,KAAK;AAEjC,QAAI,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AM,KAAK,0BAA0B,WAAW;AAC9D,QAAI,OAAO;AACT;AAAA,IACF;AAEA,UAAM,GAAG,SAAS,GAAG,QAAQ,aAAa,EAAE,WAAW,KAAK,CAAC;AAE7D,UAAM,cAAc,QAAQ,KAAK,aAAa,cAAc;AAC5D,UAAM,aAAa,MAAM,GAAG,SAAS,SAAS,aAAa,OAAO;AAClE,UAAM,EAAE,MAAM,GAAG,iBAAiB,OAAO,KAAK,IAAI,KAAK,MAAM,UAAU;AAEvE,UAAM,cAAc,MAAM,OAAO,GAAG,UAAU,IAAI;AAClD,UAAM,cAAc,EAAE,MAAM,aAAa,iBAAiB,MAAM,GAAG,KAAK;AACxE,UAAM,GAAG,SAAS,UAAU,aAAa,KAAK,UAAU,aAAa,MAAM,CAAC,CAAC;AAAA,EAC/E;AAAA,EAEQ,4BAA4B,OAAO,gBAAwB;AACjE,QAAI,GAAG,WAAW,WAAW,GAAG;AAC9B,YAAM,WAAW,MAAM,KAAK,OAAO;AAAA,QACjC,aAAa,aAAAA,QAAM,KAAK,WAAW;AAAA,MACrC;AACA,UAAI,CAAC,UAAU;AACb,aAAK,OAAO,IAAI,UAAU;AAC1B,eAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACF;",
6
6
  "names": ["chalk"]
7
7
  }
@@ -30,11 +30,10 @@ __export(case_utils_exports, {
30
30
  module.exports = __toCommonJS(case_utils_exports);
31
31
  var import_lodash = __toESM(require("lodash"));
32
32
  const capitalizeFirstLetter = (text) => text.charAt(0).toUpperCase() + text.slice(1).toLowerCase();
33
- const splitHyphens = (tokens) => tokens.flatMap((token) => token.split("-"));
34
- const splitUnderscores = (tokens) => tokens.flatMap((token) => token.split("_"));
33
+ const splitChar = (char) => (tokens) => tokens.flatMap((token) => token.split(char));
35
34
  const splitCaseChange = (tokens) => tokens.flatMap((token) => token.split(/(?<=[a-z])(?=[A-Z])/));
36
35
  const splitTokens = (tokens) => {
37
- return [splitHyphens, splitUnderscores, splitCaseChange].reduce((acc, step) => step(acc), tokens);
36
+ return [splitChar("/"), splitChar("-"), splitChar("_"), splitCaseChange].reduce((acc, step) => step(acc), tokens);
38
37
  };
39
38
  const fromTokens = {
40
39
  pascalCase: (tokens) => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/case-utils.ts"],
4
- "sourcesContent": ["import _ from 'lodash'\n\nconst capitalizeFirstLetter = (text: string) => text.charAt(0).toUpperCase() + text.slice(1).toLowerCase()\n\nconst splitHyphens = (tokens: string[]) => tokens.flatMap((token) => token.split('-'))\nconst splitUnderscores = (tokens: string[]) => tokens.flatMap((token) => token.split('_'))\nconst splitCaseChange = (tokens: string[]) => tokens.flatMap((token) => token.split(/(?<=[a-z])(?=[A-Z])/))\nconst splitTokens = (tokens: string[]) => {\n return [splitHyphens, splitUnderscores, splitCaseChange].reduce((acc, step) => step(acc), tokens)\n}\n\ntype SupportedCase = `${'pascal' | 'kebab' | 'snake' | 'screamingSnake' | 'camel'}Case`\n\nconst fromTokens = {\n pascalCase: (tokens: string[]) => {\n return tokens.map(capitalizeFirstLetter).join('')\n },\n kebabCase: (tokens: string[]) => {\n return tokens.map((token) => token.toLowerCase()).join('-')\n },\n snakeCase: (tokens: string[]) => {\n return tokens.map((token) => token.toLowerCase()).join('_')\n },\n screamingSnakeCase: (tokens: string[]) => {\n return tokens.map((token) => token.toUpperCase()).join('_')\n },\n camelCase: (tokens: string[]) => {\n const [first, ...others] = tokens\n return [first!.toLowerCase(), ...others.map(capitalizeFirstLetter)].join('')\n },\n} as Record<SupportedCase, (tokens: string[]) => string>\n\nexport const to = _.mapValues(fromTokens, (fn) => (text: string) => {\n const tokens = splitTokens([text])\n return fn(tokens)\n}) satisfies Record<SupportedCase, (text: string) => string>\n\nexport const is = _.mapValues(to, (fn) => (text: string) => {\n const result = fn(text)\n return result === text\n}) satisfies Record<SupportedCase, (text: string) => boolean>\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;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AiB;AAClE,QAAM,SAAS,YAAY,CAAC,IAAI,CAAC;AACjC,SAAO,GAAG,MAAM;AAClB,CAAC;AAEM,MAAM,KAAK,cAAAA,QAAE,UAAU,IAAI,CAAC,OAAO,CAAC,SAAiB;AAC1D,QAAM,SAAS,GAAG,IAAI;AACtB,SAAO,WAAW;AACpB,CAAC;",
4
+ "sourcesContent": ["import _ from 'lodash'\n\nconst capitalizeFirstLetter = (text: string) => text.charAt(0).toUpperCase() + text.slice(1).toLowerCase()\n\nconst splitChar = (char: string) => (tokens: string[]) => tokens.flatMap((token) => token.split(char))\nconst splitCaseChange = (tokens: string[]) => tokens.flatMap((token) => token.split(/(?<=[a-z])(?=[A-Z])/))\nconst splitTokens = (tokens: string[]) => {\n return [splitChar('/'), splitChar('-'), splitChar('_'), splitCaseChange].reduce((acc, step) => step(acc), tokens)\n}\n\ntype SupportedCase = `${'pascal' | 'kebab' | 'snake' | 'screamingSnake' | 'camel'}Case`\n\nconst fromTokens = {\n pascalCase: (tokens: string[]) => {\n return tokens.map(capitalizeFirstLetter).join('')\n },\n kebabCase: (tokens: string[]) => {\n return tokens.map((token) => token.toLowerCase()).join('-')\n },\n snakeCase: (tokens: string[]) => {\n return tokens.map((token) => token.toLowerCase()).join('_')\n },\n screamingSnakeCase: (tokens: string[]) => {\n return tokens.map((token) => token.toUpperCase()).join('_')\n },\n camelCase: (tokens: string[]) => {\n const [first, ...others] = tokens\n return [first!.toLowerCase(), ...others.map(capitalizeFirstLetter)].join('')\n },\n} as Record<SupportedCase, (tokens: string[]) => string>\n\nexport const to = _.mapValues(fromTokens, (fn) => (text: string) => {\n const tokens = splitTokens([text])\n return fn(tokens)\n}) satisfies Record<SupportedCase, (text: string) => string>\n\nexport const is = _.mapValues(to, (fn) => (text: string) => {\n const result = fn(text)\n return result === text\n}) satisfies Record<SupportedCase, (text: string) => boolean>\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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MAAM;AAClB,CAAC;AAEM,MAAM,KAAK,cAAAA,QAAE,UAAU,IAAI,CAAC,OAAO,CAAC,SAAiB;AAC1D,QAAM,SAAS,GAAG,IAAI;AACtB,SAAO,WAAW;AACpB,CAAC;",
6
6
  "names": ["_"]
7
7
  }
@@ -8,6 +8,8 @@ import defaults from '../defaults'
8
8
  import { Test } from '../typings'
9
9
  import * as utils from '../utils'
10
10
 
11
+ const HANDLE = 'botpress'
12
+
11
13
  const fetchIntegration = async (client: Client, integrationName: string): Promise<ApiIntegration | undefined> => {
12
14
  const integrations = await fetchAllIntegrations(client)
13
15
  return integrations.find(({ name }) => name === integrationName)
@@ -18,8 +20,11 @@ export const createDeployIntegration: Test = {
18
20
  handler: async ({ tmpDir, dependencies, logger, ...creds }) => {
19
21
  const botpressHomeDir = pathlib.join(tmpDir, '.botpresshome')
20
22
  const baseDir = pathlib.join(tmpDir, 'integrations')
21
- const integrationName = `myintegration-${uuid.v4()}`.replace(/-/g, '')
22
- const integrationDir = pathlib.join(baseDir, integrationName)
23
+
24
+ const integrationSuffix = uuid.v4().replace(/-/g, '')
25
+ const integrationName = `${HANDLE}/myintegration${integrationSuffix}`
26
+ const integrationDirName = `${HANDLE}-myintegration${integrationSuffix}`
27
+ const integrationDir = pathlib.join(baseDir, integrationDirName)
23
28
 
24
29
  const argv = {
25
30
  ...defaults,
@@ -38,6 +43,8 @@ export const createDeployIntegration: Test = {
38
43
  await impl.build({ ...argv, workDir: integrationDir }).then(utils.handleExitCode)
39
44
  await impl.login({ ...argv }).then(utils.handleExitCode)
40
45
 
46
+ await client.updateWorkspace({ id: creds.workspaceId, handle: HANDLE })
47
+
41
48
  await impl
42
49
  .deploy({ ...argv, createNewBot: undefined, botId: undefined, workDir: integrationDir })
43
50
  .then(utils.handleExitCode)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/cli",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "Botpress CLI",
5
5
  "scripts": {
6
6
  "build": "pnpm run bundle && pnpm run template:gen",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "main": "dist/index.js",
22
22
  "dependencies": {
23
- "@botpress/client": "0.11.5",
23
+ "@botpress/client": "0.11.7",
24
24
  "@bpinternal/const": "^0.0.20",
25
25
  "@bpinternal/tunnel": "^0.1.1",
26
26
  "@bpinternal/yargs-extra": "^0.0.3",
@@ -49,7 +49,7 @@
49
49
  "zod": "^3.20.6"
50
50
  },
51
51
  "devDependencies": {
52
- "@botpress/sdk": "0.6.1",
52
+ "@botpress/sdk": "0.6.2",
53
53
  "@bpinternal/log4bot": "^0.0.4",
54
54
  "@types/bluebird": "^3.5.38",
55
55
  "@types/json-schema": "^7.0.11",
@@ -8,8 +8,8 @@
8
8
  "author": "",
9
9
  "license": "MIT",
10
10
  "dependencies": {
11
- "@botpress/client": "0.11.5",
12
- "@botpress/sdk": "0.6.1",
11
+ "@botpress/client": "0.11.7",
12
+ "@botpress/sdk": "0.6.2",
13
13
  "zod": "^3.20.6"
14
14
  },
15
15
  "devDependencies": {
@@ -1,8 +1,8 @@
1
1
  import { IntegrationDefinition, messages } from '@botpress/sdk'
2
- import { name } from './package.json'
2
+ import { name, integrationName } from './package.json'
3
3
 
4
4
  export default new IntegrationDefinition({
5
- name,
5
+ name: integrationName ?? name,
6
6
  version: '0.2.0',
7
7
  channels: {
8
8
  channel: {
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "empty-integration",
3
+ "integrationName": null,
3
4
  "scripts": {
4
5
  "type:check": "tsc --noEmit"
5
6
  },
@@ -8,8 +9,8 @@
8
9
  "author": "",
9
10
  "license": "MIT",
10
11
  "dependencies": {
11
- "@botpress/client": "0.11.5",
12
- "@botpress/sdk": "0.6.1",
12
+ "@botpress/client": "0.11.7",
13
+ "@botpress/sdk": "0.6.2",
13
14
  "zod": "^3.20.6"
14
15
  },
15
16
  "devDependencies": {