@fluidframework/tree 2.118.0 → 3.0.0

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 (1234) hide show
  1. package/CHANGELOG.md +367 -75
  2. package/README.md +55 -52
  3. package/{api-extractor.json → api-extractor/api-extractor-model.json} +1 -1
  4. package/api-report/tree.alpha.api.md +130 -145
  5. package/api-report/tree.beta.api.md +122 -91
  6. package/api-report/tree.legacy.beta.api.md +122 -91
  7. package/api-report/tree.legacy.public.api.md +26 -43
  8. package/api-report/tree.public.api.md +26 -43
  9. package/dist/api.d.ts +9 -1
  10. package/dist/api.d.ts.map +1 -1
  11. package/dist/api.js +2 -3
  12. package/dist/api.js.map +1 -1
  13. package/dist/codec/codec.d.ts +2 -2
  14. package/dist/codec/codec.d.ts.map +1 -1
  15. package/dist/codec/codec.js +9 -7
  16. package/dist/codec/codec.js.map +1 -1
  17. package/dist/codec/discriminatedUnions.js +1 -0
  18. package/dist/codec/discriminatedUnions.js.map +1 -1
  19. package/dist/codec/versioned/codec.d.ts.map +1 -1
  20. package/dist/codec/versioned/codec.js +4 -2
  21. package/dist/codec/versioned/codec.js.map +1 -1
  22. package/dist/componentApi.d.ts.map +1 -1
  23. package/dist/componentApi.js +20 -17
  24. package/dist/componentApi.js.map +1 -1
  25. package/dist/core/change-family/editBuilder.js +1 -0
  26. package/dist/core/change-family/editBuilder.js.map +1 -1
  27. package/dist/core/forest/editableForest.js +1 -2
  28. package/dist/core/forest/editableForest.js.map +1 -1
  29. package/dist/core/forest/forest.js +3 -3
  30. package/dist/core/forest/forest.js.map +1 -1
  31. package/dist/core/index.d.ts +2 -2
  32. package/dist/core/index.d.ts.map +1 -1
  33. package/dist/core/index.js +9 -5
  34. package/dist/core/index.js.map +1 -1
  35. package/dist/core/rebase/changeRebaser.js +5 -5
  36. package/dist/core/rebase/changeRebaser.js.map +1 -1
  37. package/dist/core/rebase/index.d.ts +1 -1
  38. package/dist/core/rebase/index.d.ts.map +1 -1
  39. package/dist/core/rebase/index.js +2 -1
  40. package/dist/core/rebase/index.js.map +1 -1
  41. package/dist/core/rebase/revisionTagCodec.d.ts +1 -1
  42. package/dist/core/rebase/revisionTagCodec.d.ts.map +1 -1
  43. package/dist/core/rebase/revisionTagCodec.js +3 -1
  44. package/dist/core/rebase/revisionTagCodec.js.map +1 -1
  45. package/dist/core/rebase/types.d.ts +12 -1
  46. package/dist/core/rebase/types.d.ts.map +1 -1
  47. package/dist/core/rebase/types.js +19 -15
  48. package/dist/core/rebase/types.js.map +1 -1
  49. package/dist/core/rebase/utils.js +9 -10
  50. package/dist/core/rebase/utils.js.map +1 -1
  51. package/dist/core/schema-stored/schema.js +9 -4
  52. package/dist/core/schema-stored/schema.js.map +1 -1
  53. package/dist/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  54. package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  55. package/dist/core/schema-stored/storedSchemaRepository.js +6 -4
  56. package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
  57. package/dist/core/tree/anchorSet.d.ts +1 -1
  58. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  59. package/dist/core/tree/anchorSet.js +62 -55
  60. package/dist/core/tree/anchorSet.js.map +1 -1
  61. package/dist/core/tree/chunk.js +2 -2
  62. package/dist/core/tree/chunk.js.map +1 -1
  63. package/dist/core/tree/cursor.js +12 -12
  64. package/dist/core/tree/cursor.js.map +1 -1
  65. package/dist/core/tree/deltaUtil.d.ts +34 -9
  66. package/dist/core/tree/deltaUtil.d.ts.map +1 -1
  67. package/dist/core/tree/deltaUtil.js +51 -17
  68. package/dist/core/tree/deltaUtil.js.map +1 -1
  69. package/dist/core/tree/detachedFieldIndex.js +23 -21
  70. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  71. package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts +10 -10
  72. package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
  73. package/dist/core/tree/detachedFieldIndexCodecCommon.js +1 -2
  74. package/dist/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
  75. package/dist/core/tree/detachedFieldIndexCodecV1.js +3 -2
  76. package/dist/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  77. package/dist/core/tree/detachedFieldIndexCodecV2.js +3 -2
  78. package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  79. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts +3 -3
  80. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  81. package/dist/core/tree/detachedFieldIndexFormatV1.d.ts +1 -1
  82. package/dist/core/tree/detachedFieldIndexFormatV2.d.ts +2 -2
  83. package/dist/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
  84. package/dist/core/tree/index.d.ts +1 -1
  85. package/dist/core/tree/index.d.ts.map +1 -1
  86. package/dist/core/tree/index.js +7 -4
  87. package/dist/core/tree/index.js.map +1 -1
  88. package/dist/core/tree/mapTree.js +1 -2
  89. package/dist/core/tree/mapTree.js.map +1 -1
  90. package/dist/core/tree/pathTree.js +7 -8
  91. package/dist/core/tree/pathTree.js.map +1 -1
  92. package/dist/core/tree/persistedTreeTextFormat.d.ts +4 -4
  93. package/dist/core/tree/persistedTreeTextFormat.d.ts.map +1 -1
  94. package/dist/core/tree/sparseTree.js +17 -13
  95. package/dist/core/tree/sparseTree.js.map +1 -1
  96. package/dist/core/tree/treeTextFormat.js +4 -5
  97. package/dist/core/tree/treeTextFormat.js.map +1 -1
  98. package/dist/core/tree/types.js +3 -3
  99. package/dist/core/tree/types.js.map +1 -1
  100. package/dist/core/tree/visitDelta.js +1 -2
  101. package/dist/core/tree/visitDelta.js.map +1 -1
  102. package/dist/core/tree/visitorUtils.js +5 -6
  103. package/dist/core/tree/visitorUtils.js.map +1 -1
  104. package/dist/entrypoints/alpha.d.ts +1 -1
  105. package/dist/entrypoints/alpha.d.ts.map +1 -1
  106. package/dist/entrypoints/alpha.js +6 -4
  107. package/dist/entrypoints/alpha.js.map +1 -1
  108. package/dist/entrypoints/beta.d.ts +1 -1
  109. package/dist/entrypoints/beta.d.ts.map +1 -1
  110. package/dist/entrypoints/beta.js +2 -2
  111. package/dist/entrypoints/beta.js.map +1 -1
  112. package/dist/entrypoints/legacy.d.ts +1 -1
  113. package/dist/entrypoints/legacy.d.ts.map +1 -1
  114. package/dist/entrypoints/legacy.js +2 -2
  115. package/dist/entrypoints/legacy.js.map +1 -1
  116. package/dist/entrypoints/public.d.ts +1 -1
  117. package/dist/entrypoints/public.d.ts.map +1 -1
  118. package/dist/entrypoints/public.js +1 -2
  119. package/dist/entrypoints/public.js.map +1 -1
  120. package/dist/extensibleUnionNode.d.ts.map +1 -1
  121. package/dist/extensibleUnionNode.js +1 -1
  122. package/dist/extensibleUnionNode.js.map +1 -1
  123. package/dist/feature-libraries/changeAtomIdBTree.js +3 -4
  124. package/dist/feature-libraries/changeAtomIdBTree.js.map +1 -1
  125. package/dist/feature-libraries/changeAtomIdCodec.js +1 -2
  126. package/dist/feature-libraries/changeAtomIdCodec.js.map +1 -1
  127. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  128. package/dist/feature-libraries/chunked-forest/basicChunk.js +14 -1
  129. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  130. package/dist/feature-libraries/chunked-forest/chunkTree.js +28 -20
  131. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  132. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  133. package/dist/feature-libraries/chunked-forest/chunkedForest.js +22 -16
  134. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  135. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +9 -11
  136. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  137. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +15 -7
  138. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  139. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js +7 -3
  140. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  141. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +3 -2
  142. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  143. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  144. package/dist/feature-libraries/chunked-forest/codec/codecs.js +2 -0
  145. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  146. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +33 -17
  147. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  148. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts +2 -2
  149. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -1
  150. package/dist/feature-libraries/chunked-forest/codec/format/versions.js +2 -2
  151. package/dist/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -1
  152. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js +11 -2
  153. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
  154. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +5 -6
  155. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  156. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +2 -3
  157. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  158. package/dist/feature-libraries/chunked-forest/sequenceChunk.js +1 -0
  159. package/dist/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
  160. package/dist/feature-libraries/chunked-forest/uniformChunk.js +73 -15
  161. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  162. package/dist/feature-libraries/comparison-forest/comparisonForest.js +79 -79
  163. package/dist/feature-libraries/comparison-forest/comparisonForest.js.map +1 -1
  164. package/dist/feature-libraries/cursorComparator.d.ts +8 -0
  165. package/dist/feature-libraries/cursorComparator.d.ts.map +1 -1
  166. package/dist/feature-libraries/cursorComparator.js +43 -10
  167. package/dist/feature-libraries/cursorComparator.js.map +1 -1
  168. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +6 -3
  169. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  170. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +2 -2
  171. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  172. package/dist/feature-libraries/default-schema/mappedEditBuilder.js +2 -0
  173. package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  174. package/dist/feature-libraries/deltaUtils.js +2 -3
  175. package/dist/feature-libraries/deltaUtils.js.map +1 -1
  176. package/dist/feature-libraries/detachedFieldIndexSummarizer.js +2 -0
  177. package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  178. package/dist/feature-libraries/editableTreeBinder.js +1 -2
  179. package/dist/feature-libraries/editableTreeBinder.js.map +1 -1
  180. package/dist/feature-libraries/flex-tree/context.js +19 -3
  181. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  182. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +2 -2
  183. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  184. package/dist/feature-libraries/flex-tree/lazyEntity.js +14 -14
  185. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  186. package/dist/feature-libraries/flex-tree/lazyField.js +28 -30
  187. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  188. package/dist/feature-libraries/flex-tree/lazyNode.js +24 -23
  189. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  190. package/dist/feature-libraries/flex-tree/observer.js +2 -2
  191. package/dist/feature-libraries/flex-tree/observer.js.map +1 -1
  192. package/dist/feature-libraries/flex-tree/utilities.js +5 -5
  193. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  194. package/dist/feature-libraries/forest-summary/forestSummarizer.js +122 -117
  195. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  196. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +49 -32
  197. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  198. package/dist/feature-libraries/forest-summary/summaryTypes.js +2 -3
  199. package/dist/feature-libraries/forest-summary/summaryTypes.js.map +1 -1
  200. package/dist/feature-libraries/indexing/anchorTreeIndex.js +35 -31
  201. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  202. package/dist/feature-libraries/mapTreeCursor.js +6 -7
  203. package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
  204. package/dist/feature-libraries/mitigatedChangeFamily.js +2 -3
  205. package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  206. package/dist/feature-libraries/modular-schema/comparison.js +6 -7
  207. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  208. package/dist/feature-libraries/modular-schema/crossFieldQueries.js +4 -4
  209. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  210. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js +14 -12
  211. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
  212. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +63 -10
  213. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  214. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js +3 -3
  215. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  216. package/dist/feature-libraries/modular-schema/fieldKind.js +10 -0
  217. package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  218. package/dist/feature-libraries/modular-schema/filterEdits.d.ts +13 -0
  219. package/dist/feature-libraries/modular-schema/filterEdits.d.ts.map +1 -0
  220. package/dist/feature-libraries/modular-schema/filterEdits.js +51 -0
  221. package/dist/feature-libraries/modular-schema/filterEdits.js.map +1 -0
  222. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  223. package/dist/feature-libraries/modular-schema/genericFieldKind.js +7 -4
  224. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  225. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js +1 -2
  226. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  227. package/dist/feature-libraries/modular-schema/genericFieldKindFormat.d.ts +2 -2
  228. package/dist/feature-libraries/modular-schema/genericFieldKindFormat.d.ts.map +1 -1
  229. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js +1 -2
  230. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
  231. package/dist/feature-libraries/modular-schema/index.d.ts +1 -1
  232. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  233. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  234. package/dist/feature-libraries/modular-schema/invert.d.ts +1 -1
  235. package/dist/feature-libraries/modular-schema/invert.d.ts.map +1 -1
  236. package/dist/feature-libraries/modular-schema/invert.js +5 -30
  237. package/dist/feature-libraries/modular-schema/invert.js.map +1 -1
  238. package/dist/feature-libraries/modular-schema/isNeverTree.js +4 -5
  239. package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  240. package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts +5 -7
  241. package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -1
  242. package/dist/feature-libraries/modular-schema/minimizeModularChange.js +459 -10
  243. package/dist/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -1
  244. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +14 -15
  245. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  246. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js +1 -2
  247. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
  248. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +2 -2
  249. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  250. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -10
  251. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  252. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +30 -97
  253. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  254. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +9 -9
  255. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
  256. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +4 -4
  257. package/dist/feature-libraries/modular-schema/modularChangeTypes.js +1 -2
  258. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  259. package/dist/feature-libraries/modular-schema/modularChangeUtils.d.ts +13 -1
  260. package/dist/feature-libraries/modular-schema/modularChangeUtils.d.ts.map +1 -1
  261. package/dist/feature-libraries/modular-schema/modularChangeUtils.js +115 -12
  262. package/dist/feature-libraries/modular-schema/modularChangeUtils.js.map +1 -1
  263. package/dist/feature-libraries/modular-schema/prune.d.ts +2 -3
  264. package/dist/feature-libraries/modular-schema/prune.d.ts.map +1 -1
  265. package/dist/feature-libraries/modular-schema/prune.js +25 -8
  266. package/dist/feature-libraries/modular-schema/prune.js.map +1 -1
  267. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js +1 -3
  268. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
  269. package/dist/feature-libraries/node-identifier/nodeIdentifier.js +2 -2
  270. package/dist/feature-libraries/node-identifier/nodeIdentifier.js.map +1 -1
  271. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js +3 -3
  272. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -1
  273. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  274. package/dist/feature-libraries/object-forest/objectForest.js +274 -267
  275. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  276. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  277. package/dist/feature-libraries/optional-field/optionalField.js +27 -35
  278. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  279. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +7 -7
  280. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  281. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +8 -8
  282. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  283. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js +1 -2
  284. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
  285. package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  286. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +1 -2
  287. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  288. package/dist/feature-libraries/schema-index/schemaSummarizer.js +3 -0
  289. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  290. package/dist/feature-libraries/schemaChecker.js +5 -5
  291. package/dist/feature-libraries/schemaChecker.js.map +1 -1
  292. package/dist/feature-libraries/sequence-field/compose.js +8 -2
  293. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  294. package/dist/feature-libraries/sequence-field/filterEdits.d.ts +3 -3
  295. package/dist/feature-libraries/sequence-field/filterEdits.d.ts.map +1 -1
  296. package/dist/feature-libraries/sequence-field/filterEdits.js +29 -11
  297. package/dist/feature-libraries/sequence-field/filterEdits.js.map +1 -1
  298. package/dist/feature-libraries/sequence-field/formatV1.d.ts +102 -102
  299. package/dist/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
  300. package/dist/feature-libraries/sequence-field/formatV2.d.ts +79 -79
  301. package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  302. package/dist/feature-libraries/sequence-field/formatV3.d.ts +56 -56
  303. package/dist/feature-libraries/sequence-field/formatV3.d.ts.map +1 -1
  304. package/dist/feature-libraries/sequence-field/invert.js +1 -2
  305. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  306. package/dist/feature-libraries/sequence-field/markListFactory.js +3 -4
  307. package/dist/feature-libraries/sequence-field/markListFactory.js.map +1 -1
  308. package/dist/feature-libraries/sequence-field/markQueue.js +4 -2
  309. package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
  310. package/dist/feature-libraries/sequence-field/moveEffectTable.js +9 -9
  311. package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  312. package/dist/feature-libraries/sequence-field/prune.js +1 -2
  313. package/dist/feature-libraries/sequence-field/prune.js.map +1 -1
  314. package/dist/feature-libraries/sequence-field/rebase.js +7 -2
  315. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  316. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js +1 -2
  317. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js.map +1 -1
  318. package/dist/feature-libraries/sequence-field/replaceRevisions.js +1 -2
  319. package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  320. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +2 -3
  321. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  322. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +1 -2
  323. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  324. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  325. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +9 -9
  326. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  327. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +1 -2
  328. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  329. package/dist/feature-libraries/sequence-field/utils.d.ts +2 -2
  330. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  331. package/dist/feature-libraries/sequence-field/utils.js +54 -67
  332. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  333. package/dist/feature-libraries/treeCursorUtils.js +19 -15
  334. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  335. package/dist/feature-libraries/treeTextCursor.js +8 -8
  336. package/dist/feature-libraries/treeTextCursor.js.map +1 -1
  337. package/dist/feature-libraries/valueUtilities.js +4 -5
  338. package/dist/feature-libraries/valueUtilities.js.map +1 -1
  339. package/dist/index.d.ts +4 -29
  340. package/dist/index.d.ts.map +1 -1
  341. package/dist/index.js +6 -9
  342. package/dist/index.js.map +1 -1
  343. package/dist/internalTypes.d.ts +1 -1
  344. package/dist/internalTypes.d.ts.map +1 -1
  345. package/dist/internalTypes.js.map +1 -1
  346. package/dist/packageVersion.d.ts +1 -1
  347. package/dist/packageVersion.d.ts.map +1 -1
  348. package/dist/packageVersion.js +1 -1
  349. package/dist/packageVersion.js.map +1 -1
  350. package/dist/serializableDomainSchema.d.ts +1 -1
  351. package/dist/shared-tree/history.d.ts.map +1 -1
  352. package/dist/shared-tree/history.js +32 -13
  353. package/dist/shared-tree/history.js.map +1 -1
  354. package/dist/shared-tree/independentView.d.ts +27 -3
  355. package/dist/shared-tree/independentView.d.ts.map +1 -1
  356. package/dist/shared-tree/independentView.js +36 -7
  357. package/dist/shared-tree/independentView.js.map +1 -1
  358. package/dist/shared-tree/index.d.ts +2 -1
  359. package/dist/shared-tree/index.d.ts.map +1 -1
  360. package/dist/shared-tree/index.js +6 -2
  361. package/dist/shared-tree/index.js.map +1 -1
  362. package/dist/shared-tree/isAuditableFromOutcome.js +1 -2
  363. package/dist/shared-tree/isAuditableFromOutcome.js.map +1 -1
  364. package/dist/shared-tree/schematizeTree.js +3 -4
  365. package/dist/shared-tree/schematizeTree.js.map +1 -1
  366. package/dist/shared-tree/schematizingTreeView.d.ts +2 -2
  367. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  368. package/dist/shared-tree/schematizingTreeView.js +59 -26
  369. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  370. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  371. package/dist/shared-tree/sharedTree.js +28 -19
  372. package/dist/shared-tree/sharedTree.js.map +1 -1
  373. package/dist/shared-tree/sharedTreeChangeCodecs.js +3 -3
  374. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  375. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  376. package/dist/shared-tree/sharedTreeChangeEnricher.js +12 -4
  377. package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  378. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  379. package/dist/shared-tree/sharedTreeChangeFamily.js +11 -8
  380. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  381. package/dist/shared-tree/sharedTreeChangeFormat.js +2 -3
  382. package/dist/shared-tree/sharedTreeChangeFormat.js.map +1 -1
  383. package/dist/shared-tree/sharedTreeEditBuilder.js +2 -0
  384. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  385. package/dist/shared-tree/transactionMinimize.d.ts.map +1 -1
  386. package/dist/shared-tree/transactionMinimize.js +2 -1
  387. package/dist/shared-tree/transactionMinimize.js.map +1 -1
  388. package/dist/shared-tree/transactionPostProcessor.js +2 -3
  389. package/dist/shared-tree/transactionPostProcessor.js.map +1 -1
  390. package/dist/shared-tree/tree.js +2 -2
  391. package/dist/shared-tree/tree.js.map +1 -1
  392. package/dist/shared-tree/treeAlpha.d.ts +5 -16
  393. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  394. package/dist/shared-tree/treeAlpha.js +18 -11
  395. package/dist/shared-tree/treeAlpha.js.map +1 -1
  396. package/{lib/simple-tree/api → dist/shared-tree}/treeBeta.d.ts +8 -65
  397. package/dist/shared-tree/treeBeta.d.ts.map +1 -0
  398. package/dist/shared-tree/treeBeta.js +70 -0
  399. package/dist/shared-tree/treeBeta.js.map +1 -0
  400. package/dist/shared-tree/treeCheckout.d.ts +5 -0
  401. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  402. package/dist/shared-tree/treeCheckout.js +986 -907
  403. package/dist/shared-tree/treeCheckout.js.map +1 -1
  404. package/dist/shared-tree/unhydratedTreeContext.js +3 -4
  405. package/dist/shared-tree/unhydratedTreeContext.js.map +1 -1
  406. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  407. package/dist/shared-tree-core/branch.js +24 -20
  408. package/dist/shared-tree-core/branch.js.map +1 -1
  409. package/dist/shared-tree-core/branchCommitCounter.js +35 -32
  410. package/dist/shared-tree-core/branchCommitCounter.js.map +1 -1
  411. package/dist/shared-tree-core/branchCommitEnricher.js +9 -8
  412. package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
  413. package/dist/shared-tree-core/branchIdCodec.js +2 -3
  414. package/dist/shared-tree-core/branchIdCodec.js.map +1 -1
  415. package/dist/shared-tree-core/customMetadataCodec.js +2 -3
  416. package/dist/shared-tree-core/customMetadataCodec.js.map +1 -1
  417. package/dist/shared-tree-core/customMetadataFormat.d.ts.map +1 -1
  418. package/dist/shared-tree-core/defaultResubmitMachine.js +11 -9
  419. package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  420. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  421. package/dist/shared-tree-core/editManager.js +73 -44
  422. package/dist/shared-tree-core/editManager.js.map +1 -1
  423. package/dist/shared-tree-core/editManagerCodecs.js +3 -3
  424. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  425. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +1 -1
  426. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  427. package/dist/shared-tree-core/editManagerCodecsCommons.js +33 -36
  428. package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  429. package/dist/shared-tree-core/editManagerCodecsV1toV4.js +1 -2
  430. package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  431. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js +1 -2
  432. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  433. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +11 -11
  434. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  435. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +5 -4
  436. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  437. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +10 -9
  438. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
  439. package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  440. package/dist/shared-tree-core/editManagerSummarizer.js +6 -1
  441. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  442. package/dist/shared-tree-core/messageCodecV1ToV4.js +1 -2
  443. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  444. package/dist/shared-tree-core/messageCodecVSharedBranches.js +1 -2
  445. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  446. package/dist/shared-tree-core/messageCodecs.js +3 -3
  447. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  448. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +3 -2
  449. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  450. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts +3 -2
  451. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  452. package/dist/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  453. package/dist/shared-tree-core/sharedTreeCore.js +44 -22
  454. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  455. package/dist/shared-tree-core/summaryTypes.js +2 -2
  456. package/dist/shared-tree-core/summaryTypes.js.map +1 -1
  457. package/dist/shared-tree-core/transaction.js +36 -39
  458. package/dist/shared-tree-core/transaction.js.map +1 -1
  459. package/dist/shared-tree-core/versionedSummarizer.js +4 -0
  460. package/dist/shared-tree-core/versionedSummarizer.js.map +1 -1
  461. package/dist/simple-tree/api/cloneTree.d.ts +11 -0
  462. package/dist/simple-tree/api/cloneTree.d.ts.map +1 -0
  463. package/dist/simple-tree/api/cloneTree.js +31 -0
  464. package/dist/simple-tree/api/cloneTree.js.map +1 -0
  465. package/dist/simple-tree/api/conciseTree.js +2 -3
  466. package/dist/simple-tree/api/conciseTree.js.map +1 -1
  467. package/dist/simple-tree/api/configuration.js +21 -2
  468. package/dist/simple-tree/api/configuration.js.map +1 -1
  469. package/dist/simple-tree/api/create.js +2 -3
  470. package/dist/simple-tree/api/create.js.map +1 -1
  471. package/dist/simple-tree/api/customTree.js +6 -6
  472. package/dist/simple-tree/api/customTree.js.map +1 -1
  473. package/dist/simple-tree/api/dirtyIndex.js +1 -2
  474. package/dist/simple-tree/api/dirtyIndex.js.map +1 -1
  475. package/dist/simple-tree/api/discrepancies.js +2 -3
  476. package/dist/simple-tree/api/discrepancies.js.map +1 -1
  477. package/dist/simple-tree/api/eraseSchemaDetails.js +2 -3
  478. package/dist/simple-tree/api/eraseSchemaDetails.js.map +1 -1
  479. package/dist/simple-tree/api/getJsonSchema.js +1 -2
  480. package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
  481. package/dist/simple-tree/api/getSimpleSchema.js +1 -2
  482. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
  483. package/dist/simple-tree/api/identifierIndex.js +1 -2
  484. package/dist/simple-tree/api/identifierIndex.js.map +1 -1
  485. package/dist/simple-tree/api/incrementalAllowedTypes.js +2 -2
  486. package/dist/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  487. package/dist/simple-tree/api/index.d.ts +3 -3
  488. package/dist/simple-tree/api/index.d.ts.map +1 -1
  489. package/dist/simple-tree/api/index.js +4 -7
  490. package/dist/simple-tree/api/index.js.map +1 -1
  491. package/dist/simple-tree/api/schemaCompatibilityTester.js +2 -3
  492. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  493. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +3 -7
  494. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  495. package/dist/simple-tree/api/schemaCreationUtilities.js +6 -9
  496. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  497. package/dist/simple-tree/api/schemaFactory.d.ts +4 -9
  498. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  499. package/dist/simple-tree/api/schemaFactory.js +13 -12
  500. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  501. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +20 -22
  502. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  503. package/dist/simple-tree/api/schemaFactoryAlpha.js +78 -81
  504. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  505. package/dist/simple-tree/api/schemaFactoryBeta.d.ts +7 -9
  506. package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  507. package/dist/simple-tree/api/schemaFactoryBeta.js +32 -35
  508. package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  509. package/dist/simple-tree/api/schemaFactoryRecursive.js +1 -2
  510. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  511. package/dist/simple-tree/api/schemaFromSimple.js +1 -2
  512. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  513. package/dist/simple-tree/api/schemaStatics.d.ts +7 -7
  514. package/dist/simple-tree/api/schemaStatics.d.ts.map +1 -1
  515. package/dist/simple-tree/api/simpleSchemaCodec.js +2 -3
  516. package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  517. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +2 -3
  518. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  519. package/dist/simple-tree/api/simpleTreeIndex.js +1 -2
  520. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  521. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +46 -2
  522. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  523. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +54 -12
  524. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  525. package/dist/simple-tree/api/storedSchema.js +2 -3
  526. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  527. package/dist/simple-tree/api/transactionTypes.d.ts +4 -4
  528. package/dist/simple-tree/api/transactionTypes.js.map +1 -1
  529. package/dist/simple-tree/api/tree.d.ts +80 -61
  530. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  531. package/dist/simple-tree/api/tree.js +3 -5
  532. package/dist/simple-tree/api/tree.js.map +1 -1
  533. package/dist/simple-tree/api/treeChangeEvents.d.ts +16 -4
  534. package/dist/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
  535. package/dist/simple-tree/api/treeChangeEvents.js.map +1 -1
  536. package/dist/simple-tree/api/treeChangeEventsBeta.d.ts +209 -0
  537. package/dist/simple-tree/api/treeChangeEventsBeta.d.ts.map +1 -0
  538. package/dist/simple-tree/api/{treeAlpha.js → treeChangeEventsBeta.js} +1 -1
  539. package/dist/simple-tree/api/treeChangeEventsBeta.js.map +1 -0
  540. package/dist/simple-tree/api/treeNodeApi.d.ts +1 -75
  541. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  542. package/dist/simple-tree/api/treeNodeApi.js +7 -7
  543. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  544. package/dist/simple-tree/api/typesUnsafe.d.ts +8 -6
  545. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  546. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  547. package/dist/simple-tree/api/verboseTree.js +5 -6
  548. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  549. package/dist/simple-tree/core/allowedTypes.js +22 -13
  550. package/dist/simple-tree/core/allowedTypes.js.map +1 -1
  551. package/dist/simple-tree/core/context.js +3 -0
  552. package/dist/simple-tree/core/context.js.map +1 -1
  553. package/dist/simple-tree/core/flexList.js +2 -3
  554. package/dist/simple-tree/core/flexList.js.map +1 -1
  555. package/dist/simple-tree/core/getOrCreateNode.js +2 -3
  556. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  557. package/dist/simple-tree/core/index.d.ts +1 -1
  558. package/dist/simple-tree/core/index.d.ts.map +1 -1
  559. package/dist/simple-tree/core/index.js +2 -2
  560. package/dist/simple-tree/core/index.js.map +1 -1
  561. package/dist/simple-tree/core/treeNode.d.ts +3 -4
  562. package/dist/simple-tree/core/treeNode.d.ts.map +1 -1
  563. package/dist/simple-tree/core/treeNode.js +31 -32
  564. package/dist/simple-tree/core/treeNode.js.map +1 -1
  565. package/dist/simple-tree/core/treeNodeKernel.js +194 -192
  566. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  567. package/dist/simple-tree/core/treeNodeSchema.js +3 -3
  568. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  569. package/dist/simple-tree/core/treeNodeValid.js +23 -23
  570. package/dist/simple-tree/core/treeNodeValid.js.map +1 -1
  571. package/dist/simple-tree/core/types.js +1 -2
  572. package/dist/simple-tree/core/types.js.map +1 -1
  573. package/dist/simple-tree/core/unhydratedFlexTree.js +177 -150
  574. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  575. package/dist/simple-tree/core/walkSchema.js +2 -3
  576. package/dist/simple-tree/core/walkSchema.js.map +1 -1
  577. package/dist/simple-tree/core/withType.d.ts +7 -9
  578. package/dist/simple-tree/core/withType.d.ts.map +1 -1
  579. package/dist/simple-tree/core/withType.js +6 -7
  580. package/dist/simple-tree/core/withType.js.map +1 -1
  581. package/dist/simple-tree/createContext.js +2 -3
  582. package/dist/simple-tree/createContext.js.map +1 -1
  583. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  584. package/dist/simple-tree/fieldSchema.js +33 -15
  585. package/dist/simple-tree/fieldSchema.js.map +1 -1
  586. package/dist/simple-tree/getTreeNodeForField.js +1 -2
  587. package/dist/simple-tree/getTreeNodeForField.js.map +1 -1
  588. package/dist/simple-tree/index.d.ts +2 -2
  589. package/dist/simple-tree/index.d.ts.map +1 -1
  590. package/dist/simple-tree/index.js +5 -8
  591. package/dist/simple-tree/index.js.map +1 -1
  592. package/dist/simple-tree/leafNodeSchema.d.ts +1 -1
  593. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  594. package/dist/simple-tree/leafNodeSchema.js +18 -17
  595. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  596. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +3 -2
  597. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  598. package/dist/simple-tree/node-kinds/array/arrayNode.js +31 -33
  599. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  600. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  601. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js +2 -2
  602. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  603. package/dist/simple-tree/node-kinds/common.js +1 -2
  604. package/dist/simple-tree/node-kinds/common.js.map +1 -1
  605. package/dist/simple-tree/node-kinds/map/mapNode.d.ts +6 -6
  606. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  607. package/dist/simple-tree/node-kinds/map/mapNode.js +10 -16
  608. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  609. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  610. package/dist/simple-tree/node-kinds/map/mapNodeTypes.js +2 -2
  611. package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  612. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  613. package/dist/simple-tree/node-kinds/object/objectNode.js +27 -28
  614. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  615. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +1 -1
  616. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  617. package/dist/simple-tree/node-kinds/object/objectNodeTypes.js +2 -2
  618. package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  619. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  620. package/dist/simple-tree/node-kinds/record/recordNode.js +10 -13
  621. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  622. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +3 -2
  623. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  624. package/dist/simple-tree/node-kinds/record/recordNodeTypes.js +2 -2
  625. package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  626. package/dist/simple-tree/prepareForInsertion.js +4 -5
  627. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  628. package/dist/simple-tree/toStoredSchema.js +11 -11
  629. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  630. package/dist/simple-tree/treeSchema.js +1 -2
  631. package/dist/simple-tree/treeSchema.js.map +1 -1
  632. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +3 -4
  633. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  634. package/dist/simple-tree/walkFieldSchema.js +1 -2
  635. package/dist/simple-tree/walkFieldSchema.js.map +1 -1
  636. package/dist/tableSchema.d.ts +2 -87
  637. package/dist/tableSchema.d.ts.map +1 -1
  638. package/dist/tableSchema.js +309 -275
  639. package/dist/tableSchema.js.map +1 -1
  640. package/dist/text/codePointUtils.d.ts +16 -3
  641. package/dist/text/codePointUtils.d.ts.map +1 -1
  642. package/dist/text/codePointUtils.js +24 -13
  643. package/dist/text/codePointUtils.js.map +1 -1
  644. package/dist/text/textDomain.d.ts +7 -1
  645. package/dist/text/textDomain.d.ts.map +1 -1
  646. package/dist/text/textDomain.js +32 -28
  647. package/dist/text/textDomain.js.map +1 -1
  648. package/dist/text/textDomainFormatted.d.ts.map +1 -1
  649. package/dist/text/textDomainFormatted.js +45 -34
  650. package/dist/text/textDomainFormatted.js.map +1 -1
  651. package/dist/text/textDomainFormattedDefault.js +2 -5
  652. package/dist/text/textDomainFormattedDefault.js.map +1 -1
  653. package/dist/treeDataStore.js +2 -3
  654. package/dist/treeDataStore.js.map +1 -1
  655. package/dist/treeFactory.js +7 -7
  656. package/dist/treeFactory.js.map +1 -1
  657. package/dist/util/arrayUtilities.js +5 -6
  658. package/dist/util/arrayUtilities.js.map +1 -1
  659. package/dist/util/bTreeUtils.js +3 -4
  660. package/dist/util/bTreeUtils.js.map +1 -1
  661. package/dist/util/brand.js +6 -5
  662. package/dist/util/brand.js.map +1 -1
  663. package/dist/util/brandedMap.js +2 -3
  664. package/dist/util/brandedMap.js.map +1 -1
  665. package/dist/util/breakable.d.ts.map +1 -1
  666. package/dist/util/breakable.js +7 -4
  667. package/dist/util/breakable.js.map +1 -1
  668. package/dist/util/cloneWithReplacements.js +1 -2
  669. package/dist/util/cloneWithReplacements.js.map +1 -1
  670. package/dist/util/compressedIds.js +29 -7
  671. package/dist/util/compressedIds.js.map +1 -1
  672. package/dist/util/idAllocator.js +3 -3
  673. package/dist/util/idAllocator.js.map +1 -1
  674. package/dist/util/nestedMap.js +15 -17
  675. package/dist/util/nestedMap.js.map +1 -1
  676. package/dist/util/nestedSet.js +2 -3
  677. package/dist/util/nestedSet.js.map +1 -1
  678. package/dist/util/offsetList.js +2 -4
  679. package/dist/util/offsetList.js.map +1 -1
  680. package/dist/util/opaque.js +2 -3
  681. package/dist/util/opaque.js.map +1 -1
  682. package/dist/util/rangeMap.js +6 -2
  683. package/dist/util/rangeMap.js.map +1 -1
  684. package/dist/util/readSnapshotBlob.d.ts.map +1 -1
  685. package/dist/util/referenceCounting.js +1 -0
  686. package/dist/util/referenceCounting.js.map +1 -1
  687. package/dist/util/stackyIterator.js +3 -2
  688. package/dist/util/stackyIterator.js.map +1 -1
  689. package/dist/util/typeUtils.js +1 -2
  690. package/dist/util/typeUtils.js.map +1 -1
  691. package/dist/util/typeboxBrand.js +2 -3
  692. package/dist/util/typeboxBrand.js.map +1 -1
  693. package/dist/util/utils.d.ts +2 -2
  694. package/dist/util/utils.d.ts.map +1 -1
  695. package/dist/util/utils.js +32 -32
  696. package/dist/util/utils.js.map +1 -1
  697. package/lib/api.d.ts +9 -1
  698. package/lib/api.d.ts.map +1 -1
  699. package/lib/api.js.map +1 -1
  700. package/lib/codec/codec.d.ts +2 -2
  701. package/lib/codec/codec.d.ts.map +1 -1
  702. package/lib/codec/codec.js +2 -0
  703. package/lib/codec/codec.js.map +1 -1
  704. package/lib/codec/discriminatedUnions.js +1 -0
  705. package/lib/codec/discriminatedUnions.js.map +1 -1
  706. package/lib/codec/versioned/codec.d.ts.map +1 -1
  707. package/lib/codec/versioned/codec.js +2 -0
  708. package/lib/codec/versioned/codec.js.map +1 -1
  709. package/lib/componentApi.d.ts.map +1 -1
  710. package/lib/componentApi.js +20 -17
  711. package/lib/componentApi.js.map +1 -1
  712. package/lib/core/change-family/editBuilder.js +1 -0
  713. package/lib/core/change-family/editBuilder.js.map +1 -1
  714. package/lib/core/index.d.ts +2 -2
  715. package/lib/core/index.d.ts.map +1 -1
  716. package/lib/core/index.js +2 -2
  717. package/lib/core/index.js.map +1 -1
  718. package/lib/core/rebase/index.d.ts +1 -1
  719. package/lib/core/rebase/index.d.ts.map +1 -1
  720. package/lib/core/rebase/index.js +1 -1
  721. package/lib/core/rebase/index.js.map +1 -1
  722. package/lib/core/rebase/revisionTagCodec.js +3 -1
  723. package/lib/core/rebase/revisionTagCodec.js.map +1 -1
  724. package/lib/core/rebase/types.d.ts +12 -1
  725. package/lib/core/rebase/types.d.ts.map +1 -1
  726. package/lib/core/rebase/types.js +3 -0
  727. package/lib/core/rebase/types.js.map +1 -1
  728. package/lib/core/schema-stored/schema.js +5 -0
  729. package/lib/core/schema-stored/schema.js.map +1 -1
  730. package/lib/core/schema-stored/storedSchemaRepository.js +4 -2
  731. package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
  732. package/lib/core/tree/anchorSet.js +61 -54
  733. package/lib/core/tree/anchorSet.js.map +1 -1
  734. package/lib/core/tree/deltaUtil.d.ts +34 -9
  735. package/lib/core/tree/deltaUtil.d.ts.map +1 -1
  736. package/lib/core/tree/deltaUtil.js +41 -10
  737. package/lib/core/tree/deltaUtil.js.map +1 -1
  738. package/lib/core/tree/detachedFieldIndex.js +23 -21
  739. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  740. package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts +10 -10
  741. package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
  742. package/lib/core/tree/detachedFieldIndexCodecV1.js +2 -0
  743. package/lib/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  744. package/lib/core/tree/detachedFieldIndexCodecV2.js +2 -0
  745. package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  746. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts +3 -3
  747. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  748. package/lib/core/tree/index.d.ts +1 -1
  749. package/lib/core/tree/index.d.ts.map +1 -1
  750. package/lib/core/tree/index.js +1 -1
  751. package/lib/core/tree/index.js.map +1 -1
  752. package/lib/core/tree/persistedTreeTextFormat.d.ts +4 -4
  753. package/lib/core/tree/persistedTreeTextFormat.d.ts.map +1 -1
  754. package/lib/core/tree/sparseTree.js +15 -11
  755. package/lib/core/tree/sparseTree.js.map +1 -1
  756. package/lib/entrypoints/alpha.d.ts +1 -1
  757. package/lib/entrypoints/alpha.d.ts.map +1 -1
  758. package/lib/entrypoints/alpha.js +1 -1
  759. package/lib/entrypoints/alpha.js.map +1 -1
  760. package/lib/entrypoints/beta.d.ts +1 -1
  761. package/lib/entrypoints/beta.d.ts.map +1 -1
  762. package/lib/entrypoints/beta.js +1 -1
  763. package/lib/entrypoints/beta.js.map +1 -1
  764. package/lib/entrypoints/legacy.d.ts +1 -1
  765. package/lib/entrypoints/legacy.d.ts.map +1 -1
  766. package/lib/entrypoints/legacy.js +1 -1
  767. package/lib/entrypoints/legacy.js.map +1 -1
  768. package/lib/entrypoints/public.d.ts +1 -1
  769. package/lib/entrypoints/public.d.ts.map +1 -1
  770. package/lib/entrypoints/public.js +1 -1
  771. package/lib/entrypoints/public.js.map +1 -1
  772. package/lib/extensibleUnionNode.d.ts.map +1 -1
  773. package/lib/extensibleUnionNode.js +2 -2
  774. package/lib/extensibleUnionNode.js.map +1 -1
  775. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  776. package/lib/feature-libraries/chunked-forest/basicChunk.js +14 -1
  777. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  778. package/lib/feature-libraries/chunked-forest/chunkTree.js +14 -6
  779. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  780. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  781. package/lib/feature-libraries/chunked-forest/chunkedForest.js +18 -12
  782. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  783. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +1 -3
  784. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  785. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +8 -0
  786. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  787. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js +4 -0
  788. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  789. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +1 -0
  790. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  791. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  792. package/lib/feature-libraries/chunked-forest/codec/codecs.js +2 -0
  793. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  794. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +28 -12
  795. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  796. package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts +2 -2
  797. package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -1
  798. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js +9 -0
  799. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
  800. package/lib/feature-libraries/chunked-forest/sequenceChunk.js +1 -0
  801. package/lib/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
  802. package/lib/feature-libraries/chunked-forest/uniformChunk.js +71 -13
  803. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  804. package/lib/feature-libraries/comparison-forest/comparisonForest.js +79 -79
  805. package/lib/feature-libraries/comparison-forest/comparisonForest.js.map +1 -1
  806. package/lib/feature-libraries/cursorComparator.d.ts +8 -0
  807. package/lib/feature-libraries/cursorComparator.d.ts.map +1 -1
  808. package/lib/feature-libraries/cursorComparator.js +43 -9
  809. package/lib/feature-libraries/cursorComparator.js.map +1 -1
  810. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +3 -0
  811. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  812. package/lib/feature-libraries/default-schema/mappedEditBuilder.js +2 -0
  813. package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  814. package/lib/feature-libraries/detachedFieldIndexSummarizer.js +2 -0
  815. package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  816. package/lib/feature-libraries/flex-tree/context.js +19 -3
  817. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  818. package/lib/feature-libraries/flex-tree/lazyEntity.js +12 -12
  819. package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  820. package/lib/feature-libraries/flex-tree/lazyField.js +25 -27
  821. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  822. package/lib/feature-libraries/flex-tree/lazyNode.js +22 -21
  823. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  824. package/lib/feature-libraries/forest-summary/forestSummarizer.js +122 -117
  825. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  826. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +49 -32
  827. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  828. package/lib/feature-libraries/indexing/anchorTreeIndex.js +33 -29
  829. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  830. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js +14 -12
  831. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
  832. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +63 -10
  833. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  834. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  835. package/lib/feature-libraries/modular-schema/fieldKind.js +10 -0
  836. package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  837. package/lib/feature-libraries/modular-schema/filterEdits.d.ts +13 -0
  838. package/lib/feature-libraries/modular-schema/filterEdits.d.ts.map +1 -0
  839. package/lib/feature-libraries/modular-schema/filterEdits.js +46 -0
  840. package/lib/feature-libraries/modular-schema/filterEdits.js.map +1 -0
  841. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  842. package/lib/feature-libraries/modular-schema/genericFieldKind.js +5 -2
  843. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  844. package/lib/feature-libraries/modular-schema/genericFieldKindFormat.d.ts +2 -2
  845. package/lib/feature-libraries/modular-schema/genericFieldKindFormat.d.ts.map +1 -1
  846. package/lib/feature-libraries/modular-schema/index.d.ts +1 -1
  847. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  848. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  849. package/lib/feature-libraries/modular-schema/invert.d.ts +1 -1
  850. package/lib/feature-libraries/modular-schema/invert.d.ts.map +1 -1
  851. package/lib/feature-libraries/modular-schema/invert.js +6 -30
  852. package/lib/feature-libraries/modular-schema/invert.js.map +1 -1
  853. package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts +5 -7
  854. package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -1
  855. package/lib/feature-libraries/modular-schema/minimizeModularChange.js +458 -8
  856. package/lib/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -1
  857. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -10
  858. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  859. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +20 -85
  860. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  861. package/lib/feature-libraries/modular-schema/modularChangeUtils.d.ts +13 -1
  862. package/lib/feature-libraries/modular-schema/modularChangeUtils.d.ts.map +1 -1
  863. package/lib/feature-libraries/modular-schema/modularChangeUtils.js +100 -3
  864. package/lib/feature-libraries/modular-schema/modularChangeUtils.js.map +1 -1
  865. package/lib/feature-libraries/modular-schema/prune.d.ts +2 -3
  866. package/lib/feature-libraries/modular-schema/prune.d.ts.map +1 -1
  867. package/lib/feature-libraries/modular-schema/prune.js +25 -7
  868. package/lib/feature-libraries/modular-schema/prune.js.map +1 -1
  869. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js +1 -3
  870. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
  871. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js +1 -0
  872. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -1
  873. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  874. package/lib/feature-libraries/object-forest/objectForest.js +273 -266
  875. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  876. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  877. package/lib/feature-libraries/optional-field/optionalField.js +24 -32
  878. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  879. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +1 -1
  880. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  881. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +1 -1
  882. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  883. package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  884. package/lib/feature-libraries/schema-index/schemaSummarizer.js +3 -0
  885. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  886. package/lib/feature-libraries/sequence-field/compose.js +6 -0
  887. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  888. package/lib/feature-libraries/sequence-field/filterEdits.d.ts +3 -3
  889. package/lib/feature-libraries/sequence-field/filterEdits.d.ts.map +1 -1
  890. package/lib/feature-libraries/sequence-field/filterEdits.js +31 -12
  891. package/lib/feature-libraries/sequence-field/filterEdits.js.map +1 -1
  892. package/lib/feature-libraries/sequence-field/formatV1.d.ts +3 -3
  893. package/lib/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
  894. package/lib/feature-libraries/sequence-field/formatV2.d.ts +3 -3
  895. package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  896. package/lib/feature-libraries/sequence-field/formatV3.d.ts +2 -2
  897. package/lib/feature-libraries/sequence-field/formatV3.d.ts.map +1 -1
  898. package/lib/feature-libraries/sequence-field/markListFactory.js +3 -4
  899. package/lib/feature-libraries/sequence-field/markListFactory.js.map +1 -1
  900. package/lib/feature-libraries/sequence-field/markQueue.js +4 -2
  901. package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
  902. package/lib/feature-libraries/sequence-field/rebase.js +6 -0
  903. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  904. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  905. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +9 -9
  906. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  907. package/lib/feature-libraries/sequence-field/utils.d.ts +2 -2
  908. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  909. package/lib/feature-libraries/sequence-field/utils.js +3 -15
  910. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  911. package/lib/feature-libraries/treeCursorUtils.js +13 -9
  912. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  913. package/lib/index.d.ts +4 -29
  914. package/lib/index.d.ts.map +1 -1
  915. package/lib/index.js +2 -17
  916. package/lib/index.js.map +1 -1
  917. package/lib/internalTypes.d.ts +1 -1
  918. package/lib/internalTypes.d.ts.map +1 -1
  919. package/lib/internalTypes.js.map +1 -1
  920. package/lib/packageVersion.d.ts +1 -1
  921. package/lib/packageVersion.d.ts.map +1 -1
  922. package/lib/packageVersion.js +1 -1
  923. package/lib/packageVersion.js.map +1 -1
  924. package/lib/serializableDomainSchema.d.ts +1 -1
  925. package/lib/shared-tree/history.d.ts.map +1 -1
  926. package/lib/shared-tree/history.js +32 -13
  927. package/lib/shared-tree/history.js.map +1 -1
  928. package/lib/shared-tree/independentView.d.ts +27 -3
  929. package/lib/shared-tree/independentView.d.ts.map +1 -1
  930. package/lib/shared-tree/independentView.js +30 -2
  931. package/lib/shared-tree/independentView.js.map +1 -1
  932. package/lib/shared-tree/index.d.ts +2 -1
  933. package/lib/shared-tree/index.d.ts.map +1 -1
  934. package/lib/shared-tree/index.js +2 -1
  935. package/lib/shared-tree/index.js.map +1 -1
  936. package/lib/shared-tree/schematizingTreeView.d.ts +2 -2
  937. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  938. package/lib/shared-tree/schematizingTreeView.js +60 -27
  939. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  940. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  941. package/lib/shared-tree/sharedTree.js +24 -15
  942. package/lib/shared-tree/sharedTree.js.map +1 -1
  943. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  944. package/lib/shared-tree/sharedTreeChangeEnricher.js +12 -4
  945. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  946. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  947. package/lib/shared-tree/sharedTreeChangeFamily.js +6 -3
  948. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  949. package/lib/shared-tree/sharedTreeEditBuilder.js +2 -0
  950. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  951. package/lib/shared-tree/transactionMinimize.d.ts.map +1 -1
  952. package/lib/shared-tree/transactionMinimize.js +4 -3
  953. package/lib/shared-tree/transactionMinimize.js.map +1 -1
  954. package/lib/shared-tree/treeAlpha.d.ts +5 -16
  955. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  956. package/lib/shared-tree/treeAlpha.js +13 -6
  957. package/lib/shared-tree/treeAlpha.js.map +1 -1
  958. package/{dist/simple-tree/api → lib/shared-tree}/treeBeta.d.ts +8 -65
  959. package/lib/shared-tree/treeBeta.d.ts.map +1 -0
  960. package/lib/shared-tree/treeBeta.js +64 -0
  961. package/lib/shared-tree/treeBeta.js.map +1 -0
  962. package/lib/shared-tree/treeCheckout.d.ts +5 -0
  963. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  964. package/lib/shared-tree/treeCheckout.js +985 -906
  965. package/lib/shared-tree/treeCheckout.js.map +1 -1
  966. package/lib/shared-tree/unhydratedTreeContext.js +3 -4
  967. package/lib/shared-tree/unhydratedTreeContext.js.map +1 -1
  968. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  969. package/lib/shared-tree-core/branch.js +22 -18
  970. package/lib/shared-tree-core/branch.js.map +1 -1
  971. package/lib/shared-tree-core/branchCommitCounter.js +35 -32
  972. package/lib/shared-tree-core/branchCommitCounter.js.map +1 -1
  973. package/lib/shared-tree-core/branchCommitEnricher.js +9 -8
  974. package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
  975. package/lib/shared-tree-core/customMetadataFormat.d.ts.map +1 -1
  976. package/lib/shared-tree-core/defaultResubmitMachine.js +11 -9
  977. package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  978. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  979. package/lib/shared-tree-core/editManager.js +73 -44
  980. package/lib/shared-tree-core/editManager.js.map +1 -1
  981. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +1 -1
  982. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  983. package/lib/shared-tree-core/editManagerCodecsCommons.js +32 -34
  984. package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  985. package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  986. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  987. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +4 -4
  988. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  989. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -1
  990. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  991. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +2 -1
  992. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
  993. package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  994. package/lib/shared-tree-core/editManagerSummarizer.js +6 -1
  995. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  996. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +2 -1
  997. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  998. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts +2 -1
  999. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  1000. package/lib/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  1001. package/lib/shared-tree-core/sharedTreeCore.js +45 -23
  1002. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  1003. package/lib/shared-tree-core/transaction.js +36 -39
  1004. package/lib/shared-tree-core/transaction.js.map +1 -1
  1005. package/lib/shared-tree-core/versionedSummarizer.js +4 -0
  1006. package/lib/shared-tree-core/versionedSummarizer.js.map +1 -1
  1007. package/lib/simple-tree/api/cloneTree.d.ts +11 -0
  1008. package/lib/simple-tree/api/cloneTree.d.ts.map +1 -0
  1009. package/lib/simple-tree/api/cloneTree.js +28 -0
  1010. package/lib/simple-tree/api/cloneTree.js.map +1 -0
  1011. package/lib/simple-tree/api/configuration.js +19 -0
  1012. package/lib/simple-tree/api/configuration.js.map +1 -1
  1013. package/lib/simple-tree/api/index.d.ts +3 -3
  1014. package/lib/simple-tree/api/index.d.ts.map +1 -1
  1015. package/lib/simple-tree/api/index.js +1 -1
  1016. package/lib/simple-tree/api/index.js.map +1 -1
  1017. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +3 -7
  1018. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  1019. package/lib/simple-tree/api/schemaCreationUtilities.js +1 -3
  1020. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  1021. package/lib/simple-tree/api/schemaFactory.d.ts +4 -9
  1022. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  1023. package/lib/simple-tree/api/schemaFactory.js +9 -8
  1024. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  1025. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +18 -20
  1026. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  1027. package/lib/simple-tree/api/schemaFactoryAlpha.js +78 -81
  1028. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  1029. package/lib/simple-tree/api/schemaFactoryBeta.d.ts +7 -9
  1030. package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  1031. package/lib/simple-tree/api/schemaFactoryBeta.js +32 -35
  1032. package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  1033. package/lib/simple-tree/api/schemaStatics.d.ts +7 -7
  1034. package/lib/simple-tree/api/schemaStatics.d.ts.map +1 -1
  1035. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +46 -2
  1036. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  1037. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +48 -6
  1038. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  1039. package/lib/simple-tree/api/transactionTypes.d.ts +4 -4
  1040. package/lib/simple-tree/api/transactionTypes.js.map +1 -1
  1041. package/lib/simple-tree/api/tree.d.ts +80 -61
  1042. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  1043. package/lib/simple-tree/api/tree.js +2 -3
  1044. package/lib/simple-tree/api/tree.js.map +1 -1
  1045. package/lib/simple-tree/api/treeChangeEvents.d.ts +16 -4
  1046. package/lib/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
  1047. package/lib/simple-tree/api/treeChangeEvents.js.map +1 -1
  1048. package/lib/simple-tree/api/treeChangeEventsBeta.d.ts +209 -0
  1049. package/lib/simple-tree/api/treeChangeEventsBeta.d.ts.map +1 -0
  1050. package/lib/simple-tree/api/{treeAlpha.js → treeChangeEventsBeta.js} +1 -1
  1051. package/lib/simple-tree/api/treeChangeEventsBeta.js.map +1 -0
  1052. package/lib/simple-tree/api/treeNodeApi.d.ts +1 -75
  1053. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  1054. package/lib/simple-tree/api/treeNodeApi.js +1 -1
  1055. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  1056. package/lib/simple-tree/api/typesUnsafe.d.ts +8 -6
  1057. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  1058. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  1059. package/lib/simple-tree/core/allowedTypes.js +12 -3
  1060. package/lib/simple-tree/core/allowedTypes.js.map +1 -1
  1061. package/lib/simple-tree/core/context.js +3 -0
  1062. package/lib/simple-tree/core/context.js.map +1 -1
  1063. package/lib/simple-tree/core/index.d.ts +1 -1
  1064. package/lib/simple-tree/core/index.d.ts.map +1 -1
  1065. package/lib/simple-tree/core/index.js +1 -1
  1066. package/lib/simple-tree/core/index.js.map +1 -1
  1067. package/lib/simple-tree/core/treeNode.d.ts +3 -4
  1068. package/lib/simple-tree/core/treeNode.d.ts.map +1 -1
  1069. package/lib/simple-tree/core/treeNode.js +29 -30
  1070. package/lib/simple-tree/core/treeNode.js.map +1 -1
  1071. package/lib/simple-tree/core/treeNodeKernel.js +181 -179
  1072. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  1073. package/lib/simple-tree/core/treeNodeValid.js +19 -19
  1074. package/lib/simple-tree/core/treeNodeValid.js.map +1 -1
  1075. package/lib/simple-tree/core/unhydratedFlexTree.js +173 -146
  1076. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  1077. package/lib/simple-tree/core/withType.d.ts +7 -9
  1078. package/lib/simple-tree/core/withType.d.ts.map +1 -1
  1079. package/lib/simple-tree/core/withType.js +5 -6
  1080. package/lib/simple-tree/core/withType.js.map +1 -1
  1081. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  1082. package/lib/simple-tree/fieldSchema.js +23 -5
  1083. package/lib/simple-tree/fieldSchema.js.map +1 -1
  1084. package/lib/simple-tree/index.d.ts +2 -2
  1085. package/lib/simple-tree/index.d.ts.map +1 -1
  1086. package/lib/simple-tree/index.js +2 -2
  1087. package/lib/simple-tree/index.js.map +1 -1
  1088. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  1089. package/lib/simple-tree/leafNodeSchema.js +16 -15
  1090. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  1091. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +3 -2
  1092. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  1093. package/lib/simple-tree/node-kinds/array/arrayNode.js +28 -32
  1094. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  1095. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  1096. package/lib/simple-tree/node-kinds/map/mapNode.d.ts +6 -6
  1097. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  1098. package/lib/simple-tree/node-kinds/map/mapNode.js +10 -17
  1099. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  1100. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  1101. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  1102. package/lib/simple-tree/node-kinds/object/objectNode.js +25 -28
  1103. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  1104. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +1 -1
  1105. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  1106. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  1107. package/lib/simple-tree/node-kinds/record/recordNode.js +10 -14
  1108. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  1109. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +3 -2
  1110. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  1111. package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  1112. package/lib/tableSchema.d.ts +2 -87
  1113. package/lib/tableSchema.d.ts.map +1 -1
  1114. package/lib/tableSchema.js +309 -275
  1115. package/lib/tableSchema.js.map +1 -1
  1116. package/lib/text/codePointUtils.d.ts +16 -3
  1117. package/lib/text/codePointUtils.d.ts.map +1 -1
  1118. package/lib/text/codePointUtils.js +22 -10
  1119. package/lib/text/codePointUtils.js.map +1 -1
  1120. package/lib/text/textDomain.d.ts +7 -1
  1121. package/lib/text/textDomain.d.ts.map +1 -1
  1122. package/lib/text/textDomain.js +21 -17
  1123. package/lib/text/textDomain.js.map +1 -1
  1124. package/lib/text/textDomainFormatted.d.ts.map +1 -1
  1125. package/lib/text/textDomainFormatted.js +43 -32
  1126. package/lib/text/textDomainFormatted.js.map +1 -1
  1127. package/lib/text/textDomainFormattedDefault.js +2 -5
  1128. package/lib/text/textDomainFormattedDefault.js.map +1 -1
  1129. package/lib/util/brand.js +1 -0
  1130. package/lib/util/brand.js.map +1 -1
  1131. package/lib/util/breakable.d.ts.map +1 -1
  1132. package/lib/util/breakable.js +3 -0
  1133. package/lib/util/breakable.js.map +1 -1
  1134. package/lib/util/compressedIds.js +22 -0
  1135. package/lib/util/compressedIds.js.map +1 -1
  1136. package/lib/util/nestedMap.js +2 -4
  1137. package/lib/util/nestedMap.js.map +1 -1
  1138. package/lib/util/offsetList.js +2 -4
  1139. package/lib/util/offsetList.js.map +1 -1
  1140. package/lib/util/rangeMap.js +4 -0
  1141. package/lib/util/rangeMap.js.map +1 -1
  1142. package/lib/util/readSnapshotBlob.d.ts.map +1 -1
  1143. package/lib/util/referenceCounting.js +1 -0
  1144. package/lib/util/referenceCounting.js.map +1 -1
  1145. package/lib/util/stackyIterator.js +3 -2
  1146. package/lib/util/stackyIterator.js.map +1 -1
  1147. package/lib/util/utils.d.ts +2 -2
  1148. package/lib/util/utils.d.ts.map +1 -1
  1149. package/package.json +67 -95
  1150. package/src/api.ts +11 -0
  1151. package/src/core/index.ts +6 -2
  1152. package/src/core/rebase/index.ts +1 -0
  1153. package/src/core/rebase/types.ts +16 -1
  1154. package/src/core/tree/anchorSet.ts +2 -2
  1155. package/src/core/tree/deltaUtil.ts +67 -13
  1156. package/src/core/tree/index.ts +5 -2
  1157. package/src/entrypoints/alpha.ts +19 -21
  1158. package/src/entrypoints/beta.ts +12 -5
  1159. package/src/entrypoints/legacy.ts +12 -5
  1160. package/src/entrypoints/public.ts +1 -5
  1161. package/src/extensibleUnionNode.ts +1 -2
  1162. package/src/feature-libraries/cursorComparator.ts +57 -9
  1163. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +77 -12
  1164. package/src/feature-libraries/modular-schema/filterEdits.ts +108 -0
  1165. package/src/feature-libraries/modular-schema/genericFieldKind.ts +7 -4
  1166. package/src/feature-libraries/modular-schema/index.ts +5 -2
  1167. package/src/feature-libraries/modular-schema/invert.ts +16 -61
  1168. package/src/feature-libraries/modular-schema/minimizeModularChange.ts +831 -10
  1169. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +10 -124
  1170. package/src/feature-libraries/modular-schema/modularChangeUtils.ts +164 -2
  1171. package/src/feature-libraries/modular-schema/prune.ts +52 -10
  1172. package/src/feature-libraries/optional-field/optionalField.ts +30 -42
  1173. package/src/feature-libraries/sequence-field/filterEdits.ts +62 -26
  1174. package/src/feature-libraries/sequence-field/utils.ts +7 -19
  1175. package/src/index.ts +7 -39
  1176. package/src/internalTypes.ts +1 -1
  1177. package/src/packageVersion.ts +1 -1
  1178. package/src/shared-tree/history.ts +41 -19
  1179. package/src/shared-tree/independentView.ts +40 -3
  1180. package/src/shared-tree/index.ts +5 -1
  1181. package/src/shared-tree/schematizingTreeView.ts +2 -2
  1182. package/src/shared-tree/sharedTree.ts +2 -1
  1183. package/src/shared-tree/transactionMinimize.ts +13 -4
  1184. package/src/shared-tree/treeAlpha.ts +17 -31
  1185. package/src/{simple-tree/api → shared-tree}/treeBeta.ts +56 -167
  1186. package/src/shared-tree/treeCheckout.ts +82 -9
  1187. package/src/shared-tree-core/editManager.ts +16 -8
  1188. package/src/shared-tree-core/editManagerCodecsCommons.ts +30 -34
  1189. package/src/shared-tree-core/editManagerCodecsV1toV4.ts +1 -1
  1190. package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +2 -2
  1191. package/src/simple-tree/api/cloneTree.ts +47 -0
  1192. package/src/simple-tree/api/index.ts +15 -21
  1193. package/src/simple-tree/api/schemaFactoryAlpha.ts +2 -2
  1194. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +87 -6
  1195. package/src/simple-tree/api/transactionTypes.ts +4 -4
  1196. package/src/simple-tree/api/tree.ts +139 -85
  1197. package/src/simple-tree/api/treeChangeEvents.ts +16 -4
  1198. package/src/simple-tree/api/treeChangeEventsBeta.ts +245 -0
  1199. package/src/simple-tree/api/treeNodeApi.ts +6 -85
  1200. package/src/simple-tree/api/typesUnsafe.ts +8 -6
  1201. package/src/simple-tree/core/index.ts +1 -1
  1202. package/src/simple-tree/core/treeNode.ts +3 -10
  1203. package/src/simple-tree/core/withType.ts +8 -11
  1204. package/src/simple-tree/index.ts +3 -7
  1205. package/src/simple-tree/node-kinds/array/arrayNode.ts +14 -12
  1206. package/src/simple-tree/node-kinds/map/mapNode.ts +14 -15
  1207. package/src/simple-tree/node-kinds/object/objectNode.ts +3 -6
  1208. package/src/simple-tree/node-kinds/record/recordNode.ts +6 -8
  1209. package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +2 -1
  1210. package/src/tableSchema.ts +8 -187
  1211. package/src/text/codePointUtils.ts +25 -14
  1212. package/src/text/textDomain.ts +15 -2
  1213. package/src/text/textDomainFormatted.ts +9 -4
  1214. package/tsconfig.json +1 -1
  1215. package/alpha.d.ts +0 -11
  1216. package/beta.d.ts +0 -11
  1217. package/dist/simple-tree/api/treeAlpha.d.ts +0 -126
  1218. package/dist/simple-tree/api/treeAlpha.d.ts.map +0 -1
  1219. package/dist/simple-tree/api/treeAlpha.js.map +0 -1
  1220. package/dist/simple-tree/api/treeBeta.d.ts.map +0 -1
  1221. package/dist/simple-tree/api/treeBeta.js +0 -83
  1222. package/dist/simple-tree/api/treeBeta.js.map +0 -1
  1223. package/docs/main/glossary.md +0 -163
  1224. package/internal.d.ts +0 -11
  1225. package/legacy.d.ts +0 -11
  1226. package/lib/simple-tree/api/treeAlpha.d.ts +0 -126
  1227. package/lib/simple-tree/api/treeAlpha.d.ts.map +0 -1
  1228. package/lib/simple-tree/api/treeAlpha.js.map +0 -1
  1229. package/lib/simple-tree/api/treeBeta.d.ts.map +0 -1
  1230. package/lib/simple-tree/api/treeBeta.js +0 -77
  1231. package/lib/simple-tree/api/treeBeta.js.map +0 -1
  1232. package/src/simple-tree/api/treeAlpha.ts +0 -153
  1233. /package/api-extractor/{api-extractor.current.json → api-extractor-report.current.json} +0 -0
  1234. /package/api-extractor/{api-extractor.legacy.json → api-extractor-report.legacy.json} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"fieldChangeHandler.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/fieldChangeHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkMH;;GAEG;AACH,MAAM,CAAN,IAAY,gBAiBX;AAjBD,WAAY,gBAAgB;IAC3B;;OAEG;IACH,2DAAM,CAAA;IAEN;;OAEG;IACH,+DAAQ,CAAA;IAER;;;;OAIG;IACH,qFAAmB,CAAA;AACpB,CAAC,EAjBW,gBAAgB,KAAhB,gBAAgB,QAiB3B;AAED;;;GAGG;AACH,MAAM,UAAU,+BAA+B,CAAa,IAK3D;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;QACzE,WAAW,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC;KACnE,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAa,IAKtD;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;AAqBD,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IAC1B,6DAAQ,CAAA;IACR,6DAAQ,CAAA;AACT,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ICodecFamily, JsonCodecPart } from \"../../codec/index.js\";\nimport type {\n\tChangeAtomId,\n\tChangeEncodingContext,\n\tDeltaDetachedNodeChanges,\n\tDeltaDetachedNodeId,\n\tDeltaDetachedNodeRename,\n\tDeltaFieldChanges,\n\tDeltaFieldMap,\n\tRevisionMetadataSource,\n\tRevisionReplacer,\n\tRevisionTag,\n\tRevisionTagSchema,\n} from \"../../core/index.js\";\nimport type { IdAllocator, Invariant, RangeQueryResult } from \"../../util/index.js\";\n\nimport type { CrossFieldManager } from \"./crossFieldQueries.js\";\nimport type { EncodedNodeChangeset } from \"./modularChangeFormatV1.js\";\nimport type { CrossFieldKeyRange, NodeId } from \"./modularChangeTypes.js\";\n\nexport type NestedChangesIndices = [\n\tNodeId,\n\tnumber | undefined /* inputIndex */,\n\tnumber | undefined /* outputIndex */,\n][];\n\n/**\n * The return value of calling {@link FieldChangeHandler.intoDelta}.\n */\nexport interface FieldChangeDelta {\n\t/**\n\t * {@inheritdoc DeltaFieldChanges}\n\t */\n\treadonly local?: DeltaFieldChanges;\n\t/**\n\t * {@inheritdoc DeltaRoot.global}\n\t */\n\treadonly global?: readonly DeltaDetachedNodeChanges[];\n\t/**\n\t * {@inheritdoc DeltaRoot.rename}\n\t */\n\treadonly rename?: readonly DeltaDetachedNodeRename[];\n}\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: JsonCodecPart<\n\t\t\tRevisionTag,\n\t\t\ttypeof RevisionTagSchema,\n\t\t\tChangeEncodingContext\n\t\t>,\n\t) => ICodecFamily<TChangeset, FieldChangeEncodingContext, FieldChangeDecodingContext>;\n\treadonly editor: TEditor;\n\tintoDelta(change: TChangeset, deltaFromChild: ToDelta): FieldChangeDelta;\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 following:\n\t * - index of the node in the field in the input context of the changeset (or `undefined` if the node is not\n\t * attached in the input context).\n\t * - index of the node in the field in the output context of the changeset (or `undefined` if the node is not\n\t * attached in the output 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): NestedChangesIndices;\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\trevision: RevisionTag | undefined,\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(change: TChangeset, replacer: RevisionReplacer): TChangeset;\n\n\t/**\n\t * Returns a copy of the given changeset with edits removed as specified.\n\t * @param change - The change to filter edits from\n\t * @param filterDetach - This should be called for each range of detaches in the changeset,\n\t * and the detach should be preserved, removed, or converted to a non-move detach as specified.\n\t * If the returned result does not cover the entire detach range, the remainder should be queried again.\n\t * @param filterDetach - This should be called for each range of attaches in the changeset,\n\t * and the attach should be preserved, removed, or converted to a non-move attach as specified.\n\t * If the returned result does not cover the entire detach range, the remainder should be queried again.\n\t * @param preserveOtherEdits - Whether edits other than attaches and detaches (e.g. root renames),\n\t * should be preserved or removed.\n\t */\n\tfilterEdits(\n\t\tchange: TChangeset,\n\t\toptions: {\n\t\t\tfilterDetach: EditFilterFunc;\n\t\t\tfilterAttach: EditFilterFunc;\n\t\t\tpreserveOtherEdits: boolean;\n\t\t},\n\t): TChangeset;\n}\n\nexport type EditFilterFunc = (\n\tid: ChangeAtomId,\n\tcount: number,\n\tendpoint?: ChangeAtomId,\n) => RangeQueryResult<EditFilterStatus>;\n\n/**\n * Used to describe what should be done with a particular attach or detach during `filterEdits`.\n */\nexport enum EditFilterStatus {\n\t/**\n\t * The edit should be removed from the filtered changeset.\n\t */\n\tRemove,\n\n\t/**\n\t * The edit should be preserved in the filtered changeset.\n\t */\n\tPreserve,\n\n\t/**\n\t * This should only be used for an attach or detach which is part of a move.\n\t * The edit should be preserved, but should be adjusted, if necessary,\n\t * to reflect that the other endpoint of the move has been filtered out.\n\t */\n\tPreserveWithoutMove,\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\tfilterEdits: FieldChangeRebaser<TChangeset>[\"filterEdits\"];\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\tfilterEdits: (change, options) => data.filterEdits(change, options),\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\tfilterEdits: FieldChangeRebaser<TChangeset>[\"filterEdits\"];\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 changes to the children of this editor's field.\n\t * For each element in the given iterable\n\t * - The number represents the index of the child node in the field.\n\t * - The `NodeId` represents the nested changes for that child node.\n\t * Note: The indices in the iterable must be ordered from smallest to largest (with no duplicates).\n\t */\n\tbuildChildChanges(changes: Iterable<[index: 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 */\nexport type ToDelta = (child: NodeId) => DeltaFieldMap;\n\nexport type NodeChangeInverter = (change: NodeId) => NodeId;\n\nexport enum NodeAttachState {\n\tAttached,\n\tDetached,\n}\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\nexport type NodeChangeComposer = (\n\tchange1: NodeId | undefined,\n\tchange2: NodeId | undefined,\n) => NodeId;\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 */\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}\n\n/**\n * Context provided to field change codecs when decoding.\n * @remarks\n * The decode-side counterpart of {@link FieldChangeEncodingContext}.\n */\nexport interface FieldChangeDecodingContext {\n\treadonly baseContext: ChangeEncodingContext;\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;AAmQH;;GAEG;AACH,MAAM,CAAN,IAAY,gBAiBX;AAjBD,WAAY,gBAAgB;IAC3B;;OAEG;IACH,2DAAM,CAAA;IAEN;;OAEG;IACH,+DAAQ,CAAA;IAER;;;;OAIG;IACH,qFAAmB,CAAA;AACpB,CAAC,EAjBW,gBAAgB,KAAhB,gBAAgB,QAiB3B;AAED;;;GAGG;AACH,MAAM,UAAU,+BAA+B,CAAa,IAK3D;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;QACzE,WAAW,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC;KACnE,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAa,IAKtD;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;AAqBD,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IAC1B,6DAAQ,CAAA;IACR,6DAAQ,CAAA;AACT,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ICodecFamily, JsonCodecPart } from \"../../codec/index.js\";\nimport type {\n\tChangeAtomId,\n\tChangeEncodingContext,\n\tDeltaDetachedNodeChanges,\n\tDeltaDetachedNodeId,\n\tDeltaDetachedNodeRename,\n\tDeltaFieldChanges,\n\tDeltaFieldMap,\n\tRevisionMetadataSource,\n\tRevisionReplacer,\n\tRevisionTag,\n\tRevisionTagSchema,\n} from \"../../core/index.js\";\nimport type { IdAllocator, Invariant, RangeQueryResult } from \"../../util/index.js\";\n\nimport type { CrossFieldManager } from \"./crossFieldQueries.js\";\nimport type { EncodedNodeChangeset } from \"./modularChangeFormatV1.js\";\nimport type { CrossFieldKeyRange, NodeId } from \"./modularChangeTypes.js\";\n\nexport interface ChildChangeInfo {\n\tnodeId: NodeId;\n\n\t/**\n\t * The root ID for this node in the input context of the changeset.\n\t * Undefined if the node was attached in the input context.\n\t */\n\tinputRootId: ChangeAtomId | undefined;\n\n\t/**\n\t * The ID this changeset detaches this node with.\n\t */\n\tdetachId: ChangeAtomId | undefined;\n}\n\n/**\n * The return value of calling {@link FieldChangeHandler.intoDelta}.\n */\nexport interface FieldChangeDelta {\n\t/**\n\t * {@inheritdoc DeltaFieldChanges}\n\t */\n\treadonly local?: DeltaFieldChanges;\n\t/**\n\t * {@inheritdoc DeltaRoot.global}\n\t */\n\treadonly global?: readonly DeltaDetachedNodeChanges[];\n\t/**\n\t * {@inheritdoc DeltaRoot.rename}\n\t */\n\treadonly rename?: readonly DeltaDetachedNodeRename[];\n}\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: JsonCodecPart<\n\t\t\tRevisionTag,\n\t\t\ttypeof RevisionTagSchema,\n\t\t\tChangeEncodingContext\n\t\t>,\n\t) => ICodecFamily<TChangeset, FieldChangeEncodingContext, FieldChangeDecodingContext>;\n\treadonly editor: TEditor;\n\tintoDelta(change: TChangeset, deltaFromChild: ToDelta): FieldChangeDelta;\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 following:\n\t * - index of the node in the field in the input context of the changeset (or `undefined` if the node is not\n\t * attached in the input context).\n\t * - index of the node in the field in the output context of the changeset (or `undefined` if the node is not\n\t * attached in the output 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): ChildChangeInfo[];\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\trevision: RevisionTag | undefined,\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(change: TChangeset, replacer: RevisionReplacer): TChangeset;\n\n\t/**\n\t * Returns a copy of the given changeset with edits removed as specified.\n\t * @param change - The change to filter edits from\n\t * @param filterDetach - This should be called for each range of detaches in the changeset,\n\t * and the detach should be preserved, removed, or converted to a non-move detach as specified.\n\t * If the returned result does not cover the entire detach range, the remainder should be queried again.\n\t * @param filterAttach - This should be called for each range of attaches in the changeset,\n\t * and the attach should be preserved, removed, or converted to a non-move attach as specified.\n\t * If the returned result does not cover the entire detach range, the remainder should be queried again.\n\t * @param preserveOtherEdits - Whether edits other than attaches and detaches (e.g. root renames),\n\t * should be preserved or removed.\n\t */\n\tfilterEdits(\n\t\tchange: TChangeset,\n\t\toptions: {\n\t\t\tfilterDetach: FilterDetachFunc;\n\t\t\tfilterAttach: FilterAttachFunc;\n\t\t\tpreserveOtherEdits: boolean;\n\t\t},\n\t): TChangeset;\n}\n\nexport type FilterDetachFunc = (\n\t/**\n\t * The ID of the detach being queried.\n\t */\n\tdetachId: ChangeAtomId,\n\tcount: number,\n\n\t/**\n\t * The input-context ID of the nodes being detached, if they are already detached.\n\t */\n\tinputRootId: ChangeAtomId | undefined,\n\n\t/**\n\t * The ID of the associated attach, if this is part of a move with a different attach ID.\n\t */\n\tendpoint?: ChangeAtomId,\n) => RangeQueryResult<FilterDetachResult>;\n\nexport type FilterAttachFunc = (\n\t/**\n\t * The ID of the attach being queried.\n\t */\n\tattachId: ChangeAtomId,\n\tcount: number,\n\n\t/**\n\t * The output-context ID of the nodes being attached, if they are only transiently attached.\n\t */\n\toutputRootId: ChangeAtomId | undefined,\n\n\t/**\n\t * The ID of the associated detach, if this is part of a move with a different detach ID.\n\t */\n\tendpoint?: ChangeAtomId,\n) => RangeQueryResult<FilterAttachResult>;\n\nexport interface FilterDetachResult {\n\treadonly action: EditFilterStatus;\n\n\t/**\n\t * If true, the filtered change should also remove any child changes for the detached nodes.\n\t * This will only be set when `action` is `EditFilterStatus.Remove`.\n\t */\n\treadonly shouldRemoveChild?: boolean;\n}\n\nexport interface FilterAttachResult {\n\treadonly action: EditFilterStatus;\n\n\t/**\n\t * When `action` is `EditFilterStatus.PreserveWithoutMove`,\n\t * the filtered change should include a child change with this ID.\n\t */\n\treadonly nodeId?: NodeId;\n\n\t/**\n\t * When `action` is `EditFilterStatus.PreserveWithoutMove`,\n\t * this ID should be used as the attach ID for the filtered change.\n\t */\n\treadonly newAttachId?: ChangeAtomId;\n}\n\n/**\n * Used to describe what should be done with a particular attach or detach during `filterEdits`.\n */\nexport enum EditFilterStatus {\n\t/**\n\t * The edit should be removed from the filtered changeset.\n\t */\n\tRemove,\n\n\t/**\n\t * The edit should be preserved in the filtered changeset.\n\t */\n\tPreserve,\n\n\t/**\n\t * This should only be used for an attach or detach which is part of a move.\n\t * The edit should be preserved, but should be adjusted, if necessary,\n\t * to reflect that the other endpoint of the move has been filtered out.\n\t */\n\tPreserveWithoutMove,\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\tfilterEdits: FieldChangeRebaser<TChangeset>[\"filterEdits\"];\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\tfilterEdits: (change, options) => data.filterEdits(change, options),\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\tfilterEdits: FieldChangeRebaser<TChangeset>[\"filterEdits\"];\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 changes to the children of this editor's field.\n\t * For each element in the given iterable\n\t * - The number represents the index of the child node in the field.\n\t * - The `NodeId` represents the nested changes for that child node.\n\t * Note: The indices in the iterable must be ordered from smallest to largest (with no duplicates).\n\t */\n\tbuildChildChanges(changes: Iterable<[index: 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 */\nexport type ToDelta = (child: NodeId) => DeltaFieldMap;\n\nexport type NodeChangeInverter = (change: NodeId) => NodeId;\n\nexport enum NodeAttachState {\n\tAttached,\n\tDetached,\n}\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\nexport type NodeChangeComposer = (\n\tchange1: NodeId | undefined,\n\tchange2: NodeId | undefined,\n) => NodeId;\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 */\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}\n\n/**\n * Context provided to field change codecs when decoding.\n * @remarks\n * The decode-side counterpart of {@link FieldChangeEncodingContext}.\n */\nexport interface FieldChangeDecodingContext {\n\treadonly baseContext: ChangeEncodingContext;\n\tdecodeNode(encodedNode: EncodedNodeChangeset): NodeId;\n}\n"]}
