payload 4.0.0-internal.5b1e7cd → 4.0.0-internal.5d5a2b2

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 (754) hide show
  1. package/dist/admin/RichText.d.ts +24 -17
  2. package/dist/admin/RichText.d.ts.map +1 -1
  3. package/dist/admin/RichText.js.map +1 -1
  4. package/dist/admin/adapters/cookies.d.ts +21 -0
  5. package/dist/admin/adapters/cookies.d.ts.map +1 -0
  6. package/dist/admin/adapters/cookies.js +3 -0
  7. package/dist/admin/adapters/cookies.js.map +1 -0
  8. package/dist/admin/adapters/devReload.d.ts +9 -0
  9. package/dist/admin/adapters/devReload.d.ts.map +1 -0
  10. package/dist/admin/adapters/devReload.js +6 -0
  11. package/dist/admin/adapters/devReload.js.map +1 -0
  12. package/dist/admin/adapters/index.d.ts +7 -0
  13. package/dist/admin/adapters/index.d.ts.map +1 -0
  14. package/dist/admin/adapters/index.js +3 -0
  15. package/dist/admin/adapters/index.js.map +1 -0
  16. package/dist/admin/adapters/render.d.ts +16 -0
  17. package/dist/admin/adapters/render.d.ts.map +1 -0
  18. package/dist/admin/adapters/render.js +7 -0
  19. package/dist/admin/adapters/render.js.map +1 -0
  20. package/dist/admin/adapters/router.d.ts +56 -0
  21. package/dist/admin/adapters/router.d.ts.map +1 -0
  22. package/dist/admin/adapters/router.js +3 -0
  23. package/dist/admin/adapters/router.js.map +1 -0
  24. package/dist/admin/adapters/server.d.ts +23 -0
  25. package/dist/admin/adapters/server.d.ts.map +1 -0
  26. package/dist/admin/adapters/server.js +6 -0
  27. package/dist/admin/adapters/server.js.map +1 -0
  28. package/dist/admin/adapters/views.d.ts +36 -0
  29. package/dist/admin/adapters/views.d.ts.map +1 -0
  30. package/dist/admin/adapters/views.js +7 -0
  31. package/dist/admin/adapters/views.js.map +1 -0
  32. package/dist/admin/elements/Nav.d.ts +13 -0
  33. package/dist/admin/elements/Nav.d.ts.map +1 -1
  34. package/dist/admin/elements/Nav.js.map +1 -1
  35. package/dist/admin/elements/Table.d.ts +1 -0
  36. package/dist/admin/elements/Table.d.ts.map +1 -1
  37. package/dist/admin/elements/Table.js.map +1 -1
  38. package/dist/admin/forms/Field.d.ts +7 -0
  39. package/dist/admin/forms/Field.d.ts.map +1 -1
  40. package/dist/admin/forms/Field.js.map +1 -1
  41. package/dist/admin/forms/Form.d.ts +29 -0
  42. package/dist/admin/forms/Form.d.ts.map +1 -1
  43. package/dist/admin/forms/Form.js.map +1 -1
  44. package/dist/admin/functions/index.d.ts +10 -38
  45. package/dist/admin/functions/index.d.ts.map +1 -1
  46. package/dist/admin/functions/index.js.map +1 -1
  47. package/dist/admin/types.d.ts +5 -4
  48. package/dist/admin/types.d.ts.map +1 -1
  49. package/dist/admin/types.js.map +1 -1
  50. package/dist/admin/views/dashboard.d.ts +7 -0
  51. package/dist/admin/views/dashboard.d.ts.map +1 -1
  52. package/dist/admin/views/dashboard.js.map +1 -1
  53. package/dist/admin/views/document.d.ts +7 -1
  54. package/dist/admin/views/document.d.ts.map +1 -1
  55. package/dist/admin/views/document.js.map +1 -1
  56. package/dist/admin/views/hierarchyList.d.ts +10 -0
  57. package/dist/admin/views/hierarchyList.d.ts.map +1 -0
  58. package/dist/admin/views/hierarchyList.js +3 -0
  59. package/dist/admin/views/hierarchyList.js.map +1 -0
  60. package/dist/admin/views/index.d.ts +1 -3
  61. package/dist/admin/views/index.d.ts.map +1 -1
  62. package/dist/admin/views/index.js.map +1 -1
  63. package/dist/admin/views/list.d.ts +47 -2
  64. package/dist/admin/views/list.d.ts.map +1 -1
  65. package/dist/admin/views/list.js.map +1 -1
  66. package/dist/auth/cookies.d.ts.map +1 -1
  67. package/dist/auth/defaultAccess.d.ts +1 -1
  68. package/dist/auth/defaultAccess.d.ts.map +1 -1
  69. package/dist/auth/defaultAccess.js +1 -1
  70. package/dist/auth/defaultAccess.js.map +1 -1
  71. package/dist/auth/defaultUser.d.ts.map +1 -1
  72. package/dist/auth/defaultUser.js +2 -1
  73. package/dist/auth/defaultUser.js.map +1 -1
  74. package/dist/auth/ensureUsernameOrEmail.d.ts.map +1 -1
  75. package/dist/auth/executeAccess.d.ts.map +1 -1
  76. package/dist/auth/executeAuthStrategies.d.ts.map +1 -1
  77. package/dist/auth/extractAccessFromPermission.d.ts.map +1 -1
  78. package/dist/auth/extractJWT.d.ts.map +1 -1
  79. package/dist/auth/getAuthFields.d.ts.map +1 -1
  80. package/dist/auth/getFieldsToSign.d.ts.map +1 -1
  81. package/dist/auth/getLoginOptions.d.ts.map +1 -1
  82. package/dist/auth/isUserLocked.d.ts.map +1 -1
  83. package/dist/auth/jwt.d.ts.map +1 -1
  84. package/dist/auth/operations/access.d.ts.map +1 -1
  85. package/dist/auth/operations/auth.d.ts.map +1 -1
  86. package/dist/auth/operations/forgotPassword.d.ts.map +1 -1
  87. package/dist/auth/operations/init.d.ts.map +1 -1
  88. package/dist/auth/operations/local/auth.d.ts.map +1 -1
  89. package/dist/auth/operations/login.d.ts.map +1 -1
  90. package/dist/auth/operations/logout.d.ts.map +1 -1
  91. package/dist/auth/operations/me.d.ts.map +1 -1
  92. package/dist/auth/operations/refresh.d.ts.map +1 -1
  93. package/dist/auth/operations/registerFirstUser.d.ts.map +1 -1
  94. package/dist/auth/operations/resetPassword.d.ts.map +1 -1
  95. package/dist/auth/operations/unlock.d.ts.map +1 -1
  96. package/dist/auth/operations/verifyEmail.d.ts.map +1 -1
  97. package/dist/auth/sessions.d.ts.map +1 -1
  98. package/dist/auth/strategies/apiKey.d.ts.map +1 -1
  99. package/dist/auth/strategies/apiKey.js +6 -17
  100. package/dist/auth/strategies/apiKey.js.map +1 -1
  101. package/dist/auth/strategies/local/authenticate.d.ts.map +1 -1
  102. package/dist/auth/strategies/local/generatePasswordSaltHash.d.ts.map +1 -1
  103. package/dist/auth/strategies/local/incrementLoginAttempts.d.ts.map +1 -1
  104. package/dist/auth/strategies/local/register.d.ts.map +1 -1
  105. package/dist/auth/strategies/local/resetLoginAttempts.d.ts.map +1 -1
  106. package/dist/bin/build.d.ts +25 -0
  107. package/dist/bin/build.d.ts.map +1 -0
  108. package/dist/bin/build.js +80 -0
  109. package/dist/bin/build.js.map +1 -0
  110. package/dist/bin/build.spec.js +170 -0
  111. package/dist/bin/build.spec.js.map +1 -0
  112. package/dist/bin/generateImportMap/index.d.ts.map +1 -1
  113. package/dist/bin/generateImportMap/index.js +8 -5
  114. package/dist/bin/generateImportMap/index.js.map +1 -1
  115. package/dist/bin/generateImportMap/iterateCollections.d.ts.map +1 -1
  116. package/dist/bin/generateImportMap/iterateCollections.js +1 -0
  117. package/dist/bin/generateImportMap/iterateCollections.js.map +1 -1
  118. package/dist/bin/generateImportMap/iterateConfig.d.ts.map +1 -1
  119. package/dist/bin/generateImportMap/iterateConfig.js +7 -0
  120. package/dist/bin/generateImportMap/iterateConfig.js.map +1 -1
  121. package/dist/bin/generateImportMap/iterateFields.d.ts.map +1 -1
  122. package/dist/bin/generateImportMap/iterateFields.js +4 -1
  123. package/dist/bin/generateImportMap/iterateFields.js.map +1 -1
  124. package/dist/bin/generateImportMap/iterateGlobals.d.ts.map +1 -1
  125. package/dist/bin/generateImportMap/iterateGlobals.js +20 -8
  126. package/dist/bin/generateImportMap/iterateGlobals.js.map +1 -1
  127. package/dist/bin/generateImportMap/utilities/getFromImportMap.d.ts.map +1 -1
  128. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.d.ts +5 -1
  129. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.d.ts.map +1 -1
  130. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.js +24 -18
  131. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.js.map +1 -1
  132. package/dist/bin/generateTypes.d.ts +3 -2
  133. package/dist/bin/generateTypes.d.ts.map +1 -1
  134. package/dist/bin/generateTypes.js +11 -1
  135. package/dist/bin/generateTypes.js.map +1 -1
  136. package/dist/bin/index.d.ts.map +1 -1
  137. package/dist/bin/index.js +10 -3
  138. package/dist/bin/index.js.map +1 -1
  139. package/dist/bin/loadEnv.d.ts +3 -1
  140. package/dist/bin/loadEnv.d.ts.map +1 -1
  141. package/dist/bin/loadEnv.js +40 -10
  142. package/dist/bin/loadEnv.js.map +1 -1
  143. package/dist/bin/migrate.d.ts.map +1 -1
  144. package/dist/collections/config/client.d.ts +4 -2
  145. package/dist/collections/config/client.d.ts.map +1 -1
  146. package/dist/collections/config/client.js +13 -1
  147. package/dist/collections/config/client.js.map +1 -1
  148. package/dist/collections/config/defaults.d.ts.map +1 -1
  149. package/dist/collections/config/defaults.js +3 -3
  150. package/dist/collections/config/defaults.js.map +1 -1
  151. package/dist/collections/config/defaults.spec.js +47 -0
  152. package/dist/collections/config/defaults.spec.js.map +1 -0
  153. package/dist/collections/config/sanitize.d.ts +10 -1
  154. package/dist/collections/config/sanitize.d.ts.map +1 -1
  155. package/dist/collections/config/sanitize.js +51 -10
  156. package/dist/collections/config/sanitize.js.map +1 -1
  157. package/dist/collections/config/sanitizeCompoundIndexes.d.ts.map +1 -1
  158. package/dist/collections/config/types.d.ts +76 -91
  159. package/dist/collections/config/types.d.ts.map +1 -1
  160. package/dist/collections/config/types.js.map +1 -1
  161. package/dist/collections/config/useAsTitle.d.ts.map +1 -1
  162. package/dist/collections/dataloader.d.ts.map +1 -1
  163. package/dist/collections/operations/count.d.ts.map +1 -1
  164. package/dist/collections/operations/countVersions.d.ts.map +1 -1
  165. package/dist/collections/operations/create.d.ts.map +1 -1
  166. package/dist/collections/operations/create.js +25 -19
  167. package/dist/collections/operations/create.js.map +1 -1
  168. package/dist/collections/operations/delete.d.ts.map +1 -1
  169. package/dist/collections/operations/delete.js +7 -2
  170. package/dist/collections/operations/delete.js.map +1 -1
  171. package/dist/collections/operations/deleteByID.d.ts.map +1 -1
  172. package/dist/collections/operations/deleteByID.js +7 -2
  173. package/dist/collections/operations/deleteByID.js.map +1 -1
  174. package/dist/collections/operations/duplicate.d.ts.map +1 -1
  175. package/dist/collections/operations/find.d.ts.map +1 -1
  176. package/dist/collections/operations/find.js +7 -2
  177. package/dist/collections/operations/find.js.map +1 -1
  178. package/dist/collections/operations/findByID.d.ts.map +1 -1
  179. package/dist/collections/operations/findByID.js +10 -5
  180. package/dist/collections/operations/findByID.js.map +1 -1
  181. package/dist/collections/operations/findDistinct.d.ts.map +1 -1
  182. package/dist/collections/operations/findVersionByID.d.ts.map +1 -1
  183. package/dist/collections/operations/findVersionByID.js +6 -4
  184. package/dist/collections/operations/findVersionByID.js.map +1 -1
  185. package/dist/collections/operations/findVersions.d.ts.map +1 -1
  186. package/dist/collections/operations/findVersions.js +6 -4
  187. package/dist/collections/operations/findVersions.js.map +1 -1
  188. package/dist/collections/operations/local/duplicate.d.ts.map +1 -1
  189. package/dist/collections/operations/local/duplicate.js.map +1 -1
  190. package/dist/collections/operations/local/find.d.ts.map +1 -1
  191. package/dist/collections/operations/local/find.js.map +1 -1
  192. package/dist/collections/operations/local/findByID.d.ts.map +1 -1
  193. package/dist/collections/operations/local/findByID.js.map +1 -1
  194. package/dist/collections/operations/local/findVersionByID.d.ts.map +1 -1
  195. package/dist/collections/operations/local/findVersionByID.js.map +1 -1
  196. package/dist/collections/operations/local/findVersions.d.ts.map +1 -1
  197. package/dist/collections/operations/local/findVersions.js.map +1 -1
  198. package/dist/collections/operations/local/restoreVersion.d.ts.map +1 -1
  199. package/dist/collections/operations/local/restoreVersion.js.map +1 -1
  200. package/dist/collections/operations/restoreVersion.d.ts.map +1 -1
  201. package/dist/collections/operations/restoreVersion.js +7 -2
  202. package/dist/collections/operations/restoreVersion.js.map +1 -1
  203. package/dist/collections/operations/update.d.ts.map +1 -1
  204. package/dist/collections/operations/update.js +7 -2
  205. package/dist/collections/operations/update.js.map +1 -1
  206. package/dist/collections/operations/updateByID.d.ts.map +1 -1
  207. package/dist/collections/operations/updateByID.js +7 -2
  208. package/dist/collections/operations/updateByID.js.map +1 -1
  209. package/dist/collections/operations/utilities/buildAfterOperation.d.ts.map +1 -1
  210. package/dist/collections/operations/utilities/sanitizeSortQuery.d.ts.map +1 -1
  211. package/dist/collections/operations/utilities/update.d.ts.map +1 -1
  212. package/dist/collections/operations/utilities/update.js +21 -12
  213. package/dist/collections/operations/utilities/update.js.map +1 -1
  214. package/dist/config/build.d.ts.map +1 -1
  215. package/dist/config/build.js +8 -0
  216. package/dist/config/build.js.map +1 -1
  217. package/dist/config/client.d.ts +1 -1
  218. package/dist/config/client.d.ts.map +1 -1
  219. package/dist/config/client.js +2 -11
  220. package/dist/config/client.js.map +1 -1
  221. package/dist/config/defaults.d.ts.map +1 -1
  222. package/dist/config/defaults.js +0 -15
  223. package/dist/config/defaults.js.map +1 -1
  224. package/dist/config/orderable/index.d.ts.map +1 -1
  225. package/dist/config/orderable/index.js +0 -4
  226. package/dist/config/orderable/index.js.map +1 -1
  227. package/dist/config/sanitize.d.ts.map +1 -1
  228. package/dist/config/sanitize.js +6 -53
  229. package/dist/config/sanitize.js.map +1 -1
  230. package/dist/config/types.d.ts +197 -32
  231. package/dist/config/types.d.ts.map +1 -1
  232. package/dist/config/types.js +1 -0
  233. package/dist/config/types.js.map +1 -1
  234. package/dist/database/combineQueries.d.ts.map +1 -1
  235. package/dist/database/migrations/findMigrationDir.d.ts.map +1 -1
  236. package/dist/database/migrations/getPredefinedMigration.d.ts.map +1 -1
  237. package/dist/database/migrations/migrationsCollection.d.ts.map +1 -1
  238. package/dist/database/migrations/migrationsCollection.js +2 -1
  239. package/dist/database/migrations/migrationsCollection.js.map +1 -1
  240. package/dist/database/migrations/readMigrationFiles.d.ts.map +1 -1
  241. package/dist/database/migrations/templates/localizeStatus.d.ts.map +1 -1
  242. package/dist/database/migrations/writeMigrationIndex.d.ts.map +1 -1
  243. package/dist/database/sanitizeJoinQuery.d.ts.map +1 -1
  244. package/dist/database/sanitizeWhereQuery.d.ts.map +1 -1
  245. package/dist/duplicateDocument/index.d.ts.map +1 -1
  246. package/dist/email/getStringifiedToAddress.d.ts.map +1 -1
  247. package/dist/exports/shared.d.ts +26 -3
  248. package/dist/exports/shared.d.ts.map +1 -1
  249. package/dist/exports/shared.js +24 -2
  250. package/dist/exports/shared.js.map +1 -1
  251. package/dist/fields/baseFields/slug/countVersions.d.ts.map +1 -1
  252. package/dist/fields/baseFields/slug/generateSlug.d.ts.map +1 -1
  253. package/dist/fields/baseFields/slug/index.d.ts.map +1 -1
  254. package/dist/fields/baseFields/slug/index.js +7 -5
  255. package/dist/fields/baseFields/slug/index.js.map +1 -1
  256. package/dist/fields/config/client.d.ts +2 -2
  257. package/dist/fields/config/client.d.ts.map +1 -1
  258. package/dist/fields/config/client.js +5 -4
  259. package/dist/fields/config/client.js.map +1 -1
  260. package/dist/fields/config/sanitize.d.ts.map +1 -1
  261. package/dist/fields/config/sanitize.js +13 -20
  262. package/dist/fields/config/sanitize.js.map +1 -1
  263. package/dist/fields/config/sanitizeJoinField.d.ts.map +1 -1
  264. package/dist/fields/config/sanitizeJoinField.js +3 -0
  265. package/dist/fields/config/sanitizeJoinField.js.map +1 -1
  266. package/dist/fields/config/types.d.ts +44 -118
  267. package/dist/fields/config/types.d.ts.map +1 -1
  268. package/dist/fields/config/types.js +12 -2
  269. package/dist/fields/config/types.js.map +1 -1
  270. package/dist/fields/getDefaultValue.d.ts.map +1 -1
  271. package/dist/fields/hooks/afterChange/index.d.ts.map +1 -1
  272. package/dist/fields/hooks/afterChange/promise.d.ts.map +1 -1
  273. package/dist/fields/hooks/afterChange/traverseFields.d.ts.map +1 -1
  274. package/dist/fields/hooks/afterRead/promise.d.ts.map +1 -1
  275. package/dist/fields/hooks/afterRead/relationshipPopulationPromise.d.ts.map +1 -1
  276. package/dist/fields/hooks/afterRead/traverseFields.d.ts.map +1 -1
  277. package/dist/fields/hooks/afterRead/virtualFieldPopulationPromise.d.ts.map +1 -1
  278. package/dist/fields/hooks/beforeChange/cloneDataFromOriginalDoc.d.ts.map +1 -1
  279. package/dist/fields/hooks/beforeChange/getExistingRowDoc.d.ts.map +1 -1
  280. package/dist/fields/hooks/beforeChange/index.d.ts.map +1 -1
  281. package/dist/fields/hooks/beforeChange/promise.d.ts.map +1 -1
  282. package/dist/fields/hooks/beforeChange/traverseFields.d.ts.map +1 -1
  283. package/dist/fields/hooks/beforeDuplicate/index.d.ts.map +1 -1
  284. package/dist/fields/hooks/beforeDuplicate/promise.d.ts.map +1 -1
  285. package/dist/fields/hooks/beforeDuplicate/traverseFields.d.ts.map +1 -1
  286. package/dist/fields/hooks/beforeValidate/index.d.ts.map +1 -1
  287. package/dist/fields/hooks/beforeValidate/promise.d.ts.map +1 -1
  288. package/dist/fields/hooks/beforeValidate/traverseFields.d.ts.map +1 -1
  289. package/dist/fields/isFieldDisabled.d.ts +12 -0
  290. package/dist/fields/isFieldDisabled.d.ts.map +1 -0
  291. package/dist/fields/isFieldDisabled.js +15 -0
  292. package/dist/fields/isFieldDisabled.js.map +1 -0
  293. package/dist/fields/isFieldDisabled.spec.js +134 -0
  294. package/dist/fields/isFieldDisabled.spec.js.map +1 -0
  295. package/dist/fields/mergeBaseFields.d.ts.map +1 -1
  296. package/dist/fields/setDefaultBeforeDuplicate.d.ts.map +1 -1
  297. package/dist/fields/validations.d.ts.map +1 -1
  298. package/dist/fields/validations.js +6 -5
  299. package/dist/fields/validations.js.map +1 -1
  300. package/dist/globals/config/client.d.ts +1 -1
  301. package/dist/globals/config/client.d.ts.map +1 -1
  302. package/dist/globals/config/client.js +2 -1
  303. package/dist/globals/config/client.js.map +1 -1
  304. package/dist/globals/config/sanitize.d.ts +6 -1
  305. package/dist/globals/config/sanitize.d.ts.map +1 -1
  306. package/dist/globals/config/sanitize.js +7 -2
  307. package/dist/globals/config/sanitize.js.map +1 -1
  308. package/dist/globals/config/sanitize.spec.js +43 -0
  309. package/dist/globals/config/sanitize.spec.js.map +1 -0
  310. package/dist/globals/config/types.d.ts +4 -57
  311. package/dist/globals/config/types.d.ts.map +1 -1
  312. package/dist/globals/config/types.js.map +1 -1
  313. package/dist/globals/operations/countGlobalVersions.d.ts.map +1 -1
  314. package/dist/globals/operations/docAccess.d.ts.map +1 -1
  315. package/dist/globals/operations/findOne.d.ts.map +1 -1
  316. package/dist/globals/operations/findOne.js +7 -2
  317. package/dist/globals/operations/findOne.js.map +1 -1
  318. package/dist/globals/operations/findVersionByID.d.ts.map +1 -1
  319. package/dist/globals/operations/findVersionByID.js +6 -4
  320. package/dist/globals/operations/findVersionByID.js.map +1 -1
  321. package/dist/globals/operations/findVersions.d.ts.map +1 -1
  322. package/dist/globals/operations/findVersions.js +6 -4
  323. package/dist/globals/operations/findVersions.js.map +1 -1
  324. package/dist/globals/operations/local/findOne.d.ts.map +1 -1
  325. package/dist/globals/operations/local/findOne.js.map +1 -1
  326. package/dist/globals/operations/local/update.d.ts.map +1 -1
  327. package/dist/globals/operations/local/update.js.map +1 -1
  328. package/dist/globals/operations/restoreVersion.d.ts.map +1 -1
  329. package/dist/globals/operations/update.d.ts.map +1 -1
  330. package/dist/globals/operations/update.js +7 -2
  331. package/dist/globals/operations/update.js.map +1 -1
  332. package/dist/hierarchy/addHierarchyToCollection.d.ts +9 -0
  333. package/dist/hierarchy/addHierarchyToCollection.d.ts.map +1 -0
  334. package/dist/hierarchy/addHierarchyToCollection.js +76 -0
  335. package/dist/hierarchy/addHierarchyToCollection.js.map +1 -0
  336. package/dist/hierarchy/buildParentField.d.ts +11 -0
  337. package/dist/hierarchy/buildParentField.d.ts.map +1 -0
  338. package/dist/hierarchy/buildParentField.js +42 -0
  339. package/dist/hierarchy/buildParentField.js.map +1 -0
  340. package/dist/hierarchy/constants.d.ts +15 -0
  341. package/dist/hierarchy/constants.d.ts.map +1 -0
  342. package/dist/hierarchy/constants.js +11 -0
  343. package/dist/hierarchy/constants.js.map +1 -0
  344. package/dist/hierarchy/createFolderField.d.ts +39 -0
  345. package/dist/hierarchy/createFolderField.d.ts.map +1 -0
  346. package/dist/hierarchy/createFolderField.js +54 -0
  347. package/dist/hierarchy/createFolderField.js.map +1 -0
  348. package/dist/hierarchy/createTagField.d.ts +44 -0
  349. package/dist/hierarchy/createTagField.d.ts.map +1 -0
  350. package/dist/hierarchy/createTagField.js +48 -0
  351. package/dist/hierarchy/createTagField.js.map +1 -0
  352. package/dist/hierarchy/getInitialTreeData.d.ts +27 -0
  353. package/dist/hierarchy/getInitialTreeData.d.ts.map +1 -0
  354. package/dist/hierarchy/getInitialTreeData.js +125 -0
  355. package/dist/hierarchy/getInitialTreeData.js.map +1 -0
  356. package/dist/hierarchy/hooks/collectionAfterDelete.d.ts +14 -0
  357. package/dist/hierarchy/hooks/collectionAfterDelete.d.ts.map +1 -0
  358. package/dist/hierarchy/hooks/collectionAfterDelete.js +21 -0
  359. package/dist/hierarchy/hooks/collectionAfterDelete.js.map +1 -0
  360. package/dist/hierarchy/hooks/collectionAfterRead.d.ts +27 -0
  361. package/dist/hierarchy/hooks/collectionAfterRead.d.ts.map +1 -0
  362. package/dist/hierarchy/hooks/collectionAfterRead.js +72 -0
  363. package/dist/hierarchy/hooks/collectionAfterRead.js.map +1 -0
  364. package/dist/hierarchy/hooks/collectionBeforeChange.d.ts +19 -0
  365. package/dist/hierarchy/hooks/collectionBeforeChange.d.ts.map +1 -0
  366. package/dist/hierarchy/hooks/collectionBeforeChange.js +90 -0
  367. package/dist/hierarchy/hooks/collectionBeforeChange.js.map +1 -0
  368. package/dist/hierarchy/hooks/collectionBeforeDelete.d.ts +15 -0
  369. package/dist/hierarchy/hooks/collectionBeforeDelete.d.ts.map +1 -0
  370. package/dist/hierarchy/hooks/collectionBeforeDelete.js +20 -0
  371. package/dist/hierarchy/hooks/collectionBeforeDelete.js.map +1 -0
  372. package/dist/hierarchy/hooks/collectionBeforeOperation.d.ts +33 -0
  373. package/dist/hierarchy/hooks/collectionBeforeOperation.d.ts.map +1 -0
  374. package/dist/hierarchy/hooks/collectionBeforeOperation.js +66 -0
  375. package/dist/hierarchy/hooks/collectionBeforeOperation.js.map +1 -0
  376. package/dist/hierarchy/hooks/ensureSafeCollectionsChange.d.ts +8 -0
  377. package/dist/hierarchy/hooks/ensureSafeCollectionsChange.d.ts.map +1 -0
  378. package/dist/hierarchy/hooks/ensureSafeCollectionsChange.js +108 -0
  379. package/dist/hierarchy/hooks/ensureSafeCollectionsChange.js.map +1 -0
  380. package/dist/hierarchy/injectHierarchyButton.d.ts +14 -0
  381. package/dist/hierarchy/injectHierarchyButton.d.ts.map +1 -0
  382. package/dist/hierarchy/injectHierarchyButton.js +37 -0
  383. package/dist/hierarchy/injectHierarchyButton.js.map +1 -0
  384. package/dist/hierarchy/presets.d.ts +13 -0
  385. package/dist/hierarchy/presets.d.ts.map +1 -0
  386. package/dist/hierarchy/presets.js +52 -0
  387. package/dist/hierarchy/presets.js.map +1 -0
  388. package/dist/hierarchy/resolveHierarchyCollections.d.ts +23 -0
  389. package/dist/hierarchy/resolveHierarchyCollections.d.ts.map +1 -0
  390. package/dist/hierarchy/resolveHierarchyCollections.js +321 -0
  391. package/dist/hierarchy/resolveHierarchyCollections.js.map +1 -0
  392. package/dist/hierarchy/sanitizeHierarchyCollection.d.ts +14 -0
  393. package/dist/hierarchy/sanitizeHierarchyCollection.d.ts.map +1 -0
  394. package/dist/hierarchy/sanitizeHierarchyCollection.js +119 -0
  395. package/dist/hierarchy/sanitizeHierarchyCollection.js.map +1 -0
  396. package/dist/hierarchy/types.d.ts +162 -0
  397. package/dist/hierarchy/types.d.ts.map +1 -0
  398. package/dist/hierarchy/types.js +6 -0
  399. package/dist/hierarchy/types.js.map +1 -0
  400. package/dist/hierarchy/utils/buildLocalizedHierarchyPaths.d.ts +77 -0
  401. package/dist/hierarchy/utils/buildLocalizedHierarchyPaths.d.ts.map +1 -0
  402. package/dist/hierarchy/utils/buildLocalizedHierarchyPaths.js +77 -0
  403. package/dist/hierarchy/utils/buildLocalizedHierarchyPaths.js.map +1 -0
  404. package/dist/hierarchy/utils/computePaths.d.ts +31 -0
  405. package/dist/hierarchy/utils/computePaths.d.ts.map +1 -0
  406. package/dist/hierarchy/utils/computePaths.js +445 -0
  407. package/dist/hierarchy/utils/computePaths.js.map +1 -0
  408. package/dist/hierarchy/utils/findUseAsTitle.d.ts +14 -0
  409. package/dist/hierarchy/utils/findUseAsTitle.d.ts.map +1 -0
  410. package/dist/hierarchy/utils/findUseAsTitle.js +89 -0
  411. package/dist/hierarchy/utils/findUseAsTitle.js.map +1 -0
  412. package/dist/hierarchy/utils/getAncestors.d.ts +34 -0
  413. package/dist/hierarchy/utils/getAncestors.d.ts.map +1 -0
  414. package/dist/hierarchy/utils/getAncestors.js +94 -0
  415. package/dist/hierarchy/utils/getAncestors.js.map +1 -0
  416. package/dist/hierarchy/utils/getLocalizedValue.d.ts +30 -0
  417. package/dist/hierarchy/utils/getLocalizedValue.d.ts.map +1 -0
  418. package/dist/hierarchy/utils/getLocalizedValue.js +46 -0
  419. package/dist/hierarchy/utils/getLocalizedValue.js.map +1 -0
  420. package/dist/hierarchy/utils/getLocalizedValue.spec.js +250 -0
  421. package/dist/hierarchy/utils/getLocalizedValue.spec.js.map +1 -0
  422. package/dist/index.bundled.d.ts +1235 -729
  423. package/dist/index.d.ts +39 -18
  424. package/dist/index.d.ts.map +1 -1
  425. package/dist/index.js +63 -41
  426. package/dist/index.js.map +1 -1
  427. package/dist/kv/adapters/DatabaseKVAdapter.d.ts.map +1 -1
  428. package/dist/kv/adapters/DatabaseKVAdapter.js +1 -0
  429. package/dist/kv/adapters/DatabaseKVAdapter.js.map +1 -1
  430. package/dist/locked-documents/config.d.ts.map +1 -1
  431. package/dist/locked-documents/config.js +2 -1
  432. package/dist/locked-documents/config.js.map +1 -1
  433. package/dist/preferences/config.d.ts.map +1 -1
  434. package/dist/preferences/config.js +2 -1
  435. package/dist/preferences/config.js.map +1 -1
  436. package/dist/preferences/deleteUserPreferences.d.ts.map +1 -1
  437. package/dist/preferences/keys.d.ts +8 -4
  438. package/dist/preferences/keys.d.ts.map +1 -1
  439. package/dist/preferences/keys.js +7 -4
  440. package/dist/preferences/keys.js.map +1 -1
  441. package/dist/preferences/types.d.ts +1 -1
  442. package/dist/preferences/types.d.ts.map +1 -1
  443. package/dist/preferences/types.js.map +1 -1
  444. package/dist/query-presets/access.d.ts.map +1 -1
  445. package/dist/query-presets/config.d.ts.map +1 -1
  446. package/dist/query-presets/config.js +12 -7
  447. package/dist/query-presets/config.js.map +1 -1
  448. package/dist/query-presets/constraints.d.ts.map +1 -1
  449. package/dist/query-presets/constraints.js +1 -1
  450. package/dist/query-presets/constraints.js.map +1 -1
  451. package/dist/queues/config/collection.d.ts.map +1 -1
  452. package/dist/queues/config/collection.js +2 -1
  453. package/dist/queues/config/collection.js.map +1 -1
  454. package/dist/queues/config/generateJobsJSONSchemas.d.ts +1 -1
  455. package/dist/queues/config/generateJobsJSONSchemas.d.ts.map +1 -1
  456. package/dist/queues/config/generateJobsJSONSchemas.js +33 -12
  457. package/dist/queues/config/generateJobsJSONSchemas.js.map +1 -1
  458. package/dist/queues/config/global.d.ts.map +1 -1
  459. package/dist/queues/config/global.js +2 -1
  460. package/dist/queues/config/global.js.map +1 -1
  461. package/dist/queues/config/types/index.d.ts +0 -21
  462. package/dist/queues/config/types/index.d.ts.map +1 -1
  463. package/dist/queues/config/types/index.js.map +1 -1
  464. package/dist/queues/config/types/taskTypes.d.ts +0 -20
  465. package/dist/queues/config/types/taskTypes.d.ts.map +1 -1
  466. package/dist/queues/config/types/taskTypes.js.map +1 -1
  467. package/dist/queues/endpoints/run.d.ts.map +1 -1
  468. package/dist/queues/errors/handleWorkflowError.d.ts.map +1 -1
  469. package/dist/queues/errors/handleWorkflowError.js +9 -1
  470. package/dist/queues/errors/handleWorkflowError.js.map +1 -1
  471. package/dist/queues/localAPI.d.ts.map +1 -1
  472. package/dist/queues/localAPI.js +26 -67
  473. package/dist/queues/localAPI.js.map +1 -1
  474. package/dist/queues/operations/handleSchedules/getQueuesWithSchedules.d.ts.map +1 -1
  475. package/dist/queues/operations/handleSchedules/index.d.ts.map +1 -1
  476. package/dist/queues/operations/handleSchedules/index.js +1 -4
  477. package/dist/queues/operations/handleSchedules/index.js.map +1 -1
  478. package/dist/queues/operations/runJobs/index.d.ts.map +1 -1
  479. package/dist/queues/operations/runJobs/index.js +40 -37
  480. package/dist/queues/operations/runJobs/index.js.map +1 -1
  481. package/dist/queues/operations/runJobs/runJSONJob/index.d.ts.map +1 -1
  482. package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.d.ts.map +1 -1
  483. package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js +3 -22
  484. package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js.map +1 -1
  485. package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.d.ts.map +1 -1
  486. package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.js +0 -2
  487. package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.js.map +1 -1
  488. package/dist/queues/operations/runJobs/runJob/index.d.ts.map +1 -1
  489. package/dist/queues/utilities/getJobTaskStatus.d.ts.map +1 -1
  490. package/dist/queues/utilities/updateJob.d.ts +1 -3
  491. package/dist/queues/utilities/updateJob.d.ts.map +1 -1
  492. package/dist/queues/utilities/updateJob.js +2 -18
  493. package/dist/queues/utilities/updateJob.js.map +1 -1
  494. package/dist/translations/getLocalI18n.d.ts.map +1 -1
  495. package/dist/types/index.d.ts +54 -5
  496. package/dist/types/index.d.ts.map +1 -1
  497. package/dist/types/index.js.map +1 -1
  498. package/dist/uploads/checkFileAccess.d.ts.map +1 -1
  499. package/dist/uploads/checkFileRestrictions.d.ts.map +1 -1
  500. package/dist/uploads/docWithFilenameExists.d.ts.map +1 -1
  501. package/dist/uploads/endpoints/getFileFromURL.d.ts.map +1 -1
  502. package/dist/uploads/endpoints/getFileFromURL.js +9 -5
  503. package/dist/uploads/endpoints/getFileFromURL.js.map +1 -1
  504. package/dist/uploads/fetchAPI-multipart/isEligibleRequest.d.ts.map +1 -1
  505. package/dist/uploads/fetchAPI-multipart/processMultipart.d.ts.map +1 -1
  506. package/dist/uploads/fetchAPI-multipart/processMultipart.js +14 -1
  507. package/dist/uploads/fetchAPI-multipart/processMultipart.js.map +1 -1
  508. package/dist/uploads/fetchAPI-multipart/processNested.d.ts.map +1 -1
  509. package/dist/uploads/fetchAPI-multipart/utilities.d.ts.map +1 -1
  510. package/dist/uploads/fileExists.d.ts.map +1 -1
  511. package/dist/uploads/generateFileData.d.ts +2 -1
  512. package/dist/uploads/generateFileData.d.ts.map +1 -1
  513. package/dist/uploads/generateFileData.js +5 -2
  514. package/dist/uploads/generateFileData.js.map +1 -1
  515. package/dist/uploads/getBaseFields.d.ts.map +1 -1
  516. package/dist/uploads/getBaseFields.js +24 -70
  517. package/dist/uploads/getBaseFields.js.map +1 -1
  518. package/dist/uploads/getExternalFile.d.ts.map +1 -1
  519. package/dist/uploads/getFileByPath.d.ts.map +1 -1
  520. package/dist/uploads/getFileTypeFallback.d.ts.map +1 -1
  521. package/dist/uploads/getSafeFilename.d.ts +9 -4
  522. package/dist/uploads/getSafeFilename.d.ts.map +1 -1
  523. package/dist/uploads/getSafeFilename.js +5 -5
  524. package/dist/uploads/getSafeFilename.js.map +1 -1
  525. package/dist/uploads/image-resizing/createImageSize.d.ts.map +1 -1
  526. package/dist/uploads/image-resizing/generateImageSizeFilename.d.ts.map +1 -1
  527. package/dist/uploads/image-resizing/getImageResizeAction.d.ts.map +1 -1
  528. package/dist/uploads/image-resizing/parseFilename.d.ts.map +1 -1
  529. package/dist/uploads/image-resizing/sanitizeResizeConfig.d.ts.map +1 -1
  530. package/dist/uploads/mimeTypeValidator.d.ts.map +1 -1
  531. package/dist/uploads/safeFetch.d.ts +1 -1
  532. package/dist/uploads/safeFetch.d.ts.map +1 -1
  533. package/dist/uploads/safeFetch.js +11 -5
  534. package/dist/uploads/safeFetch.js.map +1 -1
  535. package/dist/uploads/saveBufferToFile.d.ts.map +1 -1
  536. package/dist/uploads/tempFile.d.ts.map +1 -1
  537. package/dist/uploads/types.d.ts +12 -29
  538. package/dist/uploads/types.d.ts.map +1 -1
  539. package/dist/uploads/types.js.map +1 -1
  540. package/dist/uploads/uploadFiles.d.ts.map +1 -1
  541. package/dist/utilities/addLocalesToRequest.d.ts.map +1 -1
  542. package/dist/utilities/addSelectGenericsToGeneretedTypes.d.ts.map +1 -1
  543. package/dist/utilities/appendDateTimezoneSelectFields.d.ts +13 -0
  544. package/dist/utilities/appendDateTimezoneSelectFields.d.ts.map +1 -0
  545. package/dist/utilities/appendDateTimezoneSelectFields.js +47 -0
  546. package/dist/utilities/appendDateTimezoneSelectFields.js.map +1 -0
  547. package/dist/utilities/appendNonTrashedFilter.d.ts.map +1 -1
  548. package/dist/utilities/appendUploadSelectFields.d.ts.map +1 -1
  549. package/dist/utilities/appendUploadSelectFields.js +3 -0
  550. package/dist/utilities/appendUploadSelectFields.js.map +1 -1
  551. package/dist/utilities/canAccessAdmin.d.ts.map +1 -1
  552. package/dist/utilities/checkDocumentLockStatus.d.ts.map +1 -1
  553. package/dist/utilities/configToJSONSchema.d.ts +59 -16
  554. package/dist/utilities/configToJSONSchema.d.ts.map +1 -1
  555. package/dist/utilities/configToJSONSchema.js +191 -74
  556. package/dist/utilities/configToJSONSchema.js.map +1 -1
  557. package/dist/utilities/configToJSONSchema.spec.js +301 -85
  558. package/dist/utilities/configToJSONSchema.spec.js.map +1 -1
  559. package/dist/utilities/createPayloadRequest.d.ts.map +1 -1
  560. package/dist/utilities/deepCopyObject.d.ts.map +1 -1
  561. package/dist/utilities/dependencies/dependencyChecker.js +1 -1
  562. package/dist/utilities/dependencies/dependencyChecker.js.map +1 -1
  563. package/dist/utilities/dependencies/getDependencies.d.ts.map +1 -1
  564. package/dist/utilities/dependencies/getDependencies.js +5 -5
  565. package/dist/utilities/dependencies/getDependencies.js.map +1 -1
  566. package/dist/utilities/dependencies/resolveFrom.d.ts.map +1 -1
  567. package/dist/utilities/dynamicImport.js +1 -1
  568. package/dist/utilities/dynamicImport.js.map +1 -1
  569. package/dist/utilities/escapeRegExp.d.ts.map +1 -1
  570. package/dist/utilities/extractID.d.ts.map +1 -1
  571. package/dist/utilities/extractID.js +1 -1
  572. package/dist/utilities/extractID.js.map +1 -1
  573. package/dist/utilities/flattenAllFields.d.ts.map +1 -1
  574. package/dist/utilities/formatAdminURL.d.ts +13 -2
  575. package/dist/utilities/formatAdminURL.d.ts.map +1 -1
  576. package/dist/utilities/formatAdminURL.js +3 -15
  577. package/dist/utilities/formatAdminURL.js.map +1 -1
  578. package/dist/utilities/formatAdminURL.spec.js +1 -90
  579. package/dist/utilities/formatAdminURL.spec.js.map +1 -1
  580. package/dist/utilities/formatErrors.d.ts.map +1 -1
  581. package/dist/utilities/formatErrors.js +3 -1
  582. package/dist/utilities/formatErrors.js.map +1 -1
  583. package/dist/utilities/formatLabels.d.ts.map +1 -1
  584. package/dist/utilities/getBestFitFromSizes.d.ts.map +1 -1
  585. package/dist/utilities/getBlockSelect.d.ts.map +1 -1
  586. package/dist/utilities/getDataByPath.d.ts.map +1 -1
  587. package/dist/utilities/getEntityPermissions/populateFieldPermissions.d.ts.map +1 -1
  588. package/dist/utilities/getFieldByPath.d.ts.map +1 -1
  589. package/dist/utilities/getFieldPermissions.d.ts.map +1 -1
  590. package/dist/utilities/getObjectDotNotation.d.ts.map +1 -1
  591. package/dist/utilities/getRequestEntity.d.ts.map +1 -1
  592. package/dist/utilities/getRequestLanguage.d.ts +2 -2
  593. package/dist/utilities/getRequestLanguage.d.ts.map +1 -1
  594. package/dist/utilities/getRequestLanguage.js.map +1 -1
  595. package/dist/utilities/getRequestOrigin.d.ts.map +1 -1
  596. package/dist/utilities/getSafeRedirect.d.ts.map +1 -1
  597. package/dist/utilities/getSelectMode.d.ts.map +1 -1
  598. package/dist/utilities/getSiblingData.d.ts.map +1 -1
  599. package/dist/utilities/getTranslatedLabel.d.ts.map +1 -1
  600. package/dist/utilities/getVersionsConfig.d.ts.map +1 -1
  601. package/dist/utilities/handleEndpoints.d.ts.map +1 -1
  602. package/dist/utilities/handleEndpoints.js +9 -9
  603. package/dist/utilities/handleEndpoints.js.map +1 -1
  604. package/dist/utilities/headersWithCors.d.ts.map +1 -1
  605. package/dist/utilities/isEntityHidden.d.ts.map +1 -1
  606. package/dist/utilities/isRSCEnabled.d.ts +12 -0
  607. package/dist/utilities/isRSCEnabled.d.ts.map +1 -0
  608. package/dist/utilities/isRSCEnabled.js +14 -0
  609. package/dist/utilities/isRSCEnabled.js.map +1 -0
  610. package/dist/utilities/isURLAllowed.d.ts.map +1 -1
  611. package/dist/utilities/isValidID.d.ts.map +1 -1
  612. package/dist/utilities/logError.d.ts.map +1 -1
  613. package/dist/utilities/logger.d.ts.map +1 -1
  614. package/dist/utilities/mergeHeaders.d.ts.map +1 -1
  615. package/dist/utilities/mergeListSearchAndWhere.d.ts.map +1 -1
  616. package/dist/utilities/optionsAreEqual.d.ts.map +1 -1
  617. package/dist/utilities/parseBooleanString.d.ts.map +1 -1
  618. package/dist/utilities/parseCookies.d.ts.map +1 -1
  619. package/dist/utilities/parseParams/index.d.ts.map +1 -1
  620. package/dist/utilities/profiling.d.ts.map +1 -1
  621. package/dist/utilities/reduceFieldsToValues.d.ts.map +1 -1
  622. package/dist/utilities/resolveSelect.d.ts +16 -0
  623. package/dist/utilities/resolveSelect.d.ts.map +1 -0
  624. package/dist/utilities/resolveSelect.js +19 -0
  625. package/dist/utilities/resolveSelect.js.map +1 -0
  626. package/dist/utilities/routeError.d.ts.map +1 -1
  627. package/dist/utilities/sanitizeFallbackLocale.d.ts.map +1 -1
  628. package/dist/utilities/sanitizeInternalFields.d.ts.map +1 -1
  629. package/dist/utilities/sanitizeJoinParams.d.ts.map +1 -1
  630. package/dist/utilities/sanitizePopulateParam.d.ts.map +1 -1
  631. package/dist/utilities/sanitizeSelect.d.ts +1 -2
  632. package/dist/utilities/sanitizeSelect.d.ts.map +1 -1
  633. package/dist/utilities/sanitizeSelect.js +19 -25
  634. package/dist/utilities/sanitizeSelect.js.map +1 -1
  635. package/dist/utilities/sanitizeSelectParam.d.ts.map +1 -1
  636. package/dist/utilities/sanitizeSortParams.d.ts.map +1 -1
  637. package/dist/utilities/setsAreEqual.d.ts.map +1 -1
  638. package/dist/utilities/slugify.d.ts.map +1 -1
  639. package/dist/utilities/stripUnselectedFields.d.ts.map +1 -1
  640. package/dist/utilities/telemetry/conf/envPaths.d.ts.map +1 -1
  641. package/dist/utilities/telemetry/conf/envPaths.js +31 -40
  642. package/dist/utilities/telemetry/conf/envPaths.js.map +1 -1
  643. package/dist/utilities/telemetry/events/adminInit.d.ts.map +1 -1
  644. package/dist/utilities/telemetry/events/serverInit.d.ts.map +1 -1
  645. package/dist/utilities/telemetry/index.d.ts.map +1 -1
  646. package/dist/utilities/telemetry/oneWayHash.d.ts.map +1 -1
  647. package/dist/utilities/timestamp.d.ts.map +1 -1
  648. package/dist/utilities/toKebabCase.d.ts.map +1 -1
  649. package/dist/utilities/transformColumnPreferences.d.ts.map +1 -1
  650. package/dist/utilities/transformColumnPreferences.js +4 -2
  651. package/dist/utilities/transformColumnPreferences.js.map +1 -1
  652. package/dist/utilities/transformWhereQuery.d.ts.map +1 -1
  653. package/dist/utilities/traverseFields.d.ts.map +1 -1
  654. package/dist/utilities/traverseForLocalizedFields.d.ts.map +1 -1
  655. package/dist/utilities/unflatten.d.ts.map +1 -1
  656. package/dist/utilities/validateMimeType.d.ts.map +1 -1
  657. package/dist/utilities/validateTimezones.d.ts.map +1 -1
  658. package/dist/utilities/validateWhereQuery.d.ts.map +1 -1
  659. package/dist/utilities/wordBoundariesRegex.d.ts.map +1 -1
  660. package/dist/utilities/wrapInternalEndpoints.d.ts.map +1 -1
  661. package/dist/versions/baseFields.d.ts.map +1 -1
  662. package/dist/versions/baseFields.js +3 -2
  663. package/dist/versions/baseFields.js.map +1 -1
  664. package/dist/versions/buildCollectionFields.d.ts.map +1 -1
  665. package/dist/versions/buildCollectionFields.js +0 -1
  666. package/dist/versions/buildCollectionFields.js.map +1 -1
  667. package/dist/versions/buildGlobalFields.d.ts.map +1 -1
  668. package/dist/versions/buildGlobalFields.js +0 -1
  669. package/dist/versions/buildGlobalFields.js.map +1 -1
  670. package/dist/versions/buildVersionCompoundIndexes.d.ts.map +1 -1
  671. package/dist/versions/deleteCollectionVersions.d.ts.map +1 -1
  672. package/dist/versions/deleteScheduledPublishJobs.d.ts.map +1 -1
  673. package/dist/versions/drafts/appendVersionToQueryKey.d.ts.map +1 -1
  674. package/dist/versions/drafts/getQueryDraftsSelect.d.ts.map +1 -1
  675. package/dist/versions/drafts/getQueryDraftsSort.d.ts.map +1 -1
  676. package/dist/versions/drafts/replaceWithDraftIfAvailable.d.ts.map +1 -1
  677. package/dist/versions/enforceMaxVersions.d.ts.map +1 -1
  678. package/dist/versions/getLatestCollectionVersion.d.ts.map +1 -1
  679. package/dist/versions/getLatestGlobalVersion.d.ts.map +1 -1
  680. package/dist/versions/migrations/localizeStatus/shared.d.ts.map +1 -1
  681. package/dist/versions/payloadPackageList.d.ts.map +1 -1
  682. package/dist/versions/payloadPackageList.js +0 -1
  683. package/dist/versions/payloadPackageList.js.map +1 -1
  684. package/dist/versions/saveSnapshot.d.ts.map +1 -1
  685. package/dist/versions/schedule/job.d.ts.map +1 -1
  686. package/package.json +25 -22
  687. package/dist/admin/views/folderList.d.ts +0 -56
  688. package/dist/admin/views/folderList.d.ts.map +0 -1
  689. package/dist/admin/views/folderList.js +0 -3
  690. package/dist/admin/views/folderList.js.map +0 -1
  691. package/dist/folders/addFolderCollection.d.ts +0 -10
  692. package/dist/folders/addFolderCollection.d.ts.map +0 -1
  693. package/dist/folders/addFolderCollection.js +0 -26
  694. package/dist/folders/addFolderCollection.js.map +0 -1
  695. package/dist/folders/addFolderFieldToCollection.d.ts +0 -8
  696. package/dist/folders/addFolderFieldToCollection.d.ts.map +0 -1
  697. package/dist/folders/addFolderFieldToCollection.js +0 -20
  698. package/dist/folders/addFolderFieldToCollection.js.map +0 -1
  699. package/dist/folders/buildFolderField.d.ts +0 -8
  700. package/dist/folders/buildFolderField.d.ts.map +0 -1
  701. package/dist/folders/buildFolderField.js +0 -87
  702. package/dist/folders/buildFolderField.js.map +0 -1
  703. package/dist/folders/constants.d.ts +0 -3
  704. package/dist/folders/constants.d.ts.map +0 -1
  705. package/dist/folders/constants.js +0 -4
  706. package/dist/folders/constants.js.map +0 -1
  707. package/dist/folders/createFolderCollection.d.ts +0 -11
  708. package/dist/folders/createFolderCollection.d.ts.map +0 -1
  709. package/dist/folders/createFolderCollection.js +0 -115
  710. package/dist/folders/createFolderCollection.js.map +0 -1
  711. package/dist/folders/hooks/deleteSubfoldersAfterDelete.d.ts +0 -8
  712. package/dist/folders/hooks/deleteSubfoldersAfterDelete.d.ts.map +0 -1
  713. package/dist/folders/hooks/deleteSubfoldersAfterDelete.js +0 -15
  714. package/dist/folders/hooks/deleteSubfoldersAfterDelete.js.map +0 -1
  715. package/dist/folders/hooks/dissasociateAfterDelete.d.ts +0 -8
  716. package/dist/folders/hooks/dissasociateAfterDelete.d.ts.map +0 -1
  717. package/dist/folders/hooks/dissasociateAfterDelete.js +0 -20
  718. package/dist/folders/hooks/dissasociateAfterDelete.js.map +0 -1
  719. package/dist/folders/hooks/ensureSafeCollectionsChange.d.ts +0 -5
  720. package/dist/folders/hooks/ensureSafeCollectionsChange.d.ts.map +0 -1
  721. package/dist/folders/hooks/ensureSafeCollectionsChange.js +0 -107
  722. package/dist/folders/hooks/ensureSafeCollectionsChange.js.map +0 -1
  723. package/dist/folders/hooks/reparentChildFolder.d.ts +0 -24
  724. package/dist/folders/hooks/reparentChildFolder.d.ts.map +0 -1
  725. package/dist/folders/hooks/reparentChildFolder.js +0 -72
  726. package/dist/folders/hooks/reparentChildFolder.js.map +0 -1
  727. package/dist/folders/types.d.ts +0 -118
  728. package/dist/folders/types.d.ts.map +0 -1
  729. package/dist/folders/types.js +0 -3
  730. package/dist/folders/types.js.map +0 -1
  731. package/dist/folders/utils/buildFolderWhereConstraints.d.ts +0 -13
  732. package/dist/folders/utils/buildFolderWhereConstraints.d.ts.map +0 -1
  733. package/dist/folders/utils/buildFolderWhereConstraints.js +0 -45
  734. package/dist/folders/utils/buildFolderWhereConstraints.js.map +0 -1
  735. package/dist/folders/utils/formatFolderOrDocumentItem.d.ts +0 -12
  736. package/dist/folders/utils/formatFolderOrDocumentItem.d.ts.map +0 -1
  737. package/dist/folders/utils/formatFolderOrDocumentItem.js +0 -30
  738. package/dist/folders/utils/formatFolderOrDocumentItem.js.map +0 -1
  739. package/dist/folders/utils/getFolderBreadcrumbs.d.ts +0 -14
  740. package/dist/folders/utils/getFolderBreadcrumbs.d.ts.map +0 -1
  741. package/dist/folders/utils/getFolderBreadcrumbs.js +0 -45
  742. package/dist/folders/utils/getFolderBreadcrumbs.js.map +0 -1
  743. package/dist/folders/utils/getFolderData.d.ts +0 -33
  744. package/dist/folders/utils/getFolderData.d.ts.map +0 -1
  745. package/dist/folders/utils/getFolderData.js +0 -88
  746. package/dist/folders/utils/getFolderData.js.map +0 -1
  747. package/dist/folders/utils/getFoldersAndDocumentsFromJoin.d.ts +0 -24
  748. package/dist/folders/utils/getFoldersAndDocumentsFromJoin.d.ts.map +0 -1
  749. package/dist/folders/utils/getFoldersAndDocumentsFromJoin.js +0 -66
  750. package/dist/folders/utils/getFoldersAndDocumentsFromJoin.js.map +0 -1
  751. package/dist/folders/utils/getOrphanedDocs.d.ts +0 -15
  752. package/dist/folders/utils/getOrphanedDocs.d.ts.map +0 -1
  753. package/dist/folders/utils/getOrphanedDocs.js +0 -40
  754. package/dist/folders/utils/getOrphanedDocs.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"findVersionByID.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/findVersionByID.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACpF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB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AAA;IACvB,GAAG,EAAE,cAAc,CAAA;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAA;AAEnD,eAAO,MAAM,wBAAwB,GAAU,KAAK,SAAS,UAAU,GAAG,GAAG,EAC3E,MAAM,SAAS,KACd,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAsLhC,CAAA"}
