payload 4.0.0-internal.40de3ec → 4.0.0-internal.45cfa3d

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 (381) hide show
  1. package/LICENSE.md +1 -1
  2. package/bin.js +11 -0
  3. package/dist/admin/RichText.d.ts +1 -21
  4. package/dist/admin/RichText.d.ts.map +1 -1
  5. package/dist/admin/RichText.js.map +1 -1
  6. package/dist/admin/fields/Row.d.ts +2 -2
  7. package/dist/admin/fields/Row.d.ts.map +1 -1
  8. package/dist/admin/fields/Row.js.map +1 -1
  9. package/dist/admin/forms/Description.d.ts +2 -2
  10. package/dist/admin/forms/Description.d.ts.map +1 -1
  11. package/dist/admin/forms/Description.js.map +1 -1
  12. package/dist/admin/forms/Field.d.ts +3 -5
  13. package/dist/admin/forms/Field.d.ts.map +1 -1
  14. package/dist/admin/forms/Field.js.map +1 -1
  15. package/dist/admin/forms/Form.d.ts +0 -29
  16. package/dist/admin/forms/Form.d.ts.map +1 -1
  17. package/dist/admin/forms/Form.js.map +1 -1
  18. package/dist/admin/types.d.ts +2 -1
  19. package/dist/admin/types.d.ts.map +1 -1
  20. package/dist/admin/types.js.map +1 -1
  21. package/dist/admin/views/document.d.ts +0 -4
  22. package/dist/admin/views/document.d.ts.map +1 -1
  23. package/dist/admin/views/document.js.map +1 -1
  24. package/dist/admin/views/list.d.ts +5 -0
  25. package/dist/admin/views/list.d.ts.map +1 -1
  26. package/dist/admin/views/list.js.map +1 -1
  27. package/dist/auth/baseFields/apiKey.d.ts +10 -2
  28. package/dist/auth/baseFields/apiKey.d.ts.map +1 -1
  29. package/dist/auth/baseFields/apiKey.js +35 -24
  30. package/dist/auth/baseFields/apiKey.js.map +1 -1
  31. package/dist/auth/getAuthFields.js +2 -2
  32. package/dist/auth/getAuthFields.js.map +1 -1
  33. package/dist/auth/operations/auth.d.ts +2 -2
  34. package/dist/auth/operations/auth.d.ts.map +1 -1
  35. package/dist/auth/operations/auth.js.map +1 -1
  36. package/dist/auth/operations/login.d.ts +2 -1
  37. package/dist/auth/operations/login.d.ts.map +1 -1
  38. package/dist/auth/operations/login.js.map +1 -1
  39. package/dist/auth/operations/me.js.map +1 -1
  40. package/dist/auth/operations/refresh.d.ts.map +1 -1
  41. package/dist/auth/operations/refresh.js +9 -3
  42. package/dist/auth/operations/refresh.js.map +1 -1
  43. package/dist/auth/operations/resetPassword.d.ts.map +1 -1
  44. package/dist/auth/operations/resetPassword.js.map +1 -1
  45. package/dist/auth/sendVerificationEmail.d.ts +2 -2
  46. package/dist/auth/sendVerificationEmail.d.ts.map +1 -1
  47. package/dist/auth/sendVerificationEmail.js +1 -1
  48. package/dist/auth/sendVerificationEmail.js.map +1 -1
  49. package/dist/auth/sessions.d.ts +4 -5
  50. package/dist/auth/sessions.d.ts.map +1 -1
  51. package/dist/auth/sessions.js +5 -3
  52. package/dist/auth/sessions.js.map +1 -1
  53. package/dist/auth/strategies/apiKey.js.map +1 -1
  54. package/dist/auth/strategies/local/incrementLoginAttempts.d.ts +2 -2
  55. package/dist/auth/strategies/local/incrementLoginAttempts.d.ts.map +1 -1
  56. package/dist/auth/strategies/local/incrementLoginAttempts.js +1 -1
  57. package/dist/auth/strategies/local/incrementLoginAttempts.js.map +1 -1
  58. package/dist/auth/types.d.ts +28 -21
  59. package/dist/auth/types.d.ts.map +1 -1
  60. package/dist/auth/types.js.map +1 -1
  61. package/dist/bin/generateImportMap/iterateCollections.d.ts.map +1 -1
  62. package/dist/bin/generateImportMap/iterateCollections.js +11 -0
  63. package/dist/bin/generateImportMap/iterateCollections.js.map +1 -1
  64. package/dist/bin/generateImportMap/iterateConfig.d.ts.map +1 -1
  65. package/dist/bin/generateImportMap/iterateConfig.js +12 -0
  66. package/dist/bin/generateImportMap/iterateConfig.js.map +1 -1
  67. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.d.ts.map +1 -1
  68. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.js +11 -3
  69. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.js.map +1 -1
  70. package/dist/collections/config/client.d.ts +1 -1
  71. package/dist/collections/config/client.d.ts.map +1 -1
  72. package/dist/collections/config/client.js +1 -0
  73. package/dist/collections/config/client.js.map +1 -1
  74. package/dist/collections/config/defaults.d.ts +0 -4
  75. package/dist/collections/config/defaults.d.ts.map +1 -1
  76. package/dist/collections/config/defaults.js +0 -15
  77. package/dist/collections/config/defaults.js.map +1 -1
  78. package/dist/collections/config/sanitize.d.ts.map +1 -1
  79. package/dist/collections/config/sanitize.js +1 -11
  80. package/dist/collections/config/sanitize.js.map +1 -1
  81. package/dist/collections/config/types.d.ts +7 -0
  82. package/dist/collections/config/types.d.ts.map +1 -1
  83. package/dist/collections/config/types.js.map +1 -1
  84. package/dist/collections/endpoints/create.d.ts.map +1 -1
  85. package/dist/collections/endpoints/create.js +0 -2
  86. package/dist/collections/endpoints/create.js.map +1 -1
  87. package/dist/collections/endpoints/updateByID.d.ts.map +1 -1
  88. package/dist/collections/endpoints/updateByID.js +1 -2
  89. package/dist/collections/endpoints/updateByID.js.map +1 -1
  90. package/dist/collections/operations/count.d.ts.map +1 -1
  91. package/dist/collections/operations/count.js +1 -0
  92. package/dist/collections/operations/count.js.map +1 -1
  93. package/dist/collections/operations/create.d.ts +0 -1
  94. package/dist/collections/operations/create.d.ts.map +1 -1
  95. package/dist/collections/operations/create.js +14 -6
  96. package/dist/collections/operations/create.js.map +1 -1
  97. package/dist/collections/operations/findDistinct.d.ts.map +1 -1
  98. package/dist/collections/operations/findDistinct.js +1 -0
  99. package/dist/collections/operations/findDistinct.js.map +1 -1
  100. package/dist/collections/operations/local/count.d.ts +3 -3
  101. package/dist/collections/operations/local/count.d.ts.map +1 -1
  102. package/dist/collections/operations/local/count.js.map +1 -1
  103. package/dist/collections/operations/local/countVersions.d.ts +3 -3
  104. package/dist/collections/operations/local/countVersions.d.ts.map +1 -1
  105. package/dist/collections/operations/local/countVersions.js.map +1 -1
  106. package/dist/collections/operations/local/create.d.ts +3 -3
  107. package/dist/collections/operations/local/create.d.ts.map +1 -1
  108. package/dist/collections/operations/local/create.js.map +1 -1
  109. package/dist/collections/operations/local/delete.d.ts +3 -3
  110. package/dist/collections/operations/local/delete.d.ts.map +1 -1
  111. package/dist/collections/operations/local/delete.js.map +1 -1
  112. package/dist/collections/operations/local/duplicate.d.ts +3 -3
  113. package/dist/collections/operations/local/duplicate.d.ts.map +1 -1
  114. package/dist/collections/operations/local/duplicate.js.map +1 -1
  115. package/dist/collections/operations/local/find.d.ts +3 -3
  116. package/dist/collections/operations/local/find.d.ts.map +1 -1
  117. package/dist/collections/operations/local/find.js.map +1 -1
  118. package/dist/collections/operations/local/findByID.d.ts +3 -3
  119. package/dist/collections/operations/local/findByID.d.ts.map +1 -1
  120. package/dist/collections/operations/local/findByID.js.map +1 -1
  121. package/dist/collections/operations/local/findDistinct.d.ts +2 -2
  122. package/dist/collections/operations/local/findDistinct.d.ts.map +1 -1
  123. package/dist/collections/operations/local/findDistinct.js.map +1 -1
  124. package/dist/collections/operations/local/findVersionByID.d.ts +3 -3
  125. package/dist/collections/operations/local/findVersionByID.d.ts.map +1 -1
  126. package/dist/collections/operations/local/findVersionByID.js.map +1 -1
  127. package/dist/collections/operations/local/findVersions.d.ts +3 -3
  128. package/dist/collections/operations/local/findVersions.d.ts.map +1 -1
  129. package/dist/collections/operations/local/findVersions.js.map +1 -1
  130. package/dist/collections/operations/local/restoreVersion.d.ts +3 -3
  131. package/dist/collections/operations/local/restoreVersion.d.ts.map +1 -1
  132. package/dist/collections/operations/local/restoreVersion.js.map +1 -1
  133. package/dist/collections/operations/local/update.d.ts +7 -11
  134. package/dist/collections/operations/local/update.d.ts.map +1 -1
  135. package/dist/collections/operations/local/update.js +1 -2
  136. package/dist/collections/operations/local/update.js.map +1 -1
  137. package/dist/collections/operations/update.d.ts +0 -1
  138. package/dist/collections/operations/update.d.ts.map +1 -1
  139. package/dist/collections/operations/update.js +8 -4
  140. package/dist/collections/operations/update.js.map +1 -1
  141. package/dist/collections/operations/updateByID.d.ts +0 -1
  142. package/dist/collections/operations/updateByID.d.ts.map +1 -1
  143. package/dist/collections/operations/updateByID.js +1 -5
  144. package/dist/collections/operations/updateByID.js.map +1 -1
  145. package/dist/collections/operations/utilities/copyDataWithFreshRowIDs.d.ts +9 -0
  146. package/dist/collections/operations/utilities/copyDataWithFreshRowIDs.d.ts.map +1 -0
  147. package/dist/collections/operations/utilities/copyDataWithFreshRowIDs.js +170 -0
  148. package/dist/collections/operations/utilities/copyDataWithFreshRowIDs.js.map +1 -0
  149. package/dist/collections/operations/utilities/types.d.ts +0 -9
  150. package/dist/collections/operations/utilities/types.d.ts.map +1 -1
  151. package/dist/collections/operations/utilities/types.js.map +1 -1
  152. package/dist/collections/operations/utilities/update.d.ts +1 -2
  153. package/dist/collections/operations/utilities/update.d.ts.map +1 -1
  154. package/dist/collections/operations/utilities/update.js +48 -57
  155. package/dist/collections/operations/utilities/update.js.map +1 -1
  156. package/dist/config/client.d.ts +2 -2
  157. package/dist/config/client.d.ts.map +1 -1
  158. package/dist/config/client.js.map +1 -1
  159. package/dist/config/defaults.d.ts +0 -4
  160. package/dist/config/defaults.d.ts.map +1 -1
  161. package/dist/config/defaults.js +0 -78
  162. package/dist/config/defaults.js.map +1 -1
  163. package/dist/config/definePlugin.d.ts +10 -10
  164. package/dist/config/definePlugin.d.ts.map +1 -1
  165. package/dist/config/definePlugin.js +7 -11
  166. package/dist/config/definePlugin.js.map +1 -1
  167. package/dist/config/orderable/index.d.ts.map +1 -1
  168. package/dist/config/orderable/index.js +23 -0
  169. package/dist/config/orderable/index.js.map +1 -1
  170. package/dist/config/sanitize.d.ts.map +1 -1
  171. package/dist/config/sanitize.js +137 -13
  172. package/dist/config/sanitize.js.map +1 -1
  173. package/dist/config/types.d.ts +49 -20
  174. package/dist/config/types.d.ts.map +1 -1
  175. package/dist/config/types.js +1 -0
  176. package/dist/config/types.js.map +1 -1
  177. package/dist/errors/ValidationError.d.ts +1 -0
  178. package/dist/errors/ValidationError.d.ts.map +1 -1
  179. package/dist/errors/ValidationError.js.map +1 -1
  180. package/dist/exports/migrations.d.ts +5 -13
  181. package/dist/exports/migrations.d.ts.map +1 -1
  182. package/dist/exports/migrations.js +5 -13
  183. package/dist/exports/migrations.js.map +1 -1
  184. package/dist/exports/shared.d.ts +3 -2
  185. package/dist/exports/shared.d.ts.map +1 -1
  186. package/dist/exports/shared.js +3 -2
  187. package/dist/exports/shared.js.map +1 -1
  188. package/dist/fields/config/client.d.ts.map +1 -1
  189. package/dist/fields/config/client.js +10 -3
  190. package/dist/fields/config/client.js.map +1 -1
  191. package/dist/fields/config/types.d.ts +13 -1
  192. package/dist/fields/config/types.d.ts.map +1 -1
  193. package/dist/fields/config/types.js.map +1 -1
  194. package/dist/fields/hooks/afterRead/promise.d.ts.map +1 -1
  195. package/dist/fields/hooks/afterRead/promise.js +10 -1
  196. package/dist/fields/hooks/afterRead/promise.js.map +1 -1
  197. package/dist/fields/hooks/beforeChange/promise.d.ts.map +1 -1
  198. package/dist/fields/hooks/beforeChange/promise.js.map +1 -1
  199. package/dist/fields/hooks/beforeValidate/promise.d.ts.map +1 -1
  200. package/dist/fields/hooks/beforeValidate/promise.js +10 -1
  201. package/dist/fields/hooks/beforeValidate/promise.js.map +1 -1
  202. package/dist/globals/config/sanitize.d.ts.map +1 -1
  203. package/dist/globals/config/sanitize.js +1 -6
  204. package/dist/globals/config/sanitize.js.map +1 -1
  205. package/dist/globals/endpoints/update.d.ts.map +1 -1
  206. package/dist/globals/endpoints/update.js +0 -2
  207. package/dist/globals/endpoints/update.js.map +1 -1
  208. package/dist/globals/operations/local/countVersions.d.ts +3 -3
  209. package/dist/globals/operations/local/countVersions.d.ts.map +1 -1
  210. package/dist/globals/operations/local/countVersions.js.map +1 -1
  211. package/dist/globals/operations/local/findOne.d.ts +3 -3
  212. package/dist/globals/operations/local/findOne.d.ts.map +1 -1
  213. package/dist/globals/operations/local/findOne.js.map +1 -1
  214. package/dist/globals/operations/local/findVersionByID.d.ts +3 -3
  215. package/dist/globals/operations/local/findVersionByID.d.ts.map +1 -1
  216. package/dist/globals/operations/local/findVersionByID.js.map +1 -1
  217. package/dist/globals/operations/local/findVersions.d.ts +3 -3
  218. package/dist/globals/operations/local/findVersions.d.ts.map +1 -1
  219. package/dist/globals/operations/local/findVersions.js.map +1 -1
  220. package/dist/globals/operations/local/restoreVersion.d.ts +3 -3
  221. package/dist/globals/operations/local/restoreVersion.d.ts.map +1 -1
  222. package/dist/globals/operations/local/restoreVersion.js.map +1 -1
  223. package/dist/globals/operations/local/update.d.ts +7 -9
  224. package/dist/globals/operations/local/update.d.ts.map +1 -1
  225. package/dist/globals/operations/local/update.js +1 -2
  226. package/dist/globals/operations/local/update.js.map +1 -1
  227. package/dist/globals/operations/update.d.ts +0 -1
  228. package/dist/globals/operations/update.d.ts.map +1 -1
  229. package/dist/globals/operations/update.js +52 -58
  230. package/dist/globals/operations/update.js.map +1 -1
  231. package/dist/index.bundled.d.ts +441 -311
  232. package/dist/index.d.ts +62 -15
  233. package/dist/index.d.ts.map +1 -1
  234. package/dist/index.js +4 -3
  235. package/dist/index.js.map +1 -1
  236. package/dist/preferences/keys.d.ts +4 -0
  237. package/dist/preferences/keys.d.ts.map +1 -1
  238. package/dist/preferences/keys.js +4 -1
  239. package/dist/preferences/keys.js.map +1 -1
  240. package/dist/preferences/types.d.ts +15 -0
  241. package/dist/preferences/types.d.ts.map +1 -1
  242. package/dist/preferences/types.js +3 -1
  243. package/dist/preferences/types.js.map +1 -1
  244. package/dist/query-presets/config.d.ts.map +1 -1
  245. package/dist/query-presets/config.js +73 -34
  246. package/dist/query-presets/config.js.map +1 -1
  247. package/dist/query-presets/constraints.d.ts.map +1 -1
  248. package/dist/query-presets/constraints.js +2 -1
  249. package/dist/query-presets/constraints.js.map +1 -1
  250. package/dist/types/index.d.ts +8 -3
  251. package/dist/types/index.d.ts.map +1 -1
  252. package/dist/types/index.js.map +1 -1
  253. package/dist/uploads/fetchAPI-multipart/processMultipart.d.ts.map +1 -1
  254. package/dist/uploads/fetchAPI-multipart/processMultipart.js +1 -14
  255. package/dist/uploads/fetchAPI-multipart/processMultipart.js.map +1 -1
  256. package/dist/uploads/matchMimeType.d.ts +8 -0
  257. package/dist/uploads/matchMimeType.d.ts.map +1 -0
  258. package/dist/uploads/matchMimeType.js +19 -0
  259. package/dist/uploads/matchMimeType.js.map +1 -0
  260. package/dist/uploads/matchMimeType.spec.js +66 -0
  261. package/dist/uploads/matchMimeType.spec.js.map +1 -0
  262. package/dist/uploads/types.d.ts +21 -0
  263. package/dist/uploads/types.d.ts.map +1 -1
  264. package/dist/uploads/types.js.map +1 -1
  265. package/dist/utilities/addDataAndFileToRequest.d.ts.map +1 -1
  266. package/dist/utilities/addDataAndFileToRequest.js +6 -0
  267. package/dist/utilities/addDataAndFileToRequest.js.map +1 -1
  268. package/dist/utilities/configToJSONSchema.d.ts +13 -4
  269. package/dist/utilities/configToJSONSchema.d.ts.map +1 -1
  270. package/dist/utilities/configToJSONSchema.js +138 -61
  271. package/dist/utilities/configToJSONSchema.js.map +1 -1
  272. package/dist/utilities/configToJSONSchema.spec.js +319 -0
  273. package/dist/utilities/configToJSONSchema.spec.js.map +1 -1
  274. package/dist/utilities/createLocalReq.d.ts +2 -2
  275. package/dist/utilities/createLocalReq.d.ts.map +1 -1
  276. package/dist/utilities/createLocalReq.js.map +1 -1
  277. package/dist/utilities/createPayloadRequest.d.ts.map +1 -1
  278. package/dist/utilities/createPayloadRequest.js +1 -0
  279. package/dist/utilities/createPayloadRequest.js.map +1 -1
  280. package/dist/utilities/deepCopyObject.d.ts.map +1 -1
  281. package/dist/utilities/deepCopyObject.js +8 -0
  282. package/dist/utilities/deepCopyObject.js.map +1 -1
  283. package/dist/utilities/getEntityPermissions/getEntityPermissions.d.ts.map +1 -1
  284. package/dist/utilities/getEntityPermissions/getEntityPermissions.js +2 -0
  285. package/dist/utilities/getEntityPermissions/getEntityPermissions.js.map +1 -1
  286. package/dist/utilities/getEntityPermissions/populateFieldPermissions.d.ts +7 -1
  287. package/dist/utilities/getEntityPermissions/populateFieldPermissions.d.ts.map +1 -1
  288. package/dist/utilities/getEntityPermissions/populateFieldPermissions.js +19 -2
  289. package/dist/utilities/getEntityPermissions/populateFieldPermissions.js.map +1 -1
  290. package/dist/utilities/getFieldByPath.d.ts.map +1 -1
  291. package/dist/utilities/getFieldByPath.js.map +1 -1
  292. package/dist/utilities/getVersionsConfig.js.map +1 -1
  293. package/dist/utilities/mergeLocalizedData.d.ts +14 -4
  294. package/dist/utilities/mergeLocalizedData.d.ts.map +1 -1
  295. package/dist/utilities/mergeLocalizedData.js +49 -34
  296. package/dist/utilities/mergeLocalizedData.js.map +1 -1
  297. package/dist/utilities/mergeLocalizedData.spec.js +23 -23
  298. package/dist/utilities/mergeLocalizedData.spec.js.map +1 -1
  299. package/dist/utilities/parseParams/index.d.ts +2 -5
  300. package/dist/utilities/parseParams/index.d.ts.map +1 -1
  301. package/dist/utilities/parseParams/index.js.map +1 -1
  302. package/dist/utilities/parseParams/index.spec.js +0 -9
  303. package/dist/utilities/parseParams/index.spec.js.map +1 -1
  304. package/dist/utilities/telemetry/conf/envPaths.d.ts.map +1 -1
  305. package/dist/utilities/telemetry/conf/envPaths.js +40 -31
  306. package/dist/utilities/telemetry/conf/envPaths.js.map +1 -1
  307. package/dist/utilities/traverseFields.d.ts.map +1 -1
  308. package/dist/utilities/traverseFields.js.map +1 -1
  309. package/dist/versions/baseFields.d.ts +1 -2
  310. package/dist/versions/baseFields.d.ts.map +1 -1
  311. package/dist/versions/baseFields.js +0 -13
  312. package/dist/versions/baseFields.js.map +1 -1
  313. package/dist/versions/buildCollectionFields.d.ts.map +1 -1
  314. package/dist/versions/buildCollectionFields.js +0 -2
  315. package/dist/versions/buildCollectionFields.js.map +1 -1
  316. package/dist/versions/buildGlobalFields.d.ts.map +1 -1
  317. package/dist/versions/buildGlobalFields.js +0 -2
  318. package/dist/versions/buildGlobalFields.js.map +1 -1
  319. package/dist/versions/buildSingleLocalePublishData.d.ts +32 -0
  320. package/dist/versions/buildSingleLocalePublishData.d.ts.map +1 -0
  321. package/dist/versions/buildSingleLocalePublishData.js +37 -0
  322. package/dist/versions/buildSingleLocalePublishData.js.map +1 -0
  323. package/dist/versions/saveVersion.d.ts +0 -2
  324. package/dist/versions/saveVersion.d.ts.map +1 -1
  325. package/dist/versions/saveVersion.js +12 -17
  326. package/dist/versions/saveVersion.js.map +1 -1
  327. package/dist/versions/schedule/job.d.ts.map +1 -1
  328. package/dist/versions/schedule/job.js +2 -9
  329. package/dist/versions/schedule/job.js.map +1 -1
  330. package/dist/versions/types.d.ts +2 -15
  331. package/dist/versions/types.d.ts.map +1 -1
  332. package/dist/versions/types.js.map +1 -1
  333. package/package.json +3 -3
  334. package/dist/database/migrations/templates/localizeStatus.d.ts +0 -10
  335. package/dist/database/migrations/templates/localizeStatus.d.ts.map +0 -1
  336. package/dist/database/migrations/templates/localizeStatus.js +0 -54
  337. package/dist/database/migrations/templates/localizeStatus.js.map +0 -1
  338. package/dist/utilities/isRSCEnabled.d.ts +0 -12
  339. package/dist/utilities/isRSCEnabled.d.ts.map +0 -1
  340. package/dist/utilities/isRSCEnabled.js +0 -14
  341. package/dist/utilities/isRSCEnabled.js.map +0 -1
  342. package/dist/versions/migrations/localizeStatus/index.d.ts +0 -12
  343. package/dist/versions/migrations/localizeStatus/index.d.ts.map +0 -1
  344. package/dist/versions/migrations/localizeStatus/index.js +0 -33
  345. package/dist/versions/migrations/localizeStatus/index.js.map +0 -1
  346. package/dist/versions/migrations/localizeStatus/mongo/down.d.ts +0 -9
  347. package/dist/versions/migrations/localizeStatus/mongo/down.d.ts.map +0 -1
  348. package/dist/versions/migrations/localizeStatus/mongo/down.js +0 -112
  349. package/dist/versions/migrations/localizeStatus/mongo/down.js.map +0 -1
  350. package/dist/versions/migrations/localizeStatus/mongo/index.d.ts +0 -8
  351. package/dist/versions/migrations/localizeStatus/mongo/index.d.ts.map +0 -1
  352. package/dist/versions/migrations/localizeStatus/mongo/index.js +0 -8
  353. package/dist/versions/migrations/localizeStatus/mongo/index.js.map +0 -1
  354. package/dist/versions/migrations/localizeStatus/mongo/up.d.ts +0 -9
  355. package/dist/versions/migrations/localizeStatus/mongo/up.d.ts.map +0 -1
  356. package/dist/versions/migrations/localizeStatus/mongo/up.js +0 -220
  357. package/dist/versions/migrations/localizeStatus/mongo/up.js.map +0 -1
  358. package/dist/versions/migrations/localizeStatus/sql/down.d.ts +0 -11
  359. package/dist/versions/migrations/localizeStatus/sql/down.d.ts.map +0 -1
  360. package/dist/versions/migrations/localizeStatus/sql/down.js +0 -213
  361. package/dist/versions/migrations/localizeStatus/sql/down.js.map +0 -1
  362. package/dist/versions/migrations/localizeStatus/sql/index.d.ts +0 -8
  363. package/dist/versions/migrations/localizeStatus/sql/index.d.ts.map +0 -1
  364. package/dist/versions/migrations/localizeStatus/sql/index.js +0 -8
  365. package/dist/versions/migrations/localizeStatus/sql/index.js.map +0 -1
  366. package/dist/versions/migrations/localizeStatus/sql/migrateMainCollection.d.ts +0 -13
  367. package/dist/versions/migrations/localizeStatus/sql/migrateMainCollection.d.ts.map +0 -1
  368. package/dist/versions/migrations/localizeStatus/sql/migrateMainCollection.js +0 -51
  369. package/dist/versions/migrations/localizeStatus/sql/migrateMainCollection.js.map +0 -1
  370. package/dist/versions/migrations/localizeStatus/sql/migrateMainGlobal.d.ts +0 -13
  371. package/dist/versions/migrations/localizeStatus/sql/migrateMainGlobal.d.ts.map +0 -1
  372. package/dist/versions/migrations/localizeStatus/sql/migrateMainGlobal.js +0 -54
  373. package/dist/versions/migrations/localizeStatus/sql/migrateMainGlobal.js.map +0 -1
  374. package/dist/versions/migrations/localizeStatus/sql/up.d.ts +0 -11
  375. package/dist/versions/migrations/localizeStatus/sql/up.d.ts.map +0 -1
  376. package/dist/versions/migrations/localizeStatus/sql/up.js +0 -277
  377. package/dist/versions/migrations/localizeStatus/sql/up.js.map +0 -1
  378. package/dist/versions/saveSnapshot.d.ts +0 -18
  379. package/dist/versions/saveSnapshot.d.ts.map +0 -1
  380. package/dist/versions/saveSnapshot.js +0 -38
  381. package/dist/versions/saveSnapshot.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import type { PaginatedDocs } from '../../../database/types.js';
