zcatalyst-cli 1.12.1 → 1.13.2
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/docs/apig-utils.toml +5 -0
- package/lib/apig-utils.js +51 -39
- package/lib/archiver.js +13 -9
- package/lib/authentication/index.js +22 -18
- package/lib/authentication/login.js +32 -32
- package/lib/bin/catalyst.js +15 -15
- package/lib/cli_table/src/cell.js +26 -26
- package/lib/cli_table/src/layout-manager.js +44 -45
- package/lib/cli_table/src/table.js +9 -9
- package/lib/cli_table/src/utils.js +35 -36
- package/lib/client-utils.js +43 -22
- package/lib/client.js +1 -1
- package/lib/command_needs/auth.js +7 -7
- package/lib/command_needs/rc.js +32 -25
- package/lib/commands/apig/disable.js +5 -5
- package/lib/commands/apig/enable.js +5 -5
- package/lib/commands/apig/status.js +9 -9
- package/lib/commands/client/delete.js +18 -18
- package/lib/commands/client/setup.js +8 -4
- package/lib/commands/deploy.js +18 -14
- package/lib/commands/ds/export.js +11 -11
- package/lib/commands/ds/import.js +12 -12
- package/lib/commands/ds/status.js +10 -10
- package/lib/commands/event/generate/index.js +21 -17
- package/lib/commands/event/generate/integ.js +7 -3
- package/lib/commands/functions/add.js +8 -4
- package/lib/commands/functions/config.js +5 -5
- package/lib/commands/functions/delete.js +20 -20
- package/lib/commands/functions/setup.js +8 -4
- package/lib/commands/functions/shell.js +7 -3
- package/lib/commands/help.js +4 -4
- package/lib/commands/iac/export.js +8 -8
- package/lib/commands/iac/import.js +23 -19
- package/lib/commands/iac/pack.js +15 -11
- package/lib/commands/iac/status.js +6 -2
- package/lib/commands/index.js +5 -1
- package/lib/commands/init.js +14 -10
- package/lib/commands/login.js +5 -1
- package/lib/commands/logout.js +5 -1
- package/lib/commands/project/list.js +14 -10
- package/lib/commands/project/reset.js +5 -5
- package/lib/commands/project/use.js +9 -9
- package/lib/commands/pull.js +18 -14
- package/lib/commands/run.js +13 -9
- package/lib/commands/serve.js +5 -1
- package/lib/commands/token/generate.js +6 -2
- package/lib/commands/token/list.js +7 -3
- package/lib/commands/token/revoke.js +6 -2
- package/lib/commands/whoami.js +3 -3
- package/lib/dc.js +2 -2
- package/lib/deploy/features/apig.js +6 -6
- package/lib/deploy/features/client.js +1 -1
- package/lib/deploy/features/functions/index.js +9 -9
- package/lib/deploy/features/index.js +5 -1
- package/lib/deploy/index.js +2 -2
- package/lib/endpoints/index.js +17 -13
- package/lib/endpoints/lib/apig.js +5 -5
- package/lib/endpoints/lib/applogic.js +4 -4
- package/lib/endpoints/lib/cache.js +3 -3
- package/lib/endpoints/lib/catalyst-details.js +1 -1
- package/lib/endpoints/lib/client.js +5 -5
- package/lib/endpoints/lib/datastore.js +2 -2
- package/lib/endpoints/lib/ds-bulk.js +5 -5
- package/lib/endpoints/lib/env.js +1 -1
- package/lib/endpoints/lib/event-bus.js +1 -1
- package/lib/endpoints/lib/filestore.js +2 -2
- package/lib/endpoints/lib/functions.js +4 -4
- package/lib/endpoints/lib/iac.js +10 -10
- package/lib/endpoints/lib/project.js +20 -5
- package/lib/endpoints/lib/queue.js +3 -3
- package/lib/endpoints/lib/sdk.js +1 -1
- package/lib/endpoints/lib/zcql.js +1 -1
- package/lib/error.js +1 -1
- package/lib/errorOut.js +2 -2
- package/lib/event_generate/cache.js +5 -5
- package/lib/event_generate/custom.js +2 -2
- package/lib/event_generate/datastore.js +5 -5
- package/lib/event_generate/filestore.js +5 -5
- package/lib/event_generate/integration/cliq.js +3 -3
- package/lib/event_generate/user.js +1 -1
- package/lib/event_generate/webapp.js +5 -5
- package/lib/execute-script.js +19 -15
- package/lib/express_middlewares/authenticator.js +30 -4
- package/lib/express_middlewares/logger.js +2 -2
- package/lib/express_middlewares/unknownReqProxy.js +1 -1
- package/lib/fn-utils/index.js +5 -1
- package/lib/fn-utils/lib/common.js +44 -44
- package/lib/fn-utils/lib/integ.js +9 -9
- package/lib/fn-utils/lib/java.js +46 -46
- package/lib/fn-utils/lib/node.js +7 -7
- package/lib/fn-watcher.js +9 -11
- package/lib/iac/status/bundle.js +5 -5
- package/lib/iac/status/deploy.js +4 -4
- package/lib/index.js +2 -2
- package/lib/init/dependencies/npm-install.js +1 -1
- package/lib/init/dependencies/package-json.js +6 -6
- package/lib/init/features/client/index.js +5 -1
- package/lib/init/features/client/initializers/angular.js +16 -12
- package/lib/init/features/client/initializers/basic.js +10 -6
- package/lib/init/features/client/initializers/lyte.js +11 -7
- package/lib/init/features/client/initializers/react.js +13 -9
- package/lib/init/features/functions/index.js +9 -9
- package/lib/init/features/functions/languages/java.js +10 -10
- package/lib/init/features/functions/languages/node.js +9 -9
- package/lib/init/features/index.js +12 -8
- package/lib/init/features/project.js +20 -20
- package/lib/init/index.js +2 -2
- package/lib/init/util/client.js +7 -3
- package/lib/init/util/functions.js +1 -1
- package/lib/init/util/project.js +4 -4
- package/lib/internal/api.js +19 -19
- package/lib/internal/command.js +20 -16
- package/lib/internal/config.js +5 -5
- package/lib/internal/credential.js +10 -10
- package/lib/internal/crypt.js +5 -5
- package/lib/internal/rc.js +6 -6
- package/lib/migration/global/1.6.2.js +3 -3
- package/lib/migration/index.js +22 -18
- package/lib/option-filter.js +34 -30
- package/lib/optional-import.js +12 -8
- package/lib/plugin-loader.js +7 -3
- package/lib/port-resolver.js +4 -4
- package/lib/progress.js +2 -2
- package/lib/prompt/index.js +5 -1
- package/lib/prompt/types/file-path.js +1 -1
- package/lib/pull/features/apig.js +9 -9
- package/lib/pull/features/client.js +7 -7
- package/lib/pull/features/functions/index.js +14 -14
- package/lib/pull/features/index.js +5 -1
- package/lib/pull/index.js +4 -4
- package/lib/repl-server.js +2 -2
- package/lib/serve/features/apig.js +1 -1
- package/lib/serve/features/index.js +8 -4
- package/lib/serve/index.js +15 -11
- package/lib/serve/server/index.js +43 -27
- package/lib/serve/server/lib/java/JavaaioServer.java +2 -1
- package/lib/serve/server/lib/java/lib/catalyst-cli-java-runtime-1.0.0.jar +0 -0
- package/lib/serve/server/lib/java/lib/catalyst-java-runtime-1.0.0.jar +0 -0
- package/lib/serve/server/lib/java/lib/zip4j-2.5.0.jar +0 -0
- package/lib/serve/server/lib/master.js +26 -15
- package/lib/serve/server/lib/node.js +7 -3
- package/lib/serve/server/lib/web_client/index.js +3 -3
- package/lib/serve/server/lib/web_client/server.js +17 -17
- package/lib/shell/dependencies/http-functions.js +40 -34
- package/lib/shell/dependencies/invoker/bio/java/JavabioInvoker.java +13 -1
- package/lib/shell/dependencies/invoker/cron/java/JavacronInvoker.java +13 -2
- package/lib/shell/dependencies/invoker/event/java/JavaeventInvoker.java +13 -2
- package/lib/shell/dependencies/invoker/integ/java/JavaintegInvoker.java +13 -2
- package/lib/shell/dependencies/invoker/integ/node.js +8 -4
- package/lib/shell/dependencies/local-function.js +44 -40
- package/lib/shell/index.js +12 -12
- package/lib/shell/prepare/index.js +2 -2
- package/lib/shell/prepare/languages/index.js +5 -1
- package/lib/shell/prepare/languages/java.js +1 -1
- package/lib/throbber/index.js +17 -17
- package/lib/throbber/utils.js +9 -9
- package/lib/track.js +7 -7
- package/lib/util_modules/config/index.js +5 -1
- package/lib/util_modules/constants/lib/auth.js +6 -6
- package/lib/util_modules/constants/lib/cliq-handlers.js +2 -2
- package/lib/util_modules/constants/lib/scopes.js +1 -0
- package/lib/util_modules/constants/lib/template.js +21 -21
- package/lib/util_modules/constants/lib/urls.js +11 -11
- package/lib/util_modules/context-help.js +15 -15
- package/lib/util_modules/fs/index.js +5 -1
- package/lib/util_modules/fs/lib/async.js +4 -4
- package/lib/util_modules/fs/utils.js +1 -1
- package/lib/util_modules/logger.js +2 -2
- package/lib/util_modules/parser/toml.js +1 -1
- package/lib/util_modules/project.js +6 -6
- package/lib/util_modules/shell.js +4 -4
- package/lib/winston.js +5 -5
- package/package.json +39 -39
- package/scripts/postInstall.js +7 -6
- package/docs/.DS_Store +0 -0
- package/lib/serve/server/lib/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
|
@@ -31,21 +31,22 @@ const logger_2 = require("../../util_modules/logger");
|
|
|
31
31
|
const project_2 = require("../../util_modules/project");
|
|
32
32
|
const shell_1 = require("../../util_modules/shell");
|
|
33
33
|
const logUrl = (name, pthName, httpPort, masterPort) => {
|
|
34
|
-
logger_2.labeled(`functions(${name})`, 'URL => http://localhost:' + (masterPort === -1 ? httpPort : masterPort) + pthName).MESSAGE();
|
|
34
|
+
(0, logger_2.labeled)(`functions(${name})`, 'URL => http://localhost:' + (masterPort === -1 ? httpPort : masterPort) + pthName).MESSAGE();
|
|
35
35
|
};
|
|
36
36
|
class HttpFunctions {
|
|
37
|
-
constructor(repl) {
|
|
37
|
+
constructor({ repl, primary = true } = {}) {
|
|
38
38
|
this.repl = repl;
|
|
39
|
-
this.app = express_1.default();
|
|
39
|
+
this.app = (0, express_1.default)();
|
|
40
|
+
this.app.locals.primary = primary;
|
|
40
41
|
this.nodeInvoker = {
|
|
41
|
-
[constants_1.FN_TYPE.basic]: path_1.normalize(path_1.join(__dirname, './invoker', constants_1.FN_TYPE.basic, 'node.js'))
|
|
42
|
+
[constants_1.FN_TYPE.basic]: (0, path_1.normalize)((0, path_1.join)(__dirname, './invoker', constants_1.FN_TYPE.basic, 'node.js'))
|
|
42
43
|
};
|
|
43
44
|
this.javaInvoker = {
|
|
44
|
-
[constants_1.FN_TYPE.basic]: path_1.join(runtime_store_1.default.get('cwd'), '.build', '.catalyst', 'Java' + constants_1.FN_TYPE.basic + 'Invoker')
|
|
45
|
+
[constants_1.FN_TYPE.basic]: (0, path_1.join)(runtime_store_1.default.get('cwd'), '.build', '.catalyst', 'Java' + constants_1.FN_TYPE.basic + 'Invoker')
|
|
45
46
|
};
|
|
46
|
-
this.requestFile = path_1.join(runtime_store_1.default.get('cwd'), '.build', '.catalyst', 'user_req_body');
|
|
47
|
-
this.responseFile = path_1.join(runtime_store_1.default.get('cwd'), '.build', '.catalyst', 'user_res_body');
|
|
48
|
-
this.metaFile = path_1.join(runtime_store_1.default.get('cwd'), '.build', '.catalyst', 'user_meta.json');
|
|
47
|
+
this.requestFile = (0, path_1.join)(runtime_store_1.default.get('cwd'), '.build', '.catalyst', 'user_req_body');
|
|
48
|
+
this.responseFile = (0, path_1.join)(runtime_store_1.default.get('cwd'), '.build', '.catalyst', 'user_res_body');
|
|
49
|
+
this.metaFile = (0, path_1.join)(runtime_store_1.default.get('cwd'), '.build', '.catalyst', 'user_meta.json');
|
|
49
50
|
this.runningSlaves = [];
|
|
50
51
|
this.targets = [];
|
|
51
52
|
this.q = new better_queue_1.default((opts, cb) => {
|
|
@@ -61,25 +62,26 @@ class HttpFunctions {
|
|
|
61
62
|
'content-length': opts.req.headers['content-length']
|
|
62
63
|
}
|
|
63
64
|
}));
|
|
64
|
-
const slave = shell_1.spawn(opts.command, opts.options, {
|
|
65
|
+
const slave = (0, shell_1.spawn)(opts.command, opts.options, {
|
|
65
66
|
cwd: opts.pth,
|
|
66
67
|
stdio: 'pipe',
|
|
67
68
|
env: {
|
|
68
69
|
X_ZOHO_CATALYST_IS_LOCAL: 'true',
|
|
70
|
+
X_ZOHO_CATALYST_FUNCTION_LOADED: 'true',
|
|
69
71
|
X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth,
|
|
70
72
|
X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin
|
|
71
73
|
}
|
|
72
74
|
}).RAW();
|
|
73
75
|
(_a = slave.stdout) === null || _a === void 0 ? void 0 : _a.on('data', (data) => {
|
|
74
|
-
logger_2.info(Buffer.isBuffer(data) ? data.toString() : data);
|
|
76
|
+
(0, logger_2.info)(Buffer.isBuffer(data) ? data.toString() : data);
|
|
75
77
|
});
|
|
76
78
|
(_b = slave.stderr) === null || _b === void 0 ? void 0 : _b.on('data', (data) => {
|
|
77
79
|
const errorStr = data.toString().trim();
|
|
78
|
-
logger_2.info(errorStr);
|
|
80
|
+
(0, logger_2.info)(errorStr);
|
|
79
81
|
});
|
|
80
82
|
slave.on('uncaughtException', (err, origin) => {
|
|
81
83
|
const errorString = `Caught exception: ${err}\n` + `Exception origin: ${origin}`;
|
|
82
|
-
logger_2.error(errorString);
|
|
84
|
+
(0, logger_2.error)(errorString);
|
|
83
85
|
cb(errorString, null);
|
|
84
86
|
});
|
|
85
87
|
slave.on('exit', (code) => {
|
|
@@ -112,20 +114,22 @@ class HttpFunctions {
|
|
|
112
114
|
const httpPort = parseInt(runtime_store_1.default.get('context.port.http.' + constants_1.REMOTE_REF.functions.type[constants_1.FN_TYPE.basic]), 10);
|
|
113
115
|
if (this.repl !== undefined) {
|
|
114
116
|
this.app.use((_req, _res, next) => {
|
|
115
|
-
shell_1.clearLine(process.stdout);
|
|
117
|
+
(0, shell_1.clearLine)(process.stdout);
|
|
116
118
|
next();
|
|
117
119
|
});
|
|
118
120
|
}
|
|
119
|
-
this.app.
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
121
|
+
if (this.app.locals.primary) {
|
|
122
|
+
this.app.use(logger_1.default);
|
|
123
|
+
this.app.use(cookie_parser_1.default);
|
|
124
|
+
this.app.use((0, project_1.default)({
|
|
125
|
+
id: (0, project_2.getProjectId)(),
|
|
126
|
+
domain_prefix: (0, project_2.getDomainPrefix)(),
|
|
127
|
+
domain: constants_1.ORIGIN.app.replace('https://', ''),
|
|
128
|
+
key: (0, project_2.getDomainKey)(),
|
|
129
|
+
env_name: (0, project_2.getEnvName)()
|
|
130
|
+
}));
|
|
131
|
+
this.app.use(authenticator_1.default);
|
|
132
|
+
}
|
|
129
133
|
const reqHandler = (fnTarget) => (request, response, next) => {
|
|
130
134
|
var _a, _b;
|
|
131
135
|
const urlParts = new url_1.URL(request.originalUrl, request.protocol + '://' + request.get('host')).searchParams;
|
|
@@ -155,9 +159,10 @@ class HttpFunctions {
|
|
|
155
159
|
'x-zc-user-cred-token': request.headers['x-zc-user-cred-token'],
|
|
156
160
|
'x-zc-admin-cred-type': request.headers['x-zc-admin-cred-type'],
|
|
157
161
|
'x-zc-admin-cred-token': request.headers['x-zc-admin-cred-token'],
|
|
158
|
-
'x-zc-cookie': request.headers['x-zc-cookie']
|
|
162
|
+
'x-zc-cookie': request.headers['x-zc-cookie'],
|
|
163
|
+
'x-zc-user-type': request.headers['x-zc-user-type']
|
|
159
164
|
}));
|
|
160
|
-
slaveOptions.push(JSON.stringify(path_1.join(runtime_store_1.default.get('cwd'), '.build')));
|
|
165
|
+
slaveOptions.push(JSON.stringify((0, path_1.join)(runtime_store_1.default.get('cwd'), '.build')));
|
|
161
166
|
slave = this.q.push({
|
|
162
167
|
command: 'node',
|
|
163
168
|
options: slaveOptions,
|
|
@@ -167,18 +172,18 @@ class HttpFunctions {
|
|
|
167
172
|
});
|
|
168
173
|
}
|
|
169
174
|
else if ((_b = fnTarget.stack) === null || _b === void 0 ? void 0 : _b.startsWith(runtime_1.default.language.java)) {
|
|
170
|
-
const javaInvokerDir = path_1.parse(this.javaInvoker[fnTarget.type]).dir;
|
|
175
|
+
const javaInvokerDir = (0, path_1.parse)(this.javaInvoker[fnTarget.type]).dir;
|
|
171
176
|
slaveOptions.push('-cp');
|
|
172
177
|
slaveOptions.push(javaInvokerDir +
|
|
173
178
|
fn_utils_1.fnUtils.java.classPathSep +
|
|
174
|
-
path_1.join(javaInvokerDir, 'lib', '*'));
|
|
179
|
+
(0, path_1.join)(javaInvokerDir, 'lib', '*'));
|
|
175
180
|
if (debugPort !== -1) {
|
|
176
181
|
slaveOptions.push('-Xdebug');
|
|
177
182
|
slaveOptions.push('-Xrunjdwp:transport=dt_socket,address=' +
|
|
178
183
|
debugPort +
|
|
179
184
|
',server=y,suspend=y');
|
|
180
185
|
}
|
|
181
|
-
slaveOptions.push(path_1.basename(this.javaInvoker[fnTarget.type]));
|
|
186
|
+
slaveOptions.push((0, path_1.basename)(this.javaInvoker[fnTarget.type]));
|
|
182
187
|
slaveOptions.push(javaInvokerDir);
|
|
183
188
|
slaveOptions.push(JSON.stringify(fnTarget));
|
|
184
189
|
slaveOptions.push(query);
|
|
@@ -193,7 +198,8 @@ class HttpFunctions {
|
|
|
193
198
|
'x-zc-user-cred-token': request.headers['x-zc-user-cred-token'],
|
|
194
199
|
'x-zc-admin-cred-type': request.headers['x-zc-admin-cred-type'],
|
|
195
200
|
'x-zc-admin-cred-token': request.headers['x-zc-admin-cred-token'],
|
|
196
|
-
'x-zc-cookie': request.headers['x-zc-cookie']
|
|
201
|
+
'x-zc-cookie': request.headers['x-zc-cookie'],
|
|
202
|
+
'x-zc-user-type': request.headers['x-zc-user-type']
|
|
197
203
|
}));
|
|
198
204
|
slave = this.q.push({
|
|
199
205
|
command: 'java',
|
|
@@ -233,7 +239,7 @@ class HttpFunctions {
|
|
|
233
239
|
}
|
|
234
240
|
});
|
|
235
241
|
};
|
|
236
|
-
shell_1.clearLine(process.stdout);
|
|
242
|
+
(0, shell_1.clearLine)(process.stdout);
|
|
237
243
|
const masterPort = runtime_store_1.default.get(`context.port.http.master`, -1);
|
|
238
244
|
const fnTargets = runtime_store_1.default.get('context.functions.targets', []);
|
|
239
245
|
fnTargets
|
|
@@ -245,7 +251,7 @@ class HttpFunctions {
|
|
|
245
251
|
.forEach((t) => {
|
|
246
252
|
var _a;
|
|
247
253
|
if ((_a = t.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.java)) {
|
|
248
|
-
fn_utils_1.fnUtils.java.ensureJavaInvoker(this.javaInvoker[t.type], path_1.normalize(path_1.join(__dirname, './invoker', t.type, 'java', 'Java' + t.type + 'Invoker.java')));
|
|
254
|
+
fn_utils_1.fnUtils.java.ensureJavaInvoker(this.javaInvoker[t.type], (0, path_1.normalize)((0, path_1.join)(__dirname, './invoker', t.type, 'java', 'Java' + t.type + 'Invoker.java')));
|
|
249
255
|
}
|
|
250
256
|
const pthName = new url_1.URL(t.url).pathname;
|
|
251
257
|
if (pthName !== null) {
|
|
@@ -269,7 +275,7 @@ class HttpFunctions {
|
|
|
269
275
|
}
|
|
270
276
|
});
|
|
271
277
|
(_b = target.watcher) === null || _b === void 0 ? void 0 : _b.on('compiled', () => {
|
|
272
|
-
logger_2.labeled(`functions(${target.name})`, 'ready!').MESSAGE();
|
|
278
|
+
(0, logger_2.labeled)(`functions(${target.name})`, 'ready!').MESSAGE();
|
|
273
279
|
logUrl(target.name, new url_1.URL(target.url).pathname, httpPort, masterPort);
|
|
274
280
|
if (this.repl && this.repl.paused) {
|
|
275
281
|
this.repl.resume();
|
|
@@ -292,7 +298,7 @@ class HttpFunctions {
|
|
|
292
298
|
start() {
|
|
293
299
|
return __awaiter(this, void 0, void 0, function* () {
|
|
294
300
|
const server = yield this._spinUpServer();
|
|
295
|
-
logger_2.info();
|
|
301
|
+
(0, logger_2.info)();
|
|
296
302
|
server.on('connection', (socket) => {
|
|
297
303
|
socket.unref();
|
|
298
304
|
});
|
|
@@ -310,7 +316,7 @@ class HttpFunctions {
|
|
|
310
316
|
yield Promise.all(this.targets.map((target) => __awaiter(this, void 0, void 0, function* () { var _a; return (_a = target.watcher) === null || _a === void 0 ? void 0 : _a.close(); })));
|
|
311
317
|
if (HttpFunctions.server !== null) {
|
|
312
318
|
HttpFunctions.server.close((err) => {
|
|
313
|
-
logger_2.debug(err);
|
|
319
|
+
(0, logger_2.debug)(err);
|
|
314
320
|
res();
|
|
315
321
|
});
|
|
316
322
|
}
|
|
@@ -18,6 +18,7 @@ import java.util.logging.Handler;
|
|
|
18
18
|
import java.util.logging.LogManager;
|
|
19
19
|
import java.util.logging.LogRecord;
|
|
20
20
|
import java.util.logging.Logger;
|
|
21
|
+
import java.util.logging.SimpleFormatter;
|
|
21
22
|
|
|
22
23
|
import org.json.JSONException;
|
|
23
24
|
import org.json.JSONObject;
|
|
@@ -41,7 +42,7 @@ public class JavabioInvoker {
|
|
|
41
42
|
if (record.getThrown() != null) {
|
|
42
43
|
exceptionMessage = getStackTraceAsString(record.getThrown());
|
|
43
44
|
}
|
|
44
|
-
String message =
|
|
45
|
+
String message = new SimpleFormatter().format(record) + " " + exceptionMessage;
|
|
45
46
|
if (message.length() > MESSAGE_LENGTH) {
|
|
46
47
|
message = message.substring(0, MESSAGE_LENGTH);
|
|
47
48
|
}
|
|
@@ -164,13 +165,24 @@ public class JavabioInvoker {
|
|
|
164
165
|
|
|
165
166
|
clientAuth.put((userAuthHeaderType.equals("token")) ? "access_token" : "ticket", userAuthToken); // No I18N
|
|
166
167
|
}
|
|
168
|
+
if(auth.containsKey("x-zc-user-type")) { // No I18N
|
|
169
|
+
String userType = auth.get("x-zc-user-type").toString(); // No I18N
|
|
170
|
+
clientAuth.put("user_type", userType); // No I18N
|
|
171
|
+
}
|
|
172
|
+
if (auth.containsKey("x-zc-cookie")) {
|
|
173
|
+
String cookie = auth.get("x-zc-cookie").toString();
|
|
174
|
+
clientAuth.put("cookie", cookie);
|
|
175
|
+
}
|
|
167
176
|
catalystAuth.put("client_cred", clientAuth);
|
|
168
177
|
|
|
169
178
|
ZCThreadLocal.putValue("CATALYST_AUTH", catalystAuth.toString()); // No I18N
|
|
179
|
+
|
|
180
|
+
// For backward compatibility, to be remove in future.
|
|
170
181
|
if(auth.containsKey("x-zc-cookie")) {
|
|
171
182
|
String cookie = auth.get("x-zc-cookie").toString();
|
|
172
183
|
ZCThreadLocal.putValue("client_cookie", cookie); // No I18N
|
|
173
184
|
}
|
|
185
|
+
// to be removed in future
|
|
174
186
|
}
|
|
175
187
|
|
|
176
188
|
public static void main(String[] args) {
|
|
@@ -18,6 +18,7 @@ import java.util.logging.Handler;
|
|
|
18
18
|
import java.util.logging.LogManager;
|
|
19
19
|
import java.util.logging.LogRecord;
|
|
20
20
|
import java.util.logging.Logger;
|
|
21
|
+
import java.util.logging.SimpleFormatter;
|
|
21
22
|
|
|
22
23
|
import org.json.JSONException;
|
|
23
24
|
import org.json.JSONObject;
|
|
@@ -42,7 +43,7 @@ public class JavacronInvoker {
|
|
|
42
43
|
if (record.getThrown() != null) {
|
|
43
44
|
exceptionMessage = getStackTraceAsString(record.getThrown());
|
|
44
45
|
}
|
|
45
|
-
String message =
|
|
46
|
+
String message = new SimpleFormatter().format(record) + " " + exceptionMessage;
|
|
46
47
|
if (message.length() > MESSAGE_LENGTH) {
|
|
47
48
|
message = message.substring(0, MESSAGE_LENGTH);
|
|
48
49
|
}
|
|
@@ -139,13 +140,23 @@ public class JavacronInvoker {
|
|
|
139
140
|
|
|
140
141
|
clientAuth.put((userAuthHeaderType.equals("token")) ? "access_token" : "ticket", userAuthToken); // No I18N
|
|
141
142
|
}
|
|
143
|
+
if(auth.containsKey("x-zc-user-type")) { // No I18N
|
|
144
|
+
String userType = auth.get("x-zc-user-type").toString(); // No I18N
|
|
145
|
+
clientAuth.put("user_type", userType); // No I18N
|
|
146
|
+
}
|
|
147
|
+
if (auth.containsKey("x-zc-cookie")) {
|
|
148
|
+
String cookie = auth.get("x-zc-cookie").toString();
|
|
149
|
+
clientAuth.put("cookie", cookie);
|
|
150
|
+
}
|
|
142
151
|
catalystAuth.put("client_cred", clientAuth);
|
|
143
|
-
|
|
144
152
|
ZCThreadLocal.putValue("CATALYST_AUTH", catalystAuth.toString()); // No I18N
|
|
153
|
+
|
|
154
|
+
// For backward compatibility, to be remove in future.
|
|
145
155
|
if(auth.containsKey("x-zc-cookie")) {
|
|
146
156
|
String cookie = auth.get("x-zc-cookie").toString();
|
|
147
157
|
ZCThreadLocal.putValue("client_cookie", cookie); // No I18N
|
|
148
158
|
}
|
|
159
|
+
// to be removed in future
|
|
149
160
|
}
|
|
150
161
|
|
|
151
162
|
public static void main(String[] args) {
|
|
@@ -18,6 +18,7 @@ import java.util.logging.Handler;
|
|
|
18
18
|
import java.util.logging.LogManager;
|
|
19
19
|
import java.util.logging.LogRecord;
|
|
20
20
|
import java.util.logging.Logger;
|
|
21
|
+
import java.util.logging.SimpleFormatter;
|
|
21
22
|
|
|
22
23
|
import org.json.JSONException;
|
|
23
24
|
import org.json.JSONObject;
|
|
@@ -42,7 +43,7 @@ public class JavaeventInvoker {
|
|
|
42
43
|
if (record.getThrown() != null) {
|
|
43
44
|
exceptionMessage = getStackTraceAsString(record.getThrown());
|
|
44
45
|
}
|
|
45
|
-
String message =
|
|
46
|
+
String message = new SimpleFormatter().format(record) + " " + exceptionMessage;
|
|
46
47
|
if (message.length() > MESSAGE_LENGTH) {
|
|
47
48
|
message = message.substring(0, MESSAGE_LENGTH);
|
|
48
49
|
}
|
|
@@ -139,13 +140,23 @@ public class JavaeventInvoker {
|
|
|
139
140
|
|
|
140
141
|
clientAuth.put((userAuthHeaderType.equals("token")) ? "access_token" : "ticket", userAuthToken); // No I18N
|
|
141
142
|
}
|
|
143
|
+
if(auth.containsKey("x-zc-user-type")) { // No I18N
|
|
144
|
+
String userType = auth.get("x-zc-user-type").toString(); // No I18N
|
|
145
|
+
clientAuth.put("user_type", userType); // No I18N
|
|
146
|
+
}
|
|
147
|
+
if (auth.containsKey("x-zc-cookie")) {
|
|
148
|
+
String cookie = auth.get("x-zc-cookie").toString();
|
|
149
|
+
clientAuth.put("cookie", cookie);
|
|
150
|
+
}
|
|
142
151
|
catalystAuth.put("client_cred", clientAuth);
|
|
143
|
-
|
|
144
152
|
ZCThreadLocal.putValue("CATALYST_AUTH", catalystAuth.toString()); // No I18N
|
|
153
|
+
|
|
154
|
+
// For backward compatibility, to be remove in future.
|
|
145
155
|
if(auth.containsKey("x-zc-cookie")) {
|
|
146
156
|
String cookie = auth.get("x-zc-cookie").toString();
|
|
147
157
|
ZCThreadLocal.putValue("client_cookie", cookie); // No I18N
|
|
148
158
|
}
|
|
159
|
+
// to be removed in future
|
|
149
160
|
}
|
|
150
161
|
|
|
151
162
|
public static void main(String[] args) {
|
|
@@ -18,6 +18,7 @@ import java.util.logging.Handler;
|
|
|
18
18
|
import java.util.logging.LogManager;
|
|
19
19
|
import java.util.logging.LogRecord;
|
|
20
20
|
import java.util.logging.Logger;
|
|
21
|
+
import java.util.logging.SimpleFormatter;
|
|
21
22
|
|
|
22
23
|
import org.json.JSONException;
|
|
23
24
|
import org.json.JSONObject;
|
|
@@ -39,7 +40,7 @@ public class JavaintegInvoker {
|
|
|
39
40
|
if (record.getThrown() != null) {
|
|
40
41
|
exceptionMessage = getStackTraceAsString(record.getThrown());
|
|
41
42
|
}
|
|
42
|
-
String message =
|
|
43
|
+
String message = new SimpleFormatter().format(record) + " " + exceptionMessage;
|
|
43
44
|
if (message.length() > MESSAGE_LENGTH) {
|
|
44
45
|
message = message.substring(0, MESSAGE_LENGTH);
|
|
45
46
|
}
|
|
@@ -140,13 +141,23 @@ public class JavaintegInvoker {
|
|
|
140
141
|
|
|
141
142
|
clientAuth.put((userAuthHeaderType.equals("token")) ? "access_token" : "ticket", userAuthToken); // No I18N
|
|
142
143
|
}
|
|
144
|
+
if(auth.containsKey("x-zc-user-type")) { // No I18N
|
|
145
|
+
String userType = auth.get("x-zc-user-type").toString(); // No I18N
|
|
146
|
+
clientAuth.put("user_type", userType); // No I18N
|
|
147
|
+
}
|
|
148
|
+
if (auth.containsKey("x-zc-cookie")) {
|
|
149
|
+
String cookie = auth.get("x-zc-cookie").toString();
|
|
150
|
+
clientAuth.put("cookie", cookie);
|
|
151
|
+
}
|
|
143
152
|
catalystAuth.put("client_cred", clientAuth);
|
|
144
|
-
|
|
145
153
|
ZCThreadLocal.putValue("CATALYST_AUTH", catalystAuth.toString()); // No I18N
|
|
154
|
+
|
|
155
|
+
// For backward compatibility, to be remove in future.
|
|
146
156
|
if (auth.containsKey("x-zc-cookie")) {
|
|
147
157
|
String cookie = auth.get("x-zc-cookie").toString();
|
|
148
158
|
ZCThreadLocal.putValue("client_cookie", cookie); // No I18N
|
|
149
159
|
}
|
|
160
|
+
// to be removed in future
|
|
150
161
|
}
|
|
151
162
|
|
|
152
163
|
public static void main(String[] args) {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -28,9 +32,9 @@ const data = JSON.parse(args[1]);
|
|
|
28
32
|
const projectJson = JSON.parse(args[2]);
|
|
29
33
|
const authJson = JSON.parse(args[3]);
|
|
30
34
|
const buildDir = JSON.parse(args[4]);
|
|
31
|
-
const responseFile = path_1.join(buildDir, '.catalyst', 'user_res_body');
|
|
35
|
+
const responseFile = (0, path_1.join)(buildDir, '.catalyst', 'user_res_body');
|
|
32
36
|
const writeAndExit = (resp, exitCode = 0) => {
|
|
33
|
-
fs_1.writeFileSync(responseFile, JSON.stringify(resp));
|
|
37
|
+
(0, fs_1.writeFileSync)(responseFile, JSON.stringify(resp));
|
|
34
38
|
process.exit(exitCode);
|
|
35
39
|
};
|
|
36
40
|
const integrationRequest = data || {};
|
|
@@ -71,5 +75,5 @@ try {
|
|
|
71
75
|
}
|
|
72
76
|
catch (e) {
|
|
73
77
|
console.error(e);
|
|
74
|
-
writeAndExit({ error: util_1.inspect(e) }, 2);
|
|
78
|
+
writeAndExit({ error: (0, util_1.inspect)(e) }, 2);
|
|
75
79
|
}
|
|
@@ -34,13 +34,13 @@ class LocalFunction {
|
|
|
34
34
|
this.watcher = target.watcher;
|
|
35
35
|
this.target = js_1.JS.omit(target, ['zip_stream', 'watcher']);
|
|
36
36
|
this.slave = null;
|
|
37
|
-
this.nodeInvoker = path_1.normalize(path_1.join(__dirname, './invoker', target.type, 'node.js'));
|
|
38
|
-
this.javaInvoker = path_1.join(runtime_store_1.default.get('cwd'), '.build', '.catalyst', 'Java' + target.type + 'Invoker');
|
|
37
|
+
this.nodeInvoker = (0, path_1.normalize)((0, path_1.join)(__dirname, './invoker', target.type, 'node.js'));
|
|
38
|
+
this.javaInvoker = (0, path_1.join)(runtime_store_1.default.get('cwd'), '.build', '.catalyst', 'Java' + target.type + 'Invoker');
|
|
39
39
|
if ((_a = target.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.java)) {
|
|
40
|
-
fn_utils_1.fnUtils.java.ensureJavaInvoker(this.javaInvoker, path_1.normalize(path_1.join(__dirname, './invoker', target.type, 'java', 'Java' + target.type + 'Invoker.java')));
|
|
40
|
+
fn_utils_1.fnUtils.java.ensureJavaInvoker(this.javaInvoker, (0, path_1.normalize)((0, path_1.join)(__dirname, './invoker', target.type, 'java', 'Java' + target.type + 'Invoker.java')));
|
|
41
41
|
}
|
|
42
|
-
this.responseFile = path_1.join(runtime_store_1.default.get('cwd'), '.build', '.catalyst', 'user_res_body');
|
|
43
|
-
this.metaFile = path_1.join(runtime_store_1.default.get('cwd'), '.build', '.catalyst', 'user_meta.json');
|
|
42
|
+
this.responseFile = (0, path_1.join)(runtime_store_1.default.get('cwd'), '.build', '.catalyst', 'user_res_body');
|
|
43
|
+
this.metaFile = (0, path_1.join)(runtime_store_1.default.get('cwd'), '.build', '.catalyst', 'user_meta.json');
|
|
44
44
|
this.call = this._call.bind(this);
|
|
45
45
|
(_b = this.watcher) === null || _b === void 0 ? void 0 : _b.on('preparing', () => {
|
|
46
46
|
if (!this.repl.paused) {
|
|
@@ -48,7 +48,7 @@ class LocalFunction {
|
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
(_c = this.watcher) === null || _c === void 0 ? void 0 : _c.on('compiled', () => {
|
|
51
|
-
logger_1.labeled(`functions(${target.name})`, 'ready!').MESSAGE();
|
|
51
|
+
(0, logger_1.labeled)(`functions(${target.name})`, 'ready!').MESSAGE();
|
|
52
52
|
if (this.repl.paused) {
|
|
53
53
|
repl.resume();
|
|
54
54
|
repl.showPrompt();
|
|
@@ -64,7 +64,7 @@ class LocalFunction {
|
|
|
64
64
|
try {
|
|
65
65
|
data = JSON.stringify(rawData);
|
|
66
66
|
if (!data.startsWith('{') || !data.endsWith('}')) {
|
|
67
|
-
const content = fs_1.SYNC.readFile(path_1.resolve(runtime_store_1.default.get('cwd'), data.slice(1, data.length - 1)));
|
|
67
|
+
const content = fs_1.SYNC.readFile((0, path_1.resolve)(runtime_store_1.default.get('cwd'), data.slice(1, data.length - 1)));
|
|
68
68
|
if (content === undefined) {
|
|
69
69
|
return new error_1.default('content is undefined for provided file path');
|
|
70
70
|
}
|
|
@@ -72,12 +72,12 @@ class LocalFunction {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
catch (e) {
|
|
75
|
-
logger_1.info('the input must be in the form of json or a path to a file containing json data.');
|
|
75
|
+
(0, logger_1.info)('the input must be in the form of json or a path to a file containing json data.');
|
|
76
76
|
return new error_1.default('Invalid input');
|
|
77
77
|
}
|
|
78
78
|
if (this.target.type === constants_1.FN_TYPE.event && !data.includes('event_bus_details')) {
|
|
79
|
-
logger_1.info('For event function kindly use event:generate command to generate the input json.');
|
|
80
|
-
logger_1.info('You can also provide event details as per documentation.');
|
|
79
|
+
(0, logger_1.info)('For event function kindly use event:generate command to generate the input json.');
|
|
80
|
+
(0, logger_1.info)('You can also provide event details as per documentation.');
|
|
81
81
|
return new error_1.default('Event bus details missing');
|
|
82
82
|
}
|
|
83
83
|
return (() => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -95,57 +95,61 @@ class LocalFunction {
|
|
|
95
95
|
slaveOptions.push(JSON.stringify(this.target));
|
|
96
96
|
slaveOptions.push(data);
|
|
97
97
|
slaveOptions.push(JSON.stringify({
|
|
98
|
-
'x-zc-projectid': project_1.getProjectId(),
|
|
99
|
-
'x-zc-project-domain': project_1.getDomainPrefix() + '.' + constants_1.ORIGIN.app.replace('https://', ''),
|
|
100
|
-
'x-zc-project-key': project_1.getDomainKey(),
|
|
101
|
-
'x-zc-environment': project_1.getEnvName()
|
|
98
|
+
'x-zc-projectid': (0, project_1.getProjectId)(),
|
|
99
|
+
'x-zc-project-domain': (0, project_1.getDomainPrefix)() + '.' + constants_1.ORIGIN.app.replace('https://', ''),
|
|
100
|
+
'x-zc-project-key': (0, project_1.getDomainKey)(),
|
|
101
|
+
'x-zc-environment': (0, project_1.getEnvName)()
|
|
102
102
|
}));
|
|
103
103
|
slaveOptions.push(JSON.stringify({
|
|
104
104
|
'x-zc-user-cred-type': 'token',
|
|
105
105
|
'x-zc-user-cred-token': accessToken,
|
|
106
106
|
'x-zc-admin-cred-type': 'token',
|
|
107
|
-
'x-zc-admin-cred-token': accessToken
|
|
107
|
+
'x-zc-admin-cred-token': accessToken,
|
|
108
|
+
'x-zc-user-type': 'admin'
|
|
108
109
|
}));
|
|
109
|
-
slaveOptions.push(JSON.stringify(path_1.join(runtime_store_1.default.get('cwd'), '.build')));
|
|
110
|
-
this.slave = shell_1.spawn('node', slaveOptions, {
|
|
110
|
+
slaveOptions.push(JSON.stringify((0, path_1.join)(runtime_store_1.default.get('cwd'), '.build')));
|
|
111
|
+
this.slave = (0, shell_1.spawn)('node', slaveOptions, {
|
|
111
112
|
cwd: this.target.source,
|
|
112
113
|
stdio: 'pipe',
|
|
113
114
|
env: {
|
|
114
115
|
X_ZOHO_CATALYST_IS_LOCAL: 'true',
|
|
116
|
+
X_ZOHO_CATALYST_FUNCTION_LOADED: 'true',
|
|
115
117
|
X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth,
|
|
116
118
|
X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin
|
|
117
119
|
}
|
|
118
120
|
}).RAW();
|
|
119
121
|
}
|
|
120
122
|
else if ((_b = this.target.stack) === null || _b === void 0 ? void 0 : _b.startsWith(runtime_1.default.language.java)) {
|
|
121
|
-
const javaInvokerDir = path_1.parse(this.javaInvoker).dir;
|
|
123
|
+
const javaInvokerDir = (0, path_1.parse)(this.javaInvoker).dir;
|
|
122
124
|
slaveOptions.push('-cp');
|
|
123
|
-
slaveOptions.push(javaInvokerDir + fn_utils_1.fnUtils.java.classPathSep + path_1.join(javaInvokerDir, 'lib', '*'));
|
|
125
|
+
slaveOptions.push(javaInvokerDir + fn_utils_1.fnUtils.java.classPathSep + (0, path_1.join)(javaInvokerDir, 'lib', '*'));
|
|
124
126
|
if (debugPort !== null) {
|
|
125
127
|
slaveOptions.push('-Xdebug');
|
|
126
128
|
slaveOptions.push('-Xrunjdwp:transport=dt_socket,address=' + debugPort + ',server=y,suspend=y');
|
|
127
129
|
}
|
|
128
|
-
slaveOptions.push(path_1.basename(this.javaInvoker));
|
|
130
|
+
slaveOptions.push((0, path_1.basename)(this.javaInvoker));
|
|
129
131
|
slaveOptions.push(javaInvokerDir);
|
|
130
132
|
slaveOptions.push(JSON.stringify(this.target));
|
|
131
133
|
slaveOptions.push(data);
|
|
132
134
|
slaveOptions.push(JSON.stringify({
|
|
133
|
-
'x-zc-projectid': project_1.getProjectId(),
|
|
134
|
-
'x-zc-project-domain': project_1.getDomainPrefix() + '.' + constants_1.ORIGIN.app.replace('https://', ''),
|
|
135
|
-
'x-zc-project-key': project_1.getDomainKey(),
|
|
136
|
-
'x-zc-environment': project_1.getEnvName()
|
|
135
|
+
'x-zc-projectid': (0, project_1.getProjectId)(),
|
|
136
|
+
'x-zc-project-domain': (0, project_1.getDomainPrefix)() + '.' + constants_1.ORIGIN.app.replace('https://', ''),
|
|
137
|
+
'x-zc-project-key': (0, project_1.getDomainKey)(),
|
|
138
|
+
'x-zc-environment': (0, project_1.getEnvName)()
|
|
137
139
|
}));
|
|
138
140
|
slaveOptions.push(JSON.stringify({
|
|
139
141
|
'x-zc-user-cred-type': 'token',
|
|
140
142
|
'x-zc-user-cred-token': accessToken,
|
|
141
143
|
'x-zc-admin-cred-type': 'token',
|
|
142
|
-
'x-zc-admin-cred-token': accessToken
|
|
144
|
+
'x-zc-admin-cred-token': accessToken,
|
|
145
|
+
'x-zc-user-type': 'admin'
|
|
143
146
|
}));
|
|
144
|
-
this.slave = shell_1.spawn('java', slaveOptions, {
|
|
147
|
+
this.slave = (0, shell_1.spawn)('java', slaveOptions, {
|
|
145
148
|
cwd: this.target.source,
|
|
146
149
|
stdio: 'pipe',
|
|
147
150
|
env: {
|
|
148
151
|
X_ZOHO_CATALYST_IS_LOCAL: 'true',
|
|
152
|
+
X_ZOHO_CATALYST_FUNCTION_LOADED: 'true',
|
|
149
153
|
X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth,
|
|
150
154
|
X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin
|
|
151
155
|
}
|
|
@@ -157,18 +161,18 @@ class LocalFunction {
|
|
|
157
161
|
});
|
|
158
162
|
}
|
|
159
163
|
(_c = this.slave.stdout) === null || _c === void 0 ? void 0 : _c.on('data', (message) => {
|
|
160
|
-
shell_1.clearLine(process.stdout);
|
|
161
|
-
logger_1.info(message.toString());
|
|
164
|
+
(0, shell_1.clearLine)(process.stdout);
|
|
165
|
+
(0, logger_1.info)(message.toString());
|
|
162
166
|
});
|
|
163
167
|
(_d = this.slave.stderr) === null || _d === void 0 ? void 0 : _d.on('data', (message) => {
|
|
164
168
|
const errorStr = js_1.JS.trim(message.toString());
|
|
165
|
-
shell_1.clearLine(process.stdout);
|
|
166
|
-
logger_1.info(errorStr);
|
|
169
|
+
(0, shell_1.clearLine)(process.stdout);
|
|
170
|
+
(0, logger_1.info)(errorStr);
|
|
167
171
|
});
|
|
168
172
|
this.slave.on('exit', (code) => __awaiter(this, void 0, void 0, function* () {
|
|
169
173
|
if (code !== null && code !== 130) {
|
|
170
|
-
logger_1.info('[cli] Function execution complete');
|
|
171
|
-
logger_1.info();
|
|
174
|
+
(0, logger_1.info)('[cli] Function execution complete');
|
|
175
|
+
(0, logger_1.info)();
|
|
172
176
|
const response = yield fs_1.ASYNC.readFile(this.responseFile);
|
|
173
177
|
let meta;
|
|
174
178
|
try {
|
|
@@ -179,19 +183,19 @@ class LocalFunction {
|
|
|
179
183
|
}
|
|
180
184
|
switch (this.target.type) {
|
|
181
185
|
case constants_1.FN_TYPE.basic:
|
|
182
|
-
logger_1.info('[response]');
|
|
183
|
-
logger_1.info(response);
|
|
184
|
-
logger_1.info('[status]');
|
|
185
|
-
logger_1.info(meta.statusCode || 200);
|
|
186
|
+
(0, logger_1.info)('[response]');
|
|
187
|
+
(0, logger_1.info)(response);
|
|
188
|
+
(0, logger_1.info)('[status]');
|
|
189
|
+
(0, logger_1.info)(meta.statusCode || 200);
|
|
186
190
|
break;
|
|
187
191
|
case constants_1.FN_TYPE.cron:
|
|
188
192
|
case constants_1.FN_TYPE.event:
|
|
189
|
-
logger_1.info('[status]');
|
|
190
|
-
logger_1.info(response);
|
|
193
|
+
(0, logger_1.info)('[status]');
|
|
194
|
+
(0, logger_1.info)(response);
|
|
191
195
|
break;
|
|
192
196
|
case constants_1.FN_TYPE.integration:
|
|
193
|
-
logger_1.info('[response]');
|
|
194
|
-
logger_1.info(response);
|
|
197
|
+
(0, logger_1.info)('[response]');
|
|
198
|
+
(0, logger_1.info)(response);
|
|
195
199
|
break;
|
|
196
200
|
default:
|
|
197
201
|
break;
|
package/lib/shell/index.js
CHANGED
|
@@ -38,19 +38,19 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
38
38
|
if (output instanceof Error) {
|
|
39
39
|
return ansi_colors_1.bold.red('Error: ') + output.message;
|
|
40
40
|
}
|
|
41
|
-
return util_1.inspect(output);
|
|
41
|
+
return (0, util_1.inspect)(output);
|
|
42
42
|
}
|
|
43
43
|
return '';
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
|
-
const httpServer = new http_functions_1.default(replServer);
|
|
46
|
+
const httpServer = new http_functions_1.default({ repl: replServer });
|
|
47
47
|
try {
|
|
48
|
-
yield prepare_1.default([constants_1.FN_TYPE.basic, constants_1.FN_TYPE.cron, constants_1.FN_TYPE.event, constants_1.FN_TYPE.integration]);
|
|
48
|
+
yield (0, prepare_1.default)([constants_1.FN_TYPE.basic, constants_1.FN_TYPE.cron, constants_1.FN_TYPE.event, constants_1.FN_TYPE.integration]);
|
|
49
49
|
const targets = runtime_store_1.default
|
|
50
50
|
.get('context.functions.targets', [])
|
|
51
51
|
.filter((target) => {
|
|
52
52
|
if (!target.valid) {
|
|
53
|
-
logger_js_1.warning('target [' +
|
|
53
|
+
(0, logger_js_1.warning)('target [' +
|
|
54
54
|
target.name +
|
|
55
55
|
'] is not a valid one reason : ' +
|
|
56
56
|
target.failure_reason);
|
|
@@ -64,14 +64,14 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
replServer.start();
|
|
67
|
-
const watchOpt = option_1.getOptionValue('watch');
|
|
67
|
+
const watchOpt = (0, option_1.getOptionValue)('watch');
|
|
68
68
|
if (watchOpt === true) {
|
|
69
|
-
logger_js_1.info();
|
|
70
|
-
logger_js_1.labeled('DEPRECATED', `The ${ansi_colors_1.italic.bold('--watch')} option is deprecated. \nThe watch mode will be enabled by default. If you wish to disable it use the ${ansi_colors_1.italic.bold('--no-watch')} option. \nPlease execute ${ansi_colors_1.bold('catalyst functions:shell ' + ansi_colors_1.italic('--help'))} command for more usage details.`).WARN();
|
|
69
|
+
(0, logger_js_1.info)();
|
|
70
|
+
(0, logger_js_1.labeled)('DEPRECATED', `The ${ansi_colors_1.italic.bold('--watch')} option is deprecated. \nThe watch mode will be enabled by default. If you wish to disable it use the ${ansi_colors_1.italic.bold('--no-watch')} option. \nPlease execute ${(0, ansi_colors_1.bold)('catalyst functions:shell ' + (0, ansi_colors_1.italic)('--help'))} command for more usage details.`).WARN();
|
|
71
71
|
}
|
|
72
72
|
yield Promise.all(targets.map((target) => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
73
|
if (watchOpt !== false) {
|
|
74
|
-
yield fn_watcher_1.default(target);
|
|
74
|
+
yield (0, fn_watcher_1.default)(target);
|
|
75
75
|
}
|
|
76
76
|
const localFn = new local_function_1.default(replServer, target);
|
|
77
77
|
replServer.setContext(target.name, localFn.call);
|
|
@@ -87,14 +87,14 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
87
87
|
return target.localFn.shutdown();
|
|
88
88
|
}
|
|
89
89
|
})));
|
|
90
|
-
yield fs_1.ASYNC.deleteDir(path_1.join(runtime_store_1.default.get('cwd'), '.build')).catch();
|
|
90
|
+
yield fs_1.ASYNC.deleteDir((0, path_1.join)(runtime_store_1.default.get('cwd'), '.build')).catch();
|
|
91
91
|
fn_utils_1.fnUtils.common.executeHook({ prefix: 'post', command: 'serve' });
|
|
92
|
-
logger_js_1.info();
|
|
93
|
-
logger_js_1.success('shell complete');
|
|
92
|
+
(0, logger_js_1.info)();
|
|
93
|
+
(0, logger_js_1.success)('shell complete');
|
|
94
94
|
}
|
|
95
95
|
catch (e) {
|
|
96
96
|
yield Promise.all([
|
|
97
|
-
fs_1.ASYNC.deleteDir(path_1.join(runtime_store_1.default.get('cwd'), '.build')).catch(),
|
|
97
|
+
fs_1.ASYNC.deleteDir((0, path_1.join)(runtime_store_1.default.get('cwd'), '.build')).catch(),
|
|
98
98
|
httpServer ? httpServer.stop() : undefined
|
|
99
99
|
]);
|
|
100
100
|
throw e;
|
|
@@ -32,7 +32,7 @@ exports.default = (fnTypes) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
32
32
|
return target;
|
|
33
33
|
});
|
|
34
34
|
runtime_store_1.default.set('context.functions.targets', refinedTargets);
|
|
35
|
-
yield languages_1.prepareFunctions(refinedTargets);
|
|
36
|
-
yield common_1.resolveAllFnPorts(refinedTargets);
|
|
35
|
+
yield (0, languages_1.prepareFunctions)(refinedTargets);
|
|
36
|
+
yield (0, common_1.resolveAllFnPorts)(refinedTargets);
|
|
37
37
|
return refinedTargets;
|
|
38
38
|
});
|