@dkcinema/contracts 1.0.15 → 1.0.17

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.
@@ -0,0 +1,59 @@
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: account.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+
11
+ export const protobufPackage = "account.v1";
12
+
13
+ export enum Role {
14
+ USER = 0,
15
+ ADMIN = 1,
16
+ UNRECOGNIZED = -1,
17
+ }
18
+
19
+ export interface GetAccountRequest {
20
+ id: string;
21
+ }
22
+
23
+ export interface GetAccountResponse {
24
+ id: string;
25
+ email?: string | undefined;
26
+ phone?: string | undefined;
27
+ isPhoneVerified: boolean;
28
+ isEmailVerified: boolean;
29
+ role: Role;
30
+ }
31
+
32
+ export const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
33
+
34
+ export interface AccountServiceClient {
35
+ getAccount(request: GetAccountRequest): Observable<GetAccountResponse>;
36
+ }
37
+
38
+ export interface AccountServiceController {
39
+ getAccount(
40
+ request: GetAccountRequest,
41
+ ): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
42
+ }
43
+
44
+ export function AccountServiceControllerMethods() {
45
+ return function (constructor: Function) {
46
+ const grpcMethods: string[] = ["getAccount"];
47
+ for (const method of grpcMethods) {
48
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
49
+ GrpcMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
50
+ }
51
+ const grpcStreamMethods: string[] = [];
52
+ for (const method of grpcStreamMethods) {
53
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
54
+ GrpcStreamMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
55
+ }
56
+ };
57
+ }
58
+
59
+ export const ACCOUNT_SERVICE_NAME = "AccountService";
package/output/auth.ts CHANGED
@@ -10,12 +10,21 @@ import { Observable } from "rxjs";
10
10
 
11
11
  export const protobufPackage = "auth.v1";
12
12
 
13
+ export interface RefreshRequest {
14
+ refreshToken: string;
15
+ }
16
+
17
+ export interface RefreshResponse {
18
+ accessToken: string;
19
+ refreshToken: string;
20
+ }
21
+
13
22
  export interface GetUserRequest {
14
- userId: number;
23
+ userId: string;
15
24
  }
16
25
 
17
26
  export interface GetUserResponse {
18
- id: number;
27
+ id: string;
19
28
  email?: string | undefined;
20
29
  phone?: string | undefined;
21
30
  }
@@ -69,6 +78,8 @@ export interface AuthServiceClient {
69
78
 
70
79
  loginByEmail(request: LoginByEmailRequest): Observable<LoginByEmailResponse>;
71
80
 
81
+ refresh(request: RefreshRequest): Observable<RefreshResponse>;
82
+
72
83
  getUser(request: GetUserRequest): Observable<GetUserResponse>;
73
84
  }
74
85
 
@@ -89,6 +100,8 @@ export interface AuthServiceController {
89
100
  request: LoginByEmailRequest,
90
101
  ): Promise<LoginByEmailResponse> | Observable<LoginByEmailResponse> | LoginByEmailResponse;
91
102
 
103
+ refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
104
+
92
105
  getUser(request: GetUserRequest): Promise<GetUserResponse> | Observable<GetUserResponse> | GetUserResponse;
93
106
  }
94
107
 
@@ -100,6 +113,7 @@ export function AuthServiceControllerMethods() {
100
113
  "verifyEmailOtp",
101
114
  "verifyPhoneOtp",
102
115
  "loginByEmail",
116
+ "refresh",
103
117
  "getUser",
104
118
  ];
105
119
  for (const method of grpcMethods) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dkcinema/contracts",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -0,0 +1,28 @@
1
+ syntax = "proto3";
2
+
3
+ package account.v1;
4
+
5
+ service AccountService {
6
+ rpc GetAccount (GetAccountRequest) returns (GetAccountResponse);
7
+ }
8
+
9
+ enum Role {
10
+ USER = 0;
11
+ ADMIN = 1;
12
+ }
13
+
14
+ message GetAccountRequest {
15
+ string id = 1;
16
+ }
17
+
18
+ message GetAccountResponse {
19
+ string id = 1;
20
+ optional string email = 2;
21
+ optional string phone = 3;
22
+ bool is_phone_verified = 4;
23
+ bool is_email_verified = 5;
24
+ Role role = 6;
25
+ }
26
+
27
+
28
+
package/protos/auth.proto CHANGED
@@ -10,15 +10,26 @@ service AuthService {
10
10
  rpc VerifyPhoneOtp(VerifyPhoneOtpRequest) returns (VerifyOtpResponse);
11
11
 
12
12
  rpc LoginByEmail (LoginByEmailRequest) returns (LoginByEmailResponse);
13
+ rpc Refresh (RefreshRequest) returns (RefreshResponse);
14
+
13
15
  rpc GetUser (GetUserRequest) returns (GetUserResponse);
14
16
  }
15
17
 
18
+ message RefreshRequest {
19
+ string refresh_token = 1;
20
+ }
21
+
22
+ message RefreshResponse {
23
+ string access_token = 1;
24
+ string refresh_token = 2;
25
+ }
26
+
16
27
  message GetUserRequest {
17
- int64 user_id = 1;
28
+ string user_id = 1;
18
29
  }
19
30
 
20
31
  message GetUserResponse {
21
- int64 id = 1;
32
+ string id = 1;
22
33
 
23
34
  oneof contact {
24
35
  string email = 2;