@fluidframework/tree 2.1.1 → 2.2.1

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 (1457) hide show
  1. package/.mocharc.customBenchmarks.cjs +33 -0
  2. package/CHANGELOG.md +297 -0
  3. package/README.md +34 -4
  4. package/api-extractor.json +17 -0
  5. package/api-report/tree.alpha.api.md +119 -25
  6. package/api-report/tree.beta.api.md +51 -25
  7. package/api-report/tree.public.api.md +51 -25
  8. package/dist/beta.d.ts +3 -1
  9. package/dist/codec/discriminatedUnions.d.ts +11 -5
  10. package/dist/codec/discriminatedUnions.d.ts.map +1 -1
  11. package/dist/codec/discriminatedUnions.js.map +1 -1
  12. package/dist/codec/index.d.ts +1 -1
  13. package/dist/codec/index.d.ts.map +1 -1
  14. package/dist/codec/index.js.map +1 -1
  15. package/dist/core/forest/editableForest.d.ts +1 -5
  16. package/dist/core/forest/editableForest.d.ts.map +1 -1
  17. package/dist/core/forest/editableForest.js.map +1 -1
  18. package/dist/core/forest/forest.d.ts +0 -6
  19. package/dist/core/forest/forest.d.ts.map +1 -1
  20. package/dist/core/forest/forest.js +0 -2
  21. package/dist/core/forest/forest.js.map +1 -1
  22. package/dist/core/index.d.ts +2 -2
  23. package/dist/core/index.d.ts.map +1 -1
  24. package/dist/core/index.js +3 -4
  25. package/dist/core/index.js.map +1 -1
  26. package/dist/core/rebase/changeRebaser.d.ts +0 -4
  27. package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
  28. package/dist/core/rebase/changeRebaser.js.map +1 -1
  29. package/dist/core/rebase/index.d.ts +1 -1
  30. package/dist/core/rebase/index.d.ts.map +1 -1
  31. package/dist/core/rebase/index.js +1 -3
  32. package/dist/core/rebase/index.js.map +1 -1
  33. package/dist/core/rebase/types.d.ts +1 -8
  34. package/dist/core/rebase/types.d.ts.map +1 -1
  35. package/dist/core/rebase/types.js +1 -9
  36. package/dist/core/rebase/types.js.map +1 -1
  37. package/dist/core/rebase/utils.d.ts +0 -1
  38. package/dist/core/rebase/utils.d.ts.map +1 -1
  39. package/dist/core/rebase/utils.js +12 -7
  40. package/dist/core/rebase/utils.js.map +1 -1
  41. package/dist/core/schema-stored/multiplicity.d.ts +0 -1
  42. package/dist/core/schema-stored/multiplicity.d.ts.map +1 -1
  43. package/dist/core/schema-stored/multiplicity.js +0 -1
  44. package/dist/core/schema-stored/multiplicity.js.map +1 -1
  45. package/dist/core/schema-stored/schema.d.ts +0 -7
  46. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  47. package/dist/core/schema-stored/schema.js +0 -4
  48. package/dist/core/schema-stored/schema.js.map +1 -1
  49. package/dist/core/schema-stored/storedSchemaRepository.d.ts +0 -3
  50. package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  51. package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
  52. package/dist/core/schema-view/view.d.ts +0 -3
  53. package/dist/core/schema-view/view.d.ts.map +1 -1
  54. package/dist/core/schema-view/view.js +0 -1
  55. package/dist/core/schema-view/view.js.map +1 -1
  56. package/dist/core/tree/anchorSet.d.ts +0 -10
  57. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  58. package/dist/core/tree/anchorSet.js +1 -4
  59. package/dist/core/tree/anchorSet.js.map +1 -1
  60. package/dist/core/tree/cursor.d.ts +1 -6
  61. package/dist/core/tree/cursor.d.ts.map +1 -1
  62. package/dist/core/tree/cursor.js +0 -2
  63. package/dist/core/tree/cursor.js.map +1 -1
  64. package/dist/core/tree/delta.d.ts +0 -11
  65. package/dist/core/tree/delta.d.ts.map +1 -1
  66. package/dist/core/tree/delta.js.map +1 -1
  67. package/dist/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  68. package/dist/core/tree/detachedFieldIndexCodec.js +3 -2
  69. package/dist/core/tree/detachedFieldIndexCodec.js.map +1 -1
  70. package/dist/core/tree/detachedFieldIndexTypes.d.ts +0 -1
  71. package/dist/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
  72. package/dist/core/tree/detachedFieldIndexTypes.js.map +1 -1
  73. package/dist/core/tree/index.d.ts +1 -1
  74. package/dist/core/tree/index.d.ts.map +1 -1
  75. package/dist/core/tree/index.js +3 -1
  76. package/dist/core/tree/index.js.map +1 -1
  77. package/dist/core/tree/mapTree.d.ts +20 -4
  78. package/dist/core/tree/mapTree.d.ts.map +1 -1
  79. package/dist/core/tree/mapTree.js +29 -0
  80. package/dist/core/tree/mapTree.js.map +1 -1
  81. package/dist/core/tree/pathTree.d.ts +0 -11
  82. package/dist/core/tree/pathTree.d.ts.map +1 -1
  83. package/dist/core/tree/pathTree.js.map +1 -1
  84. package/dist/core/tree/treeTextFormat.d.ts.map +1 -1
  85. package/dist/core/tree/treeTextFormat.js +3 -2
  86. package/dist/core/tree/treeTextFormat.js.map +1 -1
  87. package/dist/core/tree/types.d.ts +0 -11
  88. package/dist/core/tree/types.d.ts.map +1 -1
  89. package/dist/core/tree/types.js +0 -4
  90. package/dist/core/tree/types.js.map +1 -1
  91. package/dist/core/tree/visitDelta.d.ts +0 -1
  92. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  93. package/dist/core/tree/visitDelta.js +2 -2
  94. package/dist/core/tree/visitDelta.js.map +1 -1
  95. package/dist/core/tree/visitPath.d.ts +0 -2
  96. package/dist/core/tree/visitPath.d.ts.map +1 -1
  97. package/dist/core/tree/visitPath.js.map +1 -1
  98. package/dist/core/tree/visitorUtils.d.ts +0 -1
  99. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  100. package/dist/core/tree/visitorUtils.js.map +1 -1
  101. package/dist/domains/index.d.ts +1 -1
  102. package/dist/domains/index.d.ts.map +1 -1
  103. package/dist/domains/index.js +2 -1
  104. package/dist/domains/index.js.map +1 -1
  105. package/dist/domains/json/index.d.ts +1 -1
  106. package/dist/domains/json/index.d.ts.map +1 -1
  107. package/dist/domains/json/index.js +2 -1
  108. package/dist/domains/json/index.js.map +1 -1
  109. package/dist/domains/json/jsonCursor.d.ts +36 -2
  110. package/dist/domains/json/jsonCursor.d.ts.map +1 -1
  111. package/dist/domains/json/jsonCursor.js +76 -5
  112. package/dist/domains/json/jsonCursor.js.map +1 -1
  113. package/dist/domains/json/jsonDomainSchema.d.ts +13 -3
  114. package/dist/domains/json/jsonDomainSchema.d.ts.map +1 -1
  115. package/dist/domains/json/jsonDomainSchema.js +12 -4
  116. package/dist/domains/json/jsonDomainSchema.js.map +1 -1
  117. package/dist/domains/leafDomain.d.ts +0 -1
  118. package/dist/domains/leafDomain.d.ts.map +1 -1
  119. package/dist/domains/leafDomain.js +0 -1
  120. package/dist/domains/leafDomain.js.map +1 -1
  121. package/dist/domains/schemaBuilder.d.ts +1 -7
  122. package/dist/domains/schemaBuilder.d.ts.map +1 -1
  123. package/dist/domains/schemaBuilder.js +0 -10
  124. package/dist/domains/schemaBuilder.js.map +1 -1
  125. package/dist/events/events.d.ts +0 -4
  126. package/dist/events/events.d.ts.map +1 -1
  127. package/dist/events/events.js +0 -1
  128. package/dist/events/events.js.map +1 -1
  129. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  130. package/dist/feature-libraries/chunked-forest/basicChunk.js +8 -3
  131. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  132. package/dist/feature-libraries/chunked-forest/chunk.d.ts +1 -1
  133. package/dist/feature-libraries/chunked-forest/chunk.d.ts.map +1 -1
  134. package/dist/feature-libraries/chunked-forest/chunk.js.map +1 -1
  135. package/dist/feature-libraries/chunked-forest/chunkTree.js +3 -3
  136. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  137. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  138. package/dist/feature-libraries/chunked-forest/chunkedForest.js +7 -5
  139. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  140. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +1 -1
  141. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  142. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  143. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +8 -5
  144. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  145. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  146. package/dist/feature-libraries/chunked-forest/uniformChunk.js +5 -3
  147. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  148. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -24
  149. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  150. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +9 -19
  151. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  152. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +0 -6
  153. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  154. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +11 -1
  155. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  156. package/dist/feature-libraries/default-schema/defaultSchema.d.ts +0 -1
  157. package/dist/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
  158. package/dist/feature-libraries/default-schema/defaultSchema.js +0 -1
  159. package/dist/feature-libraries/default-schema/defaultSchema.js.map +1 -1
  160. package/dist/feature-libraries/default-schema/index.d.ts +1 -1
  161. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  162. package/dist/feature-libraries/default-schema/index.js +2 -1
  163. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  164. package/dist/feature-libraries/default-schema/schemaChecker.d.ts +6 -0
  165. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  166. package/dist/feature-libraries/default-schema/schemaChecker.js +6 -0
  167. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  168. package/dist/feature-libraries/editableTreeBinder.d.ts +0 -67
  169. package/dist/feature-libraries/editableTreeBinder.d.ts.map +1 -1
  170. package/dist/feature-libraries/editableTreeBinder.js +5 -24
  171. package/dist/feature-libraries/editableTreeBinder.js.map +1 -1
  172. package/dist/feature-libraries/fieldGenerator.d.ts +0 -3
  173. package/dist/feature-libraries/fieldGenerator.d.ts.map +1 -1
  174. package/dist/feature-libraries/fieldGenerator.js +0 -1
  175. package/dist/feature-libraries/fieldGenerator.js.map +1 -1
  176. package/dist/feature-libraries/flex-map-tree/index.d.ts +1 -1
  177. package/dist/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  178. package/dist/feature-libraries/flex-map-tree/index.js +2 -2
  179. package/dist/feature-libraries/flex-map-tree/index.js.map +1 -1
  180. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +57 -49
  181. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  182. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js +171 -168
  183. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  184. package/dist/feature-libraries/flex-tree/context.d.ts +0 -1
  185. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  186. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  187. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +17 -282
  188. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  189. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +0 -4
  190. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  191. package/dist/feature-libraries/flex-tree/index.d.ts +1 -1
  192. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  193. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  194. package/dist/feature-libraries/flex-tree/lazyField.d.ts +9 -26
  195. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  196. package/dist/feature-libraries/flex-tree/lazyField.js +26 -99
  197. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  198. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +2 -10
  199. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  200. package/dist/feature-libraries/flex-tree/lazyNode.js +3 -42
  201. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  202. package/dist/feature-libraries/flex-tree/treeEvents.d.ts +0 -2
  203. package/dist/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
  204. package/dist/feature-libraries/flex-tree/treeEvents.js.map +1 -1
  205. package/dist/feature-libraries/flex-tree/utilities.d.ts +2 -1
  206. package/dist/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  207. package/dist/feature-libraries/flex-tree/utilities.js +4 -0
  208. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  209. package/dist/feature-libraries/forest-summary/codec.js +2 -2
  210. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  211. package/dist/feature-libraries/index.d.ts +6 -8
  212. package/dist/feature-libraries/index.d.ts.map +1 -1
  213. package/dist/feature-libraries/index.js +7 -18
  214. package/dist/feature-libraries/index.js.map +1 -1
  215. package/dist/feature-libraries/mapTreeCursor.d.ts +6 -2
  216. package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  217. package/dist/feature-libraries/mapTreeCursor.js +9 -1
  218. package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
  219. package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -4
  220. package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts.map +1 -1
  221. package/dist/feature-libraries/memoizedIdRangeAllocator.js +0 -1
  222. package/dist/feature-libraries/memoizedIdRangeAllocator.js.map +1 -1
  223. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +0 -2
  224. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  225. package/dist/feature-libraries/modular-schema/crossFieldQueries.js +0 -1
  226. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  227. package/dist/feature-libraries/modular-schema/discrepancies.d.ts +18 -0
  228. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  229. package/dist/feature-libraries/modular-schema/discrepancies.js +105 -2
  230. package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  231. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +0 -8
  232. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  233. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js +0 -1
  234. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  235. package/dist/feature-libraries/modular-schema/fieldKind.d.ts +1 -3
  236. package/dist/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  237. package/dist/feature-libraries/modular-schema/fieldKind.js +1 -2
  238. package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  239. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +1 -2
  240. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  241. package/dist/feature-libraries/modular-schema/genericFieldKind.js +57 -85
  242. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  243. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts +1 -1
  244. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
  245. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js +5 -8
  246. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  247. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.d.ts +3 -14
  248. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.d.ts.map +1 -1
  249. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js +6 -0
  250. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
  251. package/dist/feature-libraries/modular-schema/index.d.ts +2 -2
  252. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  253. package/dist/feature-libraries/modular-schema/index.js +2 -1
  254. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  255. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  256. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +39 -22
  257. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  258. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +9 -8
  259. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  260. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +192 -228
  261. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  262. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +8 -14
  263. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  264. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  265. package/dist/feature-libraries/node-key/nodeKey.d.ts +0 -4
  266. package/dist/feature-libraries/node-key/nodeKey.d.ts.map +1 -1
  267. package/dist/feature-libraries/node-key/nodeKey.js +0 -2
  268. package/dist/feature-libraries/node-key/nodeKey.js.map +1 -1
  269. package/dist/feature-libraries/node-key/nodeKeyManager.d.ts +0 -1
  270. package/dist/feature-libraries/node-key/nodeKeyManager.d.ts.map +1 -1
  271. package/dist/feature-libraries/node-key/nodeKeyManager.js.map +1 -1
  272. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  273. package/dist/feature-libraries/object-forest/objectForest.js +1 -10
  274. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  275. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
  276. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  277. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
  278. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  279. package/dist/feature-libraries/schemaBuilderBase.d.ts +2 -28
  280. package/dist/feature-libraries/schemaBuilderBase.d.ts.map +1 -1
  281. package/dist/feature-libraries/schemaBuilderBase.js +1 -27
  282. package/dist/feature-libraries/schemaBuilderBase.js.map +1 -1
  283. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  284. package/dist/feature-libraries/sequence-field/compose.js +24 -21
  285. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  286. package/dist/feature-libraries/sequence-field/formatV2.d.ts +3 -3
  287. package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  288. package/dist/feature-libraries/sequence-field/formatV2.js +7 -6
  289. package/dist/feature-libraries/sequence-field/formatV2.js.map +1 -1
  290. package/dist/feature-libraries/sequence-field/formatV3.d.ts +195 -0
  291. package/dist/feature-libraries/sequence-field/formatV3.d.ts.map +1 -0
  292. package/dist/feature-libraries/sequence-field/formatV3.js +23 -0
  293. package/dist/feature-libraries/sequence-field/formatV3.js.map +1 -0
  294. package/dist/feature-libraries/sequence-field/helperTypes.d.ts +11 -0
  295. package/dist/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  296. package/dist/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  297. package/dist/feature-libraries/sequence-field/index.d.ts +1 -1
  298. package/dist/feature-libraries/sequence-field/index.d.ts.map +1 -1
  299. package/dist/feature-libraries/sequence-field/index.js.map +1 -1
  300. package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  301. package/dist/feature-libraries/sequence-field/invert.js +21 -13
  302. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  303. package/dist/feature-libraries/sequence-field/markQueue.js +1 -1
  304. package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
  305. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +2 -2
  306. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  307. package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  308. package/dist/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  309. package/dist/feature-libraries/sequence-field/rebase.js +24 -6
  310. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  311. package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  312. package/dist/feature-libraries/sequence-field/replaceRevisions.js +16 -3
  313. package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  314. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  315. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +38 -4
  316. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  317. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -1
  318. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  319. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +54 -9
  320. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  321. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +11 -0
  322. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -0
  323. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +85 -0
  324. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -0
  325. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  326. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js +2 -0
  327. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  328. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  329. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +4 -1
  330. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  331. package/dist/feature-libraries/sequence-field/types.d.ts +23 -4
  332. package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
  333. package/dist/feature-libraries/sequence-field/types.js.map +1 -1
  334. package/dist/feature-libraries/sequence-field/utils.d.ts +5 -4
  335. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  336. package/dist/feature-libraries/sequence-field/utils.js +70 -42
  337. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  338. package/dist/feature-libraries/storedToViewSchema.d.ts +0 -1
  339. package/dist/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  340. package/dist/feature-libraries/storedToViewSchema.js +0 -1
  341. package/dist/feature-libraries/storedToViewSchema.js.map +1 -1
  342. package/dist/feature-libraries/treeCursorUtils.d.ts +0 -6
  343. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  344. package/dist/feature-libraries/treeCursorUtils.js +8 -6
  345. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  346. package/dist/feature-libraries/treeTextCursor.d.ts +0 -2
  347. package/dist/feature-libraries/treeTextCursor.d.ts.map +1 -1
  348. package/dist/feature-libraries/treeTextCursor.js +0 -2
  349. package/dist/feature-libraries/treeTextCursor.js.map +1 -1
  350. package/dist/feature-libraries/typed-schema/flexList.d.ts +0 -3
  351. package/dist/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
  352. package/dist/feature-libraries/typed-schema/flexList.js.map +1 -1
  353. package/dist/feature-libraries/typed-schema/index.d.ts +1 -1
  354. package/dist/feature-libraries/typed-schema/index.d.ts.map +1 -1
  355. package/dist/feature-libraries/typed-schema/index.js +1 -3
  356. package/dist/feature-libraries/typed-schema/index.js.map +1 -1
  357. package/dist/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  358. package/dist/feature-libraries/typed-schema/schemaCollection.js +0 -4
  359. package/dist/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  360. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +2 -41
  361. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  362. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +1 -40
  363. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  364. package/dist/feature-libraries/typed-schema/view.d.ts +0 -1
  365. package/dist/feature-libraries/typed-schema/view.d.ts.map +1 -1
  366. package/dist/feature-libraries/typed-schema/view.js.map +1 -1
  367. package/dist/index.d.ts +8 -9
  368. package/dist/index.d.ts.map +1 -1
  369. package/dist/index.js +31 -90
  370. package/dist/index.js.map +1 -1
  371. package/dist/internalTypes.d.ts +1 -1
  372. package/dist/internalTypes.d.ts.map +1 -1
  373. package/dist/internalTypes.js.map +1 -1
  374. package/dist/packageVersion.d.ts +1 -1
  375. package/dist/packageVersion.js +1 -1
  376. package/dist/packageVersion.js.map +1 -1
  377. package/dist/public.d.ts +3 -1
  378. package/dist/shared-tree/schematizeTree.d.ts +2 -11
  379. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  380. package/dist/shared-tree/schematizeTree.js +13 -2
  381. package/dist/shared-tree/schematizeTree.js.map +1 -1
  382. package/dist/shared-tree/schematizingTreeView.d.ts +4 -4
  383. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  384. package/dist/shared-tree/schematizingTreeView.js +2 -2
  385. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  386. package/dist/shared-tree/sharedTree.d.ts +4 -17
  387. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  388. package/dist/shared-tree/sharedTree.js +4 -8
  389. package/dist/shared-tree/sharedTree.js.map +1 -1
  390. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  391. package/dist/shared-tree/sharedTreeChangeCodecs.js +4 -0
  392. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  393. package/dist/shared-tree/sharedTreeChangeFamily.js +2 -2
  394. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  395. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +0 -2
  396. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  397. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  398. package/dist/shared-tree/treeApi.js +2 -2
  399. package/dist/shared-tree/treeApi.js.map +1 -1
  400. package/dist/shared-tree/treeCheckout.d.ts +0 -5
  401. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  402. package/dist/shared-tree/treeCheckout.js +5 -3
  403. package/dist/shared-tree/treeCheckout.js.map +1 -1
  404. package/dist/shared-tree/treeView.d.ts +3 -6
  405. package/dist/shared-tree/treeView.d.ts.map +1 -1
  406. package/dist/shared-tree/treeView.js.map +1 -1
  407. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  408. package/dist/shared-tree-core/branch.js +11 -6
  409. package/dist/shared-tree-core/branch.js.map +1 -1
  410. package/dist/shared-tree-core/defaultResubmitMachine.js +3 -3
  411. package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  412. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  413. package/dist/shared-tree-core/editManagerCodecs.js +1 -0
  414. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  415. package/dist/shared-tree-core/editManagerFormat.d.ts +2 -2
  416. package/dist/shared-tree-core/editManagerFormat.d.ts.map +1 -1
  417. package/dist/shared-tree-core/editManagerFormat.js +6 -1
  418. package/dist/shared-tree-core/editManagerFormat.js.map +1 -1
  419. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  420. package/dist/shared-tree-core/messageCodecs.js +1 -0
  421. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  422. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  423. package/dist/shared-tree-core/sharedTreeCore.js +3 -1
  424. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  425. package/dist/simple-tree/api/create.d.ts +54 -0
  426. package/dist/simple-tree/api/create.d.ts.map +1 -0
  427. package/dist/simple-tree/api/create.js +99 -0
  428. package/dist/simple-tree/api/create.js.map +1 -0
  429. package/dist/simple-tree/api/index.d.ts +12 -0
  430. package/dist/simple-tree/api/index.d.ts.map +1 -0
  431. package/dist/simple-tree/api/index.js +28 -0
  432. package/dist/simple-tree/api/index.js.map +1 -0
  433. package/{lib/simple-tree → dist/simple-tree/api}/schemaCreationUtilities.d.ts +7 -4
  434. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -0
  435. package/dist/simple-tree/{schemaCreationUtilities.js → api/schemaCreationUtilities.js} +1 -1
  436. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -0
  437. package/dist/simple-tree/{schemaFactory.d.ts → api/schemaFactory.d.ts} +15 -14
  438. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -0
  439. package/dist/simple-tree/{schemaFactory.js → api/schemaFactory.js} +10 -9
  440. package/dist/simple-tree/api/schemaFactory.js.map +1 -0
  441. package/{lib/simple-tree → dist/simple-tree/api}/schemaFactoryRecursive.d.ts +40 -7
  442. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -0
  443. package/dist/simple-tree/{schemaFactoryRecursive.js → api/schemaFactoryRecursive.js} +1 -1
  444. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -0
  445. package/dist/simple-tree/api/testRecursiveDomain.d.ts +62 -0
  446. package/dist/simple-tree/api/testRecursiveDomain.d.ts.map +1 -0
  447. package/dist/simple-tree/api/testRecursiveDomain.js.map +1 -0
  448. package/{lib/simple-tree → dist/simple-tree/api}/tree.d.ts +111 -20
  449. package/dist/simple-tree/api/tree.d.ts.map +1 -0
  450. package/dist/simple-tree/api/tree.js +173 -0
  451. package/dist/simple-tree/api/tree.js.map +1 -0
  452. package/dist/simple-tree/{treeNodeApi.d.ts → api/treeNodeApi.d.ts} +6 -5
  453. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -0
  454. package/dist/simple-tree/{treeNodeApi.js → api/treeNodeApi.js} +28 -20
  455. package/dist/simple-tree/api/treeNodeApi.js.map +1 -0
  456. package/dist/simple-tree/api/verboseTree.d.ts +136 -0
  457. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -0
  458. package/dist/simple-tree/api/verboseTree.js +220 -0
  459. package/dist/simple-tree/api/verboseTree.js.map +1 -0
  460. package/dist/simple-tree/arrayNode.d.ts +3 -3
  461. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  462. package/dist/simple-tree/arrayNode.js +70 -69
  463. package/dist/simple-tree/arrayNode.js.map +1 -1
  464. package/dist/simple-tree/core/index.d.ts +10 -0
  465. package/dist/simple-tree/core/index.d.ts.map +1 -0
  466. package/dist/simple-tree/core/index.js +27 -0
  467. package/dist/simple-tree/core/index.js.map +1 -0
  468. package/{lib/simple-tree → dist/simple-tree/core}/schemaCaching.d.ts +2 -9
  469. package/dist/simple-tree/core/schemaCaching.d.ts.map +1 -0
  470. package/dist/simple-tree/{schemaCaching.js → core/schemaCaching.js} +2 -23
  471. package/dist/simple-tree/core/schemaCaching.js.map +1 -0
  472. package/dist/simple-tree/core/treeNodeKernel.d.ts +57 -0
  473. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -0
  474. package/dist/simple-tree/{treeNodeKernel.js → core/treeNodeKernel.js} +49 -4
  475. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -0
  476. package/dist/simple-tree/core/treeNodeSchema.d.ts +149 -0
  477. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -0
  478. package/dist/simple-tree/core/treeNodeSchema.js +35 -0
  479. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -0
  480. package/dist/simple-tree/{types.d.ts → core/types.d.ts} +23 -70
  481. package/dist/simple-tree/core/types.d.ts.map +1 -0
  482. package/dist/simple-tree/core/types.js +117 -0
  483. package/dist/simple-tree/core/types.js.map +1 -0
  484. package/dist/simple-tree/core/withType.d.ts +82 -0
  485. package/dist/simple-tree/core/withType.d.ts.map +1 -0
  486. package/dist/simple-tree/core/withType.js +39 -0
  487. package/dist/simple-tree/core/withType.js.map +1 -0
  488. package/dist/simple-tree/getJsonSchema.d.ts +55 -0
  489. package/dist/simple-tree/getJsonSchema.d.ts.map +1 -0
  490. package/dist/simple-tree/getJsonSchema.js +69 -0
  491. package/dist/simple-tree/getJsonSchema.js.map +1 -0
  492. package/dist/simple-tree/getSimpleFieldSchema.d.ts +14 -0
  493. package/dist/simple-tree/getSimpleFieldSchema.d.ts.map +1 -0
  494. package/dist/simple-tree/getSimpleFieldSchema.js +29 -0
  495. package/dist/simple-tree/getSimpleFieldSchema.js.map +1 -0
  496. package/dist/simple-tree/getSimpleSchema.d.ts +58 -0
  497. package/dist/simple-tree/getSimpleSchema.d.ts.map +1 -0
  498. package/dist/simple-tree/getSimpleSchema.js +68 -0
  499. package/dist/simple-tree/getSimpleSchema.js.map +1 -0
  500. package/dist/simple-tree/index.d.ts +12 -13
  501. package/dist/simple-tree/index.d.ts.map +1 -1
  502. package/dist/simple-tree/index.js +26 -23
  503. package/dist/simple-tree/index.js.map +1 -1
  504. package/dist/simple-tree/jsonSchema.d.ts +206 -0
  505. package/dist/simple-tree/jsonSchema.d.ts.map +1 -0
  506. package/dist/{feature-libraries/schema-aware/index.js → simple-tree/jsonSchema.js} +1 -1
  507. package/dist/simple-tree/jsonSchema.js.map +1 -0
  508. package/dist/simple-tree/leafNodeSchema.d.ts +1 -1
  509. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  510. package/dist/simple-tree/leafNodeSchema.js +3 -4
  511. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  512. package/dist/simple-tree/mapNode.d.ts +9 -3
  513. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  514. package/dist/simple-tree/mapNode.js +33 -35
  515. package/dist/simple-tree/mapNode.js.map +1 -1
  516. package/dist/simple-tree/objectNode.d.ts +18 -16
  517. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  518. package/dist/simple-tree/objectNode.js +43 -44
  519. package/dist/simple-tree/objectNode.js.map +1 -1
  520. package/dist/simple-tree/objectNodeTypes.d.ts +38 -0
  521. package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -0
  522. package/dist/simple-tree/objectNodeTypes.js +19 -0
  523. package/dist/simple-tree/objectNodeTypes.js.map +1 -0
  524. package/dist/simple-tree/proxies.d.ts +6 -25
  525. package/dist/simple-tree/proxies.d.ts.map +1 -1
  526. package/dist/simple-tree/proxies.js +50 -63
  527. package/dist/simple-tree/proxies.js.map +1 -1
  528. package/dist/simple-tree/proxyBinding.d.ts +45 -22
  529. package/dist/simple-tree/proxyBinding.d.ts.map +1 -1
  530. package/dist/simple-tree/proxyBinding.js +94 -59
  531. package/dist/simple-tree/proxyBinding.js.map +1 -1
  532. package/dist/simple-tree/schemaTypes.d.ts +10 -159
  533. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  534. package/dist/simple-tree/schemaTypes.js +11 -42
  535. package/dist/simple-tree/schemaTypes.js.map +1 -1
  536. package/dist/simple-tree/simpleSchema.d.ts +124 -0
  537. package/dist/simple-tree/simpleSchema.d.ts.map +1 -0
  538. package/dist/{feature-libraries/schema-aware/schemaAware.js → simple-tree/simpleSchema.js} +1 -1
  539. package/dist/simple-tree/simpleSchema.js.map +1 -0
  540. package/dist/simple-tree/simpleSchemaToJsonSchema.d.ts +12 -0
  541. package/dist/simple-tree/simpleSchemaToJsonSchema.d.ts.map +1 -0
  542. package/dist/simple-tree/simpleSchemaToJsonSchema.js +146 -0
  543. package/dist/simple-tree/simpleSchemaToJsonSchema.js.map +1 -0
  544. package/dist/simple-tree/toFlexSchema.d.ts +4 -12
  545. package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
  546. package/dist/simple-tree/toFlexSchema.js +42 -52
  547. package/dist/simple-tree/toFlexSchema.js.map +1 -1
  548. package/dist/simple-tree/toMapTree.d.ts +39 -39
  549. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  550. package/dist/simple-tree/toMapTree.js +227 -171
  551. package/dist/simple-tree/toMapTree.js.map +1 -1
  552. package/dist/simple-tree/treeNodeValid.d.ts +74 -0
  553. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -0
  554. package/dist/simple-tree/{types.js → treeNodeValid.js} +18 -111
  555. package/dist/simple-tree/treeNodeValid.js.map +1 -0
  556. package/dist/simple-tree/typesUnsafe.d.ts +35 -4
  557. package/dist/simple-tree/typesUnsafe.d.ts.map +1 -1
  558. package/dist/simple-tree/typesUnsafe.js.map +1 -1
  559. package/dist/simple-tree/viewSchemaToSimpleSchema.d.ts +11 -0
  560. package/dist/simple-tree/viewSchemaToSimpleSchema.d.ts.map +1 -0
  561. package/dist/simple-tree/viewSchemaToSimpleSchema.js +171 -0
  562. package/dist/simple-tree/viewSchemaToSimpleSchema.js.map +1 -0
  563. package/dist/util/brand.d.ts +0 -3
  564. package/dist/util/brand.d.ts.map +1 -1
  565. package/dist/util/brand.js +1 -2
  566. package/dist/util/brand.js.map +1 -1
  567. package/dist/util/brandedMap.d.ts +0 -5
  568. package/dist/util/brandedMap.d.ts.map +1 -1
  569. package/dist/util/brandedMap.js +0 -1
  570. package/dist/util/brandedMap.js.map +1 -1
  571. package/dist/util/idAllocator.d.ts +0 -2
  572. package/dist/util/idAllocator.d.ts.map +1 -1
  573. package/dist/util/idAllocator.js +0 -1
  574. package/dist/util/idAllocator.js.map +1 -1
  575. package/dist/util/index.d.ts +2 -2
  576. package/dist/util/index.d.ts.map +1 -1
  577. package/dist/util/index.js +4 -2
  578. package/dist/util/index.js.map +1 -1
  579. package/dist/util/nestedMap.d.ts +5 -19
  580. package/dist/util/nestedMap.d.ts.map +1 -1
  581. package/dist/util/nestedMap.js +17 -17
  582. package/dist/util/nestedMap.js.map +1 -1
  583. package/dist/util/opaque.d.ts +0 -4
  584. package/dist/util/opaque.d.ts.map +1 -1
  585. package/dist/util/opaque.js +0 -2
  586. package/dist/util/opaque.js.map +1 -1
  587. package/dist/util/rangeMap.d.ts +0 -2
  588. package/dist/util/rangeMap.d.ts.map +1 -1
  589. package/dist/util/rangeMap.js +4 -3
  590. package/dist/util/rangeMap.js.map +1 -1
  591. package/dist/util/transactionResult.d.ts +0 -1
  592. package/dist/util/transactionResult.d.ts.map +1 -1
  593. package/dist/util/transactionResult.js +0 -1
  594. package/dist/util/transactionResult.js.map +1 -1
  595. package/dist/util/typeCheck.d.ts +2 -20
  596. package/dist/util/typeCheck.d.ts.map +1 -1
  597. package/dist/util/typeCheck.js.map +1 -1
  598. package/dist/util/typeCheckTests.d.ts +4 -4
  599. package/dist/util/typeCheckTests.d.ts.map +1 -1
  600. package/dist/util/typeCheckTests.js.map +1 -1
  601. package/dist/util/typeUtils.d.ts +0 -7
  602. package/dist/util/typeUtils.d.ts.map +1 -1
  603. package/dist/util/typeUtils.js.map +1 -1
  604. package/dist/util/utils.d.ts +6 -8
  605. package/dist/util/utils.d.ts.map +1 -1
  606. package/dist/util/utils.js +14 -5
  607. package/dist/util/utils.js.map +1 -1
  608. package/lib/beta.d.ts +3 -1
  609. package/lib/codec/discriminatedUnions.d.ts +11 -5
  610. package/lib/codec/discriminatedUnions.d.ts.map +1 -1
  611. package/lib/codec/discriminatedUnions.js.map +1 -1
  612. package/lib/codec/index.d.ts +1 -1
  613. package/lib/codec/index.d.ts.map +1 -1
  614. package/lib/codec/index.js +1 -1
  615. package/lib/codec/index.js.map +1 -1
  616. package/lib/core/forest/editableForest.d.ts +1 -5
  617. package/lib/core/forest/editableForest.d.ts.map +1 -1
  618. package/lib/core/forest/editableForest.js.map +1 -1
  619. package/lib/core/forest/forest.d.ts +0 -6
  620. package/lib/core/forest/forest.d.ts.map +1 -1
  621. package/lib/core/forest/forest.js +0 -2
  622. package/lib/core/forest/forest.js.map +1 -1
  623. package/lib/core/index.d.ts +2 -2
  624. package/lib/core/index.d.ts.map +1 -1
  625. package/lib/core/index.js +2 -2
  626. package/lib/core/index.js.map +1 -1
  627. package/lib/core/rebase/changeRebaser.d.ts +0 -4
  628. package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
  629. package/lib/core/rebase/changeRebaser.js.map +1 -1
  630. package/lib/core/rebase/index.d.ts +1 -1
  631. package/lib/core/rebase/index.d.ts.map +1 -1
  632. package/lib/core/rebase/index.js +1 -1
  633. package/lib/core/rebase/index.js.map +1 -1
  634. package/lib/core/rebase/types.d.ts +1 -8
  635. package/lib/core/rebase/types.d.ts.map +1 -1
  636. package/lib/core/rebase/types.js +1 -7
  637. package/lib/core/rebase/types.js.map +1 -1
  638. package/lib/core/rebase/utils.d.ts +0 -1
  639. package/lib/core/rebase/utils.d.ts.map +1 -1
  640. package/lib/core/rebase/utils.js +13 -8
  641. package/lib/core/rebase/utils.js.map +1 -1
  642. package/lib/core/schema-stored/multiplicity.d.ts +0 -1
  643. package/lib/core/schema-stored/multiplicity.d.ts.map +1 -1
  644. package/lib/core/schema-stored/multiplicity.js +0 -1
  645. package/lib/core/schema-stored/multiplicity.js.map +1 -1
  646. package/lib/core/schema-stored/schema.d.ts +0 -7
  647. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  648. package/lib/core/schema-stored/schema.js +0 -4
  649. package/lib/core/schema-stored/schema.js.map +1 -1
  650. package/lib/core/schema-stored/storedSchemaRepository.d.ts +0 -3
  651. package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  652. package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
  653. package/lib/core/schema-view/view.d.ts +0 -3
  654. package/lib/core/schema-view/view.d.ts.map +1 -1
  655. package/lib/core/schema-view/view.js +0 -1
  656. package/lib/core/schema-view/view.js.map +1 -1
  657. package/lib/core/tree/anchorSet.d.ts +0 -10
  658. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  659. package/lib/core/tree/anchorSet.js +1 -4
  660. package/lib/core/tree/anchorSet.js.map +1 -1
  661. package/lib/core/tree/cursor.d.ts +1 -6
  662. package/lib/core/tree/cursor.d.ts.map +1 -1
  663. package/lib/core/tree/cursor.js +0 -2
  664. package/lib/core/tree/cursor.js.map +1 -1
  665. package/lib/core/tree/delta.d.ts +0 -11
  666. package/lib/core/tree/delta.d.ts.map +1 -1
  667. package/lib/core/tree/delta.js.map +1 -1
  668. package/lib/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  669. package/lib/core/tree/detachedFieldIndexCodec.js +4 -3
  670. package/lib/core/tree/detachedFieldIndexCodec.js.map +1 -1
  671. package/lib/core/tree/detachedFieldIndexTypes.d.ts +0 -1
  672. package/lib/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
  673. package/lib/core/tree/detachedFieldIndexTypes.js.map +1 -1
  674. package/lib/core/tree/index.d.ts +1 -1
  675. package/lib/core/tree/index.d.ts.map +1 -1
  676. package/lib/core/tree/index.js +1 -0
  677. package/lib/core/tree/index.js.map +1 -1
  678. package/lib/core/tree/mapTree.d.ts +20 -4
  679. package/lib/core/tree/mapTree.d.ts.map +1 -1
  680. package/lib/core/tree/mapTree.js +27 -1
  681. package/lib/core/tree/mapTree.js.map +1 -1
  682. package/lib/core/tree/pathTree.d.ts +0 -11
  683. package/lib/core/tree/pathTree.d.ts.map +1 -1
  684. package/lib/core/tree/pathTree.js.map +1 -1
  685. package/lib/core/tree/treeTextFormat.d.ts.map +1 -1
  686. package/lib/core/tree/treeTextFormat.js +3 -2
  687. package/lib/core/tree/treeTextFormat.js.map +1 -1
  688. package/lib/core/tree/types.d.ts +0 -11
  689. package/lib/core/tree/types.d.ts.map +1 -1
  690. package/lib/core/tree/types.js +0 -4
  691. package/lib/core/tree/types.js.map +1 -1
  692. package/lib/core/tree/visitDelta.d.ts +0 -1
  693. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  694. package/lib/core/tree/visitDelta.js +2 -2
  695. package/lib/core/tree/visitDelta.js.map +1 -1
  696. package/lib/core/tree/visitPath.d.ts +0 -2
  697. package/lib/core/tree/visitPath.d.ts.map +1 -1
  698. package/lib/core/tree/visitPath.js.map +1 -1
  699. package/lib/core/tree/visitorUtils.d.ts +0 -1
  700. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  701. package/lib/core/tree/visitorUtils.js.map +1 -1
  702. package/lib/domains/index.d.ts +1 -1
  703. package/lib/domains/index.d.ts.map +1 -1
  704. package/lib/domains/index.js +1 -1
  705. package/lib/domains/index.js.map +1 -1
  706. package/lib/domains/json/index.d.ts +1 -1
  707. package/lib/domains/json/index.d.ts.map +1 -1
  708. package/lib/domains/json/index.js +1 -1
  709. package/lib/domains/json/index.js.map +1 -1
  710. package/lib/domains/json/jsonCursor.d.ts +36 -2
  711. package/lib/domains/json/jsonCursor.d.ts.map +1 -1
  712. package/lib/domains/json/jsonCursor.js +76 -5
  713. package/lib/domains/json/jsonCursor.js.map +1 -1
  714. package/lib/domains/json/jsonDomainSchema.d.ts +13 -3
  715. package/lib/domains/json/jsonDomainSchema.d.ts.map +1 -1
  716. package/lib/domains/json/jsonDomainSchema.js +9 -1
  717. package/lib/domains/json/jsonDomainSchema.js.map +1 -1
  718. package/lib/domains/leafDomain.d.ts +0 -1
  719. package/lib/domains/leafDomain.d.ts.map +1 -1
  720. package/lib/domains/leafDomain.js +0 -1
  721. package/lib/domains/leafDomain.js.map +1 -1
  722. package/lib/domains/schemaBuilder.d.ts +1 -7
  723. package/lib/domains/schemaBuilder.d.ts.map +1 -1
  724. package/lib/domains/schemaBuilder.js +1 -11
  725. package/lib/domains/schemaBuilder.js.map +1 -1
  726. package/lib/events/events.d.ts +0 -4
  727. package/lib/events/events.d.ts.map +1 -1
  728. package/lib/events/events.js +0 -1
  729. package/lib/events/events.js.map +1 -1
  730. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  731. package/lib/feature-libraries/chunked-forest/basicChunk.js +9 -4
  732. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  733. package/lib/feature-libraries/chunked-forest/chunk.d.ts +1 -1
  734. package/lib/feature-libraries/chunked-forest/chunk.d.ts.map +1 -1
  735. package/lib/feature-libraries/chunked-forest/chunk.js.map +1 -1
  736. package/lib/feature-libraries/chunked-forest/chunkTree.js +4 -4
  737. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  738. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  739. package/lib/feature-libraries/chunked-forest/chunkedForest.js +8 -6
  740. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  741. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +2 -2
  742. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  743. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  744. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +9 -6
  745. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  746. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  747. package/lib/feature-libraries/chunked-forest/uniformChunk.js +6 -4
  748. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  749. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -24
  750. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  751. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +6 -16
  752. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  753. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +0 -6
  754. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  755. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +11 -1
  756. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  757. package/lib/feature-libraries/default-schema/defaultSchema.d.ts +0 -1
  758. package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
  759. package/lib/feature-libraries/default-schema/defaultSchema.js +0 -1
  760. package/lib/feature-libraries/default-schema/defaultSchema.js.map +1 -1
  761. package/lib/feature-libraries/default-schema/index.d.ts +1 -1
  762. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  763. package/lib/feature-libraries/default-schema/index.js +1 -1
  764. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  765. package/lib/feature-libraries/default-schema/schemaChecker.d.ts +6 -0
  766. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  767. package/lib/feature-libraries/default-schema/schemaChecker.js +6 -0
  768. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  769. package/lib/feature-libraries/editableTreeBinder.d.ts +0 -67
  770. package/lib/feature-libraries/editableTreeBinder.d.ts.map +1 -1
  771. package/lib/feature-libraries/editableTreeBinder.js +6 -25
  772. package/lib/feature-libraries/editableTreeBinder.js.map +1 -1
  773. package/lib/feature-libraries/fieldGenerator.d.ts +0 -3
  774. package/lib/feature-libraries/fieldGenerator.d.ts.map +1 -1
  775. package/lib/feature-libraries/fieldGenerator.js +0 -1
  776. package/lib/feature-libraries/fieldGenerator.js.map +1 -1
  777. package/lib/feature-libraries/flex-map-tree/index.d.ts +1 -1
  778. package/lib/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  779. package/lib/feature-libraries/flex-map-tree/index.js +1 -1
  780. package/lib/feature-libraries/flex-map-tree/index.js.map +1 -1
  781. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts +57 -49
  782. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  783. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js +172 -168
  784. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  785. package/lib/feature-libraries/flex-tree/context.d.ts +0 -1
  786. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  787. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  788. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +17 -282
  789. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  790. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +0 -4
  791. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  792. package/lib/feature-libraries/flex-tree/index.d.ts +1 -1
  793. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  794. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  795. package/lib/feature-libraries/flex-tree/lazyField.d.ts +9 -26
  796. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  797. package/lib/feature-libraries/flex-tree/lazyField.js +28 -101
  798. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  799. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +2 -10
  800. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  801. package/lib/feature-libraries/flex-tree/lazyNode.js +4 -42
  802. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  803. package/lib/feature-libraries/flex-tree/treeEvents.d.ts +0 -2
  804. package/lib/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
  805. package/lib/feature-libraries/flex-tree/treeEvents.js.map +1 -1
  806. package/lib/feature-libraries/flex-tree/utilities.d.ts +2 -1
  807. package/lib/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  808. package/lib/feature-libraries/flex-tree/utilities.js +4 -0
  809. package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
  810. package/lib/feature-libraries/forest-summary/codec.js +3 -3
  811. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  812. package/lib/feature-libraries/index.d.ts +6 -8
  813. package/lib/feature-libraries/index.d.ts.map +1 -1
  814. package/lib/feature-libraries/index.js +5 -6
  815. package/lib/feature-libraries/index.js.map +1 -1
  816. package/lib/feature-libraries/mapTreeCursor.d.ts +6 -2
  817. package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  818. package/lib/feature-libraries/mapTreeCursor.js +7 -0
  819. package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
  820. package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -4
  821. package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts.map +1 -1
  822. package/lib/feature-libraries/memoizedIdRangeAllocator.js +0 -1
  823. package/lib/feature-libraries/memoizedIdRangeAllocator.js.map +1 -1
  824. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +0 -2
  825. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  826. package/lib/feature-libraries/modular-schema/crossFieldQueries.js +0 -1
  827. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  828. package/lib/feature-libraries/modular-schema/discrepancies.d.ts +18 -0
  829. package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  830. package/lib/feature-libraries/modular-schema/discrepancies.js +103 -1
  831. package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  832. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +0 -8
  833. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  834. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js +0 -1
  835. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  836. package/lib/feature-libraries/modular-schema/fieldKind.d.ts +1 -3
  837. package/lib/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  838. package/lib/feature-libraries/modular-schema/fieldKind.js +1 -2
  839. package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  840. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +1 -2
  841. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  842. package/lib/feature-libraries/modular-schema/genericFieldKind.js +56 -83
  843. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  844. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts +1 -1
  845. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
  846. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js +6 -9
  847. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  848. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.d.ts +3 -14
  849. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.d.ts.map +1 -1
  850. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.js +4 -1
  851. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
  852. package/lib/feature-libraries/modular-schema/index.d.ts +2 -2
  853. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  854. package/lib/feature-libraries/modular-schema/index.js +1 -1
  855. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  856. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  857. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +42 -25
  858. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  859. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +9 -8
  860. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  861. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +169 -206
  862. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  863. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +8 -14
  864. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  865. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  866. package/lib/feature-libraries/node-key/nodeKey.d.ts +0 -4
  867. package/lib/feature-libraries/node-key/nodeKey.d.ts.map +1 -1
  868. package/lib/feature-libraries/node-key/nodeKey.js +0 -2
  869. package/lib/feature-libraries/node-key/nodeKey.js.map +1 -1
  870. package/lib/feature-libraries/node-key/nodeKeyManager.d.ts +0 -1
  871. package/lib/feature-libraries/node-key/nodeKeyManager.d.ts.map +1 -1
  872. package/lib/feature-libraries/node-key/nodeKeyManager.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 +2 -11
  875. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  876. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
  877. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  878. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
  879. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  880. package/lib/feature-libraries/schemaBuilderBase.d.ts +2 -28
  881. package/lib/feature-libraries/schemaBuilderBase.d.ts.map +1 -1
  882. package/lib/feature-libraries/schemaBuilderBase.js +2 -28
  883. package/lib/feature-libraries/schemaBuilderBase.js.map +1 -1
  884. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  885. package/lib/feature-libraries/sequence-field/compose.js +25 -22
  886. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  887. package/lib/feature-libraries/sequence-field/formatV2.d.ts +3 -3
  888. package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  889. package/lib/feature-libraries/sequence-field/formatV2.js +3 -3
  890. package/lib/feature-libraries/sequence-field/formatV2.js.map +1 -1
  891. package/lib/feature-libraries/sequence-field/formatV3.d.ts +195 -0
  892. package/lib/feature-libraries/sequence-field/formatV3.d.ts.map +1 -0
  893. package/lib/feature-libraries/sequence-field/formatV3.js +19 -0
  894. package/lib/feature-libraries/sequence-field/formatV3.js.map +1 -0
  895. package/lib/feature-libraries/sequence-field/helperTypes.d.ts +11 -0
  896. package/lib/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  897. package/lib/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  898. package/lib/feature-libraries/sequence-field/index.d.ts +1 -1
  899. package/lib/feature-libraries/sequence-field/index.d.ts.map +1 -1
  900. package/lib/feature-libraries/sequence-field/index.js.map +1 -1
  901. package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  902. package/lib/feature-libraries/sequence-field/invert.js +22 -14
  903. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  904. package/lib/feature-libraries/sequence-field/markQueue.js +2 -2
  905. package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
  906. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +2 -2
  907. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  908. package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  909. package/lib/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  910. package/lib/feature-libraries/sequence-field/rebase.js +25 -7
  911. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  912. package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  913. package/lib/feature-libraries/sequence-field/replaceRevisions.js +16 -3
  914. package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  915. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  916. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +40 -6
  917. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  918. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -1
  919. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  920. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +55 -11
  921. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  922. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +11 -0
  923. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -0
  924. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +81 -0
  925. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -0
  926. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  927. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js +2 -0
  928. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  929. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  930. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +5 -2
  931. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  932. package/lib/feature-libraries/sequence-field/types.d.ts +23 -4
  933. package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
  934. package/lib/feature-libraries/sequence-field/types.js.map +1 -1
  935. package/lib/feature-libraries/sequence-field/utils.d.ts +5 -4
  936. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  937. package/lib/feature-libraries/sequence-field/utils.js +67 -41
  938. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  939. package/lib/feature-libraries/storedToViewSchema.d.ts +0 -1
  940. package/lib/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  941. package/lib/feature-libraries/storedToViewSchema.js +0 -1
  942. package/lib/feature-libraries/storedToViewSchema.js.map +1 -1
  943. package/lib/feature-libraries/treeCursorUtils.d.ts +0 -6
  944. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  945. package/lib/feature-libraries/treeCursorUtils.js +9 -7
  946. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  947. package/lib/feature-libraries/treeTextCursor.d.ts +0 -2
  948. package/lib/feature-libraries/treeTextCursor.d.ts.map +1 -1
  949. package/lib/feature-libraries/treeTextCursor.js +0 -2
  950. package/lib/feature-libraries/treeTextCursor.js.map +1 -1
  951. package/lib/feature-libraries/typed-schema/flexList.d.ts +0 -3
  952. package/lib/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
  953. package/lib/feature-libraries/typed-schema/flexList.js.map +1 -1
  954. package/lib/feature-libraries/typed-schema/index.d.ts +1 -1
  955. package/lib/feature-libraries/typed-schema/index.d.ts.map +1 -1
  956. package/lib/feature-libraries/typed-schema/index.js +1 -1
  957. package/lib/feature-libraries/typed-schema/index.js.map +1 -1
  958. package/lib/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  959. package/lib/feature-libraries/typed-schema/schemaCollection.js +1 -5
  960. package/lib/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  961. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +2 -41
  962. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  963. package/lib/feature-libraries/typed-schema/typedTreeSchema.js +1 -38
  964. package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  965. package/lib/feature-libraries/typed-schema/view.d.ts +0 -1
  966. package/lib/feature-libraries/typed-schema/view.d.ts.map +1 -1
  967. package/lib/feature-libraries/typed-schema/view.js.map +1 -1
  968. package/lib/index.d.ts +8 -9
  969. package/lib/index.d.ts.map +1 -1
  970. package/lib/index.js +4 -9
  971. package/lib/index.js.map +1 -1
  972. package/lib/internalTypes.d.ts +1 -1
  973. package/lib/internalTypes.d.ts.map +1 -1
  974. package/lib/internalTypes.js.map +1 -1
  975. package/lib/packageVersion.d.ts +1 -1
  976. package/lib/packageVersion.js +1 -1
  977. package/lib/packageVersion.js.map +1 -1
  978. package/lib/public.d.ts +3 -1
  979. package/lib/shared-tree/schematizeTree.d.ts +2 -11
  980. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  981. package/lib/shared-tree/schematizeTree.js +15 -4
  982. package/lib/shared-tree/schematizeTree.js.map +1 -1
  983. package/lib/shared-tree/schematizingTreeView.d.ts +4 -4
  984. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  985. package/lib/shared-tree/schematizingTreeView.js +3 -3
  986. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  987. package/lib/shared-tree/sharedTree.d.ts +4 -17
  988. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  989. package/lib/shared-tree/sharedTree.js +6 -10
  990. package/lib/shared-tree/sharedTree.js.map +1 -1
  991. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  992. package/lib/shared-tree/sharedTreeChangeCodecs.js +4 -0
  993. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  994. package/lib/shared-tree/sharedTreeChangeFamily.js +3 -3
  995. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  996. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +0 -2
  997. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  998. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  999. package/lib/shared-tree/treeApi.js +3 -3
  1000. package/lib/shared-tree/treeApi.js.map +1 -1
  1001. package/lib/shared-tree/treeCheckout.d.ts +0 -5
  1002. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  1003. package/lib/shared-tree/treeCheckout.js +6 -4
  1004. package/lib/shared-tree/treeCheckout.js.map +1 -1
  1005. package/lib/shared-tree/treeView.d.ts +3 -6
  1006. package/lib/shared-tree/treeView.d.ts.map +1 -1
  1007. package/lib/shared-tree/treeView.js.map +1 -1
  1008. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  1009. package/lib/shared-tree-core/branch.js +12 -7
  1010. package/lib/shared-tree-core/branch.js.map +1 -1
  1011. package/lib/shared-tree-core/defaultResubmitMachine.js +4 -4
  1012. package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  1013. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  1014. package/lib/shared-tree-core/editManagerCodecs.js +1 -0
  1015. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  1016. package/lib/shared-tree-core/editManagerFormat.d.ts +2 -2
  1017. package/lib/shared-tree-core/editManagerFormat.d.ts.map +1 -1
  1018. package/lib/shared-tree-core/editManagerFormat.js +6 -1
  1019. package/lib/shared-tree-core/editManagerFormat.js.map +1 -1
  1020. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  1021. package/lib/shared-tree-core/messageCodecs.js +1 -0
  1022. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  1023. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  1024. package/lib/shared-tree-core/sharedTreeCore.js +4 -2
  1025. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  1026. package/lib/simple-tree/api/create.d.ts +54 -0
  1027. package/lib/simple-tree/api/create.d.ts.map +1 -0
  1028. package/lib/simple-tree/api/create.js +92 -0
  1029. package/lib/simple-tree/api/create.js.map +1 -0
  1030. package/lib/simple-tree/api/index.d.ts +12 -0
  1031. package/lib/simple-tree/api/index.d.ts.map +1 -0
  1032. package/lib/simple-tree/api/index.js +13 -0
  1033. package/lib/simple-tree/api/index.js.map +1 -0
  1034. package/{dist/simple-tree → lib/simple-tree/api}/schemaCreationUtilities.d.ts +7 -4
  1035. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -0
  1036. package/lib/simple-tree/{schemaCreationUtilities.js → api/schemaCreationUtilities.js} +1 -1
  1037. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -0
  1038. package/lib/simple-tree/{schemaFactory.d.ts → api/schemaFactory.d.ts} +15 -14
  1039. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -0
  1040. package/lib/simple-tree/{schemaFactory.js → api/schemaFactory.js} +9 -8
  1041. package/lib/simple-tree/api/schemaFactory.js.map +1 -0
  1042. package/{dist/simple-tree → lib/simple-tree/api}/schemaFactoryRecursive.d.ts +40 -7
  1043. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -0
  1044. package/lib/simple-tree/{schemaFactoryRecursive.js → api/schemaFactoryRecursive.js} +1 -1
  1045. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -0
  1046. package/lib/simple-tree/api/testRecursiveDomain.d.ts +62 -0
  1047. package/lib/simple-tree/api/testRecursiveDomain.d.ts.map +1 -0
  1048. package/lib/simple-tree/api/testRecursiveDomain.js.map +1 -0
  1049. package/{dist/simple-tree → lib/simple-tree/api}/tree.d.ts +111 -20
  1050. package/lib/simple-tree/api/tree.d.ts.map +1 -0
  1051. package/lib/simple-tree/api/tree.js +165 -0
  1052. package/lib/simple-tree/api/tree.js.map +1 -0
  1053. package/lib/simple-tree/{treeNodeApi.d.ts → api/treeNodeApi.d.ts} +6 -5
  1054. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -0
  1055. package/lib/simple-tree/{treeNodeApi.js → api/treeNodeApi.js} +25 -17
  1056. package/lib/simple-tree/api/treeNodeApi.js.map +1 -0
  1057. package/lib/simple-tree/api/verboseTree.d.ts +136 -0
  1058. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -0
  1059. package/lib/simple-tree/api/verboseTree.js +213 -0
  1060. package/lib/simple-tree/api/verboseTree.js.map +1 -0
  1061. package/lib/simple-tree/arrayNode.d.ts +3 -3
  1062. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  1063. package/lib/simple-tree/arrayNode.js +56 -53
  1064. package/lib/simple-tree/arrayNode.js.map +1 -1
  1065. package/lib/simple-tree/core/index.d.ts +10 -0
  1066. package/lib/simple-tree/core/index.d.ts.map +1 -0
  1067. package/lib/simple-tree/core/index.js +10 -0
  1068. package/lib/simple-tree/core/index.js.map +1 -0
  1069. package/{dist/simple-tree → lib/simple-tree/core}/schemaCaching.d.ts +2 -9
  1070. package/lib/simple-tree/core/schemaCaching.d.ts.map +1 -0
  1071. package/lib/simple-tree/{schemaCaching.js → core/schemaCaching.js} +1 -21
  1072. package/lib/simple-tree/core/schemaCaching.js.map +1 -0
  1073. package/lib/simple-tree/core/treeNodeKernel.d.ts +57 -0
  1074. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -0
  1075. package/lib/simple-tree/{treeNodeKernel.js → core/treeNodeKernel.js} +45 -3
  1076. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -0
  1077. package/lib/simple-tree/core/treeNodeSchema.d.ts +149 -0
  1078. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -0
  1079. package/lib/simple-tree/core/treeNodeSchema.js +32 -0
  1080. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -0
  1081. package/lib/simple-tree/{types.d.ts → core/types.d.ts} +23 -70
  1082. package/lib/simple-tree/core/types.d.ts.map +1 -0
  1083. package/lib/simple-tree/core/types.js +111 -0
  1084. package/lib/simple-tree/core/types.js.map +1 -0
  1085. package/lib/simple-tree/core/withType.d.ts +82 -0
  1086. package/lib/simple-tree/core/withType.d.ts.map +1 -0
  1087. package/lib/simple-tree/core/withType.js +36 -0
  1088. package/lib/simple-tree/core/withType.js.map +1 -0
  1089. package/lib/simple-tree/getJsonSchema.d.ts +55 -0
  1090. package/lib/simple-tree/getJsonSchema.d.ts.map +1 -0
  1091. package/lib/simple-tree/getJsonSchema.js +65 -0
  1092. package/lib/simple-tree/getJsonSchema.js.map +1 -0
  1093. package/lib/simple-tree/getSimpleFieldSchema.d.ts +14 -0
  1094. package/lib/simple-tree/getSimpleFieldSchema.d.ts.map +1 -0
  1095. package/lib/simple-tree/getSimpleFieldSchema.js +25 -0
  1096. package/lib/simple-tree/getSimpleFieldSchema.js.map +1 -0
  1097. package/lib/simple-tree/getSimpleSchema.d.ts +58 -0
  1098. package/lib/simple-tree/getSimpleSchema.d.ts.map +1 -0
  1099. package/lib/simple-tree/getSimpleSchema.js +64 -0
  1100. package/lib/simple-tree/getSimpleSchema.js.map +1 -0
  1101. package/lib/simple-tree/index.d.ts +12 -13
  1102. package/lib/simple-tree/index.d.ts.map +1 -1
  1103. package/lib/simple-tree/index.js +8 -11
  1104. package/lib/simple-tree/index.js.map +1 -1
  1105. package/lib/simple-tree/jsonSchema.d.ts +206 -0
  1106. package/lib/simple-tree/jsonSchema.d.ts.map +1 -0
  1107. package/lib/simple-tree/{nodeKeys.js → jsonSchema.js} +1 -1
  1108. package/lib/simple-tree/jsonSchema.js.map +1 -0
  1109. package/lib/simple-tree/leafNodeSchema.d.ts +1 -1
  1110. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  1111. package/lib/simple-tree/leafNodeSchema.js +1 -2
  1112. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  1113. package/lib/simple-tree/mapNode.d.ts +9 -3
  1114. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  1115. package/lib/simple-tree/mapNode.js +36 -36
  1116. package/lib/simple-tree/mapNode.js.map +1 -1
  1117. package/lib/simple-tree/objectNode.d.ts +18 -16
  1118. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  1119. package/lib/simple-tree/objectNode.js +36 -34
  1120. package/lib/simple-tree/objectNode.js.map +1 -1
  1121. package/lib/simple-tree/objectNodeTypes.d.ts +38 -0
  1122. package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -0
  1123. package/lib/simple-tree/objectNodeTypes.js +15 -0
  1124. package/lib/simple-tree/objectNodeTypes.js.map +1 -0
  1125. package/lib/simple-tree/proxies.d.ts +6 -25
  1126. package/lib/simple-tree/proxies.d.ts.map +1 -1
  1127. package/lib/simple-tree/proxies.js +46 -57
  1128. package/lib/simple-tree/proxies.js.map +1 -1
  1129. package/lib/simple-tree/proxyBinding.d.ts +45 -22
  1130. package/lib/simple-tree/proxyBinding.d.ts.map +1 -1
  1131. package/lib/simple-tree/proxyBinding.js +89 -52
  1132. package/lib/simple-tree/proxyBinding.js.map +1 -1
  1133. package/lib/simple-tree/schemaTypes.d.ts +10 -159
  1134. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  1135. package/lib/simple-tree/schemaTypes.js +9 -41
  1136. package/lib/simple-tree/schemaTypes.js.map +1 -1
  1137. package/lib/simple-tree/simpleSchema.d.ts +124 -0
  1138. package/lib/simple-tree/simpleSchema.d.ts.map +1 -0
  1139. package/lib/{feature-libraries/schema-aware/schemaAware.js → simple-tree/simpleSchema.js} +1 -1
  1140. package/lib/simple-tree/simpleSchema.js.map +1 -0
  1141. package/lib/simple-tree/simpleSchemaToJsonSchema.d.ts +12 -0
  1142. package/lib/simple-tree/simpleSchemaToJsonSchema.d.ts.map +1 -0
  1143. package/lib/simple-tree/simpleSchemaToJsonSchema.js +142 -0
  1144. package/lib/simple-tree/simpleSchemaToJsonSchema.js.map +1 -0
  1145. package/lib/simple-tree/toFlexSchema.d.ts +4 -12
  1146. package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
  1147. package/lib/simple-tree/toFlexSchema.js +9 -18
  1148. package/lib/simple-tree/toFlexSchema.js.map +1 -1
  1149. package/lib/simple-tree/toMapTree.d.ts +39 -39
  1150. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  1151. package/lib/simple-tree/toMapTree.js +214 -158
  1152. package/lib/simple-tree/toMapTree.js.map +1 -1
  1153. package/lib/simple-tree/treeNodeValid.d.ts +74 -0
  1154. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -0
  1155. package/lib/simple-tree/{types.js → treeNodeValid.js} +8 -98
  1156. package/lib/simple-tree/treeNodeValid.js.map +1 -0
  1157. package/lib/simple-tree/typesUnsafe.d.ts +35 -4
  1158. package/lib/simple-tree/typesUnsafe.d.ts.map +1 -1
  1159. package/lib/simple-tree/typesUnsafe.js.map +1 -1
  1160. package/lib/simple-tree/viewSchemaToSimpleSchema.d.ts +11 -0
  1161. package/lib/simple-tree/viewSchemaToSimpleSchema.d.ts.map +1 -0
  1162. package/lib/simple-tree/viewSchemaToSimpleSchema.js +167 -0
  1163. package/lib/simple-tree/viewSchemaToSimpleSchema.js.map +1 -0
  1164. package/lib/util/brand.d.ts +0 -3
  1165. package/lib/util/brand.d.ts.map +1 -1
  1166. package/lib/util/brand.js +1 -2
  1167. package/lib/util/brand.js.map +1 -1
  1168. package/lib/util/brandedMap.d.ts +0 -5
  1169. package/lib/util/brandedMap.d.ts.map +1 -1
  1170. package/lib/util/brandedMap.js +0 -1
  1171. package/lib/util/brandedMap.js.map +1 -1
  1172. package/lib/util/idAllocator.d.ts +0 -2
  1173. package/lib/util/idAllocator.d.ts.map +1 -1
  1174. package/lib/util/idAllocator.js +0 -1
  1175. package/lib/util/idAllocator.js.map +1 -1
  1176. package/lib/util/index.d.ts +2 -2
  1177. package/lib/util/index.d.ts.map +1 -1
  1178. package/lib/util/index.js +2 -2
  1179. package/lib/util/index.js.map +1 -1
  1180. package/lib/util/nestedMap.d.ts +5 -19
  1181. package/lib/util/nestedMap.d.ts.map +1 -1
  1182. package/lib/util/nestedMap.js +15 -16
  1183. package/lib/util/nestedMap.js.map +1 -1
  1184. package/lib/util/opaque.d.ts +0 -4
  1185. package/lib/util/opaque.d.ts.map +1 -1
  1186. package/lib/util/opaque.js +0 -2
  1187. package/lib/util/opaque.js.map +1 -1
  1188. package/lib/util/rangeMap.d.ts +0 -2
  1189. package/lib/util/rangeMap.d.ts.map +1 -1
  1190. package/lib/util/rangeMap.js +4 -3
  1191. package/lib/util/rangeMap.js.map +1 -1
  1192. package/lib/util/transactionResult.d.ts +0 -1
  1193. package/lib/util/transactionResult.d.ts.map +1 -1
  1194. package/lib/util/transactionResult.js +0 -1
  1195. package/lib/util/transactionResult.js.map +1 -1
  1196. package/lib/util/typeCheck.d.ts +2 -20
  1197. package/lib/util/typeCheck.d.ts.map +1 -1
  1198. package/lib/util/typeCheck.js.map +1 -1
  1199. package/lib/util/typeCheckTests.d.ts +4 -4
  1200. package/lib/util/typeCheckTests.d.ts.map +1 -1
  1201. package/lib/util/typeCheckTests.js.map +1 -1
  1202. package/lib/util/typeUtils.d.ts +0 -7
  1203. package/lib/util/typeUtils.d.ts.map +1 -1
  1204. package/lib/util/typeUtils.js.map +1 -1
  1205. package/lib/util/utils.d.ts +6 -8
  1206. package/lib/util/utils.d.ts.map +1 -1
  1207. package/lib/util/utils.js +12 -4
  1208. package/lib/util/utils.js.map +1 -1
  1209. package/package.json +25 -24
  1210. package/src/codec/discriminatedUnions.ts +20 -10
  1211. package/src/codec/index.ts +5 -1
  1212. package/src/core/forest/README.md +4 -2
  1213. package/src/core/forest/editableForest.ts +1 -6
  1214. package/src/core/forest/forest.ts +0 -6
  1215. package/src/core/index.ts +2 -2
  1216. package/src/core/rebase/changeRebaser.ts +0 -4
  1217. package/src/core/rebase/index.ts +0 -2
  1218. package/src/core/rebase/types.ts +1 -23
  1219. package/src/core/rebase/utils.ts +13 -11
  1220. package/src/core/schema-stored/multiplicity.ts +0 -1
  1221. package/src/core/schema-stored/schema.ts +0 -7
  1222. package/src/core/schema-stored/storedSchemaRepository.ts +0 -3
  1223. package/src/core/schema-view/view.ts +0 -3
  1224. package/src/core/tree/anchorSet.ts +7 -17
  1225. package/src/core/tree/cursor.ts +1 -6
  1226. package/src/core/tree/delta.ts +0 -11
  1227. package/src/core/tree/detachedFieldIndexCodec.ts +4 -3
  1228. package/src/core/tree/detachedFieldIndexTypes.ts +0 -1
  1229. package/src/core/tree/index.ts +1 -1
  1230. package/src/core/tree/mapTree.ts +45 -4
  1231. package/src/core/tree/pathTree.ts +0 -11
  1232. package/src/core/tree/treeTextFormat.ts +3 -2
  1233. package/src/core/tree/types.ts +0 -11
  1234. package/src/core/tree/visitDelta.ts +2 -3
  1235. package/src/core/tree/visitPath.ts +0 -2
  1236. package/src/core/tree/visitorUtils.ts +0 -1
  1237. package/src/domains/index.ts +3 -0
  1238. package/src/domains/json/index.ts +7 -1
  1239. package/src/domains/json/jsonCursor.ts +113 -6
  1240. package/src/domains/json/jsonDomainSchema.ts +4 -5
  1241. package/src/domains/leafDomain.ts +0 -1
  1242. package/src/domains/schemaBuilder.ts +0 -22
  1243. package/src/events/events.ts +0 -4
  1244. package/src/feature-libraries/chunked-forest/README.md +9 -1
  1245. package/src/feature-libraries/chunked-forest/basicChunk.ts +14 -9
  1246. package/src/feature-libraries/chunked-forest/chunk.ts +1 -1
  1247. package/src/feature-libraries/chunked-forest/chunkTree.ts +4 -4
  1248. package/src/feature-libraries/chunked-forest/chunkedForest.ts +8 -6
  1249. package/src/feature-libraries/chunked-forest/codec/chunkCodecUtilities.ts +2 -2
  1250. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +9 -6
  1251. package/src/feature-libraries/chunked-forest/uniformChunk.ts +6 -4
  1252. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +18 -46
  1253. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +11 -6
  1254. package/src/feature-libraries/default-schema/defaultSchema.ts +0 -1
  1255. package/src/feature-libraries/default-schema/index.ts +1 -1
  1256. package/src/feature-libraries/default-schema/schemaChecker.ts +6 -0
  1257. package/src/feature-libraries/editableTreeBinder.ts +6 -78
  1258. package/src/feature-libraries/fieldGenerator.ts +0 -3
  1259. package/src/feature-libraries/flex-map-tree/index.ts +2 -1
  1260. package/src/feature-libraries/flex-map-tree/mapTreeNode.ts +238 -267
  1261. package/src/feature-libraries/flex-tree/context.ts +0 -1
  1262. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +27 -357
  1263. package/src/feature-libraries/flex-tree/index.ts +0 -1
  1264. package/src/feature-libraries/flex-tree/lazyField.ts +38 -208
  1265. package/src/feature-libraries/flex-tree/lazyNode.ts +5 -66
  1266. package/src/feature-libraries/flex-tree/treeEvents.ts +0 -2
  1267. package/src/feature-libraries/flex-tree/utilities.ts +6 -1
  1268. package/src/feature-libraries/forest-summary/codec.ts +3 -3
  1269. package/src/feature-libraries/index.ts +5 -35
  1270. package/src/feature-libraries/mapTreeCursor.ts +13 -4
  1271. package/src/feature-libraries/memoizedIdRangeAllocator.ts +0 -4
  1272. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +0 -2
  1273. package/src/feature-libraries/modular-schema/discrepancies.ts +117 -1
  1274. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +0 -8
  1275. package/src/feature-libraries/modular-schema/fieldKind.ts +1 -3
  1276. package/src/feature-libraries/modular-schema/genericFieldKind.ts +69 -92
  1277. package/src/feature-libraries/modular-schema/genericFieldKindCodecs.ts +7 -14
  1278. package/src/feature-libraries/modular-schema/genericFieldKindTypes.ts +6 -15
  1279. package/src/feature-libraries/modular-schema/index.ts +2 -2
  1280. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +68 -34
  1281. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +330 -336
  1282. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +7 -14
  1283. package/src/feature-libraries/node-key/nodeKey.ts +0 -4
  1284. package/src/feature-libraries/node-key/nodeKeyManager.ts +0 -1
  1285. package/src/feature-libraries/object-forest/objectForest.ts +1 -13
  1286. package/src/feature-libraries/schemaBuilderBase.ts +1 -49
  1287. package/src/feature-libraries/sequence-field/compose.ts +41 -20
  1288. package/src/feature-libraries/sequence-field/formatV2.ts +3 -3
  1289. package/src/feature-libraries/sequence-field/formatV3.ts +65 -0
  1290. package/src/feature-libraries/sequence-field/helperTypes.ts +33 -0
  1291. package/src/feature-libraries/sequence-field/index.ts +1 -0
  1292. package/src/feature-libraries/sequence-field/invert.ts +28 -18
  1293. package/src/feature-libraries/sequence-field/markQueue.ts +2 -2
  1294. package/src/feature-libraries/sequence-field/moveEffectTable.ts +2 -2
  1295. package/src/feature-libraries/sequence-field/rebase.ts +30 -13
  1296. package/src/feature-libraries/sequence-field/replaceRevisions.ts +27 -3
  1297. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +52 -7
  1298. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +92 -19
  1299. package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +134 -0
  1300. package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +2 -0
  1301. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +8 -2
  1302. package/src/feature-libraries/sequence-field/types.ts +24 -4
  1303. package/src/feature-libraries/sequence-field/utils.ts +78 -50
  1304. package/src/feature-libraries/storedToViewSchema.ts +0 -1
  1305. package/src/feature-libraries/treeCursorUtils.ts +11 -11
  1306. package/src/feature-libraries/treeTextCursor.ts +0 -2
  1307. package/src/feature-libraries/typed-schema/flexList.ts +0 -3
  1308. package/src/feature-libraries/typed-schema/index.ts +0 -2
  1309. package/src/feature-libraries/typed-schema/schemaCollection.ts +0 -5
  1310. package/src/feature-libraries/typed-schema/typedTreeSchema.ts +2 -68
  1311. package/src/feature-libraries/typed-schema/view.ts +0 -1
  1312. package/src/index.ts +27 -245
  1313. package/src/internalTypes.ts +1 -0
  1314. package/src/packageVersion.ts +1 -1
  1315. package/src/shared-tree/schematizeTree.ts +25 -21
  1316. package/src/shared-tree/schematizingTreeView.ts +6 -6
  1317. package/src/shared-tree/sharedTree.ts +8 -39
  1318. package/src/shared-tree/sharedTreeChangeCodecs.ts +8 -0
  1319. package/src/shared-tree/sharedTreeChangeFamily.ts +3 -3
  1320. package/src/shared-tree/sharedTreeEditBuilder.ts +0 -2
  1321. package/src/shared-tree/treeApi.ts +3 -3
  1322. package/src/shared-tree/treeCheckout.ts +6 -8
  1323. package/src/shared-tree/treeView.ts +3 -6
  1324. package/src/shared-tree-core/branch.ts +20 -8
  1325. package/src/shared-tree-core/defaultResubmitMachine.ts +4 -4
  1326. package/src/shared-tree-core/editManagerCodecs.ts +1 -0
  1327. package/src/shared-tree-core/editManagerFormat.ts +7 -2
  1328. package/src/shared-tree-core/messageCodecs.ts +2 -1
  1329. package/src/shared-tree-core/sharedTreeCore.ts +5 -3
  1330. package/src/simple-tree/ProxyBinding.md +2 -0
  1331. package/src/simple-tree/api/README.md +7 -0
  1332. package/src/simple-tree/api/create.ts +179 -0
  1333. package/src/simple-tree/api/index.ts +36 -0
  1334. package/src/simple-tree/{schemaCreationUtilities.ts → api/schemaCreationUtilities.ts} +13 -5
  1335. package/src/simple-tree/{schemaFactory.ts → api/schemaFactory.ts} +36 -34
  1336. package/src/simple-tree/{schemaFactoryRecursive.ts → api/schemaFactoryRecursive.ts} +47 -10
  1337. package/src/simple-tree/{testRecursiveDomain.ts → api/testRecursiveDomain.ts} +3 -1
  1338. package/src/simple-tree/{tree.ts → api/tree.ts} +246 -34
  1339. package/src/simple-tree/{treeNodeApi.ts → api/treeNodeApi.ts} +47 -36
  1340. package/src/simple-tree/api/verboseTree.ts +415 -0
  1341. package/src/simple-tree/arrayNode.ts +100 -98
  1342. package/src/simple-tree/core/README.md +11 -0
  1343. package/src/simple-tree/core/index.ts +33 -0
  1344. package/src/simple-tree/{schemaCaching.ts → core/schemaCaching.ts} +3 -37
  1345. package/src/simple-tree/{treeNodeKernel.ts → core/treeNodeKernel.ts} +55 -5
  1346. package/src/simple-tree/core/treeNodeSchema.ts +184 -0
  1347. package/src/simple-tree/core/types.ts +255 -0
  1348. package/src/simple-tree/core/withType.ts +89 -0
  1349. package/src/simple-tree/getJsonSchema.ts +70 -0
  1350. package/src/simple-tree/getSimpleFieldSchema.ts +36 -0
  1351. package/src/simple-tree/getSimpleSchema.ts +69 -0
  1352. package/src/simple-tree/index.ts +58 -33
  1353. package/src/simple-tree/jsonSchema.ts +230 -0
  1354. package/src/simple-tree/leafNodeSchema.ts +6 -3
  1355. package/src/simple-tree/mapNode.ts +56 -55
  1356. package/src/simple-tree/objectNode.ts +66 -90
  1357. package/src/simple-tree/objectNodeTypes.ts +68 -0
  1358. package/src/simple-tree/proxies.ts +52 -68
  1359. package/src/simple-tree/proxyBinding.ts +127 -72
  1360. package/src/simple-tree/schemaTypes.ts +29 -194
  1361. package/src/simple-tree/simpleSchema.ts +138 -0
  1362. package/src/simple-tree/simpleSchemaToJsonSchema.ts +178 -0
  1363. package/src/simple-tree/toFlexSchema.ts +9 -42
  1364. package/src/simple-tree/toMapTree.ts +270 -296
  1365. package/src/simple-tree/{types.ts → treeNodeValid.ts} +16 -232
  1366. package/src/simple-tree/typesUnsafe.ts +51 -5
  1367. package/src/simple-tree/viewSchemaToSimpleSchema.ts +209 -0
  1368. package/src/util/brand.ts +1 -4
  1369. package/src/util/brandedMap.ts +0 -5
  1370. package/src/util/idAllocator.ts +0 -2
  1371. package/src/util/index.ts +2 -0
  1372. package/src/util/nestedMap.ts +23 -20
  1373. package/src/util/opaque.ts +0 -4
  1374. package/src/util/rangeMap.ts +5 -5
  1375. package/src/util/transactionResult.ts +0 -1
  1376. package/src/util/typeCheck.ts +2 -20
  1377. package/src/util/typeCheckTests.ts +4 -4
  1378. package/src/util/typeUtils.ts +0 -7
  1379. package/src/util/utils.ts +13 -8
  1380. package/tsconfig.json +0 -1
  1381. package/dist/feature-libraries/contextuallyTyped.d.ts +0 -209
  1382. package/dist/feature-libraries/contextuallyTyped.d.ts.map +0 -1
  1383. package/dist/feature-libraries/contextuallyTyped.js +0 -328
  1384. package/dist/feature-libraries/contextuallyTyped.js.map +0 -1
  1385. package/dist/feature-libraries/schema-aware/index.d.ts +0 -6
  1386. package/dist/feature-libraries/schema-aware/index.d.ts.map +0 -1
  1387. package/dist/feature-libraries/schema-aware/index.js.map +0 -1
  1388. package/dist/feature-libraries/schema-aware/schemaAware.d.ts +0 -76
  1389. package/dist/feature-libraries/schema-aware/schemaAware.d.ts.map +0 -1
  1390. package/dist/feature-libraries/schema-aware/schemaAware.js.map +0 -1
  1391. package/dist/simple-tree/nodeKeys.d.ts +0 -41
  1392. package/dist/simple-tree/nodeKeys.d.ts.map +0 -1
  1393. package/dist/simple-tree/nodeKeys.js +0 -7
  1394. package/dist/simple-tree/nodeKeys.js.map +0 -1
  1395. package/dist/simple-tree/schemaCaching.d.ts.map +0 -1
  1396. package/dist/simple-tree/schemaCaching.js.map +0 -1
  1397. package/dist/simple-tree/schemaCreationUtilities.d.ts.map +0 -1
  1398. package/dist/simple-tree/schemaCreationUtilities.js.map +0 -1
  1399. package/dist/simple-tree/schemaFactory.d.ts.map +0 -1
  1400. package/dist/simple-tree/schemaFactory.js.map +0 -1
  1401. package/dist/simple-tree/schemaFactoryRecursive.d.ts.map +0 -1
  1402. package/dist/simple-tree/schemaFactoryRecursive.js.map +0 -1
  1403. package/dist/simple-tree/testRecursiveDomain.d.ts +0 -61
  1404. package/dist/simple-tree/testRecursiveDomain.d.ts.map +0 -1
  1405. package/dist/simple-tree/testRecursiveDomain.js.map +0 -1
  1406. package/dist/simple-tree/tree.d.ts.map +0 -1
  1407. package/dist/simple-tree/tree.js +0 -73
  1408. package/dist/simple-tree/tree.js.map +0 -1
  1409. package/dist/simple-tree/treeNodeApi.d.ts.map +0 -1
  1410. package/dist/simple-tree/treeNodeApi.js.map +0 -1
  1411. package/dist/simple-tree/treeNodeKernel.d.ts +0 -26
  1412. package/dist/simple-tree/treeNodeKernel.d.ts.map +0 -1
  1413. package/dist/simple-tree/treeNodeKernel.js.map +0 -1
  1414. package/dist/simple-tree/types.d.ts.map +0 -1
  1415. package/dist/simple-tree/types.js.map +0 -1
  1416. package/lib/feature-libraries/contextuallyTyped.d.ts +0 -209
  1417. package/lib/feature-libraries/contextuallyTyped.d.ts.map +0 -1
  1418. package/lib/feature-libraries/contextuallyTyped.js +0 -311
  1419. package/lib/feature-libraries/contextuallyTyped.js.map +0 -1
  1420. package/lib/feature-libraries/schema-aware/index.d.ts +0 -6
  1421. package/lib/feature-libraries/schema-aware/index.d.ts.map +0 -1
  1422. package/lib/feature-libraries/schema-aware/index.js +0 -6
  1423. package/lib/feature-libraries/schema-aware/index.js.map +0 -1
  1424. package/lib/feature-libraries/schema-aware/schemaAware.d.ts +0 -76
  1425. package/lib/feature-libraries/schema-aware/schemaAware.d.ts.map +0 -1
  1426. package/lib/feature-libraries/schema-aware/schemaAware.js.map +0 -1
  1427. package/lib/simple-tree/nodeKeys.d.ts +0 -41
  1428. package/lib/simple-tree/nodeKeys.d.ts.map +0 -1
  1429. package/lib/simple-tree/nodeKeys.js.map +0 -1
  1430. package/lib/simple-tree/schemaCaching.d.ts.map +0 -1
  1431. package/lib/simple-tree/schemaCaching.js.map +0 -1
  1432. package/lib/simple-tree/schemaCreationUtilities.d.ts.map +0 -1
  1433. package/lib/simple-tree/schemaCreationUtilities.js.map +0 -1
  1434. package/lib/simple-tree/schemaFactory.d.ts.map +0 -1
  1435. package/lib/simple-tree/schemaFactory.js.map +0 -1
  1436. package/lib/simple-tree/schemaFactoryRecursive.d.ts.map +0 -1
  1437. package/lib/simple-tree/schemaFactoryRecursive.js.map +0 -1
  1438. package/lib/simple-tree/testRecursiveDomain.d.ts +0 -61
  1439. package/lib/simple-tree/testRecursiveDomain.d.ts.map +0 -1
  1440. package/lib/simple-tree/testRecursiveDomain.js.map +0 -1
  1441. package/lib/simple-tree/tree.d.ts.map +0 -1
  1442. package/lib/simple-tree/tree.js +0 -66
  1443. package/lib/simple-tree/tree.js.map +0 -1
  1444. package/lib/simple-tree/treeNodeApi.d.ts.map +0 -1
  1445. package/lib/simple-tree/treeNodeApi.js.map +0 -1
  1446. package/lib/simple-tree/treeNodeKernel.d.ts +0 -26
  1447. package/lib/simple-tree/treeNodeKernel.d.ts.map +0 -1
  1448. package/lib/simple-tree/treeNodeKernel.js.map +0 -1
  1449. package/lib/simple-tree/types.d.ts.map +0 -1
  1450. package/lib/simple-tree/types.js.map +0 -1
  1451. package/src/feature-libraries/contextuallyTyped.ts +0 -582
  1452. package/src/feature-libraries/schema-aware/README.md +0 -19
  1453. package/src/feature-libraries/schema-aware/index.ts +0 -16
  1454. package/src/feature-libraries/schema-aware/schemaAware.ts +0 -135
  1455. package/src/simple-tree/nodeKeys.ts +0 -42
  1456. /package/dist/simple-tree/{testRecursiveDomain.js → api/testRecursiveDomain.js} +0 -0
  1457. /package/lib/simple-tree/{testRecursiveDomain.js → api/testRecursiveDomain.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"schematizingTreeView.js","sourceRoot":"","sources":["../../src/shared-tree/schematizingTreeView.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kEAA6D;AAC7D,uEAAsE;AAEtE,+CAAoE;AACpE,iDAK4B;AAC5B,4DAQuC;AACvC,sDAgBiC;AACjC,+CAA+F;AAE/F,2DAA8E;AAE9E,+CAAqD;AAErD;;GAEG;IAEU,0BAA0B;4BADtC,wBAAa;;;;;QAmCb,YACiB,QAAsB,EACtB,MAA0C,EAC1C,cAA8B,EAC9B,UAAqB,IAAI,oBAAS,CAAC,4BAA4B,CAAC;YAHhE,aAAQ,GAAR,QAAQ,CAAc;YACtB,WAAM,GAAN,MAAM,CAAoC;YAC1C,mBAAc,GAAd,cAAc,CAAgB;YAC9B,YAAO,GAAP,OAAO,CAAyD;YAvBjE,WAAM,GAEU,IAAA,wBAAa,GAAE,CAAC;YAI/B,wBAAmB,GAAG,IAAI,GAAG,EAAc,CAAC;YAEtD,aAAQ,GAAG,KAAK,CAAC;YACxB;;;;;eAKG;YACK,eAAU,GAAG,KAAK,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iBAAM,EAAC,KAAK,CAAC,GAAG,CAAC,sBAAW,CAAC,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAE9E,MAAM,UAAU,GAAG,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;QACrE,UAAU,EAAE,CAAC;QACb,IAAI,CAAC,wBAAa,CAAC,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACb,CAAC;AAhCD,sCAgCC","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 { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { AllowedUpdateType, Compatibility } from \"../core/index.js\";\nimport {\n\ttype HasListeners,\n\ttype IEmitter,\n\ttype Listenable,\n\tcreateEmitter,\n} from \"../events/index.js\";\nimport {\n\ttype FlexFieldSchema,\n\ttype NodeKeyManager,\n\tViewSchema,\n\tdefaultSchemaPolicy,\n\tContextSlot,\n\tcursorForMapTreeNode,\n\ttype FlexTreeSchema,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype FieldSchema,\n\ttype ImplicitFieldSchema,\n\ttype SchemaCompatibilityStatus,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype TreeFieldFromImplicitField,\n\ttype TreeView,\n\ttype TreeViewEvents,\n\tgetProxyForField,\n\ttoFlexSchema,\n\tsetField,\n\tnormalizeFieldSchema,\n\ttype InsertableContent,\n\ttype TreeViewConfiguration,\n\tmapTreeFromNodeData,\n\tprepareContentForHydration,\n} from \"../simple-tree/index.js\";\nimport { Breakable, breakingClass, disposeSymbol, type WithBreakable } from \"../util/index.js\";\n\nimport { canInitialize, ensureSchema, initialize } from \"./schematizeTree.js\";\nimport type { TreeCheckout } from \"./treeCheckout.js\";\nimport { CheckoutFlexTreeView } from \"./treeView.js\";\n\n/**\n * Implementation of TreeView wrapping a FlexTreeView.\n */\n@breakingClass\nexport class SchematizingSimpleTreeView<in out TRootSchema extends ImplicitFieldSchema>\n\timplements TreeView<TRootSchema>, WithBreakable\n{\n\t/**\n\t * The view is set to undefined when this object is disposed or the view schema does not support viewing the document's stored schema.\n\t *\n\t * The view schema may be incompatible with the stored schema. Use `compatibility` to check.\n\t */\n\tprivate view: CheckoutFlexTreeView<FlexFieldSchema> | undefined;\n\n\t/**\n\t * Undefined iff uninitialized or disposed.\n\t */\n\tprivate currentCompatibility: SchemaCompatibilityStatus | undefined;\n\tprivate readonly flexSchema: FlexTreeSchema;\n\tpublic readonly events: Listenable<TreeViewEvents> &\n\t\tIEmitter<TreeViewEvents> &\n\t\tHasListeners<TreeViewEvents> = createEmitter();\n\n\tprivate readonly viewSchema: ViewSchema;\n\n\tprivate readonly unregisterCallbacks = new Set<() => void>();\n\n\tpublic disposed = false;\n\t/**\n\t * This is set to true while an edit impacting the document schema is in progress.\n\t * This allows suppressing extra rootChanged / schemaChanged events until the edit concludes.\n\t * This is useful especially for some initialization edits, since document initialization can involve transient schemas\n\t * which are implementation details and should not be exposed to the user.\n\t */\n\tprivate midUpgrade = false;\n\n\tprivate readonly rootFieldSchema: FieldSchema;\n\n\tpublic constructor(\n\t\tpublic readonly checkout: TreeCheckout,\n\t\tpublic readonly config: TreeViewConfiguration<TRootSchema>,\n\t\tpublic readonly nodeKeyManager: NodeKeyManager,\n\t\tpublic readonly breaker: Breakable = new Breakable(\"SchematizingSimpleTreeView\"),\n\t) {\n\t\tconst policy = {\n\t\t\t...defaultSchemaPolicy,\n\t\t\tvalidateSchema: config.enableSchemaValidation,\n\t\t};\n\t\tthis.rootFieldSchema = normalizeFieldSchema(config.schema);\n\t\tthis.flexSchema = toFlexSchema(config.schema);\n\n\t\tthis.viewSchema = new ViewSchema(policy, {}, this.flexSchema);\n\t\t// This must be initialized before `update` can be called.\n\t\tthis.currentCompatibility = {\n\t\t\tcanView: false,\n\t\t\tcanUpgrade: true,\n\t\t\tisEquivalent: false,\n\t\t\tcanInitialize: true,\n\t\t};\n\t\tthis.update();\n\n\t\tthis.unregisterCallbacks.add(\n\t\t\tthis.checkout.events.on(\"commitApplied\", (data, getRevertible) =>\n\t\t\t\tthis.events.emit(\"commitApplied\", data, getRevertible),\n\t\t\t),\n\t\t);\n\t}\n\n\tpublic initialize(content: InsertableTreeFieldFromImplicitField<TRootSchema>): void {\n\t\tthis.ensureUndisposed();\n\n\t\tconst compatibility = this.compatibility;\n\t\tif (!compatibility.canInitialize) {\n\t\t\tthrow new UsageError(\"Tree cannot be initialized more than once.\");\n\t\t}\n\n\t\tthis.runSchemaEdit(() => {\n\t\t\tconst mapTree = mapTreeFromNodeData(\n\t\t\t\tcontent as InsertableContent,\n\t\t\t\tthis.rootFieldSchema.allowedTypes,\n\t\t\t\tthis.nodeKeyManager,\n\t\t\t\t{\n\t\t\t\t\tschema: this.checkout.storedSchema,\n\t\t\t\t\tpolicy: {\n\t\t\t\t\t\t...defaultSchemaPolicy,\n\t\t\t\t\t\tvalidateSchema: this.config.enableSchemaValidation,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t);\n\n\t\t\tprepareContentForHydration(mapTree, this.checkout.forest);\n\t\t\tinitialize(this.checkout, {\n\t\t\t\tschema: this.flexSchema,\n\t\t\t\tinitialTree: mapTree === undefined ? undefined : cursorForMapTreeNode(mapTree),\n\t\t\t});\n\t\t});\n\t}\n\n\tpublic upgradeSchema(): void {\n\t\tthis.ensureUndisposed();\n\n\t\tconst compatibility = this.compatibility;\n\t\tif (compatibility.isEquivalent) {\n\t\t\t// No-op\n\t\t\treturn;\n\t\t}\n\n\t\tif (!compatibility.canUpgrade) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Existing stored schema can not be upgraded (see TreeView.compatibility.canUpgrade).\",\n\t\t\t);\n\t\t}\n\n\t\tthis.runSchemaEdit(() => {\n\t\t\tconst result = ensureSchema(\n\t\t\t\tthis.viewSchema,\n\t\t\t\tAllowedUpdateType.SchemaCompatible,\n\t\t\t\tthis.checkout,\n\t\t\t\t{\n\t\t\t\t\tschema: this.flexSchema,\n\t\t\t\t\tinitialTree: undefined,\n\t\t\t\t},\n\t\t\t);\n\t\t\tassert(result, 0x8bf /* Schema upgrade should always work if canUpgrade is set. */);\n\t\t});\n\t}\n\n\t/**\n\t * Gets the view. Throws when disposed.\n\t */\n\tpublic getView(): CheckoutFlexTreeView<FlexFieldSchema> {\n\t\tthis.ensureUndisposed();\n\t\tassert(this.view !== undefined, 0x8c0 /* unexpected getViewOrError */);\n\t\treturn this.view;\n\t}\n\n\tprivate ensureUndisposed(): void {\n\t\tif (this.disposed) {\n\t\t\tthis.failDisposed();\n\t\t}\n\t}\n\n\tprivate failDisposed(): never {\n\t\tthrow new UsageError(\"Accessed a disposed TreeView.\");\n\t}\n\n\t/**\n\t * Updates `this.view` and the current compatibility status.\n\t * Invoked during initialization and when `this.view` needs to be replaced due to stored schema changes.\n\t * Handles re-registering for events to call update in the future.\n\t * @remarks\n\t * This does not check if the view needs to be replaced, it replaces it unconditionally:\n\t * callers should do any checking to detect if it's really needed before calling `update`.\n\t * @privateRemarks\n\t * This implementation avoids making any edits, which prevents it from being invoked reentrantly.\n\t * If implicit initialization (or some other edit) is desired, it should be done outside of this method.\n\t */\n\tprivate update(): void {\n\t\tthis.disposeView();\n\n\t\tconst result = this.viewSchema.checkCompatibility(this.checkout.storedSchema);\n\n\t\t// TODO: AB#8121: Weaken this check to support viewing under additional circumstances.\n\t\t// In the near term, this should support viewing documents with additional optional fields in their schema on object types.\n\t\t// Longer-term (as demand arises), we could also add APIs to constructing view schema to allow for more flexibility\n\t\t// (e.g. out-of-schema content handlers could allow support for viewing docs which have extra allowed types in a particular field)\n\t\tconst canView =\n\t\t\tresult.write === Compatibility.Compatible && result.read === Compatibility.Compatible;\n\t\tconst canUpgrade = result.read === Compatibility.Compatible;\n\t\tconst isEquivalent = canView && canUpgrade;\n\t\tconst compatibility: SchemaCompatibilityStatus = {\n\t\t\tcanView,\n\t\t\tcanUpgrade,\n\t\t\tisEquivalent,\n\t\t\tcanInitialize: canInitialize(this.checkout),\n\t\t};\n\t\tlet lastRoot =\n\t\t\tthis.compatibility.canView && this.view !== undefined ? this.root : undefined;\n\t\tthis.currentCompatibility = compatibility;\n\n\t\tif (compatibility.canView) {\n\t\t\t// Trigger \"rootChanged\" if the root changes in the future.\n\t\t\t// Currently there is no good way to do this as FlexTreeField has no events for changes.\n\t\t\t// this.view.flexTree.on(????)\n\t\t\t// As a workaround for the above, trigger \"rootChanged\" in \"afterBatch\"\n\t\t\t// which isn't the correct time since we normally do events during the batch when the forest is modified, but its better than nothing.\n\t\t\t// TODO: provide a better event: this.view.flexTree.on(????)\n\t\t\tconst cleanupCheckOutEvents = this.checkout.events.on(\"afterBatch\", () => {\n\t\t\t\t// In the initialization flow, this event is raised before the correct compatibility w.r.t the new schema is calculated.\n\t\t\t\t// Accessing `this.root` in that case can throw. It's OK to ignore this because:\n\t\t\t\t// - The rootChanged event will already be raised at the end of the current upgrade\n\t\t\t\t// - It doesn't matter that `lastRoot` isn't updated in this case, because `update` will be called again before the upgrade\n\t\t\t\t// completes (at which point this callback and the `lastRoot` captured here will be out of scope anyway)\n\t\t\t\tif (!this.midUpgrade && lastRoot !== this.root) {\n\t\t\t\t\tlastRoot = this.root;\n\t\t\t\t\tthis.events.emit(\"rootChanged\");\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tconst onViewDispose = (): void => {\n\t\t\t\tcleanupCheckOutEvents();\n\t\t\t\tthis.view = undefined;\n\t\t\t\tif (!this.disposed) {\n\t\t\t\t\tthis.update();\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tthis.view = requireSchema(\n\t\t\t\tthis.checkout,\n\t\t\t\tthis.viewSchema,\n\t\t\t\tonViewDispose,\n\t\t\t\tthis.nodeKeyManager,\n\t\t\t);\n\t\t} else {\n\t\t\tthis.view = undefined;\n\n\t\t\tconst unregister = this.checkout.storedSchema.on(\"afterSchemaChange\", () => {\n\t\t\t\tunregister();\n\t\t\t\tthis.unregisterCallbacks.delete(unregister);\n\t\t\t\tthis.update();\n\t\t\t});\n\t\t\tthis.unregisterCallbacks.add(unregister);\n\t\t}\n\n\t\tif (!this.midUpgrade) {\n\t\t\tthis.events.emit(\"schemaChanged\");\n\t\t\tthis.events.emit(\"rootChanged\");\n\t\t}\n\t}\n\n\tprivate runSchemaEdit(edit: () => void): void {\n\t\tthis.midUpgrade = true;\n\t\ttry {\n\t\t\tedit();\n\t\t} finally {\n\t\t\tthis.midUpgrade = false;\n\t\t}\n\t\tthis.events.emit(\"schemaChanged\");\n\t\tthis.events.emit(\"rootChanged\");\n\t}\n\n\tprivate disposeView(): void {\n\t\tif (this.view !== undefined) {\n\t\t\tthis.view[disposeSymbol]();\n\t\t\tthis.view = undefined;\n\t\t\tthis.unregisterCallbacks.forEach((unregister) => unregister());\n\t\t}\n\t}\n\n\tpublic get compatibility(): SchemaCompatibilityStatus {\n\t\tif (!this.currentCompatibility) {\n\t\t\tthis.failDisposed();\n\t\t}\n\t\treturn this.currentCompatibility;\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.disposed = true;\n\t\tthis.disposeView();\n\t\tthis.currentCompatibility = undefined;\n\t}\n\n\tpublic get root(): TreeFieldFromImplicitField<TRootSchema> {\n\t\tthis.breaker.use();\n\t\tif (!this.compatibility.canView) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Document is out of schema. Check TreeView.compatibility before accessing TreeView.root.\",\n\t\t\t);\n\t\t}\n\t\tconst view = this.getView();\n\t\treturn getProxyForField(view.flexTree) as TreeFieldFromImplicitField<TRootSchema>;\n\t}\n\n\tpublic set root(newRoot: InsertableTreeFieldFromImplicitField<TRootSchema>) {\n\t\tthis.breaker.use();\n\t\tif (!this.compatibility.canView) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Document is out of schema. Check TreeView.compatibility before accessing TreeView.root.\",\n\t\t\t);\n\t\t}\n\t\tconst view = this.getView();\n\t\tsetField(view.context.root, this.rootFieldSchema, newRoot as InsertableContent);\n\t}\n}\n\n/**\n * Creates a view that self-disposes whenenever the stored schema changes.\n * This may only be called when the schema is already known to be compatible (typically via ensureSchema).\n */\nexport function requireSchema<TRoot extends FlexFieldSchema>(\n\tcheckout: TreeCheckout,\n\tviewSchema: ViewSchema<TRoot>,\n\tonDispose: () => void,\n\tnodeKeyManager: NodeKeyManager,\n): CheckoutFlexTreeView<TRoot> {\n\tconst slots = checkout.forest.anchors.slots;\n\tassert(!slots.has(ContextSlot), 0x8c2 /* Cannot create second view from checkout */);\n\n\t{\n\t\tconst compatibility = viewSchema.checkCompatibility(checkout.storedSchema);\n\t\tassert(\n\t\t\tcompatibility.write === Compatibility.Compatible &&\n\t\t\t\tcompatibility.read === Compatibility.Compatible,\n\t\t\t0x8c3 /* requireSchema invoked with incompatible schema */,\n\t\t);\n\t}\n\n\tconst view = new CheckoutFlexTreeView(\n\t\tcheckout,\n\t\tviewSchema.schema,\n\t\tnodeKeyManager,\n\t\tonDispose,\n\t);\n\tassert(slots.has(ContextSlot), 0x90d /* Context should be tracked in slot */);\n\n\tconst unregister = checkout.storedSchema.on(\"afterSchemaChange\", () => {\n\t\tunregister();\n\t\tview[disposeSymbol]();\n\t});\n\n\treturn view;\n}\n"]}
