@fluidframework/tree 2.10.0-307399 → 2.11.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 (472) hide show
  1. package/CHANGELOG.md +103 -0
  2. package/api-report/tree.alpha.api.md +47 -16
  3. package/api-report/tree.beta.api.md +5 -14
  4. package/api-report/tree.legacy.alpha.api.md +5 -14
  5. package/api-report/tree.legacy.public.api.md +5 -14
  6. package/api-report/tree.public.api.md +5 -14
  7. package/dist/alpha.d.ts +9 -0
  8. package/dist/core/forest/forest.d.ts +10 -2
  9. package/dist/core/forest/forest.d.ts.map +1 -1
  10. package/dist/core/forest/forest.js.map +1 -1
  11. package/dist/core/index.d.ts +2 -2
  12. package/dist/core/index.d.ts.map +1 -1
  13. package/dist/core/index.js +3 -2
  14. package/dist/core/index.js.map +1 -1
  15. package/dist/core/rebase/utils.d.ts +1 -1
  16. package/dist/core/rebase/utils.d.ts.map +1 -1
  17. package/dist/core/rebase/utils.js +11 -8
  18. package/dist/core/rebase/utils.js.map +1 -1
  19. package/dist/core/revertible.d.ts +30 -1
  20. package/dist/core/revertible.d.ts.map +1 -1
  21. package/dist/core/revertible.js.map +1 -1
  22. package/dist/core/schema-stored/storedSchemaRepository.d.ts +2 -2
  23. package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  24. package/dist/core/schema-stored/storedSchemaRepository.js +5 -5
  25. package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
  26. package/dist/core/tree/anchorSet.d.ts +2 -2
  27. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  28. package/dist/core/tree/anchorSet.js +21 -21
  29. package/dist/core/tree/anchorSet.js.map +1 -1
  30. package/dist/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  31. package/dist/core/tree/detachedFieldIndexCodec.js +3 -2
  32. package/dist/core/tree/detachedFieldIndexCodec.js.map +1 -1
  33. package/dist/core/tree/index.d.ts +1 -1
  34. package/dist/core/tree/index.d.ts.map +1 -1
  35. package/dist/core/tree/index.js +2 -1
  36. package/dist/core/tree/index.js.map +1 -1
  37. package/dist/core/tree/visitorUtils.d.ts +25 -1
  38. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  39. package/dist/core/tree/visitorUtils.js +29 -1
  40. package/dist/core/tree/visitorUtils.js.map +1 -1
  41. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +5 -2
  42. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  43. package/dist/feature-libraries/chunked-forest/chunkedForest.js +24 -14
  44. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  45. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  46. package/dist/feature-libraries/chunked-forest/uniformChunk.js +2 -2
  47. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  48. package/dist/feature-libraries/flex-tree/context.d.ts +1 -1
  49. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  50. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  51. package/dist/feature-libraries/index.d.ts +1 -0
  52. package/dist/feature-libraries/index.d.ts.map +1 -1
  53. package/dist/feature-libraries/index.js +4 -1
  54. package/dist/feature-libraries/index.js.map +1 -1
  55. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +132 -0
  56. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -0
  57. package/dist/feature-libraries/indexing/anchorTreeIndex.js +361 -0
  58. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -0
  59. package/dist/feature-libraries/indexing/index.d.ts +7 -0
  60. package/dist/feature-libraries/indexing/index.d.ts.map +1 -0
  61. package/dist/feature-libraries/indexing/index.js +11 -0
  62. package/dist/feature-libraries/indexing/index.js.map +1 -0
  63. package/dist/feature-libraries/indexing/types.d.ts +32 -0
  64. package/dist/feature-libraries/indexing/types.d.ts.map +1 -0
  65. package/dist/{events/interop.js → feature-libraries/indexing/types.js} +1 -1
  66. package/dist/feature-libraries/indexing/types.js.map +1 -0
  67. package/dist/feature-libraries/modular-schema/discrepancies.js +1 -1
  68. package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  69. package/dist/feature-libraries/object-forest/objectForest.d.ts +5 -2
  70. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  71. package/dist/feature-libraries/object-forest/objectForest.js +21 -11
  72. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  73. package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  74. package/dist/feature-libraries/sequence-field/invert.js +2 -2
  75. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  76. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +3 -2
  77. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  78. package/dist/index.d.ts +4 -4
  79. package/dist/index.d.ts.map +1 -1
  80. package/dist/index.js +4 -1
  81. package/dist/index.js.map +1 -1
  82. package/dist/packageVersion.d.ts +1 -1
  83. package/dist/packageVersion.d.ts.map +1 -1
  84. package/dist/packageVersion.js +1 -1
  85. package/dist/packageVersion.js.map +1 -1
  86. package/dist/shared-tree/index.d.ts +1 -1
  87. package/dist/shared-tree/index.d.ts.map +1 -1
  88. package/dist/shared-tree/index.js +1 -2
  89. package/dist/shared-tree/index.js.map +1 -1
  90. package/dist/shared-tree/schematizingTreeView.d.ts +7 -1
  91. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  92. package/dist/shared-tree/schematizingTreeView.js +31 -30
  93. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  94. package/dist/shared-tree/sharedTree.d.ts +3 -0
  95. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  96. package/dist/shared-tree/sharedTree.js +56 -20
  97. package/dist/shared-tree/sharedTree.js.map +1 -1
  98. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  99. package/dist/shared-tree/sharedTreeChangeFamily.js +3 -3
  100. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  101. package/dist/shared-tree/treeCheckout.d.ts +32 -64
  102. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  103. package/dist/shared-tree/treeCheckout.js +161 -125
  104. package/dist/shared-tree/treeCheckout.js.map +1 -1
  105. package/dist/shared-tree-core/branch.d.ts +25 -81
  106. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  107. package/dist/shared-tree-core/branch.js +72 -151
  108. package/dist/shared-tree-core/branch.js.map +1 -1
  109. package/dist/shared-tree-core/branchCommitEnricher.d.ts +19 -33
  110. package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  111. package/dist/shared-tree-core/branchCommitEnricher.js +73 -54
  112. package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
  113. package/dist/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  114. package/dist/shared-tree-core/defaultResubmitMachine.js +2 -1
  115. package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  116. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  117. package/dist/shared-tree-core/editManager.js +2 -2
  118. package/dist/shared-tree-core/editManager.js.map +1 -1
  119. package/dist/shared-tree-core/index.d.ts +1 -1
  120. package/dist/shared-tree-core/index.d.ts.map +1 -1
  121. package/dist/shared-tree-core/index.js +4 -3
  122. package/dist/shared-tree-core/index.js.map +1 -1
  123. package/dist/shared-tree-core/sharedTreeCore.d.ts +2 -2
  124. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  125. package/dist/shared-tree-core/sharedTreeCore.js +11 -52
  126. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  127. package/dist/shared-tree-core/transaction.d.ts +108 -0
  128. package/dist/shared-tree-core/transaction.d.ts.map +1 -0
  129. package/dist/shared-tree-core/transaction.js +99 -0
  130. package/dist/shared-tree-core/transaction.js.map +1 -0
  131. package/dist/shared-tree-core/transactionEnricher.d.ts +8 -13
  132. package/dist/shared-tree-core/transactionEnricher.d.ts.map +1 -1
  133. package/dist/shared-tree-core/transactionEnricher.js +41 -21
  134. package/dist/shared-tree-core/transactionEnricher.js.map +1 -1
  135. package/dist/simple-tree/api/identifierIndex.d.ts +21 -0
  136. package/dist/simple-tree/api/identifierIndex.d.ts.map +1 -0
  137. package/dist/simple-tree/api/identifierIndex.js +45 -0
  138. package/dist/simple-tree/api/identifierIndex.js.map +1 -0
  139. package/dist/simple-tree/api/index.d.ts +2 -0
  140. package/dist/simple-tree/api/index.d.ts.map +1 -1
  141. package/dist/simple-tree/api/index.js +5 -1
  142. package/dist/simple-tree/api/index.js.map +1 -1
  143. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +9 -7
  144. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  145. package/dist/simple-tree/api/simpleTreeIndex.d.ts +65 -0
  146. package/dist/simple-tree/api/simpleTreeIndex.d.ts.map +1 -0
  147. package/dist/simple-tree/api/simpleTreeIndex.js +91 -0
  148. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -0
  149. package/dist/simple-tree/api/tree.d.ts +4 -5
  150. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  151. package/dist/simple-tree/api/tree.js.map +1 -1
  152. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  153. package/dist/simple-tree/core/index.d.ts +1 -1
  154. package/dist/simple-tree/core/index.d.ts.map +1 -1
  155. package/dist/simple-tree/core/index.js +2 -1
  156. package/dist/simple-tree/core/index.js.map +1 -1
  157. package/dist/simple-tree/core/treeNodeKernel.d.ts +6 -2
  158. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  159. package/dist/simple-tree/core/treeNodeKernel.js +53 -22
  160. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  161. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +1 -1
  162. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  163. package/dist/simple-tree/core/unhydratedFlexTree.js +2 -2
  164. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  165. package/dist/simple-tree/index.d.ts +1 -1
  166. package/dist/simple-tree/index.d.ts.map +1 -1
  167. package/dist/simple-tree/index.js +4 -2
  168. package/dist/simple-tree/index.js.map +1 -1
  169. package/dist/simple-tree/objectNode.d.ts +7 -2
  170. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  171. package/dist/simple-tree/objectNode.js.map +1 -1
  172. package/dist/simple-tree/toMapTree.js +3 -3
  173. package/dist/simple-tree/toMapTree.js.map +1 -1
  174. package/dist/util/index.d.ts +1 -2
  175. package/dist/util/index.d.ts.map +1 -1
  176. package/dist/util/index.js +5 -4
  177. package/dist/util/index.js.map +1 -1
  178. package/dist/util/typeCheck.d.ts +6 -1
  179. package/dist/util/typeCheck.d.ts.map +1 -1
  180. package/dist/util/typeCheck.js.map +1 -1
  181. package/dist/util/typeCheckTests.d.ts +14 -2
  182. package/dist/util/typeCheckTests.d.ts.map +1 -1
  183. package/dist/util/typeCheckTests.js.map +1 -1
  184. package/dist/util/utils.d.ts +29 -0
  185. package/dist/util/utils.d.ts.map +1 -1
  186. package/dist/util/utils.js +13 -1
  187. package/dist/util/utils.js.map +1 -1
  188. package/lib/alpha.d.ts +9 -0
  189. package/lib/core/forest/forest.d.ts +10 -2
  190. package/lib/core/forest/forest.d.ts.map +1 -1
  191. package/lib/core/forest/forest.js.map +1 -1
  192. package/lib/core/index.d.ts +2 -2
  193. package/lib/core/index.d.ts.map +1 -1
  194. package/lib/core/index.js +2 -2
  195. package/lib/core/index.js.map +1 -1
  196. package/lib/core/rebase/utils.d.ts +1 -1
  197. package/lib/core/rebase/utils.d.ts.map +1 -1
  198. package/lib/core/rebase/utils.js +11 -8
  199. package/lib/core/rebase/utils.js.map +1 -1
  200. package/lib/core/revertible.d.ts +30 -1
  201. package/lib/core/revertible.d.ts.map +1 -1
  202. package/lib/core/revertible.js.map +1 -1
  203. package/lib/core/schema-stored/storedSchemaRepository.d.ts +2 -2
  204. package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  205. package/lib/core/schema-stored/storedSchemaRepository.js +1 -1
  206. package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
  207. package/lib/core/tree/anchorSet.d.ts +2 -2
  208. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  209. package/lib/core/tree/anchorSet.js +1 -1
  210. package/lib/core/tree/anchorSet.js.map +1 -1
  211. package/lib/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  212. package/lib/core/tree/detachedFieldIndexCodec.js +4 -3
  213. package/lib/core/tree/detachedFieldIndexCodec.js.map +1 -1
  214. package/lib/core/tree/index.d.ts +1 -1
  215. package/lib/core/tree/index.d.ts.map +1 -1
  216. package/lib/core/tree/index.js +1 -1
  217. package/lib/core/tree/index.js.map +1 -1
  218. package/lib/core/tree/visitorUtils.d.ts +25 -1
  219. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  220. package/lib/core/tree/visitorUtils.js +27 -0
  221. package/lib/core/tree/visitorUtils.js.map +1 -1
  222. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +5 -2
  223. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  224. package/lib/feature-libraries/chunked-forest/chunkedForest.js +18 -8
  225. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  226. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  227. package/lib/feature-libraries/chunked-forest/uniformChunk.js +3 -3
  228. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  229. package/lib/feature-libraries/flex-tree/context.d.ts +1 -1
  230. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  231. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  232. package/lib/feature-libraries/index.d.ts +1 -0
  233. package/lib/feature-libraries/index.d.ts.map +1 -1
  234. package/lib/feature-libraries/index.js +1 -0
  235. package/lib/feature-libraries/index.js.map +1 -1
  236. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +132 -0
  237. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -0
  238. package/lib/feature-libraries/indexing/anchorTreeIndex.js +356 -0
  239. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -0
  240. package/lib/feature-libraries/indexing/index.d.ts +7 -0
  241. package/lib/feature-libraries/indexing/index.d.ts.map +1 -0
  242. package/lib/{events → feature-libraries/indexing}/index.js +1 -1
  243. package/lib/feature-libraries/indexing/index.js.map +1 -0
  244. package/lib/feature-libraries/indexing/types.d.ts +32 -0
  245. package/lib/feature-libraries/indexing/types.d.ts.map +1 -0
  246. package/lib/{events/interop.js → feature-libraries/indexing/types.js} +1 -1
  247. package/lib/feature-libraries/indexing/types.js.map +1 -0
  248. package/lib/feature-libraries/modular-schema/discrepancies.js +1 -1
  249. package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  250. package/lib/feature-libraries/object-forest/objectForest.d.ts +5 -2
  251. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  252. package/lib/feature-libraries/object-forest/objectForest.js +15 -5
  253. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  254. package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  255. package/lib/feature-libraries/sequence-field/invert.js +4 -4
  256. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  257. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +4 -3
  258. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  259. package/lib/index.d.ts +4 -4
  260. package/lib/index.d.ts.map +1 -1
  261. package/lib/index.js +1 -1
  262. package/lib/index.js.map +1 -1
  263. package/lib/packageVersion.d.ts +1 -1
  264. package/lib/packageVersion.d.ts.map +1 -1
  265. package/lib/packageVersion.js +1 -1
  266. package/lib/packageVersion.js.map +1 -1
  267. package/lib/shared-tree/index.d.ts +1 -1
  268. package/lib/shared-tree/index.d.ts.map +1 -1
  269. package/lib/shared-tree/index.js +1 -1
  270. package/lib/shared-tree/index.js.map +1 -1
  271. package/lib/shared-tree/schematizingTreeView.d.ts +7 -1
  272. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  273. package/lib/shared-tree/schematizingTreeView.js +2 -2
  274. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  275. package/lib/shared-tree/sharedTree.d.ts +3 -0
  276. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  277. package/lib/shared-tree/sharedTree.js +37 -1
  278. package/lib/shared-tree/sharedTree.js.map +1 -1
  279. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  280. package/lib/shared-tree/sharedTreeChangeFamily.js +5 -5
  281. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  282. package/lib/shared-tree/treeCheckout.d.ts +32 -64
  283. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  284. package/lib/shared-tree/treeCheckout.js +149 -112
  285. package/lib/shared-tree/treeCheckout.js.map +1 -1
  286. package/lib/shared-tree-core/branch.d.ts +25 -81
  287. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  288. package/lib/shared-tree-core/branch.js +72 -151
  289. package/lib/shared-tree-core/branch.js.map +1 -1
  290. package/lib/shared-tree-core/branchCommitEnricher.d.ts +19 -33
  291. package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  292. package/lib/shared-tree-core/branchCommitEnricher.js +74 -55
  293. package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
  294. package/lib/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  295. package/lib/shared-tree-core/defaultResubmitMachine.js +3 -2
  296. package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  297. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  298. package/lib/shared-tree-core/editManager.js +1 -1
  299. package/lib/shared-tree-core/editManager.js.map +1 -1
  300. package/lib/shared-tree-core/index.d.ts +1 -1
  301. package/lib/shared-tree-core/index.d.ts.map +1 -1
  302. package/lib/shared-tree-core/index.js +1 -1
  303. package/lib/shared-tree-core/index.js.map +1 -1
  304. package/lib/shared-tree-core/sharedTreeCore.d.ts +2 -2
  305. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  306. package/lib/shared-tree-core/sharedTreeCore.js +12 -53
  307. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  308. package/lib/shared-tree-core/transaction.d.ts +108 -0
  309. package/lib/shared-tree-core/transaction.d.ts.map +1 -0
  310. package/lib/shared-tree-core/transaction.js +95 -0
  311. package/lib/shared-tree-core/transaction.js.map +1 -0
  312. package/lib/shared-tree-core/transactionEnricher.d.ts +8 -13
  313. package/lib/shared-tree-core/transactionEnricher.d.ts.map +1 -1
  314. package/lib/shared-tree-core/transactionEnricher.js +41 -21
  315. package/lib/shared-tree-core/transactionEnricher.js.map +1 -1
  316. package/lib/simple-tree/api/identifierIndex.d.ts +21 -0
  317. package/lib/simple-tree/api/identifierIndex.d.ts.map +1 -0
  318. package/lib/simple-tree/api/identifierIndex.js +41 -0
  319. package/lib/simple-tree/api/identifierIndex.js.map +1 -0
  320. package/lib/simple-tree/api/index.d.ts +2 -0
  321. package/lib/simple-tree/api/index.d.ts.map +1 -1
  322. package/lib/simple-tree/api/index.js +2 -0
  323. package/lib/simple-tree/api/index.js.map +1 -1
  324. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +11 -9
  325. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  326. package/lib/simple-tree/api/simpleTreeIndex.d.ts +65 -0
  327. package/lib/simple-tree/api/simpleTreeIndex.d.ts.map +1 -0
  328. package/lib/simple-tree/api/simpleTreeIndex.js +87 -0
  329. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -0
  330. package/lib/simple-tree/api/tree.d.ts +4 -5
  331. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  332. package/lib/simple-tree/api/tree.js.map +1 -1
  333. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  334. package/lib/simple-tree/core/index.d.ts +1 -1
  335. package/lib/simple-tree/core/index.d.ts.map +1 -1
  336. package/lib/simple-tree/core/index.js +1 -1
  337. package/lib/simple-tree/core/index.js.map +1 -1
  338. package/lib/simple-tree/core/treeNodeKernel.d.ts +6 -2
  339. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  340. package/lib/simple-tree/core/treeNodeKernel.js +31 -1
  341. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  342. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +1 -1
  343. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  344. package/lib/simple-tree/core/unhydratedFlexTree.js +1 -1
  345. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  346. package/lib/simple-tree/index.d.ts +1 -1
  347. package/lib/simple-tree/index.d.ts.map +1 -1
  348. package/lib/simple-tree/index.js +1 -1
  349. package/lib/simple-tree/index.js.map +1 -1
  350. package/lib/simple-tree/objectNode.d.ts +7 -2
  351. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  352. package/lib/simple-tree/objectNode.js.map +1 -1
  353. package/lib/simple-tree/toMapTree.js +5 -5
  354. package/lib/simple-tree/toMapTree.js.map +1 -1
  355. package/lib/util/index.d.ts +1 -2
  356. package/lib/util/index.d.ts.map +1 -1
  357. package/lib/util/index.js +1 -2
  358. package/lib/util/index.js.map +1 -1
  359. package/lib/util/typeCheck.d.ts +6 -1
  360. package/lib/util/typeCheck.d.ts.map +1 -1
  361. package/lib/util/typeCheck.js.map +1 -1
  362. package/lib/util/typeCheckTests.d.ts +14 -2
  363. package/lib/util/typeCheckTests.d.ts.map +1 -1
  364. package/lib/util/typeCheckTests.js.map +1 -1
  365. package/lib/util/utils.d.ts +29 -0
  366. package/lib/util/utils.d.ts.map +1 -1
  367. package/lib/util/utils.js +9 -0
  368. package/lib/util/utils.js.map +1 -1
  369. package/package.json +23 -23
  370. package/src/core/forest/forest.ts +12 -1
  371. package/src/core/index.ts +8 -1
  372. package/src/core/rebase/utils.ts +12 -10
  373. package/src/core/revertible.ts +35 -1
  374. package/src/core/schema-stored/storedSchemaRepository.ts +2 -1
  375. package/src/core/tree/anchorSet.ts +2 -1
  376. package/src/core/tree/detachedFieldIndexCodec.ts +4 -3
  377. package/src/core/tree/index.ts +1 -0
  378. package/src/core/tree/visitorUtils.ts +56 -1
  379. package/src/feature-libraries/chunked-forest/chunkedForest.ts +33 -7
  380. package/src/feature-libraries/chunked-forest/uniformChunk.ts +3 -3
  381. package/src/feature-libraries/flex-tree/context.ts +1 -1
  382. package/src/feature-libraries/index.ts +9 -0
  383. package/src/feature-libraries/indexing/anchorTreeIndex.ts +453 -0
  384. package/src/feature-libraries/indexing/index.ts +11 -0
  385. package/src/feature-libraries/indexing/types.ts +37 -0
  386. package/src/feature-libraries/modular-schema/discrepancies.ts +1 -1
  387. package/src/feature-libraries/object-forest/objectForest.ts +22 -4
  388. package/src/feature-libraries/sequence-field/invert.ts +4 -4
  389. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +4 -4
  390. package/src/index.ts +16 -6
  391. package/src/packageVersion.ts +1 -1
  392. package/src/shared-tree/index.ts +0 -2
  393. package/src/shared-tree/schematizingTreeView.ts +7 -7
  394. package/src/shared-tree/sharedTree.ts +60 -6
  395. package/src/shared-tree/sharedTreeChangeFamily.ts +5 -4
  396. package/src/shared-tree/treeCheckout.ts +201 -189
  397. package/src/shared-tree-core/branch.ts +93 -220
  398. package/src/shared-tree-core/branchCommitEnricher.ts +69 -64
  399. package/src/shared-tree-core/defaultResubmitMachine.ts +3 -2
  400. package/src/shared-tree-core/editManager.ts +1 -1
  401. package/src/shared-tree-core/index.ts +9 -2
  402. package/src/shared-tree-core/sharedTreeCore.ts +17 -62
  403. package/src/shared-tree-core/transaction.ts +165 -0
  404. package/src/shared-tree-core/transactionEnricher.ts +30 -24
  405. package/src/simple-tree/api/identifierIndex.ts +64 -0
  406. package/src/simple-tree/api/index.ts +5 -0
  407. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +17 -18
  408. package/src/simple-tree/api/simpleTreeIndex.ts +231 -0
  409. package/src/simple-tree/api/tree.ts +8 -5
  410. package/src/simple-tree/api/treeNodeApi.ts +1 -1
  411. package/src/simple-tree/core/index.ts +1 -0
  412. package/src/simple-tree/core/treeNodeKernel.ts +37 -2
  413. package/src/simple-tree/core/unhydratedFlexTree.ts +2 -1
  414. package/src/simple-tree/index.ts +4 -0
  415. package/src/simple-tree/objectNode.ts +19 -12
  416. package/src/simple-tree/toMapTree.ts +5 -5
  417. package/src/util/index.ts +3 -1
  418. package/src/util/typeCheck.ts +6 -1
  419. package/src/util/typeCheckTests.ts +11 -1
  420. package/src/util/utils.ts +38 -0
  421. package/dist/events/emitter.d.ts +0 -139
  422. package/dist/events/emitter.d.ts.map +0 -1
  423. package/dist/events/emitter.js +0 -165
  424. package/dist/events/emitter.js.map +0 -1
  425. package/dist/events/index.d.ts +0 -7
  426. package/dist/events/index.d.ts.map +0 -1
  427. package/dist/events/index.js +0 -11
  428. package/dist/events/index.js.map +0 -1
  429. package/dist/events/interop.d.ts +0 -30
  430. package/dist/events/interop.d.ts.map +0 -1
  431. package/dist/events/interop.js.map +0 -1
  432. package/dist/events/listeners.d.ts +0 -76
  433. package/dist/events/listeners.d.ts.map +0 -1
  434. package/dist/events/listeners.js +0 -7
  435. package/dist/events/listeners.js.map +0 -1
  436. package/dist/shared-tree-core/transactionStack.d.ts +0 -29
  437. package/dist/shared-tree-core/transactionStack.d.ts.map +0 -1
  438. package/dist/shared-tree-core/transactionStack.js +0 -41
  439. package/dist/shared-tree-core/transactionStack.js.map +0 -1
  440. package/dist/util/transactionResult.d.ts +0 -19
  441. package/dist/util/transactionResult.d.ts.map +0 -1
  442. package/dist/util/transactionResult.js +0 -23
  443. package/dist/util/transactionResult.js.map +0 -1
  444. package/lib/events/emitter.d.ts +0 -139
  445. package/lib/events/emitter.d.ts.map +0 -1
  446. package/lib/events/emitter.js +0 -160
  447. package/lib/events/emitter.js.map +0 -1
  448. package/lib/events/index.d.ts +0 -7
  449. package/lib/events/index.d.ts.map +0 -1
  450. package/lib/events/index.js.map +0 -1
  451. package/lib/events/interop.d.ts +0 -30
  452. package/lib/events/interop.d.ts.map +0 -1
  453. package/lib/events/interop.js.map +0 -1
  454. package/lib/events/listeners.d.ts +0 -76
  455. package/lib/events/listeners.d.ts.map +0 -1
  456. package/lib/events/listeners.js +0 -6
  457. package/lib/events/listeners.js.map +0 -1
  458. package/lib/shared-tree-core/transactionStack.d.ts +0 -29
  459. package/lib/shared-tree-core/transactionStack.d.ts.map +0 -1
  460. package/lib/shared-tree-core/transactionStack.js +0 -37
  461. package/lib/shared-tree-core/transactionStack.js.map +0 -1
  462. package/lib/util/transactionResult.d.ts +0 -19
  463. package/lib/util/transactionResult.d.ts.map +0 -1
  464. package/lib/util/transactionResult.js +0 -20
  465. package/lib/util/transactionResult.js.map +0 -1
  466. package/src/events/README.md +0 -3
  467. package/src/events/emitter.ts +0 -256
  468. package/src/events/index.ts +0 -19
  469. package/src/events/interop.ts +0 -38
  470. package/src/events/listeners.ts +0 -80
  471. package/src/shared-tree-core/transactionStack.ts +0 -45
  472. package/src/util/transactionResult.ts +0 -19
