zcatalyst-cli 1.18.0-beta.8 → 1.18.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 (145) hide show
  1. package/README.md +11 -6
  2. package/docs/commands/slate/unlink.toml +9 -0
  3. package/docs/endpoints/lib/env.toml +3 -1
  4. package/docs/endpoints/lib/slate.toml +3 -0
  5. package/docs/serve/server/lib/slate/index.toml +14 -0
  6. package/docs/slate-utils.toml +4 -0
  7. package/docs/util_modules/config/lib/slate.toml +4 -0
  8. package/lib/archiver.js +18 -9
  9. package/lib/authentication/login.js +6 -5
  10. package/lib/code-deck.js +5 -6
  11. package/lib/command_needs/auth.js +1 -1
  12. package/lib/command_needs/rc.js +40 -3
  13. package/lib/commands/codelib/install.js +1 -0
  14. package/lib/commands/deploy/index.js +4 -0
  15. package/lib/commands/deploy/slate.js +58 -0
  16. package/lib/commands/index.js +2 -3
  17. package/lib/commands/init.js +0 -10
  18. package/lib/commands/slate/create.js +59 -0
  19. package/lib/commands/slate/link.js +59 -0
  20. package/lib/commands/slate/unlink.js +75 -0
  21. package/lib/commands/zest/generate/index.js +1 -6
  22. package/lib/config-store.js +2 -1
  23. package/lib/deploy/features/index.js +3 -0
  24. package/lib/deploy/features/slate.js +123 -0
  25. package/lib/endpoints/index.js +8 -1
  26. package/lib/endpoints/lib/env.js +2 -1
  27. package/lib/endpoints/lib/sdk.js +2 -2
  28. package/lib/endpoints/lib/slate.js +107 -0
  29. package/lib/fn-utils/lib/common.js +1 -1
  30. package/lib/iac/status/deploy.js +1 -5
  31. package/lib/index.js +1 -1
  32. package/lib/init/features/appsail/index.js +2 -3
  33. package/lib/init/features/index.js +13 -1
  34. package/lib/init/features/project.js +1 -1
  35. package/lib/init/features/slate/index.js +313 -0
  36. package/lib/internal/api.js +1 -1
  37. package/lib/internal/command.js +10 -6
  38. package/lib/port-resolver.js +7 -0
  39. package/lib/prompt/index.js +22 -6
  40. package/lib/prompt/types/file-path.js +10 -7
  41. package/lib/serve/features/index.js +8 -1
  42. package/lib/serve/features/slate.js +47 -0
  43. package/lib/serve/server/index.js +61 -1
  44. package/lib/serve/server/lib/appsail/index.js +2 -2
  45. package/lib/serve/server/lib/java/aio_server/lib/catalyst-cli-java-runtime-1.0.0.jar +0 -0
  46. package/lib/serve/server/lib/java/aio_server/lib/{catalyst-function-sdk-1.0.0.jar → catalyst-function-sdk-1.1.0.jar} +0 -0
  47. package/lib/serve/server/lib/java/aio_server/lib/catalyst-java-runtime-1.0.0.jar +0 -0
  48. package/lib/serve/server/lib/java/index.js +1 -1
  49. package/lib/serve/server/lib/master/index.js +25 -21
  50. package/lib/serve/server/lib/master/slate.js +45 -0
  51. package/lib/serve/server/lib/master/unknown-req-proxy.js +1 -1
  52. package/lib/serve/server/lib/master/utils.js +9 -3
  53. package/lib/serve/server/lib/node/index.js +1 -1
  54. package/lib/serve/server/lib/python/index.js +1 -1
  55. package/lib/serve/server/lib/slate/index.js +115 -0
  56. package/lib/serve/server/lib/slate/static-server.js +194 -0
  57. package/lib/serve/server/lib/web_client/server.js +2 -1
  58. package/lib/shell/dependencies/http-functions.js +1 -1
  59. package/lib/shell/dependencies/invoker/bio/java/lib/{catalyst-function-sdk-1.0.0.jar → catalyst-function-sdk-1.1.0.jar} +0 -0
  60. package/lib/shell/dependencies/invoker/cron/java/lib/{catalyst-function-sdk-1.0.0.jar → catalyst-function-sdk-1.1.0.jar} +0 -0
  61. package/lib/shell/dependencies/invoker/event/java/lib/{catalyst-function-sdk-1.0.0.jar → catalyst-function-sdk-1.1.0.jar} +0 -0
  62. package/lib/shell/dependencies/invoker/integ/java/lib/catalyst-function-sdk-1.1.0.jar +0 -0
  63. package/lib/shell/dependencies/invoker/job/java/lib/catalyst-function-sdk-1.1.0.jar +0 -0
  64. package/lib/shell/dependencies/local-function.js +3 -3
  65. package/lib/slate-utils.js +212 -0
  66. package/lib/util_modules/config/index.js +3 -1
  67. package/lib/util_modules/config/lib/slate.js +98 -0
  68. package/lib/util_modules/constants/lib/cliq-handlers.js +18 -10
  69. package/lib/util_modules/constants/lib/dc-type.js +8 -0
  70. package/lib/util_modules/constants/lib/default.js +4 -0
  71. package/lib/util_modules/constants/lib/file-names.js +7 -1
  72. package/lib/util_modules/constants/lib/folder-names.js +1 -0
  73. package/lib/util_modules/constants/lib/placeholders.js +2 -1
  74. package/lib/util_modules/constants/lib/scopes.js +1 -6
  75. package/lib/util_modules/context-help.js +2 -2
  76. package/lib/util_modules/fs/lib/async.js +14 -3
  77. package/lib/util_modules/fs/lib/sync.js +6 -1
  78. package/lib/util_modules/parser/toml.js +20 -5
  79. package/package.json +3 -3
  80. package/templates/event/integ/cliq/bot/action_handler.json +13 -4
  81. package/templates/event/integ/cliq/bot/call_handler.json +41 -0
  82. package/templates/event/integ/cliq/bot/context_handler.json +11 -3
  83. package/templates/event/integ/cliq/bot/incomingwebhook_handler.json +11 -3
  84. package/templates/event/integ/cliq/bot/mention_handler.json +12 -4
  85. package/templates/event/integ/cliq/bot/message_handler.json +13 -4
  86. package/templates/event/integ/cliq/bot/participation_handler.json +13 -3
  87. package/templates/event/integ/cliq/bot/welcome_handler.json +12 -8
  88. package/templates/event/integ/cliq/command/execution_handler.json +12 -3
  89. package/templates/event/integ/cliq/command/suggestion_handler.json +18 -4
  90. package/templates/event/integ/cliq/{installation → extension}/installation_handler.json +13 -4
  91. package/templates/event/integ/cliq/{installation → extension}/installation_validator.json +13 -5
  92. package/templates/event/integ/cliq/extension/uninstallation_handler.json +37 -0
  93. package/templates/event/integ/cliq/function/button_handler.json +13 -5
  94. package/templates/event/integ/cliq/function/form_change_handler.json +9 -3
  95. package/templates/event/integ/cliq/function/form_handler.json +11 -3
  96. package/templates/event/integ/cliq/function/form_values_handler.json +9 -3
  97. package/templates/event/integ/cliq/function/form_view_handler.json +26 -0
  98. package/templates/event/integ/cliq/function/widget_button_handler.json +14 -5
  99. package/templates/event/integ/cliq/link_preview/action_handler.json +54 -0
  100. package/templates/event/integ/cliq/link_preview/after_send_handler.json +47 -0
  101. package/templates/event/integ/cliq/link_preview/menu_handler.json +47 -0
  102. package/templates/event/integ/cliq/link_preview/preview_handler.json +47 -0
  103. package/templates/event/integ/cliq/messageaction/execution_handler.json +11 -3
  104. package/templates/event/integ/cliq/widget/view_handler.json +12 -4
  105. package/templates/init/client/react/react_js/template/src/index.js +3 -3
  106. package/templates/init/client/react/react_ts/template/src/index.tsx +3 -3
  107. package/templates/init/client/react/react_ts/template.json +3 -3
  108. package/templates/init/functions/java/event/sample.java +4 -0
  109. package/templates/init/functions/java/integ/cliq/com/handlers/BotHandler.java +29 -23
  110. package/templates/init/functions/java/integ/cliq/com/handlers/CommandHandler.java +14 -17
  111. package/templates/init/functions/java/integ/cliq/com/handlers/ExtensionHandler.java +41 -0
  112. package/templates/init/functions/java/integ/cliq/com/handlers/FunctionHandler.java +74 -22
  113. package/templates/init/functions/java/integ/cliq/com/handlers/LinkPreviewHandler.java +108 -0
  114. package/templates/init/functions/java/integ/cliq/com/handlers/MessageActionHandler.java +6 -8
  115. package/templates/init/functions/java/integ/cliq/sample.java +10 -0
  116. package/templates/init/functions/node/aio/package.json +1 -1
  117. package/templates/init/functions/node/bio/package.json +1 -1
  118. package/templates/init/functions/node/cron/package.json +1 -1
  119. package/templates/init/functions/node/event/package.json +1 -1
  120. package/templates/init/functions/node/event/sample.js +1 -0
  121. package/templates/init/functions/node/event/types/event.d.ts +7 -0
  122. package/templates/init/functions/node/integ/cliq/handlers/bot-handler.js +4 -0
  123. package/templates/init/functions/node/integ/cliq/handlers/command-handler.js +3 -5
  124. package/templates/init/functions/node/integ/cliq/handlers/{installation-validator.js → extension-handler.js} +20 -3
  125. package/templates/init/functions/node/integ/cliq/handlers/function-handler.js +42 -0
  126. package/templates/init/functions/node/integ/cliq/handlers/link-preview-handler.js +73 -0
  127. package/templates/init/functions/node/integ/cliq/package.json +1 -1
  128. package/templates/init/functions/node/integ/convokraft/package.json +1 -1
  129. package/templates/init/functions/node/job/package.json +1 -1
  130. package/templates/init/functions/python/event/sample.py +9 -5
  131. package/templates/init/functions/python/integ/cliq/handlers/bot_handler.py +13 -3
  132. package/templates/init/functions/python/integ/cliq/handlers/command_handler.py +7 -7
  133. package/templates/init/functions/python/integ/cliq/handlers/extension_handler.py +25 -0
  134. package/templates/init/functions/python/integ/cliq/handlers/function_handler.py +54 -10
  135. package/templates/init/functions/python/integ/cliq/handlers/link_preview_handler.py +76 -0
  136. package/templates/init/functions/python/integ/cliq/handlers/widget_handler.py +10 -9
  137. package/templates/init/functions/python/integ/cliq/sample.py +2 -2
  138. package/templates/init.txt +2 -1
  139. package/lib/shell/dependencies/invoker/integ/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  140. package/lib/shell/dependencies/invoker/job/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  141. package/templates/init/functions/java/integ/cliq/com/handlers/InstallationHandler.java +0 -20
  142. package/templates/init/functions/java/integ/cliq/com/handlers/InstallationValidator.java +0 -22
  143. package/templates/init/functions/node/integ/cliq/handlers/installation-handler.js +0 -15
  144. package/templates/init/functions/python/integ/cliq/handlers/installation_handler.py +0 -12
  145. package/templates/init/functions/python/integ/cliq/handlers/installation_validator.py +0 -16
