@payloadcms/tanstack-start 4.0.0-internal.e387174 → 4.0.0-internal.e38d3ac

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 (228) hide show
  1. package/dist/auth/login.d.ts +3 -16
  2. package/dist/auth/login.d.ts.map +1 -1
  3. package/dist/auth/login.js +6 -46
  4. package/dist/auth/login.js.map +1 -1
  5. package/dist/auth/logout.d.ts +2 -5
  6. package/dist/auth/logout.d.ts.map +1 -1
  7. package/dist/auth/logout.js +6 -47
  8. package/dist/auth/logout.js.map +1 -1
  9. package/dist/auth/refresh.d.ts +2 -4
  10. package/dist/auth/refresh.d.ts.map +1 -1
  11. package/dist/auth/refresh.js +6 -49
  12. package/dist/auth/refresh.js.map +1 -1
  13. package/dist/elements/RouterAdapter/index.d.ts.map +1 -1
  14. package/dist/elements/RouterAdapter/index.js +17 -3
  15. package/dist/elements/RouterAdapter/index.js.map +1 -1
  16. package/dist/exports/client.d.ts +1 -3
  17. package/dist/exports/client.d.ts.map +1 -1
  18. package/dist/exports/client.js +1 -3
  19. package/dist/exports/client.js.map +1 -1
  20. package/dist/exports/layouts.d.ts +2 -4
  21. package/dist/exports/layouts.d.ts.map +1 -1
  22. package/dist/exports/layouts.js +0 -1
  23. package/dist/exports/layouts.js.map +1 -1
  24. package/dist/exports/rsc.browser.d.ts +4 -1
  25. package/dist/exports/rsc.browser.d.ts.map +1 -1
  26. package/dist/exports/rsc.browser.js +4 -1
  27. package/dist/exports/rsc.browser.js.map +1 -1
  28. package/dist/exports/rsc.d.ts +0 -1
  29. package/dist/exports/rsc.d.ts.map +1 -1
  30. package/dist/exports/rsc.js +0 -1
  31. package/dist/exports/rsc.js.map +1 -1
  32. package/dist/exports/server.d.ts +4 -4
  33. package/dist/exports/server.d.ts.map +1 -1
  34. package/dist/exports/server.js +3 -3
  35. package/dist/exports/server.js.map +1 -1
  36. package/dist/exports/shared.d.ts +2 -0
  37. package/dist/exports/shared.d.ts.map +1 -0
  38. package/dist/exports/shared.js +3 -0
  39. package/dist/exports/shared.js.map +1 -0
  40. package/dist/index.d.ts +1 -5
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +1 -5
  43. package/dist/index.js.map +1 -1
  44. package/dist/layouts/Root/getLayoutData.d.ts +24 -2
  45. package/dist/layouts/Root/getLayoutData.d.ts.map +1 -1
  46. package/dist/layouts/Root/getLayoutData.js +7 -1
  47. package/dist/layouts/Root/getLayoutData.js.map +1 -1
  48. package/dist/layouts/Root/withPayloadRoot.d.ts +7 -31
  49. package/dist/layouts/Root/withPayloadRoot.d.ts.map +1 -1
  50. package/dist/layouts/Root/withPayloadRoot.js +33 -34
  51. package/dist/layouts/Root/withPayloadRoot.js.map +1 -1
  52. package/dist/node/cssLoader.d.mts +24 -2
  53. package/dist/node/cssLoader.d.mts.map +1 -1
  54. package/dist/routes/adminRoutes.d.ts +10 -13
  55. package/dist/routes/adminRoutes.d.ts.map +1 -1
  56. package/dist/routes/adminRoutes.js +52 -45
  57. package/dist/routes/adminRoutes.js.map +1 -1
  58. package/dist/routes/apiRoute.d.ts +5 -0
  59. package/dist/routes/apiRoute.d.ts.map +1 -1
  60. package/dist/routes/apiRoute.js +6 -1
  61. package/dist/routes/apiRoute.js.map +1 -1
  62. package/dist/routes/layoutRoute.d.ts +4 -3
  63. package/dist/routes/layoutRoute.d.ts.map +1 -1
  64. package/dist/routes/layoutRoute.js +1 -0
  65. package/dist/routes/layoutRoute.js.map +1 -1
  66. package/dist/utilities/devConfigReload.server.d.ts +2 -0
  67. package/dist/utilities/devConfigReload.server.d.ts.map +1 -0
  68. package/dist/utilities/devConfigReload.server.js +38 -0
  69. package/dist/utilities/devConfigReload.server.js.map +1 -0
  70. package/dist/utilities/devConfigReloadEvent.d.ts +9 -0
  71. package/dist/utilities/devConfigReloadEvent.d.ts.map +1 -0
  72. package/dist/utilities/devConfigReloadEvent.js +9 -0
  73. package/dist/utilities/devConfigReloadEvent.js.map +1 -0
  74. package/dist/utilities/getRequestLocale.d.ts.map +1 -1
  75. package/dist/utilities/getRequestLocale.js +1 -2
  76. package/dist/utilities/getRequestLocale.js.map +1 -1
  77. package/dist/utilities/graphqlHandler.server.d.ts.map +1 -1
  78. package/dist/utilities/{handleAPIRoute.d.ts → handleAPIRoute.server.d.ts} +1 -1
  79. package/dist/utilities/handleAPIRoute.server.d.ts.map +1 -0
  80. package/dist/utilities/{handleAPIRoute.js → handleAPIRoute.server.js} +1 -1
  81. package/dist/utilities/handleAPIRoute.server.js.map +1 -0
  82. package/dist/utilities/handleServerFunctions.d.ts +1 -19
  83. package/dist/utilities/handleServerFunctions.d.ts.map +1 -1
  84. package/dist/utilities/handleServerFunctions.js +8 -56
  85. package/dist/utilities/handleServerFunctions.js.map +1 -1
  86. package/dist/utilities/initReq.server.d.ts +1 -0
  87. package/dist/utilities/initReq.server.d.ts.map +1 -1
  88. package/dist/utilities/initReq.server.js +3 -0
  89. package/dist/utilities/initReq.server.js.map +1 -1
  90. package/dist/utilities/loadAdminPage.d.ts +5 -2
  91. package/dist/utilities/loadAdminPage.d.ts.map +1 -1
  92. package/dist/utilities/loadAdminPage.js +13 -12
  93. package/dist/utilities/loadAdminPage.js.map +1 -1
  94. package/dist/utilities/loadLayoutData.d.ts +3 -1
  95. package/dist/utilities/loadLayoutData.d.ts.map +1 -1
  96. package/dist/utilities/loadLayoutData.js +2 -3
  97. package/dist/utilities/loadLayoutData.js.map +1 -1
  98. package/dist/utilities/meta.d.ts +1 -0
  99. package/dist/utilities/meta.d.ts.map +1 -1
  100. package/dist/utilities/meta.js +2 -1
  101. package/dist/utilities/meta.js.map +1 -1
  102. package/dist/utilities/routerSearch.d.ts +40 -0
  103. package/dist/utilities/routerSearch.d.ts.map +1 -0
  104. package/dist/utilities/routerSearch.js +45 -0
  105. package/dist/utilities/routerSearch.js.map +1 -0
  106. package/dist/utilities/serverAdapter.server.d.ts.map +1 -1
  107. package/dist/utilities/toSerializable.d.ts +9 -0
  108. package/dist/utilities/toSerializable.d.ts.map +1 -1
  109. package/dist/utilities/toSerializable.js +13 -2
  110. package/dist/utilities/toSerializable.js.map +1 -1
  111. package/dist/withPayload/config/external.d.ts +44 -0
  112. package/dist/withPayload/config/external.d.ts.map +1 -0
  113. package/dist/withPayload/config/external.js +96 -0
  114. package/dist/withPayload/config/external.js.map +1 -0
  115. package/dist/withPayload/config/optimizeDeps.d.ts +25 -0
  116. package/dist/withPayload/config/optimizeDeps.d.ts.map +1 -0
  117. package/dist/{vite/constants.js → withPayload/config/optimizeDeps.js} +16 -66
  118. package/dist/withPayload/config/optimizeDeps.js.map +1 -0
  119. package/dist/withPayload/config/scss.d.ts +14 -0
  120. package/dist/withPayload/config/scss.d.ts.map +1 -0
  121. package/dist/withPayload/config/scss.js +28 -0
  122. package/dist/withPayload/config/scss.js.map +1 -0
  123. package/dist/withPayload/devConfigReload.d.ts +14 -0
  124. package/dist/withPayload/devConfigReload.d.ts.map +1 -0
  125. package/dist/withPayload/devConfigReload.js +84 -0
  126. package/dist/withPayload/devConfigReload.js.map +1 -0
  127. package/dist/withPayload/importProtection.d.ts.map +1 -0
  128. package/dist/{vite → withPayload}/importProtection.js +2 -2
  129. package/dist/withPayload/importProtection.js.map +1 -0
  130. package/dist/withPayload/index.d.ts +112 -0
  131. package/dist/withPayload/index.d.ts.map +1 -0
  132. package/dist/withPayload/index.js +302 -0
  133. package/dist/withPayload/index.js.map +1 -0
  134. package/dist/withPayload/workarounds/clientModuleResolution.d.ts.map +1 -0
  135. package/dist/withPayload/workarounds/clientModuleResolution.js.map +1 -0
  136. package/dist/withPayload/workarounds/devTransforms.d.ts.map +1 -0
  137. package/dist/{vite/plugins → withPayload/workarounds}/devTransforms.js +5 -0
  138. package/dist/withPayload/workarounds/devTransforms.js.map +1 -0
  139. package/dist/withPayload/workarounds/reactDomServerInRsc.d.ts.map +1 -0
  140. package/dist/withPayload/workarounds/reactDomServerInRsc.js.map +1 -0
  141. package/dist/withPayload/workarounds/stripDistStyleImports.d.ts.map +1 -0
  142. package/dist/{vite/plugins → withPayload/workarounds}/stripDistStyleImports.js +1 -1
  143. package/dist/withPayload/workarounds/stripDistStyleImports.js.map +1 -0
  144. package/dist/withPayload/workarounds/stubPrettierInClient.d.ts +13 -0
  145. package/dist/withPayload/workarounds/stubPrettierInClient.d.ts.map +1 -0
  146. package/dist/withPayload/workarounds/stubPrettierInClient.js +32 -0
  147. package/dist/withPayload/workarounds/stubPrettierInClient.js.map +1 -0
  148. package/dist/withPayload/workarounds/wrapCjsForClient.d.ts.map +1 -0
  149. package/dist/withPayload/workarounds/wrapCjsForClient.js.map +1 -0
  150. package/package.json +18 -12
  151. package/dist/elements/DocumentHeaderClient/index.d.ts +0 -16
  152. package/dist/elements/DocumentHeaderClient/index.d.ts.map +0 -1
  153. package/dist/elements/DocumentHeaderClient/index.js +0 -116
  154. package/dist/elements/DocumentHeaderClient/index.js.map +0 -1
  155. package/dist/elements/RenderComponent/index.d.ts +0 -10
  156. package/dist/elements/RenderComponent/index.d.ts.map +0 -1
  157. package/dist/elements/RenderComponent/index.js +0 -12
  158. package/dist/elements/RenderComponent/index.js.map +0 -1
  159. package/dist/exports/vite.d.ts +0 -3
  160. package/dist/exports/vite.d.ts.map +0 -1
  161. package/dist/exports/vite.js +0 -3
  162. package/dist/exports/vite.js.map +0 -1
  163. package/dist/layouts/Root/index.d.ts +0 -32
  164. package/dist/layouts/Root/index.d.ts.map +0 -1
  165. package/dist/layouts/Root/index.js +0 -51
  166. package/dist/layouts/Root/index.js.map +0 -1
  167. package/dist/rsc/renderPayloadRSC.d.ts +0 -6
  168. package/dist/rsc/renderPayloadRSC.d.ts.map +0 -1
  169. package/dist/rsc/renderPayloadRSC.js +0 -6
  170. package/dist/rsc/renderPayloadRSC.js.map +0 -1
  171. package/dist/utilities/devReloadStrategy.d.ts +0 -10
  172. package/dist/utilities/devReloadStrategy.d.ts.map +0 -1
  173. package/dist/utilities/devReloadStrategy.js +0 -27
  174. package/dist/utilities/devReloadStrategy.js.map +0 -1
  175. package/dist/utilities/getExistingAuthToken.d.ts +0 -7
  176. package/dist/utilities/getExistingAuthToken.d.ts.map +0 -1
  177. package/dist/utilities/getExistingAuthToken.js +0 -18
  178. package/dist/utilities/getExistingAuthToken.js.map +0 -1
  179. package/dist/utilities/getPreferences.d.ts +0 -10
  180. package/dist/utilities/getPreferences.d.ts.map +0 -1
  181. package/dist/utilities/getPreferences.js +0 -33
  182. package/dist/utilities/getPreferences.js.map +0 -1
  183. package/dist/utilities/getRequestTheme.d.ts +0 -10
  184. package/dist/utilities/getRequestTheme.d.ts.map +0 -1
  185. package/dist/utilities/getRequestTheme.js +0 -25
  186. package/dist/utilities/getRequestTheme.js.map +0 -1
  187. package/dist/utilities/handleAPIRoute.d.ts.map +0 -1
  188. package/dist/utilities/handleAPIRoute.js.map +0 -1
  189. package/dist/utilities/importMap.server.d.ts +0 -8
  190. package/dist/utilities/importMap.server.d.ts.map +0 -1
  191. package/dist/utilities/importMap.server.js +0 -11
  192. package/dist/utilities/importMap.server.js.map +0 -1
  193. package/dist/utilities/serverFunctionHandlers.d.ts +0 -18
  194. package/dist/utilities/serverFunctionHandlers.d.ts.map +0 -1
  195. package/dist/utilities/serverFunctionHandlers.js +0 -17
  196. package/dist/utilities/serverFunctionHandlers.js.map +0 -1
  197. package/dist/utilities/setPayloadAuthCookie.d.ts +0 -9
  198. package/dist/utilities/setPayloadAuthCookie.d.ts.map +0 -1
  199. package/dist/utilities/setPayloadAuthCookie.js +0 -31
  200. package/dist/utilities/setPayloadAuthCookie.js.map +0 -1
  201. package/dist/vite/constants.d.ts +0 -42
  202. package/dist/vite/constants.d.ts.map +0 -1
  203. package/dist/vite/constants.js.map +0 -1
  204. package/dist/vite/importProtection.d.ts.map +0 -1
  205. package/dist/vite/importProtection.js.map +0 -1
  206. package/dist/vite/plugin.d.ts +0 -38
  207. package/dist/vite/plugin.d.ts.map +0 -1
  208. package/dist/vite/plugin.js +0 -177
  209. package/dist/vite/plugin.js.map +0 -1
  210. package/dist/vite/plugins/clientModuleResolution.d.ts.map +0 -1
  211. package/dist/vite/plugins/clientModuleResolution.js.map +0 -1
  212. package/dist/vite/plugins/devTransforms.d.ts.map +0 -1
  213. package/dist/vite/plugins/devTransforms.js.map +0 -1
  214. package/dist/vite/plugins/reactDomServerInRsc.d.ts.map +0 -1
  215. package/dist/vite/plugins/reactDomServerInRsc.js.map +0 -1
  216. package/dist/vite/plugins/stripDistStyleImports.d.ts.map +0 -1
  217. package/dist/vite/plugins/stripDistStyleImports.js.map +0 -1
  218. package/dist/vite/plugins/wrapCjsForClient.d.ts.map +0 -1
  219. package/dist/vite/plugins/wrapCjsForClient.js.map +0 -1
  220. /package/dist/{vite → withPayload}/importProtection.d.ts +0 -0
  221. /package/dist/{vite/plugins → withPayload/workarounds}/clientModuleResolution.d.ts +0 -0
  222. /package/dist/{vite/plugins → withPayload/workarounds}/clientModuleResolution.js +0 -0
  223. /package/dist/{vite/plugins → withPayload/workarounds}/devTransforms.d.ts +0 -0
  224. /package/dist/{vite/plugins → withPayload/workarounds}/reactDomServerInRsc.d.ts +0 -0
  225. /package/dist/{vite/plugins → withPayload/workarounds}/reactDomServerInRsc.js +0 -0
  226. /package/dist/{vite/plugins → withPayload/workarounds}/stripDistStyleImports.d.ts +0 -0
  227. /package/dist/{vite/plugins → withPayload/workarounds}/wrapCjsForClient.d.ts +0 -0
  228. /package/dist/{vite/plugins → withPayload/workarounds}/wrapCjsForClient.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/routes/adminRoutes.tsx"],"sourcesContent":["'use client'\n\nimport { NotFoundClient } from '@payloadcms/ui'\nimport { notFound, redirect, useLoaderData } from '@tanstack/react-router'\nimport { Fragment, type ReactNode } from 'react'\n\nimport { getAdminMeta } from '../utilities/meta.js'\n\n/**\n * Loader supplied by the app — a TanStack Start `createServerFn` that delegates\n * to `loadAdminPage`. Typed loosely because the server-fn's call signature is\n * generated by the Start compiler.\n */\nexport type AdminLoad = (opts: {\n data: { _splat: string; search: Record<string, string | string[]> }\n}) => Promise<any>\n\nconst searchToRecord = (searchStr: string): Record<string, string | string[]> =>\n Object.fromEntries(new URLSearchParams(searchStr)) as Record<string, string | string[]>\n\nconst runLoader = async (load: AdminLoad, splat: string, searchStr: string) => {\n const data = await load({ data: { _splat: splat, search: searchToRecord(searchStr) } })\n if (data?._redirect) {\n // eslint-disable-next-line @typescript-eslint/only-throw-error -- TanStack Router requires throwing redirect objects\n throw redirect({ to: data._redirect })\n }\n return data\n}\n\nfunction AdminPage() {\n // RSC Flight payload — render directly. Key by the loader-derived `routeKey`\n // (not `location.pathname`, which updates before `useLoaderData` during a\n // transition and would remount with the previous payload) so navigating to a\n // different admin page remounts the view, mirroring Next route-segment\n // semantics. Search params are excluded so search-only changes reconcile in place.\n const data = useLoaderData({ strict: false })\n return <Fragment key={data?.routeKey}>{data?.rscPayload}</Fragment>\n}\n\nfunction AdminNotFound(props: { data?: { routeKey?: string; rscPayload?: ReactNode } }) {\n const rscPayload = props?.data?.rscPayload\n if (!rscPayload) {\n return <NotFoundClient />\n }\n return <Fragment key={props?.data?.routeKey}>{rscPayload}</Fragment>\n}\n\n/**\n * Route options for the admin splat route (`/_payload/admin/$`). Renders Payload's\n * server-built NotFound page (shipped via the `notFound()` error's\n * `data.rscPayload`) for unknown/access-denied routes, falling back to the bare\n * client view.\n */\nexport function payloadAdminSplatRoute({ load }: { load: AdminLoad }) {\n return {\n component: AdminPage,\n head: ({ loaderData }: { loaderData?: any }) => getAdminMeta(loaderData?.metadata),\n // `staleReloadMode: 'blocking'` (a property of the loader *object*, not a\n // sibling route option — router-core only reads it off a non-function loader)\n // makes stale-match revalidation await the fresh loader before committing,\n // instead of the default background SWR that flashes the pre-navigation list\n // (e.g. a just-created doc missing) until the reload lands.\n loader: {\n handler: async ({ location, params }: { location: any; params: any }) => {\n const data = await runLoader(load, params._splat ?? '', location.searchStr)\n if (data?._notFound) {\n // eslint-disable-next-line @typescript-eslint/only-throw-error -- TanStack Router requires throwing notFound objects\n throw notFound({ data: { routeKey: data.routeKey, rscPayload: data.rscPayload } })\n }\n return data\n },\n staleReloadMode: 'blocking',\n },\n // Surface query params in `loaderDeps` so `?locale=es` re-runs the loader.\n loaderDeps: ({ search }: { search: Record<string, unknown> }) => ({\n searchKey: JSON.stringify(search),\n }),\n notFoundComponent: AdminNotFound,\n validateSearch: (search: Record<string, unknown>) => search,\n }\n}\n\n/**\n * Route options for the admin index route (`/_payload/admin/`). Same loader as the\n * splat route but throws a bare `notFound()` (no rscPayload) on miss.\n */\nexport function payloadAdminIndexRoute({ load }: { load: AdminLoad }) {\n return {\n component: AdminPage,\n head: ({ loaderData }: { loaderData?: any }) => getAdminMeta(loaderData?.metadata),\n loader: {\n handler: async ({ location }: { location: any }) => {\n const data = await runLoader(load, '', location.searchStr)\n if (data?._notFound) {\n // eslint-disable-next-line @typescript-eslint/only-throw-error -- TanStack Router requires throwing notFound objects\n throw notFound()\n }\n return data\n },\n staleReloadMode: 'blocking',\n },\n loaderDeps: ({ search }: { search: Record<string, unknown> }) => ({\n searchKey: JSON.stringify(search),\n }),\n validateSearch: (search: Record<string, unknown>) => search,\n }\n}\n"],"names":["NotFoundClient","notFound","redirect","useLoaderData","Fragment","getAdminMeta","searchToRecord","searchStr","Object","fromEntries","URLSearchParams","runLoader","load","splat","data","_splat","search","_redirect","to","AdminPage","strict","rscPayload","routeKey","AdminNotFound","props","payloadAdminSplatRoute","component","head","loaderData","metadata","loader","handler","location","params","_notFound","staleReloadMode","loaderDeps","searchKey","JSON","stringify","notFoundComponent","validateSearch","payloadAdminIndexRoute"],"mappings":"AAAA;;AAEA,SAASA,cAAc,QAAQ,iBAAgB;AAC/C,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,yBAAwB;AAC1E,SAASC,QAAQ,QAAwB,QAAO;AAEhD,SAASC,YAAY,QAAQ,uBAAsB;AAWnD,MAAMC,iBAAiB,CAACC,YACtBC,OAAOC,WAAW,CAAC,IAAIC,gBAAgBH;AAEzC,MAAMI,YAAY,OAAOC,MAAiBC,OAAeN;IACvD,MAAMO,OAAO,MAAMF,KAAK;QAAEE,MAAM;YAAEC,QAAQF;YAAOG,QAAQV,eAAeC;QAAW;IAAE;IACrF,IAAIO,MAAMG,WAAW;QACnB,qHAAqH;QACrH,MAAMf,SAAS;YAAEgB,IAAIJ,KAAKG,SAAS;QAAC;IACtC;IACA,OAAOH;AACT;AAEA,SAASK;IACP,6EAA6E;IAC7E,0EAA0E;IAC1E,6EAA6E;IAC7E,uEAAuE;IACvE,mFAAmF;IACnF,MAAML,OAAOX,cAAc;QAAEiB,QAAQ;IAAM;IAC3C,qBAAO,KAAChB;kBAA+BU,MAAMO;OAAvBP,MAAMQ;AAC9B;AAEA,SAASC,cAAcC,KAA+D;IACpF,MAAMH,aAAaG,OAAOV,MAAMO;IAChC,IAAI,CAACA,YAAY;QACf,qBAAO,KAACrB;IACV;IACA,qBAAO,KAACI;kBAAsCiB;OAAxBG,OAAOV,MAAMQ;AACrC;AAEA;;;;;CAKC,GACD,OAAO,SAASG,uBAAuB,EAAEb,IAAI,EAAuB;IAClE,OAAO;QACLc,WAAWP;QACXQ,MAAM,CAAC,EAAEC,UAAU,EAAwB,GAAKvB,aAAauB,YAAYC;QACzE,0EAA0E;QAC1E,8EAA8E;QAC9E,2EAA2E;QAC3E,6EAA6E;QAC7E,4DAA4D;QAC5DC,QAAQ;YACNC,SAAS,OAAO,EAAEC,QAAQ,EAAEC,MAAM,EAAkC;gBAClE,MAAMnB,OAAO,MAAMH,UAAUC,MAAMqB,OAAOlB,MAAM,IAAI,IAAIiB,SAASzB,SAAS;gBAC1E,IAAIO,MAAMoB,WAAW;oBACnB,qHAAqH;oBACrH,MAAMjC,SAAS;wBAAEa,MAAM;4BAAEQ,UAAUR,KAAKQ,QAAQ;4BAAED,YAAYP,KAAKO,UAAU;wBAAC;oBAAE;gBAClF;gBACA,OAAOP;YACT;YACAqB,iBAAiB;QACnB;QACA,2EAA2E;QAC3EC,YAAY,CAAC,EAAEpB,MAAM,EAAuC,GAAM,CAAA;gBAChEqB,WAAWC,KAAKC,SAAS,CAACvB;YAC5B,CAAA;QACAwB,mBAAmBjB;QACnBkB,gBAAgB,CAACzB,SAAoCA;IACvD;AACF;AAEA;;;CAGC,GACD,OAAO,SAAS0B,uBAAuB,EAAE9B,IAAI,EAAuB;IAClE,OAAO;QACLc,WAAWP;QACXQ,MAAM,CAAC,EAAEC,UAAU,EAAwB,GAAKvB,aAAauB,YAAYC;QACzEC,QAAQ;YACNC,SAAS,OAAO,EAAEC,QAAQ,EAAqB;gBAC7C,MAAMlB,OAAO,MAAMH,UAAUC,MAAM,IAAIoB,SAASzB,SAAS;gBACzD,IAAIO,MAAMoB,WAAW;oBACnB,qHAAqH;oBACrH,MAAMjC;gBACR;gBACA,OAAOa;YACT;YACAqB,iBAAiB;QACnB;QACAC,YAAY,CAAC,EAAEpB,MAAM,EAAuC,GAAM,CAAA;gBAChEqB,WAAWC,KAAKC,SAAS,CAACvB;YAC5B,CAAA;QACAyB,gBAAgB,CAACzB,SAAoCA;IACvD;AACF"}
1
+ {"version":3,"sources":["../../src/routes/adminRoutes.tsx"],"sourcesContent":["'use client'\n\nimport type { NotFoundRouteProps } from '@tanstack/react-router'\n\nimport { NotFoundClient, useRouteTransition } from '@payloadcms/ui'\nimport { notFound, redirect, useLoaderData } from '@tanstack/react-router'\nimport { Fragment, type ReactNode, useDeferredValue, useEffect } from 'react'\n\nimport { getAdminMeta } from '../utilities/meta.js'\n\n/**\n * Loader supplied by the app — a TanStack Start `createServerFn` that delegates\n * to `loadAdminPage`. Typed loosely because the server-fn's call signature is\n * generated by the Start compiler.\n */\nexport type AdminLoad = (opts: {\n data: { _splat: string; search: Record<string, string | string[]> }\n}) => Promise<any>\n\nconst searchToRecord = (searchStr: string): Record<string, string | string[]> =>\n Object.fromEntries(new URLSearchParams(searchStr)) as Record<string, string | string[]>\n\nconst runLoader = async (load: AdminLoad, splat: string, searchStr: string) => {\n const data = await load({ data: { _splat: splat, search: searchToRecord(searchStr) } })\n if (data?._redirect) {\n // eslint-disable-next-line @typescript-eslint/only-throw-error -- TanStack Router requires throwing redirect objects\n throw redirect({ to: data._redirect })\n }\n return data\n}\n\nfunction AdminPage() {\n // Note: React key intentionally omitted here so the persistent template (nav, header) doesn't remount and flash on navigation.\n // The per-route view key is attached server-side to the view subtree instead, via `renderRoot`'s `key` in `loadAdminPage`.\n const data = useLoaderData({ strict: false })\n\n // Route state comes from an external store, so a new RSC payload that suspends\n // on code-split client references can reveal the router's null fallback.\n // Keep the current payload painted until the next one is renderable.\n const rscPayload = useDeferredValue(data?.rscPayload)\n const { holdRouteTransition } = useRouteTransition()\n const isRscPayloadDeferred = rscPayload !== data?.rscPayload\n\n useEffect(() => {\n if (!isRscPayloadDeferred) {\n return\n }\n\n const releaseRouteTransition = holdRouteTransition()\n\n return () => releaseRouteTransition()\n }, [holdRouteTransition, isRscPayloadDeferred])\n\n return <Fragment>{rscPayload}</Fragment>\n}\n\ntype AdminNotFoundData = { routeKey?: string; rscPayload?: ReactNode }\n\nfunction AdminNotFound({ data }: NotFoundRouteProps) {\n // TanStack exposes not-found data as unknown; this route only receives the shape thrown below.\n const { routeKey, rscPayload } = (data ?? {}) as AdminNotFoundData\n if (!rscPayload) {\n return <NotFoundClient />\n }\n return <Fragment key={routeKey}>{rscPayload}</Fragment>\n}\n\nconst adminRouteOptions = ({\n forwardNotFoundPayload,\n load,\n resolveSplat,\n}: {\n /**\n * Ships the server-rendered NotFound tree through `notFound()`'s `data` so a\n * `notFoundComponent` can render it with the full admin chrome. Routes without\n * one throw bare.\n */\n forwardNotFoundPayload: boolean\n load: AdminLoad\n /** The route's splat, i.e. the path after `/admin/`. */\n resolveSplat: (params: any) => string\n}) => ({\n component: AdminPage,\n head: ({ loaderData }: { loaderData?: any }) => getAdminMeta(loaderData?.metadata),\n // Both admin routes must use the same boundary type so index ↔ splat\n // navigation preserves the existing admin subtree.\n notFoundComponent: AdminNotFound,\n // `staleReloadMode: 'blocking'` (a property of the loader *object*, not a\n // sibling route option — router-core only reads it off a non-function loader)\n // makes stale-match revalidation await the fresh loader before committing,\n // instead of the default background SWR that flashes the pre-navigation list\n // (e.g. a just-created doc missing) until the reload lands.\n loader: {\n handler: async ({ location, params }: { location: any; params: any }) => {\n const data = await runLoader(load, resolveSplat(params), location.searchStr)\n if (data?._notFound) {\n // eslint-disable-next-line @typescript-eslint/only-throw-error -- TanStack Router requires throwing notFound objects\n throw notFound(\n forwardNotFoundPayload\n ? { data: { routeKey: data.routeKey, rscPayload: data.rscPayload } }\n : undefined,\n )\n }\n return data\n },\n staleReloadMode: 'blocking' as const,\n },\n // Surface query params in `loaderDeps` so `?locale=es` re-runs the loader.\n loaderDeps: ({ search }: { search: Record<string, unknown> }) => ({\n searchKey: JSON.stringify(search),\n }),\n validateSearch: (search: Record<string, unknown>) => search,\n})\n\n/**\n * Route options for the admin splat route (`/_payload/admin/$`). Renders Payload's\n * server-built NotFound page (shipped via the `notFound()` error's\n * `data.rscPayload`) for unknown/access-denied routes, falling back to the bare\n * client view.\n */\nexport function payloadAdminSplatRoute({ load }: { load: AdminLoad }) {\n return adminRouteOptions({\n forwardNotFoundPayload: true,\n load,\n resolveSplat: (params) => params._splat ?? '',\n })\n}\n\n/**\n * Route options for the admin index route (`/_payload/admin/`). Not-found\n * results omit the RSC payload and fall back to `NotFoundClient`.\n */\nexport function payloadAdminIndexRoute({ load }: { load: AdminLoad }) {\n return adminRouteOptions({\n forwardNotFoundPayload: false,\n load,\n resolveSplat: () => '',\n })\n}\n"],"names":["NotFoundClient","useRouteTransition","notFound","redirect","useLoaderData","Fragment","useDeferredValue","useEffect","getAdminMeta","searchToRecord","searchStr","Object","fromEntries","URLSearchParams","runLoader","load","splat","data","_splat","search","_redirect","to","AdminPage","strict","rscPayload","holdRouteTransition","isRscPayloadDeferred","releaseRouteTransition","AdminNotFound","routeKey","adminRouteOptions","forwardNotFoundPayload","resolveSplat","component","head","loaderData","metadata","notFoundComponent","loader","handler","location","params","_notFound","undefined","staleReloadMode","loaderDeps","searchKey","JSON","stringify","validateSearch","payloadAdminSplatRoute","payloadAdminIndexRoute"],"mappings":"AAAA;;AAIA,SAASA,cAAc,EAAEC,kBAAkB,QAAQ,iBAAgB;AACnE,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,yBAAwB;AAC1E,SAASC,QAAQ,EAAkBC,gBAAgB,EAAEC,SAAS,QAAQ,QAAO;AAE7E,SAASC,YAAY,QAAQ,uBAAsB;AAWnD,MAAMC,iBAAiB,CAACC,YACtBC,OAAOC,WAAW,CAAC,IAAIC,gBAAgBH;AAEzC,MAAMI,YAAY,OAAOC,MAAiBC,OAAeN;IACvD,MAAMO,OAAO,MAAMF,KAAK;QAAEE,MAAM;YAAEC,QAAQF;YAAOG,QAAQV,eAAeC;QAAW;IAAE;IACrF,IAAIO,MAAMG,WAAW;QACnB,qHAAqH;QACrH,MAAMjB,SAAS;YAAEkB,IAAIJ,KAAKG,SAAS;QAAC;IACtC;IACA,OAAOH;AACT;AAEA,SAASK;IACP,+HAA+H;IAC/H,2HAA2H;IAC3H,MAAML,OAAOb,cAAc;QAAEmB,QAAQ;IAAM;IAE3C,+EAA+E;IAC/E,yEAAyE;IACzE,qEAAqE;IACrE,MAAMC,aAAalB,iBAAiBW,MAAMO;IAC1C,MAAM,EAAEC,mBAAmB,EAAE,GAAGxB;IAChC,MAAMyB,uBAAuBF,eAAeP,MAAMO;IAElDjB,UAAU;QACR,IAAI,CAACmB,sBAAsB;YACzB;QACF;QAEA,MAAMC,yBAAyBF;QAE/B,OAAO,IAAME;IACf,GAAG;QAACF;QAAqBC;KAAqB;IAE9C,qBAAO,KAACrB;kBAAUmB;;AACpB;AAIA,SAASI,cAAc,EAAEX,IAAI,EAAsB;IACjD,+FAA+F;IAC/F,MAAM,EAAEY,QAAQ,EAAEL,UAAU,EAAE,GAAIP,QAAQ,CAAC;IAC3C,IAAI,CAACO,YAAY;QACf,qBAAO,KAACxB;IACV;IACA,qBAAO,KAACK;kBAAyBmB;OAAXK;AACxB;AAEA,MAAMC,oBAAoB,CAAC,EACzBC,sBAAsB,EACtBhB,IAAI,EACJiB,YAAY,EAWb,GAAM,CAAA;QACLC,WAAWX;QACXY,MAAM,CAAC,EAAEC,UAAU,EAAwB,GAAK3B,aAAa2B,YAAYC;QACzE,qEAAqE;QACrE,mDAAmD;QACnDC,mBAAmBT;QACnB,0EAA0E;QAC1E,8EAA8E;QAC9E,2EAA2E;QAC3E,6EAA6E;QAC7E,4DAA4D;QAC5DU,QAAQ;YACNC,SAAS,OAAO,EAAEC,QAAQ,EAAEC,MAAM,EAAkC;gBAClE,MAAMxB,OAAO,MAAMH,UAAUC,MAAMiB,aAAaS,SAASD,SAAS9B,SAAS;gBAC3E,IAAIO,MAAMyB,WAAW;oBACnB,qHAAqH;oBACrH,MAAMxC,SACJ6B,yBACI;wBAAEd,MAAM;4BAAEY,UAAUZ,KAAKY,QAAQ;4BAAEL,YAAYP,KAAKO,UAAU;wBAAC;oBAAE,IACjEmB;gBAER;gBACA,OAAO1B;YACT;YACA2B,iBAAiB;QACnB;QACA,2EAA2E;QAC3EC,YAAY,CAAC,EAAE1B,MAAM,EAAuC,GAAM,CAAA;gBAChE2B,WAAWC,KAAKC,SAAS,CAAC7B;YAC5B,CAAA;QACA8B,gBAAgB,CAAC9B,SAAoCA;IACvD,CAAA;AAEA;;;;;CAKC,GACD,OAAO,SAAS+B,uBAAuB,EAAEnC,IAAI,EAAuB;IAClE,OAAOe,kBAAkB;QACvBC,wBAAwB;QACxBhB;QACAiB,cAAc,CAACS,SAAWA,OAAOvB,MAAM,IAAI;IAC7C;AACF;AAEA;;;CAGC,GACD,OAAO,SAASiC,uBAAuB,EAAEpC,IAAI,EAAuB;IAClE,OAAOe,kBAAkB;QACvBC,wBAAwB;QACxBhB;QACAiB,cAAc,IAAM;IACtB;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 }),
@@ -1 +1 @@
1
- {"version":3,"file":"apiRoute.d.ts","sourceRoot":"","sources":["../../src/routes/apiRoute.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;;;;;;;;;;;;;;;;;;;GAmBG;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"}
1
+ {"version":3,"file":"apiRoute.d.ts","sourceRoot":"","sources":["../../src/routes/apiRoute.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('../utilities/handleAPIRoute.server.js');
23
28
  return handleAPIRoute({
24
29
  config: await getConfig(),
25
30
  request
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/routes/apiRoute.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 * 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 * 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('../utilities/handleAPIRoute.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;;;;;;;;;;;;;;;;;;;CAmBC,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
+ {"version":3,"sources":["../../src/routes/apiRoute.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('../utilities/handleAPIRoute.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,11 +1,12 @@
1
1
  import type { ComponentProps } from 'react';
2
2
  import { RootProvider } from '@payloadcms/ui';
3
+ import type { LoadLayoutDataResult } from '../utilities/loadLayoutData.js';
3
4
  /**
4
5
  * Loader supplied by the app — a TanStack Start `createServerFn` that delegates
5
6
  * to `loadLayoutData`. Typed loosely because the server-fn's call signature is
6
7
  * generated by the Start compiler.
7
8
  */
8
- export type LayoutLoad = () => Promise<Record<string, unknown>>;
9
+ export type LayoutLoad = () => Promise<LoadLayoutDataResult>;
9
10
  /**
10
11
  * Route options for the Payload admin layout (`/_payload`). Maps the layout
11
12
  * loader data onto `RootProvider` and renders the admin chrome (progress bar,
@@ -19,8 +20,8 @@ export declare function payloadLayoutRoute({ load, serverFunction, }: {
19
20
  }): {
20
21
  component: () => import("react").JSX.Element;
21
22
  loader: {
22
- handler: () => Promise<Record<string, unknown>>;
23
- staleReloadMode: string;
23
+ handler: () => Promise<import("../utilities/toSerializable.js").SerializableRecord>;
24
+ staleReloadMode: 'blocking';
24
25
  };
25
26
  };
26
27
  //# sourceMappingURL=layoutRoute.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"layoutRoute.d.ts","sourceRoot":"","sources":["../../src/routes/layoutRoute.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAE3C,OAAO,EAAe,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAK1D;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;AAE/D;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,cAAc,GACf,EAAE;IACD,IAAI,EAAE,UAAU,CAAA;IAChB,cAAc,EAAE,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC,gBAAgB,CAAC,CAAA;CACtE;;;;;;EAwCA"}
1
+ {"version":3,"file":"layoutRoute.d.ts","sourceRoot":"","sources":["../../src/routes/layoutRoute.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAE3C,OAAO,EAAe,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAG1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AAI1E;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,oBAAoB,CAAC,CAAA;AAE5D;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,cAAc,GACf,EAAE;IACD,IAAI,EAAE,UAAU,CAAA;IAChB,cAAc,EAAE,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC,gBAAgB,CAAC,CAAA;CACtE;IAsCG,SAAS;IACT,MAAM;QAAI,OAAO;QAAgB,eAAe,EAAE,UAAU;;EAE/D"}
@@ -19,6 +19,7 @@ import { TanStackRouterAdapter } from '../elements/RouterAdapter/index.js';
19
19
  /*#__PURE__*/ _jsxs(RootProvider, {
20
20
  config: data.clientConfig,
21
21
  dateFNSKey: data.dateFNSKey,
22
+ embed: data.isEmbedded,
22
23
  fallbackLang: data.fallbackLang,
23
24
  highContrastMode: false,
24
25
  isNavOpen: data.isNavOpen,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/routes/layoutRoute.tsx"],"sourcesContent":["'use client'\n\nimport type { ComponentProps } from 'react'\n\nimport { ProgressBar, RootProvider } from '@payloadcms/ui'\nimport { Outlet, useLoaderData } from '@tanstack/react-router'\n\nimport { TanStackRouterAdapter } from '../elements/RouterAdapter/index.js'\n\n/**\n * Loader supplied by the app — a TanStack Start `createServerFn` that delegates\n * to `loadLayoutData`. Typed loosely because the server-fn's call signature is\n * generated by the Start compiler.\n */\nexport type LayoutLoad = () => Promise<Record<string, unknown>>\n\n/**\n * Route options for the Payload admin layout (`/_payload`). Maps the layout\n * loader data onto `RootProvider` and renders the admin chrome (progress bar,\n * custom-provider tree or router `<Outlet />`, portal mount). The app supplies\n * `load` (the layout-data server fn) and `serverFunction` (the server-function\n * client wired into `RootProvider`); everything else is adapter-owned.\n */\nexport function payloadLayoutRoute({\n load,\n serverFunction,\n}: {\n load: LayoutLoad\n serverFunction: ComponentProps<typeof RootProvider>['serverFunction']\n}) {\n function PayloadLayout() {\n const data = useLoaderData({ strict: false })\n\n return (\n <>\n <RootProvider\n config={data.clientConfig}\n dateFNSKey={data.dateFNSKey}\n fallbackLang={data.fallbackLang}\n highContrastMode={false}\n isNavOpen={data.isNavOpen}\n languageCode={data.languageCode}\n languageOptions={data.languageOptions}\n locale={data.locale}\n permissions={data.user ? data.permissions : null}\n RouterAdapter={TanStackRouterAdapter}\n serverFunction={serverFunction}\n theme={data.theme}\n translations={data.translations}\n user={data.user}\n >\n <ProgressBar />\n {/* `data.providers` is the custom-provider tree (config.admin.components.providers)\n already wrapping the router <Outlet />; falls back to a bare <Outlet /> when\n no custom providers are configured. */}\n {data.providers ?? <Outlet />}\n </RootProvider>\n <div id=\"portal\" />\n </>\n )\n }\n\n // `staleReloadMode` lives on the loader *object* — router-core only reads it\n // off a non-function loader — so stale-match revalidation blocks on the fresh\n // loader instead of flashing stale layout data via the default background SWR.\n return {\n component: PayloadLayout,\n loader: { handler: () => load(), staleReloadMode: 'blocking' },\n }\n}\n"],"names":["ProgressBar","RootProvider","Outlet","useLoaderData","TanStackRouterAdapter","payloadLayoutRoute","load","serverFunction","PayloadLayout","data","strict","config","clientConfig","dateFNSKey","fallbackLang","highContrastMode","isNavOpen","languageCode","languageOptions","locale","permissions","user","RouterAdapter","theme","translations","providers","div","id","component","loader","handler","staleReloadMode"],"mappings":"AAAA;;AAIA,SAASA,WAAW,EAAEC,YAAY,QAAQ,iBAAgB;AAC1D,SAASC,MAAM,EAAEC,aAAa,QAAQ,yBAAwB;AAE9D,SAASC,qBAAqB,QAAQ,qCAAoC;AAS1E;;;;;;CAMC,GACD,OAAO,SAASC,mBAAmB,EACjCC,IAAI,EACJC,cAAc,EAIf;IACC,SAASC;QACP,MAAMC,OAAON,cAAc;YAAEO,QAAQ;QAAM;QAE3C,qBACE;;8BACE,MAACT;oBACCU,QAAQF,KAAKG,YAAY;oBACzBC,YAAYJ,KAAKI,UAAU;oBAC3BC,cAAcL,KAAKK,YAAY;oBAC/BC,kBAAkB;oBAClBC,WAAWP,KAAKO,SAAS;oBACzBC,cAAcR,KAAKQ,YAAY;oBAC/BC,iBAAiBT,KAAKS,eAAe;oBACrCC,QAAQV,KAAKU,MAAM;oBACnBC,aAAaX,KAAKY,IAAI,GAAGZ,KAAKW,WAAW,GAAG;oBAC5CE,eAAelB;oBACfG,gBAAgBA;oBAChBgB,OAAOd,KAAKc,KAAK;oBACjBC,cAAcf,KAAKe,YAAY;oBAC/BH,MAAMZ,KAAKY,IAAI;;sCAEf,KAACrB;wBAIAS,KAAKgB,SAAS,kBAAI,KAACvB;;;8BAEtB,KAACwB;oBAAIC,IAAG;;;;IAGd;IAEA,6EAA6E;IAC7E,8EAA8E;IAC9E,+EAA+E;IAC/E,OAAO;QACLC,WAAWpB;QACXqB,QAAQ;YAAEC,SAAS,IAAMxB;YAAQyB,iBAAiB;QAAW;IAC/D;AACF"}
1
+ {"version":3,"sources":["../../src/routes/layoutRoute.tsx"],"sourcesContent":["'use client'\n\nimport type { ComponentProps } from 'react'\n\nimport { ProgressBar, RootProvider } from '@payloadcms/ui'\nimport { Outlet, useLoaderData } from '@tanstack/react-router'\n\nimport type { LoadLayoutDataResult } from '../utilities/loadLayoutData.js'\n\nimport { TanStackRouterAdapter } from '../elements/RouterAdapter/index.js'\n\n/**\n * Loader supplied by the app — a TanStack Start `createServerFn` that delegates\n * to `loadLayoutData`. Typed loosely because the server-fn's call signature is\n * generated by the Start compiler.\n */\nexport type LayoutLoad = () => Promise<LoadLayoutDataResult>\n\n/**\n * Route options for the Payload admin layout (`/_payload`). Maps the layout\n * loader data onto `RootProvider` and renders the admin chrome (progress bar,\n * custom-provider tree or router `<Outlet />`, portal mount). The app supplies\n * `load` (the layout-data server fn) and `serverFunction` (the server-function\n * client wired into `RootProvider`); everything else is adapter-owned.\n */\nexport function payloadLayoutRoute({\n load,\n serverFunction,\n}: {\n load: LayoutLoad\n serverFunction: ComponentProps<typeof RootProvider>['serverFunction']\n}) {\n function PayloadLayout() {\n const data = useLoaderData({ strict: false })\n\n return (\n <>\n <RootProvider\n config={data.clientConfig}\n dateFNSKey={data.dateFNSKey}\n embed={data.isEmbedded}\n fallbackLang={data.fallbackLang}\n highContrastMode={false}\n isNavOpen={data.isNavOpen}\n languageCode={data.languageCode}\n languageOptions={data.languageOptions}\n locale={data.locale}\n permissions={data.user ? data.permissions : null}\n RouterAdapter={TanStackRouterAdapter}\n serverFunction={serverFunction}\n theme={data.theme}\n translations={data.translations}\n user={data.user}\n >\n <ProgressBar />\n {/* `data.providers` is the custom-provider tree (config.admin.components.providers)\n already wrapping the router <Outlet />; falls back to a bare <Outlet /> when\n no custom providers are configured. */}\n {data.providers ?? <Outlet />}\n </RootProvider>\n <div id=\"portal\" />\n </>\n )\n }\n\n // `staleReloadMode` lives on the loader *object* — router-core only reads it\n // off a non-function loader — so stale-match revalidation blocks on the fresh\n // loader instead of flashing stale layout data via the default background SWR.\n return {\n component: PayloadLayout,\n loader: { handler: () => load(), staleReloadMode: 'blocking' as const },\n }\n}\n"],"names":["ProgressBar","RootProvider","Outlet","useLoaderData","TanStackRouterAdapter","payloadLayoutRoute","load","serverFunction","PayloadLayout","data","strict","config","clientConfig","dateFNSKey","embed","isEmbedded","fallbackLang","highContrastMode","isNavOpen","languageCode","languageOptions","locale","permissions","user","RouterAdapter","theme","translations","providers","div","id","component","loader","handler","staleReloadMode"],"mappings":"AAAA;;AAIA,SAASA,WAAW,EAAEC,YAAY,QAAQ,iBAAgB;AAC1D,SAASC,MAAM,EAAEC,aAAa,QAAQ,yBAAwB;AAI9D,SAASC,qBAAqB,QAAQ,qCAAoC;AAS1E;;;;;;CAMC,GACD,OAAO,SAASC,mBAAmB,EACjCC,IAAI,EACJC,cAAc,EAIf;IACC,SAASC;QACP,MAAMC,OAAON,cAAc;YAAEO,QAAQ;QAAM;QAE3C,qBACE;;8BACE,MAACT;oBACCU,QAAQF,KAAKG,YAAY;oBACzBC,YAAYJ,KAAKI,UAAU;oBAC3BC,OAAOL,KAAKM,UAAU;oBACtBC,cAAcP,KAAKO,YAAY;oBAC/BC,kBAAkB;oBAClBC,WAAWT,KAAKS,SAAS;oBACzBC,cAAcV,KAAKU,YAAY;oBAC/BC,iBAAiBX,KAAKW,eAAe;oBACrCC,QAAQZ,KAAKY,MAAM;oBACnBC,aAAab,KAAKc,IAAI,GAAGd,KAAKa,WAAW,GAAG;oBAC5CE,eAAepB;oBACfG,gBAAgBA;oBAChBkB,OAAOhB,KAAKgB,KAAK;oBACjBC,cAAcjB,KAAKiB,YAAY;oBAC/BH,MAAMd,KAAKc,IAAI;;sCAEf,KAACvB;wBAIAS,KAAKkB,SAAS,kBAAI,KAACzB;;;8BAEtB,KAAC0B;oBAAIC,IAAG;;;;IAGd;IAEA,6EAA6E;IAC7E,8EAA8E;IAC9E,+EAA+E;IAC/E,OAAO;QACLC,WAAWtB;QACXuB,QAAQ;YAAEC,SAAS,IAAM1B;YAAQ2B,iBAAiB;QAAoB;IACxE;AACF"}
@@ -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,38 @@
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 `initReq.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
+ const listeners = new Set();
23
+ hot.on(PAYLOAD_CONFIG_CHANGED_EVENT, ()=>{
24
+ for (const onReload of listeners){
25
+ onReload();
26
+ }
27
+ });
28
+ registerDevReloadStrategy({
29
+ connect: (onReload)=>{
30
+ listeners.add(onReload);
31
+ return ()=>{
32
+ listeners.delete(onReload);
33
+ };
34
+ }
35
+ });
36
+ }
37
+
38
+ //# 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 `initReq.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 const listeners = new Set<() => void>()\n\n hot.on(PAYLOAD_CONFIG_CHANGED_EVENT, () => {\n for (const onReload of listeners) {\n onReload()\n }\n })\n\n registerDevReloadStrategy({\n connect: (onReload) => {\n listeners.add(onReload)\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","listeners","Set","on","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;IACP,MAAMC,YAAY,IAAIC;IAEtBF,IAAIG,EAAE,CAACJ,8BAA8B;QACnC,KAAK,MAAMK,YAAYH,UAAW;YAChCG;QACF;IACF;IAEAN,0BAA0B;QACxBO,SAAS,CAACD;YACRH,UAAUK,GAAG,CAACF;YAEd,OAAO;gBACLH,UAAUM,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"getRequestLocale.d.ts","sourceRoot":"","sources":["../../src/utilities/getRequestLocale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAOrD,KAAK,oBAAoB,GAAG;IAC1B,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAED,wBAAsB,gBAAgB,CAAC,EAAE,GAAG,EAAE,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAkCjG"}
1
+ {"version":3,"file":"getRequestLocale.d.ts","sourceRoot":"","sources":["../../src/utilities/getRequestLocale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAKrD,KAAK,oBAAoB,GAAG;IAC1B,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAED,wBAAsB,gBAAgB,CAAC,EAAE,GAAG,EAAE,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAkCjG"}
@@ -1,6 +1,5 @@
1
- import { upsertPreferences } from '@payloadcms/ui/rsc';
1
+ import { getPreferences, upsertPreferences } from '@payloadcms/ui/rsc';
2
2
  import { findLocaleFromCode } from '@payloadcms/ui/shared';
3
- import { getPreferences } from './getPreferences.js';
4
3
  export async function getRequestLocale({ req }) {
5
4
  if (req.payload.config.localization) {
6
5
  const localeFromParams = req.query.locale;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/getRequestLocale.ts"],"sourcesContent":["import type { Locale, PayloadRequest } from 'payload'\n\nimport { upsertPreferences } from '@payloadcms/ui/rsc'\nimport { findLocaleFromCode } from '@payloadcms/ui/shared'\n\nimport { getPreferences } from './getPreferences.js'\n\ntype GetRequestLocaleArgs = {\n req: PayloadRequest\n}\n\nexport async function getRequestLocale({ req }: GetRequestLocaleArgs): Promise<Locale | undefined> {\n if (req.payload.config.localization) {\n const localeFromParams = req.query.locale as string | undefined\n\n if (req.user && localeFromParams) {\n await upsertPreferences<Locale['code']>({ key: 'locale', req, value: localeFromParams })\n }\n\n const userLocale =\n req.user &&\n findLocaleFromCode(\n req.payload.config.localization,\n localeFromParams ||\n (\n await getPreferences<Locale['code']>(\n 'locale',\n req.payload,\n req.user.id,\n req.user.collection,\n )\n )?.value,\n )\n\n return (\n userLocale ??\n findLocaleFromCode(\n req.payload.config.localization,\n req.payload.config.localization.defaultLocale || 'en',\n ) ??\n undefined\n )\n }\n\n return undefined\n}\n"],"names":["upsertPreferences","findLocaleFromCode","getPreferences","getRequestLocale","req","payload","config","localization","localeFromParams","query","locale","user","key","value","userLocale","id","collection","defaultLocale","undefined"],"mappings":"AAEA,SAASA,iBAAiB,QAAQ,qBAAoB;AACtD,SAASC,kBAAkB,QAAQ,wBAAuB;AAE1D,SAASC,cAAc,QAAQ,sBAAqB;AAMpD,OAAO,eAAeC,iBAAiB,EAAEC,GAAG,EAAwB;IAClE,IAAIA,IAAIC,OAAO,CAACC,MAAM,CAACC,YAAY,EAAE;QACnC,MAAMC,mBAAmBJ,IAAIK,KAAK,CAACC,MAAM;QAEzC,IAAIN,IAAIO,IAAI,IAAIH,kBAAkB;YAChC,MAAMR,kBAAkC;gBAAEY,KAAK;gBAAUR;gBAAKS,OAAOL;YAAiB;QACxF;QAEA,MAAMM,aACJV,IAAIO,IAAI,IACRV,mBACEG,IAAIC,OAAO,CAACC,MAAM,CAACC,YAAY,EAC/BC,oBAEI,CAAA,MAAMN,eACJ,UACAE,IAAIC,OAAO,EACXD,IAAIO,IAAI,CAACI,EAAE,EACXX,IAAIO,IAAI,CAACK,UAAU,CACrB,GACCH;QAGT,OACEC,cACAb,mBACEG,IAAIC,OAAO,CAACC,MAAM,CAACC,YAAY,EAC/BH,IAAIC,OAAO,CAACC,MAAM,CAACC,YAAY,CAACU,aAAa,IAAI,SAEnDC;IAEJ;IAEA,OAAOA;AACT"}
1
+ {"version":3,"sources":["../../src/utilities/getRequestLocale.ts"],"sourcesContent":["import type { Locale, PayloadRequest } from 'payload'\n\nimport { getPreferences, upsertPreferences } from '@payloadcms/ui/rsc'\nimport { findLocaleFromCode } from '@payloadcms/ui/shared'\n\ntype GetRequestLocaleArgs = {\n req: PayloadRequest\n}\n\nexport async function getRequestLocale({ req }: GetRequestLocaleArgs): Promise<Locale | undefined> {\n if (req.payload.config.localization) {\n const localeFromParams = req.query.locale as string | undefined\n\n if (req.user && localeFromParams) {\n await upsertPreferences<Locale['code']>({ key: 'locale', req, value: localeFromParams })\n }\n\n const userLocale =\n req.user &&\n findLocaleFromCode(\n req.payload.config.localization,\n localeFromParams ||\n (\n await getPreferences<Locale['code']>(\n 'locale',\n req.payload,\n req.user.id,\n req.user.collection,\n )\n )?.value,\n )\n\n return (\n userLocale ??\n findLocaleFromCode(\n req.payload.config.localization,\n req.payload.config.localization.defaultLocale || 'en',\n ) ??\n undefined\n )\n }\n\n return undefined\n}\n"],"names":["getPreferences","upsertPreferences","findLocaleFromCode","getRequestLocale","req","payload","config","localization","localeFromParams","query","locale","user","key","value","userLocale","id","collection","defaultLocale","undefined"],"mappings":"AAEA,SAASA,cAAc,EAAEC,iBAAiB,QAAQ,qBAAoB;AACtE,SAASC,kBAAkB,QAAQ,wBAAuB;AAM1D,OAAO,eAAeC,iBAAiB,EAAEC,GAAG,EAAwB;IAClE,IAAIA,IAAIC,OAAO,CAACC,MAAM,CAACC,YAAY,EAAE;QACnC,MAAMC,mBAAmBJ,IAAIK,KAAK,CAACC,MAAM;QAEzC,IAAIN,IAAIO,IAAI,IAAIH,kBAAkB;YAChC,MAAMP,kBAAkC;gBAAEW,KAAK;gBAAUR;gBAAKS,OAAOL;YAAiB;QACxF;QAEA,MAAMM,aACJV,IAAIO,IAAI,IACRT,mBACEE,IAAIC,OAAO,CAACC,MAAM,CAACC,YAAY,EAC/BC,oBAEI,CAAA,MAAMR,eACJ,UACAI,IAAIC,OAAO,EACXD,IAAIO,IAAI,CAACI,EAAE,EACXX,IAAIO,IAAI,CAACK,UAAU,CACrB,GACCH;QAGT,OACEC,cACAZ,mBACEE,IAAIC,OAAO,CAACC,MAAM,CAACC,YAAY,EAC/BH,IAAIC,OAAO,CAACC,MAAM,CAACC,YAAY,CAACU,aAAa,IAAI,SAEnDC;IAEJ;IAEA,OAAOA;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"graphqlHandler.server.d.ts","sourceRoot":"","sources":["../../src/utilities/graphqlHandler.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA2B,eAAe,EAAE,MAAM,SAAS,CAAA;AAyFvE;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAU,sBAGjC;IACD,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAA;IAClD,OAAO,EAAE,OAAO,CAAA;CACjB,KAAG,OAAO,CAAC,QAAQ,CA2DnB,CAAA"}
1
+ {"version":3,"file":"graphqlHandler.server.d.ts","sourceRoot":"","sources":["../../src/utilities/graphqlHandler.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA2B,eAAe,EAAE,MAAM,SAAS,CAAA;AAyFvE;;;;;GAKG;AACH,eAAO,MAAM,aAAa,yBAGvB;IACD,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAA;IAClD,OAAO,EAAE,OAAO,CAAA;CACjB,KAAG,OAAO,CAAC,QAAQ,CA2DnB,CAAA"}
@@ -8,4 +8,4 @@ export declare function handleAPIRoute({ config, request, }: {
8
8
  config: SanitizedConfig;
9
9
  request: Request;
10
10
  }): Promise<Response>;
11
- //# sourceMappingURL=handleAPIRoute.d.ts.map
11
+ //# sourceMappingURL=handleAPIRoute.server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handleAPIRoute.server.d.ts","sourceRoot":"","sources":["../../src/utilities/handleAPIRoute.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=handleAPIRoute.server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utilities/handleAPIRoute.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"}
@@ -1,20 +1,2 @@
1
- import type { ServerFunctionHandler } from 'payload';
2
- /**
3
- * Server function dispatcher for TanStack Start.
4
- *
5
- * Mirrors `packages/next/src/utilities/handleServerFunctions.ts` and uses the
6
- * exact same set of handlers — both adapters share `sharedServerFunctions`
7
- * plus the small set of RSC-only handlers re-exported by `@payloadcms/ui`.
8
- *
9
- * Pipes the result through `serializeForRsc`, which converts any React
10
- * elements left in the response (e.g. `state[path].customComponents.Field`
11
- * produced by `buildFormState`, the `List` / `Document` nodes returned by
12
- * `render-list` / `render-document`) into RSC "renderable handles" via
13
- * `renderServerComponent` from `@tanstack/react-start/rsc`. TanStack Start's
14
- * `$RSC` serialization adapter then ships those handles to the client as
15
- * Flight payloads — so this dispatcher must be invoked from a context that
16
- * uses TanStack's wire format (e.g. `createServerFn`), not raw
17
- * `JSON.stringify`.
18
- */
19
- export declare const handleServerFunctions: ServerFunctionHandler;
1
+ export declare const handleServerFunctions: import("payload").ServerFunctionHandler;
20
2
  //# sourceMappingURL=handleServerFunctions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleServerFunctions.d.ts","sourceRoot":"","sources":["../../src/utilities/handleServerFunctions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA6C,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAwB/F;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,qBAAqB,EAAE,qBAkCnC,CAAA"}
1
+ {"version":3,"file":"handleServerFunctions.d.ts","sourceRoot":"","sources":["../../src/utilities/handleServerFunctions.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB,yCAGhC,CAAA"}
@@ -1,60 +1,12 @@
1
- import { renderTabHandler } from '@payloadcms/ui/elements/Nav/SidebarTabs/renderTabServerFn';
2
- import { _internal_renderFieldHandler } from '@payloadcms/ui/rsc';
3
- import { sharedServerFunctions } from '@payloadcms/ui/utilities/serverFunctionRegistry';
4
- import { getDefaultLayoutHandler } from '@payloadcms/ui/views/Dashboard/Default/ModularDashboard/renderWidget/getDefaultLayoutServerFn';
5
- import { renderWidgetHandler } from '@payloadcms/ui/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn';
6
- import { renderDocumentSlotsHandler } from '@payloadcms/ui/views/Document/renderDocumentSlots';
7
- import { RenderRSCComponent } from '../rsc/renderPayloadRSC.js';
1
+ import { createServerFunctionHandler } from '@payloadcms/ui/utilities/handleServerFunctions';
8
2
  import { initReq } from './initReq.server.js';
9
3
  import { serializeForRsc } from './serializeForRsc.js';
10
- import { switchLanguageHandler } from './serverFunctionHandlers.js';
11
- const baseServerFunctions = {
12
- ...sharedServerFunctions,
13
- 'get-default-layout': getDefaultLayoutHandler,
14
- 'render-document-slots': renderDocumentSlotsHandler,
15
- 'render-field': _internal_renderFieldHandler,
16
- 'render-tab': renderTabHandler,
17
- 'render-widget': renderWidgetHandler,
18
- 'switch-language': switchLanguageHandler
19
- };
20
- /**
21
- * Server function dispatcher for TanStack Start.
22
- *
23
- * Mirrors `packages/next/src/utilities/handleServerFunctions.ts` and uses the
24
- * exact same set of handlers — both adapters share `sharedServerFunctions`
25
- * plus the small set of RSC-only handlers re-exported by `@payloadcms/ui`.
26
- *
27
- * Pipes the result through `serializeForRsc`, which converts any React
28
- * elements left in the response (e.g. `state[path].customComponents.Field`
29
- * produced by `buildFormState`, the `List` / `Document` nodes returned by
30
- * `render-list` / `render-document`) into RSC "renderable handles" via
31
- * `renderServerComponent` from `@tanstack/react-start/rsc`. TanStack Start's
32
- * `$RSC` serialization adapter then ships those handles to the client as
33
- * Flight payloads — so this dispatcher must be invoked from a context that
34
- * uses TanStack's wire format (e.g. `createServerFn`), not raw
35
- * `JSON.stringify`.
36
- */ export const handleServerFunctions = async (args)=>{
37
- const { name: fnKey, args: fnArgs, config: configPromise, importMap, serverFunctions: extraServerFunctions } = args;
38
- const { cookies, locale, permissions, req } = await initReq({
39
- configPromise,
40
- importMap
41
- });
42
- const augmentedArgs = {
43
- ...fnArgs,
44
- cookies,
45
- importMap,
46
- locale,
47
- mode: 'rsc',
48
- permissions,
49
- renderComponent: RenderRSCComponent,
50
- req
51
- };
52
- const fn = extraServerFunctions?.[fnKey] || baseServerFunctions[fnKey];
53
- if (!fn) {
54
- throw new Error(`Unknown Server Function: ${fnKey}`);
55
- }
56
- const result = await fn(augmentedArgs);
57
- return await serializeForRsc(result);
58
- };
4
+ export const handleServerFunctions = createServerFunctionHandler({
5
+ initReq: ({ configPromise, importMap })=>initReq({
6
+ configPromise,
7
+ importMap
8
+ }),
9
+ transformResult: serializeForRsc
10
+ });
59
11
 
60
12
  //# sourceMappingURL=handleServerFunctions.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/handleServerFunctions.ts"],"sourcesContent":["import type { DefaultServerFunctionArgs, ServerFunction, ServerFunctionHandler } from 'payload'\n\nimport { renderTabHandler } from '@payloadcms/ui/elements/Nav/SidebarTabs/renderTabServerFn'\nimport { _internal_renderFieldHandler } from '@payloadcms/ui/rsc'\nimport { sharedServerFunctions } from '@payloadcms/ui/utilities/serverFunctionRegistry'\nimport { getDefaultLayoutHandler } from '@payloadcms/ui/views/Dashboard/Default/ModularDashboard/renderWidget/getDefaultLayoutServerFn'\nimport { renderWidgetHandler } from '@payloadcms/ui/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn'\nimport { renderDocumentSlotsHandler } from '@payloadcms/ui/views/Document/renderDocumentSlots'\n\nimport { RenderRSCComponent } from '../rsc/renderPayloadRSC.js'\nimport { initReq } from './initReq.server.js'\nimport { serializeForRsc } from './serializeForRsc.js'\nimport { switchLanguageHandler } from './serverFunctionHandlers.js'\n\nconst baseServerFunctions: Record<string, ServerFunction<any, any>> = {\n ...sharedServerFunctions,\n 'get-default-layout': getDefaultLayoutHandler,\n 'render-document-slots': renderDocumentSlotsHandler,\n 'render-field': _internal_renderFieldHandler,\n 'render-tab': renderTabHandler,\n 'render-widget': renderWidgetHandler,\n 'switch-language': switchLanguageHandler,\n}\n\n/**\n * Server function dispatcher for TanStack Start.\n *\n * Mirrors `packages/next/src/utilities/handleServerFunctions.ts` and uses the\n * exact same set of handlers — both adapters share `sharedServerFunctions`\n * plus the small set of RSC-only handlers re-exported by `@payloadcms/ui`.\n *\n * Pipes the result through `serializeForRsc`, which converts any React\n * elements left in the response (e.g. `state[path].customComponents.Field`\n * produced by `buildFormState`, the `List` / `Document` nodes returned by\n * `render-list` / `render-document`) into RSC \"renderable handles\" via\n * `renderServerComponent` from `@tanstack/react-start/rsc`. TanStack Start's\n * `$RSC` serialization adapter then ships those handles to the client as\n * Flight payloads — so this dispatcher must be invoked from a context that\n * uses TanStack's wire format (e.g. `createServerFn`), not raw\n * `JSON.stringify`.\n */\nexport const handleServerFunctions: ServerFunctionHandler = async (args) => {\n const {\n name: fnKey,\n args: fnArgs,\n config: configPromise,\n importMap,\n serverFunctions: extraServerFunctions,\n } = args\n\n const { cookies, locale, permissions, req } = await initReq({\n configPromise,\n importMap,\n })\n\n const augmentedArgs: DefaultServerFunctionArgs = {\n ...fnArgs,\n cookies,\n importMap,\n locale,\n mode: 'rsc',\n permissions,\n renderComponent: RenderRSCComponent,\n req,\n }\n\n const fn = extraServerFunctions?.[fnKey] || baseServerFunctions[fnKey]\n\n if (!fn) {\n throw new Error(`Unknown Server Function: ${fnKey}`)\n }\n\n const result = await fn(augmentedArgs)\n\n return await serializeForRsc(result)\n}\n"],"names":["renderTabHandler","_internal_renderFieldHandler","sharedServerFunctions","getDefaultLayoutHandler","renderWidgetHandler","renderDocumentSlotsHandler","RenderRSCComponent","initReq","serializeForRsc","switchLanguageHandler","baseServerFunctions","handleServerFunctions","args","name","fnKey","fnArgs","config","configPromise","importMap","serverFunctions","extraServerFunctions","cookies","locale","permissions","req","augmentedArgs","mode","renderComponent","fn","Error","result"],"mappings":"AAEA,SAASA,gBAAgB,QAAQ,4DAA2D;AAC5F,SAASC,4BAA4B,QAAQ,qBAAoB;AACjE,SAASC,qBAAqB,QAAQ,kDAAiD;AACvF,SAASC,uBAAuB,QAAQ,gGAA+F;AACvI,SAASC,mBAAmB,QAAQ,4FAA2F;AAC/H,SAASC,0BAA0B,QAAQ,oDAAmD;AAE9F,SAASC,kBAAkB,QAAQ,6BAA4B;AAC/D,SAASC,OAAO,QAAQ,sBAAqB;AAC7C,SAASC,eAAe,QAAQ,uBAAsB;AACtD,SAASC,qBAAqB,QAAQ,8BAA6B;AAEnE,MAAMC,sBAAgE;IACpE,GAAGR,qBAAqB;IACxB,sBAAsBC;IACtB,yBAAyBE;IACzB,gBAAgBJ;IAChB,cAAcD;IACd,iBAAiBI;IACjB,mBAAmBK;AACrB;AAEA;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,MAAME,wBAA+C,OAAOC;IACjE,MAAM,EACJC,MAAMC,KAAK,EACXF,MAAMG,MAAM,EACZC,QAAQC,aAAa,EACrBC,SAAS,EACTC,iBAAiBC,oBAAoB,EACtC,GAAGR;IAEJ,MAAM,EAAES,OAAO,EAAEC,MAAM,EAAEC,WAAW,EAAEC,GAAG,EAAE,GAAG,MAAMjB,QAAQ;QAC1DU;QACAC;IACF;IAEA,MAAMO,gBAA2C;QAC/C,GAAGV,MAAM;QACTM;QACAH;QACAI;QACAI,MAAM;QACNH;QACAI,iBAAiBrB;QACjBkB;IACF;IAEA,MAAMI,KAAKR,sBAAsB,CAACN,MAAM,IAAIJ,mBAAmB,CAACI,MAAM;IAEtE,IAAI,CAACc,IAAI;QACP,MAAM,IAAIC,MAAM,CAAC,yBAAyB,EAAEf,OAAO;IACrD;IAEA,MAAMgB,SAAS,MAAMF,GAAGH;IAExB,OAAO,MAAMjB,gBAAgBsB;AAC/B,EAAC"}
1
+ {"version":3,"sources":["../../src/utilities/handleServerFunctions.ts"],"sourcesContent":["import { createServerFunctionHandler } from '@payloadcms/ui/utilities/handleServerFunctions'\n\nimport { initReq } from './initReq.server.js'\nimport { serializeForRsc } from './serializeForRsc.js'\n\nexport const handleServerFunctions = createServerFunctionHandler({\n initReq: ({ configPromise, importMap }) => initReq({ configPromise, importMap }),\n transformResult: serializeForRsc,\n})\n"],"names":["createServerFunctionHandler","initReq","serializeForRsc","handleServerFunctions","configPromise","importMap","transformResult"],"mappings":"AAAA,SAASA,2BAA2B,QAAQ,iDAAgD;AAE5F,SAASC,OAAO,QAAQ,sBAAqB;AAC7C,SAASC,eAAe,QAAQ,uBAAsB;AAEtD,OAAO,MAAMC,wBAAwBH,4BAA4B;IAC/DC,SAAS,CAAC,EAAEG,aAAa,EAAEC,SAAS,EAAE,GAAKJ,QAAQ;YAAEG;YAAeC;QAAU;IAC9EC,iBAAiBJ;AACnB,GAAE"}
@@ -1,5 +1,6 @@
1
1
  import type { ImportMap, InitReqResult, SanitizedConfig, ServerAdapter } from 'payload';
2
2
  import { createLocalReq } from 'payload';
3
+ import './devConfigReload.server.js';
3
4
  /**
4
5
  * Initializes a Payload request object from the current TanStack Start server context.
5
6
  * Uses `getRequest()` from `@tanstack/react-start/server` to access the incoming request.
@@ -1 +1 @@
1
- {"version":3,"file":"initReq.server.d.ts","sourceRoot":"","sources":["../../src/utilities/initReq.server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAIvF,OAAO,EACL,cAAc,EAMf,MAAM,SAAS,CAAA;AAMhB;;;GAGG;AACH,wBAAsB,OAAO,CAAC,EAC5B,aAAa,EACb,SAAS,EACT,SAAS,EACT,aAAqC,GACtC,EAAE;IACD,aAAa,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAA;IACzD,SAAS,EAAE,SAAS,CAAA;IACpB,SAAS,CAAC,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAA;IAChD;;;;;OAKG;IACH,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B,GAAG,OAAO,CAAC,aAAa,CAAC,CAkFzB"}
1
+ {"version":3,"file":"initReq.server.d.ts","sourceRoot":"","sources":["../../src/utilities/initReq.server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAIvF,OAAO,EACL,cAAc,EAMf,MAAM,SAAS,CAAA;AAKhB,OAAO,6BAA6B,CAAA;AAIpC;;;GAGG;AACH,wBAAsB,OAAO,CAAC,EAC5B,aAAa,EACb,SAAS,EACT,SAAS,EACT,aAAqC,GACtC,EAAE;IACD,aAAa,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAA;IACzD,SAAS,EAAE,SAAS,CAAA;IACpB,SAAS,CAAC,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAA;IAChD;;;;;OAKG;IACH,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B,GAAG,OAAO,CAAC,aAAa,CAAC,CAkFzB"}
@@ -2,6 +2,9 @@ import { initI18n } from '@payloadcms/translations';
2
2
  import { getRequest } from '@tanstack/react-start/server';
3
3
  import { createLocalReq, executeAuthStrategies, getAccessResults, getPayload, getRequestLanguage, parseCookies } from 'payload';
4
4
  import * as qs from 'qs-esm';
5
+ // Registers the dev reload strategy before the `getPayload` call below can
6
+ // build an instance. Side-effect only, and a no-op outside of dev serve.
7
+ import './devConfigReload.server.js';
5
8
  import { getRequestLocale } from './getRequestLocale.js';
6
9
  import { tanstackServerAdapter } from './serverAdapter.server.js';
7
10
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/initReq.server.ts"],"sourcesContent":["import type { I18n, I18nClient } from '@payloadcms/translations'\nimport type { ImportMap, InitReqResult, SanitizedConfig, ServerAdapter } from 'payload'\n\nimport { initI18n } from '@payloadcms/translations'\nimport { getRequest } from '@tanstack/react-start/server'\nimport {\n createLocalReq,\n executeAuthStrategies,\n getAccessResults,\n getPayload,\n getRequestLanguage,\n parseCookies,\n} from 'payload'\nimport * as qs from 'qs-esm'\n\nimport { getRequestLocale } from './getRequestLocale.js'\nimport { tanstackServerAdapter } from './serverAdapter.server.js'\n\n/**\n * Initializes a Payload request object from the current TanStack Start server context.\n * Uses `getRequest()` from `@tanstack/react-start/server` to access the incoming request.\n */\nexport async function initReq({\n configPromise,\n importMap,\n overrides,\n serverAdapter = tanstackServerAdapter,\n}: {\n configPromise: Promise<SanitizedConfig> | SanitizedConfig\n importMap: ImportMap\n overrides?: Parameters<typeof createLocalReq>[0]\n /**\n * `ServerAdapter` attached to `req.server`. Defaults to the native\n * `tanstackServerAdapter` (throws TanStack `redirect`/`notFound`). The admin\n * page render passes an error-contract adapter so navigation thrown mid-render\n * is caught at the loader boundary and re-thrown as native TanStack nav.\n */\n serverAdapter?: ServerAdapter\n}): Promise<InitReqResult> {\n const webRequest = getRequest()\n const headers = new Headers(webRequest.headers)\n const cookies = parseCookies(headers)\n\n const config = await configPromise\n const payload = await getPayload({ config, importMap })\n\n const languageCode = getRequestLanguage({\n config,\n cookies,\n headers,\n })\n\n const i18n: I18nClient = await initI18n({\n config: config.i18n,\n context: 'client',\n language: languageCode,\n })\n\n const { responseHeaders, user } = await executeAuthStrategies({\n headers,\n payload,\n })\n\n const { req: reqOverrides, ...optionsOverrides } = overrides || {}\n\n // Parse the active URL's query string so that `req.query` (and thus\n // `getRequestLocale`, access checks, etc.) reflect things like `?locale=es`\n // even when the caller (e.g. the root layout loader) hasn't explicitly\n // forwarded `searchParams` via overrides. `createLocalReq` only defaults\n // `req.query` to `{}` and never reads the request URL itself.\n let queryFromUrl: Record<string, unknown> | undefined\n try {\n const urlObject = new URL(webRequest.url)\n if (urlObject.search) {\n queryFromUrl = qs.parse(urlObject.search, {\n depth: 10,\n ignoreQueryPrefix: true,\n }) as Record<string, unknown>\n }\n } catch {\n queryFromUrl = undefined\n }\n\n const req = await createLocalReq(\n {\n req: {\n headers,\n host: headers.get('host') ?? undefined,\n i18n: i18n as I18n,\n query: queryFromUrl,\n responseHeaders,\n // Expose the `ServerAdapter` so framework-agnostic server functions can\n // set cookies / redirect via `req.server` (mirrors the Next.js adapter,\n // which passes `nextServerAdapter`). Required by handlers like\n // `switch-language`. Defaults to the native adapter; the page render\n // overrides it with the error-contract adapter.\n server: serverAdapter,\n url: webRequest.url,\n user,\n ...(reqOverrides || {}),\n },\n ...(optionsOverrides || {}),\n },\n payload,\n )\n\n const locale = await getRequestLocale({ req })\n\n req.locale = locale?.code\n\n const permissions = await getAccessResults({ req })\n\n return {\n cookies,\n headers,\n languageCode,\n locale,\n permissions,\n req,\n }\n}\n"],"names":["initI18n","getRequest","createLocalReq","executeAuthStrategies","getAccessResults","getPayload","getRequestLanguage","parseCookies","qs","getRequestLocale","tanstackServerAdapter","initReq","configPromise","importMap","overrides","serverAdapter","webRequest","headers","Headers","cookies","config","payload","languageCode","i18n","context","language","responseHeaders","user","req","reqOverrides","optionsOverrides","queryFromUrl","urlObject","URL","url","search","parse","depth","ignoreQueryPrefix","undefined","host","get","query","server","locale","code","permissions"],"mappings":"AAGA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,UAAU,QAAQ,+BAA8B;AACzD,SACEC,cAAc,EACdC,qBAAqB,EACrBC,gBAAgB,EAChBC,UAAU,EACVC,kBAAkB,EAClBC,YAAY,QACP,UAAS;AAChB,YAAYC,QAAQ,SAAQ;AAE5B,SAASC,gBAAgB,QAAQ,wBAAuB;AACxD,SAASC,qBAAqB,QAAQ,4BAA2B;AAEjE;;;CAGC,GACD,OAAO,eAAeC,QAAQ,EAC5BC,aAAa,EACbC,SAAS,EACTC,SAAS,EACTC,gBAAgBL,qBAAqB,EAYtC;IACC,MAAMM,aAAaf;IACnB,MAAMgB,UAAU,IAAIC,QAAQF,WAAWC,OAAO;IAC9C,MAAME,UAAUZ,aAAaU;IAE7B,MAAMG,SAAS,MAAMR;IACrB,MAAMS,UAAU,MAAMhB,WAAW;QAAEe;QAAQP;IAAU;IAErD,MAAMS,eAAehB,mBAAmB;QACtCc;QACAD;QACAF;IACF;IAEA,MAAMM,OAAmB,MAAMvB,SAAS;QACtCoB,QAAQA,OAAOG,IAAI;QACnBC,SAAS;QACTC,UAAUH;IACZ;IAEA,MAAM,EAAEI,eAAe,EAAEC,IAAI,EAAE,GAAG,MAAMxB,sBAAsB;QAC5Dc;QACAI;IACF;IAEA,MAAM,EAAEO,KAAKC,YAAY,EAAE,GAAGC,kBAAkB,GAAGhB,aAAa,CAAC;IAEjE,oEAAoE;IACpE,4EAA4E;IAC5E,uEAAuE;IACvE,yEAAyE;IACzE,8DAA8D;IAC9D,IAAIiB;IACJ,IAAI;QACF,MAAMC,YAAY,IAAIC,IAAIjB,WAAWkB,GAAG;QACxC,IAAIF,UAAUG,MAAM,EAAE;YACpBJ,eAAevB,GAAG4B,KAAK,CAACJ,UAAUG,MAAM,EAAE;gBACxCE,OAAO;gBACPC,mBAAmB;YACrB;QACF;IACF,EAAE,OAAM;QACNP,eAAeQ;IACjB;IAEA,MAAMX,MAAM,MAAM1B,eAChB;QACE0B,KAAK;YACHX;YACAuB,MAAMvB,QAAQwB,GAAG,CAAC,WAAWF;YAC7BhB,MAAMA;YACNmB,OAAOX;YACPL;YACA,wEAAwE;YACxE,wEAAwE;YACxE,+DAA+D;YAC/D,qEAAqE;YACrE,gDAAgD;YAChDiB,QAAQ5B;YACRmB,KAAKlB,WAAWkB,GAAG;YACnBP;YACA,GAAIE,gBAAgB,CAAC,CAAC;QACxB;QACA,GAAIC,oBAAoB,CAAC,CAAC;IAC5B,GACAT;IAGF,MAAMuB,SAAS,MAAMnC,iBAAiB;QAAEmB;IAAI;IAE5CA,IAAIgB,MAAM,GAAGA,QAAQC;IAErB,MAAMC,cAAc,MAAM1C,iBAAiB;QAAEwB;IAAI;IAEjD,OAAO;QACLT;QACAF;QACAK;QACAsB;QACAE;QACAlB;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/utilities/initReq.server.ts"],"sourcesContent":["import type { I18n, I18nClient } from '@payloadcms/translations'\nimport type { ImportMap, InitReqResult, SanitizedConfig, ServerAdapter } from 'payload'\n\nimport { initI18n } from '@payloadcms/translations'\nimport { getRequest } from '@tanstack/react-start/server'\nimport {\n createLocalReq,\n executeAuthStrategies,\n getAccessResults,\n getPayload,\n getRequestLanguage,\n parseCookies,\n} from 'payload'\nimport * as qs from 'qs-esm'\n\n// Registers the dev reload strategy before the `getPayload` call below can\n// build an instance. Side-effect only, and a no-op outside of dev serve.\nimport './devConfigReload.server.js'\nimport { getRequestLocale } from './getRequestLocale.js'\nimport { tanstackServerAdapter } from './serverAdapter.server.js'\n\n/**\n * Initializes a Payload request object from the current TanStack Start server context.\n * Uses `getRequest()` from `@tanstack/react-start/server` to access the incoming request.\n */\nexport async function initReq({\n configPromise,\n importMap,\n overrides,\n serverAdapter = tanstackServerAdapter,\n}: {\n configPromise: Promise<SanitizedConfig> | SanitizedConfig\n importMap: ImportMap\n overrides?: Parameters<typeof createLocalReq>[0]\n /**\n * `ServerAdapter` attached to `req.server`. Defaults to the native\n * `tanstackServerAdapter` (throws TanStack `redirect`/`notFound`). The admin\n * page render passes an error-contract adapter so navigation thrown mid-render\n * is caught at the loader boundary and re-thrown as native TanStack nav.\n */\n serverAdapter?: ServerAdapter\n}): Promise<InitReqResult> {\n const webRequest = getRequest()\n const headers = new Headers(webRequest.headers)\n const cookies = parseCookies(headers)\n\n const config = await configPromise\n const payload = await getPayload({ config, importMap })\n\n const languageCode = getRequestLanguage({\n config,\n cookies,\n headers,\n })\n\n const i18n: I18nClient = await initI18n({\n config: config.i18n,\n context: 'client',\n language: languageCode,\n })\n\n const { responseHeaders, user } = await executeAuthStrategies({\n headers,\n payload,\n })\n\n const { req: reqOverrides, ...optionsOverrides } = overrides || {}\n\n // Parse the active URL's query string so that `req.query` (and thus\n // `getRequestLocale`, access checks, etc.) reflect things like `?locale=es`\n // even when the caller (e.g. the root layout loader) hasn't explicitly\n // forwarded `searchParams` via overrides. `createLocalReq` only defaults\n // `req.query` to `{}` and never reads the request URL itself.\n let queryFromUrl: Record<string, unknown> | undefined\n try {\n const urlObject = new URL(webRequest.url)\n if (urlObject.search) {\n queryFromUrl = qs.parse(urlObject.search, {\n depth: 10,\n ignoreQueryPrefix: true,\n }) as Record<string, unknown>\n }\n } catch {\n queryFromUrl = undefined\n }\n\n const req = await createLocalReq(\n {\n req: {\n headers,\n host: headers.get('host') ?? undefined,\n i18n: i18n as I18n,\n query: queryFromUrl,\n responseHeaders,\n // Expose the `ServerAdapter` so framework-agnostic server functions can\n // set cookies / redirect via `req.server` (mirrors the Next.js adapter,\n // which passes `nextServerAdapter`). Required by handlers like\n // `switch-language`. Defaults to the native adapter; the page render\n // overrides it with the error-contract adapter.\n server: serverAdapter,\n url: webRequest.url,\n user,\n ...(reqOverrides || {}),\n },\n ...(optionsOverrides || {}),\n },\n payload,\n )\n\n const locale = await getRequestLocale({ req })\n\n req.locale = locale?.code\n\n const permissions = await getAccessResults({ req })\n\n return {\n cookies,\n headers,\n languageCode,\n locale,\n permissions,\n req,\n }\n}\n"],"names":["initI18n","getRequest","createLocalReq","executeAuthStrategies","getAccessResults","getPayload","getRequestLanguage","parseCookies","qs","getRequestLocale","tanstackServerAdapter","initReq","configPromise","importMap","overrides","serverAdapter","webRequest","headers","Headers","cookies","config","payload","languageCode","i18n","context","language","responseHeaders","user","req","reqOverrides","optionsOverrides","queryFromUrl","urlObject","URL","url","search","parse","depth","ignoreQueryPrefix","undefined","host","get","query","server","locale","code","permissions"],"mappings":"AAGA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,UAAU,QAAQ,+BAA8B;AACzD,SACEC,cAAc,EACdC,qBAAqB,EACrBC,gBAAgB,EAChBC,UAAU,EACVC,kBAAkB,EAClBC,YAAY,QACP,UAAS;AAChB,YAAYC,QAAQ,SAAQ;AAE5B,2EAA2E;AAC3E,yEAAyE;AACzE,OAAO,8BAA6B;AACpC,SAASC,gBAAgB,QAAQ,wBAAuB;AACxD,SAASC,qBAAqB,QAAQ,4BAA2B;AAEjE;;;CAGC,GACD,OAAO,eAAeC,QAAQ,EAC5BC,aAAa,EACbC,SAAS,EACTC,SAAS,EACTC,gBAAgBL,qBAAqB,EAYtC;IACC,MAAMM,aAAaf;IACnB,MAAMgB,UAAU,IAAIC,QAAQF,WAAWC,OAAO;IAC9C,MAAME,UAAUZ,aAAaU;IAE7B,MAAMG,SAAS,MAAMR;IACrB,MAAMS,UAAU,MAAMhB,WAAW;QAAEe;QAAQP;IAAU;IAErD,MAAMS,eAAehB,mBAAmB;QACtCc;QACAD;QACAF;IACF;IAEA,MAAMM,OAAmB,MAAMvB,SAAS;QACtCoB,QAAQA,OAAOG,IAAI;QACnBC,SAAS;QACTC,UAAUH;IACZ;IAEA,MAAM,EAAEI,eAAe,EAAEC,IAAI,EAAE,GAAG,MAAMxB,sBAAsB;QAC5Dc;QACAI;IACF;IAEA,MAAM,EAAEO,KAAKC,YAAY,EAAE,GAAGC,kBAAkB,GAAGhB,aAAa,CAAC;IAEjE,oEAAoE;IACpE,4EAA4E;IAC5E,uEAAuE;IACvE,yEAAyE;IACzE,8DAA8D;IAC9D,IAAIiB;IACJ,IAAI;QACF,MAAMC,YAAY,IAAIC,IAAIjB,WAAWkB,GAAG;QACxC,IAAIF,UAAUG,MAAM,EAAE;YACpBJ,eAAevB,GAAG4B,KAAK,CAACJ,UAAUG,MAAM,EAAE;gBACxCE,OAAO;gBACPC,mBAAmB;YACrB;QACF;IACF,EAAE,OAAM;QACNP,eAAeQ;IACjB;IAEA,MAAMX,MAAM,MAAM1B,eAChB;QACE0B,KAAK;YACHX;YACAuB,MAAMvB,QAAQwB,GAAG,CAAC,WAAWF;YAC7BhB,MAAMA;YACNmB,OAAOX;YACPL;YACA,wEAAwE;YACxE,wEAAwE;YACxE,+DAA+D;YAC/D,qEAAqE;YACrE,gDAAgD;YAChDiB,QAAQ5B;YACRmB,KAAKlB,WAAWkB,GAAG;YACnBP;YACA,GAAIE,gBAAgB,CAAC,CAAC;QACxB;QACA,GAAIC,oBAAoB,CAAC,CAAC;IAC5B,GACAT;IAGF,MAAMuB,SAAS,MAAMnC,iBAAiB;QAAEmB;IAAI;IAE5CA,IAAIgB,MAAM,GAAGA,QAAQC;IAErB,MAAMC,cAAc,MAAM1C,iBAAiB;QAAEwB;IAAI;IAEjD,OAAO;QACLT;QACAF;QACAK;QACAsB;QACAE;QACAlB;IACF;AACF"}
@@ -1,3 +1,4 @@
1
+ import type { RenderableServerComponent } from '@tanstack/react-start/rsc';
1
2
  import type { ImportMap, SanitizedConfig } from 'payload';
2
3
  import type { AdminPageMetadata } from './meta.js';
3
4
  export type LoadAdminPageArgs = {
@@ -6,10 +7,11 @@ export type LoadAdminPageArgs = {
6
7
  search?: Record<string, string | string[]>;
7
8
  splat?: string;
8
9
  };
10
+ type RSCPayload = RenderableServerComponent<React.ReactElement>;
9
11
  export type LoadAdminPageResult = {
10
12
  _notFound: true;
11
13
  routeKey?: string;
12
- rscPayload?: React.ReactNode;
14
+ rscPayload?: RSCPayload;
13
15
  } | {
14
16
  _redirect: string;
15
17
  } | {
@@ -26,7 +28,7 @@ export type LoadAdminPageResult = {
26
28
  * so search-only changes (e.g. list-view filtering) reconcile in place.
27
29
  */
28
30
  routeKey: string;
29
- rscPayload: React.ReactNode;
31
+ rscPayload: RSCPayload;
30
32
  };
31
33
  /**
32
34
  * Renders an admin page for TanStack Start and returns a serializable loader
@@ -51,4 +53,5 @@ export type LoadAdminPageResult = {
51
53
  * so it's read from the `nav` holder after `renderServerComponent` resolves.
52
54
  */
53
55
  export declare function loadAdminPage({ config, importMap, search, splat, }: LoadAdminPageArgs): Promise<LoadAdminPageResult>;
56
+ export {};
54
57
  //# sourceMappingURL=loadAdminPage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loadAdminPage.d.ts","sourceRoot":"","sources":["../../src/utilities/loadAdminPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAc,eAAe,EAAE,MAAM,SAAS,CAAA;AAIrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAMlD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,eAAe,CAAA;IACvB,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAA;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,mBAAmB,GAC3B;IAAE,SAAS,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,GACpE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GACrB;IACE,QAAQ,EAAE,iBAAiB,CAAA;IAC3B;;;;;;;;;;OAUG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAA;CAC5B,CAAA;AA0FL;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,aAAa,CAAC,EAClC,MAAM,EACN,SAAS,EACT,MAAM,EACN,KAAK,GACN,EAAE,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAoJlD"}
1
+ {"version":3,"file":"loadAdminPage.d.ts","sourceRoot":"","sources":["../../src/utilities/loadAdminPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAA;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAc,eAAe,EAAE,MAAM,SAAS,CAAA;AAKrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAMlD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,eAAe,CAAA;IACvB,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAA;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,KAAK,UAAU,GAAG,yBAAyB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;AAE/D,MAAM,MAAM,mBAAmB,GAC3B;IAAE,SAAS,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,UAAU,CAAA;CAAE,GAC/D;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GACrB;IACE,QAAQ,EAAE,iBAAiB,CAAA;IAC3B;;;;;;;;;;OAUG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;AA0FL;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,aAAa,CAAC,EAClC,MAAM,EACN,SAAS,EACT,MAAM,EACN,KAAK,GACN,EAAE,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAkJlD"}