@@ -18,6 +18,16 @@
18
18
  * Using a class gets stronger (nominal) typing for objects which will be down cast.
19
19
  */
20
20
  export class FlexFieldKind {
21
+ identifier;
22
+ multiplicity;
23
+ options;
24
+ _typeCheck;
25
+ /**
26
+ * Change handling policy.
27
+ */
28
+ // TODO: stronger typing
29
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
+ changeHandler;
21
31
  constructor(identifier, multiplicity,
22
32
  // TODO: stronger typing
23
33
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1 +1 @@
1
- {"version":3,"file":"fieldKind.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/fieldKind.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,aAAa;IAiBzB,YACiB,UAAiB,EACjB,YAA2B;IAC3C,wBAAwB;IACxB,8DAA8D;IAC9C,OAA2D;QAJ3D,eAAU,GAAV,UAAU,CAAO;QACjB,iBAAY,GAAZ,YAAY,CAAe;QAG3B,YAAO,GAAP,OAAO,CAAoD;QAE3E,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAC5C,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tFieldKindIdentifier,\n\tFieldKindData,\n\tMultiplicity,\n\tSchemaPolicy,\n} from \"../../core/index.js\";\nimport type { MakeNominal } from \"../../util/index.js\";\n\nimport type { FieldChangeHandler, FieldEditor } from \"./fieldChangeHandler.js\";\n\n/**\n * Functionality for FieldKinds that is stable,\n * meaning that it can not change in any measurable way without providing a new identifier.\n *\n * It is assumed that this information and policy is available on all clients interacting with a document\n * using the identifier.\n *\n * This must contain enough information to process remote edits to this FieldKind consistently with all clients.\n * All behavior must be deterministic, and not change across versions of the app/library.\n *\n * These policies include the data encoding, change encoding, change rebase and change application.\n *\n * @privateRemarks\n * Using a class gets stronger (nominal) typing for objects which will be down cast.\n */\nexport class FlexFieldKind<\n\t// TODO: stronger typing\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTEditor extends FieldEditor<any> = FieldEditor<any>,\n\tTName extends FieldKindIdentifier = FieldKindIdentifier,\n\tTMultiplicity extends Multiplicity = Multiplicity,\n> implements FieldKindData\n{\n\tprotected _typeCheck!: MakeNominal;\n\n\t/**\n\t * Change handling policy.\n\t */\n\t// TODO: stronger typing\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic readonly changeHandler: FieldChangeHandler<any, TEditor>;\n\n\tpublic constructor(\n\t\tpublic readonly identifier: TName,\n\t\tpublic readonly multiplicity: TMultiplicity,\n\t\t// TODO: stronger typing\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tpublic readonly options: FieldKindOptions<FieldChangeHandler<any, TEditor>>,\n\t) {\n\t\tthis.changeHandler = options.changeHandler;\n\t}\n}\n\n/**\n * Additional options for {@link FlexFieldKind}.\n *\n * @remarks\n * Puts the more confusing parameters into this object so they get explicit names to help with clarity.\n */\nexport interface FieldKindOptions<TFieldChangeHandler> {\n\t/**\n\t * Change handling policy.\n\t */\n\treadonly changeHandler: TFieldChangeHandler;\n\n\t/**\n\t * The set of field kinds which can be migrated to this one by a {@link TreeView.upgradeSchema}.\n\t * @remarks\n\t * Must return false if such an upgrade could violate any invariants of `superset` for any document which is compatible with `this` + `originalTypes`.\n\t *\n\t * Unlike the rest of the FieldKind API, this may change over time without changing the FieldKind identifier without causing decoherence between clients.\n\t * It has a different set of constraints:\n\t *\n\t * - This must never allow an upgrade that could violate any invariants of any field kind required by any version of client for any document content (that was not already invalid).\n\t * This prevents a schema upgrade from causing a document to become out of schema.\n\t * - The set of implementations of this function across all fields kinds and all client versions must never permit a cycle.\n\t * This prevents applications which simply do an upgrade when possible from being able to have two clients both upgrade where one is actually a down grade and they cause an infinite loop of schema upgrade edits.\n\t *\n\t * To help maintain these invariants, any cases where the set of allowed contents does not increase (but is the same so the upgrade is still in schema) must be considered carefully.\n\t * For example, a migration from `Sequence([])` to `Optional([])` can be problematic despite being permissible\n\t * as it does not change what content is allowed (the field must be empty either way as no types are allowed in it).\n\t * Such cases, if allowed, could lead to cycles if their inverse is also allowed.\n\t * These cases, if supported, can be removed, but if doing so must be documented and still considered when avoiding cycles.\n\t *\n\t * Used by {@link allowsFieldSuperset}.\n\t *\n\t * TODO: this design is rather limiting, and there is some planned work in this area:\n\t * - Provide schema upgrade schema not reliant on this to ensure monotonicity of schema upgrades like AB#7482.\n\t * - This monotonic upgrade scheme can remain useful for features like AB#53604 so it should be kept and refined.\n\t */\n\treadonly allowMonotonicUpgradeFrom: ReadonlySet<FieldKindIdentifier>;\n\n\t/**\n\t * Kinds (in addition to this) whose edits can be processed by changeHandler.\n\t * If the kind of a field changes, and edits are rebased across that kind change,\n\t * listing the other old kind here can prevent those edits from being conflicted and\n\t * provide a chance to handle them.\n\t */\n\t// TODO: provide this and use it for improved support for rebasing changes across schema upgrades.\n\t// readonly handlesEditsFrom: ReadonlySet<FieldKindIdentifier>;\n}\n\n/**\n * Policy from the app for interpreting the stored schema.\n * The app must ensure consistency for all users of the document.\n */\nexport interface FullSchemaPolicy extends SchemaPolicy {\n\t/**\n\t * Policy information about FieldKinds:\n\t * This is typically stored as code, not in documents, and defines how to handles fields based on their kind.\n\t * It is assumed that all users of a document will have exactly the same FieldKind policies,\n\t * though older applications might be missing some,\n\t * and will be unable to process any changes that use those FieldKinds.\n\t */\n\treadonly fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>;\n}\n"]}
1
+ {"version":3,"file":"fieldKind.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/fieldKind.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,aAAa;IAkBR;IACA;IAGA;IAdP,UAAU,CAAe;IAEnC;;OAEG;IACH,wBAAwB;IACxB,8DAA8D;IAC9C,aAAa,CAAmC;IAEhE,YACiB,UAAiB,EACjB,YAA2B;IAC3C,wBAAwB;IACxB,8DAA8D;IAC9C,OAA2D;QAJ3D,eAAU,GAAV,UAAU,CAAO;QACjB,iBAAY,GAAZ,YAAY,CAAe;QAG3B,YAAO,GAAP,OAAO,CAAoD;QAE3E,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAC5C,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tFieldKindIdentifier,\n\tFieldKindData,\n\tMultiplicity,\n\tSchemaPolicy,\n} from \"../../core/index.js\";\nimport type { MakeNominal } from \"../../util/index.js\";\n\nimport type { FieldChangeHandler, FieldEditor } from \"./fieldChangeHandler.js\";\n\n/**\n * Functionality for FieldKinds that is stable,\n * meaning that it can not change in any measurable way without providing a new identifier.\n *\n * It is assumed that this information and policy is available on all clients interacting with a document\n * using the identifier.\n *\n * This must contain enough information to process remote edits to this FieldKind consistently with all clients.\n * All behavior must be deterministic, and not change across versions of the app/library.\n *\n * These policies include the data encoding, change encoding, change rebase and change application.\n *\n * @privateRemarks\n * Using a class gets stronger (nominal) typing for objects which will be down cast.\n */\nexport class FlexFieldKind<\n\t// TODO: stronger typing\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTEditor extends FieldEditor<any> = FieldEditor<any>,\n\tTName extends FieldKindIdentifier = FieldKindIdentifier,\n\tTMultiplicity extends Multiplicity = Multiplicity,\n> implements FieldKindData\n{\n\tprotected _typeCheck!: MakeNominal;\n\n\t/**\n\t * Change handling policy.\n\t */\n\t// TODO: stronger typing\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic readonly changeHandler: FieldChangeHandler<any, TEditor>;\n\n\tpublic constructor(\n\t\tpublic readonly identifier: TName,\n\t\tpublic readonly multiplicity: TMultiplicity,\n\t\t// TODO: stronger typing\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tpublic readonly options: FieldKindOptions<FieldChangeHandler<any, TEditor>>,\n\t) {\n\t\tthis.changeHandler = options.changeHandler;\n\t}\n}\n\n/**\n * Additional options for {@link FlexFieldKind}.\n *\n * @remarks\n * Puts the more confusing parameters into this object so they get explicit names to help with clarity.\n */\nexport interface FieldKindOptions<TFieldChangeHandler> {\n\t/**\n\t * Change handling policy.\n\t */\n\treadonly changeHandler: TFieldChangeHandler;\n\n\t/**\n\t * The set of field kinds which can be migrated to this one by a {@link TreeView.upgradeSchema}.\n\t * @remarks\n\t * Must return false if such an upgrade could violate any invariants of `superset` for any document which is compatible with `this` + `originalTypes`.\n\t *\n\t * Unlike the rest of the FieldKind API, this may change over time without changing the FieldKind identifier without causing decoherence between clients.\n\t * It has a different set of constraints:\n\t *\n\t * - This must never allow an upgrade that could violate any invariants of any field kind required by any version of client for any document content (that was not already invalid).\n\t * This prevents a schema upgrade from causing a document to become out of schema.\n\t * - The set of implementations of this function across all fields kinds and all client versions must never permit a cycle.\n\t * This prevents applications which simply do an upgrade when possible from being able to have two clients both upgrade where one is actually a down grade and they cause an infinite loop of schema upgrade edits.\n\t *\n\t * To help maintain these invariants, any cases where the set of allowed contents does not increase (but is the same so the upgrade is still in schema) must be considered carefully.\n\t * For example, a migration from `Sequence([])` to `Optional([])` can be problematic despite being permissible\n\t * as it does not change what content is allowed (the field must be empty either way as no types are allowed in it).\n\t * Such cases, if allowed, could lead to cycles if their inverse is also allowed.\n\t * These cases, if supported, can be removed, but if doing so must be documented and still considered when avoiding cycles.\n\t *\n\t * Used by {@link allowsFieldSuperset}.\n\t *\n\t * TODO: this design is rather limiting, and there is some planned work in this area:\n\t * - Provide schema upgrade schema not reliant on this to ensure monotonicity of schema upgrades like AB#7482.\n\t * - This monotonic upgrade scheme can remain useful for features like AB#53604 so it should be kept and refined.\n\t */\n\treadonly allowMonotonicUpgradeFrom: ReadonlySet<FieldKindIdentifier>;\n\n\t/**\n\t * Kinds (in addition to this) whose edits can be processed by changeHandler.\n\t * If the kind of a field changes, and edits are rebased across that kind change,\n\t * listing the other old kind here can prevent those edits from being conflicted and\n\t * provide a chance to handle them.\n\t */\n\t// TODO: provide this and use it for improved support for rebasing changes across schema upgrades.\n\t// readonly handlesEditsFrom: ReadonlySet<FieldKindIdentifier>;\n}\n\n/**\n * Policy from the app for interpreting the stored schema.\n * The app must ensure consistency for all users of the document.\n */\nexport interface FullSchemaPolicy extends SchemaPolicy {\n\t/**\n\t * Policy information about FieldKinds:\n\t * This is typically stored as code, not in documents, and defines how to handles fields based on their kind.\n\t * It is assumed that all users of a document will have exactly the same FieldKind policies,\n\t * though older applications might be missing some,\n\t * and will be unable to process any changes that use those FieldKinds.\n\t */\n\treadonly fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>;\n}\n"]}
@@ -0,0 +1,13 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { type ChangeAtomId, type FieldKindIdentifier } from "../../core/index.js";
6
+ import { type RangeQueryResult } from "../../util/index.js";
7
+ import { type FilterAttachResult, type FilterDetachResult } from "./fieldChangeHandler.js";
8
+ import type { FlexFieldKind } from "./fieldKind.js";
9
+ import type { FieldChange, FieldId, ModularChangeset } from "./modularChangeTypes.js";
10
+ export declare function removeAllDetachesFilter(_id: ChangeAtomId, count: number, _rootId: ChangeAtomId | undefined, _endpointId?: ChangeAtomId): RangeQueryResult<FilterDetachResult>;
11
+ export declare function removeAllAttachesFilter(_id: ChangeAtomId, count: number, _rootId: ChangeAtomId | undefined, _endpointId?: ChangeAtomId): RangeQueryResult<FilterAttachResult>;
12
+ export declare function filterEdits(change: ModularChangeset, filterFieldEdits: (fieldChange: FieldChange, fieldId: FieldId) => FieldChange, fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>): ModularChangeset;
13
+ //# sourceMappingURL=filterEdits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filterEdits.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/filterEdits.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAS,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAEN,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EACX,WAAW,EAEX,OAAO,EACP,gBAAgB,EAGhB,MAAM,yBAAyB,CAAC;AAIjC,wBAAgB,uBAAuB,CACtC,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,YAAY,GAAG,SAAS,EACjC,WAAW,CAAC,EAAE,YAAY,GACxB,gBAAgB,CAAC,kBAAkB,CAAC,CAKtC;AAED,wBAAgB,uBAAuB,CACtC,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,YAAY,GAAG,SAAS,EACjC,WAAW,CAAC,EAAE,YAAY,GACxB,gBAAgB,CAAC,kBAAkB,CAAC,CAEtC;AAED,wBAAgB,WAAW,CAC1B,MAAM,EAAE,gBAAgB,EACxB,gBAAgB,EAAE,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,KAAK,WAAW,EAC7E,UAAU,EAAE,WAAW,CAAC,mBAAmB,EAAE,aAAa,CAAC,GACzD,gBAAgB,CA0BlB"}
@@ -0,0 +1,46 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { makeChangeAtomId, } from "../../core/index.js";
6
+ import { brand } from "../../util/index.js";
7
+ import { EditFilterStatus, } from "./fieldChangeHandler.js";
8
+ import { makeChangesetInversions } from "./modularChangeUtils.js";
9
+ import { pruneChangeset } from "./prune.js";
10
+ export function removeAllDetachesFilter(_id, count, _rootId, _endpointId) {
11
+ return {
12
+ value: { action: EditFilterStatus.Remove, shouldRemoveChild: false },
13
+ length: count,
14
+ };
15
+ }
16
+ export function removeAllAttachesFilter(_id, count, _rootId, _endpointId) {
17
+ return { value: { action: EditFilterStatus.Remove }, length: count };
18
+ }
19
+ export function filterEdits(change, filterFieldEdits, fieldKinds) {
20
+ const filteredFieldChanges = filterFieldMapEdits(change.fieldChanges, undefined, filterFieldEdits);
21
+ const filteredNodeChanges = brand(change.nodeChanges.mapValues((v, k) => filterNodeEdits(makeChangeAtomId(k[1], k[0]), v, filterFieldEdits)));
22
+ const { crossFieldKeys: filteredCrossFieldKeys, nodeToParent: filteredNodeToParent } = makeChangesetInversions(filteredFieldChanges, filteredNodeChanges, fieldKinds);
23
+ return pruneChangeset({
24
+ ...change,
25
+ fieldChanges: filteredFieldChanges,
26
+ nodeChanges: filteredNodeChanges,
27
+ crossFieldKeys: filteredCrossFieldKeys,
28
+ nodeToParent: filteredNodeToParent,
29
+ }, fieldKinds);
30
+ }
31
+ function filterFieldMapEdits(change, nodeId, filterFieldEdits) {
32
+ return new Map(Array.from(change.entries(), ([field, fieldChange]) => [
33
+ field,
34
+ filterFieldEdits(fieldChange, { nodeId, field }),
35
+ ]));
36
+ }
37
+ function filterNodeEdits(nodeId, change, filterFieldEdits) {
38
+ if (change.fieldChanges === undefined) {
39
+ return change;
40
+ }
41
+ return {
42
+ ...change,
43
+ fieldChanges: filterFieldMapEdits(change.fieldChanges, nodeId, filterFieldEdits),
44
+ };
45
+ }
46
+ //# sourceMappingURL=filterEdits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filterEdits.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/filterEdits.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,gBAAgB,GAGhB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAyB,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EACN,gBAAgB,GAGhB,MAAM,yBAAyB,CAAC;AAUjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,UAAU,uBAAuB,CACtC,GAAiB,EACjB,KAAa,EACb,OAAiC,EACjC,WAA0B;IAE1B,OAAO;QACN,KAAK,EAAE,EAAE,MAAM,EAAE,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE;QACpE,MAAM,EAAE,KAAK;KACb,CAAC;AACH,CAAC;AAED,MAAM,UAAU,uBAAuB,CACtC,GAAiB,EACjB,KAAa,EACb,OAAiC,EACjC,WAA0B;IAE1B,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,gBAAgB,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,WAAW,CAC1B,MAAwB,EACxB,gBAA6E,EAC7E,UAA2D;IAE3D,MAAM,oBAAoB,GAAG,mBAAmB,CAC/C,MAAM,CAAC,YAAY,EACnB,SAAS,EACT,gBAAgB,CAChB,CAAC;IAEF,MAAM,mBAAmB,GAAqC,KAAK,CAClE,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACrC,eAAe,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,gBAAgB,CAAC,CAClE,CACD,CAAC;IAEF,MAAM,EAAE,cAAc,EAAE,sBAAsB,EAAE,YAAY,EAAE,oBAAoB,EAAE,GACnF,uBAAuB,CAAC,oBAAoB,EAAE,mBAAmB,EAAE,UAAU,CAAC,CAAC;IAEhF,OAAO,cAAc,CACpB;QACC,GAAG,MAAM;QACT,YAAY,EAAE,oBAAoB;QAClC,WAAW,EAAE,mBAAmB;QAChC,cAAc,EAAE,sBAAsB;QACtC,YAAY,EAAE,oBAAoB;KAClC,EACD,UAAU,CACV,CAAC;AACH,CAAC;AAED,SAAS,mBAAmB,CAC3B,MAAsB,EACtB,MAA0B,EAC1B,gBAA6E;IAE7E,OAAO,IAAI,GAAG,CACb,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,WAAW,CAAC,EAAE,EAAE,CAAC;QACtD,KAAK;QACL,gBAAgB,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;KAChD,CAAC,CACF,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CACvB,MAAc,EACd,MAAqB,EACrB,gBAA6E;IAE7E,IAAI,MAAM,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACvC,OAAO,MAAM,CAAC;IACf,CAAC;IACD,OAAO;QACN,GAAG,MAAM;QACT,YAAY,EAAE,mBAAmB,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,gBAAgB,CAAC;KAChF,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tmakeChangeAtomId,\n\ttype ChangeAtomId,\n\ttype FieldKindIdentifier,\n} from \"../../core/index.js\";\nimport { brand, type RangeQueryResult } from \"../../util/index.js\";\nimport type { ChangeAtomIdBTree } from \"../changeAtomIdBTree.js\";\nimport {\n\tEditFilterStatus,\n\ttype FilterAttachResult,\n\ttype FilterDetachResult,\n} from \"./fieldChangeHandler.js\";\nimport type { FlexFieldKind } from \"./fieldKind.js\";\nimport type {\n\tFieldChange,\n\tFieldChangeMap,\n\tFieldId,\n\tModularChangeset,\n\tNodeChangeset,\n\tNodeId,\n} from \"./modularChangeTypes.js\";\nimport { makeChangesetInversions } from \"./modularChangeUtils.js\";\nimport { pruneChangeset } from \"./prune.js\";\n\nexport function removeAllDetachesFilter(\n\t_id: ChangeAtomId,\n\tcount: number,\n\t_rootId: ChangeAtomId | undefined,\n\t_endpointId?: ChangeAtomId,\n): RangeQueryResult<FilterDetachResult> {\n\treturn {\n\t\tvalue: { action: EditFilterStatus.Remove, shouldRemoveChild: false },\n\t\tlength: count,\n\t};\n}\n\nexport function removeAllAttachesFilter(\n\t_id: ChangeAtomId,\n\tcount: number,\n\t_rootId: ChangeAtomId | undefined,\n\t_endpointId?: ChangeAtomId,\n): RangeQueryResult<FilterAttachResult> {\n\treturn { value: { action: EditFilterStatus.Remove }, length: count };\n}\n\nexport function filterEdits(\n\tchange: ModularChangeset,\n\tfilterFieldEdits: (fieldChange: FieldChange, fieldId: FieldId) => FieldChange,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): ModularChangeset {\n\tconst filteredFieldChanges = filterFieldMapEdits(\n\t\tchange.fieldChanges,\n\t\tundefined,\n\t\tfilterFieldEdits,\n\t);\n\n\tconst filteredNodeChanges: ChangeAtomIdBTree<NodeChangeset> = brand(\n\t\tchange.nodeChanges.mapValues((v, k) =>\n\t\t\tfilterNodeEdits(makeChangeAtomId(k[1], k[0]), v, filterFieldEdits),\n\t\t),\n\t);\n\n\tconst { crossFieldKeys: filteredCrossFieldKeys, nodeToParent: filteredNodeToParent } =\n\t\tmakeChangesetInversions(filteredFieldChanges, filteredNodeChanges, fieldKinds);\n\n\treturn pruneChangeset(\n\t\t{\n\t\t\t...change,\n\t\t\tfieldChanges: filteredFieldChanges,\n\t\t\tnodeChanges: filteredNodeChanges,\n\t\t\tcrossFieldKeys: filteredCrossFieldKeys,\n\t\t\tnodeToParent: filteredNodeToParent,\n\t\t},\n\t\tfieldKinds,\n\t);\n}\n\nfunction filterFieldMapEdits(\n\tchange: FieldChangeMap,\n\tnodeId: NodeId | undefined,\n\tfilterFieldEdits: (fieldChange: FieldChange, fieldId: FieldId) => FieldChange,\n): FieldChangeMap {\n\treturn new Map(\n\t\tArray.from(change.entries(), ([field, fieldChange]) => [\n\t\t\tfield,\n\t\t\tfilterFieldEdits(fieldChange, { nodeId, field }),\n\t\t]),\n\t);\n}\n\nfunction filterNodeEdits(\n\tnodeId: NodeId,\n\tchange: NodeChangeset,\n\tfilterFieldEdits: (fieldChange: FieldChange, fieldId: FieldId) => FieldChange,\n): NodeChangeset {\n\tif (change.fieldChanges === undefined) {\n\t\treturn change;\n\t}\n\treturn {\n\t\t...change,\n\t\tfieldChanges: filterFieldMapEdits(change.fieldChanges, nodeId, filterFieldEdits),\n\t};\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"genericFieldKind.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/genericFieldKind.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,OAAO,KAAK,EAEX,kBAAkB,EAOlB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAGxF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,kBAAkB,CAAC,gBAAgB,CAkCrE,CAAC;AA6FF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAO9B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAC3C,SAAS,EAAE,gBAAgB,EAC3B,MAAM,EAAE,kBAAkB,CAAC,OAAO,CAAC,GACjC,OAAO,CAET"}
1
+ {"version":3,"file":"genericFieldKind.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/genericFieldKind.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,OAAO,KAAK,EAGX,kBAAkB,EAMlB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAGxF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,kBAAkB,CAAC,gBAAgB,CAkCrE,CAAC;AAgGF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAO9B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAC3C,SAAS,EAAE,gBAAgB,EAC3B,MAAM,EAAE,kBAAkB,CAAC,OAAO,CAAC,GACjC,OAAO,CAET"}
@@ -57,8 +57,11 @@ function compose(change1, change2, composeChildren) {
57
57
  return composed;
58
58
  }
