@botonic/nx-plugin 2.31.0 → 2.32.0-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.
Files changed (78) hide show
  1. package/migrations.json +1 -8
  2. package/package.json +7 -4
  3. package/src/executors/build-node-app/executor-impl.d.ts +5 -0
  4. package/src/executors/build-node-app/executor-impl.js +65 -0
  5. package/src/executors/build-node-app/executor.d.ts +4 -2
  6. package/src/executors/build-node-app/executor.js +3 -41
  7. package/src/executors/delete-bot/executor-impl.d.ts +5 -0
  8. package/src/executors/delete-bot/executor-impl.js +110 -0
  9. package/src/executors/delete-bot/executor.d.ts +4 -2
  10. package/src/executors/delete-bot/executor.js +3 -86
  11. package/src/executors/deploy-netlify-snapshot/executor-impl.d.ts +8 -0
  12. package/src/executors/deploy-netlify-snapshot/executor-impl.js +79 -0
  13. package/src/executors/deploy-netlify-snapshot/executor.d.ts +4 -5
  14. package/src/executors/deploy-netlify-snapshot/executor.js +3 -55
  15. package/src/executors/deploy-to-hubtype/executor-impl.d.ts +5 -0
  16. package/src/executors/deploy-to-hubtype/executor-impl.js +172 -0
  17. package/src/executors/deploy-to-hubtype/executor.d.ts +4 -2
  18. package/src/executors/deploy-to-hubtype/executor.js +3 -148
  19. package/src/executors/e2e-webchat/executor-impl.d.ts +5 -0
  20. package/src/executors/e2e-webchat/executor-impl.js +134 -0
  21. package/src/executors/e2e-webchat/executor.d.ts +4 -2
  22. package/src/executors/e2e-webchat/executor.js +4 -111
  23. package/src/executors/integrate-provider/executor-impl.d.ts +5 -0
  24. package/src/executors/integrate-provider/executor-impl.js +153 -0
  25. package/src/executors/integrate-provider/executor.d.ts +4 -2
  26. package/src/executors/integrate-provider/executor.js +3 -129
  27. package/src/executors/login-to-hubtype/executor-impl.d.ts +5 -0
  28. package/src/executors/login-to-hubtype/executor-impl.js +77 -0
  29. package/src/executors/login-to-hubtype/executor.d.ts +4 -2
  30. package/src/executors/login-to-hubtype/executor.js +3 -53
  31. package/src/executors/logout-from-hubtype/executor-impl.d.ts +3 -0
  32. package/src/executors/logout-from-hubtype/executor-impl.js +54 -0
  33. package/src/executors/logout-from-hubtype/executor.d.ts +5 -1
  34. package/src/executors/logout-from-hubtype/executor.js +3 -30
  35. package/src/executors/run-lambda/executor-impl.d.ts +5 -0
  36. package/src/executors/run-lambda/executor-impl.js +65 -0
  37. package/src/executors/run-lambda/executor.d.ts +4 -2
  38. package/src/executors/run-lambda/executor.js +3 -41
  39. package/src/executors/serve-bot/executor-impl.d.ts +5 -0
  40. package/src/executors/serve-bot/executor-impl.js +530 -0
  41. package/src/executors/serve-bot/executor.d.ts +4 -2
  42. package/src/executors/serve-bot/executor.js +3 -506
  43. package/src/generators/action/generator-impl.d.ts +4 -0
  44. package/src/generators/action/generator-impl.js +112 -0
  45. package/src/generators/action/generator.d.ts +2 -3
  46. package/src/generators/action/generator.js +2 -87
  47. package/src/generators/bot-app/files/vite/webchat.config.ts.template +10 -2
  48. package/src/generators/bot-app/generator-impl.d.ts +4 -0
  49. package/src/generators/bot-app/generator-impl.js +328 -0
  50. package/src/generators/bot-app/generator.d.ts +2 -4
  51. package/src/generators/bot-app/generator.js +2 -295
  52. package/src/generators/custom-message/generator-impl.d.ts +4 -0
  53. package/src/generators/custom-message/generator-impl.js +235 -0
  54. package/src/generators/custom-message/generator.d.ts +2 -3
  55. package/src/generators/custom-message/generator.js +2 -210
  56. package/src/generators/preset/generator-impl.d.ts +4 -0
  57. package/src/generators/preset/generator-impl.js +127 -0
  58. package/src/generators/preset/generator.d.ts +2 -4
  59. package/src/generators/preset/generator.js +2 -95
  60. package/src/generators/remove-custom-message/generator-impl.d.ts +4 -0
  61. package/src/generators/remove-custom-message/generator-impl.js +259 -0
  62. package/src/generators/remove-custom-message/generator.d.ts +2 -3
  63. package/src/generators/remove-custom-message/generator.js +2 -234
  64. package/src/generators/webview/generator-impl.d.ts +4 -0
  65. package/src/generators/webview/generator-impl.js +179 -0
  66. package/src/generators/webview/generator.d.ts +2 -3
  67. package/src/generators/webview/generator.js +2 -154
  68. package/src/index.d.ts +1 -0
  69. package/src/index.js +3 -1
  70. package/src/lib/delegate/delegate-executor.d.ts +6 -0
  71. package/src/lib/delegate/delegate-executor.js +119 -0
  72. package/src/lib/delegate/delegate-generator.d.ts +2 -0
  73. package/src/lib/delegate/delegate-generator.js +128 -0
  74. package/src/lib/serve-mode/index.d.ts +25 -0
  75. package/src/lib/serve-mode/index.js +183 -0
  76. package/src/generators/bot-app/files/vite/plugins/dev-log-viewer-html.plugin.ts.template +0 -65
  77. package/src/migrations/install-claude-update-skills/install-claude-update-skills.migration.d.ts +0 -2
  78. package/src/migrations/install-claude-update-skills/install-claude-update-skills.migration.js +0 -290
