zcatalyst-cli 1.17.5 → 1.17.6

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.
@@ -0,0 +1,3 @@
1
+ [ENV-1]
2
+ context = '''The ${arg[0]} environment for the project ${arg[1]} has been ${arg[2]}.'''
3
+ aid = '''Please contact catalyst support at ${arg[3]}'''
@@ -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();
@@ -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', {
@@ -175,7 +176,7 @@ exports.default = new command_1.default('event:generate <source> <action>')
175
176
  break;
176
177
  }
177
178
  });
178
- const sourceModule = (yield Promise.resolve().then(() => __importStar(require('../../../event_generate/' + source)))).default;
179
+ const sourceModule = (yield (_a = '../../../event_generate/' + source, Promise.resolve().then(() => __importStar(require(_a))))).default;
179
180
  eventJsonContent = yield sourceModule(eventJsonContent, optionMap, action);
180
181
  const jsonContent = JSON.parse(eventJsonContent);
181
182
  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(`../../../event_generate/integration/${serviceValue}`))))
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');
@@ -50,7 +50,7 @@ exports.default = new command_1.default('functions:shell')
50
50
  '\n' +
51
51
  '(deprecated: The watch mode will be enabled by default. To disable watch mode use the --no-watch option)')
52
52
  .option('--no-watch', 'disable watching the files for changes')
53
- .needs('auth', [constants_1.SCOPE.functions, constants_1.SCOPE.functions_execution])
53
+ .needs('auth', [constants_1.SCOPE.functions, constants_1.SCOPE.functions_execution, constants_1.SCOPE.custom_token_generation])
54
54
  .needs('config')
55
55
  .needs('rc')
