@seatwave/contracts 1.0.4 → 1.0.6
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 +69 -21
- package/gen/auth.ts +31 -58
- package/gen/google/protobuf/empty.ts +23 -0
- package/package.json +1 -1
- package/proto/account.proto +45 -23
- package/proto/auth.proto +26 -37
package/gen/account.ts
CHANGED
|
@@ -10,60 +10,108 @@ import { Observable } from "rxjs";
|
|
|
10
10
|
|
|
11
11
|
export const protobufPackage = "account.v1";
|
|
12
12
|
|
|
13
|
-
/** Role represents the authorization level of the account. */
|
|
14
13
|
export enum Role {
|
|
15
|
-
/** USER - Default user role with standard permissions. */
|
|
16
14
|
USER = 0,
|
|
17
|
-
/** ADMIN - Administrator role with elevated permissions. */
|
|
18
15
|
ADMIN = 1,
|
|
19
16
|
UNRECOGNIZED = -1,
|
|
20
17
|
}
|
|
21
18
|
|
|
22
|
-
/** Request message for retrieving an account. */
|
|
23
19
|
export interface GetAccountRequest {
|
|
24
|
-
/** Unique account identifier (UUID). */
|
|
25
20
|
id: string;
|
|
26
21
|
}
|
|
27
22
|
|
|
28
|
-
/** Response message containing account details. */
|
|
29
23
|
export interface GetAccountResponse {
|
|
30
|
-
/** Unique account identifier. */
|
|
31
24
|
id: string;
|
|
32
|
-
/** Phone number associated with the account (E.164 format). */
|
|
33
25
|
phone: string;
|
|
34
|
-
/** Email address associated with the account. */
|
|
35
26
|
email: string;
|
|
36
|
-
/** Indicates whether the phone number has been verified. */
|
|
37
27
|
isPhoneVerified: boolean;
|
|
38
|
-
/** Indicates whether the email address has been verified. */
|
|
39
28
|
isEmailVerified: boolean;
|
|
40
|
-
/** Role assigned to the account. */
|
|
41
29
|
role: Role;
|
|
42
30
|
}
|
|
43
31
|
|
|
44
|
-
export
|
|
32
|
+
export interface InitEmailChangeRequest {
|
|
33
|
+
email: string;
|
|
34
|
+
userId: string;
|
|
35
|
+
}
|
|
45
36
|
|
|
46
|
-
|
|
37
|
+
export interface InitEmailChangeResponse {
|
|
38
|
+
ok: boolean;
|
|
39
|
+
}
|
|
47
40
|
|
|
48
|
-
export interface
|
|
49
|
-
|
|
41
|
+
export interface ConfirmEmailChangeRequest {
|
|
42
|
+
email: string;
|
|
43
|
+
code: string;
|
|
44
|
+
userId: string;
|
|
45
|
+
}
|
|
50
46
|
|
|
51
|
-
|
|
47
|
+
export interface ConfirmEmailChangeResponse {
|
|
48
|
+
ok: boolean;
|
|
52
49
|
}
|
|
53
50
|
|
|
54
|
-
|
|
51
|
+
export interface InitPhoneChangeRequest {
|
|
52
|
+
phone: string;
|
|
53
|
+
userId: string;
|
|
54
|
+
}
|
|
55
55
|
|
|
56
|
-
export interface
|
|
57
|
-
|
|
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>;
|
|
58
78
|
|
|
79
|
+
initPhoneChange(request: InitPhoneChangeRequest): Observable<InitPhoneChangeResponse>;
|
|
80
|
+
|
|
81
|
+
confirmPhoneChange(request: ConfirmPhoneChangeRequest): Observable<ConfirmPhoneChangeResponse>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface AccountServiceController {
|
|
59
85
|
getAccount(
|
|
60
86
|
request: GetAccountRequest,
|
|
61
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;
|
|
62
104
|
}
|
|
63
105
|
|
|
64
106
|
export function AccountServiceControllerMethods() {
|
|
65
107
|
return function (constructor: Function) {
|
|
66
|
-
const grpcMethods: string[] = [
|
|
108
|
+
const grpcMethods: string[] = [
|
|
109
|
+
"getAccount",
|
|
110
|
+
"initEmailChange",
|
|
111
|
+
"confirmEmailChange",
|
|
112
|
+
"initPhoneChange",
|
|
113
|
+
"confirmPhoneChange",
|
|
114
|
+
];
|
|
67
115
|
for (const method of grpcMethods) {
|
|
68
116
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
69
117
|
GrpcMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
|
package/gen/auth.ts
CHANGED
|
@@ -7,116 +7,89 @@
|
|
|
7
7
|
/* eslint-disable */
|
|
8
8
|
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
9
|
import { Observable } from "rxjs";
|
|
10
|
+
import { Empty } from "./google/protobuf/empty";
|
|
10
11
|
|
|
11
12
|
export const protobufPackage = "auth.v1";
|
|
12
13
|
|
|
13
|
-
/** Request to send a one-time password (OTP) to the user. */
|
|
14
14
|
export interface SendOtpRequest {
|
|
15
|
-
/** The user identifier: either phone number or email address. */
|
|
16
15
|
identifier: string;
|
|
17
|
-
/** The type of identifier: "phone" or "email". */
|
|
18
16
|
type: string;
|
|
19
17
|
}
|
|
20
18
|
|
|
21
|
-
/** Response for SendOtp request. */
|
|
22
19
|
export interface SendOtpResponse {
|
|
23
|
-
/** True if OTP was successfully sent. */
|
|
24
20
|
ok: boolean;
|
|
25
21
|
}
|
|
26
22
|
|
|
27
|
-
/** Request to verify a one-time password (OTP). */
|
|
28
23
|
export interface VerifyOtpRequest {
|
|
29
|
-
/** The user identifier: either phone number or email address. */
|
|
30
24
|
identifier: string;
|
|
31
|
-
/** The type of identifier: "phone" or "email". */
|
|
32
25
|
type: string;
|
|
33
|
-
/** The OTP code sent to the user. */
|
|
34
26
|
code: string;
|
|
35
27
|
}
|
|
36
28
|
|
|
37
|
-
/** Response for VerifyOtp request. */
|
|
38
29
|
export interface VerifyOtpResponse {
|
|
39
|
-
/** JWT access token. */
|
|
40
30
|
accessToken: string;
|
|
41
|
-
/** Refresh token to obtain new access tokens. */
|
|
42
31
|
refreshToken: string;
|
|
43
32
|
}
|
|
44
33
|
|
|
45
|
-
/** Request to refresh an access token. */
|
|
46
34
|
export interface RefreshRequest {
|
|
47
|
-
/** The refresh token issued previously. */
|
|
48
35
|
refreshToken: string;
|
|
49
36
|
}
|
|
50
37
|
|
|
51
|
-
/** Response for Refresh request. */
|
|
52
38
|
export interface RefreshResponse {
|
|
53
|
-
/** New JWT access token. */
|
|
54
39
|
accessToken: string;
|
|
55
|
-
/** New refresh token. */
|
|
56
40
|
refreshToken: string;
|
|
57
41
|
}
|
|
58
42
|
|
|
59
|
-
export
|
|
43
|
+
export interface TelegramInitResponse {
|
|
44
|
+
url: string;
|
|
45
|
+
}
|
|
60
46
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
*/
|
|
47
|
+
export interface TelegramVerifyRequest {
|
|
48
|
+
query: { [key: string]: string };
|
|
49
|
+
}
|
|
65
50
|
|
|
66
|
-
export interface
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
*/
|
|
51
|
+
export interface TelegramVerifyRequest_QueryEntry {
|
|
52
|
+
key: string;
|
|
53
|
+
value: string;
|
|
54
|
+
}
|
|
71
55
|
|
|
72
|
-
|
|
56
|
+
export interface TelegramVerifyResponse {
|
|
57
|
+
url?: string | undefined;
|
|
58
|
+
accessToken?: string | undefined;
|
|
59
|
+
refreshToken?: string | undefined;
|
|
60
|
+
}
|
|
73
61
|
|
|
74
|
-
|
|
75
|
-
* Verifies a one-time password (OTP) sent to the user.
|
|
76
|
-
* The request must include the identifier, type, and OTP code.
|
|
77
|
-
*/
|
|
62
|
+
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
78
63
|
|
|
79
|
-
|
|
64
|
+
export interface AuthServiceClient {
|
|
65
|
+
sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
|
|
80
66
|
|
|
81
|
-
|
|
82
|
-
* Refreshes the access token using a valid refresh token.
|
|
83
|
-
* Returns a new access token and refresh token.
|
|
84
|
-
*/
|
|
67
|
+
verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
|
|
85
68
|
|
|
86
69
|
refresh(request: RefreshRequest): Observable<RefreshResponse>;
|
|
87
|
-
}
|
|
88
70
|
|
|
89
|
-
|
|
90
|
-
* AuthService handles all user authentication operations such as sending
|
|
91
|
-
* OTP codes, verifying them, and refreshing access tokens.
|
|
92
|
-
*/
|
|
71
|
+
telegramInit(request: Empty): Observable<TelegramInitResponse>;
|
|
93
72
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
* Sends a one-time verification code to the user via phone or email.
|
|
97
|
-
* The user provides an identifier (phone number or email) and type.
|
|
98
|
-
*/
|
|
73
|
+
telegramVerify(request: TelegramVerifyRequest): Observable<TelegramVerifyResponse>;
|
|
74
|
+
}
|
|
99
75
|
|
|
76
|
+
export interface AuthServiceController {
|
|
100
77
|
sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
|
|
101
78
|
|
|
102
|
-
/**
|
|
103
|
-
* Verifies a one-time password (OTP) sent to the user.
|
|
104
|
-
* The request must include the identifier, type, and OTP code.
|
|
105
|
-
*/
|
|
106
|
-
|
|
107
79
|
verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
|
|
108
80
|
|
|
109
|
-
/**
|
|
110
|
-
* Refreshes the access token using a valid refresh token.
|
|
111
|
-
* Returns a new access token and refresh token.
|
|
112
|
-
*/
|
|
113
|
-
|
|
114
81
|
refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
|
|
82
|
+
|
|
83
|
+
telegramInit(request: Empty): Promise<TelegramInitResponse> | Observable<TelegramInitResponse> | TelegramInitResponse;
|
|
84
|
+
|
|
85
|
+
telegramVerify(
|
|
86
|
+
request: TelegramVerifyRequest,
|
|
87
|
+
): Promise<TelegramVerifyResponse> | Observable<TelegramVerifyResponse> | TelegramVerifyResponse;
|
|
115
88
|
}
|
|
116
89
|
|
|
117
90
|
export function AuthServiceControllerMethods() {
|
|
118
91
|
return function (constructor: Function) {
|
|
119
|
-
const grpcMethods: string[] = ["sendOtp", "verifyOtp", "refresh"];
|
|
92
|
+
const grpcMethods: string[] = ["sendOtp", "verifyOtp", "refresh", "telegramInit", "telegramVerify"];
|
|
120
93
|
for (const method of grpcMethods) {
|
|
121
94
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
122
95
|
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.11.2
|
|
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
package/proto/account.proto
CHANGED
|
@@ -2,44 +2,66 @@ syntax = "proto3";
|
|
|
2
2
|
|
|
3
3
|
package account.v1;
|
|
4
4
|
|
|
5
|
-
// AccountService handles account retrieval operations.
|
|
6
5
|
service AccountService {
|
|
7
|
-
// GetAccount returns account information by unique identifier.
|
|
8
6
|
rpc GetAccount (GetAccountRequest) returns (GetAccountResponse);
|
|
7
|
+
rpc InitEmailChange (InitEmailChangeRequest) returns (InitEmailChangeResponse);
|
|
8
|
+
rpc ConfirmEmailChange (ConfirmEmailChangeRequest) returns (ConfirmEmailChangeResponse);
|
|
9
|
+
rpc InitPhoneChange (InitPhoneChangeRequest) returns (InitPhoneChangeResponse);
|
|
10
|
+
rpc ConfirmPhoneChange (ConfirmPhoneChangeRequest) returns (ConfirmPhoneChangeResponse);
|
|
9
11
|
}
|
|
10
12
|
|
|
11
|
-
// Request message for retrieving an account.
|
|
12
13
|
message GetAccountRequest {
|
|
13
|
-
// Unique account identifier (UUID).
|
|
14
14
|
string id = 1;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
// Response message containing account details.
|
|
18
17
|
message GetAccountResponse {
|
|
19
|
-
|
|
20
|
-
string
|
|
18
|
+
string id = 1;
|
|
19
|
+
string phone = 2;
|
|
20
|
+
string email = 3;
|
|
21
|
+
bool is_phone_verified = 4;
|
|
22
|
+
bool is_email_verified = 5;
|
|
23
|
+
Role role = 6;
|
|
24
|
+
}
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
enum Role {
|
|
27
|
+
USER = 0;
|
|
28
|
+
ADMIN = 1;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
message InitEmailChangeRequest {
|
|
32
|
+
string email = 1;
|
|
33
|
+
string user_id = 2;
|
|
34
|
+
}
|
|
24
35
|
|
|
25
|
-
|
|
26
|
-
|
|
36
|
+
message InitEmailChangeResponse {
|
|
37
|
+
bool ok = 1;
|
|
38
|
+
}
|
|
27
39
|
|
|
28
|
-
|
|
29
|
-
|
|
40
|
+
message ConfirmEmailChangeRequest {
|
|
41
|
+
string email = 1;
|
|
42
|
+
string code = 2;
|
|
43
|
+
string user_id = 3;
|
|
44
|
+
}
|
|
30
45
|
|
|
31
|
-
|
|
32
|
-
bool
|
|
46
|
+
message ConfirmEmailChangeResponse {
|
|
47
|
+
bool ok = 1;
|
|
48
|
+
}
|
|
33
49
|
|
|
34
|
-
|
|
35
|
-
|
|
50
|
+
message InitPhoneChangeRequest {
|
|
51
|
+
string phone = 1;
|
|
52
|
+
string user_id = 2;
|
|
36
53
|
}
|
|
37
54
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
USER = 0;
|
|
55
|
+
message InitPhoneChangeResponse {
|
|
56
|
+
bool ok = 1;
|
|
57
|
+
}
|
|
42
58
|
|
|
43
|
-
|
|
44
|
-
|
|
59
|
+
message ConfirmPhoneChangeRequest {
|
|
60
|
+
string phone = 1;
|
|
61
|
+
string code = 2;
|
|
62
|
+
string user_id = 3;
|
|
45
63
|
}
|
|
64
|
+
|
|
65
|
+
message ConfirmPhoneChangeResponse {
|
|
66
|
+
bool ok = 1;
|
|
67
|
+
}
|
package/proto/auth.proto
CHANGED
|
@@ -2,69 +2,58 @@ syntax = "proto3";
|
|
|
2
2
|
|
|
3
3
|
package auth.v1;
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import "google/protobuf/empty.proto";
|
|
6
|
+
|
|
7
7
|
service AuthService {
|
|
8
|
-
// Sends a one-time verification code to the user via phone or email.
|
|
9
|
-
// The user provides an identifier (phone number or email) and type.
|
|
10
8
|
rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
|
|
11
|
-
|
|
12
|
-
// Verifies a one-time password (OTP) sent to the user.
|
|
13
|
-
// The request must include the identifier, type, and OTP code.
|
|
14
9
|
rpc VerifyOtp (VerifyOtpRequest) returns (VerifyOtpResponse);
|
|
15
|
-
|
|
16
|
-
// Refreshes the access token using a valid refresh token.
|
|
17
|
-
// Returns a new access token and refresh token.
|
|
18
10
|
rpc Refresh (RefreshRequest) returns (RefreshResponse);
|
|
11
|
+
|
|
12
|
+
rpc TelegramInit (google.protobuf.Empty) returns (TelegramInitResponse);
|
|
13
|
+
rpc TelegramVerify (TelegramVerifyRequest) returns (TelegramVerifyResponse);
|
|
19
14
|
}
|
|
20
15
|
|
|
21
|
-
// Request to send a one-time password (OTP) to the user.
|
|
22
16
|
message SendOtpRequest {
|
|
23
|
-
// The user identifier: either phone number or email address.
|
|
24
17
|
string identifier = 1;
|
|
25
|
-
|
|
26
|
-
// The type of identifier: "phone" or "email".
|
|
27
|
-
string type = 2;
|
|
18
|
+
string type = 2;
|
|
28
19
|
}
|
|
29
20
|
|
|
30
|
-
// Response for SendOtp request.
|
|
31
21
|
message SendOtpResponse {
|
|
32
|
-
// True if OTP was successfully sent.
|
|
33
22
|
bool ok = 1;
|
|
34
23
|
}
|
|
35
24
|
|
|
36
|
-
// Request to verify a one-time password (OTP).
|
|
37
25
|
message VerifyOtpRequest {
|
|
38
|
-
// The user identifier: either phone number or email address.
|
|
39
26
|
string identifier = 1;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
string type = 2;
|
|
43
|
-
|
|
44
|
-
// The OTP code sent to the user.
|
|
45
|
-
string code = 3;
|
|
27
|
+
string type = 2;
|
|
28
|
+
string code = 3;
|
|
46
29
|
}
|
|
47
30
|
|
|
48
|
-
// Response for VerifyOtp request.
|
|
49
31
|
message VerifyOtpResponse {
|
|
50
|
-
|
|
51
|
-
string access_token = 1;
|
|
52
|
-
|
|
53
|
-
// Refresh token to obtain new access tokens.
|
|
32
|
+
string access_token = 1;
|
|
54
33
|
string refresh_token = 2;
|
|
55
34
|
}
|
|
56
35
|
|
|
57
|
-
// Request to refresh an access token.
|
|
58
36
|
message RefreshRequest {
|
|
59
|
-
// The refresh token issued previously.
|
|
60
37
|
string refresh_token = 1;
|
|
61
38
|
}
|
|
62
39
|
|
|
63
|
-
// Response for Refresh request.
|
|
64
40
|
message RefreshResponse {
|
|
65
|
-
|
|
66
|
-
string access_token = 1;
|
|
67
|
-
|
|
68
|
-
// New refresh token.
|
|
41
|
+
string access_token = 1;
|
|
69
42
|
string refresh_token = 2;
|
|
70
43
|
}
|
|
44
|
+
|
|
45
|
+
message TelegramInitResponse {
|
|
46
|
+
string url = 1;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
message TelegramVerifyRequest {
|
|
50
|
+
map<string, string> query = 1;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
message TelegramVerifyResponse {
|
|
54
|
+
oneof result {
|
|
55
|
+
string url = 1;
|
|
56
|
+
string access_token = 2;
|
|
57
|
+
string refresh_token = 3;
|
|
58
|
+
}
|
|
59
|
+
}
|