2
- import type { CollectionSlug, JoinQuery, Payload, PayloadTypes, RequestContext, TypedFallbackLocale, TypedLocale } from '../../../index.js';
3
- import type { Document, DraftTransformCollectionWithSelect, PayloadRequest, PopulateType, SelectType, Sort, TransformCollectionWithSelect, Where } from '../../../types/index.js';
2
+ import type { CollectionSlug, JoinQuery, Payload, PayloadTypes, RequestContext, TypedFallbackLocale, TypedLocale, User } from '../../../index.js';
3
+ import type { DraftTransformCollectionWithSelect, PayloadRequest, PopulateType, SelectType, Sort, TransformCollectionWithSelect, Where } from '../../../types/index.js';
4
4
  import type { DraftFlagFromCollectionSlug, SelectFromCollectionSlug } from '../../config/types.js';
5
5
  type BaseFindOptions<TSlug extends CollectionSlug, TSelect extends SelectType> = {
6
6
  /**
@@ -145,7 +145,7 @@ type BaseFindOptions<TSlug extends CollectionSlug, TSelect extends SelectType> =
145
145
  /**
146
146
  * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
147
147
  */
148
- user?: Document;
148
+ user?: null | User;
149
149
  /**
150
150
  * A filter [query](https://payloadcms.com/docs/queries/overview)
151
151
  */
@@ -1 +1 @@
1
- {"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/find.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,KAAK,EACV,cAAc,EAEd,SAAS,EACT,OAAO,EACP,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,WAAW,EACZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,QAAQ,EACR,kCAAkC,EAClC,cAAc,EACd,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,6BA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A;IAEf;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAED,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,cAAc,EAAE,OAAO,SAAS,UAAU,IAAI,eAAe,CAC7F,KAAK,EACL,OAAO,CACR,GACC,2BAA2B,CAAC,KAAK,CAAC,CAAA;AAGpC,MAAM,MAAM,WAAW,CAAC,KAAK,SAAS,cAAc,EAAE,OAAO,SAAS,UAAU,IAAI,OAAO,CACzF,KAAK,EACL,OAAO,CACR,CAAA;AAED,wBAAsB,SAAS,CAC7B,KAAK,SAAS,cAAc,EAC5B,OAAO,SAAS,wBAAwB,CAAC,KAAK,CAAC,EAC/C,MAAM,SAAS,OAAO,GAAG,KAAK,EAE9B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,GACxD,OAAO,CACR,aAAa,CACX,MAAM,SAAS,IAAI,GACf,YAAY,SAAS;IAAE,gBAAgB,EAAE,IAAI,CAAA;CAAE,GAC7C,kCAAkC,CAAC,KAAK,EAAE,OAAO,CAAC,GAClD,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,GAC/C,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,CAClD,CACF,CAiDA"}
1
+ {"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/find.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,OAAO,EACP,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,WAAW,EACX,IAAI,EACL,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,kCAAkC,EAClC,cAAc,EACd,YAAY,EACZ,UAAU,EACV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,EAAE,OAAO,CAAA;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAED,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,cAAc,EAAE,OAAO,SAAS,UAAU,IAAI,eAAe,CAC7F,KAAK,EACL,OAAO,CACR,GACC,2BAA2B,CAAC,KAAK,CAAC,CAAA;AAGpC,MAAM,MAAM,WAAW,CAAC,KAAK,SAAS,cAAc,EAAE,OAAO,SAAS,UAAU,IAAI,OAAO,CACzF,KAAK,EACL,OAAO,CACR,CAAA;AAED,wBAAsB,SAAS,CAC7B,KAAK,SAAS,cAAc,EAC5B,OAAO,SAAS,wBAAwB,CAAC,KAAK,CAAC,EAC/C,MAAM,SAAS,OAAO,GAAG,KAAK,EAE9B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,GACxD,OAAO,CACR,aAAa,CACX,MAAM,SAAS,IAAI,GACf,YAAY,SAAS;IAAE,gBAAgB,EAAE,IAAI,CAAA;CAAE,GAC7C,kCAAkC,CAAC,KAAK,EAAE,OAAO,CAAC,GAClD,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,GAC/C,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,CAClD,CACF,CAiDA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/collections/operations/local/find.ts"],"sourcesContent":["import type { PaginatedDocs } from '../../../database/types.js'\nimport type {\n CollectionSlug,\n GeneratedTypes,\n JoinQuery,\n Payload,\n PayloadTypes,\n RequestContext,\n TypedFallbackLocale,\n TypedLocale,\n} from '../../../index.js'\nimport type {\n Document,\n DraftTransformCollectionWithSelect,\n PayloadRequest,\n PopulateType,\n SelectType,\n Sort,\n TransformCollectionWithSelect,\n Where,\n} from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type { DraftFlagFromCollectionSlug, SelectFromCollectionSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { findOperation } from '../find.js'\n\ntype BaseFindOptions<TSlug extends CollectionSlug, TSelect extends SelectType> = {\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * The current population depth, used internally for relationships population.\n * @internal\n */\n currentDepth?: number\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * When set to `true`, errors will not be thrown.\n */\n disableErrors?: boolean\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: TypedFallbackLocale\n /**\n * Include info about the lock status to the result into all documents with fields: `_isLocked` and `_userEditing`\n */\n includeLockStatus?: boolean\n /**\n * The [Join Field Query](https://payloadcms.com/docs/fields/join#query-options).\n * Pass `false` to disable all join fields from the result.\n */\n joins?: JoinQuery<TSlug>\n /**\n * The maximum related documents to be returned.\n * Defaults unless `defaultLimit` is specified for the collection config\n * @default 10\n */\n limit?: number\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * Get a specific page number\n * @default 1\n */\n page?: number\n /**\n * Set to `false` to return all documents and avoid querying for document counts which introduces some overhead.\n * You can also combine that property with a specified `limit` to limit documents but avoid the count query.\n */\n pagination?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * By default, Payload's APIs will return all fields for a given collection or global.\n * But you may not need all of that data for all of your queries.\n * Sometimes, you might want just a few fields from the response.\n *\n * With the Select API, you can define exactly which fields you'd like to retrieve.\n * This can impact performance by reducing database load and response size.\n *\n *\n * **Example: Select specific fields**\n * ```ts\n * const post = await payload.findByID({\n * collection: 'posts',\n * id: '1',\n * select: { title: true, content: true },\n * })\n *\n * console.log(post) // { id: '1', title: 'My Post', content: 'This is my post' }\n * ```\n *\n * **Example: Select all fields except `content`**\n *\n * ```ts\n * const post = await payload.findByID({\n * collection: 'posts',\n * id: '1',\n * select: { content: false },\n * })\n *\n * console.log(post) // { id: '1', title: 'My Post', number: 3 }\n * ```\n *\n * **Example: Empty select returns only `id`**\n *\n * ```ts\n * const post = await payload.findByID({\n * collection: 'posts',\n * id: '1',\n * select: {},\n * })\n *\n * console.log(post) // { id: '1' }\n * ```\n *\n * @see https://payloadcms.com/docs/queries/select\n */\n select?: TSelect\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * Sort the documents, can be a string or an array of strings\n * @example '-createdAt' // Sort DESC by createdAt\n * @example ['group', '-createdAt'] // sort by 2 fields, ASC group and DESC createdAt\n */\n sort?: Sort\n /**\n * When set to `true`, the query will include both normal and trashed documents.\n * To query only trashed documents, pass `trash: true` and combine with a `where` clause filtering by `deletedAt`.\n * By default (`false`), the query will only include normal documents and exclude those with a `deletedAt` field.\n *\n * This argument has no effect unless `trash` is enabled on the collection.\n * @default false\n */\n trash?: boolean\n // TODO: Strongly type User as TypedUser (= User in v4.0)\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: Document\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: Where\n}\n\nexport type Options<TSlug extends CollectionSlug, TSelect extends SelectType> = BaseFindOptions<\n TSlug,\n TSelect\n> &\n DraftFlagFromCollectionSlug<TSlug>\n\n// Backward compatibility export\nexport type FindOptions<TSlug extends CollectionSlug, TSelect extends SelectType> = Options<\n TSlug,\n TSelect\n>\n\nexport async function findLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n TDraft extends boolean = false,\n>(\n payload: Payload,\n options: { draft?: TDraft } & FindOptions<TSlug, TSelect>,\n): Promise<\n PaginatedDocs<\n TDraft extends true\n ? PayloadTypes extends { strictDraftTypes: true }\n ? DraftTransformCollectionWithSelect<TSlug, TSelect>\n : TransformCollectionWithSelect<TSlug, TSelect>\n : TransformCollectionWithSelect<TSlug, TSelect>\n >\n> {\n const {\n collection: collectionSlug,\n currentDepth,\n depth,\n disableErrors,\n draft = false,\n includeLockStatus,\n joins,\n limit,\n overrideAccess = true,\n page,\n pagination = true,\n populate,\n select,\n showHiddenFields,\n sort,\n trash = false,\n where,\n } = options\n\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(collectionSlug)} can't be found. Find Operation.`,\n )\n }\n\n return findOperation<TSlug, TSelect>({\n collection,\n currentDepth,\n depth,\n disableErrors,\n draft,\n includeLockStatus,\n joins,\n limit,\n overrideAccess,\n page,\n pagination,\n populate,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n select,\n showHiddenFields,\n sort,\n trash,\n where,\n })\n}\n"],"names":["APIError","createLocalReq","findOperation","findLocal","payload","options","collection","collectionSlug","currentDepth","depth","disableErrors","draft","includeLockStatus","joins","limit","overrideAccess","page","pagination","populate","select","showHiddenFields","sort","trash","where","collections","String","req"],"mappings":"AAwBA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,aAAa,QAAQ,aAAY;AAqK1C,OAAO,eAAeC,UAKpBC,OAAgB,EAChBC,OAAyD;IAUzD,MAAM,EACJC,YAAYC,cAAc,EAC1BC,YAAY,EACZC,KAAK,EACLC,aAAa,EACbC,QAAQ,KAAK,EACbC,iBAAiB,EACjBC,KAAK,EACLC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,IAAI,EACJC,aAAa,IAAI,EACjBC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EAChBC,IAAI,EACJC,QAAQ,KAAK,EACbC,KAAK,EACN,GAAGlB;IAEJ,MAAMC,aAAaF,QAAQoB,WAAW,CAACjB,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIN,SACR,CAAC,yBAAyB,EAAEyB,OAAOlB,gBAAgB,gCAAgC,CAAC;IAExF;IAEA,OAAOL,cAA8B;QACnCI;QACAE;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAQ,KAAK,MAAMzB,eAAeI,SAAkCD;QAC5De;QACAC;QACAC;QACAC;QACAC;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../src/collections/operations/local/find.ts"],"sourcesContent":["import type { PaginatedDocs } from '../../../database/types.js'\nimport type {\n CollectionSlug,\n JoinQuery,\n Payload,\n PayloadTypes,\n RequestContext,\n TypedFallbackLocale,\n TypedLocale,\n User,\n} from '../../../index.js'\nimport type {\n DraftTransformCollectionWithSelect,\n PayloadRequest,\n PopulateType,\n SelectType,\n Sort,\n TransformCollectionWithSelect,\n Where,\n} from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type { DraftFlagFromCollectionSlug, SelectFromCollectionSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { findOperation } from '../find.js'\n\ntype BaseFindOptions<TSlug extends CollectionSlug, TSelect extends SelectType> = {\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * The current population depth, used internally for relationships population.\n * @internal\n */\n currentDepth?: number\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * When set to `true`, errors will not be thrown.\n */\n disableErrors?: boolean\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: TypedFallbackLocale\n /**\n * Include info about the lock status to the result into all documents with fields: `_isLocked` and `_userEditing`\n */\n includeLockStatus?: boolean\n /**\n * The [Join Field Query](https://payloadcms.com/docs/fields/join#query-options).\n * Pass `false` to disable all join fields from the result.\n */\n joins?: JoinQuery<TSlug>\n /**\n * The maximum related documents to be returned.\n * Defaults unless `defaultLimit` is specified for the collection config\n * @default 10\n */\n limit?: number\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * Get a specific page number\n * @default 1\n */\n page?: number\n /**\n * Set to `false` to return all documents and avoid querying for document counts which introduces some overhead.\n * You can also combine that property with a specified `limit` to limit documents but avoid the count query.\n */\n pagination?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * By default, Payload's APIs will return all fields for a given collection or global.\n * But you may not need all of that data for all of your queries.\n * Sometimes, you might want just a few fields from the response.\n *\n * With the Select API, you can define exactly which fields you'd like to retrieve.\n * This can impact performance by reducing database load and response size.\n *\n *\n * **Example: Select specific fields**\n * ```ts\n * const post = await payload.findByID({\n * collection: 'posts',\n * id: '1',\n * select: { title: true, content: true },\n * })\n *\n * console.log(post) // { id: '1', title: 'My Post', content: 'This is my post' }\n * ```\n *\n * **Example: Select all fields except `content`**\n *\n * ```ts\n * const post = await payload.findByID({\n * collection: 'posts',\n * id: '1',\n * select: { content: false },\n * })\n *\n * console.log(post) // { id: '1', title: 'My Post', number: 3 }\n * ```\n *\n * **Example: Empty select returns only `id`**\n *\n * ```ts\n * const post = await payload.findByID({\n * collection: 'posts',\n * id: '1',\n * select: {},\n * })\n *\n * console.log(post) // { id: '1' }\n * ```\n *\n * @see https://payloadcms.com/docs/queries/select\n */\n select?: TSelect\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * Sort the documents, can be a string or an array of strings\n * @example '-createdAt' // Sort DESC by createdAt\n * @example ['group', '-createdAt'] // sort by 2 fields, ASC group and DESC createdAt\n */\n sort?: Sort\n /**\n * When set to `true`, the query will include both normal and trashed documents.\n * To query only trashed documents, pass `trash: true` and combine with a `where` clause filtering by `deletedAt`.\n * By default (`false`), the query will only include normal documents and exclude those with a `deletedAt` field.\n *\n * This argument has no effect unless `trash` is enabled on the collection.\n * @default false\n */\n trash?: boolean\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: null | User\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: Where\n}\n\nexport type Options<TSlug extends CollectionSlug, TSelect extends SelectType> = BaseFindOptions<\n TSlug,\n TSelect\n> &\n DraftFlagFromCollectionSlug<TSlug>\n\n// Backward compatibility export\nexport type FindOptions<TSlug extends CollectionSlug, TSelect extends SelectType> = Options<\n TSlug,\n TSelect\n>\n\nexport async function findLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n TDraft extends boolean = false,\n>(\n payload: Payload,\n options: { draft?: TDraft } & FindOptions<TSlug, TSelect>,\n): Promise<\n PaginatedDocs<\n TDraft extends true\n ? PayloadTypes extends { strictDraftTypes: true }\n ? DraftTransformCollectionWithSelect<TSlug, TSelect>\n : TransformCollectionWithSelect<TSlug, TSelect>\n : TransformCollectionWithSelect<TSlug, TSelect>\n >\n> {\n const {\n collection: collectionSlug,\n currentDepth,\n depth,\n disableErrors,\n draft = false,\n includeLockStatus,\n joins,\n limit,\n overrideAccess = true,\n page,\n pagination = true,\n populate,\n select,\n showHiddenFields,\n sort,\n trash = false,\n where,\n } = options\n\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(collectionSlug)} can't be found. Find Operation.`,\n )\n }\n\n return findOperation<TSlug, TSelect>({\n collection,\n currentDepth,\n depth,\n disableErrors,\n draft,\n includeLockStatus,\n joins,\n limit,\n overrideAccess,\n page,\n pagination,\n populate,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n select,\n showHiddenFields,\n sort,\n trash,\n where,\n })\n}\n"],"names":["APIError","createLocalReq","findOperation","findLocal","payload","options","collection","collectionSlug","currentDepth","depth","disableErrors","draft","includeLockStatus","joins","limit","overrideAccess","page","pagination","populate","select","showHiddenFields","sort","trash","where","collections","String","req"],"mappings":"AAuBA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,aAAa,QAAQ,aAAY;AAoK1C,OAAO,eAAeC,UAKpBC,OAAgB,EAChBC,OAAyD;IAUzD,MAAM,EACJC,YAAYC,cAAc,EAC1BC,YAAY,EACZC,KAAK,EACLC,aAAa,EACbC,QAAQ,KAAK,EACbC,iBAAiB,EACjBC,KAAK,EACLC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,IAAI,EACJC,aAAa,IAAI,EACjBC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EAChBC,IAAI,EACJC,QAAQ,KAAK,EACbC,KAAK,EACN,GAAGlB;IAEJ,MAAMC,aAAaF,QAAQoB,WAAW,CAACjB,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIN,SACR,CAAC,yBAAyB,EAAEyB,OAAOlB,gBAAgB,gCAAgC,CAAC;IAExF;IAEA,OAAOL,cAA8B;QACnCI;QACAE;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAQ,KAAK,MAAMzB,eAAeI,SAAkCD;QAC5De;QACAC;QACAC;QACAC;QACAC;IACF;AACF"}
@@ -1,5 +1,5 @@
1
- import type { CollectionSlug, FindOptions, JoinQuery, Payload, RequestContext, SelectType, TypedFallbackLocale, TypedLocale } from '../../../index.js';
2
- import type { ApplyDisableErrors, Document, PayloadRequest, PopulateType, TransformCollectionWithSelect } from '../../../types/index.js';
1
+ import type { CollectionSlug, FindOptions, JoinQuery, Payload, RequestContext, SelectType, TypedFallbackLocale, TypedLocale, User } from '../../../index.js';
2
+ import type { ApplyDisableErrors, PayloadRequest, PopulateType, TransformCollectionWithSelect } from '../../../types/index.js';
3
3
  import type { DraftFlagFromCollectionSlug, SelectFromCollectionSlug } from '../../config/types.js';
