payload 3.0.0-beta.95 → 3.0.0-beta.97

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 (320) hide show
  1. package/dist/admin/RichText.d.ts +4 -3
  2. package/dist/admin/RichText.d.ts.map +1 -1
  3. package/dist/admin/RichText.js.map +1 -1
  4. package/dist/admin/elements/Tab.d.ts +1 -1
  5. package/dist/admin/elements/Tab.d.ts.map +1 -1
  6. package/dist/admin/elements/Tab.js.map +1 -1
  7. package/dist/admin/forms/Description.d.ts +1 -1
  8. package/dist/admin/forms/Description.d.ts.map +1 -1
  9. package/dist/admin/forms/Description.js.map +1 -1
  10. package/dist/admin/forms/Error.d.ts +1 -1
  11. package/dist/admin/forms/Error.d.ts.map +1 -1
  12. package/dist/admin/forms/Error.js.map +1 -1
  13. package/dist/admin/forms/Form.d.ts +1 -1
  14. package/dist/admin/forms/Form.d.ts.map +1 -1
  15. package/dist/admin/forms/Form.js.map +1 -1
  16. package/dist/admin/forms/Label.d.ts +1 -1
  17. package/dist/admin/forms/Label.d.ts.map +1 -1
  18. package/dist/admin/forms/Label.js.map +1 -1
  19. package/dist/admin/types.d.ts +5 -5
  20. package/dist/admin/types.d.ts.map +1 -1
  21. package/dist/admin/types.js.map +1 -1
  22. package/dist/admin/views/types.d.ts +1 -1
  23. package/dist/admin/views/types.d.ts.map +1 -1
  24. package/dist/admin/views/types.js.map +1 -1
  25. package/dist/auth/executeAccess.d.ts.map +1 -1
  26. package/dist/auth/executeAccess.js +6 -2
  27. package/dist/auth/executeAccess.js.map +1 -1
  28. package/dist/auth/getAuthFields.d.ts.map +1 -1
  29. package/dist/auth/getAuthFields.js +3 -1
  30. package/dist/auth/getAuthFields.js.map +1 -1
  31. package/dist/auth/isLocked.d.ts.map +1 -1
  32. package/dist/auth/isLocked.js +3 -1
  33. package/dist/auth/isLocked.js.map +1 -1
  34. package/dist/auth/operations/auth.d.ts +1 -1
  35. package/dist/auth/operations/auth.d.ts.map +1 -1
  36. package/dist/auth/operations/auth.js +3 -1
  37. package/dist/auth/operations/auth.js.map +1 -1
  38. package/dist/auth/operations/forgotPassword.d.ts.map +1 -1
  39. package/dist/auth/operations/forgotPassword.js +6 -2
  40. package/dist/auth/operations/forgotPassword.js.map +1 -1
  41. package/dist/auth/operations/login.d.ts.map +1 -1
  42. package/dist/auth/operations/login.js +6 -2
  43. package/dist/auth/operations/login.js.map +1 -1
  44. package/dist/auth/operations/logout.d.ts.map +1 -1
  45. package/dist/auth/operations/logout.js +6 -2
  46. package/dist/auth/operations/logout.js.map +1 -1
  47. package/dist/auth/operations/me.d.ts.map +1 -1
  48. package/dist/auth/operations/me.js +6 -2
  49. package/dist/auth/operations/me.js.map +1 -1
  50. package/dist/auth/operations/refresh.d.ts.map +1 -1
  51. package/dist/auth/operations/refresh.js +6 -2
  52. package/dist/auth/operations/refresh.js.map +1 -1
  53. package/dist/auth/operations/registerFirstUser.d.ts.map +1 -1
  54. package/dist/auth/operations/registerFirstUser.js +6 -2
  55. package/dist/auth/operations/registerFirstUser.js.map +1 -1
  56. package/dist/auth/operations/resetPassword.d.ts.map +1 -1
  57. package/dist/auth/operations/resetPassword.js +6 -2
  58. package/dist/auth/operations/resetPassword.js.map +1 -1
  59. package/dist/auth/operations/unlock.d.ts.map +1 -1
  60. package/dist/auth/operations/unlock.js +3 -1
  61. package/dist/auth/operations/unlock.js.map +1 -1
  62. package/dist/auth/operations/verifyEmail.d.ts.map +1 -1
  63. package/dist/auth/operations/verifyEmail.js +9 -3
  64. package/dist/auth/operations/verifyEmail.js.map +1 -1
  65. package/dist/auth/strategies/jwt.js.map +1 -1
  66. package/dist/auth/strategies/local/authenticate.d.ts.map +1 -1
  67. package/dist/auth/strategies/local/authenticate.js +3 -1
  68. package/dist/auth/strategies/local/authenticate.js.map +1 -1
  69. package/dist/auth/strategies/local/register.d.ts.map +1 -1
  70. package/dist/auth/strategies/local/register.js +3 -1
  71. package/dist/auth/strategies/local/register.js.map +1 -1
  72. package/dist/auth/strategies/local/resetLoginAttempts.d.ts.map +1 -1
  73. package/dist/auth/strategies/local/resetLoginAttempts.js +3 -1
  74. package/dist/auth/strategies/local/resetLoginAttempts.js.map +1 -1
  75. package/dist/auth/types.d.ts +5 -5
  76. package/dist/auth/types.d.ts.map +1 -1
  77. package/dist/auth/types.js.map +1 -1
  78. package/dist/bin/generateImportMap/iterateFields.js.map +1 -1
  79. package/dist/bin/generateTypes.d.ts.map +1 -1
  80. package/dist/bin/generateTypes.js +7 -3
  81. package/dist/bin/generateTypes.js.map +1 -1
  82. package/dist/bin/index.d.ts.map +1 -1
  83. package/dist/bin/index.js +3 -1
  84. package/dist/bin/index.js.map +1 -1
  85. package/dist/collections/config/client.d.ts +2 -2
  86. package/dist/collections/config/client.d.ts.map +1 -1
  87. package/dist/collections/config/client.js.map +1 -1
  88. package/dist/collections/config/reservedFieldNames.spec.js +4 -4
  89. package/dist/collections/config/reservedFieldNames.spec.js.map +1 -1
  90. package/dist/collections/config/sanitize.d.ts.map +1 -1
  91. package/dist/collections/config/sanitize.js +15 -6
  92. package/dist/collections/config/sanitize.js.map +1 -1
  93. package/dist/collections/config/types.d.ts +9 -9
  94. package/dist/collections/config/types.d.ts.map +1 -1
  95. package/dist/collections/config/types.js.map +1 -1
  96. package/dist/collections/dataloader.d.ts +1 -1
  97. package/dist/collections/dataloader.d.ts.map +1 -1
  98. package/dist/collections/dataloader.js +3 -1
  99. package/dist/collections/dataloader.js.map +1 -1
  100. package/dist/collections/operations/create.d.ts.map +1 -1
  101. package/dist/collections/operations/create.js +3 -1
  102. package/dist/collections/operations/create.js.map +1 -1
  103. package/dist/collections/operations/delete.d.ts.map +1 -1
  104. package/dist/collections/operations/delete.js +3 -1
  105. package/dist/collections/operations/delete.js.map +1 -1
  106. package/dist/collections/operations/deleteByID.d.ts.map +1 -1
  107. package/dist/collections/operations/deleteByID.js +9 -3
  108. package/dist/collections/operations/deleteByID.js.map +1 -1
  109. package/dist/collections/operations/duplicate.d.ts.map +1 -1
  110. package/dist/collections/operations/duplicate.js +9 -3
  111. package/dist/collections/operations/duplicate.js.map +1 -1
  112. package/dist/collections/operations/findByID.d.ts.map +1 -1
  113. package/dist/collections/operations/findByID.js +6 -2
  114. package/dist/collections/operations/findByID.js.map +1 -1
  115. package/dist/collections/operations/findVersionByID.d.ts.map +1 -1
  116. package/dist/collections/operations/findVersionByID.js +9 -3
  117. package/dist/collections/operations/findVersionByID.js.map +1 -1
  118. package/dist/collections/operations/restoreVersion.d.ts.map +1 -1
  119. package/dist/collections/operations/restoreVersion.js +6 -2
  120. package/dist/collections/operations/restoreVersion.js.map +1 -1
  121. package/dist/collections/operations/update.d.ts.map +1 -1
  122. package/dist/collections/operations/update.js +3 -1
  123. package/dist/collections/operations/update.js.map +1 -1
  124. package/dist/collections/operations/updateByID.d.ts.map +1 -1
  125. package/dist/collections/operations/updateByID.js +9 -3
  126. package/dist/collections/operations/updateByID.js.map +1 -1
  127. package/dist/collections/operations/utils.d.ts +1 -1
  128. package/dist/collections/operations/utils.d.ts.map +1 -1
  129. package/dist/collections/operations/utils.js.map +1 -1
  130. package/dist/config/client.d.ts +2 -2
  131. package/dist/config/client.d.ts.map +1 -1
  132. package/dist/config/client.js.map +1 -1
  133. package/dist/config/find.d.ts.map +1 -1
  134. package/dist/config/find.js +9 -3
  135. package/dist/config/find.js.map +1 -1
  136. package/dist/config/sanitize.d.ts.map +1 -1
  137. package/dist/config/sanitize.js +10 -5
  138. package/dist/config/sanitize.js.map +1 -1
  139. package/dist/config/types.d.ts +164 -35
  140. package/dist/config/types.d.ts.map +1 -1
  141. package/dist/config/types.js.map +1 -1
  142. package/dist/database/combineQueries.d.ts +1 -1
  143. package/dist/database/combineQueries.d.ts.map +1 -1
  144. package/dist/database/combineQueries.js +9 -3
  145. package/dist/database/combineQueries.js.map +1 -1
  146. package/dist/database/getLocalizedPaths.d.ts.map +1 -1
  147. package/dist/database/getLocalizedPaths.js +3 -1
  148. package/dist/database/getLocalizedPaths.js.map +1 -1
  149. package/dist/database/migrations/readMigrationFiles.d.ts.map +1 -1
  150. package/dist/database/migrations/readMigrationFiles.js +3 -1
  151. package/dist/database/migrations/readMigrationFiles.js.map +1 -1
  152. package/dist/database/types.d.ts +3 -3
  153. package/dist/database/types.d.ts.map +1 -1
  154. package/dist/database/types.js.map +1 -1
  155. package/dist/fields/config/sanitize.d.ts +2 -1
  156. package/dist/fields/config/sanitize.d.ts.map +1 -1
  157. package/dist/fields/config/sanitize.js +28 -8
  158. package/dist/fields/config/sanitize.js.map +1 -1
  159. package/dist/fields/config/types.d.ts +56 -56
  160. package/dist/fields/config/types.d.ts.map +1 -1
  161. package/dist/fields/config/types.js.map +1 -1
  162. package/dist/fields/hooks/afterChange/index.d.ts +2 -2
  163. package/dist/fields/hooks/afterChange/index.d.ts.map +1 -1
  164. package/dist/fields/hooks/afterChange/index.js.map +1 -1
  165. package/dist/fields/hooks/afterChange/promise.d.ts +2 -2
  166. package/dist/fields/hooks/afterChange/promise.d.ts.map +1 -1
  167. package/dist/fields/hooks/afterChange/promise.js.map +1 -1
  168. package/dist/fields/hooks/afterChange/traverseFields.d.ts +2 -2
  169. package/dist/fields/hooks/afterChange/traverseFields.d.ts.map +1 -1
  170. package/dist/fields/hooks/afterChange/traverseFields.js.map +1 -1
  171. package/dist/fields/hooks/afterRead/index.d.ts +2 -2
  172. package/dist/fields/hooks/afterRead/index.d.ts.map +1 -1
  173. package/dist/fields/hooks/afterRead/index.js +3 -1
  174. package/dist/fields/hooks/afterRead/index.js.map +1 -1
  175. package/dist/fields/hooks/afterRead/promise.d.ts +2 -2
  176. package/dist/fields/hooks/afterRead/promise.d.ts.map +1 -1
  177. package/dist/fields/hooks/afterRead/promise.js +6 -2
  178. package/dist/fields/hooks/afterRead/promise.js.map +1 -1
  179. package/dist/fields/hooks/afterRead/traverseFields.d.ts +2 -2
  180. package/dist/fields/hooks/afterRead/traverseFields.d.ts.map +1 -1
  181. package/dist/fields/hooks/afterRead/traverseFields.js.map +1 -1
  182. package/dist/fields/hooks/beforeChange/getExistingRowDoc.d.ts.map +1 -1
  183. package/dist/fields/hooks/beforeChange/getExistingRowDoc.js +6 -2
  184. package/dist/fields/hooks/beforeChange/getExistingRowDoc.js.map +1 -1
  185. package/dist/fields/hooks/beforeChange/index.d.ts +2 -2
  186. package/dist/fields/hooks/beforeChange/index.d.ts.map +1 -1
  187. package/dist/fields/hooks/beforeChange/index.js.map +1 -1
  188. package/dist/fields/hooks/beforeChange/promise.d.ts +2 -2
  189. package/dist/fields/hooks/beforeChange/promise.d.ts.map +1 -1
  190. package/dist/fields/hooks/beforeChange/promise.js +18 -6
  191. package/dist/fields/hooks/beforeChange/promise.js.map +1 -1
  192. package/dist/fields/hooks/beforeChange/traverseFields.d.ts +2 -2
  193. package/dist/fields/hooks/beforeChange/traverseFields.d.ts.map +1 -1
  194. package/dist/fields/hooks/beforeChange/traverseFields.js.map +1 -1
  195. package/dist/fields/hooks/beforeValidate/index.d.ts +2 -2
  196. package/dist/fields/hooks/beforeValidate/index.d.ts.map +1 -1
  197. package/dist/fields/hooks/beforeValidate/index.js.map +1 -1
  198. package/dist/fields/hooks/beforeValidate/promise.d.ts +2 -2
  199. package/dist/fields/hooks/beforeValidate/promise.d.ts.map +1 -1
  200. package/dist/fields/hooks/beforeValidate/promise.js +21 -7
  201. package/dist/fields/hooks/beforeValidate/promise.js.map +1 -1
  202. package/dist/fields/hooks/beforeValidate/traverseFields.d.ts +2 -2
  203. package/dist/fields/hooks/beforeValidate/traverseFields.d.ts.map +1 -1
  204. package/dist/fields/hooks/beforeValidate/traverseFields.js.map +1 -1
  205. package/dist/fields/validations.d.ts +1 -1
  206. package/dist/fields/validations.d.ts.map +1 -1
  207. package/dist/fields/validations.js +57 -19
  208. package/dist/fields/validations.js.map +1 -1
  209. package/dist/globals/config/sanitize.d.ts.map +1 -1
  210. package/dist/globals/config/sanitize.js +45 -16
  211. package/dist/globals/config/sanitize.js.map +1 -1
  212. package/dist/globals/config/types.d.ts +2 -2
  213. package/dist/globals/config/types.d.ts.map +1 -1
  214. package/dist/globals/config/types.js.map +1 -1
  215. package/dist/globals/operations/docAccess.d.ts.map +1 -1
  216. package/dist/globals/operations/docAccess.js +3 -1
  217. package/dist/globals/operations/docAccess.js.map +1 -1
  218. package/dist/globals/operations/findVersionByID.d.ts.map +1 -1
  219. package/dist/globals/operations/findVersionByID.js +12 -4
  220. package/dist/globals/operations/findVersionByID.js.map +1 -1
  221. package/dist/globals/operations/restoreVersion.d.ts.map +1 -1
  222. package/dist/globals/operations/restoreVersion.js +3 -1
  223. package/dist/globals/operations/restoreVersion.js.map +1 -1
  224. package/dist/globals/operations/update.d.ts.map +1 -1
  225. package/dist/globals/operations/update.js +3 -1
  226. package/dist/globals/operations/update.js.map +1 -1
  227. package/dist/index.d.ts +7 -7
  228. package/dist/index.d.ts.map +1 -1
  229. package/dist/index.js +13 -7
  230. package/dist/index.js.map +1 -1
  231. package/dist/preferences/operations/findOne.d.ts.map +1 -1
  232. package/dist/preferences/operations/findOne.js +3 -1
  233. package/dist/preferences/operations/findOne.js.map +1 -1
  234. package/dist/types/index.d.ts +3 -3
  235. package/dist/types/index.d.ts.map +1 -1
  236. package/dist/types/index.js.map +1 -1
  237. package/dist/uploads/cropImage.d.ts.map +1 -1
  238. package/dist/uploads/cropImage.js +3 -1
  239. package/dist/uploads/cropImage.js.map +1 -1
  240. package/dist/uploads/deleteAssociatedFiles.d.ts.map +1 -1
  241. package/dist/uploads/deleteAssociatedFiles.js +3 -1
  242. package/dist/uploads/deleteAssociatedFiles.js.map +1 -1
  243. package/dist/uploads/docWithFilenameExists.d.ts.map +1 -1
  244. package/dist/uploads/docWithFilenameExists.js +3 -1
  245. package/dist/uploads/docWithFilenameExists.js.map +1 -1
  246. package/dist/uploads/formatFilesize.d.ts.map +1 -1
  247. package/dist/uploads/formatFilesize.js +3 -1
  248. package/dist/uploads/formatFilesize.js.map +1 -1
  249. package/dist/uploads/generateFileData.d.ts.map +1 -1
  250. package/dist/uploads/generateFileData.js +12 -4
  251. package/dist/uploads/generateFileData.js.map +1 -1
  252. package/dist/uploads/getBaseFields.d.ts.map +1 -1
  253. package/dist/uploads/getBaseFields.js +6 -2
  254. package/dist/uploads/getBaseFields.js.map +1 -1
  255. package/dist/uploads/getExternalFile.d.ts.map +1 -1
  256. package/dist/uploads/getExternalFile.js +3 -1
  257. package/dist/uploads/getExternalFile.js.map +1 -1
  258. package/dist/uploads/imageResizer.d.ts.map +1 -1
  259. package/dist/uploads/imageResizer.js +35 -13
  260. package/dist/uploads/imageResizer.js.map +1 -1
  261. package/dist/uploads/optionallyAppendMetadata.d.ts.map +1 -1
  262. package/dist/uploads/optionallyAppendMetadata.js +3 -1
  263. package/dist/uploads/optionallyAppendMetadata.js.map +1 -1
  264. package/dist/utilities/configToJSONSchema.d.ts.map +1 -1
  265. package/dist/utilities/configToJSONSchema.js +12 -4
  266. package/dist/utilities/configToJSONSchema.js.map +1 -1
  267. package/dist/utilities/createArrayFromCommaDelineated.d.ts.map +1 -1
  268. package/dist/utilities/createArrayFromCommaDelineated.js +3 -1
  269. package/dist/utilities/createArrayFromCommaDelineated.js.map +1 -1
  270. package/dist/utilities/createLocalReq.d.ts.map +1 -1
  271. package/dist/utilities/createLocalReq.js +28 -12
  272. package/dist/utilities/createLocalReq.js.map +1 -1
  273. package/dist/utilities/deepCopyObject.d.ts.map +1 -1
  274. package/dist/utilities/deepCopyObject.js +15 -5
  275. package/dist/utilities/deepCopyObject.js.map +1 -1
  276. package/dist/utilities/dependencies/versionUtils.d.ts.map +1 -1
  277. package/dist/utilities/dependencies/versionUtils.js +24 -8
  278. package/dist/utilities/dependencies/versionUtils.js.map +1 -1
  279. package/dist/utilities/getEntityPolicies.d.ts.map +1 -1
  280. package/dist/utilities/getEntityPolicies.js +9 -3
  281. package/dist/utilities/getEntityPolicies.js.map +1 -1
  282. package/dist/utilities/getObjectDotNotation.d.ts.map +1 -1
  283. package/dist/utilities/getObjectDotNotation.js +3 -1
  284. package/dist/utilities/getObjectDotNotation.js.map +1 -1
  285. package/dist/utilities/getSiblingData.d.ts.map +1 -1
  286. package/dist/utilities/getSiblingData.js +3 -1
  287. package/dist/utilities/getSiblingData.js.map +1 -1
  288. package/dist/utilities/isReactComponent.d.ts +3 -3
  289. package/dist/utilities/isReactComponent.d.ts.map +1 -1
  290. package/dist/utilities/isReactComponent.js.map +1 -1
  291. package/dist/utilities/isValidID.d.ts +1 -1
  292. package/dist/utilities/isValidID.d.ts.map +1 -1
  293. package/dist/utilities/isValidID.js +3 -1
  294. package/dist/utilities/isValidID.js.map +1 -1
  295. package/dist/utilities/logger.d.ts +8 -3
  296. package/dist/utilities/logger.d.ts.map +1 -1
  297. package/dist/utilities/logger.js +22 -14
  298. package/dist/utilities/logger.js.map +1 -1
  299. package/dist/utilities/reduceFieldsToValues.d.ts.map +1 -1
  300. package/dist/utilities/reduceFieldsToValues.js +3 -1
  301. package/dist/utilities/reduceFieldsToValues.js.map +1 -1
  302. package/dist/utilities/telemetry/conf/index.d.ts +1 -1
  303. package/dist/utilities/telemetry/conf/index.d.ts.map +1 -1
  304. package/dist/utilities/telemetry/conf/index.js +8 -8
  305. package/dist/utilities/telemetry/conf/index.js.map +1 -1
  306. package/dist/utilities/timestamp.d.ts.map +1 -1
  307. package/dist/utilities/timestamp.js +3 -1
  308. package/dist/utilities/timestamp.js.map +1 -1
  309. package/dist/versions/drafts/appendVersionToQueryKey.js +1 -1
  310. package/dist/versions/drafts/appendVersionToQueryKey.js.map +1 -1
  311. package/dist/versions/drafts/getQueryDraftsSort.d.ts.map +1 -1
  312. package/dist/versions/drafts/getQueryDraftsSort.js +3 -1
  313. package/dist/versions/drafts/getQueryDraftsSort.js.map +1 -1
  314. package/dist/versions/saveVersion.d.ts.map +1 -1
  315. package/dist/versions/saveVersion.js +18 -6
  316. package/dist/versions/saveVersion.js.map +1 -1
  317. package/dist/versions/types.d.ts +4 -4
  318. package/dist/versions/types.d.ts.map +1 -1
  319. package/dist/versions/types.js.map +1 -1
  320. package/package.json +7 -8
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/config/types.ts"],"sourcesContent":["import type {\n DefaultTranslationsObject,\n I18nClient,\n I18nOptions,\n TFunction,\n} from '@payloadcms/translations'\nimport type { Options as ExpressFileUploadOptions } from 'express-fileupload'\nimport type GraphQL from 'graphql'\nimport type { JSONSchema4 } from 'json-schema'\nimport type { DestinationStream, LoggerOptions } from 'pino'\nimport type React from 'react'\nimport type { default as sharp } from 'sharp'\nimport type { DeepRequired } from 'ts-essentials'\n\nimport type { RichTextAdapterProvider } from '../admin/RichText.js'\nimport type { DocumentTabConfig, RichTextAdapter } from '../admin/types.js'\nimport type { AdminViewConfig, ServerSideEditViewProps } from '../admin/views/types.js'\nimport type { Permissions } from '../auth/index.js'\nimport type {\n AddToImportMap,\n ImportMap,\n Imports,\n InternalImportMap,\n} from '../bin/generateImportMap/index.js'\nimport type {\n AfterErrorHook,\n Collection,\n CollectionConfig,\n SanitizedCollectionConfig,\n} from '../collections/config/types.js'\nimport type { DatabaseAdapterResult } from '../database/types.js'\nimport type { EmailAdapter, SendEmailOptions } from '../email/types.js'\nimport type { GlobalConfig, Globals, SanitizedGlobalConfig } from '../globals/config/types.js'\nimport type { Payload, TypedUser } from '../index.js'\nimport type { PayloadRequest, Where } from '../types/index.js'\nimport type { PayloadLogger } from '../utilities/logger.js'\n\n/**\n * The string path pointing to the React component. If one of the generics is `never`, you effectively mark it as a server-only or client-only component.\n *\n * If it is `false` an empty component will be rendered.\n */\nexport type PayloadComponent<\n TComponentServerProps extends never | object = Record<string, any>,\n TComponentClientProps extends never | object = Record<string, any>,\n> = RawPayloadComponent<TComponentServerProps, TComponentClientProps> | false | string\n\n// We need the actual object as its own type, otherwise the infers for the PayloadClientReactComponent / PayloadServerReactComponent will not work due to the string union.\n// We also NEED to actually use those generics for this to work, thus they are part of the props.\nexport type RawPayloadComponent<\n TComponentServerProps extends never | object = Record<string, any>,\n TComponentClientProps extends never | object = Record<string, any>,\n> = {\n clientProps?: TComponentClientProps | object\n exportName?: string\n path: string\n serverProps?: TComponentServerProps | object\n}\n\nexport type PayloadComponentProps<TPayloadComponent> =\n TPayloadComponent extends RawPayloadComponent<\n infer TComponentServerProps,\n infer TComponentClientProps\n >\n ? TComponentClientProps | TComponentServerProps\n : never\n\nexport type PayloadClientComponentProps<TPayloadComponent> =\n TPayloadComponent extends RawPayloadComponent<infer _, infer TComponentClientProps>\n ? TComponentClientProps\n : never\n\nexport type PayloadServerComponentProps<TPayloadComponent> =\n TPayloadComponent extends RawPayloadComponent<infer TComponentServerProps, infer _>\n ? TComponentServerProps\n : never\n\nexport type PayloadReactComponent<TPayloadComponent> = React.FC<\n PayloadComponentProps<TPayloadComponent>\n>\n\n// This also ensures that if never is passed to TComponentClientProps, this entire type will be never.\n// => TypeScript will now ensure that users cannot even define the typed Server Components if the PayloadComponent is marked as\n// Client-Only (marked as Client-Only = TComponentServerProps is never)\nexport type PayloadClientReactComponent<TPayloadComponent> =\n TPayloadComponent extends RawPayloadComponent<infer _, infer TComponentClientProps>\n ? TComponentClientProps extends never\n ? never\n : React.FC<TComponentClientProps>\n : never\n\nexport type PayloadServerReactComponent<TPayloadComponent> =\n TPayloadComponent extends RawPayloadComponent<infer TComponentServerProps, infer _>\n ? TComponentServerProps extends never\n ? never\n : React.FC<TComponentServerProps>\n : never\n\nexport type ResolvedComponent<\n TComponentServerProps extends never | object,\n TComponentClientProps extends never | object,\n> = {\n Component: React.FC<TComponentClientProps | TComponentServerProps>\n clientProps?: TComponentClientProps\n serverProps?: TComponentServerProps\n}\n\nexport type BinScriptConfig = {\n key: string\n scriptPath: string\n}\n\nexport type BinScript = (config: SanitizedConfig) => Promise<void> | void\n\ntype Prettify<T> = {\n [K in keyof T]: T[K]\n} & NonNullable<unknown>\n\nexport type Plugin = (config: Config) => Config | Promise<Config>\n\nexport type LivePreviewConfig = {\n /**\n Device breakpoints to use for the `iframe` of the Live Preview window.\n Options are displayed in the Live Preview toolbar.\n The `responsive` breakpoint is included by default.\n */\n breakpoints?: {\n height: number | string\n label: string\n name: string\n width: number | string\n }[]\n /**\n The URL of the frontend application. This will be rendered within an `iframe` as its `src`.\n Payload will send a `window.postMessage()` to this URL with the document data in real-time.\n The frontend application is responsible for receiving the message and updating the UI accordingly.\n Use the `useLivePreview` hook to get started in React applications.\n */\n url?:\n | ((args: {\n collectionConfig?: SanitizedCollectionConfig\n data: Record<string, any>\n globalConfig?: SanitizedGlobalConfig\n locale: Locale\n payload: Payload\n }) => Promise<string> | string)\n | string\n}\n\nexport type OGImageConfig = {\n alt?: string\n height?: number | string\n type?: string\n url: string\n width?: number | string\n}\n\nexport type OpenGraphConfig = {\n description?: string\n images?: OGImageConfig | OGImageConfig[]\n siteName?: string\n title?: string\n}\n\nexport type IconConfig = {\n color?: string\n /**\n * @see https://developer.mozilla.org/docs/Web/API/HTMLImageElement/fetchPriority\n */\n fetchPriority?: 'auto' | 'high' | 'low'\n media?: string\n /** defaults to rel=\"icon\" */\n rel?: string\n sizes?: string\n type?: string\n /**\n * URL of the icon to use. You can use a relative path from the public folder (see https://nextjs.org/docs/app/building-your-application/optimizing/static-assets) or an absolute URL.\n */\n url: string\n}\n\nexport type MetaConfig = {\n /**\n * When `static`, a pre-made image will be used for all pages.\n * When `dynamic`, a unique image will be generated for each page based on page content and given overrides.\n * When `off`, no Open Graph images will be generated and the `/api/og` endpoint will be disabled. You can still provide custom images using the `openGraph.images` property.\n * @default 'dynamic'\n */\n defaultOGImageType?: 'dynamic' | 'off' | 'static'\n /**\n * Overrides the auto-generated <meta name=\"description\"> of admin pages\n * @example `\"This is my custom CMS built with Payload.\"`\n */\n description?: string\n /**\n * Icons to be rendered by devices and browsers.\n *\n * For example browser tabs, phone home screens, and search engine results.\n */\n icons?: IconConfig[]\n /**\n * Overrides the auto-generated <meta name=\"keywords\"> of admin pages\n * @example `\"CMS, Payload, Custom\"`\n */\n keywords?: string\n /**\n * Metadata to be rendered as `og` meta tags in the head of the Admin Panel.\n *\n * For example when sharing the Admin Panel on social media or through messaging services.\n */\n openGraph?: OpenGraphConfig\n /**\n * Overrides the auto-generated <title> of admin pages\n * @example `\"My Admin Panel\"`\n */\n title?: string\n /**\n * String to append to the auto-generated <title> of admin pages\n * @example `\" - Custom CMS\"`\n */\n titleSuffix?: string\n}\n\nexport type ServerOnlyLivePreviewProperties = keyof Pick<LivePreviewConfig, 'url'>\n\ntype GeneratePreviewURLOptions = {\n locale: string\n req: PayloadRequest\n token: null | string\n}\n\nexport type GeneratePreviewURL = (\n doc: Record<string, unknown>,\n options: GeneratePreviewURLOptions,\n) => Promise<null | string> | null | string\n\nexport type GraphQLInfo = {\n Mutation: {\n fields: Record<string, any>\n name: string\n }\n Query: {\n fields: Record<string, any>\n name: string\n }\n collections: {\n [slug: string]: Collection\n }\n globals: Globals\n types: {\n arrayTypes: Record<string, GraphQL.GraphQLType>\n blockInputTypes: Record<string, GraphQL.GraphQLInputObjectType>\n blockTypes: Record<string, GraphQL.GraphQLObjectType>\n fallbackLocaleInputType?: GraphQL.GraphQLEnumType | GraphQL.GraphQLScalarType\n groupTypes: Record<string, GraphQL.GraphQLObjectType>\n localeInputType?: GraphQL.GraphQLEnumType | GraphQL.GraphQLScalarType\n tabTypes: Record<string, GraphQL.GraphQLObjectType>\n }\n}\nexport type GraphQLExtension = (\n graphQL: typeof GraphQL,\n context: {\n config: SanitizedConfig\n } & GraphQLInfo,\n) => Record<string, unknown>\n\nexport type InitOptions = {\n /**\n * Sometimes, with the local API, you might need to pass a config file directly, for example, serverless on Vercel\n * The passed config should match the config file, and if it doesn't, there could be mismatches between the admin UI\n * and the backend functionality\n */\n config: Promise<SanitizedConfig> | SanitizedConfig\n /**\n * Disable connect to the database on init\n */\n disableDBConnect?: boolean\n\n /**\n * Disable running of the `onInit` function\n */\n disableOnInit?: boolean\n\n importMap?: ImportMap\n\n /**\n * A previously instantiated logger instance. Must conform to the PayloadLogger interface which uses Pino\n * This allows you to bring your own logger instance and let payload use it\n */\n logger?: PayloadLogger\n\n loggerDestination?: DestinationStream\n /**\n * Specify options for the built-in Pino logger that Payload uses for internal logging.\n *\n * See Pino Docs for options: https://getpino.io/#/docs/api?id=options\n */\n loggerOptions?: LoggerOptions\n /**\n * A function that is called immediately following startup that receives the Payload instance as it's only argument.\n */\n onInit?: (payload: Payload) => Promise<void> | void\n}\n\n/**\n * This result is calculated on the server\n * and then sent to the client allowing the dashboard to show accessible data and actions.\n *\n * If the result is `true`, the user has access.\n * If the result is an object, it is interpreted as a MongoDB query.\n *\n * @example `{ createdBy: { equals: id } }`\n *\n * @example `{ tenant: { in: tenantIds } }`\n *\n * @see https://payloadcms.com/docs/access-control/overview\n */\nexport type AccessResult = Where | boolean\n\nexport type AccessArgs<TData = any> = {\n /**\n * The relevant resource that is being accessed.\n *\n * `data` is null when a list is requested\n */\n data?: TData\n /** ID of the resource being accessed */\n id?: number | string\n /** If true, the request is for a static file */\n isReadingStaticFile?: boolean\n /** The original request that requires an access check */\n req: PayloadRequest\n}\n\n/**\n * Access function runs on the server\n * and is sent to the client allowing the dashboard to show accessible data and actions.\n *\n * @see https://payloadcms.com/docs/access-control/overview\n */\nexport type Access<TData = any> = (args: AccessArgs<TData>) => AccessResult | Promise<AccessResult>\n\n/** Web Request/Response model, but the req has more payload specific properties added to it. */\nexport type PayloadHandler = (req: PayloadRequest) => Promise<Response> | Response\n\n/**\n * Docs: https://payloadcms.com/docs/rest-api/overview#custom-endpoints\n */\nexport type Endpoint = {\n /** Extension point to add your custom data. */\n custom?: Record<string, any>\n\n /**\n * Middleware that will be called when the path/method matches\n *\n * Compatible with Web Request/Response Model\n */\n handler: PayloadHandler\n /** HTTP method (or \"all\") */\n method: 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put'\n /**\n * Pattern that should match the path of the incoming request\n *\n * Compatible with the Express router\n */\n path: string\n /**\n * Please add \"root\" routes under the /api folder in the Payload Project.\n * https://nextjs.org/docs/app/api-reference/file-conventions/route\n *\n * @deprecated in 3.0\n */\n root?: never\n}\n\nexport type EditViewComponent = PayloadComponent<ServerSideEditViewProps>\n\nexport type EditViewConfig = {\n meta?: MetaConfig\n} & (\n | {\n Component: EditViewComponent\n path?: string\n }\n | {\n actions?: CustomComponent[]\n }\n | {\n path?: string\n /**\n * Add a new Edit View to the admin panel\n * i.e. you can render a custom view that has no tab, if desired\n * Or override a specific properties of an existing one\n * i.e. you can customize the `Default` view tab label, if desired\n */\n tab?: DocumentTabConfig\n }\n)\n\nexport type ServerProps = {\n readonly i18n: I18nClient\n readonly locale?: Locale\n readonly params?: { [key: string]: string | string[] | undefined }\n readonly payload: Payload\n readonly permissions?: Permissions\n readonly [key: string]: unknown\n readonly searchParams?: { [key: string]: string | string[] | undefined }\n readonly user?: TypedUser\n}\n\nexport const serverProps: (keyof ServerProps)[] = [\n 'payload',\n 'i18n',\n 'locale',\n 'params',\n 'permissions',\n 'searchParams',\n 'permissions',\n]\n\nexport type CustomComponent<TAdditionalProps extends object = Record<string, any>> =\n PayloadComponent<ServerProps & TAdditionalProps, TAdditionalProps>\n\nexport type Locale = {\n /**\n * value of supported locale\n * @example \"en\"\n */\n code: string\n /**\n * Code of another locale to use when reading documents with fallback, if not specified defaultLocale is used\n */\n fallbackLocale?: string\n /**\n * label of supported locale\n * @example \"English\"\n */\n label: Record<string, string> | string\n /**\n * if true, defaults textAligmnent on text fields to RTL\n */\n rtl?: boolean\n}\n\nexport type BaseLocalizationConfig = {\n /**\n * Locale for users that have not expressed their preference for a specific locale\n * @example `\"en\"`\n */\n defaultLocale: string\n /** Set to `true` to let missing values in localised fields fall back to the values in `defaultLocale` */\n fallback?: boolean\n}\n\nexport type LocalizationConfigWithNoLabels = Prettify<\n {\n /**\n * List of supported locales\n * @example `[\"en\", \"es\", \"fr\", \"nl\", \"de\", \"jp\"]`\n */\n locales: string[]\n } & BaseLocalizationConfig\n>\n\nexport type LocalizationConfigWithLabels = Prettify<\n {\n /**\n * List of supported locales with labels\n * @example {\n * label: 'English',\n * value: 'en',\n * rtl: false\n * }\n */\n locales: Locale[]\n } & BaseLocalizationConfig\n>\n\nexport type SanitizedLocalizationConfig = Prettify<\n {\n /**\n * List of supported locales\n * @example `[\"en\", \"es\", \"fr\", \"nl\", \"de\", \"jp\"]`\n */\n localeCodes: string[]\n } & LocalizationConfigWithLabels\n>\n\n/**\n * @see https://payloadcms.com/docs/configuration/localization#localization\n */\nexport type LocalizationConfig = Prettify<\n LocalizationConfigWithLabels | LocalizationConfigWithNoLabels\n>\n\nexport type LabelFunction = ({ t }: { t: TFunction }) => string\n\nexport type StaticLabel = Record<string, string> | string\n\nexport type SharpDependency = (\n input?:\n | ArrayBuffer\n | Buffer\n | Float32Array\n | Float64Array\n | Int8Array\n | Int16Array\n | Int32Array\n | Uint8Array\n | Uint8ClampedArray\n | Uint16Array\n | Uint32Array\n | string,\n options?: sharp.SharpOptions,\n) => sharp.Sharp\n\nexport type CORSConfig = {\n headers?: string[]\n origins: '*' | string[]\n}\n\nexport type AdminFunction = {\n args?: object\n path: string\n type: 'function'\n}\n\nexport type AdminComponent = {\n clientProps?: object\n path: string\n serverProps?: object\n type: 'component'\n}\n\nexport interface AdminDependencies {\n [key: string]: AdminComponent | AdminFunction\n}\n\n/**\n * This is the central configuration\n *\n * @see https://payloadcms.com/docs/configuration/overview\n */\nexport type Config = {\n /** Configure admin dashboard */\n admin?: {\n /** Automatically log in as a user */\n autoLogin?:\n | {\n /**\n * The email address of the user to login as\n */\n email?: string\n /** The password of the user to login as. This is only needed if `prefillOnly` is set to true */\n password?: string\n /**\n * If set to true, the login credentials will be prefilled but the user will still need to click the login button.\n *\n * @default false\n */\n prefillOnly?: boolean\n /** The username of the user to login as */\n username?: string\n }\n | false\n\n /** Set account profile picture. Options: gravatar, default or a custom React component. */\n avatar?:\n | 'default'\n | 'gravatar'\n | {\n Component: PayloadComponent<never>\n }\n /**\n * Add extra and/or replace built-in components with custom components\n *\n * @see https://payloadcms.com/docs/admin/components\n */\n components?: {\n /**\n * Replace the navigation with a custom component\n */\n Nav?: CustomComponent\n /**\n * Add custom components to the top right of the Admin Panel\n */\n actions?: CustomComponent[]\n /**\n * Add custom components after the collection overview\n */\n afterDashboard?: CustomComponent[]\n /**\n * Add custom components after the email/password field\n */\n afterLogin?: CustomComponent[]\n /**\n * Add custom components after the navigation links\n */\n afterNavLinks?: CustomComponent[]\n /**\n * Add custom components before the collection overview\n */\n beforeDashboard?: CustomComponent[]\n /**\n * Add custom components before the email/password field\n */\n beforeLogin?: CustomComponent[]\n /**\n * Add custom components before the navigation links\n */\n beforeNavLinks?: CustomComponent[]\n /** Replace graphical components */\n graphics?: {\n /** Replace the icon in the navigation */\n Icon?: CustomComponent\n /** Replace the logo on the login page */\n Logo?: CustomComponent\n }\n /** Replace logout related components */\n logout?: {\n /** Replace the logout button */\n Button?: CustomComponent\n }\n /**\n * Wrap the admin dashboard in custom context providers\n */\n providers?: PayloadComponent<{ children?: React.ReactNode }, { children?: React.ReactNode }>[]\n /**\n * Replace or modify top-level admin routes, or add new ones:\n * + `Account` - `/admin/account`\n * + `Dashboard` - `/admin`\n * + `:path` - `/admin/:path`\n */\n views?: {\n /** Add custom admin views */\n [key: string]: AdminViewConfig\n /** Replace the account screen */\n Account?: AdminViewConfig\n /** Replace the admin homepage */\n Dashboard?: AdminViewConfig\n }\n }\n /** Extension point to add your custom data. Available in server and client. */\n custom?: Record<string, any>\n /** Global date format that will be used for all dates in the Admin panel. Any valid date-fns format pattern can be used. */\n dateFormat?: string\n /**\n * Each entry in this map generates an entry in the importMap,\n * as well as an entry in the componentMap if the type of the\n * dependency is 'component'\n */\n dependencies?: AdminDependencies\n /** If set to true, the entire Admin panel will be disabled. */\n disable?: boolean\n importMap?: {\n /**\n * Automatically generate component map during development\n * @default true\n */\n autoGenerate?: boolean\n\n /** The base directory for component paths starting with /.\n *\n * By default, this is process.cwd()\n **/\n baseDir?: string\n /**\n * You can use generators to add custom components to the component import map.\n * This allows you to import custom components in the admin panel.\n */\n generators?: Array<\n (props: {\n addToImportMap: AddToImportMap\n baseDir: string\n config: SanitizedConfig\n importMap: InternalImportMap\n imports: Imports\n }) => void\n >\n }\n livePreview?: {\n collections?: string[]\n globals?: string[]\n } & LivePreviewConfig\n /** Base meta data to use for the Admin Panel. Included properties are titleSuffix, ogImage, and favicon. */\n meta?: MetaConfig\n routes?: {\n /** The route for the account page. */\n account?: string\n /** The route for the create first user page. */\n createFirstUser?: string\n /** The route for the forgot password page. */\n forgot?: string\n /** The route the user will be redirected to after being inactive for too long. */\n inactivity?: string\n /** The route for the login page. */\n login?: string\n /** The route for the logout page. */\n logout?: string\n /** The route for the reset password page. */\n reset?: string\n /** The route for the unauthorized page. */\n unauthorized?: string\n }\n /** The slug of a Collection that you want to be used to log in to the Admin dashboard. */\n user?: string\n }\n /** Custom Payload bin scripts can be injected via the config. */\n bin?: BinScriptConfig[]\n /**\n * Manage the datamodel of your application\n *\n * @see https://payloadcms.com/docs/configuration/collections#collection-configs\n */\n collections?: CollectionConfig[]\n /**\n * Prefix a string to all cookies that Payload sets.\n *\n * @default \"payload\"\n */\n cookiePrefix?: string\n /** Either a whitelist array of URLS to allow CORS requests from, or a wildcard string ('*') to accept incoming requests from any domain. */\n cors?: '*' | CORSConfig | string[]\n /** A whitelist array of URLs to allow Payload cookies to be accepted from as a form of CSRF protection. */\n csrf?: string[]\n\n /** Extension point to add your custom data. Server only. */\n custom?: Record<string, any>\n\n /** Pass in a database adapter for use on this project. */\n db: DatabaseAdapterResult\n /** Enable to expose more detailed error information. */\n debug?: boolean\n /**\n * If a user does not specify `depth` while requesting a resource, this depth will be used.\n *\n * @see https://payloadcms.com/docs/getting-started/concepts#depth\n *\n * @default 2\n */\n defaultDepth?: number\n /**\n * The maximum allowed depth to be permitted application-wide. This setting helps prevent against malicious queries.\n *\n * @default 40000\n */\n defaultMaxTextLength?: number\n /** Default richtext editor to use for richText fields */\n editor?: RichTextAdapterProvider<any, any, any>\n /**\n * Email Adapter\n *\n * @see https://payloadcms.com/docs/email/overview\n */\n email?: EmailAdapter | Promise<EmailAdapter>\n /** Custom REST endpoints */\n endpoints?: Endpoint[]\n /**\n * @see https://payloadcms.com/docs/configuration/globals#global-configs\n */\n globals?: GlobalConfig[]\n /**\n * Manage the GraphQL API\n *\n * You can add your own GraphQL queries and mutations to Payload, making use of all the types that Payload has defined for you.\n *\n * @see https://payloadcms.com/docs/graphql/overview\n */\n graphQL?: {\n disable?: boolean\n disablePlaygroundInProduction?: boolean\n maxComplexity?: number\n /**\n * Function that returns an object containing keys to custom GraphQL mutations\n *\n * @see https://payloadcms.com/docs/graphql/extending\n */\n mutations?: GraphQLExtension\n /**\n * Function that returns an object containing keys to custom GraphQL queries\n *\n * @see https://payloadcms.com/docs/graphql/extending\n */\n queries?: GraphQLExtension\n /**\n * Filepath to write the generated schema to\n */\n schemaOutputFile?: string\n }\n /**\n * Tap into Payload-wide hooks.\n *\n * @see https://payloadcms.com/docs/hooks/overview\n */\n hooks?: {\n afterError?: AfterErrorHook\n }\n /** i18n config settings */\n i18n?: I18nOptions<{} | DefaultTranslationsObject> // loosen the type here to allow for custom translations\n /** Automatically index all sortable top-level fields in the database to improve sort performance and add database compatibility for Azure Cosmos and similar. */\n indexSortableFields?: boolean\n /**\n * Translate your content to different languages/locales.\n *\n * @default false // disable localization\n */\n localization?: LocalizationConfig | false\n /**\n * The maximum allowed depth to be permitted application-wide. This setting helps prevent against malicious queries.\n *\n * @see https://payloadcms.com/docs/getting-started/concepts#depth\n *\n * @default 10\n */\n maxDepth?: number\n /** A function that is called immediately following startup that receives the Payload instance as its only argument. */\n onInit?: (payload: Payload) => Promise<void> | void\n /**\n * An array of Payload plugins.\n *\n * @see https://payloadcms.com/docs/plugins/overview\n */\n plugins?: Plugin[]\n /** Control the routing structure that Payload binds itself to. */\n routes?: {\n /** The route for the admin panel.\n * @example \"/my-admin\"\n * @default \"/admin\"\n */\n admin?: string\n /** @default \"/api\" */\n api?: string\n /** @default \"/graphql\" */\n graphQL?: string\n /** @default \"/graphql-playground\" */\n graphQLPlayground?: string\n }\n /** Secure string that Payload will use for any encryption workflows */\n secret: string\n /**\n * Define the absolute URL of your app including the protocol, for example `https://example.org`.\n * No paths allowed, only protocol, domain and (optionally) port.\n *\n * @see https://payloadcms.com/docs/configuration/overview#options\n */\n serverURL?: string\n /**\n * Pass in a local copy of Sharp if you'd like to use it.\n *\n */\n sharp?: SharpDependency\n /** Send anonymous telemetry data about general usage. */\n telemetry?: boolean\n /** Control how typescript interfaces are generated from your collections. */\n typescript?: {\n /**\n * Automatically generate types during development\n * @default true\n */\n autoGenerate?: boolean\n\n /** Disable declare block in generated types file */\n declare?:\n | {\n /**\n * @internal internal use only to allow for multiple declarations within a monorepo and suppress the \"Duplicate identifier GeneratedTypes\" error\n *\n * Adds a @ts-ignore flag above the GeneratedTypes interface declaration\n *\n * @default false\n */\n ignoreTSError?: boolean\n }\n | false\n\n /** Filename to write the generated types to */\n outputFile?: string\n\n /**\n * Allows you to modify the base JSON schema that is generated during generate:types. This JSON schema will be used\n * to generate the TypeScript interfaces.\n */\n schema?: Array<(args: { jsonSchema: JSONSchema4 }) => JSONSchema4>\n }\n /**\n * Customize the handling of incoming file uploads for collections that have uploads enabled.\n */\n upload?: ExpressFileUploadOptions\n}\n\nexport type SanitizedConfig = {\n collections: SanitizedCollectionConfig[]\n /** Default richtext editor to use for richText fields */\n editor?: RichTextAdapter<any, any, any>\n endpoints: Endpoint[]\n globals: SanitizedGlobalConfig[]\n i18n: Required<I18nOptions>\n localization: SanitizedLocalizationConfig | false\n paths: {\n config: string\n configDir: string\n rawConfig: string\n }\n upload: {\n /**\n * Deduped list of adapters used in the project\n */\n adapters: string[]\n } & ExpressFileUploadOptions\n} & Omit<\n // TODO: DeepRequired breaks certain, advanced TypeScript types / certain type information is lost. We should remove it when possible.\n // E.g. in packages/ui/src/graphics/Account/index.tsx in getComponent, if avatar.Component is casted to what it's supposed to be,\n // the result type is different\n DeepRequired<Config>,\n 'collections' | 'editor' | 'endpoint' | 'globals' | 'i18n' | 'localization' | 'upload'\n>\n\nexport type EditConfig =\n | {\n [key: string]: EditViewConfig\n /**\n * Replace or modify individual nested routes, or add new ones:\n * + `default` - `/admin/collections/:collection/:id`\n * + `api` - `/admin/collections/:collection/:id/api`\n * + `livePreview` - `/admin/collections/:collection/:id/preview`\n * + `references` - `/admin/collections/:collection/:id/references`\n * + `relationships` - `/admin/collections/:collection/:id/relationships`\n * + `versions` - `/admin/collections/:collection/:id/versions`\n * + `version` - `/admin/collections/:collection/:id/versions/:version`\n * + `customView` - `/admin/collections/:collection/:id/:path`\n *\n * To override the entire Edit View including all nested views, use the `root` key.\n */\n api?: Partial<EditViewConfig>\n default?: Partial<EditViewConfig>\n livePreview?: Partial<EditViewConfig>\n root?: never\n version?: Partial<EditViewConfig>\n versions?: Partial<EditViewConfig>\n // TODO: uncomment these as they are built\n // references?: EditView\n // relationships?: EditView\n }\n | {\n api?: never\n default?: never\n livePreview?: never\n /**\n * Replace or modify _all_ nested document views and routes, including the document header, controls, and tabs. This cannot be used in conjunction with other nested views.\n * + `root` - `/admin/collections/:collection/:id/**\\/*`\n */\n root: Partial<EditViewConfig>\n version?: never\n versions?: never\n }\n\nexport type EntityDescriptionComponent = CustomComponent\n\nexport type EntityDescriptionFunction = ({ t }: { t: TFunction }) => string\n\nexport type EntityDescription = EntityDescriptionFunction | Record<string, string> | string\n\nexport type { EmailAdapter, SendEmailOptions }\n"],"names":["serverProps"],"mappings":"AA0ZA,OAAO,MAAMA,cAAqC;IAChD;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA"}
1
+ {"version":3,"sources":["../../src/config/types.ts"],"sourcesContent":["import type {\n DefaultTranslationsObject,\n I18nClient,\n I18nOptions,\n TFunction,\n} from '@payloadcms/translations'\nimport type { BusboyConfig } from 'busboy'\nimport type GraphQL from 'graphql'\nimport type { JSONSchema4 } from 'json-schema'\nimport type { DestinationStream, LoggerOptions, pino } from 'pino'\nimport type React from 'react'\nimport type { default as sharp } from 'sharp'\nimport type { DeepRequired } from 'ts-essentials'\n\nimport type { RichTextAdapterProvider } from '../admin/RichText.js'\nimport type { DocumentTabConfig, RichTextAdapter } from '../admin/types.js'\nimport type { AdminViewConfig, ServerSideEditViewProps } from '../admin/views/types.js'\nimport type { Permissions } from '../auth/index.js'\nimport type {\n AddToImportMap,\n ImportMap,\n Imports,\n InternalImportMap,\n} from '../bin/generateImportMap/index.js'\nimport type {\n AfterErrorHook,\n Collection,\n CollectionConfig,\n SanitizedCollectionConfig,\n} from '../collections/config/types.js'\nimport type { DatabaseAdapterResult } from '../database/types.js'\nimport type { EmailAdapter, SendEmailOptions } from '../email/types.js'\nimport type { GlobalConfig, Globals, SanitizedGlobalConfig } from '../globals/config/types.js'\nimport type { Payload, TypedUser } from '../index.js'\nimport type { PayloadRequest, Where } from '../types/index.js'\nimport type { PayloadLogger } from '../utilities/logger.js'\n\n/**\n * The string path pointing to the React component. If one of the generics is `never`, you effectively mark it as a server-only or client-only component.\n *\n * If it is `false` an empty component will be rendered.\n */\nexport type PayloadComponent<\n TComponentServerProps extends never | object = Record<string, any>,\n TComponentClientProps extends never | object = Record<string, any>,\n> = false | RawPayloadComponent<TComponentServerProps, TComponentClientProps> | string\n\n// We need the actual object as its own type, otherwise the infers for the PayloadClientReactComponent / PayloadServerReactComponent will not work due to the string union.\n// We also NEED to actually use those generics for this to work, thus they are part of the props.\nexport type RawPayloadComponent<\n TComponentServerProps extends never | object = Record<string, any>,\n TComponentClientProps extends never | object = Record<string, any>,\n> = {\n clientProps?: object | TComponentClientProps\n exportName?: string\n path: string\n serverProps?: object | TComponentServerProps\n}\n\nexport type PayloadComponentProps<TPayloadComponent> =\n TPayloadComponent extends RawPayloadComponent<\n infer TComponentServerProps,\n infer TComponentClientProps\n >\n ? TComponentClientProps | TComponentServerProps\n : never\n\nexport type PayloadClientComponentProps<TPayloadComponent> =\n TPayloadComponent extends RawPayloadComponent<infer _, infer TComponentClientProps>\n ? TComponentClientProps\n : never\n\nexport type PayloadServerComponentProps<TPayloadComponent> =\n TPayloadComponent extends RawPayloadComponent<infer TComponentServerProps, infer _>\n ? TComponentServerProps\n : never\n\nexport type PayloadReactComponent<TPayloadComponent> = React.FC<\n PayloadComponentProps<TPayloadComponent>\n>\n\n// This also ensures that if never is passed to TComponentClientProps, this entire type will be never.\n// => TypeScript will now ensure that users cannot even define the typed Server Components if the PayloadComponent is marked as\n// Client-Only (marked as Client-Only = TComponentServerProps is never)\nexport type PayloadClientReactComponent<TPayloadComponent> =\n TPayloadComponent extends RawPayloadComponent<infer _, infer TComponentClientProps>\n ? TComponentClientProps extends never\n ? never\n : React.FC<TComponentClientProps>\n : never\n\nexport type PayloadServerReactComponent<TPayloadComponent> =\n TPayloadComponent extends RawPayloadComponent<infer TComponentServerProps, infer _>\n ? TComponentServerProps extends never\n ? never\n : React.FC<TComponentServerProps>\n : never\n\nexport type ResolvedComponent<\n TComponentServerProps extends never | object,\n TComponentClientProps extends never | object,\n> = {\n clientProps?: TComponentClientProps\n Component: React.FC<TComponentClientProps | TComponentServerProps>\n serverProps?: TComponentServerProps\n}\n\nexport type BinScriptConfig = {\n key: string\n scriptPath: string\n}\n\nexport type BinScript = (config: SanitizedConfig) => Promise<void> | void\n\ntype Prettify<T> = {\n [K in keyof T]: T[K]\n} & NonNullable<unknown>\n\nexport type Plugin = (config: Config) => Config | Promise<Config>\n\nexport type LivePreviewConfig = {\n /**\n Device breakpoints to use for the `iframe` of the Live Preview window.\n Options are displayed in the Live Preview toolbar.\n The `responsive` breakpoint is included by default.\n */\n breakpoints?: {\n height: number | string\n label: string\n name: string\n width: number | string\n }[]\n /**\n The URL of the frontend application. This will be rendered within an `iframe` as its `src`.\n Payload will send a `window.postMessage()` to this URL with the document data in real-time.\n The frontend application is responsible for receiving the message and updating the UI accordingly.\n Use the `useLivePreview` hook to get started in React applications.\n */\n url?:\n | ((args: {\n collectionConfig?: SanitizedCollectionConfig\n data: Record<string, any>\n globalConfig?: SanitizedGlobalConfig\n locale: Locale\n payload: Payload\n }) => Promise<string> | string)\n | string\n}\n\nexport type OGImageConfig = {\n alt?: string\n height?: number | string\n type?: string\n url: string\n width?: number | string\n}\n\nexport type OpenGraphConfig = {\n description?: string\n images?: OGImageConfig | OGImageConfig[]\n siteName?: string\n title?: string\n}\n\nexport type IconConfig = {\n color?: string\n /**\n * @see https://developer.mozilla.org/docs/Web/API/HTMLImageElement/fetchPriority\n */\n fetchPriority?: 'auto' | 'high' | 'low'\n media?: string\n /** defaults to rel=\"icon\" */\n rel?: string\n sizes?: string\n type?: string\n /**\n * URL of the icon to use. You can use a relative path from the public folder (see https://nextjs.org/docs/app/building-your-application/optimizing/static-assets) or an absolute URL.\n */\n url: string\n}\n\nexport type MetaConfig = {\n /**\n * When `static`, a pre-made image will be used for all pages.\n * When `dynamic`, a unique image will be generated for each page based on page content and given overrides.\n * When `off`, no Open Graph images will be generated and the `/api/og` endpoint will be disabled. You can still provide custom images using the `openGraph.images` property.\n * @default 'dynamic'\n */\n defaultOGImageType?: 'dynamic' | 'off' | 'static'\n /**\n * Overrides the auto-generated <meta name=\"description\"> of admin pages\n * @example `\"This is my custom CMS built with Payload.\"`\n */\n description?: string\n /**\n * Icons to be rendered by devices and browsers.\n *\n * For example browser tabs, phone home screens, and search engine results.\n */\n icons?: IconConfig[]\n /**\n * Overrides the auto-generated <meta name=\"keywords\"> of admin pages\n * @example `\"CMS, Payload, Custom\"`\n */\n keywords?: string\n /**\n * Metadata to be rendered as `og` meta tags in the head of the Admin Panel.\n *\n * For example when sharing the Admin Panel on social media or through messaging services.\n */\n openGraph?: OpenGraphConfig\n /**\n * Overrides the auto-generated <title> of admin pages\n * @example `\"My Admin Panel\"`\n */\n title?: string\n /**\n * String to append to the auto-generated <title> of admin pages\n * @example `\" - Custom CMS\"`\n */\n titleSuffix?: string\n}\n\nexport type ServerOnlyLivePreviewProperties = keyof Pick<LivePreviewConfig, 'url'>\n\ntype GeneratePreviewURLOptions = {\n locale: string\n req: PayloadRequest\n token: null | string\n}\n\nexport type GeneratePreviewURL = (\n doc: Record<string, unknown>,\n options: GeneratePreviewURLOptions,\n) => null | Promise<null | string> | string\n\nexport type GraphQLInfo = {\n collections: {\n [slug: string]: Collection\n }\n globals: Globals\n Mutation: {\n fields: Record<string, any>\n name: string\n }\n Query: {\n fields: Record<string, any>\n name: string\n }\n types: {\n arrayTypes: Record<string, GraphQL.GraphQLType>\n blockInputTypes: Record<string, GraphQL.GraphQLInputObjectType>\n blockTypes: Record<string, GraphQL.GraphQLObjectType>\n fallbackLocaleInputType?: GraphQL.GraphQLEnumType | GraphQL.GraphQLScalarType\n groupTypes: Record<string, GraphQL.GraphQLObjectType>\n localeInputType?: GraphQL.GraphQLEnumType | GraphQL.GraphQLScalarType\n tabTypes: Record<string, GraphQL.GraphQLObjectType>\n }\n}\nexport type GraphQLExtension = (\n graphQL: typeof GraphQL,\n context: {\n config: SanitizedConfig\n } & GraphQLInfo,\n) => Record<string, unknown>\n\nexport type InitOptions = {\n /**\n * Sometimes, with the local API, you might need to pass a config file directly, for example, serverless on Vercel\n * The passed config should match the config file, and if it doesn't, there could be mismatches between the admin UI\n * and the backend functionality\n */\n config: Promise<SanitizedConfig> | SanitizedConfig\n /**\n * Disable connect to the database on init\n */\n disableDBConnect?: boolean\n\n /**\n * Disable running of the `onInit` function\n */\n disableOnInit?: boolean\n\n importMap?: ImportMap\n\n /**\n * A function that is called immediately following startup that receives the Payload instance as it's only argument.\n */\n onInit?: (payload: Payload) => Promise<void> | void\n}\n\n/**\n * This result is calculated on the server\n * and then sent to the client allowing the dashboard to show accessible data and actions.\n *\n * If the result is `true`, the user has access.\n * If the result is an object, it is interpreted as a MongoDB query.\n *\n * @example `{ createdBy: { equals: id } }`\n *\n * @example `{ tenant: { in: tenantIds } }`\n *\n * @see https://payloadcms.com/docs/access-control/overview\n */\nexport type AccessResult = boolean | Where\n\nexport type AccessArgs<TData = any> = {\n /**\n * The relevant resource that is being accessed.\n *\n * `data` is null when a list is requested\n */\n data?: TData\n /** ID of the resource being accessed */\n id?: number | string\n /** If true, the request is for a static file */\n isReadingStaticFile?: boolean\n /** The original request that requires an access check */\n req: PayloadRequest\n}\n\n/**\n * Access function runs on the server\n * and is sent to the client allowing the dashboard to show accessible data and actions.\n *\n * @see https://payloadcms.com/docs/access-control/overview\n */\nexport type Access<TData = any> = (args: AccessArgs<TData>) => AccessResult | Promise<AccessResult>\n\n/** Web Request/Response model, but the req has more payload specific properties added to it. */\nexport type PayloadHandler = (req: PayloadRequest) => Promise<Response> | Response\n\n/**\n * Docs: https://payloadcms.com/docs/rest-api/overview#custom-endpoints\n */\nexport type Endpoint = {\n /** Extension point to add your custom data. */\n custom?: Record<string, any>\n\n /**\n * Middleware that will be called when the path/method matches\n *\n * Compatible with Web Request/Response Model\n */\n handler: PayloadHandler\n /** HTTP method (or \"all\") */\n method: 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put'\n /**\n * Pattern that should match the path of the incoming request\n *\n * Compatible with the Express router\n */\n path: string\n /**\n * Please add \"root\" routes under the /api folder in the Payload Project.\n * https://nextjs.org/docs/app/api-reference/file-conventions/route\n *\n * @deprecated in 3.0\n */\n root?: never\n}\n\nexport type EditViewComponent = PayloadComponent<ServerSideEditViewProps>\n\nexport type EditViewConfig = {\n meta?: MetaConfig\n} & (\n | {\n actions?: CustomComponent[]\n }\n | {\n Component: EditViewComponent\n path?: string\n }\n | {\n path?: string\n /**\n * Add a new Edit View to the admin panel\n * i.e. you can render a custom view that has no tab, if desired\n * Or override a specific properties of an existing one\n * i.e. you can customize the `Default` view tab label, if desired\n */\n tab?: DocumentTabConfig\n }\n)\n\nexport type ServerProps = {\n readonly i18n: I18nClient\n readonly locale?: Locale\n readonly params?: { [key: string]: string | string[] | undefined }\n readonly payload: Payload\n readonly permissions?: Permissions\n readonly [key: string]: unknown\n readonly searchParams?: { [key: string]: string | string[] | undefined }\n readonly user?: TypedUser\n}\n\nexport const serverProps: (keyof ServerProps)[] = [\n 'payload',\n 'i18n',\n 'locale',\n 'params',\n 'permissions',\n 'searchParams',\n 'permissions',\n]\n\nexport type CustomComponent<TAdditionalProps extends object = Record<string, any>> =\n PayloadComponent<ServerProps & TAdditionalProps, TAdditionalProps>\n\nexport type Locale = {\n /**\n * value of supported locale\n * @example \"en\"\n */\n code: string\n /**\n * Code of another locale to use when reading documents with fallback, if not specified defaultLocale is used\n */\n fallbackLocale?: string\n /**\n * label of supported locale\n * @example \"English\"\n */\n label: Record<string, string> | string\n /**\n * if true, defaults textAligmnent on text fields to RTL\n */\n rtl?: boolean\n}\n\nexport type BaseLocalizationConfig = {\n /**\n * Locale for users that have not expressed their preference for a specific locale\n * @example `\"en\"`\n */\n defaultLocale: string\n /** Set to `true` to let missing values in localised fields fall back to the values in `defaultLocale` */\n fallback?: boolean\n}\n\nexport type LocalizationConfigWithNoLabels = Prettify<\n {\n /**\n * List of supported locales\n * @example `[\"en\", \"es\", \"fr\", \"nl\", \"de\", \"jp\"]`\n */\n locales: string[]\n } & BaseLocalizationConfig\n>\n\nexport type LocalizationConfigWithLabels = Prettify<\n {\n /**\n * List of supported locales with labels\n * @example {\n * label: 'English',\n * value: 'en',\n * rtl: false\n * }\n */\n locales: Locale[]\n } & BaseLocalizationConfig\n>\n\nexport type SanitizedLocalizationConfig = Prettify<\n {\n /**\n * List of supported locales\n * @example `[\"en\", \"es\", \"fr\", \"nl\", \"de\", \"jp\"]`\n */\n localeCodes: string[]\n } & LocalizationConfigWithLabels\n>\n\n/**\n * @see https://payloadcms.com/docs/configuration/localization#localization\n */\nexport type LocalizationConfig = Prettify<\n LocalizationConfigWithLabels | LocalizationConfigWithNoLabels\n>\n\nexport type LabelFunction = ({ t }: { t: TFunction }) => string\n\nexport type StaticLabel = Record<string, string> | string\n\nexport type SharpDependency = (\n input?:\n | ArrayBuffer\n | Buffer\n | Float32Array\n | Float64Array\n | Int8Array\n | Int16Array\n | Int32Array\n | string\n | Uint8Array\n | Uint8ClampedArray\n | Uint16Array\n | Uint32Array,\n options?: sharp.SharpOptions,\n) => sharp.Sharp\n\nexport type CORSConfig = {\n headers?: string[]\n origins: '*' | string[]\n}\n\nexport type AdminFunction = {\n args?: object\n path: string\n type: 'function'\n}\n\nexport type AdminComponent = {\n clientProps?: object\n path: string\n serverProps?: object\n type: 'component'\n}\n\nexport interface AdminDependencies {\n [key: string]: AdminComponent | AdminFunction\n}\n\nexport type FetchAPIFileUploadOptions = {\n /**\n * Returns a HTTP 413 when the file is bigger than the size limit if `true`.\n * Otherwise, it will add a `truncated = true` to the resulting file structure.\n * @default false\n */\n abortOnLimit?: boolean | undefined\n /**\n * Automatically creates the directory path specified in `.mv(filePathName)`\n * @default false\n */\n createParentPath?: boolean | undefined\n /**\n * Turn on/off upload process logging. Can be useful for troubleshooting.\n * @default false\n */\n debug?: boolean | undefined\n /**\n * User defined limit handler which will be invoked if the file is bigger than configured limits.\n * @default false\n */\n limitHandler?: ((args: { request: Request; size: number }) => void) | boolean | undefined\n /**\n * By default, `req.body` and `req.files` are flattened like this:\n * `{'name': 'John', 'hobbies[0]': 'Cinema', 'hobbies[1]': 'Bike'}\n *\n * When this option is enabled they are parsed in order to be nested like this:\n * `{'name': 'John', 'hobbies': ['Cinema', 'Bike']}`\n * @default false\n */\n parseNested?: boolean | undefined\n /**\n * Preserves filename extension when using `safeFileNames` option.\n * If set to `true`, will default to an extension length of `3`.\n * If set to `number`, this will be the max allowable extension length.\n * If an extension is smaller than the extension length, it remains untouched. If the extension is longer,\n * it is shifted.\n * @default false\n *\n * @example\n * // true\n * app.use(fileUpload({ safeFileNames: true, preserveExtension: true }));\n * // myFileName.ext --> myFileName.ext\n *\n * @example\n * // max extension length 2, extension shifted\n * app.use(fileUpload({ safeFileNames: true, preserveExtension: 2 }));\n * // myFileName.ext --> myFileNamee.xt\n */\n preserveExtension?: boolean | number | undefined\n /**\n * Response which will be send to client if file size limit exceeded when `abortOnLimit` set to `true`.\n * @default 'File size limit has been reached'\n */\n responseOnLimit?: string | undefined\n /**\n * Strips characters from the upload's filename.\n * You can use custom regex to determine what to strip.\n * If set to `true`, non-alphanumeric characters _except_ dashes and underscores will be stripped.\n * This option is off by default.\n * @default false\n *\n * @example\n * // strip slashes from file names\n * app.use(fileUpload({ safeFileNames: /\\\\/g }))\n *\n * @example\n * app.use(fileUpload({ safeFileNames: true }))\n */\n safeFileNames?: boolean | RegExp | undefined\n /**\n * Path to store temporary files.\n * Used along with the `useTempFiles` option. By default this module uses `'tmp'` folder\n * in the current working directory.\n * You can use trailing slash, but it is not necessary.\n * @default './tmp'\n */\n tempFileDir?: string | undefined\n /**\n * This defines how long to wait for data before aborting. Set to `0` if you want to turn off timeout checks.\n * @default 60_000\n */\n uploadTimeout?: number | undefined\n /**\n * Applies uri decoding to file names if set `true`.\n * @default false\n */\n uriDecodeFileNames?: boolean | undefined\n /**\n * By default this module uploads files into RAM.\n * Setting this option to `true` turns on using temporary files instead of utilising RAM.\n * This avoids memory overflow issues when uploading large files or in case of uploading\n * lots of files at same time.\n * @default false\n */\n useTempFiles?: boolean | undefined\n} & Partial<BusboyConfig>\n\n/**\n * This is the central configuration\n *\n * @see https://payloadcms.com/docs/configuration/overview\n */\nexport type Config = {\n /** Configure admin dashboard */\n admin?: {\n /** Automatically log in as a user */\n autoLogin?:\n | {\n /**\n * The email address of the user to login as\n */\n email?: string\n /** The password of the user to login as. This is only needed if `prefillOnly` is set to true */\n password?: string\n /**\n * If set to true, the login credentials will be prefilled but the user will still need to click the login button.\n *\n * @default false\n */\n prefillOnly?: boolean\n /** The username of the user to login as */\n username?: string\n }\n | false\n\n /** Set account profile picture. Options: gravatar, default or a custom React component. */\n avatar?:\n | 'default'\n | 'gravatar'\n | {\n Component: PayloadComponent<never>\n }\n /**\n * Add extra and/or replace built-in components with custom components\n *\n * @see https://payloadcms.com/docs/admin/components\n */\n components?: {\n /**\n * Add custom components to the top right of the Admin Panel\n */\n actions?: CustomComponent[]\n /**\n * Add custom components after the collection overview\n */\n afterDashboard?: CustomComponent[]\n /**\n * Add custom components after the email/password field\n */\n afterLogin?: CustomComponent[]\n /**\n * Add custom components after the navigation links\n */\n afterNavLinks?: CustomComponent[]\n /**\n * Add custom components before the collection overview\n */\n beforeDashboard?: CustomComponent[]\n /**\n * Add custom components before the email/password field\n */\n beforeLogin?: CustomComponent[]\n /**\n * Add custom components before the navigation links\n */\n beforeNavLinks?: CustomComponent[]\n /** Replace graphical components */\n graphics?: {\n /** Replace the icon in the navigation */\n Icon?: CustomComponent\n /** Replace the logo on the login page */\n Logo?: CustomComponent\n }\n /** Replace logout related components */\n logout?: {\n /** Replace the logout button */\n Button?: CustomComponent\n }\n /**\n * Replace the navigation with a custom component\n */\n Nav?: CustomComponent\n /**\n * Wrap the admin dashboard in custom context providers\n */\n providers?: PayloadComponent<{ children?: React.ReactNode }, { children?: React.ReactNode }>[]\n /**\n * Replace or modify top-level admin routes, or add new ones:\n * + `Account` - `/admin/account`\n * + `Dashboard` - `/admin`\n * + `:path` - `/admin/:path`\n */\n views?: {\n /** Add custom admin views */\n [key: string]: AdminViewConfig\n /** Replace the account screen */\n Account?: AdminViewConfig\n /** Replace the admin homepage */\n Dashboard?: AdminViewConfig\n }\n }\n /** Extension point to add your custom data. Available in server and client. */\n custom?: Record<string, any>\n /** Global date format that will be used for all dates in the Admin panel. Any valid date-fns format pattern can be used. */\n dateFormat?: string\n /**\n * Each entry in this map generates an entry in the importMap,\n * as well as an entry in the componentMap if the type of the\n * dependency is 'component'\n */\n dependencies?: AdminDependencies\n /** If set to true, the entire Admin panel will be disabled. */\n disable?: boolean\n importMap?: {\n /**\n * Automatically generate component map during development\n * @default true\n */\n autoGenerate?: boolean\n\n /** The base directory for component paths starting with /.\n *\n * By default, this is process.cwd()\n **/\n baseDir?: string\n /**\n * You can use generators to add custom components to the component import map.\n * This allows you to import custom components in the admin panel.\n */\n generators?: Array<\n (props: {\n addToImportMap: AddToImportMap\n baseDir: string\n config: SanitizedConfig\n importMap: InternalImportMap\n imports: Imports\n }) => void\n >\n }\n livePreview?: {\n collections?: string[]\n globals?: string[]\n } & LivePreviewConfig\n /** Base meta data to use for the Admin Panel. Included properties are titleSuffix, ogImage, and favicon. */\n meta?: MetaConfig\n routes?: {\n /** The route for the account page. */\n account?: string\n /** The route for the create first user page. */\n createFirstUser?: string\n /** The route for the forgot password page. */\n forgot?: string\n /** The route the user will be redirected to after being inactive for too long. */\n inactivity?: string\n /** The route for the login page. */\n login?: string\n /** The route for the logout page. */\n logout?: string\n /** The route for the reset password page. */\n reset?: string\n /** The route for the unauthorized page. */\n unauthorized?: string\n }\n /** The slug of a Collection that you want to be used to log in to the Admin dashboard. */\n user?: string\n }\n /** Custom Payload bin scripts can be injected via the config. */\n bin?: BinScriptConfig[]\n /**\n * Manage the datamodel of your application\n *\n * @see https://payloadcms.com/docs/configuration/collections#collection-configs\n */\n collections?: CollectionConfig[]\n /**\n * Compatibility flags for prior Payload versions\n */\n compatibility?: {\n /**\n * By default, Payload will remove the `localized: true` property\n * from fields if a parent field is localized. Set this property\n * to `true` only if you have an existing Payload database from pre-3.0\n * that you would like to maintain without migrating. This is only\n * relevant for MongoDB databases.\n */\n allowLocalizedWithinLocalized: true\n }\n /**\n * Prefix a string to all cookies that Payload sets.\n *\n * @default \"payload\"\n */\n cookiePrefix?: string\n /** Either a whitelist array of URLS to allow CORS requests from, or a wildcard string ('*') to accept incoming requests from any domain. */\n cors?: '*' | CORSConfig | string[]\n /** A whitelist array of URLs to allow Payload cookies to be accepted from as a form of CSRF protection. */\n csrf?: string[]\n\n /** Extension point to add your custom data. Server only. */\n custom?: Record<string, any>\n\n /** Pass in a database adapter for use on this project. */\n db: DatabaseAdapterResult\n /** Enable to expose more detailed error information. */\n debug?: boolean\n /**\n * If a user does not specify `depth` while requesting a resource, this depth will be used.\n *\n * @see https://payloadcms.com/docs/getting-started/concepts#depth\n *\n * @default 2\n */\n defaultDepth?: number\n /**\n * The maximum allowed depth to be permitted application-wide. This setting helps prevent against malicious queries.\n *\n * @default 40000\n */\n defaultMaxTextLength?: number\n /** Default richtext editor to use for richText fields */\n editor?: RichTextAdapterProvider<any, any, any>\n /**\n * Email Adapter\n *\n * @see https://payloadcms.com/docs/email/overview\n */\n email?: EmailAdapter | Promise<EmailAdapter>\n /** Custom REST endpoints */\n endpoints?: Endpoint[]\n /**\n * @see https://payloadcms.com/docs/configuration/globals#global-configs\n */\n globals?: GlobalConfig[]\n /**\n * Manage the GraphQL API\n *\n * You can add your own GraphQL queries and mutations to Payload, making use of all the types that Payload has defined for you.\n *\n * @see https://payloadcms.com/docs/graphql/overview\n */\n graphQL?: {\n disable?: boolean\n disablePlaygroundInProduction?: boolean\n maxComplexity?: number\n /**\n * Function that returns an object containing keys to custom GraphQL mutations\n *\n * @see https://payloadcms.com/docs/graphql/extending\n */\n mutations?: GraphQLExtension\n /**\n * Function that returns an object containing keys to custom GraphQL queries\n *\n * @see https://payloadcms.com/docs/graphql/extending\n */\n queries?: GraphQLExtension\n /**\n * Filepath to write the generated schema to\n */\n schemaOutputFile?: string\n }\n /**\n * Tap into Payload-wide hooks.\n *\n * @see https://payloadcms.com/docs/hooks/overview\n */\n hooks?: {\n afterError?: AfterErrorHook\n }\n /** i18n config settings */\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n i18n?: I18nOptions<{} | DefaultTranslationsObject> // loosen the type here to allow for custom translations\n /** Automatically index all sortable top-level fields in the database to improve sort performance and add database compatibility for Azure Cosmos and similar. */\n indexSortableFields?: boolean\n /**\n * Translate your content to different languages/locales.\n *\n * @default false // disable localization\n */\n localization?: false | LocalizationConfig\n\n /**\n * Logger options, logger options with a destination stream, or an instantiated logger instance.\n *\n * See Pino Docs for options: https://getpino.io/#/docs/api?id=options\n *\n * ```ts\n * // Logger options only\n * logger: {\n * level: 'info',\n * }\n *\n * // Logger options with destination stream\n * logger: {\n * options: {\n * level: 'info',\n * },\n * destination: process.stdout\n * },\n *\n * // Logger instance\n * logger: pino({ name: 'my-logger' })\n *\n * ```\n */\n logger?: 'sync' | { destination?: DestinationStream; options: pino.LoggerOptions } | PayloadLogger\n\n /**\n * The maximum allowed depth to be permitted application-wide. This setting helps prevent against malicious queries.\n *\n * @see https://payloadcms.com/docs/getting-started/concepts#depth\n *\n * @default 10\n */\n maxDepth?: number\n /** A function that is called immediately following startup that receives the Payload instance as its only argument. */\n onInit?: (payload: Payload) => Promise<void> | void\n /**\n * An array of Payload plugins.\n *\n * @see https://payloadcms.com/docs/plugins/overview\n */\n plugins?: Plugin[]\n /** Control the routing structure that Payload binds itself to. */\n routes?: {\n /** The route for the admin panel.\n * @example \"/my-admin\"\n * @default \"/admin\"\n */\n admin?: string\n /** @default \"/api\" */\n api?: string\n /** @default \"/graphql\" */\n graphQL?: string\n /** @default \"/graphql-playground\" */\n graphQLPlayground?: string\n }\n /** Secure string that Payload will use for any encryption workflows */\n secret: string\n /**\n * Define the absolute URL of your app including the protocol, for example `https://example.org`.\n * No paths allowed, only protocol, domain and (optionally) port.\n *\n * @see https://payloadcms.com/docs/configuration/overview#options\n */\n serverURL?: string\n /**\n * Pass in a local copy of Sharp if you'd like to use it.\n *\n */\n sharp?: SharpDependency\n /** Send anonymous telemetry data about general usage. */\n telemetry?: boolean\n /** Control how typescript interfaces are generated from your collections. */\n typescript?: {\n /**\n * Automatically generate types during development\n * @default true\n */\n autoGenerate?: boolean\n\n /** Disable declare block in generated types file */\n declare?:\n | {\n /**\n * @internal internal use only to allow for multiple declarations within a monorepo and suppress the \"Duplicate identifier GeneratedTypes\" error\n *\n * Adds a @ts-ignore flag above the GeneratedTypes interface declaration\n *\n * @default false\n */\n ignoreTSError?: boolean\n }\n | false\n\n /** Filename to write the generated types to */\n outputFile?: string\n\n /**\n * Allows you to modify the base JSON schema that is generated during generate:types. This JSON schema will be used\n * to generate the TypeScript interfaces.\n */\n schema?: Array<(args: { jsonSchema: JSONSchema4 }) => JSONSchema4>\n }\n /**\n * Customize the handling of incoming file uploads for collections that have uploads enabled.\n */\n upload?: FetchAPIFileUploadOptions\n}\n\nexport type SanitizedConfig = {\n collections: SanitizedCollectionConfig[]\n /** Default richtext editor to use for richText fields */\n editor?: RichTextAdapter<any, any, any>\n endpoints: Endpoint[]\n globals: SanitizedGlobalConfig[]\n i18n: Required<I18nOptions>\n localization: false | SanitizedLocalizationConfig\n paths: {\n config: string\n configDir: string\n rawConfig: string\n }\n upload: {\n /**\n * Deduped list of adapters used in the project\n */\n adapters: string[]\n } & FetchAPIFileUploadOptions\n} & Omit<\n // TODO: DeepRequired breaks certain, advanced TypeScript types / certain type information is lost. We should remove it when possible.\n // E.g. in packages/ui/src/graphics/Account/index.tsx in getComponent, if avatar.Component is casted to what it's supposed to be,\n // the result type is different\n DeepRequired<Config>,\n 'collections' | 'editor' | 'endpoint' | 'globals' | 'i18n' | 'localization' | 'upload'\n>\n\nexport type EditConfig =\n | {\n [key: string]: EditViewConfig\n /**\n * Replace or modify individual nested routes, or add new ones:\n * + `default` - `/admin/collections/:collection/:id`\n * + `api` - `/admin/collections/:collection/:id/api`\n * + `livePreview` - `/admin/collections/:collection/:id/preview`\n * + `references` - `/admin/collections/:collection/:id/references`\n * + `relationships` - `/admin/collections/:collection/:id/relationships`\n * + `versions` - `/admin/collections/:collection/:id/versions`\n * + `version` - `/admin/collections/:collection/:id/versions/:version`\n * + `customView` - `/admin/collections/:collection/:id/:path`\n *\n * To override the entire Edit View including all nested views, use the `root` key.\n */\n api?: Partial<EditViewConfig>\n default?: Partial<EditViewConfig>\n livePreview?: Partial<EditViewConfig>\n root?: never\n version?: Partial<EditViewConfig>\n versions?: Partial<EditViewConfig>\n // TODO: uncomment these as they are built\n // references?: EditView\n // relationships?: EditView\n }\n | {\n api?: never\n default?: never\n livePreview?: never\n /**\n * Replace or modify _all_ nested document views and routes, including the document header, controls, and tabs. This cannot be used in conjunction with other nested views.\n * + `root` - `/admin/collections/:collection/:id/**\\/*`\n */\n root: Partial<EditViewConfig>\n version?: never\n versions?: never\n }\n\nexport type EntityDescriptionComponent = CustomComponent\n\nexport type EntityDescriptionFunction = ({ t }: { t: TFunction }) => string\n\nexport type EntityDescription = EntityDescriptionFunction | Record<string, string> | string\n\nexport type { EmailAdapter, SendEmailOptions }\n"],"names":["serverProps"],"mappings":"AA6YA,OAAO,MAAMA,cAAqC;IAChD;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA"}
@@ -1,3 +1,3 @@
1
1
  import type { Where } from '../types/index.js';
