@fuzdev/fuz_app 0.171.0 → 0.172.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.
Files changed (37) hide show
  1. package/dist/http/CLAUDE.md +2 -1
  2. package/dist/http/error_schemas.d.ts +3 -4
  3. package/dist/http/error_schemas.d.ts.map +1 -1
  4. package/dist/http/error_schemas.js +4 -5
  5. package/dist/http/host.d.ts +137 -0
  6. package/dist/http/host.d.ts.map +1 -0
  7. package/dist/http/host.js +203 -0
  8. package/dist/http/origin.d.ts +9 -0
  9. package/dist/http/origin.d.ts.map +1 -1
  10. package/dist/http/origin.js +6 -2
  11. package/dist/http/origin_wildcard.d.ts +20 -5
  12. package/dist/http/origin_wildcard.d.ts.map +1 -1
  13. package/dist/http/origin_wildcard.js +22 -10
  14. package/dist/server/app_server.d.ts +10 -0
  15. package/dist/server/app_server.d.ts.map +1 -1
  16. package/dist/server/app_server.js +14 -3
  17. package/dist/testing/CLAUDE.md +5 -6
  18. package/dist/testing/cross_backend/in_process_setup.d.ts +1 -1
  19. package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
  20. package/dist/testing/cross_backend/in_process_setup.js +2 -1
  21. package/dist/testing/cross_backend/origin_conformance.d.ts +62 -1
  22. package/dist/testing/cross_backend/origin_conformance.d.ts.map +1 -1
  23. package/dist/testing/cross_backend/origin_conformance.js +19 -3
  24. package/dist/testing/cross_backend/origin_conformance.json +330 -0
  25. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +6 -6
  26. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
  27. package/dist/testing/cross_backend/rust_spine_consumer_surface.js +4 -15
  28. package/dist/testing/cross_backend/testing_origin_check.d.ts +16 -1
  29. package/dist/testing/cross_backend/testing_origin_check.d.ts.map +1 -1
  30. package/dist/testing/cross_backend/testing_origin_check.js +12 -4
  31. package/dist/testing/cross_backend/testing_server_core.d.ts +2 -2
  32. package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
  33. package/dist/testing/cross_backend/testing_server_core.js +3 -3
  34. package/dist/testing/stubs.d.ts +11 -4
  35. package/dist/testing/stubs.d.ts.map +1 -1
  36. package/dist/testing/stubs.js +10 -5
  37. package/package.json +1 -1
@@ -10,6 +10,7 @@ import './assert_dev_env.js';
10
10
  import { Logger } from '@fuzdev/fuz_util/log.ts';
11
11
  import { REST_FORBIDDEN_ORIGIN } from '../http/error_schemas.js';
12
12
  import { body_limit_middleware_shape } from '../http/body_limit_schema.js';
13
+ import { host_gate_middleware_shape } from '../http/host.js';
13
14
  import { create_realtime_closer } from '../actions/connection_closer.js';
14
15
  import { Db } from '../db/db.js';
15
16
  import { attach_route_handler, prefix_route_specs } from '../http/route_spec.js';
@@ -285,9 +286,10 @@ const assert_self_resolved_ws_origins = (endpoint) => {
285
286
  * middleware's scope (`assert_endpoint_in_auth_scope`), of a route that
286
287
  * reads or mints a credential outside it
287
288
  * (`assert_credential_routes_in_auth_scope`), and of a
288
- * `transform_middleware` that doesn't keep the proxy and auth stack mounted
289
- * (`assert_middleware_stack_mounted`). The middleware list mirrors the real
290
- * one: a stub `trusted_proxy` spec at `'*'`, then the stub auth stack (with
289
+ * `transform_middleware` that doesn't keep the host gate, proxy and auth stack
290
+ * mounted (`assert_middleware_stack_mounted`). The middleware list mirrors the
291
+ * real one: the host gate's shape at `'*'` (unless `host_gate` is `false`), a
292
+ * stub `trusted_proxy` spec at `'*'`, then the stub auth stack (with
291
293
  * `daemon_token` when `options.daemon_token` is set). If
292
294
  * `create_app_server` changes how it wires routes, update this helper
293
295
  * to stay in sync (single source of truth for all consumers). The body
@@ -300,7 +302,7 @@ const assert_self_resolved_ws_origins = (endpoint) => {
300
302
  * credential, is outside `AUTH_MIDDLEWARE_PATH`, a
301
303
  * `ws_endpoints` spec declares no `allowed_origins` and no `allowed_origins`
302
304
  * option is given, or `transform_middleware` moves, drops, duplicates,
303
- * reorders, wraps, or replaces the stub proxy spec or a stub auth spec
305
+ * reorders, wraps, or replaces the stub host gate, proxy or auth spec
304
306
  */
305
307
  export const create_test_app_surface_spec = (options) => {
306
308
  const ctx = create_stub_app_server_context(options.session_options);
@@ -372,8 +374,11 @@ export const create_test_app_surface_spec = (options) => {
372
374
  ];
373
375
  // refused like `create_app_server` refuses it
374
376
  assert_credential_routes_in_auth_scope(route_specs);
375
- // mirrors `create_app_server`'s `[proxy_spec, ...auth_middleware]`
377
+ // mirrors `create_app_server`'s `[host_spec, proxy_spec, ...auth_middleware]`
376
378
  const stack_specs = [
379
+ ...(options.host_gate === false
380
+ ? []
381
+ : [{ ...host_gate_middleware_shape, handler: create_stub_mw() }]),
377
382
  { name: 'trusted_proxy', path: '*', handler: create_stub_mw() },
378
383
  ...create_stub_api_middleware({
379
384
  include_daemon_token: options.daemon_token,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fuzdev/fuz_app",
3
- "version": "0.171.0",
3
+ "version": "0.172.0",
4
4
  "description": "fullstack app library",
5
5
  "glyph": "🗝",
6
6
  "logo": "logo.svg",