@fluidframework/tree 2.23.0 → 2.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1027) hide show
  1. package/CHANGELOG.md +1636 -1466
  2. package/api-extractor/api-extractor.current.json +0 -3
  3. package/api-report/tree.alpha.api.md +261 -100
  4. package/api-report/tree.beta.api.md +86 -61
  5. package/api-report/tree.legacy.alpha.api.md +86 -61
  6. package/api-report/tree.legacy.public.api.md +86 -61
  7. package/api-report/tree.public.api.md +86 -61
  8. package/dist/alpha.d.ts +32 -1
  9. package/dist/beta.d.ts +5 -1
  10. package/dist/codec/codec.d.ts +1 -1
  11. package/dist/codec/codec.d.ts.map +1 -1
  12. package/dist/codec/codec.js +3 -4
  13. package/dist/codec/codec.js.map +1 -1
  14. package/dist/codec/discriminatedUnions.d.ts.map +1 -1
  15. package/dist/codec/discriminatedUnions.js +1 -1
  16. package/dist/codec/discriminatedUnions.js.map +1 -1
  17. package/dist/core/forest/editableForest.d.ts +1 -14
  18. package/dist/core/forest/editableForest.d.ts.map +1 -1
  19. package/dist/core/forest/editableForest.js +1 -28
  20. package/dist/core/forest/editableForest.js.map +1 -1
  21. package/dist/core/forest/forest.d.ts +16 -3
  22. package/dist/core/forest/forest.d.ts.map +1 -1
  23. package/dist/core/forest/forest.js +4 -1
  24. package/dist/core/forest/forest.js.map +1 -1
  25. package/dist/core/forest/index.d.ts +1 -1
  26. package/dist/core/forest/index.d.ts.map +1 -1
  27. package/dist/core/forest/index.js +1 -2
  28. package/dist/core/forest/index.js.map +1 -1
  29. package/dist/core/index.d.ts +2 -2
  30. package/dist/core/index.d.ts.map +1 -1
  31. package/dist/core/index.js +3 -3
  32. package/dist/core/index.js.map +1 -1
  33. package/dist/core/rebase/utils.js +1 -1
  34. package/dist/core/rebase/utils.js.map +1 -1
  35. package/dist/core/schema-stored/schema.d.ts +4 -1
  36. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  37. package/dist/core/schema-stored/schema.js +8 -4
  38. package/dist/core/schema-stored/schema.js.map +1 -1
  39. package/dist/core/tree/anchorSet.d.ts +8 -3
  40. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  41. package/dist/core/tree/anchorSet.js +16 -9
  42. package/dist/core/tree/anchorSet.js.map +1 -1
  43. package/dist/core/tree/delta.d.ts +8 -23
  44. package/dist/core/tree/delta.d.ts.map +1 -1
  45. package/dist/core/tree/delta.js.map +1 -1
  46. package/dist/core/tree/deltaUtil.d.ts +3 -3
  47. package/dist/core/tree/deltaUtil.d.ts.map +1 -1
  48. package/dist/core/tree/deltaUtil.js +2 -2
  49. package/dist/core/tree/deltaUtil.js.map +1 -1
  50. package/dist/core/tree/index.d.ts +2 -2
  51. package/dist/core/tree/index.d.ts.map +1 -1
  52. package/dist/core/tree/index.js +2 -1
  53. package/dist/core/tree/index.js.map +1 -1
  54. package/dist/core/tree/pathTree.d.ts +54 -1
  55. package/dist/core/tree/pathTree.d.ts.map +1 -1
  56. package/dist/core/tree/pathTree.js +8 -1
  57. package/dist/core/tree/pathTree.js.map +1 -1
  58. package/dist/core/tree/treeTextFormat.js +2 -2
  59. package/dist/core/tree/treeTextFormat.js.map +1 -1
  60. package/dist/core/tree/visitDelta.d.ts +7 -5
  61. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  62. package/dist/core/tree/visitDelta.js +19 -9
  63. package/dist/core/tree/visitDelta.js.map +1 -1
  64. package/dist/core/tree/visitorUtils.d.ts +5 -23
  65. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  66. package/dist/core/tree/visitorUtils.js +8 -5
  67. package/dist/core/tree/visitorUtils.js.map +1 -1
  68. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts +1 -1
  69. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  70. package/dist/feature-libraries/chunked-forest/basicChunk.js +9 -9
  71. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  72. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +5 -3
  73. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  74. package/dist/feature-libraries/chunked-forest/chunkTree.js +12 -9
  75. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  76. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -0
  77. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  78. package/dist/feature-libraries/chunked-forest/chunkedForest.js +8 -5
  79. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  80. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +3 -3
  81. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  82. package/dist/feature-libraries/chunked-forest/codec/codecs.js +2 -2
  83. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  84. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
  85. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -4
  86. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  87. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js +2 -2
  88. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  89. package/dist/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.d.ts → schemaBasedEncode.d.ts} +1 -1
  90. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -0
  91. package/dist/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.js → schemaBasedEncode.js} +4 -5
  92. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -0
  93. package/dist/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
  94. package/dist/feature-libraries/chunked-forest/emptyChunk.js +15 -15
  95. package/dist/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  96. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +3 -2
  97. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  98. package/dist/feature-libraries/chunked-forest/uniformChunk.js +7 -6
  99. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  100. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -14
  101. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  102. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +5 -6
  103. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  104. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  105. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +19 -19
  106. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  107. package/dist/feature-libraries/default-schema/index.d.ts +1 -0
  108. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  109. package/dist/feature-libraries/default-schema/index.js +3 -1
  110. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  111. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts +21 -0
  112. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -0
  113. package/dist/feature-libraries/default-schema/mappedEditBuilder.js +57 -0
  114. package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -0
  115. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  116. package/dist/feature-libraries/default-schema/schemaChecker.js +1 -2
  117. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  118. package/dist/feature-libraries/deltaUtils.js +1 -1
  119. package/dist/feature-libraries/deltaUtils.js.map +1 -1
  120. package/dist/feature-libraries/flex-tree/context.d.ts +5 -5
  121. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  122. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  123. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -2
  124. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  125. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  126. package/dist/feature-libraries/flex-tree/lazyField.d.ts +5 -4
  127. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  128. package/dist/feature-libraries/flex-tree/lazyField.js +12 -9
  129. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  130. package/dist/feature-libraries/flex-tree/lazyNode.js +4 -4
  131. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  132. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  133. package/dist/feature-libraries/forest-summary/forestSummarizer.js +4 -5
  134. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  135. package/dist/feature-libraries/index.d.ts +2 -1
  136. package/dist/feature-libraries/index.d.ts.map +1 -1
  137. package/dist/feature-libraries/index.js +9 -7
  138. package/dist/feature-libraries/index.js.map +1 -1
  139. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  140. package/dist/feature-libraries/indexing/anchorTreeIndex.js +1 -1
  141. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  142. package/dist/feature-libraries/initializeForest.d.ts +18 -0
  143. package/dist/feature-libraries/initializeForest.d.ts.map +1 -0
  144. package/dist/feature-libraries/initializeForest.js +35 -0
  145. package/dist/feature-libraries/initializeForest.js.map +1 -0
  146. package/dist/feature-libraries/modular-schema/comparison.js +4 -4
  147. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  148. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  149. package/dist/feature-libraries/modular-schema/isNeverTree.js +2 -3
  150. package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  151. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  152. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +4 -4
  153. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  154. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +5 -5
  155. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  156. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +13 -19
  157. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  158. package/dist/feature-libraries/node-identifier/index.d.ts +8 -0
  159. package/dist/feature-libraries/node-identifier/index.d.ts.map +1 -0
  160. package/dist/feature-libraries/node-identifier/index.js +16 -0
  161. package/dist/feature-libraries/node-identifier/index.js.map +1 -0
  162. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts +22 -0
  163. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts.map +1 -0
  164. package/dist/feature-libraries/{node-key/mockNodeKeyManager.js → node-identifier/mockNodeIdentifierManager.js} +18 -18
  165. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -0
  166. package/dist/feature-libraries/node-identifier/nodeIdentifier.d.ts +38 -0
  167. package/dist/feature-libraries/node-identifier/nodeIdentifier.d.ts.map +1 -0
  168. package/dist/feature-libraries/node-identifier/nodeIdentifier.js +26 -0
  169. package/dist/feature-libraries/node-identifier/nodeIdentifier.js.map +1 -0
  170. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.d.ts +37 -0
  171. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.d.ts.map +1 -0
  172. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js +48 -0
  173. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -0
  174. package/dist/feature-libraries/object-forest/objectForest.d.ts +2 -1
  175. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  176. package/dist/feature-libraries/object-forest/objectForest.js +7 -3
  177. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  178. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  179. package/dist/feature-libraries/schema-index/codec.js +2 -1
  180. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  181. package/dist/feature-libraries/sequence-field/compose.d.ts +1 -1
  182. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  183. package/dist/feature-libraries/sequence-field/compose.js +16 -17
  184. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  185. package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  186. package/dist/feature-libraries/sequence-field/invert.js +1 -1
  187. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  188. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  189. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
  190. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  191. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  192. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
  193. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  194. package/dist/feature-libraries/sequence-field/utils.js +1 -1
  195. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  196. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  197. package/dist/feature-libraries/treeCursorUtils.js +5 -6
  198. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  199. package/dist/index.d.ts +5 -4
  200. package/dist/index.d.ts.map +1 -1
  201. package/dist/index.js +15 -3
  202. package/dist/index.js.map +1 -1
  203. package/dist/jsonDomainSchema.d.ts +15 -16
  204. package/dist/jsonDomainSchema.d.ts.map +1 -1
  205. package/dist/jsonDomainSchema.js +10 -5
  206. package/dist/jsonDomainSchema.js.map +1 -1
  207. package/dist/legacy.d.ts +5 -1
  208. package/dist/packageVersion.d.ts +1 -1
  209. package/dist/packageVersion.js +1 -1
  210. package/dist/packageVersion.js.map +1 -1
  211. package/dist/public.d.ts +5 -1
  212. package/dist/serializableDomainSchema.d.ts +8 -14
  213. package/dist/serializableDomainSchema.d.ts.map +1 -1
  214. package/dist/shared-tree/checkoutFlexTreeView.d.ts +3 -3
  215. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  216. package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -1
  217. package/dist/shared-tree/independentView.d.ts.map +1 -1
  218. package/dist/shared-tree/independentView.js +3 -18
  219. package/dist/shared-tree/independentView.js.map +1 -1
  220. package/dist/shared-tree/index.d.ts +1 -1
  221. package/dist/shared-tree/index.d.ts.map +1 -1
  222. package/dist/shared-tree/index.js +2 -1
  223. package/dist/shared-tree/index.js.map +1 -1
  224. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  225. package/dist/shared-tree/schematizeTree.js +4 -3
  226. package/dist/shared-tree/schematizeTree.js.map +1 -1
  227. package/dist/shared-tree/schematizingTreeView.d.ts +4 -4
  228. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  229. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  230. package/dist/shared-tree/sharedTree.d.ts +1 -0
  231. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  232. package/dist/shared-tree/sharedTree.js +27 -19
  233. package/dist/shared-tree/sharedTree.js.map +1 -1
  234. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  235. package/dist/shared-tree/sharedTreeChangeFamily.js +2 -2
  236. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  237. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +1 -2
  238. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  239. package/dist/shared-tree/sharedTreeEditBuilder.js +2 -2
  240. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  241. package/dist/shared-tree/treeApiAlpha.d.ts +9 -30
  242. package/dist/shared-tree/treeApiAlpha.d.ts.map +1 -1
  243. package/dist/shared-tree/treeApiAlpha.js +22 -34
  244. package/dist/shared-tree/treeApiAlpha.js.map +1 -1
  245. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  246. package/dist/shared-tree/treeCheckout.js +2 -2
  247. package/dist/shared-tree/treeCheckout.js.map +1 -1
  248. package/dist/shared-tree-core/branch.d.ts +4 -3
  249. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  250. package/dist/shared-tree-core/branch.js +2 -2
  251. package/dist/shared-tree-core/branch.js.map +1 -1
  252. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  253. package/dist/shared-tree-core/editManager.js +37 -31
  254. package/dist/shared-tree-core/editManager.js.map +1 -1
  255. package/dist/sharedTreeAttributes.d.ts +18 -0
  256. package/dist/sharedTreeAttributes.d.ts.map +1 -0
  257. package/dist/sharedTreeAttributes.js +25 -0
  258. package/dist/sharedTreeAttributes.js.map +1 -0
  259. package/dist/simple-tree/api/conciseTree.d.ts +8 -2
  260. package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
  261. package/dist/simple-tree/api/conciseTree.js +10 -1
  262. package/dist/simple-tree/api/conciseTree.js.map +1 -1
  263. package/dist/simple-tree/api/create.d.ts +3 -3
  264. package/dist/simple-tree/api/create.d.ts.map +1 -1
  265. package/dist/simple-tree/api/create.js.map +1 -1
  266. package/dist/simple-tree/api/customTree.d.ts +42 -12
  267. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  268. package/dist/simple-tree/api/customTree.js +33 -5
  269. package/dist/simple-tree/api/customTree.js.map +1 -1
  270. package/dist/simple-tree/api/getJsonSchema.d.ts +10 -0
  271. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  272. package/dist/simple-tree/api/getJsonSchema.js +10 -0
  273. package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
  274. package/dist/simple-tree/api/getSimpleSchema.d.ts +13 -43
  275. package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  276. package/dist/simple-tree/api/getSimpleSchema.js +13 -43
  277. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
  278. package/dist/simple-tree/api/index.d.ts +7 -6
  279. package/dist/simple-tree/api/index.d.ts.map +1 -1
  280. package/dist/simple-tree/api/index.js +8 -1
  281. package/dist/simple-tree/api/index.js.map +1 -1
  282. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  283. package/dist/simple-tree/api/schemaCreationUtilities.js +2 -2
  284. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  285. package/dist/simple-tree/api/schemaFactory.d.ts +112 -67
  286. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  287. package/dist/simple-tree/api/schemaFactory.js +80 -158
  288. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  289. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +38 -23
  290. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  291. package/dist/simple-tree/api/schemaFactoryAlpha.js +26 -1
  292. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  293. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +40 -5
  294. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  295. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  296. package/dist/simple-tree/api/schemaFromSimple.d.ts +19 -0
  297. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -0
  298. package/dist/simple-tree/api/schemaFromSimple.js +71 -0
  299. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -0
  300. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts +3 -2
  301. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  302. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +7 -6
  303. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  304. package/dist/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
  305. package/dist/simple-tree/api/simpleTreeIndex.js +4 -3
  306. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  307. package/dist/simple-tree/api/testRecursiveDomain.d.ts +10 -10
  308. package/dist/simple-tree/api/tree.d.ts +12 -6
  309. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  310. package/dist/simple-tree/api/tree.js +17 -8
  311. package/dist/simple-tree/api/tree.js.map +1 -1
  312. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  313. package/dist/simple-tree/api/treeNodeApi.js +5 -20
  314. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  315. package/dist/simple-tree/api/typesUnsafe.d.ts +102 -36
  316. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  317. package/dist/simple-tree/api/typesUnsafe.js +0 -1
  318. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  319. package/dist/simple-tree/api/verboseTree.d.ts +16 -25
  320. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  321. package/dist/simple-tree/api/verboseTree.js +19 -14
  322. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  323. package/dist/simple-tree/api/view.d.ts.map +1 -1
  324. package/dist/simple-tree/api/view.js +16 -17
  325. package/dist/simple-tree/api/view.js.map +1 -1
  326. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +16 -3
  327. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  328. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +70 -147
  329. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  330. package/dist/simple-tree/arrayNode.d.ts +5 -4
  331. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  332. package/dist/simple-tree/arrayNode.js +13 -9
  333. package/dist/simple-tree/arrayNode.js.map +1 -1
  334. package/dist/simple-tree/arrayNodeTypes.d.ts +46 -0
  335. package/dist/simple-tree/arrayNodeTypes.d.ts.map +1 -0
  336. package/dist/simple-tree/arrayNodeTypes.js +30 -0
  337. package/dist/simple-tree/arrayNodeTypes.js.map +1 -0
  338. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  339. package/dist/simple-tree/core/getOrCreateNode.js +1 -11
  340. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  341. package/dist/simple-tree/core/index.d.ts +1 -2
  342. package/dist/simple-tree/core/index.d.ts.map +1 -1
  343. package/dist/simple-tree/core/index.js +2 -3
  344. package/dist/simple-tree/core/index.js.map +1 -1
  345. package/dist/simple-tree/core/treeNodeKernel.d.ts +12 -5
  346. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  347. package/dist/simple-tree/core/treeNodeKernel.js +36 -20
  348. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  349. package/dist/simple-tree/core/treeNodeSchema.d.ts +14 -7
  350. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  351. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  352. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +2 -2
  353. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  354. package/dist/simple-tree/core/unhydratedFlexTree.js +5 -5
  355. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  356. package/dist/simple-tree/flexList.d.ts +4 -5
  357. package/dist/simple-tree/flexList.d.ts.map +1 -1
  358. package/dist/simple-tree/flexList.js +1 -14
  359. package/dist/simple-tree/flexList.js.map +1 -1
  360. package/dist/simple-tree/index.d.ts +9 -2
  361. package/dist/simple-tree/index.d.ts.map +1 -1
  362. package/dist/simple-tree/index.js +15 -2
  363. package/dist/simple-tree/index.js.map +1 -1
  364. package/dist/simple-tree/leafNodeSchema.d.ts +22 -5
  365. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  366. package/dist/simple-tree/leafNodeSchema.js +2 -0
  367. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  368. package/dist/simple-tree/mapNode.d.ts +3 -2
  369. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  370. package/dist/simple-tree/mapNode.js +5 -1
  371. package/dist/simple-tree/mapNode.js.map +1 -1
  372. package/dist/simple-tree/mapNodeTypes.d.ts +46 -0
  373. package/dist/simple-tree/mapNodeTypes.d.ts.map +1 -0
  374. package/dist/simple-tree/mapNodeTypes.js +30 -0
  375. package/dist/simple-tree/mapNodeTypes.js.map +1 -0
  376. package/dist/simple-tree/objectNode.d.ts +10 -3
  377. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  378. package/dist/simple-tree/objectNode.js +12 -5
  379. package/dist/simple-tree/objectNode.js.map +1 -1
  380. package/dist/simple-tree/objectNodeTypes.d.ts +9 -5
  381. package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -1
  382. package/dist/simple-tree/objectNodeTypes.js +3 -0
  383. package/dist/simple-tree/objectNodeTypes.js.map +1 -1
  384. package/dist/simple-tree/proxies.js +2 -1
  385. package/dist/simple-tree/proxies.js.map +1 -1
  386. package/dist/simple-tree/schemaTypes.d.ts +81 -8
  387. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  388. package/dist/simple-tree/schemaTypes.js +94 -5
  389. package/dist/simple-tree/schemaTypes.js.map +1 -1
  390. package/dist/simple-tree/{api/simpleSchema.d.ts → simpleSchema.d.ts} +55 -28
  391. package/dist/simple-tree/simpleSchema.d.ts.map +1 -0
  392. package/dist/simple-tree/simpleSchema.js.map +1 -0
  393. package/dist/simple-tree/toMapTree.d.ts +4 -4
  394. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  395. package/dist/simple-tree/toMapTree.js +3 -3
  396. package/dist/simple-tree/toMapTree.js.map +1 -1
  397. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  398. package/dist/simple-tree/toStoredSchema.js +2 -6
  399. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  400. package/dist/simple-tree/treeNodeValid.d.ts +7 -1
  401. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  402. package/dist/simple-tree/treeNodeValid.js +17 -10
  403. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  404. package/dist/treeFactory.d.ts +0 -12
  405. package/dist/treeFactory.d.ts.map +1 -1
  406. package/dist/treeFactory.js +5 -21
  407. package/dist/treeFactory.js.map +1 -1
  408. package/dist/util/cloneWithReplacements.d.ts +21 -0
  409. package/dist/util/cloneWithReplacements.d.ts.map +1 -0
  410. package/dist/util/cloneWithReplacements.js +38 -0
  411. package/dist/util/cloneWithReplacements.js.map +1 -0
  412. package/dist/util/idAllocator.d.ts.map +1 -1
  413. package/dist/util/idAllocator.js +1 -2
  414. package/dist/util/idAllocator.js.map +1 -1
  415. package/dist/util/index.d.ts +2 -1
  416. package/dist/util/index.d.ts.map +1 -1
  417. package/dist/util/index.js +4 -3
  418. package/dist/util/index.js.map +1 -1
  419. package/dist/util/referenceCounting.d.ts +18 -0
  420. package/dist/util/referenceCounting.d.ts.map +1 -1
  421. package/dist/util/referenceCounting.js.map +1 -1
  422. package/dist/util/typeCheck.d.ts +7 -0
  423. package/dist/util/typeCheck.d.ts.map +1 -1
  424. package/dist/util/typeCheck.js.map +1 -1
  425. package/dist/util/utils.d.ts +0 -1
  426. package/dist/util/utils.d.ts.map +1 -1
  427. package/dist/util/utils.js +1 -4
  428. package/dist/util/utils.js.map +1 -1
  429. package/lib/alpha.d.ts +32 -1
  430. package/lib/beta.d.ts +5 -1
  431. package/lib/codec/codec.d.ts +1 -1
  432. package/lib/codec/codec.d.ts.map +1 -1
  433. package/lib/codec/codec.js +1 -2
  434. package/lib/codec/codec.js.map +1 -1
  435. package/lib/codec/discriminatedUnions.d.ts.map +1 -1
  436. package/lib/codec/discriminatedUnions.js +2 -2
  437. package/lib/codec/discriminatedUnions.js.map +1 -1
  438. package/lib/core/forest/editableForest.d.ts +1 -14
  439. package/lib/core/forest/editableForest.d.ts.map +1 -1
  440. package/lib/core/forest/editableForest.js +0 -26
  441. package/lib/core/forest/editableForest.js.map +1 -1
  442. package/lib/core/forest/forest.d.ts +16 -3
  443. package/lib/core/forest/forest.d.ts.map +1 -1
  444. package/lib/core/forest/forest.js +4 -1
  445. package/lib/core/forest/forest.js.map +1 -1
  446. package/lib/core/forest/index.d.ts +1 -1
  447. package/lib/core/forest/index.d.ts.map +1 -1
  448. package/lib/core/forest/index.js +1 -1
  449. package/lib/core/forest/index.js.map +1 -1
  450. package/lib/core/index.d.ts +2 -2
  451. package/lib/core/index.d.ts.map +1 -1
  452. package/lib/core/index.js +2 -2
  453. package/lib/core/index.js.map +1 -1
  454. package/lib/core/rebase/utils.js +1 -1
  455. package/lib/core/rebase/utils.js.map +1 -1
  456. package/lib/core/schema-stored/schema.d.ts +4 -1
  457. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  458. package/lib/core/schema-stored/schema.js +6 -2
  459. package/lib/core/schema-stored/schema.js.map +1 -1
  460. package/lib/core/tree/anchorSet.d.ts +8 -3
  461. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  462. package/lib/core/tree/anchorSet.js +14 -7
  463. package/lib/core/tree/anchorSet.js.map +1 -1
  464. package/lib/core/tree/delta.d.ts +8 -23
  465. package/lib/core/tree/delta.d.ts.map +1 -1
  466. package/lib/core/tree/delta.js.map +1 -1
  467. package/lib/core/tree/deltaUtil.d.ts +3 -3
  468. package/lib/core/tree/deltaUtil.d.ts.map +1 -1
  469. package/lib/core/tree/deltaUtil.js +2 -2
  470. package/lib/core/tree/deltaUtil.js.map +1 -1
  471. package/lib/core/tree/index.d.ts +2 -2
  472. package/lib/core/tree/index.d.ts.map +1 -1
  473. package/lib/core/tree/index.js +1 -1
  474. package/lib/core/tree/index.js.map +1 -1
  475. package/lib/core/tree/pathTree.d.ts +54 -1
  476. package/lib/core/tree/pathTree.d.ts.map +1 -1
  477. package/lib/core/tree/pathTree.js +6 -0
  478. package/lib/core/tree/pathTree.js.map +1 -1
  479. package/lib/core/tree/treeTextFormat.js +1 -1
  480. package/lib/core/tree/treeTextFormat.js.map +1 -1
  481. package/lib/core/tree/visitDelta.d.ts +7 -5
  482. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  483. package/lib/core/tree/visitDelta.js +19 -9
  484. package/lib/core/tree/visitDelta.js.map +1 -1
  485. package/lib/core/tree/visitorUtils.d.ts +5 -23
  486. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  487. package/lib/core/tree/visitorUtils.js +8 -5
  488. package/lib/core/tree/visitorUtils.js.map +1 -1
  489. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts +1 -1
  490. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  491. package/lib/feature-libraries/chunked-forest/basicChunk.js +3 -3
  492. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  493. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +5 -3
  494. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  495. package/lib/feature-libraries/chunked-forest/chunkTree.js +12 -9
  496. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  497. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -0
  498. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  499. package/lib/feature-libraries/chunked-forest/chunkedForest.js +8 -5
  500. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  501. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +1 -1
  502. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  503. package/lib/feature-libraries/chunked-forest/codec/codecs.js +1 -1
  504. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  505. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
  506. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +3 -3
  507. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  508. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js +2 -2
  509. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  510. package/lib/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.d.ts → schemaBasedEncode.d.ts} +1 -1
  511. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -0
  512. package/lib/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.js → schemaBasedEncode.js} +2 -3
  513. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -0
  514. package/lib/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
  515. package/lib/feature-libraries/chunked-forest/emptyChunk.js +1 -1
  516. package/lib/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  517. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +3 -2
  518. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  519. package/lib/feature-libraries/chunked-forest/uniformChunk.js +5 -4
  520. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  521. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -14
  522. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  523. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +5 -6
  524. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  525. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  526. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
  527. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  528. package/lib/feature-libraries/default-schema/index.d.ts +1 -0
  529. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  530. package/lib/feature-libraries/default-schema/index.js +1 -0
  531. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  532. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts +21 -0
  533. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -0
  534. package/lib/feature-libraries/default-schema/mappedEditBuilder.js +53 -0
  535. package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -0
  536. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  537. package/lib/feature-libraries/default-schema/schemaChecker.js +1 -2
  538. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  539. package/lib/feature-libraries/deltaUtils.js +1 -1
  540. package/lib/feature-libraries/deltaUtils.js.map +1 -1
  541. package/lib/feature-libraries/flex-tree/context.d.ts +5 -5
  542. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  543. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  544. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -2
  545. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  546. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  547. package/lib/feature-libraries/flex-tree/lazyField.d.ts +5 -4
  548. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  549. package/lib/feature-libraries/flex-tree/lazyField.js +13 -10
  550. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  551. package/lib/feature-libraries/flex-tree/lazyNode.js +2 -2
  552. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  553. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  554. package/lib/feature-libraries/forest-summary/forestSummarizer.js +6 -7
  555. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  556. package/lib/feature-libraries/index.d.ts +2 -1
  557. package/lib/feature-libraries/index.d.ts.map +1 -1
  558. package/lib/feature-libraries/index.js +2 -1
  559. package/lib/feature-libraries/index.js.map +1 -1
  560. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  561. package/lib/feature-libraries/indexing/anchorTreeIndex.js +2 -2
  562. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  563. package/lib/feature-libraries/initializeForest.d.ts +18 -0
  564. package/lib/feature-libraries/initializeForest.d.ts.map +1 -0
  565. package/lib/feature-libraries/initializeForest.js +31 -0
  566. package/lib/feature-libraries/initializeForest.js.map +1 -0
  567. package/lib/feature-libraries/modular-schema/comparison.js +2 -2
  568. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  569. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  570. package/lib/feature-libraries/modular-schema/isNeverTree.js +1 -2
  571. package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  572. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  573. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +2 -2
  574. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  575. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +5 -5
  576. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  577. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +12 -18
  578. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  579. package/lib/feature-libraries/node-identifier/index.d.ts +8 -0
  580. package/lib/feature-libraries/node-identifier/index.d.ts.map +1 -0
  581. package/lib/feature-libraries/node-identifier/index.js +8 -0
  582. package/lib/feature-libraries/node-identifier/index.js.map +1 -0
  583. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts +22 -0
  584. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts.map +1 -0
  585. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js +45 -0
  586. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -0
  587. package/lib/feature-libraries/node-identifier/nodeIdentifier.d.ts +38 -0
  588. package/lib/feature-libraries/node-identifier/nodeIdentifier.d.ts.map +1 -0
  589. package/lib/feature-libraries/node-identifier/nodeIdentifier.js +22 -0
  590. package/lib/feature-libraries/node-identifier/nodeIdentifier.js.map +1 -0
  591. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.d.ts +37 -0
  592. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.d.ts.map +1 -0
  593. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js +43 -0
  594. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -0
  595. package/lib/feature-libraries/object-forest/objectForest.d.ts +2 -1
  596. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  597. package/lib/feature-libraries/object-forest/objectForest.js +8 -4
  598. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  599. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  600. package/lib/feature-libraries/schema-index/codec.js +2 -1
  601. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  602. package/lib/feature-libraries/sequence-field/compose.d.ts +1 -1
  603. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  604. package/lib/feature-libraries/sequence-field/compose.js +1 -2
  605. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  606. package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  607. package/lib/feature-libraries/sequence-field/invert.js +2 -2
  608. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  609. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  610. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +2 -2
  611. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  612. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  613. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +2 -2
  614. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  615. package/lib/feature-libraries/sequence-field/utils.js +2 -2
  616. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  617. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  618. package/lib/feature-libraries/treeCursorUtils.js +2 -3
  619. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  620. package/lib/index.d.ts +5 -4
  621. package/lib/index.d.ts.map +1 -1
  622. package/lib/index.js +5 -3
  623. package/lib/index.js.map +1 -1
  624. package/lib/jsonDomainSchema.d.ts +15 -16
  625. package/lib/jsonDomainSchema.d.ts.map +1 -1
  626. package/lib/jsonDomainSchema.js +11 -6
  627. package/lib/jsonDomainSchema.js.map +1 -1
  628. package/lib/legacy.d.ts +5 -1
  629. package/lib/packageVersion.d.ts +1 -1
  630. package/lib/packageVersion.js +1 -1
  631. package/lib/packageVersion.js.map +1 -1
  632. package/lib/public.d.ts +5 -1
  633. package/lib/serializableDomainSchema.d.ts +8 -14
  634. package/lib/serializableDomainSchema.d.ts.map +1 -1
  635. package/lib/shared-tree/checkoutFlexTreeView.d.ts +3 -3
  636. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  637. package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -1
  638. package/lib/shared-tree/independentView.d.ts.map +1 -1
  639. package/lib/shared-tree/independentView.js +5 -20
  640. package/lib/shared-tree/independentView.js.map +1 -1
  641. package/lib/shared-tree/index.d.ts +1 -1
  642. package/lib/shared-tree/index.d.ts.map +1 -1
  643. package/lib/shared-tree/index.js +1 -1
  644. package/lib/shared-tree/index.js.map +1 -1
  645. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  646. package/lib/shared-tree/schematizeTree.js +5 -4
  647. package/lib/shared-tree/schematizeTree.js.map +1 -1
  648. package/lib/shared-tree/schematizingTreeView.d.ts +4 -4
  649. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  650. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  651. package/lib/shared-tree/sharedTree.d.ts +1 -0
  652. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  653. package/lib/shared-tree/sharedTree.js +23 -16
  654. package/lib/shared-tree/sharedTree.js.map +1 -1
  655. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  656. package/lib/shared-tree/sharedTreeChangeFamily.js +3 -3
  657. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  658. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +1 -2
  659. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  660. package/lib/shared-tree/sharedTreeEditBuilder.js +2 -2
  661. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  662. package/lib/shared-tree/treeApiAlpha.d.ts +9 -30
  663. package/lib/shared-tree/treeApiAlpha.d.ts.map +1 -1
  664. package/lib/shared-tree/treeApiAlpha.js +12 -24
  665. package/lib/shared-tree/treeApiAlpha.js.map +1 -1
  666. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  667. package/lib/shared-tree/treeCheckout.js +4 -4
  668. package/lib/shared-tree/treeCheckout.js.map +1 -1
  669. package/lib/shared-tree-core/branch.d.ts +4 -3
  670. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  671. package/lib/shared-tree-core/branch.js +2 -2
  672. package/lib/shared-tree-core/branch.js.map +1 -1
  673. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  674. package/lib/shared-tree-core/editManager.js +35 -29
  675. package/lib/shared-tree-core/editManager.js.map +1 -1
  676. package/lib/sharedTreeAttributes.d.ts +18 -0
  677. package/lib/sharedTreeAttributes.d.ts.map +1 -0
  678. package/lib/sharedTreeAttributes.js +22 -0
  679. package/lib/sharedTreeAttributes.js.map +1 -0
  680. package/lib/simple-tree/api/conciseTree.d.ts +8 -2
  681. package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
  682. package/lib/simple-tree/api/conciseTree.js +9 -1
  683. package/lib/simple-tree/api/conciseTree.js.map +1 -1
  684. package/lib/simple-tree/api/create.d.ts +3 -3
  685. package/lib/simple-tree/api/create.d.ts.map +1 -1
  686. package/lib/simple-tree/api/create.js.map +1 -1
  687. package/lib/simple-tree/api/customTree.d.ts +42 -12
  688. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  689. package/lib/simple-tree/api/customTree.js +30 -3
  690. package/lib/simple-tree/api/customTree.js.map +1 -1
  691. package/lib/simple-tree/api/getJsonSchema.d.ts +10 -0
  692. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  693. package/lib/simple-tree/api/getJsonSchema.js +10 -0
  694. package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
  695. package/lib/simple-tree/api/getSimpleSchema.d.ts +13 -43
  696. package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  697. package/lib/simple-tree/api/getSimpleSchema.js +13 -43
  698. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
  699. package/lib/simple-tree/api/index.d.ts +7 -6
  700. package/lib/simple-tree/api/index.d.ts.map +1 -1
  701. package/lib/simple-tree/api/index.js +5 -3
  702. package/lib/simple-tree/api/index.js.map +1 -1
  703. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  704. package/lib/simple-tree/api/schemaCreationUtilities.js +1 -1
  705. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  706. package/lib/simple-tree/api/schemaFactory.d.ts +112 -67
  707. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  708. package/lib/simple-tree/api/schemaFactory.js +78 -155
  709. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  710. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +38 -23
  711. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  712. package/lib/simple-tree/api/schemaFactoryAlpha.js +27 -2
  713. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  714. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +40 -5
  715. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  716. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  717. package/lib/simple-tree/api/schemaFromSimple.d.ts +19 -0
  718. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -0
  719. package/lib/simple-tree/api/schemaFromSimple.js +67 -0
  720. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -0
  721. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts +3 -2
  722. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  723. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +6 -6
  724. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  725. package/lib/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
  726. package/lib/simple-tree/api/simpleTreeIndex.js +2 -1
  727. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  728. package/lib/simple-tree/api/testRecursiveDomain.d.ts +10 -10
  729. package/lib/simple-tree/api/tree.d.ts +12 -6
  730. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  731. package/lib/simple-tree/api/tree.js +14 -5
  732. package/lib/simple-tree/api/tree.js.map +1 -1
  733. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  734. package/lib/simple-tree/api/treeNodeApi.js +5 -20
  735. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  736. package/lib/simple-tree/api/typesUnsafe.d.ts +102 -36
  737. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  738. package/lib/simple-tree/api/typesUnsafe.js +0 -1
  739. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  740. package/lib/simple-tree/api/verboseTree.d.ts +16 -25
  741. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  742. package/lib/simple-tree/api/verboseTree.js +16 -12
  743. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  744. package/lib/simple-tree/api/view.d.ts.map +1 -1
  745. package/lib/simple-tree/api/view.js +1 -2
  746. package/lib/simple-tree/api/view.js.map +1 -1
  747. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +16 -3
  748. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  749. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +69 -146
  750. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  751. package/lib/simple-tree/arrayNode.d.ts +5 -4
  752. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  753. package/lib/simple-tree/arrayNode.js +7 -3
  754. package/lib/simple-tree/arrayNode.js.map +1 -1
  755. package/lib/simple-tree/arrayNodeTypes.d.ts +46 -0
  756. package/lib/simple-tree/arrayNodeTypes.d.ts.map +1 -0
  757. package/lib/simple-tree/arrayNodeTypes.js +26 -0
  758. package/lib/simple-tree/arrayNodeTypes.js.map +1 -0
  759. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  760. package/lib/simple-tree/core/getOrCreateNode.js +2 -12
  761. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  762. package/lib/simple-tree/core/index.d.ts +1 -2
  763. package/lib/simple-tree/core/index.d.ts.map +1 -1
  764. package/lib/simple-tree/core/index.js +1 -2
  765. package/lib/simple-tree/core/index.js.map +1 -1
  766. package/lib/simple-tree/core/treeNodeKernel.d.ts +12 -5
  767. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  768. package/lib/simple-tree/core/treeNodeKernel.js +28 -14
  769. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  770. package/lib/simple-tree/core/treeNodeSchema.d.ts +14 -7
  771. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  772. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  773. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +2 -2
  774. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  775. package/lib/simple-tree/core/unhydratedFlexTree.js +2 -2
  776. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  777. package/lib/simple-tree/flexList.d.ts +4 -5
  778. package/lib/simple-tree/flexList.d.ts.map +1 -1
  779. package/lib/simple-tree/flexList.js +0 -12
  780. package/lib/simple-tree/flexList.js.map +1 -1
  781. package/lib/simple-tree/index.d.ts +9 -2
  782. package/lib/simple-tree/index.d.ts.map +1 -1
  783. package/lib/simple-tree/index.js +5 -2
  784. package/lib/simple-tree/index.js.map +1 -1
  785. package/lib/simple-tree/leafNodeSchema.d.ts +22 -5
  786. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  787. package/lib/simple-tree/leafNodeSchema.js +2 -0
  788. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  789. package/lib/simple-tree/mapNode.d.ts +3 -2
  790. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  791. package/lib/simple-tree/mapNode.js +5 -1
  792. package/lib/simple-tree/mapNode.js.map +1 -1
  793. package/lib/simple-tree/mapNodeTypes.d.ts +46 -0
  794. package/lib/simple-tree/mapNodeTypes.d.ts.map +1 -0
  795. package/lib/simple-tree/mapNodeTypes.js +26 -0
  796. package/lib/simple-tree/mapNodeTypes.js.map +1 -0
  797. package/lib/simple-tree/objectNode.d.ts +10 -3
  798. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  799. package/lib/simple-tree/objectNode.js +12 -5
  800. package/lib/simple-tree/objectNode.js.map +1 -1
  801. package/lib/simple-tree/objectNodeTypes.d.ts +9 -5
  802. package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -1
  803. package/lib/simple-tree/objectNodeTypes.js +3 -0
  804. package/lib/simple-tree/objectNodeTypes.js.map +1 -1
  805. package/lib/simple-tree/proxies.js +2 -1
  806. package/lib/simple-tree/proxies.js.map +1 -1
  807. package/lib/simple-tree/schemaTypes.d.ts +81 -8
  808. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  809. package/lib/simple-tree/schemaTypes.js +91 -6
  810. package/lib/simple-tree/schemaTypes.js.map +1 -1
  811. package/lib/simple-tree/{api/simpleSchema.d.ts → simpleSchema.d.ts} +55 -28
  812. package/lib/simple-tree/simpleSchema.d.ts.map +1 -0
  813. package/lib/simple-tree/simpleSchema.js.map +1 -0
  814. package/lib/simple-tree/toMapTree.d.ts +4 -4
  815. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  816. package/lib/simple-tree/toMapTree.js +2 -2
  817. package/lib/simple-tree/toMapTree.js.map +1 -1
  818. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  819. package/lib/simple-tree/toStoredSchema.js +4 -8
  820. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  821. package/lib/simple-tree/treeNodeValid.d.ts +7 -1
  822. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  823. package/lib/simple-tree/treeNodeValid.js +14 -7
  824. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  825. package/lib/treeFactory.d.ts +0 -12
  826. package/lib/treeFactory.d.ts.map +1 -1
  827. package/lib/treeFactory.js +1 -17
  828. package/lib/treeFactory.js.map +1 -1
  829. package/lib/tsdoc-metadata.json +1 -1
  830. package/lib/util/cloneWithReplacements.d.ts +21 -0
  831. package/lib/util/cloneWithReplacements.d.ts.map +1 -0
  832. package/lib/util/cloneWithReplacements.js +34 -0
  833. package/lib/util/cloneWithReplacements.js.map +1 -0
  834. package/lib/util/idAllocator.d.ts.map +1 -1
  835. package/lib/util/idAllocator.js +1 -2
  836. package/lib/util/idAllocator.js.map +1 -1
  837. package/lib/util/index.d.ts +2 -1
  838. package/lib/util/index.d.ts.map +1 -1
  839. package/lib/util/index.js +2 -1
  840. package/lib/util/index.js.map +1 -1
  841. package/lib/util/referenceCounting.d.ts +18 -0
  842. package/lib/util/referenceCounting.d.ts.map +1 -1
  843. package/lib/util/referenceCounting.js.map +1 -1
  844. package/lib/util/typeCheck.d.ts +7 -0
  845. package/lib/util/typeCheck.d.ts.map +1 -1
  846. package/lib/util/typeCheck.js.map +1 -1
  847. package/lib/util/utils.d.ts +0 -1
  848. package/lib/util/utils.d.ts.map +1 -1
  849. package/lib/util/utils.js +0 -2
  850. package/lib/util/utils.js.map +1 -1
  851. package/package.json +37 -27
  852. package/src/codec/codec.ts +2 -2
  853. package/src/codec/discriminatedUnions.ts +2 -2
  854. package/src/core/forest/editableForest.ts +1 -52
  855. package/src/core/forest/forest.ts +17 -2
  856. package/src/core/forest/index.ts +0 -1
  857. package/src/core/index.ts +4 -2
  858. package/src/core/rebase/utils.ts +1 -1
  859. package/src/core/schema-stored/schema.ts +6 -2
  860. package/src/core/tree/anchorSet.ts +42 -12
  861. package/src/core/tree/delta.ts +8 -25
  862. package/src/core/tree/deltaUtil.ts +5 -5
  863. package/src/core/tree/index.ts +4 -1
  864. package/src/core/tree/pathTree.ts +72 -1
  865. package/src/core/tree/treeTextFormat.ts +1 -1
  866. package/src/core/tree/visitDelta.ts +38 -17
  867. package/src/core/tree/visitorUtils.ts +22 -36
  868. package/src/feature-libraries/chunked-forest/basicChunk.ts +3 -3
  869. package/src/feature-libraries/chunked-forest/chunkTree.ts +20 -9
  870. package/src/feature-libraries/chunked-forest/chunkedForest.ts +10 -6
  871. package/src/feature-libraries/chunked-forest/codec/README.md +3 -3
  872. package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +1 -1
  873. package/src/feature-libraries/chunked-forest/codec/codecs.ts +1 -1
  874. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +3 -3
  875. package/src/feature-libraries/chunked-forest/codec/nodeShape.ts +2 -2
  876. package/src/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.ts → schemaBasedEncode.ts} +1 -2
  877. package/src/feature-libraries/chunked-forest/emptyChunk.ts +1 -1
  878. package/src/feature-libraries/chunked-forest/uniformChunk.ts +5 -4
  879. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +21 -38
  880. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -1
  881. package/src/feature-libraries/default-schema/index.ts +2 -0
  882. package/src/feature-libraries/default-schema/mappedEditBuilder.ts +68 -0
  883. package/src/feature-libraries/default-schema/schemaChecker.ts +1 -2
  884. package/src/feature-libraries/deltaUtils.ts +1 -1
  885. package/src/feature-libraries/flex-tree/context.ts +4 -4
  886. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +2 -2
  887. package/src/feature-libraries/flex-tree/lazyField.ts +21 -12
  888. package/src/feature-libraries/flex-tree/lazyNode.ts +2 -2
  889. package/src/feature-libraries/forest-summary/forestSummarizer.ts +5 -9
  890. package/src/feature-libraries/index.ts +10 -8
  891. package/src/feature-libraries/indexing/anchorTreeIndex.ts +4 -4
  892. package/src/feature-libraries/initializeForest.ts +55 -0
  893. package/src/feature-libraries/modular-schema/comparison.ts +2 -2
  894. package/src/feature-libraries/modular-schema/isNeverTree.ts +1 -2
  895. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +1 -2
  896. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +13 -30
  897. package/src/feature-libraries/node-identifier/README.md +11 -0
  898. package/src/feature-libraries/node-identifier/index.ts +17 -0
  899. package/src/feature-libraries/node-identifier/mockNodeIdentifierManager.ts +59 -0
  900. package/src/feature-libraries/node-identifier/nodeIdentifier.ts +50 -0
  901. package/src/feature-libraries/node-identifier/nodeIdentifierManager.ts +95 -0
  902. package/src/feature-libraries/object-forest/objectForest.ts +11 -5
  903. package/src/feature-libraries/schema-index/codec.ts +2 -1
  904. package/src/feature-libraries/sequence-field/compose.ts +2 -2
  905. package/src/feature-libraries/sequence-field/invert.ts +2 -2
  906. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +2 -2
  907. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +2 -2
  908. package/src/feature-libraries/sequence-field/utils.ts +2 -2
  909. package/src/feature-libraries/treeCursorUtils.ts +2 -3
  910. package/src/index.ts +43 -13
  911. package/src/jsonDomainSchema.ts +30 -11
  912. package/src/packageVersion.ts +1 -1
  913. package/src/shared-tree/checkoutFlexTreeView.ts +2 -2
  914. package/src/shared-tree/independentView.ts +5 -29
  915. package/src/shared-tree/index.ts +1 -0
  916. package/src/shared-tree/schematizeTree.ts +5 -4
  917. package/src/shared-tree/schematizingTreeView.ts +3 -3
  918. package/src/shared-tree/sharedTree.ts +29 -19
  919. package/src/shared-tree/sharedTreeChangeFamily.ts +1 -3
  920. package/src/shared-tree/sharedTreeEditBuilder.ts +5 -11
  921. package/src/shared-tree/treeApiAlpha.ts +45 -85
  922. package/src/shared-tree/treeCheckout.ts +4 -10
  923. package/src/shared-tree-core/branch.ts +5 -3
  924. package/src/shared-tree-core/editManager.ts +37 -45
  925. package/src/sharedTreeAttributes.ts +25 -0
  926. package/src/simple-tree/api/conciseTree.ts +25 -8
  927. package/src/simple-tree/api/create.ts +3 -3
  928. package/src/simple-tree/api/customTree.ts +60 -17
  929. package/src/simple-tree/api/getJsonSchema.ts +10 -0
  930. package/src/simple-tree/api/getSimpleSchema.ts +14 -44
  931. package/src/simple-tree/api/index.ts +17 -12
  932. package/src/simple-tree/api/schemaCreationUtilities.ts +1 -2
  933. package/src/simple-tree/api/schemaFactory.ts +179 -118
  934. package/src/simple-tree/api/schemaFactoryAlpha.ts +74 -67
  935. package/src/simple-tree/api/schemaFactoryRecursive.ts +44 -12
  936. package/src/simple-tree/api/schemaFromSimple.ts +96 -0
  937. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +7 -7
  938. package/src/simple-tree/api/simpleTreeIndex.ts +2 -1
  939. package/src/simple-tree/api/tree.ts +16 -11
  940. package/src/simple-tree/api/treeNodeApi.ts +5 -18
  941. package/src/simple-tree/api/typesUnsafe.ts +166 -48
  942. package/src/simple-tree/api/verboseTree.ts +45 -57
  943. package/src/simple-tree/api/view.ts +1 -2
  944. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +80 -185
  945. package/src/simple-tree/arrayNode.ts +20 -14
  946. package/src/simple-tree/arrayNodeTypes.ts +93 -0
  947. package/src/simple-tree/core/getOrCreateNode.ts +3 -13
  948. package/src/simple-tree/core/index.ts +1 -1
  949. package/src/simple-tree/core/treeNodeKernel.ts +32 -18
  950. package/src/simple-tree/core/treeNodeSchema.ts +14 -8
  951. package/src/simple-tree/core/unhydratedFlexTree.ts +4 -4
  952. package/src/simple-tree/flexList.ts +4 -14
  953. package/src/simple-tree/index.ts +36 -9
  954. package/src/simple-tree/leafNodeSchema.ts +28 -7
  955. package/src/simple-tree/mapNode.ts +13 -11
  956. package/src/simple-tree/mapNodeTypes.ts +90 -0
  957. package/src/simple-tree/objectNode.ts +40 -13
  958. package/src/simple-tree/objectNodeTypes.ts +21 -16
  959. package/src/simple-tree/proxies.ts +2 -2
  960. package/src/simple-tree/schemaTypes.ts +153 -23
  961. package/src/simple-tree/{api/simpleSchema.ts → simpleSchema.ts} +67 -28
  962. package/src/simple-tree/toMapTree.ts +8 -8
  963. package/src/simple-tree/toStoredSchema.ts +4 -7
  964. package/src/simple-tree/treeNodeValid.ts +17 -7
  965. package/src/treeFactory.ts +1 -19
  966. package/src/util/cloneWithReplacements.ts +41 -0
  967. package/src/util/idAllocator.ts +1 -3
  968. package/src/util/index.ts +2 -1
  969. package/src/util/referenceCounting.ts +18 -1
  970. package/src/util/typeCheck.ts +7 -0
  971. package/src/util/utils.ts +0 -3
  972. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.d.ts.map +0 -1
  973. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js.map +0 -1
  974. package/dist/feature-libraries/node-key/index.d.ts +0 -8
  975. package/dist/feature-libraries/node-key/index.d.ts.map +0 -1
  976. package/dist/feature-libraries/node-key/index.js +0 -16
  977. package/dist/feature-libraries/node-key/index.js.map +0 -1
  978. package/dist/feature-libraries/node-key/mockNodeKeyManager.d.ts +0 -22
  979. package/dist/feature-libraries/node-key/mockNodeKeyManager.d.ts.map +0 -1
  980. package/dist/feature-libraries/node-key/mockNodeKeyManager.js.map +0 -1
  981. package/dist/feature-libraries/node-key/nodeKey.d.ts +0 -38
  982. package/dist/feature-libraries/node-key/nodeKey.d.ts.map +0 -1
  983. package/dist/feature-libraries/node-key/nodeKey.js +0 -26
  984. package/dist/feature-libraries/node-key/nodeKey.js.map +0 -1
  985. package/dist/feature-libraries/node-key/nodeKeyManager.d.ts +0 -37
  986. package/dist/feature-libraries/node-key/nodeKeyManager.d.ts.map +0 -1
  987. package/dist/feature-libraries/node-key/nodeKeyManager.js +0 -48
  988. package/dist/feature-libraries/node-key/nodeKeyManager.js.map +0 -1
  989. package/dist/simple-tree/api/simpleSchema.d.ts.map +0 -1
  990. package/dist/simple-tree/api/simpleSchema.js.map +0 -1
  991. package/dist/simple-tree/core/schemaCaching.d.ts +0 -16
  992. package/dist/simple-tree/core/schemaCaching.d.ts.map +0 -1
  993. package/dist/simple-tree/core/schemaCaching.js +0 -32
  994. package/dist/simple-tree/core/schemaCaching.js.map +0 -1
  995. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.d.ts.map +0 -1
  996. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js.map +0 -1
  997. package/lib/feature-libraries/node-key/index.d.ts +0 -8
  998. package/lib/feature-libraries/node-key/index.d.ts.map +0 -1
  999. package/lib/feature-libraries/node-key/index.js +0 -8
  1000. package/lib/feature-libraries/node-key/index.js.map +0 -1
  1001. package/lib/feature-libraries/node-key/mockNodeKeyManager.d.ts +0 -22
  1002. package/lib/feature-libraries/node-key/mockNodeKeyManager.d.ts.map +0 -1
  1003. package/lib/feature-libraries/node-key/mockNodeKeyManager.js +0 -45
  1004. package/lib/feature-libraries/node-key/mockNodeKeyManager.js.map +0 -1
  1005. package/lib/feature-libraries/node-key/nodeKey.d.ts +0 -38
  1006. package/lib/feature-libraries/node-key/nodeKey.d.ts.map +0 -1
  1007. package/lib/feature-libraries/node-key/nodeKey.js +0 -22
  1008. package/lib/feature-libraries/node-key/nodeKey.js.map +0 -1
  1009. package/lib/feature-libraries/node-key/nodeKeyManager.d.ts +0 -37
  1010. package/lib/feature-libraries/node-key/nodeKeyManager.d.ts.map +0 -1
  1011. package/lib/feature-libraries/node-key/nodeKeyManager.js +0 -43
  1012. package/lib/feature-libraries/node-key/nodeKeyManager.js.map +0 -1
  1013. package/lib/simple-tree/api/simpleSchema.d.ts.map +0 -1
  1014. package/lib/simple-tree/api/simpleSchema.js.map +0 -1
  1015. package/lib/simple-tree/core/schemaCaching.d.ts +0 -16
  1016. package/lib/simple-tree/core/schemaCaching.d.ts.map +0 -1
  1017. package/lib/simple-tree/core/schemaCaching.js +0 -27
  1018. package/lib/simple-tree/core/schemaCaching.js.map +0 -1
  1019. package/prettier.config.cjs +0 -8
  1020. package/src/feature-libraries/node-key/README.md +0 -11
  1021. package/src/feature-libraries/node-key/index.ts +0 -17
  1022. package/src/feature-libraries/node-key/mockNodeKeyManager.ts +0 -54
  1023. package/src/feature-libraries/node-key/nodeKey.ts +0 -47
  1024. package/src/feature-libraries/node-key/nodeKeyManager.ts +0 -93
  1025. package/src/simple-tree/core/schemaCaching.ts +0 -35
  1026. /package/dist/simple-tree/{api/simpleSchema.js → simpleSchema.js} +0 -0
  1027. /package/lib/simple-tree/{api/simpleSchema.js → simpleSchema.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"independentView.js","sourceRoot":"","sources":["../../src/shared-tree/independentView.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA6D;AAC7D,qEAGgD;AAEhD,+CAO0B;AAC1B,4DASuC;AASvC,mDAIyB;AACzB,uDAAuD;AACvD,uEAAuE;AAEvE;;;;;;;;GAQG;AACH,SAAgB,eAAe,CAC9B,MAAsC,EACtC,OAAqE;IAErE,MAAM,YAAY,GAAkB,OAAO,CAAC,YAAY,IAAI,IAAA,6BAAkB,GAAE,CAAC;IACjF,MAAM,eAAe,GAAG,GAAgB,EAAE,CAAC,YAAY,CAAC,oBAAoB,EAAE,CAAC;IAC/E,MAAM,gBAAgB,GAAG,IAAI,2BAAgB,CAAC,YAAY,CAAC,CAAC;IAC5D,MAAM,MAAM,GAAG,IAAI,qCAA0B,EAAE,CAAC;IAChD,MAAM,MAAM,GAAG,IAAA,qCAAqB,EACnC,OAAO,CAAC,MAAM,IAAI,wCAAwB,CAAC,MAAM,EACjD,MAAM,EACN,YAAY,CACZ,CAAC;IACF,MAAM,QAAQ,GAAG,IAAA,oCAAkB,EAAC,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE;QACpF,MAAM;QACN,MAAM;KACN,CAAC,CAAC;IACH,MAAM,GAAG,GAA2B,IAAI,oDAA0B,CACjE,QAAQ,EACR,MAAM,EACN,IAAA,+BAAoB,EAAC,YAAY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,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;IAEzE,MAAM,QAAQ,GAAG,IAAA,oCAAkB,EAAC,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE;QACpF,MAAM;QACN,MAAM;KACN,CAAC,CAAC;IACH,MAAM,GAAG,GAA2B,IAAI,oDAA0B,CACjE,QAAQ,EACR,MAAM,EACN,IAAA,+BAAoB,EAAC,YAAY,CAAC,CAClC,CAAC;IACF,OAAO,GAAG,CAAC;AACZ,CAAC;AA5CD,gEA4CC;AAED,SAAS,yBAAyB,CACjC,WAAmC;IAEnC,OAAO,IAAA,yBAAc,EAAC,WAAW,EAAE,cAAc,CAAC,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CAAC,MAA8B;IACrD,MAAM,IAAI,GAAG,IAAA,oBAAS,EAAC,MAAM,EAAE;QAC9B,MAAM,EAAE,6BAAkB;QAC1B,YAAY,EAAE,SAAS;KACvB,CAAC,CAAC,MAAM,EAAE,CAAC;IACZ,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAClB,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype IIdCompressor,\n\tcreateIdCompressor,\n} from \"@fluidframework/id-compressor/internal\";\nimport type { ICodecOptions } from \"../codec/index.js\";\nimport {\n\ttype RevisionTag,\n\tRevisionTagCodec,\n\tTreeStoredSchemaRepository,\n\tinitializeForest,\n\ttype ITreeCursorSynchronous,\n\tmapCursorField,\n} from \"../core/index.js\";\nimport {\n\tcreateNodeKeyManager,\n\tmakeFieldBatchCodec,\n\tmakeSchemaCodec,\n\ttype FieldBatchEncodingContext,\n\tdefaultSchemaPolicy,\n\tchunkTree,\n\tdefaultChunkPolicy,\n\tTreeCompressionStrategy,\n} from \"../feature-libraries/index.js\";\n// eslint-disable-next-line import/no-internal-modules\nimport type { Format } from \"../feature-libraries/schema-index/format.js\";\nimport type {\n\tTreeViewConfiguration,\n\tImplicitFieldSchema,\n\tTreeViewAlpha,\n} from \"../simple-tree/index.js\";\nimport type { JsonCompatibleReadOnly, JsonCompatible } from \"../util/index.js\";\nimport {\n\tbuildConfiguredForest,\n\tdefaultSharedTreeOptions,\n\ttype ForestOptions,\n} from \"./sharedTree.js\";\nimport { createTreeCheckout } from \"./treeCheckout.js\";\nimport { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\n\n/**\n * Create an uninitialized {@link TreeView} that is not tied to any {@link ITree} instance.\n *\n * @remarks\n * Such a view can never experience collaboration or be persisted to to a Fluid Container.\n *\n * This can be useful for testing, as well as use-cases like working on local files instead of documents stored in some Fluid service.\n * @alpha\n */\nexport function independentView<const TSchema extends ImplicitFieldSchema>(\n\tconfig: TreeViewConfiguration<TSchema>,\n\toptions: ForestOptions & { idCompressor?: IIdCompressor | undefined },\n): TreeViewAlpha<TSchema> {\n\tconst idCompressor: IIdCompressor = options.idCompressor ?? createIdCompressor();\n\tconst mintRevisionTag = (): RevisionTag => idCompressor.generateCompressedId();\n\tconst revisionTagCodec = new RevisionTagCodec(idCompressor);\n\tconst schema = new TreeStoredSchemaRepository();\n\tconst forest = buildConfiguredForest(\n\t\toptions.forest ?? defaultSharedTreeOptions.forest,\n\t\tschema,\n\t\tidCompressor,\n\t);\n\tconst checkout = createTreeCheckout(idCompressor, mintRevisionTag, revisionTagCodec, {\n\t\tforest,\n\t\tschema,\n\t});\n\tconst out: TreeViewAlpha<TSchema> = new SchematizingSimpleTreeView<TSchema>(\n\t\tcheckout,\n\t\tconfig,\n\t\tcreateNodeKeyManager(idCompressor),\n\t);\n\treturn out;\n}\n/**\n * Create an initialized {@link TreeView} that is not tied to any {@link ITree} instance.\n *\n * @remarks\n * Such a view can never experience collaboration or be persisted to to a Fluid Container.\n *\n * This can be useful for testing, as well as use-cases like working on local files instead of documents stored in some Fluid service.\n * @alpha\n */\nexport function independentInitializedView<const TSchema extends ImplicitFieldSchema>(\n\tconfig: TreeViewConfiguration<TSchema>,\n\toptions: ForestOptions & ICodecOptions,\n\tcontent: ViewContent,\n): TreeViewAlpha<TSchema> {\n\tconst idCompressor: IIdCompressor = content.idCompressor;\n\tconst mintRevisionTag = (): RevisionTag => idCompressor.generateCompressedId();\n\tconst revisionTagCodec = new RevisionTagCodec(idCompressor);\n\n\tconst fieldBatchCodec = makeFieldBatchCodec(options, 1);\n\tconst schemaCodec = makeSchemaCodec(options);\n\n\tconst schema = new TreeStoredSchemaRepository(schemaCodec.decode(content.schema as Format));\n\tconst forest = buildConfiguredForest(\n\t\toptions.forest ?? defaultSharedTreeOptions.forest,\n\t\tschema,\n\t\tidCompressor,\n\t);\n\n\tconst context: FieldBatchEncodingContext = {\n\t\tencodeType: TreeCompressionStrategy.Compressed,\n\t\tidCompressor,\n\t\toriginatorId: idCompressor.localSessionId, // Is this right? If so, why is is needed?\n\t\tschema: { schema, policy: defaultSchemaPolicy },\n\t};\n\n\tconst fieldCursors = fieldBatchCodec.decode(content.tree as JsonCompatibleReadOnly, context);\n\tassert(fieldCursors.length === 1, 0xa5b /* must have exactly 1 field in batch */);\n\t// Checked above.\n\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\tconst cursors = fieldCursorToNodesCursors(fieldCursors[0]!);\n\n\tinitializeForest(forest, cursors, revisionTagCodec, idCompressor, false);\n\n\tconst checkout = createTreeCheckout(idCompressor, mintRevisionTag, revisionTagCodec, {\n\t\tforest,\n\t\tschema,\n\t});\n\tconst out: TreeViewAlpha<TSchema> = new SchematizingSimpleTreeView<TSchema>(\n\t\tcheckout,\n\t\tconfig,\n\t\tcreateNodeKeyManager(idCompressor),\n\t);\n\treturn out;\n}\n\nfunction fieldCursorToNodesCursors(\n\tfieldCursor: ITreeCursorSynchronous,\n): ITreeCursorSynchronous[] {\n\treturn mapCursorField(fieldCursor, copyNodeCursor);\n}\n\n/**\n * TODO: avoid needing this, or optimize it.\n */\nfunction copyNodeCursor(cursor: ITreeCursorSynchronous): ITreeCursorSynchronous {\n\tconst copy = chunkTree(cursor, {\n\t\tpolicy: defaultChunkPolicy,\n\t\tidCompressor: undefined,\n\t}).cursor();\n\tcopy.enterNode(0);\n\treturn copy;\n}\n\n/**\n * The portion of SharedTree data typically persisted by the container.\n * Usable with {@link independentInitializedView} to create a {@link TreeView}\n * without loading a container.\n * @alpha\n */\nexport interface ViewContent {\n\t/**\n\t * Compressed tree from {@link TreeAlpha.exportCompressed}.\n\t * @remarks\n\t * This is an owning reference:\n\t * consumers of this content might modify this data in place (for example when applying edits) to avoid copying.\n\t */\n\treadonly tree: JsonCompatible<IFluidHandle>;\n\t/**\n\t * Persisted schema from {@link extractPersistedSchema}.\n\t */\n\treadonly schema: JsonCompatible;\n\t/**\n\t * IIdCompressor which will be used to decompress any compressed identifiers in `tree`\n\t * as well as for any other identifiers added to the view.\n\t */\n\treadonly idCompressor: IIdCompressor;\n}\n"]}
