@fluidframework/tree 2.41.0 → 2.43.0-343119

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 (673) hide show
  1. package/.vscode/settings.json +1 -0
  2. package/CHANGELOG.md +33 -0
  3. package/api-report/tree.alpha.api.md +70 -28
  4. package/api-report/tree.beta.api.md +33 -0
  5. package/dist/alpha.d.ts +12 -6
  6. package/dist/beta.d.ts +6 -1
  7. package/dist/codec/codec.d.ts +23 -3
  8. package/dist/codec/codec.d.ts.map +1 -1
  9. package/dist/codec/codec.js.map +1 -1
  10. package/dist/codec/index.d.ts +1 -1
  11. package/dist/codec/index.d.ts.map +1 -1
  12. package/dist/codec/index.js.map +1 -1
  13. package/dist/codec/versioned/codec.d.ts +35 -2
  14. package/dist/codec/versioned/codec.d.ts.map +1 -1
  15. package/dist/codec/versioned/codec.js +38 -3
  16. package/dist/codec/versioned/codec.js.map +1 -1
  17. package/dist/core/index.d.ts +1 -1
  18. package/dist/core/index.d.ts.map +1 -1
  19. package/dist/core/index.js +5 -2
  20. package/dist/core/index.js.map +1 -1
  21. package/dist/core/schema-stored/formatV2.d.ts +80 -0
  22. package/dist/core/schema-stored/formatV2.d.ts.map +1 -0
  23. package/dist/core/schema-stored/formatV2.js +55 -0
  24. package/dist/core/schema-stored/formatV2.js.map +1 -0
  25. package/dist/core/schema-stored/index.d.ts +3 -1
  26. package/dist/core/schema-stored/index.d.ts.map +1 -1
  27. package/dist/core/schema-stored/index.js +5 -2
  28. package/dist/core/schema-stored/index.js.map +1 -1
  29. package/dist/core/schema-stored/schema.d.ts +49 -17
  30. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  31. package/dist/core/schema-stored/schema.js +65 -22
  32. package/dist/core/schema-stored/schema.js.map +1 -1
  33. package/dist/core/tree/detachedFieldIndex.d.ts +2 -2
  34. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  35. package/dist/core/tree/detachedFieldIndex.js +5 -1
  36. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  37. package/dist/core/tree/mapTree.d.ts +2 -1
  38. package/dist/core/tree/mapTree.d.ts.map +1 -1
  39. package/dist/core/tree/mapTree.js +11 -5
  40. package/dist/core/tree/mapTree.js.map +1 -1
  41. package/dist/core/tree/visitorUtils.d.ts +2 -2
  42. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  43. package/dist/core/tree/visitorUtils.js.map +1 -1
  44. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +9 -7
  45. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  46. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +13 -9
  47. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  48. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +3 -3
  49. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  50. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +6 -6
  51. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  52. package/dist/feature-libraries/chunked-forest/codec/nodeShape.d.ts +1 -1
  53. package/dist/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
  54. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js +3 -3
  55. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  56. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +3 -2
  57. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  58. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  59. package/dist/feature-libraries/default-schema/schemaChecker.d.ts +4 -3
  60. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  61. package/dist/feature-libraries/default-schema/schemaChecker.js +4 -3
  62. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  63. package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts +8 -3
  64. package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
  65. package/dist/feature-libraries/detachedFieldIndexSummarizer.js +2 -5
  66. package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  67. package/dist/feature-libraries/flex-tree/context.d.ts +14 -6
  68. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  69. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  70. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +48 -29
  71. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  72. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +4 -0
  73. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  74. package/dist/feature-libraries/flex-tree/index.d.ts +2 -3
  75. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  76. package/dist/feature-libraries/flex-tree/index.js +1 -7
  77. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  78. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts +2 -2
  79. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  80. package/dist/feature-libraries/flex-tree/lazyEntity.js +3 -0
  81. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  82. package/dist/feature-libraries/flex-tree/lazyField.d.ts +6 -7
  83. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  84. package/dist/feature-libraries/flex-tree/lazyField.js +2 -5
  85. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  86. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +8 -7
  87. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  88. package/dist/feature-libraries/flex-tree/lazyNode.js +17 -6
  89. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  90. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +10 -5
  91. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  92. package/dist/feature-libraries/forest-summary/forestSummarizer.js +9 -12
  93. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  94. package/dist/feature-libraries/index.d.ts +2 -2
  95. package/dist/feature-libraries/index.d.ts.map +1 -1
  96. package/dist/feature-libraries/index.js +4 -3
  97. package/dist/feature-libraries/index.js.map +1 -1
  98. package/dist/feature-libraries/mapTreeCursor.d.ts +53 -3
  99. package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  100. package/dist/feature-libraries/mapTreeCursor.js +45 -7
  101. package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
  102. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.d.ts.map +1 -1
  103. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js +2 -0
  104. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js.map +1 -1
  105. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +1 -1
  106. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  107. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +5 -5
  108. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  109. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  110. package/dist/feature-libraries/object-forest/objectForest.js +2 -0
  111. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  112. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  113. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +8 -4
  114. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  115. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -36
  116. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
  117. package/dist/feature-libraries/schema-edits/schemaChangeFormat.js +3 -3
  118. package/dist/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
  119. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  120. package/dist/feature-libraries/schema-index/codec.js +59 -9
  121. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  122. package/dist/feature-libraries/schema-index/formatV1.d.ts +1 -1
  123. package/dist/feature-libraries/schema-index/formatV2.d.ts +42 -0
  124. package/dist/feature-libraries/schema-index/formatV2.d.ts.map +1 -0
  125. package/dist/feature-libraries/schema-index/formatV2.js +26 -0
  126. package/dist/feature-libraries/schema-index/formatV2.js.map +1 -0
  127. package/dist/feature-libraries/schema-index/index.d.ts +2 -1
  128. package/dist/feature-libraries/schema-index/index.d.ts.map +1 -1
  129. package/dist/feature-libraries/schema-index/index.js +4 -2
  130. package/dist/feature-libraries/schema-index/index.js.map +1 -1
  131. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +7 -2
  132. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  133. package/dist/feature-libraries/schema-index/schemaSummarizer.js +6 -6
  134. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  135. package/dist/feature-libraries/treeCursorUtils.d.ts +5 -1
  136. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  137. package/dist/feature-libraries/treeCursorUtils.js +8 -2
  138. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  139. package/dist/index.d.ts +3 -3
  140. package/dist/index.d.ts.map +1 -1
  141. package/dist/index.js.map +1 -1
  142. package/dist/packageVersion.d.ts +1 -1
  143. package/dist/packageVersion.d.ts.map +1 -1
  144. package/dist/packageVersion.js +1 -1
  145. package/dist/packageVersion.js.map +1 -1
  146. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  147. package/dist/shared-tree/schematizeTree.js +1 -0
  148. package/dist/shared-tree/schematizeTree.js.map +1 -1
  149. package/dist/shared-tree/schematizingTreeView.d.ts +11 -1
  150. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  151. package/dist/shared-tree/schematizingTreeView.js +36 -22
  152. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  153. package/dist/shared-tree/sharedTree.d.ts +8 -4
  154. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  155. package/dist/shared-tree/sharedTree.js +35 -5
  156. package/dist/shared-tree/sharedTree.js.map +1 -1
  157. package/dist/shared-tree/tree.d.ts.map +1 -1
  158. package/dist/shared-tree/tree.js +8 -24
  159. package/dist/shared-tree/tree.js.map +1 -1
  160. package/dist/shared-tree/treeAlpha.d.ts +2 -3
  161. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  162. package/dist/shared-tree/treeAlpha.js +4 -5
  163. package/dist/shared-tree/treeAlpha.js.map +1 -1
  164. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  165. package/dist/shared-tree/treeCheckout.js +5 -2
  166. package/dist/shared-tree/treeCheckout.js.map +1 -1
  167. package/dist/shared-tree-core/editManagerSummarizer.d.ts +8 -3
  168. package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  169. package/dist/shared-tree-core/editManagerSummarizer.js +2 -5
  170. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  171. package/dist/shared-tree-core/sharedTreeCore.d.ts +18 -7
  172. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  173. package/dist/shared-tree-core/sharedTreeCore.js +15 -2
  174. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  175. package/dist/simple-tree/api/configuration.d.ts +2 -2
  176. package/dist/simple-tree/api/configuration.js +1 -1
  177. package/dist/simple-tree/api/configuration.js.map +1 -1
  178. package/dist/simple-tree/api/create.d.ts +9 -4
  179. package/dist/simple-tree/api/create.d.ts.map +1 -1
  180. package/dist/simple-tree/api/create.js +29 -16
  181. package/dist/simple-tree/api/create.js.map +1 -1
  182. package/dist/simple-tree/api/customTree.d.ts +4 -0
  183. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  184. package/dist/simple-tree/api/customTree.js +9 -1
  185. package/dist/simple-tree/api/customTree.js.map +1 -1
  186. package/dist/simple-tree/api/index.d.ts +1 -1
  187. package/dist/simple-tree/api/index.d.ts.map +1 -1
  188. package/dist/simple-tree/api/index.js +1 -2
  189. package/dist/simple-tree/api/index.js.map +1 -1
  190. package/dist/simple-tree/api/schemaCompatibilityTester.js +1 -1
  191. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  192. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +3 -3
  193. package/dist/simple-tree/api/schemaCreationUtilities.js +3 -3
  194. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  195. package/dist/simple-tree/api/schemaFactory.d.ts +25 -13
  196. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  197. package/dist/simple-tree/api/schemaFactory.js +42 -9
  198. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  199. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +41 -11
  200. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  201. package/dist/simple-tree/api/schemaFactoryAlpha.js +31 -4
  202. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  203. package/dist/simple-tree/api/storedSchema.js +2 -2
  204. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  205. package/dist/simple-tree/api/treeChangeEvents.d.ts +8 -3
  206. package/dist/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
  207. package/dist/simple-tree/api/treeChangeEvents.js.map +1 -1
  208. package/dist/simple-tree/api/treeNodeApi.d.ts +14 -3
  209. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  210. package/dist/simple-tree/api/treeNodeApi.js +32 -17
  211. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  212. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  213. package/dist/simple-tree/api/verboseTree.js +12 -9
  214. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  215. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  216. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +5 -0
  217. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  218. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  219. package/dist/simple-tree/core/getOrCreateNode.js +2 -1
  220. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  221. package/dist/simple-tree/core/index.d.ts +2 -2
  222. package/dist/simple-tree/core/index.d.ts.map +1 -1
  223. package/dist/simple-tree/core/index.js +3 -4
  224. package/dist/simple-tree/core/index.js.map +1 -1
  225. package/dist/simple-tree/core/treeNodeKernel.d.ts +15 -25
  226. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  227. package/dist/simple-tree/core/treeNodeKernel.js +27 -34
  228. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  229. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +129 -64
  230. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  231. package/dist/simple-tree/core/unhydratedFlexTree.js +175 -207
  232. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  233. package/dist/simple-tree/index.d.ts +5 -5
  234. package/dist/simple-tree/index.d.ts.map +1 -1
  235. package/dist/simple-tree/index.js +5 -5
  236. package/dist/simple-tree/index.js.map +1 -1
  237. package/dist/simple-tree/leafNodeSchema.d.ts +2 -0
  238. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  239. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  240. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +3 -1
  241. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  242. package/dist/simple-tree/node-kinds/array/arrayNode.js +8 -7
  243. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  244. package/dist/simple-tree/node-kinds/index.d.ts +1 -1
  245. package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
  246. package/dist/simple-tree/node-kinds/index.js +1 -2
  247. package/dist/simple-tree/node-kinds/index.js.map +1 -1
  248. package/dist/simple-tree/node-kinds/map/mapNode.d.ts +3 -2
  249. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  250. package/dist/simple-tree/node-kinds/map/mapNode.js +6 -4
  251. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  252. package/dist/simple-tree/node-kinds/object/index.d.ts +1 -1
  253. package/dist/simple-tree/node-kinds/object/index.d.ts.map +1 -1
  254. package/dist/simple-tree/node-kinds/object/index.js +1 -2
  255. package/dist/simple-tree/node-kinds/object/index.js.map +1 -1
  256. package/dist/simple-tree/node-kinds/object/objectNode.d.ts +5 -15
  257. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  258. package/dist/simple-tree/node-kinds/object/objectNode.js +15 -44
  259. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  260. package/dist/simple-tree/prepareForInsertion.d.ts +20 -6
  261. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
  262. package/dist/simple-tree/prepareForInsertion.js +31 -20
  263. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  264. package/dist/simple-tree/schemaTypes.d.ts +56 -9
  265. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  266. package/dist/simple-tree/schemaTypes.js +28 -1
  267. package/dist/simple-tree/schemaTypes.js.map +1 -1
  268. package/dist/simple-tree/simpleSchema.d.ts +22 -4
  269. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  270. package/dist/simple-tree/simpleSchema.js.map +1 -1
  271. package/dist/simple-tree/toStoredSchema.d.ts +8 -1
  272. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  273. package/dist/simple-tree/toStoredSchema.js +19 -7
  274. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  275. package/{lib/simple-tree/toMapTree.d.ts → dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts} +12 -23
  276. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -0
  277. package/dist/simple-tree/{toMapTree.js → unhydratedFlexTreeFromInsertable.js} +103 -185
  278. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -0
  279. package/dist/tableSchema.d.ts +1 -1
  280. package/dist/treeFactory.d.ts.map +1 -1
  281. package/dist/treeFactory.js +6 -1
  282. package/dist/treeFactory.js.map +1 -1
  283. package/dist/util/index.d.ts +1 -1
  284. package/dist/util/index.d.ts.map +1 -1
  285. package/dist/util/index.js +2 -1
  286. package/dist/util/index.js.map +1 -1
  287. package/dist/util/typeUtils.d.ts +2 -2
  288. package/dist/util/typeUtils.js.map +1 -1
  289. package/dist/util/utils.d.ts +6 -0
  290. package/dist/util/utils.d.ts.map +1 -1
  291. package/dist/util/utils.js +8 -1
  292. package/dist/util/utils.js.map +1 -1
  293. package/docs/user-facing/schema-evolution.md +1 -1
  294. package/lib/alpha.d.ts +12 -6
  295. package/lib/beta.d.ts +6 -1
  296. package/lib/codec/codec.d.ts +23 -3
  297. package/lib/codec/codec.d.ts.map +1 -1
  298. package/lib/codec/codec.js.map +1 -1
  299. package/lib/codec/index.d.ts +1 -1
  300. package/lib/codec/index.d.ts.map +1 -1
  301. package/lib/codec/index.js.map +1 -1
  302. package/lib/codec/versioned/codec.d.ts +35 -2
  303. package/lib/codec/versioned/codec.d.ts.map +1 -1
  304. package/lib/codec/versioned/codec.js +36 -2
  305. package/lib/codec/versioned/codec.js.map +1 -1
  306. package/lib/core/index.d.ts +1 -1
  307. package/lib/core/index.d.ts.map +1 -1
  308. package/lib/core/index.js +1 -1
  309. package/lib/core/index.js.map +1 -1
  310. package/lib/core/schema-stored/formatV2.d.ts +80 -0
  311. package/lib/core/schema-stored/formatV2.d.ts.map +1 -0
  312. package/lib/core/schema-stored/formatV2.js +52 -0
  313. package/lib/core/schema-stored/formatV2.js.map +1 -0
  314. package/lib/core/schema-stored/index.d.ts +3 -1
  315. package/lib/core/schema-stored/index.d.ts.map +1 -1
  316. package/lib/core/schema-stored/index.js +3 -1
  317. package/lib/core/schema-stored/index.js.map +1 -1
  318. package/lib/core/schema-stored/schema.d.ts +49 -17
  319. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  320. package/lib/core/schema-stored/schema.js +63 -21
  321. package/lib/core/schema-stored/schema.js.map +1 -1
  322. package/lib/core/tree/detachedFieldIndex.d.ts +2 -2
  323. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  324. package/lib/core/tree/detachedFieldIndex.js +6 -2
  325. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  326. package/lib/core/tree/mapTree.d.ts +2 -1
  327. package/lib/core/tree/mapTree.d.ts.map +1 -1
  328. package/lib/core/tree/mapTree.js +11 -5
  329. package/lib/core/tree/mapTree.js.map +1 -1
  330. package/lib/core/tree/visitorUtils.d.ts +2 -2
  331. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  332. package/lib/core/tree/visitorUtils.js.map +1 -1
  333. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +9 -7
  334. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  335. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +11 -7
  336. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  337. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +3 -3
  338. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  339. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +7 -7
  340. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  341. package/lib/feature-libraries/chunked-forest/codec/nodeShape.d.ts +1 -1
  342. package/lib/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
  343. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js +3 -3
  344. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  345. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +3 -2
  346. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  347. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  348. package/lib/feature-libraries/default-schema/schemaChecker.d.ts +4 -3
  349. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  350. package/lib/feature-libraries/default-schema/schemaChecker.js +4 -3
  351. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  352. package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts +8 -3
  353. package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
  354. package/lib/feature-libraries/detachedFieldIndexSummarizer.js +2 -5
  355. package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  356. package/lib/feature-libraries/flex-tree/context.d.ts +14 -6
  357. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  358. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  359. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +48 -29
  360. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  361. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +4 -0
  362. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  363. package/lib/feature-libraries/flex-tree/index.d.ts +2 -3
  364. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  365. package/lib/feature-libraries/flex-tree/index.js +0 -1
  366. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  367. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts +2 -2
  368. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  369. package/lib/feature-libraries/flex-tree/lazyEntity.js +3 -0
  370. package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  371. package/lib/feature-libraries/flex-tree/lazyField.d.ts +6 -7
  372. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  373. package/lib/feature-libraries/flex-tree/lazyField.js +3 -6
  374. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  375. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +8 -7
  376. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  377. package/lib/feature-libraries/flex-tree/lazyNode.js +17 -6
  378. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  379. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +10 -5
  380. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  381. package/lib/feature-libraries/forest-summary/forestSummarizer.js +4 -7
  382. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  383. package/lib/feature-libraries/index.d.ts +2 -2
  384. package/lib/feature-libraries/index.d.ts.map +1 -1
  385. package/lib/feature-libraries/index.js +2 -2
  386. package/lib/feature-libraries/index.js.map +1 -1
  387. package/lib/feature-libraries/mapTreeCursor.d.ts +53 -3
  388. package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  389. package/lib/feature-libraries/mapTreeCursor.js +43 -7
  390. package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
  391. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.d.ts.map +1 -1
  392. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js +2 -0
  393. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js.map +1 -1
  394. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +1 -1
  395. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  396. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +5 -5
  397. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  398. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  399. package/lib/feature-libraries/object-forest/objectForest.js +2 -0
  400. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  401. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  402. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +8 -4
  403. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  404. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -36
  405. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
  406. package/lib/feature-libraries/schema-edits/schemaChangeFormat.js +3 -3
  407. package/lib/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
  408. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  409. package/lib/feature-libraries/schema-index/codec.js +60 -10
  410. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  411. package/lib/feature-libraries/schema-index/formatV1.d.ts +1 -1
  412. package/lib/feature-libraries/schema-index/formatV2.d.ts +42 -0
  413. package/lib/feature-libraries/schema-index/formatV2.d.ts.map +1 -0
  414. package/lib/feature-libraries/schema-index/formatV2.js +23 -0
  415. package/lib/feature-libraries/schema-index/formatV2.js.map +1 -0
  416. package/lib/feature-libraries/schema-index/index.d.ts +2 -1
  417. package/lib/feature-libraries/schema-index/index.d.ts.map +1 -1
  418. package/lib/feature-libraries/schema-index/index.js +2 -1
  419. package/lib/feature-libraries/schema-index/index.js.map +1 -1
  420. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +7 -2
  421. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  422. package/lib/feature-libraries/schema-index/schemaSummarizer.js +6 -6
  423. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  424. package/lib/feature-libraries/treeCursorUtils.d.ts +5 -1
  425. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  426. package/lib/feature-libraries/treeCursorUtils.js +8 -2
  427. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  428. package/lib/index.d.ts +3 -3
  429. package/lib/index.d.ts.map +1 -1
  430. package/lib/index.js.map +1 -1
  431. package/lib/packageVersion.d.ts +1 -1
  432. package/lib/packageVersion.d.ts.map +1 -1
  433. package/lib/packageVersion.js +1 -1
  434. package/lib/packageVersion.js.map +1 -1
  435. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  436. package/lib/shared-tree/schematizeTree.js +1 -0
  437. package/lib/shared-tree/schematizeTree.js.map +1 -1
  438. package/lib/shared-tree/schematizingTreeView.d.ts +11 -1
  439. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  440. package/lib/shared-tree/schematizingTreeView.js +34 -21
  441. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  442. package/lib/shared-tree/sharedTree.d.ts +8 -4
  443. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  444. package/lib/shared-tree/sharedTree.js +36 -6
  445. package/lib/shared-tree/sharedTree.js.map +1 -1
  446. package/lib/shared-tree/tree.d.ts.map +1 -1
  447. package/lib/shared-tree/tree.js +2 -18
  448. package/lib/shared-tree/tree.js.map +1 -1
  449. package/lib/shared-tree/treeAlpha.d.ts +2 -3
  450. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  451. package/lib/shared-tree/treeAlpha.js +6 -7
  452. package/lib/shared-tree/treeAlpha.js.map +1 -1
  453. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  454. package/lib/shared-tree/treeCheckout.js +6 -3
  455. package/lib/shared-tree/treeCheckout.js.map +1 -1
  456. package/lib/shared-tree-core/editManagerSummarizer.d.ts +8 -3
  457. package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  458. package/lib/shared-tree-core/editManagerSummarizer.js +2 -5
  459. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  460. package/lib/shared-tree-core/sharedTreeCore.d.ts +18 -7
  461. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  462. package/lib/shared-tree-core/sharedTreeCore.js +15 -2
  463. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  464. package/lib/simple-tree/api/configuration.d.ts +2 -2
  465. package/lib/simple-tree/api/configuration.js +1 -1
  466. package/lib/simple-tree/api/configuration.js.map +1 -1
  467. package/lib/simple-tree/api/create.d.ts +9 -4
  468. package/lib/simple-tree/api/create.d.ts.map +1 -1
  469. package/lib/simple-tree/api/create.js +22 -9
  470. package/lib/simple-tree/api/create.js.map +1 -1
  471. package/lib/simple-tree/api/customTree.d.ts +4 -0
  472. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  473. package/lib/simple-tree/api/customTree.js +7 -0
  474. package/lib/simple-tree/api/customTree.js.map +1 -1
  475. package/lib/simple-tree/api/index.d.ts +1 -1
  476. package/lib/simple-tree/api/index.d.ts.map +1 -1
  477. package/lib/simple-tree/api/index.js +1 -1
  478. package/lib/simple-tree/api/index.js.map +1 -1
  479. package/lib/simple-tree/api/schemaCompatibilityTester.js +1 -1
  480. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  481. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +3 -3
  482. package/lib/simple-tree/api/schemaCreationUtilities.js +3 -3
  483. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  484. package/lib/simple-tree/api/schemaFactory.d.ts +25 -13
  485. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  486. package/lib/simple-tree/api/schemaFactory.js +44 -11
  487. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  488. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +41 -11
  489. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  490. package/lib/simple-tree/api/schemaFactoryAlpha.js +31 -4
  491. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  492. package/lib/simple-tree/api/storedSchema.js +2 -2
  493. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  494. package/lib/simple-tree/api/treeChangeEvents.d.ts +8 -3
  495. package/lib/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
  496. package/lib/simple-tree/api/treeChangeEvents.js.map +1 -1
  497. package/lib/simple-tree/api/treeNodeApi.d.ts +14 -3
  498. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  499. package/lib/simple-tree/api/treeNodeApi.js +35 -20
  500. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  501. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  502. package/lib/simple-tree/api/verboseTree.js +13 -10
  503. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  504. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  505. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +5 -0
  506. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  507. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  508. package/lib/simple-tree/core/getOrCreateNode.js +3 -2
  509. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  510. package/lib/simple-tree/core/index.d.ts +2 -2
  511. package/lib/simple-tree/core/index.d.ts.map +1 -1
  512. package/lib/simple-tree/core/index.js +2 -2
  513. package/lib/simple-tree/core/index.js.map +1 -1
  514. package/lib/simple-tree/core/treeNodeKernel.d.ts +15 -25
  515. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  516. package/lib/simple-tree/core/treeNodeKernel.js +25 -33
  517. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  518. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +129 -64
  519. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  520. package/lib/simple-tree/core/unhydratedFlexTree.js +174 -208
  521. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  522. package/lib/simple-tree/index.d.ts +5 -5
  523. package/lib/simple-tree/index.d.ts.map +1 -1
  524. package/lib/simple-tree/index.js +3 -3
  525. package/lib/simple-tree/index.js.map +1 -1
  526. package/lib/simple-tree/leafNodeSchema.d.ts +2 -0
  527. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  528. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  529. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +3 -1
  530. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  531. package/lib/simple-tree/node-kinds/array/arrayNode.js +7 -6
  532. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  533. package/lib/simple-tree/node-kinds/index.d.ts +1 -1
  534. package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
  535. package/lib/simple-tree/node-kinds/index.js +1 -1
  536. package/lib/simple-tree/node-kinds/index.js.map +1 -1
  537. package/lib/simple-tree/node-kinds/map/mapNode.d.ts +3 -2
  538. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  539. package/lib/simple-tree/node-kinds/map/mapNode.js +8 -6
  540. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  541. package/lib/simple-tree/node-kinds/object/index.d.ts +1 -1
  542. package/lib/simple-tree/node-kinds/object/index.d.ts.map +1 -1
  543. package/lib/simple-tree/node-kinds/object/index.js +1 -1
  544. package/lib/simple-tree/node-kinds/object/index.js.map +1 -1
  545. package/lib/simple-tree/node-kinds/object/objectNode.d.ts +5 -15
  546. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  547. package/lib/simple-tree/node-kinds/object/objectNode.js +6 -34
  548. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  549. package/lib/simple-tree/prepareForInsertion.d.ts +20 -6
  550. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
  551. package/lib/simple-tree/prepareForInsertion.js +30 -20
  552. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  553. package/lib/simple-tree/schemaTypes.d.ts +56 -9
  554. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  555. package/lib/simple-tree/schemaTypes.js +28 -1
  556. package/lib/simple-tree/schemaTypes.js.map +1 -1
  557. package/lib/simple-tree/simpleSchema.d.ts +22 -4
  558. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  559. package/lib/simple-tree/simpleSchema.js.map +1 -1
  560. package/lib/simple-tree/toStoredSchema.d.ts +8 -1
  561. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  562. package/lib/simple-tree/toStoredSchema.js +17 -5
  563. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  564. package/{dist/simple-tree/toMapTree.d.ts → lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts} +12 -23
  565. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -0
  566. package/lib/simple-tree/{toMapTree.js → unhydratedFlexTreeFromInsertable.js} +105 -186
  567. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -0
  568. package/lib/tableSchema.d.ts +1 -1
  569. package/lib/treeFactory.d.ts.map +1 -1
  570. package/lib/treeFactory.js +6 -1
  571. package/lib/treeFactory.js.map +1 -1
  572. package/lib/util/index.d.ts +1 -1
  573. package/lib/util/index.d.ts.map +1 -1
  574. package/lib/util/index.js +1 -1
  575. package/lib/util/index.js.map +1 -1
  576. package/lib/util/typeUtils.d.ts +2 -2
  577. package/lib/util/typeUtils.js.map +1 -1
  578. package/lib/util/utils.d.ts +6 -0
  579. package/lib/util/utils.d.ts.map +1 -1
  580. package/lib/util/utils.js +6 -0
  581. package/lib/util/utils.js.map +1 -1
  582. package/package.json +21 -21
  583. package/src/codec/codec.ts +24 -3
  584. package/src/codec/index.ts +1 -0
  585. package/src/codec/versioned/codec.ts +42 -5
  586. package/src/core/index.ts +3 -1
  587. package/src/core/schema-stored/formatV2.ts +78 -0
  588. package/src/core/schema-stored/index.ts +4 -1
  589. package/src/core/schema-stored/schema.ts +123 -33
  590. package/src/core/tree/detachedFieldIndex.ts +13 -4
  591. package/src/core/tree/mapTree.ts +22 -7
  592. package/src/core/tree/visitorUtils.ts +2 -2
  593. package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +16 -11
  594. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +16 -7
  595. package/src/feature-libraries/chunked-forest/codec/nodeShape.ts +4 -4
  596. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +3 -2
  597. package/src/feature-libraries/default-schema/schemaChecker.ts +7 -6
  598. package/src/feature-libraries/detachedFieldIndexSummarizer.ts +9 -16
  599. package/src/feature-libraries/flex-tree/context.ts +17 -7
  600. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +57 -33
  601. package/src/feature-libraries/flex-tree/index.ts +4 -8
  602. package/src/feature-libraries/flex-tree/lazyEntity.ts +5 -1
  603. package/src/feature-libraries/flex-tree/lazyField.ts +12 -13
  604. package/src/feature-libraries/flex-tree/lazyNode.ts +21 -8
  605. package/src/feature-libraries/forest-summary/forestSummarizer.ts +12 -18
  606. package/src/feature-libraries/index.ts +10 -1
  607. package/src/feature-libraries/mapTreeCursor.ts +112 -16
  608. package/src/feature-libraries/modular-schema/fieldKindWithEditor.ts +2 -0
  609. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +9 -5
  610. package/src/feature-libraries/object-forest/objectForest.ts +3 -0
  611. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +11 -6
  612. package/src/feature-libraries/schema-edits/schemaChangeFormat.ts +3 -3
  613. package/src/feature-libraries/schema-index/codec.ts +73 -14
  614. package/src/feature-libraries/schema-index/formatV2.ts +30 -0
  615. package/src/feature-libraries/schema-index/index.ts +2 -1
  616. package/src/feature-libraries/schema-index/schemaSummarizer.ts +11 -18
  617. package/src/feature-libraries/treeCursorUtils.ts +21 -10
  618. package/src/index.ts +6 -0
  619. package/src/packageVersion.ts +1 -1
  620. package/src/shared-tree/schematizeTree.ts +1 -0
  621. package/src/shared-tree/schematizingTreeView.ts +40 -22
  622. package/src/shared-tree/sharedTree.ts +51 -15
  623. package/src/shared-tree/tree.ts +5 -20
  624. package/src/shared-tree/treeAlpha.ts +23 -12
  625. package/src/shared-tree/treeCheckout.ts +6 -3
  626. package/src/shared-tree-core/editManagerSummarizer.ts +9 -16
  627. package/src/shared-tree-core/sharedTreeCore.ts +33 -24
  628. package/src/simple-tree/api/configuration.ts +3 -3
  629. package/src/simple-tree/api/create.ts +49 -19
  630. package/src/simple-tree/api/customTree.ts +10 -0
  631. package/src/simple-tree/api/index.ts +1 -4
  632. package/src/simple-tree/api/schemaCompatibilityTester.ts +1 -1
  633. package/src/simple-tree/api/schemaCreationUtilities.ts +3 -3
  634. package/src/simple-tree/api/schemaFactory.ts +78 -24
  635. package/src/simple-tree/api/schemaFactoryAlpha.ts +53 -8
  636. package/src/simple-tree/api/storedSchema.ts +4 -4
  637. package/src/simple-tree/api/treeChangeEvents.ts +8 -3
  638. package/src/simple-tree/api/treeNodeApi.ts +48 -27
  639. package/src/simple-tree/api/verboseTree.ts +15 -12
  640. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +5 -0
  641. package/src/simple-tree/core/getOrCreateNode.ts +4 -2
  642. package/src/simple-tree/core/index.ts +2 -3
  643. package/src/simple-tree/core/treeNodeKernel.ts +38 -55
  644. package/src/simple-tree/core/unhydratedFlexTree.ts +231 -292
  645. package/src/simple-tree/index.ts +6 -3
  646. package/src/simple-tree/leafNodeSchema.ts +2 -0
  647. package/src/simple-tree/node-kinds/array/arrayNode.ts +17 -13
  648. package/src/simple-tree/node-kinds/index.ts +0 -1
  649. package/src/simple-tree/node-kinds/map/mapNode.ts +17 -11
  650. package/src/simple-tree/node-kinds/object/index.ts +0 -1
  651. package/src/simple-tree/node-kinds/object/objectNode.ts +15 -49
  652. package/src/simple-tree/prepareForInsertion.ts +54 -43
  653. package/src/simple-tree/schemaTypes.ts +103 -13
  654. package/src/simple-tree/simpleSchema.ts +27 -5
  655. package/src/simple-tree/toStoredSchema.ts +22 -5
  656. package/src/simple-tree/{toMapTree.ts → unhydratedFlexTreeFromInsertable.ts} +134 -226
  657. package/src/treeFactory.ts +6 -1
  658. package/src/util/index.ts +1 -0
  659. package/src/util/typeUtils.ts +2 -2
  660. package/src/util/utils.ts +9 -0
  661. package/dist/feature-libraries/flex-tree/navigation.d.ts +0 -46
  662. package/dist/feature-libraries/flex-tree/navigation.d.ts.map +0 -1
  663. package/dist/feature-libraries/flex-tree/navigation.js +0 -104
  664. package/dist/feature-libraries/flex-tree/navigation.js.map +0 -1
  665. package/dist/simple-tree/toMapTree.d.ts.map +0 -1
  666. package/dist/simple-tree/toMapTree.js.map +0 -1
  667. package/lib/feature-libraries/flex-tree/navigation.d.ts +0 -46
  668. package/lib/feature-libraries/flex-tree/navigation.d.ts.map +0 -1
  669. package/lib/feature-libraries/flex-tree/navigation.js +0 -97
  670. package/lib/feature-libraries/flex-tree/navigation.js.map +0 -1
  671. package/lib/simple-tree/toMapTree.d.ts.map +0 -1
  672. package/lib/simple-tree/toMapTree.js.map +0 -1
  673. package/src/feature-libraries/flex-tree/navigation.ts +0 -121
