@botpress/cli 4.25.0 → 4.25.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +12 -12
- package/dist/command-implementations/add-command.js +3 -1
- package/dist/command-implementations/add-command.js.map +2 -2
- package/dist/command-implementations/global-command.js +27 -23
- package/dist/command-implementations/global-command.js.map +2 -2
- package/dist/command-implementations/integration-commands.js +4 -2
- package/dist/command-implementations/integration-commands.js.map +2 -2
- package/dist/command-implementations/interface-commands.js +4 -2
- package/dist/command-implementations/interface-commands.js.map +2 -2
- package/dist/command-implementations/plugin-commands.js +4 -2
- package/dist/command-implementations/plugin-commands.js.map +2 -2
- package/package.json +2 -2
- package/templates/empty-bot/package.json +1 -1
- package/templates/empty-integration/package.json +1 -1
- package/templates/empty-plugin/package.json +1 -1
- package/templates/hello-world/package.json +1 -1
- package/templates/webhook-message/package.json +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
|
|
2
|
-
> @botpress/cli@4.25.
|
|
2
|
+
> @botpress/cli@4.25.2 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@4.25.
|
|
6
|
+
> @botpress/cli@4.25.2 build:types /home/runner/work/botpress/botpress/packages/cli
|
|
7
7
|
> tsc -p ./tsconfig.build.json
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
> @botpress/cli@4.25.
|
|
10
|
+
> @botpress/cli@4.25.2 bundle /home/runner/work/botpress/botpress/packages/cli
|
|
11
11
|
> ts-node -T build.ts
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
> @botpress/cli@4.25.
|
|
14
|
+
> @botpress/cli@4.25.2 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 v4.25.
|
|
18
|
-
🤖 Botpress CLI v4.25.
|
|
19
|
-
🤖 Botpress CLI v4.25.
|
|
20
|
-
🤖 Botpress CLI v4.25.
|
|
21
|
-
○ Generating typings for integration
|
|
17
|
+
🤖 Botpress CLI v4.25.2
|
|
18
|
+
🤖 Botpress CLI v4.25.2
|
|
19
|
+
🤖 Botpress CLI v4.25.2
|
|
20
|
+
🤖 Botpress CLI v4.25.2
|
|
21
|
+
○ Generating typings for integration empty-integration...
|
|
22
22
|
✓ Typings available at .botpress
|
|
23
23
|
|
|
24
24
|
○ Generating typings for plugin empty-plugin...
|
|
25
|
-
○ Generating typings for bot...
|
|
26
25
|
✓ Typings available at .botpress
|
|
27
26
|
|
|
28
|
-
○ Generating typings for integration
|
|
27
|
+
○ Generating typings for integration hello-world...
|
|
28
|
+
○ Generating typings for bot...
|
|
29
29
|
✓ Typings available at .botpress
|
|
30
30
|
|
|
31
31
|
✓ Typings available at .botpress
|
|
32
32
|
|
|
33
|
-
🤖 Botpress CLI v4.25.
|
|
33
|
+
🤖 Botpress CLI v4.25.2
|
|
34
34
|
○ Generating typings for integration webhook-message...
|
|
35
35
|
✓ Typings available at .botpress
|
|
36
36
|
|
|
@@ -49,7 +49,9 @@ class AddCommand extends import_global_command.GlobalCommand {
|
|
|
49
49
|
if (ref) {
|
|
50
50
|
return await this._addNewSinglePackage({ ...ref, alias: this.argv.alias });
|
|
51
51
|
}
|
|
52
|
-
const pkgJson = await utils.pkgJson.readPackageJson(this.argv.installPath)
|
|
52
|
+
const pkgJson = await utils.pkgJson.readPackageJson(this.argv.installPath).catch((thrown) => {
|
|
53
|
+
throw errors.BotpressCLIError.wrap(thrown, "failed to read package.json file");
|
|
54
|
+
});
|
|
53
55
|
if (!pkgJson) {
|
|
54
56
|
this.logger.warn("No package.json found in the install path");
|
|
55
57
|
return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/command-implementations/add-command.ts"],
|
|
4
|
-
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as fslib from 'fs'\nimport * as pathlib from 'path'\nimport semver from 'semver'\nimport * as apiUtils from '../api'\nimport * as codegen from '../code-generation'\nimport type commandDefinitions from '../command-definitions'\nimport * as consts from '../consts'\nimport * as errors from '../errors'\nimport * as pkgRef from '../package-ref'\nimport * as utils from '../utils'\nimport { GlobalCommand } from './global-command'\nimport {\n ProjectCache,\n ProjectCommand,\n ProjectCommandDefinition,\n ProjectDefinitionLazy,\n ProjectDefinition,\n} from './project-command'\n\ntype InstallablePackage =\n | {\n type: 'integration'\n pkg: codegen.IntegrationInstallablePackage\n }\n | {\n type: 'interface'\n pkg: codegen.InterfaceInstallablePackage\n }\n | {\n type: 'plugin'\n pkg: codegen.PluginInstallablePackage\n }\n\ntype RefWithAlias = pkgRef.PackageRef & { alias?: string }\n\nexport type AddCommandDefinition = typeof commandDefinitions.add\nexport class AddCommand extends GlobalCommand<AddCommandDefinition> {\n public async run(): Promise<void> {\n const ref = this._parseArgvRef()\n if (ref) {\n return await this._addNewSinglePackage({ ...ref, alias: this.argv.alias })\n }\n const pkgJson = await utils.pkgJson.readPackageJson(this.argv.installPath)\n if (!pkgJson) {\n this.logger.warn('No package.json found in the install path')\n return\n }\n\n const { bpDependencies } = pkgJson\n if (!bpDependencies) {\n this.logger.log('No bp dependencies found in package.json')\n return\n }\n\n const bpDependenciesSchema = sdk.z.record(sdk.z.string())\n const parseResults = bpDependenciesSchema.safeParse(bpDependencies)\n if (!parseResults.success) {\n throw new errors.BotpressCLIError('Invalid bpDependencies found in package.json')\n }\n\n for (const [pkgAlias, pkgRefStr] of Object.entries(parseResults.data)) {\n const parsed = pkgRef.parsePackageRef(pkgRefStr)\n if (!parsed) {\n throw new errors.InvalidPackageReferenceError(pkgRefStr)\n }\n\n await this._addSinglePackage({ ...parsed, alias: pkgAlias })\n }\n }\n\n private _parseArgvRef = (): pkgRef.PackageRef | undefined => {\n if (!this.argv.packageRef) {\n return\n }\n\n const parsed = pkgRef.parsePackageRef(this.argv.packageRef)\n if (!parsed) {\n throw new errors.InvalidPackageReferenceError(this.argv.packageRef)\n }\n\n if (parsed.type !== 'name') {\n return parsed\n }\n\n const argvPkgType = this.argv.packageType\n if (!argvPkgType) {\n return parsed\n }\n\n const ref = { ...parsed, pkg: argvPkgType }\n\n const strRef = pkgRef.formatPackageRef(ref)\n this.logger.warn(`argument --packageType is deprecated; please use the package reference format \"${strRef}\"`)\n\n return ref\n }\n\n private async _addSinglePackage(ref: RefWithAlias) {\n const { packageName, targetPackage } = await this._findPackage(ref)\n\n const baseInstallPath = utils.path.absoluteFrom(utils.path.cwd(), this.argv.installPath)\n const packageDirName = utils.casing.to.kebabCase(packageName)\n const installPath = utils.path.join(baseInstallPath, consts.installDirName, packageDirName)\n\n const alreadyInstalled = fslib.existsSync(installPath)\n if (alreadyInstalled) {\n this.logger.warn(`Package with name \"${packageName}\" already installed.`)\n const res = await this.prompt.confirm('Do you want to overwrite the existing package?')\n if (!res) {\n throw new errors.AbortedOperationError()\n }\n\n await this._uninstall(installPath)\n }\n\n if (ref.type === 'name' && ref.version === pkgRef.LATEST_TAG) {\n // If the semver version expression is 'latest', we assume the project\n // is compatible with all versions of the latest major:\n const major = semver.major(targetPackage.pkg.version)\n targetPackage.pkg.version = `>=${major}.0.0 <${major + 1}.0.0`\n\n this.logger.log(\n `Dependency \"${packageName}\" will be installed with version \"${targetPackage.pkg.version}\". ` +\n `To pin a specific version or version range, please change \"${targetPackage.type}:${packageName}@latest\" ` +\n 'to a specific version number or range instead of \"latest\".'\n )\n } else if (ref.type === 'name') {\n // Preserve the semver version expression in the generated code:\n targetPackage.pkg.version = ref.version\n }\n\n let files: codegen.File[]\n if (targetPackage.type === 'integration') {\n files = await codegen.generateIntegrationPackage(targetPackage.pkg)\n } else if (targetPackage.type === 'interface') {\n files = await codegen.generateInterfacePackage(targetPackage.pkg)\n } else if (targetPackage.type === 'plugin') {\n files = await codegen.generatePluginPackage(targetPackage.pkg)\n } else {\n type _assertion = utils.types.AssertNever<typeof targetPackage>\n throw new errors.BotpressCLIError('Invalid package type')\n }\n\n await this._install(installPath, files)\n }\n\n private async _addNewSinglePackage(ref: RefWithAlias) {\n await this._addSinglePackage(ref)\n const { packageName, targetPackage } = await this._findPackage(ref)\n await this._addDependencyToPackage(packageName, targetPackage)\n }\n\n private async _findPackage(ref: RefWithAlias): Promise<{ packageName: string; targetPackage: InstallablePackage }> {\n const targetPackage = ref.type === 'path' ? await this._findLocalPackage(ref) : await this._findRemotePackage(ref)\n if (!targetPackage) {\n const strRef = pkgRef.formatPackageRef(ref)\n throw new errors.BotpressCLIError(`Could not find package \"${strRef}\"`)\n }\n const packageName = ref.alias ?? targetPackage.pkg.name\n\n return { packageName, targetPackage }\n }\n\n private async _findRemotePackage(ref: pkgRef.ApiPackageRef): Promise<InstallablePackage | undefined> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n if (this._pkgCouldBe(ref, 'integration')) {\n const integration = await api.findPublicOrPrivateIntegration(ref)\n if (integration) {\n const { name, version } = integration\n return { type: 'integration', pkg: { integration, name, version } }\n }\n }\n if (this._pkgCouldBe(ref, 'interface')) {\n const intrface = await api.findPublicOrPrivateInterface(ref)\n if (intrface) {\n const { name, version } = intrface\n return { type: 'interface', pkg: { interface: intrface, name, version } }\n }\n }\n if (this._pkgCouldBe(ref, 'plugin')) {\n const plugin = await api.findPublicOrPrivatePlugin(ref)\n if (plugin) {\n const { code } = plugin.public\n ? await api.client.getPublicPluginCode({ id: plugin.id, platform: 'node' })\n : await api.client.getPluginCode({ id: plugin.id, platform: 'node' })\n const { name, version } = plugin\n return {\n type: 'plugin',\n pkg: {\n name,\n version,\n plugin,\n code,\n },\n }\n }\n }\n return\n }\n\n private async _findLocalPackage(ref: pkgRef.LocalPackageRef): Promise<InstallablePackage | undefined> {\n const absPath = utils.path.absoluteFrom(utils.path.cwd(), ref.path)\n const {\n definition: projectDefinition,\n implementation: projectImplementation,\n devId: projectDevId,\n } = await this._readProject(absPath)\n\n if (projectDefinition?.type === 'integration') {\n const { name, version } = projectDefinition.definition\n let devId: string | undefined\n if (this.argv.useDev && projectDevId) {\n this.logger.warn(`Installing integration \"${name}\" with dev version \"${projectDevId}\"`)\n devId = projectDevId\n }\n\n let createIntegrationReqBody = await this._getProjectCmd(ref.path).prepareCreateIntegrationBody(\n projectDefinition.definition\n )\n createIntegrationReqBody = {\n ...createIntegrationReqBody,\n interfaces: utils.records.mapValues(projectDefinition.definition.interfaces ?? {}, (i) => ({\n id: '', // TODO: do this better\n ...i,\n })),\n }\n return {\n type: 'integration',\n pkg: { path: absPath, devId, name, version, integration: createIntegrationReqBody },\n }\n }\n\n if (projectDefinition?.type === 'interface') {\n const { name, version } = projectDefinition.definition\n const createInterfaceReqBody = await apiUtils.prepareCreateInterfaceBody(projectDefinition.definition)\n return {\n type: 'interface',\n pkg: { path: absPath, name, version, interface: createInterfaceReqBody },\n }\n }\n\n if (projectDefinition?.type === 'plugin') {\n if (!projectImplementation) {\n throw new errors.BotpressCLIError(\n 'Plugin implementation not found; Please build the plugin project before installing'\n )\n }\n\n const pluginDefinition = projectDefinition.definition\n const { name, version } = pluginDefinition\n const code = projectImplementation\n\n const createPluginReqBody = await apiUtils.prepareCreatePluginBody(pluginDefinition)\n return {\n type: 'plugin',\n pkg: {\n path: absPath,\n name,\n version,\n code,\n plugin: {\n ...createPluginReqBody,\n dependencies: {\n interfaces: pluginDefinition.interfaces,\n integrations: pluginDefinition.integrations,\n },\n recurringEvents: pluginDefinition.recurringEvents,\n },\n },\n }\n }\n\n if (projectDefinition?.type === 'bot') {\n throw new errors.BotpressCLIError('Cannot install a bot as a package')\n }\n return\n }\n\n private async _install(installPath: utils.path.AbsolutePath, files: codegen.File[]): Promise<void> {\n const line = this.logger.line()\n line.started(`Installing ${files.length} files to \"${installPath}\"`)\n try {\n for (const file of files) {\n const filePath = utils.path.absoluteFrom(installPath, file.path)\n const dirPath = pathlib.dirname(filePath)\n await fslib.promises.mkdir(dirPath, { recursive: true })\n await fslib.promises.writeFile(filePath, file.content)\n }\n line.success(`Installed ${files.length} files to \"${installPath}\"`)\n } finally {\n line.commit()\n }\n }\n\n private async _uninstall(installPath: utils.path.AbsolutePath): Promise<void> {\n await fslib.promises.rm(installPath, { recursive: true })\n }\n\n private async _readProject(workDir: utils.path.AbsolutePath): Promise<{\n definition?: ProjectDefinition\n implementation?: string\n devId?: string\n }> {\n const cmd = this._getProjectCmd(workDir)\n\n const { resolveProjectDefinition } = cmd.readProjectDefinitionFromFS()\n const definition = await resolveProjectDefinition().catch((thrown) => {\n if (thrown instanceof errors.ProjectDefinitionNotFoundError) {\n return undefined\n }\n throw thrown\n })\n\n const devId = await cmd.projectCache.get('devId')\n\n const implementationAbsPath = utils.path.join(workDir, consts.fromWorkDir.outFileCJS)\n if (!fslib.existsSync(implementationAbsPath)) {\n return { definition, devId }\n }\n\n const implementation = await fslib.promises.readFile(implementationAbsPath, 'utf8')\n return { definition, implementation, devId }\n }\n\n private _pkgCouldBe = (ref: pkgRef.ApiPackageRef, pkgType: InstallablePackage['type']) => {\n if (ref.type === 'id') {\n // TODO: use ULID prefixes to determine the type of the package\n return true\n }\n if (!ref.pkg) {\n return true // ref does not specify the package type\n }\n return ref.pkg === pkgType\n }\n\n private _getProjectCmd(workDir: string): _AnyProjectCommand {\n return new _AnyProjectCommand(apiUtils.ApiClient, this.prompt, this.logger, {\n ...this.argv,\n workDir,\n })\n }\n\n private async _addDependencyToPackage(packageName: string, targetPackage: InstallablePackage) {\n const pkgJson = await utils.pkgJson.readPackageJson(this.argv.installPath)\n const version =\n targetPackage.pkg.path ?? `${targetPackage.type}:${targetPackage.pkg.name}@${targetPackage.pkg.version}`\n if (!pkgJson) {\n this.logger.warn('No package.json found in the install path')\n return\n }\n\n const { bpDependencies } = pkgJson\n if (!bpDependencies) {\n pkgJson.bpDependencies = { [packageName]: version }\n await utils.pkgJson.writePackageJson(this.argv.installPath, pkgJson)\n return\n }\n\n const bpDependenciesSchema = sdk.z.record(sdk.z.string())\n const parseResult = bpDependenciesSchema.safeParse(bpDependencies)\n if (!parseResult.success) {\n throw new errors.BotpressCLIError('Invalid bpDependencies found in package.json')\n }\n\n const { data: validatedBpDeps } = parseResult\n\n const alreadyPresentDep = Object.entries(validatedBpDeps).find(([key]) => key === packageName)\n if (alreadyPresentDep) {\n if (alreadyPresentDep[1] !== version) {\n this.logger.warn(\n `The dependency ${packageName} is already present in the bpDependencies of package.json. It will not be replaced.`\n )\n }\n return\n }\n\n pkgJson.bpDependencies = {\n ...validatedBpDeps,\n [packageName]: version,\n }\n\n await utils.pkgJson.writePackageJson(this.argv.installPath, pkgJson)\n }\n}\n\n// this is a hack to avoid refactoring the project command class\nclass _AnyProjectCommand extends ProjectCommand<ProjectCommandDefinition> {\n public async run(): Promise<void> {\n throw new errors.BotpressCLIError('Not implemented')\n }\n\n public readProjectDefinitionFromFS(): ProjectDefinitionLazy {\n return super.readProjectDefinitionFromFS()\n }\n\n public async prepareCreateIntegrationBody(\n integrationDef: sdk.IntegrationDefinition\n ): Promise<apiUtils.CreateIntegrationRequestBody> {\n return super.prepareCreateIntegrationBody(integrationDef)\n }\n\n public get projectCache(): utils.cache.FSKeyValueCache<ProjectCache> {\n return super.projectCache\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAAqB;AACrB,YAAuB;AACvB,cAAyB;AACzB,oBAAmB;AACnB,eAA0B;AAC1B,cAAyB;AAEzB,aAAwB;AACxB,aAAwB;AACxB,aAAwB;AACxB,YAAuB;AACvB,4BAA8B;AAC9B,6BAMO;AAmBA,MAAM,mBAAmB,oCAAoC;AAAA,EAClE,MAAa,MAAqB;AAChC,UAAM,MAAM,KAAK,cAAc;AAC/B,QAAI,KAAK;AACP,aAAO,MAAM,KAAK,qBAAqB,EAAE,GAAG,KAAK,OAAO,KAAK,KAAK,MAAM,CAAC;AAAA,IAC3E;
|
|
4
|
+
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as fslib from 'fs'\nimport * as pathlib from 'path'\nimport semver from 'semver'\nimport * as apiUtils from '../api'\nimport * as codegen from '../code-generation'\nimport type commandDefinitions from '../command-definitions'\nimport * as consts from '../consts'\nimport * as errors from '../errors'\nimport * as pkgRef from '../package-ref'\nimport * as utils from '../utils'\nimport { GlobalCommand } from './global-command'\nimport {\n ProjectCache,\n ProjectCommand,\n ProjectCommandDefinition,\n ProjectDefinitionLazy,\n ProjectDefinition,\n} from './project-command'\n\ntype InstallablePackage =\n | {\n type: 'integration'\n pkg: codegen.IntegrationInstallablePackage\n }\n | {\n type: 'interface'\n pkg: codegen.InterfaceInstallablePackage\n }\n | {\n type: 'plugin'\n pkg: codegen.PluginInstallablePackage\n }\n\ntype RefWithAlias = pkgRef.PackageRef & { alias?: string }\n\nexport type AddCommandDefinition = typeof commandDefinitions.add\nexport class AddCommand extends GlobalCommand<AddCommandDefinition> {\n public async run(): Promise<void> {\n const ref = this._parseArgvRef()\n if (ref) {\n return await this._addNewSinglePackage({ ...ref, alias: this.argv.alias })\n }\n\n const pkgJson = await utils.pkgJson.readPackageJson(this.argv.installPath).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, 'failed to read package.json file')\n })\n\n if (!pkgJson) {\n this.logger.warn('No package.json found in the install path')\n return\n }\n\n const { bpDependencies } = pkgJson\n if (!bpDependencies) {\n this.logger.log('No bp dependencies found in package.json')\n return\n }\n\n const bpDependenciesSchema = sdk.z.record(sdk.z.string())\n const parseResults = bpDependenciesSchema.safeParse(bpDependencies)\n if (!parseResults.success) {\n throw new errors.BotpressCLIError('Invalid bpDependencies found in package.json')\n }\n\n for (const [pkgAlias, pkgRefStr] of Object.entries(parseResults.data)) {\n const parsed = pkgRef.parsePackageRef(pkgRefStr)\n if (!parsed) {\n throw new errors.InvalidPackageReferenceError(pkgRefStr)\n }\n\n await this._addSinglePackage({ ...parsed, alias: pkgAlias })\n }\n }\n\n private _parseArgvRef = (): pkgRef.PackageRef | undefined => {\n if (!this.argv.packageRef) {\n return\n }\n\n const parsed = pkgRef.parsePackageRef(this.argv.packageRef)\n if (!parsed) {\n throw new errors.InvalidPackageReferenceError(this.argv.packageRef)\n }\n\n if (parsed.type !== 'name') {\n return parsed\n }\n\n const argvPkgType = this.argv.packageType\n if (!argvPkgType) {\n return parsed\n }\n\n const ref = { ...parsed, pkg: argvPkgType }\n\n const strRef = pkgRef.formatPackageRef(ref)\n this.logger.warn(`argument --packageType is deprecated; please use the package reference format \"${strRef}\"`)\n\n return ref\n }\n\n private async _addSinglePackage(ref: RefWithAlias) {\n const { packageName, targetPackage } = await this._findPackage(ref)\n\n const baseInstallPath = utils.path.absoluteFrom(utils.path.cwd(), this.argv.installPath)\n const packageDirName = utils.casing.to.kebabCase(packageName)\n const installPath = utils.path.join(baseInstallPath, consts.installDirName, packageDirName)\n\n const alreadyInstalled = fslib.existsSync(installPath)\n if (alreadyInstalled) {\n this.logger.warn(`Package with name \"${packageName}\" already installed.`)\n const res = await this.prompt.confirm('Do you want to overwrite the existing package?')\n if (!res) {\n throw new errors.AbortedOperationError()\n }\n\n await this._uninstall(installPath)\n }\n\n if (ref.type === 'name' && ref.version === pkgRef.LATEST_TAG) {\n // If the semver version expression is 'latest', we assume the project\n // is compatible with all versions of the latest major:\n const major = semver.major(targetPackage.pkg.version)\n targetPackage.pkg.version = `>=${major}.0.0 <${major + 1}.0.0`\n\n this.logger.log(\n `Dependency \"${packageName}\" will be installed with version \"${targetPackage.pkg.version}\". ` +\n `To pin a specific version or version range, please change \"${targetPackage.type}:${packageName}@latest\" ` +\n 'to a specific version number or range instead of \"latest\".'\n )\n } else if (ref.type === 'name') {\n // Preserve the semver version expression in the generated code:\n targetPackage.pkg.version = ref.version\n }\n\n let files: codegen.File[]\n if (targetPackage.type === 'integration') {\n files = await codegen.generateIntegrationPackage(targetPackage.pkg)\n } else if (targetPackage.type === 'interface') {\n files = await codegen.generateInterfacePackage(targetPackage.pkg)\n } else if (targetPackage.type === 'plugin') {\n files = await codegen.generatePluginPackage(targetPackage.pkg)\n } else {\n type _assertion = utils.types.AssertNever<typeof targetPackage>\n throw new errors.BotpressCLIError('Invalid package type')\n }\n\n await this._install(installPath, files)\n }\n\n private async _addNewSinglePackage(ref: RefWithAlias) {\n await this._addSinglePackage(ref)\n const { packageName, targetPackage } = await this._findPackage(ref)\n await this._addDependencyToPackage(packageName, targetPackage)\n }\n\n private async _findPackage(ref: RefWithAlias): Promise<{ packageName: string; targetPackage: InstallablePackage }> {\n const targetPackage = ref.type === 'path' ? await this._findLocalPackage(ref) : await this._findRemotePackage(ref)\n if (!targetPackage) {\n const strRef = pkgRef.formatPackageRef(ref)\n throw new errors.BotpressCLIError(`Could not find package \"${strRef}\"`)\n }\n const packageName = ref.alias ?? targetPackage.pkg.name\n\n return { packageName, targetPackage }\n }\n\n private async _findRemotePackage(ref: pkgRef.ApiPackageRef): Promise<InstallablePackage | undefined> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n if (this._pkgCouldBe(ref, 'integration')) {\n const integration = await api.findPublicOrPrivateIntegration(ref)\n if (integration) {\n const { name, version } = integration\n return { type: 'integration', pkg: { integration, name, version } }\n }\n }\n if (this._pkgCouldBe(ref, 'interface')) {\n const intrface = await api.findPublicOrPrivateInterface(ref)\n if (intrface) {\n const { name, version } = intrface\n return { type: 'interface', pkg: { interface: intrface, name, version } }\n }\n }\n if (this._pkgCouldBe(ref, 'plugin')) {\n const plugin = await api.findPublicOrPrivatePlugin(ref)\n if (plugin) {\n const { code } = plugin.public\n ? await api.client.getPublicPluginCode({ id: plugin.id, platform: 'node' })\n : await api.client.getPluginCode({ id: plugin.id, platform: 'node' })\n const { name, version } = plugin\n return {\n type: 'plugin',\n pkg: {\n name,\n version,\n plugin,\n code,\n },\n }\n }\n }\n return\n }\n\n private async _findLocalPackage(ref: pkgRef.LocalPackageRef): Promise<InstallablePackage | undefined> {\n const absPath = utils.path.absoluteFrom(utils.path.cwd(), ref.path)\n const {\n definition: projectDefinition,\n implementation: projectImplementation,\n devId: projectDevId,\n } = await this._readProject(absPath)\n\n if (projectDefinition?.type === 'integration') {\n const { name, version } = projectDefinition.definition\n let devId: string | undefined\n if (this.argv.useDev && projectDevId) {\n this.logger.warn(`Installing integration \"${name}\" with dev version \"${projectDevId}\"`)\n devId = projectDevId\n }\n\n let createIntegrationReqBody = await this._getProjectCmd(ref.path).prepareCreateIntegrationBody(\n projectDefinition.definition\n )\n createIntegrationReqBody = {\n ...createIntegrationReqBody,\n interfaces: utils.records.mapValues(projectDefinition.definition.interfaces ?? {}, (i) => ({\n id: '', // TODO: do this better\n ...i,\n })),\n }\n return {\n type: 'integration',\n pkg: { path: absPath, devId, name, version, integration: createIntegrationReqBody },\n }\n }\n\n if (projectDefinition?.type === 'interface') {\n const { name, version } = projectDefinition.definition\n const createInterfaceReqBody = await apiUtils.prepareCreateInterfaceBody(projectDefinition.definition)\n return {\n type: 'interface',\n pkg: { path: absPath, name, version, interface: createInterfaceReqBody },\n }\n }\n\n if (projectDefinition?.type === 'plugin') {\n if (!projectImplementation) {\n throw new errors.BotpressCLIError(\n 'Plugin implementation not found; Please build the plugin project before installing'\n )\n }\n\n const pluginDefinition = projectDefinition.definition\n const { name, version } = pluginDefinition\n const code = projectImplementation\n\n const createPluginReqBody = await apiUtils.prepareCreatePluginBody(pluginDefinition)\n return {\n type: 'plugin',\n pkg: {\n path: absPath,\n name,\n version,\n code,\n plugin: {\n ...createPluginReqBody,\n dependencies: {\n interfaces: pluginDefinition.interfaces,\n integrations: pluginDefinition.integrations,\n },\n recurringEvents: pluginDefinition.recurringEvents,\n },\n },\n }\n }\n\n if (projectDefinition?.type === 'bot') {\n throw new errors.BotpressCLIError('Cannot install a bot as a package')\n }\n return\n }\n\n private async _install(installPath: utils.path.AbsolutePath, files: codegen.File[]): Promise<void> {\n const line = this.logger.line()\n line.started(`Installing ${files.length} files to \"${installPath}\"`)\n try {\n for (const file of files) {\n const filePath = utils.path.absoluteFrom(installPath, file.path)\n const dirPath = pathlib.dirname(filePath)\n await fslib.promises.mkdir(dirPath, { recursive: true })\n await fslib.promises.writeFile(filePath, file.content)\n }\n line.success(`Installed ${files.length} files to \"${installPath}\"`)\n } finally {\n line.commit()\n }\n }\n\n private async _uninstall(installPath: utils.path.AbsolutePath): Promise<void> {\n await fslib.promises.rm(installPath, { recursive: true })\n }\n\n private async _readProject(workDir: utils.path.AbsolutePath): Promise<{\n definition?: ProjectDefinition\n implementation?: string\n devId?: string\n }> {\n const cmd = this._getProjectCmd(workDir)\n\n const { resolveProjectDefinition } = cmd.readProjectDefinitionFromFS()\n const definition = await resolveProjectDefinition().catch((thrown) => {\n if (thrown instanceof errors.ProjectDefinitionNotFoundError) {\n return undefined\n }\n throw thrown\n })\n\n const devId = await cmd.projectCache.get('devId')\n\n const implementationAbsPath = utils.path.join(workDir, consts.fromWorkDir.outFileCJS)\n if (!fslib.existsSync(implementationAbsPath)) {\n return { definition, devId }\n }\n\n const implementation = await fslib.promises.readFile(implementationAbsPath, 'utf8')\n return { definition, implementation, devId }\n }\n\n private _pkgCouldBe = (ref: pkgRef.ApiPackageRef, pkgType: InstallablePackage['type']) => {\n if (ref.type === 'id') {\n // TODO: use ULID prefixes to determine the type of the package\n return true\n }\n if (!ref.pkg) {\n return true // ref does not specify the package type\n }\n return ref.pkg === pkgType\n }\n\n private _getProjectCmd(workDir: string): _AnyProjectCommand {\n return new _AnyProjectCommand(apiUtils.ApiClient, this.prompt, this.logger, {\n ...this.argv,\n workDir,\n })\n }\n\n private async _addDependencyToPackage(packageName: string, targetPackage: InstallablePackage) {\n const pkgJson = await utils.pkgJson.readPackageJson(this.argv.installPath)\n const version =\n targetPackage.pkg.path ?? `${targetPackage.type}:${targetPackage.pkg.name}@${targetPackage.pkg.version}`\n if (!pkgJson) {\n this.logger.warn('No package.json found in the install path')\n return\n }\n\n const { bpDependencies } = pkgJson\n if (!bpDependencies) {\n pkgJson.bpDependencies = { [packageName]: version }\n await utils.pkgJson.writePackageJson(this.argv.installPath, pkgJson)\n return\n }\n\n const bpDependenciesSchema = sdk.z.record(sdk.z.string())\n const parseResult = bpDependenciesSchema.safeParse(bpDependencies)\n if (!parseResult.success) {\n throw new errors.BotpressCLIError('Invalid bpDependencies found in package.json')\n }\n\n const { data: validatedBpDeps } = parseResult\n\n const alreadyPresentDep = Object.entries(validatedBpDeps).find(([key]) => key === packageName)\n if (alreadyPresentDep) {\n if (alreadyPresentDep[1] !== version) {\n this.logger.warn(\n `The dependency ${packageName} is already present in the bpDependencies of package.json. It will not be replaced.`\n )\n }\n return\n }\n\n pkgJson.bpDependencies = {\n ...validatedBpDeps,\n [packageName]: version,\n }\n\n await utils.pkgJson.writePackageJson(this.argv.installPath, pkgJson)\n }\n}\n\n// this is a hack to avoid refactoring the project command class\nclass _AnyProjectCommand extends ProjectCommand<ProjectCommandDefinition> {\n public async run(): Promise<void> {\n throw new errors.BotpressCLIError('Not implemented')\n }\n\n public readProjectDefinitionFromFS(): ProjectDefinitionLazy {\n return super.readProjectDefinitionFromFS()\n }\n\n public async prepareCreateIntegrationBody(\n integrationDef: sdk.IntegrationDefinition\n ): Promise<apiUtils.CreateIntegrationRequestBody> {\n return super.prepareCreateIntegrationBody(integrationDef)\n }\n\n public get projectCache(): utils.cache.FSKeyValueCache<ProjectCache> {\n return super.projectCache\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAAqB;AACrB,YAAuB;AACvB,cAAyB;AACzB,oBAAmB;AACnB,eAA0B;AAC1B,cAAyB;AAEzB,aAAwB;AACxB,aAAwB;AACxB,aAAwB;AACxB,YAAuB;AACvB,4BAA8B;AAC9B,6BAMO;AAmBA,MAAM,mBAAmB,oCAAoC;AAAA,EAClE,MAAa,MAAqB;AAChC,UAAM,MAAM,KAAK,cAAc;AAC/B,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I,OAAO,iBAAiB,iBAAiB;AAAA,EACrD;AAAA,EAEO,8BAAqD;AAC1D,WAAO,MAAM,4BAA4B;AAAA,EAC3C;AAAA,EAEA,MAAa,6BACX,gBACgD;AAChD,WAAO,MAAM,6BAA6B,cAAc;AAAA,EAC1D;AAAA,EAEA,IAAW,eAA0D;AACnE,WAAO,MAAM;AAAA,EACf;AACF;",
|
|
6
6
|
"names": ["semver"]
|
|
7
7
|
}
|
|
@@ -83,31 +83,35 @@ class GlobalCommand extends import_base_command.BaseCommand {
|
|
|
83
83
|
this.logger.cleanup();
|
|
84
84
|
};
|
|
85
85
|
async getAuthenticatedClient(credentials) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
86
|
+
try {
|
|
87
|
+
const cache = this.globalCache;
|
|
88
|
+
let token;
|
|
89
|
+
let workspaceId;
|
|
90
|
+
let apiUrl;
|
|
91
|
+
if (this.argv.profile) {
|
|
92
|
+
if (credentials.token || credentials.workspaceId || credentials.apiUrl) {
|
|
93
|
+
this.logger.warn(
|
|
94
|
+
"You are currently using credential command line arguments or environment variables as well as a profile. Your profile has overwritten the variables"
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
;
|
|
98
|
+
({ token, workspaceId, apiUrl } = await this.readProfileFromFS(this.argv.profile));
|
|
99
|
+
this.logger.log(`Using profile "${this.argv.profile}"`, { prefix: "\u{1F464}" });
|
|
100
|
+
} else {
|
|
101
|
+
token = credentials.token ?? await cache.get("token");
|
|
102
|
+
workspaceId = credentials.workspaceId ?? await cache.get("workspaceId");
|
|
103
|
+
apiUrl = credentials.apiUrl ?? await cache.get("apiUrl");
|
|
95
104
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return null;
|
|
106
|
-
}
|
|
107
|
-
if (apiUrl !== consts.defaultBotpressApiUrl) {
|
|
108
|
-
this.logger.log(`Using custom url ${apiUrl}`, { prefix: "\u{1F517}" });
|
|
105
|
+
if (!(token && workspaceId && apiUrl)) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
if (apiUrl !== consts.defaultBotpressApiUrl) {
|
|
109
|
+
this.logger.log(`Using custom url ${apiUrl}`, { prefix: "\u{1F517}" });
|
|
110
|
+
}
|
|
111
|
+
return this.api.newClient({ apiUrl, token, workspaceId }, this.logger);
|
|
112
|
+
} catch (thrown) {
|
|
113
|
+
throw errors.BotpressCLIError.wrap(thrown, "failed to create authenticated client");
|
|
109
114
|
}
|
|
110
|
-
return this.api.newClient({ apiUrl, token, workspaceId }, this.logger);
|
|
111
115
|
}
|
|
112
116
|
async readProfileFromFS(profile) {
|
|
113
117
|
const parsedProfiles = await this.readProfilesFromFS();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/command-implementations/global-command.ts"],
|
|
4
|
-
"sourcesContent": ["import { z } from '@botpress/sdk'\nimport type { YargsConfig } from '@bpinternal/yargs-extra'\nimport chalk from 'chalk'\nimport * as fs from 'fs'\nimport latestVersion from 'latest-version'\nimport _ from 'lodash'\nimport semver from 'semver'\nimport type { ApiClientFactory } from '../api/client'\nimport * as config from '../config'\nimport * as consts from '../consts'\nimport * as errors from '../errors'\nimport type { CommandArgv, CommandDefinition } from '../typings'\nimport * as utils from '../utils'\nimport { BaseCommand } from './base-command'\n\nexport type GlobalCommandDefinition = CommandDefinition<typeof config.schemas.global>\nexport type GlobalCache = { apiUrl: string; token: string; workspaceId: string; activeProfile: string }\n\nexport type ConfigurableGlobalPaths = {\n botpressHomeDir: string\n cliRootDir: utils.path.AbsolutePath\n profilesPath: string\n}\nexport type ConstantGlobalPaths = typeof consts.fromHomeDir & typeof consts.fromCliRootDir\nexport type AllGlobalPaths = ConfigurableGlobalPaths & ConstantGlobalPaths\n\nconst profileCredentialSchema = z.object({ apiUrl: z.string(), workspaceId: z.string(), token: z.string() })\nexport type ProfileCredentials = z.infer<typeof profileCredentialSchema>\n\nclass GlobalPaths extends utils.path.PathStore<keyof AllGlobalPaths> {\n public constructor(argv: CommandArgv<GlobalCommandDefinition>) {\n const absBotpressHome = utils.path.absoluteFrom(utils.path.cwd(), argv.botpressHome)\n super({\n cliRootDir: consts.cliRootDir,\n botpressHomeDir: absBotpressHome,\n profilesPath: utils.path.absoluteFrom(absBotpressHome, consts.profileFileName),\n ..._.mapValues(consts.fromHomeDir, (p) => utils.path.absoluteFrom(absBotpressHome, p)),\n ..._.mapValues(consts.fromCliRootDir, (p) => utils.path.absoluteFrom(consts.cliRootDir, p)),\n })\n }\n}\n\nexport abstract class GlobalCommand<C extends GlobalCommandDefinition> extends BaseCommand<C> {\n protected api: ApiClientFactory\n protected prompt: utils.prompt.CLIPrompt\n private _pkgJson: utils.pkgJson.PackageJson | undefined\n\n public constructor(\n api: ApiClientFactory,\n prompt: utils.prompt.CLIPrompt,\n ...args: ConstructorParameters<typeof BaseCommand<C>>\n ) {\n super(...args)\n this.api = api\n this.prompt = prompt\n }\n\n protected get globalPaths() {\n return new GlobalPaths(this.argv)\n }\n\n protected get globalCache() {\n return new utils.cache.FSKeyValueCache<GlobalCache>(this.globalPaths.abs.globalCacheFile)\n }\n\n protected override async bootstrap() {\n const pkgJson = await this.readPkgJson()\n const versionText = chalk.bold(`v${pkgJson.version}`)\n this.logger.log(`Botpress CLI ${versionText}`, { prefix: '\uD83E\uDD16' })\n\n await this._notifyUpdateCli()\n\n const paths = this.globalPaths\n if (paths.abs.botpressHomeDir !== consts.defaultBotpressHome) {\n this.logger.log(`Using custom botpress home: ${paths.abs.botpressHomeDir}`, { prefix: '\uD83C\uDFE0' })\n }\n }\n\n protected override teardown = async () => {\n this.logger.cleanup()\n }\n\n protected async getAuthenticatedClient(credentials: Partial<YargsConfig<typeof config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Y;AACnC,UAAM,UAAU,MAAM,KAAK,YAAY;AACvC,UAAM,cAAc,aAAAC,QAAM,KAAK,IAAI,QAAQ,OAAO,EAAE;AACpD,SAAK,OAAO,IAAI,gBAAgB,WAAW,IAAI,EAAE,QAAQ,YAAK,CAAC;AAE/D,UAAM,KAAK,iBAAiB;AAE5B,UAAM,QAAQ,KAAK;AACnB,QAAI,MAAM,IAAI,oBAAoB,OAAO,qBAAqB;AAC5D,WAAK,OAAO,IAAI,+BAA+B,MAAM,IAAI,eAAe,IAAI,EAAE,QAAQ,YAAK,CAAC;AAAA,IAC9F;AAAA,EACF;AAAA,EAEmB,WAAW,YAAY;AACxC,SAAK,OAAO,QAAQ;AAAA,EACtB;AAAA,EAEA,MAAgB,uBAAuB,aAAsE;AAC3G,
|
|
4
|
+
"sourcesContent": ["import { z } from '@botpress/sdk'\nimport type { YargsConfig } from '@bpinternal/yargs-extra'\nimport chalk from 'chalk'\nimport * as fs from 'fs'\nimport latestVersion from 'latest-version'\nimport _ from 'lodash'\nimport semver from 'semver'\nimport type { ApiClientFactory } from '../api/client'\nimport * as config from '../config'\nimport * as consts from '../consts'\nimport * as errors from '../errors'\nimport type { CommandArgv, CommandDefinition } from '../typings'\nimport * as utils from '../utils'\nimport { BaseCommand } from './base-command'\n\nexport type GlobalCommandDefinition = CommandDefinition<typeof config.schemas.global>\nexport type GlobalCache = { apiUrl: string; token: string; workspaceId: string; activeProfile: string }\n\nexport type ConfigurableGlobalPaths = {\n botpressHomeDir: string\n cliRootDir: utils.path.AbsolutePath\n profilesPath: string\n}\nexport type ConstantGlobalPaths = typeof consts.fromHomeDir & typeof consts.fromCliRootDir\nexport type AllGlobalPaths = ConfigurableGlobalPaths & ConstantGlobalPaths\n\nconst profileCredentialSchema = z.object({ apiUrl: z.string(), workspaceId: z.string(), token: z.string() })\nexport type ProfileCredentials = z.infer<typeof profileCredentialSchema>\n\nclass GlobalPaths extends utils.path.PathStore<keyof AllGlobalPaths> {\n public constructor(argv: CommandArgv<GlobalCommandDefinition>) {\n const absBotpressHome = utils.path.absoluteFrom(utils.path.cwd(), argv.botpressHome)\n super({\n cliRootDir: consts.cliRootDir,\n botpressHomeDir: absBotpressHome,\n profilesPath: utils.path.absoluteFrom(absBotpressHome, consts.profileFileName),\n ..._.mapValues(consts.fromHomeDir, (p) => utils.path.absoluteFrom(absBotpressHome, p)),\n ..._.mapValues(consts.fromCliRootDir, (p) => utils.path.absoluteFrom(consts.cliRootDir, p)),\n })\n }\n}\n\nexport abstract class GlobalCommand<C extends GlobalCommandDefinition> extends BaseCommand<C> {\n protected api: ApiClientFactory\n protected prompt: utils.prompt.CLIPrompt\n private _pkgJson: utils.pkgJson.PackageJson | undefined\n\n public constructor(\n api: ApiClientFactory,\n prompt: utils.prompt.CLIPrompt,\n ...args: ConstructorParameters<typeof BaseCommand<C>>\n ) {\n super(...args)\n this.api = api\n this.prompt = prompt\n }\n\n protected get globalPaths() {\n return new GlobalPaths(this.argv)\n }\n\n protected get globalCache() {\n return new utils.cache.FSKeyValueCache<GlobalCache>(this.globalPaths.abs.globalCacheFile)\n }\n\n protected override async bootstrap() {\n const pkgJson = await this.readPkgJson()\n const versionText = chalk.bold(`v${pkgJson.version}`)\n this.logger.log(`Botpress CLI ${versionText}`, { prefix: '\uD83E\uDD16' })\n\n await this._notifyUpdateCli()\n\n const paths = this.globalPaths\n if (paths.abs.botpressHomeDir !== consts.defaultBotpressHome) {\n this.logger.log(`Using custom botpress home: ${paths.abs.botpressHomeDir}`, { prefix: '\uD83C\uDFE0' })\n }\n }\n\n protected override teardown = async () => {\n this.logger.cleanup()\n }\n\n protected async getAuthenticatedClient(credentials: Partial<YargsConfig<typeof config.schemas.credentials>>) {\n try {\n const cache = this.globalCache\n\n let token: string | undefined\n let workspaceId: string | undefined\n let apiUrl: string | undefined\n\n if (this.argv.profile) {\n if (credentials.token || credentials.workspaceId || credentials.apiUrl) {\n this.logger.warn(\n 'You are currently using credential command line arguments or environment variables as well as a profile. Your profile has overwritten the variables'\n )\n }\n ;({ token, workspaceId, apiUrl } = await this.readProfileFromFS(this.argv.profile))\n this.logger.log(`Using profile \"${this.argv.profile}\"`, { prefix: '\uD83D\uDC64' })\n } else {\n token = credentials.token ?? (await cache.get('token'))\n workspaceId = credentials.workspaceId ?? (await cache.get('workspaceId'))\n apiUrl = credentials.apiUrl ?? (await cache.get('apiUrl'))\n }\n\n if (!(token && workspaceId && apiUrl)) {\n return null\n }\n\n if (apiUrl !== consts.defaultBotpressApiUrl) {\n this.logger.log(`Using custom url ${apiUrl}`, { prefix: '\uD83D\uDD17' })\n }\n\n return this.api.newClient({ apiUrl, token, workspaceId }, this.logger)\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, 'failed to create authenticated client')\n }\n }\n\n protected async readProfileFromFS(profile: string): Promise<ProfileCredentials> {\n const parsedProfiles = await this.readProfilesFromFS()\n\n const profileData = parsedProfiles[profile]\n if (!profileData) {\n throw new errors.BotpressCLIError(\n `Profile \"${profile}\" not found in \"${this.globalPaths.abs.profilesPath}\". Found profiles '${Object.keys(parsedProfiles).join(\"', '\")}'.`\n )\n }\n\n return profileData\n }\n\n protected async readProfilesFromFS(): Promise<Record<string, ProfileCredentials>> {\n if (!fs.existsSync(this.globalPaths.abs.profilesPath)) {\n throw new errors.BotpressCLIError(`Profile file not found at \"${this.globalPaths.abs.profilesPath}\"`)\n }\n const fileContent = await fs.promises.readFile(this.globalPaths.abs.profilesPath, 'utf-8')\n const parsedProfiles = JSON.parse(fileContent)\n\n const zodParseResult = z.record(profileCredentialSchema).safeParse(parsedProfiles)\n if (!zodParseResult.success) {\n throw errors.BotpressCLIError.wrap(zodParseResult.error, 'Error parsing profiles: ')\n }\n\n return zodParseResult.data\n }\n\n protected async writeProfileToFS(profileName: string, profile: ProfileCredentials): Promise<void> {\n let profiles: Record<string, ProfileCredentials>\n if (fs.existsSync(this.globalPaths.abs.profilesPath)) {\n profiles = await this.readProfilesFromFS()\n } else {\n profiles = {}\n }\n profiles[profileName] = profile\n\n await fs.promises.writeFile(\n this.globalPaths.abs.profilesPath,\n JSON.stringify({ [consts.defaultProfileName]: profiles.defaultProfileName, ...profiles }, null, 2),\n 'utf-8'\n )\n }\n\n protected async ensureLoginAndCreateClient(credentials: YargsConfig<typeof config.schemas.credentials>) {\n const client = await this.getAuthenticatedClient(credentials)\n\n if (client === null) {\n throw new errors.NotLoggedInError()\n }\n\n return client\n }\n\n private readonly _notifyUpdateCli = async (): Promise<void> => {\n try {\n this.logger.debug('Checking if cli is up to date')\n\n const pkgJson = await this.readPkgJson()\n if (!pkgJson.version) {\n throw new errors.BotpressCLIError('Could not find version in package.json')\n }\n\n const latest = await latestVersion(pkgJson.name)\n const isOutdated = semver.lt(pkgJson.version, latest)\n if (isOutdated) {\n this.logger.box(\n [\n `${chalk.bold('Update available')} ${chalk.dim(pkgJson.version)} \u2192 ${chalk.green(latest)}`,\n '',\n 'To update, run:',\n ` for npm ${chalk.cyan(`npm i -g ${pkgJson.name}`)}`,\n ` for yarn ${chalk.cyan(`yarn global add ${pkgJson.name}`)}`,\n ` for pnpm ${chalk.cyan(`pnpm i -g ${pkgJson.name}`)}`,\n ].join('\\n')\n )\n }\n } catch (thrown) {\n const err = errors.BotpressCLIError.map(thrown)\n this.logger.debug(`Failed to check if cli is up to date: ${err.message}`)\n }\n }\n\n protected async readPkgJson(): Promise<utils.pkgJson.PackageJson> {\n if (this._pkgJson) {\n return this._pkgJson\n }\n const { cliRootDir } = this.globalPaths.abs\n const pkgJson = await utils.pkgJson.readPackageJson(cliRootDir)\n if (!pkgJson) {\n throw new errors.BotpressCLIError(`Could not find package.json at \"${cliRootDir}\"`)\n }\n\n this._pkgJson = pkgJson\n return pkgJson\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAkB;AAElB,mBAAkB;AAClB,SAAoB;AACpB,4BAA0B;AAC1B,oBAAc;AACd,oBAAmB;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EA,SAAK,WAAW;AAChB,WAAO;AAAA,EACT;AACF;",
|
|
6
6
|
"names": ["_", "chalk", "latestVersion", "semver"]
|
|
7
7
|
}
|
|
@@ -69,8 +69,10 @@ class ListIntegrationsCommand extends import_global_command.GlobalCommand {
|
|
|
69
69
|
const dummyLister = async () => ({ integrations: [], meta: {} });
|
|
70
70
|
const publicLister = dev ? dummyLister : (req) => api.client.listPublicIntegrations({ nextToken: req.nextToken, name, version });
|
|
71
71
|
try {
|
|
72
|
-
const privateIntegrations = await
|
|
73
|
-
|
|
72
|
+
const [privateIntegrations, publicIntegrations] = await Promise.all([
|
|
73
|
+
api.listAllPages(privateLister, (r) => r.integrations),
|
|
74
|
+
api.listAllPages(publicLister, (r) => r.integrations)
|
|
75
|
+
]);
|
|
74
76
|
const integrations = import_lodash.default.uniqBy([...privateIntegrations, ...publicIntegrations], (i) => i.id);
|
|
75
77
|
this.logger.success("Integrations:");
|
|
76
78
|
this.logger.json(integrations);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/command-implementations/integration-commands.ts"],
|
|
4
|
-
"sourcesContent": ["import chalk from 'chalk'\nimport _ from 'lodash'\nimport { ApiClient, PublicOrPrivateIntegration } from 'src/api/client'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport { NamePackageRef, parsePackageRef } from '../package-ref'\nimport { GlobalCommand } from './global-command'\n\nexport type GetIntegrationCommandDefinition = typeof commandDefinitions.integrations.subcommands.get\nexport class GetIntegrationCommand extends GlobalCommand<GetIntegrationCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n const parsedRef = parsePackageRef(this.argv.integrationRef)\n if (!parsedRef) {\n throw new errors.InvalidPackageReferenceError(this.argv.integrationRef)\n }\n if (parsedRef.type === 'path') {\n throw new errors.BotpressCLIError('Cannot get local integration')\n }\n\n try {\n const integration = await api.findPublicOrPrivateIntegration(parsedRef)\n if (integration) {\n this.logger.success(`Integration ${chalk.bold(this.argv.integrationRef)}:`)\n this.logger.json(integration)\n return\n }\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not get integration ${this.argv.integrationRef}`)\n }\n\n throw new errors.BotpressCLIError(`Integration ${this.argv.integrationRef} not found`)\n }\n}\n\nexport type ListIntegrationsCommandDefinition = typeof commandDefinitions.integrations.subcommands.list\nexport class ListIntegrationsCommand extends GlobalCommand<ListIntegrationsCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n\n const { dev, name, versionNumber: version } = this.argv\n\n const privateLister = (req: { nextToken?: string }) =>\n api.client.listIntegrations({ nextToken: req.nextToken, dev, name, version })\n\n const dummyLister: typeof privateLister = async () => ({ integrations: [], meta: {} })\n const publicLister = dev\n ? dummyLister\n : (req: { nextToken?: string }) => api.client.listPublicIntegrations({ nextToken: req.nextToken, name, version })\n\n try {\n const privateIntegrations = await api.listAllPages(privateLister, (r) => r.integrations)
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,oBAAc;AAGd,aAAwB;AACxB,yBAAgD;AAChD,4BAA8B;AAGvB,MAAM,8BAA8B,oCAA+C;AAAA,EACxF,MAAa,MAAqB;AAChC,UAAM,MAAM,MAAM,KAAK,2BAA2B,KAAK,IAAI;AAC3D,UAAM,gBAAY,oCAAgB,KAAK,KAAK,cAAc;AAC1D,QAAI,CAAC,WAAW;AACd,YAAM,IAAI,OAAO,6BAA6B,KAAK,KAAK,cAAc;AAAA,IACxE;AACA,QAAI,UAAU,SAAS,QAAQ;AAC7B,YAAM,IAAI,OAAO,iBAAiB,8BAA8B;AAAA,IAClE;AAEA,QAAI;AACF,YAAM,cAAc,MAAM,IAAI,+BAA+B,SAAS;AACtE,UAAI,aAAa;AACf,aAAK,OAAO,QAAQ,eAAe,aAAAA,QAAM,KAAK,KAAK,KAAK,cAAc,CAAC,GAAG;AAC1E,aAAK,OAAO,KAAK,WAAW;AAC5B;AAAA,MACF;AAAA,IACF,SAAS,QAAQ;AACf,YAAM,OAAO,iBAAiB,KAAK,QAAQ,6BAA6B,KAAK,KAAK,cAAc,EAAE;AAAA,IACpG;AAEA,UAAM,IAAI,OAAO,iBAAiB,eAAe,KAAK,KAAK,cAAc,YAAY;AAAA,EACvF;AACF;AAGO,MAAM,gCAAgC,oCAAiD;AAAA,EAC5F,MAAa,MAAqB;AAChC,UAAM,MAAM,MAAM,KAAK,2BAA2B,KAAK,IAAI;AAE3D,UAAM,EAAE,KAAK,MAAM,eAAe,QAAQ,IAAI,KAAK;AAEnD,UAAM,gBAAgB,CAAC,QACrB,IAAI,OAAO,iBAAiB,EAAE,WAAW,IAAI,WAAW,KAAK,MAAM,QAAQ,CAAC;AAE9E,UAAM,cAAoC,aAAa,EAAE,cAAc,CAAC,GAAG,MAAM,CAAC,EAAE;AACpF,UAAM,eAAe,MACjB,cACA,CAAC,QAAgC,IAAI,OAAO,uBAAuB,EAAE,WAAW,IAAI,WAAW,MAAM,QAAQ,CAAC;AAElH,QAAI;AACF,YAAM,
|
|
4
|
+
"sourcesContent": ["import chalk from 'chalk'\nimport _ from 'lodash'\nimport { ApiClient, PublicOrPrivateIntegration } from 'src/api/client'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport { NamePackageRef, parsePackageRef } from '../package-ref'\nimport { GlobalCommand } from './global-command'\n\nexport type GetIntegrationCommandDefinition = typeof commandDefinitions.integrations.subcommands.get\nexport class GetIntegrationCommand extends GlobalCommand<GetIntegrationCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n const parsedRef = parsePackageRef(this.argv.integrationRef)\n if (!parsedRef) {\n throw new errors.InvalidPackageReferenceError(this.argv.integrationRef)\n }\n if (parsedRef.type === 'path') {\n throw new errors.BotpressCLIError('Cannot get local integration')\n }\n\n try {\n const integration = await api.findPublicOrPrivateIntegration(parsedRef)\n if (integration) {\n this.logger.success(`Integration ${chalk.bold(this.argv.integrationRef)}:`)\n this.logger.json(integration)\n return\n }\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not get integration ${this.argv.integrationRef}`)\n }\n\n throw new errors.BotpressCLIError(`Integration ${this.argv.integrationRef} not found`)\n }\n}\n\nexport type ListIntegrationsCommandDefinition = typeof commandDefinitions.integrations.subcommands.list\nexport class ListIntegrationsCommand extends GlobalCommand<ListIntegrationsCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n\n const { dev, name, versionNumber: version } = this.argv\n\n const privateLister = (req: { nextToken?: string }) =>\n api.client.listIntegrations({ nextToken: req.nextToken, dev, name, version })\n\n const dummyLister: typeof privateLister = async () => ({ integrations: [], meta: {} })\n const publicLister = dev\n ? dummyLister\n : (req: { nextToken?: string }) => api.client.listPublicIntegrations({ nextToken: req.nextToken, name, version })\n\n try {\n const [privateIntegrations, publicIntegrations] = await Promise.all([\n api.listAllPages(privateLister, (r) => r.integrations),\n api.listAllPages(publicLister, (r) => r.integrations),\n ])\n const integrations = _.uniqBy([...privateIntegrations, ...publicIntegrations], (i) => i.id)\n\n this.logger.success('Integrations:')\n this.logger.json(integrations)\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not list integrations')\n }\n }\n}\n\nexport type DeleteIntegrationCommandDefinition = typeof commandDefinitions.integrations.subcommands.delete\nexport class DeleteIntegrationCommand extends GlobalCommand<DeleteIntegrationCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n const parsedRef = parsePackageRef(this.argv.integrationRef)\n if (!parsedRef) {\n throw new errors.InvalidPackageReferenceError(this.argv.integrationRef)\n }\n if (parsedRef.type === 'path') {\n throw new errors.BotpressCLIError('Cannot delete local integration')\n }\n\n let integrationId: string | undefined\n if (parsedRef.type === 'id') {\n integrationId = parsedRef.id\n } else {\n const integration = await this._findIntegration(api, parsedRef)\n integrationId = integration.id\n }\n\n try {\n await api.client.deleteIntegration({ id: integrationId })\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not delete integration ${this.argv.integrationRef}`)\n }\n\n this.logger.success(`Integration ${chalk.bold(this.argv.integrationRef)} deleted`)\n return\n }\n\n private _findIntegration = async (api: ApiClient, parsedRef: NamePackageRef) => {\n let integration: PublicOrPrivateIntegration | undefined\n\n try {\n integration = await api.findPrivateIntegration(parsedRef)\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not get integration ${this.argv.integrationRef}`)\n }\n\n if (!integration) {\n const publicIntegration = await api.findPublicIntegration(parsedRef)\n if (publicIntegration) {\n throw new errors.BotpressCLIError(`Integration ${this.argv.integrationRef} does not belong to your workspace`)\n }\n\n throw new errors.BotpressCLIError(`Integration ${this.argv.integrationRef} not found`)\n }\n\n return integration\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,oBAAc;AAGd,aAAwB;AACxB,yBAAgD;AAChD,4BAA8B;AAGvB,MAAM,8BAA8B,oCAA+C;AAAA,EACxF,MAAa,MAAqB;AAChC,UAAM,MAAM,MAAM,KAAK,2BAA2B,KAAK,IAAI;AAC3D,UAAM,gBAAY,oCAAgB,KAAK,KAAK,cAAc;AAC1D,QAAI,CAAC,WAAW;AACd,YAAM,IAAI,OAAO,6BAA6B,KAAK,KAAK,cAAc;AAAA,IACxE;AACA,QAAI,UAAU,SAAS,QAAQ;AAC7B,YAAM,IAAI,OAAO,iBAAiB,8BAA8B;AAAA,IAClE;AAEA,QAAI;AACF,YAAM,cAAc,MAAM,IAAI,+BAA+B,SAAS;AACtE,UAAI,aAAa;AACf,aAAK,OAAO,QAAQ,eAAe,aAAAA,QAAM,KAAK,KAAK,KAAK,cA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67,8 +67,10 @@ class ListInterfacesCommand extends import_global_command.GlobalCommand {
|
|
|
67
67
|
const privateLister = (req) => api.client.listInterfaces({ nextToken: req.nextToken });
|
|
68
68
|
const publicLister = (req) => api.client.listPublicInterfaces({ nextToken: req.nextToken });
|
|
69
69
|
try {
|
|
70
|
-
const privateInterfaces = await
|
|
71
|
-
|
|
70
|
+
const [privateInterfaces, publicInterfaces] = await Promise.all([
|
|
71
|
+
api.listAllPages(privateLister, (r) => r.interfaces),
|
|
72
|
+
api.listAllPages(publicLister, (r) => r.interfaces)
|
|
73
|
+
]);
|
|
72
74
|
const interfaces = import_lodash.default.uniqBy([...privateInterfaces, ...publicInterfaces], (i) => i.id);
|
|
73
75
|
this.logger.success("Interfaces:");
|
|
74
76
|
this.logger.json(interfaces);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/command-implementations/interface-commands.ts"],
|
|
4
|
-
"sourcesContent": ["import type * as client from '@botpress/client'\nimport chalk from 'chalk'\nimport _ from 'lodash'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport { parsePackageRef } from '../package-ref'\nimport { GlobalCommand } from './global-command'\n\nexport type GetInterfaceCommandDefinition = typeof commandDefinitions.interfaces.subcommands.get\nexport class GetInterfaceCommand extends GlobalCommand<GetInterfaceCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n const parsedRef = parsePackageRef(this.argv.interfaceRef)\n if (!parsedRef) {\n throw new errors.InvalidPackageReferenceError(this.argv.interfaceRef)\n }\n if (parsedRef.type === 'path') {\n throw new errors.BotpressCLIError('Cannot get local interface')\n }\n\n try {\n const intrface = await api.findPublicOrPrivateInterface(parsedRef)\n if (intrface) {\n this.logger.success(`Interface ${chalk.bold(this.argv.interfaceRef)}:`)\n this.logger.json(intrface)\n return\n }\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not get interface ${this.argv.interfaceRef}`)\n }\n\n throw new errors.BotpressCLIError(`Interface ${this.argv.interfaceRef} not found`)\n }\n}\n\nexport type ListInterfacesCommandDefinition = typeof commandDefinitions.interfaces.subcommands.list\nexport class ListInterfacesCommand extends GlobalCommand<ListInterfacesCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n\n const privateLister = (req: { nextToken?: string }) => api.client.listInterfaces({ nextToken: req.nextToken })\n const publicLister = (req: { nextToken?: string }) => api.client.listPublicInterfaces({ nextToken: req.nextToken })\n\n try {\n const privateInterfaces = await api.listAllPages(privateLister, (r) => r.interfaces)
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,oBAAc;AAEd,aAAwB;AACxB,yBAAgC;AAChC,4BAA8B;AAGvB,MAAM,4BAA4B,oCAA6C;AAAA,EACpF,MAAa,MAAqB;AAChC,UAAM,MAAM,MAAM,KAAK,2BAA2B,KAAK,IAAI;AAC3D,UAAM,gBAAY,oCAAgB,KAAK,KAAK,YAAY;AACxD,QAAI,CAAC,WAAW;AACd,YAAM,IAAI,OAAO,6BAA6B,KAAK,KAAK,YAAY;AAAA,IACtE;AACA,QAAI,UAAU,SAAS,QAAQ;AAC7B,YAAM,IAAI,OAAO,iBAAiB,4BAA4B;AAAA,IAChE;AAEA,QAAI;AACF,YAAM,WAAW,MAAM,IAAI,6BAA6B,SAAS;AACjE,UAAI,UAAU;AACZ,aAAK,OAAO,QAAQ,aAAa,aAAAA,QAAM,KAAK,KAAK,KAAK,YAAY,CAAC,GAAG;AACtE,aAAK,OAAO,KAAK,QAAQ;AACzB;AAAA,MACF;AAAA,IACF,SAAS,QAAQ;AACf,YAAM,OAAO,iBAAiB,KAAK,QAAQ,2BAA2B,KAAK,KAAK,YAAY,EAAE;AAAA,IAChG;AAEA,UAAM,IAAI,OAAO,iBAAiB,aAAa,KAAK,KAAK,YAAY,YAAY;AAAA,EACnF;AACF;AAGO,MAAM,8BAA8B,oCAA+C;AAAA,EACxF,MAAa,MAAqB;AAChC,UAAM,MAAM,MAAM,KAAK,2BAA2B,KAAK,IAAI;AAE3D,UAAM,gBAAgB,CAAC,QAAgC,IAAI,OAAO,eAAe,EAAE,WAAW,IAAI,UAAU,CAAC;AAC7G,UAAM,eAAe,CAAC,QAAgC,IAAI,OAAO,qBAAqB,EAAE,WAAW,IAAI,UAAU,CAAC;AAElH,QAAI;AACF,YAAM,
|
|
4
|
+
"sourcesContent": ["import type * as client from '@botpress/client'\nimport chalk from 'chalk'\nimport _ from 'lodash'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport { parsePackageRef } from '../package-ref'\nimport { GlobalCommand } from './global-command'\n\nexport type GetInterfaceCommandDefinition = typeof commandDefinitions.interfaces.subcommands.get\nexport class GetInterfaceCommand extends GlobalCommand<GetInterfaceCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n const parsedRef = parsePackageRef(this.argv.interfaceRef)\n if (!parsedRef) {\n throw new errors.InvalidPackageReferenceError(this.argv.interfaceRef)\n }\n if (parsedRef.type === 'path') {\n throw new errors.BotpressCLIError('Cannot get local interface')\n }\n\n try {\n const intrface = await api.findPublicOrPrivateInterface(parsedRef)\n if (intrface) {\n this.logger.success(`Interface ${chalk.bold(this.argv.interfaceRef)}:`)\n this.logger.json(intrface)\n return\n }\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not get interface ${this.argv.interfaceRef}`)\n }\n\n throw new errors.BotpressCLIError(`Interface ${this.argv.interfaceRef} not found`)\n }\n}\n\nexport type ListInterfacesCommandDefinition = typeof commandDefinitions.interfaces.subcommands.list\nexport class ListInterfacesCommand extends GlobalCommand<ListInterfacesCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n\n const privateLister = (req: { nextToken?: string }) => api.client.listInterfaces({ nextToken: req.nextToken })\n const publicLister = (req: { nextToken?: string }) => api.client.listPublicInterfaces({ nextToken: req.nextToken })\n\n try {\n const [privateInterfaces, publicInterfaces] = await Promise.all([\n api.listAllPages(privateLister, (r) => r.interfaces),\n api.listAllPages(publicLister, (r) => r.interfaces),\n ])\n const interfaces = _.uniqBy([...privateInterfaces, ...publicInterfaces], (i) => i.id)\n\n this.logger.success('Interfaces:')\n this.logger.json(interfaces)\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not list interfaces')\n }\n }\n}\n\nexport type DeleteInterfaceCommandDefinition = typeof commandDefinitions.interfaces.subcommands.delete\nexport class DeleteInterfaceCommand extends GlobalCommand<DeleteInterfaceCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n const parsedRef = parsePackageRef(this.argv.interfaceRef)\n if (!parsedRef) {\n throw new errors.InvalidPackageReferenceError(this.argv.interfaceRef)\n }\n if (parsedRef.type === 'path') {\n throw new errors.BotpressCLIError('Cannot delete local interface')\n }\n\n let intrface: client.Interface | undefined\n try {\n intrface = await api.findPublicOrPrivateInterface(parsedRef)\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not get interface ${this.argv.interfaceRef}`)\n }\n\n if (!intrface) {\n throw new errors.BotpressCLIError(`Interface ${this.argv.interfaceRef} not found`)\n }\n\n try {\n await api.client.deleteInterface({ id: intrface.id })\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not delete interface ${this.argv.interfaceRef}`)\n }\n\n this.logger.success(`Interface ${chalk.bold(this.argv.interfaceRef)} deleted`)\n return\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,oBAAc;AAEd,aAAwB;AACxB,yBAAgC;AAChC,4BAA8B;AAGvB,MAAM,4BAA4B,oCAA6C;A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MAAM,EAAE,EAAE;AAEpF,WAAK,OAAO,QAAQ,aAAa;AACjC,WAAK,OAAO,KAAK,UAAU;AAAA,IAC7B,SAAS,QAAQ;AACf,YAAM,OAAO,iBAAiB,KAAK,QAAQ,2BAA2B;AAAA,IACxE;AAAA,EACF;AACF;AAGO,MAAM,+BAA+B,oCAAgD;AAAA,EAC1F,MAAa,MAAqB;AAChC,UAAM,MAAM,MAAM,KAAK,2BAA2B,KAAK,IAAI;AAC3D,UAAM,gBAAY,oCAAgB,KAAK,KAAK,YAAY;AACxD,QAAI,CAAC,WAAW;AACd,YAAM,IAAI,OAAO,6BAA6B,KAAK,KAAK,YAAY;AAAA,IACtE;AACA,QAAI,UAAU,SAAS,QAAQ;AAC7B,YAAM,IAAI,OAAO,iBAAiB,+BAA+B;AAAA,IACnE;AAEA,QAAI;AACJ,QAAI;AACF,iBAAW,MAAM,IAAI,6BAA6B,SAAS;AAAA,IAC7D,SAAS,QAAQ;AACf,YAAM,OAAO,iBAAiB,KAAK,QAAQ,2BAA2B,KAAK,KAAK,YAAY,EAAE;AAAA,IAChG;AAEA,QAAI,CAAC,UAAU;AACb,YAAM,IAAI,OAAO,iBAAiB,aAAa,KAAK,KAAK,YAAY,YAAY;AAAA,IACnF;AAEA,QAAI;AACF,YAAM,IAAI,OAAO,gBAAgB,EAAE,IAAI,SAAS,GAAG,CAAC;AAAA,IACtD,SAAS,QAAQ;AACf,YAAM,OAAO,iBAAiB,KAAK,QAAQ,8BAA8B,KAAK,KAAK,YAAY,EAAE;AAAA,IACnG;AAEA,SAAK,OAAO,QAAQ,aAAa,aAAAD,QAAM,KAAK,KAAK,KAAK,YAAY,CAAC,UAAU;AAC7E;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["chalk", "_"]
|
|
7
7
|
}
|
|
@@ -68,8 +68,10 @@ class ListPluginsCommand extends import_global_command.GlobalCommand {
|
|
|
68
68
|
const privateLister = (req) => api.client.listPlugins({ nextToken: req.nextToken, name, version });
|
|
69
69
|
const publicLister = (req) => api.client.listPublicPlugins({ nextToken: req.nextToken, name, version });
|
|
70
70
|
try {
|
|
71
|
-
const privatePlugins = await
|
|
72
|
-
|
|
71
|
+
const [privatePlugins, publicPlugins] = await Promise.all([
|
|
72
|
+
api.listAllPages(privateLister, (r) => r.plugins),
|
|
73
|
+
api.listAllPages(publicLister, (r) => r.plugins)
|
|
74
|
+
]);
|
|
73
75
|
const plugins = import_lodash.default.uniqBy([...privatePlugins, ...publicPlugins], (p) => p.id);
|
|
74
76
|
this.logger.success("Plugins:");
|
|
75
77
|
this.logger.json(plugins);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/command-implementations/plugin-commands.ts"],
|
|
4
|
-
"sourcesContent": ["import type * as client from '@botpress/client'\nimport chalk from 'chalk'\nimport _ from 'lodash'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport { parsePackageRef } from '../package-ref'\nimport { GlobalCommand } from './global-command'\n\nexport type GetPluginCommandDefinition = typeof commandDefinitions.plugins.subcommands.get\nexport class GetPluginCommand extends GlobalCommand<GetPluginCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n const parsedRef = parsePackageRef(this.argv.pluginRef)\n if (!parsedRef) {\n throw new errors.InvalidPackageReferenceError(this.argv.pluginRef)\n }\n if (parsedRef.type === 'path') {\n throw new errors.BotpressCLIError('Cannot get local plugin')\n }\n\n try {\n const plugin = await api.findPublicOrPrivatePlugin(parsedRef)\n if (plugin) {\n this.logger.success(`Plugin ${chalk.bold(this.argv.pluginRef)}:`)\n this.logger.json(plugin)\n return\n }\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not get plugin ${this.argv.pluginRef}`)\n }\n\n throw new errors.BotpressCLIError(`Plugin ${this.argv.pluginRef} not found`)\n }\n}\n\nexport type ListPluginsCommandDefinition = typeof commandDefinitions.plugins.subcommands.list\nexport class ListPluginsCommand extends GlobalCommand<ListPluginsCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n\n const { name, versionNumber: version } = this.argv\n\n const privateLister = (req: { nextToken?: string }) =>\n api.client.listPlugins({ nextToken: req.nextToken, name, version })\n const publicLister = (req: { nextToken?: string }) =>\n api.client.listPublicPlugins({ nextToken: req.nextToken, name, version })\n\n try {\n const privatePlugins = await api.listAllPages(privateLister, (r) => r.plugins)
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,oBAAc;AAEd,aAAwB;AACxB,yBAAgC;AAChC,4BAA8B;AAGvB,MAAM,yBAAyB,oCAA0C;AAAA,EAC9E,MAAa,MAAqB;AAChC,UAAM,MAAM,MAAM,KAAK,2BAA2B,KAAK,IAAI;AAC3D,UAAM,gBAAY,oCAAgB,KAAK,KAAK,SAAS;AACrD,QAAI,CAAC,WAAW;AACd,YAAM,IAAI,OAAO,6BAA6B,KAAK,KAAK,SAAS;AAAA,IACnE;AACA,QAAI,UAAU,SAAS,QAAQ;AAC7B,YAAM,IAAI,OAAO,iBAAiB,yBAAyB;AAAA,IAC7D;AAEA,QAAI;AACF,YAAM,SAAS,MAAM,IAAI,0BAA0B,SAAS;AAC5D,UAAI,QAAQ;AACV,aAAK,OAAO,QAAQ,UAAU,aAAAA,QAAM,KAAK,KAAK,KAAK,SAAS,CAAC,GAAG;AAChE,aAAK,OAAO,KAAK,MAAM;AACvB;AAAA,MACF;AAAA,IACF,SAAS,QAAQ;AACf,YAAM,OAAO,iBAAiB,KAAK,QAAQ,wBAAwB,KAAK,KAAK,SAAS,EAAE;AAAA,IAC1F;AAEA,UAAM,IAAI,OAAO,iBAAiB,UAAU,KAAK,KAAK,SAAS,YAAY;AAAA,EAC7E;AACF;AAGO,MAAM,2BAA2B,oCAA4C;AAAA,EAClF,MAAa,MAAqB;AAChC,UAAM,MAAM,MAAM,KAAK,2BAA2B,KAAK,IAAI;AAE3D,UAAM,EAAE,MAAM,eAAe,QAAQ,IAAI,KAAK;AAE9C,UAAM,gBAAgB,CAAC,QACrB,IAAI,OAAO,YAAY,EAAE,WAAW,IAAI,WAAW,MAAM,QAAQ,CAAC;AACpE,UAAM,eAAe,CAAC,QACpB,IAAI,OAAO,kBAAkB,EAAE,WAAW,IAAI,WAAW,MAAM,QAAQ,CAAC;AAE1E,QAAI;AACF,YAAM,
|
|
4
|
+
"sourcesContent": ["import type * as client from '@botpress/client'\nimport chalk from 'chalk'\nimport _ from 'lodash'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport { parsePackageRef } from '../package-ref'\nimport { GlobalCommand } from './global-command'\n\nexport type GetPluginCommandDefinition = typeof commandDefinitions.plugins.subcommands.get\nexport class GetPluginCommand extends GlobalCommand<GetPluginCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n const parsedRef = parsePackageRef(this.argv.pluginRef)\n if (!parsedRef) {\n throw new errors.InvalidPackageReferenceError(this.argv.pluginRef)\n }\n if (parsedRef.type === 'path') {\n throw new errors.BotpressCLIError('Cannot get local plugin')\n }\n\n try {\n const plugin = await api.findPublicOrPrivatePlugin(parsedRef)\n if (plugin) {\n this.logger.success(`Plugin ${chalk.bold(this.argv.pluginRef)}:`)\n this.logger.json(plugin)\n return\n }\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not get plugin ${this.argv.pluginRef}`)\n }\n\n throw new errors.BotpressCLIError(`Plugin ${this.argv.pluginRef} not found`)\n }\n}\n\nexport type ListPluginsCommandDefinition = typeof commandDefinitions.plugins.subcommands.list\nexport class ListPluginsCommand extends GlobalCommand<ListPluginsCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n\n const { name, versionNumber: version } = this.argv\n\n const privateLister = (req: { nextToken?: string }) =>\n api.client.listPlugins({ nextToken: req.nextToken, name, version })\n const publicLister = (req: { nextToken?: string }) =>\n api.client.listPublicPlugins({ nextToken: req.nextToken, name, version })\n\n try {\n const [privatePlugins, publicPlugins] = await Promise.all([\n api.listAllPages(privateLister, (r) => r.plugins),\n api.listAllPages(publicLister, (r) => r.plugins),\n ])\n const plugins = _.uniqBy([...privatePlugins, ...publicPlugins], (p) => p.id)\n\n this.logger.success('Plugins:')\n this.logger.json(plugins)\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not list plugins')\n }\n }\n}\n\nexport type DeletePluginCommandDefinition = typeof commandDefinitions.plugins.subcommands.delete\nexport class DeletePluginCommand extends GlobalCommand<DeletePluginCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n const parsedRef = parsePackageRef(this.argv.pluginRef)\n if (!parsedRef) {\n throw new errors.InvalidPackageReferenceError(this.argv.pluginRef)\n }\n if (parsedRef.type === 'path') {\n throw new errors.BotpressCLIError('Cannot delete local plugin')\n }\n\n let plugin: client.Plugin | undefined\n try {\n plugin = await api.findPublicOrPrivatePlugin(parsedRef)\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not get plugin ${this.argv.pluginRef}`)\n }\n\n if (!plugin) {\n throw new errors.BotpressCLIError(`Plugin ${this.argv.pluginRef} not found`)\n }\n\n try {\n await api.client.deletePlugin({ id: plugin.id })\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not delete plugin ${this.argv.pluginRef}`)\n }\n\n this.logger.success(`Plugin ${chalk.bold(this.argv.pluginRef)} deleted`)\n return\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,oBAAc;AAEd,aAAwB;AACxB,yBAAgC;AAChC,4BAA8B;AAGvB,MAAM,yBAAyB,oCAA0C;AAAA,EAC9E,MAA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"@botpress/cli",
|
|
3
|
-
"version": "4.25.
|
|
3
|
+
"version": "4.25.2",
|
|
4
4
|
"description": "Botpress CLI",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "pnpm run build:types && pnpm run bundle && pnpm run template:gen",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@apidevtools/json-schema-ref-parser": "^11.7.0",
|
|
28
28
|
"@botpress/chat": "0.5.4",
|
|
29
29
|
"@botpress/client": "1.27.1",
|
|
30
|
-
"@botpress/sdk": "4.
|
|
30
|
+
"@botpress/sdk": "4.20.0",
|
|
31
31
|
"@bpinternal/const": "^0.1.0",
|
|
32
32
|
"@bpinternal/tunnel": "^0.1.1",
|
|
33
33
|
"@bpinternal/verel": "^0.2.0",
|