zcatalyst-cli 1.18.0-beta.1 → 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/zest/generate/index.toml +4 -0
- package/docs/serve/server/lib/appsail/index.toml +22 -1
- package/lib/authentication/login.js +8 -4
- package/lib/code-deck.js +7 -7
- package/lib/command_needs/rc.js +7 -7
- package/lib/commands/appsail/add.js +2 -2
- package/lib/commands/client/setup.js +1 -1
- package/lib/commands/codelib/install.js +6 -2
- package/lib/commands/ds/import.js +37 -21
- package/lib/commands/event/generate/index.js +14 -2
- package/lib/commands/functions/add.js +1 -1
- package/lib/commands/functions/setup.js +1 -1
- package/lib/commands/iac/export.js +5 -1
- package/lib/commands/iac/import.js +4 -1
- package/lib/commands/index.js +1 -0
- package/lib/commands/init.js +8 -1
- package/lib/commands/zest/generate/index.js +304 -0
- package/lib/deploy/features/appsail/index.js +25 -10
- package/lib/endpoints/index.js +17 -3
- package/lib/endpoints/lib/ds-bulk.js +1 -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/fn-utils/lib/common.js +6 -1
- package/lib/iac/status/deploy.js +1 -5
- package/lib/init/features/appsail/index.js +34 -27
- package/lib/init/features/project.js +6 -15
- package/lib/internal/api.js +14 -6
- package/lib/internal/command.js +1 -1
- 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/serve/features/appsail.js +1 -1
- package/lib/serve/server/index.js +44 -14
- package/lib/serve/server/lib/appsail/index.js +73 -13
- 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 +1 -1
- package/lib/serve/server/lib/master/appsail.js +3 -3
- package/lib/serve/server/lib/master/unknown-req-proxy.js +5 -2
- package/lib/serve/server/lib/master/utils.js +27 -15
- package/lib/serve/server/lib/node/index.js +1 -1
- package/lib/serve/server/lib/node/server/package-lock.json +12 -0
- package/lib/serve/server/lib/python/index.js +1 -1
- package/lib/shell/dependencies/http-functions.js +1 -1
- package/lib/shell/dependencies/invoker/bio/java/lib/{catalyst-function-sdk-1.0.0.jar → 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.0.0.jar → catalyst-function-sdk-1.1.0.jar} +0 -0
- package/lib/shell/dependencies/invoker/event/java/lib/{catalyst-function-sdk-1.0.0.jar → catalyst-function-sdk-1.1.0.jar} +0 -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 +15 -1
- package/lib/shell/dependencies/invoker/job/java/lib/catalyst-function-sdk-1.1.0.jar +0 -0
- package/lib/shell/dependencies/local-function.js +24 -23
- package/lib/shell/dependencies/tunnel-server.js +52 -23
- package/lib/shell/index.js +22 -28
- package/lib/util_modules/config/lib/appsail.js +10 -8
- package/lib/util_modules/constants/lib/dc-type.js +8 -0
- 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/placeholders.js +2 -1
- package/lib/util_modules/constants/lib/scopes.js +14 -3
- package/lib/util_modules/constants/lib/urls.js +8 -0
- package/lib/util_modules/fs/lib/async.js +7 -2
- package/package.json +4 -2
- 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/sample.java +1 -1
- package/templates/init/functions/node/aio/sample.js +7 -0
- 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/sample.js +5 -0
- package/templates/init/functions/node/cron/types/cron.d.ts +64 -0
- 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/job/sample.js +0 -1
- package/templates/init/functions/node/job/types/job.d.ts +0 -4
- package/templates/init/functions/python/job/sample.py +0 -1
- package/templates/init.txt +2 -1
- package/lib/shell/dependencies/invoker/integ/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
- package/lib/shell/dependencies/invoker/job/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
|
@@ -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'
|
|
@@ -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 = ''
|
|
@@ -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/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
|
@@ -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,14 +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
48
|
.ci(false)
|
|
49
49
|
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
50
50
|
const config = runtime_store_1.default.get('config');
|
|
51
51
|
yield (yield Promise.resolve().then(() => __importStar(require('../../init/features')))).appsail();
|
|
52
52
|
yield config.save();
|
|
53
|
-
(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.');
|
|
54
54
|
(0, logger_1.info)();
|
|
55
55
|
(0, logger_1.success)('AppSail service successfully linked');
|
|
56
56
|
}));
|
|
@@ -43,7 +43,7 @@ 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
48
|
.ci(false)
|
|
49
49
|
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -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 });
|
|
@@ -149,10 +149,22 @@ exports.default = new command_1.default('event:generate <source> <action>')
|
|
|
149
149
|
break;
|
|
150
150
|
case 'action':
|
|
151
151
|
const eventRefArr = constants_1.EVENT_REF[remoteSourceName];
|
|
152
|
-
const remoteRefAction = action
|
|
152
|
+
const remoteRefAction = action
|
|
153
|
+
.split('_')
|
|
154
|
+
.map((act) => act.charAt(0).toUpperCase() + act.slice(1))
|
|
155
|
+
.join(' ');
|
|
153
156
|
(0, logger_1.debug)(`action provided is : ${remoteRefAction}`);
|
|
154
157
|
const indexOfAction = eventRefArr.indexOf(remoteRefAction);
|
|
155
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');
|
|
156
168
|
throw new error_1.default('Action incompatible with the source ' + eventRefArr, {
|
|
157
169
|
exit: 1,
|
|
158
170
|
errorId: 'IDX-6',
|
|
@@ -160,7 +172,7 @@ exports.default = new command_1.default('event:generate <source> <action>')
|
|
|
160
172
|
(0, ansi_colors_1.bold)(action),
|
|
161
173
|
ansi_colors_1.bold.red('X'),
|
|
162
174
|
(0, ansi_colors_1.bold)(source),
|
|
163
|
-
(0, ansi_colors_1.bold)(
|
|
175
|
+
(0, ansi_colors_1.bold)(availableActions)
|
|
164
176
|
]
|
|
165
177
|
});
|
|
166
178
|
}
|
|
@@ -43,7 +43,7 @@ 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
48
|
.ci(false)
|
|
49
49
|
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -43,7 +43,7 @@ const logger_1 = require("../../util_modules/logger");
|
|
|
43
43
|
exports.default = new command_1.default('functions:setup')
|
|
44
44
|
.description('Set up and configure the function directory in your project directory')
|
|
45
45
|
.needs('auth', [constants_1.SCOPE.functions])
|
|
46
|
-
.needs('config')
|
|
46
|
+
.needs('config', { optional: true })
|
|
47
47
|
.needs('rc')
|
|
48
48
|
.ci(false)
|
|
49
49
|
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -73,7 +73,11 @@ exports.default = new command_1.default('iac:export')
|
|
|
73
73
|
arr.push(allGlobalOpts[key]);
|
|
74
74
|
}
|
|
75
75
|
return arr;
|
|
76
|
-
},
|
|
76
|
+
}, [
|
|
77
|
+
'--org',
|
|
78
|
+
(0, project_1.getEnvId)(),
|
|
79
|
+
...(env === 'Production' ? ['--production'] : [])
|
|
80
|
+
]);
|
|
77
81
|
(0, shell_1.spawn)('catalyst', ['iac:status', 'export', ...optsArr], {
|
|
78
82
|
shell: true,
|
|
79
83
|
stdio: 'inherit'
|
|
@@ -58,6 +58,7 @@ const logger_1 = require("../../util_modules/logger");
|
|
|
58
58
|
const option_1 = require("../../util_modules/option");
|
|
59
59
|
const shell_1 = require("../../util_modules/shell");
|
|
60
60
|
const server_js_1 = require("../../util_modules/server.js");
|
|
61
|
+
const project_1 = require("../../util_modules/project");
|
|
61
62
|
const getZipAndTemplate = (filePath, stagedDeploy) => __awaiter(void 0, void 0, void 0, function* () {
|
|
62
63
|
const zipFile = filePath
|
|
63
64
|
? yield ASYNC.readFile((0, utils_js_1.untildify)(filePath), 'buffer')
|
|
@@ -84,6 +85,8 @@ const ensureUserAction = (deployRes) => __awaiter(void 0, void 0, void 0, functi
|
|
|
84
85
|
const callbackPort = yield port_resolver_1.default.getFreePort(3000, 10, false);
|
|
85
86
|
const accessUrl = new url_1.URL(`/baas/v1/project/import/${deployRes.id}/deploy`, `${constants_1.ORIGIN.admin}`);
|
|
86
87
|
accessUrl.searchParams.set('redirect_url', `http://localhost:${callbackPort}/success`);
|
|
88
|
+
const orgId = (0, project_1.getEnvId)();
|
|
89
|
+
orgId && accessUrl.searchParams.set('catalyst_org', orgId);
|
|
87
90
|
const server = (0, http_1.createServer)((req, resp) => __awaiter(void 0, void 0, void 0, function* () {
|
|
88
91
|
try {
|
|
89
92
|
if (req.url !== '/success') {
|
|
@@ -136,7 +139,7 @@ const ensureUserAction = (deployRes) => __awaiter(void 0, void 0, void 0, functi
|
|
|
136
139
|
arr.push(allGlobalOpts[key]);
|
|
137
140
|
}
|
|
138
141
|
return arr;
|
|
139
|
-
}, ['--id', deployRes.id]);
|
|
142
|
+
}, ['--id', deployRes.id, '--org', (0, project_1.getEnvId)() || '']);
|
|
140
143
|
yield (0, shell_1.spawn)('catalyst', ['iac:status', 'import', ...optsArr], {
|
|
141
144
|
shell: true,
|
|
142
145
|
stdio: 'inherit'
|
package/lib/commands/index.js
CHANGED
|
@@ -80,6 +80,7 @@ exports.default = (client) => {
|
|
|
80
80
|
loadCommand('codelib:install'),
|
|
81
81
|
loadCommand('event:generate'),
|
|
82
82
|
loadCommand('event:generate:integ'),
|
|
83
|
+
loadCommand('zest:generate'),
|
|
83
84
|
loadCommand('event:generate:job'),
|
|
84
85
|
loadCommand('serve'),
|
|
85
86
|
loadCommand('deploy'),
|
package/lib/commands/init.js
CHANGED
|
@@ -100,8 +100,15 @@ exports.default = new command_1.default('init [feature]')
|
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
102
|
if (feature !== 'project') {
|
|
103
|
-
|
|
103
|
+
try {
|
|
104
|
+
yield (0, features_1.project)();
|
|
105
|
+
}
|
|
106
|
+
catch (er) {
|
|
107
|
+
(0, logger_1.debug)(er);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
104
110
|
}
|
|
111
|
+
(0, logger_1.info)();
|
|
105
112
|
const featureAns = yield prompt_1.default.ask(prompt_1.default.question('features', 'Which are the features you want to setup for this folder?\n This step is optional! Press ' +
|
|
106
113
|
(0, ansi_colors_1.cyan)('<return> ') +
|
|
107
114
|
'to proceed.\n', {
|