@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.
Files changed (206) hide show
  1. package/CHANGELOG.md +420 -0
  2. package/README.md +279 -0
  3. package/executors.json +55 -0
  4. package/generators.json +61 -0
  5. package/migrations.json +40 -0
  6. package/package.json +54 -0
  7. package/src/cursor-commands/update-bot.md +114 -0
  8. package/src/cursor-commands/update-botonic.md +63 -0
  9. package/src/executors/build-node-app/executor.d.ts +5 -0
  10. package/src/executors/build-node-app/executor.js +65 -0
  11. package/src/executors/build-node-app/schema.d.js +16 -0
  12. package/src/executors/build-node-app/schema.json +25 -0
  13. package/src/executors/delete-bot/executor.d.ts +5 -0
  14. package/src/executors/delete-bot/executor.js +112 -0
  15. package/src/executors/delete-bot/schema.d.js +16 -0
  16. package/src/executors/delete-bot/schema.json +35 -0
  17. package/src/executors/deploy-local-runtime/executor.d.ts +5 -0
  18. package/src/executors/deploy-local-runtime/executor.js +144 -0
  19. package/src/executors/deploy-local-runtime/schema.d.js +16 -0
  20. package/src/executors/deploy-local-runtime/schema.json +34 -0
  21. package/src/executors/deploy-netlify-snapshot/executor.d.ts +8 -0
  22. package/src/executors/deploy-netlify-snapshot/executor.js +79 -0
  23. package/src/executors/deploy-netlify-snapshot/schema.d.js +16 -0
  24. package/src/executors/deploy-netlify-snapshot/schema.json +31 -0
  25. package/src/executors/deploy-to-hubtype/executor.d.ts +5 -0
  26. package/src/executors/deploy-to-hubtype/executor.js +308 -0
  27. package/src/executors/deploy-to-hubtype/schema.d.js +16 -0
  28. package/src/executors/deploy-to-hubtype/schema.json +31 -0
  29. package/src/executors/e2e-webchat/botonic-package-publish.spec.ts +84 -0
  30. package/src/executors/e2e-webchat/executor.d.ts +5 -0
  31. package/src/executors/e2e-webchat/executor.js +134 -0
  32. package/src/executors/e2e-webchat/schema.d.js +16 -0
  33. package/src/executors/e2e-webchat/schema.json +35 -0
  34. package/src/executors/integrate-provider/executor.d.ts +5 -0
  35. package/src/executors/integrate-provider/executor.js +155 -0
  36. package/src/executors/integrate-provider/schema.d.js +16 -0
  37. package/src/executors/integrate-provider/schema.json +30 -0
  38. package/src/executors/login-to-hubtype/executor.d.ts +5 -0
  39. package/src/executors/login-to-hubtype/executor.js +79 -0
  40. package/src/executors/login-to-hubtype/schema.d.js +16 -0
  41. package/src/executors/login-to-hubtype/schema.json +25 -0
  42. package/src/executors/logout-from-hubtype/executor.d.ts +3 -0
  43. package/src/executors/logout-from-hubtype/executor.js +54 -0
  44. package/src/executors/logout-from-hubtype/schema.d.js +16 -0
  45. package/src/executors/logout-from-hubtype/schema.json +9 -0
  46. package/src/executors/run-lambda/executor.d.ts +5 -0
  47. package/src/executors/run-lambda/executor.js +65 -0
  48. package/src/executors/run-lambda/schema.d.js +16 -0
  49. package/src/executors/run-lambda/schema.json +20 -0
  50. package/src/executors/serve-bot/executor.d.ts +5 -0
  51. package/src/executors/serve-bot/executor.js +330 -0
  52. package/src/executors/serve-bot/schema.d.js +16 -0
  53. package/src/executors/serve-bot/schema.json +40 -0
  54. package/src/generators/action/files/__name__.spec.ts.template +15 -0
  55. package/src/generators/action/files/__name__.ts.template +15 -0
  56. package/src/generators/action/generator.d.ts +4 -0
  57. package/src/generators/action/generator.js +112 -0
  58. package/src/generators/action/schema.d.ts +7 -0
  59. package/src/generators/action/schema.js +16 -0
  60. package/src/generators/action/schema.json +43 -0
  61. package/src/generators/bot-app/files/.eslintrc.json.template +18 -0
  62. package/src/generators/bot-app/files/README.md.template +148 -0
  63. package/src/generators/bot-app/files/src/client/custom-messages/index.ts.template +2 -0
  64. package/src/generators/bot-app/files/src/client/webchat/index.html.template +35 -0
  65. package/src/generators/bot-app/files/src/client/webchat/index.tsx.template +107 -0
  66. package/src/generators/bot-app/files/src/client/webchat/styles.css.template +17 -0
  67. package/src/generators/bot-app/files/src/client/webchat/webchat-tokens-overrides.css.template +2 -0
  68. package/src/generators/bot-app/files/src/client/webviews/app.tsx.template +8 -0
  69. package/src/generators/bot-app/files/src/client/webviews/index.html.template +32 -0
  70. package/src/generators/bot-app/files/src/client/webviews/index.tsx.template +18 -0
  71. package/src/generators/bot-app/files/src/server/bot/actions/index.ts.template +2 -0
  72. package/src/generators/bot-app/files/src/server/bot/actions/not-found.ts.template +13 -0
  73. package/src/generators/bot-app/files/src/server/bot/actions/welcome.ts.template +13 -0
  74. package/src/generators/bot-app/files/src/server/bot/index.ts.template +43 -0
  75. package/src/generators/bot-app/files/src/server/bot/plugins/ai-agents/index.ts.template +30 -0
  76. package/src/generators/bot-app/files/src/server/bot/plugins/flow-builder/index.ts.template +28 -0
  77. package/src/generators/bot-app/files/src/server/bot/plugins/index.ts.template +11 -0
  78. package/src/generators/bot-app/files/src/server/bot/routes.ts.template +23 -0
  79. package/src/generators/bot-app/files/src/server/bot/tools/index.ts.template +5 -0
  80. package/src/generators/bot-app/files/src/server/bot/tracking.ts.template +35 -0
  81. package/src/generators/bot-app/files/src/server/bot/types.ts.template +4 -0
  82. package/src/generators/bot-app/files/src/server/bot/utils.ts.template +9 -0
  83. package/src/generators/bot-app/files/src/server/lambda/handler.js.template +24 -0
  84. package/src/generators/bot-app/files/src/server/lambda/package.json +20 -0
  85. package/src/generators/bot-app/files/src/server/lambda/template.yaml.template +20 -0
  86. package/src/generators/bot-app/files/src/shared/constants.ts.template +12 -0
  87. package/src/generators/bot-app/files/vite/base-client.config.ts.template +14 -0
  88. package/src/generators/bot-app/files/vite/base.config.ts.template +20 -0
  89. package/src/generators/bot-app/files/vite/build.config.ts.template +65 -0
  90. package/src/generators/bot-app/files/vite/node.config.ts.template +41 -0
  91. package/src/generators/bot-app/files/vite/plugins/move-html.plugin.ts.template +36 -0
  92. package/src/generators/bot-app/files/vite/webchat.config.ts.template +58 -0
  93. package/src/generators/bot-app/files/vite/webviews.config.ts.template +57 -0
  94. package/src/generators/bot-app/files/vite.config.ts.template +36 -0
  95. package/src/generators/bot-app/generator.d.ts +4 -0
  96. package/src/generators/bot-app/generator.js +294 -0
  97. package/src/generators/bot-app/schema.d.ts +6 -0
  98. package/src/generators/bot-app/schema.js +16 -0
  99. package/src/generators/bot-app/schema.json +36 -0
  100. package/src/generators/bot-app-migrations/migrate-fix-css-code-split/generator.d.ts +5 -0
  101. package/src/generators/bot-app-migrations/migrate-fix-css-code-split/generator.js +92 -0
  102. package/src/generators/bot-app-migrations/migrate-fix-css-code-split/schema.json +15 -0
  103. package/src/generators/bot-app-migrations/migrate-pnpm-compat/generator.d.ts +5 -0
  104. package/src/generators/bot-app-migrations/migrate-pnpm-compat/generator.js +97 -0
  105. package/src/generators/bot-app-migrations/migrate-pnpm-compat/schema.json +15 -0
  106. package/src/generators/bot-app-migrations/migrate-webchat-trigger/generator.d.ts +5 -0
  107. package/src/generators/bot-app-migrations/migrate-webchat-trigger/generator.js +165 -0
  108. package/src/generators/bot-app-migrations/migrate-webchat-trigger/schema.json +15 -0
  109. package/src/generators/custom-message/files/__name__-output.ts.template +21 -0
  110. package/src/generators/custom-message/files/__name__.spec.tsx.template +27 -0
  111. package/src/generators/custom-message/files/__name__.tsx.template +18 -0
  112. package/src/generators/custom-message/generator.d.ts +4 -0
  113. package/src/generators/custom-message/generator.js +235 -0
  114. package/src/generators/custom-message/schema.d.ts +7 -0
  115. package/src/generators/custom-message/schema.js +16 -0
  116. package/src/generators/custom-message/schema.json +44 -0
  117. package/src/generators/preset/files/.cursor/commands/update-bot.md +5 -0
  118. package/src/generators/preset/files/.cursor/commands/update-botonic.md +5 -0
  119. package/src/generators/preset/files/.cursor/scripts/update-bot/discover-bots.sh +67 -0
  120. package/src/generators/preset/files/.cursor/scripts/update-bot/find-migration-guides.sh +70 -0
  121. package/src/generators/preset/files/.cursor/skills/botonic-action/SKILL.md +167 -0
  122. package/src/generators/preset/files/.cursor/skills/botonic-custom-message/SKILL.md +231 -0
  123. package/src/generators/preset/files/.cursor/skills/botonic-webview/SKILL.md +179 -0
  124. package/src/generators/preset/files/.env.prod.template +2 -0
  125. package/src/generators/preset/files/.env.template +2 -0
  126. package/src/generators/preset/files/.npmrc.template +1 -0
  127. package/src/generators/preset/files/README.md.template +174 -0
  128. package/src/generators/preset/files/nx.json +66 -0
  129. package/src/generators/preset/files/package.json +26 -0
  130. package/src/generators/preset/files/tsconfig.base.json +27 -0
  131. package/src/generators/preset/files/tsconfig.base.json.template +27 -0
  132. package/src/generators/preset/files/tsconfig.json +9 -0
  133. package/src/generators/preset/generator.d.ts +4 -0
  134. package/src/generators/preset/generator.js +127 -0
  135. package/src/generators/preset/schema.d.ts +6 -0
  136. package/src/generators/preset/schema.js +16 -0
  137. package/src/generators/preset/schema.json +50 -0
  138. package/src/generators/remove-custom-message/generator.d.ts +4 -0
  139. package/src/generators/remove-custom-message/generator.js +259 -0
  140. package/src/generators/remove-custom-message/schema.d.ts +6 -0
  141. package/src/generators/remove-custom-message/schema.js +16 -0
  142. package/src/generators/remove-custom-message/schema.json +39 -0
  143. package/src/generators/shared/bot-app-utils.d.ts +25 -0
  144. package/src/generators/shared/bot-app-utils.js +209 -0
  145. package/src/generators/webview/files/__name__.spec.tsx.template +20 -0
  146. package/src/generators/webview/files/__name__.tsx.template +19 -0
  147. package/src/generators/webview/generator.d.ts +4 -0
  148. package/src/generators/webview/generator.js +179 -0
  149. package/src/generators/webview/schema.d.ts +5 -0
  150. package/src/generators/webview/schema.js +16 -0
  151. package/src/generators/webview/schema.json +34 -0
  152. package/src/index.d.ts +7 -0
  153. package/src/index.js +56 -0
  154. package/src/lib/api-service.d.ts +110 -0
  155. package/src/lib/api-service.js +591 -0
  156. package/src/lib/bot-config.d.ts +30 -0
  157. package/src/lib/bot-config.js +203 -0
  158. package/src/lib/cloudflared-tunnel.d.ts +29 -0
  159. package/src/lib/cloudflared-tunnel.js +95 -0
  160. package/src/lib/constants.d.ts +13 -0
  161. package/src/lib/constants.js +60 -0
  162. package/src/lib/credentials-handler.d.ts +40 -0
  163. package/src/lib/credentials-handler.js +115 -0
  164. package/src/lib/index.d.ts +10 -0
  165. package/src/lib/index.js +47 -0
  166. package/src/lib/interfaces.d.ts +49 -0
  167. package/src/lib/interfaces.js +16 -0
  168. package/src/lib/util/executor-helpers.d.ts +97 -0
  169. package/src/lib/util/executor-helpers.js +574 -0
  170. package/src/lib/util/file-system.d.ts +8 -0
  171. package/src/lib/util/file-system.js +65 -0
  172. package/src/lib/util/sam-container-cleanup.d.ts +11 -0
  173. package/src/lib/util/sam-container-cleanup.js +55 -0
  174. package/src/lib/util/sam-template.d.ts +9 -0
  175. package/src/lib/util/sam-template.js +71 -0
  176. package/src/lib/util/system.d.ts +1 -0
  177. package/src/lib/util/system.js +30 -0
  178. package/src/migrations/add-botonic-update-bots-skill/add-botonic-update-bots-skill.migration.d.ts +2 -0
  179. package/src/migrations/add-botonic-update-bots-skill/add-botonic-update-bots-skill.migration.js +52 -0
  180. package/src/migrations/add-botonic-update-bots-skill/add-botonic-update-bots-skill.migration.md +23 -0
  181. package/src/migrations/add-botonic-update-bots-skill/files/.cursor/commands/update-bot.md +5 -0
  182. package/src/migrations/add-botonic-update-bots-skill/files/.cursor/commands/update-botonic.md +5 -0
  183. package/src/migrations/add-botonic-update-bots-skill/files/.cursor/scripts/update-bot/discover-bots.sh +67 -0
  184. package/src/migrations/add-botonic-update-bots-skill/files/.cursor/scripts/update-bot/find-migration-guides.sh +70 -0
  185. package/src/migrations/add-botonic-update-bots-skill/schema.json +5 -0
  186. package/src/migrations/add-lilara-registry/add-lilara-registry.migration.d.ts +2 -0
  187. package/src/migrations/add-lilara-registry/add-lilara-registry.migration.js +49 -0
  188. package/src/migrations/add-lilara-registry/schema.json +5 -0
  189. package/src/migrations/fix-css-code-split/fix-css-code-split.migration.md +45 -0
  190. package/src/migrations/remove-codeartifact-registry/remove-codeartifact-registry.migration.d.ts +2 -0
  191. package/src/migrations/remove-codeartifact-registry/remove-codeartifact-registry.migration.js +59 -0
  192. package/src/migrations/remove-codeartifact-registry/schema.json +5 -0
  193. package/src/migrations/sync-pending-bot-migrations/schema.json +5 -0
  194. package/src/migrations/sync-pending-bot-migrations/sync-pending-bot-migrations.migration.d.ts +2 -0
  195. package/src/migrations/sync-pending-bot-migrations/sync-pending-bot-migrations.migration.js +137 -0
  196. package/src/migrations/sync-pending-bot-migrations/sync-pending-bot-migrations.migration.md +19 -0
  197. package/src/migrations/update-cursor-commands-to-stubs/schema.json +5 -0
  198. package/src/migrations/update-cursor-commands-to-stubs/update-cursor-commands-to-stubs.migration.d.ts +2 -0
  199. package/src/migrations/update-cursor-commands-to-stubs/update-cursor-commands-to-stubs.migration.js +61 -0
  200. package/src/migrations/update-pnpm-workspace-scripts/schema.json +4 -0
  201. package/src/migrations/update-pnpm-workspace-scripts/update-pnpm-workspace-scripts.migration.d.ts +2 -0
  202. package/src/migrations/update-pnpm-workspace-scripts/update-pnpm-workspace-scripts.migration.js +47 -0
  203. package/src/migrations/utils/migration-utils.d.ts +109 -0
  204. package/src/migrations/utils/migration-utils.js +448 -0
  205. package/src/plugin.d.ts +15 -0
  206. package/src/plugin.js +246 -0
