@fuzdev/fuz_app 0.54.0 → 0.56.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 +214 -103
- package/dist/actions/action_bridge.d.ts +8 -5
- package/dist/actions/action_bridge.d.ts.map +1 -1
- package/dist/actions/action_bridge.js +1 -11
- package/dist/actions/action_codegen.d.ts +32 -0
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +35 -15
- package/dist/actions/action_registry.d.ts.map +1 -1
- package/dist/actions/action_registry.js +5 -2
- package/dist/actions/action_rpc.d.ts +141 -22
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +106 -187
- package/dist/actions/action_spec.d.ts +55 -16
- package/dist/actions/action_spec.d.ts.map +1 -1
- package/dist/actions/action_spec.js +16 -11
- package/dist/actions/action_types.d.ts +28 -60
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/action_types.js +13 -5
- package/dist/actions/broadcast_api.d.ts +2 -2
- package/dist/actions/broadcast_api.js +2 -2
- package/dist/actions/compile_action_registry.d.ts +50 -0
- package/dist/actions/compile_action_registry.d.ts.map +1 -0
- package/dist/actions/compile_action_registry.js +69 -0
- package/dist/actions/heartbeat.d.ts +8 -4
- package/dist/actions/heartbeat.d.ts.map +1 -1
- package/dist/actions/heartbeat.js +5 -4
- package/dist/actions/perform_action.d.ts +145 -0
- package/dist/actions/perform_action.d.ts.map +1 -0
- package/dist/actions/perform_action.js +258 -0
- package/dist/actions/register_action_ws.d.ts +46 -40
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +101 -159
- package/dist/actions/register_ws_endpoint.d.ts +15 -10
- package/dist/actions/register_ws_endpoint.d.ts.map +1 -1
- package/dist/actions/register_ws_endpoint.js +54 -7
- package/dist/actions/transports.d.ts.map +1 -1
- package/dist/actions/transports.js +0 -4
- package/dist/actions/transports_ws_auth_guard.d.ts +1 -1
- package/dist/actions/transports_ws_auth_guard.js +1 -1
- package/dist/actions/transports_ws_backend.d.ts +1 -1
- package/dist/actions/transports_ws_backend.js +1 -1
- package/dist/auth/CLAUDE.md +794 -410
- package/dist/auth/account_action_specs.d.ts +28 -7
- package/dist/auth/account_action_specs.d.ts.map +1 -1
- package/dist/auth/account_action_specs.js +7 -7
- package/dist/auth/account_actions.d.ts +7 -13
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +26 -35
- package/dist/auth/account_queries.d.ts +52 -16
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +87 -38
- package/dist/auth/account_routes.d.ts +9 -11
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +118 -46
- package/dist/auth/account_schema.d.ts +46 -35
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +21 -28
- package/dist/auth/admin_action_specs.d.ts +100 -32
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +64 -33
- package/dist/auth/admin_actions.d.ts +13 -19
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +37 -41
- package/dist/auth/audit_emitter.d.ts +160 -0
- package/dist/auth/audit_emitter.d.ts.map +1 -0
- package/dist/auth/audit_emitter.js +83 -0
- package/dist/auth/audit_log_queries.d.ts +17 -48
- package/dist/auth/audit_log_queries.d.ts.map +1 -1
- package/dist/auth/audit_log_queries.js +20 -56
- package/dist/auth/audit_log_routes.d.ts +1 -1
- package/dist/auth/audit_log_routes.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.js +7 -3
- package/dist/auth/audit_log_schema.d.ts +92 -32
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +75 -46
- package/dist/auth/auth_guard_resolver.d.ts +44 -0
- package/dist/auth/auth_guard_resolver.d.ts.map +1 -0
- package/dist/auth/auth_guard_resolver.js +56 -0
- package/dist/auth/bearer_auth.d.ts +9 -7
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +13 -21
- package/dist/auth/bootstrap_account.d.ts +7 -7
- package/dist/auth/bootstrap_account.d.ts.map +1 -1
- package/dist/auth/bootstrap_account.js +7 -7
- package/dist/auth/bootstrap_routes.d.ts.map +1 -1
- package/dist/auth/bootstrap_routes.js +11 -10
- package/dist/auth/cleanup.d.ts +20 -26
- package/dist/auth/cleanup.d.ts.map +1 -1
- package/dist/auth/cleanup.js +33 -42
- package/dist/auth/credential_type_schema.d.ts +115 -0
- package/dist/auth/credential_type_schema.d.ts.map +1 -0
- package/dist/auth/credential_type_schema.js +127 -0
- package/dist/auth/daemon_token_middleware.d.ts +23 -11
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +28 -22
- package/dist/auth/ddl.d.ts +2 -2
- package/dist/auth/ddl.d.ts.map +1 -1
- package/dist/auth/ddl.js +6 -6
- package/dist/auth/deps.d.ts +7 -18
- package/dist/auth/deps.d.ts.map +1 -1
- package/dist/auth/grant_path_schema.d.ts +117 -0
- package/dist/auth/grant_path_schema.d.ts.map +1 -0
- package/dist/auth/grant_path_schema.js +137 -0
- package/dist/auth/invite_queries.d.ts +12 -1
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +12 -1
- package/dist/auth/invite_schema.d.ts +1 -1
- package/dist/auth/invite_schema.d.ts.map +1 -1
- package/dist/auth/invite_schema.js +1 -1
- package/dist/auth/middleware.d.ts.map +1 -1
- package/dist/auth/middleware.js +9 -4
- package/dist/auth/migrations.d.ts +37 -14
- package/dist/auth/migrations.d.ts.map +1 -1
- package/dist/auth/migrations.js +79 -32
- package/dist/auth/request_context.d.ts +331 -61
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +378 -95
- package/dist/auth/{permit_offer_action_specs.d.ts → role_grant_offer_action_specs.d.ts} +163 -94
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -0
- package/dist/auth/role_grant_offer_action_specs.js +262 -0
- package/dist/auth/role_grant_offer_actions.d.ts +104 -0
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -0
- package/dist/auth/role_grant_offer_actions.js +473 -0
- package/dist/auth/{permit_offer_notifications.d.ts → role_grant_offer_notifications.d.ts} +90 -70
- package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -0
- package/dist/auth/role_grant_offer_notifications.js +182 -0
- package/dist/auth/role_grant_offer_queries.d.ts +242 -0
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -0
- package/dist/auth/role_grant_offer_queries.js +533 -0
- package/dist/auth/role_grant_offer_schema.d.ts +150 -0
- package/dist/auth/role_grant_offer_schema.d.ts.map +1 -0
- package/dist/auth/{permit_offer_schema.js → role_grant_offer_schema.js} +60 -36
- package/dist/auth/role_grant_queries.d.ts +231 -0
- package/dist/auth/role_grant_queries.d.ts.map +1 -0
- package/dist/auth/role_grant_queries.js +320 -0
- package/dist/auth/role_schema.d.ts +150 -40
- package/dist/auth/role_schema.d.ts.map +1 -1
- package/dist/auth/role_schema.js +144 -45
- package/dist/auth/scope_kind_schema.d.ts +96 -0
- package/dist/auth/scope_kind_schema.d.ts.map +1 -0
- package/dist/auth/scope_kind_schema.js +94 -0
- package/dist/auth/self_service_role_action_specs.d.ts +6 -1
- package/dist/auth/self_service_role_action_specs.d.ts.map +1 -1
- package/dist/auth/self_service_role_action_specs.js +3 -1
- package/dist/auth/self_service_role_actions.d.ts +34 -27
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +68 -48
- package/dist/auth/session_cookie.d.ts +43 -6
- package/dist/auth/session_cookie.d.ts.map +1 -1
- package/dist/auth/session_cookie.js +31 -5
- package/dist/auth/session_middleware.d.ts +37 -3
- package/dist/auth/session_middleware.d.ts.map +1 -1
- package/dist/auth/session_middleware.js +33 -7
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +48 -19
- package/dist/auth/standard_action_specs.d.ts +2 -2
- package/dist/auth/standard_action_specs.js +4 -4
- package/dist/auth/standard_rpc_actions.d.ts +23 -19
- package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
- package/dist/auth/standard_rpc_actions.js +12 -12
- package/dist/db/migrate.d.ts +12 -8
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +10 -7
- package/dist/dev/setup.d.ts +2 -2
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +9 -7
- package/dist/env/load.d.ts +1 -1
- package/dist/env/load.js +1 -1
- package/dist/hono_context.d.ts +64 -5
- package/dist/hono_context.d.ts.map +1 -1
- package/dist/hono_context.js +38 -2
- package/dist/http/CLAUDE.md +264 -87
- package/dist/http/auth_shape.d.ts +191 -0
- package/dist/http/auth_shape.d.ts.map +1 -0
- package/dist/http/auth_shape.js +237 -0
- package/dist/http/common_routes.js +3 -3
- package/dist/http/db_routes.d.ts +4 -0
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/http/db_routes.js +44 -7
- package/dist/http/error_schemas.d.ts +132 -19
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +132 -40
- package/dist/http/jsonrpc_errors.d.ts +27 -2
- package/dist/http/jsonrpc_errors.d.ts.map +1 -1
- package/dist/http/jsonrpc_errors.js +26 -2
- package/dist/http/pending_effects.d.ts +71 -18
- package/dist/http/pending_effects.d.ts.map +1 -1
- package/dist/http/pending_effects.js +87 -18
- package/dist/http/proxy.d.ts +52 -5
- package/dist/http/proxy.d.ts.map +1 -1
- package/dist/http/proxy.js +92 -14
- package/dist/http/route_spec.d.ts +113 -41
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +130 -52
- package/dist/http/schema_helpers.d.ts +3 -2
- package/dist/http/schema_helpers.d.ts.map +1 -1
- package/dist/http/schema_helpers.js +9 -2
- package/dist/http/surface.d.ts +2 -1
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface.js +1 -2
- package/dist/http/surface_query.d.ts +39 -35
- package/dist/http/surface_query.d.ts.map +1 -1
- package/dist/http/surface_query.js +79 -36
- package/dist/primitive_schemas.d.ts +39 -0
- package/dist/primitive_schemas.d.ts.map +1 -0
- package/dist/primitive_schemas.js +40 -0
- package/dist/realtime/sse_auth_guard.d.ts +5 -5
- package/dist/realtime/sse_auth_guard.js +9 -9
- package/dist/runtime/mock.d.ts +1 -1
- package/dist/runtime/mock.js +1 -1
- package/dist/server/app_backend.d.ts +14 -11
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +12 -8
- package/dist/server/app_server.d.ts +7 -7
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +36 -31
- package/dist/server/validate_nginx.d.ts +1 -1
- package/dist/server/validate_nginx.js +1 -1
- package/dist/testing/CLAUDE.md +73 -55
- package/dist/testing/admin_integration.d.ts +5 -6
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +100 -96
- package/dist/testing/adversarial_headers.js +1 -1
- package/dist/testing/app_server.d.ts +11 -14
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +18 -17
- package/dist/testing/assertions.d.ts.map +1 -1
- package/dist/testing/assertions.js +2 -1
- package/dist/testing/attack_surface.d.ts.map +1 -1
- package/dist/testing/attack_surface.js +15 -9
- package/dist/testing/audit_completeness.d.ts +2 -2
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +53 -39
- package/dist/testing/auth_apps.d.ts +5 -4
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +28 -22
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +5 -5
- package/dist/testing/db.d.ts +1 -1
- package/dist/testing/db.d.ts.map +1 -1
- package/dist/testing/db.js +4 -4
- package/dist/testing/db_entities.d.ts +22 -0
- package/dist/testing/db_entities.d.ts.map +1 -0
- package/dist/testing/db_entities.js +28 -0
- package/dist/testing/entities.d.ts +10 -8
- package/dist/testing/entities.d.ts.map +1 -1
- package/dist/testing/entities.js +22 -18
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +13 -14
- package/dist/testing/integration_helpers.d.ts +8 -6
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +29 -23
- package/dist/testing/middleware.d.ts +15 -11
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +75 -32
- package/dist/testing/rpc_attack_surface.d.ts.map +1 -1
- package/dist/testing/rpc_attack_surface.js +40 -24
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +3 -1
- package/dist/testing/rpc_round_trip.d.ts +1 -1
- package/dist/testing/rpc_round_trip.d.ts.map +1 -1
- package/dist/testing/rpc_round_trip.js +14 -13
- package/dist/testing/sse_round_trip.d.ts +3 -4
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +7 -11
- package/dist/testing/standard.d.ts +1 -1
- package/dist/testing/stubs.d.ts +25 -0
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +43 -2
- package/dist/testing/surface_invariants.d.ts +2 -2
- package/dist/testing/ws_round_trip.d.ts +12 -13
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +24 -12
- package/dist/ui/AdminAccounts.svelte +23 -20
- package/dist/ui/AdminOverview.svelte +15 -13
- package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
- package/dist/ui/{AdminPermitHistory.svelte → AdminRoleGrantHistory.svelte} +12 -12
- package/dist/ui/AdminRoleGrantHistory.svelte.d.ts +4 -0
- package/dist/ui/AdminRoleGrantHistory.svelte.d.ts.map +1 -0
- package/dist/ui/BootstrapForm.svelte +1 -1
- package/dist/ui/CLAUDE.md +65 -59
- package/dist/ui/{PermitOfferForm.svelte → RoleGrantOfferForm.svelte} +37 -22
- package/dist/ui/RoleGrantOfferForm.svelte.d.ts +20 -0
- package/dist/ui/RoleGrantOfferForm.svelte.d.ts.map +1 -0
- package/dist/ui/{PermitOfferHistory.svelte → RoleGrantOfferHistory.svelte} +12 -12
- package/dist/ui/{PermitOfferHistory.svelte.d.ts → RoleGrantOfferHistory.svelte.d.ts} +4 -4
- package/dist/ui/RoleGrantOfferHistory.svelte.d.ts.map +1 -0
- package/dist/ui/{PermitOfferInbox.svelte → RoleGrantOfferInbox.svelte} +14 -14
- package/dist/ui/{PermitOfferInbox.svelte.d.ts → RoleGrantOfferInbox.svelte.d.ts} +4 -4
- package/dist/ui/RoleGrantOfferInbox.svelte.d.ts.map +1 -0
- package/dist/ui/SignupForm.svelte +1 -1
- package/dist/ui/SurfaceExplorer.svelte +35 -15
- package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
- package/dist/ui/account_sessions_state.svelte.d.ts +2 -3
- package/dist/ui/account_sessions_state.svelte.d.ts.map +1 -1
- package/dist/ui/account_sessions_state.svelte.js +2 -3
- package/dist/ui/admin_accounts_state.svelte.d.ts +25 -18
- package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.js +28 -17
- package/dist/ui/admin_rpc_adapters.d.ts +20 -20
- package/dist/ui/admin_rpc_adapters.d.ts.map +1 -1
- package/dist/ui/admin_rpc_adapters.js +17 -17
- package/dist/ui/admin_sessions_state.svelte.d.ts +2 -2
- package/dist/ui/admin_sessions_state.svelte.js +2 -2
- package/dist/ui/audit_log_state.svelte.d.ts +7 -7
- package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.js +6 -6
- package/dist/ui/auth_state.svelte.d.ts +3 -3
- package/dist/ui/auth_state.svelte.d.ts.map +1 -1
- package/dist/ui/auth_state.svelte.js +6 -6
- package/dist/ui/format_scope.d.ts +2 -2
- package/dist/ui/format_scope.js +2 -2
- package/dist/ui/{permit_offers_state.svelte.d.ts → role_grant_offers_state.svelte.d.ts} +39 -31
- package/dist/ui/role_grant_offers_state.svelte.d.ts.map +1 -0
- package/dist/ui/{permit_offers_state.svelte.js → role_grant_offers_state.svelte.js} +25 -19
- package/dist/ui/ui_format.js +2 -2
- package/package.json +3 -3
- package/dist/auth/permit_offer_action_specs.d.ts.map +0 -1
- package/dist/auth/permit_offer_action_specs.js +0 -227
- package/dist/auth/permit_offer_actions.d.ts +0 -110
- package/dist/auth/permit_offer_actions.d.ts.map +0 -1
- package/dist/auth/permit_offer_actions.js +0 -452
- package/dist/auth/permit_offer_notifications.d.ts.map +0 -1
- package/dist/auth/permit_offer_notifications.js +0 -182
- package/dist/auth/permit_offer_queries.d.ts +0 -183
- package/dist/auth/permit_offer_queries.d.ts.map +0 -1
- package/dist/auth/permit_offer_queries.js +0 -408
- package/dist/auth/permit_offer_schema.d.ts +0 -103
- package/dist/auth/permit_offer_schema.d.ts.map +0 -1
- package/dist/auth/permit_queries.d.ts +0 -210
- package/dist/auth/permit_queries.d.ts.map +0 -1
- package/dist/auth/permit_queries.js +0 -294
- package/dist/auth/require_keeper.d.ts +0 -20
- package/dist/auth/require_keeper.d.ts.map +0 -1
- package/dist/auth/require_keeper.js +0 -35
- package/dist/auth/route_guards.d.ts +0 -21
- package/dist/auth/route_guards.d.ts.map +0 -1
- package/dist/auth/route_guards.js +0 -32
- package/dist/auth/session_lifecycle.d.ts +0 -37
- package/dist/auth/session_lifecycle.d.ts.map +0 -1
- package/dist/auth/session_lifecycle.js +0 -29
- package/dist/ui/AdminPermitHistory.svelte.d.ts +0 -4
- package/dist/ui/AdminPermitHistory.svelte.d.ts.map +0 -1
- package/dist/ui/PermitOfferForm.svelte.d.ts +0 -14
- package/dist/ui/PermitOfferForm.svelte.d.ts.map +0 -1
- package/dist/ui/PermitOfferHistory.svelte.d.ts.map +0 -1
- package/dist/ui/PermitOfferInbox.svelte.d.ts.map +0 -1
- package/dist/ui/permit_offers_state.svelte.d.ts.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Reactive state for the audit log viewer.
|
|
3
3
|
*
|
|
4
|
-
* Two fetch primitives (`fetch` for events, `
|
|
4
|
+
* Two fetch primitives (`fetch` for events, `fetch_role_grant_history` for the
|
|
5
5
|
* grant/revoke shortcut) flow through an injected RPC adapter; the SSE
|
|
6
6
|
* stream continues to use `EventSource` directly — streams aren't an RPC
|
|
7
7
|
* concern.
|
|
@@ -19,7 +19,7 @@ export const audit_log_rpc_context = create_context(() => () => null);
|
|
|
19
19
|
export class AuditLogState extends Loadable {
|
|
20
20
|
#get_rpc;
|
|
21
21
|
events = $state.raw([]);
|
|
22
|
-
|
|
22
|
+
role_grant_history_events = $state.raw([]);
|
|
23
23
|
count = $derived(this.events.length);
|
|
24
24
|
/** Whether the SSE stream is currently connected. */
|
|
25
25
|
connected = $state.raw(false);
|
|
@@ -34,7 +34,7 @@ export class AuditLogState extends Loadable {
|
|
|
34
34
|
this.#get_rpc = options?.get_rpc ?? (() => null);
|
|
35
35
|
this.#stream_url = options?.stream_url ?? '/api/admin/audit/stream';
|
|
36
36
|
}
|
|
37
|
-
/** True when an RPC adapter is wired. `fetch`/`
|
|
37
|
+
/** True when an RPC adapter is wired. `fetch`/`fetch_role_grant_history` no-op without it. */
|
|
38
38
|
get has_rpc() {
|
|
39
39
|
return this.#get_rpc() !== null;
|
|
40
40
|
}
|
|
@@ -50,15 +50,15 @@ export class AuditLogState extends Loadable {
|
|
|
50
50
|
this.#update_last_seq(this.events);
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
async
|
|
53
|
+
async fetch_role_grant_history(limit, offset) {
|
|
54
54
|
const rpc = this.#get_rpc();
|
|
55
55
|
if (!rpc) {
|
|
56
56
|
this.error = 'rpc adapter not wired';
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
59
|
await this.run(async () => {
|
|
60
|
-
const { events } = await rpc.
|
|
61
|
-
this.
|
|
60
|
+
const { events } = await rpc.role_grant_history({ limit, offset });
|
|
61
|
+
this.role_grant_history_events = events;
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
*
|
|
32
32
|
* @module
|
|
33
33
|
*/
|
|
34
|
-
import { type ActorSummaryJson, type
|
|
34
|
+
import { type ActorSummaryJson, type RoleGrantSummaryJson, type SessionAccount } from '../auth/account_schema.js';
|
|
35
35
|
/**
|
|
36
36
|
* Svelte context for `AuthState`.
|
|
37
37
|
* Use `auth_state_context.set(state)` in the provider and `auth_state_context.get()` to access.
|
|
@@ -47,8 +47,8 @@ export declare class AuthState {
|
|
|
47
47
|
verify_error: string | null;
|
|
48
48
|
account: SessionAccount | null;
|
|
49
49
|
actor: ActorSummaryJson | null;
|
|
50
|
-
|
|
51
|
-
readonly
|
|
50
|
+
role_grants: Array<RoleGrantSummaryJson>;
|
|
51
|
+
readonly active_role_grants: Array<RoleGrantSummaryJson>;
|
|
52
52
|
readonly roles: Array<string>;
|
|
53
53
|
/** True when bootstrap is available (no accounts exist yet). */
|
|
54
54
|
needs_bootstrap: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth_state.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/auth_state.svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAKH,OAAO,EACN,KAAK,gBAAgB,EAErB,KAAK,
|
|
1
|
+
{"version":3,"file":"auth_state.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/auth_state.svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAKH,OAAO,EACN,KAAK,gBAAgB,EAErB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,MAAM,2BAA2B,CAAC;AAEnC;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;CAA8B,CAAC;AAE9D,qBAAa,SAAS;IACrB,SAAS,UAAqB;IAC9B,QAAQ,UAAqB;IAC7B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAoB;IAC/C,OAAO,EAAE,cAAc,GAAG,IAAI,CAAoB;IAClD,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAAoB;IAClD,WAAW,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAkB;IAC1D,QAAQ,CAAC,kBAAkB,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAEtD;IACF,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAwD;IAErF,gEAAgE;IAChE,eAAe,UAAqB;IAEpC;;;;;;;;OAQG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IA6BpC;;;;;;;OAOG;IACG,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAwCjE;;;;;OAKG;IACG,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAiCpF;;;;;;;OAOG;IACG,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IA4ClF;;;;;OAKG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAW7B"}
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
*/
|
|
34
34
|
import { create_context } from '@fuzdev/fuz_ui/context_helpers.js';
|
|
35
35
|
import { ui_fetch } from './ui_fetch.js';
|
|
36
|
-
import {
|
|
36
|
+
import { is_role_grant_active, } from '../auth/account_schema.js';
|
|
37
37
|
/**
|
|
38
38
|
* Svelte context for `AuthState`.
|
|
39
39
|
* Use `auth_state_context.set(state)` in the provider and `auth_state_context.get()` to access.
|
|
@@ -45,9 +45,9 @@ export class AuthState {
|
|
|
45
45
|
verify_error = $state.raw(null);
|
|
46
46
|
account = $state.raw(null);
|
|
47
47
|
actor = $state.raw(null);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
roles = $derived(this.
|
|
48
|
+
role_grants = $state.raw([]);
|
|
49
|
+
active_role_grants = $derived(this.role_grants.filter((p) => is_role_grant_active(p)));
|
|
50
|
+
roles = $derived(this.active_role_grants.map((p) => p.role));
|
|
51
51
|
/** True when bootstrap is available (no accounts exist yet). */
|
|
52
52
|
needs_bootstrap = $state.raw(false);
|
|
53
53
|
/**
|
|
@@ -68,7 +68,7 @@ export class AuthState {
|
|
|
68
68
|
this.verified = true;
|
|
69
69
|
this.account = data.account ?? null;
|
|
70
70
|
this.actor = data.actor ?? null;
|
|
71
|
-
this.
|
|
71
|
+
this.role_grants = data.role_grants ?? [];
|
|
72
72
|
this.needs_bootstrap = false;
|
|
73
73
|
}
|
|
74
74
|
else {
|
|
@@ -248,6 +248,6 @@ export class AuthState {
|
|
|
248
248
|
this.verified = false;
|
|
249
249
|
this.account = null;
|
|
250
250
|
this.actor = null;
|
|
251
|
-
this.
|
|
251
|
+
this.role_grants = [];
|
|
252
252
|
}
|
|
253
253
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared `format_scope` callback contract for
|
|
2
|
+
* Shared `format_scope` callback contract for role-grant-display components.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Role grants and offers carry a `scope_id` that names a consumer-owned resource
|
|
5
5
|
* (e.g. a classroom uuid). The default render is the raw uuid. Consumers wire
|
|
6
6
|
* a `FormatScope` via context to render a human label without per-page
|
|
7
7
|
* lookup or forking the components.
|
package/dist/ui/format_scope.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared `format_scope` callback contract for
|
|
2
|
+
* Shared `format_scope` callback contract for role-grant-display components.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Role grants and offers carry a `scope_id` that names a consumer-owned resource
|
|
5
5
|
* (e.g. a classroom uuid). The default render is the raw uuid. Consumers wire
|
|
6
6
|
* a `FormatScope` via context to render a human label without per-page
|
|
7
7
|
* lookup or forking the components.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Reactive state for the consentful-
|
|
2
|
+
* Reactive state for the consentful-role-grants offer flow.
|
|
3
3
|
*
|
|
4
4
|
* Maintains one offer cache keyed by id, seeded by the RPC list/history
|
|
5
|
-
* actions and kept live by the six
|
|
5
|
+
* actions and kept live by the six role-grant-offer WebSocket notifications.
|
|
6
6
|
* `incoming` (recipient-side pending) and `outgoing` (grantor-side pending)
|
|
7
7
|
* are derived views; `history` is the full cache ordered newest-first for
|
|
8
8
|
* the grantor/admin history view.
|
|
@@ -16,44 +16,45 @@
|
|
|
16
16
|
* @module
|
|
17
17
|
*/
|
|
18
18
|
import { Loadable } from './loadable.svelte.js';
|
|
19
|
-
import type {
|
|
19
|
+
import type { RoleGrantOfferJson } from '../auth/role_grant_offer_schema.js';
|
|
20
20
|
/**
|
|
21
|
-
* Svelte context for `
|
|
22
|
-
* Use `
|
|
23
|
-
* `
|
|
21
|
+
* Svelte context for `RoleGrantOffersState`.
|
|
22
|
+
* Use `role_grant_offers_state_context.set(state)` in the provider and
|
|
23
|
+
* `role_grant_offers_state_context.get()` to access.
|
|
24
24
|
*/
|
|
25
|
-
export declare const
|
|
26
|
-
get: (error_message?: string) =>
|
|
27
|
-
get_maybe: () =>
|
|
28
|
-
set: (value:
|
|
25
|
+
export declare const role_grant_offers_state_context: {
|
|
26
|
+
get: (error_message?: string) => RoleGrantOffersState;
|
|
27
|
+
get_maybe: () => RoleGrantOffersState | undefined;
|
|
28
|
+
set: (value: RoleGrantOffersState) => RoleGrantOffersState;
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
|
-
* Narrow RPC surface consumed by `
|
|
31
|
+
* Narrow RPC surface consumed by `RoleGrantOffersState`. Consumers adapt their
|
|
32
32
|
* typed client (e.g. a `create_rpc_client` Proxy) to this shape — the state
|
|
33
33
|
* class stays decoupled from the client's `Result` return type so tests can
|
|
34
34
|
* inject plain-function stubs.
|
|
35
35
|
*/
|
|
36
|
-
export interface
|
|
36
|
+
export interface RoleGrantOffersRpc {
|
|
37
37
|
list: () => Promise<{
|
|
38
|
-
offers: Array<
|
|
38
|
+
offers: Array<RoleGrantOfferJson>;
|
|
39
39
|
}>;
|
|
40
40
|
history: (options?: {
|
|
41
41
|
limit?: number;
|
|
42
42
|
offset?: number;
|
|
43
43
|
}) => Promise<{
|
|
44
|
-
offers: Array<
|
|
44
|
+
offers: Array<RoleGrantOfferJson>;
|
|
45
45
|
}>;
|
|
46
46
|
create: (params: {
|
|
47
47
|
to_account_id: string;
|
|
48
|
+
to_actor_id?: string | null;
|
|
48
49
|
role: string;
|
|
49
50
|
scope_id?: string | null;
|
|
50
51
|
message?: string | null;
|
|
51
52
|
}) => Promise<{
|
|
52
|
-
offer:
|
|
53
|
+
offer: RoleGrantOfferJson;
|
|
53
54
|
}>;
|
|
54
55
|
accept: (offer_id: string) => Promise<{
|
|
55
|
-
|
|
56
|
-
offer:
|
|
56
|
+
role_grant_id: string;
|
|
57
|
+
offer: RoleGrantOfferJson;
|
|
57
58
|
superseded_offer_ids: Array<string>;
|
|
58
59
|
}>;
|
|
59
60
|
decline: (offer_id: string, reason?: string | null) => Promise<{
|
|
@@ -64,14 +65,14 @@ export interface PermitOffersRpc {
|
|
|
64
65
|
}>;
|
|
65
66
|
}
|
|
66
67
|
/** Narrow WS notification envelope — method + params, matching `JsonrpcNotification`. */
|
|
67
|
-
export interface
|
|
68
|
+
export interface RoleGrantOfferNotification {
|
|
68
69
|
method: string;
|
|
69
70
|
params: unknown;
|
|
70
71
|
}
|
|
71
72
|
/** Subscription primitive — consumer wires their WS receiver; returns a disposer. */
|
|
72
|
-
export type
|
|
73
|
-
export interface
|
|
74
|
-
rpc:
|
|
73
|
+
export type RoleGrantOfferSubscribe = (handler: (notification: RoleGrantOfferNotification) => void) => () => void;
|
|
74
|
+
export interface RoleGrantOffersStateOptions {
|
|
75
|
+
rpc: RoleGrantOffersRpc;
|
|
75
76
|
/** Reactive accessor for the current account id; returns `null` when logged out. */
|
|
76
77
|
account_id: () => string | null;
|
|
77
78
|
/**
|
|
@@ -80,16 +81,16 @@ export interface PermitOffersStateOptions {
|
|
|
80
81
|
*/
|
|
81
82
|
actor_id: () => string | null;
|
|
82
83
|
}
|
|
83
|
-
export declare class
|
|
84
|
+
export declare class RoleGrantOffersState extends Loadable {
|
|
84
85
|
#private;
|
|
85
86
|
/** Pending offers for the current account, soonest-expiring first. */
|
|
86
|
-
readonly incoming: Array<
|
|
87
|
+
readonly incoming: Array<RoleGrantOfferJson>;
|
|
87
88
|
/** Pending offers from the current actor, newest-created first. */
|
|
88
|
-
readonly outgoing: Array<
|
|
89
|
+
readonly outgoing: Array<RoleGrantOfferJson>;
|
|
89
90
|
/** Every offer known to this state, newest-created first. Feeds the history view. */
|
|
90
|
-
readonly history: Array<
|
|
91
|
+
readonly history: Array<RoleGrantOfferJson>;
|
|
91
92
|
readonly incoming_count: number;
|
|
92
|
-
constructor(options:
|
|
93
|
+
constructor(options: RoleGrantOffersStateOptions);
|
|
93
94
|
/** Seed the cache with the recipient-side pending inbox. */
|
|
94
95
|
fetch(): Promise<void>;
|
|
95
96
|
/** Seed both-directions history (includes terminal rows). */
|
|
@@ -97,13 +98,20 @@ export declare class PermitOffersState extends Loadable {
|
|
|
97
98
|
limit?: number;
|
|
98
99
|
offset?: number;
|
|
99
100
|
}): Promise<void>;
|
|
100
|
-
/**
|
|
101
|
+
/**
|
|
102
|
+
* Issue a new offer; merges the returned offer into the cache on success.
|
|
103
|
+
*
|
|
104
|
+
* `to_actor_id` (optional) narrows the offer to a specific actor on
|
|
105
|
+
* `to_account_id`; omit / null for the account-grain default (any actor
|
|
106
|
+
* on the recipient account may accept).
|
|
107
|
+
*/
|
|
101
108
|
create(params: {
|
|
102
109
|
to_account_id: string;
|
|
110
|
+
to_actor_id?: string | null;
|
|
103
111
|
role: string;
|
|
104
112
|
scope_id?: string | null;
|
|
105
113
|
message?: string | null;
|
|
106
|
-
}): Promise<
|
|
114
|
+
}): Promise<RoleGrantOfferJson | undefined>;
|
|
107
115
|
/** Accept an offer; stamps it terminal in the cache and drops any siblings the server superseded. */
|
|
108
116
|
accept(offer_id: string): Promise<void>;
|
|
109
117
|
decline(offer_id: string, reason?: string | null): Promise<void>;
|
|
@@ -112,7 +120,7 @@ export declare class PermitOffersState extends Loadable {
|
|
|
112
120
|
* Wire a notification subscription. The handler dispatches each matching
|
|
113
121
|
* notification into `apply_notification`; the returned disposer unwires.
|
|
114
122
|
*/
|
|
115
|
-
subscribe(subscribe_fn:
|
|
123
|
+
subscribe(subscribe_fn: RoleGrantOfferSubscribe): () => void;
|
|
116
124
|
/**
|
|
117
125
|
* Reduce a single WS notification into the cache. Exposed so consumers
|
|
118
126
|
* wiring their WS receiver directly (without `subscribe`) and tests can
|
|
@@ -120,8 +128,8 @@ export declare class PermitOffersState extends Loadable {
|
|
|
120
128
|
*
|
|
121
129
|
* @mutates `this`
|
|
122
130
|
*/
|
|
123
|
-
apply_notification(notification:
|
|
131
|
+
apply_notification(notification: RoleGrantOfferNotification): void;
|
|
124
132
|
/** Clear the cache and reset loading/error state. */
|
|
125
133
|
reset(): void;
|
|
126
134
|
}
|
|
127
|
-
//# sourceMappingURL=
|
|
135
|
+
//# sourceMappingURL=role_grant_offers_state.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role_grant_offers_state.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/role_grant_offers_state.svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAC,QAAQ,E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AAI,CAAC;QACzB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACxB,GAAG,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC;IAQ3C,qGAAqG;IAC/F,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAavC,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAOhE,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAO9C;;;OAGG;IACH,SAAS,CAAC,YAAY,EAAE,uBAAuB,GAAG,MAAM,IAAI;IAM5D;;;;;;OAMG;IACH,kBAAkB,CAAC,YAAY,EAAE,0BAA0B,GAAG,IAAI;IAwBlE,qDAAqD;IAC5C,KAAK,IAAI,IAAI;CAmBtB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Reactive state for the consentful-
|
|
2
|
+
* Reactive state for the consentful-role-grants offer flow.
|
|
3
3
|
*
|
|
4
4
|
* Maintains one offer cache keyed by id, seeded by the RPC list/history
|
|
5
|
-
* actions and kept live by the six
|
|
5
|
+
* actions and kept live by the six role-grant-offer WebSocket notifications.
|
|
6
6
|
* `incoming` (recipient-side pending) and `outgoing` (grantor-side pending)
|
|
7
7
|
* are derived views; `history` is the full cache ordered newest-first for
|
|
8
8
|
* the grantor/admin history view.
|
|
@@ -17,18 +17,18 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { create_context } from '@fuzdev/fuz_ui/context_helpers.js';
|
|
19
19
|
import { Loadable } from './loadable.svelte.js';
|
|
20
|
-
import {
|
|
20
|
+
import { ROLE_GRANT_OFFER_ACCEPTED_NOTIFICATION_METHOD, ROLE_GRANT_OFFER_DECLINED_NOTIFICATION_METHOD, ROLE_GRANT_OFFER_RECEIVED_NOTIFICATION_METHOD, ROLE_GRANT_OFFER_RETRACTED_NOTIFICATION_METHOD, ROLE_GRANT_OFFER_SUPERSEDE_NOTIFICATION_METHOD, ROLE_GRANT_REVOKE_NOTIFICATION_METHOD, } from '../auth/role_grant_offer_notifications.js';
|
|
21
21
|
/**
|
|
22
|
-
* Svelte context for `
|
|
23
|
-
* Use `
|
|
24
|
-
* `
|
|
22
|
+
* Svelte context for `RoleGrantOffersState`.
|
|
23
|
+
* Use `role_grant_offers_state_context.set(state)` in the provider and
|
|
24
|
+
* `role_grant_offers_state_context.get()` to access.
|
|
25
25
|
*/
|
|
26
|
-
export const
|
|
26
|
+
export const role_grant_offers_state_context = create_context();
|
|
27
27
|
const is_terminal = (o) => o.accepted_at !== null ||
|
|
28
28
|
o.declined_at !== null ||
|
|
29
29
|
o.retracted_at !== null ||
|
|
30
30
|
o.superseded_at !== null;
|
|
31
|
-
export class
|
|
31
|
+
export class RoleGrantOffersState extends Loadable {
|
|
32
32
|
#rpc;
|
|
33
33
|
#get_account_id;
|
|
34
34
|
#get_actor_id;
|
|
@@ -98,7 +98,13 @@ export class PermitOffersState extends Loadable {
|
|
|
98
98
|
this.#merge_offers(offers);
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
|
-
/**
|
|
101
|
+
/**
|
|
102
|
+
* Issue a new offer; merges the returned offer into the cache on success.
|
|
103
|
+
*
|
|
104
|
+
* `to_actor_id` (optional) narrows the offer to a specific actor on
|
|
105
|
+
* `to_account_id`; omit / null for the account-grain default (any actor
|
|
106
|
+
* on the recipient account may accept).
|
|
107
|
+
*/
|
|
102
108
|
async create(params) {
|
|
103
109
|
return this.run(async () => {
|
|
104
110
|
const { offer } = await this.#rpc.create(params);
|
|
@@ -149,23 +155,23 @@ export class PermitOffersState extends Loadable {
|
|
|
149
155
|
*/
|
|
150
156
|
apply_notification(notification) {
|
|
151
157
|
switch (notification.method) {
|
|
152
|
-
case
|
|
153
|
-
case
|
|
154
|
-
case
|
|
155
|
-
case
|
|
156
|
-
case
|
|
158
|
+
case ROLE_GRANT_OFFER_RECEIVED_NOTIFICATION_METHOD:
|
|
159
|
+
case ROLE_GRANT_OFFER_RETRACTED_NOTIFICATION_METHOD:
|
|
160
|
+
case ROLE_GRANT_OFFER_ACCEPTED_NOTIFICATION_METHOD:
|
|
161
|
+
case ROLE_GRANT_OFFER_DECLINED_NOTIFICATION_METHOD:
|
|
162
|
+
case ROLE_GRANT_OFFER_SUPERSEDE_NOTIFICATION_METHOD: {
|
|
157
163
|
const params = notification.params;
|
|
158
164
|
if (!params || typeof params !== 'object' || !('offer' in params))
|
|
159
165
|
return;
|
|
160
166
|
const offer = params.offer;
|
|
161
|
-
if (!
|
|
167
|
+
if (!is_role_grant_offer_like(offer))
|
|
162
168
|
return;
|
|
163
169
|
this.#merge_offers([offer]);
|
|
164
170
|
return;
|
|
165
171
|
}
|
|
166
|
-
case
|
|
167
|
-
//
|
|
168
|
-
// is unaffected. Consumers handle it in an auth/
|
|
172
|
+
case ROLE_GRANT_REVOKE_NOTIFICATION_METHOD:
|
|
173
|
+
// role_grant_revoke is a role-grant-lifecycle event — the offer cache
|
|
174
|
+
// is unaffected. Consumers handle it in an auth/role_grants state.
|
|
169
175
|
return;
|
|
170
176
|
default:
|
|
171
177
|
// unrelated notifications — ignore silently.
|
|
@@ -192,7 +198,7 @@ export class PermitOffersState extends Loadable {
|
|
|
192
198
|
this.#offers = next;
|
|
193
199
|
}
|
|
194
200
|
}
|
|
195
|
-
const
|
|
201
|
+
const is_role_grant_offer_like = (value) => !!value &&
|
|
196
202
|
typeof value === 'object' &&
|
|
197
203
|
typeof value.id === 'string' &&
|
|
198
204
|
typeof value.to_account_id === 'string' &&
|
package/dist/ui/ui_format.js
CHANGED
|
@@ -159,9 +159,9 @@ export const format_audit_metadata = (event_type, metadata) => {
|
|
|
159
159
|
return metadata.token_id ? `token: ${truncate_middle(metadata.token_id, 12)}` : '';
|
|
160
160
|
case 'token_revoke_all':
|
|
161
161
|
return metadata.count != null ? `${metadata.count} tokens` : '';
|
|
162
|
-
case '
|
|
162
|
+
case 'role_grant_create':
|
|
163
163
|
return metadata.role ? `role: ${metadata.role}` : '';
|
|
164
|
-
case '
|
|
164
|
+
case 'role_grant_revoke':
|
|
165
165
|
return metadata.role ? `role: ${metadata.role}` : '';
|
|
166
166
|
case 'invite_create':
|
|
167
167
|
return [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fuzdev/fuz_app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.56.0",
|
|
4
4
|
"description": "fullstack app library",
|
|
5
5
|
"glyph": "🗝",
|
|
6
6
|
"logo": "logo.svg",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"node": ">=24.14"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@electric-sql/pglite": ">=0.
|
|
25
|
+
"@electric-sql/pglite": ">=0.4",
|
|
26
26
|
"@fuzdev/blake3_wasm": ">=0.1.0",
|
|
27
27
|
"@fuzdev/fuz_util": ">=0.53.4",
|
|
28
28
|
"@node-rs/argon2": ">=2",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@electric-sql/pglite": "^0.
|
|
44
|
+
"@electric-sql/pglite": "^0.4.5",
|
|
45
45
|
"@fuzdev/blake3_wasm": "^0.1.0",
|
|
46
46
|
"@fuzdev/fuz_code": "^0.45.1",
|
|
47
47
|
"@fuzdev/fuz_css": "^0.59.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"permit_offer_action_specs.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/permit_offer_action_specs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,2BAA2B,CAAC;AAUzE,g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