1
+ {"version":3,"file":"independentView.js","sourceRoot":"","sources":["../../src/shared-tree/independentView.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA6D;AAC7D,qEAGgD;AAEhD,+CAI0B;AAC1B,4DAQuC;AASvC,mDAIyB;AACzB,uDAAuD;AACvD,uEAAuE;AAEvE;;;;;;;;GAQG;AACH,SAAgB,eAAe,CAC9B,MAAsC,EACtC,OAAqE;IAErE,MAAM,YAAY,GAAkB,OAAO,CAAC,YAAY,IAAI,IAAA,6BAAkB,GAAE,CAAC;IACjF,MAAM,eAAe,GAAG,GAAgB,EAAE,CAAC,YAAY,CAAC,oBAAoB,EAAE,CAAC;IAC/E,MAAM,gBAAgB,GAAG,IAAI,2BAAgB,CAAC,YAAY,CAAC,CAAC;IAC5D,MAAM,MAAM,GAAG,IAAI,qCAA0B,EAAE,CAAC;IAChD,MAAM,MAAM,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AAC;IAEF,MAAM,YAAY,GAAG,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,IAA8B,EAAE,OAAO,CAAC,CAAC;IAC7F,IAAA,iBAAM,EAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAClF,iBAAiB;IACjB,oEAAoE;IACpE,IAAA,2BAAgB,EAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAE,EAAE,gBAAgB,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;IAElF,MAAM,QAAQ,GAAG,IAAA,oCAAkB,EAAC,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE;QACpF,MAAM;QACN,MAAM;KACN,CAAC,CAAC;IACH,MAAM,GAAG,GAA2B,IAAI,oDAA0B,CACjE,QAAQ,EACR,MAAM,EACN,IAAA,sCAA2B,EAAC,YAAY,CAAC,CACzC,CAAC;IACF,OAAO,GAAG,CAAC;AACZ,CAAC;AA1CD,gEA0CC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype IIdCompressor,\n\tcreateIdCompressor,\n} from \"@fluidframework/id-compressor/internal\";\nimport type { ICodecOptions } from \"../codec/index.js\";\nimport {\n\ttype RevisionTag,\n\tRevisionTagCodec,\n\tTreeStoredSchemaRepository,\n} from \"../core/index.js\";\nimport {\n\tcreateNodeIdentifierManager,\n\tmakeFieldBatchCodec,\n\tmakeSchemaCodec,\n\ttype FieldBatchEncodingContext,\n\tdefaultSchemaPolicy,\n\tTreeCompressionStrategy,\n\tinitializeForest,\n} from \"../feature-libraries/index.js\";\n// eslint-disable-next-line import/no-internal-modules\nimport type { Format } from \"../feature-libraries/schema-index/format.js\";\nimport type {\n\tTreeViewConfiguration,\n\tImplicitFieldSchema,\n\tTreeViewAlpha,\n} from \"../simple-tree/index.js\";\nimport type { JsonCompatibleReadOnly, JsonCompatible } from \"../util/index.js\";\nimport {\n\tbuildConfiguredForest,\n\tdefaultSharedTreeOptions,\n\ttype ForestOptions,\n} from \"./sharedTree.js\";\nimport { createTreeCheckout } from \"./treeCheckout.js\";\nimport { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\n\n/**\n * Create an uninitialized {@link TreeView} that is not tied to any {@link ITree} instance.\n *\n * @remarks\n * Such a view can never experience collaboration or be persisted to to a Fluid Container.\n *\n * This can be useful for testing, as well as use-cases like working on local files instead of documents stored in some Fluid service.\n * @alpha\n */\nexport function independentView<const TSchema extends ImplicitFieldSchema>(\n\tconfig: TreeViewConfiguration<TSchema>,\n\toptions: ForestOptions & { idCompressor?: IIdCompressor | undefined },\n): TreeViewAlpha<TSchema> {\n\tconst idCompressor: IIdCompressor = options.idCompressor ?? createIdCompressor();\n\tconst mintRevisionTag = (): RevisionTag => idCompressor.generateCompressedId();\n\tconst revisionTagCodec = new RevisionTagCodec(idCompressor);\n\tconst schema = new TreeStoredSchemaRepository();\n\tconst forest = buildConfiguredForest(\n\t\toptions.forest ?? defaultSharedTreeOptions.forest,\n\t\tschema,\n\t\tidCompressor,\n\t);\n\tconst checkout = createTreeCheckout(idCompressor, mintRevisionTag, revisionTagCodec, {\n\t\tforest,\n\t\tschema,\n\t});\n\tconst out: TreeViewAlpha<TSchema> = new SchematizingSimpleTreeView<TSchema>(\n\t\tcheckout,\n\t\tconfig,\n\t\tcreateNodeIdentifierManager(idCompressor),\n\t);\n\treturn out;\n}\n/**\n * Create an initialized {@link TreeView} that is not tied to any {@link ITree} instance.\n *\n * @remarks\n * Such a view can never experience collaboration or be persisted to to a Fluid Container.\n *\n * This can be useful for testing, as well as use-cases like working on local files instead of documents stored in some Fluid service.\n * @alpha\n */\nexport function independentInitializedView<const TSchema extends ImplicitFieldSchema>(\n\tconfig: TreeViewConfiguration<TSchema>,\n\toptions: ForestOptions & ICodecOptions,\n\tcontent: ViewContent,\n): TreeViewAlpha<TSchema> {\n\tconst idCompressor: IIdCompressor = content.idCompressor;\n\tconst mintRevisionTag = (): RevisionTag => idCompressor.generateCompressedId();\n\tconst revisionTagCodec = new RevisionTagCodec(idCompressor);\n\n\tconst fieldBatchCodec = makeFieldBatchCodec(options, 1);\n\tconst schemaCodec = makeSchemaCodec(options);\n\n\tconst schema = new TreeStoredSchemaRepository(schemaCodec.decode(content.schema as Format));\n\tconst forest = buildConfiguredForest(\n\t\toptions.forest ?? defaultSharedTreeOptions.forest,\n\t\tschema,\n\t\tidCompressor,\n\t);\n\n\tconst context: FieldBatchEncodingContext = {\n\t\tencodeType: TreeCompressionStrategy.Compressed,\n\t\tidCompressor,\n\t\toriginatorId: idCompressor.localSessionId, // Is this right? If so, why is is needed?\n\t\tschema: { schema, policy: defaultSchemaPolicy },\n\t};\n\n\tconst fieldCursors = fieldBatchCodec.decode(content.tree as JsonCompatibleReadOnly, context);\n\tassert(fieldCursors.length === 1, 0xa5b /* must have exactly 1 field in batch */);\n\t// Checked above.\n\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\tinitializeForest(forest, fieldCursors[0]!, revisionTagCodec, idCompressor, false);\n\n\tconst checkout = createTreeCheckout(idCompressor, mintRevisionTag, revisionTagCodec, {\n\t\tforest,\n\t\tschema,\n\t});\n\tconst out: TreeViewAlpha<TSchema> = new SchematizingSimpleTreeView<TSchema>(\n\t\tcheckout,\n\t\tconfig,\n\t\tcreateNodeIdentifierManager(idCompressor),\n\t);\n\treturn out;\n}\n\n/**\n * The portion of SharedTree data typically persisted by the container.\n * Usable with {@link independentInitializedView} to create a {@link TreeView}\n * without loading a container.\n * @alpha\n */\nexport interface ViewContent {\n\t/**\n\t * Compressed tree from {@link TreeAlpha.exportCompressed}.\n\t * @remarks\n\t * This is an owning reference:\n\t * consumers of this content might modify this data in place (for example when applying edits) to avoid copying.\n\t */\n\treadonly tree: JsonCompatible<IFluidHandle>;\n\t/**\n\t * Persisted schema from {@link extractPersistedSchema}.\n\t */\n\treadonly schema: JsonCompatible;\n\t/**\n\t * IIdCompressor which will be used to decompress any compressed identifiers in `tree`\n\t * as well as for any other identifiers added to the view.\n\t */\n\treadonly idCompressor: IIdCompressor;\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { type ISharedTree, type ITreePrivate, type SharedTreeOptionsInternal, type SharedTreeOptions, SharedTree, getBranch, type ForestType, type SharedTreeContentSnapshot, type SharedTreeFormatOptions, SharedTreeFormatVersion, buildConfiguredForest, defaultSharedTreeOptions, type ForestOptions, type ITreeInternal, ForestTypeOptimized, ForestTypeExpensiveDebug, ForestTypeReference, } from "./sharedTree.js";
5
+ export { type ISharedTree, type ITreePrivate, type SharedTreeOptionsInternal, type SharedTreeOptions, SharedTree, getBranch, type ForestType, type SharedTreeContentSnapshot, type SharedTreeFormatOptions, SharedTreeFormatVersion, buildConfiguredForest, defaultSharedTreeOptions, type ForestOptions, type ITreeInternal, ForestTypeOptimized, ForestTypeExpensiveDebug, ForestTypeReference, exportSimpleSchema, } from "./sharedTree.js";
6
6
  export { createTreeCheckout, TreeCheckout, type ITreeCheckout, type CheckoutEvents, type ITreeCheckoutFork, type BranchableTree, type TreeBranchFork, } from "./treeCheckout.js";
7
7
  export { type TreeStoredContent } from "./schematizeTree.js";
8
8
  export { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,UAAU,EACV,SAAS,EACT,KAAK,UAAU,EACf,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EAC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AAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,cAAc,GACnB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAEvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEnF,OAAO,EACN,OAAO,IAAI,IAAI,EACf,KAAK,OAAO,EACZ,KAAK,cAAc,GACnB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EACN,0BAA0B,EAC1B,KAAK,WAAW,EAChB,eAAe,GACf,MAAM,sBAAsB,CAAC"}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.independentView = exports.independentInitializedView = exports.TreeAlpha = exports.Tree = exports.CheckoutFlexTreeView = exports.SchematizingSimpleTreeView = exports.TreeCheckout = exports.createTreeCheckout = exports.ForestTypeReference = exports.ForestTypeExpensiveDebug = exports.ForestTypeOptimized = exports.defaultSharedTreeOptions = exports.buildConfiguredForest = exports.SharedTreeFormatVersion = exports.getBranch = exports.SharedTree = void 0;
7
+ exports.independentView = exports.independentInitializedView = exports.TreeAlpha = exports.Tree = exports.CheckoutFlexTreeView = exports.SchematizingSimpleTreeView = exports.TreeCheckout = exports.createTreeCheckout = exports.exportSimpleSchema = exports.ForestTypeReference = exports.ForestTypeExpensiveDebug = exports.ForestTypeOptimized = exports.defaultSharedTreeOptions = exports.buildConfiguredForest = exports.SharedTreeFormatVersion = exports.getBranch = exports.SharedTree = void 0;
8
8
  var sharedTree_js_1 = require("./sharedTree.js");
9
9
  Object.defineProperty(exports, "SharedTree", { enumerable: true, get: function () { return sharedTree_js_1.SharedTree; } });
10
10
  Object.defineProperty(exports, "getBranch", { enumerable: true, get: function () { return sharedTree_js_1.getBranch; } });
@@ -14,6 +14,7 @@ Object.defineProperty(exports, "defaultSharedTreeOptions", { enumerable: true, g
14
14
  Object.defineProperty(exports, "ForestTypeOptimized", { enumerable: true, get: function () { return sharedTree_js_1.ForestTypeOptimized; } });
15
15
  Object.defineProperty(exports, "ForestTypeExpensiveDebug", { enumerable: true, get: function () { return sharedTree_js_1.ForestTypeExpensiveDebug; } });
16
16
  Object.defineProperty(exports, "ForestTypeReference", { enumerable: true, get: function () { return sharedTree_js_1.ForestTypeReference; } });
17
+ Object.defineProperty(exports, "exportSimpleSchema", { enumerable: true, get: function () { return sharedTree_js_1.exportSimpleSchema; } });
17
18
  var treeCheckout_js_1 = require("./treeCheckout.js");
18
19
  Object.defineProperty(exports, "createTreeCheckout", { enumerable: true, get: function () { return treeCheckout_js_1.createTreeCheckout; } });
19
20
  Object.defineProperty(exports, "TreeCheckout", { enumerable: true, get: function () { return treeCheckout_js_1.TreeCheckout; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared-tree/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDAkByB;AAbxB,2GAAA,UAAU,OAAA;AACV,0GAAA,SAAS,OAAA;AAIT,wHAAA,uBAAuB,OAAA;AACvB,sHAAA,qBAAqB,OAAA;AACrB,yHAAA,wBAAwB,OAAA;AAGxB,oHAAA,mBAAmB,OAAA;AACnB,yHAAA,wBAAwB,OAAA;AACxB,oHAAA,mBAAmB,OAAA;AAGpB,qDAQ2B;AAP1B,qHAAA,kBAAkB,OAAA;AAClB,+GAAA,YAAY,OAAA;AAUb,qEAAuE;AAA9D,qIAAA,0BAA0B,OAAA;AAEnC,qEAAiE;AAAxD,+HAAA,oBAAoB,OAAA;AAI7B,2CAIsB;AAHrB,kGAAA,OAAO,OAAQ;AAKhB,qDAA8C;AAArC,4GAAA,SAAS,OAAA;AAElB,2DAI8B;AAH7B,gIAAA,0BAA0B,OAAA;AAE1B,qHAAA,eAAe,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype ISharedTree,\n\ttype ITreePrivate,\n\ttype SharedTreeOptionsInternal,\n\ttype SharedTreeOptions,\n\tSharedTree,\n\tgetBranch,\n\ttype ForestType,\n\ttype SharedTreeContentSnapshot,\n\ttype SharedTreeFormatOptions,\n\tSharedTreeFormatVersion,\n\tbuildConfiguredForest,\n\tdefaultSharedTreeOptions,\n\ttype ForestOptions,\n\ttype ITreeInternal,\n\tForestTypeOptimized,\n\tForestTypeExpensiveDebug,\n\tForestTypeReference,\n} from \"./sharedTree.js\";\n\nexport {\n\tcreateTreeCheckout,\n\tTreeCheckout,\n\ttype ITreeCheckout,\n\ttype CheckoutEvents,\n\ttype ITreeCheckoutFork,\n\ttype BranchableTree,\n\ttype TreeBranchFork,\n} from \"./treeCheckout.js\";\n\nexport { type TreeStoredContent } from \"./schematizeTree.js\";\n\nexport { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\n\nexport { CheckoutFlexTreeView } from \"./checkoutFlexTreeView.js\";\n\nexport type { ISharedTreeEditor, ISchemaEditor } from \"./sharedTreeEditBuilder.js\";\n\nexport {\n\ttreeApi as Tree,\n\ttype TreeApi,\n\ttype RunTransaction,\n} from \"./treeApi.js\";\n\nexport { TreeAlpha } from \"./treeApiAlpha.js\";\n\nexport {\n\tindependentInitializedView,\n\ttype ViewContent,\n\tindependentView,\n} from \"./independentView.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared-tree/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDAmByB;AAdxB,2GAAA,UAAU,OAAA;AACV,0GAAA,SAAS,OAAA;AAIT,wHAAA,uBAAuB,OAAA;AACvB,sHAAA,qBAAqB,OAAA;AACrB,yHAAA,wBAAwB,OAAA;AAGxB,oHAAA,mBAAmB,OAAA;AACnB,yHAAA,wBAAwB,OAAA;AACxB,oHAAA,mBAAmB,OAAA;AACnB,mHAAA,kBAAkB,OAAA;AAGnB,qDAQ2B;AAP1B,qHAAA,kBAAkB,OAAA;AAClB,+GAAA,YAAY,OAAA;AAUb,qEAAuE;AAA9D,qIAAA,0BAA0B,OAAA;AAEnC,qEAAiE;AAAxD,+HAAA,oBAAoB,OAAA;AAI7B,2CAIsB;AAHrB,kGAAA,OAAO,OAAQ;AAKhB,qDAA8C;AAArC,4GAAA,SAAS,OAAA;AAElB,2DAI8B;AAH7B,gIAAA,0BAA0B,OAAA;AAE1B,qHAAA,eAAe,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype ISharedTree,\n\ttype ITreePrivate,\n\ttype SharedTreeOptionsInternal,\n\ttype SharedTreeOptions,\n\tSharedTree,\n\tgetBranch,\n\ttype ForestType,\n\ttype SharedTreeContentSnapshot,\n\ttype SharedTreeFormatOptions,\n\tSharedTreeFormatVersion,\n\tbuildConfiguredForest,\n\tdefaultSharedTreeOptions,\n\ttype ForestOptions,\n\ttype ITreeInternal,\n\tForestTypeOptimized,\n\tForestTypeExpensiveDebug,\n\tForestTypeReference,\n\texportSimpleSchema,\n} from \"./sharedTree.js\";\n\nexport {\n\tcreateTreeCheckout,\n\tTreeCheckout,\n\ttype ITreeCheckout,\n\ttype CheckoutEvents,\n\ttype ITreeCheckoutFork,\n\ttype BranchableTree,\n\ttype TreeBranchFork,\n} from \"./treeCheckout.js\";\n\nexport { type TreeStoredContent } from \"./schematizeTree.js\";\n\nexport { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\n\nexport { CheckoutFlexTreeView } from \"./checkoutFlexTreeView.js\";\n\nexport type { ISharedTreeEditor, ISchemaEditor } from \"./sharedTreeEditBuilder.js\";\n\nexport {\n\ttreeApi as Tree,\n\ttype TreeApi,\n\ttype RunTransaction,\n} from \"./treeApi.js\";\n\nexport { TreeAlpha } from \"./treeApiAlpha.js\";\n\nexport {\n\tindependentInitializedView,\n\ttype ViewContent,\n\tindependentView,\n} from \"./independentView.js\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"schematizeTree.d.ts","sourceRoot":"","sources":["../../src/shared-tree/schematizeTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,iBAAiB,EAEjB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EAGrB,MAAM,kBAAkB,CAAC;AAU1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1E;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAChC,gBAAgB,EAAE;IACjB,YAAY,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IAC5C,YAAY,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;CAC5C,EACD,SAAS,EAAE,gBAAgB,EAC3B,cAAc,EAAE,MAAM,IAAI,GACxB,IAAI,CA+CN;AAED,oBAAY,UAAU;IACrB;;OAEG;IACH,IAAI,IAAA;IACJ;;OAEG;IACH,UAAU,IAAA;IACV;;OAEG;IACH,gBAAgB,IAAA;IAChB;;OAEG;IACH,YAAY,IAAA;CACZ;AAED,wBAAgB,cAAc,CAC7B,UAAU,EAAE,UAAU,EACtB,0BAA0B,EAAE,iBAAiB,EAC7C,QAAQ,EAAE,aAAa,GACrB,UAAU,CAyBZ;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAG9D;AAoBD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,iBAAiB,GAAG,IAAI,CA+BxF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAC3B,UAAU,EAAE,UAAU,EACtB,0BAA0B,EAAE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aAAa,EAAE,WAAW,EAAE,iBAAiB,GAAG,IAAI,CAgCxF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAC3B,UAAU,EAAE,UAAU,EACtB,0BAA0B,EAAE,iBAAiB,EAC7C,QAAQ,EAAE,aAAa,EACvB,WAAW,EAAE,iBAAiB,GAAG,SAAS,GACxC,OAAO,CAiCT;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAElC;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,SAAS,sBAAsB,EAAE,GAAG,sBAAsB,GAAG,SAAS,CAAC;CAC7F"}
@@ -132,21 +132,22 @@ function initialize(checkout, treeContent) {
132
132
  initializeContent(checkout, treeContent.schema, () => {
133
133
  const field = { field: index_js_1.rootFieldKey, parent: undefined };
134
134
  const content = normalizeNewFieldContent(treeContent.initialTree);
135
+ const contentChunk = checkout.forest.chunkField(content);
135
136
  switch (checkout.storedSchema.rootFieldSchema.kind) {
136
137
  case index_js_2.FieldKinds.optional.identifier: {
137
138
  const fieldEditor = checkout.editor.optionalField(field);
138
139
  (0, internal_1.assert)(content.getFieldLength() <= 1, 0x7f4 /* optional field content should normalize at most one item */);
139
- fieldEditor.set(content.getFieldLength() === 0 ? undefined : content, true);
140
+ fieldEditor.set(contentChunk.topLevelLength === 0 ? undefined : contentChunk, true);
140
141
  break;
141
142
  }
142
143
  case index_js_2.FieldKinds.sequence.identifier: {
143
144
  const fieldEditor = checkout.editor.sequenceField(field);
144
145
  // TODO: should do an idempotent edit here.
145
- fieldEditor.insert(0, content);
146
+ fieldEditor.insert(0, contentChunk);
146
147
  break;
147
148
  }
148
149
  default: {
149
- (0, index_js_3.fail)(0xac7 /* unexpected root field kind during initialize */);
150
+ (0, internal_1.fail)(0xac7 /* unexpected root field kind during initialize */);
150
151
  }
151
152
  }
152
153
  });
@@ -1 +1 @@
1
- {"version":3,"file":"schematizeTree.js","sourceRoot":"","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AAa,EAAE,CAAC;QACvB,KAAK,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;YACtB,OAAO,IAAI,CAAC;QACb,CAAC;QACD,KAAK,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;YAC9B,OAAO,KAAK,CAAC;QACd,CAAC;QACD,KAAK,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC;YAClC,QAAQ,CAAC,YAAY,CAAC,IAAA,yBAAc,EAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;YACzD,OAAO,IAAI,CAAC;QACb,CAAC;QACD,KAAK,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;YAC5B,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;gBAC/B,OAAO,KAAK,CAAC;YACd,CAAC;YACD,QAAQ;YACR,sFAAsF;YACtF,iGAAiG;YACjG,UAAU,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;YAClC,OAAO,IAAI,CAAC;QACb,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACT,IAAA,0BAAe,EAAC,aAAa,CAAC,CAAC;QAChC,CAAC;IACF,CAAC;AACF,CAAC;AAtCD,oCAsCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tAllowedUpdateType,\n\tCursorLocationType,\n\ttype ITreeCursorSynchronous,\n\ttype TreeStoredSchema,\n\trootFieldKey,\n\tschemaDataIsEmpty,\n} from \"../core/index.js\";\nimport {\n\tFieldKinds,\n\tallowsRepoSuperset,\n\tcursorForMapTreeField,\n\tdefaultSchemaPolicy,\n\tmapTreeFromCursor,\n} from \"../feature-libraries/index.js\";\nimport { fail, isReadonlyArray } from \"../util/index.js\";\n\nimport type { ITreeCheckout } from \"./treeCheckout.js\";\nimport { toStoredSchema, type ViewSchema } from \"../simple-tree/index.js\";\n\n/**\n * Modify `storedSchema` and invoke `setInitialTree` when it's time to set the tree content.\n *\n * Requires `storedSchema` to be in its default/empty state.\n *\n * This is done in such a way that if the content (implicitly assumed to start empty)\n * is never out of schema.\n * This means that if the root field of the new schema requires content (like a value field),\n * a temporary intermediate schema is used so the initial empty state is not out of schema.\n *\n * Since this makes multiple changes, callers may want to wrap it in a transaction.\n */\nexport function initializeContent(\n\tschemaRepository: {\n\t\tstoredSchema: ITreeCheckout[\"storedSchema\"];\n\t\tupdateSchema: ITreeCheckout[\"updateSchema\"];\n\t},\n\tnewSchema: TreeStoredSchema,\n\tsetInitialTree: () => void,\n): void {\n\tassert(\n\t\tschemaDataIsEmpty(schemaRepository.storedSchema),\n\t\t0x743 /* cannot initialize after a schema is set */,\n\t);\n\n\tconst rootSchema = newSchema.rootFieldSchema;\n\tconst rootKind = rootSchema.kind;\n\n\t// To keep the data in schema during the update, first define a schema that tolerates the current (empty) tree as well as the final (initial) tree.\n\tlet incrementalSchemaUpdate: TreeStoredSchema;\n\tif (\n\t\trootKind === FieldKinds.sequence.identifier ||\n\t\trootKind === FieldKinds.optional.identifier\n\t) {\n\t\t// These kinds are known to tolerate empty, so use the schema as is:\n\t\tincrementalSchemaUpdate = newSchema;\n\t} else {\n\t\tassert(rootKind === FieldKinds.required.identifier, 0x5c8 /* Unexpected kind */);\n\t\t// Replace value kind with optional kind in root field schema:\n\t\tincrementalSchemaUpdate = {\n\t\t\tnodeSchema: newSchema.nodeSchema,\n\t\t\trootFieldSchema: {\n\t\t\t\tkind: FieldKinds.optional.identifier,\n\t\t\t\ttypes: rootSchema.types,\n\t\t\t},\n\t\t};\n\t}\n\n\t// TODO: fix issues with schema comparison and enable this.\n\t// assert(\n\t// \tallowsRepoSuperset(defaultSchemaPolicy, tree.storedSchema, incrementalSchemaUpdate),\n\t// \t\"Incremental Schema update should support the existing empty tree\",\n\t// );\n\tassert(\n\t\tallowsRepoSuperset(defaultSchemaPolicy, newSchema, incrementalSchemaUpdate),\n\t\t0x5c9 /* Incremental Schema during update should be a allow a superset of the final schema */,\n\t);\n\t// Update to intermediate schema\n\tschemaRepository.updateSchema(incrementalSchemaUpdate);\n\t// Insert initial tree\n\tsetInitialTree();\n\n\t// If intermediate schema is not final desired schema, update to the final schema:\n\tif (incrementalSchemaUpdate !== newSchema) {\n\t\tschemaRepository.updateSchema(newSchema);\n\t}\n}\n\nexport enum UpdateType {\n\t/**\n\t * Already compatible, no update needed.\n\t */\n\tNone,\n\t/**\n\t * Empty: needs initializing.\n\t */\n\tInitialize,\n\t/**\n\t * Schema can be upgraded leaving tree as is.\n\t */\n\tSchemaCompatible,\n\t/**\n\t * No update currently supported.\n\t */\n\tIncompatible,\n}\n\nexport function evaluateUpdate(\n\tviewSchema: ViewSchema,\n\tallowedSchemaModifications: AllowedUpdateType,\n\tcheckout: ITreeCheckout,\n): UpdateType {\n\tconst compatibility = viewSchema.checkCompatibility(checkout.storedSchema);\n\n\tif (compatibility.canUpgrade && compatibility.canView) {\n\t\t// Compatible as is\n\t\treturn UpdateType.None;\n\t}\n\n\t// eslint-disable-next-line no-bitwise\n\tif (allowedSchemaModifications & AllowedUpdateType.Initialize && canInitialize(checkout)) {\n\t\treturn UpdateType.Initialize;\n\t}\n\n\tif (!compatibility.canUpgrade) {\n\t\t// Existing stored schema permits trees which are incompatible with the view schema, so schema can not be updated\n\t\treturn UpdateType.Incompatible;\n\t}\n\n\tassert(!compatibility.canView, 0x8bd /* unexpected case */);\n\tassert(compatibility.canUpgrade, 0x8be /* unexpected case */);\n\n\t// eslint-disable-next-line no-bitwise\n\treturn allowedSchemaModifications & AllowedUpdateType.SchemaCompatible\n\t\t? UpdateType.SchemaCompatible\n\t\t: UpdateType.Incompatible;\n}\n\nexport function canInitialize(checkout: ITreeCheckout): boolean {\n\t// Check for empty.\n\treturn checkout.forest.isEmpty && schemaDataIsEmpty(checkout.storedSchema);\n}\n\nfunction normalizeNewFieldContent(\n\tcontent: readonly ITreeCursorSynchronous[] | ITreeCursorSynchronous | undefined,\n): ITreeCursorSynchronous {\n\tif (content === undefined) {\n\t\treturn cursorForMapTreeField([]);\n\t}\n\n\tif (isReadonlyArray(content)) {\n\t\treturn cursorForMapTreeField(content.map((c) => mapTreeFromCursor(c)));\n\t}\n\n\tif (content.mode === CursorLocationType.Fields) {\n\t\treturn content;\n\t}\n\n\treturn cursorForMapTreeField([mapTreeFromCursor(content)]);\n}\n\n/**\n * Initialize a checkout with a schema and tree content.\n * This function should only be called when the tree is uninitialized (no schema or content).\n * @remarks\n *\n * If the proposed schema (from `treeContent`) is not compatible with the emptry tree, this function handles using an intermediate schema\n * which supports the empty tree as well as the final tree content.\n */\nexport function initialize(checkout: ITreeCheckout, treeContent: TreeStoredContent): void {\n\tcheckout.transaction.start();\n\ttry {\n\t\tinitializeContent(checkout, treeContent.schema, () => {\n\t\t\tconst field = { field: rootFieldKey, parent: undefined };\n\t\t\tconst content = normalizeNewFieldContent(treeContent.initialTree);\n\n\t\t\tswitch (checkout.storedSchema.rootFieldSchema.kind) {\n\t\t\t\tcase FieldKinds.optional.identifier: {\n\t\t\t\t\tconst fieldEditor = checkout.editor.optionalField(field);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tcontent.getFieldLength() <= 1,\n\t\t\t\t\t\t0x7f4 /* optional field content should normalize at most one item */,\n\t\t\t\t\t);\n\t\t\t\t\tfieldEditor.set(content.getFieldLength() === 0 ? undefined : content, true);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase FieldKinds.sequence.identifier: {\n\t\t\t\t\tconst fieldEditor = checkout.editor.sequenceField(field);\n\t\t\t\t\t// TODO: should do an idempotent edit here.\n\t\t\t\t\tfieldEditor.insert(0, content);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tfail(0xac7 /* unexpected root field kind during initialize */);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t} finally {\n\t\tcheckout.transaction.commit();\n\t}\n}\n\n/**\n * Ensure a {@link ITreeCheckout} can be used with a given {@link ViewSchema}.\n *\n * @remarks\n * It is up to the caller to ensure that compatibility is reevaluated if the checkout's stored schema is edited in the future.\n *\n * @param viewSchema - View schema that `checkout` should be made compatible with.\n * @param allowedSchemaModifications - Flags enum describing the ways this is allowed to modify `checkout`.\n * @param checkout - To be modified as needed to be compatible with `viewSchema`.\n * @param treeContent - Content to be used to initialize `checkout`'s the tree if needed and allowed.\n * @returns true iff checkout now is compatible with `viewSchema`.\n */\nexport function ensureSchema(\n\tviewSchema: ViewSchema,\n\tallowedSchemaModifications: AllowedUpdateType,\n\tcheckout: ITreeCheckout,\n\ttreeContent: TreeStoredContent | undefined,\n): boolean {\n\tlet possibleModifications = allowedSchemaModifications;\n\tif (treeContent === undefined) {\n\t\t// Clear bit for Initialize if initial tree is not provided.\n\t\t// eslint-disable-next-line no-bitwise\n\t\tpossibleModifications &= ~AllowedUpdateType.Initialize;\n\t}\n\tconst updatedNeeded = evaluateUpdate(viewSchema, possibleModifications, checkout);\n\tswitch (updatedNeeded) {\n\t\tcase UpdateType.None: {\n\t\t\treturn true;\n\t\t}\n\t\tcase UpdateType.Incompatible: {\n\t\t\treturn false;\n\t\t}\n\t\tcase UpdateType.SchemaCompatible: {\n\t\t\tcheckout.updateSchema(toStoredSchema(viewSchema.schema));\n\t\t\treturn true;\n\t\t}\n\t\tcase UpdateType.Initialize: {\n\t\t\tif (treeContent === undefined) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t// TODO:\n\t\t\t// When this becomes a more proper out of schema adapter, editing should be made lazy.\n\t\t\t// This will improve support for readonly documents, cross version collaboration and attribution.\n\t\t\tinitialize(checkout, treeContent);\n\t\t\treturn true;\n\t\t}\n\t\tdefault: {\n\t\t\tunreachableCase(updatedNeeded);\n\t\t}\n\t}\n}\n\n/**\n * Content that can populate a `SharedTree`.\n */\nexport interface TreeStoredContent {\n\treadonly schema: TreeStoredSchema;\n\n\t/**\n\t * Default tree content to initialize the tree with iff the tree is uninitialized\n\t * (meaning it does not even have any schema set at all).\n\t */\n\treadonly initialTree: readonly ITreeCursorSynchronous[] | ITreeCursorSynchronous | undefined;\n}\n"]}
1
+ {"version":3,"file":"schematizeTree.js","sourceRoot":"","sources":["../../src/shared-tree/schematizeTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAoF;AAEpF,+CAO0B;AAC1B,4DAMuC;AACvC,+CAAmD;AAGnD,sDAA0E;AAE1E;;;;;;;;;;;GAWG;AACH,SAAgB,iBAAiB,CAChC,gBAGC,EACD,SAA2B,EAC3B,cAA0B;IAE1B,IAAA,iBAAM,EACL,IAAA,4BAAiB,EAAC,gBAAgB,CAAC,YAAY,CAAC,EAChD,KAAK,CAAC,6CAA6C,CACnD,CAAC;IAEF,MAAM,UAAU,GAAG,SAAS,CAAC,eAAe,CAAC;IAC7C,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC;IAEjC,mJAAmJ;IACnJ,IAAI,uBAAyC,CAAC;IAC9C,IACC,QAAQ,KAAK,qBAAU,CAAC,QAAQ,CAAC,UAAU;QAC3C,QAAQ,KAAK,qBAAU,CAAC,QAAQ,CAAC,UAAU,EAC1C,CAAC;QACF,oEAAoE;QACpE,uBAAuB,GAAG,SAAS,CAAC;IACrC,CAAC;SAAM,CAAC;QACP,IAAA,iBAAM,EAAC,QAAQ,KAAK,qBAAU,CAAC,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACjF,8DAA8D;QAC9D,uBAAuB,GAAG;YACzB,UAAU,EAAE,SAAS,CAAC,UAAU;YAChC,eAAe,EAAE;gBAChB,IAAI,EAAE,qBAAU,CAAC,QAAQ,CAAC,UAAU;gBACpC,KAAK,EAAE,UAAU,CAAC,KAAK;aACvB;SACD,CAAC;IACH,CAAC;IAED,2DAA2D;IAC3D,UAAU;IACV,wFAAwF;IACxF,uEAAuE;IACvE,KAAK;IACL,IAAA,iBAAM,EACL,IAAA,6BAAkB,EAAC,8BAAmB,EAAE,SAAS,EAAE,uBAAu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D;QAC5D,sCAAsC;QACtC,qBAAqB,IAAI,CAAC,4BAAiB,CAAC,UAAU,CAAC;IACxD,CAAC;IACD,MAAM,aAAa,GAAG,cAAc,CAAC,UAAU,EAAE,qBAAqB,EAAE,QAAQ,CAAC,CAAC;IAClF,QAAQ,aAAa,EAAE,CAAC;QACvB,KAAK,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;YACtB,OAAO,IAAI,CAAC;QACb,CAAC;QACD,KAAK,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;YAC9B,OAAO,KAAK,CAAC;QACd,CAAC;QACD,KAAK,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC;YAClC,QAAQ,CAAC,YAAY,CAAC,IAAA,yBAAc,EAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;YACzD,OAAO,IAAI,CAAC;QACb,CAAC;QACD,KAAK,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;YAC5B,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;gBAC/B,OAAO,KAAK,CAAC;YACd,CAAC;YACD,QAAQ;YACR,sFAAsF;YACtF,iGAAiG;YACjG,UAAU,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;YAClC,OAAO,IAAI,CAAC;QACb,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACT,IAAA,0BAAe,EAAC,aAAa,CAAC,CAAC;QAChC,CAAC;IACF,CAAC;AACF,CAAC;AAtCD,oCAsCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase, fail } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tAllowedUpdateType,\n\tCursorLocationType,\n\ttype ITreeCursorSynchronous,\n\ttype TreeStoredSchema,\n\trootFieldKey,\n\tschemaDataIsEmpty,\n} from \"../core/index.js\";\nimport {\n\tFieldKinds,\n\tallowsRepoSuperset,\n\tcursorForMapTreeField,\n\tdefaultSchemaPolicy,\n\tmapTreeFromCursor,\n} from \"../feature-libraries/index.js\";\nimport { isReadonlyArray } from \"../util/index.js\";\n\nimport type { ITreeCheckout } from \"./treeCheckout.js\";\nimport { toStoredSchema, type ViewSchema } from \"../simple-tree/index.js\";\n\n/**\n * Modify `storedSchema` and invoke `setInitialTree` when it's time to set the tree content.\n *\n * Requires `storedSchema` to be in its default/empty state.\n *\n * This is done in such a way that if the content (implicitly assumed to start empty)\n * is never out of schema.\n * This means that if the root field of the new schema requires content (like a value field),\n * a temporary intermediate schema is used so the initial empty state is not out of schema.\n *\n * Since this makes multiple changes, callers may want to wrap it in a transaction.\n */\nexport function initializeContent(\n\tschemaRepository: {\n\t\tstoredSchema: ITreeCheckout[\"storedSchema\"];\n\t\tupdateSchema: ITreeCheckout[\"updateSchema\"];\n\t},\n\tnewSchema: TreeStoredSchema,\n\tsetInitialTree: () => void,\n): void {\n\tassert(\n\t\tschemaDataIsEmpty(schemaRepository.storedSchema),\n\t\t0x743 /* cannot initialize after a schema is set */,\n\t);\n\n\tconst rootSchema = newSchema.rootFieldSchema;\n\tconst rootKind = rootSchema.kind;\n\n\t// To keep the data in schema during the update, first define a schema that tolerates the current (empty) tree as well as the final (initial) tree.\n\tlet incrementalSchemaUpdate: TreeStoredSchema;\n\tif (\n\t\trootKind === FieldKinds.sequence.identifier ||\n\t\trootKind === FieldKinds.optional.identifier\n\t) {\n\t\t// These kinds are known to tolerate empty, so use the schema as is:\n\t\tincrementalSchemaUpdate = newSchema;\n\t} else {\n\t\tassert(rootKind === FieldKinds.required.identifier, 0x5c8 /* Unexpected kind */);\n\t\t// Replace value kind with optional kind in root field schema:\n\t\tincrementalSchemaUpdate = {\n\t\t\tnodeSchema: newSchema.nodeSchema,\n\t\t\trootFieldSchema: {\n\t\t\t\tkind: FieldKinds.optional.identifier,\n\t\t\t\ttypes: rootSchema.types,\n\t\t\t},\n\t\t};\n\t}\n\n\t// TODO: fix issues with schema comparison and enable this.\n\t// assert(\n\t// \tallowsRepoSuperset(defaultSchemaPolicy, tree.storedSchema, incrementalSchemaUpdate),\n\t// \t\"Incremental Schema update should support the existing empty tree\",\n\t// );\n\tassert(\n\t\tallowsRepoSuperset(defaultSchemaPolicy, newSchema, incrementalSchemaUpdate),\n\t\t0x5c9 /* Incremental Schema during update should be a allow a superset of the final schema */,\n\t);\n\t// Update to intermediate schema\n\tschemaRepository.updateSchema(incrementalSchemaUpdate);\n\t// Insert initial tree\n\tsetInitialTree();\n\n\t// If intermediate schema is not final desired schema, update to the final schema:\n\tif (incrementalSchemaUpdate !== newSchema) {\n\t\tschemaRepository.updateSchema(newSchema);\n\t}\n}\n\nexport enum UpdateType {\n\t/**\n\t * Already compatible, no update needed.\n\t */\n\tNone,\n\t/**\n\t * Empty: needs initializing.\n\t */\n\tInitialize,\n\t/**\n\t * Schema can be upgraded leaving tree as is.\n\t */\n\tSchemaCompatible,\n\t/**\n\t * No update currently supported.\n\t */\n\tIncompatible,\n}\n\nexport function evaluateUpdate(\n\tviewSchema: ViewSchema,\n\tallowedSchemaModifications: AllowedUpdateType,\n\tcheckout: ITreeCheckout,\n): UpdateType {\n\tconst compatibility = viewSchema.checkCompatibility(checkout.storedSchema);\n\n\tif (compatibility.canUpgrade && compatibility.canView) {\n\t\t// Compatible as is\n\t\treturn UpdateType.None;\n\t}\n\n\t// eslint-disable-next-line no-bitwise\n\tif (allowedSchemaModifications & AllowedUpdateType.Initialize && canInitialize(checkout)) {\n\t\treturn UpdateType.Initialize;\n\t}\n\n\tif (!compatibility.canUpgrade) {\n\t\t// Existing stored schema permits trees which are incompatible with the view schema, so schema can not be updated\n\t\treturn UpdateType.Incompatible;\n\t}\n\n\tassert(!compatibility.canView, 0x8bd /* unexpected case */);\n\tassert(compatibility.canUpgrade, 0x8be /* unexpected case */);\n\n\t// eslint-disable-next-line no-bitwise\n\treturn allowedSchemaModifications & AllowedUpdateType.SchemaCompatible\n\t\t? UpdateType.SchemaCompatible\n\t\t: UpdateType.Incompatible;\n}\n\nexport function canInitialize(checkout: ITreeCheckout): boolean {\n\t// Check for empty.\n\treturn checkout.forest.isEmpty && schemaDataIsEmpty(checkout.storedSchema);\n}\n\nfunction normalizeNewFieldContent(\n\tcontent: readonly ITreeCursorSynchronous[] | ITreeCursorSynchronous | undefined,\n): ITreeCursorSynchronous {\n\tif (content === undefined) {\n\t\treturn cursorForMapTreeField([]);\n\t}\n\n\tif (isReadonlyArray(content)) {\n\t\treturn cursorForMapTreeField(content.map((c) => mapTreeFromCursor(c)));\n\t}\n\n\tif (content.mode === CursorLocationType.Fields) {\n\t\treturn content;\n\t}\n\n\treturn cursorForMapTreeField([mapTreeFromCursor(content)]);\n}\n\n/**\n * Initialize a checkout with a schema and tree content.\n * This function should only be called when the tree is uninitialized (no schema or content).\n * @remarks\n *\n * If the proposed schema (from `treeContent`) is not compatible with the emptry tree, this function handles using an intermediate schema\n * which supports the empty tree as well as the final tree content.\n */\nexport function initialize(checkout: ITreeCheckout, treeContent: TreeStoredContent): void {\n\tcheckout.transaction.start();\n\ttry {\n\t\tinitializeContent(checkout, treeContent.schema, () => {\n\t\t\tconst field = { field: rootFieldKey, parent: undefined };\n\t\t\tconst content = normalizeNewFieldContent(treeContent.initialTree);\n\t\t\tconst contentChunk = checkout.forest.chunkField(content);\n\n\t\t\tswitch (checkout.storedSchema.rootFieldSchema.kind) {\n\t\t\t\tcase FieldKinds.optional.identifier: {\n\t\t\t\t\tconst fieldEditor = checkout.editor.optionalField(field);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tcontent.getFieldLength() <= 1,\n\t\t\t\t\t\t0x7f4 /* optional field content should normalize at most one item */,\n\t\t\t\t\t);\n\t\t\t\t\tfieldEditor.set(contentChunk.topLevelLength === 0 ? undefined : contentChunk, true);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase FieldKinds.sequence.identifier: {\n\t\t\t\t\tconst fieldEditor = checkout.editor.sequenceField(field);\n\t\t\t\t\t// TODO: should do an idempotent edit here.\n\t\t\t\t\tfieldEditor.insert(0, contentChunk);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tfail(0xac7 /* unexpected root field kind during initialize */);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t} finally {\n\t\tcheckout.transaction.commit();\n\t}\n}\n\n/**\n * Ensure a {@link ITreeCheckout} can be used with a given {@link ViewSchema}.\n *\n * @remarks\n * It is up to the caller to ensure that compatibility is reevaluated if the checkout's stored schema is edited in the future.\n *\n * @param viewSchema - View schema that `checkout` should be made compatible with.\n * @param allowedSchemaModifications - Flags enum describing the ways this is allowed to modify `checkout`.\n * @param checkout - To be modified as needed to be compatible with `viewSchema`.\n * @param treeContent - Content to be used to initialize `checkout`'s the tree if needed and allowed.\n * @returns true iff checkout now is compatible with `viewSchema`.\n */\nexport function ensureSchema(\n\tviewSchema: ViewSchema,\n\tallowedSchemaModifications: AllowedUpdateType,\n\tcheckout: ITreeCheckout,\n\ttreeContent: TreeStoredContent | undefined,\n): boolean {\n\tlet possibleModifications = allowedSchemaModifications;\n\tif (treeContent === undefined) {\n\t\t// Clear bit for Initialize if initial tree is not provided.\n\t\t// eslint-disable-next-line no-bitwise\n\t\tpossibleModifications &= ~AllowedUpdateType.Initialize;\n\t}\n\tconst updatedNeeded = evaluateUpdate(viewSchema, possibleModifications, checkout);\n\tswitch (updatedNeeded) {\n\t\tcase UpdateType.None: {\n\t\t\treturn true;\n\t\t}\n\t\tcase UpdateType.Incompatible: {\n\t\t\treturn false;\n\t\t}\n\t\tcase UpdateType.SchemaCompatible: {\n\t\t\tcheckout.updateSchema(toStoredSchema(viewSchema.schema));\n\t\t\treturn true;\n\t\t}\n\t\tcase UpdateType.Initialize: {\n\t\t\tif (treeContent === undefined) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t// TODO:\n\t\t\t// When this becomes a more proper out of schema adapter, editing should be made lazy.\n\t\t\t// This will improve support for readonly documents, cross version collaboration and attribution.\n\t\t\tinitialize(checkout, treeContent);\n\t\t\treturn true;\n\t\t}\n\t\tdefault: {\n\t\t\tunreachableCase(updatedNeeded);\n\t\t}\n\t}\n}\n\n/**\n * Content that can populate a `SharedTree`.\n */\nexport interface TreeStoredContent {\n\treadonly schema: TreeStoredSchema;\n\n\t/**\n\t * Default tree content to initialize the tree with iff the tree is uninitialized\n\t * (meaning it does not even have any schema set at all).\n\t */\n\treadonly initialTree: readonly ITreeCursorSynchronous[] | ITreeCursorSynchronous | undefined;\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { HasListeners, IEmitter, Listenable } from "@fluidframework/core-interfaces/internal";
6
- import { type NodeKeyManager, type FullSchemaPolicy } from "../feature-libraries/index.js";
6
+ import { type NodeIdentifierManager, type FullSchemaPolicy } from "../feature-libraries/index.js";
7
7
  import { type ImplicitFieldSchema, type SchemaCompatibilityStatus, type TreeView, type TreeViewEvents, ViewSchema, type TreeViewConfiguration, type TreeViewAlpha, type InsertableField, type ReadableField, type ReadSchema, type UnsafeUnknownSchema, type TreeBranch, type TreeBranchEvents, type VoidTransactionCallbackStatus, type TransactionCallbackStatus, type TransactionResult, type TransactionResultExt, type RunTransactionParams } from "../simple-tree/index.js";
8
8
  import { type Breakable, type WithBreakable } from "../util/index.js";
9
9
  import type { ITreeCheckout, TreeCheckout } from "./treeCheckout.js";
@@ -19,7 +19,7 @@ export declare const ViewSlot: import("../core/index.js").AnchorSlot<TreeView<Im
19
19
  export declare class SchematizingSimpleTreeView<in out TRootSchema extends ImplicitFieldSchema | UnsafeUnknownSchema> implements TreeBranch, TreeViewAlpha<TRootSchema>, WithBreakable {
20
20
  readonly checkout: TreeCheckout;
21
21
  readonly config: TreeViewConfiguration<ReadSchema<TRootSchema>>;
22
- readonly nodeKeyManager: NodeKeyManager;
22
+ readonly nodeKeyManager: NodeIdentifierManager;
23
23
  private readonly onDispose?;
24
24
  /**
25
25
  * The view is set to undefined when this object is disposed or the view schema does not support viewing the document's stored schema.
@@ -45,7 +45,7 @@ export declare class SchematizingSimpleTreeView<in out TRootSchema extends Impli
45
45
  private midUpgrade;
46
46
  private readonly rootFieldSchema;
47
47
  readonly breaker: Breakable;
48
- constructor(checkout: TreeCheckout, config: TreeViewConfiguration<ReadSchema<TRootSchema>>, nodeKeyManager: NodeKeyManager, onDispose?: (() => void) | undefined);
48
+ constructor(checkout: TreeCheckout, config: TreeViewConfiguration<ReadSchema<TRootSchema>>, nodeKeyManager: NodeIdentifierManager, onDispose?: (() => void) | undefined);
49
49
  hasRootSchema<TSchema extends ImplicitFieldSchema>(schema: TSchema): this is TreeViewAlpha<TSchema>;
50
50
  get schema(): ReadSchema<TRootSchema>;
51
51
  initialize(content: InsertableField<TRootSchema>): void;
@@ -96,5 +96,5 @@ export declare function getCheckout(context: TreeBranch): TreeCheckout;
96
96
  * Creates a view that self-disposes whenenever the stored schema changes.
97
97
  * This may only be called when the schema is already known to be compatible (typically via ensureSchema).
98
98
  */
99
- export declare function requireSchema(checkout: ITreeCheckout, viewSchema: ViewSchema, onDispose: () => void, nodeKeyManager: NodeKeyManager, schemaPolicy: FullSchemaPolicy): CheckoutFlexTreeView;
99
+ export declare function requireSchema(checkout: ITreeCheckout, viewSchema: ViewSchema, onDispose: () => void, nodeKeyManager: NodeIdentifierManager, schemaPolicy: FullSchemaPolicy): CheckoutFlexTreeView;
100
100
  //# sourceMappingURL=schematizingTreeView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schematizingTreeView.d.ts","sourceRoot":"","sources":["../../src/shared-tree/schematizingTreeView.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,MAAM,0CAA0C,CAAC;AAMlD,OAAO,EACN,KAAK,cAAc,EAInB,KAAK,gBAAgB,EAErB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEN,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,QAAQ,EACb,KAAK,cAAc,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AE,eAAe,CAAC,WAAW,CAAC,EAapD;IAIM,IAAI,IAAI,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,0BAA0B,CAAC,WAAW,CAAC;IAIhF,KAAK,CAAC,OAAO,EAAE,UAAU,EAAE,aAAa,UAAO,GAAG,IAAI;IAItD,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI;CAK5C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,YAAY,CAK7D;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC5B,QAAQ,EAAE,aAAa,EACvB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,MAAM,IAAI,EACrB,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,gBAAgB,GAC5B,oBAAoB,CAatB"}
1
+ {"version":3,"file":"schematizingTreeView.d.ts","sourceRoot":"","sources":["../../src/shared-tree/schematizingTreeView.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,MAAM,0CAA0C,CAAC;AAMlD,OAAO,EACN,KAAK,qBAAqB,EAI1B,KAAK,gBAAgB,EAErB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEN,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,QAAQ,EACb,KAAK,cAAc,EAInB,UAAU,EAEV,KAAK,qBAAqB,EAK1B,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,gBAAgB,EAGrB,KAAK,6BAA6B,EAClC,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAMzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,KAAK,SAAS,EAGd,KAAK,aAAa,EAClB,MAAM,kBAAkB,C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G,IAAI,8CAAoB,CAAC,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;IACzF,IAAA,iBAAM,EAAC,KAAK,CAAC,GAAG,CAAC,sBAAW,CAAC,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAE9E,OAAO,IAAI,CAAC;AACb,CAAC;AAnBD,sCAmBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tHasListeners,\n\tIEmitter,\n\tListenable,\n} from \"@fluidframework/core-interfaces/internal\";\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { AllowedUpdateType, anchorSlot, type SchemaPolicy } from \"../core/index.js\";\nimport {\n\ttype NodeKeyManager,\n\tdefaultSchemaPolicy,\n\tContextSlot,\n\tcursorForMapTreeNode,\n\ttype FullSchemaPolicy,\n\tTreeStatus,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype FieldSchema,\n\ttype ImplicitFieldSchema,\n\ttype SchemaCompatibilityStatus,\n\ttype TreeView,\n\ttype TreeViewEvents,\n\tgetTreeNodeForField,\n\tsetField,\n\tnormalizeFieldSchema,\n\tViewSchema,\n\ttype InsertableContent,\n\ttype TreeViewConfiguration,\n\tmapTreeFromNodeData,\n\tprepareContentForHydration,\n\tcomparePersistedSchemaInternal,\n\ttoStoredSchema,\n\ttype TreeViewAlpha,\n\ttype InsertableField,\n\ttype ReadableField,\n\ttype ReadSchema,\n\ttype UnsafeUnknownSchema,\n\ttype TreeBranch,\n\ttype TreeBranchEvents,\n\tgetOrCreateInnerNode,\n\tgetKernel,\n\ttype VoidTransactionCallbackStatus,\n\ttype TransactionCallbackStatus,\n\ttype TransactionResult,\n\ttype TransactionResultExt,\n\ttype RunTransactionParams,\n\ttype TransactionConstraint,\n\tHydratedContext,\n\tSimpleContextSlot,\n\tareImplicitFieldSchemaEqual,\n\tcreateUnknownOptionalFieldPolicy,\n} from \"../simple-tree/index.js\";\nimport {\n\ttype Breakable,\n\tbreakingClass,\n\tdisposeSymbol,\n\ttype WithBreakable,\n} from \"../util/index.js\";\n\nimport { canInitialize, ensureSchema, initialize } from \"./schematizeTree.js\";\nimport type { ITreeCheckout, TreeCheckout } from \"./treeCheckout.js\";\nimport { CheckoutFlexTreeView } from \"./checkoutFlexTreeView.js\";\n\n/**\n * Creating multiple tree views from the same checkout is not supported. This slot is used to detect if one already\n * exists and error if creating a second.\n */\nexport const ViewSlot = anchorSlot<TreeView<ImplicitFieldSchema>>();\n\n/**\n * Implementation of TreeView wrapping a FlexTreeView.\n */\n@breakingClass\nexport class SchematizingSimpleTreeView<\n\tin out TRootSchema extends ImplicitFieldSchema | UnsafeUnknownSchema,\n> implements TreeBranch, TreeViewAlpha<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 | undefined;\n\n\t/**\n\t * Undefined iff uninitialized or disposed.\n\t */\n\tprivate currentCompatibility: SchemaCompatibilityStatus | undefined;\n\tprivate readonly schemaPolicy: SchemaPolicy;\n\tpublic readonly events: Listenable<TreeViewEvents & TreeBranchEvents> &\n\t\tIEmitter<TreeViewEvents & TreeBranchEvents> &\n\t\tHasListeners<TreeViewEvents & TreeBranchEvents> = 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\tpublic readonly breaker: Breakable;\n\n\tpublic constructor(\n\t\tpublic readonly checkout: TreeCheckout,\n\t\tpublic readonly config: TreeViewConfiguration<ReadSchema<TRootSchema>>,\n\t\tpublic readonly nodeKeyManager: NodeKeyManager,\n\t\tprivate readonly onDispose?: () => void,\n\t) {\n\t\tthis.breaker = checkout.breaker;\n\t\tif (checkout.forest.anchors.slots.has(ViewSlot)) {\n\t\t\tthrow new UsageError(\"Cannot create a second tree view from the same checkout\");\n\t\t}\n\t\tcheckout.forest.anchors.slots.set(ViewSlot, this);\n\n\t\tthis.rootFieldSchema = normalizeFieldSchema(config.schema);\n\t\tthis.schemaPolicy = {\n\t\t\t...defaultSchemaPolicy,\n\t\t\tvalidateSchema: config.enableSchemaValidation,\n\t\t\tallowUnknownOptionalFields: createUnknownOptionalFieldPolicy(this.rootFieldSchema),\n\t\t};\n\n\t\tthis.viewSchema = new ViewSchema(this.schemaPolicy, {}, this.rootFieldSchema);\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(\"changed\", (data, getRevertible) => {\n\t\t\t\tthis.events.emit(\"changed\", data, getRevertible);\n\t\t\t\tthis.events.emit(\"commitApplied\", data, getRevertible);\n\t\t\t}),\n\t\t);\n\t}\n\n\tpublic hasRootSchema<TSchema extends ImplicitFieldSchema>(\n\t\tschema: TSchema,\n\t): this is TreeViewAlpha<TSchema> {\n\t\treturn areImplicitFieldSchemaEqual(this.rootFieldSchema, schema);\n\t}\n\n\tpublic get schema(): ReadSchema<TRootSchema> {\n\t\treturn this.config.schema;\n\t}\n\n\tpublic initialize(content: InsertableField<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 | undefined,\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: this.schemaPolicy,\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: toStoredSchema(this.viewSchema.schema),\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: toStoredSchema(this.viewSchema.schema),\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 {\n\t\tthis.ensureUndisposed();\n\t\tassert(this.view !== undefined, 0x8c0 /* unexpected getViewOrError */);\n\t\treturn this.view;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-tree#TreeViewAlpha.runTransaction}\n\t */\n\tpublic runTransaction<TSuccessValue, TFailureValue>(\n\t\ttransaction: () => TransactionCallbackStatus<TSuccessValue, TFailureValue>,\n\t\tparams?: RunTransactionParams,\n\t): TransactionResultExt<TSuccessValue, TFailureValue>;\n\t/**\n\t * {@inheritDoc @fluidframework/shared-tree#TreeViewAlpha.runTransaction}\n\t */\n\tpublic runTransaction(\n\t\ttransaction: () => VoidTransactionCallbackStatus | void,\n\t\tparams?: RunTransactionParams,\n\t): TransactionResult;\n\tpublic runTransaction<TSuccessValue, TFailureValue>(\n\t\ttransaction: () =>\n\t\t\t| TransactionCallbackStatus<TSuccessValue, TFailureValue>\n\t\t\t| VoidTransactionCallbackStatus\n\t\t\t| void,\n\t\tparams?: RunTransactionParams,\n\t): TransactionResultExt<TSuccessValue, TFailureValue> | TransactionResult {\n\t\tconst addConstraints = (\n\t\t\tconstraintsOnRevert: boolean,\n\t\t\tconstraints: readonly TransactionConstraint[] = [],\n\t\t): void => {\n\t\t\tfor (const constraint of constraints) {\n\t\t\t\tswitch (constraint.type) {\n\t\t\t\t\tcase \"nodeInDocument\": {\n\t\t\t\t\t\tconst node = getOrCreateInnerNode(constraint.node);\n\t\t\t\t\t\tconst nodeStatus = getKernel(constraint.node).getStatus();\n\t\t\t\t\t\tif (nodeStatus !== TreeStatus.InDocument) {\n\t\t\t\t\t\t\tconst revertText = constraintsOnRevert ? \" on revert\" : \"\";\n\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t`Attempted to add a \"nodeInDocument\" constraint${revertText}, but the node is not currently in the document. Node status: ${nodeStatus}`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (constraintsOnRevert) {\n\t\t\t\t\t\t\tthis.checkout.editor.addNodeExistsConstraintOnRevert(node.anchorNode);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.checkout.editor.addNodeExistsConstraint(node.anchorNode);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunreachableCase(constraint.type);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tthis.checkout.transaction.start();\n\n\t\t// Validate preconditions before running the transaction callback.\n\t\taddConstraints(false /* constraintsOnRevert */, params?.preconditions);\n\t\tconst transactionCallbackStatus = transaction();\n\t\tconst rollback = transactionCallbackStatus?.rollback;\n\t\tconst value = (\n\t\t\ttransactionCallbackStatus as TransactionCallbackStatus<TSuccessValue, TFailureValue>\n\t\t)?.value;\n\n\t\tif (rollback === true) {\n\t\t\tthis.checkout.transaction.abort();\n\t\t\treturn value !== undefined\n\t\t\t\t? { success: false, value: value as TFailureValue }\n\t\t\t\t: { success: false };\n\t\t}\n\n\t\t// Validate preconditions on revert after running the transaction callback and was successful.\n\t\taddConstraints(\n\t\t\ttrue /* constraintsOnRevert */,\n\t\t\ttransactionCallbackStatus?.preconditionsOnRevert,\n\t\t);\n\n\t\tthis.checkout.transaction.commit();\n\t\treturn value !== undefined\n\t\t\t? { success: true, value: value as TSuccessValue }\n\t\t\t: { success: true };\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 compatibility = comparePersistedSchemaInternal(\n\t\t\tthis.checkout.storedSchema,\n\t\t\tthis.viewSchema,\n\t\t\tcanInitialize(this.checkout),\n\t\t);\n\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\tconst 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\tthis.schemaPolicy,\n\t\t\t);\n\t\t\tthis.view = view;\n\t\t\tassert(\n\t\t\t\t!this.checkout.forest.anchors.slots.has(SimpleContextSlot),\n\t\t\t\t0xa47 /* extra simple tree context */,\n\t\t\t);\n\t\t\tthis.checkout.forest.anchors.slots.set(\n\t\t\t\tSimpleContextSlot,\n\t\t\t\tnew HydratedContext(this.rootFieldSchema.allowedTypeSet, view.context),\n\t\t\t);\n\n\t\t\tconst unregister = this.checkout.storedSchema.events.on(\"afterSchemaChange\", () => {\n\t\t\t\tunregister();\n\t\t\t\tthis.unregisterCallbacks.delete(unregister);\n\t\t\t\tview[disposeSymbol]();\n\t\t\t});\n\t\t\tthis.unregisterCallbacks.add(unregister);\n\t\t} else {\n\t\t\tthis.view = undefined;\n\t\t\tthis.checkout.forest.anchors.slots.delete(SimpleContextSlot);\n\n\t\t\tconst unregister = this.checkout.storedSchema.events.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.checkout.forest.anchors.slots.delete(SimpleContextSlot);\n\t\t\tthis.unregisterCallbacks.forEach((unregister) => unregister());\n\t\t}\n\t\tthis.checkout.forest.anchors.slots.delete(SimpleContextSlot);\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.checkout.forest.anchors.slots.delete(ViewSlot);\n\t\tthis.currentCompatibility = undefined;\n\t\tthis.onDispose?.();\n\t\tif (this.checkout.isBranch && !this.checkout.disposed) {\n\t\t\t// All (non-main) branches are 1:1 with views, so if a user manually disposes a view, we should also dispose the checkout/branch.\n\t\t\tthis.checkout.dispose();\n\t\t}\n\t}\n\n\tpublic get root(): ReadableField<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 ReadableField<TRootSchema>;\n\t}\n\n\tpublic set root(newRoot: InsertableField<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(\n\t\t\tview.context.root,\n\t\t\tthis.rootFieldSchema,\n\t\t\tnewRoot as InsertableContent | undefined,\n\t\t);\n\t}\n\n\t// #region Branching\n\n\tpublic fork(): ReturnType<TreeBranch[\"fork\"]> & SchematizingSimpleTreeView<TRootSchema> {\n\t\treturn this.checkout.branch().viewWith(this.config);\n\t}\n\n\tpublic merge(context: TreeBranch, disposeMerged = true): void {\n\t\tthis.checkout.merge(getCheckout(context), disposeMerged);\n\t}\n\n\tpublic rebaseOnto(context: TreeBranch): void {\n\t\tgetCheckout(context).rebase(this.checkout);\n\t}\n\n\t// #endregion Branching\n}\n\n/**\n * Get the {@link TreeCheckout} associated with a given {@link TreeBranch}.\n * @remarks Currently, all contexts are also {@link SchematizingSimpleTreeView}s.\n * Other checkout implementations (e.g. not associated with a view) may be supported in the future.\n */\nexport function getCheckout(context: TreeBranch): TreeCheckout {\n\tif (context instanceof SchematizingSimpleTreeView) {\n\t\treturn context.checkout;\n\t}\n\tthrow new UsageError(\"Unsupported context implementation\");\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(\n\tcheckout: ITreeCheckout,\n\tviewSchema: ViewSchema,\n\tonDispose: () => void,\n\tnodeKeyManager: NodeKeyManager,\n\tschemaPolicy: FullSchemaPolicy,\n): CheckoutFlexTreeView {\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(compatibility.canView, 0x8c3 /* requireSchema invoked with incompatible schema */);\n\t}\n\n\tconst view = new CheckoutFlexTreeView(checkout, schemaPolicy, nodeKeyManager, onDispose);\n\tassert(slots.has(ContextSlot), 0x90d /* Context should be tracked in slot */);\n\n\treturn view;\n}\n"]}
1
+ {"version":3,"file":"schematizingTreeView.js","sourceRoot":"","sources":["../../src/shared-tree/schematizingTreeView.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOH,+DAA6D;AAC7D,kEAA8E;AAC9E,uEAAsE;AAEtE,+CAAoF;AACpF,4DAOuC;AACvC,sDAmCiC;AACjC,+CAK0B;AAE1B,2DAA8E;AAE9E,uEAAiE;AAEjE;;;GAGG;AACU,QAAA,QAAQ,GAAG,IAAA,qBAAU,GAAiC,CAAC;AAEpE;;GAEG;IAEU,0BAA0B;4BADtC,wBAAa;;;;;QAqCb,YACiB,QAAsB,EACtB,MAAsD,EACtD,cAAqC,EACpC,SAAsB;YAHvB,aAAQ,GAAR,QAAQ,CAAc;YACtB,WAAM,GAAN,MAAM,CAAgD;YACtD,mBAAc,GAAd,cAAc,CAAuB;YACp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kCAKC;AAED;;;GAGG;AACH,SAAgB,aAAa,CAC5B,QAAuB,EACvB,UAAsB,EACtB,SAAqB,EACrB,cAAqC,EACrC,YAA8B;IAE9B,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;IAC5C,IAAA,iBAAM,EAAC,CAAC,KAAK,CAAC,GAAG,CAAC,sBAAW,CAAC,EAAE,KAAK,CAAC,6CAA6C,CAAC,CAAC;IAErF,CAAC;QACA,MAAM,aAAa,GAAG,UAAU,CAAC,kBAAkB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QAC3E,IAAA,iBAAM,EAAC,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,oDAAoD,CAAC,CAAC;IAC3F,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,8CAAoB,CAAC,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;IACzF,IAAA,iBAAM,EAAC,KAAK,CAAC,GAAG,CAAC,sBAAW,CAAC,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAE9E,OAAO,IAAI,CAAC;AACb,CAAC;AAnBD,sCAmBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tHasListeners,\n\tIEmitter,\n\tListenable,\n} from \"@fluidframework/core-interfaces/internal\";\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { AllowedUpdateType, anchorSlot, type SchemaPolicy } from \"../core/index.js\";\nimport {\n\ttype NodeIdentifierManager,\n\tdefaultSchemaPolicy,\n\tContextSlot,\n\tcursorForMapTreeNode,\n\ttype FullSchemaPolicy,\n\tTreeStatus,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype FieldSchema,\n\ttype ImplicitFieldSchema,\n\ttype SchemaCompatibilityStatus,\n\ttype TreeView,\n\ttype TreeViewEvents,\n\tgetTreeNodeForField,\n\tsetField,\n\tnormalizeFieldSchema,\n\tViewSchema,\n\ttype InsertableContent,\n\ttype TreeViewConfiguration,\n\tmapTreeFromNodeData,\n\tprepareContentForHydration,\n\tcomparePersistedSchemaInternal,\n\ttoStoredSchema,\n\ttype TreeViewAlpha,\n\ttype InsertableField,\n\ttype ReadableField,\n\ttype ReadSchema,\n\ttype UnsafeUnknownSchema,\n\ttype TreeBranch,\n\ttype TreeBranchEvents,\n\tgetOrCreateInnerNode,\n\tgetKernel,\n\ttype VoidTransactionCallbackStatus,\n\ttype TransactionCallbackStatus,\n\ttype TransactionResult,\n\ttype TransactionResultExt,\n\ttype RunTransactionParams,\n\ttype TransactionConstraint,\n\tHydratedContext,\n\tSimpleContextSlot,\n\tareImplicitFieldSchemaEqual,\n\tcreateUnknownOptionalFieldPolicy,\n} from \"../simple-tree/index.js\";\nimport {\n\ttype Breakable,\n\tbreakingClass,\n\tdisposeSymbol,\n\ttype WithBreakable,\n} from \"../util/index.js\";\n\nimport { canInitialize, ensureSchema, initialize } from \"./schematizeTree.js\";\nimport type { ITreeCheckout, TreeCheckout } from \"./treeCheckout.js\";\nimport { CheckoutFlexTreeView } from \"./checkoutFlexTreeView.js\";\n\n/**\n * Creating multiple tree views from the same checkout is not supported. This slot is used to detect if one already\n * exists and error if creating a second.\n */\nexport const ViewSlot = anchorSlot<TreeView<ImplicitFieldSchema>>();\n\n/**\n * Implementation of TreeView wrapping a FlexTreeView.\n */\n@breakingClass\nexport class SchematizingSimpleTreeView<\n\tin out TRootSchema extends ImplicitFieldSchema | UnsafeUnknownSchema,\n> implements TreeBranch, TreeViewAlpha<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 | undefined;\n\n\t/**\n\t * Undefined iff uninitialized or disposed.\n\t */\n\tprivate currentCompatibility: SchemaCompatibilityStatus | undefined;\n\tprivate readonly schemaPolicy: SchemaPolicy;\n\tpublic readonly events: Listenable<TreeViewEvents & TreeBranchEvents> &\n\t\tIEmitter<TreeViewEvents & TreeBranchEvents> &\n\t\tHasListeners<TreeViewEvents & TreeBranchEvents> = 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\tpublic readonly breaker: Breakable;\n\n\tpublic constructor(\n\t\tpublic readonly checkout: TreeCheckout,\n\t\tpublic readonly config: TreeViewConfiguration<ReadSchema<TRootSchema>>,\n\t\tpublic readonly nodeKeyManager: NodeIdentifierManager,\n\t\tprivate readonly onDispose?: () => void,\n\t) {\n\t\tthis.breaker = checkout.breaker;\n\t\tif (checkout.forest.anchors.slots.has(ViewSlot)) {\n\t\t\tthrow new UsageError(\"Cannot create a second tree view from the same checkout\");\n\t\t}\n\t\tcheckout.forest.anchors.slots.set(ViewSlot, this);\n\n\t\tthis.rootFieldSchema = normalizeFieldSchema(config.schema);\n\t\tthis.schemaPolicy = {\n\t\t\t...defaultSchemaPolicy,\n\t\t\tvalidateSchema: config.enableSchemaValidation,\n\t\t\tallowUnknownOptionalFields: createUnknownOptionalFieldPolicy(this.rootFieldSchema),\n\t\t};\n\n\t\tthis.viewSchema = new ViewSchema(this.schemaPolicy, {}, this.rootFieldSchema);\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(\"changed\", (data, getRevertible) => {\n\t\t\t\tthis.events.emit(\"changed\", data, getRevertible);\n\t\t\t\tthis.events.emit(\"commitApplied\", data, getRevertible);\n\t\t\t}),\n\t\t);\n\t}\n\n\tpublic hasRootSchema<TSchema extends ImplicitFieldSchema>(\n\t\tschema: TSchema,\n\t): this is TreeViewAlpha<TSchema> {\n\t\treturn areImplicitFieldSchemaEqual(this.rootFieldSchema, schema);\n\t}\n\n\tpublic get schema(): ReadSchema<TRootSchema> {\n\t\treturn this.config.schema;\n\t}\n\n\tpublic initialize(content: InsertableField<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 | undefined,\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: this.schemaPolicy,\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: toStoredSchema(this.viewSchema.schema),\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: toStoredSchema(this.viewSchema.schema),\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 {\n\t\tthis.ensureUndisposed();\n\t\tassert(this.view !== undefined, 0x8c0 /* unexpected getViewOrError */);\n\t\treturn this.view;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-tree#TreeViewAlpha.runTransaction}\n\t */\n\tpublic runTransaction<TSuccessValue, TFailureValue>(\n\t\ttransaction: () => TransactionCallbackStatus<TSuccessValue, TFailureValue>,\n\t\tparams?: RunTransactionParams,\n\t): TransactionResultExt<TSuccessValue, TFailureValue>;\n\t/**\n\t * {@inheritDoc @fluidframework/shared-tree#TreeViewAlpha.runTransaction}\n\t */\n\tpublic runTransaction(\n\t\ttransaction: () => VoidTransactionCallbackStatus | void,\n\t\tparams?: RunTransactionParams,\n\t): TransactionResult;\n\tpublic runTransaction<TSuccessValue, TFailureValue>(\n\t\ttransaction: () =>\n\t\t\t| TransactionCallbackStatus<TSuccessValue, TFailureValue>\n\t\t\t| VoidTransactionCallbackStatus\n\t\t\t| void,\n\t\tparams?: RunTransactionParams,\n\t): TransactionResultExt<TSuccessValue, TFailureValue> | TransactionResult {\n\t\tconst addConstraints = (\n\t\t\tconstraintsOnRevert: boolean,\n\t\t\tconstraints: readonly TransactionConstraint[] = [],\n\t\t): void => {\n\t\t\tfor (const constraint of constraints) {\n\t\t\t\tswitch (constraint.type) {\n\t\t\t\t\tcase \"nodeInDocument\": {\n\t\t\t\t\t\tconst node = getOrCreateInnerNode(constraint.node);\n\t\t\t\t\t\tconst nodeStatus = getKernel(constraint.node).getStatus();\n\t\t\t\t\t\tif (nodeStatus !== TreeStatus.InDocument) {\n\t\t\t\t\t\t\tconst revertText = constraintsOnRevert ? \" on revert\" : \"\";\n\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t`Attempted to add a \"nodeInDocument\" constraint${revertText}, but the node is not currently in the document. Node status: ${nodeStatus}`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (constraintsOnRevert) {\n\t\t\t\t\t\t\tthis.checkout.editor.addNodeExistsConstraintOnRevert(node.anchorNode);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.checkout.editor.addNodeExistsConstraint(node.anchorNode);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tunreachableCase(constraint.type);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tthis.checkout.transaction.start();\n\n\t\t// Validate preconditions before running the transaction callback.\n\t\taddConstraints(false /* constraintsOnRevert */, params?.preconditions);\n\t\tconst transactionCallbackStatus = transaction();\n\t\tconst rollback = transactionCallbackStatus?.rollback;\n\t\tconst value = (\n\t\t\ttransactionCallbackStatus as TransactionCallbackStatus<TSuccessValue, TFailureValue>\n\t\t)?.value;\n\n\t\tif (rollback === true) {\n\t\t\tthis.checkout.transaction.abort();\n\t\t\treturn value !== undefined\n\t\t\t\t? { success: false, value: value as TFailureValue }\n\t\t\t\t: { success: false };\n\t\t}\n\n\t\t// Validate preconditions on revert after running the transaction callback and was successful.\n\t\taddConstraints(\n\t\t\ttrue /* constraintsOnRevert */,\n\t\t\ttransactionCallbackStatus?.preconditionsOnRevert,\n\t\t);\n\n\t\tthis.checkout.transaction.commit();\n\t\treturn value !== undefined\n\t\t\t? { success: true, value: value as TSuccessValue }\n\t\t\t: { success: true };\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 compatibility = comparePersistedSchemaInternal(\n\t\t\tthis.checkout.storedSchema,\n\t\t\tthis.viewSchema,\n\t\t\tcanInitialize(this.checkout),\n\t\t);\n\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\tconst 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\tthis.schemaPolicy,\n\t\t\t);\n\t\t\tthis.view = view;\n\t\t\tassert(\n\t\t\t\t!this.checkout.forest.anchors.slots.has(SimpleContextSlot),\n\t\t\t\t0xa47 /* extra simple tree context */,\n\t\t\t);\n\t\t\tthis.checkout.forest.anchors.slots.set(\n\t\t\t\tSimpleContextSlot,\n\t\t\t\tnew HydratedContext(this.rootFieldSchema.allowedTypeSet, view.context),\n\t\t\t);\n\n\t\t\tconst unregister = this.checkout.storedSchema.events.on(\"afterSchemaChange\", () => {\n\t\t\t\tunregister();\n\t\t\t\tthis.unregisterCallbacks.delete(unregister);\n\t\t\t\tview[disposeSymbol]();\n\t\t\t});\n\t\t\tthis.unregisterCallbacks.add(unregister);\n\t\t} else {\n\t\t\tthis.view = undefined;\n\t\t\tthis.checkout.forest.anchors.slots.delete(SimpleContextSlot);\n\n\t\t\tconst unregister = this.checkout.storedSchema.events.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.checkout.forest.anchors.slots.delete(SimpleContextSlot);\n\t\t\tthis.unregisterCallbacks.forEach((unregister) => unregister());\n\t\t}\n\t\tthis.checkout.forest.anchors.slots.delete(SimpleContextSlot);\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.checkout.forest.anchors.slots.delete(ViewSlot);\n\t\tthis.currentCompatibility = undefined;\n\t\tthis.onDispose?.();\n\t\tif (this.checkout.isBranch && !this.checkout.disposed) {\n\t\t\t// All (non-main) branches are 1:1 with views, so if a user manually disposes a view, we should also dispose the checkout/branch.\n\t\t\tthis.checkout.dispose();\n\t\t}\n\t}\n\n\tpublic get root(): ReadableField<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 ReadableField<TRootSchema>;\n\t}\n\n\tpublic set root(newRoot: InsertableField<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(\n\t\t\tview.context.root,\n\t\t\tthis.rootFieldSchema,\n\t\t\tnewRoot as InsertableContent | undefined,\n\t\t);\n\t}\n\n\t// #region Branching\n\n\tpublic fork(): ReturnType<TreeBranch[\"fork\"]> & SchematizingSimpleTreeView<TRootSchema> {\n\t\treturn this.checkout.branch().viewWith(this.config);\n\t}\n\n\tpublic merge(context: TreeBranch, disposeMerged = true): void {\n\t\tthis.checkout.merge(getCheckout(context), disposeMerged);\n\t}\n\n\tpublic rebaseOnto(context: TreeBranch): void {\n\t\tgetCheckout(context).rebase(this.checkout);\n\t}\n\n\t// #endregion Branching\n}\n\n/**\n * Get the {@link TreeCheckout} associated with a given {@link TreeBranch}.\n * @remarks Currently, all contexts are also {@link SchematizingSimpleTreeView}s.\n * Other checkout implementations (e.g. not associated with a view) may be supported in the future.\n */\nexport function getCheckout(context: TreeBranch): TreeCheckout {\n\tif (context instanceof SchematizingSimpleTreeView) {\n\t\treturn context.checkout;\n\t}\n\tthrow new UsageError(\"Unsupported context implementation\");\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(\n\tcheckout: ITreeCheckout,\n\tviewSchema: ViewSchema,\n\tonDispose: () => void,\n\tnodeKeyManager: NodeIdentifierManager,\n\tschemaPolicy: FullSchemaPolicy,\n): CheckoutFlexTreeView {\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(compatibility.canView, 0x8c3 /* requireSchema invoked with incompatible schema */);\n\t}\n\n\tconst view = new CheckoutFlexTreeView(checkout, schemaPolicy, nodeKeyManager, onDispose);\n\tassert(slots.has(ContextSlot), 0x90d /* Context should be tracked in slot */);\n\n\treturn view;\n}\n"]}
@@ -116,6 +116,7 @@ declare class SharedTreeKernel extends SharedTreeCore<SharedTreeEditBuilder, Sha
116
116
  protected submitCommit(commit: GraphCommit<SharedTreeChange>, schemaAndPolicy: ClonableSchemaAndPolicy, isResubmit: boolean): void;
117
117
  onDisconnect(): void;
118
118
  }
119
+ export declare function exportSimpleSchema(storedSchema: TreeStoredSchema): SimpleTreeSchema;
119
120
  /**
120
121
  * Get a {@link BranchableTree} from a {@link ITree}.
121
122
  * @remarks The branch can be used for "version control"-style coordination of edits on the tree.
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTree.d.ts","sourceRoot":"","sources":["../../src/shared-tree/sharedTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACX,UAAU,EAEV,cAAc,EACd,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EACX,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACN,YAAY,EACZ,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAEN,KAAK,mBAAmB,EACxB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EACX,iBAAiB,EACjB,sCAAsC,EACtC,qBAAqB,EACrB,yBAAyB,EACzB,MAAM,8CAA8C,CAAC;AACtD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAE7F,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,mBAAmB,CAAC;AACtE,OAAO,EACN,KAAK,WAAW,EAChB,KAAK,eAAe,EAEpB,KAAK,YAAY,EASjB,KAAK,gBAAgB,EACrB,0BAA0B,EAC1B,KAAK,4BAA4B,EAGjC,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAKN,uBAAuB,EAQvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,KAAK,uBAAuB,EAG5B,cAAc,EACd,MAAM,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G;AACH,eAAO,MAAM,mBAAmB,YAG/B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,YAAmD,CAAC;AAWzF;;GAEG;AACH,wBAAgB,qBAAqB,CACpC,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,4BAA4B,EACpC,YAAY,EAAE,aAAa,GACzB,eAAe,CAEjB;AAED,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,yBAAyB,CAMxE,CAAC"}
@@ -42,7 +42,7 @@ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, p
42
42
  return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
43
43
  };
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.defaultSharedTreeOptions = exports.buildConfiguredForest = exports.ForestTypeExpensiveDebug = exports.ForestTypeOptimized = exports.ForestTypeReference = exports.SharedTreeFormatVersion = exports.getBranch = exports.SharedTree = void 0;
45
+ exports.defaultSharedTreeOptions = exports.buildConfiguredForest = exports.ForestTypeExpensiveDebug = exports.ForestTypeOptimized = exports.ForestTypeReference = exports.SharedTreeFormatVersion = exports.getBranch = exports.exportSimpleSchema = exports.SharedTree = void 0;
46
46
  const internal_1 = require("@fluidframework/core-utils/internal");
47
47
  const internal_2 = require("@fluidframework/shared-object-base/internal");
48
48
  const internal_3 = require("@fluidframework/telemetry-utils/internal");
@@ -242,7 +242,7 @@ let SharedTreeKernel = (() => {
242
242
  return verboseFromCursor(cursor, this.storedSchema.nodeSchema);
243
243
  }
244
244
  else {
245
- (0, index_js_6.fail)(0xac8 /* Invalid document root length */);
245
+ (0, internal_1.fail)(0xac8 /* Invalid document root length */);
246
246
  }
247
247
  }
248
248
  finally {
@@ -250,12 +250,7 @@ let SharedTreeKernel = (() => {
250
250
  }
251
251
  }
252
252
  exportSimpleSchema() {
253
- return {
254
- ...exportSimpleFieldSchemaStored(this.storedSchema.rootFieldSchema),
255
- definitions: new Map([...this.storedSchema.nodeSchema].map(([key, schema]) => {
256
- return [key, exportSimpleNodeSchemaStored(schema)];
257
- })),
258
- };
253
+ return exportSimpleSchema(this.storedSchema);
259
254
  }
260
255
  contentSnapshot() {
261
256
  const cursor = this.checkout.forest.allocateCursor("contentSnapshot");
@@ -314,6 +309,15 @@ let SharedTreeKernel = (() => {
314
309
  })();
315
310
  return SharedTreeKernel = _classThis;
316
311
  })();
312
+ function exportSimpleSchema(storedSchema) {
313
+ return {
314
+ ...exportSimpleFieldSchemaStored(storedSchema.rootFieldSchema),
315
+ definitions: new Map([...storedSchema.nodeSchema].map(([key, schema]) => {
316
+ return [key, exportSimpleNodeSchemaStored(schema)];
317
+ })),
318
+ };
319
+ }
320
+ exports.exportSimpleSchema = exportSimpleSchema;
317
321
  function getBranch(treeOrView) {
318
322
  if (treeOrView instanceof schematizingTreeView_js_1.SchematizingSimpleTreeView) {
319
323
  return treeOrView.checkout;
@@ -395,7 +399,7 @@ exports.defaultSharedTreeOptions = {
395
399
  };
396
400
  function verboseFromCursor(reader, schema) {
397
401
  const fields = (0, index_js_5.customFromCursorStored)(reader, schema, verboseFromCursor);
398
- const nodeSchema = schema.get(reader.type) ?? (0, index_js_6.fail)(0xac9 /* missing schema for type in cursor */);
402
+ const nodeSchema = schema.get(reader.type) ?? (0, internal_1.fail)(0xac9 /* missing schema for type in cursor */);
399
403
  if (nodeSchema instanceof index_js_2.LeafNodeStoredSchema) {
400
404
  return fields;
401
405
  }
@@ -421,29 +425,33 @@ function exportSimpleFieldSchemaStored(schema) {
421
425
  (0, internal_1.assert)(schema.types.size === 0, 0xa94 /* invalid forbidden field */);
422
426
  break;
423
427
  default:
424
- (0, index_js_6.fail)(0xaca /* invalid field kind */);
428
+ (0, internal_1.fail)(0xaca /* invalid field kind */);
425
429
  }
426
- return { kind, allowedTypes: schema.types };
430
+ return { kind, allowedTypesIdentifiers: schema.types, metadata: {} };
427
431
  }
428
432
  function exportSimpleNodeSchemaStored(schema) {
429
433
  const arrayTypes = (0, index_js_5.tryStoredSchemaAsArray)(schema);
430
434
  if (arrayTypes !== undefined) {
431
- return { kind: index_js_5.NodeKind.Array, allowedTypes: arrayTypes };
435
+ return { kind: index_js_5.NodeKind.Array, allowedTypesIdentifiers: arrayTypes, metadata: {} };
432
436
  }
433
437
  if (schema instanceof index_js_2.ObjectNodeStoredSchema) {
434
- const fields = {};
435
- for (const [key, field] of schema.objectNodeFields) {
436
- fields[key] = exportSimpleFieldSchemaStored(field);
438
+ const fields = new Map();
439
+ for (const [storedKey, field] of schema.objectNodeFields) {
440
+ fields.set(storedKey, { ...exportSimpleFieldSchemaStored(field), storedKey });
437
441
  }
438
- return { kind: index_js_5.NodeKind.Object, fields };
442
+ return { kind: index_js_5.NodeKind.Object, fields, metadata: {} };
439
443
  }
440
444
  if (schema instanceof index_js_2.MapNodeStoredSchema) {
441
445
  (0, internal_1.assert)(schema.mapFields.kind === index_js_3.FieldKinds.optional.identifier, 0xa95 /* Invalid map schema */);
442
- return { kind: index_js_5.NodeKind.Map, allowedTypes: schema.mapFields.types };
446
+ return {
447
+ kind: index_js_5.NodeKind.Map,
448
+ allowedTypesIdentifiers: schema.mapFields.types,
449
+ metadata: {},
450
+ };
443
451
  }
444
452
  if (schema instanceof index_js_2.LeafNodeStoredSchema) {
445
- return { kind: index_js_5.NodeKind.Leaf, leafKind: schema.leafValue };
453
+ return { kind: index_js_5.NodeKind.Leaf, leafKind: schema.leafValue, metadata: {} };
446
454
  }
447
- (0, index_js_6.fail)(0xacb /* invalid schema kind */);
455
+ (0, internal_1.fail)(0xacb /* invalid schema kind */);
448
456
  }
449
457
  //# sourceMappingURL=sharedTree.js.map