zcatalyst-cli 1.18.0-beta.0 → 1.18.0-beta.2

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.
Files changed (129) hide show
  1. package/docs/command_needs/rc.toml +8 -8
  2. package/docs/commands/event/generate/job.toml +7 -0
  3. package/docs/endpoints/lib/job-scheduling.toml +3 -0
  4. package/docs/internal/command.toml +5 -0
  5. package/lib/appsail-utils.js +4 -10
  6. package/lib/authentication/index.js +1 -0
  7. package/lib/bin/catalyst.js +1 -1
  8. package/lib/command_needs/rc.js +8 -8
  9. package/lib/commands/appsail/add.js +2 -1
  10. package/lib/commands/client/setup.js +2 -1
  11. package/lib/commands/codelib/install.js +5 -2
  12. package/lib/commands/event/generate/index.js +2 -1
  13. package/lib/commands/event/generate/integ.js +2 -1
  14. package/lib/commands/event/generate/job.js +82 -0
  15. package/lib/commands/functions/add.js +2 -1
  16. package/lib/commands/functions/delete.js +2 -4
  17. package/lib/commands/functions/setup.js +2 -1
  18. package/lib/commands/functions/shell.js +1 -0
  19. package/lib/commands/index.js +3 -1
  20. package/lib/commands/init.js +10 -7
  21. package/lib/commands/login.js +1 -0
  22. package/lib/commands/logout.js +1 -0
  23. package/lib/commands/pull.js +1 -0
  24. package/lib/commands/serve.js +1 -1
  25. package/lib/commands/whoami.js +1 -0
  26. package/lib/deploy/features/appsail/index.js +42 -25
  27. package/lib/deploy/features/appsail/utils.js +4 -5
  28. package/lib/endpoints/index.js +10 -3
  29. package/lib/endpoints/lib/appsail.js +7 -1
  30. package/lib/endpoints/lib/job-scheduling.js +61 -0
  31. package/lib/express_middlewares/logger.js +2 -4
  32. package/lib/fn-utils/lib/common.js +2 -3
  33. package/lib/fn-utils/lib/java.js +1 -1
  34. package/lib/fn-utils/lib/python.js +2 -2
  35. package/lib/fn-watcher.js +1 -1
  36. package/lib/init/dependencies/python/ensure-python.js +6 -8
  37. package/lib/init/features/appsail/index.js +36 -26
  38. package/lib/init/features/client/index.js +2 -1
  39. package/lib/init/features/functions/index.js +4 -0
  40. package/lib/init/features/functions/languages/python.js +21 -5
  41. package/lib/init/features/project.js +5 -15
  42. package/lib/internal/api.js +25 -6
  43. package/lib/internal/command.js +30 -6
  44. package/lib/migration/index.js +4 -2
  45. package/lib/optional-import.js +3 -2
  46. package/lib/prompt/types/file-path.js +1 -1
  47. package/lib/prompt/types/tree.js +3 -3
  48. package/lib/serve/features/appsail.js +2 -3
  49. package/lib/serve/index.js +1 -2
  50. package/lib/serve/server/index.js +8 -9
  51. package/lib/serve/server/lib/appsail/index.js +29 -35
  52. package/lib/serve/server/lib/java/aio_server/lib/catalyst-cli-java-runtime-1.0.0.jar +0 -0
  53. package/lib/serve/server/lib/java/aio_server/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  54. package/lib/serve/server/lib/java/aio_server/lib/catalyst-java-runtime-1.0.0.jar +0 -0
  55. package/lib/serve/server/lib/java/index.js +2 -2
  56. package/lib/serve/server/lib/master/appsail.js +53 -0
  57. package/lib/serve/server/lib/master/functions.js +34 -0
  58. package/lib/serve/server/lib/master/index.js +155 -0
  59. package/lib/{express_middlewares/unknownReqProxy.js → serve/server/lib/master/unknown-req-proxy.js} +4 -7
  60. package/lib/serve/server/lib/master/utils.js +130 -0
  61. package/lib/serve/server/lib/master/web-client.js +39 -0
  62. package/lib/serve/server/lib/node/index.js +3 -3
  63. package/lib/serve/server/lib/python/index.js +3 -3
  64. package/lib/shell/dependencies/invoker/bio/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  65. package/lib/shell/dependencies/invoker/cron/java/JavacronInvoker.java +1 -1
  66. package/lib/shell/dependencies/invoker/cron/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  67. package/lib/shell/dependencies/invoker/event/java/JavaeventInvoker.java +2 -1
  68. package/lib/shell/dependencies/invoker/event/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  69. package/lib/shell/dependencies/invoker/event/node.mjs +1 -0
  70. package/lib/shell/dependencies/invoker/integ/java/JavaintegInvoker.java +14 -0
  71. package/lib/shell/dependencies/invoker/integ/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  72. package/lib/shell/dependencies/invoker/integ/node.mjs +13 -0
  73. package/lib/shell/dependencies/invoker/job/java/JavajobInvoker.java +268 -0
  74. package/lib/shell/dependencies/invoker/job/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  75. package/lib/shell/dependencies/invoker/job/java/lib/org.json.jar +0 -0
  76. package/lib/shell/dependencies/invoker/job/node.mjs +93 -0
  77. package/lib/shell/dependencies/local-function.js +121 -13
  78. package/lib/shell/index.js +7 -1
  79. package/lib/shell/prepare/languages/index.js +4 -4
  80. package/lib/shell/prepare/languages/java.js +1 -2
  81. package/lib/shell/prepare/languages/python.js +10 -16
  82. package/lib/throbber/index.js +6 -1
  83. package/lib/userConfig.js +7 -1
  84. package/lib/util_modules/config/index.js +1 -1
  85. package/lib/util_modules/config/lib/{appSail.js → appsail.js} +60 -10
  86. package/lib/util_modules/config/lib/client.js +6 -8
  87. package/lib/util_modules/config/lib/functions.js +6 -8
  88. package/lib/util_modules/constants/lib/default.js +9 -9
  89. package/lib/util_modules/constants/lib/fn-type.js +2 -1
  90. package/lib/util_modules/constants/lib/needed-scopes.js +53 -44
  91. package/lib/util_modules/constants/lib/placeholders.js +6 -0
  92. package/lib/util_modules/constants/lib/ref-mapping.js +2 -1
  93. package/lib/util_modules/constants/lib/remote-mapping.js +2 -1
  94. package/lib/util_modules/constants/lib/scopes.js +5 -1
  95. package/lib/util_modules/constants/lib/template.js +9 -4
  96. package/lib/util_modules/constants/lib/urls.js +8 -0
  97. package/lib/util_modules/fs/lib/async.js +14 -4
  98. package/lib/util_modules/fs/lib/sync.js +12 -1
  99. package/lib/util_modules/server.js +2 -4
  100. package/lib/winston.js +17 -11
  101. package/package.json +1 -1
  102. package/templates/event/job.json +30 -0
  103. package/templates/init/functions/java/job/.classpath +6 -0
  104. package/templates/init/functions/java/job/.project +17 -0
  105. package/templates/init/functions/java/job/catalyst-config.json +11 -0
  106. package/templates/init/functions/java/job/sample.java +34 -0
  107. package/templates/init/functions/node/aio/package.json +1 -1
  108. package/templates/init/functions/node/aio/sample.js +7 -0
  109. package/templates/init/functions/node/bio/package.json +1 -1
  110. package/templates/init/functions/node/bio/sample.js +5 -0
  111. package/templates/init/functions/node/bio/types/basicio.d.ts +57 -0
  112. package/templates/init/functions/node/cron/package.json +1 -1
  113. package/templates/init/functions/node/cron/sample.js +5 -0
  114. package/templates/init/functions/node/cron/types/cron.d.ts +64 -0
  115. package/templates/init/functions/node/event/package.json +1 -1
  116. package/templates/init/functions/node/event/sample.js +11 -8
  117. package/templates/init/functions/node/event/types/event.d.ts +82 -0
  118. package/templates/init/functions/node/integ/cliq/package.json +1 -1
  119. package/templates/init/functions/node/integ/convokraft/package.json +1 -1
  120. package/templates/init/functions/node/{stream → job}/catalyst-config.json +3 -2
  121. package/templates/init/functions/node/{stream → job}/package.json +1 -1
  122. package/templates/init/functions/node/job/sample.js +27 -0
  123. package/templates/init/functions/node/job/types/job.d.ts +62 -0
  124. package/templates/init/functions/python/job/catalyst-config.json +11 -0
  125. package/templates/init/functions/python/job/requirements.txt +1 -0
  126. package/templates/init/functions/python/job/sample.py +22 -0
  127. package/templates/init.txt +13 -0
  128. package/lib/serve/server/lib/master.js +0 -326
  129. package/templates/init/functions/node/stream/sample.js +0 -15
