zcatalyst-cli 1.13.3 → 1.14.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/docs/client-utils.toml +6 -1
- package/docs/commands/ds/import.toml +5 -0
- package/docs/fn-utils/lib/python.toml +4 -0
- package/docs/init/dependencies/python/ensure-python.toml +12 -0
- package/docs/init/dependencies/python/pip-install.toml +4 -0
- package/docs/serve/index.toml +5 -0
- package/lib/authentication/login.js +2 -1
- package/lib/cli_table/index.js +26 -2
- package/lib/cli_table/src/cell.js +359 -267
- package/lib/cli_table/src/layout-manager.js +231 -209
- package/lib/cli_table/src/table.js +76 -60
- package/lib/cli_table/src/utils.js +259 -224
- package/lib/client-utils.js +18 -4
- package/lib/command_needs/rc.js +57 -8
- package/lib/commands/config/delete.js +23 -0
- package/lib/commands/config/get.js +23 -0
- package/lib/commands/config/list.js +23 -0
- package/lib/commands/config/set.js +29 -0
- package/lib/commands/console/cache.js +31 -1
- package/lib/commands/console/queue.js +31 -1
- package/lib/commands/console/zcql.js +27 -1
- package/lib/commands/ds/export.js +2 -2
- package/lib/commands/ds/import.js +25 -5
- package/lib/commands/ds/status.js +2 -2
- package/lib/commands/iac/export.js +1 -1
- package/lib/commands/iac/import.js +1 -1
- package/lib/commands/iac/pack.js +16 -5
- package/lib/commands/iac/status.js +1 -1
- package/lib/commands/index.js +4 -0
- package/lib/commands/project/list.js +1 -1
- package/lib/commands/project/use.js +1 -1
- package/lib/deploy/features/client.js +2 -2
- package/lib/deploy/features/functions/index.js +13 -3
- package/lib/deploy/features/functions/languages/index.js +19 -2
- package/lib/endpoints/index.js +12 -5
- package/lib/endpoints/lib/env.js +5 -2
- package/lib/endpoints/lib/functions.js +30 -0
- package/lib/endpoints/lib/org.js +35 -0
- package/lib/endpoints/lib/project.js +7 -3
- package/lib/express_middlewares/unknownReqProxy.js +4 -1
- package/lib/fn-utils/index.js +2 -0
- package/lib/fn-utils/lib/common.js +68 -7
- package/lib/fn-utils/lib/integ.js +15 -11
- package/lib/fn-utils/lib/java.js +7 -3
- package/lib/fn-utils/lib/python.js +121 -0
- package/lib/fn-watcher.js +10 -2
- package/lib/index.js +2 -1
- package/lib/init/dependencies/python/ensure-python.js +151 -0
- package/lib/init/dependencies/python/pip-install.js +189 -0
- package/lib/init/features/functions/index.js +50 -29
- package/lib/init/features/functions/languages/index.js +3 -1
- package/lib/init/features/functions/languages/python.js +115 -0
- package/lib/init/features/index.js +2 -2
- package/lib/init/features/project.js +26 -6
- package/lib/init/util/project.js +2 -2
- package/lib/internal/api.js +2 -0
- package/lib/internal/command.js +1 -1
- package/lib/internal/rc.js +2 -0
- package/lib/port-resolver.js +4 -3
- package/lib/prompt/types/file-path.js +1 -1
- package/lib/pull/features/functions/index.js +35 -2
- package/lib/pull/features/functions/languages.js +8 -1
- package/lib/readLineUtils.js +37 -1
- package/lib/readline/features/cache.js +175 -1
- package/lib/readline/features/index.js +7 -1
- package/lib/readline/features/queue.js +209 -1
- package/lib/readline/features/zcql.js +237 -1
- package/lib/readline/index.js +30 -1
- package/lib/serve/index.js +48 -7
- package/lib/serve/server/index.js +118 -44
- 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-function-sdk-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/master.js +18 -5
- package/lib/serve/server/lib/node.mjs +41 -0
- package/lib/serve/server/lib/web_client/index.js +7 -3
- package/lib/serve/server/lib/web_client/server.js +31 -15
- package/lib/shell/dependencies/http-functions.js +57 -21
- package/lib/shell/dependencies/invoker/bio/java/JavabioInvoker.java +1 -2
- package/lib/shell/dependencies/invoker/bio/node.mjs +127 -0
- package/lib/shell/dependencies/invoker/cron/java/JavacronInvoker.java +1 -1
- package/lib/shell/dependencies/invoker/cron/node.mjs +87 -0
- package/lib/shell/dependencies/invoker/event/java/JavaeventInvoker.java +3 -3
- package/lib/shell/dependencies/invoker/event/node.mjs +84 -0
- package/lib/shell/dependencies/invoker/integ/java/JavaintegInvoker.java +1 -1
- package/lib/shell/dependencies/invoker/integ/node.mjs +88 -0
- package/lib/shell/dependencies/local-function.js +74 -22
- package/lib/shell/index.js +11 -2
- package/lib/shell/prepare/index.js +21 -0
- package/lib/shell/prepare/languages/index.js +8 -2
- package/lib/shell/prepare/languages/java.js +39 -2
- package/lib/shell/prepare/languages/node.js +21 -2
- package/lib/shell/prepare/languages/python.js +65 -0
- package/lib/throbber/index.js +3 -1
- package/lib/userConfig.js +48 -0
- package/lib/util_modules/constants/index.js +3 -1
- package/lib/util_modules/constants/lib/apig-rules.js +8 -0
- package/lib/util_modules/constants/lib/cliq-handlers.js +17 -1
- package/lib/util_modules/constants/lib/dc-type.js +8 -0
- package/lib/util_modules/constants/lib/default.js +2 -2
- package/lib/util_modules/constants/lib/env-path.js +12 -0
- package/lib/util_modules/constants/lib/file-names.js +4 -1
- package/lib/util_modules/constants/lib/folder-names.js +3 -1
- package/lib/util_modules/constants/lib/placeholders.js +6 -1
- package/lib/util_modules/constants/lib/runtime.js +2 -1
- package/lib/util_modules/constants/lib/scopes.js +1 -0
- package/lib/util_modules/constants/lib/template.js +9 -0
- package/lib/util_modules/constants/lib/urls.js +2 -6
- package/lib/util_modules/context-help.js +2 -0
- package/lib/util_modules/fs/lib/async.js +35 -11
- package/lib/util_modules/project.js +20 -1
- package/package.json +2 -1
- package/templates/init/functions/java/aio/catalyst-config.json +3 -2
- package/templates/init/functions/java/bio/catalyst-config.json +3 -2
- package/templates/init/functions/java/cron/catalyst-config.json +3 -2
- package/templates/init/functions/java/event/catalyst-config.json +3 -2
- package/templates/init/functions/java/integ/cliq/catalyst-config.json +1 -0
- package/templates/init/functions/node/aio/catalyst-config.json +3 -2
- package/templates/init/functions/node/bio/catalyst-config.json +3 -2
- package/templates/init/functions/node/cron/catalyst-config.json +3 -2
- package/templates/init/functions/node/event/catalyst-config.json +3 -2
- package/templates/init/functions/node/integ/cliq/catalyst-config.json +1 -0
- package/templates/init/functions/node/integ/cliq/handlers/bot-handler.js +2 -2
- package/templates/init/functions/node/integ/cliq/handlers/command-handler.js +1 -2
- package/templates/init/functions/node/integ/cliq/handlers/function-handler.js +1 -1
- package/templates/init/functions/node/integ/cliq/handlers/installation-handler.js +1 -1
- package/templates/init/functions/node/integ/cliq/handlers/installation-validator.js +1 -1
- package/templates/init/functions/node/integ/cliq/handlers/message-action-handler.js +1 -1
- package/templates/init/functions/node/integ/cliq/handlers/widget-handler.js +1 -1
- package/templates/init/functions/node/integ/cliq/sample.js +4 -4
- package/templates/init/functions/python/aio/catalyst-config.json +11 -0
- package/templates/init/functions/python/aio/requirements.txt +1 -0
- package/templates/init/functions/python/aio/sample.py +26 -0
- package/templates/init/functions/python/bio/catalyst-config.json +11 -0
- package/templates/init/functions/python/bio/requirements.txt +1 -0
- package/templates/init/functions/python/bio/sample.py +6 -0
- package/templates/init/functions/python/cron/catalyst-config.json +11 -0
- package/templates/init/functions/python/cron/requirements.txt +1 -0
- package/templates/init/functions/python/cron/sample.py +18 -0
- package/templates/init/functions/python/event/catalyst-config.json +11 -0
- package/templates/init/functions/python/event/requirements.txt +1 -0
- package/templates/init/functions/python/event/sample.py +21 -0
- package/templates/init/functions/python/integ/cliq/catalyst-config.json +11 -0
- package/templates/init/functions/python/integ/cliq/handlers/bot_handler.py +174 -0
- package/templates/init/functions/python/integ/cliq/handlers/command_handler.py +102 -0
- package/templates/init/functions/python/integ/cliq/handlers/function_handler.py +409 -0
- package/templates/init/functions/python/integ/cliq/handlers/installation_handler.py +12 -0
- package/templates/init/functions/python/integ/cliq/handlers/installation_validator.py +16 -0
- package/templates/init/functions/python/integ/cliq/handlers/message_action_handler.py +18 -0
- package/templates/init/functions/python/integ/cliq/handlers/widget_handler.py +269 -0
- package/templates/init/functions/python/integ/cliq/requirements.txt +1 -0
- package/templates/init/functions/python/integ/cliq/sample.py +21 -0
- package/lib/serve/server/lib/node.js +0 -62
- package/lib/shell/dependencies/invoker/bio/node.js +0 -80
- package/lib/shell/dependencies/invoker/cron/node.js +0 -54
- package/lib/shell/dependencies/invoker/event/node.js +0 -56
- package/lib/shell/dependencies/invoker/integ/node.js +0 -79
- package/templates/.DS_Store +0 -0
- package/templates/init/.DS_Store +0 -0
- package/templates/init/client/.DS_Store +0 -0
- package/templates/init/client/react/.DS_Store +0 -0
- package/templates/init/functions/node/integ/cliq/.DS_Store +0 -0
|
@@ -14,7 +14,12 @@ exports.default = Object.freeze({
|
|
|
14
14
|
author: '{{_AUTHOR_}}'
|
|
15
15
|
},
|
|
16
16
|
java_class: '{{_CLASS_}}',
|
|
17
|
-
java_name: '{{_NAME_}}'
|
|
17
|
+
java_name: '{{_NAME_}}',
|
|
18
|
+
python_package: {
|
|
19
|
+
name: '{{_NAME_}}',
|
|
20
|
+
main: '{{_MAIN_}}',
|
|
21
|
+
sdkVersion: '{{_VERSION_}}'
|
|
22
|
+
}
|
|
18
23
|
},
|
|
19
24
|
catalyst_config: {
|
|
20
25
|
type: '{{_TYPE_}}',
|
|
@@ -26,6 +26,7 @@ exports.default = Object.freeze({
|
|
|
26
26
|
project_user_read: 'ZohoCatalyst.projects.users.READ',
|
|
27
27
|
project_user_create: 'ZohoCatalyst.projects.users.CREATE',
|
|
28
28
|
project_user_delete: 'ZohoCatalyst.projects.users.DELETE',
|
|
29
|
+
project_user_update: 'ZohoCatalyst.projects.users.UPDATE',
|
|
29
30
|
email_send: 'ZohoCatalyst.email.CREATE',
|
|
30
31
|
datastore: 'ZohoCatalyst.tables.ALL',
|
|
31
32
|
row: 'ZohoCatalyst.tables.rows.ALL',
|
|
@@ -39,6 +39,15 @@ exports.default = Object.freeze({
|
|
|
39
39
|
integ: {
|
|
40
40
|
[constants_1.INTEG.services.cliq]: (0, path_1.join)(TEMPLATE_ROOT, 'init', 'functions', 'java', 'integ', 'cliq')
|
|
41
41
|
}
|
|
42
|
+
},
|
|
43
|
+
python: {
|
|
44
|
+
bio: (0, path_1.join)(TEMPLATE_ROOT, 'init', 'functions', 'python', 'bio'),
|
|
45
|
+
event: (0, path_1.join)(TEMPLATE_ROOT, 'init', 'functions', 'python', 'event'),
|
|
46
|
+
cron: (0, path_1.join)(TEMPLATE_ROOT, 'init', 'functions', 'python', 'cron'),
|
|
47
|
+
aio: (0, path_1.join)(TEMPLATE_ROOT, 'init', 'functions', 'python', 'aio'),
|
|
48
|
+
integ: {
|
|
49
|
+
[constants_1.INTEG.services.cliq]: (0, path_1.join)(TEMPLATE_ROOT, 'init', 'functions', 'python', 'integ', 'cliq')
|
|
50
|
+
}
|
|
42
51
|
}
|
|
43
52
|
},
|
|
44
53
|
event_data: (0, path_1.join)(TEMPLATE_ROOT, 'event', 'data.json')
|
|
@@ -31,12 +31,9 @@ class URL {
|
|
|
31
31
|
static get catalystStatic() {
|
|
32
32
|
const dc = (0, dc_js_1.getActiveDCType)();
|
|
33
33
|
if (dc === undefined) {
|
|
34
|
-
return URL.
|
|
34
|
+
return URL._zohoStatic;
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
return URL._zohoStatic.replace(dc_type_js_1.default.us.ext, dc_type_js_1.default.in.ext);
|
|
38
|
-
}
|
|
39
|
-
return URL._catalystStatic.replace('.com', dc.ext);
|
|
36
|
+
return URL._zohoStatic.replace(dc_type_js_1.default.us.ext, dc.ext);
|
|
40
37
|
}
|
|
41
38
|
static get console() {
|
|
42
39
|
const dc = (0, dc_js_1.getActiveDCType)();
|
|
@@ -51,5 +48,4 @@ URL._auth = (0, env_js_1.envOverride)('CATALYST_AUTH_URL', 'https://accounts.zoh
|
|
|
51
48
|
URL._admin = (0, env_js_1.envOverride)('CATALYST_ADMIN_URL', 'https://api.catalyst.zoho.com');
|
|
52
49
|
URL._app = (0, env_js_1.envOverride)('CATALYST_APP_URL', 'https://catalystserverless.com');
|
|
53
50
|
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
51
|
URL._console = (0, env_js_1.envOverride)('CATALYST_CONSOLE_URL', 'https://console.catalyst.zoho.com');
|
|
@@ -55,8 +55,10 @@ function help() {
|
|
|
55
55
|
(0, logger_1.info)();
|
|
56
56
|
(0, logger_1.labeled)((0, ansi_colors_1.bold)('Error'), help.context).ERROR();
|
|
57
57
|
debugLog(err);
|
|
58
|
+
(0, logger_1.info)();
|
|
58
59
|
(0, logger_1.log)('error', help.aid);
|
|
59
60
|
if (helpTemplate.link && helpTemplate.link !== '') {
|
|
61
|
+
(0, logger_1.info)();
|
|
60
62
|
(0, logger_1.log)('error', (0, ansi_colors_1.bold)((0, ansi_colors_1.blue)('REF: ') + (0, ansi_colors_1.underline)(helpTemplate.link)));
|
|
61
63
|
}
|
|
62
64
|
errQueue.shift();
|
|
@@ -12,12 +12,19 @@ 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.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 = void 0;
|
|
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;
|
|
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"));
|
|
19
19
|
const path_1 = __importDefault(require("path"));
|
|
20
20
|
const utils_js_1 = require("../utils.js");
|
|
21
|
+
function isPathExists(path) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const stats = yield fs_extra_1.default.stat((0, utils_js_1.untildify)(path)).catch(() => false);
|
|
24
|
+
return stats && true;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
exports.isPathExists = isPathExists;
|
|
21
28
|
function dirExists(pth) {
|
|
22
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
30
|
const stats = yield fs_extra_1.default.stat((0, utils_js_1.untildify)(pth)).catch(() => false);
|
|
@@ -75,10 +82,13 @@ function dirList(dir) {
|
|
|
75
82
|
});
|
|
76
83
|
}
|
|
77
84
|
exports.dirList = dirList;
|
|
78
|
-
function walk(dir, {
|
|
85
|
+
function walk(dir, { filter = {
|
|
86
|
+
exclude: [],
|
|
87
|
+
excludeDir: true
|
|
88
|
+
}, depth = -1, includeDirPaths = false } = {}) {
|
|
79
89
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
90
|
if (depth === 0) {
|
|
81
|
-
return [];
|
|
91
|
+
return includeDirPaths ? [dir] : [];
|
|
82
92
|
}
|
|
83
93
|
const isDir = yield fs_extra_1.default.stat(dir).then((stat) => stat.isDirectory());
|
|
84
94
|
const files = isDir ? yield fs_extra_1.default.readdir(dir) : [path_1.default.basename(dir)];
|
|
@@ -87,20 +97,20 @@ function walk(dir, { exclude = [], excludeDir = true, depth = -1 } = {}) {
|
|
|
87
97
|
const stats = yield fs_extra_1.default.stat(entryPath);
|
|
88
98
|
const isEntryPthDir = stats.isDirectory();
|
|
89
99
|
let excludeMatch = false;
|
|
90
|
-
if (!(isEntryPthDir && !excludeDir)) {
|
|
91
|
-
for (const glob of exclude) {
|
|
100
|
+
if (!(isEntryPthDir && !filter.excludeDir)) {
|
|
101
|
+
for (const glob of filter.exclude || []) {
|
|
92
102
|
excludeMatch = excludeMatch || (0, minimatch_1.default)(entryPath, glob);
|
|
93
103
|
}
|
|
94
104
|
}
|
|
95
105
|
if (excludeMatch) {
|
|
96
106
|
return [];
|
|
97
107
|
}
|
|
98
|
-
return isEntryPthDir
|
|
99
|
-
? walk(entryPath, {
|
|
108
|
+
return isEntryPthDir && depth !== 0
|
|
109
|
+
? walk(entryPath, { filter, depth: depth - 1, includeDirPaths })
|
|
100
110
|
: [entryPath];
|
|
101
111
|
}));
|
|
102
112
|
const folderContents = yield Promise.all(folderContentPromise);
|
|
103
|
-
return folderContents.reduce((all, folderContent) => all.concat(folderContent), []);
|
|
113
|
+
return folderContents.reduce((all, folderContent) => all.concat(folderContent), includeDirPaths ? [dir] : []);
|
|
104
114
|
});
|
|
105
115
|
}
|
|
106
116
|
exports.walk = walk;
|
|
@@ -135,10 +145,10 @@ function deleteDir(dir) {
|
|
|
135
145
|
});
|
|
136
146
|
}
|
|
137
147
|
exports.deleteDir = deleteDir;
|
|
138
|
-
function copyFile(src, dest) {
|
|
148
|
+
function copyFile(src, dest, flag) {
|
|
139
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
140
150
|
yield ensureDir(path_1.default.dirname(dest));
|
|
141
|
-
return fs_extra_1.default.copyFile(src, dest);
|
|
151
|
+
return fs_extra_1.default.copyFile(src, dest, flag);
|
|
142
152
|
});
|
|
143
153
|
}
|
|
144
154
|
exports.copyFile = copyFile;
|
|
@@ -207,10 +217,24 @@ function readJSONFile(pth, opts) {
|
|
|
207
217
|
});
|
|
208
218
|
}
|
|
209
219
|
exports.readJSONFile = readJSONFile;
|
|
210
|
-
function writeJSONFile(pth, object, opts) {
|
|
220
|
+
function writeJSONFile(pth, object, opts = { spaces: '\t' }) {
|
|
211
221
|
return __awaiter(this, void 0, void 0, function* () {
|
|
212
222
|
yield ensureFile(pth, true);
|
|
213
223
|
return fs_extra_1.default.writeJson(pth, object, opts);
|
|
214
224
|
});
|
|
215
225
|
}
|
|
216
226
|
exports.writeJSONFile = writeJSONFile;
|
|
227
|
+
function chmod(path, mode, { checkPath = true, recursive = false } = {}) {
|
|
228
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
229
|
+
if (checkPath && !(yield isPathExists(path))) {
|
|
230
|
+
return Promise.reject('Path does not exists');
|
|
231
|
+
}
|
|
232
|
+
if (recursive && (yield dirExists(path))) {
|
|
233
|
+
const paths = yield walk(path, { includeDirPaths: true, depth: 1 });
|
|
234
|
+
paths.shift();
|
|
235
|
+
yield Promise.all(paths.map((_path) => chmod(_path, mode, { recursive, checkPath })));
|
|
236
|
+
}
|
|
237
|
+
return fs_extra_1.default.chmod(path, mode);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
exports.chmod = chmod;
|
|
@@ -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.resolveProjectPath = exports.upsertProject = exports.upsertEnv = exports.removeProject = exports.transformEnv = exports.transformProject = exports.makeDefaultProjectActive = exports.getProjectRoot = exports.getDefaultEnvName = exports.getDefaultProjectName = exports.getDefaultProjectId = exports.getDomainKey = exports.getDomainPrefix = exports.getEnvName = exports.getProjectName = exports.getProjectId = void 0;
|
|
15
|
+
exports.resolveProjectPath = exports.upsertProject = exports.upsertEnv = exports.removeProject = exports.transformEnv = exports.transformProject = exports.makeDefaultProjectActive = exports.getProjectRoot = exports.getDefaultEnvName = exports.getDefaultProjectName = exports.getDefaultProjectId = exports.getProjectTimezone = exports.getDomainKey = exports.getDomainPrefix = exports.getEnvName = exports.getEnvId = exports.getProjectName = exports.getProjectId = void 0;
|
|
16
16
|
const ansi_colors_1 = require("ansi-colors");
|
|
17
17
|
const path_1 = __importDefault(require("path"));
|
|
18
18
|
const error_1 = __importDefault(require("../error"));
|
|
@@ -78,6 +78,10 @@ function getProjectName(fallback) {
|
|
|
78
78
|
return projectName + '';
|
|
79
79
|
}
|
|
80
80
|
exports.getProjectName = getProjectName;
|
|
81
|
+
function getEnvId(fallback) {
|
|
82
|
+
return runtime_store_1.default.get('project.env.id', fallback);
|
|
83
|
+
}
|
|
84
|
+
exports.getEnvId = getEnvId;
|
|
81
85
|
function getEnvName(fallback = 'Development') {
|
|
82
86
|
return runtime_store_1.default.get('project.env.name', fallback);
|
|
83
87
|
}
|
|
@@ -112,6 +116,21 @@ function getDomainKey(fallback) {
|
|
|
112
116
|
return domainId;
|
|
113
117
|
}
|
|
114
118
|
exports.getDomainKey = getDomainKey;
|
|
119
|
+
function getProjectTimezone(fallback) {
|
|
120
|
+
const projectTimezone = runtime_store_1.default.get('project.timezone', null);
|
|
121
|
+
if (projectTimezone === null) {
|
|
122
|
+
if (fallback === undefined) {
|
|
123
|
+
throw new error_1.default('Project timezone is needed', {
|
|
124
|
+
exit: 1,
|
|
125
|
+
errorId: 'PROJ-2',
|
|
126
|
+
arg: ['Project timezone', (0, ansi_colors_1.bold)('catalyst init project --force')]
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
return fallback;
|
|
130
|
+
}
|
|
131
|
+
return projectTimezone + '';
|
|
132
|
+
}
|
|
133
|
+
exports.getProjectTimezone = getProjectTimezone;
|
|
115
134
|
function getDefaultProjectId(fallback) {
|
|
116
135
|
const defaultProject = getDefaultProject(fallback === undefined);
|
|
117
136
|
if (defaultProject !== undefined) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zcatalyst-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.1",
|
|
4
4
|
"description": "Command Line Tool for CATALYST",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"commander": "^9.2.0",
|
|
34
34
|
"conf": "^10.1.2",
|
|
35
35
|
"cross-spawn": "^7.0.3",
|
|
36
|
+
"env-paths": "^2.2.1",
|
|
36
37
|
"express": "^4.17.3",
|
|
37
38
|
"fs-extra": "^10.1.0",
|
|
38
39
|
"fuzzy": "^0.1.3",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
2
|
+
import Cliq from 'zcatalyst-integ-cliq';
|
|
3
3
|
const botHandler = Cliq.bot();
|
|
4
4
|
|
|
5
5
|
botHandler.welcomeHandler(async (req, res) => {
|
|
@@ -88,7 +88,7 @@ botHandler.contextHandler(async (req, res, app) => {
|
|
|
88
88
|
const answer = req.answers;
|
|
89
89
|
let text = `Nice! I have collected your info: \n*Name*: ${answer.name.text} \n*Department*: ${answer.dept.text}`
|
|
90
90
|
|
|
91
|
-
if(answer.cache
|
|
91
|
+
if(answer.cache?.text === 'YES') {
|
|
92
92
|
try {
|
|
93
93
|
const segment = app.cache().segment();
|
|
94
94
|
await segment.put('Name', answer.name.text);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import Cliq from 'zcatalyst-integ-cliq';
|
|
3
|
+
import catalyst from 'zcatalyst-sdk-node';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
export default async (request, response) => {
|
|
6
6
|
try {
|
|
7
7
|
const app = catalyst.initialize(request);
|
|
8
|
-
const handlerResponse = await Cliq.
|
|
8
|
+
const handlerResponse = await Cliq.execute(request, app);
|
|
9
9
|
response.end(handlerResponse);
|
|
10
10
|
} catch (err) {
|
|
11
11
|
console.log('Error while executing handler. ', err);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
zcatalyst-sdk=={{_VERSION_}}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import zcatalyst_sdk
|
|
3
|
+
import logging
|
|
4
|
+
from flask import Request, make_response, jsonify
|
|
5
|
+
|
|
6
|
+
def handler(request: Request):
|
|
7
|
+
app = zcatalyst_sdk.initialize()
|
|
8
|
+
logger = logging.getLogger()
|
|
9
|
+
if request.path == "/":
|
|
10
|
+
response = make_response(jsonify({
|
|
11
|
+
'status': 'success',
|
|
12
|
+
'message': 'Hello from {{_MAIN_}}'
|
|
13
|
+
}), 200)
|
|
14
|
+
return response
|
|
15
|
+
elif request.path == "/cache":
|
|
16
|
+
default_segment = app.cache().segment()
|
|
17
|
+
|
|
18
|
+
insert_resp = default_segment.put('Name', 'DefaultName')
|
|
19
|
+
logger.info('Inserted cache : ' + str(insert_resp))
|
|
20
|
+
get_resp = default_segment.get('Name')
|
|
21
|
+
|
|
22
|
+
return jsonify(get_resp), 200
|
|
23
|
+
else:
|
|
24
|
+
response = make_response('Unknown path')
|
|
25
|
+
response.status_code = 400
|
|
26
|
+
return response
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
zcatalyst-sdk=={{_VERSION_}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
zcatalyst-sdk=={{_VERSION_}}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def handler(cron_details, context):
|
|
5
|
+
logger = logging.getLogger()
|
|
6
|
+
logger.info('Hello from {{_MAIN_}}')
|
|
7
|
+
|
|
8
|
+
'''CronDetails Functionalities'''
|
|
9
|
+
# cron_param = cron_details.get_cron_param('')
|
|
10
|
+
# remaining_execution_count = cron_details.get_remaining_execution_count()
|
|
11
|
+
# details = cron_details.get_cron_details()
|
|
12
|
+
# project_details = cron_details.get_project_details()
|
|
13
|
+
|
|
14
|
+
'''Context Functionalities'''
|
|
15
|
+
# remaining_execution_time_ms = context.get_remaining_execution_time_ms()
|
|
16
|
+
# max_execution_time_ms = context.get_max_execution_time_ms()
|
|
17
|
+
# context.close_with_failure()
|
|
18
|
+
context.close_with_success()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
zcatalyst-sdk=={{_VERSION_}}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def handler(event, context):
|
|
5
|
+
logger = logging.getLogger()
|
|
6
|
+
logger.info('Hello from {{_MAIN_}}')
|
|
7
|
+
|
|
8
|
+
'''Event Functionalities'''
|
|
9
|
+
data = event.get_data() # event data
|
|
10
|
+
time = event.get_time() # event occurred time
|
|
11
|
+
action = event.get_action()
|
|
12
|
+
source_details = event.get_source()
|
|
13
|
+
source_entity_id = event.get_source_entity_id()
|
|
14
|
+
event_bus_details = event.get_event_bus_details()
|
|
15
|
+
project_details = event.get_project_details()
|
|
16
|
+
|
|
17
|
+
'''Context Functionalities'''
|
|
18
|
+
# remaining_execution_time_ms = context.get_remaining_execution_time_ms()
|
|
19
|
+
# max_execution_time_ms = context.get_max_execution_time_ms()
|
|
20
|
+
# context.close_with_failure()
|
|
21
|
+
context.close_with_success()
|