zcatalyst-cli 1.18.0-beta.9 → 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 (129) 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 +1 -1
  45. package/lib/serve/server/lib/master/index.js +25 -21
  46. package/lib/serve/server/lib/master/slate.js +45 -0
  47. package/lib/serve/server/lib/master/utils.js +9 -3
  48. package/lib/serve/server/lib/slate/index.js +115 -0
  49. package/lib/serve/server/lib/slate/static-server.js +194 -0
  50. package/lib/serve/server/lib/web_client/server.js +2 -1
  51. package/lib/slate-utils.js +212 -0
  52. package/lib/util_modules/config/index.js +3 -1
  53. package/lib/util_modules/config/lib/slate.js +98 -0
  54. package/lib/util_modules/constants/lib/cliq-handlers.js +18 -10
  55. package/lib/util_modules/constants/lib/dc-type.js +8 -0
  56. package/lib/util_modules/constants/lib/default.js +4 -0
  57. package/lib/util_modules/constants/lib/file-names.js +7 -1
  58. package/lib/util_modules/constants/lib/folder-names.js +1 -0
  59. package/lib/util_modules/constants/lib/placeholders.js +2 -1
  60. package/lib/util_modules/constants/lib/scopes.js +1 -6
  61. package/lib/util_modules/context-help.js +2 -2
  62. package/lib/util_modules/fs/lib/async.js +14 -3
  63. package/lib/util_modules/fs/lib/sync.js +6 -1
  64. package/lib/util_modules/parser/toml.js +20 -5
  65. package/package.json +3 -3
  66. package/templates/event/integ/cliq/bot/action_handler.json +13 -4
  67. package/templates/event/integ/cliq/bot/call_handler.json +41 -0
  68. package/templates/event/integ/cliq/bot/context_handler.json +11 -3
  69. package/templates/event/integ/cliq/bot/incomingwebhook_handler.json +11 -3
  70. package/templates/event/integ/cliq/bot/mention_handler.json +12 -4
  71. package/templates/event/integ/cliq/bot/message_handler.json +13 -4
  72. package/templates/event/integ/cliq/bot/participation_handler.json +13 -3
  73. package/templates/event/integ/cliq/bot/welcome_handler.json +12 -8
  74. package/templates/event/integ/cliq/command/execution_handler.json +12 -3
  75. package/templates/event/integ/cliq/command/suggestion_handler.json +18 -4
  76. package/templates/event/integ/cliq/{installation → extension}/installation_handler.json +13 -4
  77. package/templates/event/integ/cliq/{installation → extension}/installation_validator.json +13 -5
  78. package/templates/event/integ/cliq/extension/uninstallation_handler.json +37 -0
  79. package/templates/event/integ/cliq/function/button_handler.json +13 -5
  80. package/templates/event/integ/cliq/function/form_change_handler.json +9 -3
  81. package/templates/event/integ/cliq/function/form_handler.json +11 -3
  82. package/templates/event/integ/cliq/function/form_values_handler.json +9 -3
  83. package/templates/event/integ/cliq/function/form_view_handler.json +26 -0
  84. package/templates/event/integ/cliq/function/widget_button_handler.json +14 -5
  85. package/templates/event/integ/cliq/link_preview/action_handler.json +54 -0
  86. package/templates/event/integ/cliq/link_preview/after_send_handler.json +47 -0
  87. package/templates/event/integ/cliq/link_preview/menu_handler.json +47 -0
  88. package/templates/event/integ/cliq/link_preview/preview_handler.json +47 -0
  89. package/templates/event/integ/cliq/messageaction/execution_handler.json +11 -3
  90. package/templates/event/integ/cliq/widget/view_handler.json +12 -4
  91. package/templates/init/client/react/react_js/template/src/index.js +3 -3
  92. package/templates/init/client/react/react_ts/template/src/index.tsx +3 -3
  93. package/templates/init/client/react/react_ts/template.json +3 -3
  94. package/templates/init/functions/java/event/sample.java +4 -0
  95. package/templates/init/functions/java/integ/cliq/com/handlers/BotHandler.java +29 -23
  96. package/templates/init/functions/java/integ/cliq/com/handlers/CommandHandler.java +14 -17
  97. package/templates/init/functions/java/integ/cliq/com/handlers/ExtensionHandler.java +41 -0
  98. package/templates/init/functions/java/integ/cliq/com/handlers/FunctionHandler.java +74 -22
  99. package/templates/init/functions/java/integ/cliq/com/handlers/LinkPreviewHandler.java +108 -0
  100. package/templates/init/functions/java/integ/cliq/com/handlers/MessageActionHandler.java +6 -8
  101. package/templates/init/functions/java/integ/cliq/sample.java +10 -0
  102. package/templates/init/functions/node/aio/package.json +1 -1
  103. package/templates/init/functions/node/bio/package.json +1 -1
  104. package/templates/init/functions/node/cron/package.json +1 -1
  105. package/templates/init/functions/node/event/package.json +1 -1
  106. package/templates/init/functions/node/event/sample.js +1 -0
  107. package/templates/init/functions/node/event/types/event.d.ts +7 -0
  108. package/templates/init/functions/node/integ/cliq/handlers/bot-handler.js +4 -0
  109. package/templates/init/functions/node/integ/cliq/handlers/command-handler.js +3 -5
  110. package/templates/init/functions/node/integ/cliq/handlers/{installation-validator.js → extension-handler.js} +20 -3
  111. package/templates/init/functions/node/integ/cliq/handlers/function-handler.js +42 -0
  112. package/templates/init/functions/node/integ/cliq/handlers/link-preview-handler.js +73 -0
  113. package/templates/init/functions/node/integ/cliq/package.json +1 -1
  114. package/templates/init/functions/node/integ/convokraft/package.json +1 -1
  115. package/templates/init/functions/node/job/package.json +1 -1
  116. package/templates/init/functions/python/event/sample.py +9 -5
  117. package/templates/init/functions/python/integ/cliq/handlers/bot_handler.py +13 -3
  118. package/templates/init/functions/python/integ/cliq/handlers/command_handler.py +7 -7
  119. package/templates/init/functions/python/integ/cliq/handlers/extension_handler.py +25 -0
  120. package/templates/init/functions/python/integ/cliq/handlers/function_handler.py +54 -10
  121. package/templates/init/functions/python/integ/cliq/handlers/link_preview_handler.py +76 -0
  122. package/templates/init/functions/python/integ/cliq/handlers/widget_handler.py +10 -9
  123. package/templates/init/functions/python/integ/cliq/sample.py +2 -2
  124. package/templates/init.txt +2 -1
  125. package/templates/init/functions/java/integ/cliq/com/handlers/InstallationHandler.java +0 -20
  126. package/templates/init/functions/java/integ/cliq/com/handlers/InstallationValidator.java +0 -22
  127. package/templates/init/functions/node/integ/cliq/handlers/installation-handler.js +0 -15
  128. package/templates/init/functions/python/integ/cliq/handlers/installation_handler.py +0 -12
  129. package/templates/init/functions/python/integ/cliq/handlers/installation_validator.py +0 -16