@@ -5,9 +5,9 @@ import { APIError, Forbidden, NotFound } from '../../errors/index.js';
5
5
  import { afterRead } from '../../fields/hooks/afterRead/index.js';
6
6
  import { appendNonTrashedFilter } from '../../utilities/appendNonTrashedFilter.js';
7
7
  import { killTransaction } from '../../utilities/killTransaction.js';
8
+ import { resolveSelect } from '../../utilities/resolveSelect.js';
8
9
  import { sanitizeSelect } from '../../utilities/sanitizeSelect.js';
9
10
  import { buildVersionCollectionFields } from '../../versions/buildCollectionFields.js';
10
- import { getQueryDraftsSelect } from '../../versions/drafts/getQueryDraftsSelect.js';
11
11
  import { buildAfterOperation } from './utilities/buildAfterOperation.js';
12
12
  import { buildBeforeOperation } from './utilities/buildBeforeOperation.js';
13
13
  export const findVersionByIDOperation = async (args)=>{
@@ -55,10 +55,12 @@ export const findVersionByIDOperation = async (args)=>{
55
55
  // /////////////////////////////////////
56
56
  const select = sanitizeSelect({
57
57
  fields: buildVersionCollectionFields(payload.config, collectionConfig, true),
58
- forceSelect: getQueryDraftsSelect({
59
- select: collectionConfig.forceSelect
58
+ select: resolveSelect({
59
+ config: collectionConfig.select,
60
+ operation: 'read',
61
+ req,
62
+ select: incomingSelect
60
63
  }),
61
- select: incomingSelect,
62
64
  versions: true
63
65
  });
64
66
  const versionsQuery = await payload.db.findVersions({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/collections/operations/findVersionByID.ts"],"sourcesContent":["import { status as httpStatus } from 'http-status'\n\nimport type { FindOptions } from '../../index.js'\nimport type { PayloadRequest, PopulateType, SelectType } from '../../types/index.js'\nimport type { TypeWithVersion } from '../../versions/types.js'\nimport type { Collection, TypeWithID } from '../config/types.js'\n\nimport { executeAccess } from '../../auth/executeAccess.js'\nimport { combineQueries } from '../../database/combineQueries.js'\nimport { APIError, Forbidden, NotFound } from '../../errors/index.js'\nimport { afterRead } from '../../fields/hooks/afterRead/index.js'\nimport { appendNonTrashedFilter } from '../../utilities/appendNonTrashedFilter.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { sanitizeSelect } from '../../utilities/sanitizeSelect.js'\nimport { buildVersionCollectionFields } from '../../versions/buildCollectionFields.js'\nimport { getQueryDraftsSelect } from '../../versions/drafts/getQueryDraftsSelect.js'\nimport { buildAfterOperation } from './utilities/buildAfterOperation.js'\nimport { buildBeforeOperation } from './utilities/buildBeforeOperation.js'\n\nexport type Arguments = {\n collection: Collection\n currentDepth?: number\n depth?: number\n disableErrors?: boolean\n id: number | string\n overrideAccess?: boolean\n populate?: PopulateType\n req: PayloadRequest\n showHiddenFields?: boolean\n trash?: boolean\n} & Pick<FindOptions<string, SelectType>, 'select'>\n\nexport const findVersionByIDOperation = async <TData extends TypeWithID = any>(\n args: Arguments,\n): Promise<TypeWithVersion<TData>> => {\n const {\n id,\n collection: { config: collectionConfig },\n currentDepth,\n depth,\n disableErrors,\n overrideAccess,\n populate,\n req: { fallbackLocale, locale, payload },\n req,\n select: incomingSelect,\n showHiddenFields,\n trash = false,\n } = args\n\n if (!id) {\n throw new APIError('Missing ID of version.', httpStatus.BAD_REQUEST)\n }\n\n try {\n // /////////////////////////////////////\n // beforeOperation - Collection\n // /////////////////////////////////////\n\n args = await buildBeforeOperation({\n args,\n collection: collectionConfig,\n operation: 'findVersionByID',\n overrideAccess,\n })\n\n // /////////////////////////////////////\n // Access\n // /////////////////////////////////////\n\n const accessResults = !overrideAccess\n ? await executeAccess({ id, disableErrors, req }, collectionConfig.access.readVersions)\n : true\n\n // If errors are disabled, and access returns false, return null\n if (accessResults === false) {\n return null!\n }\n\n const hasWhereAccess = typeof accessResults === 'object'\n\n const where = { id: { equals: id } }\n\n let fullWhere = combineQueries(where, accessResults)\n\n fullWhere = appendNonTrashedFilter({\n deletedAtPath: 'version.deletedAt',\n enableTrash: collectionConfig.trash,\n trash,\n where: fullWhere,\n })\n\n // /////////////////////////////////////\n // Find by ID\n // /////////////////////////////////////\n\n const select = sanitizeSelect({\n fields: buildVersionCollectionFields(payload.config, collectionConfig, true),\n forceSelect: getQueryDraftsSelect({ select: collectionConfig.forceSelect }),\n select: incomingSelect,\n versions: true,\n })\n\n const versionsQuery = await payload.db.findVersions<TData>({\n collection: collectionConfig.slug,\n limit: 1,\n locale: locale!,\n pagination: false,\n req,\n select,\n where: fullWhere,\n })\n\n let result = versionsQuery.docs[0]!\n\n if (!result) {\n if (!disableErrors) {\n if (!hasWhereAccess) {\n throw new NotFound(req.t)\n }\n if (hasWhereAccess) {\n throw new Forbidden(req.t)\n }\n }\n\n return null!\n }\n\n if (!result.version) {\n // Fallback if not selected\n ;(result as any).version = {}\n }\n\n // /////////////////////////////////////\n // beforeRead - Collection\n // /////////////////////////////////////\n\n if (collectionConfig.hooks?.beforeRead?.length) {\n for (const hook of collectionConfig.hooks.beforeRead) {\n result.version =\n (await hook({\n collection: collectionConfig,\n context: req.context,\n doc: result.version,\n overrideAccess,\n query: fullWhere,\n req,\n })) || result.version\n }\n }\n\n // /////////////////////////////////////\n // afterRead - Fields\n // /////////////////////////////////////\n\n result.version = await afterRead({\n collection: collectionConfig,\n context: req.context,\n currentDepth,\n depth: depth!,\n doc: result.version,\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n draft: undefined,\n fallbackLocale: fallbackLocale!,\n global: null,\n locale: locale!,\n overrideAccess: overrideAccess!,\n populate,\n req,\n select: typeof select?.version === 'object' ? select.version : undefined,\n showHiddenFields: showHiddenFields!,\n })\n\n // /////////////////////////////////////\n // afterRead - Collection\n // /////////////////////////////////////\n\n if (collectionConfig.hooks?.afterRead?.length) {\n for (const hook of collectionConfig.hooks.afterRead) {\n result.version =\n (await hook({\n collection: collectionConfig,\n context: req.context,\n doc: result.version,\n overrideAccess,\n query: fullWhere,\n req,\n })) || result.version\n }\n }\n\n // /////////////////////////////////////\n // afterOperation - Collection\n // /////////////////////////////////////\n\n result = await buildAfterOperation({\n args,\n collection: collectionConfig,\n operation: 'findVersionByID',\n overrideAccess,\n result,\n })\n\n // /////////////////////////////////////\n // Return results\n // /////////////////////////////////////\n\n return result\n } catch (error: unknown) {\n await killTransaction(req)\n throw error\n }\n}\n"],"names":["status","httpStatus","executeAccess","combineQueries","APIError","Forbidden","NotFound","afterRead","appendNonTrashedFilter","killTransaction","sanitizeSelect","buildVersionCollectionFields","getQueryDraftsSelect","buildAfterOperation","buildBeforeOperation","findVersionByIDOperation","args","id","collection","config","collectionConfig","currentDepth","depth","disableErrors","overrideAccess","populate","req","fallbackLocale","locale","payload","select","incomingSelect","showHiddenFields","trash","BAD_REQUEST","operation","accessResults","access","readVersions","hasWhereAccess","where","equals","fullWhere","deletedAtPath","enableTrash","fields","forceSelect","versions","versionsQuery","db","findVersions","slug","limit","pagination","result","docs","t","version","hooks","beforeRead","length","hook","context","doc","query","draft","undefined","global","error"],"mappings":"AAAA,SAASA,UAAUC,UAAU,QAAQ,cAAa;AAOlD,SAASC,aAAa,QAAQ,8BAA6B;AAC3D,SAASC,cAAc,QAAQ,mCAAkC;AACjE,SAASC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,wBAAuB;AACrE,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,sBAAsB,QAAQ,4CAA2C;AAClF,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,cAAc,QAAQ,oCAAmC;AAClE,SAASC,4BAA4B,QAAQ,0CAAyC;AACtF,SAASC,oBAAoB,QAAQ,gDAA+C;AACpF,SAASC,mBAAmB,QAAQ,qCAAoC;AACxE,SAASC,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YAC/DlC,kBAAkBA;QACpB;QAEA,wCAAwC;QACxC,yBAAyB;QACzB,wCAAwC;QAExC,IAAIZ,iBAAiBsC,KAAK,EAAEnD,WAAWqD,QAAQ;YAC7C,KAAK,MAAMC,QAAQzC,iBAAiBsC,KAAK,CAACnD,SAAS,CAAE;gBACnD+C,OAAOG,OAAO,GACZ,AAAC,MAAMI,KAAK;oBACV3C,YAAYE;oBACZ0C,SAASpC,IAAIoC,OAAO;oBACpBC,KAAKT,OAAOG,OAAO;oBACnBjC;oBACAwC,OAAOtB;oBACPhB;gBACF,MAAO4B,OAAOG,OAAO;YACzB;QACF;QAEA,wCAAwC;QACxC,8BAA8B;QAC9B,wCAAwC;QAExCH,SAAS,MAAMzC,oBAAoB;YACjCG;YACAE,YAAYE;YACZe,WAAW;YACXX;YACA8B;QACF;QAEA,wCAAwC;QACxC,iBAAiB;QACjB,wCAAwC;QAExC,OAAOA;IACT,EAAE,OAAOc,OAAgB;QACvB,MAAM3D,gBAAgBiB;QACtB,MAAM0C;IACR;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/collections/operations/findVersionByID.ts"],"sourcesContent":["import { status as httpStatus } from 'http-status'\n\nimport type { FindOptions } from '../../index.js'\nimport type { PayloadRequest, PopulateType, SelectType } from '../../types/index.js'\nimport type { TypeWithVersion } from '../../versions/types.js'\nimport type { Collection, TypeWithID } from '../config/types.js'\n\nimport { executeAccess } from '../../auth/executeAccess.js'\nimport { combineQueries } from '../../database/combineQueries.js'\nimport { APIError, Forbidden, NotFound } from '../../errors/index.js'\nimport { afterRead } from '../../fields/hooks/afterRead/index.js'\nimport { appendNonTrashedFilter } from '../../utilities/appendNonTrashedFilter.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { resolveSelect } from '../../utilities/resolveSelect.js'\nimport { sanitizeSelect } from '../../utilities/sanitizeSelect.js'\nimport { buildVersionCollectionFields } from '../../versions/buildCollectionFields.js'\nimport { buildAfterOperation } from './utilities/buildAfterOperation.js'\nimport { buildBeforeOperation } from './utilities/buildBeforeOperation.js'\n\nexport type Arguments = {\n collection: Collection\n currentDepth?: number\n depth?: number\n disableErrors?: boolean\n id: number | string\n overrideAccess?: boolean\n populate?: PopulateType\n req: PayloadRequest\n showHiddenFields?: boolean\n trash?: boolean\n} & Pick<FindOptions<string, SelectType>, 'select'>\n\nexport const findVersionByIDOperation = async <TData extends TypeWithID = any>(\n args: Arguments,\n): Promise<TypeWithVersion<TData>> => {\n const {\n id,\n collection: { config: collectionConfig },\n currentDepth,\n depth,\n disableErrors,\n overrideAccess,\n populate,\n req: { fallbackLocale, locale, payload },\n req,\n select: incomingSelect,\n showHiddenFields,\n trash = false,\n } = args\n\n if (!id) {\n throw new APIError('Missing ID of version.', httpStatus.BAD_REQUEST)\n }\n\n try {\n // /////////////////////////////////////\n // beforeOperation - Collection\n // /////////////////////////////////////\n\n args = await buildBeforeOperation({\n args,\n collection: collectionConfig,\n operation: 'findVersionByID',\n overrideAccess,\n })\n\n // /////////////////////////////////////\n // Access\n // /////////////////////////////////////\n\n const accessResults = !overrideAccess\n ? await executeAccess({ id, disableErrors, req }, collectionConfig.access.readVersions)\n : true\n\n // If errors are disabled, and access returns false, return null\n if (accessResults === false) {\n return null!\n }\n\n const hasWhereAccess = typeof accessResults === 'object'\n\n const where = { id: { equals: id } }\n\n let fullWhere = combineQueries(where, accessResults)\n\n fullWhere = appendNonTrashedFilter({\n deletedAtPath: 'version.deletedAt',\n enableTrash: collectionConfig.trash,\n trash,\n where: fullWhere,\n })\n\n // /////////////////////////////////////\n // Find by ID\n // /////////////////////////////////////\n\n const select = sanitizeSelect({\n fields: buildVersionCollectionFields(payload.config, collectionConfig, true),\n select: resolveSelect({\n config: collectionConfig.select,\n operation: 'read',\n req,\n select: incomingSelect,\n }),\n versions: true,\n })\n\n const versionsQuery = await payload.db.findVersions<TData>({\n collection: collectionConfig.slug,\n limit: 1,\n locale: locale!,\n pagination: false,\n req,\n select,\n where: fullWhere,\n })\n\n let result = versionsQuery.docs[0]!\n\n if (!result) {\n if (!disableErrors) {\n if (!hasWhereAccess) {\n throw new NotFound(req.t)\n }\n if (hasWhereAccess) {\n throw new Forbidden(req.t)\n }\n }\n\n return null!\n }\n\n if (!result.version) {\n // Fallback if not selected\n ;(result as any).version = {}\n }\n\n // /////////////////////////////////////\n // beforeRead - Collection\n // /////////////////////////////////////\n\n if (collectionConfig.hooks?.beforeRead?.length) {\n for (const hook of collectionConfig.hooks.beforeRead) {\n result.version =\n (await hook({\n collection: collectionConfig,\n context: req.context,\n doc: result.version,\n overrideAccess,\n query: fullWhere,\n req,\n })) || result.version\n }\n }\n\n // /////////////////////////////////////\n // afterRead - Fields\n // /////////////////////////////////////\n\n result.version = await afterRead({\n collection: collectionConfig,\n context: req.context,\n currentDepth,\n depth: depth!,\n doc: result.version,\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n draft: undefined,\n fallbackLocale: fallbackLocale!,\n global: null,\n locale: locale!,\n overrideAccess: overrideAccess!,\n populate,\n req,\n select: typeof select?.version === 'object' ? select.version : undefined,\n showHiddenFields: showHiddenFields!,\n })\n\n // /////////////////////////////////////\n // afterRead - Collection\n // /////////////////////////////////////\n\n if (collectionConfig.hooks?.afterRead?.length) {\n for (const hook of collectionConfig.hooks.afterRead) {\n result.version =\n (await hook({\n collection: collectionConfig,\n context: req.context,\n doc: result.version,\n overrideAccess,\n query: fullWhere,\n req,\n })) || result.version\n }\n }\n\n // /////////////////////////////////////\n // afterOperation - Collection\n // /////////////////////////////////////\n\n result = await buildAfterOperation({\n args,\n collection: collectionConfig,\n operation: 'findVersionByID',\n overrideAccess,\n result,\n })\n\n // /////////////////////////////////////\n // Return results\n // /////////////////////////////////////\n\n return result\n } catch (error: unknown) {\n await killTransaction(req)\n throw error\n }\n}\n"],"names":["status","httpStatus","executeAccess","combineQueries","APIError","Forbidden","NotFound","afterRead","appendNonTrashedFilter","killTransaction","resolveSelect","sanitizeSelect","buildVersionCollectionFields","buildAfterOperation","buildBeforeOperation","findVersionByIDOperation","args","id","collection","config","collectionConfig","currentDepth","depth","disableErrors","overrideAccess","populate","req","fallbackLocale","locale","payload","select","incomingSelect","showHiddenFields","trash","BAD_REQUEST","operation","accessResults","access","readVersions","hasWhereAccess","where","equals","fullWhere","deletedAtPath","enableTrash","fields","versions","versionsQuery","db","findVersions","slug","limit","pagination","result","docs","t","version","hooks","beforeRead","length","hook","context","doc","query","draft","undefined","global","error"],"mappings":"AAAA,SAASA,UAAUC,UAAU,QAAQ,cAAa;AAOlD,SAASC,aAAa,QAAQ,8BAA6B;AAC3D,SAASC,cAAc,QAAQ,mCAAkC;AACjE,SAASC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,wBAAuB;AACrE,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,sBAAsB,QAAQ,4CAA2C;AAClF,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,aAAa,QAAQ,mCAAkC;AAChE,SAASC,cAAc,QAAQ,oCAAmC;AAClE,SAASC,4BAA4B,QAAQ,0CAAyC;AACtF,SAASC,mBAAmB,QAAQ,qCAAoC;AACxE,SAASC,oBAAoB,QAAQ,sCAAqC;AAe1E,OAAO,MAAMC,2BAA2B,OACtCC;IAEA,MAAM,EACJC,EAAE,EACFC,YAAY,EAAEC,QAAQC,gBAAgB,EAAE,EACxCC,YAAY,EACZC,KAAK,EACLC,aAAa,EACbC,cAAc,EACdC,QAAQ,EACRC,KAAK,EAAEC,cAAc,EAAEC,MAAM,EAAEC,OAAO,EAAE,EACxCH,GAAG,EACHI,QAAQC,cAAc,EACtBC,gBAAgB,EAChBC,QAAQ,KAAK,EACd,GAAGjB;IAEJ,IAAI,CAACC,IAAI;QACP,MAAM,IAAIb,SAAS,0BAA0BH,WAAWiC,WAAW;IACrE;IAEA,IAAI;QACF,wCAAwC;QACxC,+BAA+B;QAC/B,wCAAwC;QAExClB,OAAO,MAAMF,qBAAqB;YAChCE;YACAE,YAAYE;YACZe,WAAW;YACX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AwC;QACxC,iBAAiB;QACjB,wCAAwC;QAExC,OAAOA;IACT,EAAE,OAAOc,OAAgB;QACvB,MAAM1D,gBAAgBiB;QACtB,MAAMyC;IACR;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"findVersions.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/findVersions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAgBlD,MAAM,MAAM,SAAS,GAAG;IACtB,UAAU,EAAE,UAAU,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,GAAG,CAAC,EAAE,cAAc,CAAA;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAA;AAEnD,eAAO,MAAM,qBAAqB,GAAU,KAAK,SAAS,eAAe,CAAC,KAAK,CAAC,QACxE,SAAS,KACd,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAmM9B,CAAA"}
1
+ {"version":3,"file":"findVersions.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/findVersions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAgBlD,MAAM,MAAM,SAAS,GAAG;IACtB,UAAU,EAAE,UAAU,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,GAAG,CAAC,EAAE,cAAc,CAAA;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAA;AAEnD,eAAO,MAAM,qBAAqB,GAAU,KAAK,SAAS,eAAe,CAAC,KAAK,CAAC,EAC9E,MAAM,SAAS,KACd,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAuM9B,CAAA"}
@@ -5,10 +5,10 @@ import { sanitizeWhereQuery } from '../../database/sanitizeWhereQuery.js';
5
5
  import { afterRead } from '../../fields/hooks/afterRead/index.js';
6
6
  import { appendNonTrashedFilter } from '../../utilities/appendNonTrashedFilter.js';
7
7
  import { killTransaction } from '../../utilities/killTransaction.js';
8
+ import { resolveSelect } from '../../utilities/resolveSelect.js';
8
9
  import { sanitizeInternalFields } from '../../utilities/sanitizeInternalFields.js';
9
10
  import { sanitizeSelect } from '../../utilities/sanitizeSelect.js';
10
11
  import { buildVersionCollectionFields } from '../../versions/buildCollectionFields.js';
11
- import { getQueryDraftsSelect } from '../../versions/drafts/getQueryDraftsSelect.js';
12
12
  import { buildAfterOperation } from './utilities/buildAfterOperation.js';
13
13
  import { buildBeforeOperation } from './utilities/buildBeforeOperation.js';
14
14
  export const findVersionsOperation = async (args)=>{
@@ -57,10 +57,12 @@ export const findVersionsOperation = async (args)=>{
57
57
  });
58
58
  const select = sanitizeSelect({
59
59
  fields: versionFields,
60
- forceSelect: getQueryDraftsSelect({
61
- select: collectionConfig.forceSelect
60
+ select: resolveSelect({
61
+ config: collectionConfig.select,
62
+ operation: 'read',
63
+ req,
64
+ select: incomingSelect
62
65
  }),
63
- select: incomingSelect,
64
66
  versions: true
65
67
  });
66
68
  // /////////////////////////////////////
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/collections/operations/findVersions.ts"],"sourcesContent":["import type { AccessResult } from '../../config/types.js'\nimport type { PaginatedDocs } from '../../database/types.js'\nimport type { PayloadRequest, PopulateType, SelectType, Sort, Where } from '../../types/index.js'\nimport type { TypeWithVersion } from '../../versions/types.js'\nimport type { Collection } from '../config/types.js'\nimport type { FindOptions } from './local/find.js'\n\nimport { executeAccess } from '../../auth/executeAccess.js'\nimport { combineQueries } from '../../database/combineQueries.js'\nimport { validateQueryPaths } from '../../database/queryValidation/validateQueryPaths.js'\nimport { sanitizeWhereQuery } from '../../database/sanitizeWhereQuery.js'\nimport { afterRead } from '../../fields/hooks/afterRead/index.js'\nimport { appendNonTrashedFilter } from '../../utilities/appendNonTrashedFilter.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { sanitizeInternalFields } from '../../utilities/sanitizeInternalFields.js'\nimport { sanitizeSelect } from '../../utilities/sanitizeSelect.js'\nimport { buildVersionCollectionFields } from '../../versions/buildCollectionFields.js'\nimport { getQueryDraftsSelect } from '../../versions/drafts/getQueryDraftsSelect.js'\nimport { buildAfterOperation } from './utilities/buildAfterOperation.js'\nimport { buildBeforeOperation } from './utilities/buildBeforeOperation.js'\n\nexport type Arguments = {\n collection: Collection\n depth?: number\n limit?: number\n overrideAccess?: boolean\n page?: number\n pagination?: boolean\n populate?: PopulateType\n req?: PayloadRequest\n showHiddenFields?: boolean\n sort?: Sort\n trash?: boolean\n where?: Where\n} & Pick<FindOptions<string, SelectType>, 'select'>\n\nexport const findVersionsOperation = async <TData extends TypeWithVersion<TData>>(\n args: Arguments,\n): Promise<PaginatedDocs<TData>> => {\n try {\n // /////////////////////////////////////\n // beforeOperation - Collection\n // /////////////////////////////////////\n\n args = await buildBeforeOperation({\n args,\n collection: args.collection.config,\n operation: 'findVersions',\n overrideAccess: args.overrideAccess!,\n })\n\n const {\n collection: { config: collectionConfig },\n depth,\n limit,\n overrideAccess,\n page,\n pagination = true,\n populate,\n select: incomingSelect,\n showHiddenFields,\n sort,\n trash = false,\n where,\n } = args\n\n const req = args.req!\n const { fallbackLocale, locale, payload } = req\n\n // /////////////////////////////////////\n // Access\n // /////////////////////////////////////\n\n let accessResults!: AccessResult\n\n if (!overrideAccess) {\n accessResults = await executeAccess({ req }, collectionConfig.access.readVersions)\n }\n\n const versionFields = buildVersionCollectionFields(payload.config, collectionConfig, true)\n\n await validateQueryPaths({\n collectionConfig,\n overrideAccess: overrideAccess!,\n req,\n versionFields,\n where: where!,\n })\n\n let fullWhere = combineQueries(where!, accessResults)\n\n // Exclude trashed documents when trash: false\n fullWhere = appendNonTrashedFilter({\n deletedAtPath: 'version.deletedAt',\n enableTrash: collectionConfig.trash,\n trash,\n where: fullWhere,\n })\n\n sanitizeWhereQuery({ fields: versionFields, payload, where: fullWhere })\n\n const select = sanitizeSelect({\n fields: versionFields,\n forceSelect: getQueryDraftsSelect({ select: collectionConfig.forceSelect }),\n select: incomingSelect,\n versions: true,\n })\n\n // /////////////////////////////////////\n // Find\n // /////////////////////////////////////\n\n const usePagination = pagination && limit !== 0\n const sanitizedLimit = limit ?? (usePagination ? 10 : 0)\n const sanitizedPage = page || 1\n\n const paginatedDocs = await payload.db.findVersions<TData>({\n collection: collectionConfig.slug,\n limit: sanitizedLimit,\n locale: locale!,\n page: sanitizedPage,\n pagination,\n req,\n select,\n sort,\n where: fullWhere,\n })\n\n // /////////////////////////////////////\n // beforeRead - Collection\n // /////////////////////////////////////\n let result: PaginatedDocs<TData> = paginatedDocs as unknown as PaginatedDocs<TData>\n result.docs = (await Promise.all(\n paginatedDocs.docs.map(async (doc) => {\n const docRef = doc\n // Fallback if not selected\n if (!docRef.version) {\n ;(docRef as any).version = {}\n }\n\n if (collectionConfig.hooks?.beforeRead?.length) {\n for (const hook of collectionConfig.hooks.beforeRead) {\n docRef.version =\n (await hook({\n collection: collectionConfig,\n context: req.context,\n doc: docRef.version,\n overrideAccess,\n query: fullWhere,\n req,\n })) || docRef.version\n }\n }\n\n return docRef\n }),\n )) as TData[]\n // /////////////////////////////////////\n // afterRead - Fields\n // /////////////////////////////////////\n\n result.docs = await Promise.all(\n result.docs.map(async (data) => {\n data.version = await afterRead({\n collection: collectionConfig,\n context: req.context,\n depth: depth!,\n doc: data.version,\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n draft: undefined,\n fallbackLocale: fallbackLocale!,\n findMany: true,\n global: null,\n locale: locale!,\n overrideAccess: overrideAccess!,\n populate,\n req,\n select: typeof select?.version === 'object' ? select.version : undefined,\n showHiddenFields: showHiddenFields!,\n })\n return data\n }),\n )\n\n // /////////////////////////////////////\n // afterRead - Collection\n // /////////////////////////////////////\n\n if (collectionConfig.hooks.afterRead?.length) {\n result.docs = await Promise.all(\n result.docs.map(async (doc) => {\n const docRef = doc\n\n for (const hook of collectionConfig.hooks.afterRead) {\n docRef.version =\n (await hook({\n collection: collectionConfig,\n context: req.context,\n doc: doc.version,\n findMany: true,\n overrideAccess,\n query: fullWhere,\n req,\n })) || doc.version\n }\n\n return docRef\n }),\n )\n }\n\n // /////////////////////////////////////\n // Return results\n // /////////////////////////////////////\n result.docs = result.docs.map((doc) => sanitizeInternalFields<TData>(doc))\n\n // /////////////////////////////////////\n // afterOperation - Collection\n // /////////////////////////////////////\n\n result = await buildAfterOperation({\n args,\n collection: collectionConfig,\n operation: 'findVersions',\n overrideAccess,\n result,\n })\n\n return result\n } catch (error: unknown) {\n await killTransaction(args.req!)\n throw error\n }\n}\n"],"names":["executeAccess","combineQueries","validateQueryPaths","sanitizeWhereQuery","afterRead","appendNonTrashedFilter","killTransaction","sanitizeInternalFields","sanitizeSelect","buildVersionCollectionFields","getQueryDraftsSelect","buildAfterOperation","buildBeforeOperation","findVersionsOperation","args","collection","config","operation","overrideAccess","collectionConfig","depth","limit","page","pagination","populate","select","incomingSelect","showHiddenFields","sort","trash","where","req","fallbackLocale","locale","payload","accessResults","access","readVersions","versionFields","fullWhere","deletedAtPath","enableTrash","fields","forceSelect","versions","usePagination","sanitizedLimit","sanitizedPage","paginatedDocs","db","findVersions","slug","result","docs","Promise","all","map","doc","docRef","version","hooks","beforeRead","length","hook","context","query","data","draft","undefined","findMany","global","error"],"mappings":"AAOA,SAASA,aAAa,QAAQ,8BAA6B;AAC3D,SAASC,cAAc,QAAQ,mCAAkC;AACjE,SAASC,kBAAkB,QAAQ,uDAAsD;AACzF,SAASC,kBAAkB,QAAQ,uCAAsC;AACzE,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,sBAAsB,QAAQ,4CAA2C;AAClF,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,sBAAsB,QAAQ,4CAA2C;AAClF,SAASC,cAAc,QAAQ,oCAAmC;AAClE,SAASC,4BAA4B,QAAQ,0CAAyC;AACtF,SAASC,oBAAoB,QAAQ,gDAA+C;AACpF,SAASC,mBAAmB,QAAQ,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qC,KAAKS,KAAKP,OAAO;gBACjB,oFAAoF;gBACpFQ,OAAOC;gBACPpC,gBAAgBA;gBAChBqC,UAAU;gBACVC,QAAQ;gBACRrC,QAAQA;gBACRf,gBAAgBA;gBAChBM;gBACAO;gBACAN,QAAQ,OAAOA,QAAQkC,YAAY,WAAWlC,OAAOkC,OAAO,GAAGS;gBAC/DzC,kBAAkBA;YACpB;YACA,OAAOuC;QACT;QAGF,wCAAwC;QACxC,yBAAyB;QACzB,wCAAwC;QAExC,IAAI/C,iBAAiByC,KAAK,CAACxD,SAAS,EAAE0D,QAAQ;YAC5CV,OAAOC,IAAI,GAAG,MAAMC,QAAQC,GAAG,CAC7BH,OAAOC,IAAI,CAACG,GAAG,CAAC,OAAOC;gBACrB,MAAMC,SAASD;gBAEf,KAAK,MAAMM,QAAQ5C,iBAAiByC,KAAK,CAACxD,SAAS,CAAE;oBACnDsD,OAAOC,OAAO,GACZ,AAAC,MAAMI,KAAK;wBACVhD,YAAYI;wBACZ6C,SAASjC,IAAIiC,OAAO;wBACpBP,KAAKA,IAAIE,OAAO;wBAChBU,UAAU;wBACVnD;wBACA+C,OAAO1B;wBACPR;oBACF,MAAO0B,IAAIE,OAAO;gBACtB;gBAEA,OAAOD;YACT;QAEJ;QAEA,wCAAwC;QACxC,iBAAiB;QACjB,wCAAwC;QACxCN,OAAOC,IAAI,GAAGD,OAAOC,IAAI,CAACG,GAAG,CAAC,CAACC,MAAQlD,uBAA8BkD;QAErE,wCAAwC;QACxC,8BAA8B;QAC9B,wCAAwC;QAExCL,SAAS,MAAMzC,oBAAoB;YACjCG;YACAC,YAAYI;YACZF,WAAW;YACXC;YACAkC;QACF;QAEA,OAAOA;IACT,EAAE,OAAOmB,OAAgB;QACvB,MAAMjE,gBAAgBQ,KAAKiB,GAAG;QAC9B,MAAMwC;IACR;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/collections/operations/findVersions.ts"],"sourcesContent":["import type { AccessResult } from '../../config/types.js'\nimport type { PaginatedDocs } from '../../database/types.js'\nimport type { PayloadRequest, PopulateType, SelectType, Sort, Where } from '../../types/index.js'\nimport type { TypeWithVersion } from '../../versions/types.js'\nimport type { Collection } from '../config/types.js'\nimport type { FindOptions } from './local/find.js'\n\nimport { executeAccess } from '../../auth/executeAccess.js'\nimport { combineQueries } from '../../database/combineQueries.js'\nimport { validateQueryPaths } from '../../database/queryValidation/validateQueryPaths.js'\nimport { sanitizeWhereQuery } from '../../database/sanitizeWhereQuery.js'\nimport { afterRead } from '../../fields/hooks/afterRead/index.js'\nimport { appendNonTrashedFilter } from '../../utilities/appendNonTrashedFilter.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { resolveSelect } from '../../utilities/resolveSelect.js'\nimport { sanitizeInternalFields } from '../../utilities/sanitizeInternalFields.js'\nimport { sanitizeSelect } from '../../utilities/sanitizeSelect.js'\nimport { buildVersionCollectionFields } from '../../versions/buildCollectionFields.js'\nimport { buildAfterOperation } from './utilities/buildAfterOperation.js'\nimport { buildBeforeOperation } from './utilities/buildBeforeOperation.js'\n\nexport type Arguments = {\n collection: Collection\n depth?: number\n limit?: number\n overrideAccess?: boolean\n page?: number\n pagination?: boolean\n populate?: PopulateType\n req?: PayloadRequest\n showHiddenFields?: boolean\n sort?: Sort\n trash?: boolean\n where?: Where\n} & Pick<FindOptions<string, SelectType>, 'select'>\n\nexport const findVersionsOperation = async <TData extends TypeWithVersion<TData>>(\n args: Arguments,\n): Promise<PaginatedDocs<TData>> => {\n try {\n // /////////////////////////////////////\n // beforeOperation - Collection\n // /////////////////////////////////////\n\n args = await buildBeforeOperation({\n args,\n collection: args.collection.config,\n operation: 'findVersions',\n overrideAccess: args.overrideAccess!,\n })\n\n const {\n collection: { config: collectionConfig },\n depth,\n limit,\n overrideAccess,\n page,\n pagination = true,\n populate,\n select: incomingSelect,\n showHiddenFields,\n sort,\n trash = false,\n where,\n } = args\n\n const req = args.req!\n const { fallbackLocale, locale, payload } = req\n\n // /////////////////////////////////////\n // Access\n // /////////////////////////////////////\n\n let accessResults!: AccessResult\n\n if (!overrideAccess) {\n accessResults = await executeAccess({ req }, collectionConfig.access.readVersions)\n }\n\n const versionFields = buildVersionCollectionFields(payload.config, collectionConfig, true)\n\n await validateQueryPaths({\n collectionConfig,\n overrideAccess: overrideAccess!,\n req,\n versionFields,\n where: where!,\n })\n\n let fullWhere = combineQueries(where!, accessResults)\n\n // Exclude trashed documents when trash: false\n fullWhere = appendNonTrashedFilter({\n deletedAtPath: 'version.deletedAt',\n enableTrash: collectionConfig.trash,\n trash,\n where: fullWhere,\n })\n\n sanitizeWhereQuery({ fields: versionFields, payload, where: fullWhere })\n\n const select = sanitizeSelect({\n fields: versionFields,\n select: resolveSelect({\n config: collectionConfig.select,\n operation: 'read',\n req,\n select: incomingSelect,\n }),\n versions: true,\n })\n\n // /////////////////////////////////////\n // Find\n // /////////////////////////////////////\n\n const usePagination = pagination && limit !== 0\n const sanitizedLimit = limit ?? (usePagination ? 10 : 0)\n const sanitizedPage = page || 1\n\n const paginatedDocs = await payload.db.findVersions<TData>({\n collection: collectionConfig.slug,\n limit: sanitizedLimit,\n locale: locale!,\n page: sanitizedPage,\n pagination,\n req,\n select,\n sort,\n where: fullWhere,\n })\n\n // /////////////////////////////////////\n // beforeRead - Collection\n // /////////////////////////////////////\n let result: PaginatedDocs<TData> = paginatedDocs as unknown as PaginatedDocs<TData>\n result.docs = (await Promise.all(\n paginatedDocs.docs.map(async (doc) => {\n const docRef = doc\n // Fallback if not selected\n if (!docRef.version) {\n ;(docRef as any).version = {}\n }\n\n if (collectionConfig.hooks?.beforeRead?.length) {\n for (const hook of collectionConfig.hooks.beforeRead) {\n docRef.version =\n (await hook({\n collection: collectionConfig,\n context: req.context,\n doc: docRef.version,\n overrideAccess,\n query: fullWhere,\n req,\n })) || docRef.version\n }\n }\n\n return docRef\n }),\n )) as TData[]\n // /////////////////////////////////////\n // afterRead - Fields\n // /////////////////////////////////////\n\n result.docs = await Promise.all(\n result.docs.map(async (data) => {\n data.version = await afterRead({\n collection: collectionConfig,\n context: req.context,\n depth: depth!,\n doc: data.version,\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n draft: undefined,\n fallbackLocale: fallbackLocale!,\n findMany: true,\n global: null,\n locale: locale!,\n overrideAccess: overrideAccess!,\n populate,\n req,\n select: typeof select?.version === 'object' ? select.version : undefined,\n showHiddenFields: showHiddenFields!,\n })\n return data\n }),\n )\n\n // /////////////////////////////////////\n // afterRead - Collection\n // /////////////////////////////////////\n\n if (collectionConfig.hooks.afterRead?.length) {\n result.docs = await Promise.all(\n result.docs.map(async (doc) => {\n const docRef = doc\n\n for (const hook of collectionConfig.hooks.afterRead) {\n docRef.version =\n (await hook({\n collection: collectionConfig,\n context: req.context,\n doc: doc.version,\n findMany: true,\n overrideAccess,\n query: fullWhere,\n req,\n })) || doc.version\n }\n\n return docRef\n }),\n )\n }\n\n // /////////////////////////////////////\n // Return results\n // /////////////////////////////////////\n result.docs = result.docs.map((doc) => sanitizeInternalFields<TData>(doc))\n\n // /////////////////////////////////////\n // afterOperation - Collection\n // /////////////////////////////////////\n\n result = await buildAfterOperation({\n args,\n collection: collectionConfig,\n operation: 'findVersions',\n overrideAccess,\n result,\n })\n\n return result\n } catch (error: unknown) {\n await killTransaction(args.req!)\n throw error\n }\n}\n"],"names":["executeAccess","combineQueries","validateQueryPaths","sanitizeWhereQuery","afterRead","appendNonTrashedFilter","killTransaction","resolveSelect","sanitizeInternalFields","sanitizeSelect","buildVersionCollectionFields","buildAfterOperation","buildBeforeOperation","findVersionsOperation","args","collection","config","operation","overrideAccess","collectionConfig","depth","limit","page","pagination","populate","select","incomingSelect","showHiddenFields","sort","trash","where","req","fallbackLocale","locale","payload","accessResults","access","readVersions","versionFields","fullWhere","deletedAtPath","enableTrash","fields","versions","usePagination","sanitizedLimit","sanitizedPage","paginatedDocs","db","findVersions","slug","result","docs","Promise","all","map","doc","docRef","version","hooks","beforeRead","length","hook","context","query","data","draft","undefined","findMany","global","error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CAAwC;QACxC,iBAAiB;QACjB,wCAAwC;QACxCN,OAAOC,IAAI,GAAGD,OAAOC,IAAI,CAACG,GAAG,CAAC,CAACC,MAAQhD,uBAA8BgD;QAErE,wCAAwC;QACxC,8BAA8B;QAC9B,wCAAwC;QAExCL,SAAS,MAAMxC,oBAAoB;YACjCG;YACAC,YAAYI;YACZF,WAAW;YACXC;YACAiC;QACF;QAEA,OAAOA;IACT,EAAE,OAAOmB,OAAgB;QACvB,MAAMhE,gBAAgBQ,KAAKiB,GAAG;QAC9B,MAAMuC;IACR;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"duplicate.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/duplicate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAC7E,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,UAAU,EACV,6BAA6B,EAC9B,MAAM,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EACV,2BAA2B,EAC3B,8BAA8B,EAC9B,wBAAwB,EACzB,MAAM,uBAAuB,CAAA;AAM9B,KAAK,WAAW,CAAC,KAAK,SAAS,cAAc,EAAE,OAAO,SAAS,UAAU,IAAI;IAC3E;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC,8BAA8B,CAAC,KAAK,CAAC,CAAC,CAAA;IACzD;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;OAEG;IACH,c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AAK,EACL,OAAO,CACR,GACC,2BAA2B,CAAC,KAAK,CAAC,CAAA;AAEpC,wBAAsB,cAAc,CAClC,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,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CA8CxD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/collections/operations/local/duplicate.ts"],"sourcesContent":["import type { DeepPartial } from 'ts-essentials'\n\nimport type { CollectionSlug, TypedLocale } from '../../..//index.js'\nimport type { FindOptions, Payload, RequestContext } from '../../../index.js'\nimport type {\n Document,\n PayloadRequest,\n PopulateType,\n SelectType,\n TransformCollectionWithSelect,\n} from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type {\n DraftFlagFromCollectionSlug,\n RequiredDataFromCollectionSlug,\n SelectFromCollectionSlug,\n} from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { duplicateOperation } from '../duplicate.js'\n\ntype BaseOptions<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 * Override the data for the document to duplicate.\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 * The ID of the document to duplicate from.\n */\n id: number | 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 * Specifies which locales to include when duplicating localized fields. Non-localized data is always duplicated.\n * By default, all locales are duplicated.\n */\n selectedLocales?: string[]\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, TSelect>, 'select'>\n\nexport type Options<TSlug extends CollectionSlug, TSelect extends SelectType> =\n BaseOptions<TSlug, TSelect> & DraftFlagFromCollectionSlug<TSlug>\n\nexport async function duplicateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<TransformCollectionWithSelect<TSlug, TSelect>> {\n const {\n id,\n collection: collectionSlug,\n data,\n depth,\n disableTransaction,\n draft,\n overrideAccess = true,\n populate,\n select,\n selectedLocales,\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(collectionSlug)} can't be found. Duplicate Operation.`,\n )\n }\n\n if (collection.config.disableDuplicate === true) {\n throw new APIError(\n `The collection with slug ${String(collectionSlug)} cannot be duplicated.`,\n 400,\n )\n }\n\n const req = await createLocalReq(options as CreateLocalReqOptions, payload)\n\n return duplicateOperation<TSlug, TSelect>({\n id,\n collection,\n data,\n depth,\n disableTransaction,\n draft,\n overrideAccess,\n populate,\n req,\n select,\n selectedLocales,\n showHiddenFields,\n })\n}\n"],"names":["APIError","createLocalReq","duplicateOperation","duplicateLocal","payload","options","id","collection","collectionSlug","data","depth","disableTransaction","draft","overrideAccess","populate","select","selectedLocales","showHiddenFields","collections","String","config","disableDuplicate","req"],"mappings":"AAkBA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,kBAAkB,QAAQ,kBAAiB;AA0EpD,OAAO,eAAeC,eAIpBC,OAAgB,EAChBC,OAAgC;IAEhC,MAAM,EACJC,EAAE,EACFC,YAAYC,cAAc,EAC1BC,IAAI,EACJC,KAAK,EACLC,kBAAkB,EAClBC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,QAAQ,EACRC,MAAM,EACNC,eAAe,EACfC,gBAAgB,EACjB,GAAGZ;IAEJ,MAAME,aAAaH,QAAQc,WAAW,CAACV,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIP,SACR,CAAC,yBAAyB,EAAEmB,OAAOX,gBAAgB,qCAAqC,CAAC;IAE7F;IAEA,IAAID,WAAWa,MAAM,CAACC,gBAAgB,KAAK,MAAM;QAC/C,MAAM,IAAIrB,SACR,CAAC,yBAAyB,EAAEmB,OAAOX,gBAAgB,sBAAsB,CAAC,EAC1E;IAEJ;IAEA,MAAMc,MAAM,MAAMrB,eAAeI,SAAkCD;IAEnE,OAAOF,mBAAmC;QACxCI;QACAC;QACAE;QACAC;QACAC;QACAC;QACAC;QACAC;QACAQ;QACAP;QACAC;QACAC;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../src/collections/operations/local/duplicate.ts"],"sourcesContent":["import type { DeepPartial } from 'ts-essentials'\n\nimport type { CollectionSlug, TypedLocale } from '../../..//index.js'\nimport type { FindOptions, Payload, RequestContext } from '../../../index.js'\nimport type {\n Document,\n PayloadRequest,\n PopulateType,\n SelectType,\n TransformCollectionWithSelect,\n} from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type {\n DraftFlagFromCollectionSlug,\n RequiredDataFromCollectionSlug,\n SelectFromCollectionSlug,\n} from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { duplicateOperation } from '../duplicate.js'\n\ntype BaseOptions<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 * Override the data for the document to duplicate.\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 * The ID of the document to duplicate from.\n */\n id: number | 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 * Specifies which locales to include when duplicating localized fields. Non-localized data is always duplicated.\n * By default, all locales are duplicated.\n */\n selectedLocales?: string[]\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, TSelect>, 'select'>\n\nexport type Options<TSlug extends CollectionSlug, TSelect extends SelectType> = BaseOptions<\n TSlug,\n TSelect\n> &\n DraftFlagFromCollectionSlug<TSlug>\n\nexport async function duplicateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<TransformCollectionWithSelect<TSlug, TSelect>> {\n const {\n id,\n collection: collectionSlug,\n data,\n depth,\n disableTransaction,\n draft,\n overrideAccess = true,\n populate,\n select,\n selectedLocales,\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(collectionSlug)} can't be found. Duplicate Operation.`,\n )\n }\n\n if (collection.config.disableDuplicate === true) {\n throw new APIError(\n `The collection with slug ${String(collectionSlug)} cannot be duplicated.`,\n 400,\n )\n }\n\n const req = await createLocalReq(options as CreateLocalReqOptions, payload)\n\n return duplicateOperation<TSlug, TSelect>({\n id,\n collection,\n data,\n depth,\n disableTransaction,\n draft,\n overrideAccess,\n populate,\n req,\n select,\n selectedLocales,\n showHiddenFields,\n })\n}\n"],"names":["APIError","createLocalReq","duplicateOperation","duplicateLocal","payload","options","id","collection","collectionSlug","data","depth","disableTransaction","draft","overrideAccess","populate","select","selectedLocales","showHiddenFields","collections","String","config","disableDuplicate","req"],"mappings":"AAkBA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,kBAAkB,QAAQ,kBAAiB;AA6EpD,OAAO,eAAeC,eAIpBC,OAAgB,EAChBC,OAAgC;IAEhC,MAAM,EACJC,EAAE,EACFC,YAAYC,cAAc,EAC1BC,IAAI,EACJC,KAAK,EACLC,kBAAkB,EAClBC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,QAAQ,EACRC,MAAM,EACNC,eAAe,EACfC,gBAAgB,EACjB,GAAGZ;IAEJ,MAAME,aAAaH,QAAQc,WAAW,CAACV,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIP,SACR,CAAC,yBAAyB,EAAEmB,OAAOX,gBAAgB,qCAAqC,CAAC;IAE7F;IAEA,IAAID,WAAWa,MAAM,CAACC,gBAAgB,KAAK,MAAM;QAC/C,MAAM,IAAIrB,SACR,CAAC,yBAAyB,EAAEmB,OAAOX,gBAAgB,sBAAsB,CAAC,EAC1E;IAEJ;IAEA,MAAMc,MAAM,MAAMrB,eAAeI,SAAkCD;IAEnE,OAAOF,mBAAmC;QACxCI;QACAC;QACAE;QACAC;QACAC;QACAC;QACAC;QACAC;QACAQ;QACAP;QACAC;QACAC;IACF;AACF"}
@@ -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,EAC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AI,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,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 {\n DraftFlagFromCollectionSlug,\n SelectFromCollectionSlug,\n} 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> =\n BaseFindOptions<TSlug, TSelect> & DraftFlagFromCollectionSlug<TSlug>\n\n// Backward compatibility export\nexport type FindOptions<TSlug extends CollectionSlug, TSelect extends SelectType> =\n Options<TSlug, TSelect>\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":"AA2BA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,aAAa,QAAQ,aAAY;AAgK1C,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 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 +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,EACV,2BAA2B,EAC3B,wBAAwB,EACzB,MAAM,uBAAuB,CAAA;AAI9B,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;;;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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
+ {"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;IACH,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB;;O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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 {\n DraftFlagFromCollectionSlug,\n SelectFromCollectionSlug,\n} 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":"AAuBA,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} 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 +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,EACV,sBAAsB,EACtB,2BAA2B,EAC5B,MAAM,uBAAuB,CAAA;AAM9B,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,IAC9C,WAAW,CAAC,KAAK,CAAC,GAAG,2BAA2B,CAAC,KAAK,CAAC,CAAA;AAEzD,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,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 +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 {\n DataFromCollectionSlug,\n DraftFlagFromCollectionSlug,\n} 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> =\n BaseOptions<TSlug> & 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":"AAeA,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} 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 +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,EACV,sBAAsB,EACtB,2BAA2B,EAC5B,MAAM,uBAAuB,CAAA;AAM9B,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,IAC9C,WAAW,CAAC,KAAK,CAAC,GAAG,2BAA2B,CAAC,KAAK,CAAC,CAAA;AAEzD,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,EACZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,KAAK,EACN,MAAM,yBAAyB,CAAA;A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iB,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 {\n DataFromCollectionSlug,\n DraftFlagFromCollectionSlug,\n} 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> =\n BaseOptions<TSlug> & 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":"AAuBA,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} 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 +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,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,EACV,sBAAsB,EACtB,2BAA2B,EAC5B,MAAM,uBAAuB,CAAA;AAM9B,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;IAE1B;;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,IAC9C,WAAW,CAAC,KAAK,CAAC,GAAG,2BAA2B,CAAC,KAAK,CAAC,CAAA;AAEzD,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
+ {"version":3,"file":"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,EACZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEjG,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;IAE1B;;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,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 {\n DataFromCollectionSlug,\n DraftFlagFromCollectionSlug,\n} 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> =\n BaseOptions<TSlug> & 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":"AAcA,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} 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 +1 @@
1
- {"version":3,"file":"restoreVersion.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/restoreVersion.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAChG,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAoBlD,MAAM,MAAM,SAAS,GAAG;IACtB,UAAU,EAAE,UAAU,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,GAAG,EAAE,cAAc,CAAA;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAA;AAEnD,eAAO,MAAM,uBAAuB,GAClC,KAAK,SAAS,UAAU,GAAG,UAAU,kCAE/B,SAAS,KACd,OAAO,CAAC,KAAK,CA0Vf,CAAA"}
1
+ {"version":3,"file":"restoreVersion.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/restoreVersion.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAChG,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAqBlD,MAAM,MAAM,SAAS,GAAG;IACtB,UAAU,EAAE,UAAU,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,GAAG,EAAE,cAAc,CAAA;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAA;AAEnD,eAAO,MAAM,uBAAuB,GAClC,KAAK,SAAS,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,EAE/D,MAAM,SAAS,KACd,OAAO,CAAC,KAAK,CA8Vf,CAAA"}
@@ -12,6 +12,7 @@ import { deepCopyObjectSimple } from '../../utilities/deepCopyObject.js';
12
12
  import { hasDraftValidationEnabled } from '../../utilities/getVersionsConfig.js';
13
13
  import { initTransaction } from '../../utilities/initTransaction.js';
14
14
  import { killTransaction } from '../../utilities/killTransaction.js';
15
+ import { resolveSelect } from '../../utilities/resolveSelect.js';
15
16
  import { sanitizeSelect } from '../../utilities/sanitizeSelect.js';
16
17
  import { getLatestCollectionVersion } from '../../versions/getLatestCollectionVersion.js';
17
18
  import { saveVersion } from '../../versions/saveVersion.js';
@@ -197,8 +198,12 @@ export const restoreVersionOperation = async (args)=>{
197
198
  // /////////////////////////////////////
198
199
  const select = sanitizeSelect({
199
200
  fields: collectionConfig.flattenedFields,
200
- forceSelect: collectionConfig.forceSelect,
201
- select: incomingSelect
201
+ select: resolveSelect({
202
+ config: collectionConfig.select,
203
+ operation: 'restoreVersion',
204
+ req,
205
+ select: incomingSelect
206
+ })
202
207
  });
203
208
  // Ensure updatedAt date is always updated
204
209
  result.updatedAt = new Date().toISOString();