zcatalyst-cli 1.15.0-beta.3 → 1.15.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/appsail-utils.js +84 -0
- package/lib/archiver.js +18 -1
- package/lib/code-deck.js +114 -0
- package/lib/command_needs/rc.js +7 -6
- package/lib/commands/appsail/add.js +55 -0
- package/lib/commands/codelib/install.js +143 -0
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/deploy/appsail.js +62 -0
- package/lib/commands/{deploy.js → deploy/index.js} +20 -14
- package/lib/commands/iac/pack.js +3 -3
- package/lib/commands/index.js +2 -0
- package/lib/commands/init.js +5 -1
- package/lib/commands/pull.js +1 -1
- package/lib/commands/serve.js +1 -1
- package/lib/commands/whoami.js +2 -1
- package/lib/deploy/features/appsail/index.js +246 -0
- package/lib/deploy/features/appsail/utils.js +91 -0
- package/lib/deploy/features/functions/index.js +12 -10
- package/lib/deploy/features/index.js +3 -0
- package/lib/deploy/index.js +3 -3
- package/lib/endpoints/index.js +22 -1
- package/lib/endpoints/lib/appsail.js +98 -0
- package/lib/endpoints/lib/code-deck.js +71 -0
- package/lib/endpoints/lib/common.js +8 -5
- package/lib/endpoints/lib/git-hub.js +148 -0
- package/lib/endpoints/lib/iac.js +15 -0
- package/lib/endpoints/lib/sdk.js +4 -1
- package/lib/execute-script.js +35 -27
- package/lib/fn-utils/lib/browserLogic.js +17 -20
- package/lib/fn-utils/lib/common.js +3 -4
- package/lib/fn-utils/lib/integ.js +3 -3
- package/lib/fn-utils/lib/java.js +7 -1
- package/lib/fn-watcher.js +3 -0
- package/lib/iac/status/deploy.js +26 -4
- package/lib/iac/status/util/index.js +3 -0
- package/lib/init/dependencies/python/ensure-python.js +2 -2
- package/lib/init/dependencies/python/pip-install.js +4 -4
- package/lib/init/features/appsail/index.js +213 -0
- package/lib/init/features/functions/index.js +5 -72
- package/lib/init/features/functions/languages/java.js +7 -3
- package/lib/init/features/functions/languages/node.js +9 -7
- package/lib/init/features/functions/languages/python.js +1 -1
- package/lib/init/features/index.js +28 -12
- package/lib/init/features/project.js +3 -3
- package/lib/init/index.js +1 -1
- package/lib/init/util/common.js +103 -0
- package/lib/internal/api.js +5 -5
- package/lib/internal/command.js +26 -3
- package/lib/option-filter.js +40 -21
- package/lib/prompt/index.js +5 -0
- package/lib/prompt/types/file-path.js +4 -1
- package/lib/prompt/types/tree.js +297 -0
- package/lib/pull/features/functions/index.js +70 -47
- package/lib/serve/features/appsail.js +37 -0
- package/lib/serve/features/index.js +8 -1
- package/lib/serve/index.js +23 -6
- package/lib/serve/server/index.js +111 -233
- package/lib/serve/server/lib/appsail/index.js +134 -0
- package/lib/serve/server/lib/appsail/start.js +75 -0
- package/lib/serve/server/lib/java/index.js +54 -0
- package/lib/serve/server/lib/master.js +84 -60
- package/lib/serve/server/lib/node/index.js +85 -74
- package/lib/serve/server/lib/node/server/index.js +77 -0
- package/lib/serve/server/lib/python/index.js +46 -0
- package/lib/serve/server/lib/web_client/index.js +33 -0
- package/lib/serve/server/lib/web_client/server.js +3 -0
- package/lib/shell/dependencies/http-functions.js +7 -7
- package/lib/shell/dependencies/local-function.js +6 -6
- package/lib/shell/prepare/index.js +1 -1
- package/lib/shell/prepare/languages/index.js +3 -3
- package/lib/shell/prepare/languages/java.js +2 -2
- package/lib/util_modules/config/index.js +3 -1
- package/lib/util_modules/config/lib/appSail.js +89 -0
- package/lib/util_modules/constants/index.js +3 -1
- package/lib/util_modules/constants/lib/default.js +4 -2
- package/lib/util_modules/constants/lib/file-names.js +4 -1
- package/lib/util_modules/constants/lib/runtime.js +12 -3
- package/lib/util_modules/constants/lib/scopes.js +4 -0
- package/lib/util_modules/constants/lib/template.js +23 -20
- package/lib/util_modules/constants/lib/urls.js +5 -0
- package/lib/util_modules/context-help.js +3 -0
- package/lib/util_modules/fs/lib/async.js +10 -3
- package/lib/util_modules/fs/lib/sync.js +2 -2
- package/lib/util_modules/js.js +4 -0
- package/lib/util_modules/project.js +2 -2
- package/lib/util_modules/server.js +2 -1
- package/package.json +1 -1
- package/scripts/postInstall.js +27 -18
- package/templates/init/functions/java/browserLogic/playwright/sample.java +1 -1
- package/templates/init/functions/java/browserLogic/selenium/sample.java +1 -1
- package/templates/init/functions/node/browserlogic/playwright/sample.js +1 -1
- package/templates/init/functions/node/browserlogic/puppeteer/sample.js +1 -1
- package/templates/init/functions/node/browserlogic/selenium/sample.js +1 -1
- package/templates/init/functions/python/aio/requirements.txt +1 -1
- package/templates/init/functions/python/bio/requirements.txt +1 -1
- package/templates/init/functions/python/cron/requirements.txt +1 -1
- package/templates/init/functions/python/event/requirements.txt +1 -1
- package/templates/init/functions/python/integ/cliq/requirements.txt +1 -1
- /package/lib/serve/server/lib/java/{JavaaioServer.java → aio_server/JavaaioServer.java} +0 -0
- /package/lib/serve/server/lib/java/{lib → aio_server/lib}/catalyst-cli-java-runtime-1.0.0.jar +0 -0
- /package/lib/serve/server/lib/java/{lib → aio_server/lib}/catalyst-function-sdk-1.0.0.jar +0 -0
- /package/lib/serve/server/lib/java/{lib → aio_server/lib}/catalyst-java-runtime-1.0.0.jar +0 -0
- /package/lib/serve/server/lib/java/{lib → aio_server/lib}/gradle-wrapper.jar +0 -0
- /package/lib/serve/server/lib/java/{lib → aio_server/lib}/jetty-http-9.3.24.v20180605.jar +0 -0
- /package/lib/serve/server/lib/java/{lib → aio_server/lib}/jetty-io-9.3.24.v20180605.jar +0 -0
- /package/lib/serve/server/lib/java/{lib → aio_server/lib}/jetty-security-9.3.24.v20180605.jar +0 -0
- /package/lib/serve/server/lib/java/{lib → aio_server/lib}/jetty-server-9.3.24.v20180605.jar +0 -0
- /package/lib/serve/server/lib/java/{lib → aio_server/lib}/jetty-servlet-9.3.24.v20180605.jar +0 -0
- /package/lib/serve/server/lib/java/{lib → aio_server/lib}/jetty-util-9.3.24.v20180605.jar +0 -0
- /package/lib/serve/server/lib/java/{lib → aio_server/lib}/org.json.jar +0 -0
- /package/lib/serve/server/lib/java/{lib → aio_server/lib}/servlet-api-3.1.jar +0 -0
- /package/lib/serve/server/lib/java/{lib → aio_server/lib}/zip4j-2.5.0.jar +0 -0
- /package/lib/serve/server/lib/node/{browserlogic → server/browserlogic}/browserlogic-playwright.js +0 -0
- /package/lib/serve/server/lib/node/{browserlogic → server/browserlogic}/browserlogic-puppeteer.js +0 -0
- /package/lib/serve/server/lib/node/{browserlogic → server/browserlogic}/browserlogic-selenium.js +0 -0
- /package/lib/serve/server/lib/node/{browserlogic → server/browserlogic}/index.js +0 -0
- /package/lib/serve/server/lib/node/{browserlogic → server/browserlogic}/utils/deferred_promise.js +0 -0
- /package/lib/serve/server/lib/node/{browserlogic → server/browserlogic}/utils/playwright-handler.js +0 -0
- /package/lib/serve/server/lib/node/{browserlogic → server/browserlogic}/utils/puppeteer-handler.js +0 -0
- /package/lib/serve/server/lib/node/{browserlogic → server/browserlogic}/utils/selenium-handler.js +0 -0
- /package/lib/serve/server/lib/node/{package.json → server/package.json} +0 -0
|
@@ -129,6 +129,9 @@ function webClientServer(httpPort, source, { homepage = 'index.html', enableWatc
|
|
|
129
129
|
if (enableWatch && (requestedFile.includes('.html') || requestedFile.includes('.htm'))) {
|
|
130
130
|
const htmlFile = yield index_js_2.ASYNC.readFile((0, path_1.join)(source, requestedFile));
|
|
131
131
|
if (!htmlFile) {
|
|
132
|
+
res.contentType('text/html');
|
|
133
|
+
res.status(404);
|
|
134
|
+
res.end();
|
|
132
135
|
eventListener.emit('error', new error_js_1.default('Unable to read the html file', {
|
|
133
136
|
exit: 1,
|
|
134
137
|
errorId: 'WEB-CLIENT-SERVER-1',
|
|
@@ -172,7 +172,7 @@ class HttpFunctions {
|
|
|
172
172
|
exit: 2
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
|
-
if ((_a = fnTarget.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.
|
|
175
|
+
if ((_a = fnTarget.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.node.value)) {
|
|
176
176
|
if (debugPort !== -1) {
|
|
177
177
|
slaveOptions.push('--inspect-brk=' + debugPort);
|
|
178
178
|
}
|
|
@@ -203,7 +203,7 @@ class HttpFunctions {
|
|
|
203
203
|
envVars: fnTarget.env_var
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
|
-
else if ((_b = fnTarget.stack) === null || _b === void 0 ? void 0 : _b.startsWith(runtime_1.default.language.java)) {
|
|
206
|
+
else if ((_b = fnTarget.stack) === null || _b === void 0 ? void 0 : _b.startsWith(runtime_1.default.language.java.value)) {
|
|
207
207
|
const javaInvokerDir = (0, path_1.parse)(this.javaInvoker[fnTarget.type]).dir;
|
|
208
208
|
slaveOptions.push('-cp');
|
|
209
209
|
slaveOptions.push(javaInvokerDir +
|
|
@@ -280,15 +280,15 @@ class HttpFunctions {
|
|
|
280
280
|
var _a;
|
|
281
281
|
return t.url !== undefined &&
|
|
282
282
|
t.type === constants_1.FN_TYPE.basic &&
|
|
283
|
-
!((_a = t.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.python));
|
|
283
|
+
!((_a = t.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.python.value));
|
|
284
284
|
})
|
|
285
285
|
.map((t) => {
|
|
286
286
|
this.targets.push(t);
|
|
287
287
|
return js_1.JS.omit(t, ['zip_stream', 'watcher', 'localFn']);
|
|
288
288
|
})
|
|
289
|
-
.forEach((t) =>
|
|
289
|
+
.forEach((t) => {
|
|
290
290
|
var _a;
|
|
291
|
-
if ((_a = t.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.java)) {
|
|
291
|
+
if ((_a = t.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.java.value)) {
|
|
292
292
|
fn_utils_1.fnUtils.java.ensureJavaInvoker(this.javaInvoker[t.type], (0, path_1.normalize)((0, path_1.join)(__dirname, './invoker', t.type, 'java', 'Java' + t.type + 'Invoker.java')));
|
|
293
293
|
}
|
|
294
294
|
const pthName = new url_1.URL(t.url).pathname;
|
|
@@ -301,7 +301,7 @@ class HttpFunctions {
|
|
|
301
301
|
this.app.use(pathWithId, reqHandler(t));
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
|
-
})
|
|
304
|
+
});
|
|
305
305
|
return new Promise((res) => {
|
|
306
306
|
const server = this.app.listen(httpPort, () => {
|
|
307
307
|
this.targets.forEach((target) => {
|
|
@@ -312,7 +312,7 @@ class HttpFunctions {
|
|
|
312
312
|
}
|
|
313
313
|
});
|
|
314
314
|
(_b = target.watcher) === null || _b === void 0 ? void 0 : _b.on('compiled', () => {
|
|
315
|
-
(0, logger_2.labeled)(`functions
|
|
315
|
+
(0, logger_2.labeled)(`functions[${target.name}]`, 'ready!').MESSAGE();
|
|
316
316
|
logUrl(target.name, new url_1.URL(target.url).pathname, httpPort, masterPort);
|
|
317
317
|
if (this.repl && this.repl.paused) {
|
|
318
318
|
this.repl.resume();
|
|
@@ -42,7 +42,7 @@ class LocalFunction {
|
|
|
42
42
|
this.nodeInvoker = (0, path_1.normalize)((0, path_1.join)(__dirname, './invoker', target.type, 'node.mjs'));
|
|
43
43
|
const projectRoot = runtime_store_1.default.get('project.root');
|
|
44
44
|
this.javaInvoker = (0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build, '.catalyst', 'Java' + target.type + 'Invoker');
|
|
45
|
-
if ((_a = target.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.java)) {
|
|
45
|
+
if ((_a = target.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.java.value)) {
|
|
46
46
|
fn_utils_1.fnUtils.java.ensureJavaInvoker(this.javaInvoker, (0, path_1.normalize)((0, path_1.join)(__dirname, './invoker', target.type, 'java', 'Java' + target.type + 'Invoker.java')));
|
|
47
47
|
}
|
|
48
48
|
this.responseFile = (0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build, '.catalyst', 'user_res_body');
|
|
@@ -54,7 +54,7 @@ class LocalFunction {
|
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
(_c = this.watcher) === null || _c === void 0 ? void 0 : _c.on('compiled', () => {
|
|
57
|
-
(0, logger_1.labeled)(`functions
|
|
57
|
+
(0, logger_1.labeled)(`functions[${target.name}]`, 'ready!').MESSAGE();
|
|
58
58
|
if (this.repl.paused) {
|
|
59
59
|
repl.resume();
|
|
60
60
|
repl.showPrompt();
|
|
@@ -94,7 +94,7 @@ class LocalFunction {
|
|
|
94
94
|
const debugPort = runtime_store_1.default.get('context.port.debug.' + constants_1.REMOTE_REF.functions.type[constants_1.FN_TYPE.basic], null);
|
|
95
95
|
yield fs_1.ASYNC.ensureFile(this.responseFile, true);
|
|
96
96
|
yield fs_1.ASYNC.ensureFile(this.metaFile, true);
|
|
97
|
-
if ((_a = this.target.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.
|
|
97
|
+
if ((_a = this.target.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.node.value)) {
|
|
98
98
|
if (debugPort !== null) {
|
|
99
99
|
slaveOptions.push('--inspect-brk=' + debugPort);
|
|
100
100
|
}
|
|
@@ -121,7 +121,7 @@ class LocalFunction {
|
|
|
121
121
|
env: Object.assign({ X_ZOHO_CATALYST_IS_LOCAL: 'true', X_ZOHO_CATALYST_FUNCTION_LOADED: 'true', X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth, X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin, CATALYST_PROJECT_TIMEZONE: (0, project_1.getProjectTimezone)(Intl.DateTimeFormat().resolvedOptions().timeZone) }, this.target.env_var)
|
|
122
122
|
}).RAW();
|
|
123
123
|
}
|
|
124
|
-
else if ((_b = this.target.stack) === null || _b === void 0 ? void 0 : _b.startsWith(runtime_1.default.language.java)) {
|
|
124
|
+
else if ((_b = this.target.stack) === null || _b === void 0 ? void 0 : _b.startsWith(runtime_1.default.language.java.value)) {
|
|
125
125
|
const javaInvokerDir = (0, path_1.parse)(this.javaInvoker).dir;
|
|
126
126
|
slaveOptions.push('-cp');
|
|
127
127
|
slaveOptions.push(javaInvokerDir + fn_utils_1.fnUtils.java.classPathSep + (0, path_1.join)(javaInvokerDir, 'lib', '*'));
|
|
@@ -152,7 +152,7 @@ class LocalFunction {
|
|
|
152
152
|
env: Object.assign({ X_ZOHO_CATALYST_IS_LOCAL: 'true', X_ZOHO_CATALYST_FUNCTION_LOADED: 'true', X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth, X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin, CATALYST_PROJECT_TIMEZONE: (0, project_1.getProjectTimezone)(Intl.DateTimeFormat().resolvedOptions().timeZone) }, this.target.env_var)
|
|
153
153
|
}).RAW();
|
|
154
154
|
}
|
|
155
|
-
else if ((_c = this.target.stack) === null || _c === void 0 ? void 0 : _c.startsWith(runtime_1.default.language.python)) {
|
|
155
|
+
else if ((_c = this.target.stack) === null || _c === void 0 ? void 0 : _c.startsWith(runtime_1.default.language.python.value)) {
|
|
156
156
|
const stackVersion = (_d = this.target.stack) === null || _d === void 0 ? void 0 : _d.replace('python_', '');
|
|
157
157
|
const runtimesDir = constants_1.ENVPATH.runtimes.data;
|
|
158
158
|
const httpPort = parseInt(runtime_store_1.default.get('context.port.http.' + constants_1.REMOTE_REF.functions.type[constants_1.FN_TYPE.basic]), 10);
|
|
@@ -162,7 +162,7 @@ class LocalFunction {
|
|
|
162
162
|
slaveOptions.push('-u');
|
|
163
163
|
slaveOptions.push('main.py');
|
|
164
164
|
this.slave = (0, shell_1.spawn)(userConfig_1.default.get(`python${stackVersion}.bin`), slaveOptions, {
|
|
165
|
-
cwd: (0, path_1.join)(runtimesDir, runtime_1.default.language.python, `zcatalyst_runtime_${stackVersion.replace('_', '')}`),
|
|
165
|
+
cwd: (0, path_1.join)(runtimesDir, runtime_1.default.language.python.value, `zcatalyst_runtime_${stackVersion.replace('_', '')}`),
|
|
166
166
|
stdio: 'pipe',
|
|
167
167
|
env: Object.assign({ X_ZOHO_CATALYST_IS_LOCAL: 'true', X_ZOHO_CATALYST_FUNCTION_LOADED: 'true', X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth, X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin, X_ZOHO_CATALYST_CODE_LOCATION: (0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build, constants_1.FOLDERNAME.functions, this.target.name), X_ZOHO_CATALYST_SERVER_LISTEN_PORT: runTimePort.toString(), CATALYST_PROJECT_TIMEZONE: (0, project_1.getProjectTimezone)(Intl.DateTimeFormat().resolvedOptions().timeZone) }, this.target.env_var)
|
|
168
168
|
}).RAW();
|
|
@@ -45,7 +45,7 @@ exports.default = (fnTypes) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
45
45
|
const pyStacks = [];
|
|
46
46
|
refinedTargets.filter((target) => {
|
|
47
47
|
var _a;
|
|
48
|
-
if (((_a = target.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.python)) &&
|
|
48
|
+
if (((_a = target.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.python.value)) &&
|
|
49
49
|
!pyStacks.includes(target.stack) &&
|
|
50
50
|
target.valid) {
|
|
51
51
|
pyStacks.push(target.stack);
|
|
@@ -55,9 +55,9 @@ function python(targets, fnWatchEvent) {
|
|
|
55
55
|
function prepareFunctions(targets, fnWatchEvent) {
|
|
56
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
57
|
return Promise.all([
|
|
58
|
-
node(targets.filter((target) => { var _a; return ((_a = target.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.
|
|
59
|
-
java(targets.filter((target) => { var _a; return ((_a = target.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.java)) && target.valid; })),
|
|
60
|
-
python(targets.filter((target) => { var _a; return ((_a = target.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.python)) && target.valid; }), fnWatchEvent)
|
|
58
|
+
node(targets.filter((target) => { var _a; return ((_a = target.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.node.value)) && target.valid; })),
|
|
59
|
+
java(targets.filter((target) => { var _a; return ((_a = target.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.java.value)) && target.valid; })),
|
|
60
|
+
python(targets.filter((target) => { var _a; return ((_a = target.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.python.value)) && target.valid; }), fnWatchEvent)
|
|
61
61
|
]);
|
|
62
62
|
});
|
|
63
63
|
}
|
|
@@ -50,9 +50,9 @@ exports.default = (targets) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
50
50
|
}
|
|
51
51
|
if (target.type === constants_1.FN_TYPE.advanced ||
|
|
52
52
|
target.type === constants_1.FN_TYPE.applogic ||
|
|
53
|
-
target.type
|
|
53
|
+
target.type === constants_1.FN_TYPE.browserLogic) {
|
|
54
54
|
const javaServer = (0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build, '.catalyst', 'aioserver', 'JavaaioServer');
|
|
55
|
-
const javaInvoker = (0, path_1.join)(__dirname, '../../../serve/server/lib/java/JavaaioServer.java');
|
|
55
|
+
const javaInvoker = (0, path_1.join)(__dirname, '../../../serve/server/lib/java/aio_server/JavaaioServer.java');
|
|
56
56
|
(0, java_1.ensureJavaInvoker)(javaServer, javaInvoker);
|
|
57
57
|
const serverFiles = yield fs_1.ASYNC.walk((0, path_1.dirname)(javaServer));
|
|
58
58
|
yield Promise.all(serverFiles.map((file) => {
|
|
@@ -23,10 +23,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.apigConfig = exports.functionsConfig = exports.clientConfig = void 0;
|
|
26
|
+
exports.appSailConfig = exports.apigConfig = exports.functionsConfig = exports.clientConfig = void 0;
|
|
27
27
|
const apigConfig = __importStar(require("./lib/apig"));
|
|
28
28
|
exports.apigConfig = apigConfig;
|
|
29
29
|
const clientConfig = __importStar(require("./lib/client"));
|
|
30
30
|
exports.clientConfig = clientConfig;
|
|
31
31
|
const functionsConfig = __importStar(require("./lib/functions"));
|
|
32
32
|
exports.functionsConfig = functionsConfig;
|
|
33
|
+
const appSailConfig = __importStar(require("./lib/appSail.js"));
|
|
34
|
+
exports.appSailConfig = appSailConfig;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.getAllTargetDetails = exports.getTargetDetails = exports.raw = void 0;
|
|
16
|
+
const error_1 = __importDefault(require("../../../error"));
|
|
17
|
+
const runtime_store_1 = __importDefault(require("../../../runtime-store"));
|
|
18
|
+
const constants_1 = require("../../constants");
|
|
19
|
+
const fs_1 = require("../../fs");
|
|
20
|
+
const logger_1 = require("../../logger");
|
|
21
|
+
const project_1 = require("../../project");
|
|
22
|
+
function raw(throwError = false) {
|
|
23
|
+
const config = runtime_store_1.default.get('config', null);
|
|
24
|
+
if (config === null) {
|
|
25
|
+
if (throwError) {
|
|
26
|
+
throw new error_1.default(constants_1.FILENAME.config + ' file is required', { exit: 2 });
|
|
27
|
+
}
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
return config.get('appsail');
|
|
31
|
+
}
|
|
32
|
+
exports.raw = raw;
|
|
33
|
+
function getTargetDetails(name) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const rawTargets = raw();
|
|
36
|
+
const target = rawTargets === null || rawTargets === void 0 ? void 0 : rawTargets.find((tar) => tar.name === name);
|
|
37
|
+
if (!target) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const appConfigPth = (0, project_1.resolveProjectPath)(target.source, constants_1.FILENAME.app_config);
|
|
41
|
+
const isPath = yield fs_1.ASYNC.fileExists(appConfigPth);
|
|
42
|
+
if (!isPath) {
|
|
43
|
+
return Object.assign({ validity: { valid: false, reason: 'Config file not present' } }, target);
|
|
44
|
+
}
|
|
45
|
+
const appConfigJson = yield fs_1.ASYNC.readJSONFile(appConfigPth);
|
|
46
|
+
if (!appConfigJson) {
|
|
47
|
+
return Object.assign({ validity: { valid: false, reason: 'Config file is empty' } }, target);
|
|
48
|
+
}
|
|
49
|
+
return Object.assign(Object.assign(Object.assign({}, target), appConfigJson), { validity: { valid: true } });
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
exports.getTargetDetails = getTargetDetails;
|
|
53
|
+
function getAllTargetDetails(throwErr = true) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
const rawTargets = raw();
|
|
56
|
+
if (!rawTargets) {
|
|
57
|
+
if (throwErr) {
|
|
58
|
+
throw new error_1.default('No AppSail targets found');
|
|
59
|
+
}
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
return Promise.all(rawTargets.reduce((resArr, target) => {
|
|
63
|
+
const catalystConfigPth = (0, project_1.resolveProjectPath)(target.source, constants_1.FILENAME.app_config);
|
|
64
|
+
const isPath = fs_1.SYNC.fileExists(catalystConfigPth);
|
|
65
|
+
if (!isPath) {
|
|
66
|
+
resArr.push(Promise.resolve(Object.assign({ validity: {
|
|
67
|
+
valid: false,
|
|
68
|
+
reason: 'Config file not present'
|
|
69
|
+
} }, target)));
|
|
70
|
+
return resArr;
|
|
71
|
+
}
|
|
72
|
+
resArr.push(new Promise((res) => __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const configJson = yield fs_1.ASYNC.readJSONFile(catalystConfigPth).catch((err) => (0, logger_1.debug)('Unable to read config file: ', err));
|
|
74
|
+
if (!configJson) {
|
|
75
|
+
return res(Object.assign({ validity: {
|
|
76
|
+
valid: false,
|
|
77
|
+
reason: 'Config file is empty'
|
|
78
|
+
} }, target));
|
|
79
|
+
}
|
|
80
|
+
return res({
|
|
81
|
+
appSail: Object.assign(Object.assign({}, target), configJson),
|
|
82
|
+
validity: { valid: true }
|
|
83
|
+
});
|
|
84
|
+
})));
|
|
85
|
+
return resArr;
|
|
86
|
+
}, []));
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
exports.getAllTargetDetails = getAllTargetDetails;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ENVPATH = exports.IAC = exports.PLUGIN = exports.ORIGIN = exports.TEMPLATE = exports.SCOPE = exports.REMOTE_REF = exports.REGEX = exports.REFERENCE = exports.PLACEHOLDER = exports.INTEG = exports.FOLDERNAME = exports.FN_TYPE = exports.DC_TYPE = exports.FILENAME = exports.EVENT_SOURCE = exports.EVENT_REF = exports.DEFAULT = exports.CLIQ = exports.AUTH = exports.APIG_RULES = void 0;
|
|
6
|
+
exports.ENVPATH = exports.RUNTIME = exports.IAC = exports.PLUGIN = exports.ORIGIN = exports.TEMPLATE = exports.SCOPE = exports.REMOTE_REF = exports.REGEX = exports.REFERENCE = exports.PLACEHOLDER = exports.INTEG = exports.FOLDERNAME = exports.FN_TYPE = exports.DC_TYPE = exports.FILENAME = exports.EVENT_SOURCE = exports.EVENT_REF = exports.DEFAULT = exports.CLIQ = exports.AUTH = exports.APIG_RULES = void 0;
|
|
7
7
|
var apig_rules_1 = require("./lib/apig-rules");
|
|
8
8
|
Object.defineProperty(exports, "APIG_RULES", { enumerable: true, get: function () { return __importDefault(apig_rules_1).default; } });
|
|
9
9
|
var auth_1 = require("./lib/auth");
|
|
@@ -44,5 +44,7 @@ var plugin_1 = require("./lib/plugin");
|
|
|
44
44
|
Object.defineProperty(exports, "PLUGIN", { enumerable: true, get: function () { return __importDefault(plugin_1).default; } });
|
|
45
45
|
var iac_1 = require("./lib/iac");
|
|
46
46
|
Object.defineProperty(exports, "IAC", { enumerable: true, get: function () { return __importDefault(iac_1).default; } });
|
|
47
|
+
var runtime_1 = require("./lib/runtime");
|
|
48
|
+
Object.defineProperty(exports, "RUNTIME", { enumerable: true, get: function () { return __importDefault(runtime_1).default; } });
|
|
47
49
|
var env_path_1 = require("./lib/env-path");
|
|
48
50
|
Object.defineProperty(exports, "ENVPATH", { enumerable: true, get: function () { return __importDefault(env_path_1).default; } });
|
|
@@ -14,7 +14,8 @@ exports.default = Object.freeze({
|
|
|
14
14
|
master: 3000,
|
|
15
15
|
advancedio: 3010,
|
|
16
16
|
basicio: 3040,
|
|
17
|
-
client:
|
|
17
|
+
client: 3050,
|
|
18
|
+
appsail: 3060,
|
|
18
19
|
browser_logic: 3100
|
|
19
20
|
},
|
|
20
21
|
debug: {
|
|
@@ -22,7 +23,8 @@ exports.default = Object.freeze({
|
|
|
22
23
|
advancedio: 8000,
|
|
23
24
|
basicio: 8010,
|
|
24
25
|
client: -1,
|
|
25
|
-
|
|
26
|
+
appsail: 8020,
|
|
27
|
+
browser_logic: 8040
|
|
26
28
|
}
|
|
27
29
|
},
|
|
28
30
|
event_bus: {
|
|
@@ -24,5 +24,8 @@ exports.default = Object.freeze({
|
|
|
24
24
|
},
|
|
25
25
|
catalyst_config: 'catalyst-config.json',
|
|
26
26
|
command_log: '.command.log',
|
|
27
|
-
node_modules: 'node_modules'
|
|
27
|
+
node_modules: 'node_modules',
|
|
28
|
+
app_config: 'app-config.json',
|
|
29
|
+
package_json: 'package.json',
|
|
30
|
+
catalyst_ignore: '.catalystignore'
|
|
28
31
|
});
|
|
@@ -2,9 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const RUNTIME = Object.freeze({
|
|
4
4
|
language: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
node: {
|
|
6
|
+
value: 'node',
|
|
7
|
+
label: 'NodeJS'
|
|
8
|
+
},
|
|
9
|
+
java: {
|
|
10
|
+
value: 'java',
|
|
11
|
+
label: 'Java'
|
|
12
|
+
},
|
|
13
|
+
python: {
|
|
14
|
+
value: 'python',
|
|
15
|
+
label: 'Python'
|
|
16
|
+
}
|
|
8
17
|
},
|
|
9
18
|
memory: [128, 256, 512]
|
|
10
19
|
});
|
|
@@ -51,6 +51,10 @@ exports.default = Object.freeze({
|
|
|
51
51
|
circuits_exe_read: 'ZohoCatalyst.circuits.execution.READ',
|
|
52
52
|
circuits_exe_delete: 'ZohoCatalyst.circuits.execution.DELETE',
|
|
53
53
|
cli_logs: 'ZohoCatalyst.cli.logs.CREATE',
|
|
54
|
+
appsail_read: 'ZohoCatalyst.appsail.Read',
|
|
55
|
+
appsail_create: 'ZohoCatalyst.appsail.Create',
|
|
56
|
+
appsail_update: 'ZohoCatalyst.appsail.Update',
|
|
57
|
+
appsail_delete: 'ZohoCatalyst.appsail.Delete',
|
|
54
58
|
iam_profile: 'AaaServer.profile.READ',
|
|
55
59
|
stratus_create: 'Stratus.sdkop.CREATE',
|
|
56
60
|
stratus_read: 'Stratus.sdkop.READ'
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const path_1 = require("path");
|
|
4
4
|
const constants_1 = require("../../constants");
|
|
5
5
|
const TEMPLATE_ROOT = (0, path_1.resolve)(__dirname, '../../../../templates');
|
|
6
|
+
const FUNCTIONS_NODE_ROOT = (0, path_1.join)(TEMPLATE_ROOT, 'init', 'functions', 'node');
|
|
7
|
+
const FUNCTIONS_JAVA_ROOT = (0, path_1.join)(TEMPLATE_ROOT, 'init', 'functions', 'java');
|
|
8
|
+
const FUNCTIONS_PYTHON_ROOT = (0, path_1.join)(TEMPLATE_ROOT, 'init', 'functions', 'python');
|
|
6
9
|
exports.default = Object.freeze({
|
|
7
10
|
banner: (0, path_1.join)(TEMPLATE_ROOT, 'banner.txt'),
|
|
8
11
|
login_success: (0, path_1.join)(TEMPLATE_ROOT, 'loginSuccess.html'),
|
|
@@ -23,39 +26,39 @@ exports.default = Object.freeze({
|
|
|
23
26
|
},
|
|
24
27
|
functions: {
|
|
25
28
|
node: {
|
|
26
|
-
bio: (0, path_1.join)(
|
|
27
|
-
event: (0, path_1.join)(
|
|
28
|
-
cron: (0, path_1.join)(
|
|
29
|
-
aio: (0, path_1.join)(
|
|
29
|
+
bio: (0, path_1.join)(FUNCTIONS_NODE_ROOT, 'bio'),
|
|
30
|
+
event: (0, path_1.join)(FUNCTIONS_NODE_ROOT, 'event'),
|
|
31
|
+
cron: (0, path_1.join)(FUNCTIONS_NODE_ROOT, 'cron'),
|
|
32
|
+
aio: (0, path_1.join)(FUNCTIONS_NODE_ROOT, 'aio'),
|
|
30
33
|
integ: {
|
|
31
|
-
[constants_1.INTEG.services.cliq]: (0, path_1.join)(
|
|
34
|
+
[constants_1.INTEG.services.cliq.toLowerCase()]: (0, path_1.join)(FUNCTIONS_NODE_ROOT, 'integ', 'cliq')
|
|
32
35
|
},
|
|
33
36
|
browserlogic: {
|
|
34
|
-
playwright: (0, path_1.join)(
|
|
35
|
-
puppeteer: (0, path_1.join)(
|
|
36
|
-
selenium: (0, path_1.join)(
|
|
37
|
+
playwright: (0, path_1.join)(FUNCTIONS_NODE_ROOT, 'browserlogic', 'playwright'),
|
|
38
|
+
puppeteer: (0, path_1.join)(FUNCTIONS_NODE_ROOT, 'browserlogic', 'puppeteer'),
|
|
39
|
+
selenium: (0, path_1.join)(FUNCTIONS_NODE_ROOT, 'browserlogic', 'selenium')
|
|
37
40
|
}
|
|
38
41
|
},
|
|
39
42
|
java: {
|
|
40
|
-
bio: (0, path_1.join)(
|
|
41
|
-
event: (0, path_1.join)(
|
|
42
|
-
cron: (0, path_1.join)(
|
|
43
|
-
aio: (0, path_1.join)(
|
|
43
|
+
bio: (0, path_1.join)(FUNCTIONS_JAVA_ROOT, 'bio'),
|
|
44
|
+
event: (0, path_1.join)(FUNCTIONS_JAVA_ROOT, 'event'),
|
|
45
|
+
cron: (0, path_1.join)(FUNCTIONS_JAVA_ROOT, 'cron'),
|
|
46
|
+
aio: (0, path_1.join)(FUNCTIONS_JAVA_ROOT, 'aio'),
|
|
44
47
|
integ: {
|
|
45
|
-
[constants_1.INTEG.services.cliq]: (0, path_1.join)(
|
|
48
|
+
[constants_1.INTEG.services.cliq.toLowerCase()]: (0, path_1.join)(FUNCTIONS_JAVA_ROOT, 'integ', 'cliq')
|
|
46
49
|
},
|
|
47
50
|
browserlogic: {
|
|
48
|
-
selenium: (0, path_1.join)(
|
|
49
|
-
playwright: (0, path_1.join)(
|
|
51
|
+
selenium: (0, path_1.join)(FUNCTIONS_JAVA_ROOT, 'browserlogic', 'selenium'),
|
|
52
|
+
playwright: (0, path_1.join)(FUNCTIONS_JAVA_ROOT, 'browserlogic', 'playwright')
|
|
50
53
|
}
|
|
51
54
|
},
|
|
52
55
|
python: {
|
|
53
|
-
bio: (0, path_1.join)(
|
|
54
|
-
event: (0, path_1.join)(
|
|
55
|
-
cron: (0, path_1.join)(
|
|
56
|
-
aio: (0, path_1.join)(
|
|
56
|
+
bio: (0, path_1.join)(FUNCTIONS_PYTHON_ROOT, 'bio'),
|
|
57
|
+
event: (0, path_1.join)(FUNCTIONS_PYTHON_ROOT, 'event'),
|
|
58
|
+
cron: (0, path_1.join)(FUNCTIONS_PYTHON_ROOT, 'cron'),
|
|
59
|
+
aio: (0, path_1.join)(FUNCTIONS_PYTHON_ROOT, 'aio'),
|
|
57
60
|
integ: {
|
|
58
|
-
[constants_1.INTEG.services.cliq]: (0, path_1.join)(
|
|
61
|
+
[constants_1.INTEG.services.cliq]: (0, path_1.join)(FUNCTIONS_PYTHON_ROOT, 'integ', 'cliq')
|
|
59
62
|
}
|
|
60
63
|
}
|
|
61
64
|
},
|
|
@@ -49,3 +49,8 @@ URL._admin = (0, env_js_1.envOverride)('CATALYST_ADMIN_URL', 'https://api.cataly
|
|
|
49
49
|
URL._app = (0, env_js_1.envOverride)('CATALYST_APP_URL', 'https://catalystserverless.com');
|
|
50
50
|
URL._zohoStatic = (0, env_js_1.envOverride)('ZOHO_STATIC', 'https://www.zoho.com/catalyst');
|
|
51
51
|
URL._console = (0, env_js_1.envOverride)('CATALYST_CONSOLE_URL', 'https://console.catalyst.zoho.com');
|
|
52
|
+
URL.zohoCDN = (0, env_js_1.envOverride)('ZOHO_CDN', 'https://static.zohocdn.com');
|
|
53
|
+
URL.external = Object.freeze({
|
|
54
|
+
gitHubAPI: 'https://api.github.com',
|
|
55
|
+
gitHubWeb: 'https://github.com'
|
|
56
|
+
});
|
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.chmod = exports.writeJSONFile = exports.readJSONFile = exports.emptyDir = exports.findAndReplace = exports.rename = exports.copyDir = exports.copyFiles = exports.copyFile = exports.deleteDir = exports.deleteFile = exports.ensureDir = exports.ensureFile = exports.walk = exports.dirList = exports.writeFile = exports.tempFile = exports.readFile = exports.fileExists = exports.dirExists = exports.isPathExists = void 0;
|
|
15
|
+
exports.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.isFile = 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"));
|
|
@@ -39,6 +39,13 @@ function fileExists(pth) {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
exports.fileExists = fileExists;
|
|
42
|
+
function isFile(pth) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const stats = yield fs_extra_1.default.stat((0, utils_js_1.untildify)(pth)).catch(() => false);
|
|
45
|
+
return stats && stats.isFile();
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
exports.isFile = isFile;
|
|
42
49
|
function readFile(pth, type) {
|
|
43
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
51
|
if (!(yield fileExists(pth))) {
|
|
@@ -52,11 +59,11 @@ function readFile(pth, type) {
|
|
|
52
59
|
});
|
|
53
60
|
}
|
|
54
61
|
exports.readFile = readFile;
|
|
55
|
-
function tempFile(name = Date.now().toString()) {
|
|
62
|
+
function tempFile(name = Date.now().toString(), content) {
|
|
56
63
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
64
|
const tempDir = path_1.default.join(os_1.default.tmpdir(), '.catalyst');
|
|
58
65
|
const tempFilePth = path_1.default.join(tempDir, name);
|
|
59
|
-
yield ensureFile(tempFilePth);
|
|
66
|
+
content === undefined ? yield ensureFile(tempFilePth) : yield writeFile(tempFilePth, content);
|
|
60
67
|
return tempFilePth;
|
|
61
68
|
});
|
|
62
69
|
}
|
|
@@ -7,8 +7,8 @@ exports.writeJSONFile = exports.readJSONFile = exports.emptyDir = exports.copyDi
|
|
|
7
7
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
8
|
const os_1 = __importDefault(require("os"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
|
-
function getWriteStream(pth) {
|
|
11
|
-
return fs_extra_1.default.createWriteStream(pth);
|
|
10
|
+
function getWriteStream(pth, mode) {
|
|
11
|
+
return fs_extra_1.default.createWriteStream(pth, { mode });
|
|
12
12
|
}
|
|
13
13
|
exports.getWriteStream = getWriteStream;
|
|
14
14
|
function getReadStream(pth) {
|
package/lib/util_modules/js.js
CHANGED
|
@@ -291,9 +291,9 @@ function upsertProject(projectObj, { base = false, active = false }) {
|
|
|
291
291
|
});
|
|
292
292
|
}
|
|
293
293
|
exports.upsertProject = upsertProject;
|
|
294
|
-
function resolveProjectPath(filePath) {
|
|
294
|
+
function resolveProjectPath(...filePath) {
|
|
295
295
|
let root = runtime_store_1.default.get('project.root', runtime_store_1.default.get('cwd'));
|
|
296
296
|
root = root !== undefined ? root : getProjectRoot();
|
|
297
|
-
return path_1.default.normalize(path_1.default.resolve(root, filePath));
|
|
297
|
+
return path_1.default.normalize(path_1.default.resolve(root, ...filePath));
|
|
298
298
|
}
|
|
299
299
|
exports.resolveProjectPath = resolveProjectPath;
|
|
@@ -42,7 +42,8 @@ class ConnectionDestroyer {
|
|
|
42
42
|
return this.server.close(() => resolve());
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
45
|
-
return this.server.
|
|
45
|
+
return (this.server.listening &&
|
|
46
|
+
this.server.close((err) => (err instanceof Error ? reject(err) : resolve())));
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
resolve();
|
package/package.json
CHANGED
package/scripts/postInstall.js
CHANGED
|
@@ -10,23 +10,32 @@ try {
|
|
|
10
10
|
const cliTable = require('../lib/cli_table');
|
|
11
11
|
const packageJson = require('../package.json');
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const table = new cliTable({ style: { border: [], header: [] } });
|
|
19
|
-
table.push(
|
|
20
|
-
{
|
|
21
|
-
'Current version: ': [ansi.red(semver.clean(process.version))]
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
'Compatible version: ': [ansi.green(packageJson.engines.node)]
|
|
13
|
+
const promise = new Promise(async (res) => {
|
|
14
|
+
if (semver.satisfies(process.version, packageJson.engines.node)) {
|
|
15
|
+
console.log(ansi.green.bold('Installation successful.'));
|
|
16
|
+
return res(0);
|
|
25
17
|
}
|
|
18
|
+
|
|
19
|
+
const table = new cliTable({ style: { border: [], header: [] } });
|
|
20
|
+
table.push(
|
|
21
|
+
{
|
|
22
|
+
'Current version: ': [ansi.red(semver.clean(process.version))]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
'Compatible version: ': [ansi.green(packageJson.engines.node)]
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
console.error(ansi.red('Node.js version is incompatible !!!'));
|
|
29
|
+
console.error(table.toString());
|
|
30
|
+
console.error('\n' + ansi.yellow.bold('Please update Node.js to a compatible version.'));
|
|
31
|
+
console.error(ansi.bold('Reference: ') + ansi.underline('https://nodejs.org/') + '\n');
|
|
32
|
+
res(1);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
promise.then(
|
|
36
|
+
(code) => process.exit(code),
|
|
37
|
+
() => process.exit(1)
|
|
26
38
|
);
|
|
27
|
-
|
|
28
|
-
console.error(
|
|
29
|
-
|
|
30
|
-
console.error(ansi.bold('Reference: ') + ansi.underline('https://nodejs.org/') + '\n');
|
|
31
|
-
process.exit(1);
|
|
32
|
-
} catch (err) {}
|
|
39
|
+
} catch (err) {
|
|
40
|
+
console.error(err);
|
|
41
|
+
}
|
|
@@ -19,7 +19,7 @@ public class {{_CLASS_}} implements PlaywrightHandler {
|
|
|
19
19
|
public void runner(HttpServletRequest request, HttpServletResponse response,Page page) throws Exception {
|
|
20
20
|
try {
|
|
21
21
|
//Fetches the endpoint and method to which the call was made
|
|
22
|
-
page.navigate("https://
|
|
22
|
+
page.navigate("https://catalyst.zoho.com");
|
|
23
23
|
responseData.put("message", "Title of the page "+page.title());
|
|
24
24
|
|
|
25
25
|
//Sends the response back to the Client
|
|
@@ -19,7 +19,7 @@ public class {{_CLASS_}} implements SeleniumHandler {
|
|
|
19
19
|
public void runner(HttpServletRequest request, HttpServletResponse response,ChromeDriver driver) throws Exception {
|
|
20
20
|
try {
|
|
21
21
|
//Fetches the endpoint and method to which the call was made
|
|
22
|
-
driver.get("https://
|
|
22
|
+
driver.get("https://catalyst.zoho.com");
|
|
23
23
|
responseData.put("message", "Title of the page "+driver.getTitle());
|
|
24
24
|
|
|
25
25
|
//Sends the response back to the Client
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Read the `url` from request, goto the page, extract title and return the results
|
|
3
3
|
|
|
4
4
|
module.exports.playwright = async (request, response, page) => {
|
|
5
|
-
await page.goto('https://
|
|
5
|
+
await page.goto('https://catalyst.zoho.com');
|
|
6
6
|
const pageTitle = await page.title();
|
|
7
7
|
response.setHeader('Content-Type', 'application/json');
|
|
8
8
|
response.write(JSON.stringify({ output: pageTitle }));
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Read the `url` from request, goto the page, extract title and return the results
|
|
3
3
|
|
|
4
4
|
module.exports.puppeteer = async (request, response, page) => {
|
|
5
|
-
await page.goto('https://
|
|
5
|
+
await page.goto('https://catalyst.zoho.com',{waitUntil: "domcontentloaded"});
|
|
6
6
|
const pageTitle = await page.title();
|
|
7
7
|
response.setHeader('Content-Type', 'application/json');
|
|
8
8
|
response.write(JSON.stringify({ output: pageTitle }));
|