@@ -21,7 +21,7 @@ const pip_install_1 = require("../../../init/dependencies/python/pip-install");
21
21
  const error_1 = __importDefault(require("../../../error"));
22
22
  const fs_extra_1 = require("fs-extra");
23
23
  const throbber_1 = __importDefault(require("../../../throbber"));
24
- exports.default = (targets, fnWatchEvent) => __awaiter(void 0, void 0, void 0, function* () {
24
+ exports.default = (targets) => __awaiter(void 0, void 0, void 0, function* () {
25
25
  if (targets === undefined || targets.length === 0) {
26
26
  return;
27
27
  }
@@ -42,22 +42,16 @@ exports.default = (targets, fnWatchEvent) => __awaiter(void 0, void 0, void 0, f
42
42
  var _a;
43
43
  const buildPath = (0, path_1.join)(runtime_store_1.default.get('project.root'), constants_1.FOLDERNAME.build, constants_1.FOLDERNAME.functions, target.name);
44
44
  const reqFile = (0, path_1.join)(target.source, constants_1.FILENAME.functions.python_requirements);
45
- const requirementsExists = yield fs_1.ASYNC.readFile(reqFile);
46
- const watch = fnWatchEvent
47
- ? fnWatchEvent.pth === constants_1.FILENAME.functions.python_requirements
48
- : true;
49
- if (requirementsExists && watch) {
50
- yield (0, fs_extra_1.ensureDir)(buildPath);
51
- try {
52
- yield (0, pip_install_1.installRequirements)(reqFile, buildPath, (_a = target.stack) === null || _a === void 0 ? void 0 : _a.replace('python_', ''));
53
- }
54
- catch (err) {
55
- const error = error_1.default.getErrorInstance(err);
56
- target.valid = false;
57
- target.failure_reason = error.message;
58
- }
59
- }
45
+ yield (0, fs_extra_1.ensureDir)(buildPath);
60
46
  yield fs_1.ASYNC.emptyDir(buildPath);
47
+ try {
48
+ yield (0, pip_install_1.installRequirements)(reqFile, buildPath, (_a = target.stack) === null || _a === void 0 ? void 0 : _a.replace('python_', ''));
49
+ }
50
+ catch (err) {
51
+ const error = error_1.default.getErrorInstance(err);
52
+ target.valid = false;
53
+ target.failure_reason = error.message;
54
+ }
61
55
  yield fs_1.ASYNC.copyDir(target.source, buildPath);
62
56
  throbber.remove('function_serve_' + target.name);
63
57
  return target;
@@ -42,7 +42,9 @@ class Throbber {
42
42
  options.text = name;
43
43
  }
44
44
  const spinnerProperties = Object.assign(Object.assign({}, this.options), options);
45
- this.spinners[name] = spinnerProperties;
45
+ if (this.spin) {
46
+ this.spinners[name] = spinnerProperties;
47
+ }
46
48
  this.updateSpinnerState();
47
49
  return spinnerProperties;
48
50
  }
@@ -94,6 +96,9 @@ class Throbber {
94
96
  return !!Object.values(this.spinners).find(({ status }) => status === 'spinning');
95
97
  }
96
98
  setSpinnerProperties(name, options, status = 'spinning') {
99
+ if (!this.spin) {
100
+ return;
101
+ }
97
102
  if (!this.spinners[name]) {
98
103
  throw new error_js_1.default(`No spinner initialized with name ${name}`);
99
104
  }
package/lib/userConfig.js CHANGED
@@ -9,7 +9,13 @@ const path_1 = __importDefault(require("path"));
9
9
  const error_1 = __importDefault(require("./error"));
10
10
  class UserConfig {
11
11
  constructor() {
12
- this.validKeys = ['python3_9.bin', 'java8.bin', 'java11.bin', 'java17.bin'];
12
+ this.validKeys = [
13
+ 'python3_9.bin',
14
+ 'java8.bin',
15
+ 'java11.bin',
16
+ 'java17.bin',
17
+ 'javac.disable_warnings'
18
+ ];
13
19
  this.configFilePath = path_1.default.join(constants_1.ENVPATH.userConfig.config, '.zcconfig');
14
20
  this.config = fs_1.SYNC.readJSONFile(this.configFilePath, { checkpath: true }) || {};
15
21
  }
@@ -30,5 +30,5 @@ const clientConfig = __importStar(require("./lib/client"));
30
30
  exports.clientConfig = clientConfig;
31
31
  const functionsConfig = __importStar(require("./lib/functions"));
32
32
  exports.functionsConfig = functionsConfig;
33
- const appSailConfig = __importStar(require("./lib/appSail.js"));
33
+ const appSailConfig = __importStar(require("./lib/appsail"));
34
34
  exports.appSailConfig = appSailConfig;
@@ -13,12 +13,57 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.getAllTargetDetails = exports.getTargetDetails = exports.raw = void 0;
16
+ const path_1 = require("path");
16
17
  const error_1 = __importDefault(require("../../../error"));
17
18
  const runtime_store_1 = __importDefault(require("../../../runtime-store"));
18
19
  const constants_1 = require("../../constants");
19
20
  const fs_1 = require("../../fs");
20
- const logger_1 = require("../../logger");
21
21
  const project_1 = require("../../project");
22
+ function validateConfig(source, configJson) {
23
+ if (!configJson) {
24
+ return {
25
+ valid: false,
26
+ reason: 'Config file is empty'
27
+ };
28
+ }
29
+ if (configJson.buildPath || configJson.build_path) {
30
+ const buildPath = configJson.build_path || configJson.buildPath;
31
+ if (!buildPath) {
32
+ return {
33
+ valid: false,
34
+ reason: 'Build Path not present'
35
+ };
36
+ }
37
+ const absolutePath = (0, path_1.isAbsolute)(buildPath) ? buildPath : (0, path_1.resolve)(source, buildPath);
38
+ configJson.build_path = absolutePath;
39
+ }
40
+ if (configJson.catalyst_auth === true) {
41
+ if (configJson.login_redirect === undefined) {
42
+ return {
43
+ valid: false,
44
+ reason: 'Login Redirect value incorrect! Please check the entered value.'
45
+ };
46
+ }
47
+ else if (configJson.login_redirect.length === 0) {
48
+ return {
49
+ valid: false,
50
+ reason: 'Login Redirect value empty! Please provide a login redirect URL.'
51
+ };
52
+ }
53
+ else if (configJson.login_redirect.toLowerCase().startsWith('http') ||
54
+ configJson.login_redirect.includes('://') ||
55
+ !configJson.login_redirect.startsWith('/') ||
56
+ configJson.login_redirect.includes('//')) {
57
+ return {
58
+ valid: false,
59
+ reason: 'Login Redirect value not a relative URL! Please provide a relative URL.'
60
+ };
61
+ }
62
+ }
63
+ return {
64
+ valid: true
65
+ };
66
+ }
22
67
  function raw(throwError = false) {
23
68
  const config = runtime_store_1.default.get('config', null);
24
69
  if (config === null) {
@@ -27,7 +72,11 @@ function raw(throwError = false) {
27
72
  }
28
73
  return;
29
74
  }
30
- return config.get('appsail');
75
+ const appsailConfig = config.get('appsail');
76
+ return appsailConfig === null || appsailConfig === void 0 ? void 0 : appsailConfig.map((_conf) => {
77
+ _conf.source = (0, path_1.isAbsolute)(_conf.source) ? _conf.source : (0, path_1.normalize)(_conf.source);
78
+ return _conf;
79
+ });
31
80
  }
32
81
  exports.raw = raw;
33
82
  function getTargetDetails(name) {
@@ -70,17 +119,18 @@ function getAllTargetDetails(throwErr = true) {
70
119
  return resArr;
71
120
  }
72
121
  resArr.push(new Promise((res) => __awaiter(this, void 0, void 0, function* () {
73
- const configJson = yield fs_1.ASYNC.readJSONFile(catalystConfigPth).catch((err) => (0, logger_1.debug)('Unable to read config file: ', err));
74
- if (!configJson) {
75
- return res(Object.assign({ validity: {
122
+ try {
123
+ const configJson = yield fs_1.ASYNC.readJSONFile(catalystConfigPth);
124
+ const validity = validateConfig(target.source, configJson);
125
+ return res(Object.assign({ config: configJson, validity }, target));
126
+ }
127
+ catch (er) {
128
+ const configErr = error_1.default.getErrorInstance(er, { skipHelp: true });
129
+ res(Object.assign({ validity: {
76
130
  valid: false,
77
- reason: 'Config file is empty'
131
+ reason: configErr.message
78
132
  } }, target));
79
133
  }
80
- return res({
81
- appSail: Object.assign(Object.assign({}, target), configJson),
82
- validity: { valid: true }
83
- });
84
134
  })));
85
135
  return resArr;
86
136
  }, []));
@@ -55,16 +55,14 @@ function ignore(sourcePath) {
55
55
  if (js_js_1.JS.indexOf(value, path_1.sep) === js_js_1.JS.size(value) - 1) {
56
56
  return '**' + path_1.sep + js_js_1.JS.initial(value).join('');
57
57
  }
58
- else {
59
- if (js_js_1.JS.startsWith(value, path_1.sep)) {
60
- return js_js_1.JS.endsWith(value, path_1.sep)
61
- ? sourcePath + js_js_1.JS.initial(value).join('')
62
- : sourcePath + value;
63
- }
58
+ if (js_js_1.JS.startsWith(value, path_1.sep)) {
64
59
  return js_js_1.JS.endsWith(value, path_1.sep)
65
- ? sourcePath + path_1.sep + js_js_1.JS.initial(value).join('')
66
- : sourcePath + path_1.sep + value;
60
+ ? sourcePath + js_js_1.JS.initial(value).join('')
61
+ : sourcePath + value;
67
62
  }
63
+ return js_js_1.JS.endsWith(value, path_1.sep)
64
+ ? sourcePath + path_1.sep + js_js_1.JS.initial(value).join('')
65
+ : sourcePath + path_1.sep + value;
68
66
  });
69
67
  }
70
68
  exports.ignore = ignore;
@@ -68,16 +68,14 @@ function ignore(sourcePath) {
68
68
  if (js_1.JS.indexOf(value, path_1.sep) === js_1.JS.size(value) - 1) {
69
69
  return '**' + path_1.sep + js_1.JS.initial(value).join('');
70
70
  }
71
- else {
72
- if (js_1.JS.startsWith(value, path_1.sep)) {
73
- return js_1.JS.endsWith(value, path_1.sep)
74
- ? sourcePath + js_1.JS.initial(value).join('')
75
- : sourcePath + value;
76
- }
71
+ if (js_1.JS.startsWith(value, path_1.sep)) {
77
72
  return js_1.JS.endsWith(value, path_1.sep)
78
- ? sourcePath + path_1.sep + js_1.JS.initial(value).join('')
79
- : sourcePath + path_1.sep + value;
73
+ ? sourcePath + js_1.JS.initial(value).join('')
74
+ : sourcePath + value;
80
75
  }
76
+ return js_1.JS.endsWith(value, path_1.sep)
77
+ ? sourcePath + path_1.sep + js_1.JS.initial(value).join('')
78
+ : sourcePath + path_1.sep + value;
81
79
  });
82
80
  }
83
81
  exports.ignore = ignore;
@@ -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: 4600
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: {
@@ -7,5 +7,6 @@ exports.default = Object.freeze({
7
7
  applogic: 'applogic',
8
8
  advanced: 'aio',
9
9
  integration: 'integ',
10
- browserLogic: 'browserlogic'
10
+ browserLogic: 'browserlogic',
11
+ job: 'job'
11
12
  });
@@ -2,51 +2,60 @@
2
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
+ var _a;
5
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ const __1 = require("..");
8
+ const login_1 = require("../../../authentication/login");
9
+ const dc_1 = require("../../../dc");
6
10
  const scopes_1 = __importDefault(require("./scopes"));
11
+ const serveScopes = [
12
+ scopes_1.default.api_read,
13
+ scopes_1.default.apig_read,
14
+ scopes_1.default.segment,
15
+ scopes_1.default.cache_read,
16
+ scopes_1.default.cache_create,
17
+ scopes_1.default.cache_delete,
18
+ scopes_1.default.projects,
19
+ scopes_1.default.cron,
20
+ scopes_1.default.zcql,
21
+ scopes_1.default.project_user_read,
22
+ scopes_1.default.project_user_create,
23
+ scopes_1.default.project_user_delete,
24
+ scopes_1.default.project_user_update,
25
+ scopes_1.default.custom_token_generation,
26
+ scopes_1.default.email_send,
27
+ scopes_1.default.datastore,
28
+ scopes_1.default.row,
29
+ scopes_1.default.column,
30
+ scopes_1.default.bulk_create,
31
+ scopes_1.default.bulk_read,
32
+ scopes_1.default.folders,
33
+ scopes_1.default.file_create,
34
+ scopes_1.default.file_read,
35
+ scopes_1.default.file_delete,
36
+ scopes_1.default.functions,
37
+ scopes_1.default.functions_execution,
38
+ scopes_1.default.event_listeners,
39
+ scopes_1.default.event_produce,
40
+ scopes_1.default.security_read,
41
+ scopes_1.default.security_update,
42
+ scopes_1.default.notification_mobile,
43
+ scopes_1.default.notification_web,
44
+ scopes_1.default.search_read,
45
+ scopes_1.default.zia,
46
+ scopes_1.default.quick_ml,
47
+ scopes_1.default.pdf_shot,
48
+ scopes_1.default.dataverse,
49
+ scopes_1.default.circuits_exe_delete,
50
+ scopes_1.default.circuits_exe_read,
51
+ scopes_1.default.circuits_execute,
52
+ scopes_1.default.appsail_read,
53
+ scopes_1.default.jobpool_read,
54
+ scopes_1.default.job,
55
+ scopes_1.default.nosql_table,
56
+ scopes_1.default.nosql_rows
57
+ ];
58
+ const _missingScope = ((_a = login_1.missingScopes[(0, dc_1.getActiveDC)()]) === null || _a === void 0 ? void 0 : _a.map((dvScope) => __1.SCOPE[dvScope])) || [];
7
59
  exports.default = Object.freeze({
8
- SERVE: [
9
- scopes_1.default.api_read,
10
- scopes_1.default.apig_read,
11
- scopes_1.default.segment,
12
- scopes_1.default.cache_read,
13
- scopes_1.default.cache_create,
14
- scopes_1.default.cache_delete,
15
- scopes_1.default.projects,
16
- scopes_1.default.cron,
17
- scopes_1.default.zcql,
18
- scopes_1.default.project_user_read,
19
- scopes_1.default.project_user_create,
20
- scopes_1.default.project_user_delete,
21
- scopes_1.default.project_user_update,
22
- scopes_1.default.email_send,
23
- scopes_1.default.datastore,
24
- scopes_1.default.row,
25
- scopes_1.default.column,
26
- scopes_1.default.bulk_create,
27
- scopes_1.default.bulk_read,
28
- scopes_1.default.folders,
29
- scopes_1.default.file_create,
30
- scopes_1.default.file_read,
31
- scopes_1.default.file_delete,
32
- scopes_1.default.functions,
33
- scopes_1.default.functions_execution,
34
- scopes_1.default.event_listeners,
35
- scopes_1.default.event_produce,
36
- scopes_1.default.security_read,
37
- scopes_1.default.security_update,
38
- scopes_1.default.notification_mobile,
39
- scopes_1.default.notification_web,
40
- scopes_1.default.search_read,
41
- scopes_1.default.zia,
42
- scopes_1.default.quick_ml,
43
- scopes_1.default.pdf_shot,
44
- scopes_1.default.dataverse,
45
- scopes_1.default.circuits_exe_delete,
46
- scopes_1.default.circuits_exe_read,
47
- scopes_1.default.circuits_execute,
48
- scopes_1.default.appsail_read,
49
- scopes_1.default.nosql_table,
50
- scopes_1.default.nosql_rows
51
- ]
60
+ SERVE: serveScopes.filter((scope) => !_missingScope.includes(scope))
52
61
  });
@@ -38,5 +38,11 @@ exports.default = Object.freeze({
38
38
  event_time: '{{__EVENT_TIME__}}',
39
39
  data: '{{__DATA__}}',
40
40
  rule_id: '{{__RULE_ID__}}'
41
+ },
42
+ init_js: {
43
+ project_id: '{{__PROJECT_ID__}}',
44
+ zaid: '{{__ZAID__}}',
45
+ auth_domain: '{{__AUTH_DOMAIN__}}',
46
+ org_id: '{{__ORG_ID__}}'
41
47
  }
42
48
  });
@@ -13,7 +13,8 @@ exports.default = Object.freeze({
13
13
  applogic: fn_type_1.default.applogic,
14
14
  advancedio: fn_type_1.default.advanced,
15
15
  integration: fn_type_1.default.integration,
16
- browser_logic: fn_type_1.default.browserLogic
16
+ browser_logic: fn_type_1.default.browserLogic,
17
+ job: fn_type_1.default.job
17
18
  }
18
19
  }
19
20
  });
@@ -13,7 +13,8 @@ exports.default = Object.freeze({
13
13
  [fn_type_1.default.applogic]: 'applogic',
14
14
  [fn_type_1.default.advanced]: 'advancedio',
15
15
  [fn_type_1.default.integration]: 'integration',
16
- [fn_type_1.default.browserLogic]: 'browser_logic'
16
+ [fn_type_1.default.browserLogic]: 'browser_logic',
17
+ [fn_type_1.default.job]: 'job'
17
18
  }
18
19
  }
19
20
  });
@@ -61,9 +61,13 @@ exports.default = Object.freeze({
61
61
  appsail_create: 'ZohoCatalyst.appsail.Create',
62
62
  appsail_update: 'ZohoCatalyst.appsail.Update',
63
63
  appsail_delete: 'ZohoCatalyst.appsail.Delete',
64
+ jobpool_read: 'ZohoCatalyst.jobpool.READ',
65
+ job: 'ZohoCatalyst.job.ALL',
64
66
  tunneling_read: 'ZohoCatalyst.tunneling.READ',
65
67
  tunneling_update: 'ZohoCatalyst.tunneling.UPDATE',
66
68
  iam_profile: 'AaaServer.profile.READ',
67
69
  stratus_create: 'Stratus.sdkop.CREATE',
68
- stratus_read: 'Stratus.sdkop.READ'
70
+ stratus_read: 'Stratus.sdkop.READ',
71
+ pipline_read: 'ZohoCatalyst.pipeline.READ',
72
+ pipeline_exec_create: 'ZohoCatalyst.pipeline.execution.CREATE'
69
73
  });
@@ -38,7 +38,8 @@ exports.default = Object.freeze({
38
38
  Playwright: (0, path_1.join)(FUNCTIONS_NODE_ROOT, 'browserlogic', 'playwright'),
39
39
  Puppeteer: (0, path_1.join)(FUNCTIONS_NODE_ROOT, 'browserlogic', 'puppeteer'),
40
40
  Selenium: (0, path_1.join)(FUNCTIONS_NODE_ROOT, 'browserlogic', 'selenium')
41
- }
41
+ },
42
+ [constants_1.FN_TYPE.job]: (0, path_1.join)(FUNCTIONS_NODE_ROOT, 'job')
42
43
  },
43
44
  java: {
44
45
  [constants_1.FN_TYPE.basic]: (0, path_1.join)(FUNCTIONS_JAVA_ROOT, 'bio'),
@@ -52,7 +53,8 @@ exports.default = Object.freeze({
52
53
  [constants_1.FN_TYPE.browserLogic]: {
53
54
  Selenium: (0, path_1.join)(FUNCTIONS_JAVA_ROOT, 'browserlogic', 'selenium'),
54
55
  Playwright: (0, path_1.join)(FUNCTIONS_JAVA_ROOT, 'browserlogic', 'playwright')
55
- }
56
+ },
57
+ [constants_1.FN_TYPE.job]: (0, path_1.join)(FUNCTIONS_JAVA_ROOT, 'job')
56
58
  },
57
59
  python: {
58
60
  [constants_1.FN_TYPE.basic]: (0, path_1.join)(FUNCTIONS_PYTHON_ROOT, 'bio'),
@@ -62,8 +64,11 @@ exports.default = Object.freeze({
62
64
  [constants_1.FN_TYPE.integration]: {
63
65
  [constants_1.INTEG.services.cliq]: (0, path_1.join)(FUNCTIONS_PYTHON_ROOT, 'integ', 'cliq'),
64
66
  [constants_1.INTEG.services.convokraft]: (0, path_1.join)(FUNCTIONS_PYTHON_ROOT, 'integ', 'convokraft')
65
- }
67
+ },
68
+ [constants_1.FN_TYPE.job]: (0, path_1.join)(FUNCTIONS_PYTHON_ROOT, 'job')
66
69
  }
67
70
  },
68
- event_data: (0, path_1.join)(TEMPLATE_ROOT, 'event', 'data.json')
71
+ event_data: (0, path_1.join)(TEMPLATE_ROOT, 'event', 'data.json'),
72
+ job_data: (0, path_1.join)(TEMPLATE_ROOT, 'event', 'job.json'),
73
+ init_js: (0, path_1.join)(TEMPLATE_ROOT, 'init.txt')
69
74
  });
@@ -17,6 +17,13 @@ class URL {
17
17
  }
18
18
  return URL._auth.replace('.com', dc.ext);
19
19
  }
