@fonderie/client 0.15.0 → 0.16.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 +1 -1
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,6 +151,10 @@ 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;
|
|
@@ -526,6 +538,34 @@ interface IAuditPageResult {
|
|
|
526
538
|
nextCursor: string | null;
|
|
527
539
|
}
|
|
528
540
|
|
|
541
|
+
interface ILoginEventDTO {
|
|
542
|
+
id: string;
|
|
543
|
+
method: string;
|
|
544
|
+
outcome: string;
|
|
545
|
+
failureReason: string | null;
|
|
546
|
+
ipAddress: string | null;
|
|
547
|
+
userAgent: string | null;
|
|
548
|
+
createdAt: string;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
interface ILoginHistoryPageResult {
|
|
552
|
+
events: ILoginEventDTO[];
|
|
553
|
+
nextCursor: string | null;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
interface ISessionDTO {
|
|
557
|
+
id: string;
|
|
558
|
+
current: boolean;
|
|
559
|
+
ipAddress: string | null;
|
|
560
|
+
userAgent: string | null;
|
|
561
|
+
createdAt: string;
|
|
562
|
+
expiresAt: string;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
interface ISessionsResult {
|
|
566
|
+
sessions: ISessionDTO[];
|
|
567
|
+
}
|
|
568
|
+
|
|
529
569
|
interface ICancelSubscriptionInput {
|
|
530
570
|
atPeriodEnd?: boolean;
|
|
531
571
|
}
|
|
@@ -744,6 +784,7 @@ interface IInvoiceDTO {
|
|
|
744
784
|
currency: string;
|
|
745
785
|
status: string;
|
|
746
786
|
created: string;
|
|
787
|
+
dueDate: string | null;
|
|
747
788
|
hostedInvoiceUrl: string | null;
|
|
748
789
|
invoicePdf: string | null;
|
|
749
790
|
}
|
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
|