payload 4.0.0-internal.4cbdd50 → 4.0.0-internal.4e1f822

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 (1347) hide show
  1. package/LICENSE.md +1 -1
  2. package/bin.js +14 -10
  3. package/dist/__testing__/predefinedMigration.d.ts +4 -3
  4. package/dist/__testing__/predefinedMigration.d.ts.map +1 -1
  5. package/dist/admin/RichText.d.ts +2 -22
  6. package/dist/admin/RichText.d.ts.map +1 -1
  7. package/dist/admin/RichText.js.map +1 -1
  8. package/dist/admin/adapters/devReload.d.ts +13 -0
  9. package/dist/admin/adapters/devReload.d.ts.map +1 -1
  10. package/dist/admin/adapters/devReload.js +14 -1
  11. package/dist/admin/adapters/devReload.js.map +1 -1
  12. package/dist/admin/adapters/router.d.ts +8 -0
  13. package/dist/admin/adapters/router.d.ts.map +1 -1
  14. package/dist/admin/adapters/router.js.map +1 -1
  15. package/dist/admin/forms/Field.d.ts +2 -2
  16. package/dist/admin/forms/Field.d.ts.map +1 -1
  17. package/dist/admin/forms/Field.js.map +1 -1
  18. package/dist/admin/forms/Form.d.ts +0 -29
  19. package/dist/admin/forms/Form.d.ts.map +1 -1
  20. package/dist/admin/forms/Form.js.map +1 -1
  21. package/dist/admin/functions/index.d.ts +12 -10
  22. package/dist/admin/functions/index.d.ts.map +1 -1
  23. package/dist/admin/functions/index.js.map +1 -1
  24. package/dist/admin/types.d.ts +4 -3
  25. package/dist/admin/types.d.ts.map +1 -1
  26. package/dist/admin/types.js.map +1 -1
  27. package/dist/admin/views/index.d.ts +2 -2
  28. package/dist/admin/views/index.d.ts.map +1 -1
  29. package/dist/admin/views/index.js.map +1 -1
  30. package/dist/auth/baseFields/apiKey.d.ts.map +1 -1
  31. package/dist/auth/baseFields/apiKey.js +16 -1
  32. package/dist/auth/baseFields/apiKey.js.map +1 -1
  33. package/dist/auth/cookies.d.ts +2 -2
  34. package/dist/auth/cookies.d.ts.map +1 -1
  35. package/dist/auth/crypto.d.ts +73 -2
  36. package/dist/auth/crypto.d.ts.map +1 -1
  37. package/dist/auth/crypto.js +90 -13
  38. package/dist/auth/crypto.js.map +1 -1
  39. package/dist/auth/defaultAccess.d.ts.map +1 -1
  40. package/dist/auth/endpoints/login.d.ts.map +1 -1
  41. package/dist/auth/endpoints/login.js +2 -11
  42. package/dist/auth/endpoints/login.js.map +1 -1
  43. package/dist/auth/endpoints/refresh.d.ts.map +1 -1
  44. package/dist/auth/endpoints/refresh.js +4 -6
  45. package/dist/auth/endpoints/refresh.js.map +1 -1
  46. package/dist/auth/ensureUsernameOrEmail.d.ts.map +1 -1
  47. package/dist/auth/executeAccess.d.ts +2 -1
  48. package/dist/auth/executeAccess.d.ts.map +1 -1
  49. package/dist/auth/executeAccess.js +2 -1
  50. package/dist/auth/executeAccess.js.map +1 -1
  51. package/dist/auth/executeAuthStrategies.d.ts.map +1 -1
  52. package/dist/auth/extractAccessFromPermission.d.ts.map +1 -1
  53. package/dist/auth/extractJWT.d.ts +1 -1
  54. package/dist/auth/extractJWT.d.ts.map +1 -1
  55. package/dist/auth/getAccessResults.js +1 -0
  56. package/dist/auth/getAccessResults.js.map +1 -1
  57. package/dist/auth/getAuthFields.d.ts.map +1 -1
  58. package/dist/auth/getFieldsToSign.d.ts +1 -1
  59. package/dist/auth/getFieldsToSign.d.ts.map +1 -1
  60. package/dist/auth/getLoginOptions.d.ts +1 -1
  61. package/dist/auth/getLoginOptions.d.ts.map +1 -1
  62. package/dist/auth/getLoginOptions.js.map +1 -1
  63. package/dist/auth/isUserLocked.d.ts.map +1 -1
  64. package/dist/auth/jwt.d.ts.map +1 -1
  65. package/dist/auth/loginWithCookie.d.ts +33 -0
  66. package/dist/auth/loginWithCookie.d.ts.map +1 -0
  67. package/dist/auth/loginWithCookie.js +34 -0
  68. package/dist/auth/loginWithCookie.js.map +1 -0
  69. package/dist/auth/operations/access.d.ts.map +1 -1
  70. package/dist/auth/operations/access.js +3 -9
  71. package/dist/auth/operations/access.js.map +1 -1
  72. package/dist/auth/operations/auth.d.ts +2 -2
  73. package/dist/auth/operations/auth.d.ts.map +1 -1
  74. package/dist/auth/operations/auth.js +15 -21
  75. package/dist/auth/operations/auth.js.map +1 -1
  76. package/dist/auth/operations/forgotPassword.d.ts.map +1 -1
  77. package/dist/auth/operations/init.d.ts.map +1 -1
  78. package/dist/auth/operations/local/auth.d.ts.map +1 -1
  79. package/dist/auth/operations/login.d.ts +2 -1
  80. package/dist/auth/operations/login.d.ts.map +1 -1
  81. package/dist/auth/operations/login.js.map +1 -1
  82. package/dist/auth/operations/logout.d.ts.map +1 -1
  83. package/dist/auth/operations/me.d.ts +2 -9
  84. package/dist/auth/operations/me.d.ts.map +1 -1
  85. package/dist/auth/operations/me.js +0 -6
  86. package/dist/auth/operations/me.js.map +1 -1
  87. package/dist/auth/operations/refresh.d.ts +0 -7
  88. package/dist/auth/operations/refresh.d.ts.map +1 -1
  89. package/dist/auth/operations/refresh.js +9 -9
  90. package/dist/auth/operations/refresh.js.map +1 -1
  91. package/dist/auth/operations/registerFirstUser.d.ts.map +1 -1
  92. package/dist/auth/operations/resetPassword.d.ts.map +1 -1
  93. package/dist/auth/operations/resetPassword.js.map +1 -1
  94. package/dist/auth/operations/unlock.d.ts.map +1 -1
  95. package/dist/auth/operations/unlock.js +1 -0
  96. package/dist/auth/operations/unlock.js.map +1 -1
  97. package/dist/auth/operations/verifyEmail.d.ts.map +1 -1
  98. package/dist/auth/rotateSecret.d.ts +51 -0
  99. package/dist/auth/rotateSecret.d.ts.map +1 -0
  100. package/dist/auth/rotateSecret.js +131 -0
  101. package/dist/auth/rotateSecret.js.map +1 -0
  102. package/dist/auth/sendVerificationEmail.d.ts +2 -2
  103. package/dist/auth/sendVerificationEmail.d.ts.map +1 -1
  104. package/dist/auth/sendVerificationEmail.js +1 -1
  105. package/dist/auth/sendVerificationEmail.js.map +1 -1
  106. package/dist/auth/serverFunctions/cookies.d.ts +47 -0
  107. package/dist/auth/serverFunctions/cookies.d.ts.map +1 -0
  108. package/dist/auth/serverFunctions/cookies.js +52 -0
  109. package/dist/auth/serverFunctions/cookies.js.map +1 -0
  110. package/dist/auth/serverFunctions/login.d.ts +29 -0
  111. package/dist/auth/serverFunctions/login.d.ts.map +1 -0
  112. package/dist/auth/serverFunctions/login.js +63 -0
  113. package/dist/auth/serverFunctions/login.js.map +1 -0
  114. package/dist/auth/serverFunctions/logout.d.ts +17 -0
  115. package/dist/auth/serverFunctions/logout.d.ts.map +1 -0
  116. package/dist/auth/serverFunctions/logout.js +58 -0
  117. package/dist/auth/serverFunctions/logout.js.map +1 -0
  118. package/dist/auth/serverFunctions/refresh.d.ts +17 -0
  119. package/dist/auth/serverFunctions/refresh.d.ts.map +1 -0
  120. package/dist/auth/serverFunctions/refresh.js +61 -0
  121. package/dist/auth/serverFunctions/refresh.js.map +1 -0
  122. package/dist/auth/sessions.d.ts +4 -5
  123. package/dist/auth/sessions.d.ts.map +1 -1
  124. package/dist/auth/sessions.js +5 -3
  125. package/dist/auth/sessions.js.map +1 -1
  126. package/dist/auth/strategies/apiKey.d.ts.map +1 -1
  127. package/dist/auth/strategies/apiKey.js +5 -3
  128. package/dist/auth/strategies/apiKey.js.map +1 -1
  129. package/dist/auth/strategies/jwt.d.ts.map +1 -1
  130. package/dist/auth/strategies/jwt.js +23 -2
  131. package/dist/auth/strategies/jwt.js.map +1 -1
  132. package/dist/auth/strategies/local/authenticate.d.ts.map +1 -1
  133. package/dist/auth/strategies/local/generatePasswordSaltHash.d.ts.map +1 -1
  134. package/dist/auth/strategies/local/incrementLoginAttempts.d.ts +2 -2
  135. package/dist/auth/strategies/local/incrementLoginAttempts.d.ts.map +1 -1
  136. package/dist/auth/strategies/local/incrementLoginAttempts.js +1 -1
  137. package/dist/auth/strategies/local/incrementLoginAttempts.js.map +1 -1
  138. package/dist/auth/strategies/local/register.d.ts.map +1 -1
  139. package/dist/auth/strategies/local/resetLoginAttempts.d.ts.map +1 -1
  140. package/dist/auth/types.d.ts +34 -35
  141. package/dist/auth/types.d.ts.map +1 -1
  142. package/dist/auth/types.js.map +1 -1
  143. package/dist/auth/withBaseAccess.d.ts +22 -0
  144. package/dist/auth/withBaseAccess.d.ts.map +1 -0
  145. package/dist/auth/withBaseAccess.js +61 -0
  146. package/dist/auth/withBaseAccess.js.map +1 -0
  147. package/dist/cli/commands/build/build.d.ts +44 -0
  148. package/dist/cli/commands/build/build.d.ts.map +1 -0
  149. package/dist/cli/commands/build/build.js +225 -0
  150. package/dist/cli/commands/build/build.js.map +1 -0
  151. package/dist/cli/commands/build/build.spec.js +582 -0
  152. package/dist/cli/commands/build/build.spec.js.map +1 -0
  153. package/dist/cli/commands/build/index.d.ts +2 -0
  154. package/dist/cli/commands/build/index.d.ts.map +1 -0
  155. package/dist/cli/commands/build/index.js +26 -0
  156. package/dist/cli/commands/build/index.js.map +1 -0
  157. package/dist/cli/commands/collections/countDocuments.d.ts +2 -0
  158. package/dist/cli/commands/collections/countDocuments.d.ts.map +1 -0
  159. package/dist/cli/commands/collections/countDocuments.js +37 -0
  160. package/dist/cli/commands/collections/countDocuments.js.map +1 -0
  161. package/dist/cli/commands/collections/countVersions.d.ts +2 -0
  162. package/dist/cli/commands/collections/countVersions.d.ts.map +1 -0
  163. package/dist/cli/commands/collections/countVersions.js +36 -0
  164. package/dist/cli/commands/collections/countVersions.js.map +1 -0
  165. package/dist/cli/commands/collections/createDocuments.d.ts +2 -0
  166. package/dist/cli/commands/collections/createDocuments.d.ts.map +1 -0
  167. package/dist/cli/commands/collections/createDocuments.js +126 -0
  168. package/dist/cli/commands/collections/createDocuments.js.map +1 -0
  169. package/dist/cli/commands/collections/deleteDocuments.d.ts +2 -0
  170. package/dist/cli/commands/collections/deleteDocuments.d.ts.map +1 -0
  171. package/dist/cli/commands/collections/deleteDocuments.js +60 -0
  172. package/dist/cli/commands/collections/deleteDocuments.js.map +1 -0
  173. package/dist/cli/commands/collections/duplicateDocument.d.ts +2 -0
  174. package/dist/cli/commands/collections/duplicateDocument.d.ts.map +1 -0
  175. package/dist/cli/commands/collections/duplicateDocument.js +103 -0
  176. package/dist/cli/commands/collections/duplicateDocument.js.map +1 -0
  177. package/dist/cli/commands/collections/findDistinct.d.ts +2 -0
  178. package/dist/cli/commands/collections/findDistinct.d.ts.map +1 -0
  179. package/dist/cli/commands/collections/findDistinct.js +52 -0
  180. package/dist/cli/commands/collections/findDistinct.js.map +1 -0
  181. package/dist/cli/commands/collections/findDocuments.d.ts +2 -0
  182. package/dist/cli/commands/collections/findDocuments.d.ts.map +1 -0
  183. package/dist/cli/commands/collections/findDocuments.js +75 -0
  184. package/dist/cli/commands/collections/findDocuments.js.map +1 -0
  185. package/dist/cli/commands/collections/findVersionByID.d.ts +2 -0
  186. package/dist/cli/commands/collections/findVersionByID.d.ts.map +1 -0
  187. package/dist/cli/commands/collections/findVersionByID.js +49 -0
  188. package/dist/cli/commands/collections/findVersionByID.js.map +1 -0
  189. package/dist/cli/commands/collections/findVersions.d.ts +2 -0
  190. package/dist/cli/commands/collections/findVersions.d.ts.map +1 -0
  191. package/dist/cli/commands/collections/findVersions.js +57 -0
  192. package/dist/cli/commands/collections/findVersions.js.map +1 -0
  193. package/dist/cli/commands/collections/getCollectionSchema.d.ts +2 -0
  194. package/dist/cli/commands/collections/getCollectionSchema.d.ts.map +1 -0
  195. package/dist/cli/commands/collections/getCollectionSchema.js +49 -0
  196. package/dist/cli/commands/collections/getCollectionSchema.js.map +1 -0
  197. package/dist/cli/commands/collections/restoreVersion.d.ts +2 -0
  198. package/dist/cli/commands/collections/restoreVersion.d.ts.map +1 -0
  199. package/dist/cli/commands/collections/restoreVersion.js +48 -0
  200. package/dist/cli/commands/collections/restoreVersion.js.map +1 -0
  201. package/dist/cli/commands/collections/updateDocument.d.ts +2 -0
  202. package/dist/cli/commands/collections/updateDocument.d.ts.map +1 -0
  203. package/dist/cli/commands/collections/updateDocument.js +178 -0
  204. package/dist/cli/commands/collections/updateDocument.js.map +1 -0
  205. package/dist/cli/commands/data/input.d.ts +10 -0
  206. package/dist/cli/commands/data/input.d.ts.map +1 -0
  207. package/dist/cli/commands/data/input.js +57 -0
  208. package/dist/cli/commands/data/input.js.map +1 -0
  209. package/dist/cli/commands/data/utilities.d.ts +65 -0
  210. package/dist/cli/commands/data/utilities.d.ts.map +1 -0
  211. package/dist/cli/commands/data/utilities.js +67 -0
  212. package/dist/cli/commands/data/utilities.js.map +1 -0
  213. package/dist/cli/commands/generateDBSchema.d.ts +2 -0
  214. package/dist/cli/commands/generateDBSchema.d.ts.map +1 -0
  215. package/dist/cli/commands/generateDBSchema.js +29 -0
  216. package/dist/cli/commands/generateDBSchema.js.map +1 -0
  217. package/dist/cli/commands/generateImportMap/frameworkConventions.d.ts +8 -0
  218. package/dist/cli/commands/generateImportMap/frameworkConventions.d.ts.map +1 -0
  219. package/dist/cli/commands/generateImportMap/frameworkConventions.js +8 -0
  220. package/dist/cli/commands/generateImportMap/frameworkConventions.js.map +1 -0
  221. package/dist/{bin/generateImportMap/index.d.ts → cli/commands/generateImportMap/generateImportMap.d.ts} +8 -4
  222. package/dist/cli/commands/generateImportMap/generateImportMap.d.ts.map +1 -0
  223. package/dist/{bin/generateImportMap/index.js → cli/commands/generateImportMap/generateImportMap.js} +9 -4
  224. package/dist/cli/commands/generateImportMap/generateImportMap.js.map +1 -0
  225. package/dist/cli/commands/generateImportMap/generateImportMap.spec.js.map +1 -0
  226. package/dist/cli/commands/generateImportMap/index.d.ts +2 -0
  227. package/dist/cli/commands/generateImportMap/index.d.ts.map +1 -0
  228. package/dist/cli/commands/generateImportMap/index.js +18 -0
  229. package/dist/cli/commands/generateImportMap/index.js.map +1 -0
  230. package/dist/{bin → cli/commands}/generateImportMap/iterateCollections.d.ts +3 -3
  231. package/dist/cli/commands/generateImportMap/iterateCollections.d.ts.map +1 -0
  232. package/dist/{bin → cli/commands}/generateImportMap/iterateCollections.js +10 -0
  233. package/dist/cli/commands/generateImportMap/iterateCollections.js.map +1 -0
  234. package/dist/{bin → cli/commands}/generateImportMap/iterateConfig.d.ts +2 -2
  235. package/dist/cli/commands/generateImportMap/iterateConfig.d.ts.map +1 -0
  236. package/dist/{bin → cli/commands}/generateImportMap/iterateConfig.js +1 -1
  237. package/dist/cli/commands/generateImportMap/iterateConfig.js.map +1 -0
  238. package/dist/{bin → cli/commands}/generateImportMap/iterateFields.d.ts +3 -3
  239. package/dist/cli/commands/generateImportMap/iterateFields.d.ts.map +1 -0
  240. package/dist/cli/commands/generateImportMap/iterateFields.js.map +1 -0
  241. package/dist/{bin → cli/commands}/generateImportMap/iterateGlobals.d.ts +3 -3
  242. package/dist/cli/commands/generateImportMap/iterateGlobals.d.ts.map +1 -0
  243. package/dist/cli/commands/generateImportMap/iterateGlobals.js.map +1 -0
  244. package/dist/{bin → cli/commands}/generateImportMap/utilities/addPayloadComponentToImportMap.d.ts +2 -2
  245. package/dist/cli/commands/generateImportMap/utilities/addPayloadComponentToImportMap.d.ts.map +1 -0
  246. package/dist/cli/commands/generateImportMap/utilities/addPayloadComponentToImportMap.js.map +1 -0
  247. package/dist/{bin → cli/commands}/generateImportMap/utilities/getFromImportMap.d.ts +2 -2
  248. package/dist/cli/commands/generateImportMap/utilities/getFromImportMap.d.ts.map +1 -0
  249. package/dist/cli/commands/generateImportMap/utilities/getFromImportMap.js.map +1 -0
  250. package/dist/cli/commands/generateImportMap/utilities/getImportMapToBaseDirPath.d.ts.map +1 -0
  251. package/dist/cli/commands/generateImportMap/utilities/getImportMapToBaseDirPath.js.map +1 -0
  252. package/dist/{bin → cli/commands}/generateImportMap/utilities/parsePayloadComponent.d.ts +1 -1
  253. package/dist/cli/commands/generateImportMap/utilities/parsePayloadComponent.d.ts.map +1 -0
  254. package/dist/cli/commands/generateImportMap/utilities/parsePayloadComponent.js.map +1 -0
  255. package/dist/cli/commands/generateImportMap/utilities/resolveImportMapFilePath.d.ts.map +1 -0
  256. package/dist/{bin → cli/commands}/generateImportMap/utilities/resolveImportMapFilePath.js +5 -4
  257. package/dist/cli/commands/generateImportMap/utilities/resolveImportMapFilePath.js.map +1 -0
  258. package/dist/cli/commands/generateTypes.d.ts +12 -0
  259. package/dist/cli/commands/generateTypes.d.ts.map +1 -0
  260. package/dist/{bin → cli/commands}/generateTypes.js +33 -7
  261. package/dist/cli/commands/generateTypes.js.map +1 -0
  262. package/dist/cli/commands/getConfigInfo.d.ts +2 -0
  263. package/dist/cli/commands/getConfigInfo.d.ts.map +1 -0
  264. package/dist/cli/commands/getConfigInfo.js +23 -0
  265. package/dist/cli/commands/getConfigInfo.js.map +1 -0
  266. package/dist/cli/commands/globals/countGlobalVersions.d.ts +2 -0
  267. package/dist/cli/commands/globals/countGlobalVersions.d.ts.map +1 -0
  268. package/dist/cli/commands/globals/countGlobalVersions.js +36 -0
  269. package/dist/cli/commands/globals/countGlobalVersions.js.map +1 -0
  270. package/dist/cli/commands/globals/findGlobal.d.ts +2 -0
  271. package/dist/cli/commands/globals/findGlobal.d.ts.map +1 -0
  272. package/dist/cli/commands/globals/findGlobal.js +42 -0
  273. package/dist/cli/commands/globals/findGlobal.js.map +1 -0
  274. package/dist/cli/commands/globals/findGlobalVersionByID.d.ts +2 -0
  275. package/dist/cli/commands/globals/findGlobalVersionByID.d.ts.map +1 -0
  276. package/dist/cli/commands/globals/findGlobalVersionByID.js +47 -0
  277. package/dist/cli/commands/globals/findGlobalVersionByID.js.map +1 -0
  278. package/dist/cli/commands/globals/findGlobalVersions.d.ts +2 -0
  279. package/dist/cli/commands/globals/findGlobalVersions.d.ts.map +1 -0
  280. package/dist/cli/commands/globals/findGlobalVersions.js +55 -0
  281. package/dist/cli/commands/globals/findGlobalVersions.js.map +1 -0
  282. package/dist/cli/commands/globals/getGlobalSchema.d.ts +2 -0
  283. package/dist/cli/commands/globals/getGlobalSchema.d.ts.map +1 -0
  284. package/dist/cli/commands/globals/getGlobalSchema.js +34 -0
  285. package/dist/cli/commands/globals/getGlobalSchema.js.map +1 -0
  286. package/dist/cli/commands/globals/restoreGlobalVersion.d.ts +2 -0
  287. package/dist/cli/commands/globals/restoreGlobalVersion.d.ts.map +1 -0
  288. package/dist/cli/commands/globals/restoreGlobalVersion.js +47 -0
  289. package/dist/cli/commands/globals/restoreGlobalVersion.js.map +1 -0
  290. package/dist/cli/commands/globals/updateGlobal.d.ts +2 -0
  291. package/dist/cli/commands/globals/updateGlobal.d.ts.map +1 -0
  292. package/dist/cli/commands/globals/updateGlobal.js +93 -0
  293. package/dist/cli/commands/globals/updateGlobal.js.map +1 -0
  294. package/dist/cli/commands/help.d.ts +2 -0
  295. package/dist/cli/commands/help.d.ts.map +1 -0
  296. package/dist/cli/commands/help.js +40 -0
  297. package/dist/cli/commands/help.js.map +1 -0
  298. package/dist/cli/commands/info.d.ts +2 -0
  299. package/dist/cli/commands/info.d.ts.map +1 -0
  300. package/dist/cli/commands/info.js +78 -0
  301. package/dist/cli/commands/info.js.map +1 -0
  302. package/dist/cli/commands/jobs/handleSchedules.d.ts +2 -0
  303. package/dist/cli/commands/jobs/handleSchedules.d.ts.map +1 -0
  304. package/dist/cli/commands/jobs/handleSchedules.js +17 -0
  305. package/dist/cli/commands/jobs/handleSchedules.js.map +1 -0
  306. package/dist/cli/commands/jobs/run.d.ts +2 -0
  307. package/dist/cli/commands/jobs/run.d.ts.map +1 -0
  308. package/dist/cli/commands/jobs/run.js +29 -0
  309. package/dist/cli/commands/jobs/run.js.map +1 -0
  310. package/dist/cli/commands/migrate/create.d.ts +2 -0
  311. package/dist/cli/commands/migrate/create.d.ts.map +1 -0
  312. package/dist/cli/commands/migrate/create.js +44 -0
  313. package/dist/cli/commands/migrate/create.js.map +1 -0
  314. package/dist/cli/commands/migrate/down.d.ts +2 -0
  315. package/dist/cli/commands/migrate/down.d.ts.map +1 -0
  316. package/dist/cli/commands/migrate/down.js +22 -0
  317. package/dist/cli/commands/migrate/down.js.map +1 -0
  318. package/dist/cli/commands/migrate/fresh.d.ts +2 -0
  319. package/dist/cli/commands/migrate/fresh.d.ts.map +1 -0
  320. package/dist/cli/commands/migrate/fresh.js +28 -0
  321. package/dist/cli/commands/migrate/fresh.js.map +1 -0
  322. package/dist/cli/commands/migrate/initialize.d.ts +11 -0
  323. package/dist/cli/commands/migrate/initialize.d.ts.map +1 -0
  324. package/dist/cli/commands/migrate/initialize.js +17 -0
  325. package/dist/cli/commands/migrate/initialize.js.map +1 -0
  326. package/dist/cli/commands/migrate/refresh.d.ts +2 -0
  327. package/dist/cli/commands/migrate/refresh.d.ts.map +1 -0
  328. package/dist/cli/commands/migrate/refresh.js +22 -0
  329. package/dist/cli/commands/migrate/refresh.js.map +1 -0
  330. package/dist/cli/commands/migrate/reset.d.ts +2 -0
  331. package/dist/cli/commands/migrate/reset.d.ts.map +1 -0
  332. package/dist/cli/commands/migrate/reset.js +22 -0
  333. package/dist/cli/commands/migrate/reset.js.map +1 -0
  334. package/dist/cli/commands/migrate/run.d.ts +2 -0
  335. package/dist/cli/commands/migrate/run.d.ts.map +1 -0
  336. package/dist/cli/commands/migrate/run.js +28 -0
  337. package/dist/cli/commands/migrate/run.js.map +1 -0
  338. package/dist/cli/commands/migrate/status.d.ts +2 -0
  339. package/dist/cli/commands/migrate/status.d.ts.map +1 -0
  340. package/dist/cli/commands/migrate/status.js +22 -0
  341. package/dist/cli/commands/migrate/status.js.map +1 -0
  342. package/dist/cli/commands/run.d.ts +2 -0
  343. package/dist/cli/commands/run.d.ts.map +1 -0
  344. package/dist/cli/commands/run.js +45 -0
  345. package/dist/cli/commands/run.js.map +1 -0
  346. package/dist/cli/defineCLICommand.d.ts +32 -0
  347. package/dist/cli/defineCLICommand.d.ts.map +1 -0
  348. package/dist/cli/defineCLICommand.js +26 -0
  349. package/dist/cli/defineCLICommand.js.map +1 -0
  350. package/dist/cli/index.d.ts +5 -0
  351. package/dist/cli/index.d.ts.map +1 -0
  352. package/dist/cli/index.js +73 -0
  353. package/dist/cli/index.js.map +1 -0
  354. package/dist/cli/index.spec.js +402 -0
  355. package/dist/cli/index.spec.js.map +1 -0
  356. package/dist/cli/program/createHelp.d.ts +8 -0
  357. package/dist/cli/program/createHelp.d.ts.map +1 -0
  358. package/dist/cli/program/createHelp.js +22 -0
  359. package/dist/cli/program/createHelp.js.map +1 -0
  360. package/dist/cli/program/loadCommands.d.ts +12 -0
  361. package/dist/cli/program/loadCommands.d.ts.map +1 -0
  362. package/dist/cli/program/loadCommands.js +62 -0
  363. package/dist/cli/program/loadCommands.js.map +1 -0
  364. package/dist/cli/program/normalizeHelpArguments.d.ts +12 -0
  365. package/dist/cli/program/normalizeHelpArguments.d.ts.map +1 -0
  366. package/dist/cli/program/normalizeHelpArguments.js +36 -0
  367. package/dist/cli/program/normalizeHelpArguments.js.map +1 -0
  368. package/dist/cli/program/registerCommand.d.ts +10 -0
  369. package/dist/cli/program/registerCommand.d.ts.map +1 -0
  370. package/dist/cli/program/registerCommand.js +185 -0
  371. package/dist/cli/program/registerCommand.js.map +1 -0
  372. package/dist/cli/runtime/createRuntime.d.ts +9 -0
  373. package/dist/cli/runtime/createRuntime.d.ts.map +1 -0
  374. package/dist/cli/runtime/createRuntime.js +66 -0
  375. package/dist/cli/runtime/createRuntime.js.map +1 -0
  376. package/dist/cli/runtime/getCommandInput.d.ts +13 -0
  377. package/dist/cli/runtime/getCommandInput.d.ts.map +1 -0
  378. package/dist/cli/runtime/getCommandInput.js +78 -0
  379. package/dist/cli/runtime/getCommandInput.js.map +1 -0
  380. package/dist/cli/runtime/invokeCommand.d.ts +23 -0
  381. package/dist/cli/runtime/invokeCommand.d.ts.map +1 -0
  382. package/dist/cli/runtime/invokeCommand.js +117 -0
  383. package/dist/cli/runtime/invokeCommand.js.map +1 -0
  384. package/dist/cli/runtime/loadEnv.d.ts.map +1 -0
  385. package/dist/{bin → cli/runtime}/loadEnv.js +1 -1
  386. package/dist/cli/runtime/loadEnv.js.map +1 -0
  387. package/dist/cli/runtime/output.d.ts +42 -0
  388. package/dist/cli/runtime/output.d.ts.map +1 -0
  389. package/dist/cli/runtime/output.js +91 -0
  390. package/dist/cli/runtime/output.js.map +1 -0
  391. package/dist/cli/runtime/redirectOutputToStderr.d.ts +3 -0
  392. package/dist/cli/runtime/redirectOutputToStderr.d.ts.map +1 -0
  393. package/dist/cli/runtime/redirectOutputToStderr.js +17 -0
  394. package/dist/cli/runtime/redirectOutputToStderr.js.map +1 -0
  395. package/dist/collections/config/client.d.ts +11 -5
  396. package/dist/collections/config/client.d.ts.map +1 -1
  397. package/dist/collections/config/client.js +7 -1
  398. package/dist/collections/config/client.js.map +1 -1
  399. package/dist/collections/config/defaults.d.ts +4 -8
  400. package/dist/collections/config/defaults.d.ts.map +1 -1
  401. package/dist/collections/config/defaults.js +37 -47
  402. package/dist/collections/config/defaults.js.map +1 -1
  403. package/dist/collections/config/sanitize.d.ts +4 -8
  404. package/dist/collections/config/sanitize.d.ts.map +1 -1
  405. package/dist/collections/config/sanitize.js +31 -21
  406. package/dist/collections/config/sanitize.js.map +1 -1
  407. package/dist/collections/config/sanitize.spec.js +363 -1
  408. package/dist/collections/config/sanitize.spec.js.map +1 -1
  409. package/dist/collections/config/sanitizeCompoundIndexes.d.ts.map +1 -1
  410. package/dist/collections/config/types.d.ts +62 -51
  411. package/dist/collections/config/types.d.ts.map +1 -1
  412. package/dist/collections/config/types.js.map +1 -1
  413. package/dist/collections/config/useAsTitle.d.ts.map +1 -1
  414. package/dist/collections/config/useAsTitle.spec.js +27 -27
  415. package/dist/collections/config/useAsTitle.spec.js.map +1 -1
  416. package/dist/collections/dataloader.d.ts +1 -1
  417. package/dist/collections/dataloader.d.ts.map +1 -1
  418. package/dist/collections/operations/count.d.ts.map +1 -1
  419. package/dist/collections/operations/count.js +65 -70
  420. package/dist/collections/operations/count.js.map +1 -1
  421. package/dist/collections/operations/countVersions.d.ts.map +1 -1
  422. package/dist/collections/operations/countVersions.js +61 -66
  423. package/dist/collections/operations/countVersions.js.map +1 -1
  424. package/dist/collections/operations/create.d.ts.map +1 -1
  425. package/dist/collections/operations/create.js +22 -0
  426. package/dist/collections/operations/create.js.map +1 -1
  427. package/dist/collections/operations/delete.d.ts.map +1 -1
  428. package/dist/collections/operations/delete.js +1 -0
  429. package/dist/collections/operations/delete.js.map +1 -1
  430. package/dist/collections/operations/deleteByID.d.ts.map +1 -1
  431. package/dist/collections/operations/deleteByID.js +1 -0
  432. package/dist/collections/operations/deleteByID.js.map +1 -1
  433. package/dist/collections/operations/docAccess.d.ts.map +1 -1
  434. package/dist/collections/operations/docAccess.js +19 -25
  435. package/dist/collections/operations/docAccess.js.map +1 -1
  436. package/dist/collections/operations/duplicate.d.ts.map +1 -1
  437. package/dist/collections/operations/find.d.ts.map +1 -1
  438. package/dist/collections/operations/find.js +248 -246
  439. package/dist/collections/operations/find.js.map +1 -1
  440. package/dist/collections/operations/findByID.d.ts.map +1 -1
  441. package/dist/collections/operations/findByID.js +215 -220
  442. package/dist/collections/operations/findByID.js.map +1 -1
  443. package/dist/collections/operations/findDistinct.d.ts.map +1 -1
  444. package/dist/collections/operations/findDistinct.js +161 -158
  445. package/dist/collections/operations/findDistinct.js.map +1 -1
  446. package/dist/collections/operations/findVersionByID.d.ts.map +1 -1
  447. package/dist/collections/operations/findVersionByID.js +131 -136
  448. package/dist/collections/operations/findVersionByID.js.map +1 -1
  449. package/dist/collections/operations/findVersions.d.ts.map +1 -1
  450. package/dist/collections/operations/findVersions.js +152 -149
  451. package/dist/collections/operations/findVersions.js.map +1 -1
  452. package/dist/collections/operations/inputSchemas.d.ts +877 -0
  453. package/dist/collections/operations/inputSchemas.d.ts.map +1 -0
  454. package/dist/collections/operations/inputSchemas.js +217 -0
  455. package/dist/collections/operations/inputSchemas.js.map +1 -0
  456. package/dist/collections/operations/local/count.d.ts +3 -3
  457. package/dist/collections/operations/local/count.d.ts.map +1 -1
  458. package/dist/collections/operations/local/count.js.map +1 -1
  459. package/dist/collections/operations/local/countVersions.d.ts +3 -3
  460. package/dist/collections/operations/local/countVersions.d.ts.map +1 -1
  461. package/dist/collections/operations/local/countVersions.js.map +1 -1
  462. package/dist/collections/operations/local/create.d.ts +3 -3
  463. package/dist/collections/operations/local/create.d.ts.map +1 -1
  464. package/dist/collections/operations/local/create.js.map +1 -1
  465. package/dist/collections/operations/local/delete.d.ts +3 -3
  466. package/dist/collections/operations/local/delete.d.ts.map +1 -1
  467. package/dist/collections/operations/local/delete.js.map +1 -1
  468. package/dist/collections/operations/local/duplicate.d.ts +3 -3
  469. package/dist/collections/operations/local/duplicate.d.ts.map +1 -1
  470. package/dist/collections/operations/local/duplicate.js.map +1 -1
  471. package/dist/collections/operations/local/find.d.ts +3 -3
  472. package/dist/collections/operations/local/find.d.ts.map +1 -1
  473. package/dist/collections/operations/local/find.js.map +1 -1
  474. package/dist/collections/operations/local/findByID.d.ts +3 -3
  475. package/dist/collections/operations/local/findByID.d.ts.map +1 -1
  476. package/dist/collections/operations/local/findByID.js.map +1 -1
  477. package/dist/collections/operations/local/findDistinct.d.ts +2 -2
  478. package/dist/collections/operations/local/findDistinct.d.ts.map +1 -1
  479. package/dist/collections/operations/local/findDistinct.js.map +1 -1
  480. package/dist/collections/operations/local/findVersionByID.d.ts +3 -3
  481. package/dist/collections/operations/local/findVersionByID.d.ts.map +1 -1
  482. package/dist/collections/operations/local/findVersionByID.js.map +1 -1
  483. package/dist/collections/operations/local/findVersions.d.ts +3 -3
  484. package/dist/collections/operations/local/findVersions.d.ts.map +1 -1
  485. package/dist/collections/operations/local/findVersions.js.map +1 -1
  486. package/dist/collections/operations/local/restoreVersion.d.ts +3 -3
  487. package/dist/collections/operations/local/restoreVersion.d.ts.map +1 -1
  488. package/dist/collections/operations/local/restoreVersion.js.map +1 -1
  489. package/dist/collections/operations/local/update.d.ts +3 -3
  490. package/dist/collections/operations/local/update.d.ts.map +1 -1
  491. package/dist/collections/operations/local/update.js.map +1 -1
  492. package/dist/collections/operations/restoreVersion.d.ts.map +1 -1
  493. package/dist/collections/operations/restoreVersion.js +8 -4
  494. package/dist/collections/operations/restoreVersion.js.map +1 -1
  495. package/dist/collections/operations/update.d.ts.map +1 -1
  496. package/dist/collections/operations/update.js +20 -1
  497. package/dist/collections/operations/update.js.map +1 -1
  498. package/dist/collections/operations/updateByID.d.ts.map +1 -1
  499. package/dist/collections/operations/updateByID.js +13 -0
  500. package/dist/collections/operations/updateByID.js.map +1 -1
  501. package/dist/collections/operations/utilities/buildAfterOperation.d.ts +1 -1
  502. package/dist/collections/operations/utilities/buildAfterOperation.d.ts.map +1 -1
  503. package/dist/collections/operations/utilities/copyDataWithFreshRowIDs.d.ts.map +1 -1
  504. package/dist/collections/operations/utilities/sanitizeSortQuery.d.ts.map +1 -1
  505. package/dist/collections/operations/utilities/types.d.ts +20 -29
  506. package/dist/collections/operations/utilities/types.d.ts.map +1 -1
  507. package/dist/collections/operations/utilities/types.js.map +1 -1
  508. package/dist/collections/operations/utilities/update.d.ts.map +1 -1
  509. package/dist/config/build.js +1 -1
  510. package/dist/config/build.js.map +1 -1
  511. package/dist/config/client.d.ts +4 -4
  512. package/dist/config/client.d.ts.map +1 -1
  513. package/dist/config/client.js +2 -1
  514. package/dist/config/client.js.map +1 -1
  515. package/dist/config/client.spec.js +20 -0
  516. package/dist/config/client.spec.js.map +1 -0
  517. package/dist/config/defaults.d.ts +0 -4
  518. package/dist/config/defaults.d.ts.map +1 -1
  519. package/dist/config/defaults.js +94 -119
  520. package/dist/config/defaults.js.map +1 -1
  521. package/dist/config/definePlugin.d.ts +10 -10
  522. package/dist/config/definePlugin.d.ts.map +1 -1
  523. package/dist/config/definePlugin.js +7 -11
  524. package/dist/config/definePlugin.js.map +1 -1
  525. package/dist/config/orderable/fractional-indexing.d.ts +23 -23
  526. package/dist/config/orderable/fractional-indexing.d.ts.map +1 -1
  527. package/dist/config/orderable/index.d.ts +1 -1
  528. package/dist/config/orderable/index.d.ts.map +1 -1
  529. package/dist/config/orderable/index.js +3 -2
  530. package/dist/config/orderable/index.js.map +1 -1
  531. package/dist/config/sanitize.d.ts +1 -1
  532. package/dist/config/sanitize.d.ts.map +1 -1
  533. package/dist/config/sanitize.js +172 -38
  534. package/dist/config/sanitize.js.map +1 -1
  535. package/dist/config/sanitize.spec.js +105 -0
  536. package/dist/config/sanitize.spec.js.map +1 -0
  537. package/dist/config/types.d.ts +500 -399
  538. package/dist/config/types.d.ts.map +1 -1
  539. package/dist/config/types.js.map +1 -1
  540. package/dist/database/combineQueries.d.ts.map +1 -1
  541. package/dist/database/createDatabaseAdapter.d.ts +1 -1
  542. package/dist/database/createDatabaseAdapter.d.ts.map +1 -1
  543. package/dist/database/createDatabaseAdapter.js +0 -2
  544. package/dist/database/createDatabaseAdapter.js.map +1 -1
  545. package/dist/database/isNestedRelationshipQuery.d.ts +14 -0
  546. package/dist/database/isNestedRelationshipQuery.d.ts.map +1 -0
  547. package/dist/database/isNestedRelationshipQuery.js +19 -0
  548. package/dist/database/isNestedRelationshipQuery.js.map +1 -0
  549. package/dist/database/migrations/createMigration.d.ts.map +1 -1
  550. package/dist/database/migrations/createMigration.js +4 -0
  551. package/dist/database/migrations/createMigration.js.map +1 -1
  552. package/dist/database/migrations/findMigrationDir.d.ts.map +1 -1
  553. package/dist/database/migrations/getPredefinedMigration.d.ts.map +1 -1
  554. package/dist/database/migrations/getPredefinedMigration.js +2 -2
  555. package/dist/database/migrations/getPredefinedMigration.js.map +1 -1
  556. package/dist/database/migrations/migrate.d.ts.map +1 -1
  557. package/dist/database/migrations/migrate.js +9 -0
  558. package/dist/database/migrations/migrate.js.map +1 -1
  559. package/dist/database/migrations/migrateDown.d.ts +2 -2
  560. package/dist/database/migrations/migrateDown.d.ts.map +1 -1
  561. package/dist/database/migrations/migrateDown.js +12 -2
  562. package/dist/database/migrations/migrateDown.js.map +1 -1
  563. package/dist/database/migrations/migrateRefresh.d.ts +2 -2
  564. package/dist/database/migrations/migrateRefresh.d.ts.map +1 -1
  565. package/dist/database/migrations/migrateRefresh.js +10 -2
  566. package/dist/database/migrations/migrateRefresh.js.map +1 -1
  567. package/dist/database/migrations/migrateReset.d.ts +2 -2
  568. package/dist/database/migrations/migrateReset.d.ts.map +1 -1
  569. package/dist/database/migrations/migrateReset.js +11 -1
  570. package/dist/database/migrations/migrateReset.js.map +1 -1
  571. package/dist/database/migrations/migrateStatus.d.ts +2 -2
  572. package/dist/database/migrations/migrateStatus.d.ts.map +1 -1
  573. package/dist/database/migrations/migrateStatus.js +11 -6
  574. package/dist/database/migrations/migrateStatus.js.map +1 -1
  575. package/dist/database/migrations/readMigrationFiles.d.ts.map +1 -1
  576. package/dist/database/migrations/writeMigrationIndex.d.ts.map +1 -1
  577. package/dist/database/queryValidation/validateQueryPaths.d.ts.map +1 -1
  578. package/dist/database/queryValidation/validateQueryPaths.js +8 -1
  579. package/dist/database/queryValidation/validateQueryPaths.js.map +1 -1
  580. package/dist/database/queryValidation/validateSearchParams.d.ts.map +1 -1
  581. package/dist/database/queryValidation/validateSearchParams.js +21 -4
  582. package/dist/database/queryValidation/validateSearchParams.js.map +1 -1
  583. package/dist/database/queryValidation/validateSortQuery.d.ts +23 -0
  584. package/dist/database/queryValidation/validateSortQuery.d.ts.map +1 -0
  585. package/dist/database/queryValidation/validateSortQuery.js +54 -0
  586. package/dist/database/queryValidation/validateSortQuery.js.map +1 -0
  587. package/dist/database/sanitizeJoinQuery.d.ts.map +1 -1
  588. package/dist/database/sanitizeJoinQuery.js +7 -0
  589. package/dist/database/sanitizeJoinQuery.js.map +1 -1
  590. package/dist/database/sanitizeWhereQuery.d.ts +1 -1
  591. package/dist/database/sanitizeWhereQuery.d.ts.map +1 -1
  592. package/dist/database/sanitizeWhereQuery.js +44 -1
  593. package/dist/database/sanitizeWhereQuery.js.map +1 -1
  594. package/dist/database/types.d.ts +37 -13
  595. package/dist/database/types.d.ts.map +1 -1
  596. package/dist/database/types.js.map +1 -1
  597. package/dist/duplicateDocument/index.d.ts.map +1 -1
  598. package/dist/duplicateDocument/index.js +1 -0
  599. package/dist/duplicateDocument/index.js.map +1 -1
  600. package/dist/email/getStringifiedToAddress.d.ts.map +1 -1
  601. package/dist/errors/APIError.d.ts.map +1 -1
  602. package/dist/errors/AuthenticationError.d.ts.map +1 -1
  603. package/dist/errors/DuplicateCollection.d.ts.map +1 -1
  604. package/dist/errors/DuplicateFieldName.d.ts.map +1 -1
  605. package/dist/errors/DuplicateGlobal.d.ts.map +1 -1
  606. package/dist/errors/ErrorDeletingFile.d.ts.map +1 -1
  607. package/dist/errors/FileRetrievalError.d.ts.map +1 -1
  608. package/dist/errors/FileUploadError.d.ts.map +1 -1
  609. package/dist/errors/Forbidden.d.ts.map +1 -1
  610. package/dist/errors/InvalidConfiguration.d.ts.map +1 -1
  611. package/dist/errors/InvalidFieldJoin.d.ts.map +1 -1
  612. package/dist/errors/InvalidFieldName.d.ts.map +1 -1
  613. package/dist/errors/InvalidFieldRelationship.d.ts.map +1 -1
  614. package/dist/errors/InvalidSchema.d.ts.map +1 -1
  615. package/dist/errors/Locked.d.ts.map +1 -1
  616. package/dist/errors/LockedAuth.d.ts.map +1 -1
  617. package/dist/errors/MissingCollectionLabel.d.ts.map +1 -1
  618. package/dist/errors/MissingEditorProp.d.ts.map +1 -1
  619. package/dist/errors/MissingFieldInputOptions.d.ts.map +1 -1
  620. package/dist/errors/MissingFieldType.d.ts.map +1 -1
  621. package/dist/errors/MissingFile.d.ts.map +1 -1
  622. package/dist/errors/NotFound.d.ts.map +1 -1
  623. package/dist/errors/QueryError.d.ts.map +1 -1
  624. package/dist/errors/ReservedFieldName.d.ts.map +1 -1
  625. package/dist/errors/TimestampsRequired.d.ts.map +1 -1
  626. package/dist/errors/UnauthorizedError.d.ts.map +1 -1
  627. package/dist/errors/UnverifiedEmail.d.ts.map +1 -1
  628. package/dist/errors/ValidationError.d.ts.map +1 -1
  629. package/dist/exports/auth.d.ts +5 -0
  630. package/dist/exports/auth.d.ts.map +1 -0
  631. package/dist/exports/auth.js +6 -0
  632. package/dist/exports/auth.js.map +1 -0
  633. package/dist/exports/cli.d.ts +4 -0
  634. package/dist/exports/cli.d.ts.map +1 -0
  635. package/dist/exports/cli.js +4 -0
  636. package/dist/exports/cli.js.map +1 -0
  637. package/dist/exports/cliBuiltin.d.ts +37 -0
  638. package/dist/exports/cliBuiltin.d.ts.map +1 -0
  639. package/dist/exports/cliBuiltin.js +38 -0
  640. package/dist/exports/cliBuiltin.js.map +1 -0
  641. package/dist/exports/internal.d.ts +6 -0
  642. package/dist/exports/internal.d.ts.map +1 -1
  643. package/dist/exports/internal.js +7 -1
  644. package/dist/exports/internal.js.map +1 -1
  645. package/dist/exports/node.d.ts +2 -2
  646. package/dist/exports/node.d.ts.map +1 -1
  647. package/dist/exports/node.js +2 -2
  648. package/dist/exports/node.js.map +1 -1
  649. package/dist/exports/shared.d.ts +8 -5
  650. package/dist/exports/shared.d.ts.map +1 -1
  651. package/dist/exports/shared.js +6 -4
  652. package/dist/exports/shared.js.map +1 -1
  653. package/dist/fields/baseFields/slug/duplicateContext.d.ts +11 -0
  654. package/dist/fields/baseFields/slug/duplicateContext.d.ts.map +1 -0
  655. package/dist/fields/baseFields/slug/duplicateContext.js +21 -0
  656. package/dist/fields/baseFields/slug/duplicateContext.js.map +1 -0
  657. package/dist/fields/baseFields/slug/fillEmptyLocalizedSlugs.d.ts +23 -0
  658. package/dist/fields/baseFields/slug/fillEmptyLocalizedSlugs.d.ts.map +1 -0
  659. package/dist/fields/baseFields/slug/fillEmptyLocalizedSlugs.js +65 -0
  660. package/dist/fields/baseFields/slug/fillEmptyLocalizedSlugs.js.map +1 -0
  661. package/dist/fields/baseFields/slug/generateSlug.d.ts +19 -7
  662. package/dist/fields/baseFields/slug/generateSlug.d.ts.map +1 -1
  663. package/dist/fields/baseFields/slug/generateSlug.js +111 -74
  664. package/dist/fields/baseFields/slug/generateSlug.js.map +1 -1
  665. package/dist/fields/baseFields/slug/generateSlugBeforeDuplicate.d.ts +18 -0
  666. package/dist/fields/baseFields/slug/generateSlugBeforeDuplicate.d.ts.map +1 -0
  667. package/dist/fields/baseFields/slug/generateSlugBeforeDuplicate.js +20 -0
  668. package/dist/fields/baseFields/slug/generateSlugBeforeDuplicate.js.map +1 -0
  669. package/dist/fields/baseFields/slug/getSlugFallbackValue.d.ts +23 -0
  670. package/dist/fields/baseFields/slug/getSlugFallbackValue.d.ts.map +1 -0
  671. package/dist/fields/baseFields/slug/getSlugFallbackValue.js +24 -0
  672. package/dist/fields/baseFields/slug/getSlugFallbackValue.js.map +1 -0
  673. package/dist/fields/baseFields/slug/hasValue.d.ts +3 -0
  674. package/dist/fields/baseFields/slug/hasValue.d.ts.map +1 -0
  675. package/dist/fields/baseFields/slug/hasValue.js +3 -0
  676. package/dist/fields/baseFields/slug/hasValue.js.map +1 -0
  677. package/dist/fields/baseFields/slug/types.d.ts +14 -0
  678. package/dist/fields/baseFields/slug/types.d.ts.map +1 -0
  679. package/dist/fields/baseFields/slug/types.js +6 -0
  680. package/dist/fields/baseFields/slug/types.js.map +1 -0
  681. package/dist/fields/config/client.d.ts +5 -5
  682. package/dist/fields/config/client.d.ts.map +1 -1
  683. package/dist/fields/config/client.js +3 -2
  684. package/dist/fields/config/client.js.map +1 -1
  685. package/dist/fields/config/reservedFieldNames.spec.js +18 -18
  686. package/dist/fields/config/reservedFieldNames.spec.js.map +1 -1
  687. package/dist/fields/config/sanitize.d.ts +6 -6
  688. package/dist/fields/config/sanitize.d.ts.map +1 -1
  689. package/dist/fields/config/sanitize.js +68 -19
  690. package/dist/fields/config/sanitize.js.map +1 -1
  691. package/dist/fields/config/sanitize.spec.js +105 -105
  692. package/dist/fields/config/sanitize.spec.js.map +1 -1
  693. package/dist/fields/config/sanitizeJoinField.d.ts.map +1 -1
  694. package/dist/fields/config/types.d.ts +50 -12
  695. package/dist/fields/config/types.d.ts.map +1 -1
  696. package/dist/fields/config/types.js +1 -1
  697. package/dist/fields/config/types.js.map +1 -1
  698. package/dist/fields/getDefaultValue.d.ts.map +1 -1
  699. package/dist/fields/hooks/afterChange/index.d.ts.map +1 -1
  700. package/dist/fields/hooks/afterChange/promise.d.ts.map +1 -1
  701. package/dist/fields/hooks/afterChange/traverseFields.d.ts.map +1 -1
  702. package/dist/fields/hooks/afterRead/promise.d.ts.map +1 -1
  703. package/dist/fields/hooks/afterRead/promise.js +11 -1
  704. package/dist/fields/hooks/afterRead/promise.js.map +1 -1
  705. package/dist/fields/hooks/afterRead/relationshipPopulationPromise.d.ts.map +1 -1
  706. package/dist/fields/hooks/afterRead/traverseFields.d.ts.map +1 -1
  707. package/dist/fields/hooks/afterRead/virtualFieldPopulationPromise.d.ts.map +1 -1
  708. package/dist/fields/hooks/beforeChange/cloneDataFromOriginalDoc.d.ts.map +1 -1
  709. package/dist/fields/hooks/beforeChange/getExistingRowDoc.d.ts.map +1 -1
  710. package/dist/fields/hooks/beforeChange/index.d.ts.map +1 -1
  711. package/dist/fields/hooks/beforeChange/promise.d.ts.map +1 -1
  712. package/dist/fields/hooks/beforeChange/promise.js +1 -0
  713. package/dist/fields/hooks/beforeChange/promise.js.map +1 -1
  714. package/dist/fields/hooks/beforeChange/traverseFields.d.ts.map +1 -1
  715. package/dist/fields/hooks/beforeDuplicate/index.d.ts.map +1 -1
  716. package/dist/fields/hooks/beforeDuplicate/promise.d.ts.map +1 -1
  717. package/dist/fields/hooks/beforeDuplicate/traverseFields.d.ts.map +1 -1
  718. package/dist/fields/hooks/beforeValidate/index.d.ts.map +1 -1
  719. package/dist/fields/hooks/beforeValidate/promise.d.ts.map +1 -1
  720. package/dist/fields/hooks/beforeValidate/promise.js +15 -4
  721. package/dist/fields/hooks/beforeValidate/promise.js.map +1 -1
  722. package/dist/fields/hooks/beforeValidate/stripNullRows.d.ts +10 -0
  723. package/dist/fields/hooks/beforeValidate/stripNullRows.d.ts.map +1 -0
  724. package/dist/fields/hooks/beforeValidate/stripNullRows.js +18 -0
  725. package/dist/fields/hooks/beforeValidate/stripNullRows.js.map +1 -0
  726. package/dist/fields/hooks/beforeValidate/traverseFields.d.ts.map +1 -1
  727. package/dist/fields/hooks/beforeValidate/traverseFields.js +2 -0
  728. package/dist/fields/hooks/beforeValidate/traverseFields.js.map +1 -1
  729. package/dist/fields/isFieldDisabled.d.ts.map +1 -1
  730. package/dist/fields/mergeBaseFields.d.ts.map +1 -1
  731. package/dist/fields/setDefaultBeforeDuplicate.d.ts.map +1 -1
  732. package/dist/fields/setDefaultBeforeDuplicate.js +1 -0
  733. package/dist/fields/setDefaultBeforeDuplicate.js.map +1 -1
  734. package/dist/fields/sortableFieldTypes.d.ts.map +1 -1
  735. package/dist/fields/sortableFieldTypes.js +1 -0
  736. package/dist/fields/sortableFieldTypes.js.map +1 -1
  737. package/dist/fields/validations.d.ts +4 -1
  738. package/dist/fields/validations.d.ts.map +1 -1
  739. package/dist/fields/validations.js +8 -2
  740. package/dist/fields/validations.js.map +1 -1
  741. package/dist/fields/validations.spec.js +61 -37
  742. package/dist/fields/validations.spec.js.map +1 -1
  743. package/dist/globals/config/client.d.ts +5 -5
  744. package/dist/globals/config/client.d.ts.map +1 -1
  745. package/dist/globals/config/client.js.map +1 -1
  746. package/dist/globals/config/sanitize.d.ts +3 -7
  747. package/dist/globals/config/sanitize.d.ts.map +1 -1
  748. package/dist/globals/config/sanitize.js +26 -6
  749. package/dist/globals/config/sanitize.js.map +1 -1
  750. package/dist/globals/config/sanitize.spec.js +227 -8
  751. package/dist/globals/config/sanitize.spec.js.map +1 -1
  752. package/dist/globals/config/types.d.ts +21 -16
  753. package/dist/globals/config/types.d.ts.map +1 -1
  754. package/dist/globals/config/types.js.map +1 -1
  755. package/dist/globals/operations/countGlobalVersions.d.ts.map +1 -1
  756. package/dist/globals/operations/countGlobalVersions.js +51 -55
  757. package/dist/globals/operations/countGlobalVersions.js.map +1 -1
  758. package/dist/globals/operations/docAccess.d.ts.map +1 -1
  759. package/dist/globals/operations/docAccess.js +19 -25
  760. package/dist/globals/operations/docAccess.js.map +1 -1
  761. package/dist/globals/operations/findOne.d.ts.map +1 -1
  762. package/dist/globals/operations/findOne.js +169 -174
  763. package/dist/globals/operations/findOne.js.map +1 -1
  764. package/dist/globals/operations/findVersionByID.d.ts.map +1 -1
  765. package/dist/globals/operations/findVersionByID.js +104 -109
  766. package/dist/globals/operations/findVersionByID.js.map +1 -1
  767. package/dist/globals/operations/findVersions.d.ts.map +1 -1
  768. package/dist/globals/operations/findVersions.js +112 -109
  769. package/dist/globals/operations/findVersions.js.map +1 -1
  770. package/dist/globals/operations/inputSchemas.d.ts +365 -0
  771. package/dist/globals/operations/inputSchemas.d.ts.map +1 -0
  772. package/dist/globals/operations/inputSchemas.js +104 -0
  773. package/dist/globals/operations/inputSchemas.js.map +1 -0
  774. package/dist/globals/operations/local/countVersions.d.ts +3 -3
  775. package/dist/globals/operations/local/countVersions.d.ts.map +1 -1
  776. package/dist/globals/operations/local/countVersions.js.map +1 -1
  777. package/dist/globals/operations/local/findOne.d.ts +3 -3
  778. package/dist/globals/operations/local/findOne.d.ts.map +1 -1
  779. package/dist/globals/operations/local/findOne.js.map +1 -1
  780. package/dist/globals/operations/local/findVersionByID.d.ts +3 -3
  781. package/dist/globals/operations/local/findVersionByID.d.ts.map +1 -1
  782. package/dist/globals/operations/local/findVersionByID.js.map +1 -1
  783. package/dist/globals/operations/local/findVersions.d.ts +3 -3
  784. package/dist/globals/operations/local/findVersions.d.ts.map +1 -1
  785. package/dist/globals/operations/local/findVersions.js.map +1 -1
  786. package/dist/globals/operations/local/restoreVersion.d.ts +3 -3
  787. package/dist/globals/operations/local/restoreVersion.d.ts.map +1 -1
  788. package/dist/globals/operations/local/restoreVersion.js.map +1 -1
  789. package/dist/globals/operations/local/update.d.ts +3 -3
  790. package/dist/globals/operations/local/update.d.ts.map +1 -1
  791. package/dist/globals/operations/local/update.js.map +1 -1
  792. package/dist/globals/operations/restoreVersion.d.ts.map +1 -1
  793. package/dist/globals/operations/restoreVersion.js +1 -0
  794. package/dist/globals/operations/restoreVersion.js.map +1 -1
  795. package/dist/globals/operations/update.d.ts.map +1 -1
  796. package/dist/globals/operations/update.js +1 -0
  797. package/dist/globals/operations/update.js.map +1 -1
  798. package/dist/hierarchy/addHierarchyToCollection.d.ts.map +1 -1
  799. package/dist/hierarchy/addHierarchyToCollection.js +2 -0
  800. package/dist/hierarchy/addHierarchyToCollection.js.map +1 -1
  801. package/dist/hierarchy/buildParentField.d.ts.map +1 -1
  802. package/dist/hierarchy/constants.d.ts.map +1 -1
  803. package/dist/hierarchy/getInitialTreeData.d.ts.map +1 -1
  804. package/dist/hierarchy/hooks/collectionAfterDelete.d.ts.map +1 -1
  805. package/dist/hierarchy/hooks/collectionAfterRead.d.ts.map +1 -1
  806. package/dist/hierarchy/hooks/collectionBeforeChange.d.ts.map +1 -1
  807. package/dist/hierarchy/hooks/collectionBeforeDelete.d.ts.map +1 -1
  808. package/dist/hierarchy/hooks/collectionBeforeOperation.d.ts.map +1 -1
  809. package/dist/hierarchy/hooks/ensureSafeCollectionsChange.d.ts.map +1 -1
  810. package/dist/hierarchy/injectHierarchyButton.d.ts.map +1 -1
  811. package/dist/hierarchy/resolveHierarchyCollections.d.ts.map +1 -1
  812. package/dist/hierarchy/sanitizeHierarchyCollection.d.ts.map +1 -1
  813. package/dist/index.bundled.d.ts +6085 -4339
  814. package/dist/index.d.ts +158 -55
  815. package/dist/index.d.ts.map +1 -1
  816. package/dist/index.js +85 -65
  817. package/dist/index.js.map +1 -1
  818. package/dist/kv/adapters/DatabaseKVAdapter.d.ts.map +1 -1
  819. package/dist/kv/adapters/InMemoryKVAdapter.d.ts.map +1 -1
  820. package/dist/locked-documents/config.d.ts.map +1 -1
  821. package/dist/preferences/config.d.ts.map +1 -1
  822. package/dist/preferences/deleteUserPreferences.d.ts.map +1 -1
  823. package/dist/preferences/keys.d.ts +8 -4
  824. package/dist/preferences/keys.d.ts.map +1 -1
  825. package/dist/preferences/keys.js +4 -1
  826. package/dist/preferences/keys.js.map +1 -1
  827. package/dist/preferences/types.d.ts +15 -0
  828. package/dist/preferences/types.d.ts.map +1 -1
  829. package/dist/preferences/types.js +3 -1
  830. package/dist/preferences/types.js.map +1 -1
  831. package/dist/query-presets/access.d.ts.map +1 -1
  832. package/dist/query-presets/config.d.ts.map +1 -1
  833. package/dist/query-presets/constraints.d.ts.map +1 -1
  834. package/dist/query-presets/constraints.js +1 -1
  835. package/dist/query-presets/constraints.js.map +1 -1
  836. package/dist/query-presets/types.d.ts +1 -1
  837. package/dist/query-presets/types.d.ts.map +1 -1
  838. package/dist/queues/config/collection.d.ts.map +1 -1
  839. package/dist/queues/config/collection.js +43 -43
  840. package/dist/queues/config/collection.js.map +1 -1
  841. package/dist/queues/config/global.d.ts +5 -6
  842. package/dist/queues/config/global.d.ts.map +1 -1
  843. package/dist/queues/config/global.js +1 -1
  844. package/dist/queues/config/global.js.map +1 -1
  845. package/dist/queues/config/types/index.d.ts +31 -24
  846. package/dist/queues/config/types/index.d.ts.map +1 -1
  847. package/dist/queues/config/types/index.js.map +1 -1
  848. package/dist/queues/config/types/taskTypes.d.ts +4 -7
  849. package/dist/queues/config/types/taskTypes.d.ts.map +1 -1
  850. package/dist/queues/config/types/taskTypes.js.map +1 -1
  851. package/dist/queues/config/types/workflowJSONTypes.d.ts +10 -9
  852. package/dist/queues/config/types/workflowJSONTypes.d.ts.map +1 -1
  853. package/dist/queues/config/types/workflowJSONTypes.js.map +1 -1
  854. package/dist/queues/config/types/workflowTypes.d.ts +11 -58
  855. package/dist/queues/config/types/workflowTypes.d.ts.map +1 -1
  856. package/dist/queues/config/types/workflowTypes.js.map +1 -1
  857. package/dist/queues/endpoints/handleSchedules.d.ts.map +1 -1
  858. package/dist/queues/endpoints/handleSchedules.js +3 -2
  859. package/dist/queues/endpoints/handleSchedules.js.map +1 -1
  860. package/dist/queues/endpoints/run.d.ts.map +1 -1
  861. package/dist/queues/endpoints/run.js +2 -1
  862. package/dist/queues/endpoints/run.js.map +1 -1
  863. package/dist/queues/errors/handleTaskError.js +4 -4
  864. package/dist/queues/errors/handleTaskError.js.map +1 -1
  865. package/dist/queues/errors/handleWorkflowError.js +1 -1
  866. package/dist/queues/errors/handleWorkflowError.js.map +1 -1
  867. package/dist/queues/errors/index.d.ts +6 -0
  868. package/dist/queues/errors/index.d.ts.map +1 -1
  869. package/dist/queues/errors/index.js +5 -0
  870. package/dist/queues/errors/index.js.map +1 -1
  871. package/dist/queues/localAPI.d.ts +9 -9
  872. package/dist/queues/localAPI.d.ts.map +1 -1
  873. package/dist/queues/localAPI.js +63 -66
  874. package/dist/queues/localAPI.js.map +1 -1
  875. package/dist/queues/operations/handleSchedules/countRunnableOrActiveJobsForQueue.d.ts +4 -4
  876. package/dist/queues/operations/handleSchedules/countRunnableOrActiveJobsForQueue.d.ts.map +1 -1
  877. package/dist/queues/operations/handleSchedules/countRunnableOrActiveJobsForQueue.js.map +1 -1
  878. package/dist/queues/operations/handleSchedules/getQueuesWithSchedules.d.ts.map +1 -1
  879. package/dist/queues/operations/handleSchedules/index.d.ts +1 -1
  880. package/dist/queues/operations/handleSchedules/index.d.ts.map +1 -1
  881. package/dist/queues/operations/handleSchedules/index.js +1 -1
  882. package/dist/queues/operations/handleSchedules/index.js.map +1 -1
  883. package/dist/queues/operations/runJobs/heartbeat.d.ts +13 -0
  884. package/dist/queues/operations/runJobs/heartbeat.d.ts.map +1 -0
  885. package/dist/queues/operations/runJobs/heartbeat.js +66 -0
  886. package/dist/queues/operations/runJobs/heartbeat.js.map +1 -0
  887. package/dist/queues/operations/runJobs/index.d.ts.map +1 -1
  888. package/dist/queues/operations/runJobs/index.js +133 -84
  889. package/dist/queues/operations/runJobs/index.js.map +1 -1
  890. package/dist/queues/operations/runJobs/runJSONJob/index.d.ts.map +1 -1
  891. package/dist/queues/operations/runJobs/runJSONJob/index.js +6 -3
  892. package/dist/queues/operations/runJobs/runJSONJob/index.js.map +1 -1
  893. package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.d.ts.map +1 -1
  894. package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js +5 -5
  895. package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js.map +1 -1
  896. package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.d.ts +2 -1
  897. package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.d.ts.map +1 -1
  898. package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.js +39 -8
  899. package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.js.map +1 -1
  900. package/dist/queues/operations/runJobs/runJob/importHandlerPath.d.ts +1 -1
  901. package/dist/queues/operations/runJobs/runJob/importHandlerPath.d.ts.map +1 -1
  902. package/dist/queues/operations/runJobs/runJob/importHandlerPath.js.map +1 -1
  903. package/dist/queues/operations/runJobs/runJob/index.d.ts.map +1 -1
  904. package/dist/queues/operations/runJobs/runJob/index.js +4 -4
  905. package/dist/queues/operations/runJobs/runJob/index.js.map +1 -1
  906. package/dist/queues/utilities/getCurrentDate.d.ts.map +1 -1
  907. package/dist/queues/utilities/getJobTaskStatus.d.ts.map +1 -1
  908. package/dist/queues/utilities/updateJob.d.ts.map +1 -1
  909. package/dist/queues/utilities/updateJob.js +3 -0
  910. package/dist/queues/utilities/updateJob.js.map +1 -1
  911. package/dist/translations/getLocalI18n.d.ts.map +1 -1
  912. package/dist/types/constants.d.ts +23 -2
  913. package/dist/types/constants.d.ts.map +1 -1
  914. package/dist/types/constants.js +23 -0
  915. package/dist/types/constants.js.map +1 -1
  916. package/dist/types/index.d.ts +12 -10
  917. package/dist/types/index.d.ts.map +1 -1
  918. package/dist/types/index.js.map +1 -1
  919. package/dist/uploads/checkFileAccess.d.ts.map +1 -1
  920. package/dist/uploads/checkFileAccess.js +1 -0
  921. package/dist/uploads/checkFileAccess.js.map +1 -1
  922. package/dist/uploads/checkFileRestrictions.d.ts +1 -1
  923. package/dist/uploads/checkFileRestrictions.d.ts.map +1 -1
  924. package/dist/uploads/checkFileRestrictions.js +15 -1
  925. package/dist/uploads/checkFileRestrictions.js.map +1 -1
  926. package/dist/uploads/cropImage.d.ts +1 -1
  927. package/dist/uploads/cropImage.d.ts.map +1 -1
  928. package/dist/uploads/cropImage.js +2 -5
  929. package/dist/uploads/cropImage.js.map +1 -1
  930. package/dist/uploads/cropImage.spec.js +71 -0
  931. package/dist/uploads/cropImage.spec.js.map +1 -0
  932. package/dist/uploads/docWithFilenameExists.d.ts.map +1 -1
  933. package/dist/uploads/endpoints/getFileFromURL.js +2 -0
  934. package/dist/uploads/endpoints/getFileFromURL.js.map +1 -1
  935. package/dist/uploads/endpoints/uploadInstructions.d.ts +15 -0
  936. package/dist/uploads/endpoints/uploadInstructions.d.ts.map +1 -0
  937. package/dist/uploads/endpoints/uploadInstructions.js +84 -0
  938. package/dist/uploads/endpoints/uploadInstructions.js.map +1 -0
  939. package/dist/uploads/fetchAPI-multipart/isEligibleRequest.d.ts.map +1 -1
  940. package/dist/uploads/fetchAPI-multipart/isEligibleRequest.js +1 -2
  941. package/dist/uploads/fetchAPI-multipart/isEligibleRequest.js.map +1 -1
  942. package/dist/uploads/fetchAPI-multipart/isEligibleRequest.spec.js +28 -0
  943. package/dist/uploads/fetchAPI-multipart/isEligibleRequest.spec.js.map +1 -1
  944. package/dist/uploads/fetchAPI-multipart/processMultipart.d.ts.map +1 -1
  945. package/dist/uploads/fetchAPI-multipart/processMultipart.js +3 -12
  946. package/dist/uploads/fetchAPI-multipart/processMultipart.js.map +1 -1
  947. package/dist/uploads/fetchAPI-multipart/processNested.d.ts.map +1 -1
  948. package/dist/uploads/fetchAPI-multipart/utilities.d.ts.map +1 -1
  949. package/dist/uploads/fileExists.d.ts.map +1 -1
  950. package/dist/uploads/generateFileData.d.ts +9 -0
  951. package/dist/uploads/generateFileData.d.ts.map +1 -1
  952. package/dist/uploads/generateFileData.js +60 -46
  953. package/dist/uploads/generateFileData.js.map +1 -1
  954. package/dist/uploads/generateFileData.spec.js +207 -0
  955. package/dist/uploads/generateFileData.spec.js.map +1 -0
  956. package/dist/uploads/generateFileData.tempFileBuffering.spec.js +81 -0
  957. package/dist/uploads/generateFileData.tempFileBuffering.spec.js.map +1 -0
  958. package/dist/uploads/getBaseFields.d.ts.map +1 -1
  959. package/dist/uploads/getExternalFile.d.ts.map +1 -1
  960. package/dist/uploads/getFileByPath.d.ts +1 -1
  961. package/dist/uploads/getFileByPath.d.ts.map +1 -1
  962. package/dist/uploads/getFileContentRequirement.d.ts +32 -0
  963. package/dist/uploads/getFileContentRequirement.d.ts.map +1 -0
  964. package/dist/uploads/getFileContentRequirement.js +40 -0
  965. package/dist/uploads/getFileContentRequirement.js.map +1 -0
  966. package/dist/uploads/getFileContentRequirement.spec.js +125 -0
  967. package/dist/uploads/getFileContentRequirement.spec.js.map +1 -0
  968. package/dist/uploads/getFileFromUploadInstructions.d.ts +8 -0
  969. package/dist/uploads/getFileFromUploadInstructions.d.ts.map +1 -0
  970. package/dist/uploads/getFileFromUploadInstructions.js +232 -0
  971. package/dist/uploads/getFileFromUploadInstructions.js.map +1 -0
  972. package/dist/uploads/getFileFromUploadInstructions.spec.js +378 -0
  973. package/dist/uploads/getFileFromUploadInstructions.spec.js.map +1 -0
  974. package/dist/uploads/getFileTypeFallback.d.ts.map +1 -1
  975. package/dist/uploads/getImageSize.d.ts +12 -1
  976. package/dist/uploads/getImageSize.d.ts.map +1 -1
  977. package/dist/uploads/getImageSize.js +20 -18
  978. package/dist/uploads/getImageSize.js.map +1 -1
  979. package/dist/uploads/getImageSize.spec.js +298 -0
  980. package/dist/uploads/getImageSize.spec.js.map +1 -0
  981. package/dist/uploads/getSafeFilename.d.ts.map +1 -1
  982. package/dist/uploads/image-resizing/createImageSize.d.ts.map +1 -1
  983. package/dist/uploads/image-resizing/createImageSizes.d.ts.map +1 -1
  984. package/dist/uploads/image-resizing/createImageSizes.js +2 -5
  985. package/dist/uploads/image-resizing/createImageSizes.js.map +1 -1
  986. package/dist/uploads/image-resizing/createImageSizes.spec.js +80 -0
  987. package/dist/uploads/image-resizing/createImageSizes.spec.js.map +1 -0
  988. package/dist/uploads/image-resizing/generateImageSizeFilename.d.ts.map +1 -1
  989. package/dist/uploads/image-resizing/getImageResizeAction.d.ts +1 -1
  990. package/dist/uploads/image-resizing/getImageResizeAction.d.ts.map +1 -1
  991. package/dist/uploads/image-resizing/parseFilename.d.ts.map +1 -1
  992. package/dist/uploads/image-resizing/sanitizeResizeConfig.d.ts.map +1 -1
  993. package/dist/uploads/isAnimatedImage.d.ts +8 -0
  994. package/dist/uploads/isAnimatedImage.d.ts.map +1 -0
  995. package/dist/uploads/isAnimatedImage.js +22 -0
  996. package/dist/uploads/isAnimatedImage.js.map +1 -0
  997. package/dist/uploads/isAnimatedImage.spec.js +19 -0
  998. package/dist/uploads/isAnimatedImage.spec.js.map +1 -0
  999. package/dist/uploads/matchMimeType.d.ts +8 -0
  1000. package/dist/uploads/matchMimeType.d.ts.map +1 -0
  1001. package/dist/uploads/matchMimeType.js +19 -0
  1002. package/dist/uploads/matchMimeType.js.map +1 -0
  1003. package/dist/uploads/matchMimeType.spec.js +66 -0
  1004. package/dist/uploads/matchMimeType.spec.js.map +1 -0
  1005. package/dist/uploads/mimeTypeValidator.d.ts.map +1 -1
  1006. package/dist/uploads/probeImageSize.d.ts +39 -0
  1007. package/dist/uploads/probeImageSize.d.ts.map +1 -0
  1008. package/dist/uploads/probeImageSize.js +374 -0
  1009. package/dist/uploads/probeImageSize.js.map +1 -0
  1010. package/dist/uploads/probeImageSize.spec.js +366 -0
  1011. package/dist/uploads/probeImageSize.spec.js.map +1 -0
  1012. package/dist/uploads/safeFetch.d.ts.map +1 -1
  1013. package/dist/uploads/saveBufferToFile.d.ts.map +1 -1
  1014. package/dist/uploads/stagedUpload.d.ts +27 -0
  1015. package/dist/uploads/stagedUpload.d.ts.map +1 -0
  1016. package/dist/uploads/stagedUpload.js +197 -0
  1017. package/dist/uploads/stagedUpload.js.map +1 -0
  1018. package/dist/uploads/types.d.ts +112 -7
  1019. package/dist/uploads/types.d.ts.map +1 -1
  1020. package/dist/uploads/types.js.map +1 -1
  1021. package/dist/uploads/unlinkTempFiles.d.ts.map +1 -1
  1022. package/dist/uploads/unlinkTempFiles.js +6 -2
  1023. package/dist/uploads/unlinkTempFiles.js.map +1 -1
  1024. package/dist/uploads/unlinkTempFiles.spec.js +71 -0
  1025. package/dist/uploads/unlinkTempFiles.spec.js.map +1 -0
  1026. package/dist/uploads/uploadFiles.d.ts.map +1 -1
  1027. package/dist/uploads/uploadFiles.js +7 -2
  1028. package/dist/uploads/uploadFiles.js.map +1 -1
  1029. package/dist/uploads/uploadFiles.spec.js +44 -0
  1030. package/dist/uploads/uploadFiles.spec.js.map +1 -0
  1031. package/dist/utilities/addDataAndFileToRequest.d.ts.map +1 -1
  1032. package/dist/utilities/addDataAndFileToRequest.js +12 -39
  1033. package/dist/utilities/addDataAndFileToRequest.js.map +1 -1
  1034. package/dist/utilities/addLocalesToRequest.d.ts.map +1 -1
  1035. package/dist/utilities/addSelectGenericsToGeneretedTypes.d.ts.map +1 -1
  1036. package/dist/utilities/appendDateTimezoneSelectFields.d.ts.map +1 -1
  1037. package/dist/utilities/appendNonTrashedFilter.d.ts +1 -1
  1038. package/dist/utilities/appendNonTrashedFilter.d.ts.map +1 -1
  1039. package/dist/utilities/appendNonTrashedFilter.js.map +1 -1
  1040. package/dist/utilities/appendUploadSelectFields.d.ts.map +1 -1
  1041. package/dist/utilities/canAccessAdmin.d.ts.map +1 -1
  1042. package/dist/utilities/canAccessAdmin.js +1 -0
  1043. package/dist/utilities/canAccessAdmin.js.map +1 -1
  1044. package/dist/utilities/checkDocumentLockStatus.d.ts.map +1 -1
  1045. package/dist/utilities/configToJSONSchema.d.ts +13 -4
  1046. package/dist/utilities/configToJSONSchema.d.ts.map +1 -1
  1047. package/dist/utilities/configToJSONSchema.js +139 -61
  1048. package/dist/utilities/configToJSONSchema.js.map +1 -1
  1049. package/dist/utilities/configToJSONSchema.spec.js +378 -22
  1050. package/dist/utilities/configToJSONSchema.spec.js.map +1 -1
  1051. package/dist/utilities/createLocalReq.d.ts +2 -2
  1052. package/dist/utilities/createLocalReq.d.ts.map +1 -1
  1053. package/dist/utilities/createLocalReq.js.map +1 -1
  1054. package/dist/utilities/createPayloadRequest.d.ts.map +1 -1
  1055. package/dist/utilities/deepCopyObject.d.ts.map +1 -1
  1056. package/dist/utilities/dependencies/resolveFrom.d.ts.map +1 -1
  1057. package/dist/utilities/entityInputSchema/filterFieldsByAccess.d.ts +30 -0
  1058. package/dist/utilities/entityInputSchema/filterFieldsByAccess.d.ts.map +1 -0
  1059. package/dist/utilities/entityInputSchema/filterFieldsByAccess.js +71 -0
  1060. package/dist/utilities/entityInputSchema/filterFieldsByAccess.js.map +1 -0
  1061. package/dist/utilities/entityInputSchema/getEntityInputSchema.d.ts +13 -0
  1062. package/dist/utilities/entityInputSchema/getEntityInputSchema.d.ts.map +1 -0
  1063. package/dist/utilities/entityInputSchema/getEntityInputSchema.js +66 -0
  1064. package/dist/utilities/entityInputSchema/getEntityInputSchema.js.map +1 -0
  1065. package/dist/utilities/entityInputSchema/sanitizeEntitySchema.d.ts +10 -0
  1066. package/dist/utilities/entityInputSchema/sanitizeEntitySchema.d.ts.map +1 -0
  1067. package/dist/utilities/entityInputSchema/sanitizeEntitySchema.js +384 -0
  1068. package/dist/utilities/entityInputSchema/sanitizeEntitySchema.js.map +1 -0
  1069. package/dist/utilities/entityInputSchema/sanitizeEntitySchema.spec.js +133 -0
  1070. package/dist/utilities/entityInputSchema/sanitizeEntitySchema.spec.js.map +1 -0
  1071. package/dist/utilities/entityInputSchema/types.d.ts +16 -0
  1072. package/dist/utilities/entityInputSchema/types.d.ts.map +1 -0
  1073. package/dist/utilities/entityInputSchema/types.js +3 -0
  1074. package/dist/utilities/entityInputSchema/types.js.map +1 -0
  1075. package/dist/utilities/entityInputSchema/validateEntityData.d.ts +13 -0
  1076. package/dist/utilities/entityInputSchema/validateEntityData.d.ts.map +1 -0
  1077. package/dist/utilities/entityInputSchema/validateEntityData.js +138 -0
  1078. package/dist/utilities/entityInputSchema/validateEntityData.js.map +1 -0
  1079. package/dist/utilities/escapeRegExp.d.ts.map +1 -1
  1080. package/dist/utilities/extractID.d.ts.map +1 -1
  1081. package/dist/utilities/fieldValueExists.d.ts +29 -0
  1082. package/dist/utilities/fieldValueExists.d.ts.map +1 -0
  1083. package/dist/utilities/fieldValueExists.js +37 -0
  1084. package/dist/utilities/fieldValueExists.js.map +1 -0
  1085. package/dist/utilities/flattenAllFields.d.ts.map +1 -1
  1086. package/dist/utilities/formatAdminURL.d.ts.map +1 -1
  1087. package/dist/utilities/formatErrors.d.ts.map +1 -1
  1088. package/dist/utilities/formatLabels.d.ts.map +1 -1
  1089. package/dist/utilities/getBestFitFromSizes.d.ts.map +1 -1
  1090. package/dist/utilities/getBlockSelect.d.ts.map +1 -1
  1091. package/dist/utilities/getDataByPath.d.ts.map +1 -1
  1092. package/dist/utilities/getEntityPermissions/getEntityPermissions.d.ts.map +1 -1
  1093. package/dist/utilities/getEntityPermissions/getEntityPermissions.js +3 -0
  1094. package/dist/utilities/getEntityPermissions/getEntityPermissions.js.map +1 -1
  1095. package/dist/utilities/getEntityPermissions/populateFieldPermissions.d.ts +7 -1
  1096. package/dist/utilities/getEntityPermissions/populateFieldPermissions.d.ts.map +1 -1
  1097. package/dist/utilities/getEntityPermissions/populateFieldPermissions.js +19 -2
  1098. package/dist/utilities/getEntityPermissions/populateFieldPermissions.js.map +1 -1
  1099. package/dist/utilities/getFieldByPath.d.ts.map +1 -1
  1100. package/dist/utilities/getFieldPermissions.d.ts.map +1 -1
  1101. package/dist/utilities/getNextVersion.d.ts +7 -0
  1102. package/dist/utilities/getNextVersion.d.ts.map +1 -0
  1103. package/dist/utilities/getNextVersion.js +20 -0
  1104. package/dist/utilities/getNextVersion.js.map +1 -0
  1105. package/dist/utilities/getNextVersion.spec.js +16 -0
  1106. package/dist/utilities/getNextVersion.spec.js.map +1 -0
  1107. package/dist/utilities/getObjectDotNotation.d.ts.map +1 -1
  1108. package/dist/utilities/getRequestEntity.d.ts.map +1 -1
  1109. package/dist/utilities/getRequestLanguage.d.ts.map +1 -1
  1110. package/dist/utilities/getRequestOrigin.d.ts +2 -2
  1111. package/dist/utilities/getRequestOrigin.d.ts.map +1 -1
  1112. package/dist/utilities/getRequestOrigin.js.map +1 -1
  1113. package/dist/utilities/getSafeRedirect.d.ts.map +1 -1
  1114. package/dist/utilities/getSafeRedirect.js +16 -9
  1115. package/dist/utilities/getSafeRedirect.js.map +1 -1
  1116. package/dist/utilities/getSafeRedirect.spec.js +96 -2
  1117. package/dist/utilities/getSafeRedirect.spec.js.map +1 -1
  1118. package/dist/utilities/getSelectMode.d.ts.map +1 -1
  1119. package/dist/utilities/getSiblingData.d.ts.map +1 -1
  1120. package/dist/utilities/getTranslatedLabel.d.ts.map +1 -1
  1121. package/dist/utilities/getUniqueFieldValue.d.ts +28 -0
  1122. package/dist/utilities/getUniqueFieldValue.d.ts.map +1 -0
  1123. package/dist/utilities/getUniqueFieldValue.js +27 -0
  1124. package/dist/utilities/getUniqueFieldValue.js.map +1 -0
  1125. package/dist/utilities/getVersionsConfig.d.ts +1 -1
  1126. package/dist/utilities/getVersionsConfig.d.ts.map +1 -1
  1127. package/dist/utilities/getVirtualFieldNames.d.ts +14 -0
  1128. package/dist/utilities/getVirtualFieldNames.d.ts.map +1 -0
  1129. package/dist/utilities/getVirtualFieldNames.js +35 -0
  1130. package/dist/utilities/getVirtualFieldNames.js.map +1 -0
  1131. package/dist/utilities/handleEndpoints.d.ts.map +1 -1
  1132. package/dist/utilities/headersWithCors.d.ts.map +1 -1
  1133. package/dist/utilities/headersWithCors.js +1 -1
  1134. package/dist/utilities/headersWithCors.js.map +1 -1
  1135. package/dist/utilities/isEntityHidden.d.ts +2 -2
  1136. package/dist/utilities/isEntityHidden.d.ts.map +1 -1
  1137. package/dist/utilities/isURLAllowed.d.ts.map +1 -1
  1138. package/dist/utilities/isURLAllowed.js +9 -3
  1139. package/dist/utilities/isURLAllowed.js.map +1 -1
  1140. package/dist/utilities/isURLAllowed.spec.js +78 -0
  1141. package/dist/utilities/isURLAllowed.spec.js.map +1 -0
  1142. package/dist/utilities/isValidID.d.ts +1 -1
  1143. package/dist/utilities/isValidID.d.ts.map +1 -1
  1144. package/dist/utilities/killTransaction.d.ts +7 -0
  1145. package/dist/utilities/killTransaction.d.ts.map +1 -1
  1146. package/dist/utilities/killTransaction.js +7 -0
  1147. package/dist/utilities/killTransaction.js.map +1 -1
  1148. package/dist/utilities/logError.d.ts.map +1 -1
  1149. package/dist/utilities/logError.js +5 -2
  1150. package/dist/utilities/logError.js.map +1 -1
  1151. package/dist/utilities/logger.d.ts +1 -1
  1152. package/dist/utilities/logger.d.ts.map +1 -1
  1153. package/dist/utilities/mergeHeaders.d.ts.map +1 -1
  1154. package/dist/utilities/mergeListSearchAndWhere.d.ts.map +1 -1
  1155. package/dist/utilities/miniChalk.d.ts.map +1 -1
  1156. package/dist/utilities/nextJsDevReloadStrategy.d.ts +7 -0
  1157. package/dist/utilities/nextJsDevReloadStrategy.d.ts.map +1 -0
  1158. package/dist/utilities/nextJsDevReloadStrategy.js +59 -0
  1159. package/dist/utilities/nextJsDevReloadStrategy.js.map +1 -0
  1160. package/dist/utilities/nextJsDevReloadStrategy.spec.js +123 -0
  1161. package/dist/utilities/nextJsDevReloadStrategy.spec.js.map +1 -0
  1162. package/dist/utilities/optionsAreEqual.d.ts.map +1 -1
  1163. package/dist/utilities/parseBooleanString.d.ts.map +1 -1
  1164. package/dist/utilities/parseCookies.d.ts +1 -1
  1165. package/dist/utilities/parseCookies.d.ts.map +1 -1
  1166. package/dist/utilities/parseParams/index.d.ts.map +1 -1
  1167. package/dist/utilities/profiling.d.ts.map +1 -1
  1168. package/dist/utilities/reduceFieldsToValues.d.ts.map +1 -1
  1169. package/dist/utilities/resolveSelect.d.ts.map +1 -1
  1170. package/dist/utilities/routeError.d.ts.map +1 -1
  1171. package/dist/utilities/sanitizeFallbackLocale.d.ts.map +1 -1
  1172. package/dist/utilities/sanitizeInternalFields.d.ts.map +1 -1
  1173. package/dist/utilities/sanitizeJoinParams.d.ts.map +1 -1
  1174. package/dist/utilities/sanitizePopulateParam.d.ts.map +1 -1
  1175. package/dist/utilities/sanitizeSelect.d.ts.map +1 -1
  1176. package/dist/utilities/sanitizeSelectParam.d.ts.map +1 -1
  1177. package/dist/utilities/sanitizeSortParams.d.ts.map +1 -1
  1178. package/dist/utilities/setsAreEqual.d.ts.map +1 -1
  1179. package/dist/utilities/sharedInputSchemas.d.ts +52 -0
  1180. package/dist/utilities/sharedInputSchemas.d.ts.map +1 -0
  1181. package/dist/utilities/sharedInputSchemas.js +101 -0
  1182. package/dist/utilities/sharedInputSchemas.js.map +1 -0
  1183. package/dist/utilities/slugify.d.ts.map +1 -1
  1184. package/dist/utilities/stripUnselectedFields.d.ts.map +1 -1
  1185. package/dist/utilities/telemetry/conf/envPaths.d.ts.map +1 -1
  1186. package/dist/utilities/telemetry/conf/envPaths.js +40 -31
  1187. package/dist/utilities/telemetry/conf/envPaths.js.map +1 -1
  1188. package/dist/utilities/telemetry/conf/index.d.ts.map +1 -1
  1189. package/dist/utilities/telemetry/events/adminInit.d.ts.map +1 -1
  1190. package/dist/utilities/telemetry/events/adminInit.js +2 -3
  1191. package/dist/utilities/telemetry/events/adminInit.js.map +1 -1
  1192. package/dist/utilities/telemetry/events/serverInit.d.ts.map +1 -1
  1193. package/dist/utilities/telemetry/events/serverInit.js +2 -3
  1194. package/dist/utilities/telemetry/events/serverInit.js.map +1 -1
  1195. package/dist/utilities/telemetry/getProjectContext.d.ts +16 -0
  1196. package/dist/utilities/telemetry/getProjectContext.d.ts.map +1 -0
  1197. package/dist/utilities/telemetry/getProjectContext.js +43 -0
  1198. package/dist/utilities/telemetry/getProjectContext.js.map +1 -0
  1199. package/dist/utilities/telemetry/index.d.ts +18 -4
  1200. package/dist/utilities/telemetry/index.d.ts.map +1 -1
  1201. package/dist/utilities/telemetry/index.js +13 -1
  1202. package/dist/utilities/telemetry/index.js.map +1 -1
  1203. package/dist/utilities/telemetry/index.spec.js +43 -0
  1204. package/dist/utilities/telemetry/index.spec.js.map +1 -0
  1205. package/dist/utilities/telemetry/oneWayHash.d.ts.map +1 -1
  1206. package/dist/utilities/timestamp.d.ts.map +1 -1
  1207. package/dist/utilities/toKebabCase.d.ts.map +1 -1
  1208. package/dist/utilities/transformColumnPreferences.d.ts.map +1 -1
  1209. package/dist/utilities/transformPointDataToPayload.d.ts +7 -0
  1210. package/dist/utilities/transformPointDataToPayload.d.ts.map +1 -0
  1211. package/dist/utilities/transformPointDataToPayload.js +28 -0
  1212. package/dist/utilities/transformPointDataToPayload.js.map +1 -0
  1213. package/dist/utilities/transformWhereQuery.d.ts.map +1 -1
  1214. package/dist/utilities/traverseFields.d.ts.map +1 -1
  1215. package/dist/utilities/traverseFields.js +20 -22
  1216. package/dist/utilities/traverseFields.js.map +1 -1
  1217. package/dist/utilities/traverseFields.spec.js +112 -0
  1218. package/dist/utilities/traverseFields.spec.js.map +1 -1
  1219. package/dist/utilities/traverseForLocalizedFields.d.ts.map +1 -1
  1220. package/dist/utilities/unflatten.d.ts.map +1 -1
  1221. package/dist/utilities/unflattenData.d.ts +3 -0
  1222. package/dist/utilities/unflattenData.d.ts.map +1 -0
  1223. package/dist/utilities/unflattenData.js +14 -0
  1224. package/dist/utilities/unflattenData.js.map +1 -0
  1225. package/dist/utilities/validateMimeType.d.ts.map +1 -1
  1226. package/dist/utilities/validateTimezones.d.ts.map +1 -1
  1227. package/dist/utilities/validateWhereQuery.d.ts.map +1 -1
  1228. package/dist/utilities/wordBoundariesRegex.d.ts.map +1 -1
  1229. package/dist/utilities/wrapInternalEndpoints.d.ts.map +1 -1
  1230. package/dist/utilities/zod.d.ts +5 -0
  1231. package/dist/utilities/zod.d.ts.map +1 -0
  1232. package/dist/utilities/zod.js +21 -0
  1233. package/dist/utilities/zod.js.map +1 -0
  1234. package/dist/versions/baseFields.d.ts.map +1 -1
  1235. package/dist/versions/buildCollectionFields.d.ts.map +1 -1
  1236. package/dist/versions/buildGlobalFields.d.ts.map +1 -1
  1237. package/dist/versions/buildVersionCompoundIndexes.d.ts.map +1 -1
  1238. package/dist/versions/defaults.d.ts.map +1 -1
  1239. package/dist/versions/deleteCollectionVersions.d.ts.map +1 -1
  1240. package/dist/versions/deleteScheduledPublishJobs.d.ts.map +1 -1
  1241. package/dist/versions/deleteScheduledPublishJobs.js +2 -2
  1242. package/dist/versions/deleteScheduledPublishJobs.js.map +1 -1
  1243. package/dist/versions/drafts/appendVersionToQueryKey.d.ts.map +1 -1
  1244. package/dist/versions/drafts/appendVersionToQueryKey.js +1 -3
  1245. package/dist/versions/drafts/appendVersionToQueryKey.js.map +1 -1
  1246. package/dist/versions/drafts/appendVersionToQueryKey.spec.js +28 -0
  1247. package/dist/versions/drafts/appendVersionToQueryKey.spec.js.map +1 -0
  1248. package/dist/versions/drafts/getQueryDraftsSelect.d.ts.map +1 -1
  1249. package/dist/versions/drafts/getQueryDraftsSort.d.ts.map +1 -1
  1250. package/dist/versions/drafts/replaceWithDraftIfAvailable.d.ts.map +1 -1
  1251. package/dist/versions/enforceMaxVersions.d.ts.map +1 -1
  1252. package/dist/versions/getLatestCollectionVersion.d.ts.map +1 -1
  1253. package/dist/versions/getLatestGlobalVersion.d.ts.map +1 -1
  1254. package/dist/versions/migrations/localizeStatus/shared.d.ts.map +1 -1
  1255. package/dist/versions/payloadPackageList.d.ts.map +1 -1
  1256. package/dist/versions/payloadPackageList.js +0 -1
  1257. package/dist/versions/payloadPackageList.js.map +1 -1
  1258. package/dist/versions/schedule/job.d.ts.map +1 -1
  1259. package/dist/versions/schedule/job.js +4 -1
  1260. package/dist/versions/schedule/job.js.map +1 -1
  1261. package/package.json +24 -7
  1262. package/skills/payload/SKILL.md +526 -0
  1263. package/skills/payload/reference/ACCESS-CONTROL-ADVANCED.md +704 -0
  1264. package/skills/payload/reference/ACCESS-CONTROL.md +696 -0
  1265. package/skills/payload/reference/ADAPTERS.md +305 -0
  1266. package/skills/payload/reference/ADVANCED.md +386 -0
  1267. package/skills/payload/reference/COLLECTIONS.md +333 -0
  1268. package/skills/payload/reference/ENDPOINTS.md +634 -0
  1269. package/skills/payload/reference/FIELD-TYPE-GUARDS.md +553 -0
  1270. package/skills/payload/reference/FIELDS.md +745 -0
  1271. package/skills/payload/reference/HOOKS.md +186 -0
  1272. package/skills/payload/reference/PLUGIN-DEVELOPMENT.md +1436 -0
  1273. package/skills/payload/reference/QUERIES.md +274 -0
  1274. package/dist/bin/build.d.ts +0 -25
  1275. package/dist/bin/build.d.ts.map +0 -1
  1276. package/dist/bin/build.js +0 -80
  1277. package/dist/bin/build.js.map +0 -1
  1278. package/dist/bin/build.spec.js +0 -170
  1279. package/dist/bin/build.spec.js.map +0 -1
  1280. package/dist/bin/generateImportMap/generateImportMap.spec.js.map +0 -1
  1281. package/dist/bin/generateImportMap/index.d.ts.map +0 -1
  1282. package/dist/bin/generateImportMap/index.js.map +0 -1
  1283. package/dist/bin/generateImportMap/iterateCollections.d.ts.map +0 -1
  1284. package/dist/bin/generateImportMap/iterateCollections.js.map +0 -1
  1285. package/dist/bin/generateImportMap/iterateConfig.d.ts.map +0 -1
  1286. package/dist/bin/generateImportMap/iterateConfig.js.map +0 -1
  1287. package/dist/bin/generateImportMap/iterateFields.d.ts.map +0 -1
  1288. package/dist/bin/generateImportMap/iterateFields.js.map +0 -1
  1289. package/dist/bin/generateImportMap/iterateGlobals.d.ts.map +0 -1
  1290. package/dist/bin/generateImportMap/iterateGlobals.js.map +0 -1
  1291. package/dist/bin/generateImportMap/utilities/addPayloadComponentToImportMap.d.ts.map +0 -1
  1292. package/dist/bin/generateImportMap/utilities/addPayloadComponentToImportMap.js.map +0 -1
  1293. package/dist/bin/generateImportMap/utilities/getFromImportMap.d.ts.map +0 -1
  1294. package/dist/bin/generateImportMap/utilities/getFromImportMap.js.map +0 -1
  1295. package/dist/bin/generateImportMap/utilities/getImportMapToBaseDirPath.d.ts.map +0 -1
  1296. package/dist/bin/generateImportMap/utilities/getImportMapToBaseDirPath.js.map +0 -1
  1297. package/dist/bin/generateImportMap/utilities/parsePayloadComponent.d.ts.map +0 -1
  1298. package/dist/bin/generateImportMap/utilities/parsePayloadComponent.js.map +0 -1
  1299. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.d.ts.map +0 -1
  1300. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.js.map +0 -1
  1301. package/dist/bin/generateTypes.d.ts +0 -6
  1302. package/dist/bin/generateTypes.d.ts.map +0 -1
  1303. package/dist/bin/generateTypes.js.map +0 -1
  1304. package/dist/bin/index.d.ts +0 -2
  1305. package/dist/bin/index.d.ts.map +0 -1
  1306. package/dist/bin/index.js +0 -200
  1307. package/dist/bin/index.js.map +0 -1
  1308. package/dist/bin/info.d.ts +0 -2
  1309. package/dist/bin/info.d.ts.map +0 -1
  1310. package/dist/bin/info.js +0 -56
  1311. package/dist/bin/info.js.map +0 -1
  1312. package/dist/bin/loadEnv.d.ts.map +0 -1
  1313. package/dist/bin/loadEnv.js.map +0 -1
  1314. package/dist/bin/migrate.d.ts +0 -15
  1315. package/dist/bin/migrate.d.ts.map +0 -1
  1316. package/dist/bin/migrate.js +0 -102
  1317. package/dist/bin/migrate.js.map +0 -1
  1318. package/dist/database/defaultUpdateJobs.d.ts +0 -3
  1319. package/dist/database/defaultUpdateJobs.d.ts.map +0 -1
  1320. package/dist/database/defaultUpdateJobs.js +0 -41
  1321. package/dist/database/defaultUpdateJobs.js.map +0 -1
  1322. package/dist/fields/baseFields/slug/countVersions.d.ts +0 -13
  1323. package/dist/fields/baseFields/slug/countVersions.d.ts.map +0 -1
  1324. package/dist/fields/baseFields/slug/countVersions.js +0 -29
  1325. package/dist/fields/baseFields/slug/countVersions.js.map +0 -1
  1326. package/dist/fields/baseFields/slug/index.d.ts +0 -89
  1327. package/dist/fields/baseFields/slug/index.d.ts.map +0 -1
  1328. package/dist/fields/baseFields/slug/index.js +0 -81
  1329. package/dist/fields/baseFields/slug/index.js.map +0 -1
  1330. package/dist/uploads/tempFile.d.ts +0 -7
  1331. package/dist/uploads/tempFile.d.ts.map +0 -1
  1332. package/dist/uploads/tempFile.js +0 -39
  1333. package/dist/uploads/tempFile.js.map +0 -1
  1334. package/dist/utilities/isRSCEnabled.d.ts +0 -12
  1335. package/dist/utilities/isRSCEnabled.d.ts.map +0 -1
  1336. package/dist/utilities/isRSCEnabled.js +0 -14
  1337. package/dist/utilities/isRSCEnabled.js.map +0 -1
  1338. /package/dist/{bin → cli/commands}/generateImportMap/generateImportMap.spec.js +0 -0
  1339. /package/dist/{bin → cli/commands}/generateImportMap/iterateFields.js +0 -0
  1340. /package/dist/{bin → cli/commands}/generateImportMap/iterateGlobals.js +0 -0
  1341. /package/dist/{bin → cli/commands}/generateImportMap/utilities/addPayloadComponentToImportMap.js +0 -0
  1342. /package/dist/{bin → cli/commands}/generateImportMap/utilities/getFromImportMap.js +0 -0
  1343. /package/dist/{bin → cli/commands}/generateImportMap/utilities/getImportMapToBaseDirPath.d.ts +0 -0
  1344. /package/dist/{bin → cli/commands}/generateImportMap/utilities/getImportMapToBaseDirPath.js +0 -0
  1345. /package/dist/{bin → cli/commands}/generateImportMap/utilities/parsePayloadComponent.js +0 -0
  1346. /package/dist/{bin → cli/commands}/generateImportMap/utilities/resolveImportMapFilePath.d.ts +0 -0
  1347. /package/dist/{bin → cli/runtime}/loadEnv.d.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/globals/operations/local/findOne.ts"],"sourcesContent":["import type { FindOptions } from '../../../collections/operations/local/find.js'\nimport type {\n GlobalSlug,\n Payload,\n RequestContext,\n TypedFallbackLocale,\n TypedLocale,\n} from '../../../index.js'\nimport type {\n Document,\n PayloadRequest,\n PopulateType,\n SelectType,\n TransformGlobalWithSelect,\n} from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type { DraftFlagFromGlobalSlug, SelectFromGlobalSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { findOneOperation, type GlobalFindOneArgs } from '../findOne.js'\n\ntype BaseFindOneOptions<TSlug extends GlobalSlug, TSelect extends SelectType> = {\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * You may pass the document data directly which will skip the `db.findOne` database query.\n * This is useful if you want to use this endpoint solely for running hooks and populating data.\n */\n data?: Record<string, unknown>\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * When set to `true`, errors will not be thrown.\n */\n disableErrors?: boolean\n /**\n * Whether the document should be queried from the versions table/collection or not. [More](https://payloadcms.com/docs/versions/drafts#draft-api)\n */\n draft?: boolean\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: TypedFallbackLocale\n /**\n * Include info about the lock status to the result with fields: `_isLocked` and `_userEditing`\n */\n includeLockStatus?: boolean\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * the Global slug to operate against.\n */\n slug: TSlug\n // TODO: Strongly type User as TypedUser (= User in v4.0)\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: Document\n} & Pick<FindOptions<string, SelectType>, 'select'> &\n Pick<GlobalFindOneArgs, 'flattenLocales'>\n\nexport type Options<TSlug extends GlobalSlug, TSelect extends SelectType> = BaseFindOneOptions<\n TSlug,\n TSelect\n> &\n DraftFlagFromGlobalSlug<TSlug>\n\nexport async function findOneGlobalLocal<\n TSlug extends GlobalSlug,\n TSelect extends SelectFromGlobalSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<TransformGlobalWithSelect<TSlug, TSelect>> {\n const {\n slug: globalSlug,\n data,\n depth,\n disableErrors,\n draft = false,\n flattenLocales,\n includeLockStatus,\n overrideAccess = true,\n populate,\n select,\n showHiddenFields,\n } = options\n\n const globalConfig = payload.globals.config.find((config) => config.slug === globalSlug)\n\n if (!globalConfig) {\n throw new APIError(`The global with slug ${String(globalSlug)} can't be found.`)\n }\n\n return findOneOperation({\n slug: globalSlug as string,\n data,\n depth,\n disableErrors,\n draft,\n flattenLocales,\n globalConfig,\n includeLockStatus,\n overrideAccess,\n populate,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n select,\n showHiddenFields,\n })\n}\n"],"names":["APIError","createLocalReq","findOneOperation","findOneGlobalLocal","payload","options","slug","globalSlug","data","depth","disableErrors","draft","flattenLocales","includeLockStatus","overrideAccess","populate","select","showHiddenFields","globalConfig","globals","config","find","String","req"],"mappings":"AAkBA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,gBAAgB,QAAgC,gBAAe;AA6ExE,OAAO,eAAeC,mBAIpBC,OAAgB,EAChBC,OAAgC;IAEhC,MAAM,EACJC,MAAMC,UAAU,EAChBC,IAAI,EACJC,KAAK,EACLC,aAAa,EACbC,QAAQ,KAAK,EACbC,cAAc,EACdC,iBAAiB,EACjBC,iBAAiB,IAAI,EACrBC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EACjB,GAAGZ;IAEJ,MAAMa,eAAed,QAAQe,OAAO,CAACC,MAAM,CAACC,IAAI,CAAC,CAACD,SAAWA,OAAOd,IAAI,KAAKC;IAE7E,IAAI,CAACW,cAAc;QACjB,MAAM,IAAIlB,SAAS,CAAC,qBAAqB,EAAEsB,OAAOf,YAAY,gBAAgB,CAAC;IACjF;IAEA,OAAOL,iBAAiB;QACtBI,MAAMC;QACNC;QACAC;QACAC;QACAC;QACAC;QACAM;QACAL;QACAC;QACAC;QACAQ,KAAK,MAAMtB,eAAeI,SAAkCD;QAC5DY;QACAC;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../src/globals/operations/local/findOne.ts"],"sourcesContent":["import type { FindOptions } from '../../../collections/operations/local/find.js'\nimport type {\n GlobalSlug,\n Payload,\n RequestContext,\n TypedFallbackLocale,\n TypedLocale,\n User,\n} from '../../../index.js'\nimport type {\n PayloadRequest,\n PopulateType,\n SelectType,\n TransformGlobalWithSelect,\n} from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type { DraftFlagFromGlobalSlug, SelectFromGlobalSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { findOneOperation, type GlobalFindOneArgs } from '../findOne.js'\n\ntype BaseFindOneOptions<TSlug extends GlobalSlug, TSelect extends SelectType> = {\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * You may pass the document data directly which will skip the `db.findOne` database query.\n * This is useful if you want to use this endpoint solely for running hooks and populating data.\n */\n data?: Record<string, unknown>\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * When set to `true`, errors will not be thrown.\n */\n disableErrors?: boolean\n /**\n * Whether the document should be queried from the versions table/collection or not. [More](https://payloadcms.com/docs/versions/drafts#draft-api)\n */\n draft?: boolean\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: TypedFallbackLocale\n /**\n * Include info about the lock status to the result with fields: `_isLocked` and `_userEditing`\n */\n includeLockStatus?: boolean\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * the Global slug to operate against.\n */\n slug: TSlug\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: null | User\n} & Pick<FindOptions<string, SelectType>, 'select'> &\n Pick<GlobalFindOneArgs, 'flattenLocales'>\n\nexport type Options<TSlug extends GlobalSlug, TSelect extends SelectType> = BaseFindOneOptions<\n TSlug,\n TSelect\n> &\n DraftFlagFromGlobalSlug<TSlug>\n\nexport async function findOneGlobalLocal<\n TSlug extends GlobalSlug,\n TSelect extends SelectFromGlobalSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<TransformGlobalWithSelect<TSlug, TSelect>> {\n const {\n slug: globalSlug,\n data,\n depth,\n disableErrors,\n draft = false,\n flattenLocales,\n includeLockStatus,\n overrideAccess = true,\n populate,\n select,\n showHiddenFields,\n } = options\n\n const globalConfig = payload.globals.config.find((config) => config.slug === globalSlug)\n\n if (!globalConfig) {\n throw new APIError(`The global with slug ${String(globalSlug)} can't be found.`)\n }\n\n return findOneOperation({\n slug: globalSlug as string,\n data,\n depth,\n disableErrors,\n draft,\n flattenLocales,\n globalConfig,\n includeLockStatus,\n overrideAccess,\n populate,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n select,\n showHiddenFields,\n })\n}\n"],"names":["APIError","createLocalReq","findOneOperation","findOneGlobalLocal","payload","options","slug","globalSlug","data","depth","disableErrors","draft","flattenLocales","includeLockStatus","overrideAccess","populate","select","showHiddenFields","globalConfig","globals","config","find","String","req"],"mappings":"AAkBA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,gBAAgB,QAAgC,gBAAe;AA4ExE,OAAO,eAAeC,mBAIpBC,OAAgB,EAChBC,OAAgC;IAEhC,MAAM,EACJC,MAAMC,UAAU,EAChBC,IAAI,EACJC,KAAK,EACLC,aAAa,EACbC,QAAQ,KAAK,EACbC,cAAc,EACdC,iBAAiB,EACjBC,iBAAiB,IAAI,EACrBC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EACjB,GAAGZ;IAEJ,MAAMa,eAAed,QAAQe,OAAO,CAACC,MAAM,CAACC,IAAI,CAAC,CAACD,SAAWA,OAAOd,IAAI,KAAKC;IAE7E,IAAI,CAACW,cAAc;QACjB,MAAM,IAAIlB,SAAS,CAAC,qBAAqB,EAAEsB,OAAOf,YAAY,gBAAgB,CAAC;IACjF;IAEA,OAAOL,iBAAiB;QACtBI,MAAMC;QACNC;QACAC;QACAC;QACAC;QACAC;QACAM;QACAL;QACAC;QACAC;QACAQ,KAAK,MAAMtB,eAAeI,SAAkCD;QAC5DY;QACAC;IACF;AACF"}
@@ -1,5 +1,5 @@
1
- import type { FindOptions, GlobalSlug, Payload, RequestContext, TypedLocale } from '../../../index.js';
2
- import type { Document, PayloadRequest, PopulateType, SelectType } from '../../../types/index.js';
1
+ import type { FindOptions, GlobalSlug, Payload, RequestContext, TypedLocale, User } from '../../../index.js';
2
+ import type { PayloadRequest, PopulateType, SelectType } from '../../../types/index.js';
3
3
  import type { TypeWithVersion } from '../../../versions/types.js';
4
4
  import type { DataFromGlobalSlug } from '../../config/types.js';
5
5
  export type Options<TSlug extends GlobalSlug> = {
@@ -58,7 +58,7 @@ export type Options<TSlug extends GlobalSlug> = {
58
58
  /**
59
59
  * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
60
60
  */
61
- user?: Document;
61
+ user?: null | User;
62
62
  } & Pick<FindOptions<string, SelectType>, 'select'>;
63
63
  export declare function findGlobalVersionByIDLocal<TSlug extends GlobalSlug>(payload: Payload, options: Options<TSlug>): Promise<TypeWithVersion<DataFromGlobalSlug<TSlug>>>;
64
64
  //# sourceMappingURL=findVersionByID.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"findVersionByID.d.ts","sourceRoot":"","sources":["../../../../src/globals/operations/local/findVersionByID.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,OAAO,EACP,cAAc,EACd,WAAW,EACZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEjG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAM/D,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,UAAU,IAAI;IAC9C;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IACpC;;OAEG;IACH,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IAC5B;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAE7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;OAEG;IACH,IAAI,EAAE,KAAK,CAAA;IAEX;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAA;CAChB,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAA;AAEnD,wBAAsB,0BAA0B,CAAC,KAAK,SAAS,UAAU,EACvE,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,GACtB,OAAO,CAAC,eAAe,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CA6BrD"}
1
+ {"version":3,"file":"findVersionByID.d.ts","sourceRoot":"","sources":["../../../../src/globals/operations/local/findVersionByID.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,OAAO,EACP,cAAc,EACd,WAAW,EACX,IAAI,EACL,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEvF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAM/D,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,UAAU,IAAI;IAC9C;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IACpC;;OAEG;IACH,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IAC5B;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAE7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;OAEG;IACH,IAAI,EAAE,KAAK,CAAA;IACX;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;CACnB,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAA;AAEnD,wBAAsB,0BAA0B,CAAC,KAAK,SAAS,UAAU,EACvE,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,GACtB,OAAO,CAAC,eAAe,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CA6BrD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/globals/operations/local/findVersionByID.ts"],"sourcesContent":["import type {\n FindOptions,\n GlobalSlug,\n Payload,\n RequestContext,\n TypedLocale,\n} from '../../../index.js'\nimport type { Document, PayloadRequest, PopulateType, SelectType } from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type { TypeWithVersion } from '../../../versions/types.js'\nimport type { DataFromGlobalSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { findVersionByIDOperation } from '../findVersionByID.js'\n\nexport type Options<TSlug extends GlobalSlug> = {\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * When set to `true`, errors will not be thrown.\n * `null` will be returned instead, if the document on this ID was not found.\n */\n disableErrors?: boolean\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: false | TypedLocale\n /**\n * The ID of the version to find.\n */\n id: number | string\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * the Global slug to operate against.\n */\n slug: TSlug\n // TODO: Strongly type User as TypedUser (= User in v4.0)\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: Document\n} & Pick<FindOptions<string, SelectType>, 'select'>\n\nexport async function findGlobalVersionByIDLocal<TSlug extends GlobalSlug>(\n payload: Payload,\n options: Options<TSlug>,\n): Promise<TypeWithVersion<DataFromGlobalSlug<TSlug>>> {\n const {\n id,\n slug: globalSlug,\n depth,\n disableErrors = false,\n overrideAccess = true,\n populate,\n select,\n showHiddenFields,\n } = options\n\n const globalConfig = payload.globals.config.find((config) => config.slug === globalSlug)\n\n if (!globalConfig) {\n throw new APIError(`The global with slug ${String(globalSlug)} can't be found.`)\n }\n\n return findVersionByIDOperation({\n id,\n depth,\n disableErrors,\n globalConfig,\n overrideAccess,\n populate,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n select,\n showHiddenFields,\n })\n}\n"],"names":["APIError","createLocalReq","findVersionByIDOperation","findGlobalVersionByIDLocal","payload","options","id","slug","globalSlug","depth","disableErrors","overrideAccess","populate","select","showHiddenFields","globalConfig","globals","config","find","String","req"],"mappings":"AAYA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,wBAAwB,QAAQ,wBAAuB;AA+DhE,OAAO,eAAeC,2BACpBC,OAAgB,EAChBC,OAAuB;IAEvB,MAAM,EACJC,EAAE,EACFC,MAAMC,UAAU,EAChBC,KAAK,EACLC,gBAAgB,KAAK,EACrBC,iBAAiB,IAAI,EACrBC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EACjB,GAAGT;IAEJ,MAAMU,eAAeX,QAAQY,OAAO,CAACC,MAAM,CAACC,IAAI,CAAC,CAACD,SAAWA,OAAOV,IAAI,KAAKC;IAE7E,IAAI,CAACO,cAAc;QACjB,MAAM,IAAIf,SAAS,CAAC,qBAAqB,EAAEmB,OAAOX,YAAY,gBAAgB,CAAC;IACjF;IAEA,OAAON,yBAAyB;QAC9BI;QACAG;QACAC;QACAK;QACAJ;QACAC;QACAQ,KAAK,MAAMnB,eAAeI,SAAkCD;QAC5DS;QACAC;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../src/globals/operations/local/findVersionByID.ts"],"sourcesContent":["import type {\n FindOptions,\n GlobalSlug,\n Payload,\n RequestContext,\n TypedLocale,\n User,\n} from '../../../index.js'\nimport type { PayloadRequest, PopulateType, SelectType } from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type { TypeWithVersion } from '../../../versions/types.js'\nimport type { DataFromGlobalSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { findVersionByIDOperation } from '../findVersionByID.js'\n\nexport type Options<TSlug extends GlobalSlug> = {\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * When set to `true`, errors will not be thrown.\n * `null` will be returned instead, if the document on this ID was not found.\n */\n disableErrors?: boolean\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: false | TypedLocale\n /**\n * The ID of the version to find.\n */\n id: number | string\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * the Global slug to operate against.\n */\n slug: TSlug\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: null | User\n} & Pick<FindOptions<string, SelectType>, 'select'>\n\nexport async function findGlobalVersionByIDLocal<TSlug extends GlobalSlug>(\n payload: Payload,\n options: Options<TSlug>,\n): Promise<TypeWithVersion<DataFromGlobalSlug<TSlug>>> {\n const {\n id,\n slug: globalSlug,\n depth,\n disableErrors = false,\n overrideAccess = true,\n populate,\n select,\n showHiddenFields,\n } = options\n\n const globalConfig = payload.globals.config.find((config) => config.slug === globalSlug)\n\n if (!globalConfig) {\n throw new APIError(`The global with slug ${String(globalSlug)} can't be found.`)\n }\n\n return findVersionByIDOperation({\n id,\n depth,\n disableErrors,\n globalConfig,\n overrideAccess,\n populate,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n select,\n showHiddenFields,\n })\n}\n"],"names":["APIError","createLocalReq","findVersionByIDOperation","findGlobalVersionByIDLocal","payload","options","id","slug","globalSlug","depth","disableErrors","overrideAccess","populate","select","showHiddenFields","globalConfig","globals","config","find","String","req"],"mappings":"AAaA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,wBAAwB,QAAQ,wBAAuB;AA8DhE,OAAO,eAAeC,2BACpBC,OAAgB,EAChBC,OAAuB;IAEvB,MAAM,EACJC,EAAE,EACFC,MAAMC,UAAU,EAChBC,KAAK,EACLC,gBAAgB,KAAK,EACrBC,iBAAiB,IAAI,EACrBC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EACjB,GAAGT;IAEJ,MAAMU,eAAeX,QAAQY,OAAO,CAACC,MAAM,CAACC,IAAI,CAAC,CAACD,SAAWA,OAAOV,IAAI,KAAKC;IAE7E,IAAI,CAACO,cAAc;QACjB,MAAM,IAAIf,SAAS,CAAC,qBAAqB,EAAEmB,OAAOX,YAAY,gBAAgB,CAAC;IACjF;IAEA,OAAON,yBAAyB;QAC9BI;QACAG;QACAC;QACAK;QACAJ;QACAC;QACAQ,KAAK,MAAMnB,eAAeI,SAAkCD;QAC5DS;QACAC;IACF;AACF"}
@@ -1,6 +1,6 @@
1
1
  import type { PaginatedDocs } from '../../../database/types.js';
2
- import type { FindOptions, GlobalSlug, Payload, RequestContext, TypedLocale } from '../../../index.js';
3
- import type { Document, PayloadRequest, PopulateType, SelectType, Sort, Where } from '../../../types/index.js';
2
+ import type { FindOptions, GlobalSlug, Payload, RequestContext, TypedLocale, User } from '../../../index.js';
3
+ import type { PayloadRequest, PopulateType, SelectType, Sort, Where } from '../../../types/index.js';
4
4
  import type { TypeWithVersion } from '../../../versions/types.js';
5
5
  import type { DataFromGlobalSlug } from '../../config/types.js';
6
6
  export type Options<TSlug extends GlobalSlug> = {
@@ -72,7 +72,7 @@ export type Options<TSlug extends GlobalSlug> = {
72
72
  /**
73
73
  * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
74
74
  */
75
- user?: Document;
75
+ user?: null | User;
76
76
  /**
77
77
  * A filter [query](https://payloadcms.com/docs/queries/overview)
78
78
  */
@@ -1 +1 @@
1
- {"version":3,"file":"findVersions.d.ts","sourceRoot":"","sources":["../../../../src/globals/operations/local/findVersions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,OAAO,EACP,cAAc,EACd,WAAW,EACZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,KAAK,EACN,MAAM,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAM/D,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,UAAU,IAAI;IAC9C;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IACpC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IAC5B;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;OAEG;IACH,IAAI,EAAE,KAAK,CAAA;IACX;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,CAAA;IAEX;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAA;AAEnD,wBAAsB,uBAAuB,CAAC,KAAK,SAAS,UAAU,EACpE,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,GACtB,OAAO,CAAC,aAAa,CAAC,eAAe,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAmCpE"}
1
+ {"version":3,"file":"findVersions.d.ts","sourceRoot":"","sources":["../../../../src/globals/operations/local/findVersions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,OAAO,EACP,cAAc,EACd,WAAW,EACX,IAAI,EACL,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EA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AAC,eAAe,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAmCpE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/globals/operations/local/findVersions.ts"],"sourcesContent":["import type { PaginatedDocs } from '../../../database/types.js'\nimport type {\n FindOptions,\n GlobalSlug,\n Payload,\n RequestContext,\n TypedLocale,\n} from '../../../index.js'\nimport type {\n Document,\n PayloadRequest,\n PopulateType,\n SelectType,\n Sort,\n Where,\n} from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type { TypeWithVersion } from '../../../versions/types.js'\nimport type { DataFromGlobalSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { findVersionsOperation } from '../findVersions.js'\n\nexport type Options<TSlug extends GlobalSlug> = {\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: false | TypedLocale\n /**\n * The maximum related documents to be returned.\n * Defaults unless `defaultLimit` is specified for the collection config\n * @default 10\n */\n limit?: number\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * Get a specific page number\n * @default 1\n */\n page?: number\n /**\n * Set to `false` to return all documents and avoid querying for document counts which introduces some overhead.\n * You can also combine that property with a specified `limit` to limit documents but avoid the count query.\n */\n pagination?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * the Global slug to operate against.\n */\n slug: TSlug\n /**\n * Sort the documents, can be a string or an array of strings\n * @example '-version.createdAt' // Sort DESC by createdAt\n * @example ['version.group', '-version.createdAt'] // sort by 2 fields, ASC group and DESC createdAt\n */\n sort?: Sort\n // TODO: Strongly type User as TypedUser (= User in v4.0)\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: Document\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: Where\n} & Pick<FindOptions<string, SelectType>, 'select'>\n\nexport async function findGlobalVersionsLocal<TSlug extends GlobalSlug>(\n payload: Payload,\n options: Options<TSlug>,\n): Promise<PaginatedDocs<TypeWithVersion<DataFromGlobalSlug<TSlug>>>> {\n const {\n slug: globalSlug,\n depth,\n limit,\n overrideAccess = true,\n page,\n pagination = true,\n populate,\n select,\n showHiddenFields,\n sort,\n where,\n } = options\n\n const globalConfig = payload.globals.config.find((config) => config.slug === globalSlug)\n\n if (!globalConfig) {\n throw new APIError(`The global with slug ${String(globalSlug)} can't be found.`)\n }\n\n return findVersionsOperation({\n depth,\n globalConfig,\n limit,\n overrideAccess,\n page,\n pagination,\n populate,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n select,\n showHiddenFields,\n sort,\n where,\n })\n}\n"],"names":["APIError","createLocalReq","findVersionsOperation","findGlobalVersionsLocal","payload","options","slug","globalSlug","depth","limit","overrideAccess","page","pagination","populate","select","showHiddenFields","sort","where","globalConfig","globals","config","find","String","req"],"mappings":"AAoBA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,qBAAqB,QAAQ,qBAAoB;AA+E1D,OAAO,eAAeC,wBACpBC,OAAgB,EAChBC,OAAuB;IAEvB,MAAM,EACJC,MAAMC,UAAU,EAChBC,KAAK,EACLC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,IAAI,EACJC,aAAa,IAAI,EACjBC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EAChBC,IAAI,EACJC,KAAK,EACN,GAAGZ;IAEJ,MAAMa,eAAed,QAAQe,OAAO,CAACC,MAAM,CAACC,IAAI,CAAC,CAACD,SAAWA,OAAOd,IAAI,KAAKC;IAE7E,IAAI,CAACW,cAAc;QACjB,MAAM,IAAIlB,SAAS,CAAC,qBAAqB,EAAEsB,OAAOf,YAAY,gBAAgB,CAAC;IACjF;IAEA,OAAOL,sBAAsB;QAC3BM;QACAU;QACAT;QACAC;QACAC;QACAC;QACAC;QACAU,KAAK,MAAMtB,eAAeI,SAAkCD;QAC5DU;QACAC;QACAC;QACAC;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../src/globals/operations/local/findVersions.ts"],"sourcesContent":["import type { PaginatedDocs } from '../../../database/types.js'\nimport type {\n FindOptions,\n GlobalSlug,\n Payload,\n RequestContext,\n TypedLocale,\n User,\n} from '../../../index.js'\nimport type { PayloadRequest, PopulateType, SelectType, Sort, Where } from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type { TypeWithVersion } from '../../../versions/types.js'\nimport type { DataFromGlobalSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { findVersionsOperation } from '../findVersions.js'\n\nexport type Options<TSlug extends GlobalSlug> = {\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: false | TypedLocale\n /**\n * The maximum related documents to be returned.\n * Defaults unless `defaultLimit` is specified for the collection config\n * @default 10\n */\n limit?: number\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * Get a specific page number\n * @default 1\n */\n page?: number\n /**\n * Set to `false` to return all documents and avoid querying for document counts which introduces some overhead.\n * You can also combine that property with a specified `limit` to limit documents but avoid the count query.\n */\n pagination?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * the Global slug to operate against.\n */\n slug: TSlug\n /**\n * Sort the documents, can be a string or an array of strings\n * @example '-version.createdAt' // Sort DESC by createdAt\n * @example ['version.group', '-version.createdAt'] // sort by 2 fields, ASC group and DESC createdAt\n */\n sort?: Sort\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: null | User\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: Where\n} & Pick<FindOptions<string, SelectType>, 'select'>\n\nexport async function findGlobalVersionsLocal<TSlug extends GlobalSlug>(\n payload: Payload,\n options: Options<TSlug>,\n): Promise<PaginatedDocs<TypeWithVersion<DataFromGlobalSlug<TSlug>>>> {\n const {\n slug: globalSlug,\n depth,\n limit,\n overrideAccess = true,\n page,\n pagination = true,\n populate,\n select,\n showHiddenFields,\n sort,\n where,\n } = options\n\n const globalConfig = payload.globals.config.find((config) => config.slug === globalSlug)\n\n if (!globalConfig) {\n throw new APIError(`The global with slug ${String(globalSlug)} can't be found.`)\n }\n\n return findVersionsOperation({\n depth,\n globalConfig,\n limit,\n overrideAccess,\n page,\n pagination,\n populate,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n select,\n showHiddenFields,\n sort,\n where,\n })\n}\n"],"names":["APIError","createLocalReq","findVersionsOperation","findGlobalVersionsLocal","payload","options","slug","globalSlug","depth","limit","overrideAccess","page","pagination","populate","select","showHiddenFields","sort","where","globalConfig","globals","config","find","String","req"],"mappings":"AAcA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,qBAAqB,QAAQ,qBAAoB;AA8E1D,OAAO,eAAeC,wBACpBC,OAAgB,EAChBC,OAAuB;IAEvB,MAAM,EACJC,MAAMC,UAAU,EAChBC,KAAK,EACLC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,IAAI,EACJC,aAAa,IAAI,EACjBC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EAChBC,IAAI,EACJC,KAAK,EACN,GAAGZ;IAEJ,MAAMa,eAAed,QAAQe,OAAO,CAACC,MAAM,CAACC,IAAI,CAAC,CAACD,SAAWA,OAAOd,IAAI,KAAKC;IAE7E,IAAI,CAACW,cAAc;QACjB,MAAM,IAAIlB,SAAS,CAAC,qBAAqB,EAAEsB,OAAOf,YAAY,gBAAgB,CAAC;IACjF;IAEA,OAAOL,sBAAsB;QAC3BM;QACAU;QACAT;QACAC;QACAC;QACAC;QACAC;QACAU,KAAK,MAAMtB,eAAeI,SAAkCD;QAC5DU;QACAC;QACAC;QACAC;IACF;AACF"}
@@ -1,5 +1,5 @@
1
- import type { GlobalSlug, Payload, RequestContext, TypedLocale } from '../../../index.js';
2
- import type { Document, PayloadRequest, PopulateType } from '../../../types/index.js';
1
+ import type { GlobalSlug, Payload, RequestContext, TypedLocale, User } from '../../../index.js';
2
+ import type { PayloadRequest, PopulateType } from '../../../types/index.js';
3
3
  import type { DataFromGlobalSlug } from '../../config/types.js';
4
4
  export type Options<TSlug extends GlobalSlug> = {
5
5
  /**
@@ -52,7 +52,7 @@ export type Options<TSlug extends GlobalSlug> = {
52
52
  /**
53
53
  * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
54
54
  */
55
- user?: Document;
55
+ user?: null | User;
56
56
  };
57
57
  export declare function restoreGlobalVersionLocal<TSlug extends GlobalSlug>(payload: Payload, options: Options<TSlug>): Promise<DataFromGlobalSlug<TSlug>>;
58
58
  //# sourceMappingURL=restoreVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"restoreVersion.d.ts","sourceRoot":"","sources":["../../../../src/globals/operations/local/restoreVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACzF,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAErF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAM/D,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,UAAU,IAAI;IAC9C;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IACpC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;OAEG;IACH,IAAI,EAAE,KAAK,CAAA;IAEX;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAA;CAChB,CAAA;AAED,wBAAsB,yBAAyB,CAAC,KAAK,SAAS,UAAU,EACtE,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,GACtB,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAkBpC"}
1
+ {"version":3,"file":"restoreVersion.d.ts","sourceRoot":"","sources":["../../../../src/globals/operations/local/restoreVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAC/F,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAE3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAM/D,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,UAAU,IAAI;IAC9C;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IACpC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;OAEG;IACH,IAAI,EAAE,KAAK,CAAA;IACX;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;CACnB,CAAA;AAED,wBAAsB,yBAAyB,CAAC,KAAK,SAAS,UAAU,EACtE,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,GACtB,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAkBpC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/globals/operations/local/restoreVersion.ts"],"sourcesContent":["import type { GlobalSlug, Payload, RequestContext, TypedLocale } from '../../../index.js'\nimport type { Document, PayloadRequest, PopulateType } from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type { DataFromGlobalSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { restoreVersionOperation } from '../restoreVersion.js'\n\nexport type Options<TSlug extends GlobalSlug> = {\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: false | TypedLocale\n /**\n * The ID of the version to restore.\n */\n id: string\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * the Global slug to operate against.\n */\n slug: TSlug\n // TODO: Strongly type User as TypedUser (= User in v4.0)\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: Document\n}\n\nexport async function restoreGlobalVersionLocal<TSlug extends GlobalSlug>(\n payload: Payload,\n options: Options<TSlug>,\n): Promise<DataFromGlobalSlug<TSlug>> {\n const { id, slug: globalSlug, depth, overrideAccess = true, populate, showHiddenFields } = options\n\n const globalConfig = payload.globals.config.find((config) => config.slug === globalSlug)\n\n if (!globalConfig) {\n throw new APIError(`The global with slug ${String(globalSlug)} can't be found.`)\n }\n\n return restoreVersionOperation({\n id,\n depth,\n globalConfig,\n overrideAccess,\n populate,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n showHiddenFields,\n })\n}\n"],"names":["APIError","createLocalReq","restoreVersionOperation","restoreGlobalVersionLocal","payload","options","id","slug","globalSlug","depth","overrideAccess","populate","showHiddenFields","globalConfig","globals","config","find","String","req"],"mappings":"AAKA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,uBAAuB,QAAQ,uBAAsB;AAyD9D,OAAO,eAAeC,0BACpBC,OAAgB,EAChBC,OAAuB;IAEvB,MAAM,EAAEC,EAAE,EAAEC,MAAMC,UAAU,EAAEC,KAAK,EAAEC,iBAAiB,IAAI,EAAEC,QAAQ,EAAEC,gBAAgB,EAAE,GAAGP;IAE3F,MAAMQ,eAAeT,QAAQU,OAAO,CAACC,MAAM,CAACC,IAAI,CAAC,CAACD,SAAWA,OAAOR,IAAI,KAAKC;IAE7E,IAAI,CAACK,cAAc;QACjB,MAAM,IAAIb,SAAS,CAAC,qBAAqB,EAAEiB,OAAOT,YAAY,gBAAgB,CAAC;IACjF;IAEA,OAAON,wBAAwB;QAC7BI;QACAG;QACAI;QACAH;QACAC;QACAO,KAAK,MAAMjB,eAAeI,SAAkCD;QAC5DQ;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../src/globals/operations/local/restoreVersion.ts"],"sourcesContent":["import type { GlobalSlug, Payload, RequestContext, TypedLocale, User } from '../../../index.js'\nimport type { PayloadRequest, PopulateType } from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type { DataFromGlobalSlug } from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { restoreVersionOperation } from '../restoreVersion.js'\n\nexport type Options<TSlug extends GlobalSlug> = {\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: false | TypedLocale\n /**\n * The ID of the version to restore.\n */\n id: string\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * the Global slug to operate against.\n */\n slug: TSlug\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: null | User\n}\n\nexport async function restoreGlobalVersionLocal<TSlug extends GlobalSlug>(\n payload: Payload,\n options: Options<TSlug>,\n): Promise<DataFromGlobalSlug<TSlug>> {\n const { id, slug: globalSlug, depth, overrideAccess = true, populate, showHiddenFields } = options\n\n const globalConfig = payload.globals.config.find((config) => config.slug === globalSlug)\n\n if (!globalConfig) {\n throw new APIError(`The global with slug ${String(globalSlug)} can't be found.`)\n }\n\n return restoreVersionOperation({\n id,\n depth,\n globalConfig,\n overrideAccess,\n populate,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n showHiddenFields,\n })\n}\n"],"names":["APIError","createLocalReq","restoreVersionOperation","restoreGlobalVersionLocal","payload","options","id","slug","globalSlug","depth","overrideAccess","populate","showHiddenFields","globalConfig","globals","config","find","String","req"],"mappings":"AAKA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,uBAAuB,QAAQ,uBAAsB;AAwD9D,OAAO,eAAeC,0BACpBC,OAAgB,EAChBC,OAAuB;IAEvB,MAAM,EAAEC,EAAE,EAAEC,MAAMC,UAAU,EAAEC,KAAK,EAAEC,iBAAiB,IAAI,EAAEC,QAAQ,EAAEC,gBAAgB,EAAE,GAAGP;IAE3F,MAAMQ,eAAeT,QAAQU,OAAO,CAACC,MAAM,CAACC,IAAI,CAAC,CAACD,SAAWA,OAAOR,IAAI,KAAKC;IAE7E,IAAI,CAACK,cAAc;QACjB,MAAM,IAAIb,SAAS,CAAC,qBAAqB,EAAEiB,OAAOT,YAAY,gBAAgB,CAAC;IACjF;IAEA,OAAON,wBAAwB;QAC7BI;QACAG;QACAI;QACAH;QACAC;QACAO,KAAK,MAAMjB,eAAeI,SAAkCD;QAC5DQ;IACF;AACF"}
@@ -1,7 +1,7 @@
1
1
  import type { DeepPartial } from 'ts-essentials';
2
- import type { Document, PayloadRequest, PopulateType, SelectType, TransformGlobalWithSelect } from '../../../types/index.js';
2
+ import type { PayloadRequest, PopulateType, SelectType, TransformGlobalWithSelect } from '../../../types/index.js';
3
3
  import type { DataFromGlobalSlug, DraftFlagFromGlobalSlug, SelectFromGlobalSlug } from '../../config/types.js';
4
- import { type FindOptions, type GlobalSlug, type Payload, type RequestContext, type TypedLocale } from '../../../index.js';
4
+ import { type FindOptions, type GlobalSlug, type Payload, type RequestContext, type TypedLocale, type User } from '../../../index.js';
5
5
  type BaseOptions<TSlug extends GlobalSlug, TSelect extends SelectType> = {
6
6
  /**
7
7
  * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,
@@ -71,7 +71,7 @@ type BaseOptions<TSlug extends GlobalSlug, TSelect extends SelectType> = {
71
71
  /**
72
72
  * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
73
73
  */
74
- user?: Document;
74
+ user?: null | User;
75
75
  } & Pick<FindOptions<string, SelectType>, 'select'>;
76
76
  export type Options<TSlug extends GlobalSlug, TSelect extends SelectType> = BaseOptions<TSlug, TSelect> & DraftFlagFromGlobalSlug<TSlug>;
77
77
  export declare function updateGlobalLocal<TSlug extends GlobalSlug, TSelect extends SelectFromGlobalSlug<TSlug>>(payload: Payload, options: Options<TSlug, TSelect>): Promise<TransformGlobalWithSelect<TSlug, TSelect>>;
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/globals/operations/local/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ACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IACpC;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IAC5B;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;OAEG;IACH,IAAI,EAAE,KAAK,CAAA;IACX;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;CACnB,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAA;AAEnD,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,UAAU,EAAE,OAAO,SAAS,UAAU,IAAI,WAAW,CACrF,KAAK,EACL,OAAO,CACR,GACC,uBAAuB,CAAC,KAAK,CAAC,CAAA;AAEhC,wBAAsB,iBAAiB,CACrC,KAAK,SAAS,UAAU,EACxB,OAAO,SAAS,oBAAoB,CAAC,KAAK,CAAC,EAE3C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,yBAAyB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAoCpD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/globals/operations/local/update.ts"],"sourcesContent":["import type { DeepPartial } from 'ts-essentials'\n\nimport type {\n Document,\n PayloadRequest,\n PopulateType,\n SelectType,\n TransformGlobalWithSelect,\n} from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type {\n DataFromGlobalSlug,\n DraftFlagFromGlobalSlug,\n SelectFromGlobalSlug,\n} from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport {\n deepCopyObjectSimple,\n type FindOptions,\n type GlobalSlug,\n type Payload,\n type RequestContext,\n type TypedLocale,\n} from '../../../index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { updateOperation } from '../update.js'\n\ntype BaseOptions<TSlug extends GlobalSlug, TSelect extends SelectType> = {\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * The global data to update.\n */\n data: DeepPartial<Omit<DataFromGlobalSlug<TSlug>, 'id'>>\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: false | TypedLocale\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * If you are uploading a file and would like to replace\n * the existing file instead of generating a new filename,\n * you can set the following property to `true`\n */\n overrideLock?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * Publish the document / documents in all locales. Only applies when localization is enabled\n * and the global has localized fields.\n *\n * @default undefined\n */\n publishAllLocales?: boolean\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * the Global slug to operate against.\n */\n slug: TSlug\n /**\n * Unpublish the document / documents in all locales. Only applies when localization is enabled\n * and the global has localized fields.\n */\n unpublishAllLocales?: boolean\n // TODO: Strongly type User as TypedUser (= User in v4.0)\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: Document\n} & Pick<FindOptions<string, SelectType>, 'select'>\n\nexport type Options<TSlug extends GlobalSlug, TSelect extends SelectType> = BaseOptions<\n TSlug,\n TSelect\n> &\n DraftFlagFromGlobalSlug<TSlug>\n\nexport async function updateGlobalLocal<\n TSlug extends GlobalSlug,\n TSelect extends SelectFromGlobalSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<TransformGlobalWithSelect<TSlug, TSelect>> {\n const {\n slug: globalSlug,\n data,\n depth,\n draft,\n overrideAccess = true,\n overrideLock,\n populate,\n publishAllLocales,\n select,\n showHiddenFields,\n unpublishAllLocales,\n } = options\n\n const globalConfig = payload.globals.config.find((config) => config.slug === globalSlug)\n\n if (!globalConfig) {\n throw new APIError(`The global with slug ${String(globalSlug)} can't be found.`)\n }\n\n return updateOperation<TSlug, TSelect>({\n slug: globalSlug as string,\n data: deepCopyObjectSimple(data), // Ensure mutation of data in create operation hooks doesn't affect the original data\n depth,\n draft,\n globalConfig,\n overrideAccess,\n overrideLock,\n populate,\n publishAllLocales,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n select,\n showHiddenFields,\n unpublishAllLocales,\n })\n}\n"],"names":["APIError","deepCopyObjectSimple","createLocalReq","updateOperation","updateGlobalLocal","payload","options","slug","globalSlug","data","depth","draft","overrideAccess","overrideLock","populate","publishAllLocales","select","showHiddenFields","unpublishAllLocales","globalConfig","globals","config","find","String","req"],"mappings":"AAgBA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SACEC,oBAAoB,QAMf,oBAAmB;AAC1B,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,eAAe,QAAQ,eAAc;AAiF9C,OAAO,eAAeC,kBAIpBC,OAAgB,EAChBC,OAAgC;IAEhC,MAAM,EACJC,MAAMC,UAAU,EAChBC,IAAI,EACJC,KAAK,EACLC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,YAAY,EACZC,QAAQ,EACRC,iBAAiB,EACjBC,MAAM,EACNC,gBAAgB,EAChBC,mBAAmB,EACpB,GAAGZ;IAEJ,MAAMa,eAAed,QAAQe,OAAO,CAACC,MAAM,CAACC,IAAI,CAAC,CAACD,SAAWA,OAAOd,IAAI,KAAKC;IAE7E,IAAI,CAACW,cAAc;QACjB,MAAM,IAAInB,SAAS,CAAC,qBAAqB,EAAEuB,OAAOf,YAAY,gBAAgB,CAAC;IACjF;IAEA,OAAOL,gBAAgC;QACrCI,MAAMC;QACNC,MAAMR,qBAAqBQ;QAC3BC;QACAC;QACAQ;QACAP;QACAC;QACAC;QACAC;QACAS,KAAK,MAAMtB,eAAeI,SAAkCD;QAC5DW;QACAC;QACAC;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../src/globals/operations/local/update.ts"],"sourcesContent":["import type { DeepPartial } from 'ts-essentials'\n\nimport type {\n PayloadRequest,\n PopulateType,\n SelectType,\n TransformGlobalWithSelect,\n} from '../../../types/index.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type {\n DataFromGlobalSlug,\n DraftFlagFromGlobalSlug,\n SelectFromGlobalSlug,\n} from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport {\n deepCopyObjectSimple,\n type FindOptions,\n type GlobalSlug,\n type Payload,\n type RequestContext,\n type TypedLocale,\n type User,\n} from '../../../index.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { updateOperation } from '../update.js'\n\ntype BaseOptions<TSlug extends GlobalSlug, TSelect extends SelectType> = {\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * The global data to update.\n */\n data: DeepPartial<Omit<DataFromGlobalSlug<TSlug>, 'id'>>\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: false | TypedLocale\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * If you are uploading a file and would like to replace\n * the existing file instead of generating a new filename,\n * you can set the following property to `true`\n */\n overrideLock?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * Publish the document / documents in all locales. Only applies when localization is enabled\n * and the global has localized fields.\n *\n * @default undefined\n */\n publishAllLocales?: boolean\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * the Global slug to operate against.\n */\n slug: TSlug\n /**\n * Unpublish the document / documents in all locales. Only applies when localization is enabled\n * and the global has localized fields.\n */\n unpublishAllLocales?: boolean\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: null | User\n} & Pick<FindOptions<string, SelectType>, 'select'>\n\nexport type Options<TSlug extends GlobalSlug, TSelect extends SelectType> = BaseOptions<\n TSlug,\n TSelect\n> &\n DraftFlagFromGlobalSlug<TSlug>\n\nexport async function updateGlobalLocal<\n TSlug extends GlobalSlug,\n TSelect extends SelectFromGlobalSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<TransformGlobalWithSelect<TSlug, TSelect>> {\n const {\n slug: globalSlug,\n data,\n depth,\n draft,\n overrideAccess = true,\n overrideLock,\n populate,\n publishAllLocales,\n select,\n showHiddenFields,\n unpublishAllLocales,\n } = options\n\n const globalConfig = payload.globals.config.find((config) => config.slug === globalSlug)\n\n if (!globalConfig) {\n throw new APIError(`The global with slug ${String(globalSlug)} can't be found.`)\n }\n\n return updateOperation<TSlug, TSelect>({\n slug: globalSlug as string,\n data: deepCopyObjectSimple(data), // Ensure mutation of data in create operation hooks doesn't affect the original data\n depth,\n draft,\n globalConfig,\n overrideAccess,\n overrideLock,\n populate,\n publishAllLocales,\n req: await createLocalReq(options as CreateLocalReqOptions, payload),\n select,\n showHiddenFields,\n unpublishAllLocales,\n })\n}\n"],"names":["APIError","deepCopyObjectSimple","createLocalReq","updateOperation","updateGlobalLocal","payload","options","slug","globalSlug","data","depth","draft","overrideAccess","overrideLock","populate","publishAllLocales","select","showHiddenFields","unpublishAllLocales","globalConfig","globals","config","find","String","req"],"mappings":"AAeA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SACEC,oBAAoB,QAOf,oBAAmB;AAC1B,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,eAAe,QAAQ,eAAc;AAgF9C,OAAO,eAAeC,kBAIpBC,OAAgB,EAChBC,OAAgC;IAEhC,MAAM,EACJC,MAAMC,UAAU,EAChBC,IAAI,EACJC,KAAK,EACLC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,YAAY,EACZC,QAAQ,EACRC,iBAAiB,EACjBC,MAAM,EACNC,gBAAgB,EAChBC,mBAAmB,EACpB,GAAGZ;IAEJ,MAAMa,eAAed,QAAQe,OAAO,CAACC,MAAM,CAACC,IAAI,CAAC,CAACD,SAAWA,OAAOd,IAAI,KAAKC;IAE7E,IAAI,CAACW,cAAc;QACjB,MAAM,IAAInB,SAAS,CAAC,qBAAqB,EAAEuB,OAAOf,YAAY,gBAAgB,CAAC;IACjF;IAEA,OAAOL,gBAAgC;QACrCI,MAAMC;QACNC,MAAMR,qBAAqBQ;QAC3BC;QACAC;QACAQ;QACAP;QACAC;QACAC;QACAC;QACAS,KAAK,MAAMtB,eAAeI,SAAkCD;QAC5DW;QACAC;QACAC;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"restoreVersion.d.ts","sourceRoot":"","sources":["../../../src/globals/operations/restoreVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAU/D,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,YAAY,EAAE,qBAAqB,CAAA;IACnC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,GAAG,CAAC,EAAE,cAAc,CAAA;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,uBAAuB,GAAU,CAAC,SAAS,eAAe,CAAC,CAAC,CAAC,GAAG,GAAG,EAC9E,MAAM,SAAS,KACd,OAAO,CAAC,CAAC,CA4LX,CAAA"}
1
+ {"version":3,"file":"restoreVersion.d.ts","sourceRoot":"","sources":["../../../src/globals/operations/restoreVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAU/D,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,YAAY,EAAE,qBAAqB,CAAA;IACnC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,GAAG,CAAC,EAAE,cAAc,CAAA;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,uBAAuB,GAAU,CAAC,SAAS,eAAe,CAAC,CAAC,CAAC,GAAG,GAAG,QACxE,SAAS,KACd,OAAO,CAAC,CAAC,CA4LX,CAAA"}
@@ -31,6 +31,7 @@ export const restoreVersionOperation = async (args)=>{
31
31
  // /////////////////////////////////////
32
32
  if (!overrideAccess) {
33
33
  await executeAccess({
34
+ slug: globalConfig.slug,
34
35
  req
35
36
  }, globalConfig.access.update);
36
37
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/globals/operations/restoreVersion.ts"],"sourcesContent":["import type { PayloadRequest, PopulateType } 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 { NotFound } from '../../errors/index.js'\nimport { afterChange } from '../../fields/hooks/afterChange/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 depth?: number\n draft?: boolean\n globalConfig: SanitizedGlobalConfig\n id: number | string\n overrideAccess?: boolean\n populate?: PopulateType\n req?: PayloadRequest\n showHiddenFields?: boolean\n}\n\nexport const restoreVersionOperation = async <T extends TypeWithVersion<T> = any>(\n args: Arguments,\n): Promise<T> => {\n const { id, depth, draft, globalConfig, overrideAccess, populate, showHiddenFields } = args\n const req = args.req!\n const { fallbackLocale, locale, payload } = req\n\n try {\n const shouldCommit = await initTransaction(req)\n\n // /////////////////////////////////////\n // beforeOperation - Global\n // /////////////////////////////////////\n\n if (globalConfig.hooks?.beforeOperation?.length) {\n for (const hook of globalConfig.hooks.beforeOperation) {\n args =\n (await hook({\n args,\n context: req.context,\n global: globalConfig,\n operation: 'restoreVersion',\n overrideAccess,\n req,\n })) || args\n }\n }\n\n // /////////////////////////////////////\n // Access\n // /////////////////////////////////////\n\n if (!overrideAccess) {\n await executeAccess({ req }, globalConfig.access.update)\n }\n\n // /////////////////////////////////////\n // Retrieve original raw version\n // /////////////////////////////////////\n\n const { docs: versionDocs } = await payload.db.findGlobalVersions<any>({\n global: globalConfig.slug,\n limit: 1,\n req,\n where: { id: { equals: id } },\n })\n\n if (!versionDocs || versionDocs.length === 0) {\n throw new NotFound(req.t)\n }\n\n const rawVersion = versionDocs[0]!\n\n // Patch globalType onto version doc\n rawVersion.version.globalType = globalConfig.slug\n\n // Overwrite draft status if draft is true\n\n if (draft) {\n rawVersion.version._status = 'draft'\n }\n // /////////////////////////////////////\n // fetch previousDoc\n // /////////////////////////////////////\n\n const previousDoc = await payload.findGlobal({\n slug: globalConfig.slug,\n depth,\n req,\n })\n\n req.context.isRestoringVersion = true\n\n // /////////////////////////////////////\n // Update global\n // /////////////////////////////////////\n\n const global = await payload.db.findGlobal({\n slug: globalConfig.slug,\n req,\n })\n\n let result = rawVersion.version\n\n if (global) {\n // Ensure updatedAt date is always updated\n result.updatedAt = new Date().toISOString()\n result = await payload.db.updateGlobal({\n slug: globalConfig.slug,\n data: result,\n req,\n })\n\n const now = new Date().toISOString()\n\n result = await payload.db.createGlobalVersion({\n autosave: false,\n createdAt: result.createdAt ? new Date(result.createdAt).toISOString() : now,\n globalSlug: globalConfig.slug,\n req,\n updatedAt: draft ? now : new Date(result.updatedAt).toISOString(),\n versionData: result,\n })\n } else {\n result = await payload.db.createGlobal({\n slug: globalConfig.slug,\n data: result,\n req,\n })\n }\n\n // /////////////////////////////////////\n // afterRead - Fields\n // /////////////////////////////////////\n\n result = await afterRead({\n collection: null,\n context: req.context,\n depth: depth!,\n doc: result,\n draft: undefined!,\n fallbackLocale: fallbackLocale!,\n global: globalConfig,\n locale: locale!,\n overrideAccess: overrideAccess!,\n populate,\n req,\n showHiddenFields: showHiddenFields!,\n })\n\n // /////////////////////////////////////\n // afterRead - Global\n // /////////////////////////////////////\n\n if (globalConfig.hooks?.afterRead?.length) {\n for (const hook of globalConfig.hooks.afterRead) {\n result =\n (await hook({\n context: req.context,\n doc: result,\n global: globalConfig,\n overrideAccess,\n req,\n })) || result\n }\n }\n\n // /////////////////////////////////////\n // afterChange - Fields\n // /////////////////////////////////////\n\n result = await afterChange({\n collection: null,\n context: req.context,\n data: result,\n doc: result,\n global: globalConfig,\n operation: 'update',\n previousDoc,\n req,\n })\n\n // /////////////////////////////////////\n // afterChange - Global\n // /////////////////////////////////////\n\n if (globalConfig.hooks?.afterChange?.length) {\n for (const hook of globalConfig.hooks.afterChange) {\n result =\n (await hook({\n context: req.context,\n data: result,\n doc: result,\n global: globalConfig,\n overrideAccess,\n previousDoc,\n req,\n })) || result\n }\n }\n\n if (shouldCommit) {\n await commitTransaction(req)\n }\n\n return result\n } catch (error: unknown) {\n await killTransaction(req)\n throw error\n }\n}\n"],"names":["executeAccess","NotFound","afterChange","afterRead","commitTransaction","initTransaction","killTransaction","restoreVersionOperation","args","id","depth","draft","globalConfig","overrideAccess","populate","showHiddenFields","req","fallbackLocale","locale","payload","shouldCommit","hooks","beforeOperation","length","hook","context","global","operation","access","update","docs","versionDocs","db","findGlobalVersions","slug","limit","where","equals","t","rawVersion","version","globalType","_status","previousDoc","findGlobal","isRestoringVersion","result","updatedAt","Date","toISOString","updateGlobal","data","now","createGlobalVersion","autosave","createdAt","globalSlug","versionData","createGlobal","collection","doc","undefined","error"],"mappings":"AAIA,SAASA,aAAa,QAAQ,8BAA6B;AAC3D,SAASC,QAAQ,QAAQ,wBAAuB;AAChD,SAASC,WAAW,QAAQ,0CAAyC;AACrE,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;AAapE,OAAO,MAAMC,0BAA0B,OACrCC;IAEA,MAAM,EAAEC,EAAE,EAAEC,KAAK,EAAEC,KAAK,EAAEC,YAAY,EAAEC,cAAc,EAAEC,QAAQ,EAAEC,gBAAgB,EAAE,GAAGP;IACvF,MAAMQ,MAAMR,KAAKQ,GAAG;IACpB,MAAM,EAAEC,cAAc,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAGH;IAE5C,IAAI;QACF,MAAMI,eAAe,MAAMf,gBAAgBW;QAE3C,wCAAwC;QACxC,2BAA2B;QAC3B,wCAAwC;QAExC,IAAIJ,aAAaS,KAAK,EAAEC,iBAAiBC,QAAQ;YAC/C,KAAK,MAAMC,QAAQZ,aAAaS,KAAK,CAACC,eAAe,CAAE;gBACrDd,OACE,AAAC,MAAMgB,KAAK;oBACVhB;oBACAiB,SAAST,IAAIS,OAAO;oBACpBC,QAAQd;oBACRe,WAAW;oBACXd;oBACAG;gBACF,MAAOR;YACX;QACF;QAEA,wCAAwC;QACxC,SAAS;QACT,wCAAwC;QAExC,IAAI,CAACK,gBAAgB;YACnB,MAAMb,cAAc;gBAAEgB;YAAI,GAAGJ,aAAagB,MAAM,CAACC,MAAM;QACzD;QAEA,wC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;oBACVC,SAAST,IAAIS,OAAO;oBACpB0B,MAAML;oBACNc,KAAKd;oBACLpB,QAAQd;oBACRC;oBACA8B;oBACA3B;gBACF,MAAO8B;YACX;QACF;QAEA,IAAI1B,cAAc;YAChB,MAAMhB,kBAAkBY;QAC1B;QAEA,OAAO8B;IACT,EAAE,OAAOgB,OAAgB;QACvB,MAAMxD,gBAAgBU;QACtB,MAAM8C;IACR;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/globals/operations/restoreVersion.ts"],"sourcesContent":["import type { PayloadRequest, PopulateType } 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 { NotFound } from '../../errors/index.js'\nimport { afterChange } from '../../fields/hooks/afterChange/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 depth?: number\n draft?: boolean\n globalConfig: SanitizedGlobalConfig\n id: number | string\n overrideAccess?: boolean\n populate?: PopulateType\n req?: PayloadRequest\n showHiddenFields?: boolean\n}\n\nexport const restoreVersionOperation = async <T extends TypeWithVersion<T> = any>(\n args: Arguments,\n): Promise<T> => {\n const { id, depth, draft, globalConfig, overrideAccess, populate, showHiddenFields } = args\n const req = args.req!\n const { fallbackLocale, locale, payload } = req\n\n try {\n const shouldCommit = await initTransaction(req)\n\n // /////////////////////////////////////\n // beforeOperation - Global\n // /////////////////////////////////////\n\n if (globalConfig.hooks?.beforeOperation?.length) {\n for (const hook of globalConfig.hooks.beforeOperation) {\n args =\n (await hook({\n args,\n context: req.context,\n global: globalConfig,\n operation: 'restoreVersion',\n overrideAccess,\n req,\n })) || args\n }\n }\n\n // /////////////////////////////////////\n // Access\n // /////////////////////////////////////\n\n if (!overrideAccess) {\n await executeAccess({ slug: globalConfig.slug, req }, globalConfig.access.update)\n }\n\n // /////////////////////////////////////\n // Retrieve original raw version\n // /////////////////////////////////////\n\n const { docs: versionDocs } = await payload.db.findGlobalVersions<any>({\n global: globalConfig.slug,\n limit: 1,\n req,\n where: { id: { equals: id } },\n })\n\n if (!versionDocs || versionDocs.length === 0) {\n throw new NotFound(req.t)\n }\n\n const rawVersion = versionDocs[0]!\n\n // Patch globalType onto version doc\n rawVersion.version.globalType = globalConfig.slug\n\n // Overwrite draft status if draft is true\n\n if (draft) {\n rawVersion.version._status = 'draft'\n }\n // /////////////////////////////////////\n // fetch previousDoc\n // /////////////////////////////////////\n\n const previousDoc = await payload.findGlobal({\n slug: globalConfig.slug,\n depth,\n req,\n })\n\n req.context.isRestoringVersion = true\n\n // /////////////////////////////////////\n // Update global\n // /////////////////////////////////////\n\n const global = await payload.db.findGlobal({\n slug: globalConfig.slug,\n req,\n })\n\n let result = rawVersion.version\n\n if (global) {\n // Ensure updatedAt date is always updated\n result.updatedAt = new Date().toISOString()\n result = await payload.db.updateGlobal({\n slug: globalConfig.slug,\n data: result,\n req,\n })\n\n const now = new Date().toISOString()\n\n result = await payload.db.createGlobalVersion({\n autosave: false,\n createdAt: result.createdAt ? new Date(result.createdAt).toISOString() : now,\n globalSlug: globalConfig.slug,\n req,\n updatedAt: draft ? now : new Date(result.updatedAt).toISOString(),\n versionData: result,\n })\n } else {\n result = await payload.db.createGlobal({\n slug: globalConfig.slug,\n data: result,\n req,\n })\n }\n\n // /////////////////////////////////////\n // afterRead - Fields\n // /////////////////////////////////////\n\n result = await afterRead({\n collection: null,\n context: req.context,\n depth: depth!,\n doc: result,\n draft: undefined!,\n fallbackLocale: fallbackLocale!,\n global: globalConfig,\n locale: locale!,\n overrideAccess: overrideAccess!,\n populate,\n req,\n showHiddenFields: showHiddenFields!,\n })\n\n // /////////////////////////////////////\n // afterRead - Global\n // /////////////////////////////////////\n\n if (globalConfig.hooks?.afterRead?.length) {\n for (const hook of globalConfig.hooks.afterRead) {\n result =\n (await hook({\n context: req.context,\n doc: result,\n global: globalConfig,\n overrideAccess,\n req,\n })) || result\n }\n }\n\n // /////////////////////////////////////\n // afterChange - Fields\n // /////////////////////////////////////\n\n result = await afterChange({\n collection: null,\n context: req.context,\n data: result,\n doc: result,\n global: globalConfig,\n operation: 'update',\n previousDoc,\n req,\n })\n\n // /////////////////////////////////////\n // afterChange - Global\n // /////////////////////////////////////\n\n if (globalConfig.hooks?.afterChange?.length) {\n for (const hook of globalConfig.hooks.afterChange) {\n result =\n (await hook({\n context: req.context,\n data: result,\n doc: result,\n global: globalConfig,\n overrideAccess,\n previousDoc,\n req,\n })) || result\n }\n }\n\n if (shouldCommit) {\n await commitTransaction(req)\n }\n\n return result\n } catch (error: unknown) {\n await killTransaction(req)\n throw error\n }\n}\n"],"names":["executeAccess","NotFound","afterChange","afterRead","commitTransaction","initTransaction","killTransaction","restoreVersionOperation","args","id","depth","draft","globalConfig","overrideAccess","populate","showHiddenFields","req","fallbackLocale","locale","payload","shouldCommit","hooks","beforeOperation","length","hook","context","global","operation","slug","access","update","docs","versionDocs","db","findGlobalVersions","limit","where","equals","t","rawVersion","version","globalType","_status","previousDoc","findGlobal","isRestoringVersion","result","updatedAt","Date","toISOString","updateGlobal","data","now","createGlobalVersion","autosave","createdAt","globalSlug","versionData","createGlobal","collection","doc","undefined","error"],"mappings":"AAIA,SAASA,aAAa,QAAQ,8BAA6B;AAC3D,SAASC,QAAQ,QAAQ,wBAAuB;AAChD,SAASC,WAAW,QAAQ,0CAAyC;AACrE,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;AAapE,OAAO,MAAMC,0BAA0B,OACrCC;IAEA,MAAM,EAAEC,EAAE,EAAEC,KAAK,EAAEC,KAAK,EAAEC,YAAY,EAAEC,cAAc,EAAEC,QAAQ,EAAEC,gBAAg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AAqB;QACrB,wCAAwC;QAExC,IAAIH,aAAaS,KAAK,EAAElB,WAAWoB,QAAQ;YACzC,KAAK,MAAMC,QAAQZ,aAAaS,KAAK,CAAClB,SAAS,CAAE;gBAC/C2C,SACE,AAAC,MAAMtB,KAAK;oBACVC,SAAST,IAAIS,OAAO;oBACpBmC,KAAKd;oBACLpB,QAAQd;oBACRC;oBACAG;gBACF,MAAO8B;YACX;QACF;QAEA,wCAAwC;QACxC,uBAAuB;QACvB,wCAAwC;QAExCA,SAAS,MAAM5C,YAAY;YACzByD,YAAY;YACZlC,SAAST,IAAIS,OAAO;YACpB0B,MAAML;YACNc,KAAKd;YACLpB,QAAQd;YACRe,WAAW;YACXgB;YACA3B;QACF;QAEA,wCAAwC;QACxC,uBAAuB;QACvB,wCAAwC;QAExC,IAAIJ,aAAaS,KAAK,EAAEnB,aAAaqB,QAAQ;YAC3C,KAAK,MAAMC,QAAQZ,aAAaS,KAAK,CAACnB,WAAW,CAAE;gBACjD4C,SACE,AAAC,MAAMtB,KAAK;oBACVC,SAAST,IAAIS,OAAO;oBACpB0B,MAAML;oBACNc,KAAKd;oBACLpB,QAAQd;oBACRC;oBACA8B;oBACA3B;gBACF,MAAO8B;YACX;QACF;QAEA,IAAI1B,cAAc;YAChB,MAAMhB,kBAAkBY;QAC1B;QAEA,OAAO8B;IACT,EAAE,OAAOgB,OAAgB;QACvB,MAAMxD,gBAAgBU;QACtB,MAAM8C;IACR;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/globals/operations/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAA;AAC7E,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,gBAAgB,CAAA;AAC5D,OAAO,KAAK,EAEV,cAAc,EACd,YAAY,EACZ,UAAU,EACV,yBAAyB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AE,UAAU,EAAc,MAAM,gBAAgB,CAAA;AAC5D,OAAO,KAAK,EAEV,cAAc,EACd,YAAY,EACZ,UAAU,EACV,yBAAyB,EAE1B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,oBAAoB,CAAA;AAuB3B,KAAK,IAAI,CAAC,KAAK,SAAS,UAAU,IAAI;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;IACxD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,YAAY,EAAE,qBAAqB,CAAA;IACnC,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,GAAG,EAAE,cAAc,CAAA;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAC9B,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAA;AAEnD,eAAO,MAAM,eAAe,GAC1B,KAAK,SAAS,UAAU,EACxB,OAAO,SAAS,oBAAoB,CAAC,KAAK,CAAC,QAErC,IAAI,CAAC,KAAK,CAAC,KAChB,OAAO,CAAC,yBAAyB,CAAC,KAAK,EAAE,OAAO,CAAC,CAwbnD,CAAA"}
@@ -45,6 +45,7 @@ export const updateOperation = async (args)=>{
45
45
  // 1. Retrieve and execute access
46
46
  // /////////////////////////////////////
47
47
  const accessResults = !overrideAccess ? await executeAccess({
48
+ slug: globalConfig.slug,
48
49
  data,
49
50
  req
50
51
  }, globalConfig.access.update) : true;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/globals/operations/update.ts"],"sourcesContent":["import type { DeepPartial } from 'ts-essentials'\n\nimport type { FindOptions } from '../../collections/operations/local/find.js'\nimport type { GlobalSlug, JsonObject } from '../../index.js'\nimport type {\n Operation,\n PayloadRequest,\n PopulateType,\n SelectType,\n TransformGlobalWithSelect,\n Where,\n} from '../../types/index.js'\nimport type {\n DataFromGlobalSlug,\n SanitizedGlobalConfig,\n SelectFromGlobalSlug,\n} from '../config/types.js'\n\nimport { executeAccess } from '../../auth/executeAccess.js'\nimport { afterChange } from '../../fields/hooks/afterChange/index.js'\nimport { afterRead } from '../../fields/hooks/afterRead/index.js'\nimport { beforeChange } from '../../fields/hooks/beforeChange/index.js'\nimport { beforeValidate } from '../../fields/hooks/beforeValidate/index.js'\nimport { deepCopyObjectSimple } from '../../index.js'\nimport { checkDocumentLockStatus } from '../../utilities/checkDocumentLockStatus.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { getSelectMode } from '../../utilities/getSelectMode.js'\nimport {\n hasDraftsEnabled,\n hasDraftValidationEnabled,\n hasLocalizeStatusEnabled,\n} from '../../utilities/getVersionsConfig.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { resolveSelect } from '../../utilities/resolveSelect.js'\nimport { sanitizeSelect } from '../../utilities/sanitizeSelect.js'\nimport { buildLocalizedPublishData } from '../../versions/buildSingleLocalePublishData.js'\nimport { getLatestGlobalVersion } from '../../versions/getLatestGlobalVersion.js'\nimport { saveVersion } from '../../versions/saveVersion.js'\ntype Args<TSlug extends GlobalSlug> = {\n autosave?: boolean\n data: DeepPartial<Omit<DataFromGlobalSlug<TSlug>, 'id'>>\n depth?: number\n disableTransaction?: boolean\n draft?: boolean\n globalConfig: SanitizedGlobalConfig\n overrideAccess?: boolean\n overrideLock?: boolean\n populate?: PopulateType\n publishAllLocales?: boolean\n req: PayloadRequest\n showHiddenFields?: boolean\n slug: string\n unpublishAllLocales?: boolean\n} & Pick<FindOptions<string, SelectType>, 'select'>\n\nexport const updateOperation = async <\n TSlug extends GlobalSlug,\n TSelect extends SelectFromGlobalSlug<TSlug>,\n>(\n args: Args<TSlug>,\n): Promise<TransformGlobalWithSelect<TSlug, TSelect>> => {\n const {\n slug,\n autosave,\n depth,\n disableTransaction,\n draft: draftArg,\n globalConfig,\n overrideAccess,\n overrideLock,\n populate,\n publishAllLocales: publishAllLocalesArg,\n req: { fallbackLocale, locale, payload, payload: { config } = {} },\n req,\n select: incomingSelect,\n showHiddenFields,\n unpublishAllLocales: unpublishAllLocalesArg,\n } = args\n\n try {\n const shouldCommit = !disableTransaction && (await initTransaction(req))\n\n // /////////////////////////////////////\n // beforeOperation - Global\n // /////////////////////////////////////\n\n if (globalConfig.hooks?.beforeOperation?.length) {\n for (const hook of globalConfig.hooks.beforeOperation) {\n args =\n (await hook({\n args,\n context: args.req.context,\n global: globalConfig,\n operation: 'update',\n overrideAccess,\n req: args.req,\n })) || args\n }\n }\n\n let { data } = args\n\n const publishAllLocales =\n !draftArg &&\n (publishAllLocalesArg ??\n (hasLocalizeStatusEnabled(globalConfig) && locale !== 'all' ? false : true))\n const unpublishAllLocales =\n typeof unpublishAllLocalesArg === 'string'\n ? unpublishAllLocalesArg === 'true'\n : !!unpublishAllLocalesArg\n const isSavingDraft =\n Boolean(draftArg && hasDraftsEnabled(globalConfig)) &&\n data._status !== 'published' &&\n !publishAllLocales\n\n if (isSavingDraft) {\n data._status = 'draft'\n }\n\n // /////////////////////////////////////\n // 1. Retrieve and execute access\n // /////////////////////////////////////\n\n const accessResults = !overrideAccess\n ? await executeAccess(\n {\n data,\n req,\n },\n globalConfig.access.update,\n )\n : true\n\n // /////////////////////////////////////\n // Retrieve document\n // /////////////////////////////////////\n\n const query: Where = overrideAccess ? undefined! : (accessResults as Where)\n\n // /////////////////////////////////////\n // 2. Retrieve document\n // /////////////////////////////////////\n const globalVersionResult = await getLatestGlobalVersion({\n slug,\n config: globalConfig,\n locale: publishAllLocales || unpublishAllLocales ? 'all' : locale!,\n payload,\n req,\n where: query,\n })\n const { global, globalExists } = globalVersionResult || {}\n\n let globalJSON: JsonObject = {}\n\n if (globalVersionResult && globalVersionResult.global) {\n globalJSON = deepCopyObjectSimple(global)\n\n if (globalJSON._id) {\n delete globalJSON._id\n }\n }\n\n const originalDoc = await afterRead({\n collection: null,\n context: req.context,\n depth: 0,\n doc: deepCopyObjectSimple(globalJSON),\n draft: draftArg!,\n fallbackLocale: fallbackLocale!,\n global: globalConfig,\n locale: locale!,\n overrideAccess: true,\n req,\n showHiddenFields: showHiddenFields!,\n })\n\n // ///////////////////////////////////////////\n // Handle potentially locked global documents\n // ///////////////////////////////////////////\n\n await checkDocumentLockStatus({\n globalSlug: slug,\n lockErrorMessage: `Global with slug \"${slug}\" is currently locked by another user and cannot be updated.`,\n overrideLock,\n req,\n })\n\n // /////////////////////////////////////\n // beforeValidate - Fields\n // /////////////////////////////////////\n\n data = await beforeValidate({\n collection: null,\n context: req.context,\n data,\n doc: originalDoc,\n global: globalConfig,\n operation: 'update',\n overrideAccess: overrideAccess!,\n req,\n })\n\n // /////////////////////////////////////\n // beforeValidate - Global\n // /////////////////////////////////////\n\n if (globalConfig.hooks?.beforeValidate?.length) {\n for (const hook of globalConfig.hooks.beforeValidate) {\n data =\n (await hook({\n context: req.context,\n data,\n global: globalConfig,\n originalDoc,\n overrideAccess,\n req,\n })) || data\n }\n }\n\n // /////////////////////////////////////\n // beforeChange - Global\n // /////////////////////////////////////\n\n if (globalConfig.hooks?.beforeChange?.length) {\n for (const hook of globalConfig.hooks.beforeChange) {\n data =\n (await hook({\n context: req.context,\n data,\n global: globalConfig,\n originalDoc,\n overrideAccess,\n req,\n })) || data\n }\n }\n\n // /////////////////////////////////////\n // beforeChange - Fields\n // /////////////////////////////////////\n\n const beforeChangeArgs = {\n collection: null,\n context: req.context,\n data,\n doc: originalDoc,\n docWithLocales: globalJSON,\n global: globalConfig,\n operation: 'update' as Operation,\n req,\n skipValidation:\n (isSavingDraft && !hasDraftValidationEnabled(globalConfig)) ||\n // Skip validation for unpublish operations — they only change _status, not document data\n unpublishAllLocales,\n }\n\n let result: JsonObject = await beforeChange(beforeChangeArgs)\n\n if (\n config?.localization &&\n hasLocalizeStatusEnabled(globalConfig) &&\n typeof result._status === 'string'\n ) {\n const statusStr = result._status\n result._status = {}\n for (const localeCode of config.localization.localeCodes) {\n ;(result._status as Record<string, unknown>)[localeCode] = statusStr\n }\n }\n\n // /////////////////////////////////////\n // Handle Localized Data Merging\n // /////////////////////////////////////\n\n let localizedPublishData: JsonObject | null = null\n\n if (config && config.localization && globalConfig.versions) {\n if (hasLocalizeStatusEnabled(globalConfig)) {\n if (publishAllLocales || unpublishAllLocales) {\n let accessibleLocaleCodes = config.localization.localeCodes\n\n if (config.localization.filterAvailableLocales) {\n const filteredLocales = await config.localization.filterAvailableLocales({\n locales: config.localization.locales,\n req,\n })\n accessibleLocaleCodes = filteredLocales.map((locale) =>\n typeof locale === 'string' ? locale : locale.code,\n )\n }\n\n if (typeof result._status !== 'object' || result._status === null) {\n result._status = {}\n }\n\n for (const localeCode of accessibleLocaleCodes) {\n result._status[localeCode] = unpublishAllLocales ? 'draft' : 'published'\n }\n } else if (\n !isSavingDraft &&\n result._status &&\n typeof result._status === 'object' &&\n !Array.isArray(result._status) &&\n (result._status as Record<string, unknown>)[locale!] === 'published'\n ) {\n const currentGlobal = await payload.db.findGlobal({\n slug: globalConfig.slug,\n locale: 'all',\n req,\n where: query,\n })\n\n localizedPublishData = buildLocalizedPublishData({\n config,\n currentDoc: currentGlobal as JsonObject,\n fields: globalConfig.fields,\n locale: locale!,\n result,\n })\n }\n }\n }\n\n const dataToUpdate: JsonObject = { ...(localizedPublishData ?? result) }\n\n // /////////////////////////////////////\n // Update\n // /////////////////////////////////////\n\n const select = sanitizeSelect({\n fields: globalConfig.flattenedFields,\n select: resolveSelect({\n config: globalConfig.select,\n operation: 'update',\n req,\n select: incomingSelect,\n }),\n })\n\n let resultWithLocales: JsonObject = result\n\n if (!isSavingDraft) {\n const now = new Date().toISOString()\n // Ensure global has createdAt\n if (!dataToUpdate.createdAt) {\n dataToUpdate.createdAt = now\n }\n\n // Ensure updatedAt date is always updated\n dataToUpdate.updatedAt = now\n\n if (globalExists) {\n resultWithLocales = await payload.db.updateGlobal({\n slug,\n data: dataToUpdate,\n req,\n select,\n })\n } else {\n resultWithLocales = await payload.db.createGlobal({\n slug,\n data: dataToUpdate,\n req,\n })\n }\n\n resultWithLocales.updatedAt = now\n\n if (localizedPublishData) {\n // Keep full locale payload for version writes during single-locale publish.\n resultWithLocales = {\n ...result,\n createdAt: resultWithLocales.createdAt ?? result.createdAt ?? now,\n updatedAt: now,\n }\n }\n }\n\n // /////////////////////////////////////\n // Create version\n // /////////////////////////////////////\n if (globalConfig.versions) {\n const { globalType } = resultWithLocales\n resultWithLocales = await saveVersion({\n autosave,\n docWithLocales: resultWithLocales,\n draft: isSavingDraft,\n global: globalConfig,\n operation: 'update',\n payload,\n req,\n select,\n unpublish: unpublishAllLocales,\n })\n\n resultWithLocales = {\n ...resultWithLocales,\n globalType,\n }\n }\n\n // /////////////////////////////////////\n // Execute globalType field if not selected\n // /////////////////////////////////////\n if (select && resultWithLocales.globalType) {\n const selectMode = getSelectMode(select)\n if (\n (selectMode === 'include' && !select['globalType']) ||\n (selectMode === 'exclude' && select['globalType'] === false)\n ) {\n delete resultWithLocales['globalType']\n }\n }\n\n // /////////////////////////////////////\n // afterRead - Fields\n // /////////////////////////////////////\n\n result = await afterRead({\n collection: null,\n context: req.context,\n depth: depth!,\n doc: resultWithLocales,\n draft: draftArg!,\n fallbackLocale: null,\n global: globalConfig,\n locale: locale!,\n overrideAccess: overrideAccess!,\n populate,\n req,\n select,\n showHiddenFields: showHiddenFields!,\n })\n\n // /////////////////////////////////////\n // afterRead - Global\n // /////////////////////////////////////\n\n if (globalConfig.hooks?.afterRead?.length) {\n for (const hook of globalConfig.hooks.afterRead) {\n result =\n (await hook({\n context: req.context,\n doc: result,\n global: globalConfig,\n overrideAccess,\n req,\n })) || result\n }\n }\n\n // /////////////////////////////////////\n // afterChange - Fields\n // /////////////////////////////////////\n\n result = await afterChange({\n collection: null,\n context: req.context,\n data,\n doc: result,\n global: globalConfig,\n operation: 'update',\n previousDoc: originalDoc,\n req,\n })\n\n // /////////////////////////////////////\n // afterChange - Global\n // /////////////////////////////////////\n\n if (globalConfig.hooks?.afterChange?.length) {\n for (const hook of globalConfig.hooks.afterChange) {\n result =\n (await hook({\n context: req.context,\n data,\n doc: result,\n global: globalConfig,\n overrideAccess,\n previousDoc: originalDoc,\n req,\n })) || result\n }\n }\n\n // /////////////////////////////////////\n // Return results\n // /////////////////////////////////////\n\n if (shouldCommit) {\n await commitTransaction(req)\n }\n\n return result as TransformGlobalWithSelect<TSlug, TSelect>\n } catch (error: unknown) {\n await killTransaction(req)\n throw error\n }\n}\n"],"names":["executeAccess","afterChange","afterRead","beforeChange","beforeValidate","deepCopyObjectSimple","checkDocumentLockStatus","commitTransaction","getSelectMode","hasDraftsEnabled","hasDraftValidationEnabled","hasLocalizeStatusEnabled","initTransaction","killTransaction","resolveSelect","sanitizeSelect","buildLocalizedPublishData","getLatestGlobalVersion","saveVersion","updateOperation","args","slug","autosave","depth","disableTransaction","draft","draftArg","globalConfig","overrideAccess","overrideLock","populate","publishAllLocales","publishAllLocalesArg","req","fallbackLocale","locale","payload","config","select","incomingSelect","showHiddenFields","unpublishAllLocales","unpublishAllLocalesArg","shouldCommit","hooks","beforeOperation","length","hook","context","global","operation","data","isSavingDraft","Boolean","_status","accessResults","access","update","query","undefined","globalVersionResult","where","globalExists","globalJSON","_id","originalDoc","collection","doc","globalSlug","lockErrorMessage","beforeChangeArgs","docWithLocales","skipValidation","result","localization","statusStr","localeCode","localeCodes","localizedPublishData","versions","accessibleLocaleCodes","filterAvailableLocales","filteredLocales","locales","map","code","Array","isArray","currentGlobal","db","findGlobal","currentDoc","fields","dataToUpdate","flattenedFields","resultWithLocales","now","Date","toISOString","createdAt","updatedAt","updateGlobal","createGlobal","globalType","unpublish","selectMode","previousDoc","error"],"mappings":"AAkBA,SAASA,aAAa,QAAQ,8BAA6B;AAC3D,SAASC,WAAW,QAAQ,0CAAyC;AACrE,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,YAAY,QAAQ,2CAA0C;AACvE,SAASC,cAAc,QAAQ,6CAA4C;AAC3E,SAASC,oBAAoB,QAAQ,iBAAgB;AACrD,SAASC,uBAAuB,QAAQ,6CAA4C;AACpF,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,aAAa,QAAQ,mCAAkC;AAChE,SACEC,gBAAgB,EAChBC,yBAAyB,EACzBC,wBAAwB,QACnB,uCAAsC;AAC7C,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,aAAa,QAAQ,mCAAkC;AAChE,SAASC,cAAc,QAAQ,oCAAmC;AAClE,SAASC,yBAAyB,QAAQ,iDAAgD;AAC1F,SAASC,sBAAsB,QAAQ,2CAA0C;AACjF,SAASC,WAAW,QAAQ,gCAA+B;AAkB3D,OAAO,MAAMC,kBAAkB,OAI7BC;IAEA,MAAM,EACJC,IAAI,EACJC,QAAQ,EACRC,KAAK,EACLC,kBAAkB,EAClBC,OAAOC,QAAQ,EACfC,YAAY,EACZC,cAAc,EACdC,YAAY,EACZC,QAAQ,EACRC,mBAAmBC,oBAAoB,EACvCC,KAAK,EAAEC,cAAc,EAAEC,MAAM,EAAEC,OAAO,EAAEA,SAAS,EAAEC,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,EAClEJ,GAAG,EACHK,QAAQC,cAAc,EACtBC,gBAAgB,EAChBC,qBAAqBC,sBAAsB,EAC5C,GAAGtB;IAEJ,IAAI;QACF,MAAMuB,eAAe,CAACnB,sBAAuB,M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;QACrB,wCAAwC;QAExC,IAAIb,aAAaiB,KAAK,EAAE1C,WAAW4C,QAAQ;YACzC,KAAK,MAAMC,QAAQpB,aAAaiB,KAAK,CAAC1C,SAAS,CAAE;gBAC/CuE,SACE,AAAC,MAAM1B,KAAK;oBACVC,SAASf,IAAIe,OAAO;oBACpBmB,KAAKM;oBACLxB,QAAQtB;oBACRC;oBACAK;gBACF,MAAOwC;YACX;QACF;QAEA,wCAAwC;QACxC,uBAAuB;QACvB,wCAAwC;QAExCA,SAAS,MAAMxE,YAAY;YACzBiE,YAAY;YACZlB,SAASf,IAAIe,OAAO;YACpBG;YACAgB,KAAKM;YACLxB,QAAQtB;YACRuB,WAAW;YACXwD,aAAazC;YACbhC;QACF;QAEA,wCAAwC;QACxC,uBAAuB;QACvB,wCAAwC;QAExC,IAAIN,aAAaiB,KAAK,EAAE3C,aAAa6C,QAAQ;YAC3C,KAAK,MAAMC,QAAQpB,aAAaiB,KAAK,CAAC3C,WAAW,CAAE;gBACjDwE,SACE,AAAC,MAAM1B,KAAK;oBACVC,SAASf,IAAIe,OAAO;oBACpBG;oBACAgB,KAAKM;oBACLxB,QAAQtB;oBACRC;oBACA8E,aAAazC;oBACbhC;gBACF,MAAOwC;YACX;QACF;QAEA,wCAAwC;QACxC,iBAAiB;QACjB,wCAAwC;QAExC,IAAI9B,cAAc;YAChB,MAAMpC,kBAAkB0B;QAC1B;QAEA,OAAOwC;IACT,EAAE,OAAOkC,OAAgB;QACvB,MAAM9F,gBAAgBoB;QACtB,MAAM0E;IACR;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/globals/operations/update.ts"],"sourcesContent":["import type { DeepPartial } from 'ts-essentials'\n\nimport type { FindOptions } from '../../collections/operations/local/find.js'\nimport type { GlobalSlug, JsonObject } from '../../index.js'\nimport type {\n Operation,\n PayloadRequest,\n PopulateType,\n SelectType,\n TransformGlobalWithSelect,\n Where,\n} from '../../types/index.js'\nimport type {\n DataFromGlobalSlug,\n SanitizedGlobalConfig,\n SelectFromGlobalSlug,\n} from '../config/types.js'\n\nimport { executeAccess } from '../../auth/executeAccess.js'\nimport { afterChange } from '../../fields/hooks/afterChange/index.js'\nimport { afterRead } from '../../fields/hooks/afterRead/index.js'\nimport { beforeChange } from '../../fields/hooks/beforeChange/index.js'\nimport { beforeValidate } from '../../fields/hooks/beforeValidate/index.js'\nimport { deepCopyObjectSimple } from '../../index.js'\nimport { checkDocumentLockStatus } from '../../utilities/checkDocumentLockStatus.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { getSelectMode } from '../../utilities/getSelectMode.js'\nimport {\n hasDraftsEnabled,\n hasDraftValidationEnabled,\n hasLocalizeStatusEnabled,\n} from '../../utilities/getVersionsConfig.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { resolveSelect } from '../../utilities/resolveSelect.js'\nimport { sanitizeSelect } from '../../utilities/sanitizeSelect.js'\nimport { buildLocalizedPublishData } from '../../versions/buildSingleLocalePublishData.js'\nimport { getLatestGlobalVersion } from '../../versions/getLatestGlobalVersion.js'\nimport { saveVersion } from '../../versions/saveVersion.js'\ntype Args<TSlug extends GlobalSlug> = {\n autosave?: boolean\n data: DeepPartial<Omit<DataFromGlobalSlug<TSlug>, 'id'>>\n depth?: number\n disableTransaction?: boolean\n draft?: boolean\n globalConfig: SanitizedGlobalConfig\n overrideAccess?: boolean\n overrideLock?: boolean\n populate?: PopulateType\n publishAllLocales?: boolean\n req: PayloadRequest\n showHiddenFields?: boolean\n slug: string\n unpublishAllLocales?: boolean\n} & Pick<FindOptions<string, SelectType>, 'select'>\n\nexport const updateOperation = async <\n TSlug extends GlobalSlug,\n TSelect extends SelectFromGlobalSlug<TSlug>,\n>(\n args: Args<TSlug>,\n): Promise<TransformGlobalWithSelect<TSlug, TSelect>> => {\n const {\n slug,\n autosave,\n depth,\n disableTransaction,\n draft: draftArg,\n globalConfig,\n overrideAccess,\n overrideLock,\n populate,\n publishAllLocales: publishAllLocalesArg,\n req: { fallbackLocale, locale, payload, payload: { config } = {} },\n req,\n select: incomingSelect,\n showHiddenFields,\n unpublishAllLocales: unpublishAllLocalesArg,\n } = args\n\n try {\n const shouldCommit = !disableTransaction && (await initTransaction(req))\n\n // /////////////////////////////////////\n // beforeOperation - Global\n // /////////////////////////////////////\n\n if (globalConfig.hooks?.beforeOperation?.length) {\n for (const hook of globalConfig.hooks.beforeOperation) {\n args =\n (await hook({\n args,\n context: args.req.context,\n global: globalConfig,\n operation: 'update',\n overrideAccess,\n req: args.req,\n })) || args\n }\n }\n\n let { data } = args\n\n const publishAllLocales =\n !draftArg &&\n (publishAllLocalesArg ??\n (hasLocalizeStatusEnabled(globalConfig) && locale !== 'all' ? false : true))\n const unpublishAllLocales =\n typeof unpublishAllLocalesArg === 'string'\n ? unpublishAllLocalesArg === 'true'\n : !!unpublishAllLocalesArg\n const isSavingDraft =\n Boolean(draftArg && hasDraftsEnabled(globalConfig)) &&\n data._status !== 'published' &&\n !publishAllLocales\n\n if (isSavingDraft) {\n data._status = 'draft'\n }\n\n // /////////////////////////////////////\n // 1. Retrieve and execute access\n // /////////////////////////////////////\n\n const accessResults = !overrideAccess\n ? await executeAccess(\n {\n slug: globalConfig.slug,\n data,\n req,\n },\n globalConfig.access.update,\n )\n : true\n\n // /////////////////////////////////////\n // Retrieve document\n // /////////////////////////////////////\n\n const query: Where = overrideAccess ? undefined! : (accessResults as Where)\n\n // /////////////////////////////////////\n // 2. Retrieve document\n // /////////////////////////////////////\n const globalVersionResult = await getLatestGlobalVersion({\n slug,\n config: globalConfig,\n locale: publishAllLocales || unpublishAllLocales ? 'all' : locale!,\n payload,\n req,\n where: query,\n })\n const { global, globalExists } = globalVersionResult || {}\n\n let globalJSON: JsonObject = {}\n\n if (globalVersionResult && globalVersionResult.global) {\n globalJSON = deepCopyObjectSimple(global)\n\n if (globalJSON._id) {\n delete globalJSON._id\n }\n }\n\n const originalDoc = await afterRead({\n collection: null,\n context: req.context,\n depth: 0,\n doc: deepCopyObjectSimple(globalJSON),\n draft: draftArg!,\n fallbackLocale: fallbackLocale!,\n global: globalConfig,\n locale: locale!,\n overrideAccess: true,\n req,\n showHiddenFields: showHiddenFields!,\n })\n\n // ///////////////////////////////////////////\n // Handle potentially locked global documents\n // ///////////////////////////////////////////\n\n await checkDocumentLockStatus({\n globalSlug: slug,\n lockErrorMessage: `Global with slug \"${slug}\" is currently locked by another user and cannot be updated.`,\n overrideLock,\n req,\n })\n\n // /////////////////////////////////////\n // beforeValidate - Fields\n // /////////////////////////////////////\n\n data = await beforeValidate({\n collection: null,\n context: req.context,\n data,\n doc: originalDoc,\n global: globalConfig,\n operation: 'update',\n overrideAccess: overrideAccess!,\n req,\n })\n\n // /////////////////////////////////////\n // beforeValidate - Global\n // /////////////////////////////////////\n\n if (globalConfig.hooks?.beforeValidate?.length) {\n for (const hook of globalConfig.hooks.beforeValidate) {\n data =\n (await hook({\n context: req.context,\n data,\n global: globalConfig,\n originalDoc,\n overrideAccess,\n req,\n })) || data\n }\n }\n\n // /////////////////////////////////////\n // beforeChange - Global\n // /////////////////////////////////////\n\n if (globalConfig.hooks?.beforeChange?.length) {\n for (const hook of globalConfig.hooks.beforeChange) {\n data =\n (await hook({\n context: req.context,\n data,\n global: globalConfig,\n originalDoc,\n overrideAccess,\n req,\n })) || data\n }\n }\n\n // /////////////////////////////////////\n // beforeChange - Fields\n // /////////////////////////////////////\n\n const beforeChangeArgs = {\n collection: null,\n context: req.context,\n data,\n doc: originalDoc,\n docWithLocales: globalJSON,\n global: globalConfig,\n operation: 'update' as Operation,\n req,\n skipValidation:\n (isSavingDraft && !hasDraftValidationEnabled(globalConfig)) ||\n // Skip validation for unpublish operations — they only change _status, not document data\n unpublishAllLocales,\n }\n\n let result: JsonObject = await beforeChange(beforeChangeArgs)\n\n if (\n config?.localization &&\n hasLocalizeStatusEnabled(globalConfig) &&\n typeof result._status === 'string'\n ) {\n const statusStr = result._status\n result._status = {}\n for (const localeCode of config.localization.localeCodes) {\n ;(result._status as Record<string, unknown>)[localeCode] = statusStr\n }\n }\n\n // /////////////////////////////////////\n // Handle Localized Data Merging\n // /////////////////////////////////////\n\n let localizedPublishData: JsonObject | null = null\n\n if (config && config.localization && globalConfig.versions) {\n if (hasLocalizeStatusEnabled(globalConfig)) {\n if (publishAllLocales || unpublishAllLocales) {\n let accessibleLocaleCodes = config.localization.localeCodes\n\n if (config.localization.filterAvailableLocales) {\n const filteredLocales = await config.localization.filterAvailableLocales({\n locales: config.localization.locales,\n req,\n })\n accessibleLocaleCodes = filteredLocales.map((locale) =>\n typeof locale === 'string' ? locale : locale.code,\n )\n }\n\n if (typeof result._status !== 'object' || result._status === null) {\n result._status = {}\n }\n\n for (const localeCode of accessibleLocaleCodes) {\n result._status[localeCode] = unpublishAllLocales ? 'draft' : 'published'\n }\n } else if (\n !isSavingDraft &&\n result._status &&\n typeof result._status === 'object' &&\n !Array.isArray(result._status) &&\n (result._status as Record<string, unknown>)[locale!] === 'published'\n ) {\n const currentGlobal = await payload.db.findGlobal({\n slug: globalConfig.slug,\n locale: 'all',\n req,\n where: query,\n })\n\n localizedPublishData = buildLocalizedPublishData({\n config,\n currentDoc: currentGlobal as JsonObject,\n fields: globalConfig.fields,\n locale: locale!,\n result,\n })\n }\n }\n }\n\n const dataToUpdate: JsonObject = { ...(localizedPublishData ?? result) }\n\n // /////////////////////////////////////\n // Update\n // /////////////////////////////////////\n\n const select = sanitizeSelect({\n fields: globalConfig.flattenedFields,\n select: resolveSelect({\n config: globalConfig.select,\n operation: 'update',\n req,\n select: incomingSelect,\n }),\n })\n\n let resultWithLocales: JsonObject = result\n\n if (!isSavingDraft) {\n const now = new Date().toISOString()\n // Ensure global has createdAt\n if (!dataToUpdate.createdAt) {\n dataToUpdate.createdAt = now\n }\n\n // Ensure updatedAt date is always updated\n dataToUpdate.updatedAt = now\n\n if (globalExists) {\n resultWithLocales = await payload.db.updateGlobal({\n slug,\n data: dataToUpdate,\n req,\n select,\n })\n } else {\n resultWithLocales = await payload.db.createGlobal({\n slug,\n data: dataToUpdate,\n req,\n })\n }\n\n resultWithLocales.updatedAt = now\n\n if (localizedPublishData) {\n // Keep full locale payload for version writes during single-locale publish.\n resultWithLocales = {\n ...result,\n createdAt: resultWithLocales.createdAt ?? result.createdAt ?? now,\n updatedAt: now,\n }\n }\n }\n\n // /////////////////////////////////////\n // Create version\n // /////////////////////////////////////\n if (globalConfig.versions) {\n const { globalType } = resultWithLocales\n resultWithLocales = await saveVersion({\n autosave,\n docWithLocales: resultWithLocales,\n draft: isSavingDraft,\n global: globalConfig,\n operation: 'update',\n payload,\n req,\n select,\n unpublish: unpublishAllLocales,\n })\n\n resultWithLocales = {\n ...resultWithLocales,\n globalType,\n }\n }\n\n // /////////////////////////////////////\n // Execute globalType field if not selected\n // /////////////////////////////////////\n if (select && resultWithLocales.globalType) {\n const selectMode = getSelectMode(select)\n if (\n (selectMode === 'include' && !select['globalType']) ||\n (selectMode === 'exclude' && select['globalType'] === false)\n ) {\n delete resultWithLocales['globalType']\n }\n }\n\n // /////////////////////////////////////\n // afterRead - Fields\n // /////////////////////////////////////\n\n result = await afterRead({\n collection: null,\n context: req.context,\n depth: depth!,\n doc: resultWithLocales,\n draft: draftArg!,\n fallbackLocale: null,\n global: globalConfig,\n locale: locale!,\n overrideAccess: overrideAccess!,\n populate,\n req,\n select,\n showHiddenFields: showHiddenFields!,\n })\n\n // /////////////////////////////////////\n // afterRead - Global\n // /////////////////////////////////////\n\n if (globalConfig.hooks?.afterRead?.length) {\n for (const hook of globalConfig.hooks.afterRead) {\n result =\n (await hook({\n context: req.context,\n doc: result,\n global: globalConfig,\n overrideAccess,\n req,\n })) || result\n }\n }\n\n // /////////////////////////////////////\n // afterChange - Fields\n // /////////////////////////////////////\n\n result = await afterChange({\n collection: null,\n context: req.context,\n data,\n doc: result,\n global: globalConfig,\n operation: 'update',\n previousDoc: originalDoc,\n req,\n })\n\n // /////////////////////////////////////\n // afterChange - Global\n // /////////////////////////////////////\n\n if (globalConfig.hooks?.afterChange?.length) {\n for (const hook of globalConfig.hooks.afterChange) {\n result =\n (await hook({\n context: req.context,\n data,\n doc: result,\n global: globalConfig,\n overrideAccess,\n previousDoc: originalDoc,\n req,\n })) || result\n }\n }\n\n // /////////////////////////////////////\n // Return results\n // /////////////////////////////////////\n\n if (shouldCommit) {\n await commitTransaction(req)\n }\n\n return result as TransformGlobalWithSelect<TSlug, TSelect>\n } catch (error: unknown) {\n await killTransaction(req)\n throw error\n }\n}\n"],"names":["executeAccess","afterChange","afterRead","beforeChange","beforeValidate","deepCopyObjectSimple","checkDocumentLockStatus","commitTransaction","getSelectMode","hasDraftsEnabled","hasDraftValidationEnabled","hasLocalizeStatusEnabled","initTransaction","killTransaction","resolveSelect","sanitizeSelect","buildLocalizedPublishData","getLatestGlobalVersion","saveVersion","updateOperation","args","slug","autosave","depth","disableTransaction","draft","draftArg","globalConfig","overrideAccess","overrideLock","populate","publishAllLocales","publishAllLocalesArg","req","fallbackLocale","locale","payload","config","select","incomingSelect","showHiddenFields","unpublishAllLocales","unpublishAllLocalesArg","shouldCommit","hooks","beforeOperation","length","hook","context","global","operation","data","isSavingDraft","Boolean","_status","accessResults","access","update","query","undefined","globalVersionResult","where","globalExists","globalJSON","_id","originalDoc","collection","doc","globalSlug","lockErrorMessage","beforeChangeArgs","docWithLocales","skipValidation","result","localization","statusStr","localeCode","localeCodes","localizedPublishData","versions","accessibleLocaleCodes","filterAvailableLocales","filteredLocales","locales","map","code","Array","isArray","currentGlobal","db","findGlobal","currentDoc","fields","dataToUpdate","flattenedFields","resultWithLocales","now","Date","toISOString","createdAt","updatedAt","updateGlobal","createGlobal","globalType","unpublish","selectMode","previousDoc","error"],"mappings":"AAkBA,SAASA,aAAa,QAAQ,8BAA6B;AAC3D,SAASC,WAAW,QAAQ,0CAAyC;AACrE,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,YAAY,QAAQ,2CAA0C;AACvE,SAASC,cAAc,QAAQ,6CAA4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AAwC;QAExCA,SAAS,MAAMxE,YAAY;YACzBiE,YAAY;YACZlB,SAASf,IAAIe,OAAO;YACpBG;YACAgB,KAAKM;YACLxB,QAAQtB;YACRuB,WAAW;YACXwD,aAAazC;YACbhC;QACF;QAEA,wCAAwC;QACxC,uBAAuB;QACvB,wCAAwC;QAExC,IAAIN,aAAaiB,KAAK,EAAE3C,aAAa6C,QAAQ;YAC3C,KAAK,MAAMC,QAAQpB,aAAaiB,KAAK,CAAC3C,WAAW,CAAE;gBACjDwE,SACE,AAAC,MAAM1B,KAAK;oBACVC,SAASf,IAAIe,OAAO;oBACpBG;oBACAgB,KAAKM;oBACLxB,QAAQtB;oBACRC;oBACA8E,aAAazC;oBACbhC;gBACF,MAAOwC;YACX;QACF;QAEA,wCAAwC;QACxC,iBAAiB;QACjB,wCAAwC;QAExC,IAAI9B,cAAc;YAChB,MAAMpC,kBAAkB0B;QAC1B;QAEA,OAAOwC;IACT,EAAE,OAAOkC,OAAgB;QACvB,MAAM9F,gBAAgBoB;QACtB,MAAM0E;IACR;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"addHierarchyToCollection.d.ts","sourceRoot":"","sources":["../../src/hierarchy/addHierarchyToCollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAQtE,eAAO,MAAM,wBAAwB,GAAI,8FAMtC;IACD,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,iBAAiB,EAAE,MAAM,CAAA;IACzB,kBAAkB,EAAE,MAAM,CAAA;CAC3B,SAkEA,CAAA"}
1
+ {"version":3,"file":"addHierarchyToCollection.d.ts","sourceRoot":"","sources":["../../src/hierarchy/addHierarchyToCollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAQtE,eAAO,MAAM,wBAAwB,iGAMlC;IACD,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,iBAAiB,EAAE,MAAM,CAAA;IACzB,kBAAkB,EAAE,MAAM,CAAA;CAC3B,SAkEA,CAAA"}
@@ -13,6 +13,7 @@ export const addHierarchyToCollection = ({ collectionConfig, parentFieldName, sl
13
13
  name: slugPathFieldName,
14
14
  type: 'text',
15
15
  admin: {
16
+ hidden: true,
16
17
  readOnly: true
17
18
  },
18
19
  index: true,
@@ -22,6 +23,7 @@ export const addHierarchyToCollection = ({ collectionConfig, parentFieldName, sl
22
23
  name: titlePathFieldName,
23
24
  type: 'text',
24
25
  admin: {
26
+ hidden: true,
25
27
  readOnly: true
26
28
  },
27
29
  index: true,