@payloadcms/richtext-lexical 4.0.0-canary.0 → 4.0.0-canary.2

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 (276) hide show
  1. package/dist/exports/client/{RelationshipComponent-RZL743CS.js → RelationshipComponent-YCPAKOL7.js} +1 -1
  2. package/dist/exports/client/RelationshipComponent-YCPAKOL7.js.map +7 -0
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/chunk-CUFJGFNW.js +2 -0
  5. package/dist/exports/client/chunk-CUFJGFNW.js.map +7 -0
  6. package/dist/exports/client/{component-KESPRYJR.js → component-PHZQBOJE.js} +1 -1
  7. package/dist/exports/client/component-PHZQBOJE.js.map +7 -0
  8. package/dist/exports/client/componentInline-DV4EGOWU.js +2 -0
  9. package/dist/exports/client/index.js +14 -14
  10. package/dist/exports/client/index.js.map +4 -4
  11. package/dist/features/blockquote/server/index.d.ts +1 -4
  12. package/dist/features/blockquote/server/index.d.ts.map +1 -1
  13. package/dist/features/blockquote/server/index.js +2 -0
  14. package/dist/features/blockquote/server/index.js.map +1 -1
  15. package/dist/features/blockquote/server/schema.d.ts +8 -0
  16. package/dist/features/blockquote/server/schema.d.ts.map +1 -0
  17. package/dist/features/blockquote/server/schema.js +15 -0
  18. package/dist/features/blockquote/server/schema.js.map +1 -0
  19. package/dist/features/blocks/client/component/index.d.ts +1 -1
  20. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  21. package/dist/features/blocks/client/component/index.js +2 -1
  22. package/dist/features/blocks/client/component/index.js.map +1 -1
  23. package/dist/features/blocks/client/componentInline/index.d.ts +1 -1
  24. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  25. package/dist/features/blocks/client/componentInline/index.js +2 -1
  26. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  27. package/dist/features/blocks/client/index.d.ts.map +1 -1
  28. package/dist/features/blocks/client/index.js +4 -2
  29. package/dist/features/blocks/client/index.js.map +1 -1
  30. package/dist/features/blocks/client/markdown/markdownTransformer.js +4 -4
  31. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
  32. package/dist/features/blocks/client/nodes/BlocksNode.d.ts +1 -1
  33. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  34. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  35. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts +1 -1
  36. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  37. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  38. package/dist/features/blocks/client/plugin/index.d.ts +1 -1
  39. package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
  40. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  41. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +1 -1
  42. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +1 -0
  43. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  44. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts +1 -2
  45. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts.map +1 -1
  46. package/dist/features/blocks/server/graphQLPopulationPromise.js.map +1 -1
  47. package/dist/features/blocks/server/index.d.ts +1 -0
  48. package/dist/features/blocks/server/index.d.ts.map +1 -1
  49. package/dist/features/blocks/server/index.js +24 -72
  50. package/dist/features/blocks/server/index.js.map +1 -1
  51. package/dist/features/blocks/server/markdown/markdownTransformer.js +4 -4
  52. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
  53. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +1 -18
  54. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  55. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  56. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +2 -10
  57. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  58. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  59. package/dist/features/blocks/server/schema.d.ts +45 -0
  60. package/dist/features/blocks/server/schema.d.ts.map +1 -0
  61. package/dist/features/blocks/server/schema.js +139 -0
  62. package/dist/features/blocks/server/schema.js.map +1 -0
  63. package/dist/features/blocks/server/validate.d.ts +1 -2
  64. package/dist/features/blocks/server/validate.d.ts.map +1 -1
  65. package/dist/features/blocks/server/validate.js.map +1 -1
  66. package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
  67. package/dist/features/converters/lexicalToHtml/async/types.d.ts +14 -15
  68. package/dist/features/converters/lexicalToHtml/async/types.d.ts.map +1 -1
  69. package/dist/features/converters/lexicalToHtml/async/types.js.map +1 -1
  70. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
  71. package/dist/features/converters/lexicalToHtml/sync/types.d.ts +14 -15
  72. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  73. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  74. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +4 -2
  75. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  76. package/dist/features/converters/lexicalToJSX/Component/index.js +5 -4
  77. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  78. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  79. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +12 -14
  80. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  81. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  82. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts +12 -14
  83. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts.map +1 -1
  84. package/dist/features/converters/lexicalToPlaintext/sync/types.js.map +1 -1
  85. package/dist/features/experimental_table/server/index.d.ts +1 -6
  86. package/dist/features/experimental_table/server/index.d.ts.map +1 -1
  87. package/dist/features/experimental_table/server/index.js +4 -0
  88. package/dist/features/experimental_table/server/index.js.map +1 -1
  89. package/dist/features/experimental_table/server/schema.d.ts +27 -0
  90. package/dist/features/experimental_table/server/schema.d.ts.map +1 -0
  91. package/dist/features/experimental_table/server/schema.js +107 -0
  92. package/dist/features/experimental_table/server/schema.js.map +1 -0
  93. package/dist/features/heading/server/index.d.ts +2 -4
  94. package/dist/features/heading/server/index.d.ts.map +1 -1
  95. package/dist/features/heading/server/index.js +2 -0
  96. package/dist/features/heading/server/index.js.map +1 -1
  97. package/dist/features/heading/server/schema.d.ts +10 -0
  98. package/dist/features/heading/server/schema.d.ts.map +1 -0
  99. package/dist/features/heading/server/schema.js +37 -0
  100. package/dist/features/heading/server/schema.js.map +1 -0
  101. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +1 -1
  102. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  103. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  104. package/dist/features/horizontalRule/server/index.d.ts +1 -0
  105. package/dist/features/horizontalRule/server/index.d.ts.map +1 -1
  106. package/dist/features/horizontalRule/server/index.js +2 -0
  107. package/dist/features/horizontalRule/server/index.js.map +1 -1
  108. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +1 -5
  109. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  110. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  111. package/dist/features/horizontalRule/server/schema.d.ts +7 -0
  112. package/dist/features/horizontalRule/server/schema.d.ts.map +1 -0
  113. package/dist/features/horizontalRule/server/schema.js +25 -0
  114. package/dist/features/horizontalRule/server/schema.js.map +1 -0
  115. package/dist/features/link/client/index.d.ts.map +1 -1
  116. package/dist/features/link/client/index.js.map +1 -1
  117. package/dist/features/link/client/plugins/autoLink/index.d.ts +1 -1
  118. package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
  119. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  120. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  121. package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts +1 -1
  122. package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts.map +1 -1
  123. package/dist/features/link/client/plugins/floatingLinkEditor/types.js.map +1 -1
  124. package/dist/features/link/client/plugins/link/index.js.map +1 -1
  125. package/dist/features/link/markdownTransformer.d.ts +1 -1
  126. package/dist/features/link/markdownTransformer.d.ts.map +1 -1
  127. package/dist/features/link/markdownTransformer.js.map +1 -1
  128. package/dist/features/link/markdownTransformer.spec.js.map +1 -1
  129. package/dist/features/link/nodes/AutoLinkNode.d.ts +3 -3
  130. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  131. package/dist/features/link/nodes/AutoLinkNode.js +2 -1
  132. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  133. package/dist/features/link/nodes/LinkNode.d.ts +3 -3
  134. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  135. package/dist/features/link/nodes/LinkNode.js +2 -1
  136. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  137. package/dist/features/link/server/baseFields.js.map +1 -1
  138. package/dist/features/link/server/graphQLPopulationPromise.d.ts +1 -1
  139. package/dist/features/link/server/graphQLPopulationPromise.d.ts.map +1 -1
  140. package/dist/features/link/server/graphQLPopulationPromise.js.map +1 -1
  141. package/dist/features/link/server/index.d.ts +2 -1
  142. package/dist/features/link/server/index.d.ts.map +1 -1
  143. package/dist/features/link/server/index.js +3 -0
  144. package/dist/features/link/server/index.js.map +1 -1
  145. package/dist/features/link/server/schema.d.ts +32 -0
  146. package/dist/features/link/server/schema.d.ts.map +1 -0
  147. package/dist/features/link/server/schema.js +169 -0
  148. package/dist/features/link/server/schema.js.map +1 -0
  149. package/dist/features/link/server/validate.d.ts +1 -1
  150. package/dist/features/link/server/validate.d.ts.map +1 -1
  151. package/dist/features/link/server/validate.js.map +1 -1
  152. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  153. package/dist/features/lists/checklist/server/index.js +3 -0
  154. package/dist/features/lists/checklist/server/index.js.map +1 -1
  155. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  156. package/dist/features/lists/orderedList/server/index.js +3 -0
  157. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  158. package/dist/features/lists/plugin/index.d.ts +0 -9
  159. package/dist/features/lists/plugin/index.d.ts.map +1 -1
  160. package/dist/features/lists/plugin/index.js.map +1 -1
  161. package/dist/features/lists/shared/schema.d.ts +18 -0
  162. package/dist/features/lists/shared/schema.d.ts.map +1 -0
  163. package/dist/features/lists/shared/schema.js +62 -0
  164. package/dist/features/lists/shared/schema.js.map +1 -0
  165. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  166. package/dist/features/lists/unorderedList/server/index.js +3 -0
  167. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  168. package/dist/features/relationship/client/components/RelationshipComponent.d.ts +1 -1
  169. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  170. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  171. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts +1 -1
  172. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  173. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  174. package/dist/features/relationship/client/plugins/index.d.ts +1 -1
  175. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  176. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  177. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  178. package/dist/features/relationship/client/utils/useEnabledRelationships.js +9 -40
  179. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  180. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +1 -1
  181. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  182. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  183. package/dist/features/relationship/server/index.d.ts +1 -0
  184. package/dist/features/relationship/server/index.d.ts.map +1 -1
  185. package/dist/features/relationship/server/index.js +2 -0
  186. package/dist/features/relationship/server/index.js.map +1 -1
  187. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +1 -10
  188. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  189. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  190. package/dist/features/relationship/server/schema.d.ts +28 -0
  191. package/dist/features/relationship/server/schema.d.ts.map +1 -0
  192. package/dist/features/relationship/server/schema.js +80 -0
  193. package/dist/features/relationship/server/schema.js.map +1 -0
  194. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +23 -0
  195. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -0
  196. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +34 -0
  197. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -0
  198. package/dist/features/typesServer.d.ts +17 -40
  199. package/dist/features/typesServer.d.ts.map +1 -1
  200. package/dist/features/typesServer.js.map +1 -1
  201. package/dist/features/upload/client/component/index.d.ts +1 -1
  202. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  203. package/dist/features/upload/client/component/index.js.map +1 -1
  204. package/dist/features/upload/client/nodes/UploadNode.d.ts +1 -1
  205. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  206. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  207. package/dist/features/upload/client/plugin/index.d.ts +1 -1
  208. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  209. package/dist/features/upload/client/plugin/index.js.map +1 -1
  210. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +1 -1
  211. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  212. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  213. package/dist/features/upload/server/index.d.ts +1 -0
  214. package/dist/features/upload/server/index.d.ts.map +1 -1
  215. package/dist/features/upload/server/index.js +3 -2
  216. package/dist/features/upload/server/index.js.map +1 -1
  217. package/dist/features/upload/server/nodes/UploadNode.d.ts +1 -55
  218. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  219. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  220. package/dist/features/upload/server/nodes/conversions.d.ts.map +1 -1
  221. package/dist/features/upload/server/nodes/conversions.js.map +1 -1
  222. package/dist/features/upload/server/schema.d.ts +52 -0
  223. package/dist/features/upload/server/schema.d.ts.map +1 -0
  224. package/dist/features/upload/server/schema.js +129 -0
  225. package/dist/features/upload/server/schema.js.map +1 -0
  226. package/dist/features/upload/server/validate.d.ts +1 -1
  227. package/dist/features/upload/server/validate.d.ts.map +1 -1
  228. package/dist/features/upload/server/validate.js.map +1 -1
  229. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  230. package/dist/field/bundled.css +1 -1
  231. package/dist/field/index.css +4 -0
  232. package/dist/index.d.ts +8 -5
  233. package/dist/index.d.ts.map +1 -1
  234. package/dist/index.js.map +1 -1
  235. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  236. package/dist/lexical/config/server/sanitize.js +9 -11
  237. package/dist/lexical/config/server/sanitize.js.map +1 -1
  238. package/dist/types/builtInNodes.d.ts +14 -0
  239. package/dist/types/builtInNodes.d.ts.map +1 -0
  240. package/dist/types/builtInNodes.js +203 -0
  241. package/dist/types/builtInNodes.js.map +1 -0
  242. package/dist/types/index.d.ts +14 -15
  243. package/dist/types/index.d.ts.map +1 -1
  244. package/dist/types/index.js.map +1 -1
  245. package/dist/types/jsonSchemaHelpers.d.ts +30 -0
  246. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -0
  247. package/dist/types/jsonSchemaHelpers.js +58 -0
  248. package/dist/types/jsonSchemaHelpers.js.map +1 -0
  249. package/dist/types/nodeTypes.d.ts +115 -61
  250. package/dist/types/nodeTypes.d.ts.map +1 -1
  251. package/dist/types/nodeTypes.js +3 -2
  252. package/dist/types/nodeTypes.js.map +1 -1
  253. package/dist/types/schema.d.ts.map +1 -1
  254. package/dist/types/schema.js +67 -65
  255. package/dist/types/schema.js.map +1 -1
  256. package/dist/utilities/applyBaseFilterToFields.d.ts.map +1 -1
  257. package/dist/utilities/applyBaseFilterToFields.js +1 -2
  258. package/dist/utilities/applyBaseFilterToFields.js.map +1 -1
  259. package/dist/utilities/buildEditorState.d.ts +17 -3
  260. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  261. package/dist/utilities/buildEditorState.js +8 -0
  262. package/dist/utilities/buildEditorState.js.map +1 -1
  263. package/dist/utilities/fieldsDrawer/index.css +5 -1
  264. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +1 -1
  265. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
  266. package/package.json +6 -6
  267. package/dist/exports/client/RelationshipComponent-RZL743CS.js.map +0 -7
  268. package/dist/exports/client/chunk-XIJE2UCQ.js +0 -2
  269. package/dist/exports/client/chunk-XIJE2UCQ.js.map +0 -7
  270. package/dist/exports/client/component-KESPRYJR.js.map +0 -7
  271. package/dist/exports/client/componentInline-R2RSJX4K.js +0 -2
  272. package/dist/features/link/nodes/types.d.ts +0 -27
  273. package/dist/features/link/nodes/types.d.ts.map +0 -1
  274. package/dist/features/link/nodes/types.js +0 -2
  275. package/dist/features/link/nodes/types.js.map +0 -1
  276. /package/dist/exports/client/{componentInline-R2RSJX4K.js.map → componentInline-DV4EGOWU.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["populate","createServerFeature","createNode","relationshipPopulationPromiseHOC","i18n","RelationshipServerNode","RelationshipFeature","feature","props","maxDepth","clientFeatureProps","ClientFeature","nodes","graphQLPopulationPromises","hooks","afterRead","currentDepth","depth","draft","node","overrideAccess","populateArg","populationPromises","req","showHiddenFields","value","collection","payload","collections","relationTo","id","populateDepth","undefined","push","collectionSlug","config","slug","data","key","select","defaultPopulate"],"sources":["../../../../src/features/relationship/server/index.ts"],"sourcesContent":["import type { CollectionSlug } from 'payload'\n\nimport { populate } from '../../../populateGraphQL/populate.js'\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { relationshipPopulationPromiseHOC } from './graphQLPopulationPromise.js'\nimport { i18n } from './i18n.js'\nimport { RelationshipServerNode } from './nodes/RelationshipNode.js'\n\nexport type ExclusiveRelationshipFeatureProps =\n | {\n /**\n * The collections that should be disabled. Overrides the `enableRichTextRelationship` property in the collection config.\n * When this property is set, `enabledCollections` will not be available.\n **/\n disabledCollections?: CollectionSlug[]\n\n // Ensures that enabledCollections is not available when disabledCollections is set\n enabledCollections?: never\n }\n | {\n // Ensures that disabledCollections is not available when enabledCollections is set\n disabledCollections?: never\n\n /**\n * The collections that should be enabled. Overrides the `enableRichTextRelationship` property in the collection config\n * When this property is set, `disabledCollections` will not be available.\n **/\n enabledCollections?: CollectionSlug[]\n }\n\nexport type RelationshipFeatureProps = {\n /**\n * Sets a maximum population depth for this relationship, regardless of the remaining depth when the respective field is reached.\n * This behaves exactly like the maxDepth properties of relationship and upload fields.\n *\n * {@link https://payloadcms.com/docs/getting-started/concepts#field-level-max-depth}\n */\n maxDepth?: number\n} & ExclusiveRelationshipFeatureProps\n\nexport const RelationshipFeature = createServerFeature<\n RelationshipFeatureProps,\n RelationshipFeatureProps,\n ExclusiveRelationshipFeatureProps\n>({\n feature: ({ props }) => {\n // we don't need to pass maxDepth to the client, it's only used on the server\n const { maxDepth, ...clientFeatureProps } = props ?? {}\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#RelationshipFeatureClient',\n clientFeatureProps,\n i18n,\n nodes: [\n createNode({\n graphQLPopulationPromises: [relationshipPopulationPromiseHOC(props)],\n hooks: {\n afterRead: [\n ({\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n populateArg,\n populationPromises,\n req,\n showHiddenFields,\n }) => {\n if (!node?.value) {\n return node\n }\n const collection = req.payload.collections[node?.relationTo]\n\n if (!collection) {\n return node\n }\n // @ts-expect-error\n const id = node?.value?.id || node?.value // for backwards-compatibility\n\n const populateDepth = maxDepth !== undefined && maxDepth < depth ? maxDepth : depth\n\n populationPromises.push(\n populate({\n id,\n collectionSlug: collection.config.slug,\n currentDepth,\n data: node,\n depth: populateDepth,\n draft,\n key: 'value',\n overrideAccess,\n req,\n select:\n populateArg?.[collection.config.slug] ?? collection.config.defaultPopulate,\n showHiddenFields,\n }),\n )\n\n return node\n },\n ],\n },\n node: RelationshipServerNode,\n }),\n ],\n }\n },\n key: 'relationship',\n})\n"],"mappings":"AAEA,SAASA,QAAQ,QAAQ;AACzB,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,gCAAgC,QAAQ;AACjD,SAASC,IAAI,QAAQ;AACrB,SAASC,sBAAsB,QAAQ;AAkCvC,OAAO,MAAMC,mBAAA,GAAsBL,mBAAA,CAIjC;EACAM,OAAA,EAASA,CAAC;IAAEC;EAAK,CAAE;IACjB;IACA,MAAM;MAAEC,QAAQ;MAAE,GAAGC;IAAA,CAAoB,GAAGF,KAAA,IAAS,CAAC;IACtD,OAAO;MACLG,aAAA,EAAe;MACfD,kBAAA;MACAN,IAAA;MACAQ,KAAA,EAAO,CACLV,UAAA,CAAW;QACTW,yBAAA,EAA2B,CAACV,gCAAA,CAAiCK,KAAA,EAAO;QACpEM,KAAA,EAAO;UACLC,SAAA,EAAW,CACT,CAAC;YACCC,YAAY;YACZC,KAAK;YACLC,KAAK;YACLC,IAAI;YACJC,cAAc;YACdC,WAAW;YACXC,kBAAkB;YAClBC,GAAG;YACHC;UAAgB,CACjB;YACC,IAAI,CAACL,IAAA,EAAMM,KAAA,EAAO;cAChB,OAAON,IAAA;YACT;YACA,MAAMO,UAAA,GAAaH,GAAA,CAAII,OAAO,CAACC,WAAW,CAACT,IAAA,EAAMU,UAAA,CAAW;YAE5D,IAAI,CAACH,UAAA,EAAY;cACf,OAAOP,IAAA;YACT;YACA;YACA,MAAMW,EAAA,GAAKX,IAAA,EAAMM,KAAA,EAAOK,EAAA,IAAMX,IAAA,EAAMM,KAAA,CAAM;AAAA;YAE1C,MAAMM,aAAA,GAAgBtB,QAAA,KAAauB,SAAA,IAAavB,QAAA,GAAWQ,KAAA,GAAQR,QAAA,GAAWQ,KAAA;YAE9EK,kBAAA,CAAmBW,IAAI,CACrBjC,QAAA,CAAS;cACP8B,EAAA;cACAI,cAAA,EAAgBR,UAAA,CAAWS,MAAM,CAACC,IAAI;cACtCpB,YAAA;cACAqB,IAAA,EAAMlB,IAAA;cACNF,KAAA,EAAOc,aAAA;cACPb,KAAA;cACAoB,GAAA,EAAK;cACLlB,cAAA;cACAG,GAAA;cACAgB,MAAA,EACElB,WAAA,GAAcK,UAAA,CAAWS,MAAM,CAACC,IAAI,CAAC,IAAIV,UAAA,CAAWS,MAAM,CAACK,eAAe;cAC5EhB;YACF;YAGF,OAAOL,IAAA;UACT;QAEJ;QACAA,IAAA,EAAMd;MACR;IAEJ;EACF;EACAiC,GAAA,EAAK;AACP","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["populate","createServerFeature","createNode","relationshipPopulationPromiseHOC","i18n","RelationshipServerNode","createRelationshipNodeJSONSchema","RelationshipFeature","feature","props","maxDepth","clientFeatureProps","ClientFeature","nodes","graphQLPopulationPromises","hooks","afterRead","currentDepth","depth","draft","node","overrideAccess","populateArg","populationPromises","req","showHiddenFields","value","collection","payload","collections","relationTo","id","populateDepth","undefined","push","collectionSlug","config","slug","data","key","select","defaultPopulate","jsonSchema"],"sources":["../../../../src/features/relationship/server/index.ts"],"sourcesContent":["import type { CollectionSlug } from 'payload'\n\nimport { populate } from '../../../populateGraphQL/populate.js'\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { relationshipPopulationPromiseHOC } from './graphQLPopulationPromise.js'\nimport { i18n } from './i18n.js'\nimport { RelationshipServerNode } from './nodes/RelationshipNode.js'\nimport { createRelationshipNodeJSONSchema } from './schema.js'\n\nexport type { RelationshipData, SerializedRelationshipNode } from './schema.js'\n\nexport type ExclusiveRelationshipFeatureProps =\n | {\n /**\n * The collections that should be disabled. Overrides the `enableRichTextRelationship` property in the collection config.\n * When this property is set, `enabledCollections` will not be available.\n **/\n disabledCollections?: CollectionSlug[]\n\n // Ensures that enabledCollections is not available when disabledCollections is set\n enabledCollections?: never\n }\n | {\n // Ensures that disabledCollections is not available when enabledCollections is set\n disabledCollections?: never\n\n /**\n * The collections that should be enabled. Overrides the `enableRichTextRelationship` property in the collection config\n * When this property is set, `disabledCollections` will not be available.\n **/\n enabledCollections?: CollectionSlug[]\n }\n\nexport type RelationshipFeatureProps = {\n /**\n * Sets a maximum population depth for this relationship, regardless of the remaining depth when the respective field is reached.\n * This behaves exactly like the maxDepth properties of relationship and upload fields.\n *\n * {@link https://payloadcms.com/docs/getting-started/concepts#field-level-max-depth}\n */\n maxDepth?: number\n} & ExclusiveRelationshipFeatureProps\n\nexport const RelationshipFeature = createServerFeature<\n RelationshipFeatureProps,\n RelationshipFeatureProps,\n ExclusiveRelationshipFeatureProps\n>({\n feature: ({ props }) => {\n // we don't need to pass maxDepth to the client, it's only used on the server\n const { maxDepth, ...clientFeatureProps } = props ?? {}\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#RelationshipFeatureClient',\n clientFeatureProps,\n i18n,\n nodes: [\n createNode({\n graphQLPopulationPromises: [relationshipPopulationPromiseHOC(props)],\n hooks: {\n afterRead: [\n ({\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n populateArg,\n populationPromises,\n req,\n showHiddenFields,\n }) => {\n if (!node?.value) {\n return node\n }\n const collection = req.payload.collections[node?.relationTo]\n\n if (!collection) {\n return node\n }\n // @ts-expect-error\n const id = node?.value?.id || node?.value // for backwards-compatibility\n\n const populateDepth = maxDepth !== undefined && maxDepth < depth ? maxDepth : depth\n\n populationPromises.push(\n populate({\n id,\n collectionSlug: collection.config.slug,\n currentDepth,\n data: node,\n depth: populateDepth,\n draft,\n key: 'value',\n overrideAccess,\n req,\n select:\n populateArg?.[collection.config.slug] ?? collection.config.defaultPopulate,\n showHiddenFields,\n }),\n )\n\n return node\n },\n ],\n },\n jsonSchema: createRelationshipNodeJSONSchema(props),\n node: RelationshipServerNode,\n }),\n ],\n }\n },\n key: 'relationship',\n})\n"],"mappings":"AAEA,SAASA,QAAQ,QAAQ;AACzB,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,gCAAgC,QAAQ;AACjD,SAASC,IAAI,QAAQ;AACrB,SAASC,sBAAsB,QAAQ;AACvC,SAASC,gCAAgC,QAAQ;AAoCjD,OAAO,MAAMC,mBAAA,GAAsBN,mBAAA,CAIjC;EACAO,OAAA,EAASA,CAAC;IAAEC;EAAK,CAAE;IACjB;IACA,MAAM;MAAEC,QAAQ;MAAE,GAAGC;IAAA,CAAoB,GAAGF,KAAA,IAAS,CAAC;IACtD,OAAO;MACLG,aAAA,EAAe;MACfD,kBAAA;MACAP,IAAA;MACAS,KAAA,EAAO,CACLX,UAAA,CAAW;QACTY,yBAAA,EAA2B,CAACX,gCAAA,CAAiCM,KAAA,EAAO;QACpEM,KAAA,EAAO;UACLC,SAAA,EAAW,CACT,CAAC;YACCC,YAAY;YACZC,KAAK;YACLC,KAAK;YACLC,IAAI;YACJC,cAAc;YACdC,WAAW;YACXC,kBAAkB;YAClBC,GAAG;YACHC;UAAgB,CACjB;YACC,IAAI,CAACL,IAAA,EAAMM,KAAA,EAAO;cAChB,OAAON,IAAA;YACT;YACA,MAAMO,UAAA,GAAaH,GAAA,CAAII,OAAO,CAACC,WAAW,CAACT,IAAA,EAAMU,UAAA,CAAW;YAE5D,IAAI,CAACH,UAAA,EAAY;cACf,OAAOP,IAAA;YACT;YACA;YACA,MAAMW,EAAA,GAAKX,IAAA,EAAMM,KAAA,EAAOK,EAAA,IAAMX,IAAA,EAAMM,KAAA,CAAM;AAAA;YAE1C,MAAMM,aAAA,GAAgBtB,QAAA,KAAauB,SAAA,IAAavB,QAAA,GAAWQ,KAAA,GAAQR,QAAA,GAAWQ,KAAA;YAE9EK,kBAAA,CAAmBW,IAAI,CACrBlC,QAAA,CAAS;cACP+B,EAAA;cACAI,cAAA,EAAgBR,UAAA,CAAWS,MAAM,CAACC,IAAI;cACtCpB,YAAA;cACAqB,IAAA,EAAMlB,IAAA;cACNF,KAAA,EAAOc,aAAA;cACPb,KAAA;cACAoB,GAAA,EAAK;cACLlB,cAAA;cACAG,GAAA;cACAgB,MAAA,EACElB,WAAA,GAAcK,UAAA,CAAWS,MAAM,CAACC,IAAI,CAAC,IAAIV,UAAA,CAAWS,MAAM,CAACK,eAAe;cAC5EhB;YACF;YAGF,OAAOL,IAAA;UACT;QAEJ;QACAsB,UAAA,EAAYpC,gCAAA,CAAiCG,KAAA;QAC7CW,IAAA,EAAMf;MACR;IAEJ;EACF;EACAkC,GAAA,EAAK;AACP","ignoreList":[]}
@@ -1,16 +1,7 @@
1
- import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js';
2
- import type { CollectionSlug, DataFromCollectionSlug } from 'payload';
3
1
  import type { JSX } from 'react';
4
2
  import { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js';
5
3
  import { type DOMConversionMap, type DOMExportOutput, type EditorConfig, type ElementFormatType, type LexicalEditor, type LexicalNode, type NodeKey } from 'lexical';
6
- import type { StronglyTypedLeafNode } from '../../../../types/nodeTypes.js';
7
- export type RelationshipData = {
8
- [TCollectionSlug in CollectionSlug]: {
9
- relationTo: TCollectionSlug;
10
- value: DataFromCollectionSlug<TCollectionSlug> | number | string;
11
- };
12
- }[CollectionSlug];
13
- export type SerializedRelationshipNode = RelationshipData & StronglyTypedLeafNode<SerializedDecoratorBlockNode, 'relationship'>;
4
+ import type { RelationshipData, SerializedRelationshipNode } from '../schema.js';
14
5
  export declare class RelationshipServerNode extends DecoratorBlockNode {
15
6
  __data: RelationshipData;
16
7
  constructor({ data, format, key, }: {
@@ -1 +1 @@
1
- {"version":3,"file":"RelationshipNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/relationship/server/nodes/RelationshipNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAA;AAC/F,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AACrE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAEhF,OAAO,EAEL,KAAK,gBAAgB,EAErB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,OAAO,EACb,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AAE3E,MAAM,MAAM,gBAAgB,GAAG;KAC5B,eAAe,IAAI,cAAc,GAAG;QACnC,UAAU,EAAE,eAAe,CAAA;QAC3B,KAAK,EAAE,sBAAsB,CAAC,eAAe,CAAC,GAAG,MAAM,GAAG,MAAM,CAAA;KACjE;CACF,CAAC,cAAc,CAAC,CAAA;AAEjB,MAAM,MAAM,0BAA0B,GAAG,gBAAgB,GACvD,qBAAqB,CAAC,4BAA4B,EAAE,cAAc,CAAC,CAAA;AAgBrE,qBAAa,sBAAuB,SAAQ,kBAAkB;IAC5D,MAAM,EAAE,gBAAgB,CAAA;gBAEZ,EACV,IAAI,EACJ,MAAM,EACN,GAAG,GACJ,EAAE;QACD,IAAI,EAAE,gBAAgB,CAAA;QACtB,MAAM,CAAC,EAAE,iBAAiB,CAAA;QAC1B,GAAG,CAAC,EAAE,OAAO,CAAA;KACd;WAKe,KAAK,CAAC,IAAI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EACV,IAAI,EACJ,MAAM,EACN,GAAG,GACJ,EAAE;QACD,IAAI,EAAE,gBAAgB,CAAA;QACtB,MAAM,CAAC,EAAE,iBAAiB,CAAA;QAC1B,GAAG,CAAC,EAAE,OAAO,CAAA;KACd;WAKe,KAAK,CAAC,IAAI,EAAE,sBAAsB,GAAG,sBAAsB;WAQ3D,OAAO,IAAI,MAAM;WAIjB,SAAS,IAAI,gBAAgB,CAAC,cAAc,CAAC,GAAG,IAAI;WAiBpD,UAAU,CAAC,cAAc,EAAE,0BAA0B,GAAG,sBAAsB;IAc9F,MAAM,CAAC,QAAQ,IAAI,KAAK;IAIf,SAAS,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,WAAW;IAM7C,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO;IAIpE,SAAS,IAAI,eAAe;IAa5B,UAAU,IAAI,0BAA0B;IASjD,OAAO,IAAI,gBAAgB;IAIlB,cAAc,IAAI,MAAM;IAIjC,OAAO,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;CAItC;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,gBAAgB,GAAG,sBAAsB,CAM5F;AAED,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,sBAAsB,GAAG,SAAS,GAC5D,IAAI,IAAI,sBAAsB,CAEhC"}
@@ -1 +1 @@
1
- {"version":3,"file":"RelationshipNode.js","names":["DecoratorBlockNode","addClassNamesToElement","$applyNodeReplacement","$relationshipElementToServerNode","domNode","id","getAttribute","relationTo","node","$createServerRelationshipNode","value","RelationshipServerNode","__data","constructor","data","format","key","clone","__format","__key","getType","importDOM","div","hasAttribute","conversion","priority","importJSON","serializedNode","version","importedData","setFormat","isInline","createDOM","config","element","document","createElement","theme","relationship","decorate","_editor","_config","exportDOM","setAttribute","String","text","createTextNode","getTextContent","append","exportJSON","getData","type","getLatest","setData","writable","getWritable","$isServerRelationshipNode"],"sources":["../../../../../src/features/relationship/server/nodes/RelationshipNode.tsx"],"sourcesContent":["import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type { CollectionSlug, DataFromCollectionSlug } from 'payload'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport { addClassNamesToElement } from '@lexical/utils'\nimport {\n $applyNodeReplacement,\n type DOMConversionMap,\n type DOMConversionOutput,\n type DOMExportOutput,\n type EditorConfig,\n type ElementFormatType,\n type LexicalEditor,\n type LexicalNode,\n type NodeKey,\n} from 'lexical'\n\nimport type { StronglyTypedLeafNode } from '../../../../types/nodeTypes.js'\n\nexport type RelationshipData = {\n [TCollectionSlug in CollectionSlug]: {\n relationTo: TCollectionSlug\n value: DataFromCollectionSlug<TCollectionSlug> | number | string\n }\n}[CollectionSlug]\n\nexport type SerializedRelationshipNode = RelationshipData &\n StronglyTypedLeafNode<SerializedDecoratorBlockNode, 'relationship'>\n\nfunction $relationshipElementToServerNode(domNode: HTMLDivElement): DOMConversionOutput | null {\n const id = domNode.getAttribute('data-lexical-relationship-id')\n const relationTo = domNode.getAttribute('data-lexical-relationship-relationTo')\n\n if (id != null && relationTo != null) {\n const node = $createServerRelationshipNode({\n relationTo,\n value: id,\n })\n return { node }\n }\n return null\n}\n\nexport class RelationshipServerNode extends DecoratorBlockNode {\n __data: RelationshipData\n\n constructor({\n data,\n format,\n key,\n }: {\n data: RelationshipData\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__data = data\n }\n\n static override clone(node: RelationshipServerNode): RelationshipServerNode {\n return new this({\n data: node.__data,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'relationship'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {\n div: (domNode: HTMLDivElement) => {\n if (\n !domNode.hasAttribute('data-lexical-relationship-relationTo') ||\n !domNode.hasAttribute('data-lexical-relationship-id')\n ) {\n return null\n }\n return {\n conversion: $relationshipElementToServerNode,\n priority: 2,\n }\n },\n }\n }\n\n static override importJSON(serializedNode: SerializedRelationshipNode): RelationshipServerNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n\n const importedData: RelationshipData = {\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n const node = $createServerRelationshipNode(importedData)\n node.setFormat(serializedNode.format)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n override createDOM(config?: EditorConfig): HTMLElement {\n const element = document.createElement('div')\n addClassNamesToElement(element, config?.theme?.relationship)\n return element\n }\n\n override decorate(_editor: LexicalEditor, _config: EditorConfig): JSX.Element {\n return null as unknown as JSX.Element\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('div')\n element.setAttribute(\n 'data-lexical-relationship-id',\n String(typeof this.__data?.value === 'object' ? this.__data?.value?.id : this.__data?.value),\n )\n element.setAttribute('data-lexical-relationship-relationTo', this.__data?.relationTo)\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedRelationshipNode {\n return {\n ...super.exportJSON(),\n ...this.getData(),\n type: 'relationship',\n version: 2,\n }\n }\n\n getData(): RelationshipData {\n return this.getLatest().__data\n }\n\n override getTextContent(): string {\n return `${this.__data?.relationTo} relation to ${typeof this.__data?.value === 'object' ? this.__data?.value?.id : this.__data?.value}`\n }\n\n setData(data: RelationshipData): void {\n const writable = this.getWritable()\n writable.__data = data\n }\n}\n\nexport function $createServerRelationshipNode(data: RelationshipData): RelationshipServerNode {\n return $applyNodeReplacement(\n new RelationshipServerNode({\n data,\n }),\n )\n}\n\nexport function $isServerRelationshipNode(\n node: LexicalNode | null | RelationshipServerNode | undefined,\n): node is RelationshipServerNode {\n return node instanceof RelationshipServerNode\n}\n"],"mappings":"AAIA,SAASA,kBAAkB,QAAQ;AACnC,SA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EAAyB;IAChC,OAAO,GAAG,IAAI,CAACnC,MAAM,EAAEL,UAAA,gBAA0B,OAAO,IAAI,CAACK,MAAM,EAAEF,KAAA,KAAU,WAAW,IAAI,CAACE,MAAM,EAAEF,KAAA,EAAOL,EAAA,GAAK,IAAI,CAACO,MAAM,EAAEF,KAAA,EAAO;EACzI;EAEA2C,QAAQvC,IAAsB,EAAQ;IACpC,MAAMwC,QAAA,GAAW,IAAI,CAACC,WAAW;IACjCD,QAAA,CAAS1C,MAAM,GAAGE,IAAA;EACpB;AACF;AAEA,OAAO,SAASL,8BAA8BK,IAAsB;EAClE,OAAOZ,qBAAA,CACL,IAAIS,sBAAA,CAAuB;IACzBG;EACF;AAEJ;AAEA,OAAO,SAAS0C,0BACdhD,IAA6D;EAE7D,OAAOA,IAAA,YAAgBG,sBAAA;AACzB","ignoreList":[]}
1
+ {"version":3,"file":"RelationshipNode.js","names":["DecoratorBlockNode","addClassNamesToElement","$applyNodeReplacement","$relationshipElementToServerNode","domNode","id","getAttribute","relationTo","node","$createServerRelationshipNode","value","RelationshipServerNode","__data","constructor","data","format","key","clone","__format","__key","getType","importDOM","div","hasAttribute","conversion","priority","importJSON","serializedNode","version","importedData","setFormat","isInline","createDOM","config","element","document","createElement","theme","relationship","decorate","_editor","_config","exportDOM","setAttribute","String","text","createTextNode","getTextContent","append","exportJSON","getData","type","getLatest","setData","writable","getWritable","$isServerRelationshipNode"],"sources":["../../../../../src/features/relationship/server/nodes/RelationshipNode.tsx"],"sourcesContent":["import type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport { addClassNamesToElement } from '@lexical/utils'\nimport {\n $applyNodeReplacement,\n type DOMConversionMap,\n type DOMConversionOutput,\n type DOMExportOutput,\n type EditorConfig,\n type ElementFormatType,\n type LexicalEditor,\n type LexicalNode,\n type NodeKey,\n} from 'lexical'\n\nimport type { RelationshipData, SerializedRelationshipNode } from '../schema.js'\n\nfunction $relationshipElementToServerNode(domNode: HTMLDivElement): DOMConversionOutput | null {\n const id = domNode.getAttribute('data-lexical-relationship-id')\n const relationTo = domNode.getAttribute('data-lexical-relationship-relationTo')\n\n if (id != null && relationTo != null) {\n const node = $createServerRelationshipNode({\n relationTo,\n value: id,\n })\n return { node }\n }\n return null\n}\n\nexport class RelationshipServerNode extends DecoratorBlockNode {\n __data: RelationshipData\n\n constructor({\n data,\n format,\n key,\n }: {\n data: RelationshipData\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__data = data\n }\n\n static override clone(node: RelationshipServerNode): RelationshipServerNode {\n return new this({\n data: node.__data,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'relationship'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {\n div: (domNode: HTMLDivElement) => {\n if (\n !domNode.hasAttribute('data-lexical-relationship-relationTo') ||\n !domNode.hasAttribute('data-lexical-relationship-id')\n ) {\n return null\n }\n return {\n conversion: $relationshipElementToServerNode,\n priority: 2,\n }\n },\n }\n }\n\n static override importJSON(serializedNode: SerializedRelationshipNode): RelationshipServerNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n\n const importedData: RelationshipData = {\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n const node = $createServerRelationshipNode(importedData)\n node.setFormat(serializedNode.format)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n override createDOM(config?: EditorConfig): HTMLElement {\n const element = document.createElement('div')\n addClassNamesToElement(element, config?.theme?.relationship)\n return element\n }\n\n override decorate(_editor: LexicalEditor, _config: EditorConfig): JSX.Element {\n return null as unknown as JSX.Element\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('div')\n element.setAttribute(\n 'data-lexical-relationship-id',\n String(typeof this.__data?.value === 'object' ? this.__data?.value?.id : this.__data?.value),\n )\n element.setAttribute('data-lexical-relationship-relationTo', this.__data?.relationTo)\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedRelationshipNode {\n return {\n ...super.exportJSON(),\n ...this.getData(),\n type: 'relationship',\n version: 2,\n }\n }\n\n getData(): RelationshipData {\n return this.getLatest().__data\n }\n\n override getTextContent(): string {\n return `${this.__data?.relationTo} relation to ${typeof this.__data?.value === 'object' ? this.__data?.value?.id : this.__data?.value}`\n }\n\n setData(data: RelationshipData): void {\n const writable = this.getWritable()\n writable.__data = data\n }\n}\n\nexport function $createServerRelationshipNode(data: RelationshipData): RelationshipServerNode {\n return $applyNodeReplacement(\n new RelationshipServerNode({\n data,\n }),\n )\n}\n\nexport function $isServerRelationshipNode(\n node: LexicalNode | null | RelationshipServerNode | undefined,\n): node is RelationshipServerNode {\n return node instanceof RelationshipServerNode\n}\n"],"mappings":"AAEA,SAASA,kBAAkB,QAAQ;AACnC,SAASC,sBAAsB,QAAQ;AACvC,SACEC,qBAAqB,QAShB;AAIP,SAASC,iCAAiCC,OAAuB;EAC/D,MAAMC,EAAA,GAAKD,OAAA,CAAQE,YAAY,CAAC;EAChC,MAAMC,UAAA,GAAaH,OAAA,CAAQE,YAAY,CAAC;EAExC,IAAID,EAAA,IAAM,QAAQE,UAAA,IAAc,MAAM;IACpC,MAAMC,IAAA,GAAOC,6BAAA,CAA8B;MACzCF,UAAA;MACAG,KAAA,EAAOL;IACT;IACA,OAAO;MAAEG;IAAK;EAChB;EACA,OAAO;AACT;AAEA,OAAO,MAAMG,sBAAA,SAA+BX,kBAAA;EAC1CY,MAAA;EAEAC,YAAY;IACVC,IAAI;IACJC,MAAM;IACNC;EAAG,CAKJ,EAAE;IACD,KAAK,CAACD,MAAA,EAAQC,GAAA;IACd,IAAI,CAACJ,MAAM,GAAGE,IAAA;EAChB;EAEA,OAAgBG,MAAMT,IAA4B,EAA0B;IAC1E,OAAO,IAAI,IAAI,CAAC;MACdM,IAAA,EAAMN,IAAA,CAAKI,MAAM;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,CAAChC,MAAM,EAAEF,KAAA,KAAU,WAAW,IAAI,CAACE,MAAM,EAAEF,KAAA,EAAOL,EAAA,GAAK,IAAI,CAACO,MAAM,EAAEF,KAAA;IAExFwB,OAAA,CAAQS,YAAY,CAAC,wCAAwC,IAAI,CAAC/B,MAAM,EAAEL,UAAA;IAE1E,MAAMsC,IAAA,GAAOV,QAAA,CAASW,cAAc,CAAC,IAAI,CAACC,cAAc;IACxDb,OAAA,CAAQc,MAAM,CAACH,IAAA;IACf,OAAO;MAAEX;IAAQ;EACnB;EAESe,WAAA,EAAyC;IAChD,OAAO;MACL,GAAG,KAAK,CAACA,UAAA,EAAY;MACrB,GAAG,IAAI,CAACC,OAAO,EAAE;MACjBC,IAAA,EAAM;MACNvB,OAAA,EAAS;IACX;EACF;EAEAsB,QAAA,EAA4B;IAC1B,OAAO,IAAI,CAACE,SAAS,GAAGxC,MAAM;EAChC;EAESmC,eAAA,EAAyB;IAChC,OAAO,GAAG,IAAI,CAACnC,MAAM,EAAEL,UAAA,gBAA0B,OAAO,IAAI,CAACK,MAAM,EAAEF,KAAA,KAAU,WAAW,IAAI,CAACE,MAAM,EAAEF,KAAA,EAAOL,EAAA,GAAK,IAAI,CAACO,MAAM,EAAEF,KAAA,EAAO;EACzI;EAEA2C,QAAQvC,IAAsB,EAAQ;IACpC,MAAMwC,QAAA,GAAW,IAAI,CAACC,WAAW;IACjCD,QAAA,CAAS1C,MAAM,GAAGE,IAAA;EACpB;AACF;AAEA,OAAO,SAASL,8BAA8BK,IAAsB;EAClE,OAAOZ,qBAAA,CACL,IAAIS,sBAAA,CAAuB;IACzBG;EACF;AAEJ;AAEA,OAAO,SAAS0C,0BACdhD,IAA6D;EAE7D,OAAOA,IAAA,YAAgBG,sBAAA;AACzB","ignoreList":[]}
@@ -0,0 +1,28 @@
1
+ import type { CollectionSlug, DataFromCollectionSlug, UploadCollectionSlug } from 'payload';
2
+ import type { LexicalElementFormat } from '../../../types/nodeTypes.js';
3
+ import type { JSONSchemaFn } from '../../typesServer.js';
4
+ import type { RelationshipFeatureProps } from './index.js';
5
+ export type RelationshipData = {
6
+ [TCollectionSlug in CollectionSlug]: {
7
+ relationTo: TCollectionSlug;
8
+ value: DataFromCollectionSlug<TCollectionSlug> | number | string;
9
+ };
10
+ }[CollectionSlug];
11
+ /**
12
+ * Exclude upload collection slugs. This matches runtime behavior, as well as the json schema.
13
+ */
14
+ export type NonUploadCollectionSlug = [Exclude<CollectionSlug, UploadCollectionSlug>] extends [
15
+ never
16
+ ] ? CollectionSlug : Exclude<CollectionSlug, UploadCollectionSlug>;
17
+ export type SerializedRelationshipNode<TSlugs extends CollectionSlug = NonUploadCollectionSlug> = {
18
+ [TSlug in TSlugs]: {
19
+ relationTo: TSlug;
20
+ value: DataFromCollectionSlug<TSlug> | number | string;
21
+ };
22
+ }[TSlugs] & {
23
+ format: LexicalElementFormat;
24
+ type: 'relationship';
25
+ version: number;
26
+ };
27
+ export declare const createRelationshipNodeJSONSchema: (props: RelationshipFeatureProps | undefined) => JSONSchemaFn;
28
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/features/relationship/server/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAE3F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAK1D,MAAM,MAAM,gBAAgB,GAAG;KAC5B,eAAe,IAAI,cAAc,GAAG;QACnC,UAAU,EAAE,eAAe,CAAA;QAC3B,KAAK,EAAE,sBAAsB,CAAC,eAAe,CAAC,GAAG,MAAM,GAAG,MAAM,CAAA;KACjE;CACF,CAAC,cAAc,CAAC,CAAA;AAEjB;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAAC,SAAS;IAC5F,KAAK;CACN,GACG,cAAc,GACd,OAAO,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAAA;AAEjD,MAAM,MAAM,0BAA0B,CAAC,MAAM,SAAS,cAAc,GAAG,uBAAuB,IAAI;KAC/F,KAAK,IAAI,MAAM,GAAG;QACjB,UAAU,EAAE,KAAK,CAAA;QACjB,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC,GAAG,MAAM,GAAG,MAAM,CAAA;KACvD;CACF,CAAC,MAAM,CAAC,GAAG;IACV,MAAM,EAAE,oBAAoB,CAAA;IAC5B,IAAI,EAAE,cAAc,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAcD,eAAO,MAAM,gCAAgC,GAC1C,OAAO,wBAAwB,GAAG,SAAS,KAAG,YAkD9C,CAAA"}
@@ -0,0 +1,80 @@
1
+ import { formatSchema, versionSchema } from '../../../types/jsonSchemaHelpers.js';
2
+ import { filterEnabledRelationshipCollections } from '../shared/filterEnabledRelationshipCollections.js';
3
+ /** MUST stay byte-for-byte in sync with the runtime `SerializedRelationshipNode` declared above. */
4
+ const SERIALIZED_RELATIONSHIP_NODE_TS = `export type SerializedRelationshipNode<TSlugs extends keyof Config['collections']> = {
5
+ type: 'relationship';
6
+ format: LexicalElementFormat;
7
+ version: number;
8
+ } & {
9
+ [TSlug in TSlugs]: {
10
+ relationTo: TSlug;
11
+ value: number | string | Config['collections'][TSlug];
12
+ };
13
+ }[TSlugs];`;
14
+ export const createRelationshipNodeJSONSchema = props => ({
15
+ collectionIDFieldTypes,
16
+ config,
17
+ typeStringDefinitions
18
+ }) => {
19
+ typeStringDefinitions.add(SERIALIZED_RELATIONSHIP_NODE_TS);
20
+ const enabledCollections = config?.collections ? filterEnabledRelationshipCollections(config.collections, {
21
+ disabledCollections: props?.disabledCollections,
22
+ enabledCollections: props?.enabledCollections,
23
+ uploads: false
24
+ }) : [];
25
+ const variants = enabledCollections.map(collection => {
26
+ const slug = collection.slug;
27
+ const idType = collectionIDFieldTypes[slug] ?? 'string';
28
+ return {
29
+ type: 'object',
30
+ additionalProperties: false,
31
+ properties: {
32
+ type: {
33
+ type: 'string',
34
+ const: 'relationship'
35
+ },
36
+ format: formatSchema,
37
+ relationTo: {
38
+ type: 'string',
39
+ const: slug
40
+ },
41
+ value: {
42
+ description: 'The related document by ID (string or number). Populated to the full document when read at depth > 0.',
43
+ oneOf: [{
44
+ type: idType
45
+ }, {
46
+ $ref: `#/$defs/${slug}`
47
+ }]
48
+ },
49
+ version: versionSchema
50
+ },
51
+ required: ['format', 'relationTo', 'type', 'value', 'version']
52
+ };
53
+ });
54
+ let schema;
55
+ if (variants.length === 0) {
56
+ schema = {
57
+ type: 'object',
58
+ additionalProperties: true,
59
+ properties: {
60
+ type: {
61
+ type: 'string',
62
+ const: 'relationship'
63
+ },
64
+ version: versionSchema
65
+ },
66
+ required: ['type', 'version']
67
+ };
68
+ } else {
69
+ const slugUnion = enabledCollections.map(c => `'${c.slug}'`).join(' | ');
70
+ const baseSchema = variants.length === 1 ? variants[0] : {
71
+ oneOf: variants
72
+ };
73
+ schema = {
74
+ ...baseSchema,
75
+ tsType: `SerializedRelationshipNode<${slugUnion}>`
76
+ };
77
+ }
78
+ return schema;
79
+ };
80
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","names":["formatSchema","versionSchema","filterEnabledRelationshipCollections","SERIALIZED_RELATIONSHIP_NODE_TS","createRelationshipNodeJSONSchema","props","collectionIDFieldTypes","config","typeStringDefinitions","add","enabledCollections","collections","disabledCollections","uploads","variants","map","collection","slug","idType","type","additionalProperties","properties","const","format","relationTo","value","description","oneOf","$ref","version","required","schema","length","slugUnion","c","join","baseSchema","tsType"],"sources":["../../../../src/features/relationship/server/schema.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\nimport type { CollectionSlug, DataFromCollectionSlug, UploadCollectionSlug } from 'payload'\n\nimport type { LexicalElementFormat } from '../../../types/nodeTypes.js'\nimport type { JSONSchemaFn } from '../../typesServer.js'\nimport type { RelationshipFeatureProps } from './index.js'\n\nimport { formatSchema, versionSchema } from '../../../types/jsonSchemaHelpers.js'\nimport { filterEnabledRelationshipCollections } from '../shared/filterEnabledRelationshipCollections.js'\n\nexport type RelationshipData = {\n [TCollectionSlug in CollectionSlug]: {\n relationTo: TCollectionSlug\n value: DataFromCollectionSlug<TCollectionSlug> | number | string\n }\n}[CollectionSlug]\n\n/**\n * Exclude upload collection slugs. This matches runtime behavior, as well as the json schema.\n */\nexport type NonUploadCollectionSlug = [Exclude<CollectionSlug, UploadCollectionSlug>] extends [\n never,\n]\n ? CollectionSlug\n : Exclude<CollectionSlug, UploadCollectionSlug>\n\nexport type SerializedRelationshipNode<TSlugs extends CollectionSlug = NonUploadCollectionSlug> = {\n [TSlug in TSlugs]: {\n relationTo: TSlug\n value: DataFromCollectionSlug<TSlug> | number | string\n }\n}[TSlugs] & {\n format: LexicalElementFormat\n type: 'relationship'\n version: number\n}\n\n/** MUST stay byte-for-byte in sync with the runtime `SerializedRelationshipNode` declared above. */\nconst SERIALIZED_RELATIONSHIP_NODE_TS = `export type SerializedRelationshipNode<TSlugs extends keyof Config['collections']> = {\n type: 'relationship';\n format: LexicalElementFormat;\n version: number;\n} & {\n [TSlug in TSlugs]: {\n relationTo: TSlug;\n value: number | string | Config['collections'][TSlug];\n };\n}[TSlugs];`\n\nexport const createRelationshipNodeJSONSchema =\n (props: RelationshipFeatureProps | undefined): JSONSchemaFn =>\n ({ collectionIDFieldTypes, config, typeStringDefinitions }) => {\n typeStringDefinitions.add(SERIALIZED_RELATIONSHIP_NODE_TS)\n const enabledCollections = config?.collections\n ? filterEnabledRelationshipCollections(config.collections, {\n disabledCollections: props?.disabledCollections,\n enabledCollections: props?.enabledCollections,\n uploads: false,\n })\n : []\n\n const variants: JSONSchema4[] = enabledCollections.map((collection) => {\n const slug = collection.slug\n const idType: 'number' | 'string' = collectionIDFieldTypes[slug] ?? 'string'\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: 'relationship' },\n format: formatSchema,\n relationTo: { type: 'string', const: slug },\n value: {\n description:\n 'The related document by ID (string or number). Populated to the full document when read at depth > 0.',\n oneOf: [{ type: idType }, { $ref: `#/$defs/${slug}` }],\n },\n version: versionSchema,\n },\n required: ['format', 'relationTo', 'type', 'value', 'version'],\n }\n })\n\n let schema: JSONSchema4\n if (variants.length === 0) {\n schema = {\n type: 'object',\n additionalProperties: true,\n properties: {\n type: { type: 'string', const: 'relationship' },\n version: versionSchema,\n },\n required: ['type', 'version'],\n }\n } else {\n const slugUnion = enabledCollections.map((c) => `'${c.slug}'`).join(' | ')\n const baseSchema: JSONSchema4 = variants.length === 1 ? variants[0]! : { oneOf: variants }\n schema = { ...baseSchema, tsType: `SerializedRelationshipNode<${slugUnion}>` }\n }\n\n return schema\n }\n"],"mappings":"AAOA,SAASA,YAAY,EAAEC,aAAa,QAAQ;AAC5C,SAASC,oCAAoC,QAAQ;AA6BrD;AACA,MAAMC,+BAAA,GAAkC;;;;;;;;;WAS7B;AAEX,OAAO,MAAMC,gCAAA,GACVC,KAAA,IACD,CAAC;EAAEC,sBAAsB;EAAEC,MAAM;EAAEC;AAAqB,CAAE;EACxDA,qBAAA,CAAsBC,GAAG,CAACN,+BAAA;EAC1B,MAAMO,kBAAA,GAAqBH,MAAA,EAAQI,WAAA,GAC/BT,oCAAA,CAAqCK,MAAA,CAAOI,WAAW,EAAE;IACvDC,mBAAA,EAAqBP,KAAA,EAAOO,mBAAA;IAC5BF,kBAAA,EAAoBL,KAAA,EAAOK,kBAAA;IAC3BG,OAAA,EAAS;EACX,KACA,EAAE;EAEN,MAAMC,QAAA,GAA0BJ,kBAAA,CAAmBK,GAAG,CAAEC,UAAA;IACtD,MAAMC,IAAA,GAAOD,UAAA,C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Relationship?: boolean;
4
+ };
5
+ slug: string;
6
+ upload?: unknown;
7
+ };
8
+ export type FilterEnabledRelationshipCollectionsOptions = {
9
+ /** `disabledCollections` feature prop — slug blacklist. */
10
+ disabledCollections?: readonly string[];
11
+ /** `enabledCollections` feature prop — slug whitelist. */
12
+ enabledCollections?: readonly string[];
13
+ /** When `true`, only upload-enabled collections; when `false`, only non-upload ones. */
14
+ uploads: boolean;
15
+ /**
16
+ * Slugs the current user can see, supplied by the client at runtime.
17
+ * Server-side type generation passes `undefined` to skip the check.
18
+ */
19
+ visibleSlugs?: readonly string[];
20
+ };
21
+ export declare const filterEnabledRelationshipCollections: <TCollection extends CollectionLike>(collections: readonly TCollection[], { disabledCollections, enabledCollections, uploads, visibleSlugs, }: FilterEnabledRelationshipCollectionsOptions) => TCollection[];
22
+ export {};
23
+ //# sourceMappingURL=filterEnabledRelationshipCollections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filterEnabledRelationshipCollections.d.ts","sourceRoot":"","sources":["../../../../src/features/relationship/shared/filterEnabledRelationshipCollections.ts"],"names":[],"mappings":"AAAA,KAAK,cAAc,GAAG;IACpB,KAAK,CAAC,EAAE;QACN,0BAA0B,CAAC,EAAE,OAAO,CAAA;KACrC,CAAA;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,2CAA2C,GAAG;IACxD,2DAA2D;IAC3D,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACvC,0DAA0D;IAC1D,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACtC,wFAAwF;IACxF,OAAO,EAAE,OAAO,CAAA;IAChB;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CACjC,CAAA;AAED,eAAO,MAAM,oCAAoC,GAAI,WAAW,SAAS,cAAc,EACrF,aAAa,SAAS,WAAW,EAAE,EACnC,qEAKG,2CAA2C,KAC7C,WAAW,EA4Bb,CAAA"}
@@ -0,0 +1,34 @@
1
+ export const filterEnabledRelationshipCollections = (collections, {
2
+ disabledCollections,
3
+ enabledCollections,
4
+ uploads,
5
+ visibleSlugs
6
+ }) => {
7
+ const whitelistSet = enabledCollections?.length ? new Set(enabledCollections) : null;
8
+ const blacklistSet = disabledCollections?.length ? new Set(disabledCollections) : null;
9
+ return collections.filter(collection => {
10
+ const {
11
+ slug,
12
+ admin,
13
+ upload
14
+ } = collection;
15
+ if (visibleSlugs && !visibleSlugs.includes(slug)) {
16
+ return false;
17
+ }
18
+ if (uploads) {
19
+ if (!admin?.enableRichTextRelationship || !upload) {
20
+ return false;
21
+ }
22
+ } else if (upload || !admin?.enableRichTextRelationship) {
23
+ return false;
24
+ }
25
+ if (whitelistSet && !whitelistSet.has(slug)) {
26
+ return false;
27
+ }
28
+ if (blacklistSet && blacklistSet.has(slug)) {
29
+ return false;
30
+ }
31
+ return true;
32
+ });
33
+ };
34
+ //# sourceMappingURL=filterEnabledRelationshipCollections.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filterEnabledRelationshipCollections.js","names":["filterEnabledRelationshipCollections","collections","disabledCollections","enabledCollections","uploads","visibleSlugs","whitelistSet","length","Set","blacklistSet","filter","collection","slug","admin","upload","includes","enableRichTextRelationship","has"],"sources":["../../../../src/features/relationship/shared/filterEnabledRelationshipCollections.ts"],"sourcesContent":["type CollectionLike = {\n admin?: {\n enableRichTextRelationship?: boolean\n }\n slug: string\n upload?: unknown\n}\n\nexport type FilterEnabledRelationshipCollectionsOptions = {\n /** `disabledCollections` feature prop — slug blacklist. */\n disabledCollections?: readonly string[]\n /** `enabledCollections` feature prop — slug whitelist. */\n enabledCollections?: readonly string[]\n /** When `true`, only upload-enabled collections; when `false`, only non-upload ones. */\n uploads: boolean\n /**\n * Slugs the current user can see, supplied by the client at runtime.\n * Server-side type generation passes `undefined` to skip the check.\n */\n visibleSlugs?: readonly string[]\n}\n\nexport const filterEnabledRelationshipCollections = <TCollection extends CollectionLike>(\n collections: readonly TCollection[],\n {\n disabledCollections,\n enabledCollections,\n uploads,\n visibleSlugs,\n }: FilterEnabledRelationshipCollectionsOptions,\n): TCollection[] => {\n const whitelistSet = enabledCollections?.length ? new Set(enabledCollections) : null\n const blacklistSet = disabledCollections?.length ? new Set(disabledCollections) : null\n\n return collections.filter((collection) => {\n const { slug, admin, upload } = collection\n\n if (visibleSlugs && !visibleSlugs.includes(slug)) {\n return false\n }\n\n if (uploads) {\n if (!admin?.enableRichTextRelationship || !upload) {\n return false\n }\n } else if (upload || !admin?.enableRichTextRelationship) {\n return false\n }\n\n if (whitelistSet && !whitelistSet.has(slug)) {\n return false\n }\n if (blacklistSet && blacklistSet.has(slug)) {\n return false\n }\n\n return true\n })\n}\n"],"mappings":"AAsBA,OAAO,MAAMA,oCAAA,GAAuCA,CAClDC,WAAA,EACA;EACEC,mBAAmB;EACnBC,kBAAkB;EAClBC,OAAO;EACPC;AAAY,CACgC;EAE9C,MAAMC,YAAA,GAAeH,kBAAA,EAAoBI,MAAA,GAAS,IAAIC,GAAA,CAAIL,kBAAA,IAAsB;EAChF,MAAMM,YAAA,GAAeP,mBAAA,EAAqBK,MAAA,GAAS,IAAIC,GAAA,CAAIN,mBAAA,IAAuB;EAElF,OAAOD,WAAA,CAAYS,MAAM,CAAEC,UAAA;IACzB,MAAM;MAAEC,IAAI;MAAEC,KAAK;MAAEC;IAAM,CAAE,GAAGH,UAAA;IAEhC,IAAIN,YAAA,IAAgB,CAACA,YAAA,CAAaU,QAAQ,CAACH,IAAA,GAAO;MAChD,OAAO;IACT;IAEA,IAAIR,OAAA,EAAS;MACX,IAAI,CAACS,KAAA,EAAOG,0BAAA,IAA8B,CAACF,MAAA,EAAQ;QACjD,OAAO;MACT;IACF,OAAO,IAAIA,MAAA,IAAU,CAACD,KAAA,EAAOG,0BAAA,EAA4B;MACvD,OAAO;IACT;IAEA,IAAIV,YAAA,IAAgB,CAACA,YAAA,CAAaW,GAAG,CAACL,IAAA,GAAO;MAC3C,OAAO;IACT;IACA,IAAIH,YAAA,IAAgBA,YAAA,CAAaQ,GAAG,CAACL,IAAA,GAAO;MAC1C,OAAO;IACT;IAEA,OAAO;EACT;AACF","ignoreList":[]}
@@ -1,10 +1,11 @@
1
- import type { GenericLanguages, I18n, I18nClient } from '@payloadcms/translations';
1
+ import type { GenericLanguages, I18nClient } from '@payloadcms/translations';
2
2
  import type { JSONSchema4 } from 'json-schema';
3
3
  import type { Klass, LexicalNode, LexicalNodeReplacement, SerializedEditorState, SerializedLexicalNode } from 'lexical';
4
- import type { Field, FieldSchemaMap, ImportMapGenerators, JsonObject, PayloadComponent, PayloadRequest, PopulateType, ReplaceAny, RequestContext, RichTextField, RichTextHooks, SanitizedConfig, TypedFallbackLocale, ValidateOptions, ValidationFieldError } from 'payload';
4
+ import type { Field, FieldSchemaMap, FieldsToJSONSchemaArgs, ImportMapGenerators, JsonObject, PayloadComponent, PayloadRequest, PopulateType, ReplaceAny, RequestContext, RichTextField, RichTextHooks, SanitizedConfig, TypedFallbackLocale, ValidateOptions, ValidationFieldError } from 'payload';
5
5
  import type { ServerEditorConfig } from '../lexical/config/types.js';
6
6
  import type { Transformer } from '../packages/@lexical/markdown/index.js';
7
7
  import type { LexicalRichTextField } from '../types/index.js';
8
+ import type { ElementNodeSchemaFn } from '../types/jsonSchemaHelpers.js';
8
9
  import type { BaseClientFeatureProps } from './typesClient.js';
9
10
  export type PopulationPromise<T extends SerializedLexicalNode = SerializedLexicalNode> = (args: {
10
11
  context: RequestContext;
@@ -150,6 +151,14 @@ export type AfterReadNodeHook<T extends SerializedLexicalNode> = (args: AfterRea
150
151
  export type AfterChangeNodeHook<T extends SerializedLexicalNode> = (args: AfterChangeNodeHookArgs<T> & BaseNodeHookArgs<T>) => Promise<T> | T;
151
152
  export type BeforeChangeNodeHook<T extends SerializedLexicalNode> = (args: BaseNodeHookArgs<T> & BeforeChangeNodeHookArgs<T>) => Promise<T> | T;
152
153
  export type BeforeValidateNodeHook<T extends SerializedLexicalNode> = (args: BaseNodeHookArgs<T> & BeforeValidateNodeHookArgs<T>) => Promise<T> | T;
154
+ /** Arguments passed to each node's `jsonSchema` function. */
155
+ export type JSONSchemaArgs = {
156
+ elementNodeSchema: ElementNodeSchemaFn;
157
+ field: LexicalRichTextField;
158
+ /** TS name of the node union - use in `tsType` annotations. */
159
+ nodeUnionName: string;
160
+ } & Pick<FieldsToJSONSchemaArgs, 'collectionIDFieldTypes' | 'config' | 'i18n' | 'interfaceNameDefinitions' | 'typeStringDefinitions'>;
161
+ export type JSONSchemaFn = (args: JSONSchemaArgs) => JSONSchema4;
153
162
  export type NodeWithHooks<T extends LexicalNode = any> = {
154
163
  /**
155
164
  * If a node includes sub-fields (e.g. block and link nodes), passing those subFields here will make payload
@@ -185,6 +194,12 @@ export type NodeWithHooks<T extends LexicalNode = any> = {
185
194
  beforeChange?: Array<BeforeChangeNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>;
186
195
  beforeValidate?: Array<BeforeValidateNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>;
187
196
  };
197
+ /**
198
+ * Returns the JSON Schema for this node, plus optional standalone TS
199
+ * source for helper types its `tsType` annotations reference. Nodes
200
+ * without this function are omitted from the strictly-typed union.
201
+ */
202
+ jsonSchema?: JSONSchemaFn;
188
203
  /**
189
204
  * The actual lexical node needs to be provided here. This also supports [lexical node replacements](https://lexical.dev/docs/concepts/node-replacement).
190
205
  */
@@ -209,25 +224,6 @@ export type ServerFeature<ServerProps, ClientFeatureProps> = {
209
224
  componentImports?: {
210
225
  [key: string]: PayloadComponent;
211
226
  } | ImportMapGenerators[0] | PayloadComponent[];
212
- generatedTypes?: {
213
- modifyJSONSchema: (args: {
214
- collectionIDFieldTypes: {
215
- [key: string]: 'number' | 'string';
216
- };
217
- config?: SanitizedConfig;
218
- /**
219
- * Current schema which will be modified by this function.
220
- */
221
- currentSchema: JSONSchema4;
222
- field: LexicalRichTextField;
223
- i18n?: I18n;
224
- /**
225
- * Allows you to define new top-level interfaces that can be re-used in the output schema.
226
- */
227
- interfaceNameDefinitions: Map<string, JSONSchema4>;
228
- isRequired: boolean;
229
- }) => JSONSchema4;
230
- };
231
227
  generateSchemaMap?: (args: {
232
228
  config: SanitizedConfig;
233
229
  field: RichTextField;
@@ -272,25 +268,6 @@ export type ServerFeatureProviderMap = Map<string, FeatureProviderServer<any, an
272
268
  export type SanitizedServerFeatures = {
273
269
  /** The keys of all enabled features */
274
270
  enabledFeatures: string[];
275
- generatedTypes: {
276
- modifyJSONSchemas: Array<(args: {
277
- collectionIDFieldTypes: {
278
- [key: string]: 'number' | 'string';
279
- };
280
- config?: SanitizedConfig;
281
- /**
282
- * Current schema which will be modified by this function.
283
- */
284
- currentSchema: JSONSchema4;
285
- field: LexicalRichTextField;
286
- i18n?: I18n;
287
- /**
288
- * Allows you to define new top-level interfaces that can be re-used in the output schema.
289
- */
290
- interfaceNameDefinitions: Map<string, JSONSchema4>;
291
- isRequired: boolean;
292
- }) => JSONSchema4>;
293
- };
294
271
  /** The node types mapped to their hooks */
295
272
  getSubFields?: Map<string, (args: {
296
273
  node: SerializedLexicalNode;
@@ -1 +1 @@
1
- {"version":3,"file":"typesServer.d.ts","sourceRoot":"","sources":["../../src/features/typesServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,KAAK,EACV,KAAK,EACL,WAAW,EACX,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EACV,KAAK,EACL,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,UAAU,EACV,cAAc,EACd,aAAa,EACb,aAAa,EACb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","names":[],"sources":["../../src/features/typesServer.ts"],"sourcesContent":["import type { GenericLanguages, I18n, I18nClient } from '@payloadcms/translations'\nimport type { JSONSchema4 } from 'json-schema'\nimport type {\n Klass,\n LexicalNode,\n LexicalNodeReplacement,\n SerializedEditorState,\n SerializedLexicalNode,\n} from 'lexical'\nimport type {\n Field,\n FieldSchemaMap,\n ImportMapGenerators,\n JsonObject,\n PayloadComponent,\n PayloadRequest,\n PopulateType,\n ReplaceAny,\n RequestContext,\n RichTextField,\n RichTextHooks,\n SanitizedConfig,\n TypedFallbackLocale,\n ValidateOptions,\n ValidationFieldError,\n} from 'payload'\n\nimport type { ServerEditorConfig } from '../lexical/config/types.js'\nimport type { Transformer } from '../packages/@lexical/markdown/index.js'\nimport type { LexicalRichTextField } from '../types/index.js'\nimport type { BaseClientFeatureProps } from './typesClient.js'\n\nexport type PopulationPromise<T extends SerializedLexicalNode = SerializedLexicalNode> = (args: {\n context: RequestContext\n currentDepth: number\n depth: number\n draft: boolean\n /**\n * This maps all population promises to the node type\n */\n editorPopulationPromises: Map<string, Array<PopulationPromise>>\n field: LexicalRichTextField\n /**\n * fieldPromises are used for things like field hooks. They will be awaited before awaiting populationPromises\n */\n fieldPromises: Promise<void>[]\n findMany: boolean\n flattenLocales: boolean\n node: T\n overrideAccess: boolean\n parentIsLocalized: boolean\n populationPromises: Promise<void>[]\n req: PayloadRequest\n showHiddenFields: boolean\n siblingDoc: JsonObject\n}) => void\n\nexport type NodeValidation<T extends SerializedLexicalNode = SerializedLexicalNode> = ({\n node,\n nodeValidations,\n validation,\n}: {\n node: T\n nodeValidations: Map<string, Array<NodeValidation>>\n validation: {\n options: ValidateOptions<unknown, unknown, RichTextField, SerializedEditorState>\n value: SerializedEditorState\n }\n}) => Promise<string | true> | string | true\n\nexport type FeatureProviderProviderServer<\n UnSanitizedServerFeatureProps = undefined,\n ServerFeatureProps = UnSanitizedServerFeatureProps,\n ClientFeatureProps = undefined,\n> = (\n props?: UnSanitizedServerFeatureProps,\n) => FeatureProviderServer<UnSanitizedServerFeatureProps, ServerFeatureProps, ClientFeatureProps>\n\nexport type FeatureProviderServer<\n UnSanitizedServerFeatureProps = undefined,\n ServerFeatureProps = UnSanitizedServerFeatureProps,\n ClientFeatureProps = undefined,\n> = {\n /** Keys of dependencies needed for this feature. These dependencies do not have to be loaded first, but they have to exist, otherwise an error will be thrown. */\n dependencies?: string[]\n /** Keys of priority dependencies needed for this feature. These dependencies have to be loaded first AND have to exist, otherwise an error will be thrown. They will be available in the `feature` property. */\n dependenciesPriority?: string[]\n /** Keys of soft-dependencies needed for this feature. These are optional. Payload will attempt to load them before this feature, but doesn't throw an error if that's not possible. */\n dependenciesSoft?: string[]\n\n /**\n * This is being called during the payload sanitization process\n */\n feature:\n | ((props: {\n config: SanitizedConfig\n /** unSanitizedEditorConfig.features, but mapped */\n featureProviderMap: ServerFeatureProviderMap\n isRoot?: boolean\n parentIsLocalized: boolean\n // other resolved features, which have been loaded before this one. All features declared in 'dependencies' should be available here\n resolvedFeatures: ResolvedServerFeatureMap\n // unSanitized EditorConfig,\n unSanitizedEditorConfig: ServerEditorConfig\n }) =>\n | Promise<ServerFeature<ServerFeatureProps, ClientFeatureProps>>\n | ServerFeature<ServerFeatureProps, ClientFeatureProps>)\n | ServerFeature<ServerFeatureProps, ClientFeatureProps>\n key: string\n /** Props which were passed into your feature will have to be passed here. This will allow them to be used / read in other places of the code, e.g. wherever you can use useEditorConfigContext */\n serverFeatureProps: UnSanitizedServerFeatureProps\n}\n\nexport type AfterReadNodeHookArgs<T extends SerializedLexicalNode> = {\n /**\n * Only available in `afterRead` hooks.\n */\n currentDepth: number\n /**\n * Only available in `afterRead` hooks.\n */\n depth: number\n draft: boolean\n fallbackLocale: TypedFallbackLocale\n /**\n * Only available in `afterRead` field hooks.\n */\n fieldPromises: Promise<void>[]\n /** Boolean to denote if this hook is running against finding one, or finding many within the afterRead hook. */\n findMany: boolean\n flattenLocales: boolean\n /**\n * The requested locale.\n */\n locale: string\n overrideAccess: boolean\n /**\n * Only available in `afterRead` hooks.\n */\n populateArg?: PopulateType\n /**\n * Only available in `afterRead` field hooks.\n */\n populationPromises: Promise<void>[]\n /**\n * Only available in `afterRead` hooks.\n */\n showHiddenFields: boolean\n /**\n * Only available in `afterRead` hooks.\n */\n triggerAccessControl: boolean\n /**\n * Only available in `afterRead` hooks.\n */\n triggerHooks: boolean\n}\n\nexport type AfterChangeNodeHookArgs<T extends SerializedLexicalNode> = {\n /** A string relating to which operation the field type is currently executing within. Useful within beforeValidate, beforeChange, and afterChange hooks to differentiate between create and update operations. */\n operation: 'create' | 'delete' | 'read' | 'update'\n /** The value of the node before any changes. Not available in afterRead hooks */\n originalNode: T\n previousNode: T\n}\nexport type BeforeValidateNodeHookArgs<T extends SerializedLexicalNode> = {\n /** A string relating to which operation the field type is currently executing within. Useful within beforeValidate, beforeChange, and afterChange hooks to differentiate between create and update operations. */\n operation: 'create' | 'delete' | 'read' | 'update'\n /** The value of the node before any changes. Not available in afterRead hooks */\n originalNode: T\n overrideAccess: boolean\n}\n\nexport type BeforeChangeNodeHookArgs<T extends SerializedLexicalNode> = {\n /**\n * Only available in `beforeChange` hooks.\n */\n errors: ValidationFieldError[]\n mergeLocaleActions: (() => Promise<void> | void)[]\n /** A string relating to which operation the field type is currently executing within. Useful within beforeValidate, beforeChange, and afterChange hooks to differentiate between create and update operations. */\n operation: 'create' | 'delete' | 'read' | 'update'\n /** The value of the node before any changes. Not available in afterRead hooks */\n originalNode: T\n /**\n * The original node with locales (not modified by any hooks).\n */\n originalNodeWithLocales?: T\n previousNode: T\n\n skipValidation: boolean\n}\n\nexport type BaseNodeHookArgs<T extends SerializedLexicalNode> = {\n context: RequestContext\n /** The value of the node. */\n node: T\n parentRichTextFieldPath: (number | string)[]\n parentRichTextFieldSchemaPath: string[]\n /** The payload request object. It is mocked for Local API operations. */\n req: PayloadRequest\n}\n\nexport type AfterReadNodeHook<T extends SerializedLexicalNode> = (\n args: AfterReadNodeHookArgs<T> & BaseNodeHookArgs<T>,\n) => Promise<T> | T\n\nexport type AfterChangeNodeHook<T extends SerializedLexicalNode> = (\n args: AfterChangeNodeHookArgs<T> & BaseNodeHookArgs<T>,\n) => Promise<T> | T\n\nexport type BeforeChangeNodeHook<T extends SerializedLexicalNode> = (\n args: BaseNodeHookArgs<T> & BeforeChangeNodeHookArgs<T>,\n) => Promise<T> | T\n\nexport type BeforeValidateNodeHook<T extends SerializedLexicalNode> = (\n args: BaseNodeHookArgs<T> & BeforeValidateNodeHookArgs<T>,\n) => Promise<T> | T\n\n// Define the node with hooks that use the node's exportJSON return type\nexport type NodeWithHooks<T extends LexicalNode = any> = {\n /**\n * If a node includes sub-fields (e.g. block and link nodes), passing those subFields here will make payload\n * automatically populate, run hooks, and generate component import maps for them\n */\n getSubFields?: (args: {\n /**\n * Optional. If not provided, all possible sub-fields should be returned.\n */\n node?: ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>\n req?: PayloadRequest\n }) => Field[] | null\n /**\n * If a node includes sub-fields, the sub-fields data needs to be returned here, alongside `getSubFields` which returns their schema.\n */\n getSubFieldsData?: (args: {\n node: ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>\n req: PayloadRequest\n }) => JsonObject\n /**\n * Allows you to run population logic when a node's data was requested from graphQL.\n * While `getSubFields` and `getSubFieldsData` automatically handle populating sub-fields (since they run hooks on them), those are only populated in the Rest API.\n * This is because the Rest API hooks do not have access to the 'depth' property provided by graphQL.\n * In order for them to be populated correctly in graphQL, the population logic needs to be provided here.\n */\n graphQLPopulationPromises?: Array<\n PopulationPromise<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>\n >\n /**\n * Just like payload fields, you can provide hooks which are run for this specific node. These are called Node Hooks.\n */\n hooks?: {\n afterChange?: Array<AfterChangeNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n afterRead?: Array<AfterReadNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n beforeChange?: Array<BeforeChangeNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n beforeValidate?: Array<\n BeforeValidateNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>\n >\n }\n /**\n * The actual lexical node needs to be provided here. This also supports [lexical node replacements](https://lexical.dev/docs/concepts/node-replacement).\n */\n node: Klass<T> | LexicalNodeReplacement\n /**\n * This allows you to provide node validations, which are run when your document is being validated, alongside other payload fields.\n * You can use it to throw a validation error for a specific node in case its data is incorrect.\n */\n validations?: Array<NodeValidation<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n}\n\nexport type ServerFeature<ServerProps, ClientFeatureProps> = {\n ClientFeature?: PayloadComponent<never, BaseClientFeatureProps<ClientFeatureProps>>\n /**\n * This determines what props will be available on the Client.\n */\n clientFeatureProps?: ClientFeatureProps\n /**\n * Adds payload components to the importMap.\n *\n * If an object is provided, the imported components will automatically be made available to the client feature, keyed by the object's keys.\n */\n componentImports?:\n | {\n [key: string]: PayloadComponent\n }\n | ImportMapGenerators[0]\n | PayloadComponent[]\n generatedTypes?: {\n modifyJSONSchema: (args: {\n collectionIDFieldTypes: { [key: string]: 'number' | 'string' }\n config?: SanitizedConfig\n /**\n * Current schema which will be modified by this function.\n */\n currentSchema: JSONSchema4\n field: LexicalRichTextField\n i18n?: I18n\n /**\n * Allows you to define new top-level interfaces that can be re-used in the output schema.\n */\n interfaceNameDefinitions: Map<string, JSONSchema4>\n isRequired: boolean\n }) => JSONSchema4\n }\n generateSchemaMap?: (args: {\n config: SanitizedConfig\n field: RichTextField\n i18n: I18nClient\n props: ServerProps\n schemaMap: FieldSchemaMap\n schemaPath: string\n }) => FieldSchemaMap | null\n hooks?: RichTextHooks\n /**\n * Here you can provide i18n translations for your feature. These will only be available on the server and client.\n *\n * Translations here are automatically scoped to `lexical.featureKey.yourKey`\n *\n * @Example\n * ```ts\n * i18n: {\n * en: {\n * label: 'Horizontal Rule',\n * },\n * de: {\n * label: 'Trennlinie',\n * },\n * }\n * ```\n * In order to access these translations, you would use `i18n.t('lexical:horizontalRule:label')`.\n */\n i18n?: Partial<GenericLanguages>\n markdownTransformers?: (\n | ((props: { allNodes: Array<NodeWithHooks>; allTransformers: Transformer[] }) => Transformer)\n | Transformer\n )[]\n nodes?: Array<NodeWithHooks>\n\n /** Props which were passed into your feature will have to be passed here. This will allow them to be used / read in other places of the code, e.g. wherever you can use useEditorConfigContext */\n sanitizedServerFeatureProps?: ServerProps\n}\n\nexport type ResolvedServerFeature<ServerProps, ClientFeatureProps> = {\n order: number\n} & Required<\n Pick<\n FeatureProviderServer<ServerProps, ClientFeatureProps>,\n 'dependencies' | 'dependenciesPriority' | 'dependenciesSoft' | 'key'\n >\n> &\n ServerFeature<ServerProps, ClientFeatureProps>\n\nexport type ResolvedServerFeatureMap = Map<string, ResolvedServerFeature<any, any>>\n\nexport type ServerFeatureProviderMap = Map<string, FeatureProviderServer<any, any, any>>\n\nexport type SanitizedServerFeatures = {\n /** The keys of all enabled features */\n enabledFeatures: string[]\n generatedTypes: {\n modifyJSONSchemas: Array<\n (args: {\n collectionIDFieldTypes: { [key: string]: 'number' | 'string' }\n config?: SanitizedConfig\n /**\n * Current schema which will be modified by this function.\n */\n currentSchema: JSONSchema4\n field: LexicalRichTextField\n i18n?: I18n\n /**\n * Allows you to define new top-level interfaces that can be re-used in the output schema.\n */\n interfaceNameDefinitions: Map<string, JSONSchema4>\n isRequired: boolean\n }) => JSONSchema4\n >\n }\n /** The node types mapped to their hooks */\n\n getSubFields?: Map<\n string,\n (args: { node: SerializedLexicalNode; req: PayloadRequest }) => Field[] | null\n >\n getSubFieldsData?: Map<\n string,\n (args: { node: SerializedLexicalNode; req: PayloadRequest }) => JsonObject\n >\n graphQLPopulationPromises: Map<string, Array<PopulationPromise>>\n hooks: RichTextHooks\n markdownTransformers: Transformer[]\n nodeHooks?: {\n afterChange?: Map<string, Array<AfterChangeNodeHook<SerializedLexicalNode>>>\n afterRead?: Map<string, Array<AfterReadNodeHook<SerializedLexicalNode>>>\n beforeChange?: Map<string, Array<BeforeChangeNodeHook<SerializedLexicalNode>>>\n beforeValidate?: Map<string, Array<BeforeValidateNodeHook<SerializedLexicalNode>>>\n } /** The node types mapped to their populationPromises */\n /** The node types mapped to their validations */\n validations: Map<string, Array<NodeValidation>>\n} & Required<Pick<ResolvedServerFeature<any, any>, 'i18n' | 'nodes'>>\n"],"mappings":"AAmWA","ignoreList":[]}
1
+ {"version":3,"file":"typesServer.js","names":[],"sources":["../../src/features/typesServer.ts"],"sourcesContent":["import type { GenericLanguages, I18nClient } from '@payloadcms/translations'\nimport type { JSONSchema4 } from 'json-schema'\nimport type {\n Klass,\n LexicalNode,\n LexicalNodeReplacement,\n SerializedEditorState,\n SerializedLexicalNode,\n} from 'lexical'\nimport type {\n Field,\n FieldSchemaMap,\n FieldsToJSONSchemaArgs,\n ImportMapGenerators,\n JsonObject,\n PayloadComponent,\n PayloadRequest,\n PopulateType,\n ReplaceAny,\n RequestContext,\n RichTextField,\n RichTextHooks,\n SanitizedConfig,\n TypedFallbackLocale,\n ValidateOptions,\n ValidationFieldError,\n} from 'payload'\n\nimport type { ServerEditorConfig } from '../lexical/config/types.js'\nimport type { Transformer } from '../packages/@lexical/markdown/index.js'\nimport type { LexicalRichTextField } from '../types/index.js'\nimport type { ElementNodeSchemaFn } from '../types/jsonSchemaHelpers.js'\nimport type { BaseClientFeatureProps } from './typesClient.js'\n\nexport type PopulationPromise<T extends SerializedLexicalNode = SerializedLexicalNode> = (args: {\n context: RequestContext\n currentDepth: number\n depth: number\n draft: boolean\n /**\n * This maps all population promises to the node type\n */\n editorPopulationPromises: Map<string, Array<PopulationPromise>>\n field: LexicalRichTextField\n /**\n * fieldPromises are used for things like field hooks. They will be awaited before awaiting populationPromises\n */\n fieldPromises: Promise<void>[]\n findMany: boolean\n flattenLocales: boolean\n node: T\n overrideAccess: boolean\n parentIsLocalized: boolean\n populationPromises: Promise<void>[]\n req: PayloadRequest\n showHiddenFields: boolean\n siblingDoc: JsonObject\n}) => void\n\nexport type NodeValidation<T extends SerializedLexicalNode = SerializedLexicalNode> = ({\n node,\n nodeValidations,\n validation,\n}: {\n node: T\n nodeValidations: Map<string, Array<NodeValidation>>\n validation: {\n options: ValidateOptions<unknown, unknown, RichTextField, SerializedEditorState>\n value: SerializedEditorState\n }\n}) => Promise<string | true> | string | true\n\nexport type FeatureProviderProviderServer<\n UnSanitizedServerFeatureProps = undefined,\n ServerFeatureProps = UnSanitizedServerFeatureProps,\n ClientFeatureProps = undefined,\n> = (\n props?: UnSanitizedServerFeatureProps,\n) => FeatureProviderServer<UnSanitizedServerFeatureProps, ServerFeatureProps, ClientFeatureProps>\n\nexport type FeatureProviderServer<\n UnSanitizedServerFeatureProps = undefined,\n ServerFeatureProps = UnSanitizedServerFeatureProps,\n ClientFeatureProps = undefined,\n> = {\n /** Keys of dependencies needed for this feature. These dependencies do not have to be loaded first, but they have to exist, otherwise an error will be thrown. */\n dependencies?: string[]\n /** Keys of priority dependencies needed for this feature. These dependencies have to be loaded first AND have to exist, otherwise an error will be thrown. They will be available in the `feature` property. */\n dependenciesPriority?: string[]\n /** Keys of soft-dependencies needed for this feature. These are optional. Payload will attempt to load them before this feature, but doesn't throw an error if that's not possible. */\n dependenciesSoft?: string[]\n\n /**\n * This is being called during the payload sanitization process\n */\n feature:\n | ((props: {\n config: SanitizedConfig\n /** unSanitizedEditorConfig.features, but mapped */\n featureProviderMap: ServerFeatureProviderMap\n isRoot?: boolean\n parentIsLocalized: boolean\n // other resolved features, which have been loaded before this one. All features declared in 'dependencies' should be available here\n resolvedFeatures: ResolvedServerFeatureMap\n // unSanitized EditorConfig,\n unSanitizedEditorConfig: ServerEditorConfig\n }) =>\n | Promise<ServerFeature<ServerFeatureProps, ClientFeatureProps>>\n | ServerFeature<ServerFeatureProps, ClientFeatureProps>)\n | ServerFeature<ServerFeatureProps, ClientFeatureProps>\n key: string\n /** Props which were passed into your feature will have to be passed here. This will allow them to be used / read in other places of the code, e.g. wherever you can use useEditorConfigContext */\n serverFeatureProps: UnSanitizedServerFeatureProps\n}\n\nexport type AfterReadNodeHookArgs<T extends SerializedLexicalNode> = {\n /**\n * Only available in `afterRead` hooks.\n */\n currentDepth: number\n /**\n * Only available in `afterRead` hooks.\n */\n depth: number\n draft: boolean\n fallbackLocale: TypedFallbackLocale\n /**\n * Only available in `afterRead` field hooks.\n */\n fieldPromises: Promise<void>[]\n /** Boolean to denote if this hook is running against finding one, or finding many within the afterRead hook. */\n findMany: boolean\n flattenLocales: boolean\n /**\n * The requested locale.\n */\n locale: string\n overrideAccess: boolean\n /**\n * Only available in `afterRead` hooks.\n */\n populateArg?: PopulateType\n /**\n * Only available in `afterRead` field hooks.\n */\n populationPromises: Promise<void>[]\n /**\n * Only available in `afterRead` hooks.\n */\n showHiddenFields: boolean\n /**\n * Only available in `afterRead` hooks.\n */\n triggerAccessControl: boolean\n /**\n * Only available in `afterRead` hooks.\n */\n triggerHooks: boolean\n}\n\nexport type AfterChangeNodeHookArgs<T extends SerializedLexicalNode> = {\n /** A string relating to which operation the field type is currently executing within. Useful within beforeValidate, beforeChange, and afterChange hooks to differentiate between create and update operations. */\n operation: 'create' | 'delete' | 'read' | 'update'\n /** The value of the node before any changes. Not available in afterRead hooks */\n originalNode: T\n previousNode: T\n}\nexport type BeforeValidateNodeHookArgs<T extends SerializedLexicalNode> = {\n /** A string relating to which operation the field type is currently executing within. Useful within beforeValidate, beforeChange, and afterChange hooks to differentiate between create and update operations. */\n operation: 'create' | 'delete' | 'read' | 'update'\n /** The value of the node before any changes. Not available in afterRead hooks */\n originalNode: T\n overrideAccess: boolean\n}\n\nexport type BeforeChangeNodeHookArgs<T extends SerializedLexicalNode> = {\n /**\n * Only available in `beforeChange` hooks.\n */\n errors: ValidationFieldError[]\n mergeLocaleActions: (() => Promise<void> | void)[]\n /** A string relating to which operation the field type is currently executing within. Useful within beforeValidate, beforeChange, and afterChange hooks to differentiate between create and update operations. */\n operation: 'create' | 'delete' | 'read' | 'update'\n /** The value of the node before any changes. Not available in afterRead hooks */\n originalNode: T\n /**\n * The original node with locales (not modified by any hooks).\n */\n originalNodeWithLocales?: T\n previousNode: T\n\n skipValidation: boolean\n}\n\nexport type BaseNodeHookArgs<T extends SerializedLexicalNode> = {\n context: RequestContext\n /** The value of the node. */\n node: T\n parentRichTextFieldPath: (number | string)[]\n parentRichTextFieldSchemaPath: string[]\n /** The payload request object. It is mocked for Local API operations. */\n req: PayloadRequest\n}\n\nexport type AfterReadNodeHook<T extends SerializedLexicalNode> = (\n args: AfterReadNodeHookArgs<T> & BaseNodeHookArgs<T>,\n) => Promise<T> | T\n\nexport type AfterChangeNodeHook<T extends SerializedLexicalNode> = (\n args: AfterChangeNodeHookArgs<T> & BaseNodeHookArgs<T>,\n) => Promise<T> | T\n\nexport type BeforeChangeNodeHook<T extends SerializedLexicalNode> = (\n args: BaseNodeHookArgs<T> & BeforeChangeNodeHookArgs<T>,\n) => Promise<T> | T\n\nexport type BeforeValidateNodeHook<T extends SerializedLexicalNode> = (\n args: BaseNodeHookArgs<T> & BeforeValidateNodeHookArgs<T>,\n) => Promise<T> | T\n\n/** Arguments passed to each node's `jsonSchema` function. */\nexport type JSONSchemaArgs = {\n elementNodeSchema: ElementNodeSchemaFn\n field: LexicalRichTextField\n /** TS name of the node union - use in `tsType` annotations. */\n nodeUnionName: string\n} & Pick<\n FieldsToJSONSchemaArgs,\n | 'collectionIDFieldTypes'\n | 'config'\n | 'i18n'\n | 'interfaceNameDefinitions'\n | 'typeStringDefinitions'\n>\n\nexport type JSONSchemaFn = (args: JSONSchemaArgs) => JSONSchema4\n\n// Define the node with hooks that use the node's exportJSON return type\nexport type NodeWithHooks<T extends LexicalNode = any> = {\n /**\n * If a node includes sub-fields (e.g. block and link nodes), passing those subFields here will make payload\n * automatically populate, run hooks, and generate component import maps for them\n */\n getSubFields?: (args: {\n /**\n * Optional. If not provided, all possible sub-fields should be returned.\n */\n node?: ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>\n req?: PayloadRequest\n }) => Field[] | null\n /**\n * If a node includes sub-fields, the sub-fields data needs to be returned here, alongside `getSubFields` which returns their schema.\n */\n getSubFieldsData?: (args: {\n node: ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>\n req: PayloadRequest\n }) => JsonObject\n /**\n * Allows you to run population logic when a node's data was requested from graphQL.\n * While `getSubFields` and `getSubFieldsData` automatically handle populating sub-fields (since they run hooks on them), those are only populated in the Rest API.\n * This is because the Rest API hooks do not have access to the 'depth' property provided by graphQL.\n * In order for them to be populated correctly in graphQL, the population logic needs to be provided here.\n */\n graphQLPopulationPromises?: Array<\n PopulationPromise<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>\n >\n /**\n * Just like payload fields, you can provide hooks which are run for this specific node. These are called Node Hooks.\n */\n hooks?: {\n afterChange?: Array<AfterChangeNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n afterRead?: Array<AfterReadNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n beforeChange?: Array<BeforeChangeNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n beforeValidate?: Array<\n BeforeValidateNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>\n >\n }\n /**\n * Returns the JSON Schema for this node, plus optional standalone TS\n * source for helper types its `tsType` annotations reference. Nodes\n * without this function are omitted from the strictly-typed union.\n */\n jsonSchema?: JSONSchemaFn\n /**\n * The actual lexical node needs to be provided here. This also supports [lexical node replacements](https://lexical.dev/docs/concepts/node-replacement).\n */\n node: Klass<T> | LexicalNodeReplacement\n /**\n * This allows you to provide node validations, which are run when your document is being validated, alongside other payload fields.\n * You can use it to throw a validation error for a specific node in case its data is incorrect.\n */\n validations?: Array<NodeValidation<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n}\n\nexport type ServerFeature<ServerProps, ClientFeatureProps> = {\n ClientFeature?: PayloadComponent<never, BaseClientFeatureProps<ClientFeatureProps>>\n /**\n * This determines what props will be available on the Client.\n */\n clientFeatureProps?: ClientFeatureProps\n /**\n * Adds payload components to the importMap.\n *\n * If an object is provided, the imported components will automatically be made available to the client feature, keyed by the object's keys.\n */\n componentImports?:\n | {\n [key: string]: PayloadComponent\n }\n | ImportMapGenerators[0]\n | PayloadComponent[]\n generateSchemaMap?: (args: {\n config: SanitizedConfig\n field: RichTextField\n i18n: I18nClient\n props: ServerProps\n schemaMap: FieldSchemaMap\n schemaPath: string\n }) => FieldSchemaMap | null\n hooks?: RichTextHooks\n /**\n * Here you can provide i18n translations for your feature. These will only be available on the server and client.\n *\n * Translations here are automatically scoped to `lexical.featureKey.yourKey`\n *\n * @Example\n * ```ts\n * i18n: {\n * en: {\n * label: 'Horizontal Rule',\n * },\n * de: {\n * label: 'Trennlinie',\n * },\n * }\n * ```\n * In order to access these translations, you would use `i18n.t('lexical:horizontalRule:label')`.\n */\n i18n?: Partial<GenericLanguages>\n markdownTransformers?: (\n | ((props: { allNodes: Array<NodeWithHooks>; allTransformers: Transformer[] }) => Transformer)\n | Transformer\n )[]\n nodes?: Array<NodeWithHooks>\n\n /** Props which were passed into your feature will have to be passed here. This will allow them to be used / read in other places of the code, e.g. wherever you can use useEditorConfigContext */\n sanitizedServerFeatureProps?: ServerProps\n}\n\nexport type ResolvedServerFeature<ServerProps, ClientFeatureProps> = {\n order: number\n} & Required<\n Pick<\n FeatureProviderServer<ServerProps, ClientFeatureProps>,\n 'dependencies' | 'dependenciesPriority' | 'dependenciesSoft' | 'key'\n >\n> &\n ServerFeature<ServerProps, ClientFeatureProps>\n\nexport type ResolvedServerFeatureMap = Map<string, ResolvedServerFeature<any, any>>\n\nexport type ServerFeatureProviderMap = Map<string, FeatureProviderServer<any, any, any>>\n\nexport type SanitizedServerFeatures = {\n /** The keys of all enabled features */\n enabledFeatures: string[]\n /** The node types mapped to their hooks */\n\n getSubFields?: Map<\n string,\n (args: { node: SerializedLexicalNode; req: PayloadRequest }) => Field[] | null\n >\n getSubFieldsData?: Map<\n string,\n (args: { node: SerializedLexicalNode; req: PayloadRequest }) => JsonObject\n >\n graphQLPopulationPromises: Map<string, Array<PopulationPromise>>\n hooks: RichTextHooks\n markdownTransformers: Transformer[]\n nodeHooks?: {\n afterChange?: Map<string, Array<AfterChangeNodeHook<SerializedLexicalNode>>>\n afterRead?: Map<string, Array<AfterReadNodeHook<SerializedLexicalNode>>>\n beforeChange?: Map<string, Array<BeforeChangeNodeHook<SerializedLexicalNode>>>\n beforeValidate?: Map<string, Array<BeforeValidateNodeHook<SerializedLexicalNode>>>\n } /** The node types mapped to their populationPromises */\n /** The node types mapped to their validations */\n validations: Map<string, Array<NodeValidation>>\n} & Required<Pick<ResolvedServerFeature<any, any>, 'i18n' | 'nodes'>>\n"],"mappings":"AA2WA","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import { type ElementFormatType } from 'lexical';
2
2
  import React from 'react';
3
- import type { UploadData } from '../../server/nodes/UploadNode.js';
3
+ import type { UploadData } from '../../server/schema.js';
4
4
  import './index.css';
5
5
  export type ElementProps = {
6
6
  className: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/upload/client/component/index.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAKL,KAAK,iBAAiB,EACvB,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAsE,MAAM,OAAO,CAAA;AAG1F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AASlE,OAAO,aAAa,CAAA;AAMpB,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,UAAU,CAAA;IAChB,MAAM,CAAC,EAAE,iBAAiB,CAAA;IAC1B,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAqOlD,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/upload/client/component/index.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAKL,KAAK,iBAAiB,EACvB,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAsE,MAAM,OAAO,CAAA;AAG1F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AASxD,OAAO,aAAa,CAAA;AAMpB,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,UAAU,CAAA;IAChB,MAAM,CAAC,EAAE,iBAAiB,CAAA;IAC1B,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAqOlD,CAAA"}