zcatalyst-cli 1.25.2 → 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 +80 -13
- 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 +18 -7
- package/lib/commands/slate/unlink.js +16 -4
- 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 +198 -69
- 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 +19 -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 +20 -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 +31 -37
- 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 +4 -3
- 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
|
@@ -21,8 +21,6 @@ const project_1 = require("../../../../util_modules/project");
|
|
|
21
21
|
const shell_1 = require("../../../../util_modules/shell");
|
|
22
22
|
const endpoints_1 = require("../../../../endpoints");
|
|
23
23
|
const archiver_1 = __importDefault(require("../../../../archiver"));
|
|
24
|
-
const option_1 = require("../../../../util_modules/option");
|
|
25
|
-
const execute_script_1 = require("../../../../execute-script");
|
|
26
24
|
const master_1 = __importDefault(require("../master"));
|
|
27
25
|
const ansi_colors_1 = require("ansi-colors");
|
|
28
26
|
const common_1 = require("../../../../init/util/common");
|
|
@@ -32,15 +30,7 @@ const container_1 = require("../../../../util_modules/container");
|
|
|
32
30
|
const container_plugin_1 = require("@zcatalyst/container-plugin");
|
|
33
31
|
const appsail_1 = require("../../../../util_modules/config/lib/appsail");
|
|
34
32
|
const image_1 = require("@zcatalyst/container-plugin/out/endpoints/image");
|
|
35
|
-
|
|
36
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
if ((0, option_1.getOptionValue)('ignoreScripts', false)) {
|
|
38
|
-
(0, index_1.debug)(`skipping ${name} hook`);
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
return (0, execute_script_1.executeCommand)(script, { moduleSource, feature: name });
|
|
42
|
-
});
|
|
43
|
-
}
|
|
33
|
+
const util_1 = require("./util");
|
|
44
34
|
const startAppSail = (port, opts) => {
|
|
45
35
|
if (port === -1) {
|
|
46
36
|
throw new error_1.default('The AppSail Http port value is invalid: ' + port, { exit: 2 });
|
|
@@ -54,7 +44,7 @@ const startAppSail = (port, opts) => {
|
|
|
54
44
|
cwd: opts.target,
|
|
55
45
|
stdio: 'pipe',
|
|
56
46
|
killSignal: 'SIGINT',
|
|
57
|
-
env: Object.assign({ X_ZOHO_CATALYST_LISTEN_PORT: port + '', X_ZOHO_CATALYST_RUNTIME_MEMORY: opts.memory + '', X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth, X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin, X_ZOHO_STRATUS_RESOURCE_SUFFIX: constants_1.ORIGIN.stratusSuffix, X_ZOHO_CATALYST_IS_LOCAL: 'true', X_ZC_RESOURCE_NAME: opts.name + '', CATALYST_PORTAL_DOMAIN: constants_1.ORIGIN.iamPortal, CATALYST_PROJECT_TIMEZONE: (0, project_1.getProjectTimezone)(Intl.DateTimeFormat().resolvedOptions().timeZone) }, (opts.env || {}))
|
|
47
|
+
env: Object.assign({ X_ZOHO_CATALYST_LISTEN_PORT: port + '', X_ZOHO_CATALYST_RUNTIME_MEMORY: opts.memory + '', X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth, X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin, X_ZOHO_STRATUS_RESOURCE_SUFFIX: constants_1.ORIGIN.stratusSuffix, X_ZOHO_CATALYST_IS_LOCAL: 'true', X_ZC_RESOURCE_NAME: opts.name + '', CATALYST_PORTAL_DOMAIN: constants_1.ORIGIN.iamPortal, CATALYST_PROJECT_TIMEZONE: (0, project_1.getProjectTimezone)(Intl.DateTimeFormat().resolvedOptions().timeZone), PATH: opts.bin ? `${opts.bin}${path_1.delimiter}${process.env.PATH}` : process.env.PATH }, (opts.env || {}))
|
|
58
48
|
}).RAW();
|
|
59
49
|
return new Promise((_res, _rej) => {
|
|
60
50
|
child.on('spawn', () => _res(child));
|
|
@@ -62,8 +52,8 @@ const startAppSail = (port, opts) => {
|
|
|
62
52
|
});
|
|
63
53
|
};
|
|
64
54
|
function startAppSailWithContainer(serverDetails) {
|
|
65
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
66
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
67
57
|
const targetSail = serverDetails.target;
|
|
68
58
|
if (!targetSail || !targetSail.config) {
|
|
69
59
|
throw new error_1.default('Invalid AppSail target', { exit: 2 });
|
|
@@ -88,18 +78,19 @@ function startAppSailWithContainer(serverDetails) {
|
|
|
88
78
|
const tarStream = fs_1.SYNC.getReadStream(tarPath);
|
|
89
79
|
const imgName = `${serverDetails.target.name}-tar`;
|
|
90
80
|
const imageInfo = yield (0, image_1.loadTempImageTar)(imgName, tarStream);
|
|
91
|
-
|
|
81
|
+
const loadedImage = (_d = imageInfo.RepoTags) === null || _d === void 0 ? void 0 : _d.at(0);
|
|
82
|
+
serverDetails.target.source = `docker://${loadedImage}`;
|
|
92
83
|
child = yield (0, container_plugin_1.start)({
|
|
93
84
|
details: serverDetails,
|
|
94
85
|
projectId: (0, project_1.getProjectId)(),
|
|
95
86
|
ruok: container_plugin_1.RUOK.SKIP
|
|
96
87
|
});
|
|
97
88
|
child.once('exit', () => {
|
|
98
|
-
(0, image_1.removeImages)(imgName).catch((er) => (0, index_1.debug)('Error removing the temp images on exit: ', er));
|
|
89
|
+
(0, image_1.removeImages)(loadedImage || imgName).catch((er) => (0, index_1.debug)('Error removing the temp images on exit: ', er));
|
|
99
90
|
});
|
|
100
91
|
child.once('error', (err) => {
|
|
101
92
|
(0, index_1.debug)('Error with the AppSail container: ', err);
|
|
102
|
-
(0, image_1.removeImages)(imgName).catch((er) => (0, index_1.debug)('Error removing the temp images on error: ', er));
|
|
93
|
+
(0, image_1.removeImages)(loadedImage || imgName).catch((er) => (0, index_1.debug)('Error removing the temp images on error: ', er));
|
|
103
94
|
});
|
|
104
95
|
break;
|
|
105
96
|
}
|
|
@@ -136,7 +127,7 @@ function startAppSailWithContainer(serverDetails) {
|
|
|
136
127
|
});
|
|
137
128
|
}
|
|
138
129
|
exports.default = (serverDetails) => __awaiter(void 0, void 0, void 0, function* () {
|
|
139
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
130
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
140
131
|
let child;
|
|
141
132
|
const targetSail = serverDetails.target;
|
|
142
133
|
if (!targetSail || !targetSail.config) {
|
|
@@ -144,7 +135,7 @@ exports.default = (serverDetails) => __awaiter(void 0, void 0, void 0, function*
|
|
|
144
135
|
}
|
|
145
136
|
if ((targetSail === null || targetSail === void 0 ? void 0 : targetSail.runtime) === 'catalyst') {
|
|
146
137
|
if ((_a = targetSail.config.scripts) === null || _a === void 0 ? void 0 : _a.preserve) {
|
|
147
|
-
yield executeHook(targetSail.config.scripts.preserve, `AppSail [PRESERVE] [${targetSail.name}]`, targetSail.source);
|
|
138
|
+
yield util_1.AppsailUtils.executeHook(targetSail.config.scripts.preserve, `AppSail [PRESERVE] [${targetSail.name}]`, targetSail.source);
|
|
148
139
|
}
|
|
149
140
|
const buildPath = (_b = targetSail.config) === null || _b === void 0 ? void 0 : _b.build_path;
|
|
150
141
|
if (!buildPath) {
|
|
@@ -184,7 +175,8 @@ exports.default = (serverDetails) => __awaiter(void 0, void 0, void 0, function*
|
|
|
184
175
|
command: targetSail.config.command,
|
|
185
176
|
memory: targetSail.config.memory || 256,
|
|
186
177
|
env: targetSail.config.env_variables,
|
|
187
|
-
name: targetSail.name
|
|
178
|
+
name: targetSail.name,
|
|
179
|
+
bin: targetSail.binPath
|
|
188
180
|
});
|
|
189
181
|
break;
|
|
190
182
|
}
|
|
@@ -195,21 +187,22 @@ exports.default = (serverDetails) => __awaiter(void 0, void 0, void 0, function*
|
|
|
195
187
|
command: targetSail.config.command,
|
|
196
188
|
memory: targetSail.config.memory || 256,
|
|
197
189
|
env: targetSail.config.env_variables,
|
|
198
|
-
name: targetSail.name
|
|
190
|
+
name: targetSail.name,
|
|
191
|
+
bin: targetSail.binPath
|
|
199
192
|
});
|
|
200
193
|
break;
|
|
201
194
|
}
|
|
202
195
|
case (_l = (_k = targetSail.config) === null || _k === void 0 ? void 0 : _k.stack) === null || _l === void 0 ? void 0 : _l.startsWith('java'): {
|
|
203
196
|
if (targetSail.config.platform === 'war') {
|
|
204
|
-
const
|
|
205
|
-
if (!(yield fs_1.ASYNC.fileExists((0, path_1.join)(jettyPath, 'start.jar')).catch((err) => (0, index_1.debug)(err)))) {
|
|
197
|
+
const jettyConfig = util_1.AppsailUtils.getJettyConfig(((_m = targetSail.config) === null || _m === void 0 ? void 0 : _m.stack) || '', target, targetSail.port.appsail.host);
|
|
198
|
+
if (!(yield fs_1.ASYNC.fileExists((0, path_1.join)(jettyConfig.jettyPath, 'start.jar')).catch((err) => (0, index_1.debug)(err)))) {
|
|
206
199
|
try {
|
|
207
|
-
yield fs_1.ASYNC.ensureDir(jettyPath);
|
|
200
|
+
yield fs_1.ASYNC.ensureDir(jettyConfig.jettyPath);
|
|
208
201
|
const appxAPI = yield (0, endpoints_1.appSailAPI)();
|
|
209
|
-
const jettyZip = yield appxAPI.downloadJetty();
|
|
202
|
+
const jettyZip = yield appxAPI.downloadJetty(jettyConfig.jettyDownloadUrl);
|
|
210
203
|
const zip = new archiver_1.default();
|
|
211
204
|
zip.load(jettyZip);
|
|
212
|
-
zip.extract(jettyPath, '/', {
|
|
205
|
+
zip.extract(jettyConfig.jettyPath, '/', {
|
|
213
206
|
isFolder: true
|
|
214
207
|
});
|
|
215
208
|
yield zip.finalize();
|
|
@@ -219,14 +212,14 @@ exports.default = (serverDetails) => __awaiter(void 0, void 0, void 0, function*
|
|
|
219
212
|
throw err;
|
|
220
213
|
}
|
|
221
214
|
}
|
|
222
|
-
const jettyCommand = `java -jar "${(0, path_1.join)(jettyPath, 'start.jar')}" -Djetty.deploy.monitoredPath="${(0, project_1.resolveProjectPath)(target)}" -Djetty.http.port=${targetSail.port.appsail.host}`;
|
|
223
215
|
child = yield startAppSail(targetSail.port.appsail.host, {
|
|
224
216
|
target,
|
|
225
217
|
type: 'war',
|
|
226
|
-
command: jettyCommand,
|
|
218
|
+
command: jettyConfig.jettyCommand,
|
|
227
219
|
memory: targetSail.config.memory || 256,
|
|
228
|
-
env: Object.assign({ JETTY_BASE: (0, path_1.join)(jettyPath, 'JETTY_BASE') }, targetSail.config.env_variables),
|
|
229
|
-
name: targetSail.name
|
|
220
|
+
env: Object.assign({ JETTY_BASE: (0, path_1.join)(jettyConfig.jettyPath, 'JETTY_BASE') }, targetSail.config.env_variables),
|
|
221
|
+
name: targetSail.name,
|
|
222
|
+
bin: targetSail.binPath
|
|
230
223
|
});
|
|
231
224
|
break;
|
|
232
225
|
}
|
|
@@ -236,7 +229,8 @@ exports.default = (serverDetails) => __awaiter(void 0, void 0, void 0, function*
|
|
|
236
229
|
type: 'javase',
|
|
237
230
|
memory: targetSail.config.memory || 256,
|
|
238
231
|
env: targetSail.config.env_variables,
|
|
239
|
-
name: targetSail.name
|
|
232
|
+
name: targetSail.name,
|
|
233
|
+
bin: targetSail.binPath
|
|
240
234
|
});
|
|
241
235
|
break;
|
|
242
236
|
}
|
|
@@ -247,7 +241,7 @@ exports.default = (serverDetails) => __awaiter(void 0, void 0, void 0, function*
|
|
|
247
241
|
errorId: 'SERVE-APPSAIL-4',
|
|
248
242
|
arg: [
|
|
249
243
|
(0, ansi_colors_1.bold)(targetSail.name),
|
|
250
|
-
ansi_colors_1.bold.red(((
|
|
244
|
+
ansi_colors_1.bold.red(((_o = targetSail.config) === null || _o === void 0 ? void 0 : _o.stack) + ''),
|
|
251
245
|
appSailRuntime.runtimes.map((val) => (0, ansi_colors_1.bold)(`* ${val}`)).join('\n')
|
|
252
246
|
]
|
|
253
247
|
});
|
|
@@ -272,7 +266,7 @@ exports.default = (serverDetails) => __awaiter(void 0, void 0, void 0, function*
|
|
|
272
266
|
(0, index_1.debug)('Error with the AppSail proxy server: ', err);
|
|
273
267
|
});
|
|
274
268
|
child.once('exit', (code) => __awaiter(void 0, void 0, void 0, function* () {
|
|
275
|
-
var
|
|
269
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
276
270
|
typeof targetSail.port.appsail === 'number' &&
|
|
277
271
|
port_resolver_1.default.freePort(targetSail.port.appsail);
|
|
278
272
|
port_resolver_1.default.freePort(targetSail.port.proxy);
|
|
@@ -286,14 +280,14 @@ exports.default = (serverDetails) => __awaiter(void 0, void 0, void 0, function*
|
|
|
286
280
|
errorId: 'SERVE-APPSAIL-3',
|
|
287
281
|
arg: [
|
|
288
282
|
(0, ansi_colors_1.bold)(targetSail.name),
|
|
289
|
-
((
|
|
290
|
-
(0, ansi_colors_1.underline)(((
|
|
291
|
-
((
|
|
283
|
+
((_a = targetSail.config) === null || _a === void 0 ? void 0 : _a.command) || '',
|
|
284
|
+
(0, ansi_colors_1.underline)(((_b = targetSail.config) === null || _b === void 0 ? void 0 : _b.build_path) || ''),
|
|
285
|
+
((_c = targetSail.config) === null || _c === void 0 ? void 0 : _c.stack) || ''
|
|
292
286
|
]
|
|
293
287
|
});
|
|
294
288
|
}
|
|
295
|
-
if ((
|
|
296
|
-
yield executeHook((
|
|
289
|
+
if ((_e = (_d = targetSail.config) === null || _d === void 0 ? void 0 : _d.scripts) === null || _e === void 0 ? void 0 : _e.postserve) {
|
|
290
|
+
yield util_1.AppsailUtils.executeHook((_g = (_f = targetSail.config) === null || _f === void 0 ? void 0 : _f.scripts) === null || _g === void 0 ? void 0 : _g.postserve, `AppSail [POSTSERVE] [${targetSail.name}]`, targetSail.source);
|
|
297
291
|
}
|
|
298
292
|
}));
|
|
299
293
|
return child;
|
|
@@ -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);
|