@vsniksnet/contracts 1.2.21 → 1.3.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.
- package/dist/proto/paths.d.ts +1 -0
- package/dist/proto/paths.js +1 -0
- package/gen/friends.ts +159 -0
- package/gen/users.ts +23 -2
- package/package.json +28 -28
- package/proto/friends.proto +82 -0
- package/proto/users.proto +21 -3
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
|
@@ -6,5 +6,6 @@ exports.PROTO_PATHS = {
|
|
|
6
6
|
AUTH: (0, path_1.join)(__dirname, '../../proto/auth.proto'),
|
|
7
7
|
ACCOUNT: (0, path_1.join)(__dirname, '../../proto/account.proto'),
|
|
8
8
|
USERS: (0, path_1.join)(__dirname, '../../proto/users.proto'),
|
|
9
|
+
FRIENDS: (0, path_1.join)(__dirname, '../../proto/friends.proto'),
|
|
9
10
|
MEDIA: (0, path_1.join)(__dirname, '../../proto/media.proto'),
|
|
10
11
|
};
|
package/gen/friends.ts
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.4
|
|
4
|
+
// protoc v6.33.1
|
|
5
|
+
// source: friends.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "friends.v1";
|
|
12
|
+
|
|
13
|
+
/** Create request */
|
|
14
|
+
export interface CreateInvitionRequest {
|
|
15
|
+
userId: string;
|
|
16
|
+
currentId: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface CreateInvitionResponse {
|
|
20
|
+
profile: Profile | undefined;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Accept request */
|
|
24
|
+
export interface AcceptInvitionRequest {
|
|
25
|
+
userId: string;
|
|
26
|
+
currentId: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface AcceptInvitionResponse {
|
|
30
|
+
profile: Profile | undefined;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Reject request */
|
|
34
|
+
export interface RejectInvitionRequest {
|
|
35
|
+
userId: string;
|
|
36
|
+
currentId: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface RejectInvitionResponse {
|
|
40
|
+
profile: Profile | undefined;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** List requests */
|
|
44
|
+
export interface ListRequestedRequest {
|
|
45
|
+
currentId: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface ListRequestedResponse {
|
|
49
|
+
profile: Profile[];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** List accepted */
|
|
53
|
+
export interface ListAcceptedRequest {
|
|
54
|
+
currentId: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface ListAcceptedResponse {
|
|
58
|
+
profile: Profile[];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface Profile {
|
|
62
|
+
id: string;
|
|
63
|
+
username: string;
|
|
64
|
+
avatar: string;
|
|
65
|
+
cover: string;
|
|
66
|
+
bio: string;
|
|
67
|
+
gender: string;
|
|
68
|
+
status: string;
|
|
69
|
+
location: string;
|
|
70
|
+
birthDay: string;
|
|
71
|
+
requestsCount?: number | undefined;
|
|
72
|
+
friendsCount?: number | undefined;
|
|
73
|
+
followersCount?: number | undefined;
|
|
74
|
+
followingCount?: number | undefined;
|
|
75
|
+
isFollow?: boolean | undefined;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const FRIENDS_V1_PACKAGE_NAME = "friends.v1";
|
|
79
|
+
|
|
80
|
+
/** Friends requests service */
|
|
81
|
+
|
|
82
|
+
export interface FriendsServiceClient {
|
|
83
|
+
/** Create friend request */
|
|
84
|
+
|
|
85
|
+
createInvition(request: CreateInvitionRequest): Observable<CreateInvitionResponse>;
|
|
86
|
+
|
|
87
|
+
/** Accept friend request */
|
|
88
|
+
|
|
89
|
+
acceptInvition(request: AcceptInvitionRequest): Observable<AcceptInvitionResponse>;
|
|
90
|
+
|
|
91
|
+
/** Reject friend request */
|
|
92
|
+
|
|
93
|
+
rejectInvition(request: RejectInvitionRequest): Observable<RejectInvitionResponse>;
|
|
94
|
+
|
|
95
|
+
/** List requests */
|
|
96
|
+
|
|
97
|
+
listRequested(request: ListRequestedRequest): Observable<ListRequestedResponse>;
|
|
98
|
+
|
|
99
|
+
/** List accepted */
|
|
100
|
+
|
|
101
|
+
listAccepted(request: ListAcceptedRequest): Observable<ListAcceptedResponse>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Friends requests service */
|
|
105
|
+
|
|
106
|
+
export interface FriendsServiceController {
|
|
107
|
+
/** Create friend request */
|
|
108
|
+
|
|
109
|
+
createInvition(
|
|
110
|
+
request: CreateInvitionRequest,
|
|
111
|
+
): Promise<CreateInvitionResponse> | Observable<CreateInvitionResponse> | CreateInvitionResponse;
|
|
112
|
+
|
|
113
|
+
/** Accept friend request */
|
|
114
|
+
|
|
115
|
+
acceptInvition(
|
|
116
|
+
request: AcceptInvitionRequest,
|
|
117
|
+
): Promise<AcceptInvitionResponse> | Observable<AcceptInvitionResponse> | AcceptInvitionResponse;
|
|
118
|
+
|
|
119
|
+
/** Reject friend request */
|
|
120
|
+
|
|
121
|
+
rejectInvition(
|
|
122
|
+
request: RejectInvitionRequest,
|
|
123
|
+
): Promise<RejectInvitionResponse> | Observable<RejectInvitionResponse> | RejectInvitionResponse;
|
|
124
|
+
|
|
125
|
+
/** List requests */
|
|
126
|
+
|
|
127
|
+
listRequested(
|
|
128
|
+
request: ListRequestedRequest,
|
|
129
|
+
): Promise<ListRequestedResponse> | Observable<ListRequestedResponse> | ListRequestedResponse;
|
|
130
|
+
|
|
131
|
+
/** List accepted */
|
|
132
|
+
|
|
133
|
+
listAccepted(
|
|
134
|
+
request: ListAcceptedRequest,
|
|
135
|
+
): Promise<ListAcceptedResponse> | Observable<ListAcceptedResponse> | ListAcceptedResponse;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export function FriendsServiceControllerMethods() {
|
|
139
|
+
return function (constructor: Function) {
|
|
140
|
+
const grpcMethods: string[] = [
|
|
141
|
+
"createInvition",
|
|
142
|
+
"acceptInvition",
|
|
143
|
+
"rejectInvition",
|
|
144
|
+
"listRequested",
|
|
145
|
+
"listAccepted",
|
|
146
|
+
];
|
|
147
|
+
for (const method of grpcMethods) {
|
|
148
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
149
|
+
GrpcMethod("FriendsService", method)(constructor.prototype[method], method, descriptor);
|
|
150
|
+
}
|
|
151
|
+
const grpcStreamMethods: string[] = [];
|
|
152
|
+
for (const method of grpcStreamMethods) {
|
|
153
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
154
|
+
GrpcStreamMethod("FriendsService", method)(constructor.prototype[method], method, descriptor);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export const FRIENDS_SERVICE_NAME = "FriendsService";
|
package/gen/users.ts
CHANGED
|
@@ -31,6 +31,20 @@ export interface GetUserResponse {
|
|
|
31
31
|
user: Profile | undefined;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
export interface GetAuthRequest {
|
|
35
|
+
currentId: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface GetAuthResponse {
|
|
39
|
+
id: string;
|
|
40
|
+
username: string;
|
|
41
|
+
avatar: string;
|
|
42
|
+
followersCount: number;
|
|
43
|
+
followingCount: number;
|
|
44
|
+
requestCount: number;
|
|
45
|
+
friendsCount: number;
|
|
46
|
+
}
|
|
47
|
+
|
|
34
48
|
/** List users */
|
|
35
49
|
export interface ListUsersRequest {
|
|
36
50
|
search?: string | undefined;
|
|
@@ -132,8 +146,10 @@ export interface Profile {
|
|
|
132
146
|
status: string;
|
|
133
147
|
location: string;
|
|
134
148
|
birthDay: string;
|
|
135
|
-
|
|
136
|
-
|
|
149
|
+
requestsCount?: number | undefined;
|
|
150
|
+
friendsCount?: number | undefined;
|
|
151
|
+
followersCount?: number | undefined;
|
|
152
|
+
followingCount?: number | undefined;
|
|
137
153
|
isFollow?: boolean | undefined;
|
|
138
154
|
}
|
|
139
155
|
|
|
@@ -150,6 +166,8 @@ export interface UsersServiceClient {
|
|
|
150
166
|
|
|
151
167
|
getUser(request: GetUserRequest): Observable<GetUserResponse>;
|
|
152
168
|
|
|
169
|
+
getAuth(request: GetAuthRequest): Observable<GetAuthResponse>;
|
|
170
|
+
|
|
153
171
|
/** List users */
|
|
154
172
|
|
|
155
173
|
listUsers(request: ListUsersRequest): Observable<ListUsersResponse>;
|
|
@@ -192,6 +210,8 @@ export interface UsersServiceController {
|
|
|
192
210
|
|
|
193
211
|
getUser(request: GetUserRequest): Promise<GetUserResponse> | Observable<GetUserResponse> | GetUserResponse;
|
|
194
212
|
|
|
213
|
+
getAuth(request: GetAuthRequest): Promise<GetAuthResponse> | Observable<GetAuthResponse> | GetAuthResponse;
|
|
214
|
+
|
|
195
215
|
/** List users */
|
|
196
216
|
|
|
197
217
|
listUsers(request: ListUsersRequest): Promise<ListUsersResponse> | Observable<ListUsersResponse> | ListUsersResponse;
|
|
@@ -238,6 +258,7 @@ export function UsersServiceControllerMethods() {
|
|
|
238
258
|
const grpcMethods: string[] = [
|
|
239
259
|
"createUser",
|
|
240
260
|
"getUser",
|
|
261
|
+
"getAuth",
|
|
241
262
|
"listUsers",
|
|
242
263
|
"updateEmail",
|
|
243
264
|
"updateUser",
|
package/package.json
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@vsniksnet/contracts",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Protobuf definitions and generated typescript types",
|
|
5
|
-
"main": "./dist/index.js",
|
|
6
|
-
"types": "./dist/index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "tsc -p tsconfig.build.json",
|
|
9
|
-
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
|
|
10
|
-
},
|
|
11
|
-
"files": [
|
|
12
|
-
"dist",
|
|
13
|
-
"proto",
|
|
14
|
-
"gen"
|
|
15
|
-
],
|
|
16
|
-
"publishConfig": {
|
|
17
|
-
"access": "public"
|
|
18
|
-
},
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"@nestjs/microservices": "^11.1.14",
|
|
21
|
-
"rxjs": "^7.8.2",
|
|
22
|
-
"ts-proto": "^2.11.4"
|
|
23
|
-
},
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"@types/node": "^25.3.3",
|
|
26
|
-
"typescript": "^5.9.3"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@vsniksnet/contracts",
|
|
3
|
+
"version": "1.3.1",
|
|
4
|
+
"description": "Protobuf definitions and generated typescript types",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc -p tsconfig.build.json",
|
|
9
|
+
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"proto",
|
|
14
|
+
"gen"
|
|
15
|
+
],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@nestjs/microservices": "^11.1.14",
|
|
21
|
+
"rxjs": "^7.8.2",
|
|
22
|
+
"ts-proto": "^2.11.4"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "^25.3.3",
|
|
26
|
+
"typescript": "^5.9.3"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package friends.v1;
|
|
4
|
+
|
|
5
|
+
/* Friends requests service */
|
|
6
|
+
service FriendsService {
|
|
7
|
+
/* Create friend request */
|
|
8
|
+
rpc CreateInvition (CreateInvitionRequest) returns (CreateInvitionResponse);
|
|
9
|
+
/* Accept friend request */
|
|
10
|
+
rpc AcceptInvition (AcceptInvitionRequest) returns (AcceptInvitionResponse);
|
|
11
|
+
/* Reject friend request */
|
|
12
|
+
rpc RejectInvition (RejectInvitionRequest) returns (RejectInvitionResponse);
|
|
13
|
+
/* List requests */
|
|
14
|
+
rpc ListRequested (ListRequestedRequest) returns (ListRequestedResponse);
|
|
15
|
+
/* List accepted*/
|
|
16
|
+
rpc ListAccepted (ListAcceptedRequest) returns (ListAcceptedResponse);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* Create request */
|
|
20
|
+
message CreateInvitionRequest {
|
|
21
|
+
string user_id = 1;
|
|
22
|
+
string current_id = 2;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
message CreateInvitionResponse {
|
|
26
|
+
Profile profile = 1;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* Accept request */
|
|
30
|
+
message AcceptInvitionRequest {
|
|
31
|
+
string user_id = 1;
|
|
32
|
+
string current_id = 2;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
message AcceptInvitionResponse {
|
|
36
|
+
Profile profile = 1;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* Reject request */
|
|
40
|
+
message RejectInvitionRequest {
|
|
41
|
+
string user_id = 1;
|
|
42
|
+
string current_id = 2;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
message RejectInvitionResponse {
|
|
46
|
+
Profile profile = 1;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* List requests */
|
|
50
|
+
message ListRequestedRequest {
|
|
51
|
+
string current_id = 1;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
message ListRequestedResponse {
|
|
55
|
+
repeated Profile profile = 1;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* List accepted*/
|
|
59
|
+
message ListAcceptedRequest {
|
|
60
|
+
string current_id = 1;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
message ListAcceptedResponse {
|
|
64
|
+
repeated Profile profile = 1;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
message Profile {
|
|
68
|
+
string id = 1;
|
|
69
|
+
string username = 2;
|
|
70
|
+
string avatar = 3;
|
|
71
|
+
string cover = 4;
|
|
72
|
+
string bio = 5;
|
|
73
|
+
string gender = 6;
|
|
74
|
+
string status = 7;
|
|
75
|
+
string location = 8;
|
|
76
|
+
string birth_day = 9;
|
|
77
|
+
optional int32 requests_count = 10;
|
|
78
|
+
optional int32 friends_count = 11;
|
|
79
|
+
optional int32 followers_count = 12;
|
|
80
|
+
optional int32 following_count = 13;
|
|
81
|
+
optional bool is_follow = 14;
|
|
82
|
+
}
|
package/proto/users.proto
CHANGED
|
@@ -8,6 +8,8 @@ service UsersService {
|
|
|
8
8
|
rpc CreateUser (CreateUserRequest) returns (CreateUserResponse);
|
|
9
9
|
/* Get one user by id */
|
|
10
10
|
rpc GetUser (GetUserRequest) returns (GetUserResponse);
|
|
11
|
+
|
|
12
|
+
rpc GetAuth (GetAuthRequest) returns (GetAuthResponse);
|
|
11
13
|
/* List users */
|
|
12
14
|
rpc ListUsers (ListUsersRequest) returns (ListUsersResponse);
|
|
13
15
|
/* Update email */
|
|
@@ -45,6 +47,20 @@ message GetUserResponse {
|
|
|
45
47
|
Profile user = 1;
|
|
46
48
|
}
|
|
47
49
|
|
|
50
|
+
message GetAuthRequest {
|
|
51
|
+
string current_id = 1;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
message GetAuthResponse {
|
|
55
|
+
string id = 1;
|
|
56
|
+
string username = 2;
|
|
57
|
+
string avatar = 3;
|
|
58
|
+
int32 followers_count = 4;
|
|
59
|
+
int32 following_count = 5;
|
|
60
|
+
int32 request_count = 6;
|
|
61
|
+
int32 friends_count = 7;
|
|
62
|
+
}
|
|
63
|
+
|
|
48
64
|
/* List users */
|
|
49
65
|
message ListUsersRequest {
|
|
50
66
|
optional string search = 1;
|
|
@@ -147,7 +163,9 @@ message Profile {
|
|
|
147
163
|
string status = 7;
|
|
148
164
|
string location = 8;
|
|
149
165
|
string birth_day = 9;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
optional
|
|
166
|
+
optional int32 requests_count = 10;
|
|
167
|
+
optional int32 friends_count = 11;
|
|
168
|
+
optional int32 followers_count = 12;
|
|
169
|
+
optional int32 following_count = 13;
|
|
170
|
+
optional bool is_follow = 14;
|
|
153
171
|
}
|