zcatalyst-cli 1.9.0 → 1.11.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 (190) hide show
  1. package/README.md +29 -29
  2. package/docs/client-utils.toml +5 -0
  3. package/docs/command_needs/auth.toml +5 -0
  4. package/docs/commands/iac/export.toml +4 -0
  5. package/docs/commands/iac/import.toml +4 -0
  6. package/docs/commands/iac/status.toml +4 -0
  7. package/docs/commands/project/use.toml +6 -0
  8. package/docs/iac/status/bundle.toml +4 -0
  9. package/docs/plugin-loader.toml +4 -0
  10. package/docs/serve/server/index.toml +4 -0
  11. package/docs/serve/server/lib/web_client/server.toml +4 -0
  12. package/lib/api-timer.js +81 -0
  13. package/lib/apig-utils.js +17 -14
  14. package/lib/archiver.js +83 -45
  15. package/lib/authentication/login.js +4 -2
  16. package/lib/bin/catalyst.js +0 -1
  17. package/lib/client-utils.js +55 -26
  18. package/lib/client.js +0 -3
  19. package/lib/command_needs/auth.js +12 -3
  20. package/lib/command_needs/rc.js +12 -7
  21. package/lib/commands/apig/disable.js +1 -1
  22. package/lib/commands/apig/enable.js +1 -1
  23. package/lib/commands/apig/status.js +7 -5
  24. package/lib/commands/client/delete.js +4 -5
  25. package/lib/commands/client/setup.js +1 -1
  26. package/lib/commands/deploy.js +4 -2
  27. package/lib/commands/ds/export.js +4 -2
  28. package/lib/commands/ds/import.js +4 -2
  29. package/lib/commands/ds/status.js +146 -150
  30. package/lib/commands/event/generate/index.js +5 -14
  31. package/lib/commands/event/generate/integ.js +1 -1
  32. package/lib/commands/functions/add.js +1 -1
  33. package/lib/commands/functions/config.js +1 -1
  34. package/lib/commands/functions/delete.js +1 -1
  35. package/lib/commands/functions/setup.js +1 -1
  36. package/lib/commands/functions/shell.js +1 -1
  37. package/lib/commands/help.js +0 -22
  38. package/lib/commands/iac/export.js +85 -0
  39. package/lib/commands/iac/import.js +189 -0
  40. package/lib/commands/iac/pack.js +129 -0
  41. package/lib/commands/iac/status.js +63 -0
  42. package/lib/commands/index.js +4 -0
  43. package/lib/commands/init.js +35 -28
  44. package/lib/commands/login.js +1 -1
  45. package/lib/commands/logout.js +1 -1
  46. package/lib/commands/project/list.js +11 -7
  47. package/lib/commands/project/reset.js +1 -1
  48. package/lib/commands/project/use.js +42 -25
  49. package/lib/commands/pull.js +2 -2
  50. package/lib/commands/run.js +1 -1
  51. package/lib/commands/serve.js +3 -2
  52. package/lib/commands/token/generate.js +1 -1
  53. package/lib/commands/token/list.js +1 -1
  54. package/lib/commands/token/revoke.js +1 -1
  55. package/lib/commands/whoami.js +1 -1
  56. package/lib/deploy/features/functions/index.js +2 -1
  57. package/lib/deploy/index.js +3 -1
  58. package/lib/endpoints/lib/iac.js +134 -0
  59. package/lib/error.js +33 -3
  60. package/lib/errorOut.js +4 -3
  61. package/lib/fn-utils/lib/common.js +37 -16
  62. package/lib/fn-utils/lib/java.js +7 -9
  63. package/lib/fn-utils/lib/node.js +7 -1
  64. package/lib/iac/status/bundle.js +82 -0
  65. package/lib/iac/status/deploy.js +74 -0
  66. package/lib/iac/status/util/index.js +26 -0
  67. package/lib/index.js +13 -19
  68. package/lib/init/dependencies/npm-install.js +2 -9
  69. package/lib/init/features/client/index.js +47 -0
  70. package/lib/init/features/client/initializers/angular.js +88 -0
  71. package/lib/init/features/client/initializers/basic.js +27 -0
  72. package/lib/init/features/client/initializers/lyte.js +44 -0
  73. package/lib/init/features/client/initializers/react.js +53 -0
  74. package/lib/init/features/functions/languages/java.js +2 -5
  75. package/lib/init/features/functions/languages/node.js +5 -6
  76. package/lib/init/features/index.js +18 -6
  77. package/lib/init/features/project.js +72 -34
  78. package/lib/init/util/client.js +12 -0
  79. package/lib/init/util/functions.js +20 -0
  80. package/lib/init/util/project.js +35 -0
  81. package/lib/internal/api.js +6 -9
  82. package/lib/internal/command.js +6 -3
  83. package/lib/internal/config.js +7 -4
  84. package/lib/migration/index.js +10 -6
  85. package/lib/option-filter.js +4 -1
  86. package/lib/optional-import.js +11 -25
  87. package/lib/plugin-loader.js +8 -2
  88. package/lib/port-resolver.js +20 -16
  89. package/lib/prompt/index.js +92 -0
  90. package/lib/prompt/types/file-path.js +95 -0
  91. package/lib/pull/features/client.js +1 -1
  92. package/lib/pull/features/functions/index.js +5 -7
  93. package/lib/pull/index.js +4 -1
  94. package/lib/serve/features/index.js +3 -1
  95. package/lib/serve/index.js +6 -1
  96. package/lib/serve/server/index.js +74 -29
  97. package/lib/serve/server/lib/master.js +28 -12
  98. package/lib/serve/server/lib/web_client/index.js +30 -0
  99. package/lib/serve/server/lib/web_client/server.js +171 -0
  100. package/lib/serve/server/lib/web_client/utils.js +10 -0
  101. package/lib/shell/dependencies/http-functions.js +1 -1
  102. package/lib/shell/index.js +3 -1
  103. package/lib/track.js +3 -1
  104. package/lib/util_modules/char.js +1 -1
  105. package/lib/util_modules/config/lib/apig.js +2 -1
  106. package/lib/util_modules/constants/index.js +5 -1
  107. package/lib/util_modules/constants/lib/file-names.js +2 -1
  108. package/lib/util_modules/constants/lib/iac.js +8 -0
  109. package/lib/util_modules/constants/lib/placeholders.js +3 -1
  110. package/lib/util_modules/constants/lib/plugin.js +28 -0
  111. package/lib/util_modules/constants/lib/regex.js +2 -1
  112. package/lib/util_modules/constants/lib/scopes.js +5 -0
  113. package/lib/util_modules/constants/lib/template.js +11 -1
  114. package/lib/util_modules/constants/lib/urls.js +8 -0
  115. package/lib/util_modules/constants/project.js +6 -0
  116. package/lib/util_modules/{contextHelp.js → context-help.js} +5 -1
  117. package/lib/util_modules/env.js +14 -16
  118. package/lib/util_modules/fs/index.js +9 -1
  119. package/lib/util_modules/fs/lib/async.js +29 -22
  120. package/lib/util_modules/global-space.js +99 -0
  121. package/lib/util_modules/js.js +6 -0
  122. package/lib/util_modules/option.js +5 -1
  123. package/lib/util_modules/parser/toml.js +5 -1
  124. package/lib/util_modules/project.js +3 -0
  125. package/lib/util_modules/shell.js +9 -8
  126. package/lib/winston.js +1 -1
  127. package/package.json +11 -5
  128. package/templates/iacSuccess.html +391 -0
  129. package/templates/init/.DS_Store +0 -0
  130. package/templates/init/client/.DS_Store +0 -0
  131. package/templates/init/client/{client-package.json → basic/client-package.json} +0 -0
  132. package/templates/init/client/{index.html → basic/index.html} +0 -0
  133. package/templates/init/client/{main.css → basic/main.css} +0 -0
  134. package/templates/init/client/{main.js → basic/main.js} +0 -0
  135. package/templates/init/client/lyte/build/build.js +301 -0
  136. package/templates/init/client/lyte/build/scripts/cliDownloadScript.js +54 -0
  137. package/templates/init/client/lyte/client-package.json +5 -0
  138. package/templates/init/client/lyte/components/javascript/welcome-comp.js +13 -0
  139. package/templates/init/client/lyte/components/styles/welcome-comp.css +0 -0
  140. package/templates/init/client/lyte/components/templates/welcome-comp.html +8 -0
  141. package/templates/init/client/lyte/data-store/adapters/.gitkeep +0 -0
  142. package/templates/init/client/lyte/data-store/models/.gitkeep +0 -0
  143. package/templates/init/client/lyte/data-store/serializers/.gitkeep +0 -0
  144. package/templates/init/client/lyte/index.html +17 -0
  145. package/templates/init/client/lyte/package.json +12 -0
  146. package/templates/init/client/lyte/router.js +14 -0
  147. package/templates/init/client/lyte/routes/index.js +54 -0
  148. package/templates/init/client/react/.DS_Store +0 -0
  149. package/templates/init/client/react/react_js/package.json +11 -0
  150. package/templates/init/client/react/react_js/template/README.md +70 -0
  151. package/templates/init/client/react/react_js/template/client-package.json +5 -0
  152. package/templates/init/client/react/react_js/template/gitignore +23 -0
  153. package/templates/init/client/react/react_js/template/public/favicon.ico +0 -0
  154. package/templates/init/client/react/react_js/template/public/index.html +43 -0
  155. package/templates/init/client/react/react_js/template/public/logo192.png +0 -0
  156. package/templates/init/client/react/react_js/template/public/logo512.png +0 -0
  157. package/templates/init/client/react/react_js/template/public/manifest.json +25 -0
  158. package/templates/init/client/react/react_js/template/public/robots.txt +3 -0
  159. package/templates/init/client/react/react_js/template/src/App.css +38 -0
  160. package/templates/init/client/react/react_js/template/src/App.js +25 -0
  161. package/templates/init/client/react/react_js/template/src/App.test.js +8 -0
  162. package/templates/init/client/react/react_js/template/src/index.css +13 -0
  163. package/templates/init/client/react/react_js/template/src/index.js +17 -0
  164. package/templates/init/client/react/react_js/template/src/logo.svg +1 -0
  165. package/templates/init/client/react/react_js/template/src/reportWebVitals.js +13 -0
  166. package/templates/init/client/react/react_js/template/src/setupTests.js +5 -0
  167. package/templates/init/client/react/react_js/template.json +13 -0
  168. package/templates/init/client/react/react_ts/package.json +11 -0
  169. package/templates/init/client/react/react_ts/template/README.md +46 -0
  170. package/templates/init/client/react/react_ts/template/client-package.json +5 -0
  171. package/templates/init/client/react/react_ts/template/gitignore +23 -0
  172. package/templates/init/client/react/react_ts/template/public/favicon.ico +0 -0
  173. package/templates/init/client/react/react_ts/template/public/index.html +43 -0
  174. package/templates/init/client/react/react_ts/template/public/logo192.png +0 -0
  175. package/templates/init/client/react/react_ts/template/public/logo512.png +0 -0
  176. package/templates/init/client/react/react_ts/template/public/manifest.json +25 -0
  177. package/templates/init/client/react/react_ts/template/public/robots.txt +3 -0
  178. package/templates/init/client/react/react_ts/template/src/App.css +38 -0
  179. package/templates/init/client/react/react_ts/template/src/App.test.tsx +9 -0
  180. package/templates/init/client/react/react_ts/template/src/App.tsx +26 -0
  181. package/templates/init/client/react/react_ts/template/src/index.css +13 -0
  182. package/templates/init/client/react/react_ts/template/src/index.tsx +17 -0
  183. package/templates/init/client/react/react_ts/template/src/logo.svg +1 -0
  184. package/templates/init/client/react/react_ts/template/src/reportWebVitals.ts +15 -0
  185. package/templates/init/client/react/react_ts/template/src/setupTests.ts +5 -0
  186. package/templates/init/client/react/react_ts/template.json +18 -0
  187. package/templates/web-socket.txt +21 -0
  188. package/lib/init/features/client.js +0 -51
  189. package/lib/prompt.js +0 -49
  190. package/lib/serve/server/lib/client.js +0 -30
