payload 3.80.0-internal-debug.cd99b1f → 3.80.0-internal.21e9c47

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 (259) hide show
  1. package/dist/admin/elements/Nav.d.ts +10 -0
  2. package/dist/admin/elements/Nav.d.ts.map +1 -1
  3. package/dist/admin/elements/Nav.js.map +1 -1
  4. package/dist/admin/functions/index.d.ts +1 -38
  5. package/dist/admin/functions/index.d.ts.map +1 -1
  6. package/dist/admin/functions/index.js.map +1 -1
  7. package/dist/admin/types.d.ts +5 -4
  8. package/dist/admin/types.d.ts.map +1 -1
  9. package/dist/admin/types.js.map +1 -1
  10. package/dist/admin/views/hierarchyList.d.ts +9 -0
  11. package/dist/admin/views/hierarchyList.d.ts.map +1 -0
  12. package/dist/admin/views/hierarchyList.js +3 -0
  13. package/dist/admin/views/hierarchyList.js.map +1 -0
  14. package/dist/admin/views/index.d.ts +1 -3
  15. package/dist/admin/views/index.d.ts.map +1 -1
  16. package/dist/admin/views/index.js.map +1 -1
  17. package/dist/admin/views/list.d.ts +37 -1
  18. package/dist/admin/views/list.d.ts.map +1 -1
  19. package/dist/admin/views/list.js.map +1 -1
  20. package/dist/auth/operations/me.js +5 -5
  21. package/dist/auth/operations/me.js.map +1 -1
  22. package/dist/bin/generateImportMap/iterateCollections.d.ts.map +1 -1
  23. package/dist/bin/generateImportMap/iterateCollections.js +1 -0
  24. package/dist/bin/generateImportMap/iterateCollections.js.map +1 -1
  25. package/dist/bin/generateImportMap/iterateConfig.d.ts.map +1 -1
  26. package/dist/bin/generateImportMap/iterateConfig.js +7 -0
  27. package/dist/bin/generateImportMap/iterateConfig.js.map +1 -1
  28. package/dist/collections/config/client.d.ts +3 -1
  29. package/dist/collections/config/client.d.ts.map +1 -1
  30. package/dist/collections/config/client.js +11 -0
  31. package/dist/collections/config/client.js.map +1 -1
  32. package/dist/collections/config/defaults.js +1 -1
  33. package/dist/collections/config/defaults.js.map +1 -1
  34. package/dist/collections/config/sanitize.d.ts.map +1 -1
  35. package/dist/collections/config/sanitize.js +3 -7
  36. package/dist/collections/config/sanitize.js.map +1 -1
  37. package/dist/collections/config/types.d.ts +29 -7
  38. package/dist/collections/config/types.d.ts.map +1 -1
  39. package/dist/collections/config/types.js.map +1 -1
  40. package/dist/collections/operations/create.js +17 -17
  41. package/dist/collections/operations/create.js.map +1 -1
  42. package/dist/collections/operations/findByID.js +3 -3
  43. package/dist/collections/operations/findByID.js.map +1 -1
  44. package/dist/collections/operations/utilities/update.d.ts.map +1 -1
  45. package/dist/collections/operations/utilities/update.js +5 -4
  46. package/dist/collections/operations/utilities/update.js.map +1 -1
  47. package/dist/config/client.d.ts.map +1 -1
  48. package/dist/config/client.js +0 -10
  49. package/dist/config/client.js.map +1 -1
  50. package/dist/config/defaults.d.ts.map +1 -1
  51. package/dist/config/defaults.js +0 -15
  52. package/dist/config/defaults.js.map +1 -1
  53. package/dist/config/sanitize.d.ts.map +1 -1
  54. package/dist/config/sanitize.js +3 -26
  55. package/dist/config/sanitize.js.map +1 -1
  56. package/dist/config/types.d.ts +26 -12
  57. package/dist/config/types.d.ts.map +1 -1
  58. package/dist/config/types.js.map +1 -1
  59. package/dist/exports/shared.d.ts +2 -3
  60. package/dist/exports/shared.d.ts.map +1 -1
  61. package/dist/exports/shared.js +1 -2
  62. package/dist/exports/shared.js.map +1 -1
  63. package/dist/fields/config/sanitize.d.ts.map +1 -1
  64. package/dist/fields/config/sanitize.js +4 -0
  65. package/dist/fields/config/sanitize.js.map +1 -1
  66. package/dist/fields/config/sanitizeJoinField.d.ts.map +1 -1
  67. package/dist/fields/config/sanitizeJoinField.js +3 -0
  68. package/dist/fields/config/sanitizeJoinField.js.map +1 -1
  69. package/dist/globals/config/types.d.ts +4 -0
  70. package/dist/globals/config/types.d.ts.map +1 -1
  71. package/dist/globals/config/types.js.map +1 -1
  72. package/dist/hierarchy/addHierarchyToCollection.d.ts +8 -0
  73. package/dist/hierarchy/addHierarchyToCollection.d.ts.map +1 -0
  74. package/dist/hierarchy/addHierarchyToCollection.js +62 -0
  75. package/dist/hierarchy/addHierarchyToCollection.js.map +1 -0
  76. package/dist/hierarchy/buildParentField.d.ts +11 -0
  77. package/dist/hierarchy/buildParentField.d.ts.map +1 -0
  78. package/dist/hierarchy/buildParentField.js +42 -0
  79. package/dist/hierarchy/buildParentField.js.map +1 -0
  80. package/dist/hierarchy/constants.d.ts +15 -0
  81. package/dist/hierarchy/constants.d.ts.map +1 -0
  82. package/dist/hierarchy/constants.js +11 -0
  83. package/dist/hierarchy/constants.js.map +1 -0
  84. package/dist/hierarchy/createFolderField.d.ts +39 -0
  85. package/dist/hierarchy/createFolderField.d.ts.map +1 -0
  86. package/dist/hierarchy/createFolderField.js +54 -0
  87. package/dist/hierarchy/createFolderField.js.map +1 -0
  88. package/dist/hierarchy/createFoldersCollection.d.ts +57 -0
  89. package/dist/hierarchy/createFoldersCollection.d.ts.map +1 -0
  90. package/dist/hierarchy/createFoldersCollection.js +63 -0
  91. package/dist/hierarchy/createFoldersCollection.js.map +1 -0
  92. package/dist/hierarchy/createTagField.d.ts +44 -0
  93. package/dist/hierarchy/createTagField.d.ts.map +1 -0
  94. package/dist/hierarchy/createTagField.js +48 -0
  95. package/dist/hierarchy/createTagField.js.map +1 -0
  96. package/dist/hierarchy/createTagsCollection.d.ts +54 -0
  97. package/dist/hierarchy/createTagsCollection.d.ts.map +1 -0
  98. package/dist/hierarchy/createTagsCollection.js +56 -0
  99. package/dist/hierarchy/createTagsCollection.js.map +1 -0
  100. package/dist/hierarchy/endpoints/findRelated.d.ts +7 -0
  101. package/dist/hierarchy/endpoints/findRelated.d.ts.map +1 -0
  102. package/dist/hierarchy/endpoints/findRelated.js +36 -0
  103. package/dist/hierarchy/endpoints/findRelated.js.map +1 -0
  104. package/dist/hierarchy/getInitialTreeData.d.ts +24 -0
  105. package/dist/hierarchy/getInitialTreeData.d.ts.map +1 -0
  106. package/dist/hierarchy/getInitialTreeData.js +120 -0
  107. package/dist/hierarchy/getInitialTreeData.js.map +1 -0
  108. package/dist/hierarchy/hooks/collectionAfterDelete.d.ts +14 -0
  109. package/dist/hierarchy/hooks/collectionAfterDelete.d.ts.map +1 -0
  110. package/dist/hierarchy/hooks/collectionAfterDelete.js +21 -0
  111. package/dist/hierarchy/hooks/collectionAfterDelete.js.map +1 -0
  112. package/dist/hierarchy/hooks/collectionAfterRead.d.ts +27 -0
  113. package/dist/hierarchy/hooks/collectionAfterRead.d.ts.map +1 -0
  114. package/dist/hierarchy/hooks/collectionAfterRead.js +64 -0
  115. package/dist/hierarchy/hooks/collectionAfterRead.js.map +1 -0
  116. package/dist/hierarchy/hooks/collectionBeforeChange.d.ts +19 -0
  117. package/dist/hierarchy/hooks/collectionBeforeChange.d.ts.map +1 -0
  118. package/dist/hierarchy/hooks/collectionBeforeChange.js +90 -0
  119. package/dist/hierarchy/hooks/collectionBeforeChange.js.map +1 -0
  120. package/dist/hierarchy/hooks/collectionBeforeDelete.d.ts +15 -0
  121. package/dist/hierarchy/hooks/collectionBeforeDelete.d.ts.map +1 -0
  122. package/dist/hierarchy/hooks/collectionBeforeDelete.js +20 -0
  123. package/dist/hierarchy/hooks/collectionBeforeDelete.js.map +1 -0
  124. package/dist/hierarchy/hooks/ensureSafeCollectionsChange.d.ts +8 -0
  125. package/dist/hierarchy/hooks/ensureSafeCollectionsChange.d.ts.map +1 -0
  126. package/dist/hierarchy/hooks/ensureSafeCollectionsChange.js +108 -0
  127. package/dist/hierarchy/hooks/ensureSafeCollectionsChange.js.map +1 -0
  128. package/dist/hierarchy/injectHierarchyButton.d.ts +14 -0
  129. package/dist/hierarchy/injectHierarchyButton.d.ts.map +1 -0
  130. package/dist/hierarchy/injectHierarchyButton.js +37 -0
  131. package/dist/hierarchy/injectHierarchyButton.js.map +1 -0
  132. package/dist/hierarchy/operations/findRelatedDocuments.d.ts +24 -0
  133. package/dist/hierarchy/operations/findRelatedDocuments.d.ts.map +1 -0
  134. package/dist/hierarchy/operations/findRelatedDocuments.js +73 -0
  135. package/dist/hierarchy/operations/findRelatedDocuments.js.map +1 -0
  136. package/dist/hierarchy/operations/index.d.ts +2 -0
  137. package/dist/hierarchy/operations/index.d.ts.map +1 -0
  138. package/dist/hierarchy/operations/index.js +3 -0
  139. package/dist/hierarchy/operations/index.js.map +1 -0
  140. package/dist/hierarchy/resolveHierarchyCollections.d.ts +23 -0
  141. package/dist/hierarchy/resolveHierarchyCollections.d.ts.map +1 -0
  142. package/dist/hierarchy/resolveHierarchyCollections.js +312 -0
  143. package/dist/hierarchy/resolveHierarchyCollections.js.map +1 -0
  144. package/dist/hierarchy/sanitizeHierarchyCollection.d.ts +14 -0
  145. package/dist/hierarchy/sanitizeHierarchyCollection.d.ts.map +1 -0
  146. package/dist/hierarchy/sanitizeHierarchyCollection.js +125 -0
  147. package/dist/hierarchy/sanitizeHierarchyCollection.js.map +1 -0
  148. package/dist/hierarchy/types.d.ts +137 -0
  149. package/dist/hierarchy/types.d.ts.map +1 -0
  150. package/dist/hierarchy/types.js +6 -0
  151. package/dist/hierarchy/types.js.map +1 -0
  152. package/dist/hierarchy/utils/buildLocalizedHierarchyPaths.d.ts +71 -0
  153. package/dist/hierarchy/utils/buildLocalizedHierarchyPaths.d.ts.map +1 -0
  154. package/dist/hierarchy/utils/buildLocalizedHierarchyPaths.js +65 -0
  155. package/dist/hierarchy/utils/buildLocalizedHierarchyPaths.js.map +1 -0
  156. package/dist/hierarchy/utils/computePaths.d.ts +31 -0
  157. package/dist/hierarchy/utils/computePaths.d.ts.map +1 -0
  158. package/dist/hierarchy/utils/computePaths.js +371 -0
  159. package/dist/hierarchy/utils/computePaths.js.map +1 -0
  160. package/dist/hierarchy/utils/findUseAsTitle.d.ts +6 -0
  161. package/dist/hierarchy/utils/findUseAsTitle.d.ts.map +1 -0
  162. package/dist/hierarchy/utils/findUseAsTitle.js +72 -0
  163. package/dist/hierarchy/utils/findUseAsTitle.js.map +1 -0
  164. package/dist/hierarchy/utils/getAncestors.d.ts +34 -0
  165. package/dist/hierarchy/utils/getAncestors.d.ts.map +1 -0
  166. package/dist/hierarchy/utils/getAncestors.js +94 -0
  167. package/dist/hierarchy/utils/getAncestors.js.map +1 -0
  168. package/dist/hierarchy/utils/getLocalizedValue.d.ts +30 -0
  169. package/dist/hierarchy/utils/getLocalizedValue.d.ts.map +1 -0
  170. package/dist/hierarchy/utils/getLocalizedValue.js +46 -0
  171. package/dist/hierarchy/utils/getLocalizedValue.js.map +1 -0
  172. package/dist/hierarchy/utils/getLocalizedValue.spec.js +250 -0
  173. package/dist/hierarchy/utils/getLocalizedValue.spec.js.map +1 -0
  174. package/dist/index.bundled.d.ts +567 -280
  175. package/dist/index.d.ts +23 -9
  176. package/dist/index.d.ts.map +1 -1
  177. package/dist/index.js +13 -5
  178. package/dist/index.js.map +1 -1
  179. package/dist/preferences/keys.d.ts +8 -4
  180. package/dist/preferences/keys.d.ts.map +1 -1
  181. package/dist/preferences/keys.js +7 -4
  182. package/dist/preferences/keys.js.map +1 -1
  183. package/dist/types/index.d.ts +1 -0
  184. package/dist/types/index.d.ts.map +1 -1
  185. package/dist/types/index.js.map +1 -1
  186. package/dist/utilities/extractID.js +1 -1
  187. package/dist/utilities/extractID.js.map +1 -1
  188. package/dist/utilities/formatAdminURL.d.ts +13 -2
  189. package/dist/utilities/formatAdminURL.d.ts.map +1 -1
  190. package/dist/utilities/formatAdminURL.js.map +1 -1
  191. package/package.json +2 -2
  192. package/dist/admin/views/folderList.d.ts +0 -56
  193. package/dist/admin/views/folderList.d.ts.map +0 -1
  194. package/dist/admin/views/folderList.js +0 -3
  195. package/dist/admin/views/folderList.js.map +0 -1
  196. package/dist/folders/addFolderCollection.d.ts +0 -10
  197. package/dist/folders/addFolderCollection.d.ts.map +0 -1
  198. package/dist/folders/addFolderCollection.js +0 -26
  199. package/dist/folders/addFolderCollection.js.map +0 -1
  200. package/dist/folders/addFolderFieldToCollection.d.ts +0 -8
  201. package/dist/folders/addFolderFieldToCollection.d.ts.map +0 -1
  202. package/dist/folders/addFolderFieldToCollection.js +0 -20
  203. package/dist/folders/addFolderFieldToCollection.js.map +0 -1
  204. package/dist/folders/buildFolderField.d.ts +0 -8
  205. package/dist/folders/buildFolderField.d.ts.map +0 -1
  206. package/dist/folders/buildFolderField.js +0 -87
  207. package/dist/folders/buildFolderField.js.map +0 -1
  208. package/dist/folders/constants.d.ts +0 -3
  209. package/dist/folders/constants.d.ts.map +0 -1
  210. package/dist/folders/constants.js +0 -4
  211. package/dist/folders/constants.js.map +0 -1
  212. package/dist/folders/createFolderCollection.d.ts +0 -11
  213. package/dist/folders/createFolderCollection.d.ts.map +0 -1
  214. package/dist/folders/createFolderCollection.js +0 -115
  215. package/dist/folders/createFolderCollection.js.map +0 -1
  216. package/dist/folders/hooks/deleteSubfoldersAfterDelete.d.ts +0 -8
  217. package/dist/folders/hooks/deleteSubfoldersAfterDelete.d.ts.map +0 -1
  218. package/dist/folders/hooks/deleteSubfoldersAfterDelete.js +0 -15
  219. package/dist/folders/hooks/deleteSubfoldersAfterDelete.js.map +0 -1
  220. package/dist/folders/hooks/dissasociateAfterDelete.d.ts +0 -8
  221. package/dist/folders/hooks/dissasociateAfterDelete.d.ts.map +0 -1
  222. package/dist/folders/hooks/dissasociateAfterDelete.js +0 -20
  223. package/dist/folders/hooks/dissasociateAfterDelete.js.map +0 -1
  224. package/dist/folders/hooks/ensureSafeCollectionsChange.d.ts +0 -5
  225. package/dist/folders/hooks/ensureSafeCollectionsChange.d.ts.map +0 -1
  226. package/dist/folders/hooks/ensureSafeCollectionsChange.js +0 -107
  227. package/dist/folders/hooks/ensureSafeCollectionsChange.js.map +0 -1
  228. package/dist/folders/hooks/reparentChildFolder.d.ts +0 -24
  229. package/dist/folders/hooks/reparentChildFolder.d.ts.map +0 -1
  230. package/dist/folders/hooks/reparentChildFolder.js +0 -72
  231. package/dist/folders/hooks/reparentChildFolder.js.map +0 -1
  232. package/dist/folders/types.d.ts +0 -118
  233. package/dist/folders/types.d.ts.map +0 -1
  234. package/dist/folders/types.js +0 -3
  235. package/dist/folders/types.js.map +0 -1
  236. package/dist/folders/utils/buildFolderWhereConstraints.d.ts +0 -13
  237. package/dist/folders/utils/buildFolderWhereConstraints.d.ts.map +0 -1
  238. package/dist/folders/utils/buildFolderWhereConstraints.js +0 -45
  239. package/dist/folders/utils/buildFolderWhereConstraints.js.map +0 -1
  240. package/dist/folders/utils/formatFolderOrDocumentItem.d.ts +0 -12
  241. package/dist/folders/utils/formatFolderOrDocumentItem.d.ts.map +0 -1
  242. package/dist/folders/utils/formatFolderOrDocumentItem.js +0 -30
  243. package/dist/folders/utils/formatFolderOrDocumentItem.js.map +0 -1
  244. package/dist/folders/utils/getFolderBreadcrumbs.d.ts +0 -14
  245. package/dist/folders/utils/getFolderBreadcrumbs.d.ts.map +0 -1
  246. package/dist/folders/utils/getFolderBreadcrumbs.js +0 -45
  247. package/dist/folders/utils/getFolderBreadcrumbs.js.map +0 -1
  248. package/dist/folders/utils/getFolderData.d.ts +0 -33
  249. package/dist/folders/utils/getFolderData.d.ts.map +0 -1
  250. package/dist/folders/utils/getFolderData.js +0 -88
  251. package/dist/folders/utils/getFolderData.js.map +0 -1
  252. package/dist/folders/utils/getFoldersAndDocumentsFromJoin.d.ts +0 -24
  253. package/dist/folders/utils/getFoldersAndDocumentsFromJoin.d.ts.map +0 -1
  254. package/dist/folders/utils/getFoldersAndDocumentsFromJoin.js +0 -66
  255. package/dist/folders/utils/getFoldersAndDocumentsFromJoin.js.map +0 -1
  256. package/dist/folders/utils/getOrphanedDocs.d.ts +0 -15
  257. package/dist/folders/utils/getOrphanedDocs.d.ts.map +0 -1
  258. package/dist/folders/utils/getOrphanedDocs.js +0 -40
  259. package/dist/folders/utils/getOrphanedDocs.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["import type { I18n, TFunction } from '@payloadcms/translations'\nimport type DataLoader from 'dataloader'\nimport type { OptionalKeys, RequiredKeys } from 'ts-essentials'\nimport type { URL } from 'url'\n\nimport type {\n DataFromCollectionSlug,\n QueryDraftDataFromCollectionSlug,\n TypeWithID,\n TypeWithTimestamps,\n} from '../collections/config/types.js'\nimport type payload from '../index.js'\nimport type {\n CollectionSlug,\n DataFromGlobalSlug,\n GlobalSlug,\n Payload,\n RequestContext,\n TypedCollectionJoins,\n TypedCollectionSelect,\n TypedFallbackLocale,\n TypedLocale,\n TypedUser,\n} from '../index.js'\nimport type { Operator } from './constants.js'\nexport type { Payload } from '../index.js'\n\nexport type CustomPayloadRequestProperties = {\n context: RequestContext\n /** The locale that should be used for a field when it is not translated to the requested locale */\n fallbackLocale?: TypedFallbackLocale\n i18n: I18n\n /**\n * The requested locale if specified\n * Only available for localized collections\n *\n * Suppressing warning below as it is a valid use case - won't be an issue if generated types exist\n */\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n locale?: 'all' | TypedLocale\n /**\n * The payload object\n */\n payload: typeof payload\n /**\n * The context in which the request is being made\n */\n payloadAPI: 'GraphQL' | 'local' | 'REST'\n /** Optimized document loader */\n payloadDataLoader: {\n /**\n * Wraps `payload.find` with a cache to deduplicate requests\n * @experimental This is may be replaced by a more robust cache strategy in future versions\n * By calling this method with the same arguments many times in one request, it will only be handled one time\n * const result = await req.payloadDataLoader.find({\n * collection,\n * req,\n * where: findWhere,\n * })\n */\n find: Payload['find']\n } & DataLoader<string, TypeWithID>\n /** Resized versions of the image that was uploaded during this request */\n payloadUploadSizes?: Record<string, Buffer>\n /** Query params on the request */\n query: Record<string, unknown>\n /** Any response headers that are required to be set when a response is sent */\n responseHeaders?: Headers\n /** The route parameters\n * @example\n * /:collection/:id -> /posts/123\n * { collection: 'posts', id: '123' }\n */\n routeParams?: Record<string, unknown>\n /** Translate function - duplicate of i18n.t */\n t: TFunction\n /**\n * Identifier for the database transaction for interactions in a single, all-or-nothing operation.\n * Can also be used to ensure consistency when multiple operations try to create a transaction concurrently on the same request.\n */\n transactionID?: number | Promise<number | string> | string\n /**\n * Used to ensure consistency when multiple operations try to create a transaction concurrently on the same request\n * @deprecated This is not used anywhere, instead `transactionID` is used for the above. Will be removed in next major version.\n */\n transactionIDPromise?: Promise<void>\n /** The signed-in user */\n user: null | TypedUser\n} & Pick<\n URL,\n 'hash' | 'host' | 'href' | 'origin' | 'pathname' | 'port' | 'protocol' | 'search' | 'searchParams'\n>\ntype PayloadRequestData = {\n /**\n * Data from the request body\n *\n * Within Payload operations, i.e. hooks, data will be there\n * BUT in custom endpoints it will not be, you will need to\n * use either:\n * 1. `const data = await req.json()`\n *\n * 2. import { addDataAndFileToRequest } from 'payload'\n * `await addDataAndFileToRequest(req)`\n *\n * You should not expect this object to be the document data. It is the request data.\n * */\n data?: JsonObject\n /** The file on the request, same rules apply as the `data` property */\n file?: {\n /**\n * Context of the file when it was uploaded via client side.\n */\n clientUploadContext?: unknown\n data: Buffer\n mimetype: string\n name: string\n size: number\n tempFilePath?: string\n }\n}\nexport interface PayloadRequest\n extends CustomPayloadRequestProperties,\n Partial<Request>,\n PayloadRequestData {\n headers: Request['headers']\n}\n\nexport type { Operator }\n\n// Makes it so things like passing new Date() will error\nexport type JsonValue = JsonArray | JsonObject | unknown //Date | JsonArray | JsonObject | boolean | null | number | string // TODO: Evaluate proper, strong type for this\n\nexport type JsonArray = Array<JsonValue>\n\nexport interface JsonObject {\n [key: string]: any\n}\n\nexport type WhereField = {\n // any json-serializable value\n [key in Operator]?: JsonValue\n}\n\nexport type Where = {\n [key: string]: Where[] | WhereField\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n and?: Where[]\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n or?: Where[]\n}\n\nexport type Sort = Array<string> | string\n\ntype SerializableValue = boolean | number | object | string\nexport type DefaultValue =\n | ((args: {\n locale?: TypedLocale\n req: PayloadRequest\n user: PayloadRequest['user']\n }) => SerializableValue)\n | SerializableValue\n\n/**\n * Applies pagination for join fields for including collection relationships\n */\nexport type JoinQuery<TSlug extends CollectionSlug = string> =\n TypedCollectionJoins[TSlug] extends Record<string, string>\n ?\n | false\n | Partial<{\n [K in keyof TypedCollectionJoins[TSlug]]:\n | {\n count?: boolean\n limit?: number\n page?: number\n sort?: string\n where?: Where\n }\n | false\n }>\n : never\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type Document = any\n\nexport type Operation = 'create' | 'delete' | 'read' | 'update'\nexport type VersionOperations = 'readVersions'\nexport type AuthOperations = 'unlock'\nexport type AllOperations = AuthOperations | Operation | VersionOperations\n\nexport function docHasTimestamps(doc: any): doc is TypeWithTimestamps {\n return doc?.createdAt && doc?.updatedAt\n}\n\nexport type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N // This is a commonly used trick to detect 'any'\nexport type IsAny<T> = IfAny<T, true, false>\nexport type ReplaceAny<T, DefaultType> = IsAny<T> extends true ? DefaultType : T\n\nexport type SelectIncludeType = {\n [k: string]: SelectIncludeType | true\n}\n\nexport type SelectExcludeType = {\n [k: string]: false | SelectExcludeType\n}\n\nexport type SelectMode = 'exclude' | 'include'\n\nexport type SelectType = SelectExcludeType | SelectIncludeType\n\nexport type ApplyDisableErrors<T, DisableErrors = false> = false extends DisableErrors\n ? T\n : null | T\n\nexport type TransformDataWithSelect<\n Data extends Record<string, any>,\n Select extends SelectType,\n> = Select extends never\n ? Data\n : string extends keyof Select\n ? Data\n : // START Handle types when they aren't generated\n // For example in any package in this repository outside of tests / plugins\n // This stil gives us autocomplete when using include select mode, i.e select: {title :true} returns type {title: any, id: string | number}\n string extends keyof Omit<Data, 'id'>\n ? Select extends SelectIncludeType\n ? {\n [K in Data extends TypeWithID ? 'id' | keyof Select : keyof Select]: K extends 'id'\n ? number | string\n : unknown\n }\n : Data\n : // END Handle types when they aren't generated\n // Handle include mode\n Select extends SelectIncludeType\n ? {\n [K in keyof Data as K extends keyof Select\n ? Select[K] extends object | true\n ? K\n : never\n : // select 'id' always\n K extends 'id'\n ? K\n : never]: Data[K]\n }\n : // Handle exclude mode\n {\n [K in keyof Data as K extends keyof Select\n ? Select[K] extends object | undefined\n ? K\n : never\n : K]: Data[K]\n }\n\nexport type TransformCollectionWithSelect<\n TSlug extends CollectionSlug,\n TSelect extends SelectType,\n> = TSelect extends SelectType\n ? TransformDataWithSelect<DataFromCollectionSlug<TSlug>, TSelect>\n : DataFromCollectionSlug<TSlug>\n\nexport type DraftTransformCollectionWithSelect<\n TSlug extends CollectionSlug,\n TSelect extends SelectType,\n> = TSelect extends SelectType\n ? TransformDataWithSelect<QueryDraftDataFromCollectionSlug<TSlug>, TSelect>\n : QueryDraftDataFromCollectionSlug<TSlug>\n\nexport type TransformGlobalWithSelect<\n TSlug extends GlobalSlug,\n TSelect extends SelectType,\n> = TSelect extends SelectType\n ? TransformDataWithSelect<DataFromGlobalSlug<TSlug>, TSelect>\n : DataFromGlobalSlug<TSlug>\n\nexport type PopulateType = Partial<TypedCollectionSelect>\n\nexport type ResolvedFilterOptions = { [collection: string]: Where }\n\nexport type PickPreserveOptional<T, K extends keyof T> = Partial<\n Pick<T, Extract<K, OptionalKeys<T>>>\n> &\n Pick<T, Extract<K, RequiredKeys<T>>>\n\nexport type MaybePromise<T> = Promise<T> | T\n"],"names":["docHasTimestamps","doc","createdAt","updatedAt"],"mappings":"AA8LA,OAAO,SAASA,iBAAiBC,GAAQ;IACvC,OAAOA,KAAKC,aAAaD,KAAKE;AAChC"}
