zcatalyst-cli 1.12.0 → 1.13.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.
- package/lib/apig-utils.js +39 -39
- package/lib/archiver.js +13 -9
- package/lib/authentication/index.js +22 -18
- package/lib/authentication/login.js +37 -39
- package/lib/bin/catalyst.js +15 -15
- package/lib/cli_table/src/cell.js +26 -26
- package/lib/cli_table/src/layout-manager.js +44 -45
- package/lib/cli_table/src/table.js +9 -9
- package/lib/cli_table/src/utils.js +35 -36
- package/lib/client-utils.js +18 -18
- package/lib/client.js +1 -1
- package/lib/command_needs/auth.js +7 -7
- package/lib/command_needs/rc.js +24 -24
- package/lib/commands/apig/disable.js +5 -5
- package/lib/commands/apig/enable.js +5 -5
- package/lib/commands/apig/status.js +9 -9
- package/lib/commands/client/delete.js +19 -19
- package/lib/commands/client/setup.js +8 -4
- package/lib/commands/deploy.js +18 -14
- package/lib/commands/ds/export.js +11 -11
- package/lib/commands/ds/import.js +12 -12
- package/lib/commands/ds/status.js +15 -15
- package/lib/commands/event/generate/index.js +21 -17
- package/lib/commands/event/generate/integ.js +7 -3
- package/lib/commands/functions/add.js +8 -4
- package/lib/commands/functions/config.js +5 -5
- package/lib/commands/functions/delete.js +22 -22
- package/lib/commands/functions/setup.js +8 -4
- package/lib/commands/functions/shell.js +7 -3
- package/lib/commands/help.js +4 -4
- package/lib/commands/iac/export.js +8 -8
- package/lib/commands/iac/import.js +29 -21
- package/lib/commands/iac/pack.js +15 -11
- package/lib/commands/iac/status.js +6 -2
- package/lib/commands/index.js +5 -1
- package/lib/commands/init.js +14 -10
- package/lib/commands/login.js +5 -1
- package/lib/commands/logout.js +5 -1
- package/lib/commands/project/list.js +14 -10
- package/lib/commands/project/reset.js +5 -5
- package/lib/commands/project/use.js +9 -9
- package/lib/commands/pull.js +18 -14
- package/lib/commands/run.js +13 -9
- package/lib/commands/serve.js +5 -1
- package/lib/commands/token/generate.js +6 -2
- package/lib/commands/token/list.js +7 -3
- package/lib/commands/token/revoke.js +6 -2
- package/lib/commands/whoami.js +3 -3
- package/lib/dc.js +2 -2
- package/lib/deploy/features/apig.js +6 -6
- package/lib/deploy/features/client.js +1 -1
- package/lib/deploy/features/functions/index.js +9 -9
- package/lib/deploy/features/index.js +5 -1
- package/lib/deploy/index.js +2 -2
- package/lib/endpoints/index.js +17 -13
- package/lib/endpoints/lib/apig.js +5 -5
- package/lib/endpoints/lib/applogic.js +4 -4
- package/lib/endpoints/lib/cache.js +3 -3
- package/lib/endpoints/lib/catalyst-details.js +1 -1
- package/lib/endpoints/lib/client.js +5 -5
- package/lib/endpoints/lib/datastore.js +2 -2
- package/lib/endpoints/lib/ds-bulk.js +5 -5
- package/lib/endpoints/lib/env.js +1 -1
- package/lib/endpoints/lib/event-bus.js +1 -1
- package/lib/endpoints/lib/filestore.js +2 -2
- package/lib/endpoints/lib/functions.js +4 -4
- package/lib/endpoints/lib/iac.js +10 -10
- package/lib/endpoints/lib/project.js +20 -5
- package/lib/endpoints/lib/queue.js +3 -3
- package/lib/endpoints/lib/sdk.js +1 -1
- package/lib/endpoints/lib/zcql.js +1 -1
- package/lib/error.js +1 -1
- package/lib/errorOut.js +2 -2
- package/lib/event_generate/cache.js +5 -5
- package/lib/event_generate/custom.js +2 -2
- package/lib/event_generate/datastore.js +5 -5
- package/lib/event_generate/filestore.js +5 -5
- package/lib/event_generate/integration/cliq.js +3 -3
- package/lib/event_generate/user.js +1 -1
- package/lib/event_generate/webapp.js +5 -5
- package/lib/execute-script.js +19 -15
- package/lib/express_middlewares/authenticator.js +29 -4
- package/lib/express_middlewares/logger.js +2 -2
- package/lib/express_middlewares/unknownReqProxy.js +1 -1
- package/lib/fn-utils/index.js +5 -1
- package/lib/fn-utils/lib/common.js +44 -44
- package/lib/fn-utils/lib/integ.js +9 -9
- package/lib/fn-utils/lib/java.js +48 -46
- package/lib/fn-utils/lib/node.js +7 -7
- package/lib/fn-watcher.js +9 -11
- package/lib/iac/status/bundle.js +5 -5
- package/lib/iac/status/deploy.js +4 -4
- package/lib/index.js +2 -2
- package/lib/init/dependencies/npm-install.js +1 -1
- package/lib/init/dependencies/package-json.js +6 -6
- package/lib/init/features/client/index.js +5 -1
- package/lib/init/features/client/initializers/angular.js +16 -12
- package/lib/init/features/client/initializers/basic.js +10 -6
- package/lib/init/features/client/initializers/lyte.js +11 -7
- package/lib/init/features/client/initializers/react.js +13 -9
- package/lib/init/features/functions/index.js +23 -14
- package/lib/init/features/functions/languages/java.js +10 -10
- package/lib/init/features/functions/languages/node.js +9 -9
- package/lib/init/features/index.js +12 -8
- package/lib/init/features/project.js +20 -20
- package/lib/init/index.js +2 -2
- package/lib/init/util/client.js +7 -3
- package/lib/init/util/functions.js +1 -1
- package/lib/init/util/project.js +4 -4
- package/lib/internal/api.js +19 -19
- package/lib/internal/command.js +20 -16
- package/lib/internal/config.js +5 -5
- package/lib/internal/credential.js +10 -10
- package/lib/internal/crypt.js +5 -5
- package/lib/internal/rc.js +5 -5
- package/lib/migration/global/1.6.2.js +3 -3
- package/lib/migration/index.js +22 -18
- package/lib/option-filter.js +34 -30
- package/lib/optional-import.js +12 -8
- package/lib/plugin-loader.js +7 -3
- package/lib/port-resolver.js +4 -4
- package/lib/progress.js +2 -2
- package/lib/prompt/index.js +6 -2
- package/lib/prompt/types/file-path.js +1 -1
- package/lib/pull/features/apig.js +9 -9
- package/lib/pull/features/client.js +7 -7
- package/lib/pull/features/functions/index.js +15 -15
- package/lib/pull/features/index.js +5 -1
- package/lib/pull/index.js +4 -4
- package/lib/repl-server.js +2 -2
- package/lib/serve/features/apig.js +1 -1
- package/lib/serve/features/index.js +8 -4
- package/lib/serve/index.js +15 -11
- package/lib/serve/server/index.js +34 -27
- package/lib/serve/server/lib/java/JavaaioServer.java +5 -3
- package/lib/serve/server/lib/java/lib/catalyst-cli-java-runtime-1.0.0.jar +0 -0
- package/lib/serve/server/lib/java/lib/catalyst-java-runtime-1.0.0.jar +0 -0
- package/lib/serve/server/lib/java/lib/zip4j-2.5.0.jar +0 -0
- package/lib/serve/server/lib/master.js +33 -36
- package/lib/serve/server/lib/node.js +7 -3
- package/lib/serve/server/lib/web_client/index.js +3 -3
- package/lib/serve/server/lib/web_client/server.js +22 -19
- package/lib/shell/dependencies/http-functions.js +38 -33
- package/lib/shell/dependencies/invoker/bio/java/JavabioInvoker.java +14 -3
- package/lib/shell/dependencies/invoker/bio/node.js +5 -2
- package/lib/shell/dependencies/invoker/cron/java/JavacronInvoker.java +7 -2
- package/lib/shell/dependencies/invoker/event/java/JavaeventInvoker.java +7 -2
- package/lib/shell/dependencies/invoker/integ/java/JavaintegInvoker.java +7 -2
- package/lib/shell/dependencies/invoker/integ/node.js +8 -4
- package/lib/shell/dependencies/local-function.js +44 -40
- package/lib/shell/index.js +12 -12
- package/lib/shell/prepare/index.js +2 -2
- package/lib/shell/prepare/languages/index.js +5 -1
- package/lib/shell/prepare/languages/java.js +1 -1
- package/lib/throbber/index.js +17 -17
- package/lib/throbber/utils.js +9 -9
- package/lib/track.js +7 -7
- package/lib/util_modules/config/index.js +5 -1
- package/lib/util_modules/constants/lib/auth.js +6 -6
- package/lib/util_modules/constants/lib/cliq-handlers.js +2 -2
- package/lib/util_modules/constants/lib/template.js +21 -21
- package/lib/util_modules/constants/lib/urls.js +11 -11
- package/lib/util_modules/context-help.js +15 -15
- package/lib/util_modules/fs/index.js +5 -1
- package/lib/util_modules/fs/lib/async.js +4 -4
- package/lib/util_modules/fs/utils.js +1 -1
- package/lib/util_modules/logger.js +2 -2
- package/lib/util_modules/parser/toml.js +1 -1
- package/lib/util_modules/project.js +6 -6
- package/lib/util_modules/server.js +53 -0
- package/lib/util_modules/shell.js +4 -4
- package/lib/winston.js +5 -5
- package/package.json +39 -39
- package/scripts/postInstall.js +7 -6
- package/templates/init/functions/java/integ/cliq/com/handlers/BotHandler.java +21 -3
- package/{docs → templates/init/functions/node/integ/cliq}/.DS_Store +0 -0
- package/templates/init/functions/node/integ/cliq/handlers/bot-handler.js +21 -5
- package/templates/init/functions/node/integ/cliq/handlers/command-handler.js +3 -3
- package/templates/init/functions/node/integ/cliq/package.json +2 -1
- package/templates/init/functions/node/integ/cliq/sample.js +3 -1
- package/lib/serve/server/lib/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
|
@@ -8,28 +8,28 @@ const dc_js_1 = require("../../../dc.js");
|
|
|
8
8
|
const dc_type_js_1 = __importDefault(require("./dc-type.js"));
|
|
9
9
|
class URL {
|
|
10
10
|
static get auth() {
|
|
11
|
-
const dc = dc_js_1.getActiveDCType();
|
|
11
|
+
const dc = (0, dc_js_1.getActiveDCType)();
|
|
12
12
|
if (dc === undefined) {
|
|
13
13
|
return URL._auth;
|
|
14
14
|
}
|
|
15
15
|
return URL._auth.replace('.com', dc.ext);
|
|
16
16
|
}
|
|
17
17
|
static get admin() {
|
|
18
|
-
const dc = dc_js_1.getActiveDCType();
|
|
18
|
+
const dc = (0, dc_js_1.getActiveDCType)();
|
|
19
19
|
if (dc === undefined) {
|
|
20
20
|
return URL._admin;
|
|
21
21
|
}
|
|
22
22
|
return URL._admin.replace('.com', dc.ext);
|
|
23
23
|
}
|
|
24
24
|
static get app() {
|
|
25
|
-
const dc = dc_js_1.getActiveDCType();
|
|
25
|
+
const dc = (0, dc_js_1.getActiveDCType)();
|
|
26
26
|
if (dc === undefined) {
|
|
27
27
|
return URL._app;
|
|
28
28
|
}
|
|
29
29
|
return URL._app.replace('.com', dc.ext);
|
|
30
30
|
}
|
|
31
31
|
static get catalystStatic() {
|
|
32
|
-
const dc = dc_js_1.getActiveDCType();
|
|
32
|
+
const dc = (0, dc_js_1.getActiveDCType)();
|
|
33
33
|
if (dc === undefined) {
|
|
34
34
|
return URL._catalystStatic;
|
|
35
35
|
}
|
|
@@ -39,7 +39,7 @@ class URL {
|
|
|
39
39
|
return URL._catalystStatic.replace('.com', dc.ext);
|
|
40
40
|
}
|
|
41
41
|
static get console() {
|
|
42
|
-
const dc = dc_js_1.getActiveDCType();
|
|
42
|
+
const dc = (0, dc_js_1.getActiveDCType)();
|
|
43
43
|
if (dc === undefined) {
|
|
44
44
|
return URL._console;
|
|
45
45
|
}
|
|
@@ -47,9 +47,9 @@ class URL {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
exports.default = URL;
|
|
50
|
-
URL._auth = env_js_1.envOverride('CATALYST_AUTH_URL', 'https://accounts.zoho.com');
|
|
51
|
-
URL._admin = env_js_1.envOverride('CATALYST_ADMIN_URL', 'https://api.catalyst.zoho.com');
|
|
52
|
-
URL._app = env_js_1.envOverride('CATALYST_APP_URL', 'https://catalystserverless.com');
|
|
53
|
-
URL._zohoStatic = env_js_1.envOverride('ZOHO_STATIC', 'https://www.zoho.com/catalyst');
|
|
54
|
-
URL._catalystStatic = env_js_1.envOverride('CATALYST_STATIC', 'https://catalyst.zoho.com');
|
|
55
|
-
URL._console = env_js_1.envOverride('CATALYST_CONSOLE_URL', 'https://console.catalyst.zoho.com');
|
|
50
|
+
URL._auth = (0, env_js_1.envOverride)('CATALYST_AUTH_URL', 'https://accounts.zoho.com');
|
|
51
|
+
URL._admin = (0, env_js_1.envOverride)('CATALYST_ADMIN_URL', 'https://api.catalyst.zoho.com');
|
|
52
|
+
URL._app = (0, env_js_1.envOverride)('CATALYST_APP_URL', 'https://catalystserverless.com');
|
|
53
|
+
URL._zohoStatic = (0, env_js_1.envOverride)('ZOHO_STATIC', 'https://www.zoho.com/catalyst');
|
|
54
|
+
URL._catalystStatic = (0, env_js_1.envOverride)('CATALYST_STATIC', 'https://catalyst.zoho.com');
|
|
55
|
+
URL._console = (0, env_js_1.envOverride)('CATALYST_CONSOLE_URL', 'https://console.catalyst.zoho.com');
|
|
@@ -13,7 +13,7 @@ function help() {
|
|
|
13
13
|
let exitCode = 0;
|
|
14
14
|
const logs = runtime_store_1.default.get('log');
|
|
15
15
|
if (logs === undefined) {
|
|
16
|
-
logger_1.debug('NO ERRORS REGISTERED');
|
|
16
|
+
(0, logger_1.debug)('NO ERRORS REGISTERED');
|
|
17
17
|
return exitCode;
|
|
18
18
|
}
|
|
19
19
|
const logKeys = Object.keys(logs);
|
|
@@ -34,9 +34,9 @@ function help() {
|
|
|
34
34
|
return;
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
const docPath = key.replace(path_1.join(__dirname, '../../lib'), path_1.join(__dirname, '../../docs')) + '.toml';
|
|
37
|
+
const docPath = key.replace((0, path_1.join)(__dirname, '../../lib'), (0, path_1.join)(__dirname, '../../docs')) + '.toml';
|
|
38
38
|
const doc = fs_1.SYNC.readFile(docPath) || '';
|
|
39
|
-
const catHelp = toml_1.default(doc);
|
|
39
|
+
const catHelp = (0, toml_1.default)(doc);
|
|
40
40
|
errQueue.forEach((err) => {
|
|
41
41
|
exitCode = err.exit > exitCode ? err.exit : exitCode;
|
|
42
42
|
if (err.errorId === undefined || catHelp === undefined || catHelp === {}) {
|
|
@@ -46,18 +46,18 @@ function help() {
|
|
|
46
46
|
const arg = err.arg || [];
|
|
47
47
|
const helpTemplate = catHelp[err.errorId];
|
|
48
48
|
if (helpTemplate === undefined || helpTemplate.context === undefined) {
|
|
49
|
-
logger_1.debug('Error when fetching the help');
|
|
50
|
-
logger_1.debug('No Help found for errorId: ' + err.errorId);
|
|
49
|
+
(0, logger_1.debug)('Error when fetching the help');
|
|
50
|
+
(0, logger_1.debug)('No Help found for errorId: ' + err.errorId);
|
|
51
51
|
outputError(err, errQueue);
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
const help = fillTemplate(helpTemplate.context, helpTemplate.aid || '', ...arg);
|
|
55
|
-
logger_1.info();
|
|
56
|
-
logger_1.labeled(ansi_colors_1.bold('Error'), help.context).ERROR();
|
|
55
|
+
(0, logger_1.info)();
|
|
56
|
+
(0, logger_1.labeled)((0, ansi_colors_1.bold)('Error'), help.context).ERROR();
|
|
57
57
|
debugLog(err);
|
|
58
|
-
logger_1.log('error', help.aid);
|
|
58
|
+
(0, logger_1.log)('error', help.aid);
|
|
59
59
|
if (helpTemplate.link && helpTemplate.link !== '') {
|
|
60
|
-
logger_1.log('error', ansi_colors_1.bold(ansi_colors_1.blue('REF: ') + ansi_colors_1.underline(helpTemplate.link)));
|
|
60
|
+
(0, logger_1.log)('error', (0, ansi_colors_1.bold)((0, ansi_colors_1.blue)('REF: ') + (0, ansi_colors_1.underline)(helpTemplate.link)));
|
|
61
61
|
}
|
|
62
62
|
errQueue.shift();
|
|
63
63
|
});
|
|
@@ -66,23 +66,23 @@ function help() {
|
|
|
66
66
|
}
|
|
67
67
|
exports.default = help;
|
|
68
68
|
function outputError(err, errQueue) {
|
|
69
|
-
logger_1.error(err.message);
|
|
69
|
+
(0, logger_1.error)(err.message);
|
|
70
70
|
debugLog(err);
|
|
71
71
|
errQueue.shift();
|
|
72
72
|
if (err.exit === 2) {
|
|
73
|
-
logger_1.info(`Kindly contact Catalyst support [${ansi_colors_1.bold.underline('support@zohocatalyst.com')}] if you need any further assistance`);
|
|
73
|
+
(0, logger_1.info)(`Kindly contact Catalyst support [${ansi_colors_1.bold.underline('support@zohocatalyst.com')}] if you need any further assistance`);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
function debugLog(err) {
|
|
77
|
-
logger_1.debug('Error Stack: ' + err.stack);
|
|
77
|
+
(0, logger_1.debug)('Error Stack: ' + err.stack);
|
|
78
78
|
if (err.original) {
|
|
79
|
-
logger_1.debug('Original Error: ' +
|
|
79
|
+
(0, logger_1.debug)('Original Error: ' +
|
|
80
80
|
(typeof err.original === 'string' ? err.original : err.original.stack));
|
|
81
81
|
}
|
|
82
82
|
if (err.context) {
|
|
83
|
-
logger_1.debug('Error Context: ' + JSON.stringify(err.context, undefined, 2));
|
|
83
|
+
(0, logger_1.debug)('Error Context: ' + JSON.stringify(err.context, undefined, 2));
|
|
84
84
|
}
|
|
85
85
|
if (err.status) {
|
|
86
|
-
logger_1.debug('Error Status: ' + err.status);
|
|
86
|
+
(0, logger_1.debug)('Error Status: ' + err.status);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -20,14 +20,14 @@ const path_1 = __importDefault(require("path"));
|
|
|
20
20
|
const utils_js_1 = require("../utils.js");
|
|
21
21
|
function dirExists(pth) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const stats = yield fs_extra_1.default.stat(utils_js_1.untildify(pth)).catch(() => false);
|
|
23
|
+
const stats = yield fs_extra_1.default.stat((0, utils_js_1.untildify)(pth)).catch(() => false);
|
|
24
24
|
return stats && stats.isDirectory();
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
exports.dirExists = dirExists;
|
|
28
28
|
function fileExists(pth) {
|
|
29
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
const stats = yield fs_extra_1.default.stat(utils_js_1.untildify(pth)).catch(() => false);
|
|
30
|
+
const stats = yield fs_extra_1.default.stat((0, utils_js_1.untildify)(pth)).catch(() => false);
|
|
31
31
|
return stats && stats.isFile();
|
|
32
32
|
});
|
|
33
33
|
}
|
|
@@ -89,7 +89,7 @@ function walk(dir, { exclude = [], excludeDir = true, depth = -1 } = {}) {
|
|
|
89
89
|
let excludeMatch = false;
|
|
90
90
|
if (!(isEntryPthDir && !excludeDir)) {
|
|
91
91
|
for (const glob of exclude) {
|
|
92
|
-
excludeMatch = excludeMatch || minimatch_1.default(entryPath, glob);
|
|
92
|
+
excludeMatch = excludeMatch || (0, minimatch_1.default)(entryPath, glob);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
if (excludeMatch) {
|
|
@@ -171,7 +171,7 @@ function rename(pth, modifier = (baseName) => baseName) {
|
|
|
171
171
|
exports.rename = rename;
|
|
172
172
|
const findAndReplace = (pth) => (templates, finalWords) => __awaiter(void 0, void 0, void 0, function* () {
|
|
173
173
|
if (Array.isArray(pth)) {
|
|
174
|
-
yield Promise.all(pth.map((el) => exports.findAndReplace(el)(templates, finalWords)));
|
|
174
|
+
yield Promise.all(pth.map((el) => (0, exports.findAndReplace)(el)(templates, finalWords)));
|
|
175
175
|
return;
|
|
176
176
|
}
|
|
177
177
|
const files = yield walk(pth);
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.untildify = void 0;
|
|
4
4
|
const os_1 = require("os");
|
|
5
5
|
const tildRegex = /^~(?=$|\/|\\)/;
|
|
6
|
-
const homeDirectory = os_1.homedir();
|
|
6
|
+
const homeDirectory = (0, os_1.homedir)();
|
|
7
7
|
const untildify = (pth) => homeDirectory ? pth.replace(tildRegex, homeDirectory) : pth;
|
|
8
8
|
exports.untildify = untildify;
|
|
@@ -13,11 +13,11 @@ function log(level, message, ...meta) {
|
|
|
13
13
|
}
|
|
14
14
|
exports.log = log;
|
|
15
15
|
function info(msg = '', ...params) {
|
|
16
|
-
winston_1.default.info(util_1.format(msg, ...params));
|
|
16
|
+
winston_1.default.info((0, util_1.format)(msg, ...params));
|
|
17
17
|
}
|
|
18
18
|
exports.info = info;
|
|
19
19
|
function debug(msg = '', ...params) {
|
|
20
|
-
winston_1.default.debug(util_1.format(msg, ...params));
|
|
20
|
+
winston_1.default.debug((0, util_1.format)(msg, ...params));
|
|
21
21
|
}
|
|
22
22
|
exports.debug = debug;
|
|
23
23
|
function success(msg, level = 'info', label = '') {
|
|
@@ -7,7 +7,7 @@ const toml_1 = require("toml");
|
|
|
7
7
|
const error_1 = __importDefault(require("../../error"));
|
|
8
8
|
exports.default = (str) => {
|
|
9
9
|
try {
|
|
10
|
-
return toml_1.parse(str);
|
|
10
|
+
return (0, toml_1.parse)(str);
|
|
11
11
|
}
|
|
12
12
|
catch (e) {
|
|
13
13
|
const err = error_1.default.getErrorInstance(e, {
|
|
@@ -27,7 +27,7 @@ function getDefaultProject(throwError) {
|
|
|
27
27
|
throw new error_1.default(constants_1.FILENAME.rc + ' file needed', {
|
|
28
28
|
exit: 1,
|
|
29
29
|
errorId: 'PROJ-1',
|
|
30
|
-
arg: [constants_1.FILENAME.rc, ansi_colors_1.bold('catalyst init project')]
|
|
30
|
+
arg: [constants_1.FILENAME.rc, (0, ansi_colors_1.bold)('catalyst init project')]
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
return;
|
|
@@ -41,7 +41,7 @@ function getDefaultEnv(throwError) {
|
|
|
41
41
|
throw new error_1.default(constants_1.FILENAME.rc + ' file needed', {
|
|
42
42
|
exit: 1,
|
|
43
43
|
errorId: 'PROJ-1',
|
|
44
|
-
arg: [constants_1.FILENAME.rc, ansi_colors_1.bold('catalyst init project')]
|
|
44
|
+
arg: [constants_1.FILENAME.rc, (0, ansi_colors_1.bold)('catalyst init project')]
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
return;
|
|
@@ -55,7 +55,7 @@ function getProjectId(fallback) {
|
|
|
55
55
|
throw new error_1.default('ProjectId is needed', {
|
|
56
56
|
exit: 1,
|
|
57
57
|
errorId: 'PROJ-2',
|
|
58
|
-
arg: ['Project ID', ansi_colors_1.bold('catalyst init project --force')]
|
|
58
|
+
arg: ['Project ID', (0, ansi_colors_1.bold)('catalyst init project --force')]
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
return fallback;
|
|
@@ -70,7 +70,7 @@ function getProjectName(fallback) {
|
|
|
70
70
|
throw new error_1.default('ProjectName is needed', {
|
|
71
71
|
exit: 1,
|
|
72
72
|
errorId: 'PROJ-2',
|
|
73
|
-
arg: ['Project Name', ansi_colors_1.bold('catalyst init project --force')]
|
|
73
|
+
arg: ['Project Name', (0, ansi_colors_1.bold)('catalyst init project --force')]
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
return fallback;
|
|
@@ -89,7 +89,7 @@ function getDomainPrefix(fallback) {
|
|
|
89
89
|
throw new error_1.default('domainName is needed', {
|
|
90
90
|
exit: 1,
|
|
91
91
|
errorId: 'PROJ-2',
|
|
92
|
-
arg: ['Domain Name', ansi_colors_1.bold('catalyst init project --force')]
|
|
92
|
+
arg: ['Domain Name', (0, ansi_colors_1.bold)('catalyst init project --force')]
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
95
|
return fallback;
|
|
@@ -104,7 +104,7 @@ function getDomainKey(fallback) {
|
|
|
104
104
|
throw new error_1.default('domainId is needed', {
|
|
105
105
|
exit: 1,
|
|
106
106
|
errorId: 'PROJ-2',
|
|
107
|
-
arg: ['Domain ID', ansi_colors_1.bold('catalyst init project --force')]
|
|
107
|
+
arg: ['Domain ID', (0, ansi_colors_1.bold)('catalyst init project --force')]
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
110
|
return fallback;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ConnectionDestroyer = void 0;
|
|
16
|
+
const http_proxy_1 = __importDefault(require("http-proxy"));
|
|
17
|
+
class ConnectionDestroyer {
|
|
18
|
+
constructor(server) {
|
|
19
|
+
this.server = server;
|
|
20
|
+
this.connections = new Set();
|
|
21
|
+
if (this.server instanceof http_proxy_1.default) {
|
|
22
|
+
this.server.on('proxyReq', (req) => {
|
|
23
|
+
req.on('finish', () => this.connections.delete(req));
|
|
24
|
+
this.connections.add(req);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
this.server.on('connection', (sock) => {
|
|
29
|
+
sock.on('close', () => this.connections.delete(sock));
|
|
30
|
+
this.connections.add(sock);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
destroy(terminate = true, err) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
this.connections.forEach((sock) => {
|
|
38
|
+
sock.destroy(err);
|
|
39
|
+
});
|
|
40
|
+
if (terminate) {
|
|
41
|
+
if (this.server instanceof http_proxy_1.default) {
|
|
42
|
+
return this.server.close(() => resolve());
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
return this.server.close((err) => err instanceof Error ? reject(err) : resolve());
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
resolve();
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.ConnectionDestroyer = ConnectionDestroyer;
|
|
@@ -45,7 +45,7 @@ function spawn(command, opts, _a = {}) {
|
|
|
45
45
|
return {
|
|
46
46
|
SYNC: () => cross_spawn_1.default.sync(command, opts, Object.assign({ cwd, stdio, shell }, otherOpts)),
|
|
47
47
|
ASYNC: () => {
|
|
48
|
-
const childProcess = cross_spawn_1.default(command, opts, Object.assign({ cwd,
|
|
48
|
+
const childProcess = (0, cross_spawn_1.default)(command, opts, Object.assign({ cwd,
|
|
49
49
|
stdio,
|
|
50
50
|
shell }, otherOpts));
|
|
51
51
|
return new Promise((res, rej) => {
|
|
@@ -68,7 +68,7 @@ function spawn(command, opts, _a = {}) {
|
|
|
68
68
|
});
|
|
69
69
|
},
|
|
70
70
|
RAW: () => {
|
|
71
|
-
const child = cross_spawn_1.default(command, opts, Object.assign({ cwd, stdio, shell }, otherOpts)).on('error', logger_1.debug);
|
|
71
|
+
const child = (0, cross_spawn_1.default)(command, opts, Object.assign({ cwd, stdio, shell }, otherOpts)).on('error', logger_1.debug);
|
|
72
72
|
return child;
|
|
73
73
|
}
|
|
74
74
|
};
|
|
@@ -98,7 +98,7 @@ function which(commandName, { alwaysResolve = true }) {
|
|
|
98
98
|
if (/[\x00-\x1f<>:"|?*]/.test(commandName)) {
|
|
99
99
|
alwaysResolve ? resolve(false) : reject('controll char test failed');
|
|
100
100
|
}
|
|
101
|
-
child_process_1.exec('where ' + cleanedCmd, (error) => {
|
|
101
|
+
(0, child_process_1.exec)('where ' + cleanedCmd, (error) => {
|
|
102
102
|
if (error !== null) {
|
|
103
103
|
alwaysResolve ? resolve(false) : reject(error);
|
|
104
104
|
}
|
|
@@ -108,7 +108,7 @@ function which(commandName, { alwaysResolve = true }) {
|
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
110
|
else {
|
|
111
|
-
child_process_1.exec('command -v ' +
|
|
111
|
+
(0, child_process_1.exec)('command -v ' +
|
|
112
112
|
cleanedCmd +
|
|
113
113
|
' 2>/dev/null' +
|
|
114
114
|
' && { echo >&1 ' +
|
package/lib/winston.js
CHANGED
|
@@ -27,15 +27,15 @@ exports.transport = {
|
|
|
27
27
|
handleExceptions: true,
|
|
28
28
|
tailable: true,
|
|
29
29
|
format: winston_1.format.combine(winston_1.format.printf((info) => {
|
|
30
|
-
return `[${info.level}] [${new Date().toISOString()}] : ${strip_ansi_1.default(info.message)}`;
|
|
30
|
+
return `[${info.level}] [${new Date().toISOString()}] : ${(0, strip_ansi_1.default)(info.message)}`;
|
|
31
31
|
}))
|
|
32
32
|
}),
|
|
33
33
|
http_log: new winston_1.transports.File({
|
|
34
34
|
filename: fs_1.SYNC.tempFile(constants_1.FILENAME.http_log),
|
|
35
35
|
level: 'debug',
|
|
36
36
|
handleExceptions: true,
|
|
37
|
-
format: winston_1.format.combine(winston_1.format((info) => {
|
|
38
|
-
info.message = strip_ansi_1.default(info.message);
|
|
37
|
+
format: winston_1.format.combine((0, winston_1.format)((info) => {
|
|
38
|
+
info.message = (0, strip_ansi_1.default)(info.message);
|
|
39
39
|
return info.message === '' || info.level === 'info' ? false : info;
|
|
40
40
|
})(), winston_1.format.json(), winston_1.format.label({
|
|
41
41
|
label: 'CatalystCLI/' + version
|
|
@@ -56,11 +56,11 @@ if (process.env.DEBUG || process.argv.slice(2).includes('--verbose')) {
|
|
|
56
56
|
return `[${info.timestamp}] ${info.level}: ${info.message}`;
|
|
57
57
|
}));
|
|
58
58
|
}
|
|
59
|
-
exports.logger = winston_1.createLogger({
|
|
59
|
+
exports.logger = (0, winston_1.createLogger)({
|
|
60
60
|
transports: [exports.transport.console],
|
|
61
61
|
exitOnError: false
|
|
62
62
|
});
|
|
63
|
-
if (env_1.isWindows || env_1.isPrimaryShell()) {
|
|
63
|
+
if (env_1.isWindows || (0, env_1.isPrimaryShell)()) {
|
|
64
64
|
if (usage) {
|
|
65
65
|
exports.logger.add(exports.transport.http_log);
|
|
66
66
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zcatalyst-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.1",
|
|
4
4
|
"description": "Command Line Tool for CATALYST",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"catalyst": "./lib/bin/catalyst.js"
|
|
8
8
|
},
|
|
9
9
|
"engines": {
|
|
10
|
-
"node": ">=
|
|
10
|
+
"node": ">=14.0.0"
|
|
11
11
|
},
|
|
12
12
|
"preferGlobal": true,
|
|
13
13
|
"keywords": [
|
|
@@ -28,34 +28,34 @@
|
|
|
28
28
|
"ansi-colors": "^4.1.1",
|
|
29
29
|
"app-module-path": "^2.2.0",
|
|
30
30
|
"better-queue": "^3.8.10",
|
|
31
|
-
"chokidar": "^3.5.
|
|
31
|
+
"chokidar": "^3.5.3",
|
|
32
32
|
"cli-cursor": "^3.1.0",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"conf": "^10.0.2",
|
|
33
|
+
"commander": "^9.2.0",
|
|
34
|
+
"conf": "^10.1.2",
|
|
36
35
|
"cross-spawn": "^7.0.3",
|
|
37
|
-
"express": "^4.17.
|
|
38
|
-
"fs-extra": "^10.
|
|
36
|
+
"express": "^4.17.3",
|
|
37
|
+
"fs-extra": "^10.1.0",
|
|
39
38
|
"fuzzy": "^0.1.3",
|
|
40
39
|
"http-proxy": "^1.18.1",
|
|
41
|
-
"inquirer": "^8.
|
|
42
|
-
"inquirer-autocomplete-prompt": "^
|
|
43
|
-
"jszip": "^3.
|
|
40
|
+
"inquirer": "^8.2.2",
|
|
41
|
+
"inquirer-autocomplete-prompt": "^2.0.0",
|
|
42
|
+
"jszip": "^3.9.1",
|
|
44
43
|
"lodash": "^4.17.21",
|
|
45
|
-
"minimatch": "^
|
|
46
|
-
"moment": "^2.29.
|
|
47
|
-
"open": "^8.
|
|
44
|
+
"minimatch": "^5.0.1",
|
|
45
|
+
"moment": "^2.29.3",
|
|
46
|
+
"open": "^8.4.0",
|
|
48
47
|
"portfinder": "^1.0.28",
|
|
49
48
|
"pretty-ms": "^7.0.1",
|
|
50
49
|
"request": "^2.88.2",
|
|
51
|
-
"semver": "^7.3.
|
|
52
|
-
"
|
|
50
|
+
"semver": "^7.3.7",
|
|
51
|
+
"string-width": "^4.2.3",
|
|
52
|
+
"strip-ansi": "^6.0.1",
|
|
53
53
|
"toml": "^3.0.0",
|
|
54
54
|
"update-notifier": "^5.1.0",
|
|
55
|
-
"winston": "^3.
|
|
56
|
-
"ws": "^8.
|
|
55
|
+
"winston": "^3.7.2",
|
|
56
|
+
"ws": "^8.5.0",
|
|
57
57
|
"xml2js": "^0.4.23",
|
|
58
|
-
"yaml": "^
|
|
58
|
+
"yaml": "^2.0.1",
|
|
59
59
|
"zcatalyst-angular-schematics": "^0.1.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
@@ -63,30 +63,30 @@
|
|
|
63
63
|
"@types/better-queue": "^3.8.3",
|
|
64
64
|
"@types/cross-spawn": "^6.0.2",
|
|
65
65
|
"@types/express": "^4.17.13",
|
|
66
|
-
"@types/fs-extra": "^9.0.
|
|
67
|
-
"@types/http-proxy": "^1.17.
|
|
68
|
-
"@types/inquirer": "^
|
|
69
|
-
"@types/inquirer-autocomplete-prompt": "^1.3.
|
|
70
|
-
"@types/jest": "^
|
|
71
|
-
"@types/lodash": "^4.14.
|
|
66
|
+
"@types/fs-extra": "^9.0.13",
|
|
67
|
+
"@types/http-proxy": "^1.17.8",
|
|
68
|
+
"@types/inquirer": "^8.2.1",
|
|
69
|
+
"@types/inquirer-autocomplete-prompt": "^1.3.4",
|
|
70
|
+
"@types/jest": "^27.4.1",
|
|
71
|
+
"@types/lodash": "^4.14.182",
|
|
72
72
|
"@types/minimatch": "^3.0.5",
|
|
73
|
-
"@types/node": "^
|
|
74
|
-
"@types/request": "^2.48.
|
|
75
|
-
"@types/semver": "^7.3.
|
|
73
|
+
"@types/node": "^17.0.25",
|
|
74
|
+
"@types/request": "^2.48.8",
|
|
75
|
+
"@types/semver": "^7.3.9",
|
|
76
76
|
"@types/update-notifier": "^5.1.0",
|
|
77
|
-
"@types/ws": "^8.
|
|
78
|
-
"@types/xml2js": "^0.4.
|
|
79
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
80
|
-
"@typescript-eslint/parser": "^
|
|
81
|
-
"eslint": "^
|
|
82
|
-
"eslint-config-prettier": "^8.
|
|
83
|
-
"eslint-plugin-prettier": "^
|
|
77
|
+
"@types/ws": "^8.5.3",
|
|
78
|
+
"@types/xml2js": "^0.4.11",
|
|
79
|
+
"@typescript-eslint/eslint-plugin": "^5.20.0",
|
|
80
|
+
"@typescript-eslint/parser": "^5.20.0",
|
|
81
|
+
"eslint": "^8.13.0",
|
|
82
|
+
"eslint-config-prettier": "^8.5.0",
|
|
83
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
84
84
|
"gulp": "^4.0.2",
|
|
85
|
-
"jest": "^27.
|
|
85
|
+
"jest": "^27.5.1",
|
|
86
86
|
"npm-run-all": "^4.1.5",
|
|
87
|
-
"prettier": "^2.
|
|
88
|
-
"ts-jest": "^27.
|
|
89
|
-
"typescript": "^4.3
|
|
87
|
+
"prettier": "^2.6.2",
|
|
88
|
+
"ts-jest": "^27.1.4",
|
|
89
|
+
"typescript": "^4.6.3"
|
|
90
90
|
},
|
|
91
91
|
"scripts": {
|
|
92
92
|
"build": "gulp build",
|
package/scripts/postInstall.js
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
try {
|
|
8
8
|
const semver = require('semver');
|
|
9
9
|
const ansi = require('ansi-colors');
|
|
10
|
-
const cliTable = require('
|
|
10
|
+
const cliTable = require('../lib/cli_table');
|
|
11
11
|
const packageJson = require('../package.json');
|
|
12
12
|
|
|
13
13
|
if (semver.satisfies(process.version, packageJson.engines.node)) {
|
|
14
14
|
console.log(ansi.green.bold('Installation successful.'));
|
|
15
|
-
|
|
15
|
+
process.exit(0);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
const table = new cliTable({ style: { border: [], header: [] } });
|
|
@@ -24,8 +24,9 @@ try {
|
|
|
24
24
|
'Compatible version: ': [ansi.green(packageJson.engines.node)]
|
|
25
25
|
}
|
|
26
26
|
);
|
|
27
|
-
console.
|
|
28
|
-
console.
|
|
29
|
-
console.
|
|
30
|
-
console.
|
|
27
|
+
console.error(ansi.red('Node.js version is incompatible !!!'));
|
|
28
|
+
console.error(table.toString());
|
|
29
|
+
console.error('\n' + ansi.yellow.bold('Please update Node.js to a compatible version.'));
|
|
30
|
+
console.error(ansi.bold('Reference: ') + ansi.underline('https://nodejs.org/') + '\n');
|
|
31
|
+
process.exit(1);
|
|
31
32
|
} catch (err) {}
|
|
@@ -31,6 +31,7 @@ import com.zc.cliq.requests.BotParticipationHandlerRequest;
|
|
|
31
31
|
import com.zc.cliq.requests.BotWebhookHandlerRequest;
|
|
32
32
|
import com.zc.cliq.requests.BotWelcomeHandlerRequest;
|
|
33
33
|
import com.zc.cliq.util.ZCCliqUtil;
|
|
34
|
+
import com.zc.component.cache.ZCCache;
|
|
34
35
|
|
|
35
36
|
public class BotHandler implements com.zc.cliq.interfaces.BotHandler {
|
|
36
37
|
Logger LOGGER = Logger.getLogger(BotHandler.class.getName());
|
|
@@ -82,7 +83,13 @@ public class BotHandler implements com.zc.cliq.interfaces.BotHandler {
|
|
|
82
83
|
param2.addSuggestion("IT");
|
|
83
84
|
param2.addSuggestion("MECH");
|
|
84
85
|
|
|
85
|
-
|
|
86
|
+
BotContextParam param3 = BotContextParam.getInstance();
|
|
87
|
+
param3.setName("cache");
|
|
88
|
+
param3.setQuestion("Do you wish to put this detail in Catalyst Cache ?");
|
|
89
|
+
param3.addSuggestion("YES");
|
|
90
|
+
param3.addSuggestion("NO");
|
|
91
|
+
|
|
92
|
+
context.setParams(param1, param2, param3);
|
|
86
93
|
resp.put("context", context);
|
|
87
94
|
} else if (message.equalsIgnoreCase("button")) {
|
|
88
95
|
|
|
@@ -117,8 +124,19 @@ public class BotHandler implements com.zc.cliq.interfaces.BotHandler {
|
|
|
117
124
|
if (req.getContextId().equals("personal_details")) {
|
|
118
125
|
Map<String, String> answers = req.getAnswers();
|
|
119
126
|
StringBuilder str = new StringBuilder();
|
|
120
|
-
str.append("Name
|
|
121
|
-
str.append("Department
|
|
127
|
+
str.append("*Name*: ").append(answers.get("name")).append("\n");
|
|
128
|
+
str.append("*Department*: ").append(answers.get("dept")).append("\n");
|
|
129
|
+
|
|
130
|
+
if(answers.get("cache").equals("YES")) {
|
|
131
|
+
try {
|
|
132
|
+
ZCCache cache = ZCCache.getInstance();
|
|
133
|
+
cache.putCacheValue("Name", answers.get("name"), 1L);
|
|
134
|
+
cache.putCacheValue("Department", answers.get("dept"), 1L);
|
|
135
|
+
str.append("This data is now available in Catalyst Cache's default segment.");
|
|
136
|
+
} catch(Exception ex) {
|
|
137
|
+
System.out.print("Error putting the value to cache: " + ex.toString());
|
|
138
|
+
}
|
|
139
|
+
}
|
|
122
140
|
|
|
123
141
|
resp.put("text", "Nice ! I have collected your info: \n" + str.toString());
|
|
124
142
|
}
|
|
Binary file
|
|
@@ -46,8 +46,14 @@ botHandler.messageHandler(async (req, res) => {
|
|
|
46
46
|
param2.addSuggestion('CSE');
|
|
47
47
|
param2.addSuggestion('IT');
|
|
48
48
|
param2.addSuggestion('MECH');
|
|
49
|
+
|
|
50
|
+
const param3 = context.newParam();
|
|
51
|
+
param3.name = 'cache';
|
|
52
|
+
param3.question = "Do you wish to put this detail in Catalyst Cache ?"
|
|
53
|
+
param3.addSuggestion('YES');
|
|
54
|
+
param3.addSuggestion('NO');
|
|
49
55
|
|
|
50
|
-
context.addParams(param1, param2);
|
|
56
|
+
context.addParams(param1, param2, param3);
|
|
51
57
|
res.context = context;
|
|
52
58
|
}
|
|
53
59
|
else if (comp(msg, 'button')) {
|
|
@@ -77,13 +83,23 @@ botHandler.messageHandler(async (req, res) => {
|
|
|
77
83
|
}
|
|
78
84
|
});
|
|
79
85
|
|
|
80
|
-
botHandler.contextHandler(async (req, res) => {
|
|
86
|
+
botHandler.contextHandler(async (req, res, app) => {
|
|
81
87
|
if(req.context_id === 'personal_details') {
|
|
82
88
|
const answer = req.answers;
|
|
83
|
-
|
|
84
|
-
|
|
89
|
+
let text = `Nice! I have collected your info: \n*Name*: ${answer.name.text} \n*Department*: ${answer.dept.text}`
|
|
90
|
+
|
|
91
|
+
if(answer.cache.text === 'YES') {
|
|
92
|
+
try {
|
|
93
|
+
const segment = app.cache().segment();
|
|
94
|
+
await segment.put('Name', answer.name.text);
|
|
95
|
+
await segment.put('Department', answer.dept.text);
|
|
96
|
+
text += '\nThis data is now available in Catalyst Cache\'s default segment.'
|
|
97
|
+
} catch(err) {
|
|
98
|
+
console.error('Error putting value in cache', err);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
85
101
|
|
|
86
|
-
res.setText(
|
|
102
|
+
res.setText(text);
|
|
87
103
|
}
|
|
88
104
|
return res;
|
|
89
105
|
});
|