59
59
  function getNestedChanges(change) {
60
- // For generic changeset, the indices in the input and output contexts are the same.
61
- return change.toArray().map(([index, nodeChange]) => [nodeChange, index, index]);
60
+ return change.toArray().map(([_index, nodeChange]) => ({
61
+ nodeId: nodeChange,
62
+ inputRootId: undefined,
63
+ detachId: undefined,
64
+ }));
62
65
  }
63
66
  function rebaseGenericChange(change, over, rebaseChild) {
64
67
  const rebased = new BTree();
@@ -1 +1 @@
1
- {"version":3,"file":"genericFieldKind.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/genericFieldKind.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,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7B,MAAwB,EACxB,6BAA4D;IAE5D,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;QAC1C,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 { assert } from \"@fluidframework/core-utils/internal\";\nimport { BTree } from \"@tylerbu/sorted-btree-es6\";\n\nimport {\n\ttype DeltaDetachedNodeId,\n\ttype DeltaMark,\n\ttype FieldKindIdentifier,\n\tMultiplicity,\n\ttype RevisionReplacer,\n} from \"../../core/index.js\";\nimport { brandConst } from \"../../util/index.js\";\n\nimport type {\n\tFieldChangeDelta,\n\tFieldChangeHandler,\n\tNestedChangesIndices,\n\tNodeChangeComposer,\n\tNodeChangePruner,\n\tNodeChangeRebaser,\n\tRelevantRemovedRootsFromChild,\n\tToDelta,\n} from \"./fieldChangeHandler.js\";\nimport { FlexFieldKind } from \"./fieldKind.js\";\nimport { makeGenericChangeCodec } from \"./genericFieldKindCodecs.js\";\nimport { newGenericChangeset, 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\tinvert: (change: GenericChangeset): GenericChangeset => change,\n\t\trebase: rebaseGenericChange,\n\t\tprune: pruneGenericChange,\n\t\treplaceRevisions,\n\t\tfilterEdits: (change: GenericChangeset): GenericChangeset => change,\n\t},\n\tcodecsFactory: makeGenericChangeCodec,\n\teditor: {\n\t\tbuildChildChanges(changes: Iterable<[number, NodeId]>): GenericChangeset {\n\t\t\treturn newGenericChangeset([...changes]);\n\t\t},\n\t},\n\tintoDelta: (change: GenericChangeset, deltaFromChild: ToDelta): FieldChangeDelta => {\n\t\tlet nodeIndex = 0;\n\t\tconst markList: DeltaMark[] = [];\n\t\tfor (const [index, nodeChange] of change.entries()) {\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: { marks: markList } };\n\t},\n\trelevantRemovedRoots,\n\tisEmpty: (change: GenericChangeset): boolean => change.length === 0,\n\tgetNestedChanges,\n\tcreateEmpty: newGenericChangeset,\n\tgetCrossFieldKeys: (_change) => [],\n};\n\nfunction compose(\n\tchange1: GenericChangeset,\n\tchange2: GenericChangeset,\n\tcomposeChildren: NodeChangeComposer,\n): GenericChangeset {\n\tconst composed = change1.clone();\n\tfor (const [index, id2] of change2.entries()) {\n\t\tconst id1 = composed.get(index);\n\t\tconst idComposed = id1 === undefined ? id2 : composeChildren(id1, id2);\n\t\tcomposed.set(index, idComposed);\n\t}\n\n\treturn composed;\n}\n\nfunction getNestedChanges(change: GenericChangeset): NestedChangesIndices {\n\t// For generic changeset, the indices in the input and output contexts are the same.\n\treturn change.toArray().map(([index, nodeChange]) => [nodeChange, index, index]);\n}\n\nfunction rebaseGenericChange(\n\tchange: GenericChangeset,\n\tover: GenericChangeset,\n\trebaseChild: NodeChangeRebaser,\n): GenericChangeset {\n\tconst rebased: GenericChangeset = new BTree();\n\tlet nextIndex = 0;\n\n\twhile (true) {\n\t\tconst newEntry = change.getPairOrNextHigher(nextIndex);\n\t\tconst baseEntry = over.getPairOrNextHigher(nextIndex);\n\n\t\tif (baseEntry === undefined && newEntry === undefined) {\n\t\t\tbreak;\n\t\t}\n\n\t\tconst newIndex = newEntry?.[0] ?? Number.POSITIVE_INFINITY;\n\t\tconst baseIndex = baseEntry?.[0] ?? Number.POSITIVE_INFINITY;\n\t\tlet newNodeChange: NodeId | undefined;\n\t\tlet baseNodeChange: NodeId | undefined;\n\t\tlet index: number;\n\t\tif (newIndex === baseIndex) {\n\t\t\tassert(\n\t\t\t\tnewEntry !== undefined && baseEntry !== undefined,\n\t\t\t\t0xa0d /* Entries should be defined */,\n\t\t\t);\n\t\t\tindex = newIndex;\n\t\t\tnewNodeChange = newEntry[1];\n\t\t\tbaseNodeChange = baseEntry[1];\n\t\t} else if (newIndex < baseIndex) {\n\t\t\tassert(newEntry !== undefined, 0xa0e /* Entry should be defined */);\n\t\t\tindex = newIndex;\n\t\t\tnewNodeChange = newEntry[1];\n\t\t} else {\n\t\t\tassert(baseEntry !== undefined, 0xa0f /* Entry should be defined */);\n\t\t\tindex = baseIndex;\n\t\t\tbaseNodeChange = baseEntry[1];\n\t\t}\n\n\t\tconst nodeChange = rebaseChild(newNodeChange, baseNodeChange);\n\t\tif (nodeChange !== undefined) {\n\t\t\trebased.set(index, nodeChange);\n\t\t}\n\n\t\tnextIndex = index + 1;\n\t}\n\n\treturn rebased;\n}\n\nfunction pruneGenericChange(\n\tchangeset: GenericChangeset,\n\tpruneChild: NodeChangePruner,\n): GenericChangeset {\n\tconst pruned: GenericChangeset = new BTree();\n\tfor (const [index, node] of changeset.entries()) {\n\t\tconst prunedNode = pruneChild(node);\n\t\tif (prunedNode !== undefined) {\n\t\t\tpruned.set(index, node);\n\t\t}\n\t}\n\treturn pruned;\n}\n\nfunction replaceRevisions(\n\tchangeset: GenericChangeset,\n\treplacer: RevisionReplacer,\n): GenericChangeset {\n\treturn changeset.mapValues((node) => replacer.getUpdatedAtomId(node));\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: FlexFieldKind = new FlexFieldKind(\n\tbrandConst(\"ModularEditBuilder.Generic\")<FieldKindIdentifier>(),\n\tMultiplicity.Sequence,\n\t{\n\t\tchangeHandler: genericChangeHandler,\n\t\tallowMonotonicUpgradeFrom: new Set(),\n\t},\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): TChange {\n\treturn target.editor.buildChildChanges(changeset.entries());\n}\n\nfunction* relevantRemovedRoots(\n\tchange: GenericChangeset,\n\trelevantRemovedRootsFromChild: RelevantRemovedRootsFromChild,\n): Iterable<DeltaDetachedNodeId> {\n\tfor (const nodeChange of change.values()) {\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,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAElD,OAAO,EAIN,YAAY,GAEZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAYjD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAyB,MAAM,4BAA4B,CAAC;AAGxF;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAyC;IACzE,OAAO,EAAE;QACR,OAAO;QACP,MAAM,EAAE,CAAC,MAAwB,EAAoB,EAAE,CAAC,MAAM;QAC9D,MAAM,EAAE,mBAAmB;QAC3B,KAAK,EAAE,kBAAkB;QACzB,gBAAgB;QAChB,WAAW,EAAE,CAAC,MAAwB,EAAoB,EAAE,CAAC,MAAM;KACnE;IACD,aAAa,EAAE,sBAAsB;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AI,CAAC,CAAC;QACzB,CAAC;IACF,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC;AAED,SAAS,gBAAgB,CACxB,SAA2B,EAC3B,QAA0B;IAE1B,OAAO,SAAS,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;AACvE,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAkB,IAAI,aAAa,CAC/D,UAAU,CAAC,4BAA4B,CAAC,EAAuB,EAC/D,YAAY,CAAC,QAAQ,EACrB;IACC,aAAa,EAAE,oBAAoB;IACnC,yBAAyB,EAAE,IAAI,GAAG,EAAE;CACpC,CACD,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CACnC,SAA2B,EAC3B,MAAmC;IAEnC,OAAO,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;AAC7D,CAAC;AAED,QAAQ,CAAC,CAAC,oBAAoB,CAC7B,MAAwB,EACxB,6BAA4D;IAE5D,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;QAC1C,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 { assert } from \"@fluidframework/core-utils/internal\";\nimport { BTree } from \"@tylerbu/sorted-btree-es6\";\n\nimport {\n\ttype DeltaDetachedNodeId,\n\ttype DeltaMark,\n\ttype FieldKindIdentifier,\n\tMultiplicity,\n\ttype RevisionReplacer,\n} from \"../../core/index.js\";\nimport { brandConst } from \"../../util/index.js\";\n\nimport type {\n\tChildChangeInfo,\n\tFieldChangeDelta,\n\tFieldChangeHandler,\n\tNodeChangeComposer,\n\tNodeChangePruner,\n\tNodeChangeRebaser,\n\tRelevantRemovedRootsFromChild,\n\tToDelta,\n} from \"./fieldChangeHandler.js\";\nimport { FlexFieldKind } from \"./fieldKind.js\";\nimport { makeGenericChangeCodec } from \"./genericFieldKindCodecs.js\";\nimport { newGenericChangeset, 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\tinvert: (change: GenericChangeset): GenericChangeset => change,\n\t\trebase: rebaseGenericChange,\n\t\tprune: pruneGenericChange,\n\t\treplaceRevisions,\n\t\tfilterEdits: (change: GenericChangeset): GenericChangeset => change,\n\t},\n\tcodecsFactory: makeGenericChangeCodec,\n\teditor: {\n\t\tbuildChildChanges(changes: Iterable<[number, NodeId]>): GenericChangeset {\n\t\t\treturn newGenericChangeset([...changes]);\n\t\t},\n\t},\n\tintoDelta: (change: GenericChangeset, deltaFromChild: ToDelta): FieldChangeDelta => {\n\t\tlet nodeIndex = 0;\n\t\tconst markList: DeltaMark[] = [];\n\t\tfor (const [index, nodeChange] of change.entries()) {\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: { marks: markList } };\n\t},\n\trelevantRemovedRoots,\n\tisEmpty: (change: GenericChangeset): boolean => change.length === 0,\n\tgetNestedChanges,\n\tcreateEmpty: newGenericChangeset,\n\tgetCrossFieldKeys: (_change) => [],\n};\n\nfunction compose(\n\tchange1: GenericChangeset,\n\tchange2: GenericChangeset,\n\tcomposeChildren: NodeChangeComposer,\n): GenericChangeset {\n\tconst composed = change1.clone();\n\tfor (const [index, id2] of change2.entries()) {\n\t\tconst id1 = composed.get(index);\n\t\tconst idComposed = id1 === undefined ? id2 : composeChildren(id1, id2);\n\t\tcomposed.set(index, idComposed);\n\t}\n\n\treturn composed;\n}\n\nfunction getNestedChanges(change: GenericChangeset): ChildChangeInfo[] {\n\treturn change.toArray().map(([_index, nodeChange]) => ({\n\t\tnodeId: nodeChange,\n\t\tinputRootId: undefined,\n\t\tdetachId: undefined,\n\t}));\n}\n\nfunction rebaseGenericChange(\n\tchange: GenericChangeset,\n\tover: GenericChangeset,\n\trebaseChild: NodeChangeRebaser,\n): GenericChangeset {\n\tconst rebased: GenericChangeset = new BTree();\n\tlet nextIndex = 0;\n\n\twhile (true) {\n\t\tconst newEntry = change.getPairOrNextHigher(nextIndex);\n\t\tconst baseEntry = over.getPairOrNextHigher(nextIndex);\n\n\t\tif (baseEntry === undefined && newEntry === undefined) {\n\t\t\tbreak;\n\t\t}\n\n\t\tconst newIndex = newEntry?.[0] ?? Number.POSITIVE_INFINITY;\n\t\tconst baseIndex = baseEntry?.[0] ?? Number.POSITIVE_INFINITY;\n\t\tlet newNodeChange: NodeId | undefined;\n\t\tlet baseNodeChange: NodeId | undefined;\n\t\tlet index: number;\n\t\tif (newIndex === baseIndex) {\n\t\t\tassert(\n\t\t\t\tnewEntry !== undefined && baseEntry !== undefined,\n\t\t\t\t0xa0d /* Entries should be defined */,\n\t\t\t);\n\t\t\tindex = newIndex;\n\t\t\tnewNodeChange = newEntry[1];\n\t\t\tbaseNodeChange = baseEntry[1];\n\t\t} else if (newIndex < baseIndex) {\n\t\t\tassert(newEntry !== undefined, 0xa0e /* Entry should be defined */);\n\t\t\tindex = newIndex;\n\t\t\tnewNodeChange = newEntry[1];\n\t\t} else {\n\t\t\tassert(baseEntry !== undefined, 0xa0f /* Entry should be defined */);\n\t\t\tindex = baseIndex;\n\t\t\tbaseNodeChange = baseEntry[1];\n\t\t}\n\n\t\tconst nodeChange = rebaseChild(newNodeChange, baseNodeChange);\n\t\tif (nodeChange !== undefined) {\n\t\t\trebased.set(index, nodeChange);\n\t\t}\n\n\t\tnextIndex = index + 1;\n\t}\n\n\treturn rebased;\n}\n\nfunction pruneGenericChange(\n\tchangeset: GenericChangeset,\n\tpruneChild: NodeChangePruner,\n): GenericChangeset {\n\tconst pruned: GenericChangeset = new BTree();\n\tfor (const [index, node] of changeset.entries()) {\n\t\tconst prunedNode = pruneChild(node);\n\t\tif (prunedNode !== undefined) {\n\t\t\tpruned.set(index, node);\n\t\t}\n\t}\n\treturn pruned;\n}\n\nfunction replaceRevisions(\n\tchangeset: GenericChangeset,\n\treplacer: RevisionReplacer,\n): GenericChangeset {\n\treturn changeset.mapValues((node) => replacer.getUpdatedAtomId(node));\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: FlexFieldKind = new FlexFieldKind(\n\tbrandConst(\"ModularEditBuilder.Generic\")<FieldKindIdentifier>(),\n\tMultiplicity.Sequence,\n\t{\n\t\tchangeHandler: genericChangeHandler,\n\t\tallowMonotonicUpgradeFrom: new Set(),\n\t},\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): TChange {\n\treturn target.editor.buildChildChanges(changeset.entries());\n}\n\nfunction* relevantRemovedRoots(\n\tchange: GenericChangeset,\n\trelevantRemovedRootsFromChild: RelevantRemovedRootsFromChild,\n): Iterable<DeltaDetachedNodeId> {\n\tfor (const nodeChange of change.values()) {\n\t\tyield* relevantRemovedRootsFromChild(nodeChange);\n\t}\n}\n"]}
@@ -4,8 +4,8 @@
4
4
  */
