@botpress/cli 0.0.13 → 0.0.15

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.
Files changed (59) hide show
  1. package/dist/code-generation/action.js +2 -2
  2. package/dist/code-generation/channel.js +2 -2
  3. package/dist/code-generation/event.js +1 -1
  4. package/dist/code-generation/index.js +25 -7
  5. package/dist/code-generation/integration-impl.js +3 -3
  6. package/dist/code-generation/integration-instance.js +3 -2
  7. package/dist/code-generation/integration-secret.js +54 -0
  8. package/dist/code-generation/message.js +1 -1
  9. package/dist/code-generation/module.js +6 -5
  10. package/dist/command-implementations/base-command.js +7 -2
  11. package/dist/command-implementations/deploy-command.js +5 -1
  12. package/dist/command-implementations/dev-command.js +7 -4
  13. package/dist/command-implementations/gen-command.js +24 -2
  14. package/dist/command-implementations/global-command.js +3 -0
  15. package/dist/command-implementations/init-command.js +1 -1
  16. package/dist/command-implementations/project-command.js +48 -0
  17. package/dist/command-implementations/serve-command.js +8 -2
  18. package/dist/config.js +13 -0
  19. package/dist/consts.js +1 -0
  20. package/dist/utils/case-utils.js +69 -0
  21. package/dist/utils/index.js +5 -5
  22. package/dist/utils/prompt-utils.js +8 -4
  23. package/package.json +3 -3
  24. package/templates/echo-bot/package.json +1 -2
  25. package/templates/empty-integration/.botpress/index.ts +2 -1
  26. package/templates/empty-integration/.botpress/secrets/index.ts +7 -0
  27. package/templates/empty-integration/integration.definition.ts +2 -2
  28. package/templates/empty-integration/package.json +1 -2
  29. package/dist/app/api-utils.js +0 -112
  30. package/dist/app/base.js +0 -71
  31. package/dist/app/cache.js +0 -95
  32. package/dist/app/errors.js +0 -156
  33. package/dist/app/file-paths.js +0 -79
  34. package/dist/app/generator/action.js +0 -76
  35. package/dist/app/generator/channel.js +0 -51
  36. package/dist/app/generator/configuration.js +0 -40
  37. package/dist/app/generator/const.js +0 -31
  38. package/dist/app/generator/event.js +0 -47
  39. package/dist/app/generator/index.js +0 -83
  40. package/dist/app/generator/integration-impl.js +0 -147
  41. package/dist/app/generator/integration-instance.js +0 -85
  42. package/dist/app/generator/message.js +0 -47
  43. package/dist/app/generator/module.js +0 -115
  44. package/dist/app/generator/strings.js +0 -38
  45. package/dist/app/generator/typings.js +0 -16
  46. package/dist/app/index.js +0 -82
  47. package/dist/app/integration-ref.js +0 -61
  48. package/dist/app/project.js +0 -486
  49. package/dist/app/typings.js +0 -16
  50. package/dist/app/user.js +0 -237
  51. package/dist/esbuild-utils.js +0 -89
  52. package/dist/event-emitter.js +0 -62
  53. package/dist/path-utils.js +0 -72
  54. package/dist/require-utils.js +0 -49
  55. package/dist/update-notif.js +0 -47
  56. package/dist/utils/string-utils.js +0 -57
  57. package/dist/watcher.js +0 -68
  58. package/templates/echo-bot/.botpress/project.cache.json +0 -1
  59. package/templates/empty-integration/.botpress/project.cache.json +0 -1
@@ -38,7 +38,7 @@ class CLIPrompt {
38
38
  this._logger.debug(`Confirming automatically: ${message}`);
39
39
  return true;
40
40
  }
