payload 4.0.0-internal.e16cf59 → 4.0.0-internal.fa345ef

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 (743) hide show
  1. package/LICENSE.md +1 -1
  2. package/bin.js +11 -0
  3. package/dist/admin/RichText.d.ts +4 -17
  4. package/dist/admin/RichText.d.ts.map +1 -1
  5. package/dist/admin/RichText.js.map +1 -1
  6. package/dist/admin/adapters/cookies.d.ts +21 -0
  7. package/dist/admin/adapters/cookies.d.ts.map +1 -0
  8. package/dist/admin/adapters/cookies.js +3 -0
  9. package/dist/admin/adapters/cookies.js.map +1 -0
  10. package/dist/admin/adapters/devReload.d.ts +9 -0
  11. package/dist/admin/adapters/devReload.d.ts.map +1 -0
  12. package/dist/admin/adapters/devReload.js +6 -0
  13. package/dist/admin/adapters/devReload.js.map +1 -0
  14. package/dist/admin/adapters/index.d.ts +7 -0
  15. package/dist/admin/adapters/index.d.ts.map +1 -0
  16. package/dist/admin/adapters/index.js +3 -0
  17. package/dist/admin/adapters/index.js.map +1 -0
  18. package/dist/admin/adapters/render.d.ts +16 -0
  19. package/dist/admin/adapters/render.d.ts.map +1 -0
  20. package/dist/admin/adapters/render.js +7 -0
  21. package/dist/admin/adapters/render.js.map +1 -0
  22. package/dist/admin/adapters/router.d.ts +56 -0
  23. package/dist/admin/adapters/router.d.ts.map +1 -0
  24. package/dist/admin/adapters/router.js +3 -0
  25. package/dist/admin/adapters/router.js.map +1 -0
  26. package/dist/admin/adapters/server.d.ts +23 -0
  27. package/dist/admin/adapters/server.d.ts.map +1 -0
  28. package/dist/admin/adapters/server.js +6 -0
  29. package/dist/admin/adapters/server.js.map +1 -0
  30. package/dist/admin/adapters/views.d.ts +36 -0
  31. package/dist/admin/adapters/views.d.ts.map +1 -0
  32. package/dist/admin/adapters/views.js +7 -0
  33. package/dist/admin/adapters/views.js.map +1 -0
  34. package/dist/admin/elements/Table.d.ts +1 -0
  35. package/dist/admin/elements/Table.d.ts.map +1 -1
  36. package/dist/admin/elements/Table.js.map +1 -1
  37. package/dist/admin/fields/Row.d.ts +2 -2
  38. package/dist/admin/fields/Row.d.ts.map +1 -1
  39. package/dist/admin/fields/Row.js.map +1 -1
  40. package/dist/admin/forms/Description.d.ts +2 -2
  41. package/dist/admin/forms/Description.d.ts.map +1 -1
  42. package/dist/admin/forms/Description.js.map +1 -1
  43. package/dist/admin/forms/Field.d.ts +10 -5
  44. package/dist/admin/forms/Field.d.ts.map +1 -1
  45. package/dist/admin/forms/Field.js.map +1 -1
  46. package/dist/admin/functions/index.d.ts +9 -0
  47. package/dist/admin/functions/index.d.ts.map +1 -1
  48. package/dist/admin/functions/index.js.map +1 -1
  49. package/dist/admin/types.d.ts +3 -2
  50. package/dist/admin/types.d.ts.map +1 -1
  51. package/dist/admin/types.js.map +1 -1
  52. package/dist/admin/views/dashboard.d.ts +7 -0
  53. package/dist/admin/views/dashboard.d.ts.map +1 -1
  54. package/dist/admin/views/dashboard.js.map +1 -1
  55. package/dist/admin/views/document.d.ts +5 -3
  56. package/dist/admin/views/document.d.ts.map +1 -1
  57. package/dist/admin/views/document.js.map +1 -1
  58. package/dist/admin/views/hierarchyList.d.ts +1 -0
  59. package/dist/admin/views/hierarchyList.d.ts.map +1 -1
  60. package/dist/admin/views/hierarchyList.js.map +1 -1
  61. package/dist/admin/views/list.d.ts +10 -1
  62. package/dist/admin/views/list.d.ts.map +1 -1
  63. package/dist/admin/views/list.js.map +1 -1
  64. package/dist/auth/baseFields/apiKey.d.ts +10 -2
  65. package/dist/auth/baseFields/apiKey.d.ts.map +1 -1
  66. package/dist/auth/baseFields/apiKey.js +35 -24
  67. package/dist/auth/baseFields/apiKey.js.map +1 -1
  68. package/dist/auth/cookies.d.ts.map +1 -1
  69. package/dist/auth/defaultAccess.d.ts +1 -1
  70. package/dist/auth/defaultAccess.d.ts.map +1 -1
  71. package/dist/auth/defaultAccess.js +1 -1
  72. package/dist/auth/defaultAccess.js.map +1 -1
  73. package/dist/auth/defaultUser.d.ts.map +1 -1
  74. package/dist/auth/defaultUser.js +2 -1
  75. package/dist/auth/defaultUser.js.map +1 -1
  76. package/dist/auth/ensureUsernameOrEmail.d.ts.map +1 -1
  77. package/dist/auth/executeAccess.d.ts.map +1 -1
  78. package/dist/auth/executeAuthStrategies.d.ts.map +1 -1
  79. package/dist/auth/extractAccessFromPermission.d.ts.map +1 -1
  80. package/dist/auth/extractJWT.d.ts.map +1 -1
  81. package/dist/auth/getAuthFields.d.ts.map +1 -1
  82. package/dist/auth/getAuthFields.js +2 -2
  83. package/dist/auth/getAuthFields.js.map +1 -1
  84. package/dist/auth/getFieldsToSign.d.ts.map +1 -1
  85. package/dist/auth/getLoginOptions.d.ts.map +1 -1
  86. package/dist/auth/isUserLocked.d.ts.map +1 -1
  87. package/dist/auth/jwt.d.ts.map +1 -1
  88. package/dist/auth/operations/access.d.ts.map +1 -1
  89. package/dist/auth/operations/auth.d.ts +2 -2
  90. package/dist/auth/operations/auth.d.ts.map +1 -1
  91. package/dist/auth/operations/auth.js.map +1 -1
  92. package/dist/auth/operations/forgotPassword.d.ts.map +1 -1
  93. package/dist/auth/operations/init.d.ts.map +1 -1
  94. package/dist/auth/operations/local/auth.d.ts.map +1 -1
  95. package/dist/auth/operations/login.d.ts +2 -1
  96. package/dist/auth/operations/login.d.ts.map +1 -1
  97. package/dist/auth/operations/login.js.map +1 -1
  98. package/dist/auth/operations/logout.d.ts.map +1 -1
  99. package/dist/auth/operations/me.d.ts.map +1 -1
  100. package/dist/auth/operations/me.js.map +1 -1
  101. package/dist/auth/operations/refresh.d.ts.map +1 -1
  102. package/dist/auth/operations/refresh.js +9 -3
  103. package/dist/auth/operations/refresh.js.map +1 -1
  104. package/dist/auth/operations/registerFirstUser.d.ts.map +1 -1
  105. package/dist/auth/operations/resetPassword.d.ts.map +1 -1
  106. package/dist/auth/operations/resetPassword.js.map +1 -1
  107. package/dist/auth/operations/unlock.d.ts.map +1 -1
  108. package/dist/auth/operations/verifyEmail.d.ts.map +1 -1
  109. package/dist/auth/sendVerificationEmail.d.ts +2 -2
  110. package/dist/auth/sendVerificationEmail.d.ts.map +1 -1
  111. package/dist/auth/sendVerificationEmail.js +1 -1
  112. package/dist/auth/sendVerificationEmail.js.map +1 -1
  113. package/dist/auth/sessions.d.ts +4 -5
  114. package/dist/auth/sessions.d.ts.map +1 -1
  115. package/dist/auth/sessions.js +5 -3
  116. package/dist/auth/sessions.js.map +1 -1
  117. package/dist/auth/strategies/apiKey.d.ts.map +1 -1
  118. package/dist/auth/strategies/apiKey.js +6 -17
  119. package/dist/auth/strategies/apiKey.js.map +1 -1
  120. package/dist/auth/strategies/local/authenticate.d.ts.map +1 -1
  121. package/dist/auth/strategies/local/generatePasswordSaltHash.d.ts.map +1 -1
  122. package/dist/auth/strategies/local/incrementLoginAttempts.d.ts +2 -2
  123. package/dist/auth/strategies/local/incrementLoginAttempts.d.ts.map +1 -1
  124. package/dist/auth/strategies/local/incrementLoginAttempts.js +1 -1
  125. package/dist/auth/strategies/local/incrementLoginAttempts.js.map +1 -1
  126. package/dist/auth/strategies/local/register.d.ts.map +1 -1
  127. package/dist/auth/strategies/local/resetLoginAttempts.d.ts.map +1 -1
  128. package/dist/auth/types.d.ts +28 -21
  129. package/dist/auth/types.d.ts.map +1 -1
  130. package/dist/auth/types.js.map +1 -1
  131. package/dist/bin/build.d.ts +25 -0
  132. package/dist/bin/build.d.ts.map +1 -0
  133. package/dist/bin/build.js +80 -0
  134. package/dist/bin/build.js.map +1 -0
  135. package/dist/bin/build.spec.js +170 -0
  136. package/dist/bin/build.spec.js.map +1 -0
  137. package/dist/bin/generateImportMap/index.d.ts.map +1 -1
  138. package/dist/bin/generateImportMap/index.js +8 -5
  139. package/dist/bin/generateImportMap/index.js.map +1 -1
  140. package/dist/bin/generateImportMap/iterateCollections.d.ts.map +1 -1
  141. package/dist/bin/generateImportMap/iterateCollections.js +11 -0
  142. package/dist/bin/generateImportMap/iterateCollections.js.map +1 -1
  143. package/dist/bin/generateImportMap/iterateConfig.d.ts.map +1 -1
  144. package/dist/bin/generateImportMap/iterateConfig.js +12 -0
  145. package/dist/bin/generateImportMap/iterateConfig.js.map +1 -1
  146. package/dist/bin/generateImportMap/iterateFields.d.ts.map +1 -1
  147. package/dist/bin/generateImportMap/iterateFields.js +4 -1
  148. package/dist/bin/generateImportMap/iterateFields.js.map +1 -1
  149. package/dist/bin/generateImportMap/utilities/getFromImportMap.d.ts.map +1 -1
  150. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.d.ts +5 -1
  151. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.d.ts.map +1 -1
  152. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.js +32 -18
  153. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.js.map +1 -1
  154. package/dist/bin/generateTypes.d.ts +3 -2
  155. package/dist/bin/generateTypes.d.ts.map +1 -1
  156. package/dist/bin/generateTypes.js +11 -1
  157. package/dist/bin/generateTypes.js.map +1 -1
  158. package/dist/bin/index.d.ts.map +1 -1
  159. package/dist/bin/index.js +9 -0
  160. package/dist/bin/index.js.map +1 -1
  161. package/dist/bin/loadEnv.d.ts +3 -1
  162. package/dist/bin/loadEnv.d.ts.map +1 -1
  163. package/dist/bin/loadEnv.js +40 -10
  164. package/dist/bin/loadEnv.js.map +1 -1
  165. package/dist/bin/migrate.d.ts.map +1 -1
  166. package/dist/collections/config/client.d.ts +1 -1
  167. package/dist/collections/config/client.d.ts.map +1 -1
  168. package/dist/collections/config/client.js +1 -0
  169. package/dist/collections/config/client.js.map +1 -1
  170. package/dist/collections/config/defaults.d.ts +0 -4
  171. package/dist/collections/config/defaults.d.ts.map +1 -1
  172. package/dist/collections/config/defaults.js +2 -17
  173. package/dist/collections/config/defaults.js.map +1 -1
  174. package/dist/collections/config/defaults.spec.js +47 -0
  175. package/dist/collections/config/defaults.spec.js.map +1 -0
  176. package/dist/collections/config/sanitize.d.ts +10 -1
  177. package/dist/collections/config/sanitize.d.ts.map +1 -1
  178. package/dist/collections/config/sanitize.js +1 -11
  179. package/dist/collections/config/sanitize.js.map +1 -1
  180. package/dist/collections/config/sanitizeCompoundIndexes.d.ts.map +1 -1
  181. package/dist/collections/config/types.d.ts +11 -7
  182. package/dist/collections/config/types.d.ts.map +1 -1
  183. package/dist/collections/config/types.js.map +1 -1
  184. package/dist/collections/config/useAsTitle.d.ts.map +1 -1
  185. package/dist/collections/dataloader.d.ts.map +1 -1
  186. package/dist/collections/endpoints/create.d.ts.map +1 -1
  187. package/dist/collections/endpoints/create.js +0 -2
  188. package/dist/collections/endpoints/create.js.map +1 -1
  189. package/dist/collections/endpoints/updateByID.d.ts.map +1 -1
  190. package/dist/collections/endpoints/updateByID.js +1 -2
  191. package/dist/collections/endpoints/updateByID.js.map +1 -1
  192. package/dist/collections/operations/count.d.ts.map +1 -1
  193. package/dist/collections/operations/count.js +1 -0
  194. package/dist/collections/operations/count.js.map +1 -1
  195. package/dist/collections/operations/countVersions.d.ts.map +1 -1
  196. package/dist/collections/operations/create.d.ts +0 -1
  197. package/dist/collections/operations/create.d.ts.map +1 -1
  198. package/dist/collections/operations/create.js +15 -6
  199. package/dist/collections/operations/create.js.map +1 -1
  200. package/dist/collections/operations/delete.d.ts.map +1 -1
  201. package/dist/collections/operations/delete.js +3 -0
  202. package/dist/collections/operations/delete.js.map +1 -1
  203. package/dist/collections/operations/deleteByID.d.ts.map +1 -1
  204. package/dist/collections/operations/duplicate.d.ts.map +1 -1
  205. package/dist/collections/operations/find.d.ts.map +1 -1
  206. package/dist/collections/operations/findByID.d.ts.map +1 -1
  207. package/dist/collections/operations/findDistinct.d.ts.map +1 -1
  208. package/dist/collections/operations/findDistinct.js +1 -0
  209. package/dist/collections/operations/findDistinct.js.map +1 -1
  210. package/dist/collections/operations/findVersionByID.d.ts.map +1 -1
  211. package/dist/collections/operations/findVersions.d.ts.map +1 -1
  212. package/dist/collections/operations/local/count.d.ts +3 -3
  213. package/dist/collections/operations/local/count.d.ts.map +1 -1
  214. package/dist/collections/operations/local/count.js.map +1 -1
  215. package/dist/collections/operations/local/countVersions.d.ts +3 -3
  216. package/dist/collections/operations/local/countVersions.d.ts.map +1 -1
  217. package/dist/collections/operations/local/countVersions.js.map +1 -1
  218. package/dist/collections/operations/local/create.d.ts +3 -3
  219. package/dist/collections/operations/local/create.d.ts.map +1 -1
  220. package/dist/collections/operations/local/create.js.map +1 -1
  221. package/dist/collections/operations/local/delete.d.ts +3 -3
  222. package/dist/collections/operations/local/delete.d.ts.map +1 -1
  223. package/dist/collections/operations/local/delete.js.map +1 -1
  224. package/dist/collections/operations/local/duplicate.d.ts +3 -3
  225. package/dist/collections/operations/local/duplicate.d.ts.map +1 -1
  226. package/dist/collections/operations/local/duplicate.js.map +1 -1
  227. package/dist/collections/operations/local/find.d.ts +3 -3
  228. package/dist/collections/operations/local/find.d.ts.map +1 -1
  229. package/dist/collections/operations/local/find.js.map +1 -1
  230. package/dist/collections/operations/local/findByID.d.ts +3 -3
  231. package/dist/collections/operations/local/findByID.d.ts.map +1 -1
  232. package/dist/collections/operations/local/findByID.js.map +1 -1
  233. package/dist/collections/operations/local/findDistinct.d.ts +2 -2
  234. package/dist/collections/operations/local/findDistinct.d.ts.map +1 -1
  235. package/dist/collections/operations/local/findDistinct.js.map +1 -1
  236. package/dist/collections/operations/local/findVersionByID.d.ts +3 -3
  237. package/dist/collections/operations/local/findVersionByID.d.ts.map +1 -1
  238. package/dist/collections/operations/local/findVersionByID.js.map +1 -1
  239. package/dist/collections/operations/local/findVersions.d.ts +3 -3
  240. package/dist/collections/operations/local/findVersions.d.ts.map +1 -1
  241. package/dist/collections/operations/local/findVersions.js.map +1 -1
  242. package/dist/collections/operations/local/restoreVersion.d.ts +3 -3
  243. package/dist/collections/operations/local/restoreVersion.d.ts.map +1 -1
  244. package/dist/collections/operations/local/restoreVersion.js.map +1 -1
  245. package/dist/collections/operations/local/update.d.ts +7 -11
  246. package/dist/collections/operations/local/update.d.ts.map +1 -1
  247. package/dist/collections/operations/local/update.js +1 -2
  248. package/dist/collections/operations/local/update.js.map +1 -1
  249. package/dist/collections/operations/restoreVersion.d.ts.map +1 -1
  250. package/dist/collections/operations/update.d.ts +0 -1
  251. package/dist/collections/operations/update.d.ts.map +1 -1
  252. package/dist/collections/operations/update.js +8 -4
  253. package/dist/collections/operations/update.js.map +1 -1
  254. package/dist/collections/operations/updateByID.d.ts +0 -1
  255. package/dist/collections/operations/updateByID.d.ts.map +1 -1
  256. package/dist/collections/operations/updateByID.js +1 -5
  257. package/dist/collections/operations/updateByID.js.map +1 -1
  258. package/dist/collections/operations/utilities/buildAfterOperation.d.ts.map +1 -1
  259. package/dist/collections/operations/utilities/copyDataWithFreshRowIDs.d.ts +9 -0
  260. package/dist/collections/operations/utilities/copyDataWithFreshRowIDs.d.ts.map +1 -0
  261. package/dist/collections/operations/utilities/copyDataWithFreshRowIDs.js +170 -0
  262. package/dist/collections/operations/utilities/copyDataWithFreshRowIDs.js.map +1 -0
  263. package/dist/collections/operations/utilities/sanitizeSortQuery.d.ts.map +1 -1
  264. package/dist/collections/operations/utilities/types.d.ts +0 -9
  265. package/dist/collections/operations/utilities/types.d.ts.map +1 -1
  266. package/dist/collections/operations/utilities/types.js.map +1 -1
  267. package/dist/collections/operations/utilities/update.d.ts +1 -2
  268. package/dist/collections/operations/utilities/update.d.ts.map +1 -1
  269. package/dist/collections/operations/utilities/update.js +64 -65
  270. package/dist/collections/operations/utilities/update.js.map +1 -1
  271. package/dist/config/build.d.ts.map +1 -1
  272. package/dist/config/build.js +8 -0
  273. package/dist/config/build.js.map +1 -1
  274. package/dist/config/client.d.ts +3 -3
  275. package/dist/config/client.d.ts.map +1 -1
  276. package/dist/config/client.js +2 -1
  277. package/dist/config/client.js.map +1 -1
  278. package/dist/config/defaults.d.ts +0 -4
  279. package/dist/config/defaults.d.ts.map +1 -1
  280. package/dist/config/defaults.js +0 -78
  281. package/dist/config/defaults.js.map +1 -1
  282. package/dist/config/definePlugin.d.ts +10 -10
  283. package/dist/config/definePlugin.d.ts.map +1 -1
  284. package/dist/config/definePlugin.js +7 -11
  285. package/dist/config/definePlugin.js.map +1 -1
  286. package/dist/config/orderable/index.d.ts.map +1 -1
  287. package/dist/config/orderable/index.js +23 -0
  288. package/dist/config/orderable/index.js.map +1 -1
  289. package/dist/config/sanitize.d.ts.map +1 -1
  290. package/dist/config/sanitize.js +139 -27
  291. package/dist/config/sanitize.js.map +1 -1
  292. package/dist/config/types.d.ts +125 -38
  293. package/dist/config/types.d.ts.map +1 -1
  294. package/dist/config/types.js +2 -0
  295. package/dist/config/types.js.map +1 -1
  296. package/dist/database/combineQueries.d.ts.map +1 -1
  297. package/dist/database/getLocalizedPaths.d.ts.map +1 -1
  298. package/dist/database/getLocalizedPaths.js +1 -1
  299. package/dist/database/getLocalizedPaths.js.map +1 -1
  300. package/dist/database/migrations/findMigrationDir.d.ts.map +1 -1
  301. package/dist/database/migrations/getPredefinedMigration.d.ts.map +1 -1
  302. package/dist/database/migrations/migrationsCollection.d.ts.map +1 -1
  303. package/dist/database/migrations/migrationsCollection.js +2 -1
  304. package/dist/database/migrations/migrationsCollection.js.map +1 -1
  305. package/dist/database/migrations/readMigrationFiles.d.ts.map +1 -1
  306. package/dist/database/migrations/writeMigrationIndex.d.ts.map +1 -1
  307. package/dist/database/sanitizeJoinQuery.d.ts.map +1 -1
  308. package/dist/database/sanitizeWhereQuery.d.ts.map +1 -1
  309. package/dist/duplicateDocument/index.d.ts.map +1 -1
  310. package/dist/email/getStringifiedToAddress.d.ts.map +1 -1
  311. package/dist/errors/ValidationError.d.ts +1 -0
  312. package/dist/errors/ValidationError.d.ts.map +1 -1
  313. package/dist/errors/ValidationError.js.map +1 -1
  314. package/dist/exports/migrations.d.ts +5 -13
  315. package/dist/exports/migrations.d.ts.map +1 -1
  316. package/dist/exports/migrations.js +5 -13
  317. package/dist/exports/migrations.js.map +1 -1
  318. package/dist/exports/shared.d.ts +23 -1
  319. package/dist/exports/shared.d.ts.map +1 -1
  320. package/dist/exports/shared.js +23 -1
  321. package/dist/exports/shared.js.map +1 -1
  322. package/dist/fields/baseFields/slug/countVersions.d.ts.map +1 -1
  323. package/dist/fields/baseFields/slug/generateSlug.d.ts.map +1 -1
  324. package/dist/fields/baseFields/slug/index.js +1 -1
  325. package/dist/fields/baseFields/slug/index.js.map +1 -1
  326. package/dist/fields/config/client.d.ts +3 -3
  327. package/dist/fields/config/client.d.ts.map +1 -1
  328. package/dist/fields/config/client.js +12 -13
  329. package/dist/fields/config/client.js.map +1 -1
  330. package/dist/fields/config/sanitize.d.ts.map +1 -1
  331. package/dist/fields/config/sanitize.js +2 -14
  332. package/dist/fields/config/sanitize.js.map +1 -1
  333. package/dist/fields/config/sanitizeJoinField.d.ts.map +1 -1
  334. package/dist/fields/config/types.d.ts +45 -66
  335. package/dist/fields/config/types.d.ts.map +1 -1
  336. package/dist/fields/config/types.js +1 -1
  337. package/dist/fields/config/types.js.map +1 -1
  338. package/dist/fields/getDefaultValue.d.ts.map +1 -1
  339. package/dist/fields/hooks/afterChange/index.d.ts.map +1 -1
  340. package/dist/fields/hooks/afterChange/promise.d.ts.map +1 -1
  341. package/dist/fields/hooks/afterChange/promise.js +1 -1
  342. package/dist/fields/hooks/afterChange/promise.js.map +1 -1
  343. package/dist/fields/hooks/afterChange/traverseFields.d.ts.map +1 -1
  344. package/dist/fields/hooks/afterRead/promise.d.ts.map +1 -1
  345. package/dist/fields/hooks/afterRead/promise.js +12 -3
  346. package/dist/fields/hooks/afterRead/promise.js.map +1 -1
  347. package/dist/fields/hooks/afterRead/relationshipPopulationPromise.d.ts.map +1 -1
  348. package/dist/fields/hooks/afterRead/traverseFields.d.ts.map +1 -1
  349. package/dist/fields/hooks/afterRead/virtualFieldPopulationPromise.d.ts.map +1 -1
  350. package/dist/fields/hooks/beforeChange/cloneDataFromOriginalDoc.d.ts.map +1 -1
  351. package/dist/fields/hooks/beforeChange/getExistingRowDoc.d.ts.map +1 -1
  352. package/dist/fields/hooks/beforeChange/index.d.ts.map +1 -1
  353. package/dist/fields/hooks/beforeChange/promise.d.ts.map +1 -1
  354. package/dist/fields/hooks/beforeChange/promise.js +3 -3
  355. package/dist/fields/hooks/beforeChange/promise.js.map +1 -1
  356. package/dist/fields/hooks/beforeChange/traverseFields.d.ts.map +1 -1
  357. package/dist/fields/hooks/beforeDuplicate/index.d.ts.map +1 -1
  358. package/dist/fields/hooks/beforeDuplicate/promise.d.ts.map +1 -1
  359. package/dist/fields/hooks/beforeDuplicate/promise.js +2 -2
  360. package/dist/fields/hooks/beforeDuplicate/promise.js.map +1 -1
  361. package/dist/fields/hooks/beforeDuplicate/traverseFields.d.ts.map +1 -1
  362. package/dist/fields/hooks/beforeValidate/index.d.ts.map +1 -1
  363. package/dist/fields/hooks/beforeValidate/promise.d.ts.map +1 -1
  364. package/dist/fields/hooks/beforeValidate/promise.js +11 -2
  365. package/dist/fields/hooks/beforeValidate/promise.js.map +1 -1
  366. package/dist/fields/hooks/beforeValidate/traverseFields.d.ts.map +1 -1
  367. package/dist/fields/isFieldDisabled.d.ts.map +1 -1
  368. package/dist/fields/mergeBaseFields.d.ts.map +1 -1
  369. package/dist/fields/setDefaultBeforeDuplicate.d.ts.map +1 -1
  370. package/dist/fields/validations.d.ts.map +1 -1
  371. package/dist/fields/validations.js +5 -4
  372. package/dist/fields/validations.js.map +1 -1
  373. package/dist/globals/config/client.d.ts.map +1 -1
  374. package/dist/globals/config/sanitize.d.ts +6 -1
  375. package/dist/globals/config/sanitize.d.ts.map +1 -1
  376. package/dist/globals/config/sanitize.js +2 -6
  377. package/dist/globals/config/sanitize.js.map +1 -1
  378. package/dist/globals/config/sanitize.spec.js +43 -0
  379. package/dist/globals/config/sanitize.spec.js.map +1 -0
  380. package/dist/globals/endpoints/update.d.ts.map +1 -1
  381. package/dist/globals/endpoints/update.js +0 -2
  382. package/dist/globals/endpoints/update.js.map +1 -1
  383. package/dist/globals/operations/countGlobalVersions.d.ts.map +1 -1
  384. package/dist/globals/operations/docAccess.d.ts.map +1 -1
  385. package/dist/globals/operations/findOne.d.ts.map +1 -1
  386. package/dist/globals/operations/findVersionByID.d.ts.map +1 -1
  387. package/dist/globals/operations/findVersions.d.ts.map +1 -1
  388. package/dist/globals/operations/local/countVersions.d.ts +3 -3
  389. package/dist/globals/operations/local/countVersions.d.ts.map +1 -1
  390. package/dist/globals/operations/local/countVersions.js.map +1 -1
  391. package/dist/globals/operations/local/findOne.d.ts +3 -3
  392. package/dist/globals/operations/local/findOne.d.ts.map +1 -1
  393. package/dist/globals/operations/local/findOne.js.map +1 -1
  394. package/dist/globals/operations/local/findVersionByID.d.ts +3 -3
  395. package/dist/globals/operations/local/findVersionByID.d.ts.map +1 -1
  396. package/dist/globals/operations/local/findVersionByID.js.map +1 -1
  397. package/dist/globals/operations/local/findVersions.d.ts +3 -3
  398. package/dist/globals/operations/local/findVersions.d.ts.map +1 -1
  399. package/dist/globals/operations/local/findVersions.js.map +1 -1
  400. package/dist/globals/operations/local/restoreVersion.d.ts +3 -3
  401. package/dist/globals/operations/local/restoreVersion.d.ts.map +1 -1
  402. package/dist/globals/operations/local/restoreVersion.js.map +1 -1
  403. package/dist/globals/operations/local/update.d.ts +7 -9
  404. package/dist/globals/operations/local/update.d.ts.map +1 -1
  405. package/dist/globals/operations/local/update.js +1 -2
  406. package/dist/globals/operations/local/update.js.map +1 -1
  407. package/dist/globals/operations/restoreVersion.d.ts.map +1 -1
  408. package/dist/globals/operations/update.d.ts +0 -1
  409. package/dist/globals/operations/update.d.ts.map +1 -1
  410. package/dist/globals/operations/update.js +52 -58
  411. package/dist/globals/operations/update.js.map +1 -1
  412. package/dist/hierarchy/addHierarchyToCollection.d.ts.map +1 -1
  413. package/dist/hierarchy/buildParentField.d.ts.map +1 -1
  414. package/dist/hierarchy/constants.d.ts.map +1 -1
  415. package/dist/hierarchy/getInitialTreeData.d.ts.map +1 -1
  416. package/dist/hierarchy/hooks/collectionAfterDelete.d.ts.map +1 -1
  417. package/dist/hierarchy/hooks/collectionAfterRead.d.ts.map +1 -1
  418. package/dist/hierarchy/hooks/collectionBeforeChange.d.ts.map +1 -1
  419. package/dist/hierarchy/hooks/collectionBeforeDelete.d.ts.map +1 -1
  420. package/dist/hierarchy/hooks/collectionBeforeOperation.d.ts.map +1 -1
  421. package/dist/hierarchy/hooks/ensureSafeCollectionsChange.d.ts.map +1 -1
  422. package/dist/hierarchy/injectHierarchyButton.d.ts.map +1 -1
  423. package/dist/hierarchy/resolveHierarchyCollections.d.ts.map +1 -1
  424. package/dist/hierarchy/resolveHierarchyCollections.js +1 -1
  425. package/dist/hierarchy/resolveHierarchyCollections.js.map +1 -1
  426. package/dist/hierarchy/sanitizeHierarchyCollection.d.ts.map +1 -1
  427. package/dist/hierarchy/sanitizeHierarchyCollection.js +3 -1
  428. package/dist/hierarchy/sanitizeHierarchyCollection.js.map +1 -1
  429. package/dist/hierarchy/types.d.ts +8 -1
  430. package/dist/hierarchy/types.d.ts.map +1 -1
  431. package/dist/hierarchy/types.js.map +1 -1
  432. package/dist/index.bundled.d.ts +808 -366
  433. package/dist/index.d.ts +72 -24
  434. package/dist/index.d.ts.map +1 -1
  435. package/dist/index.js +55 -36
  436. package/dist/index.js.map +1 -1
  437. package/dist/kv/adapters/DatabaseKVAdapter.d.ts.map +1 -1
  438. package/dist/kv/adapters/DatabaseKVAdapter.js +1 -0
  439. package/dist/kv/adapters/DatabaseKVAdapter.js.map +1 -1
  440. package/dist/locked-documents/config.d.ts.map +1 -1
  441. package/dist/locked-documents/config.js +2 -1
  442. package/dist/locked-documents/config.js.map +1 -1
  443. package/dist/preferences/config.d.ts.map +1 -1
  444. package/dist/preferences/config.js +2 -1
  445. package/dist/preferences/config.js.map +1 -1
  446. package/dist/preferences/deleteUserPreferences.d.ts.map +1 -1
  447. package/dist/preferences/keys.d.ts +4 -0
  448. package/dist/preferences/keys.d.ts.map +1 -1
  449. package/dist/preferences/keys.js +4 -1
  450. package/dist/preferences/keys.js.map +1 -1
  451. package/dist/preferences/types.d.ts +15 -0
  452. package/dist/preferences/types.d.ts.map +1 -1
  453. package/dist/preferences/types.js +3 -1
  454. package/dist/preferences/types.js.map +1 -1
  455. package/dist/query-presets/access.d.ts.map +1 -1
  456. package/dist/query-presets/config.d.ts.map +1 -1
  457. package/dist/query-presets/config.js +77 -37
  458. package/dist/query-presets/config.js.map +1 -1
  459. package/dist/query-presets/constraints.d.ts.map +1 -1
  460. package/dist/query-presets/constraints.js +3 -2
  461. package/dist/query-presets/constraints.js.map +1 -1
  462. package/dist/queues/config/collection.d.ts.map +1 -1
  463. package/dist/queues/config/collection.js +2 -1
  464. package/dist/queues/config/collection.js.map +1 -1
  465. package/dist/queues/config/generateJobsJSONSchemas.d.ts +1 -1
  466. package/dist/queues/config/generateJobsJSONSchemas.d.ts.map +1 -1
  467. package/dist/queues/config/generateJobsJSONSchemas.js +33 -12
  468. package/dist/queues/config/generateJobsJSONSchemas.js.map +1 -1
  469. package/dist/queues/config/global.d.ts.map +1 -1
  470. package/dist/queues/config/global.js +2 -1
  471. package/dist/queues/config/global.js.map +1 -1
  472. package/dist/queues/endpoints/run.d.ts.map +1 -1
  473. package/dist/queues/localAPI.d.ts.map +1 -1
  474. package/dist/queues/operations/handleSchedules/getQueuesWithSchedules.d.ts.map +1 -1
  475. package/dist/queues/operations/runJobs/index.d.ts.map +1 -1
  476. package/dist/queues/operations/runJobs/runJSONJob/index.d.ts.map +1 -1
  477. package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.d.ts.map +1 -1
  478. package/dist/queues/operations/runJobs/runJob/index.d.ts.map +1 -1
  479. package/dist/queues/utilities/getJobTaskStatus.d.ts.map +1 -1
  480. package/dist/translations/getLocalI18n.d.ts.map +1 -1
  481. package/dist/types/index.d.ts +18 -8
  482. package/dist/types/index.d.ts.map +1 -1
  483. package/dist/types/index.js.map +1 -1
  484. package/dist/uploads/checkFileAccess.d.ts.map +1 -1
  485. package/dist/uploads/checkFileRestrictions.d.ts.map +1 -1
  486. package/dist/uploads/docWithFilenameExists.d.ts.map +1 -1
  487. package/dist/uploads/endpoints/getFileFromURL.d.ts.map +1 -1
  488. package/dist/uploads/endpoints/getFileFromURL.js +9 -5
  489. package/dist/uploads/endpoints/getFileFromURL.js.map +1 -1
  490. package/dist/uploads/fetchAPI-multipart/isEligibleRequest.d.ts.map +1 -1
  491. package/dist/uploads/fetchAPI-multipart/processNested.d.ts.map +1 -1
  492. package/dist/uploads/fetchAPI-multipart/utilities.d.ts.map +1 -1
  493. package/dist/uploads/fileExists.d.ts.map +1 -1
  494. package/dist/uploads/generateFileData.d.ts +2 -1
  495. package/dist/uploads/generateFileData.d.ts.map +1 -1
  496. package/dist/uploads/generateFileData.js +5 -2
  497. package/dist/uploads/generateFileData.js.map +1 -1
  498. package/dist/uploads/getBaseFields.d.ts.map +1 -1
  499. package/dist/uploads/getBaseFields.js +7 -19
  500. package/dist/uploads/getBaseFields.js.map +1 -1
  501. package/dist/uploads/getExternalFile.d.ts.map +1 -1
  502. package/dist/uploads/getFileByPath.d.ts.map +1 -1
  503. package/dist/uploads/getFileTypeFallback.d.ts.map +1 -1
  504. package/dist/uploads/getSafeFilename.d.ts.map +1 -1
  505. package/dist/uploads/image-resizing/createImageSize.d.ts.map +1 -1
  506. package/dist/uploads/image-resizing/generateImageSizeFilename.d.ts.map +1 -1
  507. package/dist/uploads/image-resizing/getImageResizeAction.d.ts.map +1 -1
  508. package/dist/uploads/image-resizing/parseFilename.d.ts.map +1 -1
  509. package/dist/uploads/image-resizing/sanitizeResizeConfig.d.ts.map +1 -1
  510. package/dist/uploads/matchMimeType.d.ts +8 -0
  511. package/dist/uploads/matchMimeType.d.ts.map +1 -0
  512. package/dist/uploads/matchMimeType.js +19 -0
  513. package/dist/uploads/matchMimeType.js.map +1 -0
  514. package/dist/uploads/matchMimeType.spec.js +66 -0
  515. package/dist/uploads/matchMimeType.spec.js.map +1 -0
  516. package/dist/uploads/mimeTypeValidator.d.ts.map +1 -1
  517. package/dist/uploads/safeFetch.d.ts +1 -1
  518. package/dist/uploads/safeFetch.d.ts.map +1 -1
  519. package/dist/uploads/safeFetch.js +11 -5
  520. package/dist/uploads/safeFetch.js.map +1 -1
  521. package/dist/uploads/saveBufferToFile.d.ts.map +1 -1
  522. package/dist/uploads/tempFile.d.ts.map +1 -1
  523. package/dist/uploads/types.d.ts +33 -29
  524. package/dist/uploads/types.d.ts.map +1 -1
  525. package/dist/uploads/types.js.map +1 -1
  526. package/dist/uploads/uploadFiles.d.ts.map +1 -1
  527. package/dist/utilities/addDataAndFileToRequest.d.ts.map +1 -1
  528. package/dist/utilities/addDataAndFileToRequest.js +6 -0
  529. package/dist/utilities/addDataAndFileToRequest.js.map +1 -1
  530. package/dist/utilities/addLocalesToRequest.d.ts.map +1 -1
  531. package/dist/utilities/addSelectGenericsToGeneretedTypes.d.ts.map +1 -1
  532. package/dist/utilities/appendDateTimezoneSelectFields.d.ts.map +1 -1
  533. package/dist/utilities/appendDateTimezoneSelectFields.js +2 -2
  534. package/dist/utilities/appendDateTimezoneSelectFields.js.map +1 -1
  535. package/dist/utilities/appendNonTrashedFilter.d.ts.map +1 -1
  536. package/dist/utilities/appendUploadSelectFields.d.ts.map +1 -1
  537. package/dist/utilities/canAccessAdmin.d.ts.map +1 -1
  538. package/dist/utilities/checkDocumentLockStatus.d.ts.map +1 -1
  539. package/dist/utilities/configToJSONSchema.d.ts +68 -16
  540. package/dist/utilities/configToJSONSchema.d.ts.map +1 -1
  541. package/dist/utilities/configToJSONSchema.js +311 -117
  542. package/dist/utilities/configToJSONSchema.js.map +1 -1
  543. package/dist/utilities/configToJSONSchema.spec.js +619 -85
  544. package/dist/utilities/configToJSONSchema.spec.js.map +1 -1
  545. package/dist/utilities/createLocalReq.d.ts +2 -2
  546. package/dist/utilities/createLocalReq.d.ts.map +1 -1
  547. package/dist/utilities/createLocalReq.js.map +1 -1
  548. package/dist/utilities/createPayloadRequest.d.ts.map +1 -1
  549. package/dist/utilities/createPayloadRequest.js +1 -0
  550. package/dist/utilities/createPayloadRequest.js.map +1 -1
  551. package/dist/utilities/deepCopyObject.d.ts.map +1 -1
  552. package/dist/utilities/deepCopyObject.js +8 -0
  553. package/dist/utilities/deepCopyObject.js.map +1 -1
  554. package/dist/utilities/dependencies/dependencyChecker.js +1 -1
  555. package/dist/utilities/dependencies/dependencyChecker.js.map +1 -1
  556. package/dist/utilities/dependencies/getDependencies.d.ts.map +1 -1
  557. package/dist/utilities/dependencies/getDependencies.js +5 -5
  558. package/dist/utilities/dependencies/getDependencies.js.map +1 -1
  559. package/dist/utilities/dependencies/resolveFrom.d.ts.map +1 -1
  560. package/dist/utilities/dynamicImport.js +1 -1
  561. package/dist/utilities/dynamicImport.js.map +1 -1
  562. package/dist/utilities/escapeRegExp.d.ts.map +1 -1
  563. package/dist/utilities/extractID.d.ts.map +1 -1
  564. package/dist/utilities/filterDataToSelectedLocales.d.ts.map +1 -1
  565. package/dist/utilities/filterDataToSelectedLocales.js +5 -12
  566. package/dist/utilities/filterDataToSelectedLocales.js.map +1 -1
  567. package/dist/utilities/filterDataToSelectedLocales.spec.js +1 -2
  568. package/dist/utilities/filterDataToSelectedLocales.spec.js.map +1 -1
  569. package/dist/utilities/flattenAllFields.d.ts.map +1 -1
  570. package/dist/utilities/flattenAllFields.js +7 -22
  571. package/dist/utilities/flattenAllFields.js.map +1 -1
  572. package/dist/utilities/formatAdminURL.d.ts.map +1 -1
  573. package/dist/utilities/formatErrors.d.ts.map +1 -1
  574. package/dist/utilities/formatErrors.js +3 -1
  575. package/dist/utilities/formatErrors.js.map +1 -1
  576. package/dist/utilities/formatLabels.d.ts.map +1 -1
  577. package/dist/utilities/getBestFitFromSizes.d.ts.map +1 -1
  578. package/dist/utilities/getBlockSelect.d.ts.map +1 -1
  579. package/dist/utilities/getDataByPath.d.ts.map +1 -1
  580. package/dist/utilities/getEntityPermissions/getEntityPermissions.d.ts.map +1 -1
  581. package/dist/utilities/getEntityPermissions/getEntityPermissions.js +2 -0
  582. package/dist/utilities/getEntityPermissions/getEntityPermissions.js.map +1 -1
  583. package/dist/utilities/getEntityPermissions/populateFieldPermissions.d.ts +7 -1
  584. package/dist/utilities/getEntityPermissions/populateFieldPermissions.d.ts.map +1 -1
  585. package/dist/utilities/getEntityPermissions/populateFieldPermissions.js +24 -7
  586. package/dist/utilities/getEntityPermissions/populateFieldPermissions.js.map +1 -1
  587. package/dist/utilities/getFieldByPath.d.ts.map +1 -1
  588. package/dist/utilities/getFieldByPath.js +1 -1
  589. package/dist/utilities/getFieldByPath.js.map +1 -1
  590. package/dist/utilities/getFieldPermissions.d.ts.map +1 -1
  591. package/dist/utilities/getObjectDotNotation.d.ts.map +1 -1
  592. package/dist/utilities/getRequestEntity.d.ts.map +1 -1
  593. package/dist/utilities/getRequestLanguage.d.ts +2 -2
  594. package/dist/utilities/getRequestLanguage.d.ts.map +1 -1
  595. package/dist/utilities/getRequestLanguage.js.map +1 -1
  596. package/dist/utilities/getRequestOrigin.d.ts.map +1 -1
  597. package/dist/utilities/getSafeRedirect.d.ts.map +1 -1
  598. package/dist/utilities/getSelectMode.d.ts.map +1 -1
  599. package/dist/utilities/getSiblingData.d.ts.map +1 -1
  600. package/dist/utilities/getTranslatedLabel.d.ts.map +1 -1
  601. package/dist/utilities/getVersionsConfig.d.ts.map +1 -1
  602. package/dist/utilities/getVersionsConfig.js.map +1 -1
  603. package/dist/utilities/handleEndpoints.d.ts.map +1 -1
  604. package/dist/utilities/handleEndpoints.js +7 -4
  605. package/dist/utilities/handleEndpoints.js.map +1 -1
  606. package/dist/utilities/headersWithCors.d.ts.map +1 -1
  607. package/dist/utilities/isEntityHidden.d.ts.map +1 -1
  608. package/dist/utilities/isURLAllowed.d.ts.map +1 -1
  609. package/dist/utilities/isValidID.d.ts.map +1 -1
  610. package/dist/utilities/logError.d.ts.map +1 -1
  611. package/dist/utilities/logger.d.ts.map +1 -1
  612. package/dist/utilities/mergeHeaders.d.ts.map +1 -1
  613. package/dist/utilities/mergeListSearchAndWhere.d.ts.map +1 -1
  614. package/dist/utilities/mergeLocalizedData.d.ts +14 -4
  615. package/dist/utilities/mergeLocalizedData.d.ts.map +1 -1
  616. package/dist/utilities/mergeLocalizedData.js +54 -46
  617. package/dist/utilities/mergeLocalizedData.js.map +1 -1
  618. package/dist/utilities/mergeLocalizedData.spec.js +23 -23
  619. package/dist/utilities/mergeLocalizedData.spec.js.map +1 -1
  620. package/dist/utilities/optionsAreEqual.d.ts.map +1 -1
  621. package/dist/utilities/parseBooleanString.d.ts.map +1 -1
  622. package/dist/utilities/parseCookies.d.ts.map +1 -1
  623. package/dist/utilities/parseParams/index.d.ts +2 -5
  624. package/dist/utilities/parseParams/index.d.ts.map +1 -1
  625. package/dist/utilities/parseParams/index.js.map +1 -1
  626. package/dist/utilities/parseParams/index.spec.js +0 -9
  627. package/dist/utilities/parseParams/index.spec.js.map +1 -1
  628. package/dist/utilities/profiling.d.ts.map +1 -1
  629. package/dist/utilities/reduceFieldsToValues.d.ts.map +1 -1
  630. package/dist/utilities/resolveSelect.d.ts.map +1 -1
  631. package/dist/utilities/routeError.d.ts.map +1 -1
  632. package/dist/utilities/sanitizeFallbackLocale.d.ts.map +1 -1
  633. package/dist/utilities/sanitizeInternalFields.d.ts.map +1 -1
  634. package/dist/utilities/sanitizeJoinParams.d.ts.map +1 -1
  635. package/dist/utilities/sanitizePopulateParam.d.ts.map +1 -1
  636. package/dist/utilities/sanitizeSelect.d.ts.map +1 -1
  637. package/dist/utilities/sanitizeSelectParam.d.ts.map +1 -1
  638. package/dist/utilities/sanitizeSortParams.d.ts.map +1 -1
  639. package/dist/utilities/setsAreEqual.d.ts.map +1 -1
  640. package/dist/utilities/slugify.d.ts.map +1 -1
  641. package/dist/utilities/stripUnselectedFields.d.ts.map +1 -1
  642. package/dist/utilities/telemetry/events/adminInit.d.ts.map +1 -1
  643. package/dist/utilities/telemetry/events/serverInit.d.ts.map +1 -1
  644. package/dist/utilities/telemetry/index.d.ts.map +1 -1
  645. package/dist/utilities/telemetry/oneWayHash.d.ts.map +1 -1
  646. package/dist/utilities/timestamp.d.ts.map +1 -1
  647. package/dist/utilities/toKebabCase.d.ts.map +1 -1
  648. package/dist/utilities/transformColumnPreferences.d.ts.map +1 -1
  649. package/dist/utilities/transformColumnPreferences.js +4 -2
  650. package/dist/utilities/transformColumnPreferences.js.map +1 -1
  651. package/dist/utilities/transformWhereQuery.d.ts.map +1 -1
  652. package/dist/utilities/traverseFields.d.ts.map +1 -1
  653. package/dist/utilities/traverseFields.js +2 -4
  654. package/dist/utilities/traverseFields.js.map +1 -1
  655. package/dist/utilities/traverseForLocalizedFields.d.ts.map +1 -1
  656. package/dist/utilities/traverseForLocalizedFields.js +3 -0
  657. package/dist/utilities/traverseForLocalizedFields.js.map +1 -1
  658. package/dist/utilities/unflatten.d.ts.map +1 -1
  659. package/dist/utilities/validateMimeType.d.ts.map +1 -1
  660. package/dist/utilities/validateTimezones.d.ts.map +1 -1
  661. package/dist/utilities/validateWhereQuery.d.ts.map +1 -1
  662. package/dist/utilities/wordBoundariesRegex.d.ts.map +1 -1
  663. package/dist/utilities/wrapInternalEndpoints.d.ts.map +1 -1
  664. package/dist/versions/baseFields.d.ts +1 -2
  665. package/dist/versions/baseFields.d.ts.map +1 -1
  666. package/dist/versions/baseFields.js +0 -13
  667. package/dist/versions/baseFields.js.map +1 -1
  668. package/dist/versions/buildCollectionFields.d.ts.map +1 -1
  669. package/dist/versions/buildCollectionFields.js +0 -2
  670. package/dist/versions/buildCollectionFields.js.map +1 -1
  671. package/dist/versions/buildGlobalFields.d.ts.map +1 -1
  672. package/dist/versions/buildGlobalFields.js +0 -2
  673. package/dist/versions/buildGlobalFields.js.map +1 -1
  674. package/dist/versions/buildSingleLocalePublishData.d.ts +32 -0
  675. package/dist/versions/buildSingleLocalePublishData.d.ts.map +1 -0
  676. package/dist/versions/buildSingleLocalePublishData.js +37 -0
  677. package/dist/versions/buildSingleLocalePublishData.js.map +1 -0
  678. package/dist/versions/buildVersionCompoundIndexes.d.ts.map +1 -1
  679. package/dist/versions/deleteCollectionVersions.d.ts.map +1 -1
  680. package/dist/versions/deleteScheduledPublishJobs.d.ts.map +1 -1
  681. package/dist/versions/drafts/appendVersionToQueryKey.d.ts.map +1 -1
  682. package/dist/versions/drafts/getQueryDraftsSelect.d.ts.map +1 -1
  683. package/dist/versions/drafts/getQueryDraftsSort.d.ts.map +1 -1
  684. package/dist/versions/drafts/replaceWithDraftIfAvailable.d.ts.map +1 -1
  685. package/dist/versions/enforceMaxVersions.d.ts.map +1 -1
  686. package/dist/versions/getLatestCollectionVersion.d.ts.map +1 -1
  687. package/dist/versions/getLatestGlobalVersion.d.ts.map +1 -1
  688. package/dist/versions/migrations/localizeStatus/shared.d.ts.map +1 -1
  689. package/dist/versions/saveVersion.d.ts +0 -2
  690. package/dist/versions/saveVersion.d.ts.map +1 -1
  691. package/dist/versions/saveVersion.js +12 -17
  692. package/dist/versions/saveVersion.js.map +1 -1
  693. package/dist/versions/schedule/job.d.ts.map +1 -1
  694. package/dist/versions/schedule/job.js +2 -9
  695. package/dist/versions/schedule/job.js.map +1 -1
  696. package/dist/versions/types.d.ts +2 -15
  697. package/dist/versions/types.d.ts.map +1 -1
  698. package/dist/versions/types.js.map +1 -1
  699. package/package.json +23 -20
  700. package/dist/database/migrations/templates/localizeStatus.d.ts +0 -10
  701. package/dist/database/migrations/templates/localizeStatus.d.ts.map +0 -1
  702. package/dist/database/migrations/templates/localizeStatus.js +0 -54
  703. package/dist/database/migrations/templates/localizeStatus.js.map +0 -1
  704. package/dist/versions/migrations/localizeStatus/index.d.ts +0 -12
  705. package/dist/versions/migrations/localizeStatus/index.d.ts.map +0 -1
  706. package/dist/versions/migrations/localizeStatus/index.js +0 -33
  707. package/dist/versions/migrations/localizeStatus/index.js.map +0 -1
  708. package/dist/versions/migrations/localizeStatus/mongo/down.d.ts +0 -9
  709. package/dist/versions/migrations/localizeStatus/mongo/down.d.ts.map +0 -1
  710. package/dist/versions/migrations/localizeStatus/mongo/down.js +0 -112
  711. package/dist/versions/migrations/localizeStatus/mongo/down.js.map +0 -1
  712. package/dist/versions/migrations/localizeStatus/mongo/index.d.ts +0 -8
  713. package/dist/versions/migrations/localizeStatus/mongo/index.d.ts.map +0 -1
  714. package/dist/versions/migrations/localizeStatus/mongo/index.js +0 -8
  715. package/dist/versions/migrations/localizeStatus/mongo/index.js.map +0 -1
  716. package/dist/versions/migrations/localizeStatus/mongo/up.d.ts +0 -9
  717. package/dist/versions/migrations/localizeStatus/mongo/up.d.ts.map +0 -1
  718. package/dist/versions/migrations/localizeStatus/mongo/up.js +0 -220
  719. package/dist/versions/migrations/localizeStatus/mongo/up.js.map +0 -1
  720. package/dist/versions/migrations/localizeStatus/sql/down.d.ts +0 -11
  721. package/dist/versions/migrations/localizeStatus/sql/down.d.ts.map +0 -1
  722. package/dist/versions/migrations/localizeStatus/sql/down.js +0 -213
  723. package/dist/versions/migrations/localizeStatus/sql/down.js.map +0 -1
  724. package/dist/versions/migrations/localizeStatus/sql/index.d.ts +0 -8
  725. package/dist/versions/migrations/localizeStatus/sql/index.d.ts.map +0 -1
  726. package/dist/versions/migrations/localizeStatus/sql/index.js +0 -8
  727. package/dist/versions/migrations/localizeStatus/sql/index.js.map +0 -1
  728. package/dist/versions/migrations/localizeStatus/sql/migrateMainCollection.d.ts +0 -13
  729. package/dist/versions/migrations/localizeStatus/sql/migrateMainCollection.d.ts.map +0 -1
  730. package/dist/versions/migrations/localizeStatus/sql/migrateMainCollection.js +0 -51
  731. package/dist/versions/migrations/localizeStatus/sql/migrateMainCollection.js.map +0 -1
  732. package/dist/versions/migrations/localizeStatus/sql/migrateMainGlobal.d.ts +0 -13
  733. package/dist/versions/migrations/localizeStatus/sql/migrateMainGlobal.d.ts.map +0 -1
  734. package/dist/versions/migrations/localizeStatus/sql/migrateMainGlobal.js +0 -54
  735. package/dist/versions/migrations/localizeStatus/sql/migrateMainGlobal.js.map +0 -1
  736. package/dist/versions/migrations/localizeStatus/sql/up.d.ts +0 -11
  737. package/dist/versions/migrations/localizeStatus/sql/up.d.ts.map +0 -1
  738. package/dist/versions/migrations/localizeStatus/sql/up.js +0 -277
  739. package/dist/versions/migrations/localizeStatus/sql/up.js.map +0 -1
  740. package/dist/versions/saveSnapshot.d.ts +0 -18
  741. package/dist/versions/saveSnapshot.d.ts.map +0 -1
  742. package/dist/versions/saveSnapshot.js +0 -38
  743. package/dist/versions/saveSnapshot.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/collections/operations/findDistinct.ts"],"sourcesContent":["import httpStatus from 'http-status'\n\nimport type { AccessResult } from '../../config/types.js'\nimport type { PaginatedDistinctDocs } from '../../database/types.js'\nimport type { FlattenedField } from '../../fields/config/types.js'\nimport type { PayloadRequest, PopulateType, Sort, Where } from '../../types/index.js'\nimport type { Collection } from '../config/types.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 { APIError } from '../../errors/APIError.js'\nimport { Forbidden } from '../../errors/Forbidden.js'\nimport { relationshipPopulationPromise } from '../../fields/hooks/afterRead/relationshipPopulationPromise.js'\nimport { appendNonTrashedFilter } from '../../utilities/appendNonTrashedFilter.js'\nimport { getFieldByPath } from '../../utilities/getFieldByPath.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { buildAfterOperation } from './utilities/buildAfterOperation.js'\nimport { buildBeforeOperation } from './utilities/buildBeforeOperation.js'\n\nexport type Arguments = {\n collection: Collection\n depth?: number\n disableErrors?: boolean\n field: string\n limit?: number\n locale?: string\n overrideAccess?: boolean\n page?: number\n populate?: PopulateType\n req?: PayloadRequest\n showHiddenFields?: boolean\n sort?: Sort\n trash?: boolean\n where?: Where\n}\nexport const findDistinctOperation = async (\n incomingArgs: Arguments,\n): Promise<PaginatedDistinctDocs<Record<string, unknown>>> => {\n let args = incomingArgs\n\n try {\n // /////////////////////////////////////\n // beforeOperation - Collection\n // /////////////////////////////////////\n\n args = await buildBeforeOperation({\n args,\n collection: args.collection.config,\n operation: 'readDistinct',\n overrideAccess: args.overrideAccess!,\n })\n\n const {\n collection: { config: collectionConfig },\n disableErrors,\n overrideAccess,\n populate,\n showHiddenFields = false,\n trash = false,\n where,\n } = args\n\n const req = args.req!\n const { locale, payload } = req\n\n // /////////////////////////////////////\n // Access\n // /////////////////////////////////////\n\n let accessResult: AccessResult\n\n if (!overrideAccess) {\n accessResult = await executeAccess({ disableErrors, req }, collectionConfig.access.read)\n\n // If errors are disabled, and access returns false, return empty results\n if (accessResult === false) {\n return {\n hasNextPage: false,\n hasPrevPage: false,\n limit: args.limit || 0,\n nextPage: null,\n page: 1,\n pagingCounter: 1,\n prevPage: null,\n totalDocs: 0,\n totalPages: 0,\n values: [],\n }\n }\n }\n\n // /////////////////////////////////////\n // Find Distinct\n // /////////////////////////////////////\n\n let fullWhere = combineQueries(where!, accessResult!)\n sanitizeWhereQuery({ fields: collectionConfig.flattenedFields, payload, where: fullWhere })\n\n // Exclude trashed documents when trash: false\n fullWhere = appendNonTrashedFilter({\n enableTrash: collectionConfig.trash,\n trash,\n where: fullWhere,\n })\n\n await validateQueryPaths({\n collectionConfig,\n overrideAccess: overrideAccess!,\n req,\n where: where ?? {},\n })\n\n const fieldResult = getFieldByPath({\n config: payload.config,\n fields: collectionConfig.flattenedFields,\n includeRelationships: true,\n path: args.field,\n })\n\n if (!fieldResult) {\n throw new APIError(\n `Field ${args.field} was not found in the collection ${collectionConfig.slug}`,\n httpStatus.BAD_REQUEST,\n )\n }\n\n if (fieldResult.field.hidden && !showHiddenFields) {\n throw new Forbidden(req.t)\n }\n\n if (fieldResult.field.access?.read) {\n const hasAccess = await fieldResult.field.access.read({ req })\n if (!hasAccess) {\n throw new Forbidden(req.t)\n }\n }\n\n if ('virtual' in fieldResult.field && fieldResult.field.virtual) {\n if (typeof fieldResult.field.virtual !== 'string') {\n throw new APIError(\n `Cannot findDistinct by a virtual field that isn't linked to a relationship field.`,\n )\n }\n\n let relationPath: string = ''\n let currentFields: FlattenedField[] = collectionConfig.flattenedFields\n const fieldPathSegments = fieldResult.field.virtual.split('.')\n for (const segment of fieldResult.field.virtual.split('.')) {\n relationPath = `${relationPath}${segment}`\n fieldPathSegments.shift()\n const field = currentFields.find((e) => e.name === segment)!\n if (\n (field.type === 'relationship' || field.type === 'upload') &&\n typeof field.relationTo === 'string'\n ) {\n break\n }\n if ('flattenedFields' in field) {\n currentFields = field.flattenedFields\n }\n }\n\n const path = `${relationPath}.${fieldPathSegments.join('.')}`\n\n const result = await payload.findDistinct({\n collection: collectionConfig.slug,\n depth: args.depth,\n disableErrors,\n field: path,\n limit: args.limit,\n locale,\n overrideAccess,\n page: args.page,\n populate,\n req,\n showHiddenFields,\n sort: args.sort,\n trash,\n where,\n })\n\n for (const val of result.values) {\n val[args.field] = val[path]\n delete val[path]\n }\n\n return result\n }\n\n let result = await payload.db.findDistinct({\n collection: collectionConfig.slug,\n field: args.field,\n limit: args.limit,\n locale: locale!,\n page: args.page,\n req,\n sort: args.sort,\n where: fullWhere,\n })\n\n if (\n (fieldResult.field.type === 'relationship' || fieldResult.field.type === 'upload') &&\n args.depth\n ) {\n const populationPromises: Promise<void>[] = []\n const sanitizedField = { ...fieldResult.field }\n if (fieldResult.field.hasMany) {\n sanitizedField.hasMany = false\n }\n for (const doc of result.values) {\n populationPromises.push(\n relationshipPopulationPromise({\n currentDepth: 0,\n depth: args.depth,\n draft: false,\n fallbackLocale: req.fallbackLocale || null,\n field: sanitizedField,\n locale: req.locale || null,\n overrideAccess: args.overrideAccess ?? true,\n parentIsLocalized: false,\n populate,\n req,\n showHiddenFields: false,\n siblingDoc: doc,\n }),\n )\n }\n await Promise.all(populationPromises)\n }\n\n // /////////////////////////////////////\n // afterOperation - Collection\n // /////////////////////////////////////\n\n result = await buildAfterOperation({\n args,\n collection: collectionConfig,\n operation: 'findDistinct',\n overrideAccess,\n result,\n })\n\n // /////////////////////////////////////\n // Return results\n // /////////////////////////////////////\n\n return result\n } catch (error: unknown) {\n await killTransaction(args.req!)\n throw error\n }\n}\n"],"names":["httpStatus","executeAccess","combineQueries","validateQueryPaths","sanitizeWhereQuery","APIError","Forbidden","relationshipPopulationPromise","appendNonTrashedFilter","getFieldByPath","killTransaction","buildAfterOperation","buildBeforeOperation","findDistinctOperation","incomingArgs","args","collection","config","operation","overrideAccess","collectionConfig","disableErrors","populate","showHiddenFields","trash","where","req","locale","payload","accessResult","access","read","hasNextPage","hasPrevPage","limit","nextPage","page","pagingCounter","prevPage","totalDocs","totalPages","values","fullWhere","fields","flattenedFields","enableTrash","fieldResult","includeRelationships","path","field","slug","BAD_REQUEST","hidden","t","hasAccess","virtual","relationPath","currentFields","fieldPathSegments","split","segment","shift","find","e","name","type","relationTo","join","result","findDistinct","depth","sort","val","db","populationPromises","sanitizedField","hasMany","doc","push","currentDepth","draft","fallbackLocale","parentIsLocalized","siblingDoc","Promise","all","error"],"mappings":"AAAA,OAAOA,gBAAgB,cAAa;AAQpC,SAASC,aAAa,QAAQ,8BAA6B;AAC3D,SAASC,cAAc,QAAQ,mCAAkC;AACjE,SAASC,kBAAkB,QAAQ,uDAAsD;AACzF,SAASC,kBAAkB,QAAQ,uCAAsC;AACzE,SAASC,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,SAAS,QAAQ,4BAA2B;AACrD,SAASC,6BAA6B,QAAQ,gEAA+D;AAC7G,SAASC,sBAAsB,QAAQ,4CAA2C;AAClF,SAASC,cAAc,QAAQ,oCAAmC;AAClE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,mBAAmB,QAAQ,qCAAoC;AACxE,SAASC,oBAAoB,QAAQ,sCAAqC;AAkB1E,OAAO,MAAMC,wBAAwB,OACnCC;IAEA,IAAIC,OAAOD;IAEX,IAAI;QACF,wCAAwC;QACxC,+BAA+B;QAC/B,wCAAwC;QAExCC,OAAO,MAAMH,qBAAqB;YAChCG;YACAC,YAAY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U,OAAO;oBACPC,gBAAgBvD,IAAIuD,cAAc,IAAI;oBACtChC,OAAO0B;oBACPhD,QAAQD,IAAIC,MAAM,IAAI;oBACtBR,gBAAgBJ,KAAKI,cAAc,IAAI;oBACvC+D,mBAAmB;oBACnB5D;oBACAI;oBACAH,kBAAkB;oBAClB4D,YAAYN;gBACd;YAEJ;YACA,MAAMO,QAAQC,GAAG,CAACX;QACpB;QAEA,wCAAwC;QACxC,8BAA8B;QAC9B,wCAAwC;QAExCN,SAAS,MAAMzD,oBAAoB;YACjCI;YACAC,YAAYI;YACZF,WAAW;YACXC;YACAiD;QACF;QAEA,wCAAwC;QACxC,iBAAiB;QACjB,wCAAwC;QAExC,OAAOA;IACT,EAAE,OAAOkB,OAAgB;QACvB,MAAM5E,gBAAgBK,KAAKW,GAAG;QAC9B,MAAM4D;IACR;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/collections/operations/findDistinct.ts"],"sourcesContent":["import httpStatus from 'http-status'\n\nimport type { AccessResult } from '../../config/types.js'\nimport type { PaginatedDistinctDocs } from '../../database/types.js'\nimport type { FlattenedField } from '../../fields/config/types.js'\nimport type { PayloadRequest, PopulateType, Sort, Where } from '../../types/index.js'\nimport type { Collection } from '../config/types.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 { APIError } from '../../errors/APIError.js'\nimport { Forbidden } from '../../errors/Forbidden.js'\nimport { relationshipPopulationPromise } from '../../fields/hooks/afterRead/relationshipPopulationPromise.js'\nimport { appendNonTrashedFilter } from '../../utilities/appendNonTrashedFilter.js'\nimport { getFieldByPath } from '../../utilities/getFieldByPath.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { buildAfterOperation } from './utilities/buildAfterOperation.js'\nimport { buildBeforeOperation } from './utilities/buildBeforeOperation.js'\n\nexport type Arguments = {\n collection: Collection\n depth?: number\n disableErrors?: boolean\n field: string\n limit?: number\n locale?: string\n overrideAccess?: boolean\n page?: number\n populate?: PopulateType\n req?: PayloadRequest\n showHiddenFields?: boolean\n sort?: Sort\n trash?: boolean\n where?: Where\n}\nexport const findDistinctOperation = async (\n incomingArgs: Arguments,\n): Promise<PaginatedDistinctDocs<Record<string, unknown>>> => {\n let args = incomingArgs\n\n try {\n // /////////////////////////////////////\n // beforeOperation - Collection\n // /////////////////////////////////////\n\n args = await buildBeforeOperation({\n args,\n collection: args.collection.config,\n operation: 'readDistinct',\n overrideAccess: args.overrideAccess!,\n })\n\n const {\n collection: { config: collectionConfig },\n disableErrors,\n overrideAccess,\n populate,\n showHiddenFields = false,\n trash = false,\n where,\n } = args\n\n const req = args.req!\n const { locale, payload } = req\n\n // /////////////////////////////////////\n // Access\n // /////////////////////////////////////\n\n let accessResult: AccessResult\n\n if (!overrideAccess) {\n accessResult = await executeAccess({ disableErrors, req }, collectionConfig.access.read)\n\n // If errors are disabled, and access returns false, return empty results\n if (accessResult === false) {\n return {\n hasNextPage: false,\n hasPrevPage: false,\n limit: args.limit || 0,\n nextPage: null,\n page: 1,\n pagingCounter: 1,\n prevPage: null,\n totalDocs: 0,\n totalPages: 0,\n values: [],\n }\n }\n }\n\n // /////////////////////////////////////\n // Find Distinct\n // /////////////////////////////////////\n\n let fullWhere = combineQueries(where!, accessResult!)\n sanitizeWhereQuery({ fields: collectionConfig.flattenedFields, payload, where: fullWhere })\n\n // Exclude trashed documents when trash: false\n fullWhere = appendNonTrashedFilter({\n enableTrash: collectionConfig.trash,\n trash,\n where: fullWhere,\n })\n\n await validateQueryPaths({\n collectionConfig,\n overrideAccess: overrideAccess!,\n req,\n where: where ?? {},\n })\n\n const fieldResult = getFieldByPath({\n config: payload.config,\n fields: collectionConfig.flattenedFields,\n includeRelationships: true,\n path: args.field,\n })\n\n if (!fieldResult) {\n throw new APIError(\n `Field ${args.field} was not found in the collection ${collectionConfig.slug}`,\n httpStatus.BAD_REQUEST,\n )\n }\n\n if (fieldResult.field.hidden && !showHiddenFields) {\n throw new Forbidden(req.t)\n }\n\n if (fieldResult.field.access?.read) {\n const hasAccess = await fieldResult.field.access.read({\n collection: collectionConfig,\n req,\n })\n if (!hasAccess) {\n throw new Forbidden(req.t)\n }\n }\n\n if ('virtual' in fieldResult.field && fieldResult.field.virtual) {\n if (typeof fieldResult.field.virtual !== 'string') {\n throw new APIError(\n `Cannot findDistinct by a virtual field that isn't linked to a relationship field.`,\n )\n }\n\n let relationPath: string = ''\n let currentFields: FlattenedField[] = collectionConfig.flattenedFields\n const fieldPathSegments = fieldResult.field.virtual.split('.')\n for (const segment of fieldResult.field.virtual.split('.')) {\n relationPath = `${relationPath}${segment}`\n fieldPathSegments.shift()\n const field = currentFields.find((e) => e.name === segment)!\n if (\n (field.type === 'relationship' || field.type === 'upload') &&\n typeof field.relationTo === 'string'\n ) {\n break\n }\n if ('flattenedFields' in field) {\n currentFields = field.flattenedFields\n }\n }\n\n const path = `${relationPath}.${fieldPathSegments.join('.')}`\n\n const result = await payload.findDistinct({\n collection: collectionConfig.slug,\n depth: args.depth,\n disableErrors,\n field: path,\n limit: args.limit,\n locale,\n overrideAccess,\n page: args.page,\n populate,\n req,\n showHiddenFields,\n sort: args.sort,\n trash,\n where,\n })\n\n for (const val of result.values) {\n val[args.field] = val[path]\n delete val[path]\n }\n\n return result\n }\n\n let result = await payload.db.findDistinct({\n collection: collectionConfig.slug,\n field: args.field,\n limit: args.limit,\n locale: locale!,\n page: args.page,\n req,\n sort: args.sort,\n where: fullWhere,\n })\n\n if (\n (fieldResult.field.type === 'relationship' || fieldResult.field.type === 'upload') &&\n args.depth\n ) {\n const populationPromises: Promise<void>[] = []\n const sanitizedField = { ...fieldResult.field }\n if (fieldResult.field.hasMany) {\n sanitizedField.hasMany = false\n }\n for (const doc of result.values) {\n populationPromises.push(\n relationshipPopulationPromise({\n currentDepth: 0,\n depth: args.depth,\n draft: false,\n fallbackLocale: req.fallbackLocale || null,\n field: sanitizedField,\n locale: req.locale || null,\n overrideAccess: args.overrideAccess ?? true,\n parentIsLocalized: false,\n populate,\n req,\n showHiddenFields: false,\n siblingDoc: doc,\n }),\n )\n }\n await Promise.all(populationPromises)\n }\n\n // /////////////////////////////////////\n // afterOperation - Collection\n // /////////////////////////////////////\n\n result = await buildAfterOperation({\n args,\n collection: collectionConfig,\n operation: 'findDistinct',\n overrideAccess,\n result,\n })\n\n // /////////////////////////////////////\n // Return results\n // /////////////////////////////////////\n\n return result\n } catch (error: unknown) {\n await killTransaction(args.req!)\n throw error\n }\n}\n"],"names":["httpStatus","executeAccess","combineQueries","validateQueryPaths","sanitizeWhereQuery","APIError","Forbidden","relationshipPopulationPromise","appendNonTrashedFilter","getFieldByPath","killTransaction","buildAfterOperation","buildBeforeOperation","findDistinctOperation","incomingArgs","args","collection","config","operation","overrideAccess","collectionConfig","disableErrors","populate","showHiddenFields","trash","where","req","locale","payload","accessResult","access","read","hasNextPage","hasPrevPage","limit","nextPage","page","pagingCounter","prevPage","totalDocs","totalPages","values","fullWhere","fields","flattenedFields","enableTrash","fieldResult","includeRelationships","path","field","slug","BAD_REQUEST","hidden","t","hasAccess","virtual","relationPath","currentFields","fieldPathSegments","split","segment","shift","find","e","name","type","relationTo","join","result","findDistinct","depth","sort","val","db","populationPromises","sanitizedField","hasMany","doc","push","currentDepth","draft","fallbackLocale","parentIsLocalized","siblingDoc","Promise","all","error"],"mappings":"AAAA,OAAOA,gBAAgB,cAAa;AAQpC,SAASC,aAAa,QAAQ,8BAA6B;AAC3D,SAASC,cAAc,QAAQ,mCAAkC;AACjE,SAASC,kBAAkB,QAAQ,uDAAsD;AACzF,SAASC,kBAAkB,QAAQ,uCAAsC;AACzE,SAASC,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,SAAS,QAAQ,4BAA2B;AACrD,SAASC,6BAA6B,QAAQ,gEAA+D;AAC7G,SAASC,sBAAsB,QAAQ,4CAA2C;AAClF,SAAS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I,qBAAsC,EAAE;YAC9C,MAAMC,iBAAiB;gBAAE,GAAG7B,YAAYG,KAAK;YAAC;YAC9C,IAAIH,YAAYG,KAAK,CAAC2B,OAAO,EAAE;gBAC7BD,eAAeC,OAAO,GAAG;YAC3B;YACA,KAAK,MAAMC,OAAOT,OAAO3B,MAAM,CAAE;gBAC/BiC,mBAAmBI,IAAI,CACrBvE,8BAA8B;oBAC5BwE,cAAc;oBACdT,OAAOvD,KAAKuD,KAAK;oBACjBU,OAAO;oBACPC,gBAAgBvD,IAAIuD,cAAc,IAAI;oBACtChC,OAAO0B;oBACPhD,QAAQD,IAAIC,MAAM,IAAI;oBACtBR,gBAAgBJ,KAAKI,cAAc,IAAI;oBACvC+D,mBAAmB;oBACnB5D;oBACAI;oBACAH,kBAAkB;oBAClB4D,YAAYN;gBACd;YAEJ;YACA,MAAMO,QAAQC,GAAG,CAACX;QACpB;QAEA,wCAAwC;QACxC,8BAA8B;QAC9B,wCAAwC;QAExCN,SAAS,MAAMzD,oBAAoB;YACjCI;YACAC,YAAYI;YACZF,WAAW;YACXC;YACAiD;QACF;QAEA,wCAAwC;QACxC,iBAAiB;QACjB,wCAAwC;QAExC,OAAOA;IACT,EAAE,OAAOkB,OAAgB;QACvB,MAAM5E,gBAAgBK,KAAKW,GAAG;QAC9B,MAAM4D;IACR;AACF,EAAC"}
@@ -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,CAAA;AAchE,MAAM,MAAM,SAAS,GAAG;IACt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AC,aAAa,CAAC,KAAK,CAAC,CAuM9B,CAAA"}
@@ -1,5 +1,5 @@
1
- import type { CollectionSlug, Payload, RequestContext, TypedLocale } from '../../../index.js';
2
- import type { Document, PayloadRequest, Where } from '../../../types/index.js';
1
+ import type { CollectionSlug, Payload, RequestContext, TypedLocale, User } from '../../../index.js';
2
+ import type { PayloadRequest, Where } from '../../../types/index.js';
3
3
  export type CountOptions<TSlug extends CollectionSlug> = {
4
4
  /**
5
5
  * the Collection slug to operate against.
@@ -43,7 +43,7 @@ export type CountOptions<TSlug extends CollectionSlug> = {
43
43
  /**
44
44
  * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
45
45
  */
46
- user?: Document;
46
+ user?: null | User;
47
47
  /**
48
48
  * A filter [query](https://payloadcms.com/docs/queries/overview)
49
49
  */
@@ -1 +1 @@
1
- {"version":3,"file":"count.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/count.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC7F,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAO9E,MAAM,MAAM,YAAY,CAAC,KAAK,SAAS,cAAc,IAAI;IACvD;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7B;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAED,wBAAsB,UAAU,CAAC,KAAK,SAAS,cAAc,EAC3D,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC,GAC3B,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAyBhC"}
1
+ {"version":3,"file":"count.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/count.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACnG,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAOpE,MAAM,MAAM,YAAY,CAAC,KAAK,SAAS,cAAc,IAAI;IACvD;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7B;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAED,wBAAsB,UAAU,CAAC,KAAK,SAAS,cAAc,EAC3D,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC,GAC3B,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAyBhC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/collections/operations/local/count.ts"],"sourcesContent":["import type { CollectionSlug, Payload, RequestContext, TypedLocale } from '../../../index.js'\nimport type { Document, PayloadRequest, Where } from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { countOperation } from '../count.js'\n\nexport type CountOptions<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 * When set to `true`, errors will not be thrown.\n */\n disableErrors?: boolean\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 * 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 * When set to `true`, the query will include both normal and trashed documents.\n * To query only trashed documents, pass `trash: true` and combine with a `where` clause filtering by `deletedAt`.\n * By default (`false`), the query will only include normal documents and exclude those with a `deletedAt` field.\n *\n * This argument has no effect unless `trash` is enabled on the collection.\n * @default false\n */\n trash?: boolean\n // TODO: Strongly type User as TypedUser (= User in v4.0)\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: Document\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: Where\n}\n\nexport async function countLocal<TSlug extends CollectionSlug>(\n payload: Payload,\n options: CountOptions<TSlug>,\n): Promise<{ totalDocs: number }> {\n const {\n collection: collectionSlug,\n disableErrors,\n overrideAccess = true,\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. Count Operation.`,\n )\n }\n\n return countOperation<TSlug>({\n collection,\n disableErrors,\n overrideAccess,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n trash,\n where,\n })\n}\n"],"names":["APIError","createLocalReq","countOperation","countLocal","payload","options","collection","collectionSlug","disableErrors","overrideAccess","trash","where","collections","String","req"],"mappings":"AAIA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,cAAc,QAAQ,cAAa;AAqD5C,OAAO,eAAeC,WACpBC,OAAgB,EAChBC,OAA4B;IAE5B,MAAM,EACJC,YAAYC,cAAc,EAC1BC,aAAa,EACbC,iBAAiB,IAAI,EACrBC,QAAQ,KAAK,EACbC,KAAK,EACN,GAAGN;IAEJ,MAAMC,aAAaF,QAAQQ,WAAW,CAACL,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIN,SACR,CAAC,yBAAyB,EAAEa,OAAON,gBAAgB,iCAAiC,CAAC;IAEzF;IAEA,OAAOL,eAAsB;QAC3BI;QACAE;QACAC;QACAK,KAAK,MAAMb,eAAeI,SAAkCD;QAC5DM;QACAC;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../src/collections/operations/local/count.ts"],"sourcesContent":["import type { CollectionSlug, Payload, RequestContext, TypedLocale, User } from '../../../index.js'\nimport type { PayloadRequest, Where } from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { countOperation } from '../count.js'\n\nexport type CountOptions<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 * When set to `true`, errors will not be thrown.\n */\n disableErrors?: boolean\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 * 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 * When set to `true`, the query will include both normal and trashed documents.\n * To query only trashed documents, pass `trash: true` and combine with a `where` clause filtering by `deletedAt`.\n * By default (`false`), the query will only include normal documents and exclude those with a `deletedAt` field.\n *\n * This argument has no effect unless `trash` is enabled on the collection.\n * @default false\n */\n trash?: boolean\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: null | User\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: Where\n}\n\nexport async function countLocal<TSlug extends CollectionSlug>(\n payload: Payload,\n options: CountOptions<TSlug>,\n): Promise<{ totalDocs: number }> {\n const {\n collection: collectionSlug,\n disableErrors,\n overrideAccess = true,\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. Count Operation.`,\n )\n }\n\n return countOperation<TSlug>({\n collection,\n disableErrors,\n overrideAccess,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n trash,\n where,\n })\n}\n"],"names":["APIError","createLocalReq","countOperation","countLocal","payload","options","collection","collectionSlug","disableErrors","overrideAccess","trash","where","collections","String","req"],"mappings":"AAIA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,cAAc,QAAQ,cAAa;AAoD5C,OAAO,eAAeC,WACpBC,OAAgB,EAChBC,OAA4B;IAE5B,MAAM,EACJC,YAAYC,cAAc,EAC1BC,aAAa,EACbC,iBAAiB,IAAI,EACrBC,QAAQ,KAAK,EACbC,KAAK,EACN,GAAGN;IAEJ,MAAMC,aAAaF,QAAQQ,WAAW,CAACL,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIN,SACR,CAAC,yBAAyB,EAAEa,OAAON,gBAAgB,iCAAiC,CAAC;IAEzF;IAEA,OAAOL,eAAsB;QAC3BI;QACAE;QACAC;QACAK,KAAK,MAAMb,eAAeI,SAAkCD;QAC5DM;QACAC;IACF;AACF"}
@@ -1,5 +1,5 @@
1
- import type { CollectionSlug, Payload, RequestContext, TypedLocale } from '../../../index.js';
2
- import type { Document, PayloadRequest, Where } from '../../../types/index.js';
1
+ import type { CollectionSlug, Payload, RequestContext, TypedLocale, User } from '../../../index.js';
2
+ import type { PayloadRequest, Where } from '../../../types/index.js';
3
3
  export type CountVersionsOptions<TSlug extends CollectionSlug> = {
4
4
  /**
5
5
  * the Collection slug to operate against.
@@ -34,7 +34,7 @@ export type CountVersionsOptions<TSlug extends CollectionSlug> = {
34
34
  /**
35
35
  * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
36
36
  */
37
- user?: Document;
37
+ user?: null | User;
38
38
  /**
39
39
  * A filter [query](https://payloadcms.com/docs/queries/overview)
40
40
  */
@@ -1 +1 @@
1
- {"version":3,"file":"countVersions.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/countVersions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC7F,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAO9E,MAAM,MAAM,oBAAoB,CAAC,KAAK,SAAS,cAAc,IAAI;IAC/D;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAE7B;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAED,wBAAsB,kBAAkB,CAAC,KAAK,SAAS,cAAc,EACnE,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,oBAAoB,CAAC,KAAK,CAAC,GACnC,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAkBhC"}
1
+ {"version":3,"file":"countVersions.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/countVersions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACnG,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAOpE,MAAM,MAAM,oBAAoB,CAAC,KAAK,SAAS,cAAc,IAAI;IAC/D;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7B;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAED,wBAAsB,kBAAkB,CAAC,KAAK,SAAS,cAAc,EACnE,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,oBAAoB,CAAC,KAAK,CAAC,GACnC,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAkBhC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/collections/operations/local/countVersions.ts"],"sourcesContent":["import type { CollectionSlug, Payload, RequestContext, TypedLocale } from '../../../index.js'\nimport type { Document, PayloadRequest, Where } from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { countVersionsOperation } from '../countVersions.js'\n\nexport type CountVersionsOptions<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 * When set to `true`, errors will not be thrown.\n */\n disableErrors?: boolean\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 * 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 // TODO: Strongly type User as TypedUser (= User in v4.0)\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: Document\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: Where\n}\n\nexport async function countVersionsLocal<TSlug extends CollectionSlug>(\n payload: Payload,\n options: CountVersionsOptions<TSlug>,\n): Promise<{ totalDocs: number }> {\n const { collection: collectionSlug, disableErrors, overrideAccess = true, where } = 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. Count Versions Operation.`,\n )\n }\n\n return countVersionsOperation<TSlug>({\n collection,\n disableErrors,\n overrideAccess,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n where,\n })\n}\n"],"names":["APIError","createLocalReq","countVersionsOperation","countVersionsLocal","payload","options","collection","collectionSlug","disableErrors","overrideAccess","where","collections","String","req"],"mappings":"AAIA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,sBAAsB,QAAQ,sBAAqB;AA4C5D,OAAO,eAAeC,mBACpBC,OAAgB,EAChBC,OAAoC;IAEpC,MAAM,EAAEC,YAAYC,cAAc,EAAEC,aAAa,EAAEC,iBAAiB,IAAI,EAAEC,KAAK,EAAE,GAAGL;IAEpF,MAAMC,aAAaF,QAAQO,WAAW,CAACJ,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIN,SACR,CAAC,yBAAyB,EAAEY,OAAOL,gBAAgB,0CAA0C,CAAC;IAElG;IAEA,OAAOL,uBAA8B;QACnCI;QACAE;QACAC;QACAI,KAAK,MAAMZ,eAAeI,SAAkCD;QAC5DM;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../src/collections/operations/local/countVersions.ts"],"sourcesContent":["import type { CollectionSlug, Payload, RequestContext, TypedLocale, User } from '../../../index.js'\nimport type { PayloadRequest, Where } from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { countVersionsOperation } from '../countVersions.js'\n\nexport type CountVersionsOptions<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 * When set to `true`, errors will not be thrown.\n */\n disableErrors?: boolean\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 * 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 * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: null | User\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: Where\n}\n\nexport async function countVersionsLocal<TSlug extends CollectionSlug>(\n payload: Payload,\n options: CountVersionsOptions<TSlug>,\n): Promise<{ totalDocs: number }> {\n const { collection: collectionSlug, disableErrors, overrideAccess = true, where } = 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. Count Versions Operation.`,\n )\n }\n\n return countVersionsOperation<TSlug>({\n collection,\n disableErrors,\n overrideAccess,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n where,\n })\n}\n"],"names":["APIError","createLocalReq","countVersionsOperation","countVersionsLocal","payload","options","collection","collectionSlug","disableErrors","overrideAccess","where","collections","String","req"],"mappings":"AAIA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,sBAAsB,QAAQ,sBAAqB;AA2C5D,OAAO,eAAeC,mBACpBC,OAAgB,EAChBC,OAAoC;IAEpC,MAAM,EAAEC,YAAYC,cAAc,EAAEC,aAAa,EAAEC,iBAAiB,IAAI,EAAEC,KAAK,EAAE,GAAGL;IAEpF,MAAMC,aAAaF,QAAQO,WAAW,CAACJ,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIN,SACR,CAAC,yBAAyB,EAAEY,OAAOL,gBAAgB,0CAA0C,CAAC;IAElG;IAEA,OAAOL,uBAA8B;QACnCI;QACAE;QACAC;QACAI,KAAK,MAAMZ,eAAeI,SAAkCD;QAC5DM;IACF;AACF"}
@@ -1,7 +1,7 @@
1
- import type { Document, PayloadRequest, PopulateType, SelectType, TransformCollectionWithSelect } from '../../../types/index.js';
1
+ import type { PayloadRequest, PopulateType, SelectType, TransformCollectionWithSelect } from '../../../types/index.js';
2
2
  import type { File } from '../../../uploads/types.js';
