zcatalyst-cli 1.18.0-beta.0 → 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.
Files changed (160) hide show
  1. package/docs/command_needs/rc.toml +8 -8
  2. package/docs/commands/ds/import.toml +5 -5
  3. package/docs/commands/event/generate/job.toml +7 -0
  4. package/docs/commands/zest/generate/index.toml +4 -0
  5. package/docs/endpoints/lib/job-scheduling.toml +3 -0
  6. package/docs/internal/command.toml +5 -0
  7. package/docs/serve/server/lib/appsail/index.toml +22 -1
  8. package/lib/appsail-utils.js +4 -10
  9. package/lib/authentication/index.js +1 -0
  10. package/lib/authentication/login.js +8 -4
  11. package/lib/bin/catalyst.js +1 -1
  12. package/lib/code-deck.js +7 -7
  13. package/lib/command_needs/rc.js +8 -8
  14. package/lib/commands/appsail/add.js +3 -2
  15. package/lib/commands/client/setup.js +2 -1
  16. package/lib/commands/codelib/install.js +6 -2
  17. package/lib/commands/ds/import.js +37 -21
  18. package/lib/commands/event/generate/index.js +16 -3
  19. package/lib/commands/event/generate/integ.js +2 -1
  20. package/lib/commands/event/generate/job.js +82 -0
  21. package/lib/commands/functions/add.js +2 -1
  22. package/lib/commands/functions/delete.js +2 -4
  23. package/lib/commands/functions/setup.js +2 -1
  24. package/lib/commands/functions/shell.js +1 -0
  25. package/lib/commands/iac/export.js +5 -1
  26. package/lib/commands/iac/import.js +4 -1
  27. package/lib/commands/index.js +4 -1
  28. package/lib/commands/init.js +10 -7
  29. package/lib/commands/login.js +1 -0
  30. package/lib/commands/logout.js +1 -0
  31. package/lib/commands/pull.js +1 -0
  32. package/lib/commands/serve.js +1 -1
  33. package/lib/commands/whoami.js +1 -0
  34. package/lib/commands/zest/generate/index.js +304 -0
  35. package/lib/deploy/features/appsail/index.js +42 -25
  36. package/lib/deploy/features/appsail/utils.js +4 -5
  37. package/lib/endpoints/index.js +24 -3
  38. package/lib/endpoints/lib/appsail.js +7 -1
  39. package/lib/endpoints/lib/ds-bulk.js +1 -0
  40. package/lib/endpoints/lib/job-scheduling.js +61 -0
  41. package/lib/endpoints/lib/stratus.js +63 -0
  42. package/lib/endpoints/lib/tunnel.js +18 -0
  43. package/lib/endpoints/lib/zest.js +124 -0
  44. package/lib/event_generate/stratus.js +52 -0
  45. package/lib/express_middlewares/logger.js +2 -4
  46. package/lib/fn-utils/lib/common.js +8 -4
  47. package/lib/fn-utils/lib/java.js +1 -1
  48. package/lib/fn-utils/lib/python.js +2 -2
  49. package/lib/fn-watcher.js +1 -1
  50. package/lib/iac/status/deploy.js +1 -5
  51. package/lib/init/dependencies/python/ensure-python.js +6 -8
  52. package/lib/init/features/appsail/index.js +38 -27
  53. package/lib/init/features/client/index.js +2 -1
  54. package/lib/init/features/functions/index.js +4 -0
  55. package/lib/init/features/functions/languages/python.js +21 -5
  56. package/lib/init/features/project.js +6 -15
  57. package/lib/internal/api.js +26 -7
  58. package/lib/internal/command.js +31 -7
  59. package/lib/migration/index.js +4 -2
  60. package/lib/optional-import.js +3 -2
  61. package/lib/prompt/index.js +5 -2
  62. package/lib/prompt/types/file-path.js +1 -1
  63. package/lib/prompt/types/search-box.js +281 -0
  64. package/lib/prompt/types/tree.js +3 -3
  65. package/lib/serve/features/appsail.js +3 -4
  66. package/lib/serve/index.js +1 -2
  67. package/lib/serve/server/index.js +52 -23
  68. package/lib/serve/server/lib/appsail/index.js +89 -39
  69. package/lib/serve/server/lib/appsail/start.js +9 -1
  70. package/lib/serve/server/lib/java/aio_server/lib/catalyst-cli-java-runtime-1.0.0.jar +0 -0
  71. 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
  72. package/lib/serve/server/lib/java/aio_server/lib/catalyst-java-runtime-1.0.0.jar +0 -0
  73. package/lib/serve/server/lib/java/index.js +2 -2
  74. package/lib/serve/server/lib/master/appsail.js +53 -0
  75. package/lib/serve/server/lib/master/functions.js +34 -0
  76. package/lib/serve/server/lib/master/index.js +155 -0
  77. package/lib/{express_middlewares/unknownReqProxy.js → serve/server/lib/master/unknown-req-proxy.js} +9 -9
  78. package/lib/serve/server/lib/master/utils.js +142 -0
  79. package/lib/serve/server/lib/master/web-client.js +39 -0
  80. package/lib/serve/server/lib/node/index.js +3 -3
  81. package/lib/serve/server/lib/node/server/package-lock.json +12 -0
  82. package/lib/serve/server/lib/python/index.js +3 -3
  83. package/lib/shell/dependencies/http-functions.js +1 -1
  84. package/lib/shell/dependencies/invoker/bio/java/lib/catalyst-function-sdk-1.1.0.jar +0 -0
  85. package/lib/shell/dependencies/invoker/cron/java/JavacronInvoker.java +1 -1
  86. package/lib/shell/dependencies/invoker/cron/java/lib/catalyst-function-sdk-1.1.0.jar +0 -0
  87. package/lib/shell/dependencies/invoker/event/java/JavaeventInvoker.java +2 -1
  88. package/lib/shell/dependencies/invoker/event/java/lib/catalyst-function-sdk-1.1.0.jar +0 -0
  89. package/lib/shell/dependencies/invoker/event/node.mjs +1 -0
  90. package/lib/shell/dependencies/invoker/integ/java/JavaintegInvoker.java +15 -0
  91. package/lib/shell/dependencies/invoker/integ/java/lib/catalyst-function-sdk-1.1.0.jar +0 -0
  92. package/lib/shell/dependencies/invoker/integ/node.mjs +13 -0
  93. package/lib/shell/dependencies/invoker/job/java/JavajobInvoker.java +268 -0
  94. package/lib/shell/dependencies/invoker/job/java/lib/catalyst-function-sdk-1.1.0.jar +0 -0
  95. package/lib/shell/dependencies/invoker/job/java/lib/org.json.jar +0 -0
  96. package/lib/shell/dependencies/invoker/job/node.mjs +93 -0
  97. package/lib/shell/dependencies/local-function.js +122 -13
  98. package/lib/shell/dependencies/tunnel-server.js +52 -23
  99. package/lib/shell/index.js +22 -22
  100. package/lib/shell/prepare/languages/index.js +4 -4
  101. package/lib/shell/prepare/languages/java.js +1 -2
  102. package/lib/shell/prepare/languages/python.js +10 -16
  103. package/lib/throbber/index.js +6 -1
  104. package/lib/userConfig.js +7 -1
  105. package/lib/util_modules/config/index.js +1 -1
  106. package/lib/util_modules/config/lib/{appSail.js → appsail.js} +64 -10
  107. package/lib/util_modules/config/lib/client.js +6 -8
  108. package/lib/util_modules/config/lib/functions.js +6 -8
  109. package/lib/util_modules/constants/lib/dc-type.js +8 -0
  110. package/lib/util_modules/constants/lib/default.js +9 -9
  111. package/lib/util_modules/constants/lib/event-action.js +1 -0
  112. package/lib/util_modules/constants/lib/event-source.js +1 -0
  113. package/lib/util_modules/constants/lib/fn-type.js +2 -1
  114. package/lib/util_modules/constants/lib/needed-scopes.js +53 -44
  115. package/lib/util_modules/constants/lib/placeholders.js +7 -0
  116. package/lib/util_modules/constants/lib/ref-mapping.js +2 -1
  117. package/lib/util_modules/constants/lib/remote-mapping.js +2 -1
  118. package/lib/util_modules/constants/lib/scopes.js +17 -2
  119. package/lib/util_modules/constants/lib/template.js +9 -4
  120. package/lib/util_modules/constants/lib/urls.js +16 -0
  121. package/lib/util_modules/fs/lib/async.js +14 -4
  122. package/lib/util_modules/fs/lib/sync.js +12 -1
  123. package/lib/util_modules/server.js +2 -4
  124. package/lib/winston.js +17 -11
  125. package/package.json +4 -2
  126. package/templates/event/job.json +30 -0
  127. package/templates/init/client/react/react_js/template/src/index.js +3 -3
  128. package/templates/init/client/react/react_ts/template/src/index.tsx +3 -3
  129. package/templates/init/client/react/react_ts/template.json +3 -3
  130. package/templates/init/functions/java/job/.classpath +6 -0
  131. package/templates/init/functions/java/job/.project +17 -0
  132. package/templates/init/functions/java/job/catalyst-config.json +11 -0
  133. package/templates/init/functions/java/job/sample.java +34 -0
  134. package/templates/init/functions/node/aio/package.json +1 -1
  135. package/templates/init/functions/node/aio/sample.js +7 -0
  136. package/templates/init/functions/node/bio/package.json +1 -1
  137. package/templates/init/functions/node/bio/sample.js +5 -0
  138. package/templates/init/functions/node/bio/types/basicio.d.ts +57 -0
  139. package/templates/init/functions/node/cron/package.json +1 -1
  140. package/templates/init/functions/node/cron/sample.js +5 -0
  141. package/templates/init/functions/node/cron/types/cron.d.ts +64 -0
  142. package/templates/init/functions/node/event/package.json +1 -1
  143. package/templates/init/functions/node/event/sample.js +11 -8
  144. package/templates/init/functions/node/event/types/event.d.ts +82 -0
  145. package/templates/init/functions/node/integ/cliq/package.json +1 -1
  146. package/templates/init/functions/node/integ/convokraft/package.json +1 -1
  147. package/templates/init/functions/node/{stream → job}/catalyst-config.json +3 -2
  148. package/templates/init/functions/node/{stream → job}/package.json +1 -1
  149. package/templates/init/functions/node/job/sample.js +27 -0
  150. package/templates/init/functions/node/job/types/job.d.ts +62 -0
  151. package/templates/init/functions/python/job/catalyst-config.json +11 -0
  152. package/templates/init/functions/python/job/requirements.txt +1 -0
  153. package/templates/init/functions/python/job/sample.py +22 -0
  154. package/templates/init.txt +14 -0
  155. package/lib/serve/server/lib/master.js +0 -326
  156. package/lib/shell/dependencies/invoker/bio/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  157. package/lib/shell/dependencies/invoker/cron/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  158. package/lib/shell/dependencies/invoker/event/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  159. package/lib/shell/dependencies/invoker/integ/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  160. package/templates/init/functions/node/stream/sample.js +0 -15
