@platfformx/proto-contracts 1.0.0 → 1.0.2
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.
|
@@ -11,32 +11,148 @@ import { Observable } from "rxjs";
|
|
|
11
11
|
export const protobufPackage = "auth_service.v1";
|
|
12
12
|
|
|
13
13
|
export interface GetAccountRequest {
|
|
14
|
-
|
|
14
|
+
userId: string;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export interface GetAccountResponse {
|
|
18
|
-
|
|
18
|
+
userId: string;
|
|
19
|
+
email?: string | undefined;
|
|
20
|
+
phone?: string | undefined;
|
|
21
|
+
username?: string | undefined;
|
|
22
|
+
isPhoneVerified: boolean;
|
|
23
|
+
isEmailVerified: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface InitEmailChangeRequest {
|
|
27
|
+
userId: string;
|
|
28
|
+
email: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface InitEmailChangeResponse {
|
|
32
|
+
verificationId: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface InitPhoneChangeRequest {
|
|
36
|
+
userId: string;
|
|
19
37
|
phone: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface InitPhoneChangeResponse {
|
|
41
|
+
verificationId: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface ConfirmEmailChangeRequest {
|
|
45
|
+
userId: string;
|
|
20
46
|
email: string;
|
|
47
|
+
verificationId: string;
|
|
48
|
+
code: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface ConfirmEmailChangeResponse {
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface ConfirmPhoneChangeRequest {
|
|
55
|
+
userId: string;
|
|
56
|
+
phone: string;
|
|
57
|
+
verificationId: string;
|
|
58
|
+
code: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface ConfirmPhoneChangeResponse {
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface PatchAccountRequest {
|
|
65
|
+
userId: string;
|
|
66
|
+
username?: string | undefined;
|
|
67
|
+
displayName?: string | undefined;
|
|
68
|
+
email?: string | undefined;
|
|
69
|
+
phone?: string | undefined;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface PatchAccountResponse {
|
|
73
|
+
userId: string;
|
|
74
|
+
username?: string | undefined;
|
|
75
|
+
displayName?: string | undefined;
|
|
76
|
+
phone?: string | undefined;
|
|
77
|
+
email?: string | undefined;
|
|
21
78
|
isPhoneVerified: boolean;
|
|
22
79
|
isEmailVerified: boolean;
|
|
23
80
|
}
|
|
24
81
|
|
|
82
|
+
export interface ChangePasswordRequest {
|
|
83
|
+
userId: string;
|
|
84
|
+
oldPassword: string;
|
|
85
|
+
newPasword: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface ChangePasswordResponse {
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface LinkOAuthRequest {
|
|
92
|
+
userId: string;
|
|
93
|
+
oauthToken: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface LinkOAuthResponse {
|
|
97
|
+
}
|
|
98
|
+
|
|
25
99
|
export const AUTH_SERVICE_V1_PACKAGE_NAME = "auth_service.v1";
|
|
26
100
|
|
|
27
101
|
export interface AccountServiceClient {
|
|
28
102
|
getAccount(request: GetAccountRequest): Observable<GetAccountResponse>;
|
|
103
|
+
|
|
104
|
+
patchAccount(request: PatchAccountRequest): Observable<PatchAccountResponse>;
|
|
105
|
+
|
|
106
|
+
initEmailChange(request: InitEmailChangeRequest): Observable<InitEmailChangeResponse>;
|
|
107
|
+
|
|
108
|
+
initPhoneChange(request: InitPhoneChangeRequest): Observable<InitPhoneChangeResponse>;
|
|
109
|
+
|
|
110
|
+
confirmEmailChange(request: ConfirmEmailChangeRequest): Observable<ConfirmEmailChangeResponse>;
|
|
111
|
+
|
|
112
|
+
confirmPhoneChange(request: ConfirmPhoneChangeRequest): Observable<ConfirmPhoneChangeResponse>;
|
|
113
|
+
|
|
114
|
+
linkOAuth(request: LinkOAuthRequest): Observable<LinkOAuthResponse>;
|
|
29
115
|
}
|
|
30
116
|
|
|
31
117
|
export interface AccountServiceController {
|
|
32
118
|
getAccount(
|
|
33
119
|
request: GetAccountRequest,
|
|
34
120
|
): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
|
|
121
|
+
|
|
122
|
+
patchAccount(
|
|
123
|
+
request: PatchAccountRequest,
|
|
124
|
+
): Promise<PatchAccountResponse> | Observable<PatchAccountResponse> | PatchAccountResponse;
|
|
125
|
+
|
|
126
|
+
initEmailChange(
|
|
127
|
+
request: InitEmailChangeRequest,
|
|
128
|
+
): Promise<InitEmailChangeResponse> | Observable<InitEmailChangeResponse> | InitEmailChangeResponse;
|
|
129
|
+
|
|
130
|
+
initPhoneChange(
|
|
131
|
+
request: InitPhoneChangeRequest,
|
|
132
|
+
): Promise<InitPhoneChangeResponse> | Observable<InitPhoneChangeResponse> | InitPhoneChangeResponse;
|
|
133
|
+
|
|
134
|
+
confirmEmailChange(
|
|
135
|
+
request: ConfirmEmailChangeRequest,
|
|
136
|
+
): Promise<ConfirmEmailChangeResponse> | Observable<ConfirmEmailChangeResponse> | ConfirmEmailChangeResponse;
|
|
137
|
+
|
|
138
|
+
confirmPhoneChange(
|
|
139
|
+
request: ConfirmPhoneChangeRequest,
|
|
140
|
+
): Promise<ConfirmPhoneChangeResponse> | Observable<ConfirmPhoneChangeResponse> | ConfirmPhoneChangeResponse;
|
|
141
|
+
|
|
142
|
+
linkOAuth(request: LinkOAuthRequest): Promise<LinkOAuthResponse> | Observable<LinkOAuthResponse> | LinkOAuthResponse;
|
|
35
143
|
}
|
|
36
144
|
|
|
37
145
|
export function AccountServiceControllerMethods() {
|
|
38
146
|
return function (constructor: Function) {
|
|
39
|
-
const grpcMethods: string[] = [
|
|
147
|
+
const grpcMethods: string[] = [
|
|
148
|
+
"getAccount",
|
|
149
|
+
"patchAccount",
|
|
150
|
+
"initEmailChange",
|
|
151
|
+
"initPhoneChange",
|
|
152
|
+
"confirmEmailChange",
|
|
153
|
+
"confirmPhoneChange",
|
|
154
|
+
"linkOAuth",
|
|
155
|
+
];
|
|
40
156
|
for (const method of grpcMethods) {
|
|
41
157
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
42
158
|
GrpcMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
|
|
@@ -10,28 +10,81 @@ import { Observable } from "rxjs";
|
|
|
10
10
|
|
|
11
11
|
export const protobufPackage = "auth_service.v1";
|
|
12
12
|
|
|
13
|
-
export interface
|
|
14
|
-
|
|
13
|
+
export interface RegisterRequest {
|
|
14
|
+
credentials?: RegisterCredentials | undefined;
|
|
15
|
+
oauthToken?: string | undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface RegisterResponse {
|
|
19
|
+
userId: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface AuthenticationRequest {
|
|
23
|
+
credentials?: AuthCredentials | undefined;
|
|
24
|
+
oauthToken?: string | undefined;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface AuthenticationResponse {
|
|
28
|
+
accessToken: string;
|
|
29
|
+
refreshToken: string;
|
|
30
|
+
user: UserInfo | undefined;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface RegisterCredentials {
|
|
34
|
+
email?: string | undefined;
|
|
35
|
+
phone?: string | undefined;
|
|
36
|
+
password: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface AuthCredentials {
|
|
40
|
+
email?: string | undefined;
|
|
41
|
+
phone?: string | undefined;
|
|
42
|
+
username?: string | undefined;
|
|
15
43
|
password: string;
|
|
16
44
|
}
|
|
17
45
|
|
|
18
|
-
export interface
|
|
46
|
+
export interface TokenRefreshRequest {
|
|
47
|
+
refreshToken: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface TokenRefreshResponse {
|
|
19
51
|
accessToken: string;
|
|
52
|
+
refreshToken: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface UserInfo {
|
|
56
|
+
userId: string;
|
|
57
|
+
email?: string | undefined;
|
|
58
|
+
phone?: string | undefined;
|
|
59
|
+
username?: string | undefined;
|
|
60
|
+
displayName?: string | undefined;
|
|
20
61
|
}
|
|
21
62
|
|
|
22
63
|
export const AUTH_SERVICE_V1_PACKAGE_NAME = "auth_service.v1";
|
|
23
64
|
|
|
24
65
|
export interface AuthServiceClient {
|
|
25
|
-
|
|
66
|
+
register(request: RegisterRequest): Observable<RegisterResponse>;
|
|
67
|
+
|
|
68
|
+
authenticate(request: AuthenticationRequest): Observable<AuthenticationResponse>;
|
|
69
|
+
|
|
70
|
+
refreshTokens(request: TokenRefreshRequest): Observable<TokenRefreshResponse>;
|
|
26
71
|
}
|
|
27
72
|
|
|
28
73
|
export interface AuthServiceController {
|
|
29
|
-
|
|
74
|
+
register(request: RegisterRequest): Promise<RegisterResponse> | Observable<RegisterResponse> | RegisterResponse;
|
|
75
|
+
|
|
76
|
+
authenticate(
|
|
77
|
+
request: AuthenticationRequest,
|
|
78
|
+
): Promise<AuthenticationResponse> | Observable<AuthenticationResponse> | AuthenticationResponse;
|
|
79
|
+
|
|
80
|
+
refreshTokens(
|
|
81
|
+
request: TokenRefreshRequest,
|
|
82
|
+
): Promise<TokenRefreshResponse> | Observable<TokenRefreshResponse> | TokenRefreshResponse;
|
|
30
83
|
}
|
|
31
84
|
|
|
32
85
|
export function AuthServiceControllerMethods() {
|
|
33
86
|
return function (constructor: Function) {
|
|
34
|
-
const grpcMethods: string[] = ["
|
|
87
|
+
const grpcMethods: string[] = ["register", "authenticate", "refreshTokens"];
|
|
35
88
|
for (const method of grpcMethods) {
|
|
36
89
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
37
90
|
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platfformx/proto-contracts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -21,5 +21,8 @@
|
|
|
21
21
|
"ts-proto": "^2.11.8",
|
|
22
22
|
"typescript": "^6.0.3"
|
|
23
23
|
},
|
|
24
|
-
"dependencies": {
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@nestjs/microservices": "^11.1.21",
|
|
26
|
+
"rxjs": "^7.8.2"
|
|
27
|
+
}
|
|
25
28
|
}
|
|
@@ -2,23 +2,105 @@ syntax = "proto3";
|
|
|
2
2
|
|
|
3
3
|
package auth_service.v1;
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
5
|
service AccountService {
|
|
8
6
|
rpc GetAccount (GetAccountRequest) returns (GetAccountResponse);
|
|
9
|
-
|
|
7
|
+
rpc PatchAccount (PatchAccountRequest) returns (PatchAccountResponse);
|
|
8
|
+
rpc InitEmailChange (InitEmailChangeRequest) returns (InitEmailChangeResponse);
|
|
9
|
+
rpc InitPhoneChange (InitPhoneChangeRequest) returns (InitPhoneChangeResponse);
|
|
10
|
+
rpc ConfirmEmailChange (ConfirmEmailChangeRequest) returns (ConfirmEmailChangeResponse);
|
|
11
|
+
rpc ConfirmPhoneChange (ConfirmPhoneChangeRequest) returns (ConfirmPhoneChangeResponse);
|
|
12
|
+
rpc LinkOAuth (LinkOAuthRequest) returns (LinkOAuthResponse);
|
|
10
13
|
}
|
|
11
14
|
|
|
12
15
|
message GetAccountRequest {
|
|
13
|
-
string
|
|
16
|
+
string user_id = 1;
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
message GetAccountResponse {
|
|
17
|
-
string
|
|
20
|
+
string user_id = 1;
|
|
21
|
+
optional string email = 2;
|
|
22
|
+
optional string phone = 3;
|
|
23
|
+
optional string username = 4;
|
|
24
|
+
bool is_phone_verified = 5;
|
|
25
|
+
bool is_email_verified = 6;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
message InitEmailChangeRequest {
|
|
30
|
+
string user_id = 1;
|
|
31
|
+
string email = 2;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
message InitEmailChangeResponse {
|
|
36
|
+
string verification_id = 2;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
message InitPhoneChangeRequest {
|
|
40
|
+
string user_id = 1;
|
|
18
41
|
string phone = 2;
|
|
19
|
-
string email = 3;
|
|
20
|
-
bool is_phone_verified = 4;
|
|
21
|
-
bool is_email_verified = 5;
|
|
22
42
|
|
|
23
43
|
}
|
|
24
44
|
|
|
45
|
+
message InitPhoneChangeResponse {
|
|
46
|
+
string verification_id = 1;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
message ConfirmEmailChangeRequest {
|
|
52
|
+
string user_id = 1;
|
|
53
|
+
string email = 2;
|
|
54
|
+
string verification_id = 3;
|
|
55
|
+
string code = 4;
|
|
56
|
+
|
|
57
|
+
}
|
|
58
|
+
message ConfirmEmailChangeResponse {
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
message ConfirmPhoneChangeRequest {
|
|
63
|
+
string user_id = 1;
|
|
64
|
+
string phone = 2;
|
|
65
|
+
string verification_id = 3;
|
|
66
|
+
string code = 4;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
message ConfirmPhoneChangeResponse {
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
message PatchAccountRequest {
|
|
74
|
+
string user_id = 1;
|
|
75
|
+
optional string username = 2;
|
|
76
|
+
optional string display_name = 3;
|
|
77
|
+
optional string email = 4;
|
|
78
|
+
optional string phone = 5;
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
message PatchAccountResponse {
|
|
82
|
+
string user_id = 1;
|
|
83
|
+
optional string username = 2;
|
|
84
|
+
optional string display_name = 3;
|
|
85
|
+
optional string phone = 4;
|
|
86
|
+
optional string email = 5;
|
|
87
|
+
bool is_phone_verified = 6;
|
|
88
|
+
bool is_email_verified = 7;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
message ChangePasswordRequest {
|
|
92
|
+
string user_id = 1;
|
|
93
|
+
string old_password = 2;
|
|
94
|
+
string new_pasword = 3;
|
|
95
|
+
}
|
|
96
|
+
message ChangePasswordResponse {
|
|
97
|
+
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
message LinkOAuthRequest {
|
|
101
|
+
string user_id = 1;
|
|
102
|
+
string oauth_token = 2;
|
|
103
|
+
}
|
|
104
|
+
message LinkOAuthResponse {
|
|
105
|
+
|
|
106
|
+
}
|
|
@@ -2,17 +2,61 @@ syntax = "proto3";
|
|
|
2
2
|
|
|
3
3
|
package auth_service.v1;
|
|
4
4
|
|
|
5
|
+
service AuthService {
|
|
6
|
+
rpc CreateAccount (CreateAccountRequest) returns (CreateAccountResponse);
|
|
7
|
+
rpc Authenticate (AuthenticationRequest) returns (AuthenticationResponse);
|
|
8
|
+
rpc RefreshTokens (TokenRefreshRequest) returns (TokenRefreshResponse);
|
|
9
|
+
}
|
|
5
10
|
|
|
6
11
|
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
message CreateAccountRequest {
|
|
13
|
+
oneof register_method {
|
|
14
|
+
UserCredentials credentials = 1;
|
|
15
|
+
string oauth_token = 2;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
message CreateAccountResponse {
|
|
20
|
+
string user_id = 1;
|
|
21
|
+
string access_token = 2;
|
|
22
|
+
string refresh_token = 3;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
message AuthenticationRequest {
|
|
26
|
+
oneof auth_method {
|
|
27
|
+
UserCredentials credentials = 1;
|
|
28
|
+
string oauth_token = 2;
|
|
29
|
+
}
|
|
9
30
|
}
|
|
10
31
|
|
|
11
|
-
message
|
|
32
|
+
message AuthenticationResponse {
|
|
33
|
+
string access_token = 1;
|
|
34
|
+
string refresh_token = 2;
|
|
35
|
+
UserInfo user = 3;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
message UserCredentials {
|
|
12
40
|
string email = 1;
|
|
13
|
-
string
|
|
41
|
+
string phone = 2;
|
|
42
|
+
string username = 3;
|
|
43
|
+
string password = 4;
|
|
14
44
|
}
|
|
15
45
|
|
|
16
|
-
|
|
46
|
+
//Токены
|
|
47
|
+
message TokenRefreshRequest {
|
|
48
|
+
string refresh_token = 1;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
message TokenRefreshResponse {
|
|
17
52
|
string access_token = 1;
|
|
53
|
+
string refresh_token = 2;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
message UserInfo {
|
|
57
|
+
string user_id = 1;
|
|
58
|
+
optional string email = 2;
|
|
59
|
+
optional string phone = 3;
|
|
60
|
+
optional string username = 4;
|
|
61
|
+
optional string display_name = 5;
|
|
18
62
|
}
|
package/tsconfig.json
CHANGED