1
+ {"version":3,"file":"schematizingTreeView.js","sourceRoot":"","sources":["../../src/shared-tree/schematizingTreeView.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kEAA6D;AAC7D,uEAAsE;AAEtE,+CAAoE;AACpE,iDAK4B;AAC5B,4DAQuC;AACvC,sDAgBiC;AACjC,+CAA+F;AAE/F,2DAA8E;AAE9E,+CAAqD;AAErD;;GAEG;IAEU,0BAA0B;4BADtC,wBAAa;;;;;QAmCb,YACiB,QAAuB,EACvB,MAA0C,EAC1C,cAA8B,EAC9B,UAAqB,IAAI,oBAAS,CAAC,4BAA4B,CAAC;YAHhE,aAAQ,GAAR,QA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Aa,CAAC,KAAK,KAAK,wBAAa,CAAC,UAAU;YAC/C,aAAa,CAAC,IAAI,KAAK,wBAAa,CAAC,UAAU,EAChD,KAAK,CAAC,oDAAoD,CAC1D,CAAC;IACH,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,kCAAoB,CACpC,QAAQ,EACR,UAAU,CAAC,MAAM,EACjB,cAAc,EACd,SAAS,CACT,CAAC;IACF,IAAA,iBAAM,EAAC,KAAK,CAAC,GAAG,CAAC,sBAAW,CAAC,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAE9E,MAAM,UAAU,GAAG,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;QACrE,UAAU,EAAE,CAAC;QACb,IAAI,CAAC,wBAAa,CAAC,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACb,CAAC;AAhCD,sCAgCC","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 { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { AllowedUpdateType, Compatibility } from \"../core/index.js\";\nimport {\n\ttype HasListeners,\n\ttype IEmitter,\n\ttype Listenable,\n\tcreateEmitter,\n} from \"../events/index.js\";\nimport {\n\ttype FlexFieldSchema,\n\ttype NodeKeyManager,\n\tViewSchema,\n\tdefaultSchemaPolicy,\n\tContextSlot,\n\tcursorForMapTreeNode,\n\ttype FlexTreeSchema,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype FieldSchema,\n\ttype ImplicitFieldSchema,\n\ttype SchemaCompatibilityStatus,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype TreeFieldFromImplicitField,\n\ttype TreeView,\n\ttype TreeViewEvents,\n\tgetTreeNodeForField,\n\ttoFlexSchema,\n\tsetField,\n\tnormalizeFieldSchema,\n\ttype InsertableContent,\n\ttype TreeViewConfiguration,\n\tmapTreeFromNodeData,\n\tprepareContentForHydration,\n} from \"../simple-tree/index.js\";\nimport { Breakable, breakingClass, disposeSymbol, type WithBreakable } from \"../util/index.js\";\n\nimport { canInitialize, ensureSchema, initialize } from \"./schematizeTree.js\";\nimport type { ITreeCheckout } from \"./treeCheckout.js\";\nimport { CheckoutFlexTreeView } from \"./treeView.js\";\n\n/**\n * Implementation of TreeView wrapping a FlexTreeView.\n */\n@breakingClass\nexport class SchematizingSimpleTreeView<in out TRootSchema extends ImplicitFieldSchema>\n\timplements TreeView<TRootSchema>, WithBreakable\n{\n\t/**\n\t * The view is set to undefined when this object is disposed or the view schema does not support viewing the document's stored schema.\n\t *\n\t * The view schema may be incompatible with the stored schema. Use `compatibility` to check.\n\t */\n\tprivate view: CheckoutFlexTreeView<FlexFieldSchema> | undefined;\n\n\t/**\n\t * Undefined iff uninitialized or disposed.\n\t */\n\tprivate currentCompatibility: SchemaCompatibilityStatus | undefined;\n\tprivate readonly flexSchema: FlexTreeSchema;\n\tpublic readonly events: Listenable<TreeViewEvents> &\n\t\tIEmitter<TreeViewEvents> &\n\t\tHasListeners<TreeViewEvents> = createEmitter();\n\n\tprivate readonly viewSchema: ViewSchema;\n\n\tprivate readonly unregisterCallbacks = new Set<() => void>();\n\n\tpublic disposed = false;\n\t/**\n\t * This is set to true while an edit impacting the document schema is in progress.\n\t * This allows suppressing extra rootChanged / schemaChanged events until the edit concludes.\n\t * This is useful especially for some initialization edits, since document initialization can involve transient schemas\n\t * which are implementation details and should not be exposed to the user.\n\t */\n\tprivate midUpgrade = false;\n\n\tprivate readonly rootFieldSchema: FieldSchema;\n\n\tpublic constructor(\n\t\tpublic readonly checkout: ITreeCheckout,\n\t\tpublic readonly config: TreeViewConfiguration<TRootSchema>,\n\t\tpublic readonly nodeKeyManager: NodeKeyManager,\n\t\tpublic readonly breaker: Breakable = new Breakable(\"SchematizingSimpleTreeView\"),\n\t) {\n\t\tconst policy = {\n\t\t\t...defaultSchemaPolicy,\n\t\t\tvalidateSchema: config.enableSchemaValidation,\n\t\t};\n\t\tthis.rootFieldSchema = normalizeFieldSchema(config.schema);\n\t\tthis.flexSchema = toFlexSchema(config.schema);\n\n\t\tthis.viewSchema = new ViewSchema(policy, {}, this.flexSchema);\n\t\t// This must be initialized before `update` can be called.\n\t\tthis.currentCompatibility = {\n\t\t\tcanView: false,\n\t\t\tcanUpgrade: true,\n\t\t\tisEquivalent: false,\n\t\t\tcanInitialize: true,\n\t\t};\n\t\tthis.update();\n\n\t\tthis.unregisterCallbacks.add(\n\t\t\tthis.checkout.events.on(\"commitApplied\", (data, getRevertible) =>\n\t\t\t\tthis.events.emit(\"commitApplied\", data, getRevertible),\n\t\t\t),\n\t\t);\n\t}\n\n\tpublic initialize(content: InsertableTreeFieldFromImplicitField<TRootSchema>): void {\n\t\tthis.ensureUndisposed();\n\n\t\tconst compatibility = this.compatibility;\n\t\tif (!compatibility.canInitialize) {\n\t\t\tthrow new UsageError(\"Tree cannot be initialized more than once.\");\n\t\t}\n\n\t\tthis.runSchemaEdit(() => {\n\t\t\tconst mapTree = mapTreeFromNodeData(\n\t\t\t\tcontent as InsertableContent,\n\t\t\t\tthis.rootFieldSchema,\n\t\t\t\tthis.nodeKeyManager,\n\t\t\t\t{\n\t\t\t\t\tschema: this.checkout.storedSchema,\n\t\t\t\t\tpolicy: {\n\t\t\t\t\t\t...defaultSchemaPolicy,\n\t\t\t\t\t\tvalidateSchema: this.config.enableSchemaValidation,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t);\n\n\t\t\tprepareContentForHydration(mapTree, this.checkout.forest);\n\t\t\tinitialize(this.checkout, {\n\t\t\t\tschema: this.flexSchema,\n\t\t\t\tinitialTree: mapTree === undefined ? undefined : cursorForMapTreeNode(mapTree),\n\t\t\t});\n\t\t});\n\t}\n\n\tpublic upgradeSchema(): void {\n\t\tthis.ensureUndisposed();\n\n\t\tconst compatibility = this.compatibility;\n\t\tif (compatibility.isEquivalent) {\n\t\t\t// No-op\n\t\t\treturn;\n\t\t}\n\n\t\tif (!compatibility.canUpgrade) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Existing stored schema can not be upgraded (see TreeView.compatibility.canUpgrade).\",\n\t\t\t);\n\t\t}\n\n\t\tthis.runSchemaEdit(() => {\n\t\t\tconst result = ensureSchema(\n\t\t\t\tthis.viewSchema,\n\t\t\t\tAllowedUpdateType.SchemaCompatible,\n\t\t\t\tthis.checkout,\n\t\t\t\t{\n\t\t\t\t\tschema: this.flexSchema,\n\t\t\t\t\tinitialTree: undefined,\n\t\t\t\t},\n\t\t\t);\n\t\t\tassert(result, 0x8bf /* Schema upgrade should always work if canUpgrade is set. */);\n\t\t});\n\t}\n\n\t/**\n\t * Gets the view. Throws when disposed.\n\t */\n\tpublic getView(): CheckoutFlexTreeView<FlexFieldSchema> {\n\t\tthis.ensureUndisposed();\n\t\tassert(this.view !== undefined, 0x8c0 /* unexpected getViewOrError */);\n\t\treturn this.view;\n\t}\n\n\tprivate ensureUndisposed(): void {\n\t\tif (this.disposed) {\n\t\t\tthis.failDisposed();\n\t\t}\n\t}\n\n\tprivate failDisposed(): never {\n\t\tthrow new UsageError(\"Accessed a disposed TreeView.\");\n\t}\n\n\t/**\n\t * Updates `this.view` and the current compatibility status.\n\t * Invoked during initialization and when `this.view` needs to be replaced due to stored schema changes.\n\t * Handles re-registering for events to call update in the future.\n\t * @remarks\n\t * This does not check if the view needs to be replaced, it replaces it unconditionally:\n\t * callers should do any checking to detect if it's really needed before calling `update`.\n\t * @privateRemarks\n\t * This implementation avoids making any edits, which prevents it from being invoked reentrantly.\n\t * If implicit initialization (or some other edit) is desired, it should be done outside of this method.\n\t */\n\tprivate update(): void {\n\t\tthis.disposeView();\n\n\t\tconst result = this.viewSchema.checkCompatibility(this.checkout.storedSchema);\n\n\t\t// TODO: AB#8121: Weaken this check to support viewing under additional circumstances.\n\t\t// In the near term, this should support viewing documents with additional optional fields in their schema on object types.\n\t\t// Longer-term (as demand arises), we could also add APIs to constructing view schema to allow for more flexibility\n\t\t// (e.g. out-of-schema content handlers could allow support for viewing docs which have extra allowed types in a particular field)\n\t\tconst canView =\n\t\t\tresult.write === Compatibility.Compatible && result.read === Compatibility.Compatible;\n\t\tconst canUpgrade = result.read === Compatibility.Compatible;\n\t\tconst isEquivalent = canView && canUpgrade;\n\t\tconst compatibility: SchemaCompatibilityStatus = {\n\t\t\tcanView,\n\t\t\tcanUpgrade,\n\t\t\tisEquivalent,\n\t\t\tcanInitialize: canInitialize(this.checkout),\n\t\t};\n\t\tlet lastRoot =\n\t\t\tthis.compatibility.canView && this.view !== undefined ? this.root : undefined;\n\t\tthis.currentCompatibility = compatibility;\n\n\t\tif (compatibility.canView) {\n\t\t\t// Trigger \"rootChanged\" if the root changes in the future.\n\t\t\t// Currently there is no good way to do this as FlexTreeField has no events for changes.\n\t\t\t// this.view.flexTree.on(????)\n\t\t\t// As a workaround for the above, trigger \"rootChanged\" in \"afterBatch\"\n\t\t\t// which isn't the correct time since we normally do events during the batch when the forest is modified, but its better than nothing.\n\t\t\t// TODO: provide a better event: this.view.flexTree.on(????)\n\t\t\tconst cleanupCheckOutEvents = this.checkout.events.on(\"afterBatch\", () => {\n\t\t\t\t// In the initialization flow, this event is raised before the correct compatibility w.r.t the new schema is calculated.\n\t\t\t\t// Accessing `this.root` in that case can throw. It's OK to ignore this because:\n\t\t\t\t// - The rootChanged event will already be raised at the end of the current upgrade\n\t\t\t\t// - It doesn't matter that `lastRoot` isn't updated in this case, because `update` will be called again before the upgrade\n\t\t\t\t// completes (at which point this callback and the `lastRoot` captured here will be out of scope anyway)\n\t\t\t\tif (!this.midUpgrade && lastRoot !== this.root) {\n\t\t\t\t\tlastRoot = this.root;\n\t\t\t\t\tthis.events.emit(\"rootChanged\");\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tconst onViewDispose = (): void => {\n\t\t\t\tcleanupCheckOutEvents();\n\t\t\t\tthis.view = undefined;\n\t\t\t\tif (!this.disposed) {\n\t\t\t\t\tthis.update();\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tthis.view = requireSchema(\n\t\t\t\tthis.checkout,\n\t\t\t\tthis.viewSchema,\n\t\t\t\tonViewDispose,\n\t\t\t\tthis.nodeKeyManager,\n\t\t\t);\n\t\t} else {\n\t\t\tthis.view = undefined;\n\n\t\t\tconst unregister = this.checkout.storedSchema.on(\"afterSchemaChange\", () => {\n\t\t\t\tunregister();\n\t\t\t\tthis.unregisterCallbacks.delete(unregister);\n\t\t\t\tthis.update();\n\t\t\t});\n\t\t\tthis.unregisterCallbacks.add(unregister);\n\t\t}\n\n\t\tif (!this.midUpgrade) {\n\t\t\tthis.events.emit(\"schemaChanged\");\n\t\t\tthis.events.emit(\"rootChanged\");\n\t\t}\n\t}\n\n\tprivate runSchemaEdit(edit: () => void): void {\n\t\tthis.midUpgrade = true;\n\t\ttry {\n\t\t\tedit();\n\t\t} finally {\n\t\t\tthis.midUpgrade = false;\n\t\t}\n\t\tthis.events.emit(\"schemaChanged\");\n\t\tthis.events.emit(\"rootChanged\");\n\t}\n\n\tprivate disposeView(): void {\n\t\tif (this.view !== undefined) {\n\t\t\tthis.view[disposeSymbol]();\n\t\t\tthis.view = undefined;\n\t\t\tthis.unregisterCallbacks.forEach((unregister) => unregister());\n\t\t}\n\t}\n\n\tpublic get compatibility(): SchemaCompatibilityStatus {\n\t\tif (!this.currentCompatibility) {\n\t\t\tthis.failDisposed();\n\t\t}\n\t\treturn this.currentCompatibility;\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.disposed = true;\n\t\tthis.disposeView();\n\t\tthis.currentCompatibility = undefined;\n\t}\n\n\tpublic get root(): TreeFieldFromImplicitField<TRootSchema> {\n\t\tthis.breaker.use();\n\t\tif (!this.compatibility.canView) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Document is out of schema. Check TreeView.compatibility before accessing TreeView.root.\",\n\t\t\t);\n\t\t}\n\t\tconst view = this.getView();\n\t\treturn getTreeNodeForField(view.flexTree) as TreeFieldFromImplicitField<TRootSchema>;\n\t}\n\n\tpublic set root(newRoot: InsertableTreeFieldFromImplicitField<TRootSchema>) {\n\t\tthis.breaker.use();\n\t\tif (!this.compatibility.canView) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Document is out of schema. Check TreeView.compatibility before accessing TreeView.root.\",\n\t\t\t);\n\t\t}\n\t\tconst view = this.getView();\n\t\tsetField(view.context.root, this.rootFieldSchema, newRoot as InsertableContent);\n\t}\n}\n\n/**\n * Creates a view that self-disposes whenenever the stored schema changes.\n * This may only be called when the schema is already known to be compatible (typically via ensureSchema).\n */\nexport function requireSchema<TRoot extends FlexFieldSchema>(\n\tcheckout: ITreeCheckout,\n\tviewSchema: ViewSchema<TRoot>,\n\tonDispose: () => void,\n\tnodeKeyManager: NodeKeyManager,\n): CheckoutFlexTreeView<TRoot> {\n\tconst slots = checkout.forest.anchors.slots;\n\tassert(!slots.has(ContextSlot), 0x8c2 /* Cannot create second view from checkout */);\n\n\t{\n\t\tconst compatibility = viewSchema.checkCompatibility(checkout.storedSchema);\n\t\tassert(\n\t\t\tcompatibility.write === Compatibility.Compatible &&\n\t\t\t\tcompatibility.read === Compatibility.Compatible,\n\t\t\t0x8c3 /* requireSchema invoked with incompatible schema */,\n\t\t);\n\t}\n\n\tconst view = new CheckoutFlexTreeView(\n\t\tcheckout,\n\t\tviewSchema.schema,\n\t\tnodeKeyManager,\n\t\tonDispose,\n\t);\n\tassert(slots.has(ContextSlot), 0x90d /* Context should be tracked in slot */);\n\n\tconst unregister = checkout.storedSchema.on(\"afterSchemaChange\", () => {\n\t\tunregister();\n\t\tview[disposeSymbol]();\n\t});\n\n\treturn view;\n}\n"]}
@@ -6,15 +6,13 @@ import type { IChannelAttributes, IChannelFactory, IFluidDataStoreRuntime, IChan
6
6
  import type { ISharedObject } from "@fluidframework/shared-object-base/internal";
7
7
  import { type ICodecOptions } from "../codec/index.js";
8
8
  import { type JsonableTree, type TreeStoredSchema, TreeStoredSchemaRepository } from "../core/index.js";
9
- import { type FlexFieldSchema, TreeCompressionStrategy } from "../feature-libraries/index.js";
9
+ import { TreeCompressionStrategy } from "../feature-libraries/index.js";
10
10
  import { SharedTreeCore } from "../shared-tree-core/index.js";
11
11
  import type { ITree, ImplicitFieldSchema, TreeViewConfiguration } from "../simple-tree/index.js";
12
- import { type InitializeAndSchematizeConfiguration } from "./schematizeTree.js";
13
12
  import { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
14
13
  import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
15
14
  import type { SharedTreeEditBuilder } from "./sharedTreeEditBuilder.js";
16
15
  import { type TreeCheckout } from "./treeCheckout.js";
17
- import type { CheckoutFlexTreeView, FlexTreeView } from "./treeView.js";
18
16
  /**
19
17
  * Copy of data from an {@link ISharedTree} at some point in time.
20
18
  * @remarks
@@ -31,19 +29,16 @@ export interface SharedTreeContentSnapshot {
31
29
  */
32
30
  readonly schema: TreeStoredSchema;
33
31
  /**
34
- * All {@link TreeStatus#InDocument} content.
32
+ * All {@link TreeStatus.InDocument} content.
35
33
  */
36
34
  readonly tree: JsonableTree[];
37
35
  /**
38
- * All {@link TreeStatus#Removed} content.
36
+ * All {@link TreeStatus.Removed} content.
39
37
  */
40
38
  readonly removed: [string | number | undefined, number, JsonableTree][];
41
39
  }
42
40
  /**
43
- * Collaboratively editable tree distributed data-structure,
44
- * powered by {@link @fluidframework/shared-object-base#ISharedObject}.
45
- *
46
- * See [the README](../../README.md) for details.
41
+ * {@link ITree} extended with some non-public APIs.
47
42
  * @internal
48
43
  */
49
44
  export interface ISharedTree extends ISharedObject, ITree {
@@ -55,13 +50,6 @@ export interface ISharedTree extends ISharedObject, ITree {
55
50
  * This does not include everything that is included in a tree summary, since information about how to merge future edits is omitted.
56
51
  */
57
52
  contentSnapshot(): SharedTreeContentSnapshot;
58
- /**
59
- * Like {@link ITree.viewWith}, but uses the flex-tree schema system and exposes the tree as a flex-tree.
60
- *
61
- * Returned view is disposed when the stored schema becomes incompatible with the view schema.
62
- * Undefined is returned if the stored data could not be made compatible with the view schema.
63
- */
64
- schematizeFlexTree<TRoot extends FlexFieldSchema>(config: InitializeAndSchematizeConfiguration<TRoot>, onDispose: () => void): FlexTreeView<TRoot> | undefined;
65
53
  }
66
54
  /**
67
55
  * Shared tree, configured with a good set of indexes and field kinds which will maintain compatibility over time.
@@ -74,7 +62,6 @@ export declare class SharedTree extends SharedTreeCore<SharedTreeEditBuilder, Sh
74
62
  get storedSchema(): TreeStoredSchemaRepository;
75
63
  constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes, optionsParam: SharedTreeOptions, telemetryContextPrefix?: string);
76
64
  contentSnapshot(): SharedTreeContentSnapshot;
77
- schematizeFlexTree<TRoot extends FlexFieldSchema>(config: InitializeAndSchematizeConfiguration<TRoot>, onDispose: () => void): CheckoutFlexTreeView<TRoot> | undefined;
78
65
  viewWith<TRoot extends ImplicitFieldSchema>(config: TreeViewConfiguration<TRoot>): SchematizingSimpleTreeView<TRoot>;
79
66
  protected loadCore(services: IChannelStorageService): Promise<void>;
80
67
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTree.d.ts","sourceRoot":"","sources":["../../src/shared-tree/sharedTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACX,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,EACtB,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAGjF,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,mBAAmB,CAAC;AACtE,OAAO,EACN,KAAK,YAAY,EAEjB,KAAK,gBAAgB,EACrB,0BAA0B,EAG1B,MAAM,kBAAkB,CAAC;AAO1B,OAAO,EAEN,KAAK,eAAe,EAGpB,uBAAuB,EAUvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAGN,cAAc,EACd,MAAM,8BAA8B,CAAC;AACt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BAAuB,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC,GACrD,OAAO,CAAC,uBAAuB,CAAC,GAAG;IAClC;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;CACpB,CAAC;AAEH;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACvC;;;OAGG;IACH,cAAc,EAAE,uBAAuB,CAAC;IACxC;;;;;;;;;;OAUG;IACH,aAAa,EAAE,uBAAuB,CAAC,MAAM,uBAAuB,CAAC,CAAC;CACtE;AAED;;;GAGG;AACH,oBAAY,UAAU;IACrB;;OAEG;IACH,SAAS,IAAI;IACb;;OAEG;IACH,SAAS,IAAI;IACb;;OAEG;IACH,SAAS,IAAI;CACb;AAED,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,iBAAiB,CAKhE,CAAC;AAEF;;GAEG;AACH,qBAAa,iBAAkB,YAAW,eAAe,CAAC,WAAW,CAAC;IASlD,OAAO,CAAC,QAAQ,CAAC,OAAO;IAR3C,SAAgB,IAAI,EAAE,MAAM,CAA4C;IAExE,SAAgB,UAAU,EAAE,kBAAkB,CAI5C;gBAEkC,OAAO,GAAE,iBAAsB;IAEtD,IAAI,CAChB,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,iBAAiB,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GAC7C,OAAO,CAAC,UAAU,CAAC;IAMf,MAAM,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,UAAU;CAKtE"}
@@ -50,7 +50,6 @@ const index_js_2 = require("../core/index.js");
50
50
  const index_js_3 = require("../events/index.js");
51
51
  const index_js_4 = require("../feature-libraries/index.js");
52
52
  const index_js_5 = require("../shared-tree-core/index.js");
53
- const schematizeTree_js_1 = require("./schematizeTree.js");
54
53
  const schematizingTreeView_js_1 = require("./schematizingTreeView.js");
55
54
  const sharedTreeChangeEnricher_js_1 = require("./sharedTreeChangeEnricher.js");
56
55
  const sharedTreeChangeFamily_js_1 = require("./sharedTreeChangeFamily.js");
@@ -69,6 +68,10 @@ const formatVersionToTopLevelCodecVersions = new Map([
69
68
  3,
70
69
  { forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 3, message: 3, fieldBatch: 1 },
71
70
  ],
71
+ [
72
+ 4,
73
+ { forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 4, message: 4, fieldBatch: 1 },
74
+ ],
72
75
  ]);
73
76
  function getCodecVersions(formatVersion) {
74
77
  const versions = formatVersionToTopLevelCodecVersions.get(formatVersion);
@@ -171,13 +174,6 @@ let SharedTree = (() => {
171
174
  cursor.free();
172
175
  }
173
176
  }
174
- schematizeFlexTree(config, onDispose) {
175
- const viewSchema = new index_js_4.ViewSchema(index_js_4.defaultSchemaPolicy, {}, config.schema);
176
- if (!(0, schematizeTree_js_1.ensureSchema)(viewSchema, config.allowedSchemaModifications, this.checkout, config)) {
177
- return undefined;
178
- }
179
- return (0, schematizingTreeView_js_1.requireSchema)(this.checkout, viewSchema, onDispose, (0, index_js_4.createNodeKeyManager)(this.runtime.idCompressor));
180
- }
181
177
  viewWith(config) {
182
178
  return new schematizingTreeView_js_1.SchematizingSimpleTreeView(this.checkout, config, (0, index_js_4.createNodeKeyManager)(this.runtime.idCompressor), this.breaker);
183
179
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTree.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kEAA6D;AAS7D,uEAAsE;AAEtE,gDAAsE;AACtE,+CAO0B;AAC1B,iDAK4B;AAC5B,4DAeuC;AACvC,2DAIsC;AAOtC,2DAA8F;AAC9F,uEAAsF;AACtF,+EAAiF;AACjF,2EAAqE;AAGrE,uDAA+F;AAE/F,+CAAgE;AAyEhE,MAAM,oC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,IAAI;YACf,qBAAqB,EAAE,OAAO;YAC9B,cAAc,EAAE,OAAO;SACvB,CAAC;IAEoE,CAAC;IAEhE,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,iBAA+C;QAE/C,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,EAAE,EAAE,OAAO,EAAE,iBAAiB,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1E,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1B,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,MAAM,CAAC,OAA+B,EAAE,EAAU;QACxD,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACxE,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AA3BD,8CA2BC","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 type {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type { ISharedObject } from \"@fluidframework/shared-object-base/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { type ICodecOptions, noopValidator } from \"../codec/index.js\";\nimport {\n\ttype JsonableTree,\n\tRevisionTagCodec,\n\ttype TreeStoredSchema,\n\tTreeStoredSchemaRepository,\n\tmakeDetachedFieldIndex,\n\tmoveToDetachedField,\n} from \"../core/index.js\";\nimport {\n\ttype HasListeners,\n\ttype IEmitter,\n\ttype Listenable,\n\tcreateEmitter,\n} from \"../events/index.js\";\nimport {\n\tDetachedFieldIndexSummarizer,\n\ttype FlexFieldSchema,\n\tForestSummarizer,\n\tSchemaSummarizer,\n\tTreeCompressionStrategy,\n\tViewSchema,\n\tbuildChunkedForest,\n\tbuildForest,\n\tcreateNodeKeyManager,\n\tdefaultSchemaPolicy,\n\tjsonableTreeFromFieldCursor,\n\tmakeFieldBatchCodec,\n\tmakeMitigatedChangeFamily,\n\tmakeTreeChunker,\n} from \"../feature-libraries/index.js\";\nimport {\n\tDefaultResubmitMachine,\n\ttype ExplicitCoreCodecVersions,\n\tSharedTreeCore,\n} from \"../shared-tree-core/index.js\";\nimport type {\n\tITree,\n\tImplicitFieldSchema,\n\tTreeViewConfiguration,\n} from \"../simple-tree/index.js\";\n\nimport { type InitializeAndSchematizeConfiguration, ensureSchema } from \"./schematizeTree.js\";\nimport { SchematizingSimpleTreeView, requireSchema } from \"./schematizingTreeView.js\";\nimport { SharedTreeReadonlyChangeEnricher } from \"./sharedTreeChangeEnricher.js\";\nimport { SharedTreeChangeFamily } from \"./sharedTreeChangeFamily.js\";\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\nimport type { SharedTreeEditBuilder } from \"./sharedTreeEditBuilder.js\";\nimport { type CheckoutEvents, type TreeCheckout, createTreeCheckout } from \"./treeCheckout.js\";\nimport type { CheckoutFlexTreeView, FlexTreeView } from \"./treeView.js\";\nimport { breakingClass, throwIfBroken } from \"../util/index.js\";\n\n/**\n * Copy of data from an {@link ISharedTree} at some point in time.\n * @remarks\n * This is unrelated to Fluids concept of \"snapshots\".\n * @internal\n */\nexport interface SharedTreeContentSnapshot {\n\t/**\n\t * The schema stored in the document.\n\t *\n\t * @remarks\n\t * Edits to the schema can mutate the schema stored of the tree which took this snapshot (but this snapshot will remain the same)\n\t * This is mainly useful for debugging cases where schematize reports an incompatible view schema.\n\t */\n\treadonly schema: TreeStoredSchema;\n\t/**\n\t * All {@link TreeStatus#InDocument} content.\n\t */\n\treadonly tree: JsonableTree[];\n\t/**\n\t * All {@link TreeStatus#Removed} content.\n\t */\n\treadonly removed: [string | number | undefined, number, JsonableTree][];\n}\n\n/**\n * Collaboratively editable tree distributed data-structure,\n * powered by {@link @fluidframework/shared-object-base#ISharedObject}.\n *\n * See [the README](../../README.md) for details.\n * @internal\n */\nexport interface ISharedTree extends ISharedObject, ITree {\n\t/**\n\t * Provides a copy of the current content of the tree.\n\t * This can be useful for inspecting the tree when no suitable view schema is available.\n\t * This is only intended for use in testing and exceptional code paths: it is not performant.\n\t *\n\t * This does not include everything that is included in a tree summary, since information about how to merge future edits is omitted.\n\t */\n\tcontentSnapshot(): SharedTreeContentSnapshot;\n\n\t/**\n\t * Like {@link ITree.viewWith}, but uses the flex-tree schema system and exposes the tree as a flex-tree.\n\t *\n\t * Returned view is disposed when the stored schema becomes incompatible with the view schema.\n\t * Undefined is returned if the stored data could not be made compatible with the view schema.\n\t */\n\tschematizeFlexTree<TRoot extends FlexFieldSchema>(\n\t\tconfig: InitializeAndSchematizeConfiguration<TRoot>,\n\t\tonDispose: () => void,\n\t): FlexTreeView<TRoot> | undefined;\n}\n\n/**\n * Has an entry for each codec which writes an explicit version into its data.\n *\n * This is used to map the single API entrypoint controlling the format {@link SharedTreeOptions.formatVersion}\n * to a list of write versions that for each codec that should be used for that format.\n *\n * Note that all explicitly versioned codecs should be using the format version from the data to read encoded data.\n *\n * TODO: Plumb these write versions into forest, schema, detached field index codec creation.\n */\ninterface ExplicitCodecVersions extends ExplicitCoreCodecVersions {\n\tforest: number;\n\tschema: number;\n\tdetachedFieldIndex: number;\n\tfieldBatch: number;\n}\n\nconst formatVersionToTopLevelCodecVersions = new Map<number, ExplicitCodecVersions>([\n\t[\n\t\t1,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 1, message: 1, fieldBatch: 1 },\n\t],\n\t[\n\t\t2,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 2, message: 2, fieldBatch: 1 },\n\t],\n\t[\n\t\t3,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 3, message: 3, fieldBatch: 1 },\n\t],\n]);\n\nfunction getCodecVersions(formatVersion: number): ExplicitCodecVersions {\n\tconst versions = formatVersionToTopLevelCodecVersions.get(formatVersion);\n\tassert(versions !== undefined, 0x90e /* Unknown format version */);\n\treturn versions;\n}\n\n/**\n * Shared tree, configured with a good set of indexes and field kinds which will maintain compatibility over time.\n *\n * TODO: detail compatibility requirements.\n */\n@breakingClass\nexport class SharedTree\n\textends SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>\n\timplements ISharedTree\n{\n\tprivate readonly _events: Listenable<CheckoutEvents> &\n\t\tIEmitter<CheckoutEvents> &\n\t\tHasListeners<CheckoutEvents>;\n\tpublic readonly checkout: TreeCheckout;\n\tpublic get storedSchema(): TreeStoredSchemaRepository {\n\t\treturn this.checkout.storedSchema;\n\t}\n\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t\toptionsParam: SharedTreeOptions,\n\t\ttelemetryContextPrefix: string = \"fluid_sharedTree_\",\n\t) {\n\t\tif (runtime.idCompressor === undefined) {\n\t\t\tthrow new UsageError(\"IdCompressor must be enabled to use SharedTree\");\n\t\t}\n\n\t\tconst options = { ...defaultSharedTreeOptions, ...optionsParam };\n\t\tconst codecVersions = getCodecVersions(options.formatVersion);\n\t\tconst schema = new TreeStoredSchemaRepository();\n\t\tconst forest =\n\t\t\toptions.forest === ForestType.Optimized\n\t\t\t\t? buildChunkedForest(makeTreeChunker(schema, defaultSchemaPolicy))\n\t\t\t\t: options.forest === ForestType.Reference\n\t\t\t\t\t? buildForest()\n\t\t\t\t\t: buildForest(undefined, true);\n\t\tconst revisionTagCodec = new RevisionTagCodec(runtime.idCompressor);\n\t\tconst removedRoots = makeDetachedFieldIndex(\n\t\t\t\"repair\",\n\t\t\trevisionTagCodec,\n\t\t\truntime.idCompressor,\n\t\t\toptions,\n\t\t);\n\t\tconst schemaSummarizer = new SchemaSummarizer(runtime, schema, options, {\n\t\t\tgetCurrentSeq: () => this.deltaManager.lastSequenceNumber,\n\t\t});\n\t\tconst fieldBatchCodec = makeFieldBatchCodec(options, codecVersions.fieldBatch);\n\n\t\tconst encoderContext = {\n\t\t\tschema: {\n\t\t\t\tschema,\n\t\t\t\tpolicy: defaultSchemaPolicy,\n\t\t\t},\n\t\t\tencodeType: options.treeEncodeType,\n\t\t\toriginatorId: runtime.idCompressor.localSessionId,\n\t\t\tidCompressor: runtime.idCompressor,\n\t\t};\n\t\tconst forestSummarizer = new ForestSummarizer(\n\t\t\tforest,\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\tencoderContext,\n\t\t\toptions,\n\t\t\truntime.idCompressor,\n\t\t);\n\t\tconst removedRootsSummarizer = new DetachedFieldIndexSummarizer(removedRoots);\n\t\tconst innerChangeFamily = new SharedTreeChangeFamily(\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\toptions,\n\t\t\toptions.treeEncodeType,\n\t\t);\n\t\tconst changeFamily = makeMitigatedChangeFamily(\n\t\t\tinnerChangeFamily,\n\t\t\tSharedTreeChangeFamily.emptyChange,\n\t\t\t(error: unknown) => {\n\t\t\t\t// TODO:6344 Add telemetry for these errors.\n\t\t\t\t// Rethrowing the error has a different effect depending on the context in which the\n\t\t\t\t// ChangeFamily was invoked:\n\t\t\t\t// - If the ChangeFamily was invoked as part of incoming op processing, rethrowing the error\n\t\t\t\t// will cause the runtime to disconnect the client, log a severe error, and not reconnect.\n\t\t\t\t// This will not cause the host application to crash because it is not on the stack at that time.\n\t\t\t\t// TODO: let the host application know that the client is now disconnected.\n\t\t\t\t// - If the ChangeFamily was invoked as part of dealing with a local change, rethrowing the\n\t\t\t\t// error will cause the host application to crash. This is not ideal, but is better than\n\t\t\t\t// letting the application either send an invalid change to the server or allowing the\n\t\t\t\t// application to continue working when its local branches contain edits that cannot be\n\t\t\t\t// reflected in its views.\n\t\t\t\t// The best course of action for a host application in such a state is to restart.\n\t\t\t\t// TODO: let the host application know about this situation and provide a way to\n\t\t\t\t// programmatically reload the SharedTree container.\n\t\t\t\tthrow error;\n\t\t\t},\n\t\t);\n\t\tconst changeEnricher = new SharedTreeReadonlyChangeEnricher(forest, schema, removedRoots);\n\t\tsuper(\n\t\t\t[schemaSummarizer, forestSummarizer, removedRootsSummarizer],\n\t\t\tchangeFamily,\n\t\t\toptions,\n\t\t\tcodecVersions,\n\t\t\tid,\n\t\t\truntime,\n\t\t\tattributes,\n\t\t\ttelemetryContextPrefix,\n\t\t\tschema,\n\t\t\tdefaultSchemaPolicy,\n\t\t\tnew DefaultResubmitMachine(\n\t\t\t\tchangeFamily.rebaser.invert.bind(changeFamily.rebaser),\n\t\t\t\tchangeEnricher,\n\t\t\t),\n\t\t\tchangeEnricher,\n\t\t);\n\t\tthis._events = createEmitter<CheckoutEvents>();\n\t\tconst localBranch = this.getLocalBranch();\n\t\tthis.checkout = createTreeCheckout(\n\t\t\truntime.idCompressor,\n\t\t\tthis.mintRevisionTag,\n\t\t\trevisionTagCodec,\n\t\t\t{\n\t\t\t\tbranch: localBranch,\n\t\t\t\tchangeFamily,\n\t\t\t\tschema,\n\t\t\t\tforest,\n\t\t\t\tfieldBatchCodec,\n\t\t\t\tevents: this._events,\n\t\t\t\tremovedRoots,\n\t\t\t\tchunkCompressionStrategy: options.treeEncodeType,\n\t\t\t\tlogger: this.logger,\n\t\t\t},\n\t\t);\n\t}\n\n\t@throwIfBroken\n\tpublic contentSnapshot(): SharedTreeContentSnapshot {\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"contentSnapshot\");\n\t\ttry {\n\t\t\tmoveToDetachedField(this.checkout.forest, cursor);\n\t\t\treturn {\n\t\t\t\tschema: this.storedSchema.clone(),\n\t\t\t\ttree: jsonableTreeFromFieldCursor(cursor),\n\t\t\t\tremoved: this.checkout.getRemovedRoots(),\n\t\t\t};\n\t\t} finally {\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\tpublic schematizeFlexTree<TRoot extends FlexFieldSchema>(\n\t\tconfig: InitializeAndSchematizeConfiguration<TRoot>,\n\t\tonDispose: () => void,\n\t): CheckoutFlexTreeView<TRoot> | undefined {\n\t\tconst viewSchema = new ViewSchema(defaultSchemaPolicy, {}, config.schema);\n\t\tif (!ensureSchema(viewSchema, config.allowedSchemaModifications, this.checkout, config)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn requireSchema(\n\t\t\tthis.checkout,\n\t\t\tviewSchema,\n\t\t\tonDispose,\n\t\t\tcreateNodeKeyManager(this.runtime.idCompressor),\n\t\t);\n\t}\n\n\tpublic viewWith<TRoot extends ImplicitFieldSchema>(\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): SchematizingSimpleTreeView<TRoot> {\n\t\treturn new SchematizingSimpleTreeView(\n\t\t\tthis.checkout,\n\t\t\tconfig,\n\t\t\tcreateNodeKeyManager(this.runtime.idCompressor),\n\t\t\tthis.breaker,\n\t\t);\n\t}\n\n\tprotected override async loadCore(services: IChannelStorageService): Promise<void> {\n\t\tawait super.loadCore(services);\n\t\tthis.checkout.setTipRevisionForLoadedData(this.trunkHeadRevision);\n\t\tthis._events.emit(\"afterBatch\");\n\t}\n}\n\n/**\n * Format versions supported by SharedTree.\n *\n * Each version documents a required minimum version of the \\@fluidframework/tree package.\n * @internal\n */\nexport const SharedTreeFormatVersion = {\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t *\n\t * @deprecated - FF does not currently plan on supporting this format long-term.\n\t * Do not write production documents using this format, as they may not be loadable in the future.\n\t */\n\tv1: 1,\n\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t */\n\tv2: 2,\n\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t */\n\tv3: 3,\n} as const;\n\n/**\n * Format versions supported by SharedTree.\n *\n * Each version documents a required minimum version of the \\@fluidframework/tree package.\n * @internal\n * @privateRemarks\n * See packages/dds/tree/docs/main/compatibility.md for information on how to add support for a new format.\n */\nexport type SharedTreeFormatVersion = typeof SharedTreeFormatVersion;\n\n/**\n * @internal\n */\nexport type SharedTreeOptions = Partial<ICodecOptions> &\n\tPartial<SharedTreeFormatOptions> & {\n\t\t/**\n\t\t * The {@link ForestType} indicating which forest type should be created for the SharedTree.\n\t\t */\n\t\tforest?: ForestType;\n\t};\n\n/**\n * Options for configuring the persisted format SharedTree uses.\n * @internal\n */\nexport interface SharedTreeFormatOptions {\n\t/**\n\t * See {@link TreeCompressionStrategy}.\n\t * default: TreeCompressionStrategy.Compressed\n\t */\n\ttreeEncodeType: TreeCompressionStrategy;\n\t/**\n\t * The format version SharedTree should use to persist documents.\n\t *\n\t * This option has compatibility implications for applications using SharedTree.\n\t * Each version documents a required minimum version of \\@fluidframework/tree.\n\t * If this minimum version fails to be met, the SharedTree may fail to load.\n\t * To be safe, application authors should verify that they have saturated this version\n\t * of \\@fluidframework/tree in their ecosystem before changing the format version.\n\t *\n\t * This option defaults to SharedTreeFormatVersion.v2.\n\t */\n\tformatVersion: SharedTreeFormatVersion[keyof SharedTreeFormatVersion];\n}\n\n/**\n * Used to distinguish between different forest types.\n * @internal\n */\nexport enum ForestType {\n\t/**\n\t * The \"ObjectForest\" forest type.\n\t */\n\tReference = 0,\n\t/**\n\t * The \"ChunkedForest\" forest type.\n\t */\n\tOptimized = 1,\n\t/**\n\t * The \"ObjectForest\" forest type with expensive asserts for debugging.\n\t */\n\tExpensive = 2,\n}\n\nexport const defaultSharedTreeOptions: Required<SharedTreeOptions> = {\n\tjsonValidator: noopValidator,\n\tforest: ForestType.Reference,\n\ttreeEncodeType: TreeCompressionStrategy.Compressed,\n\tformatVersion: SharedTreeFormatVersion.v3,\n};\n\n/**\n * A channel factory that creates {@link ISharedTree}s.\n */\nexport class SharedTreeFactory implements IChannelFactory<ISharedTree> {\n\tpublic readonly type: string = \"https://graph.microsoft.com/types/tree\";\n\n\tpublic readonly attributes: IChannelAttributes = {\n\t\ttype: this.type,\n\t\tsnapshotFormatVersion: \"0.0.0\",\n\t\tpackageVersion: \"0.0.0\",\n\t};\n\n\tpublic constructor(private readonly options: SharedTreeOptions = {}) {}\n\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tchannelAttributes: Readonly<IChannelAttributes>,\n\t): Promise<SharedTree> {\n\t\tconst tree = new SharedTree(id, runtime, channelAttributes, this.options);\n\t\tawait tree.load(services);\n\t\treturn tree;\n\t}\n\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): SharedTree {\n\t\tconst tree = new SharedTree(id, runtime, this.attributes, this.options);\n\t\ttree.initializeLocal();\n\t\treturn tree;\n\t}\n}\n"]}
1
+ {"version":3,"file":"sharedTree.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kEAA6D;AAS7D,uEAAsE;AAEtE,gDAAsE;AACtE,+CAO0B;AAC1B,iDAK4B;AAC5B,4DAauC;AACvC,2DAIsC;AAOtC,uEAAuE;AACvE,+EAAiF;AACjF,2EAAqE;AAGrE,uDAA+F;AAC/F,+CAAgE;AA2DhE,MAAM,oCAAoC,GAAG,IAAI,GAAG,CAAgC;IACnF;QACC,CAAC;QACD,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,kBAAkB,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE;KAC1F;IACD;QACC,CAAC;QACD,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,kBAAkB,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE;KAC1F;IACD;QACC,CAAC;QACD,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,kBAAkB,EAAE,C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DAAa,CAAA;IACb;;OAEG;IACH,qDAAa,CAAA;IACb;;OAEG;IACH,qDAAa,CAAA;AACd,CAAC,EAbW,UAAU,0BAAV,UAAU,QAarB;AAEY,QAAA,wBAAwB,GAAgC;IACpE,aAAa,EAAE,wBAAa;IAC5B,MAAM,EAAE,UAAU,CAAC,SAAS;IAC5B,cAAc,EAAE,kCAAuB,CAAC,UAAU;IAClD,aAAa,EAAE,+BAAuB,CAAC,EAAE;CACzC,CAAC;AAEF;;GAEG;AACH,MAAa,iBAAiB;IAS7B,YAAoC,UAA6B,EAAE;QAA/B,YAAO,GAAP,OAAO,CAAwB;QARnD,SAAI,GAAW,wCAAwC,CAAC;QAExD,eAAU,GAAuB;YAChD,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,qBAAqB,EAAE,OAAO;YAC9B,cAAc,EAAE,OAAO;SACvB,CAAC;IAEoE,CAAC;IAEhE,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,iBAA+C;QAE/C,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,EAAE,EAAE,OAAO,EAAE,iBAAiB,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1E,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1B,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,MAAM,CAAC,OAA+B,EAAE,EAAU;QACxD,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACxE,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AA3BD,8CA2BC","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 type {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type { ISharedObject } from \"@fluidframework/shared-object-base/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { type ICodecOptions, noopValidator } from \"../codec/index.js\";\nimport {\n\ttype JsonableTree,\n\tRevisionTagCodec,\n\ttype TreeStoredSchema,\n\tTreeStoredSchemaRepository,\n\tmakeDetachedFieldIndex,\n\tmoveToDetachedField,\n} from \"../core/index.js\";\nimport {\n\ttype HasListeners,\n\ttype IEmitter,\n\ttype Listenable,\n\tcreateEmitter,\n} from \"../events/index.js\";\nimport {\n\tDetachedFieldIndexSummarizer,\n\tForestSummarizer,\n\tSchemaSummarizer,\n\tTreeCompressionStrategy,\n\tbuildChunkedForest,\n\tbuildForest,\n\tcreateNodeKeyManager,\n\tdefaultSchemaPolicy,\n\tjsonableTreeFromFieldCursor,\n\tmakeFieldBatchCodec,\n\tmakeMitigatedChangeFamily,\n\tmakeTreeChunker,\n} from \"../feature-libraries/index.js\";\nimport {\n\tDefaultResubmitMachine,\n\ttype ExplicitCoreCodecVersions,\n\tSharedTreeCore,\n} from \"../shared-tree-core/index.js\";\nimport type {\n\tITree,\n\tImplicitFieldSchema,\n\tTreeViewConfiguration,\n} from \"../simple-tree/index.js\";\n\nimport { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\nimport { SharedTreeReadonlyChangeEnricher } from \"./sharedTreeChangeEnricher.js\";\nimport { SharedTreeChangeFamily } from \"./sharedTreeChangeFamily.js\";\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\nimport type { SharedTreeEditBuilder } from \"./sharedTreeEditBuilder.js\";\nimport { type CheckoutEvents, type TreeCheckout, createTreeCheckout } from \"./treeCheckout.js\";\nimport { breakingClass, throwIfBroken } from \"../util/index.js\";\n\n/**\n * Copy of data from an {@link ISharedTree} at some point in time.\n * @remarks\n * This is unrelated to Fluids concept of \"snapshots\".\n * @internal\n */\nexport interface SharedTreeContentSnapshot {\n\t/**\n\t * The schema stored in the document.\n\t *\n\t * @remarks\n\t * Edits to the schema can mutate the schema stored of the tree which took this snapshot (but this snapshot will remain the same)\n\t * This is mainly useful for debugging cases where schematize reports an incompatible view schema.\n\t */\n\treadonly schema: TreeStoredSchema;\n\t/**\n\t * All {@link TreeStatus.InDocument} content.\n\t */\n\treadonly tree: JsonableTree[];\n\t/**\n\t * All {@link TreeStatus.Removed} content.\n\t */\n\treadonly removed: [string | number | undefined, number, JsonableTree][];\n}\n\n/**\n * {@link ITree} extended with some non-public APIs.\n * @internal\n */\nexport interface ISharedTree extends ISharedObject, ITree {\n\t/**\n\t * Provides a copy of the current content of the tree.\n\t * This can be useful for inspecting the tree when no suitable view schema is available.\n\t * This is only intended for use in testing and exceptional code paths: it is not performant.\n\t *\n\t * This does not include everything that is included in a tree summary, since information about how to merge future edits is omitted.\n\t */\n\tcontentSnapshot(): SharedTreeContentSnapshot;\n}\n\n/**\n * Has an entry for each codec which writes an explicit version into its data.\n *\n * This is used to map the single API entrypoint controlling the format {@link SharedTreeOptions.formatVersion}\n * to a list of write versions that for each codec that should be used for that format.\n *\n * Note that all explicitly versioned codecs should be using the format version from the data to read encoded data.\n *\n * TODO: Plumb these write versions into forest, schema, detached field index codec creation.\n */\ninterface ExplicitCodecVersions extends ExplicitCoreCodecVersions {\n\tforest: number;\n\tschema: number;\n\tdetachedFieldIndex: number;\n\tfieldBatch: number;\n}\n\nconst formatVersionToTopLevelCodecVersions = new Map<number, ExplicitCodecVersions>([\n\t[\n\t\t1,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 1, message: 1, fieldBatch: 1 },\n\t],\n\t[\n\t\t2,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 2, message: 2, fieldBatch: 1 },\n\t],\n\t[\n\t\t3,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 3, message: 3, fieldBatch: 1 },\n\t],\n\t[\n\t\t4,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 4, message: 4, fieldBatch: 1 },\n\t],\n]);\n\nfunction getCodecVersions(formatVersion: number): ExplicitCodecVersions {\n\tconst versions = formatVersionToTopLevelCodecVersions.get(formatVersion);\n\tassert(versions !== undefined, 0x90e /* Unknown format version */);\n\treturn versions;\n}\n\n/**\n * Shared tree, configured with a good set of indexes and field kinds which will maintain compatibility over time.\n *\n * TODO: detail compatibility requirements.\n */\n@breakingClass\nexport class SharedTree\n\textends SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>\n\timplements ISharedTree\n{\n\tprivate readonly _events: Listenable<CheckoutEvents> &\n\t\tIEmitter<CheckoutEvents> &\n\t\tHasListeners<CheckoutEvents>;\n\tpublic readonly checkout: TreeCheckout;\n\tpublic get storedSchema(): TreeStoredSchemaRepository {\n\t\treturn this.checkout.storedSchema;\n\t}\n\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t\toptionsParam: SharedTreeOptions,\n\t\ttelemetryContextPrefix: string = \"fluid_sharedTree_\",\n\t) {\n\t\tif (runtime.idCompressor === undefined) {\n\t\t\tthrow new UsageError(\"IdCompressor must be enabled to use SharedTree\");\n\t\t}\n\n\t\tconst options = { ...defaultSharedTreeOptions, ...optionsParam };\n\t\tconst codecVersions = getCodecVersions(options.formatVersion);\n\t\tconst schema = new TreeStoredSchemaRepository();\n\t\tconst forest =\n\t\t\toptions.forest === ForestType.Optimized\n\t\t\t\t? buildChunkedForest(makeTreeChunker(schema, defaultSchemaPolicy))\n\t\t\t\t: options.forest === ForestType.Reference\n\t\t\t\t\t? buildForest()\n\t\t\t\t\t: buildForest(undefined, true);\n\t\tconst revisionTagCodec = new RevisionTagCodec(runtime.idCompressor);\n\t\tconst removedRoots = makeDetachedFieldIndex(\n\t\t\t\"repair\",\n\t\t\trevisionTagCodec,\n\t\t\truntime.idCompressor,\n\t\t\toptions,\n\t\t);\n\t\tconst schemaSummarizer = new SchemaSummarizer(runtime, schema, options, {\n\t\t\tgetCurrentSeq: () => this.deltaManager.lastSequenceNumber,\n\t\t});\n\t\tconst fieldBatchCodec = makeFieldBatchCodec(options, codecVersions.fieldBatch);\n\n\t\tconst encoderContext = {\n\t\t\tschema: {\n\t\t\t\tschema,\n\t\t\t\tpolicy: defaultSchemaPolicy,\n\t\t\t},\n\t\t\tencodeType: options.treeEncodeType,\n\t\t\toriginatorId: runtime.idCompressor.localSessionId,\n\t\t\tidCompressor: runtime.idCompressor,\n\t\t};\n\t\tconst forestSummarizer = new ForestSummarizer(\n\t\t\tforest,\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\tencoderContext,\n\t\t\toptions,\n\t\t\truntime.idCompressor,\n\t\t);\n\t\tconst removedRootsSummarizer = new DetachedFieldIndexSummarizer(removedRoots);\n\t\tconst innerChangeFamily = new SharedTreeChangeFamily(\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\toptions,\n\t\t\toptions.treeEncodeType,\n\t\t);\n\t\tconst changeFamily = makeMitigatedChangeFamily(\n\t\t\tinnerChangeFamily,\n\t\t\tSharedTreeChangeFamily.emptyChange,\n\t\t\t(error: unknown) => {\n\t\t\t\t// TODO:6344 Add telemetry for these errors.\n\t\t\t\t// Rethrowing the error has a different effect depending on the context in which the\n\t\t\t\t// ChangeFamily was invoked:\n\t\t\t\t// - If the ChangeFamily was invoked as part of incoming op processing, rethrowing the error\n\t\t\t\t// will cause the runtime to disconnect the client, log a severe error, and not reconnect.\n\t\t\t\t// This will not cause the host application to crash because it is not on the stack at that time.\n\t\t\t\t// TODO: let the host application know that the client is now disconnected.\n\t\t\t\t// - If the ChangeFamily was invoked as part of dealing with a local change, rethrowing the\n\t\t\t\t// error will cause the host application to crash. This is not ideal, but is better than\n\t\t\t\t// letting the application either send an invalid change to the server or allowing the\n\t\t\t\t// application to continue working when its local branches contain edits that cannot be\n\t\t\t\t// reflected in its views.\n\t\t\t\t// The best course of action for a host application in such a state is to restart.\n\t\t\t\t// TODO: let the host application know about this situation and provide a way to\n\t\t\t\t// programmatically reload the SharedTree container.\n\t\t\t\tthrow error;\n\t\t\t},\n\t\t);\n\t\tconst changeEnricher = new SharedTreeReadonlyChangeEnricher(forest, schema, removedRoots);\n\t\tsuper(\n\t\t\t[schemaSummarizer, forestSummarizer, removedRootsSummarizer],\n\t\t\tchangeFamily,\n\t\t\toptions,\n\t\t\tcodecVersions,\n\t\t\tid,\n\t\t\truntime,\n\t\t\tattributes,\n\t\t\ttelemetryContextPrefix,\n\t\t\tschema,\n\t\t\tdefaultSchemaPolicy,\n\t\t\tnew DefaultResubmitMachine(\n\t\t\t\tchangeFamily.rebaser.invert.bind(changeFamily.rebaser),\n\t\t\t\tchangeEnricher,\n\t\t\t),\n\t\t\tchangeEnricher,\n\t\t);\n\t\tthis._events = createEmitter<CheckoutEvents>();\n\t\tconst localBranch = this.getLocalBranch();\n\t\tthis.checkout = createTreeCheckout(\n\t\t\truntime.idCompressor,\n\t\t\tthis.mintRevisionTag,\n\t\t\trevisionTagCodec,\n\t\t\t{\n\t\t\t\tbranch: localBranch,\n\t\t\t\tchangeFamily,\n\t\t\t\tschema,\n\t\t\t\tforest,\n\t\t\t\tfieldBatchCodec,\n\t\t\t\tevents: this._events,\n\t\t\t\tremovedRoots,\n\t\t\t\tchunkCompressionStrategy: options.treeEncodeType,\n\t\t\t\tlogger: this.logger,\n\t\t\t},\n\t\t);\n\t}\n\n\t@throwIfBroken\n\tpublic contentSnapshot(): SharedTreeContentSnapshot {\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"contentSnapshot\");\n\t\ttry {\n\t\t\tmoveToDetachedField(this.checkout.forest, cursor);\n\t\t\treturn {\n\t\t\t\tschema: this.storedSchema.clone(),\n\t\t\t\ttree: jsonableTreeFromFieldCursor(cursor),\n\t\t\t\tremoved: this.checkout.getRemovedRoots(),\n\t\t\t};\n\t\t} finally {\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\tpublic viewWith<TRoot extends ImplicitFieldSchema>(\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): SchematizingSimpleTreeView<TRoot> {\n\t\treturn new SchematizingSimpleTreeView(\n\t\t\tthis.checkout,\n\t\t\tconfig,\n\t\t\tcreateNodeKeyManager(this.runtime.idCompressor),\n\t\t\tthis.breaker,\n\t\t);\n\t}\n\n\tprotected override async loadCore(services: IChannelStorageService): Promise<void> {\n\t\tawait super.loadCore(services);\n\t\tthis.checkout.setTipRevisionForLoadedData(this.trunkHeadRevision);\n\t\tthis._events.emit(\"afterBatch\");\n\t}\n}\n\n/**\n * Format versions supported by SharedTree.\n *\n * Each version documents a required minimum version of the \\@fluidframework/tree package.\n * @internal\n */\nexport const SharedTreeFormatVersion = {\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t *\n\t * @deprecated - FF does not currently plan on supporting this format long-term.\n\t * Do not write production documents using this format, as they may not be loadable in the future.\n\t */\n\tv1: 1,\n\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t */\n\tv2: 2,\n\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t */\n\tv3: 3,\n} as const;\n\n/**\n * Format versions supported by SharedTree.\n *\n * Each version documents a required minimum version of the \\@fluidframework/tree package.\n * @internal\n * @privateRemarks\n * See packages/dds/tree/docs/main/compatibility.md for information on how to add support for a new format.\n */\nexport type SharedTreeFormatVersion = typeof SharedTreeFormatVersion;\n\n/**\n * @internal\n */\nexport type SharedTreeOptions = Partial<ICodecOptions> &\n\tPartial<SharedTreeFormatOptions> & {\n\t\t/**\n\t\t * The {@link ForestType} indicating which forest type should be created for the SharedTree.\n\t\t */\n\t\tforest?: ForestType;\n\t};\n\n/**\n * Options for configuring the persisted format SharedTree uses.\n * @internal\n */\nexport interface SharedTreeFormatOptions {\n\t/**\n\t * See {@link TreeCompressionStrategy}.\n\t * default: TreeCompressionStrategy.Compressed\n\t */\n\ttreeEncodeType: TreeCompressionStrategy;\n\t/**\n\t * The format version SharedTree should use to persist documents.\n\t *\n\t * This option has compatibility implications for applications using SharedTree.\n\t * Each version documents a required minimum version of \\@fluidframework/tree.\n\t * If this minimum version fails to be met, the SharedTree may fail to load.\n\t * To be safe, application authors should verify that they have saturated this version\n\t * of \\@fluidframework/tree in their ecosystem before changing the format version.\n\t *\n\t * This option defaults to SharedTreeFormatVersion.v2.\n\t */\n\tformatVersion: SharedTreeFormatVersion[keyof SharedTreeFormatVersion];\n}\n\n/**\n * Used to distinguish between different forest types.\n * @internal\n */\nexport enum ForestType {\n\t/**\n\t * The \"ObjectForest\" forest type.\n\t */\n\tReference = 0,\n\t/**\n\t * The \"ChunkedForest\" forest type.\n\t */\n\tOptimized = 1,\n\t/**\n\t * The \"ObjectForest\" forest type with expensive asserts for debugging.\n\t */\n\tExpensive = 2,\n}\n\nexport const defaultSharedTreeOptions: Required<SharedTreeOptions> = {\n\tjsonValidator: noopValidator,\n\tforest: ForestType.Reference,\n\ttreeEncodeType: TreeCompressionStrategy.Compressed,\n\tformatVersion: SharedTreeFormatVersion.v3,\n};\n\n/**\n * A channel factory that creates {@link ISharedTree}s.\n */\nexport class SharedTreeFactory implements IChannelFactory<ISharedTree> {\n\tpublic readonly type: string = \"https://graph.microsoft.com/types/tree\";\n\n\tpublic readonly attributes: IChannelAttributes = {\n\t\ttype: this.type,\n\t\tsnapshotFormatVersion: \"0.0.0\",\n\t\tpackageVersion: \"0.0.0\",\n\t};\n\n\tpublic constructor(private readonly options: SharedTreeOptions = {}) {}\n\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tchannelAttributes: Readonly<IChannelAttributes>,\n\t): Promise<SharedTree> {\n\t\tconst tree = new SharedTree(id, runtime, channelAttributes, this.options);\n\t\tawait tree.load(services);\n\t\treturn tree;\n\t}\n\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): SharedTree {\n\t\tconst tree = new SharedTree(id, runtime, this.attributes, this.options);\n\t\ttree.initializeLocal();\n\t\treturn tree;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeChangeCodecs.d.ts","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeChangeCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,KAAK,YAAY,EACjB,KAAK,aAAa,EAIlB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,qBAAqB,EAAoB,MAAM,kBAAkB,CAAC;AAChF,OAAO,EACN,KAAK,gBAAgB,EAIrB,MAAM,+BAA+B,CAAC;AAOvC,OAAO,KAAK,EAAE,gBAAgB,EAAyB,MAAM,4BAA4B,CAAC;AAE1F,wBAAgB,+BAA+B,CAC9C,wBAAwB,EAAE,YAAY,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,EAC/E,OAAO,EAAE,aAAa,GACpB,YAAY,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CA4BvD"}
1
+ {"version":3,"file":"sharedTreeChangeCodecs.d.ts","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeChangeCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,KAAK,YAAY,EACjB,KAAK,aAAa,EAIlB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,qBAAqB,EAAoB,MAAM,kBAAkB,CAAC;AAChF,OAAO,EACN,KAAK,gBAAgB,EAIrB,MAAM,+BAA+B,CAAC;AAOvC,OAAO,KAAK,EAAE,gBAAgB,EAAyB,MAAM,4BAA4B,CAAC;AAE1F,wBAAgB,+BAA+B,CAC9C,wBAAwB,EAAE,YAAY,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,EAC/E,OAAO,EAAE,aAAa,GACpB,YAAY,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAoCvD"}
@@ -23,6 +23,10 @@ function makeSharedTreeChangeCodecFamily(modularChangeCodecFamily, options) {
23
23
  3,
24
24
  makeSharedTreeChangeCodec(modularChangeCodecFamily.resolve(3).json, schemaChangeCodecs.resolve(1).json, options),
25
25
  ],
