payload 3.84.1 → 4.0.0-internal.d28e9fb

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 (400) hide show
  1. package/README.md +5 -5
  2. package/dist/admin/elements/Nav.d.ts +13 -0
  3. package/dist/admin/elements/Nav.d.ts.map +1 -1
  4. package/dist/admin/elements/Nav.js.map +1 -1
  5. package/dist/admin/functions/index.d.ts +1 -38
  6. package/dist/admin/functions/index.d.ts.map +1 -1
  7. package/dist/admin/functions/index.js.map +1 -1
  8. package/dist/admin/types.d.ts +5 -4
  9. package/dist/admin/types.d.ts.map +1 -1
  10. package/dist/admin/types.js.map +1 -1
  11. package/dist/admin/views/hierarchyList.d.ts +9 -0
  12. package/dist/admin/views/hierarchyList.d.ts.map +1 -0
  13. package/dist/admin/views/hierarchyList.js +3 -0
  14. package/dist/admin/views/hierarchyList.js.map +1 -0
  15. package/dist/admin/views/index.d.ts +1 -3
  16. package/dist/admin/views/index.d.ts.map +1 -1
  17. package/dist/admin/views/index.js.map +1 -1
  18. package/dist/admin/views/list.d.ts +43 -2
  19. package/dist/admin/views/list.d.ts.map +1 -1
  20. package/dist/admin/views/list.js.map +1 -1
  21. package/dist/bin/generateImportMap/iterateCollections.d.ts.map +1 -1
  22. package/dist/bin/generateImportMap/iterateCollections.js +1 -0
  23. package/dist/bin/generateImportMap/iterateCollections.js.map +1 -1
  24. package/dist/bin/generateImportMap/iterateConfig.d.ts.map +1 -1
  25. package/dist/bin/generateImportMap/iterateConfig.js +7 -0
  26. package/dist/bin/generateImportMap/iterateConfig.js.map +1 -1
  27. package/dist/bin/generateImportMap/iterateGlobals.d.ts.map +1 -1
  28. package/dist/bin/generateImportMap/iterateGlobals.js +20 -8
  29. package/dist/bin/generateImportMap/iterateGlobals.js.map +1 -1
  30. package/dist/bin/index.d.ts.map +1 -1
  31. package/dist/bin/index.js +1 -3
  32. package/dist/bin/index.js.map +1 -1
  33. package/dist/collections/config/client.d.ts +4 -2
  34. package/dist/collections/config/client.d.ts.map +1 -1
  35. package/dist/collections/config/client.js +13 -1
  36. package/dist/collections/config/client.js.map +1 -1
  37. package/dist/collections/config/defaults.js +1 -1
  38. package/dist/collections/config/defaults.js.map +1 -1
  39. package/dist/collections/config/sanitize.d.ts.map +1 -1
  40. package/dist/collections/config/sanitize.js +231 -184
  41. package/dist/collections/config/sanitize.js.map +1 -1
  42. package/dist/collections/config/types.d.ts +76 -91
  43. package/dist/collections/config/types.d.ts.map +1 -1
  44. package/dist/collections/config/types.js.map +1 -1
  45. package/dist/collections/operations/create.d.ts.map +1 -1
  46. package/dist/collections/operations/create.js +24 -19
  47. package/dist/collections/operations/create.js.map +1 -1
  48. package/dist/collections/operations/delete.d.ts.map +1 -1
  49. package/dist/collections/operations/delete.js +7 -2
  50. package/dist/collections/operations/delete.js.map +1 -1
  51. package/dist/collections/operations/deleteByID.d.ts.map +1 -1
  52. package/dist/collections/operations/deleteByID.js +7 -2
  53. package/dist/collections/operations/deleteByID.js.map +1 -1
  54. package/dist/collections/operations/find.d.ts.map +1 -1
  55. package/dist/collections/operations/find.js +7 -2
  56. package/dist/collections/operations/find.js.map +1 -1
  57. package/dist/collections/operations/findByID.d.ts.map +1 -1
  58. package/dist/collections/operations/findByID.js +10 -5
  59. package/dist/collections/operations/findByID.js.map +1 -1
  60. package/dist/collections/operations/findVersionByID.d.ts.map +1 -1
  61. package/dist/collections/operations/findVersionByID.js +6 -4
  62. package/dist/collections/operations/findVersionByID.js.map +1 -1
  63. package/dist/collections/operations/findVersions.d.ts.map +1 -1
  64. package/dist/collections/operations/findVersions.js +6 -4
  65. package/dist/collections/operations/findVersions.js.map +1 -1
  66. package/dist/collections/operations/restoreVersion.d.ts.map +1 -1
  67. package/dist/collections/operations/restoreVersion.js +7 -2
  68. package/dist/collections/operations/restoreVersion.js.map +1 -1
  69. package/dist/collections/operations/update.d.ts.map +1 -1
  70. package/dist/collections/operations/update.js +7 -2
  71. package/dist/collections/operations/update.js.map +1 -1
  72. package/dist/collections/operations/updateByID.d.ts.map +1 -1
  73. package/dist/collections/operations/updateByID.js +7 -2
  74. package/dist/collections/operations/updateByID.js.map +1 -1
  75. package/dist/collections/operations/utilities/update.d.ts.map +1 -1
  76. package/dist/collections/operations/utilities/update.js +5 -4
  77. package/dist/collections/operations/utilities/update.js.map +1 -1
  78. package/dist/config/client.d.ts.map +1 -1
  79. package/dist/config/client.js +0 -10
  80. package/dist/config/client.js.map +1 -1
  81. package/dist/config/defaults.d.ts.map +1 -1
  82. package/dist/config/defaults.js +0 -15
  83. package/dist/config/defaults.js.map +1 -1
  84. package/dist/config/orderable/index.d.ts.map +1 -1
  85. package/dist/config/orderable/index.js +0 -4
  86. package/dist/config/orderable/index.js.map +1 -1
  87. package/dist/config/sanitize.d.ts.map +1 -1
  88. package/dist/config/sanitize.js +252 -266
  89. package/dist/config/sanitize.js.map +1 -1
  90. package/dist/config/types.d.ts +120 -13
  91. package/dist/config/types.d.ts.map +1 -1
  92. package/dist/config/types.js.map +1 -1
  93. package/dist/exports/internal.d.ts +1 -0
  94. package/dist/exports/internal.d.ts.map +1 -1
  95. package/dist/exports/internal.js +1 -0
  96. package/dist/exports/internal.js.map +1 -1
  97. package/dist/exports/shared.d.ts +5 -3
  98. package/dist/exports/shared.d.ts.map +1 -1
  99. package/dist/exports/shared.js +3 -2
  100. package/dist/exports/shared.js.map +1 -1
  101. package/dist/fields/baseFields/slug/index.d.ts.map +1 -1
  102. package/dist/fields/baseFields/slug/index.js +6 -4
  103. package/dist/fields/baseFields/slug/index.js.map +1 -1
  104. package/dist/fields/config/client.d.ts.map +1 -1
  105. package/dist/fields/config/client.js +3 -2
  106. package/dist/fields/config/client.js.map +1 -1
  107. package/dist/fields/config/sanitize.d.ts.map +1 -1
  108. package/dist/fields/config/sanitize.js +335 -322
  109. package/dist/fields/config/sanitize.js.map +1 -1
  110. package/dist/fields/config/sanitizeJoinField.d.ts.map +1 -1
  111. package/dist/fields/config/sanitizeJoinField.js +3 -0
  112. package/dist/fields/config/sanitizeJoinField.js.map +1 -1
  113. package/dist/fields/config/types.d.ts +17 -73
  114. package/dist/fields/config/types.d.ts.map +1 -1
  115. package/dist/fields/config/types.js +11 -1
  116. package/dist/fields/config/types.js.map +1 -1
  117. package/dist/fields/isFieldDisabled.d.ts +12 -0
  118. package/dist/fields/isFieldDisabled.d.ts.map +1 -0
  119. package/dist/fields/isFieldDisabled.js +15 -0
  120. package/dist/fields/isFieldDisabled.js.map +1 -0
  121. package/dist/fields/isFieldDisabled.spec.js +134 -0
  122. package/dist/fields/isFieldDisabled.spec.js.map +1 -0
  123. package/dist/fields/validations.js +1 -1
  124. package/dist/fields/validations.js.map +1 -1
  125. package/dist/globals/config/client.d.ts +1 -1
  126. package/dist/globals/config/client.d.ts.map +1 -1
  127. package/dist/globals/config/client.js +2 -1
  128. package/dist/globals/config/client.js.map +1 -1
  129. package/dist/globals/config/sanitize.d.ts.map +1 -1
  130. package/dist/globals/config/sanitize.js +132 -122
  131. package/dist/globals/config/sanitize.js.map +1 -1
  132. package/dist/globals/config/types.d.ts +4 -57
  133. package/dist/globals/config/types.d.ts.map +1 -1
  134. package/dist/globals/config/types.js.map +1 -1
  135. package/dist/globals/operations/findOne.d.ts.map +1 -1
  136. package/dist/globals/operations/findOne.js +7 -2
  137. package/dist/globals/operations/findOne.js.map +1 -1
  138. package/dist/globals/operations/findVersionByID.d.ts.map +1 -1
  139. package/dist/globals/operations/findVersionByID.js +6 -4
  140. package/dist/globals/operations/findVersionByID.js.map +1 -1
  141. package/dist/globals/operations/findVersions.d.ts.map +1 -1
  142. package/dist/globals/operations/findVersions.js +6 -4
  143. package/dist/globals/operations/findVersions.js.map +1 -1
  144. package/dist/globals/operations/update.d.ts.map +1 -1
  145. package/dist/globals/operations/update.js +7 -2
  146. package/dist/globals/operations/update.js.map +1 -1
  147. package/dist/hierarchy/addHierarchyToCollection.d.ts +9 -0
  148. package/dist/hierarchy/addHierarchyToCollection.d.ts.map +1 -0
  149. package/dist/hierarchy/addHierarchyToCollection.js +76 -0
  150. package/dist/hierarchy/addHierarchyToCollection.js.map +1 -0
  151. package/dist/hierarchy/buildParentField.d.ts +11 -0
  152. package/dist/hierarchy/buildParentField.d.ts.map +1 -0
  153. package/dist/hierarchy/buildParentField.js +42 -0
  154. package/dist/hierarchy/buildParentField.js.map +1 -0
  155. package/dist/hierarchy/constants.d.ts +15 -0
  156. package/dist/hierarchy/constants.d.ts.map +1 -0
  157. package/dist/hierarchy/constants.js +11 -0
  158. package/dist/hierarchy/constants.js.map +1 -0
  159. package/dist/hierarchy/createFolderField.d.ts +39 -0
  160. package/dist/hierarchy/createFolderField.d.ts.map +1 -0
  161. package/dist/hierarchy/createFolderField.js +54 -0
  162. package/dist/hierarchy/createFolderField.js.map +1 -0
  163. package/dist/hierarchy/createTagField.d.ts +44 -0
  164. package/dist/hierarchy/createTagField.d.ts.map +1 -0
  165. package/dist/hierarchy/createTagField.js +48 -0
  166. package/dist/hierarchy/createTagField.js.map +1 -0
  167. package/dist/hierarchy/getInitialTreeData.d.ts +27 -0
  168. package/dist/hierarchy/getInitialTreeData.d.ts.map +1 -0
  169. package/dist/hierarchy/getInitialTreeData.js +125 -0
  170. package/dist/hierarchy/getInitialTreeData.js.map +1 -0
  171. package/dist/hierarchy/hooks/collectionAfterDelete.d.ts +14 -0
  172. package/dist/hierarchy/hooks/collectionAfterDelete.d.ts.map +1 -0
  173. package/dist/hierarchy/hooks/collectionAfterDelete.js +21 -0
  174. package/dist/hierarchy/hooks/collectionAfterDelete.js.map +1 -0
  175. package/dist/hierarchy/hooks/collectionAfterRead.d.ts +27 -0
  176. package/dist/hierarchy/hooks/collectionAfterRead.d.ts.map +1 -0
  177. package/dist/hierarchy/hooks/collectionAfterRead.js +72 -0
  178. package/dist/hierarchy/hooks/collectionAfterRead.js.map +1 -0
  179. package/dist/hierarchy/hooks/collectionBeforeChange.d.ts +19 -0
  180. package/dist/hierarchy/hooks/collectionBeforeChange.d.ts.map +1 -0
  181. package/dist/hierarchy/hooks/collectionBeforeChange.js +90 -0
  182. package/dist/hierarchy/hooks/collectionBeforeChange.js.map +1 -0
  183. package/dist/hierarchy/hooks/collectionBeforeDelete.d.ts +15 -0
  184. package/dist/hierarchy/hooks/collectionBeforeDelete.d.ts.map +1 -0
  185. package/dist/hierarchy/hooks/collectionBeforeDelete.js +20 -0
  186. package/dist/hierarchy/hooks/collectionBeforeDelete.js.map +1 -0
  187. package/dist/hierarchy/hooks/collectionBeforeOperation.d.ts +33 -0
  188. package/dist/hierarchy/hooks/collectionBeforeOperation.d.ts.map +1 -0
  189. package/dist/hierarchy/hooks/collectionBeforeOperation.js +66 -0
  190. package/dist/hierarchy/hooks/collectionBeforeOperation.js.map +1 -0
  191. package/dist/hierarchy/hooks/ensureSafeCollectionsChange.d.ts +8 -0
  192. package/dist/hierarchy/hooks/ensureSafeCollectionsChange.d.ts.map +1 -0
  193. package/dist/hierarchy/hooks/ensureSafeCollectionsChange.js +108 -0
  194. package/dist/hierarchy/hooks/ensureSafeCollectionsChange.js.map +1 -0
  195. package/dist/hierarchy/injectHierarchyButton.d.ts +14 -0
  196. package/dist/hierarchy/injectHierarchyButton.d.ts.map +1 -0
  197. package/dist/hierarchy/injectHierarchyButton.js +37 -0
  198. package/dist/hierarchy/injectHierarchyButton.js.map +1 -0
  199. package/dist/hierarchy/presets.d.ts +13 -0
  200. package/dist/hierarchy/presets.d.ts.map +1 -0
  201. package/dist/hierarchy/presets.js +52 -0
  202. package/dist/hierarchy/presets.js.map +1 -0
  203. package/dist/hierarchy/resolveHierarchyCollections.d.ts +23 -0
  204. package/dist/hierarchy/resolveHierarchyCollections.d.ts.map +1 -0
  205. package/dist/hierarchy/resolveHierarchyCollections.js +321 -0
  206. package/dist/hierarchy/resolveHierarchyCollections.js.map +1 -0
  207. package/dist/hierarchy/sanitizeHierarchyCollection.d.ts +14 -0
  208. package/dist/hierarchy/sanitizeHierarchyCollection.d.ts.map +1 -0
  209. package/dist/hierarchy/sanitizeHierarchyCollection.js +117 -0
  210. package/dist/hierarchy/sanitizeHierarchyCollection.js.map +1 -0
  211. package/dist/hierarchy/types.d.ts +155 -0
  212. package/dist/hierarchy/types.d.ts.map +1 -0
  213. package/dist/hierarchy/types.js +6 -0
  214. package/dist/hierarchy/types.js.map +1 -0
  215. package/dist/hierarchy/utils/buildLocalizedHierarchyPaths.d.ts +77 -0
  216. package/dist/hierarchy/utils/buildLocalizedHierarchyPaths.d.ts.map +1 -0
  217. package/dist/hierarchy/utils/buildLocalizedHierarchyPaths.js +77 -0
  218. package/dist/hierarchy/utils/buildLocalizedHierarchyPaths.js.map +1 -0
  219. package/dist/hierarchy/utils/computePaths.d.ts +31 -0
  220. package/dist/hierarchy/utils/computePaths.d.ts.map +1 -0
  221. package/dist/hierarchy/utils/computePaths.js +445 -0
  222. package/dist/hierarchy/utils/computePaths.js.map +1 -0
  223. package/dist/hierarchy/utils/findUseAsTitle.d.ts +14 -0
  224. package/dist/hierarchy/utils/findUseAsTitle.d.ts.map +1 -0
  225. package/dist/hierarchy/utils/findUseAsTitle.js +89 -0
  226. package/dist/hierarchy/utils/findUseAsTitle.js.map +1 -0
  227. package/dist/hierarchy/utils/getAncestors.d.ts +34 -0
  228. package/dist/hierarchy/utils/getAncestors.d.ts.map +1 -0
  229. package/dist/hierarchy/utils/getAncestors.js +94 -0
  230. package/dist/hierarchy/utils/getAncestors.js.map +1 -0
  231. package/dist/hierarchy/utils/getLocalizedValue.d.ts +30 -0
  232. package/dist/hierarchy/utils/getLocalizedValue.d.ts.map +1 -0
  233. package/dist/hierarchy/utils/getLocalizedValue.js +46 -0
  234. package/dist/hierarchy/utils/getLocalizedValue.js.map +1 -0
  235. package/dist/hierarchy/utils/getLocalizedValue.spec.js +250 -0
  236. package/dist/hierarchy/utils/getLocalizedValue.spec.js.map +1 -0
  237. package/dist/index.bundled.d.ts +709 -530
  238. package/dist/index.d.ts +28 -8
  239. package/dist/index.d.ts.map +1 -1
  240. package/dist/index.js +31 -8
  241. package/dist/index.js.map +1 -1
  242. package/dist/preferences/keys.d.ts +8 -4
  243. package/dist/preferences/keys.d.ts.map +1 -1
  244. package/dist/preferences/keys.js +7 -4
  245. package/dist/preferences/keys.js.map +1 -1
  246. package/dist/preferences/types.d.ts +1 -1
  247. package/dist/preferences/types.d.ts.map +1 -1
  248. package/dist/preferences/types.js.map +1 -1
  249. package/dist/query-presets/config.d.ts.map +1 -1
  250. package/dist/query-presets/config.js +5 -1
  251. package/dist/query-presets/config.js.map +1 -1
  252. package/dist/queues/config/types/index.d.ts +0 -21
  253. package/dist/queues/config/types/index.d.ts.map +1 -1
  254. package/dist/queues/config/types/index.js.map +1 -1
  255. package/dist/queues/config/types/taskTypes.d.ts +0 -20
  256. package/dist/queues/config/types/taskTypes.d.ts.map +1 -1
  257. package/dist/queues/config/types/taskTypes.js.map +1 -1
  258. package/dist/queues/errors/handleWorkflowError.d.ts.map +1 -1
  259. package/dist/queues/errors/handleWorkflowError.js +9 -1
  260. package/dist/queues/errors/handleWorkflowError.js.map +1 -1
  261. package/dist/queues/localAPI.d.ts.map +1 -1
  262. package/dist/queues/localAPI.js +26 -67
  263. package/dist/queues/localAPI.js.map +1 -1
  264. package/dist/queues/operations/handleSchedules/index.d.ts.map +1 -1
  265. package/dist/queues/operations/handleSchedules/index.js +1 -4
  266. package/dist/queues/operations/handleSchedules/index.js.map +1 -1
  267. package/dist/queues/operations/runJobs/index.d.ts.map +1 -1
  268. package/dist/queues/operations/runJobs/index.js +40 -37
  269. package/dist/queues/operations/runJobs/index.js.map +1 -1
  270. package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.d.ts.map +1 -1
  271. package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js +3 -22
  272. package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js.map +1 -1
  273. package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.d.ts.map +1 -1
  274. package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.js +0 -2
  275. package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.js.map +1 -1
  276. package/dist/queues/utilities/updateJob.d.ts +1 -3
  277. package/dist/queues/utilities/updateJob.d.ts.map +1 -1
  278. package/dist/queues/utilities/updateJob.js +2 -18
  279. package/dist/queues/utilities/updateJob.js.map +1 -1
  280. package/dist/types/index.d.ts +44 -0
  281. package/dist/types/index.d.ts.map +1 -1
  282. package/dist/types/index.js.map +1 -1
  283. package/dist/uploads/getBaseFields.d.ts.map +1 -1
  284. package/dist/uploads/getBaseFields.js +35 -69
  285. package/dist/uploads/getBaseFields.js.map +1 -1
  286. package/dist/uploads/getSafeFilename.d.ts +9 -4
  287. package/dist/uploads/getSafeFilename.d.ts.map +1 -1
  288. package/dist/uploads/getSafeFilename.js +5 -5
  289. package/dist/uploads/getSafeFilename.js.map +1 -1
  290. package/dist/utilities/appendDateTimezoneSelectFields.d.ts +13 -0
  291. package/dist/utilities/appendDateTimezoneSelectFields.d.ts.map +1 -0
  292. package/dist/utilities/appendDateTimezoneSelectFields.js +47 -0
  293. package/dist/utilities/appendDateTimezoneSelectFields.js.map +1 -0
  294. package/dist/utilities/appendUploadSelectFields.d.ts.map +1 -1
  295. package/dist/utilities/appendUploadSelectFields.js +3 -0
  296. package/dist/utilities/appendUploadSelectFields.js.map +1 -1
  297. package/dist/utilities/extractID.js +1 -1
  298. package/dist/utilities/extractID.js.map +1 -1
  299. package/dist/utilities/flattenAllFields.d.ts.map +1 -1
  300. package/dist/utilities/flattenAllFields.js +102 -93
  301. package/dist/utilities/flattenAllFields.js.map +1 -1
  302. package/dist/utilities/formatAdminURL.d.ts +13 -2
  303. package/dist/utilities/formatAdminURL.d.ts.map +1 -1
  304. package/dist/utilities/formatAdminURL.js.map +1 -1
  305. package/dist/utilities/handleEndpoints.d.ts.map +1 -1
  306. package/dist/utilities/handleEndpoints.js +0 -1
  307. package/dist/utilities/handleEndpoints.js.map +1 -1
  308. package/dist/utilities/resolveSelect.d.ts +16 -0
  309. package/dist/utilities/resolveSelect.d.ts.map +1 -0
  310. package/dist/utilities/resolveSelect.js +19 -0
  311. package/dist/utilities/resolveSelect.js.map +1 -0
  312. package/dist/utilities/sanitizeProfiler.d.ts +38 -0
  313. package/dist/utilities/sanitizeProfiler.d.ts.map +1 -0
  314. package/dist/utilities/sanitizeProfiler.js +101 -0
  315. package/dist/utilities/sanitizeProfiler.js.map +1 -0
  316. package/dist/utilities/sanitizeSelect.d.ts +1 -2
  317. package/dist/utilities/sanitizeSelect.d.ts.map +1 -1
  318. package/dist/utilities/sanitizeSelect.js +19 -25
  319. package/dist/utilities/sanitizeSelect.js.map +1 -1
  320. package/dist/versions/baseFields.d.ts.map +1 -1
  321. package/dist/versions/baseFields.js +3 -2
  322. package/dist/versions/baseFields.js.map +1 -1
  323. package/dist/versions/buildCollectionFields.d.ts.map +1 -1
  324. package/dist/versions/buildCollectionFields.js +0 -1
  325. package/dist/versions/buildCollectionFields.js.map +1 -1
  326. package/dist/versions/buildGlobalFields.d.ts.map +1 -1
  327. package/dist/versions/buildGlobalFields.js +0 -1
  328. package/dist/versions/buildGlobalFields.js.map +1 -1
  329. package/dist/versions/payloadPackageList.d.ts.map +1 -1
  330. package/dist/versions/payloadPackageList.js +0 -1
  331. package/dist/versions/payloadPackageList.js.map +1 -1
  332. package/package.json +4 -4
  333. package/dist/admin/views/folderList.d.ts +0 -56
  334. package/dist/admin/views/folderList.d.ts.map +0 -1
  335. package/dist/admin/views/folderList.js +0 -3
  336. package/dist/admin/views/folderList.js.map +0 -1
  337. package/dist/folders/addFolderCollection.d.ts +0 -10
  338. package/dist/folders/addFolderCollection.d.ts.map +0 -1
  339. package/dist/folders/addFolderCollection.js +0 -26
  340. package/dist/folders/addFolderCollection.js.map +0 -1
  341. package/dist/folders/addFolderFieldToCollection.d.ts +0 -8
  342. package/dist/folders/addFolderFieldToCollection.d.ts.map +0 -1
  343. package/dist/folders/addFolderFieldToCollection.js +0 -20
  344. package/dist/folders/addFolderFieldToCollection.js.map +0 -1
  345. package/dist/folders/buildFolderField.d.ts +0 -8
  346. package/dist/folders/buildFolderField.d.ts.map +0 -1
  347. package/dist/folders/buildFolderField.js +0 -87
  348. package/dist/folders/buildFolderField.js.map +0 -1
  349. package/dist/folders/constants.d.ts +0 -3
  350. package/dist/folders/constants.d.ts.map +0 -1
  351. package/dist/folders/constants.js +0 -4
  352. package/dist/folders/constants.js.map +0 -1
  353. package/dist/folders/createFolderCollection.d.ts +0 -11
  354. package/dist/folders/createFolderCollection.d.ts.map +0 -1
  355. package/dist/folders/createFolderCollection.js +0 -115
  356. package/dist/folders/createFolderCollection.js.map +0 -1
  357. package/dist/folders/hooks/deleteSubfoldersAfterDelete.d.ts +0 -8
  358. package/dist/folders/hooks/deleteSubfoldersAfterDelete.d.ts.map +0 -1
  359. package/dist/folders/hooks/deleteSubfoldersAfterDelete.js +0 -15
  360. package/dist/folders/hooks/deleteSubfoldersAfterDelete.js.map +0 -1
  361. package/dist/folders/hooks/dissasociateAfterDelete.d.ts +0 -8
  362. package/dist/folders/hooks/dissasociateAfterDelete.d.ts.map +0 -1
  363. package/dist/folders/hooks/dissasociateAfterDelete.js +0 -20
  364. package/dist/folders/hooks/dissasociateAfterDelete.js.map +0 -1
  365. package/dist/folders/hooks/ensureSafeCollectionsChange.d.ts +0 -5
  366. package/dist/folders/hooks/ensureSafeCollectionsChange.d.ts.map +0 -1
  367. package/dist/folders/hooks/ensureSafeCollectionsChange.js +0 -107
  368. package/dist/folders/hooks/ensureSafeCollectionsChange.js.map +0 -1
  369. package/dist/folders/hooks/reparentChildFolder.d.ts +0 -24
  370. package/dist/folders/hooks/reparentChildFolder.d.ts.map +0 -1
  371. package/dist/folders/hooks/reparentChildFolder.js +0 -72
  372. package/dist/folders/hooks/reparentChildFolder.js.map +0 -1
  373. package/dist/folders/types.d.ts +0 -118
  374. package/dist/folders/types.d.ts.map +0 -1
  375. package/dist/folders/types.js +0 -3
  376. package/dist/folders/types.js.map +0 -1
  377. package/dist/folders/utils/buildFolderWhereConstraints.d.ts +0 -13
  378. package/dist/folders/utils/buildFolderWhereConstraints.d.ts.map +0 -1
  379. package/dist/folders/utils/buildFolderWhereConstraints.js +0 -45
  380. package/dist/folders/utils/buildFolderWhereConstraints.js.map +0 -1
  381. package/dist/folders/utils/formatFolderOrDocumentItem.d.ts +0 -12
  382. package/dist/folders/utils/formatFolderOrDocumentItem.d.ts.map +0 -1
  383. package/dist/folders/utils/formatFolderOrDocumentItem.js +0 -30
  384. package/dist/folders/utils/formatFolderOrDocumentItem.js.map +0 -1
  385. package/dist/folders/utils/getFolderBreadcrumbs.d.ts +0 -14
  386. package/dist/folders/utils/getFolderBreadcrumbs.d.ts.map +0 -1
  387. package/dist/folders/utils/getFolderBreadcrumbs.js +0 -45
  388. package/dist/folders/utils/getFolderBreadcrumbs.js.map +0 -1
  389. package/dist/folders/utils/getFolderData.d.ts +0 -33
  390. package/dist/folders/utils/getFolderData.d.ts.map +0 -1
  391. package/dist/folders/utils/getFolderData.js +0 -88
  392. package/dist/folders/utils/getFolderData.js.map +0 -1
  393. package/dist/folders/utils/getFoldersAndDocumentsFromJoin.d.ts +0 -24
  394. package/dist/folders/utils/getFoldersAndDocumentsFromJoin.d.ts.map +0 -1
  395. package/dist/folders/utils/getFoldersAndDocumentsFromJoin.js +0 -66
  396. package/dist/folders/utils/getFoldersAndDocumentsFromJoin.js.map +0 -1
  397. package/dist/folders/utils/getOrphanedDocs.d.ts +0 -15
  398. package/dist/folders/utils/getOrphanedDocs.d.ts.map +0 -1
  399. package/dist/folders/utils/getOrphanedDocs.js +0 -40
  400. package/dist/folders/utils/getOrphanedDocs.js.map +0 -1
