zcatalyst-cli 1.16.0 → 1.16.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.
@@ -32,8 +32,8 @@ const js_1 = require("../util_modules/js");
32
32
  const logger_1 = require("../util_modules/logger");
33
33
  const option_1 = require("../util_modules/option");
34
34
  exports.missingScopes = {
35
- [constants_1.DC_TYPE.au.value]: ['zia_hub'],
36
- [constants_1.DC_TYPE.eu.value]: ['zia_hub']
35
+ [constants_1.DC_TYPE.au.value]: ['quick_ml'],
36
+ [constants_1.DC_TYPE.eu.value]: ['quick_ml']
37
37
  };
38
38
  class Login {
39
39
  constructor(localhost = true, user = true) {
@@ -348,7 +348,7 @@ class Login {
348
348
  }
349
349
  }));
350
350
  const destroyer = new server_js_1.ConnectionDestroyer(server);
351
- server.listen(port, () => {
351
+ server.listen(port, '127.0.0.1', () => {
352
352
  (0, logger_1.info)();
353
353
  (0, logger_1.info)('Visit this URL on this device to log in:');
354
354
  (0, logger_1.info)(ansi_colors_1.bold.underline(authUrl));
@@ -53,6 +53,6 @@ exports.default = (inScopes = []) => {
53
53
  });
54
54
  }
55
55
  runtime_store_1.default.set('auth_scopes', requiredScopes);
56
- runtime_store_1.default.set('user', config_store_1.default.get(`${activeDC}.user`, null));
57
- runtime_store_1.default.set('credential', credential_1.default.init(tokenObj.token, tokenObj.temp));
56
+ runtime_store_1.default.set('user', config_store_1.default.get(`${activeDC}.user`));
57
+ runtime_store_1.default.set('credential', credential_1.default.initToken(tokenObj.token, tokenObj.temp));
58
58
  };
@@ -26,9 +26,14 @@ const option_1 = require("../util_modules/option");
26
26
  const project_2 = require("../util_modules/project");
27
27
  const config_store_1 = __importDefault(require("../config-store"));
28
28
  const dc_1 = require("../dc");
29
+ const env_1 = require("../util_modules/env");
29
30
  exports.default = ({ optional = false, resolveOnNotFound = false, skipOrgCheck = true } = {}) => __awaiter(void 0, void 0, void 0, function* () {
30
- const orgOpt = (0, option_1.getGlobalOptionValue)('org', null);
31
- const projectOpt = (0, option_1.getGlobalOptionValue)('project', null);
31
+ const globOrgOpt = (0, option_1.getGlobalOptionValue)('org', null);
32
+ const orgOpt = globOrgOpt ? globOrgOpt : (0, env_1.getEnvVariable)('CATALYST_ORG', null);
33
+ const globProjectOpt = (0, option_1.getGlobalOptionValue)('project', null);
34
+ const projectOpt = globProjectOpt
35
+ ? globProjectOpt
36
+ : (0, env_1.getEnvVariable)('CATALYST_PROJECT', null);
32
37
  if (projectOpt !== null && orgOpt === null) {
33
38
  throw new error_1.default('Org option is needed when project option is supplied', {
34
39
  exit: 2
@@ -106,7 +106,7 @@ const ensureUserAction = (deployRes) => __awaiter(void 0, void 0, void 0, functi
106
106
  }
107
107
  }));
108
108
  const destroyer = new server_js_1.ConnectionDestroyer(server);
109
- server.listen(callbackPort, () => {
109
+ server.listen(callbackPort, '127.0.0.1', () => {
110
110
  const urlString = accessUrl.toString();
111
111
  (0, logger_1.info)();
112
112
  (0, logger_1.info)('Visit this URL on this device to proceed:');
@@ -49,7 +49,7 @@ exports.default = new command_1.default('serve')
49
49
  .option('--except <targets>', 'serve all targets except specified (e.g. "client")')
50
50
  .option('--ignore-scripts', 'ignore the pre and post lifescycle scripts')
51
51
  .option('--no-open', 'disable opening the client automatically when served')
52
- .needs('auth', [constants_1.SCOPE.functions, constants_1.SCOPE.functions_execution, constants_1.SCOPE.webapp])
52
+ .needs('auth', [constants_1.SCOPE.functions, constants_1.SCOPE.functions_execution, constants_1.SCOPE.webapp, constants_1.SCOPE.pdf_shot])
53
53
  .needs('config')
54
54
  .needs('rc')
55
55
  .action(() => __awaiter(void 0, void 0, void 0, function* () {
@@ -9,6 +9,10 @@ exports.default = (proxyInstance, customProxyUrl) => (req, res) => {
9
9
  if (req.url.length === 1 && req.url.startsWith('/')) {
10
10
  res.redirect('/app/');
11
11
  }
12
+ else if (req.url.match(/accounts\/p\/[0-9]+\/clientidprequest/g)) {
13
+ res.redirect(308, `https://${req.headers['x-zc-project-domain']}${req.url}`);
14
+ return;
15
+ }
12
16
  else if (typeof customProxyUrl === 'string' &&
13
17
  !req.url.match(/^(\/baas|\/app|\/server|\/oauthorize|\/__catalyst).*/g)) {
14
18
  (0, logger_1.debug)(`proxying "${req.url}" to "${customProxyUrl}"`);
@@ -182,6 +182,13 @@ class Credential {
182
182
  get createdTime() {
183
183
  return this.cTime;
184
184
  }
185
+ static initToken(token, temp = false) {
186
+ if (token.slice(1, 2) !== '_' && !Credential.crypt.isEncrypted(token)) {
187
+ Credential.oneTimeToken = token;
188
+ return Credential.oneTimeToken;
189
+ }
190
+ return this.init(token, temp);
191
+ }
185
192
  static init(token, temp = false) {
186
193
  let tokenObj;
187
194
  if (typeof token === 'string') {
@@ -116,6 +116,7 @@ function spinUpMaster(listenPort, otherServerDetails) {
116
116
  });
117
117
  app.use('*/.catalyst%2Freload-script.js', (req, res) => {
118
118
  var _a;
119
+ req.url = '/.catalyst%2Freload-script.js';
119
120
  (_a = otherServerDetails.client) === null || _a === void 0 ? void 0 : _a.forEach((clientDetails) => {
120
121
  const appTarget = `http://127.0.0.1:${clientDetails.httpPort}/app/`;
121
122
  proxy.web(req, res, {
@@ -266,9 +267,8 @@ function spinUpMaster(listenPort, otherServerDetails) {
266
267
  case 'appSail': {
267
268
  (_d = otherServerDetails.appSail) === null || _d === void 0 ? void 0 : _d.forEach((appSailDetails) => {
268
269
  app.use('/', (req, res) => {
269
- var _a, _b, _c;
270
- if ((_b = (_a = appSailDetails.target) === null || _a === void 0 ? void 0 : _a.url) === null || _b === void 0 ? void 0 : _b.includes('/__catalyst/sdk/init.js')) {
271
- req.url = (_c = appSailDetails.target) === null || _c === void 0 ? void 0 : _c.url;
270
+ var _a;
271
+ if ((_a = req.url) === null || _a === void 0 ? void 0 : _a.includes('/__catalyst/sdk/init.js')) {
272
272
  (0, unknownReqProxy_1.default)(proxy, customProxyUrl)(req, res);
273
273
  }
274
274
  else {
@@ -290,7 +290,7 @@ function spinUpMaster(listenPort, otherServerDetails) {
290
290
  });
291
291
  app.use('/', (0, unknownReqProxy_1.default)(proxy, customProxyUrl));
292
292
  app.use(error_handler_1.default);
293
- const expressServer = app.listen(listenPort).on('error', (err) => {
293
+ const expressServer = app.listen(listenPort, '127.0.0.1').on('error', (err) => {
294
294
  if (proxy) {
295
295
  proxyDestroyer.destroy();
296
296
  }
@@ -69,7 +69,7 @@ const browserLogicHandler = async (req, res) => {
69
69
 
70
70
  const server = createServer(type === 'browserlogic' ? browserLogicHandler : aioHandler);
71
71
 
72
- server.listen(listenPort).on('error', (err) => {
72
+ server.listen(listenPort, '127.0.0.1').on('error', (err) => {
73
73
  // eslint-disable-next-line no-console
74
74
  console.error(err);
75
75
  });
@@ -174,7 +174,7 @@ function webClientServer(httpPort, source, { homepage = 'index.html', enableWatc
174
174
  res.send('Error fetching the resource');
175
175
  });
176
176
  }));
177
- const server = app.listen(httpPort).on('error', (err) => {
177
+ const server = app.listen(httpPort, '127.0.0.1').on('error', (err) => {
178
178
  eventListener.emit('error', err);
179
179
  });
180
180
  const expressDestroyer = new server_js_1.ConnectionDestroyer(server);
@@ -326,7 +326,7 @@ class HttpFunctions {
326
326
  }
327
327
  });
328
328
  return new Promise((res) => {
329
- const server = this.app.listen(httpPort, () => {
329
+ const server = this.app.listen(httpPort, '127.0.0.1', () => {
330
330
  this.targets.forEach((target) => {
331
331
  var _a, _b;
332
332
  (_a = target.watcher) === null || _a === void 0 ? void 0 : _a.on('preparing', () => {
@@ -23,6 +23,6 @@ exports.default = Object.freeze({
23
23
  plugin: 'zcatalyst-cli-plugin-angular',
24
24
  runner_command: ['ng', 'new'],
25
25
  collection_name: 'zcatalyst-angular-schematics',
26
- runner_package: '@angular/cli@v12-lts'
26
+ runner_package: '@angular/cli@v15-lts'
27
27
  }
28
28
  });
@@ -47,7 +47,9 @@ exports.default = Object.freeze({
47
47
  notification_web: 'ZohoCatalyst.notifications.web',
48
48
  search_read: 'ZohoCatalyst.search.READ',
49
49
  zia: 'ZohoCatalyst.mlkit.READ',
50
- zia_hub: 'ZiaHub.deployment.READ',
50
+ quick_ml: 'QuickML.deployment.READ',
51
+ pdf_shot: 'ZohoCatalyst.pdfshot.execute',
52
+ dataverse: 'ZohoCatalyst.dataverse.execute',
51
53
  circuits_execute: 'ZohoCatalyst.circuits.execute',
52
54
  circuits_exe_read: 'ZohoCatalyst.circuits.execution.READ',
53
55
  circuits_exe_delete: 'ZohoCatalyst.circuits.execution.DELETE',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zcatalyst-cli",
3
- "version": "1.16.0",
3
+ "version": "1.16.1",
4
4
  "description": "Command Line Tool for CATALYST",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -21,8 +21,8 @@
21
21
  "functions",
22
22
  "zcatalyst"
23
23
  ],
24
- "author": "Catalyst (https://www.zoho.com/catalyst/)",
25
- "homepage": "https://www.zoho.com/catalyst/",
24
+ "author": "Catalyst (https://catalyst.zoho.com)",
25
+ "homepage": "https://catalyst.zoho.com",
26
26
  "license": "MIT",
27
27
  "dependencies": {
28
28
  "ansi-colors": "^4.1.1",
@@ -57,7 +57,7 @@
57
57
  "ws": "^8.5.0",
58
58
  "xml2js": "^0.4.23",
59
59
  "yaml": "^2.0.1",
60
- "zcatalyst-angular-schematics": "^0.1.0"
60
+ "zcatalyst-angular-schematics": "^1.0.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/app-module-path": "^2.2.0",