zcatalyst-cli 1.18.0-beta.0 → 1.18.0-beta.10

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 (160) hide show
  1. package/docs/command_needs/rc.toml +8 -8
  2. package/docs/commands/ds/import.toml +5 -5
  3. package/docs/commands/event/generate/job.toml +7 -0
  4. package/docs/commands/zest/generate/index.toml +4 -0
  5. package/docs/endpoints/lib/job-scheduling.toml +3 -0
  6. package/docs/internal/command.toml +5 -0
  7. package/docs/serve/server/lib/appsail/index.toml +22 -1
  8. package/lib/appsail-utils.js +4 -10
  9. package/lib/authentication/index.js +1 -0
  10. package/lib/authentication/login.js +8 -4
  11. package/lib/bin/catalyst.js +1 -1
  12. package/lib/code-deck.js +7 -7
  13. package/lib/command_needs/rc.js +8 -8
  14. package/lib/commands/appsail/add.js +3 -2
  15. package/lib/commands/client/setup.js +2 -1
  16. package/lib/commands/codelib/install.js +6 -2
  17. package/lib/commands/ds/import.js +37 -21
  18. package/lib/commands/event/generate/index.js +16 -3
  19. package/lib/commands/event/generate/integ.js +2 -1
  20. package/lib/commands/event/generate/job.js +82 -0
  21. package/lib/commands/functions/add.js +2 -1
  22. package/lib/commands/functions/delete.js +2 -4
  23. package/lib/commands/functions/setup.js +2 -1
  24. package/lib/commands/functions/shell.js +1 -0
  25. package/lib/commands/iac/export.js +5 -1
  26. package/lib/commands/iac/import.js +4 -1
  27. package/lib/commands/index.js +4 -1
  28. package/lib/commands/init.js +10 -7
  29. package/lib/commands/login.js +1 -0
  30. package/lib/commands/logout.js +1 -0
  31. package/lib/commands/pull.js +1 -0
  32. package/lib/commands/serve.js +1 -1
  33. package/lib/commands/whoami.js +1 -0
  34. package/lib/commands/zest/generate/index.js +304 -0
  35. package/lib/deploy/features/appsail/index.js +42 -25
  36. package/lib/deploy/features/appsail/utils.js +4 -5
  37. package/lib/endpoints/index.js +24 -3
  38. package/lib/endpoints/lib/appsail.js +7 -1
  39. package/lib/endpoints/lib/ds-bulk.js +1 -0
  40. package/lib/endpoints/lib/job-scheduling.js +61 -0
  41. package/lib/endpoints/lib/stratus.js +63 -0
  42. package/lib/endpoints/lib/tunnel.js +18 -0
  43. package/lib/endpoints/lib/zest.js +124 -0
  44. package/lib/event_generate/stratus.js +52 -0
  45. package/lib/express_middlewares/logger.js +2 -4
  46. package/lib/fn-utils/lib/common.js +8 -4
  47. package/lib/fn-utils/lib/java.js +1 -1
  48. package/lib/fn-utils/lib/python.js +2 -2
  49. package/lib/fn-watcher.js +1 -1
  50. package/lib/iac/status/deploy.js +1 -5
  51. package/lib/init/dependencies/python/ensure-python.js +6 -8
  52. package/lib/init/features/appsail/index.js +38 -27
  53. package/lib/init/features/client/index.js +2 -1
  54. package/lib/init/features/functions/index.js +4 -0
  55. package/lib/init/features/functions/languages/python.js +21 -5
  56. package/lib/init/features/project.js +6 -15
  57. package/lib/internal/api.js +26 -7
  58. package/lib/internal/command.js +31 -7
  59. package/lib/migration/index.js +4 -2
  60. package/lib/optional-import.js +3 -2
  61. package/lib/prompt/index.js +5 -2
  62. package/lib/prompt/types/file-path.js +1 -1
  63. package/lib/prompt/types/search-box.js +281 -0
  64. package/lib/prompt/types/tree.js +3 -3
  65. package/lib/serve/features/appsail.js +3 -4
  66. package/lib/serve/index.js +1 -2
  67. package/lib/serve/server/index.js +52 -23
  68. package/lib/serve/server/lib/appsail/index.js +89 -39
  69. package/lib/serve/server/lib/appsail/start.js +9 -1
  70. package/lib/serve/server/lib/java/aio_server/lib/catalyst-cli-java-runtime-1.0.0.jar +0 -0
  71. package/lib/serve/server/lib/java/aio_server/lib/{catalyst-function-sdk-1.0.0.jar → catalyst-function-sdk-1.1.0.jar} +0 -0
  72. package/lib/serve/server/lib/java/aio_server/lib/catalyst-java-runtime-1.0.0.jar +0 -0
  73. package/lib/serve/server/lib/java/index.js +2 -2
  74. package/lib/serve/server/lib/master/appsail.js +53 -0
  75. package/lib/serve/server/lib/master/functions.js +34 -0
  76. package/lib/serve/server/lib/master/index.js +155 -0
  77. package/lib/{express_middlewares/unknownReqProxy.js → serve/server/lib/master/unknown-req-proxy.js} +9 -9
  78. package/lib/serve/server/lib/master/utils.js +142 -0
  79. package/lib/serve/server/lib/master/web-client.js +39 -0
  80. package/lib/serve/server/lib/node/index.js +3 -3
  81. package/lib/serve/server/lib/node/server/package-lock.json +12 -0
  82. package/lib/serve/server/lib/python/index.js +3 -3
  83. package/lib/shell/dependencies/http-functions.js +1 -1
  84. package/lib/shell/dependencies/invoker/bio/java/lib/catalyst-function-sdk-1.1.0.jar +0 -0
  85. package/lib/shell/dependencies/invoker/cron/java/JavacronInvoker.java +1 -1
  86. package/lib/shell/dependencies/invoker/cron/java/lib/catalyst-function-sdk-1.1.0.jar +0 -0
  87. package/lib/shell/dependencies/invoker/event/java/JavaeventInvoker.java +2 -1
  88. package/lib/shell/dependencies/invoker/event/java/lib/catalyst-function-sdk-1.1.0.jar +0 -0
  89. package/lib/shell/dependencies/invoker/event/node.mjs +1 -0
  90. package/lib/shell/dependencies/invoker/integ/java/JavaintegInvoker.java +15 -0
  91. package/lib/shell/dependencies/invoker/integ/java/lib/catalyst-function-sdk-1.1.0.jar +0 -0
  92. package/lib/shell/dependencies/invoker/integ/node.mjs +13 -0
  93. package/lib/shell/dependencies/invoker/job/java/JavajobInvoker.java +268 -0
  94. package/lib/shell/dependencies/invoker/job/java/lib/catalyst-function-sdk-1.1.0.jar +0 -0
  95. package/lib/shell/dependencies/invoker/job/java/lib/org.json.jar +0 -0
  96. package/lib/shell/dependencies/invoker/job/node.mjs +93 -0
  97. package/lib/shell/dependencies/local-function.js +122 -13
  98. package/lib/shell/dependencies/tunnel-server.js +52 -23
  99. package/lib/shell/index.js +22 -22
  100. package/lib/shell/prepare/languages/index.js +4 -4
  101. package/lib/shell/prepare/languages/java.js +1 -2
  102. package/lib/shell/prepare/languages/python.js +10 -16
  103. package/lib/throbber/index.js +6 -1
  104. package/lib/userConfig.js +7 -1
  105. package/lib/util_modules/config/index.js +1 -1
  106. package/lib/util_modules/config/lib/{appSail.js → appsail.js} +64 -10
  107. package/lib/util_modules/config/lib/client.js +6 -8
  108. package/lib/util_modules/config/lib/functions.js +6 -8
  109. package/lib/util_modules/constants/lib/dc-type.js +8 -0
  110. package/lib/util_modules/constants/lib/default.js +9 -9
  111. package/lib/util_modules/constants/lib/event-action.js +1 -0
  112. package/lib/util_modules/constants/lib/event-source.js +1 -0
  113. package/lib/util_modules/constants/lib/fn-type.js +2 -1
  114. package/lib/util_modules/constants/lib/needed-scopes.js +53 -44
  115. package/lib/util_modules/constants/lib/placeholders.js +7 -0
  116. package/lib/util_modules/constants/lib/ref-mapping.js +2 -1
  117. package/lib/util_modules/constants/lib/remote-mapping.js +2 -1
  118. package/lib/util_modules/constants/lib/scopes.js +17 -2
  119. package/lib/util_modules/constants/lib/template.js +9 -4
  120. package/lib/util_modules/constants/lib/urls.js +16 -0
  121. package/lib/util_modules/fs/lib/async.js +14 -4
  122. package/lib/util_modules/fs/lib/sync.js +12 -1
  123. package/lib/util_modules/server.js +2 -4
  124. package/lib/winston.js +17 -11
  125. package/package.json +4 -2
  126. package/templates/event/job.json +30 -0
  127. package/templates/init/client/react/react_js/template/src/index.js +3 -3
  128. package/templates/init/client/react/react_ts/template/src/index.tsx +3 -3
  129. package/templates/init/client/react/react_ts/template.json +3 -3
  130. package/templates/init/functions/java/job/.classpath +6 -0
  131. package/templates/init/functions/java/job/.project +17 -0
  132. package/templates/init/functions/java/job/catalyst-config.json +11 -0
  133. package/templates/init/functions/java/job/sample.java +34 -0
  134. package/templates/init/functions/node/aio/package.json +1 -1
  135. package/templates/init/functions/node/aio/sample.js +7 -0
  136. package/templates/init/functions/node/bio/package.json +1 -1
  137. package/templates/init/functions/node/bio/sample.js +5 -0
  138. package/templates/init/functions/node/bio/types/basicio.d.ts +57 -0
  139. package/templates/init/functions/node/cron/package.json +1 -1
  140. package/templates/init/functions/node/cron/sample.js +5 -0
  141. package/templates/init/functions/node/cron/types/cron.d.ts +64 -0
  142. package/templates/init/functions/node/event/package.json +1 -1
  143. package/templates/init/functions/node/event/sample.js +11 -8
  144. package/templates/init/functions/node/event/types/event.d.ts +82 -0
  145. package/templates/init/functions/node/integ/cliq/package.json +1 -1
  146. package/templates/init/functions/node/integ/convokraft/package.json +1 -1
  147. package/templates/init/functions/node/{stream → job}/catalyst-config.json +3 -2
  148. package/templates/init/functions/node/{stream → job}/package.json +1 -1
  149. package/templates/init/functions/node/job/sample.js +27 -0
  150. package/templates/init/functions/node/job/types/job.d.ts +62 -0
  151. package/templates/init/functions/python/job/catalyst-config.json +11 -0
  152. package/templates/init/functions/python/job/requirements.txt +1 -0
  153. package/templates/init/functions/python/job/sample.py +22 -0
  154. package/templates/init.txt +14 -0
  155. package/lib/serve/server/lib/master.js +0 -326
  156. package/lib/shell/dependencies/invoker/bio/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  157. package/lib/shell/dependencies/invoker/cron/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  158. package/lib/shell/dependencies/invoker/event/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  159. package/lib/shell/dependencies/invoker/integ/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  160. package/templates/init/functions/node/stream/sample.js +0 -15
