@fluidframework/tree 2.1.0-276326 → 2.1.0-281041

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 (442) hide show
  1. package/.eslintrc.cjs +7 -0
  2. package/.vscode/Tree.code-workspace +7 -1
  3. package/README.md +134 -29
  4. package/api-report/tree.alpha.api.md +1 -0
  5. package/api-report/tree.beta.api.md +1 -0
  6. package/api-report/tree.public.api.md +1 -0
  7. package/beta.d.ts +1 -1
  8. package/dist/beta.d.ts +1 -1
  9. package/dist/core/forest/editableForest.d.ts +6 -3
  10. package/dist/core/forest/editableForest.d.ts.map +1 -1
  11. package/dist/core/forest/editableForest.js +14 -4
  12. package/dist/core/forest/editableForest.js.map +1 -1
  13. package/dist/core/index.d.ts +1 -1
  14. package/dist/core/index.d.ts.map +1 -1
  15. package/dist/core/index.js +3 -1
  16. package/dist/core/index.js.map +1 -1
  17. package/dist/core/rebase/index.d.ts +1 -1
  18. package/dist/core/rebase/index.d.ts.map +1 -1
  19. package/dist/core/rebase/index.js +3 -1
  20. package/dist/core/rebase/index.js.map +1 -1
  21. package/dist/core/rebase/types.d.ts +2 -0
  22. package/dist/core/rebase/types.d.ts.map +1 -1
  23. package/dist/core/rebase/types.js +9 -1
  24. package/dist/core/rebase/types.js.map +1 -1
  25. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  26. package/dist/core/tree/visitDelta.js.map +1 -1
  27. package/dist/events/events.d.ts +4 -1
  28. package/dist/events/events.d.ts.map +1 -1
  29. package/dist/events/events.js.map +1 -1
  30. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +1 -1
  31. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  32. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  33. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +1 -0
  34. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  35. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +0 -2
  36. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  37. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js +0 -20
  38. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  39. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +0 -38
  40. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  41. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  42. package/dist/feature-libraries/flex-tree/index.d.ts +1 -1
  43. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  44. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  45. package/dist/feature-libraries/flex-tree/lazyField.d.ts +0 -4
  46. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  47. package/dist/feature-libraries/flex-tree/lazyField.js +1 -14
  48. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  49. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +0 -1
  50. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  51. package/dist/feature-libraries/flex-tree/lazyNode.js +0 -3
  52. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  53. package/dist/feature-libraries/index.d.ts +3 -3
  54. package/dist/feature-libraries/index.d.ts.map +1 -1
  55. package/dist/feature-libraries/index.js +2 -2
  56. package/dist/feature-libraries/index.js.map +1 -1
  57. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +11 -0
  58. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  59. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  60. package/dist/feature-libraries/modular-schema/discrepancies.d.ts +96 -0
  61. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -0
  62. package/dist/feature-libraries/modular-schema/discrepancies.js +264 -0
  63. package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -0
  64. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +9 -2
  65. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  66. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  67. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  68. package/dist/feature-libraries/modular-schema/genericFieldKind.js +3 -0
  69. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  70. package/dist/feature-libraries/modular-schema/index.d.ts +2 -1
  71. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  72. package/dist/feature-libraries/modular-schema/index.js +3 -1
  73. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  74. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  75. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +42 -26
  76. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  77. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +51 -2
  78. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  79. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +830 -245
  80. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  81. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  82. package/dist/feature-libraries/modular-schema/modularChangeFormat.js +2 -0
  83. package/dist/feature-libraries/modular-schema/modularChangeFormat.js.map +1 -1
  84. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +44 -1
  85. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  86. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  87. package/dist/feature-libraries/node-key/index.d.ts +0 -1
  88. package/dist/feature-libraries/node-key/index.d.ts.map +1 -1
  89. package/dist/feature-libraries/node-key/index.js +1 -3
  90. package/dist/feature-libraries/node-key/index.js.map +1 -1
  91. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  92. package/dist/feature-libraries/optional-field/optionalField.js +1 -0
  93. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  94. package/dist/feature-libraries/sequence-field/index.d.ts +1 -1
  95. package/dist/feature-libraries/sequence-field/index.d.ts.map +1 -1
  96. package/dist/feature-libraries/sequence-field/index.js +1 -2
  97. package/dist/feature-libraries/sequence-field/index.js.map +1 -1
  98. package/dist/feature-libraries/sequence-field/invert.js +1 -1
  99. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  100. package/dist/feature-libraries/sequence-field/rebase.js +6 -1
  101. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  102. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
  103. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +1 -0
  104. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
  105. package/dist/feature-libraries/sequence-field/utils.d.ts +2 -17
  106. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  107. package/dist/feature-libraries/sequence-field/utils.js +31 -39
  108. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  109. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +1 -0
  110. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  111. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +2 -0
  112. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  113. package/dist/index.d.ts +1 -1
  114. package/dist/index.d.ts.map +1 -1
  115. package/dist/index.js.map +1 -1
  116. package/dist/packageVersion.d.ts +1 -1
  117. package/dist/packageVersion.js +1 -1
  118. package/dist/packageVersion.js.map +1 -1
  119. package/dist/public.d.ts +1 -1
  120. package/dist/shared-tree/schematizingTreeView.d.ts +4 -2
  121. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  122. package/dist/shared-tree/schematizingTreeView.js +240 -184
  123. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  124. package/dist/shared-tree/sharedTree.d.ts +3 -2
  125. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  126. package/dist/shared-tree/sharedTree.js +150 -90
  127. package/dist/shared-tree/sharedTree.js.map +1 -1
  128. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  129. package/dist/shared-tree/treeCheckout.js +2 -1
  130. package/dist/shared-tree/treeCheckout.js.map +1 -1
  131. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  132. package/dist/shared-tree-core/branch.js +1 -0
  133. package/dist/shared-tree-core/branch.js.map +1 -1
  134. package/dist/shared-tree-core/sharedTreeCore.d.ts +4 -6
  135. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  136. package/dist/shared-tree-core/sharedTreeCore.js +265 -209
  137. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  138. package/dist/simple-tree/arrayNode.d.ts +4 -0
  139. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  140. package/dist/simple-tree/arrayNode.js +36 -19
  141. package/dist/simple-tree/arrayNode.js.map +1 -1
  142. package/dist/simple-tree/leafNodeSchema.d.ts +22 -1
  143. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  144. package/dist/simple-tree/leafNodeSchema.js +2 -1
  145. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  146. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  147. package/dist/simple-tree/mapNode.js.map +1 -1
  148. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  149. package/dist/simple-tree/objectNode.js +2 -1
  150. package/dist/simple-tree/objectNode.js.map +1 -1
  151. package/dist/simple-tree/proxies.d.ts.map +1 -1
  152. package/dist/simple-tree/proxies.js +2 -4
  153. package/dist/simple-tree/proxies.js.map +1 -1
  154. package/dist/simple-tree/schemaFactory.d.ts +24 -1
  155. package/dist/simple-tree/schemaFactory.d.ts.map +1 -1
  156. package/dist/simple-tree/schemaFactory.js +40 -4
  157. package/dist/simple-tree/schemaFactory.js.map +1 -1
  158. package/dist/simple-tree/schemaTypes.d.ts +36 -1
  159. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  160. package/dist/simple-tree/schemaTypes.js.map +1 -1
  161. package/dist/simple-tree/toFlexSchema.d.ts +2 -2
  162. package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
  163. package/dist/simple-tree/toFlexSchema.js +3 -2
  164. package/dist/simple-tree/toFlexSchema.js.map +1 -1
  165. package/dist/simple-tree/tree.d.ts +4 -1
  166. package/dist/simple-tree/tree.d.ts.map +1 -1
  167. package/dist/simple-tree/tree.js +48 -1
  168. package/dist/simple-tree/tree.js.map +1 -1
  169. package/dist/simple-tree/treeNodeApi.d.ts.map +1 -1
  170. package/dist/simple-tree/treeNodeApi.js +10 -10
  171. package/dist/simple-tree/treeNodeApi.js.map +1 -1
  172. package/dist/simple-tree/types.d.ts +22 -3
  173. package/dist/simple-tree/types.d.ts.map +1 -1
  174. package/dist/simple-tree/types.js +32 -21
  175. package/dist/simple-tree/types.js.map +1 -1
  176. package/dist/util/breakable.d.ts +83 -0
  177. package/dist/util/breakable.d.ts.map +1 -0
  178. package/dist/util/breakable.js +178 -0
  179. package/dist/util/breakable.js.map +1 -0
  180. package/dist/util/index.d.ts +3 -2
  181. package/dist/util/index.d.ts.map +1 -1
  182. package/dist/util/index.js +9 -2
  183. package/dist/util/index.js.map +1 -1
  184. package/dist/util/nestedMap.d.ts +23 -3
  185. package/dist/util/nestedMap.d.ts.map +1 -1
  186. package/dist/util/nestedMap.js +38 -7
  187. package/dist/util/nestedMap.js.map +1 -1
  188. package/dist/util/utils.d.ts +7 -0
  189. package/dist/util/utils.d.ts.map +1 -1
  190. package/dist/util/utils.js +15 -1
  191. package/dist/util/utils.js.map +1 -1
  192. package/docs/README.md +1 -1
  193. package/docs/main/compatibility.md +1 -1
  194. package/docs/main/stored-and-view-schema.md +1 -1
  195. package/internal.d.ts +1 -1
  196. package/lib/beta.d.ts +1 -1
  197. package/lib/core/forest/editableForest.d.ts +6 -3
  198. package/lib/core/forest/editableForest.d.ts.map +1 -1
  199. package/lib/core/forest/editableForest.js +15 -5
  200. package/lib/core/forest/editableForest.js.map +1 -1
  201. package/lib/core/index.d.ts +1 -1
  202. package/lib/core/index.d.ts.map +1 -1
  203. package/lib/core/index.js +1 -1
  204. package/lib/core/index.js.map +1 -1
  205. package/lib/core/rebase/index.d.ts +1 -1
  206. package/lib/core/rebase/index.d.ts.map +1 -1
  207. package/lib/core/rebase/index.js +1 -1
  208. package/lib/core/rebase/index.js.map +1 -1
  209. package/lib/core/rebase/types.d.ts +2 -0
  210. package/lib/core/rebase/types.d.ts.map +1 -1
  211. package/lib/core/rebase/types.js +7 -1
  212. package/lib/core/rebase/types.js.map +1 -1
  213. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  214. package/lib/core/tree/visitDelta.js.map +1 -1
  215. package/lib/events/events.d.ts +4 -1
  216. package/lib/events/events.d.ts.map +1 -1
  217. package/lib/events/events.js.map +1 -1
  218. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +1 -1
  219. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  220. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  221. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -0
  222. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  223. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts +0 -2
  224. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  225. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js +0 -20
  226. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  227. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +0 -38
  228. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  229. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  230. package/lib/feature-libraries/flex-tree/index.d.ts +1 -1
  231. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  232. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  233. package/lib/feature-libraries/flex-tree/lazyField.d.ts +0 -4
  234. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  235. package/lib/feature-libraries/flex-tree/lazyField.js +1 -14
  236. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  237. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +0 -1
  238. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  239. package/lib/feature-libraries/flex-tree/lazyNode.js +0 -3
  240. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  241. package/lib/feature-libraries/index.d.ts +3 -3
  242. package/lib/feature-libraries/index.d.ts.map +1 -1
  243. package/lib/feature-libraries/index.js +2 -2
  244. package/lib/feature-libraries/index.js.map +1 -1
  245. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +11 -0
  246. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  247. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  248. package/lib/feature-libraries/modular-schema/discrepancies.d.ts +96 -0
  249. package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -0
  250. package/lib/feature-libraries/modular-schema/discrepancies.js +260 -0
  251. package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -0
  252. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +9 -2
  253. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  254. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  255. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  256. package/lib/feature-libraries/modular-schema/genericFieldKind.js +3 -0
  257. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  258. package/lib/feature-libraries/modular-schema/index.d.ts +2 -1
  259. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  260. package/lib/feature-libraries/modular-schema/index.js +1 -0
  261. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  262. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  263. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +42 -26
  264. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  265. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +51 -2
  266. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  267. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +829 -247
  268. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  269. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  270. package/lib/feature-libraries/modular-schema/modularChangeFormat.js +2 -0
  271. package/lib/feature-libraries/modular-schema/modularChangeFormat.js.map +1 -1
  272. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +44 -1
  273. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  274. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  275. package/lib/feature-libraries/node-key/index.d.ts +0 -1
  276. package/lib/feature-libraries/node-key/index.d.ts.map +1 -1
  277. package/lib/feature-libraries/node-key/index.js +0 -1
  278. package/lib/feature-libraries/node-key/index.js.map +1 -1
  279. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  280. package/lib/feature-libraries/optional-field/optionalField.js +1 -0
  281. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  282. package/lib/feature-libraries/sequence-field/index.d.ts +1 -1
  283. package/lib/feature-libraries/sequence-field/index.d.ts.map +1 -1
  284. package/lib/feature-libraries/sequence-field/index.js +1 -1
  285. package/lib/feature-libraries/sequence-field/index.js.map +1 -1
  286. package/lib/feature-libraries/sequence-field/invert.js +1 -1
  287. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  288. package/lib/feature-libraries/sequence-field/rebase.js +6 -1
  289. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  290. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
  291. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +2 -1
  292. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
  293. package/lib/feature-libraries/sequence-field/utils.d.ts +2 -17
  294. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  295. package/lib/feature-libraries/sequence-field/utils.js +31 -39
  296. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  297. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +1 -0
  298. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  299. package/lib/feature-libraries/typed-schema/typedTreeSchema.js +4 -2
  300. package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  301. package/lib/index.d.ts +1 -1
  302. package/lib/index.d.ts.map +1 -1
  303. package/lib/index.js.map +1 -1
  304. package/lib/packageVersion.d.ts +1 -1
  305. package/lib/packageVersion.js +1 -1
  306. package/lib/packageVersion.js.map +1 -1
  307. package/lib/public.d.ts +1 -1
  308. package/lib/shared-tree/schematizingTreeView.d.ts +4 -2
  309. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  310. package/lib/shared-tree/schematizingTreeView.js +242 -185
  311. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  312. package/lib/shared-tree/sharedTree.d.ts +3 -2
  313. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  314. package/lib/shared-tree/sharedTree.js +151 -90
  315. package/lib/shared-tree/sharedTree.js.map +1 -1
  316. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  317. package/lib/shared-tree/treeCheckout.js +2 -1
  318. package/lib/shared-tree/treeCheckout.js.map +1 -1
  319. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  320. package/lib/shared-tree-core/branch.js +1 -0
  321. package/lib/shared-tree-core/branch.js.map +1 -1
  322. package/lib/shared-tree-core/sharedTreeCore.d.ts +4 -6
  323. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  324. package/lib/shared-tree-core/sharedTreeCore.js +267 -210
  325. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  326. package/lib/simple-tree/arrayNode.d.ts +4 -0
  327. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  328. package/lib/simple-tree/arrayNode.js +38 -21
  329. package/lib/simple-tree/arrayNode.js.map +1 -1
  330. package/lib/simple-tree/leafNodeSchema.d.ts +22 -1
  331. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  332. package/lib/simple-tree/leafNodeSchema.js +1 -1
  333. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  334. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  335. package/lib/simple-tree/mapNode.js.map +1 -1
  336. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  337. package/lib/simple-tree/objectNode.js +3 -2
  338. package/lib/simple-tree/objectNode.js.map +1 -1
  339. package/lib/simple-tree/proxies.d.ts.map +1 -1
  340. package/lib/simple-tree/proxies.js +2 -4
  341. package/lib/simple-tree/proxies.js.map +1 -1
  342. package/lib/simple-tree/schemaFactory.d.ts +24 -1
  343. package/lib/simple-tree/schemaFactory.d.ts.map +1 -1
  344. package/lib/simple-tree/schemaFactory.js +38 -3
  345. package/lib/simple-tree/schemaFactory.js.map +1 -1
  346. package/lib/simple-tree/schemaTypes.d.ts +36 -1
  347. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  348. package/lib/simple-tree/schemaTypes.js.map +1 -1
  349. package/lib/simple-tree/toFlexSchema.d.ts +2 -2
  350. package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
  351. package/lib/simple-tree/toFlexSchema.js +3 -2
  352. package/lib/simple-tree/toFlexSchema.js.map +1 -1
  353. package/lib/simple-tree/tree.d.ts +4 -1
  354. package/lib/simple-tree/tree.d.ts.map +1 -1
  355. package/lib/simple-tree/tree.js +44 -0
  356. package/lib/simple-tree/tree.js.map +1 -1
  357. package/lib/simple-tree/treeNodeApi.d.ts.map +1 -1
  358. package/lib/simple-tree/treeNodeApi.js +11 -11
  359. package/lib/simple-tree/treeNodeApi.js.map +1 -1
  360. package/lib/simple-tree/types.d.ts +22 -3
  361. package/lib/simple-tree/types.d.ts.map +1 -1
  362. package/lib/simple-tree/types.js +32 -21
  363. package/lib/simple-tree/types.js.map +1 -1
  364. package/lib/util/breakable.d.ts +83 -0
  365. package/lib/util/breakable.d.ts.map +1 -0
  366. package/lib/util/breakable.js +171 -0
  367. package/lib/util/breakable.js.map +1 -0
  368. package/lib/util/index.d.ts +3 -2
  369. package/lib/util/index.d.ts.map +1 -1
  370. package/lib/util/index.js +3 -2
  371. package/lib/util/index.js.map +1 -1
  372. package/lib/util/nestedMap.d.ts +23 -3
  373. package/lib/util/nestedMap.d.ts.map +1 -1
  374. package/lib/util/nestedMap.js +36 -6
  375. package/lib/util/nestedMap.js.map +1 -1
  376. package/lib/util/utils.d.ts +7 -0
  377. package/lib/util/utils.d.ts.map +1 -1
  378. package/lib/util/utils.js +13 -0
  379. package/lib/util/utils.js.map +1 -1
  380. package/package.json +29 -27
  381. package/src/core/forest/editableForest.ts +17 -4
  382. package/src/core/index.ts +2 -0
  383. package/src/core/rebase/index.ts +2 -0
  384. package/src/core/rebase/types.ts +17 -0
  385. package/src/core/tree/visitDelta.ts +1 -0
  386. package/src/events/events.ts +4 -2
  387. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +1 -1
  388. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -0
  389. package/src/feature-libraries/flex-map-tree/mapTreeNode.ts +0 -30
  390. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +0 -43
  391. package/src/feature-libraries/flex-tree/index.ts +0 -1
  392. package/src/feature-libraries/flex-tree/lazyField.ts +1 -21
  393. package/src/feature-libraries/flex-tree/lazyNode.ts +0 -6
  394. package/src/feature-libraries/index.ts +1 -2
  395. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +18 -0
  396. package/src/feature-libraries/modular-schema/discrepancies.ts +395 -0
  397. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +10 -2
  398. package/src/feature-libraries/modular-schema/genericFieldKind.ts +3 -0
  399. package/src/feature-libraries/modular-schema/index.ts +2 -0
  400. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +81 -35
  401. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +1529 -454
  402. package/src/feature-libraries/modular-schema/modularChangeFormat.ts +2 -0
  403. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +51 -0
  404. package/src/feature-libraries/node-key/index.ts +0 -1
  405. package/src/feature-libraries/optional-field/optionalField.ts +1 -0
  406. package/src/feature-libraries/sequence-field/index.ts +0 -2
  407. package/src/feature-libraries/sequence-field/invert.ts +1 -1
  408. package/src/feature-libraries/sequence-field/rebase.ts +7 -1
  409. package/src/feature-libraries/sequence-field/sequenceFieldChangeHandler.ts +2 -1
  410. package/src/feature-libraries/sequence-field/utils.ts +37 -85
  411. package/src/feature-libraries/typed-schema/typedTreeSchema.ts +10 -0
  412. package/src/index.ts +0 -1
  413. package/src/packageVersion.ts +1 -1
  414. package/src/shared-tree/schematizingTreeView.ts +6 -2
  415. package/src/shared-tree/sharedTree.ts +5 -2
  416. package/src/shared-tree/treeCheckout.ts +6 -2
  417. package/src/shared-tree-core/branch.ts +1 -0
  418. package/src/shared-tree-core/sharedTreeCore.ts +18 -6
  419. package/src/simple-tree/arrayNode.ts +49 -22
  420. package/src/simple-tree/leafNodeSchema.ts +1 -1
  421. package/src/simple-tree/mapNode.ts +2 -2
  422. package/src/simple-tree/objectNode.ts +9 -3
  423. package/src/simple-tree/proxies.ts +2 -4
  424. package/src/simple-tree/schemaFactory.ts +45 -2
  425. package/src/simple-tree/schemaTypes.ts +36 -1
  426. package/src/simple-tree/toFlexSchema.ts +5 -4
  427. package/src/simple-tree/tree.ts +65 -4
  428. package/src/simple-tree/treeNodeApi.ts +15 -15
  429. package/src/simple-tree/types.ts +60 -30
  430. package/src/util/breakable.ts +214 -0
  431. package/src/util/index.ts +10 -0
  432. package/src/util/nestedMap.ts +49 -11
  433. package/src/util/utils.ts +17 -0
  434. package/dist/feature-libraries/node-key/nodeKeyIndex.d.ts +0 -41
  435. package/dist/feature-libraries/node-key/nodeKeyIndex.d.ts.map +0 -1
  436. package/dist/feature-libraries/node-key/nodeKeyIndex.js +0 -101
  437. package/dist/feature-libraries/node-key/nodeKeyIndex.js.map +0 -1
  438. package/lib/feature-libraries/node-key/nodeKeyIndex.d.ts +0 -41
  439. package/lib/feature-libraries/node-key/nodeKeyIndex.d.ts.map +0 -1
  440. package/lib/feature-libraries/node-key/nodeKeyIndex.js +0 -97
  441. package/lib/feature-libraries/node-key/nodeKeyIndex.js.map +0 -1
  442. package/src/feature-libraries/node-key/nodeKeyIndex.ts +0 -132
