zcatalyst-cli 1.25.3 → 1.26.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 (262) hide show
  1. package/lib/api-timer.d.ts +0 -1
  2. package/lib/apig-utils.d.ts +1 -1
  3. package/lib/apig-utils.js +1 -1
  4. package/lib/appsail-utils.js +6 -7
  5. package/lib/archiver.d.ts +0 -4
  6. package/lib/archiver.js +21 -11
  7. package/lib/authentication/constants/auth.js +1 -1
  8. package/lib/authentication/credential.js +3 -3
  9. package/lib/authentication/index.js +25 -14
  10. package/lib/authentication/login.d.ts +0 -2
  11. package/lib/authentication/login.js +23 -10
  12. package/lib/bin/catalyst.js +17 -7
  13. package/lib/client-utils.d.ts +3 -3
  14. package/lib/client-utils.js +2 -2
  15. package/lib/client.js +19 -9
  16. package/lib/code-deck.d.ts +0 -2
  17. package/lib/code-deck.js +4 -4
  18. package/lib/command_needs/config.js +1 -1
  19. package/lib/command_needs/rc.js +5 -2
  20. package/lib/commands/appsail/add.js +17 -7
  21. package/lib/commands/client/setup.js +17 -7
  22. package/lib/commands/config/set.js +5 -3
  23. package/lib/commands/deploy/appsail.js +37 -14
  24. package/lib/commands/deploy/index.js +88 -66
  25. package/lib/commands/deploy/slate.js +37 -14
  26. package/lib/commands/event/generate/integ.js +18 -9
  27. package/lib/commands/functions/add.js +17 -7
  28. package/lib/commands/functions/execute.js +17 -7
  29. package/lib/commands/functions/setup.js +17 -7
  30. package/lib/commands/functions/shell.js +17 -7
  31. package/lib/commands/iac/import.js +18 -8
  32. package/lib/commands/iac/pack.js +17 -7
  33. package/lib/commands/iac/status.js +17 -7
  34. package/lib/commands/index.js +20 -12
  35. package/lib/commands/init.js +17 -7
  36. package/lib/commands/login.js +17 -7
  37. package/lib/commands/logout.js +17 -7
  38. package/lib/commands/project/list.js +17 -7
  39. package/lib/commands/project/use.js +1 -0
  40. package/lib/commands/pull.js +17 -7
  41. package/lib/commands/run.js +17 -7
  42. package/lib/commands/serve.js +17 -7
  43. package/lib/commands/signals/generate/index.js +1 -1
  44. package/lib/commands/slate/create.js +17 -7
  45. package/lib/commands/slate/link.js +17 -7
  46. package/lib/commands/token/generate.js +17 -7
  47. package/lib/commands/token/list.js +17 -7
  48. package/lib/commands/token/revoke.js +17 -7
  49. package/lib/commands/zest/generate/index.js +21 -11
  50. package/lib/deploy/features/appsail/index.js +2 -3
  51. package/lib/deploy/features/appsail/pack.d.ts +0 -1
  52. package/lib/deploy/features/appsail/pack.js +2 -3
  53. package/lib/deploy/features/appsail/utils.js +7 -8
  54. package/lib/deploy/features/functions/languages/index.js +3 -4
  55. package/lib/deploy/features/index.js +17 -7
  56. package/lib/deploy/features/slate.js +2 -3
  57. package/lib/deploy/index.js +2 -2
  58. package/lib/deploy/util.d.ts +2 -0
  59. package/lib/deploy/util.js +3 -1
  60. package/lib/docs/commands/signals/generate/generate.toml +19 -0
  61. package/lib/docs/commands/slate/unlink.toml +9 -0
  62. package/lib/docs/fn-utils/lib/node.toml +4 -0
  63. package/lib/docs/init/dependencies/python/ensure-python.toml +4 -0
  64. package/lib/docs/serve/server/lib/slate/index.toml +15 -0
  65. package/lib/docs/slate-utils.toml +9 -0
  66. package/lib/endpoints/index.d.ts +2 -1
  67. package/lib/endpoints/index.js +88 -79
  68. package/lib/endpoints/lib/apig.d.ts +0 -1
  69. package/lib/endpoints/lib/apig.js +2 -2
  70. package/lib/endpoints/lib/applogic.d.ts +0 -1
  71. package/lib/endpoints/lib/applogic.js +2 -2
  72. package/lib/endpoints/lib/appsail.d.ts +1 -4
  73. package/lib/endpoints/lib/appsail.js +7 -7
  74. package/lib/endpoints/lib/client.d.ts +0 -1
  75. package/lib/endpoints/lib/code-deck.js +1 -1
  76. package/lib/endpoints/lib/common.d.ts +0 -2
  77. package/lib/endpoints/lib/ds-bulk.js +2 -2
  78. package/lib/endpoints/lib/env.js +2 -2
  79. package/lib/endpoints/lib/filestore.d.ts +0 -1
  80. package/lib/endpoints/lib/functions.d.ts +0 -1
  81. package/lib/endpoints/lib/functions.js +2 -2
  82. package/lib/endpoints/lib/git-hub.d.ts +0 -2
  83. package/lib/endpoints/lib/iac.d.ts +0 -3
  84. package/lib/endpoints/lib/iac.js +2 -2
  85. package/lib/endpoints/lib/project.d.ts +0 -1
  86. package/lib/endpoints/lib/project.js +2 -2
  87. package/lib/endpoints/lib/sdk.d.ts +0 -2
  88. package/lib/endpoints/lib/sdk.js +1 -1
  89. package/lib/endpoints/lib/slate.d.ts +0 -1
  90. package/lib/endpoints/lib/stratus.d.ts +0 -1
  91. package/lib/endpoints/lib/user.d.ts +0 -2
  92. package/lib/endpoints/lib/user.js +2 -1
  93. package/lib/error/context-help.js +1 -1
  94. package/lib/error/index.js +2 -2
  95. package/lib/event_generate/cache.js +4 -4
  96. package/lib/event_generate/custom.js +1 -2
  97. package/lib/event_generate/datastore.js +4 -4
  98. package/lib/event_generate/filestore.js +4 -4
  99. package/lib/event_generate/github.js +2 -2
  100. package/lib/event_generate/index.js +19 -11
  101. package/lib/event_generate/stratus.js +2 -2
  102. package/lib/event_generate/user.js +2 -2
  103. package/lib/event_generate/webapp.js +2 -2
  104. package/lib/execute/caller.d.ts +0 -1
  105. package/lib/execute/caller.js +20 -7
  106. package/lib/execute/index.js +27 -4
  107. package/lib/execute-script.js +22 -13
  108. package/lib/express_middlewares/auth-checker.js +2 -3
  109. package/lib/express_middlewares/project.d.ts +1 -1
  110. package/lib/fn-utils/index.js +17 -7
  111. package/lib/fn-utils/lib/browserLogic.js +4 -5
  112. package/lib/fn-utils/lib/common.d.ts +0 -1
  113. package/lib/fn-utils/lib/common.js +25 -26
  114. package/lib/fn-utils/lib/integ.js +2 -3
  115. package/lib/fn-utils/lib/java/classpath.js +2 -3
  116. package/lib/fn-utils/lib/java/compile.js +4 -4
  117. package/lib/fn-utils/lib/java/ensure-java-userconfig.d.ts +10 -0
  118. package/lib/fn-utils/lib/java/ensure-java-userconfig.js +45 -23
  119. package/lib/fn-utils/lib/java/index.d.ts +0 -1
  120. package/lib/fn-utils/lib/java/index.js +11 -11
  121. package/lib/fn-utils/lib/java/keywords.js +2 -2
  122. package/lib/fn-utils/lib/node.d.ts +1 -1
  123. package/lib/fn-utils/lib/node.js +67 -15
  124. package/lib/fn-utils/lib/python.js +29 -19
  125. package/lib/iac/status/util/index.d.ts +1 -1
  126. package/lib/init/dependencies/npm-install.js +2 -2
  127. package/lib/init/dependencies/python/ensure-python.d.ts +2 -2
  128. package/lib/init/dependencies/python/ensure-python.js +65 -58
  129. package/lib/init/dependencies/python/pip-install.d.ts +3 -5
  130. package/lib/init/dependencies/python/pip-install.js +14 -53
  131. package/lib/init/features/appsail/utils.js +21 -12
  132. package/lib/init/features/client/index.js +18 -9
  133. package/lib/init/features/client/initializers/angular.js +17 -7
  134. package/lib/init/features/client/initializers/basic.js +17 -7
  135. package/lib/init/features/client/initializers/lyte.js +17 -7
  136. package/lib/init/features/client/initializers/react.js +17 -7
  137. package/lib/init/features/index.js +29 -20
  138. package/lib/init/features/project.js +5 -5
  139. package/lib/init/features/slate/index.js +19 -9
  140. package/lib/init/util/client.js +23 -13
  141. package/lib/init/util/common.js +5 -6
  142. package/lib/init/util/project.js +1 -1
  143. package/lib/internal/api.d.ts +0 -3
  144. package/lib/internal/api.js +19 -9
  145. package/lib/internal/command.js +18 -9
  146. package/lib/migration/global/1.25.0.d.ts +2 -0
  147. package/lib/migration/global/1.25.0.js +28 -0
  148. package/lib/migration/index.js +20 -12
  149. package/lib/option-filter.js +19 -10
  150. package/lib/optional-import.js +19 -10
  151. package/lib/plugin-loader.d.ts +0 -2
  152. package/lib/plugin-loader.js +18 -8
  153. package/lib/port-resolver.js +10 -10
  154. package/lib/prompt/index.d.ts +3 -3
  155. package/lib/prompt/index.js +17 -7
  156. package/lib/prompt/types/file-path.d.ts +0 -1
  157. package/lib/prompt/types/search-box.d.ts +0 -1
  158. package/lib/prompt/types/tree.d.ts +1 -2
  159. package/lib/prompt/types/tree.js +10 -10
  160. package/lib/prompt/types/with-description.d.ts +0 -1
  161. package/lib/pull/features/functions/index.js +71 -52
  162. package/lib/pull/features/functions/languages.js +3 -4
  163. package/lib/pull/features/index.js +17 -7
  164. package/lib/repl-server.d.ts +0 -1
  165. package/lib/repl-server.js +9 -1
  166. package/lib/serve/features/apig.js +7 -1
  167. package/lib/serve/features/appsail.d.ts +1 -0
  168. package/lib/serve/features/appsail.js +51 -7
  169. package/lib/serve/features/index.js +22 -13
  170. package/lib/serve/index.js +17 -7
  171. package/lib/serve/server/index.d.ts +0 -2
  172. package/lib/serve/server/index.js +26 -12
  173. package/lib/serve/server/lib/appsail/index.js +27 -34
  174. package/lib/serve/server/lib/appsail/start.js +12 -5
  175. package/lib/serve/server/lib/appsail/util.d.ts +11 -0
  176. package/lib/serve/server/lib/appsail/util.js +69 -0
  177. package/lib/serve/server/lib/java/index.js +18 -7
  178. package/lib/serve/server/lib/master/appsail.js +3 -4
  179. package/lib/serve/server/lib/master/functions.js +1 -2
  180. package/lib/serve/server/lib/master/index.d.ts +0 -1
  181. package/lib/serve/server/lib/master/index.js +5 -5
  182. package/lib/serve/server/lib/master/slate.js +1 -2
  183. package/lib/serve/server/lib/master/unknown-req-proxy.js +5 -2
  184. package/lib/serve/server/lib/master/utils.d.ts +4 -8
  185. package/lib/serve/server/lib/master/utils.js +4 -6
  186. package/lib/serve/server/lib/master/web-client.js +1 -2
  187. package/lib/serve/server/lib/node/index.js +22 -11
  188. package/lib/serve/server/lib/node/server/browserlogic/utils/playwright-handler.js +1 -1
  189. package/lib/serve/server/lib/node/server/browserlogic/utils/puppeteer-handler.js +1 -1
  190. package/lib/serve/server/lib/node/server/browserlogic/utils/selenium-handler.js +2 -0
  191. package/lib/serve/server/lib/python/index.js +23 -14
  192. package/lib/serve/server/lib/slate/static-server.d.ts +0 -1
  193. package/lib/serve/server/lib/slate/static-server.js +5 -4
  194. package/lib/serve/server/lib/web_client/server.d.ts +0 -1
  195. package/lib/serve/server/lib/web_client/server.js +5 -4
  196. package/lib/shell/dependencies/http-functions.d.ts +0 -2
  197. package/lib/shell/dependencies/http-functions.js +7 -7
  198. package/lib/shell/dependencies/non-http-function/fn-execution-handler.d.ts +0 -2
  199. package/lib/shell/dependencies/non-http-function/fn-execution-handler.js +55 -24
  200. package/lib/shell/dependencies/non-http-function/fn-handler.d.ts +3 -3
  201. package/lib/shell/dependencies/non-http-function/fn-handler.js +54 -20
  202. package/lib/shell/dependencies/non-http-function/node.js +4 -4
  203. package/lib/shell/dependencies/non-http-function/python.d.ts +1 -1
  204. package/lib/shell/dependencies/non-http-function/python.js +11 -13
  205. package/lib/shell/dependencies/non-http-function/slave-manager.d.ts +0 -2
  206. package/lib/shell/dependencies/non-http-function/slave-manager.js +11 -7
  207. package/lib/shell/dependencies/tunnel-server.js +4 -4
  208. package/lib/shell/index.js +50 -3
  209. package/lib/shell/prepare/index.js +4 -3
  210. package/lib/shell/prepare/languages/index.js +18 -9
  211. package/lib/shell/prepare/languages/node.js +29 -19
  212. package/lib/shell/prepare/languages/python.js +6 -12
  213. package/lib/signals/index.js +19 -11
  214. package/lib/slate-utils.js +2 -2
  215. package/lib/throbber/index.d.ts +1 -2
  216. package/lib/throbber/index.js +5 -2
  217. package/lib/throbber/utils.d.ts +0 -1
  218. package/lib/throbber/utils.js +4 -5
  219. package/lib/userConfig.d.ts +14 -0
  220. package/lib/userConfig.js +15 -1
  221. package/lib/util_modules/config/index.js +17 -7
  222. package/lib/util_modules/config/lib/apig.d.ts +1 -0
  223. package/lib/util_modules/config/lib/apig.js +10 -5
  224. package/lib/util_modules/config/lib/appsail.js +7 -7
  225. package/lib/util_modules/config/lib/client.js +5 -6
  226. package/lib/util_modules/config/lib/functions.js +5 -6
  227. package/lib/util_modules/config/lib/slate.js +5 -6
  228. package/lib/util_modules/config-store.d.ts +1 -1
  229. package/lib/util_modules/config-store.js +30 -13
  230. package/lib/util_modules/constants/lib/apig-rules.d.ts +1 -1
  231. package/lib/util_modules/constants/lib/dc-type.js +3 -3
  232. package/lib/util_modules/constants/lib/placeholders.d.ts +1 -1
  233. package/lib/util_modules/constants/lib/placeholders.js +1 -1
  234. package/lib/util_modules/constants/lib/urls.js +2 -9
  235. package/lib/util_modules/container.js +23 -14
  236. package/lib/util_modules/dc.js +3 -4
  237. package/lib/util_modules/env.d.ts +3 -0
  238. package/lib/util_modules/env.js +64 -4
  239. package/lib/util_modules/event-emitter.d.ts +9 -0
  240. package/lib/util_modules/event-emitter.js +68 -0
  241. package/lib/util_modules/fs/index.js +17 -7
  242. package/lib/util_modules/fs/lib/async.d.ts +0 -4
  243. package/lib/util_modules/fs/lib/async.js +46 -46
  244. package/lib/util_modules/fs/lib/sync.d.ts +1 -3
  245. package/lib/util_modules/fs/lib/sync.js +40 -30
  246. package/lib/util_modules/logger/index.js +12 -12
  247. package/lib/util_modules/logger/utils.d.ts +0 -4
  248. package/lib/util_modules/logger/utils.js +1 -1
  249. package/lib/util_modules/logger/winston.js +2 -2
  250. package/lib/util_modules/option.js +5 -6
  251. package/lib/util_modules/project.js +22 -23
  252. package/lib/util_modules/runtime-store.d.ts +2 -2
  253. package/lib/util_modules/server.d.ts +1 -2
  254. package/lib/util_modules/server.js +54 -15
  255. package/lib/util_modules/shell.d.ts +0 -3
  256. package/lib/util_modules/shell.js +5 -6
  257. package/lib/util_modules/toml.js +2 -3
  258. package/package.json +13 -13
  259. package/templates/init/functions/java/event/sample.java +5 -2
  260. package/templates/web-socket.txt +1 -1
  261. /package/lib/docs/{commands/event/generate → event_generate}/index.toml +0 -0
  262. /package/templates/init/functions/java/integ/convokraft/{Sample.java → sample.java} +0 -0
