@payloadcms/next 3.0.0-canary.013af1b → 3.0.0-canary.0374de4

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 (293) hide show
  1. package/dist/elements/DocumentHeader/Tabs/Tab/index.d.ts.map +1 -1
  2. package/dist/elements/DocumentHeader/Tabs/Tab/index.js +4 -4
  3. package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
  4. package/dist/elements/DocumentHeader/Tabs/index.d.ts.map +1 -1
  5. package/dist/elements/DocumentHeader/Tabs/index.js +10 -4
  6. package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
  7. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.d.ts.map +1 -1
  8. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js +27 -24
  9. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js.map +1 -1
  10. package/dist/elements/DocumentHeader/Tabs/tabs/index.d.ts +1 -1
  11. package/dist/elements/DocumentHeader/Tabs/tabs/index.d.ts.map +1 -1
  12. package/dist/elements/DocumentHeader/Tabs/tabs/index.js +2 -2
  13. package/dist/elements/DocumentHeader/Tabs/tabs/index.js.map +1 -1
  14. package/dist/elements/DocumentHeader/index.d.ts.map +1 -1
  15. package/dist/elements/DocumentHeader/index.js.map +1 -1
  16. package/dist/elements/DocumentLocked/index.d.ts +12 -0
  17. package/dist/elements/DocumentLocked/index.d.ts.map +1 -0
  18. package/dist/elements/DocumentLocked/index.js +142 -0
  19. package/dist/elements/DocumentLocked/index.js.map +1 -0
  20. package/dist/elements/DocumentLocked/index.scss +37 -0
  21. package/dist/elements/DocumentTakeOver/index.d.ts +8 -0
  22. package/dist/elements/DocumentTakeOver/index.d.ts.map +1 -0
  23. package/dist/elements/DocumentTakeOver/index.js +98 -0
  24. package/dist/elements/DocumentTakeOver/index.js.map +1 -0
  25. package/dist/elements/DocumentTakeOver/index.scss +37 -0
  26. package/dist/elements/EmailAndUsername/index.d.ts +1 -1
  27. package/dist/elements/EmailAndUsername/index.d.ts.map +1 -1
  28. package/dist/elements/EmailAndUsername/index.js.map +1 -1
  29. package/dist/elements/LeaveWithoutSaving/index.d.ts.map +1 -1
  30. package/dist/elements/LeaveWithoutSaving/index.js.map +1 -1
  31. package/dist/elements/LeaveWithoutSaving/index.scss +3 -3
  32. package/dist/elements/LeaveWithoutSaving/usePreventLeave.d.ts.map +1 -1
  33. package/dist/elements/LeaveWithoutSaving/usePreventLeave.js +3 -1
  34. package/dist/elements/LeaveWithoutSaving/usePreventLeave.js.map +1 -1
  35. package/dist/elements/Logo/index.js +1 -1
  36. package/dist/elements/Logo/index.js.map +1 -1
  37. package/dist/elements/Nav/index.client.d.ts.map +1 -1
  38. package/dist/elements/Nav/index.client.js +1 -1
  39. package/dist/elements/Nav/index.client.js.map +1 -1
  40. package/dist/elements/Nav/index.d.ts.map +1 -1
  41. package/dist/elements/Nav/index.js +1 -1
  42. package/dist/elements/Nav/index.js.map +1 -1
  43. package/dist/exports/layouts.d.ts +1 -1
  44. package/dist/exports/layouts.d.ts.map +1 -1
  45. package/dist/exports/layouts.js +1 -1
  46. package/dist/exports/layouts.js.map +1 -1
  47. package/dist/exports/views.d.ts +1 -1
  48. package/dist/exports/views.d.ts.map +1 -1
  49. package/dist/exports/views.js +1 -1
  50. package/dist/exports/views.js.map +1 -1
  51. package/dist/fetchAPI-multipart/fileFactory.d.ts +2 -1
  52. package/dist/fetchAPI-multipart/fileFactory.d.ts.map +1 -1
  53. package/dist/fetchAPI-multipart/fileFactory.js.map +1 -1
  54. package/dist/fetchAPI-multipart/handlers.d.ts +1 -1
  55. package/dist/fetchAPI-multipart/handlers.d.ts.map +1 -1
  56. package/dist/fetchAPI-multipart/handlers.js +3 -1
  57. package/dist/fetchAPI-multipart/handlers.js.map +1 -1
  58. package/dist/fetchAPI-multipart/index.d.ts +1 -101
  59. package/dist/fetchAPI-multipart/index.d.ts.map +1 -1
  60. package/dist/fetchAPI-multipart/index.js +1 -1
  61. package/dist/fetchAPI-multipart/index.js.map +1 -1
  62. package/dist/fetchAPI-multipart/processMultipart.d.ts +2 -1
  63. package/dist/fetchAPI-multipart/processMultipart.d.ts.map +1 -1
  64. package/dist/fetchAPI-multipart/processMultipart.js +1 -0
  65. package/dist/fetchAPI-multipart/processMultipart.js.map +1 -1
  66. package/dist/fetchAPI-multipart/processNested.d.ts.map +1 -1
  67. package/dist/fetchAPI-multipart/processNested.js +8 -4
  68. package/dist/fetchAPI-multipart/processNested.js.map +1 -1
  69. package/dist/fetchAPI-multipart/uploadTimer.d.ts.map +1 -1
  70. package/dist/fetchAPI-multipart/uploadTimer.js +3 -1
  71. package/dist/fetchAPI-multipart/uploadTimer.js.map +1 -1
  72. package/dist/fetchAPI-multipart/utilities.d.ts +1 -1
  73. package/dist/fetchAPI-multipart/utilities.d.ts.map +1 -1
  74. package/dist/fetchAPI-multipart/utilities.js +32 -12
  75. package/dist/fetchAPI-multipart/utilities.js.map +1 -1
  76. package/dist/layouts/Root/index.js +2 -2
  77. package/dist/layouts/Root/index.js.map +1 -1
  78. package/dist/prod/styles.css +1 -1
  79. package/dist/routes/rest/collections/find.d.ts.map +1 -1
  80. package/dist/routes/rest/collections/find.js +3 -0
  81. package/dist/routes/rest/collections/find.js.map +1 -1
  82. package/dist/routes/rest/collections/findByID.d.ts.map +1 -1
  83. package/dist/routes/rest/collections/findByID.js +2 -0
  84. package/dist/routes/rest/collections/findByID.js.map +1 -1
  85. package/dist/routes/rest/collections/updateByID.d.ts.map +1 -1
  86. package/dist/routes/rest/collections/updateByID.js +8 -2
  87. package/dist/routes/rest/collections/updateByID.js.map +1 -1
  88. package/dist/routes/rest/files/checkFileAccess.d.ts.map +1 -1
  89. package/dist/routes/rest/files/checkFileAccess.js +7 -2
  90. package/dist/routes/rest/files/checkFileAccess.js.map +1 -1
  91. package/dist/routes/rest/files/getFile.d.ts.map +1 -1
  92. package/dist/routes/rest/files/getFile.js +6 -2
  93. package/dist/routes/rest/files/getFile.js.map +1 -1
  94. package/dist/routes/rest/globals/update.d.ts.map +1 -1
  95. package/dist/routes/rest/globals/update.js +8 -2
  96. package/dist/routes/rest/globals/update.js.map +1 -1
  97. package/dist/routes/rest/index.d.ts.map +1 -1
  98. package/dist/routes/rest/index.js +42 -14
  99. package/dist/routes/rest/index.js.map +1 -1
  100. package/dist/routes/rest/og/image.d.ts +1 -1
  101. package/dist/routes/rest/og/image.d.ts.map +1 -1
  102. package/dist/routes/rest/og/image.js +7 -7
  103. package/dist/routes/rest/og/image.js.map +1 -1
  104. package/dist/routes/rest/og/index.js +2 -2
  105. package/dist/routes/rest/og/index.js.map +1 -1
  106. package/dist/routes/rest/utilities/sanitizeCollectionID.d.ts.map +1 -1
  107. package/dist/routes/rest/utilities/sanitizeCollectionID.js +6 -2
  108. package/dist/routes/rest/utilities/sanitizeCollectionID.js.map +1 -1
  109. package/dist/routes/rest/utilities/sanitizeJoinParams.d.ts +13 -0
  110. package/dist/routes/rest/utilities/sanitizeJoinParams.d.ts.map +1 -0
  111. package/dist/routes/rest/utilities/sanitizeJoinParams.js +17 -0
  112. package/dist/routes/rest/utilities/sanitizeJoinParams.js.map +1 -0
  113. package/dist/templates/Default/Wrapper/index.scss +0 -1
  114. package/dist/templates/Default/index.d.ts.map +1 -1
  115. package/dist/templates/Default/index.js +21 -19
  116. package/dist/templates/Default/index.js.map +1 -1
  117. package/dist/templates/Default/index.scss +1 -1
  118. package/dist/templates/Minimal/index.scss +2 -2
  119. package/dist/utilities/addDataAndFileToRequest.d.ts.map +1 -1
  120. package/dist/utilities/addDataAndFileToRequest.js.map +1 -1
  121. package/dist/utilities/addLocalesToRequest.d.ts.map +1 -1
  122. package/dist/utilities/addLocalesToRequest.js +6 -2
  123. package/dist/utilities/addLocalesToRequest.js.map +1 -1
  124. package/dist/utilities/createPayloadRequest.d.ts.map +1 -1
  125. package/dist/utilities/createPayloadRequest.js +9 -3
  126. package/dist/utilities/createPayloadRequest.js.map +1 -1
  127. package/dist/utilities/getNextRequestI18n.d.ts.map +1 -1
  128. package/dist/utilities/getNextRequestI18n.js.map +1 -1
  129. package/dist/utilities/getPayloadHMR.js.map +1 -1
  130. package/dist/utilities/getRequestTheme.d.ts.map +1 -1
  131. package/dist/utilities/getRequestTheme.js.map +1 -1
  132. package/dist/utilities/headersWithCors.d.ts.map +1 -1
  133. package/dist/utilities/headersWithCors.js.map +1 -1
  134. package/dist/utilities/initPage/handleAuthRedirect.d.ts.map +1 -1
  135. package/dist/utilities/initPage/handleAuthRedirect.js +3 -1
  136. package/dist/utilities/initPage/handleAuthRedirect.js.map +1 -1
  137. package/dist/utilities/initPage/index.d.ts.map +1 -1
  138. package/dist/utilities/initPage/index.js +3 -1
  139. package/dist/utilities/initPage/index.js.map +1 -1
  140. package/dist/utilities/timestamp.d.ts.map +1 -1
  141. package/dist/utilities/timestamp.js +3 -1
  142. package/dist/utilities/timestamp.js.map +1 -1
  143. package/dist/views/API/RenderJSON/index.d.ts +1 -1
  144. package/dist/views/API/RenderJSON/index.d.ts.map +1 -1
  145. package/dist/views/API/RenderJSON/index.js.map +1 -1
  146. package/dist/views/API/index.client.d.ts.map +1 -1
  147. package/dist/views/API/index.client.js.map +1 -1
  148. package/dist/views/Account/Settings/index.d.ts.map +1 -1
  149. package/dist/views/Account/Settings/index.js.map +1 -1
  150. package/dist/views/Account/index.d.ts.map +1 -1
  151. package/dist/views/Account/index.js +1 -1
  152. package/dist/views/Account/index.js.map +1 -1
  153. package/dist/views/CreateFirstUser/index.client.d.ts +1 -1
  154. package/dist/views/CreateFirstUser/index.client.d.ts.map +1 -1
  155. package/dist/views/CreateFirstUser/index.client.js +4 -1
  156. package/dist/views/CreateFirstUser/index.client.js.map +1 -1
  157. package/dist/views/CreateFirstUser/index.d.ts.map +1 -1
  158. package/dist/views/CreateFirstUser/index.js.map +1 -1
  159. package/dist/views/CreateFirstUser/index.scss +10 -0
  160. package/dist/views/Dashboard/Default/index.d.ts +8 -1
  161. package/dist/views/Dashboard/Default/index.d.ts.map +1 -1
  162. package/dist/views/Dashboard/Default/index.js +18 -6
  163. package/dist/views/Dashboard/Default/index.js.map +1 -1
  164. package/dist/views/Dashboard/Default/index.scss +5 -0
  165. package/dist/views/Dashboard/index.d.ts.map +1 -1
  166. package/dist/views/Dashboard/index.js +18 -3
  167. package/dist/views/Dashboard/index.js.map +1 -1
  168. package/dist/views/Document/getDocumentData.d.ts +5 -2
  169. package/dist/views/Document/getDocumentData.d.ts.map +1 -1
  170. package/dist/views/Document/getDocumentData.js +13 -2
  171. package/dist/views/Document/getDocumentData.js.map +1 -1
  172. package/dist/views/Document/getMetaBySegment.d.ts +2 -2
  173. package/dist/views/Document/getMetaBySegment.d.ts.map +1 -1
  174. package/dist/views/Document/getMetaBySegment.js.map +1 -1
  175. package/dist/views/Document/index.d.ts.map +1 -1
  176. package/dist/views/Document/index.js +2 -2
  177. package/dist/views/Document/index.js.map +1 -1
  178. package/dist/views/Edit/Default/Auth/APIKey.js +3 -3
  179. package/dist/views/Edit/Default/Auth/APIKey.js.map +1 -1
  180. package/dist/views/Edit/Default/Auth/types.d.ts +1 -1
  181. package/dist/views/Edit/Default/Auth/types.d.ts.map +1 -1
  182. package/dist/views/Edit/Default/Auth/types.js.map +1 -1
  183. package/dist/views/Edit/Default/SetDocumentStepNav/index.d.ts.map +1 -1
  184. package/dist/views/Edit/Default/SetDocumentStepNav/index.js.map +1 -1
  185. package/dist/views/Edit/Default/index.d.ts.map +1 -1
  186. package/dist/views/Edit/Default/index.js +183 -18
  187. package/dist/views/Edit/Default/index.js.map +1 -1
  188. package/dist/views/ForgotPassword/index.js +1 -1
  189. package/dist/views/ForgotPassword/index.js.map +1 -1
  190. package/dist/views/List/Default/index.d.ts.map +1 -1
  191. package/dist/views/List/Default/index.js +166 -146
  192. package/dist/views/List/Default/index.js.map +1 -1
  193. package/dist/views/List/Default/index.scss +1 -0
  194. package/dist/views/List/index.d.ts.map +1 -1
  195. package/dist/views/List/index.js +4 -3
  196. package/dist/views/List/index.js.map +1 -1
  197. package/dist/views/LivePreview/Context/context.d.ts +1 -1
  198. package/dist/views/LivePreview/Context/context.d.ts.map +1 -1
  199. package/dist/views/LivePreview/Context/context.js.map +1 -1
  200. package/dist/views/LivePreview/Context/index.d.ts.map +1 -1
  201. package/dist/views/LivePreview/Context/index.js +3 -1
  202. package/dist/views/LivePreview/Context/index.js.map +1 -1
  203. package/dist/views/LivePreview/Device/index.d.ts.map +1 -1
  204. package/dist/views/LivePreview/Device/index.js +6 -2
  205. package/dist/views/LivePreview/Device/index.js.map +1 -1
  206. package/dist/views/LivePreview/Toolbar/Controls/index.js +1 -1
  207. package/dist/views/LivePreview/Toolbar/Controls/index.js.map +1 -1
  208. package/dist/views/LivePreview/Toolbar/SizeInput/index.d.ts.map +1 -1
  209. package/dist/views/LivePreview/Toolbar/SizeInput/index.js.map +1 -1
  210. package/dist/views/LivePreview/index.client.d.ts.map +1 -1
  211. package/dist/views/LivePreview/index.client.js +6 -3
  212. package/dist/views/LivePreview/index.client.js.map +1 -1
  213. package/dist/views/LivePreview/usePopupWindow.d.ts +1 -1
  214. package/dist/views/LivePreview/usePopupWindow.d.ts.map +1 -1
  215. package/dist/views/LivePreview/usePopupWindow.js.map +1 -1
  216. package/dist/views/Login/LoginForm/index.d.ts.map +1 -1
  217. package/dist/views/Login/LoginForm/index.js +28 -12
  218. package/dist/views/Login/LoginForm/index.js.map +1 -1
  219. package/dist/views/Login/index.d.ts.map +1 -1
  220. package/dist/views/Login/index.js +1 -1
  221. package/dist/views/Login/index.js.map +1 -1
  222. package/dist/views/Logout/LogoutClient.d.ts +1 -0
  223. package/dist/views/Logout/LogoutClient.d.ts.map +1 -1
  224. package/dist/views/Logout/LogoutClient.js +4 -2
  225. package/dist/views/Logout/LogoutClient.js.map +1 -1
  226. package/dist/views/Logout/index.d.ts.map +1 -1
  227. package/dist/views/Logout/index.js +1 -1
  228. package/dist/views/Logout/index.js.map +1 -1
  229. package/dist/views/Logout/index.scss +12 -9
  230. package/dist/views/NotFound/index.client.d.ts.map +1 -1
  231. package/dist/views/NotFound/index.client.js +8 -5
  232. package/dist/views/NotFound/index.client.js.map +1 -1
  233. package/dist/views/NotFound/index.d.ts.map +1 -1
  234. package/dist/views/NotFound/index.js.map +1 -1
  235. package/dist/views/NotFound/index.scss +18 -0
  236. package/dist/views/ResetPassword/index.client.d.ts.map +1 -1
  237. package/dist/views/ResetPassword/index.client.js +15 -12
  238. package/dist/views/ResetPassword/index.client.js.map +1 -1
  239. package/dist/views/ResetPassword/index.d.ts.map +1 -1
  240. package/dist/views/ResetPassword/index.js +36 -42
  241. package/dist/views/ResetPassword/index.js.map +1 -1
  242. package/dist/views/ResetPassword/index.scss +28 -2
  243. package/dist/views/Root/getViewFromConfig.js +2 -2
  244. package/dist/views/Root/getViewFromConfig.js.map +1 -1
  245. package/dist/views/Root/index.js +1 -1
  246. package/dist/views/Root/index.js.map +1 -1
  247. package/dist/views/Root/isPathMatchingRoute.d.ts.map +1 -1
  248. package/dist/views/Root/isPathMatchingRoute.js +6 -2
  249. package/dist/views/Root/isPathMatchingRoute.js.map +1 -1
  250. package/dist/views/Unauthorized/index.js +1 -1
  251. package/dist/views/Unauthorized/index.js.map +1 -1
  252. package/dist/views/Verify/index.d.ts.map +1 -1
  253. package/dist/views/Verify/index.js +6 -5
  254. package/dist/views/Verify/index.js.map +1 -1
  255. package/dist/views/Version/Default/index.d.ts.map +1 -1
  256. package/dist/views/Version/Default/index.js.map +1 -1
  257. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.d.ts.map +1 -1
  258. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +4 -2
  259. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
  260. package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js +1 -1
  261. package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js.map +1 -1
  262. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.d.ts.map +1 -1
  263. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js +3 -1
  264. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js.map +1 -1
  265. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.d.ts.map +1 -1
  266. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js +9 -3
  267. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js.map +1 -1
  268. package/dist/views/Version/RenderFieldsToDiff/index.d.ts.map +1 -1
  269. package/dist/views/Version/RenderFieldsToDiff/index.js +8 -4
  270. package/dist/views/Version/RenderFieldsToDiff/index.js.map +1 -1
  271. package/dist/views/Version/Restore/index.d.ts.map +1 -1
  272. package/dist/views/Version/Restore/index.js +24 -16
  273. package/dist/views/Version/Restore/index.js.map +1 -1
  274. package/dist/views/Version/Restore/index.scss +26 -10
  275. package/dist/views/Version/SelectComparison/index.d.ts.map +1 -1
  276. package/dist/views/Version/SelectComparison/index.js +26 -3
  277. package/dist/views/Version/SelectComparison/index.js.map +1 -1
  278. package/dist/views/Version/SelectLocales/index.d.ts.map +1 -1
  279. package/dist/views/Version/SelectLocales/index.js.map +1 -1
  280. package/dist/views/Versions/buildColumns.d.ts.map +1 -1
  281. package/dist/views/Versions/buildColumns.js +63 -48
  282. package/dist/views/Versions/buildColumns.js.map +1 -1
  283. package/dist/views/Versions/cells/AutosaveCell/index.d.ts.map +1 -1
  284. package/dist/views/Versions/cells/AutosaveCell/index.js +48 -20
  285. package/dist/views/Versions/cells/AutosaveCell/index.js.map +1 -1
  286. package/dist/views/Versions/cells/CreatedAt/index.d.ts.map +1 -1
  287. package/dist/views/Versions/cells/CreatedAt/index.js.map +1 -1
  288. package/dist/views/Versions/index.client.js +2 -2
  289. package/dist/views/Versions/index.client.js.map +1 -1
  290. package/dist/views/Versions/index.d.ts.map +1 -1
  291. package/dist/views/Versions/index.js +15 -4
  292. package/dist/views/Versions/index.js.map +1 -1
  293. package/package.json +10 -10
