@fluidframework/tree 2.41.0 → 2.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (416) hide show
  1. package/.vscode/settings.json +1 -0
  2. package/CHANGELOG.md +33 -0
  3. package/api-report/tree.alpha.api.md +11 -7
  4. package/dist/alpha.d.ts +1 -0
  5. package/dist/codec/codec.d.ts +23 -3
  6. package/dist/codec/codec.d.ts.map +1 -1
  7. package/dist/codec/codec.js.map +1 -1
  8. package/dist/codec/index.d.ts +1 -1
  9. package/dist/codec/index.d.ts.map +1 -1
  10. package/dist/codec/index.js.map +1 -1
  11. package/dist/codec/versioned/codec.d.ts +35 -2
  12. package/dist/codec/versioned/codec.d.ts.map +1 -1
  13. package/dist/codec/versioned/codec.js +38 -3
  14. package/dist/codec/versioned/codec.js.map +1 -1
  15. package/dist/core/tree/detachedFieldIndex.d.ts +2 -2
  16. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  17. package/dist/core/tree/detachedFieldIndex.js +5 -1
  18. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  19. package/dist/core/tree/mapTree.d.ts +2 -1
  20. package/dist/core/tree/mapTree.d.ts.map +1 -1
  21. package/dist/core/tree/mapTree.js +11 -5
  22. package/dist/core/tree/mapTree.js.map +1 -1
  23. package/dist/core/tree/visitorUtils.d.ts +2 -2
  24. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  25. package/dist/core/tree/visitorUtils.js.map +1 -1
  26. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +3 -2
  27. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  28. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  29. package/dist/feature-libraries/default-schema/schemaChecker.d.ts +4 -3
  30. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  31. package/dist/feature-libraries/default-schema/schemaChecker.js +4 -3
  32. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  33. package/dist/feature-libraries/flex-tree/context.d.ts +14 -6
  34. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  35. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  36. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +34 -14
  37. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  38. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +4 -0
  39. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  40. package/dist/feature-libraries/flex-tree/index.d.ts +2 -2
  41. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  42. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  43. package/dist/feature-libraries/flex-tree/lazyField.d.ts +6 -6
  44. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  45. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  46. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +3 -2
  47. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  48. package/dist/feature-libraries/flex-tree/lazyNode.js +3 -0
  49. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  50. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +2 -2
  51. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  52. package/dist/feature-libraries/forest-summary/forestSummarizer.js +7 -7
  53. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  54. package/dist/feature-libraries/index.d.ts +2 -2
  55. package/dist/feature-libraries/index.d.ts.map +1 -1
  56. package/dist/feature-libraries/index.js +4 -2
  57. package/dist/feature-libraries/index.js.map +1 -1
  58. package/dist/feature-libraries/mapTreeCursor.d.ts +39 -3
  59. package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  60. package/dist/feature-libraries/mapTreeCursor.js +45 -7
  61. package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
  62. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +1 -1
  63. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  64. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +5 -5
  65. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  66. package/dist/feature-libraries/treeCursorUtils.d.ts +5 -1
  67. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  68. package/dist/feature-libraries/treeCursorUtils.js +8 -2
  69. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  70. package/dist/index.d.ts +1 -1
  71. package/dist/index.d.ts.map +1 -1
  72. package/dist/index.js.map +1 -1
  73. package/dist/packageVersion.d.ts +1 -1
  74. package/dist/packageVersion.js +1 -1
  75. package/dist/packageVersion.js.map +1 -1
  76. package/dist/shared-tree/schematizingTreeView.d.ts +11 -1
  77. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  78. package/dist/shared-tree/schematizingTreeView.js +36 -22
  79. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  80. package/dist/shared-tree/sharedTree.d.ts +3 -3
  81. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  82. package/dist/shared-tree/sharedTree.js +1 -0
  83. package/dist/shared-tree/sharedTree.js.map +1 -1
  84. package/dist/shared-tree/tree.d.ts.map +1 -1
  85. package/dist/shared-tree/tree.js +8 -24
  86. package/dist/shared-tree/tree.js.map +1 -1
  87. package/dist/shared-tree/treeAlpha.d.ts +2 -3
  88. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  89. package/dist/shared-tree/treeAlpha.js +13 -15
  90. package/dist/shared-tree/treeAlpha.js.map +1 -1
  91. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  92. package/dist/shared-tree/treeCheckout.js +5 -2
  93. package/dist/shared-tree/treeCheckout.js.map +1 -1
  94. package/dist/simple-tree/api/configuration.d.ts +2 -2
  95. package/dist/simple-tree/api/configuration.js +1 -1
  96. package/dist/simple-tree/api/configuration.js.map +1 -1
  97. package/dist/simple-tree/api/create.d.ts +9 -4
  98. package/dist/simple-tree/api/create.d.ts.map +1 -1
  99. package/dist/simple-tree/api/create.js +29 -16
  100. package/dist/simple-tree/api/create.js.map +1 -1
  101. package/dist/simple-tree/api/customTree.d.ts +4 -0
  102. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  103. package/dist/simple-tree/api/customTree.js +9 -1
  104. package/dist/simple-tree/api/customTree.js.map +1 -1
  105. package/dist/simple-tree/api/index.d.ts +1 -1
  106. package/dist/simple-tree/api/index.d.ts.map +1 -1
  107. package/dist/simple-tree/api/index.js +1 -2
  108. package/dist/simple-tree/api/index.js.map +1 -1
  109. package/dist/simple-tree/api/schemaFactory.d.ts +10 -2
  110. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  111. package/dist/simple-tree/api/schemaFactory.js +38 -9
  112. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  113. package/dist/simple-tree/api/treeNodeApi.d.ts +14 -3
  114. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  115. package/dist/simple-tree/api/treeNodeApi.js +32 -17
  116. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  117. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  118. package/dist/simple-tree/api/verboseTree.js +12 -9
  119. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  120. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  121. package/dist/simple-tree/core/getOrCreateNode.js +2 -1
  122. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  123. package/dist/simple-tree/core/index.d.ts +2 -2
  124. package/dist/simple-tree/core/index.d.ts.map +1 -1
  125. package/dist/simple-tree/core/index.js +3 -4
  126. package/dist/simple-tree/core/index.js.map +1 -1
  127. package/dist/simple-tree/core/treeNodeKernel.d.ts +15 -25
  128. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  129. package/dist/simple-tree/core/treeNodeKernel.js +26 -33
  130. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  131. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +128 -59
  132. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  133. package/dist/simple-tree/core/unhydratedFlexTree.js +169 -182
  134. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  135. package/dist/simple-tree/index.d.ts +3 -3
  136. package/dist/simple-tree/index.d.ts.map +1 -1
  137. package/dist/simple-tree/index.js +5 -5
  138. package/dist/simple-tree/index.js.map +1 -1
  139. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  140. package/dist/simple-tree/node-kinds/array/arrayNode.js +5 -6
  141. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  142. package/dist/simple-tree/node-kinds/index.d.ts +1 -1
  143. package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
  144. package/dist/simple-tree/node-kinds/index.js +1 -2
  145. package/dist/simple-tree/node-kinds/index.js.map +1 -1
  146. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  147. package/dist/simple-tree/node-kinds/map/mapNode.js +2 -2
  148. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  149. package/dist/simple-tree/node-kinds/object/index.d.ts +1 -1
  150. package/dist/simple-tree/node-kinds/object/index.d.ts.map +1 -1
  151. package/dist/simple-tree/node-kinds/object/index.js +1 -2
  152. package/dist/simple-tree/node-kinds/object/index.js.map +1 -1
  153. package/dist/simple-tree/node-kinds/object/objectNode.d.ts +3 -14
  154. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  155. package/dist/simple-tree/node-kinds/object/objectNode.js +12 -43
  156. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  157. package/dist/simple-tree/prepareForInsertion.d.ts +20 -6
  158. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
  159. package/dist/simple-tree/prepareForInsertion.js +26 -19
  160. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  161. package/dist/simple-tree/schemaTypes.d.ts +8 -8
  162. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  163. package/dist/simple-tree/schemaTypes.js.map +1 -1
  164. package/dist/simple-tree/toStoredSchema.d.ts +6 -1
  165. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  166. package/dist/simple-tree/toStoredSchema.js +6 -3
  167. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  168. package/dist/simple-tree/{toMapTree.d.ts → unhydratedFlexTreeFromInsertable.d.ts} +12 -23
  169. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -0
  170. package/dist/simple-tree/{toMapTree.js → unhydratedFlexTreeFromInsertable.js} +103 -185
  171. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -0
  172. package/dist/treeFactory.d.ts.map +1 -1
  173. package/dist/treeFactory.js +6 -1
  174. package/dist/treeFactory.js.map +1 -1
  175. package/dist/util/index.d.ts +1 -1
  176. package/dist/util/index.d.ts.map +1 -1
  177. package/dist/util/index.js +2 -1
  178. package/dist/util/index.js.map +1 -1
  179. package/dist/util/utils.d.ts +4 -0
  180. package/dist/util/utils.d.ts.map +1 -1
  181. package/dist/util/utils.js +8 -1
  182. package/dist/util/utils.js.map +1 -1
  183. package/docs/user-facing/schema-evolution.md +1 -1
  184. package/lib/alpha.d.ts +1 -0
  185. package/lib/codec/codec.d.ts +23 -3
  186. package/lib/codec/codec.d.ts.map +1 -1
  187. package/lib/codec/codec.js.map +1 -1
  188. package/lib/codec/index.d.ts +1 -1
  189. package/lib/codec/index.d.ts.map +1 -1
  190. package/lib/codec/index.js.map +1 -1
  191. package/lib/codec/versioned/codec.d.ts +35 -2
  192. package/lib/codec/versioned/codec.d.ts.map +1 -1
  193. package/lib/codec/versioned/codec.js +36 -2
  194. package/lib/codec/versioned/codec.js.map +1 -1
  195. package/lib/core/tree/detachedFieldIndex.d.ts +2 -2
  196. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  197. package/lib/core/tree/detachedFieldIndex.js +6 -2
  198. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  199. package/lib/core/tree/mapTree.d.ts +2 -1
  200. package/lib/core/tree/mapTree.d.ts.map +1 -1
  201. package/lib/core/tree/mapTree.js +11 -5
  202. package/lib/core/tree/mapTree.js.map +1 -1
  203. package/lib/core/tree/visitorUtils.d.ts +2 -2
  204. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  205. package/lib/core/tree/visitorUtils.js.map +1 -1
  206. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +3 -2
  207. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  208. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  209. package/lib/feature-libraries/default-schema/schemaChecker.d.ts +4 -3
  210. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  211. package/lib/feature-libraries/default-schema/schemaChecker.js +4 -3
  212. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  213. package/lib/feature-libraries/flex-tree/context.d.ts +14 -6
  214. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  215. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  216. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +34 -14
  217. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  218. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +4 -0
  219. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  220. package/lib/feature-libraries/flex-tree/index.d.ts +2 -2
  221. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  222. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  223. package/lib/feature-libraries/flex-tree/lazyField.d.ts +6 -6
  224. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  225. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  226. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +3 -2
  227. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  228. package/lib/feature-libraries/flex-tree/lazyNode.js +3 -0
  229. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  230. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +2 -2
  231. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  232. package/lib/feature-libraries/forest-summary/forestSummarizer.js +2 -2
  233. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  234. package/lib/feature-libraries/index.d.ts +2 -2
  235. package/lib/feature-libraries/index.d.ts.map +1 -1
  236. package/lib/feature-libraries/index.js +1 -1
  237. package/lib/feature-libraries/index.js.map +1 -1
  238. package/lib/feature-libraries/mapTreeCursor.d.ts +39 -3
  239. package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  240. package/lib/feature-libraries/mapTreeCursor.js +43 -7
  241. package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
  242. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +1 -1
  243. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  244. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +5 -5
  245. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  246. package/lib/feature-libraries/treeCursorUtils.d.ts +5 -1
  247. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  248. package/lib/feature-libraries/treeCursorUtils.js +8 -2
  249. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  250. package/lib/index.d.ts +1 -1
  251. package/lib/index.d.ts.map +1 -1
  252. package/lib/index.js.map +1 -1
  253. package/lib/packageVersion.d.ts +1 -1
  254. package/lib/packageVersion.js +1 -1
  255. package/lib/packageVersion.js.map +1 -1
  256. package/lib/shared-tree/schematizingTreeView.d.ts +11 -1
  257. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  258. package/lib/shared-tree/schematizingTreeView.js +34 -21
  259. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  260. package/lib/shared-tree/sharedTree.d.ts +3 -3
  261. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  262. package/lib/shared-tree/sharedTree.js +2 -1
  263. package/lib/shared-tree/sharedTree.js.map +1 -1
  264. package/lib/shared-tree/tree.d.ts.map +1 -1
  265. package/lib/shared-tree/tree.js +2 -18
  266. package/lib/shared-tree/tree.js.map +1 -1
  267. package/lib/shared-tree/treeAlpha.d.ts +2 -3
  268. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  269. package/lib/shared-tree/treeAlpha.js +4 -6
  270. package/lib/shared-tree/treeAlpha.js.map +1 -1
  271. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  272. package/lib/shared-tree/treeCheckout.js +6 -3
  273. package/lib/shared-tree/treeCheckout.js.map +1 -1
  274. package/lib/simple-tree/api/configuration.d.ts +2 -2
  275. package/lib/simple-tree/api/configuration.js +1 -1
  276. package/lib/simple-tree/api/configuration.js.map +1 -1
  277. package/lib/simple-tree/api/create.d.ts +9 -4
  278. package/lib/simple-tree/api/create.d.ts.map +1 -1
  279. package/lib/simple-tree/api/create.js +22 -9
  280. package/lib/simple-tree/api/create.js.map +1 -1
  281. package/lib/simple-tree/api/customTree.d.ts +4 -0
  282. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  283. package/lib/simple-tree/api/customTree.js +7 -0
  284. package/lib/simple-tree/api/customTree.js.map +1 -1
  285. package/lib/simple-tree/api/index.d.ts +1 -1
  286. package/lib/simple-tree/api/index.d.ts.map +1 -1
  287. package/lib/simple-tree/api/index.js +1 -1
  288. package/lib/simple-tree/api/index.js.map +1 -1
  289. package/lib/simple-tree/api/schemaFactory.d.ts +10 -2
  290. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  291. package/lib/simple-tree/api/schemaFactory.js +40 -11
  292. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  293. package/lib/simple-tree/api/treeNodeApi.d.ts +14 -3
  294. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  295. package/lib/simple-tree/api/treeNodeApi.js +35 -20
  296. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  297. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  298. package/lib/simple-tree/api/verboseTree.js +13 -10
  299. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  300. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  301. package/lib/simple-tree/core/getOrCreateNode.js +3 -2
  302. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  303. package/lib/simple-tree/core/index.d.ts +2 -2
  304. package/lib/simple-tree/core/index.d.ts.map +1 -1
  305. package/lib/simple-tree/core/index.js +2 -2
  306. package/lib/simple-tree/core/index.js.map +1 -1
  307. package/lib/simple-tree/core/treeNodeKernel.d.ts +15 -25
  308. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  309. package/lib/simple-tree/core/treeNodeKernel.js +24 -32
  310. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  311. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +128 -59
  312. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  313. package/lib/simple-tree/core/unhydratedFlexTree.js +166 -181
  314. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  315. package/lib/simple-tree/index.d.ts +3 -3
  316. package/lib/simple-tree/index.d.ts.map +1 -1
  317. package/lib/simple-tree/index.js +3 -3
  318. package/lib/simple-tree/index.js.map +1 -1
  319. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  320. package/lib/simple-tree/node-kinds/array/arrayNode.js +4 -5
  321. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  322. package/lib/simple-tree/node-kinds/index.d.ts +1 -1
  323. package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
  324. package/lib/simple-tree/node-kinds/index.js +1 -1
  325. package/lib/simple-tree/node-kinds/index.js.map +1 -1
  326. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  327. package/lib/simple-tree/node-kinds/map/mapNode.js +3 -3
  328. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  329. package/lib/simple-tree/node-kinds/object/index.d.ts +1 -1
  330. package/lib/simple-tree/node-kinds/object/index.d.ts.map +1 -1
  331. package/lib/simple-tree/node-kinds/object/index.js +1 -1
  332. package/lib/simple-tree/node-kinds/object/index.js.map +1 -1
  333. package/lib/simple-tree/node-kinds/object/objectNode.d.ts +3 -14
  334. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  335. package/lib/simple-tree/node-kinds/object/objectNode.js +3 -33
  336. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  337. package/lib/simple-tree/prepareForInsertion.d.ts +20 -6
  338. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
  339. package/lib/simple-tree/prepareForInsertion.js +25 -19
  340. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  341. package/lib/simple-tree/schemaTypes.d.ts +8 -8
  342. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  343. package/lib/simple-tree/schemaTypes.js.map +1 -1
  344. package/lib/simple-tree/toStoredSchema.d.ts +6 -1
  345. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  346. package/lib/simple-tree/toStoredSchema.js +4 -1
  347. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  348. package/lib/simple-tree/{toMapTree.d.ts → unhydratedFlexTreeFromInsertable.d.ts} +12 -23
  349. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -0
  350. package/lib/simple-tree/{toMapTree.js → unhydratedFlexTreeFromInsertable.js} +105 -186
  351. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -0
  352. package/lib/treeFactory.d.ts.map +1 -1
  353. package/lib/treeFactory.js +6 -1
  354. package/lib/treeFactory.js.map +1 -1
  355. package/lib/util/index.d.ts +1 -1
  356. package/lib/util/index.d.ts.map +1 -1
  357. package/lib/util/index.js +1 -1
  358. package/lib/util/index.js.map +1 -1
  359. package/lib/util/utils.d.ts +4 -0
  360. package/lib/util/utils.d.ts.map +1 -1
  361. package/lib/util/utils.js +6 -0
  362. package/lib/util/utils.js.map +1 -1
  363. package/package.json +21 -21
  364. package/src/codec/codec.ts +24 -3
  365. package/src/codec/index.ts +1 -0
  366. package/src/codec/versioned/codec.ts +42 -5
  367. package/src/core/tree/detachedFieldIndex.ts +13 -4
  368. package/src/core/tree/mapTree.ts +22 -7
  369. package/src/core/tree/visitorUtils.ts +2 -2
  370. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +3 -2
  371. package/src/feature-libraries/default-schema/schemaChecker.ts +7 -6
  372. package/src/feature-libraries/flex-tree/context.ts +17 -7
  373. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +36 -15
  374. package/src/feature-libraries/flex-tree/index.ts +4 -0
  375. package/src/feature-libraries/flex-tree/lazyField.ts +8 -6
  376. package/src/feature-libraries/flex-tree/lazyNode.ts +6 -2
  377. package/src/feature-libraries/forest-summary/forestSummarizer.ts +3 -2
  378. package/src/feature-libraries/index.ts +9 -0
  379. package/src/feature-libraries/mapTreeCursor.ts +103 -16
  380. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +9 -5
  381. package/src/feature-libraries/treeCursorUtils.ts +21 -10
  382. package/src/index.ts +1 -0
  383. package/src/packageVersion.ts +1 -1
  384. package/src/shared-tree/schematizingTreeView.ts +40 -22
  385. package/src/shared-tree/sharedTree.ts +9 -3
  386. package/src/shared-tree/tree.ts +5 -20
  387. package/src/shared-tree/treeAlpha.ts +17 -11
  388. package/src/shared-tree/treeCheckout.ts +6 -3
  389. package/src/simple-tree/api/configuration.ts +3 -3
  390. package/src/simple-tree/api/create.ts +49 -19
  391. package/src/simple-tree/api/customTree.ts +10 -0
  392. package/src/simple-tree/api/index.ts +1 -4
  393. package/src/simple-tree/api/schemaFactory.ts +62 -13
  394. package/src/simple-tree/api/treeNodeApi.ts +48 -27
  395. package/src/simple-tree/api/verboseTree.ts +15 -12
  396. package/src/simple-tree/core/getOrCreateNode.ts +4 -2
  397. package/src/simple-tree/core/index.ts +2 -3
  398. package/src/simple-tree/core/treeNodeKernel.ts +37 -54
  399. package/src/simple-tree/core/unhydratedFlexTree.ts +222 -261
  400. package/src/simple-tree/index.ts +3 -3
  401. package/src/simple-tree/node-kinds/array/arrayNode.ts +12 -13
  402. package/src/simple-tree/node-kinds/index.ts +0 -1
  403. package/src/simple-tree/node-kinds/map/mapNode.ts +6 -9
  404. package/src/simple-tree/node-kinds/object/index.ts +0 -1
  405. package/src/simple-tree/node-kinds/object/objectNode.ts +7 -49
  406. package/src/simple-tree/prepareForInsertion.ts +49 -42
  407. package/src/simple-tree/schemaTypes.ts +9 -8
  408. package/src/simple-tree/toStoredSchema.ts +7 -1
  409. package/src/simple-tree/{toMapTree.ts → unhydratedFlexTreeFromInsertable.ts} +134 -226
  410. package/src/treeFactory.ts +6 -1
  411. package/src/util/index.ts +1 -0
  412. package/src/util/utils.ts +7 -0
  413. package/dist/simple-tree/toMapTree.d.ts.map +0 -1
  414. package/dist/simple-tree/toMapTree.js.map +0 -1
  415. package/lib/simple-tree/toMapTree.d.ts.map +0 -1
  416. package/lib/simple-tree/toMapTree.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"modularChangeCodecs.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/modularChangeCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,UAAU,EAKf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACX,qBAAqB,EAErB,kBAAkB,EAKlB,WAAW,EACX,MAAM,qBAAqB,CAAC;AAS7B,OAAO,EACN,KAAK,eAAe,EAIpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAGrE,OAAO,KAAK,EACX,sBAAsB,EAEtB,MAAM,6BAA6B,CAAC;AAWrC,OAAO,EAMN,KAAK,gBAAgB,EAGrB,MAAM,yBAAyB,CAAC;AAEjC,wBAAgB,4BAA4B,CAC3C,uBAAuB,EAAE,WAAW,CAAC,MAAM,EAAE,sBAAsB,CAAC,EACpE,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,WAAW,EAAE,eAAe,EAC5B,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,aAAa,EAC3C,wBAAwB,GAAE,uBAA4D,GACpF,YAAY,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAavD"}