@@ -0,0 +1,155 @@
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 executor_exports = {};
20
+ __export(executor_exports, {
21
+ default: () => integrateProviderExecutor
22
+ });
23
+ module.exports = __toCommonJS(executor_exports);
24
+ var import_enquirer = require("enquirer");
25
+ var import_path = require("path");
26
+ var import_api_service = require("../../lib/api-service");
27
+ var import_executor_helpers = require("../../lib/util/executor-helpers");
28
+ let PROJECT_ROOT;
29
+ async function integrateProviderExecutor(options, context) {
30
+ PROJECT_ROOT = (0, import_executor_helpers.resolveProjectPath)(context);
31
+ try {
32
+ const { targetEnvironment, environmentVariables } = (0, import_executor_helpers.resolveHubtypeEnvironment)(context, options);
33
+ const botonicApiService = new import_api_service.BotonicAPIService({
34
+ projectRoot: PROJECT_ROOT,
35
+ workspaceRoot: (0, import_path.resolve)(context.root),
36
+ environmentVariables,
37
+ targetEnvironment
38
+ });
39
+ if (!botonicApiService.oauth) {
40
+ await (0, import_executor_helpers.handleAuthentication)(botonicApiService);
41
+ }
42
+ await (0, import_executor_helpers.logWorkingAsAndEnvironment)(botonicApiService);
43
+ console.log("\u{1F517} Creating webchat integration...\n");
44
+ let selectedBot;
45
+ if (options.botId) {
46
+ selectedBot = await handleBotFromId(botonicApiService, options.botId);
47
+ } else if (options.botName) {
48
+ selectedBot = await handleBotFromName(botonicApiService, options.botName);
49
+ } else {
50
+ selectedBot = await handleBotSelection(botonicApiService);
51
+ }
52
+ const integration = await createWebchatIntegration(
53
+ botonicApiService,
54
+ selectedBot,
55
+ options.integrationName
56
+ );
57
+ if (integration?.data?.provider_account?.id) {
58
+ await (0, import_executor_helpers.writeAppIdToLocalEnv)(
59
+ PROJECT_ROOT,
60
+ integration.data.provider_account.id
61
+ );
62
+ }
63
+ return { success: true };
64
+ } catch (error) {
65
+ return (0, import_executor_helpers.handleExecutorError)(error, "Integration creation");
66
+ }
67
+ }
68
+ async function handleBotFromId(botonicApiService, botId) {
69
+ const bots = await (0, import_executor_helpers.getAvailableBots)(botonicApiService);
70
+ const bot = bots.find((b) => b.id === botId);
71
+ if (!bot) {
72
+ throw new Error(`Bot with ID "${botId}" not found`);
73
+ }
74
+ console.log(`\u2705 Selected bot: ${bot.name}`);
75
+ return bot;
76
+ }
77
+ async function handleBotFromName(botonicApiService, botName) {
78
+ const bots = await (0, import_executor_helpers.getAvailableBots)(botonicApiService);
79
+ const bot = bots.find((b) => b.name === botName);
80
+ if (!bot) {
81
+ throw new Error(`Bot with name "${botName}" not found`);
82
+ }
83
+ console.log(`\u2705 Selected bot: ${bot.name}`);
84
+ return bot;
85
+ }
86
+ async function handleBotSelection(botonicApiService) {
87
+ const bots = await (0, import_executor_helpers.getAvailableBots)(botonicApiService);
88
+ if (!bots.length) {
89
+ throw new Error("No bots found. Please create a bot first.");
90
+ }
91
+ console.log("\u{1F4CB} Select a bot to create integration for:\n");
92
+ const response = await (0, import_enquirer.prompt)({
93
+ type: "select",
94
+ name: "bot_id",
95
+ message: "\u{1F916} Please select a bot:",
96
+ choices: bots.map((bot2) => ({
97
+ name: bot2.id,
98
+ message: bot2.name
99
+ }))
100
+ });
101
+ const selectedBotId = response.bot_id;
102
+ const bot = bots.find((bot2) => bot2.id === selectedBotId);
103
+ if (bot) {
104
+ console.log(`\u2705 Selected bot: ${bot.name}`);
105
+ return bot;
106
+ } else {
107
+ throw new Error("Bot selection failed");
108
+ }
109
+ }
110
+ async function createWebchatIntegration(botonicApiService, bot, integrationName) {
111
+ let name = integrationName;
112
+ if (!name) {
113
+ const response = await (0, import_enquirer.prompt)({
114
+ type: "input",
115
+ name: "integration_name",
116
+ message: "\u{1F517} Integration name:",
117
+ validate: (input) => {
118
+ return input.length > 0 ? true : "Integration name cannot be empty";
119
+ }
120
+ });
121
+ name = response.integration_name;
122
+ }
123
+ console.log(
124
+ `\u{1F517} Creating webchat integration "${name}" for bot "${bot.name}"...`
125
+ );
126
+ try {
127
+ if (!name) {
128
+ throw new Error("Integration name is required");
129
+ }
130
+ const integration = await botonicApiService.createWebchatIntegration(
131
+ bot.id,
132
+ name
133
+ );
134
+ console.log("\u2705 Webchat integration created successfully!");
135
+ console.log("\u{1F389} Your bot is now ready to receive webchat messages!");
136
+ if (integration.data) {
137
+ const appId = integration.data.provider_account.id || "N/A";
138
+ const netlifyUrl = integration.data.provider_account.netlify_url || "N/A";
139
+ console.log(`\u{1F4CB} APP ID: ${appId}`);
140
+ console.log(
141
+ `\u{1F4CB} DEPLOYED TO NETLIFY STATIC HOSTING SERVICE: ${netlifyUrl}`
142
+ );
143
+ console.log(`::set-output name=app_id::${appId}`);
144
+ console.log(`::set-output name=netlify_url::${netlifyUrl}`);
145
+ console.log(`INTEGRATION_APP_ID=${appId}`);
146
+ console.log(`INTEGRATION_NETLIFY_URL=${netlifyUrl}`);
147
+ }
148
+ return integration;
149
+ } catch (error) {
150
+ if (error.response?.status === 400) {
151
+ throw new Error("Integration with this name already exists for this bot");
152
+ }
153
+ throw error;
154
+ }
155
+ }
@@ -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 schema_d_exports = {};
16
+ module.exports = __toCommonJS(schema_d_exports);
@@ -0,0 +1,30 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "IntegrateProviderExecutor",
4
+ "title": "Integrate provider executor",
5
+ "type": "object",
6
+ "properties": {
7
+ "configuration": {
8
+ "type": "string",
9
+ "enum": ["local", "dev", "dev2", "qa", "prod"],
10
+ "description": "Environment to integrate provider"
11
+ },
12
+ "command": {
13
+ "type": "string",
14
+ "description": "Command to execute from the package scripts object"
15
+ },
16
+ "integrationName": {
17
+ "type": "string",
18
+ "description": "Name of the integration"
19
+ },
20
+ "botId": {
21
+ "type": "string",
22
+ "description": "Id of the bot"
23
+ },
24
+ "botName": {
25
+ "type": "string",
26
+ "description": "Name of the bot (alternative to botId)"
27
+ }
28
+ },
29
+ "additionalProperties": true
30
+ }
@@ -0,0 +1,5 @@
1
+ import type { ExecutorContext } from '@nx/devkit';
2
+ import type { LoginToHubtypeExecutorSchema } from './schema';
3
+ export default function loginToHubtypeExecutor(options: LoginToHubtypeExecutorSchema, context: ExecutorContext): Promise<{
4
+ success: boolean;
5
+ }>;
@@ -0,0 +1,79 @@
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 executor_exports = {};
20
+ __export(executor_exports, {
21
+ default: () => loginToHubtypeExecutor
22
+ });
23
+ module.exports = __toCommonJS(executor_exports);
24
+ var import_enquirer = require("enquirer");
25
+ var import_path = require("path");
26
+ var import_api_service = require("../../lib/api-service");
27
+ var import_executor_helpers = require("../../lib/util/executor-helpers");
28
+ async function loginToHubtypeExecutor(options, context) {
29
+ try {
30
+ const projectRoot = (0, import_executor_helpers.resolveProjectPath)(context);
31
+ const { targetEnvironment, environmentVariables } = (0, import_executor_helpers.resolveHubtypeEnvironment)(context, options);
32
+ const botonicApiService = new import_api_service.BotonicAPIService({
33
+ projectRoot,
34
+ workspaceRoot: (0, import_path.resolve)(context.root),
35
+ environmentVariables,
36
+ targetEnvironment
37
+ });
38
+ console.log(`\u{1F510} Logging in to Hubtype...[${botonicApiService.baseUrl}]
39
+ `);
40
+ const emailResponse = await (0, import_enquirer.prompt)({
41
+ type: "input",
42
+ name: "email",
43
+ message: "\u{1F4E7} Email:",
44
+ validate: (input) => {
45
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
46
+ return emailRegex.test(input) ? true : "Please enter a valid email address";
47
+ }
48
+ });
49
+ const passwordResponse = await (0, import_enquirer.prompt)({
50
+ type: "password",
51
+ name: "password",
52
+ message: "\u{1F511} Password:",
53
+ validate: (input) => {
54
+ return input.length > 0 ? true : "Password cannot be empty";
55
+ }
56
+ });
57
+ const email = emailResponse.email;
58
+ const password = passwordResponse.password;
59
+ console.log("\n\u{1F512} Authenticating with Hubtype...");
60
+ await botonicApiService.login(email, password);
61
+ botonicApiService.saveAllCredentials();
62
+ await (0, import_executor_helpers.logWorkingAsAndEnvironment)(botonicApiService);
63
+ console.log("\u2705 Authentication successful!");
64
+ console.log("\u{1F680} You are now logged in and ready to use Botonic!");
65
+ return { success: true };
66
+ } catch (error) {
67
+ console.error("\u274C Authentication failed");
68
+ if (error.response?.data?.error_description) {
69
+ console.error(` ${error.response.data.error_description}`);
70
+ } else if (error.message) {
71
+ console.error(` ${error.message}`);
72
+ } else {
73
+ console.error(" An unexpected error occurred. Please try again.");
74
+ }
75
+ console.error("\n\u{1F4A1} Need help? Check your credentials and try again.");
76
+ console.error("\u{1F517} Visit https://botonic.io for support");
77
+ return { success: false };
78
+ }
79
+ }
@@ -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 schema_d_exports = {};
16
+ module.exports = __toCommonJS(schema_d_exports);
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "version": 2,
4
+ "title": "LoginToHubtype executor",
5
+ "description": "Login to Hubtype",
6
+ "type": "object",
7
+ "properties": {
8
+ "configuration": {
9
+ "type": "string",
10
+ "enum": ["local", "dev", "dev2", "qa", "prod"],
11
+ "description": "Environment to login to"
12
+ },
13
+ "email": {
14
+ "type": "string",
15
+ "description": "Email to login to Hubtype",
16
+ "default": ""
17
+ },
18
+ "password": {
19
+ "type": "string",
20
+ "description": "Password to login to Hubtype",
21
+ "default": ""
22
+ }
23
+ },
24
+ "required": []
25
+ }
@@ -0,0 +1,3 @@
1
+ import type { ExecutorContext } from '@nx/devkit';
2
+ import type { LogoutFromHubtypeExecutorSchema } from './schema';
3
+ export default function logoutFromHubtypeExecutor(options: LogoutFromHubtypeExecutorSchema, context: ExecutorContext): Promise<void>;
@@ -0,0 +1,54 @@
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 executor_exports = {};
20
+ __export(executor_exports, {
21
+ default: () => logoutFromHubtypeExecutor
22
+ });
23
+ module.exports = __toCommonJS(executor_exports);
24
+ var import_fs_extra = require("fs-extra");
25
+ var import_os = require("os");
26
+ var import_path = require("path");
27
+ var import_constants = require("../../lib/constants");
28
+ async function logoutFromHubtypeExecutor(options, context) {
29
+ console.log("\u{1F510} Logging out from Hubtype...\n");
30
+ const homeCredsPath = (0, import_path.join)(
31
+ (0, import_os.homedir)(),
32
+ import_constants.BOTONIC_HOME_DIRNAME,
33
+ import_constants.GLOBAL_CREDS_FILENAME
34
+ );
35
+ const workspaceCredsPath = (0, import_path.join)(
36
+ (0, import_path.resolve)(context.root),
37
+ import_constants.BOTONIC_HOME_DIRNAME,
38
+ import_constants.GLOBAL_CREDS_FILENAME
39
+ );
40
+ let removed = false;
41
+ if (await (0, import_fs_extra.pathExists)(workspaceCredsPath)) {
42
+ (0, import_fs_extra.rmSync)(workspaceCredsPath, { force: true });
43
+ removed = true;
44
+ }
45
+ if (await (0, import_fs_extra.pathExists)(homeCredsPath)) {
46
+ (0, import_fs_extra.rmSync)(homeCredsPath, { force: true });
47
+ removed = true;
48
+ }
49
+ if (!removed) {
50
+ console.log("Already logged out...\n");
51
+ }
52
+ console.log("\u2705 Logout successful!");
53
+ process.exit(0);
54
+ }
@@ -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 schema_d_exports = {};
16
+ module.exports = __toCommonJS(schema_d_exports);
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "version": 2,
4
+ "title": "LogoutFromHubtype executor",
5
+ "description": "Logout from Hubtype",
6
+ "type": "object",
7
+ "properties": {},
8
+ "required": []
9
+ }
@@ -0,0 +1,5 @@
1
+ import type { ExecutorContext } from '@nx/devkit';
2
+ import type { RunLambdaExecutorSchema } from './schema';
3
+ export default function runLambdaExecutor(options: RunLambdaExecutorSchema, context: ExecutorContext): Promise<{
4
+ success: boolean;
5
+ }>;
@@ -0,0 +1,65 @@
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 executor_exports = {};
20
+ __export(executor_exports, {
21
+ default: () => runLambdaExecutor
22
+ });
23
+ module.exports = __toCommonJS(executor_exports);
24
+ var import_child_process = require("child_process");
25
+ var import_path = require("path");
26
+ var import_executor_helpers = require("../../lib/util/executor-helpers");
27
+ async function runLambdaExecutor(options, context) {
28
+ const projectRoot = (0, import_executor_helpers.resolveProjectPath)(context);
29
+ const lambdaPath = options.lambdaPath || "src/server/lambda";
30
+ const samCommand = options.samCommand || "sam local start-lambda";
31
+ const fullLambdaPath = (0, import_path.join)(projectRoot, lambdaPath);
32
+ console.info(`\u{1F680} Starting AWS SAM local lambda server...`);
33
+ console.info(`\u{1F4C1} Lambda directory: ${fullLambdaPath}`);
34
+ console.info(`\u{1F527} Command: ${samCommand}`);
35
+ return new Promise((resolve) => {
36
+ const [executable, ...args] = samCommand.split(" ");
37
+ const child = (0, import_child_process.spawn)(executable, args, {
38
+ cwd: fullLambdaPath,
39
+ stdio: "inherit",
40
+ // This will pipe stdout/stderr directly to the console
41
+ shell: true
42
+ });
43
+ child.on("error", (error) => {
44
+ console.error(`\u274C Error running lambda server:`, error.message);
45
+ resolve({ success: false });
46
+ });
47
+ child.on("close", (code) => {
48
+ if (code === 0) {
49
+ console.log("\u2705 Lambda server stopped successfully");
50
+ resolve({ success: true });
51
+ } else {
52
+ console.error(`\u274C Lambda server exited with code ${code}`);
53
+ resolve({ success: false });
54
+ }
55
+ });
56
+ process.on("SIGINT", () => {
57
+ console.log("\n\u{1F6D1} Stopping lambda server...");
58
+ child.kill("SIGINT");
59
+ });
60
+ process.on("SIGTERM", () => {
61
+ console.log("\n\u{1F6D1} Stopping lambda server...");
62
+ child.kill("SIGTERM");
63
+ });
64
+ });
65
+ }
@@ -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 schema_d_exports = {};
16
+ module.exports = __toCommonJS(schema_d_exports);
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "version": 2,
4
+ "title": "RunLambda executor",
5
+ "description": "Run AWS SAM local lambda server",
6
+ "type": "object",
7
+ "properties": {
8
+ "lambdaPath": {
9
+ "type": "string",
10
+ "description": "Relative path to the lambda directory from project root",
11
+ "default": "src/server/lambda"
12
+ },
13
+ "samCommand": {
14
+ "type": "string",
15
+ "description": "SAM command to run",
16
+ "default": "sam local start-lambda --warm-containers EAGER --skip-pull-image"
17
+ }
18
+ },
19
+ "required": []
20
+ }
@@ -0,0 +1,5 @@
1
+ import type { ExecutorContext } from '@nx/devkit';
2
+ import type { ServeBotExecutorSchema } from './schema';
3
+ export default function serveBotExecutor(options: ServeBotExecutorSchema, context: ExecutorContext): Promise<{
4
+ success: boolean;
5
+ }>;