2
- export declare const combineQueries: (where: Where, access: Where | boolean) => Where;
2
+ export declare const combineQueries: (where: Where, access: boolean | Where) => Where;
3
3
  //# sourceMappingURL=combineQueries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"combineQueries.d.ts","sourceRoot":"","sources":["../../src/database/combineQueries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAI9C,eAAO,MAAM,cAAc,UAAW,KAAK,UAAU,KAAK,GAAG,OAAO,KAAG,KAWtE,CAAA"}
1
+ {"version":3,"file":"combineQueries.d.ts","sourceRoot":"","sources":["../../src/database/combineQueries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAI9C,eAAO,MAAM,cAAc,UAAW,KAAK,UAAU,OAAO,GAAG,KAAK,KAAG,KAiBtE,CAAA"}
@@ -1,11 +1,17 @@
1
1
  import { hasWhereAccessResult } from '../auth/index.js';
2
2
  export const combineQueries = (where, access)=>{
3
- if (!where && !access) return {};
3
+ if (!where && !access) {
4
+ return {};
5
+ }
4
6
  const result = {
5
7
  and: []
6
8
  };
7
- if (where) result.and.push(where);
8
- if (hasWhereAccessResult(access)) result.and.push(access);
9
+ if (where) {
10
+ result.and.push(where);
11
+ }
12
+ if (hasWhereAccessResult(access)) {
13
+ result.and.push(access);
14
+ }
9
15
  return result;
10
16
  };
11
17
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/database/combineQueries.ts"],"sourcesContent":["import type { Where } from '../types/index.js'\n\nimport { hasWhereAccessResult } from '../auth/index.js'\n\nexport const combineQueries = (where: Where, access: Where | boolean): Where => {\n if (!where && !access) return {}\n\n const result: Where = {\n and: [],\n }\n\n if (where) result.and.push(where)\n if (hasWhereAccessResult(access)) result.and.push(access)\n\n return result\n}\n"],"names":["hasWhereAccessResult","combineQueries","where","access","result","and","push"],"mappings":"AAEA,SAASA,oBAAoB,QAAQ,mBAAkB;AAEvD,OAAO,MAAMC,iBAAiB,CAACC,OAAcC;IAC3C,IAAI,CAACD,SAAS,CAACC,QAAQ,OAAO,CAAC;IAE/B,MAAMC,SAAgB;QACpBC,KAAK,EAAE;IACT;IAEA,IAAIH,OAAOE,OAAOC,GAAG,CAACC,IAAI,CAACJ;IAC3B,IAAIF,qBAAqBG,SAASC,OAAOC,GAAG,CAACC,IAAI,CAACH;IAElD,OAAOC;AACT,EAAC"}
1
+ {"version":3,"sources":["../../src/database/combineQueries.ts"],"sourcesContent":["import type { Where } from '../types/index.js'\n\nimport { hasWhereAccessResult } from '../auth/index.js'\n\nexport const combineQueries = (where: Where, access: boolean | Where): Where => {\n if (!where && !access) {\n return {}\n }\n\n const result: Where = {\n and: [],\n }\n\n if (where) {\n result.and.push(where)\n }\n if (hasWhereAccessResult(access)) {\n result.and.push(access)\n }\n\n return result\n}\n"],"names":["hasWhereAccessResult","combineQueries","where","access","result","and","push"],"mappings":"AAEA,SAASA,oBAAoB,QAAQ,mBAAkB;AAEvD,OAAO,MAAMC,iBAAiB,CAACC,OAAcC;IAC3C,IAAI,CAACD,SAAS,CAACC,QAAQ;QACrB,OAAO,CAAC;IACV;IAEA,MAAMC,SAAgB;QACpBC,KAAK,EAAE;IACT;IAEA,IAAIH,OAAO;QACTE,OAAOC,GAAG,CAACC,IAAI,CAACJ;IAClB;IACA,IAAIF,qBAAqBG,SAAS;QAChCC,OAAOC,GAAG,CAACC,IAAI,CAACH;IAClB;IAEA,OAAOC;AACT,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getLocalizedPaths.d.ts","sourceRoot":"","sources":["../../src/database/getLocalizedPaths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAK7D,wBAAsB,iBAAiB,CAAC,EACtC,cAAc,EACd,MAAM,EACN,UAAU,EACV,YAAY,EACZ,MAAM,EACN,cAAsB,EACtB,OAAO,GACR,EAAE;IACD,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,OAAO,EAAE,OAAO,CAAA;CACjB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAkJzB"}
1
+ {"version":3,"file":"getLocalizedPaths.d.ts","sourceRoot":"","sources":["../../src/database/getLocalizedPaths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAK7D,wBAAsB,iBAAiB,CAAC,EACtC,cAAc,EACd,MAAM,EACN,UAAU,EACV,YAAY,EACZ,MAAM,EACN,cAAsB,EACtB,OAAO,GACR,EAAE;IACD,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,OAAO,EAAE,OAAO,CAAA;CACjB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAoJzB"}
@@ -109,7 +109,9 @@ export async function getLocalizedPaths({ collectionSlug, fields, globalSlug, in
109
109
  if ('fields' in lastIncompletePath.field) {
110
110
  lastIncompletePath.fields = flattenFields(lastIncompletePath.field.fields, false);
111
111
  }
112
- if (i + 1 === pathSegments.length) lastIncompletePath.complete = true;
112
+ if (i + 1 === pathSegments.length) {
113
+ lastIncompletePath.complete = true;
114
+ }
113
115
  lastIncompletePath.path = currentPath;
114
116
  }
115
117
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/database/getLocalizedPaths.ts"],"sourcesContent":["import type { Field } from '../fields/config/types.js'\nimport type { Payload } from '../index.js'\nimport type { PathToQuery } from './queryValidation/types.js'\n\nimport { fieldAffectsData } from '../fields/config/types.js'\nimport flattenFields from '../utilities/flattenTopLevelFields.js'\n\nexport async function getLocalizedPaths({\n collectionSlug,\n fields,\n globalSlug,\n incomingPath,\n locale,\n overrideAccess = false,\n payload,\n}: {\n collectionSlug?: string\n fields: Field[]\n globalSlug?: string\n incomingPath: string\n locale?: string\n overrideAccess?: boolean\n payload: Payload\n}): Promise<PathToQuery[]> {\n const pathSegments = incomingPath.split('.')\n const localizationConfig = payload.config.localization\n\n let paths: PathToQuery[] = [\n {\n collectionSlug,\n complete: false,\n field: undefined,\n fields: flattenFields(fields, false),\n globalSlug,\n invalid: false,\n path: '',\n },\n ]\n\n for (let i = 0; i < pathSegments.length; i += 1) {\n const segment = pathSegments[i]\n\n const lastIncompletePath = paths.find(({ complete }) => !complete)\n\n if (lastIncompletePath) {\n const { path } = lastIncompletePath\n let currentPath = path ? `${path}.${segment}` : segment\n\n const matchedField = lastIncompletePath.fields.find(\n (field) => fieldAffectsData(field) && field.name === segment,\n )\n lastIncompletePath.field = matchedField\n\n if (currentPath === 'globalType' && globalSlug) {\n lastIncompletePath.path = currentPath\n lastIncompletePath.complete = true\n lastIncompletePath.field = {\n name: 'globalType',\n type: 'text',\n }\n\n return paths\n }\n\n if (!matchedField && currentPath === 'id' && i === pathSegments.length - 1) {\n lastIncompletePath.path = currentPath\n const idField: Field = {\n name: 'id',\n type: payload.db.defaultIDType as 'text',\n }\n lastIncompletePath.field = idField\n lastIncompletePath.complete = true\n return paths\n }\n\n if (matchedField) {\n if ('hidden' in matchedField && matchedField.hidden && !overrideAccess) {\n lastIncompletePath.invalid = true\n }\n\n const nextSegment = pathSegments[i + 1]\n const nextSegmentIsLocale =\n localizationConfig && localizationConfig.localeCodes.includes(nextSegment)\n\n if (nextSegmentIsLocale) {\n // Skip the next iteration, because it's a locale\n i += 1\n currentPath = `${currentPath}.${nextSegment}`\n } else if (localizationConfig && 'localized' in matchedField && matchedField.localized) {\n currentPath = `${currentPath}.${locale}`\n }\n\n switch (matchedField.type) {\n case 'blocks':\n case 'richText':\n case 'json': {\n const upcomingSegments = pathSegments.slice(i + 1).join('.')\n lastIncompletePath.complete = true\n lastIncompletePath.path = upcomingSegments\n ? `${currentPath}.${upcomingSegments}`\n : currentPath\n return paths\n }\n\n case 'relationship':\n case 'upload': {\n // If this is a polymorphic relation,\n // We only support querying directly (no nested querying)\n if (typeof matchedField.relationTo !== 'string') {\n const lastSegmentIsValid =\n ['relationTo', 'value'].includes(pathSegments[pathSegments.length - 1]) ||\n pathSegments.length === 1 ||\n (pathSegments.length === 2 && pathSegments[0] === 'version')\n\n lastIncompletePath.path = pathSegments.join('.')\n\n if (lastSegmentIsValid) {\n lastIncompletePath.complete = true\n } else {\n lastIncompletePath.invalid = true\n return paths\n }\n } else {\n lastIncompletePath.complete = true\n lastIncompletePath.path = currentPath\n\n const nestedPathToQuery = pathSegments\n .slice(nextSegmentIsLocale ? i + 2 : i + 1)\n .join('.')\n\n if (nestedPathToQuery) {\n const relatedCollection = payload.collections[matchedField.relationTo].config\n\n const remainingPaths = await getLocalizedPaths({\n collectionSlug: relatedCollection.slug,\n fields: relatedCollection.fields,\n globalSlug,\n incomingPath: nestedPathToQuery,\n locale,\n payload,\n })\n\n paths = [...paths, ...remainingPaths]\n }\n\n return paths\n }\n\n break\n }\n\n default: {\n if ('fields' in lastIncompletePath.field) {\n lastIncompletePath.fields = flattenFields(lastIncompletePath.field.fields, false)\n }\n\n if (i + 1 === pathSegments.length) lastIncompletePath.complete = true\n lastIncompletePath.path = currentPath\n }\n }\n } else {\n lastIncompletePath.invalid = true\n lastIncompletePath.path = currentPath\n return paths\n }\n }\n }\n\n return paths\n}\n"],"names":["fieldAffectsData","flattenFields","getLocalizedPaths","collectionSlug","fields","globalSlug","incomingPath","locale","overrideAccess","payload","pathSegments","split","localizationConfig","config","localization","paths","complete","field","undefined","invalid","path","i","length","segment","lastIncompletePath","find","currentPath","matchedField","name","type","idField","db","defaultIDType","hidden","nextSegment","nextSegmentIsLocale","localeCodes","includes","localized","upcomingSegments","slice","join","relationTo","lastSegmentIsValid","nestedPathToQuery","relatedCollection","collections","remainingPaths","slug"],"mappings":"AAIA,SAASA,gBAAgB,QAAQ,4BAA2B;AAC5D,OAAOC,mBAAmB,wCAAuC;AAEjE,OAAO,eAAeC,kBAAkB,EACtCC,cAAc,EACdC,MAAM,EACNC,UAAU,EACVC,YAAY,EACZC,MAAM,EACNC,iBAAiB,KAAK,EACtBC,OAAO,EASR;IACC,MAAMC,eAAeJ,aAAaK,KAAK,CAAC;IACxC,MAAMC,qBAAqBH,QAAQI,MAAM,CAACC,YAAY;IAEtD,IAAIC,QAAuB;QACzB;YACEZ;YACAa,UAAU;YACVC,OAAOC;YACPd,QAAQH,cAAcG,QAAQ;YAC9BC;YACAc,SAAS;YACTC,MAAM;QACR;KACD;IAED,IAAK,IAAIC,IAAI,GAAGA,IAAIX,aAAaY,MAAM,EAAED,KAAK,EAAG;QAC/C,MAAME,UAAUb,YAAY,CAACW,EAAE;QAE/B,MAAMG,qBAAqBT,MAAMU,IAAI,CAAC,CAAC,EAAET,QAAQ,EAAE,GAAK,CAACA;QAEzD,IAAIQ,oBAAoB;YACtB,MAAM,EAAEJ,IAAI,EAAE,GAAGI;YACjB,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oBAEA;wBAAS;4BACP,IAAI,YAAYS,mBAAmBP,KAAK,EAAE;gCACxCO,mBAAmBpB,MAAM,GAAGH,cAAcuB,mBAAmBP,KAAK,CAACb,MAAM,EAAE;4BAC7E;4BAEA,IAAIiB,IAAI,MAAMX,aAAaY,MAAM,EAAEE,mBAAmBR,QAAQ,GAAG;4BACjEQ,mBAAmBJ,IAAI,GAAGM;wBAC5B;gBACF;YACF,OAAO;gBACLF,mBAAmBL,OAAO,GAAG;gBAC7BK,mBAAmBJ,IAAI,GAAGM;gBAC1B,OAAOX;YACT;QACF;IACF;IAEA,OAAOA;AACT"}
1
+ {"version":3,"sources":["../../src/database/getLocalizedPaths.ts"],"sourcesContent":["import type { Field } from '../fields/config/types.js'\nimport type { Payload } from '../index.js'\nimport type { PathToQuery } from './queryValidation/types.js'\n\nimport { fieldAffectsData } from '../fields/config/types.js'\nimport flattenFields from '../utilities/flattenTopLevelFields.js'\n\nexport async function getLocalizedPaths({\n collectionSlug,\n fields,\n globalSlug,\n incomingPath,\n locale,\n overrideAccess = false,\n payload,\n}: {\n collectionSlug?: string\n fields: Field[]\n globalSlug?: string\n incomingPath: string\n locale?: string\n overrideAccess?: boolean\n payload: Payload\n}): Promise<PathToQuery[]> {\n const pathSegments = incomingPath.split('.')\n const localizationConfig = payload.config.localization\n\n let paths: PathToQuery[] = [\n {\n collectionSlug,\n complete: false,\n field: undefined,\n fields: flattenFields(fields, false),\n globalSlug,\n invalid: false,\n path: '',\n },\n ]\n\n for (let i = 0; i < pathSegments.length; i += 1) {\n const segment = pathSegments[i]\n\n const lastIncompletePath = paths.find(({ complete }) => !complete)\n\n if (lastIncompletePath) {\n const { path } = lastIncompletePath\n let currentPath = path ? `${path}.${segment}` : segment\n\n const matchedField = lastIncompletePath.fields.find(\n (field) => fieldAffectsData(field) && field.name === segment,\n )\n lastIncompletePath.field = matchedField\n\n if (currentPath === 'globalType' && globalSlug) {\n lastIncompletePath.path = currentPath\n lastIncompletePath.complete = true\n lastIncompletePath.field = {\n name: 'globalType',\n type: 'text',\n }\n\n return paths\n }\n\n if (!matchedField && currentPath === 'id' && i === pathSegments.length - 1) {\n lastIncompletePath.path = currentPath\n const idField: Field = {\n name: 'id',\n type: payload.db.defaultIDType as 'text',\n }\n lastIncompletePath.field = idField\n lastIncompletePath.complete = true\n return paths\n }\n\n if (matchedField) {\n if ('hidden' in matchedField && matchedField.hidden && !overrideAccess) {\n lastIncompletePath.invalid = true\n }\n\n const nextSegment = pathSegments[i + 1]\n const nextSegmentIsLocale =\n localizationConfig && localizationConfig.localeCodes.includes(nextSegment)\n\n if (nextSegmentIsLocale) {\n // Skip the next iteration, because it's a locale\n i += 1\n currentPath = `${currentPath}.${nextSegment}`\n } else if (localizationConfig && 'localized' in matchedField && matchedField.localized) {\n currentPath = `${currentPath}.${locale}`\n }\n\n switch (matchedField.type) {\n case 'blocks':\n case 'richText':\n case 'json': {\n const upcomingSegments = pathSegments.slice(i + 1).join('.')\n lastIncompletePath.complete = true\n lastIncompletePath.path = upcomingSegments\n ? `${currentPath}.${upcomingSegments}`\n : currentPath\n return paths\n }\n\n case 'relationship':\n case 'upload': {\n // If this is a polymorphic relation,\n // We only support querying directly (no nested querying)\n if (typeof matchedField.relationTo !== 'string') {\n const lastSegmentIsValid =\n ['relationTo', 'value'].includes(pathSegments[pathSegments.length - 1]) ||\n pathSegments.length === 1 ||\n (pathSegments.length === 2 && pathSegments[0] === 'version')\n\n lastIncompletePath.path = pathSegments.join('.')\n\n if (lastSegmentIsValid) {\n lastIncompletePath.complete = true\n } else {\n lastIncompletePath.invalid = true\n return paths\n }\n } else {\n lastIncompletePath.complete = true\n lastIncompletePath.path = currentPath\n\n const nestedPathToQuery = pathSegments\n .slice(nextSegmentIsLocale ? i + 2 : i + 1)\n .join('.')\n\n if (nestedPathToQuery) {\n const relatedCollection = payload.collections[matchedField.relationTo].config\n\n const remainingPaths = await getLocalizedPaths({\n collectionSlug: relatedCollection.slug,\n fields: relatedCollection.fields,\n globalSlug,\n incomingPath: nestedPathToQuery,\n locale,\n payload,\n })\n\n paths = [...paths, ...remainingPaths]\n }\n\n return paths\n }\n\n break\n }\n\n default: {\n if ('fields' in lastIncompletePath.field) {\n lastIncompletePath.fields = flattenFields(lastIncompletePath.field.fields, false)\n }\n\n if (i + 1 === pathSegments.length) {\n lastIncompletePath.complete = true\n }\n lastIncompletePath.path = currentPath\n }\n }\n } else {\n lastIncompletePath.invalid = true\n lastIncompletePath.path = currentPath\n return paths\n }\n }\n }\n\n return paths\n}\n"],"names":["fieldAffectsData","flattenFields","getLocalizedPaths","collectionSlug","fields","globalSlug","incomingPath","locale","overrideAccess","payload","pathSegments","split","localizationConfig","config","localization","paths","complete","field","undefined","invalid","path","i","length","segment","lastIncompletePath","find","currentPath","matchedField","name","type","idField","db","defaultIDType","hidden","nextSegment","nextSegmentIsLocale","localeCodes","includes","localized","upcomingSegments","slice","join","relationTo","lastSegmentIsValid","nestedPathToQuery","relatedCollection","collections","remainingPaths","slug"],"mappings":"AAIA,SAASA,gBAAgB,QAAQ,4BAA2B;AAC5D,OAAOC,mBAAmB,wCAAuC;AAEjE,OAAO,eAAeC,kBAAkB,EACtCC,cAAc,EACdC,MAAM,EACNC,UAAU,EACVC,YAAY,EACZC,MAAM,EACNC,iBAAiB,KAAK,EACtBC,OAAO,EASR;IACC,MAAMC,eAAeJ,aAAaK,KAAK,CAAC;IACxC,MAAMC,qBAAqBH,QAAQI,MAAM,CAACC,YAAY;IAEtD,IAAIC,QAAuB;QACzB;YACEZ;YACAa,UAAU;YACVC,OAAOC;YACPd,QAAQH,cAAcG,QAAQ;YAC9BC;YACAc,SAAS;YACTC,MAAM;QACR;KACD;IAED,IAAK,IAAIC,IAAI,GAAGA,IAAIX,aAAaY,MAAM,EAAED,KAAK,EAAG;QAC/C,MAAME,UAAUb,YAAY,CAACW,EAAE;QAE/B,MAAMG,qBAAqBT,MAAMU,IAAI,CAAC,CAAC,EAAET,QAAQ,EAAE,GAAK,CAACA;QAEzD,IAA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2CAAUgC;qCAAe;gCACvC;gCAEA,OAAOhC;4BACT;4BAEA;wBACF;oBAEA;wBAAS;4BACP,IAAI,YAAYS,mBAAmBP,KAAK,EAAE;gCACxCO,mBAAmBpB,MAAM,GAAGH,cAAcuB,mBAAmBP,KAAK,CAACb,MAAM,EAAE;4BAC7E;4BAEA,IAAIiB,IAAI,MAAMX,aAAaY,MAAM,EAAE;gCACjCE,mBAAmBR,QAAQ,GAAG;4BAChC;4BACAQ,mBAAmBJ,IAAI,GAAGM;wBAC5B;gBACF;YACF,OAAO;gBACLF,mBAAmBL,OAAO,GAAG;gBAC7BK,mBAAmBJ,IAAI,GAAGM;gBAC1B,OAAOX;YACT;QACF;IACF;IAEA,OAAOA;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"readMigrationFiles.d.ts","sourceRoot":"","sources":["../../../src/database/migrations/readMigrationFiles.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C;;GAEG;AACH,eAAO,MAAM,kBAAkB,iBAE5B;IACD,OAAO,EAAE,OAAO,CAAA;CACjB,KAAG,OAAO,CAAC,SAAS,EAAE,CAwCtB,CAAA"}
1
+ {"version":3,"file":"readMigrationFiles.d.ts","sourceRoot":"","sources":["../../../src/database/migrations/readMigrationFiles.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C;;GAEG;AACH,eAAO,MAAM,kBAAkB,iBAE5B;IACD,OAAO,EAAE,OAAO,CAAA;CACjB,KAAG,OAAO,CAAC,SAAS,EAAE,CA0CtB,CAAA"}
@@ -21,7 +21,9 @@ import path from 'path';
21
21
  return Promise.all(files.map(async (filePath)=>{
22
22
  // eval used to circumvent errors bundling
23
23
  let migration = typeof require === 'function' ? await eval(`require('${filePath.replaceAll('\\', '/')}')`) : await eval(`import('${pathToFileURL(filePath).href}')`);
24
- if ('default' in migration) migration = migration.default;
24
+ if ('default' in migration) {
25
+ migration = migration.default;
26
+ }
25
27
  const result = {
26
28
  name: path.basename(filePath).split('.')?.[0],
27
29
  down: migration.down,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/database/migrations/readMigrationFiles.ts"],"sourcesContent":["import fs from 'fs'\nimport { pathToFileURL } from 'node:url'\nimport path from 'path'\n\nimport type { Payload } from '../../index.js'\nimport type { Migration } from '../types.js'\n\n/**\n * Read the migration files from disk\n */\nexport const readMigrationFiles = async ({\n payload,\n}: {\n payload: Payload\n}): Promise<Migration[]> => {\n if (!fs.existsSync(payload.db.migrationDir)) {\n payload.logger.error({\n msg: `No migration directory found at ${payload.db.migrationDir}`,\n })\n return []\n }\n\n payload.logger.info({\n msg: `Reading migration files from ${payload.db.migrationDir}`,\n })\n\n const files = fs\n .readdirSync(payload.db.migrationDir)\n .sort()\n .filter((f) => {\n return (f.endsWith('.ts') || f.endsWith('.js')) && !f.includes('index.')\n })\n .map((file) => {\n return path.resolve(payload.db.migrationDir, file)\n })\n\n return Promise.all(\n files.map(async (filePath) => {\n // eval used to circumvent errors bundling\n let migration =\n typeof require === 'function'\n ? await eval(`require('${filePath.replaceAll('\\\\', '/')}')`)\n : await eval(`import('${pathToFileURL(filePath).href}')`)\n if ('default' in migration) migration = migration.default\n\n const result: Migration = {\n name: path.basename(filePath).split('.')?.[0],\n down: migration.down,\n up: migration.up,\n }\n\n return result\n }),\n )\n}\n"],"names":["fs","pathToFileURL","path","readMigrationFiles","payload","existsSync","db","migrationDir","logger","error","msg","info","files","readdirSync","sort","filter","f","endsWith","includes","map","file","resolve","Promise","all","filePath","migration","require","eval","replaceAll","href","default","result","name","basename","split","down","up"],"mappings":"AAAA,OAAOA,QAAQ,KAAI;AACnB,SAASC,aAAa,QAAQ,WAAU;AACxC,OAAOC,UAAU,OAAM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sources":["../../../src/database/migrations/readMigrationFiles.ts"],"sourcesContent":["import fs from 'fs'\nimport { pathToFileURL } from 'node:url'\nimport path from 'path'\n\nimport type { Payload } from '../../index.js'\nimport type { Migration } from '../types.js'\n\n/**\n * Read the migration files from disk\n */\nexport const readMigrationFiles = async ({\n payload,\n}: {\n payload: Payload\n}): Promise<Migration[]> => {\n if (!fs.existsSync(payload.db.migrationDir)) {\n payload.logger.error({\n msg: `No migration directory found at ${payload.db.migrationDir}`,\n })\n return []\n }\n\n payload.logger.info({\n msg: `Reading migration files from ${payload.db.migrationDir}`,\n })\n\n const files = fs\n .readdirSync(payload.db.migrationDir)\n .sort()\n .filter((f) => {\n return (f.endsWith('.ts') || f.endsWith('.js')) && !f.includes('index.')\n })\n .map((file) => {\n return path.resolve(payload.db.migrationDir, file)\n })\n\n return Promise.all(\n files.map(async (filePath) => {\n // eval used to circumvent errors bundling\n let migration =\n typeof require === 'function'\n ? await eval(`require('${filePath.replaceAll('\\\\', '/')}')`)\n : await eval(`import('${pathToFileURL(filePath).href}')`)\n if ('default' in migration) {\n migration = migration.default\n }\n\n const result: Migration = {\n name: path.basename(filePath).split('.')?.[0],\n down: migration.down,\n up: migration.up,\n }\n\n return result\n }),\n )\n}\n"],"names":["fs","pathToFileURL","path","readMigrationFiles","payload","existsSync","db","migrationDir","logger","error","msg","info","files","readdirSync","sort","filter","f","endsWith","includes","map","file","resolve","Promise","all","filePath","migration","require","eval","replaceAll","href","default","result","name","basename","split","down","up"],"mappings":"AAAA,OAAOA,QAAQ,KAAI;AACnB,SAASC,aAAa,QAAQ,WAAU;AACxC,OAAOC,UAAU,OAAM;AAKvB;;CAEC,GACD,OAAO,MAAMC,qBAAqB,OAAO,EACvCC,OAAO,EAGR;IACC,IAAI,CAACJ,GAAGK,UAAU,CAACD,QAAQE,EAAE,CAACC,YAAY,GAAG;QAC3CH,QAAQI,MAAM,CAACC,KAAK,CAAC;YACnBC,KAAK,CAAC,gCAAgC,EAAEN,QAAQE,EAAE,CAACC,YAAY,CAAC,CAAC;QACnE;QACA,OAAO,EAAE;IACX;IAEAH,QAAQI,MAAM,CAACG,IAAI,CAAC;QAClBD,KAAK,CAAC,6BAA6B,EAAEN,QAAQE,EAAE,CAACC,YAAY,CAAC,CAAC;IAChE;IAEA,MAAMK,QAAQZ,GACXa,WAAW,CAACT,QAAQE,EAAE,CAACC,YAAY,EACnCO,IAAI,GACJC,MAAM,CAAC,CAACC;QACP,OAAO,AAACA,CAAAA,EAAEC,QAAQ,CAAC,UAAUD,EAAEC,QAAQ,CAAC,MAAK,KAAM,CAACD,EAAEE,QAAQ,CAAC;IACjE,GACCC,GAAG,CAAC,CAACC;QACJ,OAAOlB,KAAKmB,OAAO,CAACjB,QAAQE,EAAE,CAACC,YAAY,EAAEa;IAC/C;IAEF,OAAOE,QAAQC,GAAG,CAChBX,MAAMO,GAAG,CAAC,OAAOK;QACf,0CAA0C;QAC1C,IAAIC,YACF,OAAOC,YAAY,aACf,MAAMC,KAAK,CAAC,SAAS,EAAEH,SAASI,UAAU,CAAC,MAAM,KAAK,EAAE,CAAC,IACzD,MAAMD,KAAK,CAAC,QAAQ,EAAE1B,cAAcuB,UAAUK,IAAI,CAAC,EAAE,CAAC;QAC5D,IAAI,aAAaJ,WAAW;YAC1BA,YAAYA,UAAUK,OAAO;QAC/B;QAEA,MAAMC,SAAoB;YACxBC,MAAM9B,KAAK+B,QAAQ,CAACT,UAAUU,KAAK,CAAC,MAAM,CAAC,EAAE;YAC7CC,MAAMV,UAAUU,IAAI;YACpBC,IAAIX,UAAUW,EAAE;QAClB;QAEA,OAAOL;IACT;AAEJ,EAAC"}
@@ -128,8 +128,8 @@ export type CreateMigration = (args: {
128
128
  }) => Promise<void> | void;
129
129
  export type Transaction = (callback: () => Promise<void>, options?: Record<string, unknown>) => Promise<void>;
130
130
  export type BeginTransaction = (options?: Record<string, unknown>) => Promise<null | number | string>;
131
- export type RollbackTransaction = (id: Promise<number | string> | number | string) => Promise<void>;
132
- export type CommitTransaction = (id: Promise<number | string> | number | string) => Promise<void>;
131
+ export type RollbackTransaction = (id: number | Promise<number | string> | string) => Promise<void>;
132
+ export type CommitTransaction = (id: number | Promise<number | string> | string) => Promise<void>;
133
133
  export type QueryDraftsArgs = {
134
134
  collection: string;
135
135
  limit?: number;
@@ -147,7 +147,7 @@ export type FindOneArgs = {
147
147
  req: PayloadRequest;
148
148
  where?: Where;
149
149
  };
150
- export type FindOne = <T extends TypeWithID>(args: FindOneArgs) => Promise<T | null>;
150
+ export type FindOne = <T extends TypeWithID>(args: FindOneArgs) => Promise<null | T>;
151
151
  export type FindArgs = {
152
152
  collection: string;
153
153
  /** Setting limit to 1 is equal to the previous Model.findOne(). Setting limit to 0 disables the limit */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/database/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE3D,YAAY,EAAE,eAAe,EAAE,CAAA;AAE/B,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;IACnC;;OAEG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IAErC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB,KAAK,EAAE,KAAK,CAAA;IAEZ,MAAM,EAAE,MAAM,CAAA;IAEd,YAAY,EAAE,YAAY,CAAA;IAE1B,mBAAmB,EAAE,mBAAmB,CAAA;IACxC;;OAEG;IACH,eAAe,EAAE,eAAe,CAAA;IAEhC,aAAa,EAAE,aAAa,CAAA;IAE5B;;OAEG;IACH,aAAa,EAAE,QAAQ,GAAG,MAAM,CAAA;IAEhC,UAAU,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E,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,aAAa,CAAC,CAAC,GAAG,GAAG,IAAI;IACnC,IAAI,EAAE,CAAC,EAAE,CAAA;IACT,WAAW,EAAE,OAAO,CAAA;IACpB,WAAW,EAAE,OAAO,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAA;IACpC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAA;IACpC,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,qBAAqB,CAAC,CAAC,GAAG,mBAAmB,IAAI;IAC3D,aAAa,EAAE,QAAQ,GAAG,MAAM,CAAA;IAChC,IAAI,EAAE,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,KAAK,CAAC,CAAA;CACxC,CAAA;AAED,MAAM,MAAM,gBAAgB,GACxB,CAAC,CAAC,IAAI,EAAE;IACN,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,KAAK,MAAM,CAAC,GACb,MAAM,CAAA;AAEV,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/database/types.ts"],"sourcesContent":["import type { TypeWithID } from '../collections/config/types.js'\nimport type { Document, Payload, PayloadRequest, Where } from '../types/index.js'\nimport type { TypeWithVersion } from '../versions/types.js'\n\nexport type { TypeWithVersion }\n\nexport interface BaseDatabaseAdapter {\n /**\n * Start a transaction, requiring commitTransaction() to be called for any changes to be made.\n * @returns an identifier for the transaction or null if one cannot be established\n */\n beginTransaction?: BeginTransaction\n /**\n * Persist the changes made since the start of the transaction.\n */\n commitTransaction?: CommitTransaction\n\n /**\n * Open the connection to the database\n */\n connect?: Connect\n\n count: Count\n\n create: Create\n\n createGlobal: CreateGlobal\n\n createGlobalVersion: CreateGlobalVersion\n /**\n * Output a migration file\n */\n createMigration: CreateMigration\n\n createVersion: CreateVersion\n\n /**\n * Specify if the ID is a text or number field by default within this database adapter.\n */\n defaultIDType: 'number' | 'text'\n\n deleteMany: DeleteMany\n\n deleteOne: DeleteOne\n\n deleteVersions: DeleteVersions\n /**\n * Terminate the connection with the database\n */\n destroy?: Destroy\n\n find: <T = TypeWithID>(args: FindArgs) => Promise<PaginatedDocs<T>>\n\n findGlobal: FindGlobal\n\n findGlobalVersions: FindGlobalVersions\n\n findOne: FindOne\n\n findVersions: FindVersions\n\n /**\n * Perform startup tasks required to interact with the database such as building Schema and models\n */\n init?: Init\n\n /**\n * Run any migration up functions that have not yet been performed and update the status\n */\n migrate: (args?: { migrations?: Migration[] }) => Promise<void>\n\n /**\n * Run any migration down functions that have been performed\n */\n migrateDown: () => Promise<void>\n\n /**\n * Drop the current database and run all migrate up functions\n */\n migrateFresh: (args: { forceAcceptWarning?: boolean }) => Promise<void>\n\n /**\n * Run all migration down functions before running up\n */\n migrateRefresh: () => Promise<void>\n /**\n * Run all migrate down functions\n */\n migrateReset: () => Promise<void>\n\n /**\n * Read the current state of migrations and output the result to show which have been run\n */\n migrateStatus: () => Promise<void>\n /**\n * Path to read and write migration files from\n */\n migrationDir: string\n /**\n * The name of the database adapter\n */\n name: string\n /**\n * Full package name of the database adapter\n *\n * @example @payloadcms/db-postgres\n */\n packageName: string\n\n /**\n * reference to the instance of payload\n */\n payload: Payload\n\n queryDrafts: QueryDrafts\n /**\n * Abort any changes since the start of the transaction.\n */\n rollbackTransaction?: RollbackTransaction\n /**\n * A key-value store of all sessions open (used for transactions)\n */\n sessions?: {\n [id: string]: {\n db: unknown\n reject: () => Promise<void>\n resolve: () => Promise<void>\n }\n }\n\n updateGlobal: UpdateGlobal\n\n updateGlobalVersion: UpdateGlobalVersion\n\n updateOne: UpdateOne\n\n updateVersion: UpdateVersion\n}\n\nexport type Init = () => Promise<void> | void\n\ntype ConnectArgs = {\n hotReload: boolean\n}\n\nexport type Connect = (args?: ConnectArgs) => Promise<void>\n\nexport type Destroy = () => Promise<void>\n\nexport type CreateMigration = (args: {\n file?: string\n /**\n * Skips the prompt asking to create empty migrations\n */\n forceAcceptWarning?: boolean\n migrationName?: string\n payload: Payload\n}) => Promise<void> | void\n\nexport type Transaction = (\n callback: () => Promise<void>,\n options?: Record<string, unknown>,\n) => Promise<void>\n\nexport type BeginTransaction = (\n options?: Record<string, unknown>,\n) => Promise<null | number | string>\n\nexport type RollbackTransaction = (id: Promise<number | string> | number | string) => Promise<void>\n\nexport type CommitTransaction = (id: Promise<number | string> | number | string) => Promise<void>\n\nexport type QueryDraftsArgs = {\n collection: string\n limit?: number\n locale?: string\n page?: number\n pagination?: boolean\n req: PayloadRequest\n sort?: string\n where?: Where\n}\n\nexport type QueryDrafts = <T = TypeWithID>(args: QueryDraftsArgs) => Promise<PaginatedDocs<T>>\n\nexport type FindOneArgs = {\n collection: string\n locale?: string\n req: PayloadRequest\n where?: Where\n}\n\nexport type FindOne = <T extends TypeWithID>(args: FindOneArgs) => Promise<T | null>\n\nexport type FindArgs = {\n collection: string\n /** Setting limit to 1 is equal to the previous Model.findOne(). Setting limit to 0 disables the limit */\n limit?: number\n locale?: string\n page?: number\n pagination?: boolean\n req: PayloadRequest\n skip?: number\n sort?: string\n versions?: boolean\n where?: Where\n}\n\nexport type Find = <T = TypeWithID>(args: FindArgs) => Promise<PaginatedDocs<T>>\n\nexport type CountArgs = {\n collection: string\n locale?: string\n req: PayloadRequest\n where?: Where\n}\n\nexport type Count = (args: CountArgs) => Promise<{ totalDocs: number }>\n\ntype BaseVersionArgs = {\n limit?: number\n locale?: string\n page?: number\n pagination?: boolean\n req: PayloadRequest\n skip?: number\n sort?: string\n versions?: boolean\n where?: Where\n}\n\nexport type FindVersionsArgs = {\n collection: string\n} & BaseVersionArgs\n\nexport type FindVersions = <T = TypeWithID>(\n args: FindVersionsArgs,\n) => Promise<PaginatedDocs<TypeWithVersion<T>>>\n\nexport type FindGlobalVersionsArgs = {\n global: string\n} & BaseVersionArgs\n\nexport type FindGlobalArgs = {\n locale?: string\n req: PayloadRequest\n slug: string\n where?: Where\n}\n\nexport type UpdateGlobalVersionArgs<T = TypeWithID> = {\n global: string\n locale?: string\n req: PayloadRequest\n versionData: T\n} & (\n | {\n id: number | string\n where?: never\n }\n | {\n id?: never\n where: Where\n }\n)\n\nexport type UpdateGlobalVersion = <T extends TypeWithID = TypeWithID>(\n args: UpdateGlobalVersionArgs<T>,\n) => Promise<TypeWithVersion<T>>\n\nexport type FindGlobal = <T extends Record<string, unknown> = any>(\n args: FindGlobalArgs,\n) => Promise<T>\n\nexport type CreateGlobalArgs<T extends Record<string, unknown> = any> = {\n data: T\n req: PayloadRequest\n slug: string\n}\nexport type CreateGlobal = <T extends Record<string, unknown> = any>(\n args: CreateGlobalArgs<T>,\n) => Promise<T>\n\nexport type UpdateGlobalArgs<T extends Record<string, unknown> = any> = {\n data: T\n req: PayloadRequest\n slug: string\n}\nexport type UpdateGlobal = <T extends Record<string, unknown> = any>(\n args: UpdateGlobalArgs<T>,\n) => Promise<T>\n// export type UpdateOne = (args: UpdateOneArgs) => Promise<Document>\n\nexport type FindGlobalVersions = <T = TypeWithID>(\n args: FindGlobalVersionsArgs,\n) => Promise<PaginatedDocs<TypeWithVersion<T>>>\n\nexport type DeleteVersionsArgs = {\n collection: string\n locale?: string\n req: PayloadRequest\n sort?: {\n [key: string]: string\n }\n where: Where\n}\n\nexport type CreateVersionArgs<T = TypeWithID> = {\n autosave: boolean\n collectionSlug: string\n createdAt: string\n /** ID of the parent document for which the version should be created for */\n parent: number | string\n req: PayloadRequest\n updatedAt: string\n versionData: T\n}\n\nexport type CreateVersion = <T extends TypeWithID = TypeWithID>(\n args: CreateVersionArgs<T>,\n) => Promise<TypeWithVersion<T>>\n\nexport type CreateGlobalVersionArgs<T = TypeWithID> = {\n autosave: boolean\n createdAt: string\n globalSlug: string\n /** ID of the parent document for which the version should be created for */\n parent: number | string\n req: PayloadRequest\n updatedAt: string\n versionData: T\n}\n\nexport type CreateGlobalVersion = <T extends TypeWithID = TypeWithID>(\n args: CreateGlobalVersionArgs<T>,\n) => Promise<TypeWithVersion<T>>\n\nexport type DeleteVersions = (args: DeleteVersionsArgs) => Promise<void>\n\nexport type UpdateVersionArgs<T = TypeWithID> = {\n collection: string\n locale?: string\n req: PayloadRequest\n versionData: T\n} & (\n | {\n id: number | string\n where?: never\n }\n | {\n id?: never\n where: Where\n }\n)\n\nexport type UpdateVersion = <T extends TypeWithID = TypeWithID>(\n args: UpdateVersionArgs<T>,\n) => Promise<TypeWithVersion<T>>\n\nexport type CreateArgs = {\n collection: string\n data: Record<string, unknown>\n draft?: boolean\n locale?: string\n req: PayloadRequest\n}\n\nexport type Create = (args: CreateArgs) => Promise<Document>\n\nexport type UpdateOneArgs = {\n collection: string\n data: Record<string, unknown>\n draft?: boolean\n locale?: string\n req: PayloadRequest\n} & (\n | {\n id: number | string\n where?: never\n }\n | {\n id?: never\n where: Where\n }\n)\n\nexport type UpdateOne = (args: UpdateOneArgs) => Promise<Document>\n\nexport type DeleteOneArgs = {\n collection: string\n req: PayloadRequest\n where: Where\n}\n\nexport type DeleteOne = (args: DeleteOneArgs) => Promise<Document>\n\nexport type DeleteManyArgs = {\n collection: string\n req: PayloadRequest\n where: Where\n}\n\nexport type DeleteMany = (args: DeleteManyArgs) => Promise<void>\n\nexport type Migration = {\n down: (args: unknown) => Promise<void>\n up: (args: unknown) => Promise<void>\n} & MigrationData\n\nexport type MigrationData = {\n batch?: number\n id?: string\n name: string\n}\n\nexport type PaginatedDocs<T = any> = {\n docs: T[]\n hasNextPage: boolean\n hasPrevPage: boolean\n limit: number\n nextPage?: null | number | undefined\n page?: number\n pagingCounter: number\n prevPage?: null | number | undefined\n totalDocs: number\n totalPages: number\n}\n\nexport type DatabaseAdapterResult<T = BaseDatabaseAdapter> = {\n defaultIDType: 'number' | 'text'\n init: (args: { payload: Payload }) => T\n}\n\nexport type DBIdentifierName =\n | ((Args: {\n /** The name of the parent table when using relational DBs */\n tableName?: string\n }) => string)\n | string\n\nexport type MigrationTemplateArgs = {\n downSQL?: string\n imports?: string\n packageName?: string\n upSQL?: string\n}\n"],"names":[],"mappings":"AAwbA,WAKC"}
1
+ {"version":3,"sources":["../../src/database/types.ts"],"sourcesContent":["import type { TypeWithID } from '../collections/config/types.js'\nimport type { Document, Payload, PayloadRequest, Where } from '../types/index.js'\nimport type { TypeWithVersion } from '../versions/types.js'\n\nexport type { TypeWithVersion }\n\nexport interface BaseDatabaseAdapter {\n /**\n * Start a transaction, requiring commitTransaction() to be called for any changes to be made.\n * @returns an identifier for the transaction or null if one cannot be established\n */\n beginTransaction?: BeginTransaction\n /**\n * Persist the changes made since the start of the transaction.\n */\n commitTransaction?: CommitTransaction\n\n /**\n * Open the connection to the database\n */\n connect?: Connect\n\n count: Count\n\n create: Create\n\n createGlobal: CreateGlobal\n\n createGlobalVersion: CreateGlobalVersion\n /**\n * Output a migration file\n */\n createMigration: CreateMigration\n\n createVersion: CreateVersion\n\n /**\n * Specify if the ID is a text or number field by default within this database adapter.\n */\n defaultIDType: 'number' | 'text'\n\n deleteMany: DeleteMany\n\n deleteOne: DeleteOne\n\n deleteVersions: DeleteVersions\n /**\n * Terminate the connection with the database\n */\n destroy?: Destroy\n\n find: <T = TypeWithID>(args: FindArgs) => Promise<PaginatedDocs<T>>\n\n findGlobal: FindGlobal\n\n findGlobalVersions: FindGlobalVersions\n\n findOne: FindOne\n\n findVersions: FindVersions\n\n /**\n * Perform startup tasks required to interact with the database such as building Schema and models\n */\n init?: Init\n\n /**\n * Run any migration up functions that have not yet been performed and update the status\n */\n migrate: (args?: { migrations?: Migration[] }) => Promise<void>\n\n /**\n * Run any migration down functions that have been performed\n */\n migrateDown: () => Promise<void>\n\n /**\n * Drop the current database and run all migrate up functions\n */\n migrateFresh: (args: { forceAcceptWarning?: boolean }) => Promise<void>\n\n /**\n * Run all migration down functions before running up\n */\n migrateRefresh: () => Promise<void>\n /**\n * Run all migrate down functions\n */\n migrateReset: () => Promise<void>\n\n /**\n * Read the current state of migrations and output the result to show which have been run\n */\n migrateStatus: () => Promise<void>\n /**\n * Path to read and write migration files from\n */\n migrationDir: string\n /**\n * The name of the database adapter\n */\n name: string\n /**\n * Full package name of the database adapter\n *\n * @example @payloadcms/db-postgres\n */\n packageName: string\n\n /**\n * reference to the instance of payload\n */\n payload: Payload\n\n queryDrafts: QueryDrafts\n /**\n * Abort any changes since the start of the transaction.\n */\n rollbackTransaction?: RollbackTransaction\n /**\n * A key-value store of all sessions open (used for transactions)\n */\n sessions?: {\n [id: string]: {\n db: unknown\n reject: () => Promise<void>\n resolve: () => Promise<void>\n }\n }\n\n updateGlobal: UpdateGlobal\n\n updateGlobalVersion: UpdateGlobalVersion\n\n updateOne: UpdateOne\n\n updateVersion: UpdateVersion\n}\n\nexport type Init = () => Promise<void> | void\n\ntype ConnectArgs = {\n hotReload: boolean\n}\n\nexport type Connect = (args?: ConnectArgs) => Promise<void>\n\nexport type Destroy = () => Promise<void>\n\nexport type CreateMigration = (args: {\n file?: string\n /**\n * Skips the prompt asking to create empty migrations\n */\n forceAcceptWarning?: boolean\n migrationName?: string\n payload: Payload\n}) => Promise<void> | void\n\nexport type Transaction = (\n callback: () => Promise<void>,\n options?: Record<string, unknown>,\n) => Promise<void>\n\nexport type BeginTransaction = (\n options?: Record<string, unknown>,\n) => Promise<null | number | string>\n\nexport type RollbackTransaction = (id: number | Promise<number | string> | string) => Promise<void>\n\nexport type CommitTransaction = (id: number | Promise<number | string> | string) => Promise<void>\n\nexport type QueryDraftsArgs = {\n collection: string\n limit?: number\n locale?: string\n page?: number\n pagination?: boolean\n req: PayloadRequest\n sort?: string\n where?: Where\n}\n\nexport type QueryDrafts = <T = TypeWithID>(args: QueryDraftsArgs) => Promise<PaginatedDocs<T>>\n\nexport type FindOneArgs = {\n collection: string\n locale?: string\n req: PayloadRequest\n where?: Where\n}\n\nexport type FindOne = <T extends TypeWithID>(args: FindOneArgs) => Promise<null | T>\n\nexport type FindArgs = {\n collection: string\n /** Setting limit to 1 is equal to the previous Model.findOne(). Setting limit to 0 disables the limit */\n limit?: number\n locale?: string\n page?: number\n pagination?: boolean\n req: PayloadRequest\n skip?: number\n sort?: string\n versions?: boolean\n where?: Where\n}\n\nexport type Find = <T = TypeWithID>(args: FindArgs) => Promise<PaginatedDocs<T>>\n\nexport type CountArgs = {\n collection: string\n locale?: string\n req: PayloadRequest\n where?: Where\n}\n\nexport type Count = (args: CountArgs) => Promise<{ totalDocs: number }>\n\ntype BaseVersionArgs = {\n limit?: number\n locale?: string\n page?: number\n pagination?: boolean\n req: PayloadRequest\n skip?: number\n sort?: string\n versions?: boolean\n where?: Where\n}\n\nexport type FindVersionsArgs = {\n collection: string\n} & BaseVersionArgs\n\nexport type FindVersions = <T = TypeWithID>(\n args: FindVersionsArgs,\n) => Promise<PaginatedDocs<TypeWithVersion<T>>>\n\nexport type FindGlobalVersionsArgs = {\n global: string\n} & BaseVersionArgs\n\nexport type FindGlobalArgs = {\n locale?: string\n req: PayloadRequest\n slug: string\n where?: Where\n}\n\nexport type UpdateGlobalVersionArgs<T = TypeWithID> = {\n global: string\n locale?: string\n req: PayloadRequest\n versionData: T\n} & (\n | {\n id: number | string\n where?: never\n }\n | {\n id?: never\n where: Where\n }\n)\n\nexport type UpdateGlobalVersion = <T extends TypeWithID = TypeWithID>(\n args: UpdateGlobalVersionArgs<T>,\n) => Promise<TypeWithVersion<T>>\n\nexport type FindGlobal = <T extends Record<string, unknown> = any>(\n args: FindGlobalArgs,\n) => Promise<T>\n\nexport type CreateGlobalArgs<T extends Record<string, unknown> = any> = {\n data: T\n req: PayloadRequest\n slug: string\n}\nexport type CreateGlobal = <T extends Record<string, unknown> = any>(\n args: CreateGlobalArgs<T>,\n) => Promise<T>\n\nexport type UpdateGlobalArgs<T extends Record<string, unknown> = any> = {\n data: T\n req: PayloadRequest\n slug: string\n}\nexport type UpdateGlobal = <T extends Record<string, unknown> = any>(\n args: UpdateGlobalArgs<T>,\n) => Promise<T>\n// export type UpdateOne = (args: UpdateOneArgs) => Promise<Document>\n\nexport type FindGlobalVersions = <T = TypeWithID>(\n args: FindGlobalVersionsArgs,\n) => Promise<PaginatedDocs<TypeWithVersion<T>>>\n\nexport type DeleteVersionsArgs = {\n collection: string\n locale?: string\n req: PayloadRequest\n sort?: {\n [key: string]: string\n }\n where: Where\n}\n\nexport type CreateVersionArgs<T = TypeWithID> = {\n autosave: boolean\n collectionSlug: string\n createdAt: string\n /** ID of the parent document for which the version should be created for */\n parent: number | string\n req: PayloadRequest\n updatedAt: string\n versionData: T\n}\n\nexport type CreateVersion = <T extends TypeWithID = TypeWithID>(\n args: CreateVersionArgs<T>,\n) => Promise<TypeWithVersion<T>>\n\nexport type CreateGlobalVersionArgs<T = TypeWithID> = {\n autosave: boolean\n createdAt: string\n globalSlug: string\n /** ID of the parent document for which the version should be created for */\n parent: number | string\n req: PayloadRequest\n updatedAt: string\n versionData: T\n}\n\nexport type CreateGlobalVersion = <T extends TypeWithID = TypeWithID>(\n args: CreateGlobalVersionArgs<T>,\n) => Promise<TypeWithVersion<T>>\n\nexport type DeleteVersions = (args: DeleteVersionsArgs) => Promise<void>\n\nexport type UpdateVersionArgs<T = TypeWithID> = {\n collection: string\n locale?: string\n req: PayloadRequest\n versionData: T\n} & (\n | {\n id: number | string\n where?: never\n }\n | {\n id?: never\n where: Where\n }\n)\n\nexport type UpdateVersion = <T extends TypeWithID = TypeWithID>(\n args: UpdateVersionArgs<T>,\n) => Promise<TypeWithVersion<T>>\n\nexport type CreateArgs = {\n collection: string\n data: Record<string, unknown>\n draft?: boolean\n locale?: string\n req: PayloadRequest\n}\n\nexport type Create = (args: CreateArgs) => Promise<Document>\n\nexport type UpdateOneArgs = {\n collection: string\n data: Record<string, unknown>\n draft?: boolean\n locale?: string\n req: PayloadRequest\n} & (\n | {\n id: number | string\n where?: never\n }\n | {\n id?: never\n where: Where\n }\n)\n\nexport type UpdateOne = (args: UpdateOneArgs) => Promise<Document>\n\nexport type DeleteOneArgs = {\n collection: string\n req: PayloadRequest\n where: Where\n}\n\nexport type DeleteOne = (args: DeleteOneArgs) => Promise<Document>\n\nexport type DeleteManyArgs = {\n collection: string\n req: PayloadRequest\n where: Where\n}\n\nexport type DeleteMany = (args: DeleteManyArgs) => Promise<void>\n\nexport type Migration = {\n down: (args: unknown) => Promise<void>\n up: (args: unknown) => Promise<void>\n} & MigrationData\n\nexport type MigrationData = {\n batch?: number\n id?: string\n name: string\n}\n\nexport type PaginatedDocs<T = any> = {\n docs: T[]\n hasNextPage: boolean\n hasPrevPage: boolean\n limit: number\n nextPage?: null | number | undefined\n page?: number\n pagingCounter: number\n prevPage?: null | number | undefined\n totalDocs: number\n totalPages: number\n}\n\nexport type DatabaseAdapterResult<T = BaseDatabaseAdapter> = {\n defaultIDType: 'number' | 'text'\n init: (args: { payload: Payload }) => T\n}\n\nexport type DBIdentifierName =\n | ((Args: {\n /** The name of the parent table when using relational DBs */\n tableName?: string\n }) => string)\n | string\n\nexport type MigrationTemplateArgs = {\n downSQL?: string\n imports?: string\n packageName?: string\n upSQL?: string\n}\n"],"names":[],"mappings":"AAwbA,WAKC"}
@@ -6,6 +6,7 @@ type Args = {
6
6
  config: Config;
7
7
  existingFieldNames?: Set<string>;
8
8
  fields: Field[];
9
+ parentIsLocalized: boolean;
9
10
  /**
10
11
  * If true, a richText field will require an editor property to be set, as the sanitizeFields function will not add it from the payload config if not present.
11
12
  *
@@ -23,6 +24,6 @@ type Args = {
23
24
  */
24
25
  validRelationships: null | string[];
25
26
  };
26
- export declare const sanitizeFields: ({ collectionConfig, config, existingFieldNames, fields, requireFieldLevelRichTextEditor, richTextSanitizationPromises, validRelationships, }: Args) => Promise<Field[]>;
27
+ export declare const sanitizeFields: ({ collectionConfig, config, existingFieldNames, fields, parentIsLocalized, requireFieldLevelRichTextEditor, richTextSanitizationPromises, validRelationships, }: Args) => Promise<Field[]>;
27
28
  export {};
28
29
  //# sourceMappingURL=sanitize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../../src/fields/config/sanitize.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAgBvC,KAAK,IAAI,GAAG;IACV,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,kBAAkB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAChC,MAAM,EAAE,KAAK,EAAE,CAAA;IACf;;;;OAIG;IACH,+BAA+B,CAAC,EAAE,OAAO,CAAA;IACzC;;;OAGG;IACH,4BAA4B,CAAC,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;IAEhF;;;OAGG;IACH,kBAAkB,EAAE,IAAI,GAAG,MAAM,EAAE,CAAA;CACpC,CAAA;AAED,eAAO,MAAM,cAAc,iJAQxB,IAAI,KAAG,OAAO,CAAC,KAAK,EAAE,CAoMxB,CAAA"}
1
+ {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../../src/fields/config/sanitize.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAgBvC,KAAK,IAAI,GAAG;IACV,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,kBAAkB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAChC,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,iBAAiB,EAAE,OAAO,CAAA;IAC1B;;;;OAIG;IACH,+BAA+B,CAAC,EAAE,OAAO,CAAA;IAEzC;;;OAGG;IACH,4BAA4B,CAAC,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;IAChF;;;OAGG;IACH,kBAAkB,EAAE,IAAI,GAAG,MAAM,EAAE,CAAA;CACpC,CAAA;AAED,eAAO,MAAM,cAAc,oKASxB,IAAI,KAAG,OAAO,CAAC,KAAK,EAAE,CA0NxB,CAAA"}
@@ -1,20 +1,24 @@
1
1
  import { deepMergeSimple } from '@payloadcms/translations/utilities';
2
- import { MissingEditorProp } from '../../errors/MissingEditorProp.js';
3
2
  import { DuplicateFieldName, InvalidFieldName, InvalidFieldRelationship, MissingFieldType } from '../../errors/index.js';
3
+ import { MissingEditorProp } from '../../errors/MissingEditorProp.js';
4
4
  import { formatLabels, toWords } from '../../utilities/formatLabels.js';
5
5
  import { baseBlockFields } from '../baseFields/baseBlockFields.js';
6
6
  import { baseIDField } from '../baseFields/baseIDField.js';
7
7
  import { setDefaultBeforeDuplicate } from '../setDefaultBeforeDuplicate.js';
8
8
  import validations from '../validations.js';
9
9
  import { fieldAffectsData, tabHasName } from './types.js';
10
- export const sanitizeFields = async ({ collectionConfig, config, existingFieldNames = new Set(), fields, requireFieldLevelRichTextEditor = false, richTextSanitizationPromises, validRelationships })=>{
11
- if (!fields) return [];
10
+ export const sanitizeFields = async ({ collectionConfig, config, existingFieldNames = new Set(), fields, parentIsLocalized, requireFieldLevelRichTextEditor = false, richTextSanitizationPromises, validRelationships })=>{
11
+ if (!fields) {
12
+ return [];
13
+ }
12
14
  for(let i = 0; i < fields.length; i++){
13
15
  const field = fields[i];
14
16
  if ('_sanitized' in field && field._sanitized === true) {
15
17
  continue;
16
18
  }
17
- if (!field.type) throw new MissingFieldType(field);
19
+ if (!field.type) {
20
+ throw new MissingFieldType(field);
21
+ }
18
22
  // assert that field names do not contain forbidden characters
19
23
  if (fieldAffectsData(field) && field.name.includes('.')) {
20
24
  throw new InvalidFieldName(field, field.name);
@@ -69,7 +73,15 @@ export const sanitizeFields = async ({ collectionConfig, config, existingFieldNa
69
73
  ].includes(field.name)) {
70
74
  existingFieldNames.add(field.name);
71
75
  }
72
- if (field.localized && !config.localization) delete field.localized;
76
+ if (typeof field.localized !== 'undefined') {
77
+ let shouldDisableLocalized = !config.localization;
78
+ if (!config.compatibility?.allowLocalizedWithinLocalized && parentIsLocalized) {
79
+ shouldDisableLocalized = true;
80
+ }
81
+ if (shouldDisableLocalized) {
82
+ delete field.localized;
83
+ }
84
+ }
73
85
  if (typeof field.validate === 'undefined') {
74
86
  const defaultValidate = validations[field.type];
75
87
  if (defaultValidate) {
@@ -81,8 +93,12 @@ export const sanitizeFields = async ({ collectionConfig, config, existingFieldNa
81
93
  field.validate = ()=>true;
82
94
  }
83
95
  }
84
- if (!field.hooks) field.hooks = {};
85
- if (!field.access) field.access = {};
96
+ if (!field.hooks) {
97
+ field.hooks = {};
98
+ }
99
+ if (!field.access) {
100
+ field.access = {};
101
+ }
86
102
  setDefaultBeforeDuplicate(field);
87
103
  }
88
104
  if (!field.admin) {
@@ -103,7 +119,8 @@ export const sanitizeFields = async ({ collectionConfig, config, existingFieldNa
103
119
  if (typeof field.editor === 'function') {
104
120
  field.editor = await field.editor({
105
121
  config: _config,
106
- isRoot: requireFieldLevelRichTextEditor
122
+ isRoot: requireFieldLevelRichTextEditor,
123
+ parentIsLocalized: parentIsLocalized || field.localized
107
124
  });
108
125
  }
109
126
  if (field.editor.i18n && Object.keys(field.editor.i18n).length >= 0) {
@@ -128,6 +145,7 @@ export const sanitizeFields = async ({ collectionConfig, config, existingFieldNa
128
145
  config,
129
146
  existingFieldNames: new Set(),
130
147
  fields: block.fields,
148
+ parentIsLocalized: parentIsLocalized || field.localized,
131
149
  requireFieldLevelRichTextEditor,
132
150
  richTextSanitizationPromises,
133
151
  validRelationships
@@ -139,6 +157,7 @@ export const sanitizeFields = async ({ collectionConfig, config, existingFieldNa
139
157
  config,
140
158
  existingFieldNames: fieldAffectsData(field) ? new Set() : existingFieldNames,
141
159
  fields: field.fields,
160
+ parentIsLocalized: parentIsLocalized || field.localized,
142
161
  requireFieldLevelRichTextEditor,
143
162
  richTextSanitizationPromises,
144
163
  validRelationships
@@ -154,6 +173,7 @@ export const sanitizeFields = async ({ collectionConfig, config, existingFieldNa
154
173
  config,
155
174
  existingFieldNames: tabHasName(tab) ? new Set() : existingFieldNames,
156
175
  fields: tab.fields,
176
+ parentIsLocalized: parentIsLocalized || tabHasName(tab) && tab.localized,
157
177
  requireFieldLevelRichTextEditor,
158
178
  richTextSanitizationPromises,
159
179
  validRelationships