1
+ {"version":3,"file":"modularChangeCodecs.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/modularChangeCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,UAAU,EAKf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACX,qBAAqB,EAErB,kBAAkB,EAKlB,WAAW,EACX,MAAM,qBAAqB,CAAC;AAS7B,OAAO,EACN,KAAK,eAAe,EAIpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAGrE,OAAO,KAAK,EACX,sBAAsB,EAEtB,MAAM,6BAA6B,CAAC;AAWrC,OAAO,EAMN,KAAK,gBAAgB,EAGrB,MAAM,yBAAyB,CAAC;AAEjC,wBAAgB,4BAA4B,CAC3C,uBAAuB,EAAE,WAAW,CAAC,MAAM,EAAE,sBAAsB,CAAC,EACpE,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,WAAW,EAAE,eAAe,EAC5B,YAAY,EAAE,aAAa,EAC3B,wBAAwB,GAAE,uBAA4D,GACpF,YAAY,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAavD"}
@@ -10,20 +10,20 @@ import { TreeCompressionStrategy } from "../treeCompressionUtils.js";
10
10
  import { genericFieldKind } from "./genericFieldKind.js";
11
11
  import { EncodedModularChangeset, } from "./modularChangeFormat.js";
12
12
  import { newCrossFieldKeyTable, } from "./modularChangeTypes.js";
