@timber-js/app 0.2.0-alpha.98 → 0.2.0-alpha.99
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 +8 -0
- package/dist/_chunks/actions-CQ8Z8VGL.js +1061 -0
- package/dist/_chunks/actions-CQ8Z8VGL.js.map +1 -0
- package/dist/_chunks/build-output-helper-DXnW0qjz.js +61 -0
- package/dist/_chunks/build-output-helper-DXnW0qjz.js.map +1 -0
- package/dist/_chunks/{define-Itxvcd7F.js → define-B-Q_UMOD.js} +19 -23
- package/dist/_chunks/define-B-Q_UMOD.js.map +1 -0
- package/dist/_chunks/{define-C77ScO0m.js → define-CfBPoJb0.js} +24 -7
- package/dist/_chunks/define-CfBPoJb0.js.map +1 -0
- package/dist/_chunks/define-cookie-BjpIt4UC.js +194 -0
- package/dist/_chunks/define-cookie-BjpIt4UC.js.map +1 -0
- package/dist/_chunks/{format-CYBGxKtc.js → format-Bcn-Iv1x.js} +1 -1
- package/dist/_chunks/{format-CYBGxKtc.js.map → format-Bcn-Iv1x.js.map} +1 -1
- package/dist/_chunks/handler-store-B-lqaGyh.js +54 -0
- package/dist/_chunks/handler-store-B-lqaGyh.js.map +1 -0
- package/dist/_chunks/logger-0m8MsKdc.js +291 -0
- package/dist/_chunks/logger-0m8MsKdc.js.map +1 -0
- package/dist/_chunks/merge-search-params-BphMdht_.js +122 -0
- package/dist/_chunks/merge-search-params-BphMdht_.js.map +1 -0
- package/dist/_chunks/navigation-root-BCYczjml.js +96 -0
- package/dist/_chunks/navigation-root-BCYczjml.js.map +1 -0
- package/dist/_chunks/registry-I2ss-lvy.js +20 -0
- package/dist/_chunks/registry-I2ss-lvy.js.map +1 -0
- package/dist/_chunks/router-ref-h3-UaCQv.js +28 -0
- package/dist/_chunks/router-ref-h3-UaCQv.js.map +1 -0
- package/dist/_chunks/{schema-bridge-C3xl_vfb.js → schema-bridge-Cxu4l-7p.js} +1 -1
- package/dist/_chunks/{schema-bridge-C3xl_vfb.js.map → schema-bridge-Cxu4l-7p.js.map} +1 -1
- package/dist/_chunks/{segment-context-fHFLF1PE.js → segment-context-Dx_OizxD.js} +1 -1
- package/dist/_chunks/{segment-context-fHFLF1PE.js.map → segment-context-Dx_OizxD.js.map} +1 -1
- package/dist/_chunks/{router-ref-C8OCm7g7.js → ssr-data-B4CdH7rE.js} +2 -26
- package/dist/_chunks/ssr-data-B4CdH7rE.js.map +1 -0
- package/dist/_chunks/{stale-reload-BX5gL1r-.js → stale-reload-Bab885FO.js} +1 -1
- package/dist/_chunks/{stale-reload-BX5gL1r-.js.map → stale-reload-Bab885FO.js.map} +1 -1
- package/dist/_chunks/tracing-C8V-YGsP.js +329 -0
- package/dist/_chunks/tracing-C8V-YGsP.js.map +1 -0
- package/dist/_chunks/{use-query-states-BiV5GJgm.js → use-query-states-B2XTqxDR.js} +3 -19
- package/dist/_chunks/use-query-states-B2XTqxDR.js.map +1 -0
- package/dist/_chunks/{use-params-IOPu7E8t.js → use-segment-params-BkpKAQ7D.js} +9 -95
- package/dist/_chunks/use-segment-params-BkpKAQ7D.js.map +1 -0
- package/dist/_chunks/{walkers-VOXgavMF.js → walkers-Tg0Alwcg.js} +6 -3
- package/dist/_chunks/walkers-Tg0Alwcg.js.map +1 -0
- package/dist/_chunks/{dev-warnings-DpGRGoDi.js → warnings-Cg47l5sk.js} +3 -3
- package/dist/_chunks/warnings-Cg47l5sk.js.map +1 -0
- package/dist/adapters/build-output-helper.d.ts +28 -0
- package/dist/adapters/build-output-helper.d.ts.map +1 -0
- package/dist/adapters/cloudflare.d.ts.map +1 -1
- package/dist/adapters/cloudflare.js +8 -28
- package/dist/adapters/cloudflare.js.map +1 -1
- package/dist/adapters/nitro.d.ts.map +1 -1
- package/dist/adapters/nitro.js +8 -26
- package/dist/adapters/nitro.js.map +1 -1
- package/dist/adapters/shared.d.ts +16 -0
- package/dist/adapters/shared.d.ts.map +1 -0
- package/dist/cache/index.js +9 -2
- package/dist/cache/index.js.map +1 -1
- package/dist/cache/timber-cache.d.ts.map +1 -1
- package/dist/client/error-boundary.js +2 -1
- package/dist/client/error-boundary.js.map +1 -1
- package/dist/client/form.d.ts +10 -24
- package/dist/client/form.d.ts.map +1 -1
- package/dist/client/index.d.ts +1 -5
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +40 -90
- package/dist/client/index.js.map +1 -1
- package/dist/client/internal.d.ts +2 -1
- package/dist/client/internal.d.ts.map +1 -1
- package/dist/client/internal.js +81 -7
- package/dist/client/internal.js.map +1 -1
- package/dist/client/rsc-fetch.d.ts.map +1 -1
- package/dist/client/state.d.ts +1 -1
- package/dist/client/use-cookie.d.ts +8 -0
- package/dist/client/use-cookie.d.ts.map +1 -1
- package/dist/client/{use-params.d.ts → use-segment-params.d.ts} +1 -1
- package/dist/client/use-segment-params.d.ts.map +1 -0
- package/dist/codec.d.ts +1 -1
- package/dist/codec.d.ts.map +1 -1
- package/dist/codec.js +2 -2
- package/dist/config-types.d.ts +28 -0
- package/dist/config-types.d.ts.map +1 -1
- package/dist/cookies/define-cookie.d.ts +87 -35
- package/dist/cookies/define-cookie.d.ts.map +1 -1
- package/dist/cookies/index.d.ts +2 -1
- package/dist/cookies/index.d.ts.map +1 -1
- package/dist/cookies/index.js +48 -2
- package/dist/cookies/index.js.map +1 -0
- package/dist/cookies/json-cookie.d.ts +64 -0
- package/dist/cookies/json-cookie.d.ts.map +1 -0
- package/dist/cookies/validation.d.ts +46 -0
- package/dist/cookies/validation.d.ts.map +1 -0
- package/dist/{plugins/dev-404-page.d.ts → dev-tools/404-page.d.ts} +1 -1
- package/dist/dev-tools/404-page.d.ts.map +1 -0
- package/dist/{plugins/dev-browser-logs.d.ts → dev-tools/browser-logs.d.ts} +1 -1
- package/dist/dev-tools/browser-logs.d.ts.map +1 -0
- package/dist/{plugins/dev-error-page.d.ts → dev-tools/error-page.d.ts} +2 -2
- package/dist/dev-tools/error-page.d.ts.map +1 -0
- package/dist/{server/dev-holding-server.d.ts → dev-tools/holding-server.d.ts} +1 -1
- package/dist/dev-tools/holding-server.d.ts.map +1 -0
- package/dist/dev-tools/index.d.ts +31 -0
- package/dist/dev-tools/index.d.ts.map +1 -0
- package/dist/{server/dev-span-processor.d.ts → dev-tools/instrumentation.d.ts} +26 -6
- package/dist/dev-tools/instrumentation.d.ts.map +1 -0
- package/dist/{server/dev-logger.d.ts → dev-tools/logger.d.ts} +1 -1
- package/dist/dev-tools/logger.d.ts.map +1 -0
- package/dist/{plugins/dev-logs.d.ts → dev-tools/logs.d.ts} +1 -1
- package/dist/dev-tools/logs.d.ts.map +1 -0
- package/dist/{plugins/dev-error-overlay.d.ts → dev-tools/overlay.d.ts} +3 -12
- package/dist/dev-tools/overlay.d.ts.map +1 -0
- package/dist/dev-tools/stack-classifier.d.ts +34 -0
- package/dist/dev-tools/stack-classifier.d.ts.map +1 -0
- package/dist/{plugins/dev-terminal-error.d.ts → dev-tools/terminal.d.ts} +2 -2
- package/dist/dev-tools/terminal.d.ts.map +1 -0
- package/dist/{server/dev-warnings.d.ts → dev-tools/warnings.d.ts} +1 -1
- package/dist/dev-tools/warnings.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +97 -72
- package/dist/index.js.map +1 -1
- package/dist/plugin-context.d.ts +1 -1
- package/dist/plugin-context.d.ts.map +1 -1
- package/dist/plugins/adapter-build.d.ts.map +1 -1
- package/dist/routing/convention-lint.d.ts.map +1 -1
- package/dist/routing/index.js +1 -1
- package/dist/routing/scanner.d.ts.map +1 -1
- package/dist/routing/status-file-lint.d.ts.map +1 -1
- package/dist/search-params/define.d.ts +25 -7
- package/dist/search-params/define.d.ts.map +1 -1
- package/dist/search-params/index.js +5 -3
- package/dist/search-params/index.js.map +1 -1
- package/dist/search-params/wrappers.d.ts +2 -2
- package/dist/search-params/wrappers.d.ts.map +1 -1
- package/dist/segment-params/define.d.ts +23 -6
- package/dist/segment-params/define.d.ts.map +1 -1
- package/dist/segment-params/index.js +1 -1
- package/dist/server/access-gate.d.ts +4 -3
- package/dist/server/access-gate.d.ts.map +1 -1
- package/dist/server/action-handler.d.ts +15 -6
- package/dist/server/action-handler.d.ts.map +1 -1
- package/dist/server/als-registry.d.ts +5 -5
- package/dist/server/als-registry.d.ts.map +1 -1
- package/dist/server/asset-headers.d.ts +1 -15
- package/dist/server/asset-headers.d.ts.map +1 -1
- package/dist/server/cookie-context.d.ts +170 -0
- package/dist/server/cookie-context.d.ts.map +1 -0
- package/dist/server/cookie-parsing.d.ts +51 -0
- package/dist/server/cookie-parsing.d.ts.map +1 -0
- package/dist/server/deny-boundary.d.ts +90 -0
- package/dist/server/deny-boundary.d.ts.map +1 -0
- package/dist/server/deny-renderer.d.ts.map +1 -1
- package/dist/server/early-hints-sender.d.ts.map +1 -1
- package/dist/server/index.d.ts +5 -4
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +4 -149
- package/dist/server/index.js.map +1 -1
- package/dist/server/internal.d.ts +6 -4
- package/dist/server/internal.d.ts.map +1 -1
- package/dist/server/internal.js +261 -408
- package/dist/server/internal.js.map +1 -1
- package/dist/server/logger.d.ts +14 -0
- package/dist/server/logger.d.ts.map +1 -1
- package/dist/server/middleware-runner.d.ts +17 -0
- package/dist/server/middleware-runner.d.ts.map +1 -1
- package/dist/server/param-coercion.d.ts +26 -0
- package/dist/server/param-coercion.d.ts.map +1 -0
- package/dist/server/pipeline-helpers.d.ts +14 -7
- package/dist/server/pipeline-helpers.d.ts.map +1 -1
- package/dist/server/pipeline-outcome.d.ts +49 -0
- package/dist/server/pipeline-outcome.d.ts.map +1 -0
- package/dist/server/pipeline-phases.d.ts +4 -49
- package/dist/server/pipeline-phases.d.ts.map +1 -1
- package/dist/server/pipeline.d.ts +0 -2
- package/dist/server/pipeline.d.ts.map +1 -1
- package/dist/server/request-context.d.ts +22 -159
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/route-element-builder.d.ts.map +1 -1
- package/dist/server/rsc-entry/action-middleware-runner.d.ts +66 -0
- package/dist/server/rsc-entry/action-middleware-runner.d.ts.map +1 -0
- package/dist/server/rsc-entry/helpers.d.ts +1 -1
- package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
- package/dist/server/rsc-entry/index.d.ts.map +1 -1
- package/dist/server/rsc-entry/render-route.d.ts +50 -0
- package/dist/server/rsc-entry/render-route.d.ts.map +1 -0
- package/dist/server/rsc-entry/wrap-action-dispatch.d.ts +59 -14
- package/dist/server/rsc-entry/wrap-action-dispatch.d.ts.map +1 -1
- package/dist/server/state-tree-diff.d.ts.map +1 -1
- package/dist/server/tracing.d.ts +1 -1
- package/dist/server/tracing.d.ts.map +1 -1
- package/dist/server/tree-builder.d.ts +45 -16
- package/dist/server/tree-builder.d.ts.map +1 -1
- package/dist/server/types.d.ts +48 -0
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/utils/escape-html.d.ts +14 -0
- package/dist/server/utils/escape-html.d.ts.map +1 -0
- package/dist/shims/headers.d.ts +2 -2
- package/dist/shims/headers.d.ts.map +1 -1
- package/dist/shims/navigation-client.d.ts +3 -1
- package/dist/shims/navigation-client.d.ts.map +1 -1
- package/dist/shims/navigation.d.ts +9 -4
- package/dist/shims/navigation.d.ts.map +1 -1
- package/package.json +6 -7
- package/src/adapters/build-output-helper.ts +77 -0
- package/src/adapters/cloudflare.ts +10 -50
- package/src/adapters/nitro.ts +11 -45
- package/src/adapters/shared.ts +40 -0
- package/src/cache/timber-cache.ts +3 -2
- package/src/cli.ts +0 -0
- package/src/client/form.tsx +17 -25
- package/src/client/index.ts +16 -9
- package/src/client/internal.ts +3 -2
- package/src/client/router.ts +1 -1
- package/src/client/rsc-fetch.ts +15 -0
- package/src/client/state.ts +2 -2
- package/src/client/use-cookie.ts +29 -0
- package/src/codec.ts +3 -7
- package/src/config-types.ts +28 -0
- package/src/cookies/define-cookie.ts +271 -78
- package/src/cookies/index.ts +11 -8
- package/src/cookies/json-cookie.ts +105 -0
- package/src/cookies/validation.ts +134 -0
- package/src/{plugins/dev-404-page.ts → dev-tools/404-page.ts} +2 -7
- package/src/{plugins/dev-error-page.ts → dev-tools/error-page.ts} +5 -32
- package/src/dev-tools/index.ts +90 -0
- package/src/dev-tools/instrumentation.ts +176 -0
- package/src/{plugins/dev-logs.ts → dev-tools/logs.ts} +2 -2
- package/src/{plugins/dev-error-overlay.ts → dev-tools/overlay.ts} +5 -23
- package/src/dev-tools/stack-classifier.ts +75 -0
- package/src/{plugins/dev-terminal-error.ts → dev-tools/terminal.ts} +4 -38
- package/src/{server/dev-warnings.ts → dev-tools/warnings.ts} +1 -1
- package/src/index.ts +11 -3
- package/src/plugin-context.ts +1 -1
- package/src/plugins/adapter-build.ts +3 -1
- package/src/plugins/dev-server.ts +3 -3
- package/src/plugins/shims.ts +1 -1
- package/src/plugins/static-build.ts +1 -1
- package/src/routing/convention-lint.ts +5 -4
- package/src/routing/scanner.ts +5 -2
- package/src/routing/status-file-lint.ts +4 -2
- package/src/search-params/define.ts +71 -15
- package/src/search-params/wrappers.ts +9 -2
- package/src/segment-params/define.ts +66 -13
- package/src/server/access-gate.tsx +9 -8
- package/src/server/action-handler.ts +28 -38
- package/src/server/als-registry.ts +5 -5
- package/src/server/asset-headers.ts +8 -34
- package/src/server/cookie-context.ts +468 -0
- package/src/server/cookie-parsing.ts +135 -0
- package/src/server/{deny-page-resolver.ts → deny-boundary.ts} +78 -14
- package/src/server/deny-renderer.ts +2 -7
- package/src/server/early-hints-sender.ts +3 -2
- package/src/server/fallback-error.ts +1 -1
- package/src/server/index.ts +13 -14
- package/src/server/internal.ts +10 -3
- package/src/server/logger.ts +23 -0
- package/src/server/middleware-runner.ts +44 -0
- package/src/server/param-coercion.ts +76 -0
- package/src/server/pipeline-helpers.ts +37 -13
- package/src/server/pipeline-outcome.ts +167 -0
- package/src/server/pipeline-phases.ts +27 -209
- package/src/server/pipeline.ts +2 -9
- package/src/server/request-context.ts +46 -451
- package/src/server/route-element-builder.ts +7 -3
- package/src/server/rsc-entry/action-middleware-runner.ts +167 -0
- package/src/server/rsc-entry/error-renderer.ts +1 -1
- package/src/server/rsc-entry/helpers.ts +2 -7
- package/src/server/rsc-entry/index.ts +34 -273
- package/src/server/rsc-entry/render-route.ts +304 -0
- package/src/server/rsc-entry/rsc-payload.ts +1 -1
- package/src/server/rsc-entry/ssr-renderer.ts +2 -2
- package/src/server/rsc-entry/wrap-action-dispatch.ts +316 -23
- package/src/server/ssr-entry.ts +1 -1
- package/src/server/state-tree-diff.ts +4 -1
- package/src/server/tracing.ts +3 -3
- package/src/server/tree-builder.ts +128 -52
- package/src/server/types.ts +52 -0
- package/src/server/utils/escape-html.ts +20 -0
- package/src/shims/headers.ts +3 -3
- package/src/shims/navigation-client.ts +4 -3
- package/src/shims/navigation.ts +9 -7
- package/dist/_chunks/actions-DLnUaR65.js +0 -421
- package/dist/_chunks/actions-DLnUaR65.js.map +0 -1
- package/dist/_chunks/als-registry-HS0LGUl2.js +0 -41
- package/dist/_chunks/als-registry-HS0LGUl2.js.map +0 -1
- package/dist/_chunks/debug-ECi_61pb.js +0 -108
- package/dist/_chunks/debug-ECi_61pb.js.map +0 -1
- package/dist/_chunks/define-C77ScO0m.js.map +0 -1
- package/dist/_chunks/define-Itxvcd7F.js.map +0 -1
- package/dist/_chunks/define-cookie-BowvzoP0.js +0 -94
- package/dist/_chunks/define-cookie-BowvzoP0.js.map +0 -1
- package/dist/_chunks/dev-warnings-DpGRGoDi.js.map +0 -1
- package/dist/_chunks/merge-search-params-Cm_KIWDX.js +0 -41
- package/dist/_chunks/merge-search-params-Cm_KIWDX.js.map +0 -1
- package/dist/_chunks/request-context-CK5tZqIP.js +0 -478
- package/dist/_chunks/request-context-CK5tZqIP.js.map +0 -1
- package/dist/_chunks/router-ref-C8OCm7g7.js.map +0 -1
- package/dist/_chunks/tracing-CCYbKn5n.js +0 -238
- package/dist/_chunks/tracing-CCYbKn5n.js.map +0 -1
- package/dist/_chunks/use-params-IOPu7E8t.js.map +0 -1
- package/dist/_chunks/use-query-states-BiV5GJgm.js.map +0 -1
- package/dist/_chunks/walkers-VOXgavMF.js.map +0 -1
- package/dist/client/use-params.d.ts.map +0 -1
- package/dist/plugins/dev-404-page.d.ts.map +0 -1
- package/dist/plugins/dev-browser-logs.d.ts.map +0 -1
- package/dist/plugins/dev-error-overlay.d.ts.map +0 -1
- package/dist/plugins/dev-error-page.d.ts.map +0 -1
- package/dist/plugins/dev-logs.d.ts.map +0 -1
- package/dist/plugins/dev-terminal-error.d.ts.map +0 -1
- package/dist/server/deny-page-resolver.d.ts +0 -52
- package/dist/server/deny-page-resolver.d.ts.map +0 -1
- package/dist/server/dev-fetch-instrumentation.d.ts +0 -22
- package/dist/server/dev-fetch-instrumentation.d.ts.map +0 -1
- package/dist/server/dev-holding-server.d.ts.map +0 -1
- package/dist/server/dev-logger.d.ts.map +0 -1
- package/dist/server/dev-span-processor.d.ts.map +0 -1
- package/dist/server/dev-warnings.d.ts.map +0 -1
- package/dist/server/page-deny-boundary.d.ts +0 -31
- package/dist/server/page-deny-boundary.d.ts.map +0 -1
- package/src/server/dev-fetch-instrumentation.ts +0 -96
- package/src/server/dev-span-processor.ts +0 -78
- package/src/server/page-deny-boundary.tsx +0 -56
- /package/src/client/{use-params.ts → use-segment-params.ts} +0 -0
- /package/src/{plugins/dev-browser-logs.ts → dev-tools/browser-logs.ts} +0 -0
- /package/src/{server/dev-holding-server.ts → dev-tools/holding-server.ts} +0 -0
- /package/src/{server/dev-logger.ts → dev-tools/logger.ts} +0 -0
package/dist/server/logger.d.ts
CHANGED
|
@@ -102,4 +102,18 @@ export declare function logSwrRefetchFailed(data: {
|
|
|
102
102
|
export declare function logCacheMiss(data: {
|
|
103
103
|
cacheKey: string;
|
|
104
104
|
}): void;
|
|
105
|
+
/**
|
|
106
|
+
* Log an intentionally swallowed error. Provides observability into catch
|
|
107
|
+
* blocks that are deliberately empty — the error is consumed, never rethrown.
|
|
108
|
+
*
|
|
109
|
+
* Default level: `warn` in dev (so the overlay surfaces patterns), `debug`
|
|
110
|
+
* in production (low noise unless TIMBER_DEBUG is set). Pass `opts.level`
|
|
111
|
+
* to override.
|
|
112
|
+
*
|
|
113
|
+
* **Infallible** — swallow() itself never throws, even if the logger is
|
|
114
|
+
* broken. A thrown swallow would turn a benign catch into a crash.
|
|
115
|
+
*/
|
|
116
|
+
export declare function swallow(err: unknown, reason: string, opts?: {
|
|
117
|
+
level?: 'debug' | 'warn';
|
|
118
|
+
}): void;
|
|
105
119
|
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/server/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/server/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,6FAA6F;AAC7F,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACxD,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACxD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACzD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAC1D;AAQD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAEpD;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,YAAY,CAExC;AAsBD,4CAA4C;AAC5C,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,uFAAuF;IACvF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,IAAI,CAEP;AAED,0CAA0C;AAC1C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAE/E;AAED,+CAA+C;AAC/C,wBAAgB,cAAc,CAAC,IAAI,EAAE;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,sFAAsF;IACtF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,IAAI,CAEP;AAED,kDAAkD;AAClD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,IAAI,CAEP;AAED,6DAA6D;AAC7D,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAE/F;AAED,sDAAsD;AACtD,wBAAgB,cAAc,CAAC,IAAI,EAAE;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,IAAI,CAEP;AAED,iDAAiD;AACjD,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAE5D;AAED,0DAA0D;AAC1D,wBAAgB,cAAc,CAAC,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAE3F;AAED,0DAA0D;AAC1D,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAE1F;AAED,0DAA0D;AAC1D,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAEhE;AAED,sEAAsE;AACtE,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C;AAED,sDAAsD;AACtD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAEnE;AAED,6DAA6D;AAC7D,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAEpF;AAED,oCAAoC;AACpC,wBAAgB,YAAY,CAAC,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAE7D;AAID;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;CAAE,GAAG,IAAI,CAO/F"}
|
|
@@ -33,4 +33,21 @@ export declare function runMiddleware(middlewareFn: MiddlewareFn, ctx: Middlewar
|
|
|
33
33
|
* @returns A Response if any middleware short-circuited, or undefined to continue
|
|
34
34
|
*/
|
|
35
35
|
export declare function runMiddlewareChain(chain: MiddlewareFn[], ctx: MiddlewareContext): Promise<Response | undefined>;
|
|
36
|
+
/**
|
|
37
|
+
* Mark a request so the pipeline skips its middleware phase.
|
|
38
|
+
*
|
|
39
|
+
* Used by `wrap-action-dispatch.ts` for the no-JS form-rerender path.
|
|
40
|
+
*
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
export declare function markRequestBypassMiddleware(req: Request): void;
|
|
44
|
+
/**
|
|
45
|
+
* Check whether a request was marked to bypass middleware.
|
|
46
|
+
*
|
|
47
|
+
* Called by `handleRequest` in pipeline-phases.ts before invoking the
|
|
48
|
+
* middleware phase. Returns false for any request not explicitly marked.
|
|
49
|
+
*
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
export declare function shouldBypassMiddleware(req: Request): boolean;
|
|
36
53
|
//# sourceMappingURL=middleware-runner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware-runner.d.ts","sourceRoot":"","sources":["../../src/server/middleware-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,mDAAmD;AACnD,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,iBAAiB,KAAK,QAAQ,GAAG,IAAI,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;AAElG;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,iBAAiB,GACrB,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAM/B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,YAAY,EAAE,EACrB,GAAG,EAAE,iBAAiB,GACrB,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAQ/B"}
|
|
1
|
+
{"version":3,"file":"middleware-runner.d.ts","sourceRoot":"","sources":["../../src/server/middleware-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,mDAAmD;AACnD,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,iBAAiB,KAAK,QAAQ,GAAG,IAAI,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;AAElG;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,iBAAiB,GACrB,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAM/B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,YAAY,EAAE,EACrB,GAAG,EAAE,iBAAiB,GACrB,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAQ/B;AAuBD;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAE9D;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAE5D"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Segment param coercion — runs the matched route's `params.ts` codecs
|
|
3
|
+
* over the raw matcher output before middleware and rendering.
|
|
4
|
+
*
|
|
5
|
+
* Lifted out of `pipeline-phases.ts` (TIM-853) so the coercer can be
|
|
6
|
+
* imported directly by other entry points (the action-dispatch wrapper,
|
|
7
|
+
* the revalidation renderer in `rsc-entry/index.ts`) without pulling
|
|
8
|
+
* the entire pipeline phase module along with it.
|
|
9
|
+
*
|
|
10
|
+
* The function throws `ParamCoercionError` from `route-element-builder.ts`
|
|
11
|
+
* on any codec failure; the pipeline catches that and dispatches to the
|
|
12
|
+
* 404 page. See design/07-routing.md §"Where Coercion Runs".
|
|
13
|
+
*/
|
|
14
|
+
import type { RouteMatch } from './pipeline.js';
|
|
15
|
+
/**
|
|
16
|
+
* Run segment param coercion on the matched route's segments.
|
|
17
|
+
*
|
|
18
|
+
* Loads params.ts modules from segments that have them, extracts the
|
|
19
|
+
* segmentParams definition, and coerces raw string params through codecs.
|
|
20
|
+
* Throws ParamCoercionError if any codec fails (→ 404).
|
|
21
|
+
*
|
|
22
|
+
* This runs BEFORE middleware, so ctx.segmentParams is already typed.
|
|
23
|
+
* See design/07-routing.md §"Where Coercion Runs"
|
|
24
|
+
*/
|
|
25
|
+
export declare function coerceSegmentParams(match: RouteMatch): Promise<void>;
|
|
26
|
+
//# sourceMappingURL=param-coercion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"param-coercion.d.ts","sourceRoot":"","sources":["../../src/server/param-coercion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAKhD;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CA8C1E"}
|
|
@@ -12,16 +12,23 @@ import type { ProxyExport } from './proxy.js';
|
|
|
12
12
|
import { RedirectSignal } from './primitives.js';
|
|
13
13
|
import type { ProxyConfig } from './pipeline.js';
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Deep-walk a value returned by a segment param codec, producing a
|
|
16
|
+
* sanitized copy where every plain object is null-prototype and
|
|
17
|
+
* dangerous keys (__proto__, constructor, prototype) are stripped at
|
|
18
|
+
* every depth.
|
|
16
19
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* codec output into a null-prototype target inside coerceSegmentParams().
|
|
20
|
+
* Non-plain objects (Date, Map, class instances, etc.) are returned
|
|
21
|
+
* as-is — they cannot be poisoned by `{...x}` spread and may carry
|
|
22
|
+
* author-intended prototype methods.
|
|
21
23
|
*
|
|
22
|
-
*
|
|
24
|
+
* Arrays are walked element-wise.
|
|
25
|
+
*
|
|
26
|
+
* Performance: URL params are bounded by URL length (~8 KB). Realistic
|
|
27
|
+
* trees are <1 KB. The recursive walk is sub-microsecond.
|
|
28
|
+
*
|
|
29
|
+
* See TIM-655, TIM-855, TIM-873, design/13-security.md
|
|
23
30
|
*/
|
|
24
|
-
export declare function
|
|
31
|
+
export declare function sanitizeParamValue(value: unknown): unknown;
|
|
25
32
|
/**
|
|
26
33
|
* Resolver closure produced once at pipeline construction. The lazy variant
|
|
27
34
|
* still calls `loader()` per-request (HMR relies on re-importing), but the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline-helpers.d.ts","sourceRoot":"","sources":["../../src/server/pipeline-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAI9C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"pipeline-helpers.d.ts","sourceRoot":"","sources":["../../src/server/pipeline-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAI9C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAWjD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAmB1D;AAID;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAErE;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,WAAW,GAAG,WAAW,GAAG,SAAS,GAC3C,aAAa,GAAG,IAAI,CAatB;AAID;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAIrD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAO1E;AAID;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,CAMpE;AAID;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,OAAO,GACf,QAAQ,CAQV;AAID;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,OAAO,EACd,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GACzD,OAAO,CAAC,IAAI,CAAC,CAYf"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipeline outcome translator — converts a `PhaseOutcome` (the value
|
|
3
|
+
* each phase function returns) into a final `Response`.
|
|
4
|
+
*
|
|
5
|
+
* Lifted out of `pipeline-phases.ts` (TIM-853) so the per-phase try /
|
|
6
|
+
* catch logic and the terminal Response-building logic each live in
|
|
7
|
+
* their own file. The phases produce values; this module is the single
|
|
8
|
+
* source of truth for how those values become wire responses.
|
|
9
|
+
*
|
|
10
|
+
* See design/07-routing.md §"Request Lifecycle".
|
|
11
|
+
*/
|
|
12
|
+
import { RedirectSignal, DenySignal } from './primitives.js';
|
|
13
|
+
import type { PipelineConfig, RouteMatch } from './pipeline.js';
|
|
14
|
+
export type PhaseName = 'proxy' | 'middleware' | 'render';
|
|
15
|
+
export type PhaseOutcome = {
|
|
16
|
+
kind: 'response';
|
|
17
|
+
phase: PhaseName;
|
|
18
|
+
response: Response;
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'redirect';
|
|
21
|
+
phase: PhaseName;
|
|
22
|
+
signal: RedirectSignal;
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'deny';
|
|
25
|
+
phase: PhaseName;
|
|
26
|
+
signal: DenySignal;
|
|
27
|
+
} | {
|
|
28
|
+
kind: 'error';
|
|
29
|
+
phase: PhaseName;
|
|
30
|
+
error: unknown;
|
|
31
|
+
};
|
|
32
|
+
export interface OutcomeContext {
|
|
33
|
+
req: Request;
|
|
34
|
+
method: string;
|
|
35
|
+
path: string;
|
|
36
|
+
responseHeaders?: Headers;
|
|
37
|
+
match?: RouteMatch;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Terminal outcome handler — converts a `PhaseOutcome` into a final
|
|
41
|
+
* `Response`, applying cookies, building redirects, rendering deny pages
|
|
42
|
+
* and fallback error pages, and firing instrumentation hooks.
|
|
43
|
+
*
|
|
44
|
+
* This is the single source of truth for how phase outputs become wire
|
|
45
|
+
* responses; the per-phase try/catch blocks now produce values, not
|
|
46
|
+
* Responses, so the conversion logic lives in exactly one place.
|
|
47
|
+
*/
|
|
48
|
+
export declare function outcomeToResponse(config: PipelineConfig, outcome: PhaseOutcome, ctx: OutcomeContext): Promise<Response>;
|
|
49
|
+
//# sourceMappingURL=pipeline-outcome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline-outcome.d.ts","sourceRoot":"","sources":["../../src/server/pipeline-outcome.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAgBH,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAIhE,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,YAAY,GAAG,QAAQ,CAAC;AAE1D,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,GAC1D;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,cAAc,CAAA;CAAE,GAC9D;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,GACtD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAExD,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,OAAO,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AAID;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,YAAY,EACrB,GAAG,EAAE,cAAc,GAClB,OAAO,CAAC,QAAQ,CAAC,CAwGnB"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Pipeline phase functions — module-level free functions that take their
|
|
3
3
|
* dependencies as explicit parameters. Each phase returns a `PhaseOutcome`
|
|
4
|
-
* (a discriminated union over response / redirect / deny / error)
|
|
5
|
-
* terminal `outcomeToResponse`
|
|
4
|
+
* (a discriminated union over response / redirect / deny / error) defined
|
|
5
|
+
* in `pipeline-outcome.ts`. The terminal `outcomeToResponse` (also in
|
|
6
|
+
* `pipeline-outcome.ts`) translates outcomes into Responses.
|
|
6
7
|
*
|
|
7
8
|
* Lifted out of `createPipeline` so each phase can be unit-tested in
|
|
8
9
|
* isolation. The lift is mechanical — these functions used to be closures
|
|
@@ -10,49 +11,13 @@
|
|
|
10
11
|
*
|
|
11
12
|
* See design/07-routing.md §"Request Lifecycle", design/02-rendering-pipeline.md §"Request Flow".
|
|
12
13
|
*/
|
|
13
|
-
import { RedirectSignal, DenySignal } from './primitives.js';
|
|
14
14
|
import { type ProxyResolver } from './pipeline-helpers.js';
|
|
15
|
+
import { type PhaseOutcome } from './pipeline-outcome.js';
|
|
15
16
|
import type { InterceptionContext, PipelineConfig, RouteMatch } from './pipeline.js';
|
|
16
|
-
export type PhaseName = 'proxy' | 'middleware' | 'render';
|
|
17
|
-
export type PhaseOutcome = {
|
|
18
|
-
kind: 'response';
|
|
19
|
-
phase: PhaseName;
|
|
20
|
-
response: Response;
|
|
21
|
-
} | {
|
|
22
|
-
kind: 'redirect';
|
|
23
|
-
phase: PhaseName;
|
|
24
|
-
signal: RedirectSignal;
|
|
25
|
-
} | {
|
|
26
|
-
kind: 'deny';
|
|
27
|
-
phase: PhaseName;
|
|
28
|
-
signal: DenySignal;
|
|
29
|
-
} | {
|
|
30
|
-
kind: 'error';
|
|
31
|
-
phase: PhaseName;
|
|
32
|
-
error: unknown;
|
|
33
|
-
};
|
|
34
|
-
export interface OutcomeContext {
|
|
35
|
-
req: Request;
|
|
36
|
-
method: string;
|
|
37
|
-
path: string;
|
|
38
|
-
responseHeaders?: Headers;
|
|
39
|
-
match?: RouteMatch;
|
|
40
|
-
}
|
|
41
17
|
interface RenderContext {
|
|
42
18
|
canonicalPathname: string;
|
|
43
19
|
interception?: InterceptionContext;
|
|
44
20
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Run segment param coercion on the matched route's segments.
|
|
47
|
-
*
|
|
48
|
-
* Loads params.ts modules from segments that have them, extracts the
|
|
49
|
-
* segmentParams definition, and coerces raw string params through codecs.
|
|
50
|
-
* Throws ParamCoercionError if any codec fails (→ 404).
|
|
51
|
-
*
|
|
52
|
-
* This runs BEFORE middleware, so ctx.segmentParams is already typed.
|
|
53
|
-
* See design/07-routing.md §"Where Coercion Runs"
|
|
54
|
-
*/
|
|
55
|
-
export declare function coerceSegmentParams(match: RouteMatch): Promise<void>;
|
|
56
21
|
/**
|
|
57
22
|
* Run the proxy.ts phase. Calls user proxy code and uses `handleRequest` as
|
|
58
23
|
* the inner `next()` continuation. The proxy resolver was picked at pipeline
|
|
@@ -83,15 +48,5 @@ export declare function runRenderPhase(config: PipelineConfig, req: Request, mat
|
|
|
83
48
|
* the `next()` continuation passed to `runProxy()`.
|
|
84
49
|
*/
|
|
85
50
|
export declare function handleRequest(config: PipelineConfig, req: Request, method: string, path: string): Promise<Response>;
|
|
86
|
-
/**
|
|
87
|
-
* Terminal outcome handler — converts a `PhaseOutcome` into a final
|
|
88
|
-
* `Response`, applying cookies, building redirects, rendering deny pages
|
|
89
|
-
* and fallback error pages, and firing instrumentation hooks.
|
|
90
|
-
*
|
|
91
|
-
* This is the single source of truth for how phase outputs become wire
|
|
92
|
-
* responses; the per-phase try/catch blocks now produce values, not
|
|
93
|
-
* Responses, so the conversion logic lives in exactly one place.
|
|
94
|
-
*/
|
|
95
|
-
export declare function outcomeToResponse(config: PipelineConfig, outcome: PhaseOutcome, ctx: OutcomeContext): Promise<Response>;
|
|
96
51
|
export {};
|
|
97
52
|
//# sourceMappingURL=pipeline-phases.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline-phases.d.ts","sourceRoot":"","sources":["../../src/server/pipeline-phases.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pipeline-phases.d.ts","sourceRoot":"","sources":["../../src/server/pipeline-phases.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAmBH,OAAO,EAA2C,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEpG,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAIrF,UAAU,aAAa;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC;AAID;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,aAAa,EACvB,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,YAAY,CAAC,CAavB;AAID;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,UAAU,EACjB,eAAe,EAAE,OAAO,EACxB,oBAAoB,EAAE,OAAO,EAC7B,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,YAAY,CAAC,CA6DvB;AAID;;;GAGG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,UAAU,EACjB,eAAe,EAAE,OAAO,EACxB,oBAAoB,EAAE,OAAO,EAC7B,EAAE,iBAAiB,EAAE,YAAY,EAAE,EAAE,aAAa,GACjD,OAAO,CAAC,YAAY,CAAC,CAkBvB;AAID;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,QAAQ,CAAC,CAgNnB"}
|
|
@@ -18,8 +18,6 @@ import type { ProxyExport } from './proxy.js';
|
|
|
18
18
|
import type { MiddlewareFn } from './middleware-runner.js';
|
|
19
19
|
import { DenySignal } from './primitives.js';
|
|
20
20
|
import type { ManifestSegmentNode } from './route-matcher.js';
|
|
21
|
-
export { safeMerge } from './pipeline-helpers.js';
|
|
22
|
-
export { coerceSegmentParams } from './pipeline-phases.js';
|
|
23
21
|
/**
|
|
24
22
|
* Result of matching a canonical pathname against the route tree.
|
|
25
23
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/server/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAY3D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/server/pipeline.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Request Context — per-request ALS store for
|
|
2
|
+
* Request Context — per-request ALS store for headers, search params,
|
|
3
|
+
* segment params, and request scope lifecycle.
|
|
3
4
|
*
|
|
4
5
|
* Follows the same pattern as tracing.ts: a module-level AsyncLocalStorage
|
|
5
6
|
* instance, public accessor functions that throw outside request scope,
|
|
6
7
|
* and a framework-internal `runWithRequestContext()` to establish scope.
|
|
7
8
|
*
|
|
9
|
+
* Cookie state lives in `cookie-context.ts` (split out in TIM-853). The
|
|
10
|
+
* scope set up here owns the cookie jar / parsedCookies fields on the
|
|
11
|
+
* store, but the cookie API and helpers are in the cookie module.
|
|
12
|
+
*
|
|
8
13
|
* See design/04-authorization.md §"AccessContext does not include cookies or headers"
|
|
9
14
|
* and design/11-platform.md §"AsyncLocalStorage".
|
|
10
|
-
* See design/29-cookies.md for cookie mutation semantics.
|
|
11
15
|
*/
|
|
12
16
|
import { requestContextAls } from './als-registry.js';
|
|
13
17
|
export { requestContextAls };
|
|
@@ -17,97 +21,28 @@ export { requestContextAls };
|
|
|
17
21
|
* Available in middleware, access checks, server components, and server actions.
|
|
18
22
|
* Throws if called outside a request context (security principle #2: no global fallback).
|
|
19
23
|
*/
|
|
20
|
-
export declare function getHeaders():
|
|
24
|
+
export declare function getHeaders(): ReadonlyHeaders;
|
|
21
25
|
/**
|
|
22
26
|
* Returns the value of a single request header, or undefined if absent.
|
|
23
27
|
*
|
|
24
|
-
* Thin wrapper over `
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* ```ts
|
|
28
|
-
* import { getHeader } from '@timber-js/app/server'
|
|
28
|
+
* Thin wrapper over `getHeaders().get(name)` for the common case where
|
|
29
|
+
* you need exactly one header.
|
|
29
30
|
*
|
|
30
|
-
*
|
|
31
|
-
* const auth = await getHeader('authorization');
|
|
32
|
-
* }
|
|
33
|
-
* ```
|
|
31
|
+
* @internal — not part of the public API. Use `getHeaders().get(name)` instead.
|
|
34
32
|
*/
|
|
35
|
-
export declare function getHeader(name: string):
|
|
33
|
+
export declare function getHeader(name: string): string | undefined;
|
|
36
34
|
/**
|
|
37
|
-
* Returns
|
|
38
|
-
*
|
|
39
|
-
* Available in middleware, access checks, server components, and server actions.
|
|
40
|
-
* Throws if called outside a request context (security principle #2: no global fallback).
|
|
41
|
-
*
|
|
42
|
-
* Read methods (.get, .has, .getAll) are always available and reflect
|
|
43
|
-
* read-your-own-writes from .set() calls in the same request.
|
|
44
|
-
*
|
|
45
|
-
* Mutation methods (.set, .delete, .clear) are only available in mutable
|
|
46
|
-
* contexts (middleware.ts, server actions, route.ts handlers). Calling them
|
|
47
|
-
* in read-only contexts (access.ts, server components) throws.
|
|
48
|
-
*
|
|
49
|
-
* See design/29-cookies.md
|
|
50
|
-
*/
|
|
51
|
-
export declare function getCookies(): Promise<RequestCookies>;
|
|
52
|
-
/**
|
|
53
|
-
* Returns the value of a single cookie, or undefined if absent.
|
|
54
|
-
*
|
|
55
|
-
* Thin wrapper over `(await getCookies()).get(name)` for the common
|
|
56
|
-
* case where you need exactly one cookie.
|
|
57
|
-
*
|
|
58
|
-
* ```ts
|
|
59
|
-
* import { getCookie } from '@timber-js/app/server'
|
|
60
|
-
*
|
|
61
|
-
* export default async function Page() {
|
|
62
|
-
* const session = await getCookie('session_id');
|
|
63
|
-
* }
|
|
64
|
-
* ```
|
|
65
|
-
*/
|
|
66
|
-
export declare function getCookie(name: string): Promise<string | undefined>;
|
|
67
|
-
/**
|
|
68
|
-
* Returns a Promise resolving to the current request's raw URLSearchParams.
|
|
69
|
-
*
|
|
70
|
-
* For typed, parsed search params, import the definition from params.ts
|
|
71
|
-
* and call `.load()` or `.parse()`:
|
|
72
|
-
*
|
|
73
|
-
* ```ts
|
|
74
|
-
* import { searchParams } from './params'
|
|
75
|
-
* const parsed = await searchParams.get()
|
|
76
|
-
* ```
|
|
35
|
+
* Returns the current request's raw URLSearchParams.
|
|
77
36
|
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* ```ts
|
|
81
|
-
* import { getSearchParams } from '@timber-js/app/server'
|
|
82
|
-
* import { searchParams } from './params'
|
|
83
|
-
* const parsed = searchParams.parse(await getSearchParams())
|
|
84
|
-
* ```
|
|
85
|
-
*
|
|
86
|
-
* Throws if called outside a request context.
|
|
37
|
+
* @internal — not part of the public API. Use `defineSearchParams().get()` instead.
|
|
87
38
|
*/
|
|
88
|
-
export declare function getSearchParams():
|
|
39
|
+
export declare function getSearchParams(): URLSearchParams;
|
|
89
40
|
/**
|
|
90
|
-
* Returns
|
|
91
|
-
*
|
|
92
|
-
* Segment params are set by the pipeline after route matching and param
|
|
93
|
-
* coercion (via params.ts codecs). When no params.ts exists, values are
|
|
94
|
-
* raw strings. When codecs are defined, values are already coerced
|
|
95
|
-
* (e.g., `id` is a `number` if `defineSegmentParams({ id: z.coerce.number() })`).
|
|
96
|
-
*
|
|
97
|
-
* This is the primary way page and layout components access route params:
|
|
98
|
-
*
|
|
99
|
-
* ```ts
|
|
100
|
-
* import { getSegmentParams } from '@timber-js/app/server'
|
|
41
|
+
* Returns the current request's coerced segment params.
|
|
101
42
|
*
|
|
102
|
-
*
|
|
103
|
-
* const { slug } = await getSegmentParams()
|
|
104
|
-
* // ...
|
|
105
|
-
* }
|
|
106
|
-
* ```
|
|
107
|
-
*
|
|
108
|
-
* Throws if called outside a request context.
|
|
43
|
+
* @internal — not part of the public API. Use `defineSegmentParams().get()` instead.
|
|
109
44
|
*/
|
|
110
|
-
export declare function getSegmentParams():
|
|
45
|
+
export declare function getSegmentParams(): Record<string, string | string[]>;
|
|
111
46
|
/**
|
|
112
47
|
* Set the segment params promise on the current request context.
|
|
113
48
|
* Called by the pipeline after route matching and param coercion.
|
|
@@ -131,68 +66,15 @@ export declare function getRequestSearchString(): string;
|
|
|
131
66
|
* still a Headers instance, but user code should not mutate it.
|
|
132
67
|
*/
|
|
133
68
|
export type ReadonlyHeaders = Pick<Headers, 'get' | 'has' | 'entries' | 'keys' | 'values' | 'forEach' | typeof Symbol.iterator>;
|
|
134
|
-
/** Options for setting a cookie. See design/29-cookies.md. */
|
|
135
|
-
export interface CookieOptions {
|
|
136
|
-
/** Domain scope. Default: omitted (current domain only). */
|
|
137
|
-
domain?: string;
|
|
138
|
-
/** URL path scope. Default: '/'. */
|
|
139
|
-
path?: string;
|
|
140
|
-
/** Expiration date. Mutually exclusive with maxAge. */
|
|
141
|
-
expires?: Date;
|
|
142
|
-
/** Max age in seconds. Mutually exclusive with expires. */
|
|
143
|
-
maxAge?: number;
|
|
144
|
-
/** Prevent client-side JS access. Default: true. */
|
|
145
|
-
httpOnly?: boolean;
|
|
146
|
-
/** Only send over HTTPS. Default: true. */
|
|
147
|
-
secure?: boolean;
|
|
148
|
-
/** Cross-site request policy. Default: 'lax'. */
|
|
149
|
-
sameSite?: 'strict' | 'lax' | 'none';
|
|
150
|
-
/** Partitioned (CHIPS) — isolate cookie per top-level site. Default: false. */
|
|
151
|
-
partitioned?: boolean;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Cookie accessor returned by `getCookies()`.
|
|
155
|
-
*
|
|
156
|
-
* Read methods are always available. Mutation methods throw in read-only
|
|
157
|
-
* contexts (access.ts, server components).
|
|
158
|
-
*/
|
|
159
|
-
export interface RequestCookies {
|
|
160
|
-
/** Get a cookie value by name. Returns undefined if not present. */
|
|
161
|
-
get(name: string): string | undefined;
|
|
162
|
-
/** Check if a cookie exists. */
|
|
163
|
-
has(name: string): boolean;
|
|
164
|
-
/** Get all cookies as an array of { name, value } pairs. */
|
|
165
|
-
getAll(): Array<{
|
|
166
|
-
name: string;
|
|
167
|
-
value: string;
|
|
168
|
-
}>;
|
|
169
|
-
/** Number of cookies. */
|
|
170
|
-
readonly size: number;
|
|
171
|
-
/** Set a cookie. Only available in mutable contexts (middleware, actions, route handlers). */
|
|
172
|
-
set(name: string, value: string, options?: CookieOptions): void;
|
|
173
|
-
/**
|
|
174
|
-
* Copy all `Set-Cookie` headers from a `Headers` object.
|
|
175
|
-
* Parses each header and forwards name, value, and all attributes
|
|
176
|
-
* (path, domain, max-age, expires, sameSite, secure, httpOnly, partitioned).
|
|
177
|
-
*
|
|
178
|
-
* Useful when forwarding cookies from an internal `fetch()` or auth handler:
|
|
179
|
-
* ```ts
|
|
180
|
-
* const response = await auth.handler(req);
|
|
181
|
-
* getCookies().then(c => c.setFromHeaders(response.headers));
|
|
182
|
-
* ```
|
|
183
|
-
*/
|
|
184
|
-
setFromHeaders(headers: Headers): void;
|
|
185
|
-
/** Delete a cookie. Only available in mutable contexts. */
|
|
186
|
-
delete(name: string, options?: Pick<CookieOptions, 'path' | 'domain'>): void;
|
|
187
|
-
/** Delete all cookies. Only available in mutable contexts. */
|
|
188
|
-
clear(): void;
|
|
189
|
-
/** Serialize cookies as a Cookie header string. */
|
|
190
|
-
toString(): string;
|
|
191
|
-
}
|
|
192
69
|
/**
|
|
193
70
|
* Run a callback within a request context. Used by the pipeline to establish
|
|
194
71
|
* per-request ALS scope so that `getHeaders()` and `getCookies()` work.
|
|
195
72
|
*
|
|
73
|
+
* If the request was previously registered via `seedRequestCookies`, the
|
|
74
|
+
* resulting context's `parsedCookies` map is initialized from the seed and
|
|
75
|
+
* the raw `cookieHeader` is left empty — `parseCookieHeader` is never called
|
|
76
|
+
* for that request. This is the no-JS form-rerender path. See TIM-868.
|
|
77
|
+
*
|
|
196
78
|
* @param req - The incoming Request object.
|
|
197
79
|
* @param fn - The function to run within the request context.
|
|
198
80
|
*/
|
|
@@ -211,25 +93,6 @@ export declare function setMutableCookieContext(mutable: boolean): void;
|
|
|
211
93
|
* See design/29-cookies.md §"Streaming Constraint: Post-Flush Cookie Warning"
|
|
212
94
|
*/
|
|
213
95
|
export declare function markResponseFlushed(): void;
|
|
214
|
-
/**
|
|
215
|
-
* Build a Map of cookie name → value reflecting the current request's
|
|
216
|
-
* read-your-own-writes state. Includes incoming cookies plus any
|
|
217
|
-
* mutations from getCookies().set() / getCookies().delete() in the same request.
|
|
218
|
-
*
|
|
219
|
-
* Used by SSR renderers to populate NavContext.cookies so that
|
|
220
|
-
* useCookie()'s server snapshot matches the actual response state.
|
|
221
|
-
*
|
|
222
|
-
* See design/29-cookies.md §"Read-Your-Own-Writes"
|
|
223
|
-
* See design/triage/TIM-441-cookie-api-triage.md §4
|
|
224
|
-
*/
|
|
225
|
-
export declare function getCookiesForSsr(): Map<string, string>;
|
|
226
|
-
/**
|
|
227
|
-
* Collect all Set-Cookie headers from the cookie jar.
|
|
228
|
-
* Called by the framework at flush time to apply cookies to the response.
|
|
229
|
-
*
|
|
230
|
-
* Returns an array of serialized Set-Cookie header values.
|
|
231
|
-
*/
|
|
232
|
-
export declare function getSetCookieHeaders(): string[];
|
|
233
96
|
/**
|
|
234
97
|
* Apply middleware-injected request headers to the current request context.
|
|
235
98
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-context.d.ts","sourceRoot":"","sources":["../../src/server/request-context.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"request-context.d.ts","sourceRoot":"","sources":["../../src/server/request-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,iBAAiB,EAA4B,MAAM,mBAAmB,CAAC;AAQhF,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAQ7B;;;;;GAKG;AACH,wBAAgB,UAAU,IAAI,eAAe,CAS5C;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG1D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,eAAe,CASjD;AAkBD;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAepE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,IAAI,CAMhF;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAG/C;AAID;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,CAChC,OAAO,EACP,KAAK,GAAG,KAAK,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,MAAM,CAAC,QAAQ,CACnF,CAAC;AAIF;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAmBrE;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAK9D;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAK1C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmBhE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-element-builder.d.ts","sourceRoot":"","sources":["../../src/server/route-element-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAK9D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"route-element-builder.d.ts","sourceRoot":"","sources":["../../src/server/route-element-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAK9D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAa7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAezD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,OAAO,GAAG,OAAO,CAM7D;AAID;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,OAAO,EAAE,MAAM;CAI5B;AAID,qDAAqD;AACrD,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;CACvC;AAED,+CAA+C;AAC/C,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;IAC3C,OAAO,EAAE,mBAAmB,CAAC;CAC9B;AAED,+CAA+C;AAC/C,MAAM,WAAW,kBAAkB;IACjC,wFAAwF;IACxF,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC;IAC5B,2CAA2C;IAC3C,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,wDAAwD;IACxD,gBAAgB,EAAE,oBAAoB,EAAE,CAAC;IACzC,qCAAqC;IACrC,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAChC,4DAA4D;IAC5D,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;;;OAKG;IACH,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;aAE7B,MAAM,EAAE,UAAU,GAAG,cAAc;aACnC,gBAAgB,EAAE,oBAAoB,EAAE;aACxC,QAAQ,EAAE,mBAAmB,EAAE;gBAF/B,MAAM,EAAE,UAAU,GAAG,cAAc,EACnC,gBAAgB,EAAE,oBAAoB,EAAE,EACxC,QAAQ,EAAE,mBAAmB,EAAE;CAIlD;AA8DD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,UAAU,EACjB,YAAY,CAAC,EAAE,mBAAmB,EAClC,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,GACnC,OAAO,CAAC,kBAAkB,CAAC,CAmV7B"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Middleware-on-actions runner — runs the matched route's `middleware.ts`
|
|
3
|
+
* chain for an action POST inside its own `runWithRequestContext` scope
|
|
4
|
+
* and returns a `MiddlewareOutcome` value the dispatcher can translate.
|
|
5
|
+
*
|
|
6
|
+
* Lifted out of `wrap-action-dispatch.ts` (TIM-853) so the dispatcher
|
|
7
|
+
* can be read top-to-bottom without scrolling past the chain runner. The
|
|
8
|
+
* function is intentionally a free function (not a closure over deps)
|
|
9
|
+
* so it can be unit-tested in isolation. It does not import virtual
|
|
10
|
+
* modules and does not call into the action handler — it owns exactly
|
|
11
|
+
* the "run middleware once" step and nothing else.
|
|
12
|
+
*
|
|
13
|
+
* Failure modes are encoded as outcome variants rather than thrown so the
|
|
14
|
+
* caller never has to wrap this in try/catch. The only thrown errors are
|
|
15
|
+
* truly unexpected (programmer bugs) and propagate naturally.
|
|
16
|
+
*
|
|
17
|
+
* See TIM-871 for the full design rationale (closing the
|
|
18
|
+
* CVE-2025-29927-class bug where actions silently bypass middleware).
|
|
19
|
+
*/
|
|
20
|
+
import { DenySignal, RedirectSignal } from '../primitives.js';
|
|
21
|
+
import type { RouteMatch } from '../pipeline.js';
|
|
22
|
+
/** Coerce a matched route's segment params via its `params.ts` codecs. */
|
|
23
|
+
export type CoerceSegmentParamsFn = (match: RouteMatch) => Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Outcome of running middleware on an action request, surfaced from the
|
|
26
|
+
* inner `runWithRequestContext` scope so the outer dispatcher can convert
|
|
27
|
+
* it to a Response (short-circuit) or continue to the action handler.
|
|
28
|
+
*
|
|
29
|
+
* Each variant carries the post-middleware Set-Cookie snapshot so the
|
|
30
|
+
* outer scope can apply cookies to whichever Response it ultimately
|
|
31
|
+
* returns. The middleware ALS scope ends before the action ALS scope
|
|
32
|
+
* begins, so cookie state must be threaded explicitly across the boundary
|
|
33
|
+
* via `seedRequestCookies` (cookie reads) and `setCookieHeaders` (cookie
|
|
34
|
+
* writes).
|
|
35
|
+
*/
|
|
36
|
+
export type MiddlewareOutcome = {
|
|
37
|
+
kind: 'continue';
|
|
38
|
+
overlay: Headers;
|
|
39
|
+
cookies: Map<string, string>;
|
|
40
|
+
setCookieHeaders: string[];
|
|
41
|
+
} | {
|
|
42
|
+
kind: 'short-circuit';
|
|
43
|
+
response: Response;
|
|
44
|
+
setCookieHeaders: string[];
|
|
45
|
+
} | {
|
|
46
|
+
kind: 'redirect';
|
|
47
|
+
signal: RedirectSignal;
|
|
48
|
+
setCookieHeaders: string[];
|
|
49
|
+
} | {
|
|
50
|
+
kind: 'deny';
|
|
51
|
+
signal: DenySignal;
|
|
52
|
+
match: RouteMatch;
|
|
53
|
+
setCookieHeaders: string[];
|
|
54
|
+
} | {
|
|
55
|
+
kind: 'param-coercion-error';
|
|
56
|
+
} | {
|
|
57
|
+
kind: 'error';
|
|
58
|
+
error: unknown;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Run the matched route's middleware chain inside a fresh request-context
|
|
62
|
+
* scope, captured as a `MiddlewareOutcome` value the outer dispatcher can
|
|
63
|
+
* translate to a Response or use as the seed for the action handler.
|
|
64
|
+
*/
|
|
65
|
+
export declare function runMiddlewareForAction(req: Request, match: RouteMatch, coerceSegmentParams: CoerceSegmentParamsFn): Promise<MiddlewareOutcome>;
|
|
66
|
+
//# sourceMappingURL=action-middleware-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-middleware-runner.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/action-middleware-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAUH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,0EAA0E;AAC1E,MAAM,MAAM,qBAAqB,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzE;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,iBAAiB,GACzB;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B,GACD;IACE,IAAI,EAAE,eAAe,CAAC;IACtB,QAAQ,EAAE,QAAQ,CAAC;IACnB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B,GACD;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,cAAc,CAAC;IACvB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;IAClB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B,GACD;IACE,IAAI,EAAE,sBAAsB,CAAC;CAC9B,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEN;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,UAAU,EACjB,mBAAmB,EAAE,qBAAqB,GACzC,OAAO,CAAC,iBAAiB,CAAC,CA8E5B"}
|
|
@@ -107,7 +107,7 @@ export declare function buildRedirectResponse(req: Request, signal: RedirectSign
|
|
|
107
107
|
* is not an application error — suppress it from error boundaries and logs.
|
|
108
108
|
*/
|
|
109
109
|
export declare function isAbortError(error: unknown): boolean;
|
|
110
|
-
export
|
|
110
|
+
export { escapeHtml } from '../utils/escape-html.js';
|
|
111
111
|
/**
|
|
112
112
|
* Parse a Cookie header string into a name→value Map.
|
|
113
113
|
* Used to populate NavContext.cookies for SSR hooks (useCookie).
|