payload 4.0.0-internal.c2b57ce → 4.0.0-internal.cd69eef

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 (822) hide show
  1. package/LICENSE.md +1 -1
  2. package/bin.js +11 -0
  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 +3 -11
  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 +9 -0
  9. package/dist/admin/adapters/devReload.d.ts.map +1 -0
  10. package/dist/admin/adapters/devReload.js +6 -0
  11. package/dist/admin/adapters/devReload.js.map +1 -0
  12. package/dist/admin/adapters/index.d.ts +3 -0
  13. package/dist/admin/adapters/index.d.ts.map +1 -1
  14. package/dist/admin/adapters/index.js.map +1 -1
  15. package/dist/admin/adapters/render.d.ts +16 -0
  16. package/dist/admin/adapters/render.d.ts.map +1 -0
  17. package/dist/admin/adapters/render.js +7 -0
  18. package/dist/admin/adapters/render.js.map +1 -0
  19. package/dist/admin/adapters/router.d.ts +8 -0
  20. package/dist/admin/adapters/router.d.ts.map +1 -1
  21. package/dist/admin/adapters/router.js.map +1 -1
  22. package/dist/admin/adapters/views.d.ts +36 -0
  23. package/dist/admin/adapters/views.d.ts.map +1 -0
  24. package/dist/admin/adapters/views.js +7 -0
  25. package/dist/admin/adapters/views.js.map +1 -0
  26. package/dist/admin/fields/Row.d.ts +2 -2
  27. package/dist/admin/fields/Row.d.ts.map +1 -1
  28. package/dist/admin/fields/Row.js.map +1 -1
  29. package/dist/admin/forms/Description.d.ts +2 -2
  30. package/dist/admin/forms/Description.d.ts.map +1 -1
  31. package/dist/admin/forms/Description.js.map +1 -1
  32. package/dist/admin/forms/Field.d.ts +10 -5
  33. package/dist/admin/forms/Field.d.ts.map +1 -1
  34. package/dist/admin/forms/Field.js.map +1 -1
  35. package/dist/admin/functions/index.d.ts +10 -1
  36. package/dist/admin/functions/index.d.ts.map +1 -1
  37. package/dist/admin/functions/index.js.map +1 -1
  38. package/dist/admin/types.d.ts +3 -2
  39. package/dist/admin/types.d.ts.map +1 -1
  40. package/dist/admin/types.js.map +1 -1
  41. package/dist/admin/views/dashboard.d.ts +7 -0
  42. package/dist/admin/views/dashboard.d.ts.map +1 -1
  43. package/dist/admin/views/dashboard.js.map +1 -1
  44. package/dist/admin/views/document.d.ts +5 -3
  45. package/dist/admin/views/document.d.ts.map +1 -1
  46. package/dist/admin/views/document.js.map +1 -1
  47. package/dist/admin/views/list.d.ts +10 -1
  48. package/dist/admin/views/list.d.ts.map +1 -1
  49. package/dist/admin/views/list.js.map +1 -1
  50. package/dist/auth/baseFields/apiKey.d.ts +10 -2
  51. package/dist/auth/baseFields/apiKey.d.ts.map +1 -1
  52. package/dist/auth/baseFields/apiKey.js +35 -24
  53. package/dist/auth/baseFields/apiKey.js.map +1 -1
  54. package/dist/auth/cookies.d.ts +2 -2
  55. package/dist/auth/cookies.d.ts.map +1 -1
  56. package/dist/auth/defaultAccess.d.ts +1 -1
  57. package/dist/auth/defaultAccess.d.ts.map +1 -1
  58. package/dist/auth/defaultAccess.js +1 -1
  59. package/dist/auth/defaultAccess.js.map +1 -1
  60. package/dist/auth/defaultUser.d.ts.map +1 -1
  61. package/dist/auth/defaultUser.js +2 -1
  62. package/dist/auth/defaultUser.js.map +1 -1
  63. package/dist/auth/ensureUsernameOrEmail.d.ts.map +1 -1
  64. package/dist/auth/executeAccess.d.ts.map +1 -1
  65. package/dist/auth/executeAuthStrategies.d.ts.map +1 -1
  66. package/dist/auth/extractAccessFromPermission.d.ts.map +1 -1
  67. package/dist/auth/extractJWT.d.ts +1 -1
  68. package/dist/auth/extractJWT.d.ts.map +1 -1
  69. package/dist/auth/getAuthFields.d.ts.map +1 -1
  70. package/dist/auth/getAuthFields.js +2 -2
  71. package/dist/auth/getAuthFields.js.map +1 -1
  72. package/dist/auth/getFieldsToSign.d.ts +1 -1
  73. package/dist/auth/getFieldsToSign.d.ts.map +1 -1
  74. package/dist/auth/getLoginOptions.d.ts +1 -1
  75. package/dist/auth/getLoginOptions.d.ts.map +1 -1
  76. package/dist/auth/isUserLocked.d.ts.map +1 -1
  77. package/dist/auth/jwt.d.ts.map +1 -1
  78. package/dist/auth/operations/access.d.ts.map +1 -1
  79. package/dist/auth/operations/auth.d.ts +2 -2
  80. package/dist/auth/operations/auth.d.ts.map +1 -1
  81. package/dist/auth/operations/auth.js.map +1 -1
  82. package/dist/auth/operations/forgotPassword.d.ts.map +1 -1
  83. package/dist/auth/operations/init.d.ts.map +1 -1
  84. package/dist/auth/operations/local/auth.d.ts.map +1 -1
  85. package/dist/auth/operations/login.d.ts +2 -1
  86. package/dist/auth/operations/login.d.ts.map +1 -1
  87. package/dist/auth/operations/login.js.map +1 -1
  88. package/dist/auth/operations/logout.d.ts.map +1 -1
  89. package/dist/auth/operations/me.d.ts +2 -2
  90. package/dist/auth/operations/me.d.ts.map +1 -1
  91. package/dist/auth/operations/me.js.map +1 -1
  92. package/dist/auth/operations/refresh.d.ts.map +1 -1
  93. package/dist/auth/operations/refresh.js +9 -3
  94. package/dist/auth/operations/refresh.js.map +1 -1
  95. package/dist/auth/operations/registerFirstUser.d.ts.map +1 -1
  96. package/dist/auth/operations/resetPassword.d.ts.map +1 -1
  97. package/dist/auth/operations/resetPassword.js.map +1 -1
  98. package/dist/auth/operations/unlock.d.ts.map +1 -1
  99. package/dist/auth/operations/verifyEmail.d.ts.map +1 -1
  100. package/dist/auth/sendVerificationEmail.d.ts +2 -2
  101. package/dist/auth/sendVerificationEmail.d.ts.map +1 -1
  102. package/dist/auth/sendVerificationEmail.js +1 -1
  103. package/dist/auth/sendVerificationEmail.js.map +1 -1
  104. package/dist/auth/sessions.d.ts +4 -5
  105. package/dist/auth/sessions.d.ts.map +1 -1
  106. package/dist/auth/sessions.js +5 -3
  107. package/dist/auth/sessions.js.map +1 -1
  108. package/dist/auth/strategies/apiKey.d.ts.map +1 -1
  109. package/dist/auth/strategies/apiKey.js.map +1 -1
  110. package/dist/auth/strategies/local/authenticate.d.ts.map +1 -1
  111. package/dist/auth/strategies/local/generatePasswordSaltHash.d.ts.map +1 -1
  112. package/dist/auth/strategies/local/incrementLoginAttempts.d.ts +2 -2
  113. package/dist/auth/strategies/local/incrementLoginAttempts.d.ts.map +1 -1
  114. package/dist/auth/strategies/local/incrementLoginAttempts.js +1 -1
  115. package/dist/auth/strategies/local/incrementLoginAttempts.js.map +1 -1
  116. package/dist/auth/strategies/local/register.d.ts.map +1 -1
  117. package/dist/auth/strategies/local/resetLoginAttempts.d.ts.map +1 -1
  118. package/dist/auth/types.d.ts +25 -21
  119. package/dist/auth/types.d.ts.map +1 -1
  120. package/dist/auth/types.js.map +1 -1
  121. package/dist/bin/build.d.ts +49 -0
  122. package/dist/bin/build.d.ts.map +1 -0
  123. package/dist/bin/build.js +226 -0
  124. package/dist/bin/build.js.map +1 -0
  125. package/dist/bin/build.spec.js +594 -0
  126. package/dist/bin/build.spec.js.map +1 -0
  127. package/dist/bin/frameworkConventions.d.ts +8 -0
  128. package/dist/bin/frameworkConventions.d.ts.map +1 -0
  129. package/dist/bin/frameworkConventions.js +8 -0
  130. package/dist/bin/frameworkConventions.js.map +1 -0
  131. package/dist/bin/generateImportMap/index.d.ts.map +1 -1
  132. package/dist/bin/generateImportMap/index.js +8 -5
  133. package/dist/bin/generateImportMap/index.js.map +1 -1
  134. package/dist/bin/generateImportMap/iterateCollections.d.ts.map +1 -1
  135. package/dist/bin/generateImportMap/iterateCollections.js +11 -0
  136. package/dist/bin/generateImportMap/iterateCollections.js.map +1 -1
  137. package/dist/bin/generateImportMap/iterateConfig.d.ts.map +1 -1
  138. package/dist/bin/generateImportMap/iterateConfig.js +12 -0
  139. package/dist/bin/generateImportMap/iterateConfig.js.map +1 -1
  140. package/dist/bin/generateImportMap/iterateFields.d.ts.map +1 -1
  141. package/dist/bin/generateImportMap/iterateFields.js +4 -1
  142. package/dist/bin/generateImportMap/iterateFields.js.map +1 -1
  143. package/dist/bin/generateImportMap/utilities/getFromImportMap.d.ts.map +1 -1
  144. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.d.ts +5 -1
  145. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.d.ts.map +1 -1
  146. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.js +33 -18
  147. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.js.map +1 -1
  148. package/dist/bin/generateTypes.d.ts +3 -2
  149. package/dist/bin/generateTypes.d.ts.map +1 -1
  150. package/dist/bin/generateTypes.js +11 -1
  151. package/dist/bin/generateTypes.js.map +1 -1
  152. package/dist/bin/index.d.ts.map +1 -1
  153. package/dist/bin/index.js +9 -0
  154. package/dist/bin/index.js.map +1 -1
  155. package/dist/bin/loadEnv.d.ts +3 -1
  156. package/dist/bin/loadEnv.d.ts.map +1 -1
  157. package/dist/bin/loadEnv.js +40 -10
  158. package/dist/bin/loadEnv.js.map +1 -1
  159. package/dist/bin/migrate.d.ts.map +1 -1
  160. package/dist/collections/config/client.d.ts +11 -4
  161. package/dist/collections/config/client.d.ts.map +1 -1
  162. package/dist/collections/config/client.js +8 -0
  163. package/dist/collections/config/client.js.map +1 -1
  164. package/dist/collections/config/defaults.d.ts +0 -4
  165. package/dist/collections/config/defaults.d.ts.map +1 -1
  166. package/dist/collections/config/defaults.js +2 -17
  167. package/dist/collections/config/defaults.js.map +1 -1
  168. package/dist/collections/config/defaults.spec.js +47 -0
  169. package/dist/collections/config/defaults.spec.js.map +1 -0
  170. package/dist/collections/config/sanitize.d.ts.map +1 -1
  171. package/dist/collections/config/sanitize.js +1 -11
  172. package/dist/collections/config/sanitize.js.map +1 -1
  173. package/dist/collections/config/sanitizeCompoundIndexes.d.ts.map +1 -1
  174. package/dist/collections/config/types.d.ts +13 -9
  175. package/dist/collections/config/types.d.ts.map +1 -1
  176. package/dist/collections/config/types.js.map +1 -1
  177. package/dist/collections/config/useAsTitle.d.ts.map +1 -1
  178. package/dist/collections/dataloader.d.ts +1 -1
  179. package/dist/collections/dataloader.d.ts.map +1 -1
  180. package/dist/collections/endpoints/create.d.ts.map +1 -1
  181. package/dist/collections/endpoints/create.js +0 -2
  182. package/dist/collections/endpoints/create.js.map +1 -1
  183. package/dist/collections/endpoints/updateByID.d.ts.map +1 -1
  184. package/dist/collections/endpoints/updateByID.js +1 -2
  185. package/dist/collections/endpoints/updateByID.js.map +1 -1
  186. package/dist/collections/operations/count.d.ts.map +1 -1
  187. package/dist/collections/operations/count.js +1 -0
  188. package/dist/collections/operations/count.js.map +1 -1
  189. package/dist/collections/operations/countVersions.d.ts.map +1 -1
  190. package/dist/collections/operations/create.d.ts +0 -1
  191. package/dist/collections/operations/create.d.ts.map +1 -1
  192. package/dist/collections/operations/create.js +15 -6
  193. package/dist/collections/operations/create.js.map +1 -1
  194. package/dist/collections/operations/delete.d.ts.map +1 -1
  195. package/dist/collections/operations/delete.js +3 -0
  196. package/dist/collections/operations/delete.js.map +1 -1
  197. package/dist/collections/operations/deleteByID.d.ts.map +1 -1
  198. package/dist/collections/operations/duplicate.d.ts.map +1 -1
  199. package/dist/collections/operations/find.d.ts.map +1 -1
  200. package/dist/collections/operations/findByID.d.ts.map +1 -1
  201. package/dist/collections/operations/findDistinct.d.ts.map +1 -1
  202. package/dist/collections/operations/findDistinct.js +1 -0
  203. package/dist/collections/operations/findDistinct.js.map +1 -1
  204. package/dist/collections/operations/findVersionByID.d.ts.map +1 -1
  205. package/dist/collections/operations/findVersions.d.ts.map +1 -1
  206. package/dist/collections/operations/local/count.d.ts +3 -3
  207. package/dist/collections/operations/local/count.d.ts.map +1 -1
  208. package/dist/collections/operations/local/count.js.map +1 -1
  209. package/dist/collections/operations/local/countVersions.d.ts +3 -3
  210. package/dist/collections/operations/local/countVersions.d.ts.map +1 -1
  211. package/dist/collections/operations/local/countVersions.js.map +1 -1
  212. package/dist/collections/operations/local/create.d.ts +3 -3
  213. package/dist/collections/operations/local/create.d.ts.map +1 -1
  214. package/dist/collections/operations/local/create.js.map +1 -1
  215. package/dist/collections/operations/local/delete.d.ts +3 -3
  216. package/dist/collections/operations/local/delete.d.ts.map +1 -1
  217. package/dist/collections/operations/local/delete.js.map +1 -1
  218. package/dist/collections/operations/local/duplicate.d.ts +3 -3
  219. package/dist/collections/operations/local/duplicate.d.ts.map +1 -1
  220. package/dist/collections/operations/local/duplicate.js.map +1 -1
  221. package/dist/collections/operations/local/find.d.ts +3 -3
  222. package/dist/collections/operations/local/find.d.ts.map +1 -1
  223. package/dist/collections/operations/local/find.js.map +1 -1
  224. package/dist/collections/operations/local/findByID.d.ts +3 -3
  225. package/dist/collections/operations/local/findByID.d.ts.map +1 -1
  226. package/dist/collections/operations/local/findByID.js.map +1 -1
  227. package/dist/collections/operations/local/findDistinct.d.ts +2 -2
  228. package/dist/collections/operations/local/findDistinct.d.ts.map +1 -1
  229. package/dist/collections/operations/local/findDistinct.js.map +1 -1
  230. package/dist/collections/operations/local/findVersionByID.d.ts +3 -3
  231. package/dist/collections/operations/local/findVersionByID.d.ts.map +1 -1
  232. package/dist/collections/operations/local/findVersionByID.js.map +1 -1
  233. package/dist/collections/operations/local/findVersions.d.ts +3 -3
  234. package/dist/collections/operations/local/findVersions.d.ts.map +1 -1
  235. package/dist/collections/operations/local/findVersions.js.map +1 -1
  236. package/dist/collections/operations/local/restoreVersion.d.ts +3 -3
  237. package/dist/collections/operations/local/restoreVersion.d.ts.map +1 -1
  238. package/dist/collections/operations/local/restoreVersion.js.map +1 -1
  239. package/dist/collections/operations/local/update.d.ts +7 -11
  240. package/dist/collections/operations/local/update.d.ts.map +1 -1
  241. package/dist/collections/operations/local/update.js +1 -2
  242. package/dist/collections/operations/local/update.js.map +1 -1
  243. package/dist/collections/operations/restoreVersion.d.ts.map +1 -1
  244. package/dist/collections/operations/update.d.ts +0 -1
  245. package/dist/collections/operations/update.d.ts.map +1 -1
  246. package/dist/collections/operations/update.js +8 -4
  247. package/dist/collections/operations/update.js.map +1 -1
  248. package/dist/collections/operations/updateByID.d.ts +0 -1
  249. package/dist/collections/operations/updateByID.d.ts.map +1 -1
  250. package/dist/collections/operations/updateByID.js +1 -5
  251. package/dist/collections/operations/updateByID.js.map +1 -1
  252. package/dist/collections/operations/utilities/buildAfterOperation.d.ts +1 -1
  253. package/dist/collections/operations/utilities/buildAfterOperation.d.ts.map +1 -1
  254. package/dist/collections/operations/utilities/copyDataWithFreshRowIDs.d.ts +9 -0
  255. package/dist/collections/operations/utilities/copyDataWithFreshRowIDs.d.ts.map +1 -0
  256. package/dist/collections/operations/utilities/copyDataWithFreshRowIDs.js +170 -0
  257. package/dist/collections/operations/utilities/copyDataWithFreshRowIDs.js.map +1 -0
  258. package/dist/collections/operations/utilities/sanitizeSortQuery.d.ts.map +1 -1
  259. package/dist/collections/operations/utilities/types.d.ts +20 -29
  260. package/dist/collections/operations/utilities/types.d.ts.map +1 -1
  261. package/dist/collections/operations/utilities/types.js.map +1 -1
  262. package/dist/collections/operations/utilities/update.d.ts +1 -2
  263. package/dist/collections/operations/utilities/update.d.ts.map +1 -1
  264. package/dist/collections/operations/utilities/update.js +64 -65
  265. package/dist/collections/operations/utilities/update.js.map +1 -1
  266. package/dist/config/client.d.ts +2 -2
  267. package/dist/config/client.d.ts.map +1 -1
  268. package/dist/config/client.js.map +1 -1
  269. package/dist/config/defaults.d.ts +0 -4
  270. package/dist/config/defaults.d.ts.map +1 -1
  271. package/dist/config/defaults.js +0 -78
  272. package/dist/config/defaults.js.map +1 -1
  273. package/dist/config/definePlugin.d.ts +10 -10
  274. package/dist/config/definePlugin.d.ts.map +1 -1
  275. package/dist/config/definePlugin.js +7 -11
  276. package/dist/config/definePlugin.js.map +1 -1
  277. package/dist/config/orderable/fractional-indexing.d.ts +23 -23
  278. package/dist/config/orderable/fractional-indexing.d.ts.map +1 -1
  279. package/dist/config/orderable/index.d.ts.map +1 -1
  280. package/dist/config/orderable/index.js +23 -0
  281. package/dist/config/orderable/index.js.map +1 -1
  282. package/dist/config/sanitize.d.ts.map +1 -1
  283. package/dist/config/sanitize.js +141 -13
  284. package/dist/config/sanitize.js.map +1 -1
  285. package/dist/config/types.d.ts +67 -20
  286. package/dist/config/types.d.ts.map +1 -1
  287. package/dist/config/types.js +2 -0
  288. package/dist/config/types.js.map +1 -1
  289. package/dist/database/combineQueries.d.ts.map +1 -1
  290. package/dist/database/getLocalizedPaths.d.ts.map +1 -1
  291. package/dist/database/getLocalizedPaths.js +1 -1
  292. package/dist/database/getLocalizedPaths.js.map +1 -1
  293. package/dist/database/migrations/findMigrationDir.d.ts.map +1 -1
  294. package/dist/database/migrations/getPredefinedMigration.d.ts.map +1 -1
  295. package/dist/database/migrations/migrationsCollection.d.ts.map +1 -1
  296. package/dist/database/migrations/migrationsCollection.js +2 -1
  297. package/dist/database/migrations/migrationsCollection.js.map +1 -1
  298. package/dist/database/migrations/readMigrationFiles.d.ts.map +1 -1
  299. package/dist/database/migrations/writeMigrationIndex.d.ts.map +1 -1
  300. package/dist/database/sanitizeJoinQuery.d.ts.map +1 -1
  301. package/dist/database/sanitizeWhereQuery.d.ts.map +1 -1
  302. package/dist/database/types.d.ts +1 -5
  303. package/dist/database/types.d.ts.map +1 -1
  304. package/dist/database/types.js.map +1 -1
  305. package/dist/duplicateDocument/index.d.ts.map +1 -1
  306. package/dist/email/getStringifiedToAddress.d.ts.map +1 -1
  307. package/dist/errors/APIError.d.ts.map +1 -1
  308. package/dist/errors/AuthenticationError.d.ts.map +1 -1
  309. package/dist/errors/DuplicateCollection.d.ts.map +1 -1
  310. package/dist/errors/DuplicateFieldName.d.ts.map +1 -1
  311. package/dist/errors/DuplicateGlobal.d.ts.map +1 -1
  312. package/dist/errors/ErrorDeletingFile.d.ts.map +1 -1
  313. package/dist/errors/FileRetrievalError.d.ts.map +1 -1
  314. package/dist/errors/FileUploadError.d.ts.map +1 -1
  315. package/dist/errors/Forbidden.d.ts.map +1 -1
  316. package/dist/errors/InvalidConfiguration.d.ts.map +1 -1
  317. package/dist/errors/InvalidFieldJoin.d.ts.map +1 -1
  318. package/dist/errors/InvalidFieldName.d.ts.map +1 -1
  319. package/dist/errors/InvalidFieldRelationship.d.ts.map +1 -1
  320. package/dist/errors/InvalidSchema.d.ts.map +1 -1
  321. package/dist/errors/Locked.d.ts.map +1 -1
  322. package/dist/errors/LockedAuth.d.ts.map +1 -1
  323. package/dist/errors/MissingCollectionLabel.d.ts.map +1 -1
  324. package/dist/errors/MissingEditorProp.d.ts.map +1 -1
  325. package/dist/errors/MissingFieldInputOptions.d.ts.map +1 -1
  326. package/dist/errors/MissingFieldType.d.ts.map +1 -1
  327. package/dist/errors/MissingFile.d.ts.map +1 -1
  328. package/dist/errors/NotFound.d.ts.map +1 -1
  329. package/dist/errors/QueryError.d.ts.map +1 -1
  330. package/dist/errors/ReservedFieldName.d.ts.map +1 -1
  331. package/dist/errors/TimestampsRequired.d.ts.map +1 -1
  332. package/dist/errors/UnauthorizedError.d.ts.map +1 -1
  333. package/dist/errors/UnverifiedEmail.d.ts.map +1 -1
  334. package/dist/errors/ValidationError.d.ts +1 -0
  335. package/dist/errors/ValidationError.d.ts.map +1 -1
  336. package/dist/errors/ValidationError.js.map +1 -1
  337. package/dist/exports/internal.d.ts +2 -0
  338. package/dist/exports/internal.d.ts.map +1 -1
  339. package/dist/exports/internal.js +2 -0
  340. package/dist/exports/internal.js.map +1 -1
  341. package/dist/exports/migrations.d.ts +5 -13
  342. package/dist/exports/migrations.d.ts.map +1 -1
  343. package/dist/exports/migrations.js +5 -13
  344. package/dist/exports/migrations.js.map +1 -1
  345. package/dist/exports/shared.d.ts +23 -2
  346. package/dist/exports/shared.d.ts.map +1 -1
  347. package/dist/exports/shared.js +22 -1
  348. package/dist/exports/shared.js.map +1 -1
  349. package/dist/fields/baseFields/slug/countVersions.d.ts.map +1 -1
  350. package/dist/fields/baseFields/slug/countVersions.js +6 -8
  351. package/dist/fields/baseFields/slug/countVersions.js.map +1 -1
  352. package/dist/fields/baseFields/slug/generateSlug.d.ts +14 -7
  353. package/dist/fields/baseFields/slug/generateSlug.d.ts.map +1 -1
  354. package/dist/fields/baseFields/slug/generateSlug.js +53 -73
  355. package/dist/fields/baseFields/slug/generateSlug.js.map +1 -1
  356. package/dist/fields/baseFields/slug/types.d.ts +14 -0
  357. package/dist/fields/baseFields/slug/types.d.ts.map +1 -0
  358. package/dist/fields/baseFields/slug/types.js +6 -0
  359. package/dist/fields/baseFields/slug/types.js.map +1 -0
  360. package/dist/fields/config/client.d.ts +6 -6
  361. package/dist/fields/config/client.d.ts.map +1 -1
  362. package/dist/fields/config/client.js +14 -14
  363. package/dist/fields/config/client.js.map +1 -1
  364. package/dist/fields/config/sanitize.d.ts.map +1 -1
  365. package/dist/fields/config/sanitize.js +40 -4
  366. package/dist/fields/config/sanitize.js.map +1 -1
  367. package/dist/fields/config/sanitizeJoinField.d.ts.map +1 -1
  368. package/dist/fields/config/types.d.ts +80 -76
  369. package/dist/fields/config/types.d.ts.map +1 -1
  370. package/dist/fields/config/types.js.map +1 -1
  371. package/dist/fields/getDefaultValue.d.ts.map +1 -1
  372. package/dist/fields/hooks/afterChange/index.d.ts.map +1 -1
  373. package/dist/fields/hooks/afterChange/promise.d.ts.map +1 -1
  374. package/dist/fields/hooks/afterChange/promise.js +1 -1
  375. package/dist/fields/hooks/afterChange/promise.js.map +1 -1
  376. package/dist/fields/hooks/afterChange/traverseFields.d.ts.map +1 -1
  377. package/dist/fields/hooks/afterRead/promise.d.ts.map +1 -1
  378. package/dist/fields/hooks/afterRead/promise.js +13 -3
  379. package/dist/fields/hooks/afterRead/promise.js.map +1 -1
  380. package/dist/fields/hooks/afterRead/relationshipPopulationPromise.d.ts.map +1 -1
  381. package/dist/fields/hooks/afterRead/traverseFields.d.ts.map +1 -1
  382. package/dist/fields/hooks/afterRead/virtualFieldPopulationPromise.d.ts.map +1 -1
  383. package/dist/fields/hooks/beforeChange/cloneDataFromOriginalDoc.d.ts.map +1 -1
  384. package/dist/fields/hooks/beforeChange/getExistingRowDoc.d.ts.map +1 -1
  385. package/dist/fields/hooks/beforeChange/index.d.ts.map +1 -1
  386. package/dist/fields/hooks/beforeChange/promise.d.ts.map +1 -1
  387. package/dist/fields/hooks/beforeChange/promise.js +3 -3
  388. package/dist/fields/hooks/beforeChange/promise.js.map +1 -1
  389. package/dist/fields/hooks/beforeChange/traverseFields.d.ts.map +1 -1
  390. package/dist/fields/hooks/beforeDuplicate/index.d.ts.map +1 -1
  391. package/dist/fields/hooks/beforeDuplicate/promise.d.ts.map +1 -1
  392. package/dist/fields/hooks/beforeDuplicate/promise.js +2 -2
  393. package/dist/fields/hooks/beforeDuplicate/promise.js.map +1 -1
  394. package/dist/fields/hooks/beforeDuplicate/traverseFields.d.ts.map +1 -1
  395. package/dist/fields/hooks/beforeValidate/index.d.ts.map +1 -1
  396. package/dist/fields/hooks/beforeValidate/promise.d.ts.map +1 -1
  397. package/dist/fields/hooks/beforeValidate/promise.js +11 -2
  398. package/dist/fields/hooks/beforeValidate/promise.js.map +1 -1
  399. package/dist/fields/hooks/beforeValidate/traverseFields.d.ts.map +1 -1
  400. package/dist/fields/isFieldDisabled.d.ts.map +1 -1
  401. package/dist/fields/mergeBaseFields.d.ts.map +1 -1
  402. package/dist/fields/setDefaultBeforeDuplicate.d.ts.map +1 -1
  403. package/dist/fields/setDefaultBeforeDuplicate.js +1 -0
  404. package/dist/fields/setDefaultBeforeDuplicate.js.map +1 -1
  405. package/dist/fields/sortableFieldTypes.d.ts.map +1 -1
  406. package/dist/fields/sortableFieldTypes.js +1 -0
  407. package/dist/fields/sortableFieldTypes.js.map +1 -1
  408. package/dist/fields/validations.d.ts +4 -1
  409. package/dist/fields/validations.d.ts.map +1 -1
  410. package/dist/fields/validations.js +12 -4
  411. package/dist/fields/validations.js.map +1 -1
  412. package/dist/globals/config/client.d.ts +4 -4
  413. package/dist/globals/config/client.d.ts.map +1 -1
  414. package/dist/globals/config/sanitize.d.ts.map +1 -1
  415. package/dist/globals/config/sanitize.js +2 -6
  416. package/dist/globals/config/sanitize.js.map +1 -1
  417. package/dist/globals/config/sanitize.spec.js +43 -0
  418. package/dist/globals/config/sanitize.spec.js.map +1 -0
  419. package/dist/globals/endpoints/update.d.ts.map +1 -1
  420. package/dist/globals/endpoints/update.js +0 -2
  421. package/dist/globals/endpoints/update.js.map +1 -1
  422. package/dist/globals/operations/countGlobalVersions.d.ts.map +1 -1
  423. package/dist/globals/operations/docAccess.d.ts.map +1 -1
  424. package/dist/globals/operations/findOne.d.ts.map +1 -1
  425. package/dist/globals/operations/findVersionByID.d.ts.map +1 -1
  426. package/dist/globals/operations/findVersions.d.ts.map +1 -1
  427. package/dist/globals/operations/local/countVersions.d.ts +3 -3
  428. package/dist/globals/operations/local/countVersions.d.ts.map +1 -1
  429. package/dist/globals/operations/local/countVersions.js.map +1 -1
  430. package/dist/globals/operations/local/findOne.d.ts +3 -3
  431. package/dist/globals/operations/local/findOne.d.ts.map +1 -1
  432. package/dist/globals/operations/local/findOne.js.map +1 -1
  433. package/dist/globals/operations/local/findVersionByID.d.ts +3 -3
  434. package/dist/globals/operations/local/findVersionByID.d.ts.map +1 -1
  435. package/dist/globals/operations/local/findVersionByID.js.map +1 -1
  436. package/dist/globals/operations/local/findVersions.d.ts +3 -3
  437. package/dist/globals/operations/local/findVersions.d.ts.map +1 -1
  438. package/dist/globals/operations/local/findVersions.js.map +1 -1
  439. package/dist/globals/operations/local/restoreVersion.d.ts +3 -3
  440. package/dist/globals/operations/local/restoreVersion.d.ts.map +1 -1
  441. package/dist/globals/operations/local/restoreVersion.js.map +1 -1
  442. package/dist/globals/operations/local/update.d.ts +7 -9
  443. package/dist/globals/operations/local/update.d.ts.map +1 -1
  444. package/dist/globals/operations/local/update.js +1 -2
  445. package/dist/globals/operations/local/update.js.map +1 -1
  446. package/dist/globals/operations/restoreVersion.d.ts.map +1 -1
  447. package/dist/globals/operations/update.d.ts +0 -1
  448. package/dist/globals/operations/update.d.ts.map +1 -1
  449. package/dist/globals/operations/update.js +52 -58
  450. package/dist/globals/operations/update.js.map +1 -1
  451. package/dist/hierarchy/addHierarchyToCollection.d.ts.map +1 -1
  452. package/dist/hierarchy/buildParentField.d.ts.map +1 -1
  453. package/dist/hierarchy/constants.d.ts.map +1 -1
  454. package/dist/hierarchy/getInitialTreeData.d.ts.map +1 -1
  455. package/dist/hierarchy/hooks/collectionAfterDelete.d.ts.map +1 -1
  456. package/dist/hierarchy/hooks/collectionAfterRead.d.ts.map +1 -1
  457. package/dist/hierarchy/hooks/collectionBeforeChange.d.ts.map +1 -1
  458. package/dist/hierarchy/hooks/collectionBeforeDelete.d.ts.map +1 -1
  459. package/dist/hierarchy/hooks/collectionBeforeOperation.d.ts.map +1 -1
  460. package/dist/hierarchy/hooks/ensureSafeCollectionsChange.d.ts.map +1 -1
  461. package/dist/hierarchy/injectHierarchyButton.d.ts.map +1 -1
  462. package/dist/hierarchy/resolveHierarchyCollections.d.ts.map +1 -1
  463. package/dist/hierarchy/resolveHierarchyCollections.js +1 -1
  464. package/dist/hierarchy/resolveHierarchyCollections.js.map +1 -1
  465. package/dist/hierarchy/sanitizeHierarchyCollection.d.ts.map +1 -1
  466. package/dist/hierarchy/sanitizeHierarchyCollection.js +3 -1
  467. package/dist/hierarchy/sanitizeHierarchyCollection.js.map +1 -1
  468. package/dist/hierarchy/types.d.ts +8 -1
  469. package/dist/hierarchy/types.d.ts.map +1 -1
  470. package/dist/hierarchy/types.js.map +1 -1
  471. package/dist/index.bundled.d.ts +4466 -4152
  472. package/dist/index.d.ts +79 -34
  473. package/dist/index.d.ts.map +1 -1
  474. package/dist/index.js +54 -37
  475. package/dist/index.js.map +1 -1
  476. package/dist/kv/adapters/DatabaseKVAdapter.d.ts.map +1 -1
  477. package/dist/kv/adapters/DatabaseKVAdapter.js +1 -0
  478. package/dist/kv/adapters/DatabaseKVAdapter.js.map +1 -1
  479. package/dist/kv/adapters/InMemoryKVAdapter.d.ts.map +1 -1
  480. package/dist/locked-documents/config.d.ts.map +1 -1
  481. package/dist/locked-documents/config.js +2 -1
  482. package/dist/locked-documents/config.js.map +1 -1
  483. package/dist/preferences/config.d.ts.map +1 -1
  484. package/dist/preferences/config.js +2 -1
  485. package/dist/preferences/config.js.map +1 -1
  486. package/dist/preferences/deleteUserPreferences.d.ts.map +1 -1
  487. package/dist/preferences/keys.d.ts +8 -4
  488. package/dist/preferences/keys.d.ts.map +1 -1
  489. package/dist/preferences/keys.js +4 -1
  490. package/dist/preferences/keys.js.map +1 -1
  491. package/dist/preferences/types.d.ts +15 -0
  492. package/dist/preferences/types.d.ts.map +1 -1
  493. package/dist/preferences/types.js +3 -1
  494. package/dist/preferences/types.js.map +1 -1
  495. package/dist/query-presets/access.d.ts.map +1 -1
  496. package/dist/query-presets/config.d.ts.map +1 -1
  497. package/dist/query-presets/config.js +77 -37
  498. package/dist/query-presets/config.js.map +1 -1
  499. package/dist/query-presets/constraints.d.ts.map +1 -1
  500. package/dist/query-presets/constraints.js +3 -2
  501. package/dist/query-presets/constraints.js.map +1 -1
  502. package/dist/query-presets/types.d.ts +1 -1
  503. package/dist/query-presets/types.d.ts.map +1 -1
  504. package/dist/queues/config/collection.d.ts.map +1 -1
  505. package/dist/queues/config/collection.js +2 -1
  506. package/dist/queues/config/collection.js.map +1 -1
  507. package/dist/queues/config/generateJobsJSONSchemas.d.ts +1 -1
  508. package/dist/queues/config/generateJobsJSONSchemas.d.ts.map +1 -1
  509. package/dist/queues/config/generateJobsJSONSchemas.js +33 -12
  510. package/dist/queues/config/generateJobsJSONSchemas.js.map +1 -1
  511. package/dist/queues/config/global.d.ts.map +1 -1
  512. package/dist/queues/config/global.js +2 -1
  513. package/dist/queues/config/global.js.map +1 -1
  514. package/dist/queues/endpoints/run.d.ts.map +1 -1
  515. package/dist/queues/errors/index.d.ts.map +1 -1
  516. package/dist/queues/localAPI.d.ts +8 -8
  517. package/dist/queues/localAPI.d.ts.map +1 -1
  518. package/dist/queues/operations/handleSchedules/getQueuesWithSchedules.d.ts.map +1 -1
  519. package/dist/queues/operations/runJobs/index.d.ts.map +1 -1
  520. package/dist/queues/operations/runJobs/runJSONJob/index.d.ts.map +1 -1
  521. package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.d.ts.map +1 -1
  522. package/dist/queues/operations/runJobs/runJob/importHandlerPath.d.ts +1 -1
  523. package/dist/queues/operations/runJobs/runJob/importHandlerPath.d.ts.map +1 -1
  524. package/dist/queues/operations/runJobs/runJob/index.d.ts.map +1 -1
  525. package/dist/queues/utilities/getCurrentDate.d.ts.map +1 -1
  526. package/dist/queues/utilities/getJobTaskStatus.d.ts.map +1 -1
  527. package/dist/translations/getLocalI18n.d.ts.map +1 -1
  528. package/dist/types/constants.d.ts +2 -2
  529. package/dist/types/constants.d.ts.map +1 -1
  530. package/dist/types/index.d.ts +9 -7
  531. package/dist/types/index.d.ts.map +1 -1
  532. package/dist/types/index.js.map +1 -1
  533. package/dist/uploads/checkFileAccess.d.ts.map +1 -1
  534. package/dist/uploads/checkFileRestrictions.d.ts.map +1 -1
  535. package/dist/uploads/cropImage.d.ts.map +1 -1
  536. package/dist/uploads/docWithFilenameExists.d.ts.map +1 -1
  537. package/dist/uploads/endpoints/uploadInstructions.d.ts +3 -0
  538. package/dist/uploads/endpoints/uploadInstructions.d.ts.map +1 -0
  539. package/dist/uploads/endpoints/uploadInstructions.js +38 -0
  540. package/dist/uploads/endpoints/uploadInstructions.js.map +1 -0
  541. package/dist/uploads/fetchAPI-multipart/isEligibleRequest.d.ts.map +1 -1
  542. package/dist/uploads/fetchAPI-multipart/processMultipart.d.ts.map +1 -1
  543. package/dist/uploads/fetchAPI-multipart/processMultipart.js +4 -0
  544. package/dist/uploads/fetchAPI-multipart/processMultipart.js.map +1 -1
  545. package/dist/uploads/fetchAPI-multipart/processNested.d.ts.map +1 -1
  546. package/dist/uploads/fetchAPI-multipart/utilities.d.ts.map +1 -1
  547. package/dist/uploads/fileExists.d.ts.map +1 -1
  548. package/dist/uploads/generateFileData.d.ts +2 -1
  549. package/dist/uploads/generateFileData.d.ts.map +1 -1
  550. package/dist/uploads/generateFileData.js +5 -2
  551. package/dist/uploads/generateFileData.js.map +1 -1
  552. package/dist/uploads/getBaseFields.d.ts.map +1 -1
  553. package/dist/uploads/getExternalFile.d.ts.map +1 -1
  554. package/dist/uploads/getFileByPath.d.ts +1 -1
  555. package/dist/uploads/getFileByPath.d.ts.map +1 -1
  556. package/dist/uploads/getFileTypeFallback.d.ts.map +1 -1
  557. package/dist/uploads/getSafeFilename.d.ts.map +1 -1
  558. package/dist/uploads/image-resizing/createImageSize.d.ts.map +1 -1
  559. package/dist/uploads/image-resizing/generateImageSizeFilename.d.ts.map +1 -1
  560. package/dist/uploads/image-resizing/getImageResizeAction.d.ts +1 -1
  561. package/dist/uploads/image-resizing/getImageResizeAction.d.ts.map +1 -1
  562. package/dist/uploads/image-resizing/parseFilename.d.ts.map +1 -1
  563. package/dist/uploads/image-resizing/sanitizeResizeConfig.d.ts.map +1 -1
  564. package/dist/uploads/matchMimeType.d.ts +8 -0
  565. package/dist/uploads/matchMimeType.d.ts.map +1 -0
  566. package/dist/uploads/matchMimeType.js +19 -0
  567. package/dist/uploads/matchMimeType.js.map +1 -0
  568. package/dist/uploads/matchMimeType.spec.js +66 -0
  569. package/dist/uploads/matchMimeType.spec.js.map +1 -0
  570. package/dist/uploads/mimeTypeValidator.d.ts.map +1 -1
  571. package/dist/uploads/safeFetch.d.ts.map +1 -1
  572. package/dist/uploads/safeFetch.js +11 -5
  573. package/dist/uploads/safeFetch.js.map +1 -1
  574. package/dist/uploads/saveBufferToFile.d.ts.map +1 -1
  575. package/dist/uploads/tempFile.d.ts.map +1 -1
  576. package/dist/uploads/types.d.ts +68 -1
  577. package/dist/uploads/types.d.ts.map +1 -1
  578. package/dist/uploads/types.js.map +1 -1
  579. package/dist/uploads/uploadFiles.d.ts.map +1 -1
  580. package/dist/utilities/addDataAndFileToRequest.d.ts.map +1 -1
  581. package/dist/utilities/addDataAndFileToRequest.js +11 -4
  582. package/dist/utilities/addDataAndFileToRequest.js.map +1 -1
  583. package/dist/utilities/addLocalesToRequest.d.ts.map +1 -1
  584. package/dist/utilities/addSelectGenericsToGeneretedTypes.d.ts.map +1 -1
  585. package/dist/utilities/appendDateTimezoneSelectFields.d.ts.map +1 -1
  586. package/dist/utilities/appendDateTimezoneSelectFields.js +2 -2
  587. package/dist/utilities/appendDateTimezoneSelectFields.js.map +1 -1
  588. package/dist/utilities/appendNonTrashedFilter.d.ts.map +1 -1
  589. package/dist/utilities/appendUploadSelectFields.d.ts.map +1 -1
  590. package/dist/utilities/canAccessAdmin.d.ts.map +1 -1
  591. package/dist/utilities/checkDocumentLockStatus.d.ts.map +1 -1
  592. package/dist/utilities/configToJSONSchema.d.ts +68 -16
  593. package/dist/utilities/configToJSONSchema.d.ts.map +1 -1
  594. package/dist/utilities/configToJSONSchema.js +312 -117
  595. package/dist/utilities/configToJSONSchema.js.map +1 -1
  596. package/dist/utilities/configToJSONSchema.spec.js +656 -85
  597. package/dist/utilities/configToJSONSchema.spec.js.map +1 -1
  598. package/dist/utilities/createLocalReq.d.ts +2 -2
  599. package/dist/utilities/createLocalReq.d.ts.map +1 -1
  600. package/dist/utilities/createLocalReq.js.map +1 -1
  601. package/dist/utilities/createPayloadRequest.d.ts.map +1 -1
  602. package/dist/utilities/createPayloadRequest.js +1 -0
  603. package/dist/utilities/createPayloadRequest.js.map +1 -1
  604. package/dist/utilities/deepCopyObject.d.ts.map +1 -1
  605. package/dist/utilities/deepCopyObject.js +8 -0
  606. package/dist/utilities/deepCopyObject.js.map +1 -1
  607. package/dist/utilities/dependencies/dependencyChecker.js +1 -1
  608. package/dist/utilities/dependencies/dependencyChecker.js.map +1 -1
  609. package/dist/utilities/dependencies/getDependencies.d.ts.map +1 -1
  610. package/dist/utilities/dependencies/getDependencies.js +5 -5
  611. package/dist/utilities/dependencies/getDependencies.js.map +1 -1
  612. package/dist/utilities/dependencies/resolveFrom.d.ts.map +1 -1
  613. package/dist/utilities/dynamicImport.js +1 -1
  614. package/dist/utilities/dynamicImport.js.map +1 -1
  615. package/dist/utilities/escapeRegExp.d.ts.map +1 -1
  616. package/dist/utilities/extractID.d.ts.map +1 -1
  617. package/dist/utilities/filterDataToSelectedLocales.d.ts.map +1 -1
  618. package/dist/utilities/filterDataToSelectedLocales.js +5 -12
  619. package/dist/utilities/filterDataToSelectedLocales.js.map +1 -1
  620. package/dist/utilities/filterDataToSelectedLocales.spec.js +1 -2
  621. package/dist/utilities/filterDataToSelectedLocales.spec.js.map +1 -1
  622. package/dist/utilities/flattenAllFields.d.ts.map +1 -1
  623. package/dist/utilities/flattenAllFields.js +7 -22
  624. package/dist/utilities/flattenAllFields.js.map +1 -1
  625. package/dist/utilities/formatAdminURL.d.ts.map +1 -1
  626. package/dist/utilities/formatErrors.d.ts.map +1 -1
  627. package/dist/utilities/formatErrors.js +3 -1
  628. package/dist/utilities/formatErrors.js.map +1 -1
  629. package/dist/utilities/formatLabels.d.ts.map +1 -1
  630. package/dist/utilities/getBestFitFromSizes.d.ts.map +1 -1
  631. package/dist/utilities/getBlockSelect.d.ts.map +1 -1
  632. package/dist/utilities/getDataByPath.d.ts.map +1 -1
  633. package/dist/utilities/getEntityPermissions/getEntityPermissions.d.ts.map +1 -1
  634. package/dist/utilities/getEntityPermissions/getEntityPermissions.js +2 -0
  635. package/dist/utilities/getEntityPermissions/getEntityPermissions.js.map +1 -1
  636. package/dist/utilities/getEntityPermissions/populateFieldPermissions.d.ts +7 -1
  637. package/dist/utilities/getEntityPermissions/populateFieldPermissions.d.ts.map +1 -1
  638. package/dist/utilities/getEntityPermissions/populateFieldPermissions.js +24 -7
  639. package/dist/utilities/getEntityPermissions/populateFieldPermissions.js.map +1 -1
  640. package/dist/utilities/getFieldByPath.d.ts.map +1 -1
  641. package/dist/utilities/getFieldByPath.js +1 -1
  642. package/dist/utilities/getFieldByPath.js.map +1 -1
  643. package/dist/utilities/getFieldPermissions.d.ts.map +1 -1
  644. package/dist/utilities/getObjectDotNotation.d.ts.map +1 -1
  645. package/dist/utilities/getRequestEntity.d.ts.map +1 -1
  646. package/dist/utilities/getRequestLanguage.d.ts +2 -2
  647. package/dist/utilities/getRequestLanguage.d.ts.map +1 -1
  648. package/dist/utilities/getRequestLanguage.js.map +1 -1
  649. package/dist/utilities/getRequestOrigin.d.ts +2 -2
  650. package/dist/utilities/getRequestOrigin.d.ts.map +1 -1
  651. package/dist/utilities/getSafeRedirect.d.ts.map +1 -1
  652. package/dist/utilities/getSelectMode.d.ts.map +1 -1
  653. package/dist/utilities/getSiblingData.d.ts.map +1 -1
  654. package/dist/utilities/getTranslatedLabel.d.ts.map +1 -1
  655. package/dist/utilities/getVersionsConfig.d.ts +1 -1
  656. package/dist/utilities/getVersionsConfig.d.ts.map +1 -1
  657. package/dist/utilities/getVersionsConfig.js.map +1 -1
  658. package/dist/utilities/handleEndpoints.d.ts.map +1 -1
  659. package/dist/utilities/handleEndpoints.js +7 -3
  660. package/dist/utilities/handleEndpoints.js.map +1 -1
  661. package/dist/utilities/headersWithCors.d.ts.map +1 -1
  662. package/dist/utilities/isEntityHidden.d.ts +2 -2
  663. package/dist/utilities/isEntityHidden.d.ts.map +1 -1
  664. package/dist/utilities/isURLAllowed.d.ts.map +1 -1
  665. package/dist/utilities/isURLAllowed.js +9 -3
  666. package/dist/utilities/isURLAllowed.js.map +1 -1
  667. package/dist/utilities/isURLAllowed.spec.js +78 -0
  668. package/dist/utilities/isURLAllowed.spec.js.map +1 -0
  669. package/dist/utilities/isValidID.d.ts +1 -1
  670. package/dist/utilities/isValidID.d.ts.map +1 -1
  671. package/dist/utilities/logError.d.ts.map +1 -1
  672. package/dist/utilities/logger.d.ts +1 -1
  673. package/dist/utilities/logger.d.ts.map +1 -1
  674. package/dist/utilities/mergeHeaders.d.ts.map +1 -1
  675. package/dist/utilities/mergeListSearchAndWhere.d.ts.map +1 -1
  676. package/dist/utilities/mergeLocalizedData.d.ts +14 -4
  677. package/dist/utilities/mergeLocalizedData.d.ts.map +1 -1
  678. package/dist/utilities/mergeLocalizedData.js +54 -46
  679. package/dist/utilities/mergeLocalizedData.js.map +1 -1
  680. package/dist/utilities/mergeLocalizedData.spec.js +23 -23
  681. package/dist/utilities/mergeLocalizedData.spec.js.map +1 -1
  682. package/dist/utilities/miniChalk.d.ts.map +1 -1
  683. package/dist/utilities/optionsAreEqual.d.ts.map +1 -1
  684. package/dist/utilities/parseBooleanString.d.ts.map +1 -1
  685. package/dist/utilities/parseCookies.d.ts +1 -1
  686. package/dist/utilities/parseCookies.d.ts.map +1 -1
  687. package/dist/utilities/parseParams/index.d.ts +2 -5
  688. package/dist/utilities/parseParams/index.d.ts.map +1 -1
  689. package/dist/utilities/parseParams/index.js.map +1 -1
  690. package/dist/utilities/parseParams/index.spec.js +0 -9
  691. package/dist/utilities/parseParams/index.spec.js.map +1 -1
  692. package/dist/utilities/profiling.d.ts.map +1 -1
  693. package/dist/utilities/reduceFieldsToValues.d.ts.map +1 -1
  694. package/dist/utilities/resolveSelect.d.ts.map +1 -1
  695. package/dist/utilities/routeError.d.ts.map +1 -1
  696. package/dist/utilities/sanitizeFallbackLocale.d.ts.map +1 -1
  697. package/dist/utilities/sanitizeInternalFields.d.ts.map +1 -1
  698. package/dist/utilities/sanitizeJoinParams.d.ts.map +1 -1
  699. package/dist/utilities/sanitizePopulateParam.d.ts.map +1 -1
  700. package/dist/utilities/sanitizeSelect.d.ts.map +1 -1
  701. package/dist/utilities/sanitizeSelectParam.d.ts.map +1 -1
  702. package/dist/utilities/sanitizeSortParams.d.ts.map +1 -1
  703. package/dist/utilities/setsAreEqual.d.ts.map +1 -1
  704. package/dist/utilities/slugify.d.ts.map +1 -1
  705. package/dist/utilities/stripUnselectedFields.d.ts.map +1 -1
  706. package/dist/utilities/telemetry/conf/index.d.ts.map +1 -1
  707. package/dist/utilities/telemetry/events/adminInit.d.ts.map +1 -1
  708. package/dist/utilities/telemetry/events/adminInit.js +2 -3
  709. package/dist/utilities/telemetry/events/adminInit.js.map +1 -1
  710. package/dist/utilities/telemetry/events/serverInit.d.ts.map +1 -1
  711. package/dist/utilities/telemetry/events/serverInit.js +2 -3
  712. package/dist/utilities/telemetry/events/serverInit.js.map +1 -1
  713. package/dist/utilities/telemetry/index.d.ts +15 -4
  714. package/dist/utilities/telemetry/index.d.ts.map +1 -1
  715. package/dist/utilities/telemetry/index.js +6 -1
  716. package/dist/utilities/telemetry/index.js.map +1 -1
  717. package/dist/utilities/telemetry/index.spec.js +43 -0
  718. package/dist/utilities/telemetry/index.spec.js.map +1 -0
  719. package/dist/utilities/telemetry/oneWayHash.d.ts.map +1 -1
  720. package/dist/utilities/timestamp.d.ts.map +1 -1
  721. package/dist/utilities/toKebabCase.d.ts.map +1 -1
  722. package/dist/utilities/transformColumnPreferences.d.ts.map +1 -1
  723. package/dist/utilities/transformColumnPreferences.js +4 -2
  724. package/dist/utilities/transformColumnPreferences.js.map +1 -1
  725. package/dist/utilities/transformWhereQuery.d.ts.map +1 -1
  726. package/dist/utilities/traverseFields.d.ts.map +1 -1
  727. package/dist/utilities/traverseFields.js +2 -4
  728. package/dist/utilities/traverseFields.js.map +1 -1
  729. package/dist/utilities/traverseForLocalizedFields.d.ts.map +1 -1
  730. package/dist/utilities/traverseForLocalizedFields.js +3 -0
  731. package/dist/utilities/traverseForLocalizedFields.js.map +1 -1
  732. package/dist/utilities/unflatten.d.ts.map +1 -1
  733. package/dist/utilities/validateMimeType.d.ts.map +1 -1
  734. package/dist/utilities/validateTimezones.d.ts.map +1 -1
  735. package/dist/utilities/validateWhereQuery.d.ts.map +1 -1
  736. package/dist/utilities/wordBoundariesRegex.d.ts.map +1 -1
  737. package/dist/utilities/wrapInternalEndpoints.d.ts.map +1 -1
  738. package/dist/versions/baseFields.d.ts +1 -2
  739. package/dist/versions/baseFields.d.ts.map +1 -1
  740. package/dist/versions/baseFields.js +0 -13
  741. package/dist/versions/baseFields.js.map +1 -1
  742. package/dist/versions/buildCollectionFields.d.ts.map +1 -1
  743. package/dist/versions/buildCollectionFields.js +0 -2
  744. package/dist/versions/buildCollectionFields.js.map +1 -1
  745. package/dist/versions/buildGlobalFields.d.ts.map +1 -1
  746. package/dist/versions/buildGlobalFields.js +0 -2
  747. package/dist/versions/buildGlobalFields.js.map +1 -1
  748. package/dist/versions/buildSingleLocalePublishData.d.ts +32 -0
  749. package/dist/versions/buildSingleLocalePublishData.d.ts.map +1 -0
  750. package/dist/versions/buildSingleLocalePublishData.js +37 -0
  751. package/dist/versions/buildSingleLocalePublishData.js.map +1 -0
  752. package/dist/versions/buildVersionCompoundIndexes.d.ts.map +1 -1
  753. package/dist/versions/defaults.d.ts.map +1 -1
  754. package/dist/versions/deleteCollectionVersions.d.ts.map +1 -1
  755. package/dist/versions/deleteScheduledPublishJobs.d.ts.map +1 -1
  756. package/dist/versions/drafts/appendVersionToQueryKey.d.ts.map +1 -1
  757. package/dist/versions/drafts/getQueryDraftsSelect.d.ts.map +1 -1
  758. package/dist/versions/drafts/getQueryDraftsSort.d.ts.map +1 -1
  759. package/dist/versions/drafts/replaceWithDraftIfAvailable.d.ts.map +1 -1
  760. package/dist/versions/enforceMaxVersions.d.ts.map +1 -1
  761. package/dist/versions/getLatestCollectionVersion.d.ts.map +1 -1
  762. package/dist/versions/getLatestGlobalVersion.d.ts.map +1 -1
  763. package/dist/versions/migrations/localizeStatus/shared.d.ts.map +1 -1
  764. package/dist/versions/saveVersion.d.ts +0 -2
  765. package/dist/versions/saveVersion.d.ts.map +1 -1
  766. package/dist/versions/saveVersion.js +12 -17
  767. package/dist/versions/saveVersion.js.map +1 -1
  768. package/dist/versions/schedule/job.d.ts.map +1 -1
  769. package/dist/versions/schedule/job.js +6 -10
  770. package/dist/versions/schedule/job.js.map +1 -1
  771. package/dist/versions/types.d.ts +2 -15
  772. package/dist/versions/types.d.ts.map +1 -1
  773. package/dist/versions/types.js.map +1 -1
  774. package/package.json +9 -6
  775. package/dist/database/migrations/templates/localizeStatus.d.ts +0 -10
  776. package/dist/database/migrations/templates/localizeStatus.d.ts.map +0 -1
  777. package/dist/database/migrations/templates/localizeStatus.js +0 -54
  778. package/dist/database/migrations/templates/localizeStatus.js.map +0 -1
  779. package/dist/fields/baseFields/slug/index.d.ts +0 -89
  780. package/dist/fields/baseFields/slug/index.d.ts.map +0 -1
  781. package/dist/fields/baseFields/slug/index.js +0 -81
  782. package/dist/fields/baseFields/slug/index.js.map +0 -1
  783. package/dist/versions/migrations/localizeStatus/index.d.ts +0 -12
  784. package/dist/versions/migrations/localizeStatus/index.d.ts.map +0 -1
  785. package/dist/versions/migrations/localizeStatus/index.js +0 -33
  786. package/dist/versions/migrations/localizeStatus/index.js.map +0 -1
  787. package/dist/versions/migrations/localizeStatus/mongo/down.d.ts +0 -9
  788. package/dist/versions/migrations/localizeStatus/mongo/down.d.ts.map +0 -1
  789. package/dist/versions/migrations/localizeStatus/mongo/down.js +0 -112
  790. package/dist/versions/migrations/localizeStatus/mongo/down.js.map +0 -1
  791. package/dist/versions/migrations/localizeStatus/mongo/index.d.ts +0 -8
  792. package/dist/versions/migrations/localizeStatus/mongo/index.d.ts.map +0 -1
  793. package/dist/versions/migrations/localizeStatus/mongo/index.js +0 -8
  794. package/dist/versions/migrations/localizeStatus/mongo/index.js.map +0 -1
  795. package/dist/versions/migrations/localizeStatus/mongo/up.d.ts +0 -9
  796. package/dist/versions/migrations/localizeStatus/mongo/up.d.ts.map +0 -1
  797. package/dist/versions/migrations/localizeStatus/mongo/up.js +0 -220
  798. package/dist/versions/migrations/localizeStatus/mongo/up.js.map +0 -1
  799. package/dist/versions/migrations/localizeStatus/sql/down.d.ts +0 -11
  800. package/dist/versions/migrations/localizeStatus/sql/down.d.ts.map +0 -1
  801. package/dist/versions/migrations/localizeStatus/sql/down.js +0 -213
  802. package/dist/versions/migrations/localizeStatus/sql/down.js.map +0 -1
  803. package/dist/versions/migrations/localizeStatus/sql/index.d.ts +0 -8
  804. package/dist/versions/migrations/localizeStatus/sql/index.d.ts.map +0 -1
  805. package/dist/versions/migrations/localizeStatus/sql/index.js +0 -8
  806. package/dist/versions/migrations/localizeStatus/sql/index.js.map +0 -1
  807. package/dist/versions/migrations/localizeStatus/sql/migrateMainCollection.d.ts +0 -13
  808. package/dist/versions/migrations/localizeStatus/sql/migrateMainCollection.d.ts.map +0 -1
  809. package/dist/versions/migrations/localizeStatus/sql/migrateMainCollection.js +0 -51
  810. package/dist/versions/migrations/localizeStatus/sql/migrateMainCollection.js.map +0 -1
  811. package/dist/versions/migrations/localizeStatus/sql/migrateMainGlobal.d.ts +0 -13
  812. package/dist/versions/migrations/localizeStatus/sql/migrateMainGlobal.d.ts.map +0 -1
  813. package/dist/versions/migrations/localizeStatus/sql/migrateMainGlobal.js +0 -54
  814. package/dist/versions/migrations/localizeStatus/sql/migrateMainGlobal.js.map +0 -1
  815. package/dist/versions/migrations/localizeStatus/sql/up.d.ts +0 -11
  816. package/dist/versions/migrations/localizeStatus/sql/up.d.ts.map +0 -1
  817. package/dist/versions/migrations/localizeStatus/sql/up.js +0 -277
  818. package/dist/versions/migrations/localizeStatus/sql/up.js.map +0 -1
  819. package/dist/versions/saveSnapshot.d.ts +0 -18
  820. package/dist/versions/saveSnapshot.d.ts.map +0 -1
  821. package/dist/versions/saveSnapshot.js +0 -38
  822. package/dist/versions/saveSnapshot.js.map +0 -1
