@fuzdev/fuz_app 0.163.0 → 0.165.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/README.md +2 -1
- package/dist/actions/action_event_data.d.ts +1 -1
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +4 -0
- package/dist/actions/action_spec.d.ts +3 -3
- package/dist/actions/action_spec.d.ts.map +1 -1
- package/dist/auth/CLAUDE.md +1 -1
- package/dist/auth/account_route_schema.d.ts +3 -27
- package/dist/auth/account_route_schema.d.ts.map +1 -1
- package/dist/auth/account_route_schema.js +6 -20
- package/dist/auth/admin_action_specs.d.ts +56 -56
- package/dist/auth/audit_log_route_schema.d.ts +1 -1
- package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_route_schema.js +4 -5
- package/dist/auth/audit_log_schema.d.ts +18 -18
- package/dist/auth/bootstrap_route_schema.d.ts +1 -30
- package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
- package/dist/auth/bootstrap_route_schema.js +3 -8
- package/dist/auth/daemon_token.d.ts +4 -4
- package/dist/auth/daemon_token.d.ts.map +1 -1
- package/dist/auth/daemon_token.js +3 -3
- package/dist/auth/daemon_token_middleware.d.ts +1 -1
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +5 -5
- package/dist/auth/middleware.js +4 -4
- package/dist/auth/role_grant_offer_action_specs.d.ts +2 -2
- package/dist/auth/signup_route_schema.d.ts.map +1 -1
- package/dist/auth/signup_route_schema.js +3 -7
- package/dist/db/CLAUDE.md +2 -1
- package/dist/db/file_fact_url.d.ts +11 -6
- package/dist/db/file_fact_url.d.ts.map +1 -1
- package/dist/db/file_fact_url.js +5 -5
- package/dist/db/schema_ready.d.ts +0 -5
- package/dist/db/schema_ready.d.ts.map +1 -1
- package/dist/db/schema_ready.js +0 -5
- package/dist/http/CLAUDE.md +105 -71
- package/dist/http/auth_shape.d.ts +48 -29
- package/dist/http/auth_shape.d.ts.map +1 -1
- package/dist/http/auth_shape.js +12 -85
- package/dist/http/body_limit.d.ts +12 -0
- package/dist/http/body_limit.d.ts.map +1 -1
- package/dist/http/body_limit.js +15 -0
- package/dist/http/body_limit_schema.d.ts +20 -0
- package/dist/http/body_limit_schema.d.ts.map +1 -0
- package/dist/http/body_limit_schema.js +20 -0
- package/dist/http/common_routes.d.ts +1 -1
- package/dist/http/common_routes.d.ts.map +1 -1
- package/dist/http/common_routes.js +11 -14
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/http/db_routes.js +59 -69
- package/dist/http/dev_route_error_check.d.ts +70 -0
- package/dist/http/dev_route_error_check.d.ts.map +1 -0
- package/dist/http/dev_route_error_check.js +119 -0
- package/dist/http/error_schemas.d.ts +365 -189
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +256 -149
- package/dist/http/health_schema.d.ts +10 -6
- package/dist/http/health_schema.d.ts.map +1 -1
- package/dist/http/health_schema.js +3 -3
- package/dist/http/middleware_spec.d.ts +8 -3
- package/dist/http/middleware_spec.d.ts.map +1 -1
- package/dist/http/origin.d.ts +12 -43
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +10 -6
- package/dist/http/route_error_check.d.ts +179 -0
- package/dist/http/route_error_check.d.ts.map +1 -0
- package/dist/http/route_error_check.js +283 -0
- package/dist/http/route_errors.d.ts +80 -0
- package/dist/http/route_errors.d.ts.map +1 -0
- package/dist/http/route_errors.js +83 -0
- package/dist/http/route_spec.d.ts +33 -17
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +48 -62
- package/dist/http/schema_helpers.d.ts +15 -34
- package/dist/http/schema_helpers.d.ts.map +1 -1
- package/dist/http/schema_helpers.js +11 -47
- package/dist/http/surface.d.ts +19 -12
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface.js +25 -38
- package/dist/http/surface_query.d.ts +11 -2
- package/dist/http/surface_query.d.ts.map +1 -1
- package/dist/http/surface_query.js +7 -1
- package/dist/primitive_schemas_fuz.d.ts +17 -3
- package/dist/primitive_schemas_fuz.d.ts.map +1 -1
- package/dist/primitive_schemas_fuz.js +13 -3
- package/dist/rate_limiter.d.ts +13 -0
- package/dist/rate_limiter.d.ts.map +1 -1
- package/dist/rate_limiter.js +20 -2
- package/dist/schema_issues.d.ts +29 -11
- package/dist/schema_issues.d.ts.map +1 -1
- package/dist/schema_issues.js +11 -10
- package/dist/schema_meta.d.ts +8 -1
- package/dist/schema_meta.d.ts.map +1 -1
- package/dist/schema_meta.js +2 -1
- package/dist/server/app_server.d.ts +3 -1
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +24 -10
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +8 -31
- package/dist/server/surface_route.d.ts.map +1 -1
- package/dist/server/surface_route.js +5 -6
- package/dist/server/x_accel.d.ts +12 -7
- package/dist/server/x_accel.d.ts.map +1 -1
- package/dist/server/x_accel.js +7 -9
- package/dist/testing/CLAUDE.md +105 -61
- package/dist/testing/admin_integration.js +2 -2
- package/dist/testing/adversarial_404.d.ts +4 -18
- package/dist/testing/adversarial_404.d.ts.map +1 -1
- package/dist/testing/adversarial_404.js +20 -52
- package/dist/testing/adversarial_headers.d.ts +3 -4
- package/dist/testing/adversarial_headers.d.ts.map +1 -1
- package/dist/testing/adversarial_headers.js +8 -6
- package/dist/testing/adversarial_input.d.ts.map +1 -1
- package/dist/testing/adversarial_input.js +20 -19
- package/dist/testing/assertions.d.ts +46 -14
- package/dist/testing/assertions.d.ts.map +1 -1
- package/dist/testing/assertions.js +73 -16
- package/dist/testing/attack_surface.d.ts +17 -35
- package/dist/testing/attack_surface.d.ts.map +1 -1
- package/dist/testing/attack_surface.js +36 -95
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +2 -1
- package/dist/testing/cross_backend/action_manifest.d.ts +126 -56
- package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest.js +11 -11
- package/dist/testing/cross_backend/action_manifest_parity.d.ts +1 -1
- package/dist/testing/cross_backend/action_manifest_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_crud.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_crud.js +2 -1
- package/dist/testing/cross_backend/conformance_table.js +1 -1
- package/dist/testing/cross_backend/fact_serving.js +3 -3
- package/dist/testing/cross_backend/in_process_setup.d.ts +7 -3
- package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/in_process_setup.js +11 -4
- package/dist/testing/cross_backend/origin_conformance.d.ts +278 -102
- package/dist/testing/cross_backend/origin_conformance.d.ts.map +1 -1
- package/dist/testing/cross_backend/origin_conformance.js +21 -21
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.js +7 -1
- package/dist/testing/cross_backend/setup.d.ts +13 -0
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +24 -7
- package/dist/testing/cross_backend/spine_suites.d.ts +3 -2
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +5 -2
- package/dist/testing/cross_backend/standard.d.ts +31 -0
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/standard.js +9 -3
- package/dist/testing/cross_backend/testing_origin_check.d.ts +147 -71
- package/dist/testing/cross_backend/testing_origin_check.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_origin_check.js +16 -13
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +70 -27
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/data_exposure.d.ts +7 -0
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +8 -7
- package/dist/testing/error_coverage.d.ts +53 -61
- package/dist/testing/error_coverage.d.ts.map +1 -1
- package/dist/testing/error_coverage.js +86 -119
- package/dist/testing/integration.d.ts +28 -1
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +54 -29
- package/dist/testing/integration_helpers.d.ts +37 -9
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +75 -40
- package/dist/testing/middleware.d.ts +3 -5
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +5 -4
- package/dist/testing/middleware_gate_probes.d.ts +90 -0
- package/dist/testing/middleware_gate_probes.d.ts.map +1 -0
- package/dist/testing/middleware_gate_probes.js +179 -0
- package/dist/testing/rate_limiting.d.ts +1 -1
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +5 -4
- package/dist/testing/round_trip.d.ts +7 -0
- package/dist/testing/round_trip.d.ts.map +1 -1
- package/dist/testing/round_trip.js +8 -5
- package/dist/testing/schema_generators.d.ts +40 -11
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +71 -17
- package/dist/testing/stubs.d.ts +10 -1
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +15 -5
- package/dist/testing/surface_invariants.d.ts +36 -115
- package/dist/testing/surface_invariants.d.ts.map +1 -1
- package/dist/testing/surface_invariants.js +106 -269
- package/dist/testing/transports/raw_http.d.ts +10 -2
- package/dist/testing/transports/raw_http.d.ts.map +1 -1
- package/dist/testing/transports/raw_http.js +10 -4
- package/dist/ui/CLAUDE.md +4 -2
- package/dist/ui/auth_state.svelte.d.ts.map +1 -1
- package/dist/ui/auth_state.svelte.js +2 -8
- package/dist/ui/backend_probe.svelte.js +3 -3
- package/dist/ui/table_state.svelte.d.ts.map +1 -1
- package/dist/ui/table_state.svelte.js +1 -8
- package/dist/ui/ui_fetch.d.ts +12 -2
- package/dist/ui/ui_fetch.d.ts.map +1 -1
- package/dist/ui/ui_fetch.js +22 -4
- package/package.json +1 -1
package/dist/schema_meta.d.ts
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* `invalid_reason` and `empty_input_handler_guarded` to fuz_schema's
|
|
9
9
|
* `SchemaMeta`, so the declared refusal reason of an action input, its
|
|
10
10
|
* handler-guarded marker, and its sensitivity read the same whichever library
|
|
11
|
-
* its schema is.
|
|
11
|
+
* its schema is. It also adds JSON Schema's `readOnly` annotation, which
|
|
12
|
+
* `to_json_schema` writes onto the node.
|
|
12
13
|
*
|
|
13
14
|
* @module
|
|
14
15
|
*/
|
|
@@ -31,6 +32,12 @@ declare module '@fuzdev/fuz_schema/meta.ts' {
|
|
|
31
32
|
* (`get_meta`), so a wrapper around it drops it, as in Zod.
|
|
32
33
|
*/
|
|
33
34
|
empty_input_handler_guarded?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* JSON Schema's `readOnly` annotation, which `to_json_schema` copies onto
|
|
37
|
+
* the node: written on the role and credential-type lists of the 403
|
|
38
|
+
* bodies (`http/error_schemas.ts`).
|
|
39
|
+
*/
|
|
40
|
+
readOnly?: boolean;
|
|
34
41
|
}
|
|
35
42
|
}
|
|
36
43
|
/** Zod `.meta()` shape for fuz_app schema metadata conventions. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema_meta.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/schema_meta.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"schema_meta.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/schema_meta.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAU7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAGN,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,QAAQ,4BA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H,eAAO,MAAM,6BAA6B,GACzC,cAAc,gBAAgB,EAC9B,QAAQ,aAAa,CAAC,QAAQ,CAAC,EAC/B,OAAO,OAAO,KACZ,MAAM,GAAG,SAKX,CAAC"}
|
package/dist/schema_meta.js
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* `invalid_reason` and `empty_input_handler_guarded` to fuz_schema's
|
|
9
9
|
* `SchemaMeta`, so the declared refusal reason of an action input, its
|
|
10
10
|
* handler-guarded marker, and its sensitivity read the same whichever library
|
|
11
|
-
* its schema is.
|
|
11
|
+
* its schema is. It also adds JSON Schema's `readOnly` annotation, which
|
|
12
|
+
* `to_json_schema` writes onto the node.
|
|
12
13
|
*
|
|
13
14
|
* @module
|
|
14
15
|
*/
|
|
@@ -200,7 +200,9 @@ export interface AppServerOptions {
|
|
|
200
200
|
* (anything else throws at assembly). Omit or `undefined` to use the
|
|
201
201
|
* default (1 MiB). Pass `null` to explicitly disable body size limiting,
|
|
202
202
|
* which adds a security warning to the surface's diagnostics (logged at
|
|
203
|
-
* startup).
|
|
203
|
+
* startup). The limit is mounted as a middleware spec at `'*'` ahead of
|
|
204
|
+
* the others (`create_body_limit_middleware_spec`), so every route's
|
|
205
|
+
* error map declares its `413` and `400`; with `null` it is absent.
|
|
204
206
|
*/
|
|
205
207
|
max_body_size?: number | null;
|
|
206
208
|
/** Daemon token state for keeper auth. Omit to disable. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app_server.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/app_server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,KAAK,OAAO,
|
|
1
|
+
{"version":3,"file":"app_server.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/app_server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AAE1C,O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,6EAA6E;IAC7E,cAAc,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAAG,SAAS,CAAC;IAC1D,2CAA2C;IAC3C,iBAAiB,EAAE,eAAe,CAAC;IACnC,2DAA2D;IAC3D,aAAa,EAAE,MAAM,CAAC,uBAAuB,EAAE,WAAW,GAAG,IAAI,CAAC,CAAC;IACnE,uFAAuF;IACvF,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACzC;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,0BAA0B,GACtC,OAAO,sBAAsB,KAC3B,KAAK,CAAC,oBAAoB,CA0D5B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,eAAO,MAAM,iBAAiB,GAAU,SAAS,gBAAgB,KAAG,OAAO,CAAC,SAAS,CAQpF,CAAC"}
|
|
@@ -21,6 +21,7 @@ import { create_static_middleware } from './static.js';
|
|
|
21
21
|
import { log_startup_summary } from './startup.js';
|
|
22
22
|
import { create_app_error_handler } from './app_error_handler.js';
|
|
23
23
|
import { create_app_surface_spec } from '../http/surface.js';
|
|
24
|
+
import { create_dev_route_error_check } from '../http/dev_route_error_check.js';
|
|
24
25
|
import { apply_middleware_specs, apply_route_specs, prefix_route_specs } from '../http/route_spec.js';
|
|
25
26
|
import { check_bootstrap_status, create_bootstrap_route_specs } from '../auth/bootstrap_routes.js';
|
|
26
27
|
import { create_surface_route_spec } from './surface_route.js';
|
|
@@ -28,7 +29,7 @@ import { flush_request_effects } from '../http/pending_effects.js';
|
|
|
28
29
|
import { assert_credential_routes_in_auth_scope, assert_endpoint_in_auth_scope, assert_middleware_stack_mounted, create_auth_middleware_specs } from '../auth/middleware.js';
|
|
29
30
|
import { fuz_auth_guard_resolver } from '../auth/auth_guard_resolver.js';
|
|
30
31
|
import { create_fuz_authorization_handler } from '../auth/request_context.js';
|
|
31
|
-
import {
|
|
32
|
+
import { create_body_limit_middleware_spec } from '../http/body_limit.js';
|
|
32
33
|
import { admit_origin_wildcards, ALLOWED_ORIGINS_VAR } from '../http/origin_wildcard.js';
|
|
33
34
|
import { create_rpc_endpoint } from '../actions/action_rpc.js';
|
|
34
35
|
import { register_action_ws } from '../actions/register_action_ws.js';
|
|
@@ -277,10 +278,11 @@ const assemble_app_server = async (options, releases) => {
|
|
|
277
278
|
log.warn(`${ALLOWED_ORIGINS_VAR}: ${warning} (origin ${entry})`);
|
|
278
279
|
}
|
|
279
280
|
// body size limit — rejects oversized payloads before auth/validation; the
|
|
280
|
-
// middleware throws on a cap that is not a safe integer 0 or more
|
|
281
|
-
|
|
281
|
+
// middleware throws on a cap that is not a safe integer 0 or more. A spec,
|
|
282
|
+
// so the surface and each route's error map declare its 413 and 400.
|
|
283
|
+
const body_limit_spec = options.max_body_size === null
|
|
282
284
|
? null
|
|
283
|
-
:
|
|
285
|
+
: create_body_limit_middleware_spec(options.max_body_size ?? DEFAULT_BODY_LIMIT_BYTES);
|
|
284
286
|
// Rate limiters — the ones built here are the server's to dispose, on
|
|
285
287
|
// close or when assembly fails.
|
|
286
288
|
const { mode: rate_limiter_mode, limiters: rate_limiters, built: built_rate_limiters } = resolve_rate_limiters(options);
|
|
@@ -471,10 +473,13 @@ const assemble_app_server = async (options, releases) => {
|
|
|
471
473
|
seen_paths.add(endpoint.path);
|
|
472
474
|
}
|
|
473
475
|
}
|
|
474
|
-
// Surface + logging
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
:
|
|
476
|
+
// Surface + logging — the body limit first, where it runs, ahead of the
|
|
477
|
+
// middleware specs
|
|
478
|
+
const surface_middleware = [
|
|
479
|
+
...(body_limit_spec ? [body_limit_spec] : []),
|
|
480
|
+
...middleware_specs,
|
|
481
|
+
...(options.post_route_middleware ?? [])
|
|
482
|
+
];
|
|
478
483
|
const all_event_specs = [
|
|
479
484
|
...(options.event_specs ?? []),
|
|
480
485
|
...(audit_sse ? audit_log_event_specs : [])
|
|
@@ -506,6 +511,15 @@ const assemble_app_server = async (options, releases) => {
|
|
|
506
511
|
// above all — answers here: 503 for a failed pool checkout, Hono's default
|
|
507
512
|
// 500 for anything else.
|
|
508
513
|
app.onError(create_app_error_handler(log));
|
|
514
|
+
// DEV only, and outermost, so it sees what every layer answers: logs a JSON
|
|
515
|
+
// error at a status its route's error map doesn't declare, or off its schema
|
|
516
|
+
const dev_route_error_check = create_dev_route_error_check({
|
|
517
|
+
route_specs,
|
|
518
|
+
route_error_maps: surface_spec.route_error_maps,
|
|
519
|
+
log
|
|
520
|
+
});
|
|
521
|
+
if (dev_route_error_check)
|
|
522
|
+
app.use('*', dev_route_error_check);
|
|
509
523
|
// Two-queue side-effect flush. `pending_effects` collects eager
|
|
510
524
|
// fire-and-forget promises (audit emits, api-token usage). `post_commit_effects` collects deferred thunks pushed via
|
|
511
525
|
// `emit_after_commit` (WS notifications, anything that must observe a
|
|
@@ -545,8 +559,8 @@ const assemble_app_server = async (options, releases) => {
|
|
|
545
559
|
app.use(logger((msg) => log.info(msg)));
|
|
546
560
|
}
|
|
547
561
|
// body size limit, built with the option checks above
|
|
548
|
-
if (
|
|
549
|
-
app
|
|
562
|
+
if (body_limit_spec) {
|
|
563
|
+
apply_middleware_specs(app, [body_limit_spec]);
|
|
550
564
|
}
|
|
551
565
|
apply_middleware_specs(app, middleware_specs);
|
|
552
566
|
const authorize = create_fuz_authorization_handler({ db: deps.db });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve_fact_route.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/serve_fact_route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmIG;AAMH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"serve_fact_route.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/serve_fact_route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmIG;AAMH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AActD,OAAO,EAAuC,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAQ5F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAkBjD,MAAM,WAAW,+BAA+B;IAC/C,kFAAkF;IAClF,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;CACZ;AAkJD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,iCAAiC,GAC7C,SAAS,+BAA+B,KACtC,SAyDF,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,4BAA4B,GACxC,SAAS,+BAA+B,KACtC,SA8CF,CAAC"}
|
|
@@ -133,16 +133,12 @@
|
|
|
133
133
|
import { open } from 'node:fs/promises';
|
|
134
134
|
import { Readable } from 'node:stream';
|
|
135
135
|
import { join } from 'node:path';
|
|
136
|
-
import { FactHashSchema, Uuid } from '../
|
|
137
|
-
import {
|
|
138
|
-
import { z } from 'zod';
|
|
139
|
-
import { object } from '@fuzdev/fuz_schema/schema.ts';
|
|
136
|
+
import { ActingActor, FactHashSchema, Uuid } from '../primitive_schemas_fuz.js';
|
|
137
|
+
import { literal, object } from '@fuzdev/fuz_schema/schema.ts';
|
|
140
138
|
import { build_request_context, get_public_account_id, get_request_context, has_scoped_role } from '../auth/request_context.js';
|
|
141
139
|
import { ROLE_ADMIN } from '../auth/role_schema.js';
|
|
142
140
|
import { query_active_actors_by_account } from '../auth/account_queries.js';
|
|
143
141
|
import { get_route_params } from '../http/route_spec.js';
|
|
144
|
-
import { ERROR_INVALID_ROUTE_PARAMS } from '../http/error_schemas.js';
|
|
145
|
-
import { WireIssue } from '../schema_issues.js';
|
|
146
142
|
import { query_get_fact, query_get_fact_meta } from '../db/fact_queries.js';
|
|
147
143
|
import { to_uint8 } from '../db/fact_store.js';
|
|
148
144
|
import { query_cell_get } from '../db/cell_queries.js';
|
|
@@ -157,30 +153,13 @@ import { FACT_CACHE_CONTROL, FACT_SECURITY_HEADERS } from './fact_security_heade
|
|
|
157
153
|
* standard params-validation error shape (`ERROR_INVALID_ROUTE_PARAMS`),
|
|
158
154
|
* which the round-trip validator expects.
|
|
159
155
|
*/
|
|
160
|
-
const bare_hash_params_schema =
|
|
161
|
-
hash: FactHashSchema
|
|
162
|
-
});
|
|
156
|
+
const bare_hash_params_schema = object({ hash: FactHashSchema });
|
|
163
157
|
/**
|
|
164
158
|
* Path-param schema for the cell-scoped route. `cell_id` validates as a
|
|
165
159
|
* `Uuid`; `hash` as the canonical fact-hash form. Malformed values 400 via
|
|
166
160
|
* the standard params-validation shape.
|
|
167
161
|
*/
|
|
168
|
-
const cell_fact_params_schema =
|
|
169
|
-
cell_id: Uuid,
|
|
170
|
-
hash: FactHashSchema
|
|
171
|
-
});
|
|
172
|
-
/**
|
|
173
|
-
* Shared error-schema entry: tighten the auto-derived 400 to the literal
|
|
174
|
-
* emitted by params validation. `issues` is optional because the framework
|
|
175
|
-
* emits it through `dev_only` — a production body carries the `error`
|
|
176
|
-
* literal alone.
|
|
177
|
-
*/
|
|
178
|
-
const params_400_error = {
|
|
179
|
-
400: z.looseObject({
|
|
180
|
-
error: z.literal(ERROR_INVALID_ROUTE_PARAMS),
|
|
181
|
-
issues: z.array(WireIssue).optional()
|
|
182
|
-
})
|
|
183
|
-
};
|
|
162
|
+
const cell_fact_params_schema = object({ cell_id: Uuid, hash: FactHashSchema });
|
|
184
163
|
/**
|
|
185
164
|
* Serve a fact's bytes by hash, after the caller has been authorized for it.
|
|
186
165
|
*
|
|
@@ -325,10 +304,9 @@ export const create_serve_cell_fact_route_spec = (options) => {
|
|
|
325
304
|
reads_credential: true,
|
|
326
305
|
description: "Serve content-addressed fact bytes through a named referencing cell. 404 unless the cell admits the caller via can_view_cell (or the steward arm: the governing root's manager reading a pending or rejected contribution) AND references the hash (per-reference, never union-of-referrers).",
|
|
327
306
|
params: cell_fact_params_schema,
|
|
328
|
-
input:
|
|
307
|
+
input: literal(null),
|
|
329
308
|
// The body is a binary stream; no JSON output schema applies.
|
|
330
|
-
output:
|
|
331
|
-
errors: params_400_error,
|
|
309
|
+
output: literal(null),
|
|
332
310
|
handler: async (c, route) => {
|
|
333
311
|
const { cell_id, hash } = get_route_params(c);
|
|
334
312
|
// Resolve the named cell. Missing / soft-deleted → 404 (masked).
|
|
@@ -409,10 +387,9 @@ export const create_serve_fact_route_spec = (options) => {
|
|
|
409
387
|
// invariant 2 requires the `acting?` slot. On a GET it lives on
|
|
410
388
|
// `query` (a multi-actor admin disambiguates via `?acting=<actor>`).
|
|
411
389
|
query: object({ acting: ActingActor }),
|
|
412
|
-
input:
|
|
390
|
+
input: literal(null),
|
|
413
391
|
// The body is a binary stream; no JSON output schema applies.
|
|
414
|
-
output:
|
|
415
|
-
errors: params_400_error,
|
|
392
|
+
output: literal(null),
|
|
416
393
|
handler: async (c, route) => {
|
|
417
394
|
const { hash } = get_route_params(c);
|
|
418
395
|
// Defense-in-depth: the auth phase already gated this on the admin
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface_route.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/surface_route.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"surface_route.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/surface_route.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD,8CAA8C;AAC9C,MAAM,WAAW,mBAAmB;IACnC,2GAA2G;IAC3G,OAAO,EAAE,UAAU,CAAC;CACpB;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yBAAyB,GAAI,SAAS,mBAAmB,KAAG,SAmBvE,CAAC"}
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
11
|
-
import { object } from '@fuzdev/fuz_schema/schema.ts';
|
|
10
|
+
import { array, literal, loose_object, object } from '@fuzdev/fuz_schema/schema.ts';
|
|
12
11
|
import { ActingActor } from '../primitive_schemas_fuz.js';
|
|
13
12
|
import { ROLE_ADMIN } from '../auth/role_schema.js';
|
|
14
13
|
/**
|
|
@@ -39,9 +38,9 @@ export const create_surface_route_spec = (options) => ({
|
|
|
39
38
|
handler: (c) => c.json(options.surface),
|
|
40
39
|
description: 'Application surface (routes, middleware, schemas) — admin only',
|
|
41
40
|
query: object({ acting: ActingActor }),
|
|
42
|
-
input:
|
|
43
|
-
output:
|
|
44
|
-
routes:
|
|
45
|
-
middleware:
|
|
41
|
+
input: literal(null),
|
|
42
|
+
output: loose_object({
|
|
43
|
+
routes: array(loose_object({})),
|
|
44
|
+
middleware: array(loose_object({}))
|
|
46
45
|
})
|
|
47
46
|
});
|
package/dist/server/x_accel.d.ts
CHANGED
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
*
|
|
123
123
|
* @module
|
|
124
124
|
*/
|
|
125
|
-
import {
|
|
125
|
+
import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
|
|
126
126
|
/** Result of the facts-location check. */
|
|
127
127
|
export interface NginxFactsValidation {
|
|
128
128
|
/** `true` when every rule passes. */
|
|
@@ -149,13 +149,18 @@ export declare const validate_facts_internal_location: (config: string, facts_lo
|
|
|
149
149
|
* X-Accel serving is impossible to enable without proving at boot that the
|
|
150
150
|
* facts location is `internal;` and carries the fact hardening headers — a
|
|
151
151
|
* public facts location would bypass every cell-visibility check. A
|
|
152
|
-
*
|
|
153
|
-
* factory is the only ordinary construction path.
|
|
152
|
+
* branded `@fuzdev/fuz_schema` `object`: the brand can't be forged without an
|
|
153
|
+
* explicit cast, so the factory is the only ordinary construction path.
|
|
154
154
|
*/
|
|
155
|
-
export declare const XAccelConfig:
|
|
156
|
-
redirect_prefix:
|
|
157
|
-
},
|
|
158
|
-
|
|
155
|
+
export declare const XAccelConfig: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<{
|
|
156
|
+
redirect_prefix: string;
|
|
157
|
+
}, "XAccelConfig">, {
|
|
158
|
+
redirect_prefix: string;
|
|
159
|
+
}, "object", {
|
|
160
|
+
/** The validated redirect prefix the serving path prepends (e.g. `/_facts/`). */
|
|
161
|
+
redirect_prefix: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
162
|
+
}>;
|
|
163
|
+
export type XAccelConfig = Infer<typeof XAccelConfig>;
|
|
159
164
|
/**
|
|
160
165
|
* A misconfigured X-Accel facts location — a fail-loud boot error thrown by
|
|
161
166
|
* `create_x_accel_config`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"x_accel.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/x_accel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2HG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"x_accel.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/x_accel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2HG;AAEH,OAAO,EAAyC,KAAK,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAIjG,0CAA0C;AAC1C,MAAM,WAAW,oBAAoB;IACpC,qCAAqC;IACrC,EAAE,EAAE,OAAO,CAAC;IACZ,wDAAwD;IACxD,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,gCAAgC,GAC5C,QAAQ,MAAM,EACd,gBAAgB,MAAM,KACpB,oBAYF,CAAC;AA+IF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY;;;;;IAEvB,iFAAiF;;EAIlF,CAAC;AACF,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAEtD;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAC3C,0DAA0D;IAC1D,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;gBACnB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;CAKjC;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,qBAAqB,GACjC,iBAAiB,MAAM,EACvB,cAAc,MAAM,KAClB,YAMF,CAAC"}
|
package/dist/server/x_accel.js
CHANGED
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
*
|
|
123
123
|
* @module
|
|
124
124
|
*/
|
|
125
|
-
import {
|
|
125
|
+
import { brand, object, parse_or_throw, string } from '@fuzdev/fuz_schema/schema.ts';
|
|
126
126
|
import { FACT_SECURITY_HEADERS, fact_security_header_directives } from './fact_security_headers.js';
|
|
127
127
|
/**
|
|
128
128
|
* Assert the nginx config serves the X-Accel facts prefix only from `internal;`
|
|
@@ -275,15 +275,13 @@ const collect_errors = (config, facts_location) => {
|
|
|
275
275
|
* X-Accel serving is impossible to enable without proving at boot that the
|
|
276
276
|
* facts location is `internal;` and carries the fact hardening headers — a
|
|
277
277
|
* public facts location would bypass every cell-visibility check. A
|
|
278
|
-
*
|
|
279
|
-
* factory is the only ordinary construction path.
|
|
278
|
+
* branded `@fuzdev/fuz_schema` `object`: the brand can't be forged without an
|
|
279
|
+
* explicit cast, so the factory is the only ordinary construction path.
|
|
280
280
|
*/
|
|
281
|
-
export const XAccelConfig =
|
|
282
|
-
.strictObject({
|
|
281
|
+
export const XAccelConfig = brand(object({
|
|
283
282
|
/** The validated redirect prefix the serving path prepends (e.g. `/_facts/`). */
|
|
284
|
-
redirect_prefix:
|
|
285
|
-
})
|
|
286
|
-
.brand('XAccelConfig');
|
|
283
|
+
redirect_prefix: string
|
|
284
|
+
}), 'XAccelConfig');
|
|
287
285
|
/**
|
|
288
286
|
* A misconfigured X-Accel facts location — a fail-loud boot error thrown by
|
|
289
287
|
* `create_x_accel_config`.
|
|
@@ -317,7 +315,7 @@ export const create_x_accel_config = (redirect_prefix, nginx_config) => {
|
|
|
317
315
|
if (!validation.ok) {
|
|
318
316
|
throw new XAccelConfigError(validation.errors);
|
|
319
317
|
}
|
|
320
|
-
return XAccelConfig
|
|
318
|
+
return parse_or_throw(XAccelConfig, { redirect_prefix });
|
|
321
319
|
};
|
|
322
320
|
/** Strip every trailing `/` so `/_facts/` and `/_facts` compare equal. */
|
|
323
321
|
const trim_trailing_slashes = (value) => value.replace(/\/+$/, '');
|