zcatalyst-cli 1.18.0-beta.0 → 1.18.0-beta.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.
Files changed (115) hide show
  1. package/docs/commands/event/generate/job.toml +7 -0
  2. package/docs/endpoints/lib/job-scheduling.toml +3 -0
  3. package/docs/internal/command.toml +5 -0
  4. package/lib/appsail-utils.js +4 -10
  5. package/lib/authentication/index.js +1 -0
  6. package/lib/bin/catalyst.js +1 -1
  7. package/lib/command_needs/rc.js +1 -1
  8. package/lib/commands/appsail/add.js +1 -0
  9. package/lib/commands/client/setup.js +1 -0
  10. package/lib/commands/event/generate/index.js +2 -1
  11. package/lib/commands/event/generate/integ.js +2 -1
  12. package/lib/commands/event/generate/job.js +82 -0
  13. package/lib/commands/functions/add.js +1 -0
  14. package/lib/commands/functions/delete.js +2 -4
  15. package/lib/commands/functions/setup.js +1 -0
  16. package/lib/commands/functions/shell.js +1 -0
  17. package/lib/commands/index.js +3 -1
  18. package/lib/commands/init.js +2 -6
  19. package/lib/commands/login.js +1 -0
  20. package/lib/commands/logout.js +1 -0
  21. package/lib/commands/pull.js +1 -0
  22. package/lib/commands/serve.js +1 -1
  23. package/lib/commands/whoami.js +1 -0
  24. package/lib/deploy/features/appsail/index.js +19 -17
  25. package/lib/deploy/features/appsail/utils.js +4 -5
  26. package/lib/endpoints/index.js +8 -1
  27. package/lib/endpoints/lib/appsail.js +7 -1
  28. package/lib/endpoints/lib/job-scheduling.js +61 -0
  29. package/lib/express_middlewares/logger.js +2 -4
  30. package/lib/fn-utils/lib/common.js +2 -3
  31. package/lib/fn-utils/lib/java.js +1 -1
  32. package/lib/fn-utils/lib/python.js +2 -2
  33. package/lib/fn-watcher.js +1 -1
  34. package/lib/init/dependencies/python/ensure-python.js +6 -8
  35. package/lib/init/features/appsail/index.js +14 -10
  36. package/lib/init/features/client/index.js +2 -1
  37. package/lib/init/features/functions/index.js +4 -0
  38. package/lib/init/features/functions/languages/python.js +21 -5
  39. package/lib/internal/api.js +12 -1
  40. package/lib/internal/command.js +30 -6
  41. package/lib/migration/index.js +4 -2
  42. package/lib/optional-import.js +3 -2
  43. package/lib/prompt/types/tree.js +3 -3
  44. package/lib/serve/features/appsail.js +2 -3
  45. package/lib/serve/index.js +1 -2
  46. package/lib/serve/server/index.js +8 -9
  47. package/lib/serve/server/lib/appsail/index.js +24 -34
  48. package/lib/serve/server/lib/java/aio_server/lib/catalyst-cli-java-runtime-1.0.0.jar +0 -0
  49. package/lib/serve/server/lib/java/aio_server/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  50. package/lib/serve/server/lib/java/aio_server/lib/catalyst-java-runtime-1.0.0.jar +0 -0
  51. package/lib/serve/server/lib/java/index.js +2 -2
  52. package/lib/serve/server/lib/master/appsail.js +53 -0
  53. package/lib/serve/server/lib/master/functions.js +34 -0
  54. package/lib/serve/server/lib/master/index.js +155 -0
  55. package/lib/{express_middlewares/unknownReqProxy.js → serve/server/lib/master/unknown-req-proxy.js} +4 -7
  56. package/lib/serve/server/lib/master/utils.js +130 -0
  57. package/lib/serve/server/lib/master/web-client.js +39 -0
  58. package/lib/serve/server/lib/node/index.js +3 -3
  59. package/lib/serve/server/lib/python/index.js +3 -3
  60. package/lib/shell/dependencies/invoker/bio/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  61. package/lib/shell/dependencies/invoker/cron/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  62. package/lib/shell/dependencies/invoker/event/java/JavaeventInvoker.java +2 -1
  63. package/lib/shell/dependencies/invoker/event/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  64. package/lib/shell/dependencies/invoker/event/node.mjs +1 -0
  65. package/lib/shell/dependencies/invoker/integ/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  66. package/lib/shell/dependencies/invoker/job/java/JavajobInvoker.java +254 -0
  67. package/lib/shell/dependencies/invoker/job/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  68. package/lib/shell/dependencies/invoker/job/java/lib/org.json.jar +0 -0
  69. package/lib/shell/dependencies/invoker/job/node.mjs +93 -0
  70. package/lib/shell/dependencies/local-function.js +121 -13
  71. package/lib/shell/index.js +7 -1
  72. package/lib/shell/prepare/languages/index.js +4 -4
  73. package/lib/shell/prepare/languages/java.js +1 -2
  74. package/lib/shell/prepare/languages/python.js +10 -16
  75. package/lib/throbber/index.js +6 -1
  76. package/lib/userConfig.js +7 -1
  77. package/lib/util_modules/config/index.js +1 -1
  78. package/lib/util_modules/config/lib/{appSail.js → appsail.js} +61 -9
  79. package/lib/util_modules/config/lib/client.js +6 -8
  80. package/lib/util_modules/config/lib/functions.js +6 -8
  81. package/lib/util_modules/constants/lib/default.js +9 -9
  82. package/lib/util_modules/constants/lib/fn-type.js +2 -1
  83. package/lib/util_modules/constants/lib/needed-scopes.js +53 -44
  84. package/lib/util_modules/constants/lib/placeholders.js +6 -0
  85. package/lib/util_modules/constants/lib/ref-mapping.js +2 -1
  86. package/lib/util_modules/constants/lib/remote-mapping.js +2 -1
  87. package/lib/util_modules/constants/lib/scopes.js +5 -1
  88. package/lib/util_modules/constants/lib/template.js +9 -4
  89. package/lib/util_modules/constants/lib/urls.js +8 -0
  90. package/lib/util_modules/fs/lib/async.js +7 -2
  91. package/lib/util_modules/fs/lib/sync.js +12 -1
  92. package/lib/util_modules/server.js +2 -4
  93. package/lib/winston.js +17 -11
  94. package/package.json +1 -1
  95. package/templates/event/job.json +30 -0
  96. package/templates/init/functions/java/job/.classpath +6 -0
  97. package/templates/init/functions/java/job/.project +17 -0
  98. package/templates/init/functions/java/job/catalyst-config.json +11 -0
  99. package/templates/init/functions/java/job/sample.java +34 -0
  100. package/templates/init/functions/node/aio/package.json +1 -1
  101. package/templates/init/functions/node/bio/package.json +1 -1
  102. package/templates/init/functions/node/cron/package.json +1 -1
  103. package/templates/init/functions/node/event/package.json +1 -1
  104. package/templates/init/functions/node/integ/cliq/package.json +1 -1
  105. package/templates/init/functions/node/integ/convokraft/package.json +1 -1
  106. package/templates/init/functions/node/{stream → job}/catalyst-config.json +3 -2
  107. package/templates/init/functions/node/{stream → job}/package.json +1 -1
  108. package/templates/init/functions/node/job/sample.js +28 -0
  109. package/templates/init/functions/node/job/types/job.d.ts +66 -0
  110. package/templates/init/functions/python/job/catalyst-config.json +11 -0
  111. package/templates/init/functions/python/job/requirements.txt +1 -0
  112. package/templates/init/functions/python/job/sample.py +23 -0
  113. package/templates/init.txt +13 -0
  114. package/lib/serve/server/lib/master.js +0 -326
  115. package/templates/init/functions/node/stream/sample.js +0 -15
