@platfformx/proto-contracts 1.1.1 → 1.1.3

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,5 +1,11 @@
1
1
  import { Observable } from "rxjs";
2
2
  export declare const protobufPackage = "auth_service.v1";
3
+ export declare enum Role {
4
+ USER = 0,
5
+ ADMIN = 1,
6
+ UNRECOGNIZED = -1
7
+ }
8
+ /** Get account */
3
9
  export interface GetAccountRequest {
4
10
  userId: string;
5
11
  }
@@ -10,7 +16,9 @@ export interface GetAccountResponse {
10
16
  username?: string | undefined;
11
17
  isPhoneVerified: boolean;
12
18
  isEmailVerified: boolean;
19
+ role: Role;
13
20
  }
21
+ /** init + change email */
14
22
  export interface InitEmailChangeRequest {
15
23
  userId: string;
16
24
  email: string;
@@ -18,13 +26,6 @@ export interface InitEmailChangeRequest {
18
26
  export interface InitEmailChangeResponse {
19
27
  verificationId: string;
20
28
  }
21
- export interface InitPhoneChangeRequest {
22
- userId: string;
23
- phone: string;
24
- }
25
- export interface InitPhoneChangeResponse {
26
- verificationId: string;
27
- }
28
29
  export interface ConfirmEmailChangeRequest {
29
30
  userId: string;
30
31
  email: string;
@@ -32,6 +33,15 @@ export interface ConfirmEmailChangeRequest {
32
33
  code: string;
33
34
  }
34
35
  export interface ConfirmEmailChangeResponse {
36
+ ok: boolean;
37
+ }
38
+ /** init + change phone */
39
+ export interface InitPhoneChangeRequest {
40
+ userId: string;
41
+ phone: string;
42
+ }
43
+ export interface InitPhoneChangeResponse {
44
+ verificationId: string;
35
45
  }
36
46
  export interface ConfirmPhoneChangeRequest {
37
47
  userId: string;
@@ -40,30 +50,29 @@ export interface ConfirmPhoneChangeRequest {
40
50
  code: string;
41
51
  }
42
52
  export interface ConfirmPhoneChangeResponse {
53
+ ok: boolean;
43
54
  }
44
- export interface PatchAccountRequest {
55
+ /** update profile */
56
+ export interface UpdateProfileRequest {
45
57
  userId: string;
46
58
  username?: string | undefined;
47
59
  displayName?: string | undefined;
48
- email?: string | undefined;
49
- phone?: string | undefined;
50
60
  }
51
- export interface PatchAccountResponse {
61
+ export interface UpdateProfileResponse {
52
62
  userId: string;
53
63
  username?: string | undefined;
54
64
  displayName?: string | undefined;
55
- phone?: string | undefined;
56
- email?: string | undefined;
57
- isPhoneVerified: boolean;
58
- isEmailVerified: boolean;
59
65
  }
66
+ /** change password */
60
67
  export interface ChangePasswordRequest {
61
68
  userId: string;
62
69
  oldPassword: string;
63
70
  newPasword: string;
64
71
  }
65
72
  export interface ChangePasswordResponse {
73
+ ok: boolean;
66
74
  }
75
+ /** link oauth */
67
76
  export interface LinkOAuthRequest {
68
77
  userId: string;
69
78
  oauthToken: string;
@@ -73,7 +82,7 @@ export interface LinkOAuthResponse {
73
82
  export declare const AUTH_SERVICE_V1_PACKAGE_NAME = "auth_service.v1";
74
83
  export interface AccountServiceClient {
75
84
  getAccount(request: GetAccountRequest): Observable<GetAccountResponse>;
76
- patchAccount(request: PatchAccountRequest): Observable<PatchAccountResponse>;
85
+ updateProfile(request: UpdateProfileRequest): Observable<UpdateProfileRequest>;
77
86
  initEmailChange(request: InitEmailChangeRequest): Observable<InitEmailChangeResponse>;
78
87
  initPhoneChange(request: InitPhoneChangeRequest): Observable<InitPhoneChangeResponse>;
79
88
  confirmEmailChange(request: ConfirmEmailChangeRequest): Observable<ConfirmEmailChangeResponse>;
@@ -82,7 +91,7 @@ export interface AccountServiceClient {
82
91
  }
83
92
  export interface AccountServiceController {
84
93
  getAccount(request: GetAccountRequest): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
85
- patchAccount(request: PatchAccountRequest): Promise<PatchAccountResponse> | Observable<PatchAccountResponse> | PatchAccountResponse;
94
+ updateProfile(request: UpdateProfileRequest): Promise<UpdateProfileRequest> | Observable<UpdateProfileRequest> | UpdateProfileRequest;
86
95
  initEmailChange(request: InitEmailChangeRequest): Promise<InitEmailChangeResponse> | Observable<InitEmailChangeResponse> | InitEmailChangeResponse;
87
96
  initPhoneChange(request: InitPhoneChangeRequest): Promise<InitPhoneChangeResponse> | Observable<InitPhoneChangeResponse> | InitPhoneChangeResponse;
88
97
  confirmEmailChange(request: ConfirmEmailChangeRequest): Promise<ConfirmEmailChangeResponse> | Observable<ConfirmEmailChangeResponse> | ConfirmEmailChangeResponse;
@@ -5,17 +5,23 @@
5
5
  // protoc v7.34.0
6
6
  // source: auth-service/account.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.ACCOUNT_SERVICE_NAME = exports.AUTH_SERVICE_V1_PACKAGE_NAME = exports.protobufPackage = void 0;
8
+ exports.ACCOUNT_SERVICE_NAME = exports.AUTH_SERVICE_V1_PACKAGE_NAME = exports.Role = exports.protobufPackage = void 0;
9
9
  exports.AccountServiceControllerMethods = AccountServiceControllerMethods;
10
10
  /* eslint-disable */
11
11
  const microservices_1 = require("@nestjs/microservices");
12
12
  exports.protobufPackage = "auth_service.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 = {}));
13
19
  exports.AUTH_SERVICE_V1_PACKAGE_NAME = "auth_service.v1";
14
20
  function AccountServiceControllerMethods() {
15
21
  return function (constructor) {
16
22
  const grpcMethods = [
17
23
  "getAccount",
18
- "patchAccount",
24
+ "updateProfile",
19
25
  "initEmailChange",
20
26
  "initPhoneChange",
21
27
  "confirmEmailChange",
@@ -39,6 +39,14 @@ export interface OAuthSessionResponse {
39
39
  user: UserProfile | undefined;
40
40
  isNewUser: boolean;
41
41
  }
42
+ /** Logout */
43
+ export interface LogoutRequest {
44
+ userId: string;
45
+ accessToken: string;
46
+ }
47
+ export interface LogoutResponse {
48
+ success: boolean;
49
+ }
42
50
  /** Tokens */
43
51
  export interface TokenRefreshRequest {
44
52
  refreshToken: string;
@@ -55,6 +63,12 @@ export interface ConfirmAccountRequest {
55
63
  export interface ConfirmAccountResponse {
56
64
  verified: boolean;
57
65
  }
66
+ export interface ResendVerificationRequest {
67
+ identifier: string;
68
+ }
69
+ export interface ResendVerificationResponse {
70
+ sent: boolean;
71
+ }
58
72
  export interface AddIdentifierRequest {
59
73
  userId: string;
60
74
  identifier: string;
@@ -105,8 +119,10 @@ export interface AuthServiceClient {
105
119
  createAccount(request: CreateAccountRequest): Observable<CreateAccountResponse>;
106
120
  authenticate(request: AuthenticationRequest): Observable<AuthenticationResponse>;
107
121
  authenticateWithOAuth(request: OAuthSessionRequest): Observable<OAuthSessionResponse>;
122
+ logout(request: LogoutRequest): Observable<LogoutResponse>;
108
123
  refreshTokens(request: TokenRefreshRequest): Observable<TokenRefreshResponse>;
109
124
  confirmAccount(request: ConfirmAccountRequest): Observable<ConfirmAccountResponse>;
125
+ resendVerification(request: ResendVerificationRequest): Observable<ResendVerificationResponse>;
110
126
  resetPassword(request: ResetPasswordRequest): Observable<ResetPasswordResponse>;
111
127
  forgotPassword(request: ForgotPasswordRequest): Observable<ForgotPasswordResponse>;
112
128
  addIdentifier(request: AddIdentifierRequest): Observable<AddIdentifierResponse>;
@@ -115,8 +131,10 @@ export interface AuthServiceController {
115
131
  createAccount(request: CreateAccountRequest): Promise<CreateAccountResponse> | Observable<CreateAccountResponse> | CreateAccountResponse;
116
132
  authenticate(request: AuthenticationRequest): Promise<AuthenticationResponse> | Observable<AuthenticationResponse> | AuthenticationResponse;
117
133
  authenticateWithOAuth(request: OAuthSessionRequest): Promise<OAuthSessionResponse> | Observable<OAuthSessionResponse> | OAuthSessionResponse;
134
+ logout(request: LogoutRequest): Promise<LogoutResponse> | Observable<LogoutResponse> | LogoutResponse;
118
135
  refreshTokens(request: TokenRefreshRequest): Promise<TokenRefreshResponse> | Observable<TokenRefreshResponse> | TokenRefreshResponse;
119
136
  confirmAccount(request: ConfirmAccountRequest): Promise<ConfirmAccountResponse> | Observable<ConfirmAccountResponse> | ConfirmAccountResponse;
137
+ resendVerification(request: ResendVerificationRequest): Promise<ResendVerificationResponse> | Observable<ResendVerificationResponse> | ResendVerificationResponse;
120
138
  resetPassword(request: ResetPasswordRequest): Promise<ResetPasswordResponse> | Observable<ResetPasswordResponse> | ResetPasswordResponse;
121
139
  forgotPassword(request: ForgotPasswordRequest): Promise<ForgotPasswordResponse> | Observable<ForgotPasswordResponse> | ForgotPasswordResponse;
122
140
  addIdentifier(request: AddIdentifierRequest): Promise<AddIdentifierResponse> | Observable<AddIdentifierResponse> | AddIdentifierResponse;
@@ -25,8 +25,10 @@ function AuthServiceControllerMethods() {
25
25
  "createAccount",
26
26
  "authenticate",
27
27
  "authenticateWithOAuth",
28
+ "logout",
28
29
  "refreshTokens",
29
30
  "confirmAccount",
31
+ "resendVerification",
30
32
  "resetPassword",
31
33
  "forgotPassword",
32
34
  "addIdentifier",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platfformx/proto-contracts",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -4,7 +4,7 @@ package auth_service.v1;
4
4
 
5
5
  service AccountService {
6
6
  rpc GetAccount (GetAccountRequest) returns (GetAccountResponse);
7
- rpc PatchAccount (PatchAccountRequest) returns (PatchAccountResponse);
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,6 +12,8 @@ service AccountService {
12
12
  rpc LinkOAuth (LinkOAuthRequest) returns (LinkOAuthResponse);
13
13
  }
14
14
 
15
+
16
+ // Get account
15
17
  message GetAccountRequest {
16
18
  string user_id = 1;
17
19
  }
@@ -23,31 +25,20 @@ message GetAccountResponse {
23
25
  optional string username = 4;
24
26
  bool is_phone_verified = 5;
25
27
  bool is_email_verified = 6;
28
+ Role role = 7;
26
29
  }
27
30
 
28
31
 
32
+ // init + change email
29
33
  message InitEmailChangeRequest {
30
34
  string user_id = 1;
31
35
  string email = 2;
32
36
  }
33
37
 
34
-
35
38
  message InitEmailChangeResponse {
36
39
  string verification_id = 2;
37
40
  }
38
41
 
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
42
  message ConfirmEmailChangeRequest {
52
43
  string user_id = 1;
53
44
  string email = 2;
@@ -55,10 +46,21 @@ message ConfirmEmailChangeRequest {
55
46
  string code = 4;
56
47
 
57
48
  }
58
- message ConfirmEmailChangeResponse {
59
49
 
50
+ message ConfirmEmailChangeResponse {
51
+ bool ok = 1;
60
52
  }
61
53
 
54
+ // init + change phone
55
+ message InitPhoneChangeRequest {
56
+ string user_id = 1;
57
+ string phone = 2;
58
+ }
59
+
60
+ message InitPhoneChangeResponse {
61
+ string verification_id = 1;
62
+ }
63
+
62
64
  message ConfirmPhoneChangeRequest {
63
65
  string user_id = 1;
64
66
  string phone = 2;
@@ -67,40 +69,46 @@ message ConfirmPhoneChangeRequest {
67
69
  }
68
70
 
69
71
  message ConfirmPhoneChangeResponse {
70
-
72
+ bool ok = 1;
71
73
  }
72
74
 
73
- message PatchAccountRequest {
75
+
76
+ // update profile
77
+ message UpdateProfileRequest {
74
78
  string user_id = 1;
75
79
  optional string username = 2;
76
80
  optional string display_name = 3;
77
- optional string email = 4;
78
- optional string phone = 5;
79
81
 
80
82
  }
81
- message PatchAccountResponse {
83
+ message UpdateProfileResponse {
82
84
  string user_id = 1;
83
85
  optional string username = 2;
84
86
  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
87
  }
90
88
 
89
+
90
+ // change password
91
91
  message ChangePasswordRequest {
92
92
  string user_id = 1;
93
93
  string old_password = 2;
94
94
  string new_pasword = 3;
95
95
  }
96
96
  message ChangePasswordResponse {
97
-
97
+ bool ok = 1;
98
98
  }
99
99
 
100
+
101
+ // link oauth
100
102
  message LinkOAuthRequest {
101
103
  string user_id = 1;
102
104
  string oauth_token = 2;
103
105
  }
104
106
  message LinkOAuthResponse {
105
107
 
106
- }
108
+ }
109
+
110
+ enum Role {
111
+ USER = 0;
112
+ ADMIN = 1;
113
+ }
114
+
@@ -6,10 +6,12 @@ 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);
9
10
  rpc RefreshTokens (TokenRefreshRequest) returns (TokenRefreshResponse);
10
11
 
11
12
  rpc ConfirmAccount (ConfirmAccountRequest) returns (ConfirmAccountResponse);
12
-
13
+ rpc ResendVerification (ResendVerificationRequest) returns (ResendVerificationResponse);
14
+
13
15
  rpc ResetPassword (ResetPasswordRequest) returns (ResetPasswordResponse);
14
16
  rpc ForgotPassword (ForgotPasswordRequest) returns (ForgotPasswordResponse);
15
17
 
@@ -53,6 +55,18 @@ message OAuthSessionResponse {
53
55
  UserProfile user = 4;
54
56
  bool is_new_user = 5;
55
57
  }
58
+
59
+ // Logout
60
+ message LogoutRequest {
61
+ string user_id = 1;
62
+ string access_token = 2;
63
+ }
64
+
65
+ message LogoutResponse {
66
+ bool success = 1;
67
+ }
68
+
69
+
56
70
  // Tokens
57
71
  message TokenRefreshRequest {
58
72
  string refresh_token = 1;
@@ -63,6 +77,8 @@ message TokenRefreshResponse {
63
77
  string refresh_token = 2;
64
78
  }
65
79
 
80
+ // Verification
81
+
66
82
  message ConfirmAccountRequest {
67
83
  string identifier = 1;
68
84
  oneof confirm_method {
@@ -74,6 +90,14 @@ message ConfirmAccountResponse {
74
90
  bool verified = 1;
75
91
  }
76
92
 
93
+ message ResendVerificationRequest {
94
+ string identifier = 1;
95
+ }
96
+ message ResendVerificationResponse {
97
+ bool sent = 1;
98
+ }
99
+
100
+
77
101
 
78
102
  message AddIdentifierRequest {
79
103
  string user_id = 1;