26
+ [
27
+ 4,
28
+ makeSharedTreeChangeCodec(modularChangeCodecFamily.resolve(4).json, schemaChangeCodecs.resolve(1).json, options),
29
+ ],
26
30
  ]);
27
31
  }
28
32
  exports.makeSharedTreeChangeCodecFamily = makeSharedTreeChangeCodecFamily;
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeChangeCodecs.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeChangeCodecs.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,gDAO2B;AAE3B,4DAKuC;AAGvC,2EAGqC;AAGrC,SAAgB,+BAA+B,CAC9C,wBAA+E,EAC/E,OAAsB;IAEtB,MAAM,kBAAkB,GAAG,IAAA,iCAAsB,EAAC,OAAO,CAAC,CAAC;IAC3D,OAAO,IAAA,0BAAe,EAAC;QACtB;YACC,CAAC;YACD,yBAAyB,CACxB,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EACxC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAClC,OAAO,CACP;SACD;QACD;YACC,CAAC;YACD,yBAAyB,CACxB,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EACxC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAClC,OAAO,CACP;SACD;QACD;YACC,CAAC;YACD,yBAAyB,CACxB,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EACxC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAClC,OAAO,CACP;SACD;KACD,CAAC,CAAC;AACJ,CAAC;AA/BD,0EA+BC;AAED,SAAS,yBAAyB,CACjC,kBAKC,EACD,iBAA2C,EAC3C,YAA2B;IAO3B,M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Q,EAAE,CAAC;oBAC5C,OAAO,CAAC,IAAI,CAAC;wBACZ,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC;qBAC3D,CAAC,CAAC;oBACH,aAAa,GAAG,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC;gBACtD,CAAC;YACF,CAAC;YACD,OAAO,OAAO,CAAC;QAChB,CAAC;QACD,MAAM,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,EAAE;YAClC,MAAM,OAAO,GAAyC,EAAE,CAAC;YACzD,KAAK,MAAM,SAAS,IAAI,aAAa,EAAE,CAAC;gBACvC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;YAC3D,CAAC;YACD,OAAO,EAAE,OAAO,EAAE,CAAC;QACpB,CAAC;KACD,EACD,YAAY,CAAC,aAAa,CAC1B,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tDiscriminatedUnionDispatcher,\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\tmakeCodecFamily,\n\twithSchemaValidation,\n} from \"../codec/index.js\";\nimport type { ChangeEncodingContext, TreeStoredSchema } from \"../core/index.js\";\nimport {\n\ttype ModularChangeset,\n\ttype SchemaChange,\n\tdefaultSchemaPolicy,\n\tmakeSchemaChangeCodecs,\n} from \"../feature-libraries/index.js\";\nimport type { JsonCompatibleReadOnly, Mutable } from \"../util/index.js\";\n\nimport {\n\tEncodedSharedTreeChange,\n\ttype EncodedSharedTreeInnerChange,\n} from \"./sharedTreeChangeFormat.js\";\nimport type { SharedTreeChange, SharedTreeInnerChange } from \"./sharedTreeChangeTypes.js\";\n\nexport function makeSharedTreeChangeCodecFamily(\n\tmodularChangeCodecFamily: ICodecFamily<ModularChangeset, ChangeEncodingContext>,\n\toptions: ICodecOptions,\n): ICodecFamily<SharedTreeChange, ChangeEncodingContext> {\n\tconst schemaChangeCodecs = makeSchemaChangeCodecs(options);\n\treturn makeCodecFamily([\n\t\t[\n\t\t\t1,\n\t\t\tmakeSharedTreeChangeCodec(\n\t\t\t\tmodularChangeCodecFamily.resolve(1).json,\n\t\t\t\tschemaChangeCodecs.resolve(1).json,\n\t\t\t\toptions,\n\t\t\t),\n\t\t],\n\t\t[\n\t\t\t2,\n\t\t\tmakeSharedTreeChangeCodec(\n\t\t\t\tmodularChangeCodecFamily.resolve(2).json,\n\t\t\t\tschemaChangeCodecs.resolve(1).json,\n\t\t\t\toptions,\n\t\t\t),\n\t\t],\n\t\t[\n\t\t\t3,\n\t\t\tmakeSharedTreeChangeCodec(\n\t\t\t\tmodularChangeCodecFamily.resolve(3).json,\n\t\t\t\tschemaChangeCodecs.resolve(1).json,\n\t\t\t\toptions,\n\t\t\t),\n\t\t],\n\t]);\n}\n\nfunction makeSharedTreeChangeCodec(\n\tmodularChangeCodec: IJsonCodec<\n\t\tModularChangeset,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tChangeEncodingContext\n\t>,\n\tschemaChangeCodec: IJsonCodec<SchemaChange>,\n\tcodecOptions: ICodecOptions,\n): IJsonCodec<\n\tSharedTreeChange,\n\tEncodedSharedTreeChange,\n\tEncodedSharedTreeChange,\n\tChangeEncodingContext\n> {\n\tconst decoderLibrary = new DiscriminatedUnionDispatcher<\n\t\tEncodedSharedTreeInnerChange,\n\t\t[context: ChangeEncodingContext],\n\t\tSharedTreeInnerChange\n\t>({\n\t\tdata(encoded, context): SharedTreeInnerChange {\n\t\t\treturn {\n\t\t\t\ttype: \"data\",\n\t\t\t\tinnerChange: modularChangeCodec.decode(encoded, context),\n\t\t\t};\n\t\t},\n\t\tschema(encoded): SharedTreeInnerChange {\n\t\t\treturn {\n\t\t\t\ttype: \"schema\",\n\t\t\t\tinnerChange: schemaChangeCodec.decode(encoded),\n\t\t\t};\n\t\t},\n\t});\n\n\treturn withSchemaValidation(\n\t\tEncodedSharedTreeChange,\n\t\t{\n\t\t\tencode: (change, context) => {\n\t\t\t\tconst changes: EncodedSharedTreeInnerChange[] = [];\n\t\t\t\tlet updatedSchema: TreeStoredSchema | undefined;\n\t\t\t\tfor (const decodedChange of change.changes) {\n\t\t\t\t\tif (decodedChange.type === \"data\") {\n\t\t\t\t\t\tconst schemaAndPolicy =\n\t\t\t\t\t\t\tupdatedSchema !== undefined\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\tpolicy:\n\t\t\t\t\t\t\t\t\t\t\tcontext.schema !== undefined\n\t\t\t\t\t\t\t\t\t\t\t\t? context.schema.policy\n\t\t\t\t\t\t\t\t\t\t\t\t: defaultSchemaPolicy,\n\t\t\t\t\t\t\t\t\t\tschema: updatedSchema,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t: context.schema;\n\t\t\t\t\t\tchanges.push({\n\t\t\t\t\t\t\tdata: modularChangeCodec.encode(decodedChange.innerChange, {\n\t\t\t\t\t\t\t\toriginatorId: context.originatorId,\n\t\t\t\t\t\t\t\tschema: schemaAndPolicy,\n\t\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t\t\trevision: context.revision,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t});\n\t\t\t\t\t} else if (decodedChange.type === \"schema\") {\n\t\t\t\t\t\tchanges.push({\n\t\t\t\t\t\t\tschema: schemaChangeCodec.encode(decodedChange.innerChange),\n\t\t\t\t\t\t});\n\t\t\t\t\t\tupdatedSchema = decodedChange.innerChange.schema.new;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn changes;\n\t\t\t},\n\t\t\tdecode: (encodedChange, context) => {\n\t\t\t\tconst changes: Mutable<SharedTreeChange[\"changes\"]> = [];\n\t\t\t\tfor (const subChange of encodedChange) {\n\t\t\t\t\tchanges.push(decoderLibrary.dispatch(subChange, context));\n\t\t\t\t}\n\t\t\t\treturn { changes };\n\t\t\t},\n\t\t},\n\t\tcodecOptions.jsonValidator,\n\t);\n}\n"]}
1
+ {"version":3,"file":"sharedTreeChangeCodecs.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeChangeCodecs.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,gDAO2B;AAE3B,4DAKuC;AAGvC,2EAGqC;AAGrC,SAAgB,+BAA+B,CAC9C,wBAA+E,EAC/E,OAAsB;IAEtB,MAAM,kBAAkB,GAAG,IAAA,iCAAsB,EAAC,OAAO,CAAC,CAAC;IAC3D,OAAO,IAAA,0BAAe,EAAC;QACtB;YACC,CAAC;YACD,yBAAyB,CACxB,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EACxC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAClC,OAAO,CACP;SACD;QACD;YACC,CAAC;YACD,yBAAyB,CACxB,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EACxC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAClC,OAAO,CACP;SACD;QACD;YACC,CAAC;YACD,yBAAyB,CACxB,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EACxC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAClC,OAAO,CACP;SACD;QACD;YACC,CAAC;YACD,yBAAyB,CACxB,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EACxC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAClC,OAAO,CACP;SACD;KACD,CAAC,CAAC;AACJ,CAAC;AAvCD,0EAuCC;AAED,SAAS,yBAAyB,CACjC,kBAKC,EACD,iBAA2C,EAC3C,YAA2B;IAO3B,MAAM,cAAc,GAAG,IAAI,uCAA4B,CAIrD;QACD,IAAI,CAAC,O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AAM,EAAE,iBAAiB,CAAC,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC;qBAC3D,CAAC,CAAC;oBACH,aAAa,GAAG,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC;gBACtD,CAAC;YACF,CAAC;YACD,OAAO,OAAO,CAAC;QAChB,CAAC;QACD,MAAM,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,EAAE;YAClC,MAAM,OAAO,GAAyC,EAAE,CAAC;YACzD,KAAK,MAAM,SAAS,IAAI,aAAa,EAAE,CAAC;gBACvC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;YAC3D,CAAC;YACD,OAAO,EAAE,OAAO,EAAE,CAAC;QACpB,CAAC;KACD,EACD,YAAY,CAAC,aAAa,CAC1B,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tDiscriminatedUnionDispatcher,\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\tmakeCodecFamily,\n\twithSchemaValidation,\n} from \"../codec/index.js\";\nimport type { ChangeEncodingContext, TreeStoredSchema } from \"../core/index.js\";\nimport {\n\ttype ModularChangeset,\n\ttype SchemaChange,\n\tdefaultSchemaPolicy,\n\tmakeSchemaChangeCodecs,\n} from \"../feature-libraries/index.js\";\nimport type { JsonCompatibleReadOnly, Mutable } from \"../util/index.js\";\n\nimport {\n\tEncodedSharedTreeChange,\n\ttype EncodedSharedTreeInnerChange,\n} from \"./sharedTreeChangeFormat.js\";\nimport type { SharedTreeChange, SharedTreeInnerChange } from \"./sharedTreeChangeTypes.js\";\n\nexport function makeSharedTreeChangeCodecFamily(\n\tmodularChangeCodecFamily: ICodecFamily<ModularChangeset, ChangeEncodingContext>,\n\toptions: ICodecOptions,\n): ICodecFamily<SharedTreeChange, ChangeEncodingContext> {\n\tconst schemaChangeCodecs = makeSchemaChangeCodecs(options);\n\treturn makeCodecFamily([\n\t\t[\n\t\t\t1,\n\t\t\tmakeSharedTreeChangeCodec(\n\t\t\t\tmodularChangeCodecFamily.resolve(1).json,\n\t\t\t\tschemaChangeCodecs.resolve(1).json,\n\t\t\t\toptions,\n\t\t\t),\n\t\t],\n\t\t[\n\t\t\t2,\n\t\t\tmakeSharedTreeChangeCodec(\n\t\t\t\tmodularChangeCodecFamily.resolve(2).json,\n\t\t\t\tschemaChangeCodecs.resolve(1).json,\n\t\t\t\toptions,\n\t\t\t),\n\t\t],\n\t\t[\n\t\t\t3,\n\t\t\tmakeSharedTreeChangeCodec(\n\t\t\t\tmodularChangeCodecFamily.resolve(3).json,\n\t\t\t\tschemaChangeCodecs.resolve(1).json,\n\t\t\t\toptions,\n\t\t\t),\n\t\t],\n\t\t[\n\t\t\t4,\n\t\t\tmakeSharedTreeChangeCodec(\n\t\t\t\tmodularChangeCodecFamily.resolve(4).json,\n\t\t\t\tschemaChangeCodecs.resolve(1).json,\n\t\t\t\toptions,\n\t\t\t),\n\t\t],\n\t]);\n}\n\nfunction makeSharedTreeChangeCodec(\n\tmodularChangeCodec: IJsonCodec<\n\t\tModularChangeset,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tChangeEncodingContext\n\t>,\n\tschemaChangeCodec: IJsonCodec<SchemaChange>,\n\tcodecOptions: ICodecOptions,\n): IJsonCodec<\n\tSharedTreeChange,\n\tEncodedSharedTreeChange,\n\tEncodedSharedTreeChange,\n\tChangeEncodingContext\n> {\n\tconst decoderLibrary = new DiscriminatedUnionDispatcher<\n\t\tEncodedSharedTreeInnerChange,\n\t\t[context: ChangeEncodingContext],\n\t\tSharedTreeInnerChange\n\t>({\n\t\tdata(encoded, context): SharedTreeInnerChange {\n\t\t\treturn {\n\t\t\t\ttype: \"data\",\n\t\t\t\tinnerChange: modularChangeCodec.decode(encoded, context),\n\t\t\t};\n\t\t},\n\t\tschema(encoded): SharedTreeInnerChange {\n\t\t\treturn {\n\t\t\t\ttype: \"schema\",\n\t\t\t\tinnerChange: schemaChangeCodec.decode(encoded),\n\t\t\t};\n\t\t},\n\t});\n\n\treturn withSchemaValidation(\n\t\tEncodedSharedTreeChange,\n\t\t{\n\t\t\tencode: (change, context) => {\n\t\t\t\tconst changes: EncodedSharedTreeInnerChange[] = [];\n\t\t\t\tlet updatedSchema: TreeStoredSchema | undefined;\n\t\t\t\tfor (const decodedChange of change.changes) {\n\t\t\t\t\tif (decodedChange.type === \"data\") {\n\t\t\t\t\t\tconst schemaAndPolicy =\n\t\t\t\t\t\t\tupdatedSchema !== undefined\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\tpolicy:\n\t\t\t\t\t\t\t\t\t\t\tcontext.schema !== undefined\n\t\t\t\t\t\t\t\t\t\t\t\t? context.schema.policy\n\t\t\t\t\t\t\t\t\t\t\t\t: defaultSchemaPolicy,\n\t\t\t\t\t\t\t\t\t\tschema: updatedSchema,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t: context.schema;\n\t\t\t\t\t\tchanges.push({\n\t\t\t\t\t\t\tdata: modularChangeCodec.encode(decodedChange.innerChange, {\n\t\t\t\t\t\t\t\toriginatorId: context.originatorId,\n\t\t\t\t\t\t\t\tschema: schemaAndPolicy,\n\t\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t\t\trevision: context.revision,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t});\n\t\t\t\t\t} else if (decodedChange.type === \"schema\") {\n\t\t\t\t\t\tchanges.push({\n\t\t\t\t\t\t\tschema: schemaChangeCodec.encode(decodedChange.innerChange),\n\t\t\t\t\t\t});\n\t\t\t\t\t\tupdatedSchema = decodedChange.innerChange.schema.new;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn changes;\n\t\t\t},\n\t\t\tdecode: (encodedChange, context) => {\n\t\t\t\tconst changes: Mutable<SharedTreeChange[\"changes\"]> = [];\n\t\t\t\tfor (const subChange of encodedChange) {\n\t\t\t\t\tchanges.push(decoderLibrary.dispatch(subChange, context));\n\t\t\t\t}\n\t\t\t\treturn { changes };\n\t\t\t},\n\t\t},\n\t\tcodecOptions.jsonValidator,\n\t);\n}\n"]}
@@ -95,8 +95,8 @@ class SharedTreeChangeFamily {
95
95
  return SharedTreeChangeFamily.emptyChange;
96
96
  }
