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
@@ -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) {
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { REPLServer } from 'repl';
3
2
  declare class Repl {
4
3
  prompt: string;
@@ -51,6 +51,10 @@ class Repl {
51
51
  });
52
52
  }
53
53
  if (!this.closed) {
54
+ const pos = this.server.getCursorPos();
55
+ if (pos.cols > 0) {
56
+ this.server.write('\n');
57
+ }
54
58
  this.server.displayPrompt();
55
59
  }
56
60
  }
@@ -73,9 +77,11 @@ class Repl {
73
77
  this.server.close();
74
78
  }
75
79
  pause() {
80
+ var _a;
76
81
  if (this.paused) {
77
82
  return;
78
83
  }
84
+ (_a = this.server) === null || _a === void 0 ? void 0 : _a.setPrompt('');
79
85
  this.pureEmit = stdin.emit;
80
86
  stdin.emit = (event, ...args) => {
81
87
  if (event === 'keypress') {
@@ -90,10 +96,12 @@ class Repl {
90
96
  this.paused = true;
91
97
  }
92
98
  resume() {
99
+ var _a;
93
100
  if (this.paused) {
94
101
  stdin.emit = this.pureEmit;
95
102
  }
96
103
  this.paused = false;
104
+ (_a = this.server) === null || _a === void 0 ? void 0 : _a.setPrompt(this.prompt);
97
105
  }
98
106
  wait() {
99
107
  return new Promise((res) => {
@@ -114,7 +122,7 @@ class Repl {
114
122
  if (((_a = this.server) === null || _a === void 0 ? void 0 : _a.getCursorPos().cols) !== this.prompt.length) {
115
123
  (_b = this.server) === null || _b === void 0 ? void 0 : _b.prompt();
116
124
  }
117
- (0, index_1.info)(str);
125
+ (0, index_1.info)('\n' + str);
118
126
  (_c = this.server) === null || _c === void 0 ? void 0 : _c.prompt();
119
127
  }
120
128
  }
@@ -20,8 +20,14 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
20
20
  const compiledRules = runtime_store_1.default.get('context.apig.local.config');
21
21
  if (compiledRules === null)
22
22
  return;
23
- if (typeof compiledRules === 'object')
23
+ if (typeof compiledRules === 'object') {
24
+ (0, index_1.debug)('Using cached API Gateway rules');
24
25
  return compiledRules;
26
+ }
27
+ if (!config_1.apigConfig.exists()) {
28
+ (0, index_1.debug)('No API Gateway configuration found. Skipping API Gateway rules');
29
+ return;
30
+ }
25
31
  if (!config_1.apigConfig.enabled()) {
26
32
  runtime_store_1.default.set('context.apig.local.config', null);
27
33
  (0, index_1.info)();
@@ -1,5 +1,6 @@
1
1
  import { TAppSailDetails } from '../../util_modules/config/lib/appsail';
2
2
  export type TAppSailServerDetails = TAppSailDetails & {
3
+ binPath: string;
3
4
  port: {
4
5
  appsail: {
5
6
  host: number;
@@ -12,8 +12,12 @@ 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
+ const path_1 = require("path");
15
16
  const appsail_utils_1 = require("../../appsail-utils");
16
17
  const error_1 = __importDefault(require("../../error"));
18
+ const java_1 = require("../../fn-utils/lib/java");
19
+ const node_1 = require("../../fn-utils/lib/node");
20
+ const ensure_python_1 = require("../../init/dependencies/python/ensure-python");
17
21
  const port_resolver_1 = __importDefault(require("../../port-resolver"));
18
22
  const runtime_store_1 = __importDefault(require("../../runtime-store"));
19
23
  const config_1 = require("../../util_modules/config");
@@ -27,8 +31,48 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
27
31
  return [];
28
32
  }
29
33
  const validated = yield (0, appsail_utils_1.validateAppSail)(optionTargets);
34
+ const binPathMap = {};
35
+ yield Promise.all(validated.map((target) => __awaiter(void 0, void 0, void 0, function* () {
36
+ var _a;
37
+ try {
38
+ const stack = (_a = target.config) === null || _a === void 0 ? void 0 : _a.stack;
39
+ if (!stack) {
40
+ throw new error_1.default(`Stack is not defined for AppSail target ${target.name}`, {
41
+ exit: 2
42
+ });
43
+ }
44
+ if (binPathMap[stack]) {
45
+ return;
46
+ }
47
+ switch (true) {
48
+ case stack.startsWith('node'): {
49
+ binPathMap[stack] = yield (0, node_1.ensureNodeVersion)(stack, true);
50
+ break;
51
+ }
52
+ case stack.startsWith('java'): {
53
+ const javaBinPath = yield (0, java_1.ensureJava)(stack);
54
+ if (!javaBinPath) {
55
+ throw new error_1.default(`Invalid bin path for ${stack}`, { exit: 1 });
56
+ }
57
+ binPathMap[stack] = javaBinPath;
58
+ break;
59
+ }
60
+ case stack.startsWith('python'): {
61
+ const stackVersion = stack.replace('python_', '');
62
+ const pyExe = yield (0, ensure_python_1.ensurePython)(stackVersion.replace('_', '.'), false, true);
63
+ binPathMap[stack] = (0, path_1.dirname)(pyExe);
64
+ break;
65
+ }
66
+ }
67
+ }
68
+ catch (err) {
69
+ const error = error_1.default.getErrorInstance(err);
70
+ target.validity.valid = false;
71
+ target.validity.reason = error.message;
72
+ }
73
+ })));
30
74
  const filledTargets = yield Promise.all(validated.map((targ) => __awaiter(void 0, void 0, void 0, function* () {
31
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
75
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
32
76
  if (!targ.validity.valid) {
33
77
  return targ;
34
78
  }
@@ -39,19 +83,19 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
39
83
  }).catch((err) => {
40
84
  throw new error_1.default('No free ports between 3000 and 3010. AppSail needs the ports within this range to function properly', { original: err });
41
85
  });
42
- const AppSailServerDetails = Object.assign(Object.assign({}, targ), { port: {
86
+ const AppSailServerDetails = Object.assign(Object.assign({}, targ), { binPath: ((_a = targ.config) === null || _a === void 0 ? void 0 : _a.stack) ? binPathMap[targ.config.stack] : '', port: {
43
87
  appsail: {
44
88
  host: -1
45
89
  },
46
90
  proxy: proxyPort,
47
91
  debug: {
48
92
  host: runtime_store_1.default.get(`context.port.debug.appsail.${targ.name}`, -1),
49
- container: (_b = (_a = targ.config) === null || _a === void 0 ? void 0 : _a.port) === null || _b === void 0 ? void 0 : _b.debug
93
+ container: (_c = (_b = targ.config) === null || _b === void 0 ? void 0 : _b.port) === null || _c === void 0 ? void 0 : _c.debug
50
94
  }
51
95
  } });
52
96
  if (targ.runtime === 'catalyst') {
53
97
  try {
54
- const appsailPort = ((_d = (_c = targ.config) === null || _c === void 0 ? void 0 : _c.port) === null || _d === void 0 ? void 0 : _d.http)
98
+ const appsailPort = ((_e = (_d = targ.config) === null || _d === void 0 ? void 0 : _d.port) === null || _e === void 0 ? void 0 : _e.http)
55
99
  ? yield port_resolver_1.default.getFreePort(targ.config.port.http)
56
100
  : yield port_resolver_1.default.getPort('appsail', 'http', {
57
101
  name: targ.name + '_proxy',
@@ -61,8 +105,8 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
61
105
  AppSailServerDetails.port.appsail.host = appsailPort;
62
106
  }
63
107
  catch (er) {
64
- throw new error_1.default(((_f = (_e = targ.config) === null || _e === void 0 ? void 0 : _e.port) === null || _f === void 0 ? void 0 : _f.http)
65
- ? `The port ${(_h = (_g = targ.config) === null || _g === void 0 ? void 0 : _g.port) === null || _h === void 0 ? void 0 : _h.http} configured for the AppSail ${targ.name} is not available`
108
+ throw new error_1.default(((_g = (_f = targ.config) === null || _f === void 0 ? void 0 : _f.port) === null || _g === void 0 ? void 0 : _g.http)
109
+ ? `The port ${(_j = (_h = targ.config) === null || _h === void 0 ? void 0 : _h.port) === null || _j === void 0 ? void 0 : _j.http} configured for the AppSail ${targ.name} is not available`
66
110
  : 'Unable to find a free port to serve the AppSail: ' + targ.name, {
67
111
  exit: 1,
68
112
  original: er
@@ -77,7 +121,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
77
121
  searchSpan: constants_1.DEFAULT.serve_port.search_span.http_port
78
122
  });
79
123
  AppSailServerDetails.port.appsail.host = hostBindPort;
80
- AppSailServerDetails.port.appsail.container = (_k = (_j = targ.config) === null || _j === void 0 ? void 0 : _j.port) === null || _k === void 0 ? void 0 : _k.http;
124
+ AppSailServerDetails.port.appsail.container = (_l = (_k = targ.config) === null || _k === void 0 ? void 0 : _k.port) === null || _l === void 0 ? void 0 : _l.http;
81
125
  }
82
126
  catch (er) {
83
127
  throw new error_1.default('Unable to find a host port to bind with the AppSail container for serving the AppSail: ' +
@@ -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) {
@@ -35,7 +45,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
45
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
46
  };
37
47
  Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.slate = exports.appsail = exports.apig = exports.functions = exports.client = void 0;
48
+ exports.client = client;
49
+ exports.functions = functions;
50
+ exports.apig = apig;
51
+ exports.appsail = appsail;
52
+ exports.slate = slate;
39
53
  const index_js_1 = __importDefault(require("../../error/index.js"));
40
54
  const port_resolver_1 = __importDefault(require("../../port-resolver"));
41
55
  const runtime_store_1 = __importDefault(require("../../runtime-store"));
@@ -62,32 +76,27 @@ function client() {
62
76
  runtime_store_1.default.set('context.port.http.client.' + clientName, finalPort);
63
77
  });
64
78
  }
65
- exports.client = client;
66
79
  function functions() {
67
80
  return __awaiter(this, void 0, void 0, function* () {
68
81
  const fnModule = yield Promise.resolve().then(() => __importStar(require('../../shell/prepare')));
69
82
  return fnModule.default([constants_1.FN_TYPE.basic, constants_1.FN_TYPE.advanced, constants_1.FN_TYPE.browserLogic]);
70
83
  });
71
84
  }
72
- exports.functions = functions;
73
85
  function apig() {
74
86
  return __awaiter(this, void 0, void 0, function* () {
75
87
  const apigModule = yield Promise.resolve().then(() => __importStar(require('./apig')));
76
88
  yield apigModule.default();
77
89
  });
78
90
  }
79
- exports.apig = apig;
80
91
  function appsail() {
81
92
  return __awaiter(this, void 0, void 0, function* () {
82
93
  const appSailModule = yield Promise.resolve().then(() => __importStar(require('./appsail.js')));
83
94
  return appSailModule.default();
84
95
  });
85
96
  }
86
- exports.appsail = appsail;
87
97
  function slate() {
88
98
  return __awaiter(this, void 0, void 0, function* () {
89
99
  const slateModule = yield Promise.resolve().then(() => __importStar(require('./slate.js')));
90
100
  return slateModule.default();
91
101
  });
92
102
  }
93
- exports.slate = slate;
@@ -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) {
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import { ChildProcess } from 'child_process';
4
2
  import { EventEmitter } from 'events';
5
3
  import { IFnTarget } from '../../fn-utils/lib/common';
@@ -30,6 +30,7 @@ const container_1 = require("../../util_modules/container");
30
30
  const index_js_6 = __importDefault(require("./lib/slate/index.js"));
31
31
  const ansi_colors_1 = require("ansi-colors");
32
32
  const env_1 = require("../../util_modules/env");
33
+ const server_1 = require("../../util_modules/server");
33
34
  const bioUrl = (details, masterPort, addSpaces) => {
34
35
  var _a, _b, _c, _d;
35
36
  const labelMap = {
@@ -40,8 +41,7 @@ const bioUrl = (details, masterPort, addSpaces) => {
40
41
  ? ((_a = details.target) === null || _a === void 0 ? void 0 : _a.name) + ''
41
42
  : `${labelMap[(_b = details.target) === null || _b === void 0 ? void 0 : _b.type]}[${(_c = details.target) === null || _c === void 0 ? void 0 : _c.name}]`;
42
43
  const printLabel = label + ' '.repeat((addSpaces || label.length) - label.length);
43
- const printUrl = 'http://localhost:' +
44
- (masterPort === -1 ? details.httpPort : masterPort) +
44
+ const printUrl = (0, env_1.getLocalAccessDomain)(masterPort === -1 ? details.httpPort : masterPort) +
45
45
  new URL(((_d = details.target) === null || _d === void 0 ? void 0 : _d.url) || '').pathname;
46
46
  return {
47
47
  printUrl,
@@ -55,7 +55,7 @@ const aioUrl = (details, masterPort, addSpaces) => {
55
55
  var _a, _b, _c;
56
56
  const label = addSpaces ? ((_a = details.target) === null || _a === void 0 ? void 0 : _a.name) + '' : `AdvancedIO[${(_b = details.target) === null || _b === void 0 ? void 0 : _b.name}]`;
57
57
  const printLabel = label + ' '.repeat((addSpaces || label.length) - label.length);
58
- const printUrl = `http://localhost:${masterPort}/server/${(_c = details.target) === null || _c === void 0 ? void 0 : _c.name}/`;
58
+ const printUrl = `${(0, env_1.getLocalAccessDomain)(masterPort)}/server/${(_c = details.target) === null || _c === void 0 ? void 0 : _c.name}/`;
59
59
  return {
60
60
  printUrl,
61
61
  printLabel,
@@ -155,8 +155,8 @@ class Server {
155
155
  });
156
156
  }
157
157
  startServer(details, masterPort) {
158
- var _a, _b, _c, _d, _e, _f;
159
158
  return __awaiter(this, void 0, void 0, function* () {
159
+ var _a, _b, _c, _d, _e, _f;
160
160
  if (details.target === undefined) {
161
161
  return details;
162
162
  }
@@ -214,7 +214,7 @@ class Server {
214
214
  : (_b = target.target) === null || _b === void 0 ? void 0 : _b.name;
215
215
  };
216
216
  'stdout' in currentProcess &&
217
- (env_1.isVsCode
217
+ (env_1.isExtension
218
218
  ? (_c = currentProcess.stdout) === null || _c === void 0 ? void 0 : _c.on('data', (chunk) => {
219
219
  const logs = Buffer.isBuffer(chunk)
220
220
  ? chunk.toString().split('\n')
@@ -223,7 +223,7 @@ class Server {
223
223
  })
224
224
  : (_d = currentProcess.stdout) === null || _d === void 0 ? void 0 : _d.pipe(process.stdout));
225
225
  'stderr' in currentProcess &&
226
- (env_1.isVsCode
226
+ (env_1.isExtension
227
227
  ? (_e = currentProcess.stderr) === null || _e === void 0 ? void 0 : _e.on('data', (chunk) => {
228
228
  const logs = Buffer.isBuffer(chunk)
229
229
  ? chunk.toString().split('\n')
@@ -485,7 +485,7 @@ class Server {
485
485
  }
486
486
  const targName = targetSail.name + '';
487
487
  (0, index_1.labeled)(targName +
488
- ' '.repeat((_logTarg.nameMaxLength || targName.length) - targName.length), `http://localhost:${targetSail.port.proxy}`).MESSAGE();
488
+ ' '.repeat((_logTarg.nameMaxLength || targName.length) - targName.length), (0, env_1.getLocalAccessDomain)(targetSail.port.proxy)).MESSAGE();
489
489
  });
490
490
  (0, index_1.info)();
491
491
  break;
@@ -497,7 +497,7 @@ class Server {
497
497
  loggedEntries++;
498
498
  (0, index_1.info)();
499
499
  const targApp = logTarg;
500
- const appUrl = `http://localhost:${masterPort}/app/`;
500
+ const appUrl = `${(0, env_1.getLocalAccessDomain)(masterPort)}/app/`;
501
501
  const label = `client[${(_a = targApp.target) === null || _a === void 0 ? void 0 : _a.name}]`;
502
502
  (0, index_1.info)((0, ansi_colors_1.bold)(' >>>>>>>>>>>>> Web Client <<<<<<<<<<<<'));
503
503
  (0, index_1.labeled)(label, appUrl).MESSAGE();
@@ -545,10 +545,10 @@ class Server {
545
545
  var _a, _b;
546
546
  const target = targetdetails.target;
547
547
  (_a = target.watcher) === null || _a === void 0 ? void 0 : _a.on('preparing', () => __awaiter(this, void 0, void 0, function* () {
548
- var _c;
548
+ var _a;
549
549
  targetdetails.restarting = true;
550
550
  (0, container_1.isContainer)()
551
- ? (_c = targetdetails.process) === null || _c === void 0 ? void 0 : _c.emit('preparing', targetdetails)
551
+ ? (_a = targetdetails.process) === null || _a === void 0 ? void 0 : _a.emit('preparing', targetdetails)
552
552
  : yield this.kill(targetdetails);
553
553
  }));
554
554
  (_b = target.watcher) === null || _b === void 0 ? void 0 : _b.on('compiled', () => __awaiter(this, void 0, void 0, function* () {
@@ -603,8 +603,8 @@ class Server {
603
603
  });
604
604
  }
605
605
  kill(target) {
606
- var _a;
607
606
  return __awaiter(this, void 0, void 0, function* () {
607
+ var _a;
608
608
  const serverProcess = target.process;
609
609
  if (!serverProcess) {
610
610
  throw new error_1.default('Unable to kill. Process empty: ' + ((_a = target.target) === null || _a === void 0 ? void 0 : _a.name), {
@@ -628,7 +628,21 @@ class Server {
628
628
  const signal = serverProcess.spawnfile.includes('python')
629
629
  ? 'SIGTERM'
630
630
  : 'SIGINT';
631
- serverProcess.kill(signal);
631
+ switch (target.type) {
632
+ case 'functions':
633
+ case 'server': {
634
+ serverProcess.pid
635
+ ? (0, server_1.killProcessTree)(serverProcess.pid, signal)
636
+ : serverProcess.kill(signal);
637
+ break;
638
+ }
639
+ case 'appsail':
640
+ case 'slate':
641
+ case 'client': {
642
+ serverProcess.kill(signal);
643
+ break;
644
+ }
645
+ }
632
646
  serverProcess.once('close', resolve);
633
647
  }
634
648
  else {
@@ -21,8 +21,6 @@ const project_1 = require("../../../../util_modules/project");
21
21
  const shell_1 = require("../../../../util_modules/shell");
22
22
  const endpoints_1 = require("../../../../endpoints");
23
23
  const archiver_1 = __importDefault(require("../../../../archiver"));
24
- const option_1 = require("../../../../util_modules/option");
25
- const execute_script_1 = require("../../../../execute-script");
26
24
  const master_1 = __importDefault(require("../master"));
27
25
  const ansi_colors_1 = require("ansi-colors");
28
26
  const common_1 = require("../../../../init/util/common");
@@ -32,15 +30,7 @@ const container_1 = require("../../../../util_modules/container");
32
30
  const container_plugin_1 = require("@zcatalyst/container-plugin");
33
31
  const appsail_1 = require("../../../../util_modules/config/lib/appsail");
34
32
  const image_1 = require("@zcatalyst/container-plugin/out/endpoints/image");
35
- function executeHook(script, name, moduleSource) {
36
- return __awaiter(this, void 0, void 0, function* () {
37
- if ((0, option_1.getOptionValue)('ignoreScripts', false)) {
38
- (0, index_1.debug)(`skipping ${name} hook`);
39
- return;
40
- }
41
- return (0, execute_script_1.executeCommand)(script, { moduleSource, feature: name });
42
- });
43
- }
33
+ const util_1 = require("./util");
44
34
  const startAppSail = (port, opts) => {
45
35
  if (port === -1) {
46
36
  throw new error_1.default('The AppSail Http port value is invalid: ' + port, { exit: 2 });
@@ -54,7 +44,7 @@ const startAppSail = (port, opts) => {
54
44
  cwd: opts.target,
55
45
  stdio: 'pipe',
56
46
  killSignal: 'SIGINT',
57
- env: Object.assign({ X_ZOHO_CATALYST_LISTEN_PORT: port + '', X_ZOHO_CATALYST_RUNTIME_MEMORY: opts.memory + '', X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth, X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin, X_ZOHO_STRATUS_RESOURCE_SUFFIX: constants_1.ORIGIN.stratusSuffix, X_ZOHO_CATALYST_IS_LOCAL: 'true', X_ZC_RESOURCE_NAME: opts.name + '', CATALYST_PORTAL_DOMAIN: constants_1.ORIGIN.iamPortal, CATALYST_PROJECT_TIMEZONE: (0, project_1.getProjectTimezone)(Intl.DateTimeFormat().resolvedOptions().timeZone) }, (opts.env || {}))
47
+ env: Object.assign({ X_ZOHO_CATALYST_LISTEN_PORT: port + '', X_ZOHO_CATALYST_RUNTIME_MEMORY: opts.memory + '', X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth, X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin, X_ZOHO_STRATUS_RESOURCE_SUFFIX: constants_1.ORIGIN.stratusSuffix, X_ZOHO_CATALYST_IS_LOCAL: 'true', X_ZC_RESOURCE_NAME: opts.name + '', CATALYST_PORTAL_DOMAIN: constants_1.ORIGIN.iamPortal, CATALYST_PROJECT_TIMEZONE: (0, project_1.getProjectTimezone)(Intl.DateTimeFormat().resolvedOptions().timeZone), PATH: opts.bin ? `${opts.bin}${path_1.delimiter}${process.env.PATH}` : process.env.PATH }, (opts.env || {}))
58
48
  }).RAW();
59
49
  return new Promise((_res, _rej) => {
60
50
  child.on('spawn', () => _res(child));
@@ -62,8 +52,8 @@ const startAppSail = (port, opts) => {
62
52
  });
63
53
  };
64
54
  function startAppSailWithContainer(serverDetails) {
65
- var _a, _b, _c, _d, _e, _f, _g;
66
55
  return __awaiter(this, void 0, void 0, function* () {
56
+ var _a, _b, _c, _d, _e, _f, _g;
67
57
  const targetSail = serverDetails.target;
68
58
  if (!targetSail || !targetSail.config) {
69
59
  throw new error_1.default('Invalid AppSail target', { exit: 2 });
@@ -137,7 +127,7 @@ function startAppSailWithContainer(serverDetails) {
137
127
  });
138
128
  }
139
129
  exports.default = (serverDetails) => __awaiter(void 0, void 0, void 0, function* () {
140
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
130
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
141
131
  let child;
142
132
  const targetSail = serverDetails.target;
143
133
  if (!targetSail || !targetSail.config) {
@@ -145,7 +135,7 @@ exports.default = (serverDetails) => __awaiter(void 0, void 0, void 0, function*
145
135
  }
146
136
  if ((targetSail === null || targetSail === void 0 ? void 0 : targetSail.runtime) === 'catalyst') {
147
137
  if ((_a = targetSail.config.scripts) === null || _a === void 0 ? void 0 : _a.preserve) {
148
- yield executeHook(targetSail.config.scripts.preserve, `AppSail [PRESERVE] [${targetSail.name}]`, targetSail.source);
138
+ yield util_1.AppsailUtils.executeHook(targetSail.config.scripts.preserve, `AppSail [PRESERVE] [${targetSail.name}]`, targetSail.source);
149
139
  }
150
140
  const buildPath = (_b = targetSail.config) === null || _b === void 0 ? void 0 : _b.build_path;
151
141
  if (!buildPath) {
@@ -185,7 +175,8 @@ exports.default = (serverDetails) => __awaiter(void 0, void 0, void 0, function*
185
175
  command: targetSail.config.command,
186
176
  memory: targetSail.config.memory || 256,
187
177
  env: targetSail.config.env_variables,
188
- name: targetSail.name
178
+ name: targetSail.name,
179
+ bin: targetSail.binPath
189
180
  });
190
181
  break;
191
182
  }
@@ -196,21 +187,22 @@ exports.default = (serverDetails) => __awaiter(void 0, void 0, void 0, function*
196
187
  command: targetSail.config.command,
197
188
  memory: targetSail.config.memory || 256,
198
189
  env: targetSail.config.env_variables,
199
- name: targetSail.name
190
+ name: targetSail.name,
191
+ bin: targetSail.binPath
200
192
  });
201
193
  break;
202
194
  }
203
195
  case (_l = (_k = targetSail.config) === null || _k === void 0 ? void 0 : _k.stack) === null || _l === void 0 ? void 0 : _l.startsWith('java'): {
204
196
  if (targetSail.config.platform === 'war') {
205
- const jettyPath = (0, path_1.join)(constants_1.ENVPATH.runtimes.data, 'jetty');
206
- if (!(yield fs_1.ASYNC.fileExists((0, path_1.join)(jettyPath, 'start.jar')).catch((err) => (0, index_1.debug)(err)))) {
197
+ const jettyConfig = util_1.AppsailUtils.getJettyConfig(((_m = targetSail.config) === null || _m === void 0 ? void 0 : _m.stack) || '', target, targetSail.port.appsail.host);
198
+ if (!(yield fs_1.ASYNC.fileExists((0, path_1.join)(jettyConfig.jettyPath, 'start.jar')).catch((err) => (0, index_1.debug)(err)))) {
207
199
  try {
208
- yield fs_1.ASYNC.ensureDir(jettyPath);
200
+ yield fs_1.ASYNC.ensureDir(jettyConfig.jettyPath);
209
201
  const appxAPI = yield (0, endpoints_1.appSailAPI)();
210
- const jettyZip = yield appxAPI.downloadJetty();
202
+ const jettyZip = yield appxAPI.downloadJetty(jettyConfig.jettyDownloadUrl);
211
203
  const zip = new archiver_1.default();
212
204
  zip.load(jettyZip);
213
- zip.extract(jettyPath, '/', {
205
+ zip.extract(jettyConfig.jettyPath, '/', {
214
206
  isFolder: true
215
207
  });
216
208
  yield zip.finalize();
@@ -220,14 +212,14 @@ exports.default = (serverDetails) => __awaiter(void 0, void 0, void 0, function*
220
212
  throw err;
221
213
  }
222
214
  }
223
- const jettyCommand = `java -jar "${(0, path_1.join)(jettyPath, 'start.jar')}" -Djetty.deploy.monitoredPath="${(0, project_1.resolveProjectPath)(target)}" -Djetty.http.port=${targetSail.port.appsail.host}`;
224
215
  child = yield startAppSail(targetSail.port.appsail.host, {
225
216
  target,
226
217
  type: 'war',
227
- command: jettyCommand,
218
+ command: jettyConfig.jettyCommand,
228
219
  memory: targetSail.config.memory || 256,
229
- env: Object.assign({ JETTY_BASE: (0, path_1.join)(jettyPath, 'JETTY_BASE') }, targetSail.config.env_variables),
230
- name: targetSail.name
220
+ env: Object.assign({ JETTY_BASE: (0, path_1.join)(jettyConfig.jettyPath, 'JETTY_BASE') }, targetSail.config.env_variables),
221
+ name: targetSail.name,
222
+ bin: targetSail.binPath
231
223
  });
232
224
  break;
233
225
  }
@@ -237,7 +229,8 @@ exports.default = (serverDetails) => __awaiter(void 0, void 0, void 0, function*
237
229
  type: 'javase',
238
230
  memory: targetSail.config.memory || 256,
239
231
  env: targetSail.config.env_variables,
240
- name: targetSail.name
232
+ name: targetSail.name,
233
+ bin: targetSail.binPath
241
234
  });
242
235
  break;
243
236
  }
@@ -248,7 +241,7 @@ exports.default = (serverDetails) => __awaiter(void 0, void 0, void 0, function*
248
241
  errorId: 'SERVE-APPSAIL-4',
249
242
  arg: [
250
243
  (0, ansi_colors_1.bold)(targetSail.name),
251
- ansi_colors_1.bold.red(((_m = targetSail.config) === null || _m === void 0 ? void 0 : _m.stack) + ''),
244
+ ansi_colors_1.bold.red(((_o = targetSail.config) === null || _o === void 0 ? void 0 : _o.stack) + ''),
252
245
  appSailRuntime.runtimes.map((val) => (0, ansi_colors_1.bold)(`* ${val}`)).join('\n')
253
246
  ]
254
247
  });
@@ -273,7 +266,7 @@ exports.default = (serverDetails) => __awaiter(void 0, void 0, void 0, function*
273
266
  (0, index_1.debug)('Error with the AppSail proxy server: ', err);
274
267
  });
275
268
  child.once('exit', (code) => __awaiter(void 0, void 0, void 0, function* () {
276
- var _o, _p, _q, _r, _s, _t, _u;
269
+ var _a, _b, _c, _d, _e, _f, _g;
277
270
  typeof targetSail.port.appsail === 'number' &&
278
271
  port_resolver_1.default.freePort(targetSail.port.appsail);
279
272
  port_resolver_1.default.freePort(targetSail.port.proxy);
@@ -287,14 +280,14 @@ exports.default = (serverDetails) => __awaiter(void 0, void 0, void 0, function*
287
280
  errorId: 'SERVE-APPSAIL-3',
288
281
  arg: [
289
282
  (0, ansi_colors_1.bold)(targetSail.name),
290
- ((_o = targetSail.config) === null || _o === void 0 ? void 0 : _o.command) || '',
291
- (0, ansi_colors_1.underline)(((_p = targetSail.config) === null || _p === void 0 ? void 0 : _p.build_path) || ''),
292
- ((_q = targetSail.config) === null || _q === void 0 ? void 0 : _q.stack) || ''
283
+ ((_a = targetSail.config) === null || _a === void 0 ? void 0 : _a.command) || '',
284
+ (0, ansi_colors_1.underline)(((_b = targetSail.config) === null || _b === void 0 ? void 0 : _b.build_path) || ''),
285
+ ((_c = targetSail.config) === null || _c === void 0 ? void 0 : _c.stack) || ''
293
286
  ]
294
287
  });
295
288
  }
296
- if ((_s = (_r = targetSail.config) === null || _r === void 0 ? void 0 : _r.scripts) === null || _s === void 0 ? void 0 : _s.postserve) {
297
- yield executeHook((_u = (_t = targetSail.config) === null || _t === void 0 ? void 0 : _t.scripts) === null || _u === void 0 ? void 0 : _u.postserve, `AppSail [POSTSERVE] [${targetSail.name}]`, targetSail.source);
289
+ if ((_e = (_d = targetSail.config) === null || _d === void 0 ? void 0 : _d.scripts) === null || _e === void 0 ? void 0 : _e.postserve) {
290
+ yield util_1.AppsailUtils.executeHook((_g = (_f = targetSail.config) === null || _f === void 0 ? void 0 : _f.scripts) === null || _g === void 0 ? void 0 : _g.postserve, `AppSail [POSTSERVE] [${targetSail.name}]`, targetSail.source);
298
291
  }
299
292
  }));
300
293
  return child;