payload 3.0.0-beta.56 → 3.0.0-beta.58

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 (394) hide show
  1. package/dist/admin/RichText.d.ts +3 -3
  2. package/dist/admin/RichText.d.ts.map +1 -1
  3. package/dist/admin/RichText.js.map +1 -1
  4. package/dist/admin/views/types.d.ts +2 -2
  5. package/dist/admin/views/types.d.ts.map +1 -1
  6. package/dist/admin/views/types.js.map +1 -1
  7. package/dist/auth/baseFields/auth.d.ts.map +1 -1
  8. package/dist/auth/baseFields/auth.js +0 -14
  9. package/dist/auth/baseFields/auth.js.map +1 -1
  10. package/dist/auth/baseFields/loginField.d.ts +4 -0
  11. package/dist/auth/baseFields/loginField.d.ts.map +1 -0
  12. package/dist/auth/baseFields/loginField.js +35 -0
  13. package/dist/auth/baseFields/loginField.js.map +1 -0
  14. package/dist/auth/defaultAccess.d.ts +2 -2
  15. package/dist/auth/defaultAccess.d.ts.map +1 -1
  16. package/dist/auth/defaultAccess.js.map +1 -1
  17. package/dist/auth/executeAccess.d.ts +2 -2
  18. package/dist/auth/executeAccess.d.ts.map +1 -1
  19. package/dist/auth/executeAccess.js.map +1 -1
  20. package/dist/auth/getAccessResults.d.ts +2 -2
  21. package/dist/auth/getAccessResults.d.ts.map +1 -1
  22. package/dist/auth/getAccessResults.js.map +1 -1
  23. package/dist/auth/getFieldsToSign.d.ts +2 -2
  24. package/dist/auth/getFieldsToSign.d.ts.map +1 -1
  25. package/dist/auth/getFieldsToSign.js.map +1 -1
  26. package/dist/auth/operations/access.d.ts +2 -2
  27. package/dist/auth/operations/access.d.ts.map +1 -1
  28. package/dist/auth/operations/access.js.map +1 -1
  29. package/dist/auth/operations/auth.d.ts +2 -2
  30. package/dist/auth/operations/auth.d.ts.map +1 -1
  31. package/dist/auth/operations/auth.js.map +1 -1
  32. package/dist/auth/operations/forgotPassword.d.ts +7 -7
  33. package/dist/auth/operations/forgotPassword.d.ts.map +1 -1
  34. package/dist/auth/operations/forgotPassword.js +11 -6
  35. package/dist/auth/operations/forgotPassword.js.map +1 -1
  36. package/dist/auth/operations/init.d.ts +2 -2
  37. package/dist/auth/operations/init.d.ts.map +1 -1
  38. package/dist/auth/operations/init.js.map +1 -1
  39. package/dist/auth/operations/local/auth.js.map +1 -1
  40. package/dist/auth/operations/local/forgotPassword.d.ts +2 -2
  41. package/dist/auth/operations/local/forgotPassword.d.ts.map +1 -1
  42. package/dist/auth/operations/local/forgotPassword.js.map +1 -1
  43. package/dist/auth/operations/local/login.d.ts +4 -7
  44. package/dist/auth/operations/local/login.d.ts.map +1 -1
  45. package/dist/auth/operations/local/login.js.map +1 -1
  46. package/dist/auth/operations/local/resetPassword.d.ts +2 -2
  47. package/dist/auth/operations/local/resetPassword.d.ts.map +1 -1
  48. package/dist/auth/operations/local/resetPassword.js.map +1 -1
  49. package/dist/auth/operations/local/unlock.d.ts +2 -2
  50. package/dist/auth/operations/local/unlock.d.ts.map +1 -1
  51. package/dist/auth/operations/local/unlock.js.map +1 -1
  52. package/dist/auth/operations/local/verifyEmail.d.ts +2 -2
  53. package/dist/auth/operations/local/verifyEmail.d.ts.map +1 -1
  54. package/dist/auth/operations/local/verifyEmail.js.map +1 -1
  55. package/dist/auth/operations/login.d.ts +6 -9
  56. package/dist/auth/operations/login.d.ts.map +1 -1
  57. package/dist/auth/operations/login.js +23 -5
  58. package/dist/auth/operations/login.js.map +1 -1
  59. package/dist/auth/operations/logout.d.ts +2 -2
  60. package/dist/auth/operations/logout.d.ts.map +1 -1
  61. package/dist/auth/operations/logout.js.map +1 -1
  62. package/dist/auth/operations/me.d.ts +2 -2
  63. package/dist/auth/operations/me.d.ts.map +1 -1
  64. package/dist/auth/operations/me.js.map +1 -1
  65. package/dist/auth/operations/refresh.d.ts +2 -2
  66. package/dist/auth/operations/refresh.d.ts.map +1 -1
  67. package/dist/auth/operations/refresh.js.map +1 -1
  68. package/dist/auth/operations/registerFirstUser.d.ts +4 -7
  69. package/dist/auth/operations/registerFirstUser.d.ts.map +1 -1
  70. package/dist/auth/operations/registerFirstUser.js.map +1 -1
  71. package/dist/auth/operations/resetPassword.d.ts +2 -2
  72. package/dist/auth/operations/resetPassword.d.ts.map +1 -1
  73. package/dist/auth/operations/resetPassword.js.map +1 -1
  74. package/dist/auth/operations/unlock.d.ts +2 -2
  75. package/dist/auth/operations/unlock.d.ts.map +1 -1
  76. package/dist/auth/operations/unlock.js.map +1 -1
  77. package/dist/auth/operations/verifyEmail.d.ts +2 -2
  78. package/dist/auth/operations/verifyEmail.d.ts.map +1 -1
  79. package/dist/auth/operations/verifyEmail.js.map +1 -1
  80. package/dist/auth/sendVerificationEmail.d.ts +2 -2
  81. package/dist/auth/sendVerificationEmail.d.ts.map +1 -1
  82. package/dist/auth/sendVerificationEmail.js.map +1 -1
  83. package/dist/auth/strategies/local/incrementLoginAttempts.d.ts +2 -2
  84. package/dist/auth/strategies/local/incrementLoginAttempts.d.ts.map +1 -1
  85. package/dist/auth/strategies/local/incrementLoginAttempts.js.map +1 -1
  86. package/dist/auth/strategies/local/register.d.ts +2 -2
  87. package/dist/auth/strategies/local/register.d.ts.map +1 -1
  88. package/dist/auth/strategies/local/register.js +10 -2
  89. package/dist/auth/strategies/local/register.js.map +1 -1
  90. package/dist/auth/strategies/local/resetLoginAttempts.d.ts +2 -2
  91. package/dist/auth/strategies/local/resetLoginAttempts.d.ts.map +1 -1
  92. package/dist/auth/strategies/local/resetLoginAttempts.js.map +1 -1
  93. package/dist/auth/types.d.ts +16 -14
  94. package/dist/auth/types.d.ts.map +1 -1
  95. package/dist/auth/types.js.map +1 -1
  96. package/dist/collections/config/client.d.ts +1 -1
  97. package/dist/collections/config/client.d.ts.map +1 -1
  98. package/dist/collections/config/defaults.d.ts +6 -5
  99. package/dist/collections/config/defaults.d.ts.map +1 -1
  100. package/dist/collections/config/defaults.js +1 -0
  101. package/dist/collections/config/defaults.js.map +1 -1
  102. package/dist/collections/config/sanitize.d.ts.map +1 -1
  103. package/dist/collections/config/sanitize.js +3 -0
  104. package/dist/collections/config/sanitize.js.map +1 -1
  105. package/dist/collections/config/schema.d.ts.map +1 -1
  106. package/dist/collections/config/schema.js +1 -0
  107. package/dist/collections/config/schema.js.map +1 -1
  108. package/dist/collections/config/types.d.ts +17 -16
  109. package/dist/collections/config/types.d.ts.map +1 -1
  110. package/dist/collections/config/types.js.map +1 -1
  111. package/dist/collections/dataloader.d.ts.map +1 -1
  112. package/dist/collections/dataloader.js +1 -1
  113. package/dist/collections/dataloader.js.map +1 -1
  114. package/dist/collections/operations/count.d.ts +2 -2
  115. package/dist/collections/operations/count.d.ts.map +1 -1
  116. package/dist/collections/operations/count.js.map +1 -1
  117. package/dist/collections/operations/create.d.ts +2 -2
  118. package/dist/collections/operations/create.d.ts.map +1 -1
  119. package/dist/collections/operations/create.js.map +1 -1
  120. package/dist/collections/operations/delete.d.ts +2 -2
  121. package/dist/collections/operations/delete.d.ts.map +1 -1
  122. package/dist/collections/operations/delete.js.map +1 -1
  123. package/dist/collections/operations/deleteByID.d.ts +2 -2
  124. package/dist/collections/operations/deleteByID.d.ts.map +1 -1
  125. package/dist/collections/operations/deleteByID.js.map +1 -1
  126. package/dist/collections/operations/docAccess.d.ts +2 -2
  127. package/dist/collections/operations/docAccess.d.ts.map +1 -1
  128. package/dist/collections/operations/docAccess.js.map +1 -1
  129. package/dist/collections/operations/duplicate.d.ts +2 -2
  130. package/dist/collections/operations/duplicate.d.ts.map +1 -1
  131. package/dist/collections/operations/duplicate.js.map +1 -1
  132. package/dist/collections/operations/find.d.ts +2 -2
  133. package/dist/collections/operations/find.d.ts.map +1 -1
  134. package/dist/collections/operations/find.js.map +1 -1
  135. package/dist/collections/operations/findByID.d.ts +2 -2
  136. package/dist/collections/operations/findByID.d.ts.map +1 -1
  137. package/dist/collections/operations/findByID.js.map +1 -1
  138. package/dist/collections/operations/findVersionByID.d.ts +2 -2
  139. package/dist/collections/operations/findVersionByID.d.ts.map +1 -1
  140. package/dist/collections/operations/findVersionByID.js.map +1 -1
  141. package/dist/collections/operations/findVersions.d.ts +2 -2
  142. package/dist/collections/operations/findVersions.d.ts.map +1 -1
  143. package/dist/collections/operations/findVersions.js.map +1 -1
  144. package/dist/collections/operations/local/count.d.ts +2 -2
  145. package/dist/collections/operations/local/count.d.ts.map +1 -1
  146. package/dist/collections/operations/local/count.js.map +1 -1
  147. package/dist/collections/operations/local/create.d.ts +2 -2
  148. package/dist/collections/operations/local/create.d.ts.map +1 -1
  149. package/dist/collections/operations/local/create.js.map +1 -1
  150. package/dist/collections/operations/local/delete.d.ts +2 -2
  151. package/dist/collections/operations/local/delete.d.ts.map +1 -1
  152. package/dist/collections/operations/local/delete.js.map +1 -1
  153. package/dist/collections/operations/local/duplicate.d.ts +2 -2
  154. package/dist/collections/operations/local/duplicate.d.ts.map +1 -1
  155. package/dist/collections/operations/local/duplicate.js.map +1 -1
  156. package/dist/collections/operations/local/find.d.ts +2 -2
  157. package/dist/collections/operations/local/find.d.ts.map +1 -1
  158. package/dist/collections/operations/local/find.js.map +1 -1
  159. package/dist/collections/operations/local/findByID.d.ts +2 -2
  160. package/dist/collections/operations/local/findByID.d.ts.map +1 -1
  161. package/dist/collections/operations/local/findByID.js.map +1 -1
  162. package/dist/collections/operations/local/findVersionByID.d.ts +2 -2
  163. package/dist/collections/operations/local/findVersionByID.d.ts.map +1 -1
  164. package/dist/collections/operations/local/findVersionByID.js.map +1 -1
  165. package/dist/collections/operations/local/findVersions.d.ts +2 -2
  166. package/dist/collections/operations/local/findVersions.d.ts.map +1 -1
  167. package/dist/collections/operations/local/findVersions.js.map +1 -1
  168. package/dist/collections/operations/local/restoreVersion.d.ts +2 -2
  169. package/dist/collections/operations/local/restoreVersion.d.ts.map +1 -1
  170. package/dist/collections/operations/local/restoreVersion.js.map +1 -1
  171. package/dist/collections/operations/local/update.d.ts +2 -2
  172. package/dist/collections/operations/local/update.d.ts.map +1 -1
  173. package/dist/collections/operations/local/update.js.map +1 -1
  174. package/dist/collections/operations/restoreVersion.d.ts +2 -2
  175. package/dist/collections/operations/restoreVersion.d.ts.map +1 -1
  176. package/dist/collections/operations/restoreVersion.js.map +1 -1
  177. package/dist/collections/operations/update.d.ts +2 -2
  178. package/dist/collections/operations/update.d.ts.map +1 -1
  179. package/dist/collections/operations/update.js.map +1 -1
  180. package/dist/collections/operations/updateByID.d.ts +2 -2
  181. package/dist/collections/operations/updateByID.d.ts.map +1 -1
  182. package/dist/collections/operations/updateByID.js.map +1 -1
  183. package/dist/collections/operations/utils.d.ts +2 -2
  184. package/dist/collections/operations/utils.d.ts.map +1 -1
  185. package/dist/collections/operations/utils.js.map +1 -1
  186. package/dist/config/schema.d.ts.map +1 -1
  187. package/dist/config/schema.js +4 -2
  188. package/dist/config/schema.js.map +1 -1
  189. package/dist/config/types.d.ts +14 -4
  190. package/dist/config/types.d.ts.map +1 -1
  191. package/dist/config/types.js.map +1 -1
  192. package/dist/database/migrations/migrate.js.map +1 -1
  193. package/dist/database/migrations/migrateDown.js.map +1 -1
  194. package/dist/database/migrations/migrateRefresh.js.map +1 -1
  195. package/dist/database/migrations/migrateReset.js.map +1 -1
  196. package/dist/database/queryValidation/validateQueryPaths.d.ts +2 -2
  197. package/dist/database/queryValidation/validateQueryPaths.d.ts.map +1 -1
  198. package/dist/database/queryValidation/validateQueryPaths.js +3 -3
  199. package/dist/database/queryValidation/validateQueryPaths.js.map +1 -1
  200. package/dist/database/queryValidation/validateSearchParams.d.ts +2 -2
  201. package/dist/database/queryValidation/validateSearchParams.d.ts.map +1 -1
  202. package/dist/database/queryValidation/validateSearchParams.js.map +1 -1
  203. package/dist/database/types.d.ts +20 -20
  204. package/dist/database/types.d.ts.map +1 -1
  205. package/dist/database/types.js.map +1 -1
  206. package/dist/errors/AuthenticationError.d.ts +1 -1
  207. package/dist/errors/AuthenticationError.d.ts.map +1 -1
  208. package/dist/errors/AuthenticationError.js +2 -2
  209. package/dist/errors/AuthenticationError.js.map +1 -1
  210. package/dist/fields/config/client.d.ts +84 -2
  211. package/dist/fields/config/client.d.ts.map +1 -1
  212. package/dist/fields/config/client.js +2 -1
  213. package/dist/fields/config/client.js.map +1 -1
  214. package/dist/fields/config/schema.d.ts.map +1 -1
  215. package/dist/fields/config/schema.js +1 -0
  216. package/dist/fields/config/schema.js.map +1 -1
  217. package/dist/fields/config/types.d.ts +19 -7
  218. package/dist/fields/config/types.d.ts.map +1 -1
  219. package/dist/fields/config/types.js.map +1 -1
  220. package/dist/fields/getDefaultValue.d.ts +2 -2
  221. package/dist/fields/getDefaultValue.d.ts.map +1 -1
  222. package/dist/fields/getDefaultValue.js.map +1 -1
  223. package/dist/fields/hooks/afterChange/index.d.ts +2 -2
  224. package/dist/fields/hooks/afterChange/index.d.ts.map +1 -1
  225. package/dist/fields/hooks/afterChange/index.js.map +1 -1
  226. package/dist/fields/hooks/afterChange/promise.d.ts +2 -2
  227. package/dist/fields/hooks/afterChange/promise.d.ts.map +1 -1
  228. package/dist/fields/hooks/afterChange/promise.js.map +1 -1
  229. package/dist/fields/hooks/afterChange/traverseFields.d.ts +2 -2
  230. package/dist/fields/hooks/afterChange/traverseFields.d.ts.map +1 -1
  231. package/dist/fields/hooks/afterChange/traverseFields.js.map +1 -1
  232. package/dist/fields/hooks/afterRead/index.d.ts +2 -2
  233. package/dist/fields/hooks/afterRead/index.d.ts.map +1 -1
  234. package/dist/fields/hooks/afterRead/index.js.map +1 -1
  235. package/dist/fields/hooks/afterRead/promise.d.ts +2 -2
  236. package/dist/fields/hooks/afterRead/promise.d.ts.map +1 -1
  237. package/dist/fields/hooks/afterRead/promise.js.map +1 -1
  238. package/dist/fields/hooks/afterRead/relationshipPopulationPromise.d.ts +2 -2
  239. package/dist/fields/hooks/afterRead/relationshipPopulationPromise.d.ts.map +1 -1
  240. package/dist/fields/hooks/afterRead/relationshipPopulationPromise.js.map +1 -1
  241. package/dist/fields/hooks/afterRead/traverseFields.d.ts +2 -2
  242. package/dist/fields/hooks/afterRead/traverseFields.d.ts.map +1 -1
  243. package/dist/fields/hooks/afterRead/traverseFields.js.map +1 -1
  244. package/dist/fields/hooks/beforeChange/index.d.ts +2 -2
  245. package/dist/fields/hooks/beforeChange/index.d.ts.map +1 -1
  246. package/dist/fields/hooks/beforeChange/index.js.map +1 -1
  247. package/dist/fields/hooks/beforeChange/promise.d.ts +2 -2
  248. package/dist/fields/hooks/beforeChange/promise.d.ts.map +1 -1
  249. package/dist/fields/hooks/beforeChange/promise.js.map +1 -1
  250. package/dist/fields/hooks/beforeChange/traverseFields.d.ts +2 -2
  251. package/dist/fields/hooks/beforeChange/traverseFields.d.ts.map +1 -1
  252. package/dist/fields/hooks/beforeChange/traverseFields.js.map +1 -1
  253. package/dist/fields/hooks/beforeValidate/index.d.ts +2 -2
  254. package/dist/fields/hooks/beforeValidate/index.d.ts.map +1 -1
  255. package/dist/fields/hooks/beforeValidate/index.js.map +1 -1
  256. package/dist/fields/hooks/beforeValidate/promise.d.ts +2 -2
  257. package/dist/fields/hooks/beforeValidate/promise.d.ts.map +1 -1
  258. package/dist/fields/hooks/beforeValidate/promise.js.map +1 -1
  259. package/dist/fields/hooks/beforeValidate/traverseFields.d.ts +2 -2
  260. package/dist/fields/hooks/beforeValidate/traverseFields.d.ts.map +1 -1
  261. package/dist/fields/hooks/beforeValidate/traverseFields.js.map +1 -1
  262. package/dist/fields/validations.d.ts +5 -1
  263. package/dist/fields/validations.d.ts.map +1 -1
  264. package/dist/globals/config/types.d.ts +7 -7
  265. package/dist/globals/config/types.d.ts.map +1 -1
  266. package/dist/globals/config/types.js.map +1 -1
  267. package/dist/globals/operations/docAccess.d.ts +2 -2
  268. package/dist/globals/operations/docAccess.d.ts.map +1 -1
  269. package/dist/globals/operations/docAccess.js.map +1 -1
  270. package/dist/globals/operations/findOne.d.ts +2 -2
  271. package/dist/globals/operations/findOne.d.ts.map +1 -1
  272. package/dist/globals/operations/findOne.js.map +1 -1
  273. package/dist/globals/operations/findVersionByID.d.ts +2 -2
  274. package/dist/globals/operations/findVersionByID.d.ts.map +1 -1
  275. package/dist/globals/operations/findVersionByID.js.map +1 -1
  276. package/dist/globals/operations/findVersions.d.ts +2 -2
  277. package/dist/globals/operations/findVersions.d.ts.map +1 -1
  278. package/dist/globals/operations/findVersions.js.map +1 -1
  279. package/dist/globals/operations/local/findOne.d.ts +2 -2
  280. package/dist/globals/operations/local/findOne.d.ts.map +1 -1
  281. package/dist/globals/operations/local/findOne.js.map +1 -1
  282. package/dist/globals/operations/local/findVersionByID.d.ts +2 -2
  283. package/dist/globals/operations/local/findVersionByID.d.ts.map +1 -1
  284. package/dist/globals/operations/local/findVersionByID.js.map +1 -1
  285. package/dist/globals/operations/local/findVersions.d.ts +2 -2
  286. package/dist/globals/operations/local/findVersions.d.ts.map +1 -1
  287. package/dist/globals/operations/local/findVersions.js.map +1 -1
  288. package/dist/globals/operations/local/restoreVersion.d.ts +2 -2
  289. package/dist/globals/operations/local/restoreVersion.d.ts.map +1 -1
  290. package/dist/globals/operations/local/restoreVersion.js.map +1 -1
  291. package/dist/globals/operations/local/update.d.ts +2 -2
  292. package/dist/globals/operations/local/update.d.ts.map +1 -1
  293. package/dist/globals/operations/local/update.js.map +1 -1
  294. package/dist/globals/operations/restoreVersion.d.ts +2 -2
  295. package/dist/globals/operations/restoreVersion.d.ts.map +1 -1
  296. package/dist/globals/operations/restoreVersion.js.map +1 -1
  297. package/dist/globals/operations/update.d.ts +2 -2
  298. package/dist/globals/operations/update.d.ts.map +1 -1
  299. package/dist/globals/operations/update.js.map +1 -1
  300. package/dist/index.d.ts +21 -1
  301. package/dist/index.d.ts.map +1 -1
  302. package/dist/index.js +2 -0
  303. package/dist/index.js.map +1 -1
  304. package/dist/preferences/deleteUserPreferences.d.ts +2 -2
  305. package/dist/preferences/deleteUserPreferences.d.ts.map +1 -1
  306. package/dist/preferences/deleteUserPreferences.js.map +1 -1
  307. package/dist/preferences/requestHandlers/delete.js.map +1 -1
  308. package/dist/preferences/requestHandlers/findOne.js.map +1 -1
  309. package/dist/preferences/requestHandlers/update.js.map +1 -1
  310. package/dist/preferences/types.d.ts +3 -3
  311. package/dist/preferences/types.d.ts.map +1 -1
  312. package/dist/preferences/types.js.map +1 -1
  313. package/dist/types/index.d.ts +14 -5
  314. package/dist/types/index.d.ts.map +1 -1
  315. package/dist/types/index.js.map +1 -1
  316. package/dist/uploads/deleteAssociatedFiles.d.ts +2 -2
  317. package/dist/uploads/deleteAssociatedFiles.d.ts.map +1 -1
  318. package/dist/uploads/deleteAssociatedFiles.js.map +1 -1
  319. package/dist/uploads/docWithFilenameExists.d.ts +2 -2
  320. package/dist/uploads/docWithFilenameExists.d.ts.map +1 -1
  321. package/dist/uploads/docWithFilenameExists.js.map +1 -1
  322. package/dist/uploads/generateFileData.d.ts +2 -2
  323. package/dist/uploads/generateFileData.d.ts.map +1 -1
  324. package/dist/uploads/generateFileData.js.map +1 -1
  325. package/dist/uploads/getExternalFile.d.ts +2 -2
  326. package/dist/uploads/getExternalFile.d.ts.map +1 -1
  327. package/dist/uploads/getExternalFile.js.map +1 -1
  328. package/dist/uploads/getFileByPath.d.ts +2 -2
  329. package/dist/uploads/getFileByPath.d.ts.map +1 -1
  330. package/dist/uploads/getFileByPath.js.map +1 -1
  331. package/dist/uploads/getImageSize.d.ts +2 -2
  332. package/dist/uploads/getImageSize.d.ts.map +1 -1
  333. package/dist/uploads/getImageSize.js.map +1 -1
  334. package/dist/uploads/getSafeFilename.d.ts +2 -2
  335. package/dist/uploads/getSafeFilename.d.ts.map +1 -1
  336. package/dist/uploads/getSafeFilename.js.map +1 -1
  337. package/dist/uploads/imageResizer.d.ts +3 -3
  338. package/dist/uploads/imageResizer.d.ts.map +1 -1
  339. package/dist/uploads/imageResizer.js.map +1 -1
  340. package/dist/uploads/types.d.ts +2 -2
  341. package/dist/uploads/types.d.ts.map +1 -1
  342. package/dist/uploads/types.js.map +1 -1
  343. package/dist/uploads/unlinkTempFiles.d.ts +2 -2
  344. package/dist/uploads/unlinkTempFiles.d.ts.map +1 -1
  345. package/dist/uploads/unlinkTempFiles.js.map +1 -1
  346. package/dist/uploads/uploadFiles.d.ts +2 -2
  347. package/dist/uploads/uploadFiles.d.ts.map +1 -1
  348. package/dist/uploads/uploadFiles.js.map +1 -1
  349. package/dist/utilities/commitTransaction.d.ts +2 -2
  350. package/dist/utilities/commitTransaction.d.ts.map +1 -1
  351. package/dist/utilities/commitTransaction.js.map +1 -1
  352. package/dist/utilities/configToJSONSchema.d.ts +1 -0
  353. package/dist/utilities/configToJSONSchema.d.ts.map +1 -1
  354. package/dist/utilities/configToJSONSchema.js +104 -4
  355. package/dist/utilities/configToJSONSchema.js.map +1 -1
  356. package/dist/utilities/configToJSONSchema.spec.js +58 -0
  357. package/dist/utilities/configToJSONSchema.spec.js.map +1 -1
  358. package/dist/utilities/createLocalReq.d.ts +3 -3
  359. package/dist/utilities/createLocalReq.d.ts.map +1 -1
  360. package/dist/utilities/createLocalReq.js.map +1 -1
  361. package/dist/utilities/getEntityPolicies.d.ts +2 -2
  362. package/dist/utilities/getEntityPolicies.d.ts.map +1 -1
  363. package/dist/utilities/getEntityPolicies.js.map +1 -1
  364. package/dist/utilities/initTransaction.d.ts +2 -2
  365. package/dist/utilities/initTransaction.d.ts.map +1 -1
  366. package/dist/utilities/initTransaction.js.map +1 -1
  367. package/dist/utilities/isEntityHidden.d.ts +2 -2
  368. package/dist/utilities/isEntityHidden.d.ts.map +1 -1
  369. package/dist/utilities/isEntityHidden.js.map +1 -1
  370. package/dist/utilities/killTransaction.d.ts +2 -2
  371. package/dist/utilities/killTransaction.d.ts.map +1 -1
  372. package/dist/utilities/killTransaction.js.map +1 -1
  373. package/dist/utilities/telemetry/events/adminInit.d.ts +2 -2
  374. package/dist/utilities/telemetry/events/adminInit.d.ts.map +1 -1
  375. package/dist/utilities/telemetry/events/adminInit.js.map +1 -1
  376. package/dist/versions/deleteCollectionVersions.d.ts +2 -2
  377. package/dist/versions/deleteCollectionVersions.d.ts.map +1 -1
  378. package/dist/versions/deleteCollectionVersions.js.map +1 -1
  379. package/dist/versions/drafts/replaceWithDraftIfAvailable.d.ts +2 -2
  380. package/dist/versions/drafts/replaceWithDraftIfAvailable.d.ts.map +1 -1
  381. package/dist/versions/drafts/replaceWithDraftIfAvailable.js.map +1 -1
  382. package/dist/versions/enforceMaxVersions.d.ts +2 -2
  383. package/dist/versions/enforceMaxVersions.d.ts.map +1 -1
  384. package/dist/versions/enforceMaxVersions.js.map +1 -1
  385. package/dist/versions/getLatestCollectionVersion.d.ts +2 -2
  386. package/dist/versions/getLatestCollectionVersion.d.ts.map +1 -1
  387. package/dist/versions/getLatestCollectionVersion.js.map +1 -1
  388. package/dist/versions/getLatestGlobalVersion.d.ts +2 -2
  389. package/dist/versions/getLatestGlobalVersion.d.ts.map +1 -1
  390. package/dist/versions/getLatestGlobalVersion.js.map +1 -1
  391. package/dist/versions/saveVersion.d.ts +2 -2
  392. package/dist/versions/saveVersion.d.ts.map +1 -1
  393. package/dist/versions/saveVersion.js.map +1 -1
  394. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/fields/hooks/beforeValidate/index.ts"],"sourcesContent":["import type { SanitizedCollectionConfig } from '../../../collections/config/types.js'\nimport type { SanitizedGlobalConfig } from '../../../globals/config/types.js'\nimport type { PayloadRequestWithData, RequestContext } from '../../../types/index.js'\n\nimport { deepCopyObject } from '../../../utilities/deepCopyObject.js'\nimport { traverseFields } from './traverseFields.js'\n\ntype Args<T> = {\n collection: SanitizedCollectionConfig | null\n context: RequestContext\n data: Record<string, unknown> | T\n doc?: Record<string, unknown> | T\n duplicate?: boolean\n global: SanitizedGlobalConfig | null\n id?: number | string\n operation: 'create' | 'update'\n overrideAccess: boolean\n req: PayloadRequestWithData\n}\n\n/**\n * This function is responsible for the following actions, in order:\n * - Sanitize incoming data\n * - Execute field hooks\n * - Execute field access control\n * - Merge original document data into incoming data\n * - Compute default values for undefined fields\n */\nexport const beforeValidate = async <T extends Record<string, unknown>>({\n id,\n collection,\n context,\n data: incomingData,\n doc,\n global,\n operation,\n overrideAccess,\n req,\n}: Args<T>): Promise<T> => {\n const data = deepCopyObject(incomingData)\n\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: collection?.fields || global?.fields,\n global,\n operation,\n overrideAccess,\n path: [],\n req,\n schemaPath: [],\n siblingData: data,\n siblingDoc: doc,\n })\n\n return data\n}\n"],"names":["deepCopyObject","traverseFields","beforeValidate","id","collection","context","data","incomingData","doc","global","operation","overrideAccess","req","fields","path","schemaPath","siblingData","siblingDoc"],"mappings":"AAIA,SAASA,cAAc,QAAQ,uCAAsC;AACrE,SAASC,cAAc,QAAQ,sBAAqB;AAepD;;;;;;;CAOC,GACD,OAAO,MAAMC,iBAAiB,OAA0C,EACtEC,EAAE,EACFC,UAAU,EACVC,OAAO,EACPC,MAAMC,YAAY,EAClBC,GAAG,EACHC,MAAM,EACNC,SAAS,EACTC,cAAc,EACdC,GAAG,EACK;IACR,MAAMN,OAAON,eAAeO;IAE5B,MAAMN,eAAe;QACnBE;QACAC;QACAC;QACAC;QACAE;QACAK,QAAQT,YAAYS,UAAUJ,QAAQI;QACtCJ;QACAC;QACAC;QACAG,MAAM,EAAE;QACRF;QACAG,YAAY,EAAE;QACdC,aAAaV;QACbW,YAAYT;IACd;IAEA,OAAOF;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../../src/fields/hooks/beforeValidate/index.ts"],"sourcesContent":["import type { SanitizedCollectionConfig } from '../../../collections/config/types.js'\nimport type { SanitizedGlobalConfig } from '../../../globals/config/types.js'\nimport type { PayloadRequest, RequestContext } from '../../../types/index.js'\n\nimport { deepCopyObject } from '../../../utilities/deepCopyObject.js'\nimport { traverseFields } from './traverseFields.js'\n\ntype Args<T> = {\n collection: SanitizedCollectionConfig | null\n context: RequestContext\n data: Record<string, unknown> | T\n doc?: Record<string, unknown> | T\n duplicate?: boolean\n global: SanitizedGlobalConfig | null\n id?: number | string\n operation: 'create' | 'update'\n overrideAccess: boolean\n req: PayloadRequest\n}\n\n/**\n * This function is responsible for the following actions, in order:\n * - Sanitize incoming data\n * - Execute field hooks\n * - Execute field access control\n * - Merge original document data into incoming data\n * - Compute default values for undefined fields\n */\nexport const beforeValidate = async <T extends Record<string, unknown>>({\n id,\n collection,\n context,\n data: incomingData,\n doc,\n global,\n operation,\n overrideAccess,\n req,\n}: Args<T>): Promise<T> => {\n const data = deepCopyObject(incomingData)\n\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: collection?.fields || global?.fields,\n global,\n operation,\n overrideAccess,\n path: [],\n req,\n schemaPath: [],\n siblingData: data,\n siblingDoc: doc,\n })\n\n return data\n}\n"],"names":["deepCopyObject","traverseFields","beforeValidate","id","collection","context","data","incomingData","doc","global","operation","overrideAccess","req","fields","path","schemaPath","siblingData","siblingDoc"],"mappings":"AAIA,SAASA,cAAc,QAAQ,uCAAsC;AACrE,SAASC,cAAc,QAAQ,sBAAqB;AAepD;;;;;;;CAOC,GACD,OAAO,MAAMC,iBAAiB,OAA0C,EACtEC,EAAE,EACFC,UAAU,EACVC,OAAO,EACPC,MAAMC,YAAY,EAClBC,GAAG,EACHC,MAAM,EACNC,SAAS,EACTC,cAAc,EACdC,GAAG,EACK;IACR,MAAMN,OAAON,eAAeO;IAE5B,MAAMN,eAAe;QACnBE;QACAC;QACAC;QACAC;QACAE;QACAK,QAAQT,YAAYS,UAAUJ,QAAQI;QACtCJ;QACAC;QACAC;QACAG,MAAM,EAAE;QACRF;QACAG,YAAY,EAAE;QACdC,aAAaV;QACbW,YAAYT;IACd;IAEA,OAAOF;AACT,EAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { SanitizedCollectionConfig } from '../../../collections/config/types.js';
