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
|
@@ -16,32 +16,30 @@ const port_resolver_1 = __importDefault(require("../../../port-resolver"));
|
|
|
16
16
|
const constants_1 = require("../../../util_modules/constants");
|
|
17
17
|
const path_1 = require("path");
|
|
18
18
|
const shell_1 = require("../../../util_modules/shell");
|
|
19
|
-
const userConfig_1 = __importDefault(require("../../../userConfig"));
|
|
20
19
|
const project_1 = require("../../../util_modules/project");
|
|
21
|
-
const runtime_store_1 = __importDefault(require("../../../runtime-store"));
|
|
22
20
|
const logger_1 = require("../../../util_modules/logger");
|
|
23
|
-
exports.default = (fn) => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
21
|
+
exports.default = (fn, runTimePort) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
25
23
|
const slaveOptions = [];
|
|
26
24
|
const stackVersion = (_b = (_a = fn.target) === null || _a === void 0 ? void 0 : _a.stack) === null || _b === void 0 ? void 0 : _b.replace('python_', '');
|
|
27
25
|
const runtimesDir = constants_1.ENVPATH.runtimes.data;
|
|
28
|
-
const httpPort = parseInt(runtime_store_1.default.get('context.port.http.' + constants_1.REMOTE_REF.functions.type[constants_1.FN_TYPE.basic], constants_1.DEFAULT.serve_port.http[(_c = fn.target) === null || _c === void 0 ? void 0 : _c.type] + ''), 10);
|
|
29
|
-
const runTimePort = yield port_resolver_1.default.getFreePort(httpPort, 20, false);
|
|
30
26
|
fn.httpPort = runTimePort;
|
|
31
27
|
slaveOptions.push((0, path_1.join)(runtimesDir, constants_1.RUNTIME.language.python.value, `zcatalyst_runtime_${stackVersion === null || stackVersion === void 0 ? void 0 : stackVersion.replace('_', '')}`, 'main.py'));
|
|
32
|
-
const debugConfig = (
|
|
28
|
+
const debugConfig = (_c = fn.target.additionalInfo) === null || _c === void 0 ? void 0 : _c.debug;
|
|
33
29
|
if (debugConfig) {
|
|
34
30
|
const debugOpts = ['-m', debugConfig === null || debugConfig === void 0 ? void 0 : debugConfig.debugger, '--listen', debugConfig.port + ''];
|
|
35
|
-
((
|
|
31
|
+
((_d = fn.target) === null || _d === void 0 ? void 0 : _d.type) === constants_1.FN_TYPE.job && debugOpts.push('--wait-for-client');
|
|
36
32
|
slaveOptions.unshift(...debugOpts);
|
|
37
33
|
}
|
|
38
34
|
slaveOptions.unshift('-u');
|
|
39
|
-
(0, logger_1.debug)(`Python Spawn command: ${
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
(0, logger_1.debug)(`Python Spawn command: ${((_e = fn.target.additionalInfo) === null || _e === void 0 ? void 0 : _e.binPath) || 'python'} ${slaveOptions.join(' ')}`);
|
|
36
|
+
(0, logger_1.debug)(`X_ZOHO_DATA_URL: http://localhost:${runTimePort}/data`);
|
|
37
|
+
(0, logger_1.debug)(`X_ZOHO_CALLBACK_URL: http://localhost:${runTimePort}/callback`);
|
|
38
|
+
return (0, shell_1.spawn)(((_f = fn.target.additionalInfo) === null || _f === void 0 ? void 0 : _f.binPath) || 'python', slaveOptions, {
|
|
39
|
+
cwd: (_g = fn.target) === null || _g === void 0 ? void 0 : _g.build,
|
|
42
40
|
stdio: 'pipe',
|
|
43
|
-
env: Object.assign({ X_ZOHO_CATALYST_IS_LOCAL: 'true', X_ZOHO_CATALYST_FUNCTION_LOADED: 'true', X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth, X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin, CATALYST_PORTAL_DOMAIN: constants_1.ORIGIN.iamPortal, X_ZOHO_CATALYST_RESOURCE_ID: (
|
|
41
|
+
env: Object.assign({ X_ZOHO_CATALYST_IS_LOCAL: 'true', X_ZOHO_CATALYST_FUNCTION_LOADED: 'true', X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth, X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin, CATALYST_PORTAL_DOMAIN: constants_1.ORIGIN.iamPortal, X_ZOHO_CATALYST_RESOURCE_ID: (_h = fn.target) === null || _h === void 0 ? void 0 : _h.id, X_ZOHO_STRATUS_RESOURCE_SUFFIX: constants_1.ORIGIN.stratusSuffix, X_ZOHO_CATALYST_CODE_LOCATION: (_j = fn.target) === null || _j === void 0 ? void 0 : _j.build, X_ZOHO_CATALYST_SERVER_LISTEN_PORT: runTimePort.toString(), X_ZOHO_DATA_URL: `http://localhost:${runTimePort}/data`, X_ZOHO_CALLBACK_URL: `http://localhost:${runTimePort}/callback`, CATALYST_PROJECT_TIMEZONE: (0, project_1.getProjectTimezone)(Intl.DateTimeFormat().resolvedOptions().timeZone), X_ZOHO_ADMIN_CRED_TOKEN: 'dummy', X_ZOHO_PROJECT_SECRET_KEY: 'dummy', X_ZOHO_CATALYST_ORG: (0, project_1.getEnvId)(), X_ZOHO_CATALYST_ENVIRONMENT: 'Development', X_ZOHO_JOBMETA_JOBID: 'dummy', CATALYST_FUNCTION_TYPE: constants_1.REMOTE_REF.functions.type[(_k = fn.target) === null || _k === void 0 ? void 0 : _k.type] }, (_l = fn.target) === null || _l === void 0 ? void 0 : _l.env_var)
|
|
44
42
|
})
|
|
45
43
|
.RAW()
|
|
46
|
-
.on('exit', () => port_resolver_1.default.freePort(
|
|
44
|
+
.on('exit', () => port_resolver_1.default.freePort(runTimePort));
|
|
47
45
|
});
|
|
@@ -70,6 +70,10 @@ class SlaveManager extends fn_execution_handler_1.FnExecutionHandler {
|
|
|
70
70
|
}
|
|
71
71
|
break;
|
|
72
72
|
}
|
|
73
|
+
case constants_1.FN_TYPE.integration: {
|
|
74
|
+
data.timestamp = Date.now();
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
73
77
|
}
|
|
74
78
|
}
|
|
75
79
|
else {
|
|
@@ -86,7 +90,7 @@ class SlaveManager extends fn_execution_handler_1.FnExecutionHandler {
|
|
|
86
90
|
return new error_1.default('Invalid input: ' + e);
|
|
87
91
|
}
|
|
88
92
|
return (() => __awaiter(this, void 0, void 0, function* () {
|
|
89
|
-
var _b, _c, _d, _e, _f, _g, _h, _j
|
|
93
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
90
94
|
if (!this.fn.target) {
|
|
91
95
|
throw new error_1.default('Invalid function target: ' + this.fn.target, {
|
|
92
96
|
exit: 2
|
|
@@ -95,7 +99,7 @@ class SlaveManager extends fn_execution_handler_1.FnExecutionHandler {
|
|
|
95
99
|
const accessToken = yield credential_1.default.getAccessToken();
|
|
96
100
|
yield fs_1.ASYNC.ensureFile(this.responseFile, true);
|
|
97
101
|
yield fs_1.ASYNC.ensureFile(this.metaFile, true);
|
|
98
|
-
if (((
|
|
102
|
+
if (((_a = this.fn.target) === null || _a === void 0 ? void 0 : _a.type) === constants_1.FN_TYPE.job) {
|
|
99
103
|
if ('params' in data) {
|
|
100
104
|
data.job_details = Object.assign({
|
|
101
105
|
job_meta_details: {
|
|
@@ -106,7 +110,7 @@ class SlaveManager extends fn_execution_handler_1.FnExecutionHandler {
|
|
|
106
110
|
}
|
|
107
111
|
const jobData = data;
|
|
108
112
|
const jobMetaDetails = {
|
|
109
|
-
headers: Object.assign(Object.assign({}, (
|
|
113
|
+
headers: Object.assign(Object.assign({}, (_c = (_b = jobData === null || jobData === void 0 ? void 0 : jobData.job_details) === null || _b === void 0 ? void 0 : _b.job_meta_details) === null || _c === void 0 ? void 0 : _c.headers), {
|
|
110
114
|
'x-zc-projectid': (0, project_1.getProjectId)(),
|
|
111
115
|
'x-zc-project-domain': (0, project_1.getDomainPrefix)() + '.' + constants_1.ORIGIN.app.replace('https://', ''),
|
|
112
116
|
'x-zc-project-key': (0, project_1.getDomainKey)(),
|
|
@@ -117,11 +121,11 @@ class SlaveManager extends fn_execution_handler_1.FnExecutionHandler {
|
|
|
117
121
|
'x-zc-admin-cred-token': accessToken,
|
|
118
122
|
'x-zc-user-type': 'admin'
|
|
119
123
|
}),
|
|
120
|
-
params: ((
|
|
124
|
+
params: ((_e = (_d = jobData === null || jobData === void 0 ? void 0 : jobData.job_details) === null || _d === void 0 ? void 0 : _d.job_meta_details) === null || _e === void 0 ? void 0 : _e.params) || {},
|
|
121
125
|
jobpool_details: Object.assign({ type: 'Function', project_details: {
|
|
122
126
|
project_name: (0, project_1.getProjectName)(),
|
|
123
127
|
id: (0, project_1.getProjectId)()
|
|
124
|
-
} }, (
|
|
128
|
+
} }, (_g = (_f = jobData === null || jobData === void 0 ? void 0 : jobData.job_details) === null || _f === void 0 ? void 0 : _f.job_meta_details) === null || _g === void 0 ? void 0 : _g.jobpool_details)
|
|
125
129
|
};
|
|
126
130
|
jobData.job_details = Object.assign(Object.assign({}, jobData.job_details), { capacity: jobData.capacity || {
|
|
127
131
|
memory: '256'
|
|
@@ -142,10 +146,10 @@ class SlaveManager extends fn_execution_handler_1.FnExecutionHandler {
|
|
|
142
146
|
exit: 2
|
|
143
147
|
});
|
|
144
148
|
}
|
|
145
|
-
(
|
|
149
|
+
(_h = this.slave.stdout) === null || _h === void 0 ? void 0 : _h.on('data', (message) => {
|
|
146
150
|
process.stdout.write(message.toString());
|
|
147
151
|
});
|
|
148
|
-
(
|
|
152
|
+
(_j = this.slave.stderr) === null || _j === void 0 ? void 0 : _j.on('data', (message) => {
|
|
149
153
|
process.stderr.write(message.toString());
|
|
150
154
|
});
|
|
151
155
|
this.slave.on('error', (err) => {
|
|
@@ -53,8 +53,8 @@ class TunnelServer {
|
|
|
53
53
|
}
|
|
54
54
|
return false;
|
|
55
55
|
}
|
|
56
|
-
send(
|
|
57
|
-
return __awaiter(this,
|
|
56
|
+
send(req_1, res_1) {
|
|
57
|
+
return __awaiter(this, arguments, void 0, function* (req, res, status = 200, data, contentType) {
|
|
58
58
|
const body = req.body;
|
|
59
59
|
if (this.isAsyncFn(body.function_details.function_type)) {
|
|
60
60
|
const tunnelAPI = yield (0, endpoints_1.tunnelAPI)();
|
|
@@ -189,8 +189,8 @@ class TunnelServer {
|
|
|
189
189
|
return this;
|
|
190
190
|
}
|
|
191
191
|
stopServer() {
|
|
192
|
-
var _a;
|
|
193
192
|
return __awaiter(this, void 0, void 0, function* () {
|
|
193
|
+
var _a;
|
|
194
194
|
if (!__classPrivateFieldGet(this, _TunnelServer_server, "f")) {
|
|
195
195
|
return;
|
|
196
196
|
}
|
|
@@ -198,5 +198,5 @@ class TunnelServer {
|
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
exports.default = TunnelServer;
|
|
202
201
|
_TunnelServer_contextMap = new WeakMap(), _TunnelServer_server = new WeakMap(), _TunnelServer_destroyer = new WeakMap(), _TunnelServer_repel = new WeakMap(), _TunnelServer_projectId = new WeakMap();
|
|
202
|
+
exports.default = TunnelServer;
|
package/lib/shell/index.js
CHANGED
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
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
|
+
})();
|
|
2
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -29,16 +62,30 @@ const prepare_1 = __importDefault(require("./prepare"));
|
|
|
29
62
|
const fn_watcher_1 = __importDefault(require("../fn-watcher"));
|
|
30
63
|
const tunnel_server_1 = __importDefault(require("./dependencies/tunnel-server"));
|
|
31
64
|
const endpoints_1 = require("../endpoints");
|
|
65
|
+
const child_process_1 = require("child_process");
|
|
66
|
+
const container_plugin_1 = require("@zcatalyst/container-plugin");
|
|
67
|
+
const userConfig_1 = __importStar(require("../userConfig"));
|
|
32
68
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
69
|
var _a;
|
|
70
|
+
const shellPrompt = userConfig_1.default.get(userConfig_1.CONFIG_KEYS.functionsShell_prompt);
|
|
34
71
|
const replServer = new repl_server_1.default({
|
|
35
|
-
prompt:
|
|
72
|
+
prompt: shellPrompt && typeof shellPrompt === 'string'
|
|
73
|
+
? shellPrompt
|
|
74
|
+
: ansi_colors_1.bold.cyan('╭─ catalyst-functions-shell\n╰─> '),
|
|
36
75
|
writer: (output) => {
|
|
37
76
|
if (output !== undefined) {
|
|
38
77
|
if (output instanceof Promise) {
|
|
39
78
|
replServer.pause();
|
|
40
|
-
output.
|
|
41
|
-
|
|
79
|
+
output.then((_res) => {
|
|
80
|
+
if (_res instanceof child_process_1.ChildProcess) {
|
|
81
|
+
_res.once('close', replServer.resume);
|
|
82
|
+
}
|
|
83
|
+
else if (_res instanceof container_plugin_1.ContainerEvents) {
|
|
84
|
+
_res.once('exit', replServer.resume);
|
|
85
|
+
_res.once('error', replServer.resume);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
return '\n' + '[CLI] Function has been invoked' + '\n';
|
|
42
89
|
}
|
|
43
90
|
if (output instanceof Error) {
|
|
44
91
|
return ansi_colors_1.bold.red('Error: ') + output.message;
|
|
@@ -20,7 +20,7 @@ const runtime_store_1 = __importDefault(require("../../runtime-store"));
|
|
|
20
20
|
const throbber_1 = __importDefault(require("../../throbber"));
|
|
21
21
|
const constants_1 = require("../../util_modules/constants");
|
|
22
22
|
const languages_1 = require("./languages");
|
|
23
|
-
exports.default = (
|
|
23
|
+
exports.default = (fnTypes_1, ...args_1) => __awaiter(void 0, [fnTypes_1, ...args_1], void 0, function* (fnTypes, skipFnFilter = false) {
|
|
24
24
|
yield fn_utils_1.fnUtils.common.executeHook({ prefix: 'pre', command: 'serve' });
|
|
25
25
|
const throbber = throbber_1.default.getInstance();
|
|
26
26
|
const targets = yield fn_utils_1.fnUtils.common.validate(skipFnFilter);
|
|
@@ -44,13 +44,14 @@ exports.default = (fnTypes, skipFnFilter = false) => __awaiter(void 0, void 0, v
|
|
|
44
44
|
const [_nodeFns, javaFns, pythonFns] = yield (0, languages_1.prepareFunctions)(refinedTargets);
|
|
45
45
|
javaFns && (0, compile_1.printCompilationLog)(javaFns);
|
|
46
46
|
const pyStacks = [];
|
|
47
|
-
pythonFns === null || pythonFns === void 0 ? void 0 : pythonFns.
|
|
47
|
+
pythonFns === null || pythonFns === void 0 ? void 0 : pythonFns.forEach((target) => {
|
|
48
48
|
if (!pyStacks.includes(target.stack + '') && target.valid) {
|
|
49
49
|
pyStacks.push(target.stack + '');
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
yield Promise.all(pyStacks.map((stack) => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
-
|
|
53
|
+
var _a, _b;
|
|
54
|
+
yield (0, pip_install_1.ensurePyRuntime)(constants_1.ENVPATH.runtimes.data, stack, (_b = (_a = pythonFns === null || pythonFns === void 0 ? void 0 : pythonFns.at(0)) === null || _a === void 0 ? void 0 : _a.additionalInfo) === null || _b === void 0 ? void 0 : _b.binPath);
|
|
54
55
|
})));
|
|
55
56
|
yield (0, common_1.resolveAllFnPorts)(refinedTargets);
|
|
56
57
|
return refinedTargets;
|
|
@@ -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) {
|
|
@@ -35,7 +45,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
45
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
46
|
};
|
|
37
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.prepareFunctions =
|
|
48
|
+
exports.prepareFunctions = prepareFunctions;
|
|
39
49
|
const runtime_1 = __importDefault(require("../../../util_modules/constants/lib/runtime"));
|
|
40
50
|
function node(targets) {
|
|
41
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -76,4 +86,3 @@ function prepareFunctions(targets) {
|
|
|
76
86
|
return Promise.all([node(nodeFns), java(javaFns), python(pythonFns)]);
|
|
77
87
|
});
|
|
78
88
|
}
|
|
79
|
-
exports.prepareFunctions = prepareFunctions;
|
|
@@ -24,31 +24,41 @@ exports.default = (targets) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
24
24
|
if (targets === undefined || targets.length === 0) {
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
const reqNodeStacks = targets.reduce((stacks, target) => {
|
|
28
|
+
if (target.stack) {
|
|
29
|
+
stacks[target.stack] = '';
|
|
30
|
+
}
|
|
31
|
+
return stacks;
|
|
32
|
+
}, {});
|
|
33
|
+
yield Promise.all(Object.keys(reqNodeStacks).map((stack) => __awaiter(void 0, void 0, void 0, function* () {
|
|
34
|
+
try {
|
|
35
|
+
const binPath = yield fn_utils_1.fnUtils.node.ensureNodeVersion(stack);
|
|
36
|
+
reqNodeStacks[stack] = binPath;
|
|
37
|
+
(0, index_1.debug)(`Node binary for stack ${stack} is at ${binPath}`);
|
|
38
|
+
}
|
|
39
|
+
catch (er) {
|
|
40
|
+
(0, index_1.debug)('Ensure node version error: ', er);
|
|
41
|
+
targets.forEach((targ) => {
|
|
42
|
+
if (targ.stack === stack) {
|
|
43
|
+
targ.valid = false;
|
|
44
|
+
targ.failure_reason = error_1.default.getErrorInstance(er).message;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
})));
|
|
38
49
|
const throbber = throbber_1.default.getInstance();
|
|
39
50
|
yield fn_utils_1.fnUtils.node.validate(targets);
|
|
40
|
-
|
|
41
|
-
.filter((target) => {
|
|
51
|
+
return Promise.all(targets.map((target) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
52
|
if (!target.valid) {
|
|
43
53
|
throbber.remove('function_serve_' + target.name);
|
|
54
|
+
return target;
|
|
44
55
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
56
|
+
target.additionalInfo = {
|
|
57
|
+
binPath: target.stack && reqNodeStacks[target.stack]
|
|
58
|
+
? reqNodeStacks[target.stack]
|
|
59
|
+
: 'node'
|
|
60
|
+
};
|
|
48
61
|
fn_utils_1.fnUtils.common.generateUrlForTarget(target);
|
|
49
|
-
return target;
|
|
50
|
-
});
|
|
51
|
-
return Promise.all(nodeTargets.map((target) => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
62
|
const buildPath = (0, path_1.join)(runtime_store_1.default.get('project.root'), constants_1.FOLDERNAME.build, constants_1.FOLDERNAME.functions, target.name);
|
|
53
63
|
yield fs_1.ASYNC.emptyDir(buildPath);
|
|
54
64
|
yield fs_1.ASYNC.copyDir(target.source, buildPath);
|
|
@@ -27,29 +27,23 @@ exports.default = (targets) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
27
27
|
}
|
|
28
28
|
const throbber = throbber_1.default.getInstance();
|
|
29
29
|
yield fn_utils_1.fnUtils.python.validate(targets);
|
|
30
|
-
const
|
|
31
|
-
|
|
30
|
+
const _debugFns = runtime_store_1.default.get('context.port.debug', {});
|
|
31
|
+
return Promise.all(targets.map((target) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
+
var _a, _b;
|
|
32
33
|
if (!target.valid) {
|
|
33
34
|
throbber.remove('function_serve_' + target.name);
|
|
35
|
+
return target;
|
|
34
36
|
}
|
|
35
|
-
return target.valid;
|
|
36
|
-
})
|
|
37
|
-
.map((target) => {
|
|
38
37
|
fn_utils_1.fnUtils.common.generateUrlForTarget(target);
|
|
39
|
-
return target;
|
|
40
|
-
});
|
|
41
|
-
const _debugFns = runtime_store_1.default.get('context.port.debug', {});
|
|
42
|
-
return Promise.all(pyTargets.map((target) => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
-
var _a;
|
|
44
38
|
const buildPath = (0, path_1.join)(runtime_store_1.default.get('project.root'), constants_1.FOLDERNAME.build, constants_1.FOLDERNAME.functions, target.name);
|
|
45
39
|
const reqFile = (0, path_1.join)(target.source, constants_1.FILENAME.functions.python_requirements);
|
|
46
40
|
yield (0, fs_extra_1.ensureDir)(buildPath);
|
|
47
41
|
yield fs_1.ASYNC.emptyDir(buildPath);
|
|
48
42
|
try {
|
|
49
|
-
yield (0, pip_install_1.installRequirements)(reqFile, buildPath, (_a = target.
|
|
43
|
+
yield (0, pip_install_1.installRequirements)(reqFile, buildPath, (_a = target.additionalInfo) === null || _a === void 0 ? void 0 : _a.binPath);
|
|
50
44
|
const debugFns = _debugFns[target.type] || {};
|
|
51
45
|
if (debugFns[target.name]) {
|
|
52
|
-
yield (0, pip_install_1.installPkgs)(['debugpy'],
|
|
46
|
+
yield (0, pip_install_1.installPkgs)(['debugpy'], (_b = target.additionalInfo) === null || _b === void 0 ? void 0 : _b.binPath, buildPath);
|
|
53
47
|
if (!target.additionalInfo)
|
|
54
48
|
target.additionalInfo = { binPath: '' };
|
|
55
49
|
target.additionalInfo.debug = {
|
package/lib/signals/index.js
CHANGED
|
@@ -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) {
|
|
@@ -35,7 +45,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
45
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
46
|
};
|
|
37
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.generate =
|
|
48
|
+
exports.generate = generate;
|
|
39
49
|
const ansi_colors_1 = require("ansi-colors");
|
|
40
50
|
const error_1 = __importDefault(require("../error"));
|
|
41
51
|
const constants_1 = require("../util_modules/constants");
|
|
@@ -46,7 +56,6 @@ const js_1 = require("../util_modules/js");
|
|
|
46
56
|
const option_1 = require("../util_modules/option");
|
|
47
57
|
function generate(publisher, event) {
|
|
48
58
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
var _a;
|
|
50
59
|
const unknownArgs = (0, option_1.getUnknownOpts)([]);
|
|
51
60
|
if (unknownArgs.length % 2 !== 0) {
|
|
52
61
|
throw new error_1.default('Unknown options are not provided as key value pairs', {
|
|
@@ -101,7 +110,7 @@ function generate(publisher, event) {
|
|
|
101
110
|
}, {});
|
|
102
111
|
let data = {};
|
|
103
112
|
if (publisher !== 'custom') {
|
|
104
|
-
const publisherModule = yield (
|
|
113
|
+
const publisherModule = yield Promise.resolve(`${'../event_generate/' + (publisher === 'authentication' ? 'user' : publisher)}`).then(s => __importStar(require(s)));
|
|
105
114
|
data = yield publisherModule.getData(optionMap);
|
|
106
115
|
if (publisher === 'datastore') {
|
|
107
116
|
data = Object.assign(Object.assign({}, data), { table_details: {
|
|
@@ -197,7 +206,6 @@ function generate(publisher, event) {
|
|
|
197
206
|
return jsonContent;
|
|
198
207
|
});
|
|
199
208
|
}
|
|
200
|
-
exports.generate = generate;
|
|
201
209
|
function getPublisherType(publisher) {
|
|
202
210
|
for (const [category, services] of Object.entries(constants_1.SIGNALS_PUBLISHERS_TYPE)) {
|
|
203
211
|
if (services.includes(publisher)) {
|
package/lib/slate-utils.js
CHANGED
|
@@ -12,7 +12,8 @@ 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.
|
|
15
|
+
exports.slateUtils = void 0;
|
|
16
|
+
exports.validateServeCommand = validateServeCommand;
|
|
16
17
|
const ansi_colors_1 = require("ansi-colors");
|
|
17
18
|
const path_1 = require("path");
|
|
18
19
|
const archiver_1 = __importDefault(require("./archiver"));
|
|
@@ -107,7 +108,8 @@ exports.slateUtils = {
|
|
|
107
108
|
`**/${constants_1.FILENAME.config}`,
|
|
108
109
|
`**/${constants_1.FILENAME.rc}`,
|
|
109
110
|
`**/${constants_1.FILENAME.app_config}`,
|
|
110
|
-
`**/${constants_1.FILENAME.catalyst_ignore}
|
|
111
|
+
`**/${constants_1.FILENAME.catalyst_ignore}`,
|
|
112
|
+
`**/${constants_1.FILENAME.cli_config}`
|
|
111
113
|
];
|
|
112
114
|
const slateZip = yield fs_1.ASYNC.walk(source, {
|
|
113
115
|
filter: {
|
|
@@ -150,4 +152,3 @@ function validateServeCommand(targDetails) {
|
|
|
150
152
|
});
|
|
151
153
|
return targDetails;
|
|
152
154
|
}
|
|
153
|
-
exports.validateServeCommand = validateServeCommand;
|
package/lib/throbber/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
1
|
import { ISpinnerOptions, VALID_STATUSES } from './utils';
|
|
4
2
|
import { TTYPassThrough } from '../util_modules/logger';
|
|
5
3
|
interface IThrobbers {
|
|
@@ -25,6 +23,7 @@ declare class Throbber {
|
|
|
25
23
|
remove(name: string): ISpinnerOptions;
|
|
26
24
|
stopAll(newStatus?: string): IThrobbers;
|
|
27
25
|
hasActiveSpinners(): boolean;
|
|
26
|
+
hasSpinner(name: string): boolean;
|
|
28
27
|
setSpinnerProperties(name: string, options: ISpinnerOptions, status?: VALID_STATUSES): void;
|
|
29
28
|
updateSpinnerState(): void;
|
|
30
29
|
loopStream(): NodeJS.Timeout;
|
package/lib/throbber/index.js
CHANGED
|
@@ -20,13 +20,13 @@ class Throbber {
|
|
|
20
20
|
this.spinners = {};
|
|
21
21
|
this.isCursorHidden = false;
|
|
22
22
|
this.currentInterval = null;
|
|
23
|
-
this.stream = env_1.
|
|
23
|
+
this.stream = env_1.isExtension ? logger_1.LogStreamFactory.getStream() : process.stderr;
|
|
24
24
|
this.lineCount = 0;
|
|
25
25
|
this.currentFrameIndex = 0;
|
|
26
26
|
this.spin =
|
|
27
27
|
!this.options.disableSpins &&
|
|
28
28
|
!process.env.CI &&
|
|
29
|
-
((process.stderr && process.stderr.isTTY) || env_1.
|
|
29
|
+
((process.stderr && process.stderr.isTTY) || env_1.isExtension);
|
|
30
30
|
this.bindSigint();
|
|
31
31
|
Throbber.instance = this;
|
|
32
32
|
}
|
|
@@ -99,6 +99,9 @@ class Throbber {
|
|
|
99
99
|
hasActiveSpinners() {
|
|
100
100
|
return !!Object.values(this.spinners).find(({ status }) => status === 'spinning');
|
|
101
101
|
}
|
|
102
|
+
hasSpinner(name) {
|
|
103
|
+
return this.spinners[name] !== undefined;
|
|
104
|
+
}
|
|
102
105
|
setSpinnerProperties(name, options, status = 'spinning') {
|
|
103
106
|
if (!this.spin) {
|
|
104
107
|
return;
|
package/lib/throbber/utils.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
export type VALID_STATUSES = 'succeed' | 'fail' | 'spinning' | 'non-spinnable' | 'stopped';
|
|
3
2
|
export type VALID_COLORS = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'grey' | 'redBright' | 'greenBright' | 'yellowBright' | 'blueBright' | 'magentaBright' | 'cyanBright' | 'whiteBright';
|
|
4
3
|
export interface ISpinnerOptions {
|
package/lib/throbber/utils.js
CHANGED
|
@@ -3,7 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.breakText = breakText;
|
|
7
|
+
exports.getLinesLength = getLinesLength;
|
|
8
|
+
exports.writeStream = writeStream;
|
|
9
|
+
exports.cleanStream = cleanStream;
|
|
7
10
|
const readline_1 = require("readline");
|
|
8
11
|
const strip_ansi_1 = __importDefault(require("strip-ansi"));
|
|
9
12
|
function breakText(text, prefixLength) {
|
|
@@ -12,7 +15,6 @@ function breakText(text, prefixLength) {
|
|
|
12
15
|
.map((line, index) => (index === 0 ? breakLine(line, prefixLength) : breakLine(line, 0)))
|
|
13
16
|
.join('\n');
|
|
14
17
|
}
|
|
15
|
-
exports.breakText = breakText;
|
|
16
18
|
function breakLine(line, prefixLength) {
|
|
17
19
|
const columns = process.stderr.columns || 95;
|
|
18
20
|
return line.length >= columns - prefixLength
|
|
@@ -24,12 +26,10 @@ function getLinesLength(text, prefixLength) {
|
|
|
24
26
|
.split('\n')
|
|
25
27
|
.map((line, index) => (index === 0 ? line.length + prefixLength : line.length));
|
|
26
28
|
}
|
|
27
|
-
exports.getLinesLength = getLinesLength;
|
|
28
29
|
function writeStream(stream, output, rawLines) {
|
|
29
30
|
stream.write(output);
|
|
30
31
|
(0, readline_1.moveCursor)(stream, 0, -rawLines.length);
|
|
31
32
|
}
|
|
32
|
-
exports.writeStream = writeStream;
|
|
33
33
|
function cleanStream(stream, rawLines) {
|
|
34
34
|
rawLines.forEach((lineLength, index) => {
|
|
35
35
|
(0, readline_1.moveCursor)(stream, lineLength, index);
|
|
@@ -40,4 +40,3 @@ function cleanStream(stream, rawLines) {
|
|
|
40
40
|
(0, readline_1.clearScreenDown)(stream);
|
|
41
41
|
(0, readline_1.moveCursor)(stream, 0, -rawLines.length);
|
|
42
42
|
}
|
|
43
|
-
exports.cleanStream = cleanStream;
|
package/lib/userConfig.d.ts
CHANGED
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
export declare const CONFIG_KEYS: {
|
|
2
|
+
node12_bin: string;
|
|
3
|
+
node14_bin: string;
|
|
4
|
+
node16_bin: string;
|
|
5
|
+
node18_bin: string;
|
|
6
|
+
node20_bin: string;
|
|
7
|
+
node22_bin: string;
|
|
8
|
+
node24_bin: string;
|
|
2
9
|
python39_bin: string;
|
|
10
|
+
python310_bin: string;
|
|
11
|
+
python311_bin: string;
|
|
12
|
+
python312_bin: string;
|
|
13
|
+
python313_bin: string;
|
|
3
14
|
java8_bin: string;
|
|
4
15
|
java11_bin: string;
|
|
5
16
|
java17_bin: string;
|
|
17
|
+
java21_bin: string;
|
|
18
|
+
java25_bin: string;
|
|
6
19
|
javac_disableWarnings: string;
|
|
7
20
|
serve_container: string;
|
|
21
|
+
functionsShell_prompt: string;
|
|
8
22
|
};
|
|
9
23
|
declare class UserConfig {
|
|
10
24
|
private configFilePath;
|
package/lib/userConfig.js
CHANGED
|
@@ -9,12 +9,26 @@ const constants_1 = require("./util_modules/constants");
|
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const error_1 = __importDefault(require("./error"));
|
|
11
11
|
exports.CONFIG_KEYS = {
|
|
12
|
+
node12_bin: 'node12.bin',
|
|
13
|
+
node14_bin: 'node14.bin',
|
|
14
|
+
node16_bin: 'node16.bin',
|
|
15
|
+
node18_bin: 'node18.bin',
|
|
16
|
+
node20_bin: 'node20.bin',
|
|
17
|
+
node22_bin: 'node22.bin',
|
|
18
|
+
node24_bin: 'node24.bin',
|
|
12
19
|
python39_bin: 'python3_9.bin',
|
|
20
|
+
python310_bin: 'python3_10.bin',
|
|
21
|
+
python311_bin: 'python3_11.bin',
|
|
22
|
+
python312_bin: 'python3_12.bin',
|
|
23
|
+
python313_bin: 'python3_13.bin',
|
|
13
24
|
java8_bin: 'java8.bin',
|
|
14
25
|
java11_bin: 'java11.bin',
|
|
15
26
|
java17_bin: 'java17.bin',
|
|
27
|
+
java21_bin: 'java21.bin',
|
|
28
|
+
java25_bin: 'java25.bin',
|
|
16
29
|
javac_disableWarnings: 'javac.disable_warnings',
|
|
17
|
-
serve_container: 'serve.container'
|
|
30
|
+
serve_container: 'serve.container',
|
|
31
|
+
functionsShell_prompt: 'functions_shell.prompt'
|
|
18
32
|
};
|
|
19
33
|
class UserConfig {
|
|
20
34
|
constructor() {
|