@botpress/cli 0.0.14 → 0.0.17
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/api-client.js +1 -0
- package/dist/api-client.js.map +7 -0
- package/dist/code-generation/action.js +1 -0
- package/dist/code-generation/action.js.map +7 -0
- package/dist/code-generation/channel.js +1 -0
- package/dist/code-generation/channel.js.map +7 -0
- package/dist/code-generation/configuration.js +1 -0
- package/dist/code-generation/configuration.js.map +7 -0
- package/dist/code-generation/const.js +1 -0
- package/dist/code-generation/const.js.map +7 -0
- package/dist/code-generation/event.js +1 -0
- package/dist/code-generation/event.js.map +7 -0
- package/dist/code-generation/index.js +1 -0
- package/dist/code-generation/index.js.map +7 -0
- package/dist/code-generation/integration-impl.js +1 -0
- package/dist/code-generation/integration-impl.js.map +7 -0
- package/dist/code-generation/integration-instance.js +1 -0
- package/dist/code-generation/integration-instance.js.map +7 -0
- package/dist/code-generation/integration-secret.js +1 -0
- package/dist/code-generation/integration-secret.js.map +7 -0
- package/dist/code-generation/message.js +1 -0
- package/dist/code-generation/message.js.map +7 -0
- package/dist/code-generation/module.js +1 -0
- package/dist/code-generation/module.js.map +7 -0
- package/dist/code-generation/typings.js +1 -0
- package/dist/code-generation/typings.js.map +7 -0
- package/dist/command-definitions.js +1 -0
- package/dist/command-definitions.js.map +7 -0
- package/dist/command-implementations/add-command.js +1 -0
- package/dist/command-implementations/add-command.js.map +7 -0
- package/dist/command-implementations/base-command.js +8 -1
- package/dist/command-implementations/base-command.js.map +7 -0
- package/dist/command-implementations/bot-commands.js +1 -0
- package/dist/command-implementations/bot-commands.js.map +7 -0
- package/dist/command-implementations/build-command.js +1 -0
- package/dist/command-implementations/build-command.js.map +7 -0
- package/dist/command-implementations/bundle-command.js +1 -0
- package/dist/command-implementations/bundle-command.js.map +7 -0
- package/dist/command-implementations/deploy-command.js +21 -3
- package/dist/command-implementations/deploy-command.js.map +7 -0
- package/dist/command-implementations/dev-command.js +1 -0
- package/dist/command-implementations/dev-command.js.map +7 -0
- package/dist/command-implementations/gen-command.js +1 -0
- package/dist/command-implementations/gen-command.js.map +7 -0
- package/dist/command-implementations/global-command.js +1 -0
- package/dist/command-implementations/global-command.js.map +7 -0
- package/dist/command-implementations/index.js +1 -0
- package/dist/command-implementations/index.js.map +7 -0
- package/dist/command-implementations/init-command.js +1 -0
- package/dist/command-implementations/init-command.js.map +7 -0
- package/dist/command-implementations/integration-commands.js +1 -0
- package/dist/command-implementations/integration-commands.js.map +7 -0
- package/dist/command-implementations/login-command.js +1 -0
- package/dist/command-implementations/login-command.js.map +7 -0
- package/dist/command-implementations/logout-command.js +1 -0
- package/dist/command-implementations/logout-command.js.map +7 -0
- package/dist/command-implementations/project-command.js +1 -0
- package/dist/command-implementations/project-command.js.map +7 -0
- package/dist/command-implementations/serve-command.js +1 -0
- package/dist/command-implementations/serve-command.js.map +7 -0
- package/dist/command-tree.js +1 -0
- package/dist/command-tree.js.map +7 -0
- package/dist/config.js +1 -0
- package/dist/config.js.map +7 -0
- package/dist/consts.js +1 -0
- package/dist/consts.js.map +7 -0
- package/dist/errors.js +27 -1
- package/dist/errors.js.map +7 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +7 -0
- package/dist/init.js +1 -0
- package/dist/init.js.map +7 -0
- package/dist/integration-ref.js +1 -0
- package/dist/integration-ref.js.map +7 -0
- package/dist/logger/base-logger.js +1 -0
- package/dist/logger/base-logger.js.map +7 -0
- package/dist/logger/index.js +1 -0
- package/dist/logger/index.js.map +7 -0
- package/dist/register-yargs.js +1 -0
- package/dist/register-yargs.js.map +7 -0
- package/dist/typings.js +1 -0
- package/dist/typings.js.map +7 -0
- package/dist/utils/cache-utils.js +1 -0
- package/dist/utils/cache-utils.js.map +7 -0
- package/dist/utils/case-utils.js +1 -0
- package/dist/utils/case-utils.js.map +7 -0
- package/dist/utils/esbuild-utils.js +1 -0
- package/dist/utils/esbuild-utils.js.map +7 -0
- package/dist/utils/event-emitter.js +1 -0
- package/dist/utils/event-emitter.js.map +7 -0
- package/dist/utils/file-watcher.js +1 -0
- package/dist/utils/file-watcher.js.map +7 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +7 -0
- package/dist/utils/path-utils.js +1 -0
- package/dist/utils/path-utils.js.map +7 -0
- package/dist/utils/prompt-utils.js +1 -0
- package/dist/utils/prompt-utils.js.map +7 -0
- package/dist/utils/require-utils.js +1 -0
- package/dist/utils/require-utils.js.map +7 -0
- package/dist/worker/child-entrypoint.js +1 -0
- package/dist/worker/child-entrypoint.js.map +7 -0
- package/dist/worker/child-wrapper.js +1 -0
- package/dist/worker/child-wrapper.js.map +7 -0
- package/dist/worker/config.js +1 -0
- package/dist/worker/config.js.map +7 -0
- package/dist/worker/index.js +1 -0
- package/dist/worker/index.js.map +7 -0
- package/dist/worker/is-child.js +1 -0
- package/dist/worker/is-child.js.map +7 -0
- package/dist/worker/worker-state.js +1 -0
- package/dist/worker/worker-state.js.map +7 -0
- package/dist/worker/worker.js +1 -0
- package/dist/worker/worker.js.map +7 -0
- package/package.json +13 -13
- package/templates/echo-bot/package.json +1 -2
- package/templates/empty-integration/integration.definition.ts +2 -2
- package/templates/empty-integration/package.json +1 -2
- package/build.ts +0 -12
- package/dist/app/api-utils.js +0 -112
- package/dist/app/base.js +0 -71
- package/dist/app/cache.js +0 -95
- package/dist/app/errors.js +0 -156
- package/dist/app/file-paths.js +0 -79
- package/dist/app/generator/action.js +0 -76
- package/dist/app/generator/channel.js +0 -51
- package/dist/app/generator/configuration.js +0 -40
- package/dist/app/generator/const.js +0 -31
- package/dist/app/generator/event.js +0 -47
- package/dist/app/generator/index.js +0 -83
- package/dist/app/generator/integration-impl.js +0 -147
- package/dist/app/generator/integration-instance.js +0 -85
- package/dist/app/generator/message.js +0 -47
- package/dist/app/generator/module.js +0 -115
- package/dist/app/generator/strings.js +0 -38
- package/dist/app/generator/typings.js +0 -16
- package/dist/app/index.js +0 -82
- package/dist/app/integration-ref.js +0 -61
- package/dist/app/project.js +0 -486
- package/dist/app/typings.js +0 -16
- package/dist/app/user.js +0 -237
- package/dist/esbuild-utils.js +0 -89
- package/dist/event-emitter.js +0 -62
- package/dist/path-utils.js +0 -72
- package/dist/require-utils.js +0 -49
- package/dist/update-notif.js +0 -47
- package/dist/utils/string-utils.js +0 -68
- package/dist/watcher.js +0 -68
- package/templates/echo-bot/.botpress/project.cache.json +0 -1
package/dist/app/errors.js
DELETED
|
@@ -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
|
-
});
|
package/dist/app/file-paths.js
DELETED
|
@@ -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
|
-
});
|
|
@@ -1,76 +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 action_exports = {};
|
|
26
|
-
__export(action_exports, {
|
|
27
|
-
ActionInputModule: () => ActionInputModule,
|
|
28
|
-
ActionModule: () => ActionModule,
|
|
29
|
-
ActionOutputModule: () => ActionOutputModule
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(action_exports);
|
|
32
|
-
var import_json_schema_to_typescript = require("json-schema-to-typescript");
|
|
33
|
-
var import_module = require("./module");
|
|
34
|
-
var strings = __toESM(require("./strings"));
|
|
35
|
-
class ActionInputModule extends import_module.Module {
|
|
36
|
-
static async create(input) {
|
|
37
|
-
const schema = input.schema ?? {};
|
|
38
|
-
const filename = "input.ts";
|
|
39
|
-
const def = {
|
|
40
|
-
path: filename,
|
|
41
|
-
exportName: "Input",
|
|
42
|
-
content: await (0, import_json_schema_to_typescript.compile)(schema, filename)
|
|
43
|
-
};
|
|
44
|
-
return new ActionInputModule(def);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
class ActionOutputModule extends import_module.Module {
|
|
48
|
-
static async create(output) {
|
|
49
|
-
const schema = output.schema ?? {};
|
|
50
|
-
const filename = "output.ts";
|
|
51
|
-
const def = {
|
|
52
|
-
path: filename,
|
|
53
|
-
exportName: "Output",
|
|
54
|
-
content: await (0, import_json_schema_to_typescript.compile)(schema, filename)
|
|
55
|
-
};
|
|
56
|
-
return new ActionOutputModule(def);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
class ActionModule extends import_module.ReExportModule {
|
|
60
|
-
static async create(actionName, action) {
|
|
61
|
-
const inputModule = await ActionInputModule.create(action.input ?? {});
|
|
62
|
-
const outputModule = await ActionOutputModule.create(action.output ?? {});
|
|
63
|
-
const inst = new ActionModule({
|
|
64
|
-
exportName: `Action${strings.pascalCase(actionName)}`
|
|
65
|
-
});
|
|
66
|
-
inst.pushDep(inputModule);
|
|
67
|
-
inst.pushDep(outputModule);
|
|
68
|
-
return inst;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
72
|
-
0 && (module.exports = {
|
|
73
|
-
ActionInputModule,
|
|
74
|
-
ActionModule,
|
|
75
|
-
ActionOutputModule
|
|
76
|
-
});
|
|
@@ -1,51 +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 channel_exports = {};
|
|
26
|
-
__export(channel_exports, {
|
|
27
|
-
ChannelModule: () => ChannelModule
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(channel_exports);
|
|
30
|
-
var import_bluebird = __toESM(require("bluebird"));
|
|
31
|
-
var import_message = require("./message");
|
|
32
|
-
var import_module = require("./module");
|
|
33
|
-
var strings = __toESM(require("./strings"));
|
|
34
|
-
class ChannelModule extends import_module.ReExportModule {
|
|
35
|
-
static async create(channelName, channel) {
|
|
36
|
-
const messages = channel.messages ?? {};
|
|
37
|
-
const messageModules = await import_bluebird.default.map(
|
|
38
|
-
Object.entries(messages),
|
|
39
|
-
([messageName, message]) => import_message.MessageModule.create(messageName, message)
|
|
40
|
-
);
|
|
41
|
-
const inst = new ChannelModule({
|
|
42
|
-
exportName: `Channel${strings.pascalCase(channelName)}`
|
|
43
|
-
});
|
|
44
|
-
inst.pushDep(...messageModules);
|
|
45
|
-
return inst;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
-
0 && (module.exports = {
|
|
50
|
-
ChannelModule
|
|
51
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var configuration_exports = {};
|
|
20
|
-
__export(configuration_exports, {
|
|
21
|
-
ConfigurationModule: () => ConfigurationModule
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(configuration_exports);
|
|
24
|
-
var import_json_schema_to_typescript = require("json-schema-to-typescript");
|
|
25
|
-
var import_module = require("./module");
|
|
26
|
-
class ConfigurationModule extends import_module.Module {
|
|
27
|
-
static async create(configuration) {
|
|
28
|
-
const schema = configuration.schema ?? {};
|
|
29
|
-
const filename = "configuration";
|
|
30
|
-
return new ConfigurationModule({
|
|
31
|
-
path: `${filename}.ts`,
|
|
32
|
-
exportName: "Configuration",
|
|
33
|
-
content: await (0, import_json_schema_to_typescript.compile)(schema, filename)
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
-
0 && (module.exports = {
|
|
39
|
-
ConfigurationModule
|
|
40
|
-
});
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var const_exports = {};
|
|
20
|
-
__export(const_exports, {
|
|
21
|
-
GENERATED_HEADER: () => GENERATED_HEADER,
|
|
22
|
-
INDEX_FILE: () => INDEX_FILE
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(const_exports);
|
|
25
|
-
const GENERATED_HEADER = "/* tslint:disable */\n// This file is generated\n// Do not edit this file\n\n";
|
|
26
|
-
const INDEX_FILE = "index.ts";
|
|
27
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
-
0 && (module.exports = {
|
|
29
|
-
GENERATED_HEADER,
|
|
30
|
-
INDEX_FILE
|
|
31
|
-
});
|
|
@@ -1,47 +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 event_exports = {};
|
|
26
|
-
__export(event_exports, {
|
|
27
|
-
EventModule: () => EventModule
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(event_exports);
|
|
30
|
-
var import_json_schema_to_typescript = require("json-schema-to-typescript");
|
|
31
|
-
var import_module = require("./module");
|
|
32
|
-
var strings = __toESM(require("./strings"));
|
|
33
|
-
class EventModule extends import_module.Module {
|
|
34
|
-
static async create(name, event) {
|
|
35
|
-
const schema = event.schema ?? {};
|
|
36
|
-
const def = {
|
|
37
|
-
path: `${name}.ts`,
|
|
38
|
-
exportName: strings.pascalCase(name),
|
|
39
|
-
content: await (0, import_json_schema_to_typescript.compile)(schema, name)
|
|
40
|
-
};
|
|
41
|
-
return new EventModule(def);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
-
0 && (module.exports = {
|
|
46
|
-
EventModule
|
|
47
|
-
});
|
|
@@ -1,83 +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 generator_exports = {};
|
|
26
|
-
__export(generator_exports, {
|
|
27
|
-
File: () => import_typings.File,
|
|
28
|
-
INTEGRATION_JSON: () => INTEGRATION_JSON,
|
|
29
|
-
generateBotIndex: () => generateBotIndex,
|
|
30
|
-
generateIntegrationImplementationTypings: () => generateIntegrationImplementationTypings,
|
|
31
|
-
generateIntegrationIndex: () => generateIntegrationIndex,
|
|
32
|
-
generateIntegrationInstance: () => generateIntegrationInstance,
|
|
33
|
-
strings: () => strings2
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(generator_exports);
|
|
36
|
-
var import_path = __toESM(require("path"));
|
|
37
|
-
var import_const = require("./const");
|
|
38
|
-
var import_integration_impl = require("./integration-impl");
|
|
39
|
-
var import_integration_instance = require("./integration-instance");
|
|
40
|
-
var strings = __toESM(require("./strings"));
|
|
41
|
-
var import_typings = require("./typings");
|
|
42
|
-
var strings2 = __toESM(require("./strings"));
|
|
43
|
-
const INTEGRATION_JSON = "integration.json";
|
|
44
|
-
const generateIntegrationImplementationTypings = async (integration, implementationTypingsPath) => {
|
|
45
|
-
const indexModule = await import_integration_impl.IntegrationImplementationIndexModule.create(integration);
|
|
46
|
-
indexModule.unshift(implementationTypingsPath);
|
|
47
|
-
return indexModule.flatten();
|
|
48
|
-
};
|
|
49
|
-
const generateIntegrationIndex = async (implementationTypingsPath) => ({
|
|
50
|
-
path: import_const.INDEX_FILE,
|
|
51
|
-
content: `export * from './${implementationTypingsPath}'`
|
|
52
|
-
});
|
|
53
|
-
const generateIntegrationInstance = async (integration, installPath) => {
|
|
54
|
-
const indexModule = await import_integration_instance.IntegrationInstanceIndexModule.create(integration);
|
|
55
|
-
const dirname = strings.kebabCase(integration.name);
|
|
56
|
-
indexModule.unshift(installPath, dirname);
|
|
57
|
-
const files = indexModule.flatten();
|
|
58
|
-
const { name, version, id } = integration;
|
|
59
|
-
const json = {
|
|
60
|
-
name,
|
|
61
|
-
version,
|
|
62
|
-
id
|
|
63
|
-
};
|
|
64
|
-
files.push({
|
|
65
|
-
path: import_path.default.join(installPath, dirname, INTEGRATION_JSON),
|
|
66
|
-
content: JSON.stringify(json, null, 2)
|
|
67
|
-
});
|
|
68
|
-
return files;
|
|
69
|
-
};
|
|
70
|
-
const generateBotIndex = async (installPath, instances) => ({
|
|
71
|
-
path: import_const.INDEX_FILE,
|
|
72
|
-
content: instances.map((instance) => `export * from './${installPath}/${instance}'`).join("\n")
|
|
73
|
-
});
|
|
74
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
75
|
-
0 && (module.exports = {
|
|
76
|
-
File,
|
|
77
|
-
INTEGRATION_JSON,
|
|
78
|
-
generateBotIndex,
|
|
79
|
-
generateIntegrationImplementationTypings,
|
|
80
|
-
generateIntegrationIndex,
|
|
81
|
-
generateIntegrationInstance,
|
|
82
|
-
strings
|
|
83
|
-
});
|