@fluidframework/tree 2.40.0-336023 → 2.40.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 (445) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/api-report/tree.alpha.api.md +4 -1
  3. package/dist/alpha.d.ts +1 -0
  4. package/dist/codec/codec.d.ts +5 -1
  5. package/dist/codec/codec.d.ts.map +1 -1
  6. package/dist/codec/codec.js +6 -2
  7. package/dist/codec/codec.js.map +1 -1
  8. package/dist/codec/index.d.ts +1 -1
  9. package/dist/codec/index.d.ts.map +1 -1
  10. package/dist/codec/index.js +2 -1
  11. package/dist/codec/index.js.map +1 -1
  12. package/dist/core/index.d.ts +2 -2
  13. package/dist/core/index.d.ts.map +1 -1
  14. package/dist/core/index.js +2 -3
  15. package/dist/core/index.js.map +1 -1
  16. package/dist/core/schema-stored/{format.d.ts → formatV1.d.ts} +1 -1
  17. package/dist/core/schema-stored/formatV1.d.ts.map +1 -0
  18. package/dist/core/schema-stored/{format.js → formatV1.js} +1 -1
  19. package/dist/core/schema-stored/formatV1.js.map +1 -0
  20. package/dist/core/schema-stored/index.d.ts +3 -3
  21. package/dist/core/schema-stored/index.d.ts.map +1 -1
  22. package/dist/core/schema-stored/index.js +3 -3
  23. package/dist/core/schema-stored/index.js.map +1 -1
  24. package/dist/core/schema-stored/schema.d.ts +3 -1
  25. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  26. package/dist/core/schema-stored/schema.js +8 -6
  27. package/dist/core/schema-stored/schema.js.map +1 -1
  28. package/dist/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  29. package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  30. package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
  31. package/dist/core/schema-view/index.d.ts +1 -1
  32. package/dist/core/schema-view/index.d.ts.map +1 -1
  33. package/dist/core/schema-view/index.js +1 -2
  34. package/dist/core/schema-view/index.js.map +1 -1
  35. package/dist/core/schema-view/view.d.ts +0 -27
  36. package/dist/core/schema-view/view.d.ts.map +1 -1
  37. package/dist/core/schema-view/view.js +1 -35
  38. package/dist/core/schema-view/view.js.map +1 -1
  39. package/dist/core/tree/persistedTreeTextFormat.d.ts +4 -4
  40. package/dist/core/tree/persistedTreeTextFormat.d.ts.map +1 -1
  41. package/dist/core/tree/persistedTreeTextFormat.js +1 -1
  42. package/dist/core/tree/persistedTreeTextFormat.js.map +1 -1
  43. package/dist/feature-libraries/forest-summary/format.d.ts +2 -2
  44. package/dist/feature-libraries/forest-summary/format.d.ts.map +1 -1
  45. package/dist/feature-libraries/forest-summary/format.js +1 -1
  46. package/dist/feature-libraries/forest-summary/format.js.map +1 -1
  47. package/dist/feature-libraries/index.d.ts +1 -1
  48. package/dist/feature-libraries/index.d.ts.map +1 -1
  49. package/dist/feature-libraries/index.js +4 -2
  50. package/dist/feature-libraries/index.js.map +1 -1
  51. package/dist/feature-libraries/mapTreeCursor.d.ts +3 -3
  52. package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  53. package/dist/feature-libraries/mapTreeCursor.js +2 -2
  54. package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
  55. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts +9 -9
  56. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  57. package/dist/feature-libraries/modular-schema/modularChangeFormat.js +2 -2
  58. package/dist/feature-libraries/modular-schema/modularChangeFormat.js.map +1 -1
  59. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +14 -1
  60. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  61. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +26 -5
  62. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  63. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -2
  64. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
  65. package/dist/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
  66. package/dist/feature-libraries/schema-index/codec.d.ts +34 -5
  67. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  68. package/dist/feature-libraries/schema-index/codec.js +63 -9
  69. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  70. package/{lib/feature-libraries/schema-index/format.d.ts → dist/feature-libraries/schema-index/formatV1.d.ts} +9 -9
  71. package/dist/feature-libraries/schema-index/formatV1.d.ts.map +1 -0
  72. package/dist/feature-libraries/schema-index/{format.js → formatV1.js} +4 -4
  73. package/dist/feature-libraries/schema-index/formatV1.js.map +1 -0
  74. package/dist/feature-libraries/schema-index/index.d.ts +2 -2
  75. package/dist/feature-libraries/schema-index/index.d.ts.map +1 -1
  76. package/dist/feature-libraries/schema-index/index.js +6 -3
  77. package/dist/feature-libraries/schema-index/index.js.map +1 -1
  78. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +5 -5
  79. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  80. package/dist/feature-libraries/schema-index/schemaSummarizer.js +4 -4
  81. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  82. package/dist/index.d.ts +1 -0
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +10 -8
  85. package/dist/index.js.map +1 -1
  86. package/dist/packageVersion.d.ts +1 -1
  87. package/dist/packageVersion.d.ts.map +1 -1
  88. package/dist/packageVersion.js +1 -1
  89. package/dist/packageVersion.js.map +1 -1
  90. package/dist/shared-tree/independentView.d.ts.map +1 -1
  91. package/dist/shared-tree/independentView.js +1 -1
  92. package/dist/shared-tree/independentView.js.map +1 -1
  93. package/dist/shared-tree/index.d.ts +1 -1
  94. package/dist/shared-tree/index.d.ts.map +1 -1
  95. package/dist/shared-tree/index.js +2 -1
  96. package/dist/shared-tree/index.js.map +1 -1
  97. package/dist/shared-tree/schematizeTree.d.ts +8 -9
  98. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  99. package/dist/shared-tree/schematizeTree.js +9 -33
  100. package/dist/shared-tree/schematizeTree.js.map +1 -1
  101. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  102. package/dist/shared-tree/schematizingTreeView.js +1 -4
  103. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  104. package/dist/shared-tree/sharedTree.d.ts +28 -3
  105. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  106. package/dist/shared-tree/sharedTree.js +29 -3
  107. package/dist/shared-tree/sharedTree.js.map +1 -1
  108. package/dist/shared-tree/tree.d.ts +24 -0
  109. package/dist/shared-tree/tree.d.ts.map +1 -1
  110. package/dist/shared-tree/tree.js.map +1 -1
  111. package/dist/shared-tree/treeAlpha.d.ts +2 -0
  112. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  113. package/dist/shared-tree/treeAlpha.js +3 -2
  114. package/dist/shared-tree/treeAlpha.js.map +1 -1
  115. package/dist/shared-tree-core/branchCommitEnricher.d.ts +0 -1
  116. package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  117. package/dist/shared-tree-core/branchCommitEnricher.js +0 -1
  118. package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
  119. package/dist/shared-tree-core/transactionEnricher.d.ts +1 -1
  120. package/dist/shared-tree-core/transactionEnricher.d.ts.map +1 -1
  121. package/dist/shared-tree-core/transactionEnricher.js +4 -1
  122. package/dist/shared-tree-core/transactionEnricher.js.map +1 -1
  123. package/dist/simple-tree/api/index.d.ts +2 -1
  124. package/dist/simple-tree/api/index.d.ts.map +1 -1
  125. package/dist/simple-tree/api/index.js +2 -1
  126. package/dist/simple-tree/api/index.js.map +1 -1
  127. package/dist/simple-tree/api/schemaFactory.d.ts +9 -0
  128. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  129. package/dist/simple-tree/api/schemaFactory.js +7 -0
  130. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  131. package/dist/simple-tree/api/storedSchema.d.ts +8 -7
  132. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  133. package/dist/simple-tree/api/storedSchema.js +13 -9
  134. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  135. package/dist/simple-tree/api/tree.d.ts +25 -0
  136. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  137. package/dist/simple-tree/api/tree.js.map +1 -1
  138. package/dist/simple-tree/api/treeBeta.d.ts +4 -1
  139. package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
  140. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  141. package/dist/simple-tree/api/treeChangeEvents.d.ts +83 -0
  142. package/dist/simple-tree/api/treeChangeEvents.d.ts.map +1 -0
  143. package/dist/simple-tree/api/treeChangeEvents.js +7 -0
  144. package/dist/simple-tree/api/treeChangeEvents.js.map +1 -0
  145. package/dist/simple-tree/api/treeNodeApi.d.ts +2 -1
  146. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  147. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  148. package/dist/simple-tree/arrayNode.d.ts +28 -0
  149. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  150. package/dist/simple-tree/arrayNode.js.map +1 -1
  151. package/dist/simple-tree/core/getOrCreateNode.d.ts +1 -1
  152. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  153. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  154. package/dist/simple-tree/core/index.d.ts +2 -1
  155. package/dist/simple-tree/core/index.d.ts.map +1 -1
  156. package/dist/simple-tree/core/index.js +5 -5
  157. package/dist/simple-tree/core/index.js.map +1 -1
  158. package/dist/simple-tree/core/treeNode.d.ts +94 -0
  159. package/dist/simple-tree/core/treeNode.d.ts.map +1 -0
  160. package/dist/simple-tree/core/treeNode.js +123 -0
  161. package/dist/simple-tree/core/treeNode.js.map +1 -0
  162. package/dist/simple-tree/core/treeNodeKernel.d.ts +2 -1
  163. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  164. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  165. package/dist/simple-tree/core/treeNodeSchema.d.ts +3 -1
  166. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  167. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  168. package/dist/simple-tree/core/types.d.ts +0 -165
  169. package/dist/simple-tree/core/types.d.ts.map +1 -1
  170. package/dist/simple-tree/core/types.js +1 -113
  171. package/dist/simple-tree/core/types.js.map +1 -1
  172. package/dist/simple-tree/core/withType.d.ts +1 -1
  173. package/dist/simple-tree/core/withType.d.ts.map +1 -1
  174. package/dist/simple-tree/core/withType.js.map +1 -1
  175. package/dist/simple-tree/index.d.ts +2 -2
  176. package/dist/simple-tree/index.d.ts.map +1 -1
  177. package/dist/simple-tree/index.js +3 -2
  178. package/dist/simple-tree/index.js.map +1 -1
  179. package/dist/simple-tree/schemaTypes.d.ts +1 -0
  180. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  181. package/dist/simple-tree/schemaTypes.js.map +1 -1
  182. package/dist/simple-tree/toStoredSchema.d.ts +8 -8
  183. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  184. package/dist/simple-tree/toStoredSchema.js +27 -32
  185. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  186. package/dist/tableSchema.d.ts +302 -83
  187. package/dist/tableSchema.d.ts.map +1 -1
  188. package/dist/tableSchema.js +299 -57
  189. package/dist/tableSchema.js.map +1 -1
  190. package/dist/treeFactory.d.ts +1 -1
  191. package/dist/treeFactory.d.ts.map +1 -1
  192. package/dist/treeFactory.js +30 -75
  193. package/dist/treeFactory.js.map +1 -1
  194. package/lib/alpha.d.ts +1 -0
  195. package/lib/codec/codec.d.ts +5 -1
  196. package/lib/codec/codec.d.ts.map +1 -1
  197. package/lib/codec/codec.js +5 -1
  198. package/lib/codec/codec.js.map +1 -1
  199. package/lib/codec/index.d.ts +1 -1
  200. package/lib/codec/index.d.ts.map +1 -1
  201. package/lib/codec/index.js +1 -1
  202. package/lib/codec/index.js.map +1 -1
  203. package/lib/core/index.d.ts +2 -2
  204. package/lib/core/index.d.ts.map +1 -1
  205. package/lib/core/index.js +2 -2
  206. package/lib/core/index.js.map +1 -1
  207. package/lib/core/schema-stored/{format.d.ts → formatV1.d.ts} +1 -1
  208. package/lib/core/schema-stored/formatV1.d.ts.map +1 -0
  209. package/lib/core/schema-stored/{format.js → formatV1.js} +1 -1
  210. package/lib/core/schema-stored/formatV1.js.map +1 -0
  211. package/lib/core/schema-stored/index.d.ts +3 -3
  212. package/lib/core/schema-stored/index.d.ts.map +1 -1
  213. package/lib/core/schema-stored/index.js +2 -2
  214. package/lib/core/schema-stored/index.js.map +1 -1
  215. package/lib/core/schema-stored/schema.d.ts +3 -1
  216. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  217. package/lib/core/schema-stored/schema.js +3 -1
  218. package/lib/core/schema-stored/schema.js.map +1 -1
  219. package/lib/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  220. package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  221. package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
  222. package/lib/core/schema-view/index.d.ts +1 -1
  223. package/lib/core/schema-view/index.d.ts.map +1 -1
  224. package/lib/core/schema-view/index.js +1 -1
  225. package/lib/core/schema-view/index.js.map +1 -1
  226. package/lib/core/schema-view/view.d.ts +0 -27
  227. package/lib/core/schema-view/view.d.ts.map +1 -1
  228. package/lib/core/schema-view/view.js +0 -34
  229. package/lib/core/schema-view/view.js.map +1 -1
  230. package/lib/core/tree/persistedTreeTextFormat.d.ts +4 -4
  231. package/lib/core/tree/persistedTreeTextFormat.d.ts.map +1 -1
  232. package/lib/core/tree/persistedTreeTextFormat.js +2 -2
  233. package/lib/core/tree/persistedTreeTextFormat.js.map +1 -1
  234. package/lib/feature-libraries/forest-summary/format.d.ts +2 -2
  235. package/lib/feature-libraries/forest-summary/format.d.ts.map +1 -1
  236. package/lib/feature-libraries/forest-summary/format.js +2 -2
  237. package/lib/feature-libraries/forest-summary/format.js.map +1 -1
  238. package/lib/feature-libraries/index.d.ts +1 -1
  239. package/lib/feature-libraries/index.d.ts.map +1 -1
  240. package/lib/feature-libraries/index.js +1 -1
  241. package/lib/feature-libraries/index.js.map +1 -1
  242. package/lib/feature-libraries/mapTreeCursor.d.ts +3 -3
  243. package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  244. package/lib/feature-libraries/mapTreeCursor.js +2 -2
  245. package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
  246. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts +9 -9
  247. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  248. package/lib/feature-libraries/modular-schema/modularChangeFormat.js +3 -3
  249. package/lib/feature-libraries/modular-schema/modularChangeFormat.js.map +1 -1
  250. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +14 -1
  251. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  252. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +26 -6
  253. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  254. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -2
  255. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
  256. package/lib/feature-libraries/schema-edits/schemaChangeFormat.js +3 -3
  257. package/lib/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
  258. package/lib/feature-libraries/schema-index/codec.d.ts +34 -5
  259. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  260. package/lib/feature-libraries/schema-index/codec.js +61 -9
  261. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  262. package/{dist/feature-libraries/schema-index/format.d.ts → lib/feature-libraries/schema-index/formatV1.d.ts} +9 -9
  263. package/lib/feature-libraries/schema-index/formatV1.d.ts.map +1 -0
  264. package/lib/feature-libraries/schema-index/{format.js → formatV1.js} +5 -5
  265. package/lib/feature-libraries/schema-index/formatV1.js.map +1 -0
  266. package/lib/feature-libraries/schema-index/index.d.ts +2 -2
  267. package/lib/feature-libraries/schema-index/index.d.ts.map +1 -1
  268. package/lib/feature-libraries/schema-index/index.js +2 -2
  269. package/lib/feature-libraries/schema-index/index.js.map +1 -1
  270. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +5 -5
  271. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  272. package/lib/feature-libraries/schema-index/schemaSummarizer.js +5 -5
  273. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  274. package/lib/index.d.ts +1 -0
  275. package/lib/index.d.ts.map +1 -1
  276. package/lib/index.js +1 -0
  277. package/lib/index.js.map +1 -1
  278. package/lib/packageVersion.d.ts +1 -1
  279. package/lib/packageVersion.d.ts.map +1 -1
  280. package/lib/packageVersion.js +1 -1
  281. package/lib/packageVersion.js.map +1 -1
  282. package/lib/shared-tree/independentView.d.ts.map +1 -1
  283. package/lib/shared-tree/independentView.js +2 -2
  284. package/lib/shared-tree/independentView.js.map +1 -1
  285. package/lib/shared-tree/index.d.ts +1 -1
  286. package/lib/shared-tree/index.d.ts.map +1 -1
  287. package/lib/shared-tree/index.js +1 -1
  288. package/lib/shared-tree/index.js.map +1 -1
  289. package/lib/shared-tree/schematizeTree.d.ts +8 -9
  290. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  291. package/lib/shared-tree/schematizeTree.js +10 -34
  292. package/lib/shared-tree/schematizeTree.js.map +1 -1
  293. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  294. package/lib/shared-tree/schematizingTreeView.js +2 -5
  295. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  296. package/lib/shared-tree/sharedTree.d.ts +28 -3
  297. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  298. package/lib/shared-tree/sharedTree.js +29 -4
  299. package/lib/shared-tree/sharedTree.js.map +1 -1
  300. package/lib/shared-tree/tree.d.ts +24 -0
  301. package/lib/shared-tree/tree.d.ts.map +1 -1
  302. package/lib/shared-tree/tree.js.map +1 -1
  303. package/lib/shared-tree/treeAlpha.d.ts +2 -0
  304. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  305. package/lib/shared-tree/treeAlpha.js +4 -3
  306. package/lib/shared-tree/treeAlpha.js.map +1 -1
  307. package/lib/shared-tree-core/branchCommitEnricher.d.ts +0 -1
  308. package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  309. package/lib/shared-tree-core/branchCommitEnricher.js +0 -1
  310. package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
  311. package/lib/shared-tree-core/transactionEnricher.d.ts +1 -1
  312. package/lib/shared-tree-core/transactionEnricher.d.ts.map +1 -1
  313. package/lib/shared-tree-core/transactionEnricher.js +4 -1
  314. package/lib/shared-tree-core/transactionEnricher.js.map +1 -1
  315. package/lib/simple-tree/api/index.d.ts +2 -1
  316. package/lib/simple-tree/api/index.d.ts.map +1 -1
  317. package/lib/simple-tree/api/index.js +1 -1
  318. package/lib/simple-tree/api/index.js.map +1 -1
  319. package/lib/simple-tree/api/schemaFactory.d.ts +9 -0
  320. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  321. package/lib/simple-tree/api/schemaFactory.js +7 -0
  322. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  323. package/lib/simple-tree/api/storedSchema.d.ts +8 -7
  324. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  325. package/lib/simple-tree/api/storedSchema.js +17 -11
  326. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  327. package/lib/simple-tree/api/tree.d.ts +25 -0
  328. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  329. package/lib/simple-tree/api/tree.js.map +1 -1
  330. package/lib/simple-tree/api/treeBeta.d.ts +4 -1
  331. package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
  332. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  333. package/lib/simple-tree/api/treeChangeEvents.d.ts +83 -0
  334. package/lib/simple-tree/api/treeChangeEvents.d.ts.map +1 -0
  335. package/lib/simple-tree/api/treeChangeEvents.js +6 -0
  336. package/lib/simple-tree/api/treeChangeEvents.js.map +1 -0
  337. package/lib/simple-tree/api/treeNodeApi.d.ts +2 -1
  338. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  339. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  340. package/lib/simple-tree/arrayNode.d.ts +28 -0
  341. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  342. package/lib/simple-tree/arrayNode.js.map +1 -1
  343. package/lib/simple-tree/core/getOrCreateNode.d.ts +1 -1
  344. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  345. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  346. package/lib/simple-tree/core/index.d.ts +2 -1
  347. package/lib/simple-tree/core/index.d.ts.map +1 -1
  348. package/lib/simple-tree/core/index.js +1 -1
  349. package/lib/simple-tree/core/index.js.map +1 -1
  350. package/lib/simple-tree/core/treeNode.d.ts +94 -0
  351. package/lib/simple-tree/core/treeNode.d.ts.map +1 -0
  352. package/lib/simple-tree/core/treeNode.js +118 -0
  353. package/lib/simple-tree/core/treeNode.js.map +1 -0
  354. package/lib/simple-tree/core/treeNodeKernel.d.ts +2 -1
  355. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  356. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  357. package/lib/simple-tree/core/treeNodeSchema.d.ts +3 -1
  358. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  359. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  360. package/lib/simple-tree/core/types.d.ts +0 -165
  361. package/lib/simple-tree/core/types.d.ts.map +1 -1
  362. package/lib/simple-tree/core/types.js +0 -110
  363. package/lib/simple-tree/core/types.js.map +1 -1
  364. package/lib/simple-tree/core/withType.d.ts +1 -1
  365. package/lib/simple-tree/core/withType.d.ts.map +1 -1
  366. package/lib/simple-tree/core/withType.js.map +1 -1
  367. package/lib/simple-tree/index.d.ts +2 -2
  368. package/lib/simple-tree/index.d.ts.map +1 -1
  369. package/lib/simple-tree/index.js +1 -1
  370. package/lib/simple-tree/index.js.map +1 -1
  371. package/lib/simple-tree/schemaTypes.d.ts +1 -0
  372. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  373. package/lib/simple-tree/schemaTypes.js.map +1 -1
  374. package/lib/simple-tree/toStoredSchema.d.ts +8 -8
  375. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  376. package/lib/simple-tree/toStoredSchema.js +26 -31
  377. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  378. package/lib/tableSchema.d.ts +302 -83
  379. package/lib/tableSchema.d.ts.map +1 -1
  380. package/lib/tableSchema.js +299 -57
  381. package/lib/tableSchema.js.map +1 -1
  382. package/lib/treeFactory.d.ts +1 -1
  383. package/lib/treeFactory.d.ts.map +1 -1
  384. package/lib/treeFactory.js +30 -75
  385. package/lib/treeFactory.js.map +1 -1
  386. package/package.json +21 -21
  387. package/src/codec/codec.ts +6 -1
  388. package/src/codec/index.ts +1 -0
  389. package/src/core/index.ts +1 -2
  390. package/src/core/schema-stored/index.ts +3 -3
  391. package/src/core/schema-stored/schema.ts +3 -1
  392. package/src/core/schema-stored/storedSchemaRepository.ts +1 -1
  393. package/src/core/schema-view/index.ts +0 -1
  394. package/src/core/schema-view/view.ts +0 -31
  395. package/src/core/tree/persistedTreeTextFormat.ts +2 -2
  396. package/src/feature-libraries/forest-summary/format.ts +2 -2
  397. package/src/feature-libraries/index.ts +7 -1
  398. package/src/feature-libraries/mapTreeCursor.ts +3 -3
  399. package/src/feature-libraries/modular-schema/modularChangeFormat.ts +3 -3
  400. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +38 -9
  401. package/src/feature-libraries/schema-edits/schemaChangeFormat.ts +3 -4
  402. package/src/feature-libraries/schema-index/codec.ts +80 -12
  403. package/src/feature-libraries/schema-index/{format.ts → formatV1.ts} +4 -4
  404. package/src/feature-libraries/schema-index/index.ts +7 -2
  405. package/src/feature-libraries/schema-index/schemaSummarizer.ts +9 -9
  406. package/src/index.ts +1 -0
  407. package/src/packageVersion.ts +1 -1
  408. package/src/shared-tree/independentView.ts +3 -2
  409. package/src/shared-tree/index.ts +2 -0
  410. package/src/shared-tree/schematizeTree.ts +5 -35
  411. package/src/shared-tree/schematizingTreeView.ts +2 -10
  412. package/src/shared-tree/sharedTree.ts +67 -6
  413. package/src/shared-tree/tree.ts +24 -0
  414. package/src/shared-tree/treeAlpha.ts +6 -3
  415. package/src/shared-tree-core/branchCommitEnricher.ts +0 -1
  416. package/src/shared-tree-core/transactionEnricher.ts +4 -1
  417. package/src/simple-tree/api/index.ts +2 -0
  418. package/src/simple-tree/api/schemaFactory.ts +9 -0
  419. package/src/simple-tree/api/storedSchema.ts +24 -13
  420. package/src/simple-tree/api/tree.ts +25 -0
  421. package/src/simple-tree/api/treeBeta.ts +3 -1
  422. package/src/simple-tree/api/treeChangeEvents.ts +84 -0
  423. package/src/simple-tree/api/treeNodeApi.ts +1 -1
  424. package/src/simple-tree/arrayNode.ts +28 -0
  425. package/src/simple-tree/core/getOrCreateNode.ts +1 -1
  426. package/src/simple-tree/core/index.ts +5 -4
  427. package/src/simple-tree/core/treeNode.ts +163 -0
  428. package/src/simple-tree/core/treeNodeKernel.ts +2 -1
  429. package/src/simple-tree/core/treeNodeSchema.ts +3 -1
  430. package/src/simple-tree/core/types.ts +0 -234
  431. package/src/simple-tree/core/withType.ts +1 -1
  432. package/src/simple-tree/index.ts +2 -1
  433. package/src/simple-tree/schemaTypes.ts +1 -0
  434. package/src/simple-tree/toStoredSchema.ts +42 -41
  435. package/src/tableSchema.ts +665 -197
  436. package/src/treeFactory.ts +56 -173
  437. package/dist/core/schema-stored/format.d.ts.map +0 -1
  438. package/dist/core/schema-stored/format.js.map +0 -1
  439. package/dist/feature-libraries/schema-index/format.d.ts.map +0 -1
  440. package/dist/feature-libraries/schema-index/format.js.map +0 -1
  441. package/lib/core/schema-stored/format.d.ts.map +0 -1
  442. package/lib/core/schema-stored/format.js.map +0 -1
  443. package/lib/feature-libraries/schema-index/format.d.ts.map +0 -1
  444. package/lib/feature-libraries/schema-index/format.js.map +0 -1
  445. /package/src/core/schema-stored/{format.ts → formatV1.ts} +0 -0
