payload 4.0.0-internal.cd69eef → 4.0.0-internal.d1cc1d3

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 (279) hide show
  1. package/dist/admin/RichText.d.ts +1 -1
  2. package/dist/admin/RichText.d.ts.map +1 -1
  3. package/dist/admin/RichText.js.map +1 -1
  4. package/dist/admin/functions/index.d.ts +10 -8
  5. package/dist/admin/functions/index.d.ts.map +1 -1
  6. package/dist/admin/functions/index.js.map +1 -1
  7. package/dist/admin/types.d.ts +2 -2
  8. package/dist/admin/types.d.ts.map +1 -1
  9. package/dist/admin/types.js.map +1 -1
  10. package/dist/auth/endpoints/login.d.ts.map +1 -1
  11. package/dist/auth/endpoints/login.js +2 -11
  12. package/dist/auth/endpoints/login.js.map +1 -1
  13. package/dist/auth/loginWithCookie.d.ts +33 -0
  14. package/dist/auth/loginWithCookie.d.ts.map +1 -0
  15. package/dist/auth/loginWithCookie.js +34 -0
  16. package/dist/auth/loginWithCookie.js.map +1 -0
  17. package/dist/auth/serverFunctions/cookies.d.ts +47 -0
  18. package/dist/auth/serverFunctions/cookies.d.ts.map +1 -0
  19. package/dist/auth/serverFunctions/cookies.js +52 -0
  20. package/dist/auth/serverFunctions/cookies.js.map +1 -0
  21. package/dist/auth/serverFunctions/login.d.ts +29 -0
  22. package/dist/auth/serverFunctions/login.d.ts.map +1 -0
  23. package/dist/auth/serverFunctions/login.js +63 -0
  24. package/dist/auth/serverFunctions/login.js.map +1 -0
  25. package/dist/auth/serverFunctions/logout.d.ts +17 -0
  26. package/dist/auth/serverFunctions/logout.d.ts.map +1 -0
  27. package/dist/auth/serverFunctions/logout.js +58 -0
  28. package/dist/auth/serverFunctions/logout.js.map +1 -0
  29. package/dist/auth/serverFunctions/refresh.d.ts +17 -0
  30. package/dist/auth/serverFunctions/refresh.d.ts.map +1 -0
  31. package/dist/auth/serverFunctions/refresh.js +61 -0
  32. package/dist/auth/serverFunctions/refresh.js.map +1 -0
  33. package/dist/collections/config/client.d.ts +2 -3
  34. package/dist/collections/config/client.d.ts.map +1 -1
  35. package/dist/collections/config/client.js +5 -7
  36. package/dist/collections/config/client.js.map +1 -1
  37. package/dist/collections/config/defaults.d.ts.map +1 -1
  38. package/dist/collections/config/defaults.js +1 -0
  39. package/dist/collections/config/defaults.js.map +1 -1
  40. package/dist/collections/config/sanitize.d.ts +3 -8
  41. package/dist/collections/config/sanitize.d.ts.map +1 -1
  42. package/dist/collections/config/sanitize.js +2 -6
  43. package/dist/collections/config/sanitize.js.map +1 -1
  44. package/dist/collections/config/types.d.ts +1 -1
  45. package/dist/collections/config/types.d.ts.map +1 -1
  46. package/dist/collections/config/types.js.map +1 -1
  47. package/dist/collections/config/useAsTitle.spec.js +27 -27
  48. package/dist/collections/config/useAsTitle.spec.js.map +1 -1
  49. package/dist/collections/operations/create.d.ts.map +1 -1
  50. package/dist/collections/operations/create.js +10 -0
  51. package/dist/collections/operations/create.js.map +1 -1
  52. package/dist/collections/operations/restoreVersion.d.ts.map +1 -1
  53. package/dist/collections/operations/restoreVersion.js +7 -4
  54. package/dist/collections/operations/restoreVersion.js.map +1 -1
  55. package/dist/collections/operations/updateByID.js +1 -0
  56. package/dist/collections/operations/updateByID.js.map +1 -1
  57. package/dist/config/build.js +1 -1
  58. package/dist/config/build.js.map +1 -1
  59. package/dist/config/defaults.d.ts.map +1 -1
  60. package/dist/config/defaults.js +5 -2
  61. package/dist/config/defaults.js.map +1 -1
  62. package/dist/config/orderable/index.d.ts +1 -1
  63. package/dist/config/orderable/index.d.ts.map +1 -1
  64. package/dist/config/orderable/index.js +2 -2
  65. package/dist/config/orderable/index.js.map +1 -1
  66. package/dist/config/sanitize.d.ts +1 -1
  67. package/dist/config/sanitize.d.ts.map +1 -1
  68. package/dist/config/sanitize.js +33 -40
  69. package/dist/config/sanitize.js.map +1 -1
  70. package/dist/config/types.d.ts +1 -1
  71. package/dist/config/types.js.map +1 -1
  72. package/dist/database/createDatabaseAdapter.d.ts +1 -1
  73. package/dist/database/createDatabaseAdapter.d.ts.map +1 -1
  74. package/dist/database/createDatabaseAdapter.js +0 -2
  75. package/dist/database/createDatabaseAdapter.js.map +1 -1
  76. package/dist/database/types.d.ts +6 -0
  77. package/dist/database/types.d.ts.map +1 -1
  78. package/dist/database/types.js.map +1 -1
  79. package/dist/exports/auth.d.ts +5 -0
  80. package/dist/exports/auth.d.ts.map +1 -0
  81. package/dist/exports/auth.js +6 -0
  82. package/dist/exports/auth.js.map +1 -0
  83. package/dist/exports/internal.d.ts +2 -0
  84. package/dist/exports/internal.d.ts.map +1 -1
  85. package/dist/exports/internal.js +3 -1
  86. package/dist/exports/internal.js.map +1 -1
  87. package/dist/fields/baseFields/slug/duplicateContext.d.ts +11 -0
  88. package/dist/fields/baseFields/slug/duplicateContext.d.ts.map +1 -0
  89. package/dist/fields/baseFields/slug/duplicateContext.js +21 -0
  90. package/dist/fields/baseFields/slug/duplicateContext.js.map +1 -0
  91. package/dist/fields/baseFields/slug/fillEmptyLocalizedSlugs.d.ts +22 -0
  92. package/dist/fields/baseFields/slug/fillEmptyLocalizedSlugs.d.ts.map +1 -0
  93. package/dist/fields/baseFields/slug/fillEmptyLocalizedSlugs.js +63 -0
  94. package/dist/fields/baseFields/slug/fillEmptyLocalizedSlugs.js.map +1 -0
  95. package/dist/fields/baseFields/slug/generateSlug.d.ts +13 -8
  96. package/dist/fields/baseFields/slug/generateSlug.d.ts.map +1 -1
  97. package/dist/fields/baseFields/slug/generateSlug.js +98 -45
  98. package/dist/fields/baseFields/slug/generateSlug.js.map +1 -1
  99. package/dist/fields/baseFields/slug/generateSlugBeforeDuplicate.d.ts +18 -0
  100. package/dist/fields/baseFields/slug/generateSlugBeforeDuplicate.d.ts.map +1 -0
  101. package/dist/fields/baseFields/slug/generateSlugBeforeDuplicate.js +20 -0
  102. package/dist/fields/baseFields/slug/generateSlugBeforeDuplicate.js.map +1 -0
  103. package/dist/fields/baseFields/slug/getSlugFallbackValue.d.ts +22 -0
  104. package/dist/fields/baseFields/slug/getSlugFallbackValue.d.ts.map +1 -0
  105. package/dist/fields/baseFields/slug/getSlugFallbackValue.js +23 -0
  106. package/dist/fields/baseFields/slug/getSlugFallbackValue.js.map +1 -0
  107. package/dist/fields/baseFields/slug/hasValue.d.ts +3 -0
  108. package/dist/fields/baseFields/slug/hasValue.d.ts.map +1 -0
  109. package/dist/fields/baseFields/slug/hasValue.js +3 -0
  110. package/dist/fields/baseFields/slug/hasValue.js.map +1 -0
  111. package/dist/fields/config/reservedFieldNames.spec.js +18 -18
  112. package/dist/fields/config/reservedFieldNames.spec.js.map +1 -1
  113. package/dist/fields/config/sanitize.d.ts +3 -9
  114. package/dist/fields/config/sanitize.d.ts.map +1 -1
  115. package/dist/fields/config/sanitize.js +33 -34
  116. package/dist/fields/config/sanitize.js.map +1 -1
  117. package/dist/fields/config/sanitize.spec.js +128 -105
  118. package/dist/fields/config/sanitize.spec.js.map +1 -1
  119. package/dist/fields/config/types.d.ts +4 -3
  120. package/dist/fields/config/types.d.ts.map +1 -1
  121. package/dist/fields/config/types.js.map +1 -1
  122. package/dist/fields/hooks/beforeValidate/promise.d.ts.map +1 -1
  123. package/dist/fields/hooks/beforeValidate/promise.js +5 -3
  124. package/dist/fields/hooks/beforeValidate/promise.js.map +1 -1
  125. package/dist/fields/hooks/beforeValidate/stripNullRows.d.ts +10 -0
  126. package/dist/fields/hooks/beforeValidate/stripNullRows.d.ts.map +1 -0
  127. package/dist/fields/hooks/beforeValidate/stripNullRows.js +18 -0
  128. package/dist/fields/hooks/beforeValidate/stripNullRows.js.map +1 -0
  129. package/dist/fields/validations.d.ts.map +1 -1
  130. package/dist/fields/validations.js +7 -8
  131. package/dist/fields/validations.js.map +1 -1
  132. package/dist/fields/validations.spec.js +61 -37
  133. package/dist/fields/validations.spec.js.map +1 -1
  134. package/dist/globals/config/sanitize.d.ts +2 -7
  135. package/dist/globals/config/sanitize.d.ts.map +1 -1
  136. package/dist/globals/config/sanitize.js +2 -6
  137. package/dist/globals/config/sanitize.js.map +1 -1
  138. package/dist/globals/config/sanitize.spec.js +6 -6
  139. package/dist/globals/config/sanitize.spec.js.map +1 -1
  140. package/dist/globals/operations/countGlobalVersions.d.ts.map +1 -1
  141. package/dist/globals/operations/countGlobalVersions.js +1 -0
  142. package/dist/globals/operations/countGlobalVersions.js.map +1 -1
  143. package/dist/index.bundled.d.ts +247 -178
  144. package/dist/index.d.ts +49 -17
  145. package/dist/index.d.ts.map +1 -1
  146. package/dist/index.js +3 -0
  147. package/dist/index.js.map +1 -1
  148. package/dist/query-presets/constraints.js +1 -1
  149. package/dist/query-presets/constraints.js.map +1 -1
  150. package/dist/queues/config/collection.d.ts.map +1 -1
  151. package/dist/queues/config/collection.js +37 -43
  152. package/dist/queues/config/collection.js.map +1 -1
  153. package/dist/queues/config/global.d.ts +5 -6
  154. package/dist/queues/config/global.d.ts.map +1 -1
  155. package/dist/queues/config/global.js +1 -1
  156. package/dist/queues/config/global.js.map +1 -1
  157. package/dist/queues/config/types/index.d.ts +29 -24
  158. package/dist/queues/config/types/index.d.ts.map +1 -1
  159. package/dist/queues/config/types/index.js.map +1 -1
  160. package/dist/queues/config/types/taskTypes.d.ts +4 -7
  161. package/dist/queues/config/types/taskTypes.d.ts.map +1 -1
  162. package/dist/queues/config/types/taskTypes.js.map +1 -1
  163. package/dist/queues/config/types/workflowJSONTypes.d.ts +10 -9
  164. package/dist/queues/config/types/workflowJSONTypes.d.ts.map +1 -1
  165. package/dist/queues/config/types/workflowJSONTypes.js.map +1 -1
  166. package/dist/queues/config/types/workflowTypes.d.ts +11 -58
  167. package/dist/queues/config/types/workflowTypes.d.ts.map +1 -1
  168. package/dist/queues/config/types/workflowTypes.js.map +1 -1
  169. package/dist/queues/endpoints/handleSchedules.js +1 -1
  170. package/dist/queues/endpoints/handleSchedules.js.map +1 -1
  171. package/dist/queues/errors/handleTaskError.js +4 -4
  172. package/dist/queues/errors/handleTaskError.js.map +1 -1
  173. package/dist/queues/errors/handleWorkflowError.js +1 -1
  174. package/dist/queues/errors/handleWorkflowError.js.map +1 -1
  175. package/dist/queues/errors/index.d.ts +6 -0
  176. package/dist/queues/errors/index.d.ts.map +1 -1
  177. package/dist/queues/errors/index.js +5 -0
  178. package/dist/queues/errors/index.js.map +1 -1
  179. package/dist/queues/localAPI.d.ts +4 -4
  180. package/dist/queues/localAPI.d.ts.map +1 -1
  181. package/dist/queues/localAPI.js +63 -66
  182. package/dist/queues/localAPI.js.map +1 -1
  183. package/dist/queues/operations/handleSchedules/countRunnableOrActiveJobsForQueue.d.ts +4 -4
  184. package/dist/queues/operations/handleSchedules/countRunnableOrActiveJobsForQueue.d.ts.map +1 -1
  185. package/dist/queues/operations/handleSchedules/countRunnableOrActiveJobsForQueue.js.map +1 -1
  186. package/dist/queues/operations/handleSchedules/index.d.ts +1 -1
  187. package/dist/queues/operations/handleSchedules/index.d.ts.map +1 -1
  188. package/dist/queues/operations/handleSchedules/index.js +1 -1
  189. package/dist/queues/operations/handleSchedules/index.js.map +1 -1
  190. package/dist/queues/operations/runJobs/heartbeat.d.ts +13 -0
  191. package/dist/queues/operations/runJobs/heartbeat.d.ts.map +1 -0
  192. package/dist/queues/operations/runJobs/heartbeat.js +66 -0
  193. package/dist/queues/operations/runJobs/heartbeat.js.map +1 -0
  194. package/dist/queues/operations/runJobs/index.d.ts.map +1 -1
  195. package/dist/queues/operations/runJobs/index.js +133 -84
  196. package/dist/queues/operations/runJobs/index.js.map +1 -1
  197. package/dist/queues/operations/runJobs/runJSONJob/index.d.ts.map +1 -1
  198. package/dist/queues/operations/runJobs/runJSONJob/index.js +6 -3
  199. package/dist/queues/operations/runJobs/runJSONJob/index.js.map +1 -1
  200. package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js +5 -5
  201. package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js.map +1 -1
  202. package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.d.ts +2 -1
  203. package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.d.ts.map +1 -1
  204. package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.js +39 -8
  205. package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.js.map +1 -1
  206. package/dist/queues/operations/runJobs/runJob/importHandlerPath.js.map +1 -1
  207. package/dist/queues/operations/runJobs/runJob/index.d.ts.map +1 -1
  208. package/dist/queues/operations/runJobs/runJob/index.js +4 -4
  209. package/dist/queues/operations/runJobs/runJob/index.js.map +1 -1
  210. package/dist/queues/utilities/updateJob.d.ts.map +1 -1
  211. package/dist/queues/utilities/updateJob.js +3 -0
  212. package/dist/queues/utilities/updateJob.js.map +1 -1
  213. package/dist/types/index.d.ts +2 -2
  214. package/dist/types/index.d.ts.map +1 -1
  215. package/dist/types/index.js.map +1 -1
  216. package/dist/uploads/checkFileRestrictions.d.ts +1 -1
  217. package/dist/uploads/checkFileRestrictions.d.ts.map +1 -1
  218. package/dist/uploads/checkFileRestrictions.js +15 -1
  219. package/dist/uploads/checkFileRestrictions.js.map +1 -1
  220. package/dist/uploads/endpoints/uploadInstructions.d.ts +12 -0
  221. package/dist/uploads/endpoints/uploadInstructions.d.ts.map +1 -1
  222. package/dist/uploads/endpoints/uploadInstructions.js +66 -20
  223. package/dist/uploads/endpoints/uploadInstructions.js.map +1 -1
  224. package/dist/uploads/generateFileData.js +4 -1
  225. package/dist/uploads/generateFileData.js.map +1 -1
  226. package/dist/uploads/getFileFromUploadInstructions.d.ts +8 -0
  227. package/dist/uploads/getFileFromUploadInstructions.d.ts.map +1 -0
  228. package/dist/uploads/getFileFromUploadInstructions.js +62 -0
  229. package/dist/uploads/getFileFromUploadInstructions.js.map +1 -0
  230. package/dist/uploads/getImageSize.d.ts +12 -1
  231. package/dist/uploads/getImageSize.d.ts.map +1 -1
  232. package/dist/uploads/getImageSize.js +20 -18
  233. package/dist/uploads/getImageSize.js.map +1 -1
  234. package/dist/uploads/getImageSize.spec.js +298 -0
  235. package/dist/uploads/getImageSize.spec.js.map +1 -0
  236. package/dist/uploads/probeImageSize.d.ts +39 -0
  237. package/dist/uploads/probeImageSize.d.ts.map +1 -0
  238. package/dist/uploads/probeImageSize.js +374 -0
  239. package/dist/uploads/probeImageSize.js.map +1 -0
  240. package/dist/uploads/probeImageSize.spec.js +366 -0
  241. package/dist/uploads/probeImageSize.spec.js.map +1 -0
  242. package/dist/uploads/stagedUpload.d.ts +27 -0
  243. package/dist/uploads/stagedUpload.d.ts.map +1 -0
  244. package/dist/uploads/stagedUpload.js +197 -0
  245. package/dist/uploads/stagedUpload.js.map +1 -0
  246. package/dist/uploads/types.d.ts +41 -13
  247. package/dist/uploads/types.d.ts.map +1 -1
  248. package/dist/uploads/types.js.map +1 -1
  249. package/dist/utilities/addDataAndFileToRequest.d.ts.map +1 -1
  250. package/dist/utilities/addDataAndFileToRequest.js +12 -46
  251. package/dist/utilities/addDataAndFileToRequest.js.map +1 -1
  252. package/dist/utilities/configToJSONSchema.spec.js +33 -33
  253. package/dist/utilities/configToJSONSchema.spec.js.map +1 -1
  254. package/dist/utilities/fieldValueExists.d.ts +29 -0
  255. package/dist/utilities/fieldValueExists.d.ts.map +1 -0
  256. package/dist/utilities/fieldValueExists.js +27 -0
  257. package/dist/utilities/fieldValueExists.js.map +1 -0
  258. package/dist/utilities/getUniqueFieldValue.d.ts +27 -0
  259. package/dist/utilities/getUniqueFieldValue.d.ts.map +1 -0
  260. package/dist/utilities/getUniqueFieldValue.js +26 -0
  261. package/dist/utilities/getUniqueFieldValue.js.map +1 -0
  262. package/dist/versions/deleteScheduledPublishJobs.js +2 -2
  263. package/dist/versions/deleteScheduledPublishJobs.js.map +1 -1
  264. package/dist/versions/payloadPackageList.d.ts.map +1 -1
  265. package/dist/versions/payloadPackageList.js +0 -1
  266. package/dist/versions/payloadPackageList.js.map +1 -1
  267. package/package.json +8 -3
  268. package/dist/database/defaultUpdateJobs.d.ts +0 -3
  269. package/dist/database/defaultUpdateJobs.d.ts.map +0 -1
  270. package/dist/database/defaultUpdateJobs.js +0 -41
  271. package/dist/database/defaultUpdateJobs.js.map +0 -1
  272. package/dist/fields/baseFields/slug/countVersions.d.ts +0 -13
  273. package/dist/fields/baseFields/slug/countVersions.d.ts.map +0 -1
  274. package/dist/fields/baseFields/slug/countVersions.js +0 -27
  275. package/dist/fields/baseFields/slug/countVersions.js.map +0 -1
  276. package/dist/uploads/tempFile.d.ts +0 -7
  277. package/dist/uploads/tempFile.d.ts.map +0 -1
  278. package/dist/uploads/tempFile.js +0 -39
  279. package/dist/uploads/tempFile.js.map +0 -1