@@ -13,12 +13,60 @@ 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
+ const sourcePath = (0, path_1.join)((0, project_1.getProjectRoot)(), source);
30
+ configJson.raw.source_path = sourcePath;
31
+ if (configJson.buildPath || configJson.build_path) {
32
+ const buildPath = configJson.build_path || configJson.buildPath;
33
+ if (!buildPath) {
34
+ return {
35
+ valid: false,
36
+ reason: 'Build Path not present'
37
+ };
38
+ }
39
+ const absolutePath = (0, path_1.isAbsolute)(buildPath) ? buildPath : (0, path_1.resolve)(sourcePath, buildPath);
40
+ configJson.build_path = absolutePath;
41
+ configJson.raw.build_path = buildPath;
42
+ }
43
+ if (configJson.catalyst_auth === true) {
44
+ if (configJson.login_redirect === undefined) {
45
+ return {
46
+ valid: false,
47
+ reason: 'Login Redirect value incorrect! Please check the entered value.'
48
+ };
49
+ }
50
+ else if (configJson.login_redirect.length === 0) {
51
+ return {
52
+ valid: false,
53
+ reason: 'Login Redirect value empty! Please provide a login redirect URL.'
54
+ };
55
+ }
56
+ else if (configJson.login_redirect.toLowerCase().startsWith('http') ||
57
+ configJson.login_redirect.includes('://') ||
58
+ !configJson.login_redirect.startsWith('/') ||
59
+ configJson.login_redirect.includes('//')) {
60
+ return {
61
+ valid: false,
62
+ reason: 'Login Redirect value not a relative URL! Please provide a relative URL.'
63
+ };
64
+ }
65
+ }
66
+ return {
67
+ valid: true
68
+ };
69
+ }
22
70
  function raw(throwError = false) {
23
71
  const config = runtime_store_1.default.get('config', null);
24
72
  if (config === null) {
@@ -27,7 +75,11 @@ function raw(throwError = false) {
27
75
  }
28
76
  return;
29
77
  }
30
- return config.get('appsail');
78
+ const appsailConfig = config.get('appsail');
79
+ return appsailConfig === null || appsailConfig === void 0 ? void 0 : appsailConfig.map((_conf) => {
80
+ _conf.source = (0, path_1.isAbsolute)(_conf.source) ? _conf.source : (0, path_1.normalize)(_conf.source);
81
+ return _conf;
82
+ });
31
83
  }
