@sync-chat/contracts 1.1.3 → 1.3.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.
@@ -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
- userName: string;
17
- userDesc: string;
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 LoginRequest {
25
- email: string;
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);
@@ -0,0 +1,67 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.8
4
+ // protoc v3.21.12
5
+ // source: mail/mail.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+
11
+ export const protobufPackage = "mail.v1";
12
+
13
+ export interface SendVerificationEmailRequest {
14
+ to: string;
15
+ userName: string;
16
+ verificationUrl: string;
17
+ }
18
+
19
+ export interface SendPasswordResetRequest {
20
+ to: string;
21
+ userName: string;
22
+ resetUrl: string;
23
+ }
24
+
25
+ export interface MailResponse {
26
+ success: boolean;
27
+ message: string;
28
+ }
29
+
30
+ export const MAIL_V1_PACKAGE_NAME = "mail.v1";
31
+
32
+ export interface MailServiceClient {
33
+ sendVerificationEmail(request: SendVerificationEmailRequest): Observable<MailResponse>;
34
+
35
+ resendVerificationEmail(request: SendVerificationEmailRequest): Observable<MailResponse>;
36
+
37
+ sendPasswordReset(request: SendPasswordResetRequest): Observable<MailResponse>;
38
+ }
39
+
40
+ export interface MailServiceController {
41
+ sendVerificationEmail(
42
+ request: SendVerificationEmailRequest,
43
+ ): Promise<MailResponse> | Observable<MailResponse> | MailResponse;
44
+
45
+ resendVerificationEmail(
46
+ request: SendVerificationEmailRequest,
47
+ ): Promise<MailResponse> | Observable<MailResponse> | MailResponse;
48
+
49
+ sendPasswordReset(request: SendPasswordResetRequest): Promise<MailResponse> | Observable<MailResponse> | MailResponse;
50
+ }
51
+
52
+ export function MailServiceControllerMethods() {
53
+ return function (constructor: Function) {
54
+ const grpcMethods: string[] = ["sendVerificationEmail", "resendVerificationEmail", "sendPasswordReset"];
55
+ for (const method of grpcMethods) {
56
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
57
+ GrpcMethod("MailService", method)(constructor.prototype[method], method, descriptor);
58
+ }
59
+ const grpcStreamMethods: string[] = [];
60
+ for (const method of grpcStreamMethods) {
61
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
62
+ GrpcStreamMethod("MailService", method)(constructor.prototype[method], method, descriptor);
63
+ }
64
+ };
65
+ }
66
+
67
+ export const MAIL_SERVICE_NAME = "MailService";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sync-chat/contracts",
3
- "version": "1.1.3",
3
+ "version": "1.3.0",
4
4
  "description": "Protobuf definitions and generated TypeScript types",
5
5
  "scripts": {
6
6
  "generate": "node ./src/generate-proto.mjs"
@@ -1,24 +1,39 @@
1
1
  syntax = "proto3";
2
+
2
3
  package auth.v1;
3
4
 
4
5
  service AuthService {
5
- rpc Register(RegisterRequest) returns (AuthResponse);
6
-
7
- rpc Login(LoginRequest) returns (AuthResponse);
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
- string email = 1;
12
- string password = 2;
13
- string userName = 3;
14
- string userDesc = 4;
13
+ string user_name = 1;
14
+ string email = 2;
15
+ string password = 3;
15
16
  }
16
17
 
17
- message AuthResponse {
18
- string message = 1;
18
+ message LoginRequest {
19
+ string email = 1;
20
+ string password = 2;
19
21
  }
20
22
 
21
- message LoginRequest {
22
- string email = 1;
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
+ }
@@ -0,0 +1,26 @@
1
+ syntax = "proto3";
2
+
3
+ package mail.v1;
4
+
5
+ service MailService {
6
+ rpc SendVerificationEmail (SendVerificationEmailRequest) returns (MailResponse);
7
+ rpc ResendVerificationEmail (SendVerificationEmailRequest) returns (MailResponse);
8
+ rpc SendPasswordReset (SendPasswordResetRequest) returns (MailResponse);
9
+ }
10
+
11
+ message SendVerificationEmailRequest {
12
+ string to = 1;
13
+ string user_name = 2;
14
+ string verification_url = 3;
15
+ }
16
+
17
+ message SendPasswordResetRequest {
18
+ string to = 1;
19
+ string user_name = 2;
20
+ string reset_url = 3;
21
+ }
22
+
23
+ message MailResponse {
24
+ bool success = 1;
25
+ string message = 2;
26
+ }