@@ -0,0 +1,153 @@
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_impl_exports = {};
20
+ __export(executor_impl_exports, {
21
+ default: () => integrateProviderExecutor
22
+ });
23
+ module.exports = __toCommonJS(executor_impl_exports);
24
+ var import_enquirer = require("enquirer");
25
+ var import_api_service = require("../../lib/api-service");
26
+ var import_executor_helpers = require("../../lib/util/executor-helpers");
27
+ let PROJECT_ROOT;
28
+ async function integrateProviderExecutor(options, context) {
29
+ PROJECT_ROOT = (0, import_executor_helpers.resolveProjectPath)(context);
30
+ try {
31
+ const { targetEnvironment, environmentVariables } = (0, import_executor_helpers.resolveHubtypeEnvironment)(context, options);
32
+ const botonicApiService = new import_api_service.BotonicAPIService({
33
+ projectRoot: PROJECT_ROOT,
34
+ environmentVariables,
35
+ targetEnvironment
36
+ });
37
+ if (!botonicApiService.oauth) {
38
+ await (0, import_executor_helpers.handleAuthentication)(botonicApiService);
39
+ }
40
+ await (0, import_executor_helpers.logWorkingAsAndEnvironment)(botonicApiService);
41
+ console.log("\u{1F517} Creating webchat integration...\n");
42
+ let selectedBot;
43
+ if (options.botId) {
44
+ selectedBot = await handleBotFromId(botonicApiService, options.botId);
45
+ } else if (options.botName) {
46
+ selectedBot = await handleBotFromName(botonicApiService, options.botName);
47
+ } else {
48
+ selectedBot = await handleBotSelection(botonicApiService);
49
+ }
50
+ const integration = await createWebchatIntegration(
51
+ botonicApiService,
52
+ selectedBot,
53
+ options.integrationName
54
+ );
55
+ if (integration?.data?.provider_account?.id) {
56
+ await (0, import_executor_helpers.writeAppIdToLocalEnv)(
57
+ PROJECT_ROOT,
58
+ integration.data.provider_account.id
59
+ );
60
+ }
61
+ return { success: true };
62
+ } catch (error) {
63
+ return (0, import_executor_helpers.handleExecutorError)(error, "Integration creation");
64
+ }
65
+ }
66
+ async function handleBotFromId(botonicApiService, botId) {
67
+ const bots = await (0, import_executor_helpers.getAvailableBots)(botonicApiService);
68
+ const bot = bots.find((b) => b.id === botId);
69
+ if (!bot) {
70
+ throw new Error(`Bot with ID "${botId}" not found`);
71
+ }
72
+ console.log(`\u2705 Selected bot: ${bot.name}`);
73
+ return bot;
74
+ }
75
+ async function handleBotFromName(botonicApiService, botName) {
76
+ const bots = await (0, import_executor_helpers.getAvailableBots)(botonicApiService);
77
+ const bot = bots.find((b) => b.name === botName);
78
+ if (!bot) {
79
+ throw new Error(`Bot with name "${botName}" not found`);
80
+ }
81
+ console.log(`\u2705 Selected bot: ${bot.name}`);
82
+ return bot;
83
+ }
84
+ async function handleBotSelection(botonicApiService) {
85
+ const bots = await (0, import_executor_helpers.getAvailableBots)(botonicApiService);
86
+ if (!bots.length) {
87
+ throw new Error("No bots found. Please create a bot first.");
88
+ }
89
+ console.log("\u{1F4CB} Select a bot to create integration for:\n");
90
+ const response = await (0, import_enquirer.prompt)({
91
+ type: "select",
92
+ name: "bot_id",
93
+ message: "\u{1F916} Please select a bot:",
94
+ choices: bots.map((bot2) => ({
95
+ name: bot2.id,
96
+ message: bot2.name
97
+ }))
98
+ });
99
+ const selectedBotId = response.bot_id;
100
+ const bot = bots.find((bot2) => bot2.id === selectedBotId);
101
+ if (bot) {
102
+ console.log(`\u2705 Selected bot: ${bot.name}`);
103
+ return bot;
104
+ } else {
105
+ throw new Error("Bot selection failed");
106
+ }
107
+ }
108
+ async function createWebchatIntegration(botonicApiService, bot, integrationName) {
109
+ let name = integrationName;
110
+ if (!name) {
111
+ const response = await (0, import_enquirer.prompt)({
112
+ type: "input",
113
+ name: "integration_name",
114
+ message: "\u{1F517} Integration name:",
115
+ validate: (input) => {
116
+ return input.length > 0 ? true : "Integration name cannot be empty";
117
+ }
118
+ });
119
+ name = response.integration_name;
120
+ }
121
+ console.log(
122
+ `\u{1F517} Creating webchat integration "${name}" for bot "${bot.name}"...`
123
+ );
124
+ try {
125
+ if (!name) {
126
+ throw new Error("Integration name is required");
127
+ }
128
+ const integration = await botonicApiService.createWebchatIntegration(
129
+ bot.id,
130
+ name
131
+ );
132
+ console.log("\u2705 Webchat integration created successfully!");
133
+ console.log("\u{1F389} Your bot is now ready to receive webchat messages!");
134
+ if (integration.data) {
135
+ const appId = integration.data.provider_account.id || "N/A";
136
+ const netlifyUrl = integration.data.provider_account.netlify_url || "N/A";
137
+ console.log(`\u{1F4CB} APP ID: ${appId}`);
138
+ console.log(
139
+ `\u{1F4CB} DEPLOYED TO NETLIFY STATIC HOSTING SERVICE: ${netlifyUrl}`
140
+ );
141
+ console.log(`::set-output name=app_id::${appId}`);
142
+ console.log(`::set-output name=netlify_url::${netlifyUrl}`);
143
+ console.log(`INTEGRATION_APP_ID=${appId}`);
144
+ console.log(`INTEGRATION_NETLIFY_URL=${netlifyUrl}`);
145
+ }
146
+ return integration;
147
+ } catch (error) {
148
+ if (error.response?.status === 400) {
149
+ throw new Error("Integration with this name already exists for this bot");
150
+ }
151
+ throw error;
152
+ }
153
+ }
@@ -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, context: ExecutorContext): Promise<{
3
+ export default function integrateProviderExecutor(options: IntegrateProviderExecutorSchema, ctx: ExecutorContext): Promise<{
4
4
  success: boolean;
5
- }>;
5
+ } | AsyncIterableIterator<{
6
+ success: boolean;
7
+ }>>;
@@ -21,133 +21,7 @@ __export(executor_exports, {
21
21
  default: () => integrateProviderExecutor
22
22
  });