@@ -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,63 @@ 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
+ if (!fs_1.SYNC.pathExists(absolutePath)) {
39
+ return {
40
+ valid: false,
41
+ reason: 'Build Path does not exists'
42
+ };
43
+ }
44
+ configJson.build_path = absolutePath;
45
+ }
46
+ if (configJson.catalyst_auth === true) {
47
+ if (configJson.login_redirect === undefined) {
48
+ return {
49
+ valid: false,
50
+ reason: 'Login Redirect value incorrect! Please check the entered value.'
51
+ };
52
+ }
53
+ else if (configJson.login_redirect.length === 0) {
54
+ return {
55
+ valid: false,
56
+ reason: 'Login Redirect value empty! Please provide a login redirect URL.'
57
+ };
58
+ }
59
+ else if (configJson.login_redirect.toLowerCase().startsWith('http') ||
60
+ configJson.login_redirect.includes('://') ||
61
+ !configJson.login_redirect.startsWith('/') ||
62
+ configJson.login_redirect.includes('//')) {
63
+ return {
64
+ valid: false,
65
+ reason: 'Login Redirect value not a relative URL! Please provide a relative URL.'
66
+ };
67
+ }
68
+ }
69
+ return {
70
+ valid: true
71
+ };
72
+ }
22
73
  function raw(throwError = false) {
23
74
  const config = runtime_store_1.default.get('config', null);
24
75
  if (config === null) {
@@ -70,17 +121,18 @@ function getAllTargetDetails(throwErr = true) {
70
121
  return resArr;
71
122
  }
72
123
  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: {
124
+ try {
125
+ const configJson = yield fs_1.ASYNC.readJSONFile(catalystConfigPth);
126
+ const validity = validateConfig(target.source, configJson);
127
+ return res(Object.assign({ config: configJson, validity }, target));
128
+ }
129
+ catch (er) {
130
+ const configErr = error_1.default.getErrorInstance(er, { skipHelp: true });
131
+ res(Object.assign({ validity: {
76
132
  valid: false,
77
- reason: 'Config file is empty'
133
+ reason: configErr.message
78
134
  } }, target));
79
135
  }
80
- return res({
81
- appSail: Object.assign(Object.assign({}, target), configJson),
82
- validity: { valid: true }
83
- });
84
136
  })));
