@fuzdev/fuz_app 0.158.0 → 0.160.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/dist/actions/CLAUDE.md +7 -2
- package/dist/actions/protocol.d.ts +7 -0
- package/dist/actions/protocol.d.ts.map +1 -1
- package/dist/actions/protocol.js +19 -4
- package/dist/auth/CLAUDE.md +40 -15
- package/dist/auth/account_schema.d.ts +2 -2
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +1 -1
- package/dist/auth/audit_log_route_schema.d.ts +18 -6
- package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_route_schema.js +7 -3
- package/dist/auth/credential_type_schema.d.ts +4 -4
- package/dist/auth/credential_type_schema.d.ts.map +1 -1
- package/dist/auth/credential_type_schema.js +6 -6
- package/dist/auth/grant_path_schema.d.ts +4 -4
- package/dist/auth/grant_path_schema.d.ts.map +1 -1
- package/dist/auth/grant_path_schema.js +6 -6
- package/dist/auth/request_context.js +1 -1
- package/dist/auth/role_grant_offer_action_specs.d.ts +2257 -400
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +109 -102
- package/dist/auth/role_grant_offer_actions.d.ts +6 -3
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +15 -6
- package/dist/auth/role_grant_offer_ddl.d.ts +5 -4
- package/dist/auth/role_grant_offer_ddl.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_ddl.js +5 -4
- package/dist/auth/role_grant_offer_notifications.d.ts +1364 -255
- package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_notifications.js +100 -47
- package/dist/auth/role_grant_offer_schema.d.ts +90 -22
- package/dist/auth/role_grant_offer_schema.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_schema.js +40 -39
- package/dist/auth/role_schema.d.ts +15 -2
- package/dist/auth/role_schema.d.ts.map +1 -1
- package/dist/auth/role_schema.js +17 -4
- package/dist/auth/role_schema_fuz.d.ts +29 -0
- package/dist/auth/role_schema_fuz.d.ts.map +1 -0
- package/dist/auth/role_schema_fuz.js +28 -0
- package/dist/auth/scope_kind_schema.d.ts +27 -15
- package/dist/auth/scope_kind_schema.d.ts.map +1 -1
- package/dist/auth/scope_kind_schema.js +30 -18
- package/dist/auth/scope_kind_schema_fuz.d.ts +30 -0
- package/dist/auth/scope_kind_schema_fuz.d.ts.map +1 -0
- package/dist/auth/scope_kind_schema_fuz.js +29 -0
- package/dist/auth/self_service_role_action_specs.d.ts +70 -27
- package/dist/auth/self_service_role_action_specs.d.ts.map +1 -1
- package/dist/auth/self_service_role_action_specs.js +16 -14
- package/dist/auth/token_scope.d.ts +3 -2
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +4 -3
- package/dist/http/CLAUDE.md +6 -0
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/http/db_routes.js +8 -3
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +3 -2
- package/dist/server/surface_route.d.ts.map +1 -1
- package/dist/server/surface_route.js +3 -2
- package/dist/testing/CLAUDE.md +27 -16
- package/dist/testing/cross_backend/default_spine_surface.d.ts +1 -1
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts +15 -3
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.js +60 -17
- package/dist/testing/cross_backend/role_grant_role_grammar.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_role_grammar.js +94 -6
- package/dist/testing/cross_backend/spine_suites.d.ts +4 -3
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +2 -1
- package/dist/ui/CLAUDE.md +4 -4
- package/dist/ui/admin_accounts_state.svelte.d.ts +8 -8
- package/dist/ui/role_grant_offers_state.svelte.d.ts +9 -9
- package/dist/ui/role_grant_offers_state.svelte.js +4 -4
- package/package.json +1 -1
package/dist/actions/CLAUDE.md
CHANGED
|
@@ -802,8 +802,13 @@ actions of the server's sole `rpc_endpoints` entry through `to_ws_actions`
|
|
|
802
802
|
(`actions/protocol.ts`): `protocol_actions` first, then the RPC list less any
|
|
803
803
|
protocol action it carries (`peer_ping_action` rides the RPC list so an HTTP
|
|
804
804
|
caller is refused `peer_no_transport` rather than `method_not_found`). One set
|
|
805
|
-
of handler closures then runs on both transports.
|
|
806
|
-
|
|
805
|
+
of handler closures then runs on both transports. When the RPC list holds
|
|
806
|
+
`role_grant_offer_create`, the handler-less
|
|
807
|
+
`role_grant_offer_notification_actions` follow, so the WS surface lists what
|
|
808
|
+
the role_grant_offer actions push as `remote_notification` methods; with no
|
|
809
|
+
handler they never dispatch, and an inbound frame for one is answered
|
|
810
|
+
`method_not_found`. Assembly throws when a spec omits `actions` and
|
|
811
|
+
no RPC endpoint, or more than one, resolves.
|
|
807
812
|
|
|
808
813
|
`max_connections_per_account` sets the per-account connection cap on the
|
|
809
814
|
registry the mount creates (`RegisterActionWsOptions` carries the same field).
|
|
@@ -51,6 +51,13 @@ export declare const protocol_action_specs: ReadonlyArray<ActionSpecUnion>;
|
|
|
51
51
|
* RPC list carries (`peer_ping_action`, which an HTTP caller must reach to be
|
|
52
52
|
* refused `peer_no_transport`) is not registered twice.
|
|
53
53
|
*
|
|
54
|
+
* When `rpc_actions` carries the role_grant_offer actions (it holds
|
|
55
|
+
* `role_grant_offer_create`), the role_grant_offer notifications follow, as
|
|
56
|
+
* the handler-less `role_grant_offer_notification_actions`, so the WS
|
|
57
|
+
* endpoint's surface lists what those actions push. With no handler a
|
|
58
|
+
* notification never reaches dispatch, and an inbound frame for one is
|
|
59
|
+
* answered `method_not_found`.
|
|
60
|
+
*
|
|
54
61
|
* What a `WsEndpointSpec` that omits `actions` serves, from the server's sole
|
|
55
62
|
* RPC endpoint (`actions/ws_endpoint_spec.ts`).
|
|
56
63
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAOhD;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAAC,MAAM,CAIlD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC,eAAe,CAEhE,CAAC;AAIF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,aAAa,GAAI,aAAa,aAAa,CAAC,MAAM,CAAC,KAAG,KAAK,CAAC,MAAM,CAS9E,CAAC"}
|
package/dist/actions/protocol.js
CHANGED
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
import { cancel_action } from './cancel.js';
|
|
22
22
|
import { heartbeat_action } from './heartbeat.js';
|
|
23
23
|
import { peer_ping_action } from './peer_ping.js';
|
|
24
|
+
import { role_grant_offer_create_action_spec } from '../auth/role_grant_offer_action_specs.js';
|
|
25
|
+
import { role_grant_offer_notification_actions } from '../auth/role_grant_offer_notifications.js';
|
|
24
26
|
/**
|
|
25
27
|
* Canonical protocol `{spec, handler}` tuples for the server's
|
|
26
28
|
* `register_action_ws` `actions` array. Spread before consumer-owned actions
|
|
@@ -57,13 +59,26 @@ const PROTOCOL_METHODS = new Set(protocol_actions.map((a) => a.spec.method));
|
|
|
57
59
|
* RPC list carries (`peer_ping_action`, which an HTTP caller must reach to be
|
|
58
60
|
* refused `peer_no_transport`) is not registered twice.
|
|
59
61
|
*
|
|
62
|
+
* When `rpc_actions` carries the role_grant_offer actions (it holds
|
|
63
|
+
* `role_grant_offer_create`), the role_grant_offer notifications follow, as
|
|
64
|
+
* the handler-less `role_grant_offer_notification_actions`, so the WS
|
|
65
|
+
* endpoint's surface lists what those actions push. With no handler a
|
|
66
|
+
* notification never reaches dispatch, and an inbound frame for one is
|
|
67
|
+
* answered `method_not_found`.
|
|
68
|
+
*
|
|
60
69
|
* What a `WsEndpointSpec` that omits `actions` serves, from the server's sole
|
|
61
70
|
* RPC endpoint (`actions/ws_endpoint_spec.ts`).
|
|
62
71
|
*
|
|
63
72
|
* @param rpc_actions - the RPC endpoint's actions
|
|
64
73
|
* @returns the WS endpoint's actions
|
|
65
74
|
*/
|
|
66
|
-
export const to_ws_actions = (rpc_actions) =>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
75
|
+
export const to_ws_actions = (rpc_actions) => {
|
|
76
|
+
const actions = [
|
|
77
|
+
...protocol_actions,
|
|
78
|
+
...rpc_actions.filter((a) => !PROTOCOL_METHODS.has(a.spec.method))
|
|
79
|
+
];
|
|
80
|
+
if (rpc_actions.some((a) => a.spec.method === role_grant_offer_create_action_spec.method)) {
|
|
81
|
+
actions.push(...role_grant_offer_notification_actions);
|
|
82
|
+
}
|
|
83
|
+
return actions;
|
|
84
|
+
};
|
package/dist/auth/CLAUDE.md
CHANGED
|
@@ -57,8 +57,9 @@ Cross-cutting notes that don't live on any single symbol:
|
|
|
57
57
|
Convention — `*_schema.ts` is Zod-only; `*_ddl.ts` holds DDL strings.
|
|
58
58
|
|
|
59
59
|
- `auth/account_schema.ts` — `Account`, `Actor`, `RoleGrant`, `AuthSession`, `ApiToken` + client-safe JSON shapes. Grant predicates over wire fields: `is_role_grant_active` (not revoked, not expired) and `has_global_role(role_grants, role, now?)` (an active grant of the role with `scope_id === null` — the bare-list form of `has_scoped_role(ctx, role, null)`, used client-side by `AuthState`).
|
|
60
|
-
- `auth/role_schema.ts` — `RoleName` (lowercase letters and underscores, no leading or
|
|
61
|
-
- `auth/
|
|
60
|
+
- `auth/role_schema.ts` — `RoleName` (lowercase letters and underscores, no leading, trailing or consecutive underscores, at most `ROLE_NAME_LENGTH_MAX` = 64 characters — the grammar every `role` input and every registered role holds, twin of the Rust `is_valid_role_name`), the constants it is built from (`ROLE_NAME_PATTERN`, `ROLE_NAME_LENGTH_MESSAGE`, `ROLE_NAME_PATTERN_MESSAGE`), `RoleSpec`, `ROLE_KEEPER`, `ROLE_ADMIN`, `is_builtin_role`, `create_role_schema`, `builtin_role_specs_by_name`, `role_has_grant_path`, `list_roles_with_grant_path`.
|
|
61
|
+
- `auth/role_schema_fuz.ts` — the `@fuzdev/fuz_schema` twin of `RoleName` under the same name (`@nodocs` while the Zod one stays), `pipe(bounded_string({max, max_message}), message(regex(ROLE_NAME_PATTERN), ROLE_NAME_PATTERN_MESSAGE))` over the same constants: the same verdict, output and JSON Schema as the Zod one, and its messages; a string both too long and off the grammar gets the length issue alone, where Zod adds the grammar issue. Pinned by `role_schema_fuz.test.ts`. `self_service_role_set`'s input declares it; every other `role` input is the Zod one.
|
|
62
|
+
- `auth/scope_kind_schema.ts` — `ScopeKindName`, the constants its messages come from (`SCOPE_KIND_NAME_LENGTH_MESSAGE`, `SCOPE_KIND_NAME_PATTERN_MESSAGE`), `create_scope_kind_schema` (open registry, no builtins), `SCOPE_KIND_LENGTH_MAX` (64). `ScopeKindName` (grammar and cap) checks a registered name and the `scope_kind` on `role_grant_offer_create` / `role_grant_assign`, which is copied into the row and its audit metadata; off the grammar is the partial unique indexes' `'GLOBAL'` token.
|
|
62
63
|
- `auth/credential_type_schema.ts` — `CredentialTypeName`, `CREDENTIAL_TYPE_SESSION` / `_API_TOKEN` / `_DAEMON_TOKEN`, `create_credential_type_schema`.
|
|
63
64
|
- `auth/grant_path_schema.ts` — `GrantPathName`, `GRANT_PATH_ADMIN` / `_SELF_SERVICE` / `_SYSTEM` / `_BOOTSTRAP`, `create_grant_path_schema`.
|
|
64
65
|
- `auth/token_lifetime.ts` — the temporal axis of a minted token: `TokenLifetimeInput` (required union on `account_token_create` — `{kind:'eternal'}` or `{kind:'ttl', days}`), `token_lifetime_to_expires_at`, `TOKEN_TTL_DAYS_MAX`. No default — `expires_at IS NULL` always means "deliberately eternal".
|
|
@@ -68,10 +69,11 @@ Convention — `*_schema.ts` is Zod-only; `*_ddl.ts` holds DDL strings.
|
|
|
68
69
|
- `auth/audit_log_ddl.ts` — `audit_log` table DDL with `seq BIGSERIAL` for cursor-based gap fill (BIGSERIAL converges with the Rust spine; `create_db` registers a `pg.types` int8 parser so `seq` still reads as a JS number).
|
|
69
70
|
- `auth/invite_schema.ts` — `Invite`, `CreateInviteInput`.
|
|
70
71
|
- `auth/app_settings_schema.ts` — `AppSettings`, `UpdateAppSettingsInput` (single-row via `CHECK (id = 1)`).
|
|
71
|
-
- `auth/
|
|
72
|
+
- `auth/scope_kind_schema_fuz.ts` — the `@fuzdev/fuz_schema` twin of `ScopeKindName` under the same name (`@nodocs` while the Zod one stays), built as the `RoleName` twin is, over `scope_kind_schema.ts`'s constants: the same verdict, output and JSON Schema as the Zod one, and its messages, but for the one length issue of a string too long and off the grammar. Pinned by `scope_kind_schema_fuz.test.ts`. The role_grant_offer schemas declare it.
|
|
73
|
+
- `auth/role_grant_offer_schema.ts` — `RoleGrantOffer`, `RoleGrantOfferJson` (a `@fuzdev/fuz_schema` `object`: `role` the fuz_schema `RoleName`, `scope_kind` the fuz_schema `ScopeKindName` or `null`, so an offer row holding a name off either grammar fails it), `to_role_grant_offer_json`.
|
|
72
74
|
- `auth/role_grant_offer_ddl.ts` — `role_grant_offer` table + indexes + `ROLE_GRANT_OFFER_SCOPE_SENTINEL_UUID` / `_GLOBAL_TOKEN` + `ROLE_GRANT_OFFER_COLUMNS` and the shared `ROLE_GRANT_OFFER_WITH_GRANTOR_SELECT` CTE tail (homed here per the placement rule in `db/sql_columns.ts`).
|
|
73
75
|
- `auth/role_grant_sql.ts` — the liveness predicates every grant and offer read shares: `role_grant_active_sql(alias)` (not revoked, not expired) and `offer_pending_predicate(alias)` (every `OFFER_TERMINAL_COLUMNS` entry null), twins of the Rust spine's. The frozen partial-index DDL keeps its literal text.
|
|
74
|
-
- `auth/role_grant_offer_notifications.ts` —
|
|
76
|
+
- `auth/role_grant_offer_notifications.ts` — the WS notification specs for the consentful-grant lifecycle, their `@fuzdev/fuz_schema` params, builders, `role_grant_offer_notification_actions`, `role_grant_offer_notification_specs`, and `create_validated_notification_sender`.
|
|
75
77
|
|
|
76
78
|
### Queries
|
|
77
79
|
|
|
@@ -492,7 +494,9 @@ Four open string registries — `RoleName`, `ScopeKindName`,
|
|
|
492
494
|
`CredentialTypeName`, `GrantPathName` — share the same factory shape:
|
|
493
495
|
construction-time guards (name regex, duplicate detection, builtin-collision
|
|
494
496
|
rejection), `ReadonlyMap` output, pass into `create_role_schema` for
|
|
495
|
-
cross-axis validation.
|
|
497
|
+
cross-axis validation. The four share one name grammar, runs of lowercase
|
|
498
|
+
letters joined by single underscores, which a token's `surface:` name holds
|
|
499
|
+
too.
|
|
496
500
|
|
|
497
501
|
Dependency flow:
|
|
498
502
|
|
|
@@ -755,7 +759,15 @@ event additionally records `credential_type` in metadata (defense in depth).
|
|
|
755
759
|
> suite assume auto-accept and have to redesign their tests when they
|
|
756
760
|
> discover otherwise.
|
|
757
761
|
|
|
758
|
-
|
|
762
|
+
The specs' inputs and outputs are `@fuzdev/fuz_schema` schemas
|
|
763
|
+
(`auth/role_grant_offer_action_specs.ts`), every object refusing unknown keys,
|
|
764
|
+
`role` the fuz_schema `RoleName`, `scope_kind` the fuz_schema `ScopeKindName`.
|
|
765
|
+
The create and assign inputs end in a `check` of `is_grant_scope_paired`
|
|
766
|
+
(`GRANT_SCOPE_PAIRED_MESSAGE`), run only on an input whose fields all passed;
|
|
767
|
+
the list and history inputs read an omitted input as a fresh `{}`
|
|
768
|
+
(`with_default_fn`); history's `offset` is held to `Number.MAX_SAFE_INTEGER`.
|
|
769
|
+
|
|
770
|
+
- `role_grant_offer_create_action_spec` — session-only; input `{to_account_id, to_actor_id?, role, scope_kind?, scope_id?, message?}` (`scope_kind` a `ScopeKindName`; `scope_kind` + `scope_id` paired — both or neither, else `invalid_params`); output `{offer}`.
|
|
759
771
|
- `role_grant_offer_accept_action_spec` — session-only; input `{offer_id}`; output `{role_grant_id, offer, superseded_offer_ids}`. Refuses a builtin-role offer that must not mint (see below), leaving it pending.
|
|
760
772
|
- `role_grant_offer_decline_action_spec` — input `{offer_id, reason?}`; output `{offer}` (the declined offer, as accept answers its own).
|
|
761
773
|
- `role_grant_offer_retract_action_spec` — input `{offer_id}`; output `{offer}` (the retracted offer).
|
|
@@ -862,13 +874,25 @@ Post-commit via `emit_after_commit` (see `http/CLAUDE.md` §Pending Effects):
|
|
|
862
874
|
- Retract — `role_grant_offer_retracted` → recipient.
|
|
863
875
|
- Accept — `role_grant_offer_accepted` → grantor + `_supersede` per sibling.
|
|
864
876
|
- Decline — `role_grant_offer_declined` → grantor.
|
|
865
|
-
- Revoke — `
|
|
866
|
-
|
|
867
|
-
Spec module is `auth/role_grant_offer_notifications.ts` —
|
|
868
|
-
`RemoteNotificationActionSpec`s with
|
|
869
|
-
builders
|
|
870
|
-
`
|
|
871
|
-
|
|
877
|
+
- Revoke (`role_grant_revoke`) — `role_grant_revoked` → revokee + `_supersede` per superseded offer (the revokee's incoming siblings and its own outgoing offers, each to its grantor).
|
|
878
|
+
|
|
879
|
+
Spec module is `auth/role_grant_offer_notifications.ts` —
|
|
880
|
+
`RemoteNotificationActionSpec`s with `@fuzdev/fuz_schema` params schemas and
|
|
881
|
+
notification builders. `role_grant_revoked`'s params are
|
|
882
|
+
`{role_grant_id, role, scope_kind, scope_id, reason}`, the grant's
|
|
883
|
+
`scope_kind` and `scope_id` both `null` for a global grant, every key
|
|
884
|
+
required. `role_grant_offer_notification_actions` holds the specs as
|
|
885
|
+
handler-less actions: `to_ws_actions` (`actions/protocol.ts`) appends them to
|
|
886
|
+
the WS action set of an RPC list holding `role_grant_offer_create`, so the WS
|
|
887
|
+
endpoint's surface lists them as `remote_notification` methods. The revokee's
|
|
888
|
+
notification is `role_grant_revoked`, not the admin action's
|
|
889
|
+
`role_grant_revoke`, so the two methods never collide. They never reach
|
|
890
|
+
dispatch: an inbound frame for one is answered `method_not_found`. They are not SSE events; `role_grant_offer_notification_specs`
|
|
891
|
+
holds them as `EventSpec`s for a consumer that broadcasts them on an SSE
|
|
892
|
+
channel of its own. Under DEV, `create_role_grant_offer_actions` wraps the
|
|
893
|
+
sender in `create_validated_notification_sender`, which checks each params
|
|
894
|
+
object against its spec's `input` and logs a mismatch, sending it either way;
|
|
895
|
+
production sends unchecked.
|
|
872
896
|
|
|
873
897
|
Deps: `RevokingActionFactoryDeps & {notification_sender?: NotificationSender | null}`.
|
|
874
898
|
`role_grant_revoke` of a global grant queues a close of the revokee account's
|
|
@@ -879,7 +903,7 @@ closes nothing — a role gate admits on global grants alone.
|
|
|
879
903
|
`NotificationSender` is the narrow structural capability
|
|
880
904
|
(`send_to_account(account_id, message): number`); `ConnectionRegistry`
|
|
881
905
|
satisfies it structurally. Target account travels via the send argument, not
|
|
882
|
-
the payload — `revoked_by` is deliberately not in the `
|
|
906
|
+
the payload — `revoked_by` is deliberately not in the `role_grant_revoked`
|
|
883
907
|
payload (the revokee doesn't need to learn the admin's identity). When
|
|
884
908
|
`notification_sender` is absent, WS fan-out is silently skipped.
|
|
885
909
|
|
|
@@ -958,7 +982,8 @@ account actions hits `method_not_found` on first admin-suite run.
|
|
|
958
982
|
`auth/self_service_role_actions.ts`. One static action
|
|
959
983
|
`self_service_role_set({role, enabled})` toggles a global role_grant on the
|
|
960
984
|
caller. Idempotent in both directions (`changed: false` when the post-call
|
|
961
|
-
state already matched).
|
|
985
|
+
state already matched). Its input and output are `@fuzdev/fuz_schema`
|
|
986
|
+
`object`s, refusing unknown keys, `role` the fuz_schema `RoleName` twin.
|
|
962
987
|
|
|
963
988
|
Audit metadata carries `self_service: true` so admin reviewers can
|
|
964
989
|
distinguish self-toggled role_grants. Eligibility derives from
|
|
@@ -68,7 +68,7 @@ export interface Actor {
|
|
|
68
68
|
* Maximum length of the optional free-form `revoked_reason` attached to a
|
|
69
69
|
* revoked role_grant. Bounds the value at the schema layer so both the admin
|
|
70
70
|
* input (when the route surfaces a reason field) and the revokee-facing
|
|
71
|
-
* `
|
|
71
|
+
* `role_grant_revoked` WS notification validate against the same ceiling.
|
|
72
72
|
* Counted in UTF-16 code units.
|
|
73
73
|
*/
|
|
74
74
|
export declare const ROLE_GRANT_REVOKED_REASON_LENGTH_MAX = 500;
|
|
@@ -91,7 +91,7 @@ export interface RoleGrant {
|
|
|
91
91
|
expires_at: string | null;
|
|
92
92
|
revoked_at: string | null;
|
|
93
93
|
revoked_by: Uuid | null;
|
|
94
|
-
/** Optional free-form reason attached on revoke (rides on the `
|
|
94
|
+
/** Optional free-form reason attached on revoke (rides on the `role_grant_revoked` WS notification to the revokee). */
|
|
95
95
|
revoked_reason: string | null;
|
|
96
96
|
granted_by: Uuid | null;
|
|
97
97
|
/** Offer that produced this role_grant (set by `query_accept_offer`). `null` for direct grants. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/account_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,IAAI,EAAc,QAAQ,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAM5E,mEAAmE;AACnE,MAAM,WAAW,OAAO;IACvB,EAAE,EAAE,IAAI,CAAC;IACT,QAAQ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I,CAAC;CAC9B;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,OAAO,KAAG,cAMpD,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,SAAS,OAAO,KAAG,gBAKlD,CAAC"}
|
|
@@ -23,7 +23,7 @@ import { is_iso8601_seconds_live } from '../timestamp.js';
|
|
|
23
23
|
* Maximum length of the optional free-form `revoked_reason` attached to a
|
|
24
24
|
* revoked role_grant. Bounds the value at the schema layer so both the admin
|
|
25
25
|
* input (when the route surfaces a reason field) and the revokee-facing
|
|
26
|
-
* `
|
|
26
|
+
* `role_grant_revoked` WS notification validate against the same ceiling.
|
|
27
27
|
* Counted in UTF-16 code units.
|
|
28
28
|
*/
|
|
29
29
|
export const ROLE_GRANT_REVOKED_REASON_LENGTH_MAX = 500;
|
|
@@ -10,13 +10,25 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @module
|
|
12
12
|
*/
|
|
13
|
-
import {
|
|
13
|
+
import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
|
|
14
14
|
import type { RouteSpec } from '../http/route_spec.js';
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export
|
|
15
|
+
/**
|
|
16
|
+
* Query schema for the audit-log SSE route, a `@fuzdev/fuz_schema` `object`
|
|
17
|
+
* that refuses unknown keys — multi-actor admins pass `?acting=<uuid>`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const AuditStreamQuery: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
20
|
+
acting?: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | undefined;
|
|
21
|
+
}, {
|
|
22
|
+
acting?: string | undefined;
|
|
23
|
+
}, "object", {
|
|
24
|
+
acting: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | undefined, string | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime">)[]> & {
|
|
25
|
+
readonly '~types'?: {
|
|
26
|
+
readonly input: string;
|
|
27
|
+
readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
28
|
+
} | undefined;
|
|
29
|
+
}>>;
|
|
30
|
+
}>;
|
|
31
|
+
export type AuditStreamQuery = Infer<typeof AuditStreamQuery>;
|
|
20
32
|
/** Default role required to access the audit-log SSE route. */
|
|
21
33
|
export declare const DEFAULT_AUDIT_STREAM_ROLE = "admin";
|
|
22
34
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit_log_route_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/audit_log_route_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"audit_log_route_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/audit_log_route_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAU,KAAK,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAElE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGvD;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;EAAkC,CAAC;AAChE,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE9D,+DAA+D;AAC/D,eAAO,MAAM,yBAAyB,UAAU,CAAC;AAEjD;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B,GACxC,gBAAe,MAAkC,KAC/C,IAAI,CAAC,SAAS,EAAE,SAAS,CA8B1B,CAAC"}
|
|
@@ -11,9 +11,13 @@
|
|
|
11
11
|
* @module
|
|
12
12
|
*/
|
|
13
13
|
import { z } from 'zod';
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
import { object } from '@fuzdev/fuz_schema/schema.ts';
|
|
15
|
+
import { ActingActor } from '../primitive_schemas_fuz.js';
|
|
16
|
+
/**
|
|
17
|
+
* Query schema for the audit-log SSE route, a `@fuzdev/fuz_schema` `object`
|
|
18
|
+
* that refuses unknown keys — multi-actor admins pass `?acting=<uuid>`.
|
|
19
|
+
*/
|
|
20
|
+
export const AuditStreamQuery = object({ acting: ActingActor });
|
|
17
21
|
/** Default role required to access the audit-log SSE route. */
|
|
18
22
|
export const DEFAULT_AUDIT_STREAM_ROLE = 'admin';
|
|
19
23
|
/**
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import { z } from 'zod';
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
25
|
+
* Runs of lowercase letters (a-z) joined by single underscores, the grammar
|
|
26
|
+
* of `RoleName`, `ScopeKindName` and `GrantPathName` too. Rejects empty
|
|
27
|
+
* strings, leading, trailing or consecutive underscores, uppercase, and
|
|
28
|
+
* digits.
|
|
29
29
|
*/
|
|
30
30
|
export declare const CREDENTIAL_TYPE_NAME_REGEX: RegExp;
|
|
31
31
|
/** Zod schema for valid credential-type name strings. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential_type_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/credential_type_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,
|
|
1
|
+
{"version":3,"file":"credential_type_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/credential_type_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,QAAyB,CAAC;AAEjE,yDAAyD;AACzD,eAAO,MAAM,kBAAkB,aAK7B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAIpE,uCAAuC;AACvC,eAAO,MAAM,uBAAuB,YAAY,CAAC;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,cAAc,CAAC;AAErD,yEAAyE;AACzE,eAAO,MAAM,4BAA4B,iBAAiB,CAAC;AAE3D,0DAA0D;AAC1D,eAAO,MAAM,wBAAwB,mDAI3B,CAAC;AAEX,kDAAkD;AAClD,eAAO,MAAM,qBAAqB;;;;EAAmC,CAAC;AACtE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B,EAAE,WAAW,CAAC,MAAM,EAAE,kBAAkB,CAa/E,CAAC;AAEH,qFAAqF;AACrF,MAAM,WAAW,0BAA0B;IAC1C;;;;;;OAMG;IACH,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAClC;;;OAGG;IACH,gBAAgB,EAAE,WAAW,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;CAC1D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,6BAA6B,GACzC,iBAAgB,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAM,KACrD,0BA2BF,CAAC"}
|
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import { z } from 'zod';
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
25
|
+
* Runs of lowercase letters (a-z) joined by single underscores, the grammar
|
|
26
|
+
* of `RoleName`, `ScopeKindName` and `GrantPathName` too. Rejects empty
|
|
27
|
+
* strings, leading, trailing or consecutive underscores, uppercase, and
|
|
28
|
+
* digits.
|
|
29
29
|
*/
|
|
30
|
-
export const CREDENTIAL_TYPE_NAME_REGEX = /^[a-z][a-
|
|
30
|
+
export const CREDENTIAL_TYPE_NAME_REGEX = /^[a-z]+(?:_[a-z]+)*$/;
|
|
31
31
|
/** Zod schema for valid credential-type name strings. */
|
|
32
32
|
export const CredentialTypeName = z
|
|
33
33
|
.string()
|
|
34
|
-
.regex(CREDENTIAL_TYPE_NAME_REGEX, 'Credential-type names must be lowercase letters and underscores (a-z_), no leading
|
|
34
|
+
.regex(CREDENTIAL_TYPE_NAME_REGEX, 'Credential-type names must be lowercase letters and underscores (a-z_), no leading, trailing or consecutive underscores');
|
|
35
35
|
// Builtin credential types — provided by fuz_app, always available.
|
|
36
36
|
/** Cookie-based session credential. */
|
|
37
37
|
export const CREDENTIAL_TYPE_SESSION = 'session';
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
*/
|
|
27
27
|
import { z } from 'zod';
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
29
|
+
* Runs of lowercase letters (a-z) joined by single underscores, the grammar
|
|
30
|
+
* of `RoleName`, `ScopeKindName` and `CredentialTypeName` too. Rejects empty
|
|
31
|
+
* strings, leading, trailing or consecutive underscores, uppercase, and
|
|
32
|
+
* digits.
|
|
33
33
|
*/
|
|
34
34
|
export declare const GRANT_PATH_NAME_REGEX: RegExp;
|
|
35
35
|
/** Zod schema for valid grant-path name strings. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grant_path_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/grant_path_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"grant_path_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/grant_path_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAAyB,CAAC;AAE5D,oDAAoD;AACpD,eAAO,MAAM,aAAa,aAKxB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAI1D,gFAAgF;AAChF,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAExC,4FAA4F;AAC5F,eAAO,MAAM,uBAAuB,iBAAiB,CAAC;AAEtD,gFAAgF;AAChF,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAE1C,6EAA6E;AAC7E,eAAO,MAAM,oBAAoB,cAAc,CAAC;AAEhD,qDAAqD;AACrD,eAAO,MAAM,mBAAmB,2DAKtB,CAAC;AAEX,6CAA6C;AAC7C,eAAO,MAAM,gBAAgB;;;;;EAA8B,CAAC;AAC5D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAuBrE,CAAC;AAEH,gFAAgF;AAChF,MAAM,WAAW,qBAAqB;IACrC;;;;;;OAMG;IACH,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7B;;;OAGG;IACH,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CAChD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,wBAAwB,GACpC,iBAAgB,MAAM,CAAC,MAAM,EAAE,aAAa,CAAM,KAChD,qBA2BF,CAAC"}
|
|
@@ -26,16 +26,16 @@
|
|
|
26
26
|
*/
|
|
27
27
|
import { z } from 'zod';
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
29
|
+
* Runs of lowercase letters (a-z) joined by single underscores, the grammar
|
|
30
|
+
* of `RoleName`, `ScopeKindName` and `CredentialTypeName` too. Rejects empty
|
|
31
|
+
* strings, leading, trailing or consecutive underscores, uppercase, and
|
|
32
|
+
* digits.
|
|
33
33
|
*/
|
|
34
|
-
export const GRANT_PATH_NAME_REGEX = /^[a-z][a-
|
|
34
|
+
export const GRANT_PATH_NAME_REGEX = /^[a-z]+(?:_[a-z]+)*$/;
|
|
35
35
|
/** Zod schema for valid grant-path name strings. */
|
|
36
36
|
export const GrantPathName = z
|
|
37
37
|
.string()
|
|
38
|
-
.regex(GRANT_PATH_NAME_REGEX, 'Grant-path names must be lowercase letters and underscores (a-z_), no leading
|
|
38
|
+
.regex(GRANT_PATH_NAME_REGEX, 'Grant-path names must be lowercase letters and underscores (a-z_), no leading, trailing or consecutive underscores');
|
|
39
39
|
// Builtin grant paths — provided by fuz_app, always available.
|
|
40
40
|
/** Admin-mediated grant — `role_grant_offer_create` plus admin-direct flows. */
|
|
41
41
|
export const GRANT_PATH_ADMIN = 'admin';
|
|
@@ -331,7 +331,7 @@ export const get_public_account_id = (c) => {
|
|
|
331
331
|
*/
|
|
332
332
|
export const require_token_scope = (capability) => {
|
|
333
333
|
if (!is_route_scope_capability(capability)) {
|
|
334
|
-
throw new Error(`auth.required_scope "${capability}" is not a valid token-scope capability for a route \u2014 expected 'surface:<name>', where a surface name is lowercase letters
|
|
334
|
+
throw new Error(`auth.required_scope "${capability}" is not a valid token-scope capability for a route \u2014 expected 'surface:<name>', where a surface name is runs of lowercase letters joined by single underscores ('rpc:<method>' is the action dispatcher's per-method gate, which a route never reaches)`);
|
|
335
335
|
}
|
|
336
336
|
return async (c, next) => {
|
|
337
337
|
const denied = token_scope_surface_denial(c, capability);
|