@fonderie/client 0.28.0 → 0.29.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 +26 -0
- package/dist/index.cjs +14 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/brain/signatures.md
CHANGED
|
@@ -283,6 +283,8 @@ new AdminClient(opts: IAdminClientOptions): AdminClient
|
|
|
283
283
|
.routes(): Promise<IApiResponse<IAdminRoutesReport>>
|
|
284
284
|
.tokens(): Promise<IApiResponse<IAdminTokensReport>>
|
|
285
285
|
.adminLog(query?: IAdminLogQuery): Promise<IApiResponse<IAdminLogPage>>
|
|
286
|
+
.issueToken(input: IAdminIssueTokenInput): Promise<IApiResponse<IAdminIssuedToken>>
|
|
287
|
+
.revokeToken(id: string): Promise<IApiResponse<undefined>>
|
|
286
288
|
|
|
287
289
|
interface IAuthAdminClientOptions {
|
|
288
290
|
baseUrl: string;
|
|
@@ -800,6 +802,30 @@ interface IAdminTokensReport {
|
|
|
800
802
|
module: string;
|
|
801
803
|
set: boolean;
|
|
802
804
|
}>;
|
|
805
|
+
issued: IAdminTokenRecord[] | null;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
type AdminScope = 'read' | 'write' | 'secrets';
|
|
809
|
+
|
|
810
|
+
interface IAdminTokenRecord {
|
|
811
|
+
id: string;
|
|
812
|
+
name: string;
|
|
813
|
+
scopes: AdminScope[];
|
|
814
|
+
createdBy: string;
|
|
815
|
+
createdAt: string;
|
|
816
|
+
expiresAt: string | null;
|
|
817
|
+
revokedAt: string | null;
|
|
818
|
+
lastUsedAt: string | null;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
interface IAdminIssueTokenInput {
|
|
822
|
+
name: string;
|
|
823
|
+
scopes: AdminScope[];
|
|
824
|
+
expiresInDays?: number;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
interface IAdminIssuedToken extends IAdminTokenRecord {
|
|
828
|
+
token: string;
|
|
803
829
|
}
|
|
804
830
|
|
|
805
831
|
interface IAdminUserDTO extends IUserDTO {
|
package/dist/index.cjs
CHANGED
|
@@ -1753,11 +1753,15 @@ var AdminClient = class {
|
|
|
1753
1753
|
this.actorHeaders = opts.actor ? { "X-Actor": opts.actor } : void 0;
|
|
1754
1754
|
}
|
|
1755
1755
|
get(suffix) {
|
|
1756
|
+
return this.call("GET", suffix);
|
|
1757
|
+
}
|
|
1758
|
+
call(method, suffix, body) {
|
|
1756
1759
|
return this.http.request({
|
|
1757
|
-
method
|
|
1760
|
+
method,
|
|
1758
1761
|
path: `${this.prefix}${suffix}`,
|
|
1759
1762
|
token: this.adminToken,
|
|
1760
|
-
headers: this.actorHeaders
|
|
1763
|
+
headers: this.actorHeaders,
|
|
1764
|
+
...body !== void 0 ? { body } : {}
|
|
1761
1765
|
});
|
|
1762
1766
|
}
|
|
1763
1767
|
attention() {
|
|
@@ -1785,6 +1789,14 @@ var AdminClient = class {
|
|
|
1785
1789
|
const qs = q.toString();
|
|
1786
1790
|
return this.get(`/activity/admin-log${qs ? `?${qs}` : ""}`);
|
|
1787
1791
|
}
|
|
1792
|
+
// Root token only. The plaintext comes back once.
|
|
1793
|
+
issueToken(input) {
|
|
1794
|
+
return this.call("POST", "/access/tokens", input);
|
|
1795
|
+
}
|
|
1796
|
+
// Root token only.
|
|
1797
|
+
revokeToken(id) {
|
|
1798
|
+
return this.call("DELETE", `/access/tokens/${encodeURIComponent(id)}`);
|
|
1799
|
+
}
|
|
1788
1800
|
};
|
|
1789
1801
|
|
|
1790
1802
|
// src/modules/auth-admin.ts
|