32
84
  exports.raw = raw;
33
85
  function getTargetDetails(name) {
@@ -70,17 +122,19 @@ function getAllTargetDetails(throwErr = true) {
70
122
  return resArr;
71
123
  }
72
124
  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: {
125
+ try {
126
+ const configJson = yield fs_1.ASYNC.readJSONFile(catalystConfigPth);
127
+ configJson && (configJson.raw = {});
128
+ const validity = validateConfig(target.source, configJson);
129
+ return res(Object.assign({ config: configJson, validity }, target));
130
+ }
131
+ catch (er) {
132
+ const configErr = error_1.default.getErrorInstance(er, { skipHelp: true });
133
+ res(Object.assign({ validity: {
76
134
  valid: false,
77
- reason: 'Config file is empty'
135
+ reason: configErr.message
78
136
  } }, target));
79
137
  }
80
- return res({
81
- appSail: Object.assign(Object.assign({}, target), configJson),
82
- validity: { valid: true }
83
- });
84
138
  })));
85
139
  return resArr;
86
140
  }, []));
@@ -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;
@@ -40,5 +40,13 @@ exports.default = Object.freeze({
40
40
  w_auth: 'us',
41
41
  m_auth: 'us',
42
42
  ext: '.ca'
43
+ },
44
+ sa: {
45
+ loc: 'SaudiArabia',
46
+ ref: 'sa',
47
+ value: 'sa',
48
+ w_auth: 'us',
49
+ m_auth: 'us',
50
+ ext: '.sa'
43
51
  }
44
52
  });
