@ciganov/contracts 1.0.4 → 1.1.0

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.
@@ -0,0 +1,43 @@
1
+ import { Observable } from "rxjs";
2
+ export declare const protobufPackage = "account.v1";
3
+ export declare enum Role {
4
+ USER = 0,
5
+ ADMIN = 1,
6
+ UNRECOGNIZED = -1
7
+ }
8
+ export interface GetAccountRequest {
9
+ id: string;
10
+ }
11
+ export interface GetAccountResponse {
12
+ id: string;
13
+ email: string;
14
+ role: Role;
15
+ }
16
+ export interface InitEmailChangeRequest {
17
+ email: string;
18
+ userId: string;
19
+ }
20
+ export interface InitEmailChangeResponse {
21
+ ok: boolean;
22
+ }
23
+ export interface ConfirmEmailChangeRequest {
24
+ email: string;
25
+ code: string;
26
+ userId: string;
27
+ }
28
+ export interface ConfirmEmailChangeResponse {
29
+ ok: boolean;
30
+ }
31
+ export declare const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
32
+ export interface AccountServiceClient {
33
+ getAccount(request: GetAccountRequest): Observable<GetAccountResponse>;
34
+ initEmailChange(request: InitEmailChangeRequest): Observable<InitEmailChangeResponse>;
35
+ confirmEmailChange(request: ConfirmEmailChangeRequest): Observable<ConfirmEmailChangeResponse>;
36
+ }
37
+ export interface AccountServiceController {
38
+ getAccount(request: GetAccountRequest): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
39
+ initEmailChange(request: InitEmailChangeRequest): Promise<InitEmailChangeResponse> | Observable<InitEmailChangeResponse> | InitEmailChangeResponse;
40
+ confirmEmailChange(request: ConfirmEmailChangeRequest): Promise<ConfirmEmailChangeResponse> | Observable<ConfirmEmailChangeResponse> | ConfirmEmailChangeResponse;
41
+ }
42
+ export declare function AccountServiceControllerMethods(): (constructor: Function) => void;
43
+ export declare const ACCOUNT_SERVICE_NAME = "AccountService";
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.11.6
5
+ // protoc v3.21.12
6
+ // source: account.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.ACCOUNT_SERVICE_NAME = exports.ACCOUNT_V1_PACKAGE_NAME = exports.Role = exports.protobufPackage = void 0;
9
+ exports.AccountServiceControllerMethods = AccountServiceControllerMethods;
10
+ /* eslint-disable */
11
+ const microservices_1 = require("@nestjs/microservices");
12
+ exports.protobufPackage = "account.v1";
13
+ var Role;
14
+ (function (Role) {
15
+ Role[Role["USER"] = 0] = "USER";
16
+ Role[Role["ADMIN"] = 1] = "ADMIN";
17
+ Role[Role["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
18
+ })(Role || (exports.Role = Role = {}));
19
+ exports.ACCOUNT_V1_PACKAGE_NAME = "account.v1";
20
+ function AccountServiceControllerMethods() {
21
+ return function (constructor) {
22
+ const grpcMethods = ["getAccount", "initEmailChange", "confirmEmailChange"];
23
+ for (const method of grpcMethods) {
24
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
25
+ (0, microservices_1.GrpcMethod)("AccountService", method)(constructor.prototype[method], method, descriptor);
26
+ }
27
+ const grpcStreamMethods = [];
28
+ for (const method of grpcStreamMethods) {
29
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
30
+ (0, microservices_1.GrpcStreamMethod)("AccountService", method)(constructor.prototype[method], method, descriptor);
31
+ }
32
+ };
33
+ }
34
+ exports.ACCOUNT_SERVICE_NAME = "AccountService";
@@ -1,4 +1,5 @@
1
1
  import { Observable } from "rxjs";
2
+ import { Empty } from "./google/protobuf/empty";
2
3
  export declare const protobufPackage = "auth.v1";
3
4
  export interface SendOtpRequest {
4
5
  identifier: string;
@@ -13,14 +14,32 @@ export interface VerifyOtpRequest {
13
14
  export interface VerifyOtpResponse {
14
15
  token: string;
15
16
  }
17
+ export interface GetSessionByTokenRequest {
18
+ token: string;
19
+ }
20
+ export interface GetSessionByTokenResponse {
21
+ session?: Session | undefined;
22
+ }
23
+ export interface Session {
24
+ id: string;
25
+ token: string;
26
+ userId: string;
27
+ }
28
+ export interface RefreshTokenRequest {
29
+ token: string;
30
+ }
16
31
  export declare const AUTH_V1_PACKAGE_NAME = "auth.v1";
17
32
  export interface AuthServiceClient {
18
33
  sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
19
34
  verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
35
+ getSessionByToken(request: GetSessionByTokenRequest): Observable<GetSessionByTokenResponse>;
36
+ refreshToken(request: RefreshTokenRequest): Observable<Empty>;
20
37
  }
21
38
  export interface AuthServiceController {
22
39
  sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
23
40
  verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
41
+ getSessionByToken(request: GetSessionByTokenRequest): Promise<GetSessionByTokenResponse> | Observable<GetSessionByTokenResponse> | GetSessionByTokenResponse;
42
+ refreshToken(request: RefreshTokenRequest): void | Promise<void>;
24
43
  }
25
44
  export declare function AuthServiceControllerMethods(): (constructor: Function) => void;
26
45
  export declare const AUTH_SERVICE_NAME = "AuthService";
package/dist/gen/auth.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
3
  // versions:
4
- // protoc-gen-ts_proto v2.10.1
5
- // protoc v6.33.2
4
+ // protoc-gen-ts_proto v2.11.6
5
+ // protoc v3.21.12
6
6
  // source: auth.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.AUTH_SERVICE_NAME = exports.AUTH_V1_PACKAGE_NAME = exports.protobufPackage = void 0;
@@ -13,7 +13,7 @@ exports.protobufPackage = "auth.v1";
13
13
  exports.AUTH_V1_PACKAGE_NAME = "auth.v1";
14
14
  function AuthServiceControllerMethods() {
15
15
  return function (constructor) {
16
- const grpcMethods = ["sendOtp", "verifyOtp"];
16
+ const grpcMethods = ["sendOtp", "verifyOtp", "getSessionByToken", "refreshToken"];
17
17
  for (const method of grpcMethods) {
18
18
  const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
19
19
  (0, microservices_1.GrpcMethod)("AuthService", method)(constructor.prototype[method], method, descriptor);
@@ -1,13 +1,4 @@
1
- // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
- // versions:
3
- // protoc-gen-ts_proto v2.11.6
4
- // protoc v3.21.12
5
- // source: google/protobuf/empty.proto
6
-
7
- /* eslint-disable */
8
-
9
- export const protobufPackage = "google.protobuf";
10
-
1
+ export declare const protobufPackage = "google.protobuf";
11
2
  /**
12
3
  * A generic empty message that you can re-use to avoid defining duplicated
13
4
  * empty messages in your APIs. A typical example is to use it as the request
@@ -19,5 +10,4 @@ export const protobufPackage = "google.protobuf";
19
10
  */
20
11
  export interface Empty {
21
12
  }
22
-
23
- export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
13
+ export declare const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.11.6
5
+ // protoc v3.21.12
6
+ // source: google/protobuf/empty.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.GOOGLE_PROTOBUF_PACKAGE_NAME = exports.protobufPackage = void 0;
9
+ /* eslint-disable */
10
+ exports.protobufPackage = "google.protobuf";
11
+ exports.GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
@@ -0,0 +1,213 @@
1
+ export declare const protobufPackage = "google.protobuf";
2
+ /**
3
+ * `FieldMask` represents a set of symbolic field paths, for example:
4
+ *
5
+ * paths: "f.a"
6
+ * paths: "f.b.d"
7
+ *
8
+ * Here `f` represents a field in some root message, `a` and `b`
9
+ * fields in the message found in `f`, and `d` a field found in the
10
+ * message in `f.b`.
11
+ *
12
+ * Field masks are used to specify a subset of fields that should be
13
+ * returned by a get operation or modified by an update operation.
14
+ * Field masks also have a custom JSON encoding (see below).
15
+ *
16
+ * # Field Masks in Projections
17
+ *
18
+ * When used in the context of a projection, a response message or
19
+ * sub-message is filtered by the API to only contain those fields as
20
+ * specified in the mask. For example, if the mask in the previous
21
+ * example is applied to a response message as follows:
22
+ *
23
+ * f {
24
+ * a : 22
25
+ * b {
26
+ * d : 1
27
+ * x : 2
28
+ * }
29
+ * y : 13
30
+ * }
31
+ * z: 8
32
+ *
33
+ * The result will not contain specific values for fields x,y and z
34
+ * (their value will be set to the default, and omitted in proto text
35
+ * output):
36
+ *
37
+ * f {
38
+ * a : 22
39
+ * b {
40
+ * d : 1
41
+ * }
42
+ * }
43
+ *
44
+ * A repeated field is not allowed except at the last position of a
45
+ * paths string.
46
+ *
47
+ * If a FieldMask object is not present in a get operation, the
48
+ * operation applies to all fields (as if a FieldMask of all fields
49
+ * had been specified).
50
+ *
51
+ * Note that a field mask does not necessarily apply to the
52
+ * top-level response message. In case of a REST get operation, the
53
+ * field mask applies directly to the response, but in case of a REST
54
+ * list operation, the mask instead applies to each individual message
55
+ * in the returned resource list. In case of a REST custom method,
56
+ * other definitions may be used. Where the mask applies will be
57
+ * clearly documented together with its declaration in the API. In
58
+ * any case, the effect on the returned resource/resources is required
59
+ * behavior for APIs.
60
+ *
61
+ * # Field Masks in Update Operations
62
+ *
63
+ * A field mask in update operations specifies which fields of the
64
+ * targeted resource are going to be updated. The API is required
65
+ * to only change the values of the fields as specified in the mask
66
+ * and leave the others untouched. If a resource is passed in to
67
+ * describe the updated values, the API ignores the values of all
68
+ * fields not covered by the mask.
69
+ *
70
+ * If a repeated field is specified for an update operation, new values will
71
+ * be appended to the existing repeated field in the target resource. Note that
72
+ * a repeated field is only allowed in the last position of a `paths` string.
73
+ *
74
+ * If a sub-message is specified in the last position of the field mask for an
75
+ * update operation, then new value will be merged into the existing sub-message
76
+ * in the target resource.
77
+ *
78
+ * For example, given the target message:
79
+ *
80
+ * f {
81
+ * b {
82
+ * d: 1
83
+ * x: 2
84
+ * }
85
+ * c: [1]
86
+ * }
87
+ *
88
+ * And an update message:
89
+ *
90
+ * f {
91
+ * b {
92
+ * d: 10
93
+ * }
94
+ * c: [2]
95
+ * }
96
+ *
97
+ * then if the field mask is:
98
+ *
99
+ * paths: ["f.b", "f.c"]
100
+ *
101
+ * then the result will be:
102
+ *
103
+ * f {
104
+ * b {
105
+ * d: 10
106
+ * x: 2
107
+ * }
108
+ * c: [1, 2]
109
+ * }
110
+ *
111
+ * An implementation may provide options to override this default behavior for
112
+ * repeated and message fields.
113
+ *
114
+ * In order to reset a field's value to the default, the field must
115
+ * be in the mask and set to the default value in the provided resource.
116
+ * Hence, in order to reset all fields of a resource, provide a default
117
+ * instance of the resource and set all fields in the mask, or do
118
+ * not provide a mask as described below.
119
+ *
120
+ * If a field mask is not present on update, the operation applies to
121
+ * all fields (as if a field mask of all fields has been specified).
122
+ * Note that in the presence of schema evolution, this may mean that
123
+ * fields the client does not know and has therefore not filled into
124
+ * the request will be reset to their default. If this is unwanted
125
+ * behavior, a specific service may require a client to always specify
126
+ * a field mask, producing an error if not.
127
+ *
128
+ * As with get operations, the location of the resource which
129
+ * describes the updated values in the request message depends on the
130
+ * operation kind. In any case, the effect of the field mask is
131
+ * required to be honored by the API.
132
+ *
133
+ * ## Considerations for HTTP REST
134
+ *
135
+ * The HTTP kind of an update operation which uses a field mask must
136
+ * be set to PATCH instead of PUT in order to satisfy HTTP semantics
137
+ * (PUT must only be used for full updates).
138
+ *
139
+ * # JSON Encoding of Field Masks
140
+ *
141
+ * In JSON, a field mask is encoded as a single string where paths are
142
+ * separated by a comma. Fields name in each path are converted
143
+ * to/from lower-camel naming conventions.
144
+ *
145
+ * As an example, consider the following message declarations:
146
+ *
147
+ * message Profile {
148
+ * User user = 1;
149
+ * Photo photo = 2;
150
+ * }
151
+ * message User {
152
+ * string display_name = 1;
153
+ * string address = 2;
154
+ * }
155
+ *
156
+ * In proto a field mask for `Profile` may look as such:
157
+ *
158
+ * mask {
159
+ * paths: "user.display_name"
160
+ * paths: "photo"
161
+ * }
162
+ *
163
+ * In JSON, the same mask is represented as below:
164
+ *
165
+ * {
166
+ * mask: "user.displayName,photo"
167
+ * }
168
+ *
169
+ * # Field Masks and Oneof Fields
170
+ *
171
+ * Field masks treat fields in oneofs just as regular fields. Consider the
172
+ * following message:
173
+ *
174
+ * message SampleMessage {
175
+ * oneof test_oneof {
176
+ * string name = 4;
177
+ * SubMessage sub_message = 9;
178
+ * }
179
+ * }
180
+ *
181
+ * The field mask can be:
182
+ *
183
+ * mask {
184
+ * paths: "name"
185
+ * }
186
+ *
187
+ * Or:
188
+ *
189
+ * mask {
190
+ * paths: "sub_message"
191
+ * }
192
+ *
193
+ * Note that oneof type names ("test_oneof" in this case) cannot be used in
194
+ * paths.
195
+ *
196
+ * ## Field Mask Verification
197
+ *
198
+ * The implementation of any API method which has a FieldMask type field in the
199
+ * request should verify the included field paths, and return an
200
+ * `INVALID_ARGUMENT` error if any path is unmappable.
201
+ */
202
+ export interface FieldMask {
203
+ /** The set of field mask paths. */
204
+ paths: string[];
205
+ }
206
+ export declare const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
207
+ export declare const FieldMask: MessageFns<FieldMask> & FieldMaskWrapperFns;
208
+ export interface MessageFns<T> {
209
+ }
210
+ export interface FieldMaskWrapperFns {
211
+ wrap(paths: string[]): FieldMask;
212
+ unwrap(message: FieldMask): string[];
213
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.11.6
5
+ // protoc v3.21.12
6
+ // source: google/protobuf/field_mask.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.FieldMask = exports.GOOGLE_PROTOBUF_PACKAGE_NAME = exports.protobufPackage = void 0;
9
+ /* eslint-disable */
10
+ exports.protobufPackage = "google.protobuf";
11
+ exports.GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
12
+ function createBaseFieldMask() {
13
+ return { paths: [] };
14
+ }
15
+ exports.FieldMask = {
16
+ wrap(paths) {
17
+ const result = createBaseFieldMask();
18
+ result.paths = paths;
19
+ return result;
20
+ },
21
+ unwrap(message) {
22
+ return message.paths;
23
+ },
24
+ };
@@ -0,0 +1,43 @@
1
+ import { Observable } from "rxjs";
2
+ export declare const protobufPackage = "user.v1";
3
+ export interface GetMeRequest {
4
+ id: string;
5
+ }
6
+ export interface GetMeResponse {
7
+ user: User | undefined;
8
+ }
9
+ export interface CreateUserRequest {
10
+ id: string;
11
+ }
12
+ export interface CreateUserResponse {
13
+ ok: boolean;
14
+ }
15
+ export interface PatchUserRequest {
16
+ user: User | undefined;
17
+ updateMask: string[] | undefined;
18
+ }
19
+ export interface PatchUserResponse {
20
+ ok: boolean;
21
+ }
22
+ export interface User {
23
+ id: string;
24
+ displayName?: string | undefined;
25
+ bio?: string | undefined;
26
+ email: string;
27
+ successRate?: number | undefined;
28
+ loseAmount?: number | undefined;
29
+ avatar?: string | undefined;
30
+ }
31
+ export declare const USER_V1_PACKAGE_NAME = "user.v1";
32
+ export interface UserServiceClient {
33
+ getMe(request: GetMeRequest): Observable<GetMeResponse>;
34
+ createUser(request: CreateUserRequest): Observable<CreateUserResponse>;
35
+ patchUser(request: PatchUserRequest): Observable<PatchUserResponse>;
36
+ }
37
+ export interface UserServiceController {
38
+ getMe(request: GetMeRequest): Promise<GetMeResponse> | Observable<GetMeResponse> | GetMeResponse;
39
+ createUser(request: CreateUserRequest): Promise<CreateUserResponse> | Observable<CreateUserResponse> | CreateUserResponse;
40
+ patchUser(request: PatchUserRequest): Promise<PatchUserResponse> | Observable<PatchUserResponse> | PatchUserResponse;
41
+ }
42
+ export declare function UserServiceControllerMethods(): (constructor: Function) => void;
43
+ export declare const USER_SERVICE_NAME = "UserService";
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.11.6
5
+ // protoc v3.21.12
6
+ // source: user.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.USER_SERVICE_NAME = exports.USER_V1_PACKAGE_NAME = exports.protobufPackage = void 0;
9
+ exports.UserServiceControllerMethods = UserServiceControllerMethods;
10
+ /* eslint-disable */
11
+ const microservices_1 = require("@nestjs/microservices");
12
+ exports.protobufPackage = "user.v1";
13
+ exports.USER_V1_PACKAGE_NAME = "user.v1";
14
+ function UserServiceControllerMethods() {
15
+ return function (constructor) {
16
+ const grpcMethods = ["getMe", "createUser", "patchUser"];
17
+ for (const method of grpcMethods) {
18
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
19
+ (0, microservices_1.GrpcMethod)("UserService", method)(constructor.prototype[method], method, descriptor);
20
+ }
21
+ const grpcStreamMethods = [];
22
+ for (const method of grpcStreamMethods) {
23
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
24
+ (0, microservices_1.GrpcStreamMethod)("UserService", method)(constructor.prototype[method], method, descriptor);
25
+ }
26
+ };
27
+ }
28
+ exports.USER_SERVICE_NAME = "UserService";
package/package.json CHANGED
@@ -1,16 +1,14 @@
1
1
  {
2
2
  "name": "@ciganov/contracts",
3
- "version": "1.0.4",
3
+ "version": "1.1.0",
4
4
  "description": "Protobuf definitions and generated ts types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "scripts": {
8
- "generate": "mkdir -p ./gen && protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit",
8
+ "generate": "mkdir -p ./lib/gen && protoc -I ./proto ./proto/*.proto --ts_proto_out=./lib/gen --ts_proto_opt=nestJs=true,package=omit",
9
9
  "build": "tsc -p tsconfig.build.json"
10
10
  },
11
11
  "files": [
12
- "proto",
13
- "gen",
14
12
  "dist"
15
13
  ],
16
14
  "publishConfig": {
@@ -1 +0,0 @@
1
- export * from './auth';
package/dist/gen/index.js DELETED
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./auth"), exports);
package/gen/account.ts DELETED
@@ -1,87 +0,0 @@
1
- // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
- // versions:
3
- // protoc-gen-ts_proto v2.11.6
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
- email: string;
26
- role: Role;
27
- }
28
-
29
- export interface InitEmailChangeRequest {
30
- email: string;
31
- userId: string;
32
- }
33
-
34
- export interface InitEmailChangeResponse {
35
- ok: boolean;
36
- }
37
-
38
- export interface ConfirmEmailChangeRequest {
39
- email: string;
40
- code: string;
41
- userId: string;
42
- }
43
-
44
- export interface ConfirmEmailChangeResponse {
45
- ok: boolean;
46
- }
47
-
48
- export const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
49
-
50
- export interface AccountServiceClient {
51
- getAccount(request: GetAccountRequest): Observable<GetAccountResponse>;
52
-
53
- initEmailChange(request: InitEmailChangeRequest): Observable<InitEmailChangeResponse>;
54
-
55
- confirmEmailChange(request: ConfirmEmailChangeRequest): Observable<ConfirmEmailChangeResponse>;
56
- }
57
-
58
- export interface AccountServiceController {
59
- getAccount(
60
- request: GetAccountRequest,
61
- ): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
62
-
63
- initEmailChange(
64
- request: InitEmailChangeRequest,
65
- ): Promise<InitEmailChangeResponse> | Observable<InitEmailChangeResponse> | InitEmailChangeResponse;
66
-
67
- confirmEmailChange(
68
- request: ConfirmEmailChangeRequest,
69
- ): Promise<ConfirmEmailChangeResponse> | Observable<ConfirmEmailChangeResponse> | ConfirmEmailChangeResponse;
70
- }
71
-
72
- export function AccountServiceControllerMethods() {
73
- return function (constructor: Function) {
74
- const grpcMethods: string[] = ["getAccount", "initEmailChange", "confirmEmailChange"];
75
- for (const method of grpcMethods) {
76
- const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
77
- GrpcMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
78
- }
79
- const grpcStreamMethods: string[] = [];
80
- for (const method of grpcStreamMethods) {
81
- const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
82
- GrpcStreamMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
83
- }
84
- };
85
- }
86
-
87
- export const ACCOUNT_SERVICE_NAME = "AccountService";
package/gen/auth.ts DELETED
@@ -1,88 +0,0 @@
1
- // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
- // versions:
3
- // protoc-gen-ts_proto v2.11.6
4
- // protoc v3.21.12
5
- // source: auth.proto
6
-
7
- /* eslint-disable */
8
- import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
- import { Observable } from "rxjs";
10
- import { Empty } from "./google/protobuf/empty";
11
-
12
- export const protobufPackage = "auth.v1";
13
-
14
- export interface SendOtpRequest {
15
- identifier: string;
16
- }
17
-
18
- export interface SendOtpResponse {
19
- ok: boolean;
20
- }
21
-
22
- export interface VerifyOtpRequest {
23
- identifier: string;
24
- code: string;
25
- }
26
-
27
- export interface VerifyOtpResponse {
28
- token: string;
29
- }
30
-
31
- export interface GetSessionByTokenRequest {
32
- token: string;
33
- }
34
-
35
- export interface GetSessionByTokenResponse {
36
- session?: Session | undefined;
37
- }
38
-
39
- export interface Session {
40
- id: string;
41
- token: string;
42
- userId: string;
43
- }
44
-
45
- export interface RefreshTokenRequest {
46
- token: string;
47
- }
48
-
49
- export const AUTH_V1_PACKAGE_NAME = "auth.v1";
50
-
51
- export interface AuthServiceClient {
52
- sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
53
-
54
- verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
55
-
56
- getSessionByToken(request: GetSessionByTokenRequest): Observable<GetSessionByTokenResponse>;
57
-
58
- refreshToken(request: RefreshTokenRequest): Observable<Empty>;
59
- }
60
-
61
- export interface AuthServiceController {
62
- sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
63
-
64
- verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
65
-
66
- getSessionByToken(
67
- request: GetSessionByTokenRequest,
68
- ): Promise<GetSessionByTokenResponse> | Observable<GetSessionByTokenResponse> | GetSessionByTokenResponse;
69
-
70
- refreshToken(request: RefreshTokenRequest): void | Promise<void>;
71
- }
72
-
73
- export function AuthServiceControllerMethods() {
74
- return function (constructor: Function) {
75
- const grpcMethods: string[] = ["sendOtp", "verifyOtp", "getSessionByToken", "refreshToken"];
76
- for (const method of grpcMethods) {
77
- const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
78
- GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
79
- }
80
- const grpcStreamMethods: string[] = [];
81
- for (const method of grpcStreamMethods) {
82
- const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
83
- GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
84
- }
85
- };
86
- }
87
-
88
- export const AUTH_SERVICE_NAME = "AuthService";
package/gen/user.ts DELETED
@@ -1,81 +0,0 @@
1
- // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
- // versions:
3
- // protoc-gen-ts_proto v2.11.6
4
- // protoc v3.21.12
5
- // source: user.proto
6
-
7
- /* eslint-disable */
8
- import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
- import { Observable } from "rxjs";
10
-
11
- export const protobufPackage = "user.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
- user: User | undefined;
31
- }
32
-
33
- export interface PatchUserResponse {
34
- ok: boolean;
35
- }
36
-
37
- export interface User {
38
- id: string;
39
- displayName?: string | undefined;
40
- bio?: string | undefined;
41
- successRate?: number | undefined;
42
- loseAmount?: number | undefined;
43
- avatar?: string | undefined;
44
- }
45
-
46
- export const USER_V1_PACKAGE_NAME = "user.v1";
47
-
48
- export interface UserServiceClient {
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 UserServiceController {
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 UserServiceControllerMethods() {
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("UserService", 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("UserService", method)(constructor.prototype[method], method, descriptor);
77
- }
78
- };
79
- }
80
-
81
- export const USER_SERVICE_NAME = "UserService";
@@ -1,45 +0,0 @@
1
- syntax = "proto3";
2
-
3
- package account.v1;
4
-
5
-
6
- service AccountService {
7
- rpc GetAccount(GetAccountRequest) returns (GetAccountResponse);
8
- rpc InitEmailChange(InitEmailChangeRequest) returns (InitEmailChangeResponse);
9
- rpc ConfirmEmailChange(ConfirmEmailChangeRequest) returns (ConfirmEmailChangeResponse);
10
- }
11
-
12
- message GetAccountRequest {
13
- string id = 1;
14
- }
15
-
16
- message GetAccountResponse {
17
- string id = 1;
18
- string email = 2;
19
- Role role = 3;
20
- }
21
-
22
- message InitEmailChangeRequest {
23
- string email = 1;
24
- string user_id = 2;
25
- }
26
-
27
- message InitEmailChangeResponse {
28
- bool ok = 1;
29
- }
30
-
31
- message ConfirmEmailChangeRequest {
32
- string email = 1;
33
- string code = 2;
34
- string user_id = 3;
35
- }
36
-
37
- message ConfirmEmailChangeResponse {
38
- bool ok = 1;
39
- }
40
-
41
-
42
- enum Role {
43
- USER = 0;
44
- ADMIN = 1;
45
- }
package/proto/auth.proto DELETED
@@ -1,48 +0,0 @@
1
- syntax = "proto3";
2
-
3
- package auth.v1;
4
-
5
- import "google/protobuf/empty.proto";
6
-
7
- service AuthService {
8
- rpc SendOtp(SendOtpRequest) returns (SendOtpResponse);
9
- rpc VerifyOtp(VerifyOtpRequest) returns (VerifyOtpResponse);
10
-
11
- rpc GetSessionByToken(GetSessionByTokenRequest) returns(GetSessionByTokenResponse);
12
- rpc RefreshToken(RefreshTokenRequest) returns (google.protobuf.Empty);
13
- }
14
-
15
- message SendOtpRequest {
16
- string identifier = 1;
17
- }
18
-
19
- message SendOtpResponse {
20
- bool ok = 1;
21
- }
22
-
23
- message VerifyOtpRequest {
24
- string identifier = 1;
25
- string code = 2;
26
- }
27
-
28
- message VerifyOtpResponse {
29
- string token = 1;
30
- }
31
-
32
- message GetSessionByTokenRequest {
33
- string token = 1;
34
- }
35
-
36
- message GetSessionByTokenResponse {
37
- optional Session session = 1;
38
- }
39
-
40
- message Session {
41
- string id = 1;
42
- string token = 2;
43
- string user_id = 3;
44
- }
45
-
46
- message RefreshTokenRequest {
47
- string token = 1;
48
- }
package/proto/user.proto DELETED
@@ -1,44 +0,0 @@
1
- syntax = "proto3";
2
-
3
- package user.v1;
4
-
5
- service UserService {
6
- rpc GetMe(GetMeRequest) returns (GetMeResponse);
7
-
8
- rpc CreateUser(CreateUserRequest) returns (CreateUserResponse);
9
-
10
- rpc PatchUser(PatchUserRequest) returns (PatchUserResponse);
11
- }
12
-
13
- message GetMeRequest {
14
- string id = 1;
15
- }
16
-
17
- message GetMeResponse {
18
- User user = 1;
19
- }
20
-
21
- message CreateUserRequest {
22
- string id = 1;
23
- }
24
-
25
- message CreateUserResponse {
26
- bool ok = 1;
27
- }
28
-
29
- message PatchUserRequest {
30
- User user = 1;
31
- }
32
-
33
- message PatchUserResponse {
34
- bool ok = 1;
35
- }
36
-
37
- message User {
38
- string id = 1;
39
- optional string display_name = 2;
40
- optional string bio = 3;
41
- optional int32 success_rate = 4;
42
- optional int32 lose_amount = 5;
43
- optional string avatar = 6;
44
- }