@@ -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, 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 generate separate input types when generateInputTypes is enabled', async () => {\n // @ts-expect-error partial config\n const config: Config = {\n collections: [\n { slug: 'authors', fields: [{ name: 'name', type: 'text' }] },\n { slug: 'categories', fields: [{ name: 'title', type: 'text' }] },\n {\n slug: 'posts',\n fields: [\n { name: 'title', type: 'text', required: true },\n {\n name: 'status',\n type: 'select',\n defaultValue: 'draft',\n options: ['draft', 'published'],\n required: true,\n },\n { name: 'author', type: 'relationship', relationTo: 'authors' },\n { name: 'categories', type: 'relationship', hasMany: true, relationTo: 'categories' },\n ],\n },\n ],\n typescript: { generateInputTypes: true },\n }\n\n const sanitizedConfig = await sanitizeConfig(config)\n const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text')\n\n // Output (read) shape is unchanged: relationships may be populated, managed fields are present,\n // and a required field with a defaultValue stays required.\n const postsOutput = schema?.$defs?.posts as JSONSchema4\n expect(postsOutput.title).toBe('Post')\n expect(postsOutput.properties!.author).toStrictEqual({\n oneOf: [{ type: ['string', 'null'] }, { $ref: '#/$defs/authors' }],\n })\n expect(postsOutput.properties!.categories).toStrictEqual({\n type: ['array', 'null'],\n items: { oneOf: [{ type: 'string' }, { $ref: '#/$defs/categories' }] },\n })\n expect(postsOutput.required).toStrictEqual(['id', 'title', 'status', 'updatedAt', 'createdAt'])\n\n // Input (write) shape: relationships are ID-only, the defaultValue field is optional, `id` is\n // optional, and createdAt/updatedAt are dropped. `id` and the defaulted `status` are optional\n // but NOT nullable - nullability follows the read shape, where they're non-null.\n expect(schema?.$defs?.posts_input).toStrictEqual({\n type: 'object',\n additionalProperties: false,\n properties: {\n id: { type: 'string' },\n title: { type: 'string' },\n status: { type: 'string', enum: ['draft', 'published'] },\n author: { type: ['string', 'null'] },\n categories: { type: ['array', 'null'], items: { type: 'string' } },\n },\n required: ['title'],\n title: 'PostInput',\n })\n\n // The Config type exposes input shapes under `collectionsInput`.\n expect((schema?.properties?.collectionsInput as JSONSchema4)?.properties?.posts).toStrictEqual({\n $ref: '#/$defs/posts_input',\n })\n })\n\n it('should keep _status in the input schema for draft-enabled entities', async () => {\n // @ts-expect-error partial config\n const config: Config = {\n collections: [\n {\n slug: 'posts',\n fields: [{ name: 'title', type: 'text', required: true }],\n versions: { drafts: true },\n },\n ],\n }\n\n const sanitizedConfig = await sanitizeConfig(config)\n const entity = sanitizedConfig.collections[0]!\n const schema = entityToStandaloneJSONSchema({\n config: sanitizedConfig,\n defaultIDType: 'text',\n entity,\n variant: 'input',\n })\n\n expect(schema.properties?._status).toMatchObject({\n enum: ['draft', 'published'],\n })\n expect(schema.required).not.toContain('_status')\n expect(schema.properties?.createdAt).toBeUndefined()\n expect(schema.properties?.updatedAt).toBeUndefined()\n })\n\n it('should skip input types by default and generate them when enabled', async () => {\n // @ts-expect-error partial config\n const offByDefault: Config = {\n collections: [{ slug: 'posts', fields: [{ name: 'title', type: 'text' }] }],\n }\n const { jsonSchema: defaultSchema } = configToJSONSchema(\n await sanitizeConfig(offByDefault),\n 'text',\n )\n expect(defaultSchema?.$defs?.posts_input).toBeUndefined()\n expect(defaultSchema?.properties?.collectionsInput).toBeUndefined()\n\n // @ts-expect-error partial config\n const enabled: Config = {\n collections: [{ slug: 'posts', fields: [{ name: 'title', type: 'text' }] }],\n typescript: { generateInputTypes: true },\n }\n const { jsonSchema: enabledSchema } = configToJSONSchema(\n await sanitizeConfig(enabled),\n 'text',\n )\n expect(enabledSchema?.$defs?.posts_input).toBeDefined()\n expect(enabledSchema?.properties?.collectionsInput).toBeDefined()\n })\n\n it('should generate Input-suffixed definitions for named interfaces and blocks', async () => {\n // @ts-expect-error partial config\n const config: Config = {\n collections: [\n { slug: 'authors', fields: [{ name: 'name', type: 'text' }] },\n {\n slug: 'pages',\n fields: [\n {\n name: 'meta',\n type: 'group',\n interfaceName: 'Meta',\n fields: [{ name: 'author', type: 'relationship', relationTo: 'authors' }],\n },\n {\n name: 'layout',\n type: 'blocks',\n blocks: [\n {\n slug: 'hero',\n fields: [\n { name: 'heading', type: 'text', required: true },\n { name: 'cta', type: 'relationship', relationTo: 'authors' },\n ],\n },\n ],\n },\n ],\n },\n ],\n typescript: { generateInputTypes: true },\n }\n\n const sanitizedConfig = await sanitizeConfig(config)\n const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text')\n\n // Read-shaped named interface keeps the populated-doc union...\n expect((schema?.$defs?.Meta as JSONSchema4).properties!.author).toStrictEqual({\n oneOf: [{ type: ['string', 'null'] }, { $ref: '#/$defs/authors' }],\n })\n // ...and a separate `Input` definition is ID-only, so the two don't collide.\n expect((schema?.$defs?.MetaInput as JSONSchema4).properties!.author).toStrictEqual({\n type: ['string', 'null'],\n })\n\n // Blocks get the same treatment: read-shaped `Hero`, write-shaped `HeroInput`.\n const heroInput = schema?.$defs?.HeroInput as JSONSchema4\n expect(heroInput.properties!.cta).toStrictEqual({ type: ['string', 'null'] })\n expect(heroInput.required).toStrictEqual(['blockType', 'heading'])\n expect((schema?.$defs?.Hero as JSONSchema4).properties!.cta).toStrictEqual({\n oneOf: [{ type: ['string', 'null'] }, { $ref: '#/$defs/authors' }],\n })\n })\n\n it('passes the variant to field-level jsonSchema transforms', async () => {\n // @ts-expect-error partial config\n const config: Config = {\n collections: [\n {\n slug: 'posts',\n fields: [\n {\n name: 'custom',\n type: 'text',\n jsonSchema: [({ jsonSchema, variant }) => ({ ...jsonSchema, description: variant })],\n },\n ],\n },\n ],\n typescript: { generateInputTypes: true },\n }\n\n const sanitizedConfig = await sanitizeConfig(config)\n const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text')\n\n expect((schema?.$defs?.posts as JSONSchema4).properties!.custom.description).toBe('output')\n expect((schema?.$defs?.posts_input as JSONSchema4).properties!.custom.description).toBe('input')\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","defaultValue","options","relationTo","hasMany","typescript","generateInputTypes","postsOutput","posts","toBe","author","oneOf","$ref","categories","posts_input","status","enum","collectionsInput","drafts","entity","defaultIDType","variant","_status","toMatchObject","not","toContain","createdAt","toBeUndefined","updatedAt","offByDefault","defaultSchema","enabled","enabledSchema","toBeDefined","interfaceName","blocks","Meta","MetaInput","heroInput","HeroInput","cta","Hero","description","custom","blockField","blockFieldRequired","blockFieldWithFields","blockFieldWithFieldsRequired","defs","Cta","hashedHeroNames","Object","keys","filter","k","toHaveLength","refsOf","layout","map","r","schema2","sort","tabs","label","fieldInUnnamedTab","namedTab","fieldInNamedTab","namedTabWithRequired","customSchema","fileMatch","uri","jsonWithSchema","withCustom","sharedBlock","editor","CellComponent","FieldComponent","validate","expectedBlockSchema","blockName","blockType","const","richText","someBlockField","SharedBlock","heroNames","shapeOf","join","heroBlock","toEqual","namedBlock","schemaDefault","arrItemsDefault","arr","arrBlocksDefault","schemaInline","undefined","forceInlineBlocks","arrItemsInline","arrBlocksInline","toHaveProperty","grpBlocksInline","grp","admin","timezones","supportedTimezones","value","timezone","find","collection","$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;wBAAC;wBAAS;qBAAO;oBACvBc,OAAO;wBACLd,MAAM;wBACNU,sBAAsB;wBACtBC,YAAY;4BACVC,IAAI;gCACFZ,MAAM;oCAAC;oCAAU;iCAAO;4BAC1B;4BACAa,mBAAmB;gCACjBb,MAAM;4BACR;wBACF;wBACAC,UAAU;4BAAC;yBAAoB;oBACj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,aAAapG,OAAO,CAAC,EAAE,IAAI,CAAC;QAClDnC,OAAOwI,aAAapH,UAAU,EAAEoF,WAAWtF,aAAa,CAAC;YAAEuF,OAAO;QAAc;QAChFzG,OAAOwI,aAAapH,UAAU,EAAEI,OAAOiC,WAAW;QAElD,qEAAqE;QACrEzD,OAAOe,OAAOC,KAAK,EAAEiH,oBAAoBxE,WAAW;QAEpD,yCAAyC;QACzCzD,OAAOe,OAAOC,KAAK,EAAEyH,OAAOtF,aAAa;IAC3C;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', () => {\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 = 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 generate separate input types when generateInputTypes is enabled', () => {\n // @ts-expect-error partial config\n const config: Config = {\n collections: [\n { slug: 'authors', fields: [{ name: 'name', type: 'text' }] },\n { slug: 'categories', fields: [{ name: 'title', type: 'text' }] },\n {\n slug: 'posts',\n fields: [\n { name: 'title', type: 'text', required: true },\n {\n name: 'status',\n type: 'select',\n defaultValue: 'draft',\n options: ['draft', 'published'],\n required: true,\n },\n { name: 'author', type: 'relationship', relationTo: 'authors' },\n { name: 'categories', type: 'relationship', hasMany: true, relationTo: 'categories' },\n ],\n },\n ],\n typescript: { generateInputTypes: true },\n }\n\n const sanitizedConfig = sanitizeConfig(config)\n const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text')\n\n // Output (read) shape is unchanged: relationships may be populated, managed fields are present,\n // and a required field with a defaultValue stays required.\n const postsOutput = schema?.$defs?.posts as JSONSchema4\n expect(postsOutput.title).toBe('Post')\n expect(postsOutput.properties!.author).toStrictEqual({\n oneOf: [{ type: ['string', 'null'] }, { $ref: '#/$defs/authors' }],\n })\n expect(postsOutput.properties!.categories).toStrictEqual({\n type: ['array', 'null'],\n items: { oneOf: [{ type: 'string' }, { $ref: '#/$defs/categories' }] },\n })\n expect(postsOutput.required).toStrictEqual(['id', 'title', 'status', 'updatedAt', 'createdAt'])\n\n // Input (write) shape: relationships are ID-only, the defaultValue field is optional, `id` is\n // optional, and createdAt/updatedAt are dropped. `id` and the defaulted `status` are optional\n // but NOT nullable - nullability follows the read shape, where they're non-null.\n expect(schema?.$defs?.posts_input).toStrictEqual({\n type: 'object',\n additionalProperties: false,\n properties: {\n id: { type: 'string' },\n title: { type: 'string' },\n status: { type: 'string', enum: ['draft', 'published'] },\n author: { type: ['string', 'null'] },\n categories: { type: ['array', 'null'], items: { type: 'string' } },\n },\n required: ['title'],\n title: 'PostInput',\n })\n\n // The Config type exposes input shapes under `collectionsInput`.\n expect((schema?.properties?.collectionsInput as JSONSchema4)?.properties?.posts).toStrictEqual({\n $ref: '#/$defs/posts_input',\n })\n })\n\n it('should keep _status in the input schema for draft-enabled entities', () => {\n // @ts-expect-error partial config\n const config: Config = {\n collections: [\n {\n slug: 'posts',\n fields: [{ name: 'title', type: 'text', required: true }],\n versions: { drafts: true },\n },\n ],\n }\n\n const sanitizedConfig = sanitizeConfig(config)\n const entity = sanitizedConfig.collections[0]!\n const schema = entityToStandaloneJSONSchema({\n config: sanitizedConfig,\n defaultIDType: 'text',\n entity,\n variant: 'input',\n })\n\n expect(schema.properties?._status).toMatchObject({\n enum: ['draft', 'published'],\n })\n expect(schema.required).not.toContain('_status')\n expect(schema.properties?.createdAt).toBeUndefined()\n expect(schema.properties?.updatedAt).toBeUndefined()\n })\n\n it('should skip input types by default and generate them when enabled', () => {\n // @ts-expect-error partial config\n const offByDefault: Config = {\n collections: [{ slug: 'posts', fields: [{ name: 'title', type: 'text' }] }],\n }\n const { jsonSchema: defaultSchema } = configToJSONSchema(sanitizeConfig(offByDefault), 'text')\n expect(defaultSchema?.$defs?.posts_input).toBeUndefined()\n expect(defaultSchema?.properties?.collectionsInput).toBeUndefined()\n\n // @ts-expect-error partial config\n const enabled: Config = {\n collections: [{ slug: 'posts', fields: [{ name: 'title', type: 'text' }] }],\n typescript: { generateInputTypes: true },\n }\n const { jsonSchema: enabledSchema } = configToJSONSchema(sanitizeConfig(enabled), 'text')\n expect(enabledSchema?.$defs?.posts_input).toBeDefined()\n expect(enabledSchema?.properties?.collectionsInput).toBeDefined()\n })\n\n it('should generate Input-suffixed definitions for named interfaces and blocks', () => {\n // @ts-expect-error partial config\n const config: Config = {\n collections: [\n { slug: 'authors', fields: [{ name: 'name', type: 'text' }] },\n {\n slug: 'pages',\n fields: [\n {\n name: 'meta',\n type: 'group',\n interfaceName: 'Meta',\n fields: [{ name: 'author', type: 'relationship', relationTo: 'authors' }],\n },\n {\n name: 'layout',\n type: 'blocks',\n blocks: [\n {\n slug: 'hero',\n fields: [\n { name: 'heading', type: 'text', required: true },\n { name: 'cta', type: 'relationship', relationTo: 'authors' },\n ],\n },\n ],\n },\n ],\n },\n ],\n typescript: { generateInputTypes: true },\n }\n\n const sanitizedConfig = sanitizeConfig(config)\n const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text')\n\n // Read-shaped named interface keeps the populated-doc union...\n expect((schema?.$defs?.Meta as JSONSchema4).properties!.author).toStrictEqual({\n oneOf: [{ type: ['string', 'null'] }, { $ref: '#/$defs/authors' }],\n })\n // ...and a separate `Input` definition is ID-only, so the two don't collide.\n expect((schema?.$defs?.MetaInput as JSONSchema4).properties!.author).toStrictEqual({\n type: ['string', 'null'],\n })\n\n // Blocks get the same treatment: read-shaped `Hero`, write-shaped `HeroInput`.\n const heroInput = schema?.$defs?.HeroInput as JSONSchema4\n expect(heroInput.properties!.cta).toStrictEqual({ type: ['string', 'null'] })\n expect(heroInput.required).toStrictEqual(['blockType', 'heading'])\n expect((schema?.$defs?.Hero as JSONSchema4).properties!.cta).toStrictEqual({\n oneOf: [{ type: ['string', 'null'] }, { $ref: '#/$defs/authors' }],\n })\n })\n\n it('passes the variant to field-level jsonSchema transforms', () => {\n // @ts-expect-error partial config\n const config: Config = {\n collections: [\n {\n slug: 'posts',\n fields: [\n {\n name: 'custom',\n type: 'text',\n jsonSchema: [({ jsonSchema, variant }) => ({ ...jsonSchema, description: variant })],\n },\n ],\n },\n ],\n typescript: { generateInputTypes: true },\n }\n\n const sanitizedConfig = sanitizeConfig(config)\n const { jsonSchema: schema } = configToJSONSchema(sanitizedConfig, 'text')\n\n expect((schema?.$defs?.posts as JSONSchema4).properties!.custom.description).toBe('output')\n expect((schema?.$defs?.posts_input as JSONSchema4).properties!.custom.description).toBe('input')\n })\n\n it('should handle block fields with no blocks', () => {\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 = 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', () => {\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 = 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', () => {\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 = 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', () => {\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 = 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', () => {\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 = 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', () => {\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 = 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', () => {\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 = 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', () => {\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 = 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)', () => {\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 = 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', () => {\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 = 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","defaultValue","options","relationTo","hasMany","typescript","generateInputTypes","postsOutput","posts","toBe","author","oneOf","$ref","categories","posts_input","status","enum","collectionsInput","drafts","entity","defaultIDType","variant","_status","toMatchObject","not","toContain","createdAt","toBeUndefined","updatedAt","offByDefault","defaultSchema","enabled","enabledSchema","toBeDefined","interfaceName","blocks","Meta","MetaInput","heroInput","HeroInput","cta","Hero","description","custom","blockField","blockFieldRequired","blockFieldWithFields","blockFieldWithFieldsRequired","defs","Cta","hashedHeroNames","Object","keys","filter","k","toHaveLength","refsOf","layout","map","r","schema2","sort","tabs","label","fieldInUnnamedTab","namedTab","fieldInNamedTab","namedTabWithRequired","customSchema","fileMatch","uri","jsonWithSchema","withCustom","sharedBlock","editor","CellComponent","FieldComponent","validate","expectedBlockSchema","blockName","blockType","const","richText","someBlockField","SharedBlock","heroNames","shapeOf","join","heroBlock","toEqual","namedBlock","schemaDefault","arrItemsDefault","arr","arrBlocksDefault","schemaInline","undefined","forceInlineBlocks","arrItemsInline","arrBlocksInline","toHaveProperty","grpBlocksInline","grp","admin","timezones","supportedTimezones","value","timezone","find","collection","$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,kBAAkBZ,eAAeG;QACvC,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;wBAAC;wBAAS;qBAAO;oBACvBc,OAAO;wBACLd,MAAM;wBACNU,sBAAsB;wBACtBC,YAAY;4BACVC,IAAI;gCACFZ,MAAM;oCAAC;oCAAU;iCAAO;4BAC1B;4BACAa,mBAAmB;gCACjBb,MAAM;4BACR;wBACF;wBACAC,UAAU;4BAAC;yBAAoB;oBACjC;gBACF;YACF;YACAA,UAAU;gBAAC;aAAK;YAChBc,OAAO;QACT;IACF;IAEAzB,GAAG,2EAA2E;QAC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e,OAAOC,KAAK,EAAEiH,oBAAoBxE,WAAW;QAEpD,yCAAyC;QACzCzD,OAAOe,OAAOC,KAAK,EAAEyH,OAAOtF,aAAa;IAC3C;AACF"}
@@ -0,0 +1,29 @@
1
+ import type { DefaultDocumentIDType, Locale } from '../index.js';
2
+ import type { PayloadRequest } from '../types/index.js';
3
+ type Args = {
4
+ collection: string;
5
+ /**
6
+ * When true, also matches documents whose value only exists in a draft version. A versioned
7
+ * collection keeps draft data in `_versions`, which the main-collection query — and the unique
8
+ * index — would miss.
9
+ */
10
+ draftsEnabled?: boolean;
11
+ field: string;
12
+ /** Exclude this document, so a doc doesn't conflict with itself on update. */
13
+ id?: DefaultDocumentIDType;
14
+ locale?: Locale['code'];
15
+ req: PayloadRequest;
16
+ value: unknown;
17
+ };
18
+ /**
19
+ * Whether another document in `collection` already uses `value` for `field`.
20
+ *
21
+ * Runs the `find` operation without threading `req`, so it queries outside the caller's transaction:
22
+ * a committed read is what a uniqueness check wants (other documents are committed, the document
23
+ * being written is excluded by `id`), and it avoids the "cursor on a session with a transaction in
24
+ * progress" error that a transactional read from inside a hook would hit. `draft` includes slugs
25
+ * that only exist in a draft version.
26
+ */
27
+ export declare const fieldValueExists: ({ id, collection, draftsEnabled, field, locale, req, value, }: Args) => Promise<boolean>;
28
+ export {};
29
+ //# sourceMappingURL=fieldValueExists.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fieldValueExists.d.ts","sourceRoot":"","sources":["../../src/utilities/fieldValueExists.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAEvD,KAAK,IAAI,GAAG;IACV,UAAU,EAAE,MAAM,CAAA;IAClB;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,8EAA8E;IAC9E,EAAE,CAAC,EAAE,qBAAqB,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA;IACvB,GAAG,EAAE,cAAc,CAAA;IACnB,KAAK,EAAE,OAAO,CAAA;CACf,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,kEAQ1B,IAAI,KAAG,OAAO,CAAC,OAAO,CAaxB,CAAA"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Whether another document in `collection` already uses `value` for `field`.
3
+ *
4
+ * Runs the `find` operation without threading `req`, so it queries outside the caller's transaction:
5
+ * a committed read is what a uniqueness check wants (other documents are committed, the document
6
+ * being written is excluded by `id`), and it avoids the "cursor on a session with a transaction in
7
+ * progress" error that a transactional read from inside a hook would hit. `draft` includes slugs
8
+ * that only exist in a draft version.
9
+ */ export const fieldValueExists = async ({ id, collection, draftsEnabled, field, locale, req, value })=>{
10
+ const { docs } = await req.payload.find({
11
+ collection,
12
+ depth: 0,
13
+ draft: Boolean(draftsEnabled),
14
+ limit: 2,
15
+ locale: locale,
16
+ overrideAccess: true,
17
+ pagination: false,
18
+ where: {
19
+ [field]: {
20
+ equals: value
21
+ }
22
+ }
23
+ });
24
+ return docs.some((doc)=>doc.id !== id);
25
+ };
26
+
27
+ //# sourceMappingURL=fieldValueExists.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utilities/fieldValueExists.ts"],"sourcesContent":["import type { DefaultDocumentIDType, Locale } from '../index.js'\nimport type { PayloadRequest } from '../types/index.js'\n\ntype Args = {\n collection: string\n /**\n * When true, also matches documents whose value only exists in a draft version. A versioned\n * collection keeps draft data in `_versions`, which the main-collection query — and the unique\n * index — would miss.\n */\n draftsEnabled?: boolean\n field: string\n /** Exclude this document, so a doc doesn't conflict with itself on update. */\n id?: DefaultDocumentIDType\n locale?: Locale['code']\n req: PayloadRequest\n value: unknown\n}\n\n/**\n * Whether another document in `collection` already uses `value` for `field`.\n *\n * Runs the `find` operation without threading `req`, so it queries outside the caller's transaction:\n * a committed read is what a uniqueness check wants (other documents are committed, the document\n * being written is excluded by `id`), and it avoids the \"cursor on a session with a transaction in\n * progress\" error that a transactional read from inside a hook would hit. `draft` includes slugs\n * that only exist in a draft version.\n */\nexport const fieldValueExists = async ({\n id,\n collection,\n draftsEnabled,\n field,\n locale,\n req,\n value,\n}: Args): Promise<boolean> => {\n const { docs } = await req.payload.find({\n collection,\n depth: 0,\n draft: Boolean(draftsEnabled),\n limit: 2,\n locale: locale as Parameters<typeof req.payload.find>[0]['locale'],\n overrideAccess: true,\n pagination: false,\n where: { [field]: { equals: value } },\n })\n\n return docs.some((doc) => doc.id !== id)\n}\n"],"names":["fieldValueExists","id","collection","draftsEnabled","field","locale","req","value","docs","payload","find","depth","draft","Boolean","limit","overrideAccess","pagination","where","equals","some","doc"],"mappings":"AAmBA;;;;;;;;CAQC,GACD,OAAO,MAAMA,mBAAmB,OAAO,EACrCC,EAAE,EACFC,UAAU,EACVC,aAAa,EACbC,KAAK,EACLC,MAAM,EACNC,GAAG,EACHC,KAAK,EACA;IACL,MAAM,EAAEC,IAAI,EAAE,GAAG,MAAMF,IAAIG,OAAO,CAACC,IAAI,CAAC;QACtCR;QACAS,OAAO;QACPC,OAAOC,QAAQV;QACfW,OAAO;QACPT,QAAQA;QACRU,gBAAgB;QAChBC,YAAY;QACZC,OAAO;YAAE,CAACb,MAAM,EAAE;gBAAEc,QAAQX;YAAM;QAAE;IACtC;IAEA,OAAOC,KAAKW,IAAI,CAAC,CAACC,MAAQA,IAAInB,EAAE,KAAKA;AACvC,EAAC"}
@@ -0,0 +1,27 @@
1
+ import type { DefaultDocumentIDType, Locale } from '../index.js';
2
+ import type { PayloadRequest } from '../types/index.js';
3
+ type Args = {
4
+ collection: string;
5
+ /** Also treat a value taken by a draft-only version as unavailable. */
6
+ draftsEnabled?: boolean;
7
+ /** Field name to check for uniqueness. */
8
+ field: string;
9
+ /** Exclude this doc from the check when updating; omit for a new doc. */
10
+ id?: DefaultDocumentIDType;
11
+ /** Locale to scope the check to, for localized fields. */
12
+ locale?: Locale['code'];
13
+ req: PayloadRequest;
14
+ /**
15
+ * Index the search starts from. `0` (default) tries the bare `value` first, then `value-1`, …
16
+ * `1` always suffixes: `value-1`, `value-2`, … — useful for a counter that reads as `value-N`.
17
+ */
18
+ startIndex?: number;
19
+ value: string;
20
+ };
21
+ /**
22
+ * Returns the first available value for `field` in `collection` — either the bare `value` or a
23
+ * `value-N` variant. Useful when a unique field value is minted outside the operation pipeline.
24
+ */
25
+ export declare const getUniqueFieldValue: ({ id, collection, draftsEnabled, field, locale, req, startIndex, value, }: Args) => Promise<string>;
26
+ export {};
27
+ //# sourceMappingURL=getUniqueFieldValue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getUniqueFieldValue.d.ts","sourceRoot":"","sources":["../../src/utilities/getUniqueFieldValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAIvD,KAAK,IAAI,GAAG;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,uEAAuE;IACvE,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAA;IACb,yEAAyE;IACzE,EAAE,CAAC,EAAE,qBAAqB,CAAA;IAC1B,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA;IACvB,GAAG,EAAE,cAAc,CAAA;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAKD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,8EAS7B,IAAI,KAAG,OAAO,CAAC,MAAM,CAoBvB,CAAA"}
@@ -0,0 +1,26 @@
1
+ import { fieldValueExists } from './fieldValueExists.js';
2
+ // Bounded so a pathological run of taken suffixes can't loop forever; the check below is the guard.
3
+ const MAX_SUFFIX_ATTEMPTS = 50;
4
+ /**
5
+ * Returns the first available value for `field` in `collection` — either the bare `value` or a
6
+ * `value-N` variant. Useful when a unique field value is minted outside the operation pipeline.
7
+ */ export const getUniqueFieldValue = async ({ id, collection, draftsEnabled, field, locale, req, startIndex = 0, value })=>{
8
+ for(let index = startIndex; index <= startIndex + MAX_SUFFIX_ATTEMPTS; index++){
9
+ const candidate = index === 0 ? value : `${value}-${index}`;
10
+ const taken = await fieldValueExists({
11
+ id,
12
+ collection,
13
+ draftsEnabled,
14
+ field,
15
+ locale,
16
+ req,
17
+ value: candidate
18
+ });
19
+ if (!taken) {
20
+ return candidate;
21
+ }
22
+ }
23
+ return `${value}-${startIndex + MAX_SUFFIX_ATTEMPTS}`;
24
+ };
25
+
26
+ //# sourceMappingURL=getUniqueFieldValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utilities/getUniqueFieldValue.ts"],"sourcesContent":["import type { DefaultDocumentIDType, Locale } from '../index.js'\nimport type { PayloadRequest } from '../types/index.js'\n\nimport { fieldValueExists } from './fieldValueExists.js'\n\ntype Args = {\n collection: string\n /** Also treat a value taken by a draft-only version as unavailable. */\n draftsEnabled?: boolean\n /** Field name to check for uniqueness. */\n field: string\n /** Exclude this doc from the check when updating; omit for a new doc. */\n id?: DefaultDocumentIDType\n /** Locale to scope the check to, for localized fields. */\n locale?: Locale['code']\n req: PayloadRequest\n /**\n * Index the search starts from. `0` (default) tries the bare `value` first, then `value-1`, …\n * `1` always suffixes: `value-1`, `value-2`, … — useful for a counter that reads as `value-N`.\n */\n startIndex?: number\n value: string\n}\n\n// Bounded so a pathological run of taken suffixes can't loop forever; the check below is the guard.\nconst MAX_SUFFIX_ATTEMPTS = 50\n\n/**\n * Returns the first available value for `field` in `collection` — either the bare `value` or a\n * `value-N` variant. Useful when a unique field value is minted outside the operation pipeline.\n */\nexport const getUniqueFieldValue = async ({\n id,\n collection,\n draftsEnabled,\n field,\n locale,\n req,\n startIndex = 0,\n value,\n}: Args): Promise<string> => {\n for (let index = startIndex; index <= startIndex + MAX_SUFFIX_ATTEMPTS; index++) {\n const candidate = index === 0 ? value : `${value}-${index}`\n\n const taken = await fieldValueExists({\n id,\n collection,\n draftsEnabled,\n field,\n locale,\n req,\n value: candidate,\n })\n\n if (!taken) {\n return candidate\n }\n }\n\n return `${value}-${startIndex + MAX_SUFFIX_ATTEMPTS}`\n}\n"],"names":["fieldValueExists","MAX_SUFFIX_ATTEMPTS","getUniqueFieldValue","id","collection","draftsEnabled","field","locale","req","startIndex","value","index","candidate","taken"],"mappings":"AAGA,SAASA,gBAAgB,QAAQ,wBAAuB;AAqBxD,oGAAoG;AACpG,MAAMC,sBAAsB;AAE5B;;;CAGC,GACD,OAAO,MAAMC,sBAAsB,OAAO,EACxCC,EAAE,EACFC,UAAU,EACVC,aAAa,EACbC,KAAK,EACLC,MAAM,EACNC,GAAG,EACHC,aAAa,CAAC,EACdC,KAAK,EACA;IACL,IAAK,IAAIC,QAAQF,YAAYE,SAASF,aAAaR,qBAAqBU,QAAS;QAC/E,MAAMC,YAAYD,UAAU,IAAID,QAAQ,GAAGA,MAAM,CAAC,EAAEC,OAAO;QAE3D,MAAME,QAAQ,MAAMb,iBAAiB;YACnCG;YACAC;YACAC;YACAC;YACAC;YACAC;YACAE,OAAOE;QACT;QAEA,IAAI,CAACC,OAAO;YACV,OAAOD;QACT;IACF;IAEA,OAAO,GAAGF,MAAM,CAAC,EAAED,aAAaR,qBAAqB;AACvD,EAAC"}
@@ -13,8 +13,8 @@ export const deleteScheduledPublishJobs = async ({ id, slug, payload, req })=>{
13
13
  }
