@payloadcms/next 3.0.0-canary.294ea5c → 3.0.0-canary.2d0dd26

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 (615) hide show
  1. package/dist/cjs/withPayload.cjs +166 -0
  2. package/dist/cjs/withPayload.cjs.map +1 -0
  3. package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.d.ts.map +1 -1
  4. package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js +1 -0
  5. package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js.map +1 -1
  6. package/dist/elements/DocumentHeader/Tabs/Tab/index.d.ts +1 -1
  7. package/dist/elements/DocumentHeader/Tabs/Tab/index.d.ts.map +1 -1
  8. package/dist/elements/DocumentHeader/Tabs/Tab/index.js +16 -18
  9. package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
  10. package/dist/elements/DocumentHeader/Tabs/Tab/index.scss +70 -68
  11. package/dist/elements/DocumentHeader/Tabs/index.d.ts +2 -2
  12. package/dist/elements/DocumentHeader/Tabs/index.d.ts.map +1 -1
  13. package/dist/elements/DocumentHeader/Tabs/index.js +18 -17
  14. package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
  15. package/dist/elements/DocumentHeader/Tabs/index.scss +41 -39
  16. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.d.ts.map +1 -1
  17. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js +16 -27
  18. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js.map +1 -1
  19. package/dist/elements/DocumentHeader/Tabs/tabs/index.d.ts +1 -1
  20. package/dist/elements/DocumentHeader/Tabs/tabs/index.d.ts.map +1 -1
  21. package/dist/elements/DocumentHeader/Tabs/tabs/index.js +3 -3
  22. package/dist/elements/DocumentHeader/Tabs/tabs/index.js.map +1 -1
  23. package/dist/elements/DocumentHeader/index.d.ts +2 -3
  24. package/dist/elements/DocumentHeader/index.d.ts.map +1 -1
  25. package/dist/elements/DocumentHeader/index.js +9 -12
  26. package/dist/elements/DocumentHeader/index.js.map +1 -1
  27. package/dist/elements/DocumentHeader/index.scss +44 -42
  28. package/dist/elements/FormHeader/index.d.ts +9 -0
  29. package/dist/elements/FormHeader/index.d.ts.map +1 -0
  30. package/dist/elements/FormHeader/index.js +20 -0
  31. package/dist/elements/FormHeader/index.js.map +1 -0
  32. package/dist/elements/FormHeader/index.scss +8 -0
  33. package/dist/elements/Logo/index.d.ts.map +1 -1
  34. package/dist/elements/Logo/index.js +5 -6
  35. package/dist/elements/Logo/index.js.map +1 -1
  36. package/dist/elements/Nav/NavWrapper/index.scss +21 -14
  37. package/dist/elements/Nav/getNavPrefs.d.ts +6 -0
  38. package/dist/elements/Nav/getNavPrefs.d.ts.map +1 -0
  39. package/dist/elements/Nav/getNavPrefs.js +26 -0
  40. package/dist/elements/Nav/getNavPrefs.js.map +1 -0
  41. package/dist/elements/Nav/index.client.d.ts +6 -1
  42. package/dist/elements/Nav/index.client.d.ts.map +1 -1
  43. package/dist/elements/Nav/index.client.js +45 -95
  44. package/dist/elements/Nav/index.client.js.map +1 -1
  45. package/dist/elements/Nav/index.d.ts.map +1 -1
  46. package/dist/elements/Nav/index.js +66 -23
  47. package/dist/elements/Nav/index.js.map +1 -1
  48. package/dist/elements/Nav/index.scss +127 -121
  49. package/dist/exports/layouts.d.ts +2 -1
  50. package/dist/exports/layouts.d.ts.map +1 -1
  51. package/dist/exports/layouts.js +2 -1
  52. package/dist/exports/layouts.js.map +1 -1
  53. package/dist/exports/routes.d.ts +1 -1
  54. package/dist/exports/routes.d.ts.map +1 -1
  55. package/dist/exports/routes.js +1 -1
  56. package/dist/exports/routes.js.map +1 -1
  57. package/dist/exports/utilities.d.ts +2 -1
  58. package/dist/exports/utilities.d.ts.map +1 -1
  59. package/dist/exports/utilities.js +3 -1
  60. package/dist/exports/utilities.js.map +1 -1
  61. package/dist/exports/views.d.ts +1 -3
  62. package/dist/exports/views.d.ts.map +1 -1
  63. package/dist/exports/views.js +1 -3
  64. package/dist/exports/views.js.map +1 -1
  65. package/dist/fetchAPI-multipart/fileFactory.d.ts +2 -1
  66. package/dist/fetchAPI-multipart/fileFactory.d.ts.map +1 -1
  67. package/dist/fetchAPI-multipart/fileFactory.js.map +1 -1
  68. package/dist/fetchAPI-multipart/handlers.d.ts +1 -1
  69. package/dist/fetchAPI-multipart/handlers.d.ts.map +1 -1
  70. package/dist/fetchAPI-multipart/handlers.js +3 -1
  71. package/dist/fetchAPI-multipart/handlers.js.map +1 -1
  72. package/dist/fetchAPI-multipart/index.d.ts +1 -101
  73. package/dist/fetchAPI-multipart/index.d.ts.map +1 -1
  74. package/dist/fetchAPI-multipart/index.js +1 -1
  75. package/dist/fetchAPI-multipart/index.js.map +1 -1
  76. package/dist/fetchAPI-multipart/isEligibleRequest.js +1 -1
  77. package/dist/fetchAPI-multipart/isEligibleRequest.js.map +1 -1
  78. package/dist/fetchAPI-multipart/processMultipart.d.ts +2 -1
  79. package/dist/fetchAPI-multipart/processMultipart.d.ts.map +1 -1
  80. package/dist/fetchAPI-multipart/processMultipart.js +9 -10
  81. package/dist/fetchAPI-multipart/processMultipart.js.map +1 -1
  82. package/dist/fetchAPI-multipart/processNested.d.ts.map +1 -1
  83. package/dist/fetchAPI-multipart/processNested.js +8 -4
  84. package/dist/fetchAPI-multipart/processNested.js.map +1 -1
  85. package/dist/fetchAPI-multipart/uploadTimer.d.ts.map +1 -1
  86. package/dist/fetchAPI-multipart/uploadTimer.js +3 -1
  87. package/dist/fetchAPI-multipart/uploadTimer.js.map +1 -1
  88. package/dist/fetchAPI-multipart/utilities.d.ts +1 -1
  89. package/dist/fetchAPI-multipart/utilities.d.ts.map +1 -1
  90. package/dist/fetchAPI-multipart/utilities.js +32 -12
  91. package/dist/fetchAPI-multipart/utilities.js.map +1 -1
  92. package/dist/layouts/Root/NestProviders.d.ts +11 -0
  93. package/dist/layouts/Root/NestProviders.d.ts.map +1 -0
  94. package/dist/layouts/Root/NestProviders.js +21 -0
  95. package/dist/layouts/Root/NestProviders.js.map +1 -0
  96. package/dist/layouts/Root/checkDependencies.d.ts +2 -0
  97. package/dist/layouts/Root/checkDependencies.d.ts.map +1 -0
  98. package/dist/layouts/Root/checkDependencies.js +49 -0
  99. package/dist/layouts/Root/checkDependencies.js.map +1 -0
  100. package/dist/layouts/Root/index.d.ts +4 -3
  101. package/dist/layouts/Root/index.d.ts.map +1 -1
  102. package/dist/layouts/Root/index.js +42 -71
  103. package/dist/layouts/Root/index.js.map +1 -1
  104. package/dist/prod/styles.css +1 -1
  105. package/dist/routes/graphql/handler.d.ts.map +1 -1
  106. package/dist/routes/graphql/handler.js +23 -11
  107. package/dist/routes/graphql/handler.js.map +1 -1
  108. package/dist/routes/rest/auth/login.js +2 -2
  109. package/dist/routes/rest/auth/login.js.map +1 -1
  110. package/dist/routes/rest/auth/logout.d.ts.map +1 -1
  111. package/dist/routes/rest/auth/logout.js +3 -2
  112. package/dist/routes/rest/auth/logout.js.map +1 -1
  113. package/dist/routes/rest/auth/refresh.js +2 -2
  114. package/dist/routes/rest/auth/refresh.js.map +1 -1
  115. package/dist/routes/rest/auth/registerFirstUser.js +2 -2
  116. package/dist/routes/rest/auth/registerFirstUser.js.map +1 -1
  117. package/dist/routes/rest/auth/resetPassword.js +2 -2
  118. package/dist/routes/rest/auth/resetPassword.js.map +1 -1
  119. package/dist/routes/rest/collections/create.d.ts.map +1 -1
  120. package/dist/routes/rest/collections/create.js +5 -1
  121. package/dist/routes/rest/collections/create.js.map +1 -1
  122. package/dist/routes/rest/collections/delete.d.ts.map +1 -1
  123. package/dist/routes/rest/collections/delete.js +8 -0
  124. package/dist/routes/rest/collections/delete.js.map +1 -1
  125. package/dist/routes/rest/collections/deleteByID.d.ts.map +1 -1
  126. package/dist/routes/rest/collections/deleteByID.js +7 -1
  127. package/dist/routes/rest/collections/deleteByID.js.map +1 -1
  128. package/dist/routes/rest/collections/duplicate.d.ts.map +1 -1
  129. package/dist/routes/rest/collections/duplicate.js +5 -1
  130. package/dist/routes/rest/collections/duplicate.js.map +1 -1
  131. package/dist/routes/rest/collections/find.d.ts.map +1 -1
  132. package/dist/routes/rest/collections/find.js +10 -1
  133. package/dist/routes/rest/collections/find.js.map +1 -1
  134. package/dist/routes/rest/collections/findByID.d.ts.map +1 -1
  135. package/dist/routes/rest/collections/findByID.js +7 -1
  136. package/dist/routes/rest/collections/findByID.js.map +1 -1
  137. package/dist/routes/rest/collections/findVersionByID.d.ts.map +1 -1
  138. package/dist/routes/rest/collections/findVersionByID.js +5 -1
  139. package/dist/routes/rest/collections/findVersionByID.js.map +1 -1
  140. package/dist/routes/rest/collections/findVersions.d.ts.map +1 -1
  141. package/dist/routes/rest/collections/findVersions.js +7 -1
  142. package/dist/routes/rest/collections/findVersions.js.map +1 -1
  143. package/dist/routes/rest/collections/restoreVersion.d.ts.map +1 -1
  144. package/dist/routes/rest/collections/restoreVersion.js +2 -0
  145. package/dist/routes/rest/collections/restoreVersion.js.map +1 -1
  146. package/dist/routes/rest/collections/update.d.ts.map +1 -1
  147. package/dist/routes/rest/collections/update.js +10 -0
  148. package/dist/routes/rest/collections/update.js.map +1 -1
  149. package/dist/routes/rest/collections/updateByID.d.ts.map +1 -1
  150. package/dist/routes/rest/collections/updateByID.js +15 -3
  151. package/dist/routes/rest/collections/updateByID.js.map +1 -1
  152. package/dist/routes/rest/files/checkFileAccess.d.ts.map +1 -1
  153. package/dist/routes/rest/files/checkFileAccess.js +7 -2
  154. package/dist/routes/rest/files/checkFileAccess.js.map +1 -1
  155. package/dist/routes/rest/files/getFile.d.ts.map +1 -1
  156. package/dist/routes/rest/files/getFile.js +6 -2
  157. package/dist/routes/rest/files/getFile.js.map +1 -1
  158. package/dist/routes/rest/globals/findOne.d.ts.map +1 -1
  159. package/dist/routes/rest/globals/findOne.js +5 -1
  160. package/dist/routes/rest/globals/findOne.js.map +1 -1
  161. package/dist/routes/rest/globals/findVersionByID.d.ts.map +1 -1
  162. package/dist/routes/rest/globals/findVersionByID.js +5 -1
  163. package/dist/routes/rest/globals/findVersionByID.js.map +1 -1
  164. package/dist/routes/rest/globals/findVersions.d.ts.map +1 -1
  165. package/dist/routes/rest/globals/findVersions.js +7 -1
  166. package/dist/routes/rest/globals/findVersions.js.map +1 -1
  167. package/dist/routes/rest/globals/restoreVersion.d.ts.map +1 -1
  168. package/dist/routes/rest/globals/restoreVersion.js +2 -0
  169. package/dist/routes/rest/globals/restoreVersion.js.map +1 -1
  170. package/dist/routes/rest/globals/update.d.ts.map +1 -1
  171. package/dist/routes/rest/globals/update.js +13 -3
  172. package/dist/routes/rest/globals/update.js.map +1 -1
  173. package/dist/routes/rest/index.d.ts +17 -12
  174. package/dist/routes/rest/index.d.ts.map +1 -1
  175. package/dist/routes/rest/index.js +132 -39
  176. package/dist/routes/rest/index.js.map +1 -1
  177. package/dist/routes/rest/og/image.d.ts +4 -2
  178. package/dist/routes/rest/og/image.d.ts.map +1 -1
  179. package/dist/routes/rest/og/image.js +14 -10
  180. package/dist/routes/rest/og/image.js.map +1 -1
  181. package/dist/routes/rest/og/index.d.ts.map +1 -1
  182. package/dist/routes/rest/og/index.js +7 -12
  183. package/dist/routes/rest/og/index.js.map +1 -1
  184. package/dist/routes/rest/routeError.d.ts +2 -7
  185. package/dist/routes/rest/routeError.d.ts.map +1 -1
  186. package/dist/routes/rest/routeError.js +43 -69
  187. package/dist/routes/rest/routeError.js.map +1 -1
  188. package/dist/routes/rest/utilities/sanitizeCollectionID.d.ts.map +1 -1
  189. package/dist/routes/rest/utilities/sanitizeCollectionID.js +6 -2
  190. package/dist/routes/rest/utilities/sanitizeCollectionID.js.map +1 -1
  191. package/dist/routes/rest/utilities/sanitizeJoinParams.d.ts +13 -0
  192. package/dist/routes/rest/utilities/sanitizeJoinParams.d.ts.map +1 -0
  193. package/dist/routes/rest/utilities/sanitizeJoinParams.js +21 -0
  194. package/dist/routes/rest/utilities/sanitizeJoinParams.js.map +1 -0
  195. package/dist/routes/rest/utilities/sanitizePopulate.d.ts +3 -0
  196. package/dist/routes/rest/utilities/sanitizePopulate.d.ts.map +1 -0
  197. package/dist/routes/rest/utilities/sanitizePopulate.js +11 -0
  198. package/dist/routes/rest/utilities/sanitizePopulate.js.map +1 -0
  199. package/dist/routes/rest/utilities/sanitizeSelect.d.ts +6 -0
  200. package/dist/routes/rest/utilities/sanitizeSelect.d.ts.map +1 -0
  201. package/dist/routes/rest/utilities/sanitizeSelect.js +17 -0
  202. package/dist/routes/rest/utilities/sanitizeSelect.js.map +1 -0
  203. package/dist/scss/app.scss +166 -162
  204. package/dist/scss/colors.scss +256 -254
  205. package/dist/scss/resets.scss +9 -7
  206. package/dist/scss/toastify.scss +42 -40
  207. package/dist/scss/toasts.scss +105 -103
  208. package/dist/scss/type.scss +80 -79
  209. package/dist/templates/Default/Wrapper/index.scss +37 -36
  210. package/dist/templates/Default/index.d.ts +2 -1
  211. package/dist/templates/Default/index.d.ts.map +1 -1
  212. package/dist/templates/Default/index.js +101 -31
  213. package/dist/templates/Default/index.js.map +1 -1
  214. package/dist/templates/Default/index.scss +62 -50
  215. package/dist/templates/Minimal/index.scss +22 -20
  216. package/dist/utilities/addDataAndFileToRequest.d.ts.map +1 -1
  217. package/dist/utilities/addDataAndFileToRequest.js.map +1 -1
  218. package/dist/utilities/addLocalesToRequest.d.ts.map +1 -1
  219. package/dist/utilities/addLocalesToRequest.js +24 -10
  220. package/dist/utilities/addLocalesToRequest.js.map +1 -1
  221. package/dist/utilities/createPayloadRequest.d.ts.map +1 -1
  222. package/dist/utilities/createPayloadRequest.js +21 -13
  223. package/dist/utilities/createPayloadRequest.js.map +1 -1
  224. package/dist/utilities/getClientConfig.d.ts +8 -0
  225. package/dist/utilities/getClientConfig.d.ts.map +1 -0
  226. package/dist/utilities/getClientConfig.js +16 -0
  227. package/dist/utilities/getClientConfig.js.map +1 -0
  228. package/dist/utilities/getNextRequestI18n.d.ts.map +1 -1
  229. package/dist/utilities/getNextRequestI18n.js +2 -2
  230. package/dist/utilities/getNextRequestI18n.js.map +1 -1
  231. package/dist/utilities/getPayloadHMR.d.ts +1 -2
  232. package/dist/utilities/getPayloadHMR.d.ts.map +1 -1
  233. package/dist/utilities/getPayloadHMR.js +4 -102
  234. package/dist/utilities/getPayloadHMR.js.map +1 -1
  235. package/dist/utilities/getRequestLocales.d.ts.map +1 -1
  236. package/dist/utilities/getRequestLocales.js +10 -6
  237. package/dist/utilities/getRequestLocales.js.map +1 -1
  238. package/dist/utilities/getRequestTheme.d.ts.map +1 -1
  239. package/dist/utilities/getRequestTheme.js +3 -0
  240. package/dist/utilities/getRequestTheme.js.map +1 -1
  241. package/dist/utilities/handleServerFunctions.d.ts +3 -0
  242. package/dist/utilities/handleServerFunctions.d.ts.map +1 -0
  243. package/dist/utilities/handleServerFunctions.js +35 -0
  244. package/dist/utilities/handleServerFunctions.js.map +1 -0
  245. package/dist/utilities/headersWithCors.d.ts.map +1 -1
  246. package/dist/utilities/headersWithCors.js.map +1 -1
  247. package/dist/utilities/initPage/handleAdminPage.d.ts +13 -11
  248. package/dist/utilities/initPage/handleAdminPage.d.ts.map +1 -1
  249. package/dist/utilities/initPage/handleAdminPage.js +16 -20
  250. package/dist/utilities/initPage/handleAdminPage.js.map +1 -1
  251. package/dist/utilities/initPage/handleAuthRedirect.d.ts +6 -3
  252. package/dist/utilities/initPage/handleAuthRedirect.d.ts.map +1 -1
  253. package/dist/utilities/initPage/handleAuthRedirect.js +23 -34
  254. package/dist/utilities/initPage/handleAuthRedirect.js.map +1 -1
  255. package/dist/utilities/initPage/index.d.ts +1 -1
  256. package/dist/utilities/initPage/index.d.ts.map +1 -1
  257. package/dist/utilities/initPage/index.js +57 -48
  258. package/dist/utilities/initPage/index.js.map +1 -1
  259. package/dist/utilities/initPage/isCustomAdminView.d.ts +10 -0
  260. package/dist/utilities/initPage/isCustomAdminView.d.ts.map +1 -0
  261. package/dist/utilities/initPage/isCustomAdminView.js +31 -0
  262. package/dist/utilities/initPage/isCustomAdminView.js.map +1 -0
  263. package/dist/utilities/initPage/shared.d.ts +2 -2
  264. package/dist/utilities/initPage/shared.d.ts.map +1 -1
  265. package/dist/utilities/initPage/shared.js +19 -13
  266. package/dist/utilities/initPage/shared.js.map +1 -1
  267. package/dist/utilities/initReq.d.ts +11 -0
  268. package/dist/utilities/initReq.d.ts.map +1 -0
  269. package/dist/utilities/initReq.js +45 -0
  270. package/dist/utilities/initReq.js.map +1 -0
  271. package/dist/utilities/timestamp.d.ts.map +1 -1
  272. package/dist/utilities/timestamp.js +3 -1
  273. package/dist/utilities/timestamp.js.map +1 -1
  274. package/dist/views/API/LocaleSelector/index.js +2 -2
  275. package/dist/views/API/LocaleSelector/index.js.map +1 -1
  276. package/dist/views/API/RenderJSON/index.d.ts +1 -1
  277. package/dist/views/API/RenderJSON/index.d.ts.map +1 -1
  278. package/dist/views/API/RenderJSON/index.js.map +1 -1
  279. package/dist/views/API/RenderJSON/index.scss +68 -66
  280. package/dist/views/API/index.client.d.ts.map +1 -1
  281. package/dist/views/API/index.client.js +16 -16
  282. package/dist/views/API/index.client.js.map +1 -1
  283. package/dist/views/API/index.scss +98 -96
  284. package/dist/views/Account/Settings/index.d.ts +2 -1
  285. package/dist/views/Account/Settings/index.d.ts.map +1 -1
  286. package/dist/views/Account/Settings/index.js +3 -3
  287. package/dist/views/Account/Settings/index.js.map +1 -1
  288. package/dist/views/Account/Settings/index.scss +37 -35
  289. package/dist/views/Account/ToggleTheme/index.d.ts.map +1 -1
  290. package/dist/views/Account/ToggleTheme/index.js +2 -0
  291. package/dist/views/Account/ToggleTheme/index.js.map +1 -1
  292. package/dist/views/Account/index.d.ts.map +1 -1
  293. package/dist/views/Account/index.js +86 -31
  294. package/dist/views/Account/index.js.map +1 -1
  295. package/dist/views/CreateFirstUser/index.client.d.ts +4 -2
  296. package/dist/views/CreateFirstUser/index.client.d.ts.map +1 -1
  297. package/dist/views/CreateFirstUser/index.client.js +86 -92
  298. package/dist/views/CreateFirstUser/index.client.js.map +1 -1
  299. package/dist/views/CreateFirstUser/index.d.ts.map +1 -1
  300. package/dist/views/CreateFirstUser/index.js +36 -4
  301. package/dist/views/CreateFirstUser/index.js.map +1 -1
  302. package/dist/views/CreateFirstUser/index.scss +18 -6
  303. package/dist/views/Dashboard/Default/index.d.ts +11 -2
  304. package/dist/views/Dashboard/Default/index.d.ts.map +1 -1
  305. package/dist/views/Dashboard/Default/index.js +70 -47
  306. package/dist/views/Dashboard/Default/index.js.map +1 -1
  307. package/dist/views/Dashboard/Default/index.scss +53 -46
  308. package/dist/views/Dashboard/index.d.ts.map +1 -1
  309. package/dist/views/Dashboard/index.js +57 -24
  310. package/dist/views/Dashboard/index.js.map +1 -1
  311. package/dist/views/Document/getDocPreferences.d.ts +11 -0
  312. package/dist/views/Document/getDocPreferences.d.ts.map +1 -0
  313. package/dist/views/Document/getDocPreferences.js +44 -0
  314. package/dist/views/Document/getDocPreferences.js.map +1 -0
  315. package/dist/views/Document/getDocumentData.d.ts +10 -8
  316. package/dist/views/Document/getDocumentData.d.ts.map +1 -1
  317. package/dist/views/Document/getDocumentData.js +35 -34
  318. package/dist/views/Document/getDocumentData.js.map +1 -1
  319. package/dist/views/Document/getDocumentPermissions.d.ts +2 -2
  320. package/dist/views/Document/getDocumentPermissions.d.ts.map +1 -1
  321. package/dist/views/Document/getDocumentPermissions.js +14 -8
  322. package/dist/views/Document/getDocumentPermissions.js.map +1 -1
  323. package/dist/views/Document/getIsLocked.d.ts +16 -0
  324. package/dist/views/Document/getIsLocked.d.ts.map +1 -0
  325. package/dist/views/Document/getIsLocked.js +55 -0
  326. package/dist/views/Document/getIsLocked.js.map +1 -0
  327. package/dist/views/Document/getMetaBySegment.d.ts +2 -2
  328. package/dist/views/Document/getMetaBySegment.d.ts.map +1 -1
  329. package/dist/views/Document/getMetaBySegment.js.map +1 -1
  330. package/dist/views/Document/getVersions.d.ts +19 -0
  331. package/dist/views/Document/getVersions.d.ts.map +1 -0
  332. package/dist/views/Document/getVersions.js +181 -0
  333. package/dist/views/Document/getVersions.js.map +1 -0
  334. package/dist/views/Document/getViewsFromConfig.d.ts +3 -3
  335. package/dist/views/Document/getViewsFromConfig.d.ts.map +1 -1
  336. package/dist/views/Document/getViewsFromConfig.js +30 -25
  337. package/dist/views/Document/getViewsFromConfig.js.map +1 -1
  338. package/dist/views/Document/handleServerFunction.d.ts +25 -0
  339. package/dist/views/Document/handleServerFunction.d.ts.map +1 -0
  340. package/dist/views/Document/handleServerFunction.js +159 -0
  341. package/dist/views/Document/handleServerFunction.js.map +1 -0
  342. package/dist/views/Document/index.d.ts +5 -1
  343. package/dist/views/Document/index.d.ts.map +1 -1
  344. package/dist/views/Document/index.js +184 -73
  345. package/dist/views/Document/index.js.map +1 -1
  346. package/dist/views/Document/renderDocumentSlots.d.ts +12 -0
  347. package/dist/views/Document/renderDocumentSlots.d.ts.map +1 -0
  348. package/dist/views/Document/renderDocumentSlots.js +92 -0
  349. package/dist/views/Document/renderDocumentSlots.js.map +1 -0
  350. package/dist/views/Edit/index.d.ts +3 -2
  351. package/dist/views/Edit/index.d.ts.map +1 -1
  352. package/dist/views/Edit/index.js +7 -3
  353. package/dist/views/Edit/index.js.map +1 -1
  354. package/dist/views/ForgotPassword/ForgotPasswordForm/index.d.ts.map +1 -1
  355. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +17 -12
  356. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
  357. package/dist/views/ForgotPassword/index.d.ts.map +1 -1
  358. package/dist/views/ForgotPassword/index.js +11 -9
  359. package/dist/views/ForgotPassword/index.js.map +1 -1
  360. package/dist/views/List/handleServerFunction.d.ts +27 -0
  361. package/dist/views/List/handleServerFunction.d.ts.map +1 -0
  362. package/dist/views/List/handleServerFunction.js +158 -0
  363. package/dist/views/List/handleServerFunction.js.map +1 -0
  364. package/dist/views/List/index.d.ts +12 -2
  365. package/dist/views/List/index.d.ts.map +1 -1
  366. package/dist/views/List/index.js +146 -85
  367. package/dist/views/List/index.js.map +1 -1
  368. package/dist/views/List/renderListViewSlots.d.ts +12 -0
  369. package/dist/views/List/renderListViewSlots.d.ts.map +1 -0
  370. package/dist/views/List/renderListViewSlots.js +56 -0
  371. package/dist/views/List/renderListViewSlots.js.map +1 -0
  372. package/dist/views/LivePreview/Context/context.d.ts +1 -1
  373. package/dist/views/LivePreview/Context/context.d.ts.map +1 -1
  374. package/dist/views/LivePreview/Context/context.js.map +1 -1
  375. package/dist/views/LivePreview/Context/index.d.ts.map +1 -1
  376. package/dist/views/LivePreview/Context/index.js +3 -1
  377. package/dist/views/LivePreview/Context/index.js.map +1 -1
  378. package/dist/views/LivePreview/Context/sizeReducer.d.ts +1 -1
  379. package/dist/views/LivePreview/Context/sizeReducer.d.ts.map +1 -1
  380. package/dist/views/LivePreview/Context/sizeReducer.js +4 -4
  381. package/dist/views/LivePreview/Context/sizeReducer.js.map +1 -1
  382. package/dist/views/LivePreview/Device/index.d.ts.map +1 -1
  383. package/dist/views/LivePreview/Device/index.js +5 -1
  384. package/dist/views/LivePreview/Device/index.js.map +1 -1
  385. package/dist/views/LivePreview/IFrame/index.scss +8 -6
  386. package/dist/views/LivePreview/Preview/index.scss +32 -30
  387. package/dist/views/LivePreview/Toolbar/Controls/index.js +1 -1
  388. package/dist/views/LivePreview/Toolbar/Controls/index.js.map +1 -1
  389. package/dist/views/LivePreview/Toolbar/Controls/index.scss +49 -47
  390. package/dist/views/LivePreview/Toolbar/SizeInput/index.d.ts.map +1 -1
  391. package/dist/views/LivePreview/Toolbar/SizeInput/index.js.map +1 -1
  392. package/dist/views/LivePreview/Toolbar/SizeInput/index.scss +11 -9
  393. package/dist/views/LivePreview/Toolbar/index.scss +33 -31
  394. package/dist/views/LivePreview/ToolbarArea/index.scss +5 -3
  395. package/dist/views/LivePreview/index.client.d.ts.map +1 -1
  396. package/dist/views/LivePreview/index.client.js +234 -210
  397. package/dist/views/LivePreview/index.client.js.map +1 -1
  398. package/dist/views/LivePreview/index.d.ts.map +1 -1
  399. package/dist/views/LivePreview/index.js +5 -36
  400. package/dist/views/LivePreview/index.js.map +1 -1
  401. package/dist/views/LivePreview/index.scss +48 -46
  402. package/dist/views/LivePreview/usePopupWindow.d.ts +1 -1
  403. package/dist/views/LivePreview/usePopupWindow.d.ts.map +1 -1
  404. package/dist/views/LivePreview/usePopupWindow.js +119 -74
  405. package/dist/views/LivePreview/usePopupWindow.js.map +1 -1
  406. package/dist/views/Login/LoginField/index.d.ts.map +1 -1
  407. package/dist/views/Login/LoginField/index.js +6 -1
  408. package/dist/views/Login/LoginField/index.js.map +1 -1
  409. package/dist/views/Login/LoginForm/index.d.ts.map +1 -1
  410. package/dist/views/Login/LoginForm/index.js +31 -13
  411. package/dist/views/Login/LoginForm/index.js.map +1 -1
  412. package/dist/views/Login/LoginForm/index.scss +8 -6
  413. package/dist/views/Login/index.d.ts.map +1 -1
  414. package/dist/views/Login/index.js +26 -20
  415. package/dist/views/Login/index.js.map +1 -1
  416. package/dist/views/Login/index.scss +8 -6
  417. package/dist/views/Logout/LogoutClient.d.ts +1 -0
  418. package/dist/views/Logout/LogoutClient.d.ts.map +1 -1
  419. package/dist/views/Logout/LogoutClient.js +82 -57
  420. package/dist/views/Logout/LogoutClient.js.map +1 -1
  421. package/dist/views/Logout/index.d.ts.map +1 -1
  422. package/dist/views/Logout/index.js +1 -1
  423. package/dist/views/Logout/index.js.map +1 -1
  424. package/dist/views/Logout/index.scss +19 -14
  425. package/dist/views/NotFound/index.client.d.ts.map +1 -1
  426. package/dist/views/NotFound/index.client.js +8 -5
  427. package/dist/views/NotFound/index.client.js.map +1 -1
  428. package/dist/views/NotFound/index.d.ts +5 -5
  429. package/dist/views/NotFound/index.d.ts.map +1 -1
  430. package/dist/views/NotFound/index.js +7 -2
  431. package/dist/views/NotFound/index.js.map +1 -1
  432. package/dist/views/NotFound/index.scss +41 -21
  433. package/dist/views/ResetPassword/ResetPasswordForm/index.d.ts +7 -0
  434. package/dist/views/ResetPassword/ResetPasswordForm/index.d.ts.map +1 -0
  435. package/dist/views/ResetPassword/{index.client.js → ResetPasswordForm/index.js} +26 -25
  436. package/dist/views/ResetPassword/ResetPasswordForm/index.js.map +1 -0
  437. package/dist/views/ResetPassword/index.d.ts.map +1 -1
  438. package/dist/views/ResetPassword/index.js +48 -45
  439. package/dist/views/ResetPassword/index.js.map +1 -1
  440. package/dist/views/ResetPassword/index.scss +9 -3
  441. package/dist/views/Root/getViewFromConfig.d.ts +3 -1
  442. package/dist/views/Root/getViewFromConfig.d.ts.map +1 -1
  443. package/dist/views/Root/getViewFromConfig.js +131 -16
  444. package/dist/views/Root/getViewFromConfig.js.map +1 -1
  445. package/dist/views/Root/index.d.ts +5 -5
  446. package/dist/views/Root/index.d.ts.map +1 -1
  447. package/dist/views/Root/index.js +44 -19
  448. package/dist/views/Root/index.js.map +1 -1
  449. package/dist/views/Root/isPathMatchingRoute.d.ts.map +1 -1
  450. package/dist/views/Root/isPathMatchingRoute.js +6 -2
  451. package/dist/views/Root/isPathMatchingRoute.js.map +1 -1
  452. package/dist/views/Root/meta.d.ts +5 -5
  453. package/dist/views/Root/meta.d.ts.map +1 -1
  454. package/dist/views/Root/meta.js +3 -2
  455. package/dist/views/Root/meta.js.map +1 -1
  456. package/dist/views/Unauthorized/index.d.ts.map +1 -1
  457. package/dist/views/Unauthorized/index.js +15 -8
  458. package/dist/views/Unauthorized/index.js.map +1 -1
  459. package/dist/views/Unauthorized/index.scss +4 -31
  460. package/dist/views/Verify/index.client.d.ts +7 -0
  461. package/dist/views/Verify/index.client.d.ts.map +1 -0
  462. package/dist/views/Verify/index.client.js +46 -0
  463. package/dist/views/Verify/index.client.js.map +1 -0
  464. package/dist/views/Verify/index.d.ts.map +1 -1
  465. package/dist/views/Verify/index.js +13 -11
  466. package/dist/views/Verify/index.js.map +1 -1
  467. package/dist/views/Verify/index.scss +13 -11
  468. package/dist/views/Version/Default/index.d.ts.map +1 -1
  469. package/dist/views/Version/Default/index.js +5 -5
  470. package/dist/views/Version/Default/index.js.map +1 -1
  471. package/dist/views/Version/Default/index.scss +52 -50
  472. package/dist/views/Version/Default/types.d.ts +2 -2
  473. package/dist/views/Version/Default/types.d.ts.map +1 -1
  474. package/dist/views/Version/Default/types.js.map +1 -1
  475. package/dist/views/Version/RenderFieldsToDiff/Label/index.scss +5 -3
  476. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.d.ts.map +1 -1
  477. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +4 -2
  478. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
  479. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.scss +29 -27
  480. package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js +1 -1
  481. package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js.map +1 -1
  482. package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.scss +11 -9
  483. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.scss +12 -10
  484. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.d.ts.map +1 -1
  485. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js +3 -1
  486. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js.map +1 -1
  487. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.scss +12 -10
  488. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.d.ts.map +1 -1
  489. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js +9 -3
  490. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js.map +1 -1
  491. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.scss +12 -10
  492. package/dist/views/Version/RenderFieldsToDiff/fields/types.d.ts +4 -2
  493. package/dist/views/Version/RenderFieldsToDiff/fields/types.d.ts.map +1 -1
  494. package/dist/views/Version/RenderFieldsToDiff/fields/types.js.map +1 -1
  495. package/dist/views/Version/RenderFieldsToDiff/index.d.ts.map +1 -1
  496. package/dist/views/Version/RenderFieldsToDiff/index.js +10 -6
  497. package/dist/views/Version/RenderFieldsToDiff/index.js.map +1 -1
  498. package/dist/views/Version/RenderFieldsToDiff/index.scss +12 -10
  499. package/dist/views/Version/RenderFieldsToDiff/types.d.ts +4 -2
  500. package/dist/views/Version/RenderFieldsToDiff/types.d.ts.map +1 -1
  501. package/dist/views/Version/RenderFieldsToDiff/types.js.map +1 -1
  502. package/dist/views/Version/Restore/index.d.ts.map +1 -1
  503. package/dist/views/Version/Restore/index.js +32 -30
  504. package/dist/views/Version/Restore/index.js.map +1 -1
  505. package/dist/views/Version/Restore/index.scss +60 -42
  506. package/dist/views/Version/SelectComparison/index.d.ts.map +1 -1
  507. package/dist/views/Version/SelectComparison/index.js +27 -4
  508. package/dist/views/Version/SelectComparison/index.js.map +1 -1
  509. package/dist/views/Version/SelectComparison/index.scss +12 -10
  510. package/dist/views/Version/SelectComparison/types.d.ts +1 -0
  511. package/dist/views/Version/SelectComparison/types.d.ts.map +1 -1
  512. package/dist/views/Version/SelectComparison/types.js.map +1 -1
  513. package/dist/views/Version/SelectLocales/index.d.ts.map +1 -1
  514. package/dist/views/Version/SelectLocales/index.js.map +1 -1
  515. package/dist/views/Version/SelectLocales/index.scss +6 -4
  516. package/dist/views/Version/index.d.ts.map +1 -1
  517. package/dist/views/Version/index.js +2 -0
  518. package/dist/views/Version/index.js.map +1 -1
  519. package/dist/views/Versions/buildColumns.d.ts +3 -2
  520. package/dist/views/Versions/buildColumns.d.ts.map +1 -1
  521. package/dist/views/Versions/buildColumns.js +47 -60
  522. package/dist/views/Versions/buildColumns.js.map +1 -1
  523. package/dist/views/Versions/cells/AutosaveCell/index.d.ts +7 -0
  524. package/dist/views/Versions/cells/AutosaveCell/index.d.ts.map +1 -1
  525. package/dist/views/Versions/cells/AutosaveCell/index.js +66 -27
  526. package/dist/views/Versions/cells/AutosaveCell/index.js.map +1 -1
  527. package/dist/views/Versions/cells/CreatedAt/index.d.ts +4 -0
  528. package/dist/views/Versions/cells/CreatedAt/index.d.ts.map +1 -1
  529. package/dist/views/Versions/cells/CreatedAt/index.js +43 -44
  530. package/dist/views/Versions/cells/CreatedAt/index.js.map +1 -1
  531. package/dist/views/Versions/cells/ID/index.d.ts +3 -1
  532. package/dist/views/Versions/cells/ID/index.d.ts.map +1 -1
  533. package/dist/views/Versions/cells/ID/index.js +7 -19
  534. package/dist/views/Versions/cells/ID/index.js.map +1 -1
  535. package/dist/views/Versions/getLatestVersion.d.ts +1 -0
  536. package/dist/views/Versions/getLatestVersion.d.ts.map +1 -1
  537. package/dist/views/Versions/getLatestVersion.js +15 -4
  538. package/dist/views/Versions/getLatestVersion.js.map +1 -1
  539. package/dist/views/Versions/index.client.d.ts.map +1 -1
  540. package/dist/views/Versions/index.client.js +53 -51
  541. package/dist/views/Versions/index.client.js.map +1 -1
  542. package/dist/views/Versions/index.d.ts.map +1 -1
  543. package/dist/views/Versions/index.js +35 -13
  544. package/dist/views/Versions/index.js.map +1 -1
  545. package/dist/views/Versions/index.scss +78 -76
  546. package/dist/withPayload.d.ts.map +1 -1
  547. package/dist/withPayload.js +23 -5
  548. package/dist/withPayload.js.map +1 -1
  549. package/license.md +22 -0
  550. package/package.json +37 -22
  551. package/dist/cjs/withPayload.js +0 -111
  552. package/dist/cjs/withPayload.js.map +0 -1
  553. package/dist/elements/EmailAndUsername/index.d.ts +0 -14
  554. package/dist/elements/EmailAndUsername/index.d.ts.map +0 -1
  555. package/dist/elements/EmailAndUsername/index.js +0 -121
  556. package/dist/elements/EmailAndUsername/index.js.map +0 -1
  557. package/dist/elements/LeaveWithoutSaving/index.d.ts +0 -4
  558. package/dist/elements/LeaveWithoutSaving/index.d.ts.map +0 -1
  559. package/dist/elements/LeaveWithoutSaving/index.js +0 -162
  560. package/dist/elements/LeaveWithoutSaving/index.js.map +0 -1
  561. package/dist/elements/LeaveWithoutSaving/index.scss +0 -37
  562. package/dist/elements/LeaveWithoutSaving/usePreventLeave.d.ts +0 -9
  563. package/dist/elements/LeaveWithoutSaving/usePreventLeave.d.ts.map +0 -1
  564. package/dist/elements/LeaveWithoutSaving/usePreventLeave.js +0 -134
  565. package/dist/elements/LeaveWithoutSaving/usePreventLeave.js.map +0 -1
  566. package/dist/routes/rest/buildFormState.d.ts +0 -5
  567. package/dist/routes/rest/buildFormState.d.ts.map +0 -1
  568. package/dist/routes/rest/buildFormState.js +0 -46
  569. package/dist/routes/rest/buildFormState.js.map +0 -1
  570. package/dist/views/Edit/Default/Auth/APIKey.d.ts +0 -6
  571. package/dist/views/Edit/Default/Auth/APIKey.d.ts.map +0 -1
  572. package/dist/views/Edit/Default/Auth/APIKey.js +0 -131
  573. package/dist/views/Edit/Default/Auth/APIKey.js.map +0 -1
  574. package/dist/views/Edit/Default/Auth/index.d.ts +0 -5
  575. package/dist/views/Edit/Default/Auth/index.d.ts.map +0 -1
  576. package/dist/views/Edit/Default/Auth/index.js +0 -307
  577. package/dist/views/Edit/Default/Auth/index.js.map +0 -1
  578. package/dist/views/Edit/Default/Auth/index.scss +0 -76
  579. package/dist/views/Edit/Default/Auth/types.d.ts +0 -17
  580. package/dist/views/Edit/Default/Auth/types.d.ts.map +0 -1
  581. package/dist/views/Edit/Default/Auth/types.js +0 -2
  582. package/dist/views/Edit/Default/Auth/types.js.map +0 -1
  583. package/dist/views/Edit/Default/SetDocumentStepNav/index.d.ts +0 -11
  584. package/dist/views/Edit/Default/SetDocumentStepNav/index.d.ts.map +0 -1
  585. package/dist/views/Edit/Default/SetDocumentStepNav/index.js +0 -130
  586. package/dist/views/Edit/Default/SetDocumentStepNav/index.js.map +0 -1
  587. package/dist/views/Edit/Default/SetDocumentTitle/index.d.ts +0 -8
  588. package/dist/views/Edit/Default/SetDocumentTitle/index.d.ts.map +0 -1
  589. package/dist/views/Edit/Default/SetDocumentTitle/index.js +0 -81
  590. package/dist/views/Edit/Default/SetDocumentTitle/index.js.map +0 -1
  591. package/dist/views/Edit/Default/index.d.ts +0 -4
  592. package/dist/views/Edit/Default/index.d.ts.map +0 -1
  593. package/dist/views/Edit/Default/index.js +0 -212
  594. package/dist/views/Edit/Default/index.js.map +0 -1
  595. package/dist/views/Edit/Default/index.scss +0 -21
  596. package/dist/views/Edit/Default/types.d.ts +0 -6
  597. package/dist/views/Edit/Default/types.d.ts.map +0 -1
  598. package/dist/views/Edit/Default/types.js +0 -2
  599. package/dist/views/Edit/Default/types.js.map +0 -1
  600. package/dist/views/Edit/index.client.d.ts +0 -3
  601. package/dist/views/Edit/index.client.d.ts.map +0 -1
  602. package/dist/views/Edit/index.client.js +0 -54
  603. package/dist/views/Edit/index.client.js.map +0 -1
  604. package/dist/views/List/Default/index.d.ts +0 -4
  605. package/dist/views/List/Default/index.d.ts.map +0 -1
  606. package/dist/views/List/Default/index.js +0 -363
  607. package/dist/views/List/Default/index.js.map +0 -1
  608. package/dist/views/List/Default/index.scss +0 -177
  609. package/dist/views/List/Default/types.d.ts +0 -15
  610. package/dist/views/List/Default/types.d.ts.map +0 -1
  611. package/dist/views/List/Default/types.js +0 -2
  612. package/dist/views/List/Default/types.js.map +0 -1
  613. package/dist/views/ResetPassword/index.client.d.ts +0 -7
  614. package/dist/views/ResetPassword/index.client.d.ts.map +0 -1
  615. package/dist/views/ResetPassword/index.client.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"findByID.js","names":["httpStatus","findByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","findByID","id","incomingID","collection","req","searchParams","depth","get","collectionSlug","config","slug","payload","result","Number","undefined","draft","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/findByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { findByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\n\nexport const findByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const result = await findByIDOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: searchParams.get('draft') === 'true',\n req,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,iBAAiB,QAAQ;AAClC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AAErC,OAAO,MAAMC,QAAA,GAAyC,MAAAA,CAAO;EAC3DC,EAAA,EAAIC,UAAU;EACdC,UAAU;EACVC;AAAG,CACJ;EACC,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMN,EAAA,GAAKF,oBAAA,CAAqB;IAC9BE,EAAA,EAAIC,UAAA;IACJM,cAAA,EAAgBL,UAAA,CAAWM,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASP,GAAA,CAAIO;EACf;EAEA,MAAMC,MAAA,GAAS,MAAMhB,iBAAA,CAAkB;IACrCK,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCC,KAAA,EAAOV,YAAA,CAAaE,GAAG,CAAC,aAAa;IACrCH;EACF;EAEA,OAAOY,QAAA,CAASC,IAAI,CAACL,MAAA,EAAQ;IAC3BM,OAAA,EAASpB,eAAA,CAAgB;MACvBoB,OAAA,EAAS,IAAIC,OAAA;MACbf;IACF;IACAgB,MAAA,EAAQzB,UAAA,CAAW0B;EACrB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"findByID.js","names":["httpStatus","findByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","sanitizeJoinParams","sanitizePopulate","sanitizeSelect","findByID","id","incomingID","collection","req","searchParams","depth","get","collectionSlug","config","slug","payload","result","Number","undefined","draft","joins","query","populate","select","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/findByID.ts"],"sourcesContent":["import type { JoinQuery } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { findByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\nimport { sanitizeJoinParams } from '../utilities/sanitizeJoinParams.js'\nimport { sanitizePopulate } from '../utilities/sanitizePopulate.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const findByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const result = await findByIDOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: searchParams.get('draft') === 'true',\n joins: sanitizeJoinParams(req.query.joins as JoinQuery),\n populate: sanitizePopulate(req.query.populate),\n req,\n select: sanitizeSelect(req.query.select),\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,iBAAiB,QAAQ;AAClC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,QAAA,GAAyC,MAAAA,CAAO;EAC3DC,EAAA,EAAIC,UAAU;EACdC,UAAU;EACVC;AAAG,CACJ;EACC,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMN,EAAA,GAAKL,oBAAA,CAAqB;IAC9BK,EAAA,EAAIC,UAAA;IACJM,cAAA,EAAgBL,UAAA,CAAWM,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASP,GAAA,CAAIO;EACf;EAEA,MAAMC,MAAA,GAAS,MAAMnB,iBAAA,CAAkB;IACrCQ,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOZ,QAAA,CAASY,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCC,KAAA,EAAOV,YAAA,CAAaE,GAAG,CAAC,aAAa;IACrCS,KAAA,EAAOnB,kBAAA,CAAmBO,GAAA,CAAIa,KAAK,CAACD,KAAK;IACzCE,QAAA,EAAUpB,gBAAA,CAAiBM,GAAA,CAAIa,KAAK,CAACC,QAAQ;IAC7Cd,GAAA;IACAe,MAAA,EAAQpB,cAAA,CAAeK,GAAA,CAAIa,KAAK,CAACE,MAAM;EACzC;EAEA,OAAOC,QAAA,CAASC,IAAI,CAACT,MAAA,EAAQ;IAC3BU,OAAA,EAAS3B,eAAA,CAAgB;MACvB2B,OAAA,EAAS,IAAIC,OAAA;MACbnB;IACF;IACAoB,MAAA,EAAQhC,UAAA,CAAWiC;EACrB;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"findVersionByID.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/findVersionByID.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAK/D,eAAO,MAAM,eAAe,EAAE,4BA4B7B,CAAA"}
1
+ {"version":3,"file":"findVersionByID.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/findVersionByID.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAO/D,eAAO,MAAM,eAAe,EAAE,4BA8B7B,CAAA"}
@@ -3,6 +3,8 @@ import { findVersionByIDOperation } from 'payload';
3
3
  import { isNumber } from 'payload/shared';
4
4
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
5
5
  import { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js';
6
+ import { sanitizePopulate } from '../utilities/sanitizePopulate.js';
7
+ import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
6
8
  export const findVersionByID = async ({
7
9
  id: incomingID,
8
10
  collection,
@@ -21,7 +23,9 @@ export const findVersionByID = async ({
21
23
  id,
22
24
  collection,
23
25
  depth: isNumber(depth) ? Number(depth) : undefined,
24
- req
26
+ populate: sanitizePopulate(req.query.populate),
27
+ req,
28
+ select: sanitizeSelect(req.query.select)
25
29
  });
26
30
  return Response.json(result, {
27
31
  headers: headersWithCors({
@@ -1 +1 @@
1
- {"version":3,"file":"findVersionByID.js","names":["httpStatus","findVersionByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","findVersionByID","id","incomingID","collection","req","searchParams","depth","get","collectionSlug","config","slug","payload","result","Number","undefined","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/findVersionByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { findVersionByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\n\nexport const findVersionByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const result = await findVersionByIDOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n req,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,wBAAwB,QAAQ;AACzC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AAErC,OAAO,MAAMC,eAAA,GAAgD,MAAAA,CAAO;EAClEC,EAAA,EAAIC,UAAU;EACdC,UAAU;EACVC;AAAG,CACJ;EACC,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMN,EAAA,GAAKF,oBAAA,CAAqB;IAC9BE,EAAA,EAAIC,UAAA;IACJM,cAAA,EAAgBL,UAAA,CAAWM,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASP,GAAA,CAAIO;EACf;EAEA,MAAMC,MAAA,GAAS,MAAMhB,wBAAA,CAAyB;IAC5CK,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCV;EACF;EAEA,OAAOW,QAAA,CAASC,IAAI,CAACJ,MAAA,EAAQ;IAC3BK,OAAA,EAASnB,eAAA,CAAgB;MACvBmB,OAAA,EAAS,IAAIC,OAAA;MACbd;IACF;IACAe,MAAA,EAAQxB,UAAA,CAAWyB;EACrB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"findVersionByID.js","names":["httpStatus","findVersionByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","sanitizePopulate","sanitizeSelect","findVersionByID","id","incomingID","collection","req","searchParams","depth","get","collectionSlug","config","slug","payload","result","Number","undefined","populate","query","select","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/findVersionByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { findVersionByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\nimport { sanitizePopulate } from '../utilities/sanitizePopulate.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const findVersionByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const result = await findVersionByIDOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n populate: sanitizePopulate(req.query.populate),\n req,\n select: sanitizeSelect(req.query.select),\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,wBAAwB,QAAQ;AACzC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,eAAA,GAAgD,MAAAA,CAAO;EAClEC,EAAA,EAAIC,UAAU;EACdC,UAAU;EACVC;AAAG,CACJ;EACC,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMN,EAAA,GAAKJ,oBAAA,CAAqB;IAC9BI,EAAA,EAAIC,UAAA;IACJM,cAAA,EAAgBL,UAAA,CAAWM,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASP,GAAA,CAAIO;EACf;EAEA,MAAMC,MAAA,GAAS,MAAMlB,wBAAA,CAAyB;IAC5CO,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOX,QAAA,CAASW,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCC,QAAA,EAAUjB,gBAAA,CAAiBM,GAAA,CAAIY,KAAK,CAACD,QAAQ;IAC7CX,GAAA;IACAa,MAAA,EAAQlB,cAAA,CAAeK,GAAA,CAAIY,KAAK,CAACC,MAAM;EACzC;EAEA,OAAOC,QAAA,CAASC,IAAI,CAACP,MAAA,EAAQ;IAC3BQ,OAAA,EAASxB,eAAA,CAAgB;MACvBwB,OAAA,EAAS,IAAIC,OAAA;MACbjB;IACF;IACAkB,MAAA,EAAQ7B,UAAA,CAAW8B;EACrB;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"findVersions.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/findVersions.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,YAAY,EAAE,sBA0B1B,CAAA"}
1
+ {"version":3,"file":"findVersions.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/findVersions.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAMzD,eAAO,MAAM,YAAY,EAAE,sBA8B1B,CAAA"}
@@ -2,6 +2,8 @@ import httpStatus from 'http-status';
2
2
  import { findVersionsOperation } from 'payload';
3
3
  import { isNumber } from 'payload/shared';
4
4
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
5
+ import { sanitizePopulate } from '../utilities/sanitizePopulate.js';
6
+ import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
5
7
  export const findVersions = async ({
6
8
  collection,
7
9
  req
@@ -10,6 +12,8 @@ export const findVersions = async ({
10
12
  depth,
11
13
  limit,
12
14
  page,
15
+ populate,
16
+ select,
13
17
  sort,
14
18
  where
15
19
  } = req.query;
@@ -18,8 +22,10 @@ export const findVersions = async ({
18
22
  depth: isNumber(depth) ? Number(depth) : undefined,
19
23
  limit: isNumber(limit) ? Number(limit) : undefined,
20
24
  page: isNumber(page) ? Number(page) : undefined,
25
+ populate: sanitizePopulate(populate),
21
26
  req,
22
- sort,
27
+ select: sanitizeSelect(select),
28
+ sort: typeof sort === 'string' ? sort.split(',') : undefined,
23
29
  where
24
30
  });
25
31
  return Response.json(result, {
@@ -1 +1 @@
1
- {"version":3,"file":"findVersions.js","names":["httpStatus","findVersionsOperation","isNumber","headersWithCors","findVersions","collection","req","depth","limit","page","sort","where","query","result","Number","undefined","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/findVersions.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { findVersionsOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const findVersions: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, limit, page, sort, where } = req.query as {\n depth?: string\n limit?: string\n page?: string\n sort?: string\n where?: Where\n }\n\n const result = await findVersionsOperation({\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n limit: isNumber(limit) ? Number(limit) : undefined,\n page: isNumber(page) ? Number(page) : undefined,\n req,\n sort,\n where,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,qBAAqB,QAAQ;AACtC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,YAAA,GAAuC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EAC5E,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,IAAI;IAAEC,IAAI;IAAEC;EAAK,CAAE,GAAGL,GAAA,CAAIM,KAAK;EAQrD,MAAMC,MAAA,GAAS,MAAMZ,qBAAA,CAAsB;IACzCI,UAAA;IACAE,KAAA,EAAOL,QAAA,CAASK,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCP,KAAA,EAAON,QAAA,CAASM,KAAA,IAASM,MAAA,CAAON,KAAA,IAASO,SAAA;IACzCN,IAAA,EAAMP,QAAA,CAASO,IAAA,IAAQK,MAAA,CAAOL,IAAA,IAAQM,SAAA;IACtCT,GAAA;IACAI,IAAA;IACAC;EACF;EAEA,OAAOK,QAAA,CAASC,IAAI,CAACJ,MAAA,EAAQ;IAC3BK,OAAA,EAASf,eAAA,CAAgB;MACvBe,OAAA,EAAS,IAAIC,OAAA;MACbb;IACF;IACAc,MAAA,EAAQpB,UAAA,CAAWqB;EACrB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"findVersions.js","names":["httpStatus","findVersionsOperation","isNumber","headersWithCors","sanitizePopulate","sanitizeSelect","findVersions","collection","req","depth","limit","page","populate","select","sort","where","query","result","Number","undefined","split","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/findVersions.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { findVersionsOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizePopulate } from '../utilities/sanitizePopulate.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const findVersions: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, limit, page, populate, select, sort, where } = req.query as {\n depth?: string\n limit?: string\n page?: string\n populate?: Record<string, unknown>\n select?: Record<string, unknown>\n sort?: string\n where?: Where\n }\n\n const result = await findVersionsOperation({\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n limit: isNumber(limit) ? Number(limit) : undefined,\n page: isNumber(page) ? Number(page) : undefined,\n populate: sanitizePopulate(populate),\n req,\n select: sanitizeSelect(select),\n sort: typeof sort === 'string' ? sort.split(',') : undefined,\n where,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,qBAAqB,QAAQ;AACtC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,YAAA,GAAuC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EAC5E,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,IAAI;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,IAAI;IAAEC;EAAK,CAAE,GAAGP,GAAA,CAAIQ,KAAK;EAUvE,MAAMC,MAAA,GAAS,MAAMhB,qBAAA,CAAsB;IACzCM,UAAA;IACAE,KAAA,EAAOP,QAAA,CAASO,KAAA,IAASS,MAAA,CAAOT,KAAA,IAASU,SAAA;IACzCT,KAAA,EAAOR,QAAA,CAASQ,KAAA,IAASQ,MAAA,CAAOR,KAAA,IAASS,SAAA;IACzCR,IAAA,EAAMT,QAAA,CAASS,IAAA,IAAQO,MAAA,CAAOP,IAAA,IAAQQ,SAAA;IACtCP,QAAA,EAAUR,gBAAA,CAAiBQ,QAAA;IAC3BJ,GAAA;IACAK,MAAA,EAAQR,cAAA,CAAeQ,MAAA;IACvBC,IAAA,EAAM,OAAOA,IAAA,KAAS,WAAWA,IAAA,CAAKM,KAAK,CAAC,OAAOD,SAAA;IACnDJ;EACF;EAEA,OAAOM,QAAA,CAASC,IAAI,CAACL,MAAA,EAAQ;IAC3BM,OAAA,EAASpB,eAAA,CAAgB;MACvBoB,OAAA,EAAS,IAAIC,OAAA;MACbhB;IACF;IACAiB,MAAA,EAAQzB,UAAA,CAAW0B;EACrB;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"restoreVersion.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/restoreVersion.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAK/D,eAAO,MAAM,cAAc,EAAE,4BAoC5B,CAAA"}
1
+ {"version":3,"file":"restoreVersion.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/restoreVersion.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAM/D,eAAO,MAAM,cAAc,EAAE,4BAqC5B,CAAA"}
@@ -3,6 +3,7 @@ import { restoreVersionOperation } from 'payload';
3
3
  import { isNumber } from 'payload/shared';
4
4
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
5
5
  import { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js';
6
+ import { sanitizePopulate } from '../utilities/sanitizePopulate.js';
6
7
  export const restoreVersion = async ({
7
8
  id: incomingID,
8
9
  collection,
@@ -23,6 +24,7 @@ export const restoreVersion = async ({
23
24
  collection,
24
25
  depth: isNumber(depth) ? Number(depth) : undefined,
25
26
  draft: draft === 'true' ? true : undefined,
27
+ populate: sanitizePopulate(req.query.populate),
26
28
  req
27
29
  });
28
30
  return Response.json({
@@ -1 +1 @@
1
- {"version":3,"file":"restoreVersion.js","names":["httpStatus","restoreVersionOperation","isNumber","headersWithCors","sanitizeCollectionID","restoreVersion","id","incomingID","collection","req","searchParams","depth","get","draft","collectionSlug","config","slug","payload","result","Number","undefined","Response","json","message","t","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/restoreVersion.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { restoreVersionOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\n\nexport const restoreVersion: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const draft = searchParams.get('draft')\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const result = await restoreVersionOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: draft === 'true' ? true : undefined,\n req,\n })\n\n return Response.json(\n {\n ...result,\n message: req.t('version:restoredSuccessfully'),\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,uBAAuB,QAAQ;AACxC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AAErC,OAAO,MAAMC,cAAA,GAA+C,MAAAA,CAAO;EACjEC,EAAA,EAAIC,UAAU;EACdC,UAAU;EACVC;AAAG,CACJ;EACC,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAC/B,MAAMC,KAAA,GAAQH,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMN,EAAA,GAAKF,oBAAA,CAAqB;IAC9BE,EAAA,EAAIC,UAAA;IACJO,cAAA,EAAgBN,UAAA,CAAWO,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASR,GAAA,CAAIQ;EACf;EAEA,MAAMC,MAAA,GAAS,MAAMjB,uBAAA,CAAwB;IAC3CK,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASQ,MAAA,CAAOR,KAAA,IAASS,SAAA;IACzCP,KAAA,EAAOA,KAAA,KAAU,SAAS,OAAOO,SAAA;IACjCX;EACF;EAEA,OAAOY,QAAA,CAASC,IAAI,CAClB;IACE,GAAGJ,MAAM;IACTK,OAAA,EAASd,GAAA,CAAIe,CAAC,CAAC;EACjB,GACA;IACEC,OAAA,EAAStB,eAAA,CAAgB;MACvBsB,OAAA,EAAS,IAAIC,OAAA;MACbjB;IACF;IACAkB,MAAA,EAAQ3B,UAAA,CAAW4B;EACrB;AAEJ","ignoreList":[]}
1
+ {"version":3,"file":"restoreVersion.js","names":["httpStatus","restoreVersionOperation","isNumber","headersWithCors","sanitizeCollectionID","sanitizePopulate","restoreVersion","id","incomingID","collection","req","searchParams","depth","get","draft","collectionSlug","config","slug","payload","result","Number","undefined","populate","query","Response","json","message","t","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/restoreVersion.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { restoreVersionOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\nimport { sanitizePopulate } from '../utilities/sanitizePopulate.js'\n\nexport const restoreVersion: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const draft = searchParams.get('draft')\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const result = await restoreVersionOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: draft === 'true' ? true : undefined,\n populate: sanitizePopulate(req.query.populate),\n req,\n })\n\n return Response.json(\n {\n ...result,\n message: req.t('version:restoredSuccessfully'),\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,uBAAuB,QAAQ;AACxC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,gBAAgB,QAAQ;AAEjC,OAAO,MAAMC,cAAA,GAA+C,MAAAA,CAAO;EACjEC,EAAA,EAAIC,UAAU;EACdC,UAAU;EACVC;AAAG,CACJ;EACC,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAC/B,MAAMC,KAAA,GAAQH,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMN,EAAA,GAAKH,oBAAA,CAAqB;IAC9BG,EAAA,EAAIC,UAAA;IACJO,cAAA,EAAgBN,UAAA,CAAWO,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASR,GAAA,CAAIQ;EACf;EAEA,MAAMC,MAAA,GAAS,MAAMlB,uBAAA,CAAwB;IAC3CM,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOV,QAAA,CAASU,KAAA,IAASQ,MAAA,CAAOR,KAAA,IAASS,SAAA;IACzCP,KAAA,EAAOA,KAAA,KAAU,SAAS,OAAOO,SAAA;IACjCC,QAAA,EAAUjB,gBAAA,CAAiBK,GAAA,CAAIa,KAAK,CAACD,QAAQ;IAC7CZ;EACF;EAEA,OAAOc,QAAA,CAASC,IAAI,CAClB;IACE,GAAGN,MAAM;IACTO,OAAA,EAAShB,GAAA,CAAIiB,CAAC,CAAC;EACjB,GACA;IACEC,OAAA,EAASzB,eAAA,CAAgB;MACvByB,OAAA,EAAS,IAAIC,OAAA;MACbnB;IACF;IACAoB,MAAA,EAAQ9B,UAAA,CAAW+B;EACrB;AAEJ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/update.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,MAAM,EAAE,sBA2DpB,CAAA"}
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/update.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAMzD,eAAO,MAAM,MAAM,EAAE,sBAmEpB,CAAA"}
@@ -3,6 +3,8 @@ import httpStatus from 'http-status';
3
3
  import { updateOperation } from 'payload';
4
4
  import { isNumber } from 'payload/shared';
5
5
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
6
+ import { sanitizePopulate } from '../utilities/sanitizePopulate.js';
7
+ import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
6
8
  export const update = async ({
7
9
  collection,
8
10
  req
@@ -10,6 +12,10 @@ export const update = async ({
10
12
  const {
11
13
  depth,
12
14
  draft,
15
+ limit,
16
+ overrideLock,
17
+ populate,
18
+ select,
13
19
  where
14
20
  } = req.query;
15
21
  const result = await updateOperation({
@@ -17,7 +23,11 @@ export const update = async ({
17
23
  data: req.data,
18
24
  depth: isNumber(depth) ? Number(depth) : undefined,
19
25
  draft: draft === 'true',
26
+ limit: isNumber(limit) ? Number(limit) : undefined,
27
+ overrideLock: Boolean(overrideLock === 'true'),
28
+ populate: sanitizePopulate(populate),
20
29
  req,
30
+ select: sanitizeSelect(select),
21
31
  where
22
32
  });
23
33
  const headers = headersWithCors({
@@ -1 +1 @@
1
- {"version":3,"file":"update.js","names":["getTranslation","httpStatus","updateOperation","isNumber","headersWithCors","update","collection","req","depth","draft","where","query","result","data","Number","undefined","headers","Headers","errors","length","message","t","count","docs","label","config","labels","i18n","Response","json","status","OK","total","BAD_REQUEST"],"sources":["../../../../src/routes/rest/collections/update.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport httpStatus from 'http-status'\nimport { updateOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const update: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, draft, where } = req.query as {\n depth?: string\n draft?: string\n where?: Where\n }\n\n const result = await updateOperation({\n collection,\n data: req.data,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: draft === 'true',\n req,\n where,\n })\n\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n if (result.errors.length === 0) {\n const message = req.t('general:updatedCountSuccessfully', {\n count: result.docs.length,\n label: getTranslation(\n collection.config.labels[result.docs.length > 1 ? 'plural' : 'singular'],\n req.i18n,\n ),\n })\n\n return Response.json(\n {\n ...result,\n message,\n },\n {\n headers,\n status: httpStatus.OK,\n },\n )\n }\n\n const total = result.docs.length + result.errors.length\n const message = req.t('error:unableToUpdateCount', {\n count: result.errors.length,\n label: getTranslation(collection.config.labels[total > 1 ? 'plural' : 'singular'], req.i18n),\n total,\n })\n\n return Response.json(\n {\n ...result,\n message,\n },\n {\n headers,\n status: httpStatus.BAD_REQUEST,\n },\n )\n}\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,UAAA,MAAgB;AACvB,SAASC,eAAe,QAAQ;AAChC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,MAAA,GAAiC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACtE,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC;EAAK,CAAE,GAAGH,GAAA,CAAII,KAAK;EAMzC,MAAMC,MAAA,GAAS,MAAMV,eAAA,CAAgB;IACnCI,UAAA;IACAO,IAAA,EAAMN,GAAA,CAAIM,IAAI;IACdL,KAAA,EAAOL,QAAA,CAASK,KAAA,IAASM,MAAA,CAAON,KAAA,IAASO,SAAA;IACzCN,KAAA,EAAOA,KAAA,KAAU;IACjBF,GAAA;IACAG;EACF;EAEA,MAAMM,OAAA,GAAUZ,eAAA,CAAgB;IAC9BY,OAAA,EAAS,IAAIC,OAAA;IACbV;EACF;EAEA,IAAIK,MAAA,CAAOM,MAAM,CAACC,MAAM,KAAK,GAAG;IAC9B,MAAMC,OAAA,GAAUb,GAAA,CAAIc,CAAC,CAAC,oCAAoC;MACxDC,KAAA,EAAOV,MAAA,CAAOW,IAAI,CAACJ,MAAM;MACzBK,KAAA,EAAOxB,cAAA,CACLM,UAAA,CAAWmB,MAAM,CAACC,MAAM,CAACd,MAAA,CAAOW,IAAI,CAACJ,MAAM,GAAG,IAAI,WAAW,WAAW,EACxEZ,GAAA,CAAIoB,IAAI;IAEZ;IAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;MACE,GAAGjB,MAAM;MACTQ;IACF,GACA;MACEJ,OAAA;MACAc,MAAA,EAAQ7B,UAAA,CAAW8B;IACrB;EAEJ;EAEA,MAAMC,KAAA,GAAQpB,MAAA,CAAOW,IAAI,CAACJ,MAAM,GAAGP,MAAA,CAAOM,MAAM,CAACC,MAAM;EACvD,MAAMC,OAAA,GAAUb,GAAA,CAAIc,CAAC,CAAC,6BAA6B;IACjDC,KAAA,EAAOV,MAAA,CAAOM,MAAM,CAACC,MAAM;IAC3BK,KAAA,EAAOxB,cAAA,CAAeM,UAAA,CAAWmB,MAAM,CAACC,MAAM,CAACM,KAAA,GAAQ,IAAI,WAAW,WAAW,EAAEzB,GAAA,CAAIoB,IAAI;IAC3FK;EACF;EAEA,OAAOJ,QAAA,CAASC,IAAI,CAClB;IACE,GAAGjB,MAAM;IACTQ;EACF,GACA;IACEJ,OAAA;IACAc,MAAA,EAAQ7B,UAAA,CAAWgC;EACrB;AAEJ","ignoreList":[]}
1
+ {"version":3,"file":"update.js","names":["getTranslation","httpStatus","updateOperation","isNumber","headersWithCors","sanitizePopulate","sanitizeSelect","update","collection","req","depth","draft","limit","overrideLock","populate","select","where","query","result","data","Number","undefined","Boolean","headers","Headers","errors","length","message","t","count","docs","label","config","labels","i18n","Response","json","status","OK","total","BAD_REQUEST"],"sources":["../../../../src/routes/rest/collections/update.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport httpStatus from 'http-status'\nimport { updateOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizePopulate } from '../utilities/sanitizePopulate.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const update: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, draft, limit, overrideLock, populate, select, where } = req.query as {\n depth?: string\n draft?: string\n limit?: string\n overrideLock?: string\n populate?: Record<string, unknown>\n select?: Record<string, unknown>\n where?: Where\n }\n\n const result = await updateOperation({\n collection,\n data: req.data,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: draft === 'true',\n limit: isNumber(limit) ? Number(limit) : undefined,\n overrideLock: Boolean(overrideLock === 'true'),\n populate: sanitizePopulate(populate),\n req,\n select: sanitizeSelect(select),\n where,\n })\n\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n if (result.errors.length === 0) {\n const message = req.t('general:updatedCountSuccessfully', {\n count: result.docs.length,\n label: getTranslation(\n collection.config.labels[result.docs.length > 1 ? 'plural' : 'singular'],\n req.i18n,\n ),\n })\n\n return Response.json(\n {\n ...result,\n message,\n },\n {\n headers,\n status: httpStatus.OK,\n },\n )\n }\n\n const total = result.docs.length + result.errors.length\n const message = req.t('error:unableToUpdateCount', {\n count: result.errors.length,\n label: getTranslation(collection.config.labels[total > 1 ? 'plural' : 'singular'], req.i18n),\n total,\n })\n\n return Response.json(\n {\n ...result,\n message,\n },\n {\n headers,\n status: httpStatus.BAD_REQUEST,\n },\n )\n}\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,UAAA,MAAgB;AACvB,SAASC,eAAe,QAAQ;AAChC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,MAAA,GAAiC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACtE,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,KAAK;IAAEC,YAAY;IAAEC,QAAQ;IAAEC,MAAM;IAAEC;EAAK,CAAE,GAAGP,GAAA,CAAIQ,KAAK;EAUhF,MAAMC,MAAA,GAAS,MAAMhB,eAAA,CAAgB;IACnCM,UAAA;IACAW,IAAA,EAAMV,GAAA,CAAIU,IAAI;IACdT,KAAA,EAAOP,QAAA,CAASO,KAAA,IAASU,MAAA,CAAOV,KAAA,IAASW,SAAA;IACzCV,KAAA,EAAOA,KAAA,KAAU;IACjBC,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASQ,MAAA,CAAOR,KAAA,IAASS,SAAA;IACzCR,YAAA,EAAcS,OAAA,CAAQT,YAAA,KAAiB;IACvCC,QAAA,EAAUT,gBAAA,CAAiBS,QAAA;IAC3BL,GAAA;IACAM,MAAA,EAAQT,cAAA,CAAeS,MAAA;IACvBC;EACF;EAEA,MAAMO,OAAA,GAAUnB,eAAA,CAAgB;IAC9BmB,OAAA,EAAS,IAAIC,OAAA;IACbf;EACF;EAEA,IAAIS,MAAA,CAAOO,MAAM,CAACC,MAAM,KAAK,GAAG;IAC9B,MAAMC,OAAA,GAAUlB,GAAA,CAAImB,CAAC,CAAC,oCAAoC;MACxDC,KAAA,EAAOX,MAAA,CAAOY,IAAI,CAACJ,MAAM;MACzBK,KAAA,EAAO/B,cAAA,CACLQ,UAAA,CAAWwB,MAAM,CAACC,MAAM,CAACf,MAAA,CAAOY,IAAI,CAACJ,MAAM,GAAG,IAAI,WAAW,WAAW,EACxEjB,GAAA,CAAIyB,IAAI;IAEZ;IAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;MACE,GAAGlB,MAAM;MACTS;IACF,GACA;MACEJ,OAAA;MACAc,MAAA,EAAQpC,UAAA,CAAWqC;IACrB;EAEJ;EAEA,MAAMC,KAAA,GAAQrB,MAAA,CAAOY,IAAI,CAACJ,MAAM,GAAGR,MAAA,CAAOO,MAAM,CAACC,MAAM;EACvD,MAAMC,OAAA,GAAUlB,GAAA,CAAImB,CAAC,CAAC,6BAA6B;IACjDC,KAAA,EAAOX,MAAA,CAAOO,MAAM,CAACC,MAAM;IAC3BK,KAAA,EAAO/B,cAAA,CAAeQ,UAAA,CAAWwB,MAAM,CAACC,MAAM,CAACM,KAAA,GAAQ,IAAI,WAAW,WAAW,EAAE9B,GAAA,CAAIyB,IAAI;IAC3FK;EACF;EAEA,OAAOJ,QAAA,CAASC,IAAI,CAClB;IACE,GAAGlB,MAAM;IACTS;EACF,GACA;IACEJ,OAAA;IACAc,MAAA,EAAQpC,UAAA,CAAWuC;EACrB;AAEJ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"updateByID.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/updateByID.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAK/D,eAAO,MAAM,UAAU,EAAE,4BA4CxB,CAAA"}
1
+ {"version":3,"file":"updateByID.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/updateByID.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAO/D,eAAO,MAAM,UAAU,EAAE,4BAsDxB,CAAA"}
@@ -3,6 +3,8 @@ import { updateByIDOperation } from 'payload';
3
3
  import { isNumber } from 'payload/shared';
4
4
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
5
5
  import { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js';
6
+ import { sanitizePopulate } from '../utilities/sanitizePopulate.js';
7
+ import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
6
8
  export const updateByID = async ({
7
9
  id: incomingID,
8
10
  collection,
@@ -14,6 +16,8 @@ export const updateByID = async ({
14
16
  const depth = searchParams.get('depth');
15
17
  const autosave = searchParams.get('autosave') === 'true';
16
18
  const draft = searchParams.get('draft') === 'true';
19
+ const overrideLock = searchParams.get('overrideLock');
20
+ const publishSpecificLocale = req.query.publishSpecificLocale;
17
21
  const id = sanitizeCollectionID({
18
22
  id: incomingID,
19
23
  collectionSlug: collection.config.slug,
@@ -26,11 +30,19 @@ export const updateByID = async ({
26
30
  data: req.data,
27
31
  depth: isNumber(depth) ? Number(depth) : undefined,
28
32
  draft,
29
- req
33
+ overrideLock: Boolean(overrideLock === 'true'),
34
+ populate: sanitizePopulate(req.query.populate),
35
+ publishSpecificLocale,
36
+ req,
37
+ select: sanitizeSelect(req.query.select)
30
38
  });
31
39
  let message = req.t('general:updatedSuccessfully');
32
- if (draft) message = req.t('version:draftSavedSuccessfully');
33
- if (autosave) message = req.t('version:autosavedSuccessfully');
40
+ if (draft) {
41
+ message = req.t('version:draftSavedSuccessfully');
42
+ }
43
+ if (autosave) {
44
+ message = req.t('version:autosavedSuccessfully');
45
+ }
34
46
  return Response.json({
35
47
  doc,
36
48
  message
@@ -1 +1 @@
1
- {"version":3,"file":"updateByID.js","names":["httpStatus","updateByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","updateByID","id","incomingID","collection","req","searchParams","depth","get","autosave","draft","collectionSlug","config","slug","payload","doc","data","Number","undefined","message","t","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/updateByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { updateByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\n\nexport const updateByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const autosave = searchParams.get('autosave') === 'true'\n const draft = searchParams.get('draft') === 'true'\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const doc = await updateByIDOperation({\n id,\n autosave,\n collection,\n data: req.data,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft,\n req,\n })\n\n let message = req.t('general:updatedSuccessfully')\n\n if (draft) message = req.t('version:draftSavedSuccessfully')\n if (autosave) message = req.t('version:autosavedSuccessfully')\n\n return Response.json(\n {\n doc,\n message,\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,mBAAmB,QAAQ;AACpC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AAErC,OAAO,MAAMC,UAAA,GAA2C,MAAAA,CAAO;EAC7DC,EAAA,EAAIC,UAAU;EACdC,UAAU;EACVC;AAAG,CACJ;EACC,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAC/B,MAAMC,QAAA,GAAWH,YAAA,CAAaE,GAAG,CAAC,gBAAgB;EAClD,MAAME,KAAA,GAAQJ,YAAA,CAAaE,GAAG,CAAC,aAAa;EAE5C,MAAMN,EAAA,GAAKF,oBAAA,CAAqB;IAC9BE,EAAA,EAAIC,UAAA;IACJQ,cAAA,EAAgBP,UAAA,CAAWQ,MAAM,CAACC,IAAI;IACtCC,OAAA,EAAST,GAAA,CAAIS;EACf;EAEA,MAAMC,GAAA,GAAM,MAAMlB,mBAAA,CAAoB;IACpCK,EAAA;IACAO,QAAA;IACAL,UAAA;IACAY,IAAA,EAAMX,GAAA,CAAIW,IAAI;IACdT,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASU,MAAA,CAAOV,KAAA,IAASW,SAAA;IACzCR,KAAA;IACAL;EACF;EAEA,IAAIc,OAAA,GAAUd,GAAA,CAAIe,CAAC,CAAC;EAEpB,IAAIV,KAAA,EAAOS,OAAA,GAAUd,GAAA,CAAIe,CAAC,CAAC;EAC3B,IAAIX,QAAA,EAAUU,OAAA,GAAUd,GAAA,CAAIe,CAAC,CAAC;EAE9B,OAAOC,QAAA,CAASC,IAAI,CAClB;IACEP,GAAA;IACAI;EACF,GACA;IACEI,OAAA,EAASxB,eAAA,CAAgB;MACvBwB,OAAA,EAAS,IAAIC,OAAA;MACbnB;IACF;IACAoB,MAAA,EAAQ7B,UAAA,CAAW8B;EACrB;AAEJ","ignoreList":[]}
1
+ {"version":3,"file":"updateByID.js","names":["httpStatus","updateByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","sanitizePopulate","sanitizeSelect","updateByID","id","incomingID","collection","req","searchParams","depth","get","autosave","draft","overrideLock","publishSpecificLocale","query","collectionSlug","config","slug","payload","doc","data","Number","undefined","Boolean","populate","select","message","t","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/updateByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { updateByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\nimport { sanitizePopulate } from '../utilities/sanitizePopulate.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const updateByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const autosave = searchParams.get('autosave') === 'true'\n const draft = searchParams.get('draft') === 'true'\n const overrideLock = searchParams.get('overrideLock')\n const publishSpecificLocale = req.query.publishSpecificLocale as string | undefined\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const doc = await updateByIDOperation({\n id,\n autosave,\n collection,\n data: req.data,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft,\n overrideLock: Boolean(overrideLock === 'true'),\n populate: sanitizePopulate(req.query.populate),\n publishSpecificLocale,\n req,\n select: sanitizeSelect(req.query.select),\n })\n\n let message = req.t('general:updatedSuccessfully')\n\n if (draft) {\n message = req.t('version:draftSavedSuccessfully')\n }\n if (autosave) {\n message = req.t('version:autosavedSuccessfully')\n }\n\n return Response.json(\n {\n doc,\n message,\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,mBAAmB,QAAQ;AACpC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,UAAA,GAA2C,MAAAA,CAAO;EAC7DC,EAAA,EAAIC,UAAU;EACdC,UAAU;EACVC;AAAG,CACJ;EACC,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAC/B,MAAMC,QAAA,GAAWH,YAAA,CAAaE,GAAG,CAAC,gBAAgB;EAClD,MAAME,KAAA,GAAQJ,YAAA,CAAaE,GAAG,CAAC,aAAa;EAC5C,MAAMG,YAAA,GAAeL,YAAA,CAAaE,GAAG,CAAC;EACtC,MAAMI,qBAAA,GAAwBP,GAAA,CAAIQ,KAAK,CAACD,qBAAqB;EAE7D,MAAMV,EAAA,GAAKJ,oBAAA,CAAqB;IAC9BI,EAAA,EAAIC,UAAA;IACJW,cAAA,EAAgBV,UAAA,CAAWW,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASZ,GAAA,CAAIY;EACf;EAEA,MAAMC,GAAA,GAAM,MAAMvB,mBAAA,CAAoB;IACpCO,EAAA;IACAO,QAAA;IACAL,UAAA;IACAe,IAAA,EAAMd,GAAA,CAAIc,IAAI;IACdZ,KAAA,EAAOX,QAAA,CAASW,KAAA,IAASa,MAAA,CAAOb,KAAA,IAASc,SAAA;IACzCX,KAAA;IACAC,YAAA,EAAcW,OAAA,CAAQX,YAAA,KAAiB;IACvCY,QAAA,EAAUxB,gBAAA,CAAiBM,GAAA,CAAIQ,KAAK,CAACU,QAAQ;IAC7CX,qBAAA;IACAP,GAAA;IACAmB,MAAA,EAAQxB,cAAA,CAAeK,GAAA,CAAIQ,KAAK,CAACW,MAAM;EACzC;EAEA,IAAIC,OAAA,GAAUpB,GAAA,CAAIqB,CAAC,CAAC;EAEpB,IAAIhB,KAAA,EAAO;IACTe,OAAA,GAAUpB,GAAA,CAAIqB,CAAC,CAAC;EAClB;EACA,IAAIjB,QAAA,EAAU;IACZgB,OAAA,GAAUpB,GAAA,CAAIqB,CAAC,CAAC;EAClB;EAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;IACEV,GAAA;IACAO;EACF,GACA;IACEI,OAAA,EAAShC,eAAA,CAAgB;MACvBgC,OAAA,EAAS,IAAIC,OAAA;MACbzB;IACF;IACA0B,MAAA,EAAQrC,UAAA,CAAWsC;EACrB;AAEJ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"checkFileAccess.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/files/checkFileAccess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAS,MAAM,SAAS,CAAA;AAM5E,wBAAsB,eAAe,CAAC,EACpC,UAAU,EACV,QAAQ,EACR,GAAG,GACJ,EAAE;IACD,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,cAAc,CAAA;CACpB,GAAG,OAAO,CAAC,QAAQ,GAAG,UAAU,CAAC,CA6CjC"}
1
+ {"version":3,"file":"checkFileAccess.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/files/checkFileAccess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAS,MAAM,SAAS,CAAA;AAM5E,wBAAsB,eAAe,CAAC,EACpC,UAAU,EACV,QAAQ,EACR,GAAG,GACJ,EAAE;IACD,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,cAAc,CAAA;CACpB,GAAG,OAAO,CAAC,QAAQ,GAAG,UAAU,CAAC,CAmDjC"}
@@ -1,4 +1,4 @@
1
- import { Forbidden, executeAccess } from 'payload';
1
+ import { executeAccess, Forbidden } from 'payload';
2
2
  import { endpointsAreDisabled } from '../checkEndpoints.js';
3
3
  export async function checkFileAccess({
4
4
  collection,
@@ -12,7 +12,12 @@ export async function checkFileAccess({
12
12
  endpoints: config.endpoints,
13
13
  request: req
14
14
  });
15
- if (disableEndpoints) return disableEndpoints;
15
+ if (disableEndpoints) {
16
+ return disableEndpoints;
17
+ }
18
+ if (filename.includes('../') || filename.includes('..\\')) {
19
+ throw new Forbidden(req.t);
20
+ }
16
21
  const accessResult = await executeAccess({
17
22
  isReadingStaticFile: true,
18
23
  req
@@ -1 +1 @@
1
- {"version":3,"file":"checkFileAccess.js","names":["Forbidden","executeAccess","endpointsAreDisabled","checkFileAccess","collection","filename","req","config","disableEndpoints","endpoints","request","accessResult","isReadingStaticFile","access","read","queryToBuild","and","or","equals","upload","imageSizes","forEach","name","push","doc","payload","db","findOne","slug","where","t"],"sources":["../../../../src/routes/rest/files/checkFileAccess.ts"],"sourcesContent":["import type { Collection, PayloadRequest, TypeWithID, Where } from 'payload'\n\nimport { Forbidden, executeAccess } from 'payload'\n\nimport { endpointsAreDisabled } from '../checkEndpoints.js'\n\nexport async function checkFileAccess({\n collection,\n filename,\n req,\n}: {\n collection: Collection\n filename: string\n req: PayloadRequest\n}): Promise<Response | TypeWithID> {\n const { config } = collection\n const disableEndpoints = endpointsAreDisabled({ endpoints: config.endpoints, request: req })\n if (disableEndpoints) return disableEndpoints\n\n const accessResult = await executeAccess({ isReadingStaticFile: true, req }, config.access.read)\n\n if (typeof accessResult === 'object') {\n const queryToBuild: Where = {\n and: [\n {\n or: [\n {\n filename: {\n equals: filename,\n },\n },\n ],\n },\n accessResult,\n ],\n }\n\n if (config.upload.imageSizes) {\n config.upload.imageSizes.forEach(({ name }) => {\n queryToBuild.and[0].or.push({\n [`sizes.${name}.filename`]: {\n equals: filename,\n },\n })\n })\n }\n\n const doc = await req.payload.db.findOne({\n collection: config.slug,\n req,\n where: queryToBuild,\n })\n\n if (!doc) {\n throw new Forbidden(req.t)\n }\n\n return doc\n }\n}\n"],"mappings":"AAEA,SAASA,SAAS,EAAEC,aAAa,QAAQ;AAEzC,SAASC,oBAAoB,QAAQ;AAErC,OAAO,eAAeC,gBAAgB;EACpCC,UAAU;EACVC,QAAQ;EACRC;AAAG,CAKJ;EACC,MAAM;IAAEC;EAAM,CAAE,GAAGH,UAAA;EACnB,MAAMI,gBAAA,GAAmBN,oBAAA,CAAqB;IAAEO,SAAA,EAAWF,MAAA,CAAOE,SAAS;IAAEC,OAAA,EAASJ;EAAI;EAC1F,IAAIE,gBAAA,EAAkB,OAAOA,gBAAA;EAE7B,MAAMG,YAAA,GAAe,MAAMV,aAAA,CAAc;IAAEW,mBAAA,EAAqB;IAAMN;EAAI,GAAGC,MAAA,CAAOM,MAAM,CAACC,IAAI;EAE/F,IAAI,OAAOH,YAAA,KAAiB,UAAU;IACpC,MAAMI,YAAA,GAAsB;MAC1BC,GAAA,EAAK,CACH;QACEC,EAAA,EAAI,CACF;UACEZ,QAAA,EAAU;YACRa,MAAA,EAAQb;UACV;QACF;MAEJ,GACAM,YAAA;IAEJ;IAEA,IAAIJ,MAAA,CAAOY,MAAM,CAACC,UAAU,EAAE;MAC5Bb,MAAA,CAAOY,MAAM,CAACC,UAAU,CAACC,OAAO,CAAC,CAAC;QAAEC;MAAI,CAAE;QACxCP,YAAA,CAAaC,GAAG,CAAC,EAAE,CAACC,EAAE,CAACM,IAAI,CAAC;UAC1B,CAAC,SAASD,IAAA,WAAe,GAAG;YAC1BJ,MAAA,EAAQb;UACV;QACF;MACF;IACF;IAEA,MAAMmB,GAAA,GAAM,MAAMlB,GAAA,CAAImB,OAAO,CAACC,EAAE,CAACC,OAAO,CAAC;MACvCvB,UAAA,EAAYG,MAAA,CAAOqB,IAAI;MACvBtB,GAAA;MACAuB,KAAA,EAAOd;IACT;IAEA,IAAI,CAACS,GAAA,EAAK;MACR,MAAM,IAAIxB,SAAA,CAAUM,GAAA,CAAIwB,CAAC;IAC3B;IAEA,OAAON,GAAA;EACT;AACF","ignoreList":[]}
1
+ {"version":3,"file":"checkFileAccess.js","names":["executeAccess","Forbidden","endpointsAreDisabled","checkFileAccess","collection","filename","req","config","disableEndpoints","endpoints","request","includes","t","accessResult","isReadingStaticFile","access","read","queryToBuild","and","or","equals","upload","imageSizes","forEach","name","push","doc","payload","db","findOne","slug","where"],"sources":["../../../../src/routes/rest/files/checkFileAccess.ts"],"sourcesContent":["import type { Collection, PayloadRequest, TypeWithID, Where } from 'payload'\n\nimport { executeAccess, Forbidden } from 'payload'\n\nimport { endpointsAreDisabled } from '../checkEndpoints.js'\n\nexport async function checkFileAccess({\n collection,\n filename,\n req,\n}: {\n collection: Collection\n filename: string\n req: PayloadRequest\n}): Promise<Response | TypeWithID> {\n const { config } = collection\n const disableEndpoints = endpointsAreDisabled({ endpoints: config.endpoints, request: req })\n if (disableEndpoints) {\n return disableEndpoints\n }\n\n if (filename.includes('../') || filename.includes('..\\\\')) {\n throw new Forbidden(req.t)\n }\n\n const accessResult = await executeAccess({ isReadingStaticFile: true, req }, config.access.read)\n\n if (typeof accessResult === 'object') {\n const queryToBuild: Where = {\n and: [\n {\n or: [\n {\n filename: {\n equals: filename,\n },\n },\n ],\n },\n accessResult,\n ],\n }\n\n if (config.upload.imageSizes) {\n config.upload.imageSizes.forEach(({ name }) => {\n queryToBuild.and[0].or.push({\n [`sizes.${name}.filename`]: {\n equals: filename,\n },\n })\n })\n }\n\n const doc = await req.payload.db.findOne({\n collection: config.slug,\n req,\n where: queryToBuild,\n })\n\n if (!doc) {\n throw new Forbidden(req.t)\n }\n\n return doc\n }\n}\n"],"mappings":"AAEA,SAASA,aAAa,EAAEC,SAAS,QAAQ;AAEzC,SAASC,oBAAoB,QAAQ;AAErC,OAAO,eAAeC,gBAAgB;EACpCC,UAAU;EACVC,QAAQ;EACRC;AAAG,CAKJ;EACC,MAAM;IAAEC;EAAM,CAAE,GAAGH,UAAA;EACnB,MAAMI,gBAAA,GAAmBN,oBAAA,CAAqB;IAAEO,SAAA,EAAWF,MAAA,CAAOE,SAAS;IAAEC,OAAA,EAASJ;EAAI;EAC1F,IAAIE,gBAAA,EAAkB;IACpB,OAAOA,gBAAA;EACT;EAEA,IAAIH,QAAA,CAASM,QAAQ,CAAC,UAAUN,QAAA,CAASM,QAAQ,CAAC,SAAS;IACzD,MAAM,IAAIV,SAAA,CAAUK,GAAA,CAAIM,CAAC;EAC3B;EAEA,MAAMC,YAAA,GAAe,MAAMb,aAAA,CAAc;IAAEc,mBAAA,EAAqB;IAAMR;EAAI,GAAGC,MAAA,CAAOQ,MAAM,CAACC,IAAI;EAE/F,IAAI,OAAOH,YAAA,KAAiB,UAAU;IACpC,MAAMI,YAAA,GAAsB;MAC1BC,GAAA,EAAK,CACH;QACEC,EAAA,EAAI,CACF;UACEd,QAAA,EAAU;YACRe,MAAA,EAAQf;UACV;QACF;MAEJ,GACAQ,YAAA;IAEJ;IAEA,IAAIN,MAAA,CAAOc,MAAM,CAACC,UAAU,EAAE;MAC5Bf,MAAA,CAAOc,MAAM,CAACC,UAAU,CAACC,OAAO,CAAC,CAAC;QAAEC;MAAI,CAAE;QACxCP,YAAA,CAAaC,GAAG,CAAC,EAAE,CAACC,EAAE,CAACM,IAAI,CAAC;UAC1B,CAAC,SAASD,IAAA,WAAe,GAAG;YAC1BJ,MAAA,EAAQf;UACV;QACF;MACF;IACF;IAEA,MAAMqB,GAAA,GAAM,MAAMpB,GAAA,CAAIqB,OAAO,CAACC,EAAE,CAACC,OAAO,CAAC;MACvCzB,UAAA,EAAYG,MAAA,CAAOuB,IAAI;MACvBxB,GAAA;MACAyB,KAAA,EAAOd;IACT;IAEA,IAAI,CAACS,GAAA,EAAK;MACR,MAAM,IAAIzB,SAAA,CAAUK,GAAA,CAAIM,CAAC;IAC3B;IAEA,OAAOc,GAAA;EACT;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"getFile.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/files/getFile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAezD,KAAK,IAAI,GAAG;IACV,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AACD,eAAO,MAAM,OAAO,kCAAyC,IAAI,KAAG,OAAO,CAAC,QAAQ,CA4DnF,CAAA"}
1
+ {"version":3,"file":"getFile.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/files/getFile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAezD,KAAK,IAAI,GAAG;IACV,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AACD,eAAO,MAAM,OAAO,kCAAyC,IAAI,KAAG,OAAO,CAAC,QAAQ,CAgEnF,CAAA"}
@@ -22,7 +22,9 @@ export const getFile = async ({
22
22
  filename,
23
23
  req
24
24
  });
25
- if (accessResult instanceof Response) return accessResult;
25
+ if (accessResult instanceof Response) {
26
+ return accessResult;
27
+ }
26
28
  if (collection.config.upload.handlers?.length) {
27
29
  let customResponse = null;
28
30
  for (const handler of collection.config.upload.handlers) {
@@ -34,7 +36,9 @@ export const getFile = async ({
34
36
  }
35
37
  });
36
38
  }
37
- if (customResponse instanceof Response) return customResponse;
39
+ if (customResponse instanceof Response) {
40
+ return customResponse;
41
+ }
38
42
  }
39
43
  const fileDir = collection.config.upload?.staticDir || collection.config.slug;
40
44
  const filePath = path.resolve(`${fileDir}/${filename}`);
@@ -1 +1 @@
1
- {"version":3,"file":"getFile.js","names":["fileTypeFromFile","fsPromises","httpStatus","path","APIError","streamFile","headersWithCors","routeError","checkFileAccess","getFileTypeFallback","getFile","collection","filename","req","config","upload","slug","BAD_REQUEST","accessResult","Response","handlers","length","customResponse","handler","doc","params","fileDir","staticDir","filePath","resolve","stats","stat","data","fileTypeResult","headers","Headers","set","mime","size","modifyResponseHeaders","status","OK","err","payload"],"sources":["../../../../src/routes/rest/files/getFile.ts"],"sourcesContent":["import type { Collection, PayloadRequest } from 'payload'\n\nimport { fileTypeFromFile } from 'file-type'\nimport fsPromises from 'fs/promises'\nimport httpStatus from 'http-status'\nimport path from 'path'\nimport { APIError } from 'payload'\n\nimport { streamFile } from '../../../fetchAPI-stream-file/index.js'\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { routeError } from '../routeError.js'\nimport { checkFileAccess } from './checkFileAccess.js'\nimport { getFileTypeFallback } from './getFileTypeFallback.js'\n\n// /:collectionSlug/file/:filename\ntype Args = {\n collection: Collection\n filename: string\n req: PayloadRequest\n}\nexport const getFile = async ({ collection, filename, req }: Args): Promise<Response> => {\n try {\n if (!collection.config.upload) {\n throw new APIError(\n `This collection is not an upload collection: ${collection.config.slug}`,\n httpStatus.BAD_REQUEST,\n )\n }\n\n const accessResult = await checkFileAccess({\n collection,\n filename,\n req,\n })\n\n if (accessResult instanceof Response) return accessResult\n\n if (collection.config.upload.handlers?.length) {\n let customResponse = null\n for (const handler of collection.config.upload.handlers) {\n customResponse = await handler(req, {\n doc: accessResult,\n params: {\n collection: collection.config.slug,\n filename,\n },\n })\n }\n\n if (customResponse instanceof Response) return customResponse\n }\n\n const fileDir = collection.config.upload?.staticDir || collection.config.slug\n const filePath = path.resolve(`${fileDir}/${filename}`)\n const stats = await fsPromises.stat(filePath)\n const data = streamFile(filePath)\n const fileTypeResult = (await fileTypeFromFile(filePath)) || getFileTypeFallback(filePath)\n\n let headers = new Headers()\n headers.set('Content-Type', fileTypeResult.mime)\n headers.set('Content-Length', stats.size + '')\n headers = collection.config.upload?.modifyResponseHeaders\n ? collection.config.upload.modifyResponseHeaders({ headers })\n : headers\n\n return new Response(data, {\n headers: headersWithCors({\n headers,\n req,\n }),\n status: httpStatus.OK,\n })\n } catch (err) {\n return routeError({\n collection,\n config: req.payload.config,\n err,\n req,\n })\n }\n}\n"],"mappings":"AAEA,SAASA,gBAAgB,QAAQ;AACjC,OAAOC,UAAA,MAAgB;AACvB,OAAOC,UAAA,MAAgB;AACvB,OAAOC,IAAA,MAAU;AACjB,SAASC,QAAQ,QAAQ;AAEzB,SAASC,UAAU,QAAQ;AAC3B,SAASC,eAAe,QAAQ;AAChC,SAASC,UAAU,QAAQ;AAC3B,SAASC,eAAe,QAAQ;AAChC,SAASC,mBAAmB,QAAQ;AAQpC,OAAO,MAAMC,OAAA,GAAU,MAAAA,CAAO;EAAEC,UAAU;EAAEC,QAAQ;EAAEC;AAAG,CAAQ;EAC/D,IAAI;IACF,IAAI,CAACF,UAAA,CAAWG,MAAM,CAACC,MAAM,EAAE;MAC7B,MAAM,IAAIX,QAAA,CACR,gDAAgDO,UAAA,CAAWG,MAAM,CAACE,IAAI,EAAE,EACxEd,UAAA,CAAWe,WAAW;IAE1B;IAEA,MAAMC,YAAA,GAAe,MAAMV,eAAA,CAAgB;MACzCG,UAAA;MACAC,QAAA;MACAC;IACF;IAEA,IAAIK,YAAA,YAAwBC,QAAA,EAAU,OAAOD,YAAA;IAE7C,IAAIP,UAAA,CAAWG,MAAM,CAACC,MAAM,CAACK,QAAQ,EAAEC,MAAA,EAAQ;MAC7C,IAAIC,cAAA,GAAiB;MACrB,KAAK,MAAMC,OAAA,IAAWZ,UAAA,CAAWG,MAAM,CAACC,MAAM,CAACK,QAAQ,EAAE;QACvDE,cAAA,GAAiB,MAAMC,OAAA,CAAQV,GAAA,EAAK;UAClCW,GAAA,EAAKN,YAAA;UACLO,MAAA,EAAQ;YACNd,UAAA,EAAYA,UAAA,CAAWG,MAAM,CAACE,IAAI;YAClCJ;UACF;QACF;MACF;MAEA,IAAIU,cAAA,YAA0BH,QAAA,EAAU,OAAOG,cAAA;IACjD;IAEA,MAAMI,OAAA,GAAUf,UAAA,CAAWG,MAAM,CAACC,MAAM,EAAEY,SAAA,IAAahB,UAAA,CAAWG,MAAM,CAACE,IAAI;IAC7E,MAAMY,QAAA,GAAWzB,IAAA,CAAK0B,OAAO,CAAC,GAAGH,OAAA,IAAWd,QAAA,EAAU;IACtD,MAAMkB,KAAA,GAAQ,MAAM7B,UAAA,CAAW8B,IAAI,CAACH,QAAA;IACpC,MAAMI,IAAA,GAAO3B,UAAA,CAAWuB,QAAA;IACxB,MAAMK,cAAA,GAAiB,OAAOjC,gBAAA,CAAiB4B,QAAA,MAAcnB,mBAAA,CAAoBmB,QAAA;IAEjF,IAAIM,OAAA,GAAU,IAAIC,OAAA;IAClBD,OAAA,CAAQE,GAAG,CAAC,gBAAgBH,cAAA,CAAeI,IAAI;IAC/CH,OAAA,CAAQE,GAAG,CAAC,kBAAkBN,KAAA,CAAMQ,IAAI,GAAG;IAC3CJ,OAAA,GAAUvB,UAAA,CAAWG,MAAM,CAACC,MAAM,EAAEwB,qBAAA,GAChC5B,UAAA,CAAWG,MAAM,CAACC,MAAM,CAACwB,qBAAqB,CAAC;MAAEL;IAAQ,KACzDA,OAAA;IAEJ,OAAO,IAAIf,QAAA,CAASa,IAAA,EAAM;MACxBE,OAAA,EAAS5B,eAAA,CAAgB;QACvB4B,OAAA;QACArB;MACF;MACA2B,MAAA,EAAQtC,UAAA,CAAWuC;IACrB;EACF,EAAE,OAAOC,GAAA,EAAK;IACZ,OAAOnC,UAAA,CAAW;MAChBI,UAAA;MACAG,MAAA,EAAQD,GAAA,CAAI8B,OAAO,CAAC7B,MAAM;MAC1B4B,GAAA;MACA7B;IACF;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"getFile.js","names":["fileTypeFromFile","fsPromises","httpStatus","path","APIError","streamFile","headersWithCors","routeError","checkFileAccess","getFileTypeFallback","getFile","collection","filename","req","config","upload","slug","BAD_REQUEST","accessResult","Response","handlers","length","customResponse","handler","doc","params","fileDir","staticDir","filePath","resolve","stats","stat","data","fileTypeResult","headers","Headers","set","mime","size","modifyResponseHeaders","status","OK","err","payload"],"sources":["../../../../src/routes/rest/files/getFile.ts"],"sourcesContent":["import type { Collection, PayloadRequest } from 'payload'\n\nimport { fileTypeFromFile } from 'file-type'\nimport fsPromises from 'fs/promises'\nimport httpStatus from 'http-status'\nimport path from 'path'\nimport { APIError } from 'payload'\n\nimport { streamFile } from '../../../fetchAPI-stream-file/index.js'\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { routeError } from '../routeError.js'\nimport { checkFileAccess } from './checkFileAccess.js'\nimport { getFileTypeFallback } from './getFileTypeFallback.js'\n\n// /:collectionSlug/file/:filename\ntype Args = {\n collection: Collection\n filename: string\n req: PayloadRequest\n}\nexport const getFile = async ({ collection, filename, req }: Args): Promise<Response> => {\n try {\n if (!collection.config.upload) {\n throw new APIError(\n `This collection is not an upload collection: ${collection.config.slug}`,\n httpStatus.BAD_REQUEST,\n )\n }\n\n const accessResult = await checkFileAccess({\n collection,\n filename,\n req,\n })\n\n if (accessResult instanceof Response) {\n return accessResult\n }\n\n if (collection.config.upload.handlers?.length) {\n let customResponse = null\n for (const handler of collection.config.upload.handlers) {\n customResponse = await handler(req, {\n doc: accessResult,\n params: {\n collection: collection.config.slug,\n filename,\n },\n })\n }\n\n if (customResponse instanceof Response) {\n return customResponse\n }\n }\n\n const fileDir = collection.config.upload?.staticDir || collection.config.slug\n const filePath = path.resolve(`${fileDir}/${filename}`)\n const stats = await fsPromises.stat(filePath)\n const data = streamFile(filePath)\n const fileTypeResult = (await fileTypeFromFile(filePath)) || getFileTypeFallback(filePath)\n\n let headers = new Headers()\n headers.set('Content-Type', fileTypeResult.mime)\n headers.set('Content-Length', stats.size + '')\n headers = collection.config.upload?.modifyResponseHeaders\n ? collection.config.upload.modifyResponseHeaders({ headers })\n : headers\n\n return new Response(data, {\n headers: headersWithCors({\n headers,\n req,\n }),\n status: httpStatus.OK,\n })\n } catch (err) {\n return routeError({\n collection,\n config: req.payload.config,\n err,\n req,\n })\n }\n}\n"],"mappings":"AAEA,SAASA,gBAAgB,QAAQ;AACjC,OAAOC,UAAA,MAAgB;AACvB,OAAOC,UAAA,MAAgB;AACvB,OAAOC,IAAA,MAAU;AACjB,SAASC,QAAQ,QAAQ;AAEzB,SAASC,UAAU,QAAQ;AAC3B,SAASC,eAAe,QAAQ;AAChC,SAASC,UAAU,QAAQ;AAC3B,SAASC,eAAe,QAAQ;AAChC,SAASC,mBAAmB,QAAQ;AAQpC,OAAO,MAAMC,OAAA,GAAU,MAAAA,CAAO;EAAEC,UAAU;EAAEC,QAAQ;EAAEC;AAAG,CAAQ;EAC/D,IAAI;IACF,IAAI,CAACF,UAAA,CAAWG,MAAM,CAACC,MAAM,EAAE;MAC7B,MAAM,IAAIX,QAAA,CACR,gDAAgDO,UAAA,CAAWG,MAAM,CAACE,IAAI,EAAE,EACxEd,UAAA,CAAWe,WAAW;IAE1B;IAEA,MAAMC,YAAA,GAAe,MAAMV,eAAA,CAAgB;MACzCG,UAAA;MACAC,QAAA;MACAC;IACF;IAEA,IAAIK,YAAA,YAAwBC,QAAA,EAAU;MACpC,OAAOD,YAAA;IACT;IAEA,IAAIP,UAAA,CAAWG,MAAM,CAACC,MAAM,CAACK,QAAQ,EAAEC,MAAA,EAAQ;MAC7C,IAAIC,cAAA,GAAiB;MACrB,KAAK,MAAMC,OAAA,IAAWZ,UAAA,CAAWG,MAAM,CAACC,MAAM,CAACK,QAAQ,EAAE;QACvDE,cAAA,GAAiB,MAAMC,OAAA,CAAQV,GAAA,EAAK;UAClCW,GAAA,EAAKN,YAAA;UACLO,MAAA,EAAQ;YACNd,UAAA,EAAYA,UAAA,CAAWG,MAAM,CAACE,IAAI;YAClCJ;UACF;QACF;MACF;MAEA,IAAIU,cAAA,YAA0BH,QAAA,EAAU;QACtC,OAAOG,cAAA;MACT;IACF;IAEA,MAAMI,OAAA,GAAUf,UAAA,CAAWG,MAAM,CAACC,MAAM,EAAEY,SAAA,IAAahB,UAAA,CAAWG,MAAM,CAACE,IAAI;IAC7E,MAAMY,QAAA,GAAWzB,IAAA,CAAK0B,OAAO,CAAC,GAAGH,OAAA,IAAWd,QAAA,EAAU;IACtD,MAAMkB,KAAA,GAAQ,MAAM7B,UAAA,CAAW8B,IAAI,CAACH,QAAA;IACpC,MAAMI,IAAA,GAAO3B,UAAA,CAAWuB,QAAA;IACxB,MAAMK,cAAA,GAAiB,OAAOjC,gBAAA,CAAiB4B,QAAA,MAAcnB,mBAAA,CAAoBmB,QAAA;IAEjF,IAAIM,OAAA,GAAU,IAAIC,OAAA;IAClBD,OAAA,CAAQE,GAAG,CAAC,gBAAgBH,cAAA,CAAeI,IAAI;IAC/CH,OAAA,CAAQE,GAAG,CAAC,kBAAkBN,KAAA,CAAMQ,IAAI,GAAG;IAC3CJ,OAAA,GAAUvB,UAAA,CAAWG,MAAM,CAACC,MAAM,EAAEwB,qBAAA,GAChC5B,UAAA,CAAWG,MAAM,CAACC,MAAM,CAACwB,qBAAqB,CAAC;MAAEL;IAAQ,KACzDA,OAAA;IAEJ,OAAO,IAAIf,QAAA,CAASa,IAAA,EAAM;MACxBE,OAAA,EAAS5B,eAAA,CAAgB;QACvB4B,OAAA;QACArB;MACF;MACA2B,MAAA,EAAQtC,UAAA,CAAWuC;IACrB;EACF,EAAE,OAAOC,GAAA,EAAK;IACZ,OAAOnC,UAAA,CAAW;MAChBI,UAAA;MACAG,MAAA,EAAQD,GAAA,CAAI8B,OAAO,CAAC7B,MAAM;MAC1B4B,GAAA;MACA7B;IACF;EACF;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"findOne.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/globals/findOne.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAIrD,eAAO,MAAM,OAAO,EAAE,kBAmBrB,CAAA"}
1
+ {"version":3,"file":"findOne.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/globals/findOne.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAMrD,eAAO,MAAM,OAAO,EAAE,kBAqBrB,CAAA"}
@@ -2,6 +2,8 @@ import httpStatus from 'http-status';
2
2
  import { findOneOperation } from 'payload';
3
3
  import { isNumber } from 'payload/shared';
4
4
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
5
+ import { sanitizePopulate } from '../utilities/sanitizePopulate.js';
6
+ import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
5
7
  export const findOne = async ({
6
8
  globalConfig,
7
9
  req
@@ -15,7 +17,9 @@ export const findOne = async ({
15
17
  depth: isNumber(depth) ? Number(depth) : undefined,
16
18
  draft: searchParams.get('draft') === 'true',
17
19
  globalConfig,
18
- req
20
+ populate: sanitizePopulate(req.query.populate),
21
+ req,
22
+ select: sanitizeSelect(req.query.select)
19
23
  });
20
24
  return Response.json(result, {
21
25
  headers: headersWithCors({
@@ -1 +1 @@
1
- {"version":3,"file":"findOne.js","names":["httpStatus","findOneOperation","isNumber","headersWithCors","findOne","globalConfig","req","searchParams","depth","get","result","slug","Number","undefined","draft","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/findOne.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { findOneOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const findOne: GlobalRouteHandler = async ({ globalConfig, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const result = await findOneOperation({\n slug: globalConfig.slug,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: searchParams.get('draft') === 'true',\n globalConfig,\n req,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,gBAAgB,QAAQ;AACjC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,OAAA,GAA8B,MAAAA,CAAO;EAAEC,YAAY;EAAEC;AAAG,CAAE;EACrE,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMC,MAAA,GAAS,MAAMT,gBAAA,CAAiB;IACpCU,IAAA,EAAMN,YAAA,CAAaM,IAAI;IACvBH,KAAA,EAAON,QAAA,CAASM,KAAA,IAASI,MAAA,CAAOJ,KAAA,IAASK,SAAA;IACzCC,KAAA,EAAOP,YAAA,CAAaE,GAAG,CAAC,aAAa;IACrCJ,YAAA;IACAC;EACF;EAEA,OAAOS,QAAA,CAASC,IAAI,CAACN,MAAA,EAAQ;IAC3BO,OAAA,EAASd,eAAA,CAAgB;MACvBc,OAAA,EAAS,IAAIC,OAAA;MACbZ;IACF;IACAa,MAAA,EAAQnB,UAAA,CAAWoB;EACrB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"findOne.js","names":["httpStatus","findOneOperation","isNumber","headersWithCors","sanitizePopulate","sanitizeSelect","findOne","globalConfig","req","searchParams","depth","get","result","slug","Number","undefined","draft","populate","query","select","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/findOne.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { findOneOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizePopulate } from '../utilities/sanitizePopulate.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const findOne: GlobalRouteHandler = async ({ globalConfig, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const result = await findOneOperation({\n slug: globalConfig.slug,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: searchParams.get('draft') === 'true',\n globalConfig,\n populate: sanitizePopulate(req.query.populate),\n req,\n select: sanitizeSelect(req.query.select),\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,gBAAgB,QAAQ;AACjC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,OAAA,GAA8B,MAAAA,CAAO;EAAEC,YAAY;EAAEC;AAAG,CAAE;EACrE,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMC,MAAA,GAAS,MAAMX,gBAAA,CAAiB;IACpCY,IAAA,EAAMN,YAAA,CAAaM,IAAI;IACvBH,KAAA,EAAOR,QAAA,CAASQ,KAAA,IAASI,MAAA,CAAOJ,KAAA,IAASK,SAAA;IACzCC,KAAA,EAAOP,YAAA,CAAaE,GAAG,CAAC,aAAa;IACrCJ,YAAA;IACAU,QAAA,EAAUb,gBAAA,CAAiBI,GAAA,CAAIU,KAAK,CAACD,QAAQ;IAC7CT,GAAA;IACAW,MAAA,EAAQd,cAAA,CAAeG,GAAA,CAAIU,KAAK,CAACC,MAAM;EACzC;EAEA,OAAOC,QAAA,CAASC,IAAI,CAACT,MAAA,EAAQ;IAC3BU,OAAA,EAASnB,eAAA,CAAgB;MACvBmB,OAAA,EAAS,IAAIC,OAAA;MACbf;IACF;IACAgB,MAAA,EAAQxB,UAAA,CAAWyB;EACrB;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"findVersionByID.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/globals/findVersionByID.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAI3D,eAAO,MAAM,eAAe,EAAE,wBAkB7B,CAAA"}
1
+ {"version":3,"file":"findVersionByID.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/globals/findVersionByID.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAM3D,eAAO,MAAM,eAAe,EAAE,wBAoB7B,CAAA"}
@@ -2,6 +2,8 @@ import httpStatus from 'http-status';
2
2
  import { findVersionByIDOperationGlobal } from 'payload';
3
3
  import { isNumber } from 'payload/shared';
4
4
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
5
+ import { sanitizePopulate } from '../utilities/sanitizePopulate.js';
6
+ import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
5
7
  export const findVersionByID = async ({
6
8
  id,
7
9
  globalConfig,
@@ -15,7 +17,9 @@ export const findVersionByID = async ({
15
17
  id,
16
18
  depth: isNumber(depth) ? Number(depth) : undefined,
17
19
  globalConfig,
18
- req
20
+ populate: sanitizePopulate(req.query.populate),
21
+ req,
22
+ select: sanitizeSelect(req.query.select)
19
23
  });
20
24
  return Response.json(result, {
21
25
  headers: headersWithCors({
@@ -1 +1 @@
1
- {"version":3,"file":"findVersionByID.js","names":["httpStatus","findVersionByIDOperationGlobal","isNumber","headersWithCors","findVersionByID","id","globalConfig","req","searchParams","depth","get","result","Number","undefined","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/findVersionByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { findVersionByIDOperationGlobal } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const findVersionByID: GlobalRouteHandlerWithID = async ({ id, globalConfig, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const result = await findVersionByIDOperationGlobal({\n id,\n depth: isNumber(depth) ? Number(depth) : undefined,\n globalConfig,\n req,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,8BAA8B,QAAQ;AAC/C,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,eAAA,GAA4C,MAAAA,CAAO;EAAEC,EAAE;EAAEC,YAAY;EAAEC;AAAG,CAAE;EACvF,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMC,MAAA,GAAS,MAAMV,8BAAA,CAA+B;IAClDI,EAAA;IACAI,KAAA,EAAOP,QAAA,CAASO,KAAA,IAASG,MAAA,CAAOH,KAAA,IAASI,SAAA;IACzCP,YAAA;IACAC;EACF;EAEA,OAAOO,QAAA,CAASC,IAAI,CAACJ,MAAA,EAAQ;IAC3BK,OAAA,EAASb,eAAA,CAAgB;MACvBa,OAAA,EAAS,IAAIC,OAAA;MACbV;IACF;IACAW,MAAA,EAAQlB,UAAA,CAAWmB;EACrB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"findVersionByID.js","names":["httpStatus","findVersionByIDOperationGlobal","isNumber","headersWithCors","sanitizePopulate","sanitizeSelect","findVersionByID","id","globalConfig","req","searchParams","depth","get","result","Number","undefined","populate","query","select","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/findVersionByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { findVersionByIDOperationGlobal } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizePopulate } from '../utilities/sanitizePopulate.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const findVersionByID: GlobalRouteHandlerWithID = async ({ id, globalConfig, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const result = await findVersionByIDOperationGlobal({\n id,\n depth: isNumber(depth) ? Number(depth) : undefined,\n globalConfig,\n populate: sanitizePopulate(req.query.populate),\n req,\n select: sanitizeSelect(req.query.select),\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,8BAA8B,QAAQ;AAC/C,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,eAAA,GAA4C,MAAAA,CAAO;EAAEC,EAAE;EAAEC,YAAY;EAAEC;AAAG,CAAE;EACvF,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMC,MAAA,GAAS,MAAMZ,8BAAA,CAA+B;IAClDM,EAAA;IACAI,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASG,MAAA,CAAOH,KAAA,IAASI,SAAA;IACzCP,YAAA;IACAQ,QAAA,EAAUZ,gBAAA,CAAiBK,GAAA,CAAIQ,KAAK,CAACD,QAAQ;IAC7CP,GAAA;IACAS,MAAA,EAAQb,cAAA,CAAeI,GAAA,CAAIQ,KAAK,CAACC,MAAM;EACzC;EAEA,OAAOC,QAAA,CAASC,IAAI,CAACP,MAAA,EAAQ;IAC3BQ,OAAA,EAASlB,eAAA,CAAgB;MACvBkB,OAAA,EAAS,IAAIC,OAAA;MACbb;IACF;IACAc,MAAA,EAAQvB,UAAA,CAAWwB;EACrB;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"findVersions.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/globals/findVersions.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAIrD,eAAO,MAAM,YAAY,EAAE,kBA0B1B,CAAA"}
1
+ {"version":3,"file":"findVersions.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/globals/findVersions.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAMrD,eAAO,MAAM,YAAY,EAAE,kBA8B1B,CAAA"}
@@ -2,6 +2,8 @@ import httpStatus from 'http-status';
2
2
  import { findVersionsOperationGlobal } from 'payload';
3
3
  import { isNumber } from 'payload/shared';
4
4
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
5
+ import { sanitizePopulate } from '../utilities/sanitizePopulate.js';
6
+ import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
5
7
  export const findVersions = async ({
6
8
  globalConfig,
7
9
  req
@@ -10,6 +12,8 @@ export const findVersions = async ({
10
12
  depth,
11
13
  limit,
12
14
  page,
15
+ populate,
16
+ select,
13
17
  sort,
14
18
  where
15
19
  } = req.query;
@@ -18,8 +22,10 @@ export const findVersions = async ({
18
22
  globalConfig,
19
23
  limit: isNumber(limit) ? Number(limit) : undefined,
20
24
  page: isNumber(page) ? Number(page) : undefined,
25
+ populate: sanitizePopulate(populate),
21
26
  req,
22
- sort,
27
+ select: sanitizeSelect(select),
28
+ sort: typeof sort === 'string' ? sort.split(',') : undefined,
23
29
  where
24
30
  });
25
31
  return Response.json(result, {
@@ -1 +1 @@
1
- {"version":3,"file":"findVersions.js","names":["httpStatus","findVersionsOperationGlobal","isNumber","headersWithCors","findVersions","globalConfig","req","depth","limit","page","sort","where","query","result","Number","undefined","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/findVersions.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { findVersionsOperationGlobal } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const findVersions: GlobalRouteHandler = async ({ globalConfig, req }) => {\n const { depth, limit, page, sort, where } = req.query as {\n depth?: string\n limit?: string\n page?: string\n sort?: string\n where?: Where\n }\n\n const result = await findVersionsOperationGlobal({\n depth: isNumber(depth) ? Number(depth) : undefined,\n globalConfig,\n limit: isNumber(limit) ? Number(limit) : undefined,\n page: isNumber(page) ? Number(page) : undefined,\n req,\n sort,\n where,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,YAAA,GAAmC,MAAAA,CAAO;EAAEC,YAAY;EAAEC;AAAG,CAAE;EAC1E,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,IAAI;IAAEC,IAAI;IAAEC;EAAK,CAAE,GAAGL,GAAA,CAAIM,KAAK;EAQrD,MAAMC,MAAA,GAAS,MAAMZ,2BAAA,CAA4B;IAC/CM,KAAA,EAAOL,QAAA,CAASK,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCV,YAAA;IACAG,KAAA,EAAON,QAAA,CAASM,KAAA,IAASM,MAAA,CAAON,KAAA,IAASO,SAAA;IACzCN,IAAA,EAAMP,QAAA,CAASO,IAAA,IAAQK,MAAA,CAAOL,IAAA,IAAQM,SAAA;IACtCT,GAAA;IACAI,IAAA;IACAC;EACF;EAEA,OAAOK,QAAA,CAASC,IAAI,CAACJ,MAAA,EAAQ;IAC3BK,OAAA,EAASf,eAAA,CAAgB;MACvBe,OAAA,EAAS,IAAIC,OAAA;MACbb;IACF;IACAc,MAAA,EAAQpB,UAAA,CAAWqB;EACrB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"findVersions.js","names":["httpStatus","findVersionsOperationGlobal","isNumber","headersWithCors","sanitizePopulate","sanitizeSelect","findVersions","globalConfig","req","depth","limit","page","populate","select","sort","where","query","result","Number","undefined","split","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/findVersions.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { findVersionsOperationGlobal } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizePopulate } from '../utilities/sanitizePopulate.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const findVersions: GlobalRouteHandler = async ({ globalConfig, req }) => {\n const { depth, limit, page, populate, select, sort, where } = req.query as {\n depth?: string\n limit?: string\n page?: string\n populate?: Record<string, unknown>\n select?: Record<string, unknown>\n sort?: string\n where?: Where\n }\n\n const result = await findVersionsOperationGlobal({\n depth: isNumber(depth) ? Number(depth) : undefined,\n globalConfig,\n limit: isNumber(limit) ? Number(limit) : undefined,\n page: isNumber(page) ? Number(page) : undefined,\n populate: sanitizePopulate(populate),\n req,\n select: sanitizeSelect(select),\n sort: typeof sort === 'string' ? sort.split(',') : undefined,\n where,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,YAAA,GAAmC,MAAAA,CAAO;EAAEC,YAAY;EAAEC;AAAG,CAAE;EAC1E,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,IAAI;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,IAAI;IAAEC;EAAK,CAAE,GAAGP,GAAA,CAAIQ,KAAK;EAUvE,MAAMC,MAAA,GAAS,MAAMhB,2BAAA,CAA4B;IAC/CQ,KAAA,EAAOP,QAAA,CAASO,KAAA,IAASS,MAAA,CAAOT,KAAA,IAASU,SAAA;IACzCZ,YAAA;IACAG,KAAA,EAAOR,QAAA,CAASQ,KAAA,IAASQ,MAAA,CAAOR,KAAA,IAASS,SAAA;IACzCR,IAAA,EAAMT,QAAA,CAASS,IAAA,IAAQO,MAAA,CAAOP,IAAA,IAAQQ,SAAA;IACtCP,QAAA,EAAUR,gBAAA,CAAiBQ,QAAA;IAC3BJ,GAAA;IACAK,MAAA,EAAQR,cAAA,CAAeQ,MAAA;IACvBC,IAAA,EAAM,OAAOA,IAAA,KAAS,WAAWA,IAAA,CAAKM,KAAK,CAAC,OAAOD,SAAA;IACnDJ;EACF;EAEA,OAAOM,QAAA,CAASC,IAAI,CAACL,MAAA,EAAQ;IAC3BM,OAAA,EAASpB,eAAA,CAAgB;MACvBoB,OAAA,EAAS,IAAIC,OAAA;MACbhB;IACF;IACAiB,MAAA,EAAQzB,UAAA,CAAW0B;EACrB;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"restoreVersion.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/globals/restoreVersion.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAI3D,eAAO,MAAM,cAAc,EAAE,wBA0B5B,CAAA"}
1
+ {"version":3,"file":"restoreVersion.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/globals/restoreVersion.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAK3D,eAAO,MAAM,cAAc,EAAE,wBA2B5B,CAAA"}
@@ -2,6 +2,7 @@ import httpStatus from 'http-status';
2
2
  import { restoreVersionOperationGlobal } from 'payload';
3
3
  import { isNumber } from 'payload/shared';
4
4
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
5
+ import { sanitizePopulate } from '../utilities/sanitizePopulate.js';
5
6
  export const restoreVersion = async ({
6
7
  id,
7
8
  globalConfig,
@@ -17,6 +18,7 @@ export const restoreVersion = async ({
17
18
  depth: isNumber(depth) ? Number(depth) : undefined,
18
19
  draft: draft === 'true' ? true : undefined,
19
20
  globalConfig,
21
+ populate: sanitizePopulate(req.query.populate),
20
22
  req
21
23
  });
22
24
  return Response.json({
@@ -1 +1 @@
1
- {"version":3,"file":"restoreVersion.js","names":["httpStatus","restoreVersionOperationGlobal","isNumber","headersWithCors","restoreVersion","id","globalConfig","req","searchParams","depth","get","draft","doc","Number","undefined","Response","json","message","t","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/restoreVersion.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { restoreVersionOperationGlobal } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const restoreVersion: GlobalRouteHandlerWithID = async ({ id, globalConfig, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const draft = searchParams.get('draft')\n\n const doc = await restoreVersionOperationGlobal({\n id,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: draft === 'true' ? true : undefined,\n globalConfig,\n req,\n })\n\n return Response.json(\n {\n doc,\n message: req.t('version:restoredSuccessfully'),\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,6BAA6B,QAAQ;AAC9C,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,cAAA,GAA2C,MAAAA,CAAO;EAAEC,EAAE;EAAEC,YAAY;EAAEC;AAAG,CAAE;EACtF,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAC/B,MAAMC,KAAA,GAAQH,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAME,GAAA,GAAM,MAAMX,6BAAA,CAA8B;IAC9CI,EAAA;IACAI,KAAA,EAAOP,QAAA,CAASO,KAAA,IAASI,MAAA,CAAOJ,KAAA,IAASK,SAAA;IACzCH,KAAA,EAAOA,KAAA,KAAU,SAAS,OAAOG,SAAA;IACjCR,YAAA;IACAC;EACF;EAEA,OAAOQ,QAAA,CAASC,IAAI,CAClB;IACEJ,GAAA;IACAK,OAAA,EAASV,GAAA,CAAIW,CAAC,CAAC;EACjB,GACA;IACEC,OAAA,EAAShB,eAAA,CAAgB;MACvBgB,OAAA,EAAS,IAAIC,OAAA;MACbb;IACF;IACAc,MAAA,EAAQrB,UAAA,CAAWsB;EACrB;AAEJ","ignoreList":[]}
1
+ {"version":3,"file":"restoreVersion.js","names":["httpStatus","restoreVersionOperationGlobal","isNumber","headersWithCors","sanitizePopulate","restoreVersion","id","globalConfig","req","searchParams","depth","get","draft","doc","Number","undefined","populate","query","Response","json","message","t","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/restoreVersion.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { restoreVersionOperationGlobal } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizePopulate } from '../utilities/sanitizePopulate.js'\n\nexport const restoreVersion: GlobalRouteHandlerWithID = async ({ id, globalConfig, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const draft = searchParams.get('draft')\n\n const doc = await restoreVersionOperationGlobal({\n id,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: draft === 'true' ? true : undefined,\n globalConfig,\n populate: sanitizePopulate(req.query.populate),\n req,\n })\n\n return Response.json(\n {\n doc,\n message: req.t('version:restoredSuccessfully'),\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,6BAA6B,QAAQ;AAC9C,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,gBAAgB,QAAQ;AAEjC,OAAO,MAAMC,cAAA,GAA2C,MAAAA,CAAO;EAAEC,EAAE;EAAEC,YAAY;EAAEC;AAAG,CAAE;EACtF,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAC/B,MAAMC,KAAA,GAAQH,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAME,GAAA,GAAM,MAAMZ,6BAAA,CAA8B;IAC9CK,EAAA;IACAI,KAAA,EAAOR,QAAA,CAASQ,KAAA,IAASI,MAAA,CAAOJ,KAAA,IAASK,SAAA;IACzCH,KAAA,EAAOA,KAAA,KAAU,SAAS,OAAOG,SAAA;IACjCR,YAAA;IACAS,QAAA,EAAUZ,gBAAA,CAAiBI,GAAA,CAAIS,KAAK,CAACD,QAAQ;IAC7CR;EACF;EAEA,OAAOU,QAAA,CAASC,IAAI,CAClB;IACEN,GAAA;IACAO,OAAA,EAASZ,GAAA,CAAIa,CAAC,CAAC;EACjB,GACA;IACEC,OAAA,EAASnB,eAAA,CAAgB;MACvBmB,OAAA,EAAS,IAAIC,OAAA;MACbf;IACF;IACAgB,MAAA,EAAQxB,UAAA,CAAWyB;EACrB;AAEJ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/globals/update.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAIrD,eAAO,MAAM,MAAM,EAAE,kBAkCpB,CAAA"}
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/globals/update.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAMrD,eAAO,MAAM,MAAM,EAAE,kBA0CpB,CAAA"}