@@ -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 {\n DraftFlagFromGlobalSlug,\n SelectFromGlobalSlug,\n} 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> =\n BaseFindOneOptions<TSlug, TSelect> & 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":"AAqBA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,gBAAgB,QAAgC,gBAAe;AA0ExE,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,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAEpG,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;IACX;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IAClB;;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 +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`,
@@ -43,15 +43,12 @@ type BaseOptions<TSlug extends GlobalSlug, TSelect extends SelectType> = {
43
43
  */
44
44
  populate?: PopulateType;
45
45
  /**
46
- * Publish the document / documents in all locales. Requires `versions.drafts.localizeStatus` to be enabled.
46
+ * Publish the document / documents in all locales. Only applies when localization is enabled
47
+ * and the global has localized fields.
47
48
  *
48
49
  * @default undefined
49
50
  */
50
51
  publishAllLocales?: boolean;
51
- /**
52
- * Publish the document / documents with a specific locale.
53
- */
54
- publishSpecificLocale?: TypedLocale;
55
52
  /**
56
53
  * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.
57
54
  * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.
@@ -67,13 +64,14 @@ type BaseOptions<TSlug extends GlobalSlug, TSelect extends SelectType> = {
67
64
  */
68
65
  slug: TSlug;
69
66
  /**
70
- * Unpublish the document / documents in all locales. Requires `versions.drafts.localizeStatus` to be enabled.
67
+ * Unpublish the document / documents in all locales. Only applies when localization is enabled
68
+ * and the global has localized fields.
71
69
  */
72
70
  unpublishAllLocales?: boolean;
73
71
  /**
74
72
  * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
75
73
  */
76
- user?: Document;
74
+ user?: null | User;
77
75
  } & Pick<FindOptions<string, SelectType>, 'select'>;
78
76
  export type Options<TSlug extends GlobalSlug, TSelect extends SelectType> = BaseOptions<TSlug, TSelect> & DraftFlagFromGlobalSlug<TSlug>;
79
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/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,UAAU,EACV,yBAAyB,EAC1B,MAAM,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EACV,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,uBAAuB,CAAA;AAG9B,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAA;AAI1B,KAAK,WAAW,CAAC,KAAK,SAAS,UAAU,EAAE,OAAO,SAAS,UAAU,IAAI;IACvE;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;IACxD;;OAEG;IACH,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;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B;;OAEG;IACH,qBAAqB,CAAC,EAAE,WAAW,CAAA;IACnC;;;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,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAE7B;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAA;CAChB,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,IACtE,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAA;AAE9D,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,CAsCpD"}
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/globals/operations/local/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,UAAU,EACV,yBAAyB,EAC1B,MAAM,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EACV,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,uBAAuB,CAAA;AAG9B,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,IAAI,EACV,MAAM,mBAAmB,CAAA;AAI1B,KAAK,WAAW,CAAC,KAAK,SAAS,UAAU,EAAE,OAAO,SAAS,UAAU,IAAI;IACvE;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;IACxD;;OAEG;IACH,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"}
@@ -3,7 +3,7 @@ import { deepCopyObjectSimple } from '../../../index.js';
3
3
  import { createLocalReq } from '../../../utilities/createLocalReq.js';
4
4
  import { updateOperation } from '../update.js';
5
5
  export async function updateGlobalLocal(payload, options) {
6
- const { slug: globalSlug, data, depth, draft, overrideAccess = true, overrideLock, populate, publishAllLocales, publishSpecificLocale, select, showHiddenFields, unpublishAllLocales } = options;
6
+ const { slug: globalSlug, data, depth, draft, overrideAccess = true, overrideLock, populate, publishAllLocales, select, showHiddenFields, unpublishAllLocales } = options;
7
7
  const globalConfig = payload.globals.config.find((config)=>config.slug === globalSlug);
8
8
  if (!globalConfig) {
9
9
  throw new APIError(`The global with slug ${String(globalSlug)} can't be found.`);
