zcatalyst-cli 1.12.1 → 1.13.2

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 (176) hide show
  1. package/docs/apig-utils.toml +5 -0
  2. package/lib/apig-utils.js +51 -39
  3. package/lib/archiver.js +13 -9
  4. package/lib/authentication/index.js +22 -18
  5. package/lib/authentication/login.js +32 -32
  6. package/lib/bin/catalyst.js +15 -15
  7. package/lib/cli_table/src/cell.js +26 -26
  8. package/lib/cli_table/src/layout-manager.js +44 -45
  9. package/lib/cli_table/src/table.js +9 -9
  10. package/lib/cli_table/src/utils.js +35 -36
  11. package/lib/client-utils.js +43 -22
  12. package/lib/client.js +1 -1
  13. package/lib/command_needs/auth.js +7 -7
  14. package/lib/command_needs/rc.js +32 -25
  15. package/lib/commands/apig/disable.js +5 -5
  16. package/lib/commands/apig/enable.js +5 -5
  17. package/lib/commands/apig/status.js +9 -9
  18. package/lib/commands/client/delete.js +18 -18
  19. package/lib/commands/client/setup.js +8 -4
  20. package/lib/commands/deploy.js +18 -14
  21. package/lib/commands/ds/export.js +11 -11
  22. package/lib/commands/ds/import.js +12 -12
  23. package/lib/commands/ds/status.js +10 -10
  24. package/lib/commands/event/generate/index.js +21 -17
  25. package/lib/commands/event/generate/integ.js +7 -3
  26. package/lib/commands/functions/add.js +8 -4
  27. package/lib/commands/functions/config.js +5 -5
  28. package/lib/commands/functions/delete.js +20 -20
  29. package/lib/commands/functions/setup.js +8 -4
  30. package/lib/commands/functions/shell.js +7 -3
  31. package/lib/commands/help.js +4 -4
  32. package/lib/commands/iac/export.js +8 -8
  33. package/lib/commands/iac/import.js +23 -19
  34. package/lib/commands/iac/pack.js +15 -11
  35. package/lib/commands/iac/status.js +6 -2
  36. package/lib/commands/index.js +5 -1
  37. package/lib/commands/init.js +14 -10
  38. package/lib/commands/login.js +5 -1
  39. package/lib/commands/logout.js +5 -1
  40. package/lib/commands/project/list.js +14 -10
  41. package/lib/commands/project/reset.js +5 -5
  42. package/lib/commands/project/use.js +9 -9
  43. package/lib/commands/pull.js +18 -14
  44. package/lib/commands/run.js +13 -9
  45. package/lib/commands/serve.js +5 -1
  46. package/lib/commands/token/generate.js +6 -2
  47. package/lib/commands/token/list.js +7 -3
  48. package/lib/commands/token/revoke.js +6 -2
  49. package/lib/commands/whoami.js +3 -3
  50. package/lib/dc.js +2 -2
  51. package/lib/deploy/features/apig.js +6 -6
  52. package/lib/deploy/features/client.js +1 -1
  53. package/lib/deploy/features/functions/index.js +9 -9
  54. package/lib/deploy/features/index.js +5 -1
  55. package/lib/deploy/index.js +2 -2
  56. package/lib/endpoints/index.js +17 -13
  57. package/lib/endpoints/lib/apig.js +5 -5
  58. package/lib/endpoints/lib/applogic.js +4 -4
  59. package/lib/endpoints/lib/cache.js +3 -3
  60. package/lib/endpoints/lib/catalyst-details.js +1 -1
  61. package/lib/endpoints/lib/client.js +5 -5
  62. package/lib/endpoints/lib/datastore.js +2 -2
  63. package/lib/endpoints/lib/ds-bulk.js +5 -5
  64. package/lib/endpoints/lib/env.js +1 -1
  65. package/lib/endpoints/lib/event-bus.js +1 -1
  66. package/lib/endpoints/lib/filestore.js +2 -2
  67. package/lib/endpoints/lib/functions.js +4 -4
  68. package/lib/endpoints/lib/iac.js +10 -10
  69. package/lib/endpoints/lib/project.js +20 -5
  70. package/lib/endpoints/lib/queue.js +3 -3
  71. package/lib/endpoints/lib/sdk.js +1 -1
  72. package/lib/endpoints/lib/zcql.js +1 -1
  73. package/lib/error.js +1 -1
  74. package/lib/errorOut.js +2 -2
  75. package/lib/event_generate/cache.js +5 -5
  76. package/lib/event_generate/custom.js +2 -2
  77. package/lib/event_generate/datastore.js +5 -5
  78. package/lib/event_generate/filestore.js +5 -5
  79. package/lib/event_generate/integration/cliq.js +3 -3
  80. package/lib/event_generate/user.js +1 -1
  81. package/lib/event_generate/webapp.js +5 -5
  82. package/lib/execute-script.js +19 -15
  83. package/lib/express_middlewares/authenticator.js +30 -4
  84. package/lib/express_middlewares/logger.js +2 -2
  85. package/lib/express_middlewares/unknownReqProxy.js +1 -1
  86. package/lib/fn-utils/index.js +5 -1
  87. package/lib/fn-utils/lib/common.js +44 -44
  88. package/lib/fn-utils/lib/integ.js +9 -9
  89. package/lib/fn-utils/lib/java.js +46 -46
  90. package/lib/fn-utils/lib/node.js +7 -7
  91. package/lib/fn-watcher.js +9 -11
  92. package/lib/iac/status/bundle.js +5 -5
  93. package/lib/iac/status/deploy.js +4 -4
  94. package/lib/index.js +2 -2
  95. package/lib/init/dependencies/npm-install.js +1 -1
  96. package/lib/init/dependencies/package-json.js +6 -6
  97. package/lib/init/features/client/index.js +5 -1
  98. package/lib/init/features/client/initializers/angular.js +16 -12
  99. package/lib/init/features/client/initializers/basic.js +10 -6
  100. package/lib/init/features/client/initializers/lyte.js +11 -7
  101. package/lib/init/features/client/initializers/react.js +13 -9
  102. package/lib/init/features/functions/index.js +9 -9
  103. package/lib/init/features/functions/languages/java.js +10 -10
  104. package/lib/init/features/functions/languages/node.js +9 -9
  105. package/lib/init/features/index.js +12 -8
  106. package/lib/init/features/project.js +20 -20
  107. package/lib/init/index.js +2 -2
  108. package/lib/init/util/client.js +7 -3
  109. package/lib/init/util/functions.js +1 -1
  110. package/lib/init/util/project.js +4 -4
  111. package/lib/internal/api.js +19 -19
  112. package/lib/internal/command.js +20 -16
  113. package/lib/internal/config.js +5 -5
  114. package/lib/internal/credential.js +10 -10
  115. package/lib/internal/crypt.js +5 -5
  116. package/lib/internal/rc.js +6 -6
  117. package/lib/migration/global/1.6.2.js +3 -3
  118. package/lib/migration/index.js +22 -18
  119. package/lib/option-filter.js +34 -30
  120. package/lib/optional-import.js +12 -8
  121. package/lib/plugin-loader.js +7 -3
  122. package/lib/port-resolver.js +4 -4
  123. package/lib/progress.js +2 -2
  124. package/lib/prompt/index.js +5 -1
  125. package/lib/prompt/types/file-path.js +1 -1
  126. package/lib/pull/features/apig.js +9 -9
  127. package/lib/pull/features/client.js +7 -7
  128. package/lib/pull/features/functions/index.js +14 -14
  129. package/lib/pull/features/index.js +5 -1
  130. package/lib/pull/index.js +4 -4
  131. package/lib/repl-server.js +2 -2
  132. package/lib/serve/features/apig.js +1 -1
  133. package/lib/serve/features/index.js +8 -4
  134. package/lib/serve/index.js +15 -11
  135. package/lib/serve/server/index.js +43 -27
  136. package/lib/serve/server/lib/java/JavaaioServer.java +2 -1
  137. package/lib/serve/server/lib/java/lib/catalyst-cli-java-runtime-1.0.0.jar +0 -0
  138. package/lib/serve/server/lib/java/lib/catalyst-java-runtime-1.0.0.jar +0 -0
  139. package/lib/serve/server/lib/java/lib/zip4j-2.5.0.jar +0 -0
  140. package/lib/serve/server/lib/master.js +26 -15
  141. package/lib/serve/server/lib/node.js +7 -3
  142. package/lib/serve/server/lib/web_client/index.js +3 -3
  143. package/lib/serve/server/lib/web_client/server.js +17 -17
  144. package/lib/shell/dependencies/http-functions.js +40 -34
  145. package/lib/shell/dependencies/invoker/bio/java/JavabioInvoker.java +13 -1
  146. package/lib/shell/dependencies/invoker/cron/java/JavacronInvoker.java +13 -2
  147. package/lib/shell/dependencies/invoker/event/java/JavaeventInvoker.java +13 -2
  148. package/lib/shell/dependencies/invoker/integ/java/JavaintegInvoker.java +13 -2
  149. package/lib/shell/dependencies/invoker/integ/node.js +8 -4
  150. package/lib/shell/dependencies/local-function.js +44 -40
  151. package/lib/shell/index.js +12 -12
  152. package/lib/shell/prepare/index.js +2 -2
  153. package/lib/shell/prepare/languages/index.js +5 -1
  154. package/lib/shell/prepare/languages/java.js +1 -1
  155. package/lib/throbber/index.js +17 -17
  156. package/lib/throbber/utils.js +9 -9
  157. package/lib/track.js +7 -7
  158. package/lib/util_modules/config/index.js +5 -1
  159. package/lib/util_modules/constants/lib/auth.js +6 -6
  160. package/lib/util_modules/constants/lib/cliq-handlers.js +2 -2
  161. package/lib/util_modules/constants/lib/scopes.js +1 -0
  162. package/lib/util_modules/constants/lib/template.js +21 -21
  163. package/lib/util_modules/constants/lib/urls.js +11 -11
  164. package/lib/util_modules/context-help.js +15 -15
  165. package/lib/util_modules/fs/index.js +5 -1
  166. package/lib/util_modules/fs/lib/async.js +4 -4
  167. package/lib/util_modules/fs/utils.js +1 -1
  168. package/lib/util_modules/logger.js +2 -2
  169. package/lib/util_modules/parser/toml.js +1 -1
  170. package/lib/util_modules/project.js +6 -6
  171. package/lib/util_modules/shell.js +4 -4
  172. package/lib/winston.js +5 -5
  173. package/package.json +39 -39
  174. package/scripts/postInstall.js +7 -6
  175. package/docs/.DS_Store +0 -0
  176. package/lib/serve/server/lib/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