@@ -82,7 +82,7 @@ const keyWords = [
82
82
  'volatile',
83
83
  'while'
84
84
  ];
85
- exports.classPathSep = env_1.isWindows() ? ';' : ':';
85
+ exports.classPathSep = env_1.isWindows ? ';' : ':';
86
86
  function containsKeyWord(name) {
87
87
  return keyWords.some((keyWord) => {
88
88
  if (name === keyWord ||
@@ -115,7 +115,7 @@ function rewriteClasspath(pth, libPth) {
115
115
  if (content === undefined) {
116
116
  throw new error_1.default('Content of ' + pth + ' is not defined', { exit: 2 });
117
117
  }
118
- const files = yield fs_1.ASYNC.walk(path_1.dirname(libPth), ['**/.output']);
118
+ const files = yield fs_1.ASYNC.walk(path_1.dirname(libPth), { exclude: ['**/.output'] });
119
119
  const result = yield xml2js_1.default.parseStringPromise(content);
120
120
  const classPathEntries = js_1.JS.chain(files)
121
121
  .filter((jarPth) => path_1.extname(jarPth) === '.jar')
@@ -208,7 +208,7 @@ function compileTarget(target) {
208
208
  yield fs_1.ASYNC.ensureDir(outputFolder);
209
209
  yield fs_1.ASYNC.emptyDir(outputFolder);
210
210
  const ignore = config_1.functionsConfig.ignore(targetSource);
211
- const allFiles = yield fs_1.ASYNC.walk(targetSource, ['**/.output', ...ignore]);
211
+ const allFiles = yield fs_1.ASYNC.walk(targetSource, { exclude: ['**/.output', ...ignore] });
212
212
  const cleanUpFiles = [...allFiles];
213
213
  while (allFiles.length > 0) {
214
214
  const limit = allFiles.length < 20 ? allFiles.length : 20;
@@ -216,8 +216,7 @@ function compileTarget(target) {
216
216
  const targetPth = file.includes(path_1.sep + 'lib' + path_1.sep)
217
217
  ? file.replace(targetSource + path_1.sep + 'lib', '')
218
218
  : file.replace(targetSource, '');
219
- const target = path_1.join(outputFolder, targetPth);
220
- return fs_1.ASYNC.copyFile(file, target);
219
+ return fs_1.ASYNC.copyFile(file, path_1.join(outputFolder, targetPth));
221
220
  }));
222
221
  }
223
222
  yield Promise.all(entries.map((file) => {
@@ -234,11 +233,11 @@ function compileTarget(target) {
234
233
  }));
235
234
  const currentCommand = option_1.getCurrentCommand();
236
235
  switch (currentCommand) {
237
- case 'pull': {
236
+ case 'pull':
237
+ case 'init':
238
238
  yield cleanUp(cleanUpFiles);
239
239
  break;
240
- }
241
- case 'deploy': {
240
+ case 'deploy':
242
241
  const classPath = path_1.join(outputFolder, constants_1.FILENAME.functions.java_classpath);
243
242
  if (yield fs_1.ASYNC.fileExists(classPath)) {
244
243
  const classPathFile = yield fs_1.ASYNC.readFile(classPath);
@@ -247,7 +246,6 @@ function compileTarget(target) {
247
246
  }
248
247
  }
249
248
  break;
250
- }
251
249
  }
252
250
  });
253
251
  }
@@ -19,6 +19,7 @@ const error_1 = __importDefault(require("../../error"));
19
19
  const constants_1 = require("../../util_modules/constants");
20
20
  const fs_1 = require("../../util_modules/fs");
21
21
  const js_1 = require("../../util_modules/js");
22
+ const shell_1 = require("../../util_modules/shell");
22
23
  function validate(targets, idx) {
23
24
  return __awaiter(this, void 0, void 0, function* () {
24
25
  if (targets.length < idx + 1) {
@@ -47,10 +48,15 @@ function validate(targets, idx) {
47
48
  ]
48
49
  });
49
50
  }
51
+ const nodeModuleExists = yield fs_1.ASYNC.dirExists(path_1.join(currentTarget.source, constants_1.FILENAME.node_modules));
52
+ if (!nodeModuleExists) {
53
+ yield shell_1.spawn('npm', ['install'], { cwd: currentTarget.source }).ASYNC();
54
+ }
50
55
  currentTarget.valid = true;
51
56
  return validate(targets, ++idx);
52
57
  }
53
- catch (err) {
58
+ catch (e) {
59
+ const err = error_1.default.getErrorInstance(e);
54
60
  currentTarget.valid = false;
55
61
  currentTarget.failure_reason = err.message;
56
62
  return validate(targets, ++idx);
@@ -0,0 +1,82 @@
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
+ const iac_1 = __importDefault(require("../../endpoints/lib/iac"));
16
+ const api_timer_1 = __importDefault(require("../../api-timer"));
17
+ const error_1 = __importDefault(require("../../error"));
18
+ const throbber_1 = __importDefault(require("../../throbber"));
19
+ const logger_1 = require("../../util_modules/logger");
20
+ const util_1 = require("./util");
21
+ const prompt_1 = __importDefault(require("../../prompt"));
22
+ const fs_1 = require("../../util_modules/fs");
23
+ const path_1 = require("path");
24
+ const option_1 = require("../../util_modules/option");
25
+ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
26
+ const env = option_1.getOptionValue('production', false) ? 'Production' : 'Development';
27
+ const getSpinnerTxt = util_1.getSpinnerTxt('bundle');
28
+ const iacAPI = new iac_1.default(undefined, { env });
29
+ const bundleStatus = yield iacAPI.bundleStatus();
30
+ if (bundleStatus === undefined) {
31
+ throw new error_1.default('No export project available in server.', {
32
+ exit: 1,
33
+ errorId: 'B-1'
34
+ });
35
+ }
36
+ const throbber = throbber_1.default.getInstance();
37
+ const spinner = bundleStatus.id;
38
+ throbber.add(spinner, {
39
+ text: getSpinnerTxt(bundleStatus)
40
+ });
41
+ const timerAPI = new api_timer_1.default(iacAPI.bundleStatus.bind(iacAPI), 2000, 1);
42
+ timerAPI.on('data', (data) => __awaiter(void 0, void 0, void 0, function* () {
43
+ switch (data.status) {
44
+ case 'Scheduled':
45
+ case 'Processing':
46
+ throbber.update(spinner, {
47
+ text: getSpinnerTxt(data) + '\nPress CTRL + C to exit listening to the status'
48
+ });
49
+ break;
50
+ case 'Error_Processing':
51
+ throbber.fail(spinner, {
52
+ text: getSpinnerTxt(data, 'failed')
53
+ });
54
+ timerAPI.end();
55
+ break;
56
+ case 'Completed':
57
+ throbber.succeed(spinner, {
58
+ text: getSpinnerTxt(data)
59
+ });
60
+ timerAPI.end(undefined, true);
61
+ break;
62
+ default:
63
+ logger_1.debug('Unknown status received : ', data.status);
64
+ timerAPI.end();
65
+ }
66
+ }));
67
+ timerAPI.on('error', (e) => {
68
+ logger_1.debug('Error encounted :', e);
69
+ });
70
+ timerAPI.on('end', () => throbber.stopAll());
71
+ timerAPI.start();
72
+ const isCompleted = yield timerAPI.waitForEnd();
73
+ if (isCompleted) {
74
+ const ans = yield prompt_1.default.ask(prompt_1.default.question('download', 'Would you like to download the export zip of this job to your cmd execution directory?', { type: 'confirm', defaultAns: true }));
75
+ if (ans.download) {
76
+ const hrTime = process.hrtime();
77
+ const fileName = `export_${bundleStatus.id}_${hrTime[0] * 1000000000 + hrTime[1]}.zip`;
78
+ const bundlezip = yield iacAPI.bundleDownload();
79
+ return fs_1.ASYNC.writeFile(path_1.join(process.cwd(), fileName), bundlezip);
80
+ }
81
+ }
82
+ });
@@ -0,0 +1,74 @@
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
+ const iac_1 = __importDefault(require("../../endpoints/lib/iac"));
16
+ const api_timer_1 = __importDefault(require("../../api-timer"));
17
+ const option_1 = require("../../util_modules/option");
18
+ const error_1 = __importDefault(require("../../error"));
19
+ const throbber_1 = __importDefault(require("../../throbber"));
20
+ const logger_1 = require("../../util_modules/logger");
21
+ const util_1 = require("./util");
22
+ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
23
+ const getSpinnerTxt = util_1.getSpinnerTxt('deploy');
24
+ const idOpt = option_1.getOptionValue('id', false);
25
+ const iacAPI = new iac_1.default();
26
+ const allDeploys = yield iacAPI.allDeploys();
27
+ if (allDeploys.length <= 0) {
28
+ throw new error_1.default('No import projects available in server.');
29
+ }
30
+ const neededDeploys = allDeploys.filter((deploy) => deploy.id === idOpt || deploy.status === 'Scheduled');
31
+ if (neededDeploys.length <= 0) {
32
+ throw new error_1.default(idOpt
33
+ ? 'No import projects with given id exists.'
34
+ : 'No import projects currently scheduled.');
35
+ }
36
+ const deployDetails = neededDeploys[0];
37
+ const throbber = throbber_1.default.getInstance();
38
+ const spinner = deployDetails.id;
39
+ throbber.add(spinner, {
40
+ text: getSpinnerTxt(deployDetails)
41
+ });
42
+ const timerAPI = new api_timer_1.default(iacAPI.deployStatus.bind(iacAPI, deployDetails.id), 2000, 1);
43
+ timerAPI.on('data', (data) => __awaiter(void 0, void 0, void 0, function* () {
44
+ switch (data.status) {
45
+ case 'Scheduled':
46
+ case 'Processing':
47
+ throbber.update(spinner, {
48
+ text: getSpinnerTxt(data) + '\nPress CTRL + C to exit listening to the status'
49
+ });
50
+ break;
51
+ case 'Error_Processing':
52
+ throbber.fail(spinner, {
53
+ text: getSpinnerTxt(data, 'failed')
54
+ });
55
+ timerAPI.end();
56
+ break;
57
+ case 'Completed':
58
+ throbber.succeed(spinner, {
59
+ text: getSpinnerTxt(data)
60
+ });
61
+ timerAPI.end(undefined, true);
62
+ break;
63
+ default:
64
+ logger_1.debug('Unknown status received : ', data.status);
65
+ timerAPI.end();
66
+ }
67
+ }));
68
+ timerAPI.on('error', (e) => {
69
+ logger_1.debug('Error encounted : ', e);
70
+ });
71
+ timerAPI.on('end', () => throbber.stopAll());
72
+ timerAPI.start();
73
+ yield timerAPI.waitForEnd();
74
+ });
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSpinnerTxt = void 0;
4
+ const getSpinnerTxt = (type) => (deployDetails, status) => {
5
+ var _a, _b;
6
+ const logs = [];
7
+ const processError = (_a = deployDetails.logs) === null || _a === void 0 ? void 0 : _a.processing_errors;
8
+ const validationError = (_b = deployDetails.logs) === null || _b === void 0 ? void 0 : _b.validation_errors;
9
+ if (processError) {
10
+ if (typeof processError === 'string') {
11
+ logs.push(`Error Message: ${processError}`);
12
+ }
13
+ else {
14
+ logs.push(`Error while processing "${processError.component}"`, `Error Message: ${processError.error_message}`);
15
+ }
16
+ }
17
+ if (validationError) {
18
+ logs.push('Error while validating : ');
19
+ logs.push(...validationError);
20
+ }
21
+ return [
22
+ `${type === 'bundle' ? 'Export' : 'Import'} Project "${deployDetails.project_details.project_name}" ${status ? status : deployDetails.status.toLowerCase()}`,
23
+ ...logs
24
+ ].join('\n' + ' '.repeat(status ? 2 : 4));
25
+ };
26
+ exports.getSpinnerTxt = getSpinnerTxt;
package/lib/index.js CHANGED
@@ -3,31 +3,25 @@ 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
- const ansi_colors_1 = require("ansi-colors");
7
6
  const commander_1 = require("commander");