5
5
  import * as Type from "@sinclair/typebox";
6
6
  import type { Static, TAnySchema, TSchema } from "@sinclair/typebox";
7
- export declare const EncodedGenericChange: <NodeChangesetSchema extends Type.TSchema>(tNodeChangeset: NodeChangesetSchema) => Type.TTuple<[Type.TNumber, NodeChangesetSchema]>;
7
+ export declare const EncodedGenericChange: <NodeChangesetSchema extends TSchema>(tNodeChangeset: NodeChangesetSchema) => Type.TTuple<[Type.TNumber, NodeChangesetSchema]>;
8
8
  export type EncodedGenericChange<Schema extends TSchema = TAnySchema> = Static<ReturnType<typeof EncodedGenericChange<Schema>>>;
9
- export declare const EncodedGenericChangeset: <NodeChangesetSchema extends Type.TSchema>(tNodeChangeset: NodeChangesetSchema) => Type.TArray<Type.TTuple<[Type.TNumber, NodeChangesetSchema]>>;
9
+ export declare const EncodedGenericChangeset: <NodeChangesetSchema extends TSchema>(tNodeChangeset: NodeChangesetSchema) => Type.TArray<Type.TTuple<[Type.TNumber, NodeChangesetSchema]>>;
10
10
  export type EncodedGenericChangeset<Schema extends TSchema = TAnySchema> = Static<ReturnType<typeof EncodedGenericChangeset<Schema>>>;
