zcatalyst-cli 1.10.1 → 1.12.1

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 (149) hide show
  1. package/docs/.DS_Store +0 -0
  2. package/docs/client-utils.toml +5 -0
  3. package/docs/command_needs/auth.toml +1 -1
  4. package/docs/optional-import.toml +10 -0
  5. package/docs/plugin-loader.toml +4 -0
  6. package/docs/serve/server/index.toml +4 -0
  7. package/docs/serve/server/lib/web_client/server.toml +4 -0
  8. package/lib/apig-utils.js +2 -1
  9. package/lib/authentication/login.js +10 -12
  10. package/lib/client-utils.js +8 -6
  11. package/lib/command_needs/auth.js +2 -2
  12. package/lib/commands/client/delete.js +2 -1
  13. package/lib/commands/ds/status.js +5 -5
  14. package/lib/commands/event/generate/index.js +4 -13
  15. package/lib/commands/functions/delete.js +2 -2
  16. package/lib/commands/functions/shell.js +5 -2
  17. package/lib/commands/iac/import.js +37 -10
  18. package/lib/commands/init.js +1 -1
  19. package/lib/commands/pull.js +1 -1
  20. package/lib/commands/serve.js +2 -1
  21. package/lib/endpoints/lib/sdk.js +2 -2
  22. package/lib/error.js +16 -13
  23. package/lib/errorOut.js +2 -2
  24. package/lib/fn-utils/lib/common.js +4 -4
  25. package/lib/fn-utils/lib/java.js +6 -4
  26. package/lib/fn-utils/lib/node.js +2 -2
  27. package/lib/init/dependencies/npm-install.js +10 -10
  28. package/lib/init/features/client/index.js +47 -0
  29. package/lib/init/features/client/initializers/angular.js +104 -0
  30. package/lib/init/features/client/initializers/basic.js +50 -0
  31. package/lib/init/features/client/initializers/lyte.js +56 -0
  32. package/lib/init/features/client/initializers/react.js +78 -0
  33. package/lib/init/features/functions/index.js +14 -5
  34. package/lib/init/features/functions/languages/node.js +3 -1
  35. package/lib/init/features/index.js +10 -3
  36. package/lib/init/features/project.js +1 -1
  37. package/lib/init/util/client.js +89 -4
  38. package/lib/internal/command.js +4 -1
  39. package/lib/internal/config.js +2 -1
  40. package/lib/optional-import.js +27 -26
  41. package/lib/plugin-loader.js +27 -10
  42. package/lib/port-resolver.js +4 -2
  43. package/lib/prompt/index.js +1 -1
  44. package/lib/pull/features/functions/index.js +1 -1
  45. package/lib/serve/index.js +6 -1
  46. package/lib/serve/server/index.js +52 -8
  47. package/lib/serve/server/lib/java/JavaaioServer.java +3 -2
  48. package/lib/serve/server/lib/master.js +22 -24
  49. package/lib/serve/server/lib/web_client/index.js +30 -0
  50. package/lib/serve/server/lib/web_client/server.js +174 -0
  51. package/lib/shell/dependencies/invoker/bio/java/JavabioInvoker.java +7 -1
  52. package/lib/shell/dependencies/invoker/bio/node.js +5 -2
  53. package/lib/shell/index.js +10 -6
  54. package/lib/util_modules/char.js +1 -1
  55. package/lib/util_modules/config/lib/apig.js +2 -1
  56. package/lib/util_modules/config/lib/client.js +18 -21
  57. package/lib/util_modules/constants/index.js +3 -1
  58. package/lib/util_modules/constants/lib/placeholders.js +1 -0
  59. package/lib/util_modules/constants/lib/plugin.js +28 -0
  60. package/lib/util_modules/constants/lib/template.js +11 -1
  61. package/lib/util_modules/constants/lib/urls.js +29 -13
  62. package/lib/util_modules/{contextHelp.js → context-help.js} +0 -0
  63. package/lib/util_modules/env.js +13 -12
  64. package/lib/util_modules/fs/index.js +1 -9
  65. package/lib/util_modules/fs/lib/async.js +3 -3
  66. package/lib/util_modules/fs/utils.js +8 -0
  67. package/lib/util_modules/global-space.js +2 -0
  68. package/lib/util_modules/option.js +5 -1
  69. package/lib/util_modules/server.js +53 -0
  70. package/lib/util_modules/shell.js +10 -6
  71. package/lib/winston.js +1 -1
  72. package/package.json +8 -5
  73. package/templates/.DS_Store +0 -0
  74. package/templates/init/.DS_Store +0 -0
  75. package/templates/init/client/.DS_Store +0 -0
  76. package/templates/init/client/{client-package.json → basic/client-package.json} +0 -0
  77. package/templates/init/client/{index.html → basic/index.html} +0 -0
  78. package/templates/init/client/{main.css → basic/main.css} +0 -0
  79. package/templates/init/client/{main.js → basic/main.js} +0 -0
  80. package/templates/init/client/lyte/build/build.js +301 -0
  81. package/templates/init/client/lyte/build/scripts/cliDownloadScript.js +54 -0
  82. package/templates/init/client/lyte/client-package.json +5 -0
  83. package/templates/init/client/lyte/components/javascript/welcome-comp.js +13 -0
  84. package/templates/init/client/lyte/components/styles/welcome-comp.css +0 -0
  85. package/templates/init/client/lyte/components/templates/welcome-comp.html +8 -0
  86. package/templates/init/client/lyte/data-store/adapters/.gitkeep +0 -0
  87. package/templates/init/client/lyte/data-store/models/.gitkeep +0 -0
  88. package/templates/init/client/lyte/data-store/serializers/.gitkeep +0 -0
  89. package/templates/init/client/lyte/index.html +17 -0
  90. package/templates/init/client/lyte/package.json +12 -0
  91. package/templates/init/client/lyte/router.js +14 -0
  92. package/templates/init/client/lyte/routes/index.js +54 -0
  93. package/templates/init/client/react/.DS_Store +0 -0
  94. package/templates/init/client/react/react_js/package.json +11 -0
  95. package/templates/init/client/react/react_js/template/README.md +70 -0
  96. package/templates/init/client/react/react_js/template/client-package.json +5 -0
  97. package/templates/init/client/react/react_js/template/gitignore +23 -0
  98. package/templates/init/client/react/react_js/template/public/favicon.ico +0 -0
  99. package/templates/init/client/react/react_js/template/public/index.html +43 -0
  100. package/templates/init/client/react/react_js/template/public/logo192.png +0 -0
  101. package/templates/init/client/react/react_js/template/public/logo512.png +0 -0
  102. package/templates/init/client/react/react_js/template/public/manifest.json +25 -0
  103. package/templates/init/client/react/react_js/template/public/robots.txt +3 -0
  104. package/templates/init/client/react/react_js/template/src/App.css +38 -0
  105. package/templates/init/client/react/react_js/template/src/App.js +25 -0
  106. package/templates/init/client/react/react_js/template/src/App.test.js +8 -0
  107. package/templates/init/client/react/react_js/template/src/index.css +13 -0
  108. package/templates/init/client/react/react_js/template/src/index.js +17 -0
  109. package/templates/init/client/react/react_js/template/src/logo.svg +1 -0
  110. package/templates/init/client/react/react_js/template/src/reportWebVitals.js +13 -0
  111. package/templates/init/client/react/react_js/template/src/setupTests.js +5 -0
  112. package/templates/init/client/react/react_js/template.json +13 -0
  113. package/templates/init/client/react/react_ts/package.json +11 -0
  114. package/templates/init/client/react/react_ts/template/README.md +46 -0
  115. package/templates/init/client/react/react_ts/template/client-package.json +5 -0
  116. package/templates/init/client/react/react_ts/template/gitignore +23 -0
  117. package/templates/init/client/react/react_ts/template/public/favicon.ico +0 -0
  118. package/templates/init/client/react/react_ts/template/public/index.html +43 -0
  119. package/templates/init/client/react/react_ts/template/public/logo192.png +0 -0
  120. package/templates/init/client/react/react_ts/template/public/logo512.png +0 -0
  121. package/templates/init/client/react/react_ts/template/public/manifest.json +25 -0
  122. package/templates/init/client/react/react_ts/template/public/robots.txt +3 -0
  123. package/templates/init/client/react/react_ts/template/src/App.css +38 -0
  124. package/templates/init/client/react/react_ts/template/src/App.test.tsx +9 -0
  125. package/templates/init/client/react/react_ts/template/src/App.tsx +26 -0
  126. package/templates/init/client/react/react_ts/template/src/index.css +13 -0
  127. package/templates/init/client/react/react_ts/template/src/index.tsx +17 -0
  128. package/templates/init/client/react/react_ts/template/src/logo.svg +1 -0
  129. package/templates/init/client/react/react_ts/template/src/reportWebVitals.ts +15 -0
  130. package/templates/init/client/react/react_ts/template/src/setupTests.ts +5 -0
  131. package/templates/init/client/react/react_ts/template.json +18 -0
  132. package/templates/init/functions/java/integ/cliq/com/handlers/BotHandler.java +116 -113
  133. package/templates/init/functions/java/integ/cliq/com/handlers/CommandHandler.java +20 -27
  134. package/templates/init/functions/java/integ/cliq/com/handlers/FunctionHandler.java +143 -112
  135. package/templates/init/functions/java/integ/cliq/com/handlers/InstallationHandler.java +4 -7
  136. package/templates/init/functions/java/integ/cliq/com/handlers/InstallationValidator.java +4 -7
  137. package/templates/init/functions/java/integ/cliq/com/handlers/MessageActionHandler.java +10 -12
  138. package/templates/init/functions/java/integ/cliq/com/handlers/WidgetHandler.java +100 -66
  139. package/templates/init/functions/java/integ/cliq/sample.java +5 -7
  140. package/templates/init/functions/node/integ/cliq/.DS_Store +0 -0
  141. package/templates/init/functions/node/integ/cliq/handlers/bot-handler.js +23 -8
  142. package/templates/init/functions/node/integ/cliq/handlers/command-handler.js +3 -4
  143. package/templates/init/functions/node/integ/cliq/handlers/function-handler.js +46 -0
  144. package/templates/init/functions/node/integ/cliq/handlers/widget-handler.js +31 -0
  145. package/templates/init/functions/node/integ/cliq/package.json +2 -1
  146. package/templates/init/functions/node/integ/cliq/sample.js +3 -1
  147. package/templates/web-socket.txt +21 -0
  148. package/lib/init/features/client.js +0 -50
  149. package/lib/serve/server/lib/client.js +0 -30
