@fonderie/client 0.25.0 → 0.26.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 +25 -0
- package/dist/index.cjs +53 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -1
- package/dist/index.d.ts +30 -1
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/brain/signatures.md
CHANGED
|
@@ -284,6 +284,27 @@ new AdminClient(opts: IAdminClientOptions): AdminClient
|
|
|
284
284
|
.tokens(): Promise<IApiResponse<IAdminTokensReport>>
|
|
285
285
|
.adminLog(query?: IAdminLogQuery): Promise<IApiResponse<IAdminLogPage>>
|
|
286
286
|
|
|
287
|
+
interface IAuthAdminClientOptions {
|
|
288
|
+
baseUrl: string;
|
|
289
|
+
adminToken: string;
|
|
290
|
+
prefix?: string;
|
|
291
|
+
actor?: string;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
interface IAdminLoginHistoryQuery {
|
|
295
|
+
limit?: number;
|
|
296
|
+
cursor?: string;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
new AuthAdminClient(opts: IAuthAdminClientOptions): AuthAdminClient
|
|
300
|
+
.findUser(email: string): Promise<IApiResponse<IAdminUserDTO>>
|
|
301
|
+
.getUser(id: string): Promise<IApiResponse<IAdminUserDTO>>
|
|
302
|
+
.listUserSessions(id: string): Promise<IApiResponse<ISessionDTO[]>>
|
|
303
|
+
.revokeUserSessions(id: string): Promise<IApiResponse<undefined>>
|
|
304
|
+
.userLoginHistory(id: string, query?: IAdminLoginHistoryQuery): Promise<IApiResponse<ILoginHistoryPageResult>>
|
|
305
|
+
.suspendUser(id: string): Promise<IApiResponse<IAdminUserDTO>>
|
|
306
|
+
.unsuspendUser(id: string): Promise<IApiResponse<IAdminUserDTO>>
|
|
307
|
+
|
|
287
308
|
interface ICourierAdminClientOptions {
|
|
288
309
|
baseUrl: string;
|
|
289
310
|
adminToken: string;
|
|
@@ -738,6 +759,10 @@ interface IAdminTokensReport {
|
|
|
738
759
|
}>;
|
|
739
760
|
}
|
|
740
761
|
|
|
762
|
+
interface IAdminUserDTO extends IUserDTO {
|
|
763
|
+
deletedAt: string | null;
|
|
764
|
+
}
|
|
765
|
+
|
|
741
766
|
interface IConfigEntry {
|
|
742
767
|
key: string;
|
|
743
768
|
value: unknown;
|
package/dist/index.cjs
CHANGED
|
@@ -22,6 +22,7 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
AdminClient: () => AdminClient,
|
|
24
24
|
AuditClient: () => AuditClient,
|
|
25
|
+
AuthAdminClient: () => AuthAdminClient,
|
|
25
26
|
AuthClient: () => AuthClient,
|
|
26
27
|
BillingClient: () => BillingClient,
|
|
27
28
|
ConfigAdminClient: () => ConfigAdminClient,
|
|
@@ -1784,6 +1785,57 @@ var AdminClient = class {
|
|
|
1784
1785
|
}
|
|
1785
1786
|
};
|
|
1786
1787
|
|
|
1788
|
+
// src/modules/auth-admin.ts
|
|
1789
|
+
var AuthAdminClient = class {
|
|
1790
|
+
http;
|
|
1791
|
+
adminToken;
|
|
1792
|
+
prefix;
|
|
1793
|
+
actorHeaders;
|
|
1794
|
+
constructor(opts) {
|
|
1795
|
+
this.http = new HttpClient(opts.baseUrl);
|
|
1796
|
+
this.adminToken = opts.adminToken;
|
|
1797
|
+
this.prefix = (opts.prefix ?? "/_admin").replace(/\/+$/, "");
|
|
1798
|
+
this.actorHeaders = opts.actor ? { "X-Actor": opts.actor } : void 0;
|
|
1799
|
+
}
|
|
1800
|
+
call(method, suffix) {
|
|
1801
|
+
return this.http.request({
|
|
1802
|
+
method,
|
|
1803
|
+
path: `${this.prefix}/users${suffix}`,
|
|
1804
|
+
token: this.adminToken,
|
|
1805
|
+
headers: this.actorHeaders
|
|
1806
|
+
});
|
|
1807
|
+
}
|
|
1808
|
+
findUser(email) {
|
|
1809
|
+
return this.call("GET", `?email=${encodeURIComponent(email)}`);
|
|
1810
|
+
}
|
|
1811
|
+
getUser(id) {
|
|
1812
|
+
return this.call("GET", `/${encodeURIComponent(id)}`);
|
|
1813
|
+
}
|
|
1814
|
+
listUserSessions(id) {
|
|
1815
|
+
return this.call("GET", `/${encodeURIComponent(id)}/sessions`);
|
|
1816
|
+
}
|
|
1817
|
+
// Signs the user out everywhere.
|
|
1818
|
+
revokeUserSessions(id) {
|
|
1819
|
+
return this.call("DELETE", `/${encodeURIComponent(id)}/sessions`);
|
|
1820
|
+
}
|
|
1821
|
+
userLoginHistory(id, query = {}) {
|
|
1822
|
+
const q = new URLSearchParams();
|
|
1823
|
+
if (query.limit) q.set("limit", String(query.limit));
|
|
1824
|
+
if (query.cursor) q.set("cursor", query.cursor);
|
|
1825
|
+
const qs = q.toString();
|
|
1826
|
+
return this.call(
|
|
1827
|
+
"GET",
|
|
1828
|
+
`/${encodeURIComponent(id)}/login-history${qs ? `?${qs}` : ""}`
|
|
1829
|
+
);
|
|
1830
|
+
}
|
|
1831
|
+
suspendUser(id) {
|
|
1832
|
+
return this.call("POST", `/${encodeURIComponent(id)}/suspend`);
|
|
1833
|
+
}
|
|
1834
|
+
unsuspendUser(id) {
|
|
1835
|
+
return this.call("POST", `/${encodeURIComponent(id)}/unsuspend`);
|
|
1836
|
+
}
|
|
1837
|
+
};
|
|
1838
|
+
|
|
1787
1839
|
// src/modules/courier-admin.ts
|
|
1788
1840
|
var CourierAdminClient = class {
|
|
1789
1841
|
http;
|
|
@@ -1876,6 +1928,7 @@ function isMfaRequired(result) {
|
|
|
1876
1928
|
0 && (module.exports = {
|
|
1877
1929
|
AdminClient,
|
|
1878
1930
|
AuditClient,
|
|
1931
|
+
AuthAdminClient,
|
|
1879
1932
|
AuthClient,
|
|
1880
1933
|
BillingClient,
|
|
1881
1934
|
ConfigAdminClient,
|