23
23
  module.exports = __toCommonJS(executor_exports);
24
- var import_enquirer = require("enquirer");
25
- var import_api_service = require("../../lib/api-service");
26
- var import_executor_helpers = require("../../lib/util/executor-helpers");
27
- let PROJECT_ROOT;
28
- async function integrateProviderExecutor(options, context) {
29
- PROJECT_ROOT = (0, import_executor_helpers.resolveProjectPath)(context);
30
- try {
31
- const { targetEnvironment, environmentVariables } = (0, import_executor_helpers.resolveHubtypeEnvironment)(context, options);
32
- const botonicApiService = new import_api_service.BotonicAPIService({
33
- projectRoot: PROJECT_ROOT,
34
- environmentVariables,
35
- targetEnvironment
36
- });
37
- if (!botonicApiService.oauth) {
38
- await (0, import_executor_helpers.handleAuthentication)(botonicApiService);
39
- }
40
- await (0, import_executor_helpers.logWorkingAsAndEnvironment)(botonicApiService);
41
- console.log("\u{1F517} Creating webchat integration...\n");
42
- let selectedBot;
43
- if (options.botId) {
44
- selectedBot = await handleBotFromId(botonicApiService, options.botId);
45
- } else if (options.botName) {
46
- selectedBot = await handleBotFromName(botonicApiService, options.botName);
47
- } else {
48
- selectedBot = await handleBotSelection(botonicApiService);
49
- }
50
- const integration = await createWebchatIntegration(
51
- botonicApiService,
52
- selectedBot,
53
- options.integrationName
54
- );
55
- if (integration?.data?.provider_account?.id) {
56
- await (0, import_executor_helpers.writeAppIdToLocalEnv)(
57
- PROJECT_ROOT,
58
- integration.data.provider_account.id
59
- );
60
- }
61
- return { success: true };
62
- } catch (error) {
63
- return (0, import_executor_helpers.handleExecutorError)(error, "Integration creation");
64
- }
65
- }
66
- async function handleBotFromId(botonicApiService, botId) {
67
- const bots = await (0, import_executor_helpers.getAvailableBots)(botonicApiService);
68
- const bot = bots.find((b) => b.id === botId);
69
- if (!bot) {
70
- throw new Error(`Bot with ID "${botId}" not found`);
71
- }
72
- console.log(`\u2705 Selected bot: ${bot.name}`);
73
- return bot;
74
- }
75
- async function handleBotFromName(botonicApiService, botName) {
76
- const bots = await (0, import_executor_helpers.getAvailableBots)(botonicApiService);
77
- const bot = bots.find((b) => b.name === botName);
78
- if (!bot) {
79
- throw new Error(`Bot with name "${botName}" not found`);
80
- }
81
- console.log(`\u2705 Selected bot: ${bot.name}`);
82
- return bot;
83
- }
84
- async function handleBotSelection(botonicApiService) {
85
- const bots = await (0, import_executor_helpers.getAvailableBots)(botonicApiService);
86
- if (!bots.length) {
87
- throw new Error("No bots found. Please create a bot first.");
88
- }
89
- console.log("\u{1F4CB} Select a bot to create integration for:\n");
90
- const response = await (0, import_enquirer.prompt)({
91
- type: "select",
92
- name: "bot_id",
93
- message: "\u{1F916} Please select a bot:",
94
- choices: bots.map((bot2) => ({
95
- name: bot2.id,
96
- message: bot2.name
97
- }))
98
- });
99
- const selectedBotId = response.bot_id;
100
- const bot = bots.find((bot2) => bot2.id === selectedBotId);
101
- if (bot) {
102
- console.log(`\u2705 Selected bot: ${bot.name}`);
103
- return bot;
104
- } else {
105
- throw new Error("Bot selection failed");
106
- }
107
- }
108
- async function createWebchatIntegration(botonicApiService, bot, integrationName) {
109
- let name = integrationName;
110
- if (!name) {
111
- const response = await (0, import_enquirer.prompt)({
112
- type: "input",
113
- name: "integration_name",
114
- message: "\u{1F517} Integration name:",
115
- validate: (input) => {
116
- return input.length > 0 ? true : "Integration name cannot be empty";
117
- }
118
- });
119
- name = response.integration_name;
120
- }
121
- console.log(
122
- `\u{1F517} Creating webchat integration "${name}" for bot "${bot.name}"...`
123
- );
124
- try {
125
- if (!name) {
126
- throw new Error("Integration name is required");
127
- }
128
- const integration = await botonicApiService.createWebchatIntegration(
129
- bot.id,
130
- name
131
- );
132
- console.log("\u2705 Webchat integration created successfully!");
133
- console.log("\u{1F389} Your bot is now ready to receive webchat messages!");
134
- if (integration.data) {
135
- const appId = integration.data.provider_account.id || "N/A";
136
- const netlifyUrl = integration.data.provider_account.netlify_url || "N/A";
137
- console.log(`\u{1F4CB} APP ID: ${appId}`);
138
- console.log(
139
- `\u{1F4CB} DEPLOYED TO NETLIFY STATIC HOSTING SERVICE: ${netlifyUrl}`
140
- );
141
- console.log(`::set-output name=app_id::${appId}`);
142
- console.log(`::set-output name=netlify_url::${netlifyUrl}`);
143
- console.log(`INTEGRATION_APP_ID=${appId}`);
144
- console.log(`INTEGRATION_NETLIFY_URL=${netlifyUrl}`);
145
- }
146
- return integration;
147
- } catch (error) {
148
- if (error.response?.status === 400) {
149
- throw new Error("Integration with this name already exists for this bot");
150
- }
151
- throw error;
152
- }
24
+ var import_delegate_executor = require("../../lib/delegate/delegate-executor");
25
+ async function integrateProviderExecutor(options, ctx) {
26
+ return (0, import_delegate_executor.runLocalExecutor)(__filename, "integrate-provider", options, ctx);
153
27
  }
@@ -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,77 @@
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_impl_exports = {};
20
+ __export(executor_impl_exports, {
21
+ default: () => loginToHubtypeExecutor
22
+ });
23
+ module.exports = __toCommonJS(executor_impl_exports);
24
+ var import_enquirer = require("enquirer");
25
+ var import_api_service = require("../../lib/api-service");
26
+ var import_executor_helpers = require("../../lib/util/executor-helpers");
27
+ async function loginToHubtypeExecutor(options, context) {
28
+ try {
29
+ const projectRoot = (0, import_executor_helpers.resolveProjectPath)(context);
30
+ const { targetEnvironment, environmentVariables } = (0, import_executor_helpers.resolveHubtypeEnvironment)(context, options);
31
+ const botonicApiService = new import_api_service.BotonicAPIService({
32
+ projectRoot,
33
+ environmentVariables,
34
+ targetEnvironment
35
+ });
36
+ console.log(`\u{1F510} Logging in to Hubtype...[${botonicApiService.baseUrl}]
37
+ `);
38
+ const emailResponse = await (0, import_enquirer.prompt)({
39
+ type: "input",
40
+ name: "email",
41
+ message: "\u{1F4E7} Email:",
42
+ validate: (input) => {
43
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
44
+ return emailRegex.test(input) ? true : "Please enter a valid email address";
45
+ }
46
+ });
47
+ const passwordResponse = await (0, import_enquirer.prompt)({
48
+ type: "password",
49
+ name: "password",
50
+ message: "\u{1F511} Password:",
51
+ validate: (input) => {
52
+ return input.length > 0 ? true : "Password cannot be empty";
53
+ }
54
+ });
55
+ const email = emailResponse.email;
56
+ const password = passwordResponse.password;
57
+ console.log("\n\u{1F512} Authenticating with Hubtype...");
58
+ await botonicApiService.login(email, password);
59
+ botonicApiService.saveAllCredentials();
60
+ await (0, import_executor_helpers.logWorkingAsAndEnvironment)(botonicApiService);
61
+ console.log("\u2705 Authentication successful!");
62
+ console.log("\u{1F680} You are now logged in and ready to use Botonic!");
63
+ return { success: true };
64
+ } catch (error) {
65
+ console.error("\u274C Authentication failed");
66
+ if (error.response?.data?.error_description) {
67
+ console.error(` ${error.response.data.error_description}`);
68
+ } else if (error.message) {
69
+ console.error(` ${error.message}`);
70
+ } else {
71
+ console.error(" An unexpected error occurred. Please try again.");
72
+ }
73
+ console.error("\n\u{1F4A1} Need help? Check your credentials and try again.");
74
+ console.error("\u{1F517} Visit https://botonic.io for support");
75
+ return { success: false };
76
+ }
77
+ }
@@ -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, context: ExecutorContext): Promise<{
3
+ export default function loginToHubtypeExecutor(options: LoginToHubtypeExecutorSchema, ctx: ExecutorContext): Promise<{
4
4
  success: boolean;
5
- }>;
5
+ } | AsyncIterableIterator<{
6
+ success: boolean;
7
+ }>>;
@@ -21,57 +21,7 @@ __export(executor_exports, {
21
21
  default: () => loginToHubtypeExecutor
22
22
  });
