@astromonacinema/contracts 1.0.5 → 1.0.7

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.
package/gen/account.ts CHANGED
@@ -29,21 +29,51 @@ export interface GetAccountResponse {
29
29
  role: Role;
30
30
  }
31
31
 
32
+ export interface InitEmailChangeRequest {
33
+ id: string;
34
+ newEmail: string;
35
+ }
36
+
37
+ export interface InitEmailChangeResponse {
38
+ id: string;
39
+ }
40
+
41
+ export interface ConfirmEmailChangeRequest {
42
+ id: string;
43
+ code: string;
44
+ }
45
+
46
+ export interface ConfirmEmailChangeResponse {
47
+ id: string;
48
+ }
49
+
32
50
  export const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
33
51
 
34
52
  export interface AccountServiceClient {
35
53
  getAccount(request: GetAccountRequest): Observable<GetAccountResponse>;
54
+
55
+ initEmailChange(request: InitEmailChangeRequest): Observable<InitEmailChangeResponse>;
56
+
57
+ confirmEmailChange(request: ConfirmEmailChangeRequest): Observable<ConfirmEmailChangeResponse>;
36
58
  }
37
59
 
38
60
  export interface AccountServiceController {
39
61
  getAccount(
40
62
  request: GetAccountRequest,
41
63
  ): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
64
+
65
+ initEmailChange(
66
+ request: InitEmailChangeRequest,
67
+ ): Promise<InitEmailChangeResponse> | Observable<InitEmailChangeResponse> | InitEmailChangeResponse;
68
+
69
+ confirmEmailChange(
70
+ request: ConfirmEmailChangeRequest,
71
+ ): Promise<ConfirmEmailChangeResponse> | Observable<ConfirmEmailChangeResponse> | ConfirmEmailChangeResponse;
42
72
  }
43
73
 
