@wenlarge/ostrol-communication 0.6.1 → 0.7.0
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/generated/auth.d.ts +34 -0
- package/dist/generated/auth.js +4 -0
- package/package.json +2 -2
- package/proto/auth.proto +27 -0
- package/src/generated/auth.ts +53 -0
package/dist/generated/auth.d.ts
CHANGED
|
@@ -66,6 +66,32 @@ export interface OAuthLoginRequest {
|
|
|
66
66
|
export interface RefreshTokenRequest {
|
|
67
67
|
refreshToken: string;
|
|
68
68
|
}
|
|
69
|
+
export interface LogoutRequest {
|
|
70
|
+
/** caller, from gateway (authenticated route) */
|
|
71
|
+
userId: string;
|
|
72
|
+
/** session to revoke; may be empty with allDevices */
|
|
73
|
+
refreshToken: string;
|
|
74
|
+
/** revoke EVERY refresh token of the user */
|
|
75
|
+
allDevices: boolean;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Doubles as "set password" for OAuth-only accounts: when the account has no
|
|
79
|
+
* password yet, currentPassword must be empty and is not checked.
|
|
80
|
+
*/
|
|
81
|
+
export interface ChangePasswordRequest {
|
|
82
|
+
/** caller, from gateway (authenticated route) */
|
|
83
|
+
userId: string;
|
|
84
|
+
currentPassword: string;
|
|
85
|
+
newPassword: string;
|
|
86
|
+
}
|
|
87
|
+
export interface ForgotPasswordRequest {
|
|
88
|
+
email: string;
|
|
89
|
+
}
|
|
90
|
+
export interface ResetPasswordRequest {
|
|
91
|
+
/** single-use token from the reset email */
|
|
92
|
+
token: string;
|
|
93
|
+
newPassword: string;
|
|
94
|
+
}
|
|
69
95
|
export interface UpdateProfileRequest {
|
|
70
96
|
/**
|
|
71
97
|
* Partial update: every field except userId is `optional` so absence is
|
|
@@ -108,6 +134,10 @@ export interface AuthServiceClient {
|
|
|
108
134
|
login(request: LoginRequest, metadata?: Metadata): Observable<AuthResponse>;
|
|
109
135
|
oAuthLogin(request: OAuthLoginRequest, metadata?: Metadata): Observable<AuthResponse>;
|
|
110
136
|
refreshToken(request: RefreshTokenRequest, metadata?: Metadata): Observable<AuthResponse>;
|
|
137
|
+
logout(request: LogoutRequest, metadata?: Metadata): Observable<Empty>;
|
|
138
|
+
changePassword(request: ChangePasswordRequest, metadata?: Metadata): Observable<AuthResponse>;
|
|
139
|
+
forgotPassword(request: ForgotPasswordRequest, metadata?: Metadata): Observable<Empty>;
|
|
140
|
+
resetPassword(request: ResetPasswordRequest, metadata?: Metadata): Observable<Empty>;
|
|
111
141
|
updateProfile(request: UpdateProfileRequest, metadata?: Metadata): Observable<AuthResponse>;
|
|
112
142
|
oAuthLink(request: OAuthLinkRequest, metadata?: Metadata): Observable<Empty>;
|
|
113
143
|
oAuthUnlink(request: OAuthUnlinkRequest, metadata?: Metadata): Observable<Empty>;
|
|
@@ -120,6 +150,10 @@ export interface AuthServiceController {
|
|
|
120
150
|
login(request: LoginRequest, metadata?: Metadata): Promise<AuthResponse> | Observable<AuthResponse> | AuthResponse;
|
|
121
151
|
oAuthLogin(request: OAuthLoginRequest, metadata?: Metadata): Promise<AuthResponse> | Observable<AuthResponse> | AuthResponse;
|
|
122
152
|
refreshToken(request: RefreshTokenRequest, metadata?: Metadata): Promise<AuthResponse> | Observable<AuthResponse> | AuthResponse;
|
|
153
|
+
logout(request: LogoutRequest, metadata?: Metadata): void;
|
|
154
|
+
changePassword(request: ChangePasswordRequest, metadata?: Metadata): Promise<AuthResponse> | Observable<AuthResponse> | AuthResponse;
|
|
155
|
+
forgotPassword(request: ForgotPasswordRequest, metadata?: Metadata): void;
|
|
156
|
+
resetPassword(request: ResetPasswordRequest, metadata?: Metadata): void;
|
|
123
157
|
updateProfile(request: UpdateProfileRequest, metadata?: Metadata): Promise<AuthResponse> | Observable<AuthResponse> | AuthResponse;
|
|
124
158
|
oAuthLink(request: OAuthLinkRequest, metadata?: Metadata): void;
|
|
125
159
|
oAuthUnlink(request: OAuthUnlinkRequest, metadata?: Metadata): void;
|
package/dist/generated/auth.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wenlarge/ostrol-communication",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Shared gRPC proto contracts, generated clients and Kafka helpers for Ostrol microservices.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -46,4 +46,4 @@
|
|
|
46
46
|
"@nestjs/common": "^10.x",
|
|
47
47
|
"@nestjs/microservices": "^10.x"
|
|
48
48
|
}
|
|
49
|
-
}
|
|
49
|
+
}
|
package/proto/auth.proto
CHANGED
|
@@ -10,6 +10,10 @@ service AuthService {
|
|
|
10
10
|
rpc Login (LoginRequest) returns (AuthResponse);
|
|
11
11
|
rpc OAuthLogin (OAuthLoginRequest) returns (AuthResponse);
|
|
12
12
|
rpc RefreshToken (RefreshTokenRequest) returns (AuthResponse);
|
|
13
|
+
rpc Logout (LogoutRequest) returns (google.protobuf.Empty);
|
|
14
|
+
rpc ChangePassword (ChangePasswordRequest) returns (AuthResponse);
|
|
15
|
+
rpc ForgotPassword (ForgotPasswordRequest) returns (google.protobuf.Empty);
|
|
16
|
+
rpc ResetPassword (ResetPasswordRequest) returns (google.protobuf.Empty);
|
|
13
17
|
rpc UpdateProfile (UpdateProfileRequest) returns (AuthResponse);
|
|
14
18
|
rpc OAuthLink (OAuthLinkRequest) returns (google.protobuf.Empty);
|
|
15
19
|
rpc OAuthUnlink (OAuthUnlinkRequest) returns (google.protobuf.Empty);
|
|
@@ -81,6 +85,29 @@ message RefreshTokenRequest {
|
|
|
81
85
|
string refreshToken = 1;
|
|
82
86
|
}
|
|
83
87
|
|
|
88
|
+
message LogoutRequest {
|
|
89
|
+
string userId = 1; // caller, from gateway (authenticated route)
|
|
90
|
+
string refreshToken = 2; // session to revoke; may be empty with allDevices
|
|
91
|
+
bool allDevices = 3; // revoke EVERY refresh token of the user
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Doubles as "set password" for OAuth-only accounts: when the account has no
|
|
95
|
+
// password yet, currentPassword must be empty and is not checked.
|
|
96
|
+
message ChangePasswordRequest {
|
|
97
|
+
string userId = 1; // caller, from gateway (authenticated route)
|
|
98
|
+
string currentPassword = 2;
|
|
99
|
+
string newPassword = 3;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
message ForgotPasswordRequest {
|
|
103
|
+
string email = 1;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
message ResetPasswordRequest {
|
|
107
|
+
string token = 1; // single-use token from the reset email
|
|
108
|
+
string newPassword = 2;
|
|
109
|
+
}
|
|
110
|
+
|
|
84
111
|
message UpdateProfileRequest {
|
|
85
112
|
reserved 4; // was `birthTimezone`; timezone is derived from lat/lng in astro-engine
|
|
86
113
|
reserved "birthTimezone";
|
package/src/generated/auth.ts
CHANGED
|
@@ -84,6 +84,36 @@ export interface RefreshTokenRequest {
|
|
|
84
84
|
refreshToken: string;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
export interface LogoutRequest {
|
|
88
|
+
/** caller, from gateway (authenticated route) */
|
|
89
|
+
userId: string;
|
|
90
|
+
/** session to revoke; may be empty with allDevices */
|
|
91
|
+
refreshToken: string;
|
|
92
|
+
/** revoke EVERY refresh token of the user */
|
|
93
|
+
allDevices: boolean;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Doubles as "set password" for OAuth-only accounts: when the account has no
|
|
98
|
+
* password yet, currentPassword must be empty and is not checked.
|
|
99
|
+
*/
|
|
100
|
+
export interface ChangePasswordRequest {
|
|
101
|
+
/** caller, from gateway (authenticated route) */
|
|
102
|
+
userId: string;
|
|
103
|
+
currentPassword: string;
|
|
104
|
+
newPassword: string;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface ForgotPasswordRequest {
|
|
108
|
+
email: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface ResetPasswordRequest {
|
|
112
|
+
/** single-use token from the reset email */
|
|
113
|
+
token: string;
|
|
114
|
+
newPassword: string;
|
|
115
|
+
}
|
|
116
|
+
|
|
87
117
|
export interface UpdateProfileRequest {
|
|
88
118
|
/**
|
|
89
119
|
* Partial update: every field except userId is `optional` so absence is
|
|
@@ -139,6 +169,14 @@ export interface AuthServiceClient {
|
|
|
139
169
|
|
|
140
170
|
refreshToken(request: RefreshTokenRequest, metadata?: Metadata): Observable<AuthResponse>;
|
|
141
171
|
|
|
172
|
+
logout(request: LogoutRequest, metadata?: Metadata): Observable<Empty>;
|
|
173
|
+
|
|
174
|
+
changePassword(request: ChangePasswordRequest, metadata?: Metadata): Observable<AuthResponse>;
|
|
175
|
+
|
|
176
|
+
forgotPassword(request: ForgotPasswordRequest, metadata?: Metadata): Observable<Empty>;
|
|
177
|
+
|
|
178
|
+
resetPassword(request: ResetPasswordRequest, metadata?: Metadata): Observable<Empty>;
|
|
179
|
+
|
|
142
180
|
updateProfile(request: UpdateProfileRequest, metadata?: Metadata): Observable<AuthResponse>;
|
|
143
181
|
|
|
144
182
|
oAuthLink(request: OAuthLinkRequest, metadata?: Metadata): Observable<Empty>;
|
|
@@ -170,6 +208,17 @@ export interface AuthServiceController {
|
|
|
170
208
|
metadata?: Metadata,
|
|
171
209
|
): Promise<AuthResponse> | Observable<AuthResponse> | AuthResponse;
|
|
172
210
|
|
|
211
|
+
logout(request: LogoutRequest, metadata?: Metadata): void;
|
|
212
|
+
|
|
213
|
+
changePassword(
|
|
214
|
+
request: ChangePasswordRequest,
|
|
215
|
+
metadata?: Metadata,
|
|
216
|
+
): Promise<AuthResponse> | Observable<AuthResponse> | AuthResponse;
|
|
217
|
+
|
|
218
|
+
forgotPassword(request: ForgotPasswordRequest, metadata?: Metadata): void;
|
|
219
|
+
|
|
220
|
+
resetPassword(request: ResetPasswordRequest, metadata?: Metadata): void;
|
|
221
|
+
|
|
173
222
|
updateProfile(
|
|
174
223
|
request: UpdateProfileRequest,
|
|
175
224
|
metadata?: Metadata,
|
|
@@ -193,6 +242,10 @@ export function AuthServiceControllerMethods() {
|
|
|
193
242
|
"login",
|
|
194
243
|
"oAuthLogin",
|
|
195
244
|
"refreshToken",
|
|
245
|
+
"logout",
|
|
246
|
+
"changePassword",
|
|
247
|
+
"forgotPassword",
|
|
248
|
+
"resetPassword",
|
|
196
249
|
"updateProfile",
|
|
197
250
|
"oAuthLink",
|
|
198
251
|
"oAuthUnlink",
|