zcatalyst-cli 1.26.2 → 1.27.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 (151) hide show
  1. package/README.md +1 -0
  2. package/lib/authentication/credential.d.ts +2 -1
  3. package/lib/authentication/credential.js +20 -3
  4. package/lib/authentication/crypt.d.ts +7 -3
  5. package/lib/authentication/crypt.js +87 -16
  6. package/lib/authentication/index.js +1 -0
  7. package/lib/authentication/key-manager.d.ts +7 -0
  8. package/lib/authentication/key-manager.js +62 -0
  9. package/lib/authentication/login.js +20 -20
  10. package/lib/bin/catalyst.js +1 -15
  11. package/lib/client.d.ts +3 -1
  12. package/lib/client.js +16 -5
  13. package/lib/command_needs/rc.js +13 -3
  14. package/lib/commands/appsail/add.js +10 -0
  15. package/lib/commands/client/delete.js +18 -6
  16. package/lib/commands/client/setup.js +7 -0
  17. package/lib/commands/deploy/index.js +3 -3
  18. package/lib/commands/deploy/slate.js +65 -4
  19. package/lib/commands/functions/add.js +7 -0
  20. package/lib/commands/functions/delete.js +22 -4
  21. package/lib/commands/functions/execute.js +39 -71
  22. package/lib/commands/functions/setup.js +13 -0
  23. package/lib/commands/functions/shell.js +15 -1
  24. package/lib/commands/iac/import.js +2 -2
  25. package/lib/commands/init.js +34 -20
  26. package/lib/commands/login.js +1 -0
  27. package/lib/commands/pull.js +22 -1
  28. package/lib/commands/serve.js +2 -1
  29. package/lib/commands/slate/create.js +7 -4
  30. package/lib/commands/slate/link.js +11 -5
  31. package/lib/commands/slate/unlink.js +7 -0
  32. package/lib/commands/zest/generate/index.js +28 -35
  33. package/lib/deploy/features/slate.d.ts +3 -1
  34. package/lib/deploy/features/slate.js +204 -5
  35. package/lib/docs/client-utils.toml +0 -5
  36. package/lib/docs/command_needs/rc.toml +9 -1
  37. package/lib/docs/commands/client/delete.toml +4 -0
  38. package/lib/docs/commands/deploy/slate.toml +3 -0
  39. package/lib/docs/commands/functions/delete.toml +10 -0
  40. package/lib/docs/commands/functions/execute.toml +1 -16
  41. package/lib/docs/commands/functions/setup.toml +3 -0
  42. package/lib/docs/commands/functions/shell.toml +8 -0
  43. package/lib/docs/commands/init.toml +3 -0
  44. package/lib/docs/commands/pull.toml +6 -0
  45. package/lib/docs/commands/slate/unlink.toml +6 -0
  46. package/lib/docs/execute/command-utils.toml +14 -0
  47. package/lib/docs/execute/execute-input-resolver.toml +37 -0
  48. package/lib/docs/init/features/project.toml +20 -0
  49. package/lib/docs/init/util/client.toml +4 -0
  50. package/lib/docs/prompt/index.toml +15 -0
  51. package/lib/docs/pull/features/apig.toml +6 -0
  52. package/lib/docs/pull/features/client.toml +20 -0
  53. package/lib/docs/pull/features/functions/index.toml +24 -0
  54. package/lib/endpoints/lib/slate.d.ts +14 -1
  55. package/lib/endpoints/lib/slate.js +35 -0
  56. package/lib/error/context-help.js +1 -1
  57. package/lib/error/index.js +9 -13
  58. package/lib/execute/command-utils.d.ts +5 -0
  59. package/lib/execute/command-utils.js +86 -0
  60. package/lib/execute/execute-input-resolver.d.ts +29 -0
  61. package/lib/execute/execute-input-resolver.js +207 -0
  62. package/lib/execute/index.d.ts +4 -1
  63. package/lib/execute/index.js +3 -2
  64. package/lib/fn-utils/lib/integ.js +22 -17
  65. package/lib/index.js +1 -0
  66. package/lib/init/dependencies/package-json.js +11 -7
  67. package/lib/init/features/appsail/index.js +75 -26
  68. package/lib/init/features/appsail/prompt-fields.d.ts +43 -0
  69. package/lib/init/features/appsail/prompt-fields.js +55 -0
  70. package/lib/init/features/appsail/utils/custom-runtime.d.ts +3 -0
  71. package/lib/init/features/appsail/utils/custom-runtime.js +161 -0
  72. package/lib/init/features/appsail/{utils.d.ts → utils/index.d.ts} +2 -2
  73. package/lib/init/features/appsail/utils/index.js +170 -0
  74. package/lib/init/features/client/index.js +4 -3
  75. package/lib/init/features/client/initializers/angular.js +3 -2
  76. package/lib/init/features/client/initializers/react.js +4 -3
  77. package/lib/init/features/client/prompt-fields.d.ts +37 -0
  78. package/lib/init/features/client/prompt-fields.js +48 -0
  79. package/lib/init/features/functions/index.js +37 -8
  80. package/lib/init/features/functions/languages/java.js +42 -7
  81. package/lib/init/features/functions/languages/node.js +42 -10
  82. package/lib/init/features/functions/languages/python.js +42 -7
  83. package/lib/init/features/functions/prompt-fields.d.ts +25 -0
  84. package/lib/init/features/functions/prompt-fields.js +34 -0
  85. package/lib/init/features/project.js +41 -6
  86. package/lib/init/features/slate/index.js +2 -0
  87. package/lib/init/features/slate/prompt-fields.d.ts +31 -0
  88. package/lib/init/features/slate/prompt-fields.js +41 -0
  89. package/lib/init/index.js +2 -1
  90. package/lib/init/util/client.js +11 -8
  91. package/lib/init/util/common.d.ts +2 -0
  92. package/lib/init/util/common.js +33 -3
  93. package/lib/init/util/prompt-fields.d.ts +7 -0
  94. package/lib/init/util/prompt-fields.js +13 -0
  95. package/lib/internal/command.d.ts +3 -0
  96. package/lib/internal/command.js +26 -3
  97. package/lib/migration/global/1.27.0.d.ts +2 -0
  98. package/lib/migration/global/1.27.0.js +39 -0
  99. package/lib/prompt/choice.d.ts +2 -0
  100. package/lib/prompt/choice.js +24 -0
  101. package/lib/prompt/cli-option-key.d.ts +1 -0
  102. package/lib/prompt/cli-option-key.js +10 -0
  103. package/lib/prompt/index.d.ts +6 -22
  104. package/lib/prompt/index.js +264 -67
  105. package/lib/prompt/overwrite-prompt.d.ts +11 -0
  106. package/lib/prompt/overwrite-prompt.js +16 -0
  107. package/lib/prompt/question-factory.d.ts +34 -0
  108. package/lib/prompt/question-factory.js +41 -0
  109. package/lib/prompt/register-fields.d.ts +24 -0
  110. package/lib/prompt/register-fields.js +37 -0
  111. package/lib/pull/features/apig.js +57 -6
  112. package/lib/pull/features/client.js +107 -24
  113. package/lib/pull/features/functions/index.js +100 -4
  114. package/lib/pull/index.js +1 -1
  115. package/lib/pull/utils.d.ts +13 -0
  116. package/lib/pull/utils.js +20 -0
  117. package/lib/repl-server.d.ts +4 -0
  118. package/lib/repl-server.js +9 -0
  119. package/lib/serve/server/lib/master/index.js +3 -3
  120. package/lib/serve/server/lib/slate/static-server.js +2 -2
  121. package/lib/serve/server/lib/web_client/server.js +2 -2
  122. package/lib/shell/format-functions.d.ts +4 -0
  123. package/lib/shell/format-functions.js +59 -0
  124. package/lib/shell/index.js +18 -0
  125. package/lib/util_modules/config/lib/appsail.d.ts +3 -2
  126. package/lib/util_modules/config/lib/appsail.js +6 -3
  127. package/lib/util_modules/config/lib/slate.d.ts +19 -0
  128. package/lib/util_modules/config-store.d.ts +1 -0
  129. package/lib/util_modules/config-store.js +29 -10
  130. package/lib/util_modules/constants/index.d.ts +0 -1
  131. package/lib/util_modules/constants/index.js +1 -3
  132. package/lib/util_modules/constants/lib/urls.d.ts +2 -0
  133. package/lib/util_modules/constants/lib/urls.js +4 -0
  134. package/lib/util_modules/dc.d.ts +6 -1
  135. package/lib/util_modules/dc.js +21 -8
  136. package/lib/util_modules/env.d.ts +3 -0
  137. package/lib/util_modules/env.js +41 -0
  138. package/lib/util_modules/fs/lib/sync.d.ts +1 -0
  139. package/lib/util_modules/fs/lib/sync.js +19 -0
  140. package/lib/util_modules/logger/utils.d.ts +1 -0
  141. package/lib/util_modules/logger/utils.js +5 -1
  142. package/lib/util_modules/option.d.ts +1 -0
  143. package/lib/util_modules/option.js +8 -0
  144. package/lib/util_modules/{server.js → server/index.js} +3 -3
  145. package/lib/util_modules/server/needed-scopes.d.ts +1 -0
  146. package/lib/util_modules/{constants/lib → server}/needed-scopes.js +7 -7
  147. package/package.json +3 -2
  148. package/lib/init/features/appsail/utils.js +0 -273
  149. package/lib/util_modules/constants/lib/needed-scopes.d.ts +0 -4
  150. /package/lib/docs/{dc.toml → util_modules/dc.toml} +0 -0
  151. /package/lib/util_modules/{server.d.ts → server/index.d.ts} +0 -0
