zcatalyst-cli 1.18.0-beta.12 → 1.18.0-beta.14
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/README.md +14 -6
- package/lib/commands/index.js +3 -3
- package/lib/commands/slate/create.js +1 -1
- package/lib/index.js +1 -1
- package/lib/serve/server/lib/master/index.js +1 -1
- package/lib/serve/server/lib/master/slate.js +1 -17
- package/lib/serve/server/lib/master/utils.js +4 -2
- package/lib/util_modules/constants/lib/urls.js +30 -61
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<center>
|
|
2
|
-
<a href="https://
|
|
2
|
+
<a href="https://catalyst.zoho.com/
|
|
3
3
|
<img width="200" height="200" src="https://www.zohowebstatic.com/sites/default/files/catalyst/catalyst-logo.svg">
|
|
4
4
|
</a>
|
|
5
5
|
</center>
|
|
@@ -25,7 +25,7 @@ This is the Catalyst Command Line Interface (CLI) Tool. They can be used to:
|
|
|
25
25
|
- Interact with data in your Catalyst projects via console
|
|
26
26
|
- Deploy code and assets to your Catalyst projects
|
|
27
27
|
|
|
28
|
-
To get started with the Catalyst CLI, you can go through our documentation [CLI documentation](https://
|
|
28
|
+
To get started with the Catalyst CLI, you can go through our documentation [CLI documentation](https://docs.catalyst.zoho.com/en/cli/v1/cli-command-reference/).
|
|
29
29
|
|
|
30
30
|
## Installation
|
|
31
31
|
|
|
@@ -37,7 +37,7 @@ Then you need to install [Node.js](http://nodejs.org/) and [npm](https://npmjs.o
|
|
|
37
37
|
**NOTE**
|
|
38
38
|
|
|
39
39
|
1. Installing Node.js should install npm as well.
|
|
40
|
-
2. The ZCatalyst-CLI is compatible only with node versions >=
|
|
40
|
+
2. The ZCatalyst-CLI is compatible only with node versions >=14.
|
|
41
41
|
|
|
42
42
|
---
|
|
43
43
|
|
|
@@ -55,7 +55,7 @@ This will provide you with the globally accessible `catalyst` command.
|
|
|
55
55
|
|
|
56
56
|
1. If you need to setup the cli in current directory alone use the same command without `-g` option.
|
|
57
57
|
|
|
58
|
-
2. Alternatively you can visit [CLI Installation Documentation](https://
|
|
58
|
+
2. Alternatively you can visit [CLI Installation Documentation](https://docs.catalyst.zoho.com/en/getting-started/installing-catalyst-cli/) for installation instructions.
|
|
59
59
|
|
|
60
60
|
---
|
|
61
61
|
|
|
@@ -69,6 +69,7 @@ Certain command are project specific and for it to work you must be inside a pro
|
|
|
69
69
|
|
|
70
70
|
Command | Description
|
|
71
71
|
------- | -----------
|
|
72
|
+
**help** | Display the command reference or help for a specific command.
|
|
72
73
|
**login** | Log the CLI in to your Catalyst account. *Requires access to a web browser*.
|
|
73
74
|
**whoami** | Print the email address of the user currently logged in.
|
|
74
75
|
**token:generate** | Generate a token to authenticate accessing the CLI from a remote system.
|
|
@@ -96,13 +97,16 @@ Command | Description
|
|
|
96
97
|
**functions:shell** | Launch a node shell to test emulated functions of any stack or type, other than Advanced I/O functions.
|
|
97
98
|
**functions:config** | Perform advanced configurations such as memory allocation on a function in your project.
|
|
98
99
|
**functions:delete** | Delete a function from the remote console or the local directory.
|
|
99
|
-
**appsail:add** | Link an already existing AppSail
|
|
100
|
+
**appsail:add** | Link an already existing AppSail app to Catalyst Project.
|
|
101
|
+
**slate:link** | Configure your existing app in slate service
|
|
102
|
+
**slate:create** | Create a new slate app
|
|
103
|
+
**slate:unlink** | Unlink your existing slate app
|
|
100
104
|
**codelib:install** | Install the code library functionalities into your project.
|
|
101
105
|
**event:generate \| generate:event** | Generate sample payloads from different components or custom event sources to test Event functions.
|
|
102
106
|
**event:generate:integ** | Generate sample payloads for the required integration service to test Integration functions.
|
|
107
|
+
**event:generate:job** | Generate sample payloads to test the job functions
|
|
103
108
|
**serve** | Serve Basic I/O and Advanced I/O functions, and the client, to test them locally.
|
|
104
109
|
**deploy** | Deploy the Catalyst project and project resources to the remote console from the local directory.
|
|
105
|
-
**help** | Display the command reference or help for a specific command.
|
|
106
110
|
**run-script \| run** | Run a particular command script defined in *catalyst.json*.
|
|
107
111
|
**config:set** | Set catalyst configuration as a key value pair.
|
|
108
112
|
**config:get** | Get catalyst config value for the specified key.
|
|
@@ -122,3 +126,7 @@ This is to make sure your local project is upto date with the CLI version that i
|
|
|
122
126
|
### **v1.4.0**
|
|
123
127
|
|
|
124
128
|
- Global configuration file (zcatalyst-cli-nodejs/zcatalyst-cli.json) structure change.
|
|
129
|
+
|
|
130
|
+
### **v1.6.2**
|
|
131
|
+
|
|
132
|
+
- Global configuration file (zcatalyst-cli-nodejs/zcatalyst-cli.json) structure change.
|
package/lib/commands/index.js
CHANGED
|
@@ -49,6 +49,7 @@ exports.default = (client) => {
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
return Promise.all([
|
|
52
|
+
loadCommand('help'),
|
|
52
53
|
loadCommand('login'),
|
|
53
54
|
loadCommand('whoami'),
|
|
54
55
|
loadCommand('token:generate'),
|
|
@@ -72,10 +73,10 @@ exports.default = (client) => {
|
|
|
72
73
|
loadCommand('client:setup'),
|
|
73
74
|
loadCommand('client:delete'),
|
|
74
75
|
loadCommand('functions:setup'),
|
|
75
|
-
loadCommand('functions:delete'),
|
|
76
76
|
loadCommand('functions:add'),
|
|
77
77
|
loadCommand('functions:shell'),
|
|
78
78
|
loadCommand('functions:config'),
|
|
79
|
+
loadCommand('functions:delete'),
|
|
79
80
|
loadCommand('appsail:add'),
|
|
80
81
|
loadCommand('slate:link'),
|
|
81
82
|
loadCommand('slate:create'),
|
|
@@ -83,11 +84,10 @@ exports.default = (client) => {
|
|
|
83
84
|
loadCommand('codelib:install'),
|
|
84
85
|
loadCommand('event:generate'),
|
|
85
86
|
loadCommand('event:generate:integ'),
|
|
86
|
-
loadCommand('zest:generate'),
|
|
87
87
|
loadCommand('event:generate:job'),
|
|
88
|
+
loadCommand('zest:generate'),
|
|
88
89
|
loadCommand('serve'),
|
|
89
90
|
loadCommand('deploy'),
|
|
90
|
-
loadCommand('help'),
|
|
91
91
|
loadCommand('run'),
|
|
92
92
|
loadCommand('config:set'),
|
|
93
93
|
loadCommand('config:get'),
|
|
@@ -41,7 +41,7 @@ const runtime_store_1 = __importDefault(require("../../runtime-store"));
|
|
|
41
41
|
const constants_1 = require("../../util_modules/constants");
|
|
42
42
|
const logger_1 = require("../../util_modules/logger");
|
|
43
43
|
exports.default = new command_1.default('slate:create')
|
|
44
|
-
.description('Configure a new slate
|
|
44
|
+
.description('Configure a new slate app in catalyst')
|
|
45
45
|
.option('--name <app_name>', 'Please provide name for your slate')
|
|
46
46
|
.option('--framework <framework_name>', 'Specify framework name for your slate')
|
|
47
47
|
.option('--template <template_url>', 'Provide template url for your slate')
|
package/lib/index.js
CHANGED
|
@@ -23,6 +23,6 @@ program.helpOption('-h, --help', 'Display help for a Catalyst command');
|
|
|
23
23
|
program.showSuggestionAfterError();
|
|
24
24
|
program.showHelpAfterError(`For more usage information use the ${(0, ansi_colors_1.bold)('catalyst help')} command`);
|
|
25
25
|
program.addHelpText('before', fs_1.SYNC.readFile(constants_1.TEMPLATE.banner, 'utf-8') || '');
|
|
26
|
-
program.addHelpText('afterAll', `\nFor detailed documentations please visit ${(0, ansi_colors_1.underline)('https://
|
|
26
|
+
program.addHelpText('afterAll', `\nFor detailed documentations please visit ${(0, ansi_colors_1.underline)('https://docs.catalyst.zoho.com/en/cli/v1/cli-command-reference/')}`);
|
|
27
27
|
const cli = new client_1.Client(program);
|
|
28
28
|
exports.default = cli;
|
|
@@ -97,7 +97,7 @@ function spinUpMaster(listenPort, { otherServerDetails, appSailDetails, slateDet
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
const proxy = (0, utils_1.createProxyServer)(listenPort);
|
|
100
|
-
const signRedirectUrl = slateDetails ?
|
|
100
|
+
const signRedirectUrl = slateDetails ? '/' : '/app/local-redirect';
|
|
101
101
|
appSailDetails && ((_b = (_a = appSailDetails.target) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.catalyst_auth) === true
|
|
102
102
|
? proxy.on('proxyRes', (0, utils_1.proxyResponseHandler)({
|
|
103
103
|
signInRedirect: appSailDetails.target.config.login_redirect || '/'
|
|
@@ -11,25 +11,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.addSlateRoutes = void 0;
|
|
13
13
|
function addSlateRoutes(app, details, proxy, unknownProxy) {
|
|
14
|
-
app.use('/
|
|
14
|
+
app.use(['/accounts', '/oauthorize', '/__catalyst'], (req, res) => {
|
|
15
15
|
req.url = req.originalUrl;
|
|
16
16
|
unknownProxy(req, res);
|
|
17
|
-
}));
|
|
18
|
-
app.use(['/accounts', '/oauthorize'], (req, res) => {
|
|
19
|
-
req.url = req.originalUrl;
|
|
20
|
-
unknownProxy(req, res);
|
|
21
|
-
});
|
|
22
|
-
app.use('/__catalyst', (req, res) => {
|
|
23
|
-
req.url = req.originalUrl;
|
|
24
|
-
if (req.url.includes('redirect_url')) {
|
|
25
|
-
res.redirect(req.url.split('redirect_url=')[1]);
|
|
26
|
-
}
|
|
27
|
-
else if (req.url.includes('service_url')) {
|
|
28
|
-
res.redirect(req.url.split('service_url=')[1]);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
unknownProxy(req, res);
|
|
32
|
-
}
|
|
33
17
|
});
|
|
34
18
|
app.use('/', (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
35
19
|
if (req.header('catalyst-component') === 'true') {
|
|
@@ -89,9 +89,11 @@ const proxyResponseHandler = ({ systemRoutes, signInRedirect }) => (proxyRes, re
|
|
|
89
89
|
return cookie;
|
|
90
90
|
});
|
|
91
91
|
if (req.url.startsWith('/baas') || req.url.startsWith('/__catalyst')) {
|
|
92
|
-
|
|
92
|
+
const urlParams = new URLSearchParams(req.url.split('?')[1] || '');
|
|
93
|
+
const redirectUrl = urlParams.get('redirect_url') || urlParams.get('service_url') || signInRedirect;
|
|
94
|
+
if (req.url.includes('/signin-redirect') && redirectUrl) {
|
|
93
95
|
if (systemRoutes === undefined) {
|
|
94
|
-
(0, exports.redirectByAuth)(req, res,
|
|
96
|
+
(0, exports.redirectByAuth)(req, res, redirectUrl);
|
|
95
97
|
return;
|
|
96
98
|
}
|
|
97
99
|
const sourceRedirectUrl = Object.keys(systemRoutes).find((sourceUrl) => {
|
|
@@ -7,86 +7,55 @@ const env_js_1 = require("../../env.js");
|
|
|
7
7
|
const dc_js_1 = require("../../../dc.js");
|
|
8
8
|
const dc_type_js_1 = __importDefault(require("./dc-type.js"));
|
|
9
9
|
class URL {
|
|
10
|
+
static get zohoCDN() {
|
|
11
|
+
return (0, env_js_1.envOverride)('ZOHO_CDN', mapDataCenterUrl(URL._zohoCDNBase));
|
|
12
|
+
}
|
|
10
13
|
static get auth() {
|
|
11
|
-
|
|
12
|
-
if (dc === undefined) {
|
|
13
|
-
return URL._auth;
|
|
14
|
-
}
|
|
15
|
-
if (dc.value === dc_type_js_1.default.ca.value) {
|
|
16
|
-
return URL._auth.replace('.zoho.com', '.zohocloud.ca');
|
|
17
|
-
}
|
|
18
|
-
return URL._auth.replace('.com', dc.ext);
|
|
14
|
+
return (0, env_js_1.envOverride)('CATALYST_AUTH_URL', mapDataCenterUrl(URL._authBase));
|
|
19
15
|
}
|
|
20
16
|
static get iamPortal() {
|
|
21
|
-
|
|
22
|
-
if (dc === undefined) {
|
|
23
|
-
return URL._portal;
|
|
24
|
-
}
|
|
25
|
-
return URL._portal.replace('.com', dc.ext);
|
|
17
|
+
return (0, env_js_1.envOverride)('CATALYST_PORTAL_DOMAIN', mapDataCenterUrl(URL._portalBase));
|
|
26
18
|
}
|
|
27
19
|
static get admin() {
|
|
28
|
-
|
|
29
|
-
if (dc === undefined) {
|
|
30
|
-
return URL._admin;
|
|
31
|
-
}
|
|
32
|
-
if (dc.value === dc_type_js_1.default.ca.value) {
|
|
33
|
-
return URL._admin.replace('.zoho.com', '.zohocloud.ca');
|
|
34
|
-
}
|
|
35
|
-
return URL._admin.replace('.com', dc.ext);
|
|
20
|
+
return (0, env_js_1.envOverride)('CATALYST_ADMIN_URL', mapDataCenterUrl(URL._adminBase));
|
|
36
21
|
}
|
|
37
22
|
static get app() {
|
|
38
|
-
|
|
39
|
-
if (dc === undefined) {
|
|
40
|
-
return URL._app;
|
|
41
|
-
}
|
|
42
|
-
return URL._app.replace('.com', dc.ext);
|
|
23
|
+
return (0, env_js_1.envOverride)('CATALYST_APP_URL', mapDataCenterUrl(URL._appBase));
|
|
43
24
|
}
|
|
44
25
|
static get appSailDomain() {
|
|
45
|
-
|
|
46
|
-
if (dc === undefined) {
|
|
47
|
-
return URL._appSailDomain;
|
|
48
|
-
}
|
|
49
|
-
return URL._appSailDomain.replace('.com', dc.ext);
|
|
26
|
+
return (0, env_js_1.envOverride)('CATALYST_APPSAIL_URL', mapDataCenterUrl(URL._appSailDomainBase));
|
|
50
27
|
}
|
|
51
28
|
static get catalystStatic() {
|
|
52
|
-
|
|
53
|
-
if (dc === undefined) {
|
|
54
|
-
return URL._zohoStatic;
|
|
55
|
-
}
|
|
56
|
-
if (dc.value === dc_type_js_1.default.ca.value) {
|
|
57
|
-
return URL._zohoStatic.replace('.zoho.com', '.zohocloud.ca');
|
|
58
|
-
}
|
|
59
|
-
return URL._zohoStatic.replace(dc_type_js_1.default.us.ext, dc.ext);
|
|
29
|
+
return (0, env_js_1.envOverride)('ZOHO_STATIC', mapDataCenterUrl(URL._zohoStaticBase));
|
|
60
30
|
}
|
|
61
31
|
static get console() {
|
|
62
|
-
|
|
63
|
-
if (dc === undefined) {
|
|
64
|
-
return URL._console;
|
|
65
|
-
}
|
|
66
|
-
if (dc.value === dc_type_js_1.default.ca.value) {
|
|
67
|
-
return URL._console.replace('.zoho.com', '.zohocloud.ca');
|
|
68
|
-
}
|
|
69
|
-
return URL._console.replace('.com', dc.ext);
|
|
32
|
+
return (0, env_js_1.envOverride)('CATALYST_CONSOLE_URL', mapDataCenterUrl(URL._consoleBase));
|
|
70
33
|
}
|
|
71
34
|
static get stratusSuffix() {
|
|
72
|
-
|
|
73
|
-
if (dc === undefined) {
|
|
74
|
-
return URL._stratusSuffix;
|
|
75
|
-
}
|
|
76
|
-
return URL._stratusSuffix.replace('.com', dc.ext);
|
|
35
|
+
return (0, env_js_1.envOverride)('CATALYST_STRATUS_RESOURCE_SUFFIX', mapDataCenterUrl(URL._stratusSuffixBase));
|
|
77
36
|
}
|
|
78
37
|
}
|
|
79
38
|
exports.default = URL;
|
|
80
|
-
URL.
|
|
81
|
-
URL.
|
|
82
|
-
URL.
|
|
83
|
-
URL.
|
|
84
|
-
URL.
|
|
85
|
-
URL.
|
|
86
|
-
URL.
|
|
87
|
-
URL.
|
|
88
|
-
URL.
|
|
39
|
+
URL._authBase = 'https://accounts.zoho.com';
|
|
40
|
+
URL._portalBase = 'https://accounts.zohoportal.com';
|
|
41
|
+
URL._adminBase = 'https://api.catalyst.zoho.com';
|
|
42
|
+
URL._appBase = 'https://catalystserverless.com';
|
|
43
|
+
URL._appSailDomainBase = 'https://catalystappsail.com';
|
|
44
|
+
URL._zohoStaticBase = 'https://www.zoho.com/catalyst';
|
|
45
|
+
URL._consoleBase = 'https://console.catalyst.zoho.com';
|
|
46
|
+
URL._stratusSuffixBase = '.zohostratus.com';
|
|
47
|
+
URL._zohoCDNBase = 'https://static.zohocdn.com';
|
|
89
48
|
URL.external = Object.freeze({
|
|
90
49
|
gitHubAPI: 'https://api.github.com',
|
|
91
50
|
gitHubWeb: 'https://github.com'
|
|
92
51
|
});
|
|
52
|
+
function mapDataCenterUrl(url) {
|
|
53
|
+
const dc = (0, dc_js_1.getActiveDCType)();
|
|
54
|
+
if (dc === undefined) {
|
|
55
|
+
return url;
|
|
56
|
+
}
|
|
57
|
+
if (dc.value === dc_type_js_1.default.ca.value && url.includes('.zoho.com')) {
|
|
58
|
+
return url.replace('.zoho.com', '.zohocloud.ca');
|
|
59
|
+
}
|
|
60
|
+
return url.replace(dc_type_js_1.default.us.ext, dc.ext);
|
|
61
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zcatalyst-cli",
|
|
3
|
-
"version": "1.18.0-beta.
|
|
3
|
+
"version": "1.18.0-beta.14",
|
|
4
4
|
"description": "Command Line Tool for CATALYST",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"functions",
|
|
22
22
|
"zcatalyst"
|
|
23
23
|
],
|
|
24
|
-
"author": "Catalyst (https://
|
|
24
|
+
"author": "Catalyst (https://github.com/catalystbyzoho)",
|
|
25
25
|
"homepage": "https://catalyst.zoho.com",
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"dependencies": {
|