8
- const meant_1 = __importDefault(require("meant"));
9
7
  const client_1 = require("./client");
10
8
  const runtime_store_1 = __importDefault(require("./runtime-store"));
9
+ const fs_1 = require("./util_modules/fs");
10
+ const constants_1 = require("./util_modules/constants");
11
+ const ansi_colors_1 = require("ansi-colors");
11
12
  const packageJson = runtime_store_1.default.get('context.cli.package');
12
13
  const { description, version } = packageJson;
13
14
  const program = new commander_1.Command();
14
15
  program.description(description);
15
- program.version(version, '-v, --version');
16
- program.option('-p, --project <name|project_id>', 'the catalyst project to use for this command');
17
- program.option('--token <token>', 'supply an auth token for this command');
18
- program.option('--dc <us|eu|in>', 'supply a DC to use for this command');
19
- program.option('--verbose', 'changes the log level to verbose for debug purpose');
16
+ program.version(version, '-v, --version', 'Print the Catalyst CLI version number');
17
+ program.option('-p, --project <name|project_id>', 'Specify the Catalyst project to be used for a command');
18
+ program.option('--token <token>', 'Supply an authentication token for a command');
19
+ program.option('--dc <us|eu|in>', 'Supply a data center for a command');
20
+ program.option('--verbose', 'Change the log level to verbose for debugging purposes');
21
+ program.helpOption('-h, --help', 'Display help for a Catalyst command');
22
+ program.showSuggestionAfterError();
23
+ program.showHelpAfterError(`For more usage information use the ${ansi_colors_1.bold('catalyst help')} command`);
24
+ program.addHelpText('before', fs_1.SYNC.readFile(constants_1.TEMPLATE.banner, 'utf-8') || '');
25
+ program.addHelpText('afterAll', `\nFor detailed documentations please visit ${ansi_colors_1.underline('https://www.zoho.com/catalyst/help/cli-command-reference.html')}`);
20
26
  const cli = new client_1.Client(program);
