@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,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base server environment schema and validation.
|
|
3
|
+
*
|
|
4
|
+
* Provides `BaseServerEnv` — a shared Zod schema for common server env vars
|
|
5
|
+
* that apps can use directly or extend with app-specific fields.
|
|
6
|
+
*
|
|
7
|
+
* Generic env loading lives in `env/load.ts`.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
import { create_validated_keyring } from '../auth/keyring.js';
|
|
13
|
+
import { parse_allowed_origins } from '../http/origin.js';
|
|
14
|
+
/**
|
|
15
|
+
* Base Zod schema for server environment variables.
|
|
16
|
+
*
|
|
17
|
+
* Provides the common fields used by fuz apps:
|
|
18
|
+
* server config, database, auth, security, public URLs, and SMTP.
|
|
19
|
+
*
|
|
20
|
+
* Apps can use directly or extend with app-specific fields via `.extend()`.
|
|
21
|
+
*/
|
|
22
|
+
export const BaseServerEnv = z.strictObject({
|
|
23
|
+
NODE_ENV: z.enum(['development', 'production']).meta({ description: 'Runtime environment mode' }),
|
|
24
|
+
PORT: z.coerce.number().default(4040).meta({ description: 'HTTP server port' }),
|
|
25
|
+
HOST: z.string().default('localhost').meta({ description: 'HTTP server bind address' }),
|
|
26
|
+
DATABASE_URL: z.string().min(1).meta({
|
|
27
|
+
description: 'Database URL (postgres://, file://, or memory://)',
|
|
28
|
+
sensitivity: 'secret',
|
|
29
|
+
}),
|
|
30
|
+
SECRET_COOKIE_KEYS: z.string().min(32).meta({
|
|
31
|
+
description: 'Cookie signing keys, separated by __ for rotation',
|
|
32
|
+
sensitivity: 'secret',
|
|
33
|
+
}),
|
|
34
|
+
ALLOWED_ORIGINS: z.string().min(1, 'ALLOWED_ORIGINS is required').meta({
|
|
35
|
+
description: 'Comma-separated origin patterns for API verification',
|
|
36
|
+
}),
|
|
37
|
+
PUBLIC_API_URL: z.string().default('/api').meta({ description: 'Public API base URL' }),
|
|
38
|
+
PUBLIC_WEBSOCKET_URL: z.string().optional().meta({ description: 'Public WebSocket URL' }),
|
|
39
|
+
PUBLIC_CONTACT_EMAIL: z
|
|
40
|
+
.union([z.email(), z.literal('')])
|
|
41
|
+
.optional()
|
|
42
|
+
.meta({ description: 'Public contact email address' }),
|
|
43
|
+
BOOTSTRAP_TOKEN_PATH: z
|
|
44
|
+
.string()
|
|
45
|
+
.optional()
|
|
46
|
+
.meta({ description: 'Path to one-shot admin bootstrap token', sensitivity: 'secret' }),
|
|
47
|
+
SMTP_HOST: z.string().optional().meta({ description: 'SMTP server hostname' }),
|
|
48
|
+
SMTP_USER: z
|
|
49
|
+
.union([z.email(), z.literal('')])
|
|
50
|
+
.optional()
|
|
51
|
+
.meta({ description: 'SMTP authentication username' }),
|
|
52
|
+
SMTP_PASSWORD: z
|
|
53
|
+
.string()
|
|
54
|
+
.optional()
|
|
55
|
+
.meta({ description: 'SMTP authentication password', sensitivity: 'secret' }),
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* Validate a loaded `BaseServerEnv` and produce the artifacts needed for server init.
|
|
59
|
+
*
|
|
60
|
+
* Handles keyring validation, origin parsing, and bootstrap token path extraction.
|
|
61
|
+
* Returns a Result so callers handle errors their own way (exit, logging, etc).
|
|
62
|
+
*
|
|
63
|
+
* @param env - a loaded and Zod-validated `BaseServerEnv`
|
|
64
|
+
* @returns `{ok: true, keyring, allowed_origins, bootstrap_token_path}` or `{ok: false, field, errors}`
|
|
65
|
+
*/
|
|
66
|
+
export const validate_server_env = (env) => {
|
|
67
|
+
const keyring_result = create_validated_keyring(env.SECRET_COOKIE_KEYS);
|
|
68
|
+
if (!keyring_result.ok) {
|
|
69
|
+
return { ok: false, field: 'SECRET_COOKIE_KEYS', errors: keyring_result.errors };
|
|
70
|
+
}
|
|
71
|
+
let allowed_origins;
|
|
72
|
+
try {
|
|
73
|
+
allowed_origins = parse_allowed_origins(env.ALLOWED_ORIGINS);
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
return {
|
|
77
|
+
ok: false,
|
|
78
|
+
field: 'ALLOWED_ORIGINS',
|
|
79
|
+
errors: [err instanceof Error ? err.message : 'Invalid ALLOWED_ORIGINS'],
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
if (allowed_origins.length === 0) {
|
|
83
|
+
return {
|
|
84
|
+
ok: false,
|
|
85
|
+
field: 'ALLOWED_ORIGINS',
|
|
86
|
+
errors: ['ALLOWED_ORIGINS contains no valid patterns'],
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
ok: true,
|
|
91
|
+
keyring: keyring_result.keyring,
|
|
92
|
+
allowed_origins,
|
|
93
|
+
bootstrap_token_path: env.BOOTSTRAP_TOKEN_PATH ?? null,
|
|
94
|
+
};
|
|
95
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composable startup summary helpers.
|
|
3
|
+
*
|
|
4
|
+
* Logs a human-readable summary from an `AppSurface`.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import type { Logger } from '@fuzdev/fuz_util/log.js';
|
|
9
|
+
import type { AppSurface } from '../http/surface.js';
|
|
10
|
+
/**
|
|
11
|
+
* Log a startup summary from an `AppSurface`.
|
|
12
|
+
*
|
|
13
|
+
* Logs route count, middleware count, env breakdown (when non-empty),
|
|
14
|
+
* and event/channel counts (when non-empty). When `env_values` is provided,
|
|
15
|
+
* non-secret values are logged and secrets are masked with `***`.
|
|
16
|
+
*
|
|
17
|
+
* @param surface - the app surface to summarize
|
|
18
|
+
* @param log - the logger instance
|
|
19
|
+
* @param env_values - optional env values to log (secrets are masked)
|
|
20
|
+
*/
|
|
21
|
+
export declare const log_startup_summary: (surface: AppSurface, log: Logger, env_values?: Record<string, unknown>) => void;
|
|
22
|
+
//# sourceMappingURL=startup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startup.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/startup.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAGpD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAEnD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,GAC/B,SAAS,UAAU,EACnB,KAAK,MAAM,EACX,aAAa,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAClC,IAqCF,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composable startup summary helpers.
|
|
3
|
+
*
|
|
4
|
+
* Logs a human-readable summary from an `AppSurface`.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import { format_env_display_value } from '../env/mask.js';
|
|
9
|
+
/**
|
|
10
|
+
* Log a startup summary from an `AppSurface`.
|
|
11
|
+
*
|
|
12
|
+
* Logs route count, middleware count, env breakdown (when non-empty),
|
|
13
|
+
* and event/channel counts (when non-empty). When `env_values` is provided,
|
|
14
|
+
* non-secret values are logged and secrets are masked with `***`.
|
|
15
|
+
*
|
|
16
|
+
* @param surface - the app surface to summarize
|
|
17
|
+
* @param log - the logger instance
|
|
18
|
+
* @param env_values - optional env values to log (secrets are masked)
|
|
19
|
+
*/
|
|
20
|
+
export const log_startup_summary = (surface, log, env_values) => {
|
|
21
|
+
log.info(`Surface: ${surface.routes.length} routes, ${surface.middleware.length} middleware layers`);
|
|
22
|
+
if (surface.env.length) {
|
|
23
|
+
const required = surface.env.filter((e) => !e.optional);
|
|
24
|
+
const secret = surface.env.filter((e) => e.sensitivity === 'secret');
|
|
25
|
+
log.info(`Env: ${surface.env.length} vars (${required.length} required, ${secret.length} secret)`);
|
|
26
|
+
if (env_values) {
|
|
27
|
+
for (const entry of surface.env) {
|
|
28
|
+
const value = env_values[entry.name];
|
|
29
|
+
if (value === undefined)
|
|
30
|
+
continue;
|
|
31
|
+
log.info(` ${entry.name}=${format_env_display_value(value, entry.sensitivity === 'secret')}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (surface.events.length) {
|
|
36
|
+
const channels = new Set(surface.events.map((e) => e.channel).filter(Boolean));
|
|
37
|
+
log.info(`Events: ${surface.events.length} types, ${channels.size} channels`);
|
|
38
|
+
}
|
|
39
|
+
if (surface.diagnostics.length) {
|
|
40
|
+
const warnings = surface.diagnostics.filter((d) => d.level === 'warning');
|
|
41
|
+
if (warnings.length) {
|
|
42
|
+
log.warn(`Diagnostics: ${warnings.length} warning(s)`);
|
|
43
|
+
for (const d of warnings) {
|
|
44
|
+
log.warn(` [${d.category}] ${d.message}${d.source ? ` (${d.source})` : ''}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static file serving middleware for SvelteKit static builds.
|
|
3
|
+
*
|
|
4
|
+
* Provides multi-phase static serving:
|
|
5
|
+
* - Phase 1: Exact path match (handles /, assets, images)
|
|
6
|
+
* - Phase 2: `.html` fallback for clean URLs (`/about` → `/about.html`)
|
|
7
|
+
* - Phase 3 (optional): SPA fallback for client-side routes
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import type { MiddlewareHandler } from 'hono';
|
|
12
|
+
/**
|
|
13
|
+
* Options for `serve_static` factory functions (matches Hono's `serveStatic` signature).
|
|
14
|
+
*/
|
|
15
|
+
export interface ServeStaticOptions {
|
|
16
|
+
root: string;
|
|
17
|
+
rewriteRequestPath?: (path: string) => string;
|
|
18
|
+
mimes?: Record<string, string>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Factory function that creates a static file serving middleware.
|
|
22
|
+
*
|
|
23
|
+
* Matches the signature of `serveStatic` from `hono/deno` and `@hono/node-server/serve-static`.
|
|
24
|
+
*/
|
|
25
|
+
export type ServeStaticFactory = (options: ServeStaticOptions) => MiddlewareHandler;
|
|
26
|
+
/**
|
|
27
|
+
* Create static file serving middleware for SvelteKit static builds.
|
|
28
|
+
*
|
|
29
|
+
* Returns an array of middleware handlers to register on `'/*'`.
|
|
30
|
+
*
|
|
31
|
+
* @param serve_static - runtime-specific `serveStatic` factory
|
|
32
|
+
* @param options - optional root directory and SPA fallback path
|
|
33
|
+
* @returns array of middleware handlers to apply in order
|
|
34
|
+
*/
|
|
35
|
+
export declare const create_static_middleware: (serve_static: ServeStaticFactory, options?: {
|
|
36
|
+
root?: string;
|
|
37
|
+
spa_fallback?: string;
|
|
38
|
+
}) => Array<MiddlewareHandler>;
|
|
39
|
+
//# sourceMappingURL=static.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/static.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,MAAM,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,kBAAkB,KAAK,iBAAiB,CAAC;AAEpF;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,GACpC,cAAc,kBAAkB,EAChC,UAAU;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAC,KAC9C,KAAK,CAAC,iBAAiB,CAqBzB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static file serving middleware for SvelteKit static builds.
|
|
3
|
+
*
|
|
4
|
+
* Provides multi-phase static serving:
|
|
5
|
+
* - Phase 1: Exact path match (handles /, assets, images)
|
|
6
|
+
* - Phase 2: `.html` fallback for clean URLs (`/about` → `/about.html`)
|
|
7
|
+
* - Phase 3 (optional): SPA fallback for client-side routes
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Create static file serving middleware for SvelteKit static builds.
|
|
13
|
+
*
|
|
14
|
+
* Returns an array of middleware handlers to register on `'/*'`.
|
|
15
|
+
*
|
|
16
|
+
* @param serve_static - runtime-specific `serveStatic` factory
|
|
17
|
+
* @param options - optional root directory and SPA fallback path
|
|
18
|
+
* @returns array of middleware handlers to apply in order
|
|
19
|
+
*/
|
|
20
|
+
export const create_static_middleware = (serve_static, options) => {
|
|
21
|
+
const root = options?.root ?? './build';
|
|
22
|
+
const handlers = [];
|
|
23
|
+
// Phase 1: exact path match
|
|
24
|
+
handlers.push(serve_static({ root }));
|
|
25
|
+
// Phase 2: .html fallback for clean URLs (/about → /about.html)
|
|
26
|
+
handlers.push(async (c, next) => {
|
|
27
|
+
const path = c.req.path;
|
|
28
|
+
if (path === '/' || path.includes('.'))
|
|
29
|
+
return next();
|
|
30
|
+
return serve_static({ root, rewriteRequestPath: () => `${path}.html` })(c, next);
|
|
31
|
+
});
|
|
32
|
+
// Phase 3: optional SPA fallback for client-side routes
|
|
33
|
+
if (options?.spa_fallback) {
|
|
34
|
+
const fallback = options.spa_fallback;
|
|
35
|
+
handlers.push(serve_static({ root, rewriteRequestPath: () => fallback }));
|
|
36
|
+
}
|
|
37
|
+
return handlers;
|
|
38
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* String-based nginx config validator for fuz_app deploy configs.
|
|
3
|
+
*
|
|
4
|
+
* Checks consumer `NGINX_CONFIG` template strings for required security
|
|
5
|
+
* properties. This is pattern matching on template strings, not a real
|
|
6
|
+
* nginx parser — it catches common security omissions but won't catch
|
|
7
|
+
* all possible misconfigurations.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Result of validating an nginx config template string.
|
|
13
|
+
*/
|
|
14
|
+
export interface NginxValidationResult {
|
|
15
|
+
ok: boolean;
|
|
16
|
+
warnings: Array<string>;
|
|
17
|
+
errors: Array<string>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Validate an nginx config template string for security properties.
|
|
21
|
+
*
|
|
22
|
+
* Checks for required security headers, Authorization stripping in `/api`
|
|
23
|
+
* blocks, and the nginx `add_header` inheritance gotcha. Designed for
|
|
24
|
+
* fuz_app consumer deploy configs (tx.ts `NGINX_CONFIG` constants).
|
|
25
|
+
*
|
|
26
|
+
* Limitations: string pattern matching, not a real nginx parser. Catches
|
|
27
|
+
* common omissions in fuz_app deploy configs but won't catch all possible
|
|
28
|
+
* misconfigurations.
|
|
29
|
+
*
|
|
30
|
+
* @param config - nginx config template string
|
|
31
|
+
* @returns validation result with ok status, warnings, and errors
|
|
32
|
+
*/
|
|
33
|
+
export declare const validate_nginx_config: (config: string) => NginxValidationResult;
|
|
34
|
+
//# sourceMappingURL=validate_nginx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate_nginx.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/validate_nginx.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC,EAAE,EAAE,OAAO,CAAC;IACZ,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACtB;AAgCD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,GAAI,QAAQ,MAAM,KAAG,qBA2FtD,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* String-based nginx config validator for fuz_app deploy configs.
|
|
3
|
+
*
|
|
4
|
+
* Checks consumer `NGINX_CONFIG` template strings for required security
|
|
5
|
+
* properties. This is pattern matching on template strings, not a real
|
|
6
|
+
* nginx parser — it catches common security omissions but won't catch
|
|
7
|
+
* all possible misconfigurations.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Extract location blocks from an nginx config string.
|
|
13
|
+
*
|
|
14
|
+
* Finds `location [= ] <path> {` directives and extracts the full block
|
|
15
|
+
* content including nested braces. Returns the path and full block text.
|
|
16
|
+
*/
|
|
17
|
+
const extract_location_blocks = (config) => {
|
|
18
|
+
const blocks = [];
|
|
19
|
+
const location_regex = /location\s+(?:=\s+)?(\S+)\s*\{/g;
|
|
20
|
+
let match;
|
|
21
|
+
while ((match = location_regex.exec(config)) !== null) {
|
|
22
|
+
const path = match[1];
|
|
23
|
+
const open_brace_index = match.index + match[0].length - 1;
|
|
24
|
+
let depth = 1;
|
|
25
|
+
let block_end = open_brace_index + 1;
|
|
26
|
+
for (let i = open_brace_index + 1; i < config.length; i++) {
|
|
27
|
+
if (config[i] === '{')
|
|
28
|
+
depth++;
|
|
29
|
+
else if (config[i] === '}') {
|
|
30
|
+
depth--;
|
|
31
|
+
if (depth === 0) {
|
|
32
|
+
block_end = i + 1;
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
blocks.push({ path, content: config.slice(match.index, block_end) });
|
|
38
|
+
}
|
|
39
|
+
return blocks;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Validate an nginx config template string for security properties.
|
|
43
|
+
*
|
|
44
|
+
* Checks for required security headers, Authorization stripping in `/api`
|
|
45
|
+
* blocks, and the nginx `add_header` inheritance gotcha. Designed for
|
|
46
|
+
* fuz_app consumer deploy configs (tx.ts `NGINX_CONFIG` constants).
|
|
47
|
+
*
|
|
48
|
+
* Limitations: string pattern matching, not a real nginx parser. Catches
|
|
49
|
+
* common omissions in fuz_app deploy configs but won't catch all possible
|
|
50
|
+
* misconfigurations.
|
|
51
|
+
*
|
|
52
|
+
* @param config - nginx config template string
|
|
53
|
+
* @returns validation result with ok status, warnings, and errors
|
|
54
|
+
*/
|
|
55
|
+
export const validate_nginx_config = (config) => {
|
|
56
|
+
const errors = [];
|
|
57
|
+
const warnings = [];
|
|
58
|
+
const all_blocks = extract_location_blocks(config);
|
|
59
|
+
// 1. proxy_set_header Authorization "" in /api location blocks
|
|
60
|
+
const api_blocks = all_blocks.filter((b) => b.path === '/api' || b.path.startsWith('/api/') || b.path.startsWith('/api{'));
|
|
61
|
+
if (api_blocks.length > 0) {
|
|
62
|
+
const has_auth_strip = api_blocks.some((block) => block.content.includes('proxy_set_header Authorization ""') ||
|
|
63
|
+
block.content.includes("proxy_set_header Authorization ''"));
|
|
64
|
+
if (!has_auth_strip) {
|
|
65
|
+
errors.push('Missing `proxy_set_header Authorization ""` in /api location block — ' +
|
|
66
|
+
'required for v1 cookie-only external auth posture');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// 2. Strict-Transport-Security (error if missing)
|
|
70
|
+
if (!config.includes('Strict-Transport-Security')) {
|
|
71
|
+
errors.push('Missing Strict-Transport-Security header');
|
|
72
|
+
}
|
|
73
|
+
// 3. X-Content-Type-Options "nosniff" (warning if missing)
|
|
74
|
+
if (!config.includes('X-Content-Type-Options')) {
|
|
75
|
+
warnings.push('Missing X-Content-Type-Options "nosniff" header');
|
|
76
|
+
}
|
|
77
|
+
// 4. X-Frame-Options (warning if missing)
|
|
78
|
+
if (!config.includes('X-Frame-Options')) {
|
|
79
|
+
warnings.push('Missing X-Frame-Options header');
|
|
80
|
+
}
|
|
81
|
+
// 5. Referrer-Policy (warning if missing)
|
|
82
|
+
if (!config.includes('Referrer-Policy')) {
|
|
83
|
+
warnings.push('Missing Referrer-Policy header');
|
|
84
|
+
}
|
|
85
|
+
// 6. server_tokens off (warning if missing)
|
|
86
|
+
if (!config.includes('server_tokens off')) {
|
|
87
|
+
warnings.push('Missing server_tokens off — nginx version may be disclosed');
|
|
88
|
+
}
|
|
89
|
+
// 7. limit_req (warning if missing — may be in a separate rate_limit.conf)
|
|
90
|
+
if (!config.includes('limit_req')) {
|
|
91
|
+
warnings.push('Missing limit_req — may be in a separate rate_limit.conf. ' +
|
|
92
|
+
'Consider adding nginx-level rate limiting');
|
|
93
|
+
}
|
|
94
|
+
// 8. X-Forwarded-For: prefer $remote_addr over $proxy_add_x_forwarded_for
|
|
95
|
+
if (config.includes('$proxy_add_x_forwarded_for')) {
|
|
96
|
+
warnings.push('Using $proxy_add_x_forwarded_for — prefer $remote_addr for single-proxy setups ' +
|
|
97
|
+
'to avoid client-injected XFF headers');
|
|
98
|
+
}
|
|
99
|
+
// 9. Child location blocks with add_header must repeat security headers
|
|
100
|
+
for (const block of all_blocks) {
|
|
101
|
+
if (block.content.includes('add_header') &&
|
|
102
|
+
!block.content.includes('Strict-Transport-Security')) {
|
|
103
|
+
// Only flag child locations that add their own response headers
|
|
104
|
+
// (Cache-Control, Content-Disposition, etc.) — these override
|
|
105
|
+
// inherited headers from the parent server block
|
|
106
|
+
if (block.content.includes('Cache-Control') ||
|
|
107
|
+
block.content.includes('Content-Disposition')) {
|
|
108
|
+
warnings.push(`Location ${block.path} has add_header but is missing Strict-Transport-Security — ` +
|
|
109
|
+
'nginx add_header in child blocks replaces (not extends) inherited headers');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
ok: errors.length === 0,
|
|
115
|
+
warnings,
|
|
116
|
+
errors,
|
|
117
|
+
};
|
|
118
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
# testing/
|
|
2
|
+
|
|
3
|
+
Every module in this directory starts with `import './assert_dev_env.js';` as its first line. This side-effect import throws at runtime if `DEV` (from `esm-env`) is false, preventing accidental inclusion in production bundles. Always add this import as the first line when creating new testing modules.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import './assert_dev_env.js';
|
|
2
|
+
import type { SessionOptions } from '../auth/session_cookie.js';
|
|
3
|
+
import type { AppServerContext, AppServerOptions } from '../server/app_server.js';
|
|
4
|
+
import type { RouteSpec } from '../http/route_spec.js';
|
|
5
|
+
import { type RoleSchemaResult } from '../auth/role_schema.js';
|
|
6
|
+
import { type DbFactory } from './db.js';
|
|
7
|
+
/**
|
|
8
|
+
* Configuration for `describe_standard_admin_integration_tests`.
|
|
9
|
+
*/
|
|
10
|
+
export interface StandardAdminIntegrationTestOptions {
|
|
11
|
+
/** Session config for cookie-based auth. */
|
|
12
|
+
session_options: SessionOptions<string>;
|
|
13
|
+
/** Route spec factory — same one used in production. */
|
|
14
|
+
create_route_specs: (ctx: AppServerContext) => Array<RouteSpec>;
|
|
15
|
+
/** Role schema result from `create_role_schema()` — used to determine valid/invalid/web-grantable roles. */
|
|
16
|
+
roles: RoleSchemaResult;
|
|
17
|
+
/**
|
|
18
|
+
* Path prefix where admin routes are mounted (e.g., `'/api/admin'`).
|
|
19
|
+
* Used by the schema validation test to scope to fuz_app admin routes only,
|
|
20
|
+
* avoiding app-specific admin-gated routes that may use stub deps.
|
|
21
|
+
* Default `'/api/admin'`.
|
|
22
|
+
*/
|
|
23
|
+
admin_prefix?: string;
|
|
24
|
+
/** Optional overrides for `AppServerOptions`. */
|
|
25
|
+
app_options?: Partial<Omit<AppServerOptions, 'backend' | 'session_options' | 'create_route_specs'>>;
|
|
26
|
+
/**
|
|
27
|
+
* Database factories to run tests against. Default: pglite only.
|
|
28
|
+
* Pass consumer factories (e.g. `[pglite_factory, pg_factory]`) to also test against PostgreSQL.
|
|
29
|
+
*/
|
|
30
|
+
db_factories?: Array<DbFactory>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Standard admin integration test suite for fuz_app admin routes.
|
|
34
|
+
*
|
|
35
|
+
* Exercises account listing, permit grant/revoke, session management, token
|
|
36
|
+
* management, audit log routes, admin-to-admin isolation, and response
|
|
37
|
+
* schema validation.
|
|
38
|
+
*
|
|
39
|
+
* Each test group asserts that required routes exist, failing with a descriptive
|
|
40
|
+
* message if the consumer's route specs are misconfigured.
|
|
41
|
+
*
|
|
42
|
+
* @param options - session config, route factory, and role schema
|
|
43
|
+
*/
|
|
44
|
+
export declare const describe_standard_admin_integration_tests: (options: StandardAdminIntegrationTestOptions) => void;
|
|
45
|
+
//# sourceMappingURL=admin_integration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin_integration.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/admin_integration.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAiB7B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAC,gBAAgB,EAAE,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAChF,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAA0B,KAAK,gBAAgB,EAAC,MAAM,wBAAwB,CAAC;AAGtF,OAAO,EAIN,KAAK,SAAS,EACd,MAAM,SAAS,CAAC;AAUjB;;GAEG;AACH,MAAM,WAAW,mCAAmC;IACnD,4CAA4C;IAC5C,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,wDAAwD;IACxD,kBAAkB,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAChE,4GAA4G;IAC5G,KAAK,EAAE,gBAAgB,CAAC;IACxB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iDAAiD;IACjD,WAAW,CAAC,EAAE,OAAO,CACpB,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,iBAAiB,GAAG,oBAAoB,CAAC,CAC5E,CAAC;IACF;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;CAChC;AAgDD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,yCAAyC,GACrD,SAAS,mCAAmC,KAC1C,IAomCF,CAAC"}
|