11
11
  //# sourceMappingURL=genericFieldKindFormat.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"genericFieldKindFormat.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/genericFieldKindFormat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,IAAI,MAAM,mBAAmB,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAErE,eAAO,MAAM,oBAAoB,6DAChB,mBAAmB,qDACyC,CAAC;AAE9E,MAAM,MAAM,oBAAoB,CAAC,MAAM,SAAS,OAAO,GAAG,UAAU,IAAI,MAAM,CAC7E,UAAU,CAAC,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAC/C,CAAC;AAEF,eAAO,MAAM,uBAAuB,6DACnB,mBAAmB,kEACiB,CAAC;AAEtD,MAAM,MAAM,uBAAuB,CAAC,MAAM,SAAS,OAAO,GAAG,UAAU,IAAI,MAAM,CAChF,UAAU,CAAC,OAAO,uBAAuB,CAAC,MAAM,CAAC,CAAC,CAClD,CAAC"}
1
+ {"version":3,"file":"genericFieldKindFormat.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/genericFieldKindFormat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,IAAI,MAAM,mBAAmB,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAErE,eAAO,MAAM,oBAAoB,GAAI,mBAAmB,SAAS,OAAO,EACvE,gBAAgB,mBAAmB,qDACyC,CAAC;AAE9E,MAAM,MAAM,oBAAoB,CAAC,MAAM,SAAS,OAAO,GAAG,UAAU,IAAI,MAAM,CAC7E,UAAU,CAAC,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAC/C,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,mBAAmB,SAAS,OAAO,EAC1E,gBAAgB,mBAAmB,kEACiB,CAAC;AAEtD,MAAM,MAAM,uBAAuB,CAAC,MAAM,SAAS,OAAO,GAAG,UAAU,IAAI,MAAM,CAChF,UAAU,CAAC,OAAO,uBAAuB,CAAC,MAAM,CAAC,CAAC,CAClD,CAAC"}
@@ -8,7 +8,7 @@ export { addCrossFieldQuery, type CrossFieldManager, type CrossFieldMap, type Cr
8
8
  export { ChangesetLocalIdSchema, EncodedChangeAtomId, EncodedRevisionInfo, EncodedModularChangesetV1, EncodedNodeChangeset, } from "./modularChangeFormatV1.js";
9
9
  export { EncodedModularChangesetV2 } from "./modularChangeFormatV2.js";
10
10
  export { FlexFieldKind, type FullSchemaPolicy } from "./fieldKind.js";
11
- export { type EditFilterFunc, EditFilterStatus, type FieldChangeHandler, type FieldChangeDelta, type FieldChangeEncodingContext, type FieldChangeDecodingContext, type FieldChangeRebaser, type FieldEditor, type NestedChangesIndices, type NodeChangeComposer, type NodeChangeInverter, type NodeChangeRebaser, type NodeChangePruner, referenceFreeFieldChangeRebaser, type RebaseRevisionMetadata, type RelevantRemovedRootsFromChild, type ToDelta, NodeAttachState, } from "./fieldChangeHandler.js";
11
+ export { type ChildChangeInfo, EditFilterStatus, type FilterDetachFunc, type FilterAttachFunc, type FilterAttachResult, type FilterDetachResult, type FieldChangeHandler, type FieldChangeDelta, type FieldChangeEncodingContext, type FieldChangeDecodingContext, type FieldChangeRebaser, type FieldEditor, type NodeChangeComposer, type NodeChangeInverter, type NodeChangeRebaser, type NodeChangePruner, referenceFreeFieldChangeRebaser, type RebaseRevisionMetadata, type RelevantRemovedRootsFromChild, type ToDelta, NodeAttachState, } from "./fieldChangeHandler.js";
12
12
  export type { CrossFieldKey, CrossFieldKeyRange, FieldChange, FieldChangeMap, FieldChangeset, HasFieldChanges, ModularChangeset, NoChangeConstraint, NodeExistsConstraint, NodeId, } from "./modularChangeTypes.js";
13
13
  export { convertGenericChange, genericChangeHandler, genericFieldKind, } from "./genericFieldKind.js";
14
14
  export type { GenericChangeset } from "./genericFieldKindTypes.js";
@@ -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,EAClB,0BAA0B,GAC1B,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,yBAAyB,EACzB,oBAAoB,GACpB,MAAM,4BAA4B,CAAC;AACpC,OA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":"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,EAClB,0BAA0B,GAC1B,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,yBAAyB,EACzB,oBAAoB,GACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EACN,KAAK,eAAe,EACpB,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,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,GACf,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACX,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,MAAM,GACN,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,GAChB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,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,EACN,0BAA0B,EAC1B,4BAA4B,GAC5B,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACX,sBAAsB,EACtB,2BAA2B,GAC3B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,kBAAkB,EAClB,kCAAkC,EAClC,mBAAmB,EACnB,kBAAkB,EAClB,0BAA0B,GAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EACN,kBAAkB,EAIlB,gBAAgB,EAChB,kBAAkB,GAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,oBAAoB,GACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAyB,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAEN,gBAAgB,EAYhB,+BAA+B,EAI/B,eAAe,GACf,MAAM,yBAAyB,CAAC;AAajC,OAAO,EACN,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,GAChB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACN,mBAAmB,EACnB,kBAAkB,EAIlB,8BAA8B,EAC9B,SAAS,EACT,oBAAoB,EACpB,gBAAgB,GAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,0BAA0B,EAC1B,4BAA4B,GAC5B,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC","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\tallowsMultiplicitySuperset,\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\tEncodedModularChangesetV1,\n\tEncodedNodeChangeset,\n} from \"./modularChangeFormatV1.js\";\nexport { EncodedModularChangesetV2 } from \"./modularChangeFormatV2.js\";\nexport { FlexFieldKind, type FullSchemaPolicy } from \"./fieldKind.js\";\nexport {\n\ttype EditFilterFunc,\n\tEditFilterStatus,\n\ttype FieldChangeHandler,\n\ttype FieldChangeDelta,\n\ttype FieldChangeEncodingContext,\n\ttype FieldChangeDecodingContext,\n\ttype FieldChangeRebaser,\n\ttype FieldEditor,\n\ttype NestedChangesIndices,\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} from \"./fieldChangeHandler.js\";\nexport type {\n\tCrossFieldKey,\n\tCrossFieldKeyRange,\n\tFieldChange,\n\tFieldChangeMap,\n\tFieldChangeset,\n\tHasFieldChanges,\n\tModularChangeset,\n\tNoChangeConstraint,\n\tNodeExistsConstraint,\n\tNodeId,\n} from \"./modularChangeTypes.js\";\nexport {\n\tconvertGenericChange,\n\tgenericChangeHandler,\n\tgenericFieldKind,\n} from \"./genericFieldKind.js\";\nexport type { 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 {\n\tModularChangeFormatVersion,\n\tmakeModularChangeCodecFamily,\n} from \"./modularChangeCodecs.js\";\nexport type {\n\tFieldKindConfiguration,\n\tFieldKindConfigurationEntry,\n} from \"./fieldKindConfiguration.js\";\nexport { DefaultRevisionReplacer } from \"./defaultRevisionReplacer.js\";\nexport { minimizeModularChangeset } from \"./minimizeModularChange.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,kBAAkB,EAClB,kCAAkC,EAClC,mBAAmB,EACnB,kBAAkB,EAClB,0BAA0B,GAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EACN,kBAAkB,EAIlB,gBAAgB,EAChB,kBAAkB,GAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,oBAAoB,GACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAyB,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAEN,gBAAgB,EAehB,+BAA+B,EAI/B,eAAe,GACf,MAAM,yBAAyB,CAAC;AAajC,OAAO,EACN,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,GAChB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACN,mBAAmB,EACnB,kBAAkB,EAIlB,8BAA8B,EAC9B,SAAS,EACT,oBAAoB,EACpB,gBAAgB,GAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,0BAA0B,EAC1B,4BAA4B,GAC5B,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC","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\tallowsMultiplicitySuperset,\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\tEncodedModularChangesetV1,\n\tEncodedNodeChangeset,\n} from \"./modularChangeFormatV1.js\";\nexport { EncodedModularChangesetV2 } from \"./modularChangeFormatV2.js\";\nexport { FlexFieldKind, type FullSchemaPolicy } from \"./fieldKind.js\";\nexport {\n\ttype ChildChangeInfo,\n\tEditFilterStatus,\n\ttype FilterDetachFunc,\n\ttype FilterAttachFunc,\n\ttype FilterAttachResult,\n\ttype FilterDetachResult,\n\ttype FieldChangeHandler,\n\ttype FieldChangeDelta,\n\ttype FieldChangeEncodingContext,\n\ttype FieldChangeDecodingContext,\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} from \"./fieldChangeHandler.js\";\nexport type {\n\tCrossFieldKey,\n\tCrossFieldKeyRange,\n\tFieldChange,\n\tFieldChangeMap,\n\tFieldChangeset,\n\tHasFieldChanges,\n\tModularChangeset,\n\tNoChangeConstraint,\n\tNodeExistsConstraint,\n\tNodeId,\n} from \"./modularChangeTypes.js\";\nexport {\n\tconvertGenericChange,\n\tgenericChangeHandler,\n\tgenericFieldKind,\n} from \"./genericFieldKind.js\";\nexport type { 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 {\n\tModularChangeFormatVersion,\n\tmakeModularChangeCodecFamily,\n} from \"./modularChangeCodecs.js\";\nexport type {\n\tFieldKindConfiguration,\n\tFieldKindConfigurationEntry,\n} from \"./fieldKindConfiguration.js\";\nexport { DefaultRevisionReplacer } from \"./defaultRevisionReplacer.js\";\nexport { minimizeModularChangeset } from \"./minimizeModularChange.js\";\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { type FieldKindIdentifier, type RevisionTag, type TaggedChange } from "../../core/index.js";
6
- import { type ModularChangeset } from "./modularChangeTypes.js";
6
+ import type { ModularChangeset } from "./modularChangeTypes.js";
7
7
  import type { FlexFieldKind } from "./fieldKind.js";
