zcatalyst-cli 1.17.6 → 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 (124) hide show
  1. package/docs/commands/event/generate/job.toml +7 -0
  2. package/docs/commands/functions/shell.toml +4 -0
  3. package/docs/endpoints/lib/job-scheduling.toml +3 -0
  4. package/docs/internal/command.toml +5 -0
  5. package/docs/shell/dependencies/tunnel-server.toml +4 -0
  6. package/docs/shell/index.toml +7 -0
  7. package/lib/appsail-utils.js +3 -3
  8. package/lib/authentication/index.js +1 -0
  9. package/lib/command_needs/rc.js +1 -1
  10. package/lib/commands/appsail/add.js +1 -0
  11. package/lib/commands/client/setup.js +1 -0
  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 +98 -1
  17. package/lib/commands/index.js +1 -0
  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 +2 -8
  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 +15 -1
  27. package/lib/endpoints/lib/appsail.js +7 -1
  28. package/lib/endpoints/lib/job-scheduling.js +61 -0
  29. package/lib/endpoints/lib/sdk.js +2 -2
  30. package/lib/endpoints/lib/tunnel.js +66 -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 +14 -10
  38. package/lib/init/features/functions/index.js +4 -0
  39. package/lib/init/features/functions/languages/python.js +21 -5
  40. package/lib/internal/api.js +17 -1
  41. package/lib/internal/command.js +28 -5
  42. package/lib/port-resolver.js +1 -1
  43. package/lib/repl-server.js +9 -0
  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 +6 -3
  60. package/lib/shell/dependencies/http-functions.js +21 -8
  61. package/lib/shell/dependencies/invoker/bio/java/JavabioInvoker.java +28 -32
  62. package/lib/shell/dependencies/invoker/bio/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  63. package/lib/shell/dependencies/invoker/bio/node.mjs +2 -2
  64. package/lib/shell/dependencies/invoker/cron/java/JavacronInvoker.java +62 -13
  65. package/lib/shell/dependencies/invoker/cron/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  66. package/lib/shell/dependencies/invoker/cron/node.mjs +28 -24
  67. package/lib/shell/dependencies/invoker/event/java/JavaeventInvoker.java +41 -6
  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 +23 -9
  70. package/lib/shell/dependencies/invoker/integ/java/JavaintegInvoker.java +3 -3
  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 +6 -6
  73. package/lib/shell/dependencies/invoker/job/java/JavajobInvoker.java +254 -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 +399 -200
  78. package/lib/shell/dependencies/tunnel-server.js +173 -0
  79. package/lib/shell/index.js +62 -2
  80. package/lib/shell/prepare/languages/index.js +4 -4
  81. package/lib/shell/prepare/languages/java.js +1 -2
  82. package/lib/shell/prepare/languages/python.js +10 -16
  83. package/lib/throbber/index.js +6 -1
  84. package/lib/userConfig.js +7 -1
  85. package/lib/util_modules/config/index.js +1 -1
  86. package/lib/util_modules/config/lib/{appSail.js → appsail.js} +61 -9
  87. package/lib/util_modules/config/lib/client.js +6 -8
  88. package/lib/util_modules/config/lib/functions.js +6 -8
  89. package/lib/util_modules/constants/index.js +3 -1
  90. package/lib/util_modules/constants/lib/default.js +1 -1
  91. package/lib/util_modules/constants/lib/fn-type.js +2 -1
  92. package/lib/util_modules/constants/lib/needed-scopes.js +61 -0
  93. package/lib/util_modules/constants/lib/placeholders.js +6 -0
  94. package/lib/util_modules/constants/lib/ref-mapping.js +2 -1
  95. package/lib/util_modules/constants/lib/remote-mapping.js +2 -1
  96. package/lib/util_modules/constants/lib/scopes.js +9 -1
  97. package/lib/util_modules/constants/lib/template.js +9 -4
  98. package/lib/util_modules/constants/lib/urls.js +16 -0
  99. package/lib/util_modules/fs/lib/async.js +7 -2
  100. package/lib/util_modules/fs/lib/sync.js +12 -1
  101. package/lib/util_modules/server.js +2 -4
  102. package/lib/winston.js +17 -11
  103. package/package.json +1 -1
  104. package/templates/event/job.json +30 -0
  105. package/templates/init/functions/java/job/.classpath +6 -0
  106. package/templates/init/functions/java/job/.project +17 -0
  107. package/templates/init/functions/java/job/catalyst-config.json +11 -0
  108. package/templates/init/functions/java/job/sample.java +34 -0
  109. package/templates/init/functions/node/aio/package.json +1 -1
  110. package/templates/init/functions/node/bio/package.json +1 -1
  111. package/templates/init/functions/node/cron/package.json +1 -1
  112. package/templates/init/functions/node/event/package.json +1 -1
  113. package/templates/init/functions/node/integ/cliq/package.json +1 -1
  114. package/templates/init/functions/node/integ/convokraft/package.json +1 -1
  115. package/templates/init/functions/node/{stream → job}/catalyst-config.json +3 -2
  116. package/templates/init/functions/node/{stream → job}/package.json +1 -1
  117. package/templates/init/functions/node/job/sample.js +28 -0
  118. package/templates/init/functions/node/job/types/job.d.ts +66 -0
  119. package/templates/init/functions/python/job/catalyst-config.json +11 -0
  120. package/templates/init/functions/python/job/requirements.txt +1 -0
  121. package/templates/init/functions/python/job/sample.py +23 -0
  122. package/templates/init.txt +13 -0
  123. package/lib/serve/server/lib/master.js +0 -317
  124. package/templates/init/functions/node/stream/sample.js +0 -15
