@teacinema/contracts 1.1.3 → 1.1.4

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 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 v6.33.1
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/gen/auth.ts CHANGED
@@ -1,63 +1,143 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
- // protoc-gen-ts_proto v2.7.7
3
+ // protoc-gen-ts_proto v2.8.3
4
4
  // protoc v6.33.1
5
5
  // source: auth.proto
6
6
 
7
7
  /* eslint-disable */
8
- import { GrpcMethod, GrpcStreamMethod } from '@nestjs/microservices'
9
- import { Observable } from 'rxjs'
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+ import { Empty } from "./google/protobuf/empty";
10
11
 
11
- export const protobufPackage = 'auth.v1'
12
+ export const protobufPackage = "auth.v1";
12
13
 
13
14
  export interface SendOtpRequest {
14
- identifier: string
15
- type: string
15
+ identifier: string;
16
+ type: string;
16
17
  }
17
18
 
18
19
  export interface SendOtpResponse {
19
- ok: boolean
20
+ ok: boolean;
20
21
  }
21
22
 
22
- export const AUTH_V1_PACKAGE_NAME = 'auth.v1'
23
+ export interface VerifyOtpRequest {
24
+ identifier: string;
25
+ type: string;
26
+ code: string;
27
+ }
28
+
29
+ export interface VerifyOtpResponse {
30
+ accessToken: string;
31
+ refreshToken: string;
32
+ }
33
+
34
+ export interface RefreshRequest {
35
+ refreshToken: string;
36
+ }
37
+
38
+ export interface RefreshResponse {
39
+ accessToken: string;
40
+ refreshToken: string;
41
+ }
42
+
43
+ export interface TelegramInitResponse {
44
+ url: string;
45
+ }
46
+
47
+ export interface TelegramVerifyRequest {
48
+ query: { [key: string]: string };
49
+ }
50
+
51
+ export interface TelegramVerifyRequest_QueryEntry {
52
+ key: string;
53
+ value: string;
54
+ }
55
+
56
+ export interface TelegramVerifyResponse {
57
+ url?: string | undefined;
58
+ accessToken?: string | undefined;
59
+ refreshToken?: string | undefined;
60
+ }
61
+
62
+ export interface TelegramCompleteRequest {
63
+ sessionId: string;
64
+ phone: string;
65
+ }
66
+
67
+ export interface TelegramCompleteResponse {
68
+ sessionId: string;
69
+ }
70
+
71
+ export interface TelegramConsumeRequest {
72
+ sessionId: string;
73
+ }
74
+
75
+ export interface TelegramConsumeResponse {
76
+ accessToken: string;
77
+ refreshToken: string;
78
+ }
79
+
80
+ export const AUTH_V1_PACKAGE_NAME = "auth.v1";
23
81
 
24
82
  export interface AuthServiceClient {
25
- sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>
83
+ sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
84
+
85
+ verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
86
+
87
+ refresh(request: RefreshRequest): Observable<RefreshResponse>;
88
+
89
+ telegramInit(request: Empty): Observable<TelegramInitResponse>;
90
+
91
+ telegramVerify(request: TelegramVerifyRequest): Observable<TelegramVerifyResponse>;
92
+
93
+ telegramComplete(request: TelegramCompleteRequest): Observable<TelegramCompleteResponse>;
94
+
95
+ telegramConsume(request: TelegramConsumeRequest): Observable<TelegramConsumeResponse>;
26
96
  }
27
97
 
28
98
  export interface AuthServiceController {
29
- sendOtp(
30
- request: SendOtpRequest
31
- ): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse
99
+ sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
100
+
101
+ verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
102
+
103
+ refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
104
+
105
+ telegramInit(request: Empty): Promise<TelegramInitResponse> | Observable<TelegramInitResponse> | TelegramInitResponse;
106
+
107
+ telegramVerify(
108
+ request: TelegramVerifyRequest,
109
+ ): Promise<TelegramVerifyResponse> | Observable<TelegramVerifyResponse> | TelegramVerifyResponse;
110
+
111
+ telegramComplete(
112
+ request: TelegramCompleteRequest,
113
+ ): Promise<TelegramCompleteResponse> | Observable<TelegramCompleteResponse> | TelegramCompleteResponse;
114
+
115
+ telegramConsume(
116
+ request: TelegramConsumeRequest,
117
+ ): Promise<TelegramConsumeResponse> | Observable<TelegramConsumeResponse> | TelegramConsumeResponse;
32
118
  }