@@ -1 +1 @@
1
- {"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/find.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,IAAI,EAAE,sBA4BlB,CAAA"}
1
+ {"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/find.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAKzD,eAAO,MAAM,IAAI,EAAE,sBA8BlB,CAAA"}
@@ -2,6 +2,7 @@ import httpStatus from 'http-status';
2
2
  import { findOperation } from 'payload';
3
3
  import { isNumber } from 'payload/shared';
4
4
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
5
+ import { sanitizeJoinParams } from '../utilities/sanitizeJoinParams.js';
5
6
  export const find = async ({
6
7
  collection,
7
8
  req
@@ -9,6 +10,7 @@ export const find = async ({
9
10
  const {
10
11
  depth,
11
12
  draft,
13
+ joins,
12
14
  limit,
13
15
  page,
14
16
  sort,
@@ -18,6 +20,7 @@ export const find = async ({
18
20
  collection,
19
21
  depth: isNumber(depth) ? Number(depth) : undefined,
20
22
  draft: draft === 'true',
23
+ joins: sanitizeJoinParams(joins),
21
24
  limit: isNumber(limit) ? Number(limit) : undefined,
22
25
  page: isNumber(page) ? Number(page) : undefined,
23
26
  req,
@@ -1 +1 @@
1
- {"version":3,"file":"find.js","names":["httpStatus","findOperation","isNumber","headersWithCors","find","collection","req","depth","draft","limit","page","sort","where","query","result","Number","undefined","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/find.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { findOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const find: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, draft, limit, page, sort, where } = req.query as {\n depth?: string\n draft?: string\n limit?: string\n page?: string\n sort?: string\n where?: Where\n }\n\n const result = await findOperation({\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: draft === 'true',\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,aAAa,QAAQ;AAC9B,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,IAAA,GAA+B,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACpE,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,KAAK;IAAEC,IAAI;IAAEC,IAAI;IAAEC;EAAK,CAAE,GAAGN,GAAA,CAAIO,KAAK;EAS5D,MAAMC,MAAA,GAAS,MAAMb,aAAA,CAAc;IACjCI,UAAA;IACAE,KAAA,EAAOL,QAAA,CAASK,KAAA,IAASQ,MAAA,CAAOR,KAAA,IAASS,SAAA;IACzCR,KAAA,EAAOA,KAAA,KAAU;IACjBC,KAAA,EAAOP,QAAA,CAASO,KAAA,IAASM,MAAA,CAAON,KAAA,IAASO,SAAA;IACzCN,IAAA,EAAMR,QAAA,CAASQ,IAAA,IAAQK,MAAA,CAAOL,IAAA,IAAQM,SAAA;IACtCV,GAAA;IACAK,IAAA;IACAC;EACF;EAEA,OAAOK,QAAA,CAASC,IAAI,CAACJ,MAAA,EAAQ;IAC3BK,OAAA,EAAShB,eAAA,CAAgB;MACvBgB,OAAA,EAAS,IAAIC,OAAA;MACbd;IACF;IACAe,MAAA,EAAQrB,UAAA,CAAWsB;EACrB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"find.js","names":["httpStatus","findOperation","isNumber","headersWithCors","sanitizeJoinParams","find","collection","req","depth","draft","joins","limit","page","sort","where","query","result","Number","undefined","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/find.ts"],"sourcesContent":["import type { JoinQuery, Where } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { findOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeJoinParams } from '../utilities/sanitizeJoinParams.js'\n\nexport const find: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, draft, joins, limit, page, sort, where } = req.query as {\n depth?: string\n draft?: string\n joins?: JoinQuery\n limit?: string\n page?: string\n sort?: string\n where?: Where\n }\n\n const result = await findOperation({\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: draft === 'true',\n joins: sanitizeJoinParams(joins),\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,aAAa,QAAQ;AAC9B,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,kBAAkB,QAAQ;AAEnC,OAAO,MAAMC,IAAA,GAA+B,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACpE,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,KAAK;IAAEC,KAAK;IAAEC,IAAI;IAAEC,IAAI;IAAEC;EAAK,CAAE,GAAGP,GAAA,CAAIQ,KAAK;EAUnE,MAAMC,MAAA,GAAS,MAAMf,aAAA,CAAc;IACjCK,UAAA;IACAE,KAAA,EAAON,QAAA,CAASM,KAAA,IAASS,MAAA,CAAOT,KAAA,IAASU,SAAA;IACzCT,KAAA,EAAOA,KAAA,KAAU;IACjBC,KAAA,EAAON,kBAAA,CAAmBM,KAAA;IAC1BC,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASM,MAAA,CAAON,KAAA,IAASO,SAAA;IACzCN,IAAA,EAAMV,QAAA,CAASU,IAAA,IAAQK,MAAA,CAAOL,IAAA,IAAQM,SAAA;IACtCX,GAAA;IACAM,IAAA;IACAC;EACF;EAEA,OAAOK,QAAA,CAASC,IAAI,CAACJ,MAAA,EAAQ;IAC3BK,OAAA,EAASlB,eAAA,CAAgB;MACvBkB,OAAA,EAAS,IAAIC,OAAA;MACbf;IACF;IACAgB,MAAA,EAAQvB,UAAA,CAAWwB;EACrB;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"findByID.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/findByID.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAK/D,eAAO,MAAM,QAAQ,EAAE,4BA6BtB,CAAA"}
1
+ {"version":3,"file":"findByID.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/findByID.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAM/D,eAAO,MAAM,QAAQ,EAAE,4BA8BtB,CAAA"}
@@ -3,6 +3,7 @@ import { findByIDOperation } 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 { sanitizeJoinParams } from '../utilities/sanitizeJoinParams.js';
6
7
  export const findByID = async ({
7
8
  id: incomingID,
8
9
  collection,
@@ -22,6 +23,7 @@ export const findByID = async ({
22
23
  collection,
23
24
  depth: isNumber(depth) ? Number(depth) : undefined,
24
25
  draft: searchParams.get('draft') === 'true',
26
+ joins: sanitizeJoinParams(req.query.joins),
25
27
  req
26
28
  });
27
29
  return Response.json(result, {
@@ -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","findByID","id","incomingID","collection","req","searchParams","depth","get","collectionSlug","config","slug","payload","result","Number","undefined","draft","joins","query","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'\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 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":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,iBAAiB,QAAQ;AAClC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,kBAAkB,QAAQ;AAEnC,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,GAAKH,oBAAA,CAAqB;IAC9BG,EAAA,EAAIC,UAAA;IACJM,cAAA,EAAgBL,UAAA,CAAWM,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASP,GAAA,CAAIO;EACf;EAEA,MAAMC,MAAA,GAAS,MAAMjB,iBAAA,CAAkB;IACrCM,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOV,QAAA,CAASU,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCC,KAAA,EAAOV,YAAA,CAAaE,GAAG,CAAC,aAAa;IACrCS,KAAA,EAAOjB,kBAAA,CAAmBK,GAAA,CAAIa,KAAK,CAACD,KAAK;IACzCZ;EACF;EAEA,OAAOc,QAAA,CAASC,IAAI,CAACP,MAAA,EAAQ;IAC3BQ,OAAA,EAASvB,eAAA,CAAgB;MACvBuB,OAAA,EAAS,IAAIC,OAAA;MACbjB;IACF;IACAkB,MAAA,EAAQ5B,UAAA,CAAW6B;EACrB;AACF","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;AAK/D,eAAO,MAAM,UAAU,EAAE,4BAkDxB,CAAA"}
@@ -14,6 +14,7 @@ export const updateByID = async ({
14
14
  const depth = searchParams.get('depth');
15
15
  const autosave = searchParams.get('autosave') === 'true';
16
16
  const draft = searchParams.get('draft') === 'true';
17
+ const publishSpecificLocale = req.query.publishSpecificLocale;
17
18
  const id = sanitizeCollectionID({
18
19
  id: incomingID,
19
20
  collectionSlug: collection.config.slug,
@@ -26,11 +27,16 @@ export const updateByID = async ({
26
27
  data: req.data,
27
28
  depth: isNumber(depth) ? Number(depth) : undefined,
28
29
  draft,
30
+ publishSpecificLocale,
29
31
  req
30
32
  });
31
33
  let message = req.t('general:updatedSuccessfully');
32
- if (draft) message = req.t('version:draftSavedSuccessfully');
33
- if (autosave) message = req.t('version:autosavedSuccessfully');
34
+ if (draft) {
35
+ message = req.t('version:draftSavedSuccessfully');
36
+ }
37
+ if (autosave) {
38
+ message = req.t('version:autosavedSuccessfully');
39
+ }
34
40
  return Response.json({
35
41
  doc,
36
42
  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","updateByID","id","incomingID","collection","req","searchParams","depth","get","autosave","draft","publishSpecificLocale","query","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 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 publishSpecificLocale,\n req,\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;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;EAC5C,MAAMG,qBAAA,GAAwBN,GAAA,CAAIO,KAAK,CAACD,qBAAqB;EAE7D,MAAMT,EAAA,GAAKF,oBAAA,CAAqB;IAC9BE,EAAA,EAAIC,UAAA;IACJU,cAAA,EAAgBT,UAAA,CAAWU,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASX,GAAA,CAAIW;EACf;EAEA,MAAMC,GAAA,GAAM,MAAMpB,mBAAA,CAAoB;IACpCK,EAAA;IACAO,QAAA;IACAL,UAAA;IACAc,IAAA,EAAMb,GAAA,CAAIa,IAAI;IACdX,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASY,MAAA,CAAOZ,KAAA,IAASa,SAAA;IACzCV,KAAA;IACAC,qBAAA;IACAN;EACF;EAEA,IAAIgB,OAAA,GAAUhB,GAAA,CAAIiB,CAAC,CAAC;EAEpB,IAAIZ,KAAA,EAAO;IACTW,OAAA,GAAUhB,GAAA,CAAIiB,CAAC,CAAC;EAClB;EACA,IAAIb,QAAA,EAAU;IACZY,OAAA,GAAUhB,GAAA,CAAIiB,CAAC,CAAC;EAClB;EAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;IACEP,GAAA;IACAI;EACF,GACA;IACEI,OAAA,EAAS1B,eAAA,CAAgB;MACvB0B,OAAA,EAAS,IAAIC,OAAA;MACbrB;IACF;IACAsB,MAAA,EAAQ/B,UAAA,CAAWgC;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,S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ileAccess.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":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B,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;AAC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D,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":"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;AAIrD,eAAO,MAAM,MAAM,EAAE,kBAwCpB,CAAA"}
@@ -12,6 +12,7 @@ export const update = async ({
12
12
  const depth = searchParams.get('depth');
13
13
  const draft = searchParams.get('draft') === 'true';
14
14
  const autosave = searchParams.get('autosave') === 'true';
15
+ const publishSpecificLocale = req.query.publishSpecificLocale;
15
16
  const result = await updateOperationGlobal({
16
17
  slug: globalConfig.slug,
17
18
  autosave,
@@ -19,11 +20,16 @@ export const update = async ({
19
20
  depth: isNumber(depth) ? Number(depth) : undefined,
20
21
  draft,
21
22
  globalConfig,
23
+ publishSpecificLocale,
22
24
  req
23
25
  });
24
26
  let message = req.t('general:updatedSuccessfully');
25
- if (draft) message = req.t('version:draftSavedSuccessfully');
26
- if (autosave) message = req.t('version:autosavedSuccessfully');
27
+ if (draft) {
28
+ message = req.t('version:draftSavedSuccessfully');
29
+ }
30
+ if (autosave) {
31
+ message = req.t('version:autosavedSuccessfully');
32
+ }
27
33
  return Response.json({
28
34
  message,
29
35
  result
@@ -1 +1 @@
1
- {"version":3,"file":"update.js","names":["httpStatus","updateOperationGlobal","isNumber","headersWithCors","update","globalConfig","req","searchParams","depth","get","draft","autosave","result","slug","data","Number","undefined","message","t","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/update.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { updateOperationGlobal } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const update: GlobalRouteHandler = async ({ globalConfig, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const draft = searchParams.get('draft') === 'true'\n const autosave = searchParams.get('autosave') === 'true'\n\n const result = await updateOperationGlobal({\n slug: globalConfig.slug,\n autosave,\n data: req.data,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft,\n globalConfig,\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 message,\n result,\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,qBAAqB,QAAQ;AACtC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,MAAA,GAA6B,MAAAA,CAAO;EAAEC,YAAY;EAAEC;AAAG,CAAE;EACpE,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAC/B,MAAMC,KAAA,GAAQH,YAAA,CAAaE,GAAG,CAAC,aAAa;EAC5C,MAAME,QAAA,GAAWJ,YAAA,CAAaE,GAAG,CAAC,gBAAgB;EAElD,MAAMG,MAAA,GAAS,MAAMX,qBAAA,CAAsB;IACzCY,IAAA,EAAMR,YAAA,CAAaQ,IAAI;IACvBF,QAAA;IACAG,IAAA,EAAMR,GAAA,CAAIQ,IAAI;IACdN,KAAA,EAAON,QAAA,CAASM,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCN,KAAA;IACAL,YAAA;IACAC;EACF;EAEA,IAAIW,OAAA,GAAUX,GAAA,CAAIY,CAAC,CAAC;EAEpB,IAAIR,KAAA,EAAOO,OAAA,GAAUX,GAAA,CAAIY,CAAC,CAAC;EAC3B,IAAIP,QAAA,EAAUM,OAAA,GAAUX,GAAA,CAAIY,CAAC,CAAC;EAE9B,OAAOC,QAAA,CAASC,IAAI,CAClB;IACEH,OAAA;IACAL;EACF,GACA;IACES,OAAA,EAASlB,eAAA,CAAgB;MACvBkB,OAAA,EAAS,IAAIC,OAAA;MACbhB;IACF;IACAiB,MAAA,EAAQvB,UAAA,CAAWwB;EACrB;AAEJ","ignoreList":[]}
1
+ {"version":3,"file":"update.js","names":["httpStatus","updateOperationGlobal","isNumber","headersWithCors","update","globalConfig","req","searchParams","depth","get","draft","autosave","publishSpecificLocale","query","result","slug","data","Number","undefined","message","t","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/update.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { updateOperationGlobal } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const update: GlobalRouteHandler = async ({ globalConfig, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const draft = searchParams.get('draft') === 'true'\n const autosave = searchParams.get('autosave') === 'true'\n const publishSpecificLocale = req.query.publishSpecificLocale as string | undefined\n\n const result = await updateOperationGlobal({\n slug: globalConfig.slug,\n autosave,\n data: req.data,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft,\n globalConfig,\n publishSpecificLocale,\n req,\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 message,\n result,\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,qBAAqB,QAAQ;AACtC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,MAAA,GAA6B,MAAAA,CAAO;EAAEC,YAAY;EAAEC;AAAG,CAAE;EACpE,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAC/B,MAAMC,KAAA,GAAQH,YAAA,CAAaE,GAAG,CAAC,aAAa;EAC5C,MAAME,QAAA,GAAWJ,YAAA,CAAaE,GAAG,CAAC,gBAAgB;EAClD,MAAMG,qBAAA,GAAwBN,GAAA,CAAIO,KAAK,CAACD,qBAAqB;EAE7D,MAAME,MAAA,GAAS,MAAMb,qBAAA,CAAsB;IACzCc,IAAA,EAAMV,YAAA,CAAaU,IAAI;IACvBJ,QAAA;IACAK,IAAA,EAAMV,GAAA,CAAIU,IAAI;IACdR,KAAA,EAAON,QAAA,CAASM,KAAA,IAASS,MAAA,CAAOT,KAAA,IAASU,SAAA;IACzCR,KAAA;IACAL,YAAA;IACAO,qBAAA;IACAN;EACF;EAEA,IAAIa,OAAA,GAAUb,GAAA,CAAIc,CAAC,CAAC;EAEpB,IAAIV,KAAA,EAAO;IACTS,OAAA,GAAUb,GAAA,CAAIc,CAAC,CAAC;EAClB;EACA,IAAIT,QAAA,EAAU;IACZQ,OAAA,GAAUb,GAAA,CAAIc,CAAC,CAAC;EAClB;EAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;IACEH,OAAA;IACAL;EACF,GACA;IACES,OAAA,EAASpB,eAAA,CAAgB;MACvBoB,OAAA,EAAS,IAAIC,OAAA;MACblB;IACF;IACAmB,MAAA,EAAQzB,UAAA,CAAW0B;EACrB;AAEJ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/rest/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAsD,eAAe,EAAE,MAAM,SAAS,CAAA;AAwMlG,eAAO,MAAM,OAAO,WACT,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,eAAqB,OAAO,sBA0B9E,CAAA;AAEH,eAAO,MAAM,GAAG,WACL,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,eACnC,OAAO,wBAAwB;IAAE,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAA;CAAE,sBA4L5E,CAAA;AAEH,eAAO,MAAM,IAAI,WACN,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,eACnC,OAAO,wBAAwB;IAAE,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAA;CAAE,sBAkL5E,C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,CAAA;KAAE,CAAA;CAAE,sBAiG5E,CAAA"}
@@ -211,7 +211,9 @@ export const GET = config => async (request, {
211
211
  endpoints: req.payload.config.endpoints,
212
212
  request
213
213
  });
214
- if (disableEndpoints) return disableEndpoints;
214
+ if (disableEndpoints) {
215
+ return disableEndpoints;
216
+ }
215
217
  collection = req.payload.collections?.[slug1];
216
218
  if (collection) {
217
219
  req.routeParams.collection = slug1;
@@ -219,7 +221,9 @@ export const GET = config => async (request, {
219
221
  endpoints: collection.config.endpoints,
220
222
  request
221
223
  });
222
- if (disableEndpoints) return disableEndpoints;
224
+ if (disableEndpoints) {
225
+ return disableEndpoints;
226
+ }
223
227
  const customEndpointResponse = await handleCustomEndpoints({
224
228
  endpoints: collection.config.endpoints,
225
229
  entitySlug: slug1,
@@ -291,7 +295,9 @@ export const GET = config => async (request, {
291
295
  endpoints: globalConfig.endpoints,
292
296
  request
293
297
  });
294
- if (disableEndpoints) return disableEndpoints;
298
+ if (disableEndpoints) {
299
+ return disableEndpoints;
300
+ }
295
301
  const customEndpointResponse = await handleCustomEndpoints({
296
302
  endpoints: globalConfig.endpoints,
297
303
  entitySlug: `${slug1}/${slug2}`,
@@ -362,7 +368,9 @@ export const GET = config => async (request, {
362
368
  endpoints: req.payload.config.endpoints,
363
369
  req
364
370
  });
365
- if (customEndpointResponse) return customEndpointResponse;
371
+ if (customEndpointResponse) {
372
+ return customEndpointResponse;
373
+ }
366
374
  return RouteNotFoundResponse({
367
375
  slug,
368
376
  req
@@ -403,14 +411,18 @@ export const POST = config => async (request, {
403
411
  endpoints: req.payload.config.endpoints,
404
412
  request
405
413
  });
406
- if (disableEndpoints) return disableEndpoints;
414
+ if (disableEndpoints) {
415
+ return disableEndpoints;
416
+ }
407
417
  if (collection) {
408
418
  req.routeParams.collection = slug1;
409
419
  const disableEndpoints = endpointsAreDisabled({
410
420
  endpoints: collection.config.endpoints,
411
421
  request
412
422
  });
413
- if (disableEndpoints) return disableEndpoints;
423
+ if (disableEndpoints) {
424
+ return disableEndpoints;
425
+ }
414
426
  const customEndpointResponse = await handleCustomEndpoints({
415
427
  endpoints: collection.config.endpoints,
416
428
  entitySlug: slug1,
@@ -473,7 +485,9 @@ export const POST = config => async (request, {
473
485
  endpoints: globalConfig.endpoints,
474
486
  request
475
487
  });
476
- if (disableEndpoints) return disableEndpoints;
488
+ if (disableEndpoints) {
489
+ return disableEndpoints;
490
+ }
477
491
  const customEndpointResponse = await handleCustomEndpoints({
478
492
  endpoints: globalConfig.endpoints,
479
493
  entitySlug: `${slug1}/${slug2}`,
@@ -540,7 +554,9 @@ export const POST = config => async (request, {
540
554
  endpoints: req.payload.config.endpoints,
541
555
  req
542
556
  });
543
- if (customEndpointResponse) return customEndpointResponse;
557
+ if (customEndpointResponse) {
558
+ return customEndpointResponse;
559
+ }
544
560
  return RouteNotFoundResponse({
545
561
  slug,
546
562
  req
@@ -573,14 +589,18 @@ export const DELETE = config => async (request, {
573
589
  endpoints: req.payload.config.endpoints,
574
590
  request
575
591
  });
576
- if (disableEndpoints) return disableEndpoints;
592
+ if (disableEndpoints) {
593
+ return disableEndpoints;
594
+ }
577
595
  if (collection) {
578
596
  req.routeParams.collection = slug1;
579
597
  const disableEndpoints = endpointsAreDisabled({
580
598
  endpoints: collection.config.endpoints,
581
599
  request
582
600
  });
583
- if (disableEndpoints) return disableEndpoints;
601
+ if (disableEndpoints) {
602
+ return disableEndpoints;
603
+ }
584
604
  const customEndpointResponse = await handleCustomEndpoints({
585
605
  endpoints: collection.config.endpoints,
586
606
  entitySlug: slug1,
@@ -626,7 +646,9 @@ export const DELETE = config => async (request, {
626
646
  endpoints: req.payload.config.endpoints,
627
647
  req
628
648
  });
629
- if (customEndpointResponse) return customEndpointResponse;
649
+ if (customEndpointResponse) {
650
+ return customEndpointResponse;
651
+ }
630
652
  return RouteNotFoundResponse({
631
653
  slug,
632
654
  req
@@ -659,14 +681,18 @@ export const PATCH = config => async (request, {
659
681
  endpoints: req.payload.config.endpoints,
660
682
  request
661
683
  });
662
- if (disableEndpoints) return disableEndpoints;
684
+ if (disableEndpoints) {
685
+ return disableEndpoints;
686
+ }
663
687
  if (collection) {
664
688
  req.routeParams.collection = slug1;
665
689
  const disableEndpoints = endpointsAreDisabled({
666
690
  endpoints: collection.config.endpoints,
667
691
  request
668
692
  });
669
- if (disableEndpoints) return disableEndpoints;
693
+ if (disableEndpoints) {
694
+ return disableEndpoints;
695
+ }
670
696
  const customEndpointResponse = await handleCustomEndpoints({
671
697
  endpoints: collection.config.endpoints,
672
698
  entitySlug: slug1,
@@ -712,7 +738,9 @@ export const PATCH = config => async (request, {
712
738
  endpoints: req.payload.config.endpoints,
713
739
  req
714
740
  });
715
- if (customEndpointResponse) return customEndpointResponse;
741
+ if (customEndpointResponse) {
742
+ return customEndpointResponse;
743
+ }
716
744
  return RouteNotFoundResponse({
717
745
  slug,
718
746
  req