zcatalyst-cli 1.18.0-beta.1 → 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 (88) hide show
  1. package/docs/command_needs/rc.toml +8 -8
  2. package/docs/commands/ds/import.toml +5 -5
  3. package/docs/commands/zest/generate/index.toml +4 -0
  4. package/docs/serve/server/lib/appsail/index.toml +22 -1
  5. package/lib/authentication/login.js +8 -4
  6. package/lib/code-deck.js +7 -7
  7. package/lib/command_needs/rc.js +7 -7
  8. package/lib/commands/appsail/add.js +2 -2
  9. package/lib/commands/client/setup.js +1 -1
  10. package/lib/commands/codelib/install.js +6 -2
  11. package/lib/commands/ds/import.js +37 -21
  12. package/lib/commands/event/generate/index.js +14 -2
  13. package/lib/commands/functions/add.js +1 -1
  14. package/lib/commands/functions/setup.js +1 -1
  15. package/lib/commands/iac/export.js +5 -1
  16. package/lib/commands/iac/import.js +4 -1
  17. package/lib/commands/index.js +1 -0
  18. package/lib/commands/init.js +8 -1
  19. package/lib/commands/zest/generate/index.js +304 -0
  20. package/lib/deploy/features/appsail/index.js +25 -10
  21. package/lib/endpoints/index.js +17 -3
  22. package/lib/endpoints/lib/ds-bulk.js +1 -0
  23. package/lib/endpoints/lib/stratus.js +63 -0
  24. package/lib/endpoints/lib/tunnel.js +18 -0
  25. package/lib/endpoints/lib/zest.js +124 -0
  26. package/lib/event_generate/stratus.js +52 -0
  27. package/lib/fn-utils/lib/common.js +6 -1
  28. package/lib/iac/status/deploy.js +1 -5
  29. package/lib/init/features/appsail/index.js +34 -27
  30. package/lib/init/features/project.js +6 -15
  31. package/lib/internal/api.js +14 -6
  32. package/lib/internal/command.js +1 -1
  33. package/lib/prompt/index.js +5 -2
  34. package/lib/prompt/types/file-path.js +1 -1
  35. package/lib/prompt/types/search-box.js +281 -0
  36. package/lib/serve/features/appsail.js +1 -1
  37. package/lib/serve/server/index.js +44 -14
  38. package/lib/serve/server/lib/appsail/index.js +73 -13
  39. package/lib/serve/server/lib/appsail/start.js +9 -1
  40. package/lib/serve/server/lib/java/aio_server/lib/catalyst-cli-java-runtime-1.0.0.jar +0 -0
  41. 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
  42. package/lib/serve/server/lib/java/aio_server/lib/catalyst-java-runtime-1.0.0.jar +0 -0
  43. package/lib/serve/server/lib/java/index.js +1 -1
  44. package/lib/serve/server/lib/master/appsail.js +3 -3
  45. package/lib/serve/server/lib/master/unknown-req-proxy.js +5 -2
  46. package/lib/serve/server/lib/master/utils.js +27 -15
  47. package/lib/serve/server/lib/node/index.js +1 -1
  48. package/lib/serve/server/lib/node/server/package-lock.json +12 -0
  49. package/lib/serve/server/lib/python/index.js +1 -1
  50. package/lib/shell/dependencies/http-functions.js +1 -1
  51. package/lib/shell/dependencies/invoker/bio/java/lib/{catalyst-function-sdk-1.0.0.jar → catalyst-function-sdk-1.1.0.jar} +0 -0
  52. package/lib/shell/dependencies/invoker/cron/java/JavacronInvoker.java +1 -1
  53. package/lib/shell/dependencies/invoker/cron/java/lib/{catalyst-function-sdk-1.0.0.jar → catalyst-function-sdk-1.1.0.jar} +0 -0
  54. package/lib/shell/dependencies/invoker/event/java/lib/{catalyst-function-sdk-1.0.0.jar → catalyst-function-sdk-1.1.0.jar} +0 -0
  55. package/lib/shell/dependencies/invoker/integ/java/JavaintegInvoker.java +15 -0
  56. package/lib/shell/dependencies/invoker/integ/java/lib/catalyst-function-sdk-1.1.0.jar +0 -0
  57. package/lib/shell/dependencies/invoker/integ/node.mjs +13 -0
  58. package/lib/shell/dependencies/invoker/job/java/JavajobInvoker.java +15 -1
  59. package/lib/shell/dependencies/invoker/job/java/lib/catalyst-function-sdk-1.1.0.jar +0 -0
  60. package/lib/shell/dependencies/local-function.js +24 -23
  61. package/lib/shell/dependencies/tunnel-server.js +52 -23
  62. package/lib/shell/index.js +22 -28
  63. package/lib/util_modules/config/lib/appsail.js +10 -8
  64. package/lib/util_modules/constants/lib/dc-type.js +8 -0
  65. package/lib/util_modules/constants/lib/event-action.js +1 -0
  66. package/lib/util_modules/constants/lib/event-source.js +1 -0
  67. package/lib/util_modules/constants/lib/placeholders.js +2 -1
  68. package/lib/util_modules/constants/lib/scopes.js +14 -3
  69. package/lib/util_modules/constants/lib/urls.js +8 -0
  70. package/lib/util_modules/fs/lib/async.js +7 -2
  71. package/package.json +4 -2
  72. package/templates/init/client/react/react_js/template/src/index.js +3 -3
  73. package/templates/init/client/react/react_ts/template/src/index.tsx +3 -3
  74. package/templates/init/client/react/react_ts/template.json +3 -3
  75. package/templates/init/functions/java/job/sample.java +1 -1
  76. package/templates/init/functions/node/aio/sample.js +7 -0
  77. package/templates/init/functions/node/bio/sample.js +5 -0
  78. package/templates/init/functions/node/bio/types/basicio.d.ts +57 -0
  79. package/templates/init/functions/node/cron/sample.js +5 -0
  80. package/templates/init/functions/node/cron/types/cron.d.ts +64 -0
  81. package/templates/init/functions/node/event/sample.js +11 -8
  82. package/templates/init/functions/node/event/types/event.d.ts +82 -0
  83. package/templates/init/functions/node/job/sample.js +0 -1
  84. package/templates/init/functions/node/job/types/job.d.ts +0 -4
  85. package/templates/init/functions/python/job/sample.py +0 -1
  86. package/templates/init.txt +2 -1
  87. package/lib/shell/dependencies/invoker/integ/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
  88. package/lib/shell/dependencies/invoker/job/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
