@botpress/cli 4.25.3 → 4.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,36 +1,46 @@
1
1
 
2
- > @botpress/cli@4.25.3 build /home/runner/work/botpress/botpress/packages/cli
2
+ > @botpress/cli@4.27.0 build /home/runner/work/botpress/botpress/packages/cli
3
3
  > pnpm run build:types && pnpm run bundle && pnpm run template:gen
4
4
 
5
5
 
6
- > @botpress/cli@4.25.3 build:types /home/runner/work/botpress/botpress/packages/cli
6
+ > @botpress/cli@4.27.0 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.3 bundle /home/runner/work/botpress/botpress/packages/cli
10
+ > @botpress/cli@4.27.0 bundle /home/runner/work/botpress/botpress/packages/cli
11
11
  > ts-node -T build.ts
12
12
 
13
13
 
14
- > @botpress/cli@4.25.3 template:gen /home/runner/work/botpress/botpress/packages/cli
14
+ > @botpress/cli@4.27.0 template:gen /home/runner/work/botpress/botpress/packages/cli
15
15
  > pnpm -r --stream -F @bp-templates/* exec bp gen
16
16
 
17
- 🤖 Botpress CLI v4.25.3
18
- 🤖 Botpress CLI v4.25.3
19
- 🤖 Botpress CLI v4.25.3
20
- 🤖 Botpress CLI v4.25.3
17
+ 🤖 Botpress CLI v4.27.0
18
+ Checking if cli is up to date
19
+ 🤖 Botpress CLI v4.27.0
20
+ Checking if cli is up to date
21
+ 🤖 Botpress CLI v4.27.0
22
+ ● Checking if cli is up to date
23
+ 🤖 Botpress CLI v4.27.0
24
+ ● Checking if cli is up to date
25
+ ● Checking if sdk is up to date
26
+ ● Checking if sdk is up to date
27
+ ● Checking if sdk is up to date
28
+ ● Checking if sdk is up to date
21
29
  ○ Generating typings for plugin empty-plugin...
22
30
  ✓ Typings available at .botpress
23
31
 
24
- ○ Generating typings for integration empty-integration...
32
+ ○ Generating typings for bot...
25
33
  ✓ Typings available at .botpress
26
34
 
27
- ○ Generating typings for integration hello-world...
28
- ○ Generating typings for bot...
35
+ ○ Generating typings for integration empty-integration...
29
36
  ✓ Typings available at .botpress
30
37
 
38
+ ○ Generating typings for integration hello-world...
31
39
  ✓ Typings available at .botpress
32
40
 
33
- 🤖 Botpress CLI v4.25.3
41
+ 🤖 Botpress CLI v4.27.0
42
+ ● Checking if cli is up to date
43
+ ● Checking if sdk is up to date
34
44
  ○ Generating typings for integration webhook-message...
35
45
  ✓ Typings available at .botpress
36
46
 
@@ -20,7 +20,7 @@ export type PrivateIntegration = client.Integration & {
20
20
  export type PublicOrPrivateIntegration = client.Integration & {
21
21
  workspaceId?: string;
22
22
  };
23
- export type IntegrationSummary = client.ClientOutputs['listIntegrations']['integrations'][number];
23
+ export type IntegrationSummary = (client.ClientOutputs['listIntegrations'] | client.ClientOutputs['listPublicIntegrations'])['integrations'][number];
24
24
  export type BotSummary = client.ClientOutputs['listBots']['bots'][number];
25
25
  export type PublicInterface = client.Interface & {
26
26
  public: true;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/api/types.ts"],
4
- "sourcesContent": ["import * as client from '@botpress/client'\nimport { Logger } from '../logger'\nimport { SafeOmit, Merge } from '../utils/type-utils'\nimport { ApiClient } from './client'\n\nexport type ApiClientProps = {\n apiUrl: string\n token: string\n workspaceId: string\n botId?: string\n}\n\nexport type ApiClientFactory = {\n newClient: (props: ApiClientProps, logger: Logger) => ApiClient\n}\n\nexport type PublicOrUnlistedIntegration = client.Integration & { visibility: 'public' | 'unlisted' }\nexport type PrivateIntegration = client.Integration & { workspaceId: string }\nexport type PublicOrPrivateIntegration = client.Integration & { workspaceId?: string }\nexport type IntegrationSummary = client.ClientOutputs['listIntegrations']['integrations'][number]\nexport type BotSummary = client.ClientOutputs['listBots']['bots'][number]\nexport type PublicInterface = client.Interface & { public: true }\nexport type PrivateInterface = client.Interface & { workspaceId: string }\nexport type PublicOrPrivateInterface = client.Interface & { workspaceId?: string }\nexport type PublicPlugin = client.Plugin & { public: true }\nexport type PrivatePlugin = client.Plugin & { workspaceId: string }\nexport type PublicOrPrivatePlugin = client.Plugin & { workspaceId?: string }\n\nexport type CreateBotRequestBody = client.ClientInputs['createBot']\nexport type UpdateBotRequestBody = client.ClientInputs['updateBot']\n\nexport type CreateIntegrationRequestBody = client.ClientInputs['createIntegration']\nexport type UpdateIntegrationRequestBody = client.ClientInputs['updateIntegration']\n\nexport type CreateInterfaceRequestBody = client.ClientInputs['createInterface']\nexport type UpdateInterfaceRequestBody = client.ClientInputs['updateInterface']\n\ntype PluginDependency = client.Plugin['dependencies']['integrations'][string]\n\nexport type CreatePluginRequestBody = Merge<\n SafeOmit<client.ClientInputs['createPlugin'], 'code'>,\n {\n dependencies?: {\n integrations?: Record<string, PluginDependency>\n interfaces?: Record<string, PluginDependency>\n }\n }\n>\n\nexport type UpdatePluginRequestBody = Merge<\n client.ClientInputs['updatePlugin'],\n {\n dependencies?: {\n integrations?: Record<string, PluginDependency | null>\n interfaces?: Record<string, PluginDependency | null>\n }\n }\n>\n"],
4
+ "sourcesContent": ["import * as client from '@botpress/client'\nimport { Logger } from '../logger'\nimport { SafeOmit, Merge } from '../utils/type-utils'\nimport { ApiClient } from './client'\n\nexport type ApiClientProps = {\n apiUrl: string\n token: string\n workspaceId: string\n botId?: string\n}\n\nexport type ApiClientFactory = {\n newClient: (props: ApiClientProps, logger: Logger) => ApiClient\n}\n\nexport type PublicOrUnlistedIntegration = client.Integration & { visibility: 'public' | 'unlisted' }\nexport type PrivateIntegration = client.Integration & { workspaceId: string }\nexport type PublicOrPrivateIntegration = client.Integration & { workspaceId?: string }\nexport type IntegrationSummary = (\n | client.ClientOutputs['listIntegrations']\n | client.ClientOutputs['listPublicIntegrations']\n)['integrations'][number]\nexport type BotSummary = client.ClientOutputs['listBots']['bots'][number]\nexport type PublicInterface = client.Interface & { public: true }\nexport type PrivateInterface = client.Interface & { workspaceId: string }\nexport type PublicOrPrivateInterface = client.Interface & { workspaceId?: string }\nexport type PublicPlugin = client.Plugin & { public: true }\nexport type PrivatePlugin = client.Plugin & { workspaceId: string }\nexport type PublicOrPrivatePlugin = client.Plugin & { workspaceId?: string }\n\nexport type CreateBotRequestBody = client.ClientInputs['createBot']\nexport type UpdateBotRequestBody = client.ClientInputs['updateBot']\n\nexport type CreateIntegrationRequestBody = client.ClientInputs['createIntegration']\nexport type UpdateIntegrationRequestBody = client.ClientInputs['updateIntegration']\n\nexport type CreateInterfaceRequestBody = client.ClientInputs['createInterface']\nexport type UpdateInterfaceRequestBody = client.ClientInputs['updateInterface']\n\ntype PluginDependency = client.Plugin['dependencies']['integrations'][string]\n\nexport type CreatePluginRequestBody = Merge<\n SafeOmit<client.ClientInputs['createPlugin'], 'code'>,\n {\n dependencies?: {\n integrations?: Record<string, PluginDependency>\n interfaces?: Record<string, PluginDependency>\n }\n }\n>\n\nexport type UpdatePluginRequestBody = Merge<\n client.ClientInputs['updatePlugin'],\n {\n dependencies?: {\n integrations?: Record<string, PluginDependency | null>\n interfaces?: Record<string, PluginDependency | null>\n }\n }\n>\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -405,6 +405,18 @@ declare const _default: {
405
405
  type: "string";
406
406
  description: string;
407
407
  };
408
+ owned: {
409
+ type: "boolean";
410
+ description: string;
411
+ };
412
+ public: {
413
+ type: "boolean";
414
+ description: string;
415
+ };
416
+ limit: {
417
+ type: "number";
418
+ description: string;
419
+ };
408
420
  dev: {
409
421
  type: "boolean";
410
422
  description: string;
@@ -7,6 +7,7 @@ export declare abstract class BaseCommand<C extends CommandDefinition> {
7
7
  protected abstract run(): Promise<void>;
8
8
  protected bootstrap?(): Promise<void>;
9
9
  protected teardown?(): Promise<void>;
10
+ private get _cmdName();
10
11
  handler(): Promise<{
11
12
  exitCode: number;
12
13
  }>;
@@ -37,6 +37,9 @@ class BaseCommand {
37
37
  this.logger = logger;
38
38
  this.argv = argv;
39
39
  }
40
+ get _cmdName() {
41
+ return this.constructor.name;
42
+ }
40
43
  async handler() {
41
44
  let exitCode = 0;
42
45
  try {
@@ -46,13 +49,9 @@ class BaseCommand {
46
49
  await this.run();
47
50
  } catch (thrown) {
48
51
  const error = errors.BotpressCLIError.map(thrown);
49
- if (error.debug) {
50
- const msg = error.message + " (Run with verbose flag (-v) to see more details)";
51
- this.logger.error(msg);
52
- this.logger.debug(error.debug);
53
- } else {
54
- this.logger.error(error.message);
55
- }
52
+ this.logger.error(error.message);
53
+ const stack = error.stack ?? "No stack trace available";
54
+ this.logger.debug(`[${this._cmdName}] ${stack}`);
56
55
  exitCode = 1;
57
56
  } finally {
58
57
  if (this.teardown) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/command-implementations/base-command.ts"],
4
- "sourcesContent": ["import * as errors from '../errors'\nimport type { Logger } from '../logger'\nimport type { CommandArgv, CommandDefinition } from '../typings'\n\nexport abstract class BaseCommand<C extends CommandDefinition> {\n public constructor(\n protected readonly logger: Logger,\n protected readonly argv: CommandArgv<C>\n ) {}\n\n protected abstract run(): Promise<void>\n protected bootstrap?(): Promise<void>\n protected teardown?(): Promise<void>\n\n public async handler(): Promise<{ exitCode: number }> {\n let exitCode = 0\n try {\n if (this.bootstrap) {\n await this.bootstrap()\n }\n await this.run()\n } catch (thrown) {\n const error = errors.BotpressCLIError.map(thrown)\n\n if (error.debug) {\n const msg = error.message + ' (Run with verbose flag (-v) to see more details)'\n this.logger.error(msg)\n this.logger.debug(error.debug)\n } else {\n this.logger.error(error.message)\n }\n\n exitCode = 1\n } finally {\n if (this.teardown) {\n await this.teardown()\n }\n }\n\n return { exitCode }\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AAIjB,MAAe,YAAyC;AAAA,EACtD,YACc,QACA,MACnB;AAFmB;AACA;AAAA,EAClB;AAAA,EAMH,MAAa,UAAyC;AACpD,QAAI,WAAW;AACf,QAAI;AACF,UAAI,KAAK,WAAW;AAClB,cAAM,KAAK,UAAU;AAAA,MACvB;AACA,YAAM,KAAK,IAAI;AAAA,IACjB,SAAS,QAAQ;AACf,YAAM,QAAQ,OAAO,iBAAiB,IAAI,MAAM;AAEhD,UAAI,MAAM,OAAO;AACf,cAAM,MAAM,MAAM,UAAU;AAC5B,aAAK,OAAO,MAAM,GAAG;AACrB,aAAK,OAAO,MAAM,MAAM,KAAK;AAAA,MAC/B,OAAO;AACL,aAAK,OAAO,MAAM,MAAM,OAAO;AAAA,MACjC;AAEA,iBAAW;AAAA,IACb,UAAE;AACA,UAAI,KAAK,UAAU;AACjB,cAAM,KAAK,SAAS;AAAA,MACtB;AAAA,IACF;AAEA,WAAO,EAAE,SAAS;AAAA,EACpB;AACF;",
4
+ "sourcesContent": ["import * as errors from '../errors'\nimport type { Logger } from '../logger'\nimport type { CommandArgv, CommandDefinition } from '../typings'\n\nexport abstract class BaseCommand<C extends CommandDefinition> {\n public constructor(\n protected readonly logger: Logger,\n protected readonly argv: CommandArgv<C>\n ) {}\n\n protected abstract run(): Promise<void>\n protected bootstrap?(): Promise<void>\n protected teardown?(): Promise<void>\n\n private get _cmdName(): string {\n return this.constructor.name\n }\n\n public async handler(): Promise<{ exitCode: number }> {\n let exitCode = 0\n try {\n if (this.bootstrap) {\n await this.bootstrap()\n }\n await this.run()\n } catch (thrown) {\n const error = errors.BotpressCLIError.map(thrown)\n\n this.logger.error(error.message)\n\n const stack = error.stack ?? 'No stack trace available'\n this.logger.debug(`[${this._cmdName}] ${stack}`)\n\n exitCode = 1\n } finally {\n if (this.teardown) {\n await this.teardown()\n }\n }\n\n return { exitCode }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AAIjB,MAAe,YAAyC;AAAA,EACtD,YACc,QACA,MACnB;AAFmB;AACA;AAAA,EAClB;AAAA,EAMH,IAAY,WAAmB;AAC7B,WAAO,KAAK,YAAY;AAAA,EAC1B;AAAA,EAEA,MAAa,UAAyC;AACpD,QAAI,WAAW;AACf,QAAI;AACF,UAAI,KAAK,WAAW;AAClB,cAAM,KAAK,UAAU;AAAA,MACvB;AACA,YAAM,KAAK,IAAI;AAAA,IACjB,SAAS,QAAQ;AACf,YAAM,QAAQ,OAAO,iBAAiB,IAAI,MAAM;AAEhD,WAAK,OAAO,MAAM,MAAM,OAAO;AAE/B,YAAM,QAAQ,MAAM,SAAS;AAC7B,WAAK,OAAO,MAAM,IAAI,KAAK,QAAQ,KAAK,KAAK,EAAE;AAE/C,iBAAW;AAAA,IACb,UAAE;AACA,UAAI,KAAK,UAAU;AACjB,cAAM,KAAK,SAAS;AAAA,MACtB;AAAA,IACF;AAEA,WAAO,EAAE,SAAS;AAAA,EACpB;AACF;",
6
6
  "names": []
7
7
  }
@@ -366,6 +366,18 @@ declare const _default: {
366
366
  type: "string";
367
367
  description: string;
368
368
  };
369
+ owned: {
370
+ type: "boolean";
371
+ description: string;
372
+ };
373
+ public: {
374
+ type: "boolean";
375
+ description: string;
376
+ };
377
+ limit: {
378
+ type: "number";
379
+ description: string;
380
+ };
369
381
  dev: {
370
382
  type: "boolean";
371
383
  description: string;
@@ -7,6 +7,10 @@ export declare class GetIntegrationCommand extends GlobalCommand<GetIntegrationC
7
7
  export type ListIntegrationsCommandDefinition = typeof commandDefinitions.integrations.subcommands.list;
8
8
  export declare class ListIntegrationsCommand extends GlobalCommand<ListIntegrationsCommandDefinition> {
9
9
  run(): Promise<void>;
10
+ private _listAllIntegrations;
11
+ private _listDevIntegrations;
12
+ private _listOwnedIntegrations;
13
+ private _listPublicIntegrations;
10
14
  }
11
15
  export type DeleteIntegrationCommandDefinition = typeof commandDefinitions.integrations.subcommands.delete;
12
16
  export declare class DeleteIntegrationCommand extends GlobalCommand<DeleteIntegrationCommandDefinition> {
@@ -64,22 +64,60 @@ class GetIntegrationCommand extends import_global_command.GlobalCommand {
64
64
  class ListIntegrationsCommand extends import_global_command.GlobalCommand {
65
65
  async run() {
66
66
  const api = await this.ensureLoginAndCreateClient(this.argv);
67
- const { dev, name, versionNumber: version } = this.argv;
68
- const privateLister = (req) => api.client.listIntegrations({ nextToken: req.nextToken, dev, name, version });
69
- const dummyLister = async () => ({ integrations: [], meta: {} });
70
- const publicLister = dev ? dummyLister : (req) => api.client.listPublicIntegrations({ nextToken: req.nextToken, name, version });
67
+ const { dev, public: isPublic, owned } = this.argv;
68
+ if (dev && isPublic) {
69
+ throw new errors.BotpressCLIError(
70
+ "Cannot use --dev and --public flags together as dev integrations are always private"
71
+ );
72
+ }
73
+ if (dev && owned) {
74
+ throw new errors.BotpressCLIError(
75
+ "Cannot use --dev and --owned flags together as dev integrations are always owned by the current workspace"
76
+ );
77
+ }
71
78
  try {
72
- const [privateIntegrations, publicIntegrations] = await Promise.all([
73
- api.listAllPages(privateLister, (r) => r.integrations),
74
- api.listAllPages(publicLister, (r) => r.integrations)
75
- ]);
76
- const integrations = import_lodash.default.uniqBy([...privateIntegrations, ...publicIntegrations], (i) => i.id);
79
+ const integrations = await this._listAllIntegrations(api);
77
80
  this.logger.success("Integrations:");
78
81
  this.logger.json(integrations);
79
82
  } catch (thrown) {
80
83
  throw errors.BotpressCLIError.wrap(thrown, "Could not list integrations");
81
84
  }
82
85
  }
86
+ _listAllIntegrations = async (api) => {
87
+ if (this.argv.dev) {
88
+ return this._listDevIntegrations(api);
89
+ }
90
+ if (this.argv.public && this.argv.owned) {
91
+ const [owned2, publicIntegrations2] = await Promise.all([
92
+ this._listOwnedIntegrations(api),
93
+ this._listPublicIntegrations(api)
94
+ ]);
95
+ return import_lodash.default.intersectionBy(owned2, publicIntegrations2, (i) => i.id).slice(0, this.argv.limit);
96
+ }
97
+ if (this.argv.owned) {
98
+ return this._listOwnedIntegrations(api);
99
+ }
100
+ if (this.argv.public) {
101
+ return this._listPublicIntegrations(api);
102
+ }
103
+ const [owned, publicIntegrations] = await Promise.all([
104
+ this._listOwnedIntegrations(api),
105
+ this._listPublicIntegrations(api)
106
+ ]);
107
+ return import_lodash.default.uniqBy([...owned, ...publicIntegrations], (i) => i.id).slice(0, this.argv.limit);
108
+ };
109
+ _listDevIntegrations = async (api) => {
110
+ const { name, versionNumber: version } = this.argv;
111
+ return api.client.list.integrations({ dev: true, name, version }).collect({ limit: this.argv.limit });
112
+ };
113
+ _listOwnedIntegrations = async (api) => {
114
+ const { name, versionNumber: version } = this.argv;
115
+ return api.client.list.integrations({ name, version }).collect({ limit: this.argv.limit });
116
+ };
117
+ _listPublicIntegrations = async (api) => {
118
+ const { name, versionNumber: version } = this.argv;
119
+ return api.client.list.publicIntegrations({ name, version }).collect({ limit: this.argv.limit });
120
+ };
83
121
  }
84
122
  class DeleteIntegrationCommand extends import_global_command.GlobalCommand {
85
123
  async run() {
@@ -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, 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,cAAc,CAAC,GAAG;AAC1E,aAAK,OAAO,KAAK,WAAW;AAC5B;AAAA,MACF;AAAA,IACF,SAAS,QAAQ;AACf,YAAM,OAAO,iBAAiB,KAAK,QAAQ,6B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B,KAAK,KAAK,cAAc;AAAA,IACxE;AACA,QAAI,UAAU,SAAS,QAAQ;AAC7B,YAAM,IAAI,OAAO,iBAAiB,iCAAiC;AAAA,IACrE;AAEA,QAAI;AACJ,QAAI,UAAU,SAAS,MAAM;AAC3B,sBAAgB,UAAU;AAAA,IAC5B,OAAO;AACL,YAAM,cAAc,MAAM,KAAK,iBAAiB,KAAK,SAAS;AAC9D,sBAAgB,YAAY;AAAA,IAC9B;AAEA,QAAI;AACF,YAAM,IAAI,OAAO,kBAAkB,EAAE,IAAI,cAAc,CAAC;AAAA,IAC1D,SAAS,QAAQ;AACf,YAAM,OAAO,iBAAiB,KAAK,QAAQ,gCAAgC,KAAK,KAAK,cAAc,EAAE;AAAA,IACvG;AAEA,SAAK,OAAO,QAAQ,eAAe,aAAAD,QAAM,KAAK,KAAK,KAAK,cAAc,CAAC,UAAU;AACjF;AAAA,EACF;AAAA,EAEQ,mBAAmB,OAAO,KAAgB,cAA8B;AAC9E,QAAI;AAEJ,QAAI;AACF,oBAAc,MAAM,IAAI,uBAAuB,SAAS;AAAA,IAC1D,SAAS,QAAQ;AACf,YAAM,OAAO,iBAAiB,KAAK,QAAQ,6BAA6B,KAAK,KAAK,cAAc,EAAE;AAAA,IACpG;AAEA,QAAI,CAAC,aAAa;AAChB,YAAM,oBAAoB,MAAM,IAAI,sBAAsB,SAAS;AACnE,UAAI,mBAAmB;AACrB,cAAM,IAAI,OAAO,iBAAiB,eAAe,KAAK,KAAK,cAAc,oCAAoC;AAAA,MAC/G;AAEA,YAAM,IAAI,OAAO,iBAAiB,eAAe,KAAK,KAAK,cAAc,YAAY;AAAA,IACvF;AAEA,WAAO;AAAA,EACT;AACF;",
6
- "names": ["chalk", "_"]
4
+ "sourcesContent": ["import chalk from 'chalk'\nimport _ from 'lodash'\nimport { ApiClient, PublicOrPrivateIntegration, IntegrationSummary } 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, public: isPublic, owned } = this.argv\n\n if (dev && isPublic) {\n throw new errors.BotpressCLIError(\n 'Cannot use --dev and --public flags together as dev integrations are always private'\n )\n }\n if (dev && owned) {\n throw new errors.BotpressCLIError(\n 'Cannot use --dev and --owned flags together as dev integrations are always owned by the current workspace'\n )\n }\n\n try {\n const integrations = await this._listAllIntegrations(api)\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 private _listAllIntegrations = async (api: ApiClient): Promise<IntegrationSummary[]> => {\n if (this.argv.dev) {\n return this._listDevIntegrations(api)\n }\n\n if (this.argv.public && this.argv.owned) {\n const [owned, publicIntegrations] = await Promise.all([\n this._listOwnedIntegrations(api),\n this._listPublicIntegrations(api),\n ])\n return _.intersectionBy(owned, publicIntegrations, (i) => i.id).slice(0, this.argv.limit)\n }\n\n if (this.argv.owned) {\n return this._listOwnedIntegrations(api)\n }\n\n if (this.argv.public) {\n return this._listPublicIntegrations(api)\n }\n\n const [owned, publicIntegrations] = await Promise.all([\n this._listOwnedIntegrations(api),\n this._listPublicIntegrations(api),\n ])\n return _.uniqBy([...owned, ...publicIntegrations], (i) => i.id).slice(0, this.argv.limit)\n }\n\n private _listDevIntegrations = async (api: ApiClient): Promise<IntegrationSummary[]> => {\n const { name, versionNumber: version } = this.argv\n return api.client.list.integrations({ dev: true, name, version }).collect({ limit: this.argv.limit })\n }\n\n private _listOwnedIntegrations = async (api: ApiClient): Promise<IntegrationSummary[]> => {\n const { name, versionNumber: version } = this.argv\n return api.client.list.integrations({ name, version }).collect({ limit: this.argv.limit })\n }\n\n private _listPublicIntegrations = async (api: ApiClient): Promise<IntegrationSummary[]> => {\n const { name, versionNumber: version } = this.argv\n return api.client.list.publicIntegrations({ name, version }).collect({ limit: this.argv.limit })\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,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,E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,cAAc,MAAM,KAAK,iBAAiB,KAAK,SAAS;AAC9D,sBAAgB,YAAY;AAAA,IAC9B;AAEA,QAAI;AACF,YAAM,IAAI,OAAO,kBAAkB,EAAE,IAAI,cAAc,CAAC;AAAA,IAC1D,SAAS,QAAQ;AACf,YAAM,OAAO,iBAAiB,KAAK,QAAQ,gCAAgC,KAAK,KAAK,cAAc,EAAE;AAAA,IACvG;AAEA,SAAK,OAAO,QAAQ,eAAe,aAAAH,QAAM,KAAK,KAAK,KAAK,cAAc,CAAC,UAAU;AACjF;AAAA,EACF;AAAA,EAEQ,mBAAmB,OAAO,KAAgB,cAA8B;AAC9E,QAAI;AAEJ,QAAI;AACF,oBAAc,MAAM,IAAI,uBAAuB,SAAS;AAAA,IAC1D,SAAS,QAAQ;AACf,YAAM,OAAO,iBAAiB,KAAK,QAAQ,6BAA6B,KAAK,KAAK,cAAc,EAAE;AAAA,IACpG;AAEA,QAAI,CAAC,aAAa;AAChB,YAAM,oBAAoB,MAAM,IAAI,sBAAsB,SAAS;AACnE,UAAI,mBAAmB;AACrB,cAAM,IAAI,OAAO,iBAAiB,eAAe,KAAK,KAAK,cAAc,oCAAoC;AAAA,MAC/G;AAEA,YAAM,IAAI,OAAO,iBAAiB,eAAe,KAAK,KAAK,cAAc,YAAY;AAAA,IACvF;AAEA,WAAO;AAAA,EACT;AACF;",
6
+ "names": ["chalk", "owned", "publicIntegrations", "_"]
7
7
  }
package/dist/config.d.ts CHANGED
@@ -404,6 +404,18 @@ export declare const schemas: {
404
404
  type: "string";
405
405
  description: string;
406
406
  };
407
+ owned: {
408
+ type: "boolean";
409
+ description: string;
410
+ };
411
+ public: {
412
+ type: "boolean";
413
+ description: string;
414
+ };
415
+ limit: {
416
+ type: "number";
417
+ description: string;
418
+ };
407
419
  dev: {
408
420
  type: "boolean";
409
421
  description: string;
package/dist/config.js CHANGED
@@ -281,6 +281,9 @@ const listIntegrationsSchema = {
281
281
  ...credentialsSchema,
282
282
  name: { type: "string", description: "The name filter when listing integrations" },
283
283
  versionNumber: { type: "string", description: "The version filter when listing integrations" },
284
+ owned: { type: "boolean", description: "List only owned integrations" },
285
+ public: { type: "boolean", description: "List only public integrations" },
286
+ limit: { type: "number", description: "Limit the number of integrations returned" },
284
287
  dev
285
288
  };
286
289
  const deleteIntegrationSchema = {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/config.ts"],
4
- "sourcesContent": ["import * as consts from './consts'\nimport { ProjectTemplates } from './project-templates'\nimport type { CommandOption, CommandSchema } from './typings'\n\n// command options\n\nconst port = {\n type: 'number',\n description: 'The port to use',\n} satisfies CommandOption\n\nconst workDir = {\n type: 'string',\n description: 'The path to the project',\n default: consts.defaultWorkDir,\n} satisfies CommandOption\n\nconst noBuild = {\n type: 'boolean',\n description: 'Skip the build step',\n default: false,\n} satisfies CommandOption\n\nconst dryRun = {\n type: 'boolean',\n description: 'Ask the API not to perform the actual operation',\n default: false,\n} as const satisfies CommandOption\n\nconst apiUrl = {\n type: 'string',\n description: 'The URL of the Botpress server',\n} satisfies CommandOption\n\nconst token = {\n type: 'string',\n description: 'You Personal Access Token ',\n} satisfies CommandOption\n\nconst workspaceId = {\n type: 'string',\n description: 'The Workspace Id to deploy to',\n} satisfies CommandOption\n\nconst secrets = {\n type: 'string',\n description: 'Values for the integration secrets',\n array: true,\n default: [],\n} satisfies CommandOption\n\nconst botRef = {\n type: 'string',\n description: 'The bot ID. Bot Name is not supported.',\n demandOption: true,\n positional: true,\n idx: 0,\n} satisfies CommandOption\n\nconst packageType = {\n type: 'string',\n description:\n 'Either an integration or an interface; helps disambiguate the package type in case both an integration and an interface have the same reference.',\n choices: ['integration', 'interface', 'plugin'] as const,\n} satisfies CommandOption\n\nconst packageRef = {\n type: 'string',\n description:\n 'The package ID or name with optional version. The package can be either an integration or an interface. Ex: teams, teams@0.2.0, llm@5.1.0',\n positional: true,\n idx: 0,\n} satisfies CommandOption\n\nconst integrationRef = {\n ...packageRef,\n demandOption: true,\n description: 'The integration ID or name with optional version. Ex: teams or teams@0.2.0',\n} satisfies CommandOption\n\nconst interfaceRef = {\n ...packageRef,\n demandOption: true,\n description: 'The interface ID or name and version. Ex: llm@5.1.0',\n} satisfies CommandOption\n\nconst pluginRef = {\n ...packageRef,\n demandOption: true,\n description: 'The plugin ID or name and version. Ex: knowledge@0.0.1',\n} satisfies CommandOption\n\nconst sourceMap = { type: 'boolean', description: 'Generate sourcemaps', default: false } satisfies CommandOption\n\nconst minify = { type: 'boolean', description: 'Minify the bundled code', default: true } satisfies CommandOption\n\nconst dev = {\n type: 'boolean',\n description: 'List only dev bots / dev integrations',\n default: false,\n} satisfies CommandOption\n\n// base schemas\n\nconst globalSchema = {\n verbose: {\n type: 'boolean',\n description: 'Enable verbose logging',\n alias: 'v',\n default: false,\n },\n confirm: {\n type: 'boolean',\n description: 'Confirm all prompts',\n alias: 'y',\n default: false,\n },\n json: {\n type: 'boolean',\n description: 'Prevent logging anything else than raw json in stdout. Useful for piping output to other tools',\n default: false,\n },\n botpressHome: {\n type: 'string',\n description: 'The path to the Botpress home directory',\n default: consts.defaultBotpressHome,\n },\n profile: {\n type: 'string',\n description: 'The CLI profile defined in the $BP_BOTPRESS_HOME/profiles.json',\n alias: 'p',\n },\n} satisfies CommandSchema\n\nconst projectSchema = {\n ...globalSchema,\n workDir,\n} satisfies CommandSchema\n\nconst credentialsSchema = {\n apiUrl,\n workspaceId,\n token,\n} satisfies CommandSchema\n\nconst secretsSchema = {\n secrets,\n} satisfies CommandSchema\n\n// command schemas\n\nconst generateSchema = {\n ...projectSchema,\n} satisfies CommandSchema\n\nconst bundleSchema = {\n ...projectSchema,\n sourceMap,\n minify,\n} satisfies CommandSchema\n\nconst buildSchema = {\n ...projectSchema,\n sourceMap,\n minify,\n} satisfies CommandSchema\n\nconst readSchema = {\n ...projectSchema,\n} satisfies CommandSchema\n\nconst serveSchema = {\n ...projectSchema,\n ...secretsSchema,\n port,\n} satisfies CommandSchema\n\nconst deploySchema = {\n ...projectSchema,\n ...credentialsSchema,\n ...secretsSchema,\n botId: { type: 'string', description: 'The bot ID to deploy. Only used when deploying a bot' },\n noBuild,\n dryRun,\n createNewBot: { type: 'boolean', description: 'Create a new bot when deploying. Only used when deploying a bot' },\n sourceMap,\n minify,\n visibility: {\n type: 'string',\n choices: ['public', 'private', 'unlisted'] as const,\n description:\n 'The visibility of the project. By default, projects are always private. Unlisted visibility is only supported for integrations and plugins.',\n default: 'private',\n },\n public: {\n type: 'boolean',\n description: 'DEPRECATED: Please use \"--visibility public\" instead.',\n default: false,\n deprecated: true,\n } satisfies CommandOption,\n allowDeprecated: {\n type: 'boolean',\n description: 'Allow deprecated features in the project',\n default: false,\n },\n} as const satisfies CommandSchema\n\nconst devSchema = {\n ...projectSchema,\n ...credentialsSchema,\n ...secretsSchema,\n sourceMap,\n minify,\n port,\n tunnelUrl: {\n type: 'string',\n description: 'The tunnel HTTP URL to use',\n default: consts.defaultTunnelUrl,\n },\n tunnelId: {\n type: 'string',\n description: 'The tunnel ID to use. The ID will be generated if not specified',\n },\n} satisfies CommandSchema\n\nconst addSchema = {\n ...globalSchema,\n ...credentialsSchema,\n packageRef,\n packageType,\n installPath: {\n type: 'string',\n description: 'The path where to install the package',\n default: consts.defaultInstallPath,\n },\n useDev: {\n type: 'boolean',\n description: 'If a dev version of the package is found, use it',\n default: false,\n },\n alias: {\n type: 'string',\n description: 'The alias of the dependency you want to install',\n },\n} satisfies CommandSchema\n\nconst loginSchema = {\n ...globalSchema,\n token,\n workspaceId,\n apiUrl: { ...apiUrl, default: consts.defaultBotpressApiUrl },\n} satisfies CommandSchema\n\nconst logoutSchema = {\n ...globalSchema,\n} satisfies CommandSchema\n\nconst createBotSchema = {\n ...globalSchema,\n ...credentialsSchema,\n name: { type: 'string', description: 'The name of the bot to create' },\n ifNotExists: {\n type: 'boolean',\n description: 'Do not create if a bot with the same name already exists',\n default: false,\n },\n} satisfies CommandSchema\n\nconst getBotSchema = {\n ...globalSchema,\n ...credentialsSchema,\n botRef,\n} satisfies CommandSchema\n\nconst deleteBotSchema = {\n ...globalSchema,\n ...credentialsSchema,\n botRef,\n} satisfies CommandSchema\n\nconst listBotsSchema = {\n ...globalSchema,\n ...credentialsSchema,\n dev,\n} satisfies CommandSchema\n\nconst getIntegrationSchema = {\n ...globalSchema,\n ...credentialsSchema,\n integrationRef,\n} satisfies CommandSchema\n\nconst listIntegrationsSchema = {\n ...globalSchema,\n ...credentialsSchema,\n name: { type: 'string', description: 'The name filter when listing integrations' },\n versionNumber: { type: 'string', description: 'The version filter when listing integrations' },\n dev,\n} satisfies CommandSchema\n\nconst deleteIntegrationSchema = {\n ...globalSchema,\n ...credentialsSchema,\n integrationRef,\n} satisfies CommandSchema\n\nconst getInterfaceSchema = {\n ...globalSchema,\n ...credentialsSchema,\n interfaceRef,\n} satisfies CommandSchema\n\nconst listInterfacesSchema = {\n ...globalSchema,\n ...credentialsSchema,\n} satisfies CommandSchema\n\nconst deleteInterfaceSchema = {\n ...globalSchema,\n ...credentialsSchema,\n interfaceRef,\n} satisfies CommandSchema\n\nconst getPluginSchema = {\n ...globalSchema,\n ...credentialsSchema,\n pluginRef,\n} satisfies CommandSchema\n\nconst listPluginsSchema = {\n ...globalSchema,\n ...credentialsSchema,\n name: { type: 'string', description: 'The name filter when listing plugins' },\n versionNumber: { type: 'string', description: 'The version filter when listing plugins' },\n} satisfies CommandSchema\n\nconst deletePluginSchema = {\n ...globalSchema,\n ...credentialsSchema,\n pluginRef,\n} satisfies CommandSchema\n\nconst initSchema = {\n ...globalSchema,\n workDir,\n type: { type: 'string', choices: ['bot', 'integration', 'plugin'] as const },\n template: {\n type: 'string',\n choices: ProjectTemplates.getAllChoices(),\n description: 'The template to use',\n },\n name: { type: 'string', description: 'The name of the project' },\n} satisfies CommandSchema\n\nconst lintSchema = {\n ...projectSchema,\n} satisfies CommandSchema\n\nconst chatSchema = {\n ...globalSchema,\n ...credentialsSchema,\n chatApiUrl: {\n type: 'string',\n description: 'The URL of the chat server',\n },\n botId: {\n type: 'string',\n positional: true,\n idx: 0,\n description: 'The bot ID to chat with',\n },\n} satisfies CommandSchema\n\nconst listProfilesSchema = {\n ...globalSchema,\n} satisfies CommandSchema\n\nconst activeProfileSchema = {\n ...globalSchema,\n} satisfies CommandSchema\n\nconst useProfileSchema = {\n ...globalSchema,\n profileToUse: {\n type: 'string',\n description: 'The CLI profile defined in the $BP_BOTPRESS_HOME/profiles.json',\n positional: true,\n idx: 0,\n },\n} satisfies CommandSchema\n\n// exports\n\nexport const schemas = {\n global: globalSchema,\n project: projectSchema,\n credentials: credentialsSchema,\n secrets: secretsSchema,\n login: loginSchema,\n logout: logoutSchema,\n createBot: createBotSchema,\n getBot: getBotSchema,\n deleteBot: deleteBotSchema,\n listBots: listBotsSchema,\n getIntegration: getIntegrationSchema,\n listIntegrations: listIntegrationsSchema,\n deleteIntegration: deleteIntegrationSchema,\n getInterface: getInterfaceSchema,\n listInterfaces: listInterfacesSchema,\n deleteInterface: deleteInterfaceSchema,\n getPlugin: getPluginSchema,\n listPlugins: listPluginsSchema,\n deletePlugin: deletePluginSchema,\n init: initSchema,\n generate: generateSchema,\n bundle: bundleSchema,\n build: buildSchema,\n read: readSchema,\n serve: serveSchema,\n deploy: deploySchema,\n add: addSchema,\n dev: devSchema,\n lint: lintSchema,\n chat: chatSchema,\n listProfiles: listProfilesSchema,\n activeProfile: activeProfileSchema,\n useProfile: useProfileSchema,\n} as const\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,+BAAiC;AAKjC,MAAM,OAAO;AAAA,EACX,MAAM;AAAA,EACN,aAAa;AACf;AAEA,MAAM,UAAU;AAAA,EACd,MAAM;AAAA,EACN,aAAa;AAAA,EACb,SAAS,OAAO;AAClB;AAEA,MAAM,UAAU;AAAA,EACd,MAAM;AAAA,EACN,aAAa;AAAA,EACb,SAAS;AACX;AAEA,MAAM,SAAS;A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F;AAEA,MAAM,qBAAqB;AAAA,EACzB,GAAG;AACL;AAEA,MAAM,sBAAsB;AAAA,EAC1B,GAAG;AACL;AAEA,MAAM,mBAAmB;AAAA,EACvB,GAAG;AAAA,EACH,cAAc;AAAA,IACZ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,KAAK;AAAA,EACP;AACF;AAIO,MAAM,UAAU;AAAA,EACrB,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,aAAa;AAAA,EACb,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,aAAa;AAAA,EACb,cAAc;AAAA,EACd,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,KAAK;AAAA,EACL,MAAM;AAAA,EACN,MAAM;AAAA,EACN,cAAc;AAAA,EACd,eAAe;AAAA,EACf,YAAY;AACd;",
4
+ "sourcesContent": ["import * as consts from './consts'\nimport { ProjectTemplates } from './project-templates'\nimport type { CommandOption, CommandSchema } from './typings'\n\n// command options\n\nconst port = {\n type: 'number',\n description: 'The port to use',\n} satisfies CommandOption\n\nconst workDir = {\n type: 'string',\n description: 'The path to the project',\n default: consts.defaultWorkDir,\n} satisfies CommandOption\n\nconst noBuild = {\n type: 'boolean',\n description: 'Skip the build step',\n default: false,\n} satisfies CommandOption\n\nconst dryRun = {\n type: 'boolean',\n description: 'Ask the API not to perform the actual operation',\n default: false,\n} as const satisfies CommandOption\n\nconst apiUrl = {\n type: 'string',\n description: 'The URL of the Botpress server',\n} satisfies CommandOption\n\nconst token = {\n type: 'string',\n description: 'You Personal Access Token ',\n} satisfies CommandOption\n\nconst workspaceId = {\n type: 'string',\n description: 'The Workspace Id to deploy to',\n} satisfies CommandOption\n\nconst secrets = {\n type: 'string',\n description: 'Values for the integration secrets',\n array: true,\n default: [],\n} satisfies CommandOption\n\nconst botRef = {\n type: 'string',\n description: 'The bot ID. Bot Name is not supported.',\n demandOption: true,\n positional: true,\n idx: 0,\n} satisfies CommandOption\n\nconst packageType = {\n type: 'string',\n description:\n 'Either an integration or an interface; helps disambiguate the package type in case both an integration and an interface have the same reference.',\n choices: ['integration', 'interface', 'plugin'] as const,\n} satisfies CommandOption\n\nconst packageRef = {\n type: 'string',\n description:\n 'The package ID or name with optional version. The package can be either an integration or an interface. Ex: teams, teams@0.2.0, llm@5.1.0',\n positional: true,\n idx: 0,\n} satisfies CommandOption\n\nconst integrationRef = {\n ...packageRef,\n demandOption: true,\n description: 'The integration ID or name with optional version. Ex: teams or teams@0.2.0',\n} satisfies CommandOption\n\nconst interfaceRef = {\n ...packageRef,\n demandOption: true,\n description: 'The interface ID or name and version. Ex: llm@5.1.0',\n} satisfies CommandOption\n\nconst pluginRef = {\n ...packageRef,\n demandOption: true,\n description: 'The plugin ID or name and version. Ex: knowledge@0.0.1',\n} satisfies CommandOption\n\nconst sourceMap = { type: 'boolean', description: 'Generate sourcemaps', default: false } satisfies CommandOption\n\nconst minify = { type: 'boolean', description: 'Minify the bundled code', default: true } satisfies CommandOption\n\nconst dev = {\n type: 'boolean',\n description: 'List only dev bots / dev integrations',\n default: false,\n} satisfies CommandOption\n\n// base schemas\n\nconst globalSchema = {\n verbose: {\n type: 'boolean',\n description: 'Enable verbose logging',\n alias: 'v',\n default: false,\n },\n confirm: {\n type: 'boolean',\n description: 'Confirm all prompts',\n alias: 'y',\n default: false,\n },\n json: {\n type: 'boolean',\n description: 'Prevent logging anything else than raw json in stdout. Useful for piping output to other tools',\n default: false,\n },\n botpressHome: {\n type: 'string',\n description: 'The path to the Botpress home directory',\n default: consts.defaultBotpressHome,\n },\n profile: {\n type: 'string',\n description: 'The CLI profile defined in the $BP_BOTPRESS_HOME/profiles.json',\n alias: 'p',\n },\n} satisfies CommandSchema\n\nconst projectSchema = {\n ...globalSchema,\n workDir,\n} satisfies CommandSchema\n\nconst credentialsSchema = {\n apiUrl,\n workspaceId,\n token,\n} satisfies CommandSchema\n\nconst secretsSchema = {\n secrets,\n} satisfies CommandSchema\n\n// command schemas\n\nconst generateSchema = {\n ...projectSchema,\n} satisfies CommandSchema\n\nconst bundleSchema = {\n ...projectSchema,\n sourceMap,\n minify,\n} satisfies CommandSchema\n\nconst buildSchema = {\n ...projectSchema,\n sourceMap,\n minify,\n} satisfies CommandSchema\n\nconst readSchema = {\n ...projectSchema,\n} satisfies CommandSchema\n\nconst serveSchema = {\n ...projectSchema,\n ...secretsSchema,\n port,\n} satisfies CommandSchema\n\nconst deploySchema = {\n ...projectSchema,\n ...credentialsSchema,\n ...secretsSchema,\n botId: { type: 'string', description: 'The bot ID to deploy. Only used when deploying a bot' },\n noBuild,\n dryRun,\n createNewBot: { type: 'boolean', description: 'Create a new bot when deploying. Only used when deploying a bot' },\n sourceMap,\n minify,\n visibility: {\n type: 'string',\n choices: ['public', 'private', 'unlisted'] as const,\n description:\n 'The visibility of the project. By default, projects are always private. Unlisted visibility is only supported for integrations and plugins.',\n default: 'private',\n },\n public: {\n type: 'boolean',\n description: 'DEPRECATED: Please use \"--visibility public\" instead.',\n default: false,\n deprecated: true,\n } satisfies CommandOption,\n allowDeprecated: {\n type: 'boolean',\n description: 'Allow deprecated features in the project',\n default: false,\n },\n} as const satisfies CommandSchema\n\nconst devSchema = {\n ...projectSchema,\n ...credentialsSchema,\n ...secretsSchema,\n sourceMap,\n minify,\n port,\n tunnelUrl: {\n type: 'string',\n description: 'The tunnel HTTP URL to use',\n default: consts.defaultTunnelUrl,\n },\n tunnelId: {\n type: 'string',\n description: 'The tunnel ID to use. The ID will be generated if not specified',\n },\n} satisfies CommandSchema\n\nconst addSchema = {\n ...globalSchema,\n ...credentialsSchema,\n packageRef,\n packageType,\n installPath: {\n type: 'string',\n description: 'The path where to install the package',\n default: consts.defaultInstallPath,\n },\n useDev: {\n type: 'boolean',\n description: 'If a dev version of the package is found, use it',\n default: false,\n },\n alias: {\n type: 'string',\n description: 'The alias of the dependency you want to install',\n },\n} satisfies CommandSchema\n\nconst loginSchema = {\n ...globalSchema,\n token,\n workspaceId,\n apiUrl: { ...apiUrl, default: consts.defaultBotpressApiUrl },\n} satisfies CommandSchema\n\nconst logoutSchema = {\n ...globalSchema,\n} satisfies CommandSchema\n\nconst createBotSchema = {\n ...globalSchema,\n ...credentialsSchema,\n name: { type: 'string', description: 'The name of the bot to create' },\n ifNotExists: {\n type: 'boolean',\n description: 'Do not create if a bot with the same name already exists',\n default: false,\n },\n} satisfies CommandSchema\n\nconst getBotSchema = {\n ...globalSchema,\n ...credentialsSchema,\n botRef,\n} satisfies CommandSchema\n\nconst deleteBotSchema = {\n ...globalSchema,\n ...credentialsSchema,\n botRef,\n} satisfies CommandSchema\n\nconst listBotsSchema = {\n ...globalSchema,\n ...credentialsSchema,\n dev,\n} satisfies CommandSchema\n\nconst getIntegrationSchema = {\n ...globalSchema,\n ...credentialsSchema,\n integrationRef,\n} satisfies CommandSchema\n\nconst listIntegrationsSchema = {\n ...globalSchema,\n ...credentialsSchema,\n name: { type: 'string', description: 'The name filter when listing integrations' },\n versionNumber: { type: 'string', description: 'The version filter when listing integrations' },\n owned: { type: 'boolean', description: 'List only owned integrations' },\n public: { type: 'boolean', description: 'List only public integrations' },\n limit: { type: 'number', description: 'Limit the number of integrations returned' },\n dev,\n} satisfies CommandSchema\n\nconst deleteIntegrationSchema = {\n ...globalSchema,\n ...credentialsSchema,\n integrationRef,\n} satisfies CommandSchema\n\nconst getInterfaceSchema = {\n ...globalSchema,\n ...credentialsSchema,\n interfaceRef,\n} satisfies CommandSchema\n\nconst listInterfacesSchema = {\n ...globalSchema,\n ...credentialsSchema,\n} satisfies CommandSchema\n\nconst deleteInterfaceSchema = {\n ...globalSchema,\n ...credentialsSchema,\n interfaceRef,\n} satisfies CommandSchema\n\nconst getPluginSchema = {\n ...globalSchema,\n ...credentialsSchema,\n pluginRef,\n} satisfies CommandSchema\n\nconst listPluginsSchema = {\n ...globalSchema,\n ...credentialsSchema,\n name: { type: 'string', description: 'The name filter when listing plugins' },\n versionNumber: { type: 'string', description: 'The version filter when listing plugins' },\n} satisfies CommandSchema\n\nconst deletePluginSchema = {\n ...globalSchema,\n ...credentialsSchema,\n pluginRef,\n} satisfies CommandSchema\n\nconst initSchema = {\n ...globalSchema,\n workDir,\n type: { type: 'string', choices: ['bot', 'integration', 'plugin'] as const },\n template: {\n type: 'string',\n choices: ProjectTemplates.getAllChoices(),\n description: 'The template to use',\n },\n name: { type: 'string', description: 'The name of the project' },\n} satisfies CommandSchema\n\nconst lintSchema = {\n ...projectSchema,\n} satisfies CommandSchema\n\nconst chatSchema = {\n ...globalSchema,\n ...credentialsSchema,\n chatApiUrl: {\n type: 'string',\n description: 'The URL of the chat server',\n },\n botId: {\n type: 'string',\n positional: true,\n idx: 0,\n description: 'The bot ID to chat with',\n },\n} satisfies CommandSchema\n\nconst listProfilesSchema = {\n ...globalSchema,\n} satisfies CommandSchema\n\nconst activeProfileSchema = {\n ...globalSchema,\n} satisfies CommandSchema\n\nconst useProfileSchema = {\n ...globalSchema,\n profileToUse: {\n type: 'string',\n description: 'The CLI profile defined in the $BP_BOTPRESS_HOME/profiles.json',\n positional: true,\n idx: 0,\n },\n} satisfies CommandSchema\n\n// exports\n\nexport const schemas = {\n global: globalSchema,\n project: projectSchema,\n credentials: credentialsSchema,\n secrets: secretsSchema,\n login: loginSchema,\n logout: logoutSchema,\n createBot: createBotSchema,\n getBot: getBotSchema,\n deleteBot: deleteBotSchema,\n listBots: listBotsSchema,\n getIntegration: getIntegrationSchema,\n listIntegrations: listIntegrationsSchema,\n deleteIntegration: deleteIntegrationSchema,\n getInterface: getInterfaceSchema,\n listInterfaces: listInterfacesSchema,\n deleteInterface: deleteInterfaceSchema,\n getPlugin: getPluginSchema,\n listPlugins: listPluginsSchema,\n deletePlugin: deletePluginSchema,\n init: initSchema,\n generate: generateSchema,\n bundle: bundleSchema,\n build: buildSchema,\n read: readSchema,\n serve: serveSchema,\n deploy: deploySchema,\n add: addSchema,\n dev: devSchema,\n lint: lintSchema,\n chat: chatSchema,\n listProfiles: listProfilesSchema,\n activeProfile: activeProfileSchema,\n useProfile: useProfileSchema,\n} as const\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,+BAAiC;AAKjC,MAAM,OAAO;AAAA,EACX,MAAM;AAAA,EACN,aAAa;AACf;AAEA,MAAM,UAAU;AAAA,EACd,MAAM;AAAA,EACN,aAAa;AAAA,EACb,SAAS,OAAO;AAClB;AAEA,MAAM,UAAU;AAAA,EACd,MAAM;AAAA,EACN,aAAa;AAAA,EACb,SAAS;AACX;AAEA,MAAM,SAAS;AAAA,EACb,MAAM;AAAA,EACN,aAAa;AAAA,EACb,SAAS;AACX;AAEA,MAAM,SAAS;AAAA,EACb,MAAM;AAAA,EACN,aAAa;AACf;AAEA,MAAM,QAAQ;AAAA,EACZ,MAAM;AAAA,EACN,aAAa;AACf;AAEA,MAAM,cAAc;AAAA,EAClB,MAAM;AAAA,EACN,aAAa;AACf;AAEA,MAAM,UAAU;AAAA,EACd,MAAM;AAAA,EACN,aAAa;AAAA,EACb,OAAO;AAAA,EACP,SAAS,CAAC;AACZ;AAEA,MAAM,SAAS;AAAA,EACb,MAAM;AAAA,EACN,aAAa;AAAA,EACb,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,KAAK;AACP;AAEA,MAAM,cAAc;AAAA,EAClB,MAAM;AAAA,EACN,aACE;AAAA,EACF,SAAS,CAAC,eAAe,aAAa,QAAQ;AAChD;AAEA,MAAM,aAAa;AAAA,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;AAAA,EACX,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,aAAa;AAAA,EACb,cAAc;AAAA,EACd,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,KAAK;AAAA,EACL,MAAM;AAAA,EACN,MAAM;AAAA,EACN,cAAc;AAAA,EACd,eAAe;AAAA,EACf,YAAY;AACd;",
6
6
  "names": []
7
7
  }
package/dist/errors.d.ts CHANGED
@@ -5,11 +5,8 @@ type KnownApiError = Exclude<client.ApiError, client.UnknownError>;
5
5
  export declare class BotpressCLIError extends VError {
6
6
  static wrap(thrown: unknown, message: string): BotpressCLIError;
7
7
  static map(thrown: unknown): BotpressCLIError;
8
- private readonly _debug;
9
8
  constructor(error: BotpressCLIError, message: string);
10
9
  constructor(message: string);
11
- set debug(msg: string);
12
- get debug(): string;
13
10
  }
14
11
  export declare class ExclusiveBotFeatureError extends BotpressCLIError {
15
12
  constructor();
package/dist/errors.js CHANGED
@@ -47,7 +47,8 @@ var client = __toESM(require("@botpress/client"));
47
47
  var import_axios = __toESM(require("axios"));
48
48
  var import_verror = require("verror");
49
49
  var consts = __toESM(require("./consts"));
50
- const isKnownApiError = (e) => client.isApiError(e) && !(e instanceof client.UnknownError);
50
+ const isUnknownApiError = (e) => client.isApiError(e) && e.type === "Unknown";
51
+ const isKnownApiError = (e) => client.isApiError(e) && e.type !== "Unknown";
51
52
  class BotpressCLIError extends import_verror.VError {
52
53
  static wrap(thrown, message) {
53
54
  const err = BotpressCLIError.map(thrown);
@@ -57,16 +58,18 @@ class BotpressCLIError extends import_verror.VError {
57
58
  if (thrown instanceof BotpressCLIError) {
58
59
  return thrown;
59
60
  }
60
- if (thrown instanceof client.UnknownError) {
61
- let inst;
61
+ if (isUnknownApiError(thrown)) {
62
62
  const cause = thrown.error?.cause;
63
63
  if (cause && typeof cause === "object" && "code" in cause && cause.code === "ECONNREFUSED") {
64
- inst = new HTTPError(500, "The connection was refused by the server");
65
- } else {
66
- inst = new HTTPError(500, "An unknown error has occurred.");
64
+ return new HTTPError(500, "The connection was refused by the server");
67
65
  }
68
- inst.debug = thrown.message;
69
- return inst;
66
+ const unknownMessage = "An unknown API error occurred";
67
+ const actualTrimmedMessage = thrown.message.trim();
68
+ if (!actualTrimmedMessage) {
69
+ return new HTTPError(500, unknownMessage);
70
+ }
71
+ const inner = new HTTPError(500, actualTrimmedMessage);
72
+ return new BotpressCLIError(inner, unknownMessage);
70
73
  }
71
74
  if (isKnownApiError(thrown)) {
72
75
  return HTTPError.fromApi(thrown);
@@ -78,27 +81,14 @@ class BotpressCLIError extends import_verror.VError {
78
81
  const { message } = thrown;
79
82
  return new BotpressCLIError(message);
80
83
  }
81
- return new BotpressCLIError(`${thrown}`);
84
+ return new BotpressCLIError(String(thrown));
82
85
  }
83
- _debug;
84
86
  constructor(first, second) {
85
87
  if (typeof first === "string") {
86
88
  super(first);
87
- this._debug = [];
88
89
  return;
89
90
  }
90
91
  super(first, second);
91
- this._debug = [...first._debug];
92
- }
93
- set debug(msg) {
94
- this._debug.push(msg);
95
- }
96
- get debug() {
97
- const dbgMsgs = this._debug.filter((s) => s.length);
98
- if (!dbgMsgs.length) {
99
- return "";
100
- }
101
- return "Error: \n" + dbgMsgs.map((s) => ` ${s}`).join("\n");
102
92
  }
103
93
  }
104
94
  class ExclusiveBotFeatureError extends BotpressCLIError {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/errors.ts"],
4
- "sourcesContent": ["import * as client from '@botpress/client'\nimport axios, { AxiosError } from 'axios'\nimport { VError } from 'verror'\nimport * as consts from './consts'\n\ntype KnownApiError = Exclude<client.ApiError, client.UnknownError>\nconst isKnownApiError = (e: unknown): e is KnownApiError => client.isApiError(e) && !(e instanceof client.UnknownError)\n\nexport class BotpressCLIError extends VError {\n public static wrap(thrown: unknown, message: string): BotpressCLIError {\n const err = BotpressCLIError.map(thrown)\n return new BotpressCLIError(err, message ?? '')\n }\n\n public static map(thrown: unknown): BotpressCLIError {\n if (thrown instanceof BotpressCLIError) {\n return thrown\n }\n if (thrown instanceof client.UnknownError) {\n let inst: HTTPError\n const cause = thrown.error?.cause\n if (cause && typeof cause === 'object' && 'code' in cause && (cause as any).code === 'ECONNREFUSED') {\n inst = new HTTPError(500, 'The connection was refused by the server')\n } else {\n inst = new HTTPError(500, 'An unknown error has occurred.')\n }\n inst.debug = thrown.message\n return inst\n }\n if (isKnownApiError(thrown)) {\n return HTTPError.fromApi(thrown)\n }\n if (axios.isAxiosError(thrown)) {\n return HTTPError.fromAxios(thrown)\n }\n if (thrown instanceof Error) {\n const { message } = thrown\n return new BotpressCLIError(message)\n }\n return new BotpressCLIError(`${thrown}`)\n }\n\n private readonly _debug: string[]\n\n public constructor(error: BotpressCLIError, message: string)\n public constructor(message: string)\n public constructor(first: BotpressCLIError | string, second?: string) {\n if (typeof first === 'string') {\n super(first)\n this._debug = []\n return\n }\n super(first, second!)\n this._debug = [...first._debug]\n }\n\n public set debug(msg: string) {\n this._debug.push(msg)\n }\n\n public get debug(): string {\n const dbgMsgs = this._debug.filter((s) => s.length)\n if (!dbgMsgs.length) {\n return ''\n }\n return 'Error: \\n' + dbgMsgs.map((s) => ` ${s}`).join('\\n')\n }\n}\n\nexport class ExclusiveBotFeatureError extends BotpressCLIError {\n public constructor() {\n const message = 'This feature is only available for bots. This project is an integration or interface.'\n super(message)\n }\n}\n\nexport class ExclusiveIntegrationFeatureError extends BotpressCLIError {\n public constructor() {\n const message = 'This feature is only available for integration. This project is a bot or interface.'\n super(message)\n }\n}\n\nexport class HTTPError extends BotpressCLIError {\n public constructor(\n public readonly status: number | undefined,\n message: string\n ) {\n super(message)\n }\n\n public static fromAxios(e: AxiosError<{ message?: string }>): HTTPError {\n const message = this._axiosMsg(e)\n return new HTTPError(e.response?.status, message)\n }\n\n public static fromApi(e: KnownApiError): HTTPError {\n const { message, code } = e\n return new HTTPError(code, message)\n }\n\n private static _axiosMsg(e: AxiosError<{ message?: string }>): string {\n let message = e.message\n if (e.response?.statusText) {\n message += `\\n ${e.response?.statusText}`\n }\n if (e.response?.status && e.request?.method && e.request?.path) {\n message += `\\n (${e.response?.status}) ${e.request.method} ${e.request.path}`\n }\n if (e.response?.data?.message) {\n message += `\\n ${e.response?.data?.message}`\n }\n return message\n }\n}\n\nexport class NoBundleFoundError extends BotpressCLIError {\n public constructor() {\n const message = 'No bundle found. Please run `bp bundle` first.'\n super(message)\n }\n}\n\nexport class NoBotsFoundError extends BotpressCLIError {\n public constructor() {\n const message = `No Bot found in your Workspace. Please create one first at ${consts.defaultBotpressAppUrl}.`\n super(message)\n }\n}\n\nexport class NoWorkspacesFoundError extends BotpressCLIError {\n public constructor() {\n const message = 'No Workspace found. Please create one first.'\n super(message)\n }\n}\n\nexport class NotLoggedInError extends BotpressCLIError {\n public constructor() {\n const message = 'Not logged in. Please run `bp login` first.'\n super(message)\n }\n}\n\nexport class ParamRequiredError extends BotpressCLIError {\n public constructor(param: string) {\n const message = `${param} is required.`\n super(message)\n }\n}\n\nexport class InvalidPackageReferenceError extends BotpressCLIError {\n public constructor(ref: string) {\n const message = `Invalid package reference \"${ref}\".`\n super(message)\n }\n}\n\nexport class UnsupportedProjectType extends BotpressCLIError {\n public constructor() {\n const message = 'Unsupported project type.'\n super(message)\n }\n}\n\nexport class ProjectDefinitionNotFoundError extends BotpressCLIError {\n public constructor(workdir: string) {\n const message = `No project definition found at \"${workdir}\".`\n super(message)\n }\n}\n\nexport class AbortedOperationError extends BotpressCLIError {\n public constructor() {\n super('Aborted')\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA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,MAAM,SAAS;AAC7B,iBAAW;AAAA,IAAO,EAAE,UAAU,MAAM,OAAO;AAAA,IAC7C;AACA,WAAO;AAAA,EACT;AACF;AAEO,MAAM,2BAA2B,iBAAiB;AAAA,EAChD,cAAc;AACnB,UAAM,UAAU;AAChB,UAAM,OAAO;AAAA,EACf;AACF;AAEO,MAAM,yBAAyB,iBAAiB;AAAA,EAC9C,cAAc;AACnB,UAAM,UAAU,8DAA8D,OAAO,qBAAqB;AAC1G,UAAM,OAAO;AAAA,EACf;AACF;AAEO,MAAM,+BAA+B,iBAAiB;AAAA,EACpD,cAAc;AACnB,UAAM,UAAU;AAChB,UAAM,OAAO;AAAA,EACf;AACF;AAEO,MAAM,yBAAyB,iBAAiB;AAAA,EAC9C,cAAc;AACnB,UAAM,UAAU;AAChB,UAAM,OAAO;AAAA,EACf;AACF;AAEO,MAAM,2BAA2B,iBAAiB;AAAA,EAChD,YAAY,OAAe;AAChC,UAAM,UAAU,GAAG,KAAK;AACxB,UAAM,OAAO;AAAA,EACf;AACF;AAEO,MAAM,qCAAqC,iBAAiB;AAAA,EAC1D,YAAY,KAAa;AAC9B,UAAM,UAAU,8BAA8B,GAAG;AACjD,UAAM,OAAO;AAAA,EACf;AACF;AAEO,MAAM,+BAA+B,iBAAiB;AAAA,EACpD,cAAc;AACnB,UAAM,UAAU;AAChB,UAAM,OAAO;AAAA,EACf;AACF;AAEO,MAAM,uCAAuC,iBAAiB;AAAA,EAC5D,YAAY,SAAiB;AAClC,UAAM,UAAU,mCAAmC,OAAO;AAC1D,UAAM,OAAO;AAAA,EACf;AACF;AAEO,MAAM,8BAA8B,iBAAiB;AAAA,EACnD,cAAc;AACnB,UAAM,SAAS;AAAA,EACjB;AACF;",
4
+ "sourcesContent": ["import * as client from '@botpress/client'\nimport axios, { AxiosError } from 'axios'\nimport { VError } from 'verror'\nimport * as consts from './consts'\n\ntype KnownApiError = Exclude<client.ApiError, client.UnknownError>\nconst isUnknownApiError = (e: unknown): e is client.UnknownError => client.isApiError(e) && e.type === 'Unknown'\nconst isKnownApiError = (e: unknown): e is KnownApiError => client.isApiError(e) && e.type !== 'Unknown'\n\nexport class BotpressCLIError extends VError {\n public static wrap(thrown: unknown, message: string): BotpressCLIError {\n const err = BotpressCLIError.map(thrown)\n return new BotpressCLIError(err, message ?? '')\n }\n\n public static map(thrown: unknown): BotpressCLIError {\n if (thrown instanceof BotpressCLIError) {\n return thrown\n }\n if (isUnknownApiError(thrown)) {\n const cause = thrown.error?.cause\n if (cause && typeof cause === 'object' && 'code' in cause && cause.code === 'ECONNREFUSED') {\n return new HTTPError(500, 'The connection was refused by the server')\n }\n\n const unknownMessage = 'An unknown API error occurred'\n const actualTrimmedMessage = thrown.message.trim()\n if (!actualTrimmedMessage) {\n return new HTTPError(500, unknownMessage)\n }\n\n const inner = new HTTPError(500, actualTrimmedMessage)\n return new BotpressCLIError(inner, unknownMessage)\n }\n if (isKnownApiError(thrown)) {\n return HTTPError.fromApi(thrown)\n }\n if (axios.isAxiosError(thrown)) {\n return HTTPError.fromAxios(thrown)\n }\n if (thrown instanceof Error) {\n const { message } = thrown\n return new BotpressCLIError(message)\n }\n return new BotpressCLIError(String(thrown))\n }\n\n public constructor(error: BotpressCLIError, message: string)\n public constructor(message: string)\n public constructor(first: BotpressCLIError | string, second?: string) {\n if (typeof first === 'string') {\n super(first)\n return\n }\n super(first, second!)\n }\n}\n\nexport class ExclusiveBotFeatureError extends BotpressCLIError {\n public constructor() {\n const message = 'This feature is only available for bots. This project is an integration or interface.'\n super(message)\n }\n}\n\nexport class ExclusiveIntegrationFeatureError extends BotpressCLIError {\n public constructor() {\n const message = 'This feature is only available for integration. This project is a bot or interface.'\n super(message)\n }\n}\n\nexport class HTTPError extends BotpressCLIError {\n public constructor(\n public readonly status: number | undefined,\n message: string\n ) {\n super(message)\n }\n\n public static fromAxios(e: AxiosError<{ message?: string }>): HTTPError {\n const message = this._axiosMsg(e)\n return new HTTPError(e.response?.status, message)\n }\n\n public static fromApi(e: KnownApiError): HTTPError {\n const { message, code } = e\n return new HTTPError(code, message)\n }\n\n private static _axiosMsg(e: AxiosError<{ message?: string }>): string {\n let message = e.message\n if (e.response?.statusText) {\n message += `\\n ${e.response?.statusText}`\n }\n if (e.response?.status && e.request?.method && e.request?.path) {\n message += `\\n (${e.response?.status}) ${e.request.method} ${e.request.path}`\n }\n if (e.response?.data?.message) {\n message += `\\n ${e.response?.data?.message}`\n }\n return message\n }\n}\n\nexport class NoBundleFoundError extends BotpressCLIError {\n public constructor() {\n const message = 'No bundle found. Please run `bp bundle` first.'\n super(message)\n }\n}\n\nexport class NoBotsFoundError extends BotpressCLIError {\n public constructor() {\n const message = `No Bot found in your Workspace. Please create one first at ${consts.defaultBotpressAppUrl}.`\n super(message)\n }\n}\n\nexport class NoWorkspacesFoundError extends BotpressCLIError {\n public constructor() {\n const message = 'No Workspace found. Please create one first.'\n super(message)\n }\n}\n\nexport class NotLoggedInError extends BotpressCLIError {\n public constructor() {\n const message = 'Not logged in. Please run `bp login` first.'\n super(message)\n }\n}\n\nexport class ParamRequiredError extends BotpressCLIError {\n public constructor(param: string) {\n const message = `${param} is required.`\n super(message)\n }\n}\n\nexport class InvalidPackageReferenceError extends BotpressCLIError {\n public constructor(ref: string) {\n const message = `Invalid package reference \"${ref}\".`\n super(message)\n }\n}\n\nexport class UnsupportedProjectType extends BotpressCLIError {\n public constructor() {\n const message = 'Unsupported project type.'\n super(message)\n }\n}\n\nexport class ProjectDefinitionNotFoundError extends BotpressCLIError {\n public constructor(workdir: string) {\n const message = `No project definition found at \"${workdir}\".`\n super(message)\n }\n}\n\nexport class AbortedOperationError extends BotpressCLIError {\n public constructor() {\n super('Aborted')\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,mBAAkC;AAClC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,OAAO;AAAA,EACf;AACF;AAEO,MAAM,+BAA+B,iBAAiB;AAAA,EACpD,cAAc;AACnB,UAAM,UAAU;AAChB,UAAM,OAAO;AAAA,EACf;AACF;AAEO,MAAM,yBAAyB,iBAAiB;AAAA,EAC9C,cAAc;AACnB,UAAM,UAAU;AAChB,UAAM,OAAO;AAAA,EACf;AACF;AAEO,MAAM,2BAA2B,iBAAiB;AAAA,EAChD,YAAY,OAAe;AAChC,UAAM,UAAU,GAAG,KAAK;AACxB,UAAM,OAAO;AAAA,EACf;AACF;AAEO,MAAM,qCAAqC,iBAAiB;AAAA,EAC1D,YAAY,KAAa;AAC9B,UAAM,UAAU,8BAA8B,GAAG;AACjD,UAAM,OAAO;AAAA,EACf;AACF;AAEO,MAAM,+BAA+B,iBAAiB;AAAA,EACpD,cAAc;AACnB,UAAM,UAAU;AAChB,UAAM,OAAO;AAAA,EACf;AACF;AAEO,MAAM,uCAAuC,iBAAiB;AAAA,EAC5D,YAAY,SAAiB;AAClC,UAAM,UAAU,mCAAmC,OAAO;AAC1D,UAAM,OAAO;AAAA,EACf;AACF;AAEO,MAAM,8BAA8B,iBAAiB;AAAA,EACnD,cAAc;AACnB,UAAM,SAAS;AAAA,EACjB;AACF;",
6
6
  "names": ["axios"]
7
7
  }
package/dist/index.d.ts CHANGED
@@ -363,6 +363,18 @@ declare const _default: {
363
363
  type: "string";
364
364
  description: string;
365
365
  };
366
+ owned: {
367
+ type: "boolean";
368
+ description: string;
369
+ };
370
+ public: {
371
+ type: "boolean";
372
+ description: string;
373
+ };
374
+ limit: {
375
+ type: "number";
376
+ description: string;
377
+ };
366
378
  dev: {
367
379
  type: "boolean";
368
380
  description: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/cli",
3
- "version": "4.25.3",
3
+ "version": "4.27.0",
4
4
  "description": "Botpress CLI",
5
5
  "scripts": {
6
6
  "build": "pnpm run build:types && pnpm run bundle && pnpm run template:gen",