@teacinema/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
  };
@@ -4,4 +4,5 @@ exports.PROTO_PATHS = void 0;
4
4
  const path_1 = require("path");
5
5
  exports.PROTO_PATHS = {
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,127 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.8.3
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
+ phone: string;
26
+ email: string;
27
+ isPhoneVerified: boolean;
28
+ isEmailVerified: boolean;
29
+ role: Role;
30
+ }
31
+
32
+ export interface InitEmailChangeRequest {
33
+ email: string;
34
+ userId: string;
35
+ }
36
+
37
+ export interface InitEmailChangeResponse {
38
+ ok: boolean;
39
+ }
40
+
41
+ export interface ConfirmEmailChangeRequest {
42
+ email: string;
43
+ code: string;
44
+ userId: string;
45
+ }
46
+
47
+ export interface ConfirmEmailChangeResponse {
48
+ ok: boolean;
49
+ }
50
+
51
+ export interface InitPhoneChangeRequest {
52
+ phone: string;
53
+ userId: string;
54
+ }
55
+
56
+ export interface InitPhoneChangeResponse {
57
+ ok: boolean;
58
+ }
59
+
60
+ export interface ConfirmPhoneChangeRequest {
61
+ phone: string;
62
+ code: string;
63
+ userId: string;
64
+ }
65
+
66
+ export interface ConfirmPhoneChangeResponse {
67
+ ok: boolean;
68
+ }
69
+
70
+ export const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
71
+
72
+ export interface AccountServiceClient {
73
+ getAccount(request: GetAccountRequest): Observable<GetAccountResponse>;
74
+
75
+ initEmailChange(request: InitEmailChangeRequest): Observable<InitEmailChangeResponse>;
76
+
77
+ confirmEmailChange(request: ConfirmEmailChangeRequest): Observable<ConfirmEmailChangeResponse>;
78
+
79
+ initPhoneChange(request: InitPhoneChangeRequest): Observable<InitPhoneChangeResponse>;
80
+
81
+ confirmPhoneChange(request: ConfirmPhoneChangeRequest): Observable<ConfirmPhoneChangeResponse>;
82
+ }
83
+
84
+ export interface AccountServiceController {
85
+ getAccount(
86
+ request: GetAccountRequest,
87
+ ): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
88
+
89
+ initEmailChange(
90
+ request: InitEmailChangeRequest,
91
+ ): Promise<InitEmailChangeResponse> | Observable<InitEmailChangeResponse> | InitEmailChangeResponse;
92
+
93
+ confirmEmailChange(
94
+ request: ConfirmEmailChangeRequest,
95
+ ): Promise<ConfirmEmailChangeResponse> | Observable<ConfirmEmailChangeResponse> | ConfirmEmailChangeResponse;
96
+
97
+ initPhoneChange(
98
+ request: InitPhoneChangeRequest,
99
+ ): Promise<InitPhoneChangeResponse> | Observable<InitPhoneChangeResponse> | InitPhoneChangeResponse;
100
+
101
+ confirmPhoneChange(
102
+ request: ConfirmPhoneChangeRequest,
103
+ ): Promise<ConfirmPhoneChangeResponse> | Observable<ConfirmPhoneChangeResponse> | ConfirmPhoneChangeResponse;
104
+ }
105
+
106
+ export function AccountServiceControllerMethods() {
107
+ return function (constructor: Function) {
108
+ const grpcMethods: string[] = [
109
+ "getAccount",
110
+ "initEmailChange",
111
+ "confirmEmailChange",
112
+ "initPhoneChange",
113
+ "confirmPhoneChange",
114
+ ];
115
+ for (const method of grpcMethods) {
116
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
117
+ GrpcMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
118
+ }
119
+ const grpcStreamMethods: string[] = [];
120
+ for (const method of grpcStreamMethods) {
121
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
122
+ GrpcStreamMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
123
+ }
124
+ };
125
+ }
126
+
127
+ export const ACCOUNT_SERVICE_NAME = "AccountService";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teacinema/contracts",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Protobuf definitions and generated TypeScript types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -0,0 +1,69 @@
1
+ syntax = "proto3";
2
+
3
+ package account.v1;
4
+
5
+ service AccountService {
6
+ rpc GetAccount (GetAccountRequest) returns (GetAccountResponse);
7
+
8
+ rpc InitEmailChange (InitEmailChangeRequest) returns (InitEmailChangeResponse);
9
+ rpc ConfirmEmailChange (ConfirmEmailChangeRequest) returns (ConfirmEmailChangeResponse);
10
+
11
+ rpc InitPhoneChange (InitPhoneChangeRequest) returns (InitPhoneChangeResponse);
12
+ rpc ConfirmPhoneChange (ConfirmPhoneChangeRequest) returns (ConfirmPhoneChangeResponse);
13
+ }
14
+
15
+ message GetAccountRequest {
16
+ string id = 1;
17
+ }
18
+
19
+ message GetAccountResponse {
20
+ string id = 1;
21
+ string phone = 2;
22
+ string email = 3;
23
+ bool is_phone_verified = 4;
24
+ bool is_email_verified = 5;
25
+ Role role = 6;
26
+ }
27
+
28
+ message InitEmailChangeRequest {
29
+ string email = 1;
30
+ string user_id = 2;
31
+ }
32
+
33
+ message InitEmailChangeResponse {
34
+ bool ok = 1;
35
+ }
36
+
37
+ message ConfirmEmailChangeRequest {
38
+ string email = 1;
39
+ string code = 2;
40
+ string user_id = 3;
41
+ }
42
+
43
+ message ConfirmEmailChangeResponse {
44
+ bool ok = 1;
45
+ }
46
+
47
+ message InitPhoneChangeRequest {
48
+ string phone = 1;
49
+ string user_id = 2;
50
+ }
51
+
52
+ message InitPhoneChangeResponse {
53
+ bool ok = 1;
54
+ }
55
+
56
+ message ConfirmPhoneChangeRequest {
57
+ string phone = 1;
58
+ string code = 2;
59
+ string user_id = 3;
60
+ }
61
+
62
+ message ConfirmPhoneChangeResponse {
63
+ bool ok = 1;
64
+ }
65
+
66
+ enum Role {
67
+ USER = 0;
68
+ ADMIN = 1;
69
+ }