payload 4.0.0-internal.5f0cd13 → 4.0.0-internal.688c4d0

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 (378) hide show
  1. package/dist/admin/RichText.d.ts +22 -2
  2. package/dist/admin/RichText.d.ts.map +1 -1
  3. package/dist/admin/RichText.js.map +1 -1
  4. package/dist/admin/adapters/devReload.d.ts +9 -0
  5. package/dist/admin/adapters/devReload.d.ts.map +1 -0
  6. package/dist/admin/adapters/devReload.js +6 -0
  7. package/dist/admin/adapters/devReload.js.map +1 -0
  8. package/dist/admin/adapters/index.d.ts +3 -0
  9. package/dist/admin/adapters/index.d.ts.map +1 -1
  10. package/dist/admin/adapters/index.js.map +1 -1
  11. package/dist/admin/adapters/render.d.ts +16 -0
  12. package/dist/admin/adapters/render.d.ts.map +1 -0
  13. package/dist/admin/adapters/render.js +7 -0
  14. package/dist/admin/adapters/render.js.map +1 -0
  15. package/dist/admin/adapters/views.d.ts +36 -0
  16. package/dist/admin/adapters/views.d.ts.map +1 -0
  17. package/dist/admin/adapters/views.js +7 -0
  18. package/dist/admin/adapters/views.js.map +1 -0
  19. package/dist/admin/fields/Row.d.ts +2 -2
  20. package/dist/admin/fields/Row.d.ts.map +1 -1
  21. package/dist/admin/fields/Row.js.map +1 -1
  22. package/dist/admin/forms/Description.d.ts +2 -2
  23. package/dist/admin/forms/Description.d.ts.map +1 -1
  24. package/dist/admin/forms/Description.js.map +1 -1
  25. package/dist/admin/forms/Field.d.ts +8 -3
  26. package/dist/admin/forms/Field.d.ts.map +1 -1
  27. package/dist/admin/forms/Field.js.map +1 -1
  28. package/dist/admin/forms/Form.d.ts +29 -0
  29. package/dist/admin/forms/Form.d.ts.map +1 -1
  30. package/dist/admin/forms/Form.js.map +1 -1
  31. package/dist/admin/functions/index.d.ts +9 -0
  32. package/dist/admin/functions/index.d.ts.map +1 -1
  33. package/dist/admin/functions/index.js.map +1 -1
  34. package/dist/admin/types.d.ts +2 -2
  35. package/dist/admin/types.d.ts.map +1 -1
  36. package/dist/admin/types.js.map +1 -1
  37. package/dist/admin/views/dashboard.d.ts +7 -0
  38. package/dist/admin/views/dashboard.d.ts.map +1 -1
  39. package/dist/admin/views/dashboard.js.map +1 -1
  40. package/dist/admin/views/document.d.ts +5 -3
  41. package/dist/admin/views/document.d.ts.map +1 -1
  42. package/dist/admin/views/document.js.map +1 -1
  43. package/dist/admin/views/list.d.ts +5 -0
  44. package/dist/admin/views/list.d.ts.map +1 -1
  45. package/dist/admin/views/list.js.map +1 -1
  46. package/dist/auth/baseFields/apiKey.d.ts +10 -2
  47. package/dist/auth/baseFields/apiKey.d.ts.map +1 -1
  48. package/dist/auth/baseFields/apiKey.js +35 -24
  49. package/dist/auth/baseFields/apiKey.js.map +1 -1
  50. package/dist/auth/defaultAccess.d.ts +1 -1
  51. package/dist/auth/defaultAccess.d.ts.map +1 -1
  52. package/dist/auth/defaultAccess.js +1 -1
  53. package/dist/auth/defaultAccess.js.map +1 -1
  54. package/dist/auth/defaultUser.d.ts.map +1 -1
  55. package/dist/auth/defaultUser.js +2 -1
  56. package/dist/auth/defaultUser.js.map +1 -1
  57. package/dist/auth/getAuthFields.js +2 -2
  58. package/dist/auth/getAuthFields.js.map +1 -1
  59. package/dist/bin/build.d.ts +25 -0
  60. package/dist/bin/build.d.ts.map +1 -0
  61. package/dist/bin/build.js +80 -0
  62. package/dist/bin/build.js.map +1 -0
  63. package/dist/bin/build.spec.js +170 -0
  64. package/dist/bin/build.spec.js.map +1 -0
  65. package/dist/bin/generateImportMap/index.d.ts.map +1 -1
  66. package/dist/bin/generateImportMap/index.js +8 -5
  67. package/dist/bin/generateImportMap/index.js.map +1 -1
  68. package/dist/bin/generateImportMap/iterateCollections.d.ts.map +1 -1
  69. package/dist/bin/generateImportMap/iterateCollections.js +1 -0
  70. package/dist/bin/generateImportMap/iterateCollections.js.map +1 -1
  71. package/dist/bin/generateImportMap/iterateConfig.d.ts.map +1 -1
  72. package/dist/bin/generateImportMap/iterateConfig.js +1 -0
  73. package/dist/bin/generateImportMap/iterateConfig.js.map +1 -1
  74. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.d.ts +5 -1
  75. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.d.ts.map +1 -1
  76. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.js +24 -18
  77. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.js.map +1 -1
  78. package/dist/bin/generateTypes.d.ts +3 -2
  79. package/dist/bin/generateTypes.d.ts.map +1 -1
  80. package/dist/bin/generateTypes.js +4 -0
  81. package/dist/bin/generateTypes.js.map +1 -1
  82. package/dist/bin/index.d.ts.map +1 -1
  83. package/dist/bin/index.js +9 -0
  84. package/dist/bin/index.js.map +1 -1
  85. package/dist/bin/loadEnv.d.ts +3 -1
  86. package/dist/bin/loadEnv.d.ts.map +1 -1
  87. package/dist/bin/loadEnv.js +40 -10
  88. package/dist/bin/loadEnv.js.map +1 -1
  89. package/dist/collections/config/defaults.js +2 -2
  90. package/dist/collections/config/defaults.js.map +1 -1
  91. package/dist/collections/config/defaults.spec.js +47 -0
  92. package/dist/collections/config/defaults.spec.js.map +1 -0
  93. package/dist/collections/config/sanitize.d.ts.map +1 -1
  94. package/dist/collections/config/sanitize.js +1 -11
  95. package/dist/collections/config/sanitize.js.map +1 -1
  96. package/dist/collections/config/types.d.ts +5 -7
  97. package/dist/collections/config/types.d.ts.map +1 -1
  98. package/dist/collections/config/types.js.map +1 -1
  99. package/dist/collections/endpoints/create.d.ts.map +1 -1
  100. package/dist/collections/endpoints/create.js +0 -2
  101. package/dist/collections/endpoints/create.js.map +1 -1
  102. package/dist/collections/endpoints/updateByID.d.ts.map +1 -1
  103. package/dist/collections/endpoints/updateByID.js +1 -2
  104. package/dist/collections/endpoints/updateByID.js.map +1 -1
  105. package/dist/collections/operations/count.d.ts.map +1 -1
  106. package/dist/collections/operations/count.js +1 -0
  107. package/dist/collections/operations/count.js.map +1 -1
  108. package/dist/collections/operations/create.d.ts +0 -1
  109. package/dist/collections/operations/create.d.ts.map +1 -1
  110. package/dist/collections/operations/create.js +15 -6
  111. package/dist/collections/operations/create.js.map +1 -1
  112. package/dist/collections/operations/delete.d.ts.map +1 -1
  113. package/dist/collections/operations/delete.js +3 -0
  114. package/dist/collections/operations/delete.js.map +1 -1
  115. package/dist/collections/operations/local/duplicate.d.ts.map +1 -1
  116. package/dist/collections/operations/local/duplicate.js.map +1 -1
  117. package/dist/collections/operations/local/find.d.ts.map +1 -1
  118. package/dist/collections/operations/local/find.js.map +1 -1
  119. package/dist/collections/operations/local/findByID.d.ts.map +1 -1
  120. package/dist/collections/operations/local/findByID.js.map +1 -1
  121. package/dist/collections/operations/local/findVersionByID.d.ts.map +1 -1
  122. package/dist/collections/operations/local/findVersionByID.js.map +1 -1
  123. package/dist/collections/operations/local/findVersions.d.ts.map +1 -1
  124. package/dist/collections/operations/local/findVersions.js.map +1 -1
  125. package/dist/collections/operations/local/restoreVersion.d.ts.map +1 -1
  126. package/dist/collections/operations/local/restoreVersion.js.map +1 -1
  127. package/dist/collections/operations/local/update.d.ts +4 -8
  128. package/dist/collections/operations/local/update.d.ts.map +1 -1
  129. package/dist/collections/operations/local/update.js +1 -2
  130. package/dist/collections/operations/local/update.js.map +1 -1
  131. package/dist/collections/operations/update.d.ts +0 -1
  132. package/dist/collections/operations/update.d.ts.map +1 -1
  133. package/dist/collections/operations/update.js +1 -2
  134. package/dist/collections/operations/update.js.map +1 -1
  135. package/dist/collections/operations/updateByID.d.ts +0 -1
  136. package/dist/collections/operations/updateByID.d.ts.map +1 -1
  137. package/dist/collections/operations/updateByID.js +1 -5
  138. package/dist/collections/operations/updateByID.js.map +1 -1
  139. package/dist/collections/operations/utilities/update.d.ts +1 -2
  140. package/dist/collections/operations/utilities/update.d.ts.map +1 -1
  141. package/dist/collections/operations/utilities/update.js +64 -65
  142. package/dist/collections/operations/utilities/update.js.map +1 -1
  143. package/dist/config/client.js.map +1 -1
  144. package/dist/config/orderable/index.d.ts.map +1 -1
  145. package/dist/config/orderable/index.js +23 -0
  146. package/dist/config/orderable/index.js.map +1 -1
  147. package/dist/config/types.d.ts +18 -18
  148. package/dist/config/types.d.ts.map +1 -1
  149. package/dist/config/types.js +1 -0
  150. package/dist/config/types.js.map +1 -1
  151. package/dist/database/getLocalizedPaths.d.ts.map +1 -1
  152. package/dist/database/getLocalizedPaths.js +1 -1
  153. package/dist/database/getLocalizedPaths.js.map +1 -1
  154. package/dist/database/migrations/migrationsCollection.d.ts.map +1 -1
  155. package/dist/database/migrations/migrationsCollection.js +2 -1
  156. package/dist/database/migrations/migrationsCollection.js.map +1 -1
  157. package/dist/exports/migrations.d.ts +5 -13
  158. package/dist/exports/migrations.d.ts.map +1 -1
  159. package/dist/exports/migrations.js +5 -13
  160. package/dist/exports/migrations.js.map +1 -1
  161. package/dist/exports/shared.d.ts +20 -0
  162. package/dist/exports/shared.d.ts.map +1 -1
  163. package/dist/exports/shared.js +20 -0
  164. package/dist/exports/shared.js.map +1 -1
  165. package/dist/fields/config/client.d.ts +2 -2
  166. package/dist/fields/config/client.d.ts.map +1 -1
  167. package/dist/fields/config/client.js +11 -12
  168. package/dist/fields/config/client.js.map +1 -1
  169. package/dist/fields/config/sanitize.d.ts.map +1 -1
  170. package/dist/fields/config/sanitize.js +1 -4
  171. package/dist/fields/config/sanitize.js.map +1 -1
  172. package/dist/fields/config/types.d.ts +5 -20
  173. package/dist/fields/config/types.d.ts.map +1 -1
  174. package/dist/fields/config/types.js.map +1 -1
  175. package/dist/fields/hooks/afterChange/promise.js +1 -1
  176. package/dist/fields/hooks/afterChange/promise.js.map +1 -1
  177. package/dist/fields/hooks/afterRead/promise.js +2 -2
  178. package/dist/fields/hooks/afterRead/promise.js.map +1 -1
  179. package/dist/fields/hooks/beforeChange/promise.d.ts.map +1 -1
  180. package/dist/fields/hooks/beforeChange/promise.js +3 -3
  181. package/dist/fields/hooks/beforeChange/promise.js.map +1 -1
  182. package/dist/fields/hooks/beforeDuplicate/promise.js +2 -2
  183. package/dist/fields/hooks/beforeDuplicate/promise.js.map +1 -1
  184. package/dist/fields/hooks/beforeValidate/promise.js +1 -1
  185. package/dist/fields/hooks/beforeValidate/promise.js.map +1 -1
  186. package/dist/fields/validations.d.ts.map +1 -1
  187. package/dist/fields/validations.js +5 -4
  188. package/dist/fields/validations.js.map +1 -1
  189. package/dist/globals/config/sanitize.d.ts.map +1 -1
  190. package/dist/globals/config/sanitize.js +2 -6
  191. package/dist/globals/config/sanitize.js.map +1 -1
  192. package/dist/globals/config/sanitize.spec.js +43 -0
  193. package/dist/globals/config/sanitize.spec.js.map +1 -0
  194. package/dist/globals/endpoints/update.d.ts.map +1 -1
  195. package/dist/globals/endpoints/update.js +0 -2
  196. package/dist/globals/endpoints/update.js.map +1 -1
  197. package/dist/globals/operations/local/findOne.d.ts.map +1 -1
  198. package/dist/globals/operations/local/findOne.js.map +1 -1
  199. package/dist/globals/operations/local/update.d.ts +4 -6
  200. package/dist/globals/operations/local/update.d.ts.map +1 -1
  201. package/dist/globals/operations/local/update.js +1 -2
  202. package/dist/globals/operations/local/update.js.map +1 -1
  203. package/dist/globals/operations/update.d.ts +0 -1
  204. package/dist/globals/operations/update.d.ts.map +1 -1
  205. package/dist/globals/operations/update.js +52 -58
  206. package/dist/globals/operations/update.js.map +1 -1
  207. package/dist/index.bundled.d.ts +300 -147
  208. package/dist/index.d.ts +13 -12
  209. package/dist/index.d.ts.map +1 -1
  210. package/dist/index.js +53 -35
  211. package/dist/index.js.map +1 -1
  212. package/dist/kv/adapters/DatabaseKVAdapter.d.ts.map +1 -1
  213. package/dist/kv/adapters/DatabaseKVAdapter.js +1 -0
  214. package/dist/kv/adapters/DatabaseKVAdapter.js.map +1 -1
  215. package/dist/locked-documents/config.d.ts.map +1 -1
  216. package/dist/locked-documents/config.js +2 -1
  217. package/dist/locked-documents/config.js.map +1 -1
  218. package/dist/preferences/config.d.ts.map +1 -1
  219. package/dist/preferences/config.js +2 -1
  220. package/dist/preferences/config.js.map +1 -1
  221. package/dist/query-presets/config.d.ts.map +1 -1
  222. package/dist/query-presets/config.js +2 -1
  223. package/dist/query-presets/config.js.map +1 -1
  224. package/dist/queues/config/collection.d.ts.map +1 -1
  225. package/dist/queues/config/collection.js +2 -1
  226. package/dist/queues/config/collection.js.map +1 -1
  227. package/dist/queues/config/generateJobsJSONSchemas.js +2 -2
  228. package/dist/queues/config/generateJobsJSONSchemas.js.map +1 -1
  229. package/dist/queues/config/global.d.ts.map +1 -1
  230. package/dist/queues/config/global.js +2 -1
  231. package/dist/queues/config/global.js.map +1 -1
  232. package/dist/uploads/fetchAPI-multipart/processMultipart.d.ts.map +1 -1
  233. package/dist/uploads/fetchAPI-multipart/processMultipart.js +14 -1
  234. package/dist/uploads/fetchAPI-multipart/processMultipart.js.map +1 -1
  235. package/dist/uploads/generateFileData.d.ts +2 -1
  236. package/dist/uploads/generateFileData.d.ts.map +1 -1
  237. package/dist/uploads/generateFileData.js +5 -2
  238. package/dist/uploads/generateFileData.js.map +1 -1
  239. package/dist/uploads/safeFetch.d.ts.map +1 -1
  240. package/dist/uploads/safeFetch.js +11 -5
  241. package/dist/uploads/safeFetch.js.map +1 -1
  242. package/dist/utilities/appendDateTimezoneSelectFields.js +2 -2
  243. package/dist/utilities/appendDateTimezoneSelectFields.js.map +1 -1
  244. package/dist/utilities/configToJSONSchema.d.ts +25 -0
  245. package/dist/utilities/configToJSONSchema.d.ts.map +1 -1
  246. package/dist/utilities/configToJSONSchema.js +76 -34
  247. package/dist/utilities/configToJSONSchema.js.map +1 -1
  248. package/dist/utilities/configToJSONSchema.spec.js +215 -29
  249. package/dist/utilities/configToJSONSchema.spec.js.map +1 -1
  250. package/dist/utilities/deepCopyObject.d.ts.map +1 -1
  251. package/dist/utilities/deepCopyObject.js +8 -0
  252. package/dist/utilities/deepCopyObject.js.map +1 -1
  253. package/dist/utilities/dependencies/dependencyChecker.js +1 -1
  254. package/dist/utilities/dependencies/dependencyChecker.js.map +1 -1
  255. package/dist/utilities/dependencies/getDependencies.d.ts.map +1 -1
  256. package/dist/utilities/dependencies/getDependencies.js +5 -5
  257. package/dist/utilities/dependencies/getDependencies.js.map +1 -1
  258. package/dist/utilities/dynamicImport.js +1 -1
  259. package/dist/utilities/dynamicImport.js.map +1 -1
  260. package/dist/utilities/filterDataToSelectedLocales.d.ts.map +1 -1
  261. package/dist/utilities/filterDataToSelectedLocales.js +5 -12
  262. package/dist/utilities/filterDataToSelectedLocales.js.map +1 -1
  263. package/dist/utilities/filterDataToSelectedLocales.spec.js +1 -2
  264. package/dist/utilities/filterDataToSelectedLocales.spec.js.map +1 -1
  265. package/dist/utilities/flattenAllFields.d.ts.map +1 -1
  266. package/dist/utilities/flattenAllFields.js +7 -22
  267. package/dist/utilities/flattenAllFields.js.map +1 -1
  268. package/dist/utilities/formatErrors.d.ts.map +1 -1
  269. package/dist/utilities/formatErrors.js +3 -1
  270. package/dist/utilities/formatErrors.js.map +1 -1
  271. package/dist/utilities/getEntityPermissions/populateFieldPermissions.d.ts.map +1 -1
  272. package/dist/utilities/getEntityPermissions/populateFieldPermissions.js +5 -5
  273. package/dist/utilities/getEntityPermissions/populateFieldPermissions.js.map +1 -1
  274. package/dist/utilities/getFieldByPath.d.ts.map +1 -1
  275. package/dist/utilities/getFieldByPath.js +1 -1
  276. package/dist/utilities/getFieldByPath.js.map +1 -1
  277. package/dist/utilities/getRequestLanguage.d.ts +2 -2
  278. package/dist/utilities/getRequestLanguage.d.ts.map +1 -1
  279. package/dist/utilities/getRequestLanguage.js.map +1 -1
  280. package/dist/utilities/getVersionsConfig.js.map +1 -1
  281. package/dist/utilities/handleEndpoints.d.ts.map +1 -1
  282. package/dist/utilities/handleEndpoints.js +7 -3
  283. package/dist/utilities/handleEndpoints.js.map +1 -1
  284. package/dist/utilities/isRSCEnabled.d.ts +12 -0
  285. package/dist/utilities/isRSCEnabled.d.ts.map +1 -0
  286. package/dist/utilities/isRSCEnabled.js +14 -0
  287. package/dist/utilities/isRSCEnabled.js.map +1 -0
  288. package/dist/utilities/mergeLocalizedData.d.ts +14 -4
  289. package/dist/utilities/mergeLocalizedData.d.ts.map +1 -1
  290. package/dist/utilities/mergeLocalizedData.js +54 -46
  291. package/dist/utilities/mergeLocalizedData.js.map +1 -1
  292. package/dist/utilities/mergeLocalizedData.spec.js +23 -23
  293. package/dist/utilities/mergeLocalizedData.spec.js.map +1 -1
  294. package/dist/utilities/parseParams/index.d.ts +2 -5
  295. package/dist/utilities/parseParams/index.d.ts.map +1 -1
  296. package/dist/utilities/parseParams/index.js.map +1 -1
  297. package/dist/utilities/parseParams/index.spec.js +0 -9
  298. package/dist/utilities/parseParams/index.spec.js.map +1 -1
  299. package/dist/utilities/telemetry/conf/envPaths.d.ts.map +1 -1
  300. package/dist/utilities/telemetry/conf/envPaths.js +31 -40
  301. package/dist/utilities/telemetry/conf/envPaths.js.map +1 -1
  302. package/dist/utilities/transformColumnPreferences.js +4 -2
  303. package/dist/utilities/transformColumnPreferences.js.map +1 -1
  304. package/dist/utilities/traverseFields.d.ts.map +1 -1
  305. package/dist/utilities/traverseFields.js +2 -4
  306. package/dist/utilities/traverseFields.js.map +1 -1
  307. package/dist/utilities/traverseForLocalizedFields.d.ts.map +1 -1
  308. package/dist/utilities/traverseForLocalizedFields.js +3 -0
  309. package/dist/utilities/traverseForLocalizedFields.js.map +1 -1
  310. package/dist/versions/baseFields.d.ts +1 -2
  311. package/dist/versions/baseFields.d.ts.map +1 -1
  312. package/dist/versions/baseFields.js +0 -13
  313. package/dist/versions/baseFields.js.map +1 -1
  314. package/dist/versions/buildCollectionFields.d.ts.map +1 -1
  315. package/dist/versions/buildCollectionFields.js +0 -2
  316. package/dist/versions/buildCollectionFields.js.map +1 -1
  317. package/dist/versions/buildGlobalFields.d.ts.map +1 -1
  318. package/dist/versions/buildGlobalFields.js +0 -2
  319. package/dist/versions/buildGlobalFields.js.map +1 -1
  320. package/dist/versions/buildSingleLocalePublishData.d.ts +32 -0
  321. package/dist/versions/buildSingleLocalePublishData.d.ts.map +1 -0
  322. package/dist/versions/buildSingleLocalePublishData.js +37 -0
  323. package/dist/versions/buildSingleLocalePublishData.js.map +1 -0
  324. package/dist/versions/saveVersion.d.ts +0 -2
  325. package/dist/versions/saveVersion.d.ts.map +1 -1
  326. package/dist/versions/saveVersion.js +12 -17
  327. package/dist/versions/saveVersion.js.map +1 -1
  328. package/dist/versions/schedule/job.d.ts.map +1 -1
  329. package/dist/versions/schedule/job.js +2 -9
  330. package/dist/versions/schedule/job.js.map +1 -1
  331. package/dist/versions/types.d.ts +2 -15
  332. package/dist/versions/types.d.ts.map +1 -1
  333. package/dist/versions/types.js.map +1 -1
  334. package/package.json +8 -5
  335. package/dist/database/migrations/templates/localizeStatus.d.ts +0 -10
  336. package/dist/database/migrations/templates/localizeStatus.d.ts.map +0 -1
  337. package/dist/database/migrations/templates/localizeStatus.js +0 -54
  338. package/dist/database/migrations/templates/localizeStatus.js.map +0 -1
  339. package/dist/versions/migrations/localizeStatus/index.d.ts +0 -12
  340. package/dist/versions/migrations/localizeStatus/index.d.ts.map +0 -1
  341. package/dist/versions/migrations/localizeStatus/index.js +0 -33
  342. package/dist/versions/migrations/localizeStatus/index.js.map +0 -1
  343. package/dist/versions/migrations/localizeStatus/mongo/down.d.ts +0 -9
  344. package/dist/versions/migrations/localizeStatus/mongo/down.d.ts.map +0 -1
  345. package/dist/versions/migrations/localizeStatus/mongo/down.js +0 -112
  346. package/dist/versions/migrations/localizeStatus/mongo/down.js.map +0 -1
  347. package/dist/versions/migrations/localizeStatus/mongo/index.d.ts +0 -8
  348. package/dist/versions/migrations/localizeStatus/mongo/index.d.ts.map +0 -1
  349. package/dist/versions/migrations/localizeStatus/mongo/index.js +0 -8
  350. package/dist/versions/migrations/localizeStatus/mongo/index.js.map +0 -1
  351. package/dist/versions/migrations/localizeStatus/mongo/up.d.ts +0 -9
  352. package/dist/versions/migrations/localizeStatus/mongo/up.d.ts.map +0 -1
  353. package/dist/versions/migrations/localizeStatus/mongo/up.js +0 -220
  354. package/dist/versions/migrations/localizeStatus/mongo/up.js.map +0 -1
  355. package/dist/versions/migrations/localizeStatus/sql/down.d.ts +0 -11
  356. package/dist/versions/migrations/localizeStatus/sql/down.d.ts.map +0 -1
  357. package/dist/versions/migrations/localizeStatus/sql/down.js +0 -213
  358. package/dist/versions/migrations/localizeStatus/sql/down.js.map +0 -1
  359. package/dist/versions/migrations/localizeStatus/sql/index.d.ts +0 -8
  360. package/dist/versions/migrations/localizeStatus/sql/index.d.ts.map +0 -1
  361. package/dist/versions/migrations/localizeStatus/sql/index.js +0 -8
  362. package/dist/versions/migrations/localizeStatus/sql/index.js.map +0 -1
  363. package/dist/versions/migrations/localizeStatus/sql/migrateMainCollection.d.ts +0 -13
  364. package/dist/versions/migrations/localizeStatus/sql/migrateMainCollection.d.ts.map +0 -1
  365. package/dist/versions/migrations/localizeStatus/sql/migrateMainCollection.js +0 -51
  366. package/dist/versions/migrations/localizeStatus/sql/migrateMainCollection.js.map +0 -1
  367. package/dist/versions/migrations/localizeStatus/sql/migrateMainGlobal.d.ts +0 -13
  368. package/dist/versions/migrations/localizeStatus/sql/migrateMainGlobal.d.ts.map +0 -1
  369. package/dist/versions/migrations/localizeStatus/sql/migrateMainGlobal.js +0 -54
  370. package/dist/versions/migrations/localizeStatus/sql/migrateMainGlobal.js.map +0 -1
  371. package/dist/versions/migrations/localizeStatus/sql/up.d.ts +0 -11
  372. package/dist/versions/migrations/localizeStatus/sql/up.d.ts.map +0 -1
  373. package/dist/versions/migrations/localizeStatus/sql/up.js +0 -277
  374. package/dist/versions/migrations/localizeStatus/sql/up.js.map +0 -1
  375. package/dist/versions/saveSnapshot.d.ts +0 -18
  376. package/dist/versions/saveSnapshot.d.ts.map +0 -1
  377. package/dist/versions/saveSnapshot.js +0 -38
  378. package/dist/versions/saveSnapshot.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { describe, it, expect } from 'vitest';
