@timber-js/app 0.2.0-alpha.212 → 0.2.0-alpha.214

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 (134) hide show
  1. package/dist/_chunks/{actions-CCdnVtWm.js → actions-CUh3cClk.js} +43 -8
  2. package/dist/_chunks/{actions-CCdnVtWm.js.map → actions-CUh3cClk.js.map} +1 -1
  3. package/dist/_chunks/{canonicalize-CgHoscYO.js → canonicalize-BAWkWiKK.js} +28 -2
  4. package/dist/_chunks/{canonicalize-CgHoscYO.js.map → canonicalize-BAWkWiKK.js.map} +1 -1
  5. package/dist/_chunks/{chains-BfoPFraI.js → chains-CjK1Eu6a.js} +2 -2
  6. package/dist/_chunks/{chains-BfoPFraI.js.map → chains-CjK1Eu6a.js.map} +1 -1
  7. package/dist/_chunks/{classify-BT66U83D.js → classify-GAdt6aiA.js} +2 -2
  8. package/dist/_chunks/{classify-BT66U83D.js.map → classify-GAdt6aiA.js.map} +1 -1
  9. package/dist/_chunks/{cli-check-BfQ54-UJ.js → cli-check-DOzjlycg.js} +3 -3
  10. package/dist/_chunks/{cli-check-BfQ54-UJ.js.map → cli-check-DOzjlycg.js.map} +1 -1
  11. package/dist/_chunks/{cli-schema-sync-czh2dsLs.js → cli-schema-sync-B9wDaQvW.js} +2 -2
  12. package/dist/_chunks/{cli-schema-sync-czh2dsLs.js.map → cli-schema-sync-B9wDaQvW.js.map} +1 -1
  13. package/dist/_chunks/{client-dep-entries-CQwpb8dI.js → client-dep-entries-DyDqXOF9.js} +2 -2
  14. package/dist/_chunks/{client-dep-entries-CQwpb8dI.js.map → client-dep-entries-DyDqXOF9.js.map} +1 -1
  15. package/dist/_chunks/{convention-lint-BEVW4EID.js → convention-lint-B3QEGJX7.js} +2 -2
  16. package/dist/_chunks/{convention-lint-BEVW4EID.js.map → convention-lint-B3QEGJX7.js.map} +1 -1
  17. package/dist/_chunks/{dev-server-FKxptbnI.js → dev-server-_9L4KWC-.js} +3 -3
  18. package/dist/_chunks/{dev-server-FKxptbnI.js.map → dev-server-_9L4KWC-.js.map} +1 -1
  19. package/dist/_chunks/{error-boundary-DsNScGRM.js → error-boundary-xxxLtXt6.js} +38 -5
  20. package/dist/_chunks/{error-boundary-DsNScGRM.js.map → error-boundary-xxxLtXt6.js.map} +1 -1
  21. package/dist/_chunks/{live-graph-C_4v-fHv.js → live-graph-Cd3YHvrH.js} +4 -4
  22. package/dist/_chunks/{live-graph-C_4v-fHv.js.map → live-graph-Cd3YHvrH.js.map} +1 -1
  23. package/dist/_chunks/{poison-scan-C92liMAr.js → poison-scan-BnJjBOkn.js} +2 -2
  24. package/dist/_chunks/{poison-scan-C92liMAr.js.map → poison-scan-BnJjBOkn.js.map} +1 -1
  25. package/dist/_chunks/{scanner-CQt12vE2.js → scanner-CKAT5gRx.js} +2 -2
  26. package/dist/_chunks/{scanner-CQt12vE2.js.map → scanner-CKAT5gRx.js.map} +1 -1
  27. package/dist/_chunks/{walkers-DAT4avhZ.js → walkers-DwCXEyRu.js} +3 -3
  28. package/dist/_chunks/{walkers-DAT4avhZ.js.map → walkers-DwCXEyRu.js.map} +1 -1
  29. package/dist/adapters/nitro-preview.d.ts.map +1 -1
  30. package/dist/adapters/nitro.js +11 -2
  31. package/dist/adapters/nitro.js.map +1 -1
  32. package/dist/analyze/crawl-entry.js +3 -3
  33. package/dist/analyze/graph-command.js +2 -2
  34. package/dist/cli.js +3 -3
  35. package/dist/client/browser-entry/action-dispatch.d.ts.map +1 -1
  36. package/dist/client/browser-entry/action-queue.d.ts +1 -0
  37. package/dist/client/browser-entry/action-queue.d.ts.map +1 -1
  38. package/dist/client/browser-entry/form-state.d.ts +22 -0
  39. package/dist/client/browser-entry/form-state.d.ts.map +1 -0
  40. package/dist/client/browser-entry/hydrate.d.ts +9 -1
  41. package/dist/client/browser-entry/hydrate.d.ts.map +1 -1
  42. package/dist/client/browser-entry/index.d.ts +2 -0
  43. package/dist/client/browser-entry/index.d.ts.map +1 -1
  44. package/dist/client/browser-entry/router-init.d.ts.map +1 -1
  45. package/dist/client/error-boundary.js +1 -1
  46. package/dist/client/index.d.ts +1 -0
  47. package/dist/client/index.d.ts.map +1 -1
  48. package/dist/client/index.js +90 -2
  49. package/dist/client/index.js.map +1 -1
  50. package/dist/client/internal.js +26 -10
  51. package/dist/client/internal.js.map +1 -1
  52. package/dist/client/navigation-transition.d.ts +11 -2
  53. package/dist/client/navigation-transition.d.ts.map +1 -1
  54. package/dist/client/router-effects.d.ts +70 -8
  55. package/dist/client/router-effects.d.ts.map +1 -1
  56. package/dist/client/router-pipeline.d.ts +3 -1
  57. package/dist/client/router-pipeline.d.ts.map +1 -1
  58. package/dist/client/router-types.d.ts +12 -1
  59. package/dist/client/router-types.d.ts.map +1 -1
  60. package/dist/client/router.d.ts.map +1 -1
  61. package/dist/client/use-form-field.d.ts +39 -0
  62. package/dist/client/use-form-field.d.ts.map +1 -0
  63. package/dist/config-types.d.ts +2 -1
  64. package/dist/config-types.d.ts.map +1 -1
  65. package/dist/index.js +5 -5
  66. package/dist/index.js.map +1 -1
  67. package/dist/routing/index.js +2 -2
  68. package/dist/server/action-client.d.ts +11 -2
  69. package/dist/server/action-client.d.ts.map +1 -1
  70. package/dist/server/canonicalize.d.ts +22 -0
  71. package/dist/server/canonicalize.d.ts.map +1 -1
  72. package/dist/server/flight-scripts.d.ts +9 -0
  73. package/dist/server/flight-scripts.d.ts.map +1 -1
  74. package/dist/server/form-data.d.ts +13 -4
  75. package/dist/server/form-data.d.ts.map +1 -1
  76. package/dist/server/form-state-flight.d.ts +32 -0
  77. package/dist/server/form-state-flight.d.ts.map +1 -0
  78. package/dist/server/index.js +37 -23
  79. package/dist/server/index.js.map +1 -1
  80. package/dist/server/internal.js +54 -3
  81. package/dist/server/internal.js.map +1 -1
  82. package/dist/server/pipeline-helpers.d.ts +31 -0
  83. package/dist/server/pipeline-helpers.d.ts.map +1 -1
  84. package/dist/server/pipeline.d.ts.map +1 -1
  85. package/dist/server/rsc-entry/action-dispatcher.d.ts.map +1 -1
  86. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  87. package/dist/server/rsc-entry/render-route.d.ts +2 -0
  88. package/dist/server/rsc-entry/render-route.d.ts.map +1 -1
  89. package/dist/server/rsc-entry/ssr-renderer.d.ts +6 -0
  90. package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
  91. package/dist/server/ssr-bridge-types.d.ts +7 -5
  92. package/dist/server/ssr-bridge-types.d.ts.map +1 -1
  93. package/dist/server/ssr-entry.d.ts.map +1 -1
  94. package/dist/server/ssr-form-state.d.ts +30 -0
  95. package/dist/server/ssr-form-state.d.ts.map +1 -0
  96. package/dist/shared/form-state-flight.d.ts +36 -0
  97. package/dist/shared/form-state-flight.d.ts.map +1 -0
  98. package/docs/api/31-api-client.mdx +22 -0
  99. package/docs/api/34-api-config.mdx +1 -1
  100. package/docs/learn/08-forms-and-actions.mdx +109 -22
  101. package/package.json +1 -1
  102. package/src/adapters/nitro-preview.ts +10 -1
  103. package/src/client/browser-entry/action-dispatch.ts +34 -10
  104. package/src/client/browser-entry/action-queue.ts +1 -1
  105. package/src/client/browser-entry/form-state.ts +48 -0
  106. package/src/client/browser-entry/hydrate.ts +9 -18
  107. package/src/client/browser-entry/index.ts +25 -7
  108. package/src/client/browser-entry/router-init.ts +3 -2
  109. package/src/client/index.ts +1 -0
  110. package/src/client/navigation-transition.ts +13 -2
  111. package/src/client/router-effects.ts +99 -10
  112. package/src/client/router-pipeline.ts +7 -3
  113. package/src/client/router-types.ts +12 -1
  114. package/src/client/router.ts +35 -6
  115. package/src/client/use-form-field.ts +132 -0
  116. package/src/config-types.ts +2 -1
  117. package/src/server/action-client.ts +68 -53
  118. package/src/server/canonicalize.ts +29 -0
  119. package/src/server/flight-scripts.ts +13 -0
  120. package/src/server/form-data.ts +62 -10
  121. package/src/server/form-state-flight.ts +67 -0
  122. package/src/server/pipeline-helpers.ts +61 -0
  123. package/src/server/pipeline.ts +13 -1
  124. package/src/server/rsc-entry/action-dispatcher.ts +3 -0
  125. package/src/server/rsc-entry/index.ts +1 -0
  126. package/src/server/rsc-entry/render-route.ts +16 -0
  127. package/src/server/rsc-entry/ssr-renderer.ts +12 -14
  128. package/src/server/ssr-bridge-types.ts +7 -6
  129. package/src/server/ssr-entry.ts +16 -3
  130. package/src/server/ssr-form-state.ts +58 -0
  131. package/src/shared/form-state-flight.ts +74 -0
  132. package/dist/server/form-state-embed.d.ts +0 -32
  133. package/dist/server/form-state-embed.d.ts.map +0 -1
  134. package/src/server/form-state-embed.ts +0 -63