@@ -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: {
@@ -9,6 +9,7 @@ exports.default = Object.freeze({
9
9
  [event_source_1.default.cache]: ['Put'],
10
10
  [event_source_1.default.user]: ['SignUp', 'Delete'],
11
11
  [event_source_1.default.filestore]: ['Upload', 'Download'],
12
+ [event_source_1.default.stratus]: ['Object Upload', 'Object Download', 'Object Update', 'Object Delete'],
12
13
  [event_source_1.default.webapp]: ['Success'],
13
14
  [event_source_1.default.github]: ['Success', 'Failure'],
14
15
  [event_source_1.default.custom]: ['Produce']
@@ -6,6 +6,7 @@ exports.default = Object.freeze({
6
6
  user: 'UserManagement',
7
7
  custom: 'Custom',
8
8
  filestore: 'Filestore',
9
+ stratus: 'Stratus',
9
10
  webapp: 'Webapp',
10
11
  github: 'Github'
11
12
  });
@@ -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,12 @@ 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__}}',
47
+ stratus_domain: '{{_STRATUS_DOMAIN__}}'
41
48
  }
42
49
  });
@@ -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,24 @@ 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
- stratus_create: 'Stratus.sdkop.CREATE',
68
- stratus_read: 'Stratus.sdkop.READ'
69
+ object_creation: 'Stratus.fileop.CREATE',
70
+ object_operation: 'Stratus.fileop.ALL',
71
+ stratus_bucket_operation: 'Stratus.bucketop.ALL',
72
+ object_update: 'ZohoCatalyst.buckets.objects.UPDATE',
73
+ object_read: 'ZohoCatalyst.buckets.objects.READ',
74
+ object_delete: 'ZohoCatalyst.buckets.objects.DELETE',
75
+ bucket_read: 'ZohoCatalyst.buckets.READ',
76
+ object_create: 'ZohoCatalyst.buckets.objects.CREATE',
77
+ pipline_read: 'ZohoCatalyst.pipeline.READ',
78
+ pipeline_exec_create: 'ZohoCatalyst.pipeline.execution.CREATE',
79
+ zest_file_read: 'ZohoZEST.files.READ',
80
+ zest_spec_read: 'ZohoZEST.specifications.READ',
81
+ zest_spec_all: 'ZohoZEST.specifications.ALL',
82
+ zest_spec_src_action: 'ZohoZEST.specifications.sources.CREATE',
83
+ zest_schedule_job_read: 'ZohoZEST.scheduled_jobs.READ'
69
84
  });