@@ -0,0 +1,281 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const chalk_1 = __importDefault(require("chalk"));
7
+ const cli_cursor_1 = __importDefault(require("cli-cursor"));
8
+ const figures_1 = __importDefault(require("figures"));
9
+ const choices_1 = __importDefault(require("inquirer/lib/objects/choices"));
10
+ const base_1 = __importDefault(require("inquirer/lib/prompts/base"));
11
+ const events_1 = __importDefault(require("inquirer/lib/utils/events"));
12
+ const paginator_1 = __importDefault(require("inquirer/lib/utils/paginator"));
13
+ const operators_1 = require("rxjs/operators");
14
+ class SearchBox extends base_1.default {
15
+ constructor(questions, rl, answers) {
16
+ super(questions, rl, answers);
17
+ this.pointer = 0;
18
+ if (this.opt.highlight == null) {
19
+ this.opt.highlight = false;
20
+ }
21
+ if (typeof this.opt.searchable == null) {
22
+ this.opt.searchable = false;
23
+ }
24
+ if (typeof this.opt.default == null) {
25
+ this.opt.default = undefined;
26
+ }
27
+ if (this.opt.source == null) {
28
+ this.throwParamError('source');
29
+ }
30
+ if (this.opt.notFoundMsg === undefined) {
31
+ this.opt.notFoundMsg = 'No results...';
32
+ }
33
+ if (this.opt.searchMsg === undefined) {
34
+ this.opt.searchMsg = 'Searching...';
35
+ }
36
+ this.pointer = 0;
37
+ this.firstSourceLoading = true;
38
+ this.choices = new choices_1.default([], answers);
39
+ this.checkedChoices = [];
40
+ this.value = [];
41
+ this.lastQuery = undefined;
42
+ this.searching = false;
43
+ this.lastSourcePromise = undefined;
44
+ this.default = this.opt.default;
45
+ this.opt.default = undefined;
46
+ this.selection = [];
47
+ this.done = undefined;
48
+ this.paginator = new paginator_1.default(this.screen);
49
+ }
50
+ _run(callback) {
51
+ this.done = callback;
52
+ this.executeSource().then(() => {
53
+ const events = (0, events_1.default)(this.rl);
54
+ const validation = this.handleSubmitEvents(events.line.pipe((0, operators_1.map)(this.getCurrentValue.bind(this))));
55
+ validation.success.forEach(this.onEnd.bind(this));
56
+ validation.error.forEach(this.onError.bind(this));
57
+ events.normalizedUpKey
58
+ .pipe((0, operators_1.takeUntil)(validation.success))
59
+ .forEach(this.onUpKey.bind(this));
60
+ events.normalizedDownKey
61
+ .pipe((0, operators_1.takeUntil)(validation.success))
62
+ .forEach(this.onDownKey.bind(this));
63
+ events.spaceKey.pipe((0, operators_1.takeUntil)(validation.success)).forEach(this.onSpaceKey.bind(this));
64
+ if (this.opt.searchable === false) {
65
+ events.numberKey
66
+ .pipe((0, operators_1.takeUntil)(validation.success))
67
+ .forEach(this.onNumberKey.bind(this));
68
+ events.aKey.pipe((0, operators_1.takeUntil)(validation.success)).forEach(this.onAllKey.bind(this));
69
+ events.iKey
70
+ .pipe((0, operators_1.takeUntil)(validation.success))
71
+ .forEach(this.onInverseKey.bind(this));
72
+ }
73
+ else {
74
+ events.keypress
75
+ .pipe((0, operators_1.takeUntil)(validation.success))
76
+ .forEach(this.onKeypress.bind(this));
77
+ }
78
+ if (this.rl.line) {
79
+ this.onKeypress();
80
+ }
81
+ cli_cursor_1.default.hide();
82
+ this.render();
83
+ });
84
+ return this;
85
+ }
86
+ getValue(choice) {
87
+ if (choice.type === 'separator') {
88
+ return undefined;
89
+ }
90
+ return choice.value;
91
+ }
92
+ executeSource() {
93
+ let sourcePromise;
94
+ this.rl.line = this.rl.line.trim();
95
+ if (this.rl.line === this.lastQuery) {
96
+ return Promise.resolve(undefined);
97
+ }
98
+ if (this.opt.searchable) {
99
+ sourcePromise = this.opt.source(this.answers, this.rl.line);
100
+ }
101
+ else {
102
+ sourcePromise = this.opt.source(this.answers, undefined);
103
+ }
104
+ this.lastQuery = this.rl.line;
105
+ this.lastSourcePromise = sourcePromise;
106
+ this.searching = true;
107
+ sourcePromise.then((choices) => {
108
+ if (this.lastSourcePromise !== sourcePromise) {
109
+ return;
110
+ }
111
+ this.searching = false;
112
+ this.choices = new choices_1.default(choices, this.answers);
113
+ this.choices.forEach((choice) => {
114
+ var _a;
115
+ if (this.value.some((eachValue) => this.getValue(choice) === eachValue)) {
116
+ this.toggleChoice(choice, true);
117
+ }
118
+ else {
119
+ this.toggleChoice(choice, false);
120
+ }
121
+ if (this.default !== null) {
122
+ if ((_a = this.default) === null || _a === void 0 ? void 0 : _a.some((defaultValue) => this.getValue(choice) === defaultValue)) {
123
+ this.toggleChoice(choice, true);
124
+ }
125
+ }
126
+ });
127
+ this.pointer = 0;
128
+ this.render();
129
+ this.default = undefined;
130
+ this.firstSourceLoading = false;
131
+ });
132
+ return sourcePromise;
133
+ }
134
+ render(error) {
135
+ let message = this.getQuestion();
136
+ let bottomContent = '';
137
+ if (this.status === 'answered') {
138
+ message += chalk_1.default.cyan(this.selection.join(', '));
139
+ return this.screen.render(message, bottomContent);
140
+ }
141
+ if (this.firstSourceLoading) {
142
+ if (this.opt.searchable) {
143
+ message += `(Press ${chalk_1.default.cyan.bold('<space>')} to select, or type anything to filter the list)`;
144
+ }
145
+ else {
146
+ message += `(Press ${chalk_1.default.cyan.bold('<space>')} to select, ${chalk_1.default.cyan.bold('<a>')} to toggle all, ${chalk_1.default.cyan.bold('<i>')} to invert selection)`;
147
+ }
148
+ }
149
+ if (this.opt.searchable) {
150
+ message += this.rl.line;
151
+ }
152
+ if (this.searching) {
153
+ message += `\n ${chalk_1.default.cyan(this.opt.searchMsg)}`;
154
+ }
155
+ else if (!this.choices.length) {
156
+ message += `\n ${chalk_1.default.yellow(this.opt.notFoundMsg)}`;
157
+ }
158
+ else {
159
+ const choicesStr = this.renderChoices(this.choices, this.pointer);
160
+ const choice = this.choices.getChoice(this.pointer);
161
+ const indexPosition = this.choices.indexOf(choice);
162
+ message += `\n${this.paginator.paginate(choicesStr, indexPosition, this.opt.pageSize)}`;
163
+ }
164
+ if (error) {
165
+ bottomContent = chalk_1.default.red('>> ') + error;
166
+ }
167
+ return this.screen.render(message, bottomContent);
168
+ }
169
+ onEnd(state) {
170
+ var _a;
171
+ this.status = 'answered';
172
+ this.render();
173
+ this.screen.done();
174
+ cli_cursor_1.default.show();
175
+ (_a = this.done) === null || _a === void 0 ? void 0 : _a.call(this, 'value' in state ? state.value : undefined);
176
+ }
177
+ onError(state) {
178
+ if (state.isValid) {
179
+ this.render();
180
+ }
181
+ }
182
+ getCurrentValue() {
183
+ this.selection = this.checkedChoices.map((checkedChoice) => checkedChoice.short);
184
+ const values = this.checkedChoices.map((checkedChoice) => checkedChoice.value);
185
+ return values;
186
+ }
187
+ onUpKey() {
188
+ const len = this.choices.realLength;
189
+ this.pointer = this.pointer > 0 ? this.pointer - 1 : len - 1;
190
+ this.render();
191
+ }
192
+ onDownKey() {
193
+ const len = this.choices.realLength;
194
+ this.pointer = this.pointer < len - 1 ? this.pointer + 1 : 0;
195
+ this.render();
196
+ }
197
+ onNumberKey(input) {
198
+ if (input <= this.choices.realLength) {
199
+ this.pointer = input - 1;
200
+ this.toggleChoice(this.choices.getChoice(this.pointer));
201
+ }
202
+ this.render();
203
+ }
204
+ onSpaceKey() {
205
+ if (this.choices.getChoice(this.pointer) == null) {
206
+ return;
207
+ }
208
+ this.toggleChoice(this.choices.getChoice(this.pointer));
209
+ this.render();
210
+ }
211
+ onAllKey() {
212
+ const shouldBeChecked = Boolean(this.choices.find((choice) => {
213
+ return choice.type !== 'separator' && !choice.checked;
214
+ }));
215
+ this.choices.forEach((choice) => {
216
+ if (choice.type !== 'separator') {
217
+ choice.checked = shouldBeChecked;
218
+ }
219
+ return choice;
220
+ });
221
+ this.render();
222
+ }
223
+ onInverseKey() {
224
+ this.choices.forEach((choice) => {
225
+ if (choice.type !== 'separator') {
226
+ choice.checked = !choice.checked;
227
+ }
228
+ });
229
+ this.render();
230
+ }
231
+ onKeypress() {
232
+ this.executeSource();
233
+ this.render();
234
+ }
235
+ toggleChoice(choice, nextChecked) {
236
+ var _a;
237
+ if (choice.type === 'separator') {
238
+ return;
239
+ }
240
+ const checked = nextChecked == null ? !((_a = choice.checked) !== null && _a !== void 0 ? _a : false) : nextChecked;
241
+ this.value = this.value.filter((eachValue) => eachValue !== choice.value);
242
+ this.checkedChoices = this.checkedChoices.filter((checkedChoice) => checkedChoice.value !== choice.value);
243
+ choice.checked = false;
244
+ if (checked === true) {
245
+ this.value.push(choice.value);
246
+ this.checkedChoices.push(choice);
247
+ choice.checked = true;
248
+ }
249
+ }
250
+ static getCheckboxFigure(checked = false) {
251
+ return checked ? chalk_1.default.green(figures_1.default.radioOn) : figures_1.default.radioOff;
252
+ }
253
+ renderChoices(choices, pointer) {
254
+ const output = [];
255
+ let separatorOffset = 0;
256
+ choices.forEach((choice, index) => {
257
+ if (choice.type === 'separator') {
258
+ separatorOffset += 1;
259
+ output.push(` ${choice}\n`);
260
+ return;
261
+ }
262
+ if (choice.disabled) {
263
+ separatorOffset += 1;
264
+ output.push(` - ${choice.name} (${typeof choice.disabled === 'string' ? choice.disabled : 'Disabled'})\n`);
265
+ return;
266
+ }
267
+ if (index - separatorOffset === pointer) {
268
+ output.push(chalk_1.default.cyan(figures_1.default.pointer));
269
+ output.push(SearchBox.getCheckboxFigure(choice.checked));
270
+ output.push(' ');
271
+ output.push(this.opt.highlight ? chalk_1.default.gray(choice.name) : choice.name);
272
+ }
273
+ else {
274
+ output.push(` ${SearchBox.getCheckboxFigure(choice.checked)} ${choice.name}`);
275
+ }
276
+ output.push('\n');
277
+ });
278
+ return output.join('').replace(/\n$/, '');
279
+ }
280
+ }
281
+ exports.default = SearchBox;
@@ -26,6 +26,9 @@ var ETreeState;
26
26
  ETreeState[ETreeState["EXPANDED"] = 3] = "EXPANDED";
