@wenlarge/communication 1.1.2 → 1.1.3

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.
@@ -0,0 +1 @@
1
+ export declare const EXECUTOR_CORE_PROTO_PATH: string[];
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EXECUTOR_CORE_PROTO_PATH = void 0;
4
+ exports.EXECUTOR_CORE_PROTO_PATH = ["proto/executor-core.proto"];
@@ -0,0 +1,21 @@
1
+ import { Metadata } from "@grpc/grpc-js";
2
+ import { Observable } from "rxjs";
3
+ export declare const protobufPackage = "executor_core";
4
+ export interface ExecuteNodeRequest {
5
+ nodeTypeId: string;
6
+ nodeId: string;
7
+ config: string;
8
+ inputSchema: string;
9
+ }
10
+ export interface ExecuteNodeResponse {
11
+ lastResult: string;
12
+ }
13
+ export declare const EXECUTOR_CORE_PACKAGE_NAME = "executor_core";
14
+ export interface CoreExecutionServiceClient {
15
+ executeNode(request: ExecuteNodeRequest, metadata?: Metadata): Observable<ExecuteNodeResponse>;
16
+ }
17
+ export interface CoreExecutionServiceController {
18
+ executeNode(request: ExecuteNodeRequest, metadata?: Metadata): Promise<ExecuteNodeResponse> | Observable<ExecuteNodeResponse> | ExecuteNodeResponse;
19
+ }
20
+ export declare function CoreExecutionServiceControllerMethods(): (constructor: Function) => void;
21
+ export declare const CORE_EXECUTION_SERVICE_NAME = "CoreExecutionService";
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v1.181.2
5
+ // protoc v6.33.2
6
+ // source: executor-core.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.CORE_EXECUTION_SERVICE_NAME = exports.EXECUTOR_CORE_PACKAGE_NAME = exports.protobufPackage = void 0;
9
+ exports.CoreExecutionServiceControllerMethods = CoreExecutionServiceControllerMethods;
10
+ const microservices_1 = require("@nestjs/microservices");
11
+ exports.protobufPackage = "executor_core";
12
+ exports.EXECUTOR_CORE_PACKAGE_NAME = "executor_core";
13
+ function CoreExecutionServiceControllerMethods() {
14
+ return function (constructor) {
15
+ const grpcMethods = ["executeNode"];
16
+ for (const method of grpcMethods) {
17
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
18
+ (0, microservices_1.GrpcMethod)("CoreExecutionService", method)(constructor.prototype[method], method, descriptor);
19
+ }
20
+ const grpcStreamMethods = [];
21
+ for (const method of grpcStreamMethods) {
22
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
23
+ (0, microservices_1.GrpcStreamMethod)("CoreExecutionService", method)(constructor.prototype[method], method, descriptor);
24
+ }
25
+ };
26
+ }
27
+ exports.CORE_EXECUTION_SERVICE_NAME = "CoreExecutionService";
@@ -36,28 +36,26 @@ export interface TriggerExecutionRequest {
36
36
  export interface TriggerExecutionResponse {
37
37
  ok: boolean;
38
38
  }
39
- /** NODE SERVICE COMPS */
40
39
  export interface CreateWorkflowNodeRequest {
41
40
  workflowId: string;
42
41
  name: string;
43
- type: string;
44
42
  positionX: number;
45
43
  positionY: number;
46
44
  inputSchema: string;
47
45
  outputSchema: string;
48
46
  config: string;
49
- nextNodeIds: string[];
47
+ nodeTypeId: string;
50
48
  }
51
49
  export interface UpdateWorkflowNodeRequest {
52
50
  id: string;
53
51
  name: string;
54
- type: string;
52
+ nodeTypeId: string;
55
53
  positionX: number;
56
54
  positionY: number;
57
- nextNodeIds: string[];
58
55
  inputSchema: string;
59
56
  outputSchema: string;
60
57
  config: string;
58
+ workflowId: string;
61
59
  }
62
60
  export interface DeleteWorkflowNodeRequest {
63
61
  id: string;
@@ -80,15 +78,30 @@ export interface FindFirstWorkflowNodeResponse {
80
78
  export interface WorkflowNodeResponse {
81
79
  id: string;
82
80
  name: string;
83
- type: string;
81
+ nodeTypeId: string;
84
82
  positionX: number;
85
83
  positionY: number;
86
84
  inputSchema: string;
87
85
  outputSchema: string;
88
86
  config: string;
89
- nextNodeIds: string[];
90
87
  createdAt: string;
91
88
  updatedAt: string;
89
+ workflowId: string;
90
+ }
91
+ export interface WorkflowNodeConnection {
92
+ id: string;
93
+ workflowId: string;
94
+ fromNodeId: string;
95
+ toNodeId: string;
96
+ }
97
+ export interface UpdateBatchWorkflowRequest {
98
+ workflowId: string;
99
+ nodes: UpdateWorkflowNodeRequest[];
100
+ connections: UpdateBatchConnection[];
101
+ }
102
+ export interface UpdateBatchConnection {
103
+ fromNodeId: string;
104
+ toNodeId: string;
92
105
  }
93
106
  export declare const WORKFLOW_PACKAGE_NAME = "workflow";
94
107
  export interface WorkflowServiceClient {
@@ -102,6 +115,7 @@ export interface WorkflowServiceClient {
102
115
  findFirstWorkflowNode(request: FindFirstWorkflowNodeRequest, metadata?: Metadata): Observable<FindFirstWorkflowNodeResponse>;
103
116
  updateWorkflowNode(request: UpdateWorkflowNodeRequest, metadata?: Metadata): Observable<WorkflowNodeResponse>;
104
117
  deleteWorkflowNode(request: DeleteWorkflowNodeRequest, metadata?: Metadata): Observable<Empty>;
118
+ updateBatchWorkflow(request: UpdateBatchWorkflowRequest, metadata?: Metadata): Observable<Empty>;
105
119
  }
106
120
  export interface WorkflowServiceController {
107
121
  create(request: CreateWorkflowRequest, metadata?: Metadata): Promise<WorkflowResponse> | Observable<WorkflowResponse> | WorkflowResponse;
@@ -114,6 +128,7 @@ export interface WorkflowServiceController {
114
128
  findFirstWorkflowNode(request: FindFirstWorkflowNodeRequest, metadata?: Metadata): Promise<FindFirstWorkflowNodeResponse> | Observable<FindFirstWorkflowNodeResponse> | FindFirstWorkflowNodeResponse;
115
129
  updateWorkflowNode(request: UpdateWorkflowNodeRequest, metadata?: Metadata): Promise<WorkflowNodeResponse> | Observable<WorkflowNodeResponse> | WorkflowNodeResponse;
116
130
  deleteWorkflowNode(request: DeleteWorkflowNodeRequest, metadata?: Metadata): void;
131
+ updateBatchWorkflow(request: UpdateBatchWorkflowRequest, metadata?: Metadata): void;
117
132
  }
118
133
  export declare function WorkflowServiceControllerMethods(): (constructor: Function) => void;
119
134
  export declare const WORKFLOW_SERVICE_NAME = "WorkflowService";
@@ -23,6 +23,7 @@ function WorkflowServiceControllerMethods() {
23
23
  "findFirstWorkflowNode",
24
24
  "updateWorkflowNode",
25
25
  "deleteWorkflowNode",
26
+ "updateBatchWorkflow",
26
27
  ];
27
28
  for (const method of grpcMethods) {
28
29
  const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
@@ -3,6 +3,7 @@ export interface GrpcClientModuleOptions {
3
3
  authServiceUrl: string;
4
4
  projectServiceUrl: string;
5
5
  workflowServiceUrl: string;
6
+ executorCoreServiceUrl: string;
6
7
  }
7
8
  export declare class GrpcClientModule {
8
9
  static forRoot(options: GrpcClientModuleOptions): DynamicModule;
@@ -48,6 +48,8 @@ const auth_config_1 = require("../config/auth-config");
48
48
  const project_config_1 = require("../config/project-config");
49
49
  const workflow_1 = require("../generated/workflow");
50
50
  const workflow_config_1 = require("../config/workflow-config");
51
+ const executor_core_1 = require("../generated/executor-core");
52
+ const executor_core_config_1 = require("../config/executor-core-config");
51
53
  let GrpcClientModule = (() => {
52
54
  let _classDecorators = [(0, common_1.Module)({})];
53
55
  let _classDescriptor;
@@ -108,6 +110,22 @@ let GrpcClientModule = (() => {
108
110
  },
109
111
  },
110
112
  },
113
+ {
114
+ name: executor_core_1.CORE_EXECUTION_SERVICE_NAME,
115
+ transport: microservices_1.Transport.GRPC,
116
+ options: {
117
+ package: executor_core_1.EXECUTOR_CORE_PACKAGE_NAME,
118
+ protoPath: executor_core_config_1.EXECUTOR_CORE_PROTO_PATH.map((p) => (0, path_1.join)(__dirname, "../../" + p)),
119
+ url: options.executorCoreServiceUrl,
120
+ loader: {
121
+ keepCase: true,
122
+ longs: String,
123
+ enums: String,
124
+ defaults: true,
125
+ oneofs: true,
126
+ },
127
+ },
128
+ },
111
129
  ]),
112
130
  ],
113
131
  exports: [microservices_1.ClientsModule],
package/dist/index.d.ts CHANGED
@@ -6,4 +6,7 @@ export * from "./config/workflow-config";
6
6
  export * as Project from "./generated/project";
7
7
  export * from "./config/project-config";
8
8
  export * from "./grpc-client";
9
+ export * from "./config/executor-core-config";
9
10
  export { Metadata } from "@grpc/grpc-js";
11
+ export * as ExecutorCore from "./generated/executor-core";
12
+ export * from "./kafka/kafka-topics";
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.Metadata = exports.Project = exports.Workflow = exports.Auth = void 0;
39
+ exports.ExecutorCore = exports.Metadata = exports.Project = exports.Workflow = exports.Auth = void 0;
40
40
  __exportStar(require("./helpers/helper"), exports);
41
41
  exports.Auth = __importStar(require("./generated/auth"));
42
42
  __exportStar(require("./config/auth-config"), exports);
@@ -45,5 +45,8 @@ __exportStar(require("./config/workflow-config"), exports);
45
45
  exports.Project = __importStar(require("./generated/project"));
46
46
  __exportStar(require("./config/project-config"), exports);
47
47
  __exportStar(require("./grpc-client"), exports);
48
+ __exportStar(require("./config/executor-core-config"), exports);
48
49
  var grpc_js_1 = require("@grpc/grpc-js");
49
50
  Object.defineProperty(exports, "Metadata", { enumerable: true, get: function () { return grpc_js_1.Metadata; } });
51
+ exports.ExecutorCore = __importStar(require("./generated/executor-core"));
52
+ __exportStar(require("./kafka/kafka-topics"), exports);
@@ -0,0 +1,23 @@
1
+ export type TriggerExecutionPayload = {
2
+ nodeId: string;
3
+ };
4
+ export type ExecutionWaitingPayload = {
5
+ nodeId: string;
6
+ nodeTypeId: string;
7
+ workflowId: string;
8
+ config: string;
9
+ inputSchema: string;
10
+ triggeredAt: number;
11
+ };
12
+ export type ExecutionCompletedPayload = {
13
+ workflowId: string;
14
+ nodeId: string;
15
+ result: string;
16
+ finishedAt: number;
17
+ };
18
+ export type ExecutionFailedPayload = {
19
+ workflowId: string;
20
+ nodeId: string;
21
+ error: string;
22
+ failedAt: number;
23
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,5 @@
1
- export declare enum KafkaTopics {
2
- EXECUTION_TRIGGER = "execution.trigger"
3
- }
1
+ export declare const KafkaTopics: {
2
+ readonly EXECUTION_COMPLETED: "execution.completed";
3
+ readonly EXECUTION_FAILED: "execution.failed";
4
+ readonly EXECUTION_WAITING: "execution.waiting";
5
+ };
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.KafkaTopics = void 0;
4
- var KafkaTopics;
5
- (function (KafkaTopics) {
6
- KafkaTopics["EXECUTION_TRIGGER"] = "execution.trigger";
7
- })(KafkaTopics || (exports.KafkaTopics = KafkaTopics = {}));
4
+ exports.KafkaTopics = {
5
+ EXECUTION_COMPLETED: "execution.completed",
6
+ EXECUTION_FAILED: "execution.failed",
7
+ EXECUTION_WAITING: "execution.waiting",
8
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wenlarge/communication",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Shared gRPC proto interfaces and generated clients for Wenlarge microservices.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,18 @@
1
+ syntax = "proto3";
2
+
3
+ package executor_core;
4
+
5
+ message ExecuteNodeRequest {
6
+ string nodeTypeId = 1;
7
+ string nodeId = 2;
8
+ string config = 3;
9
+ string inputSchema = 4;
10
+ }
11
+
12
+ message ExecuteNodeResponse {
13
+ string lastResult = 1;
14
+ }
15
+
16
+ service CoreExecutionService {
17
+ rpc ExecuteNode (ExecuteNodeRequest) returns (ExecuteNodeResponse);
18
+ }
@@ -15,6 +15,7 @@ service WorkflowService {
15
15
  rpc FindFirstWorkflowNode (FindFirstWorkflowNodeRequest) returns (FindFirstWorkflowNodeResponse);
16
16
  rpc UpdateWorkflowNode (UpdateWorkflowNodeRequest) returns (WorkflowNodeResponse);
17
17
  rpc DeleteWorkflowNode (DeleteWorkflowNodeRequest) returns (google.protobuf.Empty);
18
+ rpc UpdateBatchWorkflow (UpdateBatchWorkflowRequest) returns (google.protobuf.Empty);
18
19
  }
19
20
 
20
21
  message CreateWorkflowRequest {
@@ -59,29 +60,27 @@ message TriggerExecutionResponse{
59
60
  bool ok = 1;
60
61
  }
61
62
 
62
- // NODE SERVICE COMPS
63
63
  message CreateWorkflowNodeRequest{
64
64
  string workflowId = 1;
65
65
  string name = 2;
66
- string type = 3;
67
- int32 positionX = 4;
68
- int32 positionY = 5;
69
- string inputSchema = 6;
70
- string outputSchema = 7;
71
- string config = 8;
72
- repeated string nextNodeIds = 9;
66
+ int32 positionX = 3;
67
+ int32 positionY = 4;
68
+ string inputSchema = 5;
69
+ string outputSchema = 6;
70
+ string config = 7;
71
+ string nodeTypeId = 8;
73
72
  }
74
73
 
75
74
  message UpdateWorkflowNodeRequest{
76
75
  string id = 1;
77
76
  string name = 2;
78
- string type =3;
77
+ string nodeTypeId = 3;
79
78
  int32 positionX = 4;
80
79
  int32 positionY=5;
81
- repeated string nextNodeIds = 6;
82
- string inputSchema = 7;
83
- string outputSchema = 8;
84
- string config = 9;
80
+ string inputSchema = 6;
81
+ string outputSchema = 7;
82
+ string config = 8;
83
+ string workflowId = 9;
85
84
  }
86
85
 
87
86
  message DeleteWorkflowNodeRequest{
@@ -109,13 +108,31 @@ message FindFirstWorkflowNodeResponse{
109
108
  message WorkflowNodeResponse{
110
109
  string id = 1;
111
110
  string name = 2;
112
- string type = 3;
111
+ string nodeTypeId = 3;
113
112
  int32 positionX = 4;
114
113
  int32 positionY = 5;
115
114
  string inputSchema = 6;
116
115
  string outputSchema = 7;
117
116
  string config = 8;
118
- repeated string nextNodeIds = 9;
119
- string createdAt = 10;
120
- string updatedAt = 11;
117
+ string createdAt = 9;
118
+ string updatedAt = 10;
119
+ string workflowId = 11;
120
+ }
121
+
122
+ message WorkflowNodeConnection {
123
+ string id = 1;
124
+ string workflowId = 2;
125
+ string fromNodeId = 3;
126
+ string toNodeId = 4;
127
+ }
128
+
129
+ message UpdateBatchWorkflowRequest {
130
+ string workflowId = 1;
131
+ repeated UpdateWorkflowNodeRequest nodes = 2;
132
+ repeated UpdateBatchConnection connections = 3;
133
+ }
134
+
135
+ message UpdateBatchConnection {
136
+ string fromNodeId = 1;
137
+ string toNodeId = 2;
121
138
  }
@@ -0,0 +1,53 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v1.181.2
4
+ // protoc v6.33.2
5
+ // source: executor-core.proto
6
+
7
+ /* eslint-disable */
8
+ import { Metadata } from "@grpc/grpc-js";
9
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
10
+ import { Observable } from "rxjs";
11
+
12
+ export const protobufPackage = "executor_core";
13
+
14
+ export interface ExecuteNodeRequest {
15
+ nodeTypeId: string;
16
+ nodeId: string;
17
+ config: string;
18
+ inputSchema: string;
19
+ }
20
+
21
+ export interface ExecuteNodeResponse {
22
+ lastResult: string;
23
+ }
24
+
25
+ export const EXECUTOR_CORE_PACKAGE_NAME = "executor_core";
26
+
27
+ export interface CoreExecutionServiceClient {
28
+ executeNode(request: ExecuteNodeRequest, metadata?: Metadata): Observable<ExecuteNodeResponse>;
29
+ }
30
+
31
+ export interface CoreExecutionServiceController {
32
+ executeNode(
33
+ request: ExecuteNodeRequest,
34
+ metadata?: Metadata,
35
+ ): Promise<ExecuteNodeResponse> | Observable<ExecuteNodeResponse> | ExecuteNodeResponse;
36
+ }
37
+
38
+ export function CoreExecutionServiceControllerMethods() {
39
+ return function (constructor: Function) {
40
+ const grpcMethods: string[] = ["executeNode"];
41
+ for (const method of grpcMethods) {
42
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
43
+ GrpcMethod("CoreExecutionService", method)(constructor.prototype[method], method, descriptor);
44
+ }
45
+ const grpcStreamMethods: string[] = [];
46
+ for (const method of grpcStreamMethods) {
47
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
48
+ GrpcStreamMethod("CoreExecutionService", method)(constructor.prototype[method], method, descriptor);
49
+ }
50
+ };
51
+ }
52
+
53
+ export const CORE_EXECUTION_SERVICE_NAME = "CoreExecutionService";
@@ -54,29 +54,27 @@ export interface TriggerExecutionResponse {
54
54
  ok: boolean;
55
55
  }
56
56
 
57
- /** NODE SERVICE COMPS */
58
57
  export interface CreateWorkflowNodeRequest {
59
58
  workflowId: string;
60
59
  name: string;
61
- type: string;
62
60
  positionX: number;
63
61
  positionY: number;
64
62
  inputSchema: string;
65
63
  outputSchema: string;
66
64
  config: string;
67
- nextNodeIds: string[];
65
+ nodeTypeId: string;
68
66
  }
69
67
 
70
68
  export interface UpdateWorkflowNodeRequest {
71
69
  id: string;
72
70
  name: string;
73
- type: string;
71
+ nodeTypeId: string;
74
72
  positionX: number;
75
73
  positionY: number;
76
- nextNodeIds: string[];
77
74
  inputSchema: string;
78
75
  outputSchema: string;
79
76
  config: string;
77
+ workflowId: string;
80
78
  }
81
79
 
82
80
  export interface DeleteWorkflowNodeRequest {
@@ -105,15 +103,33 @@ export interface FindFirstWorkflowNodeResponse {
105
103
  export interface WorkflowNodeResponse {
106
104
  id: string;
107
105
  name: string;
108
- type: string;
106
+ nodeTypeId: string;
109
107
  positionX: number;
110
108
  positionY: number;
111
109
  inputSchema: string;
112
110
  outputSchema: string;
113
111
  config: string;
114
- nextNodeIds: string[];
115
112
  createdAt: string;
116
113
  updatedAt: string;
114
+ workflowId: string;
115
+ }
116
+
117
+ export interface WorkflowNodeConnection {
118
+ id: string;
119
+ workflowId: string;
120
+ fromNodeId: string;
121
+ toNodeId: string;
122
+ }
123
+
124
+ export interface UpdateBatchWorkflowRequest {
125
+ workflowId: string;
126
+ nodes: UpdateWorkflowNodeRequest[];
127
+ connections: UpdateBatchConnection[];
128
+ }
129
+
130
+ export interface UpdateBatchConnection {
131
+ fromNodeId: string;
132
+ toNodeId: string;
117
133
  }
118
134
 
119
135
  export const WORKFLOW_PACKAGE_NAME = "workflow";
@@ -144,6 +160,8 @@ export interface WorkflowServiceClient {
144
160
  updateWorkflowNode(request: UpdateWorkflowNodeRequest, metadata?: Metadata): Observable<WorkflowNodeResponse>;
145
161
 
146
162
  deleteWorkflowNode(request: DeleteWorkflowNodeRequest, metadata?: Metadata): Observable<Empty>;
163
+
164
+ updateBatchWorkflow(request: UpdateBatchWorkflowRequest, metadata?: Metadata): Observable<Empty>;
147
165
  }
148
166
 
149
167
  export interface WorkflowServiceController {
@@ -190,6 +208,8 @@ export interface WorkflowServiceController {
190
208
  ): Promise<WorkflowNodeResponse> | Observable<WorkflowNodeResponse> | WorkflowNodeResponse;
191
209
 
192
210
  deleteWorkflowNode(request: DeleteWorkflowNodeRequest, metadata?: Metadata): void;
211
+
212
+ updateBatchWorkflow(request: UpdateBatchWorkflowRequest, metadata?: Metadata): void;
193
213
  }
194
214
 
195
215
  export function WorkflowServiceControllerMethods() {
@@ -205,6 +225,7 @@ export function WorkflowServiceControllerMethods() {
205
225
  "findFirstWorkflowNode",
206
226
  "updateWorkflowNode",
207
227
  "deleteWorkflowNode",
228
+ "updateBatchWorkflow",
208
229
  ];
209
230
  for (const method of grpcMethods) {
210
231
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
@@ -1 +0,0 @@
1
- export declare const WORKFLOW_NODE_PROTO_PATH: string[];
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WORKFLOW_NODE_PROTO_PATH = void 0;
4
- exports.WORKFLOW_NODE_PROTO_PATH = [
5
- 'proto/workflow-node.proto',
6
- ];