@unison-messanger/contracts 1.2.0 → 1.3.2
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/auth.ts +15 -2
- package/gen/users.ts +127 -0
- package/package.json +6 -6
- package/proto/auth.proto +11 -1
- package/proto/users.proto +70 -0
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
package/gen/auth.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
2
|
// versions:
|
|
3
3
|
// protoc-gen-ts_proto v2.10.1
|
|
4
|
-
// protoc
|
|
4
|
+
// protoc v6.33.2
|
|
5
5
|
// source: auth.proto
|
|
6
6
|
|
|
7
7
|
/* eslint-disable */
|
|
@@ -38,6 +38,15 @@ export interface RefreshResponse {
|
|
|
38
38
|
refreshToken: string;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
export interface LogoutRequest {
|
|
42
|
+
accessToken: string;
|
|
43
|
+
refreshToken: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface LogoutResponse {
|
|
47
|
+
ok: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
41
50
|
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
42
51
|
|
|
43
52
|
export interface AuthServiceClient {
|
|
@@ -46,6 +55,8 @@ export interface AuthServiceClient {
|
|
|
46
55
|
verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
|
|
47
56
|
|
|
48
57
|
refresh(request: RefreshRequest): Observable<RefreshResponse>;
|
|
58
|
+
|
|
59
|
+
logout(request: LogoutRequest): Observable<LogoutResponse>;
|
|
49
60
|
}
|
|
50
61
|
|
|
51
62
|
export interface AuthServiceController {
|
|
@@ -54,11 +65,13 @@ export interface AuthServiceController {
|
|
|
54
65
|
verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
|
|
55
66
|
|
|
56
67
|
refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
|
|
68
|
+
|
|
69
|
+
logout(request: LogoutRequest): Promise<LogoutResponse> | Observable<LogoutResponse> | LogoutResponse;
|
|
57
70
|
}
|
|
58
71
|
|
|
59
72
|
export function AuthServiceControllerMethods() {
|
|
60
73
|
return function (constructor: Function) {
|
|
61
|
-
const grpcMethods: string[] = ["sendOtp", "verifyOtp", "refresh"];
|
|
74
|
+
const grpcMethods: string[] = ["sendOtp", "verifyOtp", "refresh", "logout"];
|
|
62
75
|
for (const method of grpcMethods) {
|
|
63
76
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
64
77
|
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
package/gen/users.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.10.1
|
|
4
|
+
// protoc v6.33.2
|
|
5
|
+
// source: users.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "users.v1";
|
|
12
|
+
|
|
13
|
+
export interface GetUserRequest {
|
|
14
|
+
userId: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface CreateProfileRequest {
|
|
18
|
+
userId: string;
|
|
19
|
+
username: string;
|
|
20
|
+
displayName: string;
|
|
21
|
+
bio?: string | undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface DeleteProfileRequest {
|
|
25
|
+
userId: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface DeleteProfileResponse {
|
|
29
|
+
ok: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface DeleteAvatarRequest {
|
|
33
|
+
userId: string;
|
|
34
|
+
avatarId: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface UpdateProfileRequest {
|
|
38
|
+
userId: string;
|
|
39
|
+
username?: string | undefined;
|
|
40
|
+
displayName?: string | undefined;
|
|
41
|
+
bio?: string | undefined;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface SearchUsersRequest {
|
|
45
|
+
userId: string;
|
|
46
|
+
query: string;
|
|
47
|
+
limit: number;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface SearchUsersResponse {
|
|
51
|
+
items: UserProfile[];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface Avatar {
|
|
55
|
+
id: string;
|
|
56
|
+
url: string;
|
|
57
|
+
createdAt: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface UserProfile {
|
|
61
|
+
id: string;
|
|
62
|
+
username: string;
|
|
63
|
+
displayName: string;
|
|
64
|
+
avatar: string;
|
|
65
|
+
bio: string;
|
|
66
|
+
createdAt: string;
|
|
67
|
+
updatedAt: string;
|
|
68
|
+
avatars: Avatar[];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const USERS_V1_PACKAGE_NAME = "users.v1";
|
|
72
|
+
|
|
73
|
+
export interface UsersServiceClient {
|
|
74
|
+
getUser(request: GetUserRequest): Observable<UserProfile>;
|
|
75
|
+
|
|
76
|
+
createProfile(request: CreateProfileRequest): Observable<UserProfile>;
|
|
77
|
+
|
|
78
|
+
updateProfile(request: UpdateProfileRequest): Observable<UserProfile>;
|
|
79
|
+
|
|
80
|
+
deleteProfile(request: DeleteProfileRequest): Observable<DeleteProfileResponse>;
|
|
81
|
+
|
|
82
|
+
deleteAvatar(request: DeleteAvatarRequest): Observable<UserProfile>;
|
|
83
|
+
|
|
84
|
+
searchUsers(request: SearchUsersRequest): Observable<SearchUsersResponse>;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface UsersServiceController {
|
|
88
|
+
getUser(request: GetUserRequest): Promise<UserProfile> | Observable<UserProfile> | UserProfile;
|
|
89
|
+
|
|
90
|
+
createProfile(request: CreateProfileRequest): Promise<UserProfile> | Observable<UserProfile> | UserProfile;
|
|
91
|
+
|
|
92
|
+
updateProfile(request: UpdateProfileRequest): Promise<UserProfile> | Observable<UserProfile> | UserProfile;
|
|
93
|
+
|
|
94
|
+
deleteProfile(
|
|
95
|
+
request: DeleteProfileRequest,
|
|
96
|
+
): Promise<DeleteProfileResponse> | Observable<DeleteProfileResponse> | DeleteProfileResponse;
|
|
97
|
+
|
|
98
|
+
deleteAvatar(request: DeleteAvatarRequest): Promise<UserProfile> | Observable<UserProfile> | UserProfile;
|
|
99
|
+
|
|
100
|
+
searchUsers(
|
|
101
|
+
request: SearchUsersRequest,
|
|
102
|
+
): Promise<SearchUsersResponse> | Observable<SearchUsersResponse> | SearchUsersResponse;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function UsersServiceControllerMethods() {
|
|
106
|
+
return function (constructor: Function) {
|
|
107
|
+
const grpcMethods: string[] = [
|
|
108
|
+
"getUser",
|
|
109
|
+
"createProfile",
|
|
110
|
+
"updateProfile",
|
|
111
|
+
"deleteProfile",
|
|
112
|
+
"deleteAvatar",
|
|
113
|
+
"searchUsers",
|
|
114
|
+
];
|
|
115
|
+
for (const method of grpcMethods) {
|
|
116
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
117
|
+
GrpcMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
|
|
118
|
+
}
|
|
119
|
+
const grpcStreamMethods: string[] = [];
|
|
120
|
+
for (const method of grpcStreamMethods) {
|
|
121
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
122
|
+
GrpcStreamMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export const USERS_SERVICE_NAME = "UsersService";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unison-messanger/contracts",
|
|
3
|
-
"version": "1.2
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Protobuf definitions and generated TypeScript types",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@nestjs/microservices": "
|
|
21
|
-
"rxjs": "
|
|
22
|
-
"ts-proto": "
|
|
20
|
+
"@nestjs/microservices": "11.1.11",
|
|
21
|
+
"rxjs": "7.8.2",
|
|
22
|
+
"ts-proto": "2.10.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@types/node": "
|
|
26
|
-
"typescript": "
|
|
25
|
+
"@types/node": "25.0.3",
|
|
26
|
+
"typescript": "5.9.3"
|
|
27
27
|
}
|
|
28
28
|
}
|
package/proto/auth.proto
CHANGED
|
@@ -6,6 +6,7 @@ service AuthService {
|
|
|
6
6
|
rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
|
|
7
7
|
rpc VerifyOtp (VerifyOtpRequest) returns (VerifyOtpResponse);
|
|
8
8
|
rpc Refresh (RefreshRequest) returns (RefreshResponse);
|
|
9
|
+
rpc Logout (LogoutRequest) returns (LogoutResponse);
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
message SendOtpRequest {
|
|
@@ -34,4 +35,13 @@ message RefreshRequest {
|
|
|
34
35
|
message RefreshResponse {
|
|
35
36
|
string access_token = 1;
|
|
36
37
|
string refresh_token = 2;
|
|
37
|
-
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
message LogoutRequest {
|
|
41
|
+
string access_token = 1;
|
|
42
|
+
string refresh_token = 2;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
message LogoutResponse {
|
|
46
|
+
bool ok = 1;
|
|
47
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package users.v1;
|
|
4
|
+
|
|
5
|
+
service UsersService {
|
|
6
|
+
rpc GetUser (GetUserRequest) returns (UserProfile);
|
|
7
|
+
rpc CreateProfile (CreateProfileRequest) returns (UserProfile);
|
|
8
|
+
rpc UpdateProfile (UpdateProfileRequest) returns (UserProfile);
|
|
9
|
+
rpc DeleteProfile (DeleteProfileRequest) returns (DeleteProfileResponse);
|
|
10
|
+
rpc DeleteAvatar (DeleteAvatarRequest) returns (UserProfile);
|
|
11
|
+
rpc SearchUsers (SearchUsersRequest) returns (SearchUsersResponse);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
message GetUserRequest {
|
|
15
|
+
string user_id = 1;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
message CreateProfileRequest {
|
|
19
|
+
string user_id = 1;
|
|
20
|
+
string username = 2;
|
|
21
|
+
string display_name = 3;
|
|
22
|
+
optional string bio = 4;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
message DeleteProfileRequest {
|
|
26
|
+
string user_id = 1;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
message DeleteProfileResponse {
|
|
30
|
+
bool ok = 1;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
message DeleteAvatarRequest {
|
|
34
|
+
string user_id = 1;
|
|
35
|
+
string avatar_id = 2;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
message UpdateProfileRequest {
|
|
39
|
+
string user_id = 1;
|
|
40
|
+
optional string username = 2;
|
|
41
|
+
optional string display_name = 3;
|
|
42
|
+
optional string bio = 4;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
message SearchUsersRequest {
|
|
46
|
+
string user_id = 1;
|
|
47
|
+
string query = 2;
|
|
48
|
+
int32 limit = 3;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
message SearchUsersResponse {
|
|
52
|
+
repeated UserProfile items = 1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
message Avatar {
|
|
56
|
+
string id = 1;
|
|
57
|
+
string url = 2;
|
|
58
|
+
string created_at = 3;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
message UserProfile {
|
|
62
|
+
string id = 1;
|
|
63
|
+
string username = 2;
|
|
64
|
+
string display_name = 3;
|
|
65
|
+
string avatar = 4;
|
|
66
|
+
string bio = 5;
|
|
67
|
+
string created_at = 6;
|
|
68
|
+
string updated_at = 7;
|
|
69
|
+
repeated Avatar avatars = 8;
|
|
70
|
+
}
|