33
119
 
34
120
  export function AuthServiceControllerMethods() {
35
- return function (constructor: Function) {
36
- const grpcMethods: string[] = ['sendOtp']
37
- for (const method of grpcMethods) {
38
- const descriptor: any = Reflect.getOwnPropertyDescriptor(
39
- constructor.prototype,
40
- method
41
- )
42
- GrpcMethod('AuthService', method)(
43
- constructor.prototype[method],
44
- method,
45
- descriptor
46
- )
47
- }
48
- const grpcStreamMethods: string[] = []
49
- for (const method of grpcStreamMethods) {
50
- const descriptor: any = Reflect.getOwnPropertyDescriptor(
51
- constructor.prototype,
52
- method
53
- )
54
- GrpcStreamMethod('AuthService', method)(
55
- constructor.prototype[method],
56
- method,
57
- descriptor
58
- )
59
- }
60
- }
61
- }
62
-
63
- export const AUTH_SERVICE_NAME = 'AuthService'
121
+ return function (constructor: Function) {
122
+ const grpcMethods: string[] = [
123
+ "sendOtp",
124
+ "verifyOtp",
125
+ "refresh",
126
+ "telegramInit",
127
+ "telegramVerify",
128
+ "telegramComplete",
129
+ "telegramConsume",
130
+ ];
131
+ for (const method of grpcMethods) {
132
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
133
+ GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
134
+ }
135
+ const grpcStreamMethods: string[] = [];
136
+ for (const method of grpcStreamMethods) {
137
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
138
+ GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
139
+ }
140
+ };
141
+ }
142
+
143
+ export const AUTH_SERVICE_NAME = "AuthService";
@@ -0,0 +1,23 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.8.3
4
+ // protoc v6.33.1
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/gen/users.ts ADDED
@@ -0,0 +1,81 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.8.3
4
+ // protoc v6.33.1
5
+ // source: users.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+
11
+ export const protobufPackage = "users.v1";
12
+
13
+ export interface GetMeRequest {
14
+ id: string;
15
+ }
16
+
17
+ export interface GetMeResponse {
18
+ user: User | undefined;
19
+ }
20
+
21
+ export interface CreateUserRequest {
22
+ id: string;
23
+ }
24
+
25
+ export interface CreateUserResponse {
26
+ ok: boolean;
27
+ }
28
+
29
+ export interface PatchUserRequest {
30
+ userId: string;
31
+ name?: string | undefined;
32
+ }
33
+
34
+ export interface PatchUserResponse {
35
+ ok: boolean;
36
+ }
37
+
38
+ export interface User {
39
+ id: string;
40
+ name?: string | undefined;
41
+ phone?: string | undefined;
42
+ email?: string | undefined;
43
+ avatar?: string | undefined;
44
+ }
45
+
46
+ export const USERS_V1_PACKAGE_NAME = "users.v1";
47
+
48
+ export interface UsersServiceClient {
49
+ getMe(request: GetMeRequest): Observable<GetMeResponse>;
50
+
51
+ createUser(request: CreateUserRequest): Observable<CreateUserResponse>;
52
+
53
+ patchUser(request: PatchUserRequest): Observable<PatchUserResponse>;
54
+ }
55
+
56
+ export interface UsersServiceController {
57
+ getMe(request: GetMeRequest): Promise<GetMeResponse> | Observable<GetMeResponse> | GetMeResponse;
58
+
59
+ createUser(
60
+ request: CreateUserRequest,
61
+ ): Promise<CreateUserResponse> | Observable<CreateUserResponse> | CreateUserResponse;
62
+
63
+ patchUser(request: PatchUserRequest): Promise<PatchUserResponse> | Observable<PatchUserResponse> | PatchUserResponse;
64
+ }
65
+
66
+ export function UsersServiceControllerMethods() {
67
+ return function (constructor: Function) {
68
+ const grpcMethods: string[] = ["getMe", "createUser", "patchUser"];
69
+ for (const method of grpcMethods) {
70
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
71
+ GrpcMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
72
+ }
73
+ const grpcStreamMethods: string[] = [];
74
+ for (const method of grpcStreamMethods) {
75
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
76
+ GrpcStreamMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
77
+ }
78
+ };
79
+ }
80
+
81
+ export const USERS_SERVICE_NAME = "UsersService";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teacinema/contracts",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "Protobuf definitions and generated TypeScript types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",