@mano8/astro-auth-m8 1.4.1 → 2.0.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/CHANGELOG.md +116 -0
- package/README.md +70 -3
- package/dist/src/integration.d.ts.map +1 -1
- package/dist/src/integration.js +3 -1
- package/dist/src/integration.js.map +1 -1
- package/dist/src/runtime/api/apiKeys.d.ts +3 -1
- package/dist/src/runtime/api/apiKeys.d.ts.map +1 -1
- package/dist/src/runtime/api/apiKeys.js +9 -1
- package/dist/src/runtime/api/apiKeys.js.map +1 -1
- package/dist/src/runtime/api/index.d.ts +1 -0
- package/dist/src/runtime/api/index.d.ts.map +1 -1
- package/dist/src/runtime/api/index.js +1 -0
- package/dist/src/runtime/api/index.js.map +1 -1
- package/dist/src/runtime/api/ops.d.ts +2 -1
- package/dist/src/runtime/api/ops.d.ts.map +1 -1
- package/dist/src/runtime/api/ops.js +6 -1
- package/dist/src/runtime/api/ops.js.map +1 -1
- package/dist/src/runtime/api/security.d.ts +8 -0
- package/dist/src/runtime/api/security.d.ts.map +1 -0
- package/dist/src/runtime/api/security.js +23 -0
- package/dist/src/runtime/api/security.js.map +1 -0
- package/dist/src/runtime/api/users.d.ts +2 -2
- package/dist/src/runtime/api/users.d.ts.map +1 -1
- package/dist/src/runtime/api/users.js +2 -2
- package/dist/src/runtime/api/users.js.map +1 -1
- package/dist/src/runtime/authEvents.d.ts +25 -0
- package/dist/src/runtime/authEvents.d.ts.map +1 -0
- package/dist/src/runtime/authEvents.js +26 -0
- package/dist/src/runtime/authEvents.js.map +1 -0
- package/dist/src/runtime/authorization.d.ts +80 -0
- package/dist/src/runtime/authorization.d.ts.map +1 -0
- package/dist/src/runtime/authorization.js +109 -0
- package/dist/src/runtime/authorization.js.map +1 -0
- package/dist/src/runtime/browserAdapter.d.ts +18 -0
- package/dist/src/runtime/browserAdapter.d.ts.map +1 -0
- package/dist/src/runtime/browserAdapter.js +50 -0
- package/dist/src/runtime/browserAdapter.js.map +1 -0
- package/dist/src/runtime/compatibility.d.ts +6 -6
- package/dist/src/runtime/compatibility.d.ts.map +1 -1
- package/dist/src/runtime/compatibility.js +35 -5
- package/dist/src/runtime/compatibility.js.map +1 -1
- package/dist/src/runtime/errors.d.ts +39 -0
- package/dist/src/runtime/errors.d.ts.map +1 -1
- package/dist/src/runtime/errors.js +79 -0
- package/dist/src/runtime/errors.js.map +1 -1
- package/dist/src/runtime/hooks/index.d.ts +1 -0
- package/dist/src/runtime/hooks/index.d.ts.map +1 -1
- package/dist/src/runtime/hooks/index.js +1 -0
- package/dist/src/runtime/hooks/index.js.map +1 -1
- package/dist/src/runtime/hooks/useApiKeys.d.ts +69 -0
- package/dist/src/runtime/hooks/useApiKeys.d.ts.map +1 -1
- package/dist/src/runtime/hooks/useApiKeys.js +38 -1
- package/dist/src/runtime/hooks/useApiKeys.js.map +1 -1
- package/dist/src/runtime/hooks/useSecurity.d.ts +70 -0
- package/dist/src/runtime/hooks/useSecurity.d.ts.map +1 -0
- package/dist/src/runtime/hooks/useSecurity.js +60 -0
- package/dist/src/runtime/hooks/useSecurity.js.map +1 -0
- package/dist/src/runtime/hooks/useUsers.d.ts +4 -15
- package/dist/src/runtime/hooks/useUsers.d.ts.map +1 -1
- package/dist/src/runtime/hooks/useUsers.js +18 -4
- package/dist/src/runtime/hooks/useUsers.js.map +1 -1
- package/dist/src/runtime/queryKeys.d.ts +2 -0
- package/dist/src/runtime/queryKeys.d.ts.map +1 -1
- package/dist/src/runtime/queryKeys.js +3 -1
- package/dist/src/runtime/queryKeys.js.map +1 -1
- package/dist/src/runtime/react/AuthProvider.d.ts.map +1 -1
- package/dist/src/runtime/react/AuthProvider.js +24 -0
- package/dist/src/runtime/react/AuthProvider.js.map +1 -1
- package/dist/src/runtime/react/RequireRole.d.ts.map +1 -1
- package/dist/src/runtime/react/RequireRole.js +3 -2
- package/dist/src/runtime/react/RequireRole.js.map +1 -1
- package/dist/src/runtime/react/index.d.ts +1 -0
- package/dist/src/runtime/react/index.d.ts.map +1 -1
- package/dist/src/runtime/react/index.js +4 -0
- package/dist/src/runtime/react/index.js.map +1 -1
- package/dist/src/runtime/schemas.d.ts +186 -1
- package/dist/src/runtime/schemas.d.ts.map +1 -1
- package/dist/src/runtime/schemas.js +74 -3
- package/dist/src/runtime/schemas.js.map +1 -1
- package/package.json +18 -12
- package/registry/r/account-crud.json +1 -1
- package/registry/r/account-dashboard.json +1 -1
- package/registry/r/admin-users-panel.json +1 -1
- package/registry/r/api-keys-panel.json +1 -1
- package/registry/r/registry.json +6 -0
- package/registry/r/security-panel.json +27 -0
- package/registry/r/sessions-panel.json +1 -1
- package/registry.json +22 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-neutral role/flag authorization primitives.
|
|
3
|
+
*
|
|
4
|
+
* TypeScript mirror of `auth_sdk_m8/authorization.py`, the canonical source.
|
|
5
|
+
* Canonical role/flag truth table (one row per valid state):
|
|
6
|
+
*
|
|
7
|
+
* ```text
|
|
8
|
+
* role is_superuser=false is_superuser=true
|
|
9
|
+
* user valid, non-superuser invalid
|
|
10
|
+
* reader valid, non-superuser invalid
|
|
11
|
+
* writer valid, non-superuser invalid
|
|
12
|
+
* admin valid, non-superuser invalid
|
|
13
|
+
* superadmin invalid valid superuser
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* No caller may derive an authorization decision from `role` alone or
|
|
17
|
+
* `is_superuser` alone - the two claims must agree. This module is the single
|
|
18
|
+
* place in the package that encodes the hierarchy and the cross-field
|
|
19
|
+
* invariant, so every consumer (components, hooks, registry skins) shares one
|
|
20
|
+
* implementation.
|
|
21
|
+
*
|
|
22
|
+
* These are client-side display predicates. The backend remains the authority;
|
|
23
|
+
* mirroring its rules here only stops the UI from showing privileged surfaces
|
|
24
|
+
* the server would refuse.
|
|
25
|
+
*/
|
|
26
|
+
import { type RoleType } from "./schemas.js";
|
|
27
|
+
/**
|
|
28
|
+
* Roles ordered from highest to lowest privilege.
|
|
29
|
+
*
|
|
30
|
+
* Sourced from `RoleTypeSchema` so the hierarchy exists as exactly one list in
|
|
31
|
+
* this package, mirroring `RoleType.get_ordered_roles()`. The schema declares
|
|
32
|
+
* its members in descending privilege order; `tests/authorization.test.ts`
|
|
33
|
+
* locks that order in so a reordering of the enum fails loudly instead of
|
|
34
|
+
* silently changing every authorization decision.
|
|
35
|
+
*/
|
|
36
|
+
export declare const ORDERED_ROLES: readonly RoleType[];
|
|
37
|
+
/**
|
|
38
|
+
* Return whether `currentRole` meets or exceeds `requiredRole`.
|
|
39
|
+
*
|
|
40
|
+
* Canonical role hierarchy check, ordered highest to lowest privilege via
|
|
41
|
+
* {@link ORDERED_ROLES}. This is the single implementation of the hierarchy;
|
|
42
|
+
* no consumer should duplicate a role-ordered list or compare roles by exact
|
|
43
|
+
* membership - exact membership hides an admin surface from a superadmin.
|
|
44
|
+
*
|
|
45
|
+
* Returns `false` for an insufficient or unrecognised role.
|
|
46
|
+
*/
|
|
47
|
+
export declare function hasMinimumRole(currentRole: RoleType, requiredRole: RoleType): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Return whether `role` and `isSuperuser` agree per the truth table.
|
|
50
|
+
*
|
|
51
|
+
* Pure cross-field invariant, independent of any hierarchy comparison:
|
|
52
|
+
*
|
|
53
|
+
* - `superadmin` requires `isSuperuser === true`.
|
|
54
|
+
* - Every other recognised role requires `isSuperuser === false`.
|
|
55
|
+
*
|
|
56
|
+
* Returns `true` only when the pair is one of the five valid rows. The claims
|
|
57
|
+
* are compared strictly (`=== true` / `=== false`) rather than by truthiness,
|
|
58
|
+
* so a JavaScript consumer passing an unparsed value cannot widen the
|
|
59
|
+
* invariant.
|
|
60
|
+
*
|
|
61
|
+
* Deviation from the Python original, deliberate: `auth_sdk_m8` types `role`
|
|
62
|
+
* as a closed enum, so an unrecognised role cannot reach it and the final
|
|
63
|
+
* branch treats every non-superadmin input as valid. Here the claims may come
|
|
64
|
+
* from a backend this build does not know, so an unrecognised role is not one
|
|
65
|
+
* of the five rows and fails closed.
|
|
66
|
+
*/
|
|
67
|
+
export declare function privilegeClaimsAreConsistent(role: RoleType, isSuperuser: boolean): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Return the exact dual-evidence canonical-superuser predicate.
|
|
70
|
+
*
|
|
71
|
+
* Requires both the consistency invariant and the canonical pair
|
|
72
|
+
* (`role === "superadmin"` and `isSuperuser === true`). Callers must use this
|
|
73
|
+
* instead of reading `is_superuser` or `role` alone - a stray
|
|
74
|
+
* `is_superuser: true` on a non-superadmin role (or vice versa) never grants
|
|
75
|
+
* superuser privileges. Such mismatched pairs are not hypothetical: they exist
|
|
76
|
+
* on rows written before `fa-auth-m8` 2.0.0 added its consistency constraint,
|
|
77
|
+
* for the length of the expand/repair migration window.
|
|
78
|
+
*/
|
|
79
|
+
export declare function hasSuperuserPrivileges(role: RoleType, isSuperuser: boolean): boolean;
|
|
80
|
+
//# sourceMappingURL=authorization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorization.d.ts","sourceRoot":"","sources":["../../../src/runtime/authorization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7D;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,QAAQ,EAA2B,CAAC;AAiBzE;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,GAAG,OAAO,CAKrF;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,GAAG,OAAO,CAI1F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,GAAG,OAAO,CAIpF"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-neutral role/flag authorization primitives.
|
|
3
|
+
*
|
|
4
|
+
* TypeScript mirror of `auth_sdk_m8/authorization.py`, the canonical source.
|
|
5
|
+
* Canonical role/flag truth table (one row per valid state):
|
|
6
|
+
*
|
|
7
|
+
* ```text
|
|
8
|
+
* role is_superuser=false is_superuser=true
|
|
9
|
+
* user valid, non-superuser invalid
|
|
10
|
+
* reader valid, non-superuser invalid
|
|
11
|
+
* writer valid, non-superuser invalid
|
|
12
|
+
* admin valid, non-superuser invalid
|
|
13
|
+
* superadmin invalid valid superuser
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* No caller may derive an authorization decision from `role` alone or
|
|
17
|
+
* `is_superuser` alone - the two claims must agree. This module is the single
|
|
18
|
+
* place in the package that encodes the hierarchy and the cross-field
|
|
19
|
+
* invariant, so every consumer (components, hooks, registry skins) shares one
|
|
20
|
+
* implementation.
|
|
21
|
+
*
|
|
22
|
+
* These are client-side display predicates. The backend remains the authority;
|
|
23
|
+
* mirroring its rules here only stops the UI from showing privileged surfaces
|
|
24
|
+
* the server would refuse.
|
|
25
|
+
*/
|
|
26
|
+
import { RoleTypeSchema } from "./schemas.js";
|
|
27
|
+
/**
|
|
28
|
+
* Roles ordered from highest to lowest privilege.
|
|
29
|
+
*
|
|
30
|
+
* Sourced from `RoleTypeSchema` so the hierarchy exists as exactly one list in
|
|
31
|
+
* this package, mirroring `RoleType.get_ordered_roles()`. The schema declares
|
|
32
|
+
* its members in descending privilege order; `tests/authorization.test.ts`
|
|
33
|
+
* locks that order in so a reordering of the enum fails loudly instead of
|
|
34
|
+
* silently changing every authorization decision.
|
|
35
|
+
*/
|
|
36
|
+
export const ORDERED_ROLES = RoleTypeSchema.options;
|
|
37
|
+
/** The single role that carries superuser authority. */
|
|
38
|
+
const SUPERADMIN_ROLE = "superadmin";
|
|
39
|
+
/**
|
|
40
|
+
* Whether `role` is a role this build recognises.
|
|
41
|
+
*
|
|
42
|
+
* The type system already constrains typed call sites, but this package is
|
|
43
|
+
* published to JavaScript consumers and its claims originate from a backend
|
|
44
|
+
* that may be newer than the client. An unrecognised role is not on the truth
|
|
45
|
+
* table, so it is treated as no privilege at all rather than guessed at.
|
|
46
|
+
*/
|
|
47
|
+
function isKnownRole(role) {
|
|
48
|
+
return ORDERED_ROLES.includes(role);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Return whether `currentRole` meets or exceeds `requiredRole`.
|
|
52
|
+
*
|
|
53
|
+
* Canonical role hierarchy check, ordered highest to lowest privilege via
|
|
54
|
+
* {@link ORDERED_ROLES}. This is the single implementation of the hierarchy;
|
|
55
|
+
* no consumer should duplicate a role-ordered list or compare roles by exact
|
|
56
|
+
* membership - exact membership hides an admin surface from a superadmin.
|
|
57
|
+
*
|
|
58
|
+
* Returns `false` for an insufficient or unrecognised role.
|
|
59
|
+
*/
|
|
60
|
+
export function hasMinimumRole(currentRole, requiredRole) {
|
|
61
|
+
const current = ORDERED_ROLES.indexOf(currentRole);
|
|
62
|
+
const required = ORDERED_ROLES.indexOf(requiredRole);
|
|
63
|
+
if (current === -1 || required === -1)
|
|
64
|
+
return false;
|
|
65
|
+
return current <= required;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Return whether `role` and `isSuperuser` agree per the truth table.
|
|
69
|
+
*
|
|
70
|
+
* Pure cross-field invariant, independent of any hierarchy comparison:
|
|
71
|
+
*
|
|
72
|
+
* - `superadmin` requires `isSuperuser === true`.
|
|
73
|
+
* - Every other recognised role requires `isSuperuser === false`.
|
|
74
|
+
*
|
|
75
|
+
* Returns `true` only when the pair is one of the five valid rows. The claims
|
|
76
|
+
* are compared strictly (`=== true` / `=== false`) rather than by truthiness,
|
|
77
|
+
* so a JavaScript consumer passing an unparsed value cannot widen the
|
|
78
|
+
* invariant.
|
|
79
|
+
*
|
|
80
|
+
* Deviation from the Python original, deliberate: `auth_sdk_m8` types `role`
|
|
81
|
+
* as a closed enum, so an unrecognised role cannot reach it and the final
|
|
82
|
+
* branch treats every non-superadmin input as valid. Here the claims may come
|
|
83
|
+
* from a backend this build does not know, so an unrecognised role is not one
|
|
84
|
+
* of the five rows and fails closed.
|
|
85
|
+
*/
|
|
86
|
+
export function privilegeClaimsAreConsistent(role, isSuperuser) {
|
|
87
|
+
if (!isKnownRole(role))
|
|
88
|
+
return false;
|
|
89
|
+
if (role === SUPERADMIN_ROLE)
|
|
90
|
+
return isSuperuser === true;
|
|
91
|
+
return isSuperuser === false;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Return the exact dual-evidence canonical-superuser predicate.
|
|
95
|
+
*
|
|
96
|
+
* Requires both the consistency invariant and the canonical pair
|
|
97
|
+
* (`role === "superadmin"` and `isSuperuser === true`). Callers must use this
|
|
98
|
+
* instead of reading `is_superuser` or `role` alone - a stray
|
|
99
|
+
* `is_superuser: true` on a non-superadmin role (or vice versa) never grants
|
|
100
|
+
* superuser privileges. Such mismatched pairs are not hypothetical: they exist
|
|
101
|
+
* on rows written before `fa-auth-m8` 2.0.0 added its consistency constraint,
|
|
102
|
+
* for the length of the expand/repair migration window.
|
|
103
|
+
*/
|
|
104
|
+
export function hasSuperuserPrivileges(role, isSuperuser) {
|
|
105
|
+
return privilegeClaimsAreConsistent(role, isSuperuser)
|
|
106
|
+
&& role === SUPERADMIN_ROLE
|
|
107
|
+
&& isSuperuser === true;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=authorization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorization.js","sourceRoot":"","sources":["../../../src/runtime/authorization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,cAAc,EAAiB,MAAM,cAAc,CAAC;AAE7D;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,aAAa,GAAwB,cAAc,CAAC,OAAO,CAAC;AAEzE,wDAAwD;AACxD,MAAM,eAAe,GAAa,YAAY,CAAC;AAE/C;;;;;;;GAOG;AACH,SAAS,WAAW,CAAC,IAAc;IACjC,OAAO,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACtC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAAC,WAAqB,EAAE,YAAsB;IAC1E,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACnD,MAAM,QAAQ,GAAG,aAAa,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACrD,IAAI,OAAO,KAAK,CAAC,CAAC,IAAI,QAAQ,KAAK,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IACpD,OAAO,OAAO,IAAI,QAAQ,CAAC;AAC7B,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,4BAA4B,CAAC,IAAc,EAAE,WAAoB;IAC/E,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACrC,IAAI,IAAI,KAAK,eAAe;QAAE,OAAO,WAAW,KAAK,IAAI,CAAC;IAC1D,OAAO,WAAW,KAAK,KAAK,CAAC;AAC/B,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAc,EAAE,WAAoB;IACzE,OAAO,4BAA4B,CAAC,IAAI,EAAE,WAAW,CAAC;WACjD,IAAI,KAAK,eAAe;WACxB,WAAW,KAAK,IAAI,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type AuthRuntimeConfig } from "./config.js";
|
|
2
|
+
export type FaAuthBrowserUser = {
|
|
3
|
+
id: string;
|
|
4
|
+
role: "superadmin" | "admin" | "writer" | "reader" | "user";
|
|
5
|
+
is_superuser: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type FaAuthBrowserAdapter = {
|
|
8
|
+
getAccessToken: () => string | null;
|
|
9
|
+
refresh: () => Promise<string | null>;
|
|
10
|
+
getCurrentUser: () => Promise<FaAuthBrowserUser>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Expose the auth-owned browser adapter for independently installed plugins.
|
|
14
|
+
* Plugins consume this browser contract through their local auth adapters;
|
|
15
|
+
* they never import auth runtime modules directly.
|
|
16
|
+
*/
|
|
17
|
+
export declare function installFaAuthBrowserAdapter(config?: Partial<AuthRuntimeConfig>): FaAuthBrowserAdapter;
|
|
18
|
+
//# sourceMappingURL=browserAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browserAdapter.d.ts","sourceRoot":"","sources":["../../../src/runtime/browserAdapter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGpE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC5D,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,cAAc,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IACpC,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACtC,cAAc,EAAE,MAAM,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAClD,CAAC;AA2BF;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,GAAE,OAAO,CAAC,iBAAiB,CAAM,GACtC,oBAAoB,CAmBtB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { refreshToken } from "./api/auth.js";
|
|
2
|
+
import { getServiceMeta } from "./api/ops.js";
|
|
3
|
+
import { getProfile } from "./api/profile.js";
|
|
4
|
+
import { getFaAuthM8Compatibility } from "./compatibility.js";
|
|
5
|
+
import { configureAuth } from "./config.js";
|
|
6
|
+
import { getToken } from "./tokenStore.js";
|
|
7
|
+
let warnedUnknownCompatibility = false;
|
|
8
|
+
// AA-16/AA-22: warn-not-throw preflight against the released fa-auth-m8
|
|
9
|
+
// contract. Runs once per adapter install and never blocks or fails setup —
|
|
10
|
+
// a GET /meta failure (offline, CORS, an older backend without the route) is
|
|
11
|
+
// swallowed, since this is advisory only. `assertFaAuthM8Compatibility`
|
|
12
|
+
// remains exported, unchanged, for hosts that want to fail closed instead.
|
|
13
|
+
function runCompatibilityPreflight() {
|
|
14
|
+
void getServiceMeta()
|
|
15
|
+
.then((meta) => {
|
|
16
|
+
const compatibility = getFaAuthM8Compatibility(meta);
|
|
17
|
+
if (compatibility.status === "incompatible") {
|
|
18
|
+
console.warn(`[@mano8/astro-auth-m8] ${compatibility.reason}`);
|
|
19
|
+
}
|
|
20
|
+
else if (compatibility.status === "unknown" && !warnedUnknownCompatibility) {
|
|
21
|
+
warnedUnknownCompatibility = true;
|
|
22
|
+
console.warn(`[@mano8/astro-auth-m8] ${compatibility.reason}`);
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
.catch(() => { });
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Expose the auth-owned browser adapter for independently installed plugins.
|
|
29
|
+
* Plugins consume this browser contract through their local auth adapters;
|
|
30
|
+
* they never import auth runtime modules directly.
|
|
31
|
+
*/
|
|
32
|
+
export function installFaAuthBrowserAdapter(config = {}) {
|
|
33
|
+
configureAuth(config);
|
|
34
|
+
runCompatibilityPreflight();
|
|
35
|
+
const adapter = {
|
|
36
|
+
getAccessToken: getToken,
|
|
37
|
+
refresh: async () => (await refreshToken()).access_token,
|
|
38
|
+
getCurrentUser: async () => {
|
|
39
|
+
const user = await getProfile();
|
|
40
|
+
return {
|
|
41
|
+
id: user.id,
|
|
42
|
+
role: user.role,
|
|
43
|
+
is_superuser: user.is_superuser
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
globalThis.__M8_FA_AUTH_ADAPTER__ = adapter;
|
|
48
|
+
return adapter;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=browserAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browserAdapter.js","sourceRoot":"","sources":["../../../src/runtime/browserAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAA0B,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAkB3C,IAAI,0BAA0B,GAAG,KAAK,CAAC;AAEvC,wEAAwE;AACxE,4EAA4E;AAC5E,6EAA6E;AAC7E,wEAAwE;AACxE,2EAA2E;AAC3E,SAAS,yBAAyB;IAChC,KAAK,cAAc,EAAE;SAClB,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;QACb,MAAM,aAAa,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;QACrD,IAAI,aAAa,CAAC,MAAM,KAAK,cAAc,EAAE,CAAC;YAC5C,OAAO,CAAC,IAAI,CAAC,0BAA0B,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC;QACjE,CAAC;aAAM,IAAI,aAAa,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,0BAA0B,EAAE,CAAC;YAC7E,0BAA0B,GAAG,IAAI,CAAC;YAClC,OAAO,CAAC,IAAI,CAAC,0BAA0B,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC;QACjE,CAAC;IACH,CAAC,CAAC;SACD,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;AACrB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CACzC,SAAqC,EAAE;IAEvC,aAAa,CAAC,MAAM,CAAC,CAAC;IACtB,yBAAyB,EAAE,CAAC;IAE5B,MAAM,OAAO,GAAyB;QACpC,cAAc,EAAE,QAAQ;QACxB,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,YAAY,EAAE,CAAC,CAAC,YAAY;QACxD,cAAc,EAAE,KAAK,IAAI,EAAE;YACzB,MAAM,IAAI,GAAG,MAAM,UAAU,EAAE,CAAC;YAChC,OAAO;gBACL,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,YAAY,EAAE,IAAI,CAAC,YAAY;aAChC,CAAC;QACJ,CAAC;KACF,CAAC;IAED,UAAgC,CAAC,sBAAsB,GAAG,OAAO,CAAC;IACnE,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export declare const FA_AUTH_M8_CONTRACT_ID = "fa-auth-m8";
|
|
2
|
-
export declare const FA_AUTH_M8_CONTRACT_VERSION = "
|
|
3
|
-
export declare const FA_AUTH_M8_CONTRACT: "fa-auth-m8@
|
|
4
|
-
export declare const FA_AUTH_M8_TESTED_SERVICE_VERSION = "
|
|
5
|
-
export declare const FA_AUTH_M8_MIN_SERVICE_VERSION = "
|
|
6
|
-
export declare const FA_AUTH_M8_MAX_SERVICE_VERSION_EXCLUSIVE = "
|
|
7
|
-
export declare const FA_AUTH_M8_SERVICE_VERSION_RANGE = ">=
|
|
2
|
+
export declare const FA_AUTH_M8_CONTRACT_VERSION = "2.0";
|
|
3
|
+
export declare const FA_AUTH_M8_CONTRACT: "fa-auth-m8@2.0";
|
|
4
|
+
export declare const FA_AUTH_M8_TESTED_SERVICE_VERSION = "2.0.0";
|
|
5
|
+
export declare const FA_AUTH_M8_MIN_SERVICE_VERSION = "2.0.0";
|
|
6
|
+
export declare const FA_AUTH_M8_MAX_SERVICE_VERSION_EXCLUSIVE = "3.0.0";
|
|
7
|
+
export declare const FA_AUTH_M8_SERVICE_VERSION_RANGE = ">=2.0.0 <3.0.0";
|
|
8
8
|
export type FaAuthM8CompatibilityStatus = "compatible" | "incompatible" | "unknown";
|
|
9
9
|
export type FaAuthM8VersionMetadata = {
|
|
10
10
|
contract?: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compatibility.d.ts","sourceRoot":"","sources":["../../../src/runtime/compatibility.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,eAAe,CAAC;AACnD,eAAO,MAAM,2BAA2B,QAAQ,CAAC;AACjD,eAAO,MAAM,mBAAmB,kBAAsE,CAAC;AAEvG,eAAO,MAAM,iCAAiC,UAAU,CAAC;AACzD,eAAO,MAAM,8BAA8B,UAAU,CAAC;AACtD,eAAO,MAAM,wCAAwC,UAAU,CAAC;AAChE,eAAO,MAAM,gCAAgC,mBAAqF,CAAC;AAEnI,MAAM,MAAM,2BAA2B,GAAG,YAAY,GAAG,cAAc,GAAG,SAAS,CAAC;AAEpF,MAAM,MAAM,uBAAuB,GAAG;IAGpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,2BAA2B,CAAC;IACpC,gBAAgB,EAAE,OAAO,mBAAmB,CAAC;IAC7C,2BAA2B,EAAE,OAAO,gCA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AAE,MAAM,CAAC;CACjB,CAAC;AA+CF,wBAAgB,kCAAkC,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAI3E;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,GAAE,uBAA4B,GAAG,qBAAqB,CAiEtG;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,uBAAuB,EAAE,YAAY,UAAO,GAAG,qBAAqB,CAMzH"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export const FA_AUTH_M8_CONTRACT_ID = "fa-auth-m8";
|
|
2
|
-
export const FA_AUTH_M8_CONTRACT_VERSION = "
|
|
2
|
+
export const FA_AUTH_M8_CONTRACT_VERSION = "2.0";
|
|
3
3
|
export const FA_AUTH_M8_CONTRACT = `${FA_AUTH_M8_CONTRACT_ID}@${FA_AUTH_M8_CONTRACT_VERSION}`;
|
|
4
|
-
//
|
|
5
|
-
export const FA_AUTH_M8_TESTED_SERVICE_VERSION = "
|
|
6
|
-
export const FA_AUTH_M8_MIN_SERVICE_VERSION = "
|
|
7
|
-
export const FA_AUTH_M8_MAX_SERVICE_VERSION_EXCLUSIVE = "
|
|
4
|
+
// 2.0.0 is the supported fa-auth-m8 service baseline for this plugin.
|
|
5
|
+
export const FA_AUTH_M8_TESTED_SERVICE_VERSION = "2.0.0";
|
|
6
|
+
export const FA_AUTH_M8_MIN_SERVICE_VERSION = "2.0.0";
|
|
7
|
+
export const FA_AUTH_M8_MAX_SERVICE_VERSION_EXCLUSIVE = "3.0.0";
|
|
8
8
|
export const FA_AUTH_M8_SERVICE_VERSION_RANGE = `>=${FA_AUTH_M8_MIN_SERVICE_VERSION} <${FA_AUTH_M8_MAX_SERVICE_VERSION_EXCLUSIVE}`;
|
|
9
9
|
function stringValue(value) {
|
|
10
10
|
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
@@ -16,6 +16,21 @@ function contractObjectVersion(value) {
|
|
|
16
16
|
}
|
|
17
17
|
return undefined;
|
|
18
18
|
}
|
|
19
|
+
// Read ``contract.name`` from the GET /meta nested contract object.
|
|
20
|
+
//
|
|
21
|
+
// The flat-string contract forms carry the issuer id inline (``fa-auth-m8@2.0``)
|
|
22
|
+
// and are checked against it, but the nested object splits id and version apart.
|
|
23
|
+
// Without reading ``name`` the version check alone would bless any service whose
|
|
24
|
+
// contract happens to sit at the same version - and ``mount_service_meta`` is a
|
|
25
|
+
// shared auth-sdk-m8 helper, so every M8 service serves this same payload shape
|
|
26
|
+
// at ``{API_PREFIX}/meta``. A host pointed at the wrong sibling is exactly the
|
|
27
|
+
// misconfiguration the preflight exists to name.
|
|
28
|
+
function contractObjectName(value) {
|
|
29
|
+
if (typeof value === "object" && value !== null) {
|
|
30
|
+
return stringValue(value.name);
|
|
31
|
+
}
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
19
34
|
function parseSemver(version) {
|
|
20
35
|
const match = /^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(version);
|
|
21
36
|
if (!match)
|
|
@@ -50,6 +65,21 @@ export function getFaAuthM8Compatibility(metadata = {}) {
|
|
|
50
65
|
const serviceVersion = stringValue(metadata.fa_auth_m8_version)
|
|
51
66
|
?? stringValue(metadata.service_version)
|
|
52
67
|
?? stringValue(metadata.version);
|
|
68
|
+
// Checked before the version, so a wrong service is reported as a wrong
|
|
69
|
+
// service rather than as a version mismatch. Only applies when the payload
|
|
70
|
+
// names an id at all - a nested contract without a `name` still falls through
|
|
71
|
+
// to the version comparison below.
|
|
72
|
+
const contractName = contractObjectName(metadata.contract);
|
|
73
|
+
if (contractName && contractName !== FA_AUTH_M8_CONTRACT_ID) {
|
|
74
|
+
return {
|
|
75
|
+
status: "incompatible",
|
|
76
|
+
expectedContract: FA_AUTH_M8_CONTRACT,
|
|
77
|
+
expectedServiceVersionRange: FA_AUTH_M8_SERVICE_VERSION_RANGE,
|
|
78
|
+
contractVersion,
|
|
79
|
+
serviceVersion,
|
|
80
|
+
reason: `Expected ${FA_AUTH_M8_CONTRACT}, received the ${contractName} contract - check the configured auth API base`
|
|
81
|
+
};
|
|
82
|
+
}
|
|
53
83
|
if (contractVersion && contractVersion !== FA_AUTH_M8_CONTRACT_VERSION && contractVersion !== FA_AUTH_M8_CONTRACT) {
|
|
54
84
|
return {
|
|
55
85
|
status: "incompatible",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compatibility.js","sourceRoot":"","sources":["../../../src/runtime/compatibility.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,YAAY,CAAC;AACnD,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,CAAC;AACjD,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,sBAAsB,IAAI,2BAA2B,EAAW,CAAC;AACvG,sEAAsE;AACtE,MAAM,CAAC,MAAM,iCAAiC,GAAG,OAAO,CAAC;AACzD,MAAM,CAAC,MAAM,8BAA8B,GAAG,OAAO,CAAC;AACtD,MAAM,CAAC,MAAM,wCAAwC,GAAG,OAAO,CAAC;AAChE,MAAM,CAAC,MAAM,gCAAgC,GAAG,KAAK,8BAA8B,KAAK,wCAAwC,EAAE,CAAC;AA6BnI,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9E,CAAC;AAED,uEAAuE;AACvE,SAAS,qBAAqB,CAAC,KAAc;IAC3C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,WAAW,CAAE,KAA+B,CAAC,OAAO,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,WAAW,CAAC,OAAe;IAClC,MAAM,KAAK,GAAG,kCAAkC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/D,IAAI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|
|
18
18
|
}
|
|
19
19
|
export declare function normalizeFastApiError(payload: unknown): unknown;
|
|
20
|
+
/**
|
|
21
|
+
* An operator-facing error presentation: a short labelled `title` plus an
|
|
22
|
+
* optional `description` with more detail. Never contains a raw backend
|
|
23
|
+
* detail token (e.g. `last_superuser_required`) as the `title` - only as a
|
|
24
|
+
* verbatim `description` where the contract guarantees it is free text meant
|
|
25
|
+
* for display (the `400` retention-floor case).
|
|
26
|
+
*/
|
|
27
|
+
export interface ApiErrorPresentation {
|
|
28
|
+
title: string;
|
|
29
|
+
description?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Map a `fa-auth-m8` 2.0.0 authorization/rate-limit/retention error to an
|
|
33
|
+
* operator-readable presentation. Covers the role-change error contracts
|
|
34
|
+
* shared by `PATCH /users/update/{id}/` and `DELETE /users/delete/{id}/`
|
|
35
|
+
* (403 self-promotion, 409 `last_superuser_required`) plus the rate-limit and
|
|
36
|
+
* retention-floor contracts every new admin surface (audit log, both purges)
|
|
37
|
+
* shares with them, so callers do not each re-derive these mappings:
|
|
38
|
+
*
|
|
39
|
+
* - `403` - not permitted (e.g. a role change refused as self-promotion, or a
|
|
40
|
+
* privileged read/purge attempted without the tier). Titled by status, since
|
|
41
|
+
* several mapped surfaces produce a `403` and the detail that would tell them
|
|
42
|
+
* apart is not a stable contract; the backend's own readable detail carries
|
|
43
|
+
* the specific cause.
|
|
44
|
+
* - `409` with detail `last_superuser_required` - the raw token is never
|
|
45
|
+
* surfaced; replaced with a labelled explanation.
|
|
46
|
+
* - `429` - rate limited. The action was not attempted; safe to retry later,
|
|
47
|
+
* never automatically.
|
|
48
|
+
* - `503` - fail-closed rate limiting (e.g. Redis unavailable). Unlike `429`,
|
|
49
|
+
* the action's outcome is *unknown* - the message must not imply failure,
|
|
50
|
+
* and callers must not auto-retry (a retry could double an already-applied
|
|
51
|
+
* effect).
|
|
52
|
+
* - `400` - e.g. a purge's retention-floor rejection. The detail is free
|
|
53
|
+
* text (`str(exc)`) and is surfaced verbatim under a labelled heading,
|
|
54
|
+
* never pattern-matched into a token, since it is not a stable contract.
|
|
55
|
+
*
|
|
56
|
+
* Anything else falls back to the error's own message, then `fallback`.
|
|
57
|
+
*/
|
|
58
|
+
export declare function describeApiError(error: unknown, fallback: string): ApiErrorPresentation;
|
|
20
59
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/runtime/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,YAAY;;iBAEvB,CAAC;AAEH;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAarE;AAED,qBAAa,QAAS,SAAQ,KAAK;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;gBAEb,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM;CAM9D;AAED,qBAAa,oBAAqB,SAAQ,QAAQ;gBACpC,OAAO,SAA4B;CAIhD;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAG/D"}
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/runtime/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,YAAY;;iBAEvB,CAAC;AAEH;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAarE;AAED,qBAAa,QAAS,SAAQ,KAAK;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;gBAEb,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM;CAM9D;AAED,qBAAa,oBAAqB,SAAQ,QAAQ;gBACpC,OAAO,SAA4B;CAIhD;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAG/D;AAED;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAyDD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,oBAAoB,CAYvF"}
|
|
@@ -41,4 +41,83 @@ export function normalizeFastApiError(payload) {
|
|
|
41
41
|
const parsed = ApiErrorBody.safeParse(payload);
|
|
42
42
|
return parsed.success ? parsed.data.detail : payload;
|
|
43
43
|
}
|
|
44
|
+
const LAST_SUPERUSER_REQUIRED = "last_superuser_required";
|
|
45
|
+
/**
|
|
46
|
+
* One entry per mapped status. Kept as a table rather than a chain of `if`s so
|
|
47
|
+
* a new contract is a new row, and so each mapping can be read - and reviewed
|
|
48
|
+
* against the backend route that produces it - on its own.
|
|
49
|
+
*/
|
|
50
|
+
const API_ERROR_PRESENTERS = new Map([
|
|
51
|
+
[400, (detail) => (detail ? { title: "Rejected", description: detail } : undefined)],
|
|
52
|
+
// Titled by status, not by cause: every mapped surface can produce a 403
|
|
53
|
+
// (a role change refused as self-promotion, but also an audit-log read or a
|
|
54
|
+
// purge attempted by a principal demoted since the page loaded), and the
|
|
55
|
+
// detail string that would distinguish them is not a stable contract. The
|
|
56
|
+
// backend's own 403 detail is already operator-readable ("A user may not
|
|
57
|
+
// raise their own role"), so it carries the specific cause as the
|
|
58
|
+
// description while the title never asserts one that may be wrong.
|
|
59
|
+
[403, (detail, fallback) => ({ title: "Not permitted", description: detail ?? fallback })],
|
|
60
|
+
[
|
|
61
|
+
409,
|
|
62
|
+
(detail) => detail === LAST_SUPERUSER_REQUIRED
|
|
63
|
+
? {
|
|
64
|
+
title: "Last superuser required",
|
|
65
|
+
description: "This is the only remaining superuser account, so it can't be changed or removed."
|
|
66
|
+
}
|
|
67
|
+
: undefined
|
|
68
|
+
],
|
|
69
|
+
[
|
|
70
|
+
429,
|
|
71
|
+
() => ({
|
|
72
|
+
title: "Too many requests",
|
|
73
|
+
description: "Try again later - this action was not attempted."
|
|
74
|
+
})
|
|
75
|
+
],
|
|
76
|
+
[
|
|
77
|
+
503,
|
|
78
|
+
() => ({
|
|
79
|
+
title: "Temporarily unavailable",
|
|
80
|
+
description: "The outcome of this action is unknown. Do not retry until you've confirmed its status."
|
|
81
|
+
})
|
|
82
|
+
]
|
|
83
|
+
]);
|
|
84
|
+
/**
|
|
85
|
+
* Map a `fa-auth-m8` 2.0.0 authorization/rate-limit/retention error to an
|
|
86
|
+
* operator-readable presentation. Covers the role-change error contracts
|
|
87
|
+
* shared by `PATCH /users/update/{id}/` and `DELETE /users/delete/{id}/`
|
|
88
|
+
* (403 self-promotion, 409 `last_superuser_required`) plus the rate-limit and
|
|
89
|
+
* retention-floor contracts every new admin surface (audit log, both purges)
|
|
90
|
+
* shares with them, so callers do not each re-derive these mappings:
|
|
91
|
+
*
|
|
92
|
+
* - `403` - not permitted (e.g. a role change refused as self-promotion, or a
|
|
93
|
+
* privileged read/purge attempted without the tier). Titled by status, since
|
|
94
|
+
* several mapped surfaces produce a `403` and the detail that would tell them
|
|
95
|
+
* apart is not a stable contract; the backend's own readable detail carries
|
|
96
|
+
* the specific cause.
|
|
97
|
+
* - `409` with detail `last_superuser_required` - the raw token is never
|
|
98
|
+
* surfaced; replaced with a labelled explanation.
|
|
99
|
+
* - `429` - rate limited. The action was not attempted; safe to retry later,
|
|
100
|
+
* never automatically.
|
|
101
|
+
* - `503` - fail-closed rate limiting (e.g. Redis unavailable). Unlike `429`,
|
|
102
|
+
* the action's outcome is *unknown* - the message must not imply failure,
|
|
103
|
+
* and callers must not auto-retry (a retry could double an already-applied
|
|
104
|
+
* effect).
|
|
105
|
+
* - `400` - e.g. a purge's retention-floor rejection. The detail is free
|
|
106
|
+
* text (`str(exc)`) and is surfaced verbatim under a labelled heading,
|
|
107
|
+
* never pattern-matched into a token, since it is not a stable contract.
|
|
108
|
+
*
|
|
109
|
+
* Anything else falls back to the error's own message, then `fallback`.
|
|
110
|
+
*/
|
|
111
|
+
export function describeApiError(error, fallback) {
|
|
112
|
+
if (error instanceof ApiError) {
|
|
113
|
+
const detail = typeof error.detail === "string" ? error.detail : undefined;
|
|
114
|
+
const presented = API_ERROR_PRESENTERS.get(error.status)?.(detail, fallback);
|
|
115
|
+
if (presented)
|
|
116
|
+
return presented;
|
|
117
|
+
}
|
|
118
|
+
if (error instanceof Error && error.message) {
|
|
119
|
+
return { title: error.message };
|
|
120
|
+
}
|
|
121
|
+
return { title: fallback };
|
|
122
|
+
}
|
|
44
123
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/runtime/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;CACpB,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAe;IAC/C,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,EAAE;QAAE,OAAO,MAAM,CAAC;IAC/D,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAG,MAAM;aACjB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACZ,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,KA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wFAAwF;SAC3F,CAAC;KACH;CACF,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc,EAAE,QAAgB;IAC/D,IAAI,KAAK,YAAY,QAAQ,EAAE,CAAC;QAC9B,MAAM,MAAM,GAAG,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;QAC3E,MAAM,SAAS,GAAG,oBAAoB,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC7E,IAAI,SAAS;YAAE,OAAO,SAAS,CAAC;IAClC,CAAC;IAED,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QAC5C,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;IAClC,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -3,6 +3,7 @@ export * from "./useApiKeys.js";
|
|
|
3
3
|
export * from "./useDashboard.js";
|
|
4
4
|
export * from "./useGoogleLogin.js";
|
|
5
5
|
export * from "./useProfile.js";
|
|
6
|
+
export * from "./useSecurity.js";
|
|
6
7
|
export * from "./useSessions.js";
|
|
7
8
|
export * from "./useUsers.js";
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/runtime/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/runtime/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
|
|
@@ -3,6 +3,7 @@ export * from "./useApiKeys.js";
|
|
|
3
3
|
export * from "./useDashboard.js";
|
|
4
4
|
export * from "./useGoogleLogin.js";
|
|
5
5
|
export * from "./useProfile.js";
|
|
6
|
+
export * from "./useSecurity.js";
|
|
6
7
|
export * from "./useSessions.js";
|
|
7
8
|
export * from "./useUsers.js";
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/runtime/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/runtime/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
|