@@ -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
  });
@@ -34,6 +34,8 @@ exports.default = Object.freeze({
34
34
  column: 'ZohoCatalyst.tables.columns.ALL',
35
35
  bulk_read: 'ZohoCatalyst.tables.bulk.READ',
36
36
  bulk_create: 'ZohoCatalyst.tables.bulk.CREATE',
37
+ nosql_table: 'ZohoCatalyst.nosql.READ',
38
+ nosql_rows: 'ZohoCatalyst.nosql.rows.ALL',
37
39
  folders: 'ZohoCatalyst.folders.ALL',
38
40
  file_create: 'ZohoCatalyst.files.CREATE',
39
41
  file_read: 'ZohoCatalyst.files.READ',
@@ -59,7 +61,13 @@ exports.default = Object.freeze({
59
61
  appsail_create: 'ZohoCatalyst.appsail.Create',
60
62
  appsail_update: 'ZohoCatalyst.appsail.Update',
61
63
  appsail_delete: 'ZohoCatalyst.appsail.Delete',
64
+ jobpool_read: 'ZohoCatalyst.jobpool.READ',
65
+ job: 'ZohoCatalyst.job.ALL',
66
+ tunneling_read: 'ZohoCatalyst.tunneling.READ',
67
+ tunneling_update: 'ZohoCatalyst.tunneling.UPDATE',
62
68
  iam_profile: 'AaaServer.profile.READ',
63
69
  stratus_create: 'Stratus.sdkop.CREATE',
64
- 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'
65
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) {
@@ -34,6 +41,13 @@ class URL {
34
41
  }
35
42
  return URL._app.replace('.com', dc.ext);
36
43
  }
44
+ static get appSailDomain() {
45
+ const dc = (0, dc_js_1.getActiveDCType)();
46
+ if (dc === undefined) {
47
+ return URL._appSailDomain;
48
+ }
49
+ return URL._appSailDomain.replace('.com', dc.ext);
50
+ }
37
51
  static get catalystStatic() {
38
52
  const dc = (0, dc_js_1.getActiveDCType)();
39
53
  if (dc === undefined) {
@@ -57,8 +71,10 @@ class URL {
57
71
  }
58
72
  exports.default = URL;
59
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');
60
75
  URL._admin = (0, env_js_1.envOverride)('CATALYST_ADMIN_URL', 'https://api.catalyst.zoho.com');
61
76
  URL._app = (0, env_js_1.envOverride)('CATALYST_APP_URL', 'https://catalystserverless.com');
77
+ URL._appSailDomain = (0, env_js_1.envOverride)('CATALYST_APPSAIL_URL', 'https://catalystappsail.com');
62
78
  URL._zohoStatic = (0, env_js_1.envOverride)('ZOHO_STATIC', 'https://www.zoho.com/catalyst');
63
79
  URL._console = (0, env_js_1.envOverride)('CATALYST_CONSOLE_URL', 'https://console.catalyst.zoho.com');
64
80
  URL.zohoCDN = (0, env_js_1.envOverride)('ZOHO_CDN', 'https://static.zohocdn.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.17.6",
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
+ }
@@ -0,0 +1,34 @@
1
+ import java.util.logging.Level;
2
+ import java.util.logging.Logger;
3
+
4
+ import com.catalyst.Context;
5
+ import com.catalyst.job.JOB_STATUS;
6
+ import com.catalyst.job.JobRequest;
7
+ import com.catalyst.job.CatalystJobHandler;
8
+
9
+ import com.zc.common.ZCProject;
10
+ import com.zc.component.cache.ZCCache;
11
+
12
+ public class {{_CLASS_}} implements CatalystJobHandler {
13
+
14
+ private static final Logger LOGGER = Logger.getLogger({{_CLASS_}}.class.getName());
15
+
16
+ @Override
17
+ public JOB_STATUS handleJobExecute(JobRequest request, Context arg1) throws Exception {
18
+ try {
19
+ ZCProject.initProject();
20
+ Object eventData = request.getAllJobParams();
21
+ if(eventData != null) {
22
+ LOGGER.log(Level.SEVERE, "Data is" + eventData.toString());
23
+ }
24
+ LOGGER.log(Level.SEVERE, "Project Details " + request.getProjectDetails().toString());
25
+ ZCCache.getInstance().putCacheValue("JobSample", "Working", 1l);
26
+ LOGGER.log(Level.SEVERE, "Inserted SucessFully:)");
27
+ } catch (Exception e) {
28
+ LOGGER.log(Level.SEVERE, "Exception in Job Function", e);
29
+ return JOB_STATUS.FAILURE;
30
+ }
31
+ return JOB_STATUS.SUCCESS;
32
+ }
33
+
34
+ }
@@ -4,6 +4,6 @@
4
4
  "main": "{{_MAIN_}}",
5
5
  "author": "{{_AUTHOR_}}",
6
6
  "dependencies": {
7
- "zcatalyst-sdk-node": "latest"
7
+ "zcatalyst-sdk-node": "beta"
8
8
  }
9
9
  }
@@ -4,6 +4,6 @@
4
4
  "main": "{{_MAIN_}}",
5
5
  "author": "{{_AUTHOR_}}",
6
6
  "dependencies": {
7
- "zcatalyst-sdk-node": "latest"
7
+ "zcatalyst-sdk-node": "beta"
8
8
  }
9
9
  }
@@ -4,6 +4,6 @@
4
4
  "main": "{{_MAIN_}}",
5
5
  "author": "{{_AUTHOR_}}",
6
6
  "dependencies": {
7
- "zcatalyst-sdk-node": "latest"
7
+ "zcatalyst-sdk-node": "beta"
8
8
  }
9
9
  }
@@ -4,6 +4,6 @@
4
4
  "main": "{{_MAIN_}}",
5
5
  "author": "{{_AUTHOR_}}",
6
6
  "dependencies": {
7
- "zcatalyst-sdk-node": "latest"
7
+ "zcatalyst-sdk-node": "beta"
8
8
  }
9
9
  }
@@ -6,6 +6,6 @@
6
6
  "type": "module",
7
7
  "dependencies": {
8
8
  "zcatalyst-integ-cliq": "latest",
9
- "zcatalyst-sdk-node": "^2.1.0"
9
+ "zcatalyst-sdk-node": "beta"
10
10
  }
11
11
  }