41
- const { confirm } = await (0, import_prompts.default)({
41
+ const { confirm } = await this._prompts({
42
42
  type: "confirm",
43
43
  name: "confirm",
44
44
  message,
@@ -50,7 +50,7 @@ class CLIPrompt {
50
50
  return true;
51
51
  }
52
52
  async password(message, opts) {
53
- const { prompted } = await (0, import_prompts.default)({
53
+ const { prompted } = await this._prompts({
54
54
  type: "password",
55
55
  name: "prompted",
56
56
  message,
@@ -59,7 +59,7 @@ class CLIPrompt {
59
59
  return prompted ? prompted : void 0;
60
60
  }
61
61
  async select(message, opts) {
62
- const { prompted } = await (0, import_prompts.default)({
62
+ const { prompted } = await this._prompts({
63
63
  type: "autocomplete",
64
64
  name: "prompted",
65
65
  message,
@@ -69,7 +69,7 @@ class CLIPrompt {
69
69
  return prompted ? prompted : void 0;
70
70
  }
71
71
  async text(message, opts) {
72
- const { prompted } = await (0, import_prompts.default)({
72
+ const { prompted } = await this._prompts({
73
73
  type: "text",
74
74
  name: "prompted",
75
75
  message,
@@ -77,6 +77,10 @@ class CLIPrompt {
77
77
  });
78
78
  return prompted ? prompted : void 0;
79
79
  }
80
+ _prompts = (...args) => {
81
+ this._logger.cleanup();
82
+ return (0, import_prompts.default)(...args);
83
+ };
80
84
  }
81
85
  // Annotate the CommonJS export names for ESM import in node:
82
86
  0 && (module.exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/cli",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "Botpress CLI",
5
5
  "scripts": {
6
6
  "build": "pnpm run type-check && pnpm run bundle && pnpm run template:gen && pnpm run template:type-check",
@@ -20,7 +20,7 @@
20
20
  "main": "dist/index.js",
21
21
  "dependencies": {
22
22
  "@botpress/client": "0.0.11",
23
- "@bpinternal/yargs-extra": "^0.0.2",
23
+ "@bpinternal/yargs-extra": "^0.0.3",
24
24
  "@parcel/watcher": "^2.1.0",
25
25
  "@types/lodash": "^4.14.191",
26
26
  "@types/node": "^18.11.17",
@@ -45,7 +45,7 @@
45
45
  "zod-to-json-schema": "^3.20.1"
46
46
  },
47
47
  "devDependencies": {
48
- "@botpress/sdk": "0.0.9",
48
+ "@botpress/sdk": "0.0.11",
49
49
  "@types/bluebird": "^3.5.38",
50
50
  "@types/prompts": "^2.0.14",
51
51
  "@types/semver": "^7.3.11",
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "name": "echo-bot",
3
- "version": "0.1.0",
4
3
  "scripts": {
5
4
  "type-check": "tsc --noEmit"
6
5
  },
@@ -10,7 +9,7 @@
10
9
  "license": "MIT",
11
10
  "dependencies": {
12
11
  "@botpress/client": "0.0.11",
13
- "@botpress/sdk": "0.0.9",
12
+ "@botpress/sdk": "0.0.11",
14
13
  "zod": "^3.20.6"
15
14
  },
16
15
  "devDependencies": {
@@ -1 +1,2 @@
1
- export * from './implementation'
1
+ export * from './implementation'
2
+ export * from './secrets'
@@ -0,0 +1,7 @@
1
+ /* tslint:disable */
2
+ // This file is generated
3
+ // Do not edit this file
4
+
5
+ class Secrets {
6
+ }
7
+ export const secrets = new Secrets()
@@ -1,9 +1,9 @@
1
1
  import { IntegrationDefinition, messages } from '@botpress/sdk'
2
- import { version, name } from './package.json'
2
+ import { name } from './package.json'
3
3
 
4
4
  export default new IntegrationDefinition({
5
5
  name,
6
- version,
6
+ version: '0.0.1',
7
7
  public: false,
8
8
  channels: {
9
9
  channel: {
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "name": "empty-integration",
3
- "version": "0.1.0",
4
3
  "scripts": {
5
4
  "type-check": "tsc --noEmit"
6
5
  },
@@ -10,7 +9,7 @@
10
9
  "license": "MIT",
11
10
  "dependencies": {
12
11
  "@botpress/client": "0.0.11",
13
- "@botpress/sdk": "0.0.9",
12
+ "@botpress/sdk": "0.0.11",
14
13
  "zod": "^3.20.6"
15
14
  },
16
15
  "devDependencies": {
@@ -1,112 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
- var api_utils_exports = {};
26
- __export(api_utils_exports, {
27
- ApiUtils: () => ApiUtils
28
- });
29
- module.exports = __toCommonJS(api_utils_exports);
30
- var import_client = require("@botpress/client");
31
- var import_lodash = __toESM(require("lodash"));
32
- var errors = __toESM(require("./errors"));
33
- var import_integration_ref = require("./integration-ref");
34
- class ApiUtils {
35
- constructor(props, _logger) {
36
- this._logger = _logger;
37
- const { host, token, workspaceId } = props;
38
- this.client = new import_client.Client({ host, token, workspaceId });
39
- this.host = host;
40
- this.token = token;
41
- this.workspaceId = workspaceId;
42
- }
43
- client;
44
- host;
45
- token;
46
- workspaceId;
47
- async findIntegration(ref) {
48
- const formatted = (0, import_integration_ref.formatIntegrationRef)(ref);
49
- const privateIntegration = await this.findPrivateIntegration(ref);
50
- if (privateIntegration) {
51
- this._logger.debug(`Found integration "${formatted}" in workspace`);
52
- return privateIntegration;
53
- }
54
- const publicIntegration = await this.findPublicIntegration(ref);
55
- if (publicIntegration) {
56
- this._logger.debug(`Found integration "${formatted}" in hub`);
57
- return publicIntegration;
58
- }
59
- return;
60
- }
61
- async findPrivateIntegration(ref) {
62
- if (ref.type === "id") {
63
- return this.validateStatus(() => this.client.getIntegration(ref).then((r) => r.integration), [404, 500]);
64
- }
65
- return this.validateStatus(() => this.client.getIntegrationByName(ref).then((r) => r.integration), [404, 500]);
66
- }
67
- async findPublicIntegration(ref) {
68
- if (ref.type === "id") {
69
- return this.validateStatus(() => this.client.getPublicIntegrationById(ref).then((r) => r.integration), [404, 500]);
70
- }
71
- return this.validateStatus(() => this.client.getPublicIntegration(ref).then((r) => r.integration), [404, 500]);
72
- }
73
- async testLogin() {
74
- try {
75
- await this.client.listBots({});
76
- } catch (thrown) {
77
- throw errors.BotpressCLIError.wrap(thrown, "Authentication failed. Please check your credentials");
78
- }
79
- }
80
- async listAllPages(lister, map) {
81
- let nextToken;
82
- const all = [];
83
- do {
84
- const { meta, ...r } = await lister({ nextToken });
85
- all.push(r);
86
- nextToken = meta.nextToken;
87
- } while (nextToken);
88
- if (!map) {
89
- return all;
90
- }
91
- const mapped = all.flatMap((r) => map(r));
92
- return mapped;
93
- }
94
- async validateStatus(fn, allowedStatuses) {
95
- try {
96
- const v = await fn();
97
- return v;
98
- } catch (thrown) {
99
- const err = errors.BotpressCLIError.map(thrown);
100
- const allowedStatusesArray = import_lodash.default.isArray(allowedStatuses) ? allowedStatuses : [allowedStatuses];
101
- const isAllowed = err instanceof errors.HTTPError && err.status && allowedStatusesArray.includes(err.status);
102
- if (isAllowed) {
103
- return;
104
- }
105
- throw err;
106
- }
107
- }
108
- }
109
- // Annotate the CommonJS export names for ESM import in node:
110
- 0 && (module.exports = {
111
- ApiUtils
112
- });
package/dist/app/base.js DELETED
@@ -1,71 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
- var base_exports = {};
26
- __export(base_exports, {
27
- BaseCommands: () => BaseCommands
28
- });
29
- module.exports = __toCommonJS(base_exports);
30
- var import_prompts = __toESM(require("prompts"));
31
- var import_api_utils = require("./api-utils");
32
- var errors = __toESM(require("./errors"));
33
- class BaseCommands {
34
- constructor(_props, _userCache, _logger) {
35
- this._props = _props;
36
- this._userCache = _userCache;
37
- this._logger = _logger;
38
- }
39
- teardown() {
40
- this._logger.cleanup();
41
- }
42
- async _ensureLoginAndCreateClient(argv) {
43
- const token = await this._userCache.get("token");
44
- const workspaceId = argv.workspaceId ?? await this._userCache.get("workspaceId");
45
- const host = argv.host ?? await this._userCache.get("host");
46
- if (!(token && workspaceId && host)) {
47
- throw new errors.NotLoggedInError();
48
- }
49
- return new import_api_utils.ApiUtils({ host, token, workspaceId }, this._logger);
50
- }
51
- async _confirm(message) {
52
- if (this._props.confirm) {
53
- this._logger.debug(`Confirming automatically: ${message}`);
54
- return true;
55
- }
56
- const { confirm } = await (0, import_prompts.default)({
57
- type: "confirm",
58
- name: "confirm",
59
- message,
60
- initial: false
61
- });
62
- if (!confirm) {
63
- return false;
64
- }
65
- return true;
66
- }
67
- }
68
- // Annotate the CommonJS export names for ESM import in node:
69
- 0 && (module.exports = {
70
- BaseCommands
71
- });
package/dist/app/cache.js DELETED
@@ -1,95 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
- var cache_exports = {};
26
- __export(cache_exports, {
27
- FSConfigCache: () => FSConfigCache
28
- });
29
- module.exports = __toCommonJS(cache_exports);
30
- var import_fs = __toESM(require("fs"));
31
- var import_path = __toESM(require("path"));
32
- class FSConfigCache {
33
- constructor(_filepath) {
34
- this._filepath = _filepath;
35
- }
36
- static async loadFrom(filepath) {
37
- const dirname = import_path.default.dirname(filepath);
38
- if (!import_fs.default.existsSync(dirname)) {
39
- await import_fs.default.promises.mkdir(dirname, { recursive: true });
40
- }
41
- if (!import_fs.default.existsSync(filepath)) {
42
- await this._writeJSON(filepath, {});
43
- }
44
- return new FSConfigCache(filepath);
45
- }
46
- static _writeJSON = (filepath, data) => {
47
- const fileContent = JSON.stringify(data, null, 2);
48
- return import_fs.default.promises.writeFile(filepath, fileContent);
49
- };
50
- static _readJSON = async (filepath) => {
51
- const fileContent = await import_fs.default.promises.readFile(filepath, "utf8");
52
- return JSON.parse(fileContent);
53
- };
54
- async sync(key, value, prompt) {
55
- if (value) {
56
- await this.set(key, value);
57
- return value;
58
- }
59
- const data = await this.get(key);
60
- const newValue = await prompt(data);
61
- await this.set(key, newValue);
62
- return newValue;
63
- }
64
- async has(key) {
65
- const data = await FSConfigCache._readJSON(this._filepath);
66
- return data[key] !== void 0;
67
- }
68
- async get(key) {
69
- const data = await FSConfigCache._readJSON(this._filepath);
70
- return data[key];
71
- }
72
- async set(key, value) {
73
- const data = await FSConfigCache._readJSON(this._filepath);
74
- data[key] = value;
75
- return FSConfigCache._writeJSON(this._filepath, data);
76
- }
77
- async rm(key) {
78
- const data = await FSConfigCache._readJSON(this._filepath);
79
- delete data[key];
80
- return FSConfigCache._writeJSON(this._filepath, data);
81
- }
82
- async clear() {
83
- return FSConfigCache._writeJSON(this._filepath, {});
84
- }
85
- async nuke() {
86
- if (!import_fs.default.existsSync(this._filepath)) {
87
- return;
88
- }
89
- import_fs.default.unlinkSync(this._filepath);
90
- }
91
- }
92
- // Annotate the CommonJS export names for ESM import in node:
93
- 0 && (module.exports = {
94
- FSConfigCache
95
- });
@@ -1,156 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
- var errors_exports = {};
26
- __export(errors_exports, {
27
- BotpressCLIError: () => BotpressCLIError,
28
- ExclusiveBotFeatureError: () => ExclusiveBotFeatureError,
29
- ExclusiveIntegrationFeatureError: () => ExclusiveIntegrationFeatureError,
30
- HTTPError: () => HTTPError,
31
- InvalidIntegrationReferenceError: () => InvalidIntegrationReferenceError,
32
- NoBotsFoundError: () => NoBotsFoundError,
33
- NoBundleFoundError: () => NoBundleFoundError,
34
- NoWorkspacesFoundError: () => NoWorkspacesFoundError,
35
- NotLoggedInError: () => NotLoggedInError,
36
- ParamRequiredError: () => ParamRequiredError
37
- });
38
- module.exports = __toCommonJS(errors_exports);
39
- var import_client = require("@botpress/client");
40
- var import_axios = __toESM(require("axios"));
41
- var import_verror = require("verror");
42
- var consts = __toESM(require("../consts"));
43
- const isKnownApiError = (e) => (0, import_client.isApiError)(e) && !(e instanceof import_client.UnknownError);
44
- class BotpressCLIError extends import_verror.VError {
45
- static wrap(thrown, message) {
46
- const err = BotpressCLIError.map(thrown);
47
- return new BotpressCLIError(err, message ?? "");
48
- }
49
- static map(thrown) {
50
- if (thrown instanceof import_client.UnknownError) {
51
- return new HTTPError(500, "An unknown error has occurred.");
52
- }
53
- if (isKnownApiError(thrown)) {
54
- return HTTPError.fromApi(thrown);
55
- }
56
- if (import_axios.default.isAxiosError(thrown)) {
57
- return HTTPError.fromAxios(thrown);
58
- }
59
- if (thrown instanceof Error) {
60
- const { message } = thrown;
61
- return new BotpressCLIError(message);
62
- }
63
- return new BotpressCLIError(`${thrown}`);
64
- }
65
- }
66
- class ExclusiveBotFeatureError extends BotpressCLIError {
67
- constructor() {
68
- const message = "This feature is only available for bots. This project is an integration";
69
- super(message);
70
- }
71
- }
72
- class ExclusiveIntegrationFeatureError extends BotpressCLIError {
73
- constructor() {
74
- const message = "This feature is only available for integration. This project is a bot";
75
- super(message);
76
- }
77
- }
78
- class HTTPError extends BotpressCLIError {
79
- constructor(status, message) {
80
- super(message);
81
- this.status = status;
82
- }
83
- static fromAxios(e) {
84
- const message = this._axiosMsg(e);
85
- return new HTTPError(e.response?.status, message);
86
- }
87
- static fromApi(e) {
88
- const { message, code } = e;
89
- return new HTTPError(code, message);
90
- }
91
- static _axiosMsg(e) {
92
- let message = e.message;
93
- if (e.response?.statusText) {
94
- message += `
95
- ${e.response?.statusText}`;
96
- }
97
- if (e.response?.status && e.request?.method && e.request?.path) {
98
- message += `
99
- (${e.response?.status}) ${e.request.method} ${e.request.path}`;
100
- }
101
- if (e.response?.data?.message) {
102
- message += `
103
- ${e.response?.data?.message}`;
104
- }
105
- return message;
106
- }
107
- }
108
- class NoBundleFoundError extends BotpressCLIError {
109
- constructor() {
110
- const message = "No bundle found. Please run `bp bundle` first.";
111
- super(message);
112
- }
113
- }
114
- class NoBotsFoundError extends BotpressCLIError {
115
- constructor() {
116
- const message = `No Bot found in your Workspace. Please create one first at ${consts.defaultBotpressApp}.`;
117
- super(message);
118
- }
119
- }
120
- class NoWorkspacesFoundError extends BotpressCLIError {
121
- constructor() {
122
- const message = "No Workspace found. Please create one first.";
123
- super(message);
124
- }
125
- }
126
- class NotLoggedInError extends BotpressCLIError {
127
- constructor() {
128
- const message = "Not logged in. Please run `bp login` first.";
129
- super(message);
130
- }
131
- }
132
- class ParamRequiredError extends BotpressCLIError {
133
- constructor(param) {
134
- const message = `${param} is required.`;
135
- super(message);
136
- }
137
- }
138
- class InvalidIntegrationReferenceError extends BotpressCLIError {
139
- constructor(ref) {
140
- const message = `Invalid integration reference "${ref}".`;
141
- super(message);
142
- }
143
- }
144
- // Annotate the CommonJS export names for ESM import in node:
145
- 0 && (module.exports = {
146
- BotpressCLIError,
147
- ExclusiveBotFeatureError,
148
- ExclusiveIntegrationFeatureError,
149
- HTTPError,
150
- InvalidIntegrationReferenceError,
151
- NoBotsFoundError,
152
- NoBundleFoundError,
153
- NoWorkspacesFoundError,
154
- NotLoggedInError,
155
- ParamRequiredError
156
- });
@@ -1,79 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
- var file_paths_exports = {};
26
- __export(file_paths_exports, {
27
- ProjectPaths: () => ProjectPaths,
28
- UserPaths: () => UserPaths
29
- });
30
- module.exports = __toCommonJS(file_paths_exports);
31
- var import_lodash = __toESM(require("lodash"));
32
- var consts = __toESM(require("../consts"));
33
- var pathutils = __toESM(require("../path-utils"));
34
- class ProjectPaths {
35
- abs;
36
- constructor({ workDir, entryPoint, outDir }) {
37
- const absWorkDir = pathutils.absoluteFrom(pathutils.cwd(), workDir);
38
- const absEntrypoint = pathutils.absoluteFrom(absWorkDir, entryPoint);
39
- const absOutDir = pathutils.absoluteFrom(absWorkDir, outDir);
40
- this.abs = {
41
- workDir: absWorkDir,
42
- entryPoint: absEntrypoint,
43
- outDir: absOutDir,
44
- ...import_lodash.default.mapValues(consts.fromOutDir, (p) => pathutils.absoluteFrom(absOutDir, p)),
45
- ...import_lodash.default.mapValues(consts.fromWorkDir, (p) => pathutils.absoluteFrom(absWorkDir, p))
46
- };
47
- }
48
- get rel() {
49
- return this.relFrom("workDir");
50
- }
51
- relFrom(dir) {
52
- const from = this.abs[dir];
53
- return import_lodash.default.mapValues(this.abs, (to) => pathutils.relativeFrom(from, to));
54
- }
55
- }
56
- class UserPaths {
57
- abs;
58
- constructor({ botpressHomeDir, cliRootDir: absCliRootDir }) {
59
- const absBotpressHome = pathutils.absoluteFrom(pathutils.cwd(), botpressHomeDir);
60
- this.abs = {
61
- cliRootDir: absCliRootDir,
62
- botpressHomeDir: absBotpressHome,
63
- ...import_lodash.default.mapValues(consts.fromHomeDir, (p) => pathutils.absoluteFrom(absBotpressHome, p)),
64
- ...import_lodash.default.mapValues(consts.fromCliRootDir, (p) => pathutils.absoluteFrom(absCliRootDir, p))
65
- };
66
- }
67
- get rel() {
68
- return this.relFrom("botpressHomeDir");
69
- }
70
- relFrom(dir) {
71
- const from = this.abs[dir];
72
- return import_lodash.default.mapValues(this.abs, (to) => pathutils.relativeFrom(from, to));
73
- }
74
- }
75
- // Annotate the CommonJS export names for ESM import in node:
76
- 0 && (module.exports = {
77
- ProjectPaths,
78
- UserPaths
79
- });