14
14
  },
15
15
  {
16
- processing: {
17
- equals: false
16
+ processingUntil: {
17
+ exists: false
18
18
  }
19
19
  },
20
20
  {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/versions/deleteScheduledPublishJobs.ts"],"sourcesContent":["import type { PayloadRequest } from '../types/index.js'\n\nimport { type Payload } from '../index.js'\nimport { jobsCollectionSlug } from '../queues/config/collection.js'\n\ntype Args = {\n id?: number | string\n payload: Payload\n req?: PayloadRequest\n slug: string\n}\n\nexport const deleteScheduledPublishJobs = async ({\n id,\n slug,\n payload,\n req,\n}: Args): Promise<void> => {\n try {\n await payload.db.deleteMany({\n collection: jobsCollectionSlug,\n req,\n where: {\n and: [\n // only want to delete jobs have not run yet\n {\n completedAt: {\n exists: false,\n },\n },\n {\n processing: {\n equals: false,\n },\n },\n {\n 'input.doc.value': {\n equals: id,\n },\n },\n {\n 'input.doc.relationTo': {\n equals: slug,\n },\n },\n // data.type narrows scheduled publish jobs in case of another job having input.doc.value\n {\n taskSlug: {\n equals: 'schedulePublish',\n },\n },\n ],\n },\n })\n } catch (err) {\n payload.logger.error({\n err,\n msg: `There was an error deleting scheduled publish jobs from the queue for ${slug} document with ID ${id}.`,\n })\n }\n}\n"],"names":["jobsCollectionSlug","deleteScheduledPublishJobs","id","slug","payload","req","db","deleteMany","collection","where","and","completedAt","exists","processing","equals","taskSlug","err","logger","error","msg"],"mappings":"AAGA,SAASA,kBAAkB,QAAQ,iCAAgC;AASnE,OAAO,MAAMC,6BAA6B,OAAO,EAC/CC,EAAE,EACFC,IAAI,EACJC,OAAO,EACPC,GAAG,EACE;IACL,IAAI;QACF,MAAMD,QAAQE,EAAE,CAACC,UAAU,CAAC;YAC1BC,YAAYR;YACZK;YACAI,OAAO;gBACLC,KAAK;oBACH,4CAA4C;oBAC5C;wBACEC,aAAa;4BACXC,QAAQ;wBACV;oBACF;oBACA;wBACEC,YAAY;4BACVC,QAAQ;wBACV;oBACF;oBACA;wBACE,mBAAmB;4BACjBA,QAAQZ;wBACV;oBACF;oBACA;wBACE,wBAAwB;4BACtBY,QAAQX;wBACV;oBACF;oBACA,yFAAyF;oBACzF;wBACEY,UAAU;4BACRD,QAAQ;wBACV;oBACF;iBACD;YACH;QACF;IACF,EAAE,OAAOE,KAAK;QACZZ,QAAQa,MAAM,CAACC,KAAK,CAAC;YACnBF;YACAG,KAAK,CAAC,sEAAsE,EAAEhB,KAAK,kBAAkB,EAAED,GAAG,CAAC,CAAC;QAC9G;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../../src/versions/deleteScheduledPublishJobs.ts"],"sourcesContent":["import type { PayloadRequest } from '../types/index.js'\n\nimport { type Payload } from '../index.js'\nimport { jobsCollectionSlug } from '../queues/config/collection.js'\n\ntype Args = {\n id?: number | string\n payload: Payload\n req?: PayloadRequest\n slug: string\n}\n\nexport const deleteScheduledPublishJobs = async ({\n id,\n slug,\n payload,\n req,\n}: Args): Promise<void> => {\n try {\n await payload.db.deleteMany({\n collection: jobsCollectionSlug,\n req,\n where: {\n and: [\n // only want to delete jobs have not run yet\n {\n completedAt: {\n exists: false,\n },\n },\n {\n processingUntil: {\n exists: false,\n },\n },\n {\n 'input.doc.value': {\n equals: id,\n },\n },\n {\n 'input.doc.relationTo': {\n equals: slug,\n },\n },\n // data.type narrows scheduled publish jobs in case of another job having input.doc.value\n {\n taskSlug: {\n equals: 'schedulePublish',\n },\n },\n ],\n },\n })\n } catch (err) {\n payload.logger.error({\n err,\n msg: `There was an error deleting scheduled publish jobs from the queue for ${slug} document with ID ${id}.`,\n })\n }\n}\n"],"names":["jobsCollectionSlug","deleteScheduledPublishJobs","id","slug","payload","req","db","deleteMany","collection","where","and","completedAt","exists","processingUntil","equals","taskSlug","err","logger","error","msg"],"mappings":"AAGA,SAASA,kBAAkB,QAAQ,iCAAgC;AASnE,OAAO,MAAMC,6BAA6B,OAAO,EAC/CC,EAAE,EACFC,IAAI,EACJC,OAAO,EACPC,GAAG,EACE;IACL,IAAI;QACF,MAAMD,QAAQE,EAAE,CAACC,UAAU,CAAC;YAC1BC,YAAYR;YACZK;YACAI,OAAO;gBACLC,KAAK;oBACH,4CAA4C;oBAC5C;wBACEC,aAAa;4BACXC,QAAQ;wBACV;oBACF;oBACA;wBACEC,iBAAiB;4BACfD,QAAQ;wBACV;oBACF;oBACA;wBACE,mBAAmB;4BACjBE,QAAQZ;wBACV;oBACF;oBACA;wBACE,wBAAwB;4BACtBY,QAAQX;wBACV;oBACF;oBACA,yFAAyF;oBACzF;wBACEY,UAAU;4BACRD,QAAQ;wBACV;oBACF;iBACD;YACH;QACF;IACF,EAAE,OAAOE,KAAK;QACZZ,QAAQa,MAAM,CAACC,KAAK,CAAC;YACnBF;YACAG,KAAK,CAAC,sEAAsE,EAAEhB,KAAK,kBAAkB,EAAED,GAAG,CAAC,CAAC;QAC9G;IACF;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"payloadPackageList.d.ts","sourceRoot":"","sources":["../../src/versions/payloadPackageList.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,UA0ChC,CAAA"}
1
+ {"version":3,"file":"payloadPackageList.d.ts","sourceRoot":"","sources":["../../src/versions/payloadPackageList.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,UAyChC,CAAA"}
@@ -36,7 +36,6 @@ export const PAYLOAD_PACKAGE_LIST = [
36
36
  '@payloadcms/storage-gcs',
37
37
  '@payloadcms/storage-r2',
38
38
  '@payloadcms/storage-s3',
39
- '@payloadcms/storage-uploadthing',
40
39
  '@payloadcms/storage-vercel-blob',
41
40
  '@payloadcms/translations',
42
41
  '@payloadcms/ui/shared'
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/versions/payloadPackageList.ts"],"sourcesContent":["export const PAYLOAD_PACKAGE_LIST = [\n 'payload',\n '@payloadcms/bundler-vite',\n '@payloadcms/bundler-webpack',\n '@payloadcms/db-d1-sqlite',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/drizzle',\n '@payloadcms/ecommerce',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/live-preview',\n '@payloadcms/live-preview-react',\n '@payloadcms/live-preview-vue',\n '@payloadcms/kv-redis',\n '@payloadcms/next/utilities',\n '@payloadcms/payload-cloud',\n '@payloadcms/plugin-cloud-storage',\n '@payloadcms/plugin-form-builder',\n '@payloadcms/plugin-import-export',\n '@payloadcms/plugin-mcp',\n '@payloadcms/plugin-multi-tenant',\n '@payloadcms/plugin-nested-docs',\n '@payloadcms/plugin-redirects',\n '@payloadcms/plugin-search',\n '@payloadcms/plugin-seo',\n '@payloadcms/plugin-stripe',\n '@payloadcms/plugin-zapier',\n '@payloadcms/typescript-plugin',\n '@payloadcms/richtext-lexical',\n '@payloadcms/sdk',\n '@payloadcms/storage-azure',\n '@payloadcms/storage-gcs',\n '@payloadcms/storage-r2',\n '@payloadcms/storage-s3',\n '@payloadcms/storage-uploadthing',\n '@payloadcms/storage-vercel-blob',\n '@payloadcms/translations',\n '@payloadcms/ui/shared',\n]\n"],"names":["PAYLOAD_PACKAGE_LIST"],"mappings":"AAAA,OAAO,MAAMA,uBAAuB;IAClC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA"}
1
+ {"version":3,"sources":["../../src/versions/payloadPackageList.ts"],"sourcesContent":["export const PAYLOAD_PACKAGE_LIST = [\n 'payload',\n '@payloadcms/bundler-vite',\n '@payloadcms/bundler-webpack',\n '@payloadcms/db-d1-sqlite',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/drizzle',\n '@payloadcms/ecommerce',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/live-preview',\n '@payloadcms/live-preview-react',\n '@payloadcms/live-preview-vue',\n '@payloadcms/kv-redis',\n '@payloadcms/next/utilities',\n '@payloadcms/payload-cloud',\n '@payloadcms/plugin-cloud-storage',\n '@payloadcms/plugin-form-builder',\n '@payloadcms/plugin-import-export',\n '@payloadcms/plugin-mcp',\n '@payloadcms/plugin-multi-tenant',\n '@payloadcms/plugin-nested-docs',\n '@payloadcms/plugin-redirects',\n '@payloadcms/plugin-search',\n '@payloadcms/plugin-seo',\n '@payloadcms/plugin-stripe',\n '@payloadcms/plugin-zapier',\n '@payloadcms/typescript-plugin',\n '@payloadcms/richtext-lexical',\n '@payloadcms/sdk',\n '@payloadcms/storage-azure',\n '@payloadcms/storage-gcs',\n '@payloadcms/storage-r2',\n '@payloadcms/storage-s3',\n '@payloadcms/storage-vercel-blob',\n '@payloadcms/translations',\n '@payloadcms/ui/shared',\n]\n"],"names":["PAYLOAD_PACKAGE_LIST"],"mappings":"AAAA,OAAO,MAAMA,uBAAuB;IAClC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payload",
3
- "version": "4.0.0-internal.cd69eef",
3
+ "version": "4.0.0-internal.d1cc1d3",
4
4
  "description": "Node, React, Headless CMS and Application Framework built on Next.js",
5
5
  "keywords": [
6
6
  "admin panel",
@@ -61,6 +61,11 @@
61
61
  "types": "./dist/exports/shared.d.ts",
62
62
  "default": "./dist/exports/shared.js"
63
63
  },
64
+ "./auth": {
65
+ "import": "./dist/exports/auth.js",
66
+ "types": "./dist/exports/auth.d.ts",
67
+ "default": "./dist/exports/auth.js"
68
+ },
64
69
  "./i18n/*": {
65
70
  "import": "./dist/exports/i18n/*.js",
66
71
  "types": "./dist/exports/i18n/*.d.ts",
@@ -101,7 +106,7 @@
101
106
  "file-type": "22.0.1",
102
107
  "get-tsconfig": "4.14.0",
103
108
  "http-status": "2.1.0",
104
- "image-size": "2.0.2",
109
+ "image-dimensions": "2.5.1",
105
110
  "ipaddr.js": "2.3.0",
106
111
  "jose": "6.2.3",
107
112
  "json-schema-to-typescript": "15.0.3",
@@ -118,7 +123,7 @@
118
123
  "undici": "7.28.0",
119
124
  "uuid": "14.0.0",
120
125
  "ws": "^8.16.0",
121
- "@payloadcms/translations": "4.0.0-internal.cd69eef"
126
+ "@payloadcms/translations": "4.0.0-internal.d1cc1d3"
122
127
  },
123
128
  "devDependencies": {
124
129
  "@hyrious/esbuild-plugin-commonjs": "0.2.6",
@@ -1,3 +0,0 @@
1
- import type { UpdateJobs } from './types.js';
2
- export declare const defaultUpdateJobs: UpdateJobs;
3
- //# sourceMappingURL=defaultUpdateJobs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"defaultUpdateJobs.d.ts","sourceRoot":"","sources":["../../src/database/defaultUpdateJobs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAI5C,eAAO,MAAM,iBAAiB,EAAE,UA8C/B,CAAA"}
@@ -1,41 +0,0 @@
1
- import { jobsCollectionSlug } from '../queues/config/collection.js';
2
- export const defaultUpdateJobs = async function updateMany({ id, data, limit, req, returning, where }) {
3
- const updatedJobs = [];
4
- const jobsToUpdate = (id ? [
5
- await this.findOne({
6
- collection: jobsCollectionSlug,
7
- req,
8
- where: {
9
- id: {
10
- equals: id
11
- }
12
- }
13
- })
14
- ] : (await this.find({
15
- collection: jobsCollectionSlug,
16
- limit,
17
- pagination: false,
18
- req,
19
- where
20
- })).docs).filter(Boolean);
21
- if (!jobsToUpdate) {
22
- return null;
23
- }
24
- for (const job of jobsToUpdate){
25
- const updateData = {
26
- ...job,
27
- ...data
28
- };
29
- const updatedJob = await this.updateOne({
30
- id: job.id,
31
- collection: jobsCollectionSlug,
32
- data: updateData,
33
- req,
34
- returning
35
- });
36
- updatedJobs.push(updatedJob);
37
- }
38
- return updatedJobs;
39
- };
40
-
41
- //# sourceMappingURL=defaultUpdateJobs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/database/defaultUpdateJobs.ts"],"sourcesContent":["import type { DatabaseAdapter, Job } from '../index.js'\nimport type { UpdateJobs } from './types.js'\n\nimport { jobsCollectionSlug } from '../queues/config/collection.js'\n\nexport const defaultUpdateJobs: UpdateJobs = async function updateMany(\n this: DatabaseAdapter,\n { id, data, limit, req, returning, where },\n) {\n const updatedJobs: Job[] | null = []\n\n const jobsToUpdate: Job[] = (\n id\n ? [\n await this.findOne({\n collection: jobsCollectionSlug,\n req,\n where: { id: { equals: id } },\n }),\n ]\n : (\n await this.find({\n collection: jobsCollectionSlug,\n limit,\n pagination: false,\n req,\n where,\n })\n ).docs\n ).filter(Boolean) as Job[]\n\n if (!jobsToUpdate) {\n return null\n }\n\n for (const job of jobsToUpdate) {\n const updateData = {\n ...job,\n ...data,\n }\n const updatedJob = await this.updateOne({\n id: job.id,\n collection: jobsCollectionSlug,\n data: updateData,\n req,\n returning,\n })\n updatedJobs.push(updatedJob)\n }\n\n return updatedJobs\n}\n"],"names":["jobsCollectionSlug","defaultUpdateJobs","updateMany","id","data","limit","req","returning","where","updatedJobs","jobsToUpdate","findOne","collection","equals","find","pagination","docs","filter","Boolean","job","updateData","updatedJob","updateOne","push"],"mappings":"AAGA,SAASA,kBAAkB,QAAQ,iCAAgC;AAEnE,OAAO,MAAMC,oBAAgC,eAAeC,WAE1D,EAAEC,EAAE,EAAEC,IAAI,EAAEC,KAAK,EAAEC,GAAG,EAAEC,SAAS,EAAEC,KAAK,EAAE;IAE1C,MAAMC,cAA4B,EAAE;IAEpC,MAAMC,eAAsB,AAC1BP,CAAAA,KACI;QACE,MAAM,IAAI,CAACQ,OAAO,CAAC;YACjBC,YAAYZ;YACZM;YACAE,OAAO;gBAAEL,IAAI;oBAAEU,QAAQV;gBAAG;YAAE;QAC9B;KACD,GACD,AACE,CAAA,MAAM,IAAI,CAACW,IAAI,CAAC;QACdF,YAAYZ;QACZK;QACAU,YAAY;QACZT;QACAE;IACF,EAAC,EACDQ,IAAI,AAAD,EACTC,MAAM,CAACC;IAET,IAAI,CAACR,cAAc;QACjB,OAAO;IACT;IAEA,KAAK,MAAMS,OAAOT,aAAc;QAC9B,MAAMU,aAAa;YACjB,GAAGD,GAAG;YACN,GAAGf,IAAI;QACT;QACA,MAAMiB,aAAa,MAAM,IAAI,CAACC,SAAS,CAAC;YACtCnB,IAAIgB,IAAIhB,EAAE;YACVS,YAAYZ;YACZI,MAAMgB;YACNd;YACAC;QACF;QACAE,YAAYc,IAAI,CAACF;IACnB;IAEA,OAAOZ;AACT,EAAC"}
@@ -1,13 +0,0 @@
1
- import type { CollectionSlug, DefaultDocumentIDType, GlobalSlug, PayloadRequest } from '../../../index.js';
2
- /**
3
- * This is a cross-entity way to count the number of versions for any given document.
4
- * It will work for both collections and globals.
5
- * @returns number of versions
6
- */
7
- export declare const countVersions: (args: {
8
- collectionSlug?: CollectionSlug;
9
- globalSlug?: GlobalSlug;
10
- parentID?: DefaultDocumentIDType;
11
- req: PayloadRequest;
12
- }) => Promise<number>;
13
- //# sourceMappingURL=countVersions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"countVersions.d.ts","sourceRoot":"","sources":["../../../../src/fields/baseFields/slug/countVersions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,UAAU,EACV,cAAc,EACf,MAAM,mBAAmB,CAAA;AAE1B;;;;GAIG;AACH,eAAO,MAAM,aAAa,SAAgB;IACxC,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,QAAQ,CAAC,EAAE,qBAAqB,CAAA;IAChC,GAAG,EAAE,cAAc,CAAA;CACpB,KAAG,OAAO,CAAC,MAAM,CA2BjB,CAAA"}
@@ -1,27 +0,0 @@
1
- /**
2
- * This is a cross-entity way to count the number of versions for any given document.
3
- * It will work for both collections and globals.
4
- * @returns number of versions
5
- */ export const countVersions = async (args)=>{
6
- const { collectionSlug, globalSlug, parentID, req } = args;
7
- let countFn;
8
- if (collectionSlug) {
9
- countFn = ()=>req.payload.countVersions({
10
- collection: collectionSlug,
11
- where: {
12
- parent: {
13
- equals: parentID
14
- }
15
- }
16
- });
17
- }
18
- if (globalSlug) {
19
- countFn = ()=>req.payload.countGlobalVersions({
20
- global: globalSlug
21
- });
22
- }
23
- const res = countFn ? await countFn()?.then((res)=>res.totalDocs || 0) || 0 : 0;
24
- return res;
25
- };
26
-
27
- //# sourceMappingURL=countVersions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/fields/baseFields/slug/countVersions.ts"],"sourcesContent":["import type {\n CollectionSlug,\n DefaultDocumentIDType,\n GlobalSlug,\n PayloadRequest,\n} from '../../../index.js'\n\n/**\n * This is a cross-entity way to count the number of versions for any given document.\n * It will work for both collections and globals.\n * @returns number of versions\n */\nexport const countVersions = async (args: {\n collectionSlug?: CollectionSlug\n globalSlug?: GlobalSlug\n parentID?: DefaultDocumentIDType\n req: PayloadRequest\n}): Promise<number> => {\n const { collectionSlug, globalSlug, parentID, req } = args\n\n let countFn\n\n if (collectionSlug) {\n countFn = () =>\n req.payload.countVersions({\n collection: collectionSlug,\n where: {\n parent: {\n equals: parentID,\n },\n },\n })\n }\n\n if (globalSlug) {\n countFn = () =>\n req.payload.countGlobalVersions({\n global: globalSlug,\n })\n }\n\n const res = countFn ? (await countFn()?.then((res) => res.totalDocs || 0)) || 0 : 0\n\n return res\n}\n"],"names":["countVersions","args","collectionSlug","globalSlug","parentID","req","countFn","payload","collection","where","parent","equals","countGlobalVersions","global","res","then","totalDocs"],"mappings":"AAOA;;;;CAIC,GACD,OAAO,MAAMA,gBAAgB,OAAOC;IAMlC,MAAM,EAAEC,cAAc,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,GAAG,EAAE,GAAGJ;IAEtD,IAAIK;IAEJ,IAAIJ,gBAAgB;QAClBI,UAAU,IACRD,IAAIE,OAAO,CAACP,aAAa,CAAC;gBACxBQ,YAAYN;gBACZO,OAAO;oBACLC,QAAQ;wBACNC,QAAQP;oBACV;gBACF;YACF;IACJ;IAEA,IAAID,YAAY;QACdG,UAAU,IACRD,IAAIE,OAAO,CAACK,mBAAmB,CAAC;gBAC9BC,QAAQV;YACV;IACJ;IAEA,MAAMW,MAAMR,UAAU,AAAC,MAAMA,WAAWS,KAAK,CAACD,MAAQA,IAAIE,SAAS,IAAI,MAAO,IAAI;IAElF,OAAOF;AACT,EAAC"}
@@ -1,7 +0,0 @@
1
- type Options = {
2
- extension?: string;
3
- name?: string;
4
- };
5
- export declare const temporaryFileTask: (callback: (temporaryPath: string) => Promise<any>, options?: Options) => Promise<any>;
6
- export {};
7
- //# sourceMappingURL=tempFile.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tempFile.d.ts","sourceRoot":"","sources":["../../src/uploads/tempFile.ts"],"names":[],"mappings":"AAaA,KAAK,OAAO,GAAG;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,eAAO,MAAM,iBAAiB,aAClB,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,YACxC,OAAO,iBAIjB,CAAA"}