@@ -118,12 +118,7 @@ function downloadSourceCode(fileId, outputDir, srcType, srcName) {
118
118
  }
119
119
  exports.default = new command_1.default('zest:generate')
120
120
  .description('Generate the functions or appsail source code for your ZEST Specifications')
121
- .needs('auth', [
122
- constants_1.SCOPE.zest_spec_all,
123
- constants_1.SCOPE.zest_schedule_job_read,
124
- constants_1.SCOPE.zest_spec_all,
125
- constants_1.SCOPE.zest_spec_src_action
126
- ])
121
+ .needs('auth', [])
127
122
  .needs('config', { optional: true })
128
123
  .needs('rc', { skipOrgCheck: false })
129
124
  .action(() => __awaiter(void 0, void 0, void 0, function* () {
@@ -6,4 +6,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const conf_1 = __importDefault(require("conf"));
7
7
  const runtime_store_1 = __importDefault(require("./runtime-store"));
8
8
  const name = runtime_store_1.default.get('context.cli.package.name');
9
- exports.default = new conf_1.default({ configName: name, projectName: name });
9
+ const path = process.env['X_ZC_CREDENTIAL_PATH'];
10
+ exports.default = new conf_1.default({ configName: name, projectName: name, cwd: path });
@@ -39,6 +39,9 @@ exports.default = {
39
39
  client: () => __awaiter(void 0, void 0, void 0, function* () {
40
40
  return (yield Promise.resolve().then(() => __importStar(require('./client')))).default();
41
41
  }),
42
+ slate: () => __awaiter(void 0, void 0, void 0, function* () {
43
+ return (yield Promise.resolve().then(() => __importStar(require('./slate')))).default();
44
+ }),
42
45
  apig: () => __awaiter(void 0, void 0, void 0, function* () {
43
46
  return (yield Promise.resolve().then(() => __importStar(require('./apig')))).default();
44
47
  }),
@@ -0,0 +1,123 @@
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.slateLogger = exports.getEnvironmentType = void 0;
16
+ const slate_utils_1 = require("../../slate-utils");
17
+ const endpoints_1 = require("../../endpoints");
18
+ const runtime_store_1 = __importDefault(require("../../runtime-store"));
19
+ const error_1 = __importDefault(require("../../error"));
20
+ const config_1 = require("../../util_modules/config");
21
+ const throbber_1 = __importDefault(require("../../throbber"));
22
+ const logger_1 = require("../../util_modules/logger");
23
+ const ansi_colors_1 = require("ansi-colors");
24
+ const option_1 = require("../../util_modules/option");
25
+ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
26
+ const dId = process.env.ZC_APP_DEPLOYMENT_BUILD_ID;
27
+ const env = getEnvironmentType();
28
+ if (!dId) {
29
+ const targets = yield config_1.slateConfig.getAllTargetDetails(false);
30
+ if (!targets || targets.length === 0) {
31
+ throw new error_1.default('No targets found');
32
+ }
33
+ const filtered = slate_utils_1.slateUtils.filterTargets(targets);
34
+ const validTargets = filtered.filter((targ) => {
35
+ var _a, _b;
36
+ if ((_a = targ.validity) === null || _a === void 0 ? void 0 : _a.valid) {
37
+ return targ;
38
+ }
39
+ (0, logger_1.labeled)('Slate: ', 'Invalid Slate service ' + (0, ansi_colors_1.bold)(targ.name || 'Unknown')).ERROR();
40
+ (0, logger_1.error)('Reason: ' + ((_b = targ.validity) === null || _b === void 0 ? void 0 : _b.reason));
41
+ (0, logger_1.info)();
42
+ return false;
43
+ });
44
+ if (validTargets.length === 0) {
45
+ throw new error_1.default('No valid Slate services found to deploy', {
46
+ skipHelp: true
47
+ });
48
+ }
49
+ const slateAppConfigs = yield (yield (0, endpoints_1.slateAPI)({ env })).getAllApps();
50
+ const throbber = throbber_1.default.getInstance();
51
+ const deployRes = yield validTargets.reduce((result, _targ) => __awaiter(void 0, void 0, void 0, function* () {
52
+ var _a;
53
+ const targ = _targ;
54
+ const prevRes = yield result;
55
+ try {
56
+ const throbberName = `prepare_slate_${targ.name}`;
57
+ throbber.add(throbberName, {
58
+ text: `Preparing Slate[${targ.name}]`
59
+ });
60
+ const isAppExists = slateAppConfigs.find((app) => app.name === targ.name);
61
+ const configDetails = !isAppExists
62
+ ? (_a = (yield config_1.slateConfig.getTargetDetails(targ))) === null || _a === void 0 ? void 0 : _a.config
63
+ : undefined;
64
+ const readStream = yield slate_utils_1.slateUtils.pack(targ.source);
65
+ throbber.remove(throbberName);
66
+ yield (yield (0, endpoints_1.slateAPI)({ env })).deploy(readStream.stream, readStream.length, targ.name, '', isAppExists === null || isAppExists === void 0 ? void 0 : isAppExists.id, configDetails ? JSON.stringify(configDetails) : '', (0, option_1.getOptionValue)('m') || '');
67
+ }
68
+ catch (err) {
69
+ (0, logger_1.debug)(err);
70
+ _targ.validity = {
71
+ valid: false,
72
+ reason: error_1.default.getErrorInstance(err).message
73
+ };
74
+ }
75
+ prevRes.push(_targ);
76
+ return Promise.resolve(prevRes);
77
+ }), Promise.resolve([]));
78
+ const deployedValidTargets = deployRes.filter((targ) => {
79
+ var _a, _b, _c;
80
+ if (!((_a = targ.validity) === null || _a === void 0 ? void 0 : _a.valid)) {
81
+ (0, logger_1.warning)('Deploy of Slate [' +
82
+ targ.name +
83
+ '] was unsuccessful since ' +
84
+ ((_b = targ.validity) === null || _b === void 0 ? void 0 : _b.reason));
85
+ }
86
+ return (_c = targ.validity) === null || _c === void 0 ? void 0 : _c.valid;
87
+ });
88
+ runtime_store_1.default.set('payload.slate.targets', deployedValidTargets);
89
+ if (deployedValidTargets.length > 0) {
90
+ runtime_store_1.default.set('payload.slate.deploy', true);
91
+ }
92
+ }
93
+ else {
94
+ const source = runtime_store_1.default.get('cwd');
95
+ yield slate_utils_1.slateUtils.validate(source);
96
+ const readStream = yield slate_utils_1.slateUtils.pack();
97
+ try {
98
+ const deployRes = yield (yield (0, endpoints_1.slateAPI)({ env })).deploy(readStream.stream, readStream.length, process.env.ZC_APP_NAME, dId);
99
+ deployRes.name = process.env.ZC_APP_NAME;
100
+ runtime_store_1.default.set('payload.slate.targets', [deployRes]);
101
+ runtime_store_1.default.set('payload.slate.deploy', true);
102
+ }
103
+ catch (err) {
104
+ throw err;
105
+ }
106
+ }
107
+ });
108
+ function getEnvironmentType() {
109
+ var _a;
110
+ const isProduction = (0, option_1.getOptionValue)('production', false) ||
111
+ ((_a = process.env.ZC_ENVIRONMENT) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'production';
112
+ return isProduction ? 'Production' : 'Development';
113
+ }
114
+ exports.getEnvironmentType = getEnvironmentType;
115
+ function slateLogger() {
116
+ const deployTargets = runtime_store_1.default.get('payload.slate.targets', []);
117
+ deployTargets.forEach((slate) => {
118
+ (0, logger_1.labeled)(`Slate(${slate.name})`, 'deploy successful').SUCCESS();
119
+ (0, logger_1.info)();
120
+ });
121
+ return deployTargets;
122
+ }
123
+ exports.slateLogger = slateLogger;
@@ -32,7 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
32
32
  });
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.tunnelAPI = exports.commonAPI = exports.jobScheduling = exports.codeDeck = exports.gitHubAPI = exports.stratusAPI = exports.zestAPI = exports.appSailAPI = exports.logAPI = exports.eventBusAPI = exports.functionsAPI = exports.applogicAPI = exports.bulkDSAPI = exports.apigAPI = exports.clientAPI = exports.datastoreAPI = exports.zcqlAPI = exports.queueAPI = exports.filestoreAPI = exports.cacheAPI = exports.sdkAPI = exports.envAPI = exports.projectAPI = exports.orgAPI = void 0;
35
+ exports.tunnelAPI = exports.commonAPI = exports.jobScheduling = exports.codeDeck = exports.gitHubAPI = exports.stratusAPI = exports.zestAPI = exports.appSailAPI = exports.logAPI = exports.eventBusAPI = exports.functionsAPI = exports.applogicAPI = exports.bulkDSAPI = exports.apigAPI = exports.slateAPI = exports.clientAPI = exports.datastoreAPI = exports.zcqlAPI = exports.queueAPI = exports.filestoreAPI = exports.cacheAPI = exports.sdkAPI = exports.envAPI = exports.projectAPI = exports.orgAPI = void 0;
36
36
  const project_1 = require("../util_modules/project");
37
37
  function orgAPI({ auth = true } = {}) {
38
38
  return __awaiter(this, void 0, void 0, function* () {
@@ -104,6 +104,13 @@ function clientAPI({ auth = true, projectId = (0, project_1.getProjectId)(), env
104
104
  });
105
105
  }
106
106
  exports.clientAPI = clientAPI;
107
+ function slateAPI({ auth = true, projectId = (0, project_1.getProjectId)(), env = (0, project_1.getEnvName)() } = {}) {
108
+ return __awaiter(this, void 0, void 0, function* () {
109
+ const slate = (yield Promise.resolve().then(() => __importStar(require('./lib/slate')))).default;
110
+ return new slate(projectId, { authNeeded: auth, env });
111
+ });
112
+ }
113
+ exports.slateAPI = slateAPI;
107
114
  function apigAPI({ auth = true, projectId = (0, project_1.getProjectId)(), env = (0, project_1.getEnvName)() } = {}) {
108
115
  return __awaiter(this, void 0, void 0, function* () {
109
116
  const apig = (yield Promise.resolve().then(() => __importStar(require('./lib/apig')))).default;
@@ -37,7 +37,8 @@ class Env {
37
37
  (0, ansi_colors_1.bold)(constants_1.DEFAULT.env_name),
38
38
  (0, ansi_colors_1.bold)(projectId),
39
39
  ansi_colors_1.bold.red('blocked'),
40
- ansi_colors_1.italic.underline('support@zohocatalyst.com')
40
+ ansi_colors_1.italic.underline('support@zohocatalyst.com'),
41
+ ansi_colors_1.italic.red(JSON.stringify(devEnv.blocked_reason) || 'Unknown')
41
42
  ]
42
43
  });
43
44
  }
@@ -29,10 +29,10 @@ class SDK {
29
29
  if (service === constants_1.INTEG.services.cliq) {
30
30
  return `/downloads/sdk/java/${constants_1.INTEG.service_map[service]}/${constants_1.INTEG.java_dependencies[service]}_latest.zip`;
31
31
  }
32
- return '/downloads/sdk/java/catalyst_java_sdk_beta.zip';
32
+ return '/downloads/sdk/java/catalyst_java_sdk_latest.zip';
33
33
  }
34
34
  default: {
35
- return '/downloads/sdk/java/catalyst_java_sdk_beta.zip';
35
+ return '/downloads/sdk/java/catalyst_java_sdk_latest.zip';
36
36
  }
37
37
  }
38
38
  }
@@ -0,0 +1,107 @@
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 error_1 = __importDefault(require("../../error"));
16
+ const api_1 = __importDefault(require("../../internal/api"));
17
+ const logger_1 = require("../../util_modules/logger");
18
+ const ansi_colors_1 = require("ansi-colors");
19
+ const config_store_1 = __importDefault(require("../../config-store"));
20
+ class Slate {
21
+ constructor(projectId, opts) {
22
+ this.opts = opts;
23
+ this.projectId = projectId;
24
+ }
25
+ getFrameworks() {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ try {
28
+ const response = yield new api_1.default(this.opts).get('/slate/v1/frameworks', {
29
+ log: {
30
+ awaitingSpinner: 'Fetching frameworks from the server ...'
31
+ }
32
+ });
33
+ if (response.body && response.body.data) {
34
+ return response.body.data;
35
+ }
36
+ }
37
+ catch (err) {
38
+ if (err.status === 404) {
39
+ throw new error_1.default('API Error: Slate not accessible', {
40
+ exit: 1,
41
+ errorId: 'SLDC-1',
42
+ arg: [(0, ansi_colors_1.bold)(config_store_1.default.get('active_dc') + ''), (0, ansi_colors_1.bold)('support@zohocatalyst.com')]
43
+ });
44
+ }
45
+ else {
46
+ throw err;
47
+ }
48
+ }
49
+ throw new error_1.default('Error while fetching the frameworks', { exit: 2 });
50
+ });
51
+ }
52
+ getAllApps() {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ const response = yield new api_1.default(this.opts).get(`/slate/v1/project/${this.projectId}/app`, {
55
+ log: {
56
+ awaitingSpinner: 'Fetching slate apps'
57
+ }
58
+ });
59
+ if (response.body && response.body.data) {
60
+ return response.body.data;
61
+ }
62
+ throw new error_1.default('Error while fetching the frameworks', { exit: 2 });
63
+ });
64
+ }
65
+ downloadTemplate() {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ this.opts.origin = 'https://codeload.github.com';
68
+ this.opts.authNeeded = false;
69
+ const response = yield new api_1.default(Object.assign(Object.assign({}, this.opts), { isExternal: true })).get(`/catalystbyzoho/slate/zip/main`, {
70
+ log: {
71
+ awaitingSpinner: 'Download template from github ...'
72
+ },
73
+ encoding: null
74
+ });
75
+ if (response.body) {
76
+ return response.body;
77
+ }
78
+ throw new error_1.default('Error while downloading the template', { exit: 2 });
79
+ });
80
+ }
81
+ deploy(sourceStream, contentLength, appName, deployId, appId, config, msg) {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ const formData = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ file: sourceStream }, (appId && { app_id: appId })), (deployId && { build_id: deployId })), (appId || deployId ? {} : { name: appName })), (config && { configuration: config })), (msg && { message: msg }));
84
+ const res = yield new api_1.default(this.opts).post(`/slate/v1/project/${this.projectId}/app/upload`, {
85
+ formData,
86
+ json: false,
87
+ log: {
88
+ uploadProgress: {
89
+ title: `Slate[${appName}]`,
90
+ total: contentLength,
91
+ progressType: 'upload'
92
+ },
93
+ stream: sourceStream,
94
+ awaitingSpinner: 'deploying slate'
95
+ }
96
+ });
97
+ if (res.body && res.body.data) {
98
+ return res.body.data;
99
+ }
100
+ (0, logger_1.debug)('deploy slate response from server : ' + res.body);
101
+ throw new error_1.default('Server Error: Unexpected Response from server.', {
102
+ exit: 2
103
+ });
104
+ });
105
+ }
106
+ }
107
+ exports.default = Slate;
@@ -506,7 +506,7 @@ function getSDK(fnType, dest, stack, options = {}) {
506
506
  }