2
2
  import { sanitizeConfig } from '../config/sanitize.js';
3
- import { configToJSONSchema } from './configToJSONSchema.js';
3
+ import { configToJSONSchema, entityToStandaloneJSONSchema } from './configToJSONSchema.js';
4
4
  describe('configToJSONSchema', ()=>{
5
5
  it('should handle optional arrays with required fields', async ()=>{
6
6
  // @ts-expect-error
@@ -21,13 +21,14 @@ describe('configToJSONSchema', ()=>{
21
21
  ]
22
22
  }
23
23
  ],
24
- timestamps: false
24
+ timestamps: false,
25
+ versions: false
25
26
  }
26
27
  ]
27
28
  };
28
29
  const sanitizedConfig = await sanitizeConfig(config);
29
30
  const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text');
30
- expect(schema?.definitions?.test).toStrictEqual({
31
+ expect(schema?.$defs?.test).toStrictEqual({
31
32
  type: 'object',
32
33
  additionalProperties: false,
33
34
  properties: {
@@ -115,13 +116,14 @@ describe('configToJSONSchema', ()=>{
115
116
  ]
116
117
  }
117
118
  ],
118
- timestamps: false
119
+ timestamps: false,
120
+ versions: false
119
121
  }
120
122
  ]
121
123
  };
122
124
  const sanitizedConfig = await sanitizeConfig(config);
123
125
  const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text');
124
- expect(schema?.definitions?.test).toStrictEqual({
126
+ expect(schema?.$defs?.test).toStrictEqual({
125
127
  type: 'object',
126
128
  additionalProperties: false,
127
129
  properties: {
@@ -147,7 +149,7 @@ describe('configToJSONSchema', ()=>{
147
149
  items: {
148
150
  oneOf: [
149
151
  {
150
- $ref: '#/definitions/Test'
152
+ $ref: '#/$defs/Test'
151
153
  }
152
154
  ]
153
155
  }
@@ -160,7 +162,7 @@ describe('configToJSONSchema', ()=>{
160
162
  items: {
161
163
  oneOf: [
162
164
  {
163
- $ref: '#/definitions/TestRequired'
165
+ $ref: '#/$defs/TestRequired'
164
166
  }
165
167
  ]
166
168
  }
@@ -205,7 +207,8 @@ describe('configToJSONSchema', ()=>{
205
207
  ]
206
208
  }
207
209
  ],
208
- timestamps: false
210
+ timestamps: false,
211
+ versions: false
209
212
  },
210
213
  {
211
214
  slug: 'posts',
@@ -227,13 +230,14 @@ describe('configToJSONSchema', ()=>{
227
230
  ]
228
231
  }
229
232
  ],
230
- timestamps: false
233
+ timestamps: false,
234
+ versions: false
231
235
  }
232
236
  ]
233
237
  };
234
238
  const sanitizedConfig = await sanitizeConfig(config);
235
239
  const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text');
236
- const defs = schema.definitions;
240
+ const defs = schema.$defs;
237
241
  // The first `hero` keeps the clean name; the unique block is unaffected.
238
242
  expect(defs.Hero).toBeDefined();
239
243
  expect(defs.Cta).toBeDefined();
@@ -245,14 +249,14 @@ describe('configToJSONSchema', ()=>{
245
249
  expect(defs.Hero.description).toBeUndefined();
246
250
  // Each collection's block field references its own block's interface.
247
251
  const refsOf = (slug)=>defs[slug].properties.layout.items.oneOf.map((r)=>r.$ref);
248
- expect(refsOf('pages')).toContain('#/definitions/Hero');
249
- expect(refsOf('pages')).toContain('#/definitions/Cta');
252
+ expect(refsOf('pages')).toContain('#/$defs/Hero');
253
+ expect(refsOf('pages')).toContain('#/$defs/Cta');
250
254
  expect(refsOf('posts')).toStrictEqual([
251
- `#/definitions/${hashedHeroNames[0]}`
255
+ `#/$defs/${hashedHeroNames[0]}`
252
256
  ]);
253
257
  // Hashing is deterministic: regenerating yields identical names.
254
258
  const { jsonSchema: schema2 } = configToJSONSchema(sanitizedConfig, 'text');
255
- expect(Object.keys(schema2.definitions).filter((k)=>/^Hero/.test(k)).sort()).toStrictEqual(Object.keys(defs).filter((k)=>/^Hero/.test(k)).sort());
259
+ expect(Object.keys(schema2.$defs).filter((k)=>/^Hero/.test(k)).sort()).toStrictEqual(Object.keys(defs).filter((k)=>/^Hero/.test(k)).sort());
256
260
  });
257
261
  it('should handle tabs and named tabs with required fields', async ()=>{
258
262
  // @ts-expect-error
@@ -297,13 +301,14 @@ describe('configToJSONSchema', ()=>{
297
301
  ]
298
302
  }
299
303
  ],
300
- timestamps: false
304
+ timestamps: false,
305
+ versions: false
301
306
  }
302
307
  ]
303
308
  };
304
309
  const sanitizedConfig = await sanitizeConfig(config);
305
310
  const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text');
306
- expect(schema?.definitions?.test).toStrictEqual({
311
+ expect(schema?.$defs?.test).toStrictEqual({
307
312
  type: 'object',
308
313
  additionalProperties: false,
309
314
  properties: {
@@ -385,13 +390,14 @@ describe('configToJSONSchema', ()=>{
385
390
  }
386
391
  }
387
392
  ],
388
- timestamps: false
393
+ timestamps: false,
394
+ versions: false
389
395
  }
390
396
  ]
391
397
  };
392
398
  const sanitizedConfig = await sanitizeConfig(config);
393
399
  const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text');
394
- expect(schema?.definitions?.test).toStrictEqual({
400
+ expect(schema?.$defs?.test).toStrictEqual({
395
401
  type: 'object',
396
402
  additionalProperties: false,
397
403
  properties: {
@@ -443,7 +449,8 @@ describe('configToJSONSchema', ()=>{
443
449
  ]
444
450
  }
445
451
  ],
446
- timestamps: false
452
+ timestamps: false,
453
+ versions: false
447
454
  }
448
455
  ]
449
456
  };
@@ -485,7 +492,7 @@ describe('configToJSONSchema', ()=>{
485
492
  'blockType'
486
493
  ]
487
494
  };
488
- expect(schema?.definitions?.test).toStrictEqual({
495
+ expect(schema?.$defs?.test).toStrictEqual({
489
496
  type: 'object',
490
497
  additionalProperties: false,
491
498
  title: 'Test',
@@ -501,7 +508,7 @@ describe('configToJSONSchema', ()=>{
501
508
  items: {
502
509
  oneOf: [
503
510
  {
504
- $ref: '#/definitions/SharedBlock'
511
+ $ref: '#/$defs/SharedBlock'
505
512
  }
506
513
  ]
507
514
  }
@@ -512,7 +519,100 @@ describe('configToJSONSchema', ()=>{
512
519
  ]
513
520
  });
514
521
  // The definition should still be registered for TypeScript type generation
515
- expect(schema?.definitions?.SharedBlock).toStrictEqual(expectedBlockSchema);
522
+ expect(schema?.$defs?.SharedBlock).toStrictEqual(expectedBlockSchema);
523
+ });
524
+ it('content-hashes a colliding explicit interfaceName instead of overwriting it', async ()=>{
525
+ // Two different blocks both set `interfaceName: 'Hero'` - each must keep its own definition.
526
+ const config = {
527
+ collections: [
528
+ {
529
+ slug: 'test',
530
+ fields: [
531
+ {
532
+ name: 'blocksField',
533
+ type: 'blocks',
534
+ blocks: [
535
+ {
536
+ slug: 'blockA',
537
+ fields: [
538
+ {
539
+ name: 'title',
540
+ type: 'text'
541
+ }
542
+ ],
543
+ interfaceName: 'Hero'
544
+ },
545
+ {
546
+ slug: 'blockB',
547
+ fields: [
548
+ {
549
+ name: 'subtitle',
550
+ type: 'number'
551
+ }
552
+ ],
553
+ interfaceName: 'Hero'
554
+ }
555
+ ]
556
+ }
557
+ ],
558
+ timestamps: false,
559
+ versions: false
560
+ }
561
+ ]
562
+ };
563
+ const sanitizedConfig = await sanitizeConfig(config);
564
+ const { jsonSchema } = configToJSONSchema(sanitizedConfig, 'text');
565
+ const defs = jsonSchema.$defs;
566
+ // Each differently-shaped block keeps its own interface (one clean, one hash-suffixed).
567
+ const heroNames = Object.keys(defs).filter((k)=>/^Hero(_[0-9A-F]{8})?$/.test(k));
568
+ expect(heroNames).toHaveLength(2);
569
+ // ...and they carry distinct field shapes (not a silent overwrite).
570
+ const shapeOf = (name)=>Object.keys(defs[name].properties).sort().join(',');
571
+ expect(shapeOf(heroNames[0])).not.toBe(shapeOf(heroNames[1]));
572
+ });
573
+ it('reuses one definition when the same block is registered more than once', async ()=>{
574
+ // Reusing one block across fields registers an identical schema each time, so it dedupes.
575
+ const heroBlock = {
576
+ slug: 'hero',
577
+ fields: [
578
+ {
579
+ name: 'title',
580
+ type: 'text'
581
+ }
582
+ ],
583
+ interfaceName: 'Hero'
584
+ };
585
+ const config = {
586
+ collections: [
587
+ {
588
+ slug: 'test',
589
+ fields: [
590
+ {
591
+ name: 'a',
592
+ type: 'blocks',
593
+ blocks: [
594
+ heroBlock
595
+ ]
596
+ },
597
+ {
598
+ name: 'b',
599
+ type: 'blocks',
600
+ blocks: [
601
+ heroBlock
602
+ ]
603
+ }
604
+ ],
605
+ timestamps: false,
606
+ versions: false
607
+ }
608
+ ]
609
+ };
610
+ const sanitizedConfig = await sanitizeConfig(config);
611
+ const { jsonSchema } = configToJSONSchema(sanitizedConfig, 'text');
612
+ const heroNames = Object.keys(jsonSchema.$defs).filter((k)=>/^Hero(_[0-9A-F]{8})?$/.test(k));
613
+ expect(heroNames).toEqual([
614
+ 'Hero'
615
+ ]);
516
616
  });
517
617
  it('should allow overriding required to false', async ()=>{
518
618
  // @ts-expect-error
@@ -534,14 +634,15 @@ describe('configToJSONSchema', ()=>{
534
634
  ]
535
635
  }
536
636
  ],
537
- timestamps: false
637
+ timestamps: false,
638
+ versions: false
538
639
  }
539
640
  ]
540
641
  };
541
642
  const sanitizedConfig = await sanitizeConfig(config);
542
643
  const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text');
543
644
  // @ts-expect-error
544
- expect(schema.definitions.test.properties.title.required).toStrictEqual(false);
645
+ expect(schema.$defs.test.properties.title.required).toStrictEqual(false);
545
646
  });
546
647
  it('should propagate forceInlineBlocks to nested fields (array, group, tab)', async ()=>{
547
648
  const namedBlock = {
@@ -587,34 +688,119 @@ describe('configToJSONSchema', ()=>{
587
688
  ]
588
689
  }
589
690
  ],
590
- timestamps: false
691
+ timestamps: false,
692
+ versions: false
591
693
  }
592
694
  ]
593
695
  };
594
696
  const sanitizedConfig = await sanitizeConfig(config);
595
697
  // Without forceInlineBlocks: blocks field uses $ref
596
698
  const { jsonSchema: schemaDefault } = configToJSONSchema(sanitizedConfig, 'text');
597
- const arrItemsDefault = schemaDefault.definitions.test.properties.arr.items;
699
+ const arrItemsDefault = schemaDefault.$defs.test.properties.arr.items;
598
700
  const arrBlocksDefault = arrItemsDefault.properties.blocks.items.oneOf[0];
599
701
  expect(arrBlocksDefault).toStrictEqual({
600
- $ref: '#/definitions/MyBlock'
702
+ $ref: '#/$defs/MyBlock'
601
703
  });
602
704
  // With forceInlineBlocks: blocks field is inlined, no $ref
603
705
  const { jsonSchema: schemaInline } = configToJSONSchema(sanitizedConfig, 'text', undefined, {
604
706
  forceInlineBlocks: true
605
707
  });
606
- const arrItemsInline = schemaInline.definitions.test.properties.arr.items;
708
+ const arrItemsInline = schemaInline.$defs.test.properties.arr.items;
607
709
  const arrBlocksInline = arrItemsInline.properties.blocks.items.oneOf[0];
608
710
  expect(arrBlocksInline).not.toHaveProperty('$ref');
609
711
  expect(arrBlocksInline.properties?.blockType).toStrictEqual({
610
712
  const: 'myBlock'
611
713
  });
612
- const grpBlocksInline = schemaInline.definitions.test.properties.grp.properties.blocks.items.oneOf[0];
714
+ const grpBlocksInline = schemaInline.$defs.test.properties.grp.properties.blocks.items.oneOf[0];
613
715
  expect(grpBlocksInline).not.toHaveProperty('$ref');
614
716
  expect(grpBlocksInline.properties?.blockType).toStrictEqual({
615
717
  const: 'myBlock'
616
718
  });
617
719
  });
720
+ it('entityToStandaloneJSONSchema bundles only the definitions an entity references', async ()=>{
721
+ const sharedBlock = {
722
+ slug: 'sharedBlock',
723
+ interfaceName: 'SharedBlock',
724
+ fields: [
725
+ {
726
+ name: 'title',
727
+ type: 'text'
728
+ }
729
+ ]
730
+ };
731
+ // @ts-expect-error partial config
732
+ const config = {
733
+ admin: {
734
+ timezones: {
735
+ supportedTimezones: [
736
+ {
737
+ label: 'UTC',
738
+ value: 'UTC'
739
+ },
740
+ {
741
+ label: 'New York',
742
+ value: 'America/New_York'
743
+ }
744
+ ]
745
+ }
746
+ },
747
+ blocks: [
748
+ sharedBlock
749
+ ],
750
+ collections: [
751
+ {
752
+ slug: 'with-refs',
753
+ fields: [
754
+ {
755
+ name: 'layout',
756
+ type: 'blocks',
757
+ blocks: [
758
+ 'sharedBlock'
759
+ ]
760
+ },
761
+ {
762
+ name: 'when',
763
+ type: 'date',
764
+ timezone: true
765
+ }
766
+ ],
767
+ timestamps: false,
768
+ versions: false
769
+ },
770
+ {
771
+ slug: 'other',
772
+ fields: [
773
+ {
774
+ name: 'title',
775
+ type: 'text'
776
+ }
777
+ ],
778
+ timestamps: false,
779
+ versions: false
780
+ }
781
+ ]
782
+ };
783
+ const sanitizedConfig = await sanitizeConfig(config);
784
+ const entity = sanitizedConfig.collections.find((collection)=>collection.slug === 'with-refs');
785
+ const schema = entityToStandaloneJSONSchema({
786
+ config: sanitizedConfig,
787
+ defaultIDType: 'text',
788
+ entity
789
+ });
790
+ // Has its own $schema, so it resolves on its own.
791
+ expect(schema.$schema).toBe('https://json-schema.org/draft/2020-12/schema');
792
+ // The block reference is resolved inline, so it can't dangle.
793
+ const layoutItems = schema.properties?.layout?.items;
794
+ const inlinedBlock = layoutItems?.oneOf?.[0] ?? {};
795
+ expect(inlinedBlock.properties?.blockType).toStrictEqual({
796
+ const: 'sharedBlock'
797
+ });
798
+ expect(inlinedBlock.properties?.title).toBeDefined();
799
+ // A timezone field pulls in supportedTimezones from the root config.
800
+ expect(schema.$defs?.supportedTimezones).toBeDefined();
801
+ // Doesn't pull in unrelated collections.
802
+ expect(schema.$defs?.other).toBeUndefined();
803
+ });
618
804
  });
