zcatalyst-cli 1.12.0 → 1.13.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/apig-utils.js +39 -39
- package/lib/archiver.js +13 -9
- package/lib/authentication/index.js +22 -18
- package/lib/authentication/login.js +37 -39
- 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 +18 -18
- package/lib/client.js +1 -1
- package/lib/command_needs/auth.js +7 -7
- package/lib/command_needs/rc.js +24 -24
- 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 +19 -19
- 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 +15 -15
- 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 +22 -22
- 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 +29 -21
- 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 +29 -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 +48 -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 +23 -14
- 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 +5 -5
- 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 +6 -2
- 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 +15 -15
- 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 +34 -27
- package/lib/serve/server/lib/java/JavaaioServer.java +5 -3
- 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 +33 -36
- 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 +22 -19
- package/lib/shell/dependencies/http-functions.js +38 -33
- package/lib/shell/dependencies/invoker/bio/java/JavabioInvoker.java +14 -3
- package/lib/shell/dependencies/invoker/bio/node.js +5 -2
- package/lib/shell/dependencies/invoker/cron/java/JavacronInvoker.java +7 -2
- package/lib/shell/dependencies/invoker/event/java/JavaeventInvoker.java +7 -2
- package/lib/shell/dependencies/invoker/integ/java/JavaintegInvoker.java +7 -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/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/server.js +53 -0
- 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/templates/init/functions/java/integ/cliq/com/handlers/BotHandler.java +21 -3
- package/{docs → templates/init/functions/node/integ/cliq}/.DS_Store +0 -0
- package/templates/init/functions/node/integ/cliq/handlers/bot-handler.js +21 -5
- package/templates/init/functions/node/integ/cliq/handlers/command-handler.js +3 -3
- package/templates/init/functions/node/integ/cliq/package.json +2 -1
- package/templates/init/functions/node/integ/cliq/sample.js +3 -1
- package/lib/serve/server/lib/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
|
@@ -34,13 +34,13 @@ const option_1 = require("../../util_modules/option");
|
|
|
34
34
|
const project_1 = require("../../util_modules/project");
|
|
35
35
|
function validate() {
|
|
36
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
const sourceDir = project_1.resolveProjectPath(config_1.functionsConfig.source());
|
|
37
|
+
const sourceDir = (0, project_1.resolveProjectPath)(config_1.functionsConfig.source());
|
|
38
38
|
const fnTargets = config_1.functionsConfig.targets();
|
|
39
39
|
if (fnTargets === undefined || fnTargets.length === 0) {
|
|
40
40
|
throw new error_1.default('targets was found to be empty', {
|
|
41
41
|
exit: 1,
|
|
42
42
|
errorId: 'COMMON-1',
|
|
43
|
-
arg: [ansi_colors_1.bold('targets'), ansi_colors_1.bold(constants_1.FILENAME.config)]
|
|
43
|
+
arg: [(0, ansi_colors_1.bold)('targets'), (0, ansi_colors_1.bold)(constants_1.FILENAME.config)]
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
const sourceExists = yield fs_1.ASYNC.dirExists(sourceDir);
|
|
@@ -48,10 +48,10 @@ function validate() {
|
|
|
48
48
|
throw new error_1.default(sourceDir + ' directory was not found', {
|
|
49
49
|
exit: 1,
|
|
50
50
|
errorId: 'COMMON-2',
|
|
51
|
-
arg: [ansi_colors_1.bold(path_1.basename(sourceDir)), ansi_colors_1.bold(constants_1.FILENAME.config)]
|
|
51
|
+
arg: [(0, ansi_colors_1.bold)((0, path_1.basename)(sourceDir)), (0, ansi_colors_1.bold)(constants_1.FILENAME.config)]
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
const only = option_1.getOptionValue('only');
|
|
54
|
+
const only = (0, option_1.getOptionValue)('only');
|
|
55
55
|
let fnFilterGroups = [];
|
|
56
56
|
if (only !== undefined) {
|
|
57
57
|
fnFilterGroups = only
|
|
@@ -63,7 +63,7 @@ function validate() {
|
|
|
63
63
|
.map((filter) => filter.split(':')[1]);
|
|
64
64
|
}
|
|
65
65
|
else {
|
|
66
|
-
const except = option_1.getOptionValue('except', null);
|
|
66
|
+
const except = (0, option_1.getOptionValue)('except', null);
|
|
67
67
|
if (except !== null) {
|
|
68
68
|
const invalidFn = [];
|
|
69
69
|
const exceptFnGroup = js_1.JS.chain(except.split(','))
|
|
@@ -80,11 +80,11 @@ function validate() {
|
|
|
80
80
|
.map((filter) => filter.split(':')[1])
|
|
81
81
|
.value();
|
|
82
82
|
if (invalidFn.length > 0) {
|
|
83
|
-
logger_1.message(`The filters ${ansi_colors_1.bold(invalidFn.join(', '))} provided with --except option does not match with any functions in ${constants_1.FILENAME.config}, hence ignored.`);
|
|
83
|
+
(0, logger_1.message)(`The filters ${(0, ansi_colors_1.bold)(invalidFn.join(', '))} provided with --except option does not match with any functions in ${constants_1.FILENAME.config}, hence ignored.`);
|
|
84
84
|
}
|
|
85
85
|
fnFilterGroups = fnTargets.filter((fnTarget) => !exceptFnGroup.includes(fnTarget));
|
|
86
86
|
if (fnFilterGroups.length === fnTargets.length && invalidFn.length > 0) {
|
|
87
|
-
logger_1.message(`No match found for ${ansi_colors_1.bold('except')} option in functions. Hence, ignoring ${ansi_colors_1.bold('except')} option for functions.`);
|
|
87
|
+
(0, logger_1.message)(`No match found for ${(0, ansi_colors_1.bold)('except')} option in functions. Hence, ignoring ${(0, ansi_colors_1.bold)('except')} option for functions.`);
|
|
88
88
|
}
|
|
89
89
|
if (fnFilterGroups.length === 0 && exceptFnGroup.length > 0) {
|
|
90
90
|
return fnFilterGroups;
|
|
@@ -100,22 +100,22 @@ function validate() {
|
|
|
100
100
|
if (unmatchedFilters.length > 0) {
|
|
101
101
|
const formattedTargets = fnTargets.map((fn) => '* ' + fn).join('\n');
|
|
102
102
|
throw new error_1.default('The filters ' +
|
|
103
|
-
ansi_colors_1.bold(unmatchedFilters.join(', ')) +
|
|
103
|
+
(0, ansi_colors_1.bold)(unmatchedFilters.join(', ')) +
|
|
104
104
|
' provided with --only option does not match with any functions in ' +
|
|
105
105
|
constants_1.FILENAME.config, {
|
|
106
106
|
exit: 1,
|
|
107
107
|
errorId: 'COMMON-3',
|
|
108
108
|
arg: [
|
|
109
|
-
ansi_colors_1.bold(unmatchedFilters.join(', ')),
|
|
110
|
-
ansi_colors_1.bold('--only'),
|
|
111
|
-
ansi_colors_1.bold(constants_1.FILENAME.config),
|
|
112
|
-
ansi_colors_1.bold(formattedTargets)
|
|
109
|
+
(0, ansi_colors_1.bold)(unmatchedFilters.join(', ')),
|
|
110
|
+
(0, ansi_colors_1.bold)('--only'),
|
|
111
|
+
(0, ansi_colors_1.bold)(constants_1.FILENAME.config),
|
|
112
|
+
(0, ansi_colors_1.bold)(formattedTargets)
|
|
113
113
|
]
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
const filteredFns = fnFilterGroups.length > 0 ? js_1.JS.intersection(fnTargets, fnFilterGroups) : fnTargets;
|
|
118
|
-
const filteredFnsPath = filteredFns.map((target) => path_1.join(sourceDir, target));
|
|
118
|
+
const filteredFnsPath = filteredFns.map((target) => (0, path_1.join)(sourceDir, target));
|
|
119
119
|
runtime_store_1.default.set('context.functions.targets', filteredFnsPath);
|
|
120
120
|
return filteredFnsPath;
|
|
121
121
|
});
|
|
@@ -126,7 +126,7 @@ function refineTargets(rawTargets, mapRemoteFn = true) {
|
|
|
126
126
|
let remoteFnIdMap = {};
|
|
127
127
|
let runtimeDetails = runtime_store_1.default.get('context.catalyst.runtime', { runtimes: [] });
|
|
128
128
|
if (mapRemoteFn) {
|
|
129
|
-
const fnAPI = yield endpoints_1.functionsAPI();
|
|
129
|
+
const fnAPI = yield (0, endpoints_1.functionsAPI)();
|
|
130
130
|
let allRemoteFns = [];
|
|
131
131
|
[allRemoteFns, runtimeDetails] = yield Promise.all([
|
|
132
132
|
fnAPI.getAllFunctions(),
|
|
@@ -144,24 +144,24 @@ function refineTargets(rawTargets, mapRemoteFn = true) {
|
|
|
144
144
|
}, remoteFnIdMap);
|
|
145
145
|
}
|
|
146
146
|
return Promise.all(rawTargets.map((fnPath) => __awaiter(this, void 0, void 0, function* () {
|
|
147
|
-
fnPath = project_1.resolveProjectPath(fnPath);
|
|
148
|
-
const catalystJsonPth = path_1.join(fnPath, constants_1.FILENAME.catalyst_config);
|
|
147
|
+
fnPath = (0, project_1.resolveProjectPath)(fnPath);
|
|
148
|
+
const catalystJsonPth = (0, path_1.join)(fnPath, constants_1.FILENAME.catalyst_config);
|
|
149
149
|
const catalystJson = yield fs_1.ASYNC.readJSONFile(catalystJsonPth, {
|
|
150
150
|
checkpath: true,
|
|
151
151
|
throws: false
|
|
152
152
|
});
|
|
153
153
|
if (!catalystJson) {
|
|
154
154
|
return {
|
|
155
|
-
name: path_1.basename(fnPath),
|
|
155
|
+
name: (0, path_1.basename)(fnPath),
|
|
156
156
|
source: fnPath,
|
|
157
157
|
valid: false,
|
|
158
158
|
failure_reason: 'there is no valid ' + constants_1.FILENAME.catalyst_config + ' file present'
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
|
-
const validatePlugin = yield plugin_loader_1.default('functions', 'validate', fnPath).catch((err) => logger_1.debug(err));
|
|
161
|
+
const validatePlugin = yield (0, plugin_loader_1.default)('functions', 'validate', fnPath).catch((err) => (0, logger_1.debug)(err));
|
|
162
162
|
if (typeof validatePlugin === 'function') {
|
|
163
163
|
try {
|
|
164
|
-
yield validatePlugin(option_1.getCurrentCommand(), fnPath, runtime_store_1.default, catalystJson);
|
|
164
|
+
yield validatePlugin((0, option_1.getCurrentCommand)(), fnPath, runtime_store_1.default, catalystJson);
|
|
165
165
|
}
|
|
166
166
|
catch (e) {
|
|
167
167
|
throw new error_1.default(e.message, {
|
|
@@ -177,7 +177,7 @@ function refineTargets(rawTargets, mapRemoteFn = true) {
|
|
|
177
177
|
if (!userStack ||
|
|
178
178
|
(runtimeDetails.runtimes.length > 0 && !runtimeDetails.runtimes.includes(userStack))) {
|
|
179
179
|
return {
|
|
180
|
-
name: path_1.basename(fnPath),
|
|
180
|
+
name: (0, path_1.basename)(fnPath),
|
|
181
181
|
source: fnPath,
|
|
182
182
|
valid: false,
|
|
183
183
|
failure_reason: 'deployment.stack is unknown in ' + constants_1.FILENAME.catalyst_config + ' file.'
|
|
@@ -195,7 +195,7 @@ function refineTargets(rawTargets, mapRemoteFn = true) {
|
|
|
195
195
|
failure_reason: `Stack ${userStack} is no longer supported for creation. Kindly change the stack in ${constants_1.FILENAME.catalyst_config} and try again.`
|
|
196
196
|
};
|
|
197
197
|
}
|
|
198
|
-
logger_1.labeled(`functions(${fnName}) `, `Stack ${userStack} has reached EOL. Kindly update it as soon as possible.`).MESSAGE();
|
|
198
|
+
(0, logger_1.labeled)(`functions(${fnName}) `, `Stack ${userStack} has reached EOL. Kindly update it as soon as possible.`).MESSAGE();
|
|
199
199
|
break;
|
|
200
200
|
case 3:
|
|
201
201
|
return {
|
|
@@ -205,7 +205,7 @@ function refineTargets(rawTargets, mapRemoteFn = true) {
|
|
|
205
205
|
failure_reason: `Stack ${userStack} is no longer support. Kindly change the stack in ${constants_1.FILENAME.catalyst_config} and try again.`
|
|
206
206
|
};
|
|
207
207
|
default:
|
|
208
|
-
logger_1.debug(`unknown eol ${eol} hence skipping check`);
|
|
208
|
+
(0, logger_1.debug)(`unknown eol ${eol} hence skipping check`);
|
|
209
209
|
break;
|
|
210
210
|
}
|
|
211
211
|
let deploymentType = js_1.JS.get(catalystJson, 'deployment.type');
|
|
@@ -233,15 +233,15 @@ function refineTargets(rawTargets, mapRemoteFn = true) {
|
|
|
233
233
|
}
|
|
234
234
|
exports.refineTargets = refineTargets;
|
|
235
235
|
function executeHook({ prefix, command }) {
|
|
236
|
-
if (option_1.getOptionValue('ignoreScripts', false)) {
|
|
237
|
-
logger_1.debug(`skipping ${prefix + command} hook`);
|
|
236
|
+
if ((0, option_1.getOptionValue)('ignoreScripts', false)) {
|
|
237
|
+
(0, logger_1.debug)(`skipping ${prefix + command} hook`);
|
|
238
238
|
return;
|
|
239
239
|
}
|
|
240
240
|
const exeCommand = config_1.functionsConfig.script(prefix + command, null);
|
|
241
241
|
if (exeCommand === null) {
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
|
-
execute_script_1.default('functions:' + prefix + command);
|
|
244
|
+
(0, execute_script_1.default)('functions:' + prefix + command);
|
|
245
245
|
}
|
|
246
246
|
exports.executeHook = executeHook;
|
|
247
247
|
function pack(target) {
|
|
@@ -249,10 +249,10 @@ function pack(target) {
|
|
|
249
249
|
return __awaiter(this, void 0, void 0, function* () {
|
|
250
250
|
try {
|
|
251
251
|
let source = target.source;
|
|
252
|
-
const buildPlugin = yield plugin_loader_1.default('functions', 'build', source).catch((err) => logger_1.debug(err));
|
|
252
|
+
const buildPlugin = yield (0, plugin_loader_1.default)('functions', 'build', source).catch((err) => (0, logger_1.debug)(err));
|
|
253
253
|
if (typeof buildPlugin === 'function') {
|
|
254
254
|
try {
|
|
255
|
-
logger_1.message(`Plugin : "${runtime_store_1.default.get(`context.functions.plugins.build.${source}`)}" is used for functions deploy`);
|
|
255
|
+
(0, logger_1.message)(`Plugin : "${runtime_store_1.default.get(`context.functions.plugins.build.${source}`)}" is used for functions deploy`);
|
|
256
256
|
const outputDir = yield buildPlugin(source, runtime_store_1.default);
|
|
257
257
|
if (typeof outputDir !== 'string') {
|
|
258
258
|
throw new Error('unexpected return value from build plugin, ' + source);
|
|
@@ -270,7 +270,7 @@ function pack(target) {
|
|
|
270
270
|
}
|
|
271
271
|
const zip = new archiver_1.default(target.name);
|
|
272
272
|
if ((_a = target.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.java)) {
|
|
273
|
-
const outputFolder = path_1.join(source, '.output');
|
|
273
|
+
const outputFolder = (0, path_1.join)(source, '.output');
|
|
274
274
|
const outputFiles = yield fs_1.ASYNC.walk(outputFolder);
|
|
275
275
|
outputFiles.forEach((file) => {
|
|
276
276
|
zip.add(file.replace(outputFolder + path_1.sep, ''), fs_1.SYNC.getReadStream(file));
|
|
@@ -296,7 +296,7 @@ function pack(target) {
|
|
|
296
296
|
}
|
|
297
297
|
exports.pack = pack;
|
|
298
298
|
function generateUrlForTarget(target) {
|
|
299
|
-
const urlDefault = 'https://' + project_1.getDomainPrefix() + '.' + constants_1.ORIGIN.app.replace('https://', '');
|
|
299
|
+
const urlDefault = 'https://' + (0, project_1.getDomainPrefix)() + '.' + constants_1.ORIGIN.app.replace('https://', '');
|
|
300
300
|
switch (target.type) {
|
|
301
301
|
case constants_1.FN_TYPE.basic:
|
|
302
302
|
target.url = `${urlDefault}/server/${target.name}/execute`;
|
|
@@ -335,11 +335,11 @@ function resolveAllFnPorts(targets, idx = 0) {
|
|
|
335
335
|
}
|
|
336
336
|
let httpPort = -1;
|
|
337
337
|
let debugPort = -1;
|
|
338
|
-
switch (option_1.getCurrentCommand()) {
|
|
338
|
+
switch ((0, option_1.getCurrentCommand)()) {
|
|
339
339
|
case 'serve':
|
|
340
340
|
httpPort = yield port_resolver_1.default.getPort(constants_1.REMOTE_REF.functions.type[currentTargetType], 'http', currentTarget.name, currentTargetType === constants_1.FN_TYPE.advanced);
|
|
341
341
|
runtime_store_1.default.set('context.port.http.functions.' + currentTarget.name, httpPort);
|
|
342
|
-
const debugOptValue = option_1.getOptionValue('debug', false);
|
|
342
|
+
const debugOptValue = (0, option_1.getOptionValue)('debug', false);
|
|
343
343
|
if (debugOptValue &&
|
|
344
344
|
(debugOptValue + '').includes(constants_1.REMOTE_REF.functions.type[currentTargetType]) &&
|
|
345
345
|
((debugOptValue + '').includes(currentTarget.name) ||
|
|
@@ -353,11 +353,11 @@ function resolveAllFnPorts(targets, idx = 0) {
|
|
|
353
353
|
}
|
|
354
354
|
break;
|
|
355
355
|
case 'functions:shell':
|
|
356
|
-
if (currentTargetType === constants_1.FN_TYPE.basic && option_1.getOptionValue('http', false)) {
|
|
356
|
+
if (currentTargetType === constants_1.FN_TYPE.basic && (0, option_1.getOptionValue)('http', false)) {
|
|
357
357
|
httpPort = yield port_resolver_1.default.getPort('basicio', 'http', currentTarget.name, false);
|
|
358
358
|
runtime_store_1.default.set('context.port.http.' + constants_1.REMOTE_REF.functions.type[currentTargetType], httpPort);
|
|
359
359
|
}
|
|
360
|
-
if (option_1.getOptionValue('debug', false)) {
|
|
360
|
+
if ((0, option_1.getOptionValue)('debug', false)) {
|
|
361
361
|
debugPort = yield port_resolver_1.default.getPort('basicio', 'debug', '', false);
|
|
362
362
|
runtime_store_1.default.set('context.port.debug.' + constants_1.REMOTE_REF.functions.type[constants_1.FN_TYPE.basic], debugPort);
|
|
363
363
|
}
|
|
@@ -373,10 +373,10 @@ function fnDirDelete(conf) {
|
|
|
373
373
|
return __awaiter(this, void 0, void 0, function* () {
|
|
374
374
|
const fnSource = conf.get('functions.source', false);
|
|
375
375
|
if (!fnSource) {
|
|
376
|
-
logger_1.debug('Unable to get the functions source directory');
|
|
376
|
+
(0, logger_1.debug)('Unable to get the functions source directory');
|
|
377
377
|
return;
|
|
378
378
|
}
|
|
379
|
-
const fnDir = project_1.resolveProjectPath(fnSource);
|
|
379
|
+
const fnDir = (0, project_1.resolveProjectPath)(fnSource);
|
|
380
380
|
const dirContents = yield fs_1.ASYNC.walk(fnDir);
|
|
381
381
|
const delFnDir = yield prompt_1.default.ask(prompt_1.default.question('delDir', `All the Catalyst functions configured in the ${constants_1.FILENAME.config} file has been deleted.\n Would you like to delete the ${fnSource} directory too ?`, {
|
|
382
382
|
type: 'confirm',
|
|
@@ -404,7 +404,7 @@ function deleteFunctionLocal(path) {
|
|
|
404
404
|
exports.deleteFunctionLocal = deleteFunctionLocal;
|
|
405
405
|
function getSDK(fnType, dest, stack, options = {}) {
|
|
406
406
|
return __awaiter(this, void 0, void 0, function* () {
|
|
407
|
-
const sdk = yield endpoints_1.sdkAPI();
|
|
407
|
+
const sdk = yield (0, endpoints_1.sdkAPI)();
|
|
408
408
|
let sdkZip;
|
|
409
409
|
switch (stack) {
|
|
410
410
|
case 'java': {
|
|
@@ -425,8 +425,8 @@ exports.getSDK = getSDK;
|
|
|
425
425
|
function updateFnConfig(target) {
|
|
426
426
|
return __awaiter(this, void 0, void 0, function* () {
|
|
427
427
|
const targetConfig = target.configuration;
|
|
428
|
-
logger_1.message('Current memory configuration: ' + ansi_colors_1.bold(targetConfig.memory + ' MB'));
|
|
429
|
-
const memOption = option_1.getOptionValue('memory', false);
|
|
428
|
+
(0, logger_1.message)('Current memory configuration: ' + (0, ansi_colors_1.bold)(targetConfig.memory + ' MB'));
|
|
429
|
+
const memOption = (0, option_1.getOptionValue)('memory', false);
|
|
430
430
|
const memoryPrompt = yield prompt_1.default.ask(prompt_1.default.question('memory', 'Please specify the memory in MB to configure: ', {
|
|
431
431
|
defaultAns: 256,
|
|
432
432
|
when: () => !memOption,
|
|
@@ -444,7 +444,7 @@ function updateFnConfig(target) {
|
|
|
444
444
|
throw new error_1.default('value not a number', {
|
|
445
445
|
exit: 1,
|
|
446
446
|
errorId: 'COMMON-5',
|
|
447
|
-
arg: [ansi_colors_1.bold.red(memOption + ''), ansi_colors_1.bold('--memory')]
|
|
447
|
+
arg: [ansi_colors_1.bold.red(memOption + ''), (0, ansi_colors_1.bold)('--memory')]
|
|
448
448
|
});
|
|
449
449
|
}
|
|
450
450
|
const consent = yield prompt_1.default.ask(prompt_1.default.question('confirm', `Do you want to update the memory configuration for the function ${target.name}(${target.id}) from ${targetConfig.memory + ' MB'} to ${memValue + ' MB ?'}`, {
|
|
@@ -452,29 +452,29 @@ function updateFnConfig(target) {
|
|
|
452
452
|
when: () => memValue !== targetConfig.memory
|
|
453
453
|
}));
|
|
454
454
|
if (consent.confirm === undefined) {
|
|
455
|
-
logger_1.success('Resource already configured with the same value');
|
|
455
|
+
(0, logger_1.success)('Resource already configured with the same value');
|
|
456
456
|
return;
|
|
457
457
|
}
|
|
458
458
|
if (consent.confirm === false) {
|
|
459
|
-
logger_1.error('Operation aborted by user');
|
|
459
|
+
(0, logger_1.error)('Operation aborted by user');
|
|
460
460
|
return;
|
|
461
461
|
}
|
|
462
462
|
if (target.type === constants_1.FN_TYPE.advanced) {
|
|
463
|
-
yield (yield endpoints_1.applogicAPI()).deploy(undefined, {
|
|
463
|
+
yield (yield (0, endpoints_1.applogicAPI)()).deploy(undefined, {
|
|
464
464
|
name: target.name,
|
|
465
465
|
stack: target.stack,
|
|
466
466
|
memory: memValue
|
|
467
467
|
});
|
|
468
468
|
}
|
|
469
469
|
else {
|
|
470
|
-
yield (yield endpoints_1.functionsAPI()).deploy(undefined, {
|
|
470
|
+
yield (yield (0, endpoints_1.functionsAPI)()).deploy(undefined, {
|
|
471
471
|
name: target.name,
|
|
472
472
|
stack: target.stack,
|
|
473
473
|
type: target.type,
|
|
474
474
|
memory: memValue
|
|
475
475
|
});
|
|
476
476
|
}
|
|
477
|
-
logger_1.success(`Memory configuration for function ${ansi_colors_1.bold(target.name)}(${target.id}) has been updated to ${ansi_colors_1.bold(memValue + ' MB')}`);
|
|
477
|
+
(0, logger_1.success)(`Memory configuration for function ${(0, ansi_colors_1.bold)(target.name)}(${target.id}) has been updated to ${(0, ansi_colors_1.bold)(memValue + ' MB')}`);
|
|
478
478
|
});
|
|
479
479
|
}
|
|
480
480
|
exports.updateFnConfig = updateFnConfig;
|
|
@@ -50,11 +50,11 @@ function integHelper() {
|
|
|
50
50
|
if (js_1.JS.isEmpty(ansArr)) {
|
|
51
51
|
return ('Must select at least one handler.\n' +
|
|
52
52
|
'(Press ' +
|
|
53
|
-
ansi_colors_1.cyan('<space>') +
|
|
53
|
+
(0, ansi_colors_1.cyan)('<space>') +
|
|
54
54
|
' to select, ' +
|
|
55
|
-
ansi_colors_1.cyan('<a>') +
|
|
55
|
+
(0, ansi_colors_1.cyan)('<a>') +
|
|
56
56
|
' to toggle all, ' +
|
|
57
|
-
ansi_colors_1.cyan('<i>') +
|
|
57
|
+
(0, ansi_colors_1.cyan)('<i>') +
|
|
58
58
|
' to invert selection)');
|
|
59
59
|
}
|
|
60
60
|
return true;
|
|
@@ -80,21 +80,21 @@ function copyIntegHandlers(templatePath, targetPath, lang) {
|
|
|
80
80
|
const handlers = runtime_store_1.default.get('context.function.integration.cliq.handlers', []);
|
|
81
81
|
if (lang === runtime_1.default.language.nodejs) {
|
|
82
82
|
const filePaths = constants_1.CLIQ.node_template_contents_initial_copy.map((path) => {
|
|
83
|
-
return path_1.join(templatePath, path);
|
|
83
|
+
return (0, path_1.join)(templatePath, path);
|
|
84
84
|
});
|
|
85
85
|
yield fs_1.ASYNC.copyFiles(filePaths, targetPath);
|
|
86
86
|
const integHandlerConfig = {};
|
|
87
87
|
const handlerPaths = handlers.map((handler) => {
|
|
88
88
|
integHandlerConfig[handler] =
|
|
89
89
|
constants_1.CLIQ.node_handlers_path + constants_1.CLIQ.node_handler_file_mapping[handler];
|
|
90
|
-
return path_1.join(templatePath, constants_1.CLIQ.node_handlers_template_dir, constants_1.CLIQ.node_handler_file_mapping[handler]);
|
|
90
|
+
return (0, path_1.join)(templatePath, constants_1.CLIQ.node_handlers_template_dir, constants_1.CLIQ.node_handler_file_mapping[handler]);
|
|
91
91
|
});
|
|
92
|
-
yield fs_1.ASYNC.copyFiles(handlerPaths, path_1.join(targetPath, constants_1.CLIQ.node_handlers_template_dir));
|
|
92
|
+
yield fs_1.ASYNC.copyFiles(handlerPaths, (0, path_1.join)(targetPath, constants_1.CLIQ.node_handlers_template_dir));
|
|
93
93
|
integ_config.handlers = integHandlerConfig;
|
|
94
94
|
}
|
|
95
95
|
else if (lang === runtime_1.default.language.java) {
|
|
96
96
|
const filePaths = constants_1.CLIQ.java_template_contents_initial_copy.map((path) => {
|
|
97
|
-
return path_1.join(templatePath, path);
|
|
97
|
+
return (0, path_1.join)(templatePath, path);
|
|
98
98
|
});
|
|
99
99
|
yield fs_1.ASYNC.copyFiles(filePaths, targetPath);
|
|
100
100
|
const integHandlerConfig = {};
|
|
@@ -102,9 +102,9 @@ function copyIntegHandlers(templatePath, targetPath, lang) {
|
|
|
102
102
|
integHandlerConfig[handler] =
|
|
103
103
|
constants_1.CLIQ.java_handlers_path +
|
|
104
104
|
constants_1.CLIQ.java_handler_file_mapping[handler].replace('.java', '');
|
|
105
|
-
return path_1.join(templatePath, constants_1.CLIQ.java_handlers_template_dir, constants_1.CLIQ.java_handler_file_mapping[handler]);
|
|
105
|
+
return (0, path_1.join)(templatePath, constants_1.CLIQ.java_handlers_template_dir, constants_1.CLIQ.java_handler_file_mapping[handler]);
|
|
106
106
|
});
|
|
107
|
-
yield fs_1.ASYNC.copyFiles(handlerPaths, path_1.join(targetPath, constants_1.CLIQ.java_handlers_template_dir));
|
|
107
|
+
yield fs_1.ASYNC.copyFiles(handlerPaths, (0, path_1.join)(targetPath, constants_1.CLIQ.java_handlers_template_dir));
|
|
108
108
|
integ_config.handlers = integHandlerConfig;
|
|
109
109
|
}
|
|
110
110
|
break;
|
package/lib/fn-utils/lib/java.js
CHANGED
|
@@ -115,17 +115,17 @@ function rewriteClasspath(pth, libPth) {
|
|
|
115
115
|
if (content === undefined) {
|
|
116
116
|
throw new error_1.default('Content of ' + pth + ' is not defined', { exit: 2 });
|
|
117
117
|
}
|
|
118
|
-
const files = yield fs_1.ASYNC.walk(path_1.dirname(libPth), { exclude: ['**/.output'] });
|
|
118
|
+
const files = yield fs_1.ASYNC.walk((0, path_1.dirname)(libPth), { exclude: ['**/.output'] });
|
|
119
119
|
const result = yield xml2js_1.default.parseStringPromise(content);
|
|
120
120
|
const classPathEntries = js_1.JS.chain(files)
|
|
121
|
-
.filter((jarPth) => path_1.extname(jarPth) === '.jar')
|
|
121
|
+
.filter((jarPth) => (0, path_1.extname)(jarPth) === '.jar')
|
|
122
122
|
.map((jarPth) => {
|
|
123
123
|
return {
|
|
124
124
|
$: {
|
|
125
125
|
kind: 'lib',
|
|
126
|
-
path: path_1.basename(path_1.dirname(jarPth)) === 'lib'
|
|
127
|
-
? 'lib/' + path_1.basename(jarPth)
|
|
128
|
-
: path_1.basename(jarPth)
|
|
126
|
+
path: (0, path_1.basename)((0, path_1.dirname)(jarPth)) === 'lib'
|
|
127
|
+
? 'lib/' + (0, path_1.basename)(jarPth)
|
|
128
|
+
: (0, path_1.basename)(jarPth)
|
|
129
129
|
}
|
|
130
130
|
};
|
|
131
131
|
})
|
|
@@ -150,24 +150,24 @@ function normaliseClasspath(pth, libFolder) {
|
|
|
150
150
|
yield Promise.all(classPathEntries.map((entry) => __awaiter(this, void 0, void 0, function* () {
|
|
151
151
|
const row = entry.$;
|
|
152
152
|
if (row.kind && row.kind === 'lib' && row.path) {
|
|
153
|
-
const libPath = path_1.resolve(path_1.dirname(pth), row.path);
|
|
154
|
-
const jarName = path_1.basename(libPath);
|
|
155
|
-
const jarExists = yield fs_1.ASYNC.fileExists(path_1.join(libFolder, jarName));
|
|
153
|
+
const libPath = (0, path_1.resolve)((0, path_1.dirname)(pth), row.path);
|
|
154
|
+
const jarName = (0, path_1.basename)(libPath);
|
|
155
|
+
const jarExists = yield fs_1.ASYNC.fileExists((0, path_1.join)(libFolder, jarName));
|
|
156
156
|
if (!jarExists) {
|
|
157
157
|
try {
|
|
158
|
-
yield fs_1.ASYNC.copyFile(libPath, path_1.join(libFolder, jarName));
|
|
158
|
+
yield fs_1.ASYNC.copyFile(libPath, (0, path_1.join)(libFolder, jarName));
|
|
159
159
|
}
|
|
160
160
|
catch (err) {
|
|
161
161
|
throw new error_1.default(libPath + ' mentioned in .classpath file missing', {
|
|
162
162
|
exit: 1,
|
|
163
163
|
errorId: 'JAVA-1',
|
|
164
164
|
original: err,
|
|
165
|
-
arg: [ansi_colors_1.bold(libPath), ansi_colors_1.bold('.classpath')]
|
|
165
|
+
arg: [(0, ansi_colors_1.bold)(libPath), (0, ansi_colors_1.bold)('.classpath')]
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
row.path = path_1.join(path_1.basename(libFolder), jarName);
|
|
170
|
-
if (path_1.dirname(libPath) === path_1.dirname(libFolder)) {
|
|
169
|
+
row.path = (0, path_1.join)((0, path_1.basename)(libFolder), jarName);
|
|
170
|
+
if ((0, path_1.dirname)(libPath) === (0, path_1.dirname)(libFolder)) {
|
|
171
171
|
try {
|
|
172
172
|
yield fs_1.ASYNC.deleteFile(libPath);
|
|
173
173
|
}
|
|
@@ -177,11 +177,11 @@ function normaliseClasspath(pth, libFolder) {
|
|
|
177
177
|
exit: 1,
|
|
178
178
|
errorId: 'JAVA-2',
|
|
179
179
|
original: err,
|
|
180
|
-
arg: [ansi_colors_1.bold('.classpath'), ansi_colors_1.bold(path_1.dirname(pth))]
|
|
180
|
+
arg: [(0, ansi_colors_1.bold)('.classpath'), (0, ansi_colors_1.bold)((0, path_1.dirname)(pth))]
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
-
jarFilesList.push(path_1.join(libFolder, jarName));
|
|
184
|
+
jarFilesList.push((0, path_1.join)(libFolder, jarName));
|
|
185
185
|
}
|
|
186
186
|
})));
|
|
187
187
|
js_1.JS.set(result, 'classpath.classpathentry', classPathEntries);
|
|
@@ -192,16 +192,17 @@ function normaliseClasspath(pth, libFolder) {
|
|
|
192
192
|
}
|
|
193
193
|
exports.normaliseClasspath = normaliseClasspath;
|
|
194
194
|
function compileTarget(target) {
|
|
195
|
+
var _a;
|
|
195
196
|
return __awaiter(this, void 0, void 0, function* () {
|
|
196
197
|
const targetSource = target.source;
|
|
197
|
-
const outputFolder = path_1.join(targetSource, '.output');
|
|
198
|
+
const outputFolder = (0, path_1.join)(targetSource, '.output');
|
|
198
199
|
const integ = target.integ_config;
|
|
199
|
-
const entries = [path_1.join(targetSource, target.index + '.java')];
|
|
200
|
+
const entries = [(0, path_1.join)(targetSource, ((_a = target.index) === null || _a === void 0 ? void 0 : _a.replace(/\./g, path_1.sep)) + '.java')];
|
|
200
201
|
if (integ && integ.length > 0) {
|
|
201
202
|
integ.forEach((integConf) => {
|
|
202
203
|
const handlers = integConf.handlers;
|
|
203
204
|
Object.keys(handlers).forEach((handler) => {
|
|
204
|
-
entries.push(path_1.join(targetSource, handlers[handler].replace(
|
|
205
|
+
entries.push((0, path_1.join)(targetSource, handlers[handler].replace(/\./g, path_1.sep) + '.java'));
|
|
205
206
|
});
|
|
206
207
|
});
|
|
207
208
|
}
|
|
@@ -216,12 +217,12 @@ function compileTarget(target) {
|
|
|
216
217
|
const targetPth = file.includes(path_1.sep + 'lib' + path_1.sep)
|
|
217
218
|
? file.replace(targetSource + path_1.sep + 'lib', '')
|
|
218
219
|
: file.replace(targetSource, '');
|
|
219
|
-
return fs_1.ASYNC.copyFile(file, path_1.join(outputFolder, targetPth));
|
|
220
|
+
return fs_1.ASYNC.copyFile(file, (0, path_1.join)(outputFolder, targetPth));
|
|
220
221
|
}));
|
|
221
222
|
}
|
|
222
223
|
yield Promise.all(entries.map((file) => {
|
|
223
|
-
logger_1.info('Compiling ' + file);
|
|
224
|
-
return shell_1.spawn('javac', [
|
|
224
|
+
(0, logger_1.info)('Compiling ' + file);
|
|
225
|
+
return (0, shell_1.spawn)('javac', [
|
|
225
226
|
'-cp',
|
|
226
227
|
'*' + module.exports.classPathSep + '.',
|
|
227
228
|
'-g',
|
|
@@ -231,14 +232,14 @@ function compileTarget(target) {
|
|
|
231
232
|
cwd: outputFolder
|
|
232
233
|
}).ASYNC();
|
|
233
234
|
}));
|
|
234
|
-
const currentCommand = option_1.getCurrentCommand();
|
|
235
|
+
const currentCommand = (0, option_1.getCurrentCommand)();
|
|
235
236
|
switch (currentCommand) {
|
|
236
237
|
case 'pull':
|
|
237
238
|
case 'init':
|
|
238
239
|
yield cleanUp(cleanUpFiles);
|
|
239
240
|
break;
|
|
240
241
|
case 'deploy':
|
|
241
|
-
const classPath = path_1.join(outputFolder, constants_1.FILENAME.functions.java_classpath);
|
|
242
|
+
const classPath = (0, path_1.join)(outputFolder, constants_1.FILENAME.functions.java_classpath);
|
|
242
243
|
if (yield fs_1.ASYNC.fileExists(classPath)) {
|
|
243
244
|
const classPathFile = yield fs_1.ASYNC.readFile(classPath);
|
|
244
245
|
if (classPathFile) {
|
|
@@ -255,16 +256,16 @@ function ensureJavaInvoker(pth, invoker) {
|
|
|
255
256
|
if (fs_1.SYNC.fileExists(classPth)) {
|
|
256
257
|
return true;
|
|
257
258
|
}
|
|
258
|
-
fs_1.SYNC.ensureDir(path_1.dirname(classPth));
|
|
259
|
-
shell_1.spawn('javac', [
|
|
259
|
+
fs_1.SYNC.ensureDir((0, path_1.dirname)(classPth));
|
|
260
|
+
(0, shell_1.spawn)('javac', [
|
|
260
261
|
'-cp',
|
|
261
|
-
path_1.join('lib', '*') + module.exports.classPathSep + '.',
|
|
262
|
+
(0, path_1.join)('lib', '*') + module.exports.classPathSep + '.',
|
|
262
263
|
'-g',
|
|
263
264
|
'-d',
|
|
264
|
-
path_1.dirname(classPth),
|
|
265
|
-
path_1.basename(invoker)
|
|
266
|
-
], { cwd: path_1.dirname(invoker) }).SYNC();
|
|
267
|
-
fs_1.SYNC.copyDir(path_1.join(path_1.dirname(invoker), 'lib'), path_1.join(path_1.dirname(classPth), 'lib'));
|
|
265
|
+
(0, path_1.dirname)(classPth),
|
|
266
|
+
(0, path_1.basename)(invoker)
|
|
267
|
+
], { cwd: (0, path_1.dirname)(invoker) }).SYNC();
|
|
268
|
+
fs_1.SYNC.copyDir((0, path_1.join)((0, path_1.dirname)(invoker), 'lib'), (0, path_1.join)((0, path_1.dirname)(classPth), 'lib'));
|
|
268
269
|
return true;
|
|
269
270
|
}
|
|
270
271
|
exports.ensureJavaInvoker = ensureJavaInvoker;
|
|
@@ -273,7 +274,7 @@ function projectFileValidation(pth, target) {
|
|
|
273
274
|
const fileExists = yield fs_1.ASYNC.fileExists(pth);
|
|
274
275
|
if (!fileExists) {
|
|
275
276
|
const templatePath = getTemplatePath(target);
|
|
276
|
-
yield fs_1.ASYNC.copyFile(path_1.join(templatePath, constants_1.FILENAME.functions.java_project), path_1.join(target.source, constants_1.FILENAME.functions.java_project));
|
|
277
|
+
yield fs_1.ASYNC.copyFile((0, path_1.join)(templatePath, constants_1.FILENAME.functions.java_project), (0, path_1.join)(target.source, constants_1.FILENAME.functions.java_project));
|
|
277
278
|
yield fs_1.ASYNC.findAndReplace(pth)(constants_1.PLACEHOLDER.functions.java_name, target.name);
|
|
278
279
|
}
|
|
279
280
|
const content = yield fs_1.ASYNC.readFile(pth);
|
|
@@ -286,7 +287,7 @@ function projectFileValidation(pth, target) {
|
|
|
286
287
|
throw new error_1.default('project name mismatch in .project file for function ' + target.name, {
|
|
287
288
|
exit: 1,
|
|
288
289
|
errorId: 'JAVA-3',
|
|
289
|
-
arg: [ansi_colors_1.bold(name), ansi_colors_1.bold(path_1.basename(pth)), ansi_colors_1.bold(target.name)]
|
|
290
|
+
arg: [(0, ansi_colors_1.bold)(name), (0, ansi_colors_1.bold)((0, path_1.basename)(pth)), (0, ansi_colors_1.bold)(target.name)]
|
|
290
291
|
});
|
|
291
292
|
}
|
|
292
293
|
});
|
|
@@ -311,7 +312,7 @@ function extractAllData(child, name) {
|
|
|
311
312
|
}
|
|
312
313
|
function checkJavaCompatibility() {
|
|
313
314
|
return __awaiter(this, void 0, void 0, function* () {
|
|
314
|
-
const javacVersionChild = shell_1.spawn('javac', ['-version'], {
|
|
315
|
+
const javacVersionChild = (0, shell_1.spawn)('javac', ['-version'], {
|
|
315
316
|
cwd: runtime_store_1.default.get('cwd'),
|
|
316
317
|
stdio: 'pipe'
|
|
317
318
|
}).RAW();
|
|
@@ -320,24 +321,25 @@ function checkJavaCompatibility() {
|
|
|
320
321
|
javacVersionDetails === ''
|
|
321
322
|
? yield extractAllData(javacVersionChild, 'stderr')
|
|
322
323
|
: javacVersionDetails;
|
|
323
|
-
const javacVersion = semver_1.valid(semver_1.coerce(javacVersionDetails.split(' ')[1]));
|
|
324
|
+
const javacVersion = (0, semver_1.valid)((0, semver_1.coerce)(javacVersionDetails.split(' ')[1]));
|
|
324
325
|
if (javacVersion === '' || javacVersion === null) {
|
|
325
326
|
throw new error_1.default('Unable to check the javac version', {
|
|
326
327
|
exit: 0,
|
|
327
328
|
errorId: 'JAVA-4',
|
|
328
|
-
arg: [ansi_colors_1.bold('javac')]
|
|
329
|
+
arg: [(0, ansi_colors_1.bold)('javac')]
|
|
329
330
|
});
|
|
330
331
|
}
|
|
331
|
-
if (semver_1.gtr(javacVersion, new semver_1.Range('<1.9', { includePrerelease: true }))) {
|
|
332
|
+
if ((0, semver_1.gtr)(javacVersion, new semver_1.Range('<1.9', { includePrerelease: true }))) {
|
|
332
333
|
throw new error_1.default('javac version is above the compatible version', {
|
|
333
334
|
exit: 0,
|
|
334
335
|
errorId: 'JAVA-5',
|
|
335
|
-
arg: [ansi_colors_1.bold('javac'), ansi_colors_1.bold('1.8.x'), ansi_colors_1.bold('1.8')]
|
|
336
|
+
arg: [(0, ansi_colors_1.bold)('javac'), (0, ansi_colors_1.bold)('1.8.x'), (0, ansi_colors_1.bold)('1.8')]
|
|
336
337
|
});
|
|
337
338
|
}
|
|
338
339
|
});
|
|
339
340
|
}
|
|
340
341
|
function validate(targets, idx) {
|
|
342
|
+
var _a;
|
|
341
343
|
return __awaiter(this, void 0, void 0, function* () {
|
|
342
344
|
if (targets.length < idx + 1) {
|
|
343
345
|
return;
|
|
@@ -345,26 +347,26 @@ function validate(targets, idx) {
|
|
|
345
347
|
const currentTarget = targets[idx];
|
|
346
348
|
try {
|
|
347
349
|
const targetSource = currentTarget.source;
|
|
348
|
-
const classpath = path_1.join(targetSource, constants_1.FILENAME.functions.java_classpath);
|
|
349
|
-
const projectPath = path_1.join(targetSource, constants_1.FILENAME.functions.java_project);
|
|
350
|
-
const libFolder = path_1.join(targetSource, 'lib');
|
|
351
|
-
const entry = path_1.join(targetSource, currentTarget.index + '.java');
|
|
350
|
+
const classpath = (0, path_1.join)(targetSource, constants_1.FILENAME.functions.java_classpath);
|
|
351
|
+
const projectPath = (0, path_1.join)(targetSource, constants_1.FILENAME.functions.java_project);
|
|
352
|
+
const libFolder = (0, path_1.join)(targetSource, 'lib');
|
|
353
|
+
const entry = (0, path_1.join)(targetSource, ((_a = currentTarget.index) === null || _a === void 0 ? void 0 : _a.replace(/\./g, path_1.sep)) + '.java');
|
|
352
354
|
const entryFileExists = yield fs_1.ASYNC.fileExists(entry);
|
|
353
355
|
const classPathExists = yield fs_1.ASYNC.fileExists(classpath);
|
|
354
356
|
if (!entryFileExists) {
|
|
355
|
-
throw new error_1.default(path_1.basename(entry) + ' file is missing', {
|
|
357
|
+
throw new error_1.default((0, path_1.basename)(entry) + ' file is missing', {
|
|
356
358
|
exit: 1,
|
|
357
359
|
errorId: 'JAVA-6',
|
|
358
360
|
arg: [
|
|
359
|
-
ansi_colors_1.bold(path_1.basename(entry)),
|
|
360
|
-
ansi_colors_1.bold(constants_1.FILENAME.catalyst_config),
|
|
361
|
-
ansi_colors_1.bold(currentTarget.name)
|
|
361
|
+
(0, ansi_colors_1.bold)((0, path_1.basename)(entry)),
|
|
362
|
+
(0, ansi_colors_1.bold)(constants_1.FILENAME.catalyst_config),
|
|
363
|
+
(0, ansi_colors_1.bold)(currentTarget.name)
|
|
362
364
|
]
|
|
363
365
|
});
|
|
364
366
|
}
|
|
365
367
|
if (!classPathExists) {
|
|
366
368
|
const templatePath = getTemplatePath(currentTarget);
|
|
367
|
-
yield fs_1.ASYNC.copyFile(path_1.join(templatePath, constants_1.FILENAME.functions.java_classpath), path_1.join(targetSource, constants_1.FILENAME.functions.java_classpath));
|
|
369
|
+
yield fs_1.ASYNC.copyFile((0, path_1.join)(templatePath, constants_1.FILENAME.functions.java_classpath), (0, path_1.join)(targetSource, constants_1.FILENAME.functions.java_classpath));
|
|
368
370
|
yield rewriteClasspath(classpath, libFolder);
|
|
369
371
|
}
|
|
370
372
|
yield normaliseClasspath(classpath, libFolder);
|
|
@@ -375,7 +377,7 @@ function validate(targets, idx) {
|
|
|
375
377
|
exit: 1,
|
|
376
378
|
errorId: 'JAVA-7',
|
|
377
379
|
original: err,
|
|
378
|
-
skipHelp: !!option_1.getOptionValue('watch', false)
|
|
380
|
+
skipHelp: !!(0, option_1.getOptionValue)('watch', false)
|
|
379
381
|
});
|
|
380
382
|
});
|
|
381
383
|
currentTarget.valid = true;
|
package/lib/fn-utils/lib/node.js
CHANGED
|
@@ -27,14 +27,14 @@ function validate(targets, idx) {
|
|
|
27
27
|
}
|
|
28
28
|
const currentTarget = targets[idx];
|
|
29
29
|
try {
|
|
30
|
-
const catalystFile = path_1.join(currentTarget.source, constants_1.FILENAME.catalyst_config);
|
|
30
|
+
const catalystFile = (0, path_1.join)(currentTarget.source, constants_1.FILENAME.catalyst_config);
|
|
31
31
|
const data = yield fs_1.ASYNC.readJSONFile(catalystFile, { checkpath: true });
|
|
32
32
|
if (data === undefined) {
|
|
33
33
|
throw new error_1.default('no ' + constants_1.FILENAME.catalyst_config + ' file found', {
|
|
34
34
|
exit: 1
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
const indexFile = path_1.join(currentTarget.source, js_1.JS.get(data, 'execution.main', 'index.js'));
|
|
37
|
+
const indexFile = (0, path_1.join)(currentTarget.source, js_1.JS.get(data, 'execution.main', 'index.js'));
|
|
38
38
|
currentTarget.index = indexFile;
|
|
39
39
|
const indexFileExists = yield fs_1.ASYNC.fileExists(indexFile);
|
|
40
40
|
if (!indexFileExists) {
|
|
@@ -42,15 +42,15 @@ function validate(targets, idx) {
|
|
|
42
42
|
errorId: 'NODE-1',
|
|
43
43
|
exit: 1,
|
|
44
44
|
arg: [
|
|
45
|
-
ansi_colors_1.bold(currentTarget.index || 'undefined'),
|
|
46
|
-
ansi_colors_1.bold(constants_1.FILENAME.catalyst_config),
|
|
47
|
-
ansi_colors_1.bold(currentTarget.name)
|
|
45
|
+
(0, ansi_colors_1.bold)(currentTarget.index || 'undefined'),
|
|
46
|
+
(0, ansi_colors_1.bold)(constants_1.FILENAME.catalyst_config),
|
|
47
|
+
(0, ansi_colors_1.bold)(currentTarget.name)
|
|
48
48
|
]
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
const nodeModuleExists = yield fs_1.ASYNC.dirExists(path_1.join(currentTarget.source, constants_1.FILENAME.node_modules));
|
|
51
|
+
const nodeModuleExists = yield fs_1.ASYNC.dirExists((0, path_1.join)(currentTarget.source, constants_1.FILENAME.node_modules));
|
|
52
52
|
if (!nodeModuleExists) {
|
|
53
|
-
yield npm_install_1.default(currentTarget.source, true);
|
|
53
|
+
yield (0, npm_install_1.default)(currentTarget.source, true);
|
|
54
54
|
}
|
|
55
55
|
currentTarget.valid = true;
|
|
56
56
|
return validate(targets, ++idx);
|