@@ -5,6 +5,6 @@
5
5
  "author": "{{_AUTHOR_}}",
6
6
  "type": "module",
7
7
  "dependencies": {
8
- "zcatalyst-sdk-node": "^2.1.0"
8
+ "zcatalyst-sdk-node": "beta"
9
9
  }
10
10
  }
@@ -2,9 +2,10 @@
2
2
  "deployment": {
3
3
  "name": "{{_NAME_}}",
4
4
  "stack": "{{_STACK_}}",
5
- "type": "{{_TYPE_}}"
5
+ "type": "{{_TYPE_}}",
6
+ "env_variables": {}
6
7
  },
7
8
  "execution": {
8
9
  "main": "{{_MAIN_}}"
9
10
  }
10
- }
11
+ }
@@ -4,6 +4,6 @@
4
4
  "main": "{{_MAIN_}}",
5
5
  "author": "{{_AUTHOR_}}",
6
6
  "dependencies": {
7
- "zcatalyst-sdk-node": "latest"
7
+ "zcatalyst-sdk-node": "beta"
8
8
  }
9
9
  }
@@ -0,0 +1,28 @@
1
+ /**
2
+ *
3
+ * @param {import("./types/job").JobRequest} jobRequest
4
+ * @param {import("./types/job").Context} context
5
+ */
6
+ module.exports = (jobRequest, context) => {
7
+ console.log('Hello from {{_MAIN_}}');
8
+
9
+ // function input: { job_details: { job_meta_details: { params: { key: 'value' } } } }
10
+
11
+ /**
12
+ * JOB REQUEST FUNCTIONALITIES
13
+ */
14
+
15
+ const projectDetails = jobRequest.getProjectDetails(); // to get the current project details
16
+ const jobDetails = jobRequest.getJobDetails(); // to get the current job details
17
+ const jobMetaDetails = jobRequest.getJobMetaDetails(); // to get the current job's meta details
18
+ const jobpoolDetails = jobRequest.getJobpoolDetails(); // to get the current function job pool's details
19
+ const getJobCapacityAttributes = jobRequest.getJobCapacityAttributes(); // to get the current jobs capacity
20
+ const allJobParams = jobRequest.getAllJobParams(); // to get all the parameters supplied to the job function
21
+ const jobParam = jobRequest.getJobParam('key'); // to get the value of a particular parameter supplied to the job function
22
+
23
+ /**
24
+ * CONTEXT FUNCTIONALITIES
25
+ */
26
+ context.closeWithSuccess(); //end of application with success
27
+ // context.closeWithFailure(); //end of application with failure
28
+ };
@@ -0,0 +1,66 @@
1
+ /**
2
+ * This is a utility file with the type declaration of the job function parameters
3
+ */
4
+
5
+ /**
6
+ * Type of the Job Request object. Contains the required details of the current job.
7
+ */
8
+ export interface JobRequest {
9
+ /**
10
+ * @returns Current project details
11
+ */
12
+ getProjectDetails: () => Record<string, unknown>;
13
+ /**
14
+ * @returns Details of the current job
15
+ */
16
+ getJobDetails: () => Record<string, unknown>;
17
+ /**
18
+ * @returns Meta details of the current job
19
+ */
20
+ getJobMetaDetails: () => Record<string, unknown>;
21
+ /**
22
+ * @returns Job pool details of the current job
23
+ */
24
+ getJobpoolDetails: () => Record<string, unknown>;
25
+ /**
26
+ * @returns Capacity attributes of the current job
27
+ */
28
+ getJobCapacityAttributes: () => Record<string, string | number>;
29
+ /**
30
+ *
31
+ * @returns All parameters passed to the job function
32
+ */
33
+ getAllJobParams: () => Record<string, string>;
34
+ /**
35
+ * @param key Name of the job param
36
+ * @returns Value of the job param
37
+ */
38
+ getJobParam: (key: string) => string | undefined;
39
+ }
40
+
41
+ /**
42
+ * Type of the context object. This object is used to initialize the Catalyst sdk
43
+ */
44
+ export interface Context extends Record<string, unknown> {
45
+ /**
46
+ * Contains the necessary headers to initialize the sdk
47
+ */
48
+ catalystHeaders: Record<string, string | number>;
49
+ /**
50
+ * @returns Maximum allowed execution time of the function
51
+ */
52
+ getMaxExecutionTimeMs: () => number;
53
+ /**
54
+ * This values is the difference between time Maximum execution time and the current time
55
+ * @returns Remaining execution time of the function
56
+ */
57
+ getRemainingExecutionTimeMs: () => number;
58
+ /**
59
+ * Conclude the function execution with a success response
60
+ */
61
+ closeWithSuccess: () => void;
62
+ /**
63
+ * Conclude the function execution with a failure response
64
+ */
65
+ closeWithFailure: () => void;
66
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "deployment": {
3
+ "name": "{{_NAME_}}",
4
+ "stack": "{{_STACK_}}",
5
+ "type": "{{_TYPE_}}",
6
+ "env_variables": {}
7
+ },
8
+ "execution": {
9
+ "main": "{{_MAIN_}}"
10
+ }
11
+ }
@@ -0,0 +1 @@
1
+ zcatalyst-sdk=={{_VERSION_}}
@@ -0,0 +1,23 @@
1
+ import logging
2
+
3
+
4
+ def handler(job_request, context):
5
+ logger = logging.getLogger()
6
+ logger.info('Hello from {{_MAIN_}}')
7
+
8
+ # function input: { job_details: { job_meta_details: { params: { key: 'value' } } } }
9
+
10
+ '''JobRequest Functionalities'''
11
+ job_details = job_request.get_job_details() # get the details of the current job
12
+ project_details = job_request.get_project_details() # get the details of the current project
13
+ job_meta_details = job_request.get_job_meta_details() # get the job meta of the current job
14
+ job_pool_details = job_request.get_job_pool_details() # get the current functions job pool details
15
+ job_capacity_attributes = job_request.get_job_capacity_attributes() # get the current jobs capacity
16
+ all_job_params = job_request.get_all_job_params() # get all the parameters supplied to the job function
17
+ job_param = job_request.get_job_param('key') # get the value of a particular parameter supplied to the job function
18
+
19
+ '''Context Functionalities'''
20
+ remaining_execution_time_ms = context.get_remaining_execution_time_ms() # get the maximum allowed execution time for the job functions
21
+ max_execution_time_ms = context.get_max_execution_time_ms() # get the remaining execution time for this job function
22
+ # context.close_with_failure() # conclude the function execution with a failure response
23
+ context.close_with_success() # conclude the function execution with a success response
@@ -0,0 +1,13 @@
1
+ if (typeof catalyst === 'undefined'){
2
+ throw new Error('Catalyst Web SDK not included. You must include it before /__catalyst/sdk/init.js');
3
+ }
4
+
5
+ catalyst.initApp({
6
+ project_Id : "{{__PROJECT_ID__}}", //No I18N
7
+ zaid : "{{__ZAID__}}", //No I18N
8
+ auth_domain : "{{__AUTH_DOMAIN__}}",
9
+ is_appsail : "true",
10
+ api_domain : ""
11
+ },{
12
+ org_id: "{{__ORG_ID__}}" //No I18N
13
+ });