@@ -50,17 +50,23 @@ const command_1 = __importDefault(require("../../internal/command"));
50
50
  const runtime_store_1 = __importDefault(require("../../runtime-store"));
51
51
  const constants_1 = require("../../util_modules/constants");
52
52
  const logger_1 = require("../../util_modules/logger");
53
+ const prompt_fields_1 = require("../../init/features/slate/prompt-fields");
54
+ const common_1 = require("../../init/util/common");
53
55
  exports.default = new command_1.default('slate:link')
54
56
  .description('Links an existing local application to the Catalyst Slate service for web hosting')
55
- .option('--name <app_name>', 'Specify the name for your Slate application')
56
- .option('--framework <framework_name>', 'Specify the frontend framework used (e.g., React, Angular, Vue)')
57
- .option('--source <path>', 'Path to the existing slate app directory')
58
- .option('--template <template_url>', 'Provide a template URL to initialize your Slate application')
59
- .option('--default', 'Use default application configurations without prompting')
57
+ .option(prompt_fields_1.slateAddPromptFields.get('name'))
58
+ .option(prompt_fields_1.slateAddPromptFields.get('framework'))
59
+ .option(prompt_fields_1.slateAddPromptFields.get('source'))
60
+ .option(prompt_fields_1.slateAddPromptFields.get('template'))
61
+ .option(prompt_fields_1.slateAddPromptFields.get('default'))
60
62
  .needs('auth')
