@payloadcms/tanstack-start 4.0.0-internal.cd69eef → 4.0.0-internal.ce66a41

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 (298) hide show
  1. package/dist/adapters/handleServerFunctions.d.ts +2 -0
  2. package/dist/adapters/handleServerFunctions.d.ts.map +1 -0
  3. package/dist/adapters/handleServerFunctions.js +9 -0
  4. package/dist/adapters/handleServerFunctions.js.map +1 -0
  5. package/dist/adapters/layout/index.d.ts +66 -0
  6. package/dist/adapters/layout/index.d.ts.map +1 -0
  7. package/dist/adapters/layout/index.js +105 -0
  8. package/dist/adapters/layout/index.js.map +1 -0
  9. package/dist/adapters/layout/lazy.d.ts +11 -0
  10. package/dist/adapters/layout/lazy.d.ts.map +1 -0
  11. package/dist/adapters/layout/lazy.js +23 -0
  12. package/dist/adapters/layout/lazy.js.map +1 -0
  13. package/dist/adapters/layout/server.d.ts +29 -0
  14. package/dist/adapters/layout/server.d.ts.map +1 -0
  15. package/dist/adapters/layout/server.js +65 -0
  16. package/dist/adapters/layout/server.js.map +1 -0
  17. package/dist/{utilities/meta.d.ts → adapters/metadata.d.ts} +10 -1
  18. package/dist/adapters/metadata.d.ts.map +1 -0
  19. package/dist/{utilities/meta.js → adapters/metadata.js} +61 -2
  20. package/dist/adapters/metadata.js.map +1 -0
  21. package/dist/{elements/RouterAdapter/index.d.ts → adapters/router.d.ts} +1 -1
  22. package/dist/adapters/router.d.ts.map +1 -0
  23. package/dist/{elements/RouterAdapter/index.js → adapters/router.js} +26 -4
  24. package/dist/adapters/router.js.map +1 -0
  25. package/dist/{utilities/serverAdapter.server.d.ts → adapters/server.d.ts} +1 -1
  26. package/dist/adapters/server.d.ts.map +1 -0
  27. package/dist/{utilities/serverAdapter.server.js → adapters/server.js} +1 -1
  28. package/dist/adapters/server.js.map +1 -0
  29. package/dist/{routes/adminRoutes.d.ts → adapters/views/index.d.ts} +11 -18
  30. package/dist/adapters/views/index.d.ts.map +1 -0
  31. package/dist/{routes/adminRoutes.js → adapters/views/index.js} +33 -61
  32. package/dist/adapters/views/index.js.map +1 -0
  33. package/dist/adapters/views/lazy.d.ts +4 -0
  34. package/dist/adapters/views/lazy.d.ts.map +1 -0
  35. package/dist/adapters/views/lazy.js +43 -0
  36. package/dist/adapters/views/lazy.js.map +1 -0
  37. package/dist/{utilities/loadAdminPage.d.ts → adapters/views/server.d.ts} +9 -6
  38. package/dist/adapters/views/server.d.ts.map +1 -0
  39. package/dist/{utilities/loadAdminPage.js → adapters/views/server.js} +16 -86
  40. package/dist/adapters/views/server.js.map +1 -0
  41. package/dist/auth/login.d.ts +3 -16
  42. package/dist/auth/login.d.ts.map +1 -1
  43. package/dist/auth/login.js +6 -46
  44. package/dist/auth/login.js.map +1 -1
  45. package/dist/auth/logout.d.ts +2 -5
  46. package/dist/auth/logout.d.ts.map +1 -1
  47. package/dist/auth/logout.js +6 -47
  48. package/dist/auth/logout.js.map +1 -1
  49. package/dist/auth/refresh.d.ts +2 -4
  50. package/dist/auth/refresh.d.ts.map +1 -1
  51. package/dist/auth/refresh.js +6 -49
  52. package/dist/auth/refresh.js.map +1 -1
  53. package/dist/exports/client.d.ts +2 -6
  54. package/dist/exports/client.d.ts.map +1 -1
  55. package/dist/exports/client.js +2 -6
  56. package/dist/exports/client.js.map +1 -1
  57. package/dist/exports/layouts.d.ts +2 -5
  58. package/dist/exports/layouts.d.ts.map +1 -1
  59. package/dist/exports/layouts.js +1 -3
  60. package/dist/exports/layouts.js.map +1 -1
  61. package/dist/exports/rsc.browser.d.ts +4 -1
  62. package/dist/exports/rsc.browser.d.ts.map +1 -1
  63. package/dist/exports/rsc.browser.js +4 -1
  64. package/dist/exports/rsc.browser.js.map +1 -1
  65. package/dist/exports/rsc.d.ts +0 -1
  66. package/dist/exports/rsc.d.ts.map +1 -1
  67. package/dist/exports/rsc.js +0 -1
  68. package/dist/exports/rsc.js.map +1 -1
  69. package/dist/exports/server.d.ts +9 -11
  70. package/dist/exports/server.d.ts.map +1 -1
  71. package/dist/exports/server.js +8 -10
  72. package/dist/exports/server.js.map +1 -1
  73. package/dist/exports/shared.d.ts +2 -0
  74. package/dist/exports/shared.d.ts.map +1 -0
  75. package/dist/exports/shared.js +3 -0
  76. package/dist/exports/shared.js.map +1 -0
  77. package/dist/index.d.ts +1 -5
  78. package/dist/index.d.ts.map +1 -1
  79. package/dist/index.js +1 -5
  80. package/dist/index.js.map +1 -1
  81. package/dist/{utilities/graphqlHandler.server.d.ts → routes/graphql/handler.server.d.ts} +1 -1
  82. package/dist/routes/graphql/handler.server.d.ts.map +1 -0
  83. package/dist/{utilities/graphqlHandler.server.js → routes/graphql/handler.server.js} +3 -3
  84. package/dist/routes/graphql/handler.server.js.map +1 -0
  85. package/dist/{utilities/handleAPIRoute.d.ts → routes/rest/handler.server.d.ts} +1 -1
  86. package/dist/routes/rest/handler.server.d.ts.map +1 -0
  87. package/dist/{utilities/handleAPIRoute.js → routes/rest/handler.server.js} +1 -1
  88. package/dist/routes/rest/handler.server.js.map +1 -0
  89. package/dist/routes/{apiRoute.d.ts → rest/index.d.ts} +6 -1
  90. package/dist/routes/rest/index.d.ts.map +1 -0
  91. package/dist/routes/{apiRoute.js → rest/index.js} +7 -2
  92. package/dist/routes/rest/index.js.map +1 -0
  93. package/dist/rsc/CollectionCards.js +1 -1
  94. package/dist/rsc/CollectionCards.js.map +1 -1
  95. package/dist/utilities/devConfigReload.server.d.ts +2 -0
  96. package/dist/utilities/devConfigReload.server.d.ts.map +1 -0
  97. package/dist/utilities/devConfigReload.server.js +63 -0
  98. package/dist/utilities/devConfigReload.server.js.map +1 -0
  99. package/dist/utilities/devConfigReloadEvent.d.ts +9 -0
  100. package/dist/utilities/devConfigReloadEvent.d.ts.map +1 -0
  101. package/dist/utilities/devConfigReloadEvent.js +9 -0
  102. package/dist/utilities/devConfigReloadEvent.js.map +1 -0
  103. package/dist/utilities/getRequestI18n.server.d.ts +1 -1
  104. package/dist/utilities/getRequestI18n.server.js +1 -1
  105. package/dist/utilities/getRequestI18n.server.js.map +1 -1
  106. package/dist/utilities/initAdminContext.server.d.ts +9 -0
  107. package/dist/utilities/initAdminContext.server.d.ts.map +1 -0
  108. package/dist/utilities/initAdminContext.server.js +13 -0
  109. package/dist/utilities/initAdminContext.server.js.map +1 -0
  110. package/dist/utilities/routerSearch.d.ts +40 -0
  111. package/dist/utilities/routerSearch.d.ts.map +1 -0
  112. package/dist/utilities/routerSearch.js +45 -0
  113. package/dist/utilities/routerSearch.js.map +1 -0
  114. package/dist/utilities/serializeForRsc.d.ts.map +1 -1
  115. package/dist/utilities/serializeForRsc.js +6 -1
  116. package/dist/utilities/serializeForRsc.js.map +1 -1
  117. package/dist/utilities/serverFunctionClient.d.ts.map +1 -1
  118. package/dist/utilities/serverFunctionClient.js +6 -1
  119. package/dist/utilities/serverFunctionClient.js.map +1 -1
  120. package/dist/utilities/toSerializable.d.ts +9 -0
  121. package/dist/utilities/toSerializable.d.ts.map +1 -1
  122. package/dist/utilities/toSerializable.js +19 -3
  123. package/dist/utilities/toSerializable.js.map +1 -1
  124. package/dist/withPayload/config/external.d.ts +44 -0
  125. package/dist/withPayload/config/external.d.ts.map +1 -0
  126. package/dist/withPayload/config/external.js +96 -0
  127. package/dist/withPayload/config/external.js.map +1 -0
  128. package/dist/withPayload/config/optimizeDeps.d.ts.map +1 -0
  129. package/dist/{vite → withPayload}/config/optimizeDeps.js +44 -7
  130. package/dist/withPayload/config/optimizeDeps.js.map +1 -0
  131. package/dist/withPayload/config/scss.d.ts.map +1 -0
  132. package/dist/withPayload/config/scss.js.map +1 -0
  133. package/dist/withPayload/devConfigReload.d.ts +14 -0
  134. package/dist/withPayload/devConfigReload.d.ts.map +1 -0
  135. package/dist/withPayload/devConfigReload.js +84 -0
  136. package/dist/withPayload/devConfigReload.js.map +1 -0
  137. package/dist/withPayload/importProtection.d.ts.map +1 -0
  138. package/dist/{vite → withPayload}/importProtection.js +2 -2
  139. package/dist/withPayload/importProtection.js.map +1 -0
  140. package/dist/{vite → withPayload}/index.d.ts +21 -10
  141. package/dist/withPayload/index.d.ts.map +1 -0
  142. package/dist/{vite → withPayload}/index.js +64 -22
  143. package/dist/withPayload/index.js.map +1 -0
  144. package/dist/withPayload/workarounds/clientModuleResolution.d.ts.map +1 -0
  145. package/dist/withPayload/workarounds/clientModuleResolution.js.map +1 -0
  146. package/dist/withPayload/workarounds/devTransforms.d.ts.map +1 -0
  147. package/dist/withPayload/workarounds/devTransforms.js.map +1 -0
  148. package/dist/withPayload/workarounds/reactDomServerInRsc.d.ts.map +1 -0
  149. package/dist/withPayload/workarounds/reactDomServerInRsc.js.map +1 -0
  150. package/dist/withPayload/workarounds/stripDistStyleImports.d.ts.map +1 -0
  151. package/dist/{vite → withPayload}/workarounds/stripDistStyleImports.js +2 -2
  152. package/dist/withPayload/workarounds/stripDistStyleImports.js.map +1 -0
  153. package/dist/withPayload/workarounds/stubPrettierInClient.d.ts.map +1 -0
  154. package/dist/withPayload/workarounds/stubPrettierInClient.js.map +1 -0
  155. package/dist/withPayload/workarounds/wrapCjsForClient.d.ts.map +1 -0
  156. package/dist/withPayload/workarounds/wrapCjsForClient.js.map +1 -0
  157. package/package.json +17 -17
  158. package/dist/elements/DocumentHeaderClient/index.d.ts +0 -16
  159. package/dist/elements/DocumentHeaderClient/index.d.ts.map +0 -1
  160. package/dist/elements/DocumentHeaderClient/index.js +0 -116
  161. package/dist/elements/DocumentHeaderClient/index.js.map +0 -1
  162. package/dist/elements/RenderComponent/index.d.ts +0 -10
  163. package/dist/elements/RenderComponent/index.d.ts.map +0 -1
  164. package/dist/elements/RenderComponent/index.js +0 -12
  165. package/dist/elements/RenderComponent/index.js.map +0 -1
  166. package/dist/elements/RouterAdapter/index.d.ts.map +0 -1
  167. package/dist/elements/RouterAdapter/index.js.map +0 -1
  168. package/dist/exports/vite.d.ts +0 -3
  169. package/dist/exports/vite.d.ts.map +0 -1
  170. package/dist/exports/vite.js +0 -3
  171. package/dist/exports/vite.js.map +0 -1
  172. package/dist/layouts/Root/getLayoutData.d.ts +0 -12
  173. package/dist/layouts/Root/getLayoutData.d.ts.map +0 -1
  174. package/dist/layouts/Root/getLayoutData.js +0 -91
  175. package/dist/layouts/Root/getLayoutData.js.map +0 -1
  176. package/dist/layouts/Root/index.d.ts +0 -32
  177. package/dist/layouts/Root/index.d.ts.map +0 -1
  178. package/dist/layouts/Root/index.js +0 -51
  179. package/dist/layouts/Root/index.js.map +0 -1
  180. package/dist/layouts/Root/withPayloadRoot.d.ts +0 -65
  181. package/dist/layouts/Root/withPayloadRoot.d.ts.map +0 -1
  182. package/dist/layouts/Root/withPayloadRoot.js +0 -92
  183. package/dist/layouts/Root/withPayloadRoot.js.map +0 -1
  184. package/dist/node/cssLoader.d.mts +0 -25
  185. package/dist/node/cssLoader.d.mts.map +0 -1
  186. package/dist/node/cssLoader.js +0 -70
  187. package/dist/node/cssLoader.js.map +0 -1
  188. package/dist/node/cssLoader.mjs +0 -75
  189. package/dist/node/registerCssLoader.d.mts +0 -2
  190. package/dist/node/registerCssLoader.d.mts.map +0 -1
  191. package/dist/node/registerCssLoader.js +0 -10
  192. package/dist/node/registerCssLoader.js.map +0 -1
  193. package/dist/node/registerCssLoader.mjs +0 -10
  194. package/dist/routes/adminRoutes.d.ts.map +0 -1
  195. package/dist/routes/adminRoutes.js.map +0 -1
  196. package/dist/routes/apiRoute.d.ts.map +0 -1
  197. package/dist/routes/apiRoute.js.map +0 -1
  198. package/dist/routes/layoutRoute.d.ts +0 -26
  199. package/dist/routes/layoutRoute.d.ts.map +0 -1
  200. package/dist/routes/layoutRoute.js +0 -57
  201. package/dist/routes/layoutRoute.js.map +0 -1
  202. package/dist/rsc/renderPayloadRSC.d.ts +0 -6
  203. package/dist/rsc/renderPayloadRSC.d.ts.map +0 -1
  204. package/dist/rsc/renderPayloadRSC.js +0 -6
  205. package/dist/rsc/renderPayloadRSC.js.map +0 -1
  206. package/dist/utilities/devReloadStrategy.d.ts +0 -10
  207. package/dist/utilities/devReloadStrategy.d.ts.map +0 -1
  208. package/dist/utilities/devReloadStrategy.js +0 -27
  209. package/dist/utilities/devReloadStrategy.js.map +0 -1
  210. package/dist/utilities/getExistingAuthToken.d.ts +0 -7
  211. package/dist/utilities/getExistingAuthToken.d.ts.map +0 -1
  212. package/dist/utilities/getExistingAuthToken.js +0 -18
  213. package/dist/utilities/getExistingAuthToken.js.map +0 -1
  214. package/dist/utilities/getPreferences.d.ts +0 -10
  215. package/dist/utilities/getPreferences.d.ts.map +0 -1
  216. package/dist/utilities/getPreferences.js +0 -33
  217. package/dist/utilities/getPreferences.js.map +0 -1
  218. package/dist/utilities/getRequestLocale.d.ts +0 -7
  219. package/dist/utilities/getRequestLocale.d.ts.map +0 -1
  220. package/dist/utilities/getRequestLocale.js +0 -20
  221. package/dist/utilities/getRequestLocale.js.map +0 -1
  222. package/dist/utilities/getRequestTheme.d.ts +0 -10
  223. package/dist/utilities/getRequestTheme.d.ts.map +0 -1
  224. package/dist/utilities/getRequestTheme.js +0 -25
  225. package/dist/utilities/getRequestTheme.js.map +0 -1
  226. package/dist/utilities/graphqlHandler.server.d.ts.map +0 -1
  227. package/dist/utilities/graphqlHandler.server.js.map +0 -1
  228. package/dist/utilities/handleAPIRoute.d.ts.map +0 -1
  229. package/dist/utilities/handleAPIRoute.js.map +0 -1
  230. package/dist/utilities/handleServerFunctions.d.ts +0 -20
  231. package/dist/utilities/handleServerFunctions.d.ts.map +0 -1
  232. package/dist/utilities/handleServerFunctions.js +0 -60
  233. package/dist/utilities/handleServerFunctions.js.map +0 -1
  234. package/dist/utilities/importMap.server.d.ts +0 -8
  235. package/dist/utilities/importMap.server.d.ts.map +0 -1
  236. package/dist/utilities/importMap.server.js +0 -11
  237. package/dist/utilities/importMap.server.js.map +0 -1
  238. package/dist/utilities/initReq.server.d.ts +0 -19
  239. package/dist/utilities/initReq.server.d.ts.map +0 -1
  240. package/dist/utilities/initReq.server.js +0 -87
  241. package/dist/utilities/initReq.server.js.map +0 -1
  242. package/dist/utilities/loadAdminPage.d.ts.map +0 -1
  243. package/dist/utilities/loadAdminPage.js.map +0 -1
  244. package/dist/utilities/loadLayoutData.d.ts +0 -15
  245. package/dist/utilities/loadLayoutData.d.ts.map +0 -1
  246. package/dist/utilities/loadLayoutData.js +0 -23
  247. package/dist/utilities/loadLayoutData.js.map +0 -1
  248. package/dist/utilities/meta.d.ts.map +0 -1
  249. package/dist/utilities/meta.js.map +0 -1
  250. package/dist/utilities/serverAdapter.server.d.ts.map +0 -1
  251. package/dist/utilities/serverAdapter.server.js.map +0 -1
  252. package/dist/utilities/serverFunctionHandlers.d.ts +0 -18
  253. package/dist/utilities/serverFunctionHandlers.d.ts.map +0 -1
  254. package/dist/utilities/serverFunctionHandlers.js +0 -17
  255. package/dist/utilities/serverFunctionHandlers.js.map +0 -1
  256. package/dist/utilities/setPayloadAuthCookie.d.ts +0 -9
  257. package/dist/utilities/setPayloadAuthCookie.d.ts.map +0 -1
  258. package/dist/utilities/setPayloadAuthCookie.js +0 -31
  259. package/dist/utilities/setPayloadAuthCookie.js.map +0 -1
  260. package/dist/vite/config/external.d.ts +0 -11
  261. package/dist/vite/config/external.d.ts.map +0 -1
  262. package/dist/vite/config/external.js +0 -48
  263. package/dist/vite/config/external.js.map +0 -1
  264. package/dist/vite/config/optimizeDeps.d.ts.map +0 -1
  265. package/dist/vite/config/optimizeDeps.js.map +0 -1
  266. package/dist/vite/config/scss.d.ts.map +0 -1
  267. package/dist/vite/config/scss.js.map +0 -1
  268. package/dist/vite/importProtection.d.ts.map +0 -1
  269. package/dist/vite/importProtection.js.map +0 -1
  270. package/dist/vite/index.d.ts.map +0 -1
  271. package/dist/vite/index.js.map +0 -1
  272. package/dist/vite/workarounds/clientModuleResolution.d.ts.map +0 -1
  273. package/dist/vite/workarounds/clientModuleResolution.js.map +0 -1
  274. package/dist/vite/workarounds/devTransforms.d.ts.map +0 -1
  275. package/dist/vite/workarounds/devTransforms.js.map +0 -1
  276. package/dist/vite/workarounds/reactDomServerInRsc.d.ts.map +0 -1
  277. package/dist/vite/workarounds/reactDomServerInRsc.js.map +0 -1
  278. package/dist/vite/workarounds/stripDistStyleImports.d.ts.map +0 -1
  279. package/dist/vite/workarounds/stripDistStyleImports.js.map +0 -1
  280. package/dist/vite/workarounds/stubPrettierInClient.d.ts.map +0 -1
  281. package/dist/vite/workarounds/stubPrettierInClient.js.map +0 -1
  282. package/dist/vite/workarounds/wrapCjsForClient.d.ts.map +0 -1
  283. package/dist/vite/workarounds/wrapCjsForClient.js.map +0 -1
  284. /package/dist/{vite → withPayload}/config/optimizeDeps.d.ts +0 -0
  285. /package/dist/{vite → withPayload}/config/scss.d.ts +0 -0
  286. /package/dist/{vite → withPayload}/config/scss.js +0 -0
  287. /package/dist/{vite → withPayload}/importProtection.d.ts +0 -0
  288. /package/dist/{vite → withPayload}/workarounds/clientModuleResolution.d.ts +0 -0
  289. /package/dist/{vite → withPayload}/workarounds/clientModuleResolution.js +0 -0
  290. /package/dist/{vite → withPayload}/workarounds/devTransforms.d.ts +0 -0
  291. /package/dist/{vite → withPayload}/workarounds/devTransforms.js +0 -0
  292. /package/dist/{vite → withPayload}/workarounds/reactDomServerInRsc.d.ts +0 -0
  293. /package/dist/{vite → withPayload}/workarounds/reactDomServerInRsc.js +0 -0
  294. /package/dist/{vite → withPayload}/workarounds/stripDistStyleImports.d.ts +0 -0
  295. /package/dist/{vite → withPayload}/workarounds/stubPrettierInClient.d.ts +0 -0
  296. /package/dist/{vite → withPayload}/workarounds/stubPrettierInClient.js +0 -0
  297. /package/dist/{vite → withPayload}/workarounds/wrapCjsForClient.d.ts +0 -0
  298. /package/dist/{vite → withPayload}/workarounds/wrapCjsForClient.js +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.server.d.ts","sourceRoot":"","sources":["../../../src/routes/rest/handler.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,EACnC,MAAM,EACN,OAAO,GACR,EAAE;IACD,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;CACjB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAapB"}