@@ -0,0 +1,264 @@
1
+ "use strict";
2
+ /*!
3
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
+ * Licensed under the MIT License.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.getAllowedContentIncompatibilities = void 0;
8
+ const internal_1 = require("@fluidframework/core-utils/internal");
9
+ const index_js_1 = require("../../core/index.js");
10
+ /**
11
+ * @remarks
12
+ *
13
+ * The workflow for finding schema incompatibilities:
14
+ * 1. Compare the two root schemas to identify any `FieldIncompatibility`.
15
+ *
16
+ * 2. For each node schema in the `view`:
17
+ * - Verify if the node schema exists in the stored. If it does, ensure that the `SchemaFactoryNodeKind` are
18
+ * consistent. Otherwise this difference is treated as `NodeKindIncompatibility`
19
+ * - If a node schema with the same identifier exists in both view and stored, and their `SchemaFactoryNodeKind`
20
+ * are consistent, perform a exhaustive validation to identify all `FieldIncompatibility`.
21
+ *
22
+ * 3. For each node schema in the stored, verify if it exists in the view. The overlapping parts were already
23
+ * addressed in the previous step.
24
+ *
25
+ * @returns the discrepancies between two TreeStoredSchema objects
26
+ */
27
+ function getAllowedContentIncompatibilities(view, stored) {
28
+ const incompatibilities = [];
29
+ // check root schema discrepancies
30
+ incompatibilities.push(...trackFieldDiscrepancies(view.rootFieldSchema, stored.rootFieldSchema));
31
+ // Verify the existence and type of a node schema given its identifier (key), then determine if
32
+ // an exhaustive search is necessary.
33
+ const viewNodeKeys = new Set();
34
+ for (const [key, viewNodeSchema] of view.nodeSchema) {
35
+ viewNodeKeys.add(key);
36
+ if (viewNodeSchema instanceof index_js_1.ObjectNodeStoredSchema) {
37
+ if (!stored.nodeSchema.has(key)) {
38
+ incompatibilities.push({
39
+ identifier: key,
40
+ mismatch: "nodeKind",
41
+ view: "object",
42
+ stored: undefined,
43
+ });
44
+ }
45
+ else {
46
+ const storedNodeSchema = stored.nodeSchema.get(key);
47
+ (0, internal_1.assert)(storedNodeSchema !== undefined, "The storedNodeSchema in stored.nodeSchema should not be undefined");
48
+ if (storedNodeSchema instanceof index_js_1.MapNodeStoredSchema) {
49
+ incompatibilities.push({
50
+ identifier: key,
51
+ mismatch: "nodeKind",
52
+ view: "object",
53
+ stored: "map",
54
+ });
55
+ }
56
+ else if (storedNodeSchema instanceof index_js_1.LeafNodeStoredSchema) {
57
+ incompatibilities.push({
58
+ identifier: key,
59
+ mismatch: "nodeKind",
60
+ view: "object",
61
+ stored: "leaf",
62
+ });
63
+ }
64
+ else if (storedNodeSchema instanceof index_js_1.ObjectNodeStoredSchema) {
65
+ const differences = trackObjectNodeDiscrepancies(viewNodeSchema, storedNodeSchema);
66
+ if (differences.length > 0) {
67
+ incompatibilities.push({
68
+ identifier: key,
69
+ mismatch: "fields",
70
+ differences,
71
+ });
72
+ }
73
+ }
74
+ else {
75
+ throwUnsupportedNodeType(storedNodeSchema.constructor.name);
76
+ }
77
+ }
78
+ }
79
+ else if (viewNodeSchema instanceof index_js_1.MapNodeStoredSchema) {
80
+ if (!stored.nodeSchema.has(key)) {
81
+ incompatibilities.push({
82
+ identifier: key,
83
+ mismatch: "nodeKind",
84
+ view: "map",
85
+ stored: undefined,
86
+ });
87
+ }
88
+ else {
89
+ const storedNodeSchema = stored.nodeSchema.get(key);
90
+ (0, internal_1.assert)(storedNodeSchema !== undefined, "The storedNodeSchema in stored.nodeSchema should not be undefined");
91
+ if (storedNodeSchema instanceof index_js_1.ObjectNodeStoredSchema) {
92
+ incompatibilities.push({
93
+ identifier: key,
94
+ mismatch: "nodeKind",
95
+ view: "map",
96
+ stored: "object",
97
+ });
98
+ }
99
+ else if (storedNodeSchema instanceof index_js_1.LeafNodeStoredSchema) {
100
+ incompatibilities.push({
101
+ identifier: key,
102
+ mismatch: "nodeKind",
103
+ view: "map",
104
+ stored: "leaf",
105
+ });
106
+ }
107
+ else if (storedNodeSchema instanceof index_js_1.MapNodeStoredSchema) {
108
+ incompatibilities.push(...trackFieldDiscrepancies(viewNodeSchema.mapFields, storedNodeSchema.mapFields, key));
109
+ }
110
+ else {
111
+ throwUnsupportedNodeType(storedNodeSchema.constructor.name);
112
+ }
113
+ }
114
+ }
115
+ else if (viewNodeSchema instanceof index_js_1.LeafNodeStoredSchema) {
116
+ if (!stored.nodeSchema.has(key)) {
117
+ incompatibilities.push({
118
+ identifier: key,
119
+ mismatch: "nodeKind",
120
+ view: "leaf",
121
+ stored: undefined,
122
+ });
123
+ }
124
+ else {
125
+ const storedNodeSchema = stored.nodeSchema.get(key);
126
+ (0, internal_1.assert)(storedNodeSchema !== undefined, "The storedNodeSchema in stored.nodeSchema should not be undefined");
127
+ if (storedNodeSchema instanceof index_js_1.MapNodeStoredSchema) {
128
+ incompatibilities.push({
129
+ identifier: key,
130
+ mismatch: "nodeKind",
131
+ view: "leaf",
132
+ stored: "map",
133
+ });
134
+ }
135
+ else if (storedNodeSchema instanceof index_js_1.ObjectNodeStoredSchema) {
136
+ incompatibilities.push({
137
+ identifier: key,
138
+ mismatch: "nodeKind",
139
+ view: "leaf",
140
+ stored: "object",
141
+ });
142
+ }
143
+ else if (storedNodeSchema instanceof index_js_1.LeafNodeStoredSchema) {
144
+ if (viewNodeSchema.leafValue !== storedNodeSchema.leafValue) {
145
+ incompatibilities.push({
146
+ identifier: key,
147
+ mismatch: "valueSchema",
148
+ view: viewNodeSchema.leafValue,
149
+ stored: storedNodeSchema.leafValue,
150
+ });
151
+ }
152
+ }
153
+ else {
154
+ throwUnsupportedNodeType(storedNodeSchema.constructor.name);
155
+ }
156
+ }
157
+ }
158
+ else {
159
+ throwUnsupportedNodeType(viewNodeSchema.constructor.name);
160
+ }
161
+ }
162
+ for (const [key, storedNodeSchema] of stored.nodeSchema) {
163
+ if (!viewNodeKeys.has(key)) {
164
+ incompatibilities.push({
165
+ identifier: key,
166
+ mismatch: "nodeKind",
167
+ view: undefined,
168
+ stored: storedNodeSchema instanceof index_js_1.MapNodeStoredSchema
169
+ ? "map"
170
+ : storedNodeSchema instanceof index_js_1.ObjectNodeStoredSchema
171
+ ? "object"
172
+ : "leaf",
173
+ });
174
+ }
175
+ }
176
+ return incompatibilities;
177
+ }
178
+ exports.getAllowedContentIncompatibilities = getAllowedContentIncompatibilities;
179
+ /**
180
+ * The function to track the discrepancies between two field stored schemas.
181
+ *
182
+ * @param keyOrRoot - If the key is missing, it indicates that this is the root field schema.
183
+ */
184
+ function trackFieldDiscrepancies(view, stored, keyOrRoot) {
185
+ const differences = [];
186
+ // Only track the intersection of the two sets.
187
+ const findSetDiscrepancies = (a, b) => {
188
+ if (a === undefined && b === undefined) {
189
+ return [[], []];
190
+ }
191
+ if (a !== undefined && b !== undefined) {
192
+ const aDiff = [...a].filter((value) => !b.has(value));
193
+ const bDiff = [...b].filter((value) => !a.has(value));
194
+ return [aDiff, bDiff];
195
+ }
196
+ if (a !== undefined) {
197
+ return [[...a], []];
198
+ }
199
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
200
+ return [[], [...b]];
201
+ };
202
+ const allowedTypesDiscrepancies = findSetDiscrepancies(view.types, stored.types);
203
+ if (allowedTypesDiscrepancies[0].length > 0 || allowedTypesDiscrepancies[1].length > 0) {
204
+ differences.push({
205
+ identifier: keyOrRoot,
206
+ mismatch: "allowedTypes",
207
+ view: allowedTypesDiscrepancies[0],
208
+ stored: allowedTypesDiscrepancies[1],
209
+ });
210
+ }
211
+ if (view.kind !== stored.kind) {
212
+ differences.push({
213
+ identifier: keyOrRoot,
214
+ mismatch: "fieldKind",
215
+ view: view.kind,
216
+ stored: stored.kind,
217
+ });
218
+ }
219
+ return differences;
220
+ }
221
+ function trackObjectNodeDiscrepancies(view, stored) {
222
+ const differences = [];
223
+ const viewFieldKeys = new Set();
224
+ /**
225
+ * Similar to the logic used for tracking discrepancies between two node schemas, we will identify
226
+ * three types of differences:
227
+ * 1. Fields that exist in the view schema but not in the stored schema.
228
+ * 2. Fields that exist in both schemas but have different contents.
229
+ * 3. Fields that exist in the stored schema but not in the view schema.
230
+ *
231
+ * First, the view schema is iterated to track the first two types of differences.
232
+ * Then, the stored schema is iterated to find the third type.
233
+ */
234
+ for (const [fieldKey, fieldStoredSchema] of view.objectNodeFields) {
235
+ viewFieldKeys.add(fieldKey);
236
+ if (!stored.objectNodeFields.has(fieldKey)) {
237
+ differences.push({
238
+ identifier: fieldKey,
239
+ mismatch: "fieldKind",
240
+ view: fieldStoredSchema.kind,
241
+ stored: undefined,
242
+ });
243
+ }
244
+ else {
245
+ differences.push(...trackFieldDiscrepancies(view.objectNodeFields.get(fieldKey), stored.objectNodeFields.get(fieldKey), fieldKey));
246
+ }
247
+ }
248
+ for (const [fieldKey, fieldStoredSchema] of stored.objectNodeFields) {
249
+ if (viewFieldKeys.has(fieldKey)) {
250
+ continue;
251
+ }
252
+ differences.push({
253
+ identifier: fieldKey,
254
+ mismatch: "fieldKind",
255
+ view: undefined,
256
+ stored: fieldStoredSchema.kind,
257
+ });
258
+ }
259
+ return differences;
260
+ }
261
+ function throwUnsupportedNodeType(type) {
262
+ throw new TypeError(`Unsupported node stored schema type: ${type}`);
263
+ }
264
+ //# sourceMappingURL=discrepancies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discrepancies.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/discrepancies.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAE7D,kDAW6B;AAqF7B;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,kCAAkC,CACjD,IAAsB,EACtB,MAAwB;IAExB,MAAM,iBAAiB,GAAsB,EAAE,CAAC;IAEhD,kCAAkC;IAClC,iBAAiB,CAAC,IAAI,CACrB,GAAG,uBAAuB,CAAC,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,eAAe,CAAC,CACxE,CAAC;IAEF,+FAA+F;IAC/F,qCAAqC;IACrC,MAAM,YAAY,GAAG,IAAI,GAAG,EAA4B,CAAC;IACzD,KAAK,MAAM,CAAC,GAAG,EAAE,cAAc,CAAC,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;QACrD,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAEtB,IAAI,cAAc,YAAY,iCAAsB,EAAE,CAAC;YACtD,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBACjC,iBAAiB,CAAC,IAAI,CAAC;oBACtB,UAAU,EAAE,GAAG;oBACf,QAAQ,EAAE,UAAU;oBACpB,IAAI,EAAE,QAAQ;oBACd,MAAM,EAAE,SAAS;iBACjB,CAAC,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACP,MAAM,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBACpD,IAAA,iBAAM,EACL,gBAAgB,KAAK,SAAS,EAC9B,mEAAmE,CACnE,CAAC;gBACF,IAAI,gBAAgB,YAAY,8BAAmB,EAAE,CAAC;oBACrD,iBAAiB,CAAC,IAAI,CAAC;wBACtB,UAAU,EAAE,GAAG;wBACf,QAAQ,EAAE,UAAU;w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AAC,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAA0B,EAC5D,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAA0B,EAC9D,QAAQ,CACR,CACD,CAAC;QACH,CAAC;IACF,CAAC;IAED,KAAK,MAAM,CAAC,QAAQ,EAAE,iBAAiB,CAAC,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;QACrE,IAAI,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YACjC,SAAS;QACV,CAAC;QACD,WAAW,CAAC,IAAI,CAAC;YAChB,UAAU,EAAE,QAAQ;YACpB,QAAQ,EAAE,WAAW;YACrB,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,iBAAiB,CAAC,IAAI;SACK,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,WAAW,CAAC;AACpB,CAAC;AAED,SAAS,wBAAwB,CAAC,IAAY;IAC7C,MAAM,IAAI,SAAS,CAAC,wCAAwC,IAAI,EAAE,CAAC,CAAC;AACrE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype FieldKey,\n\ttype FieldKindIdentifier,\n\tLeafNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeStoredSchema,\n\ttype TreeTypeSet,\n\ttype ValueSchema,\n} from \"../../core/index.js\";\n\n/**\n * @remarks\n *\n * 1. FieldIncompatibility\n *\n * `FieldIncompatibility` represents the differences between two `TreeFieldStoredSchema` objects. It consists of\n * three types of incompatibilities:\n *\n * - FieldKindIncompatibility: Indicates the differences in `FieldKindIdentifier` between two `TreeFieldStoredSchema`\n * objects (e.g., optional, required, sequence, etc.).\n * - AllowedTypesIncompatibility: Indicates the differences in the allowed child types between the two schemas.\n * - ValueSchemaIncompatibility: Specifically indicates the differences in the `ValueSchema` of two\n * `LeafNodeStoredSchema` objects.\n *\n * 2. NodeIncompatibility\n *\n * `NodeIncompatibility` represents the differences between two `TreeNodeStoredSchema` objects and includes:\n *\n * - NodeKindIncompatibility: Indicates the differences in the types of `TreeNodeStoredSchema` (currently supports\n * `ObjectNodeStoredSchema`, `MapNodeStoredSchema`, and `LeafNodeStoredSchema`).\n * - NodeFieldsIncompatibility: Indicates the `FieldIncompatibility` of `TreeFieldStoredSchema` within two\n * `TreeNodeStoredSchema`. It includes an array of `FieldIncompatibility` instances in the `differences` field.\n *\n * When comparing two nodes for compatibility, it only makes sense to compare their fields if the nodes are of\n * the same kind (map, object, leaf).\n *\n * 3. Incompatibility\n *\n * Incompatibility consists of both `NodeIncompatibility` and `FieldIncompatibility`, representing any kind of\n * schema differences. See {@link getAllowedContentIncompatibilities} for more details about how we process it\n * and the ordering.\n */\nexport type Incompatibility = FieldIncompatibility | NodeIncompatibility;\n\nexport type NodeIncompatibility = NodeKindIncompatibility | NodeFieldsIncompatibility;\n\nexport type FieldIncompatibility =\n\t| AllowedTypeIncompatibility\n\t| FieldKindIncompatibility\n\t| ValueSchemaIncompatibility;\n\nexport interface AllowedTypeIncompatibility {\n\tidentifier: string | undefined; // undefined indicates root field schema\n\tmismatch: \"allowedTypes\";\n\t/**\n\t * List of allowed type identifiers in viewed schema\n\t */\n\tview: string[];\n\t/**\n\t * List of allowed type identifiers in stored schema\n\t */\n\tstored: string[];\n}\n\nexport interface FieldKindIncompatibility {\n\tidentifier: string | undefined; // undefined indicates root field schema\n\tmismatch: \"fieldKind\";\n\tview: FieldKindIdentifier | undefined;\n\tstored: FieldKindIdentifier | undefined;\n}\n\nexport interface ValueSchemaIncompatibility {\n\tidentifier: string;\n\tmismatch: \"valueSchema\";\n\tview: ValueSchema | undefined;\n\tstored: ValueSchema | undefined;\n}\n\nexport interface NodeKindIncompatibility {\n\tidentifier: string;\n\tmismatch: \"nodeKind\";\n\tview: SchemaFactoryNodeKind | undefined;\n\tstored: SchemaFactoryNodeKind | undefined;\n}\n\nexport interface NodeFieldsIncompatibility {\n\tidentifier: string;\n\tmismatch: \"fields\";\n\tdifferences: FieldIncompatibility[];\n}\n\ntype SchemaFactoryNodeKind = \"object\" | \"leaf\" | \"map\";\n\n/**\n * @remarks\n *\n * The workflow for finding schema incompatibilities:\n * 1. Compare the two root schemas to identify any `FieldIncompatibility`.\n *\n * 2. For each node schema in the `view`:\n * - Verify if the node schema exists in the stored. If it does, ensure that the `SchemaFactoryNodeKind` are\n * consistent. Otherwise this difference is treated as `NodeKindIncompatibility`\n * - If a node schema with the same identifier exists in both view and stored, and their `SchemaFactoryNodeKind`\n * are consistent, perform a exhaustive validation to identify all `FieldIncompatibility`.\n *\n * 3. For each node schema in the stored, verify if it exists in the view. The overlapping parts were already\n * addressed in the previous step.\n *\n * @returns the discrepancies between two TreeStoredSchema objects\n */\nexport function getAllowedContentIncompatibilities(\n\tview: TreeStoredSchema,\n\tstored: TreeStoredSchema,\n): Incompatibility[] {\n\tconst incompatibilities: Incompatibility[] = [];\n\n\t// check root schema discrepancies\n\tincompatibilities.push(\n\t\t...trackFieldDiscrepancies(view.rootFieldSchema, stored.rootFieldSchema),\n\t);\n\n\t// Verify the existence and type of a node schema given its identifier (key), then determine if\n\t// an exhaustive search is necessary.\n\tconst viewNodeKeys = new Set<TreeNodeSchemaIdentifier>();\n\tfor (const [key, viewNodeSchema] of view.nodeSchema) {\n\t\tviewNodeKeys.add(key);\n\n\t\tif (viewNodeSchema instanceof ObjectNodeStoredSchema) {\n\t\t\tif (!stored.nodeSchema.has(key)) {\n\t\t\t\tincompatibilities.push({\n\t\t\t\t\tidentifier: key,\n\t\t\t\t\tmismatch: \"nodeKind\",\n\t\t\t\t\tview: \"object\",\n\t\t\t\t\tstored: undefined,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst storedNodeSchema = stored.nodeSchema.get(key);\n\t\t\t\tassert(\n\t\t\t\t\tstoredNodeSchema !== undefined,\n\t\t\t\t\t\"The storedNodeSchema in stored.nodeSchema should not be undefined\",\n\t\t\t\t);\n\t\t\t\tif (storedNodeSchema instanceof MapNodeStoredSchema) {\n\t\t\t\t\tincompatibilities.push({\n\t\t\t\t\t\tidentifier: key,\n\t\t\t\t\t\tmismatch: \"nodeKind\",\n\t\t\t\t\t\tview: \"object\",\n\t\t\t\t\t\tstored: \"map\",\n\t\t\t\t\t} satisfies NodeKindIncompatibility);\n\t\t\t\t} else if (storedNodeSchema instanceof LeafNodeStoredSchema) {\n\t\t\t\t\tincompatibilities.push({\n\t\t\t\t\t\tidentifier: key,\n\t\t\t\t\t\tmismatch: \"nodeKind\",\n\t\t\t\t\t\tview: \"object\",\n\t\t\t\t\t\tstored: \"leaf\",\n\t\t\t\t\t} satisfies NodeKindIncompatibility);\n\t\t\t\t} else if (storedNodeSchema instanceof ObjectNodeStoredSchema) {\n\t\t\t\t\tconst differences = trackObjectNodeDiscrepancies(viewNodeSchema, storedNodeSchema);\n\t\t\t\t\tif (differences.length > 0) {\n\t\t\t\t\t\tincompatibilities.push({\n\t\t\t\t\t\t\tidentifier: key,\n\t\t\t\t\t\t\tmismatch: \"fields\",\n\t\t\t\t\t\t\tdifferences,\n\t\t\t\t\t\t} satisfies NodeFieldsIncompatibility);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthrowUnsupportedNodeType(storedNodeSchema.constructor.name);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (viewNodeSchema instanceof MapNodeStoredSchema) {\n\t\t\tif (!stored.nodeSchema.has(key)) {\n\t\t\t\tincompatibilities.push({\n\t\t\t\t\tidentifier: key,\n\t\t\t\t\tmismatch: \"nodeKind\",\n\t\t\t\t\tview: \"map\",\n\t\t\t\t\tstored: undefined,\n\t\t\t\t} satisfies NodeKindIncompatibility);\n\t\t\t} else {\n\t\t\t\tconst storedNodeSchema = stored.nodeSchema.get(key);\n\t\t\t\tassert(\n\t\t\t\t\tstoredNodeSchema !== undefined,\n\t\t\t\t\t\"The storedNodeSchema in stored.nodeSchema should not be undefined\",\n\t\t\t\t);\n\t\t\t\tif (storedNodeSchema instanceof ObjectNodeStoredSchema) {\n\t\t\t\t\tincompatibilities.push({\n\t\t\t\t\t\tidentifier: key,\n\t\t\t\t\t\tmismatch: \"nodeKind\",\n\t\t\t\t\t\tview: \"map\",\n\t\t\t\t\t\tstored: \"object\",\n\t\t\t\t\t} satisfies NodeKindIncompatibility);\n\t\t\t\t} else if (storedNodeSchema instanceof LeafNodeStoredSchema) {\n\t\t\t\t\tincompatibilities.push({\n\t\t\t\t\t\tidentifier: key,\n\t\t\t\t\t\tmismatch: \"nodeKind\",\n\t\t\t\t\t\tview: \"map\",\n\t\t\t\t\t\tstored: \"leaf\",\n\t\t\t\t\t} satisfies NodeKindIncompatibility);\n\t\t\t\t} else if (storedNodeSchema instanceof MapNodeStoredSchema) {\n\t\t\t\t\tincompatibilities.push(\n\t\t\t\t\t\t...trackFieldDiscrepancies(\n\t\t\t\t\t\t\tviewNodeSchema.mapFields,\n\t\t\t\t\t\t\tstoredNodeSchema.mapFields,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tthrowUnsupportedNodeType(storedNodeSchema.constructor.name);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (viewNodeSchema instanceof LeafNodeStoredSchema) {\n\t\t\tif (!stored.nodeSchema.has(key)) {\n\t\t\t\tincompatibilities.push({\n\t\t\t\t\tidentifier: key,\n\t\t\t\t\tmismatch: \"nodeKind\",\n\t\t\t\t\tview: \"leaf\",\n\t\t\t\t\tstored: undefined,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst storedNodeSchema = stored.nodeSchema.get(key);\n\t\t\t\tassert(\n\t\t\t\t\tstoredNodeSchema !== undefined,\n\t\t\t\t\t\"The storedNodeSchema in stored.nodeSchema should not be undefined\",\n\t\t\t\t);\n\t\t\t\tif (storedNodeSchema instanceof MapNodeStoredSchema) {\n\t\t\t\t\tincompatibilities.push({\n\t\t\t\t\t\tidentifier: key,\n\t\t\t\t\t\tmismatch: \"nodeKind\",\n\t\t\t\t\t\tview: \"leaf\",\n\t\t\t\t\t\tstored: \"map\",\n\t\t\t\t\t} satisfies NodeKindIncompatibility);\n\t\t\t\t} else if (storedNodeSchema instanceof ObjectNodeStoredSchema) {\n\t\t\t\t\tincompatibilities.push({\n\t\t\t\t\t\tidentifier: key,\n\t\t\t\t\t\tmismatch: \"nodeKind\",\n\t\t\t\t\t\tview: \"leaf\",\n\t\t\t\t\t\tstored: \"object\",\n\t\t\t\t\t} satisfies NodeKindIncompatibility);\n\t\t\t\t} else if (storedNodeSchema instanceof LeafNodeStoredSchema) {\n\t\t\t\t\tif (viewNodeSchema.leafValue !== storedNodeSchema.leafValue) {\n\t\t\t\t\t\tincompatibilities.push({\n\t\t\t\t\t\t\tidentifier: key,\n\t\t\t\t\t\t\tmismatch: \"valueSchema\",\n\t\t\t\t\t\t\tview: viewNodeSchema.leafValue,\n\t\t\t\t\t\t\tstored: storedNodeSchema.leafValue,\n\t\t\t\t\t\t} satisfies ValueSchemaIncompatibility);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthrowUnsupportedNodeType(storedNodeSchema.constructor.name);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tthrowUnsupportedNodeType(viewNodeSchema.constructor.name);\n\t\t}\n\t}\n\n\tfor (const [key, storedNodeSchema] of stored.nodeSchema) {\n\t\tif (!viewNodeKeys.has(key)) {\n\t\t\tincompatibilities.push({\n\t\t\t\tidentifier: key,\n\t\t\t\tmismatch: \"nodeKind\",\n\t\t\t\tview: undefined,\n\t\t\t\tstored:\n\t\t\t\t\tstoredNodeSchema instanceof MapNodeStoredSchema\n\t\t\t\t\t\t? \"map\"\n\t\t\t\t\t\t: storedNodeSchema instanceof ObjectNodeStoredSchema\n\t\t\t\t\t\t\t? \"object\"\n\t\t\t\t\t\t\t: \"leaf\",\n\t\t\t} satisfies NodeKindIncompatibility);\n\t\t}\n\t}\n\n\treturn incompatibilities;\n}\n\n/**\n * The function to track the discrepancies between two field stored schemas.\n *\n * @param keyOrRoot - If the key is missing, it indicates that this is the root field schema.\n */\nfunction trackFieldDiscrepancies(\n\tview: TreeFieldStoredSchema,\n\tstored: TreeFieldStoredSchema,\n\tkeyOrRoot?: string,\n): FieldIncompatibility[] {\n\tconst differences: FieldIncompatibility[] = [];\n\n\t// Only track the intersection of the two sets.\n\tconst findSetDiscrepancies = (\n\t\ta: TreeTypeSet,\n\t\tb: TreeTypeSet,\n\t): [TreeNodeSchemaIdentifier[], TreeNodeSchemaIdentifier[]] => {\n\t\tif (a === undefined && b === undefined) {\n\t\t\treturn [[], []];\n\t\t}\n\n\t\tif (a !== undefined && b !== undefined) {\n\t\t\tconst aDiff = [...a].filter((value) => !b.has(value));\n\t\t\tconst bDiff = [...b].filter((value) => !a.has(value));\n\t\t\treturn [aDiff, bDiff];\n\t\t}\n\n\t\tif (a !== undefined) {\n\t\t\treturn [[...a], []];\n\t\t}\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\treturn [[], [...b!]];\n\t};\n\n\tconst allowedTypesDiscrepancies = findSetDiscrepancies(view.types, stored.types);\n\tif (allowedTypesDiscrepancies[0].length > 0 || allowedTypesDiscrepancies[1].length > 0) {\n\t\tdifferences.push({\n\t\t\tidentifier: keyOrRoot,\n\t\t\tmismatch: \"allowedTypes\",\n\t\t\tview: allowedTypesDiscrepancies[0],\n\t\t\tstored: allowedTypesDiscrepancies[1],\n\t\t} satisfies AllowedTypeIncompatibility);\n\t}\n\n\tif (view.kind !== stored.kind) {\n\t\tdifferences.push({\n\t\t\tidentifier: keyOrRoot,\n\t\t\tmismatch: \"fieldKind\",\n\t\t\tview: view.kind,\n\t\t\tstored: stored.kind,\n\t\t} satisfies FieldKindIncompatibility);\n\t}\n\n\treturn differences;\n}\n\nfunction trackObjectNodeDiscrepancies(\n\tview: ObjectNodeStoredSchema,\n\tstored: ObjectNodeStoredSchema,\n): FieldIncompatibility[] {\n\tconst differences: FieldIncompatibility[] = [];\n\tconst viewFieldKeys = new Set<FieldKey>();\n\t/**\n\t * Similar to the logic used for tracking discrepancies between two node schemas, we will identify\n\t * three types of differences:\n\t * 1. Fields that exist in the view schema but not in the stored schema.\n\t * 2. Fields that exist in both schemas but have different contents.\n\t * 3. Fields that exist in the stored schema but not in the view schema.\n\t *\n\t * First, the view schema is iterated to track the first two types of differences.\n\t * Then, the stored schema is iterated to find the third type.\n\t */\n\n\tfor (const [fieldKey, fieldStoredSchema] of view.objectNodeFields) {\n\t\tviewFieldKeys.add(fieldKey);\n\t\tif (!stored.objectNodeFields.has(fieldKey)) {\n\t\t\tdifferences.push({\n\t\t\t\tidentifier: fieldKey,\n\t\t\t\tmismatch: \"fieldKind\",\n\t\t\t\tview: fieldStoredSchema.kind,\n\t\t\t\tstored: undefined,\n\t\t\t} satisfies FieldKindIncompatibility);\n\t\t} else {\n\t\t\tdifferences.push(\n\t\t\t\t...trackFieldDiscrepancies(\n\t\t\t\t\tview.objectNodeFields.get(fieldKey) as TreeFieldStoredSchema,\n\t\t\t\t\tstored.objectNodeFields.get(fieldKey) as TreeFieldStoredSchema,\n\t\t\t\t\tfieldKey,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\n\tfor (const [fieldKey, fieldStoredSchema] of stored.objectNodeFields) {\n\t\tif (viewFieldKeys.has(fieldKey)) {\n\t\t\tcontinue;\n\t\t}\n\t\tdifferences.push({\n\t\t\tidentifier: fieldKey,\n\t\t\tmismatch: \"fieldKind\",\n\t\t\tview: undefined,\n\t\t\tstored: fieldStoredSchema.kind,\n\t\t} satisfies FieldKindIncompatibility);\n\t}\n\n\treturn differences;\n}\n\nfunction throwUnsupportedNodeType(type: string): never {\n\tthrow new TypeError(`Unsupported node stored schema type: ${type}`);\n}\n"]}
@@ -7,7 +7,7 @@ import type { ChangeEncodingContext, DeltaDetachedNodeId, DeltaFieldChanges, Del
7
7
  import type { IdAllocator, Invariant } from "../../util/index.js";
8
8
  import type { MemoizedIdRangeAllocator } from "../memoizedIdRangeAllocator.js";
9
9
  import type { CrossFieldManager } from "./crossFieldQueries.js";
10
- import type { NodeId } from "./modularChangeTypes.js";
10
+ import type { CrossFieldKeyRange, NodeId } from "./modularChangeTypes.js";
11
11
  import type { EncodedNodeChangeset } from "./modularChangeFormat.js";
12
12
  /**
13
13
  * Functionality provided by a field kind which will be composed with other `FieldChangeHandler`s to
@@ -52,12 +52,19 @@ export interface FieldChangeHandler<TChangeset, TEditor extends FieldEditor<TCha
52
52
  * The returned array is owned by the caller.
53
53
  */
54
54
  getNestedChanges(change: TChangeset): [NodeId, number | undefined][];
55
+ /**
56
+ * @returns A list of all cross-field keys contained in the change.
57
+ * This should not include cross-field keys in descendant fields.
58
+ */
59
+ getCrossFieldKeys(change: TChangeset): CrossFieldKeyRange[];
55
60
  createEmpty(): TChangeset;
56
61
  }