21
- cli.onUnknownCommand((_OPTS, cmd) => {
22
- const commandNames = cli.getAllCommandNames();
23
- console.error();
24
- console.error('"' + ansi_colors_1.bold(cmd.args.join(' ')) + '" is not a catalyst command');
25
- let suggestion = meant_1.default(cmd.args.join(' '), commandNames);
26
- suggestion = suggestion || meant_1.default(cmd.args.join(':'), commandNames);
27
- if (suggestion && suggestion.length) {
28
- console.error('Did you mean ' + ansi_colors_1.bold(suggestion.join(', ')) + ' ?');
29
- }
30
- console.error();
31
- process.exit(1);
32
- });
33
27
  exports.default = cli;
@@ -13,19 +13,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const prompt_1 = __importDefault(require("../../prompt"));
16
- const runtime_store_1 = __importDefault(require("../../runtime-store"));
17
- const constants_1 = require("../../util_modules/constants");
18
16
  const shell_1 = require("../../util_modules/shell");
19
- exports.default = (pth) => __awaiter(void 0, void 0, void 0, function* () {
17
+ exports.default = (pth, skipPrompt = false) => __awaiter(void 0, void 0, void 0, function* () {
20
18
  const ans = yield prompt_1.default.ask(prompt_1.default.question('NPMinstall', 'Do you wish to install all dependencies now ? ', {
21
19
  type: 'confirm',
22
20
  defaultAns: true,
23
- when: () => {
24
- if (runtime_store_1.default.get('context.functions.type') === constants_1.FN_TYPE.integration) {
25
- return false;
26
- }
27
- return true;
28
- }
21
+ when: () => !skipPrompt
29
22
  }));
30
23
  if (ans.NPMinstall === undefined || ans.NPMinstall) {
31
24
  return shell_1.spawn('npm', ['install'], { cwd: pth }).ASYNC();
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
+ return new (P || (P = Promise))(function (resolve, reject) {
24
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ };
30
+ var __importDefault = (this && this.__importDefault) || function (mod) {
31
+ return (mod && mod.__esModule) ? mod : { "default": mod };
32
+ };
33
+ Object.defineProperty(exports, "__esModule", { value: true });
34
+ const index_js_1 = __importDefault(require("../../../prompt/index.js"));
35
+ const index_js_2 = require("../../../util_modules/constants/index.js");
36
+ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
37
+ const clientInitAnswer = yield index_js_1.default.ask(index_js_1.default.question('clientFlavour', 'Choose the type of client to initialise: ', {
38
+ type: 'list',
39
+ choices: index_js_2.PLUGIN.client.map((plugin) => {
40
+ return index_js_1.default.choice(plugin + ' web app', {
41
+ value: plugin.toLowerCase(),
42
+ short: plugin.toUpperCase()
43
+ });
44
+ })
45
+ }));
46
+ return (yield Promise.resolve().then(() => __importStar(require('./initializers/' + clientInitAnswer.clientFlavour)))).default();
47
+ });
@@ -0,0 +1,88 @@
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
+ const file_names_js_1 = __importDefault(require("../../../../util_modules/constants/lib/file-names.js"));
16
+ const plugin_js_1 = __importDefault(require("../../../../util_modules/constants/lib/plugin.js"));
17
+ const placeholders_js_1 = __importDefault(require("../../../../util_modules/constants/lib/placeholders.js"));
18
+ const folder_names_js_1 = __importDefault(require("../../../../util_modules/constants/lib/folder-names.js"));
19
+ const client_utils_js_1 = require("../../../../client-utils.js");
20
+ const project_js_1 = require("../../../../util_modules/project.js");
21
+ const shell_js_1 = require("../../../../util_modules/shell.js");
22
+ const runtime_store_js_1 = __importDefault(require("../../../../runtime-store.js"));
23
+ const logger_js_1 = require("../../../../util_modules/logger.js");
24
+ const ansi_colors_1 = require("ansi-colors");
25
+ const client_js_1 = require("../../../util/client.js");
26
+ const path_1 = require("path");
27
+ const global_space_js_1 = __importDefault(require("../../../../util_modules/global-space.js"));
28
+ const index_js_1 = require("../../../../util_modules/fs/index.js");
29
+ const error_js_1 = __importDefault(require("../../../../error.js"));
30
+ const { angular } = plugin_js_1.default;
31
+ const { client } = placeholders_js_1.default;
32
+ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
33
+ const clientName = yield client_utils_js_1.clientUtils.clientNamePrompt('Please provide a name for your Angular App:', 'angular-app');
34
+ const clientDirPath = project_js_1.resolveProjectPath(folder_names_js_1.default.client);
35
+ yield client_utils_js_1.clientUtils.directoryOverridePrompt(clientDirPath);
36
+ const opts = [
37
+ angular.runner_command[1],
38
+ clientName,
39
+ '--directory',
40
+ folder_names_js_1.default.client,
41
+ '--skip-git',
42
+ 'true'
43
+ ];
44
+ const isModuleFound = (yield global_space_js_1.default(angular.plugin, false));
45
+ try {
46
+ const collection = require.resolve(path_1.join(angular.collection_name, 'package.json'));
47
+ yield shell_js_1.spawn(angular.runner_command[0], [...opts, '--collection', path_1.dirname(collection)], {
48
+ stdio: 'inherit',
49
+ cwd: runtime_store_js_1.default.get('cwd'),
50
+ env: {
51
+ CATALYST_ANGULAR_PLUGIN_GLOBAL: isModuleFound ? 'true' : 'false'
52
+ }
53
+ }).ASYNC();
54
+ }
55
+ catch (e) {
56
+ if (e === null) {
57
+ throw new error_js_1.default('Process aborted!', { exit: 0, skipHelp: true });
58
+ }
59
+ const err = error_js_1.default.getErrorInstance(e).original;
60
+ if (!err.code || err.code !== 'ENOENT') {
61
+ throw err;
62
+ }
63
+ logger_js_1.info(`Angular CLI (${ansi_colors_1.red.italic('@angular/cli')}) not found....`);
64
+ logger_js_1.info(`Installing ${ansi_colors_1.bold('@angular/cli')} using ${ansi_colors_1.bold('npx')}`);
65
+ logger_js_1.info('Note: this may take a while...');
66
+ yield shell_js_1.spawn('npx', [
67
+ '-p',
68
+ angular.collection_name,
69
+ '-p',
70
+ angular.runner_package,
71
+ angular.runner_command[0],
72
+ ...opts,
73
+ '--collection',
74
+ angular.collection_name
75
+ ], {
76
+ stdio: 'inherit',
77
+ cwd: runtime_store_js_1.default.get('cwd'),
78
+ env: {
79
+ CATALYST_ANGULAR_PLUGIN_GLOBAL: isModuleFound ? 'true' : 'false'
80
+ }
81
+ }).ASYNC();
82
+ }
83
+ yield index_js_1.ASYNC.findAndReplace(path_1.join(clientDirPath, file_names_js_1.default.client.package_json))(client.package.name, clientName);
84
+ runtime_store_js_1.default.set('payload.client.plugin', isModuleFound
85
+ ? angular.plugin
86
+ : path_1.relative(project_js_1.getProjectRoot(), path_1.join(clientDirPath, 'node_modules', angular.plugin)));
87
+ return client_js_1.fillClientInitPayload(clientDirPath, clientName);
88
+ });
@@ -0,0 +1,27 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const ansi_colors_1 = require("ansi-colors");
13
+ const constants_1 = require("../../../../util_modules/constants");
14
+ const fs_1 = require("../../../../util_modules/fs");
15
+ const logger_1 = require("../../../../util_modules/logger");
16
+ const project_1 = require("../../../../util_modules/project");
17
+ const client_utils_1 = require("../../../../client-utils");
18
+ const client_1 = require("../../../util/client");
19
+ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
20
+ logger_1.message('A directory ' + ansi_colors_1.cyan.bold('client') + ' will be created with a webapp pre-configured.');
21
+ const clientDirPath = project_1.resolveProjectPath(constants_1.FOLDERNAME.client);
22
+ yield client_utils_1.clientUtils.directoryOverridePrompt(clientDirPath);
23
+ yield fs_1.ASYNC.copyDir(constants_1.TEMPLATE.client.basic.new, clientDirPath);
24
+ const clientName = yield client_utils_1.clientUtils.clientNamePrompt('How do you want to address the client ?', 'sampleApp');
25
+ yield fs_1.ASYNC.findAndReplace(clientDirPath)(constants_1.PLACEHOLDER.client.package.name, clientName);
26
+ return client_1.fillClientInitPayload(clientDirPath, clientName);
27
+ });
@@ -0,0 +1,44 @@
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
+ const constants_1 = require("../../../../util_modules/constants");
16
+ const fs_1 = require("../../../../util_modules/fs");
17
+ const project_1 = require("../../../../util_modules/project");
18
+ const runtime_store_1 = __importDefault(require("../../../../runtime-store"));
19
+ const path_1 = require("path");
20
+ const client_utils_1 = require("../../../../client-utils");
21
+ const global_space_1 = __importDefault(require("../../../../util_modules/global-space"));
22
+ const npm_install_1 = __importDefault(require("../../../dependencies/npm-install"));
23
+ const client_1 = require("../../../util/client");
24
+ const { lyte } = constants_1.PLUGIN;
25
+ const { client } = constants_1.PLACEHOLDER;
26
+ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
27
+ const clientName = yield client_utils_1.clientUtils.clientNamePrompt('Please provide a name for your Lyte web app: ', 'lyte-app');
28
+ const clientDirPath = project_1.resolveProjectPath(constants_1.FOLDERNAME.client);
29
+ yield client_utils_1.clientUtils.directoryOverridePrompt(clientDirPath);
30
+ yield fs_1.ASYNC.copyDir(constants_1.TEMPLATE.client.lyte, clientDirPath);
31
+ const isModuleFound = yield global_space_1.default(lyte.plugin);
32
+ yield fs_1.ASYNC.findAndReplace(clientDirPath)([client.package.name, client.package.devDependencies], [
33
+ clientName,
34
+ isModuleFound
35
+ ? ''
36
+ : ',\n "devDependencies": ' +
37
+ JSON.stringify({ [lyte.plugin]: 'latest' }, null, ' ').replace(/\n}/g, '\n }')
38
+ ]);
39
+ yield npm_install_1.default(clientDirPath, true);
40
+ runtime_store_1.default.set('payload.client.plugin', isModuleFound
41
+ ? lyte.plugin
42
+ : path_1.relative(project_1.getProjectRoot(), path_1.join(clientDirPath, 'node_modules', lyte.plugin)));
43
+ return client_1.fillClientInitPayload(clientDirPath, clientName);
44
+ });
@@ -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
+ const constants_1 = require("../../../../util_modules/constants");
16
+ const client_utils_1 = require("../../../../client-utils");
17
+ const project_1 = require("../../../../util_modules/project");
18
+ const shell_1 = require("../../../../util_modules/shell");
19
+ const runtime_store_1 = __importDefault(require("../../../../runtime-store"));
20
+ const fs_1 = require("../../../../util_modules/fs");
21
+ const path_1 = require("path");
22
+ const os_1 = require("os");
23
+ const global_space_1 = __importDefault(require("../../../../util_modules/global-space"));
24
+ const prompt_1 = __importDefault(require("../../../../prompt"));
25
+ const client_1 = require("../../../util/client");
26
+ const { react } = constants_1.PLUGIN;
27
+ const { client } = constants_1.PLACEHOLDER;
28
+ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
29
+ const flavourPrompt = yield prompt_1.default.ask(prompt_1.default.question('flavour', `Choose an option to create the React App:`, {
30
+ type: 'list',
31
+ choices: [
32
+ prompt_1.default.choice('JavaScript', { value: 'js', short: 'JavaScript' }),
33
+ prompt_1.default.choice('TypeScript', { value: 'ts', short: 'TypeScript' })
34
+ ]
35
+ }));
36
+ const clientName = yield client_utils_1.clientUtils.clientNamePrompt('Please provide a name for your React App:', 'react-app');
37
+ const clientDirPath = project_1.resolveProjectPath(clientName);
38
+ yield client_utils_1.clientUtils.directoryOverridePrompt(clientDirPath);
39
+ const catalystTempDir = path_1.join(os_1.tmpdir(), '.catalyst');
40
+ const reactPluginDir = path_1.join(catalystTempDir, 'react');
41
+ yield fs_1.ASYNC.emptyDir(reactPluginDir);
42
+ yield fs_1.ASYNC.copyDir(flavourPrompt.flavour === 'ts' ? constants_1.TEMPLATE.client.react.ts : constants_1.TEMPLATE.client.react.js, reactPluginDir);
43
+ const isModuleFound = yield global_space_1.default(react.plugin);
44
+ yield fs_1.ASYNC.findAndReplace(path_1.join(reactPluginDir))([client.package.name, client.package.devDependencies], [clientName, isModuleFound ? '' : `, "devDependencies": { "${react.plugin}": "latest" }`]);
45
+ yield shell_1.spawn('npx', [react.runner_command[0], clientName, '--template', 'file:' + reactPluginDir], {
46
+ stdio: 'inherit',
47
+ cwd: runtime_store_1.default.get('cwd')
48
+ }).ASYNC();
49
+ runtime_store_1.default.set('payload.client.plugin', isModuleFound
50
+ ? react.plugin
51
+ : path_1.relative(project_1.getProjectRoot(), path_1.join(clientDirPath, 'node_modules', react.plugin)));
52
+ return client_1.fillClientInitPayload(clientDirPath, clientName);
53
+ });
@@ -24,6 +24,7 @@ const js_1 = require("../../../../util_modules/js");
24
24
  const integ_1 = require("../../../../fn-utils/lib/integ");
