@fonderie/client 0.15.1 → 0.17.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/brain/signatures.md +41 -0
- package/dist/index.cjs +43 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -1
- package/dist/index.d.ts +41 -1
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/brain/signatures.md
CHANGED
|
@@ -87,6 +87,14 @@ interface IChangePasswordInput {
|
|
|
87
87
|
newPassword: string;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
interface IGetLoginHistoryInput {
|
|
91
|
+
outcome?: 'success' | 'failed';
|
|
92
|
+
from?: Date;
|
|
93
|
+
to?: Date;
|
|
94
|
+
limit?: number;
|
|
95
|
+
cursor?: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
90
98
|
interface ILoginInput {
|
|
91
99
|
email: string;
|
|
92
100
|
password: string;
|
|
@@ -143,10 +151,15 @@ new AuthClient(http: HttpClient, tokens: TokenStore): AuthClient
|
|
|
143
151
|
.changePassword(input: IChangePasswordInput): Promise<IApiResponse<undefined>>
|
|
144
152
|
.exportData(): Promise<IApiResponse<unknown>>
|
|
145
153
|
.deleteUser(): Promise<IApiResponse<undefined>>
|
|
154
|
+
.getLoginHistory(input?: IGetLoginHistoryInput, opts?: IReadOptions | undefined): Promise<IApiResponse<ILoginHistoryPageResult>>
|
|
155
|
+
.listSessions(opts?: IReadOptions | undefined): Promise<IApiResponse<ISessionsResult>>
|
|
156
|
+
.terminateSession(id: string): Promise<IApiResponse<{ id: string; }>>
|
|
157
|
+
.terminateOtherSessions(): Promise<IApiResponse<{ count: number; }>>
|
|
146
158
|
|
|
147
159
|
interface ICheckoutInput {
|
|
148
160
|
plan: string;
|
|
149
161
|
interval?: 'month' | 'year';
|
|
162
|
+
idempotencyKey?: string;
|
|
150
163
|
}
|
|
151
164
|
|
|
152
165
|
interface ICreatePlanInput {
|
|
@@ -526,6 +539,34 @@ interface IAuditPageResult {
|
|
|
526
539
|
nextCursor: string | null;
|
|
527
540
|
}
|
|
528
541
|
|
|
542
|
+
interface ILoginEventDTO {
|
|
543
|
+
id: string;
|
|
544
|
+
method: string;
|
|
545
|
+
outcome: string;
|
|
546
|
+
failureReason: string | null;
|
|
547
|
+
ipAddress: string | null;
|
|
548
|
+
userAgent: string | null;
|
|
549
|
+
createdAt: string;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
interface ILoginHistoryPageResult {
|
|
553
|
+
events: ILoginEventDTO[];
|
|
554
|
+
nextCursor: string | null;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
interface ISessionDTO {
|
|
558
|
+
id: string;
|
|
559
|
+
current: boolean;
|
|
560
|
+
ipAddress: string | null;
|
|
561
|
+
userAgent: string | null;
|
|
562
|
+
createdAt: string;
|
|
563
|
+
expiresAt: string;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
interface ISessionsResult {
|
|
567
|
+
sessions: ISessionDTO[];
|
|
568
|
+
}
|
|
569
|
+
|
|
529
570
|
interface ICancelSubscriptionInput {
|
|
530
571
|
atPeriodEnd?: boolean;
|
|
531
572
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -381,6 +381,49 @@ var AuthClient = class {
|
|
|
381
381
|
token: this.tokens.get()
|
|
382
382
|
});
|
|
383
383
|
}
|
|
384
|
+
// ── Security surfaces (login history + active sessions) ─────────────────────
|
|
385
|
+
// GET /auth/login-history — the caller's own attempts, newest first,
|
|
386
|
+
// keyset-paginated (pass the previous page's nextCursor to continue).
|
|
387
|
+
getLoginHistory(input = {}, opts) {
|
|
388
|
+
const params = new URLSearchParams();
|
|
389
|
+
if (input.limit !== void 0) params.set("limit", String(input.limit));
|
|
390
|
+
if (input.outcome) params.set("outcome", input.outcome);
|
|
391
|
+
if (input.from) params.set("from", input.from.toISOString());
|
|
392
|
+
if (input.to) params.set("to", input.to.toISOString());
|
|
393
|
+
if (input.cursor) params.set("cursor", input.cursor);
|
|
394
|
+
const qs = params.toString();
|
|
395
|
+
return this.http.request({
|
|
396
|
+
method: "GET",
|
|
397
|
+
path: `/auth/login-history${qs ? "?" + qs : ""}`,
|
|
398
|
+
token: this.tokens.get(),
|
|
399
|
+
bust: opts?.bust
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
// GET /auth/sessions — the caller's live sessions; one is flagged current.
|
|
403
|
+
listSessions(opts) {
|
|
404
|
+
return this.http.request({
|
|
405
|
+
method: "GET",
|
|
406
|
+
path: "/auth/sessions",
|
|
407
|
+
token: this.tokens.get(),
|
|
408
|
+
bust: opts?.bust
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
// DELETE /auth/sessions/:id — revoke one of the caller's sessions.
|
|
412
|
+
terminateSession(id) {
|
|
413
|
+
return this.http.request({
|
|
414
|
+
method: "DELETE",
|
|
415
|
+
path: `/auth/sessions/${encodeURIComponent(id)}`,
|
|
416
|
+
token: this.tokens.get()
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
// DELETE /auth/sessions/others — revoke every session except the current one.
|
|
420
|
+
terminateOtherSessions() {
|
|
421
|
+
return this.http.request({
|
|
422
|
+
method: "DELETE",
|
|
423
|
+
path: "/auth/sessions/others",
|
|
424
|
+
token: this.tokens.get()
|
|
425
|
+
});
|
|
426
|
+
}
|
|
384
427
|
};
|
|
385
428
|
|
|
386
429
|
// src/modules/billing.ts
|