619
805
 
620
806
  //# sourceMappingURL=configToJSONSchema.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/configToJSONSchema.spec.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\nimport { describe, it, expect } from 'vitest'\n\nimport type { Config } from '../config/types.js'\n\nimport { sanitizeConfig } from '../config/sanitize.js'\nimport { configToJSONSchema } from './configToJSONSchema.js'\nimport type { Block, BlocksField, RichTextField } from '../fields/config/types.js'\n\ndescribe('configToJSONSchema', () => {\n it('should handle optional arrays with required fields', async () => {\n // @ts-expect-error\n const config: Config = {\n collections: [\n {\n slug: 'test',\n fields: [\n {\n name: 'someRequiredField',\n type: 'array',\n fields: [\n {\n name: 'someRequiredField',\n type: 'text',\n required: true,\n },\n ],\n },\n ],\n timestamps: false,\n },\n ],\n }\n\n const sanitizedConfig = await sanitizeConfig(config)\n const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text')\n\n expect(schema?.definitions?.test).toStrictEqual({\n type: 'object',\n additionalProperties: false,\n properties: {\n id: {\n type: 'string',\n },\n someRequiredField: {\n type: ['array', 'null'],\n items: {\n type: 'object',\n additionalProperties: false,\n properties: {\n id: {\n type: ['string', 'null'],\n },\n someRequiredField: {\n type: 'string',\n },\n },\n required: ['someRequiredField'],\n },\n },\n },\n required: ['id'],\n title: 'Test',\n })\n })\n\n it('should handle block fields with no blocks', async () => {\n // @ts-expect-error\n const config: Config = {\n collections: [\n {\n slug: 'test',\n fields: [\n {\n name: 'blockField',\n type: 'blocks',\n blocks: [],\n },\n {\n name: 'blockFieldRequired',\n type: 'blocks',\n blocks: [],\n required: true,\n },\n {\n name: 'blockFieldWithFields',\n type: 'blocks',\n blocks: [\n {\n slug: 'test',\n fields: [\n {\n name: 'field',\n type: 'text',\n },\n ],\n },\n ],\n },\n {\n name: 'blockFieldWithFieldsRequired',\n type: 'blocks',\n blocks: [\n {\n slug: 'testRequired',\n fields: [\n {\n name: 'field',\n type: 'text',\n required: true,\n },\n ],\n },\n ],\n },\n ],\n timestamps: false,\n },\n ],\n }\n\n const sanitizedConfig = await sanitizeConfig(config)\n const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text')\n\n expect(schema?.definitions?.test).toStrictEqual({\n type: 'object',\n additionalProperties: false,\n properties: {\n id: {\n type: 'string',\n },\n blockField: {\n type: ['array', 'null'],\n items: {},\n },\n blockFieldRequired: {\n type: 'array',\n items: {},\n },\n blockFieldWithFields: {\n type: ['array', 'null'],\n items: {\n oneOf: [{ $ref: '#/definitions/Test' }],\n },\n },\n blockFieldWithFieldsRequired: {\n type: ['array', 'null'],\n items: {\n oneOf: [{ $ref: '#/definitions/TestRequired' }],\n },\n },\n },\n required: ['id', 'blockFieldRequired'],\n title: 'Test',\n })\n })\n\n it('keeps the first block interface name clean and content-hashes the colliding one', async () => {\n // @ts-expect-error - partial config for testing\n const config: Config = {\n collections: [\n {\n slug: 'pages',\n fields: [\n {\n name: 'layout',\n type: 'blocks',\n blocks: [\n { slug: 'hero', fields: [{ name: 'title', type: 'text' }] },\n { slug: 'cta', fields: [{ name: 'label', type: 'text' }] },\n ],\n },\n ],\n timestamps: false,\n },\n {\n slug: 'posts',\n fields: [\n {\n name: 'layout',\n type: 'blocks',\n // Same slug `hero`, DIFFERENT fields → name collision with pages' hero.\n blocks: [{ slug: 'hero', fields: [{ name: 'heading', type: 'text' }] }],\n },\n ],\n timestamps: false,\n },\n ],\n }\n\n const sanitizedConfig = await sanitizeConfig(config)\n const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text')\n const defs = schema.definitions!\n\n // The first `hero` keeps the clean name; the unique block is unaffected.\n expect(defs.Hero).toBeDefined()\n expect(defs.Cta).toBeDefined()\n\n // Only the second, differently-shaped `hero` is disambiguated with a content hash.\n const hashedHeroNames = Object.keys(defs).filter((k) => /^Hero_[0-9A-F]{8}$/.test(k))\n expect(hashedHeroNames).toHaveLength(1)\n\n // The disambiguated interface carries the explanatory JSDoc note; the clean one does not.\n expect((defs[hashedHeroNames[0]!] as { description?: string }).description).toContain(\n 'content hash',\n )\n expect((defs.Hero as { description?: string }).description).toBeUndefined()\n\n // Each collection's block field references its own block's interface.\n const refsOf = (slug: string): string[] =>\n (\n defs[slug] as { properties: { layout: { items: { oneOf: Array<{ $ref: string }> } } } }\n ).properties.layout.items.oneOf.map((r) => r.$ref)\n expect(refsOf('pages')).toContain('#/definitions/Hero')\n expect(refsOf('pages')).toContain('#/definitions/Cta')\n expect(refsOf('posts')).toStrictEqual([`#/definitions/${hashedHeroNames[0]}`])\n\n // Hashing is deterministic: regenerating yields identical names.\n const { jsonSchema: schema2 } = configToJSONSchema(sanitizedConfig, 'text')\n expect(\n Object.keys(schema2.definitions!)\n .filter((k) => /^Hero/.test(k))\n .sort(),\n ).toStrictEqual(\n Object.keys(defs)\n .filter((k) => /^Hero/.test(k))\n .sort(),\n )\n })\n\n it('should handle tabs and named tabs with required fields', async () => {\n // @ts-expect-error\n const config: Config = {\n collections: [\n {\n slug: 'test',\n fields: [\n {\n type: 'tabs',\n tabs: [\n {\n fields: [\n {\n name: 'fieldInUnnamedTab',\n type: 'text',\n },\n ],\n label: 'unnamedTab',\n },\n {\n name: 'namedTab',\n fields: [\n {\n name: 'fieldInNamedTab',\n type: 'text',\n },\n ],\n label: 'namedTab',\n },\n {\n name: 'namedTabWithRequired',\n fields: [\n {\n name: 'fieldInNamedTab',\n type: 'text',\n required: true,\n },\n ],\n label: 'namedTabWithRequired',\n },\n ],\n },\n ],\n timestamps: false,\n },\n ],\n }\n\n const sanitizedConfig = await sanitizeConfig(config)\n const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text')\n\n expect(schema?.definitions?.test).toStrictEqual({\n type: 'object',\n additionalProperties: false,\n properties: {\n id: {\n type: 'string',\n },\n fieldInUnnamedTab: {\n type: ['string', 'null'],\n },\n namedTab: {\n type: 'object',\n additionalProperties: false,\n properties: {\n fieldInNamedTab: {\n type: ['string', 'null'],\n },\n },\n required: [],\n },\n namedTabWithRequired: {\n type: 'object',\n additionalProperties: false,\n properties: {\n fieldInNamedTab: {\n type: 'string',\n },\n },\n required: ['fieldInNamedTab'],\n },\n },\n required: ['id', 'namedTabWithRequired'],\n title: 'Test',\n })\n })\n\n it('should handle custom typescript schema and JSON field schema', async () => {\n const customSchema: JSONSchema4 = {\n type: 'object',\n properties: {\n id: {\n type: 'number',\n },\n required: ['id'],\n },\n }\n\n const config: Partial<Config> = {\n collections: [\n {\n slug: 'test',\n fields: [\n {\n name: 'withCustom',\n type: 'text',\n jsonSchema: [() => customSchema],\n },\n {\n name: 'jsonWithSchema',\n type: 'json',\n jsonSchema: {\n fileMatch: ['a://b/foo.json'],\n schema: customSchema,\n uri: 'a://b/foo.json',\n },\n },\n ],\n timestamps: false,\n },\n ],\n }\n\n const sanitizedConfig = await sanitizeConfig(config as Config)\n const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text')\n\n expect(schema?.definitions?.test).toStrictEqual({\n type: 'object',\n additionalProperties: false,\n properties: {\n id: {\n type: 'string',\n },\n jsonWithSchema: customSchema,\n withCustom: customSchema,\n },\n required: ['id'],\n title: 'Test',\n })\n })\n\n it('should handle same block object being referenced in both collection and config.blocks', async () => {\n const sharedBlock: Block = {\n slug: 'sharedBlock',\n interfaceName: 'SharedBlock',\n fields: [\n {\n name: 'richText',\n type: 'richText',\n editor: () => {\n // stub rich text editor\n return {\n CellComponent: '',\n FieldComponent: '',\n validate: () => true,\n }\n },\n },\n ],\n }\n\n // @ts-expect-error\n const config: Config = {\n blocks: [sharedBlock],\n collections: [\n {\n slug: 'test',\n fields: [\n {\n name: 'someBlockField',\n type: 'blocks',\n blocks: [sharedBlock],\n },\n ],\n timestamps: false,\n },\n ],\n }\n\n // Ensure both rich text editor are sanitized\n const sanitizedConfig = await sanitizeConfig(config)\n expect(typeof (sanitizedConfig?.blocks?.[0]?.fields?.[0] as RichTextField)?.editor).toBe(\n 'object',\n )\n expect(\n typeof (\n (sanitizedConfig.collections[0].fields[0] as BlocksField)?.blocks?.[0]\n ?.fields?.[0] as RichTextField\n )?.editor,\n ).toBe('object')\n\n const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text')\n\n const expectedBlockSchema = {\n type: 'object',\n additionalProperties: false,\n properties: {\n id: { type: ['string', 'null'] },\n blockName: { type: ['string', 'null'] },\n blockType: { const: 'sharedBlock' },\n richText: { type: ['array', 'null'], items: { type: 'object' } },\n },\n required: ['blockType'],\n }\n\n expect(schema?.definitions?.test).toStrictEqual({\n type: 'object',\n additionalProperties: false,\n title: 'Test',\n properties: {\n id: {\n type: 'string',\n },\n someBlockField: {\n type: ['array', 'null'],\n items: {\n oneOf: [\n {\n $ref: '#/definitions/SharedBlock',\n },\n ],\n },\n },\n },\n required: ['id'],\n })\n\n // The definition should still be registered for TypeScript type generation\n expect(schema?.definitions?.SharedBlock).toStrictEqual(expectedBlockSchema)\n })\n\n it('should allow overriding required to false', async () => {\n // @ts-expect-error\n const config: Config = {\n collections: [\n {\n slug: 'test',\n fields: [\n {\n name: 'title',\n type: 'text',\n required: true,\n defaultValue: 'test',\n jsonSchema: [\n () => ({\n type: 'string',\n required: false,\n }),\n ],\n },\n ],\n timestamps: false,\n },\n ],\n }\n\n const sanitizedConfig = await sanitizeConfig(config)\n const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text')\n\n // @ts-expect-error\n expect(schema.definitions.test.properties.title.required).toStrictEqual(false)\n })\n\n it('should propagate forceInlineBlocks to nested fields (array, group, tab)', async () => {\n const namedBlock: Block = {\n slug: 'myBlock',\n interfaceName: 'MyBlock',\n fields: [{ name: 'text', type: 'text' }],\n }\n\n // @ts-expect-error\n const config: Config = {\n collections: [\n {\n slug: 'test',\n fields: [\n {\n name: 'arr',\n type: 'array',\n fields: [{ name: 'blocks', type: 'blocks', blocks: [namedBlock] }],\n },\n {\n name: 'grp',\n type: 'group',\n fields: [{ name: 'blocks', type: 'blocks', blocks: [namedBlock] }],\n },\n ],\n timestamps: false,\n },\n ],\n }\n\n const sanitizedConfig = await sanitizeConfig(config)\n\n // Without forceInlineBlocks: blocks field uses $ref\n const { jsonSchema: schemaDefault } = configToJSONSchema(sanitizedConfig, 'text')\n const arrItemsDefault = schemaDefault.definitions!.test.properties!.arr.items as JSONSchema4\n const arrBlocksDefault = (arrItemsDefault.properties!.blocks.items as JSONSchema4).oneOf![0]\n expect(arrBlocksDefault).toStrictEqual({ $ref: '#/definitions/MyBlock' })\n\n // With forceInlineBlocks: blocks field is inlined, no $ref\n const { jsonSchema: schemaInline } = configToJSONSchema(sanitizedConfig, 'text', undefined, {\n forceInlineBlocks: true,\n })\n const arrItemsInline = schemaInline.definitions!.test.properties!.arr.items as JSONSchema4\n const arrBlocksInline = (arrItemsInline.properties!.blocks.items as JSONSchema4).oneOf![0]\n expect(arrBlocksInline).not.toHaveProperty('$ref')\n expect(arrBlocksInline.properties?.blockType).toStrictEqual({ const: 'myBlock' })\n\n const grpBlocksInline = (\n schemaInline.definitions!.test.properties!.grp.properties!.blocks.items as JSONSchema4\n ).oneOf![0]\n expect(grpBlocksInline).not.toHaveProperty('$ref')\n expect(grpBlocksInline.properties?.blockType).toStrictEqual({ const: 'myBlock' })\n })\n})\n"],"names":["describe","it","expect","sanitizeConfig","configToJSONSchema","config","collections","slug","fields","name","type","required","timestamps","sanitizedConfig","jsonSchema","schema","definitions","test","toStrictEqual","additionalProperties","properties","id","someRequiredField","items","title","blocks","blockField","blockFieldRequired","blockFieldWithFields","oneOf","$ref","blockFieldWithFieldsRequired","defs","Hero","toBeDefined","Cta","hashedHeroNames","Object","keys","filter","k","toHaveLength","description","toContain","toBeUndefined","refsOf","layout","map","r","schema2","sort","tabs","label","fieldInUnnamedTab","namedTab","fieldInNamedTab","namedTabWithRequired","customSchema","fileMatch","uri","jsonWithSchema","withCustom","sharedBlock","interfaceName","editor","CellComponent","FieldComponent","validate","toBe","expectedBlockSchema","blockName","blockType","const","richText","someBlockField","SharedBlock","defaultValue","namedBlock","schemaDefault","arrItemsDefault","arr","arrBlocksDefault","schemaInline","undefined","forceInlineBlocks","arrItemsInline","arrBlocksInline","not","toHaveProperty","grpBlocksInline","grp"],"mappings":"AACA,SAASA,QAAQ,EAAEC,EAAE,EAAEC,MAAM,QAAQ,SAAQ;AAI7C,SAASC,cAAc,QAAQ,wBAAuB;AACtD,SAASC,kBAAkB,QAAQ,0BAAyB;AAG5DJ,SAAS,sBAAsB;IAC7BC,GAAG,sDAAsD;QACvD,mBAAmB;QACnB,MAAMI,SAAiB;YACrBC,aAAa;gBACX;oBACEC,MAAM;oBACNC,QAAQ;wBACN;4BACEC,MAAM;4BACNC,MAAM;4BACNF,QAAQ;gCACN;oCACEC,MAAM;oCACNC,MAAM;oCACNC,UAAU;gCACZ;6BACD;wBACH;qBACD;oBACDC,YAAY;gBACd;aACD;QACH;QAEA,MAAMC,kBAAkB,MAAMV,eAAeE;QAC7C,MAAM,EAAES,YAAYC,MAAM,EA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AACzD,KAAK;QAC3E,MAAM+D,kBAAkB,AAACD,eAAejE,UAAU,CAAEK,MAAM,CAACF,KAAK,CAAiBM,KAAK,AAAC,CAAC,EAAE;QAC1F3B,OAAOoF,iBAAiBC,GAAG,CAACC,cAAc,CAAC;QAC3CtF,OAAOoF,gBAAgBlE,UAAU,EAAEmD,WAAWrD,aAAa,CAAC;YAAEsD,OAAO;QAAU;QAE/E,MAAMiB,kBAAkB,AACtBP,aAAalE,WAAW,CAAEC,IAAI,CAACG,UAAU,CAAEsE,GAAG,CAACtE,UAAU,CAAEK,MAAM,CAACF,KAAK,CACvEM,KAAK,AAAC,CAAC,EAAE;QACX3B,OAAOuF,iBAAiBF,GAAG,CAACC,cAAc,CAAC;QAC3CtF,OAAOuF,gBAAgBrE,UAAU,EAAEmD,WAAWrD,aAAa,CAAC;YAAEsD,OAAO;QAAU;IACjF;AACF"}