8
8
  /**
9
9
  * @param change - The change to invert.
@@ -1 +1 @@
1
- {"version":3,"file":"invert.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/invert.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAIN,KAAK,mBAAmB,EAGxB,KAAK,WAAW,EAChB,KAAK,YAAY,EAEjB,MAAM,qBAAqB,CAAC;AAO7B,OAAO,EAMN,KAAK,gBAAgB,EAGrB,MAAM,yBAAyB,CAAC;AAajC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGpD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,YAAY,CAAC,gBAAgB,CAAC,EACtC,UAAU,EAAE,OAAO,EACnB,iBAAiB,EAAE,WAAW,EAC9B,UAAU,EAAE,WAAW,CAAC,mBAAmB,EAAE,aAAa,CAAC,GACzD,gBAAgB,CA+GlB"}
1
+ {"version":3,"file":"invert.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/invert.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAIN,KAAK,mBAAmB,EAGxB,KAAK,WAAW,EAChB,KAAK,YAAY,EAEjB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,KAAK,EAIX,gBAAgB,EAGhB,MAAM,yBAAyB,CAAC;AAcjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGpD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,YAAY,CAAC,gBAAgB,CAAC,EACtC,UAAU,EAAE,OAAO,EACnB,iBAAiB,EAAE,WAAW,EAC9B,UAAU,EAAE,WAAW,CAAC,mBAAmB,EAAE,aAAa,CAAC,GACzD,gBAAgB,CAkHlB"}
@@ -5,9 +5,8 @@
5
5
  import { assert, fail } from "@fluidframework/core-utils/internal";
6
6
  import { revisionMetadataSourceFromInfo, } from "../../core/index.js";
7
7
  import { brand, idAllocatorFromMaxId } from "../../util/index.js";
8
- import { newChangeAtomIdBTree, setInChangeAtomIdMap, } from "../changeAtomIdBTree.js";
9
- import { newCrossFieldKeyTable, } from "./modularChangeTypes.js";
10
- import { CrossFieldManagerI, getChangeHandler, getRevInfoFromTaggedChanges, hasConflicts, makeModularChangeset, newConstraintState, newCrossFieldTable, updateConstraintsForFields, } from "./modularChangeUtils.js";
8
+ import { newChangeAtomIdBTree } from "../changeAtomIdBTree.js";
9
+ import { CrossFieldManagerI, getChangeHandler, getRevInfoFromTaggedChanges, hasConflicts, makeChangesetInversions, makeModularChangeset, newConstraintState, newCrossFieldTable, updateConstraintsForFields, } from "./modularChangeUtils.js";
11
10
  import { NodeAttachState } from "./fieldChangeHandler.js";
12
11
  /**
13
12
  * @param change - The change to invert.
@@ -36,7 +35,6 @@ export function invertModularChange(change, isRollback, revisionForInvert, field
36
35
  const crossFieldTable = {
37
36
  ...newCrossFieldTable(),
38
37
  originalFieldToContext: new Map(),
39
- invertedNodeToParent: brand(change.change.nodeToParent.clone()),
40
38
  };
41
39
  const { revInfos: oldRevInfos } = getRevInfoFromTaggedChanges([change]);
42
40
  const revisionMetadata = revisionMetadataSourceFromInfo(oldRevInfos);
@@ -57,13 +55,13 @@ export function invertModularChange(change, isRollback, revisionForInvert, field
57
55
  invertedField.change = brand(amendedChange);
58
56
  }
59
57
  }
60
- const crossFieldKeys = makeCrossFieldKeyTable(invertedFields, invertedNodes, fieldKinds);
58
+ const { crossFieldKeys, nodeToParent } = makeChangesetInversions(invertedFields, invertedNodes, fieldKinds);
61
59
  const constraintState = newConstraintState(0);
62
60
  updateConstraintsForFields(invertedFields, NodeAttachState.Attached, constraintState, invertedNodes, fieldKinds);
63
61
  return makeModularChangeset({
64
62
  fieldChanges: invertedFields,
65
63
  nodeChanges: invertedNodes,
66
- nodeToParent: crossFieldTable.invertedNodeToParent,
64
+ nodeToParent,
67
65
  nodeAliases: change.change.nodeAliases,
68
66
  crossFieldKeys,
69
67
  maxId: genId.getMaxId(),
@@ -117,13 +115,12 @@ function invertBuilds(builds) {
117
115
  return undefined;
118
116
  }
119
117
  class InvertManager extends CrossFieldManagerI {
118
+ fieldId;
120
119
  constructor(table, field, fieldId, allowInval = true) {
121
120
  super(table, field, allowInval);
122
121
  this.fieldId = fieldId;
123
122
  }
124
- onMoveIn(id) {
125
- setInChangeAtomIdMap(this.table.invertedNodeToParent, id, this.fieldId);
126
- }
123
+ onMoveIn(id) { }
127
124
  moveKey(target, revision, id, count) {
128
125
  fail(0x9c5 /* Keys should not be moved manually during invert */);