57
62
  export interface FieldChangeRebaser<TChangeset> {
58
63
  /**
59
64
  * Compose a collection of changesets into a single one.
60
- * Every child included in the composed change must be the result of a call to `composeChild`.
65
+ * For each node which has a change in both changesets, `composeChild` must be called
66
+ * and the result used as the composite node change.
67
+ * Calling `composeChild` when one of the changesets has no node change is unnecessary but tolerated.
61
68
  * See `ChangeRebaser` for more details.
62
69
  */
63
70
  compose(change1: TChangeset, change2: TChangeset, composeChild: NodeChangeComposer, genId: IdAllocator, crossFieldManager: CrossFieldManager, revisionMetadata: RevisionMetadataSource): TChangeset;
@@ -1 +1 @@
1
- {"version":3,"file":"fieldChangeHandler.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/fieldChangeHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EACX,qBAAqB,EACrB,mBAAmB,EACnB,iBAAi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ceRoot":"","sources":["../../../src/feature-libraries/modular-schema/fieldChangeHandler.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAyIH;;;GAGG;AACH,SAAgB,+BAA+B,CAAa,IAI3D;IACA,OAAO,0BAA0B,CAAC;QACjC,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC;QACpF,MAAM,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QAC7D,MAAM,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC;KACzE,CAAC,CAAC;AACJ,CAAC;AAVD,0EAUC;AAED,SAAgB,0BAA0B,CAAa,IAItD;IACA,OAAO;QACN,GAAG,IAAI;QACP,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM;QACzB,gBAAgB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM;KACpC,CAAC;AACH,CAAC;AAVD,gEAUC;AAqBD;;GAEG;AACH,IAAY,eAGX;AAHD,WAAY,eAAe;IAC1B,6DAAQ,CAAA;IACR,6DAAQ,CAAA;AACT,CAAC,EAHW,eAAe,+BAAf,eAAe,QAG1B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ICodecFamily, IJsonCodec } from \"../../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tDeltaDetachedNodeId,\n\tDeltaFieldChanges,\n\tDeltaFieldMap,\n\tEncodedRevisionTag,\n\tRevisionMetadataSource,\n\tRevisionTag,\n} from \"../../core/index.js\";\nimport type { IdAllocator, Invariant } from \"../../util/index.js\";\nimport type { MemoizedIdRangeAllocator } from \"../memoizedIdRangeAllocator.js\";\n\nimport type { CrossFieldManager } from \"./crossFieldQueries.js\";\nimport type { NodeId } from \"./modularChangeTypes.js\";\nimport type { EncodedNodeChangeset } from \"./modularChangeFormat.js\";\n\n/**\n * Functionality provided by a field kind which will be composed with other `FieldChangeHandler`s to\n * implement a unified ChangeFamily supporting documents with multiple field kinds.\n */\nexport interface FieldChangeHandler<\n\tTChangeset,\n\tTEditor extends FieldEditor<TChangeset> = FieldEditor<TChangeset>,\n> {\n\t_typeCheck?: Invariant<TChangeset>;\n\treadonly rebaser: FieldChangeRebaser<TChangeset>;\n\treadonly codecsFactory: (\n\t\trevisionTagCodec: IJsonCodec<\n\t\t\tRevisionTag,\n\t\t\tEncodedRevisionTag,\n\t\t\tEncodedRevisionTag,\n\t\t\tChangeEncodingContext\n\t\t>,\n\t) => ICodecFamily<TChangeset, FieldChangeEncodingContext>;\n\treadonly editor: TEditor;\n\tintoDelta(\n\t\tchange: TChangeset,\n\t\tdeltaFromChild: ToDelta,\n\t\tidAllocator: MemoizedIdRangeAllocator,\n\t): DeltaFieldChanges;\n\t/**\n\t * Returns the set of removed roots that should be in memory for the given change to be applied.\n\t * A removed root is relevant if any of the following is true:\n\t * - It is being inserted\n\t * - It is being restored\n\t * - It is being edited\n\t * - The ID it is associated with is being changed\n\t *\n\t * Implementations are allowed to be conservative by returning more removed roots than strictly necessary\n\t * (though they should, for the sake of performance, try to avoid doing so).\n\t *\n\t * Implementations are not allowed to return IDs for non-root trees, even if they are removed.\n\t *\n\t * @param change - The change to be applied.\n\t * @param relevantRemovedRootsFromChild - Delegate for collecting relevant removed roots from child changes.\n\t */\n\treadonly relevantRemovedRoots: (\n\t\tchange: TChangeset,\n\t\trelevantRemovedRootsFromChild: RelevantRemovedRootsFromChild,\n\t) => Iterable<DeltaDetachedNodeId>;\n\n\t/**\n\t * Returns whether this change is empty, meaning that it represents no modifications to the field\n\t * and could be removed from the ModularChangeset tree without changing its behavior.\n\t */\n\tisEmpty(change: TChangeset): boolean;\n\n\t/**\n\t * @param change - The field change to get the child changes from.\n\t *\n\t * @returns The set of `NodeId`s that correspond to nested changes in the given `change`.\n\t * Each `NodeId` is associated with the index of the node in the field in the input context of the changeset\n\t * (or `undefined` if the node is not attached in the input context).\n\t * For all returned entries where the index is defined,\n\t * the indices are are ordered from smallest to largest (with no duplicates).\n\t * The returned array is owned by the caller.\n\t */\n\tgetNestedChanges(change: TChangeset): [NodeId, number | undefined][];\n\n\tcreateEmpty(): TChangeset;\n}\n\nexport interface FieldChangeRebaser<TChangeset> {\n\t/**\n\t * Compose a collection of changesets into a single one.\n\t * Every child included in the composed change must be the result of a call to `composeChild`.\n\t * See `ChangeRebaser` for more details.\n\t */\n\tcompose(\n\t\tchange1: TChangeset,\n\t\tchange2: TChangeset,\n\t\tcomposeChild: NodeChangeComposer,\n\t\tgenId: IdAllocator,\n\t\tcrossFieldManager: CrossFieldManager,\n\t\trevisionMetadata: RevisionMetadataSource,\n\t): TChangeset;\n\n\t/**\n\t * @returns the inverse of `changes`.\n\t * See `ChangeRebaser` for details.\n\t */\n\tinvert(\n\t\tchange: TChangeset,\n\t\tisRollback: boolean,\n\t\tgenId: IdAllocator,\n\t\tcrossFieldManager: CrossFieldManager,\n\t\trevisionMetadata: RevisionMetadataSource,\n\t): TChangeset;\n\n\t/**\n\t * Rebase `change` over `over`.\n\t * See `ChangeRebaser` for details.\n\t */\n\trebase(\n\t\tchange: TChangeset,\n\t\tover: TChangeset,\n\t\trebaseChild: NodeChangeRebaser,\n\t\tgenId: IdAllocator,\n\t\tcrossFieldManager: CrossFieldManager,\n\t\trevisionMetadata: RebaseRevisionMetadata,\n\t): TChangeset;\n\n\t/**\n\t * @returns `change` with any empty child node changesets removed.\n\t */\n\tprune(change: TChangeset, pruneChild: NodeChangePruner): TChangeset;\n\n\treplaceRevisions(\n\t\tchange: TChangeset,\n\t\toldRevisions: Set<RevisionTag | undefined>,\n\t\tnewRevisions: RevisionTag | undefined,\n\t): TChangeset;\n}\n\n/**\n * Helper for creating a {@link FieldChangeRebaser} which does not need access to revision tags.\n * This should only be used for fields where the child nodes cannot be edited.\n */\nexport function referenceFreeFieldChangeRebaser<TChangeset>(data: {\n\tcompose: (change1: TChangeset, change2: TChangeset) => TChangeset;\n\tinvert: (change: TChangeset) => TChangeset;\n\trebase: (change: TChangeset, over: TChangeset) => TChangeset;\n}): FieldChangeRebaser<TChangeset> {\n\treturn isolatedFieldChangeRebaser({\n\t\tcompose: (change1, change2, _composeChild, _genId) => data.compose(change1, change2),\n\t\tinvert: (change, _invertChild, _genId) => data.invert(change),\n\t\trebase: (change, over, _rebaseChild, _genId) => data.rebase(change, over),\n\t});\n}\n\nexport function isolatedFieldChangeRebaser<TChangeset>(data: {\n\tcompose: FieldChangeRebaser<TChangeset>[\"compose\"];\n\tinvert: FieldChangeRebaser<TChangeset>[\"invert\"];\n\trebase: FieldChangeRebaser<TChangeset>[\"rebase\"];\n}): FieldChangeRebaser<TChangeset> {\n\treturn {\n\t\t...data,\n\t\tprune: (change) => change,\n\t\treplaceRevisions: (change) => change,\n\t};\n}\n\nexport interface FieldEditor<TChangeset> {\n\t/**\n\t * Creates a changeset which represents the given `change` to the child at `childIndex` of this editor's field.\n\t */\n\tbuildChildChange(childIndex: number, change: NodeId): TChangeset;\n}\n\n/**\n * The `index` represents the index of the child node in the input context.\n * The `index` should be `undefined` iff the child node does not exist in the input context (e.g., an inserted node).\n * @internal\n */\nexport type ToDelta = (child: NodeId) => DeltaFieldMap;\n\n/**\n * @internal\n */\nexport type NodeChangeInverter = (change: NodeId) => NodeId;\n\n/**\n * @internal\n */\nexport enum NodeAttachState {\n\tAttached,\n\tDetached,\n}\n\n/**\n * @internal\n */\nexport type NodeChangeRebaser = (\n\tchange: NodeId | undefined,\n\tbaseChange: NodeId | undefined,\n\t/**\n\t * Whether the node is attached to this field in the output context of the base change.\n\t * Defaults to attached if undefined.\n\t */\n\tstate?: NodeAttachState,\n) => NodeId | undefined;\n\n/**\n * @internal\n */\nexport type NodeChangeComposer = (\n\tchange1: NodeId | undefined,\n\tchange2: NodeId | undefined,\n) => NodeId;\n\n/**\n * @internal\n */\nexport type NodeChangePruner = (change: NodeId) => NodeId | undefined;\n\n/**\n * A function that returns the set of removed roots that should be in memory for a given node changeset to be applied.\n *\n * @internal\n */\nexport type RelevantRemovedRootsFromChild = (child: NodeId) => Iterable<DeltaDetachedNodeId>;\n\nexport interface RebaseRevisionMetadata extends RevisionMetadataSource {\n\treadonly getRevisionToRebase: () => RevisionTag | undefined;\n\treadonly getBaseRevisions: () => RevisionTag[];\n}\n\nexport interface FieldChangeEncodingContext {\n\treadonly baseContext: ChangeEncodingContext;\n\tencodeNode(nodeId: NodeId): EncodedNodeChangeset;\n\tdecodeNode(encodedNode: EncodedNodeChangeset): NodeId;\n}\n"]}
1
+ {"version":3,"file":"fieldChangeHandler.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/fieldChangeHandler.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAiJH;;;GAGG;AACH,SAAgB,+BAA+B,CAAa,IAI3D;IACA,OAAO,0BAA0B,CAAC;QACjC,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC;QACpF,MAAM,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QAC7D,MAAM,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC;KACzE,CAAC,CAAC;AACJ,CAAC;AAVD,0EAUC;AAED,SAAgB,0BAA0B,CAAa,IAItD;IACA,OAAO;QACN,GAAG,IAAI;QACP,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM;QACzB,gBAAgB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM;KACpC,CAAC;AACH,CAAC;AAVD,gEAUC;AAqBD;;GAEG;AACH,IAAY,eAGX;AAHD,WAAY,eAAe;IAC1B,6DAAQ,CAAA;IACR,6DAAQ,CAAA;AACT,CAAC,EAHW,eAAe,+BAAf,eAAe,QAG1B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ICodecFamily, IJsonCodec } from \"../../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tDeltaDetachedNodeId,\n\tDeltaFieldChanges,\n\tDeltaFieldMap,\n\tEncodedRevisionTag,\n\tRevisionMetadataSource,\n\tRevisionTag,\n} from \"../../core/index.js\";\nimport type { IdAllocator, Invariant } from \"../../util/index.js\";\nimport type { MemoizedIdRangeAllocator } from \"../memoizedIdRangeAllocator.js\";\n\nimport type { CrossFieldManager } from \"./crossFieldQueries.js\";\nimport type { CrossFieldKeyRange, NodeId } from \"./modularChangeTypes.js\";\nimport type { EncodedNodeChangeset } from \"./modularChangeFormat.js\";\n\n/**\n * Functionality provided by a field kind which will be composed with other `FieldChangeHandler`s to\n * implement a unified ChangeFamily supporting documents with multiple field kinds.\n */\nexport interface FieldChangeHandler<\n\tTChangeset,\n\tTEditor extends FieldEditor<TChangeset> = FieldEditor<TChangeset>,\n> {\n\t_typeCheck?: Invariant<TChangeset>;\n\treadonly rebaser: FieldChangeRebaser<TChangeset>;\n\treadonly codecsFactory: (\n\t\trevisionTagCodec: IJsonCodec<\n\t\t\tRevisionTag,\n\t\t\tEncodedRevisionTag,\n\t\t\tEncodedRevisionTag,\n\t\t\tChangeEncodingContext\n\t\t>,\n\t) => ICodecFamily<TChangeset, FieldChangeEncodingContext>;\n\treadonly editor: TEditor;\n\tintoDelta(\n\t\tchange: TChangeset,\n\t\tdeltaFromChild: ToDelta,\n\t\tidAllocator: MemoizedIdRangeAllocator,\n\t): DeltaFieldChanges;\n\t/**\n\t * Returns the set of removed roots that should be in memory for the given change to be applied.\n\t * A removed root is relevant if any of the following is true:\n\t * - It is being inserted\n\t * - It is being restored\n\t * - It is being edited\n\t * - The ID it is associated with is being changed\n\t *\n\t * Implementations are allowed to be conservative by returning more removed roots than strictly necessary\n\t * (though they should, for the sake of performance, try to avoid doing so).\n\t *\n\t * Implementations are not allowed to return IDs for non-root trees, even if they are removed.\n\t *\n\t * @param change - The change to be applied.\n\t * @param relevantRemovedRootsFromChild - Delegate for collecting relevant removed roots from child changes.\n\t */\n\treadonly relevantRemovedRoots: (\n\t\tchange: TChangeset,\n\t\trelevantRemovedRootsFromChild: RelevantRemovedRootsFromChild,\n\t) => Iterable<DeltaDetachedNodeId>;\n\n\t/**\n\t * Returns whether this change is empty, meaning that it represents no modifications to the field\n\t * and could be removed from the ModularChangeset tree without changing its behavior.\n\t */\n\tisEmpty(change: TChangeset): boolean;\n\n\t/**\n\t * @param change - The field change to get the child changes from.\n\t *\n\t * @returns The set of `NodeId`s that correspond to nested changes in the given `change`.\n\t * Each `NodeId` is associated with the index of the node in the field in the input context of the changeset\n\t * (or `undefined` if the node is not attached in the input context).\n\t * For all returned entries where the index is defined,\n\t * the indices are are ordered from smallest to largest (with no duplicates).\n\t * The returned array is owned by the caller.\n\t */\n\tgetNestedChanges(change: TChangeset): [NodeId, number | undefined][];\n\n\t/**\n\t * @returns A list of all cross-field keys contained in the change.\n\t * This should not include cross-field keys in descendant fields.\n\t */\n\tgetCrossFieldKeys(change: TChangeset): CrossFieldKeyRange[];\n\n\tcreateEmpty(): TChangeset;\n}\n\nexport interface FieldChangeRebaser<TChangeset> {\n\t/**\n\t * Compose a collection of changesets into a single one.\n\t * For each node which has a change in both changesets, `composeChild` must be called\n\t * and the result used as the composite node change.\n\t * Calling `composeChild` when one of the changesets has no node change is unnecessary but tolerated.\n\t * See `ChangeRebaser` for more details.\n\t */\n\tcompose(\n\t\tchange1: TChangeset,\n\t\tchange2: TChangeset,\n\t\tcomposeChild: NodeChangeComposer,\n\t\tgenId: IdAllocator,\n\t\tcrossFieldManager: CrossFieldManager,\n\t\trevisionMetadata: RevisionMetadataSource,\n\t): TChangeset;\n\n\t/**\n\t * @returns the inverse of `changes`.\n\t * See `ChangeRebaser` for details.\n\t */\n\tinvert(\n\t\tchange: TChangeset,\n\t\tisRollback: boolean,\n\t\tgenId: IdAllocator,\n\t\tcrossFieldManager: CrossFieldManager,\n\t\trevisionMetadata: RevisionMetadataSource,\n\t): TChangeset;\n\n\t/**\n\t * Rebase `change` over `over`.\n\t * See `ChangeRebaser` for details.\n\t */\n\trebase(\n\t\tchange: TChangeset,\n\t\tover: TChangeset,\n\t\trebaseChild: NodeChangeRebaser,\n\t\tgenId: IdAllocator,\n\t\tcrossFieldManager: CrossFieldManager,\n\t\trevisionMetadata: RebaseRevisionMetadata,\n\t): TChangeset;\n\n\t/**\n\t * @returns `change` with any empty child node changesets removed.\n\t */\n\tprune(change: TChangeset, pruneChild: NodeChangePruner): TChangeset;\n\n\treplaceRevisions(\n\t\tchange: TChangeset,\n\t\toldRevisions: Set<RevisionTag | undefined>,\n\t\tnewRevisions: RevisionTag | undefined,\n\t): TChangeset;\n}\n\n/**\n * Helper for creating a {@link FieldChangeRebaser} which does not need access to revision tags.\n * This should only be used for fields where the child nodes cannot be edited.\n */\nexport function referenceFreeFieldChangeRebaser<TChangeset>(data: {\n\tcompose: (change1: TChangeset, change2: TChangeset) => TChangeset;\n\tinvert: (change: TChangeset) => TChangeset;\n\trebase: (change: TChangeset, over: TChangeset) => TChangeset;\n}): FieldChangeRebaser<TChangeset> {\n\treturn isolatedFieldChangeRebaser({\n\t\tcompose: (change1, change2, _composeChild, _genId) => data.compose(change1, change2),\n\t\tinvert: (change, _invertChild, _genId) => data.invert(change),\n\t\trebase: (change, over, _rebaseChild, _genId) => data.rebase(change, over),\n\t});\n}\n\nexport function isolatedFieldChangeRebaser<TChangeset>(data: {\n\tcompose: FieldChangeRebaser<TChangeset>[\"compose\"];\n\tinvert: FieldChangeRebaser<TChangeset>[\"invert\"];\n\trebase: FieldChangeRebaser<TChangeset>[\"rebase\"];\n}): FieldChangeRebaser<TChangeset> {\n\treturn {\n\t\t...data,\n\t\tprune: (change) => change,\n\t\treplaceRevisions: (change) => change,\n\t};\n}\n\nexport interface FieldEditor<TChangeset> {\n\t/**\n\t * Creates a changeset which represents the given `change` to the child at `childIndex` of this editor's field.\n\t */\n\tbuildChildChange(childIndex: number, change: NodeId): TChangeset;\n}\n\n/**\n * The `index` represents the index of the child node in the input context.\n * The `index` should be `undefined` iff the child node does not exist in the input context (e.g., an inserted node).\n * @internal\n */\nexport type ToDelta = (child: NodeId) => DeltaFieldMap;\n\n/**\n * @internal\n */\nexport type NodeChangeInverter = (change: NodeId) => NodeId;\n\n/**\n * @internal\n */\nexport enum NodeAttachState {\n\tAttached,\n\tDetached,\n}\n\n/**\n * @internal\n */\nexport type NodeChangeRebaser = (\n\tchange: NodeId | undefined,\n\tbaseChange: NodeId | undefined,\n\t/**\n\t * Whether the node is attached to this field in the output context of the base change.\n\t * Defaults to attached if undefined.\n\t */\n\tstate?: NodeAttachState,\n) => NodeId | undefined;\n\n/**\n * @internal\n */\nexport type NodeChangeComposer = (\n\tchange1: NodeId | undefined,\n\tchange2: NodeId | undefined,\n) => NodeId;\n\n/**\n * @internal\n */\nexport type NodeChangePruner = (change: NodeId) => NodeId | undefined;\n\n/**\n * A function that returns the set of removed roots that should be in memory for a given node changeset to be applied.\n *\n * @internal\n */\nexport type RelevantRemovedRootsFromChild = (child: NodeId) => Iterable<DeltaDetachedNodeId>;\n\nexport interface RebaseRevisionMetadata extends RevisionMetadataSource {\n\treadonly getRevisionToRebase: () => RevisionTag | undefined;\n\treadonly getBaseRevisions: () => RevisionTag[];\n}\n\nexport interface FieldChangeEncodingContext {\n\treadonly baseContext: ChangeEncodingContext;\n\tencodeNode(nodeId: NodeId): EncodedNodeChangeset;\n\tdecodeNode(encodedNode: EncodedNodeChangeset): NodeId;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"genericFieldKind.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/genericFieldKind.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAIN,KAAK,sBAAsB,EAI3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,WAAW,EAAQ,MAAM,qBAAqB,CAAC;AAG7D,OAAO,KAAK,EACX,kBAAkB,EAClB,kBAAkB,EAKlB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAGnE;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,kBAAkB,CAAC,gBAAgB,CAwErE,CAAC;AA2EF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,mBAM9B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAC3C,SAAS,EAAE,gBAAgB,EAC3B,MAAM,EAAE,kBAAkB,CAAC,OAAO,CAAC,EACnC,YAAY,EAAE,kBAAkB,EAChC,KAAK,EAAE,WAAW,EAClB,gBAAgB,EAAE,sBAAsB,GACtC,OAAO,CAmBT;AAQD,wBAAgB,mBAAmB,IAAI,gBAAgB,CAEtD"}
1
+ {"version":3,"file":"genericFieldKind.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/genericFieldKind.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAIN,KAAK,sBAAsB,EAI3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,WAAW,EAAQ,MAAM,qBAAqB,CAAC;AAG7D,OAAO,KAAK,EACX,kBAAkB,EAClB,kBAAkB,EAKlB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAGnE;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,kBAAkB,CAAC,gBAAgB,CAyErE,CAAC;AA2EF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,mBAM9B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAC3C,SAAS,EAAE,gBAAgB,EAC3B,MAAM,EAAE,kBAAkB,CAAC,OAAO,CAAC,EACnC,YAAY,EAAE,kBAAkB,EAChC,KAAK,EAAE,WAAW,EAClB,gBAAgB,EAAE,sBAAsB,GACtC,OAAO,CAmBT;AAUD,wBAAgB,mBAAmB,IAAI,gBAAgB,CAEtD"}
@@ -80,6 +80,7 @@ exports.genericChangeHandler = {
80
80
  isEmpty: (change) => change.length === 0,
81
81
  getNestedChanges,
82
82
  createEmpty: () => [],
83
+ getCrossFieldKeys: (_change) => [],
83
84
  };
84
85
  function getNestedChanges(change) {
85
86
  return change.map(({ index, nodeChange }) => [nodeChange, index]);
@@ -162,6 +163,8 @@ const invalidFunc = () => (0, index_js_2.fail)("Should not be called when conver
162
163
  const invalidCrossFieldManager = {
163
164
  set: invalidFunc,
164
165
  get: invalidFunc,
166
+ onMoveIn: invalidFunc,
167
+ moveKey: invalidFunc,
165
168
  };
166
169
  function newGenericChangeset() {
167
170
  return [];
@@ -1 +1 @@
1
- {"version":3,"file":"genericFieldKind.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/genericFieldKind.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kDAQ6B;AAC7B,kDAA6D;AAW7D,qEAA+D;AAC/D,2EAAqE;AAIrE;;GAEG;AACU,QAAA,oBAAoB,GAAyC;IACzE,OAAO,EAAE;QACR,OAAO,EAAE,CACR,OAAyB,EACzB,OAAyB,EACzB,eAAmC,EAChB,EAAE;YACrB,MAAM,QAAQ,GAAqB,EAAE,CAAC;YAEtC,IAAI,UAAU,GAAG,CAAC,CAA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CAAC;IAEF,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,MAAM,CAAC,WAAW,EAAE,CAAC;IAC7B,CAAC;IAED,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAC/B,MAAM,CAAC,OAAO,CAAC,OAAO,CACrB,CAAC,EACD,CAAC,EACD,YAAY,EACZ,KAAK,EACL,wBAAwB,EACxB,gBAAgB,CAChB,CACD,CAAC;AACH,CAAC;AAzBD,oDAyBC;AAED,MAAM,WAAW,GAAG,GAAU,EAAE,CAAC,IAAA,eAAI,EAAC,sDAAsD,CAAC,CAAC;AAC9F,MAAM,wBAAwB,GAAsB;IACnD,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,WAAW;CAChB,CAAC;AAEF,SAAgB,mBAAmB;IAClC,OAAO,EAAE,CAAC;AACX,CAAC;AAFD,kDAEC;AAED,QAAQ,CAAC,CAAC,oBAAoB,CAC7B,MAAwB,EACxB,6BAA4D;IAE5D,KAAK,MAAM,EAAE,UAAU,EAAE,IAAI,MAAM,EAAE,CAAC;QACrC,KAAK,CAAC,CAAC,6BAA6B,CAAC,UAAU,CAAC,CAAC;IAClD,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype DeltaDetachedNodeId,\n\ttype DeltaFieldChanges,\n\ttype DeltaMark,\n\ttype RevisionMetadataSource,\n\tMultiplicity,\n\ttype RevisionTag,\n\treplaceAtomRevisions,\n} from \"../../core/index.js\";\nimport { type IdAllocator, fail } from \"../../util/index.js\";\n\nimport type { CrossFieldManager } from \"./crossFieldQueries.js\";\nimport type {\n\tFieldChangeHandler,\n\tNodeChangeComposer,\n\tNodeChangePruner,\n\tNodeChangeRebaser,\n\tRelevantRemovedRootsFromChild,\n\tToDelta,\n} from \"./fieldChangeHandler.js\";\nimport { FieldKindWithEditor } from \"./fieldKindWithEditor.js\";\nimport { makeGenericChangeCodec } from \"./genericFieldKindCodecs.js\";\nimport type { GenericChangeset } from \"./genericFieldKindTypes.js\";\nimport type { NodeId } from \"./modularChangeTypes.js\";\n\n/**\n * {@link FieldChangeHandler} implementation for {@link GenericChangeset}.\n */\nexport const genericChangeHandler: FieldChangeHandler<GenericChangeset> = {\n\trebaser: {\n\t\tcompose: (\n\t\t\tchange1: GenericChangeset,\n\t\t\tchange2: GenericChangeset,\n\t\t\tcomposeChildren: NodeChangeComposer,\n\t\t): GenericChangeset => {\n\t\t\tconst composed: GenericChangeset = [];\n\n\t\t\tlet listIndex1 = 0;\n\t\t\tlet listIndex2 = 0;\n\n\t\t\twhile (listIndex1 < change1.length || listIndex2 < change2.length) {\n\t\t\t\tconst next1 = change1[listIndex1];\n\t\t\t\tconst next2 = change2[listIndex2];\n\t\t\t\tconst nodeIndex1 = next1?.index ?? Infinity;\n\t\t\t\tconst nodeIndex2 = next2?.index ?? Infinity;\n\t\t\t\tif (nodeIndex1 < nodeIndex2) {\n\t\t\t\t\tcomposed.push({\n\t\t\t\t\t\tindex: nodeIndex1,\n\t\t\t\t\t\tnodeChange: composeChildren(next1.nodeChange, undefined),\n\t\t\t\t\t});\n\t\t\t\t\tlistIndex1 += 1;\n\t\t\t\t} else if (nodeIndex2 < nodeIndex1) {\n\t\t\t\t\tcomposed.push({\n\t\t\t\t\t\tindex: nodeIndex2,\n\t\t\t\t\t\tnodeChange: composeChildren(undefined, next2.nodeChange),\n\t\t\t\t\t});\n\t\t\t\t\tlistIndex2 += 1;\n\t\t\t\t} else {\n\t\t\t\t\t// Both nodes are at the same position.\n\t\t\t\t\tcomposed.push({\n\t\t\t\t\t\tindex: nodeIndex1,\n\t\t\t\t\t\tnodeChange: composeChildren(next1.nodeChange, next2.nodeChange),\n\t\t\t\t\t});\n\t\t\t\t\tlistIndex1 += 1;\n\t\t\t\t\tlistIndex2 += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn composed;\n\t\t},\n\t\tinvert: (change: GenericChangeset): GenericChangeset => {\n\t\t\treturn change;\n\t\t},\n\t\trebase: rebaseGenericChange,\n\t\tprune: pruneGenericChange,\n\t\treplaceRevisions,\n\t},\n\tcodecsFactory: makeGenericChangeCodec,\n\teditor: {\n\t\tbuildChildChange(index, change): GenericChangeset {\n\t\t\treturn [{ index, nodeChange: change }];\n\t\t},\n\t},\n\tintoDelta: (change: GenericChangeset, deltaFromChild: ToDelta): DeltaFieldChanges => {\n\t\tlet nodeIndex = 0;\n\t\tconst markList: DeltaMark[] = [];\n\t\tfor (const { index, nodeChange } of change) {\n\t\t\tif (nodeIndex < index) {\n\t\t\t\tconst offset = index - nodeIndex;\n\t\t\t\tmarkList.push({ count: offset });\n\t\t\t\tnodeIndex = index;\n\t\t\t}\n\t\t\tmarkList.push({ count: 1, fields: deltaFromChild(nodeChange) });\n\t\t\tnodeIndex += 1;\n\t\t}\n\t\treturn { local: markList };\n\t},\n\trelevantRemovedRoots,\n\tisEmpty: (change: GenericChangeset): boolean => change.length === 0,\n\tgetNestedChanges,\n\tcreateEmpty: (): GenericChangeset => [],\n};\n\nfunction getNestedChanges(change: GenericChangeset): [NodeId, number | undefined][] {\n\treturn change.map(({ index, nodeChange }) => [nodeChange, index]);\n}\n\nfunction rebaseGenericChange(\n\tchange: GenericChangeset,\n\tover: GenericChangeset,\n\trebaseChild: NodeChangeRebaser,\n): GenericChangeset {\n\tconst rebased: GenericChangeset = [];\n\tlet iChange = 0;\n\tlet iOver = 0;\n\twhile (iChange < change.length || iOver < over.length) {\n\t\tconst a = change[iChange];\n\t\tconst b = over[iOver];\n\t\tconst aIndex = a?.index ?? Infinity;\n\t\tconst bIndex = b?.index ?? Infinity;\n\t\tlet nodeChangeA: NodeId | undefined;\n\t\tlet nodeChangeB: NodeId | undefined;\n\t\tlet index: number;\n\t\tif (aIndex === bIndex) {\n\t\t\tindex = a.index;\n\t\t\tnodeChangeA = a.nodeChange;\n\t\t\tnodeChangeB = b.nodeChange;\n\t\t\tiChange += 1;\n\t\t\tiOver += 1;\n\t\t} else if (aIndex < bIndex) {\n\t\t\tindex = a.index;\n\t\t\tnodeChangeA = a.nodeChange;\n\t\t\tiChange += 1;\n\t\t} else {\n\t\t\tindex = b.index;\n\t\t\tnodeChangeB = b.nodeChange;\n\t\t\tiOver += 1;\n\t\t}\n\n\t\tconst nodeChange = rebaseChild(nodeChangeA, nodeChangeB);\n\t\tif (nodeChange !== undefined) {\n\t\t\trebased.push({\n\t\t\t\tindex,\n\t\t\t\tnodeChange,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn rebased;\n}\n\nfunction pruneGenericChange(\n\tchangeset: GenericChangeset,\n\tpruneChild: NodeChangePruner,\n): GenericChangeset {\n\tconst pruned: GenericChangeset = [];\n\tfor (const change of changeset) {\n\t\tconst prunedNode = pruneChild(change.nodeChange);\n\t\tif (prunedNode !== undefined) {\n\t\t\tpruned.push({ ...change, nodeChange: prunedNode });\n\t\t}\n\t}\n\treturn pruned;\n}\n\nfunction replaceRevisions(\n\tchangeset: GenericChangeset,\n\toldRevisions: Set<RevisionTag | undefined>,\n\tnewRevision: RevisionTag | undefined,\n): GenericChangeset {\n\treturn changeset.map((change) => ({\n\t\t...change,\n\t\tnodeChange: replaceAtomRevisions(change.nodeChange, oldRevisions, newRevision),\n\t}));\n}\n\n/**\n * {@link FieldKind} used to represent changes to elements of a field in a field-kind-agnostic format.\n */\nexport const genericFieldKind: FieldKindWithEditor = new FieldKindWithEditor(\n\t\"ModularEditBuilder.Generic\",\n\tMultiplicity.Sequence,\n\tgenericChangeHandler,\n\t(types, other) => false,\n\tnew Set(),\n);\n\n/**\n * Converts a {@link GenericChangeset} into a field-kind-specific `TChange`.\n * @param changeset - The generic changeset to convert.\n * @param target - The {@link FieldChangeHandler} for the `FieldKind` that the returned change should target.\n * @param composeChild - A delegate to compose {@link NodeChangeset}s.\n * @returns An equivalent changeset as represented by the `target` field-kind.\n */\nexport function convertGenericChange<TChange>(\n\tchangeset: GenericChangeset,\n\ttarget: FieldChangeHandler<TChange>,\n\tcomposeChild: NodeChangeComposer,\n\tgenId: IdAllocator,\n\trevisionMetadata: RevisionMetadataSource,\n): TChange {\n\tconst perIndex: TChange[] = changeset.map(({ index, nodeChange }) =>\n\t\ttarget.editor.buildChildChange(index, nodeChange),\n\t);\n\n\tif (perIndex.length === 0) {\n\t\treturn target.createEmpty();\n\t}\n\n\treturn perIndex.reduce((a, b) =>\n\t\ttarget.rebaser.compose(\n\t\t\ta,\n\t\t\tb,\n\t\t\tcomposeChild,\n\t\t\tgenId,\n\t\t\tinvalidCrossFieldManager,\n\t\t\trevisionMetadata,\n\t\t),\n\t);\n}\n\nconst invalidFunc = (): never => fail(\"Should not be called when converting generic changes\");\nconst invalidCrossFieldManager: CrossFieldManager = {\n\tset: invalidFunc,\n\tget: invalidFunc,\n};\n\nexport function newGenericChangeset(): GenericChangeset {\n\treturn [];\n}\n\nfunction* relevantRemovedRoots(\n\tchange: GenericChangeset,\n\trelevantRemovedRootsFromChild: RelevantRemovedRootsFromChild,\n): Iterable<DeltaDetachedNodeId> {\n\tfor (const { nodeChange } of change) {\n\t\tyield* relevantRemovedRootsFromChild(nodeChange);\n\t}\n}\n"]}
1
+ {"version":3,"file":"genericFieldKind.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/genericFieldKind.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kDAQ6B;AAC7B,kDAA6D;AAW7D,qEAA+D;AAC/D,2EAAqE;AAIrE;;GAEG;AACU,QAAA,oBAAoB,GAAyC;IACzE,OAAO,EAAE;QACR,OAAO,EAAE,CACR,OAAyB,EACzB,OAAyB,EACzB,eAAmC,EAChB,EAAE;YACrB,MAAM,QAAQ,GAAqB,EAAE,CAAC;YAEtC,IAAI,UAAU,GAAG,CAAC,CAAC;YACnB,IAAI,UAAU,GAAG,CAAC,CAAC;YAEnB,OAAO,UAAU,GAAG,OAAO,CAAC,MAAM,IAAI,UAAU,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KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,MAAM,CAAC,WAAW,EAAE,CAAC;IAC7B,CAAC;IAED,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAC/B,MAAM,CAAC,OAAO,CAAC,OAAO,CACrB,CAAC,EACD,CAAC,EACD,YAAY,EACZ,KAAK,EACL,wBAAwB,EACxB,gBAAgB,CAChB,CACD,CAAC;AACH,CAAC;AAzBD,oDAyBC;AAED,MAAM,WAAW,GAAG,GAAU,EAAE,CAAC,IAAA,eAAI,EAAC,sDAAsD,CAAC,CAAC;AAC9F,MAAM,wBAAwB,GAAsB;IACnD,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,WAAW;IAChB,QAAQ,EAAE,WAAW;IACrB,OAAO,EAAE,WAAW;CACpB,CAAC;AAEF,SAAgB,mBAAmB;IAClC,OAAO,EAAE,CAAC;AACX,CAAC;AAFD,kDAEC;AAED,QAAQ,CAAC,CAAC,oBAAoB,CAC7B,MAAwB,EACxB,6BAA4D;IAE5D,KAAK,MAAM,EAAE,UAAU,EAAE,IAAI,MAAM,EAAE,CAAC;QACrC,KAAK,CAAC,CAAC,6BAA6B,CAAC,UAAU,CAAC,CAAC;IAClD,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype DeltaDetachedNodeId,\n\ttype DeltaFieldChanges,\n\ttype DeltaMark,\n\ttype RevisionMetadataSource,\n\tMultiplicity,\n\ttype RevisionTag,\n\treplaceAtomRevisions,\n} from \"../../core/index.js\";\nimport { type IdAllocator, fail } from \"../../util/index.js\";\n\nimport type { CrossFieldManager } from \"./crossFieldQueries.js\";\nimport type {\n\tFieldChangeHandler,\n\tNodeChangeComposer,\n\tNodeChangePruner,\n\tNodeChangeRebaser,\n\tRelevantRemovedRootsFromChild,\n\tToDelta,\n} from \"./fieldChangeHandler.js\";\nimport { FieldKindWithEditor } from \"./fieldKindWithEditor.js\";\nimport { makeGenericChangeCodec } from \"./genericFieldKindCodecs.js\";\nimport type { GenericChangeset } from \"./genericFieldKindTypes.js\";\nimport type { NodeId } from \"./modularChangeTypes.js\";\n\n/**\n * {@link FieldChangeHandler} implementation for {@link GenericChangeset}.\n */\nexport const genericChangeHandler: FieldChangeHandler<GenericChangeset> = {\n\trebaser: {\n\t\tcompose: (\n\t\t\tchange1: GenericChangeset,\n\t\t\tchange2: GenericChangeset,\n\t\t\tcomposeChildren: NodeChangeComposer,\n\t\t): GenericChangeset => {\n\t\t\tconst composed: GenericChangeset = [];\n\n\t\t\tlet listIndex1 = 0;\n\t\t\tlet listIndex2 = 0;\n\n\t\t\twhile (listIndex1 < change1.length || listIndex2 < change2.length) {\n\t\t\t\tconst next1 = change1[listIndex1];\n\t\t\t\tconst next2 = change2[listIndex2];\n\t\t\t\tconst nodeIndex1 = next1?.index ?? Infinity;\n\t\t\t\tconst nodeIndex2 = next2?.index ?? Infinity;\n\t\t\t\tif (nodeIndex1 < nodeIndex2) {\n\t\t\t\t\tcomposed.push({\n\t\t\t\t\t\tindex: nodeIndex1,\n\t\t\t\t\t\tnodeChange: composeChildren(next1.nodeChange, undefined),\n\t\t\t\t\t});\n\t\t\t\t\tlistIndex1 += 1;\n\t\t\t\t} else if (nodeIndex2 < nodeIndex1) {\n\t\t\t\t\tcomposed.push({\n\t\t\t\t\t\tindex: nodeIndex2,\n\t\t\t\t\t\tnodeChange: composeChildren(undefined, next2.nodeChange),\n\t\t\t\t\t});\n\t\t\t\t\tlistIndex2 += 1;\n\t\t\t\t} else {\n\t\t\t\t\t// Both nodes are at the same position.\n\t\t\t\t\tcomposed.push({\n\t\t\t\t\t\tindex: nodeIndex1,\n\t\t\t\t\t\tnodeChange: composeChildren(next1.nodeChange, next2.nodeChange),\n\t\t\t\t\t});\n\t\t\t\t\tlistIndex1 += 1;\n\t\t\t\t\tlistIndex2 += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn composed;\n\t\t},\n\t\tinvert: (change: GenericChangeset): GenericChangeset => {\n\t\t\treturn change;\n\t\t},\n\t\trebase: rebaseGenericChange,\n\t\tprune: pruneGenericChange,\n\t\treplaceRevisions,\n\t},\n\tcodecsFactory: makeGenericChangeCodec,\n\teditor: {\n\t\tbuildChildChange(index, change): GenericChangeset {\n\t\t\treturn [{ index, nodeChange: change }];\n\t\t},\n\t},\n\tintoDelta: (change: GenericChangeset, deltaFromChild: ToDelta): DeltaFieldChanges => {\n\t\tlet nodeIndex = 0;\n\t\tconst markList: DeltaMark[] = [];\n\t\tfor (const { index, nodeChange } of change) {\n\t\t\tif (nodeIndex < index) {\n\t\t\t\tconst offset = index - nodeIndex;\n\t\t\t\tmarkList.push({ count: offset });\n\t\t\t\tnodeIndex = index;\n\t\t\t}\n\t\t\tmarkList.push({ count: 1, fields: deltaFromChild(nodeChange) });\n\t\t\tnodeIndex += 1;\n\t\t}\n\t\treturn { local: markList };\n\t},\n\trelevantRemovedRoots,\n\tisEmpty: (change: GenericChangeset): boolean => change.length === 0,\n\tgetNestedChanges,\n\tcreateEmpty: (): GenericChangeset => [],\n\tgetCrossFieldKeys: (_change) => [],\n};\n\nfunction getNestedChanges(change: GenericChangeset): [NodeId, number | undefined][] {\n\treturn change.map(({ index, nodeChange }) => [nodeChange, index]);\n}\n\nfunction rebaseGenericChange(\n\tchange: GenericChangeset,\n\tover: GenericChangeset,\n\trebaseChild: NodeChangeRebaser,\n): GenericChangeset {\n\tconst rebased: GenericChangeset = [];\n\tlet iChange = 0;\n\tlet iOver = 0;\n\twhile (iChange < change.length || iOver < over.length) {\n\t\tconst a = change[iChange];\n\t\tconst b = over[iOver];\n\t\tconst aIndex = a?.index ?? Infinity;\n\t\tconst bIndex = b?.index ?? Infinity;\n\t\tlet nodeChangeA: NodeId | undefined;\n\t\tlet nodeChangeB: NodeId | undefined;\n\t\tlet index: number;\n\t\tif (aIndex === bIndex) {\n\t\t\tindex = a.index;\n\t\t\tnodeChangeA = a.nodeChange;\n\t\t\tnodeChangeB = b.nodeChange;\n\t\t\tiChange += 1;\n\t\t\tiOver += 1;\n\t\t} else if (aIndex < bIndex) {\n\t\t\tindex = a.index;\n\t\t\tnodeChangeA = a.nodeChange;\n\t\t\tiChange += 1;\n\t\t} else {\n\t\t\tindex = b.index;\n\t\t\tnodeChangeB = b.nodeChange;\n\t\t\tiOver += 1;\n\t\t}\n\n\t\tconst nodeChange = rebaseChild(nodeChangeA, nodeChangeB);\n\t\tif (nodeChange !== undefined) {\n\t\t\trebased.push({\n\t\t\t\tindex,\n\t\t\t\tnodeChange,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn rebased;\n}\n\nfunction pruneGenericChange(\n\tchangeset: GenericChangeset,\n\tpruneChild: NodeChangePruner,\n): GenericChangeset {\n\tconst pruned: GenericChangeset = [];\n\tfor (const change of changeset) {\n\t\tconst prunedNode = pruneChild(change.nodeChange);\n\t\tif (prunedNode !== undefined) {\n\t\t\tpruned.push({ ...change, nodeChange: prunedNode });\n\t\t}\n\t}\n\treturn pruned;\n}\n\nfunction replaceRevisions(\n\tchangeset: GenericChangeset,\n\toldRevisions: Set<RevisionTag | undefined>,\n\tnewRevision: RevisionTag | undefined,\n): GenericChangeset {\n\treturn changeset.map((change) => ({\n\t\t...change,\n\t\tnodeChange: replaceAtomRevisions(change.nodeChange, oldRevisions, newRevision),\n\t}));\n}\n\n/**\n * {@link FieldKind} used to represent changes to elements of a field in a field-kind-agnostic format.\n */\nexport const genericFieldKind: FieldKindWithEditor = new FieldKindWithEditor(\n\t\"ModularEditBuilder.Generic\",\n\tMultiplicity.Sequence,\n\tgenericChangeHandler,\n\t(types, other) => false,\n\tnew Set(),\n);\n\n/**\n * Converts a {@link GenericChangeset} into a field-kind-specific `TChange`.\n * @param changeset - The generic changeset to convert.\n * @param target - The {@link FieldChangeHandler} for the `FieldKind` that the returned change should target.\n * @param composeChild - A delegate to compose {@link NodeChangeset}s.\n * @returns An equivalent changeset as represented by the `target` field-kind.\n */\nexport function convertGenericChange<TChange>(\n\tchangeset: GenericChangeset,\n\ttarget: FieldChangeHandler<TChange>,\n\tcomposeChild: NodeChangeComposer,\n\tgenId: IdAllocator,\n\trevisionMetadata: RevisionMetadataSource,\n): TChange {\n\tconst perIndex: TChange[] = changeset.map(({ index, nodeChange }) =>\n\t\ttarget.editor.buildChildChange(index, nodeChange),\n\t);\n\n\tif (perIndex.length === 0) {\n\t\treturn target.createEmpty();\n\t}\n\n\treturn perIndex.reduce((a, b) =>\n\t\ttarget.rebaser.compose(\n\t\t\ta,\n\t\t\tb,\n\t\t\tcomposeChild,\n\t\t\tgenId,\n\t\t\tinvalidCrossFieldManager,\n\t\t\trevisionMetadata,\n\t\t),\n\t);\n}\n\nconst invalidFunc = (): never => fail(\"Should not be called when converting generic changes\");\nconst invalidCrossFieldManager: CrossFieldManager = {\n\tset: invalidFunc,\n\tget: invalidFunc,\n\tonMoveIn: invalidFunc,\n\tmoveKey: invalidFunc,\n};\n\nexport function newGenericChangeset(): GenericChangeset {\n\treturn [];\n}\n\nfunction* relevantRemovedRoots(\n\tchange: GenericChangeset,\n\trelevantRemovedRootsFromChild: RelevantRemovedRootsFromChild,\n): Iterable<DeltaDetachedNodeId> {\n\tfor (const { nodeChange } of change) {\n\t\tyield* relevantRemovedRootsFromChild(nodeChange);\n\t}\n}\n"]}
@@ -9,10 +9,11 @@ export { ChangesetLocalIdSchema, EncodedChangeAtomId, EncodedRevisionInfo, Encod
9
9
  export { FlexFieldKind, type FullSchemaPolicy } from "./fieldKind.js";
10
10
  export { FieldKindWithEditor } from "./fieldKindWithEditor.js";
11
11
  export { type FieldChangeHandler, type FieldChangeRebaser, type FieldEditor, type NodeChangeComposer, type NodeChangeInverter, type NodeChangeRebaser, type NodeChangePruner, referenceFreeFieldChangeRebaser, type RebaseRevisionMetadata, type RelevantRemovedRootsFromChild, type ToDelta, NodeAttachState, type FieldChangeEncodingContext, } from "./fieldChangeHandler.js";
12
- export type { FieldChange, FieldChangeMap, FieldChangeset, HasFieldChanges, ModularChangeset, NodeExistsConstraint, NodeId, } from "./modularChangeTypes.js";
12
+ export type { CrossFieldKeyRange, FieldChange, FieldChangeMap, FieldChangeset, HasFieldChanges, ModularChangeset, NodeExistsConstraint, NodeId, } from "./modularChangeTypes.js";
13
13
  export { convertGenericChange, genericChangeHandler, genericFieldKind, } from "./genericFieldKind.js";
14
14
  export type { GenericChange, GenericChangeset } from "./genericFieldKindTypes.js";
15
15
  export { ModularChangeFamily, ModularEditBuilder, type EditDescription, type GlobalEditDescription, type FieldEditDescription, rebaseRevisionMetadataFromInfo, intoDelta, relevantRemovedRoots, updateRefreshers, } from "./modularChangeFamily.js";
16
16
  export { makeModularChangeCodecFamily } from "./modularChangeCodecs.js";
17
17
  export type { FieldKindConfiguration, FieldKindConfigurationEntry, } from "./fieldKindConfiguration.js";
18
+ export { getAllowedContentIncompatibilities } from "./discrepancies.js";
18
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,kBAAkB,EAClB,kCAAkC,EAClC,mBAAmB,EACnB,kBAAkB,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EACN,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,gBAAgB,EAChB,kBAAkB,GAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,+BAA+B,EAC/B,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,EAClC,KAAK,OAAO,EACZ,eAAe,EACf,KAAK,0BAA0B,GAC/B,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACX,WAAW,EACX,cAAc,EACd,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,MAAM,GACN,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,GAChB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAClF,OAAO,EACN,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,8BAA8B,EAC9B,SAAS,EACT,oBAAoB,EACpB,gBAAgB,GAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AACxE,YAAY,EACX,sBAAsB,EACtB,2BAA2B,GAC3B,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,kBAAkB,EAClB,kCAAkC,EAClC,mBAAmB,EACnB,kBAAkB,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EACN,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,gBAAgB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ed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.makeModularChangeCodecFamily = exports.updateRefreshers = exports.relevantRemovedRoots = exports.intoDelta = exports.rebaseRevisionMetadataFromInfo = exports.ModularEditBuilder = exports.ModularChangeFamily = exports.genericFieldKind = exports.genericChangeHandler = exports.convertGenericChange = exports.NodeAttachState = exports.referenceFreeFieldChangeRebaser = exports.FieldKindWithEditor = exports.FlexFieldKind = exports.EncodedNodeChangeset = exports.EncodedModularChangeset = exports.EncodedRevisionInfo = exports.EncodedChangeAtomId = exports.ChangesetLocalIdSchema = exports.setInCrossFieldMap = exports.CrossFieldTarget = exports.addCrossFieldQuery = exports.isNeverTree = exports.isNeverField = exports.allowsTreeSuperset = exports.allowsFieldSuperset = exports.allowsTreeSchemaIdentifierSuperset = exports.allowsRepoSuperset = void 0;
7
+ exports.getAllowedContentIncompatibilities = exports.makeModularChangeCodecFamily = exports.updateRefreshers = exports.relevantRemovedRoots = exports.intoDelta = exports.rebaseRevisionMetadataFromInfo = exports.ModularEditBuilder = exports.ModularChangeFamily = exports.genericFieldKind = exports.genericChangeHandler = exports.convertGenericChange = exports.NodeAttachState = exports.referenceFreeFieldChangeRebaser = exports.FieldKindWithEditor = exports.FlexFieldKind = exports.EncodedNodeChangeset = exports.EncodedModularChangeset = exports.EncodedRevisionInfo = exports.EncodedChangeAtomId = exports.ChangesetLocalIdSchema = exports.setInCrossFieldMap = exports.CrossFieldTarget = exports.addCrossFieldQuery = exports.isNeverTree = exports.isNeverField = exports.allowsTreeSuperset = exports.allowsFieldSuperset = exports.allowsTreeSchemaIdentifierSuperset = exports.allowsRepoSuperset = void 0;
8
8
  var comparison_js_1 = require("./comparison.js");
9
9
  Object.defineProperty(exports, "allowsRepoSuperset", { enumerable: true, get: function () { return comparison_js_1.allowsRepoSuperset; } });
10
10
  Object.defineProperty(exports, "allowsTreeSchemaIdentifierSuperset", { enumerable: true, get: function () { return comparison_js_1.allowsTreeSchemaIdentifierSuperset; } });
@@ -43,4 +43,6 @@ Object.defineProperty(exports, "relevantRemovedRoots", { enumerable: true, get:
43
43
  Object.defineProperty(exports, "updateRefreshers", { enumerable: true, get: function () { return modularChangeFamily_js_1.updateRefreshers; } });
44
44
  var modularChangeCodecs_js_1 = require("./modularChangeCodecs.js");
45
45
  Object.defineProperty(exports, "makeModularChangeCodecFamily", { enumerable: true, get: function () { return modularChangeCodecs_js_1.makeModularChangeCodecFamily; } });
46
+ var discrepancies_js_1 = require("./discrepancies.js");
47
+ Object.defineProperty(exports, "getAllowedContentIncompatibilities", { enumerable: true, get: function () { return discrepancies_js_1.getAllowedContentIncompatibilities; } });
46
48
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDAKyB;AAJxB,mHAAA,kBAAkB,OAAA;AAClB,mIAAA,kCAAkC,OAAA;AAClC,oHAAA,mBAAmB,OAAA;AACnB,mHAAA,kBAAkB,OAAA;AAEnB,mDAA6D;AAApD,8GAAA,YAAY,OAAA;AAAE,6GAAA,WAAW,OAAA;AAClC,+DAOgC;AAN/B,0HAAA,kBAAkB,OAAA;AAIlB,wHAAA,gBAAgB,OAAA;AAChB,0HAAA,kBAAkB,OAAA;AAEnB,mEAMkC;AALjC,gIAAA,sBAAsB,OAAA;AACtB,6HAAA,mBAAmB,OAAA;AACnB,6HAAA,mBAAmB,OAAA;AACnB,iIAAA,uBAAuB,OAAA;AACvB,8HAAA,oBAAoB,OAAA;AAErB,+CAAsE;AAA7D,6GAAA,aAAa,OAAA;AACtB,mEAA+D;AAAtD,6HAAA,mBAAmB,OAAA;AAC5B,iEAciC;AANhC,wIAAA,+BAA+B,OAAA;AAI/B,wHAAA,eAAe,OAAA;AAYhB,6DAI+B;AAH9B,2HAAA,oBAAoB,OAAA;AACpB,2HAAA,oBAAoB,OAAA;AACpB,uHAAA,gBAAgB,OAAA;AAGjB,mEAUkC;AATjC,6HAAA,mBAAmB,OAAA;AACnB,4HAAA,kBAAkB,OAAA;AAIlB,wIAAA,8BAA8B,OAAA;AAC9B,mHAAA,SAAS,OAAA;AACT,8HAAA,oBAAoB,OAAA;AACpB,0HAAA,gBAAgB,OAAA;AAEjB,mEAAwE;AAA/D,sIAAA,4BAA4B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tallowsRepoSuperset,\n\tallowsTreeSchemaIdentifierSuperset,\n\tallowsFieldSuperset,\n\tallowsTreeSuperset,\n} from \"./comparison.js\";\nexport { isNeverField, isNeverTree } from \"./isNeverTree.js\";\nexport {\n\taddCrossFieldQuery,\n\ttype CrossFieldManager,\n\ttype CrossFieldMap,\n\ttype CrossFieldQuerySet,\n\tCrossFieldTarget,\n\tsetInCrossFieldMap,\n} from \"./crossFieldQueries.js\";\nexport {\n\tChangesetLocalIdSchema,\n\tEncodedChangeAtomId,\n\tEncodedRevisionInfo,\n\tEncodedModularChangeset,\n\tEncodedNodeChangeset,\n} from \"./modularChangeFormat.js\";\nexport { FlexFieldKind, type FullSchemaPolicy } from \"./fieldKind.js\";\nexport { FieldKindWithEditor } from \"./fieldKindWithEditor.js\";\nexport {\n\ttype FieldChangeHandler,\n\ttype FieldChangeRebaser,\n\ttype FieldEditor,\n\ttype NodeChangeComposer,\n\ttype NodeChangeInverter,\n\ttype NodeChangeRebaser,\n\ttype NodeChangePruner,\n\treferenceFreeFieldChangeRebaser,\n\ttype RebaseRevisionMetadata,\n\ttype RelevantRemovedRootsFromChild,\n\ttype ToDelta,\n\tNodeAttachState,\n\ttype FieldChangeEncodingContext,\n} from \"./fieldChangeHandler.js\";\nexport type {\n\tFieldChange,\n\tFieldChangeMap,\n\tFieldChangeset,\n\tHasFieldChanges,\n\tModularChangeset,\n\tNodeExistsConstraint,\n\tNodeId,\n} from \"./modularChangeTypes.js\";\nexport {\n\tconvertGenericChange,\n\tgenericChangeHandler,\n\tgenericFieldKind,\n} from \"./genericFieldKind.js\";\nexport type { GenericChange, GenericChangeset } from \"./genericFieldKindTypes.js\";\nexport {\n\tModularChangeFamily,\n\tModularEditBuilder,\n\ttype EditDescription,\n\ttype GlobalEditDescription,\n\ttype FieldEditDescription,\n\trebaseRevisionMetadataFromInfo,\n\tintoDelta,\n\trelevantRemovedRoots,\n\tupdateRefreshers,\n} from \"./modularChangeFamily.js\";\nexport { makeModularChangeCodecFamily } from \"./modularChangeCodecs.js\";\nexport type {\n\tFieldKindConfiguration,\n\tFieldKindConfigurationEntry,\n} from \"./fieldKindConfiguration.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDAKyB;AAJxB,mHAAA,kBAAkB,OAAA;AAClB,mIAAA,kCAAkC,OAAA;AAClC,oHAAA,mBAAmB,OAAA;AACnB,mHAAA,kBAAkB,OAAA;AAEnB,mDAA6D;AAApD,8GAAA,YAAY,OAAA;AAAE,6GAAA,WAAW,OAAA;AAClC,+DAOgC;AAN/B,0HAAA,kBAAkB,OAAA;AAIlB,wHAAA,gBAAgB,OAAA;AAChB,0HAAA,kBAAkB,OAAA;AAEnB,mEAMkC;AALjC,gIAAA,sBAAsB,OAAA;AACtB,6HAAA,mBAAmB,OAAA;AACnB,6HAAA,mBAAmB,OAAA;AACnB,iIAAA,uBAAuB,OAAA;AACvB,8HAAA,oBAAoB,OAAA;AAErB,+CAAsE;AAA7D,6GAAA,aAAa,OAAA;AACtB,mEAA+D;AAAtD,6HAAA,mBAAmB,OAAA;AAC5B,iEAciC;AANhC,wIAAA,+BAA+B,OAAA;AAI/B,wHAAA,eAAe,OAAA;AAahB,6DAI+B;AAH9B,2HAAA,oBAAoB,OAAA;AACpB,2HAAA,oBAAoB,OAAA;AACpB,uHAAA,gBAAgB,OAAA;AAGjB,mEAUkC;AATjC,6HAAA,mBAAmB,OAAA;AACnB,4HAAA,kBAAkB,OAAA;AAIlB,wIAAA,8BAA8B,OAAA;AAC9B,mHAAA,SAAS,OAAA;AACT,8HAAA,oBAAoB,OAAA;AACpB,0HAAA,gBAAgB,OAAA;AAEjB,mEAAwE;AAA/D,sIAAA,4BAA4B,OAAA;AAKrC,uDAAwE;AAA/D,sIAAA,kCAAkC,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tallowsRepoSuperset,\n\tallowsTreeSchemaIdentifierSuperset,\n\tallowsFieldSuperset,\n\tallowsTreeSuperset,\n} from \"./comparison.js\";\nexport { isNeverField, isNeverTree } from \"./isNeverTree.js\";\nexport {\n\taddCrossFieldQuery,\n\ttype CrossFieldManager,\n\ttype CrossFieldMap,\n\ttype CrossFieldQuerySet,\n\tCrossFieldTarget,\n\tsetInCrossFieldMap,\n} from \"./crossFieldQueries.js\";\nexport {\n\tChangesetLocalIdSchema,\n\tEncodedChangeAtomId,\n\tEncodedRevisionInfo,\n\tEncodedModularChangeset,\n\tEncodedNodeChangeset,\n} from \"./modularChangeFormat.js\";\nexport { FlexFieldKind, type FullSchemaPolicy } from \"./fieldKind.js\";\nexport { FieldKindWithEditor } from \"./fieldKindWithEditor.js\";\nexport {\n\ttype FieldChangeHandler,\n\ttype FieldChangeRebaser,\n\ttype FieldEditor,\n\ttype NodeChangeComposer,\n\ttype NodeChangeInverter,\n\ttype NodeChangeRebaser,\n\ttype NodeChangePruner,\n\treferenceFreeFieldChangeRebaser,\n\ttype RebaseRevisionMetadata,\n\ttype RelevantRemovedRootsFromChild,\n\ttype ToDelta,\n\tNodeAttachState,\n\ttype FieldChangeEncodingContext,\n} from \"./fieldChangeHandler.js\";\nexport type {\n\tCrossFieldKeyRange,\n\tFieldChange,\n\tFieldChangeMap,\n\tFieldChangeset,\n\tHasFieldChanges,\n\tModularChangeset,\n\tNodeExistsConstraint,\n\tNodeId,\n} from \"./modularChangeTypes.js\";\nexport {\n\tconvertGenericChange,\n\tgenericChangeHandler,\n\tgenericFieldKind,\n} from \"./genericFieldKind.js\";\nexport type { GenericChange, GenericChangeset } from \"./genericFieldKindTypes.js\";\nexport {\n\tModularChangeFamily,\n\tModularEditBuilder,\n\ttype EditDescription,\n\ttype GlobalEditDescription,\n\ttype FieldEditDescription,\n\trebaseRevisionMetadataFromInfo,\n\tintoDelta,\n\trelevantRemovedRoots,\n\tupdateRefreshers,\n} from \"./modularChangeFamily.js\";\nexport { makeModularChangeCodecFamily } from \"./modularChangeCodecs.js\";\nexport type {\n\tFieldKindConfiguration,\n\tFieldKindConfigurationEntry,\n} from \"./fieldKindConfiguration.js\";\nexport { getAllowedContentIncompatibilities } from \"./discrepancies.js\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"modularChangeCodecs.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/modularChangeCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,UAAU,EAKf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAEX,qBAAqB,EAErB,kBAAkB,EAKlB,WAAW,EACX,MAAM,qBAAqB,CAAC;AAW7B,OAAO,EACN,KAAK,eAAe,EAIpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE,OAAO,KAAK,EACX,sBAAsB,EAEtB,MAAM,6BAA6B,CAAC;AAWrC,OAAO,KAAK,EAGX,gBAAgB,EAGhB,MAAM,yBAAyB,CAAC;AAGjC,wBAAgB,4BAA4B,CAC3C,uBAAuB,EAAE,WAAW,CAAC,MAAM,EAAE,sBAAsB,CAAC,EACpE,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,WAAW,EAAE,eAAe,EAC5B,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,aAAa,EAC3C,wBAAwB,GAAE,uBAA4D,GACpF,YAAY,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAavD"}
1
+ {"version":3,"file":"modularChangeCodecs.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/modularChangeCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,UAAU,EAKf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAEX,qBAAqB,EAErB,kBAAkB,EAKlB,WAAW,EACX,MAAM,qBAAqB,CAAC;AAW7B,OAAO,EACN,KAAK,eAAe,EAIpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE,OAAO,KAAK,EACX,sBAAsB,EAEtB,MAAM,6BAA6B,CAAC;AAWrC,OAAO,KAAK,EAIX,gBAAgB,EAGhB,MAAM,yBAAyB,CAAC;AAIjC,wBAAgB,4BAA4B,CAC3C,uBAAuB,EAAE,WAAW,CAAC,MAAM,EAAE,sBAAsB,CAAC,EACpE,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,WAAW,EAAE,eAAe,EAC5B,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,aAAa,EAC3C,wBAAwB,GAAE,uBAA4D,GACpF,YAAY,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAavD"}