@ticket_for_cinema/contracts 1.0.3 → 1.0.5

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.
@@ -1,3 +1,4 @@
1
1
  export declare const PROTO_PATH: {
2
2
  readonly AUTH: string;
3
+ readonly ACCOUNT: string;
3
4
  };
@@ -4,4 +4,5 @@ exports.PROTO_PATH = void 0;
4
4
  const path_1 = require("path");
5
5
  exports.PROTO_PATH = {
6
6
  AUTH: (0, path_1.join)(__dirname, "../../proto/auth.proto"),
7
+ ACCOUNT: (0, path_1.join)(__dirname, "../../proto/account.proto"),
7
8
  };
package/gen/account.ts ADDED
@@ -0,0 +1,61 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v1.181.2
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
+ /** указываем версию протобуфера */
14
+
15
+ export enum Role {
16
+ USER = 0,
17
+ ADMIN = 1,
18
+ UNRECOGNIZED = -1,
19
+ }
20
+
21
+ export interface GetAccountRequest {
22
+ id: string;
23
+ }
24
+
25
+ export interface GetAccountResponse {
26
+ id: string;
27
+ phone: string;
28
+ email: string;
29
+ isPhoneVerified: boolean;
30
+ isEmailVerified: boolean;
31
+ role: Role;
32
+ }
33
+
34
+ export const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
35
+
36
+ export interface AccountServiceClient {
37
+ getAccount(request: GetAccountRequest): Observable<GetAccountResponse>;
38
+ }
39
+
40
+ export interface AccountServiceController {
41
+ getAccount(
42
+ request: GetAccountRequest,
43
+ ): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
44
+ }
45
+
46
+ export function AccountServiceControllerMethods() {
47
+ return function (constructor: Function) {
48
+ const grpcMethods: string[] = ["getAccount"];
49
+ for (const method of grpcMethods) {
50
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
51
+ GrpcMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
52
+ }
53
+ const grpcStreamMethods: string[] = [];
54
+ for (const method of grpcStreamMethods) {
55
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
56
+ GrpcStreamMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
57
+ }
58
+ };
59
+ }
60
+
61
+ export const ACCOUNT_SERVICE_NAME = "AccountService";
package/gen/auth.ts CHANGED
@@ -34,23 +34,38 @@ export interface VerifyOtpResponse {
34
34
  refreshToken: string;
35
35
  }
36
36
 
37
+ export interface RefreshTokensRequest {
38
+ refreshToken: string;
39
+ }
40
+
41
+ export interface RefreshTokensResponse {
42
+ accessToken: string;
43
+ refreshToken: string;
44
+ }
45
+
37
46
  export const AUTH_V1_PACKAGE_NAME = "auth.v1";
38
47
 
39
48
  export interface AuthServiceClient {
40
49
  sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
41
50
 
42
51
  verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
52
+
53
+ refreshTokens(request: RefreshTokensRequest): Observable<RefreshTokensResponse>;
43
54
  }
44
55
 
45
56
  export interface AuthServiceController {
46
57
  sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
47
58
 
48
59
  verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
60
+
61
+ refreshTokens(
62
+ request: RefreshTokensRequest,
63
+ ): Promise<RefreshTokensResponse> | Observable<RefreshTokensResponse> | RefreshTokensResponse;
49
64
  }
50
65
 
51
66
  export function AuthServiceControllerMethods() {
52
67
  return function (constructor: Function) {
53
- const grpcMethods: string[] = ["sendOtp", "verifyOtp"];
68
+ const grpcMethods: string[] = ["sendOtp", "verifyOtp", "refreshTokens"];
54
69
  for (const method of grpcMethods) {
55
70
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
56
71
  GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ticket_for_cinema/contracts",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Contracts for microservices",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,25 @@
1
+ syntax = "proto3"; // указываем версию протобуфера
2
+
3
+ package account.v1; // указываем пакет тут указываем доменную область
4
+
5
+ service AccountService {
6
+ rpc GetAccount (GetAccountRequest) returns (GetAccountResponse);
7
+ }
8
+
9
+ message GetAccountRequest {
10
+ string id = 1;
11
+ }
12
+
13
+ message GetAccountResponse {
14
+ string id = 1;
15
+ string phone = 2;
16
+ string email = 3;
17
+ bool is_phone_verified = 4;
18
+ bool is_email_verified = 5;
19
+ Role role = 6;
20
+ }
21
+
22
+ enum Role {
23
+ USER = 0;
24
+ ADMIN = 1;
25
+ }
package/proto/auth.proto CHANGED
@@ -5,6 +5,7 @@ package auth.v1; // указываем пакет тут указываем до
5
5
  service AuthService {
6
6
  rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
7
7
  rpc VerifyOtp (VerifyOtpRequest) returns (VerifyOtpResponse);
8
+ rpc RefreshTokens (RefreshTokensRequest) returns (RefreshTokensResponse);
8
9
  }
9
10
 
10
11
  message SendOtpRequest {
@@ -26,5 +27,14 @@ message VerifyOtpRequest {
26
27
  message VerifyOtpResponse {
27
28
  string access_token = 1;
28
29
  string refresh_token = 2;
29
-
30
- }
30
+ }
31
+
32
+ message RefreshTokensRequest {
33
+ string refresh_token = 1;
34
+ }
35
+
36
+ message RefreshTokensResponse {
37
+ string access_token = 1;
38
+ string refresh_token = 2;
39
+ }
40
+