zcatalyst-cli 1.11.1 → 1.13.0
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/optional-import.toml +10 -0
- 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 +12 -5
- 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 +11 -9
- 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 +32 -5
- 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 +8 -8
- 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 +8 -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 +29 -27
- package/lib/init/features/client/initializers/basic.js +10 -6
- package/lib/init/features/client/initializers/lyte.js +12 -13
- package/lib/init/features/client/initializers/react.js +23 -18
- 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 +12 -7
- 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 +30 -11
- package/lib/plugin-loader.js +28 -13
- 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 +33 -30
- 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 +16 -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/config/lib/client.js +18 -21
- 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 +20 -12
- 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/global-space.js +0 -97
- 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 +40 -40
- package/scripts/postInstall.js +7 -6
- package/templates/init/functions/java/integ/cliq/com/handlers/BotHandler.java +23 -5
- package/templates/init/functions/node/integ/cliq/handlers/bot-handler.js +23 -8
- 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/docs/.DS_Store +0 -0
- package/lib/serve/server/lib/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
- 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
|
@@ -24,41 +24,41 @@ const logger_1 = require("../../util_modules/logger");
|
|
|
24
24
|
const project_1 = require("../../util_modules/project");
|
|
25
25
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
26
|
const apigName = config_1.apigConfig.rules();
|
|
27
|
-
const apigDirPath = project_1.resolveProjectPath(apigName);
|
|
28
|
-
if (sync_1.isPathOutside(runtime_store_1.default.get('project.root'), apigDirPath)) {
|
|
29
|
-
logger_1.info('Skipping APIG pull since rules file is outside root dir : ' +
|
|
27
|
+
const apigDirPath = (0, project_1.resolveProjectPath)(apigName);
|
|
28
|
+
if ((0, sync_1.isPathOutside)(runtime_store_1.default.get('project.root'), apigDirPath)) {
|
|
29
|
+
(0, logger_1.info)('Skipping APIG pull since rules file is outside root dir : ' +
|
|
30
30
|
runtime_store_1.default.get('project.root'));
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
const apigAPIs = yield endpoints_1.apigAPI();
|
|
33
|
+
const apigAPIs = yield (0, endpoints_1.apigAPI)();
|
|
34
34
|
const apigStatus = (yield apigAPIs.getAPIGStatus());
|
|
35
35
|
if (!apigStatus.status) {
|
|
36
|
-
logger_1.info();
|
|
36
|
+
(0, logger_1.info)();
|
|
37
37
|
const consent = yield prompt_1.default.ask(prompt_1.default.question('enable', 'The APIG is disable in catalyst console, Do you want to enable it and pull the APIG rules now ?', {
|
|
38
38
|
type: 'confirm',
|
|
39
39
|
defaultAns: false
|
|
40
40
|
}));
|
|
41
41
|
if (!consent.enable) {
|
|
42
|
-
logger_1.info('Skipping APIG pull. Since the APIG is disabled in catalyst console.');
|
|
42
|
+
(0, logger_1.info)('Skipping APIG pull. Since the APIG is disabled in catalyst console.');
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
yield apigAPIs.updateAPIGStatus(true);
|
|
46
46
|
}
|
|
47
47
|
const fileExists = yield fs_1.ASYNC.fileExists(apigDirPath);
|
|
48
48
|
const overwriteAns = fileExists
|
|
49
|
-
? yield prompt_1.default.ask(prompt_1.default.question('overwrite', 'File ' + ansi_colors_1.underline(apigDirPath) + ' already exists. Overwrite ?', {
|
|
49
|
+
? yield prompt_1.default.ask(prompt_1.default.question('overwrite', 'File ' + (0, ansi_colors_1.underline)(apigDirPath) + ' already exists. Overwrite ?', {
|
|
50
50
|
type: 'confirm',
|
|
51
51
|
defaultAns: false
|
|
52
52
|
}))
|
|
53
53
|
: { overwrite: true };
|
|
54
54
|
if (!overwriteAns.overwrite) {
|
|
55
|
-
logger_1.info('Skipping APIG pull');
|
|
55
|
+
(0, logger_1.info)('Skipping APIG pull');
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
yield fs_1.ASYNC.deleteFile(apigDirPath).catch();
|
|
59
59
|
const rulesArr = (yield apigAPIs.getAllRules());
|
|
60
60
|
if (!rulesArr || rulesArr.length === 0) {
|
|
61
|
-
logger_1.info('No rules found in remote console');
|
|
61
|
+
(0, logger_1.info)('No rules found in remote console');
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
64
|
const fileContent = JSON.stringify(rulesArr, null, 2) + '\n';
|
|
@@ -25,29 +25,29 @@ const logger_1 = require("../../util_modules/logger");
|
|
|
25
25
|
const project_1 = require("../../util_modules/project");
|
|
26
26
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
27
|
const clientDirName = config_1.clientConfig.source();
|
|
28
|
-
const clientDirPath = project_1.resolveProjectPath(clientDirName);
|
|
29
|
-
const webappAPI = yield endpoints_1.clientAPI();
|
|
28
|
+
const clientDirPath = (0, project_1.resolveProjectPath)(clientDirName);
|
|
29
|
+
const webappAPI = yield (0, endpoints_1.clientAPI)();
|
|
30
30
|
const historyArr = (yield webappAPI.getAllHistory());
|
|
31
31
|
if (historyArr.length === 0) {
|
|
32
|
-
logger_1.info('No history details found in remote console');
|
|
32
|
+
(0, logger_1.info)('No history details found in remote console');
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
const folderExits = yield fs_1.ASYNC.dirExists(clientDirPath);
|
|
36
36
|
const overwriteAns = folderExits
|
|
37
|
-
? yield prompt_1.default.ask(prompt_1.default.question('overwrite', 'Directory ' + ansi_colors_1.underline(clientDirName) + ' already exists. Overwrite ?', {
|
|
37
|
+
? yield prompt_1.default.ask(prompt_1.default.question('overwrite', 'Directory ' + (0, ansi_colors_1.underline)(clientDirName) + ' already exists. Overwrite ?', {
|
|
38
38
|
type: 'confirm',
|
|
39
39
|
defaultAns: false
|
|
40
40
|
}))
|
|
41
41
|
: { overwrite: true };
|
|
42
42
|
if (!overwriteAns.overwrite) {
|
|
43
|
-
logger_1.info('Skipping client pull');
|
|
43
|
+
(0, logger_1.info)('Skipping client pull');
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
46
|
yield fs_1.ASYNC.deleteDir(clientDirPath).catch();
|
|
47
47
|
const choices = historyArr.map((history) => {
|
|
48
48
|
let live = '';
|
|
49
49
|
if (js_1.JS.get(history, 'status', false)) {
|
|
50
|
-
live = ansi_colors_1.cyan(' (LIVE)');
|
|
50
|
+
live = (0, ansi_colors_1.cyan)(' (LIVE)');
|
|
51
51
|
}
|
|
52
52
|
return prompt_1.default.choice(history.app_version + live, {
|
|
53
53
|
value: history.history_id,
|
|
@@ -62,5 +62,5 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
62
62
|
yield new archiver_1.default().load(clientZip).extract(clientDirPath).finalize();
|
|
63
63
|
yield client_utils_1.clientUtils.validate();
|
|
64
64
|
runtime_store_1.default.set('payload.client', runtime_store_1.default.get('context.client'));
|
|
65
|
-
runtime_store_1.default.set('payload.client.source', project_1.resolveProjectPath(clientDirName));
|
|
65
|
+
runtime_store_1.default.set('payload.client.source', (0, project_1.resolveProjectPath)(clientDirName));
|
|
66
66
|
});
|
|
@@ -28,12 +28,12 @@ const project_1 = require("../../../util_modules/project");
|
|
|
28
28
|
const runtime_1 = __importDefault(require("../../../util_modules/constants/lib/runtime"));
|
|
29
29
|
const error_1 = __importDefault(require("../../../error"));
|
|
30
30
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
|
-
const fnAPI = yield endpoints_1.functionsAPI();
|
|
31
|
+
const fnAPI = yield (0, endpoints_1.functionsAPI)();
|
|
32
32
|
const fnDirName = config_1.functionsConfig.source();
|
|
33
|
-
const fnDirPath = project_1.resolveProjectPath(fnDirName);
|
|
33
|
+
const fnDirPath = (0, project_1.resolveProjectPath)(fnDirName);
|
|
34
34
|
const fnArr = (yield fnAPI.getAllFunctions());
|
|
35
35
|
if (!Array.isArray(fnArr) || fnArr.length === 0) {
|
|
36
|
-
logger_1.info('No function found in remote console.');
|
|
36
|
+
(0, logger_1.info)('No function found in remote console.');
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
const choicesObj = fnArr.reduce((accumulator, fn) => {
|
|
@@ -47,7 +47,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
47
47
|
stack: fn.stack,
|
|
48
48
|
name,
|
|
49
49
|
type: type,
|
|
50
|
-
source: path_1.join(fnDirPath, name)
|
|
50
|
+
source: (0, path_1.join)(fnDirPath, name)
|
|
51
51
|
},
|
|
52
52
|
short: name
|
|
53
53
|
});
|
|
@@ -57,7 +57,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
57
57
|
return accumulator;
|
|
58
58
|
}, {});
|
|
59
59
|
const choicesArr = js_1.JS.transform(choicesObj, (result, value, key) => {
|
|
60
|
-
result.push(prompt_1.default.
|
|
60
|
+
result.push(prompt_1.default.separator('----' + key + '----'));
|
|
61
61
|
result.push(...value);
|
|
62
62
|
return result;
|
|
63
63
|
}, []);
|
|
@@ -68,11 +68,11 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
68
68
|
if (js_1.JS.isEmpty(ansArr)) {
|
|
69
69
|
return ('Must select at least one feature.\n' +
|
|
70
70
|
'(Press ' +
|
|
71
|
-
ansi_colors_1.cyan('<space>') +
|
|
71
|
+
(0, ansi_colors_1.cyan)('<space>') +
|
|
72
72
|
' to select, ' +
|
|
73
|
-
ansi_colors_1.cyan('<a>') +
|
|
73
|
+
(0, ansi_colors_1.cyan)('<a>') +
|
|
74
74
|
' to toggle all, ' +
|
|
75
|
-
ansi_colors_1.cyan('<i>') +
|
|
75
|
+
(0, ansi_colors_1.cyan)('<i>') +
|
|
76
76
|
' to invert selection)');
|
|
77
77
|
}
|
|
78
78
|
return true;
|
|
@@ -82,7 +82,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
82
82
|
yield Promise.all(functionsAns.functions.map((fn) => __awaiter(void 0, void 0, void 0, function* () {
|
|
83
83
|
const folderExists = yield fs_1.ASYNC.dirExists(fn.source);
|
|
84
84
|
if (folderExists) {
|
|
85
|
-
dirOverwriteQns.push(prompt_1.default.question(fn.name, 'Directory ' + ansi_colors_1.underline(fn.source) + ' already exists. Overwrite ?', {
|
|
85
|
+
dirOverwriteQns.push(prompt_1.default.question(fn.name, 'Directory ' + (0, ansi_colors_1.underline)(fn.source) + ' already exists. Overwrite ?', {
|
|
86
86
|
type: 'confirm',
|
|
87
87
|
defaultAns: false
|
|
88
88
|
}));
|
|
@@ -93,7 +93,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
93
93
|
if (dirOverwriteAns[fn.name] === undefined || dirOverwriteAns[fn.name]) {
|
|
94
94
|
return true;
|
|
95
95
|
}
|
|
96
|
-
logger_1.message('skipping pull of function: ' + fn.name);
|
|
96
|
+
(0, logger_1.message)('skipping pull of function: ' + fn.name);
|
|
97
97
|
return false;
|
|
98
98
|
});
|
|
99
99
|
if (js_1.JS.isEmpty(targets)) {
|
|
@@ -109,19 +109,19 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
109
109
|
var _a, _b;
|
|
110
110
|
yield fs_1.ASYNC.ensureDir(fn.source);
|
|
111
111
|
const buffer = (yield fnAPI.download(fn.id));
|
|
112
|
-
yield new archiver_1.default().load(buffer).extract(path_1.join(fnDirPath, fn.name)).finalize();
|
|
112
|
+
yield new archiver_1.default().load(buffer).extract((0, path_1.join)(fnDirPath, fn.name)).finalize();
|
|
113
113
|
if ((_a = fn.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.nodejs)) {
|
|
114
|
-
yield languages_1.node(fn);
|
|
114
|
+
yield (0, languages_1.node)(fn);
|
|
115
115
|
}
|
|
116
116
|
else if ((_b = fn.stack) === null || _b === void 0 ? void 0 : _b.startsWith(runtime_1.default.language.java)) {
|
|
117
|
-
yield languages_1.java(fn);
|
|
117
|
+
yield (0, languages_1.java)(fn);
|
|
118
118
|
}
|
|
119
119
|
return fn;
|
|
120
120
|
})));
|
|
121
121
|
targets = targets.filter((target) => {
|
|
122
122
|
if (!target.valid) {
|
|
123
|
-
logger_1.debug('Invalid target : ' + target.name + ' reason : ' + target.failure_reason);
|
|
124
|
-
logger_1.warning(`skipping pull of function(${target.name}) since the package is invalid. \nContact catalyst support with debug log.`);
|
|
123
|
+
(0, logger_1.debug)('Invalid target : ' + target.name + ' reason : ' + target.failure_reason);
|
|
124
|
+
(0, logger_1.warning)(`skipping pull of function(${target.name}) since the package is invalid. \nContact catalyst support with debug log.`);
|
|
125
125
|
new error_1.default('invalid package: ' + target.name, { exit: 2 });
|
|
126
126
|
}
|
|
127
127
|
return target.valid;
|
|
@@ -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];
|
package/lib/pull/index.js
CHANGED
|
@@ -31,17 +31,17 @@ function pull() {
|
|
|
31
31
|
errorId: 'PULL-1',
|
|
32
32
|
arg: [
|
|
33
33
|
ansi_colors_1.bold.red(feature),
|
|
34
|
-
ansi_colors_1.bold(Object.keys(features_1.default)
|
|
34
|
+
(0, ansi_colors_1.bold)(Object.keys(features_1.default)
|
|
35
35
|
.map((feat) => '* ' + feat)
|
|
36
36
|
.join('\n'))
|
|
37
37
|
]
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
const MODULE = features_1.default[feature];
|
|
41
|
-
logger_1.info(ansi_colors_1.bold('\n' + ansi_colors_1.white('===> ') + js_1.JS.capitalize(feature) + ' Setup'));
|
|
41
|
+
(0, logger_1.info)((0, ansi_colors_1.bold)('\n' + (0, ansi_colors_1.white)('===> ') + js_1.JS.capitalize(feature) + ' Setup'));
|
|
42
42
|
yield MODULE().catch((err) => {
|
|
43
|
-
logger_1.info();
|
|
44
|
-
logger_1.warning(`Skipping pull of ${feature}. Since ${err.message}.\nContact Catalyst Support with catalyst-debug.log file.`);
|
|
43
|
+
(0, logger_1.info)();
|
|
44
|
+
(0, logger_1.warning)(`Skipping pull of ${feature}. Since ${err.message}.\nContact Catalyst Support with catalyst-debug.log file.`);
|
|
45
45
|
});
|
|
46
46
|
if (runtime_store_1.default.get('payload.' + feature, false)) {
|
|
47
47
|
runtime_store_1.default.set('payload.features', runtime_store_1.default.get('payload.features', []).concat(feature));
|
package/lib/repl-server.js
CHANGED
|
@@ -9,7 +9,7 @@ const error_1 = __importDefault(require("./error"));
|
|
|
9
9
|
const stdin = process.stdin;
|
|
10
10
|
const ASCII_ETX_CODE = 0x03;
|
|
11
11
|
class Repl {
|
|
12
|
-
constructor({ prompt = '>', writer = (output) => util_1.inspect(output), useColors = true, ignoreUndefined = false } = {}) {
|
|
12
|
+
constructor({ prompt = '>', writer = (output) => (0, util_1.inspect)(output), useColors = true, ignoreUndefined = false } = {}) {
|
|
13
13
|
this.prompt = prompt;
|
|
14
14
|
this.writer = writer;
|
|
15
15
|
this.useColors = useColors;
|
|
@@ -21,7 +21,7 @@ class Repl {
|
|
|
21
21
|
this.pureEmit = stdin.emit;
|
|
22
22
|
}
|
|
23
23
|
start() {
|
|
24
|
-
this.server = repl_1.start({
|
|
24
|
+
this.server = (0, repl_1.start)({
|
|
25
25
|
prompt: this.prompt,
|
|
26
26
|
writer: this.writer,
|
|
27
27
|
useColors: this.useColors,
|
|
@@ -14,7 +14,7 @@ const config_1 = require("../../util_modules/config");
|
|
|
14
14
|
const logger_1 = require("../../util_modules/logger");
|
|
15
15
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
16
|
if (!config_1.apigConfig.enabled()) {
|
|
17
|
-
logger_1.info('Skipping API Gateway rules');
|
|
17
|
+
(0, logger_1.info)('Skipping API Gateway rules');
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
apig_utils_1.apigUtils.executeHook({ prefix: 'pre', command: 'serve' });
|
|
@@ -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];
|
|
@@ -45,9 +49,9 @@ function client() {
|
|
|
45
49
|
}
|
|
46
50
|
catch (e) {
|
|
47
51
|
const err = error_1.default.getErrorInstance(e);
|
|
48
|
-
logger_1.info();
|
|
49
|
-
logger_1.warning('Skipping the serve of Client because of the error: ' + err.message);
|
|
50
|
-
logger_1.info();
|
|
52
|
+
(0, logger_1.info)();
|
|
53
|
+
(0, logger_1.warning)('Skipping the serve of Client because of the error: ' + err.message);
|
|
54
|
+
(0, logger_1.info)();
|
|
51
55
|
return;
|
|
52
56
|
}
|
|
53
57
|
const clientName = runtime_store_1.default.get('context.client.name');
|
package/lib/serve/index.js
CHANGED
|
@@ -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];
|
|
@@ -48,19 +52,19 @@ const server_1 = __importDefault(require("./server"));
|
|
|
48
52
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
53
|
const serveTargets = runtime_store_1.default.get('context.targets', []);
|
|
50
54
|
const advancedServer = new server_1.default();
|
|
51
|
-
const basicFnServer = new http_functions_1.default();
|
|
55
|
+
const basicFnServer = new http_functions_1.default({ primary: false });
|
|
52
56
|
try {
|
|
53
57
|
const masterPort = yield port_resolver_1.default.getPort('master', 'http', 'master', false);
|
|
54
58
|
runtime_store_1.default.set('context.port.http.master', masterPort);
|
|
55
59
|
yield Promise.all(serveTargets.map((target) => features[target]()));
|
|
56
60
|
const rawTargets = runtime_store_1.default.get('context.functions.targets', []);
|
|
57
|
-
const watchOpt = option_1.getOptionValue('watch', false);
|
|
61
|
+
const watchOpt = (0, option_1.getOptionValue)('watch', false);
|
|
58
62
|
if (watchOpt) {
|
|
59
|
-
yield Promise.all(rawTargets.map((target) => __awaiter(void 0, void 0, void 0, function* () { return (target.valid ? fn_watcher_1.default(target) : undefined); })));
|
|
63
|
+
yield Promise.all(rawTargets.map((target) => __awaiter(void 0, void 0, void 0, function* () { return (target.valid ? (0, fn_watcher_1.default)(target) : undefined); })));
|
|
60
64
|
}
|
|
61
65
|
const funtionTargets = rawTargets.filter((target) => {
|
|
62
66
|
if (!target.valid) {
|
|
63
|
-
logger_1.warning('skipping serve of function [' +
|
|
67
|
+
(0, logger_1.warning)('skipping serve of function [' +
|
|
64
68
|
target.name +
|
|
65
69
|
'] since ' +
|
|
66
70
|
target.failure_reason);
|
|
@@ -75,7 +79,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
75
79
|
const client = runtime_store_1.default.get('context.client', false);
|
|
76
80
|
if (client && client.valid) {
|
|
77
81
|
client.opts = {
|
|
78
|
-
open: option_1.getOptionValue('open', false),
|
|
82
|
+
open: (0, option_1.getOptionValue)('open', false),
|
|
79
83
|
watch: watchOpt
|
|
80
84
|
};
|
|
81
85
|
advancedServer.add('client', client);
|
|
@@ -85,7 +89,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
85
89
|
}
|
|
86
90
|
}
|
|
87
91
|
if (serveTargets.includes('functions') && funtionTargets.length === 0) {
|
|
88
|
-
logger_1.labeled('functions', 'No targets are ready to be served in local').WARN();
|
|
92
|
+
(0, logger_1.labeled)('functions', 'No targets are ready to be served in local').WARN();
|
|
89
93
|
serveTargets.splice(serveTargets.indexOf('functions'), 1);
|
|
90
94
|
runtime_store_1.default.set('context.targets', serveTargets);
|
|
91
95
|
}
|
|
@@ -105,7 +109,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
105
109
|
yield advancedServer.start();
|
|
106
110
|
yield advancedServer.wait();
|
|
107
111
|
yield Promise.all([
|
|
108
|
-
fs_1.ASYNC.deleteDir(path_1.join(runtime_store_1.default.get('cwd'), '.build')).catch(),
|
|
112
|
+
fs_1.ASYNC.deleteDir((0, path_1.join)(runtime_store_1.default.get('cwd'), '.build')).catch(),
|
|
109
113
|
advancedServer ? advancedServer.stop() : undefined,
|
|
110
114
|
basicFnServer ? basicFnServer.stop() : undefined
|
|
111
115
|
]);
|
|
@@ -121,12 +125,12 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
121
125
|
command: 'serve'
|
|
122
126
|
});
|
|
123
127
|
}
|
|
124
|
-
logger_1.info();
|
|
125
|
-
logger_1.success('Shutdown complete');
|
|
128
|
+
(0, logger_1.info)();
|
|
129
|
+
(0, logger_1.success)('Shutdown complete');
|
|
126
130
|
}
|
|
127
131
|
catch (e) {
|
|
128
132
|
yield Promise.all([
|
|
129
|
-
fs_1.ASYNC.deleteDir(path_1.join(runtime_store_1.default.get('cwd'), '.build')).catch(),
|
|
133
|
+
fs_1.ASYNC.deleteDir((0, path_1.join)(runtime_store_1.default.get('cwd'), '.build')).catch(),
|
|
130
134
|
advancedServer ? advancedServer.stop() : undefined,
|
|
131
135
|
basicFnServer ? basicFnServer.stop() : undefined
|
|
132
136
|
]);
|
|
@@ -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];
|
|
@@ -62,7 +66,7 @@ class Server {
|
|
|
62
66
|
_addBasicFnDetails() {
|
|
63
67
|
const fnTargets = runtime_store_1.default.get('context.functions.targets', []);
|
|
64
68
|
if (fnTargets.length === 0) {
|
|
65
|
-
logger_1.debug('No basic functions to add');
|
|
69
|
+
(0, logger_1.debug)('No basic functions to add');
|
|
66
70
|
}
|
|
67
71
|
const httpPort = parseInt(runtime_store_1.default.get('context.port.http.' + constants_1.REMOTE_REF.functions.type[constants_1.FN_TYPE.basic]), 10);
|
|
68
72
|
const debugPort = parseInt(runtime_store_1.default.get('context.port.debug.' + constants_1.REMOTE_REF.functions.type[constants_1.FN_TYPE.basic], '-1'), 10);
|
|
@@ -83,45 +87,47 @@ class Server {
|
|
|
83
87
|
_spinUpJavaServer(details, masterPort) {
|
|
84
88
|
var _a, _b, _c, _d;
|
|
85
89
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
const javaServer = path_1.join(runtime_store_1.default.get('cwd'), '.build', '.catalyst', 'aioserver', 'JavaaioServer');
|
|
87
|
-
const targetDir = path_1.join(runtime_store_1.default.get('cwd'), '.build', (_a = details.target) === null || _a === void 0 ? void 0 : _a.name);
|
|
90
|
+
const javaServer = (0, path_1.join)(runtime_store_1.default.get('cwd'), '.build', '.catalyst', 'aioserver', 'JavaaioServer');
|
|
91
|
+
const targetDir = (0, path_1.join)(runtime_store_1.default.get('cwd'), '.build', (_a = details.target) === null || _a === void 0 ? void 0 : _a.name);
|
|
88
92
|
const label = `${details.type}[${(_b = details.target) === null || _b === void 0 ? void 0 : _b.name}]`;
|
|
89
|
-
fn_utils_1.fnUtils.java.ensureJavaInvoker(javaServer, path_1.normalize(path_1.join(__dirname, './lib', 'java', 'JavaaioServer.java')));
|
|
90
|
-
const serverFiles = yield fs_1.ASYNC.walk(path_1.dirname(javaServer));
|
|
93
|
+
fn_utils_1.fnUtils.java.ensureJavaInvoker(javaServer, (0, path_1.normalize)((0, path_1.join)(__dirname, './lib', 'java', 'JavaaioServer.java')));
|
|
94
|
+
const serverFiles = yield fs_1.ASYNC.walk((0, path_1.dirname)(javaServer));
|
|
91
95
|
yield Promise.all(serverFiles.map((file) => __awaiter(this, void 0, void 0, function* () {
|
|
92
|
-
return fs_1.ASYNC.copyFile(file, path_1.join(targetDir, path_1.relative(path_1.dirname(javaServer), file.replace('lib' + path_1.sep, ''))));
|
|
96
|
+
return fs_1.ASYNC.copyFile(file, (0, path_1.join)(targetDir, (0, path_1.relative)((0, path_1.dirname)(javaServer), file.replace('lib' + path_1.sep, ''))));
|
|
93
97
|
})));
|
|
94
98
|
const opts = [
|
|
95
99
|
'-cp',
|
|
96
|
-
path_1.join(targetDir, '*') + fn_utils_1.fnUtils.java.classPathSep + targetDir + path_1.sep,
|
|
100
|
+
(0, path_1.join)(targetDir, '*') + fn_utils_1.fnUtils.java.classPathSep + targetDir + path_1.sep,
|
|
97
101
|
'-DCATALYST_FUNCTION_TYPE=applogic'
|
|
98
102
|
];
|
|
99
103
|
if (details.debugPort !== -1) {
|
|
100
|
-
logger_1.labeled(label, 'you can attach your debugger at port : ' + details.debugPort).MESSAGE();
|
|
104
|
+
(0, logger_1.labeled)(label, 'you can attach your debugger at port : ' + details.debugPort).MESSAGE();
|
|
101
105
|
opts.push('-Xdebug');
|
|
102
106
|
opts.push('-Xrunjdwp:transport=dt_socket,address=' + details.debugPort + ',server=y,suspend=y');
|
|
103
107
|
}
|
|
104
|
-
opts.push(path_1.basename(javaServer));
|
|
108
|
+
opts.push((0, path_1.basename)(javaServer));
|
|
105
109
|
opts.push(details.httpPort + '');
|
|
106
110
|
const targetSource = (_c = details.target) === null || _c === void 0 ? void 0 : _c.source;
|
|
107
111
|
const configType = details.type === 'server' ? 'functions' : details.type;
|
|
108
|
-
const servePlugin = yield plugin_loader_1.default(configType, 'start', targetSource).catch((err) => logger_1.debug(err));
|
|
112
|
+
const servePlugin = yield (0, plugin_loader_1.default)(configType, 'start', targetSource).catch((err) => (0, logger_1.debug)(err));
|
|
109
113
|
if (typeof servePlugin === 'function') {
|
|
110
114
|
const event = servePlugin(details, masterPort);
|
|
111
|
-
logger_1.labeled(label, `Plugin : "${runtime_store_1.default.get(`context.${configType}.plugins.start${targetSource ? '.' + targetSource : ''}`)}" is used for ${details.type} serve`).MESSAGE();
|
|
115
|
+
(0, logger_1.labeled)(label, `Plugin : "${runtime_store_1.default.get(`context.${configType}.plugins.start${targetSource ? '.' + targetSource : ''}`)}" is used for ${details.type} serve`).MESSAGE();
|
|
112
116
|
return event;
|
|
113
117
|
}
|
|
114
|
-
const child = shell_1.spawn('java', opts, {
|
|
118
|
+
const child = (0, shell_1.spawn)('java', opts, {
|
|
115
119
|
cwd: targetSource,
|
|
116
120
|
stdio: 'pipe',
|
|
117
121
|
env: {
|
|
118
122
|
X_ZOHO_CATALYST_IS_LOCAL: 'true',
|
|
123
|
+
X_ZOHO_CATALYST_FUNCTION_LOADED: 'true',
|
|
124
|
+
X_ZOHO_CATALYST_CODE_LOCATION: targetDir + path_1.sep,
|
|
119
125
|
X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth,
|
|
120
126
|
X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin
|
|
121
127
|
}
|
|
122
128
|
}).RAW();
|
|
123
|
-
logger_1.labeled(label, `URL : http://localhost:${masterPort}/server/${(_d = details.target) === null || _d === void 0 ? void 0 : _d.name}/`).MESSAGE();
|
|
124
|
-
logger_1.info();
|
|
129
|
+
(0, logger_1.labeled)(label, `URL : http://localhost:${masterPort}/server/${(_d = details.target) === null || _d === void 0 ? void 0 : _d.name}/`).MESSAGE();
|
|
130
|
+
(0, logger_1.info)();
|
|
125
131
|
return child;
|
|
126
132
|
});
|
|
127
133
|
}
|
|
@@ -131,17 +137,17 @@ class Server {
|
|
|
131
137
|
const label = `${details.type}[${(_a = details.target) === null || _a === void 0 ? void 0 : _a.name}]`;
|
|
132
138
|
const _d = details.target, { ['watcher']: _ } = _d, serialisableTarget = __rest(_d, ['watcher']);
|
|
133
139
|
const opts = [
|
|
134
|
-
path_1.join(__dirname, 'lib', 'node.js'),
|
|
140
|
+
(0, path_1.join)(__dirname, 'lib', 'node.js'),
|
|
135
141
|
details.httpPort + '',
|
|
136
142
|
JSON.stringify(serialisableTarget)
|
|
137
143
|
];
|
|
138
144
|
if (details.debugPort !== -1) {
|
|
139
|
-
logger_1.labeled(label, 'you can attach your debugger at port : ' + details.debugPort).MESSAGE();
|
|
145
|
+
(0, logger_1.labeled)(label, 'you can attach your debugger at port : ' + details.debugPort).MESSAGE();
|
|
140
146
|
opts.unshift('--inspect=' + details.debugPort);
|
|
141
147
|
}
|
|
142
148
|
const targetSource = (_b = details.target) === null || _b === void 0 ? void 0 : _b.source;
|
|
143
149
|
const configType = details.type === 'server' ? 'functions' : details.type;
|
|
144
|
-
const servePlugin = yield plugin_loader_1.default(configType, 'start', targetSource).catch((err) => logger_1.debug(err));
|
|
150
|
+
const servePlugin = yield (0, plugin_loader_1.default)(configType, 'start', targetSource).catch((err) => (0, logger_1.debug)(err));
|
|
145
151
|
if (typeof servePlugin === 'function') {
|
|
146
152
|
const event = servePlugin(details, masterPort).catch((e) => {
|
|
147
153
|
var _a, _b;
|
|
@@ -152,28 +158,29 @@ class Server {
|
|
|
152
158
|
err.errorId = 'SERVE-IDX-1';
|
|
153
159
|
err.arg = [
|
|
154
160
|
configType,
|
|
155
|
-
ansi_colors_1.bold(((_b = (_a = details.target) === null || _a === void 0 ? void 0 : _a.plugins) === null || _b === void 0 ? void 0 : _b.start)[targetSource] || 'start'),
|
|
156
|
-
ansi_colors_1.bold('Error: ') + ansi_colors_1.italic.red(err.message)
|
|
161
|
+
(0, ansi_colors_1.bold)(((_b = (_a = details.target) === null || _a === void 0 ? void 0 : _a.plugins) === null || _b === void 0 ? void 0 : _b.start)[targetSource] || 'start'),
|
|
162
|
+
(0, ansi_colors_1.bold)('Error: ') + ansi_colors_1.italic.red(err.message)
|
|
157
163
|
];
|
|
158
164
|
throw err;
|
|
159
165
|
});
|
|
160
|
-
logger_1.labeled(label, `Plugin : "${runtime_store_1.default.get(`context.${configType}.plugins.start${targetSource ? '.' + targetSource : ''}`)}" is used for ${details.type} serve`).MESSAGE();
|
|
166
|
+
(0, logger_1.labeled)(label, `Plugin : "${runtime_store_1.default.get(`context.${configType}.plugins.start${targetSource ? '.' + targetSource : ''}`)}" is used for ${details.type} serve`).MESSAGE();
|
|
161
167
|
return event;
|
|
162
168
|
}
|
|
163
169
|
if (details.type === 'client') {
|
|
164
170
|
return yield (yield Promise.resolve().then(() => __importStar(require('./lib/web_client/index.js')))).default(details, masterPort);
|
|
165
171
|
}
|
|
166
|
-
const child = shell_1.spawn('node', opts, {
|
|
172
|
+
const child = (0, shell_1.spawn)('node', opts, {
|
|
167
173
|
cwd: targetSource,
|
|
168
174
|
stdio: 'pipe',
|
|
169
175
|
env: {
|
|
170
176
|
X_ZOHO_CATALYST_IS_LOCAL: 'true',
|
|
177
|
+
X_ZOHO_CATALYST_FUNCTION_LOADED: 'true',
|
|
171
178
|
X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth,
|
|
172
179
|
X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin
|
|
173
180
|
}
|
|
174
181
|
}).RAW();
|
|
175
|
-
logger_1.labeled(label, `URL : http://localhost:${masterPort}/server/${(_c = details.target) === null || _c === void 0 ? void 0 : _c.name}/`).MESSAGE();
|
|
176
|
-
logger_1.info();
|
|
182
|
+
(0, logger_1.labeled)(label, `URL : http://localhost:${masterPort}/server/${(_c = details.target) === null || _c === void 0 ? void 0 : _c.name}/`).MESSAGE();
|
|
183
|
+
(0, logger_1.info)();
|
|
177
184
|
return child;
|
|
178
185
|
});
|
|
179
186
|
}
|
|
@@ -228,7 +235,7 @@ class Server {
|
|
|
228
235
|
exit: 2
|
|
229
236
|
});
|
|
230
237
|
}
|
|
231
|
-
const server = yield master_1.default(masterPort, this.targetDetailsArr);
|
|
238
|
+
const server = yield (0, master_1.default)(masterPort, this.targetDetailsArr);
|
|
232
239
|
this.masterServer = server;
|
|
233
240
|
return new Promise((res) => {
|
|
234
241
|
server.on('listening', () => {
|
|
@@ -249,7 +256,7 @@ class Server {
|
|
|
249
256
|
wait() {
|
|
250
257
|
return __awaiter(this, void 0, void 0, function* () {
|
|
251
258
|
if (!this.masterServer) {
|
|
252
|
-
logger_1.debug('Master server is not started yet.');
|
|
259
|
+
(0, logger_1.debug)('Master server is not started yet.');
|
|
253
260
|
throw new error_1.default('Server cannot be put to wait state.', { exit: 2 });
|
|
254
261
|
}
|
|
255
262
|
this.targetDetailsArr.forEach((targetdetails) => {
|
|
@@ -263,7 +270,7 @@ class Server {
|
|
|
263
270
|
}));
|
|
264
271
|
(_b = target.watcher) === null || _b === void 0 ? void 0 : _b.on('compiled', () => __awaiter(this, void 0, void 0, function* () {
|
|
265
272
|
yield this.restart(target);
|
|
266
|
-
logger_1.labeled(`server[${target.name}]`, 'ready!').MESSAGE();
|
|
273
|
+
(0, logger_1.labeled)(`server[${target.name}]`, 'ready!').MESSAGE();
|
|
267
274
|
setTimeout(() => {
|
|
268
275
|
var _a;
|
|
269
276
|
(_a = target.watcher) === null || _a === void 0 ? void 0 : _a.emit('next');
|
|
@@ -4,6 +4,7 @@ import java.util.logging.Handler;
|
|
|
4
4
|
import java.util.logging.LogManager;
|
|
5
5
|
import java.util.logging.LogRecord;
|
|
6
6
|
import java.util.logging.Logger;
|
|
7
|
+
import java.util.logging.SimpleFormatter;
|
|
7
8
|
|
|
8
9
|
import com.cop.main.server.DefaultCoreServer;
|
|
9
10
|
|
|
@@ -21,7 +22,7 @@ public class JavaaioServer extends DefaultCoreServer {
|
|
|
21
22
|
if (record.getThrown() != null) {
|
|
22
23
|
exceptionMessage = getStackTraceAsString(record.getThrown());
|
|
23
24
|
}
|
|
24
|
-
String message =
|
|
25
|
+
String message = new SimpleFormatter().format(record) + " " + exceptionMessage;
|
|
25
26
|
if (message.length() > MESSAGE_LENGTH) {
|
|
26
27
|
message = message.substring(0, MESSAGE_LENGTH);
|
|
27
28
|
}
|
|
@@ -67,11 +68,12 @@ public class JavaaioServer extends DefaultCoreServer {
|
|
|
67
68
|
LogManager manager = LogManager.getLogManager();
|
|
68
69
|
manager.reset();
|
|
69
70
|
Logger rootLogger = manager.getLogger("");
|
|
70
|
-
|
|
71
|
+
JavaaioServer aioServer = new JavaaioServer();
|
|
72
|
+
LogHandler handler = aioServer.new LogHandler();
|
|
71
73
|
rootLogger.addHandler(handler);
|
|
72
74
|
|
|
73
75
|
port = Integer.parseInt(args[0]);
|
|
74
|
-
|
|
76
|
+
aioServer.start();
|
|
75
77
|
}
|
|
76
78
|
catch (Exception e) {
|
|
77
79
|
System.out.println(getStackTraceAsString(e));
|
|
Binary file
|
|
Binary file
|
|
Binary file
|