@@ -14,4 +14,4 @@ import { handleEndpoints } from 'payload';
14
14
  });
15
15
  }
16
16
 
17
- //# sourceMappingURL=handleAPIRoute.js.map
17
+ //# sourceMappingURL=handler.server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/routes/rest/handler.server.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport { handleEndpoints } from 'payload'\n\n/**\n * Routes a TanStack Start API request (`/api/*`) to Payload's REST/GraphQL\n * endpoint handler. The framework adapter wires this into the `/api/$` route's\n * server handlers, supplying the app's resolved `config`.\n */\nexport async function handleAPIRoute({\n config,\n request,\n}: {\n config: SanitizedConfig\n request: Request\n}): Promise<Response> {\n const url = new URL(request.url)\n const slugParts = url.pathname\n .replace(/^\\/api\\/?/, '')\n .split('/')\n .filter(Boolean)\n const path = slugParts.length ? `/api/${slugParts.join('/')}` : '/api'\n\n return handleEndpoints({\n config,\n path,\n request,\n })\n}\n"],"names":["handleEndpoints","handleAPIRoute","config","request","url","URL","slugParts","pathname","replace","split","filter","Boolean","path","length","join"],"mappings":"AAEA,SAASA,eAAe,QAAQ,UAAS;AAEzC;;;;CAIC,GACD,OAAO,eAAeC,eAAe,EACnCC,MAAM,EACNC,OAAO,EAIR;IACC,MAAMC,MAAM,IAAIC,IAAIF,QAAQC,GAAG;IAC/B,MAAME,YAAYF,IAAIG,QAAQ,CAC3BC,OAAO,CAAC,aAAa,IACrBC,KAAK,CAAC,KACNC,MAAM,CAACC;IACV,MAAMC,OAAON,UAAUO,MAAM,GAAG,CAAC,KAAK,EAAEP,UAAUQ,IAAI,CAAC,MAAM,GAAG;IAEhE,OAAOd,gBAAgB;QACrBE;QACAU;QACAT;IACF;AACF"}
@@ -7,10 +7,15 @@ type ApiRouteHandler = (ctx: {
7
7
  * (`/_payload/api/$`). The app supplies `getConfig` (an `@payload-config`
8
8
  * import) since the package cannot resolve the consumer's config.
9
9
  *
10
+ * Imported from `@payloadcms/tanstack-start/server` (not the root barrel) so
11
+ * the server-only `handleAPIRoute` graph never reaches the client bundle.
12
+ *
10
13
  * Spread the result into a literal `server.handlers` key so TanStack Start's
11
14
  * client compiler can statically see — and prune — the server-only route:
12
15
  *
13
16
  * ```ts
17
+ * import { payloadApiHandlers } from '@payloadcms/tanstack-start/server'
18
+ *
14
19
  * export const Route = createFileRoute('/_payload/api/$')({
15
20
  * server: {
16
21
  * handlers: payloadApiHandlers({ getConfig: async () => (await import('@payload-config')).default }),
@@ -26,4 +31,4 @@ export declare function payloadApiHandlers({ getConfig, }: {
26
31
  getConfig: () => Promise<SanitizedConfig>;
27
32
  }): Record<'DELETE' | 'GET' | 'OPTIONS' | 'PATCH' | 'POST' | 'PUT', ApiRouteHandler>;
28
33
  export {};
29
- //# sourceMappingURL=apiRoute.d.ts.map
34
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/rest/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,KAAK,eAAe,GAAG,CAAC,GAAG,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,SAAS,GACV,EAAE;IACD,SAAS,EAAE,MAAM,OAAO,CAAC,eAAe,CAAC,CAAA;CAC1C,GAAG,MAAM,CAAC,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,EAAE,eAAe,CAAC,CAcnF"}
@@ -3,10 +3,15 @@
3
3
  * (`/_payload/api/$`). The app supplies `getConfig` (an `@payload-config`
4
4
  * import) since the package cannot resolve the consumer's config.
5
5
  *
6
+ * Imported from `@payloadcms/tanstack-start/server` (not the root barrel) so
7
+ * the server-only `handleAPIRoute` graph never reaches the client bundle.
8
+ *
6
9
  * Spread the result into a literal `server.handlers` key so TanStack Start's
7
10
  * client compiler can statically see — and prune — the server-only route:
8
11
  *
9
12
  * ```ts
13
+ * import { payloadApiHandlers } from '@payloadcms/tanstack-start/server'
14
+ *
10
15
  * export const Route = createFileRoute('/_payload/api/$')({
11
16
  * server: {
12
17
  * handlers: payloadApiHandlers({ getConfig: async () => (await import('@payload-config')).default }),
@@ -19,7 +24,7 @@
19
24
  * key, leaking the config graph into the client bundle.
20
25
  */ export function payloadApiHandlers({ getConfig }) {
21
26
  const handler = async ({ request })=>{
22
- const { handleAPIRoute } = await import('../utilities/handleAPIRoute.js');
27
+ const { handleAPIRoute } = await import('./handler.server.js');
23
28
  return handleAPIRoute({
24
29
  config: await getConfig(),
25
30
  request
@@ -35,4 +40,4 @@
35
40
  };
36
41
  }
37
42
 
38
- //# sourceMappingURL=apiRoute.js.map
43
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/routes/rest/index.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\ntype ApiRouteHandler = (ctx: { request: Request }) => Promise<Response>\n\n/**\n * Builds the method handlers for the Payload REST/GraphQL catch-all\n * (`/_payload/api/$`). The app supplies `getConfig` (an `@payload-config`\n * import) since the package cannot resolve the consumer's config.\n *\n * Imported from `@payloadcms/tanstack-start/server` (not the root barrel) so\n * the server-only `handleAPIRoute` graph never reaches the client bundle.\n *\n * Spread the result into a literal `server.handlers` key so TanStack Start's\n * client compiler can statically see — and prune — the server-only route:\n *\n * ```ts\n * import { payloadApiHandlers } from '@payloadcms/tanstack-start/server'\n *\n * export const Route = createFileRoute('/_payload/api/$')({\n * server: {\n * handlers: payloadApiHandlers({ getConfig: async () => (await import('@payload-config')).default }),\n * },\n * })\n * ```\n *\n * The compiler only strips a literal `server:` key from a route-options object\n * expression; wrapping the whole options object in a factory call hides the\n * key, leaking the config graph into the client bundle.\n */\nexport function payloadApiHandlers({\n getConfig,\n}: {\n getConfig: () => Promise<SanitizedConfig>\n}): Record<'DELETE' | 'GET' | 'OPTIONS' | 'PATCH' | 'POST' | 'PUT', ApiRouteHandler> {\n const handler: ApiRouteHandler = async ({ request }) => {\n const { handleAPIRoute } = await import('./handler.server.js')\n return handleAPIRoute({ config: await getConfig(), request })\n }\n\n return {\n DELETE: handler,\n GET: handler,\n OPTIONS: handler,\n PATCH: handler,\n POST: handler,\n PUT: handler,\n }\n}\n"],"names":["payloadApiHandlers","getConfig","handler","request","handleAPIRoute","config","DELETE","GET","OPTIONS","PATCH","POST","PUT"],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;CAwBC,GACD,OAAO,SAASA,mBAAmB,EACjCC,SAAS,EAGV;IACC,MAAMC,UAA2B,OAAO,EAAEC,OAAO,EAAE;QACjD,MAAM,EAAEC,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC;QACxC,OAAOA,eAAe;YAAEC,QAAQ,MAAMJ;YAAaE;QAAQ;IAC7D;IAEA,OAAO;QACLG,QAAQJ;QACRK,KAAKL;QACLM,SAASN;QACTO,OAAOP;QACPQ,MAAMR;QACNS,KAAKT;IACP;AACF"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { CollectionCardsClient } from '@payloadcms/ui';
2
3
  import { getCollectionCardsData } from '@payloadcms/ui/server';
3
- import { CollectionCardsClient } from '@payloadcms/ui/widgets/CollectionCards/index.client';
4
4
  import React from 'react';
5
5
  export async function CollectionCards(props) {
6
6
  const data = await getCollectionCardsData(props.req);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/rsc/CollectionCards.tsx"],"sourcesContent":["import type { WidgetServerProps } from 'payload'\n\nimport { getCollectionCardsData } from '@payloadcms/ui/server'\nimport { CollectionCardsClient } from '@payloadcms/ui/widgets/CollectionCards/index.client'\nimport React from 'react'\n\nexport async function CollectionCards(props: WidgetServerProps) {\n const data = await getCollectionCardsData(props.req)\n\n return <CollectionCardsClient {...data} />\n}\n"],"names":["getCollectionCardsData","CollectionCardsClient","React","CollectionCards","props","data","req"],"mappings":";AAEA,SAASA,sBAAsB,QAAQ,wBAAuB;AAC9D,SAASC,qBAAqB,QAAQ,sDAAqD;AAC3F,OAAOC,WAAW,QAAO;AAEzB,OAAO,eAAeC,gBAAgBC,KAAwB;IAC5D,MAAMC,OAAO,MAAML,uBAAuBI,MAAME,GAAG;IAEnD,qBAAO,KAACL;QAAuB,GAAGI,IAAI;;AACxC"}
1
+ {"version":3,"sources":["../../src/rsc/CollectionCards.tsx"],"sourcesContent":["import type { WidgetServerProps } from 'payload'\n\nimport { CollectionCardsClient } from '@payloadcms/ui'\nimport { getCollectionCardsData } from '@payloadcms/ui/server'\nimport React from 'react'\n\nexport async function CollectionCards(props: WidgetServerProps) {\n const data = await getCollectionCardsData(props.req)\n\n return <CollectionCardsClient {...data} />\n}\n"],"names":["CollectionCardsClient","getCollectionCardsData","React","CollectionCards","props","data","req"],"mappings":";AAEA,SAASA,qBAAqB,QAAQ,iBAAgB;AACtD,SAASC,sBAAsB,QAAQ,wBAAuB;AAC9D,OAAOC,WAAW,QAAO;AAEzB,OAAO,eAAeC,gBAAgBC,KAAwB;IAC5D,MAAMC,OAAO,MAAMJ,uBAAuBG,MAAME,GAAG;IAEnD,qBAAO,KAACN;QAAuB,GAAGK,IAAI;;AACxC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=devConfigReload.server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devConfigReload.server.d.ts","sourceRoot":"","sources":["../../src/utilities/devConfigReload.server.ts"],"names":[],"mappings":""}
@@ -0,0 +1,63 @@
1
+ import { registerDevReloadStrategy } from 'payload';
2
+ import { PAYLOAD_CONFIG_CHANGED_EVENT } from './devConfigReloadEvent.js';
3
+ /**
4
+ * Subscribes the Payload instance to the config-changed event that the
5
+ * `payload:dev-config-reload` Vite plugin broadcasts.
6
+ *
7
+ * Imported for its side effect by `initAdminContext.server.ts`, the adapter's only
8
+ * `getPayload` call site, so the strategy is registered before an instance can
9
+ * be built. Registration is module-scoped on both ends: this runs inside the
10
+ * app's server graph and so resolves the same copy of `payload` that
11
+ * `getPayload` is called on, and each Vite environment (`ssr`, `rsc`) registers
12
+ * its own listener against its own copy.
13
+ *
14
+ * Vite re-evaluates this module on a program reload, which drops the listeners
15
+ * the previous instance had collected. `getPayload` reconnects on its next call
16
+ * because the registered strategy is a new object - see `connectDevReload`.
17
+ *
18
+ * `import.meta.hot` is only defined during dev serve, so this is inert in a
19
+ * production build.
20
+ */ const hot = import.meta.hot;
21
+ if (hot) {
22
+ registerDevReloadStrategy(createConfigChangedStrategy({
23
+ hot
24
+ }));
25
+ }
26
+ /**
27
+ * Builds a dev reload strategy that forwards the config-changed event to every
28
+ * connected instance.
29
+ *
30
+ * After a program reload, the first request to re-import this module replaces
31
+ * the old listener with a new one, but the cached Payload instance only connects
32
+ * to it on its next `getPayload` call - and a request such as a frontend page
33
+ * render may never make one. An event that lands in that gap has no one to
34
+ * notify, so it is held and replayed to the next connection instead of being
35
+ * dropped - which would otherwise leave the instance serving the old config
36
+ * indefinitely.
37
+ */ function createConfigChangedStrategy({ hot }) {
38
+ const listeners = new Set();
39
+ let hasPendingReload = false;
40
+ hot.on(PAYLOAD_CONFIG_CHANGED_EVENT, ()=>{
41
+ if (listeners.size === 0) {
42
+ hasPendingReload = true;
43
+ return;
44
+ }
45
+ for (const onReload of listeners){
46
+ onReload();
47
+ }
48
+ });
49
+ return {
50
+ connect: (onReload)=>{
51
+ listeners.add(onReload);
52
+ if (hasPendingReload) {
53
+ hasPendingReload = false;
54
+ onReload();
55
+ }
56
+ return ()=>{
57
+ listeners.delete(onReload);
58
+ };
59
+ }
60
+ };
61
+ }
62
+
63
+ //# sourceMappingURL=devConfigReload.server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utilities/devConfigReload.server.ts"],"sourcesContent":["import { registerDevReloadStrategy } from 'payload'\n\nimport { PAYLOAD_CONFIG_CHANGED_EVENT } from './devConfigReloadEvent.js'\n\n/**\n * Subscribes the Payload instance to the config-changed event that the\n * `payload:dev-config-reload` Vite plugin broadcasts.\n *\n * Imported for its side effect by `initAdminContext.server.ts`, the adapter's only\n * `getPayload` call site, so the strategy is registered before an instance can\n * be built. Registration is module-scoped on both ends: this runs inside the\n * app's server graph and so resolves the same copy of `payload` that\n * `getPayload` is called on, and each Vite environment (`ssr`, `rsc`) registers\n * its own listener against its own copy.\n *\n * Vite re-evaluates this module on a program reload, which drops the listeners\n * the previous instance had collected. `getPayload` reconnects on its next call\n * because the registered strategy is a new object - see `connectDevReload`.\n *\n * `import.meta.hot` is only defined during dev serve, so this is inert in a\n * production build.\n */\nconst hot = (import.meta as unknown as { hot?: ViteHotContext }).hot\n\nif (hot) {\n registerDevReloadStrategy(createConfigChangedStrategy({ hot }))\n}\n\n/**\n * Builds a dev reload strategy that forwards the config-changed event to every\n * connected instance.\n *\n * After a program reload, the first request to re-import this module replaces\n * the old listener with a new one, but the cached Payload instance only connects\n * to it on its next `getPayload` call - and a request such as a frontend page\n * render may never make one. An event that lands in that gap has no one to\n * notify, so it is held and replayed to the next connection instead of being\n * dropped - which would otherwise leave the instance serving the old config\n * indefinitely.\n */\nfunction createConfigChangedStrategy({ hot }: { hot: ViteHotContext }): {\n connect: (onReload: () => void) => () => void\n} {\n const listeners = new Set<() => void>()\n let hasPendingReload = false\n\n hot.on(PAYLOAD_CONFIG_CHANGED_EVENT, () => {\n if (listeners.size === 0) {\n hasPendingReload = true\n return\n }\n\n for (const onReload of listeners) {\n onReload()\n }\n })\n\n return {\n connect: (onReload) => {\n listeners.add(onReload)\n\n if (hasPendingReload) {\n hasPendingReload = false\n onReload()\n }\n\n return () => {\n listeners.delete(onReload)\n }\n },\n }\n}\n\ntype ViteHotContext = {\n on: (event: string, cb: () => void) => void\n}\n"],"names":["registerDevReloadStrategy","PAYLOAD_CONFIG_CHANGED_EVENT","hot","createConfigChangedStrategy","listeners","Set","hasPendingReload","on","size","onReload","connect","add","delete"],"mappings":"AAAA,SAASA,yBAAyB,QAAQ,UAAS;AAEnD,SAASC,4BAA4B,QAAQ,4BAA2B;AAExE;;;;;;;;;;;;;;;;;CAiBC,GACD,MAAMC,MAAM,AAAC,YAAoDA,GAAG;AAEpE,IAAIA,KAAK;IACPF,0BAA0BG,4BAA4B;QAAED;IAAI;AAC9D;AAEA;;;;;;;;;;;CAWC,GACD,SAASC,4BAA4B,EAAED,GAAG,EAA2B;IAGnE,MAAME,YAAY,IAAIC;IACtB,IAAIC,mBAAmB;IAEvBJ,IAAIK,EAAE,CAACN,8BAA8B;QACnC,IAAIG,UAAUI,IAAI,KAAK,GAAG;YACxBF,mBAAmB;YACnB;QACF;QAEA,KAAK,MAAMG,YAAYL,UAAW;YAChCK;QACF;IACF;IAEA,OAAO;QACLC,SAAS,CAACD;YACRL,UAAUO,GAAG,CAACF;YAEd,IAAIH,kBAAkB;gBACpBA,mBAAmB;gBACnBG;YACF;YAEA,OAAO;gBACLL,UAAUQ,MAAM,CAACH;YACnB;QACF;IACF;AACF"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Custom Vite HMR event the `payload:dev-config-reload` plugin broadcasts when
3
+ * the Payload config (or anything it imports) changes on disk.
4
+ *
5
+ * Kept in its own module so the Vite plugin can name the event without pulling
6
+ * in the server runtime — and therefore the whole CMS — when `vite.config.ts` loads.
7
+ */
8
+ export declare const PAYLOAD_CONFIG_CHANGED_EVENT = "payload:config-changed";
9
+ //# sourceMappingURL=devConfigReloadEvent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devConfigReloadEvent.d.ts","sourceRoot":"","sources":["../../src/utilities/devConfigReloadEvent.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,2BAA2B,CAAA"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Custom Vite HMR event the `payload:dev-config-reload` plugin broadcasts when
3
+ * the Payload config (or anything it imports) changes on disk.
4
+ *
5
+ * Kept in its own module so the Vite plugin can name the event without pulling
6
+ * in the server runtime — and therefore the whole CMS — when `vite.config.ts` loads.
7
+ */ export const PAYLOAD_CONFIG_CHANGED_EVENT = 'payload:config-changed';
8
+
9
+ //# sourceMappingURL=devConfigReloadEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utilities/devConfigReloadEvent.ts"],"sourcesContent":["/**\n * Custom Vite HMR event the `payload:dev-config-reload` plugin broadcasts when\n * the Payload config (or anything it imports) changes on disk.\n *\n * Kept in its own module so the Vite plugin can name the event without pulling\n * in the server runtime — and therefore the whole CMS — when `vite.config.ts` loads.\n */\nexport const PAYLOAD_CONFIG_CHANGED_EVENT = 'payload:config-changed'\n"],"names":["PAYLOAD_CONFIG_CHANGED_EVENT"],"mappings":"AAAA;;;;;;CAMC,GACD,OAAO,MAAMA,+BAA+B,yBAAwB"}
@@ -2,7 +2,7 @@ import type { I18nClient } from '@payloadcms/translations';
2
2
  import type { SanitizedConfig } from 'payload';
3
3
  /**
4
4
  * Resolves the client `I18n` for the current TanStack Start request without a
5
- * full `initReq` (no `getPayload`/auth/access). Mirrors the Next.js adapter's
5
+ * full `initAdminContext` (no `getPayload`/auth/access). Mirrors the Next.js adapter's
6
6
  * `getNextRequestI18n` and feeds the shared `generatePageMetadata`, which only
7
7
  * needs `config` + `i18n` to translate admin-page titles.
8
8
  */
@@ -3,7 +3,7 @@ import { getRequest } from '@tanstack/react-start/server';
3
3
  import { getRequestLanguage, parseCookies } from 'payload';
4
4
  /**
5
5
  * Resolves the client `I18n` for the current TanStack Start request without a
6
- * full `initReq` (no `getPayload`/auth/access). Mirrors the Next.js adapter's
6
+ * full `initAdminContext` (no `getPayload`/auth/access). Mirrors the Next.js adapter's
7
7
  * `getNextRequestI18n` and feeds the shared `generatePageMetadata`, which only
8
8
  * needs `config` + `i18n` to translate admin-page titles.
9
9
  */ export async function getRequestI18n({ config }) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/getRequestI18n.server.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { SanitizedConfig } from 'payload'\n\nimport { initI18n } from '@payloadcms/translations'\nimport { getRequest } from '@tanstack/react-start/server'\nimport { getRequestLanguage, parseCookies } from 'payload'\n\n/**\n * Resolves the client `I18n` for the current TanStack Start request without a\n * full `initReq` (no `getPayload`/auth/access). Mirrors the Next.js adapter's\n * `getNextRequestI18n` and feeds the shared `generatePageMetadata`, which only\n * needs `config` + `i18n` to translate admin-page titles.\n */\nexport async function getRequestI18n({ config }: { config: SanitizedConfig }): Promise<I18nClient> {\n const webRequest = getRequest()\n const headers = new Headers(webRequest.headers)\n const cookies = parseCookies(headers)\n\n const languageCode = getRequestLanguage({ config, cookies, headers })\n\n return initI18n({\n config: config.i18n,\n context: 'client',\n language: languageCode,\n })\n}\n"],"names":["initI18n","getRequest","getRequestLanguage","parseCookies","getRequestI18n","config","webRequest","headers","Headers","cookies","languageCode","i18n","context","language"],"mappings":"AAGA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,UAAU,QAAQ,+BAA8B;AACzD,SAASC,kBAAkB,EAAEC,YAAY,QAAQ,UAAS;AAE1D;;;;;CAKC,GACD,OAAO,eAAeC,eAAe,EAAEC,MAAM,EAA+B;IAC1E,MAAMC,aAAaL;IACnB,MAAMM,UAAU,IAAIC,QAAQF,WAAWC,OAAO;IAC9C,MAAME,UAAUN,aAAaI;IAE7B,MAAMG,eAAeR,mBAAmB;QAAEG;QAAQI;QAASF;IAAQ;IAEnE,OAAOP,SAAS;QACdK,QAAQA,OAAOM,IAAI;QACnBC,SAAS;QACTC,UAAUH;IACZ;AACF"}
1
+ {"version":3,"sources":["../../src/utilities/getRequestI18n.server.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { SanitizedConfig } from 'payload'\n\nimport { initI18n } from '@payloadcms/translations'\nimport { getRequest } from '@tanstack/react-start/server'\nimport { getRequestLanguage, parseCookies } from 'payload'\n\n/**\n * Resolves the client `I18n` for the current TanStack Start request without a\n * full `initAdminContext` (no `getPayload`/auth/access). Mirrors the Next.js adapter's\n * `getNextRequestI18n` and feeds the shared `generatePageMetadata`, which only\n * needs `config` + `i18n` to translate admin-page titles.\n */\nexport async function getRequestI18n({ config }: { config: SanitizedConfig }): Promise<I18nClient> {\n const webRequest = getRequest()\n const headers = new Headers(webRequest.headers)\n const cookies = parseCookies(headers)\n\n const languageCode = getRequestLanguage({ config, cookies, headers })\n\n return initI18n({\n config: config.i18n,\n context: 'client',\n language: languageCode,\n })\n}\n"],"names":["initI18n","getRequest","getRequestLanguage","parseCookies","getRequestI18n","config","webRequest","headers","Headers","cookies","languageCode","i18n","context","language"],"mappings":"AAGA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,UAAU,QAAQ,+BAA8B;AACzD,SAASC,kBAAkB,EAAEC,YAAY,QAAQ,UAAS;AAE1D;;;;;CAKC,GACD,OAAO,eAAeC,eAAe,EAAEC,MAAM,EAA+B;IAC1E,MAAMC,aAAaL;IACnB,MAAMM,UAAU,IAAIC,QAAQF,WAAWC,OAAO;IAC9C,MAAME,UAAUN,aAAaI;IAE7B,MAAMG,eAAeR,mBAAmB;QAAEG;QAAQI;QAASF;IAAQ;IAEnE,OAAOP,SAAS;QACdK,QAAQA,OAAOM,IAAI;QACnBC,SAAS;QACTC,UAAUH;IACZ;AACF"}
@@ -0,0 +1,9 @@
1
+ import type { ServerAdapter } from 'payload';
2
+ import type { InitAdminContextArgs } from 'payload/internal';
3
+ import './devConfigReload.server.js';
4
+ type TanStackInitAdminContextArgs = {
5
+ serverAdapter?: ServerAdapter;
6
+ } & Omit<InitAdminContextArgs, 'cache' | 'requestURL' | 'serverAdapter'>;
7
+ export declare const initAdminContext: ({ serverAdapter, ...args }: TanStackInitAdminContextArgs) => Promise<import("payload").AdminContext>;
8
+ export {};
9
+ //# sourceMappingURL=initAdminContext.server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initAdminContext.server.d.ts","sourceRoot":"","sources":["../../src/utilities/initAdminContext.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAO5D,OAAO,6BAA6B,CAAA;AAGpC,KAAK,4BAA4B,GAAG;IAClC,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B,GAAG,IAAI,CAAC,oBAAoB,EAAE,OAAO,GAAG,YAAY,GAAG,eAAe,CAAC,CAAA;AAExE,eAAO,MAAM,gBAAgB,+BAG1B,4BAA4B,4CAK3B,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { getRequest } from '@tanstack/react-start/server';
2
+ import { initAdminContext as initPayloadAdminContext } from 'payload/internal';
3
+ // Registers the dev reload strategy before `initPayloadAdminContext` can build an instance.
4
+ // Side-effect only, and a no-op outside of dev serve.
5
+ import './devConfigReload.server.js';
6
+ import { tanstackServerAdapter } from '../adapters/server.js';
7
+ export const initAdminContext = ({ serverAdapter = tanstackServerAdapter, ...args })=>initPayloadAdminContext({
8
+ ...args,
9
+ requestURL: getRequest().url,
10
+ serverAdapter
11
+ });
12
+
13
+ //# sourceMappingURL=initAdminContext.server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utilities/initAdminContext.server.ts"],"sourcesContent":["import type { ServerAdapter } from 'payload'\nimport type { InitAdminContextArgs } from 'payload/internal'\n\nimport { getRequest } from '@tanstack/react-start/server'\nimport { initAdminContext as initPayloadAdminContext } from 'payload/internal'\n\n// Registers the dev reload strategy before `initPayloadAdminContext` can build an instance.\n// Side-effect only, and a no-op outside of dev serve.\nimport './devConfigReload.server.js'\nimport { tanstackServerAdapter } from '../adapters/server.js'\n\ntype TanStackInitAdminContextArgs = {\n serverAdapter?: ServerAdapter\n} & Omit<InitAdminContextArgs, 'cache' | 'requestURL' | 'serverAdapter'>\n\nexport const initAdminContext = ({\n serverAdapter = tanstackServerAdapter,\n ...args\n}: TanStackInitAdminContextArgs) =>\n initPayloadAdminContext({\n ...args,\n requestURL: getRequest().url,\n serverAdapter,\n })\n"],"names":["getRequest","initAdminContext","initPayloadAdminContext","tanstackServerAdapter","serverAdapter","args","requestURL","url"],"mappings":"AAGA,SAASA,UAAU,QAAQ,+BAA8B;AACzD,SAASC,oBAAoBC,uBAAuB,QAAQ,mBAAkB;AAE9E,4FAA4F;AAC5F,sDAAsD;AACtD,OAAO,8BAA6B;AACpC,SAASC,qBAAqB,QAAQ,wBAAuB;AAM7D,OAAO,MAAMF,mBAAmB,CAAC,EAC/BG,gBAAgBD,qBAAqB,EACrC,GAAGE,MAC0B,GAC7BH,wBAAwB;QACtB,GAAGG,IAAI;QACPC,YAAYN,aAAaO,GAAG;QAC5BH;IACF,GAAE"}
@@ -0,0 +1,40 @@
1
+ import * as qs from 'qs-esm';
2
+ /**
3
+ * `parseSearch` for TanStack Router's `createRouter`, required for Payload's
4
+ * admin UI. Pair with {@link payloadStringifySearch}.
5
+ *
6
+ * Payload serializes query state (notably the list-view `where` filter) with
7
+ * `qs` bracket notation — e.g. `?where[or][0][and][0][x][equals]=y`. TanStack
8
+ * Router's default serializer treats each bracketed string as a flat key and
9
+ * JSON-encodes values, so it never round-trips Payload's nested query: every
10
+ * navigation re-encodes the already-encoded value, exponentially nesting it
11
+ * (`[true,"[true,\"[true…"]`) until the filter is unusable. Parsing and
12
+ * stringifying with `qs` (same options as `payload`/`@payloadcms/ui`) keeps
13
+ * the URL idempotent and the nested `where` intact across navigations.
14
+ *
15
+ * This is a router-global serializer: it applies to every route, not just
16
+ * `/admin`. On your own routes, search values arrive as strings (qs does no
17
+ * JSON type-coercion), so coerce in `validateSearch` (e.g. `Number(...)`) where
18
+ * you need numbers or booleans.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * import { createRouter } from '@tanstack/react-router'
23
+ * import { payloadParseSearch, payloadStringifySearch } from '@payloadcms/tanstack-start/shared'
24
+ *
25
+ * export function getRouter() {
26
+ * return createRouter({
27
+ * parseSearch: payloadParseSearch,
28
+ * routeTree,
29
+ * stringifySearch: payloadStringifySearch,
30
+ * })
31
+ * }
32
+ * ```
33
+ */
34
+ export declare const payloadParseSearch: (searchStr: string) => qs.ParsedQs;
35
+ /**
36
+ * `stringifySearch` for TanStack Router's `createRouter`, required for Payload's
37
+ * admin UI. Pair with {@link payloadParseSearch}; see it for the full rationale.
38
+ */
39
+ export declare const payloadStringifySearch: (search: Record<string, unknown>) => string;
40
+ //# sourceMappingURL=routerSearch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routerSearch.d.ts","sourceRoot":"","sources":["../../src/utilities/routerSearch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,QAAQ,CAAA;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,kBAAkB,cAAe,MAAM,gBACS,CAAA;AAE7D;;;GAGG;AACH,eAAO,MAAM,sBAAsB,WAAY,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,WAGrE,CAAA"}
@@ -0,0 +1,45 @@
1
+ import * as qs from 'qs-esm';
2
+ /**
3
+ * `parseSearch` for TanStack Router's `createRouter`, required for Payload's
4
+ * admin UI. Pair with {@link payloadStringifySearch}.
5
+ *
6
+ * Payload serializes query state (notably the list-view `where` filter) with
7
+ * `qs` bracket notation — e.g. `?where[or][0][and][0][x][equals]=y`. TanStack
8
+ * Router's default serializer treats each bracketed string as a flat key and
9
+ * JSON-encodes values, so it never round-trips Payload's nested query: every
10
+ * navigation re-encodes the already-encoded value, exponentially nesting it
11
+ * (`[true,"[true,\"[true…"]`) until the filter is unusable. Parsing and
12
+ * stringifying with `qs` (same options as `payload`/`@payloadcms/ui`) keeps
13
+ * the URL idempotent and the nested `where` intact across navigations.
14
+ *
15
+ * This is a router-global serializer: it applies to every route, not just
16
+ * `/admin`. On your own routes, search values arrive as strings (qs does no
17
+ * JSON type-coercion), so coerce in `validateSearch` (e.g. `Number(...)`) where
18
+ * you need numbers or booleans.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * import { createRouter } from '@tanstack/react-router'
23
+ * import { payloadParseSearch, payloadStringifySearch } from '@payloadcms/tanstack-start/shared'
24
+ *
25
+ * export function getRouter() {
26
+ * return createRouter({
27
+ * parseSearch: payloadParseSearch,
28
+ * routeTree,
29
+ * stringifySearch: payloadStringifySearch,
30
+ * })
31
+ * }
32
+ * ```
33
+ */ export const payloadParseSearch = (searchStr)=>qs.parse(searchStr, {
34
+ depth: 10,
35
+ ignoreQueryPrefix: true
36
+ });
37
+ /**
38
+ * `stringifySearch` for TanStack Router's `createRouter`, required for Payload's
39
+ * admin UI. Pair with {@link payloadParseSearch}; see it for the full rationale.
40
+ */ export const payloadStringifySearch = (search)=>{
41
+ const searchStr = qs.stringify(search);
42
+ return searchStr ? `?${searchStr}` : '';
43
+ };
44
+
45
+ //# sourceMappingURL=routerSearch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utilities/routerSearch.ts"],"sourcesContent":["import * as qs from 'qs-esm'\n\n/**\n * `parseSearch` for TanStack Router's `createRouter`, required for Payload's\n * admin UI. Pair with {@link payloadStringifySearch}.\n *\n * Payload serializes query state (notably the list-view `where` filter) with\n * `qs` bracket notation — e.g. `?where[or][0][and][0][x][equals]=y`. TanStack\n * Router's default serializer treats each bracketed string as a flat key and\n * JSON-encodes values, so it never round-trips Payload's nested query: every\n * navigation re-encodes the already-encoded value, exponentially nesting it\n * (`[true,\"[true,\\\"[true…\"]`) until the filter is unusable. Parsing and\n * stringifying with `qs` (same options as `payload`/`@payloadcms/ui`) keeps\n * the URL idempotent and the nested `where` intact across navigations.\n *\n * This is a router-global serializer: it applies to every route, not just\n * `/admin`. On your own routes, search values arrive as strings (qs does no\n * JSON type-coercion), so coerce in `validateSearch` (e.g. `Number(...)`) where\n * you need numbers or booleans.\n *\n * @example\n * ```ts\n * import { createRouter } from '@tanstack/react-router'\n * import { payloadParseSearch, payloadStringifySearch } from '@payloadcms/tanstack-start/shared'\n *\n * export function getRouter() {\n * return createRouter({\n * parseSearch: payloadParseSearch,\n * routeTree,\n * stringifySearch: payloadStringifySearch,\n * })\n * }\n * ```\n */\nexport const payloadParseSearch = (searchStr: string) =>\n qs.parse(searchStr, { depth: 10, ignoreQueryPrefix: true })\n\n/**\n * `stringifySearch` for TanStack Router's `createRouter`, required for Payload's\n * admin UI. Pair with {@link payloadParseSearch}; see it for the full rationale.\n */\nexport const payloadStringifySearch = (search: Record<string, unknown>) => {\n const searchStr = qs.stringify(search)\n return searchStr ? `?${searchStr}` : ''\n}\n"],"names":["qs","payloadParseSearch","searchStr","parse","depth","ignoreQueryPrefix","payloadStringifySearch","search","stringify"],"mappings":"AAAA,YAAYA,QAAQ,SAAQ;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BC,GACD,OAAO,MAAMC,qBAAqB,CAACC,YACjCF,GAAGG,KAAK,CAACD,WAAW;QAAEE,OAAO;QAAIC,mBAAmB;IAAK,GAAE;AAE7D;;;CAGC,GACD,OAAO,MAAMC,yBAAyB,CAACC;IACrC,MAAML,YAAYF,GAAGQ,SAAS,CAACD;IAC/B,OAAOL,YAAY,CAAC,CAAC,EAAEA,WAAW,GAAG;AACvC,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"serializeForRsc.d.ts","sourceRoot":"","sources":["../../src/utilities/serializeForRsc.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAE7D"}
1
+ {"version":3,"file":"serializeForRsc.d.ts","sourceRoot":"","sources":["../../src/utilities/serializeForRsc.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAE7D"}
@@ -1,4 +1,5 @@
1
1
  import { renderServerComponent } from '@tanstack/react-start/rsc';
2
+ import { setOwnProperty } from 'payload/shared';
2
3
  import { createElement, Fragment } from 'react';
3
4
  /**
4
5
  * Recursively walk a server-function return value and prepare it for transit
@@ -112,7 +113,11 @@ async function walk(value, cache, ancestors) {
112
113
  for (const key of Object.keys(obj)){
113
114
  const v = await walk(obj[key], cache, ancestors);
114
115
  if (v !== undefined) {
115
- result[key] = v;
116
+ setOwnProperty({
117
+ key,
118
+ target: result,
119
+ value: v
120
+ });
116
121
  }
117
122
  }
118
123
  ancestors.delete(obj);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/serializeForRsc.ts"],"sourcesContent":["import type React from 'react'\n\nimport { renderServerComponent } from '@tanstack/react-start/rsc'\nimport { createElement, Fragment } from 'react'\n\n/**\n * Recursively walk a server-function return value and prepare it for transit\n * to the client as an RSC payload.\n *\n * Mirrors `toSerializable`'s walk (Maps, Sets, Dates, typed arrays, circular\n * refs) with two key differences:\n *\n * 1. React elements are NOT stripped. They are passed through\n * `renderServerComponent` from `@tanstack/react-start/rsc` to produce a\n * \"renderable RSC handle\". TanStack Start's `$RSC` serialization adapter\n * streams the underlying Flight payload to the client, where it is\n * decoded back into a renderable React node. This matches the way\n * Next.js's RSC payload format ships React elements over server actions\n * and lets server-rendered custom field components (e.g. those returned\n * by `buildFormState` / `RenderServerComponent`) survive a `form-state`\n * round trip.\n *\n * 2. Functions, Symbols, and RegExps are still stripped — TanStack's seroval\n * transport cannot handle them, and Payload doesn't intentionally include\n * them in server-function return values.\n *\n * Use this in `createServerFn` handlers that return Payload form/view state\n * containing React elements (e.g. `state[path].customComponents.Field`).\n */\nexport async function serializeForRsc<T>(value: T): Promise<T> {\n return (await walk(value, new WeakMap<object, unknown>(), new WeakSet<object>())) as T\n}\n\nasync function walk(\n value: unknown,\n cache: WeakMap<object, unknown>,\n ancestors: WeakSet<object>,\n): Promise<unknown> {\n if (value === null || value === undefined) {\n return value\n }\n\n const t = typeof value\n if (t === 'function' || t === 'symbol') {\n return undefined\n }\n if (t !== 'object') {\n return value\n }\n\n const obj = value as Record<string, unknown>\n\n if (typeof obj.$$typeof === 'symbol') {\n return await renderServerComponent(value as React.ReactElement)\n }\n\n if (ancestors.has(obj)) {\n return undefined\n }\n\n if (cache.has(obj)) {\n return cache.get(obj)\n }\n\n if (obj instanceof Date) {\n return obj\n }\n\n if (obj instanceof RegExp) {\n return undefined\n }\n\n ancestors.add(obj)\n\n if (obj instanceof Map) {\n const cleaned = new Map()\n cache.set(obj, cleaned)\n for (const [k, v] of obj) {\n const cv = await walk(v, cache, ancestors)\n if (cv !== undefined) {\n cleaned.set(k, cv)\n }\n }\n ancestors.delete(obj)\n return cleaned\n }\n\n if (obj instanceof Set) {\n const cleaned = new Set()\n cache.set(obj, cleaned)\n for (const v of obj) {\n const cv = await walk(v, cache, ancestors)\n if (cv !== undefined) {\n cleaned.add(cv)\n }\n }\n ancestors.delete(obj)\n return cleaned\n }\n\n if (Array.isArray(obj)) {\n // An array consisting entirely of React elements (e.g. a field's\n // `beforeInput` / `afterInput` component list, produced by\n // `RenderServerComponent`) must be rendered as a SINGLE RSC handle.\n // Converting each element individually below turns every item into its own\n // `renderServerComponent` handle, which drops the element's React `key` —\n // the client then renders `{[handle, handle]}` as unkeyed array children\n // and React warns \"Each child in a list should have a unique key prop\".\n // Payload always renders these component arrays wholesale (`{BeforeInput}`),\n // so collapsing them into one Fragment-rendered handle is render-equivalent\n // and keeps the per-element keys intact inside the single Flight payload.\n const items = obj.filter((item) => item !== null && item !== undefined)\n const isReactElementArray =\n items.length > 0 &&\n items.every(\n (item) => typeof item === 'object' && typeof (item as { $$typeof?: unknown }).$$typeof === 'symbol',\n )\n if (isReactElementArray) {\n ancestors.delete(obj)\n return await renderServerComponent(createElement(Fragment, null, ...(obj as React.ReactNode[])))\n }\n\n const arr: unknown[] = []\n cache.set(obj, arr)\n for (const item of obj) {\n arr.push(await walk(item, cache, ancestors))\n }\n ancestors.delete(obj)\n return arr\n }\n\n if (ArrayBuffer.isView(obj)) {\n ancestors.delete(obj)\n return obj\n }\n\n const result: Record<string, unknown> = {}\n cache.set(obj, result)\n for (const key of Object.keys(obj)) {\n const v = await walk(obj[key], cache, ancestors)\n if (v !== undefined) {\n result[key] = v\n }\n }\n ancestors.delete(obj)\n return result\n}\n"],"names":["renderServerComponent","createElement","Fragment","serializeForRsc","value","walk","WeakMap","WeakSet","cache","ancestors","undefined","t","obj","$$typeof","has","get","Date","RegExp","add","Map","cleaned","set","k","v","cv","delete","Set","Array","isArray","items","filter","item","isReactElementArray","length","every","arr","push","ArrayBuffer","isView","result","key","Object","keys"],"mappings":"AAEA,SAASA,qBAAqB,QAAQ,4BAA2B;AACjE,SAASC,aAAa,EAAEC,QAAQ,QAAQ,QAAO;AAE/C;;;;;;;;;;;;;;;;;;;;;;;CAuBC,GACD,OAAO,eAAeC,gBAAmBC,KAAQ;IAC/C,OAAQ,MAAMC,KAAKD,OAAO,IAAIE,WAA4B,IAAIC;AAChE;AAEA,eAAeF,KACbD,KAAc,EACdI,KAA+B,EAC/BC,SAA0B;IAE1B,IAAIL,UAAU,QAAQA,UAAUM,WAAW;QACzC,OAAON;IACT;IAEA,MAAMO,IAAI,OAAOP;IACjB,IAAIO,MAAM,cAAcA,MAAM,UAAU;QACtC,OAAOD;IACT;IACA,IAAIC,MAAM,UAAU;QAClB,OAAOP;IACT;IAEA,MAAMQ,MAAMR;IAEZ,IAAI,OAAOQ,IAAIC,QAAQ,KAAK,UAAU;QACpC,OAAO,MAAMb,sBAAsBI;IACrC;IAEA,IAAIK,UAAUK,GAAG,CAACF,MAAM;QACtB,OAAOF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AACb;YACjB,OAAO,MAAMZ,sBAAsBC,cAAcC,UAAU,SAAUU;QACvE;QAEA,MAAMuB,MAAiB,EAAE;QACzB3B,MAAMa,GAAG,CAACT,KAAKuB;QACf,KAAK,MAAMJ,QAAQnB,IAAK;YACtBuB,IAAIC,IAAI,CAAC,MAAM/B,KAAK0B,MAAMvB,OAAOC;QACnC;QACAA,UAAUgB,MAAM,CAACb;QACjB,OAAOuB;IACT;IAEA,IAAIE,YAAYC,MAAM,CAAC1B,MAAM;QAC3BH,UAAUgB,MAAM,CAACb;QACjB,OAAOA;IACT;IAEA,MAAM2B,SAAkC,CAAC;IACzC/B,MAAMa,GAAG,CAACT,KAAK2B;IACf,KAAK,MAAMC,OAAOC,OAAOC,IAAI,CAAC9B,KAAM;QAClC,MAAMW,IAAI,MAAMlB,KAAKO,GAAG,CAAC4B,IAAI,EAAEhC,OAAOC;QACtC,IAAIc,MAAMb,WAAW;YACnB6B,MAAM,CAACC,IAAI,GAAGjB;QAChB;IACF;IACAd,UAAUgB,MAAM,CAACb;IACjB,OAAO2B;AACT"}
1
+ {"version":3,"sources":["../../src/utilities/serializeForRsc.ts"],"sourcesContent":["import type React from 'react'\n\nimport { renderServerComponent } from '@tanstack/react-start/rsc'\nimport { setOwnProperty } from 'payload/shared'\nimport { createElement, Fragment } from 'react'\n\n/**\n * Recursively walk a server-function return value and prepare it for transit\n * to the client as an RSC payload.\n *\n * Mirrors `toSerializable`'s walk (Maps, Sets, Dates, typed arrays, circular\n * refs) with two key differences:\n *\n * 1. React elements are NOT stripped. They are passed through\n * `renderServerComponent` from `@tanstack/react-start/rsc` to produce a\n * \"renderable RSC handle\". TanStack Start's `$RSC` serialization adapter\n * streams the underlying Flight payload to the client, where it is\n * decoded back into a renderable React node. This matches the way\n * Next.js's RSC payload format ships React elements over server actions\n * and lets server-rendered custom field components (e.g. those returned\n * by `buildFormState` / `RenderServerComponent`) survive a `form-state`\n * round trip.\n *\n * 2. Functions, Symbols, and RegExps are still stripped — TanStack's seroval\n * transport cannot handle them, and Payload doesn't intentionally include\n * them in server-function return values.\n *\n * Use this in `createServerFn` handlers that return Payload form/view state\n * containing React elements (e.g. `state[path].customComponents.Field`).\n */\nexport async function serializeForRsc<T>(value: T): Promise<T> {\n return (await walk(value, new WeakMap<object, unknown>(), new WeakSet<object>())) as T\n}\n\nasync function walk(\n value: unknown,\n cache: WeakMap<object, unknown>,\n ancestors: WeakSet<object>,\n): Promise<unknown> {\n if (value === null || value === undefined) {\n return value\n }\n\n const t = typeof value\n if (t === 'function' || t === 'symbol') {\n return undefined\n }\n if (t !== 'object') {\n return value\n }\n\n const obj = value as Record<string, unknown>\n\n if (typeof obj.$$typeof === 'symbol') {\n return await renderServerComponent(value as React.ReactElement)\n }\n\n if (ancestors.has(obj)) {\n return undefined\n }\n\n if (cache.has(obj)) {\n return cache.get(obj)\n }\n\n if (obj instanceof Date) {\n return obj\n }\n\n if (obj instanceof RegExp) {\n return undefined\n }\n\n ancestors.add(obj)\n\n if (obj instanceof Map) {\n const cleaned = new Map()\n cache.set(obj, cleaned)\n for (const [k, v] of obj) {\n const cv = await walk(v, cache, ancestors)\n if (cv !== undefined) {\n cleaned.set(k, cv)\n }\n }\n ancestors.delete(obj)\n return cleaned\n }\n\n if (obj instanceof Set) {\n const cleaned = new Set()\n cache.set(obj, cleaned)\n for (const v of obj) {\n const cv = await walk(v, cache, ancestors)\n if (cv !== undefined) {\n cleaned.add(cv)\n }\n }\n ancestors.delete(obj)\n return cleaned\n }\n\n if (Array.isArray(obj)) {\n // An array consisting entirely of React elements (e.g. a field's\n // `beforeInput` / `afterInput` component list, produced by\n // `RenderServerComponent`) must be rendered as a SINGLE RSC handle.\n // Converting each element individually below turns every item into its own\n // `renderServerComponent` handle, which drops the element's React `key` —\n // the client then renders `{[handle, handle]}` as unkeyed array children\n // and React warns \"Each child in a list should have a unique key prop\".\n // Payload always renders these component arrays wholesale (`{BeforeInput}`),\n // so collapsing them into one Fragment-rendered handle is render-equivalent\n // and keeps the per-element keys intact inside the single Flight payload.\n const items = obj.filter((item) => item !== null && item !== undefined)\n const isReactElementArray =\n items.length > 0 &&\n items.every(\n (item) =>\n typeof item === 'object' && typeof (item as { $$typeof?: unknown }).$$typeof === 'symbol',\n )\n if (isReactElementArray) {\n ancestors.delete(obj)\n return await renderServerComponent(\n createElement(Fragment, null, ...(obj as React.ReactNode[])),\n )\n }\n\n const arr: unknown[] = []\n cache.set(obj, arr)\n for (const item of obj) {\n arr.push(await walk(item, cache, ancestors))\n }\n ancestors.delete(obj)\n return arr\n }\n\n if (ArrayBuffer.isView(obj)) {\n ancestors.delete(obj)\n return obj\n }\n\n const result: Record<string, unknown> = {}\n cache.set(obj, result)\n for (const key of Object.keys(obj)) {\n const v = await walk(obj[key], cache, ancestors)\n if (v !== undefined) {\n setOwnProperty({ key, target: result, value: v })\n }\n }\n ancestors.delete(obj)\n return result\n}\n"],"names":["renderServerComponent","setOwnProperty","createElement","Fragment","serializeForRsc","value","walk","WeakMap","WeakSet","cache","ancestors","undefined","t","obj","$$typeof","has","get","Date","RegExp","add","Map","cleaned","set","k","v","cv","delete","Set","Array","isArray","items","filter","item","isReactElementArray","length","every","arr","push","ArrayBuffer","isView","result","key","Object","keys","target"],"mappings":"AAEA,SAASA,qBAAqB,QAAQ,4BAA2B;AACjE,SAASC,cAAc,QAAQ,iBAAgB;AAC/C,SAASC,aAAa,EAAEC,QAAQ,QAAQ,QAAO;AAE/C;;;;;;;;;;;;;;;;;;;;;;;CAuBC,GACD,OAAO,eAAeC,gBAAmBC,KAAQ;IAC/C,OAAQ,MAAMC,KAAKD,OAAO,IAAIE,WAA4B,IAAIC;AAChE;AAEA,eAAeF,KACbD,KAAc,EACdI,KAA+B,EAC/BC,SAA0B;IAE1B,IAAIL,UAAU,QAAQA,UAAUM,WAAW;QACzC,OAAON;IACT;IAEA,MAAMO,IAAI,OAAOP;IACjB,IAAIO,MAAM,cAAcA,MAAM,UAAU;QACtC,OAAOD;IACT;IACA,IAAIC,MAAM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;QAC7D,MAAMsB,sBACJH,MAAMI,MAAM,GAAG,KACfJ,MAAMK,KAAK,CACT,CAACH,OACC,OAAOA,SAAS,YAAY,OAAO,AAACA,KAAgClB,QAAQ,KAAK;QAEvF,IAAImB,qBAAqB;YACvBvB,UAAUgB,MAAM,CAACb;YACjB,OAAO,MAAMb,sBACXE,cAAcC,UAAU,SAAUU;QAEtC;QAEA,MAAMuB,MAAiB,EAAE;QACzB3B,MAAMa,GAAG,CAACT,KAAKuB;QACf,KAAK,MAAMJ,QAAQnB,IAAK;YACtBuB,IAAIC,IAAI,CAAC,MAAM/B,KAAK0B,MAAMvB,OAAOC;QACnC;QACAA,UAAUgB,MAAM,CAACb;QACjB,OAAOuB;IACT;IAEA,IAAIE,YAAYC,MAAM,CAAC1B,MAAM;QAC3BH,UAAUgB,MAAM,CAACb;QACjB,OAAOA;IACT;IAEA,MAAM2B,SAAkC,CAAC;IACzC/B,MAAMa,GAAG,CAACT,KAAK2B;IACf,KAAK,MAAMC,OAAOC,OAAOC,IAAI,CAAC9B,KAAM;QAClC,MAAMW,IAAI,MAAMlB,KAAKO,GAAG,CAAC4B,IAAI,EAAEhC,OAAOC;QACtC,IAAIc,MAAMb,WAAW;YACnBV,eAAe;gBAAEwC;gBAAKG,QAAQJ;gBAAQnC,OAAOmB;YAAE;QACjD;IACF;IACAd,UAAUgB,MAAM,CAACb;IACjB,OAAO2B;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"serverFunctionClient.d.ts","sourceRoot":"","sources":["../../src/utilities/serverFunctionClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAE7E;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,WAAW,GACZ,EAAE;IACD,WAAW,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,wBAAwB,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAC7E,GAAG,oBAAoB,CAKvB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,EACd,KAAK,GAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAiB,EAC/C,SAAS,GAAE,OAAO,CAAC,MAAM,CAAiB,GACzC,OAAO,CA4FT"}
1
+ {"version":3,"file":"serverFunctionClient.d.ts","sourceRoot":"","sources":["../../src/utilities/serverFunctionClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAI7E;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,WAAW,GACZ,EAAE;IACD,WAAW,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,wBAAwB,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAC7E,GAAG,oBAAoB,CAKvB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,EACd,KAAK,GAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAiB,EAC/C,SAAS,GAAE,OAAO,CAAC,MAAM,CAAiB,GACzC,OAAO,CA4FT"}
@@ -1,3 +1,4 @@
1
+ import { setOwnProperty } from 'payload/shared';
1
2
  /**
2
3
  * Builds the client-side `ServerFunctionClient` wired into
3
4
  * `RootProvider.serverFunction`, given the app's `createServerFn`-based
@@ -99,7 +100,11 @@
99
100
  for (const key of Object.keys(obj)){
100
101
  const v = stripUnserializable(obj[key], cache, ancestors);
101
102
  if (v !== undefined) {
102
- result[key] = v;
103
+ setOwnProperty({
104
+ key,
105
+ target: result,
106
+ value: v
107
+ });
103
108
  }
104
109
  }
105
110
  ancestors.delete(obj);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/serverFunctionClient.ts"],"sourcesContent":["import type { ServerFunctionClient, ServerFunctionClientArgs } from 'payload'\n\n/**\n * Builds the client-side `ServerFunctionClient` wired into\n * `RootProvider.serverFunction`, given the app's `createServerFn`-based\n * dispatcher (`runServerFn`).\n *\n * Strips functions / symbols / RegExps / React elements from the args before\n * dispatching: the previous `fetch + JSON.stringify` pipeline silently dropped\n * those, but TanStack Start's seroval-based wire format errors instead. We\n * mirror the relaxed behaviour so existing callers (e.g. `getFormState` in\n * `ServerFunctionsProvider`) that may pass the live form state — which can\n * carry stray functions — keep working without each call site sanitising.\n *\n * Delegates to `runServerFn`, so the response (including any RSC handles for\n * server-rendered custom components) is decoded by TanStack Start back into\n * renderable React nodes on the client.\n */\nexport function createServerFunctionClient({\n runServerFn,\n}: {\n runServerFn: (input: { data: ServerFunctionClientArgs }) => Promise<unknown>\n}): ServerFunctionClient {\n return (async (args: ServerFunctionClientArgs) => {\n const safeArgs = stripUnserializable(args) as ServerFunctionClientArgs\n return await runServerFn({ data: safeArgs })\n }) as ServerFunctionClient\n}\n\n/**\n * Recursively removes values TanStack Start's seroval wire format cannot\n * serialize (functions, symbols, RegExps, React elements, cyclic refs) and\n * normalizes `Date` subclasses to plain `Date`.\n */\nexport function stripUnserializable(\n value: unknown,\n cache: WeakMap<object, unknown> = new WeakMap(),\n ancestors: WeakSet<object> = new WeakSet(),\n): unknown {\n if (value === null || value === undefined) {\n return value\n }\n\n const t = typeof value\n if (t === 'function' || t === 'symbol') {\n return undefined\n }\n if (t !== 'object') {\n return value\n }\n\n const obj = value as Record<string, unknown>\n\n if (typeof obj.$$typeof === 'symbol') {\n return undefined\n }\n\n if (ancestors.has(obj)) {\n return undefined\n }\n\n if (cache.has(obj)) {\n return cache.get(obj)\n }\n\n if (obj instanceof Date) {\n // Normalize to a plain `Date`. Subclasses (e.g. `@date-fns/tz`'s `TZDate`,\n // used by the schedule-publish drawer) are `instanceof Date` but have a\n // different `constructor`, which TanStack Start's seroval serializer\n // rejects with \"The value [object Date] ... cannot be parsed/serialized\".\n return new Date(obj.getTime())\n }\n\n if (obj instanceof RegExp) {\n return undefined\n }\n\n ancestors.add(obj)\n\n if (obj instanceof Map) {\n const cleaned = new Map()\n cache.set(obj, cleaned)\n for (const [k, v] of obj) {\n const cv = stripUnserializable(v, cache, ancestors)\n if (cv !== undefined) {\n cleaned.set(k, cv)\n }\n }\n ancestors.delete(obj)\n return cleaned\n }\n\n if (obj instanceof Set) {\n const cleaned = new Set()\n cache.set(obj, cleaned)\n for (const v of obj) {\n const cv = stripUnserializable(v, cache, ancestors)\n if (cv !== undefined) {\n cleaned.add(cv)\n }\n }\n ancestors.delete(obj)\n return cleaned\n }\n\n if (Array.isArray(obj)) {\n const arr: unknown[] = []\n cache.set(obj, arr)\n for (const item of obj) {\n arr.push(stripUnserializable(item, cache, ancestors))\n }\n ancestors.delete(obj)\n return arr\n }\n\n if (ArrayBuffer.isView(obj)) {\n ancestors.delete(obj)\n return obj\n }\n\n const result: Record<string, unknown> = {}\n cache.set(obj, result)\n for (const key of Object.keys(obj)) {\n const v = stripUnserializable(obj[key], cache, ancestors)\n if (v !== undefined) {\n result[key] = v\n }\n }\n ancestors.delete(obj)\n return result\n}\n"],"names":["createServerFunctionClient","runServerFn","args","safeArgs","stripUnserializable","data","value","cache","WeakMap","ancestors","WeakSet","undefined","t","obj","$$typeof","has","get","Date","getTime","RegExp","add","Map","cleaned","set","k","v","cv","delete","Set","Array","isArray","arr","item","push","ArrayBuffer","isView","result","key","Object","keys"],"mappings":"AAEA;;;;;;;;;;;;;;;CAeC,GACD,OAAO,SAASA,2BAA2B,EACzCC,WAAW,EAGZ;IACC,OAAQ,OAAOC;QACb,MAAMC,WAAWC,oBAAoBF;QACrC,OAAO,MAAMD,YAAY;YAAEI,MAAMF;QAAS;IAC5C;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASC,oBACdE,KAAc,EACdC,QAAkC,IAAIC,SAAS,EAC/CC,YAA6B,IAAIC,SAAS;IAE1C,IAAIJ,UAAU,QAAQA,UAAUK,WAAW;QACzC,OAAOL;IACT;IAEA,MAAMM,IAAI,OAAON;IACjB,IA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IAAK;YACtBkB,IAAIE,IAAI,CAAC7B,oBAAoB4B,MAAMzB,OAAOE;QAC5C;QACAA,UAAUkB,MAAM,CAACd;QACjB,OAAOkB;IACT;IAEA,IAAIG,YAAYC,MAAM,CAACtB,MAAM;QAC3BJ,UAAUkB,MAAM,CAACd;QACjB,OAAOA;IACT;IAEA,MAAMuB,SAAkC,CAAC;IACzC7B,MAAMgB,GAAG,CAACV,KAAKuB;IACf,KAAK,MAAMC,OAAOC,OAAOC,IAAI,CAAC1B,KAAM;QAClC,MAAMY,IAAIrB,oBAAoBS,GAAG,CAACwB,IAAI,EAAE9B,OAAOE;QAC/C,IAAIgB,MAAMd,WAAW;YACnByB,MAAM,CAACC,IAAI,GAAGZ;QAChB;IACF;IACAhB,UAAUkB,MAAM,CAACd;IACjB,OAAOuB;AACT"}
1
+ {"version":3,"sources":["../../src/utilities/serverFunctionClient.ts"],"sourcesContent":["import type { ServerFunctionClient, ServerFunctionClientArgs } from 'payload'\n\nimport { setOwnProperty } from 'payload/shared'\n\n/**\n * Builds the client-side `ServerFunctionClient` wired into\n * `RootProvider.serverFunction`, given the app's `createServerFn`-based\n * dispatcher (`runServerFn`).\n *\n * Strips functions / symbols / RegExps / React elements from the args before\n * dispatching: the previous `fetch + JSON.stringify` pipeline silently dropped\n * those, but TanStack Start's seroval-based wire format errors instead. We\n * mirror the relaxed behaviour so existing callers (e.g. `getFormState` in\n * `ServerFunctionsProvider`) that may pass the live form state — which can\n * carry stray functions — keep working without each call site sanitising.\n *\n * Delegates to `runServerFn`, so the response (including any RSC handles for\n * server-rendered custom components) is decoded by TanStack Start back into\n * renderable React nodes on the client.\n */\nexport function createServerFunctionClient({\n runServerFn,\n}: {\n runServerFn: (input: { data: ServerFunctionClientArgs }) => Promise<unknown>\n}): ServerFunctionClient {\n return (async (args: ServerFunctionClientArgs) => {\n const safeArgs = stripUnserializable(args) as ServerFunctionClientArgs\n return await runServerFn({ data: safeArgs })\n }) as ServerFunctionClient\n}\n\n/**\n * Recursively removes values TanStack Start's seroval wire format cannot\n * serialize (functions, symbols, RegExps, React elements, cyclic refs) and\n * normalizes `Date` subclasses to plain `Date`.\n */\nexport function stripUnserializable(\n value: unknown,\n cache: WeakMap<object, unknown> = new WeakMap(),\n ancestors: WeakSet<object> = new WeakSet(),\n): unknown {\n if (value === null || value === undefined) {\n return value\n }\n\n const t = typeof value\n if (t === 'function' || t === 'symbol') {\n return undefined\n }\n if (t !== 'object') {\n return value\n }\n\n const obj = value as Record<string, unknown>\n\n if (typeof obj.$$typeof === 'symbol') {\n return undefined\n }\n\n if (ancestors.has(obj)) {\n return undefined\n }\n\n if (cache.has(obj)) {\n return cache.get(obj)\n }\n\n if (obj instanceof Date) {\n // Normalize to a plain `Date`. Subclasses (e.g. `@date-fns/tz`'s `TZDate`,\n // used by the schedule-publish drawer) are `instanceof Date` but have a\n // different `constructor`, which TanStack Start's seroval serializer\n // rejects with \"The value [object Date] ... cannot be parsed/serialized\".\n return new Date(obj.getTime())\n }\n\n if (obj instanceof RegExp) {\n return undefined\n }\n\n ancestors.add(obj)\n\n if (obj instanceof Map) {\n const cleaned = new Map()\n cache.set(obj, cleaned)\n for (const [k, v] of obj) {\n const cv = stripUnserializable(v, cache, ancestors)\n if (cv !== undefined) {\n cleaned.set(k, cv)\n }\n }\n ancestors.delete(obj)\n return cleaned\n }\n\n if (obj instanceof Set) {\n const cleaned = new Set()\n cache.set(obj, cleaned)\n for (const v of obj) {\n const cv = stripUnserializable(v, cache, ancestors)\n if (cv !== undefined) {\n cleaned.add(cv)\n }\n }\n ancestors.delete(obj)\n return cleaned\n }\n\n if (Array.isArray(obj)) {\n const arr: unknown[] = []\n cache.set(obj, arr)\n for (const item of obj) {\n arr.push(stripUnserializable(item, cache, ancestors))\n }\n ancestors.delete(obj)\n return arr\n }\n\n if (ArrayBuffer.isView(obj)) {\n ancestors.delete(obj)\n return obj\n }\n\n const result: Record<string, unknown> = {}\n cache.set(obj, result)\n for (const key of Object.keys(obj)) {\n const v = stripUnserializable(obj[key], cache, ancestors)\n if (v !== undefined) {\n setOwnProperty({ key, target: result, value: v })\n }\n }\n ancestors.delete(obj)\n return result\n}\n"],"names":["setOwnProperty","createServerFunctionClient","runServerFn","args","safeArgs","stripUnserializable","data","value","cache","WeakMap","ancestors","WeakSet","undefined","t","obj","$$typeof","has","get","Date","getTime","RegExp","add","Map","cleaned","set","k","v","cv","delete","Set","Array","isArray","arr","item","push","ArrayBuffer","isView","result","key","Object","keys","target"],"mappings":"AAEA,SAASA,cAAc,QAAQ,iBAAgB;AAE/C;;;;;;;;;;;;;;;CAeC,GACD,OAAO,SAASC,2BAA2B,EACzCC,WAAW,EAGZ;IACC,OAAQ,OAAOC;QACb,MAAMC,WAAWC,oBAAoBF;QACrC,OAAO,MAAMD,YAAY;YAAEI,MAAMF;QAAS;IAC5C;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASC,oBACdE,KAAc,EACdC,QAAkC,IAAIC,SAAS,EAC/CC,YAA6B,IAAIC,SAAS;IAE1C,IAAIJ,UAAU,QAAQA,UAAUK,WAAW;QACzC,OAAOL;IACT;IAEA,MAAMM,IAAI,OAAON;IACjB,IAAIM,MAAM,cAAcA,MAAM,UAAU;QACtC,OAAOD;IACT;IACA,IAAIC,MAAM,UAAU;QAClB,OAAON;IACT;IAEA,MAAMO,MAAMP;IAEZ,IAAI,OAAOO,IAAIC,QAAQ,KAAK,UAAU;QACpC,OAAOH;IACT;IAEA,IAAIF,UAAUM,GAAG,CAACF,MAAM;QACtB,OAAOF;IACT;IAEA,IAAIJ,MAAMQ,GAAG,CAACF,MAAM;QAClB,OAAON,MAAMS,GAAG,CAACH;IACnB;IAEA,IAAIA,eAAeI,MAAM;QACvB,2EAA2E;QAC3E,wEAAwE;QACxE,qEAAqE;QACrE,0EAA0E;QAC1E,OAAO,IAAIA,KAAKJ,IAAIK,OAAO;IAC7B;IAEA,IAAIL,eAAeM,QAAQ;QACzB,OAAOR;IACT;IAEAF,UAAUW,GAAG,CAACP;IA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d;IACjB,OAAOuB;AACT"}
@@ -1,2 +1,11 @@
1
+ import type { Serializable, SerializableExtensions } from '@tanstack/react-router';
2
+ /** A record sanitized for TanStack's server-function transport. */
3
+ export type SerializableRecord = Record<string, unknown> & SerializableExtensions['TsrSerializable'];
4
+ /**
5
+ * Removes values unsupported by TanStack's serializer. Trusted serializable
6
+ * additions are merged afterward so opaque handles such as RSC payloads are
7
+ * preserved while the source record is sanitized.
8
+ */
1
9
  export declare function toSerializable<T>(value: T): T;
10
+ export declare function toSerializable(value: Record<string, unknown>, additions: Record<string, Serializable>): SerializableRecord;
2
11
  //# sourceMappingURL=toSerializable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toSerializable.d.ts","sourceRoot":"","sources":["../../src/utilities/toSerializable.ts"],"names":[],"mappings":"AA6HA,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAE7C"}
1
+ {"version":3,"file":"toSerializable.d.ts","sourceRoot":"","sources":["../../src/utilities/toSerializable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAIlF,mEAAmE;AACnE,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,sBAAsB,CAAC,iBAAiB,CAAC,CAAA;AA+HpG;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAAA;AAC9C,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GACtC,kBAAkB,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { setOwnProperty } from 'payload/shared';
1
2
  /**
2
3
  * Recursively strip values that seroval cannot serialize (React elements,
3
4
  * functions, Symbols) while preserving Maps, Sets, Dates, typed arrays, etc.
@@ -98,14 +99,29 @@
98
99
  for (const key of Object.keys(obj)){
99
100
  const v = stripUnserializable(obj[key], cache, ancestors);
100
101
  if (v !== undefined) {
101
- result[key] = v;
102
+ setOwnProperty({
103
+ key,
104
+ target: result,
105
+ value: v
106
+ });
102
107
  }
103
108
  }
104
109
  ancestors.delete(obj);
105
110
  return result;
106
111
  }
107
- export function toSerializable(value) {
108
- return stripUnserializable(value);
112
+ export function toSerializable(value, additions) {
113
+ const serialized = stripUnserializable(value);
114
+ if (additions) {
115
+ if (typeof serialized !== 'object' || serialized === null || Array.isArray(serialized)) {
116
+ throw new TypeError('Serializable additions require an object source');
117
+ }
118
+ const result = {
119
+ ...serialized,
120
+ ...additions
121
+ };
122
+ return result;
123
+ }
124
+ return serialized;
109
125
  }
110
126
 
111
127
  //# sourceMappingURL=toSerializable.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/toSerializable.ts"],"sourcesContent":["/**\n * Recursively strip values that seroval cannot serialize (React elements,\n * functions, Symbols) while preserving Maps, Sets, Dates, typed arrays, etc.\n *\n * TanStack Start uses seroval to transfer server function return values to\n * the client. Payload's `getClientConfig` / `getLayoutData` may include\n * callback functions or RegExp instances that seroval chokes on. Running\n * the data through this function before returning from a `createServerFn`\n * handler keeps the transfer safe.\n *\n * For server functions whose payloads contain React elements (e.g. the\n * shared `form-state` / `render-list` / `render-document` handlers), use\n * `serializeForRsc` instead — it converts elements into RSC handles rather\n * than stripping them.\n *\n * Uses a WeakMap cache so that shared object references (e.g. the same array\n * referenced by both `doc.hasMany` and `formState.hasMany.value`) are\n * returned correctly instead of being dropped as \"already seen\".\n *\n * A separate `ancestors` WeakSet tracks objects currently being recursed into.\n * If an object is encountered while it is still on the recursion stack, the\n * reference is circular and is replaced with `undefined` to keep the output\n * JSON-safe. Once recursion completes the object is removed from `ancestors`,\n * so sibling/cousin references to the same (fully-processed) object still\n * resolve to the cached clone.\n */\nfunction stripUnserializable(\n value: unknown,\n cache = new WeakMap<object, unknown>(),\n ancestors = new WeakSet<object>(),\n): unknown {\n if (value === null || value === undefined) {\n return value\n }\n\n const t = typeof value\n if (t === 'function' || t === 'symbol') {\n return undefined\n }\n if (t !== 'object') {\n return value\n }\n\n const obj = value as Record<string, unknown>\n\n if (typeof obj.$$typeof === 'symbol') {\n return undefined\n }\n\n if (ancestors.has(obj)) {\n return undefined\n }\n\n if (cache.has(obj)) {\n return cache.get(obj)\n }\n\n if (obj instanceof Date) {\n return obj\n }\n\n // RegExp: seroval's SSR bootstrap emits regex literals with broken escape\n // sequences (e.g. `/!\\\\[.../` instead of `/!\\[.../`), crashing the client\n // script that populates `window.$_TSR` and preventing hydration. Rich-text\n // feature transformer regexes aren't needed on the client (they drive\n // server-side markdown import/export), so strip them here.\n if (obj instanceof RegExp) {\n return undefined\n }\n\n ancestors.add(obj)\n\n if (obj instanceof Map) {\n const cleaned = new Map()\n cache.set(obj, cleaned)\n for (const [k, v] of obj) {\n const cv = stripUnserializable(v, cache, ancestors)\n if (cv !== undefined) {\n cleaned.set(k, cv)\n }\n }\n ancestors.delete(obj)\n return cleaned\n }\n\n if (obj instanceof Set) {\n const cleaned = new Set()\n cache.set(obj, cleaned)\n for (const v of obj) {\n const cv = stripUnserializable(v, cache, ancestors)\n if (cv !== undefined) {\n cleaned.add(cv)\n }\n }\n ancestors.delete(obj)\n return cleaned\n }\n\n if (Array.isArray(obj)) {\n const arr: unknown[] = []\n cache.set(obj, arr)\n for (const item of obj) {\n arr.push(stripUnserializable(item, cache, ancestors))\n }\n ancestors.delete(obj)\n return arr\n }\n\n if (ArrayBuffer.isView(obj)) {\n ancestors.delete(obj)\n return obj\n }\n\n const result: Record<string, unknown> = {}\n cache.set(obj, result)\n for (const key of Object.keys(obj)) {\n const v = stripUnserializable(obj[key], cache, ancestors)\n if (v !== undefined) {\n result[key] = v\n }\n }\n ancestors.delete(obj)\n return result\n}\n\nexport function toSerializable<T>(value: T): T {\n return stripUnserializable(value) as T\n}\n"],"names":["stripUnserializable","value","cache","WeakMap","ancestors","WeakSet","undefined","t","obj","$$typeof","has","get","Date","RegExp","add","Map","cleaned","set","k","v","cv","delete","Set","Array","isArray","arr","item","push","ArrayBuffer","isView","result","key","Object","keys","toSerializable"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;CAyBC,GACD,SAASA,oBACPC,KAAc,EACdC,QAAQ,IAAIC,SAA0B,EACtCC,YAAY,IAAIC,SAAiB;IAEjC,IAAIJ,UAAU,QAAQA,UAAUK,WAAW;QACzC,OAAOL;IACT;IAEA,MAAMM,IAAI,OAAON;IACjB,IAAIM,MAAM,cAAcA,MAAM,UAAU;QACtC,OAAOD;IACT;IACA,IAAIC,MAAM,UAAU;QAClB,OAAON;IACT;IAEA,MAAMO,MAAMP;IAEZ,IAAI,OAAOO,IAAIC,QAAQ,KAAK,UAAU;QACpC,OAAOH;IACT;IAEA,IAAIF,UAAUM,GAAG,CAACF,MAAM;QACtB,OAAOF;IACT;IAEA,IAAIJ,MAAMQ,GAAG,CAACF,MAAM;QAClB,OAAON,MAAMS,GAAG,CAACH;IACnB;IAEA,IAAIA,eAAeI,MAAM;QACvB,OAAOJ;IACT;IAEA,0EAA0E;IAC1E,0EAA0E;IAC1E,2EAA2E;IAC3E,sEAAsE;IACtE,2DAA2D;IAC3D,IAAIA,eAAeK,QAAQ;QACzB,OAAOP;IACT;IAEAF,UAAUU,GAAG,CAACN;IAEd,IAAIA,eAAeO,KAAK;QACtB,MAAMC,UAAU,IAAID;QACpBb,MAAMe,GAAG,CAACT,KAAKQ;QACf,KAAK,MAAM,CAACE,GAAGC,EAAE,IAAIX,IAAK;YACxB,MAAMY,KAAKpB,oBAAoBmB,GAAGjB,OAAOE;YACzC,IAAIgB,OAAOd,WAAW;gBACpBU,QAAQC,GAAG,CAACC,GAAGE;YACjB;QACF;QACAhB,UAAUiB,MAAM,CAACb;QACjB,OAAOQ;IACT;IAEA,IAAIR,eAAec,KAAK;QACtB,MAAMN,UAAU,IAAIM;QACpBpB,MAAMe,GAAG,CAACT,KAAKQ;QACf,KAAK,MAAMG,KAAKX,IAAK;YACnB,MAAMY,KAAKpB,oBAAoBmB,GAAGjB,OAAOE;YACzC,IAAIgB,OAAOd,WAAW;gBACpBU,QAAQF,GAAG,CAACM;YACd;QACF;QACAhB,UAAUiB,MAAM,CAACb;QACjB,OAAOQ;IACT;IAEA,IAAIO,MAAMC,OAAO,CAAChB,MAAM;QACtB,MAAMiB,MAAiB,EAAE;QACzBvB,MAAMe,GAAG,CAACT,KAAKiB;QACf,KAAK,MAAMC,QAAQlB,IAAK;YACtBiB,IAAIE,IAAI,CAAC3B,oBAAoB0B,MAAMxB,OAAOE;QAC5C;QACAA,UAAUiB,MAAM,CAACb;QACjB,OAAOiB;IACT;IAEA,IAAIG,YAAYC,MAAM,CAACrB,MAAM;QAC3BJ,UAAUiB,MAAM,CAACb;QACjB,OAAOA;IACT;IAEA,MAAMsB,SAAkC,CAAC;IACzC5B,MAAMe,GAAG,CAACT,KAAKsB;IACf,KAAK,MAAMC,OAAOC,OAAOC,IAAI,CAACzB,KAAM;QAClC,MAAMW,IAAInB,oBAAoBQ,GAAG,CAACuB,IAAI,EAAE7B,OAAOE;QAC/C,IAAIe,MAAMb,WAAW;YACnBwB,MAAM,CAACC,IAAI,GAAGZ;QAChB;IACF;IACAf,UAAUiB,MAAM,CAACb;IACjB,OAAOsB;AACT;AAEA,OAAO,SAASI,eAAkBjC,KAAQ;IACxC,OAAOD,oBAAoBC;AAC7B"}
1
+ {"version":3,"sources":["../../src/utilities/toSerializable.ts"],"sourcesContent":["import type { Serializable, SerializableExtensions } from '@tanstack/react-router'\n\nimport { setOwnProperty } from 'payload/shared'\n\n/** A record sanitized for TanStack's server-function transport. */\nexport type SerializableRecord = Record<string, unknown> & SerializableExtensions['TsrSerializable']\n\n/**\n * Recursively strip values that seroval cannot serialize (React elements,\n * functions, Symbols) while preserving Maps, Sets, Dates, typed arrays, etc.\n *\n * TanStack Start uses seroval to transfer server function return values to\n * the client. Payload's `getClientConfig` / `getLayoutData` may include\n * callback functions or RegExp instances that seroval chokes on. Running\n * the data through this function before returning from a `createServerFn`\n * handler keeps the transfer safe.\n *\n * For server functions whose payloads contain React elements (e.g. the\n * shared `form-state` / `render-list` / `render-document` handlers), use\n * `serializeForRsc` instead — it converts elements into RSC handles rather\n * than stripping them.\n *\n * Uses a WeakMap cache so that shared object references (e.g. the same array\n * referenced by both `doc.hasMany` and `formState.hasMany.value`) are\n * returned correctly instead of being dropped as \"already seen\".\n *\n * A separate `ancestors` WeakSet tracks objects currently being recursed into.\n * If an object is encountered while it is still on the recursion stack, the\n * reference is circular and is replaced with `undefined` to keep the output\n * JSON-safe. Once recursion completes the object is removed from `ancestors`,\n * so sibling/cousin references to the same (fully-processed) object still\n * resolve to the cached clone.\n */\nfunction stripUnserializable(\n value: unknown,\n cache = new WeakMap<object, unknown>(),\n ancestors = new WeakSet<object>(),\n): unknown {\n if (value === null || value === undefined) {\n return value\n }\n\n const t = typeof value\n if (t === 'function' || t === 'symbol') {\n return undefined\n }\n if (t !== 'object') {\n return value\n }\n\n const obj = value as Record<string, unknown>\n\n if (typeof obj.$$typeof === 'symbol') {\n return undefined\n }\n\n if (ancestors.has(obj)) {\n return undefined\n }\n\n if (cache.has(obj)) {\n return cache.get(obj)\n }\n\n if (obj instanceof Date) {\n return obj\n }\n\n // RegExp: seroval's SSR bootstrap emits regex literals with broken escape\n // sequences (e.g. `/!\\\\[.../` instead of `/!\\[.../`), crashing the client\n // script that populates `window.$_TSR` and preventing hydration. Rich-text\n // feature transformer regexes aren't needed on the client (they drive\n // server-side markdown import/export), so strip them here.\n if (obj instanceof RegExp) {\n return undefined\n }\n\n ancestors.add(obj)\n\n if (obj instanceof Map) {\n const cleaned = new Map()\n cache.set(obj, cleaned)\n for (const [k, v] of obj) {\n const cv = stripUnserializable(v, cache, ancestors)\n if (cv !== undefined) {\n cleaned.set(k, cv)\n }\n }\n ancestors.delete(obj)\n return cleaned\n }\n\n if (obj instanceof Set) {\n const cleaned = new Set()\n cache.set(obj, cleaned)\n for (const v of obj) {\n const cv = stripUnserializable(v, cache, ancestors)\n if (cv !== undefined) {\n cleaned.add(cv)\n }\n }\n ancestors.delete(obj)\n return cleaned\n }\n\n if (Array.isArray(obj)) {\n const arr: unknown[] = []\n cache.set(obj, arr)\n for (const item of obj) {\n arr.push(stripUnserializable(item, cache, ancestors))\n }\n ancestors.delete(obj)\n return arr\n }\n\n if (ArrayBuffer.isView(obj)) {\n ancestors.delete(obj)\n return obj\n }\n\n const result: Record<string, unknown> = {}\n cache.set(obj, result)\n for (const key of Object.keys(obj)) {\n const v = stripUnserializable(obj[key], cache, ancestors)\n if (v !== undefined) {\n setOwnProperty({ key, target: result, value: v })\n }\n }\n ancestors.delete(obj)\n return result\n}\n\n/**\n * Removes values unsupported by TanStack's serializer. Trusted serializable\n * additions are merged afterward so opaque handles such as RSC payloads are\n * preserved while the source record is sanitized.\n */\nexport function toSerializable<T>(value: T): T\nexport function toSerializable(\n value: Record<string, unknown>,\n additions: Record<string, Serializable>,\n): SerializableRecord\nexport function toSerializable(value: unknown, additions?: Record<string, Serializable>): unknown {\n const serialized = stripUnserializable(value)\n\n if (additions) {\n if (typeof serialized !== 'object' || serialized === null || Array.isArray(serialized)) {\n throw new TypeError('Serializable additions require an object source')\n }\n\n const result = { ...serialized, ...additions } satisfies Record<string, unknown>\n\n return result as SerializableRecord\n }\n\n return serialized\n}\n"],"names":["setOwnProperty","stripUnserializable","value","cache","WeakMap","ancestors","WeakSet","undefined","t","obj","$$typeof","has","get","Date","RegExp","add","Map","cleaned","set","k","v","cv","delete","Set","Array","isArray","arr","item","push","ArrayBuffer","isView","result","key","Object","keys","target","toSerializable","additions","serialized","TypeError"],"mappings":"AAEA,SAASA,cAAc,QAAQ,iBAAgB;AAK/C;;;;;;;;;;;;;;;;;;;;;;;;;CAyBC,GACD,SAASC,oBACPC,KAAc,EACdC,QAAQ,IAAIC,SAA0B,EACtCC,YAAY,IAAIC,SAA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