61
63
  .needs('config', { optional: true })
62
64
  .needs('rc', { optional: true, generateRc: true })
63
65
  .action(() => __awaiter(void 0, void 0, void 0, function* () {
66
+ (0, common_1.niIgnorableOptsTest)([
67
+ prompt_fields_1.slateAddPromptFields.get('template').optKey,
68
+ prompt_fields_1.slateAddPromptFields.get('default').optKey
69
+ ], 'Ignoring the following options in non-interactive mode:');
64
70
  const config = runtime_store_1.default.get('config');
65
71
  yield (yield Promise.resolve().then(() => __importStar(require('../../init/features')))).slate(true);
66
72
  yield config.save();
@@ -52,6 +52,13 @@ exports.default = new command_1.default('slate:unlink')
52
52
  }
53
53
  const slateDetails = slateServices.find((slate) => slate.name === appName);
54
54
  if (!slateDetails) {
55
+ if ((0, env_1.isNonInteractiveMode)()) {
56
+ throw new error_1.default(`No slates match the given name ${appName}.`, {
57
+ exit: 1,
58
+ errorId: 'SLULK-3',
59
+ arg: [(0, ansi_colors_1.bold)(slateServices.map((slate) => `* ${slate.name}`).join('\n'))]
60
+ });
61
+ }
55
62
  throw new error_1.default(`No slates match the given name ${appName}.`, {
56
63
  exit: 1,
57
64
  errorId: 'SLULK-2',
@@ -47,13 +47,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
47
47
  Object.defineProperty(exports, "__esModule", { value: true });
48
48
  const command_1 = __importDefault(require("../../../internal/command"));
49
49
  const constants_1 = require("../../../util_modules/constants");
50
- const prompt_1 = __importDefault(require("../../../prompt"));
50
+ const prompt_1 = __importStar(require("../../../prompt"));
51
51
  const js_1 = require("../../../util_modules/js");
52
52
  const endpoints_1 = require("../../../endpoints");
53
53
  const runtime_store_1 = __importDefault(require("../../../runtime-store"));
54
54
  const archiver_1 = __importDefault(require("../../../archiver"));
55
55
  const logger_1 = require("../../../util_modules/logger");
56
- const inquirer_1 = __importStar(require("inquirer"));
56
+ const inquirer_1 = require("inquirer");
57
57
  const error_1 = __importDefault(require("../../../error"));
58
58
  const project_1 = require("../../../util_modules/project");
59
59
  const features_1 = require("../../../init/features");
@@ -140,37 +140,33 @@ exports.default = new command_1.default('zest:generate')
140
140
  });
141
141
  }
142
142
  yield prompt_1.default.register('search-box');
143
- const specName = yield inquirer_1.default.prompt([
144
- {
145
- type: 'search-box',
146
- name: 'specs',
147
- searchable: true,
148
- pageSize: 10,
149
- highlight: true,
150
- notFoundMsg: 'No specifications found!',
151
- searchMsg: 'Search specifications...',
152
- message: 'Please search and select the specifications(Use space key to select)',
153
- source(_answersSoFar, input) {
154
- input || (input = '');
155
- return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
156
- const fuzzyResult = yield searchSpecification(input, specArray);
157
- const data = fuzzyResult.map((element) => {
158
- return {
159
- name: `${element.name}(${element.version})`,
160
- value: element.id
161
- };
162
- });
163
- resolve(data);
164
- }));
165
- },
166
- validate: (ansArr) => {
167
- if (js_1.JS.isEmpty(ansArr)) {
168
- return 'Must select one specification.';
169
- }
170
- return true;
143
+ const specName = yield prompt_1.default.ask(prompt_1.default.question('specs', 'Please search and select the specifications(Use space key to select)', {
144
+ type: 'search-box',
145
+ searchable: true,
146
+ pageSize: 10,
147
+ highlight: true,
148
+ notFoundMsg: 'No specifications found!',
149
+ searchMsg: 'Search specifications...',
150
+ source(_answersSoFar, input) {
151
+ input || (input = '');
152
+ return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
153
+ const fuzzyResult = yield searchSpecification(input, specArray);
154
+ const data = fuzzyResult.map((element) => {
155
+ return {
156
+ name: `${element.name}(${element.version})`,
157
+ value: element.id
158
+ };
159
+ });
160
+ resolve(data);
161
+ }));
162
+ },
163
+ validate: (ansArr) => {
164
+ if (js_1.JS.isEmpty(ansArr)) {
165
+ return 'Must select one specification.';
171
166
  }
167
+ return true;
172
168
  }
173
- ]);
169
+ }));
174
170
  const srcTypeAns = yield prompt_1.default.ask(prompt_1.default.question('source', 'Please specify which source type you want to download', {
175
171
  type: 'list',
176
172
  choices: [
@@ -278,10 +274,7 @@ exports.default = new command_1.default('zest:generate')
278
274
  }
279
275
  const folderExists = yield fs_1.ASYNC.dirExists(outputDir);
280
276
  const overwriteAns = folderExists
281
- ? yield prompt_1.default.ask(prompt_1.default.question('overwrite', 'Directory ' + (0, ansi_colors_1.underline)(outputDir) + ' already exists. Overwrite ?', {
282
- type: 'confirm',
283
- defaultAns: false
284
- }))
277
+ ? yield prompt_1.default.ask((0, prompt_1.overwritePromptQuestion)({ resourceName: outputDir }))
285
278
  : { overwrite: true };
286
279
  if (!overwriteAns.overwrite) {
287
280
  (0, logger_1.labeled)('zest', `${sourceLabel} generation skipped.`).WARN();
@@ -2,4 +2,6 @@ import { ISlateConfig } from '../../util_modules/config/lib/slate';
2
2
  declare const _default: () => Promise<void>;
3
3
  export default _default;
4
4
  export declare function getEnvironmentType(): string;
5
- export declare function slateLogger(): Array<ISlateConfig>;
5
+ export declare function slateLogger(opts?: {
6
+ wait?: boolean;
7
+ }): Promise<Array<ISlateConfig>>;
@@ -105,12 +105,211 @@ function getEnvironmentType() {
105
105
  return isProduction ? 'Production' : 'Development';
106
106
  }
107
107
  function slateLogger() {
108
- const deployTargets = runtime_store_1.default.get('context.payload.slate.targets', []);
109
- deployTargets.forEach((slate) => {
108
+ return __awaiter(this, arguments, void 0, function* (opts = {}) {
110
109
  var _a, _b;
111
- (0, logger_1.labeled)(`Slate(${slate.name})`, 'Deploy is live!').SUCCESS();
112
- (0, logger_1.labeled)((0, ansi_colors_1.cyan)(`Build Url(${slate.name})`), `${urls_1.default.console}/baas/${(0, project_1.getEnvId)()}/project/${(0, project_1.getProjectId)()}/${getEnvironmentType()}#/slate/app/${(_a = slate.details) === null || _a === void 0 ? void 0 : _a.id}/deployment/${(_b = slate.details) === null || _b === void 0 ? void 0 : _b.deployment_type_config.upcoming_build.deployment_id}/overview`).MESSAGE();
110
+ const { wait = true } = opts;
111
+ const deployTargets = runtime_store_1.default.get('context.payload.slate.targets', []);
112
+ const env = getEnvironmentType();
113
+ const failedBuilds = [];
114
+ for (const slate of deployTargets) {
115
+ (0, logger_1.labeled)(`Slate(${slate.name})`, 'Deploy initiated!').SUCCESS();
116
+ (0, logger_1.labeled)((0, ansi_colors_1.cyan)(`Build Url(${slate.name})`), `${urls_1.default.console}/baas/${(0, project_1.getEnvId)()}/project/${(0, project_1.getProjectId)()}/${env}#/slate/app/${(_a = slate.details) === null || _a === void 0 ? void 0 : _a.id}/deployment/${(_b = slate.details) === null || _b === void 0 ? void 0 : _b.deployment_type_config.upcoming_build.deployment_id}/overview`).MESSAGE();
117
+ (0, logger_1.info)();
118
+ if (wait) {
119
+ const buildSucceeded = yield pollSlateDeployStatus(slate, env);
120
+ if (!buildSucceeded) {
121
+ failedBuilds.push(slate.name);
122
+ }
123
+ }
124
+ }
125
+ return deployTargets.filter((t) => !failedBuilds.includes(t.name));
126
+ });
127
+ }
128
+ const TERMINAL_BUILD_STATES = new Set(['success', 'failure', 'failed', 'cancelled', 'canceled']);
129
+ const POLL_INTERVAL_MS = 3000;
130
+ const MAX_POLLS = 200;
131
+ const MAX_CONSECUTIVE_STATUS_ERRORS = 5;
132
+ function pollSlateDeployStatus(slate, env) {
133
+ return __awaiter(this, void 0, void 0, function* () {
134
+ var _a, _b;
135
+ const details = slate.details;
136
+ const upcomingBuild = (_a = details === null || details === void 0 ? void 0 : details.deployment_type_config) === null || _a === void 0 ? void 0 : _a.upcoming_build;
137
+ if (!(upcomingBuild === null || upcomingBuild === void 0 ? void 0 : upcomingBuild.id)) {
138
+ (0, logger_1.debug)('No upcoming build info found, skipping poll for ' + slate.name);
139
+ return false;
140
+ }
141
+ const appId = details.id;
142
+ const buildId = upcomingBuild.id;
143
+ const deploymentId = upcomingBuild.deployment_id;
144
+ const api = yield (0, endpoints_1.slateAPI)({ env });
145
+ const throbber = throbber_1.default.getInstance();
146
+ const spinnerName = `slate_poll_${slate.name}`;
147
+ let nextToken;
148
+ let pollCount = 0;
149
+ let consecutiveStatusErrors = 0;
150
+ let logHeaderPrinted = false;
151
+ let quitRequested = false;
152
+ let wakeUp;
153
+ const hintSuffix = ' ' + (0, ansi_colors_1.gray)('(Press Ctrl+C to stop watching logs)');
154
+ const onSigint = () => {
155
+ quitRequested = true;
156
+ throbber.remove(spinnerName);
157
+ if (logHeaderPrinted) {
158
+ printLogSectionFooter();
159
+ }
160
+ (0, logger_1.info)((0, ansi_colors_1.gray)(' Stopped watching. The build is still running in the background.'));
161
+ (0, logger_1.info)((0, ansi_colors_1.gray)(' Check the Build URL above to monitor progress.'));
162
+ (0, logger_1.info)();
163
+ if (wakeUp)
164
+ wakeUp();
165
+ };
166
+ process.once('SIGINT', onSigint);
167
+ const interruptibleSleep = (ms) => new Promise((resolve) => {
168
+ const timer = setTimeout(resolve, ms);
169
+ wakeUp = () => {
170
+ clearTimeout(timer);
171
+ resolve();
172
+ };
173
+ });
174
+ throbber.add(spinnerName, { text: `Building Slate[${slate.name}]...${hintSuffix}` });
175
+ while (pollCount < MAX_POLLS) {
176
+ yield interruptibleSleep(POLL_INTERVAL_MS);
177
+ if (quitRequested)
178
+ break;
179
+ pollCount++;
180
+ try {
181
+ const logsData = yield api.getBuildLogs(appId, deploymentId, buildId, nextToken);
182
+ if (((_b = logsData.records) === null || _b === void 0 ? void 0 : _b.length) > 0) {
183
+ throbber.remove(spinnerName);
184
+ if (!logHeaderPrinted) {
185
+ printLogSectionHeader(slate.name);
186
+ logHeaderPrinted = true;
187
+ }
188
+ for (const record of logsData.records) {
189
+ try {
190
+ const { message } = JSON.parse(record);
191
+ const clean = sanitizeLogMessage(message);
192
+ if (clean) {
193
+ (0, logger_1.info)((0, ansi_colors_1.dim)(` ${clean}`));
194
+ }
195
+ }
196
+ catch (_c) {
197
+ }
198
+ }
199
+ nextToken = logsData.next_token || nextToken;
200
+ throbber.add(spinnerName, {
201
+ text: `Building Slate[${slate.name}]...${hintSuffix}`
202
+ });
203
+ }
204
+ else {
205
+ nextToken = logsData.next_token || nextToken;
206
+ }
207
+ }
208
+ catch (logErr) {
209
+ (0, logger_1.debug)(`Build log fetch error (poll ${pollCount}): ` +
210
+ error_1.default.getErrorInstance(logErr).message);
211
+ }
212
+ let buildInfo;
213
+ try {
214
+ buildInfo = yield api.getBuildStatus(appId, deploymentId, buildId);
215
+ consecutiveStatusErrors = 0;
216
+ }
217
+ catch (statusErr) {
218
+ const err = error_1.default.getErrorInstance(statusErr);
219
+ consecutiveStatusErrors++;
220
+ if (err.status === 401 || err.status === 403) {
221
+ process.removeListener('SIGINT', onSigint);
222
+ throbber.remove(spinnerName);
223
+ (0, logger_1.error)(`Authentication error while polling Slate[${slate.name}] build status: ${err.message}`);
224
+ (0, logger_1.info)();
225
+ return false;
226
+ }
227
+ if (consecutiveStatusErrors >= MAX_CONSECUTIVE_STATUS_ERRORS) {
228
+ process.removeListener('SIGINT', onSigint);
229
+ throbber.remove(spinnerName);
230
+ (0, logger_1.warning)(`Build status polling for Slate[${slate.name}] failed after ` +
231
+ `${consecutiveStatusErrors} consecutive errors. Last error: ${err.message}. ` +
232
+ `Check the console for the current build status.`);
233
+ (0, logger_1.info)();
234
+ return false;
235
+ }
236
+ (0, logger_1.debug)(`Build status error (poll ${pollCount}, consecutive: ${consecutiveStatusErrors}): ` +
237
+ err.message);
238
+ throbber.add(spinnerName, {
239
+ text: `Building Slate[${slate.name}]... [retrying status check]${hintSuffix}`
240
+ });
241
+ }
242
+ if (buildInfo) {
243
+ const statusLower = (buildInfo.status || '').toLowerCase();
244
+ if (TERMINAL_BUILD_STATES.has(statusLower)) {
245
+ process.removeListener('SIGINT', onSigint);
246
+ throbber.remove(spinnerName);
247
+ if (logHeaderPrinted) {
248
+ printLogSectionFooter();
249
+ }
250
+ if (statusLower === 'success') {
251
+ (0, logger_1.labeled)(`Slate(${slate.name})`, 'Build completed successfully!').SUCCESS();
252
+ yield printDeploymentUrl(api, slate.name, appId, deploymentId);
253
+ (0, logger_1.info)();
254
+ return true;
255
+ }
256
+ (0, logger_1.labeled)(`Slate(${slate.name})`, `Build ended with status: ${buildInfo.status}`).ERROR();
257
+ (0, logger_1.info)();
258
+ return false;
259
+ }
260
+ throbber.add(spinnerName, {
261
+ text: `Building Slate[${slate.name}]... [${buildInfo.status}]`
262
+ });
263
+ }
264
+ }
265
+ process.removeListener('SIGINT', onSigint);
266
+ if (quitRequested) {
267
+ process.exit(0);
268
+ }
269
+ throbber.remove(spinnerName);
270
+ if (logHeaderPrinted) {
271
+ printLogSectionFooter();
272
+ }
273
+ (0, logger_1.warning)(`Build polling timed out for Slate[${slate.name}]. Check console for build status.`);
113
274
  (0, logger_1.info)();
275
+ return false;
276
+ });
277
+ }
278
+ function sanitizeLogMessage(msg) {
279
+ if (!msg)
280
+ return '';
281
+ let out = msg.replace(/<[^>]+>/g, ' ');
282
+ out = out.replace(/\b\d{1,2}:\d{2}:\d{2}(?::\d{1,3})?\b/g, ' ');
283
+ out = out.replace(/:\d{3}\b/g, ' ');
284
+ out = out.replace(/\[.*?\]/g, ' ');
285
+ return out.replace(/\s+/g, ' ').trim();
286
+ }
287
+ function printLogSectionHeader(slateName) {
288
+ const cols = process.stdout.columns || 80;
289
+ const label = ` Build Output (${slateName}) `;
290
+ const lineLen = Math.max(0, cols - label.length - 4);
291
+ const line = '─'.repeat(Math.floor(lineLen / 2));
292
+ (0, logger_1.info)((0, ansi_colors_1.gray)(` ${line}${label}${line}`));
293
+ (0, logger_1.info)();
294
+ }
295
+ function printLogSectionFooter() {
296
+ const cols = process.stdout.columns || 80;
297
+ (0, logger_1.info)();
298
+ (0, logger_1.info)((0, ansi_colors_1.gray)(` ${'─'.repeat(Math.max(0, cols - 4))}`));
299
+ (0, logger_1.info)();
300
+ }
301
+ function printDeploymentUrl(api, slateName, appId, deploymentId) {
302
+ return __awaiter(this, void 0, void 0, function* () {
303
+ try {
304
+ const deployment = yield api.getDeployment(appId, deploymentId);
305
+ const appUrl = deployment.domain || deployment.origin_domain;
306
+ if (appUrl) {
307
+ (0, logger_1.labeled)((0, ansi_colors_1.cyan)(`App Url(${slateName})`), appUrl).MESSAGE();
308
+ }
309
+ }
310
+ catch (err) {
311
+ (0, logger_1.debug)(`Could not fetch deployment URL for Slate[${slateName}]: ` +
312
+ error_1.default.getErrorInstance(err).message);
313
+ }
114
314
  });
115
- return deployTargets;
116
315
  }
@@ -23,11 +23,6 @@ context = '''Error when ${arg[0]} the Client with the ${arg[1]} plugin.'''
23
23
  aid = '''Please rectify the below error to continue. \n${arg[2]}'''
24
24
  link = ''
25
25
 
26
- [CLIENT-UTILS-6]
27
- context = '''Client Setup Skipped: Since the consent to overwrite the existing directory was not given.'''
28
- aid = '''Existing directory: ${arg[0]}'''
29
- link = ''
30
-
31
26
  [CLIENT-UTILS-7]
32
27
  context = '''${arg[0]} cannot be same as the ${arg[1]} page: ${arg[2]}'''
33
28
  aid = '''Please configure a differnet value for ${arg[0]} page.'''
@@ -1,5 +1,5 @@
1
1
  [RC-1]
2
- context = '''The project(${arg[0]}) provided with the ${arg[1]} option is not available is not available in the ${arg[3]} org.'''
2
+ context = '''The project(${arg[0]}) provided with the ${arg[1]} option is not available in the ${arg[3]} org.'''
3
3
  aid = '''Please use one of the available projects with the ${arg[1]} option or specify the correct org \nThe available projects in the ${arg[3]} org are: \n${arg[2]}'''
4
4
  link = 'https://docs.catalyst.zoho.com/en/cli/v1/initialize-resources/initialize-new-project/'
5
5
 
@@ -29,3 +29,11 @@ ${arg[0]} ${arg[1]}
29
29
  ${arg[2]} ${arg[3]}'''
30
30
  aid = '''Please ensure you've logged-in with the correct user credentials.'''
31
31
  link = ''
32
+
33
+ [RC-7]
34
+ context = '''The provided value(${arg[0]}) for option ${arg[1]} is not valid.'''
35
+ aid = '''Please use one of the available orgs with the ${arg[1]} option or specify the correct org.
36
+
37
+ The available orgs are:
38
+ ${arg[2]}
39
+ '''
@@ -32,3 +32,7 @@ link = 'https://www.zoho.com/catalyst/help/web-client-hosting.html#Older_Version
32
32
  context = '''Only the live version(${arg[0]}) of the web client is available in the Catalyst Remote Console, and a live web client cannot be deleted.'''
33
33
  aid = '''You can deploy a new version of the web client that will make the ${arg[0]} version eligible for deletion.'''
34
34
  link = 'https://www.zoho.com/catalyst/help/web-client-hosting.html#Older_Version'
35
+
36
+ [CDEL-8]
37
+ context = '''Remote deletion of the web client is not possible in non-interactive mode.'''
38
+ aid = '''Please disable the non-interactive mode and try again.'''
@@ -0,0 +1,3 @@
1
+ [E_NON_INTERACTIVE_MODE_SLATE_NAME_REQUIRED]
2
+ context = '''Slate app name is required in non-interactive mode. Please provide the name of the Slate app to deploy.'''
3
+ aid = '''Example: ${arg[0]}'''
@@ -27,3 +27,13 @@ link = 'https://www.zoho.com/catalyst/help/cli-deploy.html'
27
27
  context = '''The function ${arg[0]} is not available in the Catalyst remote console.'''
28
28
  aid = '''The available functions are: \n${arg[1]}'''
29
29
  link = 'https://www.zoho.com/catalyst/help/cli-functions.html#Delete'
30
+
31
+ [FDEL-7]
32
+ context = '''Remote deletion of the function is not possible in non-interactive mode.'''
33
+ aid = '''Please run the command in interactive mode to use the remote option.'''
34
+
35
+ [FDEL-8]
36
+ context = '''Function name input is missing in non-interactive mode.'''
37
+ aid = '''Please provide the function name as an argument when running the command in non-interactive mode.
38
+ Example: ${arg[0]}
39
+ '''
@@ -3,21 +3,6 @@ context = '''${arg[0]} command does not support the execution of ${arg[1]} type
3
3
  aid = '''The supported function types are: \n${arg[3]}'''
4
4
  link = ''
5
5
 
6
- [FEXE-2]
7
- context = '''Unable to read the ${arg[0]} inputs file.'''
8
- aid = '''Please rectify the below error to continue: \n${arg[1]}'''
9
- link = ''
10
-
11
- [FEXE-3]
12
- context = '''Unable to find any inputs to execute the function.'''
13
- aid = '''Please provide the inputs to execute the function in a ${arg[0]} file inside the functions source directory or specify the path to inputs file in the ${arg[1]} file of the function, under the ${arg[2]} key.'''
14
- link = ''
15
-
16
- [FEXE-4]
17
- context = '''The input provided with the ${arg[0]} option is not present among the available input keys.'''
18
- aid = '''The available input keys are: \n${arg[1]}'''
19
- link = ''
20
-
21
6
  [FEXE-5]
22
7
  context = '''The input ${arg[0]} is an Invalid input.'''
23
8
  aid = '''Please provide a valid input. The input should be a valid json object string.'''
@@ -25,5 +10,5 @@ link = ''
25
10
 
26
11
  [FEXE-6]
27
12
  context = '''Invalid JSON input. Error when parsing the provided JSON. \n ${arg[0]}'''
28
- aid = '''Please provide a valid JSON object string'''
13
+ aid = '''Please provide a valid JSON string using --input <value>. For piped stdin, use --input -.'''
29
14
  link = ''
@@ -0,0 +1,3 @@
1
+ [E_NON_INTERACTIVE_MODE_FUNCTIONS_SETUP]
2
+ context = '''The ${arg[0]} command is disabled in ${arg[1]} mode.'''
3
+ aid = '''Please use the ${arg[2]} command to add functions in ${arg[1]} mode.'''
@@ -2,3 +2,11 @@
2
2
  context = '''Tunneling has not yet been configured for your project ${arg[0]}.'''
3
3
  aid = '''Please visit this link to get started: ${arg[1]}'''
4
4
  link = ''
5
+
6
+ [FSHELL-2]
7
+ context = '''The ${arg[0]} command cannot be run in ${arg[1]} mode. Please run the command in interactive mode.'''
8
+ aid = '''Alternatively, you can use the ${arg[2]} command to execute non-http functions such as Event, Cron, Job and Integration functions in non-interactive mode.
9
+
10
+ For command usage details, run:
11
+ ${arg[3]}
12
+ '''
@@ -0,0 +1,3 @@
1
+ [E_NON_INTERACTIVE_FEATURE_INIT]
2
+ context = '''Non-interactive mode is only supported for project initialization.'''
3
+ aid = '''Please run the command without --ni or --non-interactive flag to initialize other features.'''
@@ -0,0 +1,6 @@
1
+ [E_NON_INTERACTIVE_PULL_NO_FEATURE]
2
+ context = '''Missing ${arg[0]} argument. In Non-Interactive mode the feature to pull must be specified using an argument.'''
3
+ aid = '''Use the ${arg[0]} argument to specify the feature to pull in non-interactive mode.
4
+
5
+ Example: ${arg[1]}
6
+ '''
@@ -7,3 +7,9 @@ link = ''
7
7
  context = '''No slate app linked with the given name.'''
8
8
  aid = '''Please check the available slate apps by running the command ${arg[0]} without any options.'''
9
9
  link = ''
10
+
11
+ [SLULK-3]
12
+ context = '''No slate app linked with the given name. Please specify the name of an existing slate app.'''
13
+ aid = '''List of available slate apps:
14
+ ${arg[0]}
15
+ '''
@@ -0,0 +1,14 @@
1
+ [FEXE-2]
2
+ context = '''Unable to read the ${arg[0]} inputs file.'''
3
+ aid = '''Please rectify the below error to continue: \n${arg[1]}'''
4
+ link = ''
5
+
6
+ [FEXE-3]
7
+ context = '''Unable to find any inputs to execute the function.'''
8
+ aid = '''Please provide the inputs to execute the function in a ${arg[0]} file inside the functions source directory or specify the path to inputs file in the ${arg[1]} file of the function, under the ${arg[2]} key.'''
9
+ link = ''
10
+
11
+ [FEXE-4]
12
+ context = '''The input provided with the ${arg[0]} option is not present among the available input keys.'''
13
+ aid = '''The available input keys are: \n${arg[1]}'''
14
+ link = ''
@@ -0,0 +1,37 @@
1
+ [FEXE-6]
2
+ # FEXE-6 exists in both src/docs/commands/functions/execute.toml and src/docs/execute/execute-input-resolver.toml.
3
+ # The context and aid are identical in both files, indicating that this error message is relevant to both the command execution
4
+ # and input resolution processes.
5
+ context = '''Invalid JSON input. Error when parsing the provided JSON. \n ${arg[0]}'''
6
+ aid = '''Please provide a valid JSON string using --input <value>. For piped stdin, use --input -.'''
7
+ link = ''
8
+
9
+ [FEXE-7]
10
+ context = '''No usable input found for ${arg[0]}.'''
11
+ aid = '''Provide one of: inline JSON (--input '{"k":{}}'), a JSON file path (--input ./input.json), or piped stdin (--input -).'''
12
+ link = ''
13
+
14
+ [FEXE-8]
15
+ context = '''Timed out while waiting for input from stdin via ${arg[0]}.'''
16
+ aid = '''Ensure data is being piped and the stream completes. Example: echo '{"k":{}}' | catalyst functions:execute <fn> --input -'''
17
+ link = ''
18
+
19
+ [FEXE-9]
20
+ context = '''Cannot read stdin because ${arg[0]} requires piped or redirected input.'''
21
+ aid = '''Run the command with piped stdin or use a file/inline value with --input.'''
22
+ link = ''
23
+
24
+ [FEXE-10]
25
+ context = '''Empty stdin received for ${arg[0]}.'''
26
+ aid = '''Pipe non-empty JSON content and use --input -.'''
27
+ link = ''
28
+
29
+ [FEXE-11]
30
+ context = '''Input file not found: ${arg[0]}'''
31
+ aid = '''Provide a valid JSON file path with --input, or use inline JSON / --input -.'''
32
+ link = ''
33
+
34
+ [FEXE-12]
35
+ context = '''Unable to read input source: ${arg[0]}'''
36
+ aid = '''Ensure the input source is inside the project directory and readable, then retry with --input.'''
37
+ link = ''
@@ -0,0 +1,20 @@
1
+ [E_NON_INTERACTIVE_MISSING_INPUTS_ORG_OPT]
2
+ context = '''Catalyst init in Non-Interactive mode requires the OrgId to be passed as an option with the command.'''
3
+ aid = '''Please use the ${arg[0]} option to specify the org.
4
+
5
+ Example: ${arg[1]}
6
+
7
+ The following orgs are available:
8
+ ${arg[2]}
9
+ '''
10
+
11
+ [E_NON_INTERACTIVE_MISSING_INPUTS_PROJECT_OPT]
12
+ context = '''Catalyst init in Non-Interactive mode requires the ProjectId to be passed as an option with the command.'''
13
+ aid = '''Please use the ${arg[0]} option to specify the org.
14
+
15
+ Example: ${arg[1]}
16
+
17
+ The following orgs are available:
18
+ ${arg[2]}
19
+ '''
20
+
@@ -0,0 +1,4 @@
1
+ [CLIENT-UTILS-6]
2
+ context = '''Client Setup Skipped: Since the consent to overwrite the existing directory was not given.'''
3
+ aid = '''Existing directory: ${arg[0]}'''
4
+ link = ''
@@ -0,0 +1,15 @@
1
+ [E_NON_INTERACTIVE_MISSING_INPUTS]
2
+ context = '''Non-interactive mode requires prepared inputs for: ${arg[0]}.'''
3
+ aid = '''${arg[1]} \n\nCheckout the below command to get the list of supported inputs.\n ${arg[2]}\n'''
4
+
5
+ [E_RUNTIME_PROMPT_NO_MATCH]
6
+ context = '''No list choice matches "${arg[0]}" for prompt "${arg[1]}".'''
7
+ aid = '''Please provide a valid choice for the prompt.
8
+
9
+ Available choices are:
10
+ ${arg[2]}.
11
+ '''
12
+
13
+ [E_NON_INTERACTIVE_MISSING_INPUTS_ANY]
14
+ context = '''${arg[0]}'''
15
+ aid = '''${arg[1]}'''
@@ -0,0 +1,6 @@
1
+ [E_NON_INTERACTIVE_APIG_PULL_OVERWRITE]
2
+ context = '''APIG pull failed. Since the APIG rules file already exists in the location ${arg[0]}'''
3
+ aid = '''Use the ${arg[1]} option to overwrite the file in local.
4
+
5
+ Example: ${arg[2]}
6
+ '''
@@ -0,0 +1,20 @@
1
+ [E_NON_INTERACTIVE_CLIENT_PULL_NO_RESOURCE]
2
+ context = '''Missing ${arg[0]} option In Non-Interactive mode the web client version to pull must be specified using the ${arg[0]} option.'''
3
+ aid = '''Use the ${arg[0]} option to specify the functions to pull in non-interactive mode.
4
+
5
+ For example: ${arg[1]}
6
+
7
+ Available functions to pull:
8
+ ${arg[2]}
9
+ '''
10
+
11
+ [E_NON_INTERACTIVE_CLIENT_PULL_NO_OVERWRITE]
12
+ context = '''Web Client pull failed. Since the Web Client directory already exists in the location ${arg[0]}'''
13
+ aid = '''Use the ${arg[1]} option to overwrite the folder in local.
14
+
15
+ Example: ${arg[2]}
16
+ '''
17
+
18
+ [E_NON_INTERACTIVE_CLIENT_PULL_MULTIPLE_RESOURCES]
19
+ context = '''Multiple web client versions are specified in the ${arg[0]} option. In Non-Interactive mode only one web client version can be specified using the ${arg[0]} option.'''
20
+ aid = '''Use the ${arg[0]} option to specify only one web client version to pull in non-interactive mode.'''