4
4
  import { type FindByIDArgs } from '../findByID.js';
5
5
  type BaseFindByIDOptions<TSlug extends CollectionSlug, TDisableErrors extends boolean, TSelect extends SelectType> = {
@@ -86,7 +86,7 @@ type BaseFindByIDOptions<TSlug extends CollectionSlug, TDisableErrors extends bo
86
86
  /**
87
87
  * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
88
88
  */
89
- user?: Document;
89
+ user?: null | User;
90
90
  } & Pick<FindByIDArgs, 'flattenLocales'> & Pick<FindOptions<TSlug, TSelect>, 'select'>;
91
91
  export type Options<TSlug extends CollectionSlug, TDisableErrors extends boolean, TSelect extends SelectType> = BaseFindByIDOptions<TSlug, TDisableErrors, TSelect> & DraftFlagFromCollectionSlug<TSlug>;
92
92
  export declare function findByIDLocal<TSlug extends CollectionSlug, TDisableErrors extends boolean, TSelect extends SelectFromCollectionSlug<TSlug>>(payload: Payload, options: Options<TSlug, TDisableErrors, TSelect>): Promise<ApplyDisableErrors<TransformCollectionWithSelect<TSlug, TSelect>, TDisableErrors>>;
@@ -1 +1 @@
1
- {"version":3,"file":"findByID.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/findByID.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,SAAS,EACT,OAAO,EACP,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,WAAW,EACZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,kBAAkB,EAClB,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,6BAA6B,EAC9B,MAAM,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EAAE,2BAA2B,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAIlG,OAAO,EAAE,KAAK,YAAY,EAAqB,MAAM,gBAAgB,CAAA;AAErE,KAAK,mBAAmB,CACtB,KAAK,SAAS,cAAc,EAC5B,cAAc,SAAS,OAAO,EAC9B,OAAO,SAAS,UAAU,IACxB;IACF;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,aAAa,CAAC,EAAE,cAAc,CAAA;IAC9B;;OAEG;IACH,cAAc,CAAC,EAAE,mBAAmB,CAAA;IACpC;;OAEG;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;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;CACnB,GAAG,IAAI,CAAC,YAAY,EAAE,gBAAgB,CAAC,GACtC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAA;AAE7C,MAAM,MAAM,OAAO,CACjB,KAAK,SAAS,cAAc,EAC5B,cAAc,SAAS,OAAO,EAC9B,OAAO,SAAS,UAAU,IACxB,mBAAmB,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,CAAC,GAAG,2BAA2B,CAAC,KAAK,CAAC,CAAA;AAE5F,wBAAsB,aAAa,CACjC,KAAK,SAAS,cAAc,EAC5B,cAAc,SAAS,OAAO,EAC9B,OAAO,SAAS,wBAAwB,CAAC,KAAK,CAAC,EAE/C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,CAAC,GAC/C,OAAO,CAAC,kBAAkB,CAAC,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC,CA6C5F"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/collections/operations/local/findByID.ts"],"sourcesContent":["import type {\n CollectionSlug,\n FindOptions,\n JoinQuery,\n Payload,\n RequestContext,\n SelectType,\n TypedFallbackLocale,\n TypedLocale,\n} from '../../../index.js'\nimport type {\n ApplyDisableErrors,\n Document,\n PayloadRequest,\n PopulateType,\n TransformCollectionWithSelect,\n} from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type { DraftFlagFromCollectionSlug, SelectFromCollectionSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { type FindByIDArgs, findByIDOperation } from '../findByID.js'\n\ntype BaseFindByIDOptions<\n TSlug extends CollectionSlug,\n TDisableErrors extends boolean,\n TSelect extends SelectType,\n> = {\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * The current population depth, used internally for relationships population.\n * @internal\n */\n currentDepth?: number\n /**\n * You may pass the document data directly which will skip the `db.findOne` database query.\n * This is useful if you want to use this endpoint solely for running hooks and populating data.\n */\n data?: Record<string, unknown>\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * When set to `true`, errors will not be thrown.\n * `null` will be returned instead, if the document on this ID was not found.\n */\n disableErrors?: TDisableErrors\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: TypedFallbackLocale\n /**\n * The ID of the document to find.\n */\n id: number | string\n /**\n * Include info about the lock status to the result with fields: `_isLocked` and `_userEditing`\n */\n includeLockStatus?: boolean\n /**\n * The [Join Field Query](https://payloadcms.com/docs/fields/join#query-options).\n * Pass `false` to disable all join fields from the result.\n */\n joins?: JoinQuery<TSlug>\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * When set to `true`, the operation will return a document by ID, even if it is trashed (soft-deleted).\n * By default (`false`), the operation will exclude trashed documents.\n * To fetch a trashed document, set `trash: true`.\n *\n * This argument has no effect unless `trash` is enabled on the collection.\n * @default false\n */\n trash?: boolean\n // TODO: Strongly type User as TypedUser (= User in v4.0)\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: Document\n} & Pick<FindByIDArgs, 'flattenLocales'> &\n Pick<FindOptions<TSlug, TSelect>, 'select'>\n\nexport type Options<\n TSlug extends CollectionSlug,\n TDisableErrors extends boolean,\n TSelect extends SelectType,\n> = BaseFindByIDOptions<TSlug, TDisableErrors, TSelect> & DraftFlagFromCollectionSlug<TSlug>\n\nexport async function findByIDLocal<\n TSlug extends CollectionSlug,\n TDisableErrors extends boolean,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TDisableErrors, TSelect>,\n): Promise<ApplyDisableErrors<TransformCollectionWithSelect<TSlug, TSelect>, TDisableErrors>> {\n const {\n id,\n collection: collectionSlug,\n currentDepth,\n data,\n depth,\n disableErrors = false,\n draft = false,\n flattenLocales,\n includeLockStatus,\n joins,\n overrideAccess = true,\n populate,\n select,\n showHiddenFields,\n trash = false,\n } = options\n\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(collectionSlug)} can't be found. Find By ID Operation.`,\n )\n }\n\n return findByIDOperation<TSlug, TDisableErrors, TSelect>({\n id,\n collection,\n currentDepth,\n data,\n depth,\n disableErrors,\n draft,\n flattenLocales,\n includeLockStatus,\n joins,\n overrideAccess,\n populate,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n select,\n showHiddenFields,\n trash,\n })\n}\n"],"names":["APIError","createLocalReq","findByIDOperation","findByIDLocal","payload","options","id","collection","collectionSlug","currentDepth","data","depth","disableErrors","draft","flattenLocales","includeLockStatus","joins","overrideAccess","populate","select","showHiddenFields","trash","collections","String","req"],"mappings":"AAoBA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAA4BC,iBAAiB,QAAQ,iBAAgB;AAqGrE,OAAO,eAAeC,cAKpBC,OAAgB,EAChBC,OAAgD;IAEhD,MAAM,EACJC,EAAE,EACFC,YAAYC,cAAc,EAC1BC,YAAY,EACZC,IAAI,EACJC,KAAK,EACLC,gBAAgB,KAAK,EACrBC,QAAQ,KAAK,EACbC,cAAc,EACdC,iBAAiB,EACjBC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EAChBC,QAAQ,KAAK,EACd,GAAGhB;IAEJ,MAAME,aAAaH,QAAQkB,WAAW,CAACd,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIP,SACR,CAAC,yBAAyB,EAAEuB,OAAOf,gBAAgB,sCAAsC,CAAC;IAE9F;IAEA,OAAON,kBAAkD;QACvDI;QACAC;QACAE;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAM,KAAK,MAAMvB,eAAeI,SAAkCD;QAC5De;QACAC;QACAC;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../src/collections/operations/local/findByID.ts"],"sourcesContent":["import type {\n CollectionSlug,\n FindOptions,\n JoinQuery,\n Payload,\n RequestContext,\n SelectType,\n TypedFallbackLocale,\n TypedLocale,\n User,\n} from '../../../index.js'\nimport type {\n ApplyDisableErrors,\n PayloadRequest,\n PopulateType,\n TransformCollectionWithSelect,\n} from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type { DraftFlagFromCollectionSlug, SelectFromCollectionSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { type FindByIDArgs, findByIDOperation } from '../findByID.js'\n\ntype BaseFindByIDOptions<\n TSlug extends CollectionSlug,\n TDisableErrors extends boolean,\n TSelect extends SelectType,\n> = {\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * The current population depth, used internally for relationships population.\n * @internal\n */\n currentDepth?: number\n /**\n * You may pass the document data directly which will skip the `db.findOne` database query.\n * This is useful if you want to use this endpoint solely for running hooks and populating data.\n */\n data?: Record<string, unknown>\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * When set to `true`, errors will not be thrown.\n * `null` will be returned instead, if the document on this ID was not found.\n */\n disableErrors?: TDisableErrors\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: TypedFallbackLocale\n /**\n * The ID of the document to find.\n */\n id: number | string\n /**\n * Include info about the lock status to the result with fields: `_isLocked` and `_userEditing`\n */\n includeLockStatus?: boolean\n /**\n * The [Join Field Query](https://payloadcms.com/docs/fields/join#query-options).\n * Pass `false` to disable all join fields from the result.\n */\n joins?: JoinQuery<TSlug>\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * When set to `true`, the operation will return a document by ID, even if it is trashed (soft-deleted).\n * By default (`false`), the operation will exclude trashed documents.\n * To fetch a trashed document, set `trash: true`.\n *\n * This argument has no effect unless `trash` is enabled on the collection.\n * @default false\n */\n trash?: boolean\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: null | User\n} & Pick<FindByIDArgs, 'flattenLocales'> &\n Pick<FindOptions<TSlug, TSelect>, 'select'>\n\nexport type Options<\n TSlug extends CollectionSlug,\n TDisableErrors extends boolean,\n TSelect extends SelectType,\n> = BaseFindByIDOptions<TSlug, TDisableErrors, TSelect> & DraftFlagFromCollectionSlug<TSlug>\n\nexport async function findByIDLocal<\n TSlug extends CollectionSlug,\n TDisableErrors extends boolean,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TDisableErrors, TSelect>,\n): Promise<ApplyDisableErrors<TransformCollectionWithSelect<TSlug, TSelect>, TDisableErrors>> {\n const {\n id,\n collection: collectionSlug,\n currentDepth,\n data,\n depth,\n disableErrors = false,\n draft = false,\n flattenLocales,\n includeLockStatus,\n joins,\n overrideAccess = true,\n populate,\n select,\n showHiddenFields,\n trash = false,\n } = options\n\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(collectionSlug)} can't be found. Find By ID Operation.`,\n )\n }\n\n return findByIDOperation<TSlug, TDisableErrors, TSelect>({\n id,\n collection,\n currentDepth,\n data,\n depth,\n disableErrors,\n draft,\n flattenLocales,\n includeLockStatus,\n joins,\n overrideAccess,\n populate,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n select,\n showHiddenFields,\n trash,\n })\n}\n"],"names":["APIError","createLocalReq","findByIDOperation","findByIDLocal","payload","options","id","collection","collectionSlug","currentDepth","data","depth","disableErrors","draft","flattenLocales","includeLockStatus","joins","overrideAccess","populate","select","showHiddenFields","trash","collections","String","req"],"mappings":"AAoBA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAA4BC,iBAAiB,QAAQ,iBAAgB;AAoGrE,OAAO,eAAeC,cAKpBC,OAAgB,EAChBC,OAAgD;IAEhD,MAAM,EACJC,EAAE,EACFC,YAAYC,cAAc,EAC1BC,YAAY,EACZC,IAAI,EACJC,KAAK,EACLC,gBAAgB,KAAK,EACrBC,QAAQ,KAAK,EACbC,cAAc,EACdC,iBAAiB,EACjBC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EAChBC,QAAQ,KAAK,EACd,GAAGhB;IAEJ,MAAME,aAAaH,QAAQkB,WAAW,CAACd,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIP,SACR,CAAC,yBAAyB,EAAEuB,OAAOf,gBAAgB,sCAAsC,CAAC;IAE9F;IAEA,OAAON,kBAAkD;QACvDI;QACAC;QACAE;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAM,KAAK,MAAMvB,eAAeI,SAAkCD;QAC5De;QACAC;QACAC;IACF;AACF"}
@@ -1,4 +1,4 @@
1
- import type { CollectionSlug, DataFromCollectionSlug, Document, PaginatedDistinctDocs, Payload, PayloadRequest, PopulateType, RequestContext, Sort, TypedLocale, Where } from '../../../index.js';
1
+ import type { CollectionSlug, DataFromCollectionSlug, PaginatedDistinctDocs, Payload, PayloadRequest, PopulateType, RequestContext, Sort, TypedLocale, User, Where } from '../../../index.js';
2
2
  export type Options<TSlug extends CollectionSlug, TField extends keyof DataFromCollectionSlug<TSlug>> = {
3
3
  /**
4
4
  * the Collection slug to operate against.
@@ -75,7 +75,7 @@ export type Options<TSlug extends CollectionSlug, TField extends keyof DataFromC
75
75
  /**
76
76
  * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
77
77
  */
78
- user?: Document;
78
+ user?: null | User;
79
79
  /**
80
80
  * A filter [query](https://payloadcms.com/docs/queries/overview)
81
81
  */
@@ -1 +1 @@
1
- {"version":3,"file":"findDistinct.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/findDistinct.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,QAAQ,EACR,qBAAqB,EACrB,OAAO,EACP,cAAc,EACd,YAAY,EACZ,cAAc,EACd,IAAI,EACJ,WAAW,EACX,KAAK,EACN,MAAM,mBAAmB,CAAA;AAM1B,MAAM,MAAM,OAAO,CACjB,KAAK,SAAS,cAAc,EAC5B,MAAM,SAAS,MAAM,sBAAsB,CAAC,KAAK,CAAC,IAChD;IACF;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,KAAK,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC,GAAG,MAAM,CAAA;IAC7B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IAC5B;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,CAAA;IACX;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAED,wBAAsB,YAAY,CAChC,KAAK,SAAS,cAAc,EAC5B,MAAM,SAAS,MAAM,sBAAsB,CAAC,KAAK,CAAC,GAAG,MAAM,EAE3D,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,GAC9B,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAsCvF"}
1
+ {"version":3,"file":"findDistinct.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/findDistinct.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,OAAO,EACP,cAAc,EACd,YAAY,EACZ,cAAc,EACd,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,KAAK,EACN,MAAM,mBAAmB,CAAA;AAM1B,MAAM,MAAM,OAAO,CACjB,KAAK,SAAS,cAAc,EAC5B,MAAM,SAAS,MAAM,sBAAsB,CAAC,KAAK,CAAC,IAChD;IACF;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,KAAK,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC,GAAG,MAAM,CAAA;IAC7B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IAC5B;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,CAAA;IACX;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAED,wBAAsB,YAAY,CAChC,KAAK,SAAS,cAAc,EAC5B,MAAM,SAAS,MAAM,sBAAsB,CAAC,KAAK,CAAC,GAAG,MAAM,EAE3D,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,GAC9B,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAsCvF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/collections/operations/local/findDistinct.ts"],"sourcesContent":["import type {\n CollectionSlug,\n DataFromCollectionSlug,\n Document,\n PaginatedDistinctDocs,\n Payload,\n PayloadRequest,\n PopulateType,\n RequestContext,\n Sort,\n TypedLocale,\n Where,\n} from '../../../index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\n\nimport { APIError, createLocalReq } from '../../../index.js'\nimport { findDistinctOperation } from '../findDistinct.js'\n\nexport type Options<\n TSlug extends CollectionSlug,\n TField extends keyof DataFromCollectionSlug<TSlug>,\n> = {\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * When set to `true`, errors will not be thrown.\n */\n disableErrors?: boolean\n /**\n * The field to get distinct values for\n */\n field: ({} & string) | TField\n /**\n * The maximum distinct field values to be returned.\n * By default the operation returns all the values.\n */\n limit?: number\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * Get a specific page number (if limit is specified)\n * @default 1\n */\n page?: number\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * Sort the documents, can be a string or an array of strings\n * @example '-createdAt' // Sort DESC by createdAt\n * @example ['group', '-createdAt'] // sort by 2 fields, ASC group and DESC createdAt\n */\n sort?: Sort\n /**\n * When set to `true`, the query will include both normal and trashed documents.\n * To query only trashed documents, pass `trash: true` and combine with a `where` clause filtering by `deletedAt`.\n * By default (`false`), the query will only include normal documents and exclude those with a `deletedAt` field.\n *\n * This argument has no effect unless `trash` is enabled on the collection.\n * @default false\n */\n trash?: boolean\n // TODO: Strongly type User as TypedUser (= User in v4.0)\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: Document\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: Where\n}\n\nexport async function findDistinct<\n TSlug extends CollectionSlug,\n TField extends keyof DataFromCollectionSlug<TSlug> & string,\n>(\n payload: Payload,\n options: Options<TSlug, TField>,\n): Promise<PaginatedDistinctDocs<Record<TField, DataFromCollectionSlug<TSlug>[TField]>>> {\n const {\n collection: collectionSlug,\n depth = 0,\n disableErrors,\n field,\n limit,\n overrideAccess = true,\n page,\n populate,\n showHiddenFields,\n sort,\n trash = false,\n where,\n } = options\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(collectionSlug)} can't be found. Find Operation.`,\n )\n }\n\n return findDistinctOperation({\n collection,\n depth,\n disableErrors,\n field,\n limit,\n overrideAccess,\n page,\n populate,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n showHiddenFields,\n sort,\n trash,\n where,\n }) as Promise<PaginatedDistinctDocs<Record<TField, DataFromCollectionSlug<TSlug>[TField]>>>\n}\n"],"names":["APIError","createLocalReq","findDistinctOperation","findDistinct","payload","options","collection","collectionSlug","depth","disableErrors","field","limit","overrideAccess","page","populate","showHiddenFields","sort","trash","where","collections","String","req"],"mappings":"AAeA,SAASA,QAAQ,EAAEC,cAAc,QAAQ,oBAAmB;AAC5D,SAASC,qBAAqB,QAAQ,qBAAoB;AAyF1D,OAAO,eAAeC,aAIpBC,OAAgB,EAChBC,OAA+B;IAE/B,MAAM,EACJC,YAAYC,cAAc,EAC1BC,QAAQ,CAAC,EACTC,aAAa,EACbC,KAAK,EACLC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,IAAI,EACJC,QAAQ,EACRC,gBAAgB,EAChBC,IAAI,EACJC,QAAQ,KAAK,EACbC,KAAK,EACN,GAAGb;IACJ,MAAMC,aAAaF,QAAQe,WAAW,CAACZ,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIN,SACR,CAAC,yBAAyB,EAAEoB,OAAOb,gBAAgB,gCAAgC,CAAC;IAExF;IAEA,OAAOL,sBAAsB;QAC3BI;QACAE;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAO,KAAK,MAAMpB,eAAeI,SAAkCD;QAC5DW;QACAC;QACAC;QACAC;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../src/collections/operations/local/findDistinct.ts"],"sourcesContent":["import type {\n CollectionSlug,\n DataFromCollectionSlug,\n PaginatedDistinctDocs,\n Payload,\n PayloadRequest,\n PopulateType,\n RequestContext,\n Sort,\n TypedLocale,\n User,\n Where,\n} from '../../../index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\n\nimport { APIError, createLocalReq } from '../../../index.js'\nimport { findDistinctOperation } from '../findDistinct.js'\n\nexport type Options<\n TSlug extends CollectionSlug,\n TField extends keyof DataFromCollectionSlug<TSlug>,\n> = {\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * When set to `true`, errors will not be thrown.\n */\n disableErrors?: boolean\n /**\n * The field to get distinct values for\n */\n field: ({} & string) | TField\n /**\n * The maximum distinct field values to be returned.\n * By default the operation returns all the values.\n */\n limit?: number\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * Get a specific page number (if limit is specified)\n * @default 1\n */\n page?: number\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * Sort the documents, can be a string or an array of strings\n * @example '-createdAt' // Sort DESC by createdAt\n * @example ['group', '-createdAt'] // sort by 2 fields, ASC group and DESC createdAt\n */\n sort?: Sort\n /**\n * When set to `true`, the query will include both normal and trashed documents.\n * To query only trashed documents, pass `trash: true` and combine with a `where` clause filtering by `deletedAt`.\n * By default (`false`), the query will only include normal documents and exclude those with a `deletedAt` field.\n *\n * This argument has no effect unless `trash` is enabled on the collection.\n * @default false\n */\n trash?: boolean\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: null | User\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: Where\n}\n\nexport async function findDistinct<\n TSlug extends CollectionSlug,\n TField extends keyof DataFromCollectionSlug<TSlug> & string,\n>(\n payload: Payload,\n options: Options<TSlug, TField>,\n): Promise<PaginatedDistinctDocs<Record<TField, DataFromCollectionSlug<TSlug>[TField]>>> {\n const {\n collection: collectionSlug,\n depth = 0,\n disableErrors,\n field,\n limit,\n overrideAccess = true,\n page,\n populate,\n showHiddenFields,\n sort,\n trash = false,\n where,\n } = options\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(collectionSlug)} can't be found. Find Operation.`,\n )\n }\n\n return findDistinctOperation({\n collection,\n depth,\n disableErrors,\n field,\n limit,\n overrideAccess,\n page,\n populate,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n showHiddenFields,\n sort,\n trash,\n where,\n }) as Promise<PaginatedDistinctDocs<Record<TField, DataFromCollectionSlug<TSlug>[TField]>>>\n}\n"],"names":["APIError","createLocalReq","findDistinctOperation","findDistinct","payload","options","collection","collectionSlug","depth","disableErrors","field","limit","overrideAccess","page","populate","showHiddenFields","sort","trash","where","collections","String","req"],"mappings":"AAeA,SAASA,QAAQ,EAAEC,cAAc,QAAQ,oBAAmB;AAC5D,SAASC,qBAAqB,QAAQ,qBAAoB;AAwF1D,OAAO,eAAeC,aAIpBC,OAAgB,EAChBC,OAA+B;IAE/B,MAAM,EACJC,YAAYC,cAAc,EAC1BC,QAAQ,CAAC,EACTC,aAAa,EACbC,KAAK,EACLC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,IAAI,EACJC,QAAQ,EACRC,gBAAgB,EAChBC,IAAI,EACJC,QAAQ,KAAK,EACbC,KAAK,EACN,GAAGb;IACJ,MAAMC,aAAaF,QAAQe,WAAW,CAACZ,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIN,SACR,CAAC,yBAAyB,EAAEoB,OAAOb,gBAAgB,gCAAgC,CAAC;IAExF;IAEA,OAAOL,sBAAsB;QAC3BI;QACAE;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAO,KAAK,MAAMpB,eAAeI,SAAkCD;QAC5DW;QACAC;QACAC;QACAC;IACF;AACF"}
@@ -1,5 +1,5 @@
1
- import type { CollectionSlug, FindOptions, Payload, RequestContext, TypedLocale } from '../../../index.js';
2
- import type { Document, PayloadRequest, PopulateType, SelectType } from '../../../types/index.js';
1
+ import type { CollectionSlug, FindOptions, Payload, RequestContext, TypedLocale, User } from '../../../index.js';
2
+ import type { PayloadRequest, PopulateType, SelectType } from '../../../types/index.js';
3
3
  import type { TypeWithVersion } from '../../../versions/types.js';
4
4
  import type { DataFromCollectionSlug, DraftFlagFromCollectionSlug } from '../../config/types.js';
5
5
  type BaseOptions<TSlug extends CollectionSlug> = {
@@ -67,7 +67,7 @@ type BaseOptions<TSlug extends CollectionSlug> = {
67
67
  /**
68
68
  * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
69
69
  */
70
- user?: Document;
70
+ user?: null | User;
71
71
  } & Pick<FindOptions<TSlug, SelectType>, 'select'>;
72
72
  export type Options<TSlug extends CollectionSlug> = BaseOptions<TSlug> & DraftFlagFromCollectionSlug<TSlug>;
73
73
  export declare function findVersionByIDLocal<TSlug extends CollectionSlug>(payload: Payload, options: Options<TSlug>): Promise<TypeWithVersion<DataFromCollectionSlug<TSlug>>>;
@@ -1 +1 @@
1
- {"version":3,"file":"findVersionByID.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/findVersionByID.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,OAAO,EACP,cAAc,EACd,WAAW,EACZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEjG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAA;AAMhG,KAAK,WAAW,CAAC,KAAK,SAAS,cAAc,IAAI;IAC/C;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IACpC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IAC5B;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAA;CAChB,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAA;AAElD,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,cAAc,IAAI,WAAW,CAAC,KAAK,CAAC,GACpE,2BAA2B,CAAC,KAAK,CAAC,CAAA;AAEpC,wBAAsB,oBAAoB,CAAC,KAAK,SAAS,cAAc,EACrE,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,GACtB,OAAO,CAAC,eAAe,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC,CAmCzD"}
1
+ {"version":3,"file":"findVersionByID.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/findVersionByID.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,OAAO,EACP,cAAc,EACd,WAAW,EACX,IAAI,EACL,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEvF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAA;AAMhG,KAAK,WAAW,CAAC,KAAK,SAAS,cAAc,IAAI;IAC/C;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IACpC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IAC5B;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;CACnB,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAA;AAElD,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,cAAc,IAAI,WAAW,CAAC,KAAK,CAAC,GACpE,2BAA2B,CAAC,KAAK,CAAC,CAAA;AAEpC,wBAAsB,oBAAoB,CAAC,KAAK,SAAS,cAAc,EACrE,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,GACtB,OAAO,CAAC,eAAe,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC,CAmCzD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/collections/operations/local/findVersionByID.ts"],"sourcesContent":["import type {\n CollectionSlug,\n FindOptions,\n Payload,\n RequestContext,\n TypedLocale,\n} from '../../../index.js'\nimport type { Document, PayloadRequest, PopulateType, SelectType } from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type { TypeWithVersion } from '../../../versions/types.js'\nimport type { DataFromCollectionSlug, DraftFlagFromCollectionSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { findVersionByIDOperation } from '../findVersionByID.js'\n\ntype BaseOptions<TSlug extends CollectionSlug> = {\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * When set to `true`, errors will not be thrown.\n * `null` will be returned instead, if the document on this ID was not found.\n */\n disableErrors?: boolean\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: false | TypedLocale\n /**\n * The ID of the version to find.\n */\n id: string\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * When set to `true`, the operation will return a document by ID, even if it is trashed (soft-deleted).\n * By default (`false`), the operation will exclude trashed documents.\n * To fetch a trashed document, set `trash: true`.\n *\n * This argument has no effect unless `trash` is enabled on the collection.\n * @default false\n */\n trash?: boolean\n // TODO: Strongly type User as TypedUser (= User in v4.0)\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: Document\n} & Pick<FindOptions<TSlug, SelectType>, 'select'>\n\nexport type Options<TSlug extends CollectionSlug> = BaseOptions<TSlug> &\n DraftFlagFromCollectionSlug<TSlug>\n\nexport async function findVersionByIDLocal<TSlug extends CollectionSlug>(\n payload: Payload,\n options: Options<TSlug>,\n): Promise<TypeWithVersion<DataFromCollectionSlug<TSlug>>> {\n const {\n id,\n collection: collectionSlug,\n depth,\n disableErrors = false,\n overrideAccess = true,\n populate,\n select,\n showHiddenFields,\n trash = false,\n } = options\n\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(\n collectionSlug,\n )} can't be found. Find Version By ID Operation.`,\n )\n }\n\n return findVersionByIDOperation({\n id,\n collection,\n depth,\n disableErrors,\n overrideAccess,\n populate,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n select,\n showHiddenFields,\n trash,\n })\n}\n"],"names":["APIError","createLocalReq","findVersionByIDOperation","findVersionByIDLocal","payload","options","id","collection","collectionSlug","depth","disableErrors","overrideAccess","populate","select","showHiddenFields","trash","collections","String","req"],"mappings":"AAYA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,wBAAwB,QAAQ,wBAAuB;AA0EhE,OAAO,eAAeC,qBACpBC,OAAgB,EAChBC,OAAuB;IAEvB,MAAM,EACJC,EAAE,EACFC,YAAYC,cAAc,EAC1BC,KAAK,EACLC,gBAAgB,KAAK,EACrBC,iBAAiB,IAAI,EACrBC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EAChBC,QAAQ,KAAK,EACd,GAAGV;IAEJ,MAAME,aAAaH,QAAQY,WAAW,CAACR,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIP,SACR,CAAC,yBAAyB,EAAEiB,OAC1BT,gBACA,8CAA8C,CAAC;IAErD;IAEA,OAAON,yBAAyB;QAC9BI;QACAC;QACAE;QACAC;QACAC;QACAC;QACAM,KAAK,MAAMjB,eAAeI,SAAkCD;QAC5DS;QACAC;QACAC;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../src/collections/operations/local/findVersionByID.ts"],"sourcesContent":["import type {\n CollectionSlug,\n FindOptions,\n Payload,\n RequestContext,\n TypedLocale,\n User,\n} from '../../../index.js'\nimport type { PayloadRequest, PopulateType, SelectType } from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type { TypeWithVersion } from '../../../versions/types.js'\nimport type { DataFromCollectionSlug, DraftFlagFromCollectionSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { findVersionByIDOperation } from '../findVersionByID.js'\n\ntype BaseOptions<TSlug extends CollectionSlug> = {\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * When set to `true`, errors will not be thrown.\n * `null` will be returned instead, if the document on this ID was not found.\n */\n disableErrors?: boolean\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: false | TypedLocale\n /**\n * The ID of the version to find.\n */\n id: string\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * When set to `true`, the operation will return a document by ID, even if it is trashed (soft-deleted).\n * By default (`false`), the operation will exclude trashed documents.\n * To fetch a trashed document, set `trash: true`.\n *\n * This argument has no effect unless `trash` is enabled on the collection.\n * @default false\n */\n trash?: boolean\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: null | User\n} & Pick<FindOptions<TSlug, SelectType>, 'select'>\n\nexport type Options<TSlug extends CollectionSlug> = BaseOptions<TSlug> &\n DraftFlagFromCollectionSlug<TSlug>\n\nexport async function findVersionByIDLocal<TSlug extends CollectionSlug>(\n payload: Payload,\n options: Options<TSlug>,\n): Promise<TypeWithVersion<DataFromCollectionSlug<TSlug>>> {\n const {\n id,\n collection: collectionSlug,\n depth,\n disableErrors = false,\n overrideAccess = true,\n populate,\n select,\n showHiddenFields,\n trash = false,\n } = options\n\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(\n collectionSlug,\n )} can't be found. Find Version By ID Operation.`,\n )\n }\n\n return findVersionByIDOperation({\n id,\n collection,\n depth,\n disableErrors,\n overrideAccess,\n populate,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n select,\n showHiddenFields,\n trash,\n })\n}\n"],"names":["APIError","createLocalReq","findVersionByIDOperation","findVersionByIDLocal","payload","options","id","collection","collectionSlug","depth","disableErrors","overrideAccess","populate","select","showHiddenFields","trash","collections","String","req"],"mappings":"AAaA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,wBAAwB,QAAQ,wBAAuB;AAyEhE,OAAO,eAAeC,qBACpBC,OAAgB,EAChBC,OAAuB;IAEvB,MAAM,EACJC,EAAE,EACFC,YAAYC,cAAc,EAC1BC,KAAK,EACLC,gBAAgB,KAAK,EACrBC,iBAAiB,IAAI,EACrBC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EAChBC,QAAQ,KAAK,EACd,GAAGV;IAEJ,MAAME,aAAaH,QAAQY,WAAW,CAACR,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIP,SACR,CAAC,yBAAyB,EAAEiB,OAC1BT,gBACA,8CAA8C,CAAC;IAErD;IAEA,OAAON,yBAAyB;QAC9BI;QACAC;QACAE;QACAC;QACAC;QACAC;QACAM,KAAK,MAAMjB,eAAeI,SAAkCD;QAC5DS;QACAC;QACAC;IACF;AACF"}
@@ -1,6 +1,6 @@
1
1
  import type { PaginatedDocs } from '../../../database/types.js';
2
- import type { CollectionSlug, FindOptions, Payload, RequestContext, TypedLocale } from '../../../index.js';
3
- import type { Document, PayloadRequest, PopulateType, SelectType, Sort, Where } from '../../../types/index.js';
2
+ import type { CollectionSlug, FindOptions, Payload, RequestContext, TypedLocale, User } from '../../../index.js';
3
+ import type { PayloadRequest, PopulateType, SelectType, Sort, Where } from '../../../types/index.js';
4
4
  import type { TypeWithVersion } from '../../../versions/types.js';
5
5
  import type { DataFromCollectionSlug, DraftFlagFromCollectionSlug } from '../../config/types.js';
6
6
  type BaseOptions<TSlug extends CollectionSlug> = {
@@ -81,7 +81,7 @@ type BaseOptions<TSlug extends CollectionSlug> = {
81
81
  /**
82
82
  * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
83
83
  */
84
- user?: Document;
84
+ user?: null | User;
85
85
  /**
86
86
  * A filter [query](https://payloadcms.com/docs/queries/overview)
87
87
  */
@@ -1 +1 @@
1
- {"version":3,"file":"findVersions.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/findVersions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,OAAO,EACP,cAAc,EACd,WAAW,EACZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,KAAK,EACN,MAAM,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAA;AAMhG,KAAK,WAAW,CAAC,KAAK,SAAS,cAAc,IAAI;IAC/C;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IACpC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IAC5B;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,CAAA;IACX;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAA;AAElD,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,cAAc,IAAI,WAAW,CAAC,KAAK,CAAC,GACpE,2BAA2B,CAAC,KAAK,CAAC,CAAA;AAEpC,wBAAsB,iBAAiB,CAAC,KAAK,SAAS,cAAc,EAClE,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,GACtB,OAAO,CAAC,aAAa,CAAC,eAAe,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAuCxE"}
1
+ {"version":3,"file":"findVersions.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/findVersions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,OAAO,EACP,cAAc,EACd,WAAW,EACX,IAAI,EACL,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAEpG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAA;AAMhG,KAAK,WAAW,CAAC,KAAK,SAAS,cAAc,IAAI;IAC/C;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IACpC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IAC5B;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,CAAA;IACX;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAA;AAElD,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,cAAc,IAAI,WAAW,CAAC,KAAK,CAAC,GACpE,2BAA2B,CAAC,KAAK,CAAC,CAAA;AAEpC,wBAAsB,iBAAiB,CAAC,KAAK,SAAS,cAAc,EAClE,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,GACtB,OAAO,CAAC,aAAa,CAAC,eAAe,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAuCxE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/collections/operations/local/findVersions.ts"],"sourcesContent":["import type { PaginatedDocs } from '../../../database/types.js'\nimport type {\n CollectionSlug,\n FindOptions,\n Payload,\n RequestContext,\n TypedLocale,\n} from '../../../index.js'\nimport type {\n Document,\n PayloadRequest,\n PopulateType,\n SelectType,\n Sort,\n Where,\n} from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type { TypeWithVersion } from '../../../versions/types.js'\nimport type { DataFromCollectionSlug, DraftFlagFromCollectionSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { findVersionsOperation } from '../findVersions.js'\n\ntype BaseOptions<TSlug extends CollectionSlug> = {\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: false | TypedLocale\n /**\n * The maximum related documents to be returned.\n * Defaults unless `defaultLimit` is specified for the collection config\n * @default 10\n */\n limit?: number\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * Get a specific page number\n * @default 1\n */\n page?: number\n /**\n * Set to `false` to return all documents and avoid querying for document counts which introduces some overhead.\n * You can also combine that property with a specified `limit` to limit documents but avoid the count query.\n */\n pagination?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * Sort the documents, can be a string or an array of strings\n * @example '-version.createdAt' // Sort DESC by createdAt\n * @example ['version.group', '-version.createdAt'] // sort by 2 fields, ASC group and DESC createdAt\n */\n sort?: Sort\n /**\n * When set to `true`, the query will include both normal and trashed (soft-deleted) documents.\n * To query only trashed documents, pass `trash: true` and combine with a `where` clause filtering by `deletedAt`.\n * By default (`false`), the query will only include normal documents and exclude those with a `deletedAt` field.\n *\n * This argument has no effect unless `trash` is enabled on the collection.\n * @default false\n */\n trash?: boolean\n // TODO: Strongly type User as TypedUser (= User in v4.0)\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: Document\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: Where\n} & Pick<FindOptions<TSlug, SelectType>, 'select'>\n\nexport type Options<TSlug extends CollectionSlug> = BaseOptions<TSlug> &\n DraftFlagFromCollectionSlug<TSlug>\n\nexport async function findVersionsLocal<TSlug extends CollectionSlug>(\n payload: Payload,\n options: Options<TSlug>,\n): Promise<PaginatedDocs<TypeWithVersion<DataFromCollectionSlug<TSlug>>>> {\n const {\n collection: collectionSlug,\n depth,\n limit,\n overrideAccess = true,\n page,\n pagination = true,\n populate,\n select,\n showHiddenFields,\n sort,\n trash = false,\n where,\n } = options\n\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(collectionSlug)} can't be found. Find Versions Operation.`,\n )\n }\n\n return findVersionsOperation({\n collection,\n depth,\n limit,\n overrideAccess,\n page,\n pagination,\n populate,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n select,\n showHiddenFields,\n sort,\n trash,\n where,\n })\n}\n"],"names":["APIError","createLocalReq","findVersionsOperation","findVersionsLocal","payload","options","collection","collectionSlug","depth","limit","overrideAccess","page","pagination","populate","select","showHiddenFields","sort","trash","where","collections","String","req"],"mappings":"AAoBA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,qBAAqB,QAAQ,qBAAoB;AA2F1D,OAAO,eAAeC,kBACpBC,OAAgB,EAChBC,OAAuB;IAEvB,MAAM,EACJC,YAAYC,cAAc,EAC1BC,KAAK,EACLC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,IAAI,EACJC,aAAa,IAAI,EACjBC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EAChBC,IAAI,EACJC,QAAQ,KAAK,EACbC,KAAK,EACN,GAAGb;IAEJ,MAAMC,aAAaF,QAAQe,WAAW,CAACZ,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIN,SACR,CAAC,yBAAyB,EAAEoB,OAAOb,gBAAgB,yCAAyC,CAAC;IAEjG;IAEA,OAAOL,sBAAsB;QAC3BI;QACAE;QACAC;QACAC;QACAC;QACAC;QACAC;QACAQ,KAAK,MAAMpB,eAAeI,SAAkCD;QAC5DU;QACAC;QACAC;QACAC;QACAC;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../src/collections/operations/local/findVersions.ts"],"sourcesContent":["import type { PaginatedDocs } from '../../../database/types.js'\nimport type {\n CollectionSlug,\n FindOptions,\n Payload,\n RequestContext,\n TypedLocale,\n User,\n} from '../../../index.js'\nimport type { PayloadRequest, PopulateType, SelectType, Sort, Where } from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type { TypeWithVersion } from '../../../versions/types.js'\nimport type { DataFromCollectionSlug, DraftFlagFromCollectionSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { findVersionsOperation } from '../findVersions.js'\n\ntype BaseOptions<TSlug extends CollectionSlug> = {\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: false | TypedLocale\n /**\n * The maximum related documents to be returned.\n * Defaults unless `defaultLimit` is specified for the collection config\n * @default 10\n */\n limit?: number\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * Get a specific page number\n * @default 1\n */\n page?: number\n /**\n * Set to `false` to return all documents and avoid querying for document counts which introduces some overhead.\n * You can also combine that property with a specified `limit` to limit documents but avoid the count query.\n */\n pagination?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * Sort the documents, can be a string or an array of strings\n * @example '-version.createdAt' // Sort DESC by createdAt\n * @example ['version.group', '-version.createdAt'] // sort by 2 fields, ASC group and DESC createdAt\n */\n sort?: Sort\n /**\n * When set to `true`, the query will include both normal and trashed (soft-deleted) documents.\n * To query only trashed documents, pass `trash: true` and combine with a `where` clause filtering by `deletedAt`.\n * By default (`false`), the query will only include normal documents and exclude those with a `deletedAt` field.\n *\n * This argument has no effect unless `trash` is enabled on the collection.\n * @default false\n */\n trash?: boolean\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: null | User\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: Where\n} & Pick<FindOptions<TSlug, SelectType>, 'select'>\n\nexport type Options<TSlug extends CollectionSlug> = BaseOptions<TSlug> &\n DraftFlagFromCollectionSlug<TSlug>\n\nexport async function findVersionsLocal<TSlug extends CollectionSlug>(\n payload: Payload,\n options: Options<TSlug>,\n): Promise<PaginatedDocs<TypeWithVersion<DataFromCollectionSlug<TSlug>>>> {\n const {\n collection: collectionSlug,\n depth,\n limit,\n overrideAccess = true,\n page,\n pagination = true,\n populate,\n select,\n showHiddenFields,\n sort,\n trash = false,\n where,\n } = options\n\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(collectionSlug)} can't be found. Find Versions Operation.`,\n )\n }\n\n return findVersionsOperation({\n collection,\n depth,\n limit,\n overrideAccess,\n page,\n pagination,\n populate,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n select,\n showHiddenFields,\n sort,\n trash,\n where,\n })\n}\n"],"names":["APIError","createLocalReq","findVersionsOperation","findVersionsLocal","payload","options","collection","collectionSlug","depth","limit","overrideAccess","page","pagination","populate","select","showHiddenFields","sort","trash","where","collections","String","req"],"mappings":"AAcA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,qBAAqB,QAAQ,qBAAoB;AA0F1D,OAAO,eAAeC,kBACpBC,OAAgB,EAChBC,OAAuB;IAEvB,MAAM,EACJC,YAAYC,cAAc,EAC1BC,KAAK,EACLC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,IAAI,EACJC,aAAa,IAAI,EACjBC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EAChBC,IAAI,EACJC,QAAQ,KAAK,EACbC,KAAK,EACN,GAAGb;IAEJ,MAAMC,aAAaF,QAAQe,WAAW,CAACZ,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIN,SACR,CAAC,yBAAyB,EAAEoB,OAAOb,gBAAgB,yCAAyC,CAAC;IAEjG;IAEA,OAAOL,sBAAsB;QAC3BI;QACAE;QACAC;QACAC;QACAC;QACAC;QACAC;QACAQ,KAAK,MAAMpB,eAAeI,SAAkCD;QAC5DU;QACAC;QACAC;QACAC;QACAC;IACF;AACF"}
@@ -1,5 +1,5 @@
1
- import type { CollectionSlug, FindOptions, Payload, RequestContext, TypedLocale } from '../../../index.js';
2
- import type { Document, PayloadRequest, PopulateType, SelectType } from '../../../types/index.js';
1
+ import type { CollectionSlug, FindOptions, Payload, RequestContext, TypedLocale, User } from '../../../index.js';
2
+ import type { PayloadRequest, PopulateType, SelectType } from '../../../types/index.js';
3
3
  import type { DataFromCollectionSlug, DraftFlagFromCollectionSlug } from '../../config/types.js';
4
4
  type BaseOptions<TSlug extends CollectionSlug> = {
5
5
  /**
@@ -52,7 +52,7 @@ type BaseOptions<TSlug extends CollectionSlug> = {
52
52
  /**
53
53
  * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
54
54
  */
55
- user?: Document;
55
+ user?: null | User;
56
56
  } & Pick<FindOptions<TSlug, SelectType>, 'select'>;
57
57
  export type Options<TSlug extends CollectionSlug> = BaseOptions<TSlug> & DraftFlagFromCollectionSlug<TSlug>;
58
58
  export declare function restoreVersionLocal<TSlug extends CollectionSlug>(payload: Payload, options: Options<TSlug>): Promise<DataFromCollectionSlug<TSlug>>;
@@ -1 +1 @@
1
- {"version":3,"file":"restoreVersion.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/restoreVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EAC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restoreVersion.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/restoreVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,OAAO,EACP,cAAc,EACd,WAAW,EACX,IAAI,EACL,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEvF,OAAO,KAAK,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAA;AAMhG,KAAK,WAAW,CAAC,KAAK,SAAS,cAAc,IAAI;IAC/C;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IACpC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;CACnB,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAA;AAElD,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,cAAc,IAAI,WAAW,CAAC,KAAK,CAAC,GACpE,2BAA2B,CAAC,KAAK,CAAC,CAAA;AAEpC,wBAAsB,mBAAmB,CAAC,KAAK,SAAS,cAAc,EACpE,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,GACtB,OAAO,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAkCxC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/collections/operations/local/restoreVersion.ts"],"sourcesContent":["import type {\n CollectionSlug,\n FindOptions,\n Payload,\n RequestContext,\n TypedLocale,\n} from '../../../index.js'\nimport type { Document, PayloadRequest, PopulateType, SelectType } from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type { DataFromCollectionSlug, DraftFlagFromCollectionSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { restoreVersionOperation } from '../restoreVersion.js'\n\ntype BaseOptions<TSlug extends CollectionSlug> = {\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: false | TypedLocale\n /**\n * The ID of the version to restore.\n */\n id: string\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n // TODO: Strongly type User as TypedUser (= User in v4.0)\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: Document\n} & Pick<FindOptions<TSlug, SelectType>, 'select'>\n\nexport type Options<TSlug extends CollectionSlug> = BaseOptions<TSlug> &\n DraftFlagFromCollectionSlug<TSlug>\n\nexport async function restoreVersionLocal<TSlug extends CollectionSlug>(\n payload: Payload,\n options: Options<TSlug>,\n): Promise<DataFromCollectionSlug<TSlug>> {\n const {\n id,\n collection: collectionSlug,\n depth,\n overrideAccess = true,\n populate,\n select,\n showHiddenFields,\n } = options\n\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(\n collectionSlug,\n )} can't be found. Restore Version Operation.`,\n )\n }\n\n const args = {\n id,\n collection,\n depth,\n overrideAccess,\n payload,\n populate,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n select,\n showHiddenFields,\n }\n\n return restoreVersionOperation(args)\n}\n"],"names":["APIError","createLocalReq","restoreVersionOperation","restoreVersionLocal","payload","options","id","collection","collectionSlug","depth","overrideAccess","populate","select","showHiddenFields","collections","String","args","req"],"mappings":"AAWA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,uBAAuB,QAAQ,uBAAsB;AA4D9D,OAAO,eAAeC,oBACpBC,OAAgB,EAChBC,OAAuB;IAEvB,MAAM,EACJC,EAAE,EACFC,YAAYC,cAAc,EAC1BC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EACjB,GAAGR;IAEJ,MAAME,aAAaH,QAAQU,WAAW,CAACN,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIP,SACR,CAAC,yBAAyB,EAAEe,OAC1BP,gBACA,2CAA2C,CAAC;IAElD;IAEA,MAAMQ,OAAO;QACXV;QACAC;QACAE;QACAC;QACAN;QACAO;QACAM,KAAK,MAAMhB,eAAeI,SAAkCD;QAC5DQ;QACAC;IACF;IAEA,OAAOX,wBAAwBc;AACjC"}
1
+ {"version":3,"sources":["../../../../src/collections/operations/local/restoreVersion.ts"],"sourcesContent":["import type {\n CollectionSlug,\n FindOptions,\n Payload,\n RequestContext,\n TypedLocale,\n User,\n} from '../../../index.js'\nimport type { PayloadRequest, PopulateType, SelectType } from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type { DataFromCollectionSlug, DraftFlagFromCollectionSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { restoreVersionOperation } from '../restoreVersion.js'\n\ntype BaseOptions<TSlug extends CollectionSlug> = {\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: false | TypedLocale\n /**\n * The ID of the version to restore.\n */\n id: string\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: null | User\n} & Pick<FindOptions<TSlug, SelectType>, 'select'>\n\nexport type Options<TSlug extends CollectionSlug> = BaseOptions<TSlug> &\n DraftFlagFromCollectionSlug<TSlug>\n\nexport async function restoreVersionLocal<TSlug extends CollectionSlug>(\n payload: Payload,\n options: Options<TSlug>,\n): Promise<DataFromCollectionSlug<TSlug>> {\n const {\n id,\n collection: collectionSlug,\n depth,\n overrideAccess = true,\n populate,\n select,\n showHiddenFields,\n } = options\n\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(\n collectionSlug,\n )} can't be found. Restore Version Operation.`,\n )\n }\n\n const args = {\n id,\n collection,\n depth,\n overrideAccess,\n payload,\n populate,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n select,\n showHiddenFields,\n }\n\n return restoreVersionOperation(args)\n}\n"],"names":["APIError","createLocalReq","restoreVersionOperation","restoreVersionLocal","payload","options","id","collection","collectionSlug","depth","overrideAccess","populate","select","showHiddenFields","collections","String","args","req"],"mappings":"AAYA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,uBAAuB,QAAQ,uBAAsB;AA2D9D,OAAO,eAAeC,oBACpBC,OAAgB,EAChBC,OAAuB;IAEvB,MAAM,EACJC,EAAE,EACFC,YAAYC,cAAc,EAC1BC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EACjB,GAAGR;IAEJ,MAAME,aAAaH,QAAQU,WAAW,CAACN,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIP,SACR,CAAC,yBAAyB,EAAEe,OAC1BP,gBACA,2CAA2C,CAAC;IAElD;IAEA,MAAMQ,OAAO;QACXV;QACAC;QACAE;QACAC;QACAN;QACAO;QACAM,KAAK,MAAMhB,eAAeI,SAAkCD;QAC5DQ;QACAC;IACF;IAEA,OAAOX,wBAAwBc;AACjC"}
@@ -1,6 +1,6 @@
1
1
  import type { DeepPartial } from 'ts-essentials';