@@ -3,6 +3,7 @@ import { DuplicateFieldName, InvalidConfiguration, InvalidFieldName, InvalidFiel
3
3
  import { ReservedFieldName } from '../../errors/ReservedFieldName.js';
4
4
  import { flattenAllFields } from '../../utilities/flattenAllFields.js';
5
5
  import { formatLabels, toWords } from '../../utilities/formatLabels.js';
6
+ import { endSpan, startSpan } from '../../utilities/sanitizeProfiler.js';
6
7
  import { validateTimezones } from '../../utilities/validateTimezones.js';
7
8
  import { baseBlockFields } from '../baseFields/baseBlockFields.js';
8
9
  import { baseIDField } from '../baseFields/baseIDField.js';
@@ -27,382 +28,394 @@ import { fieldAffectsData as _fieldAffectsData, fieldIsLocalized, tabHasName } f
27
28
  if ('_sanitized' in field && field._sanitized === true) {
28
29
  return result;
29
30
  }
30
- if ('_sanitized' in field) {
31
- field._sanitized = true;
32
- }
33
- if (!field.type) {
34
- throw new MissingFieldType(field);
35
- }
36
- const fieldAffectsData = _fieldAffectsData(field);
37
- const { indexPath, schemaPath } = getFieldPaths({
38
- field,
39
- index,
40
- parentIndexPath,
41
- parentSchemaPath
42
- });
43
- // Reserved field name checks
44
- if (isTopLevelField && fieldAffectsData && field.name) {
45
- if (collectionConfig && collectionConfig.upload) {
46
- if (reservedBaseUploadFieldNames.includes(field.name)) {
47
- throw new ReservedFieldName(field, field.name);
48
- }
31
+ const __profSpan = startSpan(`sanitizeField:${field.type}`);
32
+ try {
33
+ if ('_sanitized' in field) {
34
+ field._sanitized = true;
49
35
  }
50
- if (collectionConfig && collectionConfig.auth && typeof collectionConfig.auth === 'object' && !collectionConfig.auth.disableLocalStrategy) {
51
- if (reservedBaseAuthFieldNames.includes(field.name)) {
52
- throw new ReservedFieldName(field, field.name);
53
- }
54
- if (collectionConfig.auth.verify) {
55
- // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve
56
- if (reservedAPIKeyFieldNames.includes(field.name)) {
36
+ if (!field.type) {
37
+ throw new MissingFieldType(field);
38
+ }
39
+ const fieldAffectsData = _fieldAffectsData(field);
40
+ const { indexPath, schemaPath } = getFieldPaths({
41
+ field,
42
+ index,
43
+ parentIndexPath,
44
+ parentSchemaPath
45
+ });
46
+ // Reserved field name checks
47
+ if (isTopLevelField && fieldAffectsData && field.name) {
48
+ if (collectionConfig && collectionConfig.upload) {
49
+ if (reservedBaseUploadFieldNames.includes(field.name)) {
57
50
  throw new ReservedFieldName(field, field.name);
58
51
  }
59
- // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve
60
- if (reservedVerifyFieldNames.includes(field.name)) {
52
+ }
53
+ if (collectionConfig && collectionConfig.auth && typeof collectionConfig.auth === 'object' && !collectionConfig.auth.disableLocalStrategy) {
54
+ if (reservedBaseAuthFieldNames.includes(field.name)) {
61
55
  throw new ReservedFieldName(field, field.name);
62
56
  }
63
- }
64
- }
65
- }
66
- // Invalid field name check
67
- if (fieldAffectsData && field.name.includes('.')) {
68
- throw new InvalidFieldName(field, field.name);
69
- }
70
- // Auto-label
71
- if ('name' in field && field.name && typeof field.label !== 'object' && typeof field.label !== 'string' && typeof field.label !== 'function' && field.label !== false) {
72
- field.label = toWords(field.name);
73
- }
74
- // Checkbox default
75
- if (field.type === 'checkbox' && typeof field.defaultValue === 'undefined' && field.required === true) {
76
- field.defaultValue = false;
77
- }
78
- // Join field sanitization
79
- if (field.type === 'join') {
80
- sanitizeJoinField({
81
- config,
82
- field,
83
- joinPath,
84
- joins,
85
- orderableJoins,
86
- parentIsLocalized,
87
- polymorphicJoins
88
- });
89
- }
90
- // Relationship/upload validation
91
- if (field.type === 'relationship' || field.type === 'upload') {
92
- if (Array.isArray(field.relationTo) && field.relationTo.length === 0) {
93
- throw new Error(`Field "${field.name}" of type "${field.type}" has an empty relationTo array. At least one collection must be specified.`);
94
- }
95
- if (validRelationships) {
96
- const relationships = Array.isArray(field.relationTo) ? field.relationTo : [
97
- field.relationTo
98
- ];
99
- relationships.forEach((relationship)=>{
100
- if (!validRelationships.includes(relationship)) {
101
- throw new InvalidFieldRelationship(field, relationship);
57
+ if (collectionConfig.auth.verify) {
58
+ // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve
59
+ if (reservedAPIKeyFieldNames.includes(field.name)) {
60
+ throw new ReservedFieldName(field, field.name);
61
+ }
62
+ // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve
63
+ if (reservedVerifyFieldNames.includes(field.name)) {
64
+ throw new ReservedFieldName(field, field.name);
65
+ }
102
66
  }
103
- });
67
+ }
104
68
  }
105
- if (field.min && !field.minRows) {
106
- console.warn(`(payload): The "min" property is deprecated for the Relationship field "${field.name}" and will be removed in a future version. Please use "minRows" instead.`);
107
- field.minRows = field.min;
69
+ // Invalid field name check
70
+ if (fieldAffectsData && field.name.includes('.')) {
71
+ throw new InvalidFieldName(field, field.name);
108
72
  }
109
- if (field.max && !field.maxRows) {
110
- console.warn(`(payload): The "max" property is deprecated for the Relationship field "${field.name}" and will be removed in a future version. Please use "maxRows" instead.`);
111
- field.maxRows = field.max;
73
+ // Auto-label
74
+ if ('name' in field && field.name && typeof field.label !== 'object' && typeof field.label !== 'string' && typeof field.label !== 'function' && field.label !== false) {
75
+ field.label = toWords(field.name);
112
76
  }
113
- }
114
- // Upload isSortable default
115
- if (field.type === 'upload') {
116
- if (!field.admin || !('isSortable' in field.admin)) {
117
- field.admin = {
118
- isSortable: true,
119
- ...field.admin
120
- };
121
- }
122
- }
123
- // Array ID field
124
- if (field.type === 'array' && field.fields) {
125
- const hasCustomID = field.fields.some((f)=>'name' in f && f.name === 'id');
126
- if (!hasCustomID) {
127
- field.fields.push(baseIDField);
77
+ // Checkbox default
78
+ if (field.type === 'checkbox' && typeof field.defaultValue === 'undefined' && field.required === true) {
79
+ field.defaultValue = false;
128
80
  }
129
- }
130
- // Blocks/array labels
131
- if ((field.type === 'blocks' || field.type === 'array') && field.label) {
132
- field.labels = field.labels || formatLabels(field.name);
133
- }
134
- if (fieldAffectsData) {
135
- if (existingFieldNames.has(field.name)) {
136
- throw new DuplicateFieldName(field.name);
137
- } else if (![
138
- 'blockName',
139
- 'id'
140
- ].includes(field.name)) {
141
- existingFieldNames.add(field.name);
81
+ // Join field sanitization
82
+ if (field.type === 'join') {
83
+ sanitizeJoinField({
84
+ config,
85
+ field,
86
+ joinPath,
87
+ joins,
88
+ orderableJoins,
89
+ parentIsLocalized,
90
+ polymorphicJoins
91
+ });
142
92
  }
143
- if (typeof field.localized !== 'undefined') {
144
- let shouldDisableLocalized = !config.localization;
145
- if (process.env.NEXT_PUBLIC_PAYLOAD_COMPATIBILITY_allowLocalizedWithinLocalized !== 'true' && parentIsLocalized && // @todo PAYLOAD_DO_NOT_SANITIZE_LOCALIZED_PROPERTY=true will be the default in 4.0
146
- process.env.PAYLOAD_DO_NOT_SANITIZE_LOCALIZED_PROPERTY !== 'true') {
147
- shouldDisableLocalized = true;
93
+ // Relationship/upload validation
94
+ if (field.type === 'relationship' || field.type === 'upload') {
95
+ if (Array.isArray(field.relationTo) && field.relationTo.length === 0) {
96
+ throw new Error(`Field "${field.name}" of type "${field.type}" has an empty relationTo array. At least one collection must be specified.`);
148
97
  }
149
- if (shouldDisableLocalized) {
150
- delete field.localized;
98
+ if (validRelationships) {
99
+ const relationships = Array.isArray(field.relationTo) ? field.relationTo : [
100
+ field.relationTo
101
+ ];
102
+ relationships.forEach((relationship)=>{
103
+ if (!validRelationships.includes(relationship)) {
104
+ throw new InvalidFieldRelationship(field, relationship);
105
+ }
106
+ });
151
107
  }
152
108
  }
153
- if (typeof field.validate === 'undefined') {
154
- if ('virtual' in field && field.virtual) {
155
- field.validate = ()=>true;
156
- } else {
157
- const defaultValidate = validations[field.type];
158
- if (defaultValidate) {
159
- field.validate = (val, options)=>defaultValidate(val, {
160
- ...field,
161
- ...options
162
- });
163
- } else {
164
- field.validate = ()=>true;
165
- }
109
+ // Upload isSortable default
110
+ if (field.type === 'upload') {
111
+ if (!field.admin || !('isSortable' in field.admin)) {
112
+ field.admin = {
113
+ isSortable: true,
114
+ ...field.admin
115
+ };
166
116
  }
167
117
  }
168
- if (!field.hooks) {
169
- field.hooks = {};
118
+ // Array ID field
119
+ if (field.type === 'array' && field.fields) {
120
+ const hasCustomID = field.fields.some((f)=>'name' in f && f.name === 'id');
121
+ if (!hasCustomID) {
122
+ field.fields.push(baseIDField);
123
+ }
170
124
  }
171
- if (!field.access) {
172
- field.access = {};
125
+ // Blocks/array labels
126
+ if ((field.type === 'blocks' || field.type === 'array') && field.label) {
127
+ field.labels = field.labels || formatLabels(field.name);
173
128
  }
174
- setDefaultBeforeDuplicate(field, parentIsLocalized);
175
- }
176
- if (!field.admin) {
177
- field.admin = {};
178
- }
179
- if ('virtual' in field && field.virtual && field.admin.readOnly !== false && fieldAffectsData) {
180
- field.admin.readOnly = true;
181
- }
182
- // Make sure that the richText field has an editor
183
- if (field.type === 'richText') {
184
- const sanitizeRichText = async (_config)=>{
185
- if (!field.editor) {
186
- if (_config.editor && !requireFieldLevelRichTextEditor) {
187
- // config.editor should be sanitized at this point
188
- field.editor = _config.editor;
129
+ if (fieldAffectsData) {
130
+ if (existingFieldNames.has(field.name)) {
131
+ throw new DuplicateFieldName(field.name);
132
+ } else if (![
133
+ 'blockName',
134
+ 'id'
135
+ ].includes(field.name)) {
136
+ existingFieldNames.add(field.name);
137
+ }
138
+ if (typeof field.localized !== 'undefined') {
139
+ let shouldDisableLocalized = !config.localization;
140
+ if (process.env.NEXT_PUBLIC_PAYLOAD_COMPATIBILITY_allowLocalizedWithinLocalized !== 'true' && parentIsLocalized && // @todo PAYLOAD_DO_NOT_SANITIZE_LOCALIZED_PROPERTY=true will be the default in 4.0
141
+ process.env.PAYLOAD_DO_NOT_SANITIZE_LOCALIZED_PROPERTY !== 'true') {
142
+ shouldDisableLocalized = true;
143
+ }
144
+ if (shouldDisableLocalized) {
145
+ delete field.localized;
146
+ }
147
+ }
148
+ if (typeof field.validate === 'undefined') {
149
+ if ('virtual' in field && field.virtual) {
150
+ field.validate = ()=>true;
189
151
  } else {
190
- throw new MissingEditorProp(field) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor
191
- ;
152
+ const defaultValidate = validations[field.type];
153
+ if (defaultValidate) {
154
+ field.validate = (val, options)=>defaultValidate(val, {
155
+ ...field,
156
+ ...options
157
+ });
158
+ } else {
159
+ field.validate = ()=>true;
160
+ }
192
161
  }
193
162
  }
194
- if (typeof field.editor === 'function') {
195
- field.editor = await field.editor({
196
- config: _config,
197
- isRoot: requireFieldLevelRichTextEditor,
198
- parentIsLocalized: parentIsLocalized || field.localized
199
- });
163
+ if (!field.hooks) {
164
+ field.hooks = {};
200
165
  }
201
- if (field.editor.i18n && Object.keys(field.editor.i18n).length >= 0) {
202
- config.i18n.translations = deepMergeSimple(config.i18n.translations, field.editor.i18n);
166
+ if (!field.access) {
167
+ field.access = {};
203
168
  }
204
- };
205
- if (richTextSanitizationPromises) {
206
- richTextSanitizationPromises.push(sanitizeRichText);
207
- } else {
208
- await sanitizeRichText(config);
169
+ setDefaultBeforeDuplicate(field, parentIsLocalized);
209
170
  }
210
- }
211
- if (field.type === 'blocks' && field.blocks) {
212
- if (field.blockReferences && field.blocks?.length) {
213
- throw new Error('You cannot have both blockReferences and blocks in the same blocks field');
171
+ if (!field.admin) {
172
+ field.admin = {};
214
173
  }
215
- const blockSlugs = [];
216
- for (const block of field.blockReferences ?? field.blocks){
217
- const blockSlug = typeof block === 'string' ? block : block.slug;
218
- if (blockSlugs.includes(blockSlug)) {
219
- throw new DuplicateFieldName(blockSlug);
220
- }
221
- blockSlugs.push(blockSlug);
222
- if (typeof block === 'string') {
223
- continue;
224
- }
225
- if (block._sanitized === true) {
226
- continue;
174
+ if ('virtual' in field && field.virtual && field.admin.readOnly !== false && fieldAffectsData) {
175
+ field.admin.readOnly = true;
176
+ }
177
+ // Make sure that the richText field has an editor
178
+ if (field.type === 'richText') {
179
+ const sanitizeRichText = async (_config)=>{
180
+ if (!field.editor) {
181
+ if (_config.editor && !requireFieldLevelRichTextEditor) {
182
+ // config.editor should be sanitized at this point
183
+ field.editor = _config.editor;
184
+ } else {
185
+ throw new MissingEditorProp(field) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor
186
+ ;
187
+ }
188
+ }
189
+ if (typeof field.editor === 'function') {
190
+ field.editor = await field.editor({
191
+ config: _config,
192
+ isRoot: requireFieldLevelRichTextEditor,
193
+ parentIsLocalized: parentIsLocalized || field.localized
194
+ });
195
+ }
196
+ if (field.editor.i18n && Object.keys(field.editor.i18n).length >= 0) {
197
+ config.i18n.translations = deepMergeSimple(config.i18n.translations, field.editor.i18n);
198
+ }
199
+ };
200
+ if (richTextSanitizationPromises) {
201
+ richTextSanitizationPromises.push(sanitizeRichText);
202
+ } else {
203
+ await sanitizeRichText(config);
227
204
  }
228
- block._sanitized = true;
229
- block.fields = block.fields.concat(baseBlockFields);
230
- block.labels = !block.labels ? formatLabels(block.slug) : block.labels;
231
- block.fields = await sanitizeFields({
232
- collectionConfig,
233
- config,
234
- existingFieldNames: new Set(),
235
- fields: block.fields,
236
- isTopLevelField: false,
237
- parentIndexPath: '',
238
- parentIsLocalized: parentIsLocalized || field.localized,
239
- parentSchemaPath: schemaPath + '.' + block.slug,
240
- requireFieldLevelRichTextEditor,
241
- richTextSanitizationPromises,
242
- validRelationships
243
- });
244
205
  }
245
- }
246
- if ('fields' in field && field.fields) {
247
- field.fields = await sanitizeFields({
248
- collectionConfig,
249
- config,
250
- existingFieldNames: fieldAffectsData ? new Set() : existingFieldNames,
251
- fields: field.fields,
252
- isTopLevelField: isTopLevelField && !fieldAffectsData,
253
- joinPath: fieldAffectsData ? `${joinPath ? joinPath + '.' : ''}${field.name}` : joinPath,
254
- joins,
255
- orderableJoins,
256
- parentIndexPath: fieldAffectsData ? '' : indexPath,
257
- parentIsLocalized: parentIsLocalized || fieldIsLocalized(field),
258
- parentSchemaPath: schemaPath,
259
- polymorphicJoins,
260
- requireFieldLevelRichTextEditor,
261
- richTextSanitizationPromises,
262
- validRelationships
263
- });
264
- }
265
- if (field.type === 'tabs') {
266
- for(let j = 0; j < field.tabs.length; j++){
267
- const tab = field.tabs[j];
268
- const isNamedTab = tabHasName(tab);
269
- if (isNamedTab && typeof tab.label === 'undefined') {
270
- tab.label = toWords(tab.name);
206
+ if (field.type === 'blocks' && field.blocks) {
207
+ if (field.blockReferences && field.blocks?.length) {
208
+ throw new Error('You cannot have both blockReferences and blocks in the same blocks field');
271
209
  }
272
- const { indexPath: tabIndexPath, schemaPath: tabSchemaPath } = getFieldPaths({
273
- field: tab,
274
- index: j,
275
- parentIndexPath: indexPath,
276
- parentSchemaPath: schemaPath
277
- });
278
- if ('admin' in tab && tab.admin?.condition && typeof tab.admin.condition === 'function' && !tab.id) {
279
- tab.id = tabSchemaPath;
210
+ const blockSlugs = [];
211
+ for (const block of field.blockReferences ?? field.blocks){
212
+ const blockSlug = typeof block === 'string' ? block : block.slug;
213
+ if (blockSlugs.includes(blockSlug)) {
214
+ throw new DuplicateFieldName(blockSlug);
215
+ }
216
+ blockSlugs.push(blockSlug);
217
+ if (typeof block === 'string') {
218
+ continue;
219
+ }
220
+ if (block._sanitized === true) {
221
+ continue;
222
+ }
223
+ block._sanitized = true;
224
+ block.fields = block.fields.concat(baseBlockFields);
225
+ block.labels = !block.labels ? formatLabels(block.slug) : block.labels;
226
+ block.fields = await sanitizeFields({
227
+ collectionConfig,
228
+ config,
229
+ existingFieldNames: new Set(),
230
+ fields: block.fields,
231
+ isTopLevelField: false,
232
+ parentIndexPath: '',
233
+ parentIsLocalized: parentIsLocalized || field.localized,
234
+ parentSchemaPath: schemaPath + '.' + block.slug,
235
+ requireFieldLevelRichTextEditor,
236
+ richTextSanitizationPromises,
237
+ validRelationships
238
+ });
280
239
  }
281
- tab.fields = await sanitizeFields({
240
+ }
241
+ if ('fields' in field && field.fields) {
242
+ field.fields = await sanitizeFields({
282
243
  collectionConfig,
283
244
  config,
284
- existingFieldNames: isNamedTab ? new Set() : existingFieldNames,
285
- fields: tab.fields,
286
- isTopLevelField: isTopLevelField && !isNamedTab,
287
- joinPath: isNamedTab ? `${joinPath ? joinPath + '.' : ''}${tab.name}` : joinPath,
245
+ existingFieldNames: fieldAffectsData ? new Set() : existingFieldNames,
246
+ fields: field.fields,
247
+ isTopLevelField: isTopLevelField && !fieldAffectsData,
248
+ joinPath: fieldAffectsData ? `${joinPath ? joinPath + '.' : ''}${field.name}` : joinPath,
288
249
  joins,
289
250
  orderableJoins,
290
- parentIndexPath: isNamedTab ? '' : tabIndexPath,
291
- parentIsLocalized: parentIsLocalized || isNamedTab && tab.localized,
292
- parentSchemaPath: tabSchemaPath,
251
+ parentIndexPath: fieldAffectsData ? '' : indexPath,
252
+ parentIsLocalized: parentIsLocalized || fieldIsLocalized(field),
253
+ parentSchemaPath: schemaPath,
293
254
  polymorphicJoins,
294
255
  requireFieldLevelRichTextEditor,
295
256
  richTextSanitizationPromises,
296
257
  validRelationships
297
258
  });
298
- field.tabs[j] = tab;
299
259
  }
300
- }
301
- if (field.type === 'ui' && typeof field.admin.disableBulkEdit === 'undefined') {
302
- field.admin.disableBulkEdit = true;
303
- }
304
- // Timezone field insertion
305
- if (field.type === 'date' && field.timezone) {
306
- const name = field.name + '_tz';
307
- let defaultTimezone = field.timezone && typeof field.timezone === 'object' ? field.timezone.defaultTimezone : config.admin?.timezones?.defaultTimezone;
308
- const required = field.required || field.timezone && typeof field.timezone === 'object' && field.timezone.required;
309
- const supportedTimezones = field.timezone && typeof field.timezone === 'object' && field.timezone.supportedTimezones ? field.timezone.supportedTimezones : config.admin?.timezones?.supportedTimezones;
310
- const options = typeof supportedTimezones === 'function' ? supportedTimezones({
311
- defaultTimezones
312
- }) : supportedTimezones;
313
- validateTimezones({
314
- source: `field "${field.name}" timezone.supportedTimezones`,
315
- timezones: options
316
- });
317
- if (options && options.length === 1 && options[0]?.value) {
318
- defaultTimezone = options[0].value;
260
+ if (field.type === 'tabs') {
261
+ for(let j = 0; j < field.tabs.length; j++){
262
+ const tab = field.tabs[j];
263
+ const isNamedTab = tabHasName(tab);
264
+ if (isNamedTab && typeof tab.label === 'undefined') {
265
+ tab.label = toWords(tab.name);
266
+ }
267
+ const { indexPath: tabIndexPath, schemaPath: tabSchemaPath } = getFieldPaths({
268
+ field: tab,
269
+ index: j,
270
+ parentIndexPath: indexPath,
271
+ parentSchemaPath: schemaPath
272
+ });
273
+ if ('admin' in tab && tab.admin?.condition && typeof tab.admin.condition === 'function' && !tab.id) {
274
+ tab.id = tabSchemaPath;
275
+ }
276
+ tab.fields = await sanitizeFields({
277
+ collectionConfig,
278
+ config,
279
+ existingFieldNames: isNamedTab ? new Set() : existingFieldNames,
280
+ fields: tab.fields,
281
+ isTopLevelField: isTopLevelField && !isNamedTab,
282
+ joinPath: isNamedTab ? `${joinPath ? joinPath + '.' : ''}${tab.name}` : joinPath,
283
+ joins,
284
+ orderableJoins,
285
+ parentIndexPath: isNamedTab ? '' : tabIndexPath,
286
+ parentIsLocalized: parentIsLocalized || isNamedTab && tab.localized,
287
+ parentSchemaPath: tabSchemaPath,
288
+ polymorphicJoins,
289
+ requireFieldLevelRichTextEditor,
290
+ richTextSanitizationPromises,
291
+ validRelationships
292
+ });
293
+ field.tabs[j] = tab;
294
+ }
319
295
  }
320
- // Generate label for timezone field
321
- const timezoneLabel = typeof field.label === 'string' ? `${field.label} Tz` : toWords(name);
322
- const baseField = baseTimezoneField({
323
- name,
324
- defaultValue: defaultTimezone,
325
- label: timezoneLabel,
326
- options,
327
- required
328
- });
329
- // Apply override if provided
330
- const timezoneField = typeof field.timezone === 'object' && typeof field.timezone.override === 'function' ? field.timezone.override({
331
- baseField
332
- }) : baseField;
333
- result.fieldsToInsert = [
334
- timezoneField
335
- ];
336
- }
337
- // Virtual field handling
338
- if ('virtual' in field && typeof field.virtual === 'string') {
339
- const virtualField = field;
340
- const configFields = (collectionConfig || globalConfig)?.fields;
341
- if (configFields) {
342
- let flattenFields = flattenAllFields({
343
- fields: configFields
296
+ if (field.type === 'ui') {
297
+ const existing = field.admin.disabled;
298
+ if (existing === undefined) {
299
+ field.admin.disabled = {
300
+ bulkEdit: true
301
+ };
302
+ } else if (existing !== true && typeof existing === 'object' && existing.bulkEdit === undefined) {
303
+ field.admin.disabled = {
304
+ ...existing,
305
+ bulkEdit: true
306
+ };
307
+ }
308
+ }
309
+ // Timezone field insertion
310
+ if (field.type === 'date' && field.timezone) {
311
+ const name = field.name + '_tz';
312
+ let defaultTimezone = field.timezone && typeof field.timezone === 'object' ? field.timezone.defaultTimezone : config.admin?.timezones?.defaultTimezone;
313
+ const required = field.required || field.timezone && typeof field.timezone === 'object' && field.timezone.required;
314
+ const supportedTimezones = field.timezone && typeof field.timezone === 'object' && field.timezone.supportedTimezones ? field.timezone.supportedTimezones : config.admin?.timezones?.supportedTimezones;
315
+ const options = typeof supportedTimezones === 'function' ? supportedTimezones({
316
+ defaultTimezones
317
+ }) : supportedTimezones;
318
+ validateTimezones({
319
+ source: `field "${field.name}" timezone.supportedTimezones`,
320
+ timezones: options
344
321
  });
345
- const paths = field.virtual.split('.');
346
- let isHasMany = false;
347
- for (const [idx, segment] of paths.entries()){
348
- const foundField = flattenFields.find((e)=>e.name === segment);
349
- if (!foundField) {
350
- break;
351
- }
352
- if (foundField.type === 'group' || foundField.type === 'tab' || foundField.type === 'array') {
353
- flattenFields = foundField.flattenedFields;
354
- } else if ((foundField.type === 'relationship' || foundField.type === 'upload') && idx !== paths.length - 1 && typeof foundField.relationTo === 'string') {
355
- if (foundField.hasMany && (virtualField.type === 'text' || virtualField.type === 'number' || virtualField.type === 'select')) {
356
- if (isHasMany) {
357
- throw new InvalidConfiguration(`Virtual field ${virtualField.name} in ${globalConfig ? `global ${globalConfig.slug}` : `collection ${collectionConfig?.slug}`} references 2 or more hasMany relationships on the path ${virtualField.virtual} which is not allowed.`);
358
- }
359
- isHasMany = true;
360
- virtualField.hasMany = true;
322
+ if (options && options.length === 1 && options[0]?.value) {
323
+ defaultTimezone = options[0].value;
324
+ }
325
+ // Generate label for timezone field
326
+ const timezoneLabel = typeof field.label === 'string' ? `${field.label} Tz` : toWords(name);
327
+ const baseField = baseTimezoneField({
328
+ name,
329
+ defaultValue: defaultTimezone,
330
+ label: timezoneLabel,
331
+ options,
332
+ required
333
+ });
334
+ // Apply override if provided
335
+ const timezoneField = typeof field.timezone === 'object' && typeof field.timezone.override === 'function' ? field.timezone.override({
336
+ baseField
337
+ }) : baseField;
338
+ result.fieldsToInsert = [
339
+ timezoneField
340
+ ];
341
+ }
342
+ // Virtual field handling
343
+ if ('virtual' in field && typeof field.virtual === 'string') {
344
+ const virtualField = field;
345
+ const configFields = (collectionConfig || globalConfig)?.fields;
346
+ if (configFields) {
347
+ let flattenFields = flattenAllFields({
348
+ fields: configFields
349
+ });
350
+ const paths = field.virtual.split('.');
351
+ let isHasMany = false;
352
+ for (const [idx, segment] of paths.entries()){
353
+ const foundField = flattenFields.find((e)=>e.name === segment);
354
+ if (!foundField) {
355
+ break;
361
356
  }
362
- const relatedCollection = config.collections?.find((e)=>e.slug === foundField.relationTo);
363
- if (relatedCollection) {
364
- flattenFields = flattenAllFields({
365
- fields: relatedCollection.fields
366
- });
357
+ if (foundField.type === 'group' || foundField.type === 'tab' || foundField.type === 'array') {
358
+ flattenFields = foundField.flattenedFields;
359
+ } else if ((foundField.type === 'relationship' || foundField.type === 'upload') && idx !== paths.length - 1 && typeof foundField.relationTo === 'string') {
360
+ if (foundField.hasMany && (virtualField.type === 'text' || virtualField.type === 'number' || virtualField.type === 'select')) {
361
+ if (isHasMany) {
362
+ throw new InvalidConfiguration(`Virtual field ${virtualField.name} in ${globalConfig ? `global ${globalConfig.slug}` : `collection ${collectionConfig?.slug}`} references 2 or more hasMany relationships on the path ${virtualField.virtual} which is not allowed.`);
363
+ }
364
+ isHasMany = true;
365
+ virtualField.hasMany = true;
366
+ }
367
+ const relatedCollection = config.collections?.find((e)=>e.slug === foundField.relationTo);
368
+ if (relatedCollection) {
369
+ flattenFields = flattenAllFields({
370
+ fields: relatedCollection.fields
371
+ });
372
+ }
367
373
  }
368
374
  }
369
375
  }
370
376
  }
377
+ return result;
378
+ } finally{
379
+ endSpan(__profSpan);
371
380
  }
372
- return result;
373
381
  };
374
382
  export const sanitizeFields = async ({ collectionConfig, config, existingFieldNames = new Set(), fields, globalConfig, isTopLevelField = true, joinPath = '', joins, orderableJoins, parentIndexPath = '', parentIsLocalized, parentSchemaPath = '', polymorphicJoins, requireFieldLevelRichTextEditor = false, richTextSanitizationPromises, validRelationships })=>{
375
383
  if (!fields) {
376
384
  return [];
377
385
  }
378
- for(let i = 0; i < fields.length; i++){
379
- const field = fields[i];
380
- const result = await sanitizeField({
381
- collectionConfig,
382
- config,
383
- existingFieldNames,
384
- field,
385
- globalConfig,
386
- index: i,
387
- isTopLevelField,
388
- joinPath,
389
- joins,
390
- orderableJoins,
391
- parentIndexPath,
392
- parentIsLocalized,
393
- parentSchemaPath,
394
- polymorphicJoins,
395
- requireFieldLevelRichTextEditor,
396
- richTextSanitizationPromises,
397
- validRelationships
398
- });
399
- fields[i] = field;
400
- if (result.fieldsToInsert?.length) {
401
- fields.splice(i + 1, 0, ...result.fieldsToInsert);
402
- i += result.fieldsToInsert.length;
386
+ const __profSpan = startSpan('sanitizeFields', String(fields.length));
387
+ try {
388
+ for(let i = 0; i < fields.length; i++){
389
+ const field = fields[i];
390
+ const result = await sanitizeField({
391
+ collectionConfig,
392
+ config,
393
+ existingFieldNames,
394
+ field,
395
+ globalConfig,
396
+ index: i,
397
+ isTopLevelField,
398
+ joinPath,
399
+ joins,
400
+ orderableJoins,
401
+ parentIndexPath,
402
+ parentIsLocalized,
403
+ parentSchemaPath,
404
+ polymorphicJoins,
405
+ requireFieldLevelRichTextEditor,
406
+ richTextSanitizationPromises,
407
+ validRelationships
408
+ });
409
+ fields[i] = field;
410
+ if (result.fieldsToInsert?.length) {
411
+ fields.splice(i + 1, 0, ...result.fieldsToInsert);
412
+ i += result.fieldsToInsert.length;
413
+ }
403
414
  }
415
+ return fields;
416
+ } finally{
417
+ endSpan(__profSpan);
404
418
  }
405
- return fields;
406
419
  };
407
420
 
408
421
  //# sourceMappingURL=sanitize.js.map