@@ -13,6 +13,7 @@ import type { IChannelStorageService } from "@fluidframework/datastore-definitio
13
13
  import type {
14
14
  IChannelView,
15
15
  IFluidSerializer,
16
+ SharedKernel,
16
17
  } from "@fluidframework/shared-object-base/internal";
17
18
  import {
18
19
  UsageError,
@@ -46,6 +47,7 @@ import {
46
47
  DetachedFieldIndexSummarizer,
47
48
  FieldKinds,
48
49
  ForestSummarizer,
50
+ SchemaCodecVersion,
49
51
  SchemaSummarizer,
50
52
  TreeCompressionStrategy,
51
53
  buildChunkedForest,
@@ -54,6 +56,7 @@ import {
54
56
  jsonableTreeFromFieldCursor,
55
57
  makeFieldBatchCodec,
56
58
  makeMitigatedChangeFamily,
59
+ makeSchemaCodec,
57
60
  makeTreeChunker,
58
61
  } from "../feature-libraries/index.js";
59
62
  import {
@@ -90,7 +93,14 @@ import { SharedTreeChangeFamily } from "./sharedTreeChangeFamily.js";
90
93
  import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
91
94
  import type { SharedTreeEditBuilder } from "./sharedTreeEditBuilder.js";
92
95
  import { type TreeCheckout, type BranchableTree, createTreeCheckout } from "./treeCheckout.js";
93
- import { type Breakable, breakingClass, throwIfBroken } from "../util/index.js";
96
+ import {
97
+ type Breakable,
98
+ breakingClass,
99
+ type JsonCompatible,
100
+ throwIfBroken,
101
+ } from "../util/index.js";
102
+ // eslint-disable-next-line import/no-internal-modules
103
+ import type { Format } from "../feature-libraries/schema-index/index.js";
94
104
 
95
105
  /**
96
106
  * Copy of data from an {@link ITreePrivate} at some point in time.
@@ -156,7 +166,7 @@ export interface ITreePrivate extends ITreeInternal {
156
166
  */
157
167
  interface ExplicitCodecVersions extends ExplicitCoreCodecVersions {
158
168
  forest: number;
159
- schema: number;
169
+ schema: SchemaCodecVersion;
160
170
  detachedFieldIndex: number;
161
171
  fieldBatch: number;
162
172
  }
@@ -186,18 +196,35 @@ function getCodecVersions(formatVersion: number): ExplicitCodecVersions {
186
196
  return versions;
187
197
  }
188
198
 
199
+ /**
200
+ * The type SharedTree's kernel's view must implement so what when its merged with the underling SharedObject's API it fully implements the required tree API surface ({@link ITreePrivate }).
201
+ */
202
+ export type SharedTreeKernelView = Omit<ITreePrivate, keyof (IChannelView & IFluidLoadable)>;
203
+
189
204
  /**
190
205
  * SharedTreeCore, configured with a good set of indexes and field kinds which will maintain compatibility over time.
191
206
  *
192
207
  * TODO: detail compatibility requirements.
193
208
  */
194
209
  @breakingClass
195
- export class SharedTreeKernel extends SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange> {
210
+ export class SharedTreeKernel
211
+ extends SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>
212
+ implements SharedKernel
213
+ {
196
214
  public readonly checkout: TreeCheckout;
197
215
  public get storedSchema(): TreeStoredSchemaRepository {
198
216
  return this.checkout.storedSchema;
199
217
  }
200
218
 
219
+ /**
220
+ * The app-facing API for SharedTree implemented by this Kernel.
221
+ * @remarks
222
+ * This is the API grafted onto the ISharedObject which apps can access.
223
+ * It includes both the APIs used for internal testing, and public facing APIs (both stable and unstable).
224
+ * Different users will have access to different subsets of this API, see {@link ITree}, {@link ITreeAlpha} and {@link ITreeInternal} which this {@link ITreePrivate} extends.
225
+ */
226
+ public readonly view: SharedTreeKernelView;
227
+
201
228
  public constructor(
202
229
  breaker: Breakable,
203
230
  sharedObject: IChannelView & IFluidLoadable,
@@ -219,9 +246,14 @@ export class SharedTreeKernel extends SharedTreeCore<SharedTreeEditBuilder, Shar
219
246
  idCompressor,
220
247
  options,
221
248
  );
222
- const schemaSummarizer = new SchemaSummarizer(schema, options, {
223
- getCurrentSeq: lastSequenceNumber,
224
- });
249
+ const schemaCodec = makeSchemaCodec(options, codecVersions.schema);
250
+ const schemaSummarizer = new SchemaSummarizer(
251
+ schema,
252
+ {
253
+ getCurrentSeq: lastSequenceNumber,
254
+ },
255
+ schemaCodec,
256
+ );
225
257
  const fieldBatchCodec = makeFieldBatchCodec(options, codecVersions.fieldBatch);
226
258
 
227
259
  const encoderContext = {
@@ -331,6 +363,14 @@ export class SharedTreeKernel extends SharedTreeCore<SharedTreeEditBuilder, Shar
331
363
  }
332
364
  }
333
365
  });
366
+
367
+ this.view = {
368
+ contentSnapshot: () => this.contentSnapshot(),
369
+ exportSimpleSchema: () => this.exportSimpleSchema(),
370
+ exportVerbose: () => this.exportVerbose(),
371
+ viewWith: this.viewWith.bind(this),
372
+ kernel: this,
373
+ };
334
374
  }
335
375
 
336
376
  public exportVerbose(): VerboseTree | undefined {
@@ -450,6 +490,27 @@ export function exportSimpleSchema(storedSchema: TreeStoredSchema): SimpleTreeSc
450
490
  };
451
491
  }