2
- import type { CollectionSlug, FindOptions, Payload, RequestContext, TypedLocale } from '../../../index.js';
3
- import type { Document, PayloadRequest, PopulateType, SelectType, Sort, TransformCollectionWithSelect, Where } from '../../../types/index.js';
2
+ import type { CollectionSlug, FindOptions, Payload, RequestContext, TypedLocale, User } from '../../../index.js';
3
+ import type { PayloadRequest, PopulateType, SelectType, Sort, TransformCollectionWithSelect, Where } from '../../../types/index.js';
4
4
  import type { File } from '../../../uploads/types.js';
5
5
  import type { BulkOperationResult, DraftFlagFromCollectionSlug, RequiredDataFromCollectionSlug, SelectFromCollectionSlug } from '../../config/types.js';
6
6
  export type BaseOptions<TSlug extends CollectionSlug, TSelect extends SelectType> = {
@@ -71,17 +71,12 @@ export type BaseOptions<TSlug extends CollectionSlug, TSelect extends SelectType
71
71
  */
72
72
  populate?: PopulateType;
73
73
  /**
74
- * Publish the document / documents in all locales. Requires `versions.drafts.localizeStatus` to be enabled.
74
+ * Publish the document / documents in all locales. Only applies when localization is enabled
75
+ * and the collection has localized fields.
75
76
  *
76
77
  * @default undefined
77
78
  */
78
79
  publishAllLocales?: boolean;
79
- /**
80
- * Publish the document / documents with a specific locale.
81
- *
82
- * @default undefined
83
- */
84
- publishSpecificLocale?: string;
85
80
  /**
86
81
  * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.
87
82
  * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.
@@ -100,13 +95,14 @@ export type BaseOptions<TSlug extends CollectionSlug, TSelect extends SelectType
100
95
  */
101
96
  trash?: boolean;
102
97
  /**
103
- * Unpublish the document / documents in all locales. Requires `versions.drafts.localizeStatus` to be enabled.
98
+ * Unpublish the document / documents in all locales. Only applies when localization is enabled
99
+ * and the collection has localized fields.
104
100
  */
105
101
  unpublishAllLocales?: boolean;
106
102
  /**
107
103
  * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
108
104
  */
109
- user?: Document;
105
+ user?: null | User;
110
106
  } & Pick<FindOptions<TSlug, TSelect>, 'select'>;
