@aepstore-dev/contracts 1.67.0 → 1.68.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/gen/activity.js +1 -1
- package/gen/activity.ts +270 -270
- package/gen/auth.js +1 -1
- package/gen/auth.ts +323 -323
- package/gen/mail.js +1 -1
- package/gen/mail.ts +121 -121
- package/gen/payments.js +1 -1
- package/gen/payments.ts +1048 -1048
- package/gen/products.d.ts +2 -4
- package/gen/products.ts +2 -4
- package/gen/taxonomy.js +1 -1
- package/gen/taxonomy.ts +185 -185
- package/gen/upload.js +1 -1
- package/gen/upload.ts +287 -287
- package/gen/users.js +1 -1
- package/gen/users.ts +1026 -1026
- package/package.json +1 -1
- package/proto/products.proto +4 -4
package/gen/auth.ts
CHANGED
|
@@ -1,323 +1,323 @@
|
|
|
1
|
-
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
-
// versions:
|
|
3
|
-
// protoc-gen-ts_proto v2.10.1
|
|
4
|
-
// protoc v7.35.
|
|
5
|
-
// source: auth.proto
|
|
6
|
-
|
|
7
|
-
/* eslint-disable */
|
|
8
|
-
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
-
import { Observable } from "rxjs";
|
|
10
|
-
|
|
11
|
-
export const protobufPackage = "auth.v1";
|
|
12
|
-
|
|
13
|
-
export enum TwoFactorType {
|
|
14
|
-
NONE = 0,
|
|
15
|
-
APP = 1,
|
|
16
|
-
EMAIL = 2,
|
|
17
|
-
UNRECOGNIZED = -1,
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/** Login by username OR email (one of the two must be set). */
|
|
21
|
-
export interface LoginRequest {
|
|
22
|
-
password: string;
|
|
23
|
-
/** username OR email — resolved by the service */
|
|
24
|
-
credentials: string;
|
|
25
|
-
/**
|
|
26
|
-
* Gateway-supplied audit context. LoginEvent rows for LOGIN /
|
|
27
|
-
* PASSWORD_FAIL get the same ip/user-agent that REFRESH and RESTORE
|
|
28
|
-
* already carry; the gRPC layer has no transport-level access to
|
|
29
|
-
* either, so the gateway extracts them from the HTTP request.
|
|
30
|
-
*/
|
|
31
|
-
userAgent: string;
|
|
32
|
-
ip: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface RegisterRequest {
|
|
36
|
-
email: string;
|
|
37
|
-
username: string;
|
|
38
|
-
password: string;
|
|
39
|
-
/** optional, attached by gateway from req */
|
|
40
|
-
ip: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/** type ∈ { twofa, reset, totp_generate, totp_activate, confirm } (legacy strings) */
|
|
44
|
-
export interface CreateCodeRequest {
|
|
45
|
-
email: string;
|
|
46
|
-
type: string;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* type ∈ { twofa, twofa_deactivate, reset, totp, totp_deactivate, backup, confirm }
|
|
51
|
-
* new_password is only used by the 'reset' flow.
|
|
52
|
-
*/
|
|
53
|
-
export interface VerifyCodeRequest {
|
|
54
|
-
email: string;
|
|
55
|
-
code: string;
|
|
56
|
-
type: string;
|
|
57
|
-
/** optional */
|
|
58
|
-
newPassword: string;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface CheckTokenRequest {
|
|
62
|
-
token: string;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface RefreshTokenRequest {
|
|
66
|
-
refreshToken: string;
|
|
67
|
-
/** optional */
|
|
68
|
-
userAgent: string;
|
|
69
|
-
/** optional */
|
|
70
|
-
ip: string;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export interface Get2faStatusRequest {
|
|
74
|
-
username: string;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export interface GetProfileRequest {
|
|
78
|
-
userId: string;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface AuthUser {
|
|
82
|
-
id: string;
|
|
83
|
-
username: string;
|
|
84
|
-
email: string;
|
|
85
|
-
avatarUrl: string;
|
|
86
|
-
bannerUrl: string;
|
|
87
|
-
roles: string[];
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Unified result for login/register/createCode/verifyCode/refresh. Which fields
|
|
92
|
-
* are populated depends on the flow:
|
|
93
|
-
* - fully authenticated → access_token + refresh_token + expires_in + user
|
|
94
|
-
* - 2FA required / pending confirm → message + two_factor_required + two_factor_type + user (no tokens)
|
|
95
|
-
* - totp_generate → secret + otpauth + qr (+ user)
|
|
96
|
-
* - totp_activate → backup_codes (+ tokens/user)
|
|
97
|
-
*/
|
|
98
|
-
export interface AuthResult {
|
|
99
|
-
accessToken: string;
|
|
100
|
-
refreshToken: string;
|
|
101
|
-
expiresIn: number;
|
|
102
|
-
user: AuthUser | undefined;
|
|
103
|
-
message: string;
|
|
104
|
-
/**
|
|
105
|
-
* Renamed from `requires_2fa` in 1.52.0: the digit-after-underscore broke
|
|
106
|
-
* the grpc proto-loader's camelCase pass (`_2` isn't `_<letter>`), so the
|
|
107
|
-
* wire key stayed snake_case and never matched the camelCase handler output
|
|
108
|
-
* → always serialised false. `two_factor_required` camelCases cleanly to
|
|
109
|
-
* `twoFactorRequired` on every layer. Field number 6 is unchanged (wire-
|
|
110
|
-
* compatible).
|
|
111
|
-
*/
|
|
112
|
-
twoFactorRequired: boolean;
|
|
113
|
-
twoFactorType: TwoFactorType;
|
|
114
|
-
/** TOTP setup extras */
|
|
115
|
-
secret: string;
|
|
116
|
-
otpauth: string;
|
|
117
|
-
/** data URL (PNG) */
|
|
118
|
-
qr: string;
|
|
119
|
-
backupCodes: string[];
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export interface TwoFactorStatusResponse {
|
|
123
|
-
twoFactorType: TwoFactorType;
|
|
124
|
-
has2fa: boolean;
|
|
125
|
-
isVerified: boolean;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export interface Empty {
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export interface LogoutCurrentRequest {
|
|
132
|
-
refreshToken: string;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export interface LogoutAllRequest {
|
|
136
|
-
userId: string;
|
|
137
|
-
/**
|
|
138
|
-
* Current session's refresh token — excluded from the wipe so "log out
|
|
139
|
-
* everywhere" keeps THIS device signed in. Empty = revoke every session.
|
|
140
|
-
*/
|
|
141
|
-
refreshToken: string;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export interface LogoutResponse {
|
|
145
|
-
ok: boolean;
|
|
146
|
-
/** number of refresh-token rows deleted */
|
|
147
|
-
removed: number;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export interface RestoreLoginRequest {
|
|
151
|
-
/** email or username */
|
|
152
|
-
credentials: string;
|
|
153
|
-
password: string;
|
|
154
|
-
userAgent: string;
|
|
155
|
-
ip: string;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export interface ListLoginHistoryRequest {
|
|
159
|
-
userId: string;
|
|
160
|
-
page: number;
|
|
161
|
-
limit: number;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export interface LoginEventRow {
|
|
165
|
-
id: string;
|
|
166
|
-
/** LOGIN | LOGOUT | REFRESH | TWO_FA_FAIL | PASSWORD_FAIL | BLOCKED | RESTORE */
|
|
167
|
-
type: string;
|
|
168
|
-
success: boolean;
|
|
169
|
-
reason: string;
|
|
170
|
-
ip: string;
|
|
171
|
-
userAgent: string;
|
|
172
|
-
createdAt: string;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export interface ListLoginHistoryResponse {
|
|
176
|
-
items: LoginEventRow[];
|
|
177
|
-
total: number;
|
|
178
|
-
page: number;
|
|
179
|
-
limit: number;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Ported from legacy auth-service (@MessagePattern → @GrpcMethod).
|
|
186
|
-
* Tokens are HMAC primitives from @aepstore-dev/passport:
|
|
187
|
-
* - access token: short TTL, carries userId; the gateway validates it
|
|
188
|
-
* locally via PassportAuthGuard (no round-trip here).
|
|
189
|
-
* - refresh token: long TTL HMAC + a RefreshToken DB row (device list +
|
|
190
|
-
* revocation). Refresh verifies the HMAC AND that the row still exists.
|
|
191
|
-
*/
|
|
192
|
-
|
|
193
|
-
export interface AuthServiceClient {
|
|
194
|
-
login(request: LoginRequest): Observable<AuthResult>;
|
|
195
|
-
|
|
196
|
-
register(request: RegisterRequest): Observable<AuthResult>;
|
|
197
|
-
|
|
198
|
-
createCode(request: CreateCodeRequest): Observable<AuthResult>;
|
|
199
|
-
|
|
200
|
-
verifyCode(request: VerifyCodeRequest): Observable<AuthResult>;
|
|
201
|
-
|
|
202
|
-
checkToken(request: CheckTokenRequest): Observable<AuthUser>;
|
|
203
|
-
|
|
204
|
-
refreshToken(request: RefreshTokenRequest): Observable<AuthResult>;
|
|
205
|
-
|
|
206
|
-
get2FaStatus(request: Get2faStatusRequest): Observable<TwoFactorStatusResponse>;
|
|
207
|
-
|
|
208
|
-
getProfile(request: GetProfileRequest): Observable<AuthUser>;
|
|
209
|
-
|
|
210
|
-
cleanupExpiredTotpSetups(request: Empty): Observable<Empty>;
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Logout — kill refresh tokens. LogoutCurrent kills only the one whose
|
|
214
|
-
* HMAC matches; LogoutAll wipes every row for the user.
|
|
215
|
-
*/
|
|
216
|
-
|
|
217
|
-
logoutCurrent(request: LogoutCurrentRequest): Observable<LogoutResponse>;
|
|
218
|
-
|
|
219
|
-
logoutAll(request: LogoutAllRequest): Observable<LogoutResponse>;
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Self-service restore. Verifies credentials + password against a
|
|
223
|
-
* soft-deleted user, clears deletedAt/scheduledForHardDelete, and issues
|
|
224
|
-
* fresh tokens — the one auth path that DOES read deletedAt accounts.
|
|
225
|
-
*/
|
|
226
|
-
|
|
227
|
-
restoreLogin(request: RestoreLoginRequest): Observable<AuthResult>;
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Login history. Read-only audit feed for the settings page; rows come
|
|
231
|
-
* from LoginEvent. Internal alternative: tasks-service GC.
|
|
232
|
-
*/
|
|
233
|
-
|
|
234
|
-
listLoginHistory(request: ListLoginHistoryRequest): Observable<ListLoginHistoryResponse>;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Ported from legacy auth-service (@MessagePattern → @GrpcMethod).
|
|
239
|
-
* Tokens are HMAC primitives from @aepstore-dev/passport:
|
|
240
|
-
* - access token: short TTL, carries userId; the gateway validates it
|
|
241
|
-
* locally via PassportAuthGuard (no round-trip here).
|
|
242
|
-
* - refresh token: long TTL HMAC + a RefreshToken DB row (device list +
|
|
243
|
-
* revocation). Refresh verifies the HMAC AND that the row still exists.
|
|
244
|
-
*/
|
|
245
|
-
|
|
246
|
-
export interface AuthServiceController {
|
|
247
|
-
login(request: LoginRequest): Promise<AuthResult> | Observable<AuthResult> | AuthResult;
|
|
248
|
-
|
|
249
|
-
register(request: RegisterRequest): Promise<AuthResult> | Observable<AuthResult> | AuthResult;
|
|
250
|
-
|
|
251
|
-
createCode(request: CreateCodeRequest): Promise<AuthResult> | Observable<AuthResult> | AuthResult;
|
|
252
|
-
|
|
253
|
-
verifyCode(request: VerifyCodeRequest): Promise<AuthResult> | Observable<AuthResult> | AuthResult;
|
|
254
|
-
|
|
255
|
-
checkToken(request: CheckTokenRequest): Promise<AuthUser> | Observable<AuthUser> | AuthUser;
|
|
256
|
-
|
|
257
|
-
refreshToken(request: RefreshTokenRequest): Promise<AuthResult> | Observable<AuthResult> | AuthResult;
|
|
258
|
-
|
|
259
|
-
get2FaStatus(
|
|
260
|
-
request: Get2faStatusRequest,
|
|
261
|
-
): Promise<TwoFactorStatusResponse> | Observable<TwoFactorStatusResponse> | TwoFactorStatusResponse;
|
|
262
|
-
|
|
263
|
-
getProfile(request: GetProfileRequest): Promise<AuthUser> | Observable<AuthUser> | AuthUser;
|
|
264
|
-
|
|
265
|
-
cleanupExpiredTotpSetups(request: Empty): Promise<Empty> | Observable<Empty> | Empty;
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Logout — kill refresh tokens. LogoutCurrent kills only the one whose
|
|
269
|
-
* HMAC matches; LogoutAll wipes every row for the user.
|
|
270
|
-
*/
|
|
271
|
-
|
|
272
|
-
logoutCurrent(request: LogoutCurrentRequest): Promise<LogoutResponse> | Observable<LogoutResponse> | LogoutResponse;
|
|
273
|
-
|
|
274
|
-
logoutAll(request: LogoutAllRequest): Promise<LogoutResponse> | Observable<LogoutResponse> | LogoutResponse;
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Self-service restore. Verifies credentials + password against a
|
|
278
|
-
* soft-deleted user, clears deletedAt/scheduledForHardDelete, and issues
|
|
279
|
-
* fresh tokens — the one auth path that DOES read deletedAt accounts.
|
|
280
|
-
*/
|
|
281
|
-
|
|
282
|
-
restoreLogin(request: RestoreLoginRequest): Promise<AuthResult> | Observable<AuthResult> | AuthResult;
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Login history. Read-only audit feed for the settings page; rows come
|
|
286
|
-
* from LoginEvent. Internal alternative: tasks-service GC.
|
|
287
|
-
*/
|
|
288
|
-
|
|
289
|
-
listLoginHistory(
|
|
290
|
-
request: ListLoginHistoryRequest,
|
|
291
|
-
): Promise<ListLoginHistoryResponse> | Observable<ListLoginHistoryResponse> | ListLoginHistoryResponse;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
export function AuthServiceControllerMethods() {
|
|
295
|
-
return function (constructor: Function) {
|
|
296
|
-
const grpcMethods: string[] = [
|
|
297
|
-
"login",
|
|
298
|
-
"register",
|
|
299
|
-
"createCode",
|
|
300
|
-
"verifyCode",
|
|
301
|
-
"checkToken",
|
|
302
|
-
"refreshToken",
|
|
303
|
-
"get2FaStatus",
|
|
304
|
-
"getProfile",
|
|
305
|
-
"cleanupExpiredTotpSetups",
|
|
306
|
-
"logoutCurrent",
|
|
307
|
-
"logoutAll",
|
|
308
|
-
"restoreLogin",
|
|
309
|
-
"listLoginHistory",
|
|
310
|
-
];
|
|
311
|
-
for (const method of grpcMethods) {
|
|
312
|
-
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
313
|
-
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
314
|
-
}
|
|
315
|
-
const grpcStreamMethods: string[] = [];
|
|
316
|
-
for (const method of grpcStreamMethods) {
|
|
317
|
-
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
318
|
-
GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
319
|
-
}
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
export const AUTH_SERVICE_NAME = "AuthService";
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.10.1
|
|
4
|
+
// protoc v7.35.0
|
|
5
|
+
// source: auth.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "auth.v1";
|
|
12
|
+
|
|
13
|
+
export enum TwoFactorType {
|
|
14
|
+
NONE = 0,
|
|
15
|
+
APP = 1,
|
|
16
|
+
EMAIL = 2,
|
|
17
|
+
UNRECOGNIZED = -1,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Login by username OR email (one of the two must be set). */
|
|
21
|
+
export interface LoginRequest {
|
|
22
|
+
password: string;
|
|
23
|
+
/** username OR email — resolved by the service */
|
|
24
|
+
credentials: string;
|
|
25
|
+
/**
|
|
26
|
+
* Gateway-supplied audit context. LoginEvent rows for LOGIN /
|
|
27
|
+
* PASSWORD_FAIL get the same ip/user-agent that REFRESH and RESTORE
|
|
28
|
+
* already carry; the gRPC layer has no transport-level access to
|
|
29
|
+
* either, so the gateway extracts them from the HTTP request.
|
|
30
|
+
*/
|
|
31
|
+
userAgent: string;
|
|
32
|
+
ip: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface RegisterRequest {
|
|
36
|
+
email: string;
|
|
37
|
+
username: string;
|
|
38
|
+
password: string;
|
|
39
|
+
/** optional, attached by gateway from req */
|
|
40
|
+
ip: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** type ∈ { twofa, reset, totp_generate, totp_activate, confirm } (legacy strings) */
|
|
44
|
+
export interface CreateCodeRequest {
|
|
45
|
+
email: string;
|
|
46
|
+
type: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* type ∈ { twofa, twofa_deactivate, reset, totp, totp_deactivate, backup, confirm }
|
|
51
|
+
* new_password is only used by the 'reset' flow.
|
|
52
|
+
*/
|
|
53
|
+
export interface VerifyCodeRequest {
|
|
54
|
+
email: string;
|
|
55
|
+
code: string;
|
|
56
|
+
type: string;
|
|
57
|
+
/** optional */
|
|
58
|
+
newPassword: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface CheckTokenRequest {
|
|
62
|
+
token: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface RefreshTokenRequest {
|
|
66
|
+
refreshToken: string;
|
|
67
|
+
/** optional */
|
|
68
|
+
userAgent: string;
|
|
69
|
+
/** optional */
|
|
70
|
+
ip: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface Get2faStatusRequest {
|
|
74
|
+
username: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface GetProfileRequest {
|
|
78
|
+
userId: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface AuthUser {
|
|
82
|
+
id: string;
|
|
83
|
+
username: string;
|
|
84
|
+
email: string;
|
|
85
|
+
avatarUrl: string;
|
|
86
|
+
bannerUrl: string;
|
|
87
|
+
roles: string[];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Unified result for login/register/createCode/verifyCode/refresh. Which fields
|
|
92
|
+
* are populated depends on the flow:
|
|
93
|
+
* - fully authenticated → access_token + refresh_token + expires_in + user
|
|
94
|
+
* - 2FA required / pending confirm → message + two_factor_required + two_factor_type + user (no tokens)
|
|
95
|
+
* - totp_generate → secret + otpauth + qr (+ user)
|
|
96
|
+
* - totp_activate → backup_codes (+ tokens/user)
|
|
97
|
+
*/
|
|
98
|
+
export interface AuthResult {
|
|
99
|
+
accessToken: string;
|
|
100
|
+
refreshToken: string;
|
|
101
|
+
expiresIn: number;
|
|
102
|
+
user: AuthUser | undefined;
|
|
103
|
+
message: string;
|
|
104
|
+
/**
|
|
105
|
+
* Renamed from `requires_2fa` in 1.52.0: the digit-after-underscore broke
|
|
106
|
+
* the grpc proto-loader's camelCase pass (`_2` isn't `_<letter>`), so the
|
|
107
|
+
* wire key stayed snake_case and never matched the camelCase handler output
|
|
108
|
+
* → always serialised false. `two_factor_required` camelCases cleanly to
|
|
109
|
+
* `twoFactorRequired` on every layer. Field number 6 is unchanged (wire-
|
|
110
|
+
* compatible).
|
|
111
|
+
*/
|
|
112
|
+
twoFactorRequired: boolean;
|
|
113
|
+
twoFactorType: TwoFactorType;
|
|
114
|
+
/** TOTP setup extras */
|
|
115
|
+
secret: string;
|
|
116
|
+
otpauth: string;
|
|
117
|
+
/** data URL (PNG) */
|
|
118
|
+
qr: string;
|
|
119
|
+
backupCodes: string[];
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface TwoFactorStatusResponse {
|
|
123
|
+
twoFactorType: TwoFactorType;
|
|
124
|
+
has2fa: boolean;
|
|
125
|
+
isVerified: boolean;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface Empty {
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface LogoutCurrentRequest {
|
|
132
|
+
refreshToken: string;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface LogoutAllRequest {
|
|
136
|
+
userId: string;
|
|
137
|
+
/**
|
|
138
|
+
* Current session's refresh token — excluded from the wipe so "log out
|
|
139
|
+
* everywhere" keeps THIS device signed in. Empty = revoke every session.
|
|
140
|
+
*/
|
|
141
|
+
refreshToken: string;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface LogoutResponse {
|
|
145
|
+
ok: boolean;
|
|
146
|
+
/** number of refresh-token rows deleted */
|
|
147
|
+
removed: number;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export interface RestoreLoginRequest {
|
|
151
|
+
/** email or username */
|
|
152
|
+
credentials: string;
|
|
153
|
+
password: string;
|
|
154
|
+
userAgent: string;
|
|
155
|
+
ip: string;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface ListLoginHistoryRequest {
|
|
159
|
+
userId: string;
|
|
160
|
+
page: number;
|
|
161
|
+
limit: number;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface LoginEventRow {
|
|
165
|
+
id: string;
|
|
166
|
+
/** LOGIN | LOGOUT | REFRESH | TWO_FA_FAIL | PASSWORD_FAIL | BLOCKED | RESTORE */
|
|
167
|
+
type: string;
|
|
168
|
+
success: boolean;
|
|
169
|
+
reason: string;
|
|
170
|
+
ip: string;
|
|
171
|
+
userAgent: string;
|
|
172
|
+
createdAt: string;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface ListLoginHistoryResponse {
|
|
176
|
+
items: LoginEventRow[];
|
|
177
|
+
total: number;
|
|
178
|
+
page: number;
|
|
179
|
+
limit: number;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Ported from legacy auth-service (@MessagePattern → @GrpcMethod).
|
|
186
|
+
* Tokens are HMAC primitives from @aepstore-dev/passport:
|
|
187
|
+
* - access token: short TTL, carries userId; the gateway validates it
|
|
188
|
+
* locally via PassportAuthGuard (no round-trip here).
|
|
189
|
+
* - refresh token: long TTL HMAC + a RefreshToken DB row (device list +
|
|
190
|
+
* revocation). Refresh verifies the HMAC AND that the row still exists.
|
|
191
|
+
*/
|
|
192
|
+
|
|
193
|
+
export interface AuthServiceClient {
|
|
194
|
+
login(request: LoginRequest): Observable<AuthResult>;
|
|
195
|
+
|
|
196
|
+
register(request: RegisterRequest): Observable<AuthResult>;
|
|
197
|
+
|
|
198
|
+
createCode(request: CreateCodeRequest): Observable<AuthResult>;
|
|
199
|
+
|
|
200
|
+
verifyCode(request: VerifyCodeRequest): Observable<AuthResult>;
|
|
201
|
+
|
|
202
|
+
checkToken(request: CheckTokenRequest): Observable<AuthUser>;
|
|
203
|
+
|
|
204
|
+
refreshToken(request: RefreshTokenRequest): Observable<AuthResult>;
|
|
205
|
+
|
|
206
|
+
get2FaStatus(request: Get2faStatusRequest): Observable<TwoFactorStatusResponse>;
|
|
207
|
+
|
|
208
|
+
getProfile(request: GetProfileRequest): Observable<AuthUser>;
|
|
209
|
+
|
|
210
|
+
cleanupExpiredTotpSetups(request: Empty): Observable<Empty>;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Logout — kill refresh tokens. LogoutCurrent kills only the one whose
|
|
214
|
+
* HMAC matches; LogoutAll wipes every row for the user.
|
|
215
|
+
*/
|
|
216
|
+
|
|
217
|
+
logoutCurrent(request: LogoutCurrentRequest): Observable<LogoutResponse>;
|
|
218
|
+
|
|
219
|
+
logoutAll(request: LogoutAllRequest): Observable<LogoutResponse>;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Self-service restore. Verifies credentials + password against a
|
|
223
|
+
* soft-deleted user, clears deletedAt/scheduledForHardDelete, and issues
|
|
224
|
+
* fresh tokens — the one auth path that DOES read deletedAt accounts.
|
|
225
|
+
*/
|
|
226
|
+
|
|
227
|
+
restoreLogin(request: RestoreLoginRequest): Observable<AuthResult>;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Login history. Read-only audit feed for the settings page; rows come
|
|
231
|
+
* from LoginEvent. Internal alternative: tasks-service GC.
|
|
232
|
+
*/
|
|
233
|
+
|
|
234
|
+
listLoginHistory(request: ListLoginHistoryRequest): Observable<ListLoginHistoryResponse>;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Ported from legacy auth-service (@MessagePattern → @GrpcMethod).
|
|
239
|
+
* Tokens are HMAC primitives from @aepstore-dev/passport:
|
|
240
|
+
* - access token: short TTL, carries userId; the gateway validates it
|
|
241
|
+
* locally via PassportAuthGuard (no round-trip here).
|
|
242
|
+
* - refresh token: long TTL HMAC + a RefreshToken DB row (device list +
|
|
243
|
+
* revocation). Refresh verifies the HMAC AND that the row still exists.
|
|
244
|
+
*/
|
|
245
|
+
|
|
246
|
+
export interface AuthServiceController {
|
|
247
|
+
login(request: LoginRequest): Promise<AuthResult> | Observable<AuthResult> | AuthResult;
|
|
248
|
+
|
|
249
|
+
register(request: RegisterRequest): Promise<AuthResult> | Observable<AuthResult> | AuthResult;
|
|
250
|
+
|
|
251
|
+
createCode(request: CreateCodeRequest): Promise<AuthResult> | Observable<AuthResult> | AuthResult;
|
|
252
|
+
|
|
253
|
+
verifyCode(request: VerifyCodeRequest): Promise<AuthResult> | Observable<AuthResult> | AuthResult;
|
|
254
|
+
|
|
255
|
+
checkToken(request: CheckTokenRequest): Promise<AuthUser> | Observable<AuthUser> | AuthUser;
|
|
256
|
+
|
|
257
|
+
refreshToken(request: RefreshTokenRequest): Promise<AuthResult> | Observable<AuthResult> | AuthResult;
|
|
258
|
+
|
|
259
|
+
get2FaStatus(
|
|
260
|
+
request: Get2faStatusRequest,
|
|
261
|
+
): Promise<TwoFactorStatusResponse> | Observable<TwoFactorStatusResponse> | TwoFactorStatusResponse;
|
|
262
|
+
|
|
263
|
+
getProfile(request: GetProfileRequest): Promise<AuthUser> | Observable<AuthUser> | AuthUser;
|
|
264
|
+
|
|
265
|
+
cleanupExpiredTotpSetups(request: Empty): Promise<Empty> | Observable<Empty> | Empty;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Logout — kill refresh tokens. LogoutCurrent kills only the one whose
|
|
269
|
+
* HMAC matches; LogoutAll wipes every row for the user.
|
|
270
|
+
*/
|
|
271
|
+
|
|
272
|
+
logoutCurrent(request: LogoutCurrentRequest): Promise<LogoutResponse> | Observable<LogoutResponse> | LogoutResponse;
|
|
273
|
+
|
|
274
|
+
logoutAll(request: LogoutAllRequest): Promise<LogoutResponse> | Observable<LogoutResponse> | LogoutResponse;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Self-service restore. Verifies credentials + password against a
|
|
278
|
+
* soft-deleted user, clears deletedAt/scheduledForHardDelete, and issues
|
|
279
|
+
* fresh tokens — the one auth path that DOES read deletedAt accounts.
|
|
280
|
+
*/
|
|
281
|
+
|
|
282
|
+
restoreLogin(request: RestoreLoginRequest): Promise<AuthResult> | Observable<AuthResult> | AuthResult;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Login history. Read-only audit feed for the settings page; rows come
|
|
286
|
+
* from LoginEvent. Internal alternative: tasks-service GC.
|
|
287
|
+
*/
|
|
288
|
+
|
|
289
|
+
listLoginHistory(
|
|
290
|
+
request: ListLoginHistoryRequest,
|
|
291
|
+
): Promise<ListLoginHistoryResponse> | Observable<ListLoginHistoryResponse> | ListLoginHistoryResponse;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export function AuthServiceControllerMethods() {
|
|
295
|
+
return function (constructor: Function) {
|
|
296
|
+
const grpcMethods: string[] = [
|
|
297
|
+
"login",
|
|
298
|
+
"register",
|
|
299
|
+
"createCode",
|
|
300
|
+
"verifyCode",
|
|
301
|
+
"checkToken",
|
|
302
|
+
"refreshToken",
|
|
303
|
+
"get2FaStatus",
|
|
304
|
+
"getProfile",
|
|
305
|
+
"cleanupExpiredTotpSetups",
|
|
306
|
+
"logoutCurrent",
|
|
307
|
+
"logoutAll",
|
|
308
|
+
"restoreLogin",
|
|
309
|
+
"listLoginHistory",
|
|
310
|
+
];
|
|
311
|
+
for (const method of grpcMethods) {
|
|
312
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
313
|
+
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
314
|
+
}
|
|
315
|
+
const grpcStreamMethods: string[] = [];
|
|
316
|
+
for (const method of grpcStreamMethods) {
|
|
317
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
318
|
+
GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export const AUTH_SERVICE_NAME = "AuthService";
|
package/gen/mail.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
3
|
// versions:
|
|
4
4
|
// protoc-gen-ts_proto v2.10.1
|
|
5
|
-
// protoc v7.35.
|
|
5
|
+
// protoc v7.35.0
|
|
6
6
|
// source: mail.proto
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.MAIL_SERVICE_NAME = exports.MAIL_V1_PACKAGE_NAME = exports.protobufPackage = void 0;
|