@@ -0,0 +1,212 @@
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.validateServeCommand = exports.slateUtils = void 0;
16
+ const ansi_colors_1 = require("ansi-colors");
17
+ const fs_extra_1 = require("fs-extra");
18
+ const path_1 = require("path");
19
+ const archiver_1 = __importDefault(require("./archiver"));
20
+ const error_1 = __importDefault(require("./error"));
21
+ const runtime_store_1 = __importDefault(require("./runtime-store"));
22
+ const fs_1 = require("./util_modules/fs");
23
+ const option_1 = require("./util_modules/option");
24
+ const constants_1 = require("./util_modules/constants");
25
+ const logger_1 = require("./util_modules/logger");
26
+ const minimatch_1 = __importDefault(require("minimatch"));
27
+ const env_1 = require("./util_modules/env");
28
+ const async_1 = require("./util_modules/fs/lib/async");
29
+ exports.slateUtils = {
30
+ validate: (source) => __awaiter(void 0, void 0, void 0, function* () {
31
+ const sourceDirExists = yield fs_1.ASYNC.dirExists(source);
32
+ if (!sourceDirExists) {
33
+ throw new error_1.default('source directory does not exist', {
34
+ exit: 1,
35
+ errorId: 'SLATE-UTILS-1',
36
+ arg: [ansi_colors_1.italic.red(source)]
37
+ });
38
+ }
39
+ }),
40
+ getSlateFilters(targetStr) {
41
+ return targetStr.split(',').reduce((filterArr, target) => {
42
+ const opts = target.split(':');
43
+ if (opts[0] === 'slate' && opts[1]) {
44
+ filterArr.push(opts[1]);
45
+ return filterArr;
46
+ }
47
+ return filterArr;
48
+ }, []);
49
+ },
50
+ filterTargets(allTargets) {
51
+ const only = (0, option_1.getOptionValue)('only');
52
+ if (only !== undefined) {
53
+ const onlyTargs = this.getSlateFilters(only);
54
+ if (onlyTargs.length === 0) {
55
+ return allTargets;
56
+ }
57
+ const refined = onlyTargs.reduce((filtered, filter) => {
58
+ const targDetailsIdx = allTargets.findIndex((targ) => targ.name === filter);
59
+ if (targDetailsIdx === -1) {
60
+ filtered.unmatched.push(filter);
61
+ }
62
+ else {
63
+ const targDetails = allTargets.splice(targDetailsIdx, 1);
64
+ filtered.matched.push(targDetails[0]);
65
+ }
66
+ return filtered;
67
+ }, {
68
+ matched: [],
69
+ unmatched: []
70
+ });
71
+ if (refined.unmatched.length > 0) {
72
+ throw new error_1.default(`The filters ${(0, ansi_colors_1.bold)(refined.unmatched.join(', '))} provided with --only option does not match with any Slate service in ${constants_1.FILENAME.config}.`);
73
+ }
74
+ return refined.matched;
75
+ }
76
+ const except = (0, option_1.getOptionValue)('except');
77
+ if (except !== undefined) {
78
+ const exceptTargs = this.getSlateFilters(except);
79
+ const refined = exceptTargs.reduce((filtered, filter) => {
80
+ const targDetailsIdx = allTargets.findIndex((targ) => targ.name === filter);
81
+ if (targDetailsIdx === -1) {
82
+ filtered.unmatched.push(filter);
83
+ }
84
+ else {
85
+ filtered.matched.splice(targDetailsIdx, 1);
86
+ }
87
+ return filtered;
88
+ }, {
89
+ matched: allTargets,
90
+ unmatched: []
91
+ });
92
+ if (refined.unmatched.length > 0) {
93
+ (0, logger_1.message)(`The filters ${(0, ansi_colors_1.bold)(refined.unmatched.join(', '))} provided with --except option does not match with any Slate service in ${constants_1.FILENAME.config}, hence ignored.`);
94
+ }
95
+ return refined.matched;
96
+ }
97
+ const refinedTargets = allTargets.filter((app) => app.source.includes(runtime_store_1.default.get('cwd')));
98
+ if (refinedTargets.length === 0 || !refinedTargets) {
99
+ throw new error_1.default('You are not in a catalyst app directory.');
100
+ }
101
+ return refinedTargets;
102
+ },
103
+ pack: (source) => __awaiter(void 0, void 0, void 0, function* () {
104
+ if (env_1.isCI) {
105
+ source = source !== null && source !== void 0 ? source : runtime_store_1.default.get('cwd');
106
+ const tempDir = (0, path_1.resolve)(constants_1.FOLDERNAME.slate);
107
+ if (!(yield (0, async_1.dirExists)(tempDir))) {
108
+ (0, fs_extra_1.mkdir)(tempDir);
109
+ const excludePatterns = [
110
+ '**/.catalyst',
111
+ `**/${constants_1.FILENAME.log}`,
112
+ `**/${constants_1.FILENAME.config}`,
113
+ `**/${constants_1.FILENAME.rc}`,
114
+ `**/${constants_1.FILENAME.app_config}`,
115
+ `**/${constants_1.FILENAME.catalyst_ignore}`
116
+ ];
117
+ const files = yield fs_1.ASYNC.walk(source, {
118
+ filter: {
119
+ exclude: (path) => __awaiter(void 0, void 0, void 0, function* () {
120
+ return !!excludePatterns.find((glob) => (0, minimatch_1.default)(path.replace(source + path_1.sep, ''), glob, {
121
+ dot: true
122
+ }));
123
+ }),
124
+ excludeDir: true
125
+ }
126
+ });
127
+ const zip = new archiver_1.default('static');
128
+ const fileArr = [];
129
+ files.forEach((file) => {
130
+ fileArr.push({
131
+ path: (0, path_1.relative)(source, file.path),
132
+ type: (0, path_1.extname)(file.path).replace('.', '').toUpperCase() || '',
133
+ size: file.stats.size
134
+ });
135
+ zip.add(file.path.replace(source + path_1.sep, ''), file.stats.isSymbolicLink()
136
+ ? fs_1.SYNC.readSymLink(file.path)
137
+ : fs_1.SYNC.getReadStream(file.path), {
138
+ mode: file.stats.mode
139
+ });
140
+ });
141
+ const zipFinalizer = yield zip.finalize();
142
+ const staticZip = (0, path_1.join)(tempDir, constants_1.FILENAME.slate.static_zip);
143
+ yield zipFinalizer.writeZip(staticZip);
144
+ const content = {
145
+ version: '',
146
+ framework: process.env.ZC_FRAMEWORK,
147
+ runtime: '',
148
+ static: fileArr
149
+ };
150
+ const configJson = (0, path_1.join)(tempDir, constants_1.FILENAME.slate.config_json);
151
+ fs_1.SYNC.writeFile(configJson, JSON.stringify(content, null, 2) + '\n');
152
+ }
153
+ const slateZip = yield fs_1.ASYNC.walk(tempDir, { includeDirPaths: false });
154
+ const zipWithJson = new archiver_1.default();
155
+ slateZip.forEach((file) => {
156
+ zipWithJson.add(file.path.replace(tempDir + path_1.sep, ''), file.stats.isSymbolicLink()
157
+ ? fs_1.SYNC.readSymLink(file.path)
158
+ : fs_1.SYNC.getReadStream(file.path), {
159
+ mode: file.stats.mode
160
+ });
161
+ });
162
+ const zipFinalizerWithJson = yield zipWithJson.finalize();
163
+ yield fs_1.ASYNC.deleteDir(tempDir);
164
+ return yield zipFinalizerWithJson.fsStream();
165
+ }
166
+ const excludePatterns = [
167
+ '**/.DS_Store',
168
+ '**/.catalyst',
169
+ '**/.vscode/**/*',
170
+ '**/node_modules',
171
+ `**/${constants_1.FILENAME.log}`,
172
+ `**/${constants_1.FILENAME.config}`,
173
+ `**/${constants_1.FILENAME.rc}`,
174
+ `**/${constants_1.FILENAME.app_config}`,
175
+ `**/${constants_1.FILENAME.catalyst_ignore}`
176
+ ];
177
+ const slateZip = yield fs_1.ASYNC.walk(source, {
178
+ filter: {
179
+ exclude: (path) => __awaiter(void 0, void 0, void 0, function* () {
180
+ return !!excludePatterns.find((glob) => (0, minimatch_1.default)(path.replace(source + path_1.sep, ''), glob, { dot: true }));
181
+ }),
182
+ excludeDir: true
183
+ }
184
+ });
185
+ const zipWithJson = new archiver_1.default();
186
+ slateZip.forEach((file) => {
187
+ zipWithJson.add(file.path.replace(source + path_1.sep, ''), file.stats.isSymbolicLink()
188
+ ? fs_1.SYNC.readSymLink(file.path)
189
+ : fs_1.SYNC.getReadStream(file.path), {
190
+ mode: file.stats.mode
191
+ });
192
+ });
193
+ const zipFinalizerWithJson = yield zipWithJson.finalize();
194
+ return yield zipFinalizerWithJson.fsStream();
195
+ })
196
+ };
197
+ function validateServeCommand(targDetails) {
198
+ targDetails.forEach((targ) => {
199
+ var _a, _b;
200
+ if (((_a = targ.config) === null || _a === void 0 ? void 0 : _a.framework) !== 'static') {
201
+ const serveConfig = fs_1.SYNC.readJSONFile((0, path_1.join)(targ.source, constants_1.FILENAME.cli_config));
202
+ if (targ.validity.valid && !((_b = serveConfig === null || serveConfig === void 0 ? void 0 : serveConfig.slate) === null || _b === void 0 ? void 0 : _b.dev_command)) {
203
+ targ.validity = {
204
+ valid: false,
205
+ reason: 'Development command missing'
206
+ };
207
+ }
208
+ }
209
+ });
210
+ return targDetails;
211
+ }
212
+ exports.validateServeCommand = validateServeCommand;
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.appSailConfig = exports.apigConfig = exports.functionsConfig = exports.clientConfig = void 0;
26
+ exports.slateConfig = exports.appSailConfig = exports.apigConfig = exports.functionsConfig = exports.clientConfig = void 0;
27
27
  const apigConfig = __importStar(require("./lib/apig"));