56
56
  .action(() => __awaiter(void 0, void 0, void 0, function* () {
@@ -36,7 +36,8 @@ exports.default = (client) => {
36
36
  function loadCommand(name) {
37
37
  return __awaiter(this, void 0, void 0, function* () {
38
38
  return new Promise((resolve, reject) => setTimeout(() => __awaiter(this, void 0, void 0, function* () {
39
- const cmd = (yield Promise.resolve().then(() => __importStar(require('./' + name.split(':').join('/'))))).default;
39
+ var _a;
40
+ const cmd = (yield (_a = './' + name.split(':').join('/'), Promise.resolve().then(() => __importStar(require(_a))))).default;
40
41
  try {
41
42
  cmd.register(client);
42
43
  resolve();
@@ -49,7 +49,13 @@ 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, constants_1.SCOPE.pdf_shot])
52
+ .needs('auth', [
53
+ constants_1.SCOPE.functions,
54
+ constants_1.SCOPE.functions_execution,
55
+ constants_1.SCOPE.webapp,
56
+ constants_1.SCOPE.pdf_shot,
57
+ constants_1.SCOPE.custom_token_generation
58
+ ])
53
59
  .needs('config')
54
60
  .needs('rc')
55
61
  .action(() => __awaiter(void 0, void 0, void 0, function* () {
@@ -12,19 +12,37 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
+ const ansi_colors_1 = require("ansi-colors");
15
16
  const error_1 = __importDefault(require("../../error"));
16
17
  const api_1 = __importDefault(require("../../internal/api"));
18
+ const constants_1 = require("../../util_modules/constants");
17
19
  const logger_1 = require("../../util_modules/logger");
18
20
  class Env {
19
21
  constructor(opts, org) {
20
22
  this.opts = opts;
21
23
  this.opts.envId = org;
22
24
  }
23
- getEnvs(projectId) {
25
+ getEnvs(projectId, throwErr = true) {
24
26
  return __awaiter(this, void 0, void 0, function* () {
25
27
  const res = yield new api_1.default(this.opts).get('/baas/v1/project/' + projectId + '/environment');
26
28
  if (res.body && res.body.data) {
27
- return res.body.data;
29
+ const data = res.body.data;
30
+ if (throwErr) {
31
+ const devEnv = data.find((env) => env.env_name === constants_1.DEFAULT.env_name);
32
+ if ((devEnv === null || devEnv === void 0 ? void 0 : devEnv.env_status) === 'Blocked') {
33
+ throw new error_1.default('Environment blocked', {
34
+ exit: 1,
35
+ errorId: 'ENV-1',
36
+ arg: [
37
+ (0, ansi_colors_1.bold)(constants_1.DEFAULT.env_name),
38
+ (0, ansi_colors_1.bold)(projectId),
39
+ ansi_colors_1.bold.red('blocked'),
40
+ ansi_colors_1.italic.underline('support@zohocatalyst.com')
41
+ ]
42
+ });
43
+ }
44
+ }
45
+ return data;
28
46
  }
29
47
  (0, logger_1.debug)('get environment response from server : ' + JSON.stringify(res.body));
30
48
  throw new error_1.default('Server Error: Unexpected Response from server.', {
@@ -38,6 +38,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
38
38
  const index_js_1 = __importDefault(require("../../../prompt/index.js"));
39
39
  const index_js_2 = require("../../../util_modules/constants/index.js");
40
40
  exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
41
+ var _a;
41
42
  const clientInitAnswer = yield index_js_1.default.ask(index_js_1.default.question('clientFlavour', 'Choose the type of client to initialise: ', {
42
43
  type: 'list',
43
44
  choices: index_js_2.PLUGIN.client.map((plugin) => {
@@ -47,5 +48,5 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
47
48
  });
48
49
  })
49
50
  }));
50
- return (yield Promise.resolve().then(() => __importStar(require('./initializers/' + clientInitAnswer.clientFlavour)))).default();
51
+ return (yield (_a = './initializers/' + clientInitAnswer.clientFlavour, Promise.resolve().then(() => __importStar(require(_a))))).default();
51
52
  });
@@ -206,7 +206,8 @@ class Command {
206
206
  (0, logger_1.debug)(e);
207
207
  }
208
208
  yield Promise.all(js_1.JS.map(this.beforeRunners, (before) => __awaiter(this, void 0, void 0, function* () {
209
- const beforeModule = (yield Promise.resolve().then(() => __importStar(require('../command_needs/' + before.fn)))).default;
209
+ var _a;
210
+ const beforeModule = (yield (_a = '../command_needs/' + before.fn, Promise.resolve().then(() => __importStar(require(_a))))).default;
210
211
  return beforeModule.call(this, before.args);
211
212
  })));
212
213
  return this.cmdAction.call(this, ...args);
@@ -44,6 +44,7 @@ const rc_1 = __importDefault(require("../internal/rc"));
44
44
  const fs_1 = require("../util_modules/fs");
45
45
  const logger_1 = require("../util_modules/logger");
46
46
  const runMigration = (rc, migFiles, idx = 0) => __awaiter(void 0, void 0, void 0, function* () {
47
+ var _a;
47
48
  if (migFiles.length <= idx) {
48
49
  return Promise.resolve();
49
50
  }
@@ -54,7 +55,7 @@ const runMigration = (rc, migFiles, idx = 0) => __awaiter(void 0, void 0, void 0
54
55
  return runMigration(rc, migFiles, ++idx);
55
56
  }
56
57
  try {
57
- const migModule = yield Promise.resolve().then(() => __importStar(require(migFile)));
58
+ const migModule = yield (_a = migFile, Promise.resolve().then(() => __importStar(require(_a))));
58
59
  if (migModule.isRequire()) {
59
60
  (0, logger_1.debug)('migration started for v' + currentMigFileVersion);
60
61
  migModule.migrate();
@@ -83,6 +84,7 @@ const runMigration = (rc, migFiles, idx = 0) => __awaiter(void 0, void 0, void 0
83
84
  return runMigration(rc, migFiles, ++idx);
84
85
  });
85
86
  const runGlobalMigration = (migFiles) => __awaiter(void 0, void 0, void 0, function* () {
87
+ var _b;
86
88
  if (migFiles.length === 0) {
87
89
  return;
88
90
  }
@@ -96,7 +98,7 @@ const runGlobalMigration = (migFiles) => __awaiter(void 0, void 0, void 0, funct
96
98
  return runGlobalMigration(migFiles);
97
99
  }
98
100
  try {
99
- const migModule = yield Promise.resolve().then(() => __importStar(require(migFile)));
101
+ const migModule = yield (_b = migFile, Promise.resolve().then(() => __importStar(require(_b))));
100
102
  if (migModule.isRequire()) {
101
103
  (0, logger_1.debug)('migration started for v' + currentMigFileVersion);
102
104
  migModule.migrate();
@@ -42,6 +42,7 @@ const async_js_1 = require("./util_modules/fs/lib/async.js");
42
42
  const error_js_1 = __importDefault(require("./error.js"));
43
43
  const ansi_colors_1 = require("ansi-colors");
44
44
  exports.default = (name, source) => __awaiter(void 0, void 0, void 0, function* () {
45
+ var _a, _b;
45
46
  if (name === (0, path_1.basename)(name)) {
46
47
  const projectModulePath = (0, project_js_1.resolveProjectPath)((0, path_1.join)(source, 'node_modules', name));
47
48
  const projectModulePathExists = yield (0, async_js_1.dirExists)(projectModulePath);
@@ -53,7 +54,7 @@ exports.default = (name, source) => __awaiter(void 0, void 0, void 0, function*
53
54
  });
54
55
  }
55
56
  app_module_path_1.default.addPath(projectModulePath);
56
- return Promise.resolve().then(() => __importStar(require(projectModulePath)));
57
+ return _a = projectModulePath, Promise.resolve().then(() => __importStar(require(_a)));
57
58
  }
58
59
  const projectModulePath = (0, project_js_1.resolveProjectPath)(name);
59
60
  const projectModulePathExists = yield (0, async_js_1.dirExists)(projectModulePath);
@@ -65,5 +66,5 @@ exports.default = (name, source) => __awaiter(void 0, void 0, void 0, function*
65
66
  });
66
67
  }
67
68
  app_module_path_1.default.addPath(projectModulePath);
68
- return Promise.resolve().then(() => __importStar(require(projectModulePath)));
69
+ return _b = projectModulePath, Promise.resolve().then(() => __importStar(require(_b)));
69
70
  });
@@ -26,6 +26,9 @@ var ETreeState;
26
26
  ETreeState[ETreeState["EXPANDED"] = 3] = "EXPANDED";
27
27
  })(ETreeState || (ETreeState = {}));
28
28
  class TreeNode {
29
+ get indent() {
30
+ return this.level * 2;
31
+ }
29
32
  constructor(root) {
30
33
  _TreeNode_instances.add(this);
31
34
  this.open = false;
@@ -36,9 +39,6 @@ class TreeNode {
36
39
  this.level = 1;
37
40
  this.root = root;
38
41
  }
39
- get indent() {
40
- return this.level * 2;
41
- }
42
42
  addNode(node) {
43
43
  if (node instanceof TreeNode) {
44
44
  this.leaves.push(node);
@@ -12,22 +12,22 @@ exports.default = Object.freeze({
12
12
  serve_port: {
13
13
  http: {
14
14
  master: 3000,
15
+ advancedio: 4000,
16
+ basicio: 4200,
17
+ browser_logic: 4400,
15
18
  appsail: {
16
19
  master: 3000,
17
- service: 3060
20
+ service: 4500
18
21
  },
19
- advancedio: 3010,
20
- basicio: 3040,
21
- client: 3050,
22
- browser_logic: 3100
22
+ client: 5000
23
23
  },
24
24
  debug: {
25
25
  master: -1,
26
26
  advancedio: 8000,
27
- basicio: 8010,
28
- client: -1,
29
- appsail: 8020,
30
- browser_logic: 8040
27
+ basicio: 8200,
28
+ browser_logic: 8400,
29
+ appsail: -1,
30
+ client: -1
31
31
  }
32
32
  },
33
33
  event_bus: {
@@ -27,6 +27,7 @@ exports.default = Object.freeze({
27
27
  project_user_create: 'ZohoCatalyst.projects.users.CREATE',
28
28
  project_user_delete: 'ZohoCatalyst.projects.users.DELETE',
29
29
  project_user_update: 'ZohoCatalyst.projects.users.UPDATE',
30
+ custom_token_generation: 'ZohoCatalyst.authentication.CREATE',
30
31
  email_send: 'ZohoCatalyst.email.CREATE',
31
32
  datastore: 'ZohoCatalyst.tables.ALL',
32
33
  row: 'ZohoCatalyst.tables.rows.ALL',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zcatalyst-cli",
3
- "version": "1.17.5",
3
+ "version": "1.17.6",
4
4
  "description": "Command Line Tool for CATALYST",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -71,7 +71,7 @@
71
71
  "@types/jest": "^27.4.1",
72
72
  "@types/lodash": "^4.14.182",
73
73
  "@types/minimatch": "^5.1.2",
74
- "@types/node": "^17.0.25",
74
+ "@types/node": "^20.12.7",
75
75
  "@types/request": "^2.48.8",
76
76
  "@types/semver": "^7.3.9",
77
77
  "@types/update-notifier": "^5.1.0",
@@ -87,7 +87,7 @@
87
87
  "npm-run-all": "^4.1.5",
88
88
  "prettier": "^2.6.2",
89
89
  "ts-jest": "^27.1.4",
90
- "typescript": "^4.6.3"
90
+ "typescript": "^4.9.5"
91
91
  },
92
92
  "scripts": {
93
93
  "build": "gulp build",