@@ -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) {
@@ -61,14 +68,23 @@ class URL {
61
68
  }
62
69
  return URL._console.replace('.com', dc.ext);
63
70
  }
71
+ static get stratusSuffix() {
72
+ const dc = (0, dc_js_1.getActiveDCType)();
73
+ if (dc === undefined) {
74
+ return URL._stratusSuffix;
75
+ }
76
+ return URL._stratusSuffix.replace('.com', dc.ext);
77
+ }
64
78
  }
65
79
  exports.default = URL;
66
80
  URL._auth = (0, env_js_1.envOverride)('CATALYST_AUTH_URL', 'https://accounts.zoho.com');
81
+ URL._portal = (0, env_js_1.envOverride)('CATALYST_PORTAL_DOMAIN', 'https://accounts.zohoportal.com');
67
82
  URL._admin = (0, env_js_1.envOverride)('CATALYST_ADMIN_URL', 'https://api.catalyst.zoho.com');
68
83
  URL._app = (0, env_js_1.envOverride)('CATALYST_APP_URL', 'https://catalystserverless.com');
69
84
  URL._appSailDomain = (0, env_js_1.envOverride)('CATALYST_APPSAIL_URL', 'https://catalystappsail.com');
70
85
  URL._zohoStatic = (0, env_js_1.envOverride)('ZOHO_STATIC', 'https://www.zoho.com/catalyst');
71
86
  URL._console = (0, env_js_1.envOverride)('CATALYST_CONSOLE_URL', 'https://console.catalyst.zoho.com');
87
+ URL._stratusSuffix = (0, env_js_1.envOverride)('CATALYST_STRATUS_RESOURCE_SUFFIX', '.zohostratus.com');
72
88
  URL.zohoCDN = (0, env_js_1.envOverride)('ZOHO_CDN', 'https://static.zohocdn.com');
73
89
  URL.external = Object.freeze({
74
90
  gitHubAPI: 'https://api.github.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.10",
4
4
  "description": "Command Line Tool for CATALYST",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -25,7 +25,7 @@
25
25
  "homepage": "https://catalyst.zoho.com",
26
26
  "license": "MIT",
27
27
  "dependencies": {
28
- "ansi-colors": "^4.1.1",
28
+ "ansi-colors": "^4.1.3",
29
29
  "app-module-path": "^2.2.0",
30
30
  "better-queue": "^3.8.10",
31
31
  "chokidar": "^3.5.3",
@@ -70,6 +70,7 @@
70
70
  "@types/inquirer-autocomplete-prompt": "^1.3.4",
71
71
  "@types/jest": "^27.4.1",
72
72
  "@types/lodash": "^4.14.182",
73
+ "@types/mime-types": "^2.1.4",
73
74
  "@types/minimatch": "^5.1.2",
74
75
  "@types/node": "^20.12.7",
75
76
  "@types/request": "^2.48.8",
@@ -94,6 +95,7 @@
94
95
  "build:watch": "gulp watch",
95
96
  "clean": "gulp cleanup",
96
97
  "test:unit": "jest --config jest.config.js",
98
+ "lint:nofix": "eslint --ext .ts src/ --color",
97
99
  "lint:src": "eslint --ext .ts src/ --fix --color",
98
100
  "lint:unit": "eslint --ext .js,.ts test/ --fix --color",
99
101
  "lint": "run-p lint:src lint:unit",
@@ -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
+ }