28
28
  exports.apigConfig = apigConfig;
29
29
  const clientConfig = __importStar(require("./lib/client"));
@@ -32,3 +32,5 @@ const functionsConfig = __importStar(require("./lib/functions"));
32
32
  exports.functionsConfig = functionsConfig;
33
33
  const appSailConfig = __importStar(require("./lib/appsail"));
34
34
  exports.appSailConfig = appSailConfig;
35
+ const slateConfig = __importStar(require("./lib/slate.js"));
36
+ exports.slateConfig = slateConfig;
@@ -0,0 +1,98 @@
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.getAllTargetDetails = exports.getTargetDetails = exports.raw = void 0;
16
+ const ansi_colors_1 = require("ansi-colors");
17
+ const error_1 = __importDefault(require("../../../error"));
18
+ const runtime_store_1 = __importDefault(require("../../../runtime-store"));
19
+ const constants_1 = require("../../constants");
20
+ const fs_1 = require("../../fs");
21
+ const toml_1 = require("../../parser/toml");
22
+ const project_1 = require("../../project");
23
+ const path_1 = require("path");
24
+ function raw(throwError = false) {
25
+ const config = runtime_store_1.default.get('config', null);
26
+ if (config === null) {
27
+ if (throwError) {
28
+ throw new error_1.default(constants_1.FILENAME.config + ' file is required', { exit: 2 });
29
+ }
30
+ return;
31
+ }
32
+ return config.get('slate');
33
+ }
34
+ exports.raw = raw;
35
+ function getTargetDetails(targ) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const rawTargets = raw();
38
+ const target = rawTargets === null || rawTargets === void 0 ? void 0 : rawTargets.find((tar) => tar.name === targ.name);
39
+ if (!target) {
40
+ return Object.assign(Object.assign({}, targ), { validity: { valid: false, reason: 'Slate not found' } });
41
+ }
42
+ const slateConfigPth = (0, project_1.resolveProjectPath)((0, path_1.join)(targ.source, '.catalyst', constants_1.FILENAME.slate_config));
43
+ const slateConfigJson = fs_1.SYNC.readFile(slateConfigPth);
44
+ const slateConfig = (0, toml_1.parseTOML)(slateConfigJson);
45
+ if (!slateConfig) {
46
+ return Object.assign(Object.assign({}, targ), { validity: { valid: false, reason: 'Config file is empty' } });
47
+ }
48
+ target.config = slateConfig;
49
+ return Object.assign({}, target);
50
+ });
51
+ }
52
+ exports.getTargetDetails = getTargetDetails;
53
+ function getAllTargetDetails(throwErr = true) {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ const rawTargets = raw();
56
+ if (!rawTargets) {
57
+ if (throwErr) {
58
+ throw new error_1.default('No Slate targets found', {
59
+ errorId: 'SLTARG-UTIL-1',
60
+ arg: [(0, ansi_colors_1.bold)('catalyst slate:create')],
61
+ exit: 1
62
+ });
63
+ }
64
+ return;
65
+ }
66
+ return Promise.all(rawTargets.reduce((resArr, target) => {
67
+ const isPath = fs_1.SYNC.dirExists(target.source);
68
+ if (!isPath) {
69
+ resArr.push(Promise.resolve(Object.assign(Object.assign({}, target), { validity: {
70
+ valid: false,
71
+ reason: `Invalid source path: (${(0, ansi_colors_1.bold)(target.source)}) directory not found`
72
+ } })));
73
+ return resArr;
74
+ }
75
+ const slateConfigPth = (0, project_1.resolveProjectPath)((0, path_1.join)(target.source, '.catalyst', constants_1.FILENAME.slate_config));
76
+ const isConfigPath = fs_1.SYNC.fileExists(slateConfigPth);
77
+ if (!isConfigPath) {
78
+ resArr.push(Promise.resolve(Object.assign(Object.assign({}, target), { validity: {
79
+ valid: false,
80
+ reason: 'Config file not present'
81
+ } })));
82
+ return resArr;
83
+ }
84
+ const slateConfigJson = fs_1.SYNC.readFile(slateConfigPth);
85
+ const slateConfig = (0, toml_1.parseTOML)(slateConfigJson);
86
+ if (!slateConfig) {
87
+ resArr.push(Promise.resolve(Object.assign(Object.assign({}, target), { validity: { valid: false, reason: 'Config file is empty' } })));
88
+ return resArr;
89
+ }
90
+ target.config = slateConfig;
91
+ resArr.push(new Promise((res) => __awaiter(this, void 0, void 0, function* () {
92
+ return res(Object.assign(Object.assign({}, target), { validity: { valid: true } }));
93
+ })));
94
+ return resArr;
95
+ }, []));
96
+ });
97
+ }
98
+ exports.getAllTargetDetails = getAllTargetDetails;
@@ -13,8 +13,8 @@ const handlers = {
13
13
  messageaction_handler: 'messageaction_handler',
14
14
  widget_handler: 'widget_handler',
15
15
  function_handler: 'function_handler',
16
- installation_handler: 'installation_handler',
17
- installation_validator: 'installation_validator'
16
+ extension_handler: 'extension_handler',
17
+ link_preview_handler: 'link_preview_handler'
18
18
  };