97
97
  (0, internal_1.assert)(change.change.changes.length === 1 && over.change.changes.length === 1, 0x884 /* SharedTreeChange should have exactly one inner change if no schema change is present. */);
98
- const dataChangeIntention = change.change.changes[0];
99
- const dataChangeOver = over.change.changes[0];
98
+ const dataChangeIntention = change.change.changes[0] ?? (0, internal_1.oob)();
99
+ const dataChangeOver = over.change.changes[0] ?? (0, internal_1.oob)();
100
100
  (0, internal_1.assert)(dataChangeIntention.type === "data" && dataChangeOver.type === "data", 0x885 /* Data change should be present. */);
101
101
  return {
102
102
  changes: [
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeChangeFamily.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeChangeFamily.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAG7D,+CAU0B;AAC1B,4DASuC;AACvC,+CAM0B;AAE1B,2EAA8E;AAE9E,yEAAmE;AAEnE;;;;GAIG;AACH,MAAa,sBAAsB;IAYlC,YACC,gBAAkC,EAClC,eAAgC,EAChC,YAA2B,EAC3B,wBAAkD;QAElD,MAAM,kBAAkB,GAAG,IAAA,uCAA4B,EACtD,kCAAuB,EACvB,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,wBAAwB,CACxB,CAAC;QACF,IAAI,CAAC,mBAAmB,GAAG,IAAI,8BAAmB,CAAC,qBAAU,EAAE,kBAAkB,CAAC,CAAC;QACnF,IAAI,CAAC,MAAM,GAAG,IAAA,2DAA+B,EAC5C,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAC/B,YAAY,CACZ,CA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I,QAAQ,EAAE,CAAC;YAC3B,IAAI,CAAC,IAAA,4BAAiB,EAAC,aAAa,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC3D,MAAM,EAAE,CAAC;YACV,CAAC;QACF,CAAC;IACF,CAAC;IACD,IAAI,iBAAiB,GAAG,IAAI,CAAC;IAC7B,OAAO,cAAc,CAAC,MAAM,EAAE,CAAC,UAAU,EAAE,EAAE;QAC5C,MAAM,YAAY,GAAG,kCAAkC,CAAC,UAAU,CAAC,CAAC;QACpE,IAAI,iBAAiB,EAAE,CAAC;YACvB,iBAAiB,GAAG,KAAK,CAAC;YAC1B,OAAO,0BAA0B,CAChC,UAAU,EACV,0BAA0B,EAC1B,YAAY,EACZ,IAAI,CACJ,CAAC;QACH,CAAC;aAAM,CAAC;YACP,OAAO,0BAA0B,CAChC,UAAU,EACV,0BAA0B,EAC1B,mBAAmB,CAAC,YAAY,CAAC,EACjC,KAAK,CACL,CAAC;QACH,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC;AAlED,4CAkEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport type { ICodecFamily, ICodecOptions } from \"../codec/index.js\";\nimport {\n\ttype ChangeEncodingContext,\n\ttype ChangeFamily,\n\ttype ChangeRebaser,\n\ttype DeltaDetachedNodeId,\n\ttype RevisionMetadataSource,\n\ttype RevisionTag,\n\ttype RevisionTagCodec,\n\ttype TaggedChange,\n\tmapTaggedChange,\n} from \"../core/index.js\";\nimport {\n\ttype FieldBatchCodec,\n\tModularChangeFamily,\n\ttype ModularChangeset,\n\ttype TreeChunk,\n\ttype TreeCompressionStrategy,\n\tfieldKindConfigurations,\n\tfieldKinds,\n\tmakeModularChangeCodecFamily,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype Mutable,\n\ttype NestedSet,\n\taddToNestedSet,\n\tfail,\n\tnestedSetContains,\n} from \"../util/index.js\";\n\nimport { makeSharedTreeChangeCodecFamily } from \"./sharedTreeChangeCodecs.js\";\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\nimport { SharedTreeEditBuilder } from \"./sharedTreeEditBuilder.js\";\n\n/**\n * Implementation of {@link ChangeFamily} that combines edits to fields and schema changes.\n *\n * @sealed\n */\nexport class SharedTreeChangeFamily\n\timplements\n\t\tChangeFamily<SharedTreeEditBuilder, SharedTreeChange>,\n\t\tChangeRebaser<SharedTreeChange>\n{\n\tpublic static readonly emptyChange: SharedTreeChange = {\n\t\tchanges: [],\n\t};\n\n\tpublic readonly codecs: ICodecFamily<SharedTreeChange, ChangeEncodingContext>;\n\tprivate readonly modularChangeFamily: ModularChangeFamily;\n\n\tpublic constructor(\n\t\trevisionTagCodec: RevisionTagCodec,\n\t\tfieldBatchCodec: FieldBatchCodec,\n\t\tcodecOptions: ICodecOptions,\n\t\tchunkCompressionStrategy?: TreeCompressionStrategy,\n\t) {\n\t\tconst modularChangeCodec = makeModularChangeCodecFamily(\n\t\t\tfieldKindConfigurations,\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\tcodecOptions,\n\t\t\tchunkCompressionStrategy,\n\t\t);\n\t\tthis.modularChangeFamily = new ModularChangeFamily(fieldKinds, modularChangeCodec);\n\t\tthis.codecs = makeSharedTreeChangeCodecFamily(\n\t\t\tthis.modularChangeFamily.codecs,\n\t\t\tcodecOptions,\n\t\t);\n\t}\n\n\tpublic buildEditor(\n\t\tchangeReceiver: (change: SharedTreeChange) => void,\n\t): SharedTreeEditBuilder {\n\t\treturn new SharedTreeEditBuilder(this.modularChangeFamily, changeReceiver);\n\t}\n\n\tpublic compose(changes: TaggedChange<SharedTreeChange>[]): SharedTreeChange {\n\t\tconst newChanges: Mutable<SharedTreeChange[\"changes\"]> = [];\n\t\tconst dataChangeRun: TaggedChange<ModularChangeset>[] = [];\n\n\t\tconst flushDataChangeRun = (): void => {\n\t\t\tif (dataChangeRun.length > 0) {\n\t\t\t\tnewChanges.push({\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tinnerChange: this.modularChangeFamily.compose(dataChangeRun),\n\t\t\t\t});\n\t\t\t\tdataChangeRun.length = 0;\n\t\t\t}\n\t\t};\n\n\t\tfor (const topChange of changes) {\n\t\t\tfor (const change of topChange.change.changes) {\n\t\t\t\tif (change.type === \"schema\") {\n\t\t\t\t\tflushDataChangeRun();\n\t\t\t\t\tnewChanges.push(change);\n\t\t\t\t} else {\n\t\t\t\t\tdataChangeRun.push(mapTaggedChange(topChange, change.innerChange));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tflushDataChangeRun();\n\t\treturn { changes: newChanges };\n\t}\n\n\tpublic invert(\n\t\tchange: TaggedChange<SharedTreeChange>,\n\t\tisRollback: boolean,\n\t): SharedTreeChange {\n\t\tconst invertInnerChange: (\n\t\t\tinnerChange: SharedTreeChange[\"changes\"][number],\n\t\t) => SharedTreeChange[\"changes\"][number] = (innerChange) => {\n\t\t\tswitch (innerChange.type) {\n\t\t\t\tcase \"data\":\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: \"data\",\n\t\t\t\t\t\tinnerChange: this.modularChangeFamily.invert(\n\t\t\t\t\t\t\tmapTaggedChange(change, innerChange.innerChange),\n\t\t\t\t\t\t\tisRollback,\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\tcase \"schema\": {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: \"schema\",\n\t\t\t\t\t\tinnerChange: {\n\t\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t\tnew: innerChange.innerChange.schema.old,\n\t\t\t\t\t\t\t\told: innerChange.innerChange.schema.new,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tisInverse: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tfail(\"Unknown SharedTree change type.\");\n\t\t\t}\n\t\t};\n\t\treturn {\n\t\t\tchanges: change.change.changes.map(invertInnerChange).reverse(),\n\t\t};\n\t}\n\n\tpublic rebase(\n\t\tchange: TaggedChange<SharedTreeChange>,\n\t\tover: TaggedChange<SharedTreeChange>,\n\t\trevisionMetadata: RevisionMetadataSource,\n\t): SharedTreeChange {\n\t\tif (change.change.changes.length === 0 || over.change.changes.length === 0) {\n\t\t\treturn change.change;\n\t\t}\n\n\t\tif (hasSchemaChange(change.change) || hasSchemaChange(over.change)) {\n\t\t\t// Any SharedTreeChange (a list of sub-changes) that contains a schema change will cause ANY change that rebases over it to conflict.\n\t\t\t// Similarly, any SharedTreeChange containing a schema change will fail to rebase over ANY change.\n\t\t\t// Those two combine to mean: no concurrency with schema changes is supported.\n\t\t\t// This is fine because it's an open problem. Example: a tree with an A at the root and a schema that allows an A | B at the root will\n\t\t\t// become out of schema if a schema changes to restrict root types to just A is concurrent with a data change that sets it to a B.\n\t\t\t// We don't have an efficient way to detect this document-wide and there are varying opinions on restricting schema changes to prevent this.\n\t\t\t// A SharedTreeChange containing a schema change will NOT conflict in a non-concurrency case, as the \"meatless sandwich\" optimization\n\t\t\t// will result in rebase never being called.\n\t\t\treturn SharedTreeChangeFamily.emptyChange;\n\t\t}\n\t\tassert(\n\t\t\tchange.change.changes.length === 1 && over.change.changes.length === 1,\n\t\t\t0x884 /* SharedTreeChange should have exactly one inner change if no schema change is present. */,\n\t\t);\n\n\t\tconst dataChangeIntention = change.change.changes[0];\n\t\tconst dataChangeOver = over.change.changes[0];\n\t\tassert(\n\t\t\tdataChangeIntention.type === \"data\" && dataChangeOver.type === \"data\",\n\t\t\t0x885 /* Data change should be present. */,\n\t\t);\n\n\t\treturn {\n\t\t\tchanges: [\n\t\t\t\t{\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tinnerChange: this.modularChangeFamily.rebase(\n\t\t\t\t\t\tmapTaggedChange(change, dataChangeIntention.innerChange),\n\t\t\t\t\t\tmapTaggedChange(over, dataChangeOver.innerChange),\n\t\t\t\t\t\trevisionMetadata,\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t}\n\n\tpublic changeRevision(\n\t\tchange: SharedTreeChange,\n\t\tnewRevision: RevisionTag | undefined,\n\t\trollbackOf?: RevisionTag,\n\t): SharedTreeChange {\n\t\treturn {\n\t\t\tchanges: change.changes.map((inner) => {\n\t\t\t\treturn inner.type === \"data\"\n\t\t\t\t\t? {\n\t\t\t\t\t\t\t...inner,\n\t\t\t\t\t\t\tinnerChange: this.modularChangeFamily.rebaser.changeRevision(\n\t\t\t\t\t\t\t\tinner.innerChange,\n\t\t\t\t\t\t\t\tnewRevision,\n\t\t\t\t\t\t\t\trollbackOf,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t: inner;\n\t\t\t}),\n\t\t};\n\t}\n\n\tpublic get rebaser(): ChangeRebaser<SharedTreeChange> {\n\t\treturn this;\n\t}\n}\n\nexport function hasSchemaChange(change: SharedTreeChange): boolean {\n\treturn change.changes.some((innerChange) => innerChange.type === \"schema\");\n}\n\nfunction mapDataChanges(\n\tchange: SharedTreeChange,\n\tmap: (change: ModularChangeset) => ModularChangeset,\n): SharedTreeChange {\n\treturn {\n\t\tchanges: change.changes.map((dataOrSchemaChange) => {\n\t\t\tif (dataOrSchemaChange.type === \"data\") {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tinnerChange: map(dataOrSchemaChange.innerChange),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn dataOrSchemaChange;\n\t\t}),\n\t};\n}\n\n/**\n * Produces an equivalent change with an updated set of appropriate refreshers.\n * @param change - The change to compute refreshers for. Not mutated.\n * @param getDetachedNode - retrieves a {@link TreeChunk} for the corresponding detached node id.\n * Is expected to read from a forest in a state that corresponds to the input context of the given change.\n * @returns An equivalent change with an updated set of appropriate refreshers.\n */\nexport function updateRefreshers(\n\tchange: SharedTreeChange,\n\tgetDetachedNode: (id: DeltaDetachedNodeId) => TreeChunk | undefined,\n\trelevantRemovedRootsFromDataChange: (\n\t\ttaggedChange: ModularChangeset,\n\t) => Iterable<DeltaDetachedNodeId>,\n\tupdateDataChangeRefreshers: (\n\t\tchange: ModularChangeset,\n\t\tgetDetachedNode: (id: DeltaDetachedNodeId) => TreeChunk | undefined,\n\t\tremovedRoots: Iterable<DeltaDetachedNodeId>,\n\t\trequireRefreshers: boolean,\n\t) => ModularChangeset,\n): SharedTreeChange {\n\t// Adding refreshers to a SharedTreeChange is not as simple as adding refreshers to each of its data changes.\n\t// This is because earlier data changes affect the state of the forest in ways that can influence the refreshers\n\t// needed for later data changes. This can happen in two ways:\n\t// 1. By removing a tree that is a relevant root to a later data change.\n\t// 2. By changing the contents of a tree that is a relevant root to a later data change.\n\t// (Note that these two cases can compound)\n\t// Thankfully, in both of these cases, refreshers can be omitted from the later data changes because the forest\n\t// applying those data changes is guaranteed to still have have the relevant trees in memory.\n\t// This means that for the first data change, all required refreshers should be added (and none should be missing).\n\t// While for later data changes, we should not include refreshers that either:\n\t// A) were already included in the earlier data changes\n\t// B) correspond to trees that were removed by earlier data changes\n\t// Set A is excluded by tracking which roots have already been included in the earlier data changes, and filtering\n\t// them out from the relevant removed roots.\n\t// Set B is excluded because the `getDetachedNode` is bound to return `undefined` for them, which tell\n\t// `defaultUpdateRefreshers` to ignore. One downside of this approach is that it prevents `defaultUpdateRefreshers`\n\t// from detecting cases where a detached node is missing for another reason (which would be a bug).\n\n\t// The roots that have been included as refreshers across all data changes so far.\n\tconst includedRoots: NestedSet<RevisionTag | undefined, number> = new Map();\n\tfunction getAndRememberDetachedNode(id: DeltaDetachedNodeId): TreeChunk | undefined {\n\t\taddToNestedSet(includedRoots, id.major, id.minor);\n\t\treturn getDetachedNode(id);\n\t}\n\tfunction* filterIncludedRoots(\n\t\ttoFilter: Iterable<DeltaDetachedNodeId>,\n\t): Iterable<DeltaDetachedNodeId> {\n\t\tfor (const id of toFilter) {\n\t\t\tif (!nestedSetContains(includedRoots, id.major, id.minor)) {\n\t\t\t\tyield id;\n\t\t\t}\n\t\t}\n\t}\n\tlet isFirstDataChange = true;\n\treturn mapDataChanges(change, (dataChange) => {\n\t\tconst removedRoots = relevantRemovedRootsFromDataChange(dataChange);\n\t\tif (isFirstDataChange) {\n\t\t\tisFirstDataChange = false;\n\t\t\treturn updateDataChangeRefreshers(\n\t\t\t\tdataChange,\n\t\t\t\tgetAndRememberDetachedNode,\n\t\t\t\tremovedRoots,\n\t\t\t\ttrue,\n\t\t\t);\n\t\t} else {\n\t\t\treturn updateDataChangeRefreshers(\n\t\t\t\tdataChange,\n\t\t\t\tgetAndRememberDetachedNode,\n\t\t\t\tfilterIncludedRoots(removedRoots),\n\t\t\t\tfalse,\n\t\t\t);\n\t\t}\n\t});\n}\n"]}
1
+ {"version":3,"file":"sharedTreeChangeFamily.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeChangeFamily.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAkE;AAGlE,+CAU0B;AAC1B,4DASuC;AACvC,+CAM0B;AAE1B,2EAA8E;AAE9E,yEAAmE;AAEnE;;;;GAIG;AACH,MAAa,sBAAsB;IAYlC,YACC,gBAAkC,EAClC,eAAgC,EAChC,YAA2B,EAC3B,wBAAkD;QAElD,MAAM,kBAAkB,GAAG,IAAA,uCAA4B,EACtD,kCAAuB,EACvB,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,wBAAwB,CACxB,CAAC;QACF,IAAI,CAAC,mBAAmB,GAAG,IAAI,8BAAmB,CAAC,qBAAU,EAAE,kBAAkB,CAAC,CAAC;QACnF,IAAI,CAAC,MAAM,GAAG,IAAA,2DAA+B,EAC5C,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAC/B,YAAY,CACZ,CAAC;IACH,CAAC;IAEM,WAAW,CACjB,cAAkD;QAElD,OAAO,IAAI,gDAAqB,CAAC,IAAI,CAAC,mBAAmB,EAAE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AAiB,EAAC,aAAa,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC3D,MAAM,EAAE,CAAC;YACV,CAAC;QACF,CAAC;IACF,CAAC;IACD,IAAI,iBAAiB,GAAG,IAAI,CAAC;IAC7B,OAAO,cAAc,CAAC,MAAM,EAAE,CAAC,UAAU,EAAE,EAAE;QAC5C,MAAM,YAAY,GAAG,kCAAkC,CAAC,UAAU,CAAC,CAAC;QACpE,IAAI,iBAAiB,EAAE,CAAC;YACvB,iBAAiB,GAAG,KAAK,CAAC;YAC1B,OAAO,0BAA0B,CAChC,UAAU,EACV,0BAA0B,EAC1B,YAAY,EACZ,IAAI,CACJ,CAAC;QACH,CAAC;aAAM,CAAC;YACP,OAAO,0BAA0B,CAChC,UAAU,EACV,0BAA0B,EAC1B,mBAAmB,CAAC,YAAY,CAAC,EACjC,KAAK,CACL,CAAC;QACH,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC;AAlED,4CAkEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob } from \"@fluidframework/core-utils/internal\";\n\nimport type { ICodecFamily, ICodecOptions } from \"../codec/index.js\";\nimport {\n\ttype ChangeEncodingContext,\n\ttype ChangeFamily,\n\ttype ChangeRebaser,\n\ttype DeltaDetachedNodeId,\n\ttype RevisionMetadataSource,\n\ttype RevisionTag,\n\ttype RevisionTagCodec,\n\ttype TaggedChange,\n\tmapTaggedChange,\n} from \"../core/index.js\";\nimport {\n\ttype FieldBatchCodec,\n\tModularChangeFamily,\n\ttype ModularChangeset,\n\ttype TreeChunk,\n\ttype TreeCompressionStrategy,\n\tfieldKindConfigurations,\n\tfieldKinds,\n\tmakeModularChangeCodecFamily,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype Mutable,\n\ttype NestedSet,\n\taddToNestedSet,\n\tfail,\n\tnestedSetContains,\n} from \"../util/index.js\";\n\nimport { makeSharedTreeChangeCodecFamily } from \"./sharedTreeChangeCodecs.js\";\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\nimport { SharedTreeEditBuilder } from \"./sharedTreeEditBuilder.js\";\n\n/**\n * Implementation of {@link ChangeFamily} that combines edits to fields and schema changes.\n *\n * @sealed\n */\nexport class SharedTreeChangeFamily\n\timplements\n\t\tChangeFamily<SharedTreeEditBuilder, SharedTreeChange>,\n\t\tChangeRebaser<SharedTreeChange>\n{\n\tpublic static readonly emptyChange: SharedTreeChange = {\n\t\tchanges: [],\n\t};\n\n\tpublic readonly codecs: ICodecFamily<SharedTreeChange, ChangeEncodingContext>;\n\tprivate readonly modularChangeFamily: ModularChangeFamily;\n\n\tpublic constructor(\n\t\trevisionTagCodec: RevisionTagCodec,\n\t\tfieldBatchCodec: FieldBatchCodec,\n\t\tcodecOptions: ICodecOptions,\n\t\tchunkCompressionStrategy?: TreeCompressionStrategy,\n\t) {\n\t\tconst modularChangeCodec = makeModularChangeCodecFamily(\n\t\t\tfieldKindConfigurations,\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\tcodecOptions,\n\t\t\tchunkCompressionStrategy,\n\t\t);\n\t\tthis.modularChangeFamily = new ModularChangeFamily(fieldKinds, modularChangeCodec);\n\t\tthis.codecs = makeSharedTreeChangeCodecFamily(\n\t\t\tthis.modularChangeFamily.codecs,\n\t\t\tcodecOptions,\n\t\t);\n\t}\n\n\tpublic buildEditor(\n\t\tchangeReceiver: (change: SharedTreeChange) => void,\n\t): SharedTreeEditBuilder {\n\t\treturn new SharedTreeEditBuilder(this.modularChangeFamily, changeReceiver);\n\t}\n\n\tpublic compose(changes: TaggedChange<SharedTreeChange>[]): SharedTreeChange {\n\t\tconst newChanges: Mutable<SharedTreeChange[\"changes\"]> = [];\n\t\tconst dataChangeRun: TaggedChange<ModularChangeset>[] = [];\n\n\t\tconst flushDataChangeRun = (): void => {\n\t\t\tif (dataChangeRun.length > 0) {\n\t\t\t\tnewChanges.push({\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tinnerChange: this.modularChangeFamily.compose(dataChangeRun),\n\t\t\t\t});\n\t\t\t\tdataChangeRun.length = 0;\n\t\t\t}\n\t\t};\n\n\t\tfor (const topChange of changes) {\n\t\t\tfor (const change of topChange.change.changes) {\n\t\t\t\tif (change.type === \"schema\") {\n\t\t\t\t\tflushDataChangeRun();\n\t\t\t\t\tnewChanges.push(change);\n\t\t\t\t} else {\n\t\t\t\t\tdataChangeRun.push(mapTaggedChange(topChange, change.innerChange));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tflushDataChangeRun();\n\t\treturn { changes: newChanges };\n\t}\n\n\tpublic invert(\n\t\tchange: TaggedChange<SharedTreeChange>,\n\t\tisRollback: boolean,\n\t): SharedTreeChange {\n\t\tconst invertInnerChange: (\n\t\t\tinnerChange: SharedTreeChange[\"changes\"][number],\n\t\t) => SharedTreeChange[\"changes\"][number] = (innerChange) => {\n\t\t\tswitch (innerChange.type) {\n\t\t\t\tcase \"data\":\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: \"data\",\n\t\t\t\t\t\tinnerChange: this.modularChangeFamily.invert(\n\t\t\t\t\t\t\tmapTaggedChange(change, innerChange.innerChange),\n\t\t\t\t\t\t\tisRollback,\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\tcase \"schema\": {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: \"schema\",\n\t\t\t\t\t\tinnerChange: {\n\t\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t\tnew: innerChange.innerChange.schema.old,\n\t\t\t\t\t\t\t\told: innerChange.innerChange.schema.new,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tisInverse: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tfail(\"Unknown SharedTree change type.\");\n\t\t\t}\n\t\t};\n\t\treturn {\n\t\t\tchanges: change.change.changes.map(invertInnerChange).reverse(),\n\t\t};\n\t}\n\n\tpublic rebase(\n\t\tchange: TaggedChange<SharedTreeChange>,\n\t\tover: TaggedChange<SharedTreeChange>,\n\t\trevisionMetadata: RevisionMetadataSource,\n\t): SharedTreeChange {\n\t\tif (change.change.changes.length === 0 || over.change.changes.length === 0) {\n\t\t\treturn change.change;\n\t\t}\n\n\t\tif (hasSchemaChange(change.change) || hasSchemaChange(over.change)) {\n\t\t\t// Any SharedTreeChange (a list of sub-changes) that contains a schema change will cause ANY change that rebases over it to conflict.\n\t\t\t// Similarly, any SharedTreeChange containing a schema change will fail to rebase over ANY change.\n\t\t\t// Those two combine to mean: no concurrency with schema changes is supported.\n\t\t\t// This is fine because it's an open problem. Example: a tree with an A at the root and a schema that allows an A | B at the root will\n\t\t\t// become out of schema if a schema changes to restrict root types to just A is concurrent with a data change that sets it to a B.\n\t\t\t// We don't have an efficient way to detect this document-wide and there are varying opinions on restricting schema changes to prevent this.\n\t\t\t// A SharedTreeChange containing a schema change will NOT conflict in a non-concurrency case, as the \"meatless sandwich\" optimization\n\t\t\t// will result in rebase never being called.\n\t\t\treturn SharedTreeChangeFamily.emptyChange;\n\t\t}\n\t\tassert(\n\t\t\tchange.change.changes.length === 1 && over.change.changes.length === 1,\n\t\t\t0x884 /* SharedTreeChange should have exactly one inner change if no schema change is present. */,\n\t\t);\n\n\t\tconst dataChangeIntention = change.change.changes[0] ?? oob();\n\t\tconst dataChangeOver = over.change.changes[0] ?? oob();\n\t\tassert(\n\t\t\tdataChangeIntention.type === \"data\" && dataChangeOver.type === \"data\",\n\t\t\t0x885 /* Data change should be present. */,\n\t\t);\n\n\t\treturn {\n\t\t\tchanges: [\n\t\t\t\t{\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tinnerChange: this.modularChangeFamily.rebase(\n\t\t\t\t\t\tmapTaggedChange(change, dataChangeIntention.innerChange),\n\t\t\t\t\t\tmapTaggedChange(over, dataChangeOver.innerChange),\n\t\t\t\t\t\trevisionMetadata,\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t}\n\n\tpublic changeRevision(\n\t\tchange: SharedTreeChange,\n\t\tnewRevision: RevisionTag | undefined,\n\t\trollbackOf?: RevisionTag,\n\t): SharedTreeChange {\n\t\treturn {\n\t\t\tchanges: change.changes.map((inner) => {\n\t\t\t\treturn inner.type === \"data\"\n\t\t\t\t\t? {\n\t\t\t\t\t\t\t...inner,\n\t\t\t\t\t\t\tinnerChange: this.modularChangeFamily.rebaser.changeRevision(\n\t\t\t\t\t\t\t\tinner.innerChange,\n\t\t\t\t\t\t\t\tnewRevision,\n\t\t\t\t\t\t\t\trollbackOf,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t: inner;\n\t\t\t}),\n\t\t};\n\t}\n\n\tpublic get rebaser(): ChangeRebaser<SharedTreeChange> {\n\t\treturn this;\n\t}\n}\n\nexport function hasSchemaChange(change: SharedTreeChange): boolean {\n\treturn change.changes.some((innerChange) => innerChange.type === \"schema\");\n}\n\nfunction mapDataChanges(\n\tchange: SharedTreeChange,\n\tmap: (change: ModularChangeset) => ModularChangeset,\n): SharedTreeChange {\n\treturn {\n\t\tchanges: change.changes.map((dataOrSchemaChange) => {\n\t\t\tif (dataOrSchemaChange.type === \"data\") {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tinnerChange: map(dataOrSchemaChange.innerChange),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn dataOrSchemaChange;\n\t\t}),\n\t};\n}\n\n/**\n * Produces an equivalent change with an updated set of appropriate refreshers.\n * @param change - The change to compute refreshers for. Not mutated.\n * @param getDetachedNode - retrieves a {@link TreeChunk} for the corresponding detached node id.\n * Is expected to read from a forest in a state that corresponds to the input context of the given change.\n * @returns An equivalent change with an updated set of appropriate refreshers.\n */\nexport function updateRefreshers(\n\tchange: SharedTreeChange,\n\tgetDetachedNode: (id: DeltaDetachedNodeId) => TreeChunk | undefined,\n\trelevantRemovedRootsFromDataChange: (\n\t\ttaggedChange: ModularChangeset,\n\t) => Iterable<DeltaDetachedNodeId>,\n\tupdateDataChangeRefreshers: (\n\t\tchange: ModularChangeset,\n\t\tgetDetachedNode: (id: DeltaDetachedNodeId) => TreeChunk | undefined,\n\t\tremovedRoots: Iterable<DeltaDetachedNodeId>,\n\t\trequireRefreshers: boolean,\n\t) => ModularChangeset,\n): SharedTreeChange {\n\t// Adding refreshers to a SharedTreeChange is not as simple as adding refreshers to each of its data changes.\n\t// This is because earlier data changes affect the state of the forest in ways that can influence the refreshers\n\t// needed for later data changes. This can happen in two ways:\n\t// 1. By removing a tree that is a relevant root to a later data change.\n\t// 2. By changing the contents of a tree that is a relevant root to a later data change.\n\t// (Note that these two cases can compound)\n\t// Thankfully, in both of these cases, refreshers can be omitted from the later data changes because the forest\n\t// applying those data changes is guaranteed to still have have the relevant trees in memory.\n\t// This means that for the first data change, all required refreshers should be added (and none should be missing).\n\t// While for later data changes, we should not include refreshers that either:\n\t// A) were already included in the earlier data changes\n\t// B) correspond to trees that were removed by earlier data changes\n\t// Set A is excluded by tracking which roots have already been included in the earlier data changes, and filtering\n\t// them out from the relevant removed roots.\n\t// Set B is excluded because the `getDetachedNode` is bound to return `undefined` for them, which tell\n\t// `defaultUpdateRefreshers` to ignore. One downside of this approach is that it prevents `defaultUpdateRefreshers`\n\t// from detecting cases where a detached node is missing for another reason (which would be a bug).\n\n\t// The roots that have been included as refreshers across all data changes so far.\n\tconst includedRoots: NestedSet<RevisionTag | undefined, number> = new Map();\n\tfunction getAndRememberDetachedNode(id: DeltaDetachedNodeId): TreeChunk | undefined {\n\t\taddToNestedSet(includedRoots, id.major, id.minor);\n\t\treturn getDetachedNode(id);\n\t}\n\tfunction* filterIncludedRoots(\n\t\ttoFilter: Iterable<DeltaDetachedNodeId>,\n\t): Iterable<DeltaDetachedNodeId> {\n\t\tfor (const id of toFilter) {\n\t\t\tif (!nestedSetContains(includedRoots, id.major, id.minor)) {\n\t\t\t\tyield id;\n\t\t\t}\n\t\t}\n\t}\n\tlet isFirstDataChange = true;\n\treturn mapDataChanges(change, (dataChange) => {\n\t\tconst removedRoots = relevantRemovedRootsFromDataChange(dataChange);\n\t\tif (isFirstDataChange) {\n\t\t\tisFirstDataChange = false;\n\t\t\treturn updateDataChangeRefreshers(\n\t\t\t\tdataChange,\n\t\t\t\tgetAndRememberDetachedNode,\n\t\t\t\tremovedRoots,\n\t\t\t\ttrue,\n\t\t\t);\n\t\t} else {\n\t\t\treturn updateDataChangeRefreshers(\n\t\t\t\tdataChange,\n\t\t\t\tgetAndRememberDetachedNode,\n\t\t\t\tfilterIncludedRoots(removedRoots),\n\t\t\t\tfalse,\n\t\t\t);\n\t\t}\n\t});\n}\n"]}
@@ -8,7 +8,6 @@ import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
8
8
  /**
9
9
  * Editor for schema changes.
10
10
  * The only currently supported operation is to replace the stored schema.
11
- * @internal
12
11
  */