27
27
  })(ETreeState || (ETreeState = {}));
28
28
  class TreeNode {
29
+ get indent() {
30
+ return this.level * 2;
31
+ }
29
32
  constructor(root) {
30
33
  _TreeNode_instances.add(this);
31
34
  this.open = false;
@@ -36,9 +39,6 @@ class TreeNode {
36
39
  this.level = 1;
37
40
  this.root = root;
38
41
  }
39
- get indent() {
40
- return this.level * 2;
41
- }
42
42
  addNode(node) {
43
43
  if (node instanceof TreeNode) {
44
44
  this.leaves.push(node);
@@ -27,22 +27,21 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
27
27
  }
28
28
  const validated = (0, appsail_utils_1.validateAppSail)(optionTargets);
29
29
  const filledTargets = yield Promise.all(validated.map((targ) => __awaiter(void 0, void 0, void 0, function* () {
30
- var _a, _b;
31
30
  if (!targ.validity.valid) {
32
31
  return targ;
33
32
  }
34
33
  const proxyPort = yield port_resolver_1.default.getPort('appsail', 'http', {
35
- name: ((_a = targ.appSail) === null || _a === void 0 ? void 0 : _a.name) + '_proxy',
34
+ name: targ.name + '_proxy',
36
35
  searchSpan: 10,
37
36
  server: 'master'
38
37
  }).catch((err) => {
39
38
  throw new error_1.default('No free ports between 3000 and 3010. AppSail needs the ports within this range to function properly', { original: err });
40
39
  });
41
40
  const appsailPort = yield port_resolver_1.default.getPort('appsail', 'http', {
42
- name: ((_b = targ.appSail) === null || _b === void 0 ? void 0 : _b.name) + '_proxy',
41
+ name: targ.name + '_proxy',
43
42
  server: 'service'
44
43
  });
45
- return Object.assign(Object.assign({}, targ), { port: { appsail: appsailPort, proxy: proxyPort } });
44
+ return Object.assign(Object.assign({}, targ), { port: { appsail: appsailPort, proxy: proxyPort }, trigger: { kill: false } });
46
45
  })));
47
46
  runtime_store_1.default.set('context.appsail.targets', filledTargets);
48
47
  });
@@ -108,10 +108,9 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
108
108
  if (serveTargets.includes('appsail')) {
109
109
  const appSail = runtime_store_1.default.get('context.appsail.targets', []);
110
110
  const validAppSail = appSail.filter((sail) => {
111
- var _a;
112
111
  if (!sail.validity.valid) {
113
112
  (0, logger_1.warning)('skipping serve of AppSail service [' +
114
- ((_a = sail.appSail) === null || _a === void 0 ? void 0 : _a.name) +
113
+ sail.name +
115
114
  '] since ' +
116
115
  sail.validity.reason);
117
116
  return false;
@@ -117,7 +117,7 @@ class Server {
117
117
  });
118
118
  }
119
119
  startServer(details, masterPort) {
120
- var _a, _b, _c;
120
+ var _a, _b;
121
121
  return __awaiter(this, void 0, void 0, function* () {
122
122
  if (details.target === undefined) {
123
123
  return details;
@@ -170,7 +170,7 @@ class Server {
170
170
  if (details.type === 'appsail') {
171
171
  const target = details.target;
172
172
  target.validity.valid = false;
173
- (0, logger_1.labeled)(`AppSail[${(_c = target.appSail) === null || _c === void 0 ? void 0 : _c.name}]`, error).ERROR();
173
+ (0, logger_1.labeled)(`AppSail[${target.name}]`, error).ERROR();
174
174
  }
175
175
  else if (details.type === 'client') {
176
176
  const target = details.target;
@@ -252,7 +252,7 @@ class Server {
252
252
  }
253
253
  this.masterServer =
254
254
  masterTargets.length > 0
255
- ? yield (0, master_1.default)(masterPort, masterTargets.targets)
255
+ ? yield (0, master_1.default)(masterPort, { otherServerDetails: masterTargets.targets })
256
256
  : undefined;
257
257
  startPromise = new Promise((res) => {
258
258
  this.masterServer
@@ -284,16 +284,16 @@ class Server {
284
284
  }
285
285
  if (this.targetsMap.appSail.length > 0) {
286
286
  yield Promise.all(this.targetsMap.appSail.map((targSail) => this.startServer(targSail, -1).then((details) => {
287
- var _a, _b, _c, _d, _e, _f;
287
+ var _a, _b, _c, _d;
288
288
  const serverDetails = details;
289
289
  if (!((_a = serverDetails.target) === null || _a === void 0 ? void 0 : _a.validity.valid)) {
290
290
  return;
291
291
  }
292
292
  logUrls.appsail.targs.push(targSail);
293
293
  logUrls.appsail.nameMaxLength =
294
- ((_c = (_b = targSail.target) === null || _b === void 0 ? void 0 : _b.appSail) === null || _c === void 0 ? void 0 : _c.name) &&
295
- ((_e = (_d = targSail.target) === null || _d === void 0 ? void 0 : _d.appSail) === null || _e === void 0 ? void 0 : _e.name.length) > logUrls.appsail.nameMaxLength
296
- ? (_f = targSail.target) === null || _f === void 0 ? void 0 : _f.appSail.name.length
294
+ ((_b = targSail.target) === null || _b === void 0 ? void 0 : _b.name) &&
295
+ ((_c = targSail.target) === null || _c === void 0 ? void 0 : _c.name.length) > logUrls.appsail.nameMaxLength
296
+ ? (_d = targSail.target) === null || _d === void 0 ? void 0 : _d.name.length
297
297
  : logUrls.appsail.nameMaxLength;
298
298
  })));
299
299
  }
@@ -302,6 +302,11 @@ class Server {
302
302
  var _a;
303
303
  switch (targType) {
304
304
  case 'functions': {
305
+ const headersDisplayed = {
306
+ bio: false,
307
+ aio: false,
308
+ blo: false
309
+ };
305
310
  Object.entries(logTarg).forEach((x) => {
306
311
  const [_targType, _logTarg] = x;
307
312
  if (_logTarg.targs.length === 0) {
@@ -310,48 +315,66 @@ class Server {
310
315
  loggedEntries++;
311
316
  switch (_targType) {
312
317
  case 'bio': {
313
- (0, logger_1.info)();
314
- (0, logger_1.info)((0, ansi_colors_1.bold)(' >>>>>>>>>>>>>> BasicIO <<<<<<<<<<<<<< '));
315
318
  _logTarg.targs.forEach((t) => {
316
- var _a;
319
+ var _a, _b;
317
320
  const target = t;
318
- if (!((_a = target.target) === null || _a === void 0 ? void 0 : _a.url)) {
321
+ if (!((_a = target.target) === null || _a === void 0 ? void 0 : _a.valid)) {
322
+ return;
323
+ }
324
+ if (!((_b = target.target) === null || _b === void 0 ? void 0 : _b.url)) {
319
325
  throw new error_1.default('Target URL not found', {
320
326
  exit: 2
321
327
  });
322
328
  }
329
+ if (headersDisplayed.bio === false) {
330
+ (0, logger_1.info)();
331
+ (0, logger_1.info)((0, ansi_colors_1.bold)(' >>>>>>>>>>>>>> BasicIO <<<<<<<<<<<<<< '));
332
+ headersDisplayed.bio = true;
333
+ }
323
334
  bioLogUrl(target, masterPort, _logTarg.nameMaxLength);
324
335
  });
325
336
  (0, logger_1.info)();
326
337
  break;
327
338
  }
328
339
  case 'aio': {
329
- (0, logger_1.info)();
330
- (0, logger_1.info)((0, ansi_colors_1.bold)(' >>>>>>>>>>>>> AdvancedIO <<<<<<<<<<<< '));
331
340
  _logTarg.targs.forEach((t) => {
332
- var _a;
341
+ var _a, _b;
333
342
  const _target = t;
334
- if (!((_a = _target.target) === null || _a === void 0 ? void 0 : _a.url)) {
343
+ if (!((_a = _target.target) === null || _a === void 0 ? void 0 : _a.valid)) {
344
+ return;
345
+ }
346
+ if (!((_b = _target.target) === null || _b === void 0 ? void 0 : _b.url)) {
335
347
  throw new error_1.default('Target URL not found', {
336
348
  exit: 2
337
349
  });
338
350
  }
351
+ if (headersDisplayed.aio === false) {
352
+ (0, logger_1.info)();
353
+ (0, logger_1.info)((0, ansi_colors_1.bold)(' >>>>>>>>>>>>> AdvancedIO <<<<<<<<<<<< '));
354
+ headersDisplayed.aio = true;
355
+ }
339
356
  aioLogUrl(_target, masterPort, _logTarg.nameMaxLength);
340
357
  });
341
358
  (0, logger_1.info)();
342
359
  break;
343
360
  }
344
361
  case 'browserlogic': {
345
- (0, logger_1.info)();
346
- (0, logger_1.info)((0, ansi_colors_1.bold)(' >>>>>>>>>>>> BrowserLogic <<<<<<<<<<< '));
347
362
  _logTarg.targs.forEach((t) => {
348
- var _a;
363
+ var _a, _b;
349
364
  const target = t;
350
- if (!((_a = target.target) === null || _a === void 0 ? void 0 : _a.url)) {
365
+ if (!((_a = target.target) === null || _a === void 0 ? void 0 : _a.valid)) {
366
+ return;
367
+ }
368
+ if (!((_b = target.target) === null || _b === void 0 ? void 0 : _b.url)) {
351
369
  throw new error_1.default('Target URL not found', {
352
370
  exit: 2
353
371
  });
354
372
  }
373
+ if (headersDisplayed.blo === false) {
374
+ (0, logger_1.info)();
375
+ (0, logger_1.info)((0, ansi_colors_1.bold)(' >>>>>>>>>>>> BrowserLogic <<<<<<<<<<< '));
376
+ headersDisplayed.blo = true;
377
+ }
355
378
  bioLogUrl(target, masterPort, _logTarg.nameMaxLength);
356
379
  });
357
380
  (0, logger_1.info)();
@@ -367,12 +390,18 @@ class Server {
367
390
  return;
368
391
  }
369
392
  loggedEntries++;
370
- (0, logger_1.info)();
371
- (0, logger_1.info)((0, ansi_colors_1.bold)(' >>>>>>>>>>>>>> AppSail <<<<<<<<<<<<<< '));
393
+ let isHeaderDisplayed = false;
372
394
  _logTarg.targs.forEach((t) => {
373
- var _a;
374
395
  const targetSail = t.target;
375
- const targName = ((_a = targetSail.appSail) === null || _a === void 0 ? void 0 : _a.name) + '';
396
+ if (!targetSail.validity.valid) {
397
+ return;
398
+ }
399
+ if (isHeaderDisplayed === false) {
400
+ (0, logger_1.info)();
401
+ (0, logger_1.info)((0, ansi_colors_1.bold)(' >>>>>>>>>>>>>> AppSail <<<<<<<<<<<<<< '));
402
+ isHeaderDisplayed = true;
403
+ }
404
+ const targName = targetSail.name + '';
376
405
  (0, logger_1.labeled)(targName +
377
406
  ' '.repeat((_logTarg.nameMaxLength || targName.length) - targName.length), `http://localhost:${targetSail.port.proxy}`).MESSAGE();
378
407
  });