20
+ static get iamPortal() {
21
+ const dc = (0, dc_js_1.getActiveDCType)();
22
+ if (dc === undefined) {
23
+ return URL._portal;
24
+ }
25
+ return URL._portal.replace('.com', dc.ext);
26
+ }
20
27
  static get admin() {
21
28
  const dc = (0, dc_js_1.getActiveDCType)();
22
29
  if (dc === undefined) {
@@ -64,6 +71,7 @@ class URL {
64
71
  }
65
72
  exports.default = URL;
66
73
  URL._auth = (0, env_js_1.envOverride)('CATALYST_AUTH_URL', 'https://accounts.zoho.com');
74
+ URL._portal = (0, env_js_1.envOverride)('CATALYST_PORTAL_DOMAIN', 'https://accounts.zohoportal.com');
67
75
  URL._admin = (0, env_js_1.envOverride)('CATALYST_ADMIN_URL', 'https://api.catalyst.zoho.com');
68
76
  URL._app = (0, env_js_1.envOverride)('CATALYST_APP_URL', 'https://catalystserverless.com');
69
77
  URL._appSailDomain = (0, env_js_1.envOverride)('CATALYST_APPSAIL_URL', 'https://catalystappsail.com');
@@ -99,8 +99,13 @@ function walk(dir, { filter = {
99
99
  const isEntryPthDir = entryPathStats.isDirectory() && !entryPathStats.isSymbolicLink();
100
100
  let excludeMatch = false;
101
101
  if (!(isEntryPthDir && !filter.excludeDir)) {
102
- for (const glob of filter.exclude || []) {
103
- excludeMatch = excludeMatch || (0, minimatch_1.default)(entryPath, glob);
102
+ if (typeof filter.exclude === 'function') {
103
+ excludeMatch = excludeMatch || (yield filter.exclude(entryPath));
104
+ }
105
+ else if (Array.isArray(filter.exclude)) {
106
+ for (const glob of filter.exclude || []) {
107
+ excludeMatch = excludeMatch || (0, minimatch_1.default)(entryPath, glob);
108
+ }
104
109
  }
105
110
  }
106
111
  if (excludeMatch) {
@@ -146,10 +151,15 @@ function deleteDir(dir) {
146
151
  });
147
152
  }
148
153
  exports.deleteDir = deleteDir;
149
- function copyFile(src, dest, flag) {
154
+ function copyFile(src, dest, overwrite = true) {
150
155
  return __awaiter(this, void 0, void 0, function* () {
151
156
  yield ensureDir(path_1.default.dirname(dest));
152
- return fs_extra_1.default.copyFile(src, dest, flag);
157
+ return fs_extra_1.default.copy(src, dest, {
158
+ dereference: true,
159
+ recursive: false,
160
+ overwrite,
161
+ errorOnExist: true
162
+ });
153
163
  });
154
164
  }
155
165
  exports.copyFile = copyFile;
@@ -3,10 +3,11 @@ 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.writeJSONFile = exports.readJSONFile = exports.emptyDir = exports.copyDir = exports.copyFiles = exports.copyFile = exports.deleteTempDir = exports.tempFile = exports.deleteDir = exports.isPathInside = exports.isPathOutside = exports.renameFile = exports.modifyFileName = exports.appendFile = exports.writeFile = exports.ensureFile = exports.ensureDir = exports.readFile = exports.deleteFile = exports.getAllFiles = exports.getAllDirs = exports.dirExists = exports.fileExists = exports.readSymLink = exports.getReadStream = exports.getWriteStream = void 0;
6
+ exports.writeJSONFile = exports.readJSONFile = exports.emptyDir = exports.copyDir = exports.copyFiles = exports.copyFile = exports.deleteTempDir = exports.tempFile = exports.deleteDir = exports.isPathInside = exports.isPathOutside = exports.renameFile = exports.modifyFileName = exports.appendFile = exports.writeFile = exports.ensureFile = exports.ensureDir = exports.readFile = exports.deleteFile = exports.getAllFiles = exports.getAllDirs = exports.dirExists = exports.pathExists = exports.fileExists = exports.readSymLink = exports.getReadStream = exports.getWriteStream = void 0;
7
7
  const fs_extra_1 = __importDefault(require("fs-extra"));
8
8
  const os_1 = __importDefault(require("os"));
9
9
  const path_1 = __importDefault(require("path"));
10
+ const utils_1 = require("../utils");
10
11
  function getWriteStream(pth, mode) {
11
12
  return fs_extra_1.default.createWriteStream(pth, { mode });
12
13
  }
@@ -29,6 +30,16 @@ function fileExists(pth) {
29
30
  }
30
31
  }
31
32
  exports.fileExists = fileExists;
33
+ function pathExists(pth) {
34
+ try {
35
+ const stats = fs_extra_1.default.statSync((0, utils_1.untildify)(pth));
36
+ return stats && true;
37
+ }
38
+ catch (e) {
39
+ return false;
40
+ }
41
+ }
42
+ exports.pathExists = pathExists;
32
43
  function dirExists(pth) {
33
44
  try {
34
45
  const stats = fs_extra_1.default.statSync(pth);
@@ -41,10 +41,8 @@ class ConnectionDestroyer {
41
41
  if (this.server instanceof http_proxy_1.default) {
42
42
  return this.server.close(() => resolve());
43
43
  }
44
- else {
45
- return (this.server.listening &&
46
- this.server.close((err) => (err instanceof Error ? reject(err) : resolve())));
47
- }
44
+ return (this.server.listening &&
45
+ this.server.close((err) => (err instanceof Error ? reject(err) : resolve())));
48
46
  }
49
47
  resolve();
50
48
  });
package/lib/winston.js CHANGED
@@ -17,9 +17,11 @@ exports.transport = {
17
17
  console: new winston_1.transports.Console({
18
18
  level: 'info',
19
19
  handleExceptions: false,
20
- format: winston_1.format.printf((info) => {
21
- return info.message;
22
- })
20
+ format: winston_1.format.printf(env_1.isCI
21
+ ? (info) => (0, strip_ansi_1.default)(info.message)
22
+ : (info) => {
23
+ return info.message;
24
+ })
23
25
  }),
24
26
  log_file: new winston_1.transports.File({
25
27
  filename: constants_1.FILENAME.log,
@@ -47,14 +49,18 @@ exports.transport = {
47
49
  };
48
50
  if (process.env.DEBUG || process.argv.slice(2).includes('--verbose')) {
49
51
  exports.transport.console.level = 'debug';
50
- exports.transport.console.format = winston_1.format.combine(winston_1.format.cli({
51
- colors: { info: 'green', error: 'red', debug: 'blue', warn: 'yellow' }
52
- }), winston_1.format.timestamp({ format: 'YYYY-MM-DD hh:mm:ss.SSS A' }), winston_1.format.printf((info) => {
53
- if (exports.transport.console.level === 'info') {
54
- return info.message;
55
- }
56
- return `[${info.timestamp}] ${info.level}: ${info.message}`;
57
- }));
52
+ const formats = [
53
+ winston_1.format.timestamp({ format: 'YYYY-MM-DD hh:mm:ss.SSS A' }),
54
+ winston_1.format.printf(env_1.isCI
55
+ ? (info) => `[${info.timestamp}] ${info.level}: ${(0, strip_ansi_1.default)(info.message)}`
56
+ : (info) => `[${info.timestamp}] ${info.level}: ${info.message}`)
57
+ ];
58
+ if (!env_1.isCI) {
59
+ formats.unshift(winston_1.format.cli({
60
+ colors: { info: 'green', error: 'red', debug: 'blue', warn: 'yellow' }
61
+ }));
62
+ }
63
+ exports.transport.console.format = winston_1.format.combine(...formats);
58
64
  }
59
65
  exports.logger = (0, winston_1.createLogger)({
60
66
  transports: [exports.transport.console],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zcatalyst-cli",
3
- "version": "1.18.0-beta.0",
3
+ "version": "1.18.0-beta.2",
4
4
  "description": "Command Line Tool for CATALYST",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -0,0 +1,30 @@
1
+ {
2
+ "job_details": {
3
+ "job_id": "",
4
+ "created_time": "",
5
+ "response_code": 200,
6
+ "start_time": {},
7
+ "end_time": {},
8
+ "submitted_on": {},
9
+ "job_status": "RUNNING",
10
+ "capacity": { "memory": 256 },
11
+ "job_meta_details": {
12
+ "id": "",
13
+ "url": "",
14
+ "job_name": "",
15
+ "job_config": { "number_of_retries": 0 },
16
+ "target_type": "Function",
17
+ "target_details": { "id": "", "target_name": "" },
18
+ "source_type": "API",
19
+ "source_details": { "source_name": "API" },
20
+ "jobpool_id": "",
21
+ "jobpool_details": {},
22
+ "headers": {},
23
+ "params": {},
24
+ "request_method": ""
25
+ },
26
+ "retried_count": null,
27
+ "parent_job_id": "",
28
+ "execution_time": ""
29
+ }
30
+ }