507
507
  yield new archiver_1.default()
508
508
  .load(sdkZip)
509
- .extract(dest, new RegExp(`catalyst-${stack}`), { ignoreInitial: true })
509
+ .extract(dest, new RegExp(`catalyst-${stack}`), { ignoreLevel: 1 })
510
510
  .finalize();
511
511
  });
512
512
  }
@@ -19,7 +19,6 @@ const error_1 = __importDefault(require("../../error"));
19
19
  const throbber_1 = __importDefault(require("../../throbber"));
20
20
  const logger_1 = require("../../util_modules/logger");
21
21
  const util_1 = require("./util");
22
- const env_1 = require("../../util_modules/env");
23
22
  const ansi_colors_1 = require("ansi-colors");
24
23
  const code_deck_1 = require("../../code-deck");
25
24
  exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
@@ -76,10 +75,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
76
75
  timerAPI.on('error', (e) => {
77
76
  (0, logger_1.debug)('Error encountered : ', e);
78
77
  });
79
- timerAPI.on('end', (_error, data) => {
80
- if (data === true && !(0, env_1.isPrimaryShell)() && process.send) {
81
- process.send('success');
82
- }
78
+ timerAPI.on('end', () => {
83
79
  throbber.stopAll();
84
80
  });
85
81
  process.env.PARENT_COMMAND === 'codedeck' &&
package/lib/index.js CHANGED
@@ -23,6 +23,6 @@ program.helpOption('-h, --help', 'Display help for a Catalyst command');
23
23
  program.showSuggestionAfterError();
24
24
  program.showHelpAfterError(`For more usage information use the ${(0, ansi_colors_1.bold)('catalyst help')} command`);
25
25
  program.addHelpText('before', fs_1.SYNC.readFile(constants_1.TEMPLATE.banner, 'utf-8') || '');
26
- program.addHelpText('afterAll', `\nFor detailed documentations please visit ${(0, ansi_colors_1.underline)('https://www.zoho.com/catalyst/help/cli-command-reference.html')}`);
26
+ program.addHelpText('afterAll', `\nFor detailed documentations please visit ${(0, ansi_colors_1.underline)('https://docs.catalyst.zoho.com/en/cli/v1/cli-command-reference/')}`);
27
27
  const cli = new client_1.Client(program);
28
28
  exports.default = cli;
@@ -97,7 +97,7 @@ function getAppSailZip() {
97
97
  zip.load(code);
98
98
  zip.extract(repoDir, '/', {
99
99
  isFolder: true,
100
- ignoreInitial: true
100
+ ignoreLevel: 1
101
101
  });
102
102
  yield zip.finalize();
103
103
  (0, logger_1.success)(`Successfully downloaded the code to ${ansi_colors_1.bold.green(gitRepo.repo.source)}`);
@@ -196,8 +196,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
196
196
  stack: appSailStack.runtime,
197
197
  env_variables: {},
198
198
  memory: _appSailConfig.memory || 256,
199
- scripts: _appSailConfig.scripts || {},
200
- raw: {}
199
+ scripts: _appSailConfig.scripts || {}
201
200
  };
202
201
  if (appSailStack.lang === 'java') {
203
202
  const platform = yield prompt_1.default.ask(prompt_1.default.question('value', 'Please choose a platform for your AppSail: ', {
@@ -35,7 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
35
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
36
  };
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.appsail = exports.project = exports.client = exports.functions = exports.setCatalystConfig = void 0;
38
+ exports.appsail = exports.project = exports.slate = exports.client = exports.functions = exports.setCatalystConfig = void 0;
39
39
  const ansi_colors_1 = require("ansi-colors");
40
40
  const path_1 = require("path");
41
41
  const error_1 = __importDefault(require("../../error"));
@@ -118,6 +118,11 @@ function setCatalystConfig(featureName, add) {
118
118
  config.unset('client.plugin');
119
119
  }
120
120
  break;
121
+ case 'slate': {
122
+ const targetArr = config.get('slate', []);
123
+ config.set('slate', js_1.JS.uniq(targetArr.concat([context])));
124
+ break;
125
+ }
121
126
  case 'apig':
122
127
  config.set('apig.rules', targetSource);
123
128
  config.set('apig.enabled', true);
@@ -140,6 +145,13 @@ function client() {
140
145
  });
141
146
  }
142
147
  exports.client = client;
148
+ function slate(add = false) {
149
+ return __awaiter(this, void 0, void 0, function* () {
150
+ yield (yield Promise.resolve().then(() => __importStar(require('./slate/index.js')))).default(add);
151
+ setCatalystConfig('slate', false);
152
+ });
153
+ }
154
+ exports.slate = slate;
143
155
  function project() {
144
156
  return __awaiter(this, void 0, void 0, function* () {
145
157
  yield (yield Promise.resolve().then(() => __importStar(require('./project.js')))).default();
@@ -103,7 +103,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
103
103
  }
104
104
  const [zipArchive, template, importRes] = yield (0, import_1.iacImport)();
105
105
  yield zipArchive
106
- .extract(runtime_store_1.default.get('cwd'), '/', { recursive: true, ignoreInitial: false })
106
+ .extract(runtime_store_1.default.get('cwd'), '/', { recursive: true, ignoreLevel: 0 })
107
107
  .finalize();
108
108
  const parsedJSON = js_1.JS.parseJSON(template);
109
109
  const templateJson = parsedJSON ? parsedJSON : (0, yaml_1.parse)(template);