452
492
 
493
+ /**
494
+ * A way to parse schema in the persisted format from {@link extractPersistedSchema}.
495
+ * @remarks
496
+ * This behaves identically to {@link ITreeAlpha.exportSimpleSchema},
497
+ * except that it gets the schema from the caller instead of from an existing tree.
498
+ *
499
+ * This can be useful for inspecting the contents of persisted schema,
500
+ * such as those generated by {@link extractPersistedSchema} for use in testing.
501
+ * Since that data format is otherwise unspecified,
502
+ * this provides a way to inspect its contents with documented semantics.
503
+ * @alpha
504
+ */
505
+ export function persistedToSimpleSchema(
506
+ persisted: JsonCompatible,
507
+ options: ICodecOptions,
508
+ ): SimpleTreeSchema {
509
+ const schemaCodec = makeSchemaCodec(options, SchemaCodecVersion.v1);
510
+ const stored = schemaCodec.decode(persisted as Format);
511
+ return exportSimpleSchema(stored);
512
+ }
513
+
453
514
  /**
454
515
  * Get a {@link BranchableTree} from a {@link ITree}.
455
516
  * @remarks The branch can be used for "version control"-style coordination of edits on the tree.
@@ -96,7 +96,9 @@ export interface RunTransaction {
96
96
  * All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
97
97
  * Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
98
98
  * However, using a transaction has the following additional consequences:
99
+ *
99
100
  * - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
101
+ *
100
102
  * - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
101
103
  *
102
104
  * Local change events will be emitted for each change as the transaction is being applied.
@@ -117,7 +119,9 @@ export interface RunTransaction {
117
119
  * All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
118
120
  * Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
119
121
  * However, using a transaction has the following additional consequences:
122
+ *
120
123
  * - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
124
+ *
121
125
  * - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
122
126
  *
123
127
  * Local change events will be emitted for each change as the transaction is being applied.
@@ -143,7 +147,9 @@ export interface RunTransaction {
143
147
  * All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
144
148
  * Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
145
149
  * However, using a transaction has the following additional consequences:
150
+ *
146
151
  * - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
152
+ *
147
153
  * - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
148
154
  *
149
155
  * Local change events will be emitted for each change as the transaction is being applied.
@@ -165,7 +171,9 @@ export interface RunTransaction {
165
171
  * All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
166
172
  * Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
167
173
  * However, using a transaction has the following additional consequences:
174
+ *
168
175
  * - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
176
+ *
169
177
  * - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
170
178
  *
171
179
  * Local change events will be emitted for each change as the transaction is being applied.
@@ -188,7 +196,9 @@ export interface RunTransaction {
188
196
  * All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
189
197
  * Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
190
198
  * However, using a transaction has the following additional consequences:
199
+ *
191
200
  * - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
201
+ *
192
202
  * - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
193
203
  *
194
204
  * Local change events will be emitted for each change as the transaction is being applied.
@@ -205,7 +215,9 @@ export interface RunTransaction {
205
215
  * All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
206
216
  * Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
207
217
  * However, using a transaction has the following additional consequences:
218
+ *
208
219
  * - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
220
+ *
209
221
  * - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
210
222
  *
211
223
  * Local change events will be emitted for each change as the transaction is being applied.
@@ -229,7 +241,9 @@ export interface RunTransaction {
229
241
  * All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
230
242
  * Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
231
243
  * However, using a transaction has the following additional consequences:
244
+ *
232
245
  * - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
246
+ *
233
247
  * - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
234
248
  *
235
249
  * Local change events will be emitted for each change as the transaction is being applied.
@@ -254,7 +268,9 @@ export interface RunTransaction {
254
268
  * All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
255
269
  * Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
256
270
  * However, using a transaction has the following additional consequences:
271
+ *
257
272
  * - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
273
+ *
258
274
  * - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
259
275
  *
260
276
  * Local change events will be emitted for each change as the transaction is being applied.
@@ -283,7 +299,9 @@ export interface RunTransaction {
283
299
  * All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
284
300
  * Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
285
301
  * However, using a transaction has the following additional consequences:
302
+ *
286
303
  * - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
304
+ *
287
305
  * - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
288
306
  *
289
307
  * Local change events will be emitted for each change as the transaction is being applied.
@@ -309,7 +327,9 @@ export interface RunTransaction {
309
327
  * All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
310
328
  * Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
311
329
  * However, using a transaction has the following additional consequences:
330
+ *
312
331
  * - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
332
+ *
313
333
  * - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
314
334
  *
315
335
  * Local change events will be emitted for each change as the transaction is being applied.
@@ -336,7 +356,9 @@ export interface RunTransaction {
336
356
  * All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
337
357
  * Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
338
358
  * However, using a transaction has the following additional consequences:
359
+ *
339
360
  * - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
361
+ *
340
362
  * - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
341
363
  *
342
364
  * Local change events will be emitted for each change as the transaction is being applied.
@@ -360,7 +382,9 @@ export interface RunTransaction {
360
382
  * All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
361
383
  * Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
362
384
  * However, using a transaction has the following additional consequences:
385
+ *
363
386
  * - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
387
+ *
364
388
  * - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
365
389
  *
366
390
  * Local change events will be emitted for each change as the transaction is being applied.
@@ -34,8 +34,8 @@ import {
34
34
  type VerboseTree,
35
35
  toStoredSchema,
36
36
  extractPersistedSchema,
37
- TreeViewConfiguration,
38
37
  type TreeBranch,
38
+ TreeViewConfigurationAlpha,
39
39
  } from "../simple-tree/index.js";
40
40
  import type { JsonCompatible } from "../util/index.js";
41
41
  import { noopValidator, type FluidClientVersion, type ICodecOptions } from "../codec/index.js";
@@ -52,6 +52,7 @@ import {
52
52
  } from "../feature-libraries/index.js";
53
53
  import { independentInitializedView, type ViewContent } from "./independentView.js";
54
54
  import { SchematizingSimpleTreeView, ViewSlot } from "./schematizingTreeView.js";
55
+ import { currentVersion } from "../codec/index.js";
55
56
 
56
57
  /**
57
58
  * Extensions to {@link (Tree:interface)} and {@link (TreeBeta:interface)} which are not yet stable.
@@ -197,7 +198,9 @@ export interface TreeAlpha {
197
198
  * This API could be improved:
198
199
  *
199
200
  * 1. It could validate that the schema is compatible, and return or throw an error in the invalid case (maybe add a "try" version).
201
+ *
200
202
  * 2. A "try" version of this could return an error if the data isn't in a supported format (as determined by version and/or JasonValidator).
203
+ *
201
204
  * 3. Requiring the caller provide a JsonValidator isn't the most friendly API. It might be practical to provide a default.
202
205
  */