@@ -67,3 +67,8 @@ link = 'https://www.zoho.com/catalyst/help/api-gateway.html'
67
67
  context = '''Unable to recognise the ${arg[0]}(${arg[1]}) provided for the APIG rule ${arg[2]}.'''
68
68
  aid = '''Please provide a valid Catalyst URL as the ${arg[0]}.'''
69
69
  link = 'https://www.zoho.com/catalyst/help/api-gateway.html#Routing'
70
+
71
+ [APIG-UTILS-15]
72
+ context = '''The Regular Expression provided for the rule ${arg[0]} is in an Invalid format.'''
73
+ aid = '''The Regular Expression must be in the format of ${arg[1]}. Where, ${arg[2]} is the name of dynamic value and ${arg[3]} is the Regular Expression.'''
74
+ link = 'https://www.zoho.com/catalyst/help/api-gateway.html#Routingl'
package/lib/apig-utils.js CHANGED
@@ -40,7 +40,7 @@ const option_1 = require("./util_modules/option");
40
40
  const project_1 = require("./util_modules/project");
41
41
  exports.apigUtils = {
42
42
  validate: () => __awaiter(void 0, void 0, void 0, function* () {
43
- const ruleFile = project_1.resolveProjectPath(config_1.apigConfig.rules());
43
+ const ruleFile = (0, project_1.resolveProjectPath)(config_1.apigConfig.rules());
44
44
  const ruleArr = (yield fs_1.ASYNC.readJSONFile(ruleFile, {
45
45
  checkpath: true,
46
46
  throws: true
@@ -48,7 +48,7 @@ exports.apigUtils = {
48
48
  throw new error_1.default('Unable to read ' + ruleFile + ' file.', {
49
49
  exit: 1,
50
50
  errorId: 'APIG-UTILS-1',
51
- arg: [ansi_colors_1.bold(ruleFile), ansi_colors_1.italic.red(err)],
51
+ arg: [(0, ansi_colors_1.bold)(ruleFile), ansi_colors_1.italic.red(err)],
52
52
  original: err
53
53
  });
54
54
  }));
@@ -56,7 +56,7 @@ exports.apigUtils = {
56
56
  throw new error_1.default(ruleFile + ' file not found' + constants_1.FILENAME.config, {
57
57
  exit: 1,
58
58
  errorId: 'APIG-UTILS-2',
59
- arg: [ansi_colors_1.bold.red(ruleFile), ansi_colors_1.bold(constants_1.FILENAME.config)]
59
+ arg: [ansi_colors_1.bold.red(ruleFile), (0, ansi_colors_1.bold)(constants_1.FILENAME.config)]
60
60
  });
61
61
  }
62
62
  let localRuleArr = [];
@@ -72,7 +72,7 @@ exports.apigUtils = {
72
72
  }
73
73
  }
74
74
  catch (e) {
75
- logger_1.debug(error_1.default.getErrorInstance(e).message);
75
+ (0, logger_1.debug)(error_1.default.getErrorInstance(e).message);
76
76
  }
77
77
  let redirectIdx = -1;
78
78
  const namesArr = [];
@@ -98,14 +98,14 @@ exports.apigUtils = {
98
98
  throw new error_1.default('source_endpoint missing for rule ' + rule.name, {
99
99
  exit: 1,
100
100
  errorId: 'APIG-UTILS-5',
101
- arg: [ansi_colors_1.bold.red(rule.name), ansi_colors_1.bold('source_endpoint')]
101
+ arg: [ansi_colors_1.bold.red(rule.name), (0, ansi_colors_1.bold)('source_endpoint')]
102
102
  });
103
103
  }
104
104
  if (rule.method === undefined || rule.method === null) {
105
105
  throw new error_1.default('method missing for rule ' + rule.name, {
106
106
  exit: 1,
107
107
  errorId: 'APIG-UTILS-5',
108
- arg: [ansi_colors_1.bold.red(rule.name), ansi_colors_1.bold('method')]
108
+ arg: [ansi_colors_1.bold.red(rule.name), (0, ansi_colors_1.bold)('method')]
109
109
  });
110
110
  }
111
111
  if (sourceUrlByConfig[rule.source_endpoint] !== undefined &&
@@ -115,10 +115,10 @@ exports.apigUtils = {
115
115
  exit: 1,
116
116
  errorId: 'APIG-UTILS-6',
117
117
  arg: [
118
- ansi_colors_1.bold(rule.name),
119
- ansi_colors_1.bold('source_endpoint'),
118
+ (0, ansi_colors_1.bold)(rule.name),
119
+ (0, ansi_colors_1.bold)('source_endpoint'),
120
120
  ansi_colors_1.italic.red(rule.source_endpoint),
121
- ansi_colors_1.bold(duplicateRuleName)
121
+ (0, ansi_colors_1.bold)(duplicateRuleName)
122
122
  ]
123
123
  });
124
124
  }
@@ -130,7 +130,7 @@ exports.apigUtils = {
130
130
  const homepage = runtime_store_1.default.get('context.client.homepage');
131
131
  const clientValidity = runtime_store_1.default.get('context.client.valid', false);
132
132
  if (!clientValidity || (redirectPath === undefined && homepage === undefined)) {
133
- throw new error_1.default('Login Redirect rule cannot be verified since client package is not valid', { exit: 1, errorId: 'APIG-UTILS-7', arg: [ansi_colors_1.bold(rule.name)] });
133
+ throw new error_1.default('Login Redirect rule cannot be verified since client package is not valid', { exit: 1, errorId: 'APIG-UTILS-7', arg: [(0, ansi_colors_1.bold)(rule.name)] });
134
134
  }
135
135
  else if (!redirectPath) {
136
136
  redirectPath = '/app/' + homepage;
@@ -138,11 +138,11 @@ exports.apigUtils = {
138
138
  redirectIdx = index;
139
139
  runtime_store_1.default.set('context.client.login_redirect', rule.source_endpoint);
140
140
  if (rule.target_endpoint && rule.target_endpoint !== redirectPath) {
141
- logger_1.debug('Login redirect - target_endpoint is modified to match the local client');
141
+ (0, logger_1.debug)('Login redirect - target_endpoint is modified to match the local client');
142
142
  }
143
143
  rule.target_endpoint = redirectPath;
144
144
  if (rule.method && rule.method !== 'GET') {
145
- logger_1.debug('Login redirect - method is modified to match the local client');
145
+ (0, logger_1.debug)('Login redirect - method is modified to match the local client');
146
146
  }
147
147
  rule.method = 'GET';
148
148
  rule.system = true;
@@ -156,7 +156,7 @@ exports.apigUtils = {
156
156
  throw new error_1.default('client target cannot have authentication, for rule name : ' + rule.name, {
157
157
  exit: 1,
158
158
  errorId: 'APIG-UTILS-8',
159
- arg: [ansi_colors_1.bold(rule.name), ansi_colors_1.italic.red('"authentication"')]
159
+ arg: [(0, ansi_colors_1.bold)(rule.name), ansi_colors_1.italic.red('"authentication"')]
160
160
  });
161
161
  }
162
162
  }
@@ -194,6 +194,18 @@ exports.apigUtils = {
194
194
  .map((part, currentIdx, allParts) => {
195
195
  if (part.startsWith('{')) {
196
196
  const regexParts = part.slice(1, -1).split(':');
197
+ if (regexParts.length !== 2) {
198
+ throw new error_1.default('Invalid regex format', {
199
+ errorId: 'APIG-UTILS-15',
200
+ exit: 1,
201
+ arg: [
202
+ (0, ansi_colors_1.red)(rule.name),
203
+ ansi_colors_1.italic.green(`"{var:regex}"`),
204
+ (0, ansi_colors_1.bold)('var'),
205
+ (0, ansi_colors_1.bold)('regex')
206
+ ]
207
+ });
208
+ }
197
209
  try {
198
210
  rule.name, new RegExp(regexParts[1]);
199
211
  }
@@ -207,10 +219,10 @@ exports.apigUtils = {
207
219
  });
208
220
  err.errorId = 'APIG-UTILS-9';
209
221
  err.arg = [
210
- ansi_colors_1.bold('source_endpoint'),
211
- ansi_colors_1.bold(rule.name),
212
- ansi_colors_1.italic(source_endpoint.replace(part, ansi_colors_1.red(part))),
213
- ansi_colors_1.bold('Error: ') + ansi_colors_1.italic.red(util_1.inspect(regexError))
222
+ (0, ansi_colors_1.bold)('source_endpoint'),
223
+ (0, ansi_colors_1.bold)(rule.name),
224
+ (0, ansi_colors_1.italic)(source_endpoint.replace(part, (0, ansi_colors_1.red)(part))),
225
+ (0, ansi_colors_1.bold)('Error: ') + ansi_colors_1.italic.red((0, util_1.inspect)(regexError))
214
226
  ];
215
227
  throw err;
216
228
  }
@@ -222,10 +234,10 @@ exports.apigUtils = {
222
234
  exit: 1,
223
235
  errorId: 'APIG-UTILS-10',
224
236
  arg: [
225
- ansi_colors_1.bold('source_endpoint'),
226
- ansi_colors_1.bold(rule.name),
227
- ansi_colors_1.italic(source_endpoint.replace(part, ansi_colors_1.red(part))),
228
- ansi_colors_1.bold('Error: ') +
237
+ (0, ansi_colors_1.bold)('source_endpoint'),
238
+ (0, ansi_colors_1.bold)(rule.name),
239
+ (0, ansi_colors_1.italic)(source_endpoint.replace(part, (0, ansi_colors_1.red)(part))),
240
+ (0, ansi_colors_1.bold)('Error: ') +
229
241
  ansi_colors_1.italic.red('Regular Expression(s) in the source_endpoint should not contain ^ or $ symbols')
230
242
  ]
231
243
  });
@@ -238,10 +250,10 @@ exports.apigUtils = {
238
250
  exit: 1,
239
251
  errorId: 'APIG-UTILS-10',
240
252
  arg: [
241
- ansi_colors_1.bold('source_endpoint'),
242
- ansi_colors_1.bold(rule.name),
243
- ansi_colors_1.italic(source_endpoint.replace(part, ansi_colors_1.red(part))),
244
- ansi_colors_1.bold('Error: ') +
253
+ (0, ansi_colors_1.bold)('source_endpoint'),
254
+ (0, ansi_colors_1.bold)(rule.name),
255
+ (0, ansi_colors_1.italic)(source_endpoint.replace(part, (0, ansi_colors_1.red)(part))),
256
+ (0, ansi_colors_1.bold)('Error: ') +
245
257
  ansi_colors_1.italic.red('Regular Expression(s) in the source_endpoint with the wildcard character(.*)' +
246
258
  ' is only allowed to be present at the last section of the endpoint')
247
259
  ]
@@ -269,7 +281,7 @@ exports.apigUtils = {
269
281
  otherProps.name, {
270
282
  exit: 1,
271
283
  errorId: 'APIG-UTILS-11',
272
- arg: [ansi_colors_1.bold(otherProps.name), ansi_colors_1.bold('target_endpoint')]
284
+ arg: [(0, ansi_colors_1.bold)(otherProps.name), (0, ansi_colors_1.bold)('target_endpoint')]
273
285
  });
274
286
  case 'basicio':
275
287
  if (otherProps.target_id === undefined) {
@@ -277,7 +289,7 @@ exports.apigUtils = {
277
289
  otherProps.name, {
278
290
  exit: 1,
279
291
  errorId: 'APIG-UTILS-11',
280
- arg: [ansi_colors_1.bold(otherProps.name), ansi_colors_1.bold('target_id')]
292
+ arg: [(0, ansi_colors_1.bold)(otherProps.name), (0, ansi_colors_1.bold)('target_id')]
281
293
  });
282
294
  }
283
295
  const generatedUrl = fn_utils_1.fnUtils.common.generateUrlForTarget({
@@ -301,9 +313,9 @@ exports.apigUtils = {
301
313
  exit: 1,
302
314
  errorId: 'APIG-UTILS-12',
303
315
  arg: [
304
- ansi_colors_1.bold(otherProps.name),
305
- ansi_colors_1.bold('target_endpoint'),
306
- ansi_colors_1.bold('target')
316
+ (0, ansi_colors_1.bold)(otherProps.name),
317
+ (0, ansi_colors_1.bold)('target_endpoint'),
318
+ (0, ansi_colors_1.bold)('target')
307
319
  ]
308
320
  });
309
321
  }
@@ -311,10 +323,10 @@ exports.apigUtils = {
311
323
  exit: 1,
312
324
  errorId: 'APIG-UTILS-13',
313
325
  arg: [
314
- ansi_colors_1.bold('target'),
326
+ (0, ansi_colors_1.bold)('target'),
315
327
  ansi_colors_1.italic.red(otherProps.target),
316
- ansi_colors_1.bold(otherProps.name),
317
- ansi_colors_1.bold(['* client', '* advancedio', '* basicio'].join('\n'))
328
+ (0, ansi_colors_1.bold)(otherProps.name),
329
+ (0, ansi_colors_1.bold)(['* client', '* advancedio', '* basicio'].join('\n'))
318
330
  ]
319
331
  });
320
332
  }
@@ -328,9 +340,9 @@ exports.apigUtils = {
328
340
  exit: 1,
329
341
  errorId: 'APIG-UTILS-14',
330
342
  arg: [
331
- ansi_colors_1.bold('target_endpoint'),
343
+ (0, ansi_colors_1.bold)('target_endpoint'),
332
344
  ansi_colors_1.italic.red(otherProps.target_endpoint),
333
- ansi_colors_1.bold(otherProps.name)
345
+ (0, ansi_colors_1.bold)(otherProps.name)
334
346
  ]
335
347
  });
336
348
  }
@@ -347,18 +359,18 @@ exports.apigUtils = {
347
359
  return localConfig;
348
360
  },
349
361
  executeHook: ({ prefix, command }) => {
350
- if (option_1.getOptionValue('ignoreScripts', false)) {
351
- logger_1.debug(`skipping ${prefix + command} hook`);
362
+ if ((0, option_1.getOptionValue)('ignoreScripts', false)) {
363
+ (0, logger_1.debug)(`skipping ${prefix + command} hook`);
352
364
  return;
353
365
  }
354
366
  const exeCommand = config_1.apigConfig.script(prefix + command, null);
355
367
  if (exeCommand === null) {
356
368
  return;
357
369
  }
358
- execute_script_1.default('apig:' + prefix + command);
370
+ (0, execute_script_1.default)('apig:' + prefix + command);
359
371
  },
360
372
  pack: () => __awaiter(void 0, void 0, void 0, function* () {
361
- const file = project_1.resolveProjectPath(config_1.apigConfig.rules());
373
+ const file = (0, project_1.resolveProjectPath)(config_1.apigConfig.rules());
362
374
  return fs_1.SYNC.getReadStream(file);
363
375
  })
364
376
  };
package/lib/archiver.js CHANGED
@@ -1,7 +1,11 @@
1
1
  'use strict';
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -47,7 +51,7 @@ class Archiver {
47
51
  throw new error_1.default('Unable to parse zip content, content should be either a string or buffer', { exit: 2 });
48
52
  }
49
53
  this.content = content;
50
- this.jszip = jszip_1.loadAsync(content, { createFolders });
54
+ this.jszip = (0, jszip_1.loadAsync)(content, { createFolders });
51
55
  return this;
52
56
  }
53
57
  _writeFolder(folder, to, recursive = false, ignoreInitial = false) {
@@ -60,13 +64,13 @@ class Archiver {
60
64
  while (files.length > 0) {
61
65
  const limit = files.length < Archiver.maxWriteLimit ? files.length : Archiver.maxWriteLimit;
62
66
  yield Promise.all(files.splice(0, limit).map((file) => __awaiter(this, void 0, void 0, function* () {
63
- const filePath = path_1.join(to, path_1.dirname(ignoreInitial ? file.name.substr(file.name.indexOf('/') + 1) : file.name));
67
+ const filePath = (0, path_1.join)(to, (0, path_1.dirname)(ignoreInitial ? file.name.substr(file.name.indexOf('/') + 1) : file.name));
64
68
  yield fs_1.ASYNC.ensureDir(filePath);
65
69
  if (file.name.endsWith('.zip') && recursive) {
66
70
  const zipContent = yield file.async('nodebuffer');
67
71
  return new Archiver()
68
72
  .load(zipContent)
69
- .extract(path_1.join(filePath, path_1.basename(file.name).replace('.zip', '')), '/', {
73
+ .extract((0, path_1.join)(filePath, (0, path_1.basename)(file.name).replace('.zip', '')), '/', {
70
74
  recursive,
71
75
  ignoreInitial
72
76
  })
@@ -80,9 +84,9 @@ class Archiver {
80
84
  _writeFile(file, to) {
81
85
  return __awaiter(this, void 0, void 0, function* () {
82
86
  return new Promise((resolve) => {
83
- const fileName = path_1.basename(file.name);
87
+ const fileName = (0, path_1.basename)(file.name);
84
88
  file.nodeStream()
85
- .pipe(fs_1.SYNC.getWriteStream(path_1.join(to, fileName)))
89
+ .pipe(fs_1.SYNC.getWriteStream((0, path_1.join)(to, fileName)))
86
90
  .on('close', resolve);
87
91
  });
88
92
  });
@@ -220,10 +224,10 @@ class Archiver {
220
224
  }
221
225
  });
222
226
  if (pth.endsWith('.zip')) {
223
- pth = path_1.join(path_1.dirname(pth), this.name + '.zip');
227
+ pth = (0, path_1.join)((0, path_1.dirname)(pth), this.name + '.zip');
224
228
  }
225
- if (path_1.parse(pth).ext === '') {
226
- pth = path_1.join(pth, this.name + '.zip');
229
+ if ((0, path_1.parse)(pth).ext === '') {
230
+ pth = (0, path_1.join)(pth, this.name + '.zip');
227
231
  }
228
232
  yield fs_1.ASYNC.writeFile(pth, content);
229
233
  })
@@ -1,7 +1,11 @@
1
1
  'use strict';
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -48,7 +52,7 @@ const login_1 = __importDefault(require("./login"));
48
52
  const revoke_1 = __importDefault(require("./revoke"));
49
53
  function create() {
50
54
  return __awaiter(this, void 0, void 0, function* () {
51
- if (option_1.getOptionValue('current', false)) {
55
+ if ((0, option_1.getOptionValue)('current', false)) {
52
56
  return runtime_store_1.default.get('credential.cliToken');
53
57
  }
54
58
  const result = yield new login_1.default(false, false).init();
@@ -58,12 +62,12 @@ function create() {
58
62
  }
59
63
  exports.create = create;
60
64
  function list() {
61
- const tokens = config_store_1.default.get(`${dc_1.getActiveDC()}.tokens`, null);
65
+ const tokens = config_store_1.default.get(`${(0, dc_1.getActiveDC)()}.tokens`, null);
62
66
  if (tokens === null || Object.keys(tokens).length === 0) {
63
67
  throw new error_1.default('No tokens found', {
64
68
  exit: 0,
65
69
  errorId: 'IDX-1',
66
- arg: [ansi_colors_1.bold('catalyst token:generate')]
70
+ arg: [(0, ansi_colors_1.bold)('catalyst token:generate')]
67
71
  });
68
72
  }
69
73
  const tableData = [];
@@ -74,7 +78,7 @@ function list() {
74
78
  tableData.push([
75
79
  tokenId,
76
80
  cred.cliToken,
77
- cred.createdTime ? moment_1.default(cred.createdTime).format('YYYY-MM-DD HH:mm:ss') : 'N/A'
81
+ cred.createdTime ? (0, moment_1.default)(cred.createdTime).format('YYYY-MM-DD HH:mm:ss') : 'N/A'
78
82
  ]);
79
83
  }
80
84
  }
@@ -83,7 +87,7 @@ function list() {
83
87
  exports.list = list;
84
88
  function revoke(id) {
85
89
  return __awaiter(this, void 0, void 0, function* () {
86
- const tokens = config_store_1.default.get(`${dc_1.getActiveDC()}.tokens`, {});
90
+ const tokens = config_store_1.default.get(`${(0, dc_1.getActiveDC)()}.tokens`, {});
87
91
  const tokenKey = Object.keys(tokens).find((key) => key === id);
88
92
  if (tokenKey === undefined) {
89
93
  const allTokenKeys = Object.keys(tokens);
@@ -93,7 +97,7 @@ function revoke(id) {
93
97
  arg: [
94
98
  id,
95
99
  allTokenKeys.length > 0 ? '* ' + allTokenKeys.join('\n* ') : 'None',
96
- ansi_colors_1.bold('catalyst token:list')
100
+ (0, ansi_colors_1.bold)('catalyst token:list')
97
101
  ]
98
102
  });
99
103
  }
@@ -104,11 +108,11 @@ function revoke(id) {
104
108
  exports.revoke = revoke;
105
109
  function login() {
106
110
  return __awaiter(this, void 0, void 0, function* () {
107
- let activeDC = dc_1.getActiveDC();
111
+ let activeDC = (0, dc_1.getActiveDC)();
108
112
  const user = config_store_1.default.get(`${activeDC}.user`);
109
113
  const token = config_store_1.default.get(`${activeDC}.credential`);
110
- if (user && token && !option_1.getOptionValue('force', false)) {
111
- logger_1.message('No need to login. Already logged as: ' + ansi_colors_1.default.cyan.bold(user.Email));
114
+ if (user && token && !(0, option_1.getOptionValue)('force', false)) {
115
+ (0, logger_1.message)('No need to login. Already logged as: ' + ansi_colors_1.default.cyan.bold(user.Email));
112
116
  return;
113
117
  }
114
118
  const ans = yield prompt_1.default.ask(prompt_1.default.question('collectUsage', 'Allow Catalyst to collect CLI error reporting information?', {
@@ -122,33 +126,33 @@ function login() {
122
126
  value: dcObj.value
123
127
  });
124
128
  }),
125
- when: () => !option_1.getGlobalOptionValue('dc') &&
129
+ when: () => !(0, option_1.getGlobalOptionValue)('dc') &&
126
130
  !!Object.values(constants_1.DC_TYPE).find((dc) => dc.value === activeDC)
127
131
  }));
128
132
  if (ans.dc !== undefined && ans.dc !== activeDC) {
129
- dc_1.updateActiveDC(ans.dc);
133
+ (0, dc_1.updateActiveDC)(ans.dc);
130
134
  activeDC = ans.dc;
131
135
  }
132
- const localhost = option_1.getOptionValue('localhost', true);
136
+ const localhost = (0, option_1.getOptionValue)('localhost', true);
133
137
  const result = yield new login_1.default(localhost).init();
134
138
  activeDC = result.dc;
135
139
  config_store_1.default.set('usage', ans.collectUsage);
136
140
  config_store_1.default.set(`${activeDC}.user`, result.user);
137
141
  config_store_1.default.set(`${activeDC}.scopes`, result.scopes);
138
142
  credential_1.default.init(result.token).persistMinimal('credential');
139
- logger_1.success('Success! Logged in as : ' + ansi_colors_1.default.cyan.bold(result.user.Email));
143
+ (0, logger_1.success)('Success! Logged in as : ' + ansi_colors_1.default.cyan.bold(result.user.Email));
140
144
  });
141
145
  }
142
146
  exports.login = login;
143
147
  function logout() {
144
148
  return __awaiter(this, void 0, void 0, function* () {
145
- const activeDC = dc_1.getActiveDC();
149
+ const activeDC = (0, dc_1.getActiveDC)();
146
150
  const tokenObj = config_store_1.default.get(`${activeDC}.credential`, null);
147
151
  if (tokenObj === null) {
148
152
  throw new error_1.default('Not logged in', {
149
153
  exit: 0,
150
154
  errorId: 'IDX-3',
151
- arg: [ansi_colors_1.bold('catalyst login')]
155
+ arg: [(0, ansi_colors_1.bold)('catalyst login')]
152
156
  });
153
157
  }
154
158
  const user = config_store_1.default.get(`${activeDC}.user`, null);
@@ -158,12 +162,12 @@ function logout() {
158
162
  ansi_colors_1.default.cyan.bold(user.Email) +
159
163
  ' , are you sure?', { type: 'confirm', defaultAns: true }));
160
164
  if (!ans.consent) {
161
- logger_1.message('Aborting logout process...');
165
+ (0, logger_1.message)('Aborting logout process...');
162
166
  return;
163
167
  }
164
168
  const credential = credential_1.default.init(tokenObj, false);
165
169
  yield new revoke_1.default(credential, 'credential').init();
166
- logger_1.success('SuccessFully Logged out, we hope to see you soon. (^-^)ノ');
170
+ (0, logger_1.success)('SuccessFully Logged out, we hope to see you soon. (^-^)ノ');
167
171
  });
168
172
  }
169
173
  exports.logout = logout;
@@ -33,7 +33,7 @@ const option_1 = require("../util_modules/option");
33
33
  class Login {
34
34
  constructor(localhost = true, user = true) {
35
35
  this.localhost = localhost;
36
- this.portPromise = portfinder_1.getPortPromise({
36
+ this.portPromise = (0, portfinder_1.getPortPromise)({
37
37
  startPort: 9005,
38
38
  port: 9005,
39
39
  stopPort: 9009
@@ -92,7 +92,7 @@ class Login {
92
92
  });
93
93
  if (!js_1.JS.hasIn(authCodeResponse, 'body.access_token') ||
94
94
  !js_1.JS.hasIn(authCodeResponse, 'body.refresh_token')) {
95
- logger_1.debug('Token Fetch Error: \n' +
95
+ (0, logger_1.debug)('Token Fetch Error: \n' +
96
96
  ' Status: ' +
97
97
  authCodeResponse.status +
98
98
  ', Body: ' +
@@ -132,14 +132,14 @@ class Login {
132
132
  });
133
133
  if (!js_1.JS.hasIn(deviceCodeResponse, 'body.access_token') ||
134
134
  !js_1.JS.hasIn(deviceCodeResponse, 'body.refresh_token')) {
135
- logger_1.debug('Token Fetch Error: \n' +
135
+ (0, logger_1.debug)('Token Fetch Error: \n' +
136
136
  ' Status: ' +
137
137
  deviceCodeResponse.status +
138
138
  ', Body: ' +
139
139
  JSON.stringify(deviceCodeResponse.body));
140
- logger_1.debug('> polling <');
140
+ (0, logger_1.debug)('> polling <');
141
141
  if (++retryCount > 30) {
142
- if (option_1.getCurrentCommand() === 'login') {
142
+ if ((0, option_1.getCurrentCommand)() === 'login') {
143
143
  throw new error_1.default('Unable to get refresh_token from code', {
144
144
  exit: 0,
145
145
  errorId: 'LOGIN-1'
@@ -149,7 +149,7 @@ class Login {
149
149
  throw new error_1.default('Unable to get refresh_token from code', {
150
150
  exit: 1,
151
151
  errorId: 'LOGIN-2',
152
- arg: [ansi_colors_1.bold('catalyst token:generate')]
152
+ arg: [(0, ansi_colors_1.bold)('catalyst token:generate')]
153
153
  });
154
154
  }
155
155
  }
@@ -164,7 +164,7 @@ class Login {
164
164
  }
165
165
  _respondWithFile(req, res, statusCode, filename) {
166
166
  return __awaiter(this, void 0, void 0, function* () {
167
- const content = yield fs_1.ASYNC.readFile(path_1.join(__dirname, filename));
167
+ const content = yield fs_1.ASYNC.readFile((0, path_1.join)(__dirname, filename));
168
168
  res.setHeader('Content-Type', 'text/html');
169
169
  if (content !== undefined) {
170
170
  res.setHeader('Content-Length', content.length);
@@ -192,7 +192,7 @@ class Login {
192
192
  });
193
193
  });
194
194
  if (!js_1.JS.hasIn(userInfoResponse, 'body.Email') && !js_1.JS.hasIn(userInfoResponse, 'body.ZUID')) {
195
- logger_1.debug('User Details Fetch Error:\n' +
195
+ (0, logger_1.debug)('User Details Fetch Error:\n' +
196
196
  ' Status: ' +
197
197
  userInfoResponse.response.statusCode +
198
198
  ', Body: ' +
@@ -205,7 +205,7 @@ class Login {
205
205
  _loginWithoutLocalhost(err) {
206
206
  return __awaiter(this, void 0, void 0, function* () {
207
207
  if (err) {
208
- logger_1.debug('Error while login with server : ' + err.message);
208
+ (0, logger_1.debug)('Error while login with server : ' + err.message);
209
209
  }
210
210
  this.salt = 'm';
211
211
  const throbber = throbber_1.default.getInstance();
@@ -230,7 +230,7 @@ class Login {
230
230
  });
231
231
  if (!js_1.JS.hasIn(deviceCodeResponse, 'body.user_code') ||
232
232
  !js_1.JS.hasIn(deviceCodeResponse, 'body.device_code')) {
233
- logger_1.debug('Token Fetch Error: \n' +
233
+ (0, logger_1.debug)('Token Fetch Error: \n' +
234
234
  ' Status: ' +
235
235
  deviceCodeResponse.status +
236
236
  ', Body: ' +
@@ -240,12 +240,12 @@ class Login {
240
240
  errorId: 'LOGIN-3'
241
241
  });
242
242
  }
243
- logger_1.info();
244
- logger_1.info('Visit this URL on any device: \n');
245
- logger_1.info(ansi_colors_1.bold.underline(js_1.JS.get(deviceCodeResponse, 'body.verification_url')));
246
- logger_1.info();
247
- logger_1.info('Enter the device verification code: ' +
248
- ansi_colors_1.bold(js_1.JS.get(deviceCodeResponse, 'body.user_code')) +
243
+ (0, logger_1.info)();
244
+ (0, logger_1.info)('Visit this URL on any device: \n');
245
+ (0, logger_1.info)(ansi_colors_1.bold.underline(js_1.JS.get(deviceCodeResponse, 'body.verification_url')));
246
+ (0, logger_1.info)();
247
+ (0, logger_1.info)('Enter the device verification code: ' +
248
+ (0, ansi_colors_1.bold)(js_1.JS.get(deviceCodeResponse, 'body.user_code')) +
249
249
  ' and click verify to continue.');
250
250
  const deviceCode = js_1.JS.get(deviceCodeResponse, 'body.device_code');
251
251
  yield js_1.JS.sleep(10000);
@@ -261,7 +261,7 @@ class Login {
261
261
  user: userDetails,
262
262
  token: result,
263
263
  scopes: js_1.JS.values(constants_1.SCOPE),
264
- dc: dc_1.getActiveDC()
264
+ dc: (0, dc_1.getActiveDC)()
265
265
  };
266
266
  }
267
267
  catch (e) {
@@ -274,15 +274,15 @@ class Login {
274
274
  return __awaiter(this, void 0, void 0, function* () {
275
275
  return new Promise((resolve, reject) => {
276
276
  var _a;
277
- const dcRef = (_a = dc_1.getActiveDCType()) === null || _a === void 0 ? void 0 : _a.ref;
277
+ const dcRef = (_a = (0, dc_1.getActiveDCType)()) === null || _a === void 0 ? void 0 : _a.ref;
278
278
  const callbackUrl = this._getCallbackUrl(port);
279
279
  const authUrl = this._getLoginUrl(callbackUrl);
280
280
  let reqCount = 0;
281
- const server = http_1.createServer((req, res) => __awaiter(this, void 0, void 0, function* () {
281
+ const server = (0, http_1.createServer)((req, res) => __awaiter(this, void 0, void 0, function* () {
282
282
  try {
283
283
  let processReq = true;
284
284
  if (reqCount + 1 > 1 || req.url === '/favicon.ico' || req.url === undefined) {
285
- logger_1.debug('unknown request received : ' + req.url);
285
+ (0, logger_1.debug)('unknown request received : ' + req.url);
286
286
  processReq = false;
287
287
  res.writeHead(404);
288
288
  res.end();
@@ -298,43 +298,43 @@ class Login {
298
298
  if (dcRef !== undefined &&
299
299
  typeof location === 'string' &&
300
300
  location !== dcRef) {
301
- logger_1.warning('Your credentials does not match the DC opted!!!');
301
+ (0, logger_1.warning)('Your credentials does not match the DC opted!!!');
302
302
  const ans = yield prompt_1.default.ask(prompt_1.default.question('DC', `Do you wish to continue with login by making ${location.toUpperCase()} DC as active ?`, {
303
303
  type: 'confirm',
304
304
  defaultAns: true
305
305
  }));
306
306
  if (!ans.DC) {
307
- yield destroyer.destroy(true).catch((err) => logger_1.debug(err));
307
+ yield destroyer.destroy(true).catch((err) => (0, logger_1.debug)(err));
308
308
  reject(new error_1.default('Aborted by user.\n', {
309
309
  exit: 1
310
310
  }));
311
311
  return;
312
312
  }
313
- dc_1.updateActiveDC(constants_1.DC_TYPE[location].value);
313
+ (0, dc_1.updateActiveDC)(constants_1.DC_TYPE[location].value);
314
314
  }
315
315
  const result = yield this._getTokenFromAuthorizationCode(code, callbackUrl);
316
316
  js_1.JS.set(result, 'token', this.salt + '_' + result.refresh_token);
317
317
  credential_1.default.oneTimeToken = result.access_token;
318
318
  const userDetails = yield this._getUserDetails();
319
- yield destroyer.destroy(true).catch((err) => logger_1.debug(err));
319
+ yield destroyer.destroy(true).catch((err) => (0, logger_1.debug)(err));
320
320
  yield new Promise((res) => setTimeout(res, 2000));
321
321
  resolve({
322
322
  user: userDetails,
323
323
  token: result,
324
324
  scopes: js_1.JS.values(constants_1.SCOPE),
325
- dc: dc_1.getActiveDC()
325
+ dc: (0, dc_1.getActiveDC)()
326
326
  });
327
327
  }
328
328
  else if (processReq) {
329
329
  yield this._respondWithFile(req, res, 400, '../../templates/loginFailure.html');
330
- yield destroyer.destroy(true).catch((err) => logger_1.debug(err));
330
+ yield destroyer.destroy(true).catch((err) => (0, logger_1.debug)(err));
331
331
  reject(new error_1.default("Credentials doesn't seem to be valid.\n", {
332
332
  exit: 1
333
333
  }));
334
334
  }
335
335
  }
336
336
  catch (e) {
337
- yield destroyer.destroy(true).catch((err) => logger_1.debug(err));
337
+ yield destroyer.destroy(true).catch((err) => (0, logger_1.debug)(err));
338
338
  reject(new error_1.default('Server crashed with error.\n', {
339
339
  exit: 2,
340
340
  original: error_1.default.getErrorInstance(e)
@@ -343,11 +343,11 @@ class Login {
343
343
  }));
344
344
  const destroyer = new server_js_1.ConnectionDestroyer(server);
345
345
  server.listen(port, () => {
346
- logger_1.info();
347
- logger_1.info('Visit this URL on this device to log in:');
348
- logger_1.info(ansi_colors_1.bold.underline(authUrl));
349
- logger_1.info();
350
- open_1.default(authUrl).catch();
346
+ (0, logger_1.info)();
347
+ (0, logger_1.info)('Visit this URL on this device to log in:');
348
+ (0, logger_1.info)(ansi_colors_1.bold.underline(authUrl));
349
+ (0, logger_1.info)();
350
+ (0, open_1.default)(authUrl).catch();
351
351
  });
352
352
  server.on('error', () => {
353
353
  this._loginWithoutLocalhost().then(resolve, reject);