@@ -1,4 +1,4 @@
1
- import { r as canonicalize } from "./canonicalize-CgHoscYO.js";
1
+ import { i as canonicalize } from "./canonicalize-BAWkWiKK.js";
2
2
  import { a as revalidationAls, i as requestContextAls, r as reactCacheScopeAls } from "./als-registry-BZqHCtq-.js";
3
3
  import { C as isRedirectSignal, F as withSpan, S as isDenySignal, T as isDevMode, b as REDIRECT_BRAND, w as isDebug, y as DENY_BRAND } from "./logger-CbLdcy-W.js";
4
4
  import { n as _setGetSegmentParamsFn, t as _setGetSearchParamsFn } from "./als-slots-BEEIPKYm.js";
@@ -850,9 +850,15 @@ function waitUntil(promise) {
850
850
  * Handles:
851
851
  * - **Duplicate keys → arrays**: `tags=js&tags=ts` → `{ tags: ["js", "ts"] }`
852
852
  * - **Nested dot-paths**: `user.name=Alice` → `{ user: { name: "Alice" } }`
853
- * - **Empty strings → undefined**: Enables `.optional()` semantics in schemas
853
+ * - **Indexed lists → arrays**: `rows.0.name=A&rows.1.name=B` →
854
+ * `{ rows: [{ name: "A" }, { name: "B" }] }`, when the indexes are exactly
855
+ * `0..n-1`. A list with a gap stays an object keyed by index.
856
+ * - **Empty strings stay `""`**: a blank text input is `""`, so
857
+ * `z.string().min(1, 'Required')` reports its own message. Use
858
+ * `coerce.text` to make a blank optional field `undefined`
854
859
  * - **Empty Files → undefined**: File inputs with no selection become `undefined`
855
860
  * - **Strips `$ACTION_*` fields**: React's internal hidden fields are excluded
861
+ * - **Drops `__proto__` paths and names deeper than 32 segments**
856
862
  */
857
863
  function parseFormData(formData) {
858
864
  const flat = {};
@@ -895,6 +901,7 @@ function expandDotPaths(flat) {
895
901
  for (const [key, value] of Object.entries(flat)) {
896
902
  const parts = key.split(".");
897
903
  if (parts.some((p) => DANGEROUS_KEYS.has(p))) continue;
904
+ if (parts.length > MAX_PATH_DEPTH) continue;
898
905
  if (parts.length === 1) {
899
906
  result[parts[0]] = value;
900
907
  continue;
@@ -902,20 +909,47 @@ function expandDotPaths(flat) {
902
909
  let current = result;
903
910
  for (let i = 0; i < parts.length - 1; i++) {
904
911
  const part = parts[i];
905
- if (current[part] === void 0 || current[part] === null) current[part] = {};
906
- if (typeof current[part] !== "object" || current[part] instanceof File) current[part] = {};
912
+ if (!isPlainObject(current[part])) current[part] = {};
907
913
  current = current[part];
908
914
  }
909
915
  current[parts[parts.length - 1]] = value;
910
916
  }
917
+ for (const [key, value] of Object.entries(result)) if (isPlainObject(value)) result[key] = indexedListsToArrays(value);
911
918
  return result;
912
919
  }
920
+ /**
921
+ * `node`, with every nested object whose keys are exactly `"0".."n-1"`
922
+ * turned into an array, depth first. Only a dense, canonical index set
923
+ * converts: `{ "0", "2" }` (a gap), `{ "01" }` and `{ "0", "name" }` stay
924
+ * objects. So a forged `rows.99999` stays one key instead of allocating a
925
+ * sparse array, and the array's length is bounded by the field count limit.
926
+ *
927
+ * Object.keys lists integer-like keys first, in ascending order, so a dense
928
+ * set reads as `0, 1, … n-1` and `Object.values` is already in index order.
929
+ */
930
+ function indexedListsToArrays(node) {
931
+ for (const [key, value] of Object.entries(node)) if (isPlainObject(value)) node[key] = indexedListsToArrays(value);
932
+ const keys = Object.keys(node);
933
+ return keys.length > 0 && keys.every((key, i) => key === String(i)) ? Object.values(node) : node;
934
+ }
935
+ /** An object the dot-path walk built — not an array, File or other instance. */
936
+ function isPlainObject(value) {
937
+ return typeof value === "object" && value !== null && Object.getPrototypeOf(value) === Object.prototype;
938
+ }
913
939
  var DANGEROUS_KEYS = /* @__PURE__ */ new Set(["__proto__"]);
914
940
  /**
941
+ * The most segments a dot-path field name may have. A deeper name is dropped,
942
+ * like a `__proto__` path, so no walk over the parsed value can exhaust the
943
+ * stack (TIM-1573).
944
+ */
945
+ var MAX_PATH_DEPTH = 32;
946
+ /**
915
947
  * Schema-agnostic coercion primitives for common FormData patterns.
916
948
  *
917
949
  * These are plain transform functions — they compose with any schema library's
918
- * `transform`/`preprocess` pipeline:
950
+ * `transform`/`preprocess` pipeline. In Zod, use `z.preprocess`: it runs on an
951
+ * absent key (an unchecked checkbox), where `z.unknown().transform()` fails
952
+ * with "expected nonoptional" before the transform runs.
919
953
  *
920
954
  * ```ts
921
955
  * // Zod
@@ -930,8 +964,9 @@ var coerce = {
930
964
  * Use with `.optional()` schemas where an empty input means "not provided".
931
965
  *
932
966
  * ```ts
933
- * // Zod
934
- * z.unknown().transform(coerce.text).pipe(z.string().optional())
967
+ * // Zod — preprocess, not `z.unknown().transform(…)`: Zod 4 rejects an
968
+ * // absent key before a transform runs ("expected nonoptional")
969
+ * z.preprocess(coerce.text, z.string().optional())
935
970
  * // Valibot
936
971
  * v.pipe(v.unknown(), v.transform(coerce.text), v.optional(v.string()))
937
972
  * ```
@@ -1198,4 +1233,4 @@ function revalidationPathMatches(revalidatedPath, requestPathname, requestSearch
1198
1233
  //#endregion
1199
1234
  export { setMutableCookieContext as C, setMatchedSegmentPath as S, runOutsideReactCacheScope as T, getHeaders as _, parseFormData as a, markResponseFlushed as b, deny as c, waitUntil as d, getCookie as f, getHeader as g, applyRequestHeaderOverlay as h, coerce as i, redirect as l, getSetCookieHeaders as m, revalidatePath as n, DenySignal as o, getCookieJar as p, revalidateTag as r, RedirectSignal as s, executeAction as t, redirectExternal as u, getSearchParams as v, setSegmentParams as w, runWithRequestContext as x, getSegmentParams as y };
1200
1235
 
1201
- //# sourceMappingURL=actions-CCdnVtWm.js.map
1236
+ //# sourceMappingURL=actions-CUh3cClk.js.map