85
137
  return resArr;
86
138
  }, []));
@@ -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');
@@ -146,10 +146,15 @@ function deleteDir(dir) {
146
146
  });
147
147
  }
148
148
  exports.deleteDir = deleteDir;
149
- function copyFile(src, dest, flag) {
149
+ function copyFile(src, dest, overwrite = true) {
150
150
  return __awaiter(this, void 0, void 0, function* () {
151
151
  yield ensureDir(path_1.default.dirname(dest));
152
- return fs_extra_1.default.copyFile(src, dest, flag);
152
+ return fs_extra_1.default.copy(src, dest, {
153
+ dereference: true,
154
+ recursive: false,
155
+ overwrite,
156
+ errorOnExist: true
157
+ });
153
158
  });
154
159
  }
155
160
  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.1",
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
+ }
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <classpath>
3
+ <classpathentry including="**/*.java" kind="src" path="."/>
4
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
5
+ <classpathentry kind="output" path=".output"/>
6
+ </classpath>
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <projectDescription>
3
+ <name>{{_NAME_}}</name>
4
+ <comment></comment>
5
+ <projects>
6
+ </projects>
7
+ <buildSpec>
8
+ <buildCommand>
9
+ <name>org.eclipse.jdt.core.javabuilder</name>
10
+ <arguments>
11
+ </arguments>
12
+ </buildCommand>
13
+ </buildSpec>
14
+ <natures>
15
+ <nature>org.eclipse.jdt.core.javanature</nature>
16
+ </natures>
17
+ </projectDescription>
@@ -0,0 +1,11 @@
1
+ {
2
+ "deployment": {
3
+ "name": "{{_NAME_}}",
4
+ "stack": "{{_STACK_}}",
5
+ "type": "{{_TYPE_}}",
6
+ "env_variables": {}
7
+ },
8
+ "execution": {
9
+ "main": "{{_CLASS_}}"
10
+ }
11
+ }