19
19
  exports.default = Object.freeze({
20
20
  event_template_dir: (0, path_1.join)(template_root, './event/integ/cliq/'),
@@ -43,8 +43,8 @@ exports.default = Object.freeze({
43
43
  [handlers.messageaction_handler]: 'message-action-handler.js',
44
44
  [handlers.widget_handler]: 'widget-handler.js',
45
45
  [handlers.function_handler]: 'function-handler.js',
46
- [handlers.installation_handler]: 'installation-handler.js',
47
- [handlers.installation_validator]: 'installation-validator.js'
46
+ [handlers.extension_handler]: 'extension-handler.js',
47
+ [handlers.link_preview_handler]: 'link-preview-handler.js'
48
48
  },
49
49
  java_handler_file_mapping: {
50
50
  [handlers.bot_handler]: 'BotHandler.java',
@@ -52,8 +52,8 @@ exports.default = Object.freeze({
52
52
  [handlers.messageaction_handler]: 'MessageActionHandler.java',
53
53
  [handlers.widget_handler]: 'WidgetHandler.java',
54
54
  [handlers.function_handler]: 'FunctionHandler.java',
55
- [handlers.installation_handler]: 'InstallationHandler.java',
56
- [handlers.installation_validator]: 'InstallationValidator.java'
55
+ [handlers.extension_handler]: 'ExtensionHandler.java',
56
+ [handlers.link_preview_handler]: 'LinkPreviewHandler.java'
57
57
  },
58
58
  python_handler_file_mapping: {
59
59
  [handlers.bot_handler]: 'bot_handler.py',
@@ -61,8 +61,8 @@ exports.default = Object.freeze({
61
61
  [handlers.messageaction_handler]: 'message_action_handler.py',
62
62
  [handlers.widget_handler]: 'widget_handler.py',
63
63
  [handlers.function_handler]: 'function_handler.py',
64
- [handlers.installation_handler]: 'installation_handler.py',
65
- [handlers.installation_validator]: 'installation_validator.py'
64
+ [handlers.extension_handler]: 'extension_handler.py',
65
+ [handlers.link_preview_handler]: 'link_preview_handler.py'
66
66
  },
67
67
  handlers_event_template: {
68
68
  ['bot']: [
@@ -72,7 +72,8 @@ exports.default = Object.freeze({
72
72
  'mention_handler',
73
73
  'action_handler',
74
74
  'incomingwebhook_handler',
75
- 'participation_handler'
75
+ 'participation_handler',
76
+ 'call_handler'
76
77
  ],
77
78
  ['command']: ['execution_handler', 'suggestion_handler'],
78
79
  ['messageaction']: ['execution_handler'],
@@ -82,8 +83,15 @@ exports.default = Object.freeze({
82
83
  'form_handler',
83
84
  'form_change_handler',
84
85
  'form_values_handler',
86
+ 'form_view_handler',
85
87
  'widget_button_handler'
86
88
  ],
87
- ['installation']: ['installation_handler', 'installation_validator']
89
+ ['extension']: ['installation_handler', 'installation_validator', 'uninstallation_handler'],
90
+ ['link_preview']: [
91
+ 'preview_handler',
92
+ 'action_handler',
93
+ 'menu_handler',
94
+ 'after_send_handler'
95
+ ]
88
96
  }
89
97
  });
@@ -48,5 +48,13 @@ exports.default = Object.freeze({
48
48
  w_auth: 'us',
49
49
  m_auth: 'us',
50
50
  ext: '.sa'
51
+ },
52
+ jp: {
53
+ loc: 'Japan',
54
+ ref: 'jp',
55
+ value: 'jp',
56
+ w_auth: 'us',
57
+ m_auth: 'us',
58
+ ext: '.jp'
51
59
  }
52
60
  });
@@ -19,6 +19,10 @@ exports.default = Object.freeze({
19
19
  master: 3000,
20
20
  service: 4600
21
21
  },
22
+ slate: {
23
+ master: 3000,
24
+ service: 4800
25
+ },
22
26
  client: 5000
23
27
  },
24
28
  debug: {
@@ -5,6 +5,10 @@ exports.default = Object.freeze({
5
5
  http_log: 'catalyst-http-log.json',
6
6
  rc: '.catalystrc',
7
7
  config: 'catalyst.json',
8
+ slate: {
9
+ config_json: 'files.json',
10
+ static_zip: 'static.zip'
11
+ },
8
12
  client: {
9
13
  package_json: 'client-package.json',
10
14
  notFoundPage: '404.html'
@@ -23,9 +27,11 @@ exports.default = Object.freeze({
23
27
  system_rules: 'catalyst-system-rules.json'
24
28
  },
25
29
  catalyst_config: 'catalyst-config.json',
30
+ slate_config: 'slate-config.toml',
26
31
  command_log: '.command.log',
27
32
  node_modules: 'node_modules',
28
33
  app_config: 'app-config.json',
29
34
  package_json: 'package.json',
30
- catalyst_ignore: '.catalystignore'
35
+ catalyst_ignore: '.catalystignore',
36
+ cli_config: 'cli-config.json'
31
37
  });
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = Object.freeze({
4
4
  client: 'client',
5
5
  functions: 'functions',
6
+ slate: '.slate',
6
7
  java_fn_lib: 'lib',
7
8
  build: '.build',
8
9
  output: '.output'
@@ -43,6 +43,7 @@ exports.default = Object.freeze({
43
43
  project_id: '{{__PROJECT_ID__}}',
44
44
  zaid: '{{__ZAID__}}',
45
45
  auth_domain: '{{__AUTH_DOMAIN__}}',
46
- org_id: '{{__ORG_ID__}}'
46
+ org_id: '{{__ORG_ID__}}',
47
+ stratus_domain: '{{_STRATUS_DOMAIN__}}'
47
48
  }
48
49
  });
@@ -75,10 +75,5 @@ exports.default = Object.freeze({
75
75
  bucket_read: 'ZohoCatalyst.buckets.READ',
76
76
  object_create: 'ZohoCatalyst.buckets.objects.CREATE',
77
77
  pipline_read: 'ZohoCatalyst.pipeline.READ',
78
- pipeline_exec_create: 'ZohoCatalyst.pipeline.execution.CREATE',
79
- zest_file_read: 'ZohoZEST.files.READ',
80
- zest_spec_read: 'ZohoZEST.specifications.READ',
81
- zest_spec_all: 'ZohoZEST.specifications.ALL',
82
- zest_spec_src_action: 'ZohoZEST.specifications.sources.CREATE',
83
- zest_schedule_job_read: 'ZohoZEST.scheduled_jobs.READ'
78
+ pipeline_exec_create: 'ZohoCatalyst.pipeline.execution.CREATE'
84
79
  });
@@ -8,7 +8,7 @@ const runtime_store_1 = __importDefault(require("../runtime-store"));
8
8
  const ansi_colors_1 = require("ansi-colors");
9
9
  const fs_1 = require("./fs");
10
10
  const logger_1 = require("./logger");
11
- const toml_1 = __importDefault(require("./parser/toml"));
11
+ const toml_1 = require("./parser/toml");
12
12
  function help() {
13
13
  let exitCode = 0;
14
14
  const logs = runtime_store_1.default.get('log');
@@ -40,7 +40,7 @@ function help() {
40
40
  }
41
41
  const docPath = ((_a = errQueue[0].fileName) === null || _a === void 0 ? void 0 : _a.replace((0, path_1.join)(__dirname, '../../lib'), (0, path_1.join)(__dirname, '../../docs'))) + '.toml';
42
42
  const doc = fs_1.SYNC.readFile(docPath) || '';
43
- const catHelp = (0, toml_1.default)(doc);
43
+ const catHelp = (0, toml_1.parseTOML)(doc);
44
44
  errQueue.forEach((err) => {
45
45
  exitCode = err.exit > exitCode ? err.exit : exitCode;
46
46
  if (err.errorId === undefined ||
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.chmod = exports.writeJSONFile = exports.readJSONFile = exports.emptyDir = exports.findAndReplace = exports.rename = exports.copyDir = exports.copyFiles = exports.copyFile = exports.deleteDir = exports.deleteFile = exports.ensureDir = exports.ensureFile = exports.walk = exports.dirList = exports.writeFile = exports.tempFile = exports.readFile = exports.fileExists = exports.dirExists = exports.isPathExists = void 0;
15
+ exports.isDirEmpty = exports.chmod = exports.writeJSONFile = exports.readJSONFile = exports.emptyDir = exports.findAndReplace = exports.rename = exports.copyDir = exports.copyFiles = exports.copyFile = exports.deleteDir = exports.deleteFile = exports.ensureDir = exports.ensureFile = exports.walk = exports.dirList = exports.writeFile = exports.tempFile = exports.readFile = exports.fileExists = exports.dirExists = exports.isPathExists = void 0;
16
16
  const fs_extra_1 = __importDefault(require("fs-extra"));
17
17
  const minimatch_1 = __importDefault(require("minimatch"));
18
18
  const os_1 = __importDefault(require("os"));
@@ -84,7 +84,8 @@ function dirList(dir) {
84
84
  exports.dirList = dirList;
85
85
  function walk(dir, { filter = {
86
86
  exclude: [],
87
- excludeDir: true
87
+ excludeDir: true,
88
+ ignoreFiles: false
88
89
  }, depth = -1, includeDirPaths = false } = {}) {
89
90
  return __awaiter(this, void 0, void 0, function* () {
90
91
  const stats = yield fs_extra_1.default.lstat(dir);
@@ -98,7 +99,7 @@ function walk(dir, { filter = {
98
99
  const entryPathStats = yield fs_extra_1.default.lstat(entryPath);
99
100
  const isEntryPthDir = entryPathStats.isDirectory() && !entryPathStats.isSymbolicLink();
100
101
  let excludeMatch = false;
101
- if (!(isEntryPthDir && !filter.excludeDir)) {
102
+ if (!isEntryPthDir || filter.excludeDir) {
102
103
  if (typeof filter.exclude === 'function') {
103
104
  excludeMatch = excludeMatch || (yield filter.exclude(entryPath));
104
105
  }
@@ -108,6 +109,9 @@ function walk(dir, { filter = {
108
109
  }
109
110
  }
110
111
  }
112
+ if (!isEntryPthDir && filter.ignoreFiles && !excludeMatch) {
113
+ excludeMatch = true;
114
+ }
111
115
  if (excludeMatch) {
112
116
  return [];
113
117
  }
@@ -249,3 +253,10 @@ function chmod(path, mode, { checkPath = true, recursive = false } = {}) {
249
253
  });
250
254
  }
251
255
  exports.chmod = chmod;
256
+ function isDirEmpty(pth) {
257
+ return __awaiter(this, void 0, void 0, function* () {
258
+ const files = yield fs_extra_1.default.readdir(pth);
259
+ return files.length === 0;
260
+ });
261
+ }
262
+ exports.isDirEmpty = isDirEmpty;
@@ -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.writeJSONFile = exports.readJSONFile = exports.emptyDir = exports.copyDir = exports.copyFiles = exports.copyFile = exports.deleteTempDir = exports.tempFile = exports.deleteDir = exports.isPathInside = exports.isPathOutside = exports.renameFile = exports.modifyFileName = exports.appendFile = exports.writeFile = exports.ensureFile = exports.ensureDir = exports.readFile = exports.deleteFile = exports.getAllFiles = exports.getAllDirs = exports.dirExists = exports.pathExists = exports.fileExists = exports.readSymLink = exports.getReadStream = exports.getWriteStream = void 0;
6
+ exports.isDirEmpty = exports.writeJSONFile = exports.readJSONFile = exports.emptyDir = exports.copyDir = exports.copyFiles = exports.copyFile = exports.deleteTempDir = exports.tempFile = exports.deleteDir = exports.isPathInside = exports.isPathOutside = exports.renameFile = exports.modifyFileName = exports.appendFile = exports.writeFile = exports.ensureFile = exports.ensureDir = exports.readFile = exports.deleteFile = exports.getAllFiles = exports.getAllDirs = exports.dirExists = exports.pathExists = exports.fileExists = exports.readSymLink = exports.getReadStream = exports.getWriteStream = void 0;
7
7
  const fs_extra_1 = __importDefault(require("fs-extra"));
8
8
  const os_1 = __importDefault(require("os"));
9
9
  const path_1 = __importDefault(require("path"));
@@ -180,3 +180,8 @@ function writeJSONFile(pth, object, opts) {
180
180
  return fs_extra_1.default.writeJsonSync(pth, object, opts);
181
181
  }
182
182
  exports.writeJSONFile = writeJSONFile;
183
+ function isDirEmpty(pth) {
184
+ const files = fs_extra_1.default.readdirSync(pth);
185
+ return files.length === 0;
186
+ }
187
+ exports.isDirEmpty = isDirEmpty;
@@ -3,17 +3,32 @@ 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 toml_1 = require("toml");
6
+ exports.convertTOML = exports.parseTOML = void 0;
7
+ const toml_1 = __importDefault(require("@iarna/toml"));
7
8
  const error_1 = __importDefault(require("../../error"));
8
- exports.default = (str) => {
9
+ function parseTOML(str) {
9
10
  try {
10
- return (0, toml_1.parse)(str);
11
+ return toml_1.default.parse(str);
11
12
  }
12
13
  catch (e) {
13
14
  const err = error_1.default.getErrorInstance(e, {
14
- message: 'TOML Parsing error'
15
+ message: 'TOML Parsing error' + e
15
16
  });
16
17
  err.exit = 2;
17
18
  throw err;
18
19
  }
19
- };
20
+ }
21
+ exports.parseTOML = parseTOML;
22
+ function convertTOML(object) {
23
+ try {
24
+ return toml_1.default.stringify(object);
25
+ }
26
+ catch (e) {
27
+ const err = error_1.default.getErrorInstance(e, {
28
+ message: 'TOML Writing error'
29
+ });
30
+ err.exit = 2;
31
+ throw err;
32
+ }
33
+ }
34
+ exports.convertTOML = convertTOML;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zcatalyst-cli",
3
- "version": "1.18.0-beta.9",
3
+ "version": "1.18.1",
4
4
  "description": "Command Line Tool for CATALYST",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -21,10 +21,11 @@
21
21
  "functions",
22
22
  "zcatalyst"
23
23
  ],
24
- "author": "Catalyst (https://catalyst.zoho.com)",
24
+ "author": "Catalyst (https://github.com/catalystbyzoho)",
25
25
  "homepage": "https://catalyst.zoho.com",
26
26
  "license": "MIT",
27
27
  "dependencies": {
28
+ "@iarna/toml": "^2.2.5",
28
29
  "ansi-colors": "^4.1.3",
29
30
  "app-module-path": "^2.2.0",
30
31
  "better-queue": "^3.8.10",
@@ -51,7 +52,6 @@
51
52
  "semver": "^7.3.7",
52
53
  "string-width": "^4.2.3",
53
54
  "strip-ansi": "^6.0.1",
54
- "toml": "^3.0.0",
55
55
  "update-notifier": "^5.1.0",
56
56
  "winston": "^3.7.2",
57
57
  "ws": "^8.5.0",