2
2
  import type { SanitizedGlobalConfig } from '../../../globals/config/types.js';
3
- import type { PayloadRequestWithData, RequestContext } from '../../../types/index.js';
3
+ import type { PayloadRequest, RequestContext } from '../../../types/index.js';
4
4
  import type { Field, TabAsField } from '../../config/types.js';
5
5
  type Args<T> = {
6
6
  collection: SanitizedCollectionConfig | null;
@@ -17,7 +17,7 @@ type Args<T> = {
17
17
  overrideAccess: boolean;
18
18
  parentPath: (number | string)[];
19
19
  parentSchemaPath: string[];
20
- req: PayloadRequestWithData;
20
+ req: PayloadRequest;
21
21
  siblingData: Record<string, unknown>;
22
22
  /**
23
23
  * The original siblingData (not modified by any hooks)
@@ -1 +1 @@
1
- {"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../../../../src/fields/hooks/beforeValidate/promise.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AACrF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AAC7E,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACrF,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAU9D,KAAK,IAAI,CAAC,CAAC,IAAI;IACb,UAAU,EAAE,yBAAyB,GAAG,IAAI,CAAA;IAC5C,OAAO,EAAE,cAAc,CAAA;IACvB,IAAI,EAAE,CAAC,CAAA;IACP;;OAEG;IACH,GAAG,EAAE,CAAC,CAAA;IACN,KAAK,EAAE,KAAK,GAAG,UAAU,CAAA;IACzB,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAAA;IACpC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,SAAS,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC9B,cAAc,EAAE,OAAO,CAAA;IACvB,UAAU,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IAC/B,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,GAAG,EAAE,sBAAsB,CAAA;IAC3B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACpC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACp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AA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/fields/hooks/beforeValidate/promise.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport type { RichTextAdapter } from '../../../admin/RichText.js'\nimport type { SanitizedCollectionConfig } from '../../../collections/config/types.js'\nimport type { SanitizedGlobalConfig } from '../../../globals/config/types.js'\nimport type { PayloadRequestWithData, RequestContext } from '../../../types/index.js'\nimport type { Field, TabAsField } from '../../config/types.js'\n\nimport { MissingEditorProp } from '../../../errors/index.js'\nimport { fieldAffectsData, tabHasName, valueIsValueWithRelation } from '../../config/types.js'\nimport getValueWithDefault from '../../getDefaultValue.js'\nimport { getFieldPaths } from '../../getFieldPaths.js'\nimport { cloneDataFromOriginalDoc } from '../beforeChange/cloneDataFromOriginalDoc.js'\nimport { getExistingRowDoc } from '../beforeChange/getExistingRowDoc.js'\nimport { traverseFields } from './traverseFields.js'\n\ntype Args<T> = {\n collection: SanitizedCollectionConfig | null\n context: RequestContext\n data: T\n /**\n * The original data (not modified by any hooks)\n */\n doc: T\n field: Field | TabAsField\n global: SanitizedGlobalConfig | null\n id?: number | string\n operation: 'create' | 'update'\n overrideAccess: boolean\n parentPath: (number | string)[]\n parentSchemaPath: string[]\n req: PayloadRequestWithData\n siblingData: Record<string, unknown>\n /**\n * The original siblingData (not modified by any hooks)\n */\n siblingDoc: Record<string, unknown>\n}\n\n// This function is responsible for the following actions, in order:\n// - Sanitize incoming data\n// - Execute field hooks\n// - Execute field access control\n// - Merge original document data into incoming data\n// - Compute default values for undefined fields\n\nexport const promise = async <T>({\n id,\n collection,\n context,\n data,\n doc,\n field,\n global,\n operation,\n overrideAccess,\n parentPath,\n parentSchemaPath,\n req,\n siblingData,\n siblingDoc,\n}: Args<T>): Promise<void> => {\n const { path: fieldPath, schemaPath: fieldSchemaPath } = getFieldPaths({\n field,\n parentPath,\n parentSchemaPath,\n })\n\n if (fieldAffectsData(field)) {\n if (field.name === 'id') {\n if (field.type === 'number' && typeof siblingData[field.name] === 'string') {\n const value = siblingData[field.name] as string\n\n siblingData[field.name] = parseFloat(value)\n }\n\n if (\n field.type === 'text' &&\n typeof siblingData[field.name]?.toString === 'function' &&\n typeof siblingData[field.name] !== 'string'\n ) {\n siblingData[field.name] = siblingData[field.name].toString()\n }\n }\n\n // Sanitize incoming data\n switch (field.type) {\n case 'number': {\n if (typeof siblingData[field.name] === 'string') {\n const value = siblingData[field.name] as string\n const trimmed = value.trim()\n siblingData[field.name] = trimmed.length === 0 ? null : parseFloat(trimmed)\n }\n\n break\n }\n\n case 'point': {\n if (Array.isArray(siblingData[field.name])) {\n siblingData[field.name] = (siblingData[field.name] as string[]).map((coordinate, i) => {\n if (typeof coordinate === 'string') {\n const value = siblingData[field.name][i] as string\n const trimmed = value.trim()\n return trimmed.length === 0 ? null : parseFloat(trimmed)\n }\n return coordinate\n })\n }\n\n break\n }\n\n case 'checkbox': {\n if (siblingData[field.name] === 'true') siblingData[field.name] = true\n if (siblingData[field.name] === 'false') siblingData[field.name] = false\n if (siblingData[field.name] === '') siblingData[field.name] = false\n\n break\n }\n\n case 'richText': {\n if (typeof siblingData[field.name] === 'string') {\n try {\n const richTextJSON = JSON.parse(siblingData[field.name] as string)\n siblingData[field.name] = richTextJSON\n } catch {\n // Disregard this data as it is not valid.\n // Will be reported to user by field validation\n }\n }\n\n break\n }\n\n case 'relationship':\n case 'upload': {\n if (\n siblingData[field.name] === '' ||\n siblingData[field.name] === 'none' ||\n siblingData[field.name] === 'null' ||\n siblingData[field.name] === null\n ) {\n if (field.type === 'relationship' && field.hasMany === true) {\n siblingData[field.name] = []\n } else {\n siblingData[field.name] = null\n }\n }\n\n const value = siblingData[field.name]\n\n if (Array.isArray(field.relationTo)) {\n if (Array.isArray(value)) {\n value.forEach((relatedDoc: { relationTo: string; value: unknown }, i) => {\n const relatedCollection = req.payload.config.collections.find(\n (collection) => collection.slug === relatedDoc.relationTo,\n )\n const relationshipIDField = relatedCollection.fields.find(\n (collectionField) =>\n fieldAffectsData(collectionField) && collectionField.name === 'id',\n )\n if (relationshipIDField?.type === 'number') {\n siblingData[field.name][i] = {\n ...relatedDoc,\n value: parseFloat(relatedDoc.value as string),\n }\n }\n })\n }\n if (\n field.type === 'relationship' &&\n field.hasMany !== true &&\n valueIsValueWithRelation(value)\n ) {\n const relatedCollection = req.payload.config.collections.find(\n (collection) => collection.slug === value.relationTo,\n )\n const relationshipIDField = relatedCollection.fields.find(\n (collectionField) =>\n fieldAffectsData(collectionField) && collectionField.name === 'id',\n )\n if (relationshipIDField?.type === 'number') {\n siblingData[field.name] = { ...value, value: parseFloat(value.value as string) }\n }\n }\n } else {\n if (Array.isArray(value)) {\n value.forEach((relatedDoc: unknown, i) => {\n const relatedCollection = req.payload.config.collections.find(\n (collection) => collection.slug === field.relationTo,\n )\n const relationshipIDField = relatedCollection.fields.find(\n (collectionField) =>\n fieldAffectsData(collectionField) && collectionField.name === 'id',\n )\n if (relationshipIDField?.type === 'number') {\n siblingData[field.name][i] = parseFloat(relatedDoc as string)\n }\n })\n }\n if (field.type === 'relationship' && field.hasMany !== true && value) {\n const relatedCollection = req.payload.config.collections.find(\n (collection) => collection.slug === field.relationTo,\n )\n const relationshipIDField = relatedCollection.fields.find(\n (collectionField) =>\n fieldAffectsData(collectionField) && collectionField.name === 'id',\n )\n if (relationshipIDField?.type === 'number') {\n siblingData[field.name] = parseFloat(value as string)\n }\n }\n }\n break\n }\n\n case 'array':\n case 'blocks': {\n // Handle cases of arrays being intentionally set to 0\n if (siblingData[field.name] === '0' || siblingData[field.name] === 0) {\n siblingData[field.name] = []\n }\n\n break\n }\n\n default: {\n break\n }\n }\n\n // Execute hooks\n if (field.hooks?.beforeValidate) {\n await field.hooks.beforeValidate.reduce(async (priorHook, currentHook) => {\n await priorHook\n\n const hookedValue = await currentHook({\n collection,\n context,\n data,\n field,\n global,\n operation,\n originalDoc: doc,\n overrideAccess,\n path: fieldPath,\n previousSiblingDoc: siblingDoc,\n previousValue: siblingData[field.name],\n req,\n schemaPath: fieldSchemaPath,\n siblingData,\n value: siblingData[field.name],\n })\n\n if (hookedValue !== undefined) {\n siblingData[field.name] = hookedValue\n }\n }, Promise.resolve())\n }\n\n // Execute access control\n if (field.access && field.access[operation]) {\n const result = overrideAccess\n ? true\n : await field.access[operation]({ id, data, doc, req, siblingData })\n\n if (!result) {\n delete siblingData[field.name]\n }\n }\n\n if (typeof siblingData[field.name] === 'undefined') {\n // If no incoming data, but existing document data is found, merge it in\n if (typeof siblingDoc[field.name] !== 'undefined') {\n siblingData[field.name] = cloneDataFromOriginalDoc(siblingDoc[field.name])\n\n // Otherwise compute default value\n } else if (typeof field.defaultValue !== 'undefined') {\n siblingData[field.name] = await getValueWithDefault({\n defaultValue: field.defaultValue,\n locale: req.locale,\n user: req.user,\n value: siblingData[field.name],\n })\n }\n }\n }\n\n // Traverse subfields\n switch (field.type) {\n case 'group': {\n if (typeof siblingData[field.name] !== 'object') siblingData[field.name] = {}\n if (typeof siblingDoc[field.name] !== 'object') siblingDoc[field.name] = {}\n\n const groupData = siblingData[field.name] as Record<string, unknown>\n const groupDoc = siblingDoc[field.name] as Record<string, unknown>\n\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n overrideAccess,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData: groupData,\n siblingDoc: groupDoc,\n })\n\n break\n }\n\n case 'array': {\n const rows = siblingData[field.name]\n\n if (Array.isArray(rows)) {\n const promises = []\n rows.forEach((row, i) => {\n promises.push(\n traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n overrideAccess,\n path: [...fieldPath, i],\n req,\n schemaPath: fieldSchemaPath,\n siblingData: row,\n siblingDoc: getExistingRowDoc(row, siblingDoc[field.name]),\n }),\n )\n })\n await Promise.all(promises)\n }\n break\n }\n\n case 'blocks': {\n const rows = siblingData[field.name]\n\n if (Array.isArray(rows)) {\n const promises = []\n rows.forEach((row, i) => {\n const rowSiblingDoc = getExistingRowDoc(row, siblingDoc[field.name])\n const blockTypeToMatch = row.blockType || rowSiblingDoc.blockType\n const block = field.blocks.find((blockType) => blockType.slug === blockTypeToMatch)\n\n if (block) {\n row.blockType = blockTypeToMatch\n\n promises.push(\n traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: block.fields,\n global,\n operation,\n overrideAccess,\n path: [...fieldPath, i],\n req,\n schemaPath: fieldSchemaPath,\n siblingData: row,\n siblingDoc: rowSiblingDoc,\n }),\n )\n }\n })\n await Promise.all(promises)\n }\n\n break\n }\n\n case 'row':\n case 'collapsible': {\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n overrideAccess,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData,\n siblingDoc,\n })\n\n break\n }\n\n case 'tab': {\n let tabSiblingData\n let tabSiblingDoc\n if (tabHasName(field)) {\n if (typeof siblingData[field.name] !== 'object') siblingData[field.name] = {}\n if (typeof siblingDoc[field.name] !== 'object') siblingDoc[field.name] = {}\n\n tabSiblingData = siblingData[field.name] as Record<string, unknown>\n tabSiblingDoc = siblingDoc[field.name] as Record<string, unknown>\n } else {\n tabSiblingData = siblingData\n tabSiblingDoc = siblingDoc\n }\n\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n overrideAccess,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData: tabSiblingData,\n siblingDoc: tabSiblingDoc,\n })\n\n break\n }\n\n case 'tabs': {\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: field.tabs.map((tab) => ({ ...tab, type: 'tab' })),\n global,\n operation,\n overrideAccess,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData,\n siblingDoc,\n })\n\n break\n }\n\n case 'richText': {\n if (!field?.editor) {\n throw new MissingEditorProp(field) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n if (typeof field?.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n const editor: RichTextAdapter = field?.editor\n\n if (editor?.hooks?.beforeValidate?.length) {\n await editor.hooks.beforeValidate.reduce(async (priorHook, currentHook) => {\n await priorHook\n\n const hookedValue = await currentHook({\n collection,\n context,\n data,\n field,\n global,\n operation,\n originalDoc: doc,\n overrideAccess,\n path: fieldPath,\n previousSiblingDoc: siblingDoc,\n previousValue: siblingData[field.name],\n req,\n schemaPath: fieldSchemaPath,\n siblingData,\n value: siblingData[field.name],\n })\n\n if (hookedValue !== undefined) {\n siblingData[field.name] = hookedValue\n }\n }, Promise.resolve())\n }\n break\n }\n\n default: {\n break\n }\n }\n}\n"],"names":["MissingEditorProp","fieldAffectsData","tabHasName","valueIsValueWithRelation","getValueWithDefault","getFieldPaths","cloneDataFromOriginalDoc","getExistingRowDoc","traverseFields","promise","id","collection","context","data","doc","field","global","operation","overrideAccess","parentPath","parentSchemaPath","req","siblingData","siblingDoc","path","fieldPath","schemaPath","fieldSchemaPath","name","type","value","parseFloat","toString","trimmed","trim","length","Array","isArray","map","coordinate","i","richTextJSON","JSON","parse","hasMany","relationTo","forEach","relatedDoc","relatedCollection","payload","config","collections","find","slug","relationshipIDField","fields","collectionField","hooks","beforeValidate","reduce","priorHook","currentHook","hookedValue","originalDoc","previousSiblingDoc","previousValue","undefined","Promise","resolve","access","result","defaultValue","locale","user","groupData","groupDoc","rows","promises","row","push","all","rowSiblingDoc","blockTypeToMatch","blockType","block","blocks","tabSiblingData","tabSiblingDoc","tabs","tab","editor","Error"],"mappings":"AAAA,oCAAoC,GAOpC,SAASA,iBAAiB,QAAQ,2BAA0B;AAC5D,SAASC,gBAAgB,EAAEC,UAAU,EAAEC,wBAAwB,QAAQ,wBAAuB;AAC9F,OAAOC,yBAAyB,2BAA0B;AAC1D,SAASC,aAAa,QAAQ,yBAAwB;AACtD,SAASC,wBAAwB,QAAQ,8CAA6C;AACtF,SAASC,iBAAiB,QAAQ,uCAAs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AC;4BACAC;4BACA8C,aAAajD;4BACbI;4BACAM,MAAMC;4BACNuC,oBAAoBzC;4BACpB0C,eAAe3C,WAAW,CAACP,MAAMa,IAAI,CAAC;4BACtCP;4BACAK,YAAYC;4BACZL;4BACAQ,OAAOR,WAAW,CAACP,MAAMa,IAAI,CAAC;wBAChC;wBAEA,IAAIkC,gBAAgBI,WAAW;4BAC7B5C,WAAW,CAACP,MAAMa,IAAI,CAAC,GAAGkC;wBAC5B;oBACF,GAAGK,QAAQC,OAAO;gBACpB;gBACA;YACF;QAEA;YAAS;gBACP;YACF;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../src/fields/hooks/beforeValidate/promise.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport type { RichTextAdapter } from '../../../admin/RichText.js'\nimport type { SanitizedCollectionConfig } from '../../../collections/config/types.js'\nimport type { SanitizedGlobalConfig } from '../../../globals/config/types.js'\nimport type { PayloadRequest, RequestContext } from '../../../types/index.js'\nimport type { Field, TabAsField } from '../../config/types.js'\n\nimport { MissingEditorProp } from '../../../errors/index.js'\nimport { fieldAffectsData, tabHasName, valueIsValueWithRelation } from '../../config/types.js'\nimport getValueWithDefault from '../../getDefaultValue.js'\nimport { getFieldPaths } from '../../getFieldPaths.js'\nimport { cloneDataFromOriginalDoc } from '../beforeChange/cloneDataFromOriginalDoc.js'\nimport { getExistingRowDoc } from '../beforeChange/getExistingRowDoc.js'\nimport { traverseFields } from './traverseFields.js'\n\ntype Args<T> = {\n collection: SanitizedCollectionConfig | null\n context: RequestContext\n data: T\n /**\n * The original data (not modified by any hooks)\n */\n doc: T\n field: Field | TabAsField\n global: SanitizedGlobalConfig | null\n id?: number | string\n operation: 'create' | 'update'\n overrideAccess: boolean\n parentPath: (number | string)[]\n parentSchemaPath: string[]\n req: PayloadRequest\n siblingData: Record<string, unknown>\n /**\n * The original siblingData (not modified by any hooks)\n */\n siblingDoc: Record<string, unknown>\n}\n\n// This function is responsible for the following actions, in order:\n// - Sanitize incoming data\n// - Execute field hooks\n// - Execute field access control\n// - Merge original document data into incoming data\n// - Compute default values for undefined fields\n\nexport const promise = async <T>({\n id,\n collection,\n context,\n data,\n doc,\n field,\n global,\n operation,\n overrideAccess,\n parentPath,\n parentSchemaPath,\n req,\n siblingData,\n siblingDoc,\n}: Args<T>): Promise<void> => {\n const { path: fieldPath, schemaPath: fieldSchemaPath } = getFieldPaths({\n field,\n parentPath,\n parentSchemaPath,\n })\n\n if (fieldAffectsData(field)) {\n if (field.name === 'id') {\n if (field.type === 'number' && typeof siblingData[field.name] === 'string') {\n const value = siblingData[field.name] as string\n\n siblingData[field.name] = parseFloat(value)\n }\n\n if (\n field.type === 'text' &&\n typeof siblingData[field.name]?.toString === 'function' &&\n typeof siblingData[field.name] !== 'string'\n ) {\n siblingData[field.name] = siblingData[field.name].toString()\n }\n }\n\n // Sanitize incoming data\n switch (field.type) {\n case 'number': {\n if (typeof siblingData[field.name] === 'string') {\n const value = siblingData[field.name] as string\n const trimmed = value.trim()\n siblingData[field.name] = trimmed.length === 0 ? null : parseFloat(trimmed)\n }\n\n break\n }\n\n case 'point': {\n if (Array.isArray(siblingData[field.name])) {\n siblingData[field.name] = (siblingData[field.name] as string[]).map((coordinate, i) => {\n if (typeof coordinate === 'string') {\n const value = siblingData[field.name][i] as string\n const trimmed = value.trim()\n return trimmed.length === 0 ? null : parseFloat(trimmed)\n }\n return coordinate\n })\n }\n\n break\n }\n\n case 'checkbox': {\n if (siblingData[field.name] === 'true') siblingData[field.name] = true\n if (siblingData[field.name] === 'false') siblingData[field.name] = false\n if (siblingData[field.name] === '') siblingData[field.name] = false\n\n break\n }\n\n case 'richText': {\n if (typeof siblingData[field.name] === 'string') {\n try {\n const richTextJSON = JSON.parse(siblingData[field.name] as string)\n siblingData[field.name] = richTextJSON\n } catch {\n // Disregard this data as it is not valid.\n // Will be reported to user by field validation\n }\n }\n\n break\n }\n\n case 'relationship':\n case 'upload': {\n if (\n siblingData[field.name] === '' ||\n siblingData[field.name] === 'none' ||\n siblingData[field.name] === 'null' ||\n siblingData[field.name] === null\n ) {\n if (field.type === 'relationship' && field.hasMany === true) {\n siblingData[field.name] = []\n } else {\n siblingData[field.name] = null\n }\n }\n\n const value = siblingData[field.name]\n\n if (Array.isArray(field.relationTo)) {\n if (Array.isArray(value)) {\n value.forEach((relatedDoc: { relationTo: string; value: unknown }, i) => {\n const relatedCollection = req.payload.config.collections.find(\n (collection) => collection.slug === relatedDoc.relationTo,\n )\n const relationshipIDField = relatedCollection.fields.find(\n (collectionField) =>\n fieldAffectsData(collectionField) && collectionField.name === 'id',\n )\n if (relationshipIDField?.type === 'number') {\n siblingData[field.name][i] = {\n ...relatedDoc,\n value: parseFloat(relatedDoc.value as string),\n }\n }\n })\n }\n if (\n field.type === 'relationship' &&\n field.hasMany !== true &&\n valueIsValueWithRelation(value)\n ) {\n const relatedCollection = req.payload.config.collections.find(\n (collection) => collection.slug === value.relationTo,\n )\n const relationshipIDField = relatedCollection.fields.find(\n (collectionField) =>\n fieldAffectsData(collectionField) && collectionField.name === 'id',\n )\n if (relationshipIDField?.type === 'number') {\n siblingData[field.name] = { ...value, value: parseFloat(value.value as string) }\n }\n }\n } else {\n if (Array.isArray(value)) {\n value.forEach((relatedDoc: unknown, i) => {\n const relatedCollection = req.payload.config.collections.find(\n (collection) => collection.slug === field.relationTo,\n )\n const relationshipIDField = relatedCollection.fields.find(\n (collectionField) =>\n fieldAffectsData(collectionField) && collectionField.name === 'id',\n )\n if (relationshipIDField?.type === 'number') {\n siblingData[field.name][i] = parseFloat(relatedDoc as string)\n }\n })\n }\n if (field.type === 'relationship' && field.hasMany !== true && value) {\n const relatedCollection = req.payload.config.collections.find(\n (collection) => collection.slug === field.relationTo,\n )\n const relationshipIDField = relatedCollection.fields.find(\n (collectionField) =>\n fieldAffectsData(collectionField) && collectionField.name === 'id',\n )\n if (relationshipIDField?.type === 'number') {\n siblingData[field.name] = parseFloat(value as string)\n }\n }\n }\n break\n }\n\n case 'array':\n case 'blocks': {\n // Handle cases of arrays being intentionally set to 0\n if (siblingData[field.name] === '0' || siblingData[field.name] === 0) {\n siblingData[field.name] = []\n }\n\n break\n }\n\n default: {\n break\n }\n }\n\n // Execute hooks\n if (field.hooks?.beforeValidate) {\n await field.hooks.beforeValidate.reduce(async (priorHook, currentHook) => {\n await priorHook\n\n const hookedValue = await currentHook({\n collection,\n context,\n data,\n field,\n global,\n operation,\n originalDoc: doc,\n overrideAccess,\n path: fieldPath,\n previousSiblingDoc: siblingDoc,\n previousValue: siblingData[field.name],\n req,\n schemaPath: fieldSchemaPath,\n siblingData,\n value: siblingData[field.name],\n })\n\n if (hookedValue !== undefined) {\n siblingData[field.name] = hookedValue\n }\n }, Promise.resolve())\n }\n\n // Execute access control\n if (field.access && field.access[operation]) {\n const result = overrideAccess\n ? true\n : await field.access[operation]({ id, data, doc, req, siblingData })\n\n if (!result) {\n delete siblingData[field.name]\n }\n }\n\n if (typeof siblingData[field.name] === 'undefined') {\n // If no incoming data, but existing document data is found, merge it in\n if (typeof siblingDoc[field.name] !== 'undefined') {\n siblingData[field.name] = cloneDataFromOriginalDoc(siblingDoc[field.name])\n\n // Otherwise compute default value\n } else if (typeof field.defaultValue !== 'undefined') {\n siblingData[field.name] = await getValueWithDefault({\n defaultValue: field.defaultValue,\n locale: req.locale,\n user: req.user,\n value: siblingData[field.name],\n })\n }\n }\n }\n\n // Traverse subfields\n switch (field.type) {\n case 'group': {\n if (typeof siblingData[field.name] !== 'object') siblingData[field.name] = {}\n if (typeof siblingDoc[field.name] !== 'object') siblingDoc[field.name] = {}\n\n const groupData = siblingData[field.name] as Record<string, unknown>\n const groupDoc = siblingDoc[field.name] as Record<string, unknown>\n\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n overrideAccess,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData: groupData,\n siblingDoc: groupDoc,\n })\n\n break\n }\n\n case 'array': {\n const rows = siblingData[field.name]\n\n if (Array.isArray(rows)) {\n const promises = []\n rows.forEach((row, i) => {\n promises.push(\n traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n overrideAccess,\n path: [...fieldPath, i],\n req,\n schemaPath: fieldSchemaPath,\n siblingData: row,\n siblingDoc: getExistingRowDoc(row, siblingDoc[field.name]),\n }),\n )\n })\n await Promise.all(promises)\n }\n break\n }\n\n case 'blocks': {\n const rows = siblingData[field.name]\n\n if (Array.isArray(rows)) {\n const promises = []\n rows.forEach((row, i) => {\n const rowSiblingDoc = getExistingRowDoc(row, siblingDoc[field.name])\n const blockTypeToMatch = row.blockType || rowSiblingDoc.blockType\n const block = field.blocks.find((blockType) => blockType.slug === blockTypeToMatch)\n\n if (block) {\n row.blockType = blockTypeToMatch\n\n promises.push(\n traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: block.fields,\n global,\n operation,\n overrideAccess,\n path: [...fieldPath, i],\n req,\n schemaPath: fieldSchemaPath,\n siblingData: row,\n siblingDoc: rowSiblingDoc,\n }),\n )\n }\n })\n await Promise.all(promises)\n }\n\n break\n }\n\n case 'row':\n case 'collapsible': {\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n overrideAccess,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData,\n siblingDoc,\n })\n\n break\n }\n\n case 'tab': {\n let tabSiblingData\n let tabSiblingDoc\n if (tabHasName(field)) {\n if (typeof siblingData[field.name] !== 'object') siblingData[field.name] = {}\n if (typeof siblingDoc[field.name] !== 'object') siblingDoc[field.name] = {}\n\n tabSiblingData = siblingData[field.name] as Record<string, unknown>\n tabSiblingDoc = siblingDoc[field.name] as Record<string, unknown>\n } else {\n tabSiblingData = siblingData\n tabSiblingDoc = siblingDoc\n }\n\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n overrideAccess,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData: tabSiblingData,\n siblingDoc: tabSiblingDoc,\n })\n\n break\n }\n\n case 'tabs': {\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n fields: field.tabs.map((tab) => ({ ...tab, type: 'tab' })),\n global,\n operation,\n overrideAccess,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData,\n siblingDoc,\n })\n\n break\n }\n\n case 'richText': {\n if (!field?.editor) {\n throw new MissingEditorProp(field) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n if (typeof field?.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n const editor: RichTextAdapter = field?.editor\n\n if (editor?.hooks?.beforeValidate?.length) {\n await editor.hooks.beforeValidate.reduce(async (priorHook, currentHook) => {\n await priorHook\n\n const hookedValue = await currentHook({\n collection,\n context,\n data,\n field,\n global,\n operation,\n originalDoc: doc,\n overrideAccess,\n path: fieldPath,\n previousSiblingDoc: siblingDoc,\n previousValue: siblingData[field.name],\n req,\n schemaPath: fieldSchemaPath,\n siblingData,\n value: siblingData[field.name],\n })\n\n if (hookedValue !== undefined) {\n siblingData[field.name] = hookedValue\n }\n }, Promise.resolve())\n }\n break\n }\n\n default: {\n break\n }\n }\n}\n"],"names":["MissingEditorProp","fieldAffectsData","tabHasName","valueIsValueWithRelation","getValueWithDefault","getFieldPaths","cloneDataFromOriginalDoc","getExistingRowDoc","traverseFields","promise","id","collection","context","data","doc","field","global","operation","overrideAccess","parentPath","parentSchemaPath","req","siblingData","siblingDoc","path","fieldPath","schemaPath","fieldSchemaPath","name","type","value","parseFloat","toString","trimmed","trim","length","Array","isArray","map","coordinate","i","richTextJSON","JSON","parse","hasMany","relationTo","forEach","relatedDoc","relatedCollection","payload","config","collections","find","slug","relationshipIDField","fields","collectionField","hooks","beforeValidate","reduce","priorHook","currentHook","hookedValue","originalDoc","previousSiblingDoc","previousValue","undefined","Promise","resolve","access","result","defaultValue","locale","user","groupData","groupDoc","rows","promises","row","push","all","rowSiblingDoc","blockTypeToMatch","blockType","block","blocks","tabSiblingData","tabSiblingDoc","tabs","tab","editor","Error"],"mappings":"AAAA,oCAAoC,GAOpC,SAASA,iBAAiB,QAAQ,2BAA0B;AAC5D,SAASC,gBAAgB,EAAEC,UAAU,EAAEC,wBAAwB,QAAQ,wBAAuB;AAC9F,OAAOC,yBAAyB,2BAA0B;AAC1D,SAASC,aAAa,QAAQ,yBAAwB;AACtD,SAASC,wBAAwB,QAAQ,8CAA6C;AACtF,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,cAAc,QAAQ,sBAAqB;AAyBpD,oEAAoE;AACpE,2BAA2B;AAC3B,wBAAwB;AACxB,iCAAiC;AACjC,oDAAoD;AACpD,gDAAgD;AAEhD,OAAO,MAAMC,UAAU,OAAU,EAC/BC,EAAE,EACFC,UAAU,EACVC,OAAO,EACPC,IAAI,EACJC,GAAG,EACHC,KAAK,EACLC,MAAM,EACNC,SAAS,EACTC,cAAc,EACdC,UAAU,EACVC,gBAAgB,EAChBC,GAAG,EACHC,WAAW,EACXC,UAAU,EACF;IACR,MAAM,EAAEC,MAAMC,SAAS,EAAEC,YAAYC,eAAe,EAAE,GAAGtB,cAAc;QACrEU;QACAI;QACAC;IACF;IAEA,IAAInB,iBAAiBc,QAAQ;QAC3B,IAAIA,MAAMa,IAAI,KAAK,MAAM;YACvB,IAAIb,MAAMc,IAAI,KAAK,YAAY,OAAOP,WAAW,CAACP,MAAMa,IAAI,CAAC,KAAK,UAAU;gBAC1E,MAAME,QAAQR,WAAW,CAACP,MAAMa,IAAI,CAAC;gBAErCN,WAAW,CAACP,MAAMa,IAAI,CAAC,GAAGG,WAAWD;YACvC;YAEA,IACEf,MAAMc,IAAI,KAAK,UACf,OAAOP,WAAW,CAACP,MAAMa,IAAI,CAAC,EAAEI,aAAa,cAC7C,OAAOV,WAAW,CAACP,MAAMa,IAAI,CAAC,KAAK,UACnC;gBACAN,WAAW,CAACP,MAAMa,IAA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AAI1F,kBAAkBe,OAAO,8HAA8H;;gBACnK;gBACA,IAAI,OAAOA,OAAO2E,WAAW,YAAY;oBACvC,MAAM,IAAIC,MAAM;gBAClB;gBAEA,MAAMD,SAA0B3E,OAAO2E;gBAEvC,IAAIA,QAAQjC,OAAOC,gBAAgBvB,QAAQ;oBACzC,MAAMuD,OAAOjC,KAAK,CAACC,cAAc,CAACC,MAAM,CAAC,OAAOC,WAAWC;wBACzD,MAAMD;wBAEN,MAAME,cAAc,MAAMD,YAAY;4BACpClD;4BACAC;4BACAC;4BACAE;4BACAC;4BACAC;4BACA8C,aAAajD;4BACbI;4BACAM,MAAMC;4BACNuC,oBAAoBzC;4BACpB0C,eAAe3C,WAAW,CAACP,MAAMa,IAAI,CAAC;4BACtCP;4BACAK,YAAYC;4BACZL;4BACAQ,OAAOR,WAAW,CAACP,MAAMa,IAAI,CAAC;wBAChC;wBAEA,IAAIkC,gBAAgBI,WAAW;4BAC7B5C,WAAW,CAACP,MAAMa,IAAI,CAAC,GAAGkC;wBAC5B;oBACF,GAAGK,QAAQC,OAAO;gBACpB;gBACA;YACF;QAEA;YAAS;gBACP;YACF;IACF;AACF,EAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { SanitizedCollectionConfig } from '../../../collections/config/types.js';
2
2
  import type { SanitizedGlobalConfig } from '../../../globals/config/types.js';
3
- import type { PayloadRequestWithData, RequestContext } from '../../../types/index.js';
3
+ import type { PayloadRequest, RequestContext } from '../../../types/index.js';
4
4
  import type { Field, TabAsField } from '../../config/types.js';
5
5
  type Args<T> = {
6
6
  collection: SanitizedCollectionConfig | null;
@@ -16,7 +16,7 @@ type Args<T> = {
16
16
  operation: 'create' | 'update';
17
17
  overrideAccess: boolean;
18
18
  path: (number | string)[];
19
- req: PayloadRequestWithData;
19
+ req: PayloadRequest;
20
20
  schemaPath: string[];
21
21
  siblingData: Record<string, unknown>;
22
22
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"traverseFields.d.ts","sourceRoot":"","sources":["../../../../src/fields/hooks/beforeValidate/traverseFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AACrF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AAC7E,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACrF,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAI9D,KAAK,IAAI,CAAC,CAAC,IAAI;IACb,UAAU,EAAE,yBAAyB,GAAG,IAAI,CAAA;IAC5C,OAAO,EAAE,cAAc,CAAA;IACvB,IAAI,EAAE,CAAC,CAAA;IACP;;OAEG;IACH,GAAG,EAAE,CAAC,CAAA;IACN,MAAM,EAAE,CAAC,KAAK,GAAG,UAAU,CAAC,EAAE,CAAA;IAC9B,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAAA;IACpC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,SAAS,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC9B,cAAc,EAAE,OAAO,CAAA;IACvB,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IACzB,GAAG,EAAE,sBAAsB,CAAA;IAC3B,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACpC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACpC,CAAA;AAED,eAAO,MAAM,cAAc,GAAU,CAAC,sIAenC,IAAI,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,IAAI,CAuBxB,CAAA"}
1
+ {"version":3,"file":"traverseFields.d.ts","sourceRoot":"","sources":["../../../../src/fields/hooks/beforeValidate/traverseFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AACrF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAC7E,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAI9D,KAAK,IAAI,CAAC,CAAC,IAAI;IACb,UAAU,EAAE,yBAAyB,GAAG,IAAI,CAAA;IAC5C,OAAO,EAAE,cAAc,CAAA;IACvB,IAAI,EAAE,CAAC,CAAA;IACP;;OAEG;IACH,GAAG,EAAE,CAAC,CAAA;IACN,MAAM,EAAE,CAAC,KAAK,GAAG,UAAU,CAAC,EAAE,CAAA;IAC9B,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAAA;IACpC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,SAAS,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC9B,cAAc,EAAE,OAAO,CAAA;IACvB,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IACzB,GAAG,EAAE,cAAc,CAAA;IACnB,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACpC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACpC,CAAA;AAED,eAAO,MAAM,cAAc,GAAU,CAAC,sIAenC,IAAI,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,IAAI,CAuBxB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/fields/hooks/beforeValidate/traverseFields.ts"],"sourcesContent":["import type { SanitizedCollectionConfig } from '../../../collections/config/types.js'\nimport type { SanitizedGlobalConfig } from '../../../globals/config/types.js'\nimport type { PayloadRequestWithData, RequestContext } from '../../../types/index.js'\nimport type { Field, TabAsField } from '../../config/types.js'\n\nimport { promise } from './promise.js'\n\ntype Args<T> = {\n collection: SanitizedCollectionConfig | null\n context: RequestContext\n data: T\n /**\n * The original data (not modified by any hooks)\n */\n doc: T\n fields: (Field | TabAsField)[]\n global: SanitizedGlobalConfig | null\n id?: number | string\n operation: 'create' | 'update'\n overrideAccess: boolean\n path: (number | string)[]\n req: PayloadRequestWithData\n schemaPath: string[]\n siblingData: Record<string, unknown>\n /**\n * The original siblingData (not modified by any hooks)\n */\n siblingDoc: Record<string, unknown>\n}\n\nexport const traverseFields = async <T>({\n id,\n collection,\n context,\n data,\n doc,\n fields,\n global,\n operation,\n overrideAccess,\n path,\n req,\n schemaPath,\n siblingData,\n siblingDoc,\n}: Args<T>): Promise<void> => {\n const promises = []\n fields.forEach((field) => {\n promises.push(\n promise({\n id,\n collection,\n context,\n data,\n doc,\n field,\n global,\n operation,\n overrideAccess,\n parentPath: path,\n parentSchemaPath: schemaPath,\n req,\n siblingData,\n siblingDoc,\n }),\n )\n })\n await Promise.all(promises)\n}\n"],"names":["promise","traverseFields","id","collection","context","data","doc","fields","global","operation","overrideAccess","path","req","schemaPath","siblingData","siblingDoc","promises","forEach","field","push","parentPath","parentSchemaPath","Promise","all"],"mappings":"AAKA,SAASA,OAAO,QAAQ,eAAc;AAyBtC,OAAO,MAAMC,iBAAiB,OAAU,EACtCC,EAAE,EACFC,UAAU,EACVC,OAAO,EACPC,IAAI,EACJC,GAAG,EACHC,MAAM,EACNC,MAAM,EACNC,SAAS,EACTC,cAAc,EACdC,IAAI,EACJC,GAAG,EACHC,UAAU,EACVC,WAAW,EACXC,UAAU,EACF;IACR,MAAMC,WAAW,EAAE;IACnBT,OAAOU,OAAO,CAAC,CAACC;QACdF,SAASG,IAAI,CACXnB,QAAQ;YACNE;YACAC;YACAC;YACAC;YACAC;YACAY;YACAV;YACAC;YACAC;YACAU,YAAYT;YACZU,kBAAkBR;YAClBD;YACAE;YACAC;QACF;IAEJ;IACA,MAAMO,QAAQC,GAAG,CAACP;AACpB,EAAC"}
1
+ {"version":3,"sources":["../../../../src/fields/hooks/beforeValidate/traverseFields.ts"],"sourcesContent":["import type { SanitizedCollectionConfig } from '../../../collections/config/types.js'\nimport type { SanitizedGlobalConfig } from '../../../globals/config/types.js'\nimport type { PayloadRequest, RequestContext } from '../../../types/index.js'\nimport type { Field, TabAsField } from '../../config/types.js'\n\nimport { promise } from './promise.js'\n\ntype Args<T> = {\n collection: SanitizedCollectionConfig | null\n context: RequestContext\n data: T\n /**\n * The original data (not modified by any hooks)\n */\n doc: T\n fields: (Field | TabAsField)[]\n global: SanitizedGlobalConfig | null\n id?: number | string\n operation: 'create' | 'update'\n overrideAccess: boolean\n path: (number | string)[]\n req: PayloadRequest\n schemaPath: string[]\n siblingData: Record<string, unknown>\n /**\n * The original siblingData (not modified by any hooks)\n */\n siblingDoc: Record<string, unknown>\n}\n\nexport const traverseFields = async <T>({\n id,\n collection,\n context,\n data,\n doc,\n fields,\n global,\n operation,\n overrideAccess,\n path,\n req,\n schemaPath,\n siblingData,\n siblingDoc,\n}: Args<T>): Promise<void> => {\n const promises = []\n fields.forEach((field) => {\n promises.push(\n promise({\n id,\n collection,\n context,\n data,\n doc,\n field,\n global,\n operation,\n overrideAccess,\n parentPath: path,\n parentSchemaPath: schemaPath,\n req,\n siblingData,\n siblingDoc,\n }),\n )\n })\n await Promise.all(promises)\n}\n"],"names":["promise","traverseFields","id","collection","context","data","doc","fields","global","operation","overrideAccess","path","req","schemaPath","siblingData","siblingDoc","promises","forEach","field","push","parentPath","parentSchemaPath","Promise","all"],"mappings":"AAKA,SAASA,OAAO,QAAQ,eAAc;AAyBtC,OAAO,MAAMC,iBAAiB,OAAU,EACtCC,EAAE,EACFC,UAAU,EACVC,OAAO,EACPC,IAAI,EACJC,GAAG,EACHC,MAAM,EACNC,MAAM,EACNC,SAAS,EACTC,cAAc,EACdC,IAAI,EACJC,GAAG,EACHC,UAAU,EACVC,WAAW,EACXC,UAAU,EACF;IACR,MAAMC,WAAW,EAAE;IACnBT,OAAOU,OAAO,CAAC,CAACC;QACdF,SAASG,IAAI,CACXnB,QAAQ;YACNE;YACAC;YACAC;YACAC;YACAC;YACAY;YACAV;YACAC;YACAC;YACAU,YAAYT;YACZU,kBAAkBR;YAClBD;YACAE;YACAC;QACF;IAEJ;IACA,MAAMO,QAAQC,GAAG,CAACP;AACpB,EAAC"}
@@ -53,7 +53,11 @@ declare const _default: {
53
53
  };
54
54
  editorOptions?: import("@monaco-editor/react").EditorProps["options"];
55
55
  };
56
- jsonSchema?: Record<string, unknown>;
56
+ jsonSchema?: {
57
+ fileMatch: string[];
58
+ schema: import("json-schema").JSONSchema4;
59
+ uri: string;
60
+ };
57
61
  type: "json";
58
62
  } & {
59
63
  jsonError?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"validations.d.ts","sourceRoot":"","sources":["../../src/fields/validations.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,aAAa,EACb,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,WAAW,EACX,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,SAAS,EACT,aAAa,EACb,WAAW,EACX,QAAQ,EACT,MAAM,mBAAmB,CAAA;AAK1B,eAAO,MAAM,IAAI,EAAE,QAAQ,CAAC,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAkDzE,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CA8BlE,CAAA;AAED,eAAO,MAAM,KAAK,EAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,CAShE,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,CA6BtE,CAAA;AAED,eAAO,MAAM,IAAI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;;;;;;oBAjZgC,CAAC;2BAMzB,CAAC;qBAAgC,CAAC;sBAKnC,CAAC;;;;;;;;;;;;;;;;qBA2ZqS,CAAC;qBAAuC,CAAC;;;;;;;;;;;oBAjgBvQ,MAAM;;;;;;;;;;;;;AA8etF,wBAkBC"}
@@ -5,7 +5,7 @@ import type { Access, EditConfig, Endpoint, EntityDescription, EntityDescription
5
5
  import type { DBIdentifierName } from '../../database/types.js';
6
6
  import type { Field } from '../../fields/config/types.js';
7
7
  import type { GlobalSlug, TypedGlobal } from '../../index.js';
8
- import type { PayloadRequestWithData, RequestContext, Where } from '../../types/index.js';
8
+ import type { PayloadRequest, RequestContext, Where } from '../../types/index.js';
9
9
  import type { IncomingGlobalVersions, SanitizedGlobalVersions } from '../../versions/types.js';
10
10
  export type DataFromGlobalSlug<TSlug extends GlobalSlug> = TypedGlobal[TSlug];
11
11
  export type BeforeValidateHook = (args: {
@@ -14,7 +14,7 @@ export type BeforeValidateHook = (args: {
14
14
  /** The global which this hook is being run on */
15
15
  global: SanitizedGlobalConfig;
16
16
  originalDoc?: any;
17
- req: PayloadRequestWithData;
17
+ req: PayloadRequest;
18
18
  }) => any;
19
19
  export type BeforeChangeHook = (args: {
20
20
  context: RequestContext;
@@ -22,7 +22,7 @@ export type BeforeChangeHook = (args: {
22
22
  /** The global which this hook is being run on */
23
23
  global: SanitizedGlobalConfig;
24
24
  originalDoc?: any;
25
- req: PayloadRequestWithData;
25
+ req: PayloadRequest;
26
26
  }) => any;
27
27
  export type AfterChangeHook = (args: {
28
28
  context: RequestContext;
@@ -30,14 +30,14 @@ export type AfterChangeHook = (args: {
30
30
  /** The global which this hook is being run on */
31
31
  global: SanitizedGlobalConfig;
32
32
  previousDoc: any;
33
- req: PayloadRequestWithData;
33
+ req: PayloadRequest;
34
34
  }) => any;
35
35
  export type BeforeReadHook = (args: {
36
36
  context: RequestContext;
37
37
  doc: any;
38
38
  /** The global which this hook is being run on */
39
39
  global: SanitizedGlobalConfig;
40
- req: PayloadRequestWithData;
40
+ req: PayloadRequest;
41
41
  }) => any;
42
42
  export type AfterReadHook = (args: {
43
43
  context: RequestContext;
@@ -46,7 +46,7 @@ export type AfterReadHook = (args: {
46
46
  /** The global which this hook is being run on */
47
47
  global: SanitizedGlobalConfig;
48
48
  query?: Where;
49
- req: PayloadRequestWithData;
49
+ req: PayloadRequest;
50
50
  }) => any;
51
51
  export type GlobalAdminOptions = {
52
52
  /**
@@ -98,7 +98,7 @@ export type GlobalAdminOptions = {
98
98
  * Exclude the global from the admin nav and routes
99
99
  */
100
100
  hidden?: ((args: {
101
- user: PayloadRequestWithData['user'];
101
+ user: PayloadRequest['user'];
102
102
  }) => boolean) | boolean;
103
103
  /**
104
104
  * Hide the API URL within the Edit view
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/globals/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EACV,MAAM,EACN,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,0BAA0B,EAC1B,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EAChB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACzF,OAAO,KAAK,EAAE,sBAAsB,EAAE,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,MAAM,MAAM,OAAO,GAAG;IACpB,MAAM,EAAE,qBAAqB,EAAE,CAAA;IAC/B,OAAO,CAAC,EACJ;QACE,CAAC,IAAI,EAAE,MAAM,GAAG;YACd,iBAAiB,EAAE,cAAc,CAAC,GAAG,CAAC,CAAA;YACtC,IAAI,EAAE,iBAAiB,CAAA;YACvB,WAAW,CAAC,EAAE,iBAAiB,CAAA;SAChC,CAAA;KACF,GACD,KAAK,CAAA;CACV,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/globals/config/types.ts"],"sourcesContent":["import type { GraphQLNonNull, GraphQLObjectType } from 'graphql'\nimport type { DeepRequired } from 'ts-essentials'\n\nimport type {\n CustomPreviewButton,\n CustomPublishButton,\n CustomSaveButton,\n CustomSaveDraftButton,\n} from '../../admin/types.js'\nimport type {\n Access,\n EditConfig,\n Endpoint,\n EntityDescription,\n EntityDescriptionComponent,\n GeneratePreviewURL,\n LivePreviewConfig,\n OpenGraphConfig,\n} from '../../config/types.js'\nimport type { DBIdentifierName } from '../../database/types.js'\nimport type { Field } from '../../fields/config/types.js'\nimport type { GlobalSlug, TypedGlobal } from '../../index.js'\nimport type { PayloadRequestWithData, RequestContext, Where } from '../../types/index.js'\nimport type { IncomingGlobalVersions, SanitizedGlobalVersions } from '../../versions/types.js'\n\nexport type DataFromGlobalSlug<TSlug extends GlobalSlug> = TypedGlobal[TSlug]\n\nexport type BeforeValidateHook = (args: {\n context: RequestContext\n data?: any\n /** The global which this hook is being run on */\n global: SanitizedGlobalConfig\n originalDoc?: any\n req: PayloadRequestWithData\n}) => any\n\nexport type BeforeChangeHook = (args: {\n context: RequestContext\n data: any\n /** The global which this hook is being run on */\n global: SanitizedGlobalConfig\n originalDoc?: any\n req: PayloadRequestWithData\n}) => any\n\nexport type AfterChangeHook = (args: {\n context: RequestContext\n doc: any\n /** The global which this hook is being run on */\n global: SanitizedGlobalConfig\n previousDoc: any\n req: PayloadRequestWithData\n}) => any\n\nexport type BeforeReadHook = (args: {\n context: RequestContext\n doc: any\n /** The global which this hook is being run on */\n global: SanitizedGlobalConfig\n req: PayloadRequestWithData\n}) => any\n\nexport type AfterReadHook = (args: {\n context: RequestContext\n doc: any\n findMany?: boolean\n /** The global which this hook is being run on */\n global: SanitizedGlobalConfig\n query?: Where\n req: PayloadRequestWithData\n}) => any\n\nexport type GlobalAdminOptions = {\n /**\n * Custom admin components\n */\n components?: {\n elements?: {\n Description?: EntityDescriptionComponent\n /**\n * Replaces the \"Preview\" button\n */\n PreviewButton?: CustomPreviewButton\n /**\n * Replaces the \"Publish\" button\n * + drafts must be enabled\n */\n PublishButton?: CustomPublishButton\n /**\n * Replaces the \"Save\" button\n * + drafts must be disabled\n */\n SaveButton?: CustomSaveButton\n /**\n * Replaces the \"Save Draft\" button\n * + drafts must be enabled\n * + autosave must be disabled\n */\n SaveDraftButton?: CustomSaveDraftButton\n }\n views?: {\n /**\n * Set to a React component to replace the entire \"Edit\" view, including all nested routes.\n * Set to an object to replace or modify individual nested routes, or to add new ones.\n */\n Edit?: EditConfig\n }\n }\n /** Extension point to add your custom data. Available in server and client. */\n custom?: Record<string, any>\n /**\n * Custom description for collection\n */\n description?: EntityDescription\n /**\n * Place globals into a navigational group\n * */\n group?: Record<string, string> | string\n /**\n * Exclude the global from the admin nav and routes\n */\n hidden?: ((args: { user: PayloadRequestWithData['user'] }) => boolean) | boolean\n /**\n * Hide the API URL within the Edit view\n */\n hideAPIURL?: boolean\n /**\n * Live preview options\n */\n livePreview?: LivePreviewConfig\n meta?: {\n description?: string\n openGraph?: OpenGraphConfig\n }\n /**\n * Function to generate custom preview URL\n */\n preview?: GeneratePreviewURL\n}\n\nexport type GlobalConfig = {\n access?: {\n read?: Access\n readDrafts?: Access\n readVersions?: Access\n update?: Access\n }\n admin?: GlobalAdminOptions\n /** Extension point to add your custom data. Server only. */\n custom?: Record<string, any>\n /**\n * Customize the SQL table name\n */\n dbName?: DBIdentifierName\n endpoints?: Omit<Endpoint, 'root'>[] | false\n fields: Field[]\n graphQL?:\n | {\n name?: string\n }\n | false\n hooks?: {\n afterChange?: AfterChangeHook[]\n afterRead?: AfterReadHook[]\n beforeChange?: BeforeChangeHook[]\n beforeRead?: BeforeReadHook[]\n beforeValidate?: BeforeValidateHook[]\n }\n label?: Record<string, string> | string\n slug: string\n /**\n * Options used in typescript generation\n */\n typescript?: {\n /**\n * Typescript generation name given to the interface type\n */\n interface?: string\n }\n versions?: IncomingGlobalVersions | boolean\n}\n\nexport interface SanitizedGlobalConfig\n extends Omit<DeepRequired<GlobalConfig>, 'endpoints' | 'fields' | 'versions'> {\n endpoints: Endpoint[] | false\n fields: Field[]\n versions: SanitizedGlobalVersions\n}\n\nexport type Globals = {\n config: SanitizedGlobalConfig[]\n graphQL?:\n | {\n [slug: string]: {\n mutationInputType: GraphQLNonNull<any>\n type: GraphQLObjectType\n versionType?: GraphQLObjectType\n }\n }\n | false\n}\n"],"names":[],"mappings":"AA6LA,WAWC"}
1
+ {"version":3,"sources":["../../../src/globals/config/types.ts"],"sourcesContent":["import type { GraphQLNonNull, GraphQLObjectType } from 'graphql'\nimport type { DeepRequired } from 'ts-essentials'\n\nimport type {\n CustomPreviewButton,\n CustomPublishButton,\n CustomSaveButton,\n CustomSaveDraftButton,\n} from '../../admin/types.js'\nimport type {\n Access,\n EditConfig,\n Endpoint,\n EntityDescription,\n EntityDescriptionComponent,\n GeneratePreviewURL,\n LivePreviewConfig,\n OpenGraphConfig,\n} from '../../config/types.js'\nimport type { DBIdentifierName } from '../../database/types.js'\nimport type { Field } from '../../fields/config/types.js'\nimport type { GlobalSlug, TypedGlobal } from '../../index.js'\nimport type { PayloadRequest, RequestContext, Where } from '../../types/index.js'\nimport type { IncomingGlobalVersions, SanitizedGlobalVersions } from '../../versions/types.js'\n\nexport type DataFromGlobalSlug<TSlug extends GlobalSlug> = TypedGlobal[TSlug]\n\nexport type BeforeValidateHook = (args: {\n context: RequestContext\n data?: any\n /** The global which this hook is being run on */\n global: SanitizedGlobalConfig\n originalDoc?: any\n req: PayloadRequest\n}) => any\n\nexport type BeforeChangeHook = (args: {\n context: RequestContext\n data: any\n /** The global which this hook is being run on */\n global: SanitizedGlobalConfig\n originalDoc?: any\n req: PayloadRequest\n}) => any\n\nexport type AfterChangeHook = (args: {\n context: RequestContext\n doc: any\n /** The global which this hook is being run on */\n global: SanitizedGlobalConfig\n previousDoc: any\n req: PayloadRequest\n}) => any\n\nexport type BeforeReadHook = (args: {\n context: RequestContext\n doc: any\n /** The global which this hook is being run on */\n global: SanitizedGlobalConfig\n req: PayloadRequest\n}) => any\n\nexport type AfterReadHook = (args: {\n context: RequestContext\n doc: any\n findMany?: boolean\n /** The global which this hook is being run on */\n global: SanitizedGlobalConfig\n query?: Where\n req: PayloadRequest\n}) => any\n\nexport type GlobalAdminOptions = {\n /**\n * Custom admin components\n */\n components?: {\n elements?: {\n Description?: EntityDescriptionComponent\n /**\n * Replaces the \"Preview\" button\n */\n PreviewButton?: CustomPreviewButton\n /**\n * Replaces the \"Publish\" button\n * + drafts must be enabled\n */\n PublishButton?: CustomPublishButton\n /**\n * Replaces the \"Save\" button\n * + drafts must be disabled\n */\n SaveButton?: CustomSaveButton\n /**\n * Replaces the \"Save Draft\" button\n * + drafts must be enabled\n * + autosave must be disabled\n */\n SaveDraftButton?: CustomSaveDraftButton\n }\n views?: {\n /**\n * Set to a React component to replace the entire \"Edit\" view, including all nested routes.\n * Set to an object to replace or modify individual nested routes, or to add new ones.\n */\n Edit?: EditConfig\n }\n }\n /** Extension point to add your custom data. Available in server and client. */\n custom?: Record<string, any>\n /**\n * Custom description for collection\n */\n description?: EntityDescription\n /**\n * Place globals into a navigational group\n * */\n group?: Record<string, string> | string\n /**\n * Exclude the global from the admin nav and routes\n */\n hidden?: ((args: { user: PayloadRequest['user'] }) => boolean) | boolean\n /**\n * Hide the API URL within the Edit view\n */\n hideAPIURL?: boolean\n /**\n * Live preview options\n */\n livePreview?: LivePreviewConfig\n meta?: {\n description?: string\n openGraph?: OpenGraphConfig\n }\n /**\n * Function to generate custom preview URL\n */\n preview?: GeneratePreviewURL\n}\n\nexport type GlobalConfig = {\n access?: {\n read?: Access\n readDrafts?: Access\n readVersions?: Access\n update?: Access\n }\n admin?: GlobalAdminOptions\n /** Extension point to add your custom data. Server only. */\n custom?: Record<string, any>\n /**\n * Customize the SQL table name\n */\n dbName?: DBIdentifierName\n endpoints?: Omit<Endpoint, 'root'>[] | false\n fields: Field[]\n graphQL?:\n | {\n name?: string\n }\n | false\n hooks?: {\n afterChange?: AfterChangeHook[]\n afterRead?: AfterReadHook[]\n beforeChange?: BeforeChangeHook[]\n beforeRead?: BeforeReadHook[]\n beforeValidate?: BeforeValidateHook[]\n }\n label?: Record<string, string> | string\n slug: string\n /**\n * Options used in typescript generation\n */\n typescript?: {\n /**\n * Typescript generation name given to the interface type\n */\n interface?: string\n }\n versions?: IncomingGlobalVersions | boolean\n}\n\nexport interface SanitizedGlobalConfig\n extends Omit<DeepRequired<GlobalConfig>, 'endpoints' | 'fields' | 'versions'> {\n endpoints: Endpoint[] | false\n fields: Field[]\n versions: SanitizedGlobalVersions\n}\n\nexport type Globals = {\n config: SanitizedGlobalConfig[]\n graphQL?:\n | {\n [slug: string]: {\n mutationInputType: GraphQLNonNull<any>\n type: GraphQLObjectType\n versionType?: GraphQLObjectType\n }\n }\n | false\n}\n"],"names":[],"mappings":"AA6LA,WAWC"}
@@ -1,9 +1,9 @@
1
1
  import type { GlobalPermission } from '../../auth/index.js';
2
- import type { PayloadRequestWithData } from '../../types/index.js';
2
+ import type { PayloadRequest } from '../../types/index.js';
3
3
  import type { SanitizedGlobalConfig } from '../config/types.js';
4
4
  type Arguments = {
5
5
  globalConfig: SanitizedGlobalConfig;
6
- req: PayloadRequestWithData;
6
+ req: PayloadRequest;
7
7
  };
8
8
  export declare const docAccessOperation: (args: Arguments) => Promise<GlobalPermission>;
9
9
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"docAccess.d.ts","sourceRoot":"","sources":["../../../src/globals/operations/docAccess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,KAAK,EAAiB,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AACjF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAO/D,KAAK,SAAS,GAAG;IACf,YAAY,EAAE,qBAAqB,CAAA;IACnC,GAAG,EAAE,sBAAsB,CAAA;CAC5B,CAAA;AAED,eAAO,MAAM,kBAAkB,SAAgB,SAAS,KAAG,OAAO,CAAC,gBAAgB,CAuBlF,CAAA"}
1
+ {"version":3,"file":"docAccess.d.ts","sourceRoot":"","sources":["../../../src/globals/operations/docAccess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACzE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAO/D,KAAK,SAAS,GAAG;IACf,YAAY,EAAE,qBAAqB,CAAA;IACnC,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,kBAAkB,SAAgB,SAAS,KAAG,OAAO,CAAC,gBAAgB,CAuBlF,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/globals/operations/docAccess.ts"],"sourcesContent":["import type { GlobalPermission } from '../../auth/index.js'\nimport type { AllOperations, PayloadRequestWithData } from '../../types/index.js'\nimport type { SanitizedGlobalConfig } from '../config/types.js'\n\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { getEntityPolicies } from '../../utilities/getEntityPolicies.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\n\ntype Arguments = {\n globalConfig: SanitizedGlobalConfig\n req: PayloadRequestWithData\n}\n\nexport const docAccessOperation = async (args: Arguments): Promise<GlobalPermission> => {\n const { globalConfig, req } = args\n\n const globalOperations: AllOperations[] = ['read', 'update']\n\n if (globalConfig.versions) {\n globalOperations.push('readVersions')\n }\n\n try {\n const shouldCommit = await initTransaction(req)\n const result = await getEntityPolicies({\n type: 'global',\n entity: globalConfig,\n operations: globalOperations,\n req,\n })\n if (shouldCommit) await commitTransaction(req)\n return result\n } catch (e: unknown) {\n await killTransaction(req)\n throw e\n }\n}\n"],"names":["commitTransaction","getEntityPolicies","initTransaction","killTransaction","docAccessOperation","args","globalConfig","req","globalOperations","versions","push","shouldCommit","result","type","entity","operations","e"],"mappings":"AAIA,SAASA,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;AAOpE,OAAO,MAAMC,qBAAqB,OAAOC;IACvC,MAAM,EAAEC,YAAY,EAAEC,GAAG,EAAE,GAAGF;IAE9B,MAAMG,mBAAoC;QAAC;QAAQ;KAAS;IAE5D,IAAIF,aAAaG,QAAQ,EAAE;QACzBD,iBAAiBE,IAAI,CAAC;IACxB;IAEA,IAAI;QACF,MAAMC,eAAe,MAAMT,gBAAgBK;QAC3C,MAAMK,SAAS,MAAMX,kBAAkB;YACrCY,MAAM;YACNC,QAAQR;YACRS,YAAYP;YACZD;QACF;QACA,IAAII,cAAc,MAAMX,kBAAkBO;QAC1C,OAAOK;IACT,EAAE,OAAOI,GAAY;QACnB,MAAMb,gBAAgBI;QACtB,MAAMS;IACR;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/globals/operations/docAccess.ts"],"sourcesContent":["import type { GlobalPermission } from '../../auth/index.js'\nimport type { AllOperations, PayloadRequest } from '../../types/index.js'\nimport type { SanitizedGlobalConfig } from '../config/types.js'\n\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { getEntityPolicies } from '../../utilities/getEntityPolicies.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\n\ntype Arguments = {\n globalConfig: SanitizedGlobalConfig\n req: PayloadRequest\n}\n\nexport const docAccessOperation = async (args: Arguments): Promise<GlobalPermission> => {\n const { globalConfig, req } = args\n\n const globalOperations: AllOperations[] = ['read', 'update']\n\n if (globalConfig.versions) {\n globalOperations.push('readVersions')\n }\n\n try {\n const shouldCommit = await initTransaction(req)\n const result = await getEntityPolicies({\n type: 'global',\n entity: globalConfig,\n operations: globalOperations,\n req,\n })\n if (shouldCommit) await commitTransaction(req)\n return result\n } catch (e: unknown) {\n await killTransaction(req)\n throw e\n }\n}\n"],"names":["commitTransaction","getEntityPolicies","initTransaction","killTransaction","docAccessOperation","args","globalConfig","req","globalOperations","versions","push","shouldCommit","result","type","entity","operations","e"],"mappings":"AAIA,SAASA,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;AAOpE,OAAO,MAAMC,qBAAqB,OAAOC;IACvC,MAAM,EAAEC,YAAY,EAAEC,GAAG,EAAE,GAAGF;IAE9B,MAAMG,mBAAoC;QAAC;QAAQ;KAAS;IAE5D,IAAIF,aAAaG,QAAQ,EAAE;QACzBD,iBAAiBE,IAAI,CAAC;IACxB;IAEA,IAAI;QACF,MAAMC,eAAe,MAAMT,gBAAgBK;QAC3C,MAAMK,SAAS,MAAMX,kBAAkB;YACrCY,MAAM;YACNC,QAAQR;YACRS,YAAYP;YACZD;QACF;QACA,IAAII,cAAc,MAAMX,kBAAkBO;QAC1C,OAAOK;IACT,EAAE,OAAOI,GAAY;QACnB,MAAMb,gBAAgBI;QACtB,MAAMS;IACR;AACF,EAAC"}
@@ -1,11 +1,11 @@
1
- import type { PayloadRequestWithData } from '../../types/index.js';
1
+ import type { PayloadRequest } from '../../types/index.js';
2
2
  import type { SanitizedGlobalConfig } from '../config/types.js';
3
3
  type Args = {
4
4
  depth?: number;
5
5
  draft?: boolean;
6
6
  globalConfig: SanitizedGlobalConfig;
7
7
  overrideAccess?: boolean;
8
- req: PayloadRequestWithData;
8
+ req: PayloadRequest;
9
9
  showHiddenFields?: boolean;
10
10
  slug: string;
11
11
  };
@@ -1 +1 @@
1
- {"version":3,"file":"findOne.d.ts","sourceRoot":"","sources":["../../../src/globals/operations/findOne.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAS,MAAM,sBAAsB,CAAA;AACzE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAS/D,KAAK,IAAI,GAAG;IACV,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,YAAY,EAAE,qBAAqB,CAAA;IACnC,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,GAAG,EAAE,sBAAsB,CAAA;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAU,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAChE,IAAI,KACT,OAAO,CAAC,CAAC,CAuHX,CAAA"}
1
+ {"version":3,"file":"findOne.d.ts","sourceRoot":"","sources":["../../../src/globals/operations/findOne.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAS,MAAM,sBAAsB,CAAA;AACjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAS/D,KAAK,IAAI,GAAG;IACV,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,YAAY,EAAE,qBAAqB,CAAA;IACnC,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,GAAG,EAAE,cAAc,CAAA;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAU,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAChE,IAAI,KACT,OAAO,CAAC,CAAC,CAuHX,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/globals/operations/findOne.ts"],"sourcesContent":["import type { AccessResult } from '../../config/types.js'\nimport type { GeneratedTypes } from '../../index.js'\nimport type { PayloadRequestWithData, Where } from '../../types/index.js'\nimport type { SanitizedGlobalConfig } from '../config/types.js'\n\nimport executeAccess from '../../auth/executeAccess.js'\nimport { afterRead } from '../../fields/hooks/afterRead/index.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport replaceWithDraftIfAvailable from '../../versions/drafts/replaceWithDraftIfAvailable.js'\n\ntype Args = {\n depth?: number\n draft?: boolean\n globalConfig: SanitizedGlobalConfig\n overrideAccess?: boolean\n req: PayloadRequestWithData\n showHiddenFields?: boolean\n slug: string\n}\n\nexport const findOneOperation = async <T extends Record<string, unknown>>(\n args: Args,\n): Promise<T> => {\n const {\n slug,\n depth,\n draft: draftEnabled = false,\n globalConfig,\n overrideAccess = false,\n req: { fallbackLocale, locale },\n req,\n showHiddenFields,\n } = args\n\n try {\n const shouldCommit = await initTransaction(req)\n\n // /////////////////////////////////////\n // Retrieve and execute access\n // /////////////////////////////////////\n\n let accessResult: AccessResult\n\n if (!overrideAccess) {\n accessResult = await executeAccess({ req }, globalConfig.access.read)\n }\n\n // /////////////////////////////////////\n // Perform database operation\n // /////////////////////////////////////\n\n let doc = await req.payload.db.findGlobal({\n slug,\n locale,\n req,\n where: overrideAccess ? undefined : (accessResult as Where),\n })\n if (!doc) {\n doc = {}\n }\n\n // /////////////////////////////////////\n // Replace document with draft if available\n // /////////////////////////////////////\n\n if (globalConfig.versions?.drafts && draftEnabled) {\n doc = await replaceWithDraftIfAvailable({\n accessResult,\n doc,\n entity: globalConfig,\n entityType: 'global',\n overrideAccess,\n req,\n })\n }\n\n // /////////////////////////////////////\n // Execute before global hook\n // /////////////////////////////////////\n\n await globalConfig.hooks.beforeRead.reduce(async (priorHook, hook) => {\n await priorHook\n\n doc =\n (await hook({\n context: req.context,\n doc,\n global: globalConfig,\n req,\n })) || doc\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // Execute field-level hooks and access\n // /////////////////////////////////////\n\n doc = await afterRead({\n collection: null,\n context: req.context,\n depth,\n doc,\n draft: draftEnabled,\n fallbackLocale,\n global: globalConfig,\n locale,\n overrideAccess,\n req,\n showHiddenFields,\n })\n\n // /////////////////////////////////////\n // Execute after global hook\n // /////////////////////////////////////\n\n await globalConfig.hooks.afterRead.reduce(async (priorHook, hook) => {\n await priorHook\n\n doc =\n (await hook({\n context: req.context,\n doc,\n global: globalConfig,\n req,\n })) || doc\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // Return results\n // /////////////////////////////////////\n\n if (shouldCommit) await commitTransaction(req)\n\n // /////////////////////////////////////\n // Return results\n // /////////////////////////////////////\n\n return doc\n } catch (error: unknown) {\n await killTransaction(req)\n throw error\n }\n}\n"],"names":["executeAccess","afterRead","commitTransaction","initTransaction","killTransaction","replaceWithDraftIfAvailable","findOneOperation","args","slug","depth","draft","draftEnabled","globalConfig","overrideAccess","req","fallbackLocale","locale","showHiddenFields","shouldCommit","accessResult","access","read","doc","payload","db","findGlobal","where","undefined","versions","drafts","entity","entityType","hooks","beforeRead","reduce","priorHook","hook","context","global","Promise","resolve","collection","error"],"mappings":"AAKA,OAAOA,mBAAmB,8BAA6B;AACvD,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,OAAOC,iCAAiC,uDAAsD;AAY9F,OAAO,MAAMC,mBAAmB,OAC9BC;IAEA,MAAM,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YACRI;YACAH;YACAC;YACAG;QACF;QAEA,wCAAwC;QACxC,4BAA4B;QAC5B,wCAAwC;QAExC,MAAML,aAAaoB,KAAK,CAAC/B,SAAS,CAACiC,MAAM,CAAC,OAAOC,WAAWC;YAC1D,MAAMD;YAENb,MACE,AAAC,MAAMc,KAAK;gBACVC,SAASvB,IAAIuB,OAAO;gBACpBf;gBACAgB,QAAQ1B;gBACRE;YACF,MAAOQ;QACX,GAAGiB,QAAQC,OAAO;QAElB,wCAAwC;QACxC,iBAAiB;QACjB,wCAAwC;QAExC,IAAItB,cAAc,MAAMhB,kBAAkBY;QAE1C,wCAAwC;QACxC,iBAAiB;QACjB,wCAAwC;QAExC,OAAOQ;IACT,EAAE,OAAOoB,OAAgB;QACvB,MAAMtC,gBAAgBU;QACtB,MAAM4B;IACR;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/globals/operations/findOne.ts"],"sourcesContent":["import type { AccessResult } from '../../config/types.js'\nimport type { GeneratedTypes } from '../../index.js'\nimport type { PayloadRequest, Where } from '../../types/index.js'\nimport type { SanitizedGlobalConfig } from '../config/types.js'\n\nimport executeAccess from '../../auth/executeAccess.js'\nimport { afterRead } from '../../fields/hooks/afterRead/index.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport replaceWithDraftIfAvailable from '../../versions/drafts/replaceWithDraftIfAvailable.js'\n\ntype Args = {\n depth?: number\n draft?: boolean\n globalConfig: SanitizedGlobalConfig\n overrideAccess?: boolean\n req: PayloadRequest\n showHiddenFields?: boolean\n slug: string\n}\n\nexport const findOneOperation = async <T extends Record<string, unknown>>(\n args: Args,\n): Promise<T> => {\n const {\n slug,\n depth,\n draft: draftEnabled = false,\n globalConfig,\n overrideAccess = false,\n req: { fallbackLocale, locale },\n req,\n showHiddenFields,\n } = args\n\n try {\n const shouldCommit = await initTransaction(req)\n\n // /////////////////////////////////////\n // Retrieve and execute access\n // /////////////////////////////////////\n\n let accessResult: AccessResult\n\n if (!overrideAccess) {\n accessResult = await executeAccess({ req }, globalConfig.access.read)\n }\n\n // /////////////////////////////////////\n // Perform database operation\n // /////////////////////////////////////\n\n let doc = await req.payload.db.findGlobal({\n slug,\n locale,\n req,\n where: overrideAccess ? undefined : (accessResult as Where),\n })\n if (!doc) {\n doc = {}\n }\n\n // /////////////////////////////////////\n // Replace document with draft if available\n // /////////////////////////////////////\n\n if (globalConfig.versions?.drafts && draftEnabled) {\n doc = await replaceWithDraftIfAvailable({\n accessResult,\n doc,\n entity: globalConfig,\n entityType: 'global',\n overrideAccess,\n req,\n })\n }\n\n // /////////////////////////////////////\n // Execute before global hook\n // /////////////////////////////////////\n\n await globalConfig.hooks.beforeRead.reduce(async (priorHook, hook) => {\n await priorHook\n\n doc =\n (await hook({\n context: req.context,\n doc,\n global: globalConfig,\n req,\n })) || doc\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // Execute field-level hooks and access\n // /////////////////////////////////////\n\n doc = await afterRead({\n collection: null,\n context: req.context,\n depth,\n doc,\n draft: draftEnabled,\n fallbackLocale,\n global: globalConfig,\n locale,\n overrideAccess,\n req,\n showHiddenFields,\n })\n\n // /////////////////////////////////////\n // Execute after global hook\n // /////////////////////////////////////\n\n await globalConfig.hooks.afterRead.reduce(async (priorHook, hook) => {\n await priorHook\n\n doc =\n (await hook({\n context: req.context,\n doc,\n global: globalConfig,\n req,\n })) || doc\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // Return results\n // /////////////////////////////////////\n\n if (shouldCommit) await commitTransaction(req)\n\n // /////////////////////////////////////\n // Return results\n // /////////////////////////////////////\n\n return doc\n } catch (error: unknown) {\n await killTransaction(req)\n throw error\n }\n}\n"],"names":["executeAccess","afterRead","commitTransaction","initTransaction","killTransaction","replaceWithDraftIfAvailable","findOneOperation","args","slug","depth","draft","draftEnabled","globalConfig","overrideAccess","req","fallbackLocale","locale","showHiddenFields","shouldCommit","accessResult","access","read","doc","payload","db","findGlobal","where","undefined","versions","drafts","entity","entityType","hooks","beforeRead","reduce","priorHook","hook","context","global","Promise","resolve","collection","error"],"mappings":"AAKA,OAAOA,mBAAmB,8BAA6B;AACvD,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,OAAOC,iCAAiC,uDAAsD;AAY9F,OAAO,MAAMC,mBAAmB,OAC9BC;IAEA,MAAM,EACJC,IAAI,EACJC,KAAK,EACLC,OAAOC,eAAe,KAAK,EAC3BC,YAAY,EACZC,iBAAiB,KAAK,EACtBC,KAAK,EAAEC,cAAc,EAAEC,MAAM,EAAE,EAC/BF,GAAG,EACHG,gBAAgB,EACjB,GAAGV;IAEJ,IAAI;QACF,MAAMW,eAAe,MAAMf,gBAAgBW;QAE3C,wCAAwC;QACxC,8BAA8B;QAC9B,wCAAwC;QAExC,IAAIK;QAEJ,IAAI,CAACN,gBAAgB;YACnBM,eAAe,MAAMnB,cAAc;gBAAEc;YAAI,GAAGF,aAAaQ,MAAM,CAACC,IAAI;QACtE;QAEA,wCAAwC;QACxC,6BAA6B;QAC7B,wCAAwC;QAExC,IAAIC,MAAM,MAAMR,IAAIS,OAAO,CAACC,EAAE,CAACC,UAAU,CAAC;YACxCjB;YACAQ;YACAF;YACAY,OAAOb,iBAAiBc,YAAaR;QACvC;QACA,IAAI,CAACG,KAAK;YACRA,MAAM,CAAC;QACT;QAEA,wCAAwC;QACxC,2CAA2C;QAC3C,wCAAwC;QAExC,IAAIV,aAAagB,QAAQ,EAAEC,UAAUlB,cAAc;YACjDW,MAAM,MAAMjB,4BAA4B;gBACtCc;gBACAG;gBACAQ,QAAQlB;gBACRmB,YAAY;gBACZlB;gBACAC;YACF;QACF;QAEA,wCAAwC;QACxC,6BAA6B;QAC7B,wCAAwC;QAExC,MAAMF,aAAaoB,KAAK,CAACC,UAAU,CAACC,MAAM,CAAC,OAAOC,WAAWC;YAC3D,MAAMD;YAENb,MACE,AAAC,MAAMc,KAAK;gBACVC,SAASvB,IAAIuB,OAAO;gBACpBf;gBACAgB,QAAQ1B;gBACRE;YACF,MAAOQ;QACX,GAAGiB,QAAQC,OAAO;QAElB,wCAAwC;QACxC,uCAAuC;QACvC,wCAAwC;QAExClB,MAAM,MAAMrB,UAAU;YACpBwC,YAAY;YACZJ,SAASvB,IAAIuB,OAAO;YACpB5B;YACAa;YACAZ,OAAOC;YACPI;YACAuB,QAAQ1B;YACRI;YACAH;YACAC;YACAG;QACF;QAEA,wCAAwC;QACxC,4BAA4B;QAC5B,wCAAwC;QAExC,MAAML,aAAaoB,KAAK,CAAC/B,SAAS,CAACiC,MAAM,CAAC,OAAOC,WAAWC;YAC1D,MAAMD;YAENb,MACE,AAAC,MAAMc,KAAK;gBACVC,SAASvB,IAAIuB,OAAO;gBACpBf;gBACAgB,QAAQ1B;gBACRE;YACF,MAAOQ;QACX,GAAGiB,QAAQC,OAAO;QAElB,wCAAwC;QACxC,iBAAiB;QACjB,wCAAwC;QAExC,IAAItB,cAAc,MAAMhB,kBAAkBY;QAE1C,wCAAwC;QACxC,iBAAiB;QACjB,wCAAwC;QAExC,OAAOQ;IACT,EAAE,OAAOoB,OAAgB;QACvB,MAAMtC,gBAAgBU;QACtB,MAAM4B;IACR;AACF,EAAC"}
@@ -1,4 +1,4 @@
1
- import type { PayloadRequestWithData } from '../../types/index.js';
1
+ import type { PayloadRequest } from '../../types/index.js';
2
2
  import type { TypeWithVersion } from '../../versions/types.js';
3
3
  import type { SanitizedGlobalConfig } from '../config/types.js';
4
4
  export type Arguments = {
@@ -8,7 +8,7 @@ export type Arguments = {
8
8
  globalConfig: SanitizedGlobalConfig;
9
9
  id: number | string;
10
10
  overrideAccess?: boolean;
11
- req: PayloadRequestWithData;
11
+ req: PayloadRequest;
12
12
  showHiddenFields?: boolean;
13
13
  };
14
14
  export declare const findVersionByIDOperation: <T extends TypeWithVersion<T> = any>(args: Arguments) => Promise<T>;
@@ -1 +1 @@
1
- {"version":3,"file":"findVersionByID.d.ts","sourceRoot":"","sources":["../../../src/globals/operations/findVersionByID.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAU/D,MAAM,MAAM,SAAS,GAAG;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,YAAY,EAAE,qBAAqB,CAAA;IACnC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,GAAG,EAAE,sBAAsB,CAAA;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAU,CAAC,SAAS,eAAe,CAAC,CAAC,CAAC,cACnE,SAAS,KACd,OAAO,CAAC,CAAC,CA0HX,CAAA"}
1
+ {"version":3,"file":"findVersionByID.d.ts","sourceRoot":"","sources":["../../../src/globals/operations/findVersionByID.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAU/D,MAAM,MAAM,SAAS,GAAG;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,YAAY,EAAE,qBAAqB,CAAA;IACnC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,GAAG,EAAE,cAAc,CAAA;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAU,CAAC,SAAS,eAAe,CAAC,CAAC,CAAC,cACnE,SAAS,KACd,OAAO,CAAC,CAAC,CA0HX,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/globals/operations/findVersionByID.ts"],"sourcesContent":["/* eslint-disable no-underscore-dangle */\nimport type { FindGlobalVersionsArgs } from '../../database/types.js'\nimport type { PayloadRequestWithData } from '../../types/index.js'\nimport type { TypeWithVersion } from '../../versions/types.js'\nimport type { SanitizedGlobalConfig } from '../config/types.js'\n\nimport executeAccess from '../../auth/executeAccess.js'\nimport { combineQueries } from '../../database/combineQueries.js'\nimport { Forbidden, NotFound } from '../../errors/index.js'\nimport { afterRead } from '../../fields/hooks/afterRead/index.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\n\nexport type Arguments = {\n currentDepth?: number\n depth?: number\n disableErrors?: boolean\n globalConfig: SanitizedGlobalConfig\n id: number | string\n overrideAccess?: boolean\n req: PayloadRequestWithData\n showHiddenFields?: boolean\n}\n\nexport const findVersionByIDOperation = async <T extends TypeWithVersion<T> = any>(\n args: Arguments,\n): Promise<T> => {\n const {\n id,\n currentDepth,\n depth,\n disableErrors,\n globalConfig,\n overrideAccess,\n req: { fallbackLocale, locale, payload },\n req,\n showHiddenFields,\n } = args\n\n try {\n const shouldCommit = await initTransaction(req)\n\n // /////////////////////////////////////\n // Access\n // /////////////////////////////////////\n\n const accessResults = !overrideAccess\n ? await executeAccess({ id, disableErrors, req }, globalConfig.access.readVersions)\n : true\n\n // If errors are disabled, and access returns false, return null\n if (accessResults === false) return null\n\n const hasWhereAccess = typeof accessResults === 'object'\n\n const findGlobalVersionsArgs: FindGlobalVersionsArgs = {\n global: globalConfig.slug,\n limit: 1,\n locale,\n req,\n where: combineQueries({ id: { equals: id } }, accessResults),\n }\n\n // /////////////////////////////////////\n // Find by ID\n // /////////////////////////////////////\n\n if (!findGlobalVersionsArgs.where.and[0].id) throw new NotFound(req.t)\n\n const { docs: results } = await payload.db.findGlobalVersions(findGlobalVersionsArgs)\n if (!results || results?.length === 0) {\n if (!disableErrors) {\n if (!hasWhereAccess) throw new NotFound(req.t)\n if (hasWhereAccess) throw new Forbidden(req.t)\n }\n\n return null\n }\n\n // Clone the result - it may have come back memoized\n let result = JSON.parse(JSON.stringify(results[0]))\n\n // Patch globalType onto version doc\n result.version.globalType = globalConfig.slug\n\n // /////////////////////////////////////\n // beforeRead - Collection\n // /////////////////////////////////////\n\n await globalConfig.hooks.beforeRead.reduce(async (priorHook, hook) => {\n await priorHook\n\n result =\n (await hook({\n context: req.context,\n doc: result.version,\n global: globalConfig,\n req,\n })) || result.version\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // afterRead - Fields\n // /////////////////////////////////////\n\n result.version = await afterRead({\n collection: null,\n context: req.context,\n currentDepth,\n depth,\n doc: result.version,\n draft: undefined,\n fallbackLocale,\n global: globalConfig,\n locale,\n overrideAccess,\n req,\n showHiddenFields,\n })\n\n // /////////////////////////////////////\n // afterRead - Global\n // /////////////////////////////////////\n\n await globalConfig.hooks.afterRead.reduce(async (priorHook, hook) => {\n await priorHook\n\n result.version =\n (await hook({\n context: req.context,\n doc: result.version,\n global: globalConfig,\n query: findGlobalVersionsArgs.where,\n req,\n })) || result.version\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // Return results\n // /////////////////////////////////////\n\n if (shouldCommit) await commitTransaction(req)\n\n return result\n } catch (error: unknown) {\n await killTransaction(req)\n throw error\n }\n}\n"],"names":["executeAccess","combineQueries","Forbidden","NotFound","afterRead","commitTransaction","initTransaction","killTransaction","findVersionByIDOperation","args","id","currentDepth","depth","disableErrors","globalConfig","overrideAccess","req","fallbackLocale","locale","payload","showHiddenFields","shouldCommit","accessResults","access","readVersions","hasWhereAccess","findGlobalVersionsArgs","global","slug","limit","where","equals","and","t","docs","results","db","findGlobalVersions","length","result","JSON","parse","stringify","version","globalType","hooks","beforeRead","reduce","priorHook","hook","context","doc","Promise","resolve","collection","draft","undefined","query","error"],"mappings":"AAAA,uCAAuC,GAMvC,OAAOA,mBAAmB,8BAA6B;AACvD,SAASC,cAAc,QAAQ,mCAAkC;AACjE,SAASC,SAAS,EAAEC,QAAQ,QAAQ,wBAAuB;AAC3D,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;AAapE,OAAO,MAAMC,2BAA2B,OACtCC;IAEA,MAAM,EACJC,EAAE,EACFC,YAAY,EACZC,KAAK,EACLC,aAAa,EACbC,YAAY,EACZC,cAAc,EACdC,KAAK,EAAEC,cAAc,EAAEC,MAAM,EAAEC,OAAO,EAAE,EACxCH,GAAG,EACHI,gBAAgB,EACjB,GAAGX;IAEJ,IAAI;QACF,MAAMY,eAAe,MAAMf,gBAAgBU;QAE3C,wCAAwC;QACxC,SAAS;QACT,wCAAwC;QAExC,MAAMM,gBAAgB,CAACP,iBACnB,MAAMf,cAAc;YAAEU;YAAIG;YAAeG;QAAI,GAAGF,aAAaS,MAAM,CAACC,YAAY,IAChF;QAEJ,gEAAgE;QAChE,IAAIF,kBAAkB,OAAO,OAAO;QAEpC,MAAMG,iBAAiB,OAAOH,kBAAkB;QAEhD,MAAMI,yBAAiD;YACrDC,QAAQb,aAAac,IAAI;YACzBC,OAAO;YACPX;YACAF;YACAc,OAAO7B,eAAe;gBAAES,IAAI;oBAAEqB,QAAQrB;gBAAG;YAAE,GAAGY;QAChD;QAEA,wCAAwC;QACxC,aAAa;QACb,wCAAwC;QAExC,IAAI,CAACI,uBAAuBI,KAAK,CAACE,GAAG,CAAC,EA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BACVC,SAASlC,IAAIkC,OAAO;gBACpBC,KAAKZ,OAAOI,OAAO;gBACnBhB,QAAQb;gBACR2C,OAAO/B,uBAAuBI,KAAK;gBACnCd;YACF,MAAOuB,OAAOI,OAAO;QACzB,GAAGS,QAAQC,OAAO;QAElB,wCAAwC;QACxC,iBAAiB;QACjB,wCAAwC;QAExC,IAAIhC,cAAc,MAAMhB,kBAAkBW;QAE1C,OAAOuB;IACT,EAAE,OAAOmB,OAAgB;QACvB,MAAMnD,gBAAgBS;QACtB,MAAM0C;IACR;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/globals/operations/findVersionByID.ts"],"sourcesContent":["/* eslint-disable no-underscore-dangle */\nimport type { FindGlobalVersionsArgs } from '../../database/types.js'\nimport type { PayloadRequest } from '../../types/index.js'\nimport type { TypeWithVersion } from '../../versions/types.js'\nimport type { SanitizedGlobalConfig } from '../config/types.js'\n\nimport executeAccess from '../../auth/executeAccess.js'\nimport { combineQueries } from '../../database/combineQueries.js'\nimport { Forbidden, NotFound } from '../../errors/index.js'\nimport { afterRead } from '../../fields/hooks/afterRead/index.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\n\nexport type Arguments = {\n currentDepth?: number\n depth?: number\n disableErrors?: boolean\n globalConfig: SanitizedGlobalConfig\n id: number | string\n overrideAccess?: boolean\n req: PayloadRequest\n showHiddenFields?: boolean\n}\n\nexport const findVersionByIDOperation = async <T extends TypeWithVersion<T> = any>(\n args: Arguments,\n): Promise<T> => {\n const {\n id,\n currentDepth,\n depth,\n disableErrors,\n globalConfig,\n overrideAccess,\n req: { fallbackLocale, locale, payload },\n req,\n showHiddenFields,\n } = args\n\n try {\n const shouldCommit = await initTransaction(req)\n\n // /////////////////////////////////////\n // Access\n // /////////////////////////////////////\n\n const accessResults = !overrideAccess\n ? await executeAccess({ id, disableErrors, req }, globalConfig.access.readVersions)\n : true\n\n // If errors are disabled, and access returns false, return null\n if (accessResults === false) return null\n\n const hasWhereAccess = typeof accessResults === 'object'\n\n const findGlobalVersionsArgs: FindGlobalVersionsArgs = {\n global: globalConfig.slug,\n limit: 1,\n locale,\n req,\n where: combineQueries({ id: { equals: id } }, accessResults),\n }\n\n // /////////////////////////////////////\n // Find by ID\n // /////////////////////////////////////\n\n if (!findGlobalVersionsArgs.where.and[0].id) throw new NotFound(req.t)\n\n const { docs: results } = await payload.db.findGlobalVersions(findGlobalVersionsArgs)\n if (!results || results?.length === 0) {\n if (!disableErrors) {\n if (!hasWhereAccess) throw new NotFound(req.t)\n if (hasWhereAccess) throw new Forbidden(req.t)\n }\n\n return null\n }\n\n // Clone the result - it may have come back memoized\n let result = JSON.parse(JSON.stringify(results[0]))\n\n // Patch globalType onto version doc\n result.version.globalType = globalConfig.slug\n\n // /////////////////////////////////////\n // beforeRead - Collection\n // /////////////////////////////////////\n\n await globalConfig.hooks.beforeRead.reduce(async (priorHook, hook) => {\n await priorHook\n\n result =\n (await hook({\n context: req.context,\n doc: result.version,\n global: globalConfig,\n req,\n })) || result.version\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // afterRead - Fields\n // /////////////////////////////////////\n\n result.version = await afterRead({\n collection: null,\n context: req.context,\n currentDepth,\n depth,\n doc: result.version,\n draft: undefined,\n fallbackLocale,\n global: globalConfig,\n locale,\n overrideAccess,\n req,\n showHiddenFields,\n })\n\n // /////////////////////////////////////\n // afterRead - Global\n // /////////////////////////////////////\n\n await globalConfig.hooks.afterRead.reduce(async (priorHook, hook) => {\n await priorHook\n\n result.version =\n (await hook({\n context: req.context,\n doc: result.version,\n global: globalConfig,\n query: findGlobalVersionsArgs.where,\n req,\n })) || result.version\n }, Promise.resolve())\n\n // /////////////////////////////////////\n // Return results\n // /////////////////////////////////////\n\n if (shouldCommit) await commitTransaction(req)\n\n return result\n } catch (error: unknown) {\n await killTransaction(req)\n throw error\n }\n}\n"],"names":["executeAccess","combineQueries","Forbidden","NotFound","afterRead","commitTransaction","initTransaction","killTransaction","findVersionByIDOperation","args","id","currentDepth","depth","disableErrors","globalConfig","overrideAccess","req","fallbackLocale","locale","payload","showHiddenFields","shouldCommit","accessResults","access","readVersions","hasWhereAccess","findGlobalVersionsArgs","global","slug","limit","where","equals","and","t","docs","results","db","findGlobalVersions","length","result","JSON","parse","stringify","version","globalType","hooks","beforeRead","reduce","priorHook","hook","context","doc","Promise","resolve","collection","draft","undefined","query","error"],"mappings":"AAAA,uCAAuC,GAMvC,OAAOA,mBAAmB,8BAA6B;AACvD,SAASC,cAAc,QAAQ,mCAAkC;AACjE,SAASC,SAAS,EAAEC,QAAQ,QAAQ,wBAAuB;AAC3D,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;AAapE,OAAO,MAAMC,2BAA2B,OACtCC;IAEA,MAAM,EACJC,EAAE,EACFC,YAAY,EACZC,KAAK,EACLC,aAAa,EACbC,YAAY,EACZC,cAAc,EACdC,KAAK,EAAEC,cAAc,EAAEC,MAAM,EAAEC,OAAO,EAAE,EACxCH,GAAG,EACHI,gBAAgB,EACjB,GAAGX;IAEJ,IAAI;QACF,MAAMY,eAAe,MAAMf,gBAAgBU;QAE3C,wCAAwC;QACxC,SAAS;QACT,wCAAwC;QAExC,MAAMM,gBAAgB,CAACP,iBACnB,MAAMf,cAAc;YAAEU;YAAIG;YAAeG;QAAI,GAAGF,aAAaS,MAAM,CAACC,YAAY,IAChF;QAEJ,gEAAgE;QAChE,IAAIF,kBAAkB,OAAO,OAAO;QAEpC,MAAMG,iBAAiB,OAAOH,kBAAkB;QAEhD,MAAMI,yBAAiD;YACrDC,QAAQb,aAAac,IAAI;YACzBC,OAAO;YACPX;YACAF;YACAc,OAAO7B,eAAe;gBAAES,IAAI;oBAAEqB,QAAQrB;gBAAG;YAAE,GAAGY;QAChD;QAEA,wCA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AM,CAAC,OAAOC,WAAWC;YAC1D,MAAMD;YAENT,OAAOI,OAAO,GACZ,AAAC,MAAMM,KAAK;gBACVC,SAASlC,IAAIkC,OAAO;gBACpBC,KAAKZ,OAAOI,OAAO;gBACnBhB,QAAQb;gBACR2C,OAAO/B,uBAAuBI,KAAK;gBACnCd;YACF,MAAOuB,OAAOI,OAAO;QACzB,GAAGS,QAAQC,OAAO;QAElB,wCAAwC;QACxC,iBAAiB;QACjB,wCAAwC;QAExC,IAAIhC,cAAc,MAAMhB,kBAAkBW;QAE1C,OAAOuB;IACT,EAAE,OAAOmB,OAAgB;QACvB,MAAMnD,gBAAgBS;QACtB,MAAM0C;IACR;AACF,EAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { PaginatedDocs } from '../../database/types.js';
2
- import type { PayloadRequestWithData, Where } from '../../types/index.js';
2
+ import type { PayloadRequest, Where } from '../../types/index.js';
3
3
  import type { TypeWithVersion } from '../../versions/types.js';
4
4
  import type { SanitizedGlobalConfig } from '../config/types.js';
5
5
  export type Arguments = {
@@ -8,7 +8,7 @@ export type Arguments = {
8
8
  limit?: number;
9
9
  overrideAccess?: boolean;
10
10
  page?: number;
11
- req?: PayloadRequestWithData;
11
+ req?: PayloadRequest;
12
12
  showHiddenFields?: boolean;
13
13
  sort?: string;
14
14
  where?: Where;
@@ -1 +1 @@
1
- {"version":3,"file":"findVersions.d.ts","sourceRoot":"","sources":["../../../src/globals/operations/findVersions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAY/D,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,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