@usteam/contracts 1.0.3 → 1.0.5
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/proto/paths.d.ts +1 -0
- package/dist/proto/paths.js +2 -1
- package/gen/account.ts +75 -0
- package/gen/auth.ts +25 -2
- package/package.json +1 -1
- package/proto/account.proto +31 -0
- package/proto/auth.proto +12 -0
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
|
@@ -3,5 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PROTO_PATHS = void 0;
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
exports.PROTO_PATHS = {
|
|
6
|
-
AUTH: (0, path_1.join)(__dirname, '../../proto/auth.proto')
|
|
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,75 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.10.1
|
|
4
|
+
// protoc v6.33.5
|
|
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
|
+
EDITOR = 2,
|
|
17
|
+
CASHIER = 3,
|
|
18
|
+
UNRECOGNIZED = -1,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface GetAccountRequest {
|
|
22
|
+
id: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface GetAccountResponse {
|
|
26
|
+
id: string;
|
|
27
|
+
phone: string;
|
|
28
|
+
email: string;
|
|
29
|
+
isPhoneVerified: boolean;
|
|
30
|
+
isEmailVerified: boolean;
|
|
31
|
+
role: Role;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
|
|
35
|
+
|
|
36
|
+
/** AccountService отвечает за операции с аккаунтом. */
|
|
37
|
+
|
|
38
|
+
export interface AccountServiceClient {
|
|
39
|
+
/**
|
|
40
|
+
* GetAccount отправляет id аккаунта
|
|
41
|
+
* получает данные об аккаунте
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
getAccount(request: GetAccountRequest): Observable<GetAccountResponse>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** AccountService отвечает за операции с аккаунтом. */
|
|
48
|
+
|
|
49
|
+
export interface AccountServiceController {
|
|
50
|
+
/**
|
|
51
|
+
* GetAccount отправляет id аккаунта
|
|
52
|
+
* получает данные об аккаунте
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
getAccount(
|
|
56
|
+
request: GetAccountRequest,
|
|
57
|
+
): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function AccountServiceControllerMethods() {
|
|
61
|
+
return function (constructor: Function) {
|
|
62
|
+
const grpcMethods: string[] = ["getAccount"];
|
|
63
|
+
for (const method of grpcMethods) {
|
|
64
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
65
|
+
GrpcMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
|
|
66
|
+
}
|
|
67
|
+
const grpcStreamMethods: string[] = [];
|
|
68
|
+
for (const method of grpcStreamMethods) {
|
|
69
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
70
|
+
GrpcStreamMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export const ACCOUNT_SERVICE_NAME = "AccountService";
|
package/gen/auth.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
2
|
// versions:
|
|
3
3
|
// protoc-gen-ts_proto v2.10.1
|
|
4
|
-
// protoc v6.33.
|
|
4
|
+
// protoc v6.33.5
|
|
5
5
|
// source: auth.proto
|
|
6
6
|
|
|
7
7
|
/* eslint-disable */
|
|
@@ -39,6 +39,15 @@ export interface VerifyOtpResponse {
|
|
|
39
39
|
refreshToken: string;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
export interface RefreshRequest {
|
|
43
|
+
refreshToken: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface RefreshResponse {
|
|
47
|
+
accessToken: string;
|
|
48
|
+
refreshToken: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
42
51
|
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
43
52
|
|
|
44
53
|
/**
|
|
@@ -60,6 +69,13 @@ export interface AuthServiceClient {
|
|
|
60
69
|
*/
|
|
61
70
|
|
|
62
71
|
verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Refresh обновляет токен.
|
|
75
|
+
* отправляет токены.
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
refresh(request: RefreshRequest): Observable<RefreshResponse>;
|
|
63
79
|
}
|
|
64
80
|
|
|
65
81
|
/**
|
|
@@ -81,11 +97,18 @@ export interface AuthServiceController {
|
|
|
81
97
|
*/
|
|
82
98
|
|
|
83
99
|
verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Refresh обновляет токен.
|
|
103
|
+
* отправляет токены.
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
|
|
84
107
|
}
|
|
85
108
|
|
|
86
109
|
export function AuthServiceControllerMethods() {
|
|
87
110
|
return function (constructor: Function) {
|
|
88
|
-
const grpcMethods: string[] = ["sendOtp", "verifyOtp"];
|
|
111
|
+
const grpcMethods: string[] = ["sendOtp", "verifyOtp", "refresh"];
|
|
89
112
|
for (const method of grpcMethods) {
|
|
90
113
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
91
114
|
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
package/package.json
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package account.v1;
|
|
4
|
+
|
|
5
|
+
// AccountService отвечает за операции с аккаунтом.
|
|
6
|
+
service AccountService {
|
|
7
|
+
// GetAccount отправляет id аккаунта
|
|
8
|
+
// получает данные об аккаунте
|
|
9
|
+
rpc GetAccount (GetAccountRequest) returns (GetAccountResponse);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
message GetAccountRequest {
|
|
13
|
+
string id = 1;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
message GetAccountResponse {
|
|
17
|
+
string id = 1;
|
|
18
|
+
string phone = 2;
|
|
19
|
+
string email = 3;
|
|
20
|
+
bool is_phone_verified = 4;
|
|
21
|
+
bool is_email_verified = 5;
|
|
22
|
+
Role role = 6;
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
enum Role {
|
|
27
|
+
USER = 0;
|
|
28
|
+
ADMIN = 1;
|
|
29
|
+
EDITOR = 2;
|
|
30
|
+
CASHIER = 3;
|
|
31
|
+
}
|
package/proto/auth.proto
CHANGED
|
@@ -11,6 +11,9 @@ service AuthService {
|
|
|
11
11
|
// VerifyOtp веривицирует одноразовый пароль.
|
|
12
12
|
// отправляет токены.
|
|
13
13
|
rpc VerifyOtp (VerifyOtpRequest) returns (VerifyOtpResponse);
|
|
14
|
+
// Refresh обновляет токен.
|
|
15
|
+
// отправляет токены.
|
|
16
|
+
rpc Refresh (RefreshRequest) returns (RefreshResponse);
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
// Запрос на отправку OTP.
|
|
@@ -38,4 +41,13 @@ message VerifyOtpRequest {
|
|
|
38
41
|
message VerifyOtpResponse {
|
|
39
42
|
string access_token = 1;
|
|
40
43
|
string refresh_token = 2;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
message RefreshRequest {
|
|
47
|
+
string refresh_token = 1;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
message RefreshResponse {
|
|
51
|
+
string access_token = 1;
|
|
52
|
+
string refresh_token = 2;
|
|
41
53
|
}
|