44
74
  export function AccountServiceControllerMethods() {
45
75
  return function (constructor: Function) {
46
- const grpcMethods: string[] = ["getAccount"];
76
+ const grpcMethods: string[] = ["getAccount", "initEmailChange", "confirmEmailChange"];
47
77
  for (const method of grpcMethods) {
48
78
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
49
79
  GrpcMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
package/gen/auth.ts CHANGED
@@ -9,6 +9,7 @@ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
9
  import { wrappers } from "protobufjs";
10
10
  import { Observable } from "rxjs";
11
11
  import { Any } from "./google/protobuf/any";
12
+ import { Empty } from "./google/protobuf/empty";
12
13
  import { Struct } from "./google/protobuf/struct";
13
14
  import { Timestamp } from "./google/protobuf/timestamp";
14
15
 
@@ -25,6 +26,28 @@ export enum Status {
25
26
  UNRECOGNIZED = -1,
26
27
  }
27
28
 
29
+ export interface TelegramCompleteRequest {
30
+ sessionId: string;
31
+ phone: string;
32
+ }
33
+
34
+ export interface TelegramCompleteResponse {
35
+ sessionId: string;
36
+ }
37
+
38
+ export interface TelegramConsumeRequest {
39
+ sessionId: string;
40
+ }
41
+
42
+ export interface TelegramConsumeResponse {
43
+ accessToken: string;
44
+ refreshToken: string;
45
+ }
46
+
47
+ export interface TelegramInitResponse {
48
+ url: string;
49
+ }
50
+
28
51
  export interface SendOtpRequest {
29
52
  identifier: string;
30
53
  type: string;
@@ -54,6 +77,21 @@ export interface RefreshResponse {
54
77
  refreshToken: string;
55
78
  }
56
79
 
80
+ export interface TelegramVerifyRequest {
81
+ query: { [key: string]: string };
82
+ }
83
+
84
+ export interface TelegramVerifyRequest_QueryEntry {
85
+ key: string;
86
+ value: string;
87
+ }
88
+
89
+ export interface TelegramVerifyResponse {
90
+ url?: string | undefined;
91
+ accessToken?: string | undefined;
92
+ refreshToken?: string | undefined;
93
+ }
94
+
57
95
  export interface UserSession {
58
96
  id: string;
59
97
  /** временное значение */
@@ -107,6 +145,14 @@ export interface AuthServiceClient {
107
145
  verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
108
146
 
109
147
  refresh(request: RefreshRequest): Observable<RefreshResponse>;
148
+
149
+ telegramInit(request: Empty): Observable<TelegramInitResponse>;
150
+
151
+ telegramVerify(request: TelegramVerifyRequest): Observable<TelegramVerifyResponse>;
152
+
153
+ telegramComplete(request: TelegramCompleteRequest): Observable<TelegramCompleteResponse>;
154
+
155
+ telegramConsume(request: TelegramConsumeRequest): Observable<TelegramConsumeResponse>;
110
156
  }
111
157
 
112
158
  export interface AuthServiceController {
@@ -115,11 +161,33 @@ export interface AuthServiceController {
115
161
  verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
116
162
 
117
163
  refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
164
+
165
+ telegramInit(request: Empty): Promise<TelegramInitResponse> | Observable<TelegramInitResponse> | TelegramInitResponse;
166
+
167
+ telegramVerify(
168
+ request: TelegramVerifyRequest,
169
+ ): Promise<TelegramVerifyResponse> | Observable<TelegramVerifyResponse> | TelegramVerifyResponse;
170
+
171
+ telegramComplete(
172
+ request: TelegramCompleteRequest,
173
+ ): Promise<TelegramCompleteResponse> | Observable<TelegramCompleteResponse> | TelegramCompleteResponse;
174
+
175
+ telegramConsume(
176
+ request: TelegramConsumeRequest,
177
+ ): Promise<TelegramConsumeResponse> | Observable<TelegramConsumeResponse> | TelegramConsumeResponse;
118
178
  }
119
179
 
120
180
  export function AuthServiceControllerMethods() {
121
181
  return function (constructor: Function) {
122
- const grpcMethods: string[] = ["sendOtp", "verifyOtp", "refresh"];
182
+ const grpcMethods: string[] = [
183
+ "sendOtp",
184
+ "verifyOtp",
185
+ "refresh",
186
+ "telegramInit",
187
+ "telegramVerify",
188
+ "telegramComplete",
189
+ "telegramConsume",
190
+ ];
123
191
  for (const method of grpcMethods) {
124
192
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
125
193
  GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
@@ -0,0 +1,23 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.10.1
4
+ // protoc v3.21.12
5
+ // source: google/protobuf/empty.proto
6
+
7
+ /* eslint-disable */
8
+
9
+ export const protobufPackage = "google.protobuf";
10
+
11
+ /**
12
+ * A generic empty message that you can re-use to avoid defining duplicated
13
+ * empty messages in your APIs. A typical example is to use it as the request
14
+ * or the response type of an API method. For instance:
15
+ *
16
+ * service Foo {
17
+ * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
18
+ * }
19
+ */
20
+ export interface Empty {
21
+ }
22
+
23
+ export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astromonacinema/contracts",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "license": "MIT",
5
5
  "description": "Protobuf contracts for microservices",
6
6
  "main": "dist/index.js",
@@ -5,6 +5,10 @@ package account.v1;
5
5
 
6
6
  service AccountService {
7
7
  rpc GetAccount (GetAccountRequest) returns (GetAccountResponse);
8
+
9
+ rpc initEmailChange (InitEmailChangeRequest) returns (InitEmailChangeResponse);
10
+
11
+ rpc ConfirmEmailChange (ConfirmEmailChangeRequest) returns (ConfirmEmailChangeResponse);
8
12
  }
9
13
 
10
14
  message GetAccountRequest {
@@ -23,4 +27,23 @@ message GetAccountResponse {
23
27
  enum Role {
24
28
  USER = 0;
25
29
  ADMIN = 1;
30
+ }
31
+
32
+
33
+ message InitEmailChangeRequest {
34
+ string id = 1;
35
+ string new_email = 2;
36
+ }
37
+
38
+ message InitEmailChangeResponse {
39
+ string id = 1;
40
+ }
41
+
42
+ message ConfirmEmailChangeRequest {
43
+ string id = 1;
44
+ string code = 2;
45
+ }
46
+
47
+ message ConfirmEmailChangeResponse {
48
+ string id = 1;
26
49
  }
package/proto/auth.proto CHANGED
@@ -2,6 +2,8 @@ syntax = "proto3";
2
2
 
3
3
  package auth.v1;
4
4
 
5
+ import "google/protobuf/empty.proto";
6
+
5
7
  import "google/protobuf/timestamp.proto";
6
8
  import "google/protobuf/struct.proto";
7
9
  import "google/protobuf/any.proto";
@@ -10,6 +12,33 @@ service AuthService {
10
12
  rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
11
13
  rpc VerifyOtp (VerifyOtpRequest) returns (VerifyOtpResponse);
12
14
  rpc Refresh (RefreshRequest) returns (RefreshResponse);
15
+
16
+ rpc TelegramInit(google.protobuf.Empty) returns (TelegramInitResponse);
17
+ rpc TelegramVerify(TelegramVerifyRequest) returns (TelegramVerifyResponse);
18
+ rpc TelegramComplete(TelegramCompleteRequest) returns (TelegramCompleteResponse);
19
+ rpc TelegramConsume(TelegramConsumeRequest) returns (TelegramConsumeResponse);
20
+ }
21
+
22
+ message TelegramCompleteRequest {
23
+ string session_id = 1;
24
+ string phone = 2;
25
+ }
26
+
27
+ message TelegramCompleteResponse {
28
+ string session_id = 1;
29
+ }
30
+
31
+ message TelegramConsumeRequest {
32
+ string session_id = 1;
33
+ }
34
+
35
+ message TelegramConsumeResponse {
36
+ string access_token = 1;
37
+ string refresh_token = 2;
38
+ }
39
+
40
+ message TelegramInitResponse {
41
+ string url = 1;
13
42
  }
14
43
 
15
44
  message SendOtpRequest {
@@ -42,6 +71,19 @@ message RefreshResponse {
42
71
  string refresh_token = 2;
43
72
  }
44
73
 
74
+ message TelegramVerifyRequest {
75
+ map<string, string> query = 1;
76
+ }
77
+
78
+ message TelegramVerifyResponse {
79
+ oneof result {
80
+ string url = 1;
81
+ string access_token = 2;
82
+ string refresh_token = 3;
83
+ }
84
+ }
85
+
86
+
45
87
 
46
88
 
47
89