@@ -4,8 +4,7 @@
4
4
  // exit codes
5
5
  // 150 - start up command failure
6
6
 
7
- const EXEC = require('child_process').exec;
8
-
7
+ const { spawn } = require('cross-spawn');
9
8
  const WAR = 'war';
10
9
  const JAVASE = 'javase';
11
10
  const NODEJS = 'nodejs';
@@ -62,7 +61,12 @@ function main() {
62
61
  throw new Error(`invalid runtime type: ${CMD_ARGS.rtType}`);
63
62
  }
64
63
 
65
- const _process = EXEC(command.toString(), { cwd });
64
+ const _process = spawn('sh', ['-c', command.toString()], {
65
+ cwd,
66
+ env: process.env,
67
+ stdio: 'pipe',
68
+ detached: true
69
+ });
66
70
 
67
71
  _process.on('error', (error) => {
68
72
  // eslint-disable-next-line no-console
@@ -73,8 +77,11 @@ function main() {
73
77
  _process.stdout.pipe(process.stdout);
74
78
  _process.stderr.pipe(process.stderr);
75
79
 
76
- process.once('SIGINT', () => {
77
- _process.kill('SIGINT');
80
+ ['SIGINT', 'SIGTERM'].forEach((signal) => {
81
+ process.on(signal, () => {
82
+ process.kill(-_process.pid, signal);
83
+ process.exit();
84
+ });
78
85
  });
79
86
  }
80
87
 
@@ -0,0 +1,11 @@
1
+ export declare const AppsailUtils: {
2
+ executeHook(script: string, name: string, moduleSource: string): Promise<void>;
3
+ getVersion(stack: string): number;
4
+ getJettyVersion(javaVersion: number): number;
5
+ getJettyCommand(jettyPath: string, jettyVersion: string, target: string, port: number): string;
6
+ getJettyConfig(stack: string, target: string, port: number): {
7
+ jettyPath: string;
8
+ jettyCommand: string;
9
+ jettyDownloadUrl: string;
10
+ };
11
+ };
@@ -0,0 +1,69 @@
1
+ 'use strict';
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AppsailUtils = void 0;
13
+ const path_1 = require("path");
14
+ const constants_1 = require("../../../../util_modules/constants");
15
+ const project_1 = require("../../../../util_modules/project");
16
+ const option_1 = require("../../../../util_modules/option");
17
+ const console_1 = require("console");
18
+ const execute_script_1 = require("../../../../execute-script");
19
+ exports.AppsailUtils = {
20
+ executeHook(script, name, moduleSource) {
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ if ((0, option_1.getOptionValue)('ignoreScripts', false)) {
23
+ (0, console_1.debug)(`skipping ${name} hook`);
24
+ return;
25
+ }
26
+ return (0, execute_script_1.executeCommand)(script, { moduleSource, feature: name });
27
+ });
28
+ },
29
+ getVersion(stack) {
30
+ return parseInt(stack.replace(/\D/g, ''), 10);
31
+ },
32
+ getJettyVersion(javaVersion) {
33
+ const group1 = [8, 11, 17];
34
+ const group2 = [21, 25];
35
+ if (group1.includes(javaVersion))
36
+ return 1;
37
+ if (group2.includes(javaVersion))
38
+ return 2;
39
+ return 0;
40
+ },
41
+ getJettyCommand(jettyPath, jettyVersion, target, port) {
42
+ const command = [];
43
+ command.push('java -jar');
44
+ command.push(`"${(0, path_1.join)(jettyPath, 'start.jar')}"`);
45
+ switch (jettyVersion) {
46
+ case 'v1':
47
+ command.push(`-Djetty.http.port=${port}`);
48
+ command.push(`-Djetty.deploy.monitoredPath="${(0, project_1.resolveProjectPath)(target)}"`);
49
+ break;
50
+ case 'v2':
51
+ command.push(`jetty.http.port=${port}`);
52
+ command.push(`jetty.deploy.webappsDir="${(0, project_1.resolveProjectPath)(target)}"`);
53
+ break;
54
+ }
55
+ return command.join(' ');
56
+ },
57
+ getJettyConfig(stack, target, port) {
58
+ const javaVersion = this.getVersion(stack);
59
+ const jettyVersion = `v${this.getJettyVersion(javaVersion)}`;
60
+ const jettyPath = (0, path_1.join)(constants_1.ENVPATH.runtimes.data, 'jetty', jettyVersion);
61
+ const jettyCommand = this.getJettyCommand(jettyPath, jettyVersion, target, port);
62
+ const jettyDownloadUrl = `/catalyst/appsail/${jettyVersion}/jetty_runtime_dependency.zip`;
63
+ return {
64
+ jettyPath,
65
+ jettyCommand,
66
+ jettyDownloadUrl
67
+ };
68
+ }
69
+ };
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
36
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
37
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -84,6 +94,7 @@ exports.default = (details) => __awaiter(void 0, void 0, void 0, function* () {
84
94
  return (0, shell_1.spawn)(spawnCommand, opts, {
85
95
  cwd: targetSource === null || targetSource === void 0 ? void 0 : targetSource.replace(projectRoot, (0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build)),
86
96
  stdio: 'pipe',
97
+ detached: true,
87
98
  env: Object.assign({ X_ZOHO_CATALYST_IS_LOCAL: 'true', X_ZOHO_CATALYST_FUNCTION_LOADED: 'true', X_ZOHO_CATALYST_CODE_LOCATION: targetDir + path_1.sep, X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth, X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin, X_ZOHO_CATALYST_RESOURCE_ID: (_h = details.target) === null || _h === void 0 ? void 0 : _h.id, X_ZOHO_STRATUS_RESOURCE_SUFFIX: constants_1.ORIGIN.stratusSuffix, CATALYST_PORTAL_DOMAIN: constants_1.ORIGIN.iamPortal, CATALYST_PROJECT_TIMEZONE: (0, project_1.getProjectTimezone)(Intl.DateTimeFormat().resolvedOptions().timeZone), CHROME_EXECUTABLE_PATH: runtime_store_1.default.get('CHROME_EXECUTABLE', process.env.CHROME_EXECUTABLE_PATH), CHROMEDRIVER_EXECUTABLE_PATH: runtime_store_1.default.get('CHROME_DRIVER_EXECUTABLE', process.env.CHROMEDRIVER_EXECUTABLE_PATH) }, details.target.env_var)
88
99
  }).RAW();
89
100
  });
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.addAppSailRoutes = void 0;
15
+ exports.addAppSailRoutes = addAppSailRoutes;
16
16
  const utils_1 = require("./utils");
17
17
  const error_1 = __importDefault(require("../../../../error"));
18
18
  function addAppSailRoutes(app, details, proxy, unknownProxy) {
@@ -49,9 +49,9 @@ function addAppSailRoutes(app, details, proxy, unknownProxy) {
49
49
  }
50
50
  const targetUrl = `http://127.0.0.1:${appsailPort}`;
51
51
  app.use('/', (req, res) => __awaiter(this, void 0, void 0, function* () {
52
- var _g, _h;
52
+ var _a, _b;
53
53
  if (req.header('catalyst-component') === 'true' && req.url.length > 1) {
54
- ((_h = (_g = details.target) === null || _g === void 0 ? void 0 : _g.config) === null || _h === void 0 ? void 0 : _h.catalyst_auth) === true
54
+ ((_b = (_a = details.target) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.catalyst_auth) === true
55
55
  ? unknownProxy(req, res)
56
56
  : res.sendStatus(400);
57
57
  return;
@@ -66,4 +66,3 @@ function addAppSailRoutes(app, details, proxy, unknownProxy) {
66
66
  });
67
67
  });
68
68
  }
69
- exports.addAppSailRoutes = addAppSailRoutes;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addFnRoutes = void 0;
3
+ exports.addFnRoutes = addFnRoutes;
4
4
  const constants_1 = require("../../../../util_modules/constants");
5
5
  function addFnRoutes(app, details, proxy) {
6
6
  if (details.isAlive === false) {
@@ -58,4 +58,3 @@ function addFnRoutes(app, details, proxy) {
58
58
  });
59
59
  }
60
60
  }
61
- exports.addFnRoutes = addFnRoutes;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Server } from 'http';
3
2
  import { IServerDetails, TServerTargets } from '../../index';
4
3
  import { TAppSailServerDetails } from '../../../features/appsail';
@@ -12,6 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.default = spinUpMaster;
15
16
  const express_1 = __importDefault(require("express"));
16
17
  const error_1 = __importDefault(require("../../../../error"));
17
18
  const apig_matcher_1 = __importDefault(require("../../../../express_middlewares/apig-matcher"));
@@ -35,9 +36,9 @@ const web_client_1 = require("./web-client");
35
36
  const functions_1 = require("./functions");
36
37
  const slate_1 = require("./slate");
37
38
  const apig_1 = __importDefault(require("../../../features/apig"));
38
- function spinUpMaster(listenPort, { otherServerDetails, appSailDetails, slateDetails }) {
39
- var _a, _b;
40
- return __awaiter(this, void 0, void 0, function* () {
39
+ function spinUpMaster(listenPort_1, _a) {
40
+ return __awaiter(this, arguments, void 0, function* (listenPort, { otherServerDetails, appSailDetails, slateDetails }) {
41
+ var _b, _c;
41
42
  if ((otherServerDetails && appSailDetails && slateDetails) ||
42
43
  (!otherServerDetails && !appSailDetails && !slateDetails)) {
43
44
  throw new error_1.default('Either functions/client or AppSail is need to start the master server. But both cannot use the same master', { exit: 2 });
@@ -98,7 +99,7 @@ function spinUpMaster(listenPort, { otherServerDetails, appSailDetails, slateDet
98
99
  }
99
100
  const proxy = (0, utils_1.createProxyServer)(listenPort);
100
101
  const signRedirectUrl = slateDetails ? '/' : '/app/local-redirect';
101
- appSailDetails && ((_b = (_a = appSailDetails.target) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.catalyst_auth) === true
102
+ appSailDetails && ((_c = (_b = appSailDetails.target) === null || _b === void 0 ? void 0 : _b.config) === null || _c === void 0 ? void 0 : _c.catalyst_auth) === true
102
103
  ? proxy.on('proxyRes', (0, utils_1.proxyResponseHandler)({
103
104
  signInRedirect: appSailDetails.target.config.login_redirect || '/'
104
105
  }))
@@ -164,4 +165,3 @@ function spinUpMaster(listenPort, { otherServerDetails, appSailDetails, slateDet
164
165
  return expressServer;
165
166
  });
166
167
  }
167
- exports.default = spinUpMaster;
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.addSlateRoutes = void 0;
12
+ exports.addSlateRoutes = addSlateRoutes;
13
13
  function addSlateRoutes(app, details, proxy, unknownProxy) {
14
14
  if (!details.isAlive === false) {
15
15
  return;
@@ -29,4 +29,3 @@ function addSlateRoutes(app, details, proxy, unknownProxy) {
29
29
  });
30
30
  }));
31
31
  }
32
- exports.addSlateRoutes = addSlateRoutes;
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const runtime_store_1 = __importDefault(require("../../../../runtime-store"));
7
7
  const index_1 = require("../../../../util_modules/logger/index");
8
+ const env_1 = require("../../../../util_modules/env");
8
9
  exports.default = (proxyInstance, masterPort, customProxyUrl) => (req, res) => {
9
10
  if (req.url.length === 1 && req.url.startsWith('/')) {
10
11
  res.redirect('/app/');
@@ -32,13 +33,15 @@ exports.default = (proxyInstance, masterPort, customProxyUrl) => (req, res) => {
32
33
  headers['origin'] = `https://${req.headers['x-zc-project-domain']}`;
33
34
  }
34
35
  if (req.url.includes('/__catalyst/auth/')) {
35
- headers['catalyst-redirect-domain'] = `http://localhost:${masterPort || 3000}`;
36
+ headers['catalyst-redirect-domain'] = (0, env_1.getLocalAccessDomain)(masterPort || 3000);
36
37
  }
37
38
  proxyInstance.web(req, res, {
38
39
  target: `https://${req.headers['x-zc-project-domain']}`,
39
40
  changeOrigin: true,
40
41
  cookieDomainRewrite: {
41
- [req.headers['x-zc-project-domain'] + '']: 'localhost'
42
+ [req.headers['x-zc-project-domain'] + '']: env_1.isExtension
43
+ ? (0, env_1.getLocalAccessDomain)(masterPort || 3000)
44
+ : 'localhost'
42
45
  },
43
46
  ws: true,
44
47
  headers
@@ -1,8 +1,7 @@
1
- /// <reference types="node" />
2
1
  import { IncomingMessage, ServerResponse } from 'http';
3
2
  import { IAPIGLocal, IAPIGRules } from '../../../../apig-utils';
4
3
  import Server from 'http-proxy';
5
- import EventEmitter from 'events';
4
+ import { CatalystEventEmitter } from '../../../../util_modules/event-emitter';
6
5
  export interface IMatchRule extends IAPIGRules {
7
6
  target_endpoint: string;
8
7
  source_endpoint: string;
@@ -10,15 +9,12 @@ export interface IMatchRule extends IAPIGRules {
10
9
  [x: string]: string;
11
10
  };
12
11
  }
13
- declare class ServerEvent extends EventEmitter {
14
- }
15
- export declare const serverEvent: ServerEvent;
12
+ export declare const serverEvent: CatalystEventEmitter;
16
13
  export declare const removeSecure: (str: string) => string;
17
14
  export declare const redirectByAuth: (req: IncomingMessage, res: ServerResponse, redirectUrl: string) => void;
18
15
  export declare const createProxyServer: (port: number) => Server;
19
16
  export declare const proxyResponseHandler: ({ systemRoutes, signInRedirect }: {
20
- systemRoutes?: IAPIGLocal | undefined;
21
- signInRedirect?: string | undefined;
17
+ systemRoutes?: IAPIGLocal;
18
+ signInRedirect?: string;
22
19
  }) => (proxyRes: IncomingMessage, req: IncomingMessage, res: ServerResponse) => void;
23
20
  export declare const appsailInitJs: () => Promise<string>;
24
- export {};
@@ -20,10 +20,8 @@ const error_1 = __importDefault(require("../../../../error"));
20
20
  const project_1 = require("../../../../util_modules/project");
21
21
  const http_proxy_1 = require("http-proxy");
22
22
  const index_1 = require("../../../../util_modules/logger/index");
23
- const events_1 = __importDefault(require("events"));
24
- class ServerEvent extends events_1.default {
25
- }
26
- exports.serverEvent = new ServerEvent();
23
+ const event_emitter_1 = require("../../../../util_modules/event-emitter");
24
+ exports.serverEvent = new event_emitter_1.CatalystEventEmitter();
27
25
  const iam_cookies = [
28
26
  'ZD_CSRF_TOKEN',
29
27
  '_iamadt_client',
@@ -118,13 +116,13 @@ const proxyResponseHandler = ({ systemRoutes, signInRedirect }) => (proxyRes, re
118
116
  else if (req.url.includes('/logout')) {
119
117
  const set = proxyRes.headers['set-cookie'];
120
118
  if (set) {
121
- const result = set.map((cookie) => cookie.replace(new RegExp('Domain=[\\S^;]*', 'g'), 'Domain=localhost;'));
119
+ const result = set.map((cookie) => cookie.replace(new RegExp('Domain=[\\S^;]*', 'g'), 'Path=/'));
122
120
  proxyRes.headers['set-cookie'] = result;
123
121
  }
124
122
  }
125
123
  }
126
124
  else if (req.url.startsWith('/accounts') && req.url.includes('/signin')) {
127
- (_b = proxyRes.headers['set-cookie']) === null || _b === void 0 ? void 0 : _b.push('IAM_TEST_COOKIE=IAM_TEST_COOKIE; Domain=localhost; Path=/');
125
+ (_b = proxyRes.headers['set-cookie']) === null || _b === void 0 ? void 0 : _b.push('IAM_TEST_COOKIE=IAM_TEST_COOKIE; Path=/');
128
126
  }
129
127
  };
130
128
  exports.proxyResponseHandler = proxyResponseHandler;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addWebClientRoutes = void 0;
3
+ exports.addWebClientRoutes = addWebClientRoutes;
4
4
  function addWebClientRoutes(app, details, proxy, unknownProxy) {
5
5
  const appTarget = `http://127.0.0.1:${details.httpPort}/app/`;
6
6
  app.use('/app', (req, res) => {
@@ -36,4 +36,3 @@ function addWebClientRoutes(app, details, proxy, unknownProxy) {
36
36
  });
37
37
  });
38
38
  }
39
- exports.addWebClientRoutes = addWebClientRoutes;
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
36
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
37
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -56,7 +66,7 @@ const shell_1 = require("../../../../util_modules/shell");
56
66
  const container_1 = require("../../../../util_modules/container");
57
67
  const container_plugin_1 = require("@zcatalyst/container-plugin/");
58
68
  exports.default = (details) => __awaiter(void 0, void 0, void 0, function* () {
59
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
69
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
60
70
  if (!details.target) {
61
71
  throw new error_1.default('Invalid Node function target', { exit: 2 });
62
72
  }
@@ -76,7 +86,7 @@ exports.default = (details) => __awaiter(void 0, void 0, void 0, function* () {
76
86
  });
77
87
  }
78
88
  const label = `${details.type}[${(_g = details.target) === null || _g === void 0 ? void 0 : _g.name}]`;
79
- const _o = details.target, { ['watcher']: _ } = _o, serialisableTarget = __rest(_o, ['watcher']);
89
+ const _q = details.target, { ['watcher']: _ } = _q, serialisableTarget = __rest(_q, ['watcher']);
80
90
  serialisableTarget.index = serialisableTarget.index
81
91
  ? serialisableTarget.index.replace(projectRoot, (0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build))
82
92
  : undefined;
@@ -96,9 +106,10 @@ exports.default = (details) => __awaiter(void 0, void 0, void 0, function* () {
96
106
  (0, index_1.labeled)(label, 'you can attach your debugger at port : ' + details.debugPort).MESSAGE();
97
107
  opts.unshift('--inspect=' + details.debugPort);
98
108
  }
99
- return (0, shell_1.spawn)('node', opts, {
109
+ return (0, shell_1.spawn)(((_o = (_m = details.target) === null || _m === void 0 ? void 0 : _m.additionalInfo) === null || _o === void 0 ? void 0 : _o.binPath) || 'node', opts, {
100
110
  cwd: codeLocation,
101
111
  stdio: 'pipe',
102
- env: Object.assign({ NODE_PATH: targetSource + path_1.sep + 'node_modules', X_ZOHO_CATALYST_IS_LOCAL: 'true', X_ZOHO_CATALYST_FUNCTION_LOADED: 'true', X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth, X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin, X_ZOHO_CATALYST_RESOURCE_ID: (_m = details.target) === null || _m === void 0 ? void 0 : _m.id, X_ZOHO_STRATUS_RESOURCE_SUFFIX: constants_1.ORIGIN.stratusSuffix, CATALYST_PORTAL_DOMAIN: constants_1.ORIGIN.iamPortal, CATALYST_PROJECT_TIMEZONE: (0, project_1.getProjectTimezone)(Intl.DateTimeFormat().resolvedOptions().timeZone), CHROME_EXECUTABLE_PATH: runtime_store_1.default.get('CHROME_EXECUTABLE', process.env.CHROME_EXECUTABLE_PATH), CHROMEDRIVER_EXECUTABLE_PATH: runtime_store_1.default.get('CHROME_DRIVER_EXECUTABLE', process.env.CHROMEDRIVER_EXECUTABLE_PATH) }, details.target.env_var)
112
+ detached: true,
113
+ env: Object.assign({ NODE_PATH: targetSource + path_1.sep + 'node_modules', X_ZOHO_CATALYST_IS_LOCAL: 'true', X_ZOHO_CATALYST_FUNCTION_LOADED: 'true', X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth, X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin, X_ZOHO_CATALYST_RESOURCE_ID: (_p = details.target) === null || _p === void 0 ? void 0 : _p.id, X_ZOHO_STRATUS_RESOURCE_SUFFIX: constants_1.ORIGIN.stratusSuffix, CATALYST_PORTAL_DOMAIN: constants_1.ORIGIN.iamPortal, CATALYST_PROJECT_TIMEZONE: (0, project_1.getProjectTimezone)(Intl.DateTimeFormat().resolvedOptions().timeZone), CHROME_EXECUTABLE_PATH: runtime_store_1.default.get('CHROME_EXECUTABLE', process.env.CHROME_EXECUTABLE_PATH), CHROMEDRIVER_EXECUTABLE_PATH: runtime_store_1.default.get('CHROME_DRIVER_EXECUTABLE', process.env.CHROMEDRIVER_EXECUTABLE_PATH) }, details.target.env_var)
103
114
  }).RAW();
104
115
  });
@@ -19,7 +19,7 @@ async function getBrowser() {
19
19
  if ((!browser || !browser.isConnected()) && !browserlaunching) {
20
20
  browserPromise = new DEFERED_PROMISE();
21
21
  browserlaunching = true;
22
- let args = ['--remote-debugging-port=9002'];// No I18N
22
+ let args = ['--remote-debugging-port=9002', '--no-sandbox', '--disable-setuid-sandbox'];// No I18N
23
23
  browser = await playwright.chromium.launch({ executablePath: CHROME_EXECUTABLE_PATH, args: args, headless: true });
24
24
  let version = await browser.version();
25
25
  console.log("Chrome started successfully " + version);
@@ -20,7 +20,7 @@ async function getBrowser(path) {
20
20
  if ((!browser || !browser.isConnected()) && !browserlaunching) {
21
21
  browserPromise = new DEFERED_PROMISE();
22
22
  browserlaunching = true;
23
- let args = ['--remote-debugging-port=9002'];// No I18N
23
+ let args = ['--remote-debugging-port=9002', '--no-sandbox', '--disable-setuid-sandbox'];// No I18N
24
24
  browser = await puppeteer.launch({ executablePath: CHROME_EXECUTABLE_PATH, args: args, headless: true });
25
25
  let version = await browser.version();
26
26
  console.log("Chrome started successfully " + version);
@@ -24,6 +24,8 @@ async function getBrowser() {
24
24
  options.addArguments('--headless') ;
25
25
  options.addArguments('--disable-dev-shm-usage');
26
26
  options.addArguments('--remote-debugging-port=9002');
27
+ options.addArguments('--no-sandbox');
28
+ options.addArguments('--disable-setuid-sandbox');
27
29
 
28
30
  const chromeCapabilities = webdriver.Capabilities.chrome();
29
31
  driver = new webdriver.Builder()
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
36
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
37
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -38,7 +48,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
38
48
  const path_1 = require("path");
39
49
  const runtime_store_1 = __importDefault(require("../../../../runtime-store"));
40
50
  const http_functions_1 = require("../../../../shell/dependencies/http-functions");
41
- const userConfig_1 = __importDefault(require("../../../../userConfig"));
42
51
  const constants_1 = require("../../../../util_modules/constants");
43
52
  const project_1 = require("../../../../util_modules/project");
44
53
  const shell_1 = require("../../../../util_modules/shell");
@@ -83,22 +92,22 @@ exports.default = (details) => __awaiter(void 0, void 0, void 0, function* () {
83
92
  }
84
93
  opts.unshift('-u');
85
94
  return new Promise((resolve, reject) => {
86
- var _a, _b;
87
- const child = (0, shell_1.spawn)(userConfig_1.default.get(`python${stackVersion}.bin`), opts, {
95
+ var _a, _b, _c, _d;
96
+ const child = (0, shell_1.spawn)(((_b = (_a = details.target) === null || _a === void 0 ? void 0 : _a.additionalInfo) === null || _b === void 0 ? void 0 : _b.binPath) || 'python', opts, {
88
97
  cwd: codeLocation,
89
98
  stdio: 'pipe',
90
99
  detached: true,
91
- env: Object.assign({ X_ZOHO_CATALYST_IS_LOCAL: 'true', X_ZOHO_CATALYST_FUNCTION_LOADED: 'true', X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth, X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin, X_ZOHO_CATALYST_RESOURCE_ID: (_a = details.target) === null || _a === void 0 ? void 0 : _a.id, X_ZOHO_STRATUS_RESOURCE_SUFFIX: constants_1.ORIGIN.stratusSuffix, X_ZOHO_CATALYST_CODE_LOCATION: targetSource === null || targetSource === void 0 ? void 0 : targetSource.replace(projectRoot, (0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build)), X_ZOHO_CATALYST_SERVER_LISTEN_PORT: details.httpPort.toString(), CATALYST_PORTAL_DOMAIN: constants_1.ORIGIN.iamPortal, CATALYST_PROJECT_TIMEZONE: (0, project_1.getProjectTimezone)(Intl.DateTimeFormat().resolvedOptions().timeZone) }, details.target.env_var)
100
+ env: Object.assign({ X_ZOHO_CATALYST_IS_LOCAL: 'true', X_ZOHO_CATALYST_FUNCTION_LOADED: 'true', X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth, X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin, X_ZOHO_CATALYST_RESOURCE_ID: (_c = details.target) === null || _c === void 0 ? void 0 : _c.id, X_ZOHO_STRATUS_RESOURCE_SUFFIX: constants_1.ORIGIN.stratusSuffix, X_ZOHO_CATALYST_CODE_LOCATION: targetSource === null || targetSource === void 0 ? void 0 : targetSource.replace(projectRoot, (0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build)), X_ZOHO_CATALYST_SERVER_LISTEN_PORT: details.httpPort.toString(), CATALYST_PORTAL_DOMAIN: constants_1.ORIGIN.iamPortal, CATALYST_PROJECT_TIMEZONE: (0, project_1.getProjectTimezone)(Intl.DateTimeFormat().resolvedOptions().timeZone) }, details.target.env_var)
92
101
  }).RAW();
93
102
  child.on('spawn', () => __awaiter(void 0, void 0, void 0, function* () {
94
- var _c;
103
+ var _a;
95
104
  yield (0, http_functions_1.checkIfRuntimeServerRunning)(details.httpPort.toString());
96
105
  debugConfig &&
97
- (0, index_1.info)(`\nPython debugger for function ${(_c = details.target) === null || _c === void 0 ? void 0 : _c.name} listening on port: ${details.debugPort}`);
106
+ (0, index_1.info)(`\nPython debugger for function ${(_a = details.target) === null || _a === void 0 ? void 0 : _a.name} listening on port: ${details.debugPort}`);
98
107
  resolve(child);
99
108
  }));
100
109
  const errData = [];
101
- (_b = child.stderr) === null || _b === void 0 ? void 0 : _b.on('data', (chunk) => {
110
+ (_d = child.stderr) === null || _d === void 0 ? void 0 : _d.on('data', (chunk) => {
102
111
  errData.push(chunk);
103
112
  });
104
113
  child.on('error', (err) => {
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { EventEmitter } from 'events';
3
2
  export default function slateServer(httpPort: number, source: string, { homepage, enableWatch, notFoundPage }?: {
4
3
  homepage?: string;
@@ -12,6 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.default = slateServer;
15
16
  const express_1 = __importDefault(require("express"));
16
17
  const events_1 = require("events");
17
18
  const chokidar_1 = require("chokidar");
@@ -24,13 +25,14 @@ const ws_1 = require("ws");
24
25
  const port_resolver_js_1 = __importDefault(require("../../../../port-resolver.js"));
25
26
  const ansi_colors_1 = require("ansi-colors");
26
27
  const server_js_1 = require("../../../../util_modules/server.js");
28
+ const env_1 = require("../../../../util_modules/env");
27
29
  function prepareScriptFile(dir, port) {
28
30
  return __awaiter(this, void 0, void 0, function* () {
29
31
  const scriptFile = yield index_js_1.ASYNC.readFile(constants_1.TEMPLATE.client.basic.socket);
30
32
  if (!scriptFile) {
31
33
  throw new error_1.default('Unable to read the script file', { exit: 2 });
32
34
  }
33
- const scriptReady = scriptFile.replace(new RegExp(constants_1.PLACEHOLDER.client.port, 'g'), port + '');
35
+ const scriptReady = scriptFile.replace(new RegExp(constants_1.PLACEHOLDER.client.domain, 'g'), (0, env_1.getLocalAccessDomain)(port, 'ws'));
34
36
  yield index_js_1.ASYNC.ensureDir(dir);
35
37
  const scriptFilePath = (0, path_1.join)(dir, 'reload-script.js');
36
38
  yield index_js_1.ASYNC.writeFile(scriptFilePath, scriptReady);
@@ -59,8 +61,8 @@ function reloadApp(event, path, liveSockets) {
59
61
  (0, logger_1.info)((0, ansi_colors_1.cyan)(`${event} detected in ${path} of the Web-Client.`));
60
62
  liveSockets.forEach((socket) => socket.send('reload'));
61
63
  }
62
- function slateServer(httpPort, source, { homepage = '/index.html', enableWatch = true, notFoundPage } = {}) {
63
- return __awaiter(this, void 0, void 0, function* () {
64
+ function slateServer(httpPort_1, source_1) {
65
+ return __awaiter(this, arguments, void 0, function* (httpPort, source, { homepage = '/index.html', enableWatch = true, notFoundPage } = {}) {
64
66
  const eventListener = new events_1.EventEmitter();
65
67
  const catalystTempDir = (0, path_1.join)(source, '.catalyst');
66
68
  const socketServerPort = yield port_resolver_js_1.default.getFreePort(httpPort, 20, true);
@@ -191,4 +193,3 @@ function slateServer(httpPort, source, { homepage = '/index.html', enableWatch =
191
193
  return new Promise((res) => server.on('listening', () => res(eventListener)));
192
194
  });
193
195
  }
194
- exports.default = slateServer;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { EventEmitter } from 'events';
3
2
  export default function webClientServer(httpPort: number, source: string, { homepage, enableWatch, notFoundPage }?: {
4
3
  homepage?: string;
@@ -12,6 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.default = webClientServer;
15
16
  const express_1 = __importDefault(require("express"));
16
17
  const events_1 = require("events");
17
18
  const chokidar_1 = require("chokidar");
@@ -24,13 +25,14 @@ const ws_1 = require("ws");
24
25
  const port_resolver_js_1 = __importDefault(require("../../../../port-resolver.js"));
25
26
  const ansi_colors_1 = require("ansi-colors");
26
27
  const server_js_1 = require("../../../../util_modules/server.js");
28
+ const env_1 = require("../../../../util_modules/env");
27
29
  function prepareScriptFile(dir, port) {
28
30
  return __awaiter(this, void 0, void 0, function* () {
29
31
  const scriptFile = yield index_js_3.ASYNC.readFile(index_js_1.TEMPLATE.client.basic.socket);
30
32
  if (!scriptFile) {
31
33
  throw new index_js_2.default('Unable to read the script file', { exit: 2 });
32
34
  }
33
- const scriptReady = scriptFile.replace(new RegExp(index_js_1.PLACEHOLDER.client.port, 'g'), port + '');
35
+ const scriptReady = scriptFile.replace(new RegExp(index_js_1.PLACEHOLDER.client.domain, 'g'), (0, env_1.getLocalAccessDomain)(port, 'ws'));
34
36
  yield index_js_3.ASYNC.ensureDir(dir);
35
37
  const scriptFilePath = (0, path_1.join)(dir, 'reload-script.js');
36
38
  yield index_js_3.ASYNC.writeFile(scriptFilePath, scriptReady);
@@ -59,8 +61,8 @@ function reloadApp(event, path, liveSockets) {
59
61
  (0, index_1.info)((0, ansi_colors_1.cyan)(`${event} detected in ${path} of the Web-Client.`));
60
62
  liveSockets.forEach((socket) => socket.send('reload'));
61
63
  }
62
- function webClientServer(httpPort, source, { homepage = 'index.html', enableWatch = true, notFoundPage } = {}) {
63
- return __awaiter(this, void 0, void 0, function* () {
64
+ function webClientServer(httpPort_1, source_1) {
65
+ return __awaiter(this, arguments, void 0, function* (httpPort, source, { homepage = 'index.html', enableWatch = true, notFoundPage } = {}) {
64
66
  const eventListener = new events_1.EventEmitter();
65
67
  const catalystTempDir = (0, path_1.join)(source, '.catalyst');
66
68
  const socketServerPort = yield port_resolver_js_1.default.getFreePort(httpPort, 20, true);
@@ -191,4 +193,3 @@ function webClientServer(httpPort, source, { homepage = 'index.html', enableWatc
191
193
  return new Promise((res) => server.on('listening', () => res(eventListener)));
192
194
  });
193
195
  }
194
- exports.default = webClientServer;
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import queue from 'better-queue';
4
2
  import { ChildProcess } from 'child_process';
5
3
  import express from 'express';