@@ -2,46 +2,66 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
6
+ if (kind === "m") throw new TypeError("Private method is not writable");
7
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
8
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
9
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
10
+ };
11
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
14
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
+ };
16
+ var _TransactionEnricher_rebaser, _TransactionEnricher_enricher, _TransactionEnricher_transactionCommits, _TransactionEnricher_transactionScopesStart;
5
17
  import { assert } from "@fluidframework/core-utils/internal";
6
18
  /**
7
19
  * Utility for producing an enriched commit out of multiple transaction steps
8
20
  */
9
21
  export class TransactionEnricher {
10
22
  constructor(rebaser, enricher) {
11
- this.transactionCommits = [];
23
+ _TransactionEnricher_rebaser.set(this, void 0);
24
+ _TransactionEnricher_enricher.set(this, void 0);
25
+ _TransactionEnricher_transactionCommits.set(this, []);
12
26
  /**
13
27
  * The number of commits before the start of each active transaction scope.
14
28
  * For a stack of `n` transaction scopes, the array will contain `n` integers,
15
29
  * where the integer at index `i` is the number of commits made before the start of the `i`th transaction scope
16
30
  * (therefore, the first element in the array, if present, is always 0)
17
31
  */
18
- this.transactionScopesStart = [];
19
- this.rebaser = rebaser;
20
- this.enricher = enricher;
32
+ _TransactionEnricher_transactionScopesStart.set(this, []);
33
+ __classPrivateFieldSet(this, _TransactionEnricher_rebaser, rebaser, "f");
34
+ __classPrivateFieldSet(this, _TransactionEnricher_enricher, enricher, "f");
21
35
  }
22
- startNewTransaction() {
23
- this.transactionScopesStart.push(this.transactionCommits.length);
36
+ isTransacting() {
37
+ return __classPrivateFieldGet(this, _TransactionEnricher_transactionScopesStart, "f").length !== 0;
24
38
  }
25
- commitCurrentTransaction() {
26
- const commitsCommitted = this.transactionScopesStart.pop();
39
+ startTransaction() {
40
+ __classPrivateFieldGet(this, _TransactionEnricher_transactionScopesStart, "f").push(__classPrivateFieldGet(this, _TransactionEnricher_transactionCommits, "f").length);
41
+ }
42
+ /**
43
+ * Commits the current transaction.
44
+ * @returns If and only if the closed transaction was the outermost transaction, returns a function which can be used to compute the composed change for that transaction's commits.
45
+ */
46
+ commitTransaction() {
47
+ const commitsCommitted = __classPrivateFieldGet(this, _TransactionEnricher_transactionScopesStart, "f").pop();
27
48
  assert(commitsCommitted !== undefined, 0x985 /* No transaction to commit */);
49
+ if (__classPrivateFieldGet(this, _TransactionEnricher_transactionScopesStart, "f").length === 0) {
50
+ const transactionCommits = __classPrivateFieldGet(this, _TransactionEnricher_transactionCommits, "f");
51
+ __classPrivateFieldSet(this, _TransactionEnricher_transactionCommits, [], "f");
52
+ return (revision) => __classPrivateFieldGet(this, _TransactionEnricher_rebaser, "f").changeRevision(__classPrivateFieldGet(this, _TransactionEnricher_rebaser, "f").compose(transactionCommits), revision);
53
+ }
28
54
  }
29
- abortCurrentTransaction() {
30
- const scopeStart = this.transactionScopesStart.pop();
55
+ abortTransaction() {
56
+ const scopeStart = __classPrivateFieldGet(this, _TransactionEnricher_transactionScopesStart, "f").pop();
31
57
  assert(scopeStart !== undefined, 0x986 /* No transaction to abort */);
32
- this.transactionCommits.length = scopeStart;
58
+ __classPrivateFieldGet(this, _TransactionEnricher_transactionCommits, "f").length = scopeStart;
33
59
  }
34
60
  addTransactionStep(commit) {
35
- assert(this.transactionScopesStart.length !== 0, 0x987 /* No transaction to add a step to */);
36
- const change = this.enricher.updateChangeEnrichments(commit.change, commit.revision);
37
- this.transactionCommits.push({ ...commit, change });
38
- }
39
- getComposedChange(revision) {
40
- assert(this.transactionScopesStart.length === 0, 0x988 /* Transaction not committed */);
41
- const squashed = this.rebaser.compose(this.transactionCommits);
42
- const tagged = this.rebaser.changeRevision(squashed, revision);
43
- this.transactionCommits.length = 0;
44
- return tagged;
61
+ assert(__classPrivateFieldGet(this, _TransactionEnricher_transactionScopesStart, "f").length !== 0, 0x987 /* No transaction to add a step to */);
62
+ const change = __classPrivateFieldGet(this, _TransactionEnricher_enricher, "f").updateChangeEnrichments(commit.change, commit.revision);
63
+ __classPrivateFieldGet(this, _TransactionEnricher_transactionCommits, "f").push({ ...commit, change });
45
64
  }
46
65
  }
66
+ _TransactionEnricher_rebaser = new WeakMap(), _TransactionEnricher_enricher = new WeakMap(), _TransactionEnricher_transactionCommits = new WeakMap(), _TransactionEnricher_transactionScopesStart = new WeakMap();
47
67
  //# sourceMappingURL=transactionEnricher.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transactionEnricher.js","sourceRoot":"","sources":["../../src/shared-tree-core/transactionEnricher.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAI7D;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAY/B,YACC,OAA+B,EAC/B,QAAiD;QAXjC,uBAAkB,GAA2B,EAAE,CAAC;QACjE;;;;;WAKG;QACc,2BAAsB,GAAa,EAAE,CAAC;QAMtD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC1B,CAAC;IAEM,mBAAmB;QACzB,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAClE,CAAC;IAEM,wBAAwB;QAC9B,MAAM,gBAAgB,GAAG,IAAI,CAAC,sBAAsB,CAAC,GAAG,EAAE,CAAC;QAC3D,MAAM,CAAC,gBAAgB,KAAK,SAAS,EAAE,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAC9E,CAAC;IAEM,uBAAuB;QAC7B,MAAM,UAAU,GAAG,IAAI,CAAC,sBAAsB,CAAC,GAAG,EAAE,CAAC;QACrD,MAAM,CAAC,UAAU,KAAK,SAAS,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACtE,IAAI,CAAC,kBAAkB,CAAC,MAAM,GAAG,UAAU,CAAC;IAC7C,CAAC;IAEM,kBAAkB,CAAC,MAA4B;QACrD,MAAM,CACL,IAAI,CAAC,sBAAsB,CAAC,MAAM,KAAK,CAAC,EACxC,KAAK,CAAC,qCAAqC,CAC3C,CAAC;QACF,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QACrF,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACrD,CAAC;IAEM,iBAAiB,CAAC,QAAqB;QAC7C,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,MAAM,KAAK,CAAC,EAAE,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACxF,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC/D,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC/D,IAAI,CAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC,CAAC;QACnC,OAAO,MAAM,CAAC;IACf,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { ChangeRebaser, GraphCommit, RevisionTag } from \"../core/index.js\";\nimport type { ChangeEnricherReadonlyCheckout } from \"./changeEnricher.js\";\n\n/**\n * Utility for producing an enriched commit out of multiple transaction steps\n */\nexport class TransactionEnricher<TChange> {\n\tprivate readonly rebaser: ChangeRebaser<TChange>;\n\tprivate readonly enricher: ChangeEnricherReadonlyCheckout<TChange>;\n\tprivate readonly transactionCommits: GraphCommit<TChange>[] = [];\n\t/**\n\t * The number of commits before the start of each active transaction scope.\n\t * For a stack of `n` transaction scopes, the array will contain `n` integers,\n\t * where the integer at index `i` is the number of commits made before the start of the `i`th transaction scope\n\t * (therefore, the first element in the array, if present, is always 0)\n\t */\n\tprivate readonly transactionScopesStart: number[] = [];\n\n\tpublic constructor(\n\t\trebaser: ChangeRebaser<TChange>,\n\t\tenricher: ChangeEnricherReadonlyCheckout<TChange>,\n\t) {\n\t\tthis.rebaser = rebaser;\n\t\tthis.enricher = enricher;\n\t}\n\n\tpublic startNewTransaction(): void {\n\t\tthis.transactionScopesStart.push(this.transactionCommits.length);\n\t}\n\n\tpublic commitCurrentTransaction(): void {\n\t\tconst commitsCommitted = this.transactionScopesStart.pop();\n\t\tassert(commitsCommitted !== undefined, 0x985 /* No transaction to commit */);\n\t}\n\n\tpublic abortCurrentTransaction(): void {\n\t\tconst scopeStart = this.transactionScopesStart.pop();\n\t\tassert(scopeStart !== undefined, 0x986 /* No transaction to abort */);\n\t\tthis.transactionCommits.length = scopeStart;\n\t}\n\n\tpublic addTransactionStep(commit: GraphCommit<TChange>): void {\n\t\tassert(\n\t\t\tthis.transactionScopesStart.length !== 0,\n\t\t\t0x987 /* No transaction to add a step to */,\n\t\t);\n\t\tconst change = this.enricher.updateChangeEnrichments(commit.change, commit.revision);\n\t\tthis.transactionCommits.push({ ...commit, change });\n\t}\n\n\tpublic getComposedChange(revision: RevisionTag): TChange {\n\t\tassert(this.transactionScopesStart.length === 0, 0x988 /* Transaction not committed */);\n\t\tconst squashed = this.rebaser.compose(this.transactionCommits);\n\t\tconst tagged = this.rebaser.changeRevision(squashed, revision);\n\t\tthis.transactionCommits.length = 0;\n\t\treturn tagged;\n\t}\n}\n"]}
1
+ {"version":3,"file":"transactionEnricher.js","sourceRoot":"","sources":["../../src/shared-tree-core/transactionEnricher.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAI7D;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAY/B,YACC,OAA+B,EAC/B,QAAiD;QAbzC,+CAAiC;QACjC,gDAAmD;QAC5D,kDAA8C,EAAE,EAAC;QACjD;;;;;WAKG;QACM,sDAAoC,EAAE,EAAC;QAM/C,uBAAA,IAAI,gCAAY,OAA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AC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QACtF,uBAAA,IAAI,+CAAoB,CAAC,IAAI,CAAC,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACtD,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { ChangeRebaser, GraphCommit, RevisionTag } from \"../core/index.js\";\nimport type { ChangeEnricherReadonlyCheckout } from \"./changeEnricher.js\";\n\n/**\n * Utility for producing an enriched commit out of multiple transaction steps\n */\nexport class TransactionEnricher<TChange> {\n\treadonly #rebaser: ChangeRebaser<TChange>;\n\treadonly #enricher: ChangeEnricherReadonlyCheckout<TChange>;\n\t#transactionCommits: GraphCommit<TChange>[] = [];\n\t/**\n\t * The number of commits before the start of each active transaction scope.\n\t * For a stack of `n` transaction scopes, the array will contain `n` integers,\n\t * where the integer at index `i` is the number of commits made before the start of the `i`th transaction scope\n\t * (therefore, the first element in the array, if present, is always 0)\n\t */\n\treadonly #transactionScopesStart: number[] = [];\n\n\tpublic constructor(\n\t\trebaser: ChangeRebaser<TChange>,\n\t\tenricher: ChangeEnricherReadonlyCheckout<TChange>,\n\t) {\n\t\tthis.#rebaser = rebaser;\n\t\tthis.#enricher = enricher;\n\t}\n\n\tpublic isTransacting(): boolean {\n\t\treturn this.#transactionScopesStart.length !== 0;\n\t}\n\n\tpublic startTransaction(): void {\n\t\tthis.#transactionScopesStart.push(this.#transactionCommits.length);\n\t}\n\n\t/**\n\t * Commits the current transaction.\n\t * @returns If and only if the closed transaction was the outermost transaction, returns a function which can be used to compute the composed change for that transaction's commits.\n\t */\n\tpublic commitTransaction(): ((revision: RevisionTag) => TChange) | undefined {\n\t\tconst commitsCommitted = this.#transactionScopesStart.pop();\n\t\tassert(commitsCommitted !== undefined, 0x985 /* No transaction to commit */);\n\t\tif (this.#transactionScopesStart.length === 0) {\n\t\t\tconst transactionCommits = this.#transactionCommits;\n\t\t\tthis.#transactionCommits = [];\n\t\t\treturn (revision: RevisionTag) =>\n\t\t\t\tthis.#rebaser.changeRevision(this.#rebaser.compose(transactionCommits), revision);\n\t\t}\n\t}\n\n\tpublic abortTransaction(): void {\n\t\tconst scopeStart = this.#transactionScopesStart.pop();\n\t\tassert(scopeStart !== undefined, 0x986 /* No transaction to abort */);\n\t\tthis.#transactionCommits.length = scopeStart;\n\t}\n\n\tpublic addTransactionStep(commit: GraphCommit<TChange>): void {\n\t\tassert(\n\t\t\tthis.#transactionScopesStart.length !== 0,\n\t\t\t0x987 /* No transaction to add a step to */,\n\t\t);\n\t\tconst change = this.#enricher.updateChangeEnrichments(commit.change, commit.revision);\n\t\tthis.#transactionCommits.push({ ...commit, change });\n\t}\n}\n"]}
@@ -0,0 +1,21 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { type ImplicitFieldSchema } from "../schemaTypes.js";
6
+ import type { TreeNode } from "../core/index.js";
7
+ import type { TreeView } from "./tree.js";
8
+ import { type SimpleTreeIndex } from "./simpleTreeIndex.js";
9
+ /**
10
+ * An index that returns tree nodes given their associated identifiers.
11
+ *
12
+ * @alpha
13
+ */
14
+ export type IdentifierIndex = SimpleTreeIndex<string, TreeNode>;
15
+ /**
16
+ * Creates an {@link IdentifierIndex} for a given {@link TreeView}.
17
+ *
18
+ * @alpha
19
+ */
20
+ export declare function createIdentifierIndex<TSchema extends ImplicitFieldSchema>(view: TreeView<TSchema>): IdentifierIndex;
21
+ //# sourceMappingURL=identifierIndex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identifierIndex.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/identifierIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAa,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEnF;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,eAAe,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAMhE;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,SAAS,mBAAmB,EACxE,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,GACrB,eAAe,CA+BjB"}
@@ -0,0 +1,41 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { UsageError } from "@fluidframework/telemetry-utils/internal";
6
+ import { FieldKind } from "../schemaTypes.js";
7
+ import { ObjectNodeSchema } from "../objectNodeTypes.js";
8
+ import { walkFieldSchema } from "../walkFieldSchema.js";
9
+ import { createSimpleTreeIndex } from "./simpleTreeIndex.js";
10
+ function isStringKey(key) {
11
+ return typeof key === "string";
12
+ }
13
+ /**
14
+ * Creates an {@link IdentifierIndex} for a given {@link TreeView}.
15
+ *
16
+ * @alpha
17
+ */
18
+ export function createIdentifierIndex(view) {
19
+ // For each node schema, find which field key the identifier field is under.
20
+ // This can be done easily because identifiers are their own field kinds.
21
+ const identifierFields = new Map();
22
+ walkFieldSchema(view.schema, {
23
+ node: (schemus) => {
24
+ if (schemus instanceof ObjectNodeSchema) {
25
+ for (const [fieldKey, fieldSchema] of schemus.fields.entries()) {
26
+ if (fieldSchema.kind === FieldKind.Identifier) {
27
+ identifierFields.set(schemus.identifier, fieldKey);
28
+ break;
29
+ }
30
+ }
31
+ }
32
+ },
33
+ });
34
+ return createSimpleTreeIndex(view, (schemus) => identifierFields.get(schemus.identifier), (nodes) => {
35
+ if (nodes.length > 1) {
36
+ throw new UsageError("cannot retrieve node from index: there are multiple nodes with the same identifier");
37
+ }
38
+ return nodes[0];
39
+ }, isStringKey);
40
+ }
41
+ //# sourceMappingURL=identifierIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identifierIndex.js","sourceRoot":"","sources":["../../../src/simple-tree/api/identifierIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAAE,SAAS,EAA4B,MAAM,mBAAmB,CAAC;AAExE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAwB,MAAM,sBAAsB,CAAC;AASnF,SAAS,WAAW,CAAC,GAAiB;IACrC,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC;AAChC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACpC,IAAuB;IAEvB,4EAA4E;IAC5E,yEAAyE;IACzE,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAkB,CAAC;IACnD,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE;QAC5B,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE;YACjB,IAAI,OAAO,YAAY,gBAAgB,EAAE,CAAC;gBACzC,KAAK,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;oBAChE,IAAI,WAAW,CAAC,IAAI,KAAK,SAAS,CAAC,UAAU,EAAE,CAAC;wBAC/C,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;wBACnD,MAAM;oBACP,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;KACD,CAAC,CAAC;IAEH,OAAO,qBAAqB,CAC3B,IAAI,EACJ,CAAC,OAAO,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,EACrD,CAAC,KAAK,EAAE,EAAE;QACT,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,UAAU,CACnB,oFAAoF,CACpF,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC,EACD,WAAW,CACX,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport type { TreeIndexKey } from \"../../feature-libraries/index.js\";\nimport { FieldKind, type ImplicitFieldSchema } from \"../schemaTypes.js\";\nimport type { TreeNode } from \"../core/index.js\";\nimport { ObjectNodeSchema } from \"../objectNodeTypes.js\";\nimport type { TreeView } from \"./tree.js\";\nimport { walkFieldSchema } from \"../walkFieldSchema.js\";\nimport { createSimpleTreeIndex, type SimpleTreeIndex } from \"./simpleTreeIndex.js\";\n\n/**\n * An index that returns tree nodes given their associated identifiers.\n *\n * @alpha\n */\nexport type IdentifierIndex = SimpleTreeIndex<string, TreeNode>;\n\nfunction isStringKey(key: TreeIndexKey): key is string {\n\treturn typeof key === \"string\";\n}\n\n/**\n * Creates an {@link IdentifierIndex} for a given {@link TreeView}.\n *\n * @alpha\n */\nexport function createIdentifierIndex<TSchema extends ImplicitFieldSchema>(\n\tview: TreeView<TSchema>,\n): IdentifierIndex {\n\t// For each node schema, find which field key the identifier field is under.\n\t// This can be done easily because identifiers are their own field kinds.\n\tconst identifierFields = new Map<string, string>();\n\twalkFieldSchema(view.schema, {\n\t\tnode: (schemus) => {\n\t\t\tif (schemus instanceof ObjectNodeSchema) {\n\t\t\t\tfor (const [fieldKey, fieldSchema] of schemus.fields.entries()) {\n\t\t\t\t\tif (fieldSchema.kind === FieldKind.Identifier) {\n\t\t\t\t\t\tidentifierFields.set(schemus.identifier, fieldKey);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t});\n\n\treturn createSimpleTreeIndex(\n\t\tview,\n\t\t(schemus) => identifierFields.get(schemus.identifier),\n\t\t(nodes) => {\n\t\t\tif (nodes.length > 1) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"cannot retrieve node from index: there are multiple nodes with the same identifier\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn nodes[0];\n\t\t},\n\t\tisStringKey,\n\t);\n}\n"]}
@@ -18,6 +18,8 @@ export { type VerboseTreeNode, type ParseOptions, type VerboseTree, applySchemaT
18
18
  export type { EncodeOptions } from "./customTree.js";
19
19
  export { type ConciseTree, conciseFromCursor } from "./conciseTree.js";
20
20
  export { TreeBeta, type NodeChangedData, type TreeChangeEventsBeta } from "./treeApiBeta.js";
21
+ export { createSimpleTreeIndex, type SimpleTreeIndex } from "./simpleTreeIndex.js";
22
+ export { createIdentifierIndex, type IdentifierIndex, } from "./identifierIndex.js";
21
23
  export { extractPersistedSchema, comparePersistedSchemaInternal, comparePersistedSchema, } from "./storedSchema.js";
22
24
  export { RecursiveObject as test_RecursiveObject, base as test_RecursiveObject_base, RecursiveObjectPojoMode as test_RecursiveObjectPojoMode, } from "./testRecursiveDomain.js";
23
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,KAAK,EACV,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,qBAAqB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,eAAe,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,aAAa,EAAE,KAAK,gBAAgB,EAAE,M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BAAkB,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,qBAAqB,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EACN,qBAAqB,EACrB,KAAK,eAAe,GACpB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACN,sBAAsB,EACtB,8BAA8B,EAC9B,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EACN,eAAe,IAAI,oBAAoB,EACvC,IAAI,IAAI,yBAAyB,EACjC,uBAAuB,IAAI,4BAA4B,GACvD,MAAM,0BAA0B,CAAC"}
@@ -13,6 +13,8 @@ export { ViewSchema } from "./view.js";
13
13
  export { applySchemaToParserOptions, cursorFromVerbose, verboseFromCursor, } from "./verboseTree.js";
14
14
  export { conciseFromCursor } from "./conciseTree.js";
15
15
  export { TreeBeta } from "./treeApiBeta.js";
16
+ export { createSimpleTreeIndex } from "./simpleTreeIndex.js";
17
+ export { createIdentifierIndex, } from "./identifierIndex.js";
16
18
  export { extractPersistedSchema, comparePersistedSchemaInternal, comparePersistedSchema, } from "./storedSchema.js";
17
19
  // Exporting the schema (RecursiveObject) to test that recursive types are working correctly.
18
20
  // These are `@internal` so they can't be included in the `InternalClassTreeTypes` due to https://github.com/microsoft/rushstack/issues/3639
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/simple-tree/api/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAKN,qBAAqB,EAOrB,eAAe,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,aAAa,EAAyB,MAAM,oBAAoB,CAAC;AAK1E,OAAO,EACN,SAAS,EACT,eAAe,EACf,eAAe,GACf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,WAAW,EAAoB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AA0B3F,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAyBvC,OAAO,EAIN,0BAA0B,EAC1B,iBAAiB,EACjB,iBAAiB,GACjB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EAAoB,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAmD,MAAM,kBAAkB,CAAC;AAE7F,OAAO,EACN,sBAAsB,EACtB,8BAA8B,EAC9B,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,6FAA6F;AAC7F,4IAA4I;AAC5I,OAAO,EACN,eAAe,IAAI,oBAAoB,EACvC,IAAI,IAAI,yBAAyB,EACjC,uBAAuB,IAAI,4BAA4B,GACvD,MAAM,0BAA0B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype ITree,\n\ttype TreeView,\n\ttype ViewableTree,\n\ttype TreeViewEvents,\n\tTreeViewConfiguration,\n\ttype ITreeViewConfiguration,\n\ttype SchemaCompatibilityStatus,\n\ttype ITreeConfigurationOptions,\n\ttype TreeViewAlpha,\n\ttype TreeBranch,\n\ttype TreeBranchEvents,\n\tasTreeViewAlpha,\n} from \"./tree.js\";\nexport { SchemaFactory, type ScopedSchemaName } from \"./schemaFactory.js\";\nexport type {\n\tValidateRecursiveSchema,\n\tFixRecursiveArraySchema,\n} from \"./schemaFactoryRecursive.js\";\nexport {\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n} from \"./schemaCreationUtilities.js\";\nexport { treeNodeApi, type TreeNodeApi, tryGetSchema } from \"./treeNodeApi.js\";\nexport { createFromInsertable, cursorFromInsertable, createFromCursor } from \"./create.js\";\nexport type {\n\tSimpleTreeSchema,\n\tSimpleNodeSchema,\n\tSimpleFieldSchema,\n\tSimpleLeafNodeSchema,\n\tSimpleMapNodeSchema,\n\tSimpleArrayNodeSchema,\n\tSimpleObjectNodeSchema,\n\tSimpleNodeSchemaBase,\n} from \"./simpleSchema.js\";\nexport {\n\ttype JsonSchemaId,\n\ttype JsonSchemaType,\n\ttype JsonObjectNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonLeafNodeSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonTreeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonLeafSchemaType,\n} from \"./jsonSchema.js\";\nexport { getJsonSchema } from \"./getJsonSchema.js\";\nexport { getSimpleSchema } from \"./getSimpleSchema.js\";\nexport { ViewSchema } from \"./view.js\";\nexport type {\n\tUnenforced,\n\tFieldHasDefaultUnsafe,\n\tObjectFromSchemaRecordUnsafe,\n\tTreeObjectNodeUnsafe,\n\tTreeFieldFromImplicitFieldUnsafe,\n\tTreeNodeFromImplicitAllowedTypesUnsafe,\n\tFieldSchemaUnsafe,\n\tInsertableTreeNodeFromImplicitAllowedTypesUnsafe,\n\tTreeArrayNodeUnsafe,\n\tTreeMapNodeUnsafe,\n\tInsertableObjectFromSchemaRecordUnsafe,\n\tInsertableTreeFieldFromImplicitFieldUnsafe,\n\tInsertableTypedNodeUnsafe,\n\tNodeBuilderDataUnsafe,\n\tNodeFromSchemaUnsafe,\n\tReadonlyMapInlined,\n\tTreeNodeSchemaClassUnsafe,\n\tTreeNodeSchemaUnsafe,\n\tAllowedTypesUnsafe,\n\tTreeNodeSchemaNonClassUnsafe,\n\tInsertableTreeNodeFromAllowedTypesUnsafe,\n} from \"./typesUnsafe.js\";\n\nexport {\n\ttype VerboseTreeNode,\n\ttype ParseOptions,\n\ttype VerboseTree,\n\tapplySchemaToParserOptions,\n\tcursorFromVerbose,\n\tverboseFromCursor,\n} from \"./verboseTree.js\";\n\nexport type { EncodeOptions } from \"./customTree.js\";\n\nexport { type ConciseTree, conciseFromCursor } from \"./conciseTree.js\";\n\nexport { TreeBeta, type NodeChangedData, type TreeChangeEventsBeta } from \"./treeApiBeta.js\";\n\nexport {\n\textractPersistedSchema,\n\tcomparePersistedSchemaInternal,\n\tcomparePersistedSchema,\n} from \"./storedSchema.js\";\n\n// Exporting the schema (RecursiveObject) to test that recursive types are working correctly.\n// These are `@internal` so they can't be included in the `InternalClassTreeTypes` due to https://github.com/microsoft/rushstack/issues/3639\nexport {\n\tRecursiveObject as test_RecursiveObject,\n\tbase as test_RecursiveObject_base,\n\tRecursiveObjectPojoMode as test_RecursiveObjectPojoMode,\n} from \"./testRecursiveDomain.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/simple-tree/api/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAKN,qBAAqB,EAOrB,eAAe,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,aAAa,EAAyB,MAAM,oBAAoB,CAAC;AAK1E,OAAO,EACN,SAAS,EACT,eAAe,EACf,eAAe,GACf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,WAAW,EAAoB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AA0B3F,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAyBvC,OAAO,EAIN,0BAA0B,EAC1B,iBAAiB,EACjB,iBAAiB,GACjB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EAAoB,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAmD,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,qBAAqB,EAAwB,MAAM,sBAAsB,CAAC;AACnF,OAAO,EACN,qBAAqB,GAErB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACN,sBAAsB,EACtB,8BAA8B,EAC9B,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,6FAA6F;AAC7F,4IAA4I;AAC5I,OAAO,EACN,eAAe,IAAI,oBAAoB,EACvC,IAAI,IAAI,yBAAyB,EACjC,uBAAuB,IAAI,4BAA4B,GACvD,MAAM,0BAA0B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype ITree,\n\ttype TreeView,\n\ttype ViewableTree,\n\ttype TreeViewEvents,\n\tTreeViewConfiguration,\n\ttype ITreeViewConfiguration,\n\ttype SchemaCompatibilityStatus,\n\ttype ITreeConfigurationOptions,\n\ttype TreeViewAlpha,\n\ttype TreeBranch,\n\ttype TreeBranchEvents,\n\tasTreeViewAlpha,\n} from \"./tree.js\";\nexport { SchemaFactory, type ScopedSchemaName } from \"./schemaFactory.js\";\nexport type {\n\tValidateRecursiveSchema,\n\tFixRecursiveArraySchema,\n} from \"./schemaFactoryRecursive.js\";\nexport {\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n} from \"./schemaCreationUtilities.js\";\nexport { treeNodeApi, type TreeNodeApi, tryGetSchema } from \"./treeNodeApi.js\";\nexport { createFromInsertable, cursorFromInsertable, createFromCursor } from \"./create.js\";\nexport type {\n\tSimpleTreeSchema,\n\tSimpleNodeSchema,\n\tSimpleFieldSchema,\n\tSimpleLeafNodeSchema,\n\tSimpleMapNodeSchema,\n\tSimpleArrayNodeSchema,\n\tSimpleObjectNodeSchema,\n\tSimpleNodeSchemaBase,\n} from \"./simpleSchema.js\";\nexport {\n\ttype JsonSchemaId,\n\ttype JsonSchemaType,\n\ttype JsonObjectNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonLeafNodeSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonTreeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonLeafSchemaType,\n} from \"./jsonSchema.js\";\nexport { getJsonSchema } from \"./getJsonSchema.js\";\nexport { getSimpleSchema } from \"./getSimpleSchema.js\";\nexport { ViewSchema } from \"./view.js\";\nexport type {\n\tUnenforced,\n\tFieldHasDefaultUnsafe,\n\tObjectFromSchemaRecordUnsafe,\n\tTreeObjectNodeUnsafe,\n\tTreeFieldFromImplicitFieldUnsafe,\n\tTreeNodeFromImplicitAllowedTypesUnsafe,\n\tFieldSchemaUnsafe,\n\tInsertableTreeNodeFromImplicitAllowedTypesUnsafe,\n\tTreeArrayNodeUnsafe,\n\tTreeMapNodeUnsafe,\n\tInsertableObjectFromSchemaRecordUnsafe,\n\tInsertableTreeFieldFromImplicitFieldUnsafe,\n\tInsertableTypedNodeUnsafe,\n\tNodeBuilderDataUnsafe,\n\tNodeFromSchemaUnsafe,\n\tReadonlyMapInlined,\n\tTreeNodeSchemaClassUnsafe,\n\tTreeNodeSchemaUnsafe,\n\tAllowedTypesUnsafe,\n\tTreeNodeSchemaNonClassUnsafe,\n\tInsertableTreeNodeFromAllowedTypesUnsafe,\n} from \"./typesUnsafe.js\";\n\nexport {\n\ttype VerboseTreeNode,\n\ttype ParseOptions,\n\ttype VerboseTree,\n\tapplySchemaToParserOptions,\n\tcursorFromVerbose,\n\tverboseFromCursor,\n} from \"./verboseTree.js\";\n\nexport type { EncodeOptions } from \"./customTree.js\";\n\nexport { type ConciseTree, conciseFromCursor } from \"./conciseTree.js\";\n\nexport { TreeBeta, type NodeChangedData, type TreeChangeEventsBeta } from \"./treeApiBeta.js\";\nexport { createSimpleTreeIndex, type SimpleTreeIndex } from \"./simpleTreeIndex.js\";\nexport {\n\tcreateIdentifierIndex,\n\ttype IdentifierIndex,\n} from \"./identifierIndex.js\";\n\nexport {\n\textractPersistedSchema,\n\tcomparePersistedSchemaInternal,\n\tcomparePersistedSchema,\n} from \"./storedSchema.js\";\n\n// Exporting the schema (RecursiveObject) to test that recursive types are working correctly.\n// These are `@internal` so they can't be included in the `InternalClassTreeTypes` due to https://github.com/microsoft/rushstack/issues/3639\nexport {\n\tRecursiveObject as test_RecursiveObject,\n\tbase as test_RecursiveObject_base,\n\tRecursiveObjectPojoMode as test_RecursiveObjectPojoMode,\n} from \"./testRecursiveDomain.js\";\n"]}
@@ -2,10 +2,10 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { oob, unreachableCase } from "@fluidframework/core-utils/internal";
5
+ import { unreachableCase } from "@fluidframework/core-utils/internal";
6
6
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
7
7
  import { ValueSchema } from "../../core/index.js";
8
- import { getOrCreate } from "../../util/index.js";
8
+ import { getOrCreate, hasSingle } from "../../util/index.js";
9
9
  import { FieldKind } from "../schemaTypes.js";
10
10
  import { NodeKind } from "../core/index.js";
11
11
  /**
@@ -18,9 +18,9 @@ export function toJsonSchema(schema) {
18
18
  for (const allowedType of schema.allowedTypes) {
19
19
  allowedTypes.push(createSchemaRef(allowedType));
20
20
  }
21
- return allowedTypes.length === 1
21
+ return hasSingle(allowedTypes)
22
22
  ? {
23
- ...(allowedTypes[0] ?? oob()),
23
+ ...allowedTypes[0],
24
24
  $defs: definitions,
25
25
  }
26
26
  : {
@@ -65,7 +65,9 @@ function convertArrayNodeSchema(schema) {
65
65
  schema.allowedTypes.forEach((type) => {
66
66
  allowedTypes.push(createSchemaRef(type));
67
67
  });
68
- const items = allowedTypes.length === 1 ? (allowedTypes[0] ?? oob()) : { anyOf: allowedTypes };
68
+ const items = hasSingle(allowedTypes)
69
+ ? allowedTypes[0]
70
+ : { anyOf: allowedTypes };
69
71
  return {
70
72
  type: "array",
71
73
  _treeNodeSchemaKind: NodeKind.Array,
@@ -105,8 +107,8 @@ function convertObjectNodeSchema(schema) {
105
107
  for (const allowedType of value.allowedTypes) {
106
108
  allowedTypes.push(createSchemaRef(allowedType));
107
109
  }
108
- const output = allowedTypes.length === 1
109
- ? (allowedTypes[0] ?? oob())
110
+ const output = hasSingle(allowedTypes)
111
+ ? allowedTypes[0]
110
112
  : {
111
113
  anyOf: allowedTypes,
112
114
  };
@@ -136,8 +138,8 @@ function convertMapNodeSchema(schema) {
136
138
  type: "object",
137
139
  _treeNodeSchemaKind: NodeKind.Map,
138
140
  patternProperties: {
139
- "^.*$": allowedTypes.length === 1
140
- ? (allowedTypes[0] ?? oob())
141
+ "^.*$": hasSingle(allowedTypes)
142
+ ? allowedTypes[0]
141
143
  : {
142
144
  anyOf: allowedTypes,
143
145
  },
@@ -1 +1 @@
1
- {"version":3,"file":"simpleSchemaToJsonSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/simpleSchemaToJsonSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAgB,MAAM,qBAAqB,CAAC;AAahE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAS9C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,MAAwB;IACpD,MAAM,WAAW,GAAG,kBAAkB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAE3D,MAAM,YAAY,GAAoB,EAAE,CAAC;IACzC,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,YAAY,EAA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;QACN,IAAI,EAAE,QAAQ;QACd,mBAAmB,EAAE,QAAQ,CAAC,GAAG;QACjC,iBAAiB,EAAE;YAClB,MAAM,EACL,YAAY,CAAC,MAAM,KAAK,CAAC;gBACxB,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;gBAC5B,CAAC,CAAC;oBACA,KAAK,EAAE,YAAY;iBACnB;SACJ;KACD,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,QAAgB;IACxC,OAAO;QACN,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC;KAC/B,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,QAAgB;IACtC,OAAO,WAAW,QAAQ,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { oob, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { ValueSchema } from \"../../core/index.js\";\nimport { getOrCreate, type Mutable } from \"../../util/index.js\";\nimport type {\n\tJsonArrayNodeSchema,\n\tJsonFieldSchema,\n\tJsonSchemaRef,\n\tJsonRefPath,\n\tJsonLeafNodeSchema,\n\tJsonMapNodeSchema,\n\tJsonNodeSchema,\n\tJsonObjectNodeSchema,\n\tJsonTreeSchema,\n\tJsonLeafSchemaType,\n} from \"./jsonSchema.js\";\nimport { FieldKind } from \"../schemaTypes.js\";\nimport type {\n\tSimpleArrayNodeSchema,\n\tSimpleLeafNodeSchema,\n\tSimpleMapNodeSchema,\n\tSimpleNodeSchema,\n\tSimpleObjectNodeSchema,\n\tSimpleTreeSchema,\n} from \"./simpleSchema.js\";\nimport { NodeKind } from \"../core/index.js\";\n\n/**\n * Generates a JSON Schema representation from a simple tree schema.\n * @internal\n */\nexport function toJsonSchema(schema: SimpleTreeSchema): JsonTreeSchema {\n\tconst definitions = convertDefinitions(schema.definitions);\n\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tfor (const allowedType of schema.allowedTypes) {\n\t\tallowedTypes.push(createSchemaRef(allowedType));\n\t}\n\n\treturn allowedTypes.length === 1\n\t\t? {\n\t\t\t\t...(allowedTypes[0] ?? oob()),\n\t\t\t\t$defs: definitions,\n\t\t\t}\n\t\t: {\n\t\t\t\t$defs: definitions,\n\t\t\t\tanyOf: allowedTypes,\n\t\t\t};\n}\n\nfunction convertDefinitions(\n\tdefinitions: ReadonlyMap<string, SimpleNodeSchema>,\n): Record<string, JsonNodeSchema> {\n\tconst result: Record<string, JsonNodeSchema> = {};\n\tfor (const [key, value] of definitions) {\n\t\tresult[key] = convertNodeSchema(value);\n\t}\n\treturn result;\n}\n\n/**\n * Private symbol under which the results of {@link convertNodeSchema} are cached on an input {@link SimpleNodeSchema}.\n */\nconst nodeJsonSchemaCache = new WeakMap<SimpleNodeSchema, JsonNodeSchema>();\n\n/**\n * Converts an input {@link SimpleNodeSchema} to a {@link JsonNodeSchema}.\n *\n * @remarks Caches the result on the input schema for future calls.\n */\nfunction convertNodeSchema(schema: SimpleNodeSchema): JsonNodeSchema {\n\treturn getOrCreate(nodeJsonSchemaCache, schema, () => {\n\t\tswitch (schema.kind) {\n\t\t\tcase NodeKind.Array:\n\t\t\t\treturn convertArrayNodeSchema(schema);\n\t\t\tcase NodeKind.Leaf:\n\t\t\t\treturn convertLeafNodeSchema(schema);\n\t\t\tcase NodeKind.Map:\n\t\t\t\treturn convertMapNodeSchema(schema);\n\t\t\tcase NodeKind.Object:\n\t\t\t\treturn convertObjectNodeSchema(schema);\n\t\t\tdefault:\n\t\t\t\tthrow new TypeError(`Unknown node schema kind: ${(schema as SimpleNodeSchema).kind}`);\n\t\t}\n\t});\n}\n\nfunction convertArrayNodeSchema(schema: SimpleArrayNodeSchema): JsonArrayNodeSchema {\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tschema.allowedTypes.forEach((type) => {\n\t\tallowedTypes.push(createSchemaRef(type));\n\t});\n\n\tconst items: JsonFieldSchema =\n\t\tallowedTypes.length === 1 ? (allowedTypes[0] ?? oob()) : { anyOf: allowedTypes };\n\n\treturn {\n\t\ttype: \"array\",\n\t\t_treeNodeSchemaKind: NodeKind.Array,\n\t\titems,\n\t};\n}\n\nfunction convertLeafNodeSchema(schema: SimpleLeafNodeSchema): JsonLeafNodeSchema {\n\tlet type: JsonLeafSchemaType;\n\tswitch (schema.leafKind) {\n\t\tcase ValueSchema.String:\n\t\t\ttype = \"string\";\n\t\t\tbreak;\n\t\tcase ValueSchema.Number:\n\t\t\ttype = \"number\";\n\t\t\tbreak;\n\t\tcase ValueSchema.Boolean:\n\t\t\ttype = \"boolean\";\n\t\t\tbreak;\n\t\tcase ValueSchema.Null:\n\t\t\ttype = \"null\";\n\t\t\tbreak;\n\t\tcase ValueSchema.FluidHandle:\n\t\t\tthrow new UsageError(\"Fluid handles are not supported via JSON Schema.\");\n\t\tdefault:\n\t\t\tunreachableCase(schema.leafKind);\n\t}\n\n\treturn {\n\t\ttype,\n\t\t_treeNodeSchemaKind: NodeKind.Leaf,\n\t};\n}\n\nfunction convertObjectNodeSchema(schema: SimpleObjectNodeSchema): JsonObjectNodeSchema {\n\tconst properties: Record<string, JsonFieldSchema> = {};\n\tconst required: string[] = [];\n\tfor (const [key, value] of Object.entries(schema.fields)) {\n\t\tconst allowedTypes: JsonSchemaRef[] = [];\n\t\tfor (const allowedType of value.allowedTypes) {\n\t\t\tallowedTypes.push(createSchemaRef(allowedType));\n\t\t}\n\n\t\tconst output: Mutable<JsonFieldSchema> =\n\t\t\tallowedTypes.length === 1\n\t\t\t\t? (allowedTypes[0] ?? oob())\n\t\t\t\t: {\n\t\t\t\t\t\tanyOf: allowedTypes,\n\t\t\t\t\t};\n\n\t\t// Don't include \"description\" property at all if it's not present in the input.\n\t\tif (value.metadata?.description !== undefined) {\n\t\t\toutput.description = value.metadata.description;\n\t\t}\n\n\t\tproperties[key] = output;\n\n\t\tif (value.kind === FieldKind.Required) {\n\t\t\trequired.push(key);\n\t\t}\n\t}\n\treturn {\n\t\ttype: \"object\",\n\t\t_treeNodeSchemaKind: NodeKind.Object,\n\t\tproperties,\n\t\trequired,\n\t\tadditionalProperties: false,\n\t};\n}\n\nfunction convertMapNodeSchema(schema: SimpleMapNodeSchema): JsonMapNodeSchema {\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tschema.allowedTypes.forEach((type) => {\n\t\tallowedTypes.push(createSchemaRef(type));\n\t});\n\treturn {\n\t\ttype: \"object\",\n\t\t_treeNodeSchemaKind: NodeKind.Map,\n\t\tpatternProperties: {\n\t\t\t\"^.*$\":\n\t\t\t\tallowedTypes.length === 1\n\t\t\t\t\t? (allowedTypes[0] ?? oob())\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tanyOf: allowedTypes,\n\t\t\t\t\t\t},\n\t\t},\n\t};\n}\n\nfunction createSchemaRef(schemaId: string): JsonSchemaRef {\n\treturn {\n\t\t\"$ref\": createRefPath(schemaId),\n\t};\n}\n\nfunction createRefPath(schemaId: string): JsonRefPath {\n\treturn `#/$defs/${schemaId}`;\n}\n"]}
1
+ {"version":3,"file":"simpleSchemaToJsonSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/simpleSchemaToJsonSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAgB,MAAM,qBAAqB,CAAC;AAa3E,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAS9C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,MAAwB;IACpD,MAAM,WAAW,GAAG,kBAAkB,CAAC,MAAM,CAA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ACH,OAAO;QACN,IAAI,EAAE,QAAQ;QACd,mBAAmB,EAAE,QAAQ,CAAC,GAAG;QACjC,iBAAiB,EAAE;YAClB,MAAM,EAAE,SAAS,CAAC,YAAY,CAAC;gBAC9B,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;gBACjB,CAAC,CAAC;oBACA,KAAK,EAAE,YAAY;iBACnB;SACH;KACD,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,QAAgB;IACxC,OAAO;QACN,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC;KAC/B,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,QAAgB;IACtC,OAAO,WAAW,QAAQ,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { ValueSchema } from \"../../core/index.js\";\nimport { getOrCreate, hasSingle, type Mutable } from \"../../util/index.js\";\nimport type {\n\tJsonArrayNodeSchema,\n\tJsonFieldSchema,\n\tJsonSchemaRef,\n\tJsonRefPath,\n\tJsonLeafNodeSchema,\n\tJsonMapNodeSchema,\n\tJsonNodeSchema,\n\tJsonObjectNodeSchema,\n\tJsonTreeSchema,\n\tJsonLeafSchemaType,\n} from \"./jsonSchema.js\";\nimport { FieldKind } from \"../schemaTypes.js\";\nimport type {\n\tSimpleArrayNodeSchema,\n\tSimpleLeafNodeSchema,\n\tSimpleMapNodeSchema,\n\tSimpleNodeSchema,\n\tSimpleObjectNodeSchema,\n\tSimpleTreeSchema,\n} from \"./simpleSchema.js\";\nimport { NodeKind } from \"../core/index.js\";\n\n/**\n * Generates a JSON Schema representation from a simple tree schema.\n * @internal\n */\nexport function toJsonSchema(schema: SimpleTreeSchema): JsonTreeSchema {\n\tconst definitions = convertDefinitions(schema.definitions);\n\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tfor (const allowedType of schema.allowedTypes) {\n\t\tallowedTypes.push(createSchemaRef(allowedType));\n\t}\n\n\treturn hasSingle(allowedTypes)\n\t\t? {\n\t\t\t\t...allowedTypes[0],\n\t\t\t\t$defs: definitions,\n\t\t\t}\n\t\t: {\n\t\t\t\t$defs: definitions,\n\t\t\t\tanyOf: allowedTypes,\n\t\t\t};\n}\n\nfunction convertDefinitions(\n\tdefinitions: ReadonlyMap<string, SimpleNodeSchema>,\n): Record<string, JsonNodeSchema> {\n\tconst result: Record<string, JsonNodeSchema> = {};\n\tfor (const [key, value] of definitions) {\n\t\tresult[key] = convertNodeSchema(value);\n\t}\n\treturn result;\n}\n\n/**\n * Private symbol under which the results of {@link convertNodeSchema} are cached on an input {@link SimpleNodeSchema}.\n */\nconst nodeJsonSchemaCache = new WeakMap<SimpleNodeSchema, JsonNodeSchema>();\n\n/**\n * Converts an input {@link SimpleNodeSchema} to a {@link JsonNodeSchema}.\n *\n * @remarks Caches the result on the input schema for future calls.\n */\nfunction convertNodeSchema(schema: SimpleNodeSchema): JsonNodeSchema {\n\treturn getOrCreate(nodeJsonSchemaCache, schema, () => {\n\t\tswitch (schema.kind) {\n\t\t\tcase NodeKind.Array:\n\t\t\t\treturn convertArrayNodeSchema(schema);\n\t\t\tcase NodeKind.Leaf:\n\t\t\t\treturn convertLeafNodeSchema(schema);\n\t\t\tcase NodeKind.Map:\n\t\t\t\treturn convertMapNodeSchema(schema);\n\t\t\tcase NodeKind.Object:\n\t\t\t\treturn convertObjectNodeSchema(schema);\n\t\t\tdefault:\n\t\t\t\tthrow new TypeError(`Unknown node schema kind: ${(schema as SimpleNodeSchema).kind}`);\n\t\t}\n\t});\n}\n\nfunction convertArrayNodeSchema(schema: SimpleArrayNodeSchema): JsonArrayNodeSchema {\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tschema.allowedTypes.forEach((type) => {\n\t\tallowedTypes.push(createSchemaRef(type));\n\t});\n\n\tconst items: JsonFieldSchema = hasSingle(allowedTypes)\n\t\t? allowedTypes[0]\n\t\t: { anyOf: allowedTypes };\n\n\treturn {\n\t\ttype: \"array\",\n\t\t_treeNodeSchemaKind: NodeKind.Array,\n\t\titems,\n\t};\n}\n\nfunction convertLeafNodeSchema(schema: SimpleLeafNodeSchema): JsonLeafNodeSchema {\n\tlet type: JsonLeafSchemaType;\n\tswitch (schema.leafKind) {\n\t\tcase ValueSchema.String:\n\t\t\ttype = \"string\";\n\t\t\tbreak;\n\t\tcase ValueSchema.Number:\n\t\t\ttype = \"number\";\n\t\t\tbreak;\n\t\tcase ValueSchema.Boolean:\n\t\t\ttype = \"boolean\";\n\t\t\tbreak;\n\t\tcase ValueSchema.Null:\n\t\t\ttype = \"null\";\n\t\t\tbreak;\n\t\tcase ValueSchema.FluidHandle:\n\t\t\tthrow new UsageError(\"Fluid handles are not supported via JSON Schema.\");\n\t\tdefault:\n\t\t\tunreachableCase(schema.leafKind);\n\t}\n\n\treturn {\n\t\ttype,\n\t\t_treeNodeSchemaKind: NodeKind.Leaf,\n\t};\n}\n\nfunction convertObjectNodeSchema(schema: SimpleObjectNodeSchema): JsonObjectNodeSchema {\n\tconst properties: Record<string, JsonFieldSchema> = {};\n\tconst required: string[] = [];\n\tfor (const [key, value] of Object.entries(schema.fields)) {\n\t\tconst allowedTypes: JsonSchemaRef[] = [];\n\t\tfor (const allowedType of value.allowedTypes) {\n\t\t\tallowedTypes.push(createSchemaRef(allowedType));\n\t\t}\n\n\t\tconst output: Mutable<JsonFieldSchema> = hasSingle(allowedTypes)\n\t\t\t? allowedTypes[0]\n\t\t\t: {\n\t\t\t\t\tanyOf: allowedTypes,\n\t\t\t\t};\n\n\t\t// Don't include \"description\" property at all if it's not present in the input.\n\t\tif (value.metadata?.description !== undefined) {\n\t\t\toutput.description = value.metadata.description;\n\t\t}\n\n\t\tproperties[key] = output;\n\n\t\tif (value.kind === FieldKind.Required) {\n\t\t\trequired.push(key);\n\t\t}\n\t}\n\treturn {\n\t\ttype: \"object\",\n\t\t_treeNodeSchemaKind: NodeKind.Object,\n\t\tproperties,\n\t\trequired,\n\t\tadditionalProperties: false,\n\t};\n}\n\nfunction convertMapNodeSchema(schema: SimpleMapNodeSchema): JsonMapNodeSchema {\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tschema.allowedTypes.forEach((type) => {\n\t\tallowedTypes.push(createSchemaRef(type));\n\t});\n\treturn {\n\t\ttype: \"object\",\n\t\t_treeNodeSchemaKind: NodeKind.Map,\n\t\tpatternProperties: {\n\t\t\t\"^.*$\": hasSingle(allowedTypes)\n\t\t\t\t? allowedTypes[0]\n\t\t\t\t: {\n\t\t\t\t\t\tanyOf: allowedTypes,\n\t\t\t\t\t},\n\t\t},\n\t};\n}\n\nfunction createSchemaRef(schemaId: string): JsonSchemaRef {\n\treturn {\n\t\t\"$ref\": createRefPath(schemaId),\n\t};\n}\n\nfunction createRefPath(schemaId: string): JsonRefPath {\n\treturn `#/$defs/${schemaId}`;\n}\n"]}
@@ -0,0 +1,65 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { type TreeIndexNodes, type TreeIndex, type TreeIndexKey } from "../../feature-libraries/index.js";
6
+ import type { ImplicitFieldSchema, NodeFromSchema } from "../schemaTypes.js";
7
+ import { type TreeNode, type TreeNodeSchema } from "../core/index.js";
8
+ import type { TreeView } from "./tree.js";
9
+ /**
10
+ * A {@link TreeIndex} that returns tree nodes given their associated keys.
11
+ *
12
+ * @alpha
13
+ */
14
+ export type SimpleTreeIndex<TKey extends TreeIndexKey, TValue> = TreeIndex<TKey, TValue>;
15
+ /**
16
+ * Creates a {@link SimpleTreeIndex} with a specified indexer.
17
+ *
18
+ * @param view - the view for the tree being indexed
19
+ * @param indexer - a function that takes in a {@link TreeNodeSchema} and returns the field name that all nodes of the given schema
20
+ * should be keyed on, must be pure and functional
21
+ * @param getValue - given at least one {@link TreeNode}, returns an associated value
22
+ * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer
23
+ *
24
+ * @alpha
25
+ */
26
+ export declare function createSimpleTreeIndex<TFieldSchema extends ImplicitFieldSchema, TKey extends TreeIndexKey, TValue>(view: TreeView<TFieldSchema>, indexer: (schema: TreeNodeSchema) => string | undefined, getValue: (nodes: TreeIndexNodes<TreeNode>) => TValue, isKeyValid: (key: TreeIndexKey) => key is TKey): SimpleTreeIndex<TKey, TValue>;
27
+ /**
28
+ * Creates a {@link SimpleTreeIndex} with a specified indexer.
29
+ *
30
+ * @param view - the view for the tree being indexed
31
+ * @param indexer - a function that takes in a {@link TreeNodeSchema} and returns the field name that all nodes of the given schema
32
+ * should be keyed on, must be pure and functional
33
+ * @param getValue - given at least one {@link TreeNode}, returns an associated value
34
+ * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer
35
+ * @param indexableSchema - a list of all the schema types that can be indexed
36
+ *
37
+ * @alpha
38
+ */
39
+ export declare function createSimpleTreeIndex<TFieldSchema extends ImplicitFieldSchema, TKey extends TreeIndexKey, TValue, TSchema extends TreeNodeSchema>(view: TreeView<TFieldSchema>, indexer: (schema: TSchema) => string | undefined, getValue: (nodes: TreeIndexNodes<NodeFromSchema<TSchema>>) => TValue, isKeyValid: (key: TreeIndexKey) => key is TKey, indexableSchema: readonly TSchema[]): SimpleTreeIndex<TKey, TValue>;
40
+ /**
41
+ * Creates a {@link SimpleTreeIndex} with a specified indexer.
42
+ *
43
+ * @param view - the view for the tree being indexed
44
+ * @param indexer - a map from {@link TreeNodeSchema} to the field name that all nodes of the given schema
45
+ * should be keyed on
46
+ * @param getValue - given at least one {@link TreeNode}, returns an associated value
47
+ * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer
48
+ *
49
+ * @alpha
50
+ */
51
+ export declare function createSimpleTreeIndex<TFieldSchema extends ImplicitFieldSchema, TKey extends TreeIndexKey, TValue>(view: TreeView<TFieldSchema>, indexer: Map<TreeNodeSchema, string>, getValue: (nodes: TreeIndexNodes<TreeNode>) => TValue, isKeyValid: (key: TreeIndexKey) => key is TKey): SimpleTreeIndex<TKey, TValue>;
52
+ /**
53
+ * Creates a {@link SimpleTreeIndex} with a specified indexer.
54
+ *
55
+ * @param view - the view for the tree being indexed
56
+ * @param indexer - a map from {@link TreeNodeSchema} to the field name that all nodes of the given schema
57
+ * should be keyed on
58
+ * @param getValue - given at least one {@link TreeNode}, returns an associated value
59
+ * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer
60
+ * @param indexableSchema - a list of all the schema types that can be indexed
61
+ *
62
+ * @alpha
63
+ */
64
+ export declare function createSimpleTreeIndex<TFieldSchema extends ImplicitFieldSchema, TKey extends TreeIndexKey, TValue, TSchema extends TreeNodeSchema>(view: TreeView<TFieldSchema>, indexer: Map<TreeNodeSchema, string>, getValue: (nodes: TreeIndexNodes<NodeFromSchema<TSchema>>) => TValue, isKeyValid: (key: TreeIndexKey) => key is TKey, indexableSchema: readonly TSchema[]): SimpleTreeIndex<TKey, TValue>;
65
+ //# sourceMappingURL=simpleTreeIndex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simpleTreeIndex.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/simpleTreeIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAGN,KAAK,cAAc,EAEnB,KAAK,SAAS,EACd,KAAK,YAAY,EAEjB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAsB,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE1F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAI1C;;;;GAIG;AACH,MAAM,MAAM,eAAe,CAAC,IAAI,SAAS,YAAY,EAAE,MAAM,IAAI,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAEzF;;;;;;;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C,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACjC;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACpC,YAAY,SAAS,mBAAmB,EACxC,IAAI,SAAS,YAAY,EACzB,MAAM,EACN,OAAO,SAAS,cAAc,EAE9B,IAAI,EAAE,QAAQ,CAAC,YAAY,CAAC,EAC5B,OAAO,EAAE,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC,EACpC,QAAQ,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,KAAK,MAAM,EACpE,UAAU,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,GAAG,IAAI,IAAI,EAC9C,eAAe,EAAE,SAAS,OAAO,EAAE,GACjC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC"}
@@ -0,0 +1,87 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { AnchorTreeIndex, isTreeValue, hasElement, } from "../../feature-libraries/index.js";
6
+ import { brand, fail } from "../../util/index.js";
7
+ import { treeNodeFromAnchor } from "../core/index.js";
8
+ import { treeNodeApi } from "./treeNodeApi.js";
9
+ import { walkFieldSchema } from "../walkFieldSchema.js";
10
+ /**
11
+ * Creates a {@link SimpleTreeIndex} with a specified indexer.
12
+ *
13
+ * @alpha
14
+ */
15
+ export function createSimpleTreeIndex(view, indexer, getValue, isKeyValid, indexableSchema) {
16
+ const indexableSchemaMap = new Map();
17
+ if (indexableSchema !== undefined) {
18
+ for (const schemus of indexableSchema) {
19
+ indexableSchemaMap.set(schemus.identifier, schemus);
20
+ }
21
+ }
22
+ else {
23
+ walkFieldSchema(view.schema, {
24
+ node: (schemus) => indexableSchemaMap.set(schemus.identifier, schemus),
25
+ });
26
+ }
27
+ const schemaIndexer = indexableSchema === undefined
28
+ ? (schemaIdentifier) => {
29
+ // if indexable schema isn't provided, we check if the node is in schema
30
+ const schemus = indexableSchemaMap.get(schemaIdentifier);
31
+ if (schemus !== undefined) {
32
+ const keyLocation = typeof indexer === "function" ? indexer(schemus) : indexer.get(schemus);
33
+ if (keyLocation !== undefined) {
34
+ return makeGenericKeyFinder(brand(keyLocation), isKeyValid);
35
+ }
36
+ }
37
+ else {
38
+ fail("node is out of schema");
39
+ }
40
+ }
41
+ : (schemaIdentifier) => {
42
+ const schemus = indexableSchemaMap.get(schemaIdentifier);
43
+ if (schemus !== undefined) {
44
+ const keyLocation = typeof indexer === "function" ? indexer(schemus) : indexer.get(schemus);
45
+ if (keyLocation !== undefined) {
46
+ return makeGenericKeyFinder(brand(keyLocation), isKeyValid);
47
+ }
48
+ }
49
+ };
50
+ const index = new AnchorTreeIndex(view.getView().checkout.forest, schemaIndexer, (anchorNodes) => {
51
+ const simpleTreeNodes = [];
52
+ for (const anchorNode of anchorNodes) {
53
+ const simpleTree = treeNodeFromAnchor(anchorNode);
54
+ if (!isTreeValue(simpleTree)) {
55
+ simpleTreeNodes.push(simpleTree);
56
+ }
57
+ }
58
+ if (hasElement(simpleTreeNodes)) {
59
+ return getValue(simpleTreeNodes);
60
+ }
61
+ }, (anchorNode) => {
62
+ const simpleTree = treeNodeFromAnchor(anchorNode);
63
+ if (!isTreeValue(simpleTree)) {
64
+ return treeNodeApi.status(simpleTree);
65
+ }
66
+ });
67
+ // all the type checking guarantees that we put nodes of the correct type in the index
68
+ // but it's not captured in the type system
69
+ return index;
70
+ }
71
+ function makeGenericKeyFinder(keyField, isKeyValid) {
72
+ return (cursor) => {
73
+ cursor.enterField(keyField);
74
+ cursor.firstNode();
75
+ const value = cursor.value;
76
+ cursor.exitNode();
77
+ cursor.exitField();
78
+ if (value === undefined) {
79
+ fail("a value for the key does not exist");
80
+ }
81
+ if (!isKeyValid(value)) {
82
+ fail("the key is an unexpected type");
83
+ }
84
+ return value;
85
+ };
86
+ }
87
+ //# sourceMappingURL=simpleTreeIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":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Q,CAAC,eAAe,CAAC,CAAC;QAClC,CAAC;IACF,CAAC,EACD,CAAC,UAAsB,EAAE,EAAE;QAC1B,MAAM,UAAU,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAClD,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,CAAC;YAC9B,OAAO,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACvC,CAAC;IACF,CAAC,CACD,CAAC;IAEF,sFAAsF;IACtF,2CAA2C;IAC3C,OAAO,KAAsC,CAAC;AAC/C,CAAC;AAED,SAAS,oBAAoB,CAC5B,QAAkB,EAClB,UAA8C;IAE9C,OAAO,CAAC,MAA+B,EAAE,EAAE;QAC1C,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC5B,MAAM,CAAC,SAAS,EAAE,CAAC;QACnB,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC3B,MAAM,CAAC,QAAQ,EAAE,CAAC;QAClB,MAAM,CAAC,SAAS,EAAE,CAAC;QAEnB,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACzB,IAAI,CAAC,oCAAoC,CAAC,CAAC;QAC5C,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YACxB,IAAI,CAAC,+BAA+B,CAAC,CAAC;QACvC,CAAC;QAED,OAAO,KAAK,CAAC;IACd,CAAC,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tAnchorNode,\n\tFieldKey,\n\tITreeSubscriptionCursor,\n\tTreeNodeSchemaIdentifier,\n} from \"../../core/index.js\";\nimport {\n\tAnchorTreeIndex,\n\tisTreeValue,\n\ttype TreeIndexNodes,\n\thasElement,\n\ttype TreeIndex,\n\ttype TreeIndexKey,\n\ttype KeyFinder,\n} from \"../../feature-libraries/index.js\";\nimport { brand, fail } from \"../../util/index.js\";\nimport type { ImplicitFieldSchema, NodeFromSchema } from \"../schemaTypes.js\";\nimport { treeNodeFromAnchor, type TreeNode, type TreeNodeSchema } from \"../core/index.js\";\nimport { treeNodeApi } from \"./treeNodeApi.js\";\nimport type { TreeView } from \"./tree.js\";\nimport { walkFieldSchema } from \"../walkFieldSchema.js\";\nimport type { SchematizingSimpleTreeView } from \"../../shared-tree/index.js\";\n\n/**\n * A {@link TreeIndex} that returns tree nodes given their associated keys.\n *\n * @alpha\n */\nexport type SimpleTreeIndex<TKey extends TreeIndexKey, TValue> = TreeIndex<TKey, TValue>;\n\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a function that takes in a {@link TreeNodeSchema} and returns the field name that all nodes of the given schema\n * should be keyed on, must be pure and functional\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: (schema: TreeNodeSchema) => string | undefined,\n\tgetValue: (nodes: TreeIndexNodes<TreeNode>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a function that takes in a {@link TreeNodeSchema} and returns the field name that all nodes of the given schema\n * should be keyed on, must be pure and functional\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n * @param indexableSchema - a list of all the schema types that can be indexed\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n\tTSchema extends TreeNodeSchema,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: (schema: TSchema) => string | undefined,\n\tgetValue: (nodes: TreeIndexNodes<NodeFromSchema<TSchema>>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n\tindexableSchema: readonly TSchema[],\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a map from {@link TreeNodeSchema} to the field name that all nodes of the given schema\n * should be keyed on\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: Map<TreeNodeSchema, string>,\n\tgetValue: (nodes: TreeIndexNodes<TreeNode>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a map from {@link TreeNodeSchema} to the field name that all nodes of the given schema\n * should be keyed on\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n * @param indexableSchema - a list of all the schema types that can be indexed\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n\tTSchema extends TreeNodeSchema,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: Map<TreeNodeSchema, string>,\n\tgetValue: (nodes: TreeIndexNodes<NodeFromSchema<TSchema>>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n\tindexableSchema: readonly TSchema[],\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: ((schema: TreeNodeSchema) => string | undefined) | Map<TreeNodeSchema, string>,\n\tgetValue:\n\t\t| ((nodes: TreeIndexNodes<TreeNode>) => TValue)\n\t\t| ((nodes: TreeIndexNodes<NodeFromSchema<TreeNodeSchema>>) => TValue),\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n\tindexableSchema?: readonly TreeNodeSchema[],\n): SimpleTreeIndex<TKey, TValue> {\n\tconst indexableSchemaMap = new Map();\n\tif (indexableSchema !== undefined) {\n\t\tfor (const schemus of indexableSchema) {\n\t\t\tindexableSchemaMap.set(schemus.identifier, schemus);\n\t\t}\n\t} else {\n\t\twalkFieldSchema(view.schema, {\n\t\t\tnode: (schemus) => indexableSchemaMap.set(schemus.identifier, schemus),\n\t\t});\n\t}\n\n\tconst schemaIndexer =\n\t\tindexableSchema === undefined\n\t\t\t? (schemaIdentifier: TreeNodeSchemaIdentifier) => {\n\t\t\t\t\t// if indexable schema isn't provided, we check if the node is in schema\n\t\t\t\t\tconst schemus = indexableSchemaMap.get(schemaIdentifier);\n\t\t\t\t\tif (schemus !== undefined) {\n\t\t\t\t\t\tconst keyLocation =\n\t\t\t\t\t\t\ttypeof indexer === \"function\" ? indexer(schemus) : indexer.get(schemus);\n\t\t\t\t\t\tif (keyLocation !== undefined) {\n\t\t\t\t\t\t\treturn makeGenericKeyFinder<TKey>(brand(keyLocation), isKeyValid);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfail(\"node is out of schema\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t: (schemaIdentifier: TreeNodeSchemaIdentifier) => {\n\t\t\t\t\tconst schemus = indexableSchemaMap.get(schemaIdentifier);\n\t\t\t\t\tif (schemus !== undefined) {\n\t\t\t\t\t\tconst keyLocation =\n\t\t\t\t\t\t\ttypeof indexer === \"function\" ? indexer(schemus) : indexer.get(schemus);\n\t\t\t\t\t\tif (keyLocation !== undefined) {\n\t\t\t\t\t\t\treturn makeGenericKeyFinder<TKey>(brand(keyLocation), isKeyValid);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\n\tconst index = new AnchorTreeIndex<TKey, TValue>(\n\t\t(view as SchematizingSimpleTreeView<TFieldSchema>).getView().checkout.forest,\n\t\tschemaIndexer,\n\t\t(anchorNodes) => {\n\t\t\tconst simpleTreeNodes: TreeNode[] = [];\n\t\t\tfor (const anchorNode of anchorNodes) {\n\t\t\t\tconst simpleTree = treeNodeFromAnchor(anchorNode);\n\t\t\t\tif (!isTreeValue(simpleTree)) {\n\t\t\t\t\tsimpleTreeNodes.push(simpleTree);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (hasElement(simpleTreeNodes)) {\n\t\t\t\treturn getValue(simpleTreeNodes);\n\t\t\t}\n\t\t},\n\t\t(anchorNode: AnchorNode) => {\n\t\t\tconst simpleTree = treeNodeFromAnchor(anchorNode);\n\t\t\tif (!isTreeValue(simpleTree)) {\n\t\t\t\treturn treeNodeApi.status(simpleTree);\n\t\t\t}\n\t\t},\n\t);\n\n\t// all the type checking guarantees that we put nodes of the correct type in the index\n\t// but it's not captured in the type system\n\treturn index as SimpleTreeIndex<TKey, TValue>;\n}\n\nfunction makeGenericKeyFinder<TKey extends TreeIndexKey>(\n\tkeyField: FieldKey,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n): KeyFinder<TKey> {\n\treturn (cursor: ITreeSubscriptionCursor) => {\n\t\tcursor.enterField(keyField);\n\t\tcursor.firstNode();\n\t\tconst value = cursor.value;\n\t\tcursor.exitNode();\n\t\tcursor.exitField();\n\n\t\tif (value === undefined) {\n\t\t\tfail(\"a value for the key does not exist\");\n\t\t}\n\n\t\tif (!isKeyValid(value)) {\n\t\t\tfail(\"the key is an unexpected type\");\n\t\t}\n\n\t\treturn value;\n\t};\n}\n"]}
@@ -2,9 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import type { IFluidLoadable, IDisposable } from "@fluidframework/core-interfaces";
6
- import type { CommitMetadata, RevertibleFactory } from "../../core/index.js";
7
- import type { Listenable } from "../../events/index.js";
5
+ import type { IFluidLoadable, IDisposable, Listenable } from "@fluidframework/core-interfaces";
6
+ import type { CommitMetadata, RevertibleAlphaFactory, RevertibleFactory } from "../../core/index.js";
8
7
  import { type ImplicitFieldSchema, type InsertableField, type InsertableTreeFieldFromImplicitField, type ReadableField, type ReadSchema, type TreeFieldFromImplicitField, type UnsafeUnknownSchema } from "../schemaTypes.js";
9
8
  import { type TreeNodeSchema } from "../core/index.js";
10
9
  import type { MakeNominal } from "../../util/index.js";
@@ -429,7 +428,7 @@ export interface TreeBranchEvents {
429
428
  * @param getRevertible - a function that allows users to get a revertible for the change. If not provided,
430
429
  * this change is not revertible.
431
430
  */
432
- changed(data: CommitMetadata, getRevertible?: RevertibleFactory): void;
431
+ changed(data: CommitMetadata, getRevertible?: RevertibleAlphaFactory): void;
433
432
  /**
434
433
  * Fired when:
435
434
  * - a local commit is applied outside of a transaction
@@ -443,7 +442,7 @@ export interface TreeBranchEvents {
443
442
  * @param getRevertible - a function provided that allows users to get a revertible for the commit that was applied. If not provided,
444
443
  * this commit is not revertible.
445
444
  */
446
- commitApplied(data: CommitMetadata, getRevertible?: RevertibleFactory): void;
445
+ commitApplied(data: CommitMetadata, getRevertible?: RevertibleAlphaFactory): void;
447
446
  }
448
447
  /**
449
448
  * Events for {@link TreeView}.
@@ -1 +1 @@
1
- {"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/tree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAGnF,OAAO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