25
25
  const common_1 = require("../../../../fn-utils/lib/common");
26
26
  const runtime_1 = __importDefault(require("../../../../util_modules/constants/lib/runtime"));
27
+ const functions_1 = require("../../../util/functions");
27
28
  exports.default = (stack) => () => __awaiter(void 0, void 0, void 0, function* () {
28
29
  const fnType = runtime_store_1.default.get('context.functions.type');
29
30
  const fnDirPath = path_1.join(runtime_store_1.default.get('context.functions.dir_path'));
@@ -85,9 +86,5 @@ exports.default = (stack) => () => __awaiter(void 0, void 0, void 0, function* (
85
86
  const userFnClassPath = path_1.join(fnDirPath, functionAns.name, constants_1.FILENAME.functions.java_classpath);
86
87
  const userFnLibPath = path_1.join(fnDirPath, functionAns.name, constants_1.FOLDERNAME.java_fn_lib);
87
88
  yield fn_utils_1.fnUtils.java.rewriteClasspath(userFnClassPath, userFnLibPath);
88
- runtime_store_1.default.set('payload.functions.source', targetPath);
89
- runtime_store_1.default.set('payload.functions.stack', stack);
90
- runtime_store_1.default.set('payload.functions.name', functionAns.name);
91
- runtime_store_1.default.set('payload.functions.class', functionAns.class);
92
- runtime_store_1.default.set('payload.functions.type', fnType);
89
+ return functions_1.fillFunctionsInitPayload(targetPath, functionAns.name, stack, fnType);
93
90
  });
@@ -25,6 +25,7 @@ const logger_1 = require("../../../../util_modules/logger");
25
25
  const js_1 = require("../../../../util_modules/js");
26
26
  const integ_1 = require("../../../../fn-utils/lib/integ");
27
27
  const runtime_1 = __importDefault(require("../../../../util_modules/constants/lib/runtime"));
28
+ const functions_1 = require("../../../util/functions");
28
29
  exports.default = (stack) => () => __awaiter(void 0, void 0, void 0, function* () {
29
30
  const fnType = runtime_store_1.default.get('context.functions.type');
30
31
  const service = runtime_store_1.default.get('context.functions.integration.service', '');
@@ -69,10 +70,8 @@ exports.default = (stack) => () => __awaiter(void 0, void 0, void 0, function* (
69
70
  type: fnType,
70
71
  integ_config
71
72
  });
72
- yield npm_install_1.default(targetPath);
73
- runtime_store_1.default.set('payload.functions.source', targetPath);
74
- runtime_store_1.default.set('payload.functions.stack', stack);
75
- runtime_store_1.default.set('payload.functions.name', finalJson.name);
76
- runtime_store_1.default.set('payload.functions.main', finalJson.main);
77
- runtime_store_1.default.set('payload.functions.type', fnType);
73
+ fnType === constants_1.FN_TYPE.integration
74
+ ? yield npm_install_1.default(targetPath, true)
75
+ : yield npm_install_1.default(targetPath);
76
+ return functions_1.fillFunctionsInitPayload(targetPath, finalJson.name, stack, fnType);
78
77
  });