@botonic/nx-plugin 2.31.0 → 2.31.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/index.js +44 -0
- package/{src/executors/build-node-app/executor.js → libs/botonic/nx-plugin/src/executors/build-node-app/executor-impl.js} +3 -3
- package/libs/botonic/nx-plugin/src/executors/build-node-app/executor.js +27 -0
- package/{src/executors/delete-bot/executor.js → libs/botonic/nx-plugin/src/executors/delete-bot/executor-impl.js} +3 -3
- package/libs/botonic/nx-plugin/src/executors/delete-bot/executor.js +27 -0
- package/{src/executors/deploy-netlify-snapshot/executor.js → libs/botonic/nx-plugin/src/executors/deploy-netlify-snapshot/executor-impl.js} +3 -3
- package/libs/botonic/nx-plugin/src/executors/deploy-netlify-snapshot/executor.js +27 -0
- package/{src/executors/deploy-to-hubtype/executor.js → libs/botonic/nx-plugin/src/executors/deploy-to-hubtype/executor-impl.js} +3 -3
- package/libs/botonic/nx-plugin/src/executors/deploy-to-hubtype/executor.js +27 -0
- package/{src/executors/e2e-webchat/executor.js → libs/botonic/nx-plugin/src/executors/e2e-webchat/executor-impl.js} +5 -5
- package/libs/botonic/nx-plugin/src/executors/e2e-webchat/executor.js +27 -0
- package/{src/executors/integrate-provider/executor.js → libs/botonic/nx-plugin/src/executors/integrate-provider/executor-impl.js} +3 -3
- package/libs/botonic/nx-plugin/src/executors/integrate-provider/executor.js +27 -0
- package/{src/executors/login-to-hubtype/executor.js → libs/botonic/nx-plugin/src/executors/login-to-hubtype/executor-impl.js} +3 -3
- package/libs/botonic/nx-plugin/src/executors/login-to-hubtype/executor.js +27 -0
- package/{src/executors/logout-from-hubtype/executor.js → libs/botonic/nx-plugin/src/executors/logout-from-hubtype/executor-impl.js} +3 -3
- package/libs/botonic/nx-plugin/src/executors/logout-from-hubtype/executor.js +27 -0
- package/{src/executors/run-lambda/executor.js → libs/botonic/nx-plugin/src/executors/run-lambda/executor-impl.js} +3 -3
- package/libs/botonic/nx-plugin/src/executors/run-lambda/executor.js +27 -0
- package/{src/executors/serve-bot/executor.js → libs/botonic/nx-plugin/src/executors/serve-bot/executor-impl.js} +3 -3
- package/libs/botonic/nx-plugin/src/executors/serve-bot/executor.js +27 -0
- package/{src/generators/action/generator.js → libs/botonic/nx-plugin/src/generators/action/generator-impl.js} +5 -5
- package/libs/botonic/nx-plugin/src/generators/action/generator.js +27 -0
- package/{src/generators/bot-app/generator.js → libs/botonic/nx-plugin/src/generators/bot-app/generator-impl.js} +6 -5
- package/libs/botonic/nx-plugin/src/generators/bot-app/generator.js +34 -0
- package/{src/generators/custom-message/generator.js → libs/botonic/nx-plugin/src/generators/custom-message/generator-impl.js} +5 -5
- package/libs/botonic/nx-plugin/src/generators/custom-message/generator.js +27 -0
- package/{src/generators/preset/generator.js → libs/botonic/nx-plugin/src/generators/preset/generator-impl.js} +5 -5
- package/libs/botonic/nx-plugin/src/generators/preset/generator.js +34 -0
- package/{src/generators/remove-custom-message/generator.js → libs/botonic/nx-plugin/src/generators/remove-custom-message/generator-impl.js} +5 -5
- package/libs/botonic/nx-plugin/src/generators/remove-custom-message/generator.js +27 -0
- package/{src/generators/webview/generator.js → libs/botonic/nx-plugin/src/generators/webview/generator-impl.js} +5 -5
- package/libs/botonic/nx-plugin/src/generators/webview/generator.js +27 -0
- package/{src → libs/botonic/nx-plugin/src}/index.js +3 -1
- package/libs/botonic/nx-plugin/src/lib/delegate/delegate-executor.js +119 -0
- package/libs/botonic/nx-plugin/src/lib/delegate/delegate-generator.js +128 -0
- package/libs/botonic/nx-plugin/src/lib/serve-mode/index.js +183 -0
- package/migrations.json +1 -8
- package/package.json +7 -4
- package/src/executors/build-node-app/executor-impl.d.ts +5 -0
- package/src/executors/build-node-app/executor.d.ts +4 -2
- package/src/executors/delete-bot/executor-impl.d.ts +5 -0
- package/src/executors/delete-bot/executor.d.ts +4 -2
- package/src/executors/deploy-netlify-snapshot/executor-impl.d.ts +8 -0
- package/src/executors/deploy-netlify-snapshot/executor.d.ts +4 -5
- package/src/executors/deploy-to-hubtype/executor-impl.d.ts +5 -0
- package/src/executors/deploy-to-hubtype/executor.d.ts +4 -2
- package/src/executors/e2e-webchat/executor-impl.d.ts +5 -0
- package/src/executors/e2e-webchat/executor.d.ts +4 -2
- package/src/executors/integrate-provider/executor-impl.d.ts +5 -0
- package/src/executors/integrate-provider/executor.d.ts +4 -2
- package/src/executors/login-to-hubtype/executor-impl.d.ts +5 -0
- package/src/executors/login-to-hubtype/executor.d.ts +4 -2
- package/src/executors/logout-from-hubtype/executor-impl.d.ts +3 -0
- package/src/executors/logout-from-hubtype/executor.d.ts +5 -1
- package/src/executors/run-lambda/executor-impl.d.ts +5 -0
- package/src/executors/run-lambda/executor.d.ts +4 -2
- package/src/executors/serve-bot/executor-impl.d.ts +5 -0
- package/src/executors/serve-bot/executor.d.ts +4 -2
- package/src/generators/action/generator-impl.d.ts +4 -0
- package/src/generators/action/generator.d.ts +2 -3
- package/src/generators/bot-app/files/vite/webchat.config.ts.template +10 -2
- package/src/generators/bot-app/generator-impl.d.ts +4 -0
- package/src/generators/bot-app/generator.d.ts +2 -4
- package/src/generators/custom-message/generator-impl.d.ts +4 -0
- package/src/generators/custom-message/generator.d.ts +2 -3
- package/src/generators/preset/generator-impl.d.ts +4 -0
- package/src/generators/preset/generator.d.ts +2 -4
- package/src/generators/remove-custom-message/generator-impl.d.ts +4 -0
- package/src/generators/remove-custom-message/generator.d.ts +2 -3
- package/src/generators/webview/generator-impl.d.ts +4 -0
- package/src/generators/webview/generator.d.ts +2 -3
- package/src/index.d.ts +1 -0
- package/src/lib/delegate/delegate-executor.d.ts +6 -0
- package/src/lib/delegate/delegate-generator.d.ts +2 -0
- package/src/lib/serve-mode/index.d.ts +25 -0
- package/src/generators/bot-app/files/vite/plugins/dev-log-viewer-html.plugin.ts.template +0 -65
- package/src/migrations/install-claude-update-skills/install-claude-update-skills.migration.d.ts +0 -2
- package/src/migrations/install-claude-update-skills/install-claude-update-skills.migration.js +0 -290
- /package/{src → libs/botonic/nx-plugin/src}/executors/build-node-app/schema.d.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/executors/delete-bot/schema.d.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/executors/deploy-netlify-snapshot/schema.d.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/executors/deploy-to-hubtype/schema.d.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/executors/e2e-webchat/schema.d.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/executors/integrate-provider/schema.d.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/executors/login-to-hubtype/schema.d.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/executors/logout-from-hubtype/schema.d.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/executors/run-lambda/schema.d.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/executors/serve-bot/schema.d.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/generators/action/schema.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/generators/bot-app/schema.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/generators/custom-message/schema.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/generators/preset/schema.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/generators/remove-custom-message/schema.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/generators/shared/bot-app-utils.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/generators/webview/schema.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/lib/api-service.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/lib/bot-config.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/lib/cloudflared-tunnel.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/lib/constants.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/lib/credentials-handler.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/lib/index.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/lib/interfaces.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/lib/util/executor-helpers.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/lib/util/file-system.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/lib/util/sam-container-cleanup.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/lib/util/sam-template.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/lib/util/system.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/migrations/utils/migration-utils.js +0 -0
- /package/{src → libs/botonic/nx-plugin/src}/plugin.js +0 -0
|
@@ -0,0 +1,183 @@
|
|
|
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 serve_mode_exports = {};
|
|
20
|
+
__export(serve_mode_exports, {
|
|
21
|
+
createDevPanelsPlugin: () => createDevPanelsPlugin,
|
|
22
|
+
createLogViewerPlugin: () => createLogViewerPlugin,
|
|
23
|
+
createWebchatPanelPlugin: () => createWebchatPanelPlugin,
|
|
24
|
+
createWhatsappPanelPlugin: () => createWhatsappPanelPlugin
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(serve_mode_exports);
|
|
27
|
+
var import_child_process = require("child_process");
|
|
28
|
+
var import_fs = require("fs");
|
|
29
|
+
var import_path = require("path");
|
|
30
|
+
function resolveServeModePaths() {
|
|
31
|
+
const root = (0, import_path.resolve)(__dirname, "../../../serve-mode");
|
|
32
|
+
if ((0, import_fs.existsSync)((0, import_path.join)(root, "vite.config.ts"))) {
|
|
33
|
+
return { root, bundle: (0, import_path.join)(root, "dist/serve-mode.js"), canBuild: true };
|
|
34
|
+
}
|
|
35
|
+
const bundle = (0, import_path.join)(root, "serve-mode.js");
|
|
36
|
+
return { root: (0, import_path.dirname)(bundle), bundle, canBuild: false };
|
|
37
|
+
}
|
|
38
|
+
const PATHS = resolveServeModePaths();
|
|
39
|
+
const BUNDLE_ROUTE = "/__serve-mode/bundle.js";
|
|
40
|
+
const BUNDLE_SCRIPT_MARKER = "data-botonic-serve-mode";
|
|
41
|
+
const FACTORY_PATH = __filename;
|
|
42
|
+
async function ensureBundleBuilt() {
|
|
43
|
+
if (!PATHS.canBuild) return;
|
|
44
|
+
if ((0, import_fs.existsSync)(PATHS.bundle)) {
|
|
45
|
+
const bundleMtime = (0, import_fs.statSync)(PATHS.bundle).mtimeMs;
|
|
46
|
+
const viteConfigPath = (0, import_path.join)(PATHS.root, "vite.config.ts");
|
|
47
|
+
const configMtime = (0, import_fs.existsSync)(viteConfigPath) ? (0, import_fs.statSync)(viteConfigPath).mtimeMs : 0;
|
|
48
|
+
const factoryMtime = (0, import_fs.existsSync)(FACTORY_PATH) ? (0, import_fs.statSync)(FACTORY_PATH).mtimeMs : 0;
|
|
49
|
+
const srcDir = (0, import_path.join)(PATHS.root, "src");
|
|
50
|
+
if (configMtime <= bundleMtime && factoryMtime <= bundleMtime && !isSrcNewerThan(srcDir, bundleMtime))
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
(0, import_child_process.execSync)(
|
|
55
|
+
`node_modules/.bin/vite build --config ${PATHS.root}/vite.config.ts --mode production`,
|
|
56
|
+
{
|
|
57
|
+
cwd: process.cwd(),
|
|
58
|
+
stdio: "inherit",
|
|
59
|
+
env: { ...process.env, NODE_ENV: "production" }
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
} catch (e) {
|
|
63
|
+
console.warn(
|
|
64
|
+
"[botonic-serve-mode] Failed to build panel bundle \u2014 panels will not be injected.",
|
|
65
|
+
e
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function isSrcNewerThan(dir, bundleMtime) {
|
|
70
|
+
try {
|
|
71
|
+
const { readdirSync } = require("fs");
|
|
72
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
73
|
+
const full = (0, import_path.resolve)(dir, entry.name);
|
|
74
|
+
if (entry.isDirectory()) {
|
|
75
|
+
if (isSrcNewerThan(full, bundleMtime)) return true;
|
|
76
|
+
} else if ((0, import_fs.statSync)(full).mtimeMs > bundleMtime) {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
} catch {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
function registerBundleMiddleware(server) {
|
|
86
|
+
const stack = server.middlewares.stack;
|
|
87
|
+
const already = stack.some(
|
|
88
|
+
(layer) => typeof layer.route === "string" && layer.route === BUNDLE_ROUTE
|
|
89
|
+
);
|
|
90
|
+
if (already) return;
|
|
91
|
+
server.middlewares.use(BUNDLE_ROUTE, (_req, res) => {
|
|
92
|
+
if (!(0, import_fs.existsSync)(PATHS.bundle)) {
|
|
93
|
+
res.statusCode = 404;
|
|
94
|
+
res.end("Dev panels bundle not found");
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
res.setHeader("Content-Type", "application/javascript");
|
|
98
|
+
res.setHeader("Cache-Control", "no-cache");
|
|
99
|
+
res.end((0, import_fs.readFileSync)(PATHS.bundle));
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function injectConfigScript(html, configJson) {
|
|
103
|
+
const configScript = `<script>window.__BOTONIC_DEV__=Object.assign(window.__BOTONIC_DEV__||{},${configJson});</script>`;
|
|
104
|
+
return html.replace("</body>", `${configScript}</body>`);
|
|
105
|
+
}
|
|
106
|
+
function injectBundleScript(html) {
|
|
107
|
+
if (html.includes(BUNDLE_SCRIPT_MARKER)) return html;
|
|
108
|
+
const bundleScript = `<script ${BUNDLE_SCRIPT_MARKER} defer src="${BUNDLE_ROUTE}"></script>`;
|
|
109
|
+
return html.replace("</body>", `${bundleScript}</body>`);
|
|
110
|
+
}
|
|
111
|
+
function credentialsFromEnv(overrides = {}) {
|
|
112
|
+
return {
|
|
113
|
+
botId: overrides.botId ?? process.env.VITE_DEV_BOT_ID ?? "",
|
|
114
|
+
apiUrl: overrides.apiUrl ?? process.env.VITE_DEV_API_URL ?? "https://api.hubtype.com",
|
|
115
|
+
tunnelUrl: overrides.tunnelUrl ?? process.env.VITE_DEV_SESSION_URL ?? "",
|
|
116
|
+
lambdaFn: overrides.lambdaFn ?? process.env.VITE_DEV_LAMBDA_FUNCTION_NAME ?? "BotonicV2LocalLambda",
|
|
117
|
+
accessToken: overrides.accessToken ?? process.env.VITE_DEV_ACCESS_TOKEN ?? "",
|
|
118
|
+
refreshToken: overrides.refreshToken ?? process.env.VITE_DEV_REFRESH_TOKEN ?? "",
|
|
119
|
+
clientId: overrides.clientId ?? process.env.VITE_DEV_CLIENT_ID ?? ""
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function createWhatsappPanelPlugin(opts = {}) {
|
|
123
|
+
return {
|
|
124
|
+
name: "botonic-serve-mode-whatsapp",
|
|
125
|
+
apply: "serve",
|
|
126
|
+
async configureServer(server) {
|
|
127
|
+
await ensureBundleBuilt();
|
|
128
|
+
registerBundleMiddleware(server);
|
|
129
|
+
},
|
|
130
|
+
transformIndexHtml(html) {
|
|
131
|
+
if (!process.env["BOT_HAS_WHATSAPP"]) return html;
|
|
132
|
+
const config = JSON.stringify({
|
|
133
|
+
whatsapp: {
|
|
134
|
+
...credentialsFromEnv(opts),
|
|
135
|
+
registeredPhone: opts.registeredPhone ?? ""
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
return injectBundleScript(injectConfigScript(html, config));
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function createWebchatPanelPlugin(opts = {}) {
|
|
143
|
+
return {
|
|
144
|
+
name: "botonic-serve-mode-webchat",
|
|
145
|
+
apply: "serve",
|
|
146
|
+
async configureServer(server) {
|
|
147
|
+
await ensureBundleBuilt();
|
|
148
|
+
registerBundleMiddleware(server);
|
|
149
|
+
},
|
|
150
|
+
transformIndexHtml(html) {
|
|
151
|
+
const config = JSON.stringify({ webchat: credentialsFromEnv(opts) });
|
|
152
|
+
return injectBundleScript(injectConfigScript(html, config));
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function createLogViewerPlugin() {
|
|
157
|
+
return {
|
|
158
|
+
name: "botonic-serve-mode-log-viewer",
|
|
159
|
+
apply: "serve",
|
|
160
|
+
async configureServer(server) {
|
|
161
|
+
await ensureBundleBuilt();
|
|
162
|
+
registerBundleMiddleware(server);
|
|
163
|
+
},
|
|
164
|
+
transformIndexHtml(html) {
|
|
165
|
+
const config = JSON.stringify({ logViewer: true });
|
|
166
|
+
return injectBundleScript(injectConfigScript(html, config));
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
function createDevPanelsPlugin(opts) {
|
|
171
|
+
const plugins = [];
|
|
172
|
+
if (opts.panels.includes("whatsapp"))
|
|
173
|
+
plugins.push(createWhatsappPanelPlugin(opts));
|
|
174
|
+
if (opts.panels.includes("webchat")) plugins.push(createWebchatPanelPlugin());
|
|
175
|
+
return plugins;
|
|
176
|
+
}
|
|
177
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
178
|
+
0 && (module.exports = {
|
|
179
|
+
createDevPanelsPlugin,
|
|
180
|
+
createLogViewerPlugin,
|
|
181
|
+
createWebchatPanelPlugin,
|
|
182
|
+
createWhatsappPanelPlugin
|
|
183
|
+
});
|
package/migrations.json
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generators": {
|
|
3
|
-
"install-claude-update-skills": {
|
|
4
|
-
"version": "2.29.0",
|
|
5
|
-
"description": "Replace .cursor/.claude command stubs with .claude/skills/botonic-update and .claude/skills/botonic-bot-update",
|
|
6
|
-
"cli": "nx",
|
|
7
|
-
"implementation": "./src/migrations/install-claude-update-skills/install-claude-update-skills.migration"
|
|
8
|
-
}
|
|
9
|
-
}
|
|
2
|
+
"generators": {}
|
|
10
3
|
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botonic/nx-plugin",
|
|
3
|
-
"version": "2.31.0",
|
|
3
|
+
"version": "2.31.1-alpha.0",
|
|
4
4
|
"description": "Nx plugin for creating Botonic bot applications",
|
|
5
|
-
"main": "./
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
9
|
"types": "./src/index.d.ts",
|
|
10
|
-
"require": "./
|
|
10
|
+
"require": "./dist/index.js",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
11
13
|
},
|
|
12
14
|
"./generators.json": "./generators.json",
|
|
13
15
|
"./executors.json": "./executors.json",
|
|
14
16
|
"./migrations.json": "./migrations.json",
|
|
15
|
-
"./package.json": "./package.json"
|
|
17
|
+
"./package.json": "./package.json",
|
|
18
|
+
"./serve-mode/serve-mode.js": "./serve-mode/serve-mode.js"
|
|
16
19
|
},
|
|
17
20
|
"generators": "./generators.json",
|
|
18
21
|
"executors": "./executors.json",
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ExecutorContext } from '@nx/devkit';
|
|
2
2
|
import type { BuildNodeAppExecutorSchema } from './schema';
|
|
3
|
-
export default function buildNodeAppExecutor(options: BuildNodeAppExecutorSchema,
|
|
3
|
+
export default function buildNodeAppExecutor(options: BuildNodeAppExecutorSchema, ctx: ExecutorContext): Promise<{
|
|
4
4
|
success: boolean;
|
|
5
|
-
}
|
|
5
|
+
} | AsyncIterableIterator<{
|
|
6
|
+
success: boolean;
|
|
7
|
+
}>>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ExecutorContext } from '@nx/devkit';
|
|
2
2
|
import type { DeleteBotExecutorSchema } from './schema';
|
|
3
|
-
export default function deleteBotExecutor(options: DeleteBotExecutorSchema,
|
|
3
|
+
export default function deleteBotExecutor(options: DeleteBotExecutorSchema, ctx: ExecutorContext): Promise<{
|
|
4
4
|
success: boolean;
|
|
5
|
-
}
|
|
5
|
+
} | AsyncIterableIterator<{
|
|
6
|
+
success: boolean;
|
|
7
|
+
}>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import type { DeployNetlifySnapshotExecutorSchema } from './schema';
|
|
3
|
+
export interface DeployNetlifySnapshotResult {
|
|
4
|
+
success: boolean;
|
|
5
|
+
deployUrl?: string;
|
|
6
|
+
claimUrl?: string;
|
|
7
|
+
}
|
|
8
|
+
export default function deployNetlifySnapshotExecutor(options: DeployNetlifySnapshotExecutorSchema, context: ExecutorContext): Promise<DeployNetlifySnapshotResult>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { ExecutorContext } from '@nx/devkit';
|
|
2
2
|
import type { DeployNetlifySnapshotExecutorSchema } from './schema';
|
|
3
|
-
export
|
|
3
|
+
export default function deployNetlifySnapshotExecutor(options: DeployNetlifySnapshotExecutorSchema, ctx: ExecutorContext): Promise<{
|
|
4
4
|
success: boolean;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
export default function deployNetlifySnapshotExecutor(options: DeployNetlifySnapshotExecutorSchema, context: ExecutorContext): Promise<DeployNetlifySnapshotResult>;
|
|
5
|
+
} | AsyncIterableIterator<{
|
|
6
|
+
success: boolean;
|
|
7
|
+
}>>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ExecutorContext } from '@nx/devkit';
|
|
2
2
|
import type { DeployToHubtypeExecutorSchema } from './schema';
|
|
3
|
-
export default function deployToHubtypeExecutor(options: DeployToHubtypeExecutorSchema,
|
|
3
|
+
export default function deployToHubtypeExecutor(options: DeployToHubtypeExecutorSchema, ctx: ExecutorContext): Promise<{
|
|
4
4
|
success: boolean;
|
|
5
|
-
}
|
|
5
|
+
} | AsyncIterableIterator<{
|
|
6
|
+
success: boolean;
|
|
7
|
+
}>>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ExecutorContext } from '@nx/devkit';
|
|
2
2
|
import type { E2EExecutorSchema } from './schema';
|
|
3
|
-
export default function
|
|
3
|
+
export default function e2eWebchatExecutor(options: E2EExecutorSchema, ctx: ExecutorContext): Promise<{
|
|
4
4
|
success: boolean;
|
|
5
|
-
}
|
|
5
|
+
} | AsyncIterableIterator<{
|
|
6
|
+
success: boolean;
|
|
7
|
+
}>>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import type { IntegrateProviderExecutorSchema } from './schema';
|
|
3
|
+
export default function integrateProviderExecutor(options: IntegrateProviderExecutorSchema, context: ExecutorContext): Promise<{
|
|
4
|
+
success: boolean;
|
|
5
|
+
}>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ExecutorContext } from '@nx/devkit';
|
|
2
2
|
import type { IntegrateProviderExecutorSchema } from './schema';
|
|
3
|
-
export default function integrateProviderExecutor(options: IntegrateProviderExecutorSchema,
|
|
3
|
+
export default function integrateProviderExecutor(options: IntegrateProviderExecutorSchema, ctx: ExecutorContext): Promise<{
|
|
4
4
|
success: boolean;
|
|
5
|
-
}
|
|
5
|
+
} | AsyncIterableIterator<{
|
|
6
|
+
success: boolean;
|
|
7
|
+
}>>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ExecutorContext } from '@nx/devkit';
|
|
2
2
|
import type { LoginToHubtypeExecutorSchema } from './schema';
|
|
3
|
-
export default function loginToHubtypeExecutor(options: LoginToHubtypeExecutorSchema,
|
|
3
|
+
export default function loginToHubtypeExecutor(options: LoginToHubtypeExecutorSchema, ctx: ExecutorContext): Promise<{
|
|
4
4
|
success: boolean;
|
|
5
|
-
}
|
|
5
|
+
} | AsyncIterableIterator<{
|
|
6
|
+
success: boolean;
|
|
7
|
+
}>>;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import type { ExecutorContext } from '@nx/devkit';
|
|
2
2
|
import type { LogoutFromHubtypeExecutorSchema } from './schema';
|
|
3
|
-
export default function logoutFromHubtypeExecutor(options: LogoutFromHubtypeExecutorSchema,
|
|
3
|
+
export default function logoutFromHubtypeExecutor(options: LogoutFromHubtypeExecutorSchema, ctx: ExecutorContext): Promise<{
|
|
4
|
+
success: boolean;
|
|
5
|
+
} | AsyncIterableIterator<{
|
|
6
|
+
success: boolean;
|
|
7
|
+
}>>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ExecutorContext } from '@nx/devkit';
|
|
2
2
|
import type { RunLambdaExecutorSchema } from './schema';
|
|
3
|
-
export default function runLambdaExecutor(options: RunLambdaExecutorSchema,
|
|
3
|
+
export default function runLambdaExecutor(options: RunLambdaExecutorSchema, ctx: ExecutorContext): Promise<{
|
|
4
4
|
success: boolean;
|
|
5
|
-
}
|
|
5
|
+
} | AsyncIterableIterator<{
|
|
6
|
+
success: boolean;
|
|
7
|
+
}>>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ExecutorContext } from '@nx/devkit';
|
|
2
2
|
import type { ServeBotExecutorSchema } from './schema';
|
|
3
|
-
export default function serveBotExecutor(options: ServeBotExecutorSchema,
|
|
3
|
+
export default function serveBotExecutor(options: ServeBotExecutorSchema, ctx: ExecutorContext): Promise<{
|
|
4
4
|
success: boolean;
|
|
5
|
-
}
|
|
5
|
+
} | AsyncIterableIterator<{
|
|
6
|
+
success: boolean;
|
|
7
|
+
}>>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Tree } from '@nx/devkit';
|
|
1
|
+
import type { Tree } from '@nx/devkit';
|
|
2
2
|
import type { ActionGeneratorSchema } from './schema';
|
|
3
|
-
export default function (tree: Tree, options: ActionGeneratorSchema): Promise<void>;
|
|
4
|
-
export { ActionGeneratorSchema };
|
|
3
|
+
export default function (tree: Tree, options: ActionGeneratorSchema): Promise<void | import("@nx/devkit").GeneratorCallback>;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { resolve } from 'path'
|
|
2
2
|
import type { UserConfig } from 'vite'
|
|
3
|
+
import {
|
|
4
|
+
createLogViewerPlugin,
|
|
5
|
+
createWebchatPanelPlugin,
|
|
6
|
+
createWhatsappPanelPlugin,
|
|
7
|
+
} from '@botonic/nx-plugin'
|
|
3
8
|
|
|
4
9
|
import { BUILD_CONFIG } from './build.config'
|
|
5
|
-
import { devLogViewerIndexHtmlPlugin } from './plugins/dev-log-viewer-html.plugin'
|
|
6
10
|
import { moveHtmlToRootPlugin } from './plugins/move-html.plugin'
|
|
7
11
|
|
|
8
12
|
const projectRoot = resolve(__dirname, '..')
|
|
@@ -83,7 +87,11 @@ export function getWebchatConfig(command: 'serve' | 'build'): UserConfig {
|
|
|
83
87
|
},
|
|
84
88
|
|
|
85
89
|
plugins: [
|
|
86
|
-
|
|
90
|
+
createLogViewerPlugin(),
|
|
91
|
+
createWhatsappPanelPlugin({
|
|
92
|
+
registeredPhone: process.env.WHATSAPP_PANEL_PHONE,
|
|
93
|
+
}),
|
|
94
|
+
createWebchatPanelPlugin(),
|
|
87
95
|
moveHtmlToRootPlugin(projectRoot, BUILD_CONFIG.TARGET_APPS.WEBCHAT),
|
|
88
96
|
],
|
|
89
97
|
}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export default function (tree: Tree, options: BotAppGeneratorSchema): Promise<GeneratorCallback>;
|
|
4
|
-
export { BotAppGeneratorSchema };
|
|
1
|
+
export { default } from './generator-impl';
|
|
2
|
+
export type { BotAppGeneratorSchema } from './schema';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Tree } from '@nx/devkit';
|
|
1
|
+
import type { Tree } from '@nx/devkit';
|
|
2
2
|
import type { CustomMessageGeneratorSchema } from './schema';
|
|
3
|
-
export default function (tree: Tree, options: CustomMessageGeneratorSchema): Promise<void>;
|
|
4
|
-
export { CustomMessageGeneratorSchema };
|
|
3
|
+
export default function (tree: Tree, options: CustomMessageGeneratorSchema): Promise<void | import("@nx/devkit").GeneratorCallback>;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export default function (tree: Tree, options: PresetGeneratorSchema): Promise<GeneratorCallback>;
|
|
4
|
-
export { PresetGeneratorSchema };
|
|
1
|
+
export { default } from './generator-impl';
|
|
2
|
+
export type { PresetGeneratorSchema } from './schema';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Tree } from '@nx/devkit';
|
|
1
|
+
import type { Tree } from '@nx/devkit';
|
|
2
2
|
import type { RemoveCustomMessageGeneratorSchema } from './schema';
|
|
3
|
-
export default function (tree: Tree, options: RemoveCustomMessageGeneratorSchema): Promise<void>;
|
|
4
|
-
export { RemoveCustomMessageGeneratorSchema };
|
|
3
|
+
export default function (tree: Tree, options: RemoveCustomMessageGeneratorSchema): Promise<void | import("@nx/devkit").GeneratorCallback>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Tree } from '@nx/devkit';
|
|
1
|
+
import type { Tree } from '@nx/devkit';
|
|
2
2
|
import type { WebviewGeneratorSchema } from './schema';
|
|
3
|
-
export default function (tree: Tree, options: WebviewGeneratorSchema): Promise<void>;
|
|
4
|
-
export { WebviewGeneratorSchema };
|
|
3
|
+
export default function (tree: Tree, options: WebviewGeneratorSchema): Promise<void | import("@nx/devkit").GeneratorCallback>;
|
package/src/index.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ export { default as buildNodeAppExecutor } from './executors/build-node-app/exec
|
|
|
4
4
|
export { default as runLambdaExecutor } from './executors/run-lambda/executor';
|
|
5
5
|
export { default as serveBotExecutor } from './executors/serve-bot/executor';
|
|
6
6
|
export * from './lib';
|
|
7
|
+
export * from './lib/serve-mode';
|
|
7
8
|
export { BotonicPlugin, createNodesV2 } from './plugin';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
export declare function runLocalExecutor<T = unknown>(wrapperFilename: string, executorName: string, options: T, ctx: ExecutorContext): Promise<{
|
|
3
|
+
success: boolean;
|
|
4
|
+
} | AsyncIterableIterator<{
|
|
5
|
+
success: boolean;
|
|
6
|
+
}>>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
export interface ChannelCredentials {
|
|
3
|
+
botId?: string;
|
|
4
|
+
apiUrl?: string;
|
|
5
|
+
tunnelUrl?: string;
|
|
6
|
+
lambdaFn?: string;
|
|
7
|
+
accessToken?: string;
|
|
8
|
+
refreshToken?: string;
|
|
9
|
+
clientId?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface WhatsappPanelOptions extends ChannelCredentials {
|
|
12
|
+
registeredPhone?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface DevPanelsOptions {
|
|
15
|
+
panels: Array<'whatsapp' | 'webchat'>;
|
|
16
|
+
registeredPhone?: string;
|
|
17
|
+
}
|
|
18
|
+
/** Injects the WhatsApp channel routing panel. Serve-only. */
|
|
19
|
+
export declare function createWhatsappPanelPlugin(opts?: WhatsappPanelOptions): Plugin;
|
|
20
|
+
/** Injects the Webchat channel routing panel. Serve-only. */
|
|
21
|
+
export declare function createWebchatPanelPlugin(opts?: ChannelCredentials): Plugin;
|
|
22
|
+
/** Injects the log-viewer split layout. Serve-only. No per-panel configuration needed. */
|
|
23
|
+
export declare function createLogViewerPlugin(): Plugin;
|
|
24
|
+
/** Convenience wrapper — creates all requested panel plugins in one call. */
|
|
25
|
+
export declare function createDevPanelsPlugin(opts: DevPanelsOptions): Plugin[];
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import type { Plugin } from 'vite'
|
|
2
|
-
|
|
3
|
-
/** Split layout + iframe for serve-bot log viewer (?logs= port). Serve-only — never applied on build. */
|
|
4
|
-
const LAYOUT_STYLE = `
|
|
5
|
-
.dev-layout {
|
|
6
|
-
display: flex;
|
|
7
|
-
height: 100vh;
|
|
8
|
-
margin: 0;
|
|
9
|
-
padding: 0;
|
|
10
|
-
}
|
|
11
|
-
.dev-layout .logs-panel {
|
|
12
|
-
flex: 1;
|
|
13
|
-
border: none;
|
|
14
|
-
border-right: 1px solid #ddd;
|
|
15
|
-
}
|
|
16
|
-
.dev-layout .webchat-panel {
|
|
17
|
-
flex: 1;
|
|
18
|
-
display: flex;
|
|
19
|
-
align-items: center;
|
|
20
|
-
justify-content: center;
|
|
21
|
-
background: #f5f5f5;
|
|
22
|
-
}
|
|
23
|
-
`.trim()
|
|
24
|
-
|
|
25
|
-
/** Runs before the inline boot script so #webchat-root exists when render runs. */
|
|
26
|
-
const LAYOUT_SCRIPT = `
|
|
27
|
-
document.addEventListener('DOMContentLoaded', function botonicDevLogViewerLayout() {
|
|
28
|
-
var urlParams = new URLSearchParams(window.location.search)
|
|
29
|
-
var logsPort = urlParams.get('logs')
|
|
30
|
-
if (!logsPort) return
|
|
31
|
-
document.body.innerHTML = ''
|
|
32
|
-
document.body.className = 'dev-layout'
|
|
33
|
-
var logsIframe = document.createElement('iframe')
|
|
34
|
-
logsIframe.className = 'logs-panel'
|
|
35
|
-
logsIframe.src = 'http://localhost:' + logsPort
|
|
36
|
-
var webchatPanel = document.createElement('div')
|
|
37
|
-
webchatPanel.className = 'webchat-panel'
|
|
38
|
-
webchatPanel.id = 'webchat-root'
|
|
39
|
-
document.body.appendChild(logsIframe)
|
|
40
|
-
document.body.appendChild(webchatPanel)
|
|
41
|
-
})
|
|
42
|
-
`.trim()
|
|
43
|
-
|
|
44
|
-
export function devLogViewerIndexHtmlPlugin(): Plugin {
|
|
45
|
-
return {
|
|
46
|
-
name: 'botonic-dev-log-viewer-index-html',
|
|
47
|
-
apply: 'serve',
|
|
48
|
-
transformIndexHtml(html) {
|
|
49
|
-
const marker = '<script type="text/javascript">'
|
|
50
|
-
const pos = html.indexOf(marker)
|
|
51
|
-
if (pos === -1) {
|
|
52
|
-
return html
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const styleTag = `<style data-botonic-dev-log-viewer>${LAYOUT_STYLE}</style>`
|
|
56
|
-
const scriptTag = `<script>${LAYOUT_SCRIPT}</script>`
|
|
57
|
-
const withStyle = html.replace('</head>', `${styleTag}</head>`)
|
|
58
|
-
const pos2 = withStyle.indexOf(marker)
|
|
59
|
-
if (pos2 === -1) {
|
|
60
|
-
return html
|
|
61
|
-
}
|
|
62
|
-
return `${withStyle.slice(0, pos2)}${scriptTag}${withStyle.slice(pos2)}`
|
|
63
|
-
},
|
|
64
|
-
}
|
|
65
|
-
}
|