@botpress/cli 0.0.10 → 0.0.13
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/dist/code-generation/integration-impl.js +3 -6
- package/dist/command-implementations/init-command.js +26 -11
- package/dist/config.js +83 -126
- package/dist/consts.js +9 -9
- package/dist/index.js +12 -255
- package/dist/logger/base-logger.js +5 -20
- package/dist/logger/index.js +3 -2
- package/dist/utils/prompt-utils.js +9 -0
- package/dist/utils/string-utils.js +26 -7
- package/dist/worker/child-entrypoint.js +3 -3
- package/package.json +3 -3
- package/templates/echo-bot/package.json +5 -5
- package/templates/empty-integration/.botpress/implementation/index.ts +3 -3
- package/templates/empty-integration/integration.definition.ts +3 -3
- package/templates/empty-integration/package.json +5 -5
- package/templates/empty-integration/src/index.ts +13 -3
- package/templates/echo-bot/readme.md +0 -5
- package/templates/empty-integration/readme.md +0 -5
|
@@ -28,7 +28,6 @@ __export(integration_impl_exports, {
|
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(integration_impl_exports);
|
|
30
30
|
var import_bluebird = __toESM(require("bluebird"));
|
|
31
|
-
var import_utils = require("../utils");
|
|
32
31
|
var import_action = require("./action");
|
|
33
32
|
var import_channel = require("./channel");
|
|
34
33
|
var import_configuration = require("./configuration");
|
|
@@ -74,7 +73,7 @@ class IntegrationImplementationIndexModule extends import_module.Module {
|
|
|
74
73
|
get content() {
|
|
75
74
|
let content = import_const.GENERATED_HEADER;
|
|
76
75
|
const { configModule, actionsModule, channelsModule, eventsModule } = this;
|
|
77
|
-
content += 'import
|
|
76
|
+
content += 'import * as sdk from "@botpress/sdk";\n\n';
|
|
78
77
|
const configImport = configModule.import(this);
|
|
79
78
|
const actionsImport = actionsModule.import(this);
|
|
80
79
|
const channelsImport = channelsModule.import(this);
|
|
@@ -96,10 +95,8 @@ class IntegrationImplementationIndexModule extends import_module.Module {
|
|
|
96
95
|
content += `export * as ${eventsModule.name} from "./${eventsImport}";
|
|
97
96
|
`;
|
|
98
97
|
content += "\n";
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
content += `export class Integration${className}
|
|
102
|
-
extends Integration<${configModule.name}.${configModule.exports}, ${actionsModule.name}.${actionsModule.exports}, ${channelsModule.name}.${channelsModule.exports}, ${eventsModule.name}.${eventsModule.exports}> {}
|
|
98
|
+
content += `export class Integration
|
|
99
|
+
extends sdk.Integration<${configModule.name}.${configModule.exports}, ${actionsModule.name}.${actionsModule.exports}, ${channelsModule.name}.${channelsModule.exports}, ${eventsModule.name}.${eventsModule.exports}> {}
|
|
103
100
|
`;
|
|
104
101
|
return content;
|
|
105
102
|
}
|
|
@@ -46,26 +46,41 @@ class InitCommand extends import_global_command.GlobalCommand {
|
|
|
46
46
|
}
|
|
47
47
|
projectType = promptedType;
|
|
48
48
|
}
|
|
49
|
+
let name = this.argv.name;
|
|
50
|
+
if (!name) {
|
|
51
|
+
const defaultName = projectType === "bot" ? consts.echoBotDirName : consts.emptyIntegrationDirName;
|
|
52
|
+
const promptMessage = `What is the name of your ${projectType}?`;
|
|
53
|
+
const promptedName = await this.prompt.text(promptMessage, { initial: defaultName });
|
|
54
|
+
if (!promptedName) {
|
|
55
|
+
throw new errors.ParamRequiredError("Project Name");
|
|
56
|
+
}
|
|
57
|
+
name = promptedName;
|
|
58
|
+
}
|
|
49
59
|
const workDir = utils.path.absoluteFrom(utils.path.cwd(), this.argv.workDir);
|
|
50
60
|
if (projectType === "bot") {
|
|
51
|
-
|
|
52
|
-
const exist2 = await this._checkIfDestinationExists(destination2);
|
|
53
|
-
if (exist2) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
await fs.promises.cp(this.globalPaths.abs.echoBotTemplate, destination2, { recursive: true });
|
|
61
|
+
await this._copy({ srcDir: this.globalPaths.abs.echoBotTemplate, destDir: workDir, name });
|
|
57
62
|
this.logger.success(`Bot project initialized in ${import_chalk.default.bold(workDir)}`);
|
|
58
63
|
return;
|
|
59
64
|
}
|
|
60
|
-
|
|
65
|
+
await this._copy({ srcDir: this.globalPaths.abs.emptyIntegrationTemplate, destDir: workDir, name });
|
|
66
|
+
this.logger.success(`Integration project initialized in ${import_chalk.default.bold(this.argv.workDir)}`);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
_copy = async (props) => {
|
|
70
|
+
const { srcDir, destDir, name } = props;
|
|
71
|
+
const destination = pathlib.join(destDir, props.name);
|
|
61
72
|
const exist = await this._checkIfDestinationExists(destination);
|
|
62
73
|
if (exist) {
|
|
63
74
|
return;
|
|
64
75
|
}
|
|
65
|
-
await fs.promises.cp(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
76
|
+
await fs.promises.cp(srcDir, destination, { recursive: true });
|
|
77
|
+
const pkgJsonPath = pathlib.join(destination, "package.json");
|
|
78
|
+
const strContent = await fs.promises.readFile(pkgJsonPath, "utf-8");
|
|
79
|
+
const { name: _, ...json } = JSON.parse(strContent);
|
|
80
|
+
const pkgJsonName = utils.strings.snakeCase(name);
|
|
81
|
+
const updatedJson = { name: pkgJsonName, ...json };
|
|
82
|
+
await fs.promises.writeFile(pkgJsonPath, JSON.stringify(updatedJson, null, 2));
|
|
83
|
+
};
|
|
69
84
|
_checkIfDestinationExists = async (destination) => {
|
|
70
85
|
if (fs.existsSync(destination)) {
|
|
71
86
|
const override = await this.prompt.confirm(
|
package/dist/config.js
CHANGED
|
@@ -6,8 +6,8 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __export = (target, all) => {
|
|
9
|
-
for (var
|
|
10
|
-
__defProp(target,
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
11
|
};
|
|
12
12
|
var __copyProps = (to, from, except, desc) => {
|
|
13
13
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -24,86 +24,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
25
|
var config_exports = {};
|
|
26
26
|
__export(config_exports, {
|
|
27
|
-
|
|
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
|
-
initSchema: () => initSchema,
|
|
39
|
-
integrationRef: () => integrationRef,
|
|
40
|
-
listBotsSchema: () => listBotsSchema,
|
|
41
|
-
listIntegrationsSchema: () => listIntegrationsSchema,
|
|
42
|
-
loggedInSchema: () => loggedInSchema,
|
|
43
|
-
loginSchema: () => loginSchema,
|
|
44
|
-
logoutSchema: () => logoutSchema,
|
|
45
|
-
projectSchema: () => projectSchema,
|
|
46
|
-
readBotSchema: () => readBotSchema,
|
|
47
|
-
readIntegrationSchema: () => readIntegrationSchema,
|
|
48
|
-
serveSchema: () => serveSchema
|
|
27
|
+
schemas: () => schemas
|
|
49
28
|
});
|
|
50
29
|
module.exports = __toCommonJS(config_exports);
|
|
51
30
|
var consts = __toESM(require("./consts"));
|
|
52
|
-
const botpressHome = {
|
|
53
|
-
type: "string",
|
|
54
|
-
description: "The path to the Botpress home directory",
|
|
55
|
-
default: consts.defaultBotpressHome
|
|
56
|
-
};
|
|
57
|
-
const verbose = {
|
|
58
|
-
type: "boolean",
|
|
59
|
-
description: "Enable verbose logging",
|
|
60
|
-
alias: "v",
|
|
61
|
-
default: false
|
|
62
|
-
};
|
|
63
|
-
const json = {
|
|
64
|
-
type: "boolean",
|
|
65
|
-
description: "Prevent logging anything else than raw json. Useful for piping output to other tools",
|
|
66
|
-
alias: "j",
|
|
67
|
-
default: false
|
|
68
|
-
};
|
|
69
|
-
const confirm = {
|
|
70
|
-
type: "boolean",
|
|
71
|
-
description: "Confirm all prompts",
|
|
72
|
-
alias: "y",
|
|
73
|
-
default: false
|
|
74
|
-
};
|
|
75
31
|
const port = {
|
|
76
32
|
type: "number",
|
|
77
33
|
description: "The port to use"
|
|
78
34
|
};
|
|
79
|
-
const entryPoint = {
|
|
80
|
-
type: "string",
|
|
81
|
-
description: "The entry point of the project",
|
|
82
|
-
default: consts.defaultEntrypoint
|
|
83
|
-
};
|
|
84
|
-
const outDir = {
|
|
85
|
-
type: "string",
|
|
86
|
-
description: "The output directory",
|
|
87
|
-
default: consts.defaultOutputFolder
|
|
88
|
-
};
|
|
89
35
|
const workDir = {
|
|
90
36
|
type: "string",
|
|
91
37
|
description: "The path to the project",
|
|
92
38
|
default: process.cwd()
|
|
93
39
|
};
|
|
94
|
-
const botId = {
|
|
95
|
-
type: "string",
|
|
96
|
-
description: "The bot ID to deploy. Only used when deploying a bot"
|
|
97
|
-
};
|
|
98
|
-
const createNewBot = {
|
|
99
|
-
type: "boolean",
|
|
100
|
-
description: "Create a new bot when deploying. Only used when deploying a bot"
|
|
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
40
|
const noBuild = {
|
|
108
41
|
type: "boolean",
|
|
109
42
|
description: "Skip the build step",
|
|
@@ -121,37 +54,51 @@ const workspaceId = {
|
|
|
121
54
|
type: "string",
|
|
122
55
|
description: "The Workspace Id to deploy to"
|
|
123
56
|
};
|
|
124
|
-
const type = {
|
|
125
|
-
type: "string",
|
|
126
|
-
choices: ["bot", "integration"]
|
|
127
|
-
};
|
|
128
|
-
const name = {
|
|
129
|
-
type: "string",
|
|
130
|
-
description: "The name of the project"
|
|
131
|
-
};
|
|
132
57
|
const botRef = {
|
|
133
58
|
type: "string",
|
|
134
59
|
description: "The bot ID. Bot Name is not supported.",
|
|
135
|
-
demandOption: true
|
|
60
|
+
demandOption: true,
|
|
61
|
+
positional: true,
|
|
62
|
+
idx: 0
|
|
136
63
|
};
|
|
137
64
|
const integrationRef = {
|
|
138
65
|
type: "string",
|
|
139
66
|
description: "The integration ID or name with optionnal version. Ex: teams or teams@0.2.0",
|
|
140
|
-
demandOption: true
|
|
67
|
+
demandOption: true,
|
|
68
|
+
positional: true,
|
|
69
|
+
idx: 0
|
|
141
70
|
};
|
|
142
71
|
const globalSchema = {
|
|
143
|
-
verbose
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
72
|
+
verbose: {
|
|
73
|
+
type: "boolean",
|
|
74
|
+
description: "Enable verbose logging",
|
|
75
|
+
alias: "v",
|
|
76
|
+
default: false
|
|
77
|
+
},
|
|
78
|
+
confirm: {
|
|
79
|
+
type: "boolean",
|
|
80
|
+
description: "Confirm all prompts",
|
|
81
|
+
alias: "y",
|
|
82
|
+
default: false
|
|
83
|
+
},
|
|
84
|
+
json: {
|
|
85
|
+
type: "boolean",
|
|
86
|
+
description: "Prevent logging anything else than raw json in stdout. Useful for piping output to other tools",
|
|
87
|
+
default: false
|
|
88
|
+
},
|
|
89
|
+
botpressHome: {
|
|
90
|
+
type: "string",
|
|
91
|
+
description: "The path to the Botpress home directory",
|
|
92
|
+
default: consts.defaultBotpressHome
|
|
93
|
+
}
|
|
147
94
|
};
|
|
148
95
|
const projectSchema = {
|
|
149
96
|
...globalSchema,
|
|
150
|
-
entryPoint,
|
|
151
|
-
outDir,
|
|
97
|
+
entryPoint: { type: "string", description: "The entry point of the project", default: consts.defaultEntrypoint },
|
|
98
|
+
outDir: { type: "string", description: "The output directory", default: consts.defaultOutputFolder },
|
|
152
99
|
workDir
|
|
153
100
|
};
|
|
154
|
-
const
|
|
101
|
+
const credentialsSchema = {
|
|
155
102
|
host,
|
|
156
103
|
workspaceId,
|
|
157
104
|
token
|
|
@@ -171,21 +118,26 @@ const serveSchema = {
|
|
|
171
118
|
};
|
|
172
119
|
const deploySchema = {
|
|
173
120
|
...projectSchema,
|
|
174
|
-
...
|
|
175
|
-
botId,
|
|
121
|
+
...credentialsSchema,
|
|
122
|
+
botId: { type: "string", description: "The bot ID to deploy. Only used when deploying a bot" },
|
|
176
123
|
noBuild,
|
|
177
|
-
createNewBot
|
|
124
|
+
createNewBot: { type: "boolean", description: "Create a new bot when deploying. Only used when deploying a bot" }
|
|
178
125
|
};
|
|
179
126
|
const devSchema = {
|
|
180
127
|
...projectSchema,
|
|
181
|
-
...
|
|
182
|
-
url
|
|
128
|
+
...credentialsSchema,
|
|
129
|
+
url: {
|
|
130
|
+
type: "string",
|
|
131
|
+
description: "The publicly available URL of the bot or integration (often using ngrok)",
|
|
132
|
+
demandOption: true
|
|
133
|
+
},
|
|
183
134
|
port,
|
|
184
135
|
noBuild
|
|
185
136
|
};
|
|
186
137
|
const addSchema = {
|
|
187
138
|
...projectSchema,
|
|
188
|
-
...
|
|
139
|
+
...credentialsSchema,
|
|
140
|
+
integrationRef
|
|
189
141
|
};
|
|
190
142
|
const loginSchema = {
|
|
191
143
|
...globalSchema,
|
|
@@ -198,63 +150,68 @@ const logoutSchema = {
|
|
|
198
150
|
};
|
|
199
151
|
const createBotSchema = {
|
|
200
152
|
...globalSchema,
|
|
201
|
-
...
|
|
153
|
+
...credentialsSchema,
|
|
202
154
|
name: { type: "string", description: "The name of the bot to create" }
|
|
203
155
|
};
|
|
204
|
-
const
|
|
156
|
+
const getBotSchema = {
|
|
205
157
|
...globalSchema,
|
|
206
|
-
...
|
|
158
|
+
...credentialsSchema,
|
|
159
|
+
botRef
|
|
207
160
|
};
|
|
208
161
|
const deleteBotSchema = {
|
|
209
162
|
...globalSchema,
|
|
210
|
-
...
|
|
163
|
+
...credentialsSchema,
|
|
164
|
+
botRef
|
|
211
165
|
};
|
|
212
166
|
const listBotsSchema = {
|
|
213
167
|
...globalSchema,
|
|
214
|
-
...
|
|
168
|
+
...credentialsSchema
|
|
215
169
|
};
|
|
216
|
-
const
|
|
170
|
+
const getIntegrationSchema = {
|
|
217
171
|
...globalSchema,
|
|
218
|
-
...
|
|
172
|
+
...credentialsSchema,
|
|
173
|
+
integrationRef
|
|
219
174
|
};
|
|
220
175
|
const listIntegrationsSchema = {
|
|
221
176
|
...globalSchema,
|
|
222
|
-
...
|
|
177
|
+
...credentialsSchema,
|
|
223
178
|
name: { type: "string", description: "The name filter when listing integrations" },
|
|
224
179
|
version: { type: "string", description: "The version filter when listing integrations" }
|
|
225
180
|
};
|
|
226
181
|
const deleteIntegrationSchema = {
|
|
227
182
|
...globalSchema,
|
|
228
|
-
...
|
|
183
|
+
...credentialsSchema,
|
|
184
|
+
integrationRef
|
|
229
185
|
};
|
|
230
186
|
const initSchema = {
|
|
231
187
|
...globalSchema,
|
|
232
188
|
workDir,
|
|
233
|
-
type,
|
|
234
|
-
name
|
|
189
|
+
type: { type: "string", choices: ["bot", "integration"] },
|
|
190
|
+
name: { type: "string", description: "The name of the project" }
|
|
191
|
+
};
|
|
192
|
+
const schemas = {
|
|
193
|
+
global: globalSchema,
|
|
194
|
+
project: projectSchema,
|
|
195
|
+
credentials: credentialsSchema,
|
|
196
|
+
login: loginSchema,
|
|
197
|
+
logout: logoutSchema,
|
|
198
|
+
createBot: createBotSchema,
|
|
199
|
+
getBot: getBotSchema,
|
|
200
|
+
deleteBot: deleteBotSchema,
|
|
201
|
+
listBots: listBotsSchema,
|
|
202
|
+
getIntegration: getIntegrationSchema,
|
|
203
|
+
listIntegrations: listIntegrationsSchema,
|
|
204
|
+
deleteIntegration: deleteIntegrationSchema,
|
|
205
|
+
init: initSchema,
|
|
206
|
+
generate: generateSchema,
|
|
207
|
+
bundle: bundleSchema,
|
|
208
|
+
build: buildSchema,
|
|
209
|
+
serve: serveSchema,
|
|
210
|
+
deploy: deploySchema,
|
|
211
|
+
add: addSchema,
|
|
212
|
+
dev: devSchema
|
|
235
213
|
};
|
|
236
214
|
// Annotate the CommonJS export names for ESM import in node:
|
|
237
215
|
0 && (module.exports = {
|
|
238
|
-
|
|
239
|
-
botRef,
|
|
240
|
-
buildSchema,
|
|
241
|
-
bundleSchema,
|
|
242
|
-
createBotSchema,
|
|
243
|
-
deleteBotSchema,
|
|
244
|
-
deleteIntegrationSchema,
|
|
245
|
-
deploySchema,
|
|
246
|
-
devSchema,
|
|
247
|
-
generateSchema,
|
|
248
|
-
globalSchema,
|
|
249
|
-
initSchema,
|
|
250
|
-
integrationRef,
|
|
251
|
-
listBotsSchema,
|
|
252
|
-
listIntegrationsSchema,
|
|
253
|
-
loggedInSchema,
|
|
254
|
-
loginSchema,
|
|
255
|
-
logoutSchema,
|
|
256
|
-
projectSchema,
|
|
257
|
-
readBotSchema,
|
|
258
|
-
readIntegrationSchema,
|
|
259
|
-
serveSchema
|
|
216
|
+
schemas
|
|
260
217
|
});
|
package/dist/consts.js
CHANGED
|
@@ -29,8 +29,8 @@ __export(consts_exports, {
|
|
|
29
29
|
defaultBotpressHome: () => defaultBotpressHome,
|
|
30
30
|
defaultEntrypoint: () => defaultEntrypoint,
|
|
31
31
|
defaultOutputFolder: () => defaultOutputFolder,
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
echoBotDirName: () => echoBotDirName,
|
|
33
|
+
emptyIntegrationDirName: () => emptyIntegrationDirName,
|
|
34
34
|
fromCliRootDir: () => fromCliRootDir,
|
|
35
35
|
fromHomeDir: () => fromHomeDir,
|
|
36
36
|
fromOutDir: () => fromOutDir,
|
|
@@ -44,15 +44,15 @@ const defaultOutputFolder = ".botpress";
|
|
|
44
44
|
const defaultEntrypoint = import_path.default.join("src", "index.ts");
|
|
45
45
|
const defaultBotpressApi = "https://api.botpress.cloud";
|
|
46
46
|
const defaultBotpressApp = "https://app.botpress.cloud";
|
|
47
|
-
const
|
|
48
|
-
const
|
|
47
|
+
const echoBotDirName = "echo-bot";
|
|
48
|
+
const emptyIntegrationDirName = "empty-integration";
|
|
49
49
|
const fromCliRootDir = {
|
|
50
50
|
packageJson: "package.json",
|
|
51
|
-
echoBotTemplate: import_path.default.join("templates",
|
|
52
|
-
emptyIntegrationTemplate: import_path.default.join("templates",
|
|
51
|
+
echoBotTemplate: import_path.default.join("templates", echoBotDirName),
|
|
52
|
+
emptyIntegrationTemplate: import_path.default.join("templates", emptyIntegrationDirName)
|
|
53
53
|
};
|
|
54
54
|
const fromHomeDir = {
|
|
55
|
-
|
|
55
|
+
globalCacheFile: "global.cache.json"
|
|
56
56
|
};
|
|
57
57
|
const fromWorkDir = {
|
|
58
58
|
definition: "integration.definition.ts"
|
|
@@ -71,8 +71,8 @@ const fromOutDir = {
|
|
|
71
71
|
defaultBotpressHome,
|
|
72
72
|
defaultEntrypoint,
|
|
73
73
|
defaultOutputFolder,
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
echoBotDirName,
|
|
75
|
+
emptyIntegrationDirName,
|
|
76
76
|
fromCliRootDir,
|
|
77
77
|
fromHomeDir,
|
|
78
78
|
fromOutDir,
|
package/dist/index.js
CHANGED
|
@@ -18,273 +18,30 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
18
18
|
mod
|
|
19
19
|
));
|
|
20
20
|
var import_yargs_extra = __toESM(require("@bpinternal/yargs-extra"));
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var
|
|
21
|
+
var import_command_definitions = __toESM(require("./command-definitions"));
|
|
22
|
+
var import_command_implementations = __toESM(require("./command-implementations"));
|
|
23
|
+
var tree = __toESM(require("./command-tree"));
|
|
24
|
+
var errors = __toESM(require("./errors"));
|
|
24
25
|
var import_logger = require("./logger");
|
|
25
|
-
var
|
|
26
|
-
|
|
26
|
+
var import_register_yargs = require("./register-yargs");
|
|
27
|
+
var utils = __toESM(require("./utils"));
|
|
28
|
+
const CLI_ROOT_DIR = utils.path.join(__dirname, "..");
|
|
27
29
|
const logError = (thrown) => {
|
|
28
|
-
const error =
|
|
30
|
+
const error = errors.BotpressCLIError.map(thrown);
|
|
29
31
|
new import_logger.Logger().error(error.message);
|
|
30
32
|
};
|
|
31
33
|
const onError = (thrown) => {
|
|
32
34
|
logError(thrown);
|
|
33
|
-
|
|
35
|
+
process.exit(1);
|
|
34
36
|
};
|
|
35
37
|
const yargsFail = (msg) => {
|
|
36
38
|
logError(`${msg}
|
|
37
39
|
`);
|
|
38
40
|
import_yargs_extra.default.showHelp();
|
|
39
|
-
|
|
41
|
+
process.exit(1);
|
|
40
42
|
};
|
|
41
43
|
process.on("uncaughtException", (thrown) => onError(thrown));
|
|
42
44
|
process.on("unhandledRejection", (thrown) => onError(thrown));
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
return (0, import_yargs_extra.cleanupConfig)(schema, { ...argv, ...yargsEnv });
|
|
46
|
-
};
|
|
47
|
-
import_yargs_extra.default.command(
|
|
48
|
-
"login",
|
|
49
|
-
"Login to Botpress Cloud",
|
|
50
|
-
() => import_yargs_extra.default.options(config.loginSchema),
|
|
51
|
-
async (argv) => {
|
|
52
|
-
try {
|
|
53
|
-
const parsed = parseArguments(config.loginSchema, argv);
|
|
54
|
-
const commands = await app.forUser({ ...parsed, cliRootPath: CLI_ROOT_DIR });
|
|
55
|
-
await commands.login(parsed);
|
|
56
|
-
commands.teardown();
|
|
57
|
-
} catch (e) {
|
|
58
|
-
onError(e);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
).command(
|
|
62
|
-
"logout",
|
|
63
|
-
"Logout of Botpress Cloud",
|
|
64
|
-
() => import_yargs_extra.default.options(config.logoutSchema),
|
|
65
|
-
async (argv) => {
|
|
66
|
-
try {
|
|
67
|
-
const parsed = parseArguments(config.logoutSchema, argv);
|
|
68
|
-
const commands = await app.forUser({ ...parsed, cliRootPath: CLI_ROOT_DIR });
|
|
69
|
-
await commands.logout();
|
|
70
|
-
commands.teardown();
|
|
71
|
-
} catch (e) {
|
|
72
|
-
onError(e);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
).command("bots", "bots related commands", (yargz) => {
|
|
76
|
-
yargz.command(
|
|
77
|
-
["create", "new"],
|
|
78
|
-
"Create new bot",
|
|
79
|
-
() => yargz.options({ ...config.createBotSchema }),
|
|
80
|
-
async (argv) => {
|
|
81
|
-
try {
|
|
82
|
-
const parsed = parseArguments(config.createBotSchema, argv);
|
|
83
|
-
const commands = await app.forUser({ ...parsed, cliRootPath: CLI_ROOT_DIR });
|
|
84
|
-
await commands.createBot(parsed);
|
|
85
|
-
commands.teardown();
|
|
86
|
-
} catch (e) {
|
|
87
|
-
onError(e);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
).command(
|
|
91
|
-
["list", "ls"],
|
|
92
|
-
"List bots",
|
|
93
|
-
() => yargz.options({ ...config.listBotsSchema }),
|
|
94
|
-
async (argv) => {
|
|
95
|
-
try {
|
|
96
|
-
const parsed = parseArguments(config.listBotsSchema, argv);
|
|
97
|
-
const commands = await app.forUser({ ...parsed, cliRootPath: CLI_ROOT_DIR });
|
|
98
|
-
await commands.listBots(parsed);
|
|
99
|
-
commands.teardown();
|
|
100
|
-
} catch (e) {
|
|
101
|
-
onError(e);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
).command(
|
|
105
|
-
"get <botRef>",
|
|
106
|
-
"Get bot",
|
|
107
|
-
() => yargz.positional("botRef", config.botRef).options({ ...config.readBotSchema }),
|
|
108
|
-
async (argv) => {
|
|
109
|
-
try {
|
|
110
|
-
const parsed = parseArguments(config.readBotSchema, argv);
|
|
111
|
-
const commands = await app.forUser({ ...parsed, cliRootPath: CLI_ROOT_DIR });
|
|
112
|
-
await commands.getBot(argv.botRef, parsed);
|
|
113
|
-
commands.teardown();
|
|
114
|
-
} catch (e) {
|
|
115
|
-
onError(e);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
).command(
|
|
119
|
-
["delete <botRef>", "rm <botRef>"],
|
|
120
|
-
"Delete bot",
|
|
121
|
-
() => yargz.positional("botRef", config.botRef).options({ ...config.deleteBotSchema }),
|
|
122
|
-
async (argv) => {
|
|
123
|
-
try {
|
|
124
|
-
const parsed = parseArguments(config.deleteBotSchema, argv);
|
|
125
|
-
const commands = await app.forUser({ ...parsed, cliRootPath: CLI_ROOT_DIR });
|
|
126
|
-
await commands.deleteBot(argv.botRef, parsed);
|
|
127
|
-
commands.teardown();
|
|
128
|
-
} catch (e) {
|
|
129
|
-
onError(e);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
);
|
|
133
|
-
}).command("integrations", "integrations related commands", (yargz) => {
|
|
134
|
-
yargz.command(
|
|
135
|
-
["list", "ls"],
|
|
136
|
-
"List integrations",
|
|
137
|
-
() => yargz.options({ ...config.listIntegrationsSchema }),
|
|
138
|
-
async (argv) => {
|
|
139
|
-
try {
|
|
140
|
-
const parsed = parseArguments(config.listIntegrationsSchema, argv);
|
|
141
|
-
const commands = await app.forUser({ ...parsed, cliRootPath: CLI_ROOT_DIR });
|
|
142
|
-
await commands.listIntegrations(parsed);
|
|
143
|
-
commands.teardown();
|
|
144
|
-
} catch (e) {
|
|
145
|
-
onError(e);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
).command(
|
|
149
|
-
"get <integrationRef>",
|
|
150
|
-
"Get integration",
|
|
151
|
-
() => yargz.positional("integrationRef", config.integrationRef).options({ ...config.readIntegrationSchema }),
|
|
152
|
-
async (argv) => {
|
|
153
|
-
try {
|
|
154
|
-
const parsed = parseArguments(config.readIntegrationSchema, argv);
|
|
155
|
-
const commands = await app.forUser({ ...parsed, cliRootPath: CLI_ROOT_DIR });
|
|
156
|
-
await commands.getIntegration(argv.integrationRef, parsed);
|
|
157
|
-
commands.teardown();
|
|
158
|
-
} catch (e) {
|
|
159
|
-
onError(e);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
).command(
|
|
163
|
-
["delete <integrationRef>", "rm <integrationRef>"],
|
|
164
|
-
"Delete integration",
|
|
165
|
-
() => yargz.positional("integrationRef", config.integrationRef).options({ ...config.deleteIntegrationSchema }),
|
|
166
|
-
async (argv) => {
|
|
167
|
-
try {
|
|
168
|
-
const parsed = parseArguments(config.readIntegrationSchema, argv);
|
|
169
|
-
const commands = await app.forUser({ ...parsed, cliRootPath: CLI_ROOT_DIR });
|
|
170
|
-
await commands.deleteIntegration(argv.integrationRef, parsed);
|
|
171
|
-
commands.teardown();
|
|
172
|
-
} catch (e) {
|
|
173
|
-
onError(e);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
);
|
|
177
|
-
}).command(
|
|
178
|
-
"init",
|
|
179
|
-
"Initialize a new project",
|
|
180
|
-
() => import_yargs_extra.default.options(config.initSchema),
|
|
181
|
-
async (argv) => {
|
|
182
|
-
try {
|
|
183
|
-
const parsed = parseArguments(config.initSchema, argv);
|
|
184
|
-
const commands = await app.forUser({ ...parsed, cliRootPath: CLI_ROOT_DIR });
|
|
185
|
-
await commands.initProject(parsed);
|
|
186
|
-
commands.teardown();
|
|
187
|
-
} catch (e) {
|
|
188
|
-
onError(e);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
).command(
|
|
192
|
-
"bundle",
|
|
193
|
-
"Bundle a botpress project",
|
|
194
|
-
() => import_yargs_extra.default.options(config.bundleSchema),
|
|
195
|
-
async (argv) => {
|
|
196
|
-
try {
|
|
197
|
-
const parsed = parseArguments(config.bundleSchema, argv);
|
|
198
|
-
const commands = await app.forProject({ ...parsed, cliRootPath: CLI_ROOT_DIR });
|
|
199
|
-
await commands.bundleProject(parsed);
|
|
200
|
-
commands.teardown();
|
|
201
|
-
} catch (e) {
|
|
202
|
-
onError(e);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
).command(
|
|
206
|
-
"gen",
|
|
207
|
-
"Generate typings for intellisense during development",
|
|
208
|
-
() => import_yargs_extra.default.options(config.generateSchema),
|
|
209
|
-
async (argv) => {
|
|
210
|
-
try {
|
|
211
|
-
const parsed = parseArguments(config.generateSchema, argv);
|
|
212
|
-
const commands = await app.forProject({ ...parsed, cliRootPath: CLI_ROOT_DIR });
|
|
213
|
-
await commands.generateTypings(parsed);
|
|
214
|
-
commands.teardown();
|
|
215
|
-
} catch (e) {
|
|
216
|
-
onError(e);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
).command(
|
|
220
|
-
"build",
|
|
221
|
-
"Generate typings and bundle a botpress project",
|
|
222
|
-
() => import_yargs_extra.default.options(config.buildSchema),
|
|
223
|
-
async (argv) => {
|
|
224
|
-
try {
|
|
225
|
-
const parsed = parseArguments(config.buildSchema, argv);
|
|
226
|
-
const commands = await app.forProject({ ...parsed, cliRootPath: CLI_ROOT_DIR });
|
|
227
|
-
await commands.buildProject(parsed);
|
|
228
|
-
commands.teardown();
|
|
229
|
-
} catch (e) {
|
|
230
|
-
onError(e);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
).command(
|
|
234
|
-
"serve",
|
|
235
|
-
"Serve your project locally",
|
|
236
|
-
() => import_yargs_extra.default.options(config.serveSchema),
|
|
237
|
-
async (argv) => {
|
|
238
|
-
try {
|
|
239
|
-
const parsed = parseArguments(config.serveSchema, argv);
|
|
240
|
-
const commands = await app.forProject({ ...parsed, cliRootPath: CLI_ROOT_DIR });
|
|
241
|
-
await commands.serveProject(parsed);
|
|
242
|
-
commands.teardown();
|
|
243
|
-
} catch (e) {
|
|
244
|
-
onError(e);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
).command(
|
|
248
|
-
"deploy",
|
|
249
|
-
"Deploy your project",
|
|
250
|
-
() => import_yargs_extra.default.options(config.deploySchema),
|
|
251
|
-
async (argv) => {
|
|
252
|
-
try {
|
|
253
|
-
const parsed = parseArguments(config.deploySchema, argv);
|
|
254
|
-
const commands = await app.forProject({ ...parsed, cliRootPath: CLI_ROOT_DIR });
|
|
255
|
-
await commands.deployProject(parsed);
|
|
256
|
-
commands.teardown();
|
|
257
|
-
} catch (e) {
|
|
258
|
-
onError(e);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
).command(
|
|
262
|
-
"dev",
|
|
263
|
-
"Run your project in dev mode",
|
|
264
|
-
() => import_yargs_extra.default.options(config.devSchema),
|
|
265
|
-
async (argv) => {
|
|
266
|
-
try {
|
|
267
|
-
const parsed = parseArguments(config.devSchema, argv);
|
|
268
|
-
const commands = await app.forProject({ ...parsed, cliRootPath: CLI_ROOT_DIR });
|
|
269
|
-
await commands.devProject(parsed);
|
|
270
|
-
commands.teardown();
|
|
271
|
-
} catch (e) {
|
|
272
|
-
onError(e);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
).command(
|
|
276
|
-
"add <integrationRef>",
|
|
277
|
-
"Install an integration in your bot",
|
|
278
|
-
(yargz) => yargz.positional("integrationRef", config.integrationRef).options(config.addSchema),
|
|
279
|
-
async (argv) => {
|
|
280
|
-
try {
|
|
281
|
-
const parsed = parseArguments(config.addSchema, argv);
|
|
282
|
-
const commands = await app.forProject({ ...parsed, cliRootPath: CLI_ROOT_DIR });
|
|
283
|
-
await commands.installIntegration(argv.integrationRef, parsed);
|
|
284
|
-
commands.teardown();
|
|
285
|
-
} catch (e) {
|
|
286
|
-
onError(e);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
);
|
|
45
|
+
const commands = tree.zipTree(import_command_definitions.default, import_command_implementations.default);
|
|
46
|
+
(0, import_register_yargs.registerYargs)(import_yargs_extra.default, commands, { cliRootDir: CLI_ROOT_DIR });
|
|
290
47
|
void import_yargs_extra.default.version(false).scriptName("bp").demandCommand(1, "You didn't provide any command. Use the --help flag to see the list of available commands.").recommendCommands().strict().help().fail(yargsFail).parse();
|
|
@@ -89,7 +89,7 @@ class BaseLogger {
|
|
|
89
89
|
this.opts = { ...DEFAULT_OPTIONS, ...opts };
|
|
90
90
|
}
|
|
91
91
|
log(message, props = {}) {
|
|
92
|
-
if (this.opts.json) {
|
|
92
|
+
if (this.opts.json && !props.stderr) {
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
95
|
const prefix = this._resolvePrefix(props.prefix);
|
|
@@ -102,44 +102,29 @@ class BaseLogger {
|
|
|
102
102
|
}
|
|
103
103
|
const { depth } = opts;
|
|
104
104
|
const msg = import_util.default.inspect(data, { colors: true, depth });
|
|
105
|
-
this.
|
|
105
|
+
this.log(msg);
|
|
106
106
|
}
|
|
107
107
|
debug(message, metadata) {
|
|
108
|
-
if (!this.opts.verbose
|
|
108
|
+
if (!this.opts.verbose) {
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
111
|
this.log(import_chalk.default.grey(message), { metadata, prefix: { symbol: "\u25CF", fg: "blue" } });
|
|
112
112
|
}
|
|
113
113
|
started(message, metadata) {
|
|
114
|
-
if (this.opts.json) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
114
|
this.log(message, { metadata, prefix: { symbol: "\u25CB", fg: "purple" } });
|
|
118
115
|
}
|
|
119
116
|
success(message, metadata) {
|
|
120
|
-
if (this.opts.json) {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
117
|
this.log(message, { metadata, prefix: { symbol: "\u2713", fg: "green" } });
|
|
124
118
|
}
|
|
125
119
|
warn(message, metadata) {
|
|
126
|
-
if (this.opts.json) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
120
|
this.log(message, { metadata, prefix: { symbol: "\u26A0", fg: "yellow" } });
|
|
130
121
|
}
|
|
131
122
|
error(message, metadata) {
|
|
132
|
-
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
this.log(message, { metadata, prefix: { symbol: "\xD7", fg: "red" } });
|
|
123
|
+
this.log(message, { metadata, prefix: { symbol: "\xD7", fg: "red" }, stderr: true });
|
|
136
124
|
}
|
|
137
125
|
box(message) {
|
|
138
|
-
if (this.opts.json) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
126
|
const box = (0, import_boxen.default)(message, BOX_OPTIONS);
|
|
142
|
-
this.
|
|
127
|
+
this.log(box);
|
|
143
128
|
}
|
|
144
129
|
_resolvePrefix(prefix) {
|
|
145
130
|
if (!prefix) {
|
package/dist/logger/index.js
CHANGED
|
@@ -27,12 +27,13 @@ class Logger extends import_base_logger.BaseLogger {
|
|
|
27
27
|
static _previousLine;
|
|
28
28
|
print(message, props = {}) {
|
|
29
29
|
this.cleanup();
|
|
30
|
+
const log = props.stderr ? console.error : console.info;
|
|
30
31
|
const { metadata, prefix } = props;
|
|
31
32
|
if (prefix) {
|
|
32
|
-
|
|
33
|
+
log(prefix, message, metadata ?? "");
|
|
33
34
|
return;
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
+
log(message, metadata ?? "");
|
|
36
37
|
}
|
|
37
38
|
line() {
|
|
38
39
|
this.cleanup();
|
|
@@ -68,6 +68,15 @@ class CLIPrompt {
|
|
|
68
68
|
});
|
|
69
69
|
return prompted ? prompted : void 0;
|
|
70
70
|
}
|
|
71
|
+
async text(message, opts) {
|
|
72
|
+
const { prompted } = await (0, import_prompts.default)({
|
|
73
|
+
type: "text",
|
|
74
|
+
name: "prompted",
|
|
75
|
+
message,
|
|
76
|
+
initial: opts?.initial
|
|
77
|
+
});
|
|
78
|
+
return prompted ? prompted : void 0;
|
|
79
|
+
}
|
|
71
80
|
}
|
|
72
81
|
// Annotate the CommonJS export names for ESM import in node:
|
|
73
82
|
0 && (module.exports = {
|
|
@@ -18,21 +18,40 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var string_utils_exports = {};
|
|
20
20
|
__export(string_utils_exports, {
|
|
21
|
+
camelCase: () => camelCase,
|
|
21
22
|
kebabCase: () => kebabCase,
|
|
22
|
-
pascalCase: () => pascalCase
|
|
23
|
+
pascalCase: () => pascalCase,
|
|
24
|
+
snakeCase: () => snakeCase
|
|
23
25
|
});
|
|
24
26
|
module.exports = __toCommonJS(string_utils_exports);
|
|
25
|
-
const capitalizeFirstLetter = (
|
|
26
|
-
const
|
|
27
|
-
|
|
27
|
+
const capitalizeFirstLetter = (text) => text.charAt(0).toUpperCase() + text.slice(1);
|
|
28
|
+
const splitHyphens = (tokens) => tokens.flatMap((token) => token.split("-"));
|
|
29
|
+
const splitUnderscores = (tokens) => tokens.flatMap((token) => token.split("_"));
|
|
30
|
+
const splitCaseChange = (tokens) => tokens.flatMap((token) => token.split(/(?<=[a-z])(?=[A-Z])/));
|
|
31
|
+
const split = (tokens) => {
|
|
32
|
+
const steps = [splitHyphens, splitUnderscores, splitCaseChange];
|
|
33
|
+
return steps.reduce((acc, step) => step(acc), tokens);
|
|
34
|
+
};
|
|
35
|
+
const pascalCase = (text) => {
|
|
36
|
+
const words = split([text]);
|
|
28
37
|
return words.map(capitalizeFirstLetter).join("");
|
|
29
38
|
};
|
|
30
|
-
const kebabCase = (
|
|
31
|
-
const words =
|
|
39
|
+
const kebabCase = (text) => {
|
|
40
|
+
const words = split([text]);
|
|
32
41
|
return words.map((word) => word.toLowerCase()).join("-");
|
|
33
42
|
};
|
|
43
|
+
const snakeCase = (text) => {
|
|
44
|
+
const words = split([text]);
|
|
45
|
+
return words.map((word) => word.toLowerCase()).join("_");
|
|
46
|
+
};
|
|
47
|
+
const camelCase = (text) => {
|
|
48
|
+
const [first, ...words] = split([text]);
|
|
49
|
+
return [first.toLowerCase(), ...words.map(capitalizeFirstLetter)].join("");
|
|
50
|
+
};
|
|
34
51
|
// Annotate the CommonJS export names for ESM import in node:
|
|
35
52
|
0 && (module.exports = {
|
|
53
|
+
camelCase,
|
|
36
54
|
kebabCase,
|
|
37
|
-
pascalCase
|
|
55
|
+
pascalCase,
|
|
56
|
+
snakeCase
|
|
38
57
|
});
|
|
@@ -27,7 +27,7 @@ __export(child_entrypoint_exports, {
|
|
|
27
27
|
ENTRY_POINT: () => ENTRY_POINT
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(child_entrypoint_exports);
|
|
30
|
-
var
|
|
30
|
+
var utils = __toESM(require("../utils"));
|
|
31
31
|
var import_config = require("./config");
|
|
32
32
|
var import_is_child = require("./is-child");
|
|
33
33
|
const ENTRY_POINT = __filename;
|
|
@@ -38,10 +38,10 @@ const childProcessEntrypoint = async (_props) => {
|
|
|
38
38
|
}
|
|
39
39
|
const config = import_config.configSchema.parse(JSON.parse(rawConfig));
|
|
40
40
|
if (config.type === "code") {
|
|
41
|
-
|
|
41
|
+
utils.require.requireJsCode(config.code);
|
|
42
42
|
}
|
|
43
43
|
if (config.type === "file") {
|
|
44
|
-
|
|
44
|
+
utils.require.requireJsFile(config.file);
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
if (import_is_child.processProps.type === "child") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botpress/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
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",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"main": "dist/index.js",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@botpress/client": "0.0.
|
|
22
|
+
"@botpress/client": "0.0.11",
|
|
23
23
|
"@bpinternal/yargs-extra": "^0.0.2",
|
|
24
24
|
"@parcel/watcher": "^2.1.0",
|
|
25
25
|
"@types/lodash": "^4.14.191",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"zod-to-json-schema": "^3.20.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@botpress/sdk": "0.0.
|
|
48
|
+
"@botpress/sdk": "0.0.9",
|
|
49
49
|
"@types/bluebird": "^3.5.38",
|
|
50
50
|
"@types/prompts": "^2.0.14",
|
|
51
51
|
"@types/semver": "^7.3.11",
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
2
|
+
"name": "echo-bot",
|
|
3
3
|
"version": "0.1.0",
|
|
4
|
-
"description": "Bot that answers with the received message",
|
|
5
4
|
"scripts": {
|
|
6
5
|
"type-check": "tsc --noEmit"
|
|
7
6
|
},
|
|
@@ -10,13 +9,14 @@
|
|
|
10
9
|
"author": "",
|
|
11
10
|
"license": "MIT",
|
|
12
11
|
"dependencies": {
|
|
13
|
-
"@botpress/client": "0.0.
|
|
14
|
-
"@botpress/sdk": "0.0.
|
|
12
|
+
"@botpress/client": "0.0.11",
|
|
13
|
+
"@botpress/sdk": "0.0.9",
|
|
15
14
|
"zod": "^3.20.6"
|
|
16
15
|
},
|
|
17
16
|
"devDependencies": {
|
|
18
17
|
"@types/node": "^18.11.17",
|
|
19
18
|
"ts-node": "^10.9.1",
|
|
20
|
-
"typescript": "^4.9.4"
|
|
19
|
+
"typescript": "^4.9.4",
|
|
20
|
+
"@tsconfig/node18-strictest": "^1.0.0"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// This file is generated
|
|
3
3
|
// Do not edit this file
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as sdk from "@botpress/sdk";
|
|
6
6
|
|
|
7
7
|
import type * as configuration from "./configuration";
|
|
8
8
|
import type * as actions from "./actions/index";
|
|
@@ -13,5 +13,5 @@ export * as actions from "./actions/index";
|
|
|
13
13
|
export * as channels from "./channels/index";
|
|
14
14
|
export * as events from "./events/index";
|
|
15
15
|
|
|
16
|
-
export class
|
|
17
|
-
extends Integration<configuration.Configuration, actions.Actions, channels.Channels, events.Events> {}
|
|
16
|
+
export class Integration
|
|
17
|
+
extends sdk.Integration<configuration.Configuration, actions.Actions, channels.Channels, events.Events> {}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { IntegrationDefinition, messages } from '@botpress/sdk'
|
|
2
|
-
import { version } from './package.json'
|
|
2
|
+
import { version, name } from './package.json'
|
|
3
3
|
|
|
4
4
|
export default new IntegrationDefinition({
|
|
5
|
-
name
|
|
5
|
+
name,
|
|
6
6
|
version,
|
|
7
|
-
public:
|
|
7
|
+
public: false,
|
|
8
8
|
channels: {
|
|
9
9
|
channel: {
|
|
10
10
|
messages: { ...messages.defaults },
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
2
|
+
"name": "empty-integration",
|
|
3
3
|
"version": "0.1.0",
|
|
4
|
-
"description": "Integration with no content",
|
|
5
4
|
"scripts": {
|
|
6
5
|
"type-check": "tsc --noEmit"
|
|
7
6
|
},
|
|
@@ -10,13 +9,14 @@
|
|
|
10
9
|
"author": "",
|
|
11
10
|
"license": "MIT",
|
|
12
11
|
"dependencies": {
|
|
13
|
-
"@botpress/client": "0.0.
|
|
14
|
-
"@botpress/sdk": "0.0.
|
|
12
|
+
"@botpress/client": "0.0.11",
|
|
13
|
+
"@botpress/sdk": "0.0.9",
|
|
15
14
|
"zod": "^3.20.6"
|
|
16
15
|
},
|
|
17
16
|
"devDependencies": {
|
|
18
17
|
"@types/node": "^18.11.17",
|
|
19
18
|
"ts-node": "^10.9.1",
|
|
20
|
-
"typescript": "^4.9.4"
|
|
19
|
+
"typescript": "^4.9.4",
|
|
20
|
+
"@tsconfig/node18-strictest": "^1.0.0"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -9,9 +9,19 @@ class NotImplementedError extends Error {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export default new botpress.
|
|
13
|
-
register: async () => {
|
|
14
|
-
|
|
12
|
+
export default new botpress.Integration({
|
|
13
|
+
register: async () => {
|
|
14
|
+
/**
|
|
15
|
+
* This is called when a bot installs the integration.
|
|
16
|
+
* You should use this handler to instanciate ressources in the external service and ensure that the configuration is valid.
|
|
17
|
+
*/
|
|
18
|
+
},
|
|
19
|
+
unregister: async () => {
|
|
20
|
+
/**
|
|
21
|
+
* This is called when a bot removes the integration.
|
|
22
|
+
* You should use this handler to instanciate ressources in the external service and ensure that the configuration is valid.
|
|
23
|
+
*/
|
|
24
|
+
},
|
|
15
25
|
actions: {},
|
|
16
26
|
channels: {
|
|
17
27
|
channel: {
|