@fuzdev/fuz_app 0.1.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/LICENSE +21 -0
- package/README.md +49 -0
- package/dist/actions/action_bridge.d.ts +65 -0
- package/dist/actions/action_bridge.d.ts.map +1 -0
- package/dist/actions/action_bridge.js +76 -0
- package/dist/actions/action_codegen.d.ts +97 -0
- package/dist/actions/action_codegen.d.ts.map +1 -0
- package/dist/actions/action_codegen.js +280 -0
- package/dist/actions/action_registry.d.ts +35 -0
- package/dist/actions/action_registry.d.ts.map +1 -0
- package/dist/actions/action_registry.js +83 -0
- package/dist/actions/action_spec.d.ts +169 -0
- package/dist/actions/action_spec.d.ts.map +1 -0
- package/dist/actions/action_spec.js +76 -0
- package/dist/auth/account_queries.d.ts +96 -0
- package/dist/auth/account_queries.d.ts.map +1 -0
- package/dist/auth/account_queries.js +172 -0
- package/dist/auth/account_routes.d.ts +86 -0
- package/dist/auth/account_routes.d.ts.map +1 -0
- package/dist/auth/account_routes.js +406 -0
- package/dist/auth/account_schema.d.ts +192 -0
- package/dist/auth/account_schema.d.ts.map +1 -0
- package/dist/auth/account_schema.js +105 -0
- package/dist/auth/admin_routes.d.ts +29 -0
- package/dist/auth/admin_routes.d.ts.map +1 -0
- package/dist/auth/admin_routes.js +193 -0
- package/dist/auth/api_token.d.ts +33 -0
- package/dist/auth/api_token.d.ts.map +1 -0
- package/dist/auth/api_token.js +36 -0
- package/dist/auth/api_token_queries.d.ts +80 -0
- package/dist/auth/api_token_queries.d.ts.map +1 -0
- package/dist/auth/api_token_queries.js +116 -0
- package/dist/auth/app_settings_queries.d.ts +33 -0
- package/dist/auth/app_settings_queries.d.ts.map +1 -0
- package/dist/auth/app_settings_queries.js +51 -0
- package/dist/auth/app_settings_routes.d.ts +27 -0
- package/dist/auth/app_settings_routes.d.ts.map +1 -0
- package/dist/auth/app_settings_routes.js +66 -0
- package/dist/auth/app_settings_schema.d.ts +35 -0
- package/dist/auth/app_settings_schema.d.ts.map +1 -0
- package/dist/auth/app_settings_schema.js +22 -0
- package/dist/auth/audit_log_queries.d.ts +90 -0
- package/dist/auth/audit_log_queries.d.ts.map +1 -0
- package/dist/auth/audit_log_queries.js +205 -0
- package/dist/auth/audit_log_routes.d.ts +33 -0
- package/dist/auth/audit_log_routes.d.ts.map +1 -0
- package/dist/auth/audit_log_routes.js +106 -0
- package/dist/auth/audit_log_schema.d.ts +259 -0
- package/dist/auth/audit_log_schema.d.ts.map +1 -0
- package/dist/auth/audit_log_schema.js +123 -0
- package/dist/auth/bearer_auth.d.ts +32 -0
- package/dist/auth/bearer_auth.d.ts.map +1 -0
- package/dist/auth/bearer_auth.js +90 -0
- package/dist/auth/bootstrap_account.d.ts +82 -0
- package/dist/auth/bootstrap_account.d.ts.map +1 -0
- package/dist/auth/bootstrap_account.js +97 -0
- package/dist/auth/bootstrap_routes.d.ts +74 -0
- package/dist/auth/bootstrap_routes.d.ts.map +1 -0
- package/dist/auth/bootstrap_routes.js +154 -0
- package/dist/auth/daemon_token.d.ts +49 -0
- package/dist/auth/daemon_token.d.ts.map +1 -0
- package/dist/auth/daemon_token.js +49 -0
- package/dist/auth/daemon_token_middleware.d.ts +93 -0
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -0
- package/dist/auth/daemon_token_middleware.js +167 -0
- package/dist/auth/ddl.d.ts +27 -0
- package/dist/auth/ddl.d.ts.map +1 -0
- package/dist/auth/ddl.js +111 -0
- package/dist/auth/deps.d.ts +52 -0
- package/dist/auth/deps.d.ts.map +1 -0
- package/dist/auth/deps.js +10 -0
- package/dist/auth/invite_queries.d.ts +68 -0
- package/dist/auth/invite_queries.d.ts.map +1 -0
- package/dist/auth/invite_queries.js +105 -0
- package/dist/auth/invite_routes.d.ts +18 -0
- package/dist/auth/invite_routes.d.ts.map +1 -0
- package/dist/auth/invite_routes.js +129 -0
- package/dist/auth/invite_schema.d.ts +51 -0
- package/dist/auth/invite_schema.d.ts.map +1 -0
- package/dist/auth/invite_schema.js +25 -0
- package/dist/auth/keyring.d.ts +87 -0
- package/dist/auth/keyring.d.ts.map +1 -0
- package/dist/auth/keyring.js +142 -0
- package/dist/auth/middleware.d.ts +40 -0
- package/dist/auth/middleware.d.ts.map +1 -0
- package/dist/auth/middleware.js +64 -0
- package/dist/auth/migrations.d.ts +42 -0
- package/dist/auth/migrations.d.ts.map +1 -0
- package/dist/auth/migrations.js +79 -0
- package/dist/auth/password.d.ts +39 -0
- package/dist/auth/password.d.ts.map +1 -0
- package/dist/auth/password.js +25 -0
- package/dist/auth/password_argon2.d.ts +43 -0
- package/dist/auth/password_argon2.d.ts.map +1 -0
- package/dist/auth/password_argon2.js +76 -0
- package/dist/auth/permit_queries.d.ts +72 -0
- package/dist/auth/permit_queries.d.ts.map +1 -0
- package/dist/auth/permit_queries.js +116 -0
- package/dist/auth/request_context.d.ts +114 -0
- package/dist/auth/request_context.d.ts.map +1 -0
- package/dist/auth/request_context.js +176 -0
- package/dist/auth/require_keeper.d.ts +20 -0
- package/dist/auth/require_keeper.d.ts.map +1 -0
- package/dist/auth/require_keeper.js +35 -0
- package/dist/auth/role_schema.d.ts +69 -0
- package/dist/auth/role_schema.d.ts.map +1 -0
- package/dist/auth/role_schema.js +70 -0
- package/dist/auth/route_guards.d.ts +21 -0
- package/dist/auth/route_guards.d.ts.map +1 -0
- package/dist/auth/route_guards.js +32 -0
- package/dist/auth/session_cookie.d.ts +158 -0
- package/dist/auth/session_cookie.d.ts.map +1 -0
- package/dist/auth/session_cookie.js +135 -0
- package/dist/auth/session_lifecycle.d.ts +35 -0
- package/dist/auth/session_lifecycle.d.ts.map +1 -0
- package/dist/auth/session_lifecycle.js +27 -0
- package/dist/auth/session_middleware.d.ts +33 -0
- package/dist/auth/session_middleware.d.ts.map +1 -0
- package/dist/auth/session_middleware.js +62 -0
- package/dist/auth/session_queries.d.ts +135 -0
- package/dist/auth/session_queries.d.ts.map +1 -0
- package/dist/auth/session_queries.js +186 -0
- package/dist/auth/signup_routes.d.ts +32 -0
- package/dist/auth/signup_routes.d.ts.map +1 -0
- package/dist/auth/signup_routes.js +150 -0
- package/dist/cli/args.d.ts +48 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +76 -0
- package/dist/cli/config.d.ts +48 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/config.js +77 -0
- package/dist/cli/daemon.d.ts +82 -0
- package/dist/cli/daemon.d.ts.map +1 -0
- package/dist/cli/daemon.js +149 -0
- package/dist/cli/help.d.ts +85 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/help.js +138 -0
- package/dist/cli/logger.d.ts +46 -0
- package/dist/cli/logger.d.ts.map +1 -0
- package/dist/cli/logger.js +48 -0
- package/dist/cli/util.d.ts +36 -0
- package/dist/cli/util.d.ts.map +1 -0
- package/dist/cli/util.js +50 -0
- package/dist/crypto.d.ts +13 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/crypto.js +19 -0
- package/dist/db/assert_row.d.ts +18 -0
- package/dist/db/assert_row.d.ts.map +1 -0
- package/dist/db/assert_row.js +24 -0
- package/dist/db/create_db.d.ts +38 -0
- package/dist/db/create_db.d.ts.map +1 -0
- package/dist/db/create_db.js +57 -0
- package/dist/db/db.d.ts +97 -0
- package/dist/db/db.d.ts.map +1 -0
- package/dist/db/db.js +76 -0
- package/dist/db/db_pg.d.ts +21 -0
- package/dist/db/db_pg.d.ts.map +1 -0
- package/dist/db/db_pg.js +45 -0
- package/dist/db/db_pglite.d.ts +21 -0
- package/dist/db/db_pglite.d.ts.map +1 -0
- package/dist/db/db_pglite.js +28 -0
- package/dist/db/migrate.d.ts +67 -0
- package/dist/db/migrate.d.ts.map +1 -0
- package/dist/db/migrate.js +118 -0
- package/dist/db/pg_error.d.ts +16 -0
- package/dist/db/pg_error.d.ts.map +1 -0
- package/dist/db/pg_error.js +15 -0
- package/dist/db/query_deps.d.ts +14 -0
- package/dist/db/query_deps.d.ts.map +1 -0
- package/dist/db/query_deps.js +9 -0
- package/dist/db/sql_identifier.d.ts +27 -0
- package/dist/db/sql_identifier.d.ts.map +1 -0
- package/dist/db/sql_identifier.js +31 -0
- package/dist/db/status.d.ts +62 -0
- package/dist/db/status.d.ts.map +1 -0
- package/dist/db/status.js +116 -0
- package/dist/dev/setup.d.ts +159 -0
- package/dist/dev/setup.d.ts.map +1 -0
- package/dist/dev/setup.js +265 -0
- package/dist/env/dotenv.d.ts +25 -0
- package/dist/env/dotenv.d.ts.map +1 -0
- package/dist/env/dotenv.js +52 -0
- package/dist/env/load.d.ts +52 -0
- package/dist/env/load.d.ts.map +1 -0
- package/dist/env/load.js +79 -0
- package/dist/env/mask.d.ts +19 -0
- package/dist/env/mask.d.ts.map +1 -0
- package/dist/env/mask.js +26 -0
- package/dist/env/resolve.d.ts +126 -0
- package/dist/env/resolve.d.ts.map +1 -0
- package/dist/env/resolve.js +200 -0
- package/dist/hono_context.d.ts +48 -0
- package/dist/hono_context.d.ts.map +1 -0
- package/dist/hono_context.js +22 -0
- package/dist/http/common_routes.d.ts +52 -0
- package/dist/http/common_routes.d.ts.map +1 -0
- package/dist/http/common_routes.js +65 -0
- package/dist/http/db_routes.d.ts +57 -0
- package/dist/http/db_routes.d.ts.map +1 -0
- package/dist/http/db_routes.js +176 -0
- package/dist/http/error_schemas.d.ts +169 -0
- package/dist/http/error_schemas.d.ts.map +1 -0
- package/dist/http/error_schemas.js +178 -0
- package/dist/http/middleware_spec.d.ts +19 -0
- package/dist/http/middleware_spec.d.ts.map +1 -0
- package/dist/http/middleware_spec.js +9 -0
- package/dist/http/origin.d.ts +57 -0
- package/dist/http/origin.d.ts.map +1 -0
- package/dist/http/origin.js +207 -0
- package/dist/http/proxy.d.ts +112 -0
- package/dist/http/proxy.d.ts.map +1 -0
- package/dist/http/proxy.js +240 -0
- package/dist/http/route_spec.d.ts +197 -0
- package/dist/http/route_spec.d.ts.map +1 -0
- package/dist/http/route_spec.js +243 -0
- package/dist/http/schema_helpers.d.ts +64 -0
- package/dist/http/schema_helpers.d.ts.map +1 -0
- package/dist/http/schema_helpers.js +90 -0
- package/dist/http/surface.d.ts +132 -0
- package/dist/http/surface.d.ts.map +1 -0
- package/dist/http/surface.js +156 -0
- package/dist/http/surface_query.d.ts +77 -0
- package/dist/http/surface_query.d.ts.map +1 -0
- package/dist/http/surface_query.js +86 -0
- package/dist/rate_limiter.d.ts +94 -0
- package/dist/rate_limiter.d.ts.map +1 -0
- package/dist/rate_limiter.js +156 -0
- package/dist/realtime/sse.d.ts +80 -0
- package/dist/realtime/sse.d.ts.map +1 -0
- package/dist/realtime/sse.js +109 -0
- package/dist/realtime/sse_auth_guard.d.ts +93 -0
- package/dist/realtime/sse_auth_guard.d.ts.map +1 -0
- package/dist/realtime/sse_auth_guard.js +111 -0
- package/dist/realtime/subscriber_registry.d.ts +85 -0
- package/dist/realtime/subscriber_registry.d.ts.map +1 -0
- package/dist/realtime/subscriber_registry.js +108 -0
- package/dist/runtime/deno.d.ts +21 -0
- package/dist/runtime/deno.d.ts.map +1 -0
- package/dist/runtime/deno.js +83 -0
- package/dist/runtime/deps.d.ts +113 -0
- package/dist/runtime/deps.d.ts.map +1 -0
- package/dist/runtime/deps.js +10 -0
- package/dist/runtime/fs.d.ts +15 -0
- package/dist/runtime/fs.d.ts.map +1 -0
- package/dist/runtime/fs.js +17 -0
- package/dist/runtime/mock.d.ts +81 -0
- package/dist/runtime/mock.d.ts.map +1 -0
- package/dist/runtime/mock.js +195 -0
- package/dist/runtime/node.d.ts +17 -0
- package/dist/runtime/node.d.ts.map +1 -0
- package/dist/runtime/node.js +117 -0
- package/dist/schema_meta.d.ts +16 -0
- package/dist/schema_meta.d.ts.map +1 -0
- package/dist/schema_meta.js +9 -0
- package/dist/sensitivity.d.ts +15 -0
- package/dist/sensitivity.d.ts.map +1 -0
- package/dist/sensitivity.js +9 -0
- package/dist/server/app_backend.d.ts +74 -0
- package/dist/server/app_backend.d.ts.map +1 -0
- package/dist/server/app_backend.js +39 -0
- package/dist/server/app_server.d.ts +201 -0
- package/dist/server/app_server.d.ts.map +1 -0
- package/dist/server/app_server.js +266 -0
- package/dist/server/env.d.ts +68 -0
- package/dist/server/env.d.ts.map +1 -0
- package/dist/server/env.js +95 -0
- package/dist/server/startup.d.ts +22 -0
- package/dist/server/startup.d.ts.map +1 -0
- package/dist/server/startup.js +48 -0
- package/dist/server/static.d.ts +39 -0
- package/dist/server/static.d.ts.map +1 -0
- package/dist/server/static.js +38 -0
- package/dist/server/validate_nginx.d.ts +34 -0
- package/dist/server/validate_nginx.d.ts.map +1 -0
- package/dist/server/validate_nginx.js +118 -0
- package/dist/testing/CLAUDE.md +3 -0
- package/dist/testing/admin_integration.d.ts +45 -0
- package/dist/testing/admin_integration.d.ts.map +1 -0
- package/dist/testing/admin_integration.js +840 -0
- package/dist/testing/adversarial_404.d.ts +15 -0
- package/dist/testing/adversarial_404.d.ts.map +1 -0
- package/dist/testing/adversarial_404.js +118 -0
- package/dist/testing/adversarial_headers.d.ts +36 -0
- package/dist/testing/adversarial_headers.d.ts.map +1 -0
- package/dist/testing/adversarial_headers.js +128 -0
- package/dist/testing/adversarial_input.d.ts +56 -0
- package/dist/testing/adversarial_input.d.ts.map +1 -0
- package/dist/testing/adversarial_input.js +494 -0
- package/dist/testing/app_server.d.ts +169 -0
- package/dist/testing/app_server.d.ts.map +1 -0
- package/dist/testing/app_server.js +240 -0
- package/dist/testing/assert_dev_env.d.ts +10 -0
- package/dist/testing/assert_dev_env.d.ts.map +1 -0
- package/dist/testing/assert_dev_env.js +13 -0
- package/dist/testing/assertions.d.ts +61 -0
- package/dist/testing/assertions.d.ts.map +1 -0
- package/dist/testing/assertions.js +96 -0
- package/dist/testing/attack_surface.d.ts +63 -0
- package/dist/testing/attack_surface.d.ts.map +1 -0
- package/dist/testing/attack_surface.js +224 -0
- package/dist/testing/audit_completeness.d.ts +29 -0
- package/dist/testing/audit_completeness.d.ts.map +1 -0
- package/dist/testing/audit_completeness.js +410 -0
- package/dist/testing/auth_apps.d.ts +55 -0
- package/dist/testing/auth_apps.d.ts.map +1 -0
- package/dist/testing/auth_apps.js +122 -0
- package/dist/testing/data_exposure.d.ts +62 -0
- package/dist/testing/data_exposure.d.ts.map +1 -0
- package/dist/testing/data_exposure.js +297 -0
- package/dist/testing/db.d.ts +111 -0
- package/dist/testing/db.d.ts.map +1 -0
- package/dist/testing/db.js +258 -0
- package/dist/testing/entities.d.ts +21 -0
- package/dist/testing/entities.d.ts.map +1 -0
- package/dist/testing/entities.js +42 -0
- package/dist/testing/error_coverage.d.ts +78 -0
- package/dist/testing/error_coverage.d.ts.map +1 -0
- package/dist/testing/error_coverage.js +135 -0
- package/dist/testing/integration.d.ts +37 -0
- package/dist/testing/integration.d.ts.map +1 -0
- package/dist/testing/integration.js +1139 -0
- package/dist/testing/integration_helpers.d.ts +107 -0
- package/dist/testing/integration_helpers.d.ts.map +1 -0
- package/dist/testing/integration_helpers.js +246 -0
- package/dist/testing/middleware.d.ts +125 -0
- package/dist/testing/middleware.d.ts.map +1 -0
- package/dist/testing/middleware.js +210 -0
- package/dist/testing/rate_limiting.d.ts +43 -0
- package/dist/testing/rate_limiting.d.ts.map +1 -0
- package/dist/testing/rate_limiting.js +216 -0
- package/dist/testing/round_trip.d.ts +37 -0
- package/dist/testing/round_trip.d.ts.map +1 -0
- package/dist/testing/round_trip.js +128 -0
- package/dist/testing/schema_generators.d.ts +33 -0
- package/dist/testing/schema_generators.d.ts.map +1 -0
- package/dist/testing/schema_generators.js +137 -0
- package/dist/testing/standard.d.ts +49 -0
- package/dist/testing/standard.d.ts.map +1 -0
- package/dist/testing/standard.js +16 -0
- package/dist/testing/stubs.d.ts +96 -0
- package/dist/testing/stubs.d.ts.map +1 -0
- package/dist/testing/stubs.js +192 -0
- package/dist/testing/surface_invariants.d.ts +189 -0
- package/dist/testing/surface_invariants.d.ts.map +1 -0
- package/dist/testing/surface_invariants.js +450 -0
- package/dist/ui/AccountSessions.svelte +75 -0
- package/dist/ui/AccountSessions.svelte.d.ts +19 -0
- package/dist/ui/AccountSessions.svelte.d.ts.map +1 -0
- package/dist/ui/AdminAccounts.svelte +107 -0
- package/dist/ui/AdminAccounts.svelte.d.ts +19 -0
- package/dist/ui/AdminAccounts.svelte.d.ts.map +1 -0
- package/dist/ui/AdminAuditLog.svelte +144 -0
- package/dist/ui/AdminAuditLog.svelte.d.ts +4 -0
- package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -0
- package/dist/ui/AdminInvites.svelte +142 -0
- package/dist/ui/AdminInvites.svelte.d.ts +4 -0
- package/dist/ui/AdminInvites.svelte.d.ts.map +1 -0
- package/dist/ui/AdminOverview.svelte +337 -0
- package/dist/ui/AdminOverview.svelte.d.ts +4 -0
- package/dist/ui/AdminOverview.svelte.d.ts.map +1 -0
- package/dist/ui/AdminPermitHistory.svelte +61 -0
- package/dist/ui/AdminPermitHistory.svelte.d.ts +19 -0
- package/dist/ui/AdminPermitHistory.svelte.d.ts.map +1 -0
- package/dist/ui/AdminSessions.svelte +85 -0
- package/dist/ui/AdminSessions.svelte.d.ts +19 -0
- package/dist/ui/AdminSessions.svelte.d.ts.map +1 -0
- package/dist/ui/AdminSettings.svelte +32 -0
- package/dist/ui/AdminSettings.svelte.d.ts +19 -0
- package/dist/ui/AdminSettings.svelte.d.ts.map +1 -0
- package/dist/ui/AdminSurface.svelte +42 -0
- package/dist/ui/AdminSurface.svelte.d.ts +4 -0
- package/dist/ui/AdminSurface.svelte.d.ts.map +1 -0
- package/dist/ui/AppShell.svelte +93 -0
- package/dist/ui/AppShell.svelte.d.ts +20 -0
- package/dist/ui/AppShell.svelte.d.ts.map +1 -0
- package/dist/ui/BootstrapForm.svelte +105 -0
- package/dist/ui/BootstrapForm.svelte.d.ts +4 -0
- package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -0
- package/dist/ui/ColumnLayout.svelte +46 -0
- package/dist/ui/ColumnLayout.svelte.d.ts +11 -0
- package/dist/ui/ColumnLayout.svelte.d.ts.map +1 -0
- package/dist/ui/ConfirmButton.svelte +125 -0
- package/dist/ui/ConfirmButton.svelte.d.ts +54 -0
- package/dist/ui/ConfirmButton.svelte.d.ts.map +1 -0
- package/dist/ui/Datatable.svelte +185 -0
- package/dist/ui/Datatable.svelte.d.ts +35 -0
- package/dist/ui/Datatable.svelte.d.ts.map +1 -0
- package/dist/ui/LoginForm.svelte +82 -0
- package/dist/ui/LoginForm.svelte.d.ts +8 -0
- package/dist/ui/LoginForm.svelte.d.ts.map +1 -0
- package/dist/ui/LogoutButton.svelte +36 -0
- package/dist/ui/LogoutButton.svelte.d.ts +10 -0
- package/dist/ui/LogoutButton.svelte.d.ts.map +1 -0
- package/dist/ui/MenuLink.svelte +35 -0
- package/dist/ui/MenuLink.svelte.d.ts +12 -0
- package/dist/ui/MenuLink.svelte.d.ts.map +1 -0
- package/dist/ui/OpenSignupToggle.svelte +36 -0
- package/dist/ui/OpenSignupToggle.svelte.d.ts +19 -0
- package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -0
- package/dist/ui/PopoverButton.svelte +136 -0
- package/dist/ui/PopoverButton.svelte.d.ts +63 -0
- package/dist/ui/PopoverButton.svelte.d.ts.map +1 -0
- package/dist/ui/SignupForm.svelte +117 -0
- package/dist/ui/SignupForm.svelte.d.ts +7 -0
- package/dist/ui/SignupForm.svelte.d.ts.map +1 -0
- package/dist/ui/SurfaceExplorer.svelte +287 -0
- package/dist/ui/SurfaceExplorer.svelte.d.ts +8 -0
- package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -0
- package/dist/ui/account_sessions_state.svelte.d.ts +15 -0
- package/dist/ui/account_sessions_state.svelte.d.ts.map +1 -0
- package/dist/ui/account_sessions_state.svelte.js +45 -0
- package/dist/ui/admin_accounts_state.svelte.d.ts +19 -0
- package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -0
- package/dist/ui/admin_accounts_state.svelte.js +65 -0
- package/dist/ui/admin_invites_state.svelte.d.ts +19 -0
- package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -0
- package/dist/ui/admin_invites_state.svelte.js +71 -0
- package/dist/ui/admin_sessions_state.svelte.d.ts +18 -0
- package/dist/ui/admin_sessions_state.svelte.d.ts.map +1 -0
- package/dist/ui/admin_sessions_state.svelte.js +62 -0
- package/dist/ui/app_settings_state.svelte.d.ts +14 -0
- package/dist/ui/app_settings_state.svelte.d.ts.map +1 -0
- package/dist/ui/app_settings_state.svelte.js +44 -0
- package/dist/ui/audit_log_state.svelte.d.ts +40 -0
- package/dist/ui/audit_log_state.svelte.d.ts.map +1 -0
- package/dist/ui/audit_log_state.svelte.js +153 -0
- package/dist/ui/auth_state.svelte.d.ts +85 -0
- package/dist/ui/auth_state.svelte.d.ts.map +1 -0
- package/dist/ui/auth_state.svelte.js +238 -0
- package/dist/ui/datatable.d.ts +25 -0
- package/dist/ui/datatable.d.ts.map +1 -0
- package/dist/ui/datatable.js +9 -0
- package/dist/ui/enter_advance.d.ts +13 -0
- package/dist/ui/enter_advance.d.ts.map +1 -0
- package/dist/ui/enter_advance.js +30 -0
- package/dist/ui/loadable.svelte.d.ts +55 -0
- package/dist/ui/loadable.svelte.d.ts.map +1 -0
- package/dist/ui/loadable.svelte.js +75 -0
- package/dist/ui/popover.svelte.d.ts +137 -0
- package/dist/ui/popover.svelte.d.ts.map +1 -0
- package/dist/ui/popover.svelte.js +288 -0
- package/dist/ui/position_helpers.d.ts +27 -0
- package/dist/ui/position_helpers.d.ts.map +1 -0
- package/dist/ui/position_helpers.js +81 -0
- package/dist/ui/sidebar_state.svelte.d.ts +30 -0
- package/dist/ui/sidebar_state.svelte.d.ts.map +1 -0
- package/dist/ui/sidebar_state.svelte.js +39 -0
- package/dist/ui/table_state.svelte.d.ts +63 -0
- package/dist/ui/table_state.svelte.d.ts.map +1 -0
- package/dist/ui/table_state.svelte.js +117 -0
- package/dist/ui/ui_fetch.d.ts +29 -0
- package/dist/ui/ui_fetch.d.ts.map +1 -0
- package/dist/ui/ui_fetch.js +37 -0
- package/dist/ui/ui_format.d.ts +63 -0
- package/dist/ui/ui_format.d.ts.map +1 -0
- package/dist/ui/ui_format.js +196 -0
- package/package.json +121 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment variable `$$VAR$$` resolution suite.
|
|
3
|
+
*
|
|
4
|
+
* Resolves `$$VAR$$` references in strings and object trees,
|
|
5
|
+
* scans configs for references, and validates/formats missing vars.
|
|
6
|
+
*
|
|
7
|
+
* The double-dollar bookending syntax is:
|
|
8
|
+
* - Visually distinct from shell `$VAR` syntax
|
|
9
|
+
* - Unambiguous about variable boundaries
|
|
10
|
+
* - Easy to grep: `grep '\$\$'`
|
|
11
|
+
* - Fails loud if accidentally shell-processed (`$$`=PID in shell)
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Pattern for environment variable references: `$$VAR$$`.
|
|
17
|
+
*/
|
|
18
|
+
const ENV_VAR_PATTERN = /\$\$([A-Za-z_][A-Za-z0-9_]*)\$\$/g;
|
|
19
|
+
/**
|
|
20
|
+
* Resolve environment variable references in a string.
|
|
21
|
+
*
|
|
22
|
+
* Uses `$$VAR$$` syntax (bookended double-dollar signs).
|
|
23
|
+
* Only resolves variables that are actually set in the environment.
|
|
24
|
+
* Unset variables are left as-is for clear error messages.
|
|
25
|
+
*
|
|
26
|
+
* @param runtime - runtime with `env_get` capability
|
|
27
|
+
* @param value - string that may contain `$$VAR$$` references
|
|
28
|
+
* @returns string with env vars resolved
|
|
29
|
+
*/
|
|
30
|
+
export const resolve_env_vars = (runtime, value) => {
|
|
31
|
+
return value.replace(ENV_VAR_PATTERN, (match, name) => {
|
|
32
|
+
const resolved = runtime.env_get(name);
|
|
33
|
+
// leave unresolved for the validation phase to report
|
|
34
|
+
return resolved !== undefined ? resolved : match;
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Check if a string contains unresolved env var references.
|
|
39
|
+
*
|
|
40
|
+
* @param value - string to check
|
|
41
|
+
* @returns `true` if string contains `$$VAR$$` patterns
|
|
42
|
+
*/
|
|
43
|
+
export const has_env_vars = (value) => {
|
|
44
|
+
// use a fresh regex to avoid global regex lastIndex state issues
|
|
45
|
+
return /\$\$[A-Za-z_][A-Za-z0-9_]*\$\$/.test(value);
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Get list of env var names referenced in a string.
|
|
49
|
+
*
|
|
50
|
+
* @param value - string to scan
|
|
51
|
+
* @returns array of variable names (without `$$` delimiters)
|
|
52
|
+
*/
|
|
53
|
+
export const get_env_var_names = (value) => {
|
|
54
|
+
const names = [];
|
|
55
|
+
let match;
|
|
56
|
+
// reset regex lastIndex since it's global
|
|
57
|
+
const pattern = new RegExp(ENV_VAR_PATTERN.source, 'g');
|
|
58
|
+
while ((match = pattern.exec(value)) !== null) {
|
|
59
|
+
names.push(match[1]);
|
|
60
|
+
}
|
|
61
|
+
return names;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Resolve env vars in an object's string values (shallow).
|
|
65
|
+
*
|
|
66
|
+
* @param runtime - runtime with `env_get` capability
|
|
67
|
+
* @param obj - object with string values
|
|
68
|
+
* @returns new object with env vars resolved
|
|
69
|
+
*/
|
|
70
|
+
export const resolve_env_vars_in_object = (runtime, obj) => {
|
|
71
|
+
const result = { ...obj };
|
|
72
|
+
for (const [key, value] of Object.entries(result)) {
|
|
73
|
+
if (typeof value === 'string') {
|
|
74
|
+
result[key] = resolve_env_vars(runtime, value);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Resolve env vars and throw if any are missing/empty.
|
|
81
|
+
*
|
|
82
|
+
* Use this for values that must be present.
|
|
83
|
+
*
|
|
84
|
+
* @param runtime - runtime with `env_get` capability
|
|
85
|
+
* @param value - string with `$$VAR$$` references
|
|
86
|
+
* @param context - description for error message (e.g., `"target.host"`)
|
|
87
|
+
* @returns resolved string
|
|
88
|
+
* @throws error if any referenced env var is missing or empty
|
|
89
|
+
*/
|
|
90
|
+
export const resolve_env_vars_required = (runtime, value, context) => {
|
|
91
|
+
const missing = [];
|
|
92
|
+
const result = value.replace(ENV_VAR_PATTERN, (match, name) => {
|
|
93
|
+
const resolved = runtime.env_get(name);
|
|
94
|
+
if (resolved === undefined || resolved === '') {
|
|
95
|
+
missing.push(name);
|
|
96
|
+
return match; // keep original for error message
|
|
97
|
+
}
|
|
98
|
+
return resolved;
|
|
99
|
+
});
|
|
100
|
+
if (missing.length > 0) {
|
|
101
|
+
throw new Error(`Missing required environment variable(s) for ${context}: ${missing.join(', ')}`);
|
|
102
|
+
}
|
|
103
|
+
return result;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Recursively scan an object for `$$VAR$$` env var references.
|
|
107
|
+
*
|
|
108
|
+
* Walks all string values in the object tree and extracts env var names
|
|
109
|
+
* with their path context for error reporting.
|
|
110
|
+
*
|
|
111
|
+
* @param obj - object to scan (typically a config)
|
|
112
|
+
* @returns array of env var references with paths
|
|
113
|
+
*/
|
|
114
|
+
export const scan_env_vars = (obj) => {
|
|
115
|
+
const refs = [];
|
|
116
|
+
scan_recursive(obj, '', refs);
|
|
117
|
+
return refs;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Recursive helper for `scan_env_vars`.
|
|
121
|
+
*/
|
|
122
|
+
const scan_recursive = (value, path, refs) => {
|
|
123
|
+
if (typeof value === 'string') {
|
|
124
|
+
const names = get_env_var_names(value);
|
|
125
|
+
for (const name of names) {
|
|
126
|
+
refs.push({ name, path });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
else if (Array.isArray(value)) {
|
|
130
|
+
for (let i = 0; i < value.length; i++) {
|
|
131
|
+
scan_recursive(value[i], `${path}[${i}]`, refs);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else if (value !== null && typeof value === 'object') {
|
|
135
|
+
for (const [key, v] of Object.entries(value)) {
|
|
136
|
+
const new_path = path ? `${path}.${key}` : key;
|
|
137
|
+
scan_recursive(v, new_path, refs);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
// primitives (number, boolean, null, undefined) have no env vars
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Validate that all referenced env vars exist in the environment.
|
|
144
|
+
*
|
|
145
|
+
* Returns all missing refs (including duplicates by name). Grouping
|
|
146
|
+
* and deduplication is handled by `format_missing_env_vars` at display time.
|
|
147
|
+
*
|
|
148
|
+
* @param runtime - runtime with `env_get` capability
|
|
149
|
+
* @param refs - env var references from `scan_env_vars`
|
|
150
|
+
* @returns validation result with any missing vars
|
|
151
|
+
*/
|
|
152
|
+
export const validate_env_vars = (runtime, refs) => {
|
|
153
|
+
let missing = null;
|
|
154
|
+
for (const ref of refs) {
|
|
155
|
+
const value = runtime.env_get(ref.name);
|
|
156
|
+
if (value === undefined || value === '') {
|
|
157
|
+
(missing ??= []).push(ref);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return missing === null ? { ok: true, missing: null } : { ok: false, missing };
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Format missing env vars error message.
|
|
164
|
+
*
|
|
165
|
+
* Groups refs by variable name so each missing var is shown once
|
|
166
|
+
* with all paths where it's referenced.
|
|
167
|
+
*
|
|
168
|
+
* @param missing - missing env var references (may contain duplicate names)
|
|
169
|
+
* @param options - formatting options
|
|
170
|
+
* @returns formatted error message for display
|
|
171
|
+
*/
|
|
172
|
+
export const format_missing_env_vars = (missing, options) => {
|
|
173
|
+
const lines = ['Missing required environment variables:', ''];
|
|
174
|
+
// group by variable name, preserving insertion order
|
|
175
|
+
const grouped = new Map();
|
|
176
|
+
for (const ref of missing) {
|
|
177
|
+
let paths = grouped.get(ref.name);
|
|
178
|
+
if (!paths) {
|
|
179
|
+
paths = [];
|
|
180
|
+
grouped.set(ref.name, paths);
|
|
181
|
+
}
|
|
182
|
+
paths.push(ref.path);
|
|
183
|
+
}
|
|
184
|
+
for (const [name, paths] of grouped) {
|
|
185
|
+
lines.push(` ${name} - used in ${paths.join(', ')}`);
|
|
186
|
+
}
|
|
187
|
+
lines.push('');
|
|
188
|
+
const env_file = options?.env_file;
|
|
189
|
+
if (env_file) {
|
|
190
|
+
lines.push(`Loaded from: ${env_file}`);
|
|
191
|
+
lines.push(`Add these to your ${env_file} file.`);
|
|
192
|
+
if (options.setup_hint) {
|
|
193
|
+
lines.push(options.setup_hint);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
lines.push('Use --env_file to load environment variables from a file.');
|
|
198
|
+
}
|
|
199
|
+
return lines.join('\n');
|
|
200
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hono context variable augmentation for fuz_app.
|
|
3
|
+
*
|
|
4
|
+
* Cross-cutting shared vocabulary — defines the Hono `ContextVariableMap`
|
|
5
|
+
* variables used by auth, http, server, and testing modules.
|
|
6
|
+
*
|
|
7
|
+
* Import this module once in your app to get type-safe access to
|
|
8
|
+
* `auth_session_id`, `request_context`, and `credential_type` on the Hono context.
|
|
9
|
+
*
|
|
10
|
+
* In practice, this is auto-loaded by `app_server.ts` (side-effect import)
|
|
11
|
+
* and transitively by auth middleware modules that import `CREDENTIAL_TYPE_KEY`.
|
|
12
|
+
* Consumers don't need a manual import unless bypassing the standard server assembly.
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
import { z } from 'zod';
|
|
17
|
+
import type { RequestContext } from './auth/request_context.js';
|
|
18
|
+
/** The credential types that can authenticate a request. */
|
|
19
|
+
export declare const CREDENTIAL_TYPES: readonly ["session", "api_token", "daemon_token"];
|
|
20
|
+
/** Credential type — how a request was authenticated. */
|
|
21
|
+
export declare const CredentialType: z.ZodEnum<{
|
|
22
|
+
session: "session";
|
|
23
|
+
api_token: "api_token";
|
|
24
|
+
daemon_token: "daemon_token";
|
|
25
|
+
}>;
|
|
26
|
+
export type CredentialType = z.infer<typeof CredentialType>;
|
|
27
|
+
/** Hono context variable name for the credential type. */
|
|
28
|
+
export declare const CREDENTIAL_TYPE_KEY = "credential_type";
|
|
29
|
+
declare module 'hono' {
|
|
30
|
+
interface ContextVariableMap {
|
|
31
|
+
/** Resolved client IP, set by the trusted proxy middleware. */
|
|
32
|
+
client_ip: string;
|
|
33
|
+
auth_session_id: string | null;
|
|
34
|
+
request_context: RequestContext | null;
|
|
35
|
+
validated_input: unknown;
|
|
36
|
+
validated_params: unknown;
|
|
37
|
+
validated_query: unknown;
|
|
38
|
+
/** How the request was authenticated (`'session'`, `'api_token'`, or `'daemon_token'`). */
|
|
39
|
+
credential_type: CredentialType | null;
|
|
40
|
+
/**
|
|
41
|
+
* Pending fire-and-forget effects for this request (audit logs, usage tracking, etc.).
|
|
42
|
+
* Initialized by `create_app_server`. In test mode (`await_pending_effects: true`),
|
|
43
|
+
* all effects are awaited before the response returns.
|
|
44
|
+
*/
|
|
45
|
+
pending_effects: Array<Promise<void>>;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=hono_context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hono_context.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/hono_context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAE9D,4DAA4D;AAC5D,eAAO,MAAM,gBAAgB,mDAAoD,CAAC;AAElF,yDAAyD;AACzD,eAAO,MAAM,cAAc;;;;EAA2B,CAAC;AACvD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,0DAA0D;AAC1D,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAErD,OAAO,QAAQ,MAAM,CAAC;IACrB,UAAU,kBAAkB;QAC3B,+DAA+D;QAC/D,SAAS,EAAE,MAAM,CAAC;QAClB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;QAC/B,eAAe,EAAE,cAAc,GAAG,IAAI,CAAC;QACvC,eAAe,EAAE,OAAO,CAAC;QACzB,gBAAgB,EAAE,OAAO,CAAC;QAC1B,eAAe,EAAE,OAAO,CAAC;QACzB,2FAA2F;QAC3F,eAAe,EAAE,cAAc,GAAG,IAAI,CAAC;QACvC;;;;WAIG;QACH,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;KACtC;CACD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hono context variable augmentation for fuz_app.
|
|
3
|
+
*
|
|
4
|
+
* Cross-cutting shared vocabulary — defines the Hono `ContextVariableMap`
|
|
5
|
+
* variables used by auth, http, server, and testing modules.
|
|
6
|
+
*
|
|
7
|
+
* Import this module once in your app to get type-safe access to
|
|
8
|
+
* `auth_session_id`, `request_context`, and `credential_type` on the Hono context.
|
|
9
|
+
*
|
|
10
|
+
* In practice, this is auto-loaded by `app_server.ts` (side-effect import)
|
|
11
|
+
* and transitively by auth middleware modules that import `CREDENTIAL_TYPE_KEY`.
|
|
12
|
+
* Consumers don't need a manual import unless bypassing the standard server assembly.
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
import { z } from 'zod';
|
|
17
|
+
/** The credential types that can authenticate a request. */
|
|
18
|
+
export const CREDENTIAL_TYPES = ['session', 'api_token', 'daemon_token'];
|
|
19
|
+
/** Credential type — how a request was authenticated. */
|
|
20
|
+
export const CredentialType = z.enum(CREDENTIAL_TYPES);
|
|
21
|
+
/** Hono context variable name for the credential type. */
|
|
22
|
+
export const CREDENTIAL_TYPE_KEY = 'credential_type';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common route spec factories for fuz_app consumers.
|
|
3
|
+
*
|
|
4
|
+
* Generic HTTP route factories with no auth-domain dependencies.
|
|
5
|
+
* Auth-aware route factories (account status) live in `auth/account_routes.ts`.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type { RouteSpec } from './route_spec.js';
|
|
10
|
+
import type { AppSurface } from './surface.js';
|
|
11
|
+
/**
|
|
12
|
+
* Create a public health check route spec.
|
|
13
|
+
*
|
|
14
|
+
* Infrastructure endpoint for uptime monitors and load balancers.
|
|
15
|
+
* Bootstrap availability is exposed via `/api/account/status` instead.
|
|
16
|
+
*
|
|
17
|
+
* @returns a single health check route spec
|
|
18
|
+
*/
|
|
19
|
+
export declare const create_health_route_spec: () => RouteSpec;
|
|
20
|
+
/** Options for the authenticated server status route. */
|
|
21
|
+
export interface ServerStatusOptions {
|
|
22
|
+
/** Application version string. */
|
|
23
|
+
version: string;
|
|
24
|
+
/** Returns milliseconds since server start. */
|
|
25
|
+
get_uptime_ms: () => number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Create an authenticated server status route spec.
|
|
29
|
+
*
|
|
30
|
+
* Returns version and uptime. Unlike the public health check,
|
|
31
|
+
* this requires authentication.
|
|
32
|
+
*
|
|
33
|
+
* @param options - version and uptime source
|
|
34
|
+
* @returns route spec for `GET /api/server/status`
|
|
35
|
+
*/
|
|
36
|
+
export declare const create_server_status_route_spec: (options: ServerStatusOptions) => RouteSpec;
|
|
37
|
+
/** Options for the surface explorer route. */
|
|
38
|
+
export interface SurfaceRouteOptions {
|
|
39
|
+
/** The generated app surface to serve. */
|
|
40
|
+
surface: AppSurface;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Create an authenticated route spec that serves the `AppSurface` as JSON.
|
|
44
|
+
*
|
|
45
|
+
* Surface data reveals API structure (routes, auth, schemas), so this
|
|
46
|
+
* requires authentication like the server status route.
|
|
47
|
+
*
|
|
48
|
+
* @param options - surface data source
|
|
49
|
+
* @returns route spec for `GET /api/surface`
|
|
50
|
+
*/
|
|
51
|
+
export declare const create_surface_route_spec: (options: SurfaceRouteOptions) => RouteSpec;
|
|
52
|
+
//# sourceMappingURL=common_routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/common_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AAE7C;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,QAAO,SAQ1C,CAAC;AAEH,yDAAyD;AACzD,MAAM,WAAW,mBAAmB;IACnC,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,aAAa,EAAE,MAAM,MAAM,CAAC;CAC5B;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,+BAA+B,GAAI,SAAS,mBAAmB,KAAG,SAQ7E,CAAC;AAEH,8CAA8C;AAC9C,MAAM,WAAW,mBAAmB;IACnC,0CAA0C;IAC1C,OAAO,EAAE,UAAU,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,GAAI,SAAS,mBAAmB,KAAG,SAWvE,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common route spec factories for fuz_app consumers.
|
|
3
|
+
*
|
|
4
|
+
* Generic HTTP route factories with no auth-domain dependencies.
|
|
5
|
+
* Auth-aware route factories (account status) live in `auth/account_routes.ts`.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
/**
|
|
11
|
+
* Create a public health check route spec.
|
|
12
|
+
*
|
|
13
|
+
* Infrastructure endpoint for uptime monitors and load balancers.
|
|
14
|
+
* Bootstrap availability is exposed via `/api/account/status` instead.
|
|
15
|
+
*
|
|
16
|
+
* @returns a single health check route spec
|
|
17
|
+
*/
|
|
18
|
+
export const create_health_route_spec = () => ({
|
|
19
|
+
method: 'GET',
|
|
20
|
+
path: '/health',
|
|
21
|
+
auth: { type: 'none' },
|
|
22
|
+
handler: (c) => c.json({ status: 'ok' }),
|
|
23
|
+
description: 'Health check',
|
|
24
|
+
input: z.null(),
|
|
25
|
+
output: z.strictObject({ status: z.literal('ok') }),
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* Create an authenticated server status route spec.
|
|
29
|
+
*
|
|
30
|
+
* Returns version and uptime. Unlike the public health check,
|
|
31
|
+
* this requires authentication.
|
|
32
|
+
*
|
|
33
|
+
* @param options - version and uptime source
|
|
34
|
+
* @returns route spec for `GET /api/server/status`
|
|
35
|
+
*/
|
|
36
|
+
export const create_server_status_route_spec = (options) => ({
|
|
37
|
+
method: 'GET',
|
|
38
|
+
path: '/api/server/status',
|
|
39
|
+
auth: { type: 'authenticated' },
|
|
40
|
+
handler: (c) => c.json({ version: options.version, uptime_ms: options.get_uptime_ms() }),
|
|
41
|
+
description: 'Server version and uptime',
|
|
42
|
+
input: z.null(),
|
|
43
|
+
output: z.looseObject({ version: z.string(), uptime_ms: z.number() }),
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* Create an authenticated route spec that serves the `AppSurface` as JSON.
|
|
47
|
+
*
|
|
48
|
+
* Surface data reveals API structure (routes, auth, schemas), so this
|
|
49
|
+
* requires authentication like the server status route.
|
|
50
|
+
*
|
|
51
|
+
* @param options - surface data source
|
|
52
|
+
* @returns route spec for `GET /api/surface`
|
|
53
|
+
*/
|
|
54
|
+
export const create_surface_route_spec = (options) => ({
|
|
55
|
+
method: 'GET',
|
|
56
|
+
path: '/api/surface',
|
|
57
|
+
auth: { type: 'authenticated' },
|
|
58
|
+
handler: (c) => c.json(options.surface),
|
|
59
|
+
description: 'Application surface (routes, middleware, schemas)',
|
|
60
|
+
input: z.null(),
|
|
61
|
+
output: z.looseObject({
|
|
62
|
+
routes: z.array(z.looseObject({})),
|
|
63
|
+
middleware: z.array(z.looseObject({})),
|
|
64
|
+
}),
|
|
65
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API route specs for database administration.
|
|
3
|
+
*
|
|
4
|
+
* Generic PostgreSQL table browser using `information_schema`.
|
|
5
|
+
* Provides: list tables, view columns/rows (paginated), delete rows by PK, health check.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type { Logger } from '@fuzdev/fuz_util/log.js';
|
|
10
|
+
import type { Db, DbType } from '../db/db.js';
|
|
11
|
+
import { type RouteSpec } from './route_spec.js';
|
|
12
|
+
/**
|
|
13
|
+
* Table metadata from `information_schema`.
|
|
14
|
+
*/
|
|
15
|
+
export interface TableInfo {
|
|
16
|
+
table_name: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Table info with row count.
|
|
20
|
+
*/
|
|
21
|
+
export interface TableWithCount {
|
|
22
|
+
name: string;
|
|
23
|
+
row_count: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Primary key constraint info.
|
|
27
|
+
*/
|
|
28
|
+
export interface PrimaryKeyInfo {
|
|
29
|
+
column_name: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Column metadata from `information_schema`.
|
|
33
|
+
*/
|
|
34
|
+
export interface ColumnInfo {
|
|
35
|
+
column_name: string;
|
|
36
|
+
data_type: string;
|
|
37
|
+
is_nullable: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Per-factory configuration for db routes.
|
|
41
|
+
*/
|
|
42
|
+
export interface DbRouteOptions {
|
|
43
|
+
db_type: DbType;
|
|
44
|
+
db_name: string;
|
|
45
|
+
/** Optional callback to provide app-specific stats in the health response. */
|
|
46
|
+
extra_stats?: (db: Db) => Promise<Record<string, unknown>>;
|
|
47
|
+
/** Optional logger for server-side diagnostics (e.g. FK violation details). */
|
|
48
|
+
log?: Logger;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Create the db API route specs.
|
|
52
|
+
*
|
|
53
|
+
* @param options - route configuration (db_type, db_name, extra_stats)
|
|
54
|
+
* @returns route specs for database administration
|
|
55
|
+
*/
|
|
56
|
+
export declare const create_db_route_specs: (options: DbRouteOptions) => Array<RouteSpec>;
|
|
57
|
+
//# sourceMappingURL=db_routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/db_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAC,EAAE,EAAE,MAAM,EAAC,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAmB,KAAK,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAWjE;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,UAAU,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,WAAW,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC3D,+EAA+E;IAC/E,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,SAAS,cAAc,KAAG,KAAK,CAAC,SAAS,CAqN9E,CAAC"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API route specs for database administration.
|
|
3
|
+
*
|
|
4
|
+
* Generic PostgreSQL table browser using `information_schema`.
|
|
5
|
+
* Provides: list tables, view columns/rows (paginated), delete rows by PK, health check.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
import { get_route_params } from './route_spec.js';
|
|
11
|
+
import { ApiError, ForeignKeyError, ERROR_TABLE_NOT_FOUND, ERROR_TABLE_NO_PRIMARY_KEY, ERROR_ROW_NOT_FOUND, ERROR_FOREIGN_KEY_VIOLATION, } from './error_schemas.js';
|
|
12
|
+
import { assert_valid_sql_identifier, VALID_SQL_IDENTIFIER } from '../db/sql_identifier.js';
|
|
13
|
+
/**
|
|
14
|
+
* Create the db API route specs.
|
|
15
|
+
*
|
|
16
|
+
* @param options - route configuration (db_type, db_name, extra_stats)
|
|
17
|
+
* @returns route specs for database administration
|
|
18
|
+
*/
|
|
19
|
+
export const create_db_route_specs = (options) => {
|
|
20
|
+
const { db_type, db_name, extra_stats, log } = options;
|
|
21
|
+
return [
|
|
22
|
+
{
|
|
23
|
+
method: 'GET',
|
|
24
|
+
path: '/health',
|
|
25
|
+
auth: { type: 'keeper' },
|
|
26
|
+
description: 'Database health and stats',
|
|
27
|
+
input: z.null(),
|
|
28
|
+
output: z.looseObject({ connected: z.boolean() }),
|
|
29
|
+
errors: { 503: ApiError },
|
|
30
|
+
handler: async (c, route) => {
|
|
31
|
+
try {
|
|
32
|
+
await route.db.query('SELECT 1');
|
|
33
|
+
const table_result = await route.db.query(`SELECT COUNT(*) as count FROM information_schema.tables WHERE table_schema = 'public'`);
|
|
34
|
+
const table_count = table_result[0] ? parseInt(table_result[0].count, 10) : 0;
|
|
35
|
+
const stats = extra_stats ? await extra_stats(route.db) : {};
|
|
36
|
+
return c.json({
|
|
37
|
+
connected: true,
|
|
38
|
+
type: db_type,
|
|
39
|
+
name: db_name,
|
|
40
|
+
table_count,
|
|
41
|
+
...stats,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
log?.error('Database health check failed:', err);
|
|
46
|
+
return c.json({
|
|
47
|
+
connected: false,
|
|
48
|
+
type: db_type,
|
|
49
|
+
error: 'database_connection_failed',
|
|
50
|
+
}, 503);
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
method: 'GET',
|
|
56
|
+
path: '/tables',
|
|
57
|
+
auth: { type: 'keeper' },
|
|
58
|
+
description: 'List public tables with row counts',
|
|
59
|
+
input: z.null(),
|
|
60
|
+
output: z.looseObject({ tables: z.array(z.object({ name: z.string(), row_count: z.number() })) }),
|
|
61
|
+
handler: async (c, route) => {
|
|
62
|
+
const table_names = await route.db.query(`SELECT table_name FROM information_schema.tables
|
|
63
|
+
WHERE table_schema = 'public'
|
|
64
|
+
ORDER BY table_name`);
|
|
65
|
+
const tables = [];
|
|
66
|
+
for (const { table_name } of table_names) {
|
|
67
|
+
// eslint-disable-next-line no-await-in-loop
|
|
68
|
+
const result = await route.db.query_one(`SELECT COUNT(*) as count FROM "${assert_valid_sql_identifier(table_name)}"`);
|
|
69
|
+
tables.push({
|
|
70
|
+
name: table_name,
|
|
71
|
+
row_count: result ? parseInt(result.count, 10) : 0,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return c.json({ tables });
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
method: 'GET',
|
|
79
|
+
path: '/tables/:name',
|
|
80
|
+
auth: { type: 'keeper' },
|
|
81
|
+
description: 'Get table columns and rows (paginated)',
|
|
82
|
+
params: z.strictObject({ name: z.string().regex(VALID_SQL_IDENTIFIER) }),
|
|
83
|
+
input: z.null(),
|
|
84
|
+
errors: { 404: z.looseObject({ error: z.literal(ERROR_TABLE_NOT_FOUND) }) },
|
|
85
|
+
output: z.looseObject({
|
|
86
|
+
columns: z.array(z.object({ column_name: z.string(), data_type: z.string(), is_nullable: z.string() })),
|
|
87
|
+
rows: z.array(z.record(z.string(), z.unknown())),
|
|
88
|
+
total: z.number(),
|
|
89
|
+
offset: z.number(),
|
|
90
|
+
limit: z.number(),
|
|
91
|
+
primary_key: z.string().nullable(),
|
|
92
|
+
}),
|
|
93
|
+
handler: async (c, route) => {
|
|
94
|
+
const { name } = get_route_params(c);
|
|
95
|
+
const offset = Math.max(0, parseInt(c.req.query('offset') ?? '0', 10) || 0);
|
|
96
|
+
const limit = Math.min(1000, Math.max(1, parseInt(c.req.query('limit') ?? '100', 10) || 100));
|
|
97
|
+
const exists = await route.db.query_one(`SELECT table_name FROM information_schema.tables
|
|
98
|
+
WHERE table_schema = 'public' AND table_name = $1`, [name]);
|
|
99
|
+
if (!exists) {
|
|
100
|
+
return c.json({ error: ERROR_TABLE_NOT_FOUND }, 404);
|
|
101
|
+
}
|
|
102
|
+
const columns = await route.db.query(`SELECT column_name, data_type, is_nullable
|
|
103
|
+
FROM information_schema.columns
|
|
104
|
+
WHERE table_schema = 'public' AND table_name = $1
|
|
105
|
+
ORDER BY ordinal_position`, [name]);
|
|
106
|
+
const count_result = await route.db.query_one(`SELECT COUNT(*) as count FROM "${assert_valid_sql_identifier(name)}"`);
|
|
107
|
+
const total = count_result ? parseInt(count_result.count, 10) : 0;
|
|
108
|
+
const pk_info = await route.db.query_one(`SELECT kcu.column_name
|
|
109
|
+
FROM information_schema.table_constraints tc
|
|
110
|
+
JOIN information_schema.key_column_usage kcu
|
|
111
|
+
ON tc.constraint_name = kcu.constraint_name
|
|
112
|
+
AND tc.table_schema = kcu.table_schema
|
|
113
|
+
WHERE tc.constraint_type = 'PRIMARY KEY'
|
|
114
|
+
AND tc.table_schema = 'public'
|
|
115
|
+
AND tc.table_name = $1
|
|
116
|
+
LIMIT 1`, [name]);
|
|
117
|
+
const primary_key = pk_info?.column_name ?? null;
|
|
118
|
+
const rows = await route.db.query(`SELECT * FROM "${assert_valid_sql_identifier(name)}" LIMIT $1 OFFSET $2`, [limit, offset]);
|
|
119
|
+
return c.json({ columns, rows, total, offset, limit, primary_key });
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
method: 'DELETE',
|
|
124
|
+
path: '/tables/:name/rows/:id',
|
|
125
|
+
auth: { type: 'keeper' },
|
|
126
|
+
description: 'Delete a row by primary key',
|
|
127
|
+
params: z.strictObject({
|
|
128
|
+
name: z.string().regex(VALID_SQL_IDENTIFIER),
|
|
129
|
+
id: z.string(),
|
|
130
|
+
}),
|
|
131
|
+
input: z.null(),
|
|
132
|
+
output: z.looseObject({ success: z.boolean() }),
|
|
133
|
+
errors: {
|
|
134
|
+
404: z.looseObject({
|
|
135
|
+
error: z.enum([ERROR_TABLE_NOT_FOUND, ERROR_ROW_NOT_FOUND]),
|
|
136
|
+
}),
|
|
137
|
+
409: ForeignKeyError,
|
|
138
|
+
},
|
|
139
|
+
handler: async (c, route) => {
|
|
140
|
+
const { name, id } = get_route_params(c);
|
|
141
|
+
const exists = await route.db.query_one(`SELECT table_name FROM information_schema.tables
|
|
142
|
+
WHERE table_schema = 'public' AND table_name = $1`, [name]);
|
|
143
|
+
if (!exists) {
|
|
144
|
+
return c.json({ error: ERROR_TABLE_NOT_FOUND }, 404);
|
|
145
|
+
}
|
|
146
|
+
const pk_info = await route.db.query_one(`SELECT kcu.column_name
|
|
147
|
+
FROM information_schema.table_constraints tc
|
|
148
|
+
JOIN information_schema.key_column_usage kcu
|
|
149
|
+
ON tc.constraint_name = kcu.constraint_name
|
|
150
|
+
AND tc.table_schema = kcu.table_schema
|
|
151
|
+
WHERE tc.constraint_type = 'PRIMARY KEY'
|
|
152
|
+
AND tc.table_schema = 'public'
|
|
153
|
+
AND tc.table_name = $1
|
|
154
|
+
LIMIT 1`, [name]);
|
|
155
|
+
if (!pk_info) {
|
|
156
|
+
return c.json({ error: ERROR_TABLE_NO_PRIMARY_KEY }, 400);
|
|
157
|
+
}
|
|
158
|
+
try {
|
|
159
|
+
const result = await route.db.query(`DELETE FROM "${assert_valid_sql_identifier(name)}" WHERE "${assert_valid_sql_identifier(pk_info.column_name)}" = $1 RETURNING *`, [id]);
|
|
160
|
+
if (result.length === 0) {
|
|
161
|
+
return c.json({ error: ERROR_ROW_NOT_FOUND }, 404);
|
|
162
|
+
}
|
|
163
|
+
return c.json({ success: true });
|
|
164
|
+
}
|
|
165
|
+
catch (err) {
|
|
166
|
+
if (err instanceof Error && 'code' in err && err.code === '23503') {
|
|
167
|
+
const pg_err = err;
|
|
168
|
+
log?.warn('Foreign key violation:', pg_err.detail, pg_err.constraint);
|
|
169
|
+
return c.json({ error: ERROR_FOREIGN_KEY_VIOLATION }, 409);
|
|
170
|
+
}
|
|
171
|
+
throw err;
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
];
|
|
176
|
+
};
|