zcatalyst-cli 1.25.3 → 1.26.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/lib/api-timer.d.ts +0 -1
- package/lib/apig-utils.d.ts +1 -1
- package/lib/apig-utils.js +1 -1
- package/lib/appsail-utils.js +6 -7
- package/lib/archiver.d.ts +0 -4
- package/lib/archiver.js +21 -11
- package/lib/authentication/constants/auth.js +1 -1
- package/lib/authentication/credential.js +3 -3
- package/lib/authentication/index.js +25 -14
- package/lib/authentication/login.d.ts +0 -2
- package/lib/authentication/login.js +23 -10
- package/lib/bin/catalyst.js +17 -7
- package/lib/client-utils.d.ts +3 -3
- package/lib/client-utils.js +2 -2
- package/lib/client.js +19 -9
- package/lib/code-deck.d.ts +0 -2
- package/lib/code-deck.js +4 -4
- package/lib/command_needs/config.js +1 -1
- package/lib/command_needs/rc.js +5 -2
- package/lib/commands/appsail/add.js +17 -7
- package/lib/commands/client/setup.js +17 -7
- package/lib/commands/config/set.js +5 -3
- package/lib/commands/deploy/appsail.js +37 -14
- package/lib/commands/deploy/index.js +88 -66
- package/lib/commands/deploy/slate.js +37 -14
- package/lib/commands/event/generate/integ.js +18 -9
- package/lib/commands/functions/add.js +17 -7
- package/lib/commands/functions/execute.js +17 -7
- package/lib/commands/functions/setup.js +17 -7
- package/lib/commands/functions/shell.js +17 -7
- package/lib/commands/iac/import.js +18 -8
- package/lib/commands/iac/pack.js +17 -7
- package/lib/commands/iac/status.js +17 -7
- package/lib/commands/index.js +20 -12
- package/lib/commands/init.js +17 -7
- package/lib/commands/login.js +17 -7
- package/lib/commands/logout.js +17 -7
- package/lib/commands/project/list.js +17 -7
- package/lib/commands/project/use.js +1 -0
- package/lib/commands/pull.js +17 -7
- package/lib/commands/run.js +17 -7
- package/lib/commands/serve.js +17 -7
- package/lib/commands/signals/generate/index.js +1 -1
- package/lib/commands/slate/create.js +17 -7
- package/lib/commands/slate/link.js +17 -7
- package/lib/commands/token/generate.js +17 -7
- package/lib/commands/token/list.js +17 -7
- package/lib/commands/token/revoke.js +17 -7
- package/lib/commands/zest/generate/index.js +21 -11
- package/lib/deploy/features/appsail/index.js +2 -3
- package/lib/deploy/features/appsail/pack.d.ts +0 -1
- package/lib/deploy/features/appsail/pack.js +2 -3
- package/lib/deploy/features/appsail/utils.js +7 -8
- package/lib/deploy/features/functions/languages/index.js +3 -4
- package/lib/deploy/features/index.js +17 -7
- package/lib/deploy/features/slate.js +2 -3
- package/lib/deploy/index.js +2 -2
- package/lib/deploy/util.d.ts +2 -0
- package/lib/deploy/util.js +3 -1
- package/lib/docs/commands/signals/generate/generate.toml +19 -0
- package/lib/docs/commands/slate/unlink.toml +9 -0
- package/lib/docs/fn-utils/lib/node.toml +4 -0
- package/lib/docs/init/dependencies/python/ensure-python.toml +4 -0
- package/lib/docs/serve/server/lib/slate/index.toml +15 -0
- package/lib/docs/slate-utils.toml +9 -0
- package/lib/endpoints/index.d.ts +2 -1
- package/lib/endpoints/index.js +88 -79
- package/lib/endpoints/lib/apig.d.ts +0 -1
- package/lib/endpoints/lib/apig.js +2 -2
- package/lib/endpoints/lib/applogic.d.ts +0 -1
- package/lib/endpoints/lib/applogic.js +2 -2
- package/lib/endpoints/lib/appsail.d.ts +1 -4
- package/lib/endpoints/lib/appsail.js +7 -7
- package/lib/endpoints/lib/client.d.ts +0 -1
- package/lib/endpoints/lib/code-deck.js +1 -1
- package/lib/endpoints/lib/common.d.ts +0 -2
- package/lib/endpoints/lib/ds-bulk.js +2 -2
- package/lib/endpoints/lib/env.js +2 -2
- package/lib/endpoints/lib/filestore.d.ts +0 -1
- package/lib/endpoints/lib/functions.d.ts +0 -1
- package/lib/endpoints/lib/functions.js +2 -2
- package/lib/endpoints/lib/git-hub.d.ts +0 -2
- package/lib/endpoints/lib/iac.d.ts +0 -3
- package/lib/endpoints/lib/iac.js +2 -2
- package/lib/endpoints/lib/project.d.ts +0 -1
- package/lib/endpoints/lib/project.js +2 -2
- package/lib/endpoints/lib/sdk.d.ts +0 -2
- package/lib/endpoints/lib/sdk.js +1 -1
- package/lib/endpoints/lib/slate.d.ts +0 -1
- package/lib/endpoints/lib/stratus.d.ts +0 -1
- package/lib/endpoints/lib/user.d.ts +0 -2
- package/lib/endpoints/lib/user.js +2 -1
- package/lib/error/context-help.js +1 -1
- package/lib/error/index.js +2 -2
- package/lib/event_generate/cache.js +4 -4
- package/lib/event_generate/custom.js +1 -2
- package/lib/event_generate/datastore.js +4 -4
- package/lib/event_generate/filestore.js +4 -4
- package/lib/event_generate/github.js +2 -2
- package/lib/event_generate/index.js +19 -11
- package/lib/event_generate/stratus.js +2 -2
- package/lib/event_generate/user.js +2 -2
- package/lib/event_generate/webapp.js +2 -2
- package/lib/execute/caller.d.ts +0 -1
- package/lib/execute/caller.js +20 -7
- package/lib/execute/index.js +27 -4
- package/lib/execute-script.js +22 -13
- package/lib/express_middlewares/auth-checker.js +2 -3
- package/lib/express_middlewares/project.d.ts +1 -1
- package/lib/fn-utils/index.js +17 -7
- package/lib/fn-utils/lib/browserLogic.js +4 -5
- package/lib/fn-utils/lib/common.d.ts +0 -1
- package/lib/fn-utils/lib/common.js +25 -26
- package/lib/fn-utils/lib/integ.js +2 -3
- package/lib/fn-utils/lib/java/classpath.js +2 -3
- package/lib/fn-utils/lib/java/compile.js +4 -4
- package/lib/fn-utils/lib/java/ensure-java-userconfig.d.ts +10 -0
- package/lib/fn-utils/lib/java/ensure-java-userconfig.js +45 -23
- package/lib/fn-utils/lib/java/index.d.ts +0 -1
- package/lib/fn-utils/lib/java/index.js +11 -11
- package/lib/fn-utils/lib/java/keywords.js +2 -2
- package/lib/fn-utils/lib/node.d.ts +1 -1
- package/lib/fn-utils/lib/node.js +67 -15
- package/lib/fn-utils/lib/python.js +29 -19
- package/lib/iac/status/util/index.d.ts +1 -1
- package/lib/init/dependencies/npm-install.js +2 -2
- package/lib/init/dependencies/python/ensure-python.d.ts +2 -2
- package/lib/init/dependencies/python/ensure-python.js +65 -58
- package/lib/init/dependencies/python/pip-install.d.ts +3 -5
- package/lib/init/dependencies/python/pip-install.js +14 -53
- package/lib/init/features/appsail/utils.js +21 -12
- package/lib/init/features/client/index.js +18 -9
- package/lib/init/features/client/initializers/angular.js +17 -7
- package/lib/init/features/client/initializers/basic.js +17 -7
- package/lib/init/features/client/initializers/lyte.js +17 -7
- package/lib/init/features/client/initializers/react.js +17 -7
- package/lib/init/features/index.js +29 -20
- package/lib/init/features/project.js +5 -5
- package/lib/init/features/slate/index.js +19 -9
- package/lib/init/util/client.js +23 -13
- package/lib/init/util/common.js +5 -6
- package/lib/init/util/project.js +1 -1
- package/lib/internal/api.d.ts +0 -3
- package/lib/internal/api.js +19 -9
- package/lib/internal/command.js +18 -9
- package/lib/migration/global/1.25.0.d.ts +2 -0
- package/lib/migration/global/1.25.0.js +28 -0
- package/lib/migration/index.js +20 -12
- package/lib/option-filter.js +19 -10
- package/lib/optional-import.js +19 -10
- package/lib/plugin-loader.d.ts +0 -2
- package/lib/plugin-loader.js +18 -8
- package/lib/port-resolver.js +10 -10
- package/lib/prompt/index.d.ts +3 -3
- package/lib/prompt/index.js +17 -7
- package/lib/prompt/types/file-path.d.ts +0 -1
- package/lib/prompt/types/search-box.d.ts +0 -1
- package/lib/prompt/types/tree.d.ts +1 -2
- package/lib/prompt/types/tree.js +10 -10
- package/lib/prompt/types/with-description.d.ts +0 -1
- package/lib/pull/features/functions/index.js +71 -52
- package/lib/pull/features/functions/languages.js +3 -4
- package/lib/pull/features/index.js +17 -7
- package/lib/repl-server.d.ts +0 -1
- package/lib/repl-server.js +9 -1
- package/lib/serve/features/apig.js +7 -1
- package/lib/serve/features/appsail.d.ts +1 -0
- package/lib/serve/features/appsail.js +51 -7
- package/lib/serve/features/index.js +22 -13
- package/lib/serve/index.js +17 -7
- package/lib/serve/server/index.d.ts +0 -2
- package/lib/serve/server/index.js +26 -12
- package/lib/serve/server/lib/appsail/index.js +27 -34
- package/lib/serve/server/lib/appsail/start.js +12 -5
- package/lib/serve/server/lib/appsail/util.d.ts +11 -0
- package/lib/serve/server/lib/appsail/util.js +69 -0
- package/lib/serve/server/lib/java/index.js +18 -7
- package/lib/serve/server/lib/master/appsail.js +3 -4
- package/lib/serve/server/lib/master/functions.js +1 -2
- package/lib/serve/server/lib/master/index.d.ts +0 -1
- package/lib/serve/server/lib/master/index.js +5 -5
- package/lib/serve/server/lib/master/slate.js +1 -2
- package/lib/serve/server/lib/master/unknown-req-proxy.js +5 -2
- package/lib/serve/server/lib/master/utils.d.ts +4 -8
- package/lib/serve/server/lib/master/utils.js +4 -6
- package/lib/serve/server/lib/master/web-client.js +1 -2
- package/lib/serve/server/lib/node/index.js +22 -11
- package/lib/serve/server/lib/node/server/browserlogic/utils/playwright-handler.js +1 -1
- package/lib/serve/server/lib/node/server/browserlogic/utils/puppeteer-handler.js +1 -1
- package/lib/serve/server/lib/node/server/browserlogic/utils/selenium-handler.js +2 -0
- package/lib/serve/server/lib/python/index.js +23 -14
- package/lib/serve/server/lib/slate/static-server.d.ts +0 -1
- package/lib/serve/server/lib/slate/static-server.js +5 -4
- package/lib/serve/server/lib/web_client/server.d.ts +0 -1
- package/lib/serve/server/lib/web_client/server.js +5 -4
- package/lib/shell/dependencies/http-functions.d.ts +0 -2
- package/lib/shell/dependencies/http-functions.js +7 -7
- package/lib/shell/dependencies/non-http-function/fn-execution-handler.d.ts +0 -2
- package/lib/shell/dependencies/non-http-function/fn-execution-handler.js +55 -24
- package/lib/shell/dependencies/non-http-function/fn-handler.d.ts +3 -3
- package/lib/shell/dependencies/non-http-function/fn-handler.js +54 -20
- package/lib/shell/dependencies/non-http-function/node.js +4 -4
- package/lib/shell/dependencies/non-http-function/python.d.ts +1 -1
- package/lib/shell/dependencies/non-http-function/python.js +11 -13
- package/lib/shell/dependencies/non-http-function/slave-manager.d.ts +0 -2
- package/lib/shell/dependencies/non-http-function/slave-manager.js +11 -7
- package/lib/shell/dependencies/tunnel-server.js +4 -4
- package/lib/shell/index.js +50 -3
- package/lib/shell/prepare/index.js +4 -3
- package/lib/shell/prepare/languages/index.js +18 -9
- package/lib/shell/prepare/languages/node.js +29 -19
- package/lib/shell/prepare/languages/python.js +6 -12
- package/lib/signals/index.js +19 -11
- package/lib/slate-utils.js +2 -2
- package/lib/throbber/index.d.ts +1 -2
- package/lib/throbber/index.js +5 -2
- package/lib/throbber/utils.d.ts +0 -1
- package/lib/throbber/utils.js +4 -5
- package/lib/userConfig.d.ts +14 -0
- package/lib/userConfig.js +15 -1
- package/lib/util_modules/config/index.js +17 -7
- package/lib/util_modules/config/lib/apig.d.ts +1 -0
- package/lib/util_modules/config/lib/apig.js +10 -5
- package/lib/util_modules/config/lib/appsail.js +7 -7
- package/lib/util_modules/config/lib/client.js +5 -6
- package/lib/util_modules/config/lib/functions.js +5 -6
- package/lib/util_modules/config/lib/slate.js +5 -6
- package/lib/util_modules/config-store.d.ts +1 -1
- package/lib/util_modules/config-store.js +30 -13
- package/lib/util_modules/constants/lib/apig-rules.d.ts +1 -1
- package/lib/util_modules/constants/lib/dc-type.js +3 -3
- package/lib/util_modules/constants/lib/placeholders.d.ts +1 -1
- package/lib/util_modules/constants/lib/placeholders.js +1 -1
- package/lib/util_modules/constants/lib/urls.js +2 -9
- package/lib/util_modules/container.js +23 -14
- package/lib/util_modules/dc.js +3 -4
- package/lib/util_modules/env.d.ts +3 -0
- package/lib/util_modules/env.js +64 -4
- package/lib/util_modules/event-emitter.d.ts +9 -0
- package/lib/util_modules/event-emitter.js +68 -0
- package/lib/util_modules/fs/index.js +17 -7
- package/lib/util_modules/fs/lib/async.d.ts +0 -4
- package/lib/util_modules/fs/lib/async.js +46 -46
- package/lib/util_modules/fs/lib/sync.d.ts +1 -3
- package/lib/util_modules/fs/lib/sync.js +40 -30
- package/lib/util_modules/logger/index.js +12 -12
- package/lib/util_modules/logger/utils.d.ts +0 -4
- package/lib/util_modules/logger/utils.js +1 -1
- package/lib/util_modules/logger/winston.js +2 -2
- package/lib/util_modules/option.js +5 -6
- package/lib/util_modules/project.js +22 -23
- package/lib/util_modules/runtime-store.d.ts +2 -2
- package/lib/util_modules/server.d.ts +1 -2
- package/lib/util_modules/server.js +54 -15
- package/lib/util_modules/shell.d.ts +0 -3
- package/lib/util_modules/shell.js +5 -6
- package/lib/util_modules/toml.js +2 -3
- package/package.json +13 -13
- package/templates/init/functions/java/event/sample.java +5 -2
- package/templates/web-socket.txt +1 -1
- /package/lib/docs/{commands/event/generate → event_generate}/index.toml +0 -0
- /package/templates/init/functions/java/integ/convokraft/{Sample.java → sample.java} +0 -0
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
// exit codes
|
|
5
5
|
// 150 - start up command failure
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
|
|
7
|
+
const { spawn } = require('cross-spawn');
|
|
9
8
|
const WAR = 'war';
|
|
10
9
|
const JAVASE = 'javase';
|
|
11
10
|
const NODEJS = 'nodejs';
|
|
@@ -62,7 +61,12 @@ function main() {
|
|
|
62
61
|
throw new Error(`invalid runtime type: ${CMD_ARGS.rtType}`);
|
|
63
62
|
}
|
|
64
63
|
|
|
65
|
-
const _process =
|
|
64
|
+
const _process = spawn('sh', ['-c', command.toString()], {
|
|
65
|
+
cwd,
|
|
66
|
+
env: process.env,
|
|
67
|
+
stdio: 'pipe',
|
|
68
|
+
detached: true
|
|
69
|
+
});
|
|
66
70
|
|
|
67
71
|
_process.on('error', (error) => {
|
|
68
72
|
// eslint-disable-next-line no-console
|
|
@@ -73,8 +77,11 @@ function main() {
|
|
|
73
77
|
_process.stdout.pipe(process.stdout);
|
|
74
78
|
_process.stderr.pipe(process.stderr);
|
|
75
79
|
|
|
76
|
-
|
|
77
|
-
|
|
80
|
+
['SIGINT', 'SIGTERM'].forEach((signal) => {
|
|
81
|
+
process.on(signal, () => {
|
|
82
|
+
process.kill(-_process.pid, signal);
|
|
83
|
+
process.exit();
|
|
84
|
+
});
|
|
78
85
|
});
|
|
79
86
|
}
|
|
80
87
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const AppsailUtils: {
|
|
2
|
+
executeHook(script: string, name: string, moduleSource: string): Promise<void>;
|
|
3
|
+
getVersion(stack: string): number;
|
|
4
|
+
getJettyVersion(javaVersion: number): number;
|
|
5
|
+
getJettyCommand(jettyPath: string, jettyVersion: string, target: string, port: number): string;
|
|
6
|
+
getJettyConfig(stack: string, target: string, port: number): {
|
|
7
|
+
jettyPath: string;
|
|
8
|
+
jettyCommand: string;
|
|
9
|
+
jettyDownloadUrl: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AppsailUtils = void 0;
|
|
13
|
+
const path_1 = require("path");
|
|
14
|
+
const constants_1 = require("../../../../util_modules/constants");
|
|
15
|
+
const project_1 = require("../../../../util_modules/project");
|
|
16
|
+
const option_1 = require("../../../../util_modules/option");
|
|
17
|
+
const console_1 = require("console");
|
|
18
|
+
const execute_script_1 = require("../../../../execute-script");
|
|
19
|
+
exports.AppsailUtils = {
|
|
20
|
+
executeHook(script, name, moduleSource) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
if ((0, option_1.getOptionValue)('ignoreScripts', false)) {
|
|
23
|
+
(0, console_1.debug)(`skipping ${name} hook`);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
return (0, execute_script_1.executeCommand)(script, { moduleSource, feature: name });
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
getVersion(stack) {
|
|
30
|
+
return parseInt(stack.replace(/\D/g, ''), 10);
|
|
31
|
+
},
|
|
32
|
+
getJettyVersion(javaVersion) {
|
|
33
|
+
const group1 = [8, 11, 17];
|
|
34
|
+
const group2 = [21, 25];
|
|
35
|
+
if (group1.includes(javaVersion))
|
|
36
|
+
return 1;
|
|
37
|
+
if (group2.includes(javaVersion))
|
|
38
|
+
return 2;
|
|
39
|
+
return 0;
|
|
40
|
+
},
|
|
41
|
+
getJettyCommand(jettyPath, jettyVersion, target, port) {
|
|
42
|
+
const command = [];
|
|
43
|
+
command.push('java -jar');
|
|
44
|
+
command.push(`"${(0, path_1.join)(jettyPath, 'start.jar')}"`);
|
|
45
|
+
switch (jettyVersion) {
|
|
46
|
+
case 'v1':
|
|
47
|
+
command.push(`-Djetty.http.port=${port}`);
|
|
48
|
+
command.push(`-Djetty.deploy.monitoredPath="${(0, project_1.resolveProjectPath)(target)}"`);
|
|
49
|
+
break;
|
|
50
|
+
case 'v2':
|
|
51
|
+
command.push(`jetty.http.port=${port}`);
|
|
52
|
+
command.push(`jetty.deploy.webappsDir="${(0, project_1.resolveProjectPath)(target)}"`);
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
return command.join(' ');
|
|
56
|
+
},
|
|
57
|
+
getJettyConfig(stack, target, port) {
|
|
58
|
+
const javaVersion = this.getVersion(stack);
|
|
59
|
+
const jettyVersion = `v${this.getJettyVersion(javaVersion)}`;
|
|
60
|
+
const jettyPath = (0, path_1.join)(constants_1.ENVPATH.runtimes.data, 'jetty', jettyVersion);
|
|
61
|
+
const jettyCommand = this.getJettyCommand(jettyPath, jettyVersion, target, port);
|
|
62
|
+
const jettyDownloadUrl = `/catalyst/appsail/${jettyVersion}/jetty_runtime_dependency.zip`;
|
|
63
|
+
return {
|
|
64
|
+
jettyPath,
|
|
65
|
+
jettyCommand,
|
|
66
|
+
jettyDownloadUrl
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
};
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -84,6 +94,7 @@ exports.default = (details) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
84
94
|
return (0, shell_1.spawn)(spawnCommand, opts, {
|
|
85
95
|
cwd: targetSource === null || targetSource === void 0 ? void 0 : targetSource.replace(projectRoot, (0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build)),
|
|
86
96
|
stdio: 'pipe',
|
|
97
|
+
detached: true,
|
|
87
98
|
env: Object.assign({ X_ZOHO_CATALYST_IS_LOCAL: 'true', X_ZOHO_CATALYST_FUNCTION_LOADED: 'true', X_ZOHO_CATALYST_CODE_LOCATION: targetDir + path_1.sep, X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth, X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin, X_ZOHO_CATALYST_RESOURCE_ID: (_h = details.target) === null || _h === void 0 ? void 0 : _h.id, X_ZOHO_STRATUS_RESOURCE_SUFFIX: constants_1.ORIGIN.stratusSuffix, CATALYST_PORTAL_DOMAIN: constants_1.ORIGIN.iamPortal, CATALYST_PROJECT_TIMEZONE: (0, project_1.getProjectTimezone)(Intl.DateTimeFormat().resolvedOptions().timeZone), CHROME_EXECUTABLE_PATH: runtime_store_1.default.get('CHROME_EXECUTABLE', process.env.CHROME_EXECUTABLE_PATH), CHROMEDRIVER_EXECUTABLE_PATH: runtime_store_1.default.get('CHROME_DRIVER_EXECUTABLE', process.env.CHROMEDRIVER_EXECUTABLE_PATH) }, details.target.env_var)
|
|
88
99
|
}).RAW();
|
|
89
100
|
});
|
|
@@ -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.addAppSailRoutes =
|
|
15
|
+
exports.addAppSailRoutes = addAppSailRoutes;
|
|
16
16
|
const utils_1 = require("./utils");
|
|
17
17
|
const error_1 = __importDefault(require("../../../../error"));
|
|
18
18
|
function addAppSailRoutes(app, details, proxy, unknownProxy) {
|
|
@@ -49,9 +49,9 @@ function addAppSailRoutes(app, details, proxy, unknownProxy) {
|
|
|
49
49
|
}
|
|
50
50
|
const targetUrl = `http://127.0.0.1:${appsailPort}`;
|
|
51
51
|
app.use('/', (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
var
|
|
52
|
+
var _a, _b;
|
|
53
53
|
if (req.header('catalyst-component') === 'true' && req.url.length > 1) {
|
|
54
|
-
((
|
|
54
|
+
((_b = (_a = details.target) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.catalyst_auth) === true
|
|
55
55
|
? unknownProxy(req, res)
|
|
56
56
|
: res.sendStatus(400);
|
|
57
57
|
return;
|
|
@@ -66,4 +66,3 @@ function addAppSailRoutes(app, details, proxy, unknownProxy) {
|
|
|
66
66
|
});
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
exports.addAppSailRoutes = addAppSailRoutes;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addFnRoutes =
|
|
3
|
+
exports.addFnRoutes = addFnRoutes;
|
|
4
4
|
const constants_1 = require("../../../../util_modules/constants");
|
|
5
5
|
function addFnRoutes(app, details, proxy) {
|
|
6
6
|
if (details.isAlive === false) {
|
|
@@ -58,4 +58,3 @@ function addFnRoutes(app, details, proxy) {
|
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
exports.addFnRoutes = addFnRoutes;
|
|
@@ -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
|
+
exports.default = spinUpMaster;
|
|
15
16
|
const express_1 = __importDefault(require("express"));
|
|
16
17
|
const error_1 = __importDefault(require("../../../../error"));
|
|
17
18
|
const apig_matcher_1 = __importDefault(require("../../../../express_middlewares/apig-matcher"));
|
|
@@ -35,9 +36,9 @@ const web_client_1 = require("./web-client");
|
|
|
35
36
|
const functions_1 = require("./functions");
|
|
36
37
|
const slate_1 = require("./slate");
|
|
37
38
|
const apig_1 = __importDefault(require("../../../features/apig"));
|
|
38
|
-
function spinUpMaster(
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
function spinUpMaster(listenPort_1, _a) {
|
|
40
|
+
return __awaiter(this, arguments, void 0, function* (listenPort, { otherServerDetails, appSailDetails, slateDetails }) {
|
|
41
|
+
var _b, _c;
|
|
41
42
|
if ((otherServerDetails && appSailDetails && slateDetails) ||
|
|
42
43
|
(!otherServerDetails && !appSailDetails && !slateDetails)) {
|
|
43
44
|
throw new error_1.default('Either functions/client or AppSail is need to start the master server. But both cannot use the same master', { exit: 2 });
|
|
@@ -98,7 +99,7 @@ function spinUpMaster(listenPort, { otherServerDetails, appSailDetails, slateDet
|
|
|
98
99
|
}
|
|
99
100
|
const proxy = (0, utils_1.createProxyServer)(listenPort);
|
|
100
101
|
const signRedirectUrl = slateDetails ? '/' : '/app/local-redirect';
|
|
101
|
-
appSailDetails && ((
|
|
102
|
+
appSailDetails && ((_c = (_b = appSailDetails.target) === null || _b === void 0 ? void 0 : _b.config) === null || _c === void 0 ? void 0 : _c.catalyst_auth) === true
|
|
102
103
|
? proxy.on('proxyRes', (0, utils_1.proxyResponseHandler)({
|
|
103
104
|
signInRedirect: appSailDetails.target.config.login_redirect || '/'
|
|
104
105
|
}))
|
|
@@ -164,4 +165,3 @@ function spinUpMaster(listenPort, { otherServerDetails, appSailDetails, slateDet
|
|
|
164
165
|
return expressServer;
|
|
165
166
|
});
|
|
166
167
|
}
|
|
167
|
-
exports.default = spinUpMaster;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.addSlateRoutes =
|
|
12
|
+
exports.addSlateRoutes = addSlateRoutes;
|
|
13
13
|
function addSlateRoutes(app, details, proxy, unknownProxy) {
|
|
14
14
|
if (!details.isAlive === false) {
|
|
15
15
|
return;
|
|
@@ -29,4 +29,3 @@ function addSlateRoutes(app, details, proxy, unknownProxy) {
|
|
|
29
29
|
});
|
|
30
30
|
}));
|
|
31
31
|
}
|
|
32
|
-
exports.addSlateRoutes = addSlateRoutes;
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const runtime_store_1 = __importDefault(require("../../../../runtime-store"));
|
|
7
7
|
const index_1 = require("../../../../util_modules/logger/index");
|
|
8
|
+
const env_1 = require("../../../../util_modules/env");
|
|
8
9
|
exports.default = (proxyInstance, masterPort, customProxyUrl) => (req, res) => {
|
|
9
10
|
if (req.url.length === 1 && req.url.startsWith('/')) {
|
|
10
11
|
res.redirect('/app/');
|
|
@@ -32,13 +33,15 @@ exports.default = (proxyInstance, masterPort, customProxyUrl) => (req, res) => {
|
|
|
32
33
|
headers['origin'] = `https://${req.headers['x-zc-project-domain']}`;
|
|
33
34
|
}
|
|
34
35
|
if (req.url.includes('/__catalyst/auth/')) {
|
|
35
|
-
headers['catalyst-redirect-domain'] =
|
|
36
|
+
headers['catalyst-redirect-domain'] = (0, env_1.getLocalAccessDomain)(masterPort || 3000);
|
|
36
37
|
}
|
|
37
38
|
proxyInstance.web(req, res, {
|
|
38
39
|
target: `https://${req.headers['x-zc-project-domain']}`,
|
|
39
40
|
changeOrigin: true,
|
|
40
41
|
cookieDomainRewrite: {
|
|
41
|
-
[req.headers['x-zc-project-domain'] + '']:
|
|
42
|
+
[req.headers['x-zc-project-domain'] + '']: env_1.isExtension
|
|
43
|
+
? (0, env_1.getLocalAccessDomain)(masterPort || 3000)
|
|
44
|
+
: 'localhost'
|
|
42
45
|
},
|
|
43
46
|
ws: true,
|
|
44
47
|
headers
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { IncomingMessage, ServerResponse } from 'http';
|
|
3
2
|
import { IAPIGLocal, IAPIGRules } from '../../../../apig-utils';
|
|
4
3
|
import Server from 'http-proxy';
|
|
5
|
-
import
|
|
4
|
+
import { CatalystEventEmitter } from '../../../../util_modules/event-emitter';
|
|
6
5
|
export interface IMatchRule extends IAPIGRules {
|
|
7
6
|
target_endpoint: string;
|
|
8
7
|
source_endpoint: string;
|
|
@@ -10,15 +9,12 @@ export interface IMatchRule extends IAPIGRules {
|
|
|
10
9
|
[x: string]: string;
|
|
11
10
|
};
|
|
12
11
|
}
|
|
13
|
-
declare
|
|
14
|
-
}
|
|
15
|
-
export declare const serverEvent: ServerEvent;
|
|
12
|
+
export declare const serverEvent: CatalystEventEmitter;
|
|
16
13
|
export declare const removeSecure: (str: string) => string;
|
|
17
14
|
export declare const redirectByAuth: (req: IncomingMessage, res: ServerResponse, redirectUrl: string) => void;
|
|
18
15
|
export declare const createProxyServer: (port: number) => Server;
|
|
19
16
|
export declare const proxyResponseHandler: ({ systemRoutes, signInRedirect }: {
|
|
20
|
-
systemRoutes?: IAPIGLocal
|
|
21
|
-
signInRedirect?: string
|
|
17
|
+
systemRoutes?: IAPIGLocal;
|
|
18
|
+
signInRedirect?: string;
|
|
22
19
|
}) => (proxyRes: IncomingMessage, req: IncomingMessage, res: ServerResponse) => void;
|
|
23
20
|
export declare const appsailInitJs: () => Promise<string>;
|
|
24
|
-
export {};
|
|
@@ -20,10 +20,8 @@ const error_1 = __importDefault(require("../../../../error"));
|
|
|
20
20
|
const project_1 = require("../../../../util_modules/project");
|
|
21
21
|
const http_proxy_1 = require("http-proxy");
|
|
22
22
|
const index_1 = require("../../../../util_modules/logger/index");
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
exports.serverEvent = new ServerEvent();
|
|
23
|
+
const event_emitter_1 = require("../../../../util_modules/event-emitter");
|
|
24
|
+
exports.serverEvent = new event_emitter_1.CatalystEventEmitter();
|
|
27
25
|
const iam_cookies = [
|
|
28
26
|
'ZD_CSRF_TOKEN',
|
|
29
27
|
'_iamadt_client',
|
|
@@ -118,13 +116,13 @@ const proxyResponseHandler = ({ systemRoutes, signInRedirect }) => (proxyRes, re
|
|
|
118
116
|
else if (req.url.includes('/logout')) {
|
|
119
117
|
const set = proxyRes.headers['set-cookie'];
|
|
120
118
|
if (set) {
|
|
121
|
-
const result = set.map((cookie) => cookie.replace(new RegExp('Domain=[\\S^;]*', 'g'), '
|
|
119
|
+
const result = set.map((cookie) => cookie.replace(new RegExp('Domain=[\\S^;]*', 'g'), 'Path=/'));
|
|
122
120
|
proxyRes.headers['set-cookie'] = result;
|
|
123
121
|
}
|
|
124
122
|
}
|
|
125
123
|
}
|
|
126
124
|
else if (req.url.startsWith('/accounts') && req.url.includes('/signin')) {
|
|
127
|
-
(_b = proxyRes.headers['set-cookie']) === null || _b === void 0 ? void 0 : _b.push('IAM_TEST_COOKIE=IAM_TEST_COOKIE;
|
|
125
|
+
(_b = proxyRes.headers['set-cookie']) === null || _b === void 0 ? void 0 : _b.push('IAM_TEST_COOKIE=IAM_TEST_COOKIE; Path=/');
|
|
128
126
|
}
|
|
129
127
|
};
|
|
130
128
|
exports.proxyResponseHandler = proxyResponseHandler;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addWebClientRoutes =
|
|
3
|
+
exports.addWebClientRoutes = addWebClientRoutes;
|
|
4
4
|
function addWebClientRoutes(app, details, proxy, unknownProxy) {
|
|
5
5
|
const appTarget = `http://127.0.0.1:${details.httpPort}/app/`;
|
|
6
6
|
app.use('/app', (req, res) => {
|
|
@@ -36,4 +36,3 @@ function addWebClientRoutes(app, details, proxy, unknownProxy) {
|
|
|
36
36
|
});
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
exports.addWebClientRoutes = addWebClientRoutes;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -56,7 +66,7 @@ const shell_1 = require("../../../../util_modules/shell");
|
|
|
56
66
|
const container_1 = require("../../../../util_modules/container");
|
|
57
67
|
const container_plugin_1 = require("@zcatalyst/container-plugin/");
|
|
58
68
|
exports.default = (details) => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
69
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
60
70
|
if (!details.target) {
|
|
61
71
|
throw new error_1.default('Invalid Node function target', { exit: 2 });
|
|
62
72
|
}
|
|
@@ -76,7 +86,7 @@ exports.default = (details) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
76
86
|
});
|
|
77
87
|
}
|
|
78
88
|
const label = `${details.type}[${(_g = details.target) === null || _g === void 0 ? void 0 : _g.name}]`;
|
|
79
|
-
const
|
|
89
|
+
const _q = details.target, { ['watcher']: _ } = _q, serialisableTarget = __rest(_q, ['watcher']);
|
|
80
90
|
serialisableTarget.index = serialisableTarget.index
|
|
81
91
|
? serialisableTarget.index.replace(projectRoot, (0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build))
|
|
82
92
|
: undefined;
|
|
@@ -96,9 +106,10 @@ exports.default = (details) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
96
106
|
(0, index_1.labeled)(label, 'you can attach your debugger at port : ' + details.debugPort).MESSAGE();
|
|
97
107
|
opts.unshift('--inspect=' + details.debugPort);
|
|
98
108
|
}
|
|
99
|
-
return (0, shell_1.spawn)('node', opts, {
|
|
109
|
+
return (0, shell_1.spawn)(((_o = (_m = details.target) === null || _m === void 0 ? void 0 : _m.additionalInfo) === null || _o === void 0 ? void 0 : _o.binPath) || 'node', opts, {
|
|
100
110
|
cwd: codeLocation,
|
|
101
111
|
stdio: 'pipe',
|
|
102
|
-
|
|
112
|
+
detached: true,
|
|
113
|
+
env: Object.assign({ NODE_PATH: targetSource + path_1.sep + 'node_modules', 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_RESOURCE_ID: (_p = details.target) === null || _p === void 0 ? void 0 : _p.id, X_ZOHO_STRATUS_RESOURCE_SUFFIX: constants_1.ORIGIN.stratusSuffix, CATALYST_PORTAL_DOMAIN: constants_1.ORIGIN.iamPortal, CATALYST_PROJECT_TIMEZONE: (0, project_1.getProjectTimezone)(Intl.DateTimeFormat().resolvedOptions().timeZone), CHROME_EXECUTABLE_PATH: runtime_store_1.default.get('CHROME_EXECUTABLE', process.env.CHROME_EXECUTABLE_PATH), CHROMEDRIVER_EXECUTABLE_PATH: runtime_store_1.default.get('CHROME_DRIVER_EXECUTABLE', process.env.CHROMEDRIVER_EXECUTABLE_PATH) }, details.target.env_var)
|
|
103
114
|
}).RAW();
|
|
104
115
|
});
|
|
@@ -19,7 +19,7 @@ async function getBrowser() {
|
|
|
19
19
|
if ((!browser || !browser.isConnected()) && !browserlaunching) {
|
|
20
20
|
browserPromise = new DEFERED_PROMISE();
|
|
21
21
|
browserlaunching = true;
|
|
22
|
-
let args = ['--remote-debugging-port=9002'];// No I18N
|
|
22
|
+
let args = ['--remote-debugging-port=9002', '--no-sandbox', '--disable-setuid-sandbox'];// No I18N
|
|
23
23
|
browser = await playwright.chromium.launch({ executablePath: CHROME_EXECUTABLE_PATH, args: args, headless: true });
|
|
24
24
|
let version = await browser.version();
|
|
25
25
|
console.log("Chrome started successfully " + version);
|
|
@@ -20,7 +20,7 @@ async function getBrowser(path) {
|
|
|
20
20
|
if ((!browser || !browser.isConnected()) && !browserlaunching) {
|
|
21
21
|
browserPromise = new DEFERED_PROMISE();
|
|
22
22
|
browserlaunching = true;
|
|
23
|
-
let args = ['--remote-debugging-port=9002'];// No I18N
|
|
23
|
+
let args = ['--remote-debugging-port=9002', '--no-sandbox', '--disable-setuid-sandbox'];// No I18N
|
|
24
24
|
browser = await puppeteer.launch({ executablePath: CHROME_EXECUTABLE_PATH, args: args, headless: true });
|
|
25
25
|
let version = await browser.version();
|
|
26
26
|
console.log("Chrome started successfully " + version);
|
|
@@ -24,6 +24,8 @@ async function getBrowser() {
|
|
|
24
24
|
options.addArguments('--headless') ;
|
|
25
25
|
options.addArguments('--disable-dev-shm-usage');
|
|
26
26
|
options.addArguments('--remote-debugging-port=9002');
|
|
27
|
+
options.addArguments('--no-sandbox');
|
|
28
|
+
options.addArguments('--disable-setuid-sandbox');
|
|
27
29
|
|
|
28
30
|
const chromeCapabilities = webdriver.Capabilities.chrome();
|
|
29
31
|
driver = new webdriver.Builder()
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -38,7 +48,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
38
48
|
const path_1 = require("path");
|
|
39
49
|
const runtime_store_1 = __importDefault(require("../../../../runtime-store"));
|
|
40
50
|
const http_functions_1 = require("../../../../shell/dependencies/http-functions");
|
|
41
|
-
const userConfig_1 = __importDefault(require("../../../../userConfig"));
|
|
42
51
|
const constants_1 = require("../../../../util_modules/constants");
|
|
43
52
|
const project_1 = require("../../../../util_modules/project");
|
|
44
53
|
const shell_1 = require("../../../../util_modules/shell");
|
|
@@ -83,22 +92,22 @@ exports.default = (details) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
83
92
|
}
|
|
84
93
|
opts.unshift('-u');
|
|
85
94
|
return new Promise((resolve, reject) => {
|
|
86
|
-
var _a, _b;
|
|
87
|
-
const child = (0, shell_1.spawn)(
|
|
95
|
+
var _a, _b, _c, _d;
|
|
96
|
+
const child = (0, shell_1.spawn)(((_b = (_a = details.target) === null || _a === void 0 ? void 0 : _a.additionalInfo) === null || _b === void 0 ? void 0 : _b.binPath) || 'python', opts, {
|
|
88
97
|
cwd: codeLocation,
|
|
89
98
|
stdio: 'pipe',
|
|
90
99
|
detached: true,
|
|
91
|
-
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_RESOURCE_ID: (
|
|
100
|
+
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_RESOURCE_ID: (_c = details.target) === null || _c === void 0 ? void 0 : _c.id, X_ZOHO_STRATUS_RESOURCE_SUFFIX: constants_1.ORIGIN.stratusSuffix, X_ZOHO_CATALYST_CODE_LOCATION: targetSource === null || targetSource === void 0 ? void 0 : targetSource.replace(projectRoot, (0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build)), X_ZOHO_CATALYST_SERVER_LISTEN_PORT: details.httpPort.toString(), CATALYST_PORTAL_DOMAIN: constants_1.ORIGIN.iamPortal, CATALYST_PROJECT_TIMEZONE: (0, project_1.getProjectTimezone)(Intl.DateTimeFormat().resolvedOptions().timeZone) }, details.target.env_var)
|
|
92
101
|
}).RAW();
|
|
93
102
|
child.on('spawn', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
94
|
-
var
|
|
103
|
+
var _a;
|
|
95
104
|
yield (0, http_functions_1.checkIfRuntimeServerRunning)(details.httpPort.toString());
|
|
96
105
|
debugConfig &&
|
|
97
|
-
(0, index_1.info)(`\nPython debugger for function ${(
|
|
106
|
+
(0, index_1.info)(`\nPython debugger for function ${(_a = details.target) === null || _a === void 0 ? void 0 : _a.name} listening on port: ${details.debugPort}`);
|
|
98
107
|
resolve(child);
|
|
99
108
|
}));
|
|
100
109
|
const errData = [];
|
|
101
|
-
(
|
|
110
|
+
(_d = child.stderr) === null || _d === void 0 ? void 0 : _d.on('data', (chunk) => {
|
|
102
111
|
errData.push(chunk);
|
|
103
112
|
});
|
|
104
113
|
child.on('error', (err) => {
|
|
@@ -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
|
+
exports.default = slateServer;
|
|
15
16
|
const express_1 = __importDefault(require("express"));
|
|
16
17
|
const events_1 = require("events");
|
|
17
18
|
const chokidar_1 = require("chokidar");
|
|
@@ -24,13 +25,14 @@ const ws_1 = require("ws");
|
|
|
24
25
|
const port_resolver_js_1 = __importDefault(require("../../../../port-resolver.js"));
|
|
25
26
|
const ansi_colors_1 = require("ansi-colors");
|
|
26
27
|
const server_js_1 = require("../../../../util_modules/server.js");
|
|
28
|
+
const env_1 = require("../../../../util_modules/env");
|
|
27
29
|
function prepareScriptFile(dir, port) {
|
|
28
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
31
|
const scriptFile = yield index_js_1.ASYNC.readFile(constants_1.TEMPLATE.client.basic.socket);
|
|
30
32
|
if (!scriptFile) {
|
|
31
33
|
throw new error_1.default('Unable to read the script file', { exit: 2 });
|
|
32
34
|
}
|
|
33
|
-
const scriptReady = scriptFile.replace(new RegExp(constants_1.PLACEHOLDER.client.
|
|
35
|
+
const scriptReady = scriptFile.replace(new RegExp(constants_1.PLACEHOLDER.client.domain, 'g'), (0, env_1.getLocalAccessDomain)(port, 'ws'));
|
|
34
36
|
yield index_js_1.ASYNC.ensureDir(dir);
|
|
35
37
|
const scriptFilePath = (0, path_1.join)(dir, 'reload-script.js');
|
|
36
38
|
yield index_js_1.ASYNC.writeFile(scriptFilePath, scriptReady);
|
|
@@ -59,8 +61,8 @@ function reloadApp(event, path, liveSockets) {
|
|
|
59
61
|
(0, logger_1.info)((0, ansi_colors_1.cyan)(`${event} detected in ${path} of the Web-Client.`));
|
|
60
62
|
liveSockets.forEach((socket) => socket.send('reload'));
|
|
61
63
|
}
|
|
62
|
-
function slateServer(
|
|
63
|
-
return __awaiter(this,
|
|
64
|
+
function slateServer(httpPort_1, source_1) {
|
|
65
|
+
return __awaiter(this, arguments, void 0, function* (httpPort, source, { homepage = '/index.html', enableWatch = true, notFoundPage } = {}) {
|
|
64
66
|
const eventListener = new events_1.EventEmitter();
|
|
65
67
|
const catalystTempDir = (0, path_1.join)(source, '.catalyst');
|
|
66
68
|
const socketServerPort = yield port_resolver_js_1.default.getFreePort(httpPort, 20, true);
|
|
@@ -191,4 +193,3 @@ function slateServer(httpPort, source, { homepage = '/index.html', enableWatch =
|
|
|
191
193
|
return new Promise((res) => server.on('listening', () => res(eventListener)));
|
|
192
194
|
});
|
|
193
195
|
}
|
|
194
|
-
exports.default = slateServer;
|
|
@@ -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
|
+
exports.default = webClientServer;
|
|
15
16
|
const express_1 = __importDefault(require("express"));
|
|
16
17
|
const events_1 = require("events");
|
|
17
18
|
const chokidar_1 = require("chokidar");
|
|
@@ -24,13 +25,14 @@ const ws_1 = require("ws");
|
|
|
24
25
|
const port_resolver_js_1 = __importDefault(require("../../../../port-resolver.js"));
|
|
25
26
|
const ansi_colors_1 = require("ansi-colors");
|
|
26
27
|
const server_js_1 = require("../../../../util_modules/server.js");
|
|
28
|
+
const env_1 = require("../../../../util_modules/env");
|
|
27
29
|
function prepareScriptFile(dir, port) {
|
|
28
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
31
|
const scriptFile = yield index_js_3.ASYNC.readFile(index_js_1.TEMPLATE.client.basic.socket);
|
|
30
32
|
if (!scriptFile) {
|
|
31
33
|
throw new index_js_2.default('Unable to read the script file', { exit: 2 });
|
|
32
34
|
}
|
|
33
|
-
const scriptReady = scriptFile.replace(new RegExp(index_js_1.PLACEHOLDER.client.
|
|
35
|
+
const scriptReady = scriptFile.replace(new RegExp(index_js_1.PLACEHOLDER.client.domain, 'g'), (0, env_1.getLocalAccessDomain)(port, 'ws'));
|
|
34
36
|
yield index_js_3.ASYNC.ensureDir(dir);
|
|
35
37
|
const scriptFilePath = (0, path_1.join)(dir, 'reload-script.js');
|
|
36
38
|
yield index_js_3.ASYNC.writeFile(scriptFilePath, scriptReady);
|
|
@@ -59,8 +61,8 @@ function reloadApp(event, path, liveSockets) {
|
|
|
59
61
|
(0, index_1.info)((0, ansi_colors_1.cyan)(`${event} detected in ${path} of the Web-Client.`));
|
|
60
62
|
liveSockets.forEach((socket) => socket.send('reload'));
|
|
61
63
|
}
|
|
62
|
-
function webClientServer(
|
|
63
|
-
return __awaiter(this,
|
|
64
|
+
function webClientServer(httpPort_1, source_1) {
|
|
65
|
+
return __awaiter(this, arguments, void 0, function* (httpPort, source, { homepage = 'index.html', enableWatch = true, notFoundPage } = {}) {
|
|
64
66
|
const eventListener = new events_1.EventEmitter();
|
|
65
67
|
const catalystTempDir = (0, path_1.join)(source, '.catalyst');
|
|
66
68
|
const socketServerPort = yield port_resolver_js_1.default.getFreePort(httpPort, 20, true);
|
|
@@ -191,4 +193,3 @@ function webClientServer(httpPort, source, { homepage = 'index.html', enableWatc
|
|
|
191
193
|
return new Promise((res) => server.on('listening', () => res(eventListener)));
|
|
192
194
|
});
|
|
193
195
|
}
|
|
194
|
-
exports.default = webClientServer;
|