@platfformx/proto-contracts 1.1.2 → 1.1.4

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.
@@ -1,16 +1,16 @@
1
1
  import { Observable } from "rxjs";
2
2
  export declare const protobufPackage = "auth_service.v1";
3
- export interface GetAccountRequest {
3
+ /** Get account */
4
+ export interface GetProfileRequest {
4
5
  userId: string;
5
6
  }
6
- export interface GetAccountResponse {
7
- userId: string;
8
- email?: string | undefined;
9
- phone?: string | undefined;
10
- username?: string | undefined;
11
- isPhoneVerified: boolean;
12
- isEmailVerified: boolean;
7
+ export interface GetProfileResponse {
8
+ id: string;
9
+ firstName?: string | undefined;
10
+ lastName?: string | undefined;
11
+ picture?: string | undefined;
13
12
  }
13
+ /** init + change email */
14
14
  export interface InitEmailChangeRequest {
15
15
  userId: string;
16
16
  email: string;
@@ -18,13 +18,6 @@ export interface InitEmailChangeRequest {
18
18
  export interface InitEmailChangeResponse {
19
19
  verificationId: string;
20
20
  }
21
- export interface InitPhoneChangeRequest {
22
- userId: string;
23
- phone: string;
24
- }
25
- export interface InitPhoneChangeResponse {
26
- verificationId: string;
27
- }
28
21
  export interface ConfirmEmailChangeRequest {
29
22
  userId: string;
30
23
  email: string;
@@ -32,6 +25,15 @@ export interface ConfirmEmailChangeRequest {
32
25
  code: string;
33
26
  }
34
27
  export interface ConfirmEmailChangeResponse {
28
+ ok: boolean;
29
+ }
30
+ /** init + change phone */
31
+ export interface InitPhoneChangeRequest {
32
+ userId: string;
33
+ phone: string;
34
+ }
35
+ export interface InitPhoneChangeResponse {
36
+ verificationId: string;
35
37
  }
36
38
  export interface ConfirmPhoneChangeRequest {
37
39
  userId: string;
@@ -40,30 +42,29 @@ export interface ConfirmPhoneChangeRequest {
40
42
  code: string;
41
43
  }
42
44
  export interface ConfirmPhoneChangeResponse {
45
+ ok: boolean;
43
46
  }
44
- export interface PatchAccountRequest {
47
+ /** update profile */
48
+ export interface UpdateProfileRequest {
45
49
  userId: string;
46
50
  username?: string | undefined;
47
51
  displayName?: string | undefined;
48
- email?: string | undefined;
49
- phone?: string | undefined;
50
52
  }
51
- export interface PatchAccountResponse {
53
+ export interface UpdateProfileResponse {
52
54
  userId: string;
53
55
  username?: string | undefined;
54
56
  displayName?: string | undefined;
55
- phone?: string | undefined;
56
- email?: string | undefined;
57
- isPhoneVerified: boolean;
58
- isEmailVerified: boolean;
59
57
  }
58
+ /** change password */
60
59
  export interface ChangePasswordRequest {
61
60
  userId: string;
62
61
  oldPassword: string;
63
62
  newPasword: string;
64
63
  }
65
64
  export interface ChangePasswordResponse {
65
+ ok: boolean;
66
66
  }
67
+ /** link oauth */
67
68
  export interface LinkOAuthRequest {
68
69
  userId: string;
69
70
  oauthToken: string;
@@ -72,8 +73,8 @@ export interface LinkOAuthResponse {
72
73
  }
73
74
  export declare const AUTH_SERVICE_V1_PACKAGE_NAME = "auth_service.v1";
74
75
  export interface AccountServiceClient {
75
- getAccount(request: GetAccountRequest): Observable<GetAccountResponse>;
76
- patchAccount(request: PatchAccountRequest): Observable<PatchAccountResponse>;
76
+ getProfile(request: GetProfileRequest): Observable<GetProfileResponse>;
77
+ updateProfile(request: UpdateProfileRequest): Observable<UpdateProfileRequest>;
77
78
  initEmailChange(request: InitEmailChangeRequest): Observable<InitEmailChangeResponse>;
78
79
  initPhoneChange(request: InitPhoneChangeRequest): Observable<InitPhoneChangeResponse>;
79
80
  confirmEmailChange(request: ConfirmEmailChangeRequest): Observable<ConfirmEmailChangeResponse>;
@@ -81,8 +82,8 @@ export interface AccountServiceClient {
81
82
  linkOAuth(request: LinkOAuthRequest): Observable<LinkOAuthResponse>;
82
83
  }
83
84
  export interface AccountServiceController {
84
- getAccount(request: GetAccountRequest): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
85
- patchAccount(request: PatchAccountRequest): Promise<PatchAccountResponse> | Observable<PatchAccountResponse> | PatchAccountResponse;
85
+ getProfile(request: GetProfileRequest): Promise<GetProfileResponse> | Observable<GetProfileResponse> | GetProfileResponse;
86
+ updateProfile(request: UpdateProfileRequest): Promise<UpdateProfileRequest> | Observable<UpdateProfileRequest> | UpdateProfileRequest;
86
87
  initEmailChange(request: InitEmailChangeRequest): Promise<InitEmailChangeResponse> | Observable<InitEmailChangeResponse> | InitEmailChangeResponse;
87
88
  initPhoneChange(request: InitPhoneChangeRequest): Promise<InitPhoneChangeResponse> | Observable<InitPhoneChangeResponse> | InitPhoneChangeResponse;
88
89
  confirmEmailChange(request: ConfirmEmailChangeRequest): Promise<ConfirmEmailChangeResponse> | Observable<ConfirmEmailChangeResponse> | ConfirmEmailChangeResponse;
@@ -14,8 +14,8 @@ exports.AUTH_SERVICE_V1_PACKAGE_NAME = "auth_service.v1";
14
14
  function AccountServiceControllerMethods() {
15
15
  return function (constructor) {
16
16
  const grpcMethods = [
17
- "getAccount",
18
- "patchAccount",
17
+ "getProfile",
18
+ "updateProfile",
19
19
  "initEmailChange",
20
20
  "initPhoneChange",
21
21
  "confirmEmailChange",
@@ -7,12 +7,30 @@ export declare enum OAuthProvider {
7
7
  OAUTH_PROVIDER_TELEGRAM = 3,
8
8
  UNRECOGNIZED = -1
9
9
  }
10
+ export declare enum Role {
11
+ USER = 0,
12
+ ADMIN = 1,
13
+ UNRECOGNIZED = -1
14
+ }
15
+ /** Get auth account data */
16
+ export interface GetAuthAccountRequest {
17
+ userId: string;
18
+ }
19
+ export interface GetAuthAccountResponse {
20
+ id: string;
21
+ email?: string | undefined;
22
+ phone?: string | undefined;
23
+ username?: string | undefined;
24
+ isPhoneVerified: boolean;
25
+ isEmailVerified: boolean;
26
+ role: Role;
27
+ }
10
28
  /** Create account */
11
29
  export interface CreateAccountRequest {
12
30
  credentials: UserCredentials | undefined;
13
31
  }
14
32
  export interface CreateAccountResponse {
15
- userId: string;
33
+ id: string;
16
34
  accessToken: string;
17
35
  refreshToken: string;
18
36
  user: UserProfile | undefined;
@@ -22,7 +40,7 @@ export interface AuthenticationRequest {
22
40
  credentials: UserCredentialsLogin | undefined;
23
41
  }
24
42
  export interface AuthenticationResponse {
25
- userId: string;
43
+ id: string;
26
44
  accessToken: string;
27
45
  refreshToken: string;
28
46
  user: UserProfile | undefined;
@@ -39,6 +57,14 @@ export interface OAuthSessionResponse {
39
57
  user: UserProfile | undefined;
40
58
  isNewUser: boolean;
41
59
  }
60
+ /** Logout */
61
+ export interface LogoutRequest {
62
+ userId: string;
63
+ accessToken: string;
64
+ }
65
+ export interface LogoutResponse {
66
+ success: boolean;
67
+ }
42
68
  /** Tokens */
43
69
  export interface TokenRefreshRequest {
44
70
  refreshToken: string;
@@ -111,6 +137,8 @@ export interface AuthServiceClient {
111
137
  createAccount(request: CreateAccountRequest): Observable<CreateAccountResponse>;
112
138
  authenticate(request: AuthenticationRequest): Observable<AuthenticationResponse>;
113
139
  authenticateWithOAuth(request: OAuthSessionRequest): Observable<OAuthSessionResponse>;
140
+ logout(request: LogoutRequest): Observable<LogoutResponse>;
141
+ getAuthAccount(request: GetAuthAccountRequest): Observable<GetAuthAccountResponse>;
114
142
  refreshTokens(request: TokenRefreshRequest): Observable<TokenRefreshResponse>;
115
143
  confirmAccount(request: ConfirmAccountRequest): Observable<ConfirmAccountResponse>;
116
144
  resendVerification(request: ResendVerificationRequest): Observable<ResendVerificationResponse>;
@@ -122,6 +150,8 @@ export interface AuthServiceController {
122
150
  createAccount(request: CreateAccountRequest): Promise<CreateAccountResponse> | Observable<CreateAccountResponse> | CreateAccountResponse;
123
151
  authenticate(request: AuthenticationRequest): Promise<AuthenticationResponse> | Observable<AuthenticationResponse> | AuthenticationResponse;
124
152
  authenticateWithOAuth(request: OAuthSessionRequest): Promise<OAuthSessionResponse> | Observable<OAuthSessionResponse> | OAuthSessionResponse;
153
+ logout(request: LogoutRequest): Promise<LogoutResponse> | Observable<LogoutResponse> | LogoutResponse;
154
+ getAuthAccount(request: GetAuthAccountRequest): Promise<GetAuthAccountResponse> | Observable<GetAuthAccountResponse> | GetAuthAccountResponse;
125
155
  refreshTokens(request: TokenRefreshRequest): Promise<TokenRefreshResponse> | Observable<TokenRefreshResponse> | TokenRefreshResponse;
126
156
  confirmAccount(request: ConfirmAccountRequest): Promise<ConfirmAccountResponse> | Observable<ConfirmAccountResponse> | ConfirmAccountResponse;
127
157
  resendVerification(request: ResendVerificationRequest): Promise<ResendVerificationResponse> | Observable<ResendVerificationResponse> | ResendVerificationResponse;
@@ -5,7 +5,7 @@
5
5
  // protoc v7.34.0
6
6
  // source: auth-service/auth.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.AUTH_SERVICE_NAME = exports.AUTH_SERVICE_V1_PACKAGE_NAME = exports.OAuthProvider = exports.protobufPackage = void 0;
8
+ exports.AUTH_SERVICE_NAME = exports.AUTH_SERVICE_V1_PACKAGE_NAME = exports.Role = exports.OAuthProvider = exports.protobufPackage = void 0;
9
9
  exports.AuthServiceControllerMethods = AuthServiceControllerMethods;
10
10
  /* eslint-disable */
11
11
  const microservices_1 = require("@nestjs/microservices");
@@ -18,6 +18,12 @@ var OAuthProvider;
18
18
  OAuthProvider[OAuthProvider["OAUTH_PROVIDER_TELEGRAM"] = 3] = "OAUTH_PROVIDER_TELEGRAM";
19
19
  OAuthProvider[OAuthProvider["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
20
20
  })(OAuthProvider || (exports.OAuthProvider = OAuthProvider = {}));
21
+ var Role;
22
+ (function (Role) {
23
+ Role[Role["USER"] = 0] = "USER";
24
+ Role[Role["ADMIN"] = 1] = "ADMIN";
25
+ Role[Role["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
26
+ })(Role || (exports.Role = Role = {}));
21
27
  exports.AUTH_SERVICE_V1_PACKAGE_NAME = "auth_service.v1";
22
28
  function AuthServiceControllerMethods() {
23
29
  return function (constructor) {
@@ -25,6 +31,8 @@ function AuthServiceControllerMethods() {
25
31
  "createAccount",
26
32
  "authenticate",
27
33
  "authenticateWithOAuth",
34
+ "logout",
35
+ "getAuthAccount",
28
36
  "refreshTokens",
29
37
  "confirmAccount",
30
38
  "resendVerification",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platfformx/proto-contracts",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -3,8 +3,8 @@ syntax = "proto3";
3
3
  package auth_service.v1;
4
4
 
5
5
  service AccountService {
6
- rpc GetAccount (GetAccountRequest) returns (GetAccountResponse);
7
- rpc PatchAccount (PatchAccountRequest) returns (PatchAccountResponse);
6
+ rpc GetProfile (GetProfileRequest) returns (GetProfileResponse);
7
+ rpc UpdateProfile (UpdateProfileRequest) returns (UpdateProfileRequest);
8
8
  rpc InitEmailChange (InitEmailChangeRequest) returns (InitEmailChangeResponse);
9
9
  rpc InitPhoneChange (InitPhoneChangeRequest) returns (InitPhoneChangeResponse);
10
10
  rpc ConfirmEmailChange (ConfirmEmailChangeRequest) returns (ConfirmEmailChangeResponse);
@@ -12,42 +12,29 @@ service AccountService {
12
12
  rpc LinkOAuth (LinkOAuthRequest) returns (LinkOAuthResponse);
13
13
  }
14
14
 
15
- message GetAccountRequest {
16
- string user_id = 1;
17
- }
18
15
 
19
- message GetAccountResponse {
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
- }
16
+ // Get account
17
+ message GetProfileRequest {
18
+ string user_id = 1;
27
19
 
20
+ }
21
+ message GetProfileResponse {
22
+ string id = 1;
23
+ optional string first_name = 2;
24
+ optional string last_name = 3;
25
+ optional string picture = 4;
26
+ }
28
27
 
28
+ // init + change email
29
29
  message InitEmailChangeRequest {
30
30
  string user_id = 1;
31
31
  string email = 2;
32
32
  }
33
33
 
34
-
35
34
  message InitEmailChangeResponse {
36
35
  string verification_id = 2;
37
36
  }
38
37
 
39
- message InitPhoneChangeRequest {
40
- string user_id = 1;
41
- string phone = 2;
42
-
43
- }
44
-
45
- message InitPhoneChangeResponse {
46
- string verification_id = 1;
47
- }
48
-
49
-
50
-
51
38
  message ConfirmEmailChangeRequest {
52
39
  string user_id = 1;
53
40
  string email = 2;
@@ -55,10 +42,21 @@ message ConfirmEmailChangeRequest {
55
42
  string code = 4;
56
43
 
57
44
  }
58
- message ConfirmEmailChangeResponse {
59
45
 
46
+ message ConfirmEmailChangeResponse {
47
+ bool ok = 1;
60
48
  }
61
49
 
50
+ // init + change phone
51
+ message InitPhoneChangeRequest {
52
+ string user_id = 1;
53
+ string phone = 2;
54
+ }
55
+
56
+ message InitPhoneChangeResponse {
57
+ string verification_id = 1;
58
+ }
59
+
62
60
  message ConfirmPhoneChangeRequest {
63
61
  string user_id = 1;
64
62
  string phone = 2;
@@ -67,40 +65,40 @@ message ConfirmPhoneChangeRequest {
67
65
  }
68
66
 
69
67
  message ConfirmPhoneChangeResponse {
70
-
68
+ bool ok = 1;
71
69
  }
72
70
 
73
- message PatchAccountRequest {
71
+
72
+ // update profile
73
+ message UpdateProfileRequest {
74
74
  string user_id = 1;
75
75
  optional string username = 2;
76
76
  optional string display_name = 3;
77
- optional string email = 4;
78
- optional string phone = 5;
79
77
 
80
78
  }
81
- message PatchAccountResponse {
79
+ message UpdateProfileResponse {
82
80
  string user_id = 1;
83
81
  optional string username = 2;
84
82
  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
83
  }
90
84
 
85
+
86
+ // change password
91
87
  message ChangePasswordRequest {
92
88
  string user_id = 1;
93
89
  string old_password = 2;
94
90
  string new_pasword = 3;
95
91
  }
96
92
  message ChangePasswordResponse {
97
-
93
+ bool ok = 1;
98
94
  }
99
95
 
96
+
97
+ // link oauth
100
98
  message LinkOAuthRequest {
101
99
  string user_id = 1;
102
100
  string oauth_token = 2;
103
101
  }
104
102
  message LinkOAuthResponse {
105
103
 
106
- }
104
+ }
@@ -6,6 +6,9 @@ service AuthService {
6
6
  rpc CreateAccount (CreateAccountRequest) returns (CreateAccountResponse);
7
7
  rpc Authenticate (AuthenticationRequest) returns (AuthenticationResponse);
8
8
  rpc AuthenticateWithOAuth (OAuthSessionRequest) returns (OAuthSessionResponse);
9
+ rpc Logout (LogoutRequest) returns (LogoutResponse);
10
+ rpc GetAuthAccount (GetAuthAccountRequest) returns (GetAuthAccountResponse);
11
+
9
12
  rpc RefreshTokens (TokenRefreshRequest) returns (TokenRefreshResponse);
10
13
 
11
14
  rpc ConfirmAccount (ConfirmAccountRequest) returns (ConfirmAccountResponse);
@@ -18,13 +21,30 @@ service AuthService {
18
21
 
19
22
  }
20
23
 
24
+
25
+ // Get auth account data
26
+ message GetAuthAccountRequest {
27
+ string user_id = 1;
28
+ }
29
+
30
+ message GetAuthAccountResponse {
31
+ string id = 1;
32
+ optional string email = 2;
33
+ optional string phone = 3;
34
+ optional string username = 4;
35
+ bool is_phone_verified = 5;
36
+ bool is_email_verified = 6;
37
+ Role role = 7;
38
+ }
39
+
40
+
21
41
  // Create account
22
42
  message CreateAccountRequest {
23
43
  UserCredentials credentials = 1;
24
44
  }
25
45
 
26
46
  message CreateAccountResponse {
27
- string user_id = 1;
47
+ string id = 1;
28
48
  string access_token = 2;
29
49
  string refresh_token = 3;
30
50
  UserProfile user = 4;
@@ -36,7 +56,7 @@ message AuthenticationRequest {
36
56
  }
37
57
 
38
58
  message AuthenticationResponse {
39
- string user_id = 1;
59
+ string id = 1;
40
60
  string access_token = 2;
41
61
  string refresh_token = 3;
42
62
  UserProfile user = 4;
@@ -54,6 +74,18 @@ message OAuthSessionResponse {
54
74
  UserProfile user = 4;
55
75
  bool is_new_user = 5;
56
76
  }
77
+
78
+ // Logout
79
+ message LogoutRequest {
80
+ string user_id = 1;
81
+ string access_token = 2;
82
+ }
83
+
84
+ message LogoutResponse {
85
+ bool success = 1;
86
+ }
87
+
88
+
57
89
  // Tokens
58
90
  message TokenRefreshRequest {
59
91
  string refresh_token = 1;
@@ -152,3 +184,8 @@ message UserProfile {
152
184
  optional string display_name = 4;
153
185
  }
154
186
 
187
+ enum Role {
188
+ USER = 0;
189
+ ADMIN = 1;
190
+ }
191
+