@@ -18,7 +18,6 @@ export async function updateGlobalLocal(payload, options) {
18
18
  overrideLock,
19
19
  populate,
20
20
  publishAllLocales,
21
- publishSpecificLocale: publishSpecificLocale,
22
21
  req: await createLocalReq(options, payload),
23
22
  select,
24
23
  showHiddenFields,
@@ -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. Requires `versions.drafts.localizeStatus` to be enabled.\n *\n * @default undefined\n */\n publishAllLocales?: boolean\n /**\n * Publish the document / documents with a specific locale.\n */\n publishSpecificLocale?: TypedLocale\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. Requires `versions.drafts.localizeStatus` to be enabled.\n */\n unpublishAllLocales?: boolean\n // TODO: Strongly type User as TypedUser (= User in v4.0)\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: Document\n} & Pick<FindOptions<string, SelectType>, 'select'>\n\nexport type Options<TSlug extends GlobalSlug, TSelect extends SelectType> =\n BaseOptions<TSlug, TSelect> & 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 publishSpecificLocale,\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 publishSpecificLocale: publishSpecificLocale!,\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","publishSpecificLocale","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;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,qBAAqB,EACrBC,MAAM,EACNC,gBAAgB,EAChBC,mBAAmB,EACpB,GAAGb;IAEJ,MAAMc,eAAef,QAAQgB,OAAO,CAACC,MAAM,CAACC,IAAI,CAAC,CAACD,SAAWA,OAAOf,IAAI,KAAKC;IAE7E,IAAI,CAACY,cAAc;QACjB,MAAM,IAAIpB,SAAS,CAAC,qBAAqB,EAAEwB,OAAOhB,YAAY,gBAAgB,CAAC;IACjF;IAEA,OAAOL,gBAAgC;QACrCI,MAAMC;QACNC,MAAMR,qBAAqBQ;QAC3BC;QACAC;QACAS;QACAR;QACAC;QACAC;QACAC;QACAC,uBAAuBA;QACvBS,KAAK,MAAMvB,eAAeI,SAAkCD;QAC5DY;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"}
@@ -14,7 +14,6 @@ type Args<TSlug extends GlobalSlug> = {
14
14
  overrideLock?: boolean;
15
15
  populate?: PopulateType;
16
16
  publishAllLocales?: boolean;
17
- publishSpecificLocale?: string;
18
17
  req: PayloadRequest;
19
18
  showHiddenFields?: boolean;
20
19
  slug: string;
@@ -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,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,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,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,EAE3C,MAAM,IAAI,CAAC,KAAK,CAAC,KAChB,OAAO,CAAC,yBAAyB,CAAC,KAAK,EAAE,OAAO,CAAC,CAibnD,CAAA"}
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,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,CAubnD,CAAA"}
@@ -10,16 +10,13 @@ import { getSelectMode } from '../../utilities/getSelectMode.js';
10
10
  import { hasDraftsEnabled, hasDraftValidationEnabled, hasLocalizeStatusEnabled } from '../../utilities/getVersionsConfig.js';
11
11
  import { initTransaction } from '../../utilities/initTransaction.js';
12
12
  import { killTransaction } from '../../utilities/killTransaction.js';
13
- import { mergeLocalizedData } from '../../utilities/mergeLocalizedData.js';
14
13
  import { resolveSelect } from '../../utilities/resolveSelect.js';
15
14
  import { sanitizeSelect } from '../../utilities/sanitizeSelect.js';
15
+ import { buildLocalizedPublishData } from '../../versions/buildSingleLocalePublishData.js';
16
16
  import { getLatestGlobalVersion } from '../../versions/getLatestGlobalVersion.js';
17
17
  import { saveVersion } from '../../versions/saveVersion.js';
18
18
  export const updateOperation = async (args)=>{
19
- if (args.publishSpecificLocale) {
20
- args.req.locale = args.publishSpecificLocale;
21
- }
22
- const { slug, autosave, depth, disableTransaction, draft: draftArg, globalConfig, overrideAccess, overrideLock, populate, publishAllLocales: publishAllLocalesArg, publishSpecificLocale, req: { fallbackLocale, locale, payload, payload: { config } = {} }, req, select: incomingSelect, showHiddenFields, unpublishAllLocales: unpublishAllLocalesArg } = args;
19
+ const { slug, autosave, depth, disableTransaction, draft: draftArg, globalConfig, overrideAccess, overrideLock, populate, publishAllLocales: publishAllLocalesArg, req: { fallbackLocale, locale, payload, payload: { config } = {} }, req, select: incomingSelect, showHiddenFields, unpublishAllLocales: unpublishAllLocalesArg } = args;
23
20
  try {
24
21
  const shouldCommit = !disableTransaction && await initTransaction(req);
25
22
  // /////////////////////////////////////
@@ -38,7 +35,7 @@ export const updateOperation = async (args)=>{
38
35
  }
39
36
  }
40
37
  let { data } = args;
41
- const publishAllLocales = !draftArg && (publishAllLocalesArg ?? (hasLocalizeStatusEnabled(globalConfig) ? false : true));
38
+ const publishAllLocales = !draftArg && (publishAllLocalesArg ?? (hasLocalizeStatusEnabled(globalConfig) && locale !== 'all' ? false : true));
42
39
  const unpublishAllLocales = typeof unpublishAllLocalesArg === 'string' ? unpublishAllLocalesArg === 'true' : !!unpublishAllLocalesArg;
43
40
  const isSavingDraft = Boolean(draftArg && hasDraftsEnabled(globalConfig)) && data._status !== 'published' && !publishAllLocales;
44
41
  if (isSavingDraft) {
@@ -61,7 +58,7 @@ export const updateOperation = async (args)=>{
61
58
  const globalVersionResult = await getLatestGlobalVersion({
62
59
  slug,
63
60
  config: globalConfig,
64
- locale: locale,
61
+ locale: publishAllLocales || unpublishAllLocales ? 'all' : locale,
65
62
  payload,
66
63
  req,
67
64
  where: query
@@ -155,14 +152,20 @@ export const updateOperation = async (args)=>{
155
152
  unpublishAllLocales
156
153
  };
157
154
  let result = await beforeChange(beforeChangeArgs);
158
- let snapshotToSave;
155
+ if (config?.localization && hasLocalizeStatusEnabled(globalConfig) && typeof result._status === 'string') {
156
+ const statusStr = result._status;
157
+ result._status = {};
158
+ for (const localeCode of config.localization.localeCodes){
159
+ ;
160
+ result._status[localeCode] = statusStr;
161
+ }
162
+ }
159
163
  // /////////////////////////////////////
160
164
  // Handle Localized Data Merging
161
165
  // /////////////////////////////////////
166
+ let localizedPublishData = null;
162
167
  if (config && config.localization && globalConfig.versions) {
163
- let currentGlobal = null;
164
- let snapshotData;
165
- if (globalConfig.versions.drafts && globalConfig.versions.drafts.localizeStatus) {
168
+ if (hasLocalizeStatusEnabled(globalConfig)) {
166
169
  if (publishAllLocales || unpublishAllLocales) {
167
170
  let accessibleLocaleCodes = config.localization.localeCodes;
168
171
  if (config.localization.filterAvailableLocales) {
@@ -178,43 +181,26 @@ export const updateOperation = async (args)=>{
178
181
  for (const localeCode of accessibleLocaleCodes){
179
182
  result._status[localeCode] = unpublishAllLocales ? 'draft' : 'published';
180
183
  }
181
- } else if (!isSavingDraft) {
182
- // publishing a single locale
183
- currentGlobal = await payload.db.findGlobal({
184
+ } else if (!isSavingDraft && result._status && typeof result._status === 'object' && !Array.isArray(result._status) && result._status[locale] === 'published') {
185
+ const currentGlobal = await payload.db.findGlobal({
184
186
  slug: globalConfig.slug,
187
+ locale: 'all',
185
188
  req,
186
189
  where: query
187
190
  });
188
- snapshotData = result;
191
+ localizedPublishData = buildLocalizedPublishData({
192
+ config,
193
+ currentDoc: currentGlobal,
194
+ fields: globalConfig.fields,
195
+ locale: locale,
196
+ result
197
+ });
189
198
  }
190
- } else if (publishSpecificLocale) {
191
- // previous way of publishing a single locale
192
- currentGlobal = (await getLatestGlobalVersion({
193
- slug,
194
- config: globalConfig,
195
- payload,
196
- published: true,
197
- req,
198
- where: query
199
- })).global;
200
- snapshotData = {
201
- ...result,
202
- _status: 'draft'
203
- };
204
- }
205
- if (snapshotData) {
206
- snapshotToSave = deepCopyObjectSimple(snapshotData);
207
- result = mergeLocalizedData({
208
- configBlockReferences: config.blocks,
209
- dataWithLocales: result || {},
210
- docWithLocales: currentGlobal || {},
211
- fields: globalConfig.fields,
212
- selectedLocales: [
213
- locale
214
- ]
215
- });
216
199
  }
217
200
  }
201
+ const dataToUpdate = {
202
+ ...localizedPublishData ?? result
203
+ };
218
204
  // /////////////////////////////////////
219
205
  // Update
220
206
  // /////////////////////////////////////
@@ -227,59 +213,67 @@ export const updateOperation = async (args)=>{
227
213
  select: incomingSelect
228
214
  })
229
215
  });
216
+ let resultWithLocales = result;
230
217
  if (!isSavingDraft) {
231
218
  const now = new Date().toISOString();
232
219
  // Ensure global has createdAt
233
- if (!result.createdAt) {
234
- result.createdAt = now;
220
+ if (!dataToUpdate.createdAt) {
221
+ dataToUpdate.createdAt = now;
235
222
  }
236
223
  // Ensure updatedAt date is always updated
237
- result.updatedAt = now;
224
+ dataToUpdate.updatedAt = now;
238
225
  if (globalExists) {
239
- result = await payload.db.updateGlobal({
226
+ resultWithLocales = await payload.db.updateGlobal({
240
227
  slug,
241
- data: result,
228
+ data: dataToUpdate,
242
229
  req,
243
230
  select
244
231
  });
245
232
  } else {
246
- result = await payload.db.createGlobal({
233
+ resultWithLocales = await payload.db.createGlobal({
247
234
  slug,
248
- data: result,
235
+ data: dataToUpdate,
249
236
  req
250
237
  });
251
238
  }
239
+ resultWithLocales.updatedAt = now;
240
+ if (localizedPublishData) {
241
+ // Keep full locale payload for version writes during single-locale publish.
242
+ resultWithLocales = {
243
+ ...result,
244
+ createdAt: resultWithLocales.createdAt ?? result.createdAt ?? now,
245
+ updatedAt: now
246
+ };
247
+ }
252
248
  }
253
249
  // /////////////////////////////////////
254
250
  // Create version
255
251
  // /////////////////////////////////////
256
252
  if (globalConfig.versions) {
257
- const { globalType } = result;
258
- result = await saveVersion({
253
+ const { globalType } = resultWithLocales;
254
+ resultWithLocales = await saveVersion({
259
255
  autosave,
260
- docWithLocales: result,
256
+ docWithLocales: resultWithLocales,
261
257
  draft: isSavingDraft,
262
258
  global: globalConfig,
263
259
  operation: 'update',
264
260
  payload,
265
- publishSpecificLocale,
266
261
  req,
267
262
  select,
268
- snapshot: snapshotToSave,
269
263
  unpublish: unpublishAllLocales
270
264
  });
271
- result = {
272
- ...result,
265
+ resultWithLocales = {
266
+ ...resultWithLocales,
273
267
  globalType
274
268
  };
275
269
  }
276
270
  // /////////////////////////////////////
277
271
  // Execute globalType field if not selected
278
272
  // /////////////////////////////////////
279
- if (select && result.globalType) {
273
+ if (select && resultWithLocales.globalType) {
280
274
  const selectMode = getSelectMode(select);
281
275
  if (selectMode === 'include' && !select['globalType'] || selectMode === 'exclude' && select['globalType'] === false) {
282
- delete result['globalType'];
276
+ delete resultWithLocales['globalType'];
283
277
  }
284
278
  }
285
279
  // /////////////////////////////////////
@@ -289,7 +283,7 @@ export const updateOperation = async (args)=>{
289
283
  collection: null,
290
284
  context: req.context,
291
285
  depth: depth,
292
- doc: result,
286
+ doc: resultWithLocales,
293
287
  draft: draftArg,
294
288
  fallbackLocale: null,
295
289
  global: globalConfig,