@@ -0,0 +1,57 @@
1
+ /**
2
+ * This is a utility file with the type declaration of the BasicIO function parameters
3
+ */
4
+
5
+ /**
6
+ * Type of the BasicIO object. Contains the functional APIs of BasicIO
7
+ */
8
+ export interface BasicIO {
9
+ /**
10
+ * Write to the BasicIO output
11
+ * @param value input string
12
+ * @returns
13
+ */
14
+ write: (value: string) => void;
15
+ /**
16
+ * Set the BasicIO status code
17
+ * @param statusCode status code of BasicIO
18
+ * @returns
19
+ */
20
+ setStatus: (statusCode: number) => void;
21
+ /**
22
+ * Get the input argument values of the BasicIO
23
+ * @param key argument name(key)
24
+ * @returns argument value as string
25
+ */
26
+ getArgument: (key: string) => string;
27
+ /**
28
+ * Get all input arguments
29
+ * @returns all arguments as key value pair
30
+ */
31
+ getAllArguments: () => Record<string, string>;
32
+ }
33
+
34
+ /**
35
+ * Type of the context object of the function
36
+ */
37
+ export interface Context {
38
+ /**
39
+ * Contains catalyst auth headers (for internal use)
40
+ */
41
+ catalystHeaders: Record<string, string>;
42
+ /**
43
+ * To indicate the end of a function execution
44
+ * @returns
45
+ */
46
+ close: () => void;
47
+ /**
48
+ * Fetch the remaining execution time of the function
49
+ * @returns remaining execution time in milliseconds
50
+ */
51
+ getRemainingExecutionTimeMs: () => number;
52
+ /**
53
+ * Fetch the maximum execution time of the function
54
+ * @returns maximum execution time in milliseconds
55
+ */
56
+ getMaxExecutionTimeMs: () => number;
57
+ }
@@ -1,3 +1,8 @@
1
+ /**
2
+ *
3
+ * @param {import('./types/cron').CronDetails} cronDetails
4
+ * @param {import('./types/cron').Context} context
5
+ */
1
6
  module.exports = (cronDetails, context) => {
2
7
  console.log('Hello from {{_MAIN_}}');
3
8
 
@@ -0,0 +1,64 @@
1
+ /**
2
+ * This is a utility file with the type declaration of the Cron function parameters
3
+ */
4
+
5
+ /**
6
+ * Type of Cron Details object. Contains the details of the scheduled cron
7
+ */
8
+ export interface CronDetails {
9
+ /**
10
+ * Get the input param value of the Cron function
11
+ * @returns input param value
12
+ */
13
+ getCronParam: () => string;
14
+ /**
15
+ * Get all input params of the Cron function
16
+ * @returns all input params as key value pairs
17
+ */
18
+ getAllCronParam: () => Record<string, string>;
19
+ /**
20
+ * Get the remaining execution count of the cron job
21
+ * @returns remaining execution count
22
+ */
23
+ getRemainingExecutionCount: () => number;
24
+ /**
25
+ * Get the details of the cron which executed the function
26
+ * @returns cron details
27
+ */
28
+ getCronDetails: () => Record<string, unknown>;
29
+ /**
30
+ * Get the current project details
31
+ * @returns project details
32
+ */
33
+ getProjectDetails: () => Record<string, unknown>;
34
+ }
35
+
36
+ /**
37
+ * Type of the Context object of the Cron function
38
+ */
39
+ export interface Context {
40
+ /**
41
+ * Contains catalyst auth headers (for internal use)
42
+ */
43
+ catalystHeaders: Record<string, string>;
44
+ /**
45
+ * Close the Cron function with success response
46
+ * @returns
47
+ */
48
+ closeWithSuccess: () => void;
49
+ /**
50
+ * Close the Cron function failure response
51
+ * @returns
52
+ */
53
+ closeWithFailure: () => void;
54
+ /**
55
+ * Get the remaining execution time of the Cron function
56
+ * @returns remaining execution time in milliseconds
57
+ */
58
+ getRemainingExecutionTimeMs: () => number;
59
+ /**
60
+ * Get the maximum possible execution time of the Cron function
61
+ * @returns maximum possible execution time in milliseconds
62
+ */
63
+ getMaxExecutionTimeMs: () => number;
64
+ }
@@ -1,20 +1,23 @@
1
+ /**
2
+ *
3
+ * @param {import('./types/event').EventDetails} event
4
+ * @param {import('./types/event').Context} context
5
+ */
1
6
  module.exports = (event, context) => {
2
7
  /*
3
8
  EVENT FUNCTIONALITIES
4
9
  */
5
- // const DATA = event.data; //event data
6
- // const TIME = event.time; //event occured time
10
+ // const DATA = event.getData(); //event data
11
+ // const TIME = event.getTime(); //event occurred time
7
12
 
8
- // const SOURCE_DETAILS = event.getSourceDetails(); //event source details
9
- // const SOURCE_ACTION = SOURCE_DETAILS.action; //(insert | fetch | invoke ...)
10
- // const SOURCE_TYPE = SOURCE_DETAILS.type; //(datastore | cache | queue ...)
11
- // const SOURCE_ENTITY_ID = SOURCE_DETAILS.entityId; //if type is datastore then entity id is tableid
13
+ // const ACTION = event.getAction(); //(insert | fetch | invoke ...)
14
+ // const SOURCE = event.getSource(); //(datastore | cache | queue ...)
15
+ // const SOURCE_ENTITY_ID = event.getSourceEntityId(); //if type is datastore then entity id is tableid
12
16
 
13
- // const SOURCE_BUS_DETAILS = SOURCE_DETAILS.getBusDetails(); //event bus details
17
+ // const SOURCE_BUS_DETAILS = event.getBusDetails(); //event bus details
14
18
  // const SOURCE_BUS_ID = SOURCE_BUS_DETAILS.id; //event bus id
15
19
 
16
20
  // const PROJECT_DETAILS = event.getProjectDetails(); //event project details
17
- // const FUNCTION_DETAILS = event.getFunctionDetails(); //event function details
18
21
 
19
22
  console.log('Hello from {{_MAIN_}}');
20
23
 
@@ -0,0 +1,82 @@
1
+ /**
2
+ * This is a utility file with the type declaration of the Event function parameters
3
+ */
4
+
5
+ /**
6
+ * Type of Event Details object. Contains the details of the triggered Event
7
+ */
8
+ export interface EventDetails {
9
+ /**
10
+ * Event data
11
+ */
12
+ data: Record<string, unknown>;
13
+ /**
14
+ * Time of the event
15
+ */
16
+ time: number;
17
+ /**
18
+ * Get the project details of the event function
19
+ * @returns project details
20
+ */
21
+ getProjectDetails: () => Record<string, unknown>;
22
+ /**
23
+ * Functional API to get the data of the event
24
+ * @returns event data
25
+ */
26
+ getData: () => Record<string, unknown>;
27
+ /**
28
+ * Functional API to get the time of the event
29
+ * @returns event time
30
+ */
31
+ getTime: () => number;
32
+ /**
33
+ * Get the action that triggered the event
34
+ * @returns action
35
+ */
36
+ getAction: () => string;
37
+ /**
38
+ * Get the source of the event
39
+ * @returns event source
40
+ */
41
+ getSource: () => string;
42
+ /**
43
+ * Get the Id of the entity that triggered the event
44
+ * @returns source entity's Id
45
+ */
46
+ getSourceEntityId: () => string;
47
+ /**
48
+ * Get the details of the event bus
49
+ * @returns event bus details
50
+ */
51
+ getEventBusDetails: () => Record<string, unknown>;
52
+ }
53
+
54
+ /**
55
+ * Type of the Context object of the Event function
56
+ */
57
+ export interface Context {
58
+ /**
59
+ * Contains catalyst auth headers (for internal use)
60
+ */
61
+ catalystHeaders: Record<string, string>;
62
+ /**
63
+ * Close the Event function with success response
64
+ * @returns
65
+ */
66
+ closeWithSuccess: () => void;
67
+ /**
68
+ * Close the Event function failure response
69
+ * @returns
70
+ */
71
+ closeWithFailure: () => void;
72
+ /**
73
+ * Get the remaining execution time of the Event function
74
+ * @returns remaining execution time in milliseconds
75
+ */
76
+ getRemainingExecutionTimeMs: () => number;
77
+ /**
78
+ * Get the maximum possible execution time of the Event function
79
+ * @returns maximum possible execution time in milliseconds
80
+ */
81
+ getMaxExecutionTimeMs: () => number;
82
+ }
@@ -15,7 +15,6 @@ module.exports = (jobRequest, context) => {
15
15
  const projectDetails = jobRequest.getProjectDetails(); // to get the current project details
16
16
  const jobDetails = jobRequest.getJobDetails(); // to get the current job details
17
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
18
  const getJobCapacityAttributes = jobRequest.getJobCapacityAttributes(); // to get the current jobs capacity
20
19
  const allJobParams = jobRequest.getAllJobParams(); // to get all the parameters supplied to the job function
21
20
  const jobParam = jobRequest.getJobParam('key'); // to get the value of a particular parameter supplied to the job function
@@ -18,10 +18,6 @@ export interface JobRequest {
18
18
  * @returns Meta details of the current job
19
19
  */
20
20
  getJobMetaDetails: () => Record<string, unknown>;
21
- /**
22
- * @returns Job pool details of the current job
23
- */
24
- getJobpoolDetails: () => Record<string, unknown>;
25
21
  /**
26
22
  * @returns Capacity attributes of the current job
27
23
  */
@@ -11,7 +11,6 @@ def handler(job_request, context):
11
11
  job_details = job_request.get_job_details() # get the details of the current job
12
12
  project_details = job_request.get_project_details() # get the details of the current project
13
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
14
  job_capacity_attributes = job_request.get_job_capacity_attributes() # get the current jobs capacity
16
15
  all_job_params = job_request.get_all_job_params() # get all the parameters supplied to the job function
17
16
  job_param = job_request.get_job_param('key') # get the value of a particular parameter supplied to the job function
@@ -7,7 +7,8 @@ catalyst.initApp({
7
7
  zaid : "{{__ZAID__}}", //No I18N
8
8
  auth_domain : "{{__AUTH_DOMAIN__}}",
9
9
  is_appsail : "true",
10
- api_domain : ""
10
+ api_domain : "",
11
+ stratus_domain: "{{_STRATUS_DOMAIN__}}"
11
12
  },{
12
13
  org_id: "{{__ORG_ID__}}" //No I18N
13
14
  });