23
23
  module.exports = __toCommonJS(executor_exports);
24
- var import_enquirer = require("enquirer");
25
- var import_api_service = require("../../lib/api-service");
26
- var import_executor_helpers = require("../../lib/util/executor-helpers");
27
- async function loginToHubtypeExecutor(options, context) {
28
- try {
29
- const projectRoot = (0, import_executor_helpers.resolveProjectPath)(context);
30
- const { targetEnvironment, environmentVariables } = (0, import_executor_helpers.resolveHubtypeEnvironment)(context, options);
31
- const botonicApiService = new import_api_service.BotonicAPIService({
32
- projectRoot,
33
- environmentVariables,
34
- targetEnvironment
35
- });
36
- console.log(`\u{1F510} Logging in to Hubtype...[${botonicApiService.baseUrl}]
37
- `);
38
- const emailResponse = await (0, import_enquirer.prompt)({
39
- type: "input",
40
- name: "email",
41
- message: "\u{1F4E7} Email:",
42
- validate: (input) => {
43
- const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
44
- return emailRegex.test(input) ? true : "Please enter a valid email address";
45
- }
46
- });
47
- const passwordResponse = await (0, import_enquirer.prompt)({
48
- type: "password",
49
- name: "password",
50
- message: "\u{1F511} Password:",
51
- validate: (input) => {
52
- return input.length > 0 ? true : "Password cannot be empty";
53
- }
54
- });
55
- const email = emailResponse.email;
56
- const password = passwordResponse.password;
57
- console.log("\n\u{1F512} Authenticating with Hubtype...");
58
- await botonicApiService.login(email, password);
59
- botonicApiService.saveAllCredentials();
60
- await (0, import_executor_helpers.logWorkingAsAndEnvironment)(botonicApiService);
61
- console.log("\u2705 Authentication successful!");
62
- console.log("\u{1F680} You are now logged in and ready to use Botonic!");
63
- return { success: true };
64
- } catch (error) {
65
- console.error("\u274C Authentication failed");
66
- if (error.response?.data?.error_description) {
67
- console.error(` ${error.response.data.error_description}`);
68
- } else if (error.message) {
69
- console.error(` ${error.message}`);
70
- } else {
71
- console.error(" An unexpected error occurred. Please try again.");
72
- }
73
- console.error("\n\u{1F4A1} Need help? Check your credentials and try again.");
74
- console.error("\u{1F517} Visit https://botonic.io for support");
75
- return { success: false };
76
- }
24
+ var import_delegate_executor = require("../../lib/delegate/delegate-executor");
25
+ async function loginToHubtypeExecutor(options, ctx) {
26
+ return (0, import_delegate_executor.runLocalExecutor)(__filename, "login-to-hubtype", options, ctx);
77
27
  }
@@ -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_impl_exports = {};
20
+ __export(executor_impl_exports, {
21
+ default: () => logoutFromHubtypeExecutor
22
+ });
23
+ module.exports = __toCommonJS(executor_impl_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.ENV_CREDENTIALS_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.ENV_CREDENTIALS_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
+ }
@@ -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, context: ExecutorContext): Promise<void>;
3
+ export default function logoutFromHubtypeExecutor(options: LogoutFromHubtypeExecutorSchema, ctx: ExecutorContext): Promise<{
4
+ success: boolean;
5
+ } | AsyncIterableIterator<{
6
+ success: boolean;
7
+ }>>;
@@ -21,34 +21,7 @@ __export(executor_exports, {
21
21
  default: () => logoutFromHubtypeExecutor
22
22
  });
23
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.ENV_CREDENTIALS_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.ENV_CREDENTIALS_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);
24
+ var import_delegate_executor = require("../../lib/delegate/delegate-executor");
25
+ async function logoutFromHubtypeExecutor(options, ctx) {
26
+ return (0, import_delegate_executor.runLocalExecutor)(__filename, "logout-from-hubtype", options, ctx);
54
27
  }
@@ -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_impl_exports = {};
20
+ __export(executor_impl_exports, {
21
+ default: () => runLambdaExecutor
22
+ });
23
+ module.exports = __toCommonJS(executor_impl_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
+ }
@@ -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, context: ExecutorContext): Promise<{
3
+ export default function runLambdaExecutor(options: RunLambdaExecutorSchema, ctx: ExecutorContext): Promise<{
4
4
  success: boolean;
5
- }>;
5
+ } | AsyncIterableIterator<{
6
+ success: boolean;
7
+ }>>;