@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
@@ -9,7 +9,7 @@ import type { Listenable } from "@fluidframework/core-interfaces/internal";
9
9
  import { createEmitter } from "@fluid-internal/client-utils";
10
10
  import { compareStrings } from "../../util/index.js";
11
11
 
12
- import type { TreeNodeSchemaIdentifier } from "./format.js";
12
+ import type { TreeNodeSchemaIdentifier } from "./formatV1.js";
13
13
  import {
14
14
  type StoredSchemaCollection,
15
15
  type TreeFieldStoredSchema,
@@ -7,5 +7,4 @@ export {
7
7
  type Adapters,
8
8
  type TreeAdapter,
9
9
  AdaptedViewSchema,
10
- AllowedUpdateType,
11
10
  } from "./view.js";
@@ -9,37 +9,6 @@ import type { TreeNodeSchemaIdentifier, TreeStoredSchema } from "../schema-store
9
9
  * APIs for applying `view schema` to documents.
10
10
  */
11
11
 
12
- /**
13
- * What kinds of updates to stored schema to permit.
14
- *
15
- * Bit flags enum.
16
- */
17
- export enum AllowedUpdateType {
18
- /**
19
- * Do not update the stored schema to match view schema.
20
- */
21
- None = 0,
22
- /**
23
- * Update the stored schema as part of initializing an empty document.
24
- *
25
- * Includes "Initialize".
26
- */
27
- // eslint-disable-next-line no-bitwise
28
- Initialize = 1 << 0,
29
- /**
30
- * Update the stored schema to match the view schema if the current document contents are compatible with the view schema.
31
- * TODO: support this option.
32
- */
33
- // DataCompatible,
34
- /**
35
- * Update the stored schema to match view schema if all possible documents based on the current stored schema would be compatible with the view schema.
36
- *
37
- * Includes "Initialize".
38
- */
39
- // eslint-disable-next-line no-bitwise
40
- SchemaCompatible = 1 << 1,
41
- }
42
-
43
12
  /**
44
13
  */
45
14
  export interface TreeAdapter {
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { type Static, type TSchema, Type } from "@sinclair/typebox";
7
7
 
8
- import { schemaFormat } from "../schema-stored/index.js";
8
+ import { schemaFormatV1 } from "../schema-stored/index.js";
9
9
 
10
10
  /**
11
11
  * This module contains persisted types for a simple, human-readable tree format.
@@ -58,7 +58,7 @@ const EncodedFieldMapObject = <Schema extends TSchema>(tChild: Schema) =>
58
58
  type EncodedNodeData = Static<typeof EncodedNodeData>;
59
59
  const EncodedNodeData = Type.Object({
60
60
  value: Type.Optional(Type.Any()),
61
- type: Type.Readonly(schemaFormat.TreeNodeSchemaIdentifierSchema),
61
+ type: Type.Readonly(schemaFormatV1.TreeNodeSchemaIdentifierSchema),
62
62
  });
63
63
 
64
64
  /**
@@ -6,14 +6,14 @@
6
6
  import { type Static, Type } from "@sinclair/typebox";
7
7
 
8
8
  import { Versioned } from "../../codec/index.js";
9
- import { schemaFormat } from "../../core/index.js";
9
+ import { schemaFormatV1 } from "../../core/index.js";
10
10
 
11
11
  export const version = 1.0;
12
12
 
13
13
  export const Format = Type.Object(
14
14
  {
15
15
  version: Type.Literal(version),
16
- keys: Type.Array(schemaFormat.FieldKeySchema),
16
+ keys: Type.Array(schemaFormatV1.FieldKeySchema),
17
17
  fields: Versioned,
18
18
  },
19
19
  { additionalProperties: false },
@@ -17,7 +17,13 @@ export {
17
17
  mapTreeFieldFromCursor,
18
18
  } from "./mapTreeCursor.js";
19
19
  export { buildForest } from "./object-forest/index.js";
20
- export { SchemaSummarizer, encodeTreeSchema, makeSchemaCodec } from "./schema-index/index.js";
20
+ export {
21
+ SchemaSummarizer,
22
+ encodeTreeSchema,
23
+ makeSchemaCodec,
24
+ makeSchemaCodecs,
25
+ SchemaCodecVersion,
26
+ } from "./schema-index/index.js";
21
27
  export {
22
28
  stackTreeNodeCursor,
23
29
  type CursorAdapter,
@@ -26,17 +26,17 @@ import {
26
26
  } from "./treeCursorUtils.js";
27
27
 
28
28
  /**
29
- * @returns An {@link ITreeCursorSynchronous} in nodes mode for a single {@link MapTree}.
29
+ * Returns an {@link ITreeCursorSynchronous} in nodes mode for a single {@link MapTree}.
30
30
  */
31
31
  export function cursorForMapTreeNode(root: MapTree): CursorWithNode<MapTree> {
32
32
  return stackTreeNodeCursor(adapter, root);
33
33
  }
34
34
 
35
35
  /**
36
- * @returns an {@link ITreeCursorSynchronous} in fields mode for a MapTree field.
36
+ * Returns an {@link ITreeCursorSynchronous} in fields mode for a MapTree field.
37
37
  */
38
38
  export function cursorForMapTreeField(
39
- root: MapTree[],
39
+ root: readonly MapTree[],
40
40
  detachedField: DetachedField = rootField,
41
41
  ): CursorWithNode<MapTree> {
42
42
  const key = detachedFieldAsKey(detachedField);
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { type ObjectOptions, type Static, Type } from "@sinclair/typebox";
7
7
 
8
- import { type ChangesetLocalId, RevisionTagSchema, schemaFormat } from "../../core/index.js";
8
+ import { type ChangesetLocalId, RevisionTagSchema, schemaFormatV1 } from "../../core/index.js";
9
9
  import {
10
10
  type JsonCompatibleReadOnly,
11
11
  JsonCompatibleReadOnlySchema,
@@ -27,8 +27,8 @@ export type EncodedChangeAtomId = Static<typeof EncodedChangeAtomId>;
27
27
 
28
28
  const EncodedFieldChange = Type.Object(
29
29
  {
30
- fieldKey: schemaFormat.FieldKeySchema,
31
- fieldKind: schemaFormat.FieldKindIdentifierSchema,
30
+ fieldKey: schemaFormatV1.FieldKeySchema,
31
+ fieldKind: schemaFormatV1.FieldKindIdentifierSchema,
32
32
  // Implementation note: node and field change encoding is mutually recursive.
33
33
  // This field marks a boundary in that recursion to avoid constructing excessively complex
34
34
  // recursive types. Encoded changes are validated at this boundary at runtime--see modularChangeCodecs.ts.
@@ -10,21 +10,50 @@ import {
10
10
  type ICodecOptions,
11
11
  type IJsonCodec,
12
12
  makeCodecFamily,
13
+ makeVersionDispatchingCodec,
13
14
  withSchemaValidation,
14
15
  } from "../../codec/index.js";
15
- import { makeSchemaCodec } from "../schema-index/index.js";
16
+ import {
17
+ makeSchemaCodec,
18
+ SchemaCodecVersion,
19
+ type Format as FormatV1,
20
+ } from "../schema-index/index.js";
16
21
 
17
22
  import { EncodedSchemaChange } from "./schemaChangeFormat.js";
18
23
  import type { SchemaChange } from "./schemaChangeTypes.js";
19
24
 
25
+ /**
26
+ * Create a family of schema change codecs.
27
+ * @param options - Specifies common codec options, including which `validator` to use.
28
+ * @returns The composed codec family.
29
+ */
20
30
  export function makeSchemaChangeCodecs(options: ICodecOptions): ICodecFamily<SchemaChange> {
21
- return makeCodecFamily([[1, makeSchemaChangeCodec(options)]]);
31
+ return makeCodecFamily([[SchemaCodecVersion.v1, makeSchemaChangeCodecV1(options)]]);
32
+ }
33
+
34
+ /**
35
+ * Create a schema change codec.
36
+ * @param options - Specifies common codec options, including which `validator` to use.
37
+ * @param writeVersion - The schema change write version.
38
+ * @returns The composed codec.
39
+ */
40
+ export function makeSchemaChangeCodec(
41
+ options: ICodecOptions,
42
+ writeVersion: SchemaCodecVersion,
43
+ ): IJsonCodec<SchemaChange> {
44
+ const family = makeSchemaChangeCodecs(options);
45
+ return makeVersionDispatchingCodec(family, { ...options, writeVersion });
22
46
  }
23
47
 
24
- function makeSchemaChangeCodec({
25
- jsonValidator: validator,
26
- }: ICodecOptions): IJsonCodec<SchemaChange, EncodedSchemaChange> {
27
- const schemaCodec = makeSchemaCodec({ jsonValidator: validator });
48
+ /**
49
+ * Compose the v1 schema change codec.
50
+ * @param options - The codec options.
51
+ * @returns The composed schema change codec.
52
+ */
53
+ function makeSchemaChangeCodecV1(
54
+ options: ICodecOptions,
55
+ ): IJsonCodec<SchemaChange, EncodedSchemaChange> {
56
+ const schemaCodec = makeSchemaCodec(options, SchemaCodecVersion.v1);
28
57
  const schemaChangeCodec: IJsonCodec<SchemaChange, EncodedSchemaChange> = {
29
58
  encode: (schemaChange) => {
30
59
  assert(
@@ -32,8 +61,8 @@ function makeSchemaChangeCodec({
32
61
  0x933 /* Inverse schema changes should never be transmitted */,
33
62
  );
34
63
  return {
35
- new: schemaCodec.encode(schemaChange.schema.new),
36
- old: schemaCodec.encode(schemaChange.schema.old),
64
+ new: schemaCodec.encode(schemaChange.schema.new) as FormatV1,
65
+ old: schemaCodec.encode(schemaChange.schema.old) as FormatV1,
37
66
  };
38
67
  },
39
68
  decode: (encoded) => {
@@ -48,5 +77,5 @@ function makeSchemaChangeCodec({
48
77
  encodedSchema: EncodedSchemaChange,
49
78
  };
50
79
 
51
- return withSchemaValidation(EncodedSchemaChange, schemaChangeCodec, validator);
80
+ return withSchemaValidation(EncodedSchemaChange, schemaChangeCodec, options.jsonValidator);
52
81
  }
@@ -4,12 +4,11 @@
4
4
  */
5
5
 
6
6
  import { type Static, Type } from "@sinclair/typebox";
7
-
8
- import { Format } from "../schema-index/index.js";
7
+ import { Format as FormatV1 } from "../schema-index/index.js";
9
8
 
10
9
  export const EncodedSchemaChange = Type.Object({
11
- new: Format,
12
- old: Format,
10
+ new: FormatV1,
11
+ old: FormatV1,
13
12
  });
14
13
 
15
14
  export type EncodedSchemaChange = Static<typeof EncodedSchemaChange>;
@@ -3,10 +3,14 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { fail } from "@fluidframework/core-utils/internal";
6
+ import { fail, unreachableCase } from "@fluidframework/core-utils/internal";
7
7
  import {
8
+ type FluidClientVersion,
9
+ type ICodecFamily,
8
10
  type ICodecOptions,
9
11
  type IJsonCodec,
12
+ makeCodecFamily,
13
+ makeVersionDispatchingCodec,
10
14
  makeVersionedValidatedCodec,
11
15
  } from "../../codec/index.js";
12
16
  import {
@@ -15,15 +19,77 @@ import {
15
19
  type TreeStoredSchema,
16
20
  decodeFieldSchema,
17
21
  encodeFieldSchema,
18
- schemaFormat,
22
+ schemaFormatV1,
19
23
  storedSchemaDecodeDispatcher,
20
24
  } from "../../core/index.js";
21
- import { brand } from "../../util/index.js";
25
+ import { brand, type JsonCompatible } from "../../util/index.js";
22
26
 
23
- import { Format } from "./format.js";
27
+ import { Format as FormatV1 } from "./formatV1.js";
24
28
 
25
- export function encodeRepo(repo: TreeStoredSchema): Format {
26
- const nodeSchema: Record<string, schemaFormat.TreeNodeSchemaDataFormat> =
29
+ /**
30
+ * Versions for the codec that encodes an in-memory representation of a stored schema {@link TreeStoredSchema} into a persisted format (or decodes it in the opposite direction).
31
+ */
32
+ export enum SchemaCodecVersion {
33
+ v1 = 1,
34
+ }
35
+
36
+ /**
37
+ * Convert a FluidClientVersion to a SchemaCodecVersion.
38
+ * @param clientVersion - The FluidClientVersion to convert.
39
+ * @returns The SchemaCodecVersion that corresponds to the provided FluidClientVersion.
40
+ */
41
+ export function clientVersionToSchemaVersion(
42
+ clientVersion: FluidClientVersion,
43
+ ): SchemaCodecVersion {
44
+ // Only one version of the schema codec is currently supported.
45
+ return SchemaCodecVersion.v1;
46
+ }
47
+
48
+ /**
49
+ * Create a schema codec.
50
+ * @param options - Specifies common codec options, including which `validator` to use.
51
+ * @param writeVersion - The schema write version.
52
+ * @returns The composed codec.
53
+ *
54
+ * @privateRemarks We should consider using the Shared Tree format version instead as it may be more valuable for application authors than the schema version.
55
+ */
56
+ export function makeSchemaCodec(
57
+ options: ICodecOptions,
58
+ writeVersion: SchemaCodecVersion,
59
+ ): IJsonCodec<TreeStoredSchema> {
60
+ const family = makeSchemaCodecs(options);
61
+ return makeVersionDispatchingCodec(family, { ...options, writeVersion });
62
+ }
63
+
64
+ /**
65
+ * Create a family of schema codecs.
66
+ * @param options - Specifies common codec options, including which `validator` to use.
67
+ * @returns The composed codec family.
68
+ */
69
+ export function makeSchemaCodecs(options: ICodecOptions): ICodecFamily<TreeStoredSchema> {
70
+ return makeCodecFamily([[SchemaCodecVersion.v1, makeSchemaCodecV1(options)]]);
71
+ }
72
+
73
+ /**
74
+ * Encode an in-memory TreeStoredSchema into the specified format version.
75
+ * @param repo - The in-memory schema.
76
+ * @param version - The schema write version.
77
+ * @returns The encoded schema.
78
+ */
79
+ export function encodeRepo(
80
+ repo: TreeStoredSchema,
81
+ version: SchemaCodecVersion,
82
+ ): JsonCompatible {
83
+ switch (version) {
84
+ case SchemaCodecVersion.v1:
85
+ return encodeRepoV1(repo);
86
+ default:
87
+ unreachableCase(version);
88
+ }
89
+ }
90
+
91
+ function encodeRepoV1(repo: TreeStoredSchema): FormatV1 {
92
+ const nodeSchema: Record<string, schemaFormatV1.TreeNodeSchemaDataFormat> =
27
93
  Object.create(null);
28
94
  const rootFieldSchema = encodeFieldSchema(repo.rootFieldSchema);
29
95
  for (const name of [...repo.nodeSchema.keys()].sort()) {
@@ -36,13 +102,13 @@ export function encodeRepo(repo: TreeStoredSchema): Format {
36
102
  });
37
103
  }
38
104
  return {
39
- version: schemaFormat.version,
105
+ version: schemaFormatV1.version,
40
106
  nodes: nodeSchema,
41
107
  root: rootFieldSchema,
42
108
  };
43
109
  }
44
110
 
45
- function decode(f: Format): TreeStoredSchema {
111
+ function decode(f: FormatV1): TreeStoredSchema {
46
112
  const nodeSchema: Map<TreeNodeSchemaIdentifier, TreeNodeStoredSchema> = new Map();
47
113
  for (const [key, schema] of Object.entries(f.nodes)) {
48
114
  nodeSchema.set(brand(key), storedSchemaDecodeDispatcher.dispatch(schema));
@@ -55,10 +121,12 @@ function decode(f: Format): TreeStoredSchema {
55
121
 
56
122
  /**
57
123
  * Creates a codec which performs synchronous monolithic encoding of schema content.
124
+ * @param options - Specifies common codec options, including which `validator` to use.
125
+ * @returns The codec.
58
126
  */
59
- export function makeSchemaCodec(options: ICodecOptions): IJsonCodec<TreeStoredSchema, Format> {
60
- return makeVersionedValidatedCodec(options, new Set([schemaFormat.version]), Format, {
61
- encode: (data: TreeStoredSchema) => encodeRepo(data),
62
- decode: (data: Format) => decode(data),
127
+ function makeSchemaCodecV1(options: ICodecOptions): IJsonCodec<TreeStoredSchema, FormatV1> {
128
+ return makeVersionedValidatedCodec(options, new Set([schemaFormatV1.version]), FormatV1, {
129
+ encode: (data: TreeStoredSchema) => encodeRepoV1(data),
130
+ decode: (data: FormatV1) => decode(data),
63
131
  });
64
132
  }
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { type ObjectOptions, type Static, Type } from "@sinclair/typebox";
7
7
 
8
- import { schemaFormat } from "../../core/index.js";
8
+ import { schemaFormatV1 } from "../../core/index.js";
9
9
 
10
10
  const noAdditionalProps: ObjectOptions = { additionalProperties: false };
11
11
 
@@ -21,9 +21,9 @@ const noAdditionalProps: ObjectOptions = { additionalProperties: false };
21
21
  */
22
22
  export const Format = Type.Object(
23
23
  {
24
- version: Type.Literal(schemaFormat.version),
25
- nodes: Type.Record(Type.String(), schemaFormat.TreeNodeSchemaDataFormat),
26
- root: schemaFormat.FieldSchemaFormat,
24
+ version: Type.Literal(schemaFormatV1.version),
25
+ nodes: Type.Record(Type.String(), schemaFormatV1.TreeNodeSchemaDataFormat),
26
+ root: schemaFormatV1.FieldSchemaFormat,
27
27
  },
28
28
  noAdditionalProps,
29
29
  );
@@ -4,5 +4,10 @@
4
4
  */
5
5
 
6
6
  export { SchemaSummarizer, encodeTreeSchema } from "./schemaSummarizer.js";
7
- export { makeSchemaCodec } from "./codec.js";
8
- export { Format } from "./format.js";
7
+ export {
8
+ makeSchemaCodec,
9
+ makeSchemaCodecs,
10
+ SchemaCodecVersion,
11
+ clientVersionToSchemaVersion,
12
+ } from "./codec.js";
13
+ export { Format } from "./formatV1.js";
@@ -14,7 +14,7 @@ import type {
14
14
  } from "@fluidframework/runtime-definitions/internal";
15
15
  import { SummaryTreeBuilder } from "@fluidframework/runtime-utils/internal";
16
16
 
17
- import type { ICodecOptions, IJsonCodec } from "../../codec/index.js";
17
+ import type { IJsonCodec } from "../../codec/index.js";
18
18
  import {
19
19
  type MutableTreeStoredSchema,
20
20
  type TreeStoredSchema,
@@ -27,8 +27,8 @@ import type {
27
27
  } from "../../shared-tree-core/index.js";
28
28
  import type { CollabWindow } from "../incrementalSummarizationUtils.js";
29
29
 
30
- import { encodeRepo, makeSchemaCodec } from "./codec.js";
31
- import type { Format } from "./format.js";
30
+ import { encodeRepo } from "./codec.js";
31
+ import type { JsonCompatible } from "../../util/index.js";
32
32
 
33
33
  const schemaStringKey = "SchemaString";
34
34
  /**
@@ -37,16 +37,13 @@ const schemaStringKey = "SchemaString";
37
37
  export class SchemaSummarizer implements Summarizable {
38
38
  public readonly key = "Schema";
39
39
 
40
- private readonly codec: IJsonCodec<TreeStoredSchema, Format>;
41
-
42
40
  private schemaIndexLastChangedSeq: number | undefined;
43
41
 
44
42
  public constructor(
45
43
  private readonly schema: MutableTreeStoredSchema,
46
- options: ICodecOptions,
47
44
  collabWindow: CollabWindow,
45
+ private readonly codec: IJsonCodec<TreeStoredSchema>,
48
46
  ) {
49
- this.codec = makeSchemaCodec(options);
50
47
  this.schema.events.on("afterSchemaChange", () => {
51
48
  // Invalidate the cache, as we need to regenerate the blob if the schema changes
52
49
  // We are assuming that schema changes from remote ops are valid, as we are in a summarization context.
@@ -116,6 +113,9 @@ export class SchemaSummarizer implements Summarizable {
116
113
  * @remarks
117
114
  * 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.
118
115
  */
119
- export function encodeTreeSchema(schema: TreeStoredSchema): Format {
120
- return encodeRepo(schema);
116
+ export function encodeTreeSchema(
117
+ schema: TreeStoredSchema,
118
+ writeVersion: number,
119
+ ): JsonCompatible {
120
+ return encodeRepo(schema, writeVersion);
121
121
  }
package/src/index.ts CHANGED
@@ -254,6 +254,7 @@ export {
254
254
  configuredSharedTree,
255
255
  } from "./treeFactory.js";
256
256
  export { SharedTreeAttributes, SharedTreeFactoryType } from "./sharedTreeAttributes.js";
257
+ export { persistedToSimpleSchema } from "./shared-tree/index.js";
257
258
 
258
259
  export {
259
260
  type ICodecOptions,
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/tree";
9
- export const pkgVersion = "2.40.0-336023";
9
+ export const pkgVersion = "2.40.0";
@@ -23,9 +23,10 @@ import {
23
23
  defaultSchemaPolicy,
24
24
  TreeCompressionStrategy,
25
25
  initializeForest,
26
+ SchemaCodecVersion,
26
27
  } from "../feature-libraries/index.js";
27
28
  // eslint-disable-next-line import/no-internal-modules
28
- import type { Format } from "../feature-libraries/schema-index/format.js";
29
+ import type { Format } from "../feature-libraries/schema-index/formatV1.js";
29
30
  import type {
30
31
  TreeViewConfiguration,
31
32
  ImplicitFieldSchema,
@@ -92,7 +93,7 @@ export function independentInitializedView<const TSchema extends ImplicitFieldSc
92
93
  const revisionTagCodec = new RevisionTagCodec(idCompressor);
93
94
 
94
95
  const fieldBatchCodec = makeFieldBatchCodec(options, 1);
95
- const schemaCodec = makeSchemaCodec(options);
96
+ const schemaCodec = makeSchemaCodec(options, SchemaCodecVersion.v1);
96
97
 
97
98
  const schema = new TreeStoredSchemaRepository(schemaCodec.decode(content.schema as Format));
98
99
  const forest = buildConfiguredForest(
@@ -21,6 +21,8 @@ export {
21
21
  ForestTypeExpensiveDebug,
22
22
  ForestTypeReference,
23
23
  exportSimpleSchema,
24
+ type SharedTreeKernelView,
25
+ persistedToSimpleSchema,
24
26
  } from "./sharedTree.js";
25
27
 
26
28
  export {
@@ -6,7 +6,6 @@
6
6
  import { assert, unreachableCase, fail } from "@fluidframework/core-utils/internal";
7
7
 
8
8
  import {
9
- AllowedUpdateType,
10
9
  CursorLocationType,
11
10
  type ITreeCursorSynchronous,
12
11
  type TreeStoredSchema,
@@ -21,7 +20,6 @@ import {
21
20
  mapTreeFromCursor,
22
21
  } from "../feature-libraries/index.js";
23
22
  import { isReadonlyArray } from "../util/index.js";
24
-
25
23
  import type { ITreeCheckout } from "./treeCheckout.js";
26
24
  import type { SchemaCompatibilityTester } from "../simple-tree/index.js";
27
25
 
@@ -98,10 +96,6 @@ export enum UpdateType {
98
96
  * Already compatible, no update needed.
99
97
  */
100
98
  None,
101
- /**
102
- * Empty: needs initializing.
103
- */
104
- Initialize,
105
99
  /**
106
100
  * Schema can be upgraded leaving tree as is.
107
101
  */
@@ -112,9 +106,11 @@ export enum UpdateType {
112
106
  Incompatible,
113
107
  }
114
108
 
109
+ /**
110
+ * Returns how compatible updating checkout's schema is with the viewSchema.
111
+ */
115
112
  export function evaluateUpdate(
116
113
  viewSchema: SchemaCompatibilityTester,
117
- allowedSchemaModifications: AllowedUpdateType,
118
114
  checkout: ITreeCheckout,
119
115
  ): UpdateType {
120
116
  const compatibility = viewSchema.checkCompatibility(checkout.storedSchema);
@@ -124,11 +120,6 @@ export function evaluateUpdate(
124
120
  return UpdateType.None;
125
121
  }
126
122
 
127
- // eslint-disable-next-line no-bitwise
128
- if (allowedSchemaModifications & AllowedUpdateType.Initialize && canInitialize(checkout)) {
129
- return UpdateType.Initialize;
130
- }
131
-
132
123
  if (!compatibility.canUpgrade) {
133
124
  // Existing stored schema permits trees which are incompatible with the view schema, so schema can not be updated
134
125
  return UpdateType.Incompatible;
@@ -137,10 +128,7 @@ export function evaluateUpdate(
137
128
  assert(!compatibility.canView, 0x8bd /* unexpected case */);
138
129
  assert(compatibility.canUpgrade, 0x8be /* unexpected case */);
139
130
 
140
- // eslint-disable-next-line no-bitwise
141
- return allowedSchemaModifications & AllowedUpdateType.SchemaCompatible
142
- ? UpdateType.SchemaCompatible
143
- : UpdateType.Incompatible;
131
+ return UpdateType.SchemaCompatible;
144
132
  }
145
133
 
146
134
  export function canInitialize(checkout: ITreeCheckout): boolean {
@@ -222,17 +210,9 @@ export function initialize(checkout: ITreeCheckout, treeContent: TreeStoredConte
222
210
  */
223
211
  export function ensureSchema(
224
212
  viewSchema: SchemaCompatibilityTester,
225
- allowedSchemaModifications: AllowedUpdateType,
226
213
  checkout: ITreeCheckout,
227
- treeContent: TreeStoredContent | undefined,
228
214
  ): boolean {
229
- let possibleModifications = allowedSchemaModifications;
230
- if (treeContent === undefined) {
231
- // Clear bit for Initialize if initial tree is not provided.
232
- // eslint-disable-next-line no-bitwise
233
- possibleModifications &= ~AllowedUpdateType.Initialize;
234
- }
235
- const updatedNeeded = evaluateUpdate(viewSchema, possibleModifications, checkout);
215
+ const updatedNeeded = evaluateUpdate(viewSchema, checkout);
236
216
  switch (updatedNeeded) {
237
217
  case UpdateType.None: {
238
218
  return true;
@@ -244,16 +224,6 @@ export function ensureSchema(
244
224
  checkout.updateSchema(viewSchema.viewSchemaAsStored);
245
225
  return true;
246
226
  }
247
- case UpdateType.Initialize: {
248
- if (treeContent === undefined) {
249
- return false;
250
- }
251
- // TODO:
252
- // When this becomes a more proper out of schema adapter, editing should be made lazy.
253
- // This will improve support for readonly documents, cross version collaboration and attribution.
254
- initialize(checkout, treeContent);
255
- return true;
256
- }
257
227
  default: {
258
228
  unreachableCase(updatedNeeded);
259
229
  }
@@ -12,7 +12,7 @@ import { createEmitter } from "@fluid-internal/client-utils";
12
12
  import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
13
13
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
14
14
 
15
- import { AllowedUpdateType, anchorSlot, type SchemaPolicy } from "../core/index.js";
15
+ import { anchorSlot, type SchemaPolicy } from "../core/index.js";
16
16
  import {
17
17
  type NodeIdentifierManager,
18
18
  defaultSchemaPolicy,
@@ -207,15 +207,7 @@ export class SchematizingSimpleTreeView<
207
207
  }
208
208
 
209
209
  this.runSchemaEdit(() => {
210
- const result = ensureSchema(
211
- this.viewSchema,
212
- AllowedUpdateType.SchemaCompatible,
213
- this.checkout,
214
- {
215
- schema: this.viewSchema.viewSchemaAsStored,
216
- initialTree: undefined,
217
- },
218
- );
210
+ const result = ensureSchema(this.viewSchema, this.checkout);
219
211
  assert(result, 0x8bf /* Schema upgrade should always work if canUpgrade is set. */);
220
212
  });
221
213
  }