@@ -4,42 +4,8 @@
4
4
  */
5
5
  import { type Static } from "@sinclair/typebox";
6
6
  export declare const EncodedSchemaChange: import("@sinclair/typebox").TObject<{
7
- new: import("@sinclair/typebox").TObject<{
8
- version: import("@sinclair/typebox").TLiteral<import("../../core/index.js").SchemaVersion>;
9
- nodes: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
10
- object: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
11
- kind: import("@sinclair/typebox").TUnsafe<import("../../core/index.js").FieldKindIdentifier>;
12
- types: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnsafe<import("../../core/index.js").TreeNodeSchemaIdentifier<string>>>;
13
- }>>>;
14
- map: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
15
- kind: import("@sinclair/typebox").TUnsafe<import("../../core/index.js").FieldKindIdentifier>;
16
- types: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnsafe<import("../../core/index.js").TreeNodeSchemaIdentifier<string>>>;
17
- }>>;
18
- leaf: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TEnum<typeof import("../../core/schema-stored/formatV1.js").PersistedValueSchema>>;
19
- }>>;
20
- root: import("@sinclair/typebox").TObject<{
21
- kind: import("@sinclair/typebox").TUnsafe<import("../../core/index.js").FieldKindIdentifier>;
22
- types: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnsafe<import("../../core/index.js").TreeNodeSchemaIdentifier<string>>>;
23
- }>;
24
- }>;
25
- old: import("@sinclair/typebox").TObject<{
26
- version: import("@sinclair/typebox").TLiteral<import("../../core/index.js").SchemaVersion>;
27
- nodes: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
28
- object: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
29
- kind: import("@sinclair/typebox").TUnsafe<import("../../core/index.js").FieldKindIdentifier>;
30
- types: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnsafe<import("../../core/index.js").TreeNodeSchemaIdentifier<string>>>;
31
- }>>>;
32
- map: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
33
- kind: import("@sinclair/typebox").TUnsafe<import("../../core/index.js").FieldKindIdentifier>;
34
- types: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnsafe<import("../../core/index.js").TreeNodeSchemaIdentifier<string>>>;
35
- }>>;
36
- leaf: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TEnum<typeof import("../../core/schema-stored/formatV1.js").PersistedValueSchema>>;
37
- }>>;
38
- root: import("@sinclair/typebox").TObject<{
39
- kind: import("@sinclair/typebox").TUnsafe<import("../../core/index.js").FieldKindIdentifier>;
40
- types: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnsafe<import("../../core/index.js").TreeNodeSchemaIdentifier<string>>>;
41
- }>;
42
- }>;
7
+ new: import("@sinclair/typebox").TAny;
8
+ old: import("@sinclair/typebox").TAny;
43
9
  }>;