@@ -11,8 +11,11 @@ const buildDir = JSON.parse(args[4]);
11
11
  const requestFile = path.join(buildDir, '.catalyst', 'user_req_body');
12
12
  const responseFile = path.join(buildDir, '.catalyst', 'user_res_body');
13
13
  const metaFile = path.join(buildDir, '.catalyst', 'user_meta.json');
14
- const writeToFile = (resp, metaJson) => {
15
- fs.writeFileSync(responseFile, JSON.stringify(resp));
14
+ const writeToFile = (respJson, metaJson) => {
15
+ const respStr = JSON.stringify(respJson);
16
+ fs.writeFileSync(responseFile, respStr);
17
+ metaJson.response['Content-Type'] = 'application/json';
18
+ metaJson.response['Content-Length'] = respStr.length;
16
19
  fs.writeFileSync(metaFile, JSON.stringify(metaJson));
17
20
  };
18
21
  let body = {};
@@ -21,7 +21,7 @@ const fn_utils_1 = require("../fn-utils");
21
21
  const runtime_store_1 = __importDefault(require("../runtime-store"));
22
22
  const constants_1 = require("../util_modules/constants");
23
23
  const fs_1 = require("../util_modules/fs");
24
- const logger_1 = require("../util_modules/logger");
24
+ const logger_js_1 = require("../util_modules/logger.js");
25
25
  const option_1 = require("../util_modules/option");
26
26
  const http_functions_1 = __importDefault(require("./dependencies/http-functions"));
27
27
  const local_function_1 = __importDefault(require("./dependencies/local-function"));
@@ -50,7 +50,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
50
50
  .get('context.functions.targets', [])
51
51
  .filter((target) => {
52
52
  if (!target.valid) {
53
- logger_1.warning('target [' +
53
+ logger_js_1.warning('target [' +
54
54
  target.name +
55
55
  '] is not a valid one reason : ' +
56
56
  target.failure_reason);
@@ -64,9 +64,13 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
64
64
  });
65
65
  }
66
66
  replServer.start();
67
- const watchOpt = option_1.getOptionValue('watch', false);
67
+ const watchOpt = option_1.getOptionValue('watch');
68
+ if (watchOpt === true) {
69
+ logger_js_1.info();
70
+ logger_js_1.labeled('DEPRECATED', `The ${ansi_colors_1.italic.bold('--watch')} option is deprecated. \nThe watch mode will be enabled by default. If you wish to disable it use the ${ansi_colors_1.italic.bold('--no-watch')} option. \nPlease execute ${ansi_colors_1.bold('catalyst functions:shell ' + ansi_colors_1.italic('--help'))} command for more usage details.`).WARN();
71
+ }
68
72
  yield Promise.all(targets.map((target) => __awaiter(void 0, void 0, void 0, function* () {
69
- if (watchOpt) {
73
+ if (watchOpt !== false) {
70
74
  yield fn_watcher_1.default(target);
71
75
  }
72
76
  const localFn = new local_function_1.default(replServer, target);
@@ -85,8 +89,8 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
85
89
  })));
86
90
  yield fs_1.ASYNC.deleteDir(path_1.join(runtime_store_1.default.get('cwd'), '.build')).catch();
87
91
  fn_utils_1.fnUtils.common.executeHook({ prefix: 'post', command: 'serve' });
88
- logger_1.info();
89
- logger_1.success('shell complete');
92
+ logger_js_1.info();
93
+ logger_js_1.success('shell complete');
90
94
  }
91
95
  catch (e) {
92
96
  yield Promise.all([
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CHAR = void 0;
4
4
  const ansi_colors_1 = require("ansi-colors");
5
5
  const env_1 = require("./env");
6
- const isSupported = !env_1.isWindows() || process.env.CI || process.env.TERM === 'xterm-256color';
6
+ const isSupported = !env_1.isWindows || process.env.CI || process.env.TERM === 'xterm-256color';
7
7
  exports.CHAR = {
8
8
  success: isSupported ? ansi_colors_1.bold.green('✔') : ansi_colors_1.bold.green('√'),
9
9
  warning: isSupported ? ansi_colors_1.bold.yellow('⚠') : ansi_colors_1.bold.yellow('‼'),
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.script = exports.enabled = exports.rules = exports.raw = void 0;
6
+ exports.source = exports.script = exports.enabled = exports.rules = exports.raw = void 0;
7
7
  const error_1 = __importDefault(require("../../../error"));
8
8
  const runtime_store_1 = __importDefault(require("../../../runtime-store"));
9
9
  const constants_1 = require("../../constants");
@@ -43,3 +43,4 @@ function script(name, fallback) {
43
43
  return (rawScripts && rawScripts[name]) || fallback;
44
44
  }
45
45
  exports.script = script;
46
+ exports.source = rules;
@@ -5,16 +5,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.script = exports.ignore = exports.plugin = exports.source = exports.raw = void 0;
7
7
  const path_1 = require("path");
8
- const error_1 = __importDefault(require("../../../error"));
9
- const runtime_store_1 = __importDefault(require("../../../runtime-store"));
10
- const constants_1 = require("../../constants");
11
- const js_1 = require("../../js");
12
- const logger_1 = require("../../logger");
8
+ const error_js_1 = __importDefault(require("../../../error.js"));
9
+ const runtime_store_js_1 = __importDefault(require("../../../runtime-store.js"));
10
+ const file_names_js_1 = __importDefault(require("../../constants/lib/file-names.js"));
11
+ const folder_names_js_1 = __importDefault(require("../../constants/lib/folder-names.js"));
12
+ const js_js_1 = require("../../js.js");
13
13
  function raw(throwError = false) {
14
- const config = runtime_store_1.default.get('config', null);
14
+ const config = runtime_store_js_1.default.get('config', null);
15
15
  if (config === null) {
16
16
  if (throwError) {
17
- throw new error_1.default(constants_1.FILENAME.config + ' file is required', { exit: 2 });
17
+ throw new error_js_1.default(file_names_js_1.default.config + ' file is required', { exit: 2 });
18
18
  }
19
19
  return;
20
20
  }
@@ -23,13 +23,10 @@ function raw(throwError = false) {
23
23
  exports.raw = raw;
24
24
  function source() {
25
25
  const clientConfig = raw();
26
- return (clientConfig && clientConfig.source) || constants_1.FOLDERNAME.client;
26
+ return (clientConfig && clientConfig.source) || folder_names_js_1.default.client;
27
27
  }
28
28
  exports.source = source;
29
- function plugin(name, source) {
30
- if (source) {
31
- logger_1.debug('Source config not supported for client');
32
- }
29
+ function plugin(name) {
33
30
  const clientConfig = raw();
34
31
  const rawPlugins = clientConfig && clientConfig.plugin;
35
32
  if (!rawPlugins) {
@@ -55,17 +52,17 @@ function ignore(sourcePath) {
55
52
  const clientConfig = raw();
56
53
  const ignoreArr = (clientConfig && clientConfig.ignore) || [];
57
54
  return ignoreArr.map((value) => {
58
- if (js_1.JS.indexOf(value, path_1.sep) === js_1.JS.size(value) - 1) {
59
- return '**' + path_1.sep + js_1.JS.initial(value).join('');
55
+ if (js_js_1.JS.indexOf(value, path_1.sep) === js_js_1.JS.size(value) - 1) {
56
+ return '**' + path_1.sep + js_js_1.JS.initial(value).join('');
60
57
  }
61
58
  else {
62
- if (js_1.JS.startsWith(value, path_1.sep)) {
63
- return js_1.JS.endsWith(value, path_1.sep)
64
- ? sourcePath + js_1.JS.initial(value).join('')
59
+ if (js_js_1.JS.startsWith(value, path_1.sep)) {
60
+ return js_js_1.JS.endsWith(value, path_1.sep)
61
+ ? sourcePath + js_js_1.JS.initial(value).join('')
65
62
  : sourcePath + value;
66
63
  }
67
- return js_1.JS.endsWith(value, path_1.sep)
68
- ? sourcePath + path_1.sep + js_1.JS.initial(value).join('')
64
+ return js_js_1.JS.endsWith(value, path_1.sep)
65
+ ? sourcePath + path_1.sep + js_js_1.JS.initial(value).join('')
69
66
  : sourcePath + path_1.sep + value;
70
67
  }
71
68
  });
@@ -75,13 +72,13 @@ function script(name, fallback) {
75
72
  const clientConfig = raw();
76
73
  const rawScripts = clientConfig && (clientConfig === null || clientConfig === void 0 ? void 0 : clientConfig.scripts);
77
74
  if (rawScripts === undefined && fallback === undefined) {
78
- throw new error_1.default('Scripts not found', { exit: 2 });
75
+ throw new error_js_1.default('Scripts not found', { exit: 2 });
79
76
  }
80
77
  if (name === undefined) {
81
78
  return rawScripts || fallback;
82
79
  }
83
80
  if (rawScripts && rawScripts[name] === undefined && fallback === undefined) {
84
- throw new error_1.default('Scripts not found', { exit: 2 });
81
+ throw new error_js_1.default('Scripts not found', { exit: 2 });
85
82
  }
86
83
  return (rawScripts && rawScripts[name]) || fallback;
87
84
  }
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.IAC = exports.ORIGIN = exports.TEMPLATE = exports.SCOPE = exports.REMOTE_REF = exports.REGEX = exports.REFERENCE = exports.PLACEHOLDER = exports.INTEG = exports.FOLDERNAME = exports.FN_TYPE = exports.DC_TYPE = exports.FILENAME = exports.EVENT_SOURCE = exports.EVENT_REF = exports.DEFAULT = exports.CLIQ = exports.AUTH = exports.APIG_RULES = void 0;
6
+ exports.IAC = exports.PLUGIN = exports.ORIGIN = exports.TEMPLATE = exports.SCOPE = exports.REMOTE_REF = exports.REGEX = exports.REFERENCE = exports.PLACEHOLDER = exports.INTEG = exports.FOLDERNAME = exports.FN_TYPE = exports.DC_TYPE = exports.FILENAME = exports.EVENT_SOURCE = exports.EVENT_REF = exports.DEFAULT = exports.CLIQ = exports.AUTH = exports.APIG_RULES = void 0;
7
7
  var apig_rules_1 = require("./lib/apig-rules");
8
8
  Object.defineProperty(exports, "APIG_RULES", { enumerable: true, get: function () { return __importDefault(apig_rules_1).default; } });
9
9
  var auth_1 = require("./lib/auth");
@@ -40,5 +40,7 @@ var template_1 = require("./lib/template");
40
40
  Object.defineProperty(exports, "TEMPLATE", { enumerable: true, get: function () { return __importDefault(template_1).default; } });
41
41
  var urls_1 = require("./lib/urls");
42
42
  Object.defineProperty(exports, "ORIGIN", { enumerable: true, get: function () { return __importDefault(urls_1).default; } });
43
+ var plugin_1 = require("./lib/plugin");
44
+ Object.defineProperty(exports, "PLUGIN", { enumerable: true, get: function () { return __importDefault(plugin_1).default; } });
43
45
  var iac_1 = require("./lib/iac");
44
46
  Object.defineProperty(exports, "IAC", { enumerable: true, get: function () { return __importDefault(iac_1).default; } });
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = Object.freeze({
4
4
  client: {
5
+ port: '{{_PORT_}}',
5
6
  package: {
6
7
  name: '{{_NAME_}}'
7
8
  }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = Object.freeze({
4
+ mangaer: {
5
+ npm: {
6
+ command: 'npm',
7
+ opts: ['config', 'get', 'prefix', '--json']
8
+ },
9
+ yarn: {
10
+ command: 'yarn',
11
+ opts: ['global', 'dir']
12
+ }
13
+ },
14
+ client: ['Angular', 'React', 'Basic'],
15
+ react: {
16
+ plugin: 'zcatalyst-cli-plugin-react',
17
+ runner_command: ['create-react-app']
18
+ },
19
+ lyte: {
20
+ plugin: 'zcatalyst-cli-plugin-lyte'
21
+ },
22
+ angular: {
23
+ plugin: 'zcatalyst-cli-plugin-angular',
24
+ runner_command: ['ng', 'new'],
25
+ collection_name: 'zcatalyst-angular-schematics',
26
+ runner_package: '@angular/cli@v12-lts'
27
+ }
28
+ });
@@ -7,7 +7,17 @@ exports.default = Object.freeze({
7
7
  banner: path_1.join(TEMPLATE_ROOT, 'banner.txt'),
8
8
  login_success: path_1.join(TEMPLATE_ROOT, 'loginSuccess.html'),
9
9
  login_fail: path_1.join(TEMPLATE_ROOT, 'loginFailure.html'),
10
- client: path_1.join(TEMPLATE_ROOT, 'init/client'),
10
+ client: {
11
+ basic: {
12
+ new: path_1.join(TEMPLATE_ROOT, 'init', 'client', 'basic'),
13
+ socket: path_1.join(TEMPLATE_ROOT, 'web-socket.txt')
14
+ },
15
+ lyte: path_1.join(TEMPLATE_ROOT, 'init', 'client', 'lyte'),
16
+ react: {
17
+ js: path_1.join(TEMPLATE_ROOT, 'init', 'client', 'react', 'react_js'),
18
+ ts: path_1.join(TEMPLATE_ROOT, 'init', 'client', 'react', 'react_ts')
19
+ }
20
+ },
11
21
  applogic: {
12
22
  node: path_1.join(TEMPLATE_ROOT, 'init', 'applogic', 'node')
13
23
  },
@@ -1,39 +1,55 @@
1
1
  'use strict';
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const env_1 = require("../../env");
4
- const dc_1 = require("../../../dc");
6
+ const env_js_1 = require("../../env.js");
7
+ const dc_js_1 = require("../../../dc.js");
8
+ const dc_type_js_1 = __importDefault(require("./dc-type.js"));
5
9
  class URL {
6
10
  static get auth() {
7
- const dc = dc_1.getActiveDCType();
11
+ const dc = dc_js_1.getActiveDCType();
8
12
  if (dc === undefined) {
9
13
  return URL._auth;
10
14
  }
11
15
  return URL._auth.replace('.com', dc.ext);
12
16
  }
13
17
  static get admin() {
14
- const dc = dc_1.getActiveDCType();
18
+ const dc = dc_js_1.getActiveDCType();
15
19
  if (dc === undefined) {
16
20
  return URL._admin;
17
21
  }
18
22
  return URL._admin.replace('.com', dc.ext);
19
23
  }
20
24
  static get app() {
21
- const dc = dc_1.getActiveDCType();
25
+ const dc = dc_js_1.getActiveDCType();
22
26
  if (dc === undefined) {
23
27
  return URL._app;
24
28
  }
25
29
  return URL._app.replace('.com', dc.ext);
26
30
  }
27
- static get zoho() {
28
- const dc = dc_1.getActiveDCType();
31
+ static get catalystStatic() {
32
+ const dc = dc_js_1.getActiveDCType();
29
33
  if (dc === undefined) {
30
- return URL._zoho;
34
+ return URL._catalystStatic;
31
35
  }
32
- return URL._zoho.replace('.com', dc.ext);
36
+ if (dc.ext === dc_type_js_1.default.in.ext) {
37
+ return URL._zohoStatic.replace(dc_type_js_1.default.us.ext, dc_type_js_1.default.in.ext);
38
+ }
39
+ return URL._catalystStatic.replace('.com', dc.ext);
40
+ }
41
+ static get console() {
42
+ const dc = dc_js_1.getActiveDCType();
43
+ if (dc === undefined) {
44
+ return URL._console;
45
+ }
46
+ return URL._console.replace('.com', dc.ext);
33
47
  }
34
48
  }
35
49
  exports.default = URL;
36
- URL._auth = env_1.envOverride('CATALYST_AUTH_URL', 'https://accounts.zoho.com');
37
- URL._admin = env_1.envOverride('CATALYST_ADMIN_URL', 'https://api.catalyst.zoho.com');
38
- URL._app = env_1.envOverride('CATALYST_APP_URL', 'https://catalystserverless.com');
39
- URL._zoho = env_1.envOverride('ZOHO_URL', 'https://www.zoho.com');
50
+ URL._auth = env_js_1.envOverride('CATALYST_AUTH_URL', 'https://accounts.zoho.com');
51
+ URL._admin = env_js_1.envOverride('CATALYST_ADMIN_URL', 'https://api.catalyst.zoho.com');
52
+ URL._app = env_js_1.envOverride('CATALYST_APP_URL', 'https://catalystserverless.com');
53
+ URL._zohoStatic = env_js_1.envOverride('ZOHO_STATIC', 'https://www.zoho.com/catalyst');
54
+ URL._catalystStatic = env_js_1.envOverride('CATALYST_STATIC', 'https://catalyst.zoho.com');
55
+ URL._console = env_js_1.envOverride('CATALYST_CONSOLE_URL', 'https://console.catalyst.zoho.com');
@@ -1,21 +1,22 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getEnvVariable = exports.envOverride = exports.isPrimaryShell = exports.isWindows = exports.isMac = void 0;
4
- function isMac() {
5
- return process && process.platform === 'darwin';
6
- }
7
- exports.isMac = isMac;
8
- function isWindows() {
9
- return (process &&
10
- (process.platform === 'win32' ||
11
- (process.env.OSTYPE !== undefined && /^(msys|cygwin)$/.test(process.env.OSTYPE))));
12
- }
13
- exports.isWindows = isWindows;
3
+ exports.getEnvVariable = exports.envOverride = exports.isPrimaryShell = exports.isWindows = exports.isMac = exports.isCI = void 0;
4
+ exports.isCI = process &&
5
+ !!(process.env.CI ||
6
+ process.env.CONTINUOUS_INTEGRATION ||
7
+ process.env.BUILD_NUMBER ||
8
+ process.env.RUN_ID ||
9
+ exports.name ||
10
+ false);
11
+ exports.isMac = process && process.platform === 'darwin';
12
+ exports.isWindows = process &&
13
+ (process.platform === 'win32' ||
14
+ (process.env.OSTYPE !== undefined && /^(msys|cygwin)$/.test(process.env.OSTYPE)));
14
15
  function isPrimaryShell() {
15
16
  if (!process || process.env.CATALYST_SUB_PROCESS) {
16
17
  return false;
17
18
  }
18
- if (!isWindows() && process.env.SHLVL) {
19
+ if (!exports.isWindows && process.env.SHLVL) {
19
20
  return parseInt(process.env.SHLVL) <= 1;
20
21
  }
21
22
  return false;
@@ -18,17 +18,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
18
18
  __setModuleDefault(result, mod);
19
19
  return result;
20
20
  };
21
- var __importDefault = (this && this.__importDefault) || function (mod) {
22
- return (mod && mod.__esModule) ? mod : { "default": mod };
23
- };
24
21
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.ASYNC = exports.SYNC = exports.untildify = void 0;
26
- const os_1 = __importDefault(require("os"));
22
+ exports.ASYNC = exports.SYNC = void 0;
27
23
  const ASYNC = __importStar(require("./lib/async"));
28
24
  exports.ASYNC = ASYNC;
29
25
  const SYNC = __importStar(require("./lib/sync"));
30
26
  exports.SYNC = SYNC;
31
- const tildRegex = /^~(?=$|\/|\\)/;
32
- const homeDirectory = os_1.default.homedir();
33
- const untildify = (pth) => homeDirectory ? pth.replace(tildRegex, homeDirectory) : pth;
34
- exports.untildify = untildify;
@@ -17,17 +17,17 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
17
17
  const minimatch_1 = __importDefault(require("minimatch"));
18
18
  const os_1 = __importDefault(require("os"));
19
19
  const path_1 = __importDefault(require("path"));
20
- const __1 = require("..");
20
+ const utils_js_1 = require("../utils.js");
21
21
  function dirExists(pth) {
22
22
  return __awaiter(this, void 0, void 0, function* () {
23
- const stats = yield fs_extra_1.default.stat(__1.untildify(pth)).catch(() => false);
23
+ const stats = yield fs_extra_1.default.stat(utils_js_1.untildify(pth)).catch(() => false);
24
24
  return stats && stats.isDirectory();
25
25
  });
26
26
  }
27
27
  exports.dirExists = dirExists;
28
28
  function fileExists(pth) {
29
29
  return __awaiter(this, void 0, void 0, function* () {
30
- const stats = yield fs_extra_1.default.stat(__1.untildify(pth)).catch(() => false);
30
+ const stats = yield fs_extra_1.default.stat(utils_js_1.untildify(pth)).catch(() => false);
31
31
  return stats && stats.isFile();
32
32
  });
33
33
  }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.untildify = void 0;
4
+ const os_1 = require("os");
5
+ const tildRegex = /^~(?=$|\/|\\)/;
6
+ const homeDirectory = os_1.homedir();
7
+ const untildify = (pth) => homeDirectory ? pth.replace(tildRegex, homeDirectory) : pth;
8
+ exports.untildify = untildify;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getGlobalOptionValue = exports.setGlobalOption = exports.getOptionValue = exports.getCurrentCommand = void 0;
6
+ exports.getUnknownOpts = exports.getGlobalOptionValue = exports.setGlobalOption = exports.getOptionValue = exports.getCurrentCommand = void 0;
7
7
  const runtime_store_1 = __importDefault(require("../runtime-store"));
8
8
  function getCurrentCommand(fallback) {
9
9
  return runtime_store_1.default.get('opts._name', fallback);
@@ -21,3 +21,7 @@ function getGlobalOptionValue(key, fallback) {
21
21
  return runtime_store_1.default.get('opts.globalOpts.' + key, fallback);
22
22
  }
23
23
  exports.getGlobalOptionValue = getGlobalOptionValue;
24
+ function getUnknownOpts(fallback) {
25
+ return runtime_store_1.default.get('opts.unknownOpts', fallback);
26
+ }
27
+ exports.getUnknownOpts = getUnknownOpts;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.ConnectionDestroyer = void 0;
16
+ const http_proxy_1 = __importDefault(require("http-proxy"));
17
+ class ConnectionDestroyer {
18
+ constructor(server) {
19
+ this.server = server;
20
+ this.connections = new Set();
21
+ if (this.server instanceof http_proxy_1.default) {
22
+ this.server.on('proxyReq', (req) => {
23
+ req.on('finish', () => this.connections.delete(req));
24
+ this.connections.add(req);
25
+ });
26
+ }
27
+ else {
28
+ this.server.on('connection', (sock) => {
29
+ sock.on('close', () => this.connections.delete(sock));
30
+ this.connections.add(sock);
31
+ });
32
+ }
33
+ }
34
+ destroy(terminate = true, err) {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ return new Promise((resolve, reject) => {
37
+ this.connections.forEach((sock) => {
38
+ sock.destroy(err);
39
+ });
40
+ if (terminate) {
41
+ if (this.server instanceof http_proxy_1.default) {
42
+ return this.server.close(() => resolve());
43
+ }
44
+ else {
45
+ return this.server.close((err) => err instanceof Error ? reject(err) : resolve());
46
+ }
47
+ }
48
+ resolve();
49
+ });
50
+ });
51
+ }
52
+ }
53
+ exports.ConnectionDestroyer = ConnectionDestroyer;
@@ -47,19 +47,23 @@ function spawn(command, opts, _a = {}) {
47
47
  ASYNC: () => {
48
48
  const childProcess = cross_spawn_1.default(command, opts, Object.assign({ cwd,
49
49
  stdio,
50
- shell }, otherOpts)).on('error', logger_1.debug);
50
+ shell }, otherOpts));
51
51
  return new Promise((res, rej) => {
52
+ var _a;
52
53
  let message = '';
54
+ let stdout = '';
55
+ (_a = childProcess.stdout) === null || _a === void 0 ? void 0 : _a.on('data', (msg) => {
56
+ stdout += msg.toString();
57
+ });
53
58
  childProcess.on('message', (msg) => {
54
59
  message += msg.toString();
55
- logger_1.debug(msg.toString());
56
60
  });
57
- childProcess.on('error', rej);
61
+ childProcess.on('error', (err) => rej(err));
58
62
  childProcess.on('exit', (code) => {
59
63
  if (code !== 0) {
60
64
  rej(code);
61
65
  }
62
- res(message);
66
+ res({ message, stdout });
63
67
  });
64
68
  });
65
69
  },
@@ -72,7 +76,7 @@ function spawn(command, opts, _a = {}) {
72
76
  exports.spawn = spawn;
73
77
  function which(commandName, { alwaysResolve = true }) {
74
78
  let cleanedCmd = commandName;
75
- if (env_1.isWindows()) {
79
+ if (env_1.isWindows) {
76
80
  const isPathName = /[\\]/.test(commandName);
77
81
  if (isPathName) {
78
82
  const dirname = '"' + path_1.default.dirname(commandName) + '"';
@@ -90,7 +94,7 @@ function which(commandName, { alwaysResolve = true }) {
90
94
  .replace(/\\'''/g, "\\'");
91
95
  }
92
96
  return new Promise((resolve, reject) => {
93
- if (env_1.isWindows()) {
97
+ if (env_1.isWindows) {
94
98
  if (/[\x00-\x1f<>:"|?*]/.test(commandName)) {
95
99
  alwaysResolve ? resolve(false) : reject('controll char test failed');
96
100
  }
package/lib/winston.js CHANGED
@@ -60,7 +60,7 @@ exports.logger = winston_1.createLogger({
60
60
  transports: [exports.transport.console],
61
61
  exitOnError: false
62
62
  });
63
- if (env_1.isPrimaryShell()) {
63
+ if (env_1.isWindows || env_1.isPrimaryShell()) {
64
64
  if (usage) {
65
65
  exports.logger.add(exports.transport.http_log);
66
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zcatalyst-cli",
3
- "version": "1.10.1",
3
+ "version": "1.12.1",
4
4
  "description": "Command Line Tool for CATALYST",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -9,6 +9,7 @@
9
9
  "engines": {
10
10
  "node": ">=12.0.0"
11
11
  },
12
+ "preferGlobal": true,
12
13
  "keywords": [
13
14
  "cli",
14
15
  "cloud",
@@ -29,14 +30,13 @@
29
30
  "better-queue": "^3.8.10",
30
31
  "chokidar": "^3.5.2",
31
32
  "cli-cursor": "^3.1.0",
32
- "cli-table3": "^0.6.0",
33
+ "cli-table3": "0.6.0",
33
34
  "commander": "^8.2.0",
34
35
  "conf": "^10.0.2",
35
36
  "cross-spawn": "^7.0.3",
36
37
  "express": "^4.17.1",
37
38
  "fs-extra": "^10.0.0",
38
39
  "fuzzy": "^0.1.3",
39
- "global-dirs": "^3.0.0",
40
40
  "http-proxy": "^1.18.1",
41
41
  "inquirer": "^8.1.2",
42
42
  "inquirer-autocomplete-prompt": "^1.4.0",
@@ -53,8 +53,10 @@
53
53
  "toml": "^3.0.0",
54
54
  "update-notifier": "^5.1.0",
55
55
  "winston": "^3.3.3",
56
+ "ws": "^8.2.3",
56
57
  "xml2js": "^0.4.23",
57
- "yaml": "^1.10.2"
58
+ "yaml": "^1.10.2",
59
+ "zcatalyst-angular-schematics": "^0.1.0"
58
60
  },
59
61
  "devDependencies": {
60
62
  "@types/app-module-path": "^2.2.0",
@@ -68,10 +70,11 @@
68
70
  "@types/jest": "^26.0.24",
69
71
  "@types/lodash": "^4.14.172",
70
72
  "@types/minimatch": "^3.0.5",
71
- "@types/node": "^16.6.0",
73
+ "@types/node": "^16.11.21",
72
74
  "@types/request": "^2.48.7",
73
75
  "@types/semver": "^7.3.8",
74
76
  "@types/update-notifier": "^5.1.0",
77
+ "@types/ws": "^8.2.0",
75
78
  "@types/xml2js": "^0.4.9",
76
79
  "@typescript-eslint/eslint-plugin": "^4.29.1",
77
80
  "@typescript-eslint/parser": "^4.29.1",
Binary file
Binary file
Binary file
File without changes