1
+ {"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["import type { I18n, TFunction } from '@payloadcms/translations'\nimport type DataLoader from 'dataloader'\nimport type { OptionalKeys, RequiredKeys } from 'ts-essentials'\nimport type { URL } from 'url'\n\nimport type {\n DataFromCollectionSlug,\n QueryDraftDataFromCollectionSlug,\n TypeWithID,\n TypeWithTimestamps,\n} from '../collections/config/types.js'\nimport type payload from '../index.js'\nimport type {\n CollectionSlug,\n DataFromGlobalSlug,\n GlobalSlug,\n Payload,\n RequestContext,\n TypedCollectionJoins,\n TypedCollectionSelect,\n TypedFallbackLocale,\n TypedLocale,\n TypedUser,\n} from '../index.js'\nimport type { Operator } from './constants.js'\nexport type { TypeWithID } from '../collections/config/types.js'\nexport type { Payload } from '../index.js'\n\nexport type CustomPayloadRequestProperties = {\n context: RequestContext\n /** The locale that should be used for a field when it is not translated to the requested locale */\n fallbackLocale?: TypedFallbackLocale\n i18n: I18n\n /**\n * The requested locale if specified\n * Only available for localized collections\n *\n * Suppressing warning below as it is a valid use case - won't be an issue if generated types exist\n */\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n locale?: 'all' | TypedLocale\n /**\n * The payload object\n */\n payload: typeof payload\n /**\n * The context in which the request is being made\n */\n payloadAPI: 'GraphQL' | 'local' | 'REST'\n /** Optimized document loader */\n payloadDataLoader: {\n /**\n * Wraps `payload.find` with a cache to deduplicate requests\n * @experimental This is may be replaced by a more robust cache strategy in future versions\n * By calling this method with the same arguments many times in one request, it will only be handled one time\n * const result = await req.payloadDataLoader.find({\n * collection,\n * req,\n * where: findWhere,\n * })\n */\n find: Payload['find']\n } & DataLoader<string, TypeWithID>\n /** Resized versions of the image that was uploaded during this request */\n payloadUploadSizes?: Record<string, Buffer>\n /** Query params on the request */\n query: Record<string, unknown>\n /** Any response headers that are required to be set when a response is sent */\n responseHeaders?: Headers\n /** The route parameters\n * @example\n * /:collection/:id -> /posts/123\n * { collection: 'posts', id: '123' }\n */\n routeParams?: Record<string, unknown>\n /** Translate function - duplicate of i18n.t */\n t: TFunction\n /**\n * Identifier for the database transaction for interactions in a single, all-or-nothing operation.\n * Can also be used to ensure consistency when multiple operations try to create a transaction concurrently on the same request.\n */\n transactionID?: number | Promise<number | string> | string\n /**\n * Used to ensure consistency when multiple operations try to create a transaction concurrently on the same request\n * @deprecated This is not used anywhere, instead `transactionID` is used for the above. Will be removed in next major version.\n */\n transactionIDPromise?: Promise<void>\n /** The signed-in user */\n user: null | TypedUser\n} & Pick<\n URL,\n 'hash' | 'host' | 'href' | 'origin' | 'pathname' | 'port' | 'protocol' | 'search' | 'searchParams'\n>\ntype PayloadRequestData = {\n /**\n * Data from the request body\n *\n * Within Payload operations, i.e. hooks, data will be there\n * BUT in custom endpoints it will not be, you will need to\n * use either:\n * 1. `const data = await req.json()`\n *\n * 2. import { addDataAndFileToRequest } from 'payload'\n * `await addDataAndFileToRequest(req)`\n *\n * You should not expect this object to be the document data. It is the request data.\n * */\n data?: JsonObject\n /** The file on the request, same rules apply as the `data` property */\n file?: {\n /**\n * Context of the file when it was uploaded via client side.\n */\n clientUploadContext?: unknown\n data: Buffer\n mimetype: string\n name: string\n size: number\n tempFilePath?: string\n }\n}\nexport interface PayloadRequest\n extends CustomPayloadRequestProperties,\n Partial<Request>,\n PayloadRequestData {\n headers: Request['headers']\n}\n\nexport type { Operator }\n\n// Makes it so things like passing new Date() will error\nexport type JsonValue = JsonArray | JsonObject | unknown //Date | JsonArray | JsonObject | boolean | null | number | string // TODO: Evaluate proper, strong type for this\n\nexport type JsonArray = Array<JsonValue>\n\nexport interface JsonObject {\n [key: string]: any\n}\n\nexport type WhereField = {\n // any json-serializable value\n [key in Operator]?: JsonValue\n}\n\nexport type Where = {\n [key: string]: Where[] | WhereField\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n and?: Where[]\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n or?: Where[]\n}\n\nexport type Sort = Array<string> | string\n\ntype SerializableValue = boolean | number | object | string\nexport type DefaultValue =\n | ((args: {\n locale?: TypedLocale\n req: PayloadRequest\n user: PayloadRequest['user']\n }) => SerializableValue)\n | SerializableValue\n\n/**\n * Applies pagination for join fields for including collection relationships\n */\nexport type JoinQuery<TSlug extends CollectionSlug = string> =\n TypedCollectionJoins[TSlug] extends Record<string, string>\n ?\n | false\n | Partial<{\n [K in keyof TypedCollectionJoins[TSlug]]:\n | {\n count?: boolean\n limit?: number\n page?: number\n sort?: string\n where?: Where\n }\n | false\n }>\n : never\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type Document = any\n\nexport type Operation = 'create' | 'delete' | 'read' | 'update'\nexport type VersionOperations = 'readVersions'\nexport type AuthOperations = 'unlock'\nexport type AllOperations = AuthOperations | Operation | VersionOperations\n\nexport function docHasTimestamps(doc: any): doc is TypeWithTimestamps {\n return doc?.createdAt && doc?.updatedAt\n}\n\nexport type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N // This is a commonly used trick to detect 'any'\nexport type IsAny<T> = IfAny<T, true, false>\nexport type ReplaceAny<T, DefaultType> = IsAny<T> extends true ? DefaultType : T\n\nexport type SelectIncludeType = {\n [k: string]: SelectIncludeType | true\n}\n\nexport type SelectExcludeType = {\n [k: string]: false | SelectExcludeType\n}\n\nexport type SelectMode = 'exclude' | 'include'\n\nexport type SelectType = SelectExcludeType | SelectIncludeType\n\nexport type ApplyDisableErrors<T, DisableErrors = false> = false extends DisableErrors\n ? T\n : null | T\n\nexport type TransformDataWithSelect<\n Data extends Record<string, any>,\n Select extends SelectType,\n> = Select extends never\n ? Data\n : string extends keyof Select\n ? Data\n : // START Handle types when they aren't generated\n // For example in any package in this repository outside of tests / plugins\n // This stil gives us autocomplete when using include select mode, i.e select: {title :true} returns type {title: any, id: string | number}\n string extends keyof Omit<Data, 'id'>\n ? Select extends SelectIncludeType\n ? {\n [K in Data extends TypeWithID ? 'id' | keyof Select : keyof Select]: K extends 'id'\n ? number | string\n : unknown\n }\n : Data\n : // END Handle types when they aren't generated\n // Handle include mode\n Select extends SelectIncludeType\n ? {\n [K in keyof Data as K extends keyof Select\n ? Select[K] extends object | true\n ? K\n : never\n : // select 'id' always\n K extends 'id'\n ? K\n : never]: Data[K]\n }\n : // Handle exclude mode\n {\n [K in keyof Data as K extends keyof Select\n ? Select[K] extends object | undefined\n ? K\n : never\n : K]: Data[K]\n }\n\nexport type TransformCollectionWithSelect<\n TSlug extends CollectionSlug,\n TSelect extends SelectType,\n> = TSelect extends SelectType\n ? TransformDataWithSelect<DataFromCollectionSlug<TSlug>, TSelect>\n : DataFromCollectionSlug<TSlug>\n\nexport type DraftTransformCollectionWithSelect<\n TSlug extends CollectionSlug,\n TSelect extends SelectType,\n> = TSelect extends SelectType\n ? TransformDataWithSelect<QueryDraftDataFromCollectionSlug<TSlug>, TSelect>\n : QueryDraftDataFromCollectionSlug<TSlug>\n\nexport type TransformGlobalWithSelect<\n TSlug extends GlobalSlug,\n TSelect extends SelectType,\n> = TSelect extends SelectType\n ? TransformDataWithSelect<DataFromGlobalSlug<TSlug>, TSelect>\n : DataFromGlobalSlug<TSlug>\n\nexport type PopulateType = Partial<TypedCollectionSelect>\n\nexport type ResolvedFilterOptions = { [collection: string]: Where }\n\nexport type PickPreserveOptional<T, K extends keyof T> = Partial<\n Pick<T, Extract<K, OptionalKeys<T>>>\n> &\n Pick<T, Extract<K, RequiredKeys<T>>>\n\nexport type MaybePromise<T> = Promise<T> | T\n"],"names":["docHasTimestamps","doc","createdAt","updatedAt"],"mappings":"AA+LA,OAAO,SAASA,iBAAiBC,GAAQ;IACvC,OAAOA,KAAKC,aAAaD,KAAKE;AAChC"}
@@ -2,7 +2,7 @@ export const extractID = (objectOrID)=>{
2
2
  if (typeof objectOrID === 'string' || typeof objectOrID === 'number') {
3
3
  return objectOrID;
4
4
  }
5
- return objectOrID.id;
5
+ return objectOrID?.id;
6
6
  };
7
7
 
8
8
  //# sourceMappingURL=extractID.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/extractID.ts"],"sourcesContent":["export const extractID = <IDType extends number | string>(\n objectOrID: { id: IDType } | IDType,\n): IDType => {\n if (typeof objectOrID === 'string' || typeof objectOrID === 'number') {\n return objectOrID\n }\n\n return objectOrID.id\n}\n"],"names":["extractID","objectOrID","id"],"mappings":"AAAA,OAAO,MAAMA,YAAY,CACvBC;IAEA,IAAI,OAAOA,eAAe,YAAY,OAAOA,eAAe,UAAU;QACpE,OAAOA;IACT;IAEA,OAAOA,WAAWC,EAAE;AACtB,EAAC"}
1
+ {"version":3,"sources":["../../src/utilities/extractID.ts"],"sourcesContent":["export const extractID = <IDType extends number | string>(\n objectOrID: { id: IDType } | IDType,\n): IDType => {\n if (typeof objectOrID === 'string' || typeof objectOrID === 'number') {\n return objectOrID\n }\n\n return objectOrID?.id\n}\n"],"names":["extractID","objectOrID","id"],"mappings":"AAAA,OAAO,MAAMA,YAAY,CACvBC;IAEA,IAAI,OAAOA,eAAe,YAAY,OAAOA,eAAe,UAAU;QACpE,OAAOA;IACT;IAEA,OAAOA,YAAYC;AACrB,EAAC"}
@@ -1,10 +1,21 @@
1
1
  import type { Config } from '../config/types.js';
2
2
  /**
3
- * This function builds correct URLs for admin panel routing.
3
+ * Builds correct URLs for admin panel and API routing.
4
+ * Use this for both admin routes (`adminRoute`) and API routes (`apiRoute`).
5
+ *
4
6
  * Its primary responsibilities are:
5
- * 1. Read from your `routes.admin` config and appropriately handle `"/"` admin paths
7
+ * 1. Read from your `routes.admin` or `routes.api` config and appropriately handle `"/"` paths
6
8
  * 2. Prepend the `basePath` from your Next.js config, if specified
7
9
  * 3. Return relative or absolute URLs, as needed
10
+ *
11
+ * @example
12
+ * // Admin route
13
+ * formatAdminURL({ adminRoute, path: `/collections/${slug}` })
14
+ *
15
+ * @example
16
+ * // API route with query params
17
+ * const queryString = qs.stringify({ where, limit, page }, { addQueryPrefix: true })
18
+ * formatAdminURL({ apiRoute: api, path: `/${slug}${queryString}`, serverURL })
8
19
  */
9
20
  type BaseFormatURLArgs = {
10
21
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"formatAdminURL.d.ts","sourceRoot":"","sources":["../../src/utilities/formatAdminURL.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAEhD;;;;;;GAMG;AACH,KAAK,iBAAiB,GAAG;IACvB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,IAAI,CAAC,EAAE,EAAE,GAAG,IAAI,MAAM,EAAE,GAAG,IAAI,CAAA;IAC/B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,GAAG,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;AAE7B,KAAK,aAAa,GACd,CAAC;IACC,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IAClD,QAAQ,CAAC,EAAE,KAAK,CAAA;CACjB,GAAG,iBAAiB,CAAC,GACtB,CAAC;IACC,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;CAC/C,GAAG,iBAAiB,CAAC,CAAA;AAE1B,eAAO,MAAM,cAAc,SAAU,aAAa,KAAG,MAyBpD,CAAA"}
1
+ {"version":3,"file":"formatAdminURL.d.ts","sourceRoot":"","sources":["../../src/utilities/formatAdminURL.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAEhD;;;;;;;;;;;;;;;;;GAiBG;AACH,KAAK,iBAAiB,GAAG;IACvB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,IAAI,CAAC,EAAE,EAAE,GAAG,IAAI,MAAM,EAAE,GAAG,IAAI,CAAA;IAC/B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,GAAG,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;AAE7B,KAAK,aAAa,GACd,CAAC;IACC,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IAClD,QAAQ,CAAC,EAAE,KAAK,CAAA;CACjB,GAAG,iBAAiB,CAAC,GACtB,CAAC;IACC,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;CAC/C,GAAG,iBAAiB,CAAC,CAAA;AAE1B,eAAO,MAAM,cAAc,SAAU,aAAa,KAAG,MAyBpD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/formatAdminURL.ts"],"sourcesContent":["import type { Config } from '../config/types.js'\n\n/**\n * This function builds correct URLs for admin panel routing.\n * Its primary responsibilities are:\n * 1. Read from your `routes.admin` config and appropriately handle `\"/\"` admin paths\n * 2. Prepend the `basePath` from your Next.js config, if specified\n * 3. Return relative or absolute URLs, as needed\n */\ntype BaseFormatURLArgs = {\n /**\n * The subpath of your application, if specified.\n * @see https://nextjs.org/docs/app/api-reference/config/next-config-js/basePath\n * @example '/docs'\n */\n basePath?: string\n includeBasePath?: boolean\n path?: '' | `/${string}` | null\n /**\n * Return a relative URL, e.g. ignore `serverURL`.\n * Useful for route-matching, etc.\n */\n relative?: boolean\n} & Pick<Config, 'serverURL'>\n\ntype FormatURLArgs =\n | ({\n adminRoute: NonNullable<Config['routes']>['admin']\n apiRoute?: never\n } & BaseFormatURLArgs)\n | ({\n adminRoute?: never\n apiRoute: NonNullable<Config['routes']>['api']\n } & BaseFormatURLArgs)\n\nexport const formatAdminURL = (args: FormatURLArgs): string => {\n const {\n adminRoute,\n apiRoute,\n includeBasePath: includeBasePathArg,\n path = '',\n relative = false,\n serverURL,\n } = args\n const basePath = process.env.NEXT_BASE_PATH || args.basePath || ''\n const routePath = adminRoute || apiRoute\n const segments = [routePath && routePath !== '/' && routePath, path && path].filter(Boolean)\n const pathname = segments.join('') || '/'\n const pathnameWithBase = (basePath + pathname).replace(/\\/$/, '') || '/'\n const includeBasePath = includeBasePathArg ?? (adminRoute ? false : true)\n\n if (relative || !serverURL) {\n if (includeBasePath && basePath) {\n return pathnameWithBase\n }\n return pathname\n }\n\n const serverURLObj = new URL(serverURL)\n return new URL(pathnameWithBase, serverURLObj.origin).toString()\n}\n"],"names":["formatAdminURL","args","adminRoute","apiRoute","includeBasePath","includeBasePathArg","path","relative","serverURL","basePath","process","env","NEXT_BASE_PATH","routePath","segments","filter","Boolean","pathname","join","pathnameWithBase","replace","serverURLObj","URL","origin","toString"],"mappings":"AAmCA,OAAO,MAAMA,iBAAiB,CAACC;IAC7B,MAAM,EACJC,UAAU,EACVC,QAAQ,EACRC,iBAAiBC,kBAAkB,EACnCC,OAAO,EAAE,EACTC,WAAW,KAAK,EAChBC,SAAS,EACV,GAAGP;IACJ,MAAMQ,WAAWC,QAAQC,GAAG,CAACC,cAAc,IAAIX,KAAKQ,QAAQ,IAAI;IAChE,MAAMI,YAAYX,cAAcC;IAChC,MAAMW,WAAW;QAACD,aAAaA,cAAc,OAAOA;QAAWP,QAAQA;KAAK,CAACS,MAAM,CAACC;IACpF,MAAMC,WAAWH,SAASI,IAAI,CAAC,OAAO;IACtC,MAAMC,mBAAmB,AAACV,CAAAA,WAAWQ,QAAO,EAAGG,OAAO,CAAC,OAAO,OAAO;IACrE,MAAMhB,kBAAkBC,sBAAuBH,CAAAA,aAAa,QAAQ,IAAG;IAEvE,IAAIK,YAAY,CAACC,WAAW;QAC1B,IAAIJ,mBAAmBK,UAAU;YAC/B,OAAOU;QACT;QACA,OAAOF;IACT;IAEA,MAAMI,eAAe,IAAIC,IAAId;IAC7B,OAAO,IAAIc,IAAIH,kBAAkBE,aAAaE,MAAM,EAAEC,QAAQ;AAChE,EAAC"}
1
+ {"version":3,"sources":["../../src/utilities/formatAdminURL.ts"],"sourcesContent":["import type { Config } from '../config/types.js'\n\n/**\n * Builds correct URLs for admin panel and API routing.\n * Use this for both admin routes (`adminRoute`) and API routes (`apiRoute`).\n *\n * Its primary responsibilities are:\n * 1. Read from your `routes.admin` or `routes.api` config and appropriately handle `\"/\"` paths\n * 2. Prepend the `basePath` from your Next.js config, if specified\n * 3. Return relative or absolute URLs, as needed\n *\n * @example\n * // Admin route\n * formatAdminURL({ adminRoute, path: `/collections/${slug}` })\n *\n * @example\n * // API route with query params\n * const queryString = qs.stringify({ where, limit, page }, { addQueryPrefix: true })\n * formatAdminURL({ apiRoute: api, path: `/${slug}${queryString}`, serverURL })\n */\ntype BaseFormatURLArgs = {\n /**\n * The subpath of your application, if specified.\n * @see https://nextjs.org/docs/app/api-reference/config/next-config-js/basePath\n * @example '/docs'\n */\n basePath?: string\n includeBasePath?: boolean\n path?: '' | `/${string}` | null\n /**\n * Return a relative URL, e.g. ignore `serverURL`.\n * Useful for route-matching, etc.\n */\n relative?: boolean\n} & Pick<Config, 'serverURL'>\n\ntype FormatURLArgs =\n | ({\n adminRoute: NonNullable<Config['routes']>['admin']\n apiRoute?: never\n } & BaseFormatURLArgs)\n | ({\n adminRoute?: never\n apiRoute: NonNullable<Config['routes']>['api']\n } & BaseFormatURLArgs)\n\nexport const formatAdminURL = (args: FormatURLArgs): string => {\n const {\n adminRoute,\n apiRoute,\n includeBasePath: includeBasePathArg,\n path = '',\n relative = false,\n serverURL,\n } = args\n const basePath = process.env.NEXT_BASE_PATH || args.basePath || ''\n const routePath = adminRoute || apiRoute\n const segments = [routePath && routePath !== '/' && routePath, path && path].filter(Boolean)\n const pathname = segments.join('') || '/'\n const pathnameWithBase = (basePath + pathname).replace(/\\/$/, '') || '/'\n const includeBasePath = includeBasePathArg ?? (adminRoute ? false : true)\n\n if (relative || !serverURL) {\n if (includeBasePath && basePath) {\n return pathnameWithBase\n }\n return pathname\n }\n\n const serverURLObj = new URL(serverURL)\n return new URL(pathnameWithBase, serverURLObj.origin).toString()\n}\n"],"names":["formatAdminURL","args","adminRoute","apiRoute","includeBasePath","includeBasePathArg","path","relative","serverURL","basePath","process","env","NEXT_BASE_PATH","routePath","segments","filter","Boolean","pathname","join","pathnameWithBase","replace","serverURLObj","URL","origin","toString"],"mappings":"AA8CA,OAAO,MAAMA,iBAAiB,CAACC;IAC7B,MAAM,EACJC,UAAU,EACVC,QAAQ,EACRC,iBAAiBC,kBAAkB,EACnCC,OAAO,EAAE,EACTC,WAAW,KAAK,EAChBC,SAAS,EACV,GAAGP;IACJ,MAAMQ,WAAWC,QAAQC,GAAG,CAACC,cAAc,IAAIX,KAAKQ,QAAQ,IAAI;IAChE,MAAMI,YAAYX,cAAcC;IAChC,MAAMW,WAAW;QAACD,aAAaA,cAAc,OAAOA;QAAWP,QAAQA;KAAK,CAACS,MAAM,CAACC;IACpF,MAAMC,WAAWH,SAASI,IAAI,CAAC,OAAO;IACtC,MAAMC,mBAAmB,AAACV,CAAAA,WAAWQ,QAAO,EAAGG,OAAO,CAAC,OAAO,OAAO;IACrE,MAAMhB,kBAAkBC,sBAAuBH,CAAAA,aAAa,QAAQ,IAAG;IAEvE,IAAIK,YAAY,CAACC,WAAW;QAC1B,IAAIJ,mBAAmBK,UAAU;YAC/B,OAAOU;QACT;QACA,OAAOF;IACT;IAEA,MAAMI,eAAe,IAAIC,IAAId;IAC7B,OAAO,IAAIc,IAAIH,kBAAkBE,aAAaE,MAAM,EAAEC,QAAQ;AAChE,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payload",
3
- "version": "3.80.0-internal-debug.cd99b1f",
3
+ "version": "3.80.0-internal.21e9c47",
4
4
  "description": "Node, React, Headless CMS and Application Framework built on Next.js",
5
5
  "keywords": [
6
6
  "admin panel",
@@ -115,7 +115,7 @@
115
115
  "undici": "7.18.2",
116
116
  "uuid": "10.0.0",
117
117
  "ws": "^8.16.0",
118
- "@payloadcms/translations": "3.80.0-internal-debug.cd99b1f"
118
+ "@payloadcms/translations": "3.80.0-internal.21e9c47"
119
119
  },
120
120
  "devDependencies": {
121
121
  "@hyrious/esbuild-plugin-commonjs": "0.2.6",
@@ -1,56 +0,0 @@
1
- import type { ServerProps } from '../../config/types.js';
2
- import type { FolderBreadcrumb, FolderOrDocument, FolderSortKeys } from '../../folders/types.js';
3
- import type { SanitizedCollectionConfig } from '../../index.js';
4
- export type FolderListViewSlots = {
5
- AfterFolderList?: React.ReactNode;
6
- AfterFolderListTable?: React.ReactNode;
7
- BeforeFolderList?: React.ReactNode;
8
- BeforeFolderListTable?: React.ReactNode;
9
- Description?: React.ReactNode;
10
- listMenuItems?: React.ReactNode[];
11
- };
12
- export type FolderListViewServerPropsOnly = {
13
- collectionConfig: SanitizedCollectionConfig;
14
- documents: FolderOrDocument[];
15
- subfolders: FolderOrDocument[];
16
- } & ServerProps;
17
- export type FolderListViewServerProps = FolderListViewClientProps & FolderListViewServerPropsOnly;
18
- export type FolderListViewClientProps = {
19
- activeCollectionFolderSlugs?: SanitizedCollectionConfig['slug'][];
20
- allCollectionFolderSlugs: SanitizedCollectionConfig['slug'][];
21
- allowCreateCollectionSlugs: SanitizedCollectionConfig['slug'][];
22
- baseFolderPath: `/${string}`;
23
- beforeActions?: React.ReactNode[];
24
- breadcrumbs: FolderBreadcrumb[];
25
- collectionSlug?: SanitizedCollectionConfig['slug'];
26
- disableBulkDelete?: boolean;
27
- disableBulkEdit?: boolean;
28
- documents: FolderOrDocument[];
29
- enableRowSelections?: boolean;
30
- folderAssignedCollections?: SanitizedCollectionConfig['slug'][];
31
- folderFieldName: string;
32
- folderID: null | number | string;
33
- FolderResultsComponent: React.ReactNode;
34
- search?: string;
35
- sort?: FolderSortKeys;
36
- subfolders: FolderOrDocument[];
37
- viewPreference: 'grid' | 'list';
38
- } & FolderListViewSlots;
39
- export type FolderListViewSlotSharedClientProps = {
40
- collectionSlug: SanitizedCollectionConfig['slug'];
41
- hasCreatePermission: boolean;
42
- newDocumentURL: string;
43
- };
44
- export type BeforeFolderListClientProps = FolderListViewSlotSharedClientProps;
45
- export type BeforeFolderListServerPropsOnly = {} & FolderListViewServerPropsOnly;
46
- export type BeforeFolderListServerProps = BeforeFolderListClientProps & BeforeFolderListServerPropsOnly;
47
- export type BeforeFolderListTableClientProps = FolderListViewSlotSharedClientProps;
48
- export type BeforeFolderListTableServerPropsOnly = {} & FolderListViewServerPropsOnly;
49
- export type BeforeFolderListTableServerProps = BeforeFolderListTableClientProps & BeforeFolderListTableServerPropsOnly;
50
- export type AfterFolderListClientProps = FolderListViewSlotSharedClientProps;
51
- export type AfterFolderListServerPropsOnly = {} & FolderListViewServerPropsOnly;
52
- export type AfterFolderListServerProps = AfterFolderListClientProps & AfterFolderListServerPropsOnly;
53
- export type AfterFolderListTableClientProps = FolderListViewSlotSharedClientProps;
54
- export type AfterFolderListTableServerPropsOnly = {} & FolderListViewServerPropsOnly;
55
- export type AfterFolderListTableServerProps = AfterFolderListTableClientProps & AfterFolderListTableServerPropsOnly;
56
- //# sourceMappingURL=folderList.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"folderList.d.ts","sourceRoot":"","sources":["../../../src/admin/views/folderList.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAChG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAA;AAC/D,MAAM,MAAM,mBAAmB,GAAG;IAChC,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACjC,oBAAoB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACtC,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAClC,qBAAqB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvC,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,EAAE,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG;IAC1C,gBAAgB,EAAE,yBAAyB,CAAA;IAC3C,SAAS,EAAE,gBAAgB,EAAE,CAAA;IAC7B,UAAU,EAAE,gBAAgB,EAAE,CAAA;CAC/B,GAAG,WAAW,CAAA;AAEf,MAAM,MAAM,yBAAyB,GAAG,yBAAyB,GAAG,6BAA6B,CAAA;AAEjG,MAAM,MAAM,yBAAyB,GAAG;IACtC,2BAA2B,CAAC,EAAE,yBAAyB,CAAC,MAAM,CAAC,EAAE,CAAA;IACjE,wBAAwB,EAAE,yBAAyB,CAAC,MAAM,CAAC,EAAE,CAAA;IAC7D,0BAA0B,EAAE,yBAAyB,CAAC,MAAM,CAAC,EAAE,CAAA;IAC/D,cAAc,EAAE,IAAI,MAAM,EAAE,CAAA;IAC5B,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,EAAE,CAAA;IACjC,WAAW,EAAE,gBAAgB,EAAE,CAAA;IAC/B,cAAc,CAAC,EAAE,yBAAyB,CAAC,MAAM,CAAC,CAAA;IAClD,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,SAAS,EAAE,gBAAgB,EAAE,CAAA;IAC7B,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,yBAAyB,CAAC,EAAE,yBAAyB,CAAC,MAAM,CAAC,EAAE,CAAA;IAC/D,eAAe,EAAE,MAAM,CAAA;IACvB,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;IAChC,sBAAsB,EAAE,KAAK,CAAC,SAAS,CAAA;IACvC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,cAAc,CAAA;IACrB,UAAU,EAAE,gBAAgB,EAAE,CAAA;IAC9B,cAAc,EAAE,MAAM,GAAG,MAAM,CAAA;CAChC,GAAG,mBAAmB,CAAA;AAEvB,MAAM,MAAM,mCAAmC,GAAG;IAChD,cAAc,EAAE,yBAAyB,CAAC,MAAM,CAAC,CAAA;IACjD,mBAAmB,EAAE,OAAO,CAAA;IAC5B,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAGD,MAAM,MAAM,2BAA2B,GAAG,mCAAmC,CAAA;AAC7E,MAAM,MAAM,+BAA+B,GAAG,EAAE,GAAG,6BAA6B,CAAA;AAChF,MAAM,MAAM,2BAA2B,GAAG,2BAA2B,GACnE,+BAA+B,CAAA;AAGjC,MAAM,MAAM,gCAAgC,GAAG,mCAAmC,CAAA;AAClF,MAAM,MAAM,oCAAoC,GAAG,EAAE,GAAG,6BAA6B,CAAA;AACrF,MAAM,MAAM,gCAAgC,GAAG,gCAAgC,GAC7E,oCAAoC,CAAA;AAGtC,MAAM,MAAM,0BAA0B,GAAG,mCAAmC,CAAA;AAC5E,MAAM,MAAM,8BAA8B,GAAG,EAAE,GAAG,6BAA6B,CAAA;AAC/E,MAAM,MAAM,0BAA0B,GAAG,0BAA0B,GAAG,8BAA8B,CAAA;AAGpG,MAAM,MAAM,+BAA+B,GAAG,mCAAmC,CAAA;AACjF,MAAM,MAAM,mCAAmC,GAAG,EAAE,GAAG,6BAA6B,CAAA;AACpF,MAAM,MAAM,+BAA+B,GAAG,+BAA+B,GAC3E,mCAAmC,CAAA"}
@@ -1,3 +0,0 @@
1
- export { };
2
-
3
- //# sourceMappingURL=folderList.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/admin/views/folderList.ts"],"sourcesContent":["import type { ServerProps } from '../../config/types.js'\nimport type { FolderBreadcrumb, FolderOrDocument, FolderSortKeys } from '../../folders/types.js'\nimport type { SanitizedCollectionConfig } from '../../index.js'\nexport type FolderListViewSlots = {\n AfterFolderList?: React.ReactNode\n AfterFolderListTable?: React.ReactNode\n BeforeFolderList?: React.ReactNode\n BeforeFolderListTable?: React.ReactNode\n Description?: React.ReactNode\n listMenuItems?: React.ReactNode[]\n}\n\nexport type FolderListViewServerPropsOnly = {\n collectionConfig: SanitizedCollectionConfig\n documents: FolderOrDocument[]\n subfolders: FolderOrDocument[]\n} & ServerProps\n\nexport type FolderListViewServerProps = FolderListViewClientProps & FolderListViewServerPropsOnly\n\nexport type FolderListViewClientProps = {\n activeCollectionFolderSlugs?: SanitizedCollectionConfig['slug'][]\n allCollectionFolderSlugs: SanitizedCollectionConfig['slug'][]\n allowCreateCollectionSlugs: SanitizedCollectionConfig['slug'][]\n baseFolderPath: `/${string}`\n beforeActions?: React.ReactNode[]\n breadcrumbs: FolderBreadcrumb[]\n collectionSlug?: SanitizedCollectionConfig['slug']\n disableBulkDelete?: boolean\n disableBulkEdit?: boolean\n documents: FolderOrDocument[]\n enableRowSelections?: boolean\n folderAssignedCollections?: SanitizedCollectionConfig['slug'][]\n folderFieldName: string\n folderID: null | number | string\n FolderResultsComponent: React.ReactNode\n search?: string\n sort?: FolderSortKeys\n subfolders: FolderOrDocument[]\n viewPreference: 'grid' | 'list'\n} & FolderListViewSlots\n\nexport type FolderListViewSlotSharedClientProps = {\n collectionSlug: SanitizedCollectionConfig['slug']\n hasCreatePermission: boolean\n newDocumentURL: string\n}\n\n// BeforeFolderList\nexport type BeforeFolderListClientProps = FolderListViewSlotSharedClientProps\nexport type BeforeFolderListServerPropsOnly = {} & FolderListViewServerPropsOnly\nexport type BeforeFolderListServerProps = BeforeFolderListClientProps &\n BeforeFolderListServerPropsOnly\n\n// BeforeFolderListTable\nexport type BeforeFolderListTableClientProps = FolderListViewSlotSharedClientProps\nexport type BeforeFolderListTableServerPropsOnly = {} & FolderListViewServerPropsOnly\nexport type BeforeFolderListTableServerProps = BeforeFolderListTableClientProps &\n BeforeFolderListTableServerPropsOnly\n\n// AfterFolderList\nexport type AfterFolderListClientProps = FolderListViewSlotSharedClientProps\nexport type AfterFolderListServerPropsOnly = {} & FolderListViewServerPropsOnly\nexport type AfterFolderListServerProps = AfterFolderListClientProps & AfterFolderListServerPropsOnly\n\n// AfterFolderListTable\nexport type AfterFolderListTableClientProps = FolderListViewSlotSharedClientProps\nexport type AfterFolderListTableServerPropsOnly = {} & FolderListViewServerPropsOnly\nexport type AfterFolderListTableServerProps = AfterFolderListTableClientProps &\n AfterFolderListTableServerPropsOnly\n"],"names":[],"mappings":"AAoEA,WACqC"}
@@ -1,10 +0,0 @@
1
- import type { Config, SanitizedConfig } from '../config/types.js';
2
- import type { CollectionConfig } from '../index.js';
3
- export declare function addFolderCollection({ collectionSpecific, config, folderEnabledCollections, richTextSanitizationPromises, validRelationships, }: {
4
- collectionSpecific: boolean;
5
- config: NonNullable<Config>;
6
- folderEnabledCollections: CollectionConfig[];
7
- richTextSanitizationPromises?: Array<(config: SanitizedConfig) => Promise<void>>;
8
- validRelationships?: string[];
9
- }): Promise<void>;
10
- //# sourceMappingURL=addFolderCollection.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addFolderCollection.d.ts","sourceRoot":"","sources":["../../src/folders/addFolderCollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAKnD,wBAAsB,mBAAmB,CAAC,EACxC,kBAAkB,EAClB,MAAM,EACN,wBAAwB,EACxB,4BAAiC,EACjC,kBAAuB,GACxB,EAAE;IACD,kBAAkB,EAAE,OAAO,CAAA;IAC3B,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAC3B,wBAAwB,EAAE,gBAAgB,EAAE,CAAA;IAC5C,4BAA4B,CAAC,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;IAChF,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC9B,GAAG,OAAO,CAAC,IAAI,CAAC,CAgChB"}
@@ -1,26 +0,0 @@
1
- import { sanitizeCollection } from '../collections/config/sanitize.js';
2
- import { createFolderCollection } from './createFolderCollection.js';
3
- export async function addFolderCollection({ collectionSpecific, config, folderEnabledCollections, richTextSanitizationPromises = [], validRelationships = [] }) {
4
- if (config.folders === false) {
5
- return;
6
- }
7
- let folderCollectionConfig = createFolderCollection({
8
- slug: config.folders.slug,
9
- collectionSpecific,
10
- debug: config.folders.debug,
11
- folderEnabledCollections,
12
- folderFieldName: config.folders.fieldName
13
- });
14
- const collectionIndex = config.collections.push(folderCollectionConfig);
15
- if (Array.isArray(config.folders?.collectionOverrides) && config?.folders.collectionOverrides.length) {
16
- for (const override of config.folders.collectionOverrides){
17
- folderCollectionConfig = await override({
18
- collection: folderCollectionConfig
19
- });
20
- }
21
- }
22
- const sanitizedCollectionWithOverrides = await sanitizeCollection(config, folderCollectionConfig, richTextSanitizationPromises, validRelationships);
23
- config.collections[collectionIndex - 1] = sanitizedCollectionWithOverrides;
24
- }
25
-
26
- //# sourceMappingURL=addFolderCollection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/folders/addFolderCollection.ts"],"sourcesContent":["import type { Config, SanitizedConfig } from '../config/types.js'\nimport type { CollectionConfig } from '../index.js'\n\nimport { sanitizeCollection } from '../collections/config/sanitize.js'\nimport { createFolderCollection } from './createFolderCollection.js'\n\nexport async function addFolderCollection({\n collectionSpecific,\n config,\n folderEnabledCollections,\n richTextSanitizationPromises = [],\n validRelationships = [],\n}: {\n collectionSpecific: boolean\n config: NonNullable<Config>\n folderEnabledCollections: CollectionConfig[]\n richTextSanitizationPromises?: Array<(config: SanitizedConfig) => Promise<void>>\n validRelationships?: string[]\n}): Promise<void> {\n if (config.folders === false) {\n return\n }\n\n let folderCollectionConfig = createFolderCollection({\n slug: config.folders!.slug as string,\n collectionSpecific,\n debug: config.folders!.debug,\n folderEnabledCollections,\n folderFieldName: config.folders!.fieldName as string,\n })\n\n const collectionIndex = config.collections!.push(folderCollectionConfig)\n\n if (\n Array.isArray(config.folders?.collectionOverrides) &&\n config?.folders.collectionOverrides.length\n ) {\n for (const override of config.folders.collectionOverrides) {\n folderCollectionConfig = await override({ collection: folderCollectionConfig })\n }\n }\n\n const sanitizedCollectionWithOverrides = await sanitizeCollection(\n config as unknown as Config,\n folderCollectionConfig,\n richTextSanitizationPromises,\n validRelationships,\n )\n\n config.collections![collectionIndex - 1] = sanitizedCollectionWithOverrides\n}\n"],"names":["sanitizeCollection","createFolderCollection","addFolderCollection","collectionSpecific","config","folderEnabledCollections","richTextSanitizationPromises","validRelationships","folders","folderCollectionConfig","slug","debug","folderFieldName","fieldName","collectionIndex","collections","push","Array","isArray","collectionOverrides","length","override","collection","sanitizedCollectionWithOverrides"],"mappings":"AAGA,SAASA,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,sBAAsB,QAAQ,8BAA6B;AAEpE,OAAO,eAAeC,oBAAoB,EACxCC,kBAAkB,EAClBC,MAAM,EACNC,wBAAwB,EACxBC,+BAA+B,EAAE,EACjCC,qBAAqB,EAAE,EAOxB;IACC,IAAIH,OAAOI,OAAO,KAAK,OAAO;QAC5B;IACF;IAEA,IAAIC,yBAAyBR,uBAAuB;QAClDS,MAAMN,OAAOI,OAAO,CAAEE,IAAI;QAC1BP;QACAQ,OAAOP,OAAOI,OAAO,CAAEG,KAAK;QAC5BN;QACAO,iBAAiBR,OAAOI,OAAO,CAAEK,SAAS;IAC5C;IAEA,MAAMC,kBAAkBV,OAAOW,WAAW,CAAEC,IAAI,CAACP;IAEjD,IACEQ,MAAMC,OAAO,CAACd,OAAOI,OAAO,EAAEW,wBAC9Bf,QAAQI,QAAQW,oBAAoBC,QACpC;QACA,KAAK,MAAMC,YAAYjB,OAAOI,OAAO,CAACW,mBAAmB,CAAE;YACzDV,yBAAyB,MAAMY,SAAS;gBAAEC,YAAYb;YAAuB;QAC/E;IACF;IAEA,MAAMc,mCAAmC,MAAMvB,mBAC7CI,QACAK,wBACAH,8BACAC;IAGFH,OAAOW,WAAW,AAAC,CAACD,kBAAkB,EAAE,GAAGS;AAC7C"}
@@ -1,8 +0,0 @@
1
- import type { SanitizedCollectionConfig } from '../index.js';
2
- export declare const addFolderFieldToCollection: ({ collection, collectionSpecific, folderFieldName, folderSlug, }: {
3
- collection: SanitizedCollectionConfig;
4
- collectionSpecific: boolean;
5
- folderFieldName: string;
6
- folderSlug: string;
7
- }) => void;
8
- //# sourceMappingURL=addFolderFieldToCollection.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addFolderFieldToCollection.d.ts","sourceRoot":"","sources":["../../src/folders/addFolderFieldToCollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAI5D,eAAO,MAAM,0BAA0B,qEAKpC;IACD,UAAU,EAAE,yBAAyB,CAAA;IACrC,kBAAkB,EAAE,OAAO,CAAA;IAC3B,eAAe,EAAE,MAAM,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;CACnB,KAAG,IAkBH,CAAA"}
@@ -1,20 +0,0 @@
1
- import { buildFolderField } from './buildFolderField.js';
2
- export const addFolderFieldToCollection = ({ collection, collectionSpecific, folderFieldName, folderSlug })=>{
3
- collection.fields.push(buildFolderField({
4
- collectionSpecific,
5
- folderFieldName,
6
- folderSlug,
7
- overrides: {
8
- admin: {
9
- allowCreate: false,
10
- allowEdit: false,
11
- components: {
12
- Cell: '@payloadcms/next/rsc#FolderTableCell',
13
- Field: '@payloadcms/next/rsc#FolderField'
14
- }
15
- }
16
- }
17
- }));
18
- };
19
-
20
- //# sourceMappingURL=addFolderFieldToCollection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/folders/addFolderFieldToCollection.ts"],"sourcesContent":["import type { SanitizedCollectionConfig } from '../index.js'\n\nimport { buildFolderField } from './buildFolderField.js'\n\nexport const addFolderFieldToCollection = ({\n collection,\n collectionSpecific,\n folderFieldName,\n folderSlug,\n}: {\n collection: SanitizedCollectionConfig\n collectionSpecific: boolean\n folderFieldName: string\n folderSlug: string\n}): void => {\n collection.fields.push(\n buildFolderField({\n collectionSpecific,\n folderFieldName,\n folderSlug,\n overrides: {\n admin: {\n allowCreate: false,\n allowEdit: false,\n components: {\n Cell: '@payloadcms/next/rsc#FolderTableCell',\n Field: '@payloadcms/next/rsc#FolderField',\n },\n },\n },\n }),\n )\n}\n"],"names":["buildFolderField","addFolderFieldToCollection","collection","collectionSpecific","folderFieldName","folderSlug","fields","push","overrides","admin","allowCreate","allowEdit","components","Cell","Field"],"mappings":"AAEA,SAASA,gBAAgB,QAAQ,wBAAuB;AAExD,OAAO,MAAMC,6BAA6B,CAAC,EACzCC,UAAU,EACVC,kBAAkB,EAClBC,eAAe,EACfC,UAAU,EAMX;IACCH,WAAWI,MAAM,CAACC,IAAI,CACpBP,iBAAiB;QACfG;QACAC;QACAC;QACAG,WAAW;YACTC,OAAO;gBACLC,aAAa;gBACbC,WAAW;gBACXC,YAAY;oBACVC,MAAM;oBACNC,OAAO;gBACT;YACF;QACF;IACF;AAEJ,EAAC"}
@@ -1,8 +0,0 @@
1
- import type { SingleRelationshipField } from '../fields/config/types.js';
2
- export declare const buildFolderField: ({ collectionSpecific, folderFieldName, folderSlug, overrides, }: {
3
- collectionSpecific: boolean;
4
- folderFieldName: string;
5
- folderSlug: string;
6
- overrides?: Partial<SingleRelationshipField>;
7
- }) => SingleRelationshipField;
8
- //# sourceMappingURL=buildFolderField.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildFolderField.d.ts","sourceRoot":"","sources":["../../src/folders/buildFolderField.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AAKxE,eAAO,MAAM,gBAAgB,oEAK1B;IACD,kBAAkB,EAAE,OAAO,CAAA;IAC3B,eAAe,EAAE,MAAM,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAA;CAC7C,KAAG,uBA4FH,CAAA"}
@@ -1,87 +0,0 @@
1
- import { extractID } from '../utilities/extractID.js';
2
- export const buildFolderField = ({ collectionSpecific, folderFieldName, folderSlug, overrides = {} })=>{
3
- const field = {
4
- name: folderFieldName,
5
- type: 'relationship',
6
- admin: {},
7
- hasMany: false,
8
- index: true,
9
- label: 'Folder',
10
- relationTo: folderSlug,
11
- validate: async (value, { collectionSlug, data, overrideAccess, previousValue, req })=>{
12
- if (!collectionSpecific) {
13
- // if collection scoping is not enabled, no validation required since folders can contain any type of document
14
- return true;
15
- }
16
- if (!value) {
17
- // no folder, no validation required
18
- return true;
19
- }
20
- const newID = extractID(value);
21
- if (previousValue && extractID(previousValue) === newID) {
22
- // value did not change, no validation required
23
- return true;
24
- } else {
25
- // need to validat the folder value allows this collection type
26
- let parentFolder = null;
27
- if (typeof value === 'string' || typeof value === 'number') {
28
- // need to populate the value with the document
29
- parentFolder = await req.payload.findByID({
30
- id: newID,
31
- collection: folderSlug,
32
- depth: 0,
33
- overrideAccess,
34
- req,
35
- select: {
36
- folderType: true
37
- },
38
- user: req.user
39
- });
40
- }
41
- if (parentFolder && collectionSlug) {
42
- const parentFolderTypes = parentFolder.folderType || [];
43
- // if the parent folder has no folder types, it accepts all collections
44
- if (parentFolderTypes.length === 0) {
45
- return true;
46
- }
47
- // validation for a folder document
48
- if (collectionSlug === folderSlug) {
49
- // ensure the parent accepts ALL folder types
50
- const folderTypes = 'folderType' in data ? data.folderType : [];
51
- const invalidSlugs = folderTypes.filter((validCollectionSlug)=>{
52
- return !parentFolderTypes.includes(validCollectionSlug);
53
- });
54
- if (invalidSlugs.length === 0) {
55
- return true;
56
- } else {
57
- return `Folder with ID ${newID} does not allow documents of type ${invalidSlugs.join(', ')}`;
58
- }
59
- }
60
- // validation for a non-folder document
61
- if (parentFolderTypes.includes(collectionSlug)) {
62
- return true;
63
- } else {
64
- return `Folder with ID ${newID} does not allow documents of type ${collectionSlug}`;
65
- }
66
- } else {
67
- return `Folder with ID ${newID} not found in collection ${folderSlug}`;
68
- }
69
- }
70
- }
71
- };
72
- if (overrides?.admin) {
73
- field.admin = {
74
- ...field.admin,
75
- ...overrides.admin || {}
76
- };
77
- if (overrides.admin.components) {
78
- field.admin.components = {
79
- ...field.admin.components,
80
- ...overrides.admin.components || {}
81
- };
82
- }
83
- }
84
- return field;
85
- };
86
-
87
- //# sourceMappingURL=buildFolderField.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/folders/buildFolderField.ts"],"sourcesContent":["import type { SingleRelationshipField } from '../fields/config/types.js'\nimport type { Document } from '../types/index.js'\n\nimport { extractID } from '../utilities/extractID.js'\n\nexport const buildFolderField = ({\n collectionSpecific,\n folderFieldName,\n folderSlug,\n overrides = {},\n}: {\n collectionSpecific: boolean\n folderFieldName: string\n folderSlug: string\n overrides?: Partial<SingleRelationshipField>\n}): SingleRelationshipField => {\n const field: SingleRelationshipField = {\n name: folderFieldName,\n type: 'relationship',\n admin: {},\n hasMany: false,\n index: true,\n label: 'Folder',\n relationTo: folderSlug,\n validate: async (value, { collectionSlug, data, overrideAccess, previousValue, req }) => {\n if (!collectionSpecific) {\n // if collection scoping is not enabled, no validation required since folders can contain any type of document\n return true\n }\n\n if (!value) {\n // no folder, no validation required\n return true\n }\n\n const newID = extractID<Document>(value)\n if (previousValue && extractID<Document>(previousValue) === newID) {\n // value did not change, no validation required\n return true\n } else {\n // need to validat the folder value allows this collection type\n let parentFolder: Document = null\n if (typeof value === 'string' || typeof value === 'number') {\n // need to populate the value with the document\n parentFolder = await req.payload.findByID({\n id: newID,\n collection: folderSlug,\n depth: 0, // no need to populate nested folders\n overrideAccess,\n req,\n select: {\n folderType: true, // only need to check folderType\n },\n user: req.user,\n })\n }\n\n if (parentFolder && collectionSlug) {\n const parentFolderTypes: string[] = (parentFolder.folderType as string[]) || []\n\n // if the parent folder has no folder types, it accepts all collections\n if (parentFolderTypes.length === 0) {\n return true\n }\n\n // validation for a folder document\n if (collectionSlug === folderSlug) {\n // ensure the parent accepts ALL folder types\n const folderTypes: string[] = 'folderType' in data ? (data.folderType as string[]) : []\n const invalidSlugs = folderTypes.filter((validCollectionSlug: string) => {\n return !parentFolderTypes.includes(validCollectionSlug)\n })\n if (invalidSlugs.length === 0) {\n return true\n } else {\n return `Folder with ID ${newID} does not allow documents of type ${invalidSlugs.join(', ')}`\n }\n }\n\n // validation for a non-folder document\n if (parentFolderTypes.includes(collectionSlug)) {\n return true\n } else {\n return `Folder with ID ${newID} does not allow documents of type ${collectionSlug}`\n }\n } else {\n return `Folder with ID ${newID} not found in collection ${folderSlug}`\n }\n }\n },\n }\n\n if (overrides?.admin) {\n field.admin = {\n ...field.admin,\n ...(overrides.admin || {}),\n }\n\n if (overrides.admin.components) {\n field.admin.components = {\n ...field.admin.components,\n ...(overrides.admin.components || {}),\n }\n }\n }\n\n return field\n}\n"],"names":["extractID","buildFolderField","collectionSpecific","folderFieldName","folderSlug","overrides","field","name","type","admin","hasMany","index","label","relationTo","validate","value","collectionSlug","data","overrideAccess","previousValue","req","newID","parentFolder","payload","findByID","id","collection","depth","select","folderType","user","parentFolderTypes","length","folderTypes","invalidSlugs","filter","validCollectionSlug","includes","join","components"],"mappings":"AAGA,SAASA,SAAS,QAAQ,4BAA2B;AAErD,OAAO,MAAMC,mBAAmB,CAAC,EAC/BC,kBAAkB,EAClBC,eAAe,EACfC,UAAU,EACVC,YAAY,CAAC,CAAC,EAMf;IACC,MAAMC,QAAiC;QACrCC,MAAMJ;QACNK,MAAM;QACNC,OAAO,CAAC;QACRC,SAAS;QACTC,OAAO;QACPC,OAAO;QACPC,YAAYT;QACZU,UAAU,OAAOC,OAAO,EAAEC,cAAc,EAAEC,IAAI,EAAEC,cAAc,EAAEC,aAAa,EAAEC,GAAG,EAAE;YAClF,IAAI,CAAClB,oBAAoB;gBACvB,8GAA8G;gBAC9G,OAAO;YACT;YAEA,IAAI,CAACa,OAAO;gBACV,oCAAoC;gBACpC,OAAO;YACT;YAEA,MAAMM,QAAQrB,UAAoBe;YAClC,IAAII,iBAAiBnB,UAAoBmB,mBAAmBE,OAAO;gBACjE,+CAA+C;gBAC/C,OAAO;YACT,OAAO;gBACL,+DAA+D;gBAC/D,IAAIC,eAAyB;gBAC7B,IAAI,OAAOP,UAAU,YAAY,OAAOA,UAAU,UAAU;oBAC1D,+CAA+C;oBAC/CO,eAAe,MAAMF,IAAIG,OAAO,CAACC,QAAQ,CAAC;wBACxCC,IAAIJ;wBACJK,YAAYtB;wBACZuB,OAAO;wBACPT;wBACAE;wBACAQ,QAAQ;4BACNC,YAAY;wBACd;wBACAC,MAAMV,IAAIU,IAAI;oBAChB;gBACF;gBAEA,IAAIR,gBAAgBN,gBAAgB;oBAClC,MAAMe,oBAA8B,AAACT,aAAaO,UAAU,IAAiB,EAAE;oBAE/E,uEAAuE;oBACvE,IAAIE,kBAAkBC,MAAM,KAAK,GAAG;wBAClC,OAAO;oBACT;oBAEA,mCAAmC;oBACnC,IAAIhB,mBAAmBZ,YAAY;wBACjC,6CAA6C;wBAC7C,MAAM6B,cAAwB,gBAAgBhB,OAAQA,KAAKY,UAAU,GAAgB,EAAE;wBACvF,MAAMK,eAAeD,YAAYE,MAAM,CAAC,CAACC;4BACvC,OAAO,CAACL,kBAAkBM,QAAQ,CAACD;wBACrC;wBACA,IAAIF,aAAaF,MAAM,KAAK,GAAG;4BAC7B,OAAO;wBACT,OAAO;4BACL,OAAO,CAAC,eAAe,EAAEX,MAAM,kCAAkC,EAAEa,aAAaI,IAAI,CAAC,OAAO;wBAC9F;oBACF;oBAEA,uCAAuC;oBACvC,IAAIP,kBAAkBM,QAAQ,CAACrB,iBAAiB;wBAC9C,OAAO;oBACT,OAAO;wBACL,OAAO,CAAC,eAAe,EAAEK,MAAM,kCAAkC,EAAEL,gBAAgB;oBACrF;gBACF,OAAO;oBACL,OAAO,CAAC,eAAe,EAAEK,MAAM,yBAAyB,EAAEjB,YAAY;gBACxE;YACF;QACF;IACF;IAEA,IAAIC,WAAWI,OAAO;QACpBH,MAAMG,KAAK,GAAG;YACZ,GAAGH,MAAMG,KAAK;YACd,GAAIJ,UAAUI,KAAK,IAAI,CAAC,CAAC;QAC3B;QAEA,IAAIJ,UAAUI,KAAK,CAAC8B,UAAU,EAAE;YAC9BjC,MAAMG,KAAK,CAAC8B,UAAU,GAAG;gBACvB,GAAGjC,MAAMG,KAAK,CAAC8B,UAAU;gBACzB,GAAIlC,UAAUI,KAAK,CAAC8B,UAAU,IAAI,CAAC,CAAC;YACtC;QACF;IACF;IAEA,OAAOjC;AACT,EAAC"}
@@ -1,3 +0,0 @@
1
- export declare const foldersSlug = "payload-folders";
2
- export declare const parentFolderFieldName = "folder";
3
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/folders/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,oBAAoB,CAAA;AAC5C,eAAO,MAAM,qBAAqB,WAAW,CAAA"}
@@ -1,4 +0,0 @@
1
- export const foldersSlug = 'payload-folders';
2
- export const parentFolderFieldName = 'folder';
3
-
4
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/folders/constants.ts"],"sourcesContent":["export const foldersSlug = 'payload-folders'\nexport const parentFolderFieldName = 'folder'\n"],"names":["foldersSlug","parentFolderFieldName"],"mappings":"AAAA,OAAO,MAAMA,cAAc,kBAAiB;AAC5C,OAAO,MAAMC,wBAAwB,SAAQ"}
@@ -1,11 +0,0 @@
1
- import type { CollectionConfig } from '../collections/config/types.js';
2
- type CreateFolderCollectionArgs = {
3
- collectionSpecific: boolean;
4
- debug?: boolean;
5
- folderEnabledCollections: CollectionConfig[];
6
- folderFieldName: string;
7
- slug: string;
8
- };
9
- export declare const createFolderCollection: ({ slug, collectionSpecific, debug, folderEnabledCollections, folderFieldName, }: CreateFolderCollectionArgs) => CollectionConfig;
10
- export {};
11
- //# sourceMappingURL=createFolderCollection.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createFolderCollection.d.ts","sourceRoot":"","sources":["../../src/folders/createFolderCollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAUtE,KAAK,0BAA0B,GAAG;IAChC,kBAAkB,EAAE,OAAO,CAAA;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,wBAAwB,EAAE,gBAAgB,EAAE,CAAA;IAC5C,eAAe,EAAE,MAAM,CAAA;IACvB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AACD,eAAO,MAAM,sBAAsB,oFAMhC,0BAA0B,KAAG,gBAqG/B,CAAA"}
@@ -1,115 +0,0 @@
1
- import { defaultAccess } from '../auth/defaultAccess.js';
2
- import { buildFolderField } from './buildFolderField.js';
3
- import { deleteSubfoldersBeforeDelete } from './hooks/deleteSubfoldersAfterDelete.js';
4
- import { dissasociateAfterDelete } from './hooks/dissasociateAfterDelete.js';
5
- import { ensureSafeCollectionsChange } from './hooks/ensureSafeCollectionsChange.js';
6
- import { reparentChildFolder } from './hooks/reparentChildFolder.js';
7
- export const createFolderCollection = ({ slug, collectionSpecific, debug, folderEnabledCollections, folderFieldName })=>{
8
- const { collectionOptions, collectionSlugs } = folderEnabledCollections.reduce((acc, collection)=>{
9
- acc.collectionSlugs.push(collection.slug);
10
- acc.collectionOptions.push({
11
- label: collection.labels?.plural || collection.slug,
12
- value: collection.slug
13
- });
14
- return acc;
15
- }, {
16
- collectionOptions: [],
17
- collectionSlugs: []
18
- });
19
- return {
20
- slug,
21
- access: {
22
- create: defaultAccess,
23
- delete: defaultAccess,
24
- read: defaultAccess,
25
- readVersions: defaultAccess,
26
- update: defaultAccess
27
- },
28
- admin: {
29
- hidden: !debug,
30
- useAsTitle: 'name'
31
- },
32
- fields: [
33
- {
34
- name: 'name',
35
- type: 'text',
36
- index: true,
37
- required: true
38
- },
39
- buildFolderField({
40
- collectionSpecific,
41
- folderFieldName,
42
- folderSlug: slug,
43
- overrides: {
44
- admin: {
45
- hidden: !debug
46
- }
47
- }
48
- }),
49
- {
50
- name: 'documentsAndFolders',
51
- type: 'join',
52
- admin: {
53
- hidden: !debug
54
- },
55
- collection: [
56
- slug,
57
- ...collectionSlugs
58
- ],
59
- hasMany: true,
60
- on: folderFieldName
61
- },
62
- ...collectionSpecific ? [
63
- {
64
- name: 'folderType',
65
- type: 'select',
66
- admin: {
67
- components: {
68
- Field: {
69
- path: '@payloadcms/next/client#FolderTypeField'
70
- }
71
- },
72
- position: 'sidebar'
73
- },
74
- hasMany: true,
75
- options: collectionOptions
76
- }
77
- ] : []
78
- ],
79
- hooks: {
80
- afterChange: [
81
- reparentChildFolder({
82
- folderFieldName
83
- })
84
- ],
85
- afterDelete: [
86
- dissasociateAfterDelete({
87
- collectionSlugs,
88
- folderFieldName
89
- })
90
- ],
91
- beforeDelete: [
92
- deleteSubfoldersBeforeDelete({
93
- folderFieldName,
94
- folderSlug: slug
95
- })
96
- ],
97
- beforeValidate: [
98
- ...collectionSpecific ? [
99
- ensureSafeCollectionsChange({
100
- foldersSlug: slug
101
- })
102
- ] : []
103
- ]
104
- },
105
- labels: {
106
- plural: 'Folders',
107
- singular: 'Folder'
108
- },
109
- typescript: {
110
- interface: 'FolderInterface'
111
- }
112
- };
113
- };
114
-
115
- //# sourceMappingURL=createFolderCollection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/folders/createFolderCollection.ts"],"sourcesContent":["import type { CollectionConfig } from '../collections/config/types.js'\nimport type { Field, Option, SelectField } from '../fields/config/types.js'\n\nimport { defaultAccess } from '../auth/defaultAccess.js'\nimport { buildFolderField } from './buildFolderField.js'\nimport { deleteSubfoldersBeforeDelete } from './hooks/deleteSubfoldersAfterDelete.js'\nimport { dissasociateAfterDelete } from './hooks/dissasociateAfterDelete.js'\nimport { ensureSafeCollectionsChange } from './hooks/ensureSafeCollectionsChange.js'\nimport { reparentChildFolder } from './hooks/reparentChildFolder.js'\n\ntype CreateFolderCollectionArgs = {\n collectionSpecific: boolean\n debug?: boolean\n folderEnabledCollections: CollectionConfig[]\n folderFieldName: string\n slug: string\n}\nexport const createFolderCollection = ({\n slug,\n collectionSpecific,\n debug,\n folderEnabledCollections,\n folderFieldName,\n}: CreateFolderCollectionArgs): CollectionConfig => {\n const { collectionOptions, collectionSlugs } = folderEnabledCollections.reduce(\n (acc, collection: CollectionConfig) => {\n acc.collectionSlugs.push(collection.slug)\n acc.collectionOptions.push({\n label: collection.labels?.plural || collection.slug,\n value: collection.slug,\n })\n\n return acc\n },\n {\n collectionOptions: [] as Option[],\n collectionSlugs: [] as string[],\n },\n )\n\n return {\n slug,\n access: {\n create: defaultAccess,\n delete: defaultAccess,\n read: defaultAccess,\n readVersions: defaultAccess,\n update: defaultAccess,\n },\n admin: {\n hidden: !debug,\n useAsTitle: 'name',\n },\n fields: [\n {\n name: 'name',\n type: 'text',\n index: true,\n required: true,\n },\n buildFolderField({\n collectionSpecific,\n folderFieldName,\n folderSlug: slug,\n overrides: {\n admin: {\n hidden: !debug,\n },\n },\n }),\n {\n name: 'documentsAndFolders',\n type: 'join',\n admin: {\n hidden: !debug,\n },\n collection: [slug, ...collectionSlugs],\n hasMany: true,\n on: folderFieldName,\n },\n ...(collectionSpecific\n ? [\n {\n name: 'folderType',\n type: 'select',\n admin: {\n components: {\n Field: {\n path: '@payloadcms/next/client#FolderTypeField',\n },\n },\n position: 'sidebar',\n },\n hasMany: true,\n options: collectionOptions,\n } satisfies SelectField,\n ]\n : ([] as Field[])),\n ],\n hooks: {\n afterChange: [\n reparentChildFolder({\n folderFieldName,\n }),\n ],\n afterDelete: [\n dissasociateAfterDelete({\n collectionSlugs,\n folderFieldName,\n }),\n ],\n beforeDelete: [deleteSubfoldersBeforeDelete({ folderFieldName, folderSlug: slug })],\n beforeValidate: [\n ...(collectionSpecific ? [ensureSafeCollectionsChange({ foldersSlug: slug })] : []),\n ],\n },\n labels: {\n plural: 'Folders',\n singular: 'Folder',\n },\n typescript: {\n interface: 'FolderInterface',\n },\n }\n}\n"],"names":["defaultAccess","buildFolderField","deleteSubfoldersBeforeDelete","dissasociateAfterDelete","ensureSafeCollectionsChange","reparentChildFolder","createFolderCollection","slug","collectionSpecific","debug","folderEnabledCollections","folderFieldName","collectionOptions","collectionSlugs","reduce","acc","collection","push","label","labels","plural","value","access","create","delete","read","readVersions","update","admin","hidden","useAsTitle","fields","name","type","index","required","folderSlug","overrides","hasMany","on","components","Field","path","position","options","hooks","afterChange","afterDelete","beforeDelete","beforeValidate","foldersSlug","singular","typescript","interface"],"mappings":"AAGA,SAASA,aAAa,QAAQ,2BAA0B;AACxD,SAASC,gBAAgB,QAAQ,wBAAuB;AACxD,SAASC,4BAA4B,QAAQ,yCAAwC;AACrF,SAASC,uBAAuB,QAAQ,qCAAoC;AAC5E,SAASC,2BAA2B,QAAQ,yCAAwC;AACpF,SAASC,mBAAmB,QAAQ,iCAAgC;AASpE,OAAO,MAAMC,yBAAyB,CAAC,EACrCC,IAAI,EACJC,kBAAkB,EAClBC,KAAK,EACLC,wBAAwB,EACxBC,eAAe,EACY;IAC3B,MAAM,EAAEC,iBAAiB,EAAEC,eAAe,EAAE,GAAGH,yBAAyBI,MAAM,CAC5E,CAACC,KAAKC;QACJD,IAAIF,eAAe,CAACI,IAAI,CAACD,WAAWT,IAAI;QACxCQ,IAAIH,iBAAiB,CAACK,IAAI,CAAC;YACzBC,OAAOF,WAAWG,MAAM,EAAEC,UAAUJ,WAAWT,IAAI;YACnDc,OAAOL,WAAWT,IAAI;QACxB;QAEA,OAAOQ;IACT,GACA;QACEH,mBAAmB,EAAE;QACrBC,iBAAiB,EAAE;IACrB;IAGF,OAAO;QACLN;QACAe,QAAQ;YACNC,QAAQvB;YACRwB,QAAQxB;YACRyB,MAAMzB;YACN0B,cAAc1B;YACd2B,QAAQ3B;QACV;QACA4B,OAAO;YACLC,QAAQ,CAACpB;YACTqB,YAAY;QACd;QACAC,QAAQ;YACN;gBACEC,MAAM;gBACNC,MAAM;gBACNC,OAAO;gBACPC,UAAU;YACZ;YACAlC,iBAAiB;gBACfO;gBACAG;gBACAyB,YAAY7B;gBACZ8B,WAAW;oBACTT,OAAO;wBACLC,QAAQ,CAACpB;oBACX;gBACF;YACF;YACA;gBACEuB,MAAM;gBACNC,MAAM;gBACNL,OAAO;oBACLC,QAAQ,CAACpB;gBACX;gBACAO,YAAY;oBAACT;uBAASM;iBAAgB;gBACtCyB,SAAS;gBACTC,IAAI5B;YACN;eACIH,qBACA;gBACE;oBACEwB,MAAM;oBACNC,MAAM;oBACNL,OAAO;wBACLY,YAAY;4BACVC,OAAO;gCACLC,MAAM;4BACR;wBACF;wBACAC,UAAU;oBACZ;oBACAL,SAAS;oBACTM,SAAShC;gBACX;aACD,GACA,EAAE;SACR;QACDiC,OAAO;YACLC,aAAa;gBACXzC,oBAAoB;oBAClBM;gBACF;aACD;YACDoC,aAAa;gBACX5C,wBAAwB;oBACtBU;oBACAF;gBACF;aACD;YACDqC,cAAc;gBAAC9C,6BAA6B;oBAAES;oBAAiByB,YAAY7B;gBAAK;aAAG;YACnF0C,gBAAgB;mBACVzC,qBAAqB;oBAACJ,4BAA4B;wBAAE8C,aAAa3C;oBAAK;iBAAG,GAAG,EAAE;aACnF;QACH;QACAY,QAAQ;YACNC,QAAQ;YACR+B,UAAU;QACZ;QACAC,YAAY;YACVC,WAAW;QACb;IACF;AACF,EAAC"}
@@ -1,8 +0,0 @@
1
- import type { CollectionBeforeDeleteHook } from '../../index.js';
2
- type Args = {
3
- folderFieldName: string;
4
- folderSlug: string;
5
- };
6
- export declare const deleteSubfoldersBeforeDelete: ({ folderFieldName, folderSlug, }: Args) => CollectionBeforeDeleteHook;
7
- export {};
8
- //# sourceMappingURL=deleteSubfoldersAfterDelete.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deleteSubfoldersAfterDelete.d.ts","sourceRoot":"","sources":["../../../src/folders/hooks/deleteSubfoldersAfterDelete.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAA;AAEhE,KAAK,IAAI,GAAG;IACV,eAAe,EAAE,MAAM,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AACD,eAAO,MAAM,4BAA4B,qCAGtC,IAAI,KAAG,0BAYT,CAAA"}