@ciganov/contracts 1.0.5 → 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.
- package/dist/gen/account.d.ts +43 -0
- package/dist/gen/account.js +34 -0
- package/dist/gen/auth.d.ts +19 -0
- package/dist/gen/auth.js +3 -3
- package/{gen/google/protobuf/empty.ts → dist/gen/google/protobuf/empty.d.ts} +2 -12
- package/dist/gen/google/protobuf/empty.js +11 -0
- package/{gen/google/protobuf/field_mask.ts → dist/gen/google/protobuf/field_mask.d.ts} +7 -34
- package/dist/gen/google/protobuf/field_mask.js +24 -0
- package/dist/gen/user.d.ts +43 -0
- package/dist/gen/user.js +28 -0
- package/package.json +2 -4
- package/dist/gen/index.d.ts +0 -1
- package/dist/gen/index.js +0 -17
- package/gen/account.ts +0 -87
- package/gen/auth.ts +0 -88
- package/gen/user.ts +0 -83
- package/proto/account.proto +0 -45
- package/proto/auth.proto +0 -48
- package/proto/user.proto +0 -48
|
@@ -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";
|
package/dist/gen/auth.d.ts
CHANGED
|
@@ -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.
|
|
5
|
-
// protoc
|
|
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
|
-
|
|
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";
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
// versions:
|
|
3
|
-
// protoc-gen-ts_proto v2.11.6
|
|
4
|
-
// protoc v3.21.12
|
|
5
|
-
// source: google/protobuf/field_mask.proto
|
|
6
|
-
|
|
7
|
-
/* eslint-disable */
|
|
8
|
-
|
|
9
|
-
export const protobufPackage = "google.protobuf";
|
|
10
|
-
|
|
1
|
+
export declare const protobufPackage = "google.protobuf";
|
|
11
2
|
/**
|
|
12
3
|
* `FieldMask` represents a set of symbolic field paths, for example:
|
|
13
4
|
*
|
|
@@ -209,32 +200,14 @@ export const protobufPackage = "google.protobuf";
|
|
|
209
200
|
* `INVALID_ARGUMENT` error if any path is unmappable.
|
|
210
201
|
*/
|
|
211
202
|
export interface FieldMask {
|
|
212
|
-
|
|
213
|
-
|
|
203
|
+
/** The set of field mask paths. */
|
|
204
|
+
paths: string[];
|
|
214
205
|
}
|
|
215
|
-
|
|
216
|
-
export const
|
|
217
|
-
|
|
218
|
-
function createBaseFieldMask(): FieldMask {
|
|
219
|
-
return { paths: [] };
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
export const FieldMask: MessageFns<FieldMask> & FieldMaskWrapperFns = {
|
|
223
|
-
wrap(paths: string[]): FieldMask {
|
|
224
|
-
const result = createBaseFieldMask();
|
|
225
|
-
result.paths = paths;
|
|
226
|
-
return result;
|
|
227
|
-
},
|
|
228
|
-
|
|
229
|
-
unwrap(message: FieldMask): string[] {
|
|
230
|
-
return message.paths;
|
|
231
|
-
},
|
|
232
|
-
};
|
|
233
|
-
|
|
206
|
+
export declare const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
|
|
207
|
+
export declare const FieldMask: MessageFns<FieldMask> & FieldMaskWrapperFns;
|
|
234
208
|
export interface MessageFns<T> {
|
|
235
209
|
}
|
|
236
|
-
|
|
237
210
|
export interface FieldMaskWrapperFns {
|
|
238
|
-
|
|
239
|
-
|
|
211
|
+
wrap(paths: string[]): FieldMask;
|
|
212
|
+
unwrap(message: FieldMask): string[];
|
|
240
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";
|
package/dist/gen/user.js
ADDED
|
@@ -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
|
|
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": {
|
package/dist/gen/index.d.ts
DELETED
|
@@ -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,83 +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
|
-
updateMask: string[] | undefined;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface PatchUserResponse {
|
|
35
|
-
ok: boolean;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface User {
|
|
39
|
-
id: string;
|
|
40
|
-
displayName?: string | undefined;
|
|
41
|
-
bio?: string | undefined;
|
|
42
|
-
email: string;
|
|
43
|
-
successRate?: number | undefined;
|
|
44
|
-
loseAmount?: number | undefined;
|
|
45
|
-
avatar?: string | undefined;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export const USER_V1_PACKAGE_NAME = "user.v1";
|
|
49
|
-
|
|
50
|
-
export interface UserServiceClient {
|
|
51
|
-
getMe(request: GetMeRequest): Observable<GetMeResponse>;
|
|
52
|
-
|
|
53
|
-
createUser(request: CreateUserRequest): Observable<CreateUserResponse>;
|
|
54
|
-
|
|
55
|
-
patchUser(request: PatchUserRequest): Observable<PatchUserResponse>;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface UserServiceController {
|
|
59
|
-
getMe(request: GetMeRequest): Promise<GetMeResponse> | Observable<GetMeResponse> | GetMeResponse;
|
|
60
|
-
|
|
61
|
-
createUser(
|
|
62
|
-
request: CreateUserRequest,
|
|
63
|
-
): Promise<CreateUserResponse> | Observable<CreateUserResponse> | CreateUserResponse;
|
|
64
|
-
|
|
65
|
-
patchUser(request: PatchUserRequest): Promise<PatchUserResponse> | Observable<PatchUserResponse> | PatchUserResponse;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export function UserServiceControllerMethods() {
|
|
69
|
-
return function (constructor: Function) {
|
|
70
|
-
const grpcMethods: string[] = ["getMe", "createUser", "patchUser"];
|
|
71
|
-
for (const method of grpcMethods) {
|
|
72
|
-
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
73
|
-
GrpcMethod("UserService", method)(constructor.prototype[method], method, descriptor);
|
|
74
|
-
}
|
|
75
|
-
const grpcStreamMethods: string[] = [];
|
|
76
|
-
for (const method of grpcStreamMethods) {
|
|
77
|
-
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
78
|
-
GrpcStreamMethod("UserService", method)(constructor.prototype[method], method, descriptor);
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export const USER_SERVICE_NAME = "UserService";
|
package/proto/account.proto
DELETED
|
@@ -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,48 +0,0 @@
|
|
|
1
|
-
syntax = "proto3";
|
|
2
|
-
|
|
3
|
-
package user.v1;
|
|
4
|
-
|
|
5
|
-
import "google/protobuf/field_mask.proto";
|
|
6
|
-
|
|
7
|
-
service UserService {
|
|
8
|
-
rpc GetMe(GetMeRequest) returns (GetMeResponse);
|
|
9
|
-
|
|
10
|
-
rpc CreateUser(CreateUserRequest) returns (CreateUserResponse);
|
|
11
|
-
|
|
12
|
-
rpc PatchUser(PatchUserRequest) returns (PatchUserResponse);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
message GetMeRequest {
|
|
16
|
-
string id = 1;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
message GetMeResponse {
|
|
20
|
-
User user = 1;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
message CreateUserRequest {
|
|
24
|
-
string id = 1;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
message CreateUserResponse {
|
|
28
|
-
bool ok = 1;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
message PatchUserRequest {
|
|
32
|
-
User user = 1;
|
|
33
|
-
google.protobuf.FieldMask update_mask = 2;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
message PatchUserResponse {
|
|
37
|
-
bool ok = 1;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
message User {
|
|
41
|
-
string id = 1;
|
|
42
|
-
optional string display_name = 2;
|
|
43
|
-
optional string bio = 3;
|
|
44
|
-
string email = 4;
|
|
45
|
-
optional int32 success_rate = 5;
|
|
46
|
-
optional int32 lose_amount = 6;
|
|
47
|
-
optional string avatar = 7;
|
|
48
|
-
}
|