zcatalyst-cli 1.7.1 → 1.9.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/README.md +31 -10
- package/docs/apig-utils.toml +69 -0
- package/docs/authentication/index.toml +15 -0
- package/docs/authentication/login.toml +14 -0
- package/docs/client-utils.toml +24 -0
- package/docs/command_needs/auth.toml +4 -0
- package/docs/command_needs/rc.toml +24 -0
- package/docs/commands/apig/disable.toml +4 -0
- package/docs/commands/apig/enable.toml +4 -0
- package/docs/commands/apig/status.toml +4 -0
- package/docs/commands/client/delete.toml +34 -0
- package/docs/commands/ds/export.toml +4 -0
- package/docs/commands/ds/import.toml +15 -0
- package/docs/commands/ds/status.toml +9 -0
- package/docs/commands/event/generate/index.toml +29 -0
- package/docs/commands/event/generate/integ.toml +4 -0
- package/docs/commands/functions/config.toml +11 -0
- package/docs/commands/functions/delete.toml +29 -0
- package/docs/commands/project/use.toml +9 -0
- package/docs/dc.toml +4 -0
- package/docs/deploy/features/apig.toml +4 -0
- package/docs/deploy/features/functions/index.toml +4 -0
- package/docs/event_generate/cache.toml +4 -0
- package/docs/event_generate/custom.toml +4 -0
- package/docs/event_generate/datastore.toml +4 -0
- package/docs/event_generate/filestore.toml +4 -0
- package/docs/event_generate/integration/cliq.toml +9 -0
- package/docs/execute-script.toml +19 -0
- package/docs/fn-utils/lib/common.toml +25 -0
- package/docs/fn-utils/lib/java.toml +34 -0
- package/docs/fn-utils/lib/node.toml +4 -0
- package/docs/init/index.toml +4 -0
- package/docs/internal/command.toml +4 -0
- package/docs/internal/config.toml +9 -0
- package/docs/internal/credential.toml +14 -0
- package/docs/option-filter.toml +45 -0
- package/docs/port-resolver.toml +9 -0
- package/docs/pull/index.toml +4 -0
- package/docs/serve/index.toml +4 -0
- package/docs/shell/index.toml +4 -0
- package/docs/util_modules/project.toml +9 -0
- package/lib/apig-utils.js +133 -43
- package/lib/archiver.js +4 -2
- package/lib/authentication/index.js +44 -9
- package/lib/authentication/login.js +51 -8
- package/lib/bin/catalyst.js +14 -7
- package/lib/client-utils.js +47 -14
- package/lib/client.js +1 -1
- package/lib/command_needs/auth.js +5 -3
- package/lib/command_needs/rc.js +35 -13
- package/lib/commands/apig/disable.js +8 -3
- package/lib/commands/apig/enable.js +8 -3
- package/lib/commands/apig/status.js +29 -9
- package/lib/commands/client/delete.js +65 -26
- package/lib/commands/client/setup.js +2 -2
- package/lib/commands/deploy.js +2 -2
- package/lib/commands/ds/export.js +16 -8
- package/lib/commands/ds/import.js +20 -14
- package/lib/commands/ds/status.js +22 -11
- package/lib/commands/event/generate/index.js +62 -12
- package/lib/commands/event/generate/integ.js +7 -3
- package/lib/commands/functions/add.js +2 -2
- package/lib/commands/functions/config.js +11 -3
- package/lib/commands/functions/delete.js +36 -13
- package/lib/commands/functions/setup.js +2 -2
- package/lib/commands/functions/shell.js +2 -2
- package/lib/commands/help.js +1 -1
- package/lib/commands/index.js +2 -3
- package/lib/commands/init.js +4 -4
- package/lib/commands/login.js +2 -2
- package/lib/commands/logout.js +2 -2
- package/lib/commands/project/list.js +2 -2
- package/lib/commands/project/reset.js +1 -1
- package/lib/commands/project/use.js +18 -2
- package/lib/commands/pull.js +5 -5
- package/lib/commands/run.js +2 -2
- package/lib/commands/serve.js +7 -6
- package/lib/commands/token/generate.js +2 -2
- package/lib/commands/token/list.js +2 -2
- package/lib/commands/token/revoke.js +2 -2
- package/lib/commands/whoami.js +1 -1
- package/lib/dc.js +11 -1
- package/lib/deploy/features/apig.js +33 -33
- package/lib/deploy/features/client.js +12 -19
- package/lib/deploy/features/functions/index.js +14 -4
- package/lib/deploy/features/index.js +1 -1
- package/lib/deploy/index.js +2 -9
- package/lib/endpoints/index.js +5 -2
- package/lib/endpoints/lib/apig.js +15 -5
- package/lib/endpoints/lib/applogic.js +12 -4
- package/lib/endpoints/lib/cache.js +9 -3
- package/lib/endpoints/lib/catalyst-details.js +37 -0
- package/lib/endpoints/lib/client.js +15 -5
- package/lib/endpoints/lib/datastore.js +6 -2
- package/lib/endpoints/lib/ds-bulk.js +15 -5
- package/lib/endpoints/lib/env.js +3 -1
- package/lib/endpoints/lib/event-bus.js +3 -1
- package/lib/endpoints/lib/filestore.js +6 -2
- package/lib/endpoints/lib/functions.js +12 -4
- package/lib/endpoints/lib/project.js +9 -3
- package/lib/endpoints/lib/queue.js +9 -3
- package/lib/endpoints/lib/sdk.js +3 -1
- package/lib/endpoints/lib/zcql.js +3 -1
- package/lib/error.js +18 -0
- package/lib/errorOut.js +10 -7
- package/lib/event_generate/cache.js +9 -1
- package/lib/event_generate/custom.js +6 -1
- package/lib/event_generate/datastore.js +12 -2
- package/lib/event_generate/filestore.js +9 -1
- package/lib/event_generate/integration/cliq.js +10 -2
- package/lib/execute-script.js +35 -6
- package/lib/express_middlewares/unknownReqProxy.js +18 -7
- package/lib/fn-utils/index.js +1 -1
- package/lib/fn-utils/lib/common.js +95 -17
- package/lib/fn-utils/lib/integ.js +4 -3
- package/lib/fn-utils/lib/java.js +49 -13
- package/lib/fn-utils/lib/node.js +15 -6
- package/lib/fn-watcher.js +67 -0
- package/lib/index.js +13 -12
- package/lib/init/dependencies/package-json.js +3 -1
- package/lib/init/features/functions/index.js +41 -29
- package/lib/init/features/functions/languages/java.js +5 -4
- package/lib/init/features/functions/languages/node.js +6 -5
- package/lib/init/features/index.js +8 -4
- package/lib/init/index.js +10 -3
- package/lib/internal/api.js +9 -9
- package/lib/internal/command.js +19 -14
- package/lib/internal/config.js +15 -15
- package/lib/internal/credential.js +33 -7
- package/lib/internal/rc.js +18 -10
- package/lib/migration/global/1.4.0.js +4 -2
- package/lib/migration/global/1.6.2.js +4 -2
- package/lib/migration/index.js +1 -1
- package/lib/option-filter.js +79 -22
- package/lib/optional-import.js +1 -1
- package/lib/plugin-loader.js +1 -1
- package/lib/port-resolver.js +23 -3
- package/lib/prompt.js +1 -1
- package/lib/pull/features/functions/index.js +7 -7
- package/lib/pull/features/index.js +1 -1
- package/lib/pull/index.js +10 -3
- package/lib/repl-server.js +9 -5
- package/lib/serve/features/index.js +11 -2
- package/lib/serve/index.js +19 -9
- package/lib/serve/server/index.js +137 -60
- package/lib/serve/server/lib/client.js +1 -1
- package/lib/serve/server/lib/master.js +16 -3
- package/lib/serve/server/lib/node.js +1 -1
- package/lib/shell/dependencies/http-functions.js +120 -90
- package/lib/shell/dependencies/invoker/integ/node.js +1 -1
- package/lib/shell/dependencies/local-function.js +86 -119
- package/lib/shell/index.js +10 -10
- package/lib/shell/prepare/index.js +1 -4
- package/lib/shell/prepare/languages/index.js +15 -4
- package/lib/track.js +4 -1
- package/lib/util_modules/config/index.js +1 -1
- package/lib/util_modules/config/lib/apig.js +3 -3
- package/lib/util_modules/config/lib/client.js +3 -3
- package/lib/util_modules/config/lib/functions.js +5 -5
- package/lib/util_modules/constants/index.js +22 -20
- package/lib/util_modules/constants/lib/regex.js +3 -2
- package/lib/util_modules/constants/lib/runtime.js +9 -0
- package/lib/util_modules/contextHelp.js +63 -123
- package/lib/util_modules/fs/index.js +1 -1
- package/lib/util_modules/fs/lib/async.js +19 -2
- package/lib/util_modules/fs/lib/sync.js +13 -1
- package/lib/util_modules/logger.js +12 -20
- package/lib/util_modules/option.js +1 -13
- package/lib/util_modules/project.js +75 -26
- package/lib/util_modules/shell.js +8 -2
- package/package.json +45 -45
- package/scripts/postInstall.js +31 -0
- package/lib/cjson.js +0 -20
- package/lib/log-error.js +0 -18
- package/lib/util_modules/big-json.js +0 -16
- package/lib/util_modules/constants/lib/stack.js +0 -6
- package/templates/init/functions/.DS_Store +0 -0
- package/templates/init/functions/node/.DS_Store +0 -0
- package/templates/init/functions/node/integ/.DS_Store +0 -0
|
@@ -27,7 +27,9 @@ class Cache {
|
|
|
27
27
|
return res.body.data;
|
|
28
28
|
}
|
|
29
29
|
logger_1.debug('get all segments response from server : ' + res.body);
|
|
30
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
30
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
31
|
+
exit: 2
|
|
32
|
+
});
|
|
31
33
|
});
|
|
32
34
|
}
|
|
33
35
|
put(key, value, segmentId) {
|
|
@@ -45,7 +47,9 @@ class Cache {
|
|
|
45
47
|
return res.body.data;
|
|
46
48
|
}
|
|
47
49
|
logger_1.debug('put cache response from server : ' + res.body);
|
|
48
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
50
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
51
|
+
exit: 2
|
|
52
|
+
});
|
|
49
53
|
});
|
|
50
54
|
}
|
|
51
55
|
get(name, segmentId) {
|
|
@@ -62,7 +66,9 @@ class Cache {
|
|
|
62
66
|
return res.body.data;
|
|
63
67
|
}
|
|
64
68
|
logger_1.debug('get cache response from server : ' + res.body);
|
|
65
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
69
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
70
|
+
exit: 2
|
|
71
|
+
});
|
|
66
72
|
});
|
|
67
73
|
}
|
|
68
74
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const error_1 = __importDefault(require("../../error"));
|
|
16
|
+
const api_1 = __importDefault(require("../../internal/api"));
|
|
17
|
+
const logger_1 = require("../../util_modules/logger");
|
|
18
|
+
class CatalystDetailsAPI {
|
|
19
|
+
constructor(opts) {
|
|
20
|
+
this.opts = opts;
|
|
21
|
+
}
|
|
22
|
+
getDetails(feature) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const res = yield new api_1.default(this.opts).get('/baas/get-details', {
|
|
25
|
+
qs: {
|
|
26
|
+
feature_name: feature
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
if (res.body && res.body.data) {
|
|
30
|
+
return res.body.data;
|
|
31
|
+
}
|
|
32
|
+
logger_1.debug('get detail response from server : ' + JSON.stringify(res.body));
|
|
33
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', { exit: 2 });
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.default = CatalystDetailsAPI;
|
|
@@ -32,7 +32,9 @@ class Client {
|
|
|
32
32
|
return res.body.data;
|
|
33
33
|
}
|
|
34
34
|
logger_1.debug('deploy webapp response from server : ' + res.body);
|
|
35
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
35
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
36
|
+
exit: 2
|
|
37
|
+
});
|
|
36
38
|
});
|
|
37
39
|
}
|
|
38
40
|
getAllHistory() {
|
|
@@ -42,7 +44,9 @@ class Client {
|
|
|
42
44
|
return res.body.data;
|
|
43
45
|
}
|
|
44
46
|
logger_1.debug('get all history response from server : ' + res.body);
|
|
45
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
47
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
48
|
+
exit: 2
|
|
49
|
+
});
|
|
46
50
|
});
|
|
47
51
|
}
|
|
48
52
|
getWebappDetails() {
|
|
@@ -52,7 +56,9 @@ class Client {
|
|
|
52
56
|
return res.body.data;
|
|
53
57
|
}
|
|
54
58
|
logger_1.debug('get webapp response from server : ' + res.body);
|
|
55
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
59
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
60
|
+
exit: 2
|
|
61
|
+
});
|
|
56
62
|
});
|
|
57
63
|
}
|
|
58
64
|
download(historyId) {
|
|
@@ -64,7 +70,9 @@ class Client {
|
|
|
64
70
|
return res.body;
|
|
65
71
|
}
|
|
66
72
|
logger_1.debug('download client response from server : ' + res.body);
|
|
67
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
73
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
74
|
+
exit: 2
|
|
75
|
+
});
|
|
68
76
|
});
|
|
69
77
|
}
|
|
70
78
|
delete(historyId) {
|
|
@@ -74,7 +82,9 @@ class Client {
|
|
|
74
82
|
return true;
|
|
75
83
|
}
|
|
76
84
|
logger_1.debug('delete history response from server : ' + res.body);
|
|
77
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
85
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
86
|
+
exit: 2
|
|
87
|
+
});
|
|
78
88
|
});
|
|
79
89
|
}
|
|
80
90
|
}
|
|
@@ -27,7 +27,9 @@ class Datastore {
|
|
|
27
27
|
return res.body.data;
|
|
28
28
|
}
|
|
29
29
|
logger_1.debug('get all table response from server : ' + res.body);
|
|
30
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
30
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
31
|
+
exit: 2
|
|
32
|
+
});
|
|
31
33
|
});
|
|
32
34
|
}
|
|
33
35
|
getColumnDetails(tableId) {
|
|
@@ -37,7 +39,9 @@ class Datastore {
|
|
|
37
39
|
return res.body.data;
|
|
38
40
|
}
|
|
39
41
|
logger_1.debug('get column details for table response from server : ' + res.body);
|
|
40
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
42
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
43
|
+
exit: 2
|
|
44
|
+
});
|
|
41
45
|
});
|
|
42
46
|
}
|
|
43
47
|
}
|
|
@@ -27,7 +27,9 @@ class BulkDS {
|
|
|
27
27
|
return res.body.data;
|
|
28
28
|
}
|
|
29
29
|
logger_1.debug('bulk response from server : ' + res.body);
|
|
30
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
30
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
31
|
+
exit: 2
|
|
32
|
+
});
|
|
31
33
|
});
|
|
32
34
|
}
|
|
33
35
|
read(table, config) {
|
|
@@ -68,7 +70,9 @@ class BulkDS {
|
|
|
68
70
|
return res.body.data;
|
|
69
71
|
}
|
|
70
72
|
logger_1.debug('getStatus response from server : ' + res.body);
|
|
71
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
73
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
74
|
+
exit: 2
|
|
75
|
+
});
|
|
72
76
|
});
|
|
73
77
|
}
|
|
74
78
|
getReport(operation, jobid) {
|
|
@@ -78,7 +82,9 @@ class BulkDS {
|
|
|
78
82
|
return res.body.data;
|
|
79
83
|
}
|
|
80
84
|
logger_1.debug('getReport response from server : ' + res.body);
|
|
81
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
85
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
86
|
+
exit: 2
|
|
87
|
+
});
|
|
82
88
|
});
|
|
83
89
|
}
|
|
84
90
|
getAllJobs(operation) {
|
|
@@ -88,7 +94,9 @@ class BulkDS {
|
|
|
88
94
|
return res.body.data;
|
|
89
95
|
}
|
|
90
96
|
logger_1.debug('getAllJobs response from server : ' + res.body);
|
|
91
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
97
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
98
|
+
exit: 2
|
|
99
|
+
});
|
|
92
100
|
});
|
|
93
101
|
}
|
|
94
102
|
downloadReport(url, fileName) {
|
|
@@ -108,7 +116,9 @@ class BulkDS {
|
|
|
108
116
|
return res.body;
|
|
109
117
|
}
|
|
110
118
|
logger_1.debug('download report response from server : ' + res.body);
|
|
111
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
119
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
120
|
+
exit: 2
|
|
121
|
+
});
|
|
112
122
|
});
|
|
113
123
|
}
|
|
114
124
|
}
|
package/lib/endpoints/lib/env.js
CHANGED
|
@@ -26,7 +26,9 @@ class Env {
|
|
|
26
26
|
return res.body.data;
|
|
27
27
|
}
|
|
28
28
|
logger_1.debug('get environment response from server : ' + JSON.stringify(res.body));
|
|
29
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
29
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
30
|
+
exit: 2
|
|
31
|
+
});
|
|
30
32
|
});
|
|
31
33
|
}
|
|
32
34
|
}
|
|
@@ -27,7 +27,9 @@ class EventBus {
|
|
|
27
27
|
return res.body.data;
|
|
28
28
|
}
|
|
29
29
|
logger_1.debug('get all event bus response from server : ' + res.body);
|
|
30
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
30
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
31
|
+
exit: 2
|
|
32
|
+
});
|
|
31
33
|
});
|
|
32
34
|
}
|
|
33
35
|
}
|
|
@@ -27,7 +27,9 @@ class Filestore {
|
|
|
27
27
|
return res.body.data;
|
|
28
28
|
}
|
|
29
29
|
logger_1.debug('get all folder response from server : ' + res.body);
|
|
30
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
30
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
31
|
+
exit: 2
|
|
32
|
+
});
|
|
31
33
|
});
|
|
32
34
|
}
|
|
33
35
|
uploadFile(folderId, fileStream) {
|
|
@@ -42,7 +44,9 @@ class Filestore {
|
|
|
42
44
|
return res.body.data;
|
|
43
45
|
}
|
|
44
46
|
logger_1.debug('uploadFile response from server : ' + res.body);
|
|
45
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
47
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
48
|
+
exit: 2
|
|
49
|
+
});
|
|
46
50
|
});
|
|
47
51
|
}
|
|
48
52
|
}
|
|
@@ -38,7 +38,9 @@ class Functions {
|
|
|
38
38
|
return res.body.data;
|
|
39
39
|
}
|
|
40
40
|
logger_1.debug('get all function response from server : ' + res.body);
|
|
41
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
41
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
42
|
+
exit: 2
|
|
43
|
+
});
|
|
42
44
|
});
|
|
43
45
|
}
|
|
44
46
|
deploy(sourceFsStream, { stack, name, type, memory }) {
|
|
@@ -62,7 +64,9 @@ class Functions {
|
|
|
62
64
|
return res.body.data;
|
|
63
65
|
}
|
|
64
66
|
logger_1.debug('save function response from server : ' + res.body);
|
|
65
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
67
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
68
|
+
exit: 2
|
|
69
|
+
});
|
|
66
70
|
});
|
|
67
71
|
}
|
|
68
72
|
download(functionId) {
|
|
@@ -75,7 +79,9 @@ class Functions {
|
|
|
75
79
|
return res.body;
|
|
76
80
|
}
|
|
77
81
|
logger_1.debug('download function response from server : ' + res.body);
|
|
78
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
82
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
83
|
+
exit: 2
|
|
84
|
+
});
|
|
79
85
|
});
|
|
80
86
|
}
|
|
81
87
|
delete(functionId) {
|
|
@@ -85,7 +91,9 @@ class Functions {
|
|
|
85
91
|
return res.body.data;
|
|
86
92
|
}
|
|
87
93
|
logger_1.debug('get all function response from server : ' + res.body);
|
|
88
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
94
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
95
|
+
exit: 2
|
|
96
|
+
});
|
|
89
97
|
});
|
|
90
98
|
}
|
|
91
99
|
}
|
|
@@ -26,7 +26,9 @@ class Project {
|
|
|
26
26
|
return res.body.data;
|
|
27
27
|
}
|
|
28
28
|
logger_1.debug('get project response from server : ' + res.body);
|
|
29
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
29
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
30
|
+
exit: 2
|
|
31
|
+
});
|
|
30
32
|
});
|
|
31
33
|
}
|
|
32
34
|
getAllProjects() {
|
|
@@ -36,7 +38,9 @@ class Project {
|
|
|
36
38
|
return res.body.data;
|
|
37
39
|
}
|
|
38
40
|
logger_1.debug('get all project response from server : ' + res.body);
|
|
39
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
41
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
42
|
+
exit: 2
|
|
43
|
+
});
|
|
40
44
|
});
|
|
41
45
|
}
|
|
42
46
|
createProject(name) {
|
|
@@ -50,7 +54,9 @@ class Project {
|
|
|
50
54
|
return res.body.data;
|
|
51
55
|
}
|
|
52
56
|
logger_1.debug('create project response from server : ' + res.body);
|
|
53
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
57
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
58
|
+
exit: 2
|
|
59
|
+
});
|
|
54
60
|
});
|
|
55
61
|
}
|
|
56
62
|
}
|
|
@@ -27,7 +27,9 @@ class Queue {
|
|
|
27
27
|
return res.body.data;
|
|
28
28
|
}
|
|
29
29
|
logger_1.debug('get all topics response from server : ' + res.body);
|
|
30
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
30
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
31
|
+
exit: 2
|
|
32
|
+
});
|
|
31
33
|
});
|
|
32
34
|
}
|
|
33
35
|
produce(data, topicId) {
|
|
@@ -41,7 +43,9 @@ class Queue {
|
|
|
41
43
|
return res.body.data;
|
|
42
44
|
}
|
|
43
45
|
logger_1.debug('produce data to queue response from server : ' + res.body);
|
|
44
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
46
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
47
|
+
exit: 2
|
|
48
|
+
});
|
|
45
49
|
});
|
|
46
50
|
}
|
|
47
51
|
consume(topicId) {
|
|
@@ -54,7 +58,9 @@ class Queue {
|
|
|
54
58
|
return undefined;
|
|
55
59
|
}
|
|
56
60
|
logger_1.debug('consume data from queue response from server : ' + res.body);
|
|
57
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
61
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
62
|
+
exit: 2
|
|
63
|
+
});
|
|
58
64
|
});
|
|
59
65
|
}
|
|
60
66
|
}
|
package/lib/endpoints/lib/sdk.js
CHANGED
|
@@ -45,7 +45,9 @@ class SDK {
|
|
|
45
45
|
return res.body;
|
|
46
46
|
}
|
|
47
47
|
logger_1.debug('java sdk response from server : ' + res.body);
|
|
48
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
48
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
49
|
+
exit: 2
|
|
50
|
+
});
|
|
49
51
|
});
|
|
50
52
|
}
|
|
51
53
|
}
|
|
@@ -31,7 +31,9 @@ class ZCQL {
|
|
|
31
31
|
return res.body.data;
|
|
32
32
|
}
|
|
33
33
|
logger_1.debug('ZCQL response from server : ' + res.body);
|
|
34
|
-
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
34
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
35
|
+
exit: 2
|
|
36
|
+
});
|
|
35
37
|
});
|
|
36
38
|
}
|
|
37
39
|
}
|
package/lib/error.js
CHANGED
|
@@ -3,15 +3,33 @@ 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 runtime_store_1 = __importDefault(require("./runtime-store"));
|
|
6
7
|
const default_1 = __importDefault(require("./util_modules/constants/lib/default"));
|
|
7
8
|
class CatalystError extends Error {
|
|
8
9
|
constructor(message, options = {}) {
|
|
10
|
+
var _a;
|
|
9
11
|
super(message);
|
|
10
12
|
this.name = default_1.default.catalystError;
|
|
11
13
|
this.status = options.status || 500;
|
|
12
14
|
this.exit = options.exit || 1;
|
|
13
15
|
this.original = options.original;
|
|
14
16
|
this.context = options.context;
|
|
17
|
+
this.errorId = options.errorId;
|
|
18
|
+
this.arg = options.arg;
|
|
19
|
+
this.skipHelp = options.skipHelp || false;
|
|
20
|
+
try {
|
|
21
|
+
if (!this.skipHelp) {
|
|
22
|
+
const stackArr = ((_a = this.stack) === null || _a === void 0 ? void 0 : _a.split(/\n {4}at /)) || [];
|
|
23
|
+
this.fileName =
|
|
24
|
+
options.fileName === undefined && stackArr[1] !== undefined
|
|
25
|
+
? stackArr[1].replace(/\.[^.]+$/, '').replace(/^[^(]+\(/, '')
|
|
26
|
+
: options.fileName;
|
|
27
|
+
runtime_store_1.default.set('log.' + this.fileName, runtime_store_1.default.get('log.' + this.fileName, []).concat(this));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
runtime_store_1.default.set('log.faultyError', runtime_store_1.default.get('log.faultyError', []).concat(this));
|
|
32
|
+
}
|
|
15
33
|
}
|
|
16
34
|
}
|
|
17
35
|
exports.default = CatalystError;
|
package/lib/errorOut.js
CHANGED
|
@@ -3,9 +3,10 @@ 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 logger_1 = require("./util_modules/logger");
|
|
6
7
|
const error_1 = __importDefault(require("./error"));
|
|
7
|
-
const log_error_1 = __importDefault(require("./log-error"));
|
|
8
8
|
const constants_1 = require("./util_modules/constants");
|
|
9
|
+
const contextHelp_1 = __importDefault(require("./util_modules/contextHelp"));
|
|
9
10
|
exports.default = (error, status) => {
|
|
10
11
|
if (typeof error === 'string') {
|
|
11
12
|
error = new error_1.default('An unexpected error has occurred.', {
|
|
@@ -14,16 +15,18 @@ exports.default = (error, status) => {
|
|
|
14
15
|
exit: 2
|
|
15
16
|
});
|
|
16
17
|
}
|
|
17
|
-
if (error.name !== constants_1.DEFAULT.catalystError) {
|
|
18
|
+
if (error && error.name !== constants_1.DEFAULT.catalystError) {
|
|
18
19
|
error = new error_1.default('An unexpected error has occurred.', {
|
|
19
20
|
status,
|
|
20
21
|
original: error,
|
|
21
22
|
exit: 2
|
|
22
23
|
});
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
try {
|
|
26
|
+
contextHelp_1.default();
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
logger_1.debug('HELP ERROR: ' + err.stack);
|
|
30
|
+
}
|
|
31
|
+
process.exitCode = error ? error.exit : 2;
|
|
29
32
|
};
|
|
@@ -12,6 +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
|
+
const ansi_colors_1 = require("ansi-colors");
|
|
15
16
|
const moment_1 = __importDefault(require("moment"));
|
|
16
17
|
const endpoints_1 = require("../endpoints");
|
|
17
18
|
const error_1 = __importDefault(require("../error"));
|
|
@@ -25,7 +26,14 @@ exports.default = (eventJson, options = {}) => __awaiter(void 0, void 0, void 0,
|
|
|
25
26
|
? allSegments.find((segment) => segment.segment_name === segmentId || segment.id + '' === segmentId)
|
|
26
27
|
: allSegments.find((segment) => segment.segment_name === 'Default');
|
|
27
28
|
if (selectedSegment === undefined) {
|
|
28
|
-
|
|
29
|
+
if (!allSegments.find((segment) => segment.segment_name === 'Default')) {
|
|
30
|
+
throw new error_1.default('Default segment is missing !!!', { exit: 2 });
|
|
31
|
+
}
|
|
32
|
+
throw new error_1.default('Unknown segment identifier', {
|
|
33
|
+
exit: 1,
|
|
34
|
+
errorId: 'CACHE-1',
|
|
35
|
+
arg: [ansi_colors_1.bold(segmentId || ''), ansi_colors_1.bold('--segment')]
|
|
36
|
+
});
|
|
29
37
|
}
|
|
30
38
|
eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.source_id, 'g'), selectedSegment.id);
|
|
31
39
|
const expiryInHours = js_1.JS.random(1, 48);
|
|
@@ -12,6 +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
|
+
const ansi_colors_1 = require("ansi-colors");
|
|
15
16
|
const error_1 = __importDefault(require("../error"));
|
|
16
17
|
const constants_1 = require("../util_modules/constants");
|
|
17
18
|
const js_1 = require("../util_modules/js");
|
|
@@ -24,7 +25,11 @@ exports.default = (eventJson, options = {}) => __awaiter(void 0, void 0, void 0,
|
|
|
24
25
|
eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.data, 'g'), JSON.stringify(data));
|
|
25
26
|
const ruleId = option_1.getOptionValue('ruleId', false);
|
|
26
27
|
if (!ruleId) {
|
|
27
|
-
throw new error_1.default('
|
|
28
|
+
throw new error_1.default('no rule-id provided', {
|
|
29
|
+
exit: 1,
|
|
30
|
+
errorId: 'CUSTOM-1',
|
|
31
|
+
arg: [ansi_colors_1.bold('-rid'), ansi_colors_1.bold('--rule-id')]
|
|
32
|
+
});
|
|
28
33
|
}
|
|
29
34
|
eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.source_id, 'g'), 'NULL');
|
|
30
35
|
return eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.rule_id, 'g'), ruleId);
|
|
@@ -12,6 +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
|
+
const ansi_colors_1 = require("ansi-colors");
|
|
15
16
|
const moment_1 = __importDefault(require("moment"));
|
|
16
17
|
const endpoints_1 = require("../endpoints");
|
|
17
18
|
const error_1 = __importDefault(require("../error"));
|
|
@@ -22,9 +23,18 @@ exports.default = (eventJson, options = {}) => __awaiter(void 0, void 0, void 0,
|
|
|
22
23
|
const tableId = options.table;
|
|
23
24
|
let columnDetails = constants_1.DEFAULT.datastore.column_details;
|
|
24
25
|
if (tableId !== undefined) {
|
|
25
|
-
columnDetails = (yield (yield endpoints_1.datastoreAPI()).getColumnDetails(tableId))
|
|
26
|
+
columnDetails = (yield (yield endpoints_1.datastoreAPI()).getColumnDetails(tableId).catch((err) => {
|
|
27
|
+
if (err.status && err.status === 404) {
|
|
28
|
+
throw new error_1.default('Invalid table identifier', {
|
|
29
|
+
exit: 1,
|
|
30
|
+
errorId: 'DSTORE-1',
|
|
31
|
+
arg: [ansi_colors_1.bold(tableId), ansi_colors_1.bold('--table')]
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
throw err;
|
|
35
|
+
}));
|
|
26
36
|
if (!Array.isArray(columnDetails)) {
|
|
27
|
-
throw new error_1.default('
|
|
37
|
+
throw new error_1.default('Invalid column details', { exit: 2 });
|
|
28
38
|
}
|
|
29
39
|
const rowColumn = columnDetails.find((col) => col.column_name === 'ROWID');
|
|
30
40
|
if (rowColumn === undefined) {
|
|
@@ -12,6 +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
|
+
const ansi_colors_1 = require("ansi-colors");
|
|
15
16
|
const moment_1 = __importDefault(require("moment"));
|
|
16
17
|
const endpoints_1 = require("../endpoints");
|
|
17
18
|
const error_1 = __importDefault(require("../error"));
|
|
@@ -29,7 +30,14 @@ exports.default = (eventJson, options = {}) => __awaiter(void 0, void 0, void 0,
|
|
|
29
30
|
id: js_1.JS.randomNumber(15) + ''
|
|
30
31
|
};
|
|
31
32
|
if (selectedFolder === undefined) {
|
|
32
|
-
|
|
33
|
+
const allFoldersFormatted = allFolders.length > 0
|
|
34
|
+
? allFolders.map((folder) => '* ' + folder.folder_name).join('\n')
|
|
35
|
+
: 'None';
|
|
36
|
+
throw new error_1.default('Invalid folder identifier', {
|
|
37
|
+
exit: 1,
|
|
38
|
+
errorId: 'FSTORE-1',
|
|
39
|
+
arg: [ansi_colors_1.bold('--folder'), ansi_colors_1.bold(allFoldersFormatted)]
|
|
40
|
+
});
|
|
33
41
|
}
|
|
34
42
|
eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.source_id, 'g'), selectedFolder.id);
|
|
35
43
|
const userDetails = {
|
|
@@ -24,7 +24,11 @@ exports.default = (inputs) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
24
24
|
let component;
|
|
25
25
|
let handler;
|
|
26
26
|
if (input.length === 1 && input[0] !== '') {
|
|
27
|
-
throw new error_1.default(
|
|
27
|
+
throw new error_1.default('incorrect input for event cliq', {
|
|
28
|
+
exit: 1,
|
|
29
|
+
errorId: 'CLIQ-1',
|
|
30
|
+
arg: [ansi_colors_1.bold('[component-type,handler]')]
|
|
31
|
+
});
|
|
28
32
|
}
|
|
29
33
|
else if (input[0] === '') {
|
|
30
34
|
const componentChoices = Object.keys(handlers_event_template).map((component) => {
|
|
@@ -60,7 +64,11 @@ exports.default = (inputs) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
60
64
|
handler = inputHandler;
|
|
61
65
|
}
|
|
62
66
|
else {
|
|
63
|
-
throw new error_1.default(
|
|
67
|
+
throw new error_1.default('invalid input combination', {
|
|
68
|
+
exit: 1,
|
|
69
|
+
errorId: 'CLIQ-2',
|
|
70
|
+
arg: [ansi_colors_1.bold(input[0]), ansi_colors_1.bold.red('X'), ansi_colors_1.bold(input[1]), ansi_colors_1.bold('--inputs')]
|
|
71
|
+
});
|
|
64
72
|
}
|
|
65
73
|
}
|
|
66
74
|
const filePath = path_1.join(constants_1.CLIQ.event_template_dir, component, handler + '.json');
|
package/lib/execute-script.js
CHANGED
|
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
14
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
15
|
if (mod && mod.__esModule) return mod;
|
|
16
16
|
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
@@ -34,13 +34,40 @@ const project_1 = require("./util_modules/project");
|
|
|
34
34
|
const shell_1 = require("./util_modules/shell");
|
|
35
35
|
exports.default = (commandName) => {
|
|
36
36
|
const featureByScript = commandName.split(':');
|
|
37
|
+
if (featureByScript.length !== 2) {
|
|
38
|
+
throw new error_1.default('Not a proper script command', {
|
|
39
|
+
exit: 1,
|
|
40
|
+
errorId: 'EXEC-SCRIPT-1',
|
|
41
|
+
arg: [ansi_colors_1.bold.red(commandName), ansi_colors_1.bold('feature:script')]
|
|
42
|
+
});
|
|
43
|
+
}
|
|
37
44
|
const configModule = config[(featureByScript[0] + 'Config')];
|
|
38
|
-
if (
|
|
39
|
-
throw new error_1.default('Not a
|
|
45
|
+
if (configModule === undefined) {
|
|
46
|
+
throw new error_1.default('Not a valid catayst feature', {
|
|
47
|
+
exit: 1,
|
|
48
|
+
errorId: 'EXEC-SCRIPT-2',
|
|
49
|
+
arg: [
|
|
50
|
+
ansi_colors_1.bold(commandName.replace(featureByScript[0], ansi_colors_1.red(featureByScript[0]))),
|
|
51
|
+
ansi_colors_1.bold(['* client', '* function'].join('\n'))
|
|
52
|
+
]
|
|
53
|
+
});
|
|
40
54
|
}
|
|
41
55
|
const exeTempCommand = configModule.script(featureByScript[1], null);
|
|
42
56
|
if (exeTempCommand === null) {
|
|
43
|
-
|
|
57
|
+
const availableScripts = configModule.script(undefined, false);
|
|
58
|
+
throw new error_1.default(featureByScript[1] + ' script is not available.', {
|
|
59
|
+
exit: 1,
|
|
60
|
+
errorId: 'EXEC-SCRIPT-3',
|
|
61
|
+
arg: [
|
|
62
|
+
ansi_colors_1.bold.red(featureByScript[1]),
|
|
63
|
+
ansi_colors_1.bold(constants_1.FILENAME.config),
|
|
64
|
+
ansi_colors_1.bold(availableScripts
|
|
65
|
+
? Object.keys(availableScripts)
|
|
66
|
+
.map((script) => '* ' + script)
|
|
67
|
+
.join('\n')
|
|
68
|
+
: '* None')
|
|
69
|
+
]
|
|
70
|
+
});
|
|
44
71
|
}
|
|
45
72
|
const featureSource = project_1.resolveProjectPath(configModule.source());
|
|
46
73
|
const exeCommand = js_1.JS.chain(exeTempCommand)
|
|
@@ -73,8 +100,10 @@ exports.default = (commandName) => {
|
|
|
73
100
|
}
|
|
74
101
|
if (result.status === null || result.status > 0 || result.error) {
|
|
75
102
|
throw new error_1.default('The script exited with code greater than 0 or an error', {
|
|
76
|
-
exit:
|
|
77
|
-
original: new Error(JSON.stringify(result))
|
|
103
|
+
exit: 0,
|
|
104
|
+
original: new Error(JSON.stringify(result)),
|
|
105
|
+
errorId: 'EXEC-SCRIPT-4',
|
|
106
|
+
arg: [ansi_colors_1.bold(commandName), ansi_colors_1.italic.red(JSON.stringify(result, null, ' '))]
|
|
78
107
|
});
|
|
79
108
|
}
|
|
80
109
|
return result;
|