@timber-js/app 0.2.0-alpha.165 → 0.2.0-alpha.167

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 (113) hide show
  1. package/dist/_chunks/{actions-CSDD6x7U.js → actions-TSxpXLHJ.js} +3 -3
  2. package/dist/_chunks/{actions-CSDD6x7U.js.map → actions-TSxpXLHJ.js.map} +1 -1
  3. package/dist/_chunks/{cache-api-eb1gydM7.js → cache-api-DzpQQOEx.js} +53 -49
  4. package/dist/_chunks/{cache-api-eb1gydM7.js.map → cache-api-DzpQQOEx.js.map} +1 -1
  5. package/dist/_chunks/{cli-schema-sync-mGfRbjh2.js → cli-schema-sync-wX-i90Og.js} +6 -4
  6. package/dist/_chunks/cli-schema-sync-wX-i90Og.js.map +1 -0
  7. package/dist/_chunks/cloudflare-AHoWYTYr.js +1188 -0
  8. package/dist/_chunks/cloudflare-AHoWYTYr.js.map +1 -0
  9. package/dist/_chunks/{define-CFmvb4Bt.js → define-COtkxMRT.js} +16 -28
  10. package/dist/_chunks/define-COtkxMRT.js.map +1 -0
  11. package/dist/_chunks/{define-Bssfp6ot.js → define-c4au4I9R.js} +2 -2
  12. package/dist/_chunks/{define-Bssfp6ot.js.map → define-c4au4I9R.js.map} +1 -1
  13. package/dist/_chunks/{logger-B_O6-mdJ.js → logger-t3uxAmbX.js} +3 -3
  14. package/dist/_chunks/logger-t3uxAmbX.js.map +1 -0
  15. package/dist/_chunks/{plugin-context-BnaiU_cF.js → plugin-context---kTF5v8.js} +2 -2
  16. package/dist/_chunks/{plugin-context-BnaiU_cF.js.map → plugin-context---kTF5v8.js.map} +1 -1
  17. package/dist/_chunks/{resolve-schema-3iUvBV5T.js → resolve-schema-Dz3fcFUo.js} +2 -2
  18. package/dist/_chunks/{resolve-schema-3iUvBV5T.js.map → resolve-schema-Dz3fcFUo.js.map} +1 -1
  19. package/dist/_chunks/{schema-bridge-BY3QLBL7.js → schema-bridge-DT_Tn0Xf.js} +2 -2
  20. package/dist/_chunks/{schema-bridge-BY3QLBL7.js.map → schema-bridge-DT_Tn0Xf.js.map} +1 -1
  21. package/dist/_chunks/{use-query-states-CbeQmext.js → use-query-states-DFvWd-EA.js} +65 -7
  22. package/dist/_chunks/use-query-states-DFvWd-EA.js.map +1 -0
  23. package/dist/_chunks/{walkers-BL3MCMgO.js → walkers-Cfwvl-UC.js} +3 -3
  24. package/dist/_chunks/{walkers-BL3MCMgO.js.map → walkers-Cfwvl-UC.js.map} +1 -1
  25. package/dist/adapters/cloudflare-dev.js +1 -1
  26. package/dist/adapters/cloudflare-kv-cache.js +1 -1
  27. package/dist/adapters/cloudflare.d.ts +12 -1
  28. package/dist/adapters/cloudflare.d.ts.map +1 -1
  29. package/dist/adapters/cloudflare.js +2 -461
  30. package/dist/adapters/nitro.js +1 -1
  31. package/dist/adapters/types.d.ts +2 -0
  32. package/dist/adapters/types.d.ts.map +1 -1
  33. package/dist/cache/cache-api.d.ts +33 -11
  34. package/dist/cache/cache-api.d.ts.map +1 -1
  35. package/dist/cache/index.js +1 -1
  36. package/dist/cli.js +2 -2
  37. package/dist/client/browser-entry/post-hydration.d.ts.map +1 -1
  38. package/dist/client/history.d.ts +10 -0
  39. package/dist/client/history.d.ts.map +1 -1
  40. package/dist/client/internal.js +139 -115
  41. package/dist/client/internal.js.map +1 -1
  42. package/dist/client/router.d.ts.map +1 -1
  43. package/dist/client/use-query-states.d.ts.map +1 -1
  44. package/dist/codec.js +1 -1
  45. package/dist/cookies/index.js +1 -1
  46. package/dist/dev-tools/logs.d.ts +15 -1
  47. package/dist/dev-tools/logs.d.ts.map +1 -1
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +138 -45
  50. package/dist/index.js.map +1 -1
  51. package/dist/params/index.js +1 -1
  52. package/dist/plugins/adapter-build.d.ts.map +1 -1
  53. package/dist/plugins/cache.d.ts +8 -8
  54. package/dist/plugins/cache.d.ts.map +1 -1
  55. package/dist/routing/index.js +2 -2
  56. package/dist/schema-bridge.d.ts.map +1 -1
  57. package/dist/search-params/define.d.ts +35 -4
  58. package/dist/search-params/define.d.ts.map +1 -1
  59. package/dist/search-params/index.js +3 -7
  60. package/dist/search-params/index.js.map +1 -1
  61. package/dist/search-params/wrappers.d.ts +2 -2
  62. package/dist/search-params/wrappers.d.ts.map +1 -1
  63. package/dist/segment-params/index.js +1 -1
  64. package/dist/server/als-registry.d.ts +7 -0
  65. package/dist/server/als-registry.d.ts.map +1 -1
  66. package/dist/server/deny-boundary.d.ts +3 -1
  67. package/dist/server/deny-boundary.d.ts.map +1 -1
  68. package/dist/server/index.js +2 -2
  69. package/dist/server/internal.js +12 -7
  70. package/dist/server/internal.js.map +1 -1
  71. package/dist/server/route-element-builder.d.ts +9 -0
  72. package/dist/server/route-element-builder.d.ts.map +1 -1
  73. package/dist/server/rsc-entry/render-route.d.ts.map +1 -1
  74. package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
  75. package/dist/server/rsc-entry/rsc-stream.d.ts +8 -0
  76. package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
  77. package/dist/server/stream-utils.d.ts.map +1 -1
  78. package/docs/api/32-api-cache.mdx +4 -4
  79. package/docs/api/33-api-search-params.mdx +13 -0
  80. package/docs/learn/00-introduction.mdx +1 -2
  81. package/docs/learn/09-caching.mdx +5 -5
  82. package/docs/more/03-coming-from-nextjs.mdx +2 -2
  83. package/docs/more/50-ai-agent-instructions.mdx +5 -5
  84. package/package.json +10 -8
  85. package/src/adapters/cloudflare.ts +63 -25
  86. package/src/adapters/types.ts +2 -0
  87. package/src/cache/cache-api.ts +84 -84
  88. package/src/cli.ts +0 -0
  89. package/src/client/browser-entry/post-hydration.ts +16 -9
  90. package/src/client/history.ts +11 -0
  91. package/src/client/router.ts +212 -206
  92. package/src/client/use-query-states.ts +99 -7
  93. package/src/dev-tools/logs.ts +119 -34
  94. package/src/index.ts +14 -1
  95. package/src/plugins/adapter-build.ts +1 -0
  96. package/src/plugins/cache.ts +45 -30
  97. package/src/routing/scanner.ts +7 -0
  98. package/src/schema-bridge.ts +4 -3
  99. package/src/search-params/define.ts +57 -51
  100. package/src/search-params/wrappers.ts +17 -26
  101. package/src/server/als-registry.ts +7 -0
  102. package/src/server/deny-boundary.ts +6 -3
  103. package/src/server/route-element-builder.ts +49 -8
  104. package/src/server/rsc-entry/render-route.ts +3 -1
  105. package/src/server/rsc-entry/rsc-payload.ts +21 -4
  106. package/src/server/rsc-entry/rsc-stream.ts +8 -0
  107. package/src/server/stream-utils.ts +8 -6
  108. package/LICENSE +0 -8
  109. package/dist/_chunks/cli-schema-sync-mGfRbjh2.js.map +0 -1
  110. package/dist/_chunks/define-CFmvb4Bt.js.map +0 -1
  111. package/dist/_chunks/logger-B_O6-mdJ.js.map +0 -1
  112. package/dist/_chunks/use-query-states-CbeQmext.js.map +0 -1
  113. package/dist/adapters/cloudflare.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { n as toBracketKey, t as resolveSchemaCodecs } from "../_chunks/resolve-schema-3iUvBV5T.js";
