@usteam/contracts 1.0.4 → 1.0.6

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_PATHS: {
2
2
  readonly AUTH: string;
3
+ readonly ACCOUNT: string;
3
4
  };
@@ -3,5 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PROTO_PATHS = void 0;
4
4
  const path_1 = require("path");
5
5
  exports.PROTO_PATHS = {
6
- AUTH: (0, path_1.join)(__dirname, '../../proto/auth.proto')
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,159 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.10.1
4
+ // protoc v6.33.5
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
+ EDITOR = 2,
17
+ CASHIER = 3,
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 interface InitEmailChangeRequest {
35
+ email: string;
36
+ userId: string;
37
+ }
38
+
39
+ export interface InitEmailChangeResponce {
40
+ ok: boolean;
41
+ }
42
+
43
+ export interface ConfirmEmailChangeRequest {
44
+ email: string;
45
+ code: string;
46
+ userId: string;
47
+ }
48
+
49
+ export interface ConfirmEmailChangeResponce {
50
+ ok: boolean;
51
+ }
52
+
53
+ export interface InitPhoneChangeRequest {
54
+ phone: string;
55
+ userId: string;
56
+ }
57
+
58
+ export interface InitPhoneChangeResponce {
59
+ ok: boolean;
60
+ }
61
+
62
+ export interface ConfirmPhoneChangeRequest {
63
+ phone: string;
64
+ code: string;
65
+ userId: string;
66
+ }
67
+
68
+ export interface ConfirmPhoneChangeResponce {
69
+ ok: boolean;
70
+ }
71
+
72
+ export const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
73
+
74
+ /** AccountService отвечает за операции с аккаунтом. */
75
+
76
+ export interface AccountServiceClient {
77
+ /**
78
+ * GetAccount отправляет id аккаунта
79
+ * получает данные об аккаунте
80
+ */
81
+
82
+ getAccount(request: GetAccountRequest): Observable<GetAccountResponse>;
83
+
84
+ /** InitEmailChange запрашивает новую почту */
85
+
86
+ initEmailChange(request: InitEmailChangeRequest): Observable<InitEmailChangeResponce>;
87
+
88
+ /** ConfirmEmailChange подтверждает новую почту */
89
+
90
+ confirmEmailChange(request: ConfirmEmailChangeRequest): Observable<ConfirmEmailChangeResponce>;
91
+
92
+ /** InitPhoneChange запрашивает новый телефон */
93
+
94
+ initPhoneChange(request: InitPhoneChangeRequest): Observable<InitPhoneChangeResponce>;
95
+
96
+ /** ConfirmPhoneChange подтверждает новый телефон */
97
+
98
+ confirmPhoneChange(request: ConfirmPhoneChangeRequest): Observable<ConfirmPhoneChangeResponce>;
99
+ }
100
+
101
+ /** AccountService отвечает за операции с аккаунтом. */
102
+
103
+ export interface AccountServiceController {
104
+ /**
105
+ * GetAccount отправляет id аккаунта
106
+ * получает данные об аккаунте
107
+ */
108
+
109
+ getAccount(
110
+ request: GetAccountRequest,
111
+ ): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
112
+
113
+ /** InitEmailChange запрашивает новую почту */
114
+
115
+ initEmailChange(
116
+ request: InitEmailChangeRequest,
117
+ ): Promise<InitEmailChangeResponce> | Observable<InitEmailChangeResponce> | InitEmailChangeResponce;
118
+
119
+ /** ConfirmEmailChange подтверждает новую почту */
120
+
121
+ confirmEmailChange(
122
+ request: ConfirmEmailChangeRequest,
123
+ ): Promise<ConfirmEmailChangeResponce> | Observable<ConfirmEmailChangeResponce> | ConfirmEmailChangeResponce;
124
+
125
+ /** InitPhoneChange запрашивает новый телефон */
126
+
127
+ initPhoneChange(
128
+ request: InitPhoneChangeRequest,
129
+ ): Promise<InitPhoneChangeResponce> | Observable<InitPhoneChangeResponce> | InitPhoneChangeResponce;
130
+
131
+ /** ConfirmPhoneChange подтверждает новый телефон */
132
+
133
+ confirmPhoneChange(
134
+ request: ConfirmPhoneChangeRequest,
135
+ ): Promise<ConfirmPhoneChangeResponce> | Observable<ConfirmPhoneChangeResponce> | ConfirmPhoneChangeResponce;
136
+ }
137
+
138
+ export function AccountServiceControllerMethods() {
139
+ return function (constructor: Function) {
140
+ const grpcMethods: string[] = [
141
+ "getAccount",
142
+ "initEmailChange",
143
+ "confirmEmailChange",
144
+ "initPhoneChange",
145
+ "confirmPhoneChange",
146
+ ];
147
+ for (const method of grpcMethods) {
148
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
149
+ GrpcMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
150
+ }
151
+ const grpcStreamMethods: string[] = [];
152
+ for (const method of grpcStreamMethods) {
153
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
154
+ GrpcStreamMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
155
+ }
156
+ };
157
+ }
158
+
159
+ export const ACCOUNT_SERVICE_NAME = "AccountService";
package/gen/auth.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
3
  // protoc-gen-ts_proto v2.10.1
4
- // protoc v6.33.4
4
+ // protoc v6.33.5
5
5
  // source: auth.proto
6
6
 
7
7
  /* eslint-disable */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usteam/contracts",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "scripts": {
@@ -0,0 +1,80 @@
1
+ syntax = "proto3";
2
+
3
+ package account.v1;
4
+
5
+ // AccountService отвечает за операции с аккаунтом.
6
+ service AccountService {
7
+ // GetAccount отправляет id аккаунта
8
+ // получает данные об аккаунте
9
+ rpc GetAccount (GetAccountRequest) returns (GetAccountResponse);
10
+
11
+ // InitEmailChange запрашивает новую почту
12
+ rpc InitEmailChange(InitEmailChangeRequest) returns (InitEmailChangeResponce);
13
+ // ConfirmEmailChange подтверждает новую почту
14
+ rpc ConfirmEmailChange(ConfirmEmailChangeRequest) returns (ConfirmEmailChangeResponce);
15
+
16
+ // InitPhoneChange запрашивает новый телефон
17
+ rpc InitPhoneChange(InitPhoneChangeRequest) returns (InitPhoneChangeResponce);
18
+ // ConfirmPhoneChange подтверждает новый телефон
19
+ rpc ConfirmPhoneChange(ConfirmPhoneChangeRequest) returns (ConfirmPhoneChangeResponce);
20
+
21
+ }
22
+
23
+ message GetAccountRequest {
24
+ string id = 1;
25
+ }
26
+
27
+ message GetAccountResponse {
28
+ string id = 1;
29
+ string phone = 2;
30
+ string email = 3;
31
+ bool is_phone_verified = 4;
32
+ bool is_email_verified = 5;
33
+ Role role = 6;
34
+
35
+ }
36
+
37
+ message InitEmailChangeRequest {
38
+ string email = 1;
39
+ string user_id = 2;
40
+ }
41
+
42
+ message InitEmailChangeResponce {
43
+ bool ok = 1;
44
+ }
45
+
46
+ message ConfirmEmailChangeRequest {
47
+ string email = 1;
48
+ string code = 2;
49
+ string user_id = 3;
50
+ }
51
+
52
+ message ConfirmEmailChangeResponce {
53
+ bool ok = 1;
54
+ }
55
+
56
+ message InitPhoneChangeRequest {
57
+ string phone = 1;
58
+ string user_id = 2;
59
+ }
60
+
61
+ message InitPhoneChangeResponce {
62
+ bool ok = 1;
63
+ }
64
+
65
+ message ConfirmPhoneChangeRequest {
66
+ string phone = 1;
67
+ string code = 2;
68
+ string user_id = 3;
69
+ }
70
+
71
+ message ConfirmPhoneChangeResponce {
72
+ bool ok = 1;
73
+ }
74
+
75
+ enum Role {
76
+ USER = 0;
77
+ ADMIN = 1;
78
+ EDITOR = 2;
79
+ CASHIER = 3;
80
+ }