13
- export function makeModularChangeCodecFamily(fieldKindConfigurations, revisionTagCodec, fieldsCodec, { jsonValidator: validator }, chunkCompressionStrategy = TreeCompressionStrategy.Compressed) {
13
+ export function makeModularChangeCodecFamily(fieldKindConfigurations, revisionTagCodec, fieldsCodec, codecOptions, chunkCompressionStrategy = TreeCompressionStrategy.Compressed) {
14
14
  return makeCodecFamily(Array.from(fieldKindConfigurations.entries(), ([version, fieldKinds]) => [
15
15
  version,
16
- makeModularChangeCodec(fieldKinds, revisionTagCodec, fieldsCodec, { jsonValidator: validator }, chunkCompressionStrategy),
16
+ makeModularChangeCodec(fieldKinds, revisionTagCodec, fieldsCodec, codecOptions, chunkCompressionStrategy),
17
17
  ]));
18
18
  }
19
- function makeModularChangeCodec(fieldKinds, revisionTagCodec, fieldsCodec, { jsonValidator: validator }, chunkCompressionStrategy = TreeCompressionStrategy.Compressed) {
19
+ function makeModularChangeCodec(fieldKinds, revisionTagCodec, fieldsCodec, codecOptions, chunkCompressionStrategy = TreeCompressionStrategy.Compressed) {
20
20
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
21
21
  const getMapEntry = ({ kind, formatVersion }) => {
22
22
  const codec = kind.changeHandler.codecsFactory(revisionTagCodec).resolve(formatVersion);
23
23
  return {
24
24
  codec,
25
25
  compiledSchema: codec.json.encodedSchema
26
- ? validator.compile(codec.json.encodedSchema)
26
+ ? codecOptions.jsonValidator.compile(codec.json.encodedSchema)
27
27
  : undefined,
28
28
  };
29
29
  };
@@ -278,7 +278,7 @@ function makeModularChangeCodec(fieldKinds, revisionTagCodec, fieldsCodec, { jso
278
278
  return decoded;
279
279
  },
280
280
  };
281
- return withSchemaValidation(EncodedModularChangeset, modularChangeCodec, validator);
281
+ return withSchemaValidation(EncodedModularChangeset, modularChangeCodec, codecOptions.jsonValidator);
282
282
  }
283
283
  function getChangeHandler(fieldKinds, fieldKind) {
284
284
  if (fieldKind === genericFieldKind.identifier) {
@@ -1 +1 @@
1
- {"version":3,"file":"modularChangeCodecs.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/modularChangeCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAGxE,OAAO,EAMN,eAAe,EACf,oBAAoB,GACpB,MAAM,sBAAsB,CAAC;AAW9B,OAAO,EAIN,KAAK,EACL,oBAAoB,EACpB,aAAa,GACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAGN,gBAAgB,EAChB,kBAAkB,GAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAOrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAKN,uBAAuB,GAGvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,qBAAqB,GAQrB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,UAAU,4BAA4B,CAC3C,uBAAoE,EACpE,gBAKC,EACD,WAA4B,EAC5B,EAAE,aAAa,EAAE,SAAS,EAAiB,EAC3C,2BAAoD,uBAAuB,CAAC,UAAU;IAEtF,OAAO,eAAe,CACrB,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE,EAAE,CAAC;QACxE,OAAO;QACP,sBAAsB,CACrB,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,E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AAQ,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC5F,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob, fail } from \"@fluidframework/core-utils/internal\";\nimport type { TAnySchema } from \"@sinclair/typebox\";\n\nimport {\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\ttype IMultiFormatCodec,\n\ttype SchemaValidationFunction,\n\tmakeCodecFamily,\n\twithSchemaValidation,\n} from \"../../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tChangesetLocalId,\n\tEncodedRevisionTag,\n\tFieldKey,\n\tFieldKindIdentifier,\n\tITreeCursorSynchronous,\n\tRevisionInfo,\n\tRevisionTag,\n} from \"../../core/index.js\";\nimport {\n\ttype IdAllocator,\n\ttype JsonCompatibleReadOnly,\n\ttype Mutable,\n\tbrand,\n\tidAllocatorFromMaxId,\n\tnewTupleBTree,\n} from \"../../util/index.js\";\nimport {\n\ttype FieldBatchCodec,\n\ttype TreeChunk,\n\tchunkFieldSingle,\n\tdefaultChunkPolicy,\n} from \"../chunked-forest/index.js\";\nimport { TreeCompressionStrategy } from \"../treeCompressionUtils.js\";\n\nimport type { FieldChangeEncodingContext, FieldChangeHandler } from \"./fieldChangeHandler.js\";\nimport type {\n\tFieldKindConfiguration,\n\tFieldKindConfigurationEntry,\n} from \"./fieldKindConfiguration.js\";\nimport { genericFieldKind } from \"./genericFieldKind.js\";\nimport {\n\ttype EncodedBuilds,\n\ttype EncodedBuildsArray,\n\ttype EncodedFieldChange,\n\ttype EncodedFieldChangeMap,\n\tEncodedModularChangeset,\n\ttype EncodedNodeChangeset,\n\ttype EncodedRevisionInfo,\n} from \"./modularChangeFormat.js\";\nimport {\n\tnewCrossFieldKeyTable,\n\ttype ChangeAtomIdBTree,\n\ttype FieldChangeMap,\n\ttype FieldChangeset,\n\ttype FieldId,\n\ttype ModularChangeset,\n\ttype NodeChangeset,\n\ttype NodeId,\n} from \"./modularChangeTypes.js\";\n\nexport function makeModularChangeCodecFamily(\n\tfieldKindConfigurations: ReadonlyMap<number, FieldKindConfiguration>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\tfieldsCodec: FieldBatchCodec,\n\t{ jsonValidator: validator }: ICodecOptions,\n\tchunkCompressionStrategy: TreeCompressionStrategy = TreeCompressionStrategy.Compressed,\n): ICodecFamily<ModularChangeset, ChangeEncodingContext> {\n\treturn makeCodecFamily(\n\t\tArray.from(fieldKindConfigurations.entries(), ([version, fieldKinds]) => [\n\t\t\tversion,\n\t\t\tmakeModularChangeCodec(\n\t\t\t\tfieldKinds,\n\t\t\t\trevisionTagCodec,\n\t\t\t\tfieldsCodec,\n\t\t\t\t{ jsonValidator: validator },\n\t\t\t\tchunkCompressionStrategy,\n\t\t\t),\n\t\t]),\n\t);\n}\n\ntype ModularChangeCodec = IJsonCodec<\n\tModularChangeset,\n\tEncodedModularChangeset,\n\tEncodedModularChangeset,\n\tChangeEncodingContext\n>;\n\ntype FieldCodec = IMultiFormatCodec<\n\tFieldChangeset,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tFieldChangeEncodingContext\n>;\n\nfunction makeModularChangeCodec(\n\tfieldKinds: FieldKindConfiguration,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\tfieldsCodec: FieldBatchCodec,\n\t{ jsonValidator: validator }: ICodecOptions,\n\tchunkCompressionStrategy: TreeCompressionStrategy = TreeCompressionStrategy.Compressed,\n): ModularChangeCodec {\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tconst getMapEntry = ({ kind, formatVersion }: FieldKindConfigurationEntry) => {\n\t\tconst codec = kind.changeHandler.codecsFactory(revisionTagCodec).resolve(formatVersion);\n\t\treturn {\n\t\t\tcodec,\n\t\t\tcompiledSchema: codec.json.encodedSchema\n\t\t\t\t? validator.compile(codec.json.encodedSchema)\n\t\t\t\t: undefined,\n\t\t};\n\t};\n\n\t/**\n\t * The codec version for the generic field kind.\n\t */\n\tconst genericFieldKindFormatVersion = 1;\n\tconst fieldChangesetCodecs: Map<\n\t\tFieldKindIdentifier,\n\t\t{\n\t\t\tcompiledSchema?: SchemaValidationFunction<TAnySchema>;\n\t\t\tcodec: FieldCodec;\n\t\t}\n\t> = new Map([\n\t\t[\n\t\t\tgenericFieldKind.identifier,\n\t\t\tgetMapEntry({ kind: genericFieldKind, formatVersion: genericFieldKindFormatVersion }),\n\t\t],\n\t]);\n\n\tfieldKinds.forEach((entry, identifier) => {\n\t\tfieldChangesetCodecs.set(identifier, getMapEntry(entry));\n\t});\n\n\tconst getFieldChangesetCodec = (\n\t\tfieldKind: FieldKindIdentifier,\n\t): {\n\t\tcompiledSchema?: SchemaValidationFunction<TAnySchema>;\n\t\tcodec: FieldCodec;\n\t} => {\n\t\tconst entry = fieldChangesetCodecs.get(fieldKind);\n\t\tassert(entry !== undefined, 0x5ea /* Tried to encode unsupported fieldKind */);\n\t\treturn entry;\n\t};\n\n\tfunction encodeFieldChangesForJson(\n\t\tchange: FieldChangeMap,\n\t\tcontext: ChangeEncodingContext,\n\t\tnodeChanges: ChangeAtomIdBTree<NodeChangeset>,\n\t): EncodedFieldChangeMap {\n\t\tconst fieldContext: FieldChangeEncodingContext = {\n\t\t\tbaseContext: context,\n\n\t\t\tencodeNode: (nodeId: NodeId): EncodedNodeChangeset => {\n\t\t\t\tconst node = nodeChanges.get([nodeId.revision, nodeId.localId]);\n\t\t\t\tassert(node !== undefined, 0x92e /* Unknown node ID */);\n\t\t\t\treturn encodeNodeChangesForJson(node, fieldContext);\n\t\t\t},\n\n\t\t\tdecodeNode: () => fail(0xb1e /* Should not decode nodes during field encoding */),\n\t\t};\n\n\t\treturn encodeFieldChangesForJsonI(change, fieldContext);\n\t}\n\n\tfunction encodeFieldChangesForJsonI(\n\t\tchange: FieldChangeMap,\n\t\tcontext: FieldChangeEncodingContext,\n\t): EncodedFieldChangeMap {\n\t\tconst encodedFields: EncodedFieldChangeMap = [];\n\n\t\tfor (const [field, fieldChange] of change) {\n\t\t\tconst { codec, compiledSchema } = getFieldChangesetCodec(fieldChange.fieldKind);\n\t\t\tconst encodedChange = codec.json.encode(fieldChange.change, context);\n\t\t\tif (compiledSchema !== undefined && !compiledSchema.check(encodedChange)) {\n\t\t\t\tfail(0xb1f /* Encoded change didn't pass schema validation. */);\n\t\t\t}\n\n\t\t\tconst fieldKey: FieldKey = field;\n\t\t\tconst encodedField: EncodedFieldChange = {\n\t\t\t\tfieldKey,\n\t\t\t\tfieldKind: fieldChange.fieldKind,\n\t\t\t\tchange: encodedChange,\n\t\t\t};\n\n\t\t\tencodedFields.push(encodedField);\n\t\t}\n\n\t\treturn encodedFields;\n\t}\n\n\tfunction encodeNodeChangesForJson(\n\t\tchange: NodeChangeset,\n\t\tcontext: FieldChangeEncodingContext,\n\t): EncodedNodeChangeset {\n\t\tconst encodedChange: EncodedNodeChangeset = {};\n\t\tconst { fieldChanges, nodeExistsConstraint } = change;\n\n\t\tif (fieldChanges !== undefined) {\n\t\t\tencodedChange.fieldChanges = encodeFieldChangesForJsonI(fieldChanges, context);\n\t\t}\n\n\t\tif (nodeExistsConstraint !== undefined) {\n\t\t\tencodedChange.nodeExistsConstraint = nodeExistsConstraint;\n\t\t}\n\n\t\treturn encodedChange;\n\t}\n\n\tfunction decodeFieldChangesFromJson(\n\t\tencodedChange: EncodedFieldChangeMap,\n\t\tparentId: NodeId | undefined,\n\t\tdecoded: ModularChangeset,\n\t\tcontext: ChangeEncodingContext,\n\t\tidAllocator: IdAllocator,\n\t): FieldChangeMap {\n\t\tconst decodedFields: FieldChangeMap = new Map();\n\t\tfor (const field of encodedChange) {\n\t\t\tconst { codec, compiledSchema } = getFieldChangesetCodec(field.fieldKind);\n\t\t\tif (compiledSchema !== undefined && !compiledSchema.check(field.change)) {\n\t\t\t\tfail(0xb20 /* Encoded change didn't pass schema validation. */);\n\t\t\t}\n\n\t\t\tconst fieldId: FieldId = {\n\t\t\t\tnodeId: parentId,\n\t\t\t\tfield: field.fieldKey,\n\t\t\t};\n\n\t\t\tconst fieldContext: FieldChangeEncodingContext = {\n\t\t\t\tbaseContext: context,\n\n\t\t\t\tencodeNode: () => fail(0xb21 /* Should not encode nodes during field decoding */),\n\n\t\t\t\tdecodeNode: (encodedNode: EncodedNodeChangeset): NodeId => {\n\t\t\t\t\tconst nodeId: NodeId = {\n\t\t\t\t\t\trevision: context.revision,\n\t\t\t\t\t\tlocalId: brand(idAllocator.allocate()),\n\t\t\t\t\t};\n\n\t\t\t\t\tconst node = decodeNodeChangesetFromJson(\n\t\t\t\t\t\tencodedNode,\n\t\t\t\t\t\tnodeId,\n\t\t\t\t\t\tdecoded,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\tidAllocator,\n\t\t\t\t\t);\n\n\t\t\t\t\tdecoded.nodeChanges.set([nodeId.revision, nodeId.localId], node);\n\t\t\t\t\tdecoded.nodeToParent.set([nodeId.revision, nodeId.localId], fieldId);\n\t\t\t\t\treturn nodeId;\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tconst fieldChangeset = codec.json.decode(field.change, fieldContext);\n\n\t\t\tconst crossFieldKeys = getChangeHandler(fieldKinds, field.fieldKind).getCrossFieldKeys(\n\t\t\t\tfieldChangeset,\n\t\t\t);\n\n\t\t\tfor (const { key, count } of crossFieldKeys) {\n\t\t\t\tdecoded.crossFieldKeys.set(key, count, fieldId);\n\t\t\t}\n\n\t\t\tconst fieldKey: FieldKey = brand<FieldKey>(field.fieldKey);\n\n\t\t\tdecodedFields.set(fieldKey, {\n\t\t\t\tfieldKind: field.fieldKind,\n\t\t\t\tchange: brand(fieldChangeset),\n\t\t\t});\n\t\t}\n\n\t\treturn decodedFields;\n\t}\n\n\tfunction decodeNodeChangesetFromJson(\n\t\tencodedChange: EncodedNodeChangeset,\n\t\tid: NodeId,\n\t\tdecoded: ModularChangeset,\n\t\tcontext: ChangeEncodingContext,\n\t\tidAllocator: IdAllocator,\n\t): NodeChangeset {\n\t\tconst decodedChange: NodeChangeset = {};\n\t\tconst { fieldChanges, nodeExistsConstraint } = encodedChange;\n\n\t\tif (fieldChanges !== undefined) {\n\t\t\tdecodedChange.fieldChanges = decodeFieldChangesFromJson(\n\t\t\t\tfieldChanges,\n\t\t\t\tid,\n\t\t\t\tdecoded,\n\t\t\t\tcontext,\n\t\t\t\tidAllocator,\n\t\t\t);\n\t\t}\n\n\t\tif (nodeExistsConstraint !== undefined) {\n\t\t\tdecodedChange.nodeExistsConstraint = nodeExistsConstraint;\n\t\t}\n\n\t\treturn decodedChange;\n\t}\n\n\tfunction encodeDetachedNodes(\n\t\tdetachedNodes: ChangeAtomIdBTree<TreeChunk> | undefined,\n\t\tcontext: ChangeEncodingContext,\n\t): EncodedBuilds | undefined {\n\t\tif (detachedNodes === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst treesToEncode: ITreeCursorSynchronous[] = [];\n\t\tconst buildsArray: EncodedBuildsArray = [];\n\n\t\tlet buildsForRevision:\n\t\t\t| [[ChangesetLocalId, number][], EncodedRevisionTag]\n\t\t\t| [[ChangesetLocalId, number][]]\n\t\t\t| undefined;\n\n\t\tfor (const [[revision, id], chunk] of detachedNodes.entries()) {\n\t\t\tconst encodedRevision = encodeRevisionOpt(revisionTagCodec, revision, context);\n\n\t\t\tif (buildsForRevision === undefined || buildsForRevision[1] !== encodedRevision) {\n\t\t\t\tif (buildsForRevision !== undefined) {\n\t\t\t\t\tbuildsArray.push(buildsForRevision);\n\t\t\t\t}\n\n\t\t\t\tbuildsForRevision = encodedRevision !== undefined ? [[], encodedRevision] : [[]];\n\t\t\t}\n\n\t\t\ttreesToEncode.push(chunk.cursor());\n\t\t\tconst treeIndexInBatch = treesToEncode.length - 1;\n\t\t\tbuildsForRevision?.[0].push([id, treeIndexInBatch]);\n\t\t}\n\n\t\tif (buildsForRevision !== undefined) {\n\t\t\tbuildsArray.push(buildsForRevision);\n\t\t}\n\n\t\treturn buildsArray.length === 0\n\t\t\t? undefined\n\t\t\t: {\n\t\t\t\t\tbuilds: buildsArray,\n\t\t\t\t\ttrees: fieldsCodec.encode(treesToEncode, {\n\t\t\t\t\t\tencodeType: chunkCompressionStrategy,\n\t\t\t\t\t\tschema: context.schema,\n\t\t\t\t\t\toriginatorId: context.originatorId,\n\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t}),\n\t\t\t\t};\n\t}\n\n\tfunction decodeDetachedNodes(\n\t\tencoded: EncodedBuilds | undefined,\n\t\tcontext: ChangeEncodingContext,\n\t): ChangeAtomIdBTree<TreeChunk> | undefined {\n\t\tif (encoded === undefined || encoded.builds.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst chunks = fieldsCodec.decode(encoded.trees, {\n\t\t\tencodeType: chunkCompressionStrategy,\n\t\t\toriginatorId: context.originatorId,\n\t\t\tidCompressor: context.idCompressor,\n\t\t});\n\t\tconst getChunk = (index: number): TreeChunk => {\n\t\t\tassert(index < chunks.length, 0x898 /* out of bounds index for build chunk */);\n\t\t\treturn chunkFieldSingle(chunks[index] ?? oob(), {\n\t\t\t\tpolicy: defaultChunkPolicy,\n\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t});\n\t\t};\n\n\t\tconst map: ModularChangeset[\"builds\"] = newTupleBTree();\n\t\tencoded.builds.forEach((build) => {\n\t\t\t// EncodedRevisionTag cannot be an array so this ensures that we can isolate the tuple\n\t\t\tconst revision =\n\t\t\t\tbuild[1] === undefined ? context.revision : revisionTagCodec.decode(build[1], context);\n\n\t\t\tconst decodedChunks: [ChangesetLocalId, TreeChunk][] = build[0].map(([i, n]) => [\n\t\t\t\ti,\n\t\t\t\tgetChunk(n),\n\t\t\t]);\n\n\t\t\tfor (const [id, chunk] of decodedChunks) {\n\t\t\t\tmap.set([revision, id], chunk);\n\t\t\t}\n\t\t});\n\n\t\treturn map;\n\t}\n\n\tfunction encodeRevisionInfos(\n\t\trevisions: readonly RevisionInfo[],\n\t\tcontext: ChangeEncodingContext,\n\t): EncodedRevisionInfo[] | undefined {\n\t\tif (context.revision !== undefined) {\n\t\t\tassert(\n\t\t\t\trevisions.length === 1 &&\n\t\t\t\t\trevisions[0] !== undefined &&\n\t\t\t\t\trevisions[0].revision === context.revision &&\n\t\t\t\t\trevisions[0].rollbackOf === undefined,\n\t\t\t\t0x964 /* A tagged change should only contain the tagged revision */,\n\t\t\t);\n\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst encodedRevisions = [];\n\t\tfor (const revision of revisions) {\n\t\t\tconst encodedRevision: Mutable<EncodedRevisionInfo> = {\n\t\t\t\trevision: revisionTagCodec.encode(revision.revision, context),\n\t\t\t};\n\n\t\t\tif (revision.rollbackOf !== undefined) {\n\t\t\t\tencodedRevision.rollbackOf = revisionTagCodec.encode(revision.rollbackOf, context);\n\t\t\t}\n\n\t\t\tencodedRevisions.push(encodedRevision);\n\t\t}\n\n\t\treturn encodedRevisions;\n\t}\n\n\tfunction decodeRevisionInfos(\n\t\trevisions: readonly EncodedRevisionInfo[] | undefined,\n\t\tcontext: ChangeEncodingContext,\n\t): RevisionInfo[] | undefined {\n\t\tif (revisions === undefined) {\n\t\t\treturn context.revision !== undefined ? [{ revision: context.revision }] : undefined;\n\t\t}\n\n\t\tconst decodedRevisions = [];\n\t\tfor (const revision of revisions) {\n\t\t\tconst decodedRevision: Mutable<RevisionInfo> = {\n\t\t\t\trevision: revisionTagCodec.decode(revision.revision, context),\n\t\t\t};\n\n\t\t\tif (revision.rollbackOf !== undefined) {\n\t\t\t\tdecodedRevision.rollbackOf = revisionTagCodec.decode(revision.rollbackOf, context);\n\t\t\t}\n\n\t\t\tdecodedRevisions.push(decodedRevision);\n\t\t}\n\n\t\treturn decodedRevisions;\n\t}\n\n\tconst modularChangeCodec: ModularChangeCodec = {\n\t\tencode: (change, context) => {\n\t\t\t// Destroys only exist in rollback changesets, which are never sent.\n\t\t\tassert(change.destroys === undefined, 0x899 /* Unexpected changeset with destroys */);\n\t\t\treturn {\n\t\t\t\tmaxId: change.maxId,\n\t\t\t\trevisions:\n\t\t\t\t\tchange.revisions === undefined\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: encodeRevisionInfos(change.revisions, context),\n\t\t\t\tchanges: encodeFieldChangesForJson(change.fieldChanges, context, change.nodeChanges),\n\t\t\t\tbuilds: encodeDetachedNodes(change.builds, context),\n\t\t\t\trefreshers: encodeDetachedNodes(change.refreshers, context),\n\t\t\t\tviolations: change.constraintViolationCount,\n\t\t\t};\n\t\t},\n\n\t\tdecode: (encodedChange: EncodedModularChangeset, context) => {\n\t\t\tconst decoded: Mutable<ModularChangeset> = {\n\t\t\t\tfieldChanges: new Map(),\n\t\t\t\tnodeChanges: newTupleBTree(),\n\t\t\t\tnodeToParent: newTupleBTree(),\n\t\t\t\tnodeAliases: newTupleBTree(),\n\t\t\t\tcrossFieldKeys: newCrossFieldKeyTable(),\n\t\t\t};\n\n\t\t\tdecoded.fieldChanges = decodeFieldChangesFromJson(\n\t\t\t\tencodedChange.changes,\n\t\t\t\tundefined,\n\t\t\t\tdecoded,\n\t\t\t\tcontext,\n\t\t\t\tidAllocatorFromMaxId(encodedChange.maxId),\n\t\t\t);\n\n\t\t\tif (encodedChange.builds !== undefined) {\n\t\t\t\tdecoded.builds = decodeDetachedNodes(encodedChange.builds, context);\n\t\t\t}\n\t\t\tif (encodedChange.refreshers !== undefined) {\n\t\t\t\tdecoded.refreshers = decodeDetachedNodes(encodedChange.refreshers, context);\n\t\t\t}\n\n\t\t\tif (encodedChange.violations !== undefined) {\n\t\t\t\tdecoded.constraintViolationCount = encodedChange.violations;\n\t\t\t}\n\n\t\t\tconst decodedRevInfos = decodeRevisionInfos(encodedChange.revisions, context);\n\t\t\tif (decodedRevInfos !== undefined) {\n\t\t\t\tdecoded.revisions = decodedRevInfos;\n\t\t\t}\n\t\t\tif (encodedChange.maxId !== undefined) {\n\t\t\t\tdecoded.maxId = encodedChange.maxId;\n\t\t\t}\n\t\t\treturn decoded;\n\t\t},\n\t};\n\n\treturn withSchemaValidation(EncodedModularChangeset, modularChangeCodec, validator);\n}\n\nfunction getChangeHandler(\n\tfieldKinds: FieldKindConfiguration,\n\tfieldKind: FieldKindIdentifier,\n): FieldChangeHandler<unknown> {\n\tif (fieldKind === genericFieldKind.identifier) {\n\t\treturn genericFieldKind.changeHandler;\n\t}\n\n\tconst handler = fieldKinds.get(fieldKind)?.kind.changeHandler;\n\tassert(handler !== undefined, 0x9c1 /* Unknown field kind */);\n\treturn handler;\n}\n\nfunction encodeRevisionOpt(\n\trevisionCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\trevision: RevisionTag | undefined,\n\tcontext: ChangeEncodingContext,\n): EncodedRevisionTag | undefined {\n\tif (revision === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn revision === context.revision ? undefined : revisionCodec.encode(revision, context);\n}\n"]}
1
+ {"version":3,"file":"modularChangeCodecs.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/modularChangeCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAGxE,OAAO,EAMN,eAAe,EACf,oBAAoB,GACpB,MAAM,sBAAsB,CAAC;AAW9B,OAAO,EAIN,KAAK,EACL,oBAAoB,EACpB,aAAa,GACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAGN,gBAAgB,EAChB,kBAAkB,GAClB,MAAM,4BAA4B,CAAC;AACpC,OA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ED,SAAS,gBAAgB,CACxB,UAAkC,EAClC,SAA8B;IAE9B,IAAI,SAAS,KAAK,gBAAgB,CAAC,UAAU,EAAE,CAAC;QAC/C,OAAO,gBAAgB,CAAC,aAAa,CAAC;IACvC,CAAC;IAED,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC;IAC9D,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC9D,OAAO,OAAO,CAAC;AAChB,CAAC;AAED,SAAS,iBAAiB,CACzB,aAKC,EACD,QAAiC,EACjC,OAA8B;IAE9B,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,OAAO,QAAQ,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC5F,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob, fail } from \"@fluidframework/core-utils/internal\";\nimport type { TAnySchema } from \"@sinclair/typebox\";\n\nimport {\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\ttype IMultiFormatCodec,\n\ttype SchemaValidationFunction,\n\tmakeCodecFamily,\n\twithSchemaValidation,\n} from \"../../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tChangesetLocalId,\n\tEncodedRevisionTag,\n\tFieldKey,\n\tFieldKindIdentifier,\n\tITreeCursorSynchronous,\n\tRevisionInfo,\n\tRevisionTag,\n} from \"../../core/index.js\";\nimport {\n\ttype IdAllocator,\n\ttype JsonCompatibleReadOnly,\n\ttype Mutable,\n\tbrand,\n\tidAllocatorFromMaxId,\n\tnewTupleBTree,\n} from \"../../util/index.js\";\nimport {\n\ttype FieldBatchCodec,\n\ttype TreeChunk,\n\tchunkFieldSingle,\n\tdefaultChunkPolicy,\n} from \"../chunked-forest/index.js\";\nimport { TreeCompressionStrategy } from \"../treeCompressionUtils.js\";\n\nimport type { FieldChangeEncodingContext, FieldChangeHandler } from \"./fieldChangeHandler.js\";\nimport type {\n\tFieldKindConfiguration,\n\tFieldKindConfigurationEntry,\n} from \"./fieldKindConfiguration.js\";\nimport { genericFieldKind } from \"./genericFieldKind.js\";\nimport {\n\ttype EncodedBuilds,\n\ttype EncodedBuildsArray,\n\ttype EncodedFieldChange,\n\ttype EncodedFieldChangeMap,\n\tEncodedModularChangeset,\n\ttype EncodedNodeChangeset,\n\ttype EncodedRevisionInfo,\n} from \"./modularChangeFormat.js\";\nimport {\n\tnewCrossFieldKeyTable,\n\ttype ChangeAtomIdBTree,\n\ttype FieldChangeMap,\n\ttype FieldChangeset,\n\ttype FieldId,\n\ttype ModularChangeset,\n\ttype NodeChangeset,\n\ttype NodeId,\n} from \"./modularChangeTypes.js\";\n\nexport function makeModularChangeCodecFamily(\n\tfieldKindConfigurations: ReadonlyMap<number, FieldKindConfiguration>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\tfieldsCodec: FieldBatchCodec,\n\tcodecOptions: ICodecOptions,\n\tchunkCompressionStrategy: TreeCompressionStrategy = TreeCompressionStrategy.Compressed,\n): ICodecFamily<ModularChangeset, ChangeEncodingContext> {\n\treturn makeCodecFamily(\n\t\tArray.from(fieldKindConfigurations.entries(), ([version, fieldKinds]) => [\n\t\t\tversion,\n\t\t\tmakeModularChangeCodec(\n\t\t\t\tfieldKinds,\n\t\t\t\trevisionTagCodec,\n\t\t\t\tfieldsCodec,\n\t\t\t\tcodecOptions,\n\t\t\t\tchunkCompressionStrategy,\n\t\t\t),\n\t\t]),\n\t);\n}\n\ntype ModularChangeCodec = IJsonCodec<\n\tModularChangeset,\n\tEncodedModularChangeset,\n\tEncodedModularChangeset,\n\tChangeEncodingContext\n>;\n\ntype FieldCodec = IMultiFormatCodec<\n\tFieldChangeset,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tFieldChangeEncodingContext\n>;\n\nfunction makeModularChangeCodec(\n\tfieldKinds: FieldKindConfiguration,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\tfieldsCodec: FieldBatchCodec,\n\tcodecOptions: ICodecOptions,\n\tchunkCompressionStrategy: TreeCompressionStrategy = TreeCompressionStrategy.Compressed,\n): ModularChangeCodec {\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tconst getMapEntry = ({ kind, formatVersion }: FieldKindConfigurationEntry) => {\n\t\tconst codec = kind.changeHandler.codecsFactory(revisionTagCodec).resolve(formatVersion);\n\t\treturn {\n\t\t\tcodec,\n\t\t\tcompiledSchema: codec.json.encodedSchema\n\t\t\t\t? codecOptions.jsonValidator.compile(codec.json.encodedSchema)\n\t\t\t\t: undefined,\n\t\t};\n\t};\n\n\t/**\n\t * The codec version for the generic field kind.\n\t */\n\tconst genericFieldKindFormatVersion = 1;\n\tconst fieldChangesetCodecs: Map<\n\t\tFieldKindIdentifier,\n\t\t{\n\t\t\tcompiledSchema?: SchemaValidationFunction<TAnySchema>;\n\t\t\tcodec: FieldCodec;\n\t\t}\n\t> = new Map([\n\t\t[\n\t\t\tgenericFieldKind.identifier,\n\t\t\tgetMapEntry({ kind: genericFieldKind, formatVersion: genericFieldKindFormatVersion }),\n\t\t],\n\t]);\n\n\tfieldKinds.forEach((entry, identifier) => {\n\t\tfieldChangesetCodecs.set(identifier, getMapEntry(entry));\n\t});\n\n\tconst getFieldChangesetCodec = (\n\t\tfieldKind: FieldKindIdentifier,\n\t): {\n\t\tcompiledSchema?: SchemaValidationFunction<TAnySchema>;\n\t\tcodec: FieldCodec;\n\t} => {\n\t\tconst entry = fieldChangesetCodecs.get(fieldKind);\n\t\tassert(entry !== undefined, 0x5ea /* Tried to encode unsupported fieldKind */);\n\t\treturn entry;\n\t};\n\n\tfunction encodeFieldChangesForJson(\n\t\tchange: FieldChangeMap,\n\t\tcontext: ChangeEncodingContext,\n\t\tnodeChanges: ChangeAtomIdBTree<NodeChangeset>,\n\t): EncodedFieldChangeMap {\n\t\tconst fieldContext: FieldChangeEncodingContext = {\n\t\t\tbaseContext: context,\n\n\t\t\tencodeNode: (nodeId: NodeId): EncodedNodeChangeset => {\n\t\t\t\tconst node = nodeChanges.get([nodeId.revision, nodeId.localId]);\n\t\t\t\tassert(node !== undefined, 0x92e /* Unknown node ID */);\n\t\t\t\treturn encodeNodeChangesForJson(node, fieldContext);\n\t\t\t},\n\n\t\t\tdecodeNode: () => fail(0xb1e /* Should not decode nodes during field encoding */),\n\t\t};\n\n\t\treturn encodeFieldChangesForJsonI(change, fieldContext);\n\t}\n\n\tfunction encodeFieldChangesForJsonI(\n\t\tchange: FieldChangeMap,\n\t\tcontext: FieldChangeEncodingContext,\n\t): EncodedFieldChangeMap {\n\t\tconst encodedFields: EncodedFieldChangeMap = [];\n\n\t\tfor (const [field, fieldChange] of change) {\n\t\t\tconst { codec, compiledSchema } = getFieldChangesetCodec(fieldChange.fieldKind);\n\t\t\tconst encodedChange = codec.json.encode(fieldChange.change, context);\n\t\t\tif (compiledSchema !== undefined && !compiledSchema.check(encodedChange)) {\n\t\t\t\tfail(0xb1f /* Encoded change didn't pass schema validation. */);\n\t\t\t}\n\n\t\t\tconst fieldKey: FieldKey = field;\n\t\t\tconst encodedField: EncodedFieldChange = {\n\t\t\t\tfieldKey,\n\t\t\t\tfieldKind: fieldChange.fieldKind,\n\t\t\t\tchange: encodedChange,\n\t\t\t};\n\n\t\t\tencodedFields.push(encodedField);\n\t\t}\n\n\t\treturn encodedFields;\n\t}\n\n\tfunction encodeNodeChangesForJson(\n\t\tchange: NodeChangeset,\n\t\tcontext: FieldChangeEncodingContext,\n\t): EncodedNodeChangeset {\n\t\tconst encodedChange: EncodedNodeChangeset = {};\n\t\tconst { fieldChanges, nodeExistsConstraint } = change;\n\n\t\tif (fieldChanges !== undefined) {\n\t\t\tencodedChange.fieldChanges = encodeFieldChangesForJsonI(fieldChanges, context);\n\t\t}\n\n\t\tif (nodeExistsConstraint !== undefined) {\n\t\t\tencodedChange.nodeExistsConstraint = nodeExistsConstraint;\n\t\t}\n\n\t\treturn encodedChange;\n\t}\n\n\tfunction decodeFieldChangesFromJson(\n\t\tencodedChange: EncodedFieldChangeMap,\n\t\tparentId: NodeId | undefined,\n\t\tdecoded: ModularChangeset,\n\t\tcontext: ChangeEncodingContext,\n\t\tidAllocator: IdAllocator,\n\t): FieldChangeMap {\n\t\tconst decodedFields: FieldChangeMap = new Map();\n\t\tfor (const field of encodedChange) {\n\t\t\tconst { codec, compiledSchema } = getFieldChangesetCodec(field.fieldKind);\n\t\t\tif (compiledSchema !== undefined && !compiledSchema.check(field.change)) {\n\t\t\t\tfail(0xb20 /* Encoded change didn't pass schema validation. */);\n\t\t\t}\n\n\t\t\tconst fieldId: FieldId = {\n\t\t\t\tnodeId: parentId,\n\t\t\t\tfield: field.fieldKey,\n\t\t\t};\n\n\t\t\tconst fieldContext: FieldChangeEncodingContext = {\n\t\t\t\tbaseContext: context,\n\n\t\t\t\tencodeNode: () => fail(0xb21 /* Should not encode nodes during field decoding */),\n\n\t\t\t\tdecodeNode: (encodedNode: EncodedNodeChangeset): NodeId => {\n\t\t\t\t\tconst nodeId: NodeId = {\n\t\t\t\t\t\trevision: context.revision,\n\t\t\t\t\t\tlocalId: brand(idAllocator.allocate()),\n\t\t\t\t\t};\n\n\t\t\t\t\tconst node = decodeNodeChangesetFromJson(\n\t\t\t\t\t\tencodedNode,\n\t\t\t\t\t\tnodeId,\n\t\t\t\t\t\tdecoded,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\tidAllocator,\n\t\t\t\t\t);\n\n\t\t\t\t\tdecoded.nodeChanges.set([nodeId.revision, nodeId.localId], node);\n\t\t\t\t\tdecoded.nodeToParent.set([nodeId.revision, nodeId.localId], fieldId);\n\t\t\t\t\treturn nodeId;\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tconst fieldChangeset = codec.json.decode(field.change, fieldContext);\n\n\t\t\tconst crossFieldKeys = getChangeHandler(fieldKinds, field.fieldKind).getCrossFieldKeys(\n\t\t\t\tfieldChangeset,\n\t\t\t);\n\n\t\t\tfor (const { key, count } of crossFieldKeys) {\n\t\t\t\tdecoded.crossFieldKeys.set(key, count, fieldId);\n\t\t\t}\n\n\t\t\tconst fieldKey: FieldKey = brand<FieldKey>(field.fieldKey);\n\n\t\t\tdecodedFields.set(fieldKey, {\n\t\t\t\tfieldKind: field.fieldKind,\n\t\t\t\tchange: brand(fieldChangeset),\n\t\t\t});\n\t\t}\n\n\t\treturn decodedFields;\n\t}\n\n\tfunction decodeNodeChangesetFromJson(\n\t\tencodedChange: EncodedNodeChangeset,\n\t\tid: NodeId,\n\t\tdecoded: ModularChangeset,\n\t\tcontext: ChangeEncodingContext,\n\t\tidAllocator: IdAllocator,\n\t): NodeChangeset {\n\t\tconst decodedChange: NodeChangeset = {};\n\t\tconst { fieldChanges, nodeExistsConstraint } = encodedChange;\n\n\t\tif (fieldChanges !== undefined) {\n\t\t\tdecodedChange.fieldChanges = decodeFieldChangesFromJson(\n\t\t\t\tfieldChanges,\n\t\t\t\tid,\n\t\t\t\tdecoded,\n\t\t\t\tcontext,\n\t\t\t\tidAllocator,\n\t\t\t);\n\t\t}\n\n\t\tif (nodeExistsConstraint !== undefined) {\n\t\t\tdecodedChange.nodeExistsConstraint = nodeExistsConstraint;\n\t\t}\n\n\t\treturn decodedChange;\n\t}\n\n\tfunction encodeDetachedNodes(\n\t\tdetachedNodes: ChangeAtomIdBTree<TreeChunk> | undefined,\n\t\tcontext: ChangeEncodingContext,\n\t): EncodedBuilds | undefined {\n\t\tif (detachedNodes === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst treesToEncode: ITreeCursorSynchronous[] = [];\n\t\tconst buildsArray: EncodedBuildsArray = [];\n\n\t\tlet buildsForRevision:\n\t\t\t| [[ChangesetLocalId, number][], EncodedRevisionTag]\n\t\t\t| [[ChangesetLocalId, number][]]\n\t\t\t| undefined;\n\n\t\tfor (const [[revision, id], chunk] of detachedNodes.entries()) {\n\t\t\tconst encodedRevision = encodeRevisionOpt(revisionTagCodec, revision, context);\n\n\t\t\tif (buildsForRevision === undefined || buildsForRevision[1] !== encodedRevision) {\n\t\t\t\tif (buildsForRevision !== undefined) {\n\t\t\t\t\tbuildsArray.push(buildsForRevision);\n\t\t\t\t}\n\n\t\t\t\tbuildsForRevision = encodedRevision !== undefined ? [[], encodedRevision] : [[]];\n\t\t\t}\n\n\t\t\ttreesToEncode.push(chunk.cursor());\n\t\t\tconst treeIndexInBatch = treesToEncode.length - 1;\n\t\t\tbuildsForRevision?.[0].push([id, treeIndexInBatch]);\n\t\t}\n\n\t\tif (buildsForRevision !== undefined) {\n\t\t\tbuildsArray.push(buildsForRevision);\n\t\t}\n\n\t\treturn buildsArray.length === 0\n\t\t\t? undefined\n\t\t\t: {\n\t\t\t\t\tbuilds: buildsArray,\n\t\t\t\t\ttrees: fieldsCodec.encode(treesToEncode, {\n\t\t\t\t\t\tencodeType: chunkCompressionStrategy,\n\t\t\t\t\t\tschema: context.schema,\n\t\t\t\t\t\toriginatorId: context.originatorId,\n\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t}),\n\t\t\t\t};\n\t}\n\n\tfunction decodeDetachedNodes(\n\t\tencoded: EncodedBuilds | undefined,\n\t\tcontext: ChangeEncodingContext,\n\t): ChangeAtomIdBTree<TreeChunk> | undefined {\n\t\tif (encoded === undefined || encoded.builds.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst chunks = fieldsCodec.decode(encoded.trees, {\n\t\t\tencodeType: chunkCompressionStrategy,\n\t\t\toriginatorId: context.originatorId,\n\t\t\tidCompressor: context.idCompressor,\n\t\t});\n\t\tconst getChunk = (index: number): TreeChunk => {\n\t\t\tassert(index < chunks.length, 0x898 /* out of bounds index for build chunk */);\n\t\t\treturn chunkFieldSingle(chunks[index] ?? oob(), {\n\t\t\t\tpolicy: defaultChunkPolicy,\n\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t});\n\t\t};\n\n\t\tconst map: ModularChangeset[\"builds\"] = newTupleBTree();\n\t\tencoded.builds.forEach((build) => {\n\t\t\t// EncodedRevisionTag cannot be an array so this ensures that we can isolate the tuple\n\t\t\tconst revision =\n\t\t\t\tbuild[1] === undefined ? context.revision : revisionTagCodec.decode(build[1], context);\n\n\t\t\tconst decodedChunks: [ChangesetLocalId, TreeChunk][] = build[0].map(([i, n]) => [\n\t\t\t\ti,\n\t\t\t\tgetChunk(n),\n\t\t\t]);\n\n\t\t\tfor (const [id, chunk] of decodedChunks) {\n\t\t\t\tmap.set([revision, id], chunk);\n\t\t\t}\n\t\t});\n\n\t\treturn map;\n\t}\n\n\tfunction encodeRevisionInfos(\n\t\trevisions: readonly RevisionInfo[],\n\t\tcontext: ChangeEncodingContext,\n\t): EncodedRevisionInfo[] | undefined {\n\t\tif (context.revision !== undefined) {\n\t\t\tassert(\n\t\t\t\trevisions.length === 1 &&\n\t\t\t\t\trevisions[0] !== undefined &&\n\t\t\t\t\trevisions[0].revision === context.revision &&\n\t\t\t\t\trevisions[0].rollbackOf === undefined,\n\t\t\t\t0x964 /* A tagged change should only contain the tagged revision */,\n\t\t\t);\n\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst encodedRevisions = [];\n\t\tfor (const revision of revisions) {\n\t\t\tconst encodedRevision: Mutable<EncodedRevisionInfo> = {\n\t\t\t\trevision: revisionTagCodec.encode(revision.revision, context),\n\t\t\t};\n\n\t\t\tif (revision.rollbackOf !== undefined) {\n\t\t\t\tencodedRevision.rollbackOf = revisionTagCodec.encode(revision.rollbackOf, context);\n\t\t\t}\n\n\t\t\tencodedRevisions.push(encodedRevision);\n\t\t}\n\n\t\treturn encodedRevisions;\n\t}\n\n\tfunction decodeRevisionInfos(\n\t\trevisions: readonly EncodedRevisionInfo[] | undefined,\n\t\tcontext: ChangeEncodingContext,\n\t): RevisionInfo[] | undefined {\n\t\tif (revisions === undefined) {\n\t\t\treturn context.revision !== undefined ? [{ revision: context.revision }] : undefined;\n\t\t}\n\n\t\tconst decodedRevisions = [];\n\t\tfor (const revision of revisions) {\n\t\t\tconst decodedRevision: Mutable<RevisionInfo> = {\n\t\t\t\trevision: revisionTagCodec.decode(revision.revision, context),\n\t\t\t};\n\n\t\t\tif (revision.rollbackOf !== undefined) {\n\t\t\t\tdecodedRevision.rollbackOf = revisionTagCodec.decode(revision.rollbackOf, context);\n\t\t\t}\n\n\t\t\tdecodedRevisions.push(decodedRevision);\n\t\t}\n\n\t\treturn decodedRevisions;\n\t}\n\n\tconst modularChangeCodec: ModularChangeCodec = {\n\t\tencode: (change, context) => {\n\t\t\t// Destroys only exist in rollback changesets, which are never sent.\n\t\t\tassert(change.destroys === undefined, 0x899 /* Unexpected changeset with destroys */);\n\t\t\treturn {\n\t\t\t\tmaxId: change.maxId,\n\t\t\t\trevisions:\n\t\t\t\t\tchange.revisions === undefined\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: encodeRevisionInfos(change.revisions, context),\n\t\t\t\tchanges: encodeFieldChangesForJson(change.fieldChanges, context, change.nodeChanges),\n\t\t\t\tbuilds: encodeDetachedNodes(change.builds, context),\n\t\t\t\trefreshers: encodeDetachedNodes(change.refreshers, context),\n\t\t\t\tviolations: change.constraintViolationCount,\n\t\t\t};\n\t\t},\n\n\t\tdecode: (encodedChange: EncodedModularChangeset, context) => {\n\t\t\tconst decoded: Mutable<ModularChangeset> = {\n\t\t\t\tfieldChanges: new Map(),\n\t\t\t\tnodeChanges: newTupleBTree(),\n\t\t\t\tnodeToParent: newTupleBTree(),\n\t\t\t\tnodeAliases: newTupleBTree(),\n\t\t\t\tcrossFieldKeys: newCrossFieldKeyTable(),\n\t\t\t};\n\n\t\t\tdecoded.fieldChanges = decodeFieldChangesFromJson(\n\t\t\t\tencodedChange.changes,\n\t\t\t\tundefined,\n\t\t\t\tdecoded,\n\t\t\t\tcontext,\n\t\t\t\tidAllocatorFromMaxId(encodedChange.maxId),\n\t\t\t);\n\n\t\t\tif (encodedChange.builds !== undefined) {\n\t\t\t\tdecoded.builds = decodeDetachedNodes(encodedChange.builds, context);\n\t\t\t}\n\t\t\tif (encodedChange.refreshers !== undefined) {\n\t\t\t\tdecoded.refreshers = decodeDetachedNodes(encodedChange.refreshers, context);\n\t\t\t}\n\n\t\t\tif (encodedChange.violations !== undefined) {\n\t\t\t\tdecoded.constraintViolationCount = encodedChange.violations;\n\t\t\t}\n\n\t\t\tconst decodedRevInfos = decodeRevisionInfos(encodedChange.revisions, context);\n\t\t\tif (decodedRevInfos !== undefined) {\n\t\t\t\tdecoded.revisions = decodedRevInfos;\n\t\t\t}\n\t\t\tif (encodedChange.maxId !== undefined) {\n\t\t\t\tdecoded.maxId = encodedChange.maxId;\n\t\t\t}\n\t\t\treturn decoded;\n\t\t},\n\t};\n\n\treturn withSchemaValidation(\n\t\tEncodedModularChangeset,\n\t\tmodularChangeCodec,\n\t\tcodecOptions.jsonValidator,\n\t);\n}\n\nfunction getChangeHandler(\n\tfieldKinds: FieldKindConfiguration,\n\tfieldKind: FieldKindIdentifier,\n): FieldChangeHandler<unknown> {\n\tif (fieldKind === genericFieldKind.identifier) {\n\t\treturn genericFieldKind.changeHandler;\n\t}\n\n\tconst handler = fieldKinds.get(fieldKind)?.kind.changeHandler;\n\tassert(handler !== undefined, 0x9c1 /* Unknown field kind */);\n\treturn handler;\n}\n\nfunction encodeRevisionOpt(\n\trevisionCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\trevision: RevisionTag | undefined,\n\tcontext: ChangeEncodingContext,\n): EncodedRevisionTag | undefined {\n\tif (revision === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn revision === context.revision ? undefined : revisionCodec.encode(revision, context);\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,CAAE,SAAQ,sBAAsB;IACpE;;;;OAIG;IACH,OAAO,IAAI,KAAK,CAAC;IAEjB;;;;;;;OAOG;IACH,IAAI,IA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ieldKey() {
79
79
  debugAssert(() => this.mode === 1 /* CursorLocationType.Fields */ ? true : "must be in fields mode");
80
+ // index is kept inbounds as an invariant of the class.
81
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
80
82
  return this.siblings[this.index];
81
83
  }
82
84
  getStackedFieldKey(height) {
83
85
  assert(height % 2 === 1, 0x3b8 /* must field height */);
84
86
  const siblingStack = this.siblingStack[height] ?? oob();
85
87
  const indexStack = this.indexStack[height] ?? oob();
88
+ // index is kept inbounds as an invariant of the class.
89
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
86
90
  return siblingStack[indexStack];
87
91
  }
88
92
  getStackedNodeIndex(height) {
@@ -91,7 +95,8 @@ class StackCursor extends SynchronousCursor {
91
95
  }
92
96
  getStackedNode(height) {
93
97
  const index = this.getStackedNodeIndex(height);
94
- // Test is failing when using `?? oob()` here.
98
+ // Can not use `?? oob()` since null and undefined are valid values.
99
+ // index is kept inbounds as an invariant of the class.
95
100
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
96
101
  return this.siblingStack[height][index];
97
102
  }
@@ -243,7 +248,8 @@ class StackCursor extends SynchronousCursor {
243
248
  }
244
249
  getNode() {
245
250
  // assert(this.mode === CursorLocationType.Nodes, "can only get node when in node");
246
- // Test is failing when using `?? oob()` here.
251
+ // Can not use `?? oob()` since null and undefined are valid values.
252
+ // index is kept inbounds as an invariant of the class.
247
253
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
248
254
  return this.siblings[this.index];
249
255
  }
@@ -1 +1 @@
1
- {"version":3,"file":"treeCursorUtils.js","sourceRoot":"","sources":["../../src/feature-libraries/treeCursorUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAEN,YAAY,EASZ,kBAAkB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AAC;IACD,IAAW,MAAM;QAChB,OAAO,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob, debugAssert, fail } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tCursorLocationType,\n\tCursorMarker,\n\ttype DetachedField,\n\ttype FieldKey,\n\ttype FieldUpPath,\n\ttype ITreeCursorSynchronous,\n\ttype PathRootPrefix,\n\ttype TreeType,\n\ttype UpPath,\n\ttype Value,\n\tdetachedFieldAsKey,\n\trootField,\n} from \"../core/index.js\";\n\n/**\n * {@link ITreeCursorSynchronous} that can return the underlying node objects.\n */\nexport interface CursorWithNode<TNode> extends ITreeCursorSynchronous {\n\t/**\n\t * Gets the underlying object for the current node.\n\t *\n\t * Only valid when `mode` is `Nodes`.\n\t */\n\tgetNode(): TNode;\n\n\t/**\n\t * Create a copy of this cursor which navigates independently,\n\t * and is initially located at the same place as this one.\n\t *\n\t * Depending on the cursor implementation this may be significantly faster\n\t * than other ways to copy the cursor\n\t * (such as creating a new one and walking the path from this one).\n\t */\n\tfork(): CursorWithNode<TNode>;\n}\n\n/**\n * Create a cursor, in `nodes` mode at the root of the provided tree.\n *\n * @returns an {@link ITreeCursorSynchronous} for a single root in `nodes` mode.\n */\nexport function stackTreeNodeCursor<TNode>(\n\tadapter: CursorAdapter<TNode>,\n\troot: TNode,\n): CursorWithNode<TNode> {\n\treturn new StackCursor(adapter, [], [], [root], 0);\n}\n\n/**\n * Create a cursor, in `fields` mode at the `detachedField` under the provided `root`.\n *\n * @returns an {@link ITreeCursorSynchronous} for `detachedField` of `root` in `fields` mode.\n */\nexport function stackTreeFieldCursor<TNode>(\n\tadapter: CursorAdapter<TNode>,\n\troot: TNode,\n\tdetachedField: DetachedField = rootField,\n): CursorWithNode<TNode> {\n\tconst cursor = stackTreeNodeCursor(adapter, root);\n\t// Because the root node in `stackTreeNodeCursor` is treated as the above detached fields node,\n\t// using it then just entering the correct field doesn't mess up the paths reported by the cursor.\n\tcursor.enterField(detachedFieldAsKey(detachedField));\n\treturn cursor;\n}\n\n/**\n * Provides functionality to allow a {@link stackTreeNodeCursor} and {@link stackTreeFieldCursor} to implement cursors.\n */\nexport interface CursorAdapter<TNode> {\n\t/**\n\t * @returns the value of the given node.\n\t */\n\tvalue(node: TNode): Value;\n\t/**\n\t * @returns the type of the given node.\n\t */\n\ttype(node: TNode): TreeType;\n\t/**\n\t * @returns the keys for non-empty fields on the given node.\n\t */\n\tkeysFromNode(node: TNode): readonly FieldKey[];\n\t/**\n\t * @returns the child nodes for the given node and key.\n\t */\n\tgetFieldFromNode(node: TNode, key: FieldKey): readonly TNode[];\n}\n\ntype SiblingsOrKey<TNode> = readonly TNode[] | readonly FieldKey[];\n\n/**\n * A class that satisfies part of the ITreeCursorSynchronous implementation.\n */\nexport abstract class SynchronousCursor {\n\tpublic readonly [CursorMarker] = true;\n\tpublic readonly pending = false;\n\n\tpublic skipPendingFields(): boolean {\n\t\treturn true;\n\t}\n}\n\n/**\n * A simple general purpose ITreeCursorSynchronous implementation.\n *\n * As this is a generic implementation, it's ability to optimize is limited.\n *\n * @privateRemarks\n * Note that TNode can be `null` (and we should support `undefined` as well),\n * so be careful using types like `TNode | undefined` and expressions like `TNode ??`.\n *\n * TODO:\n * 1. Unit tests for this.\n * 2. Support for cursors which are field cursors at the root.\n */\nclass StackCursor<TNode> extends SynchronousCursor implements CursorWithNode<TNode> {\n\tpublic readonly [CursorMarker] = true;\n\t/**\n\t * Might start at special root where fields are detached sequences.\n\t *\n\t * @param adapter - policy logic.\n\t * @param siblingStack - Stack of collections of siblings along the path through the tree:\n\t * does not include current level (which is stored in `siblings`).\n\t * Even levels in the stack (starting from 0) are sequences of nodes and odd levels\n\t * are for fields keys on a node.\n\t * @param indexStack - Stack of indices into the corresponding levels in `siblingStack`.\n\t * @param siblings - Siblings at the current level (not included in `siblingStack`).\n\t * @param index - Index into `siblings`.\n\t */\n\tpublic constructor(\n\t\tprivate readonly adapter: CursorAdapter<TNode>,\n\t\tprivate readonly siblingStack: SiblingsOrKey<TNode>[],\n\t\tprivate readonly indexStack: number[],\n\t\tprivate siblings: SiblingsOrKey<TNode>,\n\t\tprivate index: number,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic getFieldKey(): FieldKey {\n\t\tdebugAssert(() =>\n\t\t\tthis.mode === CursorLocationType.Fields ? true : \"must be in fields mode\",\n\t\t);\n\t\treturn this.siblings[this.index] as FieldKey;\n\t}\n\n\tprivate getStackedFieldKey(height: number): FieldKey {\n\t\tassert(height % 2 === 1, 0x3b8 /* must field height */);\n\t\tconst siblingStack = this.siblingStack[height] ?? oob();\n\t\tconst indexStack = this.indexStack[height] ?? oob();\n\t\treturn siblingStack[indexStack] as FieldKey;\n\t}\n\n\tprivate getStackedNodeIndex(height: number): number {\n\t\t// assert(height % 2 === 0, \"must be node height\");\n\t\treturn this.indexStack[height] ?? oob();\n\t}\n\n\tprivate getStackedNode(height: number): TNode {\n\t\tconst index = this.getStackedNodeIndex(height);\n\t\t// Test is failing when using `?? oob()` here.\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\treturn (this.siblingStack[height] as readonly TNode[])[index]!;\n\t}\n\n\tpublic getFieldLength(): number {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"must be in fields mode\");\n\t\treturn this.getField().length;\n\t}\n\n\tpublic enterNode(index: number): void {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"must be in fields mode\");\n\t\tconst siblings = this.getField();\n\t\tif (!(index in siblings)) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`A child does not exist at index '${index}' in field containing ${siblings.length} nodes.`,\n\t\t\t);\n\t\t}\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\t\tthis.index = index;\n\t\tthis.siblings = siblings;\n\t}\n\n\tpublic getPath(prefix?: PathRootPrefix): UpPath | undefined {\n\t\tassert(this.mode === CursorLocationType.Nodes, 0x3b9 /* must be in nodes mode */);\n\t\treturn this.getOffsetPath(0, prefix);\n\t}\n\n\tpublic getFieldPath(prefix?: PathRootPrefix): FieldUpPath {\n\t\tassert(this.mode === CursorLocationType.Fields, 0x449 /* must be in fields mode */);\n\t\treturn {\n\t\t\tfield:\n\t\t\t\tthis.indexStack.length === 1\n\t\t\t\t\t? (prefix?.rootFieldOverride ?? this.getFieldKey())\n\t\t\t\t\t: this.getFieldKey(),\n\t\t\tparent: this.getOffsetPath(1, prefix),\n\t\t};\n\t}\n\n\tprivate getOffsetPath(\n\t\toffset: number,\n\t\tprefix: PathRootPrefix | undefined,\n\t): UpPath | undefined {\n\t\t// It is more efficient to handle prefix directly in here rather than delegating to PrefixedPath.\n\n\t\tconst length = this.indexStack.length - offset;\n\t\tif (length === 0) {\n\t\t\treturn prefix?.parent; // At root\n\t\t}\n\n\t\tassert(length > 0, 0x44a /* invalid offset to above root */);\n\t\tassert(length % 2 === 0, 0x44b /* offset path must point to node not field */);\n\n\t\tconst getIndex = (height: number): number => {\n\t\t\tlet parentIndex: number =\n\t\t\t\theight === this.indexStack.length ? this.index : this.getStackedNodeIndex(height);\n\t\t\tif (prefix !== undefined && height === 2) {\n\t\t\t\tparentIndex += prefix.indexOffset ?? 0;\n\t\t\t}\n\t\t\treturn parentIndex;\n\t\t};\n\n\t\t// Perf Note:\n\t\t// This is O(depth) in tree.\n\t\t// If many different anchors are created, this could be optimized to amortize the costs.\n\t\t// For example, the cursor could cache UpPaths from the anchorSet when creating an anchor,\n\t\t// then reuse them as a starting point when making another.\n\t\t// Could cache this at one depth, and remember the depth.\n\t\t// When navigating up, adjust cached anchor if present.\n\n\t\tlet path: UpPath | undefined = prefix?.parent;\n\t\t// Skip top level, since root node in path is \"undefined\" and does not have a parent or index.\n\t\tfor (let height = 2; height <= length; height += 2) {\n\t\t\tconst fieldOverride = height === 2 ? prefix?.rootFieldOverride : undefined;\n\t\t\tpath = {\n\t\t\t\tparent: path,\n\t\t\t\tparentIndex: getIndex(height),\n\t\t\t\tparentField: fieldOverride ?? this.getStackedFieldKey(height - 1),\n\t\t\t};\n\t\t}\n\n\t\treturn path;\n\t}\n\n\tpublic fork(): StackCursor<TNode> {\n\t\t// Siblings arrays are not modified during navigation and do not need be be copied.\n\t\t// This allows this copy to be shallow, and `this.siblings` below to not be copied as all.\n\t\treturn new StackCursor<TNode>(\n\t\t\tthis.adapter,\n\t\t\t[...this.siblingStack],\n\t\t\t[...this.indexStack],\n\t\t\tthis.siblings,\n\t\t\tthis.index,\n\t\t);\n\t}\n\n\tpublic enterField(key: FieldKey): void {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"must be in nodes mode\");\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\n\t\t// For fields, siblings are only used for key lookup and\n\t\t// nextField and which has arbitrary iteration order,\n\t\t// so making a array of just key here works.\n\t\t// This adds an allocation, so it's optimizing code simplicity and for the other use case (enumeration)\n\t\t// at the cost of an allocation here.\n\t\tthis.index = 0;\n\t\tthis.siblings = [key];\n\t}\n\n\tpublic get mode(): CursorLocationType {\n\t\treturn this.siblingStack.length % 2 === 0\n\t\t\t? CursorLocationType.Nodes\n\t\t\t: CursorLocationType.Fields;\n\t}\n\n\tpublic nextField(): boolean {\n\t\tthis.index += 1;\n\t\tif (this.index === (this.siblings as []).length) {\n\t\t\tthis.exitField();\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic firstField(): boolean {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"must be in nodes mode\");\n\t\tconst fields = this.adapter.keysFromNode(this.getNode());\n\t\tif (fields.length === 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\t\tthis.index = 0;\n\t\tthis.siblings = fields;\n\t\treturn true;\n\t}\n\n\tpublic seekNodes(offset: number): boolean {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only seekNodes when in Nodes\");\n\t\tthis.index += offset;\n\t\tif (this.index in this.siblings) {\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitNode();\n\t\treturn false;\n\t}\n\n\tpublic firstNode(): boolean {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"firstNode only allowed in fields mode\");\n\t\tconst nodes = this.getField();\n\t\tif (nodes.length === 0) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\t\tthis.index = 0;\n\t\tthis.siblings = nodes;\n\t\treturn true;\n\t}\n\n\tpublic nextNode(): boolean {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Nodes,\n\t\t\t0x406 /* can only nextNode when in Nodes */,\n\t\t);\n\t\tthis.index++;\n\t\tif (this.index < (this.siblings as []).length) {\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitNode();\n\t\treturn false;\n\t}\n\n\tpublic exitField(): void {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"can only navigate up from field when in field\");\n\t\tthis.siblings =\n\t\t\tthis.siblingStack.pop() ?? fail(0xac3 /* Unexpected siblingStack.length */);\n\t\tthis.index = this.indexStack.pop() ?? fail(0xac4 /* Unexpected indexStack.length */);\n\t}\n\n\tpublic exitNode(): void {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only navigate up from node when in node\");\n\t\tthis.siblings =\n\t\t\tthis.siblingStack.pop() ?? fail(0xac5 /* Unexpected siblingStack.length */);\n\t\tthis.index = this.indexStack.pop() ?? fail(0xac6 /* Unexpected indexStack.length */);\n\t}\n\n\tpublic getNode(): TNode {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only get node when in node\");\n\t\t// Test is failing when using `?? oob()` here.\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\treturn (this.siblings as TNode[])[this.index]!;\n\t}\n\n\tprivate getField(): readonly TNode[] {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"can only get field when in fields\");\n\t\tconst parent = this.getStackedNode(this.indexStack.length - 1);\n\t\tconst key: FieldKey = this.getFieldKey();\n\t\tconst field = this.adapter.getFieldFromNode(parent, key);\n\t\treturn field;\n\t}\n\n\t/**\n\t * The value of the current node\n\t */\n\tpublic get value(): Value {\n\t\treturn this.adapter.value(this.getNode());\n\t}\n\n\t/**\n\t * The type of the current node\n\t */\n\tpublic get type(): TreeType {\n\t\treturn this.adapter.type(this.getNode());\n\t}\n\n\tpublic get fieldIndex(): number {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only node's index when in node\");\n\t\treturn this.index;\n\t}\n\n\tpublic get chunkStart(): number {\n\t\treturn this.fieldIndex;\n\t}\n\n\tpublic readonly chunkLength = 1;\n}\n\n/**\n * Apply `prefix` to `path`.\n */\nexport function prefixPath(\n\tprefix: PathRootPrefix | undefined,\n\tpath: UpPath | undefined,\n): UpPath | undefined {\n\tif (prefix === undefined) {\n\t\treturn path;\n\t}\n\tif (\n\t\tprefix.parent === undefined &&\n\t\tprefix.rootFieldOverride === undefined &&\n\t\t(prefix.indexOffset ?? 0) === 0\n\t) {\n\t\treturn path;\n\t}\n\treturn applyPrefix(prefix, path);\n}\n\n/**\n * Apply `prefix` to `path`.\n */\nexport function prefixFieldPath(\n\tprefix: PathRootPrefix | undefined,\n\tpath: FieldUpPath,\n): FieldUpPath {\n\tif (prefix === undefined) {\n\t\treturn path;\n\t}\n\tif (\n\t\tprefix.parent === undefined &&\n\t\tprefix.rootFieldOverride === undefined &&\n\t\t(prefix.indexOffset ?? 0) === 0\n\t) {\n\t\treturn path;\n\t}\n\treturn {\n\t\tfield: path.parent === undefined ? (prefix.rootFieldOverride ?? path.field) : path.field,\n\t\tparent: prefixPath(prefix, path.parent),\n\t};\n}\n\n/**\n * Compose two prefixes together.\n * `prefixFieldPath(root, prefixFieldPath(inner, path))` should be the same as `prefixFieldPath(prefixPathPrefix(root, inner), path))`\n *\n * TODO: tests for this.\n */\nexport function prefixPathPrefix(root: PathRootPrefix, inner: PathRootPrefix): PathRootPrefix {\n\tif (inner.parent !== undefined) {\n\t\tconst composedPrefix: PathRootPrefix = {\n\t\t\tparent: new PrefixedPath(root, inner.parent),\n\t\t\trootFieldOverride: inner.rootFieldOverride,\n\t\t\tindexOffset: inner.indexOffset,\n\t\t};\n\t\treturn composedPrefix;\n\t} else {\n\t\tconst composedPrefix: PathRootPrefix = {\n\t\t\tparent: root.parent,\n\t\t\trootFieldOverride: root.rootFieldOverride ?? inner.rootFieldOverride,\n\t\t\tindexOffset: (inner.indexOffset ?? 0) + (root.indexOffset ?? 0),\n\t\t};\n\t\treturn composedPrefix;\n\t}\n}\n\nfunction applyPrefix(prefix: PathRootPrefix, path: UpPath | undefined): UpPath | undefined {\n\tif (path === undefined) {\n\t\treturn prefix.parent;\n\t} else {\n\t\t// As an optimization, avoid double wrapping paths with multiple prefixes\n\t\tif (path instanceof PrefixedPath) {\n\t\t\tconst composedPrefix: PathRootPrefix = prefixPathPrefix(prefix, path.prefix);\n\t\t\treturn new PrefixedPath(composedPrefix, path.path);\n\t\t} else {\n\t\t\treturn new PrefixedPath(prefix, path);\n\t\t}\n\t}\n}\n\n/**\n * Wrapper around a path that adds a prefix to the root.\n *\n * Exported for testing: use `prefixPath` and `prefixFieldPath` to construct.\n */\nexport class PrefixedPath implements UpPath {\n\tpublic readonly parentField: FieldKey;\n\tpublic readonly parentIndex: number;\n\tpublic constructor(\n\t\tpublic readonly prefix: PathRootPrefix,\n\t\tpublic readonly path: UpPath,\n\t) {\n\t\tif (path.parent === undefined) {\n\t\t\tthis.parentField = prefix.rootFieldOverride ?? path.parentField;\n\t\t\tthis.parentIndex = path.parentIndex + (prefix.indexOffset ?? 0);\n\t\t} else {\n\t\t\tthis.parentField = path.parentField;\n\t\t\tthis.parentIndex = path.parentIndex;\n\t\t}\n\t}\n\tpublic get parent(): UpPath | undefined {\n\t\treturn applyPrefix(this.prefix, this.path.parent);\n\t}\n}\n"]}
1
+ {"version":3,"file":"treeCursorUtils.js","sourceRoot":"","sources":["../../src/feature-libraries/treeCursorUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAEN,YAAY,EASZ,kBAAkB,EAClB,SAAS,GACT,MAAM,kBAAkB,CAAC;AAwB1B;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAClC,OAA6B,EAC7B,IAAW;IAEX,OAAO,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AACpD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CACnC,OAA6B,EAC7B,IAAW,EACX,gBAA+B,SAAS;IAExC,MAAM,MAAM,GAAG,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAClD,+FAA+F;IAC/F,kGAAkG;IAClG,MAAM,CAAC,UAAU,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAC;IACrD,OAAO,MAAM,CAAC;AACf,CAAC;AA+BD;;GAEG;AACH,MAAM,OAAgB,iBAAiB;IAAvC;QACiB,QAAc,GAAG,IAAI,CAAC;QACtB,YAAO,GAAG,KAAK,CAAC;IAKjC,CAAC;IAHO,iBAAiB;QACvB,OAAO,IAAI,CAAC;IACb,CAAC;CACD;KANiB,YAAY;AAQ9B;;;;;;;;;;;;GAYG;AACH,MAAM,WAAmB,SAAQ,iBAAiB;IAEjD;;;;;;;;;;;OAWG;IACH,YACkB,OAA6B,EAC7B,YAAoC,EACpC,UAAoB,EAC7B,QAA8B,EAC9B,KAAa;QAErB,KAAK,EAAE,C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AN,MAAM,CAAgB;QACtB,SAAI,GAAJ,IAAI,CAAQ;QAE5B,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC/B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,iBAAiB,IAAI,IAAI,CAAC,WAAW,CAAC;YAChE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,GAAG,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC,CAAC;QACjE,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;YACpC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QACrC,CAAC;IACF,CAAC;IACD,IAAW,MAAM;QAChB,OAAO,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob, debugAssert, fail } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tCursorLocationType,\n\tCursorMarker,\n\ttype DetachedField,\n\ttype FieldKey,\n\ttype FieldUpPath,\n\ttype ITreeCursorSynchronous,\n\ttype PathRootPrefix,\n\ttype TreeType,\n\ttype UpPath,\n\ttype Value,\n\tdetachedFieldAsKey,\n\trootField,\n} from \"../core/index.js\";\n\n/**\n * {@link ITreeCursorSynchronous} that can return the underlying node objects.\n */\nexport interface CursorWithNode<TNode> extends ITreeCursorSynchronous {\n\t/**\n\t * Gets the underlying object for the current node.\n\t *\n\t * Only valid when `mode` is `Nodes`.\n\t */\n\tgetNode(): TNode;\n\n\t/**\n\t * Create a copy of this cursor which navigates independently,\n\t * and is initially located at the same place as this one.\n\t *\n\t * Depending on the cursor implementation this may be significantly faster\n\t * than other ways to copy the cursor\n\t * (such as creating a new one and walking the path from this one).\n\t */\n\tfork(): CursorWithNode<TNode>;\n}\n\n/**\n * Create a cursor, in `nodes` mode at the root of the provided tree.\n *\n * @returns an {@link ITreeCursorSynchronous} for a single root in `nodes` mode.\n */\nexport function stackTreeNodeCursor<TNode>(\n\tadapter: CursorAdapter<TNode>,\n\troot: TNode,\n): CursorWithNode<TNode> {\n\treturn new StackCursor(adapter, [], [], [root], 0);\n}\n\n/**\n * Create a cursor, in `fields` mode at the `detachedField` under the provided `root`.\n *\n * @returns an {@link ITreeCursorSynchronous} for `detachedField` of `root` in `fields` mode.\n */\nexport function stackTreeFieldCursor<TNode>(\n\tadapter: CursorAdapter<TNode>,\n\troot: TNode,\n\tdetachedField: DetachedField = rootField,\n): CursorWithNode<TNode> {\n\tconst cursor = stackTreeNodeCursor(adapter, root);\n\t// Because the root node in `stackTreeNodeCursor` is treated as the above detached fields node,\n\t// using it then just entering the correct field doesn't mess up the paths reported by the cursor.\n\tcursor.enterField(detachedFieldAsKey(detachedField));\n\treturn cursor;\n}\n\n/**\n * The representation of a field used by {@link CursorAdapter}.\n */\nexport type Field<TNode> = Pick<readonly TNode[], typeof Symbol.iterator | \"length\" | number>;\n\n/**\n * Provides functionality to allow a {@link stackTreeNodeCursor} and {@link stackTreeFieldCursor} to implement cursors.\n */\nexport interface CursorAdapter<TNode> {\n\t/**\n\t * @returns the value of the given node.\n\t */\n\tvalue(node: TNode): Value;\n\t/**\n\t * @returns the type of the given node.\n\t */\n\ttype(node: TNode): TreeType;\n\t/**\n\t * @returns the keys for non-empty fields on the given node.\n\t */\n\tkeysFromNode(node: TNode): readonly FieldKey[];\n\t/**\n\t * @returns the child nodes for the given node and key.\n\t */\n\tgetFieldFromNode(node: TNode, key: FieldKey): Field<TNode>;\n}\n\ntype SiblingsOrKey<TNode> = Field<TNode> | readonly FieldKey[];\n\n/**\n * A class that satisfies part of the ITreeCursorSynchronous implementation.\n */\nexport abstract class SynchronousCursor {\n\tpublic readonly [CursorMarker] = true;\n\tpublic readonly pending = false;\n\n\tpublic skipPendingFields(): boolean {\n\t\treturn true;\n\t}\n}\n\n/**\n * A simple general purpose ITreeCursorSynchronous implementation.\n *\n * As this is a generic implementation, it's ability to optimize is limited.\n *\n * @privateRemarks\n * Note that TNode can be `null` (and we should support `undefined` as well),\n * so be careful using types like `TNode | undefined` and expressions like `TNode ??`.\n *\n * TODO:\n * 1. Unit tests for this.\n * 2. Support for cursors which are field cursors at the root.\n */\nclass StackCursor<TNode> extends SynchronousCursor implements CursorWithNode<TNode> {\n\tpublic override readonly [CursorMarker] = true;\n\t/**\n\t * Might start at special root where fields are detached sequences.\n\t *\n\t * @param adapter - policy logic.\n\t * @param siblingStack - Stack of collections of siblings along the path through the tree:\n\t * does not include current level (which is stored in `siblings`).\n\t * Even levels in the stack (starting from 0) are sequences of nodes and odd levels\n\t * are for fields keys on a node.\n\t * @param indexStack - Stack of indices into the corresponding levels in `siblingStack`.\n\t * @param siblings - Siblings at the current level (not included in `siblingStack`).\n\t * @param index - Index into `siblings`.\n\t */\n\tpublic constructor(\n\t\tprivate readonly adapter: CursorAdapter<TNode>,\n\t\tprivate readonly siblingStack: SiblingsOrKey<TNode>[],\n\t\tprivate readonly indexStack: number[],\n\t\tprivate siblings: SiblingsOrKey<TNode>,\n\t\tprivate index: number,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic getFieldKey(): FieldKey {\n\t\tdebugAssert(() =>\n\t\t\tthis.mode === CursorLocationType.Fields ? true : \"must be in fields mode\",\n\t\t);\n\t\t// index is kept inbounds as an invariant of the class.\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\treturn (this.siblings as readonly FieldKey[])[this.index]!;\n\t}\n\n\tprivate getStackedFieldKey(height: number): FieldKey {\n\t\tassert(height % 2 === 1, 0x3b8 /* must field height */);\n\t\tconst siblingStack = this.siblingStack[height] ?? oob();\n\t\tconst indexStack = this.indexStack[height] ?? oob();\n\t\t// index is kept inbounds as an invariant of the class.\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\treturn (siblingStack as readonly FieldKey[])[indexStack]!;\n\t}\n\n\tprivate getStackedNodeIndex(height: number): number {\n\t\t// assert(height % 2 === 0, \"must be node height\");\n\t\treturn this.indexStack[height] ?? oob();\n\t}\n\n\tprivate getStackedNode(height: number): TNode {\n\t\tconst index = this.getStackedNodeIndex(height);\n\t\t// Can not use `?? oob()` since null and undefined are valid values.\n\t\t// index is kept inbounds as an invariant of the class.\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\treturn (this.siblingStack[height] as Field<TNode>)[index]!;\n\t}\n\n\tpublic getFieldLength(): number {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"must be in fields mode\");\n\t\treturn this.getField().length;\n\t}\n\n\tpublic enterNode(index: number): void {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"must be in fields mode\");\n\t\tconst siblings = this.getField();\n\t\tif (!(index in siblings)) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`A child does not exist at index '${index}' in field containing ${siblings.length} nodes.`,\n\t\t\t);\n\t\t}\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\t\tthis.index = index;\n\t\tthis.siblings = siblings;\n\t}\n\n\tpublic getPath(prefix?: PathRootPrefix): UpPath | undefined {\n\t\tassert(this.mode === CursorLocationType.Nodes, 0x3b9 /* must be in nodes mode */);\n\t\treturn this.getOffsetPath(0, prefix);\n\t}\n\n\tpublic getFieldPath(prefix?: PathRootPrefix): FieldUpPath {\n\t\tassert(this.mode === CursorLocationType.Fields, 0x449 /* must be in fields mode */);\n\t\treturn {\n\t\t\tfield:\n\t\t\t\tthis.indexStack.length === 1\n\t\t\t\t\t? (prefix?.rootFieldOverride ?? this.getFieldKey())\n\t\t\t\t\t: this.getFieldKey(),\n\t\t\tparent: this.getOffsetPath(1, prefix),\n\t\t};\n\t}\n\n\tprivate getOffsetPath(\n\t\toffset: number,\n\t\tprefix: PathRootPrefix | undefined,\n\t): UpPath | undefined {\n\t\t// It is more efficient to handle prefix directly in here rather than delegating to PrefixedPath.\n\n\t\tconst length = this.indexStack.length - offset;\n\t\tif (length === 0) {\n\t\t\treturn prefix?.parent; // At root\n\t\t}\n\n\t\tassert(length > 0, 0x44a /* invalid offset to above root */);\n\t\tassert(length % 2 === 0, 0x44b /* offset path must point to node not field */);\n\n\t\tconst getIndex = (height: number): number => {\n\t\t\tlet parentIndex: number =\n\t\t\t\theight === this.indexStack.length ? this.index : this.getStackedNodeIndex(height);\n\t\t\tif (prefix !== undefined && height === 2) {\n\t\t\t\tparentIndex += prefix.indexOffset ?? 0;\n\t\t\t}\n\t\t\treturn parentIndex;\n\t\t};\n\n\t\t// Perf Note:\n\t\t// This is O(depth) in tree.\n\t\t// If many different anchors are created, this could be optimized to amortize the costs.\n\t\t// For example, the cursor could cache UpPaths from the anchorSet when creating an anchor,\n\t\t// then reuse them as a starting point when making another.\n\t\t// Could cache this at one depth, and remember the depth.\n\t\t// When navigating up, adjust cached anchor if present.\n\n\t\tlet path: UpPath | undefined = prefix?.parent;\n\t\t// Skip top level, since root node in path is \"undefined\" and does not have a parent or index.\n\t\tfor (let height = 2; height <= length; height += 2) {\n\t\t\tconst fieldOverride = height === 2 ? prefix?.rootFieldOverride : undefined;\n\t\t\tpath = {\n\t\t\t\tparent: path,\n\t\t\t\tparentIndex: getIndex(height),\n\t\t\t\tparentField: fieldOverride ?? this.getStackedFieldKey(height - 1),\n\t\t\t};\n\t\t}\n\n\t\treturn path;\n\t}\n\n\tpublic fork(): StackCursor<TNode> {\n\t\t// Siblings arrays are not modified during navigation and do not need be be copied.\n\t\t// This allows this copy to be shallow, and `this.siblings` below to not be copied as all.\n\t\treturn new StackCursor<TNode>(\n\t\t\tthis.adapter,\n\t\t\t[...this.siblingStack],\n\t\t\t[...this.indexStack],\n\t\t\tthis.siblings,\n\t\t\tthis.index,\n\t\t);\n\t}\n\n\tpublic enterField(key: FieldKey): void {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"must be in nodes mode\");\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\n\t\t// For fields, siblings are only used for key lookup and\n\t\t// nextField and which has arbitrary iteration order,\n\t\t// so making a array of just key here works.\n\t\t// This adds an allocation, so it's optimizing code simplicity and for the other use case (enumeration)\n\t\t// at the cost of an allocation here.\n\t\tthis.index = 0;\n\t\tthis.siblings = [key];\n\t}\n\n\tpublic get mode(): CursorLocationType {\n\t\treturn this.siblingStack.length % 2 === 0\n\t\t\t? CursorLocationType.Nodes\n\t\t\t: CursorLocationType.Fields;\n\t}\n\n\tpublic nextField(): boolean {\n\t\tthis.index += 1;\n\t\tif (this.index === (this.siblings as []).length) {\n\t\t\tthis.exitField();\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic firstField(): boolean {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"must be in nodes mode\");\n\t\tconst fields = this.adapter.keysFromNode(this.getNode());\n\t\tif (fields.length === 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\t\tthis.index = 0;\n\t\tthis.siblings = fields;\n\t\treturn true;\n\t}\n\n\tpublic seekNodes(offset: number): boolean {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only seekNodes when in Nodes\");\n\t\tthis.index += offset;\n\t\tif (this.index in this.siblings) {\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitNode();\n\t\treturn false;\n\t}\n\n\tpublic firstNode(): boolean {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"firstNode only allowed in fields mode\");\n\t\tconst nodes = this.getField();\n\t\tif (nodes.length === 0) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.siblingStack.push(this.siblings);\n\t\tthis.indexStack.push(this.index);\n\t\tthis.index = 0;\n\t\tthis.siblings = nodes;\n\t\treturn true;\n\t}\n\n\tpublic nextNode(): boolean {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Nodes,\n\t\t\t0x406 /* can only nextNode when in Nodes */,\n\t\t);\n\t\tthis.index++;\n\t\tif (this.index < (this.siblings as []).length) {\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitNode();\n\t\treturn false;\n\t}\n\n\tpublic exitField(): void {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"can only navigate up from field when in field\");\n\t\tthis.siblings =\n\t\t\tthis.siblingStack.pop() ?? fail(0xac3 /* Unexpected siblingStack.length */);\n\t\tthis.index = this.indexStack.pop() ?? fail(0xac4 /* Unexpected indexStack.length */);\n\t}\n\n\tpublic exitNode(): void {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only navigate up from node when in node\");\n\t\tthis.siblings =\n\t\t\tthis.siblingStack.pop() ?? fail(0xac5 /* Unexpected siblingStack.length */);\n\t\tthis.index = this.indexStack.pop() ?? fail(0xac6 /* Unexpected indexStack.length */);\n\t}\n\n\tpublic getNode(): TNode {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only get node when in node\");\n\t\t// Can not use `?? oob()` since null and undefined are valid values.\n\t\t// index is kept inbounds as an invariant of the class.\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\treturn (this.siblings as Field<TNode>)[this.index]!;\n\t}\n\n\tprivate getField(): Field<TNode> {\n\t\t// assert(this.mode === CursorLocationType.Fields, \"can only get field when in fields\");\n\t\tconst parent = this.getStackedNode(this.indexStack.length - 1);\n\t\tconst key: FieldKey = this.getFieldKey();\n\t\tconst field = this.adapter.getFieldFromNode(parent, key);\n\t\treturn field;\n\t}\n\n\t/**\n\t * The value of the current node\n\t */\n\tpublic get value(): Value {\n\t\treturn this.adapter.value(this.getNode());\n\t}\n\n\t/**\n\t * The type of the current node\n\t */\n\tpublic get type(): TreeType {\n\t\treturn this.adapter.type(this.getNode());\n\t}\n\n\tpublic get fieldIndex(): number {\n\t\t// assert(this.mode === CursorLocationType.Nodes, \"can only node's index when in node\");\n\t\treturn this.index;\n\t}\n\n\tpublic get chunkStart(): number {\n\t\treturn this.fieldIndex;\n\t}\n\n\tpublic readonly chunkLength = 1;\n}\n\n/**\n * Apply `prefix` to `path`.\n */\nexport function prefixPath(\n\tprefix: PathRootPrefix | undefined,\n\tpath: UpPath | undefined,\n): UpPath | undefined {\n\tif (prefix === undefined) {\n\t\treturn path;\n\t}\n\tif (\n\t\tprefix.parent === undefined &&\n\t\tprefix.rootFieldOverride === undefined &&\n\t\t(prefix.indexOffset ?? 0) === 0\n\t) {\n\t\treturn path;\n\t}\n\treturn applyPrefix(prefix, path);\n}\n\n/**\n * Apply `prefix` to `path`.\n */\nexport function prefixFieldPath(\n\tprefix: PathRootPrefix | undefined,\n\tpath: FieldUpPath,\n): FieldUpPath {\n\tif (prefix === undefined) {\n\t\treturn path;\n\t}\n\tif (\n\t\tprefix.parent === undefined &&\n\t\tprefix.rootFieldOverride === undefined &&\n\t\t(prefix.indexOffset ?? 0) === 0\n\t) {\n\t\treturn path;\n\t}\n\treturn {\n\t\tfield: path.parent === undefined ? (prefix.rootFieldOverride ?? path.field) : path.field,\n\t\tparent: prefixPath(prefix, path.parent),\n\t};\n}\n\n/**\n * Compose two prefixes together.\n * `prefixFieldPath(root, prefixFieldPath(inner, path))` should be the same as `prefixFieldPath(prefixPathPrefix(root, inner), path))`\n *\n * TODO: tests for this.\n */\nexport function prefixPathPrefix(root: PathRootPrefix, inner: PathRootPrefix): PathRootPrefix {\n\tif (inner.parent !== undefined) {\n\t\tconst composedPrefix: PathRootPrefix = {\n\t\t\tparent: new PrefixedPath(root, inner.parent),\n\t\t\trootFieldOverride: inner.rootFieldOverride,\n\t\t\tindexOffset: inner.indexOffset,\n\t\t};\n\t\treturn composedPrefix;\n\t} else {\n\t\tconst composedPrefix: PathRootPrefix = {\n\t\t\tparent: root.parent,\n\t\t\trootFieldOverride: root.rootFieldOverride ?? inner.rootFieldOverride,\n\t\t\tindexOffset: (inner.indexOffset ?? 0) + (root.indexOffset ?? 0),\n\t\t};\n\t\treturn composedPrefix;\n\t}\n}\n\nfunction applyPrefix(prefix: PathRootPrefix, path: UpPath | undefined): UpPath | undefined {\n\tif (path === undefined) {\n\t\treturn prefix.parent;\n\t} else {\n\t\t// As an optimization, avoid double wrapping paths with multiple prefixes\n\t\tif (path instanceof PrefixedPath) {\n\t\t\tconst composedPrefix: PathRootPrefix = prefixPathPrefix(prefix, path.prefix);\n\t\t\treturn new PrefixedPath(composedPrefix, path.path);\n\t\t} else {\n\t\t\treturn new PrefixedPath(prefix, path);\n\t\t}\n\t}\n}\n\n/**\n * Wrapper around a path that adds a prefix to the root.\n *\n * Exported for testing: use `prefixPath` and `prefixFieldPath` to construct.\n */\nexport class PrefixedPath implements UpPath {\n\tpublic readonly parentField: FieldKey;\n\tpublic readonly parentIndex: number;\n\tpublic constructor(\n\t\tpublic readonly prefix: PathRootPrefix,\n\t\tpublic readonly path: UpPath,\n\t) {\n\t\tif (path.parent === undefined) {\n\t\t\tthis.parentField = prefix.rootFieldOverride ?? path.parentField;\n\t\t\tthis.parentIndex = path.parentIndex + (prefix.indexOffset ?? 0);\n\t\t} else {\n\t\t\tthis.parentField = path.parentField;\n\t\t\tthis.parentIndex = path.parentIndex;\n\t\t}\n\t}\n\tpublic get parent(): UpPath | undefined {\n\t\treturn applyPrefix(this.prefix, this.path.parent);\n\t}\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -34,7 +34,7 @@ export { TreeArrayNode, type Unhydrated, IterableTreeArrayContent, TreeNode, typ
34
34
  export { SharedTree, configuredSharedTree, } from "./treeFactory.js";
35
35
  export { SharedTreeAttributes, SharedTreeFactoryType } from "./sharedTreeAttributes.js";
36
36
  export { persistedToSimpleSchema } from "./shared-tree/index.js";
37
- export { type ICodecOptions, type JsonValidator, type SchemaValidationFunction, FluidClientVersion, } from "./codec/index.js";
37
+ export { type ICodecOptions, type CodecWriteOptions, type JsonValidator, type SchemaValidationFunction, FluidClientVersion, } from "./codec/index.js";
38
38
  export { noopValidator } from "./codec/index.js";
39
39
  export { typeboxValidator } from "./external-utilities/index.js";
40
40
  export type { requireTrue, requireFalse, requireAssignableTo, areSafelyAssignable, isAssignableTo, isAny, eitherIsAny, RestrictiveReadonlyRecord, RestrictiveStringRecord, MakeNominal, IsUnion, UnionToIntersection, UnionToTuple, PopUnion, JsonCompatible, JsonCompatibleObject, } from "./util/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,EACX,KAAK,UAAU,EACf,UAAU,EACV,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,GACpB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EACX,SAAS,IAAI,cAAc,EAC3B,UAAU,IAAI,eAAe,EAC7B,UAAU,IAAI,eAAe,EAC7B,GAAG,IAAI,QAAQ,EACf,MAAM,iCAAiC,CAAC;AAEzC;;;;GAIG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC;AAC5D;;;;GAIG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC;AAC/C;;;;GAIG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC;AAC9D;;;;GAIG;AACH,MAAM,MAAM,GAAG,GAAG,QAAQ,CAAC;AAE3B,OAAO,EACN,UAAU,EACV,uBAAuB,EACvB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,cAAc,GACnB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,KAAK,uBAAuB,EAC5B,uBAAuB,EACvB,IAAI,EACJ,KAAK,cAAc,EACnB,K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AW,EACX,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,KAAK,EACL,WAAW,EAEX,yBAAyB,EACzB,uBAAuB,EACvB,WAAW,EACX,OAAO,EACP,mBAAmB,EACnB,YAAY,EACZ,QAAQ,EACR,cAAc,EACd,oBAAoB,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO;AACN;;;GAGG;AACH,aAAa,GACb,CAAC;AAKF,YAAY,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC"}
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,EAEX,UAAU,EACV,gBAAgB,GAKhB,MAAM,iBAAiB,CAAC;AAkCzB,OAAO,EACN,UAAU,EACV,uBAAuB,GAIvB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAKN,uBAAuB,EACvB,IAAI,EAGJ,SAAS,EAGT,0BAA0B,EAE1B,SAAS,EAET,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,GACnB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACN,aAAa,EAEb,wBAAwB,EAKxB,qBAAqB,EAKrB,aAAa,EACb,kBAAkB,EASlB,SAAS,EACT,WAAW,EAMX,QAAQ,EAER,gBAAgB,EA8BhB,qBAAqB,EACrB,qBAAqB;AACrB,4BAA4B;AAC5B,SAAS,EACT,eAAe,EACf,eAAe;AAwBf,YAAY;AACZ,QAAQ,EAOR,0BAA0B,EAE1B,sBAAsB,EACtB,sBAAsB,EAgBtB,aAAa,EAYb,qBAAqB,EACrB,eAAe,EAMf,eAAe,EAcf,QAAQ,EACR,8BAA8B,EAC9B,kBAAkB,EAClB,yBAAyB,EACzB,cAAc,EACd,yBAAyB,EAEzB,WAAW,EAIX,eAAe,EAGf,aAAa,GAIb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,UAAU,EACV,oBAAoB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACxF,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EAIN,kBAAkB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAsBjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO;AACN;;;GAGG;AACH,aAAa,GACb,CAAC;AAOF,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,WAAW,EAA2B,MAAM,kBAAkB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tValueSchema,\n\ttype Revertible,\n\tCommitKind,\n\tRevertibleStatus,\n\ttype CommitMetadata,\n\ttype RevertibleFactory,\n\ttype RevertibleAlphaFactory,\n\ttype RevertibleAlpha,\n} from \"./core/index.js\";\n\nimport type {\n\tListeners as EventListeners,\n\tIsListener as EventIsListener,\n\tListenable as EventListenable,\n\tOff as EventOff,\n} from \"@fluidframework/core-interfaces\";\n\n/**\n * {@inheritdoc @fluidframework/core-interfaces#Listeners}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type Listeners<T extends object> = EventListeners<T>;\n/**\n * {@inheritdoc @fluidframework/core-interfaces#IsListener}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type IsListener<T> = EventIsListener<T>;\n/**\n * {@inheritdoc @fluidframework/core-interfaces#Listenable}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type Listenable<T extends object> = EventListenable<T>;\n/**\n * {@inheritdoc @fluidframework/core-interfaces#Off}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type Off = EventOff;\n\nexport {\n\tTreeStatus,\n\tTreeCompressionStrategy,\n\ttype TreeIndex,\n\ttype TreeIndexKey,\n\ttype TreeIndexNodes,\n} from \"./feature-libraries/index.js\";\n\nexport {\n\ttype ITreeInternal,\n\ttype SharedTreeOptions,\n\ttype ForestType,\n\ttype SharedTreeFormatOptions,\n\tSharedTreeFormatVersion,\n\tTree,\n\ttype RunTransaction,\n\ttype ForestOptions,\n\tgetBranch,\n\ttype BranchableTree,\n\ttype TreeBranchFork,\n\tindependentInitializedView,\n\ttype ViewContent,\n\tTreeAlpha,\n\ttype TreeIdentifierUtils,\n\tindependentView,\n\tForestTypeOptimized,\n\tForestTypeExpensiveDebug,\n\tForestTypeReference,\n} from \"./shared-tree/index.js\";\n\nexport {\n\tTreeArrayNode,\n\ttype Unhydrated,\n\tIterableTreeArrayContent,\n\tTreeNode,\n\ttype ViewableTree,\n\ttype ITree,\n\ttype TreeNodeSchema,\n\tTreeViewConfiguration,\n\ttype ITreeViewConfiguration,\n\ttype ITreeConfigurationOptions,\n\ttype TreeView,\n\ttype TreeViewEvents,\n\tSchemaFactory,\n\tSchemaFactoryAlpha,\n\ttype SchemaFactoryObjectOptions,\n\ttype ImplicitFieldSchema,\n\ttype TreeFieldFromImplicitField,\n\ttype TreeChangeEvents,\n\ttype NodeFromSchema,\n\ttype TreeMapNode,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype TreeLeafValue,\n\tFieldKind,\n\tFieldSchema,\n\ttype FieldSchemaAlpha,\n\ttype FieldSchemaMetadata,\n\ttype ImplicitAllowedTypes,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype InsertableTypedNode,\n\tNodeKind,\n\ttype TreeObjectNode,\n\tObjectNodeSchema,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttype TreeNodeSchemaClass,\n\ttype SchemaCompatibilityStatus,\n\ttype FieldProps,\n\ttype InternalTreeNode,\n\ttype WithType,\n\ttype NodeChangedData,\n\t// Types not really intended for public use, but used in links.\n\t// Can not be moved to internalTypes since doing so causes app code to throw errors like:\n\t// Error: src/simple-tree/objectNode.ts:72:1 - (ae-unresolved-link) The @link reference could not be resolved: The package \"@fluidframework/tree\" does not have an export \"TreeNodeApi\"\n\ttype TreeNodeApi,\n\ttype TreeNodeSchemaCore,\n\t// Types not really intended for public use, but used in inferred types exposed in the public API.\n\t// Can not be moved to internalTypes since doing so causes app code to throw errors like:\n\t// error TS2742: The inferred type of 'Inventory' cannot be named without a reference to '../node_modules/@fluidframework/tree/lib/internalTypes.js'. This is likely not portable. A type annotation is necessary.\n\ttype AllowedTypes,\n\ttype System_Unsafe,\n\ttype FieldSchemaAlphaUnsafe,\n\ttype ArrayNodeCustomizableSchemaUnsafe,\n\ttype MapNodeCustomizableSchemaUnsafe,\n\t// System types (not in Internal types for various reasons, like doc links or cannot be named errors).\n\ttype typeSchemaSymbol,\n\ttype TreeNodeSchemaNonClass,\n\t// Recursive Schema APIs\n\ttype ValidateRecursiveSchema,\n\ttype FixRecursiveArraySchema,\n\t// Index APIs\n\ttype SimpleTreeIndex,\n\ttype IdentifierIndex,\n\tcreateSimpleTreeIndex,\n\tcreateIdentifierIndex,\n\t// experimental @alpha APIs:\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n\ttype UnsafeUnknownSchema,\n\ttype TreeViewAlpha,\n\ttype InsertableField,\n\ttype Insertable,\n\ttype InsertableContent,\n\ttype FactoryContent,\n\ttype FactoryContentObject,\n\ttype ReadableField,\n\ttype ReadSchema,\n\ttype ImplicitAnnotatedAllowedTypes,\n\ttype ImplicitAnnotatedFieldSchema,\n\ttype AnnotatedAllowedType,\n\ttype AnnotatedAllowedTypes,\n\ttype AllowedTypeMetadata,\n\ttype AllowedTypesMetadata,\n\ttype InsertableObjectFromAnnotatedSchemaRecord,\n\ttype UnannotateImplicitAllowedTypes,\n\ttype UnannotateAllowedTypes,\n\ttype UnannotateAllowedType,\n\ttype UnannotateAllowedTypesList,\n\ttype UnannotateAllowedTypeOrLazyItem,\n\ttype UnannotateImplicitFieldSchema,\n\ttype UnannotateSchemaRecord,\n\t// Beta APIs\n\tTreeBeta,\n\ttype TreeChangeEventsBeta,\n\t// Other\n\ttype VerboseTreeNode,\n\ttype TreeEncodingOptions,\n\ttype TreeSchemaEncodingOptions,\n\ttype TreeSchema,\n\tTreeViewConfigurationAlpha,\n\ttype VerboseTree,\n\textractPersistedSchema,\n\tcomparePersistedSchema,\n\ttype ConciseTree,\n\t// Back to normal types\n\ttype JsonTreeSchema,\n\ttype JsonSchemaId,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonLeafNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonObjectNodeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonSchemaType,\n\ttype JsonLeafSchemaType,\n\tgetJsonSchema,\n\ttype LazyItem,\n\ttype Unenforced,\n\ttype SimpleNodeSchemaBase,\n\ttype SimpleTreeSchema,\n\ttype SimpleNodeSchema,\n\ttype SimpleFieldSchema,\n\ttype SimpleLeafNodeSchema,\n\ttype SimpleMapNodeSchema,\n\ttype SimpleArrayNodeSchema,\n\ttype SimpleObjectNodeSchema,\n\ttype SimpleObjectFieldSchema,\n\tnormalizeAllowedTypes,\n\tgetSimpleSchema,\n\ttype ReadonlyArrayNode,\n\ttype InsertableTreeNodeFromAllowedTypes,\n\ttype Input,\n\ttype TreeBranch,\n\ttype TreeBranchEvents,\n\tasTreeViewAlpha,\n\ttype NodeSchemaOptions,\n\ttype NodeSchemaMetadata,\n\ttype SchemaStatics,\n\ttype ITreeAlpha,\n\ttype TransactionConstraint,\n\ttype NodeInDocumentConstraint,\n\ttype RunTransactionParams,\n\ttype VoidTransactionCallbackStatus,\n\ttype TransactionCallbackStatus,\n\ttype TransactionResult,\n\ttype TransactionResultExt,\n\ttype TransactionResultSuccess,\n\ttype TransactionResultFailed,\n\trollback,\n\tgenerateSchemaFromSimpleSchema,\n\tevaluateLazySchema,\n\treplaceConciseTreeHandles,\n\treplaceHandles,\n\treplaceVerboseTreeHandles,\n\ttype HandleConverter,\n\tallowUnused,\n\ttype LeafSchema,\n\ttype ArrayNodeCustomizableSchema,\n\ttype ArrayNodePojoEmulationSchema,\n\tArrayNodeSchema,\n\ttype MapNodeCustomizableSchema,\n\ttype MapNodePojoEmulationSchema,\n\tMapNodeSchema,\n\ttype ObjectFromSchemaRecord,\n\ttype ValidateRecursiveSchemaTemplate,\n\ttype FixRecursiveRecursionLimit,\n} from \"./simple-tree/index.js\";\nexport {\n\tSharedTree,\n\tconfiguredSharedTree,\n} from \"./treeFactory.js\";\nexport { SharedTreeAttributes, SharedTreeFactoryType } from \"./sharedTreeAttributes.js\";\nexport { persistedToSimpleSchema } from \"./shared-tree/index.js\";\n\nexport {\n\ttype ICodecOptions,\n\ttype JsonValidator,\n\ttype SchemaValidationFunction,\n\tFluidClientVersion,\n} from \"./codec/index.js\";\nexport { noopValidator } from \"./codec/index.js\";\nexport { typeboxValidator } from \"./external-utilities/index.js\";\n\nexport type {\n\t// Type Testing\n\trequireTrue,\n\trequireFalse,\n\trequireAssignableTo,\n\tareSafelyAssignable,\n\tisAssignableTo,\n\tisAny,\n\teitherIsAny,\n\t// Other\n\tRestrictiveReadonlyRecord,\n\tRestrictiveStringRecord,\n\tMakeNominal,\n\tIsUnion,\n\tUnionToIntersection,\n\tUnionToTuple,\n\tPopUnion,\n\tJsonCompatible,\n\tJsonCompatibleObject,\n} from \"./util/index.js\";\nexport { cloneWithReplacements } from \"./util/index.js\";\n\nimport * as InternalTypes from \"./internalTypes.js\";\nexport {\n\t/**\n\t * Contains types used by the API, but which serve mechanical purposes and do not represent semantic concepts.\n\t * They are used internally to implement API aspects, but are not intended for use by external consumers.\n\t */\n\tInternalTypes,\n};\n\n// Internal/System types:\n// These would be put in `internalTypes` except doing so tents to cause errors like:\n// The inferred type of 'NodeMap' cannot be named without a reference to '../../node_modules/@fluidframework/tree/lib/internalTypes.js'. This is likely not portable. A type annotation is necessary.\nexport type { MapNodeInsertableData } from \"./simple-tree/index.js\";\n\nexport { JsonAsTree } from \"./jsonDomainSchema.js\";\nexport { FluidSerializableAsTree } from \"./serializableDomainSchema.js\";\nexport { TableSchema, type System_TableSchema } from \"./tableSchema.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,EAEX,UAAU,EACV,gBAAgB,GAKhB,MAAM,iBAAiB,CAAC;AAkCzB,OAAO,EACN,UAAU,EACV,uBAAuB,GAIvB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAKN,uBAAuB,EACvB,IAAI,EAGJ,SAAS,EAGT,0BAA0B,EAE1B,SAAS,EAET,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,GACnB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACN,aAAa,EAEb,wBAAwB,EAKxB,qBAAqB,EAKrB,aAAa,EACb,kBAAkB,EASlB,SAAS,EACT,WAAW,EAMX,QAAQ,EAER,gBAAgB,EA8BhB,qBAAqB,EACrB,qBAAqB;AACrB,4BAA4B;AAC5B,SAAS,EACT,eAAe,EACf,eAAe;AAwBf,YAAY;AACZ,QAAQ,EAOR,0BAA0B,EAE1B,sBAAsB,EACtB,sBAAsB,EAgBtB,aAAa,EAYb,qBAAqB,EACrB,eAAe,EAMf,eAAe,EAcf,QAAQ,EACR,8BAA8B,EAC9B,kBAAkB,EAClB,yBAAyB,EACzB,cAAc,EACd,yBAAyB,EAEzB,WAAW,EAIX,eAAe,EAGf,aAAa,GAIb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,UAAU,EACV,oBAAoB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACxF,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EAKN,kBAAkB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAsBjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO;AACN;;;GAGG;AACH,aAAa,GACb,CAAC;AAOF,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,WAAW,EAA2B,MAAM,kBAAkB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tValueSchema,\n\ttype Revertible,\n\tCommitKind,\n\tRevertibleStatus,\n\ttype CommitMetadata,\n\ttype RevertibleFactory,\n\ttype RevertibleAlphaFactory,\n\ttype RevertibleAlpha,\n} from \"./core/index.js\";\n\nimport type {\n\tListeners as EventListeners,\n\tIsListener as EventIsListener,\n\tListenable as EventListenable,\n\tOff as EventOff,\n} from \"@fluidframework/core-interfaces\";\n\n/**\n * {@inheritdoc @fluidframework/core-interfaces#Listeners}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type Listeners<T extends object> = EventListeners<T>;\n/**\n * {@inheritdoc @fluidframework/core-interfaces#IsListener}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type IsListener<T> = EventIsListener<T>;\n/**\n * {@inheritdoc @fluidframework/core-interfaces#Listenable}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type Listenable<T extends object> = EventListenable<T>;\n/**\n * {@inheritdoc @fluidframework/core-interfaces#Off}\n * @public\n * @deprecated Deprecated in `@fluidframework/tree`. Consider importing from `fluid-framework` or `@fluidframework/core-interfaces` instead.\n */\nexport type Off = EventOff;\n\nexport {\n\tTreeStatus,\n\tTreeCompressionStrategy,\n\ttype TreeIndex,\n\ttype TreeIndexKey,\n\ttype TreeIndexNodes,\n} from \"./feature-libraries/index.js\";\n\nexport {\n\ttype ITreeInternal,\n\ttype SharedTreeOptions,\n\ttype ForestType,\n\ttype SharedTreeFormatOptions,\n\tSharedTreeFormatVersion,\n\tTree,\n\ttype RunTransaction,\n\ttype ForestOptions,\n\tgetBranch,\n\ttype BranchableTree,\n\ttype TreeBranchFork,\n\tindependentInitializedView,\n\ttype ViewContent,\n\tTreeAlpha,\n\ttype TreeIdentifierUtils,\n\tindependentView,\n\tForestTypeOptimized,\n\tForestTypeExpensiveDebug,\n\tForestTypeReference,\n} from \"./shared-tree/index.js\";\n\nexport {\n\tTreeArrayNode,\n\ttype Unhydrated,\n\tIterableTreeArrayContent,\n\tTreeNode,\n\ttype ViewableTree,\n\ttype ITree,\n\ttype TreeNodeSchema,\n\tTreeViewConfiguration,\n\ttype ITreeViewConfiguration,\n\ttype ITreeConfigurationOptions,\n\ttype TreeView,\n\ttype TreeViewEvents,\n\tSchemaFactory,\n\tSchemaFactoryAlpha,\n\ttype SchemaFactoryObjectOptions,\n\ttype ImplicitFieldSchema,\n\ttype TreeFieldFromImplicitField,\n\ttype TreeChangeEvents,\n\ttype NodeFromSchema,\n\ttype TreeMapNode,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype TreeLeafValue,\n\tFieldKind,\n\tFieldSchema,\n\ttype FieldSchemaAlpha,\n\ttype FieldSchemaMetadata,\n\ttype ImplicitAllowedTypes,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype InsertableTypedNode,\n\tNodeKind,\n\ttype TreeObjectNode,\n\tObjectNodeSchema,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttype TreeNodeSchemaClass,\n\ttype SchemaCompatibilityStatus,\n\ttype FieldProps,\n\ttype InternalTreeNode,\n\ttype WithType,\n\ttype NodeChangedData,\n\t// Types not really intended for public use, but used in links.\n\t// Can not be moved to internalTypes since doing so causes app code to throw errors like:\n\t// Error: src/simple-tree/objectNode.ts:72:1 - (ae-unresolved-link) The @link reference could not be resolved: The package \"@fluidframework/tree\" does not have an export \"TreeNodeApi\"\n\ttype TreeNodeApi,\n\ttype TreeNodeSchemaCore,\n\t// Types not really intended for public use, but used in inferred types exposed in the public API.\n\t// Can not be moved to internalTypes since doing so causes app code to throw errors like:\n\t// error TS2742: The inferred type of 'Inventory' cannot be named without a reference to '../node_modules/@fluidframework/tree/lib/internalTypes.js'. This is likely not portable. A type annotation is necessary.\n\ttype AllowedTypes,\n\ttype System_Unsafe,\n\ttype FieldSchemaAlphaUnsafe,\n\ttype ArrayNodeCustomizableSchemaUnsafe,\n\ttype MapNodeCustomizableSchemaUnsafe,\n\t// System types (not in Internal types for various reasons, like doc links or cannot be named errors).\n\ttype typeSchemaSymbol,\n\ttype TreeNodeSchemaNonClass,\n\t// Recursive Schema APIs\n\ttype ValidateRecursiveSchema,\n\ttype FixRecursiveArraySchema,\n\t// Index APIs\n\ttype SimpleTreeIndex,\n\ttype IdentifierIndex,\n\tcreateSimpleTreeIndex,\n\tcreateIdentifierIndex,\n\t// experimental @alpha APIs:\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n\ttype UnsafeUnknownSchema,\n\ttype TreeViewAlpha,\n\ttype InsertableField,\n\ttype Insertable,\n\ttype InsertableContent,\n\ttype FactoryContent,\n\ttype FactoryContentObject,\n\ttype ReadableField,\n\ttype ReadSchema,\n\ttype ImplicitAnnotatedAllowedTypes,\n\ttype ImplicitAnnotatedFieldSchema,\n\ttype AnnotatedAllowedType,\n\ttype AnnotatedAllowedTypes,\n\ttype AllowedTypeMetadata,\n\ttype AllowedTypesMetadata,\n\ttype InsertableObjectFromAnnotatedSchemaRecord,\n\ttype UnannotateImplicitAllowedTypes,\n\ttype UnannotateAllowedTypes,\n\ttype UnannotateAllowedType,\n\ttype UnannotateAllowedTypesList,\n\ttype UnannotateAllowedTypeOrLazyItem,\n\ttype UnannotateImplicitFieldSchema,\n\ttype UnannotateSchemaRecord,\n\t// Beta APIs\n\tTreeBeta,\n\ttype TreeChangeEventsBeta,\n\t// Other\n\ttype VerboseTreeNode,\n\ttype TreeEncodingOptions,\n\ttype TreeSchemaEncodingOptions,\n\ttype TreeSchema,\n\tTreeViewConfigurationAlpha,\n\ttype VerboseTree,\n\textractPersistedSchema,\n\tcomparePersistedSchema,\n\ttype ConciseTree,\n\t// Back to normal types\n\ttype JsonTreeSchema,\n\ttype JsonSchemaId,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonLeafNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonObjectNodeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonSchemaType,\n\ttype JsonLeafSchemaType,\n\tgetJsonSchema,\n\ttype LazyItem,\n\ttype Unenforced,\n\ttype SimpleNodeSchemaBase,\n\ttype SimpleTreeSchema,\n\ttype SimpleNodeSchema,\n\ttype SimpleFieldSchema,\n\ttype SimpleLeafNodeSchema,\n\ttype SimpleMapNodeSchema,\n\ttype SimpleArrayNodeSchema,\n\ttype SimpleObjectNodeSchema,\n\ttype SimpleObjectFieldSchema,\n\tnormalizeAllowedTypes,\n\tgetSimpleSchema,\n\ttype ReadonlyArrayNode,\n\ttype InsertableTreeNodeFromAllowedTypes,\n\ttype Input,\n\ttype TreeBranch,\n\ttype TreeBranchEvents,\n\tasTreeViewAlpha,\n\ttype NodeSchemaOptions,\n\ttype NodeSchemaMetadata,\n\ttype SchemaStatics,\n\ttype ITreeAlpha,\n\ttype TransactionConstraint,\n\ttype NodeInDocumentConstraint,\n\ttype RunTransactionParams,\n\ttype VoidTransactionCallbackStatus,\n\ttype TransactionCallbackStatus,\n\ttype TransactionResult,\n\ttype TransactionResultExt,\n\ttype TransactionResultSuccess,\n\ttype TransactionResultFailed,\n\trollback,\n\tgenerateSchemaFromSimpleSchema,\n\tevaluateLazySchema,\n\treplaceConciseTreeHandles,\n\treplaceHandles,\n\treplaceVerboseTreeHandles,\n\ttype HandleConverter,\n\tallowUnused,\n\ttype LeafSchema,\n\ttype ArrayNodeCustomizableSchema,\n\ttype ArrayNodePojoEmulationSchema,\n\tArrayNodeSchema,\n\ttype MapNodeCustomizableSchema,\n\ttype MapNodePojoEmulationSchema,\n\tMapNodeSchema,\n\ttype ObjectFromSchemaRecord,\n\ttype ValidateRecursiveSchemaTemplate,\n\ttype FixRecursiveRecursionLimit,\n} from \"./simple-tree/index.js\";\nexport {\n\tSharedTree,\n\tconfiguredSharedTree,\n} from \"./treeFactory.js\";\nexport { SharedTreeAttributes, SharedTreeFactoryType } from \"./sharedTreeAttributes.js\";\nexport { persistedToSimpleSchema } from \"./shared-tree/index.js\";\n\nexport {\n\ttype ICodecOptions,\n\ttype CodecWriteOptions,\n\ttype JsonValidator,\n\ttype SchemaValidationFunction,\n\tFluidClientVersion,\n} from \"./codec/index.js\";\nexport { noopValidator } from \"./codec/index.js\";\nexport { typeboxValidator } from \"./external-utilities/index.js\";\n\nexport type {\n\t// Type Testing\n\trequireTrue,\n\trequireFalse,\n\trequireAssignableTo,\n\tareSafelyAssignable,\n\tisAssignableTo,\n\tisAny,\n\teitherIsAny,\n\t// Other\n\tRestrictiveReadonlyRecord,\n\tRestrictiveStringRecord,\n\tMakeNominal,\n\tIsUnion,\n\tUnionToIntersection,\n\tUnionToTuple,\n\tPopUnion,\n\tJsonCompatible,\n\tJsonCompatibleObject,\n} from \"./util/index.js\";\nexport { cloneWithReplacements } from \"./util/index.js\";\n\nimport * as InternalTypes from \"./internalTypes.js\";\nexport {\n\t/**\n\t * Contains types used by the API, but which serve mechanical purposes and do not represent semantic concepts.\n\t * They are used internally to implement API aspects, but are not intended for use by external consumers.\n\t */\n\tInternalTypes,\n};\n\n// Internal/System types:\n// These would be put in `internalTypes` except doing so tents to cause errors like:\n// The inferred type of 'NodeMap' cannot be named without a reference to '../../node_modules/@fluidframework/tree/lib/internalTypes.js'. This is likely not portable. A type annotation is necessary.\nexport type { MapNodeInsertableData } from \"./simple-tree/index.js\";\n\nexport { JsonAsTree } from \"./jsonDomainSchema.js\";\nexport { FluidSerializableAsTree } from \"./serializableDomainSchema.js\";\nexport { TableSchema, type System_TableSchema } from \"./tableSchema.js\";\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/tree";
8
- export declare const pkgVersion = "2.41.0";
8
+ export declare const pkgVersion = "2.42.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/tree";
8
- export const pkgVersion = "2.41.0";
8
+ export const pkgVersion = "2.42.0";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,sBAAsB,CAAC;AAC9C,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/tree\";\nexport const pkgVersion = \"2.41.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,sBAAsB,CAAC;AAC9C,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/tree\";\nexport const pkgVersion = \"2.42.0\";\n"]}
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import type { HasListeners, IEmitter, Listenable } from "@fluidframework/core-interfaces/internal";
6
6
  import { type NodeIdentifierManager, type FullSchemaPolicy } from "../feature-libraries/index.js";
7
- import { type ImplicitFieldSchema, type SchemaCompatibilityStatus, type TreeView, type TreeViewEvents, SchemaCompatibilityTester, type TreeViewConfiguration, type TreeViewAlpha, type InsertableField, type ReadableField, type ReadSchema, type UnsafeUnknownSchema, type TreeBranch, type TreeBranchEvents, type VoidTransactionCallbackStatus, type TransactionCallbackStatus, type TransactionResult, type TransactionResultExt, type RunTransactionParams } from "../simple-tree/index.js";
7
+ import { type ImplicitFieldSchema, type SchemaCompatibilityStatus, type TreeView, type TreeViewEvents, SchemaCompatibilityTester, type TreeViewConfiguration, type TreeViewAlpha, type InsertableField, type ReadableField, type ReadSchema, type UnsafeUnknownSchema, type TreeBranch, type TreeBranchEvents, type VoidTransactionCallbackStatus, type TransactionCallbackStatus, type TransactionResult, type TransactionResultExt, type RunTransactionParams, type TransactionConstraint } from "../simple-tree/index.js";
8
8
  import { type Breakable, type WithBreakable } from "../util/index.js";
9
9
  import { CheckoutFlexTreeView } from "./checkoutFlexTreeView.js";
10
10
  import type { ITreeCheckout, TreeCheckout } from "./treeCheckout.js";
@@ -100,4 +100,14 @@ export declare function getCheckout(context: TreeBranch): TreeCheckout;
100
100
  * This may only be called when the schema is already known to be compatible (typically via ensureSchema).
101
101
  */
102
102
  export declare function requireSchema(checkout: ITreeCheckout, viewSchema: SchemaCompatibilityTester, onDispose: () => void, nodeKeyManager: NodeIdentifierManager, schemaPolicy: FullSchemaPolicy): CheckoutFlexTreeView;
103
+ /**
104
+ * Adds constraints to a `checkout`'s pending transaction.
105
+ *
106
+ * @param checkout - The checkout's who's transaction will have the constraints added to it.
107
+ * @param constraintsOnRevert - If true, use {@link ISharedTreeEditor.addNodeExistsConstraintOnRevert}.
108
+ * @param constraints - The constraints to add to the transaction.
109
+ *
110
+ * @see {@link RunTransactionParams.preconditions}.
111
+ */
112
+ export declare function addConstraintsToTransaction(checkout: ITreeCheckout, constraintsOnRevert: boolean, constraints?: readonly TransactionConstraint[]): void;
103
113
  //# sourceMappingURL=schematizingTreeView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schematizingTreeView.d.ts","sourceRoot":"","sources":["../../src/shared-tree/schematizingTreeView.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACX,YAAY,EACZ,QAAQ,EACR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