@fonderie/client 1.5.0 → 1.7.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 +79 -1
- package/dist/index.cjs +70 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +106 -2
- package/dist/index.d.ts +106 -2
- package/dist/index.js +70 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/brain/signatures.md
CHANGED
|
@@ -267,7 +267,7 @@ new ConfigAdminClient(opts: IConfigAdminClientOptions): ConfigAdminClient
|
|
|
267
267
|
|
|
268
268
|
interface IAdminClientOptions {
|
|
269
269
|
baseUrl: string;
|
|
270
|
-
adminToken
|
|
270
|
+
adminToken?: string;
|
|
271
271
|
prefix?: string;
|
|
272
272
|
actor?: string;
|
|
273
273
|
}
|
|
@@ -289,6 +289,21 @@ new AdminClient(opts: IAdminClientOptions): AdminClient
|
|
|
289
289
|
.revokeToken(id: string): Promise<IApiResponse<undefined>>
|
|
290
290
|
.migrations(): Promise<IApiResponse<IAdminMigrationsReport>>
|
|
291
291
|
.applyMigrations(module: string, expect: readonly string[]): Promise<IApiResponse<IAdminMigrationModule>>
|
|
292
|
+
.session(): Promise<IApiResponse<IAdminSession>>
|
|
293
|
+
.claim(input: { email: string; password: string; name?: string; }): Promise<IApiResponse<IAdminSession>>
|
|
294
|
+
.login(input: { email: string; password: string; }): Promise<IApiResponse<IAdminSession>>
|
|
295
|
+
.enrollment(): Promise<IApiResponse<IAdminEnrollment>>
|
|
296
|
+
.confirmEnrollment(code: string): Promise<IApiResponse<IAdminSession>>
|
|
297
|
+
.verify(factor: IAdminSecondFactor): Promise<IApiResponse<IAdminSession>>
|
|
298
|
+
.stepUp(factor: IAdminSecondFactor): Promise<IApiResponse<{ stepUpFresh: boolean; backupCodesLeft?: number; }>>
|
|
299
|
+
.logout(): Promise<IApiResponse<undefined>>
|
|
300
|
+
.inspectLink(token: string): Promise<IApiResponse<{ kind: "invite" | "recovery"; email: string; }>>
|
|
301
|
+
.redeemLink(input: { token: string; password: string; name?: string; }): Promise<IApiResponse<IAdminSession>>
|
|
302
|
+
.operators(): Promise<IApiResponse<IAdminOperatorsReport>>
|
|
303
|
+
.inviteOperator(input: { email: string; scopes: AdminScope[]; expiresInHours?: number; }): Promise<IApiResponse<IAdminCreatedLink>>
|
|
304
|
+
.recoverOperator(id: string): Promise<IApiResponse<IAdminCreatedLink>>
|
|
305
|
+
.updateOperator(id: string, input: { scopes?: AdminScope[]; name?: string; disabled?: boolean; }): Promise<IApiResponse<IAdminOperator>>
|
|
306
|
+
.revokeOperatorLink(id: string): Promise<IApiResponse<undefined>>
|
|
292
307
|
|
|
293
308
|
interface IAuthAdminClientOptions {
|
|
294
309
|
baseUrl: string;
|
|
@@ -305,6 +320,7 @@ interface IAdminLoginHistoryQuery {
|
|
|
305
320
|
interface IAdminUsersQuery {
|
|
306
321
|
limit?: number;
|
|
307
322
|
cursor?: string;
|
|
323
|
+
deleted?: boolean;
|
|
308
324
|
}
|
|
309
325
|
|
|
310
326
|
new AuthAdminClient(opts: IAuthAdminClientOptions): AuthAdminClient
|
|
@@ -878,6 +894,68 @@ interface IAdminTokenRecord {
|
|
|
878
894
|
lastUsedAt: string | null;
|
|
879
895
|
}
|
|
880
896
|
|
|
897
|
+
interface IAdminOperator {
|
|
898
|
+
id: string;
|
|
899
|
+
email: string;
|
|
900
|
+
name: string | null;
|
|
901
|
+
scopes: AdminScope[];
|
|
902
|
+
enrolled: boolean;
|
|
903
|
+
backupCodesLeft: number;
|
|
904
|
+
locked: boolean;
|
|
905
|
+
createdBy: string;
|
|
906
|
+
createdAt: string;
|
|
907
|
+
lastLoginAt: string | null;
|
|
908
|
+
disabledAt: string | null;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
interface IAdminOperatorLink {
|
|
912
|
+
id: string;
|
|
913
|
+
kind: 'invite' | 'recovery';
|
|
914
|
+
email: string;
|
|
915
|
+
scopes: AdminScope[];
|
|
916
|
+
createdBy: string;
|
|
917
|
+
createdAt: string;
|
|
918
|
+
expiresAt: string;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
interface IAdminOperatorsReport {
|
|
922
|
+
operators: IAdminOperator[];
|
|
923
|
+
links: IAdminOperatorLink[];
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
interface IAdminCreatedLink {
|
|
927
|
+
id: string;
|
|
928
|
+
email: string;
|
|
929
|
+
scopes?: AdminScope[];
|
|
930
|
+
expiresAt: string;
|
|
931
|
+
token: string;
|
|
932
|
+
url: string;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
type AdminSessionState = 'signed-out' | 'needs-2fa' | 'needs-enrollment' | 'signed-in';
|
|
936
|
+
|
|
937
|
+
interface IAdminSession {
|
|
938
|
+
state: AdminSessionState;
|
|
939
|
+
operator: IAdminOperator | null;
|
|
940
|
+
claimable?: boolean;
|
|
941
|
+
stepUpFresh?: boolean;
|
|
942
|
+
backupCodes?: string[];
|
|
943
|
+
backupCodesLeft?: number;
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
interface IAdminEnrollment {
|
|
947
|
+
secret: string;
|
|
948
|
+
uri: string;
|
|
949
|
+
account: string;
|
|
950
|
+
issuer: string;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
type IAdminSecondFactor = {
|
|
954
|
+
code: string;
|
|
955
|
+
} | {
|
|
956
|
+
backupCode: string;
|
|
957
|
+
};
|
|
958
|
+
|
|
881
959
|
interface IAdminIssueTokenInput {
|
|
882
960
|
name: string;
|
|
883
961
|
scopes: AdminScope[];
|
package/dist/index.cjs
CHANGED
|
@@ -1917,6 +1917,75 @@ var AdminClient = class {
|
|
|
1917
1917
|
{ expect }
|
|
1918
1918
|
);
|
|
1919
1919
|
}
|
|
1920
|
+
// ── operator sign-in (the served console's gate) ──────────────────────
|
|
1921
|
+
// Cookie-based: the server sets an HttpOnly session cookie; nothing here
|
|
1922
|
+
// ever holds it. Omit adminToken on this client — except for claim().
|
|
1923
|
+
/** Who is signed in, and whether the console can still be claimed. */
|
|
1924
|
+
session() {
|
|
1925
|
+
return this.get("/session");
|
|
1926
|
+
}
|
|
1927
|
+
/** The one-time claim. Needs the ROOT token as this client's adminToken. */
|
|
1928
|
+
claim(input) {
|
|
1929
|
+
return this.call("POST", "/session/claim", input);
|
|
1930
|
+
}
|
|
1931
|
+
login(input) {
|
|
1932
|
+
return this.call("POST", "/session/login", input);
|
|
1933
|
+
}
|
|
1934
|
+
/** The authenticator secret and otpauth URI to scan while enrolling. */
|
|
1935
|
+
enrollment() {
|
|
1936
|
+
return this.get("/session/enrollment");
|
|
1937
|
+
}
|
|
1938
|
+
/** Confirms the first code. The response carries the backup codes, once. */
|
|
1939
|
+
confirmEnrollment(code) {
|
|
1940
|
+
return this.call("POST", "/session/enrollment", { code });
|
|
1941
|
+
}
|
|
1942
|
+
/** The second factor after the password: an authenticator code or a backup code. */
|
|
1943
|
+
verify(factor) {
|
|
1944
|
+
return this.call("POST", "/session/verify", factor);
|
|
1945
|
+
}
|
|
1946
|
+
/** A fresh code for the next five minutes of dangerous actions. */
|
|
1947
|
+
stepUp(factor) {
|
|
1948
|
+
return this.call(
|
|
1949
|
+
"POST",
|
|
1950
|
+
"/session/step-up",
|
|
1951
|
+
factor
|
|
1952
|
+
);
|
|
1953
|
+
}
|
|
1954
|
+
logout() {
|
|
1955
|
+
return this.call("DELETE", "/session");
|
|
1956
|
+
}
|
|
1957
|
+
/** What an invite or recovery link is for, before setting a password. */
|
|
1958
|
+
inspectLink(token) {
|
|
1959
|
+
return this.call(
|
|
1960
|
+
"POST",
|
|
1961
|
+
"/session/link/inspect",
|
|
1962
|
+
{ token }
|
|
1963
|
+
);
|
|
1964
|
+
}
|
|
1965
|
+
redeemLink(input) {
|
|
1966
|
+
return this.call("POST", "/session/link", input);
|
|
1967
|
+
}
|
|
1968
|
+
// ── managing operators ─────────────────────────────────────────────────
|
|
1969
|
+
operators() {
|
|
1970
|
+
return this.get("/access/operators");
|
|
1971
|
+
}
|
|
1972
|
+
/** An invite link, shown once. Needs the highest scope and a fresh code. */
|
|
1973
|
+
inviteOperator(input) {
|
|
1974
|
+
return this.call("POST", "/access/operators/invites", input);
|
|
1975
|
+
}
|
|
1976
|
+
/** Lost password or authenticator: a single-use link; signs them out everywhere. */
|
|
1977
|
+
recoverOperator(id) {
|
|
1978
|
+
return this.call(
|
|
1979
|
+
"POST",
|
|
1980
|
+
`/access/operators/${encodeURIComponent(id)}/recovery`
|
|
1981
|
+
);
|
|
1982
|
+
}
|
|
1983
|
+
updateOperator(id, input) {
|
|
1984
|
+
return this.call("PUT", `/access/operators/${encodeURIComponent(id)}`, input);
|
|
1985
|
+
}
|
|
1986
|
+
revokeOperatorLink(id) {
|
|
1987
|
+
return this.call("DELETE", `/access/operators/links/${encodeURIComponent(id)}`);
|
|
1988
|
+
}
|
|
1920
1989
|
};
|
|
1921
1990
|
|
|
1922
1991
|
// src/modules/auth-admin.ts
|
|
@@ -1945,6 +2014,7 @@ var AuthAdminClient = class {
|
|
|
1945
2014
|
const q = new URLSearchParams();
|
|
1946
2015
|
if (query.limit) q.set("limit", String(query.limit));
|
|
1947
2016
|
if (query.cursor) q.set("cursor", query.cursor);
|
|
2017
|
+
if (query.deleted) q.set("deleted", "1");
|
|
1948
2018
|
const qs = q.toString();
|
|
1949
2019
|
return this.call("GET", qs ? `?${qs}` : "");
|
|
1950
2020
|
}
|