@botonic/nx-plugin 2.23.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 +420 -0
- package/README.md +279 -0
- package/executors.json +55 -0
- package/generators.json +61 -0
- package/migrations.json +40 -0
- package/package.json +54 -0
- package/src/cursor-commands/update-bot.md +114 -0
- package/src/cursor-commands/update-botonic.md +63 -0
- package/src/executors/build-node-app/executor.d.ts +5 -0
- package/src/executors/build-node-app/executor.js +65 -0
- package/src/executors/build-node-app/schema.d.js +16 -0
- package/src/executors/build-node-app/schema.json +25 -0
- package/src/executors/delete-bot/executor.d.ts +5 -0
- package/src/executors/delete-bot/executor.js +112 -0
- package/src/executors/delete-bot/schema.d.js +16 -0
- package/src/executors/delete-bot/schema.json +35 -0
- package/src/executors/deploy-local-runtime/executor.d.ts +5 -0
- package/src/executors/deploy-local-runtime/executor.js +144 -0
- package/src/executors/deploy-local-runtime/schema.d.js +16 -0
- package/src/executors/deploy-local-runtime/schema.json +34 -0
- package/src/executors/deploy-netlify-snapshot/executor.d.ts +8 -0
- package/src/executors/deploy-netlify-snapshot/executor.js +79 -0
- package/src/executors/deploy-netlify-snapshot/schema.d.js +16 -0
- package/src/executors/deploy-netlify-snapshot/schema.json +31 -0
- package/src/executors/deploy-to-hubtype/executor.d.ts +5 -0
- package/src/executors/deploy-to-hubtype/executor.js +308 -0
- package/src/executors/deploy-to-hubtype/schema.d.js +16 -0
- package/src/executors/deploy-to-hubtype/schema.json +31 -0
- package/src/executors/e2e-webchat/botonic-package-publish.spec.ts +84 -0
- package/src/executors/e2e-webchat/executor.d.ts +5 -0
- package/src/executors/e2e-webchat/executor.js +134 -0
- package/src/executors/e2e-webchat/schema.d.js +16 -0
- package/src/executors/e2e-webchat/schema.json +35 -0
- package/src/executors/integrate-provider/executor.d.ts +5 -0
- package/src/executors/integrate-provider/executor.js +155 -0
- package/src/executors/integrate-provider/schema.d.js +16 -0
- package/src/executors/integrate-provider/schema.json +30 -0
- package/src/executors/login-to-hubtype/executor.d.ts +5 -0
- package/src/executors/login-to-hubtype/executor.js +79 -0
- package/src/executors/login-to-hubtype/schema.d.js +16 -0
- package/src/executors/login-to-hubtype/schema.json +25 -0
- package/src/executors/logout-from-hubtype/executor.d.ts +3 -0
- package/src/executors/logout-from-hubtype/executor.js +54 -0
- package/src/executors/logout-from-hubtype/schema.d.js +16 -0
- package/src/executors/logout-from-hubtype/schema.json +9 -0
- package/src/executors/run-lambda/executor.d.ts +5 -0
- package/src/executors/run-lambda/executor.js +65 -0
- package/src/executors/run-lambda/schema.d.js +16 -0
- package/src/executors/run-lambda/schema.json +20 -0
- package/src/executors/serve-bot/executor.d.ts +5 -0
- package/src/executors/serve-bot/executor.js +330 -0
- package/src/executors/serve-bot/schema.d.js +16 -0
- package/src/executors/serve-bot/schema.json +40 -0
- package/src/generators/action/files/__name__.spec.ts.template +15 -0
- package/src/generators/action/files/__name__.ts.template +15 -0
- package/src/generators/action/generator.d.ts +4 -0
- package/src/generators/action/generator.js +112 -0
- package/src/generators/action/schema.d.ts +7 -0
- package/src/generators/action/schema.js +16 -0
- package/src/generators/action/schema.json +43 -0
- package/src/generators/bot-app/files/.eslintrc.json.template +18 -0
- package/src/generators/bot-app/files/README.md.template +148 -0
- package/src/generators/bot-app/files/src/client/custom-messages/index.ts.template +2 -0
- package/src/generators/bot-app/files/src/client/webchat/index.html.template +35 -0
- package/src/generators/bot-app/files/src/client/webchat/index.tsx.template +107 -0
- package/src/generators/bot-app/files/src/client/webchat/styles.css.template +17 -0
- package/src/generators/bot-app/files/src/client/webchat/webchat-tokens-overrides.css.template +2 -0
- package/src/generators/bot-app/files/src/client/webviews/app.tsx.template +8 -0
- package/src/generators/bot-app/files/src/client/webviews/index.html.template +32 -0
- package/src/generators/bot-app/files/src/client/webviews/index.tsx.template +18 -0
- package/src/generators/bot-app/files/src/server/bot/actions/index.ts.template +2 -0
- package/src/generators/bot-app/files/src/server/bot/actions/not-found.ts.template +13 -0
- package/src/generators/bot-app/files/src/server/bot/actions/welcome.ts.template +13 -0
- package/src/generators/bot-app/files/src/server/bot/index.ts.template +43 -0
- package/src/generators/bot-app/files/src/server/bot/plugins/ai-agents/index.ts.template +30 -0
- package/src/generators/bot-app/files/src/server/bot/plugins/flow-builder/index.ts.template +28 -0
- package/src/generators/bot-app/files/src/server/bot/plugins/index.ts.template +11 -0
- package/src/generators/bot-app/files/src/server/bot/routes.ts.template +23 -0
- package/src/generators/bot-app/files/src/server/bot/tools/index.ts.template +5 -0
- package/src/generators/bot-app/files/src/server/bot/tracking.ts.template +35 -0
- package/src/generators/bot-app/files/src/server/bot/types.ts.template +4 -0
- package/src/generators/bot-app/files/src/server/bot/utils.ts.template +9 -0
- package/src/generators/bot-app/files/src/server/lambda/handler.js.template +24 -0
- package/src/generators/bot-app/files/src/server/lambda/package.json +20 -0
- package/src/generators/bot-app/files/src/server/lambda/template.yaml.template +20 -0
- package/src/generators/bot-app/files/src/shared/constants.ts.template +12 -0
- package/src/generators/bot-app/files/vite/base-client.config.ts.template +14 -0
- package/src/generators/bot-app/files/vite/base.config.ts.template +20 -0
- package/src/generators/bot-app/files/vite/build.config.ts.template +65 -0
- package/src/generators/bot-app/files/vite/node.config.ts.template +41 -0
- package/src/generators/bot-app/files/vite/plugins/move-html.plugin.ts.template +36 -0
- package/src/generators/bot-app/files/vite/webchat.config.ts.template +58 -0
- package/src/generators/bot-app/files/vite/webviews.config.ts.template +57 -0
- package/src/generators/bot-app/files/vite.config.ts.template +36 -0
- package/src/generators/bot-app/generator.d.ts +4 -0
- package/src/generators/bot-app/generator.js +294 -0
- package/src/generators/bot-app/schema.d.ts +6 -0
- package/src/generators/bot-app/schema.js +16 -0
- package/src/generators/bot-app/schema.json +36 -0
- package/src/generators/bot-app-migrations/migrate-fix-css-code-split/generator.d.ts +5 -0
- package/src/generators/bot-app-migrations/migrate-fix-css-code-split/generator.js +92 -0
- package/src/generators/bot-app-migrations/migrate-fix-css-code-split/schema.json +15 -0
- package/src/generators/bot-app-migrations/migrate-pnpm-compat/generator.d.ts +5 -0
- package/src/generators/bot-app-migrations/migrate-pnpm-compat/generator.js +97 -0
- package/src/generators/bot-app-migrations/migrate-pnpm-compat/schema.json +15 -0
- package/src/generators/bot-app-migrations/migrate-webchat-trigger/generator.d.ts +5 -0
- package/src/generators/bot-app-migrations/migrate-webchat-trigger/generator.js +165 -0
- package/src/generators/bot-app-migrations/migrate-webchat-trigger/schema.json +15 -0
- package/src/generators/custom-message/files/__name__-output.ts.template +21 -0
- package/src/generators/custom-message/files/__name__.spec.tsx.template +27 -0
- package/src/generators/custom-message/files/__name__.tsx.template +18 -0
- package/src/generators/custom-message/generator.d.ts +4 -0
- package/src/generators/custom-message/generator.js +235 -0
- package/src/generators/custom-message/schema.d.ts +7 -0
- package/src/generators/custom-message/schema.js +16 -0
- package/src/generators/custom-message/schema.json +44 -0
- package/src/generators/preset/files/.cursor/commands/update-bot.md +5 -0
- package/src/generators/preset/files/.cursor/commands/update-botonic.md +5 -0
- package/src/generators/preset/files/.cursor/scripts/update-bot/discover-bots.sh +67 -0
- package/src/generators/preset/files/.cursor/scripts/update-bot/find-migration-guides.sh +70 -0
- package/src/generators/preset/files/.cursor/skills/botonic-action/SKILL.md +167 -0
- package/src/generators/preset/files/.cursor/skills/botonic-custom-message/SKILL.md +231 -0
- package/src/generators/preset/files/.cursor/skills/botonic-webview/SKILL.md +179 -0
- package/src/generators/preset/files/.env.prod.template +2 -0
- package/src/generators/preset/files/.env.template +2 -0
- package/src/generators/preset/files/.npmrc.template +1 -0
- package/src/generators/preset/files/README.md.template +174 -0
- package/src/generators/preset/files/nx.json +66 -0
- package/src/generators/preset/files/package.json +26 -0
- package/src/generators/preset/files/tsconfig.base.json +27 -0
- package/src/generators/preset/files/tsconfig.base.json.template +27 -0
- package/src/generators/preset/files/tsconfig.json +9 -0
- package/src/generators/preset/generator.d.ts +4 -0
- package/src/generators/preset/generator.js +127 -0
- package/src/generators/preset/schema.d.ts +6 -0
- package/src/generators/preset/schema.js +16 -0
- package/src/generators/preset/schema.json +50 -0
- package/src/generators/remove-custom-message/generator.d.ts +4 -0
- package/src/generators/remove-custom-message/generator.js +259 -0
- package/src/generators/remove-custom-message/schema.d.ts +6 -0
- package/src/generators/remove-custom-message/schema.js +16 -0
- package/src/generators/remove-custom-message/schema.json +39 -0
- package/src/generators/shared/bot-app-utils.d.ts +25 -0
- package/src/generators/shared/bot-app-utils.js +209 -0
- package/src/generators/webview/files/__name__.spec.tsx.template +20 -0
- package/src/generators/webview/files/__name__.tsx.template +19 -0
- package/src/generators/webview/generator.d.ts +4 -0
- package/src/generators/webview/generator.js +179 -0
- package/src/generators/webview/schema.d.ts +5 -0
- package/src/generators/webview/schema.js +16 -0
- package/src/generators/webview/schema.json +34 -0
- package/src/index.d.ts +7 -0
- package/src/index.js +56 -0
- package/src/lib/api-service.d.ts +110 -0
- package/src/lib/api-service.js +591 -0
- package/src/lib/bot-config.d.ts +30 -0
- package/src/lib/bot-config.js +203 -0
- package/src/lib/cloudflared-tunnel.d.ts +29 -0
- package/src/lib/cloudflared-tunnel.js +95 -0
- package/src/lib/constants.d.ts +13 -0
- package/src/lib/constants.js +60 -0
- package/src/lib/credentials-handler.d.ts +40 -0
- package/src/lib/credentials-handler.js +115 -0
- package/src/lib/index.d.ts +10 -0
- package/src/lib/index.js +47 -0
- package/src/lib/interfaces.d.ts +49 -0
- package/src/lib/interfaces.js +16 -0
- package/src/lib/util/executor-helpers.d.ts +97 -0
- package/src/lib/util/executor-helpers.js +574 -0
- package/src/lib/util/file-system.d.ts +8 -0
- package/src/lib/util/file-system.js +65 -0
- package/src/lib/util/sam-container-cleanup.d.ts +11 -0
- package/src/lib/util/sam-container-cleanup.js +55 -0
- package/src/lib/util/sam-template.d.ts +9 -0
- package/src/lib/util/sam-template.js +71 -0
- package/src/lib/util/system.d.ts +1 -0
- package/src/lib/util/system.js +30 -0
- package/src/migrations/add-botonic-update-bots-skill/add-botonic-update-bots-skill.migration.d.ts +2 -0
- package/src/migrations/add-botonic-update-bots-skill/add-botonic-update-bots-skill.migration.js +52 -0
- package/src/migrations/add-botonic-update-bots-skill/add-botonic-update-bots-skill.migration.md +23 -0
- package/src/migrations/add-botonic-update-bots-skill/files/.cursor/commands/update-bot.md +5 -0
- package/src/migrations/add-botonic-update-bots-skill/files/.cursor/commands/update-botonic.md +5 -0
- package/src/migrations/add-botonic-update-bots-skill/files/.cursor/scripts/update-bot/discover-bots.sh +67 -0
- package/src/migrations/add-botonic-update-bots-skill/files/.cursor/scripts/update-bot/find-migration-guides.sh +70 -0
- package/src/migrations/add-botonic-update-bots-skill/schema.json +5 -0
- package/src/migrations/add-lilara-registry/add-lilara-registry.migration.d.ts +2 -0
- package/src/migrations/add-lilara-registry/add-lilara-registry.migration.js +49 -0
- package/src/migrations/add-lilara-registry/schema.json +5 -0
- package/src/migrations/fix-css-code-split/fix-css-code-split.migration.md +45 -0
- package/src/migrations/remove-codeartifact-registry/remove-codeartifact-registry.migration.d.ts +2 -0
- package/src/migrations/remove-codeartifact-registry/remove-codeartifact-registry.migration.js +59 -0
- package/src/migrations/remove-codeartifact-registry/schema.json +5 -0
- package/src/migrations/sync-pending-bot-migrations/schema.json +5 -0
- package/src/migrations/sync-pending-bot-migrations/sync-pending-bot-migrations.migration.d.ts +2 -0
- package/src/migrations/sync-pending-bot-migrations/sync-pending-bot-migrations.migration.js +137 -0
- package/src/migrations/sync-pending-bot-migrations/sync-pending-bot-migrations.migration.md +19 -0
- package/src/migrations/update-cursor-commands-to-stubs/schema.json +5 -0
- package/src/migrations/update-cursor-commands-to-stubs/update-cursor-commands-to-stubs.migration.d.ts +2 -0
- package/src/migrations/update-cursor-commands-to-stubs/update-cursor-commands-to-stubs.migration.js +61 -0
- package/src/migrations/update-pnpm-workspace-scripts/schema.json +4 -0
- package/src/migrations/update-pnpm-workspace-scripts/update-pnpm-workspace-scripts.migration.d.ts +2 -0
- package/src/migrations/update-pnpm-workspace-scripts/update-pnpm-workspace-scripts.migration.js +47 -0
- package/src/migrations/utils/migration-utils.d.ts +109 -0
- package/src/migrations/utils/migration-utils.js +448 -0
- package/src/plugin.d.ts +15 -0
- package/src/plugin.js +246 -0
|
@@ -0,0 +1,203 @@
|
|
|
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
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var bot_config_exports = {};
|
|
30
|
+
__export(bot_config_exports, {
|
|
31
|
+
BotConfig: () => BotConfig
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(bot_config_exports);
|
|
34
|
+
var childProcess = __toESM(require("child_process"));
|
|
35
|
+
var import_fs = require("fs");
|
|
36
|
+
var import_path = require("path");
|
|
37
|
+
var util = __toESM(require("util"));
|
|
38
|
+
const CONSTANTS_PATH = "src/shared/constants";
|
|
39
|
+
const TOOLS_PATH = "src/server/bot/tools";
|
|
40
|
+
class BotConfig {
|
|
41
|
+
static async get(projectRoot) {
|
|
42
|
+
const [botConfig, buildInfo, packages] = await Promise.all([
|
|
43
|
+
this.loadBotConfig(projectRoot),
|
|
44
|
+
this.getBuildInfo(projectRoot),
|
|
45
|
+
this.getBotonicPackages(projectRoot)
|
|
46
|
+
]);
|
|
47
|
+
const config = {
|
|
48
|
+
build_info: buildInfo,
|
|
49
|
+
packages,
|
|
50
|
+
tools: botConfig.tools,
|
|
51
|
+
payloads: botConfig.payloads,
|
|
52
|
+
webviews: botConfig.webviews
|
|
53
|
+
};
|
|
54
|
+
this.displayBotConfig(config);
|
|
55
|
+
return config;
|
|
56
|
+
}
|
|
57
|
+
static displayBotConfig(config) {
|
|
58
|
+
console.log("\n" + "=".repeat(60));
|
|
59
|
+
console.log("\u{1F4CB} BOT CONFIGURATION");
|
|
60
|
+
console.log("=".repeat(60));
|
|
61
|
+
console.log("\n\u{1F527} Build Info:");
|
|
62
|
+
console.log(` Node: ${config.build_info.node_version}`);
|
|
63
|
+
console.log(` NPM: ${config.build_info.npm_version}`);
|
|
64
|
+
console.log(` Botonic CLI: ${config.build_info.botonic_cli_version}`);
|
|
65
|
+
console.log("\n\u{1F4E6} Packages:");
|
|
66
|
+
Object.entries(config.packages).forEach(([name, info]) => {
|
|
67
|
+
console.log(` ${name}: ${info.version}`);
|
|
68
|
+
});
|
|
69
|
+
console.log("\n\u{1F528} Tools:");
|
|
70
|
+
if (config.tools.length === 0) {
|
|
71
|
+
console.log(" (none)");
|
|
72
|
+
} else {
|
|
73
|
+
config.tools.forEach((tool) => {
|
|
74
|
+
console.log(` \u2022 ${tool.name}: ${tool.description}`);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
console.log("\n\u{1F4E8} Payloads:");
|
|
78
|
+
if (config.payloads.length === 0) {
|
|
79
|
+
console.log(" (none)");
|
|
80
|
+
} else {
|
|
81
|
+
config.payloads.forEach((payload) => {
|
|
82
|
+
console.log(` \u2022 ${payload}`);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
console.log("\n\u{1F310} Webviews:");
|
|
86
|
+
if (config.webviews.length === 0) {
|
|
87
|
+
console.log(" (none)");
|
|
88
|
+
} else {
|
|
89
|
+
config.webviews.forEach((webview) => {
|
|
90
|
+
console.log(` \u2022 ${webview.name}`);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
console.log("\n" + "=".repeat(60) + "\n");
|
|
94
|
+
}
|
|
95
|
+
static async loadBotConfig(projectRoot) {
|
|
96
|
+
const [tools, payloads, webviews] = await Promise.all([
|
|
97
|
+
this.getTools(projectRoot),
|
|
98
|
+
this.getPayloads(projectRoot),
|
|
99
|
+
this.getWebviews(projectRoot)
|
|
100
|
+
]);
|
|
101
|
+
return { tools, payloads, webviews };
|
|
102
|
+
}
|
|
103
|
+
static async getTools(projectRoot) {
|
|
104
|
+
const toolsPath = (0, import_path.join)(projectRoot, TOOLS_PATH);
|
|
105
|
+
try {
|
|
106
|
+
const toolsModule = await import(toolsPath);
|
|
107
|
+
if (toolsModule.customTools && Array.isArray(toolsModule.customTools)) {
|
|
108
|
+
return toolsModule.customTools.map(
|
|
109
|
+
(tool) => ({
|
|
110
|
+
name: tool.name,
|
|
111
|
+
description: tool.description
|
|
112
|
+
})
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
} catch {
|
|
116
|
+
console.warn(`Tools not found in ${toolsPath}`);
|
|
117
|
+
}
|
|
118
|
+
return [];
|
|
119
|
+
}
|
|
120
|
+
static async loadModuleConstant(modulePath, constantName, transformer) {
|
|
121
|
+
try {
|
|
122
|
+
const module2 = await import(modulePath);
|
|
123
|
+
if (module2[constantName] && typeof module2[constantName] === "object") {
|
|
124
|
+
const values = Object.values(module2[constantName]);
|
|
125
|
+
return transformer ? values.map(transformer) : values;
|
|
126
|
+
}
|
|
127
|
+
} catch {
|
|
128
|
+
console.warn(`${constantName} not found in ${modulePath}`);
|
|
129
|
+
}
|
|
130
|
+
return [];
|
|
131
|
+
}
|
|
132
|
+
static async getPayloads(projectRoot) {
|
|
133
|
+
const constantsPath = (0, import_path.join)(projectRoot, CONSTANTS_PATH);
|
|
134
|
+
return this.loadModuleConstant(constantsPath, "PAYLOADS");
|
|
135
|
+
}
|
|
136
|
+
static async getWebviews(projectRoot) {
|
|
137
|
+
const constantsPath = (0, import_path.join)(projectRoot, CONSTANTS_PATH);
|
|
138
|
+
return this.loadModuleConstant(
|
|
139
|
+
constantsPath,
|
|
140
|
+
"WEBVIEWS",
|
|
141
|
+
(path) => ({ name: path })
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
static async getBuildInfo(projectRoot) {
|
|
145
|
+
const [nodeVersion, npmVersion] = await Promise.all([
|
|
146
|
+
this.getOutputByCommand("node -v"),
|
|
147
|
+
this.getOutputByCommand("pnpm -v")
|
|
148
|
+
]);
|
|
149
|
+
let botonicCliVersion = "";
|
|
150
|
+
try {
|
|
151
|
+
const packageJsonPath = (0, import_path.join)(projectRoot, "package.json");
|
|
152
|
+
const packageJsonContent = (0, import_fs.readFileSync)(packageJsonPath, "utf8");
|
|
153
|
+
const packageJson = JSON.parse(packageJsonContent);
|
|
154
|
+
const dependencies = {
|
|
155
|
+
...packageJson.dependencies,
|
|
156
|
+
...packageJson.devDependencies
|
|
157
|
+
};
|
|
158
|
+
botonicCliVersion = dependencies["@botonic/core"] || "";
|
|
159
|
+
botonicCliVersion = botonicCliVersion.replace(/[\^~]/, "");
|
|
160
|
+
} catch {
|
|
161
|
+
console.warn("Could not determine Botonic CLI version");
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
node_version: nodeVersion,
|
|
165
|
+
npm_version: npmVersion,
|
|
166
|
+
botonic_cli_version: botonicCliVersion
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
static async getBotonicPackages(projectRoot) {
|
|
170
|
+
const packages = {};
|
|
171
|
+
try {
|
|
172
|
+
const packageJsonPath = (0, import_path.join)(projectRoot, "package.json");
|
|
173
|
+
const packageJsonContent = (0, import_fs.readFileSync)(packageJsonPath, "utf8");
|
|
174
|
+
const packageJson = JSON.parse(packageJsonContent);
|
|
175
|
+
const dependencies = {
|
|
176
|
+
...packageJson.dependencies,
|
|
177
|
+
...packageJson.devDependencies
|
|
178
|
+
};
|
|
179
|
+
const botonicPackages = Object.keys(dependencies).filter(
|
|
180
|
+
(dep) => dep.startsWith("@botonic/")
|
|
181
|
+
);
|
|
182
|
+
let coreVersion = dependencies["@botonic/core"] || "";
|
|
183
|
+
if (coreVersion) {
|
|
184
|
+
coreVersion = coreVersion.replace(/[\^~]/, "");
|
|
185
|
+
}
|
|
186
|
+
for (const packageName of botonicPackages) {
|
|
187
|
+
packages[packageName] = { version: coreVersion };
|
|
188
|
+
}
|
|
189
|
+
} catch {
|
|
190
|
+
console.error("Error getting Botonic packages:");
|
|
191
|
+
}
|
|
192
|
+
return packages;
|
|
193
|
+
}
|
|
194
|
+
static async getOutputByCommand(command) {
|
|
195
|
+
const exec = util.promisify(childProcess.exec);
|
|
196
|
+
const { stdout } = await exec(command);
|
|
197
|
+
return stdout.trim();
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
201
|
+
0 && (module.exports = {
|
|
202
|
+
BotConfig
|
|
203
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ChildProcess } from 'child_process';
|
|
2
|
+
/**
|
|
3
|
+
* Default timeout (ms) to wait for cloudflared to output the quick tunnel URL.
|
|
4
|
+
* Cloudflared prints the URL to stdout when the tunnel is ready.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEFAULT_TUNNEL_URL_TIMEOUT_MS = 15000;
|
|
7
|
+
/**
|
|
8
|
+
* Regex to extract the quick tunnel HTTPS URL from cloudflared output.
|
|
9
|
+
* Quick tunnels use trycloudflare.com (e.g. https://random-subdomain.trycloudflare.com).
|
|
10
|
+
* Documented: https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/do-more-with-tunnels/trycloudflare/
|
|
11
|
+
*/
|
|
12
|
+
export declare const TUNNEL_URL_REGEX: RegExp;
|
|
13
|
+
export interface StartTunnelResult {
|
|
14
|
+
url: string;
|
|
15
|
+
process: ChildProcess;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Spawns cloudflared in quick-tunnel mode and returns a promise that resolves
|
|
19
|
+
* with the public HTTPS URL when it appears in stdout/stderr, or rejects on
|
|
20
|
+
* timeout or parse failure.
|
|
21
|
+
*
|
|
22
|
+
* Requires cloudflared on PATH (e.g. brew install cloudflare/cloudflare/cloudflared).
|
|
23
|
+
* No Cloudflare account or login required for quick tunnels.
|
|
24
|
+
*
|
|
25
|
+
* @param localPort - Port where the local service is listening (e.g. Lambda on 3001)
|
|
26
|
+
* @param timeoutMs - Max time to wait for the URL (default DEFAULT_TUNNEL_URL_TIMEOUT_MS)
|
|
27
|
+
* @returns Promise resolving with { url, process }. Caller must kill process on shutdown.
|
|
28
|
+
*/
|
|
29
|
+
export declare function startCloudflaredTunnel(localPort: number, timeoutMs?: number): Promise<StartTunnelResult>;
|
|
@@ -0,0 +1,95 @@
|
|
|
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 cloudflared_tunnel_exports = {};
|
|
20
|
+
__export(cloudflared_tunnel_exports, {
|
|
21
|
+
DEFAULT_TUNNEL_URL_TIMEOUT_MS: () => DEFAULT_TUNNEL_URL_TIMEOUT_MS,
|
|
22
|
+
TUNNEL_URL_REGEX: () => TUNNEL_URL_REGEX,
|
|
23
|
+
startCloudflaredTunnel: () => startCloudflaredTunnel
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(cloudflared_tunnel_exports);
|
|
26
|
+
var import_child_process = require("child_process");
|
|
27
|
+
const DEFAULT_TUNNEL_URL_TIMEOUT_MS = 15e3;
|
|
28
|
+
const TUNNEL_URL_REGEX = /https:\/\/[a-zA-Z0-9-]+\.trycloudflare\.com/;
|
|
29
|
+
function startCloudflaredTunnel(localPort, timeoutMs = DEFAULT_TUNNEL_URL_TIMEOUT_MS) {
|
|
30
|
+
return new Promise((resolve, reject) => {
|
|
31
|
+
const child = (0, import_child_process.spawn)(
|
|
32
|
+
"cloudflared",
|
|
33
|
+
["tunnel", "--url", `http://localhost:${localPort}`],
|
|
34
|
+
{
|
|
35
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
let resolved = false;
|
|
39
|
+
const timeoutId = setTimeout(() => {
|
|
40
|
+
if (resolved) return;
|
|
41
|
+
resolved = true;
|
|
42
|
+
child.kill("SIGTERM");
|
|
43
|
+
reject(
|
|
44
|
+
new Error(
|
|
45
|
+
`cloudflared did not output a tunnel URL within ${timeoutMs}ms. Ensure cloudflared is installed (e.g. brew install cloudflare/cloudflare/cloudflared).`
|
|
46
|
+
)
|
|
47
|
+
);
|
|
48
|
+
}, timeoutMs);
|
|
49
|
+
const checkLine = (line) => {
|
|
50
|
+
if (resolved) return;
|
|
51
|
+
const match = line.match(TUNNEL_URL_REGEX);
|
|
52
|
+
if (match) {
|
|
53
|
+
resolved = true;
|
|
54
|
+
clearTimeout(timeoutId);
|
|
55
|
+
resolve({ url: match[0], process: child });
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const onError = (err) => {
|
|
59
|
+
if (resolved) return;
|
|
60
|
+
resolved = true;
|
|
61
|
+
clearTimeout(timeoutId);
|
|
62
|
+
child.kill("SIGTERM");
|
|
63
|
+
reject(
|
|
64
|
+
new Error(
|
|
65
|
+
`cloudflared failed: ${err.message}. Ensure cloudflared is installed (e.g. brew install cloudflare/cloudflare/cloudflared).`
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
child.on("error", onError);
|
|
70
|
+
child.stdout?.on("data", (chunk) => {
|
|
71
|
+
const lines = chunk.toString().split(/\r?\n/);
|
|
72
|
+
lines.forEach(checkLine);
|
|
73
|
+
});
|
|
74
|
+
child.stderr?.on("data", (chunk) => {
|
|
75
|
+
const lines = chunk.toString().split(/\r?\n/);
|
|
76
|
+
lines.forEach(checkLine);
|
|
77
|
+
});
|
|
78
|
+
child.on("exit", (code, signal) => {
|
|
79
|
+
if (resolved) return;
|
|
80
|
+
resolved = true;
|
|
81
|
+
clearTimeout(timeoutId);
|
|
82
|
+
reject(
|
|
83
|
+
new Error(
|
|
84
|
+
`cloudflared exited before providing a URL (code=${code}, signal=${signal})`
|
|
85
|
+
)
|
|
86
|
+
);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
+
0 && (module.exports = {
|
|
92
|
+
DEFAULT_TUNNEL_URL_TIMEOUT_MS,
|
|
93
|
+
TUNNEL_URL_REGEX,
|
|
94
|
+
startCloudflaredTunnel
|
|
95
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const BOTONIC_NPM_NAMESPACE = "@botonic";
|
|
2
|
+
export declare const BOTONIC_HOME_DIRNAME = ".botonic";
|
|
3
|
+
export declare const GLOBAL_CREDS_FILENAME = "credentials.json";
|
|
4
|
+
export declare const BOTONIC_PROJECT_PATH: string;
|
|
5
|
+
export declare const BOT_CREDENTIALS_FILENAME = ".botonic.json";
|
|
6
|
+
export declare const LOCAL_RUNTIME_BOT_CREDENTIALS_FILENAME = ".local-runtime-botonic.json";
|
|
7
|
+
export declare const ANALYTICS_WRITE_KEY = "YD0jpJHNGW12uhLNbgB4wbdTRQ4Cy1Zu";
|
|
8
|
+
export declare const CLOUD_PROVIDERS: Readonly<{
|
|
9
|
+
AWS: "aws";
|
|
10
|
+
HUBTYPE: "hubtype";
|
|
11
|
+
}>;
|
|
12
|
+
export declare const AWS_CLOUD_CONFIG_FILENAME = "aws.config.js";
|
|
13
|
+
export declare const PATH_TO_AWS_CONFIG: string;
|
|
@@ -0,0 +1,60 @@
|
|
|
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 constants_exports = {};
|
|
20
|
+
__export(constants_exports, {
|
|
21
|
+
ANALYTICS_WRITE_KEY: () => ANALYTICS_WRITE_KEY,
|
|
22
|
+
AWS_CLOUD_CONFIG_FILENAME: () => AWS_CLOUD_CONFIG_FILENAME,
|
|
23
|
+
BOTONIC_HOME_DIRNAME: () => BOTONIC_HOME_DIRNAME,
|
|
24
|
+
BOTONIC_NPM_NAMESPACE: () => BOTONIC_NPM_NAMESPACE,
|
|
25
|
+
BOTONIC_PROJECT_PATH: () => BOTONIC_PROJECT_PATH,
|
|
26
|
+
BOT_CREDENTIALS_FILENAME: () => BOT_CREDENTIALS_FILENAME,
|
|
27
|
+
CLOUD_PROVIDERS: () => CLOUD_PROVIDERS,
|
|
28
|
+
GLOBAL_CREDS_FILENAME: () => GLOBAL_CREDS_FILENAME,
|
|
29
|
+
LOCAL_RUNTIME_BOT_CREDENTIALS_FILENAME: () => LOCAL_RUNTIME_BOT_CREDENTIALS_FILENAME,
|
|
30
|
+
PATH_TO_AWS_CONFIG: () => PATH_TO_AWS_CONFIG
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(constants_exports);
|
|
33
|
+
var import_path = require("path");
|
|
34
|
+
var import_process = require("process");
|
|
35
|
+
const BOTONIC_NPM_NAMESPACE = "@botonic";
|
|
36
|
+
const BOTONIC_HOME_DIRNAME = ".botonic";
|
|
37
|
+
const GLOBAL_CREDS_FILENAME = "credentials.json";
|
|
38
|
+
const BOTONIC_PROJECT_PATH = process.cwd();
|
|
39
|
+
const BOT_CREDENTIALS_FILENAME = ".botonic.json";
|
|
40
|
+
const LOCAL_RUNTIME_BOT_CREDENTIALS_FILENAME = ".local-runtime-botonic.json";
|
|
41
|
+
const ANALYTICS_WRITE_KEY = "YD0jpJHNGW12uhLNbgB4wbdTRQ4Cy1Zu";
|
|
42
|
+
const CLOUD_PROVIDERS = Object.freeze({
|
|
43
|
+
AWS: "aws",
|
|
44
|
+
HUBTYPE: "hubtype"
|
|
45
|
+
});
|
|
46
|
+
const AWS_CLOUD_CONFIG_FILENAME = "aws.config.js";
|
|
47
|
+
const PATH_TO_AWS_CONFIG = (0, import_path.join)((0, import_process.cwd)(), AWS_CLOUD_CONFIG_FILENAME);
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
ANALYTICS_WRITE_KEY,
|
|
51
|
+
AWS_CLOUD_CONFIG_FILENAME,
|
|
52
|
+
BOTONIC_HOME_DIRNAME,
|
|
53
|
+
BOTONIC_NPM_NAMESPACE,
|
|
54
|
+
BOTONIC_PROJECT_PATH,
|
|
55
|
+
BOT_CREDENTIALS_FILENAME,
|
|
56
|
+
CLOUD_PROVIDERS,
|
|
57
|
+
GLOBAL_CREDS_FILENAME,
|
|
58
|
+
LOCAL_RUNTIME_BOT_CREDENTIALS_FILENAME,
|
|
59
|
+
PATH_TO_AWS_CONFIG
|
|
60
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { BotCredentials, GlobalCredentialsStore, JSONObject } from './interfaces';
|
|
2
|
+
export declare class CredentialsHandler {
|
|
3
|
+
homeDir: string;
|
|
4
|
+
pathToCredentials: string;
|
|
5
|
+
constructor(args: {
|
|
6
|
+
homeDir: string;
|
|
7
|
+
filename: string;
|
|
8
|
+
});
|
|
9
|
+
initialize(): void;
|
|
10
|
+
createDirIfNotExists(): void;
|
|
11
|
+
loadJSON(): JSONObject | undefined;
|
|
12
|
+
dumpJSON(obj: JSONObject): void;
|
|
13
|
+
}
|
|
14
|
+
export declare class GlobalCredentialsHandler extends CredentialsHandler {
|
|
15
|
+
/**
|
|
16
|
+
* @param baseDir - Optional directory for credentials (e.g. monorepo_root/.botonic).
|
|
17
|
+
* When provided, credentials are stored at baseDir/credentials.json (source of truth in monorepo).
|
|
18
|
+
* When omitted, uses ~/.botonic (user home).
|
|
19
|
+
*/
|
|
20
|
+
constructor(baseDir?: string);
|
|
21
|
+
initialize(): void;
|
|
22
|
+
load(): GlobalCredentialsStore | undefined;
|
|
23
|
+
dump(obj: GlobalCredentialsStore): void;
|
|
24
|
+
}
|
|
25
|
+
declare class BaseBotCredentialsHandler<T> extends CredentialsHandler {
|
|
26
|
+
constructor(args: {
|
|
27
|
+
homeDir: string;
|
|
28
|
+
filename: string;
|
|
29
|
+
});
|
|
30
|
+
load(): T | undefined;
|
|
31
|
+
dump(obj: T): void;
|
|
32
|
+
}
|
|
33
|
+
export declare class BotCredentialsHandler extends BaseBotCredentialsHandler<BotCredentials> {
|
|
34
|
+
/**
|
|
35
|
+
* @param projectRoot - Directory for app/project .botonic.json (e.g. apps/my-bot).
|
|
36
|
+
* When omitted, uses process.cwd() (may write to repo root when Nx cwd is workspace root).
|
|
37
|
+
*/
|
|
38
|
+
constructor(projectRoot?: string);
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
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 credentials_handler_exports = {};
|
|
20
|
+
__export(credentials_handler_exports, {
|
|
21
|
+
BotCredentialsHandler: () => BotCredentialsHandler,
|
|
22
|
+
CredentialsHandler: () => CredentialsHandler,
|
|
23
|
+
GlobalCredentialsHandler: () => GlobalCredentialsHandler
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(credentials_handler_exports);
|
|
26
|
+
var import_path = require("path");
|
|
27
|
+
var import_constants = require("./constants");
|
|
28
|
+
var import_file_system = require("./util/file-system");
|
|
29
|
+
class CredentialsHandler {
|
|
30
|
+
constructor(args) {
|
|
31
|
+
this.homeDir = (0, import_path.resolve)(args.homeDir);
|
|
32
|
+
this.pathToCredentials = (0, import_path.join)(this.homeDir, args.filename);
|
|
33
|
+
this.initialize();
|
|
34
|
+
}
|
|
35
|
+
initialize() {
|
|
36
|
+
this.createDirIfNotExists();
|
|
37
|
+
}
|
|
38
|
+
createDirIfNotExists() {
|
|
39
|
+
if (!(0, import_file_system.pathExists)(this.homeDir)) (0, import_file_system.createDir)(this.homeDir);
|
|
40
|
+
}
|
|
41
|
+
loadJSON() {
|
|
42
|
+
try {
|
|
43
|
+
if (!(0, import_file_system.pathExists)(this.pathToCredentials)) return void 0;
|
|
44
|
+
return (0, import_file_system.readJSON)(this.pathToCredentials);
|
|
45
|
+
} catch (e) {
|
|
46
|
+
console.warn("Credentials could not be loaded");
|
|
47
|
+
return void 0;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
dumpJSON(obj) {
|
|
51
|
+
try {
|
|
52
|
+
(0, import_file_system.writeJSON)(this.pathToCredentials, obj);
|
|
53
|
+
} catch (e) {
|
|
54
|
+
console.warn("Credentials could not be overwritten");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
class GlobalCredentialsHandler extends CredentialsHandler {
|
|
59
|
+
/**
|
|
60
|
+
* @param baseDir - Optional directory for credentials (e.g. monorepo_root/.botonic).
|
|
61
|
+
* When provided, credentials are stored at baseDir/credentials.json (source of truth in monorepo).
|
|
62
|
+
* When omitted, uses ~/.botonic (user home).
|
|
63
|
+
*/
|
|
64
|
+
constructor(baseDir) {
|
|
65
|
+
super({
|
|
66
|
+
homeDir: baseDir ? (0, import_path.resolve)(baseDir) : (0, import_path.join)((0, import_file_system.getHomeDirectory)(), import_constants.BOTONIC_HOME_DIRNAME),
|
|
67
|
+
filename: import_constants.GLOBAL_CREDS_FILENAME
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
initialize() {
|
|
71
|
+
this.createDirIfNotExists();
|
|
72
|
+
}
|
|
73
|
+
load() {
|
|
74
|
+
const json = this.loadJSON();
|
|
75
|
+
if (!json) return void 0;
|
|
76
|
+
return json;
|
|
77
|
+
}
|
|
78
|
+
dump(obj) {
|
|
79
|
+
return this.dumpJSON(obj);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
class BaseBotCredentialsHandler extends CredentialsHandler {
|
|
83
|
+
constructor(args) {
|
|
84
|
+
super({
|
|
85
|
+
homeDir: args.homeDir,
|
|
86
|
+
filename: args.filename
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
load() {
|
|
90
|
+
const json = this.loadJSON();
|
|
91
|
+
if (!json) return void 0;
|
|
92
|
+
return json;
|
|
93
|
+
}
|
|
94
|
+
dump(obj) {
|
|
95
|
+
return this.dumpJSON(obj);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
class BotCredentialsHandler extends BaseBotCredentialsHandler {
|
|
99
|
+
/**
|
|
100
|
+
* @param projectRoot - Directory for app/project .botonic.json (e.g. apps/my-bot).
|
|
101
|
+
* When omitted, uses process.cwd() (may write to repo root when Nx cwd is workspace root).
|
|
102
|
+
*/
|
|
103
|
+
constructor(projectRoot) {
|
|
104
|
+
super({
|
|
105
|
+
homeDir: projectRoot ? (0, import_path.resolve)(projectRoot) : import_constants.BOTONIC_PROJECT_PATH,
|
|
106
|
+
filename: import_constants.BOT_CREDENTIALS_FILENAME
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
111
|
+
0 && (module.exports = {
|
|
112
|
+
BotCredentialsHandler,
|
|
113
|
+
CredentialsHandler,
|
|
114
|
+
GlobalCredentialsHandler
|
|
115
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { BotonicAPIService } from './api-service';
|
|
2
|
+
export * from './bot-config';
|
|
3
|
+
export * from './cloudflared-tunnel';
|
|
4
|
+
export * from './constants';
|
|
5
|
+
export * from './credentials-handler';
|
|
6
|
+
export * from './interfaces';
|
|
7
|
+
export * from './util/executor-helpers';
|
|
8
|
+
export * from './util/file-system';
|
|
9
|
+
export * from './util/sam-template';
|
|
10
|
+
export * from './util/system';
|
package/src/lib/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var lib_exports = {};
|
|
21
|
+
__export(lib_exports, {
|
|
22
|
+
BotonicAPIService: () => import_api_service.BotonicAPIService
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(lib_exports);
|
|
25
|
+
var import_api_service = require("./api-service");
|
|
26
|
+
__reExport(lib_exports, require("./bot-config"), module.exports);
|
|
27
|
+
__reExport(lib_exports, require("./cloudflared-tunnel"), module.exports);
|
|
28
|
+
__reExport(lib_exports, require("./constants"), module.exports);
|
|
29
|
+
__reExport(lib_exports, require("./credentials-handler"), module.exports);
|
|
30
|
+
__reExport(lib_exports, require("./interfaces"), module.exports);
|
|
31
|
+
__reExport(lib_exports, require("./util/executor-helpers"), module.exports);
|
|
32
|
+
__reExport(lib_exports, require("./util/file-system"), module.exports);
|
|
33
|
+
__reExport(lib_exports, require("./util/sam-template"), module.exports);
|
|
34
|
+
__reExport(lib_exports, require("./util/system"), module.exports);
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
BotonicAPIService,
|
|
38
|
+
...require("./bot-config"),
|
|
39
|
+
...require("./cloudflared-tunnel"),
|
|
40
|
+
...require("./constants"),
|
|
41
|
+
...require("./credentials-handler"),
|
|
42
|
+
...require("./interfaces"),
|
|
43
|
+
...require("./util/executor-helpers"),
|
|
44
|
+
...require("./util/file-system"),
|
|
45
|
+
...require("./util/sam-template"),
|
|
46
|
+
...require("./util/system")
|
|
47
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface OAuth {
|
|
2
|
+
access_token: string;
|
|
3
|
+
expires_in: number;
|
|
4
|
+
token_type: string;
|
|
5
|
+
scope: string;
|
|
6
|
+
refresh_token: string;
|
|
7
|
+
}
|
|
8
|
+
export interface Me {
|
|
9
|
+
id: string;
|
|
10
|
+
email: string;
|
|
11
|
+
first_name: string;
|
|
12
|
+
last_name: string;
|
|
13
|
+
organization_id: string;
|
|
14
|
+
campaign: string;
|
|
15
|
+
}
|
|
16
|
+
/** Credentials for a single environment (local, dev, prod, etc.). */
|
|
17
|
+
export interface EnvironmentCredentials {
|
|
18
|
+
oauth?: OAuth;
|
|
19
|
+
me?: Me;
|
|
20
|
+
/** User display name when logged in (for display when me is not loaded yet). */
|
|
21
|
+
loggedUserName?: string;
|
|
22
|
+
/** Hubtype API URL for this environment (to detect env switch). */
|
|
23
|
+
loggedEnvironmentUrl?: string;
|
|
24
|
+
}
|
|
25
|
+
/** Store: one entry per environment so multiple envs can be logged in. */
|
|
26
|
+
export type GlobalCredentialsStore = Record<string, EnvironmentCredentials>;
|
|
27
|
+
export interface BotDetail {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
organization: string;
|
|
31
|
+
last_update: any;
|
|
32
|
+
created_at: string;
|
|
33
|
+
provider_accounts: any[];
|
|
34
|
+
is_debug: boolean;
|
|
35
|
+
is_published: boolean;
|
|
36
|
+
active_users: number;
|
|
37
|
+
}
|
|
38
|
+
export interface BotCredentials {
|
|
39
|
+
bot: BotDetail | null;
|
|
40
|
+
}
|
|
41
|
+
export interface LocalRuntimeBotCredentials {
|
|
42
|
+
localRuntimeBot: BotDetail | null;
|
|
43
|
+
}
|
|
44
|
+
export type JSONPrimitive = string | number | boolean | null;
|
|
45
|
+
export type JSONValue = JSONPrimitive | JSONObject | JSONArray;
|
|
46
|
+
export type JSONObject = {
|
|
47
|
+
[member: string]: JSONValue;
|
|
48
|
+
};
|
|
49
|
+
export type JSONArray = JSONValue[];
|
|
@@ -0,0 +1,16 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var interfaces_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(interfaces_exports);
|