111
107
  export type ByIDOptions<TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>> = {
112
108
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,OAAO,EACP,cAAc,EACd,WAAW,EACZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,6BAA6B,EAC7B,KAAK,EACN,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AAErD,OAAO,KAAK,EACV,mBAAmB,EACnB,2BAA2B,EAC3B,8BAA8B,EAC9B,wBAAwB,EACzB,MAAM,uBAAuB,CAAA;AAQ9B,MAAM,MAAM,WAAW,CAAC,KAAK,SAAS,cAAc,EAAE,OAAO,SAAS,UAAU,IAAI;IAClF;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,IAAI,EAAE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AW,CACxB,KAAK,SAAS,cAAc,EAC5B,OAAO,SAAS,wBAAwB,CAAC,KAAK,CAAC,EAE/C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;AA6E/F,OAAO,EAAE,WAAW,EAAE,CAAA"}
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,OAAO,EACP,cAAc,EACd,WAAW,EACX,IAAI,EACL,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,6BAA6B,EAC7B,KAAK,EACN,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AAErD,OAAO,KAAK,EACV,mBAAmB,EACnB,2BAA2B,EAC3B,8BAA8B,EAC9B,wBAAwB,EACzB,MAAM,uBAAuB,CAAA;AAQ9B,MAAM,MAAM,WAAW,CAAC,KAAK,SAAS,cAAc,EAAE,OAAO,SAAS,UAAU,IAAI;IAClF;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,IAAI,EAAE,WAAW,CAAC,8BAA8B,CAAC,KAAK,CAAC,CAAC,CAAA;IACxD;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;I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EAAE,OAAO,CAAC,GAAG,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;AA2E/F,OAAO,EAAE,WAAW,EAAE,CAAA"}
@@ -4,7 +4,7 @@ import { createLocalReq } from '../../../utilities/createLocalReq.js';
4
4
  import { updateOperation } from '../update.js';
5
5
  import { updateByIDOperation } from '../updateByID.js';
6
6
  async function updateLocal(payload, options) {
7
- const { id, autosave, collection: collectionSlug, data, depth, disableTransaction, draft, file, filePath, limit, overrideAccess = true, overrideLock, overwriteExistingFiles = false, populate, publishAllLocales, publishSpecificLocale, select, showHiddenFields, sort, trash = false, unpublishAllLocales, where } = options;
7
+ const { id, autosave, collection: collectionSlug, data, depth, disableTransaction, draft, file, filePath, limit, overrideAccess = true, overrideLock, overwriteExistingFiles = false, populate, publishAllLocales, select, showHiddenFields, sort, trash = false, unpublishAllLocales, where } = options;
8
8
  const collection = payload.collections[collectionSlug];
9
9
  if (!collection) {
10
10
  throw new APIError(`The collection with slug ${String(collectionSlug)} can't be found. Update Operation.`);
@@ -26,7 +26,6 @@ async function updateLocal(payload, options) {
26
26
  payload,
27
27
  populate,
28
28
  publishAllLocales,
29
- publishSpecificLocale,
30
29
  req,
31
30
  select,
32
31
  showHiddenFields,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/collections/operations/local/update.ts"],"sourcesContent":["import type { DeepPartial } from 'ts-essentials'\n\nimport type {\n CollectionSlug,\n FindOptions,\n Payload,\n RequestContext,\n TypedLocale,\n} from '../../../index.js'\nimport type {\n Document,\n PayloadRequest,\n PopulateType,\n SelectType,\n Sort,\n TransformCollectionWithSelect,\n Where,\n} from '../../../types/index.js'\nimport type { File } from '../../../uploads/types.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type {\n BulkOperationResult,\n DraftFlagFromCollectionSlug,\n RequiredDataFromCollectionSlug,\n SelectFromCollectionSlug,\n} from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { getFileByPath } from '../../../uploads/getFileByPath.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { updateOperation } from '../update.js'\nimport { updateByIDOperation } from '../updateByID.js'\n\nexport type BaseOptions<TSlug extends CollectionSlug, TSelect extends SelectType> = {\n /**\n * Whether the current update should be marked as from autosave.\n * `versions.drafts.autosave` should be specified.\n */\n autosave?: boolean\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * The document / documents data to update.\n */\n data: DeepPartial<RequiredDataFromCollectionSlug<TSlug>>\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * When set to `true`, a [database transactions](https://payloadcms.com/docs/database/transactions) will not be initialized.\n * @default false\n */\n disableTransaction?: boolean\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: false | TypedLocale\n /**\n * A `File` object when updating a collection with `upload: true`.\n */\n file?: File\n /**\n * A file path when creating a collection with `upload: true`.\n */\n filePath?: string\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * By default, document locks are ignored (`true`). Set to `false` to enforce locks and prevent operations when a document is locked by another user. [More details](https://payloadcms.com/docs/admin/locked-documents).\n * @default true\n */\n overrideLock?: boolean\n /**\n * If you are uploading a file and would like to replace\n * the existing file instead of generating a new filename,\n * you can set the following property to `true`\n */\n overwriteExistingFiles?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * Publish the document / documents in all locales. Requires `versions.drafts.localizeStatus` to be enabled.\n *\n * @default undefined\n */\n publishAllLocales?: boolean\n /**\n * Publish the document / documents with a specific locale.\n *\n * @default undefined\n */\n publishSpecificLocale?: string\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * When set to `true`, the operation will update both normal and trashed (soft-deleted) documents.\n * To update only trashed documents, pass `trash: true` and combine with a `where` clause filtering by `deletedAt`.\n * By default (`false`), the update will only include normal documents and exclude those with a `deletedAt` field.\n * @default false\n */\n trash?: boolean\n /**\n * Unpublish the document / documents in all locales. Requires `versions.drafts.localizeStatus` to be enabled.\n */\n unpublishAllLocales?: boolean\n // TODO: Strongly type User as TypedUser (= User in v4.0)\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: Document\n} & Pick<FindOptions<TSlug, TSelect>, 'select'>\n\nexport type ByIDOptions<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = {\n /**\n * The ID of the document to update.\n */\n id: number | string\n /**\n * Limit documents to update\n */\n limit?: never\n /**\n * Sort the documents, can be a string or an array of strings\n * @example '-createdAt' // Sort DESC by createdAt\n * @example ['group', '-createdAt'] // sort by 2 fields, ASC group and DESC createdAt\n */\n sort?: never\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: never\n} & BaseOptions<TSlug, TSelect> &\n DraftFlagFromCollectionSlug<TSlug>\n\nexport type ManyOptions<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = {\n /**\n * The ID of the document to update.\n */\n id?: never\n /**\n * Limit documents to update\n */\n limit?: number\n /**\n * Sort the documents, can be a string or an array of strings\n * @example '-createdAt' // Sort DESC by createdAt\n * @example ['group', '-createdAt'] // sort by 2 fields, ASC group and DESC createdAt\n */\n sort?: Sort\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where: Where\n} & BaseOptions<TSlug, TSelect> &\n DraftFlagFromCollectionSlug<TSlug>\n\nexport type Options<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = ByIDOptions<TSlug, TSelect> | ManyOptions<TSlug, TSelect>\n\nasync function updateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: ByIDOptions<TSlug, TSelect>,\n): Promise<TransformCollectionWithSelect<TSlug, TSelect>>\nasync function updateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: ManyOptions<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect>>\nasync function updateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect> | TransformCollectionWithSelect<TSlug, TSelect>>\nasync function updateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect> | TransformCollectionWithSelect<TSlug, TSelect>> {\n const {\n id,\n autosave,\n collection: collectionSlug,\n data,\n depth,\n disableTransaction,\n draft,\n file,\n filePath,\n limit,\n overrideAccess = true,\n overrideLock,\n overwriteExistingFiles = false,\n populate,\n publishAllLocales,\n publishSpecificLocale,\n select,\n showHiddenFields,\n sort,\n trash = false,\n unpublishAllLocales,\n where,\n } = options\n\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(collectionSlug)} can't be found. Update Operation.`,\n )\n }\n\n const req = await createLocalReq(options as CreateLocalReqOptions, payload)\n req.file = file ?? (await getFileByPath(filePath!))\n\n const args = {\n id,\n autosave,\n collection,\n data,\n depth,\n disableTransaction,\n draft,\n limit,\n overrideAccess,\n overrideLock,\n overwriteExistingFiles,\n payload,\n populate,\n publishAllLocales,\n publishSpecificLocale,\n req,\n select,\n showHiddenFields,\n sort,\n trash,\n unpublishAllLocales,\n where,\n }\n\n if (options.id) {\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return updateByIDOperation<TSlug, TSelect>(args)\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return updateOperation<TSlug, TSelect>(args)\n}\n\nexport { updateLocal }\n"],"names":["APIError","getFileByPath","createLocalReq","updateOperation","updateByIDOperation","updateLocal","payload","options","id","autosave","collection","collectionSlug","data","depth","disableTransaction","draft","file","filePath","limit","overrideAccess","overrideLock","overwriteExistingFiles","populate","publishAllLocales","publishSpecificLocale","select","showHiddenFields","sort","trash","unpublishAllLocales","where","collections","String","req","args"],"mappings":"AA2BA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,aAAa,QAAQ,oCAAmC;AACjE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,eAAe,QAAQ,eAAc;AAC9C,SAASC,mBAAmB,QAAQ,mBAAkB;AA0LtD,eAAeC,YAIbC,OAAgB,EAChBC,OAAgC;IAEhC,MAAM,EACJC,EAAE,EACFC,QAAQ,EACRC,YAAYC,cAAc,EAC1BC,IAAI,EACJC,KAAK,EACLC,kBAAkB,EAClBC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,YAAY,EACZC,yBAAyB,KAAK,EAC9BC,QAAQ,EACRC,iBAAiB,EACjBC,qBAAqB,EACrBC,MAAM,EACNC,gBAAgB,EAChBC,IAAI,EACJC,QAAQ,KAAK,EACbC,mBAAmB,EACnBC,KAAK,EACN,GAAGvB;IAEJ,MAAMG,aAAaJ,QAAQyB,WAAW,CAACpB,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIV,SACR,CAAC,yBAAyB,EAAEgC,OAAOrB,gBAAgB,kCAAkC,CAAC;IAE1F;IAEA,MAAMsB,MAAM,MAAM/B,eAAeK,SAAkCD;IACnE2B,IAAIjB,IAAI,GAAGA,QAAS,MAAMf,cAAcgB;IAExC,MAAMiB,OAAO;QACX1B;QACAC;QACAC;QACAE;QACAC;QACAC;QACAC;QACAG;QACAC;QACAC;QACAC;QACAf;QACAgB;QACAC;QACAC;QACAS;QACAR;QACAC;QACAC;QACAC;QACAC;QACAC;IACF;IAEA,IAAIvB,QAAQC,EAAE,EAAE;QACd,oFAAoF;QACpF,OAAOJ,oBAAoC8B;IAC7C;IACA,oFAAoF;IACpF,OAAO/B,gBAAgC+B;AACzC;AAEA,SAAS7B,WAAW,GAAE"}
1
+ {"version":3,"sources":["../../../../src/collections/operations/local/update.ts"],"sourcesContent":["import type { DeepPartial } from 'ts-essentials'\n\nimport type {\n CollectionSlug,\n FindOptions,\n Payload,\n RequestContext,\n TypedLocale,\n User,\n} from '../../../index.js'\nimport type {\n PayloadRequest,\n PopulateType,\n SelectType,\n Sort,\n TransformCollectionWithSelect,\n Where,\n} from '../../../types/index.js'\nimport type { File } from '../../../uploads/types.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type {\n BulkOperationResult,\n DraftFlagFromCollectionSlug,\n RequiredDataFromCollectionSlug,\n SelectFromCollectionSlug,\n} from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { getFileByPath } from '../../../uploads/getFileByPath.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { updateOperation } from '../update.js'\nimport { updateByIDOperation } from '../updateByID.js'\n\nexport type BaseOptions<TSlug extends CollectionSlug, TSelect extends SelectType> = {\n /**\n * Whether the current update should be marked as from autosave.\n * `versions.drafts.autosave` should be specified.\n */\n autosave?: boolean\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * The document / documents data to update.\n */\n data: DeepPartial<RequiredDataFromCollectionSlug<TSlug>>\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * When set to `true`, a [database transactions](https://payloadcms.com/docs/database/transactions) will not be initialized.\n * @default false\n */\n disableTransaction?: boolean\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: false | TypedLocale\n /**\n * A `File` object when updating a collection with `upload: true`.\n */\n file?: File\n /**\n * A file path when creating a collection with `upload: true`.\n */\n filePath?: string\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * By default, document locks are ignored (`true`). Set to `false` to enforce locks and prevent operations when a document is locked by another user. [More details](https://payloadcms.com/docs/admin/locked-documents).\n * @default true\n */\n overrideLock?: boolean\n /**\n * If you are uploading a file and would like to replace\n * the existing file instead of generating a new filename,\n * you can set the following property to `true`\n */\n overwriteExistingFiles?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * Publish the document / documents in all locales. Only applies when localization is enabled\n * and the collection has localized fields.\n *\n * @default undefined\n */\n publishAllLocales?: boolean\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * When set to `true`, the operation will update both normal and trashed (soft-deleted) documents.\n * To update only trashed documents, pass `trash: true` and combine with a `where` clause filtering by `deletedAt`.\n * By default (`false`), the update will only include normal documents and exclude those with a `deletedAt` field.\n * @default false\n */\n trash?: boolean\n /**\n * Unpublish the document / documents in all locales. Only applies when localization is enabled\n * and the collection has localized fields.\n */\n unpublishAllLocales?: boolean\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: null | User\n} & Pick<FindOptions<TSlug, TSelect>, 'select'>\n\nexport type ByIDOptions<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = {\n /**\n * The ID of the document to update.\n */\n id: number | string\n /**\n * Limit documents to update\n */\n limit?: never\n /**\n * Sort the documents, can be a string or an array of strings\n * @example '-createdAt' // Sort DESC by createdAt\n * @example ['group', '-createdAt'] // sort by 2 fields, ASC group and DESC createdAt\n */\n sort?: never\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: never\n} & BaseOptions<TSlug, TSelect> &\n DraftFlagFromCollectionSlug<TSlug>\n\nexport type ManyOptions<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = {\n /**\n * The ID of the document to update.\n */\n id?: never\n /**\n * Limit documents to update\n */\n limit?: number\n /**\n * Sort the documents, can be a string or an array of strings\n * @example '-createdAt' // Sort DESC by createdAt\n * @example ['group', '-createdAt'] // sort by 2 fields, ASC group and DESC createdAt\n */\n sort?: Sort\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where: Where\n} & BaseOptions<TSlug, TSelect> &\n DraftFlagFromCollectionSlug<TSlug>\n\nexport type Options<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = ByIDOptions<TSlug, TSelect> | ManyOptions<TSlug, TSelect>\n\nasync function updateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: ByIDOptions<TSlug, TSelect>,\n): Promise<TransformCollectionWithSelect<TSlug, TSelect>>\nasync function updateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: ManyOptions<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect>>\nasync function updateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect> | TransformCollectionWithSelect<TSlug, TSelect>>\nasync function updateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect> | TransformCollectionWithSelect<TSlug, TSelect>> {\n const {\n id,\n autosave,\n collection: collectionSlug,\n data,\n depth,\n disableTransaction,\n draft,\n file,\n filePath,\n limit,\n overrideAccess = true,\n overrideLock,\n overwriteExistingFiles = false,\n populate,\n publishAllLocales,\n select,\n showHiddenFields,\n sort,\n trash = false,\n unpublishAllLocales,\n where,\n } = options\n\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(collectionSlug)} can't be found. Update Operation.`,\n )\n }\n\n const req = await createLocalReq(options as CreateLocalReqOptions, payload)\n req.file = file ?? (await getFileByPath(filePath!))\n\n const args = {\n id,\n autosave,\n collection,\n data,\n depth,\n disableTransaction,\n draft,\n limit,\n overrideAccess,\n overrideLock,\n overwriteExistingFiles,\n payload,\n populate,\n publishAllLocales,\n req,\n select,\n showHiddenFields,\n sort,\n trash,\n unpublishAllLocales,\n where,\n }\n\n if (options.id) {\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return updateByIDOperation<TSlug, TSelect>(args)\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return updateOperation<TSlug, TSelect>(args)\n}\n\nexport { updateLocal }\n"],"names":["APIError","getFileByPath","createLocalReq","updateOperation","updateByIDOperation","updateLocal","payload","options","id","autosave","collection","collectionSlug","data","depth","disableTransaction","draft","file","filePath","limit","overrideAccess","overrideLock","overwriteExistingFiles","populate","publishAllLocales","select","showHiddenFields","sort","trash","unpublishAllLocales","where","collections","String","req","args"],"mappings":"AA2BA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,aAAa,QAAQ,oCAAmC;AACjE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,eAAe,QAAQ,eAAc;AAC9C,SAASC,mBAAmB,QAAQ,mBAAkB;AAqLtD,eAAeC,YAIbC,OAAgB,EAChBC,OAAgC;IAEhC,MAAM,EACJC,EAAE,EACFC,QAAQ,EACRC,YAAYC,cAAc,EAC1BC,IAAI,EACJC,KAAK,EACLC,kBAAkB,EAClBC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,YAAY,EACZC,yBAAyB,KAAK,EAC9BC,QAAQ,EACRC,iBAAiB,EACjBC,MAAM,EACNC,gBAAgB,EAChBC,IAAI,EACJC,QAAQ,KAAK,EACbC,mBAAmB,EACnBC,KAAK,EACN,GAAGtB;IAEJ,MAAMG,aAAaJ,QAAQwB,WAAW,CAACnB,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIV,SACR,CAAC,yBAAyB,EAAE+B,OAAOpB,gBAAgB,kCAAkC,CAAC;IAE1F;IAEA,MAAMqB,MAAM,MAAM9B,eAAeK,SAAkCD;IACnE0B,IAAIhB,IAAI,GAAGA,QAAS,MAAMf,cAAcgB;IAExC,MAAMgB,OAAO;QACXzB;QACAC;QACAC;QACAE;QACAC;QACAC;QACAC;QACAG;QACAC;QACAC;QACAC;QACAf;QACAgB;QACAC;QACAS;QACAR;QACAC;QACAC;QACAC;QACAC;QACAC;IACF;IAEA,IAAItB,QAAQC,EAAE,EAAE;QACd,oFAAoF;QACpF,OAAOJ,oBAAoC6B;IAC7C;IACA,oFAAoF;IACpF,OAAO9B,gBAAgC8B;AACzC;AAEA,SAAS5B,WAAW,GAAE"}
@@ -16,7 +16,6 @@ export type Arguments<TSlug extends CollectionSlug> = {
16
16
  overwriteExistingFiles?: boolean;
17
17
  populate?: PopulateType;
18
18
  publishAllLocales?: boolean;
19
- publishSpecificLocale?: string;
20
19
  req: PayloadRequest;
21
20
  showHiddenFields?: boolean;
22
21
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAKhD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjG,OAAO,KAAK,EACV,mBAAmB,EACnB,UAAU,EAEV,8BAA8B,EAC9B,wBAAwB,EACzB,MAAM,oBAAoB,CAAA;AAO3B,OAAO,EAAE,KAAK,cAAc,EAAwB,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAmB5F,MAAM,MAAM,SAAS,CAAC,KAAK,SAAS,cAAc,IAAI;IACpD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,EAAE,UAAU,CAAA;IACtB,IAAI,EAAE,WAAW,CAAC,8BAA8B,CAAC,KAAK,CAAC,CAAC,CAAA;IACxD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,KAA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