1
+ import { n as toBracketKey, t as resolveSchemaCodecs } from "../_chunks/resolve-schema-Dz3fcFUo.js";
2
2
  import { n as setLinkCodecs, t as getLinkCodec } from "../_chunks/codec-registry-oOUxugz3.js";
3
3
  //#region src/params/define-schema.ts
4
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"adapter-build.d.ts","sourceRoot":"","sources":["../../src/plugins/adapter-build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAGnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAGjE,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAuE7D;AAED;;;;;;;GAOG;AACH;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,aAAa,EAC5B,kBAAkB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,GAC5C,OAAO,CAAC,IAAI,CAAC,CAwDf"}
1
+ {"version":3,"file":"adapter-build.d.ts","sourceRoot":"","sources":["../../src/plugins/adapter-build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAGnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAGjE,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAwE7D;AAED;;;;;;;GAOG;AACH;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,aAAa,EAC5B,kBAAkB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,GAC5C,OAAO,CAAC,IAAI,CAAC,CAwDf"}
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * timber-cache-transform — Vite plugin that injects stable callsite IDs
3
- * into `cache()` calls imported from `@timber-js/app/cache`.
3
+ * into `cache.data()` calls imported from `@timber-js/app/cache`.
4
4
  *
5
5
  * Detected callsite forms (TIM-1054):
6
- * - named imports, including aliases: `import { cache as c }` + `c(fn, opts)`
7
- * - namespace imports: `import * as ns` + `ns.cache(fn, opts)`
6
+ * - named imports, including aliases: `import { cache as c }` + `c.data(fn, opts)`
7
+ * - namespace imports: `import * as ns` + `ns.cache.data(fn, opts)`
8
8
  * Forms a per-module transform cannot trace — local variable aliases
9
9
  * (`const c = cache`), user re-export wrapper modules, computed access
10
- * (`ns['cache']`) — fall back to the runtime fnId derived from
10
+ * (`cache['data']`) — fall back to the runtime fnId derived from
11
11
  * fnv1a(fn.toString()) (see cache/timber-cache.ts), which is deterministic
12
12
  * across instances and cold starts of the same build. Without either
13
13
  * mechanism, an ordinal counter would collide across instances with a shared
@@ -15,8 +15,8 @@
15
15
  * data to another.
16
16
  *
17
17
  * The plugin transforms:
18
- * cache(fn, opts) → cache(fn, opts, "stable-id")
19
- * ns.cache(fn, opts) → ns.cache(fn, opts, "stable-id")
18
+ * cache.data(fn, opts) → cache.data(fn, opts, "stable-id")
19
+ * ns.cache.data(fn, opts) → ns.cache.data(fn, opts, "stable-id")
20
20
  *
21
21
  * where stable-id =
22
22
  * fnv1a(relPath + ":cache:" + fnv1a(stmtText) + ":" + fnv1a(callSpanText) + ":" + occurrence)
@@ -34,9 +34,9 @@
34
34
  * unrelated edits, while a changed call gets a fresh ID — which is exactly
35
35
  * when invalidation is wanted.
36
36
  *
37
- * The enclosing-statement text is included so that byte-identical cache()
37
+ * The enclosing-statement text is included so that byte-identical cache.data()
38
38
  * calls in different scopes — e.g. two factory helpers that each `return
39
- * cache(fn, { ttl: 60 })` — get distinct, insertion-stable IDs: their
39
+ * cache.data(fn, { ttl: 60 })` — get distinct, insertion-stable IDs: their
40
40
  * enclosing declarations differ by name/body even when the call spans are
41
41
  * identical. Without it, a source-order occurrence counter alone would shift
42
42
  * when an identical span is inserted above, reassigning IDs across deploys.
@@ -1 +1 @@
1
- {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/plugins/cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AA4D1D;;;GAGG;AACH,iBAAS,gBAAgB,CACvB,kBAAkB,EAAE,MAAM,EAC1B,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,GACjB,MAAM,CAQR;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAuF/D;AAGD,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/plugins/cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AA2E1D;;;GAGG;AACH,iBAAS,gBAAgB,CACvB,kBAAkB,EAAE,MAAM,EAC1B,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,GACjB,MAAM,CAQR;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAuF/D;AAGD,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import { i as INTERCEPTION_MARKERS, n as classifyUrlSegment, r as DEFAULT_PAGE_EXTENSIONS, t as classifySegment } from "../_chunks/segment-classify-CDDRVKs7.js";
2
- import { i as scanRoutes } from "../_chunks/cli-schema-sync-mGfRbjh2.js";
3
- import { a as generateRouteMap, i as validateSchemaAgainstRoutes, n as collectInterceptionRewrites, r as collectDynamicSegmentsFromTree, t as collectLeafRoutes } from "../_chunks/walkers-BL3MCMgO.js";
2
+ import { i as scanRoutes } from "../_chunks/cli-schema-sync-wX-i90Og.js";
3
+ import { a as generateRouteMap, i as validateSchemaAgainstRoutes, n as collectInterceptionRewrites, r as collectDynamicSegmentsFromTree, t as collectLeafRoutes } from "../_chunks/walkers-Cfwvl-UC.js";
4
4
  export { DEFAULT_PAGE_EXTENSIONS, INTERCEPTION_MARKERS, classifySegment, classifyUrlSegment, collectDynamicSegmentsFromTree, collectInterceptionRewrites, collectLeafRoutes, generateRouteMap, scanRoutes, validateSchemaAgainstRoutes };
@@ -1 +1 @@
1
- {"version":3,"file":"schema-bridge.d.ts","sourceRoot":"","sources":["../src/schema-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAUxC,4DAA4D;AAC5D,MAAM,WAAW,gBAAgB,CAAC,MAAM,GAAG,OAAO;IAChD,WAAW,EAAE;QACX,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC;KAChG,CAAC;CACH;AAED,MAAM,MAAM,oBAAoB,CAAC,MAAM,IACnC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,SAAS,CAAA;CAAE,GACrC;IAAE,KAAK,CAAC,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,aAAa,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC;AAMtE;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,MAAM,EACjC,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAChC,KAAK,EAAE,OAAO,GACb,oBAAoB,CAAC,MAAM,CAAC,CAQ9B;AAMD,oDAAoD;AACpD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAO1E;AAED,mEAAmE;AACnE,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAO/D;AAMD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC,CA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K,EAAE,OAAO,GACb,oBAAoB,CAAC,MAAM,CAAC,CAQ9B;AAMD,oDAAoD;AACpD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAO1E;AAED,mEAAmE;AACnE,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAO/D;AAMD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAgB3F;AAMD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,OAAO,EACd,IAAI,GAAE,OAAO,GAAG,QAAmB,GAClC,KAAK,CAAC,OAAO,CAAC,CAYhB;AAMD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAmCnE;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAmCxE"}
@@ -111,8 +111,37 @@ export interface SearchParamsDefinition<T extends Record<string, unknown>> {
111
111
  readonly _type?: T;
112
112
  }
113
113
  export type { StandardSchemaV1 } from '../schema-bridge.js';
114
- /** Infer the output type from either a SearchParamCodec or a StandardSchemaV1. */
115
- export type InferField<V> = V extends SearchParamCodec<infer T> ? T : V extends StandardSchemaV1<infer T> ? T : never;
114
+ /**
115
+ * Extract a Standard Schema's declared *input* type from its optional
116
+ * `~standard.types` property (part of the Standard Schema spec; Zod, Valibot,
117
+ * and ArkType all declare it at the type level). Falls back to `never` when
118
+ * the schema doesn't declare types (e.g. hand-written schemas): with no
119
+ * metadata we can't know whether the schema handles `undefined`, so InferField
120
+ * widens conservatively rather than risk a type lie.
121
+ */
122
+ type InferSchemaInput<V> = V extends {
123
+ '~standard': {
124
+ types?: infer TS;
125
+ };
126
+ } ? [NonNullable<TS>] extends [{
127
+ input: infer I;
128
+ }] ? I : never : never;
129
+ /**
130
+ * Infer the output type from either a SearchParamCodec or a StandardSchemaV1.
131
+ *
132
+ * Schemas whose input type rejects `undefined` (e.g. bare `z.string()`, whose
133
+ * input is `string`) are implicitly optional: the URL might not contain the
134
+ * param, and fromSchema returns `undefined` when the schema rejects absent
135
+ * input and has no default. The output type widens to `T | undefined` so the
136
+ * type doesn't lie. Schemas that accept `undefined` input (`.optional()`,
137
+ * `.default()`) keep their declared output type.
138
+ *
139
+ * Limitation: `z.coerce.*` schemas declare input `unknown`, which accepts
140
+ * `undefined` at the type level — so a coerce schema without `.default()`
141
+ * keeps its narrow output type even though absent input yields `undefined`
142
+ * at runtime. Add `.default()` to coerce schemas for accurate types.
143
+ */
144
+ export type InferField<V> = V extends SearchParamCodec<infer T> ? T : V extends StandardSchemaV1<infer T> ? undefined extends InferSchemaInput<V> ? T : T | undefined : never;
116
145
  /** Acceptable field value for defineSearchParams: a codec or a Standard Schema. */
117
146
  export type SearchParamField<T = unknown> = SearchParamCodec<T> | StandardSchemaV1<T>;
118
147
  /**
@@ -145,9 +174,11 @@ export type SearchParamField<T = unknown> = SearchParamCodec<T> | StandardSchema
145
174
  * )
146
175
  * ```
147
176
  */
148
- export declare function defineSearchParams<T extends Record<string, unknown>>(schema: StandardSchemaV1<T> & {
177
+ export declare function defineSearchParams<S extends StandardSchemaV1<Record<string, unknown>> & {
149
178
  shape: Record<string, StandardSchemaV1<unknown>>;
150
- }): SearchParamsDefinition<T>;
179
+ }>(schema: S): SearchParamsDefinition<{
180
+ [K in keyof S['shape'] & string]: InferField<S['shape'][K]>;
181
+ }>;
151
182
  /**
152
183
  * Overload: accept a map of codecs and/or Standard Schema objects.
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,7 @@
1
1
  import { n as registerSearchParams, t as getSearchParamsDefinition } from "../_chunks/registry-DbJPKoBp.js";
2
- import { i as isStandardSchema, n as fromSchema, o as validateSync, r as isCodec } from "../_chunks/schema-bridge-BY3QLBL7.js";
3
- import { n as defineSearchParams } from "../_chunks/define-CFmvb4Bt.js";
2
+ import { i as isStandardSchema, n as fromSchema, r as isCodec } from "../_chunks/schema-bridge-DT_Tn0Xf.js";
3
+ import { n as defineSearchParams } from "../_chunks/define-COtkxMRT.js";
4
4
  //#region src/search-params/wrappers.ts
5
- function validateSchemaAbsentParam(schema, fieldHint) {
6
- if (validateSync(schema, void 0).issues) throw new Error(`[timber] withUrlKey: schema for '${fieldHint}' has no default value and rejects undefined input.\n Search params are optional — the URL might not contain ?${fieldHint}=anything.\n Add .default() to your schema or use .optional().`);
7
- return fromSchema(schema);
8
- }
9
5
  /**
10
6
  * Wrap a nullable codec with a default value. When the inner codec returns
11
7
  * null, the default is used instead. The output type becomes non-nullable.
@@ -58,7 +54,7 @@ function withDefault(codec, defaultValue) {
58
54
  * ```
59
55
  */
60
56
  function withUrlKey(codecOrSchema, urlKey) {
61
- const codec = isCodec(codecOrSchema) ? codecOrSchema : isStandardSchema(codecOrSchema) ? validateSchemaAbsentParam(codecOrSchema, urlKey) : codecOrSchema;
57
+ const codec = isCodec(codecOrSchema) ? codecOrSchema : isStandardSchema(codecOrSchema) ? fromSchema(codecOrSchema) : codecOrSchema;
62
58
  return {
63
59
  parse: codec.parse.bind(codec),
64
60
  serialize: codec.serialize.bind(codec),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/search-params/wrappers.ts"],"sourcesContent":["/**\n * Codec wrappers — withDefault and withUrlKey.\n *\n * These are timber-specific utilities that work with any SearchParamCodec.\n * For actual codecs (string, integer, boolean, etc.), use nuqs parsers\n * or Standard Schema objects (Zod, Valibot, ArkType) with auto-detection.\n *\n * Design doc: design/23-search-params.md\n */\n\nimport type { SearchParamCodec, SearchParamCodecWithUrlKey, SearchParamField } from './define.js';\nimport { isCodec, isStandardSchema, fromSchema, validateSync } from '../schema-bridge.js';\nimport type { StandardSchemaV1 } from '../schema-bridge.js';\n\nfunction validateSchemaAbsentParam<T>(\n schema: StandardSchemaV1<T>,\n fieldHint: string\n): SearchParamCodec<T> {\n const absentCheck = validateSync(schema, undefined);\n if (absentCheck.issues) {\n throw new Error(\n `[timber] withUrlKey: schema for '${fieldHint}' has no default value and rejects undefined input.\\n` +\n ` Search params are optional — the URL might not contain ?${fieldHint}=anything.\\n` +\n ` Add .default() to your schema or use .optional().`\n );\n }\n return fromSchema(schema);\n}\n\n// ---------------------------------------------------------------------------\n// withDefault\n// ---------------------------------------------------------------------------\n\n/**\n * Wrap a nullable codec with a default value. When the inner codec returns\n * null, the default is used instead. The output type becomes non-nullable.\n *\n * Works with any codec — nuqs parsers, custom codecs, fromSchema results.\n *\n * ```ts\n * import { parseAsInteger } from 'nuqs'\n * import { withDefault } from '@timber-js/app/search-params'\n *\n * const page = withDefault(parseAsInteger, 1)\n * // page.parse(undefined) → 1 (not null)\n * // page.parse('5') → 5\n * ```\n */\nexport function withDefault<T>(\n codec: SearchParamCodec<T | null>,\n defaultValue: T\n): SearchParamCodec<T> {\n return {\n parse(value: string | string[] | undefined): T {\n const result = codec.parse(value);\n return result === null ? defaultValue : result;\n },\n serialize(value: T): string | null {\n return codec.serialize(value);\n },\n };\n}\n\n// ---------------------------------------------------------------------------\n// withUrlKey\n// ---------------------------------------------------------------------------\n\n/**\n * Attach a URL key alias to a codec. The alias determines what query\n * parameter key is used in the URL, while the TypeScript property name\n * stays descriptive.\n *\n * Aliases travel with codecs through object spread composition — when\n * you spread a bundle containing aliased codecs into defineSearchParams,\n * the aliases come along automatically.\n *\n * ```ts\n * import { parseAsString } from 'nuqs'\n * import { withUrlKey } from '@timber-js/app/search-params'\n *\n * export const searchable = {\n * q: withUrlKey(parseAsString, 'search'),\n * // ?search=shoes → { q: 'shoes' }\n * }\n * ```\n *\n * Composes with withDefault:\n * ```ts\n * import { parseAsInteger } from 'nuqs'\n * withUrlKey(withDefault(parseAsInteger, 1), 'p')\n * ```\n */\nexport function withUrlKey<T>(\n codecOrSchema: SearchParamField<T>,\n urlKey: string\n): SearchParamCodecWithUrlKey<T> {\n // Auto-detect Standard Schema (Zod, Valibot, ArkType) and wrap.\n // Validate absent-param handling here since withUrlKey converts to a codec\n // before resolveField sees it. design/23-search-params.md §\"Default Validation\"\n const codec: SearchParamCodec<T> = isCodec(codecOrSchema)\n ? codecOrSchema\n : isStandardSchema(codecOrSchema)\n ? validateSchemaAbsentParam(codecOrSchema, urlKey)\n : (codecOrSchema as SearchParamCodec<T>);\n return {\n parse: codec.parse.bind(codec),\n serialize: codec.serialize.bind(codec),\n urlKey,\n };\n}\n"],"mappings":";;;;AAcA,SAAS,0BACP,QACA,WACqB;CAErB,IADoB,aAAa,QAAQ,KAAA,CACrC,CAAA,CAAY,QACd,MAAM,IAAI,MACR,oCAAoC,UAAU,iHACiB,UAAU,gEAE3E;CAEF,OAAO,WAAW,MAAM;AAC1B;;;;;;;;;;;;;;;;AAqBA,SAAgB,YACd,OACA,cACqB;CACrB,OAAO;EACL,MAAM,OAAyC;GAC7C,MAAM,SAAS,MAAM,MAAM,KAAK;GAChC,OAAO,WAAW,OAAO,eAAe;EAC1C;EACA,UAAU,OAAyB;GACjC,OAAO,MAAM,UAAU,KAAK;EAC9B;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,SAAgB,WACd,eACA,QAC+B;CAI/B,MAAM,QAA6B,QAAQ,aAAa,IACpD,gBACA,iBAAiB,aAAa,IAC5B,0BAA0B,eAAe,MAAM,IAC9C;CACP,OAAO;EACL,OAAO,MAAM,MAAM,KAAK,KAAK;EAC7B,WAAW,MAAM,UAAU,KAAK,KAAK;EACrC;CACF;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/search-params/wrappers.ts"],"sourcesContent":["/**\n * Codec wrappers — withDefault and withUrlKey.\n *\n * These are timber-specific utilities that work with any SearchParamCodec.\n * For actual codecs (string, integer, boolean, etc.), use nuqs parsers\n * or Standard Schema objects (Zod, Valibot, ArkType) with auto-detection.\n *\n * Design doc: design/23-search-params.md\n */\n\nimport type {\n InferField,\n SearchParamCodec,\n SearchParamCodecWithUrlKey,\n SearchParamField,\n} from './define.js';\nimport { isCodec, isStandardSchema, fromSchema } from '../schema-bridge.js';\n\n// ---------------------------------------------------------------------------\n// withDefault\n// ---------------------------------------------------------------------------\n\n/**\n * Wrap a nullable codec with a default value. When the inner codec returns\n * null, the default is used instead. The output type becomes non-nullable.\n *\n * Works with any codec — nuqs parsers, custom codecs, fromSchema results.\n *\n * ```ts\n * import { parseAsInteger } from 'nuqs'\n * import { withDefault } from '@timber-js/app/search-params'\n *\n * const page = withDefault(parseAsInteger, 1)\n * // page.parse(undefined) → 1 (not null)\n * // page.parse('5') → 5\n * ```\n */\nexport function withDefault<T>(\n codec: SearchParamCodec<T | null>,\n defaultValue: T\n): SearchParamCodec<T> {\n return {\n parse(value: string | string[] | undefined): T {\n const result = codec.parse(value);\n return result === null ? defaultValue : result;\n },\n serialize(value: T): string | null {\n return codec.serialize(value);\n },\n };\n}\n\n// ---------------------------------------------------------------------------\n// withUrlKey\n// ---------------------------------------------------------------------------\n\n/**\n * Attach a URL key alias to a codec. The alias determines what query\n * parameter key is used in the URL, while the TypeScript property name\n * stays descriptive.\n *\n * Aliases travel with codecs through object spread composition — when\n * you spread a bundle containing aliased codecs into defineSearchParams,\n * the aliases come along automatically.\n *\n * ```ts\n * import { parseAsString } from 'nuqs'\n * import { withUrlKey } from '@timber-js/app/search-params'\n *\n * export const searchable = {\n * q: withUrlKey(parseAsString, 'search'),\n * // ?search=shoes → { q: 'shoes' }\n * }\n * ```\n *\n * Composes with withDefault:\n * ```ts\n * import { parseAsInteger } from 'nuqs'\n * withUrlKey(withDefault(parseAsInteger, 1), 'p')\n * ```\n */\nexport function withUrlKey<F extends SearchParamField>(\n codecOrSchema: F,\n urlKey: string\n): SearchParamCodecWithUrlKey<InferField<F>> {\n type T = InferField<F>;\n // Auto-detect Standard Schema (Zod, Valibot, ArkType) and wrap. Schemas\n // that reject undefined input are implicitly optional — fromSchema returns\n // undefined for absent params, and InferField widens the type to include\n // undefined. design/23-search-params.md §\"Implicit Optionality\"\n const codec: SearchParamCodec<T> = isCodec(codecOrSchema)\n ? (codecOrSchema as SearchParamCodec<T>)\n : isStandardSchema(codecOrSchema)\n ? (fromSchema(codecOrSchema) as SearchParamCodec<T>)\n : (codecOrSchema as SearchParamCodec<T>);\n return {\n parse: codec.parse.bind(codec),\n serialize: codec.serialize.bind(codec),\n urlKey,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqCA,SAAgB,YACd,OACA,cACqB;CACrB,OAAO;EACL,MAAM,OAAyC;GAC7C,MAAM,SAAS,MAAM,MAAM,KAAK;GAChC,OAAO,WAAW,OAAO,eAAe;EAC1C;EACA,UAAU,OAAyB;GACjC,OAAO,MAAM,UAAU,KAAK;EAC9B;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,SAAgB,WACd,eACA,QAC2C;CAM3C,MAAM,QAA6B,QAAQ,aAAa,IACnD,gBACD,iBAAiB,aAAa,IAC3B,WAAW,aAAa,IACxB;CACP,OAAO;EACL,OAAO,MAAM,MAAM,KAAK,KAAK;EAC7B,WAAW,MAAM,UAAU,KAAK,KAAK;EACrC;CACF;AACF"}
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * Design doc: design/23-search-params.md
9
9
  */
10
- import type { SearchParamCodec, SearchParamCodecWithUrlKey, SearchParamField } from './define.js';
10
+ import type { InferField, SearchParamCodec, SearchParamCodecWithUrlKey, SearchParamField } from './define.js';
11
11
  /**
12
12
  * Wrap a nullable codec with a default value. When the inner codec returns
13
13
  * null, the default is used instead. The output type becomes non-nullable.
@@ -49,5 +49,5 @@ export declare function withDefault<T>(codec: SearchParamCodec<T | null>, defaul
49
49
  * withUrlKey(withDefault(parseAsInteger, 1), 'p')
50
50
  * ```
51
51
  */
52
- export declare function withUrlKey<T>(codecOrSchema: SearchParamField<T>, urlKey: string): SearchParamCodecWithUrlKey<T>;
52
+ export declare function withUrlKey<F extends SearchParamField>(codecOrSchema: F, urlKey: string): SearchParamCodecWithUrlKey<InferField<F>>;
53
53
  //# sourceMappingURL=wrappers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wrappers.d.ts","sourceRoot":"","sources":["../../src/search-params/wrappers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAuBlG;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,KAAK,EAAE,gBAAgB,CAAC,CAAC,GAAG,IAAI,CAAC,EACjC,YAAY,EAAE,CAAC,GACd,gBAAgB,CAAC,CAAC,CAAC,CAUrB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAC1B,aAAa,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAClC,MAAM,EAAE,MAAM,GACb,0BAA0B,CAAC,CAAC,CAAC,CAc/B"}
1
+ {"version":3,"file":"wrappers.d.ts","sourceRoot":"","sources":["../../src/search-params/wrappers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,0BAA0B,EAC1B,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAOrB;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,KAAK,EAAE,gBAAgB,CAAC,CAAC,GAAG,IAAI,CAAC,EACjC,YAAY,EAAE,CAAC,GACd,gBAAgB,CAAC,CAAC,CAAC,CAUrB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,gBAAgB,EACnD,aAAa,EAAE,CAAC,EAChB,MAAM,EAAE,MAAM,GACb,0BAA0B,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAgB3C"}
@@ -1,2 +1,2 @@
1
- import { n as defineSegmentParams } from "../_chunks/define-Bssfp6ot.js";
1
+ import { n as defineSegmentParams } from "../_chunks/define-c4au4I9R.js";
2
2
  export { defineSegmentParams };
@@ -97,6 +97,13 @@ export interface RequestContextStore {
97
97
  * See TIM-666.
98
98
  */
99
99
  denyStatus?: number;
100
+ /**
101
+ * Callback fired when setDenyStatus() is called. Used by shellSettled
102
+ * to short-circuit when any component catches a DenySignal in-tree,
103
+ * regardless of which component caught it (AccessGate, TracedLayout,
104
+ * or PageDenyBoundary). See TIM-1208.
105
+ */
106
+ onDenyStatus?: () => void;
100
107
  /**
101
108
  * Dev-only: getter for the current request's RSC debug components.
102
109
  * Set by renderRoute() so onPipelineError can include component tree
@@ -1 +1 @@
1
- {"version":3,"file":"als-registry.d.ts","sourceRoot":"","sources":["../../src/server/als-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AA2BlE,2DAA2D;AAC3D,eAAO,MAAM,iBAAiB,wCAE7B,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,iDAAiD;IACjD,OAAO,EAAE,OAAO,CAAC;IACjB,0EAA0E;IAC1E,YAAY,EAAE,MAAM,CAAC;IACrB,8EAA8E;IAC9E,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,uEAAuE;IACvE,eAAe,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,YAAY,EAAE,eAAe,CAAC;IAC9B;;;OAGG;IACH,Y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,EAAE,CAAC;CACrD;AAED,yDAAyD;AACzD,eAAO,MAAM,SAAS,gCAA+D,CAAC;AAMtF,MAAM,WAAW,iBAAiB;IAChC,8DAA8D;IAC9D,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,6DAA6D;IAC7D,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,mDAAmD;AACnD,eAAO,MAAM,eAAe,sCAE3B,CAAC;AAMF,sDAAsD;AACtD,eAAO,MAAM,YAAY,4DAExB,CAAC;AAMF,4EAA4E;AAC5E,MAAM,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;AAE3D,8DAA8D;AAC9D,eAAO,MAAM,mBAAmB,uCAE/B,CAAC;AAMF,6EAA6E;AAC7E,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;AAE9D,4DAA4D;AAC5D,eAAO,MAAM,YAAY,gCAAmE,CAAC;AAM7F,2EAA2E;AAC3E,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChD;AAED,gEAAgE;AAChE,eAAO,MAAM,oBAAoB,yCAEhC,CAAC"}
@@ -93,13 +93,15 @@ export declare function renderDenyEntry(entry: DenyPageEntry, status: number, da
93
93
  * No error reaches React Flight — the Flight stream is clean, SSR succeeds,
94
94
  * and the entire request uses a single renderToReadableStream call.
95
95
  */
96
- export declare function PageDenyBoundary({ Page, route, denyPages, }: {
96
+ export declare function PageDenyBoundary({ Page, route, denyPages, onSettled, }: {
97
97
  /** The page server component function. */
98
98
  Page: (...args: unknown[]) => unknown;
99
99
  /** Route path for OTEL tracing. */
100
100
  route: string;
101
101
  /** Deny page fallback chain from the segment chain. */
102
102
  denyPages: DenyPageEntry[];
103
+ /** Called when the page component finishes (success or deny). See TIM-1045. */
104
+ onSettled?: () => void;
103
105
  }): Promise<React.ReactElement>;
104
106
  /**
105
107
  * Set the deny status in the request context ALS.
@@ -1 +1 @@
1
- {"version":3,"file":"deny-boundary.d.ts","sourceRoot":"","sources":["../../src/server/deny-boundary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAYH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAI9D,sDAAsD;AACtD,MAAM,WAAW,aAAa;IAC5B,yFAAyF;IACzF,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,8DAA8D;IAC9D,SAAS,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;IAC3C;;;;;OAKG;IACH,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,6FAA6F;IAC7F,KAAK,EAAE,OAAO,CAAC;CAChB;AAID;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,mBAAmB,EAAE,EAC/B,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,aAAa,EAAE,CAAC,CAuF1B;AAID;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,aAAa,EAAE,EACtB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,GACZ,KAAK,CAAC,YAAY,GAAG,IAAI,CAgB3B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,GACZ,KAAK,CAAC,YAAY,CA2BpB;AAID;;;;;;;;;;;;;GAaG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,IAAI,EACJ,KAAK,EACL,SAAS,GACV,EAAE;IACD,0CAA0C;IAC1C,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,C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AC,YAAY,CA2BpB;AAID;;;;;;;;;;;;;GAaG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,IAAI,EACJ,KAAK,EACL,SAAS,EACT,SAAS,GACV,EAAE;IACD,0CAA0C;IAC1C,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;IACtC,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,GAAG,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAgB9B;AAID;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAMlD;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,MAAM,GAAG,SAAS,CAElD"}
@@ -1,6 +1,6 @@
1
- import { B as addSpanEvent, C as RedirectType, E as getHeaders, F as getCookieJar, G as getTraceId, O as getSegmentParams, R as isDebug, S as waitUntil, W as getSpanId, Y as withSpan, Z as formFlashAls, _ as RedirectSignal, b as redirect, g as DenySignal, x as redirectExternal, y as deny, z as isDevMode } from "../_chunks/logger-B_O6-mdJ.js";
1
+ import { B as addSpanEvent, C as RedirectType, E as getHeaders, F as getCookieJar, G as getTraceId, O as getSegmentParams, R as isDebug, S as waitUntil, W as getSpanId, Y as withSpan, Z as formFlashAls, _ as RedirectSignal, b as redirect, g as DenySignal, x as redirectExternal, y as deny, z as isDevMode } from "../_chunks/logger-t3uxAmbX.js";
2
2
  import { t as formatSize } from "../_chunks/format-CfwjgPz9.js";
3
- import { a as parseFormData, i as coerce, n as revalidatePath, r as revalidateTag } from "../_chunks/actions-CSDD6x7U.js";
3
+ import { a as parseFormData, i as coerce, n as revalidatePath, r as revalidateTag } from "../_chunks/actions-TSxpXLHJ.js";
4
4
  //#region src/server/sensitive-fields.ts
5
5
  /**
6
6
  * Sensitive field stripping — removes password/token/CVV-style fields
@@ -1,10 +1,10 @@
1
1
  import { a as classifyMetadataRoute, i as METADATA_ROUTE_CONVENTIONS, o as getMetadataRouteAutoLink, r as canonicalize, s as getMetadataRouteServePath } from "../_chunks/canonicalize-P41GR6tY.js";
2
2
  import { n as classifyUrlSegment } from "../_chunks/segment-classify-CDDRVKs7.js";
3
- import { A as runWithRequestContext, D as getSearchParams, G as getTraceId, H as generateTraceId, I as getSetCookieHeaders, J as setSpanAttribute, K as replaceTraceId, L as getWaitUntil, M as setMutableCookieContext, N as setSegmentParams, O as getSegmentParams, P as getCookie, Q as requestContextAls, R as isDebug, T as getHeader, U as getOtelTraceId, X as earlyHintsSenderAls, Y as withSpan, _ as RedirectSignal, a as logProxyError, c as logRequestReceived, d as logSwrRefetchFailed, et as timingAls, f as logWaitUntilRejected, g as DenySignal, h as swallow, i as logMiddlewareShortCircuit, j as setMatchedSegmentPath, k as markResponseFlushed, l as logRouteError, m as setLogger, n as logCacheMiss, o as logRenderError, p as logWaitUntilUnsupported, q as runWithTraceId, r as logMiddlewareError, s as logRequestCompleted, t as getLogger, u as logSlowRequest, v as RenderError, w as applyRequestHeaderOverlay } from "../_chunks/logger-B_O6-mdJ.js";
4
- import { i as coerce, t as executeAction } from "../_chunks/actions-CSDD6x7U.js";
5
- import { a as getManifestEntry, b as wasInvalidatedSince, c as lookupPrebuiltPayload, d as checkVersionSkew, i as storeOverlayEntry, l as setPrebuiltPayloadSource, n as lookupOverlay, o as hasPrebuiltPayloadSource, r as overlayKey, s as isParamIndependent, u as applyReloadHeaders, v as currentInvalidationEpoch, x as createSingleflight, y as lastInvalidationEpochFor } from "../_chunks/cache-api-eb1gydM7.js";
3
+ import { A as runWithRequestContext, D as getSearchParams, G as getTraceId, H as generateTraceId, I as getSetCookieHeaders, J as setSpanAttribute, K as replaceTraceId, L as getWaitUntil, M as setMutableCookieContext, N as setSegmentParams, O as getSegmentParams, P as getCookie, Q as requestContextAls, R as isDebug, T as getHeader, U as getOtelTraceId, X as earlyHintsSenderAls, Y as withSpan, _ as RedirectSignal, a as logProxyError, c as logRequestReceived, d as logSwrRefetchFailed, et as timingAls, f as logWaitUntilRejected, g as DenySignal, h as swallow, i as logMiddlewareShortCircuit, j as setMatchedSegmentPath, k as markResponseFlushed, l as logRouteError, m as setLogger, n as logCacheMiss, o as logRenderError, p as logWaitUntilUnsupported, q as runWithTraceId, r as logMiddlewareError, s as logRequestCompleted, t as getLogger, u as logSlowRequest, v as RenderError, w as applyRequestHeaderOverlay } from "../_chunks/logger-t3uxAmbX.js";
4
+ import { i as coerce, t as executeAction } from "../_chunks/actions-TSxpXLHJ.js";
5
+ import { a as getManifestEntry, b as wasInvalidatedSince, c as lookupPrebuiltPayload, d as checkVersionSkew, i as storeOverlayEntry, l as setPrebuiltPayloadSource, n as lookupOverlay, o as hasPrebuiltPayloadSource, r as overlayKey, s as isParamIndependent, u as applyReloadHeaders, v as currentInvalidationEpoch, x as createSingleflight, y as lastInvalidationEpochFor } from "../_chunks/cache-api-DzpQQOEx.js";
6
6
  import "../client/error-boundary.js";
7
- import { n as toBracketKey } from "../_chunks/resolve-schema-3iUvBV5T.js";
7
+ import { n as toBracketKey } from "../_chunks/resolve-schema-Dz3fcFUo.js";
8
8
  import "../_chunks/segment-context-ZDnXDkbz.js";
9
9
  import { readFile } from "node:fs/promises";
10
10
  import { createHash } from "node:crypto";
@@ -105,8 +105,10 @@ function wrapResponseWithStreamTiming(body, startTime) {
105
105
  let bytes = 0;
106
106
  let cancelled = false;
107
107
  function emitLog() {
108
- const closeMs = Math.round(performance.now() - startTime);
109
- console.debug(`[timber] stream-lifecycle: firstChunk=${firstChunkMs}ms lastChunk=${lastChunkMs}ms close=${closeMs}ms maxGap=${maxGapMs}ms chunks=${chunks} bytes=${bytes}` + (cancelled ? " cancelled=true" : ""));
108
+ if (process.env.NODE_ENV !== "production") {
109
+ const closeMs = Math.round(performance.now() - startTime);
110
+ console.debug(`[timber] stream-lifecycle: firstChunk=${firstChunkMs}ms lastChunk=${lastChunkMs}ms close=${closeMs}ms maxGap=${maxGapMs}ms chunks=${chunks} bytes=${bytes}` + (cancelled ? " cancelled=true" : ""));
111
+ }
110
112
  }
111
113
  const reader = body.getReader();
112
114
  return new ReadableStream({
@@ -1431,7 +1433,10 @@ function renderDenyEntry(entry, status, data) {
1431
1433
  */
1432
1434
  function setDenyStatus(status) {
1433
1435
  const store = requestContextAls.getStore();
1434
- if (store) store.denyStatus = status;
1436
+ if (store) {
1437
+ store.denyStatus = status;
1438
+ store.onDenyStatus?.();
1439
+ }
1435
1440
  }
1436
1441
  //#endregion
1437
1442
  //#region src/server/access-gate.tsx