13
12
  export interface ISchemaEditor {
14
13
  /**
@@ -20,7 +19,6 @@ export interface ISchemaEditor {
20
19
  }
21
20
  /**
22
21
  * SharedTree editor for transactional tree data and schema changes.
23
- * @internal
24
22
  */
25
23
  export interface ISharedTreeEditor extends IDefaultEditBuilder {
26
24
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeEditBuilder.d.ts","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeEditBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EACN,kBAAkB,EAClB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEnE;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC7B;;;;OAIG;IACH,eAAe,C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AE,gBAAgB,KAAK,IAAI;CAwBpE"}
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeEditBuilder.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeEditBuilder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,4DAIuC;AA6BvC;;;GAGG;AACH,MAAa,qBACZ,SAAQ,6BAAkB;IAK1B,YACC,mBAAwC,EACvB,cAAkD;QAEnE,KAAK,CAAC,mBAAmB,EAAE,CAAC,MAAM,EAAE,EAAE,CACrC,cAAc,CAAC;YACd,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;SAChD,CAAC,CACF,CAAC;QANe,mBAAc,GAAd,cAAc,CAAoC;QAQnE,IAAI,CAAC,MAAM,GAAG;YACb,eAAe,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE;gBACzC,IAAI,CAAC,cAAc,CAAC;oBACnB,OAAO,EAAE;wBACR;4BACC,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE;gCACZ,MAAM,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE;gCAC1C,SAAS,EAAE,KAAK;6BAChB;yBACD;qBACD;iBACD,CAAC,CAAC;YACJ,CAAC;SACD,CAAC;IACH,CAAC;CACD;AAhCD,sDAgCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ChangeFamilyEditor, TreeStoredSchema } from \"../core/index.js\";\nimport {\n\tDefaultEditBuilder,\n\ttype IDefaultEditBuilder,\n\ttype ModularChangeFamily,\n} from \"../feature-libraries/index.js\";\n\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\n\n/**\n * Editor for schema changes.\n * The only currently supported operation is to replace the stored schema.\n * @internal\n */\nexport interface ISchemaEditor {\n\t/**\n\t * Updates the stored schema.\n\t * @param oldSchema - The schema being overwritten.\n\t * @param newSchema - The new schema to apply.\n\t */\n\tsetStoredSchema(oldSchema: TreeStoredSchema, newSchema: TreeStoredSchema): void;\n}\n\n/**\n * SharedTree editor for transactional tree data and schema changes.\n * @internal\n */\nexport interface ISharedTreeEditor extends IDefaultEditBuilder {\n\t/**\n\t * Editor for schema changes.\n\t */\n\tschema: ISchemaEditor;\n}\n\n/**\n * Implementation of {@link IDefaultEditBuilder} based on the default set of supported field kinds.\n * @sealed\n */\nexport class SharedTreeEditBuilder\n\textends DefaultEditBuilder\n\timplements ChangeFamilyEditor, ISharedTreeEditor\n{\n\tpublic readonly schema: ISchemaEditor;\n\n\tpublic constructor(\n\t\tmodularChangeFamily: ModularChangeFamily,\n\t\tprivate readonly changeReceiver: (change: SharedTreeChange) => void,\n\t) {\n\t\tsuper(modularChangeFamily, (change) =>\n\t\t\tchangeReceiver({\n\t\t\t\tchanges: [{ type: \"data\", innerChange: change }],\n\t\t\t}),\n\t\t);\n\n\t\tthis.schema = {\n\t\t\tsetStoredSchema: (oldSchema, newSchema) => {\n\t\t\t\tthis.changeReceiver({\n\t\t\t\t\tchanges: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"schema\",\n\t\t\t\t\t\t\tinnerChange: {\n\t\t\t\t\t\t\t\tschema: { new: newSchema, old: oldSchema },\n\t\t\t\t\t\t\t\tisInverse: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t}\n}\n"]}
1
+ {"version":3,"file":"sharedTreeEditBuilder.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeEditBuilder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,4DAIuC;AA2BvC;;;GAGG;AACH,MAAa,qBACZ,SAAQ,6BAAkB;IAK1B,YACC,mBAAwC,EACvB,cAAkD;QAEnE,KAAK,CAAC,mBAAmB,EAAE,CAAC,MAAM,EAAE,EAAE,CACrC,cAAc,CAAC;YACd,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;SAChD,CAAC,CACF,CAAC;QANe,mBAAc,GAAd,cAAc,CAAoC;QAQnE,IAAI,CAAC,MAAM,GAAG;YACb,eAAe,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE;gBACzC,IAAI,CAAC,cAAc,CAAC;oBACnB,OAAO,EAAE;wBACR;4BACC,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE;gCACZ,MAAM,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE;gCAC1C,SAAS,EAAE,KAAK;6BAChB;yBACD;qBACD;iBACD,CAAC,CAAC;YACJ,CAAC;SACD,CAAC;IACH,CAAC;CACD;AAhCD,sDAgCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ChangeFamilyEditor, TreeStoredSchema } from \"../core/index.js\";\nimport {\n\tDefaultEditBuilder,\n\ttype IDefaultEditBuilder,\n\ttype ModularChangeFamily,\n} from \"../feature-libraries/index.js\";\n\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\n\n/**\n * Editor for schema changes.\n * The only currently supported operation is to replace the stored schema.\n */\nexport interface ISchemaEditor {\n\t/**\n\t * Updates the stored schema.\n\t * @param oldSchema - The schema being overwritten.\n\t * @param newSchema - The new schema to apply.\n\t */\n\tsetStoredSchema(oldSchema: TreeStoredSchema, newSchema: TreeStoredSchema): void;\n}\n\n/**\n * SharedTree editor for transactional tree data and schema changes.\n */\nexport interface ISharedTreeEditor extends IDefaultEditBuilder {\n\t/**\n\t * Editor for schema changes.\n\t */\n\tschema: ISchemaEditor;\n}\n\n/**\n * Implementation of {@link IDefaultEditBuilder} based on the default set of supported field kinds.\n * @sealed\n */\nexport class SharedTreeEditBuilder\n\textends DefaultEditBuilder\n\timplements ChangeFamilyEditor, ISharedTreeEditor\n{\n\tpublic readonly schema: ISchemaEditor;\n\n\tpublic constructor(\n\t\tmodularChangeFamily: ModularChangeFamily,\n\t\tprivate readonly changeReceiver: (change: SharedTreeChange) => void,\n\t) {\n\t\tsuper(modularChangeFamily, (change) =>\n\t\t\tchangeReceiver({\n\t\t\t\tchanges: [{ type: \"data\", innerChange: change }],\n\t\t\t}),\n\t\t);\n\n\t\tthis.schema = {\n\t\t\tsetStoredSchema: (oldSchema, newSchema) => {\n\t\t\t\tthis.changeReceiver({\n\t\t\t\t\tchanges: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"schema\",\n\t\t\t\t\t\t\tinnerChange: {\n\t\t\t\t\t\t\t\tschema: { new: newSchema, old: oldSchema },\n\t\t\t\t\t\t\t\tisInverse: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t}\n}\n"]}
@@ -57,7 +57,7 @@ function runTransaction(treeOrNode, transaction, preconditions = []) {
57
57
  else {
58
58
  const node = treeOrNode;
59
59
  const t = transaction;
60
- const context = (0, index_js_2.getFlexNode)(node).context;
60
+ const context = (0, index_js_2.getOrCreateInnerNode)(node).context;
61
61
  (0, internal_1.assert)(context instanceof index_js_1.Context, 0x901 /* Unsupported context */);
62
62
  const treeView = treeView_js_1.contextToTreeView.get(context) ?? (0, index_js_3.fail)("Expected view to be registered for context");
63
63
  return runTransactionInCheckout(treeView.checkout, () => t(node), preconditions);
@@ -69,7 +69,7 @@ function runTransactionInCheckout(checkout, transaction, preconditions) {
69
69
  for (const constraint of preconditions) {
70
70
  switch (constraint.type) {
71
71
  case "nodeInDocument": {
72
- const node = (0, index_js_2.getFlexNode)(constraint.node);
72
+ const node = (0, index_js_2.getOrCreateInnerNode)(constraint.node);
73
73
  (0, internal_1.assert)(exports.treeApi.status(constraint.node) === index_js_1.TreeStatus.InDocument, 0x90f /* Attempted to apply "nodeExists" constraint when building a transaction, but the node is not in the document. */);
74
74
  checkout.editor.addNodeExistsConstraint(node.anchorNode);
75
75
  break;