@factcaf-org/contracts 1.0.2 → 1.1.0
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.
- package/gen/test.ts +64 -0
- package/package.json +8 -3
- package/proto/test.proto +30 -0
package/gen/test.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.2
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: test.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "test.v1";
|
|
12
|
+
|
|
13
|
+
export interface Test1Request {
|
|
14
|
+
field1: string;
|
|
15
|
+
field2: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface Test1Response {
|
|
19
|
+
field1: string;
|
|
20
|
+
field2: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface Test2Request {
|
|
24
|
+
field1: string;
|
|
25
|
+
field2: string;
|
|
26
|
+
field3: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface Test2Response {
|
|
30
|
+
field1: string;
|
|
31
|
+
field2: string;
|
|
32
|
+
field3: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const TEST_V1_PACKAGE_NAME = "test.v1";
|
|
36
|
+
|
|
37
|
+
export interface TestServiceClient {
|
|
38
|
+
test1(request: Test1Request): Observable<Test1Response>;
|
|
39
|
+
|
|
40
|
+
test2(request: Test2Request): Observable<Test2Response>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface TestServiceController {
|
|
44
|
+
test1(request: Test1Request): Promise<Test1Response> | Observable<Test1Response> | Test1Response;
|
|
45
|
+
|
|
46
|
+
test2(request: Test2Request): Promise<Test2Response> | Observable<Test2Response> | Test2Response;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function TestServiceControllerMethods() {
|
|
50
|
+
return function (constructor: Function) {
|
|
51
|
+
const grpcMethods: string[] = ["test1", "test2"];
|
|
52
|
+
for (const method of grpcMethods) {
|
|
53
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
54
|
+
GrpcMethod("TestService", method)(constructor.prototype[method], method, descriptor);
|
|
55
|
+
}
|
|
56
|
+
const grpcStreamMethods: string[] = [];
|
|
57
|
+
for (const method of grpcStreamMethods) {
|
|
58
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
59
|
+
GrpcStreamMethod("TestService", method)(constructor.prototype[method], method, descriptor);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const TEST_SERVICE_NAME = "TestService";
|
package/package.json
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@factcaf-org/contracts",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Contracts",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
8
10
|
"repository": {
|
|
9
11
|
"url": "https://github.com/FatCafOrg/contracts",
|
|
10
12
|
"type": "git"
|
|
11
13
|
},
|
|
12
14
|
"scripts": {
|
|
13
|
-
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
|
|
15
|
+
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit",
|
|
16
|
+
"build": "tsc -p tsconfig.build.json"
|
|
14
17
|
},
|
|
15
18
|
"files": [
|
|
16
19
|
"proto",
|
|
@@ -18,9 +21,11 @@
|
|
|
18
21
|
],
|
|
19
22
|
"dependencies": {
|
|
20
23
|
"@nestjs/microservices": "^11.1.14",
|
|
24
|
+
"@types/node": "^25.3.0",
|
|
21
25
|
"rxjs": "^7.8.2"
|
|
22
26
|
},
|
|
23
27
|
"devDependencies": {
|
|
24
|
-
"ts-proto": "^2.11.2"
|
|
28
|
+
"ts-proto": "^2.11.2",
|
|
29
|
+
"typescript": "^5.9.3"
|
|
25
30
|
}
|
|
26
31
|
}
|
package/proto/test.proto
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package test.v1;
|
|
4
|
+
|
|
5
|
+
service TestService {
|
|
6
|
+
rpc Test1 (Test1Request) returns (Test1Response);
|
|
7
|
+
rpc Test2 (Test2Request) returns (Test2Response);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
message Test1Request {
|
|
11
|
+
string field1 = 1;
|
|
12
|
+
string field2 = 2;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
message Test1Response {
|
|
16
|
+
string field1 = 1;
|
|
17
|
+
string field2 = 2;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
message Test2Request {
|
|
21
|
+
string field1 = 1;
|
|
22
|
+
string field2 = 2;
|
|
23
|
+
string field3 = 3;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
message Test2Response {
|
|
27
|
+
string field1 = 1;
|
|
28
|
+
string field2 = 2;
|
|
29
|
+
string field3 = 3;
|
|
30
|
+
}
|