44
10
  export type EncodedSchemaChange = Static<typeof EncodedSchemaChange>;
45
11
  //# sourceMappingURL=schemaChangeFormat.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemaChangeFormat.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/schema-edits/schemaChangeFormat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAGtD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG9B,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
1
+ {"version":3,"file":"schemaChangeFormat.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/schema-edits/schemaChangeFormat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAGtD,eAAO,MAAM,mBAAmB;;;EAG9B,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
@@ -6,9 +6,9 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.EncodedSchemaChange = void 0;
8
8
  const typebox_1 = require("@sinclair/typebox");
9
- const index_js_1 = require("../schema-index/index.js");
9
+ const index_js_1 = require("../../util/index.js");
10
10
  exports.EncodedSchemaChange = typebox_1.Type.Object({
11
- new: index_js_1.Format,
12
- old: index_js_1.Format,
11
+ new: index_js_1.JsonCompatibleReadOnlySchema,
12
+ old: index_js_1.JsonCompatibleReadOnlySchema,
13
13
  });
14
14
  //# sourceMappingURL=schemaChangeFormat.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemaChangeFormat.js","sourceRoot":"","sources":["../../../src/feature-libraries/schema-edits/schemaChangeFormat.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAAsD;AACtD,uDAA8D;AAEjD,QAAA,mBAAmB,GAAG,cAAI,CAAC,MAAM,CAAC;IAC9C,GAAG,EAAE,iBAAQ;IACb,GAAG,EAAE,iBAAQ;CACb,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type Static, Type } from \"@sinclair/typebox\";\nimport { Format as FormatV1 } from \"../schema-index/index.js\";\n\nexport const EncodedSchemaChange = Type.Object({\n\tnew: FormatV1,\n\told: FormatV1,\n});\n\nexport type EncodedSchemaChange = Static<typeof EncodedSchemaChange>;\n"]}
1
+ {"version":3,"file":"schemaChangeFormat.js","sourceRoot":"","sources":["../../../src/feature-libraries/schema-edits/schemaChangeFormat.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAAsD;AACtD,kDAAmE;AAEtD,QAAA,mBAAmB,GAAG,cAAI,CAAC,MAAM,CAAC;IAC9C,GAAG,EAAE,uCAA4B;IACjC,GAAG,EAAE,uCAA4B;CACjC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type Static, Type } from \"@sinclair/typebox\";\nimport { JsonCompatibleReadOnlySchema } from \"../../util/index.js\";\n\nexport const EncodedSchemaChange = Type.Object({\n\tnew: JsonCompatibleReadOnlySchema,\n\told: JsonCompatibleReadOnlySchema,\n});\n\nexport type EncodedSchemaChange = Static<typeof EncodedSchemaChange>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/schema-index/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,UAAU,EAIf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,aAAa,EAGb,KAAK,gBAAgB,EAKrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAS,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAIjE;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC3C,aAAa,EAAE,kBAAkB,GAC/B,aAAa,CAGf;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC9B,OAAO,EAAE,aAAa,EACtB,YAAY,EAAE,aAAa,GACzB,UAAU,CAAC,gBAAgB,CAAC,CAG9B;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,GAAG,YAAY,CAAC,gBAAgB,CAAC,CAEvF;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,aAAa,GAAG,cAAc,CAOzF"}
1
+ {"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/schema-index/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,UAAU,EAIf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,aAAa,EAGb,KAAK,gBAAgB,EAKrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAS,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAKjE;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC3C,aAAa,EAAE,kBAAkB,GAC/B,aAAa,CAGf;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC9B,OAAO,EAAE,aAAa,EACtB,YAAY,EAAE,aAAa,GACzB,UAAU,CAAC,gBAAgB,CAAC,CAG9B;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,GAAG,YAAY,CAAC,gBAAgB,CAAC,CAKvF;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,aAAa,GAAG,cAAc,CASzF"}
@@ -10,6 +10,7 @@ const index_js_1 = require("../../codec/index.js");
10
10
  const index_js_2 = require("../../core/index.js");
11
11
  const index_js_3 = require("../../util/index.js");
12
12
  const formatV1_js_1 = require("./formatV1.js");
13
+ const formatV2_js_1 = require("./formatV2.js");
13
14
  /**
14
15
  * Convert a FluidClientVersion to a SchemaVersion.
15
16
  * @param clientVersion - The FluidClientVersion to convert.
@@ -39,7 +40,10 @@ exports.makeSchemaCodec = makeSchemaCodec;
39
40
  * @returns The composed codec family.
40
41
  */
41
42
  function makeSchemaCodecs(options) {
42
- return (0, index_js_1.makeCodecFamily)([[index_js_2.SchemaVersion.v1, makeSchemaCodecV1(options)]]);
43
+ return (0, index_js_1.makeCodecFamily)([
44
+ [index_js_2.SchemaVersion.v1, makeSchemaCodecV1(options)],
45
+ [index_js_2.SchemaVersion.v2, makeSchemaCodecV2(options)],
46
+ ]);
43
47
  }
44
48
  exports.makeSchemaCodecs = makeSchemaCodecs;
45
49
  /**
@@ -52,33 +56,68 @@ function encodeRepo(repo, version) {
52
56
  switch (version) {
53
57
  case index_js_2.SchemaVersion.v1:
54
58
  return encodeRepoV1(repo);
59
+ case index_js_2.SchemaVersion.v2:
60
+ return encodeRepoV2(repo);
55
61
  default:
56
62
  (0, internal_1.unreachableCase)(version);
57
63
  }
58
64
  }
59
65
  exports.encodeRepo = encodeRepo;
60
66
  function encodeRepoV1(repo) {
67
+ const nodeSchema = encodeNodeSchema(repo, (schema) => schema.encodeV1());
68
+ const rootFieldSchema = (0, index_js_2.encodeFieldSchemaV1)(repo.rootFieldSchema);
69
+ return {
70
+ version: index_js_2.SchemaVersion.v1,
71
+ nodes: nodeSchema,
72
+ root: rootFieldSchema,
73
+ };
74
+ }
75
+ function encodeRepoV2(repo) {
76
+ const nodeSchema = encodeNodeSchema(repo, (schema) => schema.encodeV2());
77
+ const rootFieldSchema = (0, index_js_2.encodeFieldSchemaV2)(repo.rootFieldSchema);
78
+ return {
79
+ version: index_js_2.SchemaVersion.v2,
80
+ nodes: nodeSchema,
81
+ root: rootFieldSchema,
82
+ };
83
+ }
84
+ /**
85
+ * Shared logic for encoding node schemas.
86
+ * @param repo - The stored schema to encode.
87
+ * @param encodeValue - A function which encodes a single node schema.
88
+ * @returns The encoded node schema.
89
+ */
90
+ function encodeNodeSchema(repo, encodeValue) {
61
91
  const nodeSchema = Object.create(null);
62
- const rootFieldSchema = (0, index_js_2.encodeFieldSchema)(repo.rootFieldSchema);
63
92
  for (const name of [...repo.nodeSchema.keys()].sort()) {
64
93
  const schema = repo.nodeSchema.get(name) ?? (0, internal_1.fail)(0xb28 /* missing schema */);
65
94
  Object.defineProperty(nodeSchema, name, {
66
95
  enumerable: true,
67
96
  configurable: true,
68
97
  writable: true,
69
- value: schema.encode(),
98
+ value: encodeValue(schema),
70
99
  });
71
100
  }
101
+ return nodeSchema;
102
+ }
103
+ function decodeV1(f) {
104
+ const nodeSchema = new Map();
105
+ for (const [key, schema] of Object.entries(f.nodes)) {
106
+ const storedSchemaDecoder = index_js_2.storedSchemaDecodeDispatcher.dispatch(schema);
107
+ // No metadata in v1, so pass undefined
108
+ nodeSchema.set((0, index_js_3.brand)(key), storedSchemaDecoder(undefined));
109
+ }
72
110
  return {
73
- version: index_js_2.SchemaVersion.v1,
74
- nodes: nodeSchema,
75
- root: rootFieldSchema,
111
+ rootFieldSchema: (0, index_js_2.decodeFieldSchema)(f.root),
112
+ nodeSchema,
76
113
  };
77
114
  }
78
- function decode(f) {
115
+ function decodeV2(f) {
79
116
  const nodeSchema = new Map();
80
117
  for (const [key, schema] of Object.entries(f.nodes)) {
81
- nodeSchema.set((0, index_js_3.brand)(key), index_js_2.storedSchemaDecodeDispatcher.dispatch(schema));
118
+ const storedSchemaDecoder = index_js_2.storedSchemaDecodeDispatcher.dispatch(schema.kind);
119
+ // Pass in the node metadata
120
+ nodeSchema.set((0, index_js_3.brand)(key), storedSchemaDecoder(schema.metadata));
82
121
  }
83
122
  return {
84
123
  rootFieldSchema: (0, index_js_2.decodeFieldSchema)(f.root),
@@ -93,7 +132,18 @@ function decode(f) {
93
132
  function makeSchemaCodecV1(options) {
94
133
  return (0, index_js_1.makeVersionedValidatedCodec)(options, new Set([index_js_2.SchemaVersion.v1]), formatV1_js_1.Format, {
95
134
  encode: (data) => encodeRepoV1(data),
96
- decode: (data) => decode(data),
135
+ decode: (data) => decodeV1(data),
136
+ });
137
+ }
138
+ /**
139
+ * Creates a codec which performs synchronous monolithic encoding of schema content.
140
+ * @param options - Specifies common codec options, including which `validator` to use.
141
+ * @returns The codec.
142
+ */
143
+ function makeSchemaCodecV2(options) {
144
+ return (0, index_js_1.makeVersionedValidatedCodec)(options, new Set([index_js_2.SchemaVersion.v2]), formatV2_js_1.Format, {
145
+ encode: (data) => encodeRepoV2(data),
146
+ decode: (data) => decodeV2(data),
97
147
  });
98
148
  }
99
149
  //# sourceMappingURL=codec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"codec.js","sourceRoot":"","sources":["../../../src/feature-libraries/schema-index/codec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA4E;AAE5E,mDAQ8B;AAC9B,kDAS6B;AAC7B,kDAAiE;AAEjE,+CAAmD;AAEnD;;;;GAIG;AACH,SAAgB,4BAA4B,CAC3C,aAAiC;IAEjC,+DAA+D;IAC/D,OAAO,wBAAa,CAAC,EAAE,CAAC;AACzB,CAAC;AALD,oEAKC;AAED;;;;;;;GAOG;AACH,SAAgB,eAAe,CAC9B,OAAsB,EACtB,YAA2B;IAE3B,MAAM,MAAM,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACzC,OAAO,IAAA,sCAA2B,EAAC,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;AAC1E,CAAC;AAND,0CAMC;AAED;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,OAAsB;IACtD,OAAO,IAAA,0BAAe,EAAC,CAAC,CAAC,wBAAa,CAAC,EAAE,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1E,CAAC;AAFD,4CAEC;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CAAC,EAAE,uCAA4B,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO;QACN,eAAe,EAAE,IAAA,4BAAiB,EAAC,CAAC,CAAC,IAAI,CAAC;QAC1C,UAAU;KACV,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,OAAsB;IAChD,OAAO,IAAA,sCAA2B,EAAC,OAAO,EAAE,IAAI,GAAG,CAAC,CAAC,wBAAa,CAAC,EAAE,CAAC,CAAC,EAAE,oBAAQ,EAAE;QAClF,MAAM,EAAE,CAAC,IAAsB,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC;QACtD,MAAM,EAAE,CAAC,IAAc,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC;KACxC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fail, unreachableCase } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype FluidClientVersion,\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\tmakeCodecFamily,\n\tmakeVersionDispatchingCodec,\n\tmakeVersionedValidatedCodec,\n} from \"../../codec/index.js\";\nimport {\n\tSchemaVersion,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n\ttype TreeStoredSchema,\n\tdecodeFieldSchema,\n\tencodeFieldSchema,\n\ttype schemaFormatV1,\n\tstoredSchemaDecodeDispatcher,\n} from \"../../core/index.js\";\nimport { brand, type JsonCompatible } from \"../../util/index.js\";\n\nimport { Format as FormatV1 } from \"./formatV1.js\";\n\n/**\n * Convert a FluidClientVersion to a SchemaVersion.\n * @param clientVersion - The FluidClientVersion to convert.\n * @returns The SchemaVersion that corresponds to the provided FluidClientVersion.\n */\nexport function clientVersionToSchemaVersion(\n\tclientVersion: FluidClientVersion,\n): SchemaVersion {\n\t// Only one version of the schema codec is currently supported.\n\treturn SchemaVersion.v1;\n}\n\n/**\n * Create a schema codec.\n * @param options - Specifies common codec options, including which `validator` to use.\n * @param writeVersion - The schema write version.\n * @returns The composed codec.\n *\n * @privateRemarks We should consider using the Shared Tree format version instead as it may be more valuable for application authors than the schema version.\n */\nexport function makeSchemaCodec(\n\toptions: ICodecOptions,\n\twriteVersion: SchemaVersion,\n): IJsonCodec<TreeStoredSchema> {\n\tconst family = makeSchemaCodecs(options);\n\treturn makeVersionDispatchingCodec(family, { ...options, writeVersion });\n}\n\n/**\n * Create a family of schema codecs.\n * @param options - Specifies common codec options, including which `validator` to use.\n * @returns The composed codec family.\n */\nexport function makeSchemaCodecs(options: ICodecOptions): ICodecFamily<TreeStoredSchema> {\n\treturn makeCodecFamily([[SchemaVersion.v1, makeSchemaCodecV1(options)]]);\n}\n\n/**\n * Encode an in-memory TreeStoredSchema into the specified format version.\n * @param repo - The in-memory schema.\n * @param version - The schema write version.\n * @returns The encoded schema.\n */\nexport function encodeRepo(repo: TreeStoredSchema, version: SchemaVersion): JsonCompatible {\n\tswitch (version) {\n\t\tcase SchemaVersion.v1:\n\t\t\treturn encodeRepoV1(repo);\n\t\tdefault:\n\t\t\tunreachableCase(version);\n\t}\n}\n\nfunction encodeRepoV1(repo: TreeStoredSchema): FormatV1 {\n\tconst nodeSchema: Record<string, schemaFormatV1.TreeNodeSchemaDataFormat> =\n\t\tObject.create(null);\n\tconst rootFieldSchema = encodeFieldSchema(repo.rootFieldSchema);\n\tfor (const name of [...repo.nodeSchema.keys()].sort()) {\n\t\tconst schema = repo.nodeSchema.get(name) ?? fail(0xb28 /* missing schema */);\n\t\tObject.defineProperty(nodeSchema, name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: schema.encode(),\n\t\t});\n\t}\n\treturn {\n\t\tversion: SchemaVersion.v1,\n\t\tnodes: nodeSchema,\n\t\troot: rootFieldSchema,\n\t};\n}\n\nfunction decode(f: FormatV1): TreeStoredSchema {\n\tconst nodeSchema: Map<TreeNodeSchemaIdentifier, TreeNodeStoredSchema> = new Map();\n\tfor (const [key, schema] of Object.entries(f.nodes)) {\n\t\tnodeSchema.set(brand(key), storedSchemaDecodeDispatcher.dispatch(schema));\n\t}\n\treturn {\n\t\trootFieldSchema: decodeFieldSchema(f.root),\n\t\tnodeSchema,\n\t};\n}\n\n/**\n * Creates a codec which performs synchronous monolithic encoding of schema content.\n * @param options - Specifies common codec options, including which `validator` to use.\n * @returns The codec.\n */\nfunction makeSchemaCodecV1(options: ICodecOptions): IJsonCodec<TreeStoredSchema, FormatV1> {\n\treturn makeVersionedValidatedCodec(options, new Set([SchemaVersion.v1]), FormatV1, {\n\t\tencode: (data: TreeStoredSchema) => encodeRepoV1(data),\n\t\tdecode: (data: FormatV1) => decode(data),\n\t});\n}\n"]}
1
+ {"version":3,"file":"codec.js","sourceRoot":"","sources":["../../../src/feature-libraries/schema-index/codec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA4E;AAE5E,mDAQ8B;AAC9B,kDAS6B;AAC7B,kDAAiE;AAEjE,+CAAmD;AACnD,+CAAmD;AAEnD;;;;GAIG;AACH,SAAgB,4BAA4B,CAC3C,aAAiC;IAEjC,+DAA+D;IAC/D,OAAO,wBAAa,CAAC,EAAE,CAAC;AACzB,CAAC;AALD,oEAKC;AAED;;;;;;;GAOG;AACH,SAAgB,eAAe,CAC9B,OAAsB,EACtB,YAA2B;IAE3B,MAAM,MAAM,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACzC,OAAO,IAAA,sCAA2B,EAAC,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;AAC1E,CAAC;AAND,0CAMC;AAED;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,OAAsB;IACtD,OAAO,IAAA,0BAAe,EAAC;QACtB,CAAC,wBAAa,CAAC,EAAE,EAAE,iBAAiB,CAAC,OAAO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mBAAmB,GAAG,uCAA4B,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAE/E,4BAA4B;QAC5B,UAAU,CAAC,GAAG,CAAC,IAAA,gBAAK,EAAC,GAAG,CAAC,EAAE,mBAAmB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClE,CAAC;IACD,OAAO;QACN,eAAe,EAAE,IAAA,4BAAiB,EAAC,CAAC,CAAC,IAAI,CAAC;QAC1C,UAAU;KACV,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,OAAsB;IAChD,OAAO,IAAA,sCAA2B,EAAC,OAAO,EAAE,IAAI,GAAG,CAAC,CAAC,wBAAa,CAAC,EAAE,CAAC,CAAC,EAAE,oBAAQ,EAAE;QAClF,MAAM,EAAE,CAAC,IAAsB,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC;QACtD,MAAM,EAAE,CAAC,IAAc,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC;KAC1C,CAAC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,OAAsB;IAChD,OAAO,IAAA,sCAA2B,EAAC,OAAO,EAAE,IAAI,GAAG,CAAC,CAAC,wBAAa,CAAC,EAAE,CAAC,CAAC,EAAE,oBAAQ,EAAE;QAClF,MAAM,EAAE,CAAC,IAAsB,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC;QACtD,MAAM,EAAE,CAAC,IAAc,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC;KAC1C,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fail, unreachableCase } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype FluidClientVersion,\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\tmakeCodecFamily,\n\tmakeVersionDispatchingCodec,\n\tmakeVersionedValidatedCodec,\n} from \"../../codec/index.js\";\nimport {\n\tSchemaVersion,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n\ttype TreeStoredSchema,\n\tdecodeFieldSchema,\n\tencodeFieldSchemaV1,\n\tencodeFieldSchemaV2,\n\tstoredSchemaDecodeDispatcher,\n} from \"../../core/index.js\";\nimport { brand, type JsonCompatible } from \"../../util/index.js\";\n\nimport { Format as FormatV1 } from \"./formatV1.js\";\nimport { Format as FormatV2 } from \"./formatV2.js\";\n\n/**\n * Convert a FluidClientVersion to a SchemaVersion.\n * @param clientVersion - The FluidClientVersion to convert.\n * @returns The SchemaVersion that corresponds to the provided FluidClientVersion.\n */\nexport function clientVersionToSchemaVersion(\n\tclientVersion: FluidClientVersion,\n): SchemaVersion {\n\t// Only one version of the schema codec is currently supported.\n\treturn SchemaVersion.v1;\n}\n\n/**\n * Create a schema codec.\n * @param options - Specifies common codec options, including which `validator` to use.\n * @param writeVersion - The schema write version.\n * @returns The composed codec.\n *\n * @privateRemarks We should consider using the Shared Tree format version instead as it may be more valuable for application authors than the schema version.\n */\nexport function makeSchemaCodec(\n\toptions: ICodecOptions,\n\twriteVersion: SchemaVersion,\n): IJsonCodec<TreeStoredSchema> {\n\tconst family = makeSchemaCodecs(options);\n\treturn makeVersionDispatchingCodec(family, { ...options, writeVersion });\n}\n\n/**\n * Create a family of schema codecs.\n * @param options - Specifies common codec options, including which `validator` to use.\n * @returns The composed codec family.\n */\nexport function makeSchemaCodecs(options: ICodecOptions): ICodecFamily<TreeStoredSchema> {\n\treturn makeCodecFamily([\n\t\t[SchemaVersion.v1, makeSchemaCodecV1(options)],\n\t\t[SchemaVersion.v2, makeSchemaCodecV2(options)],\n\t]);\n}\n\n/**\n * Encode an in-memory TreeStoredSchema into the specified format version.\n * @param repo - The in-memory schema.\n * @param version - The schema write version.\n * @returns The encoded schema.\n */\nexport function encodeRepo(repo: TreeStoredSchema, version: SchemaVersion): JsonCompatible {\n\tswitch (version) {\n\t\tcase SchemaVersion.v1:\n\t\t\treturn encodeRepoV1(repo) as JsonCompatible;\n\t\tcase SchemaVersion.v2:\n\t\t\treturn encodeRepoV2(repo) as JsonCompatible;\n\t\tdefault:\n\t\t\tunreachableCase(version);\n\t}\n}\n\nfunction encodeRepoV1(repo: TreeStoredSchema): FormatV1 {\n\tconst nodeSchema = encodeNodeSchema(repo, (schema) => schema.encodeV1());\n\tconst rootFieldSchema = encodeFieldSchemaV1(repo.rootFieldSchema);\n\treturn {\n\t\tversion: SchemaVersion.v1,\n\t\tnodes: nodeSchema,\n\t\troot: rootFieldSchema,\n\t};\n}\n\nfunction encodeRepoV2(repo: TreeStoredSchema): FormatV2 {\n\tconst nodeSchema = encodeNodeSchema(repo, (schema) => schema.encodeV2());\n\tconst rootFieldSchema = encodeFieldSchemaV2(repo.rootFieldSchema);\n\treturn {\n\t\tversion: SchemaVersion.v2,\n\t\tnodes: nodeSchema,\n\t\troot: rootFieldSchema,\n\t};\n}\n\n/**\n * Shared logic for encoding node schemas.\n * @param repo - The stored schema to encode.\n * @param encodeValue - A function which encodes a single node schema.\n * @returns The encoded node schema.\n */\nfunction encodeNodeSchema<TFormat>(\n\trepo: TreeStoredSchema,\n\tencodeValue: (schema: TreeNodeStoredSchema) => TFormat,\n): Record<string, TFormat> {\n\tconst nodeSchema: Record<string, TFormat> = Object.create(null);\n\tfor (const name of [...repo.nodeSchema.keys()].sort()) {\n\t\tconst schema = repo.nodeSchema.get(name) ?? fail(0xb28 /* missing schema */);\n\t\tObject.defineProperty(nodeSchema, name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: encodeValue(schema),\n\t\t});\n\t}\n\n\treturn nodeSchema;\n}\n\nfunction decodeV1(f: FormatV1): TreeStoredSchema {\n\tconst nodeSchema: Map<TreeNodeSchemaIdentifier, TreeNodeStoredSchema> = new Map();\n\tfor (const [key, schema] of Object.entries(f.nodes)) {\n\t\tconst storedSchemaDecoder = storedSchemaDecodeDispatcher.dispatch(schema);\n\n\t\t// No metadata in v1, so pass undefined\n\t\tnodeSchema.set(brand(key), storedSchemaDecoder(undefined));\n\t}\n\treturn {\n\t\trootFieldSchema: decodeFieldSchema(f.root),\n\t\tnodeSchema,\n\t};\n}\n\nfunction decodeV2(f: FormatV2): TreeStoredSchema {\n\tconst nodeSchema: Map<TreeNodeSchemaIdentifier, TreeNodeStoredSchema> = new Map();\n\tfor (const [key, schema] of Object.entries(f.nodes)) {\n\t\tconst storedSchemaDecoder = storedSchemaDecodeDispatcher.dispatch(schema.kind);\n\n\t\t// Pass in the node metadata\n\t\tnodeSchema.set(brand(key), storedSchemaDecoder(schema.metadata));\n\t}\n\treturn {\n\t\trootFieldSchema: decodeFieldSchema(f.root),\n\t\tnodeSchema,\n\t};\n}\n\n/**\n * Creates a codec which performs synchronous monolithic encoding of schema content.\n * @param options - Specifies common codec options, including which `validator` to use.\n * @returns The codec.\n */\nfunction makeSchemaCodecV1(options: ICodecOptions): IJsonCodec<TreeStoredSchema, FormatV1> {\n\treturn makeVersionedValidatedCodec(options, new Set([SchemaVersion.v1]), FormatV1, {\n\t\tencode: (data: TreeStoredSchema) => encodeRepoV1(data),\n\t\tdecode: (data: FormatV1) => decodeV1(data),\n\t});\n}\n\n/**\n * Creates a codec which performs synchronous monolithic encoding of schema content.\n * @param options - Specifies common codec options, including which `validator` to use.\n * @returns The codec.\n */\nfunction makeSchemaCodecV2(options: ICodecOptions): IJsonCodec<TreeStoredSchema, FormatV2> {\n\treturn makeVersionedValidatedCodec(options, new Set([SchemaVersion.v2]), FormatV2, {\n\t\tencode: (data: TreeStoredSchema) => encodeRepoV2(data),\n\t\tdecode: (data: FormatV2) => decodeV2(data),\n\t});\n}\n"]}
@@ -15,7 +15,7 @@ import { SchemaVersion, schemaFormatV1 } from "../../core/index.js";
15
15
  * It also makes it simpler to determinately sort by keys.
16
16
  */
17
17
  export declare const Format: import("@sinclair/typebox").TObject<{
18
- version: import("@sinclair/typebox").TLiteral<SchemaVersion>;
18
+ version: import("@sinclair/typebox").TLiteral<SchemaVersion.v1>;
19
19
  nodes: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
20
20
  object: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
21
21
  kind: import("@sinclair/typebox").TUnsafe<schemaFormatV1.FieldKindIdentifier>;
@@ -0,0 +1,42 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { type Static } from "@sinclair/typebox";
6
+ import { SchemaVersion } from "../../core/index.js";
7
+ /**
8
+ * Format for encoding as json.
9
+ *
10
+ * For consistency all lists are sorted and undefined values are omitted.
11
+ *
12
+ * This chooses to use lists of named objects instead of maps:
13
+ * this choice is somewhat arbitrary, but avoids user data being used as object keys,
14
+ * which can sometimes be an issue (for example handling that for "__proto__" can require care).
15
+ * It also makes it simpler to determinately sort by keys.
16
+ */
17
+ export declare const Format: import("@sinclair/typebox").TObject<{
18
+ version: import("@sinclair/typebox").TLiteral<SchemaVersion.v2>;
19
+ nodes: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
20
+ kind: import("@sinclair/typebox").TObject<{
21
+ object: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
22
+ kind: import("@sinclair/typebox").TUnsafe<import("../../core/index.js").FieldKindIdentifier>;
23
+ types: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnsafe<import("../../core/index.js").TreeNodeSchemaIdentifier<string>>>;
24
+ metadata: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
25
+ }>>>;
26
+ map: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
27
+ kind: import("@sinclair/typebox").TUnsafe<import("../../core/index.js").FieldKindIdentifier>;
28
+ types: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnsafe<import("../../core/index.js").TreeNodeSchemaIdentifier<string>>>;
29
+ metadata: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
30
+ }>>;
31
+ leaf: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TEnum<typeof import("../../core/schema-stored/formatV1.js").PersistedValueSchema>>;
32
+ }>;
33
+ metadata: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
34
+ }>>;
35
+ root: import("@sinclair/typebox").TObject<{
36
+ kind: import("@sinclair/typebox").TUnsafe<import("../../core/index.js").FieldKindIdentifier>;
37
+ types: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnsafe<import("../../core/index.js").TreeNodeSchemaIdentifier<string>>>;
38
+ metadata: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
39
+ }>;
40
+ }>;
41
+ export type Format = Static<typeof Format>;
42
+ //# sourceMappingURL=formatV2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatV2.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/schema-index/formatV2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAsB,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAkB,MAAM,qBAAqB,CAAC;AAIpE;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;EAOlB,CAAC;AACF,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /*!
3
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
+ * Licensed under the MIT License.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.Format = void 0;
8
+ const typebox_1 = require("@sinclair/typebox");
9
+ const index_js_1 = require("../../core/index.js");
10
+ const noAdditionalProps = { additionalProperties: false };
11
+ /**
12
+ * Format for encoding as json.
13
+ *
14
+ * For consistency all lists are sorted and undefined values are omitted.
15
+ *
16
+ * This chooses to use lists of named objects instead of maps:
17
+ * this choice is somewhat arbitrary, but avoids user data being used as object keys,
18
+ * which can sometimes be an issue (for example handling that for "__proto__" can require care).
19
+ * It also makes it simpler to determinately sort by keys.
20
+ */
21
+ exports.Format = typebox_1.Type.Object({
22
+ version: typebox_1.Type.Literal(index_js_1.SchemaVersion.v2),
23
+ nodes: typebox_1.Type.Record(typebox_1.Type.String(), index_js_1.schemaFormatV2.TreeNodeSchemaDataFormat),
24
+ root: index_js_1.schemaFormatV2.FieldSchemaFormat,
25
+ }, noAdditionalProps);
26
+ //# sourceMappingURL=formatV2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatV2.js","sourceRoot":"","sources":["../../../src/feature-libraries/schema-index/formatV2.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAA0E;AAE1E,kDAAoE;AAEpE,MAAM,iBAAiB,GAAkB,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC;AAEzE;;;;;;;;;GASG;AACU,QAAA,MAAM,GAAG,cAAI,CAAC,MAAM,CAChC;IACC,OAAO,EAAE,cAAI,CAAC,OAAO,CAAC,wBAAa,CAAC,EAAE,CAAC;IACvC,KAAK,EAAE,cAAI,CAAC,MAAM,CAAC,cAAI,CAAC,MAAM,EAAE,EAAE,yBAAc,CAAC,wBAAwB,CAAC;IAC1E,IAAI,EAAE,yBAAc,CAAC,iBAAiB;CACtC,EACD,iBAAiB,CACjB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ObjectOptions, type Static, Type } from \"@sinclair/typebox\";\n\nimport { SchemaVersion, schemaFormatV2 } from \"../../core/index.js\";\n\nconst noAdditionalProps: ObjectOptions = { additionalProperties: false };\n\n/**\n * Format for encoding as json.\n *\n * For consistency all lists are sorted and undefined values are omitted.\n *\n * This chooses to use lists of named objects instead of maps:\n * this choice is somewhat arbitrary, but avoids user data being used as object keys,\n * which can sometimes be an issue (for example handling that for \"__proto__\" can require care).\n * It also makes it simpler to determinately sort by keys.\n */\nexport const Format = Type.Object(\n\t{\n\t\tversion: Type.Literal(SchemaVersion.v2),\n\t\tnodes: Type.Record(Type.String(), schemaFormatV2.TreeNodeSchemaDataFormat),\n\t\troot: schemaFormatV2.FieldSchemaFormat,\n\t},\n\tnoAdditionalProps,\n);\nexport type Format = Static<typeof Format>;\n"]}
@@ -4,5 +4,6 @@
4
4
  */
5
5
  export { SchemaSummarizer, encodeTreeSchema } from "./schemaSummarizer.js";
6
6
  export { makeSchemaCodec, makeSchemaCodecs, clientVersionToSchemaVersion, } from "./codec.js";
7
- export { Format } from "./formatV1.js";
7
+ export { Format as FormatV1 } from "./formatV1.js";
8
+ export { Format as FormatV2 } from "./formatV2.js";
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/schema-index/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EACN,eAAe,EACf,gBAAgB,EAChB,4BAA4B,GAC5B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/schema-index/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EACN,eAAe,EACf,gBAAgB,EAChB,4BAA4B,GAC5B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC"}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.Format = exports.clientVersionToSchemaVersion = exports.makeSchemaCodecs = exports.makeSchemaCodec = exports.encodeTreeSchema = exports.SchemaSummarizer = void 0;
7
+ exports.FormatV2 = exports.FormatV1 = exports.clientVersionToSchemaVersion = exports.makeSchemaCodecs = exports.makeSchemaCodec = exports.encodeTreeSchema = exports.SchemaSummarizer = void 0;
8
8
  var schemaSummarizer_js_1 = require("./schemaSummarizer.js");
9
9
  Object.defineProperty(exports, "SchemaSummarizer", { enumerable: true, get: function () { return schemaSummarizer_js_1.SchemaSummarizer; } });
10
10
  Object.defineProperty(exports, "encodeTreeSchema", { enumerable: true, get: function () { return schemaSummarizer_js_1.encodeTreeSchema; } });
@@ -13,5 +13,7 @@ Object.defineProperty(exports, "makeSchemaCodec", { enumerable: true, get: funct
13
13
  Object.defineProperty(exports, "makeSchemaCodecs", { enumerable: true, get: function () { return codec_js_1.makeSchemaCodecs; } });
14
14
  Object.defineProperty(exports, "clientVersionToSchemaVersion", { enumerable: true, get: function () { return codec_js_1.clientVersionToSchemaVersion; } });
15
15
  var formatV1_js_1 = require("./formatV1.js");
16
- Object.defineProperty(exports, "Format", { enumerable: true, get: function () { return formatV1_js_1.Format; } });
16
+ Object.defineProperty(exports, "FormatV1", { enumerable: true, get: function () { return formatV1_js_1.Format; } });
17
+ var formatV2_js_1 = require("./formatV2.js");
18
+ Object.defineProperty(exports, "FormatV2", { enumerable: true, get: function () { return formatV2_js_1.Format; } });
17
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/schema-index/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6DAA2E;AAAlE,uHAAA,gBAAgB,OAAA;AAAE,uHAAA,gBAAgB,OAAA;AAC3C,uCAIoB;AAHnB,2GAAA,eAAe,OAAA;AACf,4GAAA,gBAAgB,OAAA;AAChB,wHAAA,4BAA4B,OAAA;AAE7B,6CAAuC;AAA9B,qGAAA,MAAM,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { SchemaSummarizer, encodeTreeSchema } from \"./schemaSummarizer.js\";\nexport {\n\tmakeSchemaCodec,\n\tmakeSchemaCodecs,\n\tclientVersionToSchemaVersion,\n} from \"./codec.js\";\nexport { Format } from \"./formatV1.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/schema-index/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6DAA2E;AAAlE,uHAAA,gBAAgB,OAAA;AAAE,uHAAA,gBAAgB,OAAA;AAC3C,uCAIoB;AAHnB,2GAAA,eAAe,OAAA;AACf,4GAAA,gBAAgB,OAAA;AAChB,wHAAA,4BAA4B,OAAA;AAE7B,6CAAmD;AAA1C,uGAAA,MAAM,OAAY;AAC3B,6CAAmD;AAA1C,uGAAA,MAAM,OAAY","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { SchemaSummarizer, encodeTreeSchema } from \"./schemaSummarizer.js\";\nexport {\n\tmakeSchemaCodec,\n\tmakeSchemaCodecs,\n\tclientVersionToSchemaVersion,\n} from \"./codec.js\";\nexport { Format as FormatV1 } from \"./formatV1.js\";\nexport { Format as FormatV2 } from \"./formatV2.js\";\n"]}
@@ -18,8 +18,13 @@ export declare class SchemaSummarizer implements Summarizable {
18
18
  readonly key = "Schema";
19
19
  private schemaIndexLastChangedSeq;
20
20
  constructor(schema: MutableTreeStoredSchema, collabWindow: CollabWindow, codec: IJsonCodec<TreeStoredSchema>);
21
- getAttachSummary(stringify: SummaryElementStringifier, fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext, incrementalSummaryContext?: IExperimentalIncrementalSummaryContext | undefined): ISummaryTreeWithStats;
22
- summarize(stringify: SummaryElementStringifier, fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext, incrementalSummaryContext?: IExperimentalIncrementalSummaryContext | undefined): Promise<ISummaryTreeWithStats>;
21
+ summarize(props: {
22
+ stringify: SummaryElementStringifier;
23
+ fullTree?: boolean;
24
+ trackState?: boolean;
25
+ telemetryContext?: ITelemetryContext;
26
+ incrementalSummaryContext?: IExperimentalIncrementalSummaryContext;
27
+ }): ISummaryTreeWithStats;
23
28
  load(services: IChannelStorageService, parse: SummaryElementParser): Promise<void>;
24
29
  }
25
30
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"schemaSummarizer.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/schema-index/schemaSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAE7F,OAAO,KAAK,EACX,sCAAsC,EACtC,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,8CAA8C,CAAC;AAGtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACN,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EAErB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACX,YAAY,EACZ,oBAAoB,EACpB,yBAAyB,EACzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAKxE;;GAEG;AACH,qBAAa,gBAAiB,YAAW,YAAY;IAMnD,OAAO,CAAC,QAAQ,CAAC,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAPvB,SAAgB,GAAG,YAAY;IAE/B,OAAO,CAAC,yBAAyB,CAAqB;gBAGpC,MAAM,EAAE,uBAAuB,EAChD,YAAY,EAAE,YAAY,EACT,KAAK,EAAE,UAAU,CAAC,gBAAgB,CAAC;IAS9C,gBAAgB,CACtB,SAAS,EAAE,yBAAyB,EACpC,QAAQ,CAAC,EAAE,OAAO,EAClB,UAAU,CAAC,EAAE,OAAO,EACpB,gBAAgB,CAAC,EAAE,iBAAiB,EACpC,yBAAyB,CAAC,EAAE,sCAAsC,GAAG,SAAS,GAC5E,qBAAqB;IAmBX,SAAS,CACrB,SAAS,EAAE,yBAAyB,EACpC,QAAQ,CAAC,EAAE,OAAO,EAClB,UAAU,CAAC,EAAE,OAAO,EACpB,gBAAgB,CAAC,EAAE,iBAAiB,EACpC,yBAAyB,CAAC,EAAE,sCAAsC,GAAG,SAAS,GAC5E,OAAO,CAAC,qBAAqB,CAAC;IAIpB,IAAI,CAChB,QAAQ,EAAE,sBAAsB,EAChC,KAAK,EAAE,oBAAoB,GACzB,OAAO,CAAC,IAAI,CAAC;CAgBhB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC/B,MAAM,EAAE,gBAAgB,EACxB,YAAY,EAAE,MAAM,GAClB,cAAc,CAEhB"}
1
+ {"version":3,"file":"schemaSummarizer.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/schema-index/schemaSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAE7F,OAAO,KAAK,EACX,sCAAsC,EACtC,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,8CAA8C,CAAC;AAGtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACN,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EAErB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACX,YAAY,EACZ,oBAAoB,EACpB,yBAAyB,EACzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAKxE;;GAEG;AACH,qBAAa,gBAAiB,YAAW,YAAY;IAMnD,OAAO,CAAC,QAAQ,CAAC,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAPvB,SAAgB,GAAG,YAAY;IAE/B,OAAO,CAAC,yBAAyB,CAAqB;gBAGpC,MAAM,EAAE,uBAAuB,EAChD,YAAY,EAAE,YAAY,EACT,KAAK,EAAE,UAAU,CAAC,gBAAgB,CAAC;IAS9C,SAAS,CAAC,KAAK,EAAE;QACvB,SAAS,EAAE,yBAAyB,CAAC;QACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,gBAAgB,CAAC,EAAE,iBAAiB,CAAC;QACrC,yBAAyB,CAAC,EAAE,sCAAsC,CAAC;KACnE,GAAG,qBAAqB;IAsBZ,IAAI,CAChB,QAAQ,EAAE,sBAAsB,EAChC,KAAK,EAAE,oBAAoB,GACzB,OAAO,CAAC,IAAI,CAAC;CAgBhB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC/B,MAAM,EAAE,gBAAgB,EACxB,YAAY,EAAE,MAAM,GAClB,cAAc,CAEhB"}
@@ -26,12 +26,15 @@ class SchemaSummarizer {
26
26
  this.schemaIndexLastChangedSeq = collabWindow.getCurrentSeq();
27
27
  });
28
28
  }
29
- getAttachSummary(stringify, fullTree, trackState, telemetryContext, incrementalSummaryContext) {
29
+ summarize(props) {
30
+ const incrementalSummaryContext = props.incrementalSummaryContext;
30
31
  const builder = new internal_2.SummaryTreeBuilder();
31
- if (incrementalSummaryContext !== undefined &&
32
+ const fullTree = props.fullTree ?? false;
33
+ if (!fullTree &&
34
+ incrementalSummaryContext !== undefined &&
32
35
  this.schemaIndexLastChangedSeq !== undefined &&
33
36
  incrementalSummaryContext.latestSummarySequenceNumber >= this.schemaIndexLastChangedSeq) {
34
- builder.addHandle(schemaStringKey, driver_definitions_1.SummaryType.Blob, `${incrementalSummaryContext.summaryPath}/indexes/${this.key}/${schemaStringKey}`);
37
+ builder.addHandle(schemaStringKey, driver_definitions_1.SummaryType.Blob, `${incrementalSummaryContext.summaryPath}/${schemaStringKey}`);
35
38
  }
36
39
  else {
37
40
  const dataString = JSON.stringify(this.codec.encode(this.schema));
@@ -39,9 +42,6 @@ class SchemaSummarizer {
39
42
  }
40
43
  return builder.getSummaryTree();
41
44
  }
42
- async summarize(stringify, fullTree, trackState, telemetryContext, incrementalSummaryContext) {
43
- throw new Error("Method not implemented.");
44
- }
45
45
  async load(services, parse) {
46
46
  const schemaBuffer = await services.readBlob(schemaStringKey);
47
47
  // After the awaits, validate that the schema is in a clean state.
@@ -1 +1 @@
1
- {"version":3,"file":"schemaSummarizer.js","sourceRoot":"","sources":["../../../src/feature-libraries/schema-index/schemaSummarizer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8D;AAC9D,kEAA6D;AAE7D,2EAAiE;AAMjE,qEAA4E;AAG5E,kDAI6B;AAS7B,yCAAwC;AAExC,MAAM,eAAe,GAAG,cAAc,CAAC;AACvC;;GAEG;AACH,MAAa,gBAAgB;IAK5B,YACkB,MAA+B,EAChD,YAA0B,EACT,KAAmC;QAFnC,WAAM,GAAN,MAAM,CAAyB;QAE/B,UAAK,GAAL,KAAK,CAA8B;QAPrC,QAAG,GAAG,QAAQ,CAAC;QAS9B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;YAC/C,gFAAgF;YAChF,uGAAuG;YACvG,IAAI,CAAC,yBAAyB,GAAG,YAAY,CAAC,aAAa,EAAE,CAAC;QAC/D,CAAC,CAAC,CAAC;IACJ,CAAC;IAEM,gBAAgB,CACtB,SAAoC,EACpC,QAAkB,EAClB,UAAoB,EAC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KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;QAC5D,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,IAAI,CAAC,yBAAyB,GAAG,CAAC,CAAC;IACpC,CAAC;CACD;AAvED,4CAuEC;AAED;;;;;GAKG;AACH,SAAgB,gBAAgB,CAC/B,MAAwB,EACxB,YAAoB;IAEpB,OAAO,IAAA,qBAAU,EAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AACzC,CAAC;AALD,4CAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport { SummaryType } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIExperimentalIncrementalSummaryContext,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils/internal\";\n\nimport type { IJsonCodec } from \"../../codec/index.js\";\nimport {\n\ttype MutableTreeStoredSchema,\n\ttype TreeStoredSchema,\n\tschemaDataIsEmpty,\n} from \"../../core/index.js\";\nimport type {\n\tSummarizable,\n\tSummaryElementParser,\n\tSummaryElementStringifier,\n} from \"../../shared-tree-core/index.js\";\nimport type { JsonCompatible } from \"../../util/index.js\";\nimport type { CollabWindow } from \"../incrementalSummarizationUtils.js\";\n\nimport { encodeRepo } from \"./codec.js\";\n\nconst schemaStringKey = \"SchemaString\";\n/**\n * Provides methods for summarizing and loading a schema repository.\n */\nexport class SchemaSummarizer implements Summarizable {\n\tpublic readonly key = \"Schema\";\n\n\tprivate schemaIndexLastChangedSeq: number | undefined;\n\n\tpublic constructor(\n\t\tprivate readonly schema: MutableTreeStoredSchema,\n\t\tcollabWindow: CollabWindow,\n\t\tprivate readonly codec: IJsonCodec<TreeStoredSchema>,\n\t) {\n\t\tthis.schema.events.on(\"afterSchemaChange\", () => {\n\t\t\t// Invalidate the cache, as we need to regenerate the blob if the schema changes\n\t\t\t// We are assuming that schema changes from remote ops are valid, as we are in a summarization context.\n\t\t\tthis.schemaIndexLastChangedSeq = collabWindow.getCurrentSeq();\n\t\t});\n\t}\n\n\tpublic getAttachSummary(\n\t\tstringify: SummaryElementStringifier,\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext | undefined,\n\t): ISummaryTreeWithStats {\n\t\tconst builder = new SummaryTreeBuilder();\n\t\tif (\n\t\t\tincrementalSummaryContext !== undefined &&\n\t\t\tthis.schemaIndexLastChangedSeq !== undefined &&\n\t\t\tincrementalSummaryContext.latestSummarySequenceNumber >= this.schemaIndexLastChangedSeq\n\t\t) {\n\t\t\tbuilder.addHandle(\n\t\t\t\tschemaStringKey,\n\t\t\t\tSummaryType.Blob,\n\t\t\t\t`${incrementalSummaryContext.summaryPath}/indexes/${this.key}/${schemaStringKey}`,\n\t\t\t);\n\t\t} else {\n\t\t\tconst dataString = JSON.stringify(this.codec.encode(this.schema));\n\t\t\tbuilder.addBlob(schemaStringKey, dataString);\n\t\t}\n\t\treturn builder.getSummaryTree();\n\t}\n\n\tpublic async summarize(\n\t\tstringify: SummaryElementStringifier,\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext | undefined,\n\t): Promise<ISummaryTreeWithStats> {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\tpublic async load(\n\t\tservices: IChannelStorageService,\n\t\tparse: SummaryElementParser,\n\t): Promise<void> {\n\t\tconst schemaBuffer: ArrayBufferLike = await services.readBlob(schemaStringKey);\n\t\t// After the awaits, validate that the schema is in a clean state.\n\t\t// This detects any schema that could have been accidentally added through\n\t\t// invalid means and are about to be overwritten.\n\t\tassert(\n\t\t\tschemaDataIsEmpty(this.schema),\n\t\t\t0x3da /* there should not already be stored schema when loading stored schema */,\n\t\t);\n\n\t\tconst schemaString = bufferToString(schemaBuffer, \"utf-8\");\n\t\t// Currently no Fluid handles are used, so just use JSON.parse.\n\t\tconst decoded = this.codec.decode(JSON.parse(schemaString));\n\t\tthis.schema.apply(decoded);\n\t\tthis.schemaIndexLastChangedSeq = 0;\n\t}\n}\n\n/**\n * Dumps schema into a deterministic JSON compatible semi-human readable format.\n *\n * @remarks\n * 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.\n */\nexport function encodeTreeSchema(\n\tschema: TreeStoredSchema,\n\twriteVersion: number,\n): JsonCompatible {\n\treturn encodeRepo(schema, writeVersion);\n}\n"]}
1
+ {"version":3,"file":"schemaSummarizer.js","sourceRoot":"","sources":["../../../src/feature-libraries/schema-index/schemaSummarizer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8D;AAC9D,kEAA6D;AAE7D,2EAAiE;AAMjE,qEAA4E;AAG5E,kDAI6B;AAS7B,yCAAwC;AAExC,MAAM,eAAe,GAAG,cAAc,CAAC;AACvC;;GAEG;AACH,MAAa,gBAAgB;IAK5B,YACkB,MAA+B,EAChD,YAA0B,EACT,KAAmC;QAFnC,WAAM,GAAN,MAAM,CAAyB;QAE/B,UAAK,GAAL,KAAK,CAA8B;QAPrC,QAAG,GAAG,QAAQ,CAAC;QAS9B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;YAC/C,gFAAgF;YAChF,uGAAuG;YACvG,IAAI,CAAC,yBAAyB,GAAG,YAAY,CAAC,aAAa,EAAE,CAAC;QAC/D,CAAC,CAAC,CAAC;IACJ,CAAC;IAEM,SAAS,CAAC,KAMhB;QACA,MAAM,yBAAyB,GAAG,KAAK,CAAC,yBAAyB,CAAC;QAClE,MA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,CAAC;IACpC,CAAC;CACD;AAhED,4CAgEC;AAED;;;;;GAKG;AACH,SAAgB,gBAAgB,CAC/B,MAAwB,EACxB,YAAoB;IAEpB,OAAO,IAAA,qBAAU,EAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AACzC,CAAC;AALD,4CAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport { SummaryType } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIExperimentalIncrementalSummaryContext,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils/internal\";\n\nimport type { IJsonCodec } from \"../../codec/index.js\";\nimport {\n\ttype MutableTreeStoredSchema,\n\ttype TreeStoredSchema,\n\tschemaDataIsEmpty,\n} from \"../../core/index.js\";\nimport type {\n\tSummarizable,\n\tSummaryElementParser,\n\tSummaryElementStringifier,\n} from \"../../shared-tree-core/index.js\";\nimport type { JsonCompatible } from \"../../util/index.js\";\nimport type { CollabWindow } from \"../incrementalSummarizationUtils.js\";\n\nimport { encodeRepo } from \"./codec.js\";\n\nconst schemaStringKey = \"SchemaString\";\n/**\n * Provides methods for summarizing and loading a schema repository.\n */\nexport class SchemaSummarizer implements Summarizable {\n\tpublic readonly key = \"Schema\";\n\n\tprivate schemaIndexLastChangedSeq: number | undefined;\n\n\tpublic constructor(\n\t\tprivate readonly schema: MutableTreeStoredSchema,\n\t\tcollabWindow: CollabWindow,\n\t\tprivate readonly codec: IJsonCodec<TreeStoredSchema>,\n\t) {\n\t\tthis.schema.events.on(\"afterSchemaChange\", () => {\n\t\t\t// Invalidate the cache, as we need to regenerate the blob if the schema changes\n\t\t\t// We are assuming that schema changes from remote ops are valid, as we are in a summarization context.\n\t\t\tthis.schemaIndexLastChangedSeq = collabWindow.getCurrentSeq();\n\t\t});\n\t}\n\n\tpublic summarize(props: {\n\t\tstringify: SummaryElementStringifier;\n\t\tfullTree?: boolean;\n\t\ttrackState?: boolean;\n\t\ttelemetryContext?: ITelemetryContext;\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext;\n\t}): ISummaryTreeWithStats {\n\t\tconst incrementalSummaryContext = props.incrementalSummaryContext;\n\t\tconst builder = new SummaryTreeBuilder();\n\t\tconst fullTree = props.fullTree ?? false;\n\t\tif (\n\t\t\t!fullTree &&\n\t\t\tincrementalSummaryContext !== undefined &&\n\t\t\tthis.schemaIndexLastChangedSeq !== undefined &&\n\t\t\tincrementalSummaryContext.latestSummarySequenceNumber >= this.schemaIndexLastChangedSeq\n\t\t) {\n\t\t\tbuilder.addHandle(\n\t\t\t\tschemaStringKey,\n\t\t\t\tSummaryType.Blob,\n\t\t\t\t`${incrementalSummaryContext.summaryPath}/${schemaStringKey}`,\n\t\t\t);\n\t\t} else {\n\t\t\tconst dataString = JSON.stringify(this.codec.encode(this.schema));\n\t\t\tbuilder.addBlob(schemaStringKey, dataString);\n\t\t}\n\t\treturn builder.getSummaryTree();\n\t}\n\n\tpublic async load(\n\t\tservices: IChannelStorageService,\n\t\tparse: SummaryElementParser,\n\t): Promise<void> {\n\t\tconst schemaBuffer: ArrayBufferLike = await services.readBlob(schemaStringKey);\n\t\t// After the awaits, validate that the schema is in a clean state.\n\t\t// This detects any schema that could have been accidentally added through\n\t\t// invalid means and are about to be overwritten.\n\t\tassert(\n\t\t\tschemaDataIsEmpty(this.schema),\n\t\t\t0x3da /* there should not already be stored schema when loading stored schema */,\n\t\t);\n\n\t\tconst schemaString = bufferToString(schemaBuffer, \"utf-8\");\n\t\t// Currently no Fluid handles are used, so just use JSON.parse.\n\t\tconst decoded = this.codec.decode(JSON.parse(schemaString));\n\t\tthis.schema.apply(decoded);\n\t\tthis.schemaIndexLastChangedSeq = 0;\n\t}\n}\n\n/**\n * Dumps schema into a deterministic JSON compatible semi-human readable format.\n *\n * @remarks\n * 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.\n */\nexport function encodeTreeSchema(\n\tschema: TreeStoredSchema,\n\twriteVersion: number,\n): JsonCompatible {\n\treturn encodeRepo(schema, writeVersion);\n}\n"]}
@@ -35,6 +35,10 @@ export declare function stackTreeNodeCursor<TNode>(adapter: CursorAdapter<TNode>
35
35
  * @returns an {@link ITreeCursorSynchronous} for `detachedField` of `root` in `fields` mode.
36
36
  */
37
37
  export declare function stackTreeFieldCursor<TNode>(adapter: CursorAdapter<TNode>, root: TNode, detachedField?: DetachedField): CursorWithNode<TNode>;
38
+ /**
39
+ * The representation of a field used by {@link CursorAdapter}.
40
+ */
41
+ export type Field<TNode> = Pick<readonly TNode[], typeof Symbol.iterator | "length" | number>;
38
42
  /**
39
43
  * Provides functionality to allow a {@link stackTreeNodeCursor} and {@link stackTreeFieldCursor} to implement cursors.
40
44
  */
@@ -54,7 +58,7 @@ export interface CursorAdapter<TNode> {
54
58
  /**
55
59
  * @returns the child nodes for the given node and key.
56
60
  */
57
- getFieldFromNode(node: TNode, key: FieldKey): readonly TNode[];
61
+ getFieldFromNode(node: TNode, key: FieldKey): Field<TNode>;
58
62
  }
59
63
  /**
60
64
  * A class that satisfies part of the ITreeCursorSynchronous implementation.
@@ -1 +1 @@
1
- {"version":3,"file":"treeCursorUtils.d.ts","sourceRoot":"","sources":["../../src/feature-libraries/treeCursorUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAEN,YAAY,EACZ,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,MAAM,EACX,KAAK,KAAK,EAGV,MAAM,kBAAkB,CAAC;AAE1B;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,KAAK,CA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,IAAI,MAAM,GAAG,SAAS,CAEtC;CACD"}
@@ -83,12 +83,16 @@ class StackCursor extends SynchronousCursor {
83
83
  }
84
84
  getFieldKey() {
85
85
  (0, internal_1.debugAssert)(() => this.mode === 1 /* CursorLocationType.Fields */ ? true : "must be in fields mode");
86
+ // index is kept inbounds as an invariant of the class.
87
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
86
88
  return this.siblings[this.index];
87
89
  }
88
90
  getStackedFieldKey(height) {
89
91
  (0, internal_1.assert)(height % 2 === 1, 0x3b8 /* must field height */);
90
92
  const siblingStack = this.siblingStack[height] ?? (0, internal_1.oob)();
91
93
  const indexStack = this.indexStack[height] ?? (0, internal_1.oob)();
94
+ // index is kept inbounds as an invariant of the class.
95
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
92
96
  return siblingStack[indexStack];
93
97
  }
94
98
  getStackedNodeIndex(height) {
@@ -97,7 +101,8 @@ class StackCursor extends SynchronousCursor {
97
101
  }
98
102
  getStackedNode(height) {
99
103
  const index = this.getStackedNodeIndex(height);
100
- // Test is failing when using `?? oob()` here.
104
+ // Can not use `?? oob()` since null and undefined are valid values.
105
+ // index is kept inbounds as an invariant of the class.
101
106
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
102
107
  return this.siblingStack[height][index];
103
108
  }
@@ -249,7 +254,8 @@ class StackCursor extends SynchronousCursor {
249
254
  }
250
255
  getNode() {
251
256
  // assert(this.mode === CursorLocationType.Nodes, "can only get node when in node");
252
- // Test is failing when using `?? oob()` here.
257
+ // Can not use `?? oob()` since null and undefined are valid values.
258
+ // index is kept inbounds as an invariant of the class.
253
259
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
254
260
  return this.siblings[this.index];
255
261
  }