zcatalyst-cli 1.25.3 → 1.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api-timer.d.ts +0 -1
- package/lib/apig-utils.d.ts +1 -1
- package/lib/apig-utils.js +1 -1
- package/lib/appsail-utils.js +6 -7
- package/lib/archiver.d.ts +0 -4
- package/lib/archiver.js +21 -11
- package/lib/authentication/constants/auth.js +1 -1
- package/lib/authentication/credential.js +3 -3
- package/lib/authentication/index.js +25 -14
- package/lib/authentication/login.d.ts +0 -2
- package/lib/authentication/login.js +23 -10
- package/lib/bin/catalyst.js +17 -7
- package/lib/client-utils.d.ts +3 -3
- package/lib/client-utils.js +2 -2
- package/lib/client.js +19 -9
- package/lib/code-deck.d.ts +0 -2
- package/lib/code-deck.js +4 -4
- package/lib/command_needs/config.js +1 -1
- package/lib/command_needs/rc.js +5 -2
- package/lib/commands/appsail/add.js +17 -7
- package/lib/commands/client/setup.js +17 -7
- package/lib/commands/config/set.js +5 -3
- package/lib/commands/deploy/appsail.js +37 -14
- package/lib/commands/deploy/index.js +88 -66
- package/lib/commands/deploy/slate.js +37 -14
- package/lib/commands/event/generate/integ.js +18 -9
- package/lib/commands/functions/add.js +17 -7
- package/lib/commands/functions/execute.js +17 -7
- package/lib/commands/functions/setup.js +17 -7
- package/lib/commands/functions/shell.js +17 -7
- package/lib/commands/iac/import.js +18 -8
- package/lib/commands/iac/pack.js +17 -7
- package/lib/commands/iac/status.js +17 -7
- package/lib/commands/index.js +20 -12
- package/lib/commands/init.js +17 -7
- package/lib/commands/login.js +17 -7
- package/lib/commands/logout.js +17 -7
- package/lib/commands/project/list.js +17 -7
- package/lib/commands/project/use.js +1 -0
- package/lib/commands/pull.js +17 -7
- package/lib/commands/run.js +17 -7
- package/lib/commands/serve.js +17 -7
- package/lib/commands/signals/generate/index.js +1 -1
- package/lib/commands/slate/create.js +17 -7
- package/lib/commands/slate/link.js +17 -7
- package/lib/commands/token/generate.js +17 -7
- package/lib/commands/token/list.js +17 -7
- package/lib/commands/token/revoke.js +17 -7
- package/lib/commands/zest/generate/index.js +21 -11
- package/lib/deploy/features/appsail/index.js +2 -3
- package/lib/deploy/features/appsail/pack.d.ts +0 -1
- package/lib/deploy/features/appsail/pack.js +2 -3
- package/lib/deploy/features/appsail/utils.js +7 -8
- package/lib/deploy/features/functions/languages/index.js +3 -4
- package/lib/deploy/features/index.js +17 -7
- package/lib/deploy/features/slate.js +11 -8
- 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 +20 -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 +23 -11
- package/lib/init/util/client.js +23 -13
- package/lib/init/util/common.js +5 -6
- package/lib/init/util/project.js +1 -1
- package/lib/internal/api.d.ts +0 -3
- package/lib/internal/api.js +19 -9
- package/lib/internal/command.js +18 -9
- package/lib/migration/global/1.25.0.d.ts +2 -0
- package/lib/migration/global/1.25.0.js +28 -0
- package/lib/migration/index.js +20 -12
- package/lib/option-filter.js +19 -10
- package/lib/optional-import.js +19 -10
- package/lib/plugin-loader.d.ts +0 -2
- package/lib/plugin-loader.js +18 -8
- package/lib/port-resolver.js +10 -10
- package/lib/prompt/index.d.ts +3 -3
- package/lib/prompt/index.js +17 -7
- package/lib/prompt/types/file-path.d.ts +0 -1
- package/lib/prompt/types/search-box.d.ts +0 -1
- package/lib/prompt/types/tree.d.ts +1 -2
- package/lib/prompt/types/tree.js +10 -10
- package/lib/prompt/types/with-description.d.ts +0 -1
- package/lib/pull/features/functions/index.js +71 -52
- package/lib/pull/features/functions/languages.js +3 -4
- package/lib/pull/features/index.js +17 -7
- package/lib/repl-server.d.ts +0 -1
- package/lib/repl-server.js +9 -1
- package/lib/serve/features/apig.js +7 -1
- package/lib/serve/features/appsail.d.ts +1 -0
- package/lib/serve/features/appsail.js +51 -7
- package/lib/serve/features/index.js +22 -13
- package/lib/serve/index.js +17 -7
- package/lib/serve/server/index.d.ts +0 -2
- package/lib/serve/server/index.js +26 -12
- package/lib/serve/server/lib/appsail/index.js +27 -34
- package/lib/serve/server/lib/appsail/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/index.js +7 -0
- 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 +25 -16
- 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.d.ts +2 -1
- package/lib/util_modules/config/lib/slate.js +27 -13
- 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,8 @@ class AppSail {
|
|
|
21
21
|
this.opts = opts;
|
|
22
22
|
this.projectId = projectId;
|
|
23
23
|
}
|
|
24
|
-
deploy(
|
|
25
|
-
return __awaiter(this,
|
|
24
|
+
deploy(sourceFsStream_1, _a) {
|
|
25
|
+
return __awaiter(this, arguments, void 0, function* (sourceFsStream, { stack, name, contentLength, command, memory, platform, envVariables = {}, catalystAuth, loginRedirect, port }) {
|
|
26
26
|
const formData = {
|
|
27
27
|
stack,
|
|
28
28
|
name,
|
|
@@ -107,14 +107,14 @@ class AppSail {
|
|
|
107
107
|
});
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
-
downloadJetty() {
|
|
110
|
+
downloadJetty(url) {
|
|
111
111
|
return __awaiter(this, void 0, void 0, function* () {
|
|
112
112
|
const res = yield new api_1.default({
|
|
113
113
|
origin: constants_1.ORIGIN.zohoCDNUS,
|
|
114
114
|
authNeeded: false,
|
|
115
115
|
json: false,
|
|
116
116
|
isExternal: true
|
|
117
|
-
}).get(
|
|
117
|
+
}).get(url, { encoding: null });
|
|
118
118
|
if (res.body) {
|
|
119
119
|
return res.body;
|
|
120
120
|
}
|
|
@@ -136,8 +136,8 @@ class AppSail {
|
|
|
136
136
|
});
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
|
-
uploadToBucket(
|
|
140
|
-
return __awaiter(this,
|
|
139
|
+
uploadToBucket(_a) {
|
|
140
|
+
return __awaiter(this, arguments, void 0, function* ({ signedUrl, length, stream, name }) {
|
|
141
141
|
const url = new URL(signedUrl);
|
|
142
142
|
const res = yield new api_1.default(Object.assign(Object.assign({}, this.opts), { isExternal: true, origin: url.origin, authNeeded: false, json: false })).put(url.pathname + '?' + url.searchParams, {
|
|
143
143
|
log: {
|
|
@@ -165,8 +165,8 @@ class AppSail {
|
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
customAppSailCallback(target, objectId) {
|
|
168
|
-
var _a, _b, _c, _d, _e;
|
|
169
168
|
return __awaiter(this, void 0, void 0, function* () {
|
|
169
|
+
var _a, _b, _c, _d, _e;
|
|
170
170
|
const configuration = {};
|
|
171
171
|
if (typeof ((_a = target.config) === null || _a === void 0 ? void 0 : _a.command) === 'string') {
|
|
172
172
|
configuration.startup_command = target.config.command;
|
|
@@ -50,7 +50,6 @@ class CodeDeck {
|
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
exports.default = CodeDeck;
|
|
54
53
|
_CodeDeck_instances = new WeakSet(), _CodeDeck_manifest = function _CodeDeck_manifest() {
|
|
55
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
55
|
const res = yield new api_1.default(this.opts).get('/catalyst-library/codelib/config.json', {
|
|
@@ -69,3 +68,4 @@ _CodeDeck_instances = new WeakSet(), _CodeDeck_manifest = function _CodeDeck_man
|
|
|
69
68
|
});
|
|
70
69
|
});
|
|
71
70
|
};
|
|
71
|
+
exports.default = CodeDeck;
|
|
@@ -60,8 +60,8 @@ class BulkDS {
|
|
|
60
60
|
});
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
getStatus(
|
|
64
|
-
return __awaiter(this,
|
|
63
|
+
getStatus(operation_1, jobid_1) {
|
|
64
|
+
return __awaiter(this, arguments, void 0, function* (operation, jobid, prev = false) {
|
|
65
65
|
const res = yield new api_1.default(this.opts).get(`/baas/v1/project/${this.projectId}/bulk/${operation}/${jobid}/report`, {
|
|
66
66
|
qs: {
|
|
67
67
|
prev
|
package/lib/endpoints/lib/env.js
CHANGED
|
@@ -22,8 +22,8 @@ class Env {
|
|
|
22
22
|
this.opts = opts;
|
|
23
23
|
this.opts.envId = org;
|
|
24
24
|
}
|
|
25
|
-
getEnvs(
|
|
26
|
-
return __awaiter(this,
|
|
25
|
+
getEnvs(projectId_1) {
|
|
26
|
+
return __awaiter(this, arguments, void 0, function* (projectId, throwErr = true) {
|
|
27
27
|
const res = yield new api_1.default(this.opts).get('/baas/v1/project/' + projectId + '/environment');
|
|
28
28
|
if (res.body && res.body.data) {
|
|
29
29
|
const data = res.body.data;
|
|
@@ -73,8 +73,8 @@ class Functions {
|
|
|
73
73
|
});
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
deploy(
|
|
77
|
-
return __awaiter(this,
|
|
76
|
+
deploy(sourceFsStream_1, _a) {
|
|
77
|
+
return __awaiter(this, arguments, void 0, function* (sourceFsStream, { stack, name, type, memory, envVariables, contentLength }) {
|
|
78
78
|
const formData = {
|
|
79
79
|
stack,
|
|
80
80
|
name,
|
package/lib/endpoints/lib/iac.js
CHANGED
|
@@ -21,8 +21,8 @@ class IacAPI {
|
|
|
21
21
|
this.opts = opts || { env: (0, project_1.getEnvName)() };
|
|
22
22
|
this.projectId = projectId || (0, project_1.getProjectId)('');
|
|
23
23
|
}
|
|
24
|
-
deploy(
|
|
25
|
-
return __awaiter(this,
|
|
24
|
+
deploy(projectName_1, format_1, file_1) {
|
|
25
|
+
return __awaiter(this, arguments, void 0, function* (projectName, format, file, schedule = false) {
|
|
26
26
|
const res = yield new api_1.default(this.opts).post('/baas/v1/project/import', {
|
|
27
27
|
formData: {
|
|
28
28
|
project_name: projectName,
|
|
@@ -60,8 +60,8 @@ class ProjectAPI {
|
|
|
60
60
|
});
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
getCurrentProjectUser(
|
|
64
|
-
return __awaiter(this,
|
|
63
|
+
getCurrentProjectUser(projectId_1) {
|
|
64
|
+
return __awaiter(this, arguments, void 0, function* (projectId, headers = {}) {
|
|
65
65
|
const res = yield new api_1.default(Object.assign(Object.assign({}, this.opts), { headers, authNeeded: false, resolveOnError: true, printError: false })).get(`/baas/v1/project/${projectId}/project-user/current`);
|
|
66
66
|
if (res.body && res.body.data) {
|
|
67
67
|
if (typeof res.body.data.email_id === 'undefined') {
|
package/lib/endpoints/lib/sdk.js
CHANGED
|
@@ -37,8 +37,8 @@ class SDK {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
java(fnType, service) {
|
|
40
|
-
var _a;
|
|
41
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
var _a;
|
|
42
42
|
const targetSDK = this.getSdkUrl(fnType, service);
|
|
43
43
|
const res = yield new api_1.default(this.opts).get(targetSDK, {
|
|
44
44
|
json: false,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = help;
|
|
3
4
|
const utils_js_1 = require("./utils.js");
|
|
4
5
|
const ansi_colors_1 = require("ansi-colors");
|
|
5
6
|
const index_js_1 = require("../util_modules/fs/index.js");
|
|
@@ -69,7 +70,6 @@ function help() {
|
|
|
69
70
|
utils_js_1.runtime.set('context.log', {});
|
|
70
71
|
return exitCode;
|
|
71
72
|
}
|
|
72
|
-
exports.default = help;
|
|
73
73
|
function outputError(err, errQueue) {
|
|
74
74
|
(0, logger_1.error)(err.message);
|
|
75
75
|
debugLog(err);
|
package/lib/error/index.js
CHANGED
|
@@ -27,8 +27,8 @@ class CatalystError extends Error {
|
|
|
27
27
|
}
|
|
28
28
|
options.docPath = options.docPath || DEFAULT_DOC;
|
|
29
29
|
this.filePath = errorPath.replace((0, path_1.dirname)(options.docPath), options.docPath);
|
|
30
|
-
utils_js_1.runtime.set(
|
|
31
|
-
.get(
|
|
30
|
+
utils_js_1.runtime.set(['context.log', this.filePath], utils_js_1.runtime
|
|
31
|
+
.get(['context.log', this.filePath], [])
|
|
32
32
|
.concat(this));
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -12,15 +12,16 @@ 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.sourceId = void 0;
|
|
16
|
+
exports.getData = getData;
|
|
16
17
|
const ansi_colors_1 = require("ansi-colors");
|
|
17
18
|
const moment_1 = __importDefault(require("moment"));
|
|
18
19
|
const endpoints_1 = require("../endpoints");
|
|
19
20
|
const index_js_1 = __importDefault(require("../error/index.js"));
|
|
20
21
|
const js_1 = require("../util_modules/js");
|
|
21
22
|
exports.sourceId = 'NULL';
|
|
22
|
-
function getData(
|
|
23
|
-
return __awaiter(this,
|
|
23
|
+
function getData() {
|
|
24
|
+
return __awaiter(this, arguments, void 0, function* (options = {}) {
|
|
24
25
|
const segmentId = options.segment;
|
|
25
26
|
const allSegments = (yield (yield (0, endpoints_1.cacheAPI)()).getAllSegments());
|
|
26
27
|
const selectedSegment = segmentId !== undefined
|
|
@@ -52,4 +53,3 @@ function getData(options = {}) {
|
|
|
52
53
|
};
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
|
-
exports.getData = getData;
|
|
@@ -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.getRuleId =
|
|
15
|
+
exports.getRuleId = getRuleId;
|
|
16
16
|
const ansi_colors_1 = require("ansi-colors");
|
|
17
17
|
const index_js_1 = __importDefault(require("../error/index.js"));
|
|
18
18
|
const option_1 = require("../util_modules/option");
|
|
@@ -29,4 +29,3 @@ function getRuleId() {
|
|
|
29
29
|
return ruleId;
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
exports.getRuleId = getRuleId;
|
|
@@ -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.sourceId = void 0;
|
|
16
|
+
exports.getData = getData;
|
|
16
17
|
const ansi_colors_1 = require("ansi-colors");
|
|
17
18
|
const moment_1 = __importDefault(require("moment"));
|
|
18
19
|
const endpoints_1 = require("../endpoints");
|
|
@@ -21,8 +22,8 @@ const constants_1 = require("../util_modules/constants");
|
|
|
21
22
|
const js_1 = require("../util_modules/js");
|
|
22
23
|
const index_1 = require("../util_modules/logger/index");
|
|
23
24
|
exports.sourceId = 'NULL';
|
|
24
|
-
function getData(
|
|
25
|
-
return __awaiter(this,
|
|
25
|
+
function getData() {
|
|
26
|
+
return __awaiter(this, arguments, void 0, function* (options = {}) {
|
|
26
27
|
const tableId = options.table;
|
|
27
28
|
let columnDetails = constants_1.DEFAULT.datastore.column_details;
|
|
28
29
|
if (tableId !== undefined) {
|
|
@@ -82,4 +83,3 @@ function getData(options = {}) {
|
|
|
82
83
|
}, [{}])[0];
|
|
83
84
|
});
|
|
84
85
|
}
|
|
85
|
-
exports.getData = getData;
|
|
@@ -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.sourceId = void 0;
|
|
16
|
+
exports.getData = getData;
|
|
16
17
|
const ansi_colors_1 = require("ansi-colors");
|
|
17
18
|
const moment_1 = __importDefault(require("moment"));
|
|
18
19
|
const endpoints_1 = require("../endpoints");
|
|
@@ -21,8 +22,8 @@ const runtime_store_1 = __importDefault(require("../runtime-store"));
|
|
|
21
22
|
const js_1 = require("../util_modules/js");
|
|
22
23
|
const project_1 = require("../util_modules/project");
|
|
23
24
|
exports.sourceId = 'NULL';
|
|
24
|
-
function getData(
|
|
25
|
-
return __awaiter(this,
|
|
25
|
+
function getData() {
|
|
26
|
+
return __awaiter(this, arguments, void 0, function* (options = {}) {
|
|
26
27
|
const folderId = options.folder;
|
|
27
28
|
const allFolders = (yield (yield (0, endpoints_1.filestoreAPI)()).getAllFolders());
|
|
28
29
|
const selectedFolder = folderId !== undefined
|
|
@@ -70,4 +71,3 @@ function getData(options = {}) {
|
|
|
70
71
|
};
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
|
-
exports.getData = getData;
|
|
@@ -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.sourceId = void 0;
|
|
16
|
+
exports.getData = getData;
|
|
16
17
|
const runtime_store_1 = __importDefault(require("../runtime-store"));
|
|
17
18
|
const js_1 = require("../util_modules/js");
|
|
18
19
|
exports.sourceId = 'NULL';
|
|
@@ -32,4 +33,3 @@ function getData() {
|
|
|
32
33
|
};
|
|
33
34
|
});
|
|
34
35
|
}
|
|
35
|
-
exports.getData = getData;
|
|
@@ -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 option_1 = require("../util_modules/option");
|
|
@@ -46,7 +56,6 @@ const project_1 = require("../util_modules/project");
|
|
|
46
56
|
const logger_1 = require("../util_modules/logger");
|
|
47
57
|
function generate(source, action) {
|
|
48
58
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
var _a;
|
|
50
59
|
(0, logger_1.warning)('The "event:generate" command is deprecated and will be removed in upcoming releases. Please use the signals:generate instead.');
|
|
51
60
|
const unknownArgs = (0, option_1.getUnknownOpts)([]).filter((arg) => arg !== '--verbose');
|
|
52
61
|
if (unknownArgs.length % 2 !== 0) {
|
|
@@ -177,7 +186,7 @@ function generate(source, action) {
|
|
|
177
186
|
}
|
|
178
187
|
});
|
|
179
188
|
const isCustomSource = source === 'custom';
|
|
180
|
-
const sourceModule = yield (
|
|
189
|
+
const sourceModule = yield Promise.resolve(`${`./${source}`}`).then(s => __importStar(require(s)));
|
|
181
190
|
eventJsonContent = eventJsonContent.replace(new RegExp(constants_1.PLACEHOLDER.event_data.rule_id, 'g'), isCustomSource ? yield sourceModule.getRuleId() : 'NULL');
|
|
182
191
|
const evenData = !isCustomSource ? yield sourceModule.getData(optionMap) : optionMap.payload;
|
|
183
192
|
eventJsonContent = eventJsonContent.replace(new RegExp(constants_1.PLACEHOLDER.event_data.data, 'g'), JSON.stringify(evenData));
|
|
@@ -193,4 +202,3 @@ function generate(source, action) {
|
|
|
193
202
|
return jsonContent;
|
|
194
203
|
});
|
|
195
204
|
}
|
|
196
|
-
exports.generate = generate;
|
|
@@ -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.sourceId = void 0;
|
|
16
|
+
exports.getData = getData;
|
|
16
17
|
const moment_1 = __importDefault(require("moment"));
|
|
17
18
|
const runtime_store_1 = __importDefault(require("../runtime-store"));
|
|
18
19
|
const js_1 = require("../util_modules/js");
|
|
@@ -60,7 +61,6 @@ function getData() {
|
|
|
60
61
|
};
|
|
61
62
|
});
|
|
62
63
|
}
|
|
63
|
-
exports.getData = getData;
|
|
64
64
|
function getRandomBoolean() {
|
|
65
65
|
return js_1.JS.random(0, 1) === 1;
|
|
66
66
|
}
|
|
@@ -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.sourceId = void 0;
|
|
16
|
+
exports.getData = getData;
|
|
16
17
|
const moment_1 = __importDefault(require("moment"));
|
|
17
18
|
const runtime_store_1 = __importDefault(require("../runtime-store"));
|
|
18
19
|
const js_1 = require("../util_modules/js");
|
|
@@ -48,4 +49,3 @@ function getData() {
|
|
|
48
49
|
};
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
|
-
exports.getData = getData;
|
|
@@ -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.sourceId = void 0;
|
|
16
|
+
exports.getData = getData;
|
|
16
17
|
const moment_1 = __importDefault(require("moment"));
|
|
17
18
|
const endpoints_1 = require("../endpoints");
|
|
18
19
|
const runtime_store_1 = __importDefault(require("../runtime-store"));
|
|
@@ -50,4 +51,3 @@ function getData() {
|
|
|
50
51
|
};
|
|
51
52
|
});
|
|
52
53
|
}
|
|
53
|
-
exports.getData = getData;
|
package/lib/execute/caller.d.ts
CHANGED
package/lib/execute/caller.js
CHANGED
|
@@ -26,6 +26,7 @@ const port_resolver_1 = __importDefault(require("../port-resolver"));
|
|
|
26
26
|
const project_1 = require("../util_modules/project");
|
|
27
27
|
const container_1 = require("../util_modules/container");
|
|
28
28
|
const fn_execution_handler_1 = require("../shell/dependencies/non-http-function/fn-execution-handler");
|
|
29
|
+
const child_process_1 = require("child_process");
|
|
29
30
|
class Caller extends fn_execution_handler_1.FnExecutionHandler {
|
|
30
31
|
constructor(serverDetails, localFnEvents) {
|
|
31
32
|
var _a, _b;
|
|
@@ -40,8 +41,8 @@ class Caller extends fn_execution_handler_1.FnExecutionHandler {
|
|
|
40
41
|
};
|
|
41
42
|
}
|
|
42
43
|
call(data) {
|
|
43
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
45
46
|
if (typeof data !== 'object') {
|
|
46
47
|
throw new error_1.default('Data is not a valid JSON object', { exit: 1 });
|
|
47
48
|
}
|
|
@@ -63,6 +64,9 @@ class Caller extends fn_execution_handler_1.FnExecutionHandler {
|
|
|
63
64
|
if (this.fn.target.type === constants_1.FN_TYPE.cron) {
|
|
64
65
|
data = { data };
|
|
65
66
|
}
|
|
67
|
+
if (this.fn.target.type === constants_1.FN_TYPE.integration) {
|
|
68
|
+
data.timestamp = Date.now();
|
|
69
|
+
}
|
|
66
70
|
const accessToken = yield credential_1.default.getAccessToken();
|
|
67
71
|
yield fs_1.ASYNC.ensureFile(this.responseFile, true);
|
|
68
72
|
yield fs_1.ASYNC.ensureFile(this.metaFile, true);
|
|
@@ -124,14 +128,25 @@ class Caller extends fn_execution_handler_1.FnExecutionHandler {
|
|
|
124
128
|
(0, shell_1.clearLine)(process.stdout);
|
|
125
129
|
(0, index_1.info)(message.toString());
|
|
126
130
|
});
|
|
127
|
-
this.slave.on('error', (err) => {
|
|
128
|
-
this.localFnEvents.listenerCount('error') > 0 && this.localFnEvents.emit('error', err);
|
|
129
|
-
});
|
|
130
131
|
return new Promise((resolve, reject) => {
|
|
131
132
|
if (!this.slave) {
|
|
132
133
|
return reject(new error_1.default('Invalid slave'));
|
|
133
134
|
}
|
|
134
|
-
this.slave
|
|
135
|
+
if (this.slave instanceof child_process_1.ChildProcess && this.slave.exitCode) {
|
|
136
|
+
(0, index_1.debug)('Slave process exited prematurely');
|
|
137
|
+
this.slave.exitCode > 0
|
|
138
|
+
? reject(new error_1.default('Slave exited with code: ' + this.slave.exitCode))
|
|
139
|
+
: resolve();
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
this.slave.once('error', (err) => {
|
|
143
|
+
var _a, _b;
|
|
144
|
+
(0, index_1.debug)('Slave error in executing function ' + ((_b = (_a = this.fn) === null || _a === void 0 ? void 0 : _a.target) === null || _b === void 0 ? void 0 : _b.name), err);
|
|
145
|
+
this.localFnEvents.listenerCount('error') > 0 &&
|
|
146
|
+
this.localFnEvents.emit('error', err);
|
|
147
|
+
reject(err);
|
|
148
|
+
});
|
|
149
|
+
this.slave.once('exit', (code, sig) => __awaiter(this, void 0, void 0, function* () {
|
|
135
150
|
(0, index_1.debug)(`caller fn slave exit: ${code}, ${sig}`);
|
|
136
151
|
if (this.isContainer && code === 143) {
|
|
137
152
|
code = 0;
|
|
@@ -151,8 +166,6 @@ class Caller extends fn_execution_handler_1.FnExecutionHandler {
|
|
|
151
166
|
kill: { get: () => super.kill }
|
|
152
167
|
});
|
|
153
168
|
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
-
(0, index_1.info)();
|
|
155
|
-
(0, index_1.info)('Terminating Function');
|
|
156
169
|
_super.kill.call(this);
|
|
157
170
|
});
|
|
158
171
|
}
|
package/lib/execute/index.js
CHANGED
|
@@ -26,6 +26,8 @@ const caller_js_1 = require("./caller.js");
|
|
|
26
26
|
const runtime_store_1 = __importDefault(require("../runtime-store"));
|
|
27
27
|
const stream_1 = require("stream");
|
|
28
28
|
const throbber_1 = __importDefault(require("../throbber"));
|
|
29
|
+
const util_1 = require("util");
|
|
30
|
+
const pip_install_1 = require("../init/dependencies/python/pip-install");
|
|
29
31
|
exports.default = (target, input) => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
32
|
const buildFolder = (0, project_js_1.resolveProjectPath)(index_js_3.FOLDERNAME.build);
|
|
31
33
|
try {
|
|
@@ -42,8 +44,7 @@ exports.default = (target, input) => __awaiter(void 0, void 0, void 0, function*
|
|
|
42
44
|
throw new index_js_2.default('Error running pre cleanup', {
|
|
43
45
|
original: err,
|
|
44
46
|
exit: 1,
|
|
45
|
-
|
|
46
|
-
arg: [(0, ansi_colors_1.bold)(index_js_3.FOLDERNAME.build), ansi_colors_1.italic.red(buildFolder)]
|
|
47
|
+
skipHelp: true
|
|
47
48
|
});
|
|
48
49
|
}
|
|
49
50
|
}
|
|
@@ -54,7 +55,26 @@ exports.default = (target, input) => __awaiter(void 0, void 0, void 0, function*
|
|
|
54
55
|
});
|
|
55
56
|
const [_nodeFns, javaFns, _pythonFns] = yield (0, index_js_5.prepareFunctions)([target]);
|
|
56
57
|
javaFns && (0, compile_js_1.printCompilationLog)(javaFns);
|
|
58
|
+
const pyStacks = [];
|
|
59
|
+
_pythonFns === null || _pythonFns === void 0 ? void 0 : _pythonFns.forEach((target) => {
|
|
60
|
+
if (!pyStacks.includes(target.stack + '') && target.valid) {
|
|
61
|
+
pyStacks.push(target.stack + '');
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
yield Promise.all(pyStacks.map((stack) => __awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
+
var _a, _b;
|
|
66
|
+
yield (0, pip_install_1.ensurePyRuntime)(index_js_3.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);
|
|
67
|
+
})));
|
|
57
68
|
const debugPort = runtime_store_1.default.get(`context.port.debug.${target.type}.${target.name}`, -1);
|
|
69
|
+
const preparedFn = [_nodeFns, javaFns, _pythonFns]
|
|
70
|
+
.flat()
|
|
71
|
+
.find((fn) => (fn === null || fn === void 0 ? void 0 : fn.name) === target.name);
|
|
72
|
+
if ((preparedFn === null || preparedFn === void 0 ? void 0 : preparedFn.valid) === false) {
|
|
73
|
+
throw new index_js_2.default(`Error preparing function ${(0, ansi_colors_1.bold)(target.name)} for execution because ${target.failure_reason}`, {
|
|
74
|
+
exit: 1,
|
|
75
|
+
skipHelp: true
|
|
76
|
+
});
|
|
77
|
+
}
|
|
58
78
|
const caller = new caller_js_1.Caller({
|
|
59
79
|
type: 'functions',
|
|
60
80
|
target,
|
|
@@ -72,14 +92,17 @@ exports.default = (target, input) => __awaiter(void 0, void 0, void 0, function*
|
|
|
72
92
|
(0, index_1.info)();
|
|
73
93
|
}
|
|
74
94
|
catch (e) {
|
|
95
|
+
utils_1.serverEvent.emit('error', e);
|
|
75
96
|
index_js_4.ASYNC.deleteDir(buildFolder).catch();
|
|
76
|
-
utils_1.serverEvent.emit('stop');
|
|
77
97
|
if (typeof e === 'number') {
|
|
78
98
|
(0, index_1.debug)('Execute function program termination by code: ', 130);
|
|
79
99
|
}
|
|
80
100
|
else {
|
|
81
|
-
|
|
101
|
+
(0, index_1.info)();
|
|
102
|
+
(0, index_1.info)(ansi_colors_1.bold.red('Function execution failed'));
|
|
103
|
+
(0, index_1.info)(ansi_colors_1.italic.red('Reason: ') + (e instanceof Error ? e.message : (0, util_1.inspect)(e)));
|
|
82
104
|
}
|
|
105
|
+
utils_1.serverEvent.emit('stop');
|
|
83
106
|
}
|
|
84
107
|
finally {
|
|
85
108
|
utils_1.serverEvent.emit('close');
|