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
package/lib/fn-watcher.js
CHANGED
|
@@ -12,13 +12,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
const chokidar_1 = require("chokidar");
|
|
13
13
|
const languages_1 = require("./shell/prepare/languages");
|
|
14
14
|
const logger_1 = require("./util_modules/logger");
|
|
15
|
-
const shell_1 = require("./util_modules/shell");
|
|
16
15
|
exports.default = (target) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
16
|
return new Promise((res) => {
|
|
18
17
|
let paused = false;
|
|
19
18
|
let latestEvent;
|
|
20
|
-
const watcher = chokidar_1.watch(target.source, {
|
|
21
|
-
ignored: /(^|[\/\\])\../,
|
|
19
|
+
const watcher = (0, chokidar_1.watch)(target.source, {
|
|
20
|
+
ignored: [/(^|[\/\\])\../, 'node_modules/**/*', '/**/*.jar'],
|
|
22
21
|
cwd: target.source,
|
|
23
22
|
ignoreInitial: true
|
|
24
23
|
});
|
|
@@ -28,12 +27,11 @@ exports.default = (target) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
28
27
|
return;
|
|
29
28
|
}
|
|
30
29
|
const currentLatestEvent = latestEvent;
|
|
31
|
-
|
|
32
|
-
logger_1.info(`\n${currentLatestEvent.evnt} of ${currentLatestEvent.pth} in ${target.name} detected. Preparing your function, please wait...`);
|
|
30
|
+
(0, logger_1.info)(`\n${currentLatestEvent.evnt} of ${currentLatestEvent.pth} in ${target.name} detected. Preparing your function, please wait...`);
|
|
33
31
|
watcher.emit('preparing');
|
|
34
32
|
target.failure_reason = undefined;
|
|
35
33
|
target.valid = true;
|
|
36
|
-
yield languages_1.prepareFunctions([target]);
|
|
34
|
+
yield (0, languages_1.prepareFunctions)([target]);
|
|
37
35
|
if (currentLatestEvent.at === latestEvent.at) {
|
|
38
36
|
latestEvent = undefined;
|
|
39
37
|
}
|
|
@@ -41,9 +39,9 @@ exports.default = (target) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
41
39
|
watcher.emit('compiled');
|
|
42
40
|
return;
|
|
43
41
|
}
|
|
44
|
-
logger_1.warning('target [' + target.name + '] is not a valid one reason : ' + target.failure_reason);
|
|
45
|
-
logger_1.info('Waiting for correction..');
|
|
46
|
-
logger_1.info('\n(To exit, press ^C)');
|
|
42
|
+
(0, logger_1.warning)('target [' + target.name + '] is not a valid one reason : ' + target.failure_reason);
|
|
43
|
+
(0, logger_1.info)('Waiting for correction..');
|
|
44
|
+
(0, logger_1.info)('\n(To exit, press ^C)');
|
|
47
45
|
watcher.emit('next');
|
|
48
46
|
}));
|
|
49
47
|
watcher.on('all', (evnt, pth) => {
|
|
@@ -59,8 +57,8 @@ exports.default = (target) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
59
57
|
res();
|
|
60
58
|
});
|
|
61
59
|
watcher.on('error', (err) => {
|
|
62
|
-
logger_1.debug(err);
|
|
63
|
-
logger_1.warning(`Unable to start watcher for target [${target.name}]. Skipping watch mode.`);
|
|
60
|
+
(0, logger_1.debug)(err);
|
|
61
|
+
(0, logger_1.warning)(`Unable to start watcher for target [${target.name}]. Skipping watch mode.`);
|
|
64
62
|
res();
|
|
65
63
|
});
|
|
66
64
|
});
|
package/lib/iac/status/bundle.js
CHANGED
|
@@ -23,8 +23,8 @@ const fs_1 = require("../../util_modules/fs");
|
|
|
23
23
|
const path_1 = require("path");
|
|
24
24
|
const option_1 = require("../../util_modules/option");
|
|
25
25
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
-
const env = option_1.getOptionValue('production', false) ? 'Production' : 'Development';
|
|
27
|
-
const getSpinnerTxt = util_1.getSpinnerTxt('bundle');
|
|
26
|
+
const env = (0, option_1.getOptionValue)('production', false) ? 'Production' : 'Development';
|
|
27
|
+
const getSpinnerTxt = (0, util_1.getSpinnerTxt)('bundle');
|
|
28
28
|
const iacAPI = new iac_1.default(undefined, { env });
|
|
29
29
|
const bundleStatus = yield iacAPI.bundleStatus();
|
|
30
30
|
if (bundleStatus === undefined) {
|
|
@@ -60,12 +60,12 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
60
60
|
timerAPI.end(undefined, true);
|
|
61
61
|
break;
|
|
62
62
|
default:
|
|
63
|
-
logger_1.debug('Unknown status received : ', data.status);
|
|
63
|
+
(0, logger_1.debug)('Unknown status received : ', data.status);
|
|
64
64
|
timerAPI.end();
|
|
65
65
|
}
|
|
66
66
|
}));
|
|
67
67
|
timerAPI.on('error', (e) => {
|
|
68
|
-
logger_1.debug('Error encounted :', e);
|
|
68
|
+
(0, logger_1.debug)('Error encounted :', e);
|
|
69
69
|
});
|
|
70
70
|
timerAPI.on('end', () => throbber.stopAll());
|
|
71
71
|
timerAPI.start();
|
|
@@ -76,7 +76,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
76
76
|
const hrTime = process.hrtime();
|
|
77
77
|
const fileName = `export_${bundleStatus.id}_${hrTime[0] * 1000000000 + hrTime[1]}.zip`;
|
|
78
78
|
const bundlezip = yield iacAPI.bundleDownload();
|
|
79
|
-
return fs_1.ASYNC.writeFile(path_1.join(process.cwd(), fileName), bundlezip);
|
|
79
|
+
return fs_1.ASYNC.writeFile((0, path_1.join)(process.cwd(), fileName), bundlezip);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
});
|
package/lib/iac/status/deploy.js
CHANGED
|
@@ -20,8 +20,8 @@ const throbber_1 = __importDefault(require("../../throbber"));
|
|
|
20
20
|
const logger_1 = require("../../util_modules/logger");
|
|
21
21
|
const util_1 = require("./util");
|
|
22
22
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
|
-
const getSpinnerTxt = util_1.getSpinnerTxt('deploy');
|
|
24
|
-
const idOpt = option_1.getOptionValue('id', false);
|
|
23
|
+
const getSpinnerTxt = (0, util_1.getSpinnerTxt)('deploy');
|
|
24
|
+
const idOpt = (0, option_1.getOptionValue)('id', false);
|
|
25
25
|
const iacAPI = new iac_1.default();
|
|
26
26
|
const allDeploys = yield iacAPI.allDeploys();
|
|
27
27
|
if (allDeploys.length <= 0) {
|
|
@@ -61,12 +61,12 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
61
61
|
timerAPI.end(undefined, true);
|
|
62
62
|
break;
|
|
63
63
|
default:
|
|
64
|
-
logger_1.debug('Unknown status received : ', data.status);
|
|
64
|
+
(0, logger_1.debug)('Unknown status received : ', data.status);
|
|
65
65
|
timerAPI.end();
|
|
66
66
|
}
|
|
67
67
|
}));
|
|
68
68
|
timerAPI.on('error', (e) => {
|
|
69
|
-
logger_1.debug('Error encounted : ', e);
|
|
69
|
+
(0, logger_1.debug)('Error encounted : ', e);
|
|
70
70
|
});
|
|
71
71
|
timerAPI.on('end', () => throbber.stopAll());
|
|
72
72
|
timerAPI.start();
|
package/lib/index.js
CHANGED
|
@@ -20,8 +20,8 @@ program.option('--dc <us|eu|in>', 'Supply a data center for a command');
|
|
|
20
20
|
program.option('--verbose', 'Change the log level to verbose for debugging purposes');
|
|
21
21
|
program.helpOption('-h, --help', 'Display help for a Catalyst command');
|
|
22
22
|
program.showSuggestionAfterError();
|
|
23
|
-
program.showHelpAfterError(`For more usage information use the ${ansi_colors_1.bold('catalyst help')} command`);
|
|
23
|
+
program.showHelpAfterError(`For more usage information use the ${(0, ansi_colors_1.bold)('catalyst help')} command`);
|
|
24
24
|
program.addHelpText('before', fs_1.SYNC.readFile(constants_1.TEMPLATE.banner, 'utf-8') || '');
|
|
25
|
-
program.addHelpText('afterAll', `\nFor detailed documentations please visit ${ansi_colors_1.underline('https://www.zoho.com/catalyst/help/cli-command-reference.html')}`);
|
|
25
|
+
program.addHelpText('afterAll', `\nFor detailed documentations please visit ${(0, ansi_colors_1.underline)('https://www.zoho.com/catalyst/help/cli-command-reference.html')}`);
|
|
26
26
|
const cli = new client_1.Client(program);
|
|
27
27
|
exports.default = cli;
|
|
@@ -22,7 +22,7 @@ exports.default = (pth, skipPrompt = false) => __awaiter(void 0, void 0, void 0,
|
|
|
22
22
|
when: () => !skipPrompt
|
|
23
23
|
}));
|
|
24
24
|
if (ans.NPMinstall === undefined || ans.NPMinstall) {
|
|
25
|
-
return shell_1.spawn('npm', ['install'], { cwd: pth })
|
|
25
|
+
return (0, shell_1.spawn)('npm', ['install'], { cwd: pth })
|
|
26
26
|
.ASYNC()
|
|
27
27
|
.catch((err) => {
|
|
28
28
|
throw error_1.default.getErrorInstance(err, {
|
|
@@ -23,12 +23,12 @@ const js_1 = require("../../util_modules/js");
|
|
|
23
23
|
const logger_1 = require("../../util_modules/logger");
|
|
24
24
|
const project_1 = require("../../util_modules/project");
|
|
25
25
|
exports.default = (templateJsonDir = 'package.json', keys) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
-
const templateJsonPath = path_1.join(templateJsonDir, 'package.json');
|
|
26
|
+
const templateJsonPath = (0, path_1.join)(templateJsonDir, 'package.json');
|
|
27
27
|
const qns = keys.map((qn) => {
|
|
28
28
|
switch (qn) {
|
|
29
29
|
case 'name':
|
|
30
30
|
return prompt_1.default.question('name', 'package name: ', {
|
|
31
|
-
defaultAns: js_1.JS.snakeCase(project_1.getProjectName('sample') + '_function'),
|
|
31
|
+
defaultAns: js_1.JS.snakeCase((0, project_1.getProjectName)('sample') + '_function'),
|
|
32
32
|
validate: (ans) => {
|
|
33
33
|
if (ans.match(constants_1.REGEX.functions.package.name)) {
|
|
34
34
|
return true;
|
|
@@ -54,11 +54,11 @@ exports.default = (templateJsonDir = 'package.json', keys) => __awaiter(void 0,
|
|
|
54
54
|
throw new error_1.default('unknown key provided', { exit: 2 });
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
|
-
logger_1.info('This utility will ask series of questions with sensible defaults for creating ' +
|
|
58
|
-
ansi_colors_1.cyan('package.json') +
|
|
57
|
+
(0, logger_1.info)('This utility will ask series of questions with sensible defaults for creating ' +
|
|
58
|
+
(0, ansi_colors_1.cyan)('package.json') +
|
|
59
59
|
'\nFeel free to modify them if needed.\n');
|
|
60
|
-
logger_1.info('Use `' +
|
|
61
|
-
ansi_colors_1.bold('npm install <pkg> --save') +
|
|
60
|
+
(0, logger_1.info)('Use `' +
|
|
61
|
+
(0, ansi_colors_1.bold)('npm install <pkg> --save') +
|
|
62
62
|
'` afterwards to install a package and \nsave it as a dependency in the package.json file.\n');
|
|
63
63
|
const answers = yield prompt_1.default.ask(...qns);
|
|
64
64
|
let content = yield fs_1.ASYNC.readFile(templateJsonPath);
|
|
@@ -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];
|
|
@@ -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];
|
|
@@ -47,9 +51,9 @@ const error_js_1 = __importDefault(require("../../../../error.js"));
|
|
|
47
51
|
const { angular } = plugin_js_1.default;
|
|
48
52
|
const { client } = placeholders_js_1.default;
|
|
49
53
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
50
|
-
const clientName = yield client_js_1.clientNamePrompt('Please provide a name for your Angular App:', 'angular-app');
|
|
51
|
-
const clientDirPath = project_js_1.resolveProjectPath(folder_names_js_1.default.client);
|
|
52
|
-
yield client_js_1.directoryOverridePrompt(clientDirPath);
|
|
54
|
+
const clientName = yield (0, client_js_1.clientNamePrompt)('Please provide a name for your Angular App:', 'angular-app');
|
|
55
|
+
const clientDirPath = (0, project_js_1.resolveProjectPath)(folder_names_js_1.default.client);
|
|
56
|
+
yield (0, client_js_1.directoryOverridePrompt)(clientDirPath);
|
|
53
57
|
const opts = [
|
|
54
58
|
angular.runner_command[1],
|
|
55
59
|
clientName,
|
|
@@ -59,8 +63,8 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
59
63
|
'true'
|
|
60
64
|
];
|
|
61
65
|
try {
|
|
62
|
-
const collection = require.resolve(path_1.join(angular.collection_name, 'package.json'));
|
|
63
|
-
yield shell_js_1.spawn(angular.runner_command[0], [...opts, '--collection', path_1.dirname(collection)], {
|
|
66
|
+
const collection = require.resolve((0, path_1.join)(angular.collection_name, 'package.json'));
|
|
67
|
+
yield (0, shell_js_1.spawn)(angular.runner_command[0], [...opts, '--collection', (0, path_1.dirname)(collection)], {
|
|
64
68
|
stdio: 'inherit',
|
|
65
69
|
cwd: runtime_store_js_1.default.get('cwd')
|
|
66
70
|
}).ASYNC();
|
|
@@ -75,10 +79,10 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
75
79
|
if (!err.code || err.code !== 'ENOENT') {
|
|
76
80
|
throw err;
|
|
77
81
|
}
|
|
78
|
-
logger_js_1.info(`Angular CLI (${ansi_colors_1.red.italic('@angular/cli')}) not found....`);
|
|
79
|
-
logger_js_1.info(`Installing ${ansi_colors_1.bold('@angular/cli')} using ${ansi_colors_1.bold('npx')}`);
|
|
80
|
-
logger_js_1.info('Note: this may take a while...');
|
|
81
|
-
yield shell_js_1.spawn('npx', [
|
|
82
|
+
(0, logger_js_1.info)(`Angular CLI (${ansi_colors_1.red.italic('@angular/cli')}) not found....`);
|
|
83
|
+
(0, logger_js_1.info)(`Installing ${(0, ansi_colors_1.bold)('@angular/cli')} using ${(0, ansi_colors_1.bold)('npx')}`);
|
|
84
|
+
(0, logger_js_1.info)('Note: this may take a while...');
|
|
85
|
+
yield (0, shell_js_1.spawn)('npx', [
|
|
82
86
|
'-p',
|
|
83
87
|
angular.collection_name,
|
|
84
88
|
'-p',
|
|
@@ -98,7 +102,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
98
102
|
});
|
|
99
103
|
});
|
|
100
104
|
}
|
|
101
|
-
yield ASYNC.findAndReplace(path_1.join(clientDirPath, file_names_js_1.default.client.package_json))(client.package.name, clientName);
|
|
105
|
+
yield ASYNC.findAndReplace((0, path_1.join)(clientDirPath, file_names_js_1.default.client.package_json))(client.package.name, clientName);
|
|
102
106
|
runtime_store_js_1.default.set('payload.client.plugin', angular.plugin);
|
|
103
|
-
return client_js_1.fillClientInitPayload(clientDirPath, clientName);
|
|
107
|
+
return (0, client_js_1.fillClientInitPayload)(clientDirPath, clientName);
|
|
104
108
|
});
|
|
@@ -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];
|
|
@@ -40,11 +44,11 @@ const logger_js_1 = require("../../../../util_modules/logger.js");
|
|
|
40
44
|
const project_js_1 = require("../../../../util_modules/project.js");
|
|
41
45
|
const client_js_1 = require("../../../util/client.js");
|
|
42
46
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
-
logger_js_1.message('A directory ' + ansi_colors_1.cyan.bold('client') + ' will be created with a webapp pre-configured.');
|
|
44
|
-
const clientDirPath = project_js_1.resolveProjectPath(folder_names_js_1.default.client);
|
|
45
|
-
yield client_js_1.directoryOverridePrompt(clientDirPath);
|
|
47
|
+
(0, logger_js_1.message)('A directory ' + ansi_colors_1.cyan.bold('client') + ' will be created with a webapp pre-configured.');
|
|
48
|
+
const clientDirPath = (0, project_js_1.resolveProjectPath)(folder_names_js_1.default.client);
|
|
49
|
+
yield (0, client_js_1.directoryOverridePrompt)(clientDirPath);
|
|
46
50
|
yield ASYNC.copyDir(template_js_1.default.client.basic.new, clientDirPath);
|
|
47
|
-
const clientName = yield client_js_1.clientNamePrompt('How do you want to address the client ?', 'sampleApp');
|
|
51
|
+
const clientName = yield (0, client_js_1.clientNamePrompt)('How do you want to address the client ?', 'sampleApp');
|
|
48
52
|
yield ASYNC.findAndReplace(clientDirPath)(placeholders_js_1.default.client.package.name, clientName);
|
|
49
|
-
return client_js_1.fillClientInitPayload(clientDirPath, clientName);
|
|
53
|
+
return (0, client_js_1.fillClientInitPayload)(clientDirPath, clientName);
|
|
50
54
|
});
|
|
@@ -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];
|
|
@@ -44,13 +48,13 @@ const project_js_1 = require("../../../../util_modules/project.js");
|
|
|
44
48
|
const { lyte } = plugin_js_1.default;
|
|
45
49
|
const { client } = placeholders_js_1.default;
|
|
46
50
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
-
const clientName = yield client_js_1.clientNamePrompt('Please provide a name for your Lyte web app: ', 'lyte-app');
|
|
48
|
-
const clientDirPath = project_js_1.resolveProjectPath(folder_names_js_1.default.client);
|
|
49
|
-
yield client_js_1.directoryOverridePrompt(clientDirPath);
|
|
51
|
+
const clientName = yield (0, client_js_1.clientNamePrompt)('Please provide a name for your Lyte web app: ', 'lyte-app');
|
|
52
|
+
const clientDirPath = (0, project_js_1.resolveProjectPath)(folder_names_js_1.default.client);
|
|
53
|
+
yield (0, client_js_1.directoryOverridePrompt)(clientDirPath);
|
|
50
54
|
yield ASYNC.copyDir(template_js_1.default.client.lyte, clientDirPath);
|
|
51
|
-
yield client_js_1.addDependency(path_1.join(clientDirPath, 'package.json'), { [lyte.plugin]: 'latest' }, { dev: true });
|
|
55
|
+
yield (0, client_js_1.addDependency)((0, path_1.join)(clientDirPath, 'package.json'), { [lyte.plugin]: 'latest' }, { dev: true });
|
|
52
56
|
yield ASYNC.findAndReplace(clientDirPath)(client.package.name, clientName);
|
|
53
|
-
yield npm_install_js_1.default(clientDirPath, true);
|
|
57
|
+
yield (0, npm_install_js_1.default)(clientDirPath, true);
|
|
54
58
|
runtime_store_js_1.default.set('payload.client.plugin', lyte.plugin);
|
|
55
|
-
return client_js_1.fillClientInitPayload(clientDirPath, clientName);
|
|
59
|
+
return (0, client_js_1.fillClientInitPayload)(clientDirPath, clientName);
|
|
56
60
|
});
|
|
@@ -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];
|
|
@@ -53,16 +57,16 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
53
57
|
index_js_1.default.choice('TypeScript', { value: 'ts', short: 'TypeScript' })
|
|
54
58
|
]
|
|
55
59
|
}));
|
|
56
|
-
const clientName = yield client_js_1.clientNamePrompt('Please provide a name for your React App:', 'react-app');
|
|
57
|
-
const clientDirPath = project_js_1.resolveProjectPath(clientName);
|
|
58
|
-
yield client_js_1.directoryOverridePrompt(clientDirPath);
|
|
59
|
-
const catalystTempDir = path_1.join(os_1.tmpdir(), '.catalyst');
|
|
60
|
-
const reactPluginDir = path_1.join(catalystTempDir, 'react');
|
|
60
|
+
const clientName = yield (0, client_js_1.clientNamePrompt)('Please provide a name for your React App:', 'react-app');
|
|
61
|
+
const clientDirPath = (0, project_js_1.resolveProjectPath)(clientName);
|
|
62
|
+
yield (0, client_js_1.directoryOverridePrompt)(clientDirPath);
|
|
63
|
+
const catalystTempDir = (0, path_1.join)((0, os_1.tmpdir)(), '.catalyst');
|
|
64
|
+
const reactPluginDir = (0, path_1.join)(catalystTempDir, 'react');
|
|
61
65
|
yield ASYNC.emptyDir(reactPluginDir);
|
|
62
66
|
yield ASYNC.copyDir(flavourPrompt.flavour === 'ts' ? template_js_1.default.client.react.ts : template_js_1.default.client.react.js, reactPluginDir);
|
|
63
|
-
yield client_js_1.addDependency(path_1.join(reactPluginDir, 'template.json'), { [react.plugin]: 'latest' }, { depPath: ['package'] });
|
|
67
|
+
yield (0, client_js_1.addDependency)((0, path_1.join)(reactPluginDir, 'template.json'), { [react.plugin]: 'latest' }, { depPath: ['package'] });
|
|
64
68
|
yield ASYNC.findAndReplace(reactPluginDir)(client.package.name, clientName);
|
|
65
|
-
yield shell_js_1.spawn('npx', [react.runner_command[0], clientName, '--template', 'file:' + reactPluginDir], {
|
|
69
|
+
yield (0, shell_js_1.spawn)('npx', [react.runner_command[0], clientName, '--template', 'file:' + reactPluginDir], {
|
|
66
70
|
stdio: 'inherit',
|
|
67
71
|
cwd: runtime_store_js_1.default.get('cwd')
|
|
68
72
|
})
|
|
@@ -74,5 +78,5 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
74
78
|
});
|
|
75
79
|
});
|
|
76
80
|
runtime_store_js_1.default.set('payload.client.plugin', react.plugin);
|
|
77
|
-
return client_js_1.fillClientInitPayload(clientDirPath, clientName);
|
|
81
|
+
return (0, client_js_1.fillClientInitPayload)(clientDirPath, clientName);
|
|
78
82
|
});
|
|
@@ -25,24 +25,24 @@ const option_1 = require("../../../util_modules/option");
|
|
|
25
25
|
const project_1 = require("../../../util_modules/project");
|
|
26
26
|
const languages_1 = __importDefault(require("./languages"));
|
|
27
27
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
-
const currentCmd = option_1.getCurrentCommand();
|
|
29
|
-
const functionsDirPath = project_1.resolveProjectPath(constants_1.FOLDERNAME.functions);
|
|
28
|
+
const currentCmd = (0, option_1.getCurrentCommand)();
|
|
29
|
+
const functionsDirPath = (0, project_1.resolveProjectPath)(constants_1.FOLDERNAME.functions);
|
|
30
30
|
runtime_store_1.default.set('context.functions.dir_path', functionsDirPath);
|
|
31
31
|
if (currentCmd === 'init' || currentCmd === 'functions:setup') {
|
|
32
|
-
logger_1.message('A directory ' +
|
|
32
|
+
(0, logger_1.message)('A directory ' +
|
|
33
33
|
ansi_colors_1.cyan.bold(constants_1.FOLDERNAME.functions) +
|
|
34
34
|
' will be created with a catalyst function pre-configured.\n');
|
|
35
35
|
const folderExits = yield fs_1.ASYNC.dirExists(functionsDirPath);
|
|
36
36
|
const overwriteAns = folderExits
|
|
37
37
|
? yield prompt_1.default.ask(prompt_1.default.question('overwrite', 'Directory ' +
|
|
38
|
-
ansi_colors_1.underline(constants_1.FOLDERNAME.functions) +
|
|
38
|
+
(0, ansi_colors_1.underline)(constants_1.FOLDERNAME.functions) +
|
|
39
39
|
' already exists. Overwrite ?', {
|
|
40
40
|
type: 'confirm',
|
|
41
41
|
defaultAns: false
|
|
42
42
|
}))
|
|
43
43
|
: { overwrite: true };
|
|
44
44
|
if (!overwriteAns.overwrite) {
|
|
45
|
-
logger_1.warning('skipping function setup');
|
|
45
|
+
(0, logger_1.warning)('skipping function setup');
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
yield fs_1.ASYNC.deleteDir(functionsDirPath).catch();
|
|
@@ -76,16 +76,17 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
76
76
|
}));
|
|
77
77
|
runtime_store_1.default.set('context.functions.type', fnTypeAns.type);
|
|
78
78
|
if (fnTypeAns.type === constants_1.FN_TYPE.integration) {
|
|
79
|
-
yield integ_1.integHelper();
|
|
79
|
+
yield (0, integ_1.integHelper)();
|
|
80
80
|
}
|
|
81
81
|
const runtimeDetails = (yield runtimeDetailsPromise);
|
|
82
82
|
const runtimeChoices = runtimeDetails.runtimes.reduce((acc, value) => {
|
|
83
83
|
const langArr = value.match(/[a-zA-Z]+/g);
|
|
84
84
|
if (langArr === null || languages_1.default[langArr[0]] === undefined) {
|
|
85
|
-
logger_1.debug('Language cannot be identified hence skipping');
|
|
85
|
+
(0, logger_1.debug)('Language cannot be identified hence skipping');
|
|
86
86
|
return acc;
|
|
87
87
|
}
|
|
88
|
-
const
|
|
88
|
+
const runtimeLang = langArr[0];
|
|
89
|
+
const langFn = languages_1.default[runtimeLang];
|
|
89
90
|
let displayValue = value;
|
|
90
91
|
let disabled = false;
|
|
91
92
|
if (runtimeDetails.eol_runtimes && runtimeDetails.eol_runtimes[value]) {
|
|
@@ -102,22 +103,30 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
102
103
|
disabled = true;
|
|
103
104
|
break;
|
|
104
105
|
default:
|
|
105
|
-
logger_1.debug('unknown eol_runtime value ' + runtimeDetails.eol_runtimes[value]);
|
|
106
|
+
(0, logger_1.debug)('unknown eol_runtime value ' + runtimeDetails.eol_runtimes[value]);
|
|
106
107
|
return acc;
|
|
107
108
|
}
|
|
108
109
|
}
|
|
109
|
-
acc.
|
|
110
|
+
if (acc[runtimeLang].length === 0) {
|
|
111
|
+
const sep = {
|
|
112
|
+
node: '---NodeJS---',
|
|
113
|
+
java: '----Java----'
|
|
114
|
+
};
|
|
115
|
+
acc[runtimeLang].push(prompt_1.default.separator(sep[runtimeLang]));
|
|
116
|
+
}
|
|
117
|
+
acc[runtimeLang].push(prompt_1.default.choice(displayValue, { value: langFn(value), short: value, disabled }));
|
|
110
118
|
return acc;
|
|
111
|
-
}, []);
|
|
119
|
+
}, { node: [], java: [] });
|
|
120
|
+
const runtimeChoicesArr = [...runtimeChoices.java, ...runtimeChoices.node];
|
|
112
121
|
const runtimeAns = yield prompt_1.default.ask(prompt_1.default.question('runtime', 'Which runtime do you prefer to write your function?', {
|
|
113
122
|
type: 'list',
|
|
114
|
-
choices:
|
|
123
|
+
choices: runtimeChoicesArr,
|
|
115
124
|
when: () => {
|
|
116
|
-
return
|
|
125
|
+
return runtimeChoicesArr.length > 1;
|
|
117
126
|
}
|
|
118
127
|
}));
|
|
119
128
|
if (runtimeAns === undefined || runtimeAns.runtime === undefined) {
|
|
120
|
-
return
|
|
129
|
+
return runtimeChoices.node[1].value();
|
|
121
130
|
}
|
|
122
131
|
return runtimeAns.runtime();
|
|
123
132
|
});
|
|
@@ -27,7 +27,7 @@ const runtime_1 = __importDefault(require("../../../../util_modules/constants/li
|
|
|
27
27
|
const functions_1 = require("../../../util/functions");
|
|
28
28
|
exports.default = (stack) => () => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
29
|
const fnType = runtime_store_1.default.get('context.functions.type');
|
|
30
|
-
const fnDirPath = path_1.join(runtime_store_1.default.get('context.functions.dir_path'));
|
|
30
|
+
const fnDirPath = (0, path_1.join)(runtime_store_1.default.get('context.functions.dir_path'));
|
|
31
31
|
yield fs_1.ASYNC.ensureDir(fnDirPath);
|
|
32
32
|
const functionAns = yield prompt_1.default.ask(prompt_1.default.question('name', 'What will be the name of the java function? This will also be the folder name. ', {
|
|
33
33
|
defaultAns: 'sample',
|
|
@@ -47,18 +47,18 @@ exports.default = (stack) => () => __awaiter(void 0, void 0, void 0, function* (
|
|
|
47
47
|
return 'Invalid class name';
|
|
48
48
|
}
|
|
49
49
|
}));
|
|
50
|
-
const targetPath = path_1.join(fnDirPath, functionAns.name);
|
|
50
|
+
const targetPath = (0, path_1.join)(fnDirPath, functionAns.name);
|
|
51
51
|
const dirExists = yield fs_1.ASYNC.dirExists(targetPath);
|
|
52
52
|
const overwriteAns = dirExists
|
|
53
53
|
? yield prompt_1.default.ask(prompt_1.default.question('overwrite', 'Directory ' +
|
|
54
|
-
ansi_colors_1.underline(functionAns.name) +
|
|
54
|
+
(0, ansi_colors_1.underline)(functionAns.name) +
|
|
55
55
|
' already exists inside functions directory. Overwrite ?', {
|
|
56
56
|
type: 'confirm',
|
|
57
57
|
defaultAns: false
|
|
58
58
|
}))
|
|
59
59
|
: { overwrite: true };
|
|
60
60
|
if (!overwriteAns.overwrite) {
|
|
61
|
-
logger_1.warning('Skipping functions java setup...');
|
|
61
|
+
(0, logger_1.warning)('Skipping functions java setup...');
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
64
|
yield fs_1.ASYNC.deleteDir(targetPath).catch();
|
|
@@ -67,7 +67,7 @@ exports.default = (stack) => () => __awaiter(void 0, void 0, void 0, function* (
|
|
|
67
67
|
? js_1.JS.get(constants_1.TEMPLATE.functions.java[fnType], service)
|
|
68
68
|
: constants_1.TEMPLATE.functions.java[fnType];
|
|
69
69
|
if (fnType === constants_1.FN_TYPE.integration) {
|
|
70
|
-
yield integ_1.copyIntegHandlers(templatePath, targetPath, runtime_1.default.language.java);
|
|
70
|
+
yield (0, integ_1.copyIntegHandlers)(templatePath, targetPath, runtime_1.default.language.java);
|
|
71
71
|
}
|
|
72
72
|
else {
|
|
73
73
|
yield fs_1.ASYNC.copyDir(templatePath, targetPath);
|
|
@@ -79,12 +79,12 @@ exports.default = (stack) => () => __awaiter(void 0, void 0, void 0, function* (
|
|
|
79
79
|
type: fnType,
|
|
80
80
|
integ_config
|
|
81
81
|
});
|
|
82
|
-
yield fs_1.ASYNC.rename(path_1.join(fnDirPath, functionAns.name, constants_1.FILENAME.functions.java_main), () => functionAns.class + '.java');
|
|
83
|
-
yield common_1.getSDK(fnType, path_1.join(fnDirPath, functionAns.name, constants_1.FOLDERNAME.java_fn_lib), 'java', {
|
|
82
|
+
yield fs_1.ASYNC.rename((0, path_1.join)(fnDirPath, functionAns.name, constants_1.FILENAME.functions.java_main), () => functionAns.class + '.java');
|
|
83
|
+
yield (0, common_1.getSDK)(fnType, (0, path_1.join)(fnDirPath, functionAns.name, constants_1.FOLDERNAME.java_fn_lib), 'java', {
|
|
84
84
|
service
|
|
85
85
|
});
|
|
86
|
-
const userFnClassPath = path_1.join(fnDirPath, functionAns.name, constants_1.FILENAME.functions.java_classpath);
|
|
87
|
-
const userFnLibPath = path_1.join(fnDirPath, functionAns.name, constants_1.FOLDERNAME.java_fn_lib);
|
|
86
|
+
const userFnClassPath = (0, path_1.join)(fnDirPath, functionAns.name, constants_1.FILENAME.functions.java_classpath);
|
|
87
|
+
const userFnLibPath = (0, path_1.join)(fnDirPath, functionAns.name, constants_1.FOLDERNAME.java_fn_lib);
|
|
88
88
|
yield fn_utils_1.fnUtils.java.rewriteClasspath(userFnClassPath, userFnLibPath);
|
|
89
|
-
return functions_1.fillFunctionsInitPayload(targetPath, functionAns.name, stack, fnType);
|
|
89
|
+
return (0, functions_1.fillFunctionsInitPayload)(targetPath, functionAns.name, stack, fnType);
|
|
90
90
|
});
|
|
@@ -34,29 +34,29 @@ exports.default = (stack) => () => __awaiter(void 0, void 0, void 0, function* (
|
|
|
34
34
|
: constants_1.TEMPLATE.functions.node[fnType];
|
|
35
35
|
const functionsDirPath = runtime_store_1.default.get('context.functions.dir_path');
|
|
36
36
|
yield fs_1.ASYNC.ensureDir(functionsDirPath);
|
|
37
|
-
const finalJson = yield package_json_1.default(templatePath, ['name', 'main', 'author']);
|
|
38
|
-
const targetPath = path_1.join(functionsDirPath, finalJson.name);
|
|
37
|
+
const finalJson = yield (0, package_json_1.default)(templatePath, ['name', 'main', 'author']);
|
|
38
|
+
const targetPath = (0, path_1.join)(functionsDirPath, finalJson.name);
|
|
39
39
|
const dirExists = yield fs_1.ASYNC.dirExists(targetPath);
|
|
40
40
|
const overwriteAns = dirExists
|
|
41
41
|
? yield prompt_1.default.ask(prompt_1.default.question('overwrite', 'Directory ' +
|
|
42
|
-
ansi_colors_1.underline(finalJson.name) +
|
|
42
|
+
(0, ansi_colors_1.underline)(finalJson.name) +
|
|
43
43
|
' already exists inside functions directory. Overwrite ?', {
|
|
44
44
|
type: 'confirm',
|
|
45
45
|
defaultAns: false
|
|
46
46
|
}))
|
|
47
47
|
: { overwrite: true };
|
|
48
48
|
if (!overwriteAns.overwrite) {
|
|
49
|
-
logger_1.warning('Skipping functions node setup...');
|
|
49
|
+
(0, logger_1.warning)('Skipping functions node setup...');
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
yield fs_1.ASYNC.deleteDir(targetPath).catch();
|
|
53
53
|
if (fnType === constants_1.FN_TYPE.integration) {
|
|
54
|
-
yield integ_1.copyIntegHandlers(templatePath, targetPath, runtime_1.default.language.nodejs);
|
|
54
|
+
yield (0, integ_1.copyIntegHandlers)(templatePath, targetPath, runtime_1.default.language.nodejs);
|
|
55
55
|
}
|
|
56
56
|
else {
|
|
57
57
|
yield fs_1.ASYNC.copyDir(templatePath, targetPath);
|
|
58
58
|
}
|
|
59
|
-
yield fs_1.ASYNC.rename(path_1.join(targetPath, constants_1.FILENAME.functions.node_main), () => finalJson.main);
|
|
59
|
+
yield fs_1.ASYNC.rename((0, path_1.join)(targetPath, constants_1.FILENAME.functions.node_main), () => finalJson.main);
|
|
60
60
|
const placeholderArr = [];
|
|
61
61
|
const replaceArr = [];
|
|
62
62
|
Object.keys(constants_1.PLACEHOLDER.functions.node_package).forEach((key) => {
|
|
@@ -71,7 +71,7 @@ exports.default = (stack) => () => __awaiter(void 0, void 0, void 0, function* (
|
|
|
71
71
|
integ_config
|
|
72
72
|
});
|
|
73
73
|
fnType === constants_1.FN_TYPE.integration
|
|
74
|
-
? yield npm_install_1.default(targetPath, true)
|
|
75
|
-
: yield npm_install_1.default(targetPath);
|
|
76
|
-
return functions_1.fillFunctionsInitPayload(targetPath, finalJson.name, stack, fnType);
|
|
74
|
+
? yield (0, npm_install_1.default)(targetPath, true)
|
|
75
|
+
: yield (0, npm_install_1.default)(targetPath);
|
|
76
|
+
return (0, functions_1.fillFunctionsInitPayload)(targetPath, finalJson.name, stack, fnType);
|
|
77
77
|
});
|
|
@@ -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];
|
|
@@ -51,7 +55,7 @@ function upsertEnvArr(envArr, idx = 0) {
|
|
|
51
55
|
}
|
|
52
56
|
const currentEnvObj = envArr[idx];
|
|
53
57
|
const isDefault = currentEnvObj.env_name === constants_1.DEFAULT.env_name;
|
|
54
|
-
yield project_1.upsertEnv(currentEnvObj.project_details.id + '', currentEnvObj, {
|
|
58
|
+
yield (0, project_1.upsertEnv)(currentEnvObj.project_details.id + '', currentEnvObj, {
|
|
55
59
|
base: isDefault,
|
|
56
60
|
active: isDefault
|
|
57
61
|
});
|
|
@@ -75,8 +79,8 @@ function setFnConfig(featureName, add) {
|
|
|
75
79
|
const config = runtime_store_1.default.get('config');
|
|
76
80
|
featureContextArr.forEach((context) => {
|
|
77
81
|
var _a, _b;
|
|
78
|
-
const targetSourceDir = featureName === 'functions' ? path_1.dirname(context.source) : context.source;
|
|
79
|
-
const targetSource = path_1.relative(project_1.getProjectRoot(), targetSourceDir);
|
|
82
|
+
const targetSourceDir = featureName === 'functions' ? (0, path_1.dirname)(context.source) : context.source;
|
|
83
|
+
const targetSource = (0, path_1.relative)((0, project_1.getProjectRoot)(), targetSourceDir);
|
|
80
84
|
switch (featureName) {
|
|
81
85
|
case 'functions':
|
|
82
86
|
if (!add) {
|
|
@@ -92,7 +96,7 @@ function setFnConfig(featureName, add) {
|
|
|
92
96
|
? js_1.JS.uniq(ignoreArr.concat(['.output']))
|
|
93
97
|
: ignoreArr);
|
|
94
98
|
if (config.get(featureName + '.source') !== targetSource) {
|
|
95
|
-
logger_1.warning(featureName + ' source has been modified');
|
|
99
|
+
(0, logger_1.warning)(featureName + ' source has been modified');
|
|
96
100
|
config.set(featureName + '.source', targetSource);
|
|
97
101
|
}
|
|
98
102
|
break;
|
|
@@ -135,15 +139,15 @@ function project() {
|
|
|
135
139
|
if (!projectPayload) {
|
|
136
140
|
return;
|
|
137
141
|
}
|
|
138
|
-
yield project_1.upsertProject(projectPayload, {
|
|
142
|
+
yield (0, project_1.upsertProject)(projectPayload, {
|
|
139
143
|
base: true,
|
|
140
144
|
active: true
|
|
141
145
|
});
|
|
142
146
|
yield upsertEnvArr(runtime_store_1.default.get('payload.env', null));
|
|
143
147
|
if (runtime_store_1.default.get('payload.project.new', false)) {
|
|
144
|
-
logger_1.message('New Project has been successfully created and associated with this directory.');
|
|
148
|
+
(0, logger_1.message)('New Project has been successfully created and associated with this directory.');
|
|
145
149
|
}
|
|
146
|
-
logger_1.message(ansi_colors_1.bold(constants_1.FILENAME.rc) + ' file has be successfully created with project details.');
|
|
150
|
+
(0, logger_1.message)((0, ansi_colors_1.bold)(constants_1.FILENAME.rc) + ' file has be successfully created with project details.');
|
|
147
151
|
const isImport = runtime_store_1.default.get('payload.project.import', false);
|
|
148
152
|
if (isImport) {
|
|
149
153
|
setFnConfig('functions', true);
|