129
126
  }
@@ -131,25 +128,4 @@ class InvertManager extends CrossFieldManagerI {
131
128
  return this.crossFieldTable;
132
129
  }
133
130
  }
134
- function makeCrossFieldKeyTable(fields, nodes, fieldKinds) {
135
- const keys = newCrossFieldKeyTable();
136
- populateCrossFieldKeyTableForFieldMap(keys, fields, undefined, fieldKinds);
137
- nodes.forEachPair(([revision, localId], node) => {
138
- if (node.fieldChanges !== undefined) {
139
- populateCrossFieldKeyTableForFieldMap(keys, node.fieldChanges, {
140
- revision,
141
- localId,
142
- }, fieldKinds);
143
- }
144
- });
145
- return keys;
146
- }
147
- function populateCrossFieldKeyTableForFieldMap(table, fields, parent, fieldKinds) {
148
- for (const [fieldKey, fieldChange] of fields) {
149
- const keys = getChangeHandler(fieldKinds, fieldChange.fieldKind).getCrossFieldKeys(fieldChange.change);
150
- for (const { key, count } of keys) {
151
- table.set(key, count, { nodeId: parent, field: fieldKey });
152
- }
153
- }
154
- }
155
131
  //# sourceMappingURL=invert.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"invert.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/invert.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MA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AK;QAChB,OAAO,IAAI,CAAC,eAA8B,CAAC;IAC5C,CAAC;CACD;AAED,SAAS,sBAAsB,CAC9B,MAAsB,EACtB,KAAuC,EACvC,UAA2D;IAE3D,MAAM,IAAI,GAAuB,qBAAqB,EAAE,CAAC;IACzD,qCAAqC,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;IAC3E,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,EAAE;QAC/C,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YACrC,qCAAqC,CACpC,IAAI,EACJ,IAAI,CAAC,YAAY,EACjB;gBACC,QAAQ;gBACR,OAAO;aACP,EACD,UAAU,CACV,CAAC;QACH,CAAC;IACF,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACb,CAAC;AAED,SAAS,qCAAqC,CAC7C,KAAyB,EACzB,MAAsB,EACtB,MAA0B,EAC1B,UAA2D;IAE3D,KAAK,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,IAAI,MAAM,EAAE,CAAC;QAC9C,MAAM,IAAI,GAAG,gBAAgB,CAAC,UAAU,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC,iBAAiB,CACjF,WAAW,CAAC,MAAM,CAClB,CAAC;QACF,KAAK,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,IAAI,EAAE,CAAC;YACnC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC5D,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport {\n\trevisionMetadataSourceFromInfo,\n\ttype ChangeAtomId,\n\ttype ChangesetLocalId,\n\ttype FieldKindIdentifier,\n\ttype RevisionInfo,\n\ttype RevisionMetadataSource,\n\ttype RevisionTag,\n\ttype TaggedChange,\n\ttype TreeChunk,\n} from \"../../core/index.js\";\nimport { brand, idAllocatorFromMaxId, type IdAllocator } from \"../../util/index.js\";\nimport {\n\tnewChangeAtomIdBTree,\n\tsetInChangeAtomIdMap,\n\ttype ChangeAtomIdBTree,\n} from \"../changeAtomIdBTree.js\";\nimport {\n\tnewCrossFieldKeyTable,\n\ttype CrossFieldKeyTable,\n\ttype FieldChange,\n\ttype FieldChangeMap,\n\ttype FieldId,\n\ttype ModularChangeset,\n\ttype NodeChangeset,\n\ttype NodeId,\n} from \"./modularChangeTypes.js\";\nimport {\n\tCrossFieldManagerI,\n\tgetChangeHandler,\n\tgetRevInfoFromTaggedChanges,\n\thasConflicts,\n\tmakeModularChangeset,\n\tnewConstraintState,\n\tnewCrossFieldTable,\n\tupdateConstraintsForFields,\n\ttype CrossFieldTable,\n} from \"./modularChangeUtils.js\";\nimport type { CrossFieldTarget } from \"./crossFieldQueries.js\";\nimport type { FlexFieldKind } from \"./fieldKind.js\";\nimport { NodeAttachState } from \"./fieldChangeHandler.js\";\n\n/**\n * @param change - The change to invert.\n * @param isRollback - Whether the inverted change is meant to rollback a change on a branch as is the case when\n * performing a sandwich rebase.\n * @param revisionForInvert - The revision for the invert changeset.\n */\nexport function invertModularChange(\n\tchange: TaggedChange<ModularChangeset>,\n\tisRollback: boolean,\n\trevisionForInvert: RevisionTag,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): ModularChangeset {\n\t// Rollback changesets destroy the nodes created by the change being rolled back.\n\tconst destroys = isRollback ? invertBuilds(change.change.builds) : undefined;\n\n\t// Destroys only occur in rollback changesets, which are never inverted.\n\tassert(\n\t\tchange.change.destroys === undefined,\n\t\t0x89a /* Unexpected destroys in change to invert */,\n\t);\n\n\tconst revInfos: RevisionInfo[] = isRollback\n\t\t? [{ revision: revisionForInvert, rollbackOf: change.revision }]\n\t\t: [{ revision: revisionForInvert }];\n\n\tconst noChangeConstraint = change.change.noChangeConstraintOnRevert;\n\tconst noChangeConstraintOnRevert = change.change.noChangeConstraint;\n\n\tif (hasConflicts(change.change)) {\n\t\treturn makeModularChangeset({\n\t\t\tmaxId: change.change.maxId as number,\n\t\t\trevisions: revInfos,\n\t\t\tdestroys,\n\t\t});\n\t}\n\n\tconst genId: IdAllocator = idAllocatorFromMaxId(change.change.maxId ?? -1);\n\n\tconst crossFieldTable: InvertTable = {\n\t\t...newCrossFieldTable<FieldChange>(),\n\t\toriginalFieldToContext: new Map(),\n\t\tinvertedNodeToParent: brand(change.change.nodeToParent.clone()),\n\t};\n\tconst { revInfos: oldRevInfos } = getRevInfoFromTaggedChanges([change]);\n\tconst revisionMetadata = revisionMetadataSourceFromInfo(oldRevInfos);\n\n\tconst invertedFields = invertFieldMap(\n\t\tchange.change.fieldChanges,\n\t\tundefined,\n\t\tisRollback,\n\t\tgenId,\n\t\tcrossFieldTable,\n\t\trevisionMetadata,\n\t\trevisionForInvert,\n\t\tfieldKinds,\n\t);\n\n\tconst invertedNodes = newChangeAtomIdBTree<NodeChangeset>();\n\tchange.change.nodeChanges.forEachPair(([revision, localId], nodeChangeset) => {\n\t\tinvertedNodes.set(\n\t\t\t[revision, localId],\n\t\t\tinvertNodeChange(\n\t\t\t\tnodeChangeset,\n\t\t\t\t{ revision, localId },\n\t\t\t\tisRollback,\n\t\t\t\tgenId,\n\t\t\t\tcrossFieldTable,\n\t\t\t\trevisionMetadata,\n\t\t\t\trevisionForInvert,\n\t\t\t\tfieldKinds,\n\t\t\t),\n\t\t);\n\t});\n\n\tif (crossFieldTable.invalidatedFields.size > 0) {\n\t\tconst fieldsToUpdate = crossFieldTable.invalidatedFields;\n\t\tcrossFieldTable.invalidatedFields = new Set();\n\t\tfor (const fieldChange of fieldsToUpdate) {\n\t\t\tconst originalFieldChange = fieldChange.change;\n\t\t\tconst context = crossFieldTable.originalFieldToContext.get(fieldChange);\n\t\t\tassert(\n\t\t\t\tcontext !== undefined,\n\t\t\t\t0x851 /* Should have context for every invalidated field */,\n\t\t\t);\n\t\t\tconst { invertedField, fieldId } = context;\n\n\t\t\tconst amendedChange = getChangeHandler(fieldKinds, fieldChange.fieldKind).rebaser.invert(\n\t\t\t\toriginalFieldChange,\n\t\t\t\tisRollback,\n\t\t\t\tgenId,\n\t\t\t\trevisionForInvert,\n\t\t\t\tnew InvertManager(crossFieldTable, fieldChange, fieldId),\n\t\t\t\trevisionMetadata,\n\t\t\t);\n\t\t\tinvertedField.change = brand(amendedChange);\n\t\t}\n\t}\n\n\tconst crossFieldKeys = makeCrossFieldKeyTable(invertedFields, invertedNodes, fieldKinds);\n\n\tconst constraintState = newConstraintState(0);\n\tupdateConstraintsForFields(\n\t\tinvertedFields,\n\t\tNodeAttachState.Attached,\n\t\tconstraintState,\n\t\tinvertedNodes,\n\t\tfieldKinds,\n\t);\n\n\treturn makeModularChangeset({\n\t\tfieldChanges: invertedFields,\n\t\tnodeChanges: invertedNodes,\n\t\tnodeToParent: crossFieldTable.invertedNodeToParent,\n\t\tnodeAliases: change.change.nodeAliases,\n\t\tcrossFieldKeys,\n\t\tmaxId: genId.getMaxId(),\n\t\trevisions: revInfos,\n\t\tconstraintViolationCount: constraintState.violationCount,\n\t\tnoChangeConstraint,\n\t\tnoChangeConstraintOnRevert,\n\t\tdestroys,\n\t});\n}\n\nfunction invertFieldMap(\n\tchanges: FieldChangeMap,\n\tparentId: NodeId | undefined,\n\tisRollback: boolean,\n\tgenId: IdAllocator,\n\tcrossFieldTable: InvertTable,\n\trevisionMetadata: RevisionMetadataSource,\n\trevisionForInvert: RevisionTag,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): FieldChangeMap {\n\tconst invertedFields: FieldChangeMap = new Map();\n\n\tfor (const [field, fieldChange] of changes) {\n\t\tconst fieldId = { nodeId: parentId, field };\n\t\tconst manager = new InvertManager(crossFieldTable, fieldChange, fieldId);\n\t\tconst invertedChange = getChangeHandler(fieldKinds, fieldChange.fieldKind).rebaser.invert(\n\t\t\tfieldChange.change,\n\t\t\tisRollback,\n\t\t\tgenId,\n\t\t\trevisionForInvert,\n\t\t\tmanager,\n\t\t\trevisionMetadata,\n\t\t);\n\n\t\tconst invertedFieldChange: FieldChange = {\n\t\t\t...fieldChange,\n\t\t\tchange: brand(invertedChange),\n\t\t};\n\t\tinvertedFields.set(field, invertedFieldChange);\n\n\t\tcrossFieldTable.originalFieldToContext.set(fieldChange, {\n\t\t\tfieldId,\n\t\t\tinvertedField: invertedFieldChange,\n\t\t});\n\t}\n\n\treturn invertedFields;\n}\n\nfunction invertNodeChange(\n\tchange: NodeChangeset,\n\tid: NodeId,\n\tisRollback: boolean,\n\tgenId: IdAllocator,\n\tcrossFieldTable: InvertTable,\n\trevisionMetadata: RevisionMetadataSource,\n\trevisionForInvert: RevisionTag,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): NodeChangeset {\n\tconst inverse: NodeChangeset = {};\n\n\t// If the node has a constraint, it should be inverted to a node-exist-on-revert constraint. This ensure that if\n\t// the inverse is inverted again, the original input constraint will be restored.\n\tif (change.nodeExistsConstraint !== undefined) {\n\t\tinverse.nodeExistsConstraintOnRevert = change.nodeExistsConstraint;\n\t}\n\n\t// The node-exist-on-revert constraint of a node is the constraint that should apply when the a change is reverted.\n\t// So, it should become the constraint in the inverse. If this constraint is violated when applying the inverse,\n\t// it will be discarded.\n\tif (change.nodeExistsConstraintOnRevert !== undefined) {\n\t\tinverse.nodeExistsConstraint = change.nodeExistsConstraintOnRevert;\n\t}\n\n\tif (change.fieldChanges !== undefined) {\n\t\tinverse.fieldChanges = invertFieldMap(\n\t\t\tchange.fieldChanges,\n\t\t\tid,\n\t\t\tisRollback,\n\t\t\tgenId,\n\t\t\tcrossFieldTable,\n\t\t\trevisionMetadata,\n\t\t\trevisionForInvert,\n\t\t\tfieldKinds,\n\t\t);\n\t}\n\n\treturn inverse;\n}\n\nfunction invertBuilds(\n\tbuilds: ChangeAtomIdBTree<TreeChunk> | undefined,\n): ChangeAtomIdBTree<number> | undefined {\n\tif (builds !== undefined) {\n\t\treturn brand(builds.mapValues((chunk) => chunk.topLevelLength));\n\t}\n\treturn undefined;\n}\n\ninterface InvertTable extends CrossFieldTable<FieldChange> {\n\toriginalFieldToContext: Map<FieldChange, InvertContext>;\n\tinvertedNodeToParent: ChangeAtomIdBTree<FieldId>;\n}\n\ninterface InvertContext {\n\tfieldId: FieldId;\n\tinvertedField: FieldChange;\n}\n\nclass InvertManager extends CrossFieldManagerI<FieldChange> {\n\tpublic constructor(\n\t\ttable: InvertTable,\n\t\tfield: FieldChange,\n\t\tprivate readonly fieldId: FieldId,\n\t\tallowInval = true,\n\t) {\n\t\tsuper(table, field, allowInval);\n\t}\n\n\tpublic override onMoveIn(id: ChangeAtomId): void {\n\t\tsetInChangeAtomIdMap(this.table.invertedNodeToParent, id, this.fieldId);\n\t}\n\n\tpublic override moveKey(\n\t\ttarget: CrossFieldTarget,\n\t\trevision: RevisionTag | undefined,\n\t\tid: ChangesetLocalId,\n\t\tcount: number,\n\t): void {\n\t\tfail(0x9c5 /* Keys should not be moved manually during invert */);\n\t}\n\n\tprivate get table(): InvertTable {\n\t\treturn this.crossFieldTable as InvertTable;\n\t}\n}\n\nfunction makeCrossFieldKeyTable(\n\tfields: FieldChangeMap,\n\tnodes: ChangeAtomIdBTree<NodeChangeset>,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): CrossFieldKeyTable {\n\tconst keys: CrossFieldKeyTable = newCrossFieldKeyTable();\n\tpopulateCrossFieldKeyTableForFieldMap(keys, fields, undefined, fieldKinds);\n\tnodes.forEachPair(([revision, localId], node) => {\n\t\tif (node.fieldChanges !== undefined) {\n\t\t\tpopulateCrossFieldKeyTableForFieldMap(\n\t\t\t\tkeys,\n\t\t\t\tnode.fieldChanges,\n\t\t\t\t{\n\t\t\t\t\trevision,\n\t\t\t\t\tlocalId,\n\t\t\t\t},\n\t\t\t\tfieldKinds,\n\t\t\t);\n\t\t}\n\t});\n\n\treturn keys;\n}\n\nfunction populateCrossFieldKeyTableForFieldMap(\n\ttable: CrossFieldKeyTable,\n\tfields: FieldChangeMap,\n\tparent: NodeId | undefined,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): void {\n\tfor (const [fieldKey, fieldChange] of fields) {\n\t\tconst keys = getChangeHandler(fieldKinds, fieldChange.fieldKind).getCrossFieldKeys(\n\t\t\tfieldChange.change,\n\t\t);\n\t\tfor (const { key, count } of keys) {\n\t\t\ttable.set(key, count, { nodeId: parent, field: fieldKey });\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"invert.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/invert.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EACN,8BAA8B,GAS9B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAoB,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAA0B,MAAM,yBAAyB,CAAC;AASvF,OAAO,EACN,kBAAkB,EAClB,gBAAgB,EAChB,2BAA2B,EAC3B,YAAY,EACZ,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,0BAA0B,GAE1B,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAClC,MAAsC,EACtC,UAAmB,EACnB,iBAA8B,EAC9B,UAA2D;IAE3D,iFAAiF;IACjF,MAAM,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CA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kBAA+B;IAIxC;IAHlB,YACC,KAAkB,EAClB,KAAkB,EACD,OAAgB,EACjC,UAAU,GAAG,IAAI;QAEjB,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;QAHf,YAAO,GAAP,OAAO,CAAS;IAIlC,CAAC;IAEe,QAAQ,CAAC,EAAgB,IAAS,CAAC;IAEnC,OAAO,CACtB,MAAwB,EACxB,QAAiC,EACjC,EAAoB,EACpB,KAAa;QAEb,IAAI,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACnE,CAAC;IAED,IAAY,KAAK;QAChB,OAAO,IAAI,CAAC,eAA8B,CAAC;IAC5C,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport {\n\trevisionMetadataSourceFromInfo,\n\ttype ChangeAtomId,\n\ttype ChangesetLocalId,\n\ttype FieldKindIdentifier,\n\ttype RevisionInfo,\n\ttype RevisionMetadataSource,\n\ttype RevisionTag,\n\ttype TaggedChange,\n\ttype TreeChunk,\n} from \"../../core/index.js\";\nimport { brand, idAllocatorFromMaxId, type IdAllocator } from \"../../util/index.js\";\nimport { newChangeAtomIdBTree, type ChangeAtomIdBTree } from \"../changeAtomIdBTree.js\";\nimport type {\n\tFieldChange,\n\tFieldChangeMap,\n\tFieldId,\n\tModularChangeset,\n\tNodeChangeset,\n\tNodeId,\n} from \"./modularChangeTypes.js\";\nimport {\n\tCrossFieldManagerI,\n\tgetChangeHandler,\n\tgetRevInfoFromTaggedChanges,\n\thasConflicts,\n\tmakeChangesetInversions,\n\tmakeModularChangeset,\n\tnewConstraintState,\n\tnewCrossFieldTable,\n\tupdateConstraintsForFields,\n\ttype CrossFieldTable,\n} from \"./modularChangeUtils.js\";\nimport type { CrossFieldTarget } from \"./crossFieldQueries.js\";\nimport type { FlexFieldKind } from \"./fieldKind.js\";\nimport { NodeAttachState } from \"./fieldChangeHandler.js\";\n\n/**\n * @param change - The change to invert.\n * @param isRollback - Whether the inverted change is meant to rollback a change on a branch as is the case when\n * performing a sandwich rebase.\n * @param revisionForInvert - The revision for the invert changeset.\n */\nexport function invertModularChange(\n\tchange: TaggedChange<ModularChangeset>,\n\tisRollback: boolean,\n\trevisionForInvert: RevisionTag,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): ModularChangeset {\n\t// Rollback changesets destroy the nodes created by the change being rolled back.\n\tconst destroys = isRollback ? invertBuilds(change.change.builds) : undefined;\n\n\t// Destroys only occur in rollback changesets, which are never inverted.\n\tassert(\n\t\tchange.change.destroys === undefined,\n\t\t0x89a /* Unexpected destroys in change to invert */,\n\t);\n\n\tconst revInfos: RevisionInfo[] = isRollback\n\t\t? [{ revision: revisionForInvert, rollbackOf: change.revision }]\n\t\t: [{ revision: revisionForInvert }];\n\n\tconst noChangeConstraint = change.change.noChangeConstraintOnRevert;\n\tconst noChangeConstraintOnRevert = change.change.noChangeConstraint;\n\n\tif (hasConflicts(change.change)) {\n\t\treturn makeModularChangeset({\n\t\t\tmaxId: change.change.maxId as number,\n\t\t\trevisions: revInfos,\n\t\t\tdestroys,\n\t\t});\n\t}\n\n\tconst genId: IdAllocator = idAllocatorFromMaxId(change.change.maxId ?? -1);\n\n\tconst crossFieldTable: InvertTable = {\n\t\t...newCrossFieldTable<FieldChange>(),\n\t\toriginalFieldToContext: new Map(),\n\t};\n\tconst { revInfos: oldRevInfos } = getRevInfoFromTaggedChanges([change]);\n\tconst revisionMetadata = revisionMetadataSourceFromInfo(oldRevInfos);\n\n\tconst invertedFields = invertFieldMap(\n\t\tchange.change.fieldChanges,\n\t\tundefined,\n\t\tisRollback,\n\t\tgenId,\n\t\tcrossFieldTable,\n\t\trevisionMetadata,\n\t\trevisionForInvert,\n\t\tfieldKinds,\n\t);\n\n\tconst invertedNodes = newChangeAtomIdBTree<NodeChangeset>();\n\tchange.change.nodeChanges.forEachPair(([revision, localId], nodeChangeset) => {\n\t\tinvertedNodes.set(\n\t\t\t[revision, localId],\n\t\t\tinvertNodeChange(\n\t\t\t\tnodeChangeset,\n\t\t\t\t{ revision, localId },\n\t\t\t\tisRollback,\n\t\t\t\tgenId,\n\t\t\t\tcrossFieldTable,\n\t\t\t\trevisionMetadata,\n\t\t\t\trevisionForInvert,\n\t\t\t\tfieldKinds,\n\t\t\t),\n\t\t);\n\t});\n\n\tif (crossFieldTable.invalidatedFields.size > 0) {\n\t\tconst fieldsToUpdate = crossFieldTable.invalidatedFields;\n\t\tcrossFieldTable.invalidatedFields = new Set();\n\t\tfor (const fieldChange of fieldsToUpdate) {\n\t\t\tconst originalFieldChange = fieldChange.change;\n\t\t\tconst context = crossFieldTable.originalFieldToContext.get(fieldChange);\n\t\t\tassert(\n\t\t\t\tcontext !== undefined,\n\t\t\t\t0x851 /* Should have context for every invalidated field */,\n\t\t\t);\n\t\t\tconst { invertedField, fieldId } = context;\n\n\t\t\tconst amendedChange = getChangeHandler(fieldKinds, fieldChange.fieldKind).rebaser.invert(\n\t\t\t\toriginalFieldChange,\n\t\t\t\tisRollback,\n\t\t\t\tgenId,\n\t\t\t\trevisionForInvert,\n\t\t\t\tnew InvertManager(crossFieldTable, fieldChange, fieldId),\n\t\t\t\trevisionMetadata,\n\t\t\t);\n\t\t\tinvertedField.change = brand(amendedChange);\n\t\t}\n\t}\n\n\tconst { crossFieldKeys, nodeToParent } = makeChangesetInversions(\n\t\tinvertedFields,\n\t\tinvertedNodes,\n\t\tfieldKinds,\n\t);\n\n\tconst constraintState = newConstraintState(0);\n\tupdateConstraintsForFields(\n\t\tinvertedFields,\n\t\tNodeAttachState.Attached,\n\t\tconstraintState,\n\t\tinvertedNodes,\n\t\tfieldKinds,\n\t);\n\n\treturn makeModularChangeset({\n\t\tfieldChanges: invertedFields,\n\t\tnodeChanges: invertedNodes,\n\t\tnodeToParent,\n\t\tnodeAliases: change.change.nodeAliases,\n\t\tcrossFieldKeys,\n\t\tmaxId: genId.getMaxId(),\n\t\trevisions: revInfos,\n\t\tconstraintViolationCount: constraintState.violationCount,\n\t\tnoChangeConstraint,\n\t\tnoChangeConstraintOnRevert,\n\t\tdestroys,\n\t});\n}\n\nfunction invertFieldMap(\n\tchanges: FieldChangeMap,\n\tparentId: NodeId | undefined,\n\tisRollback: boolean,\n\tgenId: IdAllocator,\n\tcrossFieldTable: InvertTable,\n\trevisionMetadata: RevisionMetadataSource,\n\trevisionForInvert: RevisionTag,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): FieldChangeMap {\n\tconst invertedFields: FieldChangeMap = new Map();\n\n\tfor (const [field, fieldChange] of changes) {\n\t\tconst fieldId = { nodeId: parentId, field };\n\t\tconst manager = new InvertManager(crossFieldTable, fieldChange, fieldId);\n\t\tconst invertedChange = getChangeHandler(fieldKinds, fieldChange.fieldKind).rebaser.invert(\n\t\t\tfieldChange.change,\n\t\t\tisRollback,\n\t\t\tgenId,\n\t\t\trevisionForInvert,\n\t\t\tmanager,\n\t\t\trevisionMetadata,\n\t\t);\n\n\t\tconst invertedFieldChange: FieldChange = {\n\t\t\t...fieldChange,\n\t\t\tchange: brand(invertedChange),\n\t\t};\n\t\tinvertedFields.set(field, invertedFieldChange);\n\n\t\tcrossFieldTable.originalFieldToContext.set(fieldChange, {\n\t\t\tfieldId,\n\t\t\tinvertedField: invertedFieldChange,\n\t\t});\n\t}\n\n\treturn invertedFields;\n}\n\nfunction invertNodeChange(\n\tchange: NodeChangeset,\n\tid: NodeId,\n\tisRollback: boolean,\n\tgenId: IdAllocator,\n\tcrossFieldTable: InvertTable,\n\trevisionMetadata: RevisionMetadataSource,\n\trevisionForInvert: RevisionTag,\n\tfieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n): NodeChangeset {\n\tconst inverse: NodeChangeset = {};\n\n\t// If the node has a constraint, it should be inverted to a node-exist-on-revert constraint. This ensure that if\n\t// the inverse is inverted again, the original input constraint will be restored.\n\tif (change.nodeExistsConstraint !== undefined) {\n\t\tinverse.nodeExistsConstraintOnRevert = change.nodeExistsConstraint;\n\t}\n\n\t// The node-exist-on-revert constraint of a node is the constraint that should apply when the a change is reverted.\n\t// So, it should become the constraint in the inverse. If this constraint is violated when applying the inverse,\n\t// it will be discarded.\n\tif (change.nodeExistsConstraintOnRevert !== undefined) {\n\t\tinverse.nodeExistsConstraint = change.nodeExistsConstraintOnRevert;\n\t}\n\n\tif (change.fieldChanges !== undefined) {\n\t\tinverse.fieldChanges = invertFieldMap(\n\t\t\tchange.fieldChanges,\n\t\t\tid,\n\t\t\tisRollback,\n\t\t\tgenId,\n\t\t\tcrossFieldTable,\n\t\t\trevisionMetadata,\n\t\t\trevisionForInvert,\n\t\t\tfieldKinds,\n\t\t);\n\t}\n\n\treturn inverse;\n}\n\nfunction invertBuilds(\n\tbuilds: ChangeAtomIdBTree<TreeChunk> | undefined,\n): ChangeAtomIdBTree<number> | undefined {\n\tif (builds !== undefined) {\n\t\treturn brand(builds.mapValues((chunk) => chunk.topLevelLength));\n\t}\n\treturn undefined;\n}\n\ninterface InvertTable extends CrossFieldTable<FieldChange> {\n\toriginalFieldToContext: Map<FieldChange, InvertContext>;\n}\n\ninterface InvertContext {\n\tfieldId: FieldId;\n\tinvertedField: FieldChange;\n}\n\nclass InvertManager extends CrossFieldManagerI<FieldChange> {\n\tpublic constructor(\n\t\ttable: InvertTable,\n\t\tfield: FieldChange,\n\t\tprivate readonly fieldId: FieldId,\n\t\tallowInval = true,\n\t) {\n\t\tsuper(table, field, allowInval);\n\t}\n\n\tpublic override onMoveIn(id: ChangeAtomId): void {}\n\n\tpublic override moveKey(\n\t\ttarget: CrossFieldTarget,\n\t\trevision: RevisionTag | undefined,\n\t\tid: ChangesetLocalId,\n\t\tcount: number,\n\t): void {\n\t\tfail(0x9c5 /* Keys should not be moved manually during invert */);\n\t}\n\n\tprivate get table(): InvertTable {\n\t\treturn this.crossFieldTable as InvertTable;\n\t}\n}\n"]}
