@sync-chat/contracts 1.1.2 → 1.2.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/generated/auth/auth.ts +27 -6
- package/package.json +6 -2
- package/proto/auth/auth.proto +27 -12
- package/generated/auth.ts +0 -47
package/generated/auth/auth.ts
CHANGED
|
@@ -11,19 +11,32 @@ import { Observable } from "rxjs";
|
|
|
11
11
|
export const protobufPackage = "auth.v1";
|
|
12
12
|
|
|
13
13
|
export interface RegisterRequest {
|
|
14
|
+
userName: string;
|
|
15
|
+
email: string;
|
|
16
|
+
password: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface LoginRequest {
|
|
14
20
|
email: string;
|
|
15
21
|
password: string;
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface RefreshRequest {
|
|
25
|
+
refreshToken: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface LogoutRequest {
|
|
29
|
+
refreshToken: string;
|
|
18
30
|
}
|
|
19
31
|
|
|
20
32
|
export interface AuthResponse {
|
|
21
33
|
message: string;
|
|
34
|
+
accessToken: string;
|
|
35
|
+
refreshToken: string;
|
|
22
36
|
}
|
|
23
37
|
|
|
24
|
-
export interface
|
|
25
|
-
|
|
26
|
-
password: string;
|
|
38
|
+
export interface LogoutResponse {
|
|
39
|
+
message: string;
|
|
27
40
|
}
|
|
28
41
|
|
|
29
42
|
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
@@ -32,17 +45,25 @@ export interface AuthServiceClient {
|
|
|
32
45
|
register(request: RegisterRequest): Observable<AuthResponse>;
|
|
33
46
|
|
|
34
47
|
login(request: LoginRequest): Observable<AuthResponse>;
|
|
48
|
+
|
|
49
|
+
refresh(request: RefreshRequest): Observable<AuthResponse>;
|
|
50
|
+
|
|
51
|
+
logout(request: LogoutRequest): Observable<LogoutResponse>;
|
|
35
52
|
}
|
|
36
53
|
|
|
37
54
|
export interface AuthServiceController {
|
|
38
55
|
register(request: RegisterRequest): Promise<AuthResponse> | Observable<AuthResponse> | AuthResponse;
|
|
39
56
|
|
|
40
57
|
login(request: LoginRequest): Promise<AuthResponse> | Observable<AuthResponse> | AuthResponse;
|
|
58
|
+
|
|
59
|
+
refresh(request: RefreshRequest): Promise<AuthResponse> | Observable<AuthResponse> | AuthResponse;
|
|
60
|
+
|
|
61
|
+
logout(request: LogoutRequest): Promise<LogoutResponse> | Observable<LogoutResponse> | LogoutResponse;
|
|
41
62
|
}
|
|
42
63
|
|
|
43
64
|
export function AuthServiceControllerMethods() {
|
|
44
65
|
return function (constructor: Function) {
|
|
45
|
-
const grpcMethods: string[] = ["register", "login"];
|
|
66
|
+
const grpcMethods: string[] = ["register", "login", "refresh", "logout"];
|
|
46
67
|
for (const method of grpcMethods) {
|
|
47
68
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
48
69
|
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sync-chat/contracts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Protobuf definitions and generated TypeScript types",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"generate": "
|
|
6
|
+
"generate": "node ./src/generate-proto.mjs"
|
|
7
7
|
},
|
|
8
8
|
"files": [
|
|
9
9
|
"proto",
|
|
@@ -18,5 +18,9 @@
|
|
|
18
18
|
"@nestjs/microservices": "^11.1.21",
|
|
19
19
|
"rxjs": "^7.8.2",
|
|
20
20
|
"ts-proto": "^2.11.8"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/node": "^25.9.1",
|
|
24
|
+
"glob": "^13.0.6"
|
|
21
25
|
}
|
|
22
26
|
}
|
package/proto/auth/auth.proto
CHANGED
|
@@ -1,24 +1,39 @@
|
|
|
1
1
|
syntax = "proto3";
|
|
2
|
+
|
|
2
3
|
package auth.v1;
|
|
3
4
|
|
|
4
5
|
service AuthService {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
rpc Register (RegisterRequest) returns (AuthResponse);
|
|
7
|
+
rpc Login (LoginRequest) returns (AuthResponse);
|
|
8
|
+
rpc Refresh (RefreshRequest) returns (AuthResponse);
|
|
9
|
+
rpc Logout (LogoutRequest) returns (LogoutResponse);
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
message RegisterRequest {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
string userDesc = 4;
|
|
13
|
+
string user_name = 1;
|
|
14
|
+
string email = 2;
|
|
15
|
+
string password = 3;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
message
|
|
18
|
-
|
|
18
|
+
message LoginRequest {
|
|
19
|
+
string email = 1;
|
|
20
|
+
string password = 2;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
message
|
|
22
|
-
|
|
23
|
-
string password = 2;
|
|
23
|
+
message RefreshRequest {
|
|
24
|
+
string refresh_token = 1;
|
|
24
25
|
}
|
|
26
|
+
|
|
27
|
+
message LogoutRequest {
|
|
28
|
+
string refresh_token = 1;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
message AuthResponse {
|
|
32
|
+
string message = 1;
|
|
33
|
+
string access_token = 2;
|
|
34
|
+
string refresh_token = 3;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
message LogoutResponse {
|
|
38
|
+
string message = 1;
|
|
39
|
+
}
|
package/generated/auth.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
-
// versions:
|
|
3
|
-
// protoc-gen-ts_proto v2.11.8
|
|
4
|
-
// protoc v7.34.1
|
|
5
|
-
// source: auth.proto
|
|
6
|
-
|
|
7
|
-
/* eslint-disable */
|
|
8
|
-
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
-
import { Observable } from "rxjs";
|
|
10
|
-
|
|
11
|
-
export const protobufPackage = "auth.v1";
|
|
12
|
-
|
|
13
|
-
export interface SendOTPRequest {
|
|
14
|
-
identifier: string;
|
|
15
|
-
type: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface SendOTPResponse {
|
|
19
|
-
ok: boolean;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
23
|
-
|
|
24
|
-
export interface AuthServiceClient {
|
|
25
|
-
sendOtp(request: SendOTPRequest): Observable<SendOTPResponse>;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface AuthServiceController {
|
|
29
|
-
sendOtp(request: SendOTPRequest): Promise<SendOTPResponse> | Observable<SendOTPResponse> | SendOTPResponse;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function AuthServiceControllerMethods() {
|
|
33
|
-
return function (constructor: Function) {
|
|
34
|
-
const grpcMethods: string[] = ["sendOtp"];
|
|
35
|
-
for (const method of grpcMethods) {
|
|
36
|
-
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
37
|
-
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
38
|
-
}
|
|
39
|
-
const grpcStreamMethods: string[] = [];
|
|
40
|
-
for (const method of grpcStreamMethods) {
|
|
41
|
-
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
42
|
-
GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export const AUTH_SERVICE_NAME = "AuthService";
|