1
+ {"version":3,"sources":["../../src/utilities/configToJSONSchema.spec.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\nimport { describe, it, expect } from 'vitest'\n\nimport type { Config } from '../config/types.js'\n\nimport { sanitizeConfig } from '../config/sanitize.js'\nimport { configToJSONSchema, entityToStandaloneJSONSchema } from './configToJSONSchema.js'\nimport type { Block, BlocksField, RichTextField } from '../fields/config/types.js'\n\ndescribe('configToJSONSchema', () => {\n it('should handle optional arrays with required fields', async () => {\n // @ts-expect-error\n const config: Config = {\n collections: [\n {\n slug: 'test',\n fields: [\n {\n name: 'someRequiredField',\n type: 'array',\n fields: [\n {\n name: 'someRequiredField',\n type: 'text',\n required: true,\n },\n ],\n },\n ],\n timestamps: false,\n versions: false,\n },\n ],\n }\n\n const sanitizedConfig = await sanitizeConfig(config)\n const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text')\n\n expect(schema?.$defs?.test).toStrictEqual({\n type: 'object',\n additionalProperties: false,\n properties: {\n id: {\n type: 'string',\n },\n someRequiredField: {\n type: ['array', 'null'],\n items: {\n type: 'object',\n additionalProperties: false,\n properties: {\n id: {\n type: ['string', 'null'],\n },\n someRequiredField: {\n type: 'string',\n },\n },\n required: ['someRequiredField'],\n },\n },\n },\n required: ['id'],\n title: 'Test',\n })\n })\n\n it('should handle block fields with no blocks', async () => {\n // @ts-expect-error\n const config: Config = {\n collections: [\n {\n slug: 'test',\n fields: [\n {\n name: 'blockField',\n type: 'blocks',\n blocks: [],\n },\n {\n name: 'blockFieldRequired',\n type: 'blocks',\n blocks: [],\n required: true,\n },\n {\n name: 'blockFieldWithFields',\n type: 'blocks',\n blocks: [\n {\n slug: 'test',\n fields: [\n {\n name: 'field',\n type: 'text',\n },\n ],\n },\n ],\n },\n {\n name: 'blockFieldWithFieldsRequired',\n type: 'blocks',\n blocks: [\n {\n slug: 'testRequired',\n fields: [\n {\n name: 'field',\n type: 'text',\n required: true,\n },\n ],\n },\n ],\n },\n ],\n timestamps: false,\n versions: false,\n },\n ],\n }\n\n const sanitizedConfig = await sanitizeConfig(config)\n const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text')\n\n expect(schema?.$defs?.test).toStrictEqual({\n type: 'object',\n additionalProperties: false,\n properties: {\n id: {\n type: 'string',\n },\n blockField: {\n type: ['array', 'null'],\n items: {},\n },\n blockFieldRequired: {\n type: 'array',\n items: {},\n },\n blockFieldWithFields: {\n type: ['array', 'null'],\n items: {\n oneOf: [{ $ref: '#/$defs/Test' }],\n },\n },\n blockFieldWithFieldsRequired: {\n type: ['array', 'null'],\n items: {\n oneOf: [{ $ref: '#/$defs/TestRequired' }],\n },\n },\n },\n required: ['id', 'blockFieldRequired'],\n title: 'Test',\n })\n })\n\n it('keeps the first block interface name clean and content-hashes the colliding one', async () => {\n // @ts-expect-error - partial config for testing\n const config: Config = {\n collections: [\n {\n slug: 'pages',\n fields: [\n {\n name: 'layout',\n type: 'blocks',\n blocks: [\n { slug: 'hero', fields: [{ name: 'title', type: 'text' }] },\n { slug: 'cta', fields: [{ name: 'label', type: 'text' }] },\n ],\n },\n ],\n timestamps: false,\n versions: false,\n },\n {\n slug: 'posts',\n fields: [\n {\n name: 'layout',\n type: 'blocks',\n // Same slug `hero`, DIFFERENT fields → name collision with pages' hero.\n blocks: [{ slug: 'hero', fields: [{ name: 'heading', type: 'text' }] }],\n },\n ],\n timestamps: false,\n versions: false,\n },\n ],\n }\n\n const sanitizedConfig = await sanitizeConfig(config)\n const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text')\n const defs = schema.$defs!\n\n // The first `hero` keeps the clean name; the unique block is unaffected.\n expect(defs.Hero).toBeDefined()\n expect(defs.Cta).toBeDefined()\n\n // Only the second, differently-shaped `hero` is disambiguated with a content hash.\n const hashedHeroNames = Object.keys(defs).filter((k) => /^Hero_[0-9A-F]{8}$/.test(k))\n expect(hashedHeroNames).toHaveLength(1)\n\n // The disambiguated interface carries the explanatory JSDoc note; the clean one does not.\n expect((defs[hashedHeroNames[0]!] as { description?: string }).description).toContain(\n 'content hash',\n )\n expect((defs.Hero as { description?: string }).description).toBeUndefined()\n\n // Each collection's block field references its own block's interface.\n const refsOf = (slug: string): string[] =>\n (\n defs[slug] as { properties: { layout: { items: { oneOf: Array<{ $ref: string }> } } } }\n ).properties.layout.items.oneOf.map((r) => r.$ref)\n expect(refsOf('pages')).toContain('#/$defs/Hero')\n expect(refsOf('pages')).toContain('#/$defs/Cta')\n expect(refsOf('posts')).toStrictEqual([`#/$defs/${hashedHeroNames[0]}`])\n\n // Hashing is deterministic: regenerating yields identical names.\n const { jsonSchema: schema2 } = configToJSONSchema(sanitizedConfig, 'text')\n expect(\n Object.keys(schema2.$defs!)\n .filter((k) => /^Hero/.test(k))\n .sort(),\n ).toStrictEqual(\n Object.keys(defs)\n .filter((k) => /^Hero/.test(k))\n .sort(),\n )\n })\n\n it('should handle tabs and named tabs with required fields', async () => {\n // @ts-expect-error\n const config: Config = {\n collections: [\n {\n slug: 'test',\n fields: [\n {\n type: 'tabs',\n tabs: [\n {\n fields: [\n {\n name: 'fieldInUnnamedTab',\n type: 'text',\n },\n ],\n label: 'unnamedTab',\n },\n {\n name: 'namedTab',\n fields: [\n {\n name: 'fieldInNamedTab',\n type: 'text',\n },\n ],\n label: 'namedTab',\n },\n {\n name: 'namedTabWithRequired',\n fields: [\n {\n name: 'fieldInNamedTab',\n type: 'text',\n required: true,\n },\n ],\n label: 'namedTabWithRequired',\n },\n ],\n },\n ],\n timestamps: false,\n versions: false,\n },\n ],\n }\n\n const sanitizedConfig = await sanitizeConfig(config)\n const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text')\n\n expect(schema?.$defs?.test).toStrictEqual({\n type: 'object',\n additionalProperties: false,\n properties: {\n id: {\n type: 'string',\n },\n fieldInUnnamedTab: {\n type: ['string', 'null'],\n },\n namedTab: {\n type: 'object',\n additionalProperties: false,\n properties: {\n fieldInNamedTab: {\n type: ['string', 'null'],\n },\n },\n required: [],\n },\n namedTabWithRequired: {\n type: 'object',\n additionalProperties: false,\n properties: {\n fieldInNamedTab: {\n type: 'string',\n },\n },\n required: ['fieldInNamedTab'],\n },\n },\n required: ['id', 'namedTabWithRequired'],\n title: 'Test',\n })\n })\n\n it('should handle custom typescript schema and JSON field schema', async () => {\n const customSchema: JSONSchema4 = {\n type: 'object',\n properties: {\n id: {\n type: 'number',\n },\n required: ['id'],\n },\n }\n\n const config: Partial<Config> = {\n collections: [\n {\n slug: 'test',\n fields: [\n {\n name: 'withCustom',\n type: 'text',\n jsonSchema: [() => customSchema],\n },\n {\n name: 'jsonWithSchema',\n type: 'json',\n jsonSchema: {\n fileMatch: ['a://b/foo.json'],\n schema: customSchema,\n uri: 'a://b/foo.json',\n },\n },\n ],\n timestamps: false,\n versions: false,\n },\n ],\n }\n\n const sanitizedConfig = await sanitizeConfig(config as Config)\n const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text')\n\n expect(schema?.$defs?.test).toStrictEqual({\n type: 'object',\n additionalProperties: false,\n properties: {\n id: {\n type: 'string',\n },\n jsonWithSchema: customSchema,\n withCustom: customSchema,\n },\n required: ['id'],\n title: 'Test',\n })\n })\n\n it('should handle same block object being referenced in both collection and config.blocks', async () => {\n const sharedBlock: Block = {\n slug: 'sharedBlock',\n interfaceName: 'SharedBlock',\n fields: [\n {\n name: 'richText',\n type: 'richText',\n editor: () => {\n // stub rich text editor\n return {\n CellComponent: '',\n FieldComponent: '',\n validate: () => true,\n }\n },\n },\n ],\n }\n\n // @ts-expect-error\n const config: Config = {\n blocks: [sharedBlock],\n collections: [\n {\n slug: 'test',\n fields: [\n {\n name: 'someBlockField',\n type: 'blocks',\n blocks: [sharedBlock],\n },\n ],\n timestamps: false,\n versions: false,\n },\n ],\n }\n\n // Ensure both rich text editor are sanitized\n const sanitizedConfig = await sanitizeConfig(config)\n expect(typeof (sanitizedConfig?.blocks?.[0]?.fields?.[0] as RichTextField)?.editor).toBe(\n 'object',\n )\n expect(\n typeof (\n (sanitizedConfig.collections[0].fields[0] as BlocksField)?.blocks?.[0]\n ?.fields?.[0] as RichTextField\n )?.editor,\n ).toBe('object')\n\n const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text')\n\n const expectedBlockSchema = {\n type: 'object',\n additionalProperties: false,\n properties: {\n id: { type: ['string', 'null'] },\n blockName: { type: ['string', 'null'] },\n blockType: { const: 'sharedBlock' },\n richText: { type: ['array', 'null'], items: { type: 'object' } },\n },\n required: ['blockType'],\n }\n\n expect(schema?.$defs?.test).toStrictEqual({\n type: 'object',\n additionalProperties: false,\n title: 'Test',\n properties: {\n id: {\n type: 'string',\n },\n someBlockField: {\n type: ['array', 'null'],\n items: {\n oneOf: [\n {\n $ref: '#/$defs/SharedBlock',\n },\n ],\n },\n },\n },\n required: ['id'],\n })\n\n // The definition should still be registered for TypeScript type generation\n expect(schema?.$defs?.SharedBlock).toStrictEqual(expectedBlockSchema)\n })\n\n it('content-hashes a colliding explicit interfaceName instead of overwriting it', async () => {\n // Two different blocks both set `interfaceName: 'Hero'` - each must keep its own definition.\n const config: Config = {\n collections: [\n {\n slug: 'test',\n fields: [\n {\n name: 'blocksField',\n type: 'blocks',\n blocks: [\n {\n slug: 'blockA',\n fields: [{ name: 'title', type: 'text' }],\n interfaceName: 'Hero',\n },\n {\n slug: 'blockB',\n fields: [{ name: 'subtitle', type: 'number' }],\n interfaceName: 'Hero',\n },\n ],\n },\n ],\n timestamps: false,\n versions: false,\n },\n ],\n } as unknown as Config\n\n const sanitizedConfig = await sanitizeConfig(config)\n const { jsonSchema } = configToJSONSchema(sanitizedConfig, 'text')\n const defs = jsonSchema.$defs!\n\n // Each differently-shaped block keeps its own interface (one clean, one hash-suffixed).\n const heroNames = Object.keys(defs).filter((k) => /^Hero(_[0-9A-F]{8})?$/.test(k))\n expect(heroNames).toHaveLength(2)\n\n // ...and they carry distinct field shapes (not a silent overwrite).\n const shapeOf = (name: string): string =>\n Object.keys((defs[name] as { properties: Record<string, unknown> }).properties)\n .sort()\n .join(',')\n expect(shapeOf(heroNames[0]!)).not.toBe(shapeOf(heroNames[1]!))\n })\n\n it('reuses one definition when the same block is registered more than once', async () => {\n // Reusing one block across fields registers an identical schema each time, so it dedupes.\n const heroBlock = {\n slug: 'hero',\n fields: [{ name: 'title', type: 'text' }],\n interfaceName: 'Hero',\n }\n const config: Config = {\n collections: [\n {\n slug: 'test',\n fields: [\n { name: 'a', type: 'blocks', blocks: [heroBlock] },\n { name: 'b', type: 'blocks', blocks: [heroBlock] },\n ],\n timestamps: false,\n versions: false,\n },\n ],\n } as unknown as Config\n\n const sanitizedConfig = await sanitizeConfig(config)\n const { jsonSchema } = configToJSONSchema(sanitizedConfig, 'text')\n\n const heroNames = Object.keys(jsonSchema.$defs!).filter((k) => /^Hero(_[0-9A-F]{8})?$/.test(k))\n expect(heroNames).toEqual(['Hero'])\n })\n\n it('should allow overriding required to false', async () => {\n // @ts-expect-error\n const config: Config = {\n collections: [\n {\n slug: 'test',\n fields: [\n {\n name: 'title',\n type: 'text',\n required: true,\n defaultValue: 'test',\n jsonSchema: [\n () => ({\n type: 'string',\n required: false,\n }),\n ],\n },\n ],\n timestamps: false,\n versions: false,\n },\n ],\n }\n\n const sanitizedConfig = await sanitizeConfig(config)\n const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text')\n\n // @ts-expect-error\n expect(schema.$defs.test.properties.title.required).toStrictEqual(false)\n })\n\n it('should propagate forceInlineBlocks to nested fields (array, group, tab)', async () => {\n const namedBlock: Block = {\n slug: 'myBlock',\n interfaceName: 'MyBlock',\n fields: [{ name: 'text', type: 'text' }],\n }\n\n // @ts-expect-error\n const config: Config = {\n collections: [\n {\n slug: 'test',\n fields: [\n {\n name: 'arr',\n type: 'array',\n fields: [{ name: 'blocks', type: 'blocks', blocks: [namedBlock] }],\n },\n {\n name: 'grp',\n type: 'group',\n fields: [{ name: 'blocks', type: 'blocks', blocks: [namedBlock] }],\n },\n ],\n timestamps: false,\n versions: false,\n },\n ],\n }\n\n const sanitizedConfig = await sanitizeConfig(config)\n\n // Without forceInlineBlocks: blocks field uses $ref\n const { jsonSchema: schemaDefault } = configToJSONSchema(sanitizedConfig, 'text')\n const arrItemsDefault = schemaDefault.$defs!.test.properties!.arr.items as JSONSchema4\n const arrBlocksDefault = (arrItemsDefault.properties!.blocks.items as JSONSchema4).oneOf![0]\n expect(arrBlocksDefault).toStrictEqual({ $ref: '#/$defs/MyBlock' })\n\n // With forceInlineBlocks: blocks field is inlined, no $ref\n const { jsonSchema: schemaInline } = configToJSONSchema(sanitizedConfig, 'text', undefined, {\n forceInlineBlocks: true,\n })\n const arrItemsInline = schemaInline.$defs!.test.properties!.arr.items as JSONSchema4\n const arrBlocksInline = (arrItemsInline.properties!.blocks.items as JSONSchema4).oneOf![0]\n expect(arrBlocksInline).not.toHaveProperty('$ref')\n expect(arrBlocksInline.properties?.blockType).toStrictEqual({ const: 'myBlock' })\n\n const grpBlocksInline = (\n schemaInline.$defs!.test.properties!.grp.properties!.blocks.items as JSONSchema4\n ).oneOf![0]\n expect(grpBlocksInline).not.toHaveProperty('$ref')\n expect(grpBlocksInline.properties?.blockType).toStrictEqual({ const: 'myBlock' })\n })\n\n it('entityToStandaloneJSONSchema bundles only the definitions an entity references', async () => {\n const sharedBlock: Block = {\n slug: 'sharedBlock',\n interfaceName: 'SharedBlock',\n fields: [{ name: 'title', type: 'text' }],\n }\n\n // @ts-expect-error partial config\n const config: Config = {\n admin: {\n timezones: {\n supportedTimezones: [\n { label: 'UTC', value: 'UTC' },\n { label: 'New York', value: 'America/New_York' },\n ],\n },\n },\n blocks: [sharedBlock],\n collections: [\n {\n slug: 'with-refs',\n fields: [\n { name: 'layout', type: 'blocks', blocks: ['sharedBlock'] },\n { name: 'when', type: 'date', timezone: true },\n ],\n timestamps: false,\n versions: false,\n },\n {\n slug: 'other',\n fields: [{ name: 'title', type: 'text' }],\n timestamps: false,\n versions: false,\n },\n ],\n }\n\n const sanitizedConfig = await sanitizeConfig(config)\n const entity = sanitizedConfig.collections.find(\n (collection) => collection.slug === 'with-refs',\n )!\n\n const schema = entityToStandaloneJSONSchema({\n config: sanitizedConfig,\n defaultIDType: 'text',\n entity,\n })\n\n // Has its own $schema, so it resolves on its own.\n expect(schema.$schema).toBe('https://json-schema.org/draft/2020-12/schema')\n\n // The block reference is resolved inline, so it can't dangle.\n const layoutItems = (schema.properties?.layout as JSONSchema4)?.items as JSONSchema4\n const inlinedBlock = (layoutItems?.oneOf?.[0] ?? {}) as JSONSchema4\n expect(inlinedBlock.properties?.blockType).toStrictEqual({ const: 'sharedBlock' })\n expect(inlinedBlock.properties?.title).toBeDefined()\n\n // A timezone field pulls in supportedTimezones from the root config.\n expect(schema.$defs?.supportedTimezones).toBeDefined()\n\n // Doesn't pull in unrelated collections.\n expect(schema.$defs?.other).toBeUndefined()\n })\n})\n"],"names":["describe","it","expect","sanitizeConfig","configToJSONSchema","entityToStandaloneJSONSchema","config","collections","slug","fields","name","type","required","timestamps","versions","sanitizedConfig","jsonSchema","schema","$defs","test","toStrictEqual","additionalProperties","properties","id","someRequiredField","items","title","blocks","blockField","blockFieldRequired","blockFieldWithFields","oneOf","$ref","blockFieldWithFieldsRequired","defs","Hero","toBeDefined","Cta","hashedHeroNames","Object","keys","filter","k","toHaveLength","description","toContain","toBeUndefined","refsOf","layout","map","r","schema2","sort","tabs","label","fieldInUnnamedTab","namedTab","fieldInNamedTab","namedTabWithRequired","customSchema","fileMatch","uri","jsonWithSchema","withCustom","sharedBlock","interfaceName","editor","CellComponent","FieldComponent","validate","toBe","expectedBlockSchema","blockName","blockType","const","richText","someBlockField","SharedBlock","heroNames","shapeOf","join","not","heroBlock","toEqual","defaultValue","namedBlock","schemaDefault","arrItemsDefault","arr","arrBlocksDefault","schemaInline","undefined","forceInlineBlocks","arrItemsInline","arrBlocksInline","toHaveProperty","grpBlocksInline","grp","admin","timezones","supportedTimezones","value","timezone","entity","find","collection","defaultIDType","$schema","layoutItems","inlinedBlock","other"],"mappings":"AACA,SAASA,QAAQ,EAAEC,EAAE,EAAEC,MAAM,QAAQ,SAAQ;AAI7C,SAASC,cAAc,QAAQ,wBAAuB;AACtD,SAASC,kBAAkB,EAAEC,4BAA4B,QAAQ,0BAAyB;AAG1FL,SAAS,sBAAsB;IAC7BC,GAAG,sDAAsD;QACvD,mBAAmB;QACnB,MAAMK,SAAiB;YACrBC,aAAa;gBACX;oBACEC,MAAM;oBACNC,QAAQ;wBACN;4BACEC,MAAM;4BACNC,MAAM;4BACNF,QAAQ;gCACN;oCACEC,MAAM;oCACNC,MAAM;oCACNC,UAAU;gCACZ;6BACD;wBACH;qBACD;oBACDC,YAAY;oBACZC,UAAU;gBACZ;aACD;QACH;QAEA,MAAMC,kBAAkB,MAAMZ,eAAeG;QAC7C,MAAM,EAAEU,YAAYC,MAAM,EAAE,GAAGb,mBAAmBW,iBAAiB;QAEnEb,OAAOe,QAAQC,OAAOC,MAAMC,aAAa,CAAC;YACxCT,MAAM;YACNU,sBAAsB;YACtBC,YAAY;gBACVC,IAAI;oBACFZ,MAAM;gBACR;gBACAa,mBAAmB;oBACjBb,MAAM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AM,mBAAmB,CAAA;AA2DlD,eAAO,MAAM,cAAc,GAAI,CAAC,EAAE,GAAG,CAAC,KAAG,CAiCxC,CAAA;AAQD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,eAAe,UAAQ,GAAG,CAAC,CAwB9F;AAED,wBAAgB,0CAA0C,CAAC,CAAC,SAAS,SAAS,EAC5E,KAAK,EAAE,CAAC,EACR,IAAI,GAAE;IACJ,YAAY,CAAC,EAAE,OAAO,CAAA;CAClB,GACL,CAAC,CAoCH;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,GAAE,OAAO,CAAC,GAAG,EAAE,GAAG,CAAiB,GAAG,CAAC,CAqE/F"}
1
+ {"version":3,"file":"deepCopyObject.d.ts","sourceRoot":"","sources":["../../src/utilities/deepCopyObject.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AA2DlD,eAAO,MAAM,cAAc,GAAI,CAAC,EAAE,GAAG,CAAC,KAAG,CAiCxC,CAAA;AAQD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,eAAe,UAAQ,GAAG,CAAC,CA6B9F;AAED,wBAAgB,0CAA0C,CAAC,CAAC,SAAS,SAAS,EAC5E,KAAK,EAAE,CAAC,EACR,IAAI,GAAE;IACJ,YAAY,CAAC,EAAE,OAAO,CAAA;CAClB,GACL,CAAC,CAuCH;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,GAAE,OAAO,CAAC,GAAG,EAAE,GAAG,CAAiB,GAAG,CAAC,CAqE/F"}
@@ -103,6 +103,11 @@ Benchmark: https://github.com/AlessioGr/fastest-deep-clone-json/blob/main/test/b
103
103
  if (value instanceof Date) {
104
104
  return new Date(value);
105
105
  }
106
+ // BSON ObjectId instances expose extra enumerable properties (e.g. `buffer`) via `for...in`
107
+ // that corrupt the copy. Detect BSON types early and convert them to their string representation.
108
+ if ('_bsontype' in value && typeof value.toHexString === 'function') {
109
+ return value.toHexString();
110
+ }
106
111
  const ret = {};
107
112
  for(const k in value){
108
113
  const v = value[k];
@@ -132,6 +137,9 @@ export function deepCopyObjectSimpleWithoutReactComponents(value, opts = {}) {
132
137
  if (value instanceof Date) {
133
138
  return new Date(value);
134
139
  }
140
+ if ('_bsontype' in value && typeof value.toHexString === 'function') {
141
+ return value.toHexString();
142
+ }
135
143
  const ret = {};
136
144
  for(const k in value){
137
145
  const v = value[k];