@botpress/cli 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build.ts +12 -0
- package/dist/app/api-utils.js +105 -0
- package/dist/app/base.js +35 -0
- package/dist/app/cache.js +95 -0
- package/dist/app/errors.js +145 -0
- package/dist/app/esbuild.js +89 -0
- package/dist/app/generator/action.js +76 -0
- package/dist/app/generator/channel.js +51 -0
- package/dist/app/generator/configuration.js +40 -0
- package/dist/app/generator/const.js +31 -0
- package/dist/app/generator/event.js +47 -0
- package/dist/app/generator/index.js +83 -0
- package/dist/app/generator/integration-impl.js +147 -0
- package/dist/app/generator/integration-instance.js +85 -0
- package/dist/app/generator/message.js +47 -0
- package/dist/app/generator/module.js +115 -0
- package/dist/app/generator/strings.js +38 -0
- package/dist/app/generator/typings.js +16 -0
- package/dist/app/index.js +68 -0
- package/dist/app/integration-ref.js +61 -0
- package/dist/app/project.js +502 -0
- package/dist/app/typings.js +16 -0
- package/dist/app/user.js +198 -0
- package/dist/config.js +245 -0
- package/dist/const.js +87 -0
- package/dist/index.js +276 -0
- package/dist/index.js.map +7 -0
- package/dist/init.js +45 -0
- package/dist/init.js.map +7 -0
- package/dist/logger/base-logger.js +159 -0
- package/dist/logger/index.js +79 -0
- package/dist/paths.js +69 -0
- package/dist/requires.js +49 -0
- package/dist/type-utils.js +16 -0
- package/dist/worker/child-entrypoint.js +61 -0
- package/dist/worker/config.js +58 -0
- package/dist/worker/index.js +55 -0
- package/dist/worker/is-child.js +52 -0
- package/dist/worker/listen-child.js +89 -0
- package/init.js +1 -0
- package/package.json +54 -0
- package/readme.md +24 -0
package/dist/app/user.js
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
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 user_exports = {};
|
|
26
|
+
__export(user_exports, {
|
|
27
|
+
UserCommands: () => UserCommands
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(user_exports);
|
|
30
|
+
var bpclient = __toESM(require("@botpress/client"));
|
|
31
|
+
var import_chalk = __toESM(require("chalk"));
|
|
32
|
+
var import_lodash = __toESM(require("lodash"));
|
|
33
|
+
var import_prompts = __toESM(require("prompts"));
|
|
34
|
+
var import_api_utils = require("./api-utils");
|
|
35
|
+
var import_base = require("./base");
|
|
36
|
+
var errors = __toESM(require("./errors"));
|
|
37
|
+
var import_integration_ref = require("./integration-ref");
|
|
38
|
+
class UserCommands extends import_base.BaseCommands {
|
|
39
|
+
constructor(_props, _userCache, logger) {
|
|
40
|
+
super(logger);
|
|
41
|
+
this._userCache = _userCache;
|
|
42
|
+
}
|
|
43
|
+
async login(argv) {
|
|
44
|
+
const promptedToken = await this._userCache.sync("token", argv.token, async (previousToken) => {
|
|
45
|
+
const { prompted } = await (0, import_prompts.default)({
|
|
46
|
+
type: "password",
|
|
47
|
+
name: "prompted",
|
|
48
|
+
message: "Enter your Personal Access Token",
|
|
49
|
+
initial: previousToken
|
|
50
|
+
});
|
|
51
|
+
if (!prompted) {
|
|
52
|
+
throw new errors.ParamRequiredError("Personal Access Token");
|
|
53
|
+
}
|
|
54
|
+
return prompted;
|
|
55
|
+
});
|
|
56
|
+
const promptedWorkspaceId = await this._userCache.sync(
|
|
57
|
+
"workspaceId",
|
|
58
|
+
argv.workspaceId,
|
|
59
|
+
async (previousWorkspace) => {
|
|
60
|
+
const { prompted } = await (0, import_prompts.default)({
|
|
61
|
+
type: "text",
|
|
62
|
+
name: "prompted",
|
|
63
|
+
message: "Enter your default Workspace Id",
|
|
64
|
+
initial: previousWorkspace
|
|
65
|
+
});
|
|
66
|
+
if (!prompted) {
|
|
67
|
+
throw new errors.ParamRequiredError("Workspace Id");
|
|
68
|
+
}
|
|
69
|
+
return prompted;
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
await this._userCache.set("host", argv.host);
|
|
73
|
+
const client = new bpclient.Client({
|
|
74
|
+
host: argv.host,
|
|
75
|
+
token: promptedToken,
|
|
76
|
+
workspaceId: promptedWorkspaceId
|
|
77
|
+
});
|
|
78
|
+
const api = new import_api_utils.ApiUtils(client, argv.host, promptedToken, promptedWorkspaceId, this._logger);
|
|
79
|
+
await api.testLogin();
|
|
80
|
+
this._logger.success("Logged In");
|
|
81
|
+
}
|
|
82
|
+
async logout() {
|
|
83
|
+
await this._userCache.clear();
|
|
84
|
+
this._logger.success("Logged Out");
|
|
85
|
+
}
|
|
86
|
+
async createBot(argv) {
|
|
87
|
+
const { client } = await this._ensureLoginAndCreateClient(argv);
|
|
88
|
+
try {
|
|
89
|
+
const { bot } = await client.createBot({ name: argv.name });
|
|
90
|
+
this._logger.success(`Bot ${import_chalk.default.bold(bot.id)}:`);
|
|
91
|
+
this._logger.json(bot);
|
|
92
|
+
} catch (thrown) {
|
|
93
|
+
throw errors.BotpressCLIError.wrap(thrown, "Could not create bot");
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
async getBot(botId, argv) {
|
|
97
|
+
const { client } = await this._ensureLoginAndCreateClient(argv);
|
|
98
|
+
try {
|
|
99
|
+
const { bot } = await client.getBot({ id: botId });
|
|
100
|
+
this._logger.success(`Bot ${import_chalk.default.bold(botId)}:`);
|
|
101
|
+
this._logger.json(bot);
|
|
102
|
+
} catch (thrown) {
|
|
103
|
+
throw errors.BotpressCLIError.wrap(thrown, `Could not get bot ${botId}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
async listBots(argv) {
|
|
107
|
+
const api = await this._ensureLoginAndCreateClient(argv);
|
|
108
|
+
try {
|
|
109
|
+
const bots = await api.listAllPages(api.client.listBots, "bots");
|
|
110
|
+
this._logger.success("Bots:");
|
|
111
|
+
this._logger.json(bots);
|
|
112
|
+
} catch (thrown) {
|
|
113
|
+
throw errors.BotpressCLIError.wrap(thrown, "Could not list bots");
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async deleteBot(botId, argv) {
|
|
117
|
+
const { client } = await this._ensureLoginAndCreateClient(argv);
|
|
118
|
+
try {
|
|
119
|
+
await client.deleteBot({ id: botId });
|
|
120
|
+
this._logger.success(`Bot ${import_chalk.default.bold(botId)} deleted`);
|
|
121
|
+
} catch (thrown) {
|
|
122
|
+
throw errors.BotpressCLIError.wrap(thrown, `Could not delete bot ${botId}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
async getIntegration(integrationRef, argv) {
|
|
126
|
+
const api = await this._ensureLoginAndCreateClient(argv);
|
|
127
|
+
const parsedRef = (0, import_integration_ref.parseIntegrationRef)(integrationRef);
|
|
128
|
+
if (!parsedRef) {
|
|
129
|
+
throw new errors.InvalidIntegrationReferenceError(integrationRef);
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
const integration = await api.findIntegration(parsedRef);
|
|
133
|
+
if (integration) {
|
|
134
|
+
this._logger.success(`Integration ${import_chalk.default.bold(integrationRef)}:`);
|
|
135
|
+
this._logger.json(integration);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
} catch (thrown) {
|
|
139
|
+
throw errors.BotpressCLIError.wrap(thrown, `Could not get integration ${integrationRef}`);
|
|
140
|
+
}
|
|
141
|
+
throw new errors.BotpressCLIError(`Integration ${integrationRef} not found`);
|
|
142
|
+
}
|
|
143
|
+
async listIntegrations(argv) {
|
|
144
|
+
const api = await this._ensureLoginAndCreateClient(argv);
|
|
145
|
+
const privateLister = (req) => api.client.listIntegrations({ nextToken: req.nextToken, name: argv.name, version: argv.version });
|
|
146
|
+
const publicLister = (req) => api.client.listPublicIntegrations({ nextToken: req.nextToken, name: argv.name, version: argv.version });
|
|
147
|
+
try {
|
|
148
|
+
const privateIntegrations = await api.listAllPages(privateLister, "integrations");
|
|
149
|
+
const publicIntegrations = await api.listAllPages(publicLister, "integrations");
|
|
150
|
+
const integrations = import_lodash.default.uniqBy([...privateIntegrations, ...publicIntegrations], (i) => i.id);
|
|
151
|
+
this._logger.success("Integrations:");
|
|
152
|
+
this._logger.json(integrations);
|
|
153
|
+
} catch (thrown) {
|
|
154
|
+
throw errors.BotpressCLIError.wrap(thrown, "Could not list integrations");
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
async deleteIntegration(integrationRef, argv) {
|
|
158
|
+
const api = await this._ensureLoginAndCreateClient(argv);
|
|
159
|
+
const parsedRef = (0, import_integration_ref.parseIntegrationRef)(integrationRef);
|
|
160
|
+
if (!parsedRef) {
|
|
161
|
+
throw new errors.InvalidIntegrationReferenceError(integrationRef);
|
|
162
|
+
}
|
|
163
|
+
let integration;
|
|
164
|
+
try {
|
|
165
|
+
integration = await api.findPrivateIntegration(parsedRef);
|
|
166
|
+
} catch (thrown) {
|
|
167
|
+
throw errors.BotpressCLIError.wrap(thrown, `Could not get integration ${integrationRef}`);
|
|
168
|
+
}
|
|
169
|
+
if (!integration) {
|
|
170
|
+
const publicIntegration = await api.findPublicIntegration(parsedRef);
|
|
171
|
+
if (publicIntegration) {
|
|
172
|
+
throw new errors.BotpressCLIError(`Integration ${integrationRef} does not belong to your workspace`);
|
|
173
|
+
}
|
|
174
|
+
throw new errors.BotpressCLIError(`Integration ${integrationRef} not found`);
|
|
175
|
+
}
|
|
176
|
+
try {
|
|
177
|
+
await api.client.deleteIntegration({ id: integration.id });
|
|
178
|
+
} catch (thrown) {
|
|
179
|
+
throw errors.BotpressCLIError.wrap(thrown, `Could not delete integration ${integrationRef}`);
|
|
180
|
+
}
|
|
181
|
+
this._logger.success(`Integration ${import_chalk.default.bold(integrationRef)} deleted`);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
async _ensureLoginAndCreateClient(argv) {
|
|
185
|
+
const token = await this._userCache.get("token");
|
|
186
|
+
const workspaceId = argv.workspaceId ?? await this._userCache.get("workspaceId");
|
|
187
|
+
const host = argv.host ?? await this._userCache.get("host");
|
|
188
|
+
if (!(token && workspaceId && host)) {
|
|
189
|
+
throw new errors.NotLoggedInError();
|
|
190
|
+
}
|
|
191
|
+
const client = new bpclient.Client({ host, token, workspaceId });
|
|
192
|
+
return new import_api_utils.ApiUtils(client, host, token, workspaceId, this._logger);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
196
|
+
0 && (module.exports = {
|
|
197
|
+
UserCommands
|
|
198
|
+
});
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
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 config_exports = {};
|
|
26
|
+
__export(config_exports, {
|
|
27
|
+
addSchema: () => addSchema,
|
|
28
|
+
botRef: () => botRef,
|
|
29
|
+
buildSchema: () => buildSchema,
|
|
30
|
+
bundleSchema: () => bundleSchema,
|
|
31
|
+
createBotSchema: () => createBotSchema,
|
|
32
|
+
deleteBotSchema: () => deleteBotSchema,
|
|
33
|
+
deleteIntegrationSchema: () => deleteIntegrationSchema,
|
|
34
|
+
deploySchema: () => deploySchema,
|
|
35
|
+
devSchema: () => devSchema,
|
|
36
|
+
generateSchema: () => generateSchema,
|
|
37
|
+
globalSchema: () => globalSchema,
|
|
38
|
+
integrationRef: () => integrationRef,
|
|
39
|
+
listBotsSchema: () => listBotsSchema,
|
|
40
|
+
listIntegrationsSchema: () => listIntegrationsSchema,
|
|
41
|
+
loggedInSchema: () => loggedInSchema,
|
|
42
|
+
loginSchema: () => loginSchema,
|
|
43
|
+
logoutSchema: () => logoutSchema,
|
|
44
|
+
projectSchema: () => projectSchema,
|
|
45
|
+
readBotSchema: () => readBotSchema,
|
|
46
|
+
readIntegrationSchema: () => readIntegrationSchema,
|
|
47
|
+
serveSchema: () => serveSchema
|
|
48
|
+
});
|
|
49
|
+
module.exports = __toCommonJS(config_exports);
|
|
50
|
+
var consts = __toESM(require("./const"));
|
|
51
|
+
const botpressHome = {
|
|
52
|
+
type: "string",
|
|
53
|
+
description: "The path to the Botpress home directory",
|
|
54
|
+
default: consts.defaultBotpressHome
|
|
55
|
+
};
|
|
56
|
+
const verbose = {
|
|
57
|
+
type: "boolean",
|
|
58
|
+
description: "Enable verbose logging",
|
|
59
|
+
alias: "v",
|
|
60
|
+
default: false
|
|
61
|
+
};
|
|
62
|
+
const json = {
|
|
63
|
+
type: "boolean",
|
|
64
|
+
description: "Prevent logging anything else than raw json. Useful for piping output to other tools",
|
|
65
|
+
alias: "j",
|
|
66
|
+
default: false
|
|
67
|
+
};
|
|
68
|
+
const confirm = {
|
|
69
|
+
type: "boolean",
|
|
70
|
+
description: "Confirm all prompts",
|
|
71
|
+
alias: "y",
|
|
72
|
+
default: false
|
|
73
|
+
};
|
|
74
|
+
const port = {
|
|
75
|
+
type: "number",
|
|
76
|
+
description: "The port to use"
|
|
77
|
+
};
|
|
78
|
+
const entryPoint = {
|
|
79
|
+
type: "string",
|
|
80
|
+
description: "The entry point of the project",
|
|
81
|
+
default: consts.defaultEntrypoint
|
|
82
|
+
};
|
|
83
|
+
const definition = {
|
|
84
|
+
type: "string",
|
|
85
|
+
description: "The integration definition file to use. If file not found, the project is treated as a bot",
|
|
86
|
+
default: consts.defaultIntegrationConfigScript
|
|
87
|
+
};
|
|
88
|
+
const outDir = {
|
|
89
|
+
type: "string",
|
|
90
|
+
description: "The output directory",
|
|
91
|
+
default: consts.defaultOutputFolder
|
|
92
|
+
};
|
|
93
|
+
const workDir = {
|
|
94
|
+
type: "string",
|
|
95
|
+
description: "The path to the project",
|
|
96
|
+
default: process.cwd()
|
|
97
|
+
};
|
|
98
|
+
const botId = {
|
|
99
|
+
type: "string",
|
|
100
|
+
description: "The bot ID to deploy"
|
|
101
|
+
};
|
|
102
|
+
const url = {
|
|
103
|
+
type: "string",
|
|
104
|
+
description: "The publicly available URL of the bot or integration (often using ngrok)",
|
|
105
|
+
demandOption: true
|
|
106
|
+
};
|
|
107
|
+
const noBuild = {
|
|
108
|
+
type: "boolean",
|
|
109
|
+
description: "Skip the build step",
|
|
110
|
+
default: false
|
|
111
|
+
};
|
|
112
|
+
const host = {
|
|
113
|
+
type: "string",
|
|
114
|
+
description: "The URL of the Botpress server"
|
|
115
|
+
};
|
|
116
|
+
const token = {
|
|
117
|
+
type: "string",
|
|
118
|
+
description: "You Personal Access Token "
|
|
119
|
+
};
|
|
120
|
+
const workspaceId = {
|
|
121
|
+
type: "string",
|
|
122
|
+
description: "The Workspace Id to deploy to"
|
|
123
|
+
};
|
|
124
|
+
const botRef = {
|
|
125
|
+
type: "string",
|
|
126
|
+
description: "The bot ID. Bot Name is not supported.",
|
|
127
|
+
demandOption: true
|
|
128
|
+
};
|
|
129
|
+
const integrationRef = {
|
|
130
|
+
type: "string",
|
|
131
|
+
description: "The integration ID or name with optionnal version. Ex: teams or teams@0.2.0",
|
|
132
|
+
demandOption: true
|
|
133
|
+
};
|
|
134
|
+
const globalSchema = {
|
|
135
|
+
verbose,
|
|
136
|
+
confirm,
|
|
137
|
+
json,
|
|
138
|
+
botpressHome
|
|
139
|
+
};
|
|
140
|
+
const projectSchema = {
|
|
141
|
+
...globalSchema,
|
|
142
|
+
entryPoint,
|
|
143
|
+
definition,
|
|
144
|
+
outDir,
|
|
145
|
+
workDir
|
|
146
|
+
};
|
|
147
|
+
const loggedInSchema = {
|
|
148
|
+
host,
|
|
149
|
+
workspaceId,
|
|
150
|
+
token
|
|
151
|
+
};
|
|
152
|
+
const generateSchema = {
|
|
153
|
+
...projectSchema
|
|
154
|
+
};
|
|
155
|
+
const bundleSchema = {
|
|
156
|
+
...projectSchema
|
|
157
|
+
};
|
|
158
|
+
const buildSchema = {
|
|
159
|
+
...projectSchema
|
|
160
|
+
};
|
|
161
|
+
const serveSchema = {
|
|
162
|
+
...projectSchema,
|
|
163
|
+
port
|
|
164
|
+
};
|
|
165
|
+
const deploySchema = {
|
|
166
|
+
...projectSchema,
|
|
167
|
+
...loggedInSchema,
|
|
168
|
+
botId,
|
|
169
|
+
noBuild
|
|
170
|
+
};
|
|
171
|
+
const devSchema = {
|
|
172
|
+
...projectSchema,
|
|
173
|
+
...loggedInSchema,
|
|
174
|
+
url,
|
|
175
|
+
port,
|
|
176
|
+
noBuild
|
|
177
|
+
};
|
|
178
|
+
const addSchema = {
|
|
179
|
+
...projectSchema,
|
|
180
|
+
...loggedInSchema
|
|
181
|
+
};
|
|
182
|
+
const loginSchema = {
|
|
183
|
+
...globalSchema,
|
|
184
|
+
token,
|
|
185
|
+
workspaceId,
|
|
186
|
+
host: { ...host, default: consts.defaultBotpressApi }
|
|
187
|
+
};
|
|
188
|
+
const logoutSchema = {
|
|
189
|
+
...globalSchema
|
|
190
|
+
};
|
|
191
|
+
const createBotSchema = {
|
|
192
|
+
...globalSchema,
|
|
193
|
+
...loggedInSchema,
|
|
194
|
+
name: { type: "string", description: "The name of the bot to create" }
|
|
195
|
+
};
|
|
196
|
+
const readBotSchema = {
|
|
197
|
+
...globalSchema,
|
|
198
|
+
...loggedInSchema
|
|
199
|
+
};
|
|
200
|
+
const deleteBotSchema = {
|
|
201
|
+
...globalSchema,
|
|
202
|
+
...loggedInSchema
|
|
203
|
+
};
|
|
204
|
+
const listBotsSchema = {
|
|
205
|
+
...globalSchema,
|
|
206
|
+
...loggedInSchema
|
|
207
|
+
};
|
|
208
|
+
const readIntegrationSchema = {
|
|
209
|
+
...globalSchema,
|
|
210
|
+
...loggedInSchema
|
|
211
|
+
};
|
|
212
|
+
const listIntegrationsSchema = {
|
|
213
|
+
...globalSchema,
|
|
214
|
+
...loggedInSchema,
|
|
215
|
+
name: { type: "string", description: "The name filter when listing integrations" },
|
|
216
|
+
version: { type: "string", description: "The version filter when listing integrations" }
|
|
217
|
+
};
|
|
218
|
+
const deleteIntegrationSchema = {
|
|
219
|
+
...globalSchema,
|
|
220
|
+
...loggedInSchema
|
|
221
|
+
};
|
|
222
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
223
|
+
0 && (module.exports = {
|
|
224
|
+
addSchema,
|
|
225
|
+
botRef,
|
|
226
|
+
buildSchema,
|
|
227
|
+
bundleSchema,
|
|
228
|
+
createBotSchema,
|
|
229
|
+
deleteBotSchema,
|
|
230
|
+
deleteIntegrationSchema,
|
|
231
|
+
deploySchema,
|
|
232
|
+
devSchema,
|
|
233
|
+
generateSchema,
|
|
234
|
+
globalSchema,
|
|
235
|
+
integrationRef,
|
|
236
|
+
listBotsSchema,
|
|
237
|
+
listIntegrationsSchema,
|
|
238
|
+
loggedInSchema,
|
|
239
|
+
loginSchema,
|
|
240
|
+
logoutSchema,
|
|
241
|
+
projectSchema,
|
|
242
|
+
readBotSchema,
|
|
243
|
+
readIntegrationSchema,
|
|
244
|
+
serveSchema
|
|
245
|
+
});
|
package/dist/const.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
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 const_exports = {};
|
|
26
|
+
__export(const_exports, {
|
|
27
|
+
defDataOutfile: () => defDataOutfile,
|
|
28
|
+
defaultBotpressApi: () => defaultBotpressApi,
|
|
29
|
+
defaultBotpressApp: () => defaultBotpressApp,
|
|
30
|
+
defaultBotpressHome: () => defaultBotpressHome,
|
|
31
|
+
defaultEntrypoint: () => defaultEntrypoint,
|
|
32
|
+
defaultIntegrationConfigScript: () => defaultIntegrationConfigScript,
|
|
33
|
+
defaultOutputFolder: () => defaultOutputFolder,
|
|
34
|
+
dist: () => dist,
|
|
35
|
+
implementationTypings: () => implementationTypings,
|
|
36
|
+
installDir: () => installDir,
|
|
37
|
+
outfile: () => outfile,
|
|
38
|
+
projectCache: () => projectCache,
|
|
39
|
+
relativeToHomeFolder: () => relativeToHomeFolder,
|
|
40
|
+
relativeToOutFolder: () => relativeToOutFolder,
|
|
41
|
+
userCache: () => userCache
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(const_exports);
|
|
44
|
+
var import_os = __toESM(require("os"));
|
|
45
|
+
var import_path = __toESM(require("path"));
|
|
46
|
+
const defaultOutputFolder = ".botpress";
|
|
47
|
+
const defaultEntrypoint = "src/index.ts";
|
|
48
|
+
const defaultIntegrationConfigScript = "integration.definition.ts";
|
|
49
|
+
const defaultBotpressApi = "https://api.botpress.cloud";
|
|
50
|
+
const defaultBotpressApp = "https://app.botpress.cloud";
|
|
51
|
+
const defaultBotpressHome = import_path.default.join(import_os.default.homedir(), ".botpress");
|
|
52
|
+
const relativeToHomeFolder = {
|
|
53
|
+
userCache: "user.cache.json"
|
|
54
|
+
};
|
|
55
|
+
const userCache = (botpressHome) => import_path.default.join(botpressHome, relativeToHomeFolder.userCache);
|
|
56
|
+
const relativeToOutFolder = {
|
|
57
|
+
dist: "dist",
|
|
58
|
+
outfile: import_path.default.join("dist", "index.js"),
|
|
59
|
+
defDataOutfile: import_path.default.join("dist", "integration.definition.json"),
|
|
60
|
+
implementationTypings: "implementation",
|
|
61
|
+
installDir: "installations",
|
|
62
|
+
projectCache: "project.cache.json"
|
|
63
|
+
};
|
|
64
|
+
const dist = (outFolder) => import_path.default.join(outFolder, relativeToOutFolder.dist);
|
|
65
|
+
const outfile = (outFolder) => import_path.default.join(outFolder, relativeToOutFolder.outfile);
|
|
66
|
+
const defDataOutfile = (outFolder) => import_path.default.join(outFolder, relativeToOutFolder.defDataOutfile);
|
|
67
|
+
const implementationTypings = (outFolder) => import_path.default.join(outFolder, relativeToOutFolder.implementationTypings);
|
|
68
|
+
const installDir = (outFolder) => import_path.default.join(outFolder, relativeToOutFolder.installDir);
|
|
69
|
+
const projectCache = (outFolder) => import_path.default.join(outFolder, relativeToOutFolder.projectCache);
|
|
70
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
71
|
+
0 && (module.exports = {
|
|
72
|
+
defDataOutfile,
|
|
73
|
+
defaultBotpressApi,
|
|
74
|
+
defaultBotpressApp,
|
|
75
|
+
defaultBotpressHome,
|
|
76
|
+
defaultEntrypoint,
|
|
77
|
+
defaultIntegrationConfigScript,
|
|
78
|
+
defaultOutputFolder,
|
|
79
|
+
dist,
|
|
80
|
+
implementationTypings,
|
|
81
|
+
installDir,
|
|
82
|
+
outfile,
|
|
83
|
+
projectCache,
|
|
84
|
+
relativeToHomeFolder,
|
|
85
|
+
relativeToOutFolder,
|
|
86
|
+
userCache
|
|
87
|
+
});
|