@@ -2,7 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import type { ModularChangeFamily } from "./modularChangeFamily.js";
5
+ import { type FieldKindIdentifier, type IEditableForest } from "../../core/index.js";
6
+ import type { FlexFieldKind } from "./fieldKind.js";
6
7
  import type { ModularChangeset } from "./modularChangeTypes.js";
7
8
  /**
8
9
  * "Minimizes" a {@link ModularChangeset} so that it contains no extraneous
@@ -13,12 +14,9 @@ import type { ModularChangeset } from "./modularChangeTypes.js";
13
14
  * transaction, or changes whose effects cancel out to nothing. Minimizing reduces the size of an edit without altering
14
15
  * its observable effect.
15
16
  *
16
- * This is the eventual home of the minimization algorithm, colocated with {@link ModularChangeFamily} so it can use its
17
- * internals. It is currently a no-op that returns the change unchanged; a real implementation will be provided in a
18
- * future change.
19
- *
20
17
  * @param change - The change to minimize.
21
- * @param changeFamily - The change family used to compute the change's delta and identify built nodes.
18
+ * @param fieldKinds - The field kinds used in the changeset.
19
+ * @param forestFactory - A function that returns a new forest instance.
22
20
  */
23
- export declare function minimizeModularChangeset(change: ModularChangeset, changeFamily: ModularChangeFamily): ModularChangeset;
21
+ export declare function minimizeModularChangeset(change: ModularChangeset, fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>, forestFactory: () => IEditableForest): ModularChangeset;
24
22
  //# sourceMappingURL=minimizeModularChange.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"minimizeModularChange.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/minimizeModularChange.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,CACvC,MAAM,EAAE,gBAAgB,EACxB,YAAY,EAAE,mBAAmB,GAC/B,gBAAgB,CAGlB"}
1
+ {"version":3,"file":"minimizeModularChange.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/minimizeModularChange.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAcN,KAAK,mBAAmB,EACxB,KAAK,eAAe,EAEpB,MAAM,qBAAqB,CAAC;AAsB7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAIpD,OAAO,KAAK,EAIX,gBAAgB,EAGhB,MAAM,yBAAyB,CAAC;AASjC;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CACvC,MAAM,EAAE,gBAAgB,EACxB,UAAU,EAAE,WAAW,CAAC,mBAAmB,EAAE,aAAa,CAAC,EAC3D,aAAa,EAAE,MAAM,eAAe,GAClC,gBAAgB,CAElB"}