@dkcinema/contracts 1.0.10 → 1.0.12

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/output/auth.ts CHANGED
@@ -10,6 +10,28 @@ import { Observable } from "rxjs";
10
10
 
11
11
  export const protobufPackage = "auth.v1";
12
12
 
13
+ export interface UserRequest {
14
+ userId: string;
15
+ }
16
+
17
+ export interface UserResponse {
18
+ id: string;
19
+ name: string;
20
+ email: string;
21
+ }
22
+
23
+ export interface User {
24
+ }
25
+
26
+ export interface GetUserRequest {
27
+ /** или int64, или UUID */
28
+ userId: string;
29
+ }
30
+
31
+ export interface GetUserResponse {
32
+ user: User | undefined;
33
+ }
34
+
13
35
  export interface VerifyEmailOtpRequest {
14
36
  code: string;
15
37
  email: string;
@@ -37,11 +59,11 @@ export interface SendOtpResponse {
37
59
  ok: boolean;
38
60
  }
39
61
 
40
- export interface LoginRequest {
62
+ export interface LoginByEmailRequest {
41
63
  email: string;
42
64
  }
43
65
 
44
- export interface LoginResponse {
66
+ export interface LoginByEmailResponse {
45
67
  accessToken: string;
46
68
  refreshToken: string;
47
69
  }
@@ -57,7 +79,9 @@ export interface AuthServiceClient {
57
79
 
58
80
  verifyPhoneOtp(request: VerifyPhoneOtpRequest): Observable<VerifyOtpResponse>;
59
81
 
60
- login(request: LoginRequest): Observable<LoginResponse>;
82
+ loginByEmail(request: LoginByEmailRequest): Observable<LoginByEmailResponse>;
83
+
84
+ getUser(request: UserRequest): Observable<UserResponse>;
61
85
  }
62
86
 
63
87
  export interface AuthServiceController {
@@ -73,12 +97,23 @@ export interface AuthServiceController {
73
97
  request: VerifyPhoneOtpRequest,
74
98
  ): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
75
99
 
76
- login(request: LoginRequest): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse;
100
+ loginByEmail(
101
+ request: LoginByEmailRequest,
102
+ ): Promise<LoginByEmailResponse> | Observable<LoginByEmailResponse> | LoginByEmailResponse;
103
+
104
+ getUser(request: UserRequest): Promise<UserResponse> | Observable<UserResponse> | UserResponse;
77
105
  }
78
106
 
79
107
  export function AuthServiceControllerMethods() {
80
108
  return function (constructor: Function) {
81
- const grpcMethods: string[] = ["sendEmailOtp", "sendPhoneOtp", "verifyEmailOtp", "verifyPhoneOtp", "login"];
109
+ const grpcMethods: string[] = [
110
+ "sendEmailOtp",
111
+ "sendPhoneOtp",
112
+ "verifyEmailOtp",
113
+ "verifyPhoneOtp",
114
+ "loginByEmail",
115
+ "getUser",
116
+ ];
82
117
  for (const method of grpcMethods) {
83
118
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
84
119
  GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dkcinema/contracts",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
package/protos/auth.proto CHANGED
@@ -9,7 +9,30 @@ service AuthService {
9
9
  rpc VerifyEmailOtp(VerifyEmailOtpRequest) returns (VerifyOtpResponse);
10
10
  rpc VerifyPhoneOtp(VerifyPhoneOtpRequest) returns (VerifyOtpResponse);
11
11
 
12
- rpc Login (LoginRequest) returns (LoginResponse);
12
+ rpc LoginByEmail (LoginByEmailRequest) returns (LoginByEmailResponse);
13
+ rpc GetUser (UserRequest) returns (UserResponse);
14
+ }
15
+
16
+ message UserRequest {
17
+ string user_id = 1;
18
+ }
19
+
20
+ message UserResponse {
21
+ string id = 1;
22
+ string name = 2;
23
+ string email = 3;
24
+ }
25
+
26
+ message User {
27
+
28
+ }
29
+
30
+ message GetUserRequest {
31
+ string user_id = 1; // или int64, или UUID
32
+ }
33
+
34
+ message GetUserResponse {
35
+ User user = 1;
13
36
  }
14
37
 
15
38
  message VerifyEmailOtpRequest {
@@ -39,11 +62,11 @@ message SendOtpResponse {
39
62
  bool ok = 1;
40
63
  }
41
64
 
42
- message LoginRequest {
65
+ message LoginByEmailRequest {
43
66
  string email = 1;
44
67
  }
45
68
 
46
- message LoginResponse {
69
+ message LoginByEmailResponse {
47
70
  string access_token = 1;
48
71
  string refresh_token = 2;
49
72
  }