203
206
  importCompressed<const TSchema extends ImplicitFieldSchema>(
@@ -311,12 +314,12 @@ export const TreeAlpha: TreeAlpha = {
311
314
  idCompressor?: IIdCompressor;
312
315
  } & ICodecOptions,
313
316
  ): Unhydrated<TreeFieldFromImplicitField<TSchema>> {
317
+ const config = new TreeViewConfigurationAlpha({ schema });
314
318
  const content: ViewContent = {
315
- schema: extractPersistedSchema(schema),
319
+ schema: extractPersistedSchema(config, currentVersion),
316
320
  tree: compressedData,
317
321
  idCompressor: options.idCompressor ?? createIdCompressor(),
318
322
  };
319
- const config = new TreeViewConfiguration({ schema });
320
323
  const view = independentInitializedView(config, options, content);
321
324
  return TreeBeta.clone<TSchema>(view.root);
322
325
  },
@@ -47,7 +47,6 @@ export class BranchCommitEnricher<TChange> {
47
47
  /**
48
48
  * Process the given change, preparing new commits for {@link BranchCommitEnricher.enrich | enrichment}.
49
49
  * @param change - The change to process.
50
- * @param isAttached - Whether or not the SharedTree is attached to the service.
51
50
  */
52
51
  public processChange(change: SharedTreeBranchChange<TChange>): void {
53
52
  if (change.type === "append") {
@@ -40,12 +40,15 @@ export class TransactionEnricher<TChange> {
40
40
 
41
41
  /**
42
42
  * Commits the current transaction.
43
- * @returns If and only if the closed transaction was the outermost transaction, returns a function which can be used to compute the composed change for that transaction's commits.
43
+ * @returns A function which can be used to compute the composed change for that transaction's commits. Undefined if the transaction is still ongoing or contained no committed changes.
44
44
  */
45
45
  public commitTransaction(): ((revision: RevisionTag) => TChange) | undefined {
46
46
  const commitsCommitted = this.#transactionScopesStart.pop();
47
47
  assert(commitsCommitted !== undefined, 0x985 /* No transaction to commit */);
48
48
  if (this.#transactionScopesStart.length === 0) {
49
+ if (this.#transactionCommits.length === 0) {
50
+ return undefined;
51
+ }
49
52
  const transactionCommits = this.#transactionCommits;
50
53
  this.#transactionCommits = [];
51
54
  return (revision: RevisionTag) =>
@@ -29,6 +29,7 @@ export {
29
29
  type ScopedSchemaName,
30
30
  type SchemaFactoryObjectOptions,
31
31
  type SchemaStatics,
32
+ schemaStatics,
32
33
  } from "./schemaFactory.js";
33
34
  export { SchemaFactoryAlpha } from "./schemaFactoryAlpha.js";
34
35
  export type {
@@ -125,6 +126,7 @@ export {
125
126
 
126
127
  export { generateSchemaFromSimpleSchema } from "./schemaFromSimple.js";
127
128
  export { toSimpleTreeSchema } from "./viewSchemaToSimpleSchema.js";
129
+ export type { TreeChangeEvents } from "./treeChangeEvents.js";
128
130
 
129
131
  // Exporting the schema (RecursiveObject) to test that recursive types are working correctly.
130
132
  // These are `@internal` so they can't be included in the `InternalClassTreeTypes` due to https://github.com/microsoft/rushstack/issues/3639
@@ -182,7 +182,9 @@ export interface SchemaStatics {
182
182
  *
183
183
  * @remarks
184
184
  * The number is a {@link https://en.wikipedia.org/wiki/Double-precision_floating-point_format | double-precision 64-bit binary format IEEE 754} value, however there are some exceptions:
185
+ *
185
186
  * - `NaN`, and the infinities are converted to `null` (and may therefore only be used where `null` is allowed by the schema).
187
+ *
186
188
  * - `-0` may be converted to `0` in some cases.
187
189
  *
188
190
  * These limitations match the limitations of JSON.
@@ -429,9 +431,13 @@ const schemaStaticsPublic: SchemaStatics = schemaStatics;
429
431
  * It is legal to subclass the returned class, and even subclass that class,
430
432
  * but only a single class from that class hierarchy can ever be instantiated or passed to any API as a {@link TreeNodeSchema|schema}.
431
433
  * These base classes can be used with `instanceof`, but not with schema based APIs like `Tree.is`.
434
+ *
432
435
  * 2. If overriding the constructor, the constructor must accept the same argument as the base constructor `super` and forward it to `super` unchanged.
436
+ *
433
437
  * 3. Properties for fields defined in the schema should not be overridden.
438
+ *
434
439
  * 4. Additional static members added to schema should pick relatively unique keys to reduce the risk of colliding with implementation details what are not exposed in the API.
440
+ *
435
441
  * 5. If exporting the schema from a package which uses API-Extractor, export the base class and derived class separately to work around [a known limitation](https://github.com/microsoft/rushstack/issues/4429).
436
442
  *
437
443
  * Note:
@@ -1064,8 +1070,11 @@ export class SchemaFactory<
1064
1070
  * The identifier generated by the SharedTree has the following properties:
1065
1071
  *
1066
1072
  * - It is a UUID which will not collide with other generated UUIDs.
1073
+ *
1067
1074
  * - It is compressed to a space-efficient representation when stored in the document.
1075
+ *
1068
1076
  * - A compressed form of the identifier can be accessed at runtime via the {@link TreeNodeApi.shortId|Tree.shortId()} API.
1077
+ *
1069
1078
  * - It will error if read (and will not be present in the object's iterable properties) before the node has been inserted into a tree.
1070
1079
  *
1071
1080
  * However, a user may alternatively supply their own string as the identifier if desired (for example, if importing identifiers from another system).
@@ -3,29 +3,34 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import type { ICodecOptions } from "../../codec/index.js";
6
+ import type { FluidClientVersion, ICodecOptions } from "../../codec/index.js";
7
7
  import type { TreeStoredSchema } from "../../core/index.js";
8
8
  import {
9
9
  defaultSchemaPolicy,
10
10
  encodeTreeSchema,
11
11
  makeSchemaCodec,
12
+ SchemaCodecVersion,
12
13
  } from "../../feature-libraries/index.js";
13
- // eslint-disable-next-line import/no-internal-modules
14
- import type { Format } from "../../feature-libraries/schema-index/index.js";
14
+ import {
15
+ clientVersionToSchemaVersion,
16
+ type Format,
17
+ // eslint-disable-next-line import/no-internal-modules
18
+ } from "../../feature-libraries/schema-index/index.js";
15
19
  import type { JsonCompatible } from "../../util/index.js";
16
20
  import { normalizeFieldSchema, type ImplicitFieldSchema } from "../schemaTypes.js";
17
- import { toStoredSchema } from "../toStoredSchema.js";
21
+ import { simpleToStoredSchema } from "../toStoredSchema.js";
18
22
  import type { SchemaCompatibilityStatus } from "./tree.js";
19
23
  import { SchemaCompatibilityTester } from "./schemaCompatibilityTester.js";
24
+ import type { SimpleTreeSchema } from "../simpleSchema.js";
20
25
 
21
26
  /**
22
- * Dumps the "persisted" schema subset of the provided `schema` into a deterministic JSON-compatible, semi-human-readable, but unspecified format.
27
+ * Dumps the "persisted" schema subset of the provided `schema` into a deterministic JSON-compatible, semi-human-readable format.
28
+ *
29
+ * @param schema - The schema to dump.
23
30
  *
24
31
  * @remarks
25
32
  * This can be used to help inspect schema for debugging, and to save a snapshot of schema to help detect and review changes to an applications schema.
26
- *
27
- * This format may change across major versions of this package: such changes are considered breaking.
28
- * Beyond that, no compatibility guarantee is provided for this format: it should never be relied upon to load data, it should only be used for comparing outputs from this function.
33
+ * This format is also compatible with {@link ViewContent.schema}, {@link comparePersistedSchema} and {@link persistedToSimpleSchema}.
29
34
  *
30
35
  * This only includes the "persisted" subset of schema information, which means the portion which gets included in documents.
31
36
  * It thus uses "persisted" keys, see {@link FieldProps.key}.
@@ -38,7 +43,7 @@ import { SchemaCompatibilityTester } from "./schemaCompatibilityTester.js";
38
43
  * An application could use this API to generate a `schema.json` file when it first releases,
39
44
  * then test that the schema is sill compatible with documents from that version with a test like :
40
45
  * ```typescript
41
- * assert.deepEqual(extractPersistedSchema(MySchema), require("./schema.json"));
46
+ * assert.deepEqual(extractPersistedSchema(MySchema, FluidClientVersion.v2_0), require("./schema.json"));
42
47
  * ```
43
48
  *
44
49
  * @privateRemarks
@@ -48,9 +53,13 @@ import { SchemaCompatibilityTester } from "./schemaCompatibilityTester.js";
48
53
  * Public API surface uses "persisted" terminology while internally we use "stored".
49
54
  * @alpha
50
55
  */
51
- export function extractPersistedSchema(schema: ImplicitFieldSchema): JsonCompatible {
52
- const stored = toStoredSchema(schema);
53
- return encodeTreeSchema(stored);
56
+ export function extractPersistedSchema(
57
+ schema: SimpleTreeSchema,
58
+ oldestCompatibleClient: FluidClientVersion,
59
+ ): JsonCompatible {
60
+ const stored = simpleToStoredSchema(schema);
61
+ const writeVersion = clientVersionToSchemaVersion(oldestCompatibleClient);
62
+ return encodeTreeSchema(stored, writeVersion);
54
63
  }
55
64
 
56
65
  /**
@@ -89,7 +98,9 @@ export function comparePersistedSchema(
89
98
  options: ICodecOptions,
90
99
  canInitialize: boolean,
91
100
  ): SchemaCompatibilityStatus {
92
- const schemaCodec = makeSchemaCodec(options);
101
+ // Any version can be passed down to makeSchemaCodec here.
102
+ // We only use the decode part, which always dispatches to the correct codec based on the version in the data, not the version passed to `makeSchemaCodec`.
103
+ const schemaCodec = makeSchemaCodec(options, SchemaCodecVersion.v1);
93
104
  const stored = schemaCodec.decode(persisted as Format);
94
105
  const viewSchema = new SchemaCompatibilityTester(
95
106
  defaultSchemaPolicy,
@@ -290,14 +290,18 @@ export interface TreeViewAlpha<
290
290
  * "rollback" can be set to false or left undefined to indicate that the body of the transaction has successfully run.
291
291
  * @param params - The optional parameters for the transaction. It includes the constraints that will be checked before the transaction begins.
292
292
  * @returns A result object of {@link TransactionResultExt | TransactionResultExt} type. It includes the following:
293
+ *
293
294
  * - A "success" flag indicating whether the transaction was successful or not.
295
+ *
294
296
  * - The success of failure value as returned by the transaction function.
295
297
  * @remarks
296
298
  * This API will throw an error if the constraints are not met or something unexpected happens.
297
299
  * All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
298
300
  * Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
299
301
  * However, using a transaction has the following additional consequences:
302
+ *
300
303
  * - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
304
+ *
301
305
  * - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
302
306
  *
303
307
  * Local change events will be emitted for each change as the transaction is being applied.
@@ -305,9 +309,12 @@ export interface TreeViewAlpha<
305
309
  *
306
310
  * Nested transactions:
307
311
  * This API can be called from within the transaction callback of another runTransaction call. That will have slightly different behavior:
312
+ *
308
313
  * - If the inner transaction fails, only the inner transaction will be rolled back and the outer transaction will continue.
314
+ *
309
315
  * - Constraints will apply to the outermost transaction. Constraints are applied per commit and there will be one commit generated
310
316
  * for the outermost transaction which includes all inner transactions.
317
+ *
311
318
  * - Undo will undo the outermost transaction and all inner transactions.
312
319
  */
313
320
  runTransaction<TSuccessValue, TFailureValue>(
@@ -317,10 +324,13 @@ export interface TreeViewAlpha<
317
324
  /**
318
325
  * Run a transaction which applies one or more edits to the tree as a single atomic unit.
319
326
  * @param transaction - The function to run as the body of the transaction. It may return the following:
327
+ *
320
328
  * - Nothing to indicate that the body of the transaction has successfully run.
329
+ *
321
330
  * - A status object of {@link VoidTransactionCallbackStatus | VoidTransactionCallbackStatus } type. It includes a "rollback" property which
322
331
  * may be returned as true at any point during the transaction. This will abort the transaction and discard any changes it made so
323
332
  * far. "rollback" can be set to false or left undefined to indicate that the body of the transaction has successfully run.
333
+ *
324
334
  * @param params - The optional parameters for the transaction. It includes the constraints that will be checked before the transaction begins.
325
335
  * @returns A result object of {@link TransactionResult | TransactionResult} type. It includes a "success" flag indicating whether the
326
336
  * transaction was successful or not.
@@ -329,7 +339,9 @@ export interface TreeViewAlpha<
329
339
  * All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
330
340
  * Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
331
341
  * However, using a transaction has the following additional consequences:
342
+ *
332
343
  * - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
344
+ *
333
345
  * - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
334
346
  *
335
347
  * Local change events will be emitted for each change as the transaction is being applied.
@@ -337,9 +349,12 @@ export interface TreeViewAlpha<
337
349
  *
338
350
  * Nested transactions:
339
351
  * This API can be called from within the transaction callback of another runTransaction call. That will have slightly different behavior:
352
+ *
340
353
  * - If the inner transaction fails, only the inner transaction will be rolled back and the outer transaction will continue.
354
+ *
341
355
  * - Constraints will apply to the outermost transaction. Constraints are applied per commit and there will be one commit generated
342
356
  * for the outermost transaction which includes all inner transactions.
357
+ *
343
358
  * - Undo will undo the outermost transaction and all inner transactions.
344
359
  */
345
360
  runTransaction(
@@ -363,7 +378,9 @@ export interface SchemaCompatibilityStatus {
363
378
  * exact matches in a strict (schema-based) sense but still allow the same documents, and the document notion is more useful to applications.
364
379
  *
365
380
  * Examples which are expressible where this may occur include:
381
+ *
366
382
  * - schema repository `A` has extra schema which schema `B` doesn't have, but they are unused (i.e. not reachable from the root schema)
383
+ *
367
384
  * - field in schema `A` has allowed field members which the corresponding field in schema `B` does not have, but those types are not constructible (ex: an object node type containing a required field with no allowed types)
368
385
  *
369
386
  * These cases are typically not interesting to applications.
@@ -441,11 +458,15 @@ export interface TreeBranchEvents extends Omit<TreeViewEvents, "commitApplied">
441
458
 
442
459
  /**
443
460
  * Fired when:
461
+ *
444
462
  * - a local commit is applied outside of a transaction
463
+ *
445
464
  * - a local transaction is committed
446
465
  *
447
466
  * The event is not fired when:
467
+ *
448
468
  * - a local commit is applied within a transaction
469
+ *
449
470
  * - a remote commit is applied
450
471
  *
451
472
  * @param data - information about the commit that was applied
@@ -481,11 +502,15 @@ export interface TreeViewEvents {
481
502
 
482
503
  /**
483
504
  * Fired when:
505
+ *
484
506
  * - a local commit is applied outside of a transaction
507
+ *
485
508
  * - a local transaction is committed
486
509
  *
487
510
  * The event is not fired when:
511
+ *
488
512
  * - a local commit is applied within a transaction
513
+ *
489
514
  * - a remote commit is applied
490
515
  *
491
516
  * @param data - information about the commit that was applied
@@ -7,7 +7,6 @@ import {
7
7
  getKernel,
8
8
  isTreeNode,
9
9
  type NodeKind,
10
- type TreeChangeEvents,
11
10
  type TreeNode,
12
11
  type Unhydrated,
13
12
  type WithType,
@@ -15,6 +14,7 @@ import {
15
14
  import { treeNodeApi } from "./treeNodeApi.js";
16
15
  import { createFromCursor } from "./create.js";
17
16
  import type { ImplicitFieldSchema, TreeFieldFromImplicitField } from "../schemaTypes.js";
17
+ import type { TreeChangeEvents } from "./treeChangeEvents.js";
18
18
 
19
19
  // Tests for this file are grouped with those for treeNodeApi.ts as that is where this functionality will eventually land,
20
20
  // and where most of the actual implementation is for much of it.
@@ -122,7 +122,9 @@ export interface TreeBeta {
122
122
  *
123
123
  * - Local state, such as properties added to customized schema classes, will not be cloned. However, they will be
124
124
  * initialized to their default state just as if the node had been created via its constructor.
125
+ *
125
126
  * - Value node types (i.e., numbers, strings, booleans, nulls and Fluid handles) will be returned as is.
127
+ *
126
128
  * - The identifiers in the node's subtree will be preserved, i.e., they are not replaced with new values.
127
129
  */
128
130
  clone<const TSchema extends ImplicitFieldSchema>(