3
3
  import type { CollectionsWithoutDrafts, DataFromCollectionSlug, DraftDataFromCollectionSlug, RequiredDataFromCollectionSlug, SelectFromCollectionSlug } from '../../config/types.js';
4
- import { type CollectionSlug, type FindOptions, type GeneratedTypes, type Payload, type RequestContext, type TypedLocale } from '../../../index.js';
4
+ import { type CollectionSlug, type FindOptions, type GeneratedTypes, type Payload, type RequestContext, type TypedLocale, type User } from '../../../index.js';
5
5
  type BaseOptions<TSlug extends CollectionSlug, TSelect extends SelectType> = {
6
6
  /**
7
7
  * the Collection slug to operate against.
@@ -81,7 +81,7 @@ type BaseOptions<TSlug extends CollectionSlug, TSelect extends SelectType> = {
81
81
  /**
82
82
  * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
83
83
  */
84
- user?: Document;
84
+ user?: null | User;
85
85
  } & Pick<FindOptions<TSlug, TSelect>, 'select'>;
86
86
  export type Options<TSlug extends CollectionSlug, TSelect extends SelectType> = GeneratedTypes extends {
87
87
  strictDraftTypes: true;
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,UAAU,EACV,6BAA6B,EAC9B,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AAErD,OAAO,KAAK,EACV,wBAAwB,EACxB,sBAAsB,EACtB,2BAA2B,EAC3B,8BAA8B,EAC9B,wBAAwB,EACzB,MAAM,uBAAuB,CAAA;AAG9B,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAA;AAK1B,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,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;;OAGG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC;;OAEG;IACH,eAAe,CAAC,EAAE,sBAAsB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAA;IACrD;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IACpC;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,CAAA;IACX;;OAEG;IACH,QAAQ,CA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;;OAEG;IACH,KAAK,EAAE,IAAI,CAAA;CACZ,CACJ,GACC,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,GAE7B,CAAC;IACC;;OAEG;IACH,IAAI,EAAE,8BAA8B,CAAC,KAAK,CAAC,CAAA;IAC3C;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,GAAG,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,GAChC,CAAC;IACC;;;OAGG;IACH,IAAI,EAAE,2BAA2B,CAAC,KAAK,CAAC,CAAA;IACxC;;OAEG;IACH,KAAK,EAAE,IAAI,CAAA;CACZ,GAAG,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;AAExC,wBAAsB,WAAW,CAC/B,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,CA+CxD"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,UAAU,EACV,6BAA6B,EAC9B,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AAErD,OAAO,KAAK,EACV,wBAAwB,EACxB,sBAAsB,EACtB,2BAA2B,EAC3B,8BAA8B,EAC9B,wBAAwB,EACzB,MAAM,uBAAuB,CAAA;AAG9B,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,IAAI,EACV,MAAM,mBAAmB,CAAA;AAK1B,KAAK,WAAW,CAAC,KAAK,S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3,"sources":["../../../../src/collections/operations/local/create.ts"],"sourcesContent":["import type {\n Document,\n PayloadRequest,\n PopulateType,\n SelectType,\n TransformCollectionWithSelect,\n} from '../../../types/index.js'\nimport type { File } from '../../../uploads/types.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type {\n CollectionsWithoutDrafts,\n DataFromCollectionSlug,\n DraftDataFromCollectionSlug,\n RequiredDataFromCollectionSlug,\n SelectFromCollectionSlug,\n} from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport {\n type CollectionSlug,\n deepCopyObjectSimple,\n type FindOptions,\n type GeneratedTypes,\n type Payload,\n type RequestContext,\n type TypedLocale,\n} from '../../../index.js'\nimport { getFileByPath } from '../../../uploads/getFileByPath.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { createOperation } from '../create.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 * [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 * If creating verification-enabled auth doc,\n * you can disable the email that is auto-sent\n */\n disableVerificationEmail?: boolean\n /**\n * If you want to create a document that is a duplicate of another document\n */\n duplicateFromID?: DataFromCollectionSlug<TSlug>['id']\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: false | TypedLocale\n /**\n * A `File` object when creating a collection with `upload: true`.\n */\n file?: File\n /**\n * A file path when creating a collection with `upload: true`.\n */\n filePath?: string\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * If you are uploading a file and would like to replace\n * the existing file instead of generating a new filename,\n * you can set the following property to `true`\n */\n overwriteExistingFiles?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * Publish to all locales\n */\n publishAllLocales?: boolean\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * 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<\n TSlug extends CollectionSlug,\n TSelect extends SelectType,\n> = GeneratedTypes extends { strictDraftTypes: true }\n ? CollectionsWithoutDrafts extends TSlug\n ? {\n /**\n * The data for the document to create.\n */\n data: DataFromCollectionSlug<TSlug>\n /**\n * Create a **draft** document. [More](https://payloadcms.com/docs/versions/drafts#draft-api)\n */\n draft?: boolean\n } & BaseOptions<TSlug, TSelect>\n : TSlug extends CollectionsWithoutDrafts\n ? {\n data: RequiredDataFromCollectionSlug<TSlug>\n /**\n * The `draft` property is not allowed because this collection does not have `versions.drafts` enabled.\n */\n draft?: never\n } & BaseOptions<TSlug, TSelect>\n : (\n | {\n /**\n * The data for the document to create.\n */\n data: RequiredDataFromCollectionSlug<TSlug>\n /**\n * Create a **draft** document. [More](https://payloadcms.com/docs/versions/drafts#draft-api)\n * Omit this property or set to `false` to create a published document.\n */\n draft?: false\n }\n | {\n /**\n * The data for the document to create.\n * When creating a draft, required fields are optional as validation is skipped by default.\n */\n data: DraftDataFromCollectionSlug<TSlug>\n /**\n * Create a **draft** document. [More](https://payloadcms.com/docs/versions/drafts#draft-api)\n */\n draft: true\n }\n ) &\n BaseOptions<TSlug, TSelect>\n :\n | ({\n /**\n * The data for the document to create.\n */\n data: RequiredDataFromCollectionSlug<TSlug>\n /**\n * Create a **draft** document. [More](https://payloadcms.com/docs/versions/drafts#draft-api)\n */\n draft?: false\n } & BaseOptions<TSlug, TSelect>)\n | ({\n /**\n * The data for the document to create.\n * When creating a draft, required fields are optional as validation is skipped by default.\n */\n data: DraftDataFromCollectionSlug<TSlug>\n /**\n * Create a **draft** document. [More](https://payloadcms.com/docs/versions/drafts#draft-api)\n */\n draft: true\n } & BaseOptions<TSlug, TSelect>)\n\nexport async function createLocal<\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 collection: collectionSlug,\n data,\n depth,\n disableTransaction,\n disableVerificationEmail,\n draft,\n duplicateFromID,\n file,\n filePath,\n overrideAccess = true,\n overwriteExistingFiles = false,\n populate,\n publishAllLocales,\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(collectionSlug)} can't be found. Create Operation.`,\n )\n }\n\n const req = await createLocalReq(options as CreateLocalReqOptions, payload)\n\n req.file = file ?? (await getFileByPath(filePath!))\n\n return createOperation<TSlug, TSelect>({\n collection,\n data: deepCopyObjectSimple(data), // Ensure mutation of data in create operation hooks doesn't affect the original data\n depth,\n disableTransaction,\n disableVerificationEmail,\n draft,\n duplicateFromID,\n overrideAccess,\n overwriteExistingFiles,\n populate,\n publishAllLocales,\n req,\n select,\n showHiddenFields,\n })\n}\n"],"names":["APIError","deepCopyObjectSimple","getFileByPath","createLocalReq","createOperation","createLocal","payload","options","collection","collectionSlug","data","depth","disableTransaction","disableVerificationEmail","draft","duplicateFromID","file","filePath","overrideAccess","overwriteExistingFiles","populate","publishAllLocales","select","showHiddenFields","collections","String","req"],"mappings":"AAiBA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAEEC,oBAAoB,QAMf,oBAAmB;AAC1B,SAASC,aAAa,QAAQ,oCAAmC;AACjE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,eAAe,QAAQ,eAAc;AA4J9C,OAAO,eAAeC,YAIpBC,OAAgB,EAChBC,OAAgC;IAEhC,MAAM,EACJC,YAAYC,cAAc,EAC1BC,IAAI,EACJC,KAAK,EACLC,kBAAkB,EAClBC,wBAAwB,EACxBC,KAAK,EACLC,eAAe,EACfC,IAAI,EACJC,QAAQ,EACRC,iBAAiB,IAAI,EACrBC,yBAAyB,KAAK,EAC9BC,QAAQ,EACRC,iBAAiB,EACjBC,MAAM,EACNC,gBAAgB,EACjB,GAAGhB;IAEJ,MAAMC,aAAaF,QAAQkB,WAAW,CAACf,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIR,SACR,CAAC,yBAAyB,EAAEyB,OAAOhB,gBAAgB,kCAAkC,CAAC;IAE1F;IAEA,MAAMiB,MAAM,MAAMvB,eAAeI,SAAkCD;IAEnEoB,IAAIV,IAAI,GAAGA,QAAS,MAAMd,cAAce;IAExC,OAAOb,gBAAgC;QACrCI;QACAE,MAAMT,qBAAqBS;QAC3BC;QACAC;QACAC;QACAC;QACAC;QACAG;QACAC;QACAC;QACAC;QACAK;QACAJ;QACAC;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../src/collections/operations/local/create.ts"],"sourcesContent":["import type {\n PayloadRequest,\n PopulateType,\n SelectType,\n TransformCollectionWithSelect,\n} from '../../../types/index.js'\nimport type { File } from '../../../uploads/types.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type {\n CollectionsWithoutDrafts,\n DataFromCollectionSlug,\n DraftDataFromCollectionSlug,\n RequiredDataFromCollectionSlug,\n SelectFromCollectionSlug,\n} from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport {\n type CollectionSlug,\n deepCopyObjectSimple,\n type FindOptions,\n type GeneratedTypes,\n type Payload,\n type RequestContext,\n type TypedLocale,\n type User,\n} from '../../../index.js'\nimport { getFileByPath } from '../../../uploads/getFileByPath.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { createOperation } from '../create.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 * [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 * If creating verification-enabled auth doc,\n * you can disable the email that is auto-sent\n */\n disableVerificationEmail?: boolean\n /**\n * If you want to create a document that is a duplicate of another document\n */\n duplicateFromID?: DataFromCollectionSlug<TSlug>['id']\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: false | TypedLocale\n /**\n * A `File` object when creating a collection with `upload: true`.\n */\n file?: File\n /**\n * A file path when creating a collection with `upload: true`.\n */\n filePath?: string\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * If you are uploading a file and would like to replace\n * the existing file instead of generating a new filename,\n * you can set the following property to `true`\n */\n overwriteExistingFiles?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * Publish to all locales\n */\n publishAllLocales?: boolean\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: null | User\n} & Pick<FindOptions<TSlug, TSelect>, 'select'>\n\nexport type Options<\n TSlug extends CollectionSlug,\n TSelect extends SelectType,\n> = GeneratedTypes extends { strictDraftTypes: true }\n ? CollectionsWithoutDrafts extends TSlug\n ? {\n /**\n * The data for the document to create.\n */\n data: DataFromCollectionSlug<TSlug>\n /**\n * Create a **draft** document. [More](https://payloadcms.com/docs/versions/drafts#draft-api)\n */\n draft?: boolean\n } & BaseOptions<TSlug, TSelect>\n : TSlug extends CollectionsWithoutDrafts\n ? {\n data: RequiredDataFromCollectionSlug<TSlug>\n /**\n * The `draft` property is not allowed because this collection does not have `versions.drafts` enabled.\n */\n draft?: never\n } & BaseOptions<TSlug, TSelect>\n : (\n | {\n /**\n * The data for the document to create.\n */\n data: RequiredDataFromCollectionSlug<TSlug>\n /**\n * Create a **draft** document. [More](https://payloadcms.com/docs/versions/drafts#draft-api)\n * Omit this property or set to `false` to create a published document.\n */\n draft?: false\n }\n | {\n /**\n * The data for the document to create.\n * When creating a draft, required fields are optional as validation is skipped by default.\n */\n data: DraftDataFromCollectionSlug<TSlug>\n /**\n * Create a **draft** document. [More](https://payloadcms.com/docs/versions/drafts#draft-api)\n */\n draft: true\n }\n ) &\n BaseOptions<TSlug, TSelect>\n :\n | ({\n /**\n * The data for the document to create.\n */\n data: RequiredDataFromCollectionSlug<TSlug>\n /**\n * Create a **draft** document. [More](https://payloadcms.com/docs/versions/drafts#draft-api)\n */\n draft?: false\n } & BaseOptions<TSlug, TSelect>)\n | ({\n /**\n * The data for the document to create.\n * When creating a draft, required fields are optional as validation is skipped by default.\n */\n data: DraftDataFromCollectionSlug<TSlug>\n /**\n * Create a **draft** document. [More](https://payloadcms.com/docs/versions/drafts#draft-api)\n */\n draft: true\n } & BaseOptions<TSlug, TSelect>)\n\nexport async function createLocal<\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 collection: collectionSlug,\n data,\n depth,\n disableTransaction,\n disableVerificationEmail,\n draft,\n duplicateFromID,\n file,\n filePath,\n overrideAccess = true,\n overwriteExistingFiles = false,\n populate,\n publishAllLocales,\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(collectionSlug)} can't be found. Create Operation.`,\n )\n }\n\n const req = await createLocalReq(options as CreateLocalReqOptions, payload)\n\n req.file = file ?? (await getFileByPath(filePath!))\n\n return createOperation<TSlug, TSelect>({\n collection,\n data: deepCopyObjectSimple(data), // Ensure mutation of data in create operation hooks doesn't affect the original data\n depth,\n disableTransaction,\n disableVerificationEmail,\n draft,\n duplicateFromID,\n overrideAccess,\n overwriteExistingFiles,\n populate,\n publishAllLocales,\n req,\n select,\n showHiddenFields,\n })\n}\n"],"names":["APIError","deepCopyObjectSimple","getFileByPath","createLocalReq","createOperation","createLocal","payload","options","collection","collectionSlug","data","depth","disableTransaction","disableVerificationEmail","draft","duplicateFromID","file","filePath","overrideAccess","overwriteExistingFiles","populate","publishAllLocales","select","showHiddenFields","collections","String","req"],"mappings":"AAgBA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAEEC,oBAAoB,QAOf,oBAAmB;AAC1B,SAASC,aAAa,QAAQ,oCAAmC;AACjE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,eAAe,QAAQ,eAAc;AA2J9C,OAAO,eAAeC,YAIpBC,OAAgB,EAChBC,OAAgC;IAEhC,MAAM,EACJC,YAAYC,cAAc,EAC1BC,IAAI,EACJC,KAAK,EACLC,kBAAkB,EAClBC,wBAAwB,EACxBC,KAAK,EACLC,eAAe,EACfC,IAAI,EACJC,QAAQ,EACRC,iBAAiB,IAAI,EACrBC,yBAAyB,KAAK,EAC9BC,QAAQ,EACRC,iBAAiB,EACjBC,MAAM,EACNC,gBAAgB,EACjB,GAAGhB;IAEJ,MAAMC,aAAaF,QAAQkB,WAAW,CAACf,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIR,SACR,CAAC,yBAAyB,EAAEyB,OAAOhB,gBAAgB,kCAAkC,CAAC;IAE1F;IAEA,MAAMiB,MAAM,MAAMvB,eAAeI,SAAkCD;IAEnEoB,IAAIV,IAAI,GAAGA,QAAS,MAAMd,cAAce;IAExC,OAAOb,gBAAgC;QACrCI;QACAE,MAAMT,qBAAqBS;QAC3BC;QACAC;QACAC;QACAC;QACAC;QACAG;QACAC;QACAC;QACAC;QACAK;QACAJ;QACAC;IACF;AACF"}
@@ -1,5 +1,5 @@
1
- import type { CollectionSlug, FindOptions, Payload, RequestContext, TypedLocale } from '../../../index.js';
2
- import type { Document, PayloadRequest, PopulateType, SelectType, TransformCollectionWithSelect, Where } from '../../../types/index.js';
1
+ import type { CollectionSlug, FindOptions, Payload, RequestContext, TypedLocale, User } from '../../../index.js';
2
+ import type { PayloadRequest, PopulateType, SelectType, TransformCollectionWithSelect, Where } from '../../../types/index.js';
3
3
  import type { BulkOperationResult, SelectFromCollectionSlug } from '../../config/types.js';
4
4
  export type BaseOptions<TSlug extends CollectionSlug, TSelect extends SelectType> = {
5
5
  /**
@@ -66,7 +66,7 @@ export type BaseOptions<TSlug extends CollectionSlug, TSelect extends SelectType
66
66
  /**
67
67
  * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
68
68
  */
69
- user?: Document;
69
+ user?: null | User;
70
70
  } & Pick<FindOptions<TSlug, TSelect>, 'select'>;
71
71
  export type ByIDOptions<TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>> = {
72
72
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/delete.ts"],"names":[],"mappings":"AAAA,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,6BAA6B,EAC7B,KAAK,EACN,MAAM,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAO1F,MAAM,MAAM,WAAW,CAAC,KAAK,SAAS,cAAc,EAAE,OAAO,SAAS,UAAU,IAAI;IAClF;;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,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IACpC;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAA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Ac,EAC5B,OAAO,SAAS,wBAAwB,CAAC,KAAK,CAAC,EAE/C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,GACnC,OAAO,CAAC,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;AAC/C,iBAAe,WAAW,CACxB,KAAK,SAAS,cAAc,EAC5B,OAAO,SAAS,wBAAwB,CAAC,KAAK,CAAC,EAE/C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;AAqD/F,OAAO,EAAE,WAAW,EAAE,CAAA"}
1
+ {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/delete.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,OAAO,EACP,cAAc,EACd,WAAW,EACX,IAAI,EACL,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,UAAU,EACV,6BAA6B,EAC7B,KAAK,EACN,MAAM,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAO1F,MAAM,MAAM,WAAW,CAAC,KAAK,SAAS,cAAc,EAAE,OAAO,SAAS,UAAU,IAAI;IAClF;;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,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IACpC;;O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cAAc,EAC5B,OAAO,SAAS,wBAAwB,CAAC,KAAK,CAAC,EAE/C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,GACnC,OAAO,CAAC,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;AACzD,iBAAe,WAAW,CACxB,KAAK,SAAS,cAAc,EAC5B,OAAO,SAAS,wBAAwB,CAAC,KAAK,CAAC,EAE/C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,GACnC,OAAO,CAAC,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;AAC/C,iBAAe,WAAW,CACxB,KAAK,SAAS,cAAc,EAC5B,OAAO,SAAS,wBAAwB,CAAC,KAAK,CAAC,EAE/C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;AAqD/F,OAAO,EAAE,WAAW,EAAE,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/collections/operations/local/delete.ts"],"sourcesContent":["import 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 TransformCollectionWithSelect,\n Where,\n} from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type { BulkOperationResult, SelectFromCollectionSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { deleteOperation } from '../delete.js'\nimport { deleteByIDOperation } from '../deleteByID.js'\n\nexport type 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 * [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 * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * By default, document locks are ignored (`true`). Set to `false` to enforce locks and prevent operations when a document is locked by another user. [More details](https://payloadcms.com/docs/admin/locked-documents).\n * @default true\n */\n overrideLock?: boolean\n /**\n * 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 permanently delete both normal and trashed documents.\n * By default (`false`), only normal (non-trashed) documents will be permanently deleted.\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, TSelect>, 'select'>\n\nexport type ByIDOptions<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = {\n /**\n * The ID of the document to delete.\n */\n id: number | string\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: never\n} & BaseOptions<TSlug, TSelect>\n\nexport type ManyOptions<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = {\n /**\n * The ID of the document to delete.\n */\n id?: never\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where: Where\n} & BaseOptions<TSlug, TSelect>\n\nexport type Options<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = ByIDOptions<TSlug, TSelect> | ManyOptions<TSlug, TSelect>\n\nasync function deleteLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: ByIDOptions<TSlug, TSelect>,\n): Promise<TransformCollectionWithSelect<TSlug, TSelect>>\nasync function deleteLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: ManyOptions<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect>>\nasync function deleteLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect> | TransformCollectionWithSelect<TSlug, TSelect>>\nasync function deleteLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect> | TransformCollectionWithSelect<TSlug, TSelect>> {\n const {\n id,\n collection: collectionSlug,\n depth,\n disableTransaction,\n overrideAccess = true,\n overrideLock,\n populate,\n select,\n showHiddenFields,\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. Delete Operation.`,\n )\n }\n\n const args = {\n id,\n collection,\n depth,\n disableTransaction,\n overrideAccess,\n overrideLock,\n populate,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n select,\n showHiddenFields,\n trash,\n where,\n }\n\n if (options.id) {\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return deleteByIDOperation<TSlug, TSelect>(args)\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return deleteOperation<TSlug, TSelect>(args)\n}\n\nexport { deleteLocal }\n"],"names":["APIError","createLocalReq","deleteOperation","deleteByIDOperation","deleteLocal","payload","options","id","collection","collectionSlug","depth","disableTransaction","overrideAccess","overrideLock","populate","select","showHiddenFields","trash","where","collections","String","args","req"],"mappings":"AAkBA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,eAAe,QAAQ,eAAc;AAC9C,SAASC,mBAAmB,QAAQ,mBAAkB;AA6HtD,eAAeC,YAIbC,OAAgB,EAChBC,OAAgC;IAEhC,MAAM,EACJC,EAAE,EACFC,YAAYC,cAAc,EAC1BC,KAAK,EACLC,kBAAkB,EAClBC,iBAAiB,IAAI,EACrBC,YAAY,EACZC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EAChBC,QAAQ,KAAK,EACbC,KAAK,EACN,GAAGZ;IAEJ,MAAME,aAAaH,QAAQc,WAAW,CAACV,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIR,SACR,CAAC,yBAAyB,EAAEoB,OAAOX,gBAAgB,kCAAkC,CAAC;IAE1F;IAEA,MAAMY,OAAO;QACXd;QACAC;QACAE;QACAC;QACAC;QACAC;QACAC;QACAQ,KAAK,MAAMrB,eAAeK,SAAkCD;QAC5DU;QACAC;QACAC;QACAC;IACF;IAEA,IAAIZ,QAAQC,EAAE,EAAE;QACd,oFAAoF;QACpF,OAAOJ,oBAAoCkB;IAC7C;IACA,oFAAoF;IACpF,OAAOnB,gBAAgCmB;AACzC;AAEA,SAASjB,WAAW,GAAE"}
1
+ {"version":3,"sources":["../../../../src/collections/operations/local/delete.ts"],"sourcesContent":["import type {\n CollectionSlug,\n FindOptions,\n Payload,\n RequestContext,\n TypedLocale,\n User,\n} from '../../../index.js'\nimport type {\n PayloadRequest,\n PopulateType,\n SelectType,\n TransformCollectionWithSelect,\n Where,\n} from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type { BulkOperationResult, SelectFromCollectionSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { deleteOperation } from '../delete.js'\nimport { deleteByIDOperation } from '../deleteByID.js'\n\nexport type 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 * [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 * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * By default, document locks are ignored (`true`). Set to `false` to enforce locks and prevent operations when a document is locked by another user. [More details](https://payloadcms.com/docs/admin/locked-documents).\n * @default true\n */\n overrideLock?: boolean\n /**\n * 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 permanently delete both normal and trashed documents.\n * By default (`false`), only normal (non-trashed) documents will be permanently deleted.\n *\n * This argument has no effect unless `trash` is enabled on the collection.\n * @default false\n */\n trash?: boolean\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: null | User\n} & Pick<FindOptions<TSlug, TSelect>, 'select'>\n\nexport type ByIDOptions<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = {\n /**\n * The ID of the document to delete.\n */\n id: number | string\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: never\n} & BaseOptions<TSlug, TSelect>\n\nexport type ManyOptions<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = {\n /**\n * The ID of the document to delete.\n */\n id?: never\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where: Where\n} & BaseOptions<TSlug, TSelect>\n\nexport type Options<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = ByIDOptions<TSlug, TSelect> | ManyOptions<TSlug, TSelect>\n\nasync function deleteLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: ByIDOptions<TSlug, TSelect>,\n): Promise<TransformCollectionWithSelect<TSlug, TSelect>>\nasync function deleteLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: ManyOptions<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect>>\nasync function deleteLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect> | TransformCollectionWithSelect<TSlug, TSelect>>\nasync function deleteLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect> | TransformCollectionWithSelect<TSlug, TSelect>> {\n const {\n id,\n collection: collectionSlug,\n depth,\n disableTransaction,\n overrideAccess = true,\n overrideLock,\n populate,\n select,\n showHiddenFields,\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. Delete Operation.`,\n )\n }\n\n const args = {\n id,\n collection,\n depth,\n disableTransaction,\n overrideAccess,\n overrideLock,\n populate,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n select,\n showHiddenFields,\n trash,\n where,\n }\n\n if (options.id) {\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return deleteByIDOperation<TSlug, TSelect>(args)\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return deleteOperation<TSlug, TSelect>(args)\n}\n\nexport { deleteLocal }\n"],"names":["APIError","createLocalReq","deleteOperation","deleteByIDOperation","deleteLocal","payload","options","id","collection","collectionSlug","depth","disableTransaction","overrideAccess","overrideLock","populate","select","showHiddenFields","trash","where","collections","String","args","req"],"mappings":"AAkBA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,eAAe,QAAQ,eAAc;AAC9C,SAASC,mBAAmB,QAAQ,mBAAkB;AA4HtD,eAAeC,YAIbC,OAAgB,EAChBC,OAAgC;IAEhC,MAAM,EACJC,EAAE,EACFC,YAAYC,cAAc,EAC1BC,KAAK,EACLC,kBAAkB,EAClBC,iBAAiB,IAAI,EACrBC,YAAY,EACZC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EAChBC,QAAQ,KAAK,EACbC,KAAK,EACN,GAAGZ;IAEJ,MAAME,aAAaH,QAAQc,WAAW,CAACV,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIR,SACR,CAAC,yBAAyB,EAAEoB,OAAOX,gBAAgB,kCAAkC,CAAC;IAE1F;IAEA,MAAMY,OAAO;QACXd;QACAC;QACAE;QACAC;QACAC;QACAC;QACAC;QACAQ,KAAK,MAAMrB,eAAeK,SAAkCD;QAC5DU;QACAC;QACAC;QACAC;IACF;IAEA,IAAIZ,QAAQC,EAAE,EAAE;QACd,oFAAoF;QACpF,OAAOJ,oBAAoCkB;IAC7C;IACA,oFAAoF;IACpF,OAAOnB,gBAAgCmB;AACzC;AAEA,SAASjB,WAAW,GAAE"}
@@ -1,7 +1,7 @@
1
1
  import type { DeepPartial } from 'ts-essentials';
2
2
  import type { CollectionSlug, TypedLocale } from '../../..//index.js';
3
- import type { FindOptions, Payload, RequestContext } from '../../../index.js';
4
- import type { Document, PayloadRequest, PopulateType, SelectType, TransformCollectionWithSelect } from '../../../types/index.js';
3
+ import type { FindOptions, Payload, RequestContext, User } from '../../../index.js';
4
+ import type { PayloadRequest, PopulateType, SelectType, TransformCollectionWithSelect } from '../../../types/index.js';
5
5
  import type { DraftFlagFromCollectionSlug, RequiredDataFromCollectionSlug, SelectFromCollectionSlug } from '../../config/types.js';
6
6
  type BaseOptions<TSlug extends CollectionSlug, TSelect extends SelectType> = {
7
7
  /**
@@ -68,7 +68,7 @@ type BaseOptions<TSlug extends CollectionSlug, TSelect extends SelectType> = {
68
68
  /**
69
69
  * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
70
70
  */
71
- user?: Document;
71
+ user?: null | User;
72
72
  } & Pick<FindOptions<TSlug, TSelect>, 'select'>;
73
73
  export type Options<TSlug extends CollectionSlug, TSelect extends SelectType> = BaseOptions<TSlug, TSelect> & DraftFlagFromCollectionSlug<TSlug>;
74
74
  export declare function duplicateLocal<TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(payload: Payload, options: Options<TSlug, TSelect>): Promise<TransformCollectionWithSelect<TSlug, TSelect>>;
@@ -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,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WAAW,CACzF,KAAK,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, User } from '../../../index.js'\nimport type { PayloadRequest, PopulateType, SelectType, TransformCollectionWithSelect } 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 /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: null | User\n} & Pick<FindOptions<TSlug, TSelect>, 'select'>\n\nexport type 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":"AAYA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,kBAAkB,QAAQ,kBAAiB;AA4EpD,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,6 +1,6 @@
1
1
  import type { PaginatedDocs } from '../../../database/types.js';
2
- import type { CollectionSlug, JoinQuery, Payload, PayloadTypes, RequestContext, TypedFallbackLocale, TypedLocale } from '../../../index.js';
3
- import type { Document, DraftTransformCollectionWithSelect, PayloadRequest, PopulateType, SelectType, Sort, TransformCollectionWithSelect, Where } from '../../../types/index.js';
2
+ import type { CollectionSlug, JoinQuery, Payload, PayloadTypes, RequestContext, TypedFallbackLocale, TypedLocale, User } from '../../../index.js';
3
+ import type { DraftTransformCollectionWithSelect, PayloadRequest, PopulateType, SelectType, Sort, TransformCollectionWithSelect, Where } from '../../../types/index.js';
4
4
  import type { DraftFlagFromCollectionSlug, SelectFromCollectionSlug } from '../../config/types.js';
5
5
  type BaseFindOptions<TSlug extends CollectionSlug, TSelect extends SelectType> = {
6
6
  /**
@@ -145,7 +145,7 @@ type BaseFindOptions<TSlug extends CollectionSlug, TSelect extends SelectType> =
145
145
  /**
146
146
  * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
147
147
  */
148
- user?: Document;
148
+ user?: null | User;
149
149
  /**
150
150
  * A filter [query](https://payloadcms.com/docs/queries/overview)
151
151
  */
@@ -1 +1 @@
1
- {"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/find.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,KAAK,EACV,cAAc,EAEd,SAAS,EACT,OAAO,EACP,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,WAAW,EACZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,QAAQ,EACR,kCAAkC,EAClC,cAAc,EACd,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,6BAA6B,EAC7B,KAAK,EACN,MAAM,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EACV,2BAA2B,EAC3B,wBAAwB,EACzB,MAAM,uBAAuB,CAAA;AAM9B,KAAK,eAAe,CAAC,KAAK,SAAS,cAAc,EAAE,OAAO,SAAS,UAAU,IAAI;IAC/E;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,cAAc,CAAC,EAAE,mBAAmB,CAAA;IACpC;;OAEG;IACH,iBAAiB,CA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AAK,EAE9B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,GACxD,OAAO,CACR,aAAa,CACX,MAAM,SAAS,IAAI,GACf,YAAY,SAAS;IAAE,gBAAgB,EAAE,IAAI,CAAA;CAAE,GAC7C,kCAAkC,CAAC,KAAK,EAAE,OAAO,CAAC,GAClD,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,GAC/C,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,CAClD,CACF,CAiDA"}
1
+ {"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/find.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,OAAO,EACP,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,WAAW,EACX,IAAI,EACL,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,kCAAkC,EAClC,cAAc,EACd,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,6BAA6B,EAC7B,KAAK,EACN,MAAM,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EAAE,2BAA2B,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAMlG,KAAK,eAAe,CAAC,KAAK,SAAS,cAAc,EAAE,OAAO,SAAS,UAAU,IAAI;IAC/E;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,cAAc,CAAC,EAAE,mBAAmB,CAAA;IAC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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 JoinQuery,\n Payload,\n PayloadTypes,\n RequestContext,\n TypedFallbackLocale,\n TypedLocale,\n User,\n} from '../../../index.js'\nimport type {\n DraftTransformCollectionWithSelect,\n PayloadRequest,\n PopulateType,\n SelectType,\n Sort,\n TransformCollectionWithSelect,\n Where,\n} from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type { DraftFlagFromCollectionSlug, SelectFromCollectionSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { findOperation } from '../find.js'\n\ntype BaseFindOptions<TSlug extends CollectionSlug, TSelect extends SelectType> = {\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * The current population depth, used internally for relationships population.\n * @internal\n */\n currentDepth?: number\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * When set to `true`, errors will not be thrown.\n */\n disableErrors?: boolean\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: TypedFallbackLocale\n /**\n * Include info about the lock status to the result into all documents with fields: `_isLocked` and `_userEditing`\n */\n includeLockStatus?: boolean\n /**\n * The [Join Field Query](https://payloadcms.com/docs/fields/join#query-options).\n * Pass `false` to disable all join fields from the result.\n */\n joins?: JoinQuery<TSlug>\n /**\n * The maximum related documents to be returned.\n * Defaults unless `defaultLimit` is specified for the collection config\n * @default 10\n */\n limit?: number\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * Get a specific page number\n * @default 1\n */\n page?: number\n /**\n * Set to `false` to return all documents and avoid querying for document counts which introduces some overhead.\n * You can also combine that property with a specified `limit` to limit documents but avoid the count query.\n */\n pagination?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * By default, Payload's APIs will return all fields for a given collection or global.\n * But you may not need all of that data for all of your queries.\n * Sometimes, you might want just a few fields from the response.\n *\n * With the Select API, you can define exactly which fields you'd like to retrieve.\n * This can impact performance by reducing database load and response size.\n *\n *\n * **Example: Select specific fields**\n * ```ts\n * const post = await payload.findByID({\n * collection: 'posts',\n * id: '1',\n * select: { title: true, content: true },\n * })\n *\n * console.log(post) // { id: '1', title: 'My Post', content: 'This is my post' }\n * ```\n *\n * **Example: Select all fields except `content`**\n *\n * ```ts\n * const post = await payload.findByID({\n * collection: 'posts',\n * id: '1',\n * select: { content: false },\n * })\n *\n * console.log(post) // { id: '1', title: 'My Post', number: 3 }\n * ```\n *\n * **Example: Empty select returns only `id`**\n *\n * ```ts\n * const post = await payload.findByID({\n * collection: 'posts',\n * id: '1',\n * select: {},\n * })\n *\n * console.log(post) // { id: '1' }\n * ```\n *\n * @see https://payloadcms.com/docs/queries/select\n */\n select?: TSelect\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * Sort the documents, can be a string or an array of strings\n * @example '-createdAt' // Sort DESC by createdAt\n * @example ['group', '-createdAt'] // sort by 2 fields, ASC group and DESC createdAt\n */\n sort?: Sort\n /**\n * When set to `true`, the query will include both normal and trashed documents.\n * To query only trashed documents, pass `trash: true` and combine with a `where` clause filtering by `deletedAt`.\n * By default (`false`), the query will only include normal documents and exclude those with a `deletedAt` field.\n *\n * This argument has no effect unless `trash` is enabled on the collection.\n * @default false\n */\n trash?: boolean\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: null | User\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: Where\n}\n\nexport type Options<TSlug extends CollectionSlug, TSelect extends SelectType> = BaseFindOptions<\n TSlug,\n TSelect\n> &\n DraftFlagFromCollectionSlug<TSlug>\n\n// Backward compatibility export\nexport type FindOptions<TSlug extends CollectionSlug, TSelect extends SelectType> = Options<\n TSlug,\n TSelect\n>\n\nexport async function findLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n TDraft extends boolean = false,\n>(\n payload: Payload,\n options: { draft?: TDraft } & FindOptions<TSlug, TSelect>,\n): Promise<\n PaginatedDocs<\n TDraft extends true\n ? PayloadTypes extends { strictDraftTypes: true }\n ? DraftTransformCollectionWithSelect<TSlug, TSelect>\n : TransformCollectionWithSelect<TSlug, TSelect>\n : TransformCollectionWithSelect<TSlug, TSelect>\n >\n> {\n const {\n collection: collectionSlug,\n currentDepth,\n depth,\n disableErrors,\n draft = false,\n includeLockStatus,\n joins,\n limit,\n overrideAccess = true,\n page,\n pagination = true,\n populate,\n select,\n showHiddenFields,\n sort,\n trash = false,\n where,\n } = options\n\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(collectionSlug)} can't be found. Find Operation.`,\n )\n }\n\n return findOperation<TSlug, TSelect>({\n collection,\n currentDepth,\n depth,\n disableErrors,\n draft,\n includeLockStatus,\n joins,\n limit,\n overrideAccess,\n page,\n pagination,\n populate,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n select,\n showHiddenFields,\n sort,\n trash,\n where,\n })\n}\n"],"names":["APIError","createLocalReq","findOperation","findLocal","payload","options","collection","collectionSlug","currentDepth","depth","disableErrors","draft","includeLockStatus","joins","limit","overrideAccess","page","pagination","populate","select","showHiddenFields","sort","trash","where","collections","String","req"],"mappings":"AAuBA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,aAAa,QAAQ,aAAY;AAoK1C,OAAO,eAAeC,UAKpBC,OAAgB,EAChBC,OAAyD;IAUzD,MAAM,EACJC,YAAYC,cAAc,EAC1BC,YAAY,EACZC,KAAK,EACLC,aAAa,EACbC,QAAQ,KAAK,EACbC,iBAAiB,EACjBC,KAAK,EACLC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,IAAI,EACJC,aAAa,IAAI,EACjBC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EAChBC,IAAI,EACJC,QAAQ,KAAK,EACbC,KAAK,EACN,GAAGlB;IAEJ,MAAMC,aAAaF,QAAQoB,WAAW,CAACjB,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIN,SACR,CAAC,yBAAyB,EAAEyB,OAAOlB,gBAAgB,gCAAgC,CAAC;IAExF;IAEA,OAAOL,cAA8B;QACnCI;QACAE;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAQ,KAAK,MAAMzB,eAAeI,SAAkCD;QAC5De;QACAC;QACAC;QACAC;QACAC;IACF;AACF"}
@@ -1,5 +1,5 @@
1
- import type { CollectionSlug, FindOptions, JoinQuery, Payload, RequestContext, SelectType, TypedFallbackLocale, TypedLocale } from '../../../index.js';
2
- import type { ApplyDisableErrors, Document, PayloadRequest, PopulateType, TransformCollectionWithSelect } from '../../../types/index.js';
1
+ import type { CollectionSlug, FindOptions, JoinQuery, Payload, RequestContext, SelectType, TypedFallbackLocale, TypedLocale, User } from '../../../index.js';
2
+ import type { ApplyDisableErrors, PayloadRequest, PopulateType, TransformCollectionWithSelect } from '../../../types/index.js';
3
3
  import type { DraftFlagFromCollectionSlug, SelectFromCollectionSlug } from '../../config/types.js';
4
4
  import { type FindByIDArgs } from '../findByID.js';
5
5
  type BaseFindByIDOptions<TSlug extends CollectionSlug, TDisableErrors extends boolean, TSelect extends SelectType> = {
@@ -86,7 +86,7 @@ type BaseFindByIDOptions<TSlug extends CollectionSlug, TDisableErrors extends bo
86
86
  /**
87
87
  * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
88
88
  */
89
- user?: Document;
89
+ user?: null | User;
90
90
  } & Pick<FindByIDArgs, 'flattenLocales'> & Pick<FindOptions<TSlug, TSelect>, 'select'>;
91
91
  export type Options<TSlug extends CollectionSlug, TDisableErrors extends boolean, TSelect extends SelectType> = BaseFindByIDOptions<TSlug, TDisableErrors, TSelect> & DraftFlagFromCollectionSlug<TSlug>;
92
92
  export declare function findByIDLocal<TSlug extends CollectionSlug, TDisableErrors extends boolean, TSelect extends SelectFromCollectionSlug<TSlug>>(payload: Payload, options: Options<TSlug, TDisableErrors, TSelect>): Promise<ApplyDisableErrors<TransformCollectionWithSelect<TSlug, TSelect>, TDisableErrors>>;
@@ -1 +1 @@
1
- {"version":3,"file":"findByID.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/findByID.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,SAAS,EACT,OAAO,EACP,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,WAAW,EACZ,MAAM,mBAAmB,CAAA;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