@payloadcms/next 3.0.0-beta.90 → 3.0.0-beta.91

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 (461) hide show
  1. package/dist/cjs/withPayload.js +111 -0
  2. package/dist/cjs/withPayload.js.map +1 -0
  3. package/dist/config.js +0 -1
  4. package/dist/config.js.map +1 -1
  5. package/dist/elements/DocumentHeader/Tabs/ShouldRenderTabs.js +15 -9
  6. package/dist/elements/DocumentHeader/Tabs/ShouldRenderTabs.js.map +1 -1
  7. package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js +100 -35
  8. package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js.map +1 -1
  9. package/dist/elements/DocumentHeader/Tabs/Tab/index.js +74 -63
  10. package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
  11. package/dist/elements/DocumentHeader/Tabs/getCustomViews.js +31 -35
  12. package/dist/elements/DocumentHeader/Tabs/getCustomViews.js.map +1 -1
  13. package/dist/elements/DocumentHeader/Tabs/getViewConfig.js +15 -12
  14. package/dist/elements/DocumentHeader/Tabs/getViewConfig.js.map +1 -1
  15. package/dist/elements/DocumentHeader/Tabs/index.js +86 -79
  16. package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
  17. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js +32 -13
  18. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js.map +1 -1
  19. package/dist/elements/DocumentHeader/Tabs/tabs/index.js +60 -52
  20. package/dist/elements/DocumentHeader/Tabs/tabs/index.js.map +1 -1
  21. package/dist/elements/DocumentHeader/index.js +24 -23
  22. package/dist/elements/DocumentHeader/index.js.map +1 -1
  23. package/dist/elements/EmailAndUsername/index.js +107 -75
  24. package/dist/elements/EmailAndUsername/index.js.map +1 -1
  25. package/dist/elements/LeaveWithoutSaving/index.js +150 -83
  26. package/dist/elements/LeaveWithoutSaving/index.js.map +1 -1
  27. package/dist/elements/LeaveWithoutSaving/usePreventLeave.d.ts.map +1 -1
  28. package/dist/elements/LeaveWithoutSaving/usePreventLeave.js +119 -101
  29. package/dist/elements/LeaveWithoutSaving/usePreventLeave.js.map +1 -1
  30. package/dist/elements/Logo/index.js +36 -21
  31. package/dist/elements/Logo/index.js.map +1 -1
  32. package/dist/elements/Nav/NavHamburger/index.js +41 -13
  33. package/dist/elements/Nav/NavHamburger/index.js.map +1 -1
  34. package/dist/elements/Nav/NavWrapper/index.js +48 -16
  35. package/dist/elements/Nav/NavWrapper/index.js.map +1 -1
  36. package/dist/elements/Nav/index.client.js +149 -76
  37. package/dist/elements/Nav/index.client.js.map +1 -1
  38. package/dist/elements/Nav/index.js +56 -50
  39. package/dist/elements/Nav/index.js.map +1 -1
  40. package/dist/exports/layouts.js +0 -1
  41. package/dist/exports/layouts.js.map +1 -1
  42. package/dist/exports/routes.js +0 -1
  43. package/dist/exports/routes.js.map +1 -1
  44. package/dist/exports/templates.js +0 -1
  45. package/dist/exports/templates.js.map +1 -1
  46. package/dist/exports/utilities.js +0 -1
  47. package/dist/exports/utilities.js.map +1 -1
  48. package/dist/exports/views.js +0 -1
  49. package/dist/exports/views.js.map +1 -1
  50. package/dist/fetchAPI-multipart/fileFactory.js +35 -34
  51. package/dist/fetchAPI-multipart/fileFactory.js.map +1 -1
  52. package/dist/fetchAPI-multipart/handlers.js +77 -78
  53. package/dist/fetchAPI-multipart/handlers.js.map +1 -1
  54. package/dist/fetchAPI-multipart/index.js +33 -31
  55. package/dist/fetchAPI-multipart/index.js.map +1 -1
  56. package/dist/fetchAPI-multipart/isEligibleRequest.js +13 -21
  57. package/dist/fetchAPI-multipart/isEligibleRequest.js.map +1 -1
  58. package/dist/fetchAPI-multipart/processMultipart.js +158 -141
  59. package/dist/fetchAPI-multipart/processMultipart.js.map +1 -1
  60. package/dist/fetchAPI-multipart/processNested.js +23 -21
  61. package/dist/fetchAPI-multipart/processNested.js.map +1 -1
  62. package/dist/fetchAPI-multipart/uploadTimer.js +16 -17
  63. package/dist/fetchAPI-multipart/uploadTimer.js.map +1 -1
  64. package/dist/fetchAPI-multipart/utilities.js +166 -166
  65. package/dist/fetchAPI-multipart/utilities.js.map +1 -1
  66. package/dist/fetchAPI-stream-file/index.js +19 -17
  67. package/dist/fetchAPI-stream-file/index.js.map +1 -1
  68. package/dist/index.js +0 -1
  69. package/dist/index.js.map +1 -1
  70. package/dist/layouts/Root/index.js +118 -115
  71. package/dist/layouts/Root/index.js.map +1 -1
  72. package/dist/prod/styles.css +1 -1
  73. package/dist/routes/graphql/handler.js +109 -103
  74. package/dist/routes/graphql/handler.js.map +1 -1
  75. package/dist/routes/graphql/index.js +0 -1
  76. package/dist/routes/graphql/index.js.map +1 -1
  77. package/dist/routes/graphql/playground.js +23 -24
  78. package/dist/routes/graphql/playground.js.map +1 -1
  79. package/dist/routes/index.js +0 -1
  80. package/dist/routes/index.js.map +1 -1
  81. package/dist/routes/rest/auth/access.js +22 -21
  82. package/dist/routes/rest/auth/access.js.map +1 -1
  83. package/dist/routes/rest/auth/forgotPassword.js +29 -25
  84. package/dist/routes/rest/auth/forgotPassword.js.map +1 -1
  85. package/dist/routes/rest/auth/init.js +16 -14
  86. package/dist/routes/rest/auth/init.js.map +1 -1
  87. package/dist/routes/rest/auth/login.js +43 -38
  88. package/dist/routes/rest/auth/login.js.map +1 -1
  89. package/dist/routes/rest/auth/logout.js +31 -27
  90. package/dist/routes/rest/auth/logout.js.map +1 -1
  91. package/dist/routes/rest/auth/me.js +23 -21
  92. package/dist/routes/rest/auth/me.js.map +1 -1
  93. package/dist/routes/rest/auth/refresh.js +31 -27
  94. package/dist/routes/rest/auth/refresh.js.map +1 -1
  95. package/dist/routes/rest/auth/registerFirstUser.js +43 -38
  96. package/dist/routes/rest/auth/registerFirstUser.js.map +1 -1
  97. package/dist/routes/rest/auth/resetPassword.js +38 -33
  98. package/dist/routes/rest/auth/resetPassword.js.map +1 -1
  99. package/dist/routes/rest/auth/unlock.js +27 -23
  100. package/dist/routes/rest/auth/unlock.js.map +1 -1
  101. package/dist/routes/rest/auth/verifyEmail.js +22 -17
  102. package/dist/routes/rest/auth/verifyEmail.js.map +1 -1
  103. package/dist/routes/rest/buildFormState.js +38 -37
  104. package/dist/routes/rest/buildFormState.js.map +1 -1
  105. package/dist/routes/rest/checkEndpoints.js +11 -9
  106. package/dist/routes/rest/checkEndpoints.js.map +1 -1
  107. package/dist/routes/rest/collections/count.js +15 -11
  108. package/dist/routes/rest/collections/count.js.map +1 -1
  109. package/dist/routes/rest/collections/create.js +30 -26
  110. package/dist/routes/rest/collections/create.js.map +1 -1
  111. package/dist/routes/rest/collections/delete.js +40 -35
  112. package/dist/routes/rest/collections/delete.js.map +1 -1
  113. package/dist/routes/rest/collections/deleteByID.js +36 -31
  114. package/dist/routes/rest/collections/deleteByID.js.map +1 -1
  115. package/dist/routes/rest/collections/docAccess.js +17 -14
  116. package/dist/routes/rest/collections/docAccess.js.map +1 -1
  117. package/dist/routes/rest/collections/duplicate.js +36 -31
  118. package/dist/routes/rest/collections/duplicate.js.map +1 -1
  119. package/dist/routes/rest/collections/find.js +29 -20
  120. package/dist/routes/rest/collections/find.js.map +1 -1
  121. package/dist/routes/rest/collections/findByID.js +28 -23
  122. package/dist/routes/rest/collections/findByID.js.map +1 -1
  123. package/dist/routes/rest/collections/findVersionByID.js +27 -22
  124. package/dist/routes/rest/collections/findVersionByID.js.map +1 -1
  125. package/dist/routes/rest/collections/findVersions.js +27 -19
  126. package/dist/routes/rest/collections/findVersions.js.map +1 -1
  127. package/dist/routes/rest/collections/preview.js +39 -34
  128. package/dist/routes/rest/collections/preview.js.map +1 -1
  129. package/dist/routes/rest/collections/restoreVersion.js +32 -27
  130. package/dist/routes/rest/collections/restoreVersion.js.map +1 -1
  131. package/dist/routes/rest/collections/update.js +43 -37
  132. package/dist/routes/rest/collections/update.js.map +1 -1
  133. package/dist/routes/rest/collections/updateByID.js +38 -33
  134. package/dist/routes/rest/collections/updateByID.js.map +1 -1
  135. package/dist/routes/rest/files/checkFileAccess.js +46 -44
  136. package/dist/routes/rest/files/checkFileAccess.js.map +1 -1
  137. package/dist/routes/rest/files/getFile.js +52 -49
  138. package/dist/routes/rest/files/getFile.js.map +1 -1
  139. package/dist/routes/rest/files/getFileTypeFallback.js +16 -17
  140. package/dist/routes/rest/files/getFileTypeFallback.js.map +1 -1
  141. package/dist/routes/rest/globals/docAccess.js +15 -13
  142. package/dist/routes/rest/globals/docAccess.js.map +1 -1
  143. package/dist/routes/rest/globals/findOne.js +22 -18
  144. package/dist/routes/rest/globals/findOne.js.map +1 -1
  145. package/dist/routes/rest/globals/findVersionByID.js +22 -17
  146. package/dist/routes/rest/globals/findVersionByID.js.map +1 -1
  147. package/dist/routes/rest/globals/findVersions.js +27 -19
  148. package/dist/routes/rest/globals/findVersions.js.map +1 -1
  149. package/dist/routes/rest/globals/preview.js +38 -34
  150. package/dist/routes/rest/globals/preview.js.map +1 -1
  151. package/dist/routes/rest/globals/restoreVersion.js +27 -22
  152. package/dist/routes/rest/globals/restoreVersion.js.map +1 -1
  153. package/dist/routes/rest/globals/update.js +32 -28
  154. package/dist/routes/rest/globals/update.js.map +1 -1
  155. package/dist/routes/rest/index.js +651 -626
  156. package/dist/routes/rest/index.js.map +1 -1
  157. package/dist/routes/rest/og/image.js +74 -76
  158. package/dist/routes/rest/og/image.js.map +1 -1
  159. package/dist/routes/rest/og/index.js +60 -59
  160. package/dist/routes/rest/og/index.js.map +1 -1
  161. package/dist/routes/rest/routeError.js +102 -95
  162. package/dist/routes/rest/routeError.js.map +1 -1
  163. package/dist/routes/rest/types.js +1 -2
  164. package/dist/routes/rest/types.js.map +1 -1
  165. package/dist/routes/rest/utilities/sanitizeCollectionID.js +14 -11
  166. package/dist/routes/rest/utilities/sanitizeCollectionID.js.map +1 -1
  167. package/dist/scss/app.scss +4 -4
  168. package/dist/scss/type.scss +4 -4
  169. package/dist/templates/Default/NavHamburger/index.js +18 -6
  170. package/dist/templates/Default/NavHamburger/index.js.map +1 -1
  171. package/dist/templates/Default/Wrapper/index.js +42 -13
  172. package/dist/templates/Default/Wrapper/index.js.map +1 -1
  173. package/dist/templates/Default/index.js +54 -47
  174. package/dist/templates/Default/index.js.map +1 -1
  175. package/dist/templates/Minimal/index.js +16 -16
  176. package/dist/templates/Minimal/index.js.map +1 -1
  177. package/dist/utilities/addDataAndFileToRequest.js +40 -35
  178. package/dist/utilities/addDataAndFileToRequest.js.map +1 -1
  179. package/dist/utilities/addLocalesToRequest.js +44 -36
  180. package/dist/utilities/addLocalesToRequest.js.map +1 -1
  181. package/dist/utilities/createPayloadRequest.js +85 -74
  182. package/dist/utilities/createPayloadRequest.js.map +1 -1
  183. package/dist/utilities/getNextRequestI18n.js +13 -11
  184. package/dist/utilities/getNextRequestI18n.js.map +1 -1
  185. package/dist/utilities/getPayloadHMR.d.ts +1 -1
  186. package/dist/utilities/getPayloadHMR.d.ts.map +1 -1
  187. package/dist/utilities/getPayloadHMR.js +91 -94
  188. package/dist/utilities/getPayloadHMR.js.map +1 -1
  189. package/dist/utilities/getRequestLanguage.js +16 -13
  190. package/dist/utilities/getRequestLanguage.js.map +1 -1
  191. package/dist/utilities/getRequestLocales.js +27 -24
  192. package/dist/utilities/getRequestLocales.js.map +1 -1
  193. package/dist/utilities/getRequestTheme.js +16 -16
  194. package/dist/utilities/getRequestTheme.js.map +1 -1
  195. package/dist/utilities/headersWithCors.js +21 -30
  196. package/dist/utilities/headersWithCors.js.map +1 -1
  197. package/dist/utilities/initPage/handleAdminPage.js +46 -42
  198. package/dist/utilities/initPage/handleAdminPage.js.map +1 -1
  199. package/dist/utilities/initPage/handleAuthRedirect.js +45 -32
  200. package/dist/utilities/initPage/handleAuthRedirect.js.map +1 -1
  201. package/dist/utilities/initPage/index.js +146 -120
  202. package/dist/utilities/initPage/index.js.map +1 -1
  203. package/dist/utilities/initPage/shared.js +26 -25
  204. package/dist/utilities/initPage/shared.js.map +1 -1
  205. package/dist/utilities/initPage/types.js +1 -2
  206. package/dist/utilities/initPage/types.js.map +1 -1
  207. package/dist/utilities/mergeHeaders.js +8 -9
  208. package/dist/utilities/mergeHeaders.js.map +1 -1
  209. package/dist/utilities/meta.js +66 -68
  210. package/dist/utilities/meta.js.map +1 -1
  211. package/dist/utilities/timestamp.js +4 -5
  212. package/dist/utilities/timestamp.js.map +1 -1
  213. package/dist/views/API/LocaleSelector/index.d.ts.map +1 -1
  214. package/dist/views/API/LocaleSelector/index.js +38 -11
  215. package/dist/views/API/LocaleSelector/index.js.map +1 -1
  216. package/dist/views/API/RenderJSON/index.js +124 -112
  217. package/dist/views/API/RenderJSON/index.js.map +1 -1
  218. package/dist/views/API/index.client.js +190 -202
  219. package/dist/views/API/index.client.js.map +1 -1
  220. package/dist/views/API/index.js +2 -3
  221. package/dist/views/API/index.js.map +1 -1
  222. package/dist/views/API/meta.js +22 -18
  223. package/dist/views/API/meta.js.map +1 -1
  224. package/dist/views/Account/Settings/LanguageSelector.js +45 -12
  225. package/dist/views/Account/Settings/LanguageSelector.js.map +1 -1
  226. package/dist/views/Account/Settings/index.js +21 -28
  227. package/dist/views/Account/Settings/index.js.map +1 -1
  228. package/dist/views/Account/ToggleTheme/index.js +51 -30
  229. package/dist/views/Account/ToggleTheme/index.js.map +1 -1
  230. package/dist/views/Account/index.client.js +32 -16
  231. package/dist/views/Account/index.client.js.map +1 -1
  232. package/dist/views/Account/index.js +99 -68
  233. package/dist/views/Account/index.js.map +1 -1
  234. package/dist/views/Account/meta.js +12 -8
  235. package/dist/views/Account/meta.js.map +1 -1
  236. package/dist/views/CreateFirstUser/index.client.js +95 -57
  237. package/dist/views/CreateFirstUser/index.client.js.map +1 -1
  238. package/dist/views/CreateFirstUser/index.js +42 -28
  239. package/dist/views/CreateFirstUser/index.js.map +1 -1
  240. package/dist/views/CreateFirstUser/meta.js +12 -8
  241. package/dist/views/CreateFirstUser/meta.js.map +1 -1
  242. package/dist/views/Dashboard/Default/index.js +132 -115
  243. package/dist/views/Dashboard/Default/index.js.map +1 -1
  244. package/dist/views/Dashboard/index.js +61 -52
  245. package/dist/views/Dashboard/index.js.map +1 -1
  246. package/dist/views/Dashboard/meta.js +16 -12
  247. package/dist/views/Dashboard/meta.js.map +1 -1
  248. package/dist/views/Document/getCustomViewByKey.js +2 -3
  249. package/dist/views/Document/getCustomViewByKey.js.map +1 -1
  250. package/dist/views/Document/getCustomViewByRoute.js +30 -27
  251. package/dist/views/Document/getCustomViewByRoute.js.map +1 -1
  252. package/dist/views/Document/getDocumentData.js +34 -28
  253. package/dist/views/Document/getDocumentData.js.map +1 -1
  254. package/dist/views/Document/getDocumentPermissions.js +83 -74
  255. package/dist/views/Document/getDocumentPermissions.js.map +1 -1
  256. package/dist/views/Document/getMetaBySegment.js +113 -107
  257. package/dist/views/Document/getMetaBySegment.js.map +1 -1
  258. package/dist/views/Document/getViewsFromConfig.js +309 -331
  259. package/dist/views/Document/getViewsFromConfig.js.map +1 -1
  260. package/dist/views/Document/index.d.ts.map +1 -1
  261. package/dist/views/Document/index.js +193 -159
  262. package/dist/views/Document/index.js.map +1 -1
  263. package/dist/views/Document/meta.js +1 -2
  264. package/dist/views/Document/meta.js.map +1 -1
  265. package/dist/views/Edit/Default/Auth/APIKey.js +118 -132
  266. package/dist/views/Edit/Default/Auth/APIKey.js.map +1 -1
  267. package/dist/views/Edit/Default/Auth/index.js +293 -196
  268. package/dist/views/Edit/Default/Auth/index.js.map +1 -1
  269. package/dist/views/Edit/Default/Auth/types.js +1 -2
  270. package/dist/views/Edit/Default/Auth/types.js.map +1 -1
  271. package/dist/views/Edit/Default/SetDocumentStepNav/index.js +121 -70
  272. package/dist/views/Edit/Default/SetDocumentStepNav/index.js.map +1 -1
  273. package/dist/views/Edit/Default/SetDocumentTitle/index.js +74 -29
  274. package/dist/views/Edit/Default/SetDocumentTitle/index.js.map +1 -1
  275. package/dist/views/Edit/Default/index.js +190 -187
  276. package/dist/views/Edit/Default/index.js.map +1 -1
  277. package/dist/views/Edit/Default/types.js +1 -2
  278. package/dist/views/Edit/Default/types.js.map +1 -1
  279. package/dist/views/Edit/index.client.js +45 -21
  280. package/dist/views/Edit/index.client.js.map +1 -1
  281. package/dist/views/Edit/index.js +2 -3
  282. package/dist/views/Edit/index.js.map +1 -1
  283. package/dist/views/Edit/meta.js +43 -35
  284. package/dist/views/Edit/meta.js.map +1 -1
  285. package/dist/views/Edit/sanitizeEditViewProps.js +8 -9
  286. package/dist/views/Edit/sanitizeEditViewProps.js.map +1 -1
  287. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +151 -94
  288. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
  289. package/dist/views/ForgotPassword/index.js +59 -46
  290. package/dist/views/ForgotPassword/index.js.map +1 -1
  291. package/dist/views/ForgotPassword/meta.js +12 -8
  292. package/dist/views/ForgotPassword/meta.js.map +1 -1
  293. package/dist/views/List/Default/index.js +348 -208
  294. package/dist/views/List/Default/index.js.map +1 -1
  295. package/dist/views/List/Default/types.js +1 -2
  296. package/dist/views/List/Default/types.js.map +1 -1
  297. package/dist/views/List/index.js +153 -137
  298. package/dist/views/List/index.js.map +1 -1
  299. package/dist/views/List/meta.js +20 -17
  300. package/dist/views/List/meta.js.map +1 -1
  301. package/dist/views/LivePreview/Context/collisionDetection.js +24 -21
  302. package/dist/views/LivePreview/Context/collisionDetection.js.map +1 -1
  303. package/dist/views/LivePreview/Context/context.d.ts +2 -1
  304. package/dist/views/LivePreview/Context/context.d.ts.map +1 -1
  305. package/dist/views/LivePreview/Context/context.js +39 -36
  306. package/dist/views/LivePreview/Context/context.js.map +1 -1
  307. package/dist/views/LivePreview/Context/index.js +134 -142
  308. package/dist/views/LivePreview/Context/index.js.map +1 -1
  309. package/dist/views/LivePreview/Context/sizeReducer.js +18 -19
  310. package/dist/views/LivePreview/Context/sizeReducer.js.map +1 -1
  311. package/dist/views/LivePreview/Device/index.js +78 -71
  312. package/dist/views/LivePreview/Device/index.js.map +1 -1
  313. package/dist/views/LivePreview/DeviceContainer/index.js +47 -23
  314. package/dist/views/LivePreview/DeviceContainer/index.js.map +1 -1
  315. package/dist/views/LivePreview/IFrame/index.js +21 -16
  316. package/dist/views/LivePreview/IFrame/index.js.map +1 -1
  317. package/dist/views/LivePreview/Preview/index.js +145 -92
  318. package/dist/views/LivePreview/Preview/index.js.map +1 -1
  319. package/dist/views/LivePreview/Toolbar/Controls/index.js +136 -115
  320. package/dist/views/LivePreview/Toolbar/Controls/index.js.map +1 -1
  321. package/dist/views/LivePreview/Toolbar/SizeInput/index.js +89 -51
  322. package/dist/views/LivePreview/Toolbar/SizeInput/index.js.map +1 -1
  323. package/dist/views/LivePreview/Toolbar/index.js +82 -50
  324. package/dist/views/LivePreview/Toolbar/index.js.map +1 -1
  325. package/dist/views/LivePreview/ToolbarArea/index.js +32 -10
  326. package/dist/views/LivePreview/ToolbarArea/index.js.map +1 -1
  327. package/dist/views/LivePreview/index.client.js +316 -160
  328. package/dist/views/LivePreview/index.client.js.map +1 -1
  329. package/dist/views/LivePreview/index.js +67 -55
  330. package/dist/views/LivePreview/index.js.map +1 -1
  331. package/dist/views/LivePreview/meta.js +14 -9
  332. package/dist/views/LivePreview/meta.js.map +1 -1
  333. package/dist/views/LivePreview/usePopupWindow.js +91 -94
  334. package/dist/views/LivePreview/usePopupWindow.js.map +1 -1
  335. package/dist/views/Login/LoginField/index.js +83 -39
  336. package/dist/views/Login/LoginField/index.js.map +1 -1
  337. package/dist/views/Login/LoginForm/index.js +130 -66
  338. package/dist/views/Login/LoginForm/index.js.map +1 -1
  339. package/dist/views/Login/index.js +77 -54
  340. package/dist/views/Login/index.js.map +1 -1
  341. package/dist/views/Login/meta.js +12 -8
  342. package/dist/views/Login/meta.js.map +1 -1
  343. package/dist/views/Logout/LogoutClient.js +84 -39
  344. package/dist/views/Logout/LogoutClient.js.map +1 -1
  345. package/dist/views/Logout/index.js +29 -16
  346. package/dist/views/Logout/index.js.map +1 -1
  347. package/dist/views/Logout/meta.js +11 -7
  348. package/dist/views/Logout/meta.js.map +1 -1
  349. package/dist/views/NotFound/index.client.js +78 -40
  350. package/dist/views/NotFound/index.client.js.map +1 -1
  351. package/dist/views/NotFound/index.js +47 -37
  352. package/dist/views/NotFound/index.js.map +1 -1
  353. package/dist/views/NotFound/meta.js +9 -7
  354. package/dist/views/NotFound/meta.js.map +1 -1
  355. package/dist/views/ResetPassword/index.client.js +97 -59
  356. package/dist/views/ResetPassword/index.client.js.map +1 -1
  357. package/dist/views/ResetPassword/index.js +68 -53
  358. package/dist/views/ResetPassword/index.js.map +1 -1
  359. package/dist/views/ResetPassword/meta.js +12 -8
  360. package/dist/views/ResetPassword/meta.js.map +1 -1
  361. package/dist/views/Root/generateCustomViewMetadata.js +21 -19
  362. package/dist/views/Root/generateCustomViewMetadata.js.map +1 -1
  363. package/dist/views/Root/getCustomViewByRoute.js +42 -31
  364. package/dist/views/Root/getCustomViewByRoute.js.map +1 -1
  365. package/dist/views/Root/getViewFromConfig.js +162 -156
  366. package/dist/views/Root/getViewFromConfig.js.map +1 -1
  367. package/dist/views/Root/index.js +99 -82
  368. package/dist/views/Root/index.js.map +1 -1
  369. package/dist/views/Root/isPathMatchingRoute.js +18 -13
  370. package/dist/views/Root/isPathMatchingRoute.js.map +1 -1
  371. package/dist/views/Root/meta.js +141 -136
  372. package/dist/views/Root/meta.js.map +1 -1
  373. package/dist/views/Unauthorized/index.js +32 -22
  374. package/dist/views/Unauthorized/index.js.map +1 -1
  375. package/dist/views/Unauthorized/meta.js +12 -8
  376. package/dist/views/Unauthorized/meta.js.map +1 -1
  377. package/dist/views/Verify/index.js +58 -43
  378. package/dist/views/Verify/index.js.map +1 -1
  379. package/dist/views/Verify/meta.js +12 -8
  380. package/dist/views/Verify/meta.js.map +1 -1
  381. package/dist/views/Version/Default/SetStepNav.d.ts.map +1 -1
  382. package/dist/views/Version/Default/SetStepNav.js +147 -103
  383. package/dist/views/Version/Default/SetStepNav.js.map +1 -1
  384. package/dist/views/Version/Default/index.js +198 -114
  385. package/dist/views/Version/Default/index.js.map +1 -1
  386. package/dist/views/Version/Default/types.js +1 -2
  387. package/dist/views/Version/Default/types.js.map +1 -1
  388. package/dist/views/Version/RenderFieldsToDiff/Label/index.js +6 -5
  389. package/dist/views/Version/RenderFieldsToDiff/Label/index.js.map +1 -1
  390. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.d.ts.map +1 -1
  391. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +65 -69
  392. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
  393. package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.d.ts.map +1 -1
  394. package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js +34 -31
  395. package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js.map +1 -1
  396. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js +108 -78
  397. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js.map +1 -1
  398. package/dist/views/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.js +17 -11
  399. package/dist/views/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.js.map +1 -1
  400. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.d.ts.map +1 -1
  401. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js +40 -38
  402. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js.map +1 -1
  403. package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.d.ts.map +1 -1
  404. package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js +42 -32
  405. package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js.map +1 -1
  406. package/dist/views/Version/RenderFieldsToDiff/fields/Text/DiffViewer/index.js +17 -11
  407. package/dist/views/Version/RenderFieldsToDiff/fields/Text/DiffViewer/index.js.map +1 -1
  408. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.d.ts.map +1 -1
  409. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js +34 -31
  410. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js.map +1 -1
  411. package/dist/views/Version/RenderFieldsToDiff/fields/diffMethods.js +4 -5
  412. package/dist/views/Version/RenderFieldsToDiff/fields/diffMethods.js.map +1 -1
  413. package/dist/views/Version/RenderFieldsToDiff/fields/index.js +20 -21
  414. package/dist/views/Version/RenderFieldsToDiff/fields/index.js.map +1 -1
  415. package/dist/views/Version/RenderFieldsToDiff/fields/styles.js +23 -24
  416. package/dist/views/Version/RenderFieldsToDiff/fields/styles.js.map +1 -1
  417. package/dist/views/Version/RenderFieldsToDiff/fields/types.js +1 -2
  418. package/dist/views/Version/RenderFieldsToDiff/fields/types.js.map +1 -1
  419. package/dist/views/Version/RenderFieldsToDiff/index.js +102 -97
  420. package/dist/views/Version/RenderFieldsToDiff/index.js.map +1 -1
  421. package/dist/views/Version/RenderFieldsToDiff/types.js +1 -2
  422. package/dist/views/Version/RenderFieldsToDiff/types.js.map +1 -1
  423. package/dist/views/Version/Restore/index.js +107 -110
  424. package/dist/views/Version/Restore/index.js.map +1 -1
  425. package/dist/views/Version/Restore/types.js +1 -2
  426. package/dist/views/Version/Restore/types.js.map +1 -1
  427. package/dist/views/Version/SelectComparison/index.js +130 -138
  428. package/dist/views/Version/SelectComparison/index.js.map +1 -1
  429. package/dist/views/Version/SelectComparison/types.js +1 -2
  430. package/dist/views/Version/SelectComparison/types.js.map +1 -1
  431. package/dist/views/Version/SelectLocales/index.js +58 -30
  432. package/dist/views/Version/SelectLocales/index.js.map +1 -1
  433. package/dist/views/Version/SelectLocales/types.js +1 -2
  434. package/dist/views/Version/SelectLocales/types.js.map +1 -1
  435. package/dist/views/Version/index.js +126 -105
  436. package/dist/views/Version/index.js.map +1 -1
  437. package/dist/views/Version/meta.js +49 -43
  438. package/dist/views/Version/meta.js.map +1 -1
  439. package/dist/views/Versions/buildColumns.js +87 -82
  440. package/dist/views/Versions/buildColumns.js.map +1 -1
  441. package/dist/views/Versions/cells/AutosaveCell/index.js +69 -42
  442. package/dist/views/Versions/cells/AutosaveCell/index.js.map +1 -1
  443. package/dist/views/Versions/cells/CreatedAt/index.js +70 -17
  444. package/dist/views/Versions/cells/CreatedAt/index.js.map +1 -1
  445. package/dist/views/Versions/cells/ID/index.js +17 -5
  446. package/dist/views/Versions/cells/ID/index.js.map +1 -1
  447. package/dist/views/Versions/getLatestVersion.js +33 -29
  448. package/dist/views/Versions/getLatestVersion.js.map +1 -1
  449. package/dist/views/Versions/index.client.js +80 -77
  450. package/dist/views/Versions/index.client.js.map +1 -1
  451. package/dist/views/Versions/index.js +148 -127
  452. package/dist/views/Versions/index.js.map +1 -1
  453. package/dist/views/Versions/meta.js +43 -37
  454. package/dist/views/Versions/meta.js.map +1 -1
  455. package/dist/views/Versions/types.js +1 -2
  456. package/dist/views/Versions/types.js.map +1 -1
  457. package/dist/withPayload.js +83 -117
  458. package/dist/withPayload.js.map +1 -1
  459. package/package.json +20 -10
  460. package/dist/cjs/withPayload.cjs +0 -145
  461. package/dist/cjs/withPayload.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/routes/rest/auth/unlock.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { unlockOperation } from 'payload'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const unlock: CollectionRouteHandler = async ({ collection, req }) => {\n const { t } = req\n\n const authData =\n collection.config.auth?.loginWithUsername !== false\n ? {\n email: typeof req.data?.email === 'string' ? req.data.email : '',\n username: typeof req.data?.username === 'string' ? req.data.username : '',\n }\n : {\n email: typeof req.data?.email === 'string' ? req.data.email : '',\n }\n\n await unlockOperation({\n collection,\n data: authData,\n req,\n })\n\n return Response.json(\n {\n message: t('general:success'),\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"names":["httpStatus","unlockOperation","headersWithCors","unlock","collection","req","t","authData","config","auth","loginWithUsername","email","data","username","Response","json","message","headers","Headers","status","OK"],"mappings":"AAAA,OAAOA,gBAAgB,cAAa;AACpC,SAASC,eAAe,QAAQ,UAAS;AAIzC,SAASC,eAAe,QAAQ,wCAAuC;AAEvE,OAAO,MAAMC,SAAiC,OAAO,EAAEC,UAAU,EAAEC,GAAG,EAAE;IACtE,MAAM,EAAEC,CAAC,EAAE,GAAGD;IAEd,MAAME,WACJH,WAAWI,MAAM,CAACC,IAAI,EAAEC,sBAAsB,QAC1C;QACEC,OAAO,OAAON,IAAIO,IAAI,EAAED,UAAU,WAAWN,IAAIO,IAAI,CAACD,KAAK,GAAG;QAC9DE,UAAU,OAAOR,IAAIO,IAAI,EAAEC,aAAa,WAAWR,IAAIO,IAAI,CAACC,QAAQ,GAAG;IACzE,IACA;QACEF,OAAO,OAAON,IAAIO,IAAI,EAAED,UAAU,WAAWN,IAAIO,IAAI,CAACD,KAAK,GAAG;IAChE;IAEN,MAAMV,gBAAgB;QACpBG;QACAQ,MAAML;QACNF;IACF;IAEA,OAAOS,SAASC,IAAI,CAClB;QACEC,SAASV,EAAE;IACb,GACA;QACEW,SAASf,gBAAgB;YACvBe,SAAS,IAAIC;YACbb;QACF;QACAc,QAAQnB,WAAWoB,EAAE;IACvB;AAEJ,EAAC"}
1
+ {"version":3,"file":"unlock.js","names":["httpStatus","unlockOperation","headersWithCors","unlock","collection","req","t","authData","config","auth","loginWithUsername","email","data","username","Response","json","message","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/auth/unlock.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { unlockOperation } from 'payload'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const unlock: CollectionRouteHandler = async ({ collection, req }) => {\n const { t } = req\n\n const authData =\n collection.config.auth?.loginWithUsername !== false\n ? {\n email: typeof req.data?.email === 'string' ? req.data.email : '',\n username: typeof req.data?.username === 'string' ? req.data.username : '',\n }\n : {\n email: typeof req.data?.email === 'string' ? req.data.email : '',\n }\n\n await unlockOperation({\n collection,\n data: authData,\n req,\n })\n\n return Response.json(\n {\n message: t('general:success'),\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,eAAe,QAAQ;AAIhC,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,MAAA,GAAiC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACtE,MAAM;IAAEC;EAAC,CAAE,GAAGD,GAAA;EAEd,MAAME,QAAA,GACJH,UAAA,CAAWI,MAAM,CAACC,IAAI,EAAEC,iBAAA,KAAsB,QAC1C;IACEC,KAAA,EAAO,OAAON,GAAA,CAAIO,IAAI,EAAED,KAAA,KAAU,WAAWN,GAAA,CAAIO,IAAI,CAACD,KAAK,GAAG;IAC9DE,QAAA,EAAU,OAAOR,GAAA,CAAIO,IAAI,EAAEC,QAAA,KAAa,WAAWR,GAAA,CAAIO,IAAI,CAACC,QAAQ,GAAG;EACzE,IACA;IACEF,KAAA,EAAO,OAAON,GAAA,CAAIO,IAAI,EAAED,KAAA,KAAU,WAAWN,GAAA,CAAIO,IAAI,CAACD,KAAK,GAAG;EAChE;EAEN,MAAMV,eAAA,CAAgB;IACpBG,UAAA;IACAQ,IAAA,EAAML,QAAA;IACNF;EACF;EAEA,OAAOS,QAAA,CAASC,IAAI,CAClB;IACEC,OAAA,EAASV,CAAA,CAAE;EACb,GACA;IACEW,OAAA,EAASf,eAAA,CAAgB;MACvBe,OAAA,EAAS,IAAIC,OAAA;MACbb;IACF;IACAc,MAAA,EAAQnB,UAAA,CAAWoB;EACrB;AAEJ","ignoreList":[]}
@@ -1,22 +1,27 @@
1
1
  import httpStatus from 'http-status';
2
2
  import { verifyEmailOperation } from 'payload';
3
3
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
4
- export const verifyEmail = async ({ id, collection, req })=>{
5
- const { t } = req;
6
- await verifyEmailOperation({
7
- collection,
8
- req,
9
- token: id
10
- });
11
- return Response.json({
12
- message: t('authentication:accountVerified')
13
- }, {
14
- headers: headersWithCors({
15
- headers: new Headers(),
16
- req
17
- }),
18
- status: httpStatus.OK
19
- });
4
+ export const verifyEmail = async ({
5
+ id,
6
+ collection,
7
+ req
8
+ }) => {
9
+ const {
10
+ t
11
+ } = req;
12
+ await verifyEmailOperation({
13
+ collection,
14
+ req,
15
+ token: id
16
+ });
17
+ return Response.json({
18
+ message: t('authentication:accountVerified')
19
+ }, {
20
+ headers: headersWithCors({
21
+ headers: new Headers(),
22
+ req
23
+ }),
24
+ status: httpStatus.OK
25
+ });
20
26
  };
21
-
22
27
  //# sourceMappingURL=verifyEmail.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/routes/rest/auth/verifyEmail.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { verifyEmailOperation } from 'payload'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const verifyEmail: CollectionRouteHandlerWithID = async ({ id, collection, req }) => {\n const { t } = req\n await verifyEmailOperation({\n collection,\n req,\n token: id,\n })\n\n return Response.json(\n {\n message: t('authentication:accountVerified'),\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"names":["httpStatus","verifyEmailOperation","headersWithCors","verifyEmail","id","collection","req","t","token","Response","json","message","headers","Headers","status","OK"],"mappings":"AAAA,OAAOA,gBAAgB,cAAa;AACpC,SAASC,oBAAoB,QAAQ,UAAS;AAI9C,SAASC,eAAe,QAAQ,wCAAuC;AAEvE,OAAO,MAAMC,cAA4C,OAAO,EAAEC,EAAE,EAAEC,UAAU,EAAEC,GAAG,EAAE;IACrF,MAAM,EAAEC,CAAC,EAAE,GAAGD;IACd,MAAML,qBAAqB;QACzBI;QACAC;QACAE,OAAOJ;IACT;IAEA,OAAOK,SAASC,IAAI,CAClB;QACEC,SAASJ,EAAE;IACb,GACA;QACEK,SAASV,gBAAgB;YACvBU,SAAS,IAAIC;YACbP;QACF;QACAQ,QAAQd,WAAWe,EAAE;IACvB;AAEJ,EAAC"}
1
+ {"version":3,"file":"verifyEmail.js","names":["httpStatus","verifyEmailOperation","headersWithCors","verifyEmail","id","collection","req","t","token","Response","json","message","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/auth/verifyEmail.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { verifyEmailOperation } from 'payload'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const verifyEmail: CollectionRouteHandlerWithID = async ({ id, collection, req }) => {\n const { t } = req\n await verifyEmailOperation({\n collection,\n req,\n token: id,\n })\n\n return Response.json(\n {\n message: t('authentication:accountVerified'),\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,oBAAoB,QAAQ;AAIrC,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,WAAA,GAA4C,MAAAA,CAAO;EAAEC,EAAE;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACrF,MAAM;IAAEC;EAAC,CAAE,GAAGD,GAAA;EACd,MAAML,oBAAA,CAAqB;IACzBI,UAAA;IACAC,GAAA;IACAE,KAAA,EAAOJ;EACT;EAEA,OAAOK,QAAA,CAASC,IAAI,CAClB;IACEC,OAAA,EAASJ,CAAA,CAAE;EACb,GACA;IACEK,OAAA,EAASV,eAAA,CAAgB;MACvBU,OAAA,EAAS,IAAIC,OAAA;MACbP;IACF;IACAQ,MAAA,EAAQd,UAAA,CAAWe;EACrB;AAEJ","ignoreList":[]}
@@ -2,44 +2,45 @@ import { buildFormState as buildFormStateFn } from '@payloadcms/ui/utilities/bui
2
2
  import httpStatus from 'http-status';
3
3
  import { headersWithCors } from '../../utilities/headersWithCors.js';
4
4
  import { routeError } from './routeError.js';
5
- export const buildFormState = async ({ req })=>{
6
- const headers = headersWithCors({
7
- headers: new Headers(),
8
- req
5
+ export const buildFormState = async ({
6
+ req
7
+ }) => {
8
+ const headers = headersWithCors({
9
+ headers: new Headers(),
10
+ req
11
+ });
12
+ try {
13
+ const result = await buildFormStateFn({
14
+ req
9
15
  });
10
- try {
11
- const result = await buildFormStateFn({
12
- req
13
- });
14
- return Response.json(result, {
15
- headers,
16
- status: httpStatus.OK
17
- });
18
- } catch (err) {
19
- req.payload.logger.error({
20
- err,
21
- msg: `There was an error building form state`
22
- });
23
- if (err.message === 'Could not find field schema for given path') {
24
- return Response.json({
25
- message: err.message
26
- }, {
27
- headers,
28
- status: httpStatus.BAD_REQUEST
29
- });
30
- }
31
- if (err.message === 'Unauthorized') {
32
- return Response.json(null, {
33
- headers,
34
- status: httpStatus.UNAUTHORIZED
35
- });
36
- }
37
- return routeError({
38
- config: req.payload.config,
39
- err,
40
- req
41
- });
16
+ return Response.json(result, {
17
+ headers,
18
+ status: httpStatus.OK
19
+ });
20
+ } catch (err) {
21
+ req.payload.logger.error({
22
+ err,
23
+ msg: `There was an error building form state`
24
+ });
25
+ if (err.message === 'Could not find field schema for given path') {
26
+ return Response.json({
27
+ message: err.message
28
+ }, {
29
+ headers,
30
+ status: httpStatus.BAD_REQUEST
31
+ });
42
32
  }
33
+ if (err.message === 'Unauthorized') {
34
+ return Response.json(null, {
35
+ headers,
36
+ status: httpStatus.UNAUTHORIZED
37
+ });
38
+ }
39
+ return routeError({
40
+ config: req.payload.config,
41
+ err,
42
+ req
43
+ });
44
+ }
43
45
  };
44
-
45
46
  //# sourceMappingURL=buildFormState.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/routes/rest/buildFormState.ts"],"sourcesContent":["import type { PayloadRequest } from 'payload'\n\nimport { buildFormState as buildFormStateFn } from '@payloadcms/ui/utilities/buildFormState'\nimport httpStatus from 'http-status'\n\nimport { headersWithCors } from '../../utilities/headersWithCors.js'\nimport { routeError } from './routeError.js'\n\nexport const buildFormState = async ({ req }: { req: PayloadRequest }) => {\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n try {\n const result = await buildFormStateFn({ req })\n\n return Response.json(result, {\n headers,\n status: httpStatus.OK,\n })\n } catch (err) {\n req.payload.logger.error({ err, msg: `There was an error building form state` })\n\n if (err.message === 'Could not find field schema for given path') {\n return Response.json(\n {\n message: err.message,\n },\n {\n headers,\n status: httpStatus.BAD_REQUEST,\n },\n )\n }\n\n if (err.message === 'Unauthorized') {\n return Response.json(null, {\n headers,\n status: httpStatus.UNAUTHORIZED,\n })\n }\n\n return routeError({\n config: req.payload.config,\n err,\n req,\n })\n }\n}\n"],"names":["buildFormState","buildFormStateFn","httpStatus","headersWithCors","routeError","req","headers","Headers","result","Response","json","status","OK","err","payload","logger","error","msg","message","BAD_REQUEST","UNAUTHORIZED","config"],"mappings":"AAEA,SAASA,kBAAkBC,gBAAgB,QAAQ,0CAAyC;AAC5F,OAAOC,gBAAgB,cAAa;AAEpC,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,UAAU,QAAQ,kBAAiB;AAE5C,OAAO,MAAMJ,iBAAiB,OAAO,EAAEK,GAAG,EAA2B;IACnE,MAAMC,UAAUH,gBAAgB;QAC9BG,SAAS,IAAIC;QACbF;IACF;IAEA,IAAI;QACF,MAAMG,SAAS,MAAMP,iBAAiB;YAAEI;QAAI;QAE5C,OAAOI,SAASC,IAAI,CAACF,QAAQ;YAC3BF;YACAK,QAAQT,WAAWU,EAAE;QACvB;IACF,EAAE,OAAOC,KAAK;QACZR,IAAIS,OAAO,CAACC,MAAM,CAACC,KAAK,CAAC;YAAEH;YAAKI,KAAK,CAAC,sCAAsC,CAAC;QAAC;QAE9E,IAAIJ,IAAIK,OAAO,KAAK,8CAA8C;YAChE,OAAOT,SAASC,IAAI,CAClB;gBACEQ,SAASL,IAAIK,OAAO;YACtB,GACA;gBACEZ;gBACAK,QAAQT,WAAWiB,WAAW;YAChC;QAEJ;QAEA,IAAIN,IAAIK,OAAO,KAAK,gBAAgB;YAClC,OAAOT,SAASC,IAAI,CAAC,MAAM;gBACzBJ;gBACAK,QAAQT,WAAWkB,YAAY;YACjC;QACF;QAEA,OAAOhB,WAAW;YAChBiB,QAAQhB,IAAIS,OAAO,CAACO,MAAM;YAC1BR;YACAR;QACF;IACF;AACF,EAAC"}
1
+ {"version":3,"file":"buildFormState.js","names":["buildFormState","buildFormStateFn","httpStatus","headersWithCors","routeError","req","headers","Headers","result","Response","json","status","OK","err","payload","logger","error","msg","message","BAD_REQUEST","UNAUTHORIZED","config"],"sources":["../../../src/routes/rest/buildFormState.ts"],"sourcesContent":["import type { PayloadRequest } from 'payload'\n\nimport { buildFormState as buildFormStateFn } from '@payloadcms/ui/utilities/buildFormState'\nimport httpStatus from 'http-status'\n\nimport { headersWithCors } from '../../utilities/headersWithCors.js'\nimport { routeError } from './routeError.js'\n\nexport const buildFormState = async ({ req }: { req: PayloadRequest }) => {\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n try {\n const result = await buildFormStateFn({ req })\n\n return Response.json(result, {\n headers,\n status: httpStatus.OK,\n })\n } catch (err) {\n req.payload.logger.error({ err, msg: `There was an error building form state` })\n\n if (err.message === 'Could not find field schema for given path') {\n return Response.json(\n {\n message: err.message,\n },\n {\n headers,\n status: httpStatus.BAD_REQUEST,\n },\n )\n }\n\n if (err.message === 'Unauthorized') {\n return Response.json(null, {\n headers,\n status: httpStatus.UNAUTHORIZED,\n })\n }\n\n return routeError({\n config: req.payload.config,\n err,\n req,\n })\n }\n}\n"],"mappings":"AAEA,SAASA,cAAA,IAAkBC,gBAAgB,QAAQ;AACnD,OAAOC,UAAA,MAAgB;AAEvB,SAASC,eAAe,QAAQ;AAChC,SAASC,UAAU,QAAQ;AAE3B,OAAO,MAAMJ,cAAA,GAAiB,MAAAA,CAAO;EAAEK;AAAG,CAA2B;EACnE,MAAMC,OAAA,GAAUH,eAAA,CAAgB;IAC9BG,OAAA,EAAS,IAAIC,OAAA;IACbF;EACF;EAEA,IAAI;IACF,MAAMG,MAAA,GAAS,MAAMP,gBAAA,CAAiB;MAAEI;IAAI;IAE5C,OAAOI,QAAA,CAASC,IAAI,CAACF,MAAA,EAAQ;MAC3BF,OAAA;MACAK,MAAA,EAAQT,UAAA,CAAWU;IACrB;EACF,EAAE,OAAOC,GAAA,EAAK;IACZR,GAAA,CAAIS,OAAO,CAACC,MAAM,CAACC,KAAK,CAAC;MAAEH,GAAA;MAAKI,GAAA,EAAK;IAAyC;IAE9E,IAAIJ,GAAA,CAAIK,OAAO,KAAK,8CAA8C;MAChE,OAAOT,QAAA,CAASC,IAAI,CAClB;QACEQ,OAAA,EAASL,GAAA,CAAIK;MACf,GACA;QACEZ,OAAA;QACAK,MAAA,EAAQT,UAAA,CAAWiB;MACrB;IAEJ;IAEA,IAAIN,GAAA,CAAIK,OAAO,KAAK,gBAAgB;MAClC,OAAOT,QAAA,CAASC,IAAI,CAAC,MAAM;QACzBJ,OAAA;QACAK,MAAA,EAAQT,UAAA,CAAWkB;MACrB;IACF;IAEA,OAAOhB,UAAA,CAAW;MAChBiB,MAAA,EAAQhB,GAAA,CAAIS,OAAO,CAACO,MAAM;MAC1BR,GAAA;MACAR;IACF;EACF;AACF","ignoreList":[]}
@@ -1,12 +1,14 @@
1
1
  import httpStatus from 'http-status';
2
- export const endpointsAreDisabled = ({ endpoints, request })=>{
3
- if (!endpoints) {
4
- return Response.json({
5
- message: `Cannot ${request.method.toUpperCase()} ${request.url}`
6
- }, {
7
- status: httpStatus.NOT_IMPLEMENTED
8
- });
9
- }
2
+ export const endpointsAreDisabled = ({
3
+ endpoints,
4
+ request
5
+ }) => {
6
+ if (!endpoints) {
7
+ return Response.json({
8
+ message: `Cannot ${request.method.toUpperCase()} ${request.url}`
9
+ }, {
10
+ status: httpStatus.NOT_IMPLEMENTED
11
+ });
12
+ }
10
13
  };
11
-
12
14
  //# sourceMappingURL=checkEndpoints.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/routes/rest/checkEndpoints.ts"],"sourcesContent":["import httpStatus from 'http-status'\n\nexport const endpointsAreDisabled = ({\n endpoints,\n request,\n}: {\n endpoints: false | unknown[]\n request: Partial<Request>\n}) => {\n if (!endpoints) {\n return Response.json(\n {\n message: `Cannot ${request.method.toUpperCase()} ${request.url}`,\n },\n {\n status: httpStatus.NOT_IMPLEMENTED,\n },\n )\n }\n}\n"],"names":["httpStatus","endpointsAreDisabled","endpoints","request","Response","json","message","method","toUpperCase","url","status","NOT_IMPLEMENTED"],"mappings":"AAAA,OAAOA,gBAAgB,cAAa;AAEpC,OAAO,MAAMC,uBAAuB,CAAC,EACnCC,SAAS,EACTC,OAAO,EAIR;IACC,IAAI,CAACD,WAAW;QACd,OAAOE,SAASC,IAAI,CAClB;YACEC,SAAS,CAAC,OAAO,EAAEH,QAAQI,MAAM,CAACC,WAAW,GAAG,CAAC,EAAEL,QAAQM,GAAG,CAAC,CAAC;QAClE,GACA;YACEC,QAAQV,WAAWW,eAAe;QACpC;IAEJ;AACF,EAAC"}
1
+ {"version":3,"file":"checkEndpoints.js","names":["httpStatus","endpointsAreDisabled","endpoints","request","Response","json","message","method","toUpperCase","url","status","NOT_IMPLEMENTED"],"sources":["../../../src/routes/rest/checkEndpoints.ts"],"sourcesContent":["import httpStatus from 'http-status'\n\nexport const endpointsAreDisabled = ({\n endpoints,\n request,\n}: {\n endpoints: false | unknown[]\n request: Partial<Request>\n}) => {\n if (!endpoints) {\n return Response.json(\n {\n message: `Cannot ${request.method.toUpperCase()} ${request.url}`,\n },\n {\n status: httpStatus.NOT_IMPLEMENTED,\n },\n )\n }\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AAEvB,OAAO,MAAMC,oBAAA,GAAuBA,CAAC;EACnCC,SAAS;EACTC;AAAO,CAIR;EACC,IAAI,CAACD,SAAA,EAAW;IACd,OAAOE,QAAA,CAASC,IAAI,CAClB;MACEC,OAAA,EAAS,UAAUH,OAAA,CAAQI,MAAM,CAACC,WAAW,MAAML,OAAA,CAAQM,GAAG;IAChE,GACA;MACEC,MAAA,EAAQV,UAAA,CAAWW;IACrB;EAEJ;AACF","ignoreList":[]}
@@ -1,15 +1,19 @@
1
1
  import httpStatus from 'http-status';
2
2
  import { countOperation } from 'payload';
3
- export const count = async ({ collection, req })=>{
4
- const { where } = req.query;
5
- const result = await countOperation({
6
- collection,
7
- req,
8
- where
9
- });
10
- return Response.json(result, {
11
- status: httpStatus.OK
12
- });
3
+ export const count = async ({
4
+ collection,
5
+ req
6
+ }) => {
7
+ const {
8
+ where
9
+ } = req.query;
10
+ const result = await countOperation({
11
+ collection,
12
+ req,
13
+ where
14
+ });
15
+ return Response.json(result, {
16
+ status: httpStatus.OK
17
+ });
13
18
  };
14
-
15
19
  //# sourceMappingURL=count.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/routes/rest/collections/count.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { countOperation } from 'payload'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nexport const count: CollectionRouteHandler = async ({ collection, req }) => {\n const { where } = req.query as {\n where?: Where\n }\n\n const result = await countOperation({\n collection,\n req,\n where,\n })\n\n return Response.json(result, {\n status: httpStatus.OK,\n })\n}\n"],"names":["httpStatus","countOperation","count","collection","req","where","query","result","Response","json","status","OK"],"mappings":"AAEA,OAAOA,gBAAgB,cAAa;AACpC,SAASC,cAAc,QAAQ,UAAS;AAIxC,OAAO,MAAMC,QAAgC,OAAO,EAAEC,UAAU,EAAEC,GAAG,EAAE;IACrE,MAAM,EAAEC,KAAK,EAAE,GAAGD,IAAIE,KAAK;IAI3B,MAAMC,SAAS,MAAMN,eAAe;QAClCE;QACAC;QACAC;IACF;IAEA,OAAOG,SAASC,IAAI,CAACF,QAAQ;QAC3BG,QAAQV,WAAWW,EAAE;IACvB;AACF,EAAC"}
1
+ {"version":3,"file":"count.js","names":["httpStatus","countOperation","count","collection","req","where","query","result","Response","json","status","OK"],"sources":["../../../../src/routes/rest/collections/count.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { countOperation } from 'payload'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nexport const count: CollectionRouteHandler = async ({ collection, req }) => {\n const { where } = req.query as {\n where?: Where\n }\n\n const result = await countOperation({\n collection,\n req,\n where,\n })\n\n return Response.json(result, {\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,cAAc,QAAQ;AAI/B,OAAO,MAAMC,KAAA,GAAgC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACrE,MAAM;IAAEC;EAAK,CAAE,GAAGD,GAAA,CAAIE,KAAK;EAI3B,MAAMC,MAAA,GAAS,MAAMN,cAAA,CAAe;IAClCE,UAAA;IACAC,GAAA;IACAC;EACF;EAEA,OAAOG,QAAA,CAASC,IAAI,CAACF,MAAA,EAAQ;IAC3BG,MAAA,EAAQV,UAAA,CAAWW;EACrB;AACF","ignoreList":[]}
@@ -3,31 +3,35 @@ import httpStatus from 'http-status';
3
3
  import { createOperation } from 'payload';
4
4
  import { isNumber } from 'payload/shared';
5
5
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
6
- export const create = async ({ collection, req })=>{
7
- const { searchParams } = req;
8
- const autosave = searchParams.get('autosave') === 'true';
9
- const draft = searchParams.get('draft') === 'true';
10
- const depth = searchParams.get('depth');
11
- const doc = await createOperation({
12
- autosave,
13
- collection,
14
- data: req.data,
15
- depth: isNumber(depth) ? depth : undefined,
16
- draft,
17
- req
18
- });
19
- return Response.json({
20
- doc,
21
- message: req.t('general:successfullyCreated', {
22
- label: getTranslation(collection.config.labels.singular, req.i18n)
23
- })
24
- }, {
25
- headers: headersWithCors({
26
- headers: new Headers(),
27
- req
28
- }),
29
- status: httpStatus.CREATED
30
- });
6
+ export const create = async ({
7
+ collection,
8
+ req
9
+ }) => {
10
+ const {
11
+ searchParams
12
+ } = req;
13
+ const autosave = searchParams.get('autosave') === 'true';
14
+ const draft = searchParams.get('draft') === 'true';
15
+ const depth = searchParams.get('depth');
16
+ const doc = await createOperation({
17
+ autosave,
18
+ collection,
19
+ data: req.data,
20
+ depth: isNumber(depth) ? depth : undefined,
21
+ draft,
22
+ req
23
+ });
24
+ return Response.json({
25
+ doc,
26
+ message: req.t('general:successfullyCreated', {
27
+ label: getTranslation(collection.config.labels.singular, req.i18n)
28
+ })
29
+ }, {
30
+ headers: headersWithCors({
31
+ headers: new Headers(),
32
+ req
33
+ }),
34
+ status: httpStatus.CREATED
35
+ });
31
36
  };
32
-
33
37
  //# sourceMappingURL=create.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/routes/rest/collections/create.ts"],"sourcesContent":["import { getTranslation } from '@payloadcms/translations'\nimport httpStatus from 'http-status'\nimport { createOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const create: CollectionRouteHandler = async ({ collection, req }) => {\n const { searchParams } = req\n const autosave = searchParams.get('autosave') === 'true'\n const draft = searchParams.get('draft') === 'true'\n const depth = searchParams.get('depth')\n\n const doc = await createOperation({\n autosave,\n collection,\n data: req.data,\n depth: isNumber(depth) ? depth : undefined,\n draft,\n req,\n })\n\n return Response.json(\n {\n doc,\n message: req.t('general:successfullyCreated', {\n label: getTranslation(collection.config.labels.singular, req.i18n),\n }),\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.CREATED,\n },\n )\n}\n"],"names":["getTranslation","httpStatus","createOperation","isNumber","headersWithCors","create","collection","req","searchParams","autosave","get","draft","depth","doc","data","undefined","Response","json","message","t","label","config","labels","singular","i18n","headers","Headers","status","CREATED"],"mappings":"AAAA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,gBAAgB,cAAa;AACpC,SAASC,eAAe,QAAQ,UAAS;AACzC,SAASC,QAAQ,QAAQ,iBAAgB;AAIzC,SAASC,eAAe,QAAQ,wCAAuC;AAEvE,OAAO,MAAMC,SAAiC,OAAO,EAAEC,UAAU,EAAEC,GAAG,EAAE;IACtE,MAAM,EAAEC,YAAY,EAAE,GAAGD;IACzB,MAAME,WAAWD,aAAaE,GAAG,CAAC,gBAAgB;IAClD,MAAMC,QAAQH,aAAaE,GAAG,CAAC,aAAa;IAC5C,MAAME,QAAQJ,aAAaE,GAAG,CAAC;IAE/B,MAAMG,MAAM,MAAMX,gBAAgB;QAChCO;QACAH;QACAQ,MAAMP,IAAIO,IAAI;QACdF,OAAOT,SAASS,SAASA,QAAQG;QACjCJ;QACAJ;IACF;IAEA,OAAOS,SAASC,IAAI,CAClB;QACEJ;QACAK,SAASX,IAAIY,CAAC,CAAC,+BAA+B;YAC5CC,OAAOpB,eAAeM,WAAWe,MAAM,CAACC,MAAM,CAACC,QAAQ,EAAEhB,IAAIiB,IAAI;QACnE;IACF,GACA;QACEC,SAASrB,gBAAgB;YACvBqB,SAAS,IAAIC;YACbnB;QACF;QACAoB,QAAQ1B,WAAW2B,OAAO;IAC5B;AAEJ,EAAC"}
1
+ {"version":3,"file":"create.js","names":["getTranslation","httpStatus","createOperation","isNumber","headersWithCors","create","collection","req","searchParams","autosave","get","draft","depth","doc","data","undefined","Response","json","message","t","label","config","labels","singular","i18n","headers","Headers","status","CREATED"],"sources":["../../../../src/routes/rest/collections/create.ts"],"sourcesContent":["import { getTranslation } from '@payloadcms/translations'\nimport httpStatus from 'http-status'\nimport { createOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const create: CollectionRouteHandler = async ({ collection, req }) => {\n const { searchParams } = req\n const autosave = searchParams.get('autosave') === 'true'\n const draft = searchParams.get('draft') === 'true'\n const depth = searchParams.get('depth')\n\n const doc = await createOperation({\n autosave,\n collection,\n data: req.data,\n depth: isNumber(depth) ? depth : undefined,\n draft,\n req,\n })\n\n return Response.json(\n {\n doc,\n message: req.t('general:successfullyCreated', {\n label: getTranslation(collection.config.labels.singular, req.i18n),\n }),\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.CREATED,\n },\n )\n}\n"],"mappings":"AAAA,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;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,QAAA,GAAWD,YAAA,CAAaE,GAAG,CAAC,gBAAgB;EAClD,MAAMC,KAAA,GAAQH,YAAA,CAAaE,GAAG,CAAC,aAAa;EAC5C,MAAME,KAAA,GAAQJ,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMG,GAAA,GAAM,MAAMX,eAAA,CAAgB;IAChCO,QAAA;IACAH,UAAA;IACAQ,IAAA,EAAMP,GAAA,CAAIO,IAAI;IACdF,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASA,KAAA,GAAQG,SAAA;IACjCJ,KAAA;IACAJ;EACF;EAEA,OAAOS,QAAA,CAASC,IAAI,CAClB;IACEJ,GAAA;IACAK,OAAA,EAASX,GAAA,CAAIY,CAAC,CAAC,+BAA+B;MAC5CC,KAAA,EAAOpB,cAAA,CAAeM,UAAA,CAAWe,MAAM,CAACC,MAAM,CAACC,QAAQ,EAAEhB,GAAA,CAAIiB,IAAI;IACnE;EACF,GACA;IACEC,OAAA,EAASrB,eAAA,CAAgB;MACvBqB,OAAA,EAAS,IAAIC,OAAA;MACbnB;IACF;IACAoB,MAAA,EAAQ1B,UAAA,CAAW2B;EACrB;AAEJ","ignoreList":[]}
@@ -3,44 +3,49 @@ import httpStatus from 'http-status';
3
3
  import { deleteOperation } from 'payload';
4
4
  import { isNumber } from 'payload/shared';
5
5
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
6
- export const deleteDoc = async ({ collection, req })=>{
7
- const { depth, where } = req.query;
8
- const result = await deleteOperation({
9
- collection,
10
- depth: isNumber(depth) ? Number(depth) : undefined,
11
- req,
12
- where
13
- });
14
- const headers = headersWithCors({
15
- headers: new Headers(),
16
- req
17
- });
18
- if (result.errors.length === 0) {
19
- const message = req.t('general:deletedCountSuccessfully', {
20
- count: result.docs.length,
21
- label: getTranslation(collection.config.labels[result.docs.length > 1 ? 'plural' : 'singular'], req.i18n)
22
- });
23
- return Response.json({
24
- ...result,
25
- message
26
- }, {
27
- headers,
28
- status: httpStatus.OK
29
- });
30
- }
31
- const total = result.docs.length + result.errors.length;
32
- const message = req.t('error:unableToDeleteCount', {
33
- count: result.errors.length,
34
- label: getTranslation(collection.config.labels[total > 1 ? 'plural' : 'singular'], req.i18n),
35
- total
6
+ export const deleteDoc = async ({
7
+ collection,
8
+ req
9
+ }) => {
10
+ const {
11
+ depth,
12
+ where
13
+ } = req.query;
14
+ const result = await deleteOperation({
15
+ collection,
16
+ depth: isNumber(depth) ? Number(depth) : undefined,
17
+ req,
18
+ where
19
+ });
20
+ const headers = headersWithCors({
21
+ headers: new Headers(),
22
+ req
23
+ });
24
+ if (result.errors.length === 0) {
25
+ const message = req.t('general:deletedCountSuccessfully', {
26
+ count: result.docs.length,
27
+ label: getTranslation(collection.config.labels[result.docs.length > 1 ? 'plural' : 'singular'], req.i18n)
36
28
  });
37
29
  return Response.json({
38
- ...result,
39
- message
30
+ ...result,
31
+ message
40
32
  }, {
41
- headers,
42
- status: httpStatus.BAD_REQUEST
33
+ headers,
34
+ status: httpStatus.OK
43
35
  });
36
+ }
37
+ const total = result.docs.length + result.errors.length;
38
+ const message = req.t('error:unableToDeleteCount', {
39
+ count: result.errors.length,
40
+ label: getTranslation(collection.config.labels[total > 1 ? 'plural' : 'singular'], req.i18n),
41
+ total
42
+ });
43
+ return Response.json({
44
+ ...result,
45
+ message
46
+ }, {
47
+ headers,
48
+ status: httpStatus.BAD_REQUEST
49
+ });
44
50
  };
45
-
46
51
  //# sourceMappingURL=delete.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/routes/rest/collections/delete.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport httpStatus from 'http-status'\nimport { deleteOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const deleteDoc: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, where } = req.query as {\n depth?: string\n where?: Where\n }\n\n const result = await deleteOperation({\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\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:deletedCountSuccessfully', {\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\n const message = req.t('error:unableToDeleteCount', {\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"],"names":["getTranslation","httpStatus","deleteOperation","isNumber","headersWithCors","deleteDoc","collection","req","depth","where","query","result","Number","undefined","headers","Headers","errors","length","message","t","count","docs","label","config","labels","i18n","Response","json","status","OK","total","BAD_REQUEST"],"mappings":"AAEA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,gBAAgB,cAAa;AACpC,SAASC,eAAe,QAAQ,UAAS;AACzC,SAASC,QAAQ,QAAQ,iBAAgB;AAIzC,SAASC,eAAe,QAAQ,wCAAuC;AAEvE,OAAO,MAAMC,YAAoC,OAAO,EAAEC,UAAU,EAAEC,GAAG,EAAE;IACzE,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAGF,IAAIG,KAAK;IAKlC,MAAMC,SAAS,MAAMT,gBAAgB;QACnCI;QACAE,OAAOL,SAASK,SAASI,OAAOJ,SAASK;QACzCN;QACAE;IACF;IAEA,MAAMK,UAAUV,gBAAgB;QAC9BU,SAAS,IAAIC;QACbR;IACF;IAEA,IAAII,OAAOK,MAAM,CAACC,MAAM,KAAK,GAAG;QAC9B,MAAMC,UAAUX,IAAIY,CAAC,CAAC,oCAAoC;YACxDC,OAAOT,OAAOU,IAAI,CAACJ,MAAM;YACzBK,OAAOtB,eACLM,WAAWiB,MAAM,CAACC,MAAM,CAACb,OAAOU,IAAI,CAACJ,MAAM,GAAG,IAAI,WAAW,WAAW,EACxEV,IAAIkB,IAAI;QAEZ;QAEA,OAAOC,SAASC,IAAI,CAClB;YACE,GAAGhB,MAAM;YACTO;QACF,GACA;YACEJ;YACAc,QAAQ3B,WAAW4B,EAAE;QACvB;IAEJ;IAEA,MAAMC,QAAQnB,OAAOU,IAAI,CAACJ,MAAM,GAAGN,OAAOK,MAAM,CAACC,MAAM;IAEvD,MAAMC,UAAUX,IAAIY,CAAC,CAAC,6BAA6B;QACjDC,OAAOT,OAAOK,MAAM,CAACC,MAAM;QAC3BK,OAAOtB,eAAeM,WAAWiB,MAAM,CAACC,MAAM,CAACM,QAAQ,IAAI,WAAW,WAAW,EAAEvB,IAAIkB,IAAI;QAC3FK;IACF;IAEA,OAAOJ,SAASC,IAAI,CAClB;QACE,GAAGhB,MAAM;QACTO;IACF,GACA;QACEJ;QACAc,QAAQ3B,WAAW8B,WAAW;IAChC;AAEJ,EAAC"}
1
+ {"version":3,"file":"delete.js","names":["getTranslation","httpStatus","deleteOperation","isNumber","headersWithCors","deleteDoc","collection","req","depth","where","query","result","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/delete.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport httpStatus from 'http-status'\nimport { deleteOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const deleteDoc: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, where } = req.query as {\n depth?: string\n where?: Where\n }\n\n const result = await deleteOperation({\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\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:deletedCountSuccessfully', {\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\n const message = req.t('error:unableToDeleteCount', {\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,SAAA,GAAoC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACzE,MAAM;IAAEC,KAAK;IAAEC;EAAK,CAAE,GAAGF,GAAA,CAAIG,KAAK;EAKlC,MAAMC,MAAA,GAAS,MAAMT,eAAA,CAAgB;IACnCI,UAAA;IACAE,KAAA,EAAOL,QAAA,CAASK,KAAA,IAASI,MAAA,CAAOJ,KAAA,IAASK,SAAA;IACzCN,GAAA;IACAE;EACF;EAEA,MAAMK,OAAA,GAAUV,eAAA,CAAgB;IAC9BU,OAAA,EAAS,IAAIC,OAAA;IACbR;EACF;EAEA,IAAII,MAAA,CAAOK,MAAM,CAACC,MAAM,KAAK,GAAG;IAC9B,MAAMC,OAAA,GAAUX,GAAA,CAAIY,CAAC,CAAC,oCAAoC;MACxDC,KAAA,EAAOT,MAAA,CAAOU,IAAI,CAACJ,MAAM;MACzBK,KAAA,EAAOtB,cAAA,CACLM,UAAA,CAAWiB,MAAM,CAACC,MAAM,CAACb,MAAA,CAAOU,IAAI,CAACJ,MAAM,GAAG,IAAI,WAAW,WAAW,EACxEV,GAAA,CAAIkB,IAAI;IAEZ;IAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;MACE,GAAGhB,MAAM;MACTO;IACF,GACA;MACEJ,OAAA;MACAc,MAAA,EAAQ3B,UAAA,CAAW4B;IACrB;EAEJ;EAEA,MAAMC,KAAA,GAAQnB,MAAA,CAAOU,IAAI,CAACJ,MAAM,GAAGN,MAAA,CAAOK,MAAM,CAACC,MAAM;EAEvD,MAAMC,OAAA,GAAUX,GAAA,CAAIY,CAAC,CAAC,6BAA6B;IACjDC,KAAA,EAAOT,MAAA,CAAOK,MAAM,CAACC,MAAM;IAC3BK,KAAA,EAAOtB,cAAA,CAAeM,UAAA,CAAWiB,MAAM,CAACC,MAAM,CAACM,KAAA,GAAQ,IAAI,WAAW,WAAW,EAAEvB,GAAA,CAAIkB,IAAI;IAC3FK;EACF;EAEA,OAAOJ,QAAA,CAASC,IAAI,CAClB;IACE,GAAGhB,MAAM;IACTO;EACF,GACA;IACEJ,OAAA;IACAc,MAAA,EAAQ3B,UAAA,CAAW8B;EACrB;AAEJ","ignoreList":[]}
@@ -3,39 +3,44 @@ import { deleteByIDOperation } 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
- export const deleteByID = async ({ id: incomingID, collection, req })=>{
7
- const { searchParams } = req;
8
- const depth = searchParams.get('depth');
9
- const id = sanitizeCollectionID({
10
- id: incomingID,
11
- collectionSlug: collection.config.slug,
12
- payload: req.payload
13
- });
14
- const doc = await deleteByIDOperation({
15
- id,
16
- collection,
17
- depth: isNumber(depth) ? depth : undefined,
18
- req
19
- });
20
- const headers = headersWithCors({
21
- headers: new Headers(),
22
- req
23
- });
24
- if (!doc) {
25
- return Response.json({
26
- message: req.t('general:notFound')
27
- }, {
28
- headers,
29
- status: httpStatus.NOT_FOUND
30
- });
31
- }
6
+ export const deleteByID = async ({
7
+ id: incomingID,
8
+ collection,
9
+ req
10
+ }) => {
11
+ const {
12
+ searchParams
13
+ } = req;
14
+ const depth = searchParams.get('depth');
15
+ const id = sanitizeCollectionID({
16
+ id: incomingID,
17
+ collectionSlug: collection.config.slug,
18
+ payload: req.payload
19
+ });
20
+ const doc = await deleteByIDOperation({
21
+ id,
22
+ collection,
23
+ depth: isNumber(depth) ? depth : undefined,
24
+ req
25
+ });
26
+ const headers = headersWithCors({
27
+ headers: new Headers(),
28
+ req
29
+ });
30
+ if (!doc) {
32
31
  return Response.json({
33
- doc,
34
- message: req.t('general:deletedSuccessfully')
32
+ message: req.t('general:notFound')
35
33
  }, {
36
- headers,
37
- status: httpStatus.OK
34
+ headers,
35
+ status: httpStatus.NOT_FOUND
38
36
  });
37
+ }
38
+ return Response.json({
39
+ doc,
40
+ message: req.t('general:deletedSuccessfully')
41
+ }, {
42
+ headers,
43
+ status: httpStatus.OK
44
+ });
39
45
  };
40
-
41
46
  //# sourceMappingURL=deleteByID.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/routes/rest/collections/deleteByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { deleteByIDOperation } 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 deleteByID: 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 doc = await deleteByIDOperation({\n id,\n collection,\n depth: isNumber(depth) ? depth : undefined,\n req,\n })\n\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n if (!doc) {\n return Response.json(\n {\n message: req.t('general:notFound'),\n },\n {\n headers,\n status: httpStatus.NOT_FOUND,\n },\n )\n }\n\n return Response.json(\n {\n doc,\n message: req.t('general:deletedSuccessfully'),\n },\n {\n headers,\n status: httpStatus.OK,\n },\n )\n}\n"],"names":["httpStatus","deleteByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","deleteByID","id","incomingID","collection","req","searchParams","depth","get","collectionSlug","config","slug","payload","doc","undefined","headers","Headers","Response","json","message","t","status","NOT_FOUND","OK"],"mappings":"AAAA,OAAOA,gBAAgB,cAAa;AACpC,SAASC,mBAAmB,QAAQ,UAAS;AAC7C,SAASC,QAAQ,QAAQ,iBAAgB;AAIzC,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,oBAAoB,QAAQ,uCAAsC;AAE3E,OAAO,MAAMC,aAA2C,OAAO,EAC7DC,IAAIC,UAAU,EACdC,UAAU,EACVC,GAAG,EACJ;IACC,MAAM,EAAEC,YAAY,EAAE,GAAGD;IACzB,MAAME,QAAQD,aAAaE,GAAG,CAAC;IAE/B,MAAMN,KAAKF,qBAAqB;QAC9BE,IAAIC;QACJM,gBAAgBL,WAAWM,MAAM,CAACC,IAAI;QACtCC,SAASP,IAAIO,OAAO;IACtB;IAEA,MAAMC,MAAM,MAAMhB,oBAAoB;QACpCK;QACAE;QACAG,OAAOT,SAASS,SAASA,QAAQO;QACjCT;IACF;IAEA,MAAMU,UAAUhB,gBAAgB;QAC9BgB,SAAS,IAAIC;QACbX;IACF;IAEA,IAAI,CAACQ,KAAK;QACR,OAAOI,SAASC,IAAI,CAClB;YACEC,SAASd,IAAIe,CAAC,CAAC;QACjB,GACA;YACEL;YACAM,QAAQzB,WAAW0B,SAAS;QAC9B;IAEJ;IAEA,OAAOL,SAASC,IAAI,CAClB;QACEL;QACAM,SAASd,IAAIe,CAAC,CAAC;IACjB,GACA;QACEL;QACAM,QAAQzB,WAAW2B,EAAE;IACvB;AAEJ,EAAC"}
1
+ {"version":3,"file":"deleteByID.js","names":["httpStatus","deleteByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","deleteByID","id","incomingID","collection","req","searchParams","depth","get","collectionSlug","config","slug","payload","doc","undefined","headers","Headers","Response","json","message","t","status","NOT_FOUND","OK"],"sources":["../../../../src/routes/rest/collections/deleteByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { deleteByIDOperation } 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 deleteByID: 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 doc = await deleteByIDOperation({\n id,\n collection,\n depth: isNumber(depth) ? depth : undefined,\n req,\n })\n\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n if (!doc) {\n return Response.json(\n {\n message: req.t('general:notFound'),\n },\n {\n headers,\n status: httpStatus.NOT_FOUND,\n },\n )\n }\n\n return Response.json(\n {\n doc,\n message: req.t('general:deletedSuccessfully'),\n },\n {\n headers,\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;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,GAAA,GAAM,MAAMhB,mBAAA,CAAoB;IACpCK,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASA,KAAA,GAAQO,SAAA;IACjCT;EACF;EAEA,MAAMU,OAAA,GAAUhB,eAAA,CAAgB;IAC9BgB,OAAA,EAAS,IAAIC,OAAA;IACbX;EACF;EAEA,IAAI,CAACQ,GAAA,EAAK;IACR,OAAOI,QAAA,CAASC,IAAI,CAClB;MACEC,OAAA,EAASd,GAAA,CAAIe,CAAC,CAAC;IACjB,GACA;MACEL,OAAA;MACAM,MAAA,EAAQzB,UAAA,CAAW0B;IACrB;EAEJ;EAEA,OAAOL,QAAA,CAASC,IAAI,CAClB;IACEL,GAAA;IACAM,OAAA,EAASd,GAAA,CAAIe,CAAC,CAAC;EACjB,GACA;IACEL,OAAA;IACAM,MAAA,EAAQzB,UAAA,CAAW2B;EACrB;AAEJ","ignoreList":[]}
@@ -1,19 +1,22 @@
1
1
  import httpStatus from 'http-status';
2
2
  import { docAccessOperation } from 'payload';
3
3
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
4
- export const docAccess = async ({ id, collection, req })=>{
5
- const result = await docAccessOperation({
6
- id,
7
- collection,
8
- req
9
- });
10
- return Response.json(result, {
11
- headers: headersWithCors({
12
- headers: new Headers(),
13
- req
14
- }),
15
- status: httpStatus.OK
16
- });
4
+ export const docAccess = async ({
5
+ id,
6
+ collection,
7
+ req
8
+ }) => {
9
+ const result = await docAccessOperation({
10
+ id,
11
+ collection,
12
+ req
13
+ });
14
+ return Response.json(result, {
15
+ headers: headersWithCors({
16
+ headers: new Headers(),
17
+ req
18
+ }),
19
+ status: httpStatus.OK
20
+ });
17
21
  };
18
-
19
22
  //# sourceMappingURL=docAccess.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/routes/rest/collections/docAccess.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { docAccessOperation } from 'payload'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const docAccess: CollectionRouteHandlerWithID = async ({ id, collection, req }) => {\n const result = await docAccessOperation({\n id,\n collection,\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"],"names":["httpStatus","docAccessOperation","headersWithCors","docAccess","id","collection","req","result","Response","json","headers","Headers","status","OK"],"mappings":"AAAA,OAAOA,gBAAgB,cAAa;AACpC,SAASC,kBAAkB,QAAQ,UAAS;AAI5C,SAASC,eAAe,QAAQ,wCAAuC;AAEvE,OAAO,MAAMC,YAA0C,OAAO,EAAEC,EAAE,EAAEC,UAAU,EAAEC,GAAG,EAAE;IACnF,MAAMC,SAAS,MAAMN,mBAAmB;QACtCG;QACAC;QACAC;IACF;IAEA,OAAOE,SAASC,IAAI,CAACF,QAAQ;QAC3BG,SAASR,gBAAgB;YACvBQ,SAAS,IAAIC;YACbL;QACF;QACAM,QAAQZ,WAAWa,EAAE;IACvB;AACF,EAAC"}
1
+ {"version":3,"file":"docAccess.js","names":["httpStatus","docAccessOperation","headersWithCors","docAccess","id","collection","req","result","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/docAccess.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { docAccessOperation } from 'payload'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const docAccess: CollectionRouteHandlerWithID = async ({ id, collection, req }) => {\n const result = await docAccessOperation({\n id,\n collection,\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,kBAAkB,QAAQ;AAInC,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,SAAA,GAA0C,MAAAA,CAAO;EAAEC,EAAE;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACnF,MAAMC,MAAA,GAAS,MAAMN,kBAAA,CAAmB;IACtCG,EAAA;IACAC,UAAA;IACAC;EACF;EAEA,OAAOE,QAAA,CAASC,IAAI,CAACF,MAAA,EAAQ;IAC3BG,OAAA,EAASR,eAAA,CAAgB;MACvBQ,OAAA,EAAS,IAAIC,OAAA;MACbL;IACF;IACAM,MAAA,EAAQZ,UAAA,CAAWa;EACrB;AACF","ignoreList":[]}