zcatalyst-cli 1.18.0-beta.0 → 1.18.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/command_needs/rc.toml +8 -8
- package/docs/commands/ds/import.toml +5 -5
- package/docs/commands/event/generate/job.toml +7 -0
- package/docs/commands/zest/generate/index.toml +4 -0
- package/docs/endpoints/lib/job-scheduling.toml +3 -0
- package/docs/internal/command.toml +5 -0
- package/docs/serve/server/lib/appsail/index.toml +22 -1
- package/lib/appsail-utils.js +4 -10
- package/lib/authentication/index.js +1 -0
- package/lib/authentication/login.js +8 -4
- package/lib/bin/catalyst.js +1 -1
- package/lib/code-deck.js +7 -7
- package/lib/command_needs/rc.js +8 -8
- package/lib/commands/appsail/add.js +3 -2
- package/lib/commands/client/setup.js +2 -1
- package/lib/commands/codelib/install.js +6 -2
- package/lib/commands/ds/import.js +37 -21
- package/lib/commands/event/generate/index.js +16 -3
- package/lib/commands/event/generate/integ.js +2 -1
- package/lib/commands/event/generate/job.js +82 -0
- package/lib/commands/functions/add.js +2 -1
- package/lib/commands/functions/delete.js +2 -4
- package/lib/commands/functions/setup.js +2 -1
- package/lib/commands/functions/shell.js +1 -0
- package/lib/commands/iac/export.js +5 -1
- package/lib/commands/iac/import.js +4 -1
- package/lib/commands/index.js +4 -1
- package/lib/commands/init.js +10 -7
- package/lib/commands/login.js +1 -0
- package/lib/commands/logout.js +1 -0
- package/lib/commands/pull.js +1 -0
- package/lib/commands/serve.js +1 -1
- package/lib/commands/whoami.js +1 -0
- package/lib/commands/zest/generate/index.js +304 -0
- package/lib/deploy/features/appsail/index.js +42 -25
- package/lib/deploy/features/appsail/utils.js +4 -5
- package/lib/endpoints/index.js +24 -3
- package/lib/endpoints/lib/appsail.js +7 -1
- package/lib/endpoints/lib/ds-bulk.js +1 -0
- package/lib/endpoints/lib/job-scheduling.js +61 -0
- package/lib/endpoints/lib/stratus.js +63 -0
- package/lib/endpoints/lib/tunnel.js +18 -0
- package/lib/endpoints/lib/zest.js +124 -0
- package/lib/event_generate/stratus.js +52 -0
- package/lib/express_middlewares/logger.js +2 -4
- package/lib/fn-utils/lib/common.js +8 -4
- package/lib/fn-utils/lib/java.js +1 -1
- package/lib/fn-utils/lib/python.js +2 -2
- package/lib/fn-watcher.js +1 -1
- package/lib/iac/status/deploy.js +1 -5
- package/lib/init/dependencies/python/ensure-python.js +6 -8
- package/lib/init/features/appsail/index.js +38 -27
- package/lib/init/features/client/index.js +2 -1
- package/lib/init/features/functions/index.js +4 -0
- package/lib/init/features/functions/languages/python.js +21 -5
- package/lib/init/features/project.js +6 -15
- package/lib/internal/api.js +26 -7
- package/lib/internal/command.js +31 -7
- package/lib/migration/index.js +4 -2
- package/lib/optional-import.js +3 -2
- package/lib/prompt/index.js +5 -2
- package/lib/prompt/types/file-path.js +1 -1
- package/lib/prompt/types/search-box.js +281 -0
- package/lib/prompt/types/tree.js +3 -3
- package/lib/serve/features/appsail.js +3 -4
- package/lib/serve/index.js +1 -2
- package/lib/serve/server/index.js +52 -23
- package/lib/serve/server/lib/appsail/index.js +89 -39
- package/lib/serve/server/lib/appsail/start.js +9 -1
- package/lib/serve/server/lib/java/aio_server/lib/catalyst-cli-java-runtime-1.0.0.jar +0 -0
- package/lib/serve/server/lib/java/aio_server/lib/{catalyst-function-sdk-1.0.0.jar → catalyst-function-sdk-1.1.0.jar} +0 -0
- package/lib/serve/server/lib/java/aio_server/lib/catalyst-java-runtime-1.0.0.jar +0 -0
- package/lib/serve/server/lib/java/index.js +2 -2
- package/lib/serve/server/lib/master/appsail.js +53 -0
- package/lib/serve/server/lib/master/functions.js +34 -0
- package/lib/serve/server/lib/master/index.js +155 -0
- package/lib/{express_middlewares/unknownReqProxy.js → serve/server/lib/master/unknown-req-proxy.js} +9 -9
- package/lib/serve/server/lib/master/utils.js +142 -0
- package/lib/serve/server/lib/master/web-client.js +39 -0
- package/lib/serve/server/lib/node/index.js +3 -3
- package/lib/serve/server/lib/node/server/package-lock.json +12 -0
- package/lib/serve/server/lib/python/index.js +3 -3
- package/lib/shell/dependencies/http-functions.js +1 -1
- package/lib/shell/dependencies/invoker/bio/java/lib/catalyst-function-sdk-1.1.0.jar +0 -0
- package/lib/shell/dependencies/invoker/cron/java/JavacronInvoker.java +1 -1
- package/lib/shell/dependencies/invoker/cron/java/lib/catalyst-function-sdk-1.1.0.jar +0 -0
- package/lib/shell/dependencies/invoker/event/java/JavaeventInvoker.java +2 -1
- package/lib/shell/dependencies/invoker/event/java/lib/catalyst-function-sdk-1.1.0.jar +0 -0
- package/lib/shell/dependencies/invoker/event/node.mjs +1 -0
- package/lib/shell/dependencies/invoker/integ/java/JavaintegInvoker.java +15 -0
- package/lib/shell/dependencies/invoker/integ/java/lib/catalyst-function-sdk-1.1.0.jar +0 -0
- package/lib/shell/dependencies/invoker/integ/node.mjs +13 -0
- package/lib/shell/dependencies/invoker/job/java/JavajobInvoker.java +268 -0
- package/lib/shell/dependencies/invoker/job/java/lib/catalyst-function-sdk-1.1.0.jar +0 -0
- package/lib/shell/dependencies/invoker/job/java/lib/org.json.jar +0 -0
- package/lib/shell/dependencies/invoker/job/node.mjs +93 -0
- package/lib/shell/dependencies/local-function.js +122 -13
- package/lib/shell/dependencies/tunnel-server.js +52 -23
- package/lib/shell/index.js +22 -22
- package/lib/shell/prepare/languages/index.js +4 -4
- package/lib/shell/prepare/languages/java.js +1 -2
- package/lib/shell/prepare/languages/python.js +10 -16
- package/lib/throbber/index.js +6 -1
- package/lib/userConfig.js +7 -1
- package/lib/util_modules/config/index.js +1 -1
- package/lib/util_modules/config/lib/{appSail.js → appsail.js} +64 -10
- package/lib/util_modules/config/lib/client.js +6 -8
- package/lib/util_modules/config/lib/functions.js +6 -8
- package/lib/util_modules/constants/lib/dc-type.js +8 -0
- package/lib/util_modules/constants/lib/default.js +9 -9
- package/lib/util_modules/constants/lib/event-action.js +1 -0
- package/lib/util_modules/constants/lib/event-source.js +1 -0
- package/lib/util_modules/constants/lib/fn-type.js +2 -1
- package/lib/util_modules/constants/lib/needed-scopes.js +53 -44
- package/lib/util_modules/constants/lib/placeholders.js +7 -0
- package/lib/util_modules/constants/lib/ref-mapping.js +2 -1
- package/lib/util_modules/constants/lib/remote-mapping.js +2 -1
- package/lib/util_modules/constants/lib/scopes.js +17 -2
- package/lib/util_modules/constants/lib/template.js +9 -4
- package/lib/util_modules/constants/lib/urls.js +16 -0
- package/lib/util_modules/fs/lib/async.js +14 -4
- package/lib/util_modules/fs/lib/sync.js +12 -1
- package/lib/util_modules/server.js +2 -4
- package/lib/winston.js +17 -11
- package/package.json +4 -2
- package/templates/event/job.json +30 -0
- package/templates/init/client/react/react_js/template/src/index.js +3 -3
- package/templates/init/client/react/react_ts/template/src/index.tsx +3 -3
- package/templates/init/client/react/react_ts/template.json +3 -3
- package/templates/init/functions/java/job/.classpath +6 -0
- package/templates/init/functions/java/job/.project +17 -0
- package/templates/init/functions/java/job/catalyst-config.json +11 -0
- package/templates/init/functions/java/job/sample.java +34 -0
- package/templates/init/functions/node/aio/package.json +1 -1
- package/templates/init/functions/node/aio/sample.js +7 -0
- package/templates/init/functions/node/bio/package.json +1 -1
- package/templates/init/functions/node/bio/sample.js +5 -0
- package/templates/init/functions/node/bio/types/basicio.d.ts +57 -0
- package/templates/init/functions/node/cron/package.json +1 -1
- package/templates/init/functions/node/cron/sample.js +5 -0
- package/templates/init/functions/node/cron/types/cron.d.ts +64 -0
- package/templates/init/functions/node/event/package.json +1 -1
- package/templates/init/functions/node/event/sample.js +11 -8
- package/templates/init/functions/node/event/types/event.d.ts +82 -0
- package/templates/init/functions/node/integ/cliq/package.json +1 -1
- package/templates/init/functions/node/integ/convokraft/package.json +1 -1
- package/templates/init/functions/node/{stream → job}/catalyst-config.json +3 -2
- package/templates/init/functions/node/{stream → job}/package.json +1 -1
- package/templates/init/functions/node/job/sample.js +27 -0
- package/templates/init/functions/node/job/types/job.d.ts +62 -0
- package/templates/init/functions/python/job/catalyst-config.json +11 -0
- package/templates/init/functions/python/job/requirements.txt +1 -0
- package/templates/init/functions/python/job/sample.py +22 -0
- package/templates/init.txt +14 -0
- package/lib/serve/server/lib/master.js +0 -326
- package/lib/shell/dependencies/invoker/bio/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
- package/lib/shell/dependencies/invoker/cron/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
- package/lib/shell/dependencies/invoker/event/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
- package/lib/shell/dependencies/invoker/integ/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
- package/templates/init/functions/node/stream/sample.js +0 -15
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[RC-1]
|
|
2
2
|
context = '''The project(${arg[0]}) provided with the ${arg[1]} option is not available is not available in the ${arg[3]} org.'''
|
|
3
3
|
aid = '''Please use one of the available projects with the ${arg[1]} option or specify the correct org \nThe available projects in the ${arg[3]} org are: \n${arg[2]}'''
|
|
4
|
-
link = 'https://
|
|
4
|
+
link = 'https://docs.catalyst.zoho.com/en/cli/v1/initialize-resources/initialize-new-project/'
|
|
5
5
|
|
|
6
6
|
[RC-2]
|
|
7
7
|
context = '''Unable to load the ${arg[0]} file.'''
|
|
@@ -10,18 +10,18 @@ link = ''
|
|
|
10
10
|
|
|
11
11
|
[RC-3]
|
|
12
12
|
context = '''Oops!!! It looks like you're not inside a Catalyst app directory because we are unable to locate the ${arg[0]} file.'''
|
|
13
|
-
aid = '''Please run the ${arg[1]} command to
|
|
14
|
-
link = 'https://
|
|
13
|
+
aid = '''Please run the ${arg[1]} command to initialize or specify a valid project with the ${arg[2]} option.'''
|
|
14
|
+
link = 'https://docs.catalyst.zoho.com/en/cli/v1/initialize-resources/introduction/#Initialize_Alll'
|
|
15
15
|
|
|
16
16
|
[RC-4]
|
|
17
17
|
context = '''The ${arg[0]} file is corrupted.'''
|
|
18
|
-
aid = '''Please delete the ${arg[0]} file in the Catalyst app directory and
|
|
19
|
-
link = 'https://
|
|
18
|
+
aid = '''Please delete the ${arg[0]} file in the Catalyst app directory and initialize the project with the ${arg[1]} command or \nSpecify a valid project with the ${arg[2]} option.'''
|
|
19
|
+
link = 'https://docs.catalyst.zoho.com/en/cli/v1/initialize-resources/initialize-options/#--force'
|
|
20
20
|
|
|
21
21
|
[RC-5]
|
|
22
|
-
context = '''
|
|
23
|
-
aid = '''
|
|
24
|
-
link = 'https://
|
|
22
|
+
context = '''Oops!!! It looks like you don't have access to the currently initialized project ${arg[0]}.'''
|
|
23
|
+
aid = '''Please contact the owner or an administrator of the project.\nIf you would like to initialize a new project for this directory, please use the below command\n${arg[1]}'''
|
|
24
|
+
link = 'https://docs.catalyst.zoho.com/en/cli/v1/initialize-resources/initialize-options/#--force'
|
|
25
25
|
|
|
26
26
|
[RC-6]
|
|
27
27
|
context = '''The Catalyst portal initialized in the current project directory is not accessible with the currently logged in user.\n
|
|
@@ -6,15 +6,15 @@ link = 'https://www.zoho.com/catalyst/help/cli-import-export.html#Import'
|
|
|
6
6
|
[IMP-2]
|
|
7
7
|
context = '''File needed for import! A CSV file is mandatory for executing this command.'''
|
|
8
8
|
aid = '''Please provide the path of the CSV file present in the local machine with the command, or
|
|
9
|
-
provide the
|
|
9
|
+
provide the object_details of the file that is already uploaded to the Stratus in the config json.'''
|
|
10
10
|
link = 'https://www.zoho.com/catalyst/help/cli-import-export.html#CSV'
|
|
11
11
|
|
|
12
12
|
[IMP-3]
|
|
13
|
-
context = '''No
|
|
14
|
-
aid = '''Please create atleast one
|
|
13
|
+
context = '''No Buckets present in the Stratus! You must have atleast one bucket in the Stratus to upload the CSV file.'''
|
|
14
|
+
aid = '''Please create atleast one bucket in the Catalyst Stratus to proceed.'''
|
|
15
15
|
link = 'https://www.zoho.com/catalyst/help/file-store.html#Creating'
|
|
16
16
|
|
|
17
17
|
[IMP-4]
|
|
18
|
-
context = '''The
|
|
19
|
-
aid = '''Please specify the name of a
|
|
18
|
+
context = '''The bucket ${arg[0]} specified in the ${arg[1]} config file does not exists in the Catalyst Stratus.'''
|
|
19
|
+
aid = '''Please specify the name of a bucket that's already present in Catalyst Stratus. Alternatively, you can try uploading the ${arg[2]} file to a bucket in the Catalyst Stratus and specify it's ${arg[3]} as ${arg[4]} in the ${arg[1]} config file.'''
|
|
20
20
|
link = 'https://catalyst.zoho.com/help/cli-import-export.html#Import_File_Format'
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
[JOB-1]
|
|
2
|
+
context = '''No Jobpools were present in the development environment for project ${arg[0]}'''
|
|
3
|
+
aid = '''Please visit the below link to create your first jobpool\n${arg[1]}'''
|
|
4
|
+
|
|
5
|
+
[JOB-2]
|
|
6
|
+
context = '''No function Jobpools were present in the development environment for project ${arg[0]}'''
|
|
7
|
+
aid = '''Please visit the below link to create a functions jobpool\n${arg[1]}'''
|
|
@@ -2,3 +2,8 @@
|
|
|
2
2
|
context = '''Too many arguments specified with the command: ${arg[0]}.'''
|
|
3
3
|
aid = '''Use ${arg[1]} command to get the usage instructions.'''
|
|
4
4
|
link = 'https://www.zoho.com/catalyst/help/cli-help.html'
|
|
5
|
+
|
|
6
|
+
[CMD-2]
|
|
7
|
+
context = '''The command ${arg[0]} provided is not supported in CI enviroment.'''
|
|
8
|
+
aid = '''Use '${arg[1]}' to know the commands supported in CI.'''
|
|
9
|
+
link = ''
|
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
[SERVE-APPSAIL-1]
|
|
2
|
-
context = '''The provided build path
|
|
2
|
+
context = '''The provided build path ${arg[0]} for the AppSail ${arg[1]} does not exists.'''
|
|
3
3
|
aid = '''Please provide a valid build path'''
|
|
4
4
|
link = ''
|
|
5
|
+
|
|
6
|
+
[SERVE-APPSAIL-2]
|
|
7
|
+
context = '''The build path resolved from the provided relative path "${arg[0]}" does not exists.
|
|
8
|
+
Source path : ${arg[1]}
|
|
9
|
+
Build path : ${arg[2]}
|
|
10
|
+
Resolved Path : ${arg[3]}'''
|
|
11
|
+
aid = '''Please provide a valid relative path as build path'''
|
|
12
|
+
link = ''
|
|
13
|
+
|
|
14
|
+
[SERVE-APPSAIL-3]
|
|
15
|
+
context = '''Unable to start the ${arg[0]} AppSail server with the below parameters.
|
|
16
|
+
Command : ${arg[1]}
|
|
17
|
+
Build path : ${arg[2]}
|
|
18
|
+
Runtime : ${arg[3]}'''
|
|
19
|
+
aid = '''Please fix the errors if any'''
|
|
20
|
+
link = ''
|
|
21
|
+
|
|
22
|
+
[SERVE-APPSAIL-4]
|
|
23
|
+
context = '''Invalid AppSail Stack/Runtime for AppSail ${arg[0]}: ${arg[1]}'''
|
|
24
|
+
aid = '''Please use a supported Stack/Runtime from the below list: \n${arg[2]}'''
|
|
25
|
+
link = ''
|
package/lib/appsail-utils.js
CHANGED
|
@@ -3,13 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.validateAppSail = exports.filterTargets = void 0;
|
|
7
7
|
const ansi_colors_1 = require("ansi-colors");
|
|
8
8
|
const error_1 = __importDefault(require("./error"));
|
|
9
9
|
const constants_1 = require("./util_modules/constants");
|
|
10
10
|
const logger_1 = require("./util_modules/logger");
|
|
11
11
|
const option_1 = require("./util_modules/option");
|
|
12
|
-
const project_1 = require("./util_modules/project");
|
|
13
12
|
function getAppSailFilters(targetStr) {
|
|
14
13
|
return targetStr.split(',').reduce((filterArr, target) => {
|
|
15
14
|
const opts = target.split(':');
|
|
@@ -28,7 +27,7 @@ function filterTargets(allTargets) {
|
|
|
28
27
|
return allTargets;
|
|
29
28
|
}
|
|
30
29
|
const refined = onlyTargs.reduce((filtered, filter) => {
|
|
31
|
-
const targDetailsIdx = allTargets.findIndex((targ) =>
|
|
30
|
+
const targDetailsIdx = allTargets.findIndex((targ) => targ.name === filter);
|
|
32
31
|
if (targDetailsIdx === -1) {
|
|
33
32
|
filtered.unmatched.push(filter);
|
|
34
33
|
}
|
|
@@ -50,7 +49,7 @@ function filterTargets(allTargets) {
|
|
|
50
49
|
if (except !== undefined) {
|
|
51
50
|
const exceptTargs = getAppSailFilters(except);
|
|
52
51
|
const refined = exceptTargs.reduce((filtered, filter) => {
|
|
53
|
-
const targDetailsIdx = allTargets.findIndex((targ) =>
|
|
52
|
+
const targDetailsIdx = allTargets.findIndex((targ) => targ.name === filter);
|
|
54
53
|
if (targDetailsIdx === -1) {
|
|
55
54
|
filtered.unmatched.push(filter);
|
|
56
55
|
}
|
|
@@ -73,7 +72,7 @@ exports.filterTargets = filterTargets;
|
|
|
73
72
|
function validateAppSail(targDetails) {
|
|
74
73
|
targDetails.forEach((targ) => {
|
|
75
74
|
var _a, _b;
|
|
76
|
-
if (targ.validity.valid && ((_a = targ.
|
|
75
|
+
if (targ.validity.valid && ((_a = targ.config) === null || _a === void 0 ? void 0 : _a.platform) !== 'war' && !((_b = targ.config) === null || _b === void 0 ? void 0 : _b.command)) {
|
|
77
76
|
targ.validity = {
|
|
78
77
|
valid: false,
|
|
79
78
|
reason: 'Start-up command missing'
|
|
@@ -83,8 +82,3 @@ function validateAppSail(targDetails) {
|
|
|
83
82
|
return targDetails;
|
|
84
83
|
}
|
|
85
84
|
exports.validateAppSail = validateAppSail;
|
|
86
|
-
function getDomainPrefix(targetDetail) {
|
|
87
|
-
var _a;
|
|
88
|
-
return `${(_a = targetDetail.appSail) === null || _a === void 0 ? void 0 : _a.name}-${(0, project_1.getDomainKey)()}.development`;
|
|
89
|
-
}
|
|
90
|
-
exports.getDomainPrefix = getDomainPrefix;
|
|
@@ -113,6 +113,7 @@ function login() {
|
|
|
113
113
|
const token = config_store_1.default.get(`${activeDC}.credential`);
|
|
114
114
|
if (user && token && !(0, option_1.getOptionValue)('force', false)) {
|
|
115
115
|
(0, logger_1.message)('No need to login. Already logged as: ' + ansi_colors_1.default.cyan.bold(user.Email));
|
|
116
|
+
(0, dc_1.updateActiveDC)(activeDC);
|
|
116
117
|
return;
|
|
117
118
|
}
|
|
118
119
|
const ans = yield prompt_1.default.ask(prompt_1.default.question('collectUsage', 'Allow Catalyst to collect CLI error reporting information?', {
|
|
@@ -33,11 +33,15 @@ const logger_1 = require("../util_modules/logger");
|
|
|
33
33
|
const option_1 = require("../util_modules/option");
|
|
34
34
|
const crypto_1 = require("crypto");
|
|
35
35
|
exports.missingScopes = {
|
|
36
|
-
[constants_1.DC_TYPE.in.value]: ['dataverse'],
|
|
37
|
-
[constants_1.DC_TYPE.eu.value]: ['quick_ml', 'dataverse'],
|
|
38
|
-
[constants_1.DC_TYPE.au.value]: ['dataverse'],
|
|
39
|
-
[constants_1.DC_TYPE.ca.value]: ['quick_ml', 'dataverse']
|
|
36
|
+
[constants_1.DC_TYPE.in.value]: getScopes(['zest', 'dataverse']),
|
|
37
|
+
[constants_1.DC_TYPE.eu.value]: getScopes(['zest', 'quick_ml', 'dataverse']),
|
|
38
|
+
[constants_1.DC_TYPE.au.value]: getScopes(['zest', 'dataverse']),
|
|
39
|
+
[constants_1.DC_TYPE.ca.value]: getScopes(['zest', 'quick_ml', 'dataverse']),
|
|
40
|
+
[constants_1.DC_TYPE.sa.value]: getScopes(['zest', 'quick_ml', 'dataverse'])
|
|
40
41
|
};
|
|
42
|
+
function getScopes(keys) {
|
|
43
|
+
return Object.keys(constants_1.SCOPE).filter((scope) => keys.some((prefix) => scope.startsWith(prefix)));
|
|
44
|
+
}
|
|
41
45
|
class Login {
|
|
42
46
|
constructor(localhost = true, user = true) {
|
|
43
47
|
this.localhost = localhost;
|
package/lib/bin/catalyst.js
CHANGED
|
@@ -44,7 +44,7 @@ const errorOut_1 = __importDefault(require("../errorOut"));
|
|
|
44
44
|
(0, logger_1.debug)(js_1.JS.repeat('-', 70));
|
|
45
45
|
(0, logger_1.debug)();
|
|
46
46
|
process.on('beforeExit', (code) => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
-
code = process.exitCode || code;
|
|
47
|
+
code = Number(process.exitCode) || code;
|
|
48
48
|
if (code > 0 && process.stdout.isTTY) {
|
|
49
49
|
const lastError = config_store_1.default.get('lastError', 0);
|
|
50
50
|
const timestamp = Date.now();
|
package/lib/code-deck.js
CHANGED
|
@@ -20,6 +20,7 @@ const prompt_1 = __importDefault(require("./prompt"));
|
|
|
20
20
|
const tree_1 = require("./prompt/types/tree");
|
|
21
21
|
const runtime_store_1 = __importDefault(require("./runtime-store"));
|
|
22
22
|
const logger_1 = require("./util_modules/logger");
|
|
23
|
+
const project_1 = require("./util_modules/project");
|
|
23
24
|
const shell_1 = require("./util_modules/shell");
|
|
24
25
|
function listenDeploy(id, gitUrl) {
|
|
25
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -27,21 +28,20 @@ function listenDeploy(id, gitUrl) {
|
|
|
27
28
|
const allGlobalOpts = runtime_store_1.default.get('opts.globalOpts', {});
|
|
28
29
|
const optsArr = Object.keys(allGlobalOpts).reduce((arr, key) => {
|
|
29
30
|
arr.push('--' + key);
|
|
30
|
-
if (allGlobalOpts[key]) {
|
|
31
|
+
if (typeof allGlobalOpts[key] === 'string') {
|
|
31
32
|
arr.push(allGlobalOpts[key]);
|
|
32
33
|
}
|
|
33
34
|
return arr;
|
|
34
|
-
}, ['--id', id]);
|
|
35
|
-
|
|
35
|
+
}, ['--id', id, '--org', (0, project_1.getEnvId)() || '']);
|
|
36
|
+
yield (0, shell_1.spawn)('catalyst', ['iac:status', 'import', ...optsArr], {
|
|
36
37
|
shell: true,
|
|
37
38
|
stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
|
|
38
39
|
env: { PARENT_COMMAND: 'codedeck', GIT_URL: gitUrl }
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
.catch((err) => (0, logger_1.debug)(err));
|
|
42
|
-
return (childRes === null || childRes === void 0 ? void 0 : childRes.message) === 'success';
|
|
40
|
+
}).ASYNC();
|
|
41
|
+
return true;
|
|
43
42
|
}
|
|
44
43
|
catch (err) {
|
|
44
|
+
(0, logger_1.debug)('Error when listening for iac:status ', err);
|
|
45
45
|
return false;
|
|
46
46
|
}
|
|
47
47
|
});
|
package/lib/command_needs/rc.js
CHANGED
|
@@ -33,7 +33,7 @@ exports.default = ({ optional = false, resolveOnNotFound = false, skipOrgCheck =
|
|
|
33
33
|
const globProjectOpt = (0, option_1.getGlobalOptionValue)('project', null);
|
|
34
34
|
const projectOpt = globProjectOpt
|
|
35
35
|
? globProjectOpt
|
|
36
|
-
: (0, env_1.getEnvVariable)('CATALYST_PROJECT', null);
|
|
36
|
+
: (0, env_1.getEnvVariable)('CATALYST_PROJECT_ID', (0, env_1.getEnvVariable)('CATALYST_PROJECT', null));
|
|
37
37
|
const orgApi = yield (0, endpoints_1.orgAPI)();
|
|
38
38
|
if (orgOpt !== null) {
|
|
39
39
|
const orgList = yield orgApi.getAllOrgs();
|
|
@@ -192,7 +192,7 @@ exports.default = ({ optional = false, resolveOnNotFound = false, skipOrgCheck =
|
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
194
|
if (typeof finalEnvObj !== 'undefined') {
|
|
195
|
-
projectApi = yield (0, endpoints_1.projectAPI)({ auth: true, org: finalEnvObj.id });
|
|
195
|
+
projectApi = yield (0, endpoints_1.projectAPI)({ auth: true, org: finalEnvObj.id, printError: false });
|
|
196
196
|
envApi = yield (0, endpoints_1.envAPI)({ auth: true, org: finalEnvObj.id });
|
|
197
197
|
}
|
|
198
198
|
const projectDetails = yield projectApi
|
|
@@ -200,19 +200,19 @@ exports.default = ({ optional = false, resolveOnNotFound = false, skipOrgCheck =
|
|
|
200
200
|
.catch((err) => __awaiter(void 0, void 0, void 0, function* () {
|
|
201
201
|
if (js_1.JS.hasIn(err, 'context.response.statusCode')) {
|
|
202
202
|
switch (err.context.response.statusCode) {
|
|
203
|
+
case 401:
|
|
203
204
|
case 404: {
|
|
204
|
-
(0, logger_1.message)('cleaning up ' +
|
|
205
|
-
constants_1.FILENAME.rc +
|
|
206
|
-
' since the current active project for this folder is not found in remote');
|
|
207
|
-
yield (0, project_2.removeProject)(finalProjectObj.id + '');
|
|
208
205
|
if (resolveOnNotFound) {
|
|
209
206
|
finalProjectObj = undefined;
|
|
210
207
|
return;
|
|
211
208
|
}
|
|
212
|
-
throw new error_1.default('
|
|
209
|
+
throw new error_1.default('no access to project: ' + (finalProjectObj === null || finalProjectObj === void 0 ? void 0 : finalProjectObj.id), {
|
|
213
210
|
exit: 1,
|
|
214
211
|
errorId: 'RC-5',
|
|
215
|
-
arg: [
|
|
212
|
+
arg: [
|
|
213
|
+
(0, ansi_colors_1.bold)(`${finalProjectObj === null || finalProjectObj === void 0 ? void 0 : finalProjectObj.name}(${finalProjectObj === null || finalProjectObj === void 0 ? void 0 : finalProjectObj.id})`),
|
|
214
|
+
(0, ansi_colors_1.bold)((0, ansi_colors_1.cyan)('command: ') + 'catalyst init --force')
|
|
215
|
+
]
|
|
216
216
|
});
|
|
217
217
|
}
|
|
218
218
|
case 403: {
|
|
@@ -43,13 +43,14 @@ const logger_1 = require("../../util_modules/logger");
|
|
|
43
43
|
exports.default = new command_1.default('appsail:add')
|
|
44
44
|
.description('Link an already existing AppSail service to Catalyst Project')
|
|
45
45
|
.needs('auth', [constants_1.SCOPE.functions])
|
|
46
|
-
.needs('config')
|
|
46
|
+
.needs('config', { optional: true })
|
|
47
47
|
.needs('rc')
|
|
48
|
+
.ci(false)
|
|
48
49
|
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
50
|
const config = runtime_store_1.default.get('config');
|
|
50
51
|
yield (yield Promise.resolve().then(() => __importStar(require('../../init/features')))).appsail();
|
|
51
52
|
yield config.save();
|
|
52
|
-
(0, logger_1.message)((0, ansi_colors_1.bold)(constants_1.FILENAME.config) + ' file has been successfully updated with
|
|
53
|
+
(0, logger_1.message)((0, ansi_colors_1.bold)(constants_1.FILENAME.config) + ' file has been successfully updated with appsail details.');
|
|
53
54
|
(0, logger_1.info)();
|
|
54
55
|
(0, logger_1.success)('AppSail service successfully linked');
|
|
55
56
|
}));
|
|
@@ -43,8 +43,9 @@ const logger_1 = require("../../util_modules/logger");
|
|
|
43
43
|
exports.default = new command_1.default('client:setup')
|
|
44
44
|
.description('Set up and configure the client directory in your project directory')
|
|
45
45
|
.needs('auth', [constants_1.SCOPE.webapp])
|
|
46
|
-
.needs('config')
|
|
46
|
+
.needs('config', { optional: true })
|
|
47
47
|
.needs('rc')
|
|
48
|
+
.ci(false)
|
|
48
49
|
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
50
|
const config = runtime_store_1.default.get('config');
|
|
50
51
|
yield (yield Promise.resolve().then(() => __importStar(require('../../init/features')))).client();
|
|
@@ -32,7 +32,7 @@ exports.default = new command_1.default('codelib:install [git-url]')
|
|
|
32
32
|
.description('Install the code library functionalities into your project')
|
|
33
33
|
.option('-c, --continue <install-id>', 'Continue CodeLib install')
|
|
34
34
|
.needs('auth', [constants_1.SCOPE.project_import_create])
|
|
35
|
-
.needs('config')
|
|
35
|
+
.needs('config', { optional: true })
|
|
36
36
|
.needs('rc')
|
|
37
37
|
.action((gitUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
38
|
var _a;
|
|
@@ -72,7 +72,10 @@ exports.default = new command_1.default('codelib:install [git-url]')
|
|
|
72
72
|
if (!gitUrl) {
|
|
73
73
|
throw new error_1.default('Invalid code lib', { exit: 2 });
|
|
74
74
|
}
|
|
75
|
-
|
|
75
|
+
throw new error_1.default(`Error while downloading codelib.`, {
|
|
76
|
+
exit: 2,
|
|
77
|
+
original: `Occurred while processing ${gitUrl}`
|
|
78
|
+
});
|
|
76
79
|
}
|
|
77
80
|
const templateFile = yield (0, code_deck_1.getTemplateFile)(deckZip);
|
|
78
81
|
const templateJson = JSON.parse(templateFile || '');
|
|
@@ -134,6 +137,7 @@ exports.default = new command_1.default('codelib:install [git-url]')
|
|
|
134
137
|
}
|
|
135
138
|
const templateFns = (((_a = templateJson.components) === null || _a === void 0 ? void 0 : _a.Functions) || []);
|
|
136
139
|
if (templateFns.length > 0) {
|
|
140
|
+
yield new Promise((res) => setTimeout(res, 5000));
|
|
137
141
|
yield (0, functions_1.default)(templateFns.map((fn) => fn.name));
|
|
138
142
|
(0, features_1.setCatalystConfig)('functions', true);
|
|
139
143
|
const config = runtime_store_1.default.get('config');
|
|
@@ -45,6 +45,7 @@ exports.default = new command_1.default('ds:import [file]')
|
|
|
45
45
|
.needs('config', { optional: true })
|
|
46
46
|
.needs('rc', { optional: true })
|
|
47
47
|
.action((uploadFile) => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
+
var _a, _b, _c;
|
|
48
49
|
const env = (0, option_1.getOptionValue)('production', false) ? 'Production' : 'Development';
|
|
49
50
|
const configPath = (0, option_1.getOptionValue)('config', false);
|
|
50
51
|
const importConfig = configPath ? yield getWriteConfigFromPath(configPath) : {};
|
|
@@ -52,44 +53,59 @@ exports.default = new command_1.default('ds:import [file]')
|
|
|
52
53
|
if (!tableId) {
|
|
53
54
|
throw new error_1.default('Table identifier missing', { exit: 0, errorId: 'IMP-1' });
|
|
54
55
|
}
|
|
55
|
-
if (!importConfig.file_id) {
|
|
56
|
+
if (!importConfig.file_id && !((_a = importConfig.object_details) === null || _a === void 0 ? void 0 : _a.object_key)) {
|
|
56
57
|
if (!uploadFile) {
|
|
57
58
|
throw new error_1.default('No CSV file provided', { exit: 0, errorId: 'IMP-2' });
|
|
58
59
|
}
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
62
|
-
const choices =
|
|
63
|
-
value:
|
|
60
|
+
const bucketAPI = yield (0, endpoints_1.stratusAPI)({ env });
|
|
61
|
+
const allBuckets = (yield bucketAPI.getAllBuckets());
|
|
62
|
+
if (allBuckets.length > 0) {
|
|
63
|
+
const choices = allBuckets.map((bucketDetail) => prompt_1.default.choice(bucketDetail.bucket_name, {
|
|
64
|
+
value: bucketDetail
|
|
64
65
|
}));
|
|
65
|
-
const
|
|
66
|
+
const bucketAns = yield prompt_1.default.ask(prompt_1.default.question('bucket', 'Select a bucket to which you want to upload the object to : ', {
|
|
66
67
|
type: 'list',
|
|
67
68
|
choices,
|
|
68
|
-
when: !importConfig.
|
|
69
|
+
when: !((_b = importConfig.object_details) === null || _b === void 0 ? void 0 : _b.bucket_name)
|
|
69
70
|
}));
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
const bucket = bucketAns.bucket;
|
|
72
|
+
const bucketName = bucket.bucket_name === undefined
|
|
73
|
+
? allBuckets.find((bucketDetails) => {
|
|
74
|
+
var _a;
|
|
75
|
+
return bucketDetails.bucket_name ===
|
|
76
|
+
((_a = importConfig.object_details) === null || _a === void 0 ? void 0 : _a.bucket_name);
|
|
77
|
+
})
|
|
78
|
+
: bucket.bucket_name;
|
|
79
|
+
if (!bucketName) {
|
|
80
|
+
throw new error_1.default('Bucket not present', {
|
|
77
81
|
exit: 1,
|
|
78
82
|
errorId: 'IMP-4',
|
|
79
83
|
arg: [
|
|
80
|
-
ansi_colors_1.bold.red(importConfig.
|
|
84
|
+
ansi_colors_1.bold.red(((_c = importConfig.object_details) === null || _c === void 0 ? void 0 : _c.bucket_name) || ''),
|
|
81
85
|
(0, ansi_colors_1.italic)(configPath || ''),
|
|
82
86
|
(0, ansi_colors_1.bold)(uploadFile),
|
|
83
|
-
(0, ansi_colors_1.bold)('
|
|
84
|
-
(0, ansi_colors_1.italic)('
|
|
87
|
+
(0, ansi_colors_1.bold)('Details(bucket_name and object_key)'),
|
|
88
|
+
(0, ansi_colors_1.italic)('object_details')
|
|
85
89
|
]
|
|
86
90
|
});
|
|
87
91
|
}
|
|
88
|
-
|
|
89
|
-
|
|
92
|
+
try {
|
|
93
|
+
yield bucketAPI.uploadObject(bucketName, uploadFile, fs_1.SYNC.getReadStream((0, path_1.resolve)(uploadFile)));
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
throw new error_1.default('Error while uploading the object to the stratus. Use --verbose for error details', {
|
|
97
|
+
exit: 1,
|
|
98
|
+
original: err
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
const objDetail = {
|
|
102
|
+
bucket_name: bucketName,
|
|
103
|
+
object_key: uploadFile
|
|
104
|
+
};
|
|
105
|
+
importConfig.object_details = objDetail;
|
|
90
106
|
}
|
|
91
107
|
else {
|
|
92
|
-
throw new error_1.default('
|
|
108
|
+
throw new error_1.default('bucket needed', { exit: 0, errorId: 'IMP-3' });
|
|
93
109
|
}
|
|
94
110
|
}
|
|
95
111
|
const bulkAPI = yield (0, endpoints_1.bulkDSAPI)({ env });
|
|
@@ -54,6 +54,7 @@ exports.default = new command_1.default('event:generate <source> <action>')
|
|
|
54
54
|
.needs('auth')
|
|
55
55
|
.action(function generate(source, action) {
|
|
56
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
var _a;
|
|
57
58
|
const unknownArgs = (0, option_1.getUnknownOpts)([]);
|
|
58
59
|
if (unknownArgs.length % 2 !== 0) {
|
|
59
60
|
throw new error_1.default('Unknown options are not provided as key value pairs', {
|
|
@@ -148,10 +149,22 @@ exports.default = new command_1.default('event:generate <source> <action>')
|
|
|
148
149
|
break;
|
|
149
150
|
case 'action':
|
|
150
151
|
const eventRefArr = constants_1.EVENT_REF[remoteSourceName];
|
|
151
|
-
const remoteRefAction = action
|
|
152
|
+
const remoteRefAction = action
|
|
153
|
+
.split('_')
|
|
154
|
+
.map((act) => act.charAt(0).toUpperCase() + act.slice(1))
|
|
155
|
+
.join(' ');
|
|
152
156
|
(0, logger_1.debug)(`action provided is : ${remoteRefAction}`);
|
|
153
157
|
const indexOfAction = eventRefArr.indexOf(remoteRefAction);
|
|
154
158
|
if (indexOfAction < 0) {
|
|
159
|
+
const availableActions = eventRefArr
|
|
160
|
+
.map((act) => {
|
|
161
|
+
act = act
|
|
162
|
+
.split(' ')
|
|
163
|
+
.map((act) => act.charAt(0).toUpperCase() + act.slice(1))
|
|
164
|
+
.join('_');
|
|
165
|
+
return '* ' + act;
|
|
166
|
+
})
|
|
167
|
+
.join('\n');
|
|
155
168
|
throw new error_1.default('Action incompatible with the source ' + eventRefArr, {
|
|
156
169
|
exit: 1,
|
|
157
170
|
errorId: 'IDX-6',
|
|
@@ -159,7 +172,7 @@ exports.default = new command_1.default('event:generate <source> <action>')
|
|
|
159
172
|
(0, ansi_colors_1.bold)(action),
|
|
160
173
|
ansi_colors_1.bold.red('X'),
|
|
161
174
|
(0, ansi_colors_1.bold)(source),
|
|
162
|
-
(0, ansi_colors_1.bold)(
|
|
175
|
+
(0, ansi_colors_1.bold)(availableActions)
|
|
163
176
|
]
|
|
164
177
|
});
|
|
165
178
|
}
|
|
@@ -175,7 +188,7 @@ exports.default = new command_1.default('event:generate <source> <action>')
|
|
|
175
188
|
break;
|
|
176
189
|
}
|
|
177
190
|
});
|
|
178
|
-
const sourceModule = (yield Promise.resolve().then(() => __importStar(require(
|
|
191
|
+
const sourceModule = (yield (_a = '../../../event_generate/' + source, Promise.resolve().then(() => __importStar(require(_a))))).default;
|
|
179
192
|
eventJsonContent = yield sourceModule(eventJsonContent, optionMap, action);
|
|
180
193
|
const jsonContent = JSON.parse(eventJsonContent);
|
|
181
194
|
Object.keys(jsonContent).forEach((key) => {
|
|
@@ -46,6 +46,7 @@ exports.default = new command_1.default('event:generate:integ <service>')
|
|
|
46
46
|
.needs('rc')
|
|
47
47
|
.needs('auth')
|
|
48
48
|
.action((service) => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
+
var _a;
|
|
49
50
|
const availableServices = Object.keys(constants_1.INTEG.service_map);
|
|
50
51
|
if (!availableServices.includes(service)) {
|
|
51
52
|
throw new error_1.default('Unknown service requested', {
|
|
@@ -56,7 +57,7 @@ exports.default = new command_1.default('event:generate:integ <service>')
|
|
|
56
57
|
}
|
|
57
58
|
const inputs = (0, option_1.getOptionValue)('inputs', '');
|
|
58
59
|
const serviceValue = constants_1.INTEG.service_map[service];
|
|
59
|
-
const serviceModule = (yield Promise.resolve().then(() => __importStar(require(
|
|
60
|
+
const serviceModule = (yield (_a = `../../../event_generate/integration/${serviceValue}`, Promise.resolve().then(() => __importStar(require(_a)))))
|
|
60
61
|
.default;
|
|
61
62
|
const payload = yield serviceModule(inputs);
|
|
62
63
|
process.stdout.write(payload + '\n');
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const ansi_colors_1 = require("ansi-colors");
|
|
16
|
+
const endpoints_1 = require("../../../endpoints");
|
|
17
|
+
const error_1 = __importDefault(require("../../../error"));
|
|
18
|
+
const command_1 = __importDefault(require("../../../internal/command"));
|
|
19
|
+
const prompt_1 = __importDefault(require("../../../prompt"));
|
|
20
|
+
const constants_1 = require("../../../util_modules/constants");
|
|
21
|
+
const fs_1 = require("../../../util_modules/fs");
|
|
22
|
+
const project_1 = require("../../../util_modules/project");
|
|
23
|
+
exports.default = new command_1.default('event:generate:job [jobpool_id]')
|
|
24
|
+
.description('Generate sample payloads for job functions')
|
|
25
|
+
.needs('rc')
|
|
26
|
+
.needs('auth')
|
|
27
|
+
.action((jobpoolId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
+
if (!fs_1.ASYNC.fileExists(constants_1.TEMPLATE.job_data)) {
|
|
29
|
+
throw new error_1.default('Could not read request template', { exit: 2 });
|
|
30
|
+
}
|
|
31
|
+
const jobData = yield fs_1.ASYNC.readFile(constants_1.TEMPLATE.job_data);
|
|
32
|
+
const jobDataJson = JSON.parse(jobData || '');
|
|
33
|
+
const jobpoolAPI = yield (0, endpoints_1.jobScheduling)();
|
|
34
|
+
const jobpoolDetails = jobpoolId
|
|
35
|
+
? yield jobpoolAPI.getJobpoolDetails(jobpoolId)
|
|
36
|
+
: yield (() => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
+
const allJobpoolDetails = yield jobpoolAPI.getJobpoolDetails();
|
|
38
|
+
if (allJobpoolDetails.length === 0) {
|
|
39
|
+
throw new error_1.default('No jobpool present in development environment', {
|
|
40
|
+
exit: 1,
|
|
41
|
+
errorId: 'JOB-1',
|
|
42
|
+
arg: [
|
|
43
|
+
(0, ansi_colors_1.bold)(`${(0, project_1.getProjectName)()} (${(0, project_1.getProjectId)()})`),
|
|
44
|
+
ansi_colors_1.italic.underline(`${constants_1.ORIGIN.console}/baas/${(0, project_1.getEnvId)()}/project/${(0, project_1.getProjectId)()}/Development#/jobscheduling/jobpool`)
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
const jobpoolChoices = allJobpoolDetails.reduce((poolChoices, _pool) => {
|
|
49
|
+
if (_pool.type !== 'Function') {
|
|
50
|
+
return poolChoices;
|
|
51
|
+
}
|
|
52
|
+
poolChoices.push(prompt_1.default.choice(`${_pool.name} [${_pool.id}]`, {
|
|
53
|
+
value: _pool,
|
|
54
|
+
short: _pool.name
|
|
55
|
+
}));
|
|
56
|
+
return poolChoices;
|
|
57
|
+
}, []);
|
|
58
|
+
if (jobpoolChoices.length === 0) {
|
|
59
|
+
throw new error_1.default('No valid function jobpool available in the development environment', {
|
|
60
|
+
exit: 1,
|
|
61
|
+
errorId: 'JOB-2',
|
|
62
|
+
arg: [
|
|
63
|
+
(0, ansi_colors_1.bold)(`${(0, project_1.getProjectName)()} (${(0, project_1.getProjectId)()})`),
|
|
64
|
+
ansi_colors_1.italic.underline(`${constants_1.ORIGIN.console}/baas/${(0, project_1.getEnvId)()}/project/${(0, project_1.getProjectId)()}/Development#/jobscheduling/jobpool`)
|
|
65
|
+
]
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
const jobpoolQuestion = yield prompt_1.default.ask(prompt_1.default.question('details', "Please choose one of the function jobpool's to generate the data", {
|
|
69
|
+
type: 'list',
|
|
70
|
+
choices: jobpoolChoices
|
|
71
|
+
}));
|
|
72
|
+
return jobpoolQuestion.details;
|
|
73
|
+
}))();
|
|
74
|
+
if (jobpoolDetails.type !== 'Function') {
|
|
75
|
+
throw new error_1.default(`The jobpool ${jobpoolId || jobpoolDetails.name || jobpoolDetails.id} is not a function jobpool`, {
|
|
76
|
+
exit: 1
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
jobDataJson.job_details.job_meta_details.jobpool_id = jobpoolDetails.id;
|
|
80
|
+
jobDataJson.job_details.job_meta_details.jobpool_details = jobpoolDetails;
|
|
81
|
+
process.stdout.write(JSON.stringify(jobDataJson, null, ' ') + '\n');
|
|
82
|
+
}));
|
|
@@ -43,8 +43,9 @@ const logger_1 = require("../../util_modules/logger");
|
|
|
43
43
|
exports.default = new command_1.default('functions:add')
|
|
44
44
|
.description('Add a function of the required stack to the function directory')
|
|
45
45
|
.needs('auth', [constants_1.SCOPE.functions])
|
|
46
|
-
.needs('config')
|
|
46
|
+
.needs('config', { optional: true })
|
|
47
47
|
.needs('rc')
|
|
48
|
+
.ci(false)
|
|
48
49
|
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
50
|
const config = runtime_store_1.default.get('config');
|
|
50
51
|
yield (yield Promise.resolve().then(() => __importStar(require('../../init/features')))).functions(true);
|
|
@@ -199,10 +199,8 @@ exports.default = new command_1.default('functions:delete [function_name_or_id]'
|
|
|
199
199
|
if (fn.location === remote && fn.id !== undefined) {
|
|
200
200
|
return fnApi.delete(fn.id + '');
|
|
201
201
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
return (0, common_1.deleteFunctionLocal)(fn.source);
|
|
205
|
-
}
|
|
202
|
+
if (fn.source) {
|
|
203
|
+
return (0, common_1.deleteFunctionLocal)(fn.source);
|
|
206
204
|
}
|
|
207
205
|
return;
|
|
208
206
|
}));
|