@fluidframework/tree 2.0.0-dev-rc.5.0.0.271262 → 2.0.0-dev-rc.5.0.0.271717

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 (396) hide show
  1. package/api-report/tree.alpha.api.md +2 -13
  2. package/api-report/tree.beta.api.md +2 -13
  3. package/api-report/tree.public.api.md +2 -13
  4. package/dist/beta.d.ts +0 -1
  5. package/dist/codec/codec.js +0 -1
  6. package/dist/codec/codec.js.map +1 -1
  7. package/dist/codec/discriminatedUnions.js +0 -1
  8. package/dist/codec/discriminatedUnions.js.map +1 -1
  9. package/dist/core/change-family/editBuilder.js +0 -2
  10. package/dist/core/change-family/editBuilder.js.map +1 -1
  11. package/dist/core/rebase/revisionTagCodec.js +0 -2
  12. package/dist/core/rebase/revisionTagCodec.js.map +1 -1
  13. package/dist/core/schema-stored/schema.js +0 -4
  14. package/dist/core/schema-stored/schema.js.map +1 -1
  15. package/dist/core/schema-stored/storedSchemaRepository.js +1 -3
  16. package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
  17. package/dist/core/schema-view/view.js +0 -2
  18. package/dist/core/schema-view/view.js.map +1 -1
  19. package/dist/core/tree/anchorSet.js +46 -51
  20. package/dist/core/tree/anchorSet.js.map +1 -1
  21. package/dist/core/tree/detachedFieldIndex.js +2 -8
  22. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  23. package/dist/core/tree/detachedFieldIndexCodec.js +0 -3
  24. package/dist/core/tree/detachedFieldIndexCodec.js.map +1 -1
  25. package/dist/core/tree/sparseTree.js +11 -15
  26. package/dist/core/tree/sparseTree.js.map +1 -1
  27. package/dist/domains/schemaBuilder.js +70 -70
  28. package/dist/domains/schemaBuilder.js.map +1 -1
  29. package/dist/events/events.js +1 -2
  30. package/dist/events/events.js.map +1 -1
  31. package/dist/feature-libraries/chunked-forest/basicChunk.js +1 -14
  32. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  33. package/dist/feature-libraries/chunked-forest/chunkTree.js +6 -13
  34. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  35. package/dist/feature-libraries/chunked-forest/chunkedForest.js +2 -9
  36. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  37. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +3 -1
  38. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  39. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +13 -3
  40. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  41. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +6 -11
  42. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  43. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +3 -3
  44. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  45. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js +2 -5
  46. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  47. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +0 -1
  48. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  49. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +2 -1
  50. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  51. package/dist/feature-libraries/chunked-forest/codec/codecs.js +4 -1
  52. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  53. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +13 -25
  54. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  55. package/dist/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
  56. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js +5 -8
  57. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  58. package/dist/feature-libraries/chunked-forest/sequenceChunk.js +0 -1
  59. package/dist/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
  60. package/dist/feature-libraries/chunked-forest/uniformChunk.js +5 -40
  61. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  62. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +0 -2
  63. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  64. package/dist/feature-libraries/detachedFieldIndexSummarizer.js +1 -2
  65. package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  66. package/dist/feature-libraries/editableTreeBinder.js +12 -13
  67. package/dist/feature-libraries/editableTreeBinder.js.map +1 -1
  68. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js +11 -12
  69. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  70. package/dist/feature-libraries/flex-tree/context.js +3 -7
  71. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  72. package/dist/feature-libraries/flex-tree/lazyEntity.js +22 -13
  73. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  74. package/dist/feature-libraries/flex-tree/lazyField.js +0 -6
  75. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  76. package/dist/feature-libraries/flex-tree/lazyNode.js +17 -10
  77. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  78. package/dist/feature-libraries/forest-summary/forestSummarizer.js +1 -6
  79. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  80. package/dist/feature-libraries/modular-schema/fieldKind.js +0 -2
  81. package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  82. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js +0 -3
  83. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js.map +1 -1
  84. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +2 -0
  85. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  86. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +2 -5
  87. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  88. package/dist/feature-libraries/node-key/mockNodeKeyManager.js +4 -2
  89. package/dist/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
  90. package/dist/feature-libraries/node-key/nodeKeyIndex.js +0 -3
  91. package/dist/feature-libraries/node-key/nodeKeyIndex.js.map +1 -1
  92. package/dist/feature-libraries/object-forest/objectForest.js +28 -23
  93. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  94. package/dist/feature-libraries/optional-field/optionalField.js +3 -1
  95. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  96. package/dist/feature-libraries/schema-index/schemaSummarizer.js +1 -5
  97. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  98. package/dist/feature-libraries/schemaBuilderBase.js +3 -14
  99. package/dist/feature-libraries/schemaBuilderBase.js.map +1 -1
  100. package/dist/feature-libraries/sequence-field/compose.js +0 -6
  101. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  102. package/dist/feature-libraries/sequence-field/markListFactory.js +4 -3
  103. package/dist/feature-libraries/sequence-field/markListFactory.js.map +1 -1
  104. package/dist/feature-libraries/sequence-field/markQueue.js +2 -4
  105. package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
  106. package/dist/feature-libraries/sequence-field/rebase.js +0 -6
  107. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  108. package/dist/feature-libraries/treeCursorUtils.js +9 -13
  109. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  110. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +4 -23
  111. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  112. package/dist/feature-libraries/typed-schema/view.js +0 -7
  113. package/dist/feature-libraries/typed-schema/view.js.map +1 -1
  114. package/dist/index.d.ts +1 -1
  115. package/dist/index.d.ts.map +1 -1
  116. package/dist/index.js +1 -2
  117. package/dist/index.js.map +1 -1
  118. package/dist/packageVersion.d.ts +1 -1
  119. package/dist/packageVersion.js +1 -1
  120. package/dist/packageVersion.js.map +1 -1
  121. package/dist/public.d.ts +0 -1
  122. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  123. package/dist/shared-tree/schematizingTreeView.js +10 -27
  124. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  125. package/dist/shared-tree/sharedTree.d.ts +4 -0
  126. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  127. package/dist/shared-tree/sharedTree.js +13 -10
  128. package/dist/shared-tree/sharedTree.js.map +1 -1
  129. package/dist/shared-tree/sharedTreeChangeEnricher.js +11 -14
  130. package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  131. package/dist/shared-tree/sharedTreeChangeFamily.js +3 -5
  132. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  133. package/dist/shared-tree/sharedTreeEditBuilder.js +0 -2
  134. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  135. package/dist/shared-tree/treeCheckout.js +11 -22
  136. package/dist/shared-tree/treeCheckout.js.map +1 -1
  137. package/dist/shared-tree/treeView.js +0 -6
  138. package/dist/shared-tree/treeView.js.map +1 -1
  139. package/dist/shared-tree-core/branch.js +25 -31
  140. package/dist/shared-tree-core/branch.js.map +1 -1
  141. package/dist/shared-tree-core/branchCommitEnricher.js +9 -12
  142. package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
  143. package/dist/shared-tree-core/defaultResubmitMachine.js +19 -21
  144. package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  145. package/dist/shared-tree-core/editManager.js +37 -53
  146. package/dist/shared-tree-core/editManager.js.map +1 -1
  147. package/dist/shared-tree-core/editManagerSummarizer.js +1 -5
  148. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  149. package/dist/shared-tree-core/sharedTreeCore.js +7 -24
  150. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  151. package/dist/shared-tree-core/transactionEnricher.js +1 -3
  152. package/dist/shared-tree-core/transactionEnricher.js.map +1 -1
  153. package/dist/shared-tree-core/transactionStack.js +3 -1
  154. package/dist/shared-tree-core/transactionStack.js.map +1 -1
  155. package/dist/simple-tree/arrayNode.js +34 -26
  156. package/dist/simple-tree/arrayNode.js.map +1 -1
  157. package/dist/simple-tree/leafNodeSchema.js +2 -4
  158. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  159. package/dist/simple-tree/mapNode.js +5 -5
  160. package/dist/simple-tree/mapNode.js.map +1 -1
  161. package/dist/simple-tree/objectNode.js +6 -6
  162. package/dist/simple-tree/objectNode.js.map +1 -1
  163. package/dist/simple-tree/schemaFactory.d.ts +18 -5
  164. package/dist/simple-tree/schemaFactory.d.ts.map +1 -1
  165. package/dist/simple-tree/schemaFactory.js +65 -53
  166. package/dist/simple-tree/schemaFactory.js.map +1 -1
  167. package/dist/simple-tree/schemaTypes.js +3 -12
  168. package/dist/simple-tree/schemaTypes.js.map +1 -1
  169. package/dist/simple-tree/tree.d.ts +1 -22
  170. package/dist/simple-tree/tree.d.ts.map +1 -1
  171. package/dist/simple-tree/tree.js +0 -21
  172. package/dist/simple-tree/tree.js.map +1 -1
  173. package/dist/simple-tree/treeNodeApi.d.ts +13 -4
  174. package/dist/simple-tree/treeNodeApi.d.ts.map +1 -1
  175. package/dist/simple-tree/treeNodeApi.js +8 -3
  176. package/dist/simple-tree/treeNodeApi.js.map +1 -1
  177. package/dist/simple-tree/types.d.ts +26 -6
  178. package/dist/simple-tree/types.d.ts.map +1 -1
  179. package/dist/simple-tree/types.js +79 -54
  180. package/dist/simple-tree/types.js.map +1 -1
  181. package/dist/treeFactory.js +10 -9
  182. package/dist/treeFactory.js.map +1 -1
  183. package/dist/util/brand.js +0 -1
  184. package/dist/util/brand.js.map +1 -1
  185. package/dist/util/nestedMap.js +4 -2
  186. package/dist/util/nestedMap.js.map +1 -1
  187. package/dist/util/offsetList.js +4 -2
  188. package/dist/util/offsetList.js.map +1 -1
  189. package/dist/util/referenceCounting.js +0 -1
  190. package/dist/util/referenceCounting.js.map +1 -1
  191. package/dist/util/stackyIterator.js +2 -3
  192. package/dist/util/stackyIterator.js.map +1 -1
  193. package/lib/beta.d.ts +0 -1
  194. package/lib/codec/codec.js +0 -1
  195. package/lib/codec/codec.js.map +1 -1
  196. package/lib/codec/discriminatedUnions.js +0 -1
  197. package/lib/codec/discriminatedUnions.js.map +1 -1
  198. package/lib/core/change-family/editBuilder.js +0 -2
  199. package/lib/core/change-family/editBuilder.js.map +1 -1
  200. package/lib/core/rebase/revisionTagCodec.js +0 -2
  201. package/lib/core/rebase/revisionTagCodec.js.map +1 -1
  202. package/lib/core/schema-stored/schema.js +0 -4
  203. package/lib/core/schema-stored/schema.js.map +1 -1
  204. package/lib/core/schema-stored/storedSchemaRepository.js +1 -3
  205. package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
  206. package/lib/core/schema-view/view.js +0 -2
  207. package/lib/core/schema-view/view.js.map +1 -1
  208. package/lib/core/tree/anchorSet.js +46 -51
  209. package/lib/core/tree/anchorSet.js.map +1 -1
  210. package/lib/core/tree/detachedFieldIndex.js +2 -8
  211. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  212. package/lib/core/tree/detachedFieldIndexCodec.js +0 -3
  213. package/lib/core/tree/detachedFieldIndexCodec.js.map +1 -1
  214. package/lib/core/tree/sparseTree.js +11 -15
  215. package/lib/core/tree/sparseTree.js.map +1 -1
  216. package/lib/domains/schemaBuilder.js +70 -70
  217. package/lib/domains/schemaBuilder.js.map +1 -1
  218. package/lib/events/events.js +1 -2
  219. package/lib/events/events.js.map +1 -1
  220. package/lib/feature-libraries/chunked-forest/basicChunk.js +1 -14
  221. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  222. package/lib/feature-libraries/chunked-forest/chunkTree.js +6 -13
  223. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  224. package/lib/feature-libraries/chunked-forest/chunkedForest.js +2 -9
  225. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  226. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +3 -1
  227. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  228. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +13 -3
  229. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  230. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +6 -11
  231. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  232. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +3 -3
  233. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  234. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js +2 -5
  235. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  236. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +0 -1
  237. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  238. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +2 -1
  239. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  240. package/lib/feature-libraries/chunked-forest/codec/codecs.js +4 -1
  241. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  242. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +13 -25
  243. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  244. package/lib/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
  245. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js +5 -8
  246. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  247. package/lib/feature-libraries/chunked-forest/sequenceChunk.js +0 -1
  248. package/lib/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
  249. package/lib/feature-libraries/chunked-forest/uniformChunk.js +5 -40
  250. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  251. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +0 -2
  252. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  253. package/lib/feature-libraries/detachedFieldIndexSummarizer.js +1 -2
  254. package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  255. package/lib/feature-libraries/editableTreeBinder.js +12 -13
  256. package/lib/feature-libraries/editableTreeBinder.js.map +1 -1
  257. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js +11 -12
  258. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  259. package/lib/feature-libraries/flex-tree/context.js +3 -7
  260. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  261. package/lib/feature-libraries/flex-tree/lazyEntity.js +22 -13
  262. package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  263. package/lib/feature-libraries/flex-tree/lazyField.js +0 -6
  264. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  265. package/lib/feature-libraries/flex-tree/lazyNode.js +17 -10
  266. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  267. package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -6
  268. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  269. package/lib/feature-libraries/modular-schema/fieldKind.js +0 -2
  270. package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  271. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js +0 -3
  272. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js.map +1 -1
  273. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +2 -0
  274. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  275. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +2 -5
  276. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  277. package/lib/feature-libraries/node-key/mockNodeKeyManager.js +4 -2
  278. package/lib/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
  279. package/lib/feature-libraries/node-key/nodeKeyIndex.js +0 -3
  280. package/lib/feature-libraries/node-key/nodeKeyIndex.js.map +1 -1
  281. package/lib/feature-libraries/object-forest/objectForest.js +28 -23
  282. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  283. package/lib/feature-libraries/optional-field/optionalField.js +3 -1
  284. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  285. package/lib/feature-libraries/schema-index/schemaSummarizer.js +1 -5
  286. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  287. package/lib/feature-libraries/schemaBuilderBase.js +3 -14
  288. package/lib/feature-libraries/schemaBuilderBase.js.map +1 -1
  289. package/lib/feature-libraries/sequence-field/compose.js +0 -6
  290. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  291. package/lib/feature-libraries/sequence-field/markListFactory.js +4 -3
  292. package/lib/feature-libraries/sequence-field/markListFactory.js.map +1 -1
  293. package/lib/feature-libraries/sequence-field/markQueue.js +2 -4
  294. package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
  295. package/lib/feature-libraries/sequence-field/rebase.js +0 -6
  296. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  297. package/lib/feature-libraries/treeCursorUtils.js +9 -13
  298. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  299. package/lib/feature-libraries/typed-schema/typedTreeSchema.js +4 -23
  300. package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  301. package/lib/feature-libraries/typed-schema/view.js +0 -7
  302. package/lib/feature-libraries/typed-schema/view.js.map +1 -1
  303. package/lib/index.d.ts +1 -1
  304. package/lib/index.d.ts.map +1 -1
  305. package/lib/index.js +1 -1
  306. package/lib/index.js.map +1 -1
  307. package/lib/packageVersion.d.ts +1 -1
  308. package/lib/packageVersion.js +1 -1
  309. package/lib/packageVersion.js.map +1 -1
  310. package/lib/public.d.ts +0 -1
  311. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  312. package/lib/shared-tree/schematizingTreeView.js +10 -27
  313. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  314. package/lib/shared-tree/sharedTree.d.ts +4 -0
  315. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  316. package/lib/shared-tree/sharedTree.js +13 -10
  317. package/lib/shared-tree/sharedTree.js.map +1 -1
  318. package/lib/shared-tree/sharedTreeChangeEnricher.js +11 -14
  319. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  320. package/lib/shared-tree/sharedTreeChangeFamily.js +3 -5
  321. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  322. package/lib/shared-tree/sharedTreeEditBuilder.js +0 -2
  323. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  324. package/lib/shared-tree/treeCheckout.js +11 -22
  325. package/lib/shared-tree/treeCheckout.js.map +1 -1
  326. package/lib/shared-tree/treeView.js +0 -6
  327. package/lib/shared-tree/treeView.js.map +1 -1
  328. package/lib/shared-tree-core/branch.js +25 -31
  329. package/lib/shared-tree-core/branch.js.map +1 -1
  330. package/lib/shared-tree-core/branchCommitEnricher.js +9 -12
  331. package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
  332. package/lib/shared-tree-core/defaultResubmitMachine.js +19 -21
  333. package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  334. package/lib/shared-tree-core/editManager.js +37 -53
  335. package/lib/shared-tree-core/editManager.js.map +1 -1
  336. package/lib/shared-tree-core/editManagerSummarizer.js +1 -5
  337. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  338. package/lib/shared-tree-core/sharedTreeCore.js +7 -24
  339. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  340. package/lib/shared-tree-core/transactionEnricher.js +1 -3
  341. package/lib/shared-tree-core/transactionEnricher.js.map +1 -1
  342. package/lib/shared-tree-core/transactionStack.js +3 -1
  343. package/lib/shared-tree-core/transactionStack.js.map +1 -1
  344. package/lib/simple-tree/arrayNode.js +34 -26
  345. package/lib/simple-tree/arrayNode.js.map +1 -1
  346. package/lib/simple-tree/leafNodeSchema.js +2 -4
  347. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  348. package/lib/simple-tree/mapNode.js +5 -5
  349. package/lib/simple-tree/mapNode.js.map +1 -1
  350. package/lib/simple-tree/objectNode.js +6 -6
  351. package/lib/simple-tree/objectNode.js.map +1 -1
  352. package/lib/simple-tree/schemaFactory.d.ts +18 -5
  353. package/lib/simple-tree/schemaFactory.d.ts.map +1 -1
  354. package/lib/simple-tree/schemaFactory.js +65 -53
  355. package/lib/simple-tree/schemaFactory.js.map +1 -1
  356. package/lib/simple-tree/schemaTypes.js +3 -12
  357. package/lib/simple-tree/schemaTypes.js.map +1 -1
  358. package/lib/simple-tree/tree.d.ts +1 -22
  359. package/lib/simple-tree/tree.d.ts.map +1 -1
  360. package/lib/simple-tree/tree.js +0 -21
  361. package/lib/simple-tree/tree.js.map +1 -1
  362. package/lib/simple-tree/treeNodeApi.d.ts +13 -4
  363. package/lib/simple-tree/treeNodeApi.d.ts.map +1 -1
  364. package/lib/simple-tree/treeNodeApi.js +8 -3
  365. package/lib/simple-tree/treeNodeApi.js.map +1 -1
  366. package/lib/simple-tree/types.d.ts +26 -6
  367. package/lib/simple-tree/types.d.ts.map +1 -1
  368. package/lib/simple-tree/types.js +78 -54
  369. package/lib/simple-tree/types.js.map +1 -1
  370. package/lib/treeFactory.js +10 -9
  371. package/lib/treeFactory.js.map +1 -1
  372. package/lib/util/brand.js +0 -1
  373. package/lib/util/brand.js.map +1 -1
  374. package/lib/util/nestedMap.js +4 -2
  375. package/lib/util/nestedMap.js.map +1 -1
  376. package/lib/util/offsetList.js +4 -2
  377. package/lib/util/offsetList.js.map +1 -1
  378. package/lib/util/referenceCounting.js +0 -1
  379. package/lib/util/referenceCounting.js.map +1 -1
  380. package/lib/util/stackyIterator.js +2 -3
  381. package/lib/util/stackyIterator.js.map +1 -1
  382. package/package.json +20 -20
  383. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +22 -6
  384. package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +2 -2
  385. package/src/feature-libraries/chunked-forest/codec/codecs.ts +6 -2
  386. package/src/feature-libraries/chunked-forest/codec/nodeShape.ts +8 -3
  387. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +2 -0
  388. package/src/index.ts +0 -1
  389. package/src/packageVersion.ts +1 -1
  390. package/src/shared-tree/schematizingTreeView.ts +0 -2
  391. package/src/shared-tree/sharedTree.ts +8 -1
  392. package/src/simple-tree/arrayNode.ts +17 -17
  393. package/src/simple-tree/schemaFactory.ts +18 -5
  394. package/src/simple-tree/tree.ts +1 -26
  395. package/src/simple-tree/treeNodeApi.ts +25 -7
  396. package/src/simple-tree/types.ts +57 -9
@@ -12,8 +12,10 @@
12
12
  * - Merges runs of offsets together
13
13
  */
14
14
  export class OffsetListFactory {
15
- offset = 0;
16
- list = [];
15
+ constructor() {
16
+ this.offset = 0;
17
+ this.list = [];
18
+ }
17
19
  push(...offsetOrContent) {
18
20
  for (const item of offsetOrContent) {
19
21
  if (typeof item === "number") {
@@ -1 +1 @@
1
- {"version":3,"file":"offsetList.js","sourceRoot":"","sources":["../../src/util/offsetList.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;;;;;;;GAQG;AACH,MAAM,OAAO,iBAAiB;IACrB,MAAM,GAAG,CAAC,CAAC;IACH,IAAI,GAAyB,EAAE,CAAC;IAEzC,IAAI,CAAC,GAAG,eAAsC;QACpD,KAAK,MAAM,IAAI,IAAI,eAAe,EAAE,CAAC;YACpC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC9B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YACvB,CAAC;iBAAM,CAAC;gBACP,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YACxB,CAAC;QACF,CAAC;IACF,CAAC;IAEM,UAAU,CAAC,MAAc;QAC/B,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC;IACvB,CAAC;IAEM,WAAW,CAAC,OAAiB;QACnC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC5B,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QACjB,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport type OffsetList<TContent = Exclude<unknown, number>, TOffset = number> = (\n\t| TOffset\n\t| TContent\n)[];\n\n/**\n * Helper class for constructing an offset list that...\n *\n * - Does not insert offsets if there is no content after them\n *\n * - Does not insert 0-sized offsets\n *\n * - Merges runs of offsets together\n */\nexport class OffsetListFactory<TContent> {\n\tprivate offset = 0;\n\tpublic readonly list: OffsetList<TContent> = [];\n\n\tpublic push(...offsetOrContent: (number | TContent)[]): void {\n\t\tfor (const item of offsetOrContent) {\n\t\t\tif (typeof item === \"number\") {\n\t\t\t\tthis.pushOffset(item);\n\t\t\t} else {\n\t\t\t\tthis.pushContent(item);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic pushOffset(offset: number): void {\n\t\tthis.offset += offset;\n\t}\n\n\tpublic pushContent(content: TContent): void {\n\t\tif (this.offset > 0) {\n\t\t\tthis.list.push(this.offset);\n\t\t\tthis.offset = 0;\n\t\t}\n\t\tthis.list.push(content);\n\t}\n}\n"]}
1
+ {"version":3,"file":"offsetList.js","sourceRoot":"","sources":["../../src/util/offsetList.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;;;;;;;GAQG;AACH,MAAM,OAAO,iBAAiB;IAA9B;QACS,WAAM,GAAG,CAAC,CAAC;QACH,SAAI,GAAyB,EAAE,CAAC;IAuBjD,CAAC;IArBO,IAAI,CAAC,GAAG,eAAsC;QACpD,KAAK,MAAM,IAAI,IAAI,eAAe,EAAE,CAAC;YACpC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC9B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YACvB,CAAC;iBAAM,CAAC;gBACP,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YACxB,CAAC;QACF,CAAC;IACF,CAAC;IAEM,UAAU,CAAC,MAAc;QAC/B,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC;IACvB,CAAC;IAEM,WAAW,CAAC,OAAiB;QACnC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC5B,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QACjB,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport type OffsetList<TContent = Exclude<unknown, number>, TOffset = number> = (\n\t| TOffset\n\t| TContent\n)[];\n\n/**\n * Helper class for constructing an offset list that...\n *\n * - Does not insert offsets if there is no content after them\n *\n * - Does not insert 0-sized offsets\n *\n * - Merges runs of offsets together\n */\nexport class OffsetListFactory<TContent> {\n\tprivate offset = 0;\n\tpublic readonly list: OffsetList<TContent> = [];\n\n\tpublic push(...offsetOrContent: (number | TContent)[]): void {\n\t\tfor (const item of offsetOrContent) {\n\t\t\tif (typeof item === \"number\") {\n\t\t\t\tthis.pushOffset(item);\n\t\t\t} else {\n\t\t\t\tthis.pushContent(item);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic pushOffset(offset: number): void {\n\t\tthis.offset += offset;\n\t}\n\n\tpublic pushContent(content: TContent): void {\n\t\tif (this.offset > 0) {\n\t\t\tthis.list.push(this.offset);\n\t\t\tthis.offset = 0;\n\t\t}\n\t\tthis.list.push(content);\n\t}\n}\n"]}
@@ -7,7 +7,6 @@ import { assert } from "@fluidframework/core-utils/internal";
7
7
  * Base class to assist with implementing ReferenceCounted.
8
8
  */
9
9
  export class ReferenceCountedBase {
10
- refCount;
11
10
  constructor(refCount = 1) {
12
11
  this.refCount = refCount;
13
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"referenceCounting.js","sourceRoot":"","sources":["../../src/util/referenceCounting.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAe7D;;GAEG;AACH,MAAM,OAAgB,oBAAoB;IACX;IAA9B,YAA8B,WAAmB,CAAC;QAApB,aAAQ,GAAR,QAAQ,CAAY;IAAG,CAAC;IAE/C,cAAc,CAAC,KAAK,GAAG,CAAC;QAC9B,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC;IACxB,CAAC;IAEM,gBAAgB,CAAC,KAAK,GAAG,CAAC;QAChC,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC;QACvB,MAAM,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC3D,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,cAAc,EAAE,CAAC;QACvB,CAAC;IACF,CAAC;IAEM,QAAQ;QACd,OAAO,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;IAC1B,CAAC;IAEM,cAAc;QACpB,OAAO,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC;IAC5B,CAAC;CAMD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nexport interface ReferenceCounted {\n\treferenceAdded(): void;\n\n\treferenceRemoved(): void;\n\n\t/**\n\t * @returns true if mutating this object may impact other users of it.\n\t *\n\t * Implementations can return true if the refcount is 1 OR the content is logically immutable.\n\t */\n\tisShared(): boolean;\n}\n\n/**\n * Base class to assist with implementing ReferenceCounted.\n */\nexport abstract class ReferenceCountedBase implements ReferenceCounted {\n\tprotected constructor(private refCount: number = 1) {}\n\n\tpublic referenceAdded(count = 1): void {\n\t\tthis.refCount += count;\n\t}\n\n\tpublic referenceRemoved(count = 1): void {\n\t\tthis.refCount -= count;\n\t\tassert(this.refCount >= 0, 0x4c4 /* Negative ref count */);\n\t\tif (this.refCount === 0) {\n\t\t\tthis.onUnreferenced();\n\t\t}\n\t}\n\n\tpublic isShared(): boolean {\n\t\treturn this.refCount > 1;\n\t}\n\n\tpublic isUnreferenced(): boolean {\n\t\treturn this.refCount === 0;\n\t}\n\n\t/**\n\t * Called when refcount reaches 0.\n\t */\n\tprotected abstract onUnreferenced(): void;\n}\n"]}
1
+ {"version":3,"file":"referenceCounting.js","sourceRoot":"","sources":["../../src/util/referenceCounting.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAe7D;;GAEG;AACH,MAAM,OAAgB,oBAAoB;IACzC,YAA8B,WAAmB,CAAC;QAApB,aAAQ,GAAR,QAAQ,CAAY;IAAG,CAAC;IAE/C,cAAc,CAAC,KAAK,GAAG,CAAC;QAC9B,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC;IACxB,CAAC;IAEM,gBAAgB,CAAC,KAAK,GAAG,CAAC;QAChC,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC;QACvB,MAAM,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC3D,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,cAAc,EAAE,CAAC;QACvB,CAAC;IACF,CAAC;IAEM,QAAQ;QACd,OAAO,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;IAC1B,CAAC;IAEM,cAAc;QACpB,OAAO,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC;IAC5B,CAAC;CAMD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nexport interface ReferenceCounted {\n\treferenceAdded(): void;\n\n\treferenceRemoved(): void;\n\n\t/**\n\t * @returns true if mutating this object may impact other users of it.\n\t *\n\t * Implementations can return true if the refcount is 1 OR the content is logically immutable.\n\t */\n\tisShared(): boolean;\n}\n\n/**\n * Base class to assist with implementing ReferenceCounted.\n */\nexport abstract class ReferenceCountedBase implements ReferenceCounted {\n\tprotected constructor(private refCount: number = 1) {}\n\n\tpublic referenceAdded(count = 1): void {\n\t\tthis.refCount += count;\n\t}\n\n\tpublic referenceRemoved(count = 1): void {\n\t\tthis.refCount -= count;\n\t\tassert(this.refCount >= 0, 0x4c4 /* Negative ref count */);\n\t\tif (this.refCount === 0) {\n\t\t\tthis.onUnreferenced();\n\t\t}\n\t}\n\n\tpublic isShared(): boolean {\n\t\treturn this.refCount > 1;\n\t}\n\n\tpublic isUnreferenced(): boolean {\n\t\treturn this.refCount === 0;\n\t}\n\n\t/**\n\t * Called when refcount reaches 0.\n\t */\n\tprotected abstract onUnreferenced(): void;\n}\n"]}
@@ -6,10 +6,9 @@
6
6
  * An iterator that supports having items pushed onto it for later iteration.
7
7
  */
8
8
  export class StackyIterator {
9
- list;
10
- stack = [];
11
- index = 0;
12
9
  constructor(list) {
10
+ this.stack = [];
11
+ this.index = 0;
13
12
  this.list = list;
14
13
  }
15
14
  [Symbol.iterator]() {
@@ -1 +1 @@
1
- {"version":3,"file":"stackyIterator.js","sourceRoot":"","sources":["../../src/util/stackyIterator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,OAAO,cAAc;IACT,IAAI,CAAe;IACnB,KAAK,GAAQ,EAAE,CAAC;IACzB,KAAK,GAAG,CAAC,CAAC;IAElB,YAAmB,IAAkB;QACpC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;IAEM,CAAC,MAAM,CAAC,QAAQ,CAAC;QACvB,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,IAAI;QACV,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACf,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QACzC,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,EAAO,EAAE,CAAC;IACnC,CAAC;IAED,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;IAClE,CAAC;IAEM,IAAI,CAAC,IAAO;QAClB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAEM,GAAG;QACT,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QACzB,CAAC;QACD,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACpC,OAAO,SAAS,CAAC;QAClB,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAChC,CAAC;IAEM,IAAI;QACV,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * An iterator that supports having items pushed onto it for later iteration.\n */\nexport class StackyIterator<T> implements Iterator<T>, Iterable<T> {\n\tprivate readonly list: readonly T[];\n\tprivate readonly stack: T[] = [];\n\tprivate index = 0;\n\n\tpublic constructor(list: readonly T[]) {\n\t\tthis.list = list;\n\t}\n\n\tpublic [Symbol.iterator](): Iterator<T> {\n\t\treturn this;\n\t}\n\n\tpublic next(): IteratorResult<T> {\n\t\tif (this.done) {\n\t\t\treturn { value: undefined, done: true };\n\t\t}\n\t\treturn { value: this.pop() as T };\n\t}\n\n\tpublic get done(): boolean {\n\t\treturn this.index >= this.list.length && this.stack.length === 0;\n\t}\n\n\tpublic push(item: T): void {\n\t\tthis.stack.push(item);\n\t}\n\n\tpublic pop(): T | undefined {\n\t\tif (this.stack.length > 0) {\n\t\t\treturn this.stack.pop();\n\t\t}\n\t\tif (this.index >= this.list.length) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.list[this.index++];\n\t}\n\n\tpublic peek(): T | undefined {\n\t\tif (this.stack.length > 0) {\n\t\t\treturn this.stack[this.stack.length - 1];\n\t\t}\n\t\treturn this.list[this.index];\n\t}\n}\n"]}
1
+ {"version":3,"file":"stackyIterator.js","sourceRoot":"","sources":["../../src/util/stackyIterator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,OAAO,cAAc;IAK1B,YAAmB,IAAkB;QAHpB,UAAK,GAAQ,EAAE,CAAC;QACzB,UAAK,GAAG,CAAC,CAAC;QAGjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;IAEM,CAAC,MAAM,CAAC,QAAQ,CAAC;QACvB,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,IAAI;QACV,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACf,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QACzC,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,EAAO,EAAE,CAAC;IACnC,CAAC;IAED,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;IAClE,CAAC;IAEM,IAAI,CAAC,IAAO;QAClB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAEM,GAAG;QACT,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QACzB,CAAC;QACD,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACpC,OAAO,SAAS,CAAC;QAClB,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAChC,CAAC;IAEM,IAAI;QACV,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * An iterator that supports having items pushed onto it for later iteration.\n */\nexport class StackyIterator<T> implements Iterator<T>, Iterable<T> {\n\tprivate readonly list: readonly T[];\n\tprivate readonly stack: T[] = [];\n\tprivate index = 0;\n\n\tpublic constructor(list: readonly T[]) {\n\t\tthis.list = list;\n\t}\n\n\tpublic [Symbol.iterator](): Iterator<T> {\n\t\treturn this;\n\t}\n\n\tpublic next(): IteratorResult<T> {\n\t\tif (this.done) {\n\t\t\treturn { value: undefined, done: true };\n\t\t}\n\t\treturn { value: this.pop() as T };\n\t}\n\n\tpublic get done(): boolean {\n\t\treturn this.index >= this.list.length && this.stack.length === 0;\n\t}\n\n\tpublic push(item: T): void {\n\t\tthis.stack.push(item);\n\t}\n\n\tpublic pop(): T | undefined {\n\t\tif (this.stack.length > 0) {\n\t\t\treturn this.stack.pop();\n\t\t}\n\t\tif (this.index >= this.list.length) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.list[this.index++];\n\t}\n\n\tpublic peek(): T | undefined {\n\t\tif (this.stack.length > 0) {\n\t\t\treturn this.stack[this.stack.length - 1];\n\t\t}\n\t\treturn this.list[this.index];\n\t}\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/tree",
3
- "version": "2.0.0-dev-rc.5.0.0.271262",
3
+ "version": "2.0.0-dev-rc.5.0.0.271717",
4
4
  "description": "Distributed tree",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -67,17 +67,17 @@
67
67
  "temp-directory": "nyc/.nyc_output"
68
68
  },
69
69
  "dependencies": {
70
- "@fluid-internal/client-utils": "2.0.0-dev-rc.5.0.0.271262",
71
- "@fluidframework/container-runtime": "2.0.0-dev-rc.5.0.0.271262",
72
- "@fluidframework/core-interfaces": "2.0.0-dev-rc.5.0.0.271262",
73
- "@fluidframework/core-utils": "2.0.0-dev-rc.5.0.0.271262",
74
- "@fluidframework/datastore-definitions": "2.0.0-dev-rc.5.0.0.271262",
75
- "@fluidframework/driver-definitions": "2.0.0-dev-rc.5.0.0.271262",
76
- "@fluidframework/id-compressor": "2.0.0-dev-rc.5.0.0.271262",
77
- "@fluidframework/runtime-definitions": "2.0.0-dev-rc.5.0.0.271262",
78
- "@fluidframework/runtime-utils": "2.0.0-dev-rc.5.0.0.271262",
79
- "@fluidframework/shared-object-base": "2.0.0-dev-rc.5.0.0.271262",
80
- "@fluidframework/telemetry-utils": "2.0.0-dev-rc.5.0.0.271262",
70
+ "@fluid-internal/client-utils": "2.0.0-dev-rc.5.0.0.271717",
71
+ "@fluidframework/container-runtime": "2.0.0-dev-rc.5.0.0.271717",
72
+ "@fluidframework/core-interfaces": "2.0.0-dev-rc.5.0.0.271717",
73
+ "@fluidframework/core-utils": "2.0.0-dev-rc.5.0.0.271717",
74
+ "@fluidframework/datastore-definitions": "2.0.0-dev-rc.5.0.0.271717",
75
+ "@fluidframework/driver-definitions": "2.0.0-dev-rc.5.0.0.271717",
76
+ "@fluidframework/id-compressor": "2.0.0-dev-rc.5.0.0.271717",
77
+ "@fluidframework/runtime-definitions": "2.0.0-dev-rc.5.0.0.271717",
78
+ "@fluidframework/runtime-utils": "2.0.0-dev-rc.5.0.0.271717",
79
+ "@fluidframework/shared-object-base": "2.0.0-dev-rc.5.0.0.271717",
80
+ "@fluidframework/telemetry-utils": "2.0.0-dev-rc.5.0.0.271717",
81
81
  "@sinclair/typebox": "^0.32.29",
82
82
  "@tylerbu/sorted-btree-es6": "^1.8.0",
83
83
  "@ungap/structured-clone": "^1.2.0",
@@ -86,19 +86,19 @@
86
86
  "devDependencies": {
87
87
  "@arethetypeswrong/cli": "^0.15.2",
88
88
  "@biomejs/biome": "^1.7.3",
89
- "@fluid-internal/mocha-test-setup": "2.0.0-dev-rc.5.0.0.271262",
90
- "@fluid-private/stochastic-test-utils": "2.0.0-dev-rc.5.0.0.271262",
91
- "@fluid-private/test-dds-utils": "2.0.0-dev-rc.5.0.0.271262",
92
- "@fluid-private/test-drivers": "2.0.0-dev-rc.5.0.0.271262",
89
+ "@fluid-internal/mocha-test-setup": "2.0.0-dev-rc.5.0.0.271717",
90
+ "@fluid-private/stochastic-test-utils": "2.0.0-dev-rc.5.0.0.271717",
91
+ "@fluid-private/test-dds-utils": "2.0.0-dev-rc.5.0.0.271717",
92
+ "@fluid-private/test-drivers": "2.0.0-dev-rc.5.0.0.271717",
93
93
  "@fluid-tools/benchmark": "^0.48.0",
94
94
  "@fluid-tools/build-cli": "^0.39.0",
95
95
  "@fluidframework/build-common": "^2.0.3",
96
96
  "@fluidframework/build-tools": "^0.39.0",
97
- "@fluidframework/container-definitions": "2.0.0-dev-rc.5.0.0.271262",
98
- "@fluidframework/container-loader": "2.0.0-dev-rc.5.0.0.271262",
97
+ "@fluidframework/container-definitions": "2.0.0-dev-rc.5.0.0.271717",
98
+ "@fluidframework/container-loader": "2.0.0-dev-rc.5.0.0.271717",
99
99
  "@fluidframework/eslint-config-fluid": "^5.3.0",
100
- "@fluidframework/test-runtime-utils": "2.0.0-dev-rc.5.0.0.271262",
101
- "@fluidframework/test-utils": "2.0.0-dev-rc.5.0.0.271262",
100
+ "@fluidframework/test-runtime-utils": "2.0.0-dev-rc.5.0.0.271717",
101
+ "@fluidframework/test-utils": "2.0.0-dev-rc.5.0.0.271717",
102
102
  "@microsoft/api-extractor": "^7.45.1",
103
103
  "@types/diff": "^3.5.1",
104
104
  "@types/easy-table": "^0.0.32",
@@ -38,15 +38,25 @@ import {
38
38
  type EncodedValueShape,
39
39
  SpecialField,
40
40
  } from "./format.js";
41
- import type { IIdCompressor, SessionSpaceCompressedId } from "@fluidframework/id-compressor";
41
+ import type { IIdCompressor, OpSpaceCompressedId, SessionId } from "@fluidframework/id-compressor";
42
42
 
43
+ export interface IdDecodingContext {
44
+ idCompressor: IIdCompressor;
45
+ /**
46
+ * The creator of any local Ids to be decoded.
47
+ */
48
+ originatorId: SessionId;
49
+ }
43
50
  /**
44
51
  * Decode `chunk` into a TreeChunk.
45
52
  */
46
- export function decode(chunk: EncodedFieldBatch, idCompressor: IIdCompressor): TreeChunk[] {
53
+ export function decode(
54
+ chunk: EncodedFieldBatch,
55
+ idDecodingContext: { idCompressor: IIdCompressor; originatorId: SessionId },
56
+ ): TreeChunk[] {
47
57
  return genericDecode(
48
58
  decoderLibrary,
49
- new DecoderContext(chunk.identifiers, chunk.shapes, idCompressor),
59
+ new DecoderContext(chunk.identifiers, chunk.shapes, idDecodingContext),
50
60
  chunk,
51
61
  anyDecoder,
52
62
  );
@@ -77,7 +87,7 @@ const decoderLibrary = new DiscriminatedUnionDispatcher<
77
87
  export function readValue(
78
88
  stream: StreamCursor,
79
89
  shape: EncodedValueShape,
80
- idCompressor: IIdCompressor,
90
+ idDecodingContext: IdDecodingContext,
81
91
  ): Value {
82
92
  if (shape === undefined) {
83
93
  return readStreamBoolean(stream) ? readStreamValue(stream) : undefined;
@@ -96,8 +106,14 @@ export function readValue(
96
106
  typeof streamValue === "number" || typeof streamValue === "string",
97
107
  "identifier must be string or number.",
98
108
  );
109
+ const idCompressor = idDecodingContext.idCompressor;
99
110
  return typeof streamValue === "number"
100
- ? idCompressor.decompress(streamValue as SessionSpaceCompressedId)
111
+ ? idCompressor.decompress(
112
+ idCompressor.normalizeToSessionSpace(
113
+ streamValue as OpSpaceCompressedId,
114
+ idDecodingContext.originatorId,
115
+ ),
116
+ )
101
117
  : streamValue;
102
118
  } else {
103
119
  // EncodedCounter case:
@@ -259,7 +275,7 @@ export class TreeDecoder implements ChunkDecoder {
259
275
  this.type ?? readStreamIdentifier(stream, this.cache);
260
276
  // TODO: Consider typechecking against stored schema in here somewhere.
261
277
 
262
- const value = readValue(stream, this.shape.value, this.cache.idCompressor);
278
+ const value = readValue(stream, this.shape.value, this.cache.idDecodingContext);
263
279
  const fields: Map<FieldKey, TreeChunk[]> = new Map();
264
280
 
265
281
  // Helper to add fields, but with unneeded array chunks removed.
@@ -16,7 +16,7 @@ import {
16
16
  readStream,
17
17
  } from "./chunkCodecUtilities.js";
18
18
  import type { EncodedFieldBatchGeneric, IdentifierOrIndex } from "./formatGeneric.js";
19
- import type { IIdCompressor } from "@fluidframework/id-compressor";
19
+ import type { IdDecodingContext } from "./chunkDecoding.js";
20
20
 
21
21
  /**
22
22
  * General purpose shape based tree decoder which gets its support for specific shapes from the caller.
@@ -52,7 +52,7 @@ export class DecoderContext<TEncodedShape = unknown> {
52
52
  public constructor(
53
53
  public readonly identifiers: readonly string[],
54
54
  public readonly shapes: readonly TEncodedShape[],
55
- public readonly idCompressor: IIdCompressor,
55
+ public readonly idDecodingContext: IdDecodingContext,
56
56
  ) {}
57
57
 
58
58
  public identifier<T extends string & BrandedType<string, string>>(
@@ -19,11 +19,12 @@ import type { FieldBatch } from "./fieldBatch.js";
19
19
  import { EncodedFieldBatch, validVersions } from "./format.js";
20
20
  import { schemaCompressedEncode } from "./schemaBasedEncoding.js";
21
21
  import { uncompressedEncode } from "./uncompressedEncode.js";
22
- import type { IIdCompressor } from "@fluidframework/id-compressor";
22
+ import type { IIdCompressor, SessionId } from "@fluidframework/id-compressor";
23
23
 
24
24
  export interface FieldBatchEncodingContext {
25
25
  readonly encodeType: TreeCompressionStrategy;
26
26
  readonly idCompressor: IIdCompressor;
27
+ readonly originatorId: SessionId;
27
28
  readonly schema?: SchemaAndPolicy;
28
29
  }
29
30
  /**
@@ -81,7 +82,10 @@ export function makeFieldBatchCodec(options: ICodecOptions, writeVersion: number
81
82
  },
82
83
  decode: (data: EncodedFieldBatch, context: FieldBatchEncodingContext): FieldBatch => {
83
84
  // TODO: consider checking data is in schema.
84
- return decode(data, context.idCompressor).map((chunk) => chunk.cursor());
85
+ return decode(data, {
86
+ idCompressor: context.idCompressor,
87
+ originatorId: context.originatorId,
88
+ }).map((chunk) => chunk.cursor());
85
89
  },
86
90
  });
87
91
  }
@@ -51,9 +51,14 @@ export class NodeShape extends Shape<EncodedChunkShape> implements NodeEncoder {
51
51
  }
52
52
 
53
53
  if (this.value === 0) {
54
- const compressedId =
55
- cache.idCompressor.tryRecompress(cursor.value as StableId) ?? cursor.value;
56
- encodeValue(compressedId, this.value, outputBuffer);
54
+ const sessionSpaceCompressedId = cache.idCompressor.tryRecompress(
55
+ cursor.value as StableId,
56
+ );
57
+ const opSpaceCompressedId =
58
+ sessionSpaceCompressedId !== undefined
59
+ ? cache.idCompressor.normalizeToOpSpace(sessionSpaceCompressedId)
60
+ : cursor.value;
61
+ encodeValue(opSpaceCompressedId, this.value, outputBuffer);
57
62
  } else {
58
63
  encodeValue(cursor.value, this.value, outputBuffer);
59
64
  }
@@ -326,6 +326,7 @@ function makeModularChangeCodec(
326
326
  trees: fieldsCodec.encode(treesToEncode, {
327
327
  encodeType: chunkCompressionStrategy,
328
328
  schema: context.schema,
329
+ originatorId: context.originatorId,
329
330
  idCompressor: context.idCompressor,
330
331
  }),
331
332
  };
@@ -341,6 +342,7 @@ function makeModularChangeCodec(
341
342
 
342
343
  const chunks = fieldsCodec.decode(encoded.trees, {
343
344
  encodeType: chunkCompressionStrategy,
345
+ originatorId: context.originatorId,
344
346
  idCompressor: context.idCompressor,
345
347
  });
346
348
  const getChunk = (index: number): TreeChunk => {
package/src/index.ts CHANGED
@@ -272,7 +272,6 @@ export {
272
272
  type TreeArrayNodeBase,
273
273
  type ITree,
274
274
  type TreeNodeSchema,
275
- TreeConfiguration,
276
275
  TreeViewConfiguration,
277
276
  type ITreeViewConfiguration,
278
277
  type ITreeConfigurationOptions,
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/tree";
9
- export const pkgVersion = "2.0.0-dev-rc.5.0.0.271262";
9
+ export const pkgVersion = "2.0.0-dev-rc.5.0.0.271717";
@@ -233,8 +233,6 @@ export class SchematizingSimpleTreeView<in out TRootSchema extends ImplicitField
233
233
  lastRoot = this.root;
234
234
  this.events.emit("rootChanged");
235
235
  }
236
-
237
- this.events.emit("afterBatch");
238
236
  });
239
237
 
240
238
  const onViewDispose = (): void => {
@@ -142,6 +142,7 @@ interface ExplicitCodecVersions extends ExplicitCoreCodecVersions {
142
142
  const formatVersionToTopLevelCodecVersions = new Map<number, ExplicitCodecVersions>([
143
143
  [1, { forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 1, message: 1, fieldBatch: 1 }],
144
144
  [2, { forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 2, message: 2, fieldBatch: 1 }],
145
+ [3, { forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 3, message: 3, fieldBatch: 1 }],
145
146
  ]);
146
147
 
147
148
  function getCodecVersions(formatVersion: number): ExplicitCodecVersions {
@@ -203,6 +204,7 @@ export class SharedTree
203
204
  policy: defaultSchemaPolicy,
204
205
  },
205
206
  encodeType: options.treeEncodeType,
207
+ originatorId: runtime.idCompressor.localSessionId,
206
208
  idCompressor: runtime.idCompressor,
207
209
  };
208
210
  const forestSummarizer = new ForestSummarizer(
@@ -361,6 +363,11 @@ export const SharedTreeFormatVersion = {
361
363
  * Requires \@fluidframework/tree \>= 2.0.0.
362
364
  */
363
365
  v2: 2,
366
+
367
+ /**
368
+ * Requires \@fluidframework/tree \>= 2.0.0.
369
+ */
370
+ v3: 3,
364
371
  } as const;
365
372
 
366
373
  /**
@@ -427,7 +434,7 @@ export const defaultSharedTreeOptions: Required<SharedTreeOptions> = {
427
434
  jsonValidator: noopValidator,
428
435
  forest: ForestType.Reference,
429
436
  treeEncodeType: TreeCompressionStrategy.Compressed,
430
- formatVersion: SharedTreeFormatVersion.v2,
437
+ formatVersion: SharedTreeFormatVersion.v3,
431
438
  };
432
439
 
433
440
  /**
@@ -376,34 +376,34 @@ declare abstract class NodeWithArrayFeatures<Input, T>
376
376
  {
377
377
  concat(...items: ConcatArray<T>[]): T[];
378
378
  concat(...items: (T | ConcatArray<T>)[]): T[];
379
- join(separator?: string | undefined): string;
380
- slice(start?: number | undefined, end?: number | undefined): T[];
381
- indexOf(searchElement: T, fromIndex?: number | undefined): number;
382
- lastIndexOf(searchElement: T, fromIndex?: number | undefined): number;
379
+ entries(): IterableIterator<[number, T]>;
383
380
  every<S extends T>(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): this is readonly S[];
384
381
  every(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean;
385
- some(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean;
386
- forEach(callbackfn: (value: T, index: number, array: readonly T[]) => void, thisArg?: any): void;
387
- map<U>(callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any): U[];
388
382
  filter<S extends T>(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): S[];
389
383
  filter(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): T[];
384
+ find<S extends T>(predicate: (value: T, index: number, obj: readonly T[]) => value is S, thisArg?: any): S | undefined;
385
+ find(predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any): T | undefined;
386
+ findIndex(predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any): number;
387
+ flat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[];
388
+ flatMap<U, This = undefined>(callback: (this: This, value: T, index: number, array: T[]) => U | readonly U[], thisArg?: This | undefined): U[];
389
+ forEach(callbackfn: (value: T, index: number, array: readonly T[]) => void, thisArg?: any): void;
390
+ includes(searchElement: T, fromIndex?: number | undefined): boolean;
391
+ indexOf(searchElement: T, fromIndex?: number | undefined): number;
392
+ join(separator?: string | undefined): string;
393
+ keys(): IterableIterator<number>;
394
+ lastIndexOf(searchElement: T, fromIndex?: number | undefined): number;
395
+ map<U>(callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any): U[];
390
396
  reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T;
391
397
  reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T;
392
398
  reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U;
393
399
  reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T;
394
400
  reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T;
395
401
  reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U;
396
- find<S extends T>(predicate: (value: T, index: number, obj: readonly T[]) => value is S, thisArg?: any): S | undefined;
397
- find(predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any): T | undefined;
398
- findIndex(predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any): number;
399
- entries(): IterableIterator<[number, T]>;
400
- keys(): IterableIterator<number>;
401
- values(): IterableIterator<T>;
402
- includes(searchElement: T, fromIndex?: number | undefined): boolean;
403
- flatMap<U, This = undefined>(callback: (this: This, value: T, index: number, array: T[]) => U | readonly U[], thisArg?: This | undefined): U[];
404
- flat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[];
405
- toString(): string;
402
+ slice(start?: number | undefined, end?: number | undefined): T[];
403
+ some(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean;
406
404
  toLocaleString(): string;
405
+ toString(): string;
406
+ values(): IterableIterator<T>;
407
407
  }
408
408
  /* eslint-enable @typescript-eslint/explicit-member-accessibility, @typescript-eslint/no-explicit-any */
409
409
 
@@ -567,11 +567,24 @@ export class SchemaFactory<
567
567
  }
568
568
 
569
569
  /**
570
- * Make a field of type identifier instead of the default, which is required.
571
- * @remarks Identifiers may be optionally supplied at node construction time.
572
- * If not supplied, they will be generated automatically when the node is inserted into the tree.
573
- * Attempting to read an automatically generated identifier before the node is inserted into the tree will throw an error.
574
- * An automatically generated identifier will not be present when iterating the nodes's fields until after the node is inserted into the tree.
570
+ * A special field which holds a unique identifier for an object node.
571
+ * @remarks
572
+ * The value of this field, a "node identifier", uniquely identifies a node among all other nodes in the tree.
573
+ * Node identifiers are strings, and can therefore be used as lookup keys in maps or written to a database.
574
+ * When the node is constructed, the identifier field does not need to be populated.
575
+ * The SharedTree will provide an identifier for the node automatically.
576
+ * An identifier provided automatically by the SharedTree has the following properties:
577
+ * - It is a UUID.
578
+ * - It is compressed to a space-efficient representation when stored in the document.
579
+ * - A compressed form of the identifier can be accessed at runtime via the `Tree.shortId()` API.
580
+ * - It will error if read (and will not be present in the object's iterable properties) before the node has been inserted into the tree.
581
+ *
582
+ * However, a user may alternatively supply their own string as the identifier if desired (for example, if importing identifiers from another system).
583
+ * In that case, it is up to the user to ensure that the identifier is unique within the current tree - no other node should have the same identifier at the same time.
584
+ * If the identifier is not unique, it may be read, but may cause libraries or features which operate over node identifiers to misbehave.
585
+ * User-supplied identifiers may be read immediately, even before insertion into the tree.
586
+ *
587
+ * A node may have more than one identifier field (though note that this precludes the use of the `Tree.shortId()` API).
575
588
  */
576
589
  public get identifier(): FieldSchema<FieldKind.Identifier, typeof this.string> {
577
590
  const defaultIdentifierProvider: DefaultProvider = getDefaultProvider(
@@ -57,30 +57,10 @@ export interface ITree extends IFluidLoadable {
57
57
  viewWith<TRoot extends ImplicitFieldSchema>(
58
58
  config: TreeViewConfiguration<TRoot>,
59
59
  ): TreeView<TRoot>;
60
-
61
- /**
62
- * Returns a {@link TreeView} using the provided schema.
63
- * If the stored schema is view-compatible with the view schema specified by `config`,
64
- * the returned {@link TreeView} will expose the root with a schema-aware API based on the provided view schema.
65
- * See {@link TreeView.compatibility} for information about the compatibility between the view and stored schemas.
66
- *
67
- * @remarks
68
- * If the tree is uninitialized, it will be implicitly initialized by this function.
69
- *
70
- * Note that other clients can modify the document at any time, causing the view to change its compatibility status: see {@link TreeView.events} for how to handle invalidation in these cases.
71
- *
72
- * Only one schematized view may exist for a given ITree at a time.
73
- * If creating a second, the first must be disposed before calling `schematize` again.
74
- * @deprecated Replaced by {@link ITree.viewWith}. Use that method instead. Note that `viewWith` does not implicitly initialize the tree:
75
- * to initialize it, call {@link TreeView.initialize} on the returned view.
76
- */
77
- schematize<TRoot extends ImplicitFieldSchema>(
78
- config: TreeConfiguration<TRoot>,
79
- ): TreeView<TRoot>;
80
60
  }
81
61
 
82
62
  /**
83
- * Options when schematizing a tree.
63
+ * Options when constructing a tree view.
84
64
  * @public
85
65
  */
86
66
  export interface ITreeConfigurationOptions {
@@ -342,11 +322,6 @@ export interface SchemaCompatibilityStatus {
342
322
  * @public
343
323
  */
344
324
  export interface TreeViewEvents {
345
- /**
346
- * A batch of changes has finished processing and the view has been updated.
347
- */
348
- afterBatch(): void;
349
-
350
325
  /**
351
326
  * Raised whenever {@link TreeView.root} is invalidated.
352
327
  *
@@ -36,6 +36,7 @@ import {
36
36
  stringSchema,
37
37
  } from "./leafNodeSchema.js";
38
38
  import { isFluidHandle } from "@fluidframework/runtime-utils/internal";
39
+ import { UsageError } from "@fluidframework/telemetry-utils/internal";
39
40
 
40
41
  /**
41
42
  * Provides various functions for analyzing {@link TreeNode}s.
@@ -101,11 +102,20 @@ export interface TreeNodeApi {
101
102
  readonly status: (node: TreeNode) => TreeStatus;
102
103
 
103
104
  /**
104
- * Returns the {@link FieldKind.Identifier | identifier} of the given node in the most compressed form possible.
105
+ * Returns the {@link SchemaFactory.identifier | identifier} of the given node in the most compressed form possible.
105
106
  * @remarks
106
- * If the node's identifier is a valid `StableNodeKey`, then this will return a unique process-local integer corresponding to that identifier.
107
- * If the node's identifier is any other string, then this will return that string.
108
- * If the node has no identifier (that is, it has no field of an {@link FieldKind.Identifier | identifier} field kind), then this returns undefined.
107
+ * If the node's identifier is a valid UUID that was automatically generated by the SharedTree, then this will return a process-unique integer corresponding to that identifier.
108
+ * This is useful for performance-sensitive scenarios involving many nodes with identifiers that need to be compactly retained in memory or used for efficient lookup.
109
+ *
110
+ * If the node's identifier is any other user-provided string, then this will return that string.
111
+ *
112
+ * If the node has no identifier (that is, it has no {@link SchemaFactory.identifier | identifier} field), then this returns `undefined`.
113
+ *
114
+ * If the node has more than one identifier, then this will throw an error.
115
+ *
116
+ * The returned integer must not be serialized or preserved outside of the current process.
117
+ * Its lifetime is that of the current in-memory instance of the FF container for this client, and it is not guaranteed to be unique or stable outside of that context.
118
+ * The same node's identifier may, for example, be different across multiple sessions for the same client and document, or different across two clients in the same session.
109
119
  */
110
120
  shortId(node: TreeNode): number | string | undefined;
111
121
  }
@@ -188,18 +198,26 @@ export const treeNodeApi: TreeNodeApi = {
188
198
  },
189
199
  shortId(node: TreeNode): number | string | undefined {
190
200
  const flexNode = getFlexNode(node);
201
+ let shortId: number | string | undefined;
191
202
  for (const field of flexNode.boxedIterator()) {
192
203
  if (field.schema.kind === FieldKinds.identifier) {
204
+ if (shortId !== undefined) {
205
+ throw new UsageError(
206
+ "shortId() may not be called on a node with more than one identifier. Consider converting extraneous identifier fields to string fields.",
207
+ );
208
+ }
193
209
  const identifier = field.boxedAt(0);
194
210
  assert(identifier !== undefined, 0x927 /* The identifier must exist */);
195
211
  const identifierValue = identifier.value as string;
196
212
  const localNodeKey =
197
213
  identifier.context.nodeKeyManager.tryLocalizeNodeKey(identifierValue);
198
- return localNodeKey !== undefined
199
- ? extractFromOpaque(localNodeKey)
200
- : identifierValue;
214
+
215
+ shortId =
216
+ localNodeKey !== undefined ? extractFromOpaque(localNodeKey) : identifierValue;
201
217
  }
202
218
  }
219
+
220
+ return shortId;
203
221
  },
204
222
  };
205
223