@fluidframework/tree 2.41.0-338401 → 2.41.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 (974) hide show
  1. package/CHANGELOG.md +341 -0
  2. package/api-report/tree.alpha.api.md +10 -0
  3. package/dist/alpha.d.ts +1 -0
  4. package/dist/codec/codec.d.ts +10 -0
  5. package/dist/codec/codec.d.ts.map +1 -1
  6. package/dist/codec/codec.js +13 -3
  7. package/dist/codec/codec.js.map +1 -1
  8. package/dist/core/index.d.ts +1 -1
  9. package/dist/core/index.d.ts.map +1 -1
  10. package/dist/core/index.js +2 -1
  11. package/dist/core/index.js.map +1 -1
  12. package/dist/core/rebase/types.d.ts +2 -2
  13. package/dist/core/rebase/types.js +2 -2
  14. package/dist/core/rebase/types.js.map +1 -1
  15. package/dist/core/rebase/utils.d.ts +0 -2
  16. package/dist/core/rebase/utils.d.ts.map +1 -1
  17. package/dist/core/rebase/utils.js +6 -10
  18. package/dist/core/rebase/utils.js.map +1 -1
  19. package/dist/core/schema-stored/formatV1.d.ts +0 -1
  20. package/dist/core/schema-stored/formatV1.d.ts.map +1 -1
  21. package/dist/core/schema-stored/formatV1.js +1 -2
  22. package/dist/core/schema-stored/formatV1.js.map +1 -1
  23. package/dist/core/schema-stored/index.d.ts +1 -1
  24. package/dist/core/schema-stored/index.d.ts.map +1 -1
  25. package/dist/core/schema-stored/index.js +2 -1
  26. package/dist/core/schema-stored/index.js.map +1 -1
  27. package/dist/core/schema-stored/schema.d.ts +6 -0
  28. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  29. package/dist/core/schema-stored/schema.js +8 -1
  30. package/dist/core/schema-stored/schema.js.map +1 -1
  31. package/dist/core/tree/anchorSet.d.ts +2 -1
  32. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  33. package/dist/core/tree/anchorSet.js +2 -1
  34. package/dist/core/tree/anchorSet.js.map +1 -1
  35. package/dist/core/tree/pathTree.d.ts +12 -11
  36. package/dist/core/tree/pathTree.d.ts.map +1 -1
  37. package/dist/core/tree/pathTree.js +8 -7
  38. package/dist/core/tree/pathTree.js.map +1 -1
  39. package/dist/core/tree/treeTextFormat.d.ts +1 -1
  40. package/dist/core/tree/treeTextFormat.js +1 -1
  41. package/dist/core/tree/treeTextFormat.js.map +1 -1
  42. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -1
  43. package/dist/feature-libraries/chunked-forest/chunkedForest.js +1 -1
  44. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  45. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +1 -1
  46. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  47. package/dist/feature-libraries/default-schema/index.d.ts +1 -1
  48. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  49. package/dist/feature-libraries/default-schema/index.js +2 -2
  50. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  51. package/dist/feature-libraries/default-schema/schemaChecker.d.ts +15 -15
  52. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  53. package/dist/feature-libraries/default-schema/schemaChecker.js +50 -35
  54. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  55. package/dist/feature-libraries/flex-tree/context.d.ts +18 -2
  56. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  57. package/dist/feature-libraries/flex-tree/context.js +22 -6
  58. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  59. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +3 -2
  60. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  61. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +3 -2
  62. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  63. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  64. package/dist/feature-libraries/flex-tree/lazyField.js +1 -1
  65. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  66. package/dist/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  67. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  68. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +1 -1
  69. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  70. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  71. package/dist/feature-libraries/index.d.ts +2 -2
  72. package/dist/feature-libraries/index.d.ts.map +1 -1
  73. package/dist/feature-libraries/index.js +3 -4
  74. package/dist/feature-libraries/index.js.map +1 -1
  75. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +2 -2
  76. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  77. package/dist/feature-libraries/indexing/anchorTreeIndex.js +15 -15
  78. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  79. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  80. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  81. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +1 -1
  82. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  83. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  84. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.d.ts +1 -1
  85. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js +1 -1
  86. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js.map +1 -1
  87. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  88. package/dist/feature-libraries/modular-schema/genericFieldKind.js +2 -2
  89. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  90. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
  91. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  92. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.d.ts.map +1 -1
  93. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
  94. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts +0 -2
  95. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  96. package/dist/feature-libraries/modular-schema/isNeverTree.js +0 -2
  97. package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  98. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  99. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  100. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +2 -0
  101. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  102. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +2 -0
  103. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  104. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  105. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  106. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts.map +1 -1
  107. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js +8 -3
  108. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
  109. package/dist/feature-libraries/object-forest/objectForest.d.ts +22 -5
  110. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  111. package/dist/feature-libraries/object-forest/objectForest.js +296 -207
  112. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  113. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +2 -2
  114. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  115. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +3 -2
  116. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  117. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -2
  118. package/dist/feature-libraries/schema-index/codec.d.ts +6 -12
  119. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  120. package/dist/feature-libraries/schema-index/codec.js +8 -15
  121. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  122. package/dist/feature-libraries/schema-index/formatV1.d.ts +2 -2
  123. package/dist/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
  124. package/dist/feature-libraries/schema-index/formatV1.js +1 -1
  125. package/dist/feature-libraries/schema-index/formatV1.js.map +1 -1
  126. package/dist/feature-libraries/schema-index/index.d.ts +1 -1
  127. package/dist/feature-libraries/schema-index/index.d.ts.map +1 -1
  128. package/dist/feature-libraries/schema-index/index.js +1 -2
  129. package/dist/feature-libraries/schema-index/index.js.map +1 -1
  130. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +1 -1
  131. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  132. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  133. package/dist/feature-libraries/sequence-field/formatV3.d.ts.map +1 -1
  134. package/dist/feature-libraries/sequence-field/formatV3.js.map +1 -1
  135. package/dist/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
  136. package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
  137. package/dist/feature-libraries/sequence-field/prune.d.ts.map +1 -1
  138. package/dist/feature-libraries/sequence-field/prune.js.map +1 -1
  139. package/dist/feature-libraries/sequence-field/rebase.js +1 -1
  140. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  141. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +1 -1
  142. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +1 -1
  143. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js.map +1 -1
  144. package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  145. package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  146. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts +1 -1
  147. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  148. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
  149. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  150. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +2 -2
  151. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  152. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
  153. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  154. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +1 -1
  155. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  156. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +2 -2
  157. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  158. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +1 -1
  159. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  160. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  161. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +1 -1
  162. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  163. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  164. package/dist/feature-libraries/sequence-field/utils.d.ts +7 -5
  165. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  166. package/dist/feature-libraries/sequence-field/utils.js +7 -5
  167. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  168. package/dist/feature-libraries/treeCursorUtils.js +2 -2
  169. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  170. package/dist/feature-libraries/treeTextCursor.d.ts +1 -1
  171. package/dist/feature-libraries/treeTextCursor.js +1 -1
  172. package/dist/feature-libraries/treeTextCursor.js.map +1 -1
  173. package/dist/index.d.ts +2 -2
  174. package/dist/index.d.ts.map +1 -1
  175. package/dist/index.js +2 -6
  176. package/dist/index.js.map +1 -1
  177. package/dist/packageVersion.d.ts +1 -1
  178. package/dist/packageVersion.d.ts.map +1 -1
  179. package/dist/packageVersion.js +1 -1
  180. package/dist/packageVersion.js.map +1 -1
  181. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  182. package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -1
  183. package/dist/shared-tree/independentView.d.ts +1 -1
  184. package/dist/shared-tree/independentView.d.ts.map +1 -1
  185. package/dist/shared-tree/independentView.js +8 -3
  186. package/dist/shared-tree/independentView.js.map +1 -1
  187. package/dist/shared-tree/index.d.ts +1 -1
  188. package/dist/shared-tree/index.d.ts.map +1 -1
  189. package/dist/shared-tree/index.js.map +1 -1
  190. package/dist/shared-tree/schematizeTree.d.ts +1 -1
  191. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  192. package/dist/shared-tree/schematizeTree.js.map +1 -1
  193. package/dist/shared-tree/schematizingTreeView.d.ts +1 -1
  194. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  195. package/dist/shared-tree/schematizingTreeView.js +1 -1
  196. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  197. package/dist/shared-tree/sharedTree.d.ts +3 -3
  198. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  199. package/dist/shared-tree/sharedTree.js +8 -8
  200. package/dist/shared-tree/sharedTree.js.map +1 -1
  201. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +1 -1
  202. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  203. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  204. package/dist/shared-tree/tree.js +1 -1
  205. package/dist/shared-tree/tree.js.map +1 -1
  206. package/dist/shared-tree/treeAlpha.d.ts +76 -2
  207. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  208. package/dist/shared-tree/treeAlpha.js +62 -16
  209. package/dist/shared-tree/treeAlpha.js.map +1 -1
  210. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  211. package/dist/shared-tree/treeCheckout.js +3 -2
  212. package/dist/shared-tree/treeCheckout.js.map +1 -1
  213. package/dist/shared-tree-core/branch.d.ts +2 -2
  214. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  215. package/dist/shared-tree-core/branch.js +2 -2
  216. package/dist/shared-tree-core/branch.js.map +1 -1
  217. package/dist/shared-tree-core/branchCommitEnricher.d.ts +1 -1
  218. package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  219. package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
  220. package/dist/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  221. package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  222. package/dist/shared-tree-core/editManager.d.ts +3 -1
  223. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  224. package/dist/shared-tree-core/editManager.js +4 -2
  225. package/dist/shared-tree-core/editManager.js.map +1 -1
  226. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  227. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  228. package/dist/shared-tree-core/editManagerSummarizer.d.ts +1 -1
  229. package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  230. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  231. package/dist/shared-tree-core/messageCodecs.d.ts +1 -1
  232. package/dist/shared-tree-core/messageCodecs.js +1 -1
  233. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  234. package/dist/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  235. package/dist/shared-tree-core/sequenceIdUtils.js.map +1 -1
  236. package/dist/shared-tree-core/sharedTreeCore.d.ts +2 -2
  237. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  238. package/dist/shared-tree-core/sharedTreeCore.js +4 -4
  239. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  240. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  241. package/dist/shared-tree-core/transaction.js +1 -1
  242. package/dist/shared-tree-core/transaction.js.map +1 -1
  243. package/dist/shared-tree-core/transactionEnricher.d.ts.map +1 -1
  244. package/dist/shared-tree-core/transactionEnricher.js.map +1 -1
  245. package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
  246. package/dist/simple-tree/api/conciseTree.js +1 -1
  247. package/dist/simple-tree/api/conciseTree.js.map +1 -1
  248. package/dist/simple-tree/api/configuration.js +4 -4
  249. package/dist/simple-tree/api/configuration.js.map +1 -1
  250. package/dist/simple-tree/api/create.d.ts +2 -26
  251. package/dist/simple-tree/api/create.d.ts.map +1 -1
  252. package/dist/simple-tree/api/create.js +4 -41
  253. package/dist/simple-tree/api/create.js.map +1 -1
  254. package/dist/simple-tree/api/customTree.d.ts +1 -1
  255. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  256. package/dist/simple-tree/api/customTree.js +24 -24
  257. package/dist/simple-tree/api/customTree.js.map +1 -1
  258. package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  259. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
  260. package/dist/simple-tree/api/identifierIndex.js +2 -2
  261. package/dist/simple-tree/api/identifierIndex.js.map +1 -1
  262. package/dist/simple-tree/api/index.d.ts +2 -3
  263. package/dist/simple-tree/api/index.d.ts.map +1 -1
  264. package/dist/simple-tree/api/index.js +2 -9
  265. package/dist/simple-tree/api/index.js.map +1 -1
  266. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  267. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  268. package/dist/simple-tree/api/schemaFactory.d.ts +5 -5
  269. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  270. package/dist/simple-tree/api/schemaFactory.js +8 -8
  271. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  272. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +1 -3
  273. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  274. package/dist/simple-tree/api/schemaFactoryAlpha.js +4 -6
  275. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  276. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +2 -2
  277. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  278. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  279. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  280. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  281. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts +1 -1
  282. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  283. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +4 -6
  284. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  285. package/dist/simple-tree/api/storedSchema.d.ts +1 -1
  286. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  287. package/dist/simple-tree/api/storedSchema.js +7 -6
  288. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  289. package/dist/simple-tree/api/tree.d.ts +2 -2
  290. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  291. package/dist/simple-tree/api/tree.js.map +1 -1
  292. package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
  293. package/dist/simple-tree/api/treeBeta.js +1 -1
  294. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  295. package/dist/simple-tree/api/treeNodeApi.d.ts +30 -3
  296. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  297. package/dist/simple-tree/api/treeNodeApi.js +40 -28
  298. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  299. package/dist/simple-tree/api/typesUnsafe.d.ts +1 -1
  300. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  301. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  302. package/dist/simple-tree/api/verboseTree.js +3 -3
  303. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  304. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  305. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +4 -6
  306. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  307. package/dist/simple-tree/core/context.d.ts.map +1 -1
  308. package/dist/simple-tree/core/context.js.map +1 -1
  309. package/dist/simple-tree/core/getOrCreateNode.d.ts +1 -1
  310. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  311. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  312. package/dist/simple-tree/core/treeNode.d.ts.map +1 -1
  313. package/dist/simple-tree/core/treeNode.js +1 -1
  314. package/dist/simple-tree/core/treeNode.js.map +1 -1
  315. package/dist/simple-tree/core/treeNodeKernel.d.ts +3 -3
  316. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  317. package/dist/simple-tree/core/treeNodeKernel.js +2 -2
  318. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  319. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  320. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  321. package/dist/simple-tree/core/types.d.ts.map +1 -1
  322. package/dist/simple-tree/core/types.js.map +1 -1
  323. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  324. package/dist/simple-tree/core/unhydratedFlexTree.js +21 -21
  325. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  326. package/dist/simple-tree/core/withType.d.ts +1 -1
  327. package/dist/simple-tree/core/withType.d.ts.map +1 -1
  328. package/dist/simple-tree/core/withType.js.map +1 -1
  329. package/dist/simple-tree/createContext.d.ts.map +1 -1
  330. package/dist/simple-tree/createContext.js.map +1 -1
  331. package/dist/simple-tree/getTreeNodeForField.d.ts.map +1 -1
  332. package/dist/simple-tree/getTreeNodeForField.js.map +1 -1
  333. package/dist/simple-tree/index.d.ts +2 -9
  334. package/dist/simple-tree/index.d.ts.map +1 -1
  335. package/dist/simple-tree/index.js +13 -21
  336. package/dist/simple-tree/index.js.map +1 -1
  337. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  338. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  339. package/dist/simple-tree/{arrayNode.d.ts → node-kinds/array/arrayNode.d.ts} +3 -3
  340. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -0
  341. package/dist/simple-tree/{arrayNode.js → node-kinds/array/arrayNode.js} +9 -9
  342. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -0
  343. package/dist/simple-tree/{arrayNodeTypes.d.ts → node-kinds/array/arrayNodeTypes.d.ts} +3 -3
  344. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -0
  345. package/dist/simple-tree/{arrayNodeTypes.js → node-kinds/array/arrayNodeTypes.js} +1 -1
  346. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -0
  347. package/dist/simple-tree/node-kinds/array/index.d.ts +7 -0
  348. package/dist/simple-tree/node-kinds/array/index.d.ts.map +1 -0
  349. package/dist/simple-tree/node-kinds/array/index.js +16 -0
  350. package/dist/simple-tree/node-kinds/array/index.js.map +1 -0
  351. package/dist/simple-tree/node-kinds/index.d.ts +8 -0
  352. package/dist/simple-tree/node-kinds/index.d.ts.map +1 -0
  353. package/dist/simple-tree/node-kinds/index.js +26 -0
  354. package/dist/simple-tree/node-kinds/index.js.map +1 -0
  355. package/dist/simple-tree/node-kinds/map/index.d.ts +7 -0
  356. package/dist/simple-tree/node-kinds/map/index.d.ts.map +1 -0
  357. package/dist/simple-tree/node-kinds/map/index.js +13 -0
  358. package/dist/simple-tree/node-kinds/map/index.js.map +1 -0
  359. package/{lib/simple-tree → dist/simple-tree/node-kinds/map}/mapNode.d.ts +3 -3
  360. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -0
  361. package/dist/simple-tree/{mapNode.js → node-kinds/map/mapNode.js} +8 -8
  362. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -0
  363. package/dist/simple-tree/{mapNodeTypes.d.ts → node-kinds/map/mapNodeTypes.d.ts} +3 -3
  364. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -0
  365. package/dist/simple-tree/{mapNodeTypes.js → node-kinds/map/mapNodeTypes.js} +1 -1
  366. package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -0
  367. package/dist/simple-tree/node-kinds/object/index.d.ts +7 -0
  368. package/dist/simple-tree/node-kinds/object/index.d.ts.map +1 -0
  369. package/dist/simple-tree/node-kinds/object/index.js +16 -0
  370. package/dist/simple-tree/node-kinds/object/index.js.map +1 -0
  371. package/{lib/simple-tree → dist/simple-tree/node-kinds/object}/objectNode.d.ts +17 -6
  372. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -0
  373. package/dist/simple-tree/{objectNode.js → node-kinds/object/objectNode.js} +47 -24
  374. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -0
  375. package/{lib/simple-tree → dist/simple-tree/node-kinds/object}/objectNodeTypes.d.ts +5 -5
  376. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -0
  377. package/dist/simple-tree/{objectNodeTypes.js → node-kinds/object/objectNodeTypes.js} +1 -1
  378. package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -0
  379. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  380. package/dist/simple-tree/schemaTypes.d.ts +2 -2
  381. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  382. package/dist/simple-tree/schemaTypes.js.map +1 -1
  383. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  384. package/dist/simple-tree/simpleSchema.js.map +1 -1
  385. package/dist/simple-tree/toMapTree.d.ts +1 -16
  386. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  387. package/dist/simple-tree/toMapTree.js +41 -1
  388. package/dist/simple-tree/toMapTree.js.map +1 -1
  389. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  390. package/dist/simple-tree/toStoredSchema.js +1 -1
  391. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  392. package/dist/simple-tree/treeNodeValid.d.ts +1 -1
  393. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  394. package/dist/simple-tree/treeNodeValid.js +10 -10
  395. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  396. package/dist/simple-tree/walkFieldSchema.d.ts.map +1 -1
  397. package/dist/simple-tree/walkFieldSchema.js.map +1 -1
  398. package/dist/tableSchema.d.ts +10 -10
  399. package/dist/treeFactory.d.ts +1 -1
  400. package/dist/treeFactory.js +1 -1
  401. package/dist/treeFactory.js.map +1 -1
  402. package/dist/util/bTreeUtils.d.ts.map +1 -1
  403. package/dist/util/bTreeUtils.js.map +1 -1
  404. package/dist/util/breakable.d.ts +23 -4
  405. package/dist/util/breakable.d.ts.map +1 -1
  406. package/dist/util/breakable.js +12 -3
  407. package/dist/util/breakable.js.map +1 -1
  408. package/docs/SharedTree Philosophy.md +5 -5
  409. package/lib/alpha.d.ts +1 -0
  410. package/lib/codec/codec.d.ts +10 -0
  411. package/lib/codec/codec.d.ts.map +1 -1
  412. package/lib/codec/codec.js +13 -3
  413. package/lib/codec/codec.js.map +1 -1
  414. package/lib/core/index.d.ts +1 -1
  415. package/lib/core/index.d.ts.map +1 -1
  416. package/lib/core/index.js +1 -1
  417. package/lib/core/index.js.map +1 -1
  418. package/lib/core/rebase/types.d.ts +2 -2
  419. package/lib/core/rebase/types.js +2 -2
  420. package/lib/core/rebase/types.js.map +1 -1
  421. package/lib/core/rebase/utils.d.ts +0 -2
  422. package/lib/core/rebase/utils.d.ts.map +1 -1
  423. package/lib/core/rebase/utils.js +6 -10
  424. package/lib/core/rebase/utils.js.map +1 -1
  425. package/lib/core/schema-stored/formatV1.d.ts +0 -1
  426. package/lib/core/schema-stored/formatV1.d.ts.map +1 -1
  427. package/lib/core/schema-stored/formatV1.js +0 -1
  428. package/lib/core/schema-stored/formatV1.js.map +1 -1
  429. package/lib/core/schema-stored/index.d.ts +1 -1
  430. package/lib/core/schema-stored/index.d.ts.map +1 -1
  431. package/lib/core/schema-stored/index.js +1 -1
  432. package/lib/core/schema-stored/index.js.map +1 -1
  433. package/lib/core/schema-stored/schema.d.ts +6 -0
  434. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  435. package/lib/core/schema-stored/schema.js +7 -0
  436. package/lib/core/schema-stored/schema.js.map +1 -1
  437. package/lib/core/tree/anchorSet.d.ts +2 -1
  438. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  439. package/lib/core/tree/anchorSet.js +2 -1
  440. package/lib/core/tree/anchorSet.js.map +1 -1
  441. package/lib/core/tree/pathTree.d.ts +12 -11
  442. package/lib/core/tree/pathTree.d.ts.map +1 -1
  443. package/lib/core/tree/pathTree.js +8 -7
  444. package/lib/core/tree/pathTree.js.map +1 -1
  445. package/lib/core/tree/treeTextFormat.d.ts +1 -1
  446. package/lib/core/tree/treeTextFormat.js +1 -1
  447. package/lib/core/tree/treeTextFormat.js.map +1 -1
  448. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -1
  449. package/lib/feature-libraries/chunked-forest/chunkedForest.js +1 -1
  450. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  451. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +1 -1
  452. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  453. package/lib/feature-libraries/default-schema/index.d.ts +1 -1
  454. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  455. package/lib/feature-libraries/default-schema/index.js +1 -1
  456. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  457. package/lib/feature-libraries/default-schema/schemaChecker.d.ts +15 -15
  458. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  459. package/lib/feature-libraries/default-schema/schemaChecker.js +49 -34
  460. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  461. package/lib/feature-libraries/flex-tree/context.d.ts +18 -2
  462. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  463. package/lib/feature-libraries/flex-tree/context.js +23 -7
  464. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  465. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +3 -2
  466. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  467. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +3 -2
  468. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  469. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  470. package/lib/feature-libraries/flex-tree/lazyField.js +1 -1
  471. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  472. package/lib/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  473. package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
  474. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +1 -1
  475. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  476. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  477. package/lib/feature-libraries/index.d.ts +2 -2
  478. package/lib/feature-libraries/index.d.ts.map +1 -1
  479. package/lib/feature-libraries/index.js +2 -2
  480. package/lib/feature-libraries/index.js.map +1 -1
  481. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +2 -2
  482. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  483. package/lib/feature-libraries/indexing/anchorTreeIndex.js +1 -1
  484. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  485. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  486. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  487. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +1 -1
  488. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  489. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  490. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.d.ts +1 -1
  491. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js +1 -1
  492. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js.map +1 -1
  493. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  494. package/lib/feature-libraries/modular-schema/genericFieldKind.js +2 -2
  495. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  496. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
  497. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  498. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.d.ts.map +1 -1
  499. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
  500. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts +0 -2
  501. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  502. package/lib/feature-libraries/modular-schema/isNeverTree.js +0 -2
  503. package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  504. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  505. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  506. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +2 -0
  507. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  508. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +2 -0
  509. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  510. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  511. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  512. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts.map +1 -1
  513. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js +8 -3
  514. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
  515. package/lib/feature-libraries/object-forest/objectForest.d.ts +22 -5
  516. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  517. package/lib/feature-libraries/object-forest/objectForest.js +299 -209
  518. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  519. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +2 -2
  520. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  521. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +4 -3
  522. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  523. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -2
  524. package/lib/feature-libraries/schema-index/codec.d.ts +6 -12
  525. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  526. package/lib/feature-libraries/schema-index/codec.js +8 -15
  527. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  528. package/lib/feature-libraries/schema-index/formatV1.d.ts +2 -2
  529. package/lib/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
  530. package/lib/feature-libraries/schema-index/formatV1.js +2 -2
  531. package/lib/feature-libraries/schema-index/formatV1.js.map +1 -1
  532. package/lib/feature-libraries/schema-index/index.d.ts +1 -1
  533. package/lib/feature-libraries/schema-index/index.d.ts.map +1 -1
  534. package/lib/feature-libraries/schema-index/index.js +1 -1
  535. package/lib/feature-libraries/schema-index/index.js.map +1 -1
  536. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +1 -1
  537. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  538. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  539. package/lib/feature-libraries/sequence-field/formatV3.d.ts.map +1 -1
  540. package/lib/feature-libraries/sequence-field/formatV3.js.map +1 -1
  541. package/lib/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
  542. package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
  543. package/lib/feature-libraries/sequence-field/prune.d.ts.map +1 -1
  544. package/lib/feature-libraries/sequence-field/prune.js.map +1 -1
  545. package/lib/feature-libraries/sequence-field/rebase.js +1 -1
  546. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  547. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +1 -1
  548. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +1 -1
  549. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js.map +1 -1
  550. package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  551. package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  552. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts +1 -1
  553. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  554. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
  555. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  556. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +2 -2
  557. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  558. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
  559. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  560. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +1 -1
  561. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  562. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +2 -2
  563. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  564. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +1 -1
  565. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  566. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  567. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +1 -1
  568. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  569. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  570. package/lib/feature-libraries/sequence-field/utils.d.ts +7 -5
  571. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  572. package/lib/feature-libraries/sequence-field/utils.js +7 -5
  573. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  574. package/lib/feature-libraries/treeCursorUtils.js +2 -2
  575. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  576. package/lib/feature-libraries/treeTextCursor.d.ts +1 -1
  577. package/lib/feature-libraries/treeTextCursor.js +1 -1
  578. package/lib/feature-libraries/treeTextCursor.js.map +1 -1
  579. package/lib/index.d.ts +2 -2
  580. package/lib/index.d.ts.map +1 -1
  581. package/lib/index.js +0 -2
  582. package/lib/index.js.map +1 -1
  583. package/lib/packageVersion.d.ts +1 -1
  584. package/lib/packageVersion.d.ts.map +1 -1
  585. package/lib/packageVersion.js +1 -1
  586. package/lib/packageVersion.js.map +1 -1
  587. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  588. package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -1
  589. package/lib/shared-tree/independentView.d.ts +1 -1
  590. package/lib/shared-tree/independentView.d.ts.map +1 -1
  591. package/lib/shared-tree/independentView.js +10 -5
  592. package/lib/shared-tree/independentView.js.map +1 -1
  593. package/lib/shared-tree/index.d.ts +1 -1
  594. package/lib/shared-tree/index.d.ts.map +1 -1
  595. package/lib/shared-tree/index.js +1 -1
  596. package/lib/shared-tree/index.js.map +1 -1
  597. package/lib/shared-tree/schematizeTree.d.ts +1 -1
  598. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  599. package/lib/shared-tree/schematizeTree.js.map +1 -1
  600. package/lib/shared-tree/schematizingTreeView.d.ts +1 -1
  601. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  602. package/lib/shared-tree/schematizingTreeView.js +1 -1
  603. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  604. package/lib/shared-tree/sharedTree.d.ts +3 -3
  605. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  606. package/lib/shared-tree/sharedTree.js +10 -10
  607. package/lib/shared-tree/sharedTree.js.map +1 -1
  608. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +1 -1
  609. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  610. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  611. package/lib/shared-tree/tree.js +1 -1
  612. package/lib/shared-tree/tree.js.map +1 -1
  613. package/lib/shared-tree/treeAlpha.d.ts +76 -2
  614. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  615. package/lib/shared-tree/treeAlpha.js +50 -4
  616. package/lib/shared-tree/treeAlpha.js.map +1 -1
  617. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  618. package/lib/shared-tree/treeCheckout.js +3 -2
  619. package/lib/shared-tree/treeCheckout.js.map +1 -1
  620. package/lib/shared-tree-core/branch.d.ts +2 -2
  621. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  622. package/lib/shared-tree-core/branch.js +2 -2
  623. package/lib/shared-tree-core/branch.js.map +1 -1
  624. package/lib/shared-tree-core/branchCommitEnricher.d.ts +1 -1
  625. package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  626. package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
  627. package/lib/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  628. package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  629. package/lib/shared-tree-core/editManager.d.ts +3 -1
  630. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  631. package/lib/shared-tree-core/editManager.js +4 -2
  632. package/lib/shared-tree-core/editManager.js.map +1 -1
  633. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  634. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  635. package/lib/shared-tree-core/editManagerSummarizer.d.ts +1 -1
  636. package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  637. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  638. package/lib/shared-tree-core/messageCodecs.d.ts +1 -1
  639. package/lib/shared-tree-core/messageCodecs.js +1 -1
  640. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  641. package/lib/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  642. package/lib/shared-tree-core/sequenceIdUtils.js.map +1 -1
  643. package/lib/shared-tree-core/sharedTreeCore.d.ts +2 -2
  644. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  645. package/lib/shared-tree-core/sharedTreeCore.js +4 -4
  646. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  647. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  648. package/lib/shared-tree-core/transaction.js +1 -1
  649. package/lib/shared-tree-core/transaction.js.map +1 -1
  650. package/lib/shared-tree-core/transactionEnricher.d.ts.map +1 -1
  651. package/lib/shared-tree-core/transactionEnricher.js.map +1 -1
  652. package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
  653. package/lib/simple-tree/api/conciseTree.js +1 -1
  654. package/lib/simple-tree/api/conciseTree.js.map +1 -1
  655. package/lib/simple-tree/api/configuration.js +1 -1
  656. package/lib/simple-tree/api/configuration.js.map +1 -1
  657. package/lib/simple-tree/api/create.d.ts +2 -26
  658. package/lib/simple-tree/api/create.d.ts.map +1 -1
  659. package/lib/simple-tree/api/create.js +2 -37
  660. package/lib/simple-tree/api/create.js.map +1 -1
  661. package/lib/simple-tree/api/customTree.d.ts +1 -1
  662. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  663. package/lib/simple-tree/api/customTree.js +3 -3
  664. package/lib/simple-tree/api/customTree.js.map +1 -1
  665. package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  666. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
  667. package/lib/simple-tree/api/identifierIndex.js +1 -1
  668. package/lib/simple-tree/api/identifierIndex.js.map +1 -1
  669. package/lib/simple-tree/api/index.d.ts +2 -3
  670. package/lib/simple-tree/api/index.d.ts.map +1 -1
  671. package/lib/simple-tree/api/index.js +2 -5
  672. package/lib/simple-tree/api/index.js.map +1 -1
  673. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  674. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  675. package/lib/simple-tree/api/schemaFactory.d.ts +5 -5
  676. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  677. package/lib/simple-tree/api/schemaFactory.js +5 -5
  678. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  679. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +1 -3
  680. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  681. package/lib/simple-tree/api/schemaFactoryAlpha.js +1 -3
  682. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  683. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +2 -2
  684. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  685. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  686. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  687. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  688. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts +1 -1
  689. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  690. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +1 -3
  691. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  692. package/lib/simple-tree/api/storedSchema.d.ts +1 -1
  693. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  694. package/lib/simple-tree/api/storedSchema.js +3 -2
  695. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  696. package/lib/simple-tree/api/tree.d.ts +2 -2
  697. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  698. package/lib/simple-tree/api/tree.js.map +1 -1
  699. package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
  700. package/lib/simple-tree/api/treeBeta.js +1 -1
  701. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  702. package/lib/simple-tree/api/treeNodeApi.d.ts +30 -3
  703. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  704. package/lib/simple-tree/api/treeNodeApi.js +37 -26
  705. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  706. package/lib/simple-tree/api/typesUnsafe.d.ts +1 -1
  707. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  708. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  709. package/lib/simple-tree/api/verboseTree.js +1 -1
  710. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  711. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  712. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +1 -3
  713. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  714. package/lib/simple-tree/core/context.d.ts.map +1 -1
  715. package/lib/simple-tree/core/context.js.map +1 -1
  716. package/lib/simple-tree/core/getOrCreateNode.d.ts +1 -1
  717. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  718. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  719. package/lib/simple-tree/core/treeNode.d.ts.map +1 -1
  720. package/lib/simple-tree/core/treeNode.js +1 -1
  721. package/lib/simple-tree/core/treeNode.js.map +1 -1
  722. package/lib/simple-tree/core/treeNodeKernel.d.ts +3 -3
  723. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  724. package/lib/simple-tree/core/treeNodeKernel.js +2 -2
  725. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  726. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  727. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  728. package/lib/simple-tree/core/types.d.ts.map +1 -1
  729. package/lib/simple-tree/core/types.js.map +1 -1
  730. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  731. package/lib/simple-tree/core/unhydratedFlexTree.js +3 -3
  732. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  733. package/lib/simple-tree/core/withType.d.ts +1 -1
  734. package/lib/simple-tree/core/withType.d.ts.map +1 -1
  735. package/lib/simple-tree/core/withType.js.map +1 -1
  736. package/lib/simple-tree/createContext.d.ts.map +1 -1
  737. package/lib/simple-tree/createContext.js.map +1 -1
  738. package/lib/simple-tree/getTreeNodeForField.d.ts.map +1 -1
  739. package/lib/simple-tree/getTreeNodeForField.js.map +1 -1
  740. package/lib/simple-tree/index.d.ts +2 -9
  741. package/lib/simple-tree/index.d.ts.map +1 -1
  742. package/lib/simple-tree/index.js +2 -6
  743. package/lib/simple-tree/index.js.map +1 -1
  744. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  745. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  746. package/lib/simple-tree/{arrayNode.d.ts → node-kinds/array/arrayNode.d.ts} +3 -3
  747. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -0
  748. package/lib/simple-tree/{arrayNode.js → node-kinds/array/arrayNode.js} +9 -9
  749. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -0
  750. package/lib/simple-tree/{arrayNodeTypes.d.ts → node-kinds/array/arrayNodeTypes.d.ts} +3 -3
  751. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -0
  752. package/lib/simple-tree/{arrayNodeTypes.js → node-kinds/array/arrayNodeTypes.js} +1 -1
  753. package/{dist/simple-tree → lib/simple-tree/node-kinds/array}/arrayNodeTypes.js.map +1 -1
  754. package/lib/simple-tree/node-kinds/array/index.d.ts +7 -0
  755. package/lib/simple-tree/node-kinds/array/index.d.ts.map +1 -0
  756. package/lib/simple-tree/node-kinds/array/index.js +7 -0
  757. package/lib/simple-tree/node-kinds/array/index.js.map +1 -0
  758. package/lib/simple-tree/node-kinds/index.d.ts +8 -0
  759. package/lib/simple-tree/node-kinds/index.d.ts.map +1 -0
  760. package/lib/simple-tree/node-kinds/index.js +8 -0
  761. package/lib/simple-tree/node-kinds/index.js.map +1 -0
  762. package/lib/simple-tree/node-kinds/map/index.d.ts +7 -0
  763. package/lib/simple-tree/node-kinds/map/index.d.ts.map +1 -0
  764. package/lib/simple-tree/node-kinds/map/index.js +7 -0
  765. package/lib/simple-tree/node-kinds/map/index.js.map +1 -0
  766. package/{dist/simple-tree → lib/simple-tree/node-kinds/map}/mapNode.d.ts +3 -3
  767. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -0
  768. package/lib/simple-tree/{mapNode.js → node-kinds/map/mapNode.js} +8 -8
  769. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -0
  770. package/lib/simple-tree/{mapNodeTypes.d.ts → node-kinds/map/mapNodeTypes.d.ts} +3 -3
  771. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -0
  772. package/lib/simple-tree/{mapNodeTypes.js → node-kinds/map/mapNodeTypes.js} +1 -1
  773. package/lib/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -0
  774. package/lib/simple-tree/node-kinds/object/index.d.ts +7 -0
  775. package/lib/simple-tree/node-kinds/object/index.d.ts.map +1 -0
  776. package/lib/simple-tree/node-kinds/object/index.js +7 -0
  777. package/lib/simple-tree/node-kinds/object/index.js.map +1 -0
  778. package/{dist/simple-tree → lib/simple-tree/node-kinds/object}/objectNode.d.ts +17 -6
  779. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -0
  780. package/lib/simple-tree/{objectNode.js → node-kinds/object/objectNode.js} +35 -13
  781. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -0
  782. package/{dist/simple-tree → lib/simple-tree/node-kinds/object}/objectNodeTypes.d.ts +5 -5
  783. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -0
  784. package/lib/simple-tree/{objectNodeTypes.js → node-kinds/object/objectNodeTypes.js} +1 -1
  785. package/lib/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -0
  786. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  787. package/lib/simple-tree/schemaTypes.d.ts +2 -2
  788. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  789. package/lib/simple-tree/schemaTypes.js.map +1 -1
  790. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  791. package/lib/simple-tree/simpleSchema.js.map +1 -1
  792. package/lib/simple-tree/toMapTree.d.ts +1 -16
  793. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  794. package/lib/simple-tree/toMapTree.js +41 -1
  795. package/lib/simple-tree/toMapTree.js.map +1 -1
  796. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  797. package/lib/simple-tree/toStoredSchema.js +1 -1
  798. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  799. package/lib/simple-tree/treeNodeValid.d.ts +1 -1
  800. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  801. package/lib/simple-tree/treeNodeValid.js +2 -2
  802. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  803. package/lib/simple-tree/walkFieldSchema.d.ts.map +1 -1
  804. package/lib/simple-tree/walkFieldSchema.js.map +1 -1
  805. package/lib/tableSchema.d.ts +10 -10
  806. package/lib/treeFactory.d.ts +1 -1
  807. package/lib/treeFactory.js +1 -1
  808. package/lib/treeFactory.js.map +1 -1
  809. package/lib/util/bTreeUtils.d.ts.map +1 -1
  810. package/lib/util/bTreeUtils.js.map +1 -1
  811. package/lib/util/breakable.d.ts +23 -4
  812. package/lib/util/breakable.d.ts.map +1 -1
  813. package/lib/util/breakable.js +12 -3
  814. package/lib/util/breakable.js.map +1 -1
  815. package/package.json +21 -21
  816. package/src/codec/codec.ts +13 -3
  817. package/src/core/index.ts +1 -0
  818. package/src/core/rebase/types.ts +2 -2
  819. package/src/core/rebase/utils.ts +10 -10
  820. package/src/core/schema-stored/formatV1.ts +0 -2
  821. package/src/core/schema-stored/index.ts +1 -0
  822. package/src/core/schema-stored/schema.ts +7 -0
  823. package/src/core/tree/anchorSet.ts +2 -1
  824. package/src/core/tree/pathTree.ts +12 -11
  825. package/src/core/tree/treeTextFormat.ts +1 -1
  826. package/src/feature-libraries/chunked-forest/chunkedForest.ts +1 -1
  827. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +1 -1
  828. package/src/feature-libraries/default-schema/index.ts +1 -1
  829. package/src/feature-libraries/default-schema/schemaChecker.ts +44 -29
  830. package/src/feature-libraries/flex-tree/context.ts +29 -8
  831. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +3 -2
  832. package/src/feature-libraries/flex-tree/lazyField.ts +1 -1
  833. package/src/feature-libraries/flex-tree/utilities.ts +1 -1
  834. package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -1
  835. package/src/feature-libraries/index.ts +1 -2
  836. package/src/feature-libraries/indexing/anchorTreeIndex.ts +4 -2
  837. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +1 -0
  838. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +1 -1
  839. package/src/feature-libraries/modular-schema/fieldKindWithEditor.ts +1 -1
  840. package/src/feature-libraries/modular-schema/genericFieldKind.ts +4 -2
  841. package/src/feature-libraries/modular-schema/genericFieldKindCodecs.ts +1 -0
  842. package/src/feature-libraries/modular-schema/genericFieldKindTypes.ts +1 -0
  843. package/src/feature-libraries/modular-schema/isNeverTree.ts +0 -2
  844. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +1 -1
  845. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +2 -0
  846. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +1 -0
  847. package/src/feature-libraries/node-identifier/mockNodeIdentifierManager.ts +11 -5
  848. package/src/feature-libraries/object-forest/objectForest.ts +65 -7
  849. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +5 -8
  850. package/src/feature-libraries/schema-index/codec.ts +13 -21
  851. package/src/feature-libraries/schema-index/formatV1.ts +2 -2
  852. package/src/feature-libraries/schema-index/index.ts +0 -1
  853. package/src/feature-libraries/schema-index/schemaSummarizer.ts +1 -1
  854. package/src/feature-libraries/sequence-field/formatV3.ts +1 -0
  855. package/src/feature-libraries/sequence-field/markQueue.ts +1 -0
  856. package/src/feature-libraries/sequence-field/prune.ts +1 -0
  857. package/src/feature-libraries/sequence-field/rebase.ts +1 -1
  858. package/src/feature-libraries/sequence-field/relevantRemovedRoots.ts +1 -1
  859. package/src/feature-libraries/sequence-field/replaceRevisions.ts +3 -1
  860. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +2 -2
  861. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +3 -3
  862. package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +3 -3
  863. package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +2 -2
  864. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +1 -1
  865. package/src/feature-libraries/sequence-field/utils.ts +7 -5
  866. package/src/feature-libraries/treeCursorUtils.ts +2 -2
  867. package/src/feature-libraries/treeTextCursor.ts +1 -1
  868. package/src/index.ts +1 -4
  869. package/src/packageVersion.ts +1 -1
  870. package/src/shared-tree/checkoutFlexTreeView.ts +1 -0
  871. package/src/shared-tree/independentView.ts +10 -3
  872. package/src/shared-tree/index.ts +4 -1
  873. package/src/shared-tree/schematizeTree.ts +2 -1
  874. package/src/shared-tree/schematizingTreeView.ts +2 -2
  875. package/src/shared-tree/sharedTree.ts +26 -19
  876. package/src/shared-tree/sharedTreeChangeFamily.ts +1 -1
  877. package/src/shared-tree/tree.ts +1 -1
  878. package/src/shared-tree/treeAlpha.ts +142 -18
  879. package/src/shared-tree/treeCheckout.ts +3 -2
  880. package/src/shared-tree-core/branch.ts +3 -4
  881. package/src/shared-tree-core/branchCommitEnricher.ts +3 -1
  882. package/src/shared-tree-core/defaultResubmitMachine.ts +2 -0
  883. package/src/shared-tree-core/editManager.ts +4 -2
  884. package/src/shared-tree-core/editManagerCodecs.ts +1 -0
  885. package/src/shared-tree-core/editManagerSummarizer.ts +1 -1
  886. package/src/shared-tree-core/messageCodecs.ts +1 -1
  887. package/src/shared-tree-core/sequenceIdUtils.ts +1 -0
  888. package/src/shared-tree-core/sharedTreeCore.ts +5 -5
  889. package/src/shared-tree-core/transaction.ts +4 -2
  890. package/src/shared-tree-core/transactionEnricher.ts +2 -0
  891. package/src/simple-tree/api/conciseTree.ts +3 -2
  892. package/src/simple-tree/api/configuration.ts +1 -1
  893. package/src/simple-tree/api/create.ts +3 -80
  894. package/src/simple-tree/api/customTree.ts +4 -4
  895. package/src/simple-tree/api/getSimpleSchema.ts +1 -0
  896. package/src/simple-tree/api/identifierIndex.ts +1 -1
  897. package/src/simple-tree/api/index.ts +1 -10
  898. package/src/simple-tree/api/schemaCompatibilityTester.ts +2 -0
  899. package/src/simple-tree/api/schemaFactory.ts +28 -23
  900. package/src/simple-tree/api/schemaFactoryAlpha.ts +8 -6
  901. package/src/simple-tree/api/schemaFactoryRecursive.ts +3 -3
  902. package/src/simple-tree/api/schemaFromSimple.ts +3 -1
  903. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +1 -3
  904. package/src/simple-tree/api/storedSchema.ts +5 -4
  905. package/src/simple-tree/api/tree.ts +3 -4
  906. package/src/simple-tree/api/treeBeta.ts +3 -2
  907. package/src/simple-tree/api/treeNodeApi.ts +89 -40
  908. package/src/simple-tree/api/typesUnsafe.ts +1 -1
  909. package/src/simple-tree/api/verboseTree.ts +1 -1
  910. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +1 -3
  911. package/src/simple-tree/core/context.ts +1 -0
  912. package/src/simple-tree/core/getOrCreateNode.ts +2 -1
  913. package/src/simple-tree/core/treeNode.ts +1 -1
  914. package/src/simple-tree/core/treeNodeKernel.ts +10 -8
  915. package/src/simple-tree/core/treeNodeSchema.ts +1 -0
  916. package/src/simple-tree/core/types.ts +1 -1
  917. package/src/simple-tree/core/unhydratedFlexTree.ts +4 -3
  918. package/src/simple-tree/core/withType.ts +1 -1
  919. package/src/simple-tree/createContext.ts +1 -0
  920. package/src/simple-tree/getTreeNodeForField.ts +2 -0
  921. package/src/simple-tree/index.ts +14 -21
  922. package/src/simple-tree/leafNodeSchema.ts +1 -0
  923. package/src/simple-tree/{arrayNode.ts → node-kinds/array/arrayNode.ts} +10 -10
  924. package/src/simple-tree/{arrayNodeTypes.ts → node-kinds/array/arrayNodeTypes.ts} +3 -3
  925. package/src/simple-tree/node-kinds/array/index.ts +18 -0
  926. package/src/simple-tree/node-kinds/index.ts +40 -0
  927. package/src/simple-tree/node-kinds/map/index.ts +16 -0
  928. package/src/simple-tree/{mapNode.ts → node-kinds/map/mapNode.ts} +10 -10
  929. package/src/simple-tree/{mapNodeTypes.ts → node-kinds/map/mapNodeTypes.ts} +3 -3
  930. package/src/simple-tree/node-kinds/object/index.ts +17 -0
  931. package/src/simple-tree/{objectNode.ts → node-kinds/object/objectNode.ts} +63 -34
  932. package/src/simple-tree/{objectNodeTypes.ts → node-kinds/object/objectNodeTypes.ts} +5 -5
  933. package/src/simple-tree/prepareForInsertion.ts +1 -1
  934. package/src/simple-tree/schemaTypes.ts +4 -3
  935. package/src/simple-tree/simpleSchema.ts +1 -0
  936. package/src/simple-tree/toMapTree.ts +11 -30
  937. package/src/simple-tree/toStoredSchema.ts +3 -2
  938. package/src/simple-tree/treeNodeValid.ts +3 -3
  939. package/src/simple-tree/walkFieldSchema.ts +0 -1
  940. package/src/treeFactory.ts +1 -1
  941. package/src/util/bTreeUtils.ts +1 -0
  942. package/src/util/breakable.ts +19 -4
  943. package/dist/simple-tree/api/testRecursiveDomain.d.ts +0 -62
  944. package/dist/simple-tree/api/testRecursiveDomain.d.ts.map +0 -1
  945. package/dist/simple-tree/api/testRecursiveDomain.js +0 -45
  946. package/dist/simple-tree/api/testRecursiveDomain.js.map +0 -1
  947. package/dist/simple-tree/arrayNode.d.ts.map +0 -1
  948. package/dist/simple-tree/arrayNode.js.map +0 -1
  949. package/dist/simple-tree/arrayNodeTypes.d.ts.map +0 -1
  950. package/dist/simple-tree/mapNode.d.ts.map +0 -1
  951. package/dist/simple-tree/mapNode.js.map +0 -1
  952. package/dist/simple-tree/mapNodeTypes.d.ts.map +0 -1
  953. package/dist/simple-tree/mapNodeTypes.js.map +0 -1
  954. package/dist/simple-tree/objectNode.d.ts.map +0 -1
  955. package/dist/simple-tree/objectNode.js.map +0 -1
  956. package/dist/simple-tree/objectNodeTypes.d.ts.map +0 -1
  957. package/dist/simple-tree/objectNodeTypes.js.map +0 -1
  958. package/lib/simple-tree/api/testRecursiveDomain.d.ts +0 -62
  959. package/lib/simple-tree/api/testRecursiveDomain.d.ts.map +0 -1
  960. package/lib/simple-tree/api/testRecursiveDomain.js +0 -41
  961. package/lib/simple-tree/api/testRecursiveDomain.js.map +0 -1
  962. package/lib/simple-tree/arrayNode.d.ts.map +0 -1
  963. package/lib/simple-tree/arrayNode.js.map +0 -1
  964. package/lib/simple-tree/arrayNodeTypes.d.ts.map +0 -1
  965. package/lib/simple-tree/arrayNodeTypes.js.map +0 -1
  966. package/lib/simple-tree/mapNode.d.ts.map +0 -1
  967. package/lib/simple-tree/mapNode.js.map +0 -1
  968. package/lib/simple-tree/mapNodeTypes.d.ts.map +0 -1
  969. package/lib/simple-tree/mapNodeTypes.js.map +0 -1
  970. package/lib/simple-tree/objectNode.d.ts.map +0 -1
  971. package/lib/simple-tree/objectNode.js.map +0 -1
  972. package/lib/simple-tree/objectNodeTypes.d.ts.map +0 -1
  973. package/lib/simple-tree/objectNodeTypes.js.map +0 -1
  974. package/src/simple-tree/api/testRecursiveDomain.ts +0 -53
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../src/simple-tree/api/configuration.ts"],"names":[],"mappings":";AAAA;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AAM,CAAC,IAAI,CACV,0BAA0B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,mEAAmE,WAAW,CAAC,iBAAiB,CAAC,oIAAoI,CAChS,CAAC;QACH,CAAC;IACF,CAAC;AACF,CAAC;AAtFD,gCAsFC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype FieldSchemaAlpha,\n\ttype ImplicitFieldSchema,\n\tFieldKind,\n\tmarkSchemaMostDerived,\n\tnormalizeFieldSchema,\n} from \"../schemaTypes.js\";\nimport { NodeKind, type TreeNodeSchema } from \"../core/index.js\";\nimport { toStoredSchema } from \"../toStoredSchema.js\";\nimport { LeafNodeSchema } from \"../leafNodeSchema.js\";\nimport { isObjectNodeSchema, type ObjectNodeSchema } from \"../objectNodeTypes.js\";\nimport { getOrCreate } from \"../../util/index.js\";\nimport type { MakeNominal } from \"../../util/index.js\";\nimport { walkFieldSchema } from \"../walkFieldSchema.js\";\nimport type { SimpleNodeSchema, SimpleTreeSchema } from \"../simpleSchema.js\";\n\n/**\n * Options when constructing a tree view.\n * @public\n */\nexport interface ITreeConfigurationOptions {\n\t/**\n\t * If `true`, the tree will validate new content against its stored schema at insertion time\n\t * and throw an error if the new content doesn't match the expected schema.\n\t *\n\t * @defaultValue `false`.\n\t *\n\t * @remarks Enabling schema validation has a performance penalty when inserting new content into the tree because\n\t * additional checks are done. Enable this option only in scenarios where you are ok with that operation being a\n\t * bit slower.\n\t */\n\tenableSchemaValidation?: boolean;\n\n\t/**\n\t * A flag used to opt into strict rules ensuring that the schema avoids cases which can make the type of nodes ambiguous when importing or exporting data.\n\t * @defaultValue `false`.\n\t *\n\t * @remarks\n\t * When this is true, it ensures that the compile time type safety for data when constructing nodes is sufficient to ensure that the runtime behavior will not give node data ambiguity errors.\n\t *\n\t * This ensures that the canonical JSON-like representation of all unions in the tree are lossless and unambiguous.\n\t * This canonical JSON-like representation consists of arrays, plain old JavaScript objects with string keys, booleans, numbers (excluding NaN, -0 and infinities), strings, null and {@link @fluidframework/core-interfaces#IFluidHandle}s.\n\t * It is compatible with the node creation APIs (such as schema class constructors) and is also compatible with JSON assuming any IFluidHandles get special handling (since they are not JSON compatible).\n\t * Currently these cases can cause ambiguity in a union:\n\t *\n\t * - More than one ArrayNode type: it's impossible to tell which array type is intended in the case of empty arrays (`[]`).\n\t *\n\t * - More than one MapNode type: it's impossible to tell which map type is intended in the case of an empty map (`{}`).\n\t *\n\t * - Both a MapNode and an ArrayNode: this case is not a problem for the canonical JSON representation, but is an issue when constructing from an Iterable, which is supported for both MapNode and ArrayNode.\n\t *\n\t * - Both a MapNode and an ObjectNode: when the input is valid for the ObjectNode, the current parser always considers it ambiguous with being a MapNode.\n\t *\n\t * - ObjectNodes which have fields (required or optional) which include all required fields of another ObjectNode: currently each ObjectNode is differentiated by the presence of its required fields.\n\t *\n\t * This check is conservative: some complex cases may error if the current simple algorithm cannot show no ambiguity is possible.\n\t * This check may become more permissive over time.\n\t *\n\t * @example Ambiguous schema (with `preventAmbiguity: false`), and how to disambiguate it using {@link Unhydrated} nodes:\n\t * ```typescript\n\t * const schemaFactory = new SchemaFactory(\"com.example\");\n\t * class Feet extends schemaFactory.object(\"Feet\", { length: schemaFactory.number }) {}\n\t * class Meters extends schemaFactory.object(\"Meters\", { length: schemaFactory.number }) {}\n\t * const config = new TreeViewConfiguration({\n\t * \t// This combination of schema can lead to ambiguous cases and will error if `preventAmbiguity` is true.\n\t * \tschema: [Feet, Meters],\n\t * \tpreventAmbiguity: false,\n\t * });\n\t * const view = tree.viewWith(config);\n\t * // This is invalid since it is ambiguous which type of node is being constructed:\n\t * // view.initialize({ length: 5 });\n\t * // To work, an explicit type can be provided by using an {@link Unhydrated} Node:\n\t * view.initialize(new Meters({ length: 5 }));\n\t * ```\n\t *\n\t * @example Schema disambiguated by adjusting field names, validated with `preventAmbiguity: true:`\n\t * ```typescript\n\t * const schemaFactory = new SchemaFactory(\"com.example\");\n\t * class Feet extends schemaFactory.object(\"Feet\", { length: schemaFactory.number }) {}\n\t * class Meters extends schemaFactory.object(\"Meters\", {\n\t * \t// To avoid ambiguity when parsing unions of Feet and Meters, this renames the length field to \"meters\".\n\t * \t// To preserve compatibility with existing data from the ambiguous case,\n\t * \t// `{ key: \"length\" }` is set, so when persisted in the tree \"length\" is used as the field name.\n\t * \tmeters: schemaFactory.required(schemaFactory.number, { key: \"length\" }),\n\t * }) {}\n\t * const config = new TreeViewConfiguration({\n\t * \t// This combination of schema is not ambiguous because `Feet` and `Meters` have different required keys.\n\t * \tschema: [Feet, Meters],\n\t * \tpreventAmbiguity: true,\n\t * });\n\t * const view = tree.viewWith(config);\n\t * // This now works, since the field is sufficient to determine this is a `Meters` node.\n\t * view.initialize({ meters: 5 });\n\t * ```\n\t *\n\t * @privateRemarks\n\t * In the future, we can support lossless round tripping via the canonical JSON-like representation above when unambiguous.\n\t * This could be done via methods added to `Tree` to export and import such objects, which would give us a place to explicitly define the type of this representation.\n\t *\n\t * To make this more permissive in the future we can:\n\t *\n\t * - Make toMapTree more permissive (ex: allow disambiguation based on leaf type)\n\t * - Update this check to more tightly match toMapTree\n\t * - Add options to help schema authors disambiguate their types, such as \"constant fields\" which are not persisted, and always have a constant value.\n\t *\n\t * The above examples exist in executable form in this files tests, and should be updated there then copied back here.\n\t */\n\treadonly preventAmbiguity?: boolean;\n}\n\nconst defaultTreeConfigurationOptions: Required<ITreeConfigurationOptions> = {\n\tenableSchemaValidation: false,\n\tpreventAmbiguity: false,\n};\n\n/**\n * Property-bag configuration for {@link TreeViewConfiguration} construction.\n * @public\n */\nexport interface ITreeViewConfiguration<\n\tTSchema extends ImplicitFieldSchema = ImplicitFieldSchema,\n> extends ITreeConfigurationOptions {\n\t/**\n\t * The schema which the application wants to view the tree with.\n\t */\n\treadonly schema: TSchema;\n}\n\n/**\n * Configuration for {@link ViewableTree.viewWith}.\n * @sealed @public\n */\nexport class TreeViewConfiguration<\n\tconst TSchema extends ImplicitFieldSchema = ImplicitFieldSchema,\n> implements Required<ITreeViewConfiguration<TSchema>>\n{\n\tprotected _typeCheck!: MakeNominal;\n\n\t/**\n\t * {@inheritDoc ITreeViewConfiguration.schema}\n\t */\n\tpublic readonly schema: TSchema;\n\n\t/**\n\t * {@inheritDoc ITreeConfigurationOptions.enableSchemaValidation}\n\t */\n\tpublic readonly enableSchemaValidation: boolean;\n\n\t/**\n\t * {@inheritDoc ITreeConfigurationOptions.preventAmbiguity}\n\t */\n\tpublic readonly preventAmbiguity: boolean;\n\n\t/**\n\t * Construct a new {@link TreeViewConfiguration}.\n\t *\n\t * @param props - Property bag of configuration options.\n\t *\n\t * @remarks\n\t * Performing this construction deeply validates the provided schema.\n\t * This means that when this constructor is called, all {@link LazyItem} {@link TreeNodeSchema} references will be evaluated (using {@link evaluateLazySchema}).\n\t * This means that the declarations for all transitively reachable {@link TreeNodeSchema} must be available at this time.\n\t *\n\t * For example, a schema reachable from this configuration cannot reference this configuration during its declaration,\n\t * since this would be a cyclic dependency that will cause an error when constructing this configuration.\n\t */\n\tpublic constructor(props: ITreeViewConfiguration<TSchema>) {\n\t\tconst config = { ...defaultTreeConfigurationOptions, ...props };\n\t\tthis.schema = config.schema;\n\t\tthis.enableSchemaValidation = config.enableSchemaValidation;\n\t\tthis.preventAmbiguity = config.preventAmbiguity;\n\n\t\t// Ambiguity errors are lower priority to report than invalid schema errors, so collect these in an array and report them all at once.\n\t\tconst ambiguityErrors: string[] = [];\n\n\t\twalkFieldSchema(config.schema, {\n\t\t\t// Ensure all reachable schema are marked as most derived.\n\t\t\t// This ensures if multiple schema extending the same schema factory generated class are present (or have been constructed, or get constructed in the future),\n\t\t\t// an error is reported.\n\n\t\t\tnode: (schema) => markSchemaMostDerived(schema, true),\n\t\t\tallowedTypes(types): void {\n\t\t\t\tif (config.preventAmbiguity) {\n\t\t\t\t\tcheckUnion(types, ambiguityErrors);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\n\t\tif (ambiguityErrors.length !== 0) {\n\t\t\t// Duplicate errors are common since when two types conflict, both orders error:\n\t\t\tconst deduplicated = new Set(ambiguityErrors);\n\t\t\tthrow new UsageError(`Ambiguous schema found:\\n${[...deduplicated].join(\"\\n\")}`);\n\t\t}\n\n\t\t// Eagerly perform this conversion to surface errors sooner.\n\t\ttoStoredSchema(config.schema);\n\t}\n}\n\n/**\n * {@link TreeViewConfiguration} extended with some alpha APIs.\n * @sealed @alpha\n */\nexport class TreeViewConfigurationAlpha<\n\t\tconst TSchema extends ImplicitFieldSchema = ImplicitFieldSchema,\n\t>\n\textends TreeViewConfiguration<TSchema>\n\timplements TreeSchema\n{\n\t/**\n\t * {@inheritDoc TreeSchema.root}\n\t */\n\tpublic readonly root: FieldSchemaAlpha;\n\t/**\n\t * {@inheritDoc TreeSchema.definitions}\n\t */\n\tpublic readonly definitions: ReadonlyMap<string, SimpleNodeSchema & TreeNodeSchema>;\n\n\tpublic constructor(props: ITreeViewConfiguration<TSchema>) {\n\t\tsuper(props);\n\t\tthis.root = normalizeFieldSchema(props.schema);\n\t\tconst definitions = new Map<string, SimpleNodeSchema & TreeNodeSchema>();\n\t\twalkFieldSchema(props.schema, {\n\t\t\tnode: (schema) =>\n\t\t\t\tdefinitions.set(schema.identifier, schema as SimpleNodeSchema & TreeNodeSchema),\n\t\t});\n\t\tthis.definitions = definitions;\n\t}\n}\n\n/**\n * {@link TreeViewConfigurationAlpha}\n * @sealed @alpha\n */\nexport interface TreeSchema extends SimpleTreeSchema {\n\t/**\n\t * {@inheritDoc SimpleTreeSchema.root}\n\t */\n\treadonly root: FieldSchemaAlpha;\n\n\t/**\n\t * {@inheritDoc SimpleTreeSchema.definitions}\n\t */\n\treadonly definitions: ReadonlyMap<string, SimpleNodeSchema & TreeNodeSchema>;\n}\n\n/**\n * Pretty print a set of types for use in error messages.\n */\nfunction formatTypes(allowed: Iterable<TreeNodeSchema>): string {\n\t// Use JSON.stringify to quote and escape identifiers.\n\t// Don't just use a single array JSON.stringify since that omits spaces between items\n\treturn `[${Array.from(allowed, (s) => JSON.stringify(s.identifier)).join(\", \")}]`;\n}\n\n/**\n * Detect cases documented in {@link ITreeConfigurationOptions.preventAmbiguity}.\n */\nexport function checkUnion(union: Iterable<TreeNodeSchema>, errors: string[]): void {\n\tconst checked: Set<TreeNodeSchema> = new Set();\n\tconst maps: TreeNodeSchema[] = [];\n\tconst arrays: TreeNodeSchema[] = [];\n\n\tconst objects: ObjectNodeSchema[] = [];\n\t// Map from key to schema using that key\n\tconst allObjectKeys: Map<string, Set<TreeNodeSchema>> = new Map();\n\n\tfor (const schema of union) {\n\t\tif (checked.has(schema)) {\n\t\t\tthrow new UsageError(`Duplicate schema in allowed types: ${schema.identifier}`);\n\t\t}\n\t\tchecked.add(schema);\n\n\t\tif (schema instanceof LeafNodeSchema) {\n\t\t\t// nothing to do\n\t\t} else if (isObjectNodeSchema(schema)) {\n\t\t\tobjects.push(schema);\n\t\t\tfor (const key of schema.fields.keys()) {\n\t\t\t\tgetOrCreate(allObjectKeys, key, () => new Set()).add(schema);\n\t\t\t}\n\t\t} else if (schema.kind === NodeKind.Array) {\n\t\t\tarrays.push(schema);\n\t\t} else {\n\t\t\tassert(schema.kind === NodeKind.Map, 0x9e7 /* invalid schema */);\n\t\t\tmaps.push(schema);\n\t\t}\n\t}\n\n\tif (arrays.length > 1) {\n\t\terrors.push(\n\t\t\t`More than one kind of array allowed within union (${formatTypes(arrays)}). This would require type disambiguation which is not supported by arrays during import or export.`,\n\t\t);\n\t}\n\n\tif (maps.length > 1) {\n\t\terrors.push(\n\t\t\t`More than one kind of map allowed within union (${formatTypes(maps)}). This would require type disambiguation which is not supported by maps during import or export.`,\n\t\t);\n\t}\n\n\tif (maps.length > 0 && arrays.length > 0) {\n\t\terrors.push(\n\t\t\t`Both a map and an array allowed within union (${formatTypes([...arrays, ...maps])}). Both can be implicitly constructed from iterables like arrays, which are ambiguous when the array is empty.`,\n\t\t);\n\t}\n\n\tif (objects.length > 0 && maps.length > 0) {\n\t\terrors.push(\n\t\t\t`Both a object and a map allowed within union (${formatTypes([...objects, ...maps])}). Both can be constructed from objects and can be ambiguous.`,\n\t\t);\n\t}\n\n\t// Check for objects which fully overlap:\n\tfor (const schema of objects) {\n\t\t// All objects which might be ambiguous relative to `schema`.\n\t\tconst possiblyAmbiguous = new Set(objects);\n\n\t\t// A schema can't be ambiguous with itself\n\t\tpossiblyAmbiguous.delete(schema);\n\n\t\t// For each field of schema, remove schema from possiblyAmbiguous that do not have that field\n\t\tfor (const [key, field] of schema.fields) {\n\t\t\tif (field.kind === FieldKind.Required) {\n\t\t\t\tconst withKey = allObjectKeys.get(key) ?? fail(0xb35 /* missing schema */);\n\t\t\t\tfor (const candidate of possiblyAmbiguous) {\n\t\t\t\t\tif (!withKey.has(candidate)) {\n\t\t\t\t\t\tpossiblyAmbiguous.delete(candidate);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (possiblyAmbiguous.size > 0) {\n\t\t\t// TODO: make this check more permissive.\n\t\t\t// Allow using the type of the field to disambiguate, at least for leaf types.\n\t\t\t// Add \"constant\" fields which can be used to disambiguate even more cases without adding persisted data: maybe make them optional in constructor?\n\t\t\t// Consider separating unambiguous implicit construction format from constructor arguments at type level, allowing constructor to superset the implicit construction options (ex: optional constant fields).\n\t\t\t// The policy here however must remain at least as conservative as shallowCompatibilityTest in src/simple-tree/toMapTree.ts.\n\n\t\t\terrors.push(\n\t\t\t\t`The required fields of ${JSON.stringify(schema.identifier)} are insufficient to differentiate it from the following types: ${formatTypes(possiblyAmbiguous)}. For objects to be considered unambiguous, each must have required fields that do not all occur on any other object in the union.`,\n\t\t\t);\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../src/simple-tree/api/configuration.ts"],"names":[],"mappings":";AAAA;;;GAG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AAC,IAAI,CACV,0BAA0B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,mEAAmE,WAAW,CAAC,iBAAiB,CAAC,oIAAoI,CAChS,CAAC;QACH,CAAC;IACF,CAAC;AACF,CAAC;AAtFD,gCAsFC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype FieldSchemaAlpha,\n\ttype ImplicitFieldSchema,\n\tFieldKind,\n\tmarkSchemaMostDerived,\n\tnormalizeFieldSchema,\n} from \"../schemaTypes.js\";\nimport { NodeKind, type TreeNodeSchema } from \"../core/index.js\";\nimport { toStoredSchema } from \"../toStoredSchema.js\";\nimport { LeafNodeSchema } from \"../leafNodeSchema.js\";\nimport { isObjectNodeSchema, type ObjectNodeSchema } from \"../node-kinds/index.js\";\nimport { getOrCreate } from \"../../util/index.js\";\nimport type { MakeNominal } from \"../../util/index.js\";\nimport { walkFieldSchema } from \"../walkFieldSchema.js\";\nimport type { SimpleNodeSchema, SimpleTreeSchema } from \"../simpleSchema.js\";\n\n/**\n * Options when constructing a tree view.\n * @public\n */\nexport interface ITreeConfigurationOptions {\n\t/**\n\t * If `true`, the tree will validate new content against its stored schema at insertion time\n\t * and throw an error if the new content doesn't match the expected schema.\n\t *\n\t * @defaultValue `false`.\n\t *\n\t * @remarks Enabling schema validation has a performance penalty when inserting new content into the tree because\n\t * additional checks are done. Enable this option only in scenarios where you are ok with that operation being a\n\t * bit slower.\n\t */\n\tenableSchemaValidation?: boolean;\n\n\t/**\n\t * A flag used to opt into strict rules ensuring that the schema avoids cases which can make the type of nodes ambiguous when importing or exporting data.\n\t * @defaultValue `false`.\n\t *\n\t * @remarks\n\t * When this is true, it ensures that the compile time type safety for data when constructing nodes is sufficient to ensure that the runtime behavior will not give node data ambiguity errors.\n\t *\n\t * This ensures that the canonical JSON-like representation of all unions in the tree are lossless and unambiguous.\n\t * This canonical JSON-like representation consists of arrays, plain old JavaScript objects with string keys, booleans, numbers (excluding NaN, -0 and infinities), strings, null and {@link @fluidframework/core-interfaces#IFluidHandle}s.\n\t * It is compatible with the node creation APIs (such as schema class constructors) and is also compatible with JSON assuming any IFluidHandles get special handling (since they are not JSON compatible).\n\t * Currently these cases can cause ambiguity in a union:\n\t *\n\t * - More than one ArrayNode type: it's impossible to tell which array type is intended in the case of empty arrays (`[]`).\n\t *\n\t * - More than one MapNode type: it's impossible to tell which map type is intended in the case of an empty map (`{}`).\n\t *\n\t * - Both a MapNode and an ArrayNode: this case is not a problem for the canonical JSON representation, but is an issue when constructing from an Iterable, which is supported for both MapNode and ArrayNode.\n\t *\n\t * - Both a MapNode and an ObjectNode: when the input is valid for the ObjectNode, the current parser always considers it ambiguous with being a MapNode.\n\t *\n\t * - ObjectNodes which have fields (required or optional) which include all required fields of another ObjectNode: currently each ObjectNode is differentiated by the presence of its required fields.\n\t *\n\t * This check is conservative: some complex cases may error if the current simple algorithm cannot show no ambiguity is possible.\n\t * This check may become more permissive over time.\n\t *\n\t * @example Ambiguous schema (with `preventAmbiguity: false`), and how to disambiguate it using {@link Unhydrated} nodes:\n\t * ```typescript\n\t * const schemaFactory = new SchemaFactory(\"com.example\");\n\t * class Feet extends schemaFactory.object(\"Feet\", { length: schemaFactory.number }) {}\n\t * class Meters extends schemaFactory.object(\"Meters\", { length: schemaFactory.number }) {}\n\t * const config = new TreeViewConfiguration({\n\t * \t// This combination of schema can lead to ambiguous cases and will error if `preventAmbiguity` is true.\n\t * \tschema: [Feet, Meters],\n\t * \tpreventAmbiguity: false,\n\t * });\n\t * const view = tree.viewWith(config);\n\t * // This is invalid since it is ambiguous which type of node is being constructed:\n\t * // view.initialize({ length: 5 });\n\t * // To work, an explicit type can be provided by using an {@link Unhydrated} Node:\n\t * view.initialize(new Meters({ length: 5 }));\n\t * ```\n\t *\n\t * @example Schema disambiguated by adjusting field names, validated with `preventAmbiguity: true:`\n\t * ```typescript\n\t * const schemaFactory = new SchemaFactory(\"com.example\");\n\t * class Feet extends schemaFactory.object(\"Feet\", { length: schemaFactory.number }) {}\n\t * class Meters extends schemaFactory.object(\"Meters\", {\n\t * \t// To avoid ambiguity when parsing unions of Feet and Meters, this renames the length field to \"meters\".\n\t * \t// To preserve compatibility with existing data from the ambiguous case,\n\t * \t// `{ key: \"length\" }` is set, so when persisted in the tree \"length\" is used as the field name.\n\t * \tmeters: schemaFactory.required(schemaFactory.number, { key: \"length\" }),\n\t * }) {}\n\t * const config = new TreeViewConfiguration({\n\t * \t// This combination of schema is not ambiguous because `Feet` and `Meters` have different required keys.\n\t * \tschema: [Feet, Meters],\n\t * \tpreventAmbiguity: true,\n\t * });\n\t * const view = tree.viewWith(config);\n\t * // This now works, since the field is sufficient to determine this is a `Meters` node.\n\t * view.initialize({ meters: 5 });\n\t * ```\n\t *\n\t * @privateRemarks\n\t * In the future, we can support lossless round tripping via the canonical JSON-like representation above when unambiguous.\n\t * This could be done via methods added to `Tree` to export and import such objects, which would give us a place to explicitly define the type of this representation.\n\t *\n\t * To make this more permissive in the future we can:\n\t *\n\t * - Make toMapTree more permissive (ex: allow disambiguation based on leaf type)\n\t * - Update this check to more tightly match toMapTree\n\t * - Add options to help schema authors disambiguate their types, such as \"constant fields\" which are not persisted, and always have a constant value.\n\t *\n\t * The above examples exist in executable form in this files tests, and should be updated there then copied back here.\n\t */\n\treadonly preventAmbiguity?: boolean;\n}\n\nconst defaultTreeConfigurationOptions: Required<ITreeConfigurationOptions> = {\n\tenableSchemaValidation: false,\n\tpreventAmbiguity: false,\n};\n\n/**\n * Property-bag configuration for {@link TreeViewConfiguration} construction.\n * @public\n */\nexport interface ITreeViewConfiguration<\n\tTSchema extends ImplicitFieldSchema = ImplicitFieldSchema,\n> extends ITreeConfigurationOptions {\n\t/**\n\t * The schema which the application wants to view the tree with.\n\t */\n\treadonly schema: TSchema;\n}\n\n/**\n * Configuration for {@link ViewableTree.viewWith}.\n * @sealed @public\n */\nexport class TreeViewConfiguration<\n\tconst TSchema extends ImplicitFieldSchema = ImplicitFieldSchema,\n> implements Required<ITreeViewConfiguration<TSchema>>\n{\n\tprotected _typeCheck!: MakeNominal;\n\n\t/**\n\t * {@inheritDoc ITreeViewConfiguration.schema}\n\t */\n\tpublic readonly schema: TSchema;\n\n\t/**\n\t * {@inheritDoc ITreeConfigurationOptions.enableSchemaValidation}\n\t */\n\tpublic readonly enableSchemaValidation: boolean;\n\n\t/**\n\t * {@inheritDoc ITreeConfigurationOptions.preventAmbiguity}\n\t */\n\tpublic readonly preventAmbiguity: boolean;\n\n\t/**\n\t * Construct a new {@link TreeViewConfiguration}.\n\t *\n\t * @param props - Property bag of configuration options.\n\t *\n\t * @remarks\n\t * Performing this construction deeply validates the provided schema.\n\t * This means that when this constructor is called, all {@link LazyItem} {@link TreeNodeSchema} references will be evaluated (using {@link evaluateLazySchema}).\n\t * This means that the declarations for all transitively reachable {@link TreeNodeSchema} must be available at this time.\n\t *\n\t * For example, a schema reachable from this configuration cannot reference this configuration during its declaration,\n\t * since this would be a cyclic dependency that will cause an error when constructing this configuration.\n\t */\n\tpublic constructor(props: ITreeViewConfiguration<TSchema>) {\n\t\tconst config = { ...defaultTreeConfigurationOptions, ...props };\n\t\tthis.schema = config.schema;\n\t\tthis.enableSchemaValidation = config.enableSchemaValidation;\n\t\tthis.preventAmbiguity = config.preventAmbiguity;\n\n\t\t// Ambiguity errors are lower priority to report than invalid schema errors, so collect these in an array and report them all at once.\n\t\tconst ambiguityErrors: string[] = [];\n\n\t\twalkFieldSchema(config.schema, {\n\t\t\t// Ensure all reachable schema are marked as most derived.\n\t\t\t// This ensures if multiple schema extending the same schema factory generated class are present (or have been constructed, or get constructed in the future),\n\t\t\t// an error is reported.\n\n\t\t\tnode: (schema) => markSchemaMostDerived(schema, true),\n\t\t\tallowedTypes(types): void {\n\t\t\t\tif (config.preventAmbiguity) {\n\t\t\t\t\tcheckUnion(types, ambiguityErrors);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\n\t\tif (ambiguityErrors.length !== 0) {\n\t\t\t// Duplicate errors are common since when two types conflict, both orders error:\n\t\t\tconst deduplicated = new Set(ambiguityErrors);\n\t\t\tthrow new UsageError(`Ambiguous schema found:\\n${[...deduplicated].join(\"\\n\")}`);\n\t\t}\n\n\t\t// Eagerly perform this conversion to surface errors sooner.\n\t\ttoStoredSchema(config.schema);\n\t}\n}\n\n/**\n * {@link TreeViewConfiguration} extended with some alpha APIs.\n * @sealed @alpha\n */\nexport class TreeViewConfigurationAlpha<\n\t\tconst TSchema extends ImplicitFieldSchema = ImplicitFieldSchema,\n\t>\n\textends TreeViewConfiguration<TSchema>\n\timplements TreeSchema\n{\n\t/**\n\t * {@inheritDoc TreeSchema.root}\n\t */\n\tpublic readonly root: FieldSchemaAlpha;\n\t/**\n\t * {@inheritDoc TreeSchema.definitions}\n\t */\n\tpublic readonly definitions: ReadonlyMap<string, SimpleNodeSchema & TreeNodeSchema>;\n\n\tpublic constructor(props: ITreeViewConfiguration<TSchema>) {\n\t\tsuper(props);\n\t\tthis.root = normalizeFieldSchema(props.schema);\n\t\tconst definitions = new Map<string, SimpleNodeSchema & TreeNodeSchema>();\n\t\twalkFieldSchema(props.schema, {\n\t\t\tnode: (schema) =>\n\t\t\t\tdefinitions.set(schema.identifier, schema as SimpleNodeSchema & TreeNodeSchema),\n\t\t});\n\t\tthis.definitions = definitions;\n\t}\n}\n\n/**\n * {@link TreeViewConfigurationAlpha}\n * @sealed @alpha\n */\nexport interface TreeSchema extends SimpleTreeSchema {\n\t/**\n\t * {@inheritDoc SimpleTreeSchema.root}\n\t */\n\treadonly root: FieldSchemaAlpha;\n\n\t/**\n\t * {@inheritDoc SimpleTreeSchema.definitions}\n\t */\n\treadonly definitions: ReadonlyMap<string, SimpleNodeSchema & TreeNodeSchema>;\n}\n\n/**\n * Pretty print a set of types for use in error messages.\n */\nfunction formatTypes(allowed: Iterable<TreeNodeSchema>): string {\n\t// Use JSON.stringify to quote and escape identifiers.\n\t// Don't just use a single array JSON.stringify since that omits spaces between items\n\treturn `[${Array.from(allowed, (s) => JSON.stringify(s.identifier)).join(\", \")}]`;\n}\n\n/**\n * Detect cases documented in {@link ITreeConfigurationOptions.preventAmbiguity}.\n */\nexport function checkUnion(union: Iterable<TreeNodeSchema>, errors: string[]): void {\n\tconst checked: Set<TreeNodeSchema> = new Set();\n\tconst maps: TreeNodeSchema[] = [];\n\tconst arrays: TreeNodeSchema[] = [];\n\n\tconst objects: ObjectNodeSchema[] = [];\n\t// Map from key to schema using that key\n\tconst allObjectKeys: Map<string, Set<TreeNodeSchema>> = new Map();\n\n\tfor (const schema of union) {\n\t\tif (checked.has(schema)) {\n\t\t\tthrow new UsageError(`Duplicate schema in allowed types: ${schema.identifier}`);\n\t\t}\n\t\tchecked.add(schema);\n\n\t\tif (schema instanceof LeafNodeSchema) {\n\t\t\t// nothing to do\n\t\t} else if (isObjectNodeSchema(schema)) {\n\t\t\tobjects.push(schema);\n\t\t\tfor (const key of schema.fields.keys()) {\n\t\t\t\tgetOrCreate(allObjectKeys, key, () => new Set()).add(schema);\n\t\t\t}\n\t\t} else if (schema.kind === NodeKind.Array) {\n\t\t\tarrays.push(schema);\n\t\t} else {\n\t\t\tassert(schema.kind === NodeKind.Map, 0x9e7 /* invalid schema */);\n\t\t\tmaps.push(schema);\n\t\t}\n\t}\n\n\tif (arrays.length > 1) {\n\t\terrors.push(\n\t\t\t`More than one kind of array allowed within union (${formatTypes(arrays)}). This would require type disambiguation which is not supported by arrays during import or export.`,\n\t\t);\n\t}\n\n\tif (maps.length > 1) {\n\t\terrors.push(\n\t\t\t`More than one kind of map allowed within union (${formatTypes(maps)}). This would require type disambiguation which is not supported by maps during import or export.`,\n\t\t);\n\t}\n\n\tif (maps.length > 0 && arrays.length > 0) {\n\t\terrors.push(\n\t\t\t`Both a map and an array allowed within union (${formatTypes([...arrays, ...maps])}). Both can be implicitly constructed from iterables like arrays, which are ambiguous when the array is empty.`,\n\t\t);\n\t}\n\n\tif (objects.length > 0 && maps.length > 0) {\n\t\terrors.push(\n\t\t\t`Both a object and a map allowed within union (${formatTypes([...objects, ...maps])}). Both can be constructed from objects and can be ambiguous.`,\n\t\t);\n\t}\n\n\t// Check for objects which fully overlap:\n\tfor (const schema of objects) {\n\t\t// All objects which might be ambiguous relative to `schema`.\n\t\tconst possiblyAmbiguous = new Set(objects);\n\n\t\t// A schema can't be ambiguous with itself\n\t\tpossiblyAmbiguous.delete(schema);\n\n\t\t// For each field of schema, remove schema from possiblyAmbiguous that do not have that field\n\t\tfor (const [key, field] of schema.fields) {\n\t\t\tif (field.kind === FieldKind.Required) {\n\t\t\t\tconst withKey = allObjectKeys.get(key) ?? fail(0xb35 /* missing schema */);\n\t\t\t\tfor (const candidate of possiblyAmbiguous) {\n\t\t\t\t\tif (!withKey.has(candidate)) {\n\t\t\t\t\t\tpossiblyAmbiguous.delete(candidate);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (possiblyAmbiguous.size > 0) {\n\t\t\t// TODO: make this check more permissive.\n\t\t\t// Allow using the type of the field to disambiguate, at least for leaf types.\n\t\t\t// Add \"constant\" fields which can be used to disambiguate even more cases without adding persisted data: maybe make them optional in constructor?\n\t\t\t// Consider separating unambiguous implicit construction format from constructor arguments at type level, allowing constructor to superset the implicit construction options (ex: optional constant fields).\n\t\t\t// The policy here however must remain at least as conservative as shallowCompatibilityTest in src/simple-tree/toMapTree.ts.\n\n\t\t\terrors.push(\n\t\t\t\t`The required fields of ${JSON.stringify(schema.identifier)} are insufficient to differentiate it from the following types: ${formatTypes(possiblyAmbiguous)}. For objects to be considered unambiguous, each must have required fields that do not all occur on any other object in the union.`,\n\t\t\t);\n\t\t}\n\t}\n}\n"]}
@@ -3,32 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { ExclusiveMapTree, ITreeCursorSynchronous } from "../../core/index.js";
6
- import type { ImplicitFieldSchema, TreeFieldFromImplicitField, FieldSchema, FieldKind, UnsafeUnknownSchema, InsertableField, TreeLeafValue } from "../schemaTypes.js";
7
- import { type TreeNode, type Unhydrated } from "../core/index.js";
8
- import { type NodeIdentifierManager } from "../../feature-libraries/index.js";
9
- /**
10
- * Construct tree content that is compatible with the field defined by the provided `schema`.
11
- * @param schema - The schema for what to construct. As this is an {@link ImplicitFieldSchema}, a {@link FieldSchema}, {@link TreeNodeSchema} or {@link AllowedTypes} array can be provided.
12
- * @param data - The data used to construct the field content.
13
- * @remarks
14
- * When providing a {@link TreeNodeSchemaClass}, this is the same as invoking its constructor except that an unhydrated node can also be provided.
15
- * This function exists as a generalization that can be used in other cases as well,
16
- * such as when `undefined` might be allowed (for an optional field), or when the type should be inferred from the data when more than one type is possible.
17
- *
18
- * Like with {@link TreeNodeSchemaClass}'s constructor, its an error to provide an existing node to this API.
19
- * For that case, use {@link TreeBeta.clone}.
20
- */
21
- export declare function createFromInsertable<const TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema>(schema: UnsafeUnknownSchema extends TSchema ? ImplicitFieldSchema : TSchema & ImplicitFieldSchema, data: InsertableField<TSchema>, context?: NodeIdentifierManager | undefined): Unhydrated<TSchema extends ImplicitFieldSchema ? TreeFieldFromImplicitField<TSchema> : TreeNode | TreeLeafValue | undefined>;
22
- /**
23
- * Construct tree content that is compatible with the field defined by the provided `schema`.
24
- * @param schema - The schema for what to construct. As this is an {@link ImplicitFieldSchema}, a {@link FieldSchema}, {@link TreeNodeSchema} or {@link AllowedTypes} array can be provided.
25
- * @param data - The data used to construct the field content.
26
- * @remarks
27
- * When providing a {@link TreeNodeSchemaClass},
28
- * this is the same as invoking its constructor except that an unhydrated node can also be provided and the returned value is a cursor.
29
- * When `undefined` is provided (for an optional field), `undefined` is returned.
30
- */
31
- export declare function cursorFromInsertable<TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema>(schema: UnsafeUnknownSchema extends TSchema ? ImplicitFieldSchema : TSchema & ImplicitFieldSchema, data: InsertableField<TSchema>, context?: NodeIdentifierManager | undefined): ITreeCursorSynchronous | (TSchema extends FieldSchema<FieldKind.Optional> ? undefined : never);
6
+ import type { ImplicitFieldSchema, TreeFieldFromImplicitField } from "../schemaTypes.js";
7
+ import { type Unhydrated } from "../core/index.js";
32
8
  /**
33
9
  * Creates an unhydrated simple-tree field from a cursor in nodes mode.
34
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/create.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EACX,gBAAgB,EAChB,sBAAsB,EAEtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACX,mBAAmB,EACnB,0BAA0B,EAC1B,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAGN,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAKN,KAAK,qBAAqB,EAC1B,MAAM,kCAAkC,CAAC;AAM1C;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CACnC,KAAK,CAAC,OAAO,SAAS,mBAAmB,GAAG,mBAAmB,EAE/D,MAAM,EAAE,mBAAmB,SAAS,OAAO,GACxC,mBAAmB,GACnB,OAAO,GAAG,mBAAmB,EAChC,IAAI,EAAE,eAAe,CAAC,OAAO,CAAC,EAC9B,OAAO,CAAC,EAAE,qBAAqB,GAAG,SAAS,GACzC,UAAU,CACZ,OAAO,SAAS,mBAAmB,GAChC,0BAA0B,CAAC,OAAO,CAAC,GACnC,QAAQ,GAAG,aAAa,GAAG,SAAS,CACvC,CAQA;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CACnC,OAAO,SAAS,mBAAmB,GAAG,mBAAmB,EAEzD,MAAM,EAAE,mBAAmB,SAAS,OAAO,GACxC,mBA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,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC,CAQjD"}
@@ -4,49 +4,12 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.createFromMapTree = exports.createFromCursor = exports.cursorFromInsertable = exports.createFromInsertable = void 0;
7
+ exports.createFromMapTree = exports.createFromCursor = void 0;
8
8
  const internal_1 = require("@fluidframework/core-utils/internal");
9
9
  const index_js_1 = require("../core/index.js");
10
10
  const index_js_2 = require("../../feature-libraries/index.js");
11
- const index_js_3 = require("../../feature-libraries/index.js");
12
- const toMapTree_js_1 = require("../toMapTree.js");
13
11
  const createContext_js_1 = require("../createContext.js");
14
- const objectNode_js_1 = require("../objectNode.js");
15
- /**
16
- * Construct tree content that is compatible with the field defined by the provided `schema`.
17
- * @param schema - The schema for what to construct. As this is an {@link ImplicitFieldSchema}, a {@link FieldSchema}, {@link TreeNodeSchema} or {@link AllowedTypes} array can be provided.
18
- * @param data - The data used to construct the field content.
19
- * @remarks
20
- * When providing a {@link TreeNodeSchemaClass}, this is the same as invoking its constructor except that an unhydrated node can also be provided.
21
- * This function exists as a generalization that can be used in other cases as well,
22
- * such as when `undefined` might be allowed (for an optional field), or when the type should be inferred from the data when more than one type is possible.
23
- *
24
- * Like with {@link TreeNodeSchemaClass}'s constructor, its an error to provide an existing node to this API.
25
- * For that case, use {@link TreeBeta.clone}.
26
- */
27
- function createFromInsertable(schema, data, context) {
28
- const cursor = cursorFromInsertable(schema, data, context);
29
- const result = cursor === undefined ? undefined : createFromCursor(schema, cursor);
30
- return result;
31
- }
32
- exports.createFromInsertable = createFromInsertable;
33
- /**
34
- * Construct tree content that is compatible with the field defined by the provided `schema`.
35
- * @param schema - The schema for what to construct. As this is an {@link ImplicitFieldSchema}, a {@link FieldSchema}, {@link TreeNodeSchema} or {@link AllowedTypes} array can be provided.
36
- * @param data - The data used to construct the field content.
37
- * @remarks
38
- * When providing a {@link TreeNodeSchemaClass},
39
- * this is the same as invoking its constructor except that an unhydrated node can also be provided and the returned value is a cursor.
40
- * When `undefined` is provided (for an optional field), `undefined` is returned.
41
- */
42
- function cursorFromInsertable(schema, data, context) {
43
- const mapTree = (0, toMapTree_js_1.mapTreeFromNodeData)(data, schema, context);
44
- if (mapTree === undefined) {
45
- return undefined;
46
- }
47
- return (0, index_js_2.cursorForMapTreeNode)(mapTree);
48
- }
49
- exports.cursorFromInsertable = cursorFromInsertable;
12
+ const index_js_3 = require("../node-kinds/index.js");
50
13
  /**
51
14
  * Creates an unhydrated simple-tree field from a cursor in nodes mode.
52
15
  */
@@ -57,11 +20,11 @@ function createFromCursor(schema, cursor) {
57
20
  const schemaValidationPolicy = {
58
21
  policy: {
59
22
  ...index_js_2.defaultSchemaPolicy,
60
- allowUnknownOptionalFields: (0, objectNode_js_1.createUnknownOptionalFieldPolicy)(schema),
23
+ allowUnknownOptionalFields: (0, index_js_3.createUnknownOptionalFieldPolicy)(schema),
61
24
  },
62
25
  schema: context.flexContext.schema,
63
26
  };
64
- const maybeError = (0, index_js_3.isFieldInSchema)(mapTrees, flexSchema.rootFieldSchema, schemaValidationPolicy);
27
+ const maybeError = (0, index_js_2.isFieldInSchema)(mapTrees, flexSchema.rootFieldSchema, schemaValidationPolicy);
65
28
  (0, index_js_2.inSchemaOrThrow)(maybeError);
66
29
  if (mapTrees.length === 0) {
67
30
  return undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/simple-tree/api/create.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAgB7D,+CAK0B;AAC1B,+DAM0C;AAC1C,+DAAmE;AACnE,kDAAsD;AACtD,0DAA2D;AAC3D,oDAAoE;AAEpE;;;;;;;;;;;GAWG;AACH,SAAgB,oBAAoB,CAGnC,MAEgC,EAChC,IAA8B,EAC9B,OAA2C;IAM3C,MAAM,MAAM,GAAG,oBAAoB,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;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C;IACrE,CAAC;IACD,IAAA,iBAAM,EAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACnE,8JAA8J;IAC9J,oEAAoE;IACpE,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAE,CAAC;IAC7B,OAAO,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC;AA/BD,4CA+BC;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAChC,MAAe,EACf,OAAyB;IAEzB,MAAM,WAAW,GAAG,iCAAsB,CAAC,WAAW,CACrD,IAAA,uCAAoB,EAAC,MAAM,CAAC,EAC5B,OAAO,CACP,CAAC;IAEF,MAAM,MAAM,GAAG,IAAA,uCAA4B,EAAC,WAAW,CAAC,CAAC;IACzD,OAAO,MAAyD,CAAC;AAClE,CAAC;AAXD,8CAWC","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\";\n\nimport type {\n\tExclusiveMapTree,\n\tITreeCursorSynchronous,\n\tSchemaAndPolicy,\n} from \"../../core/index.js\";\nimport type {\n\tImplicitFieldSchema,\n\tTreeFieldFromImplicitField,\n\tFieldSchema,\n\tFieldKind,\n\tUnsafeUnknownSchema,\n\tInsertableField,\n\tTreeLeafValue,\n} from \"../schemaTypes.js\";\nimport {\n\tgetOrCreateNodeFromInnerNode,\n\tUnhydratedFlexTreeNode,\n\ttype TreeNode,\n\ttype Unhydrated,\n} from \"../core/index.js\";\nimport {\n\tcursorForMapTreeNode,\n\tdefaultSchemaPolicy,\n\tinSchemaOrThrow,\n\tmapTreeFromCursor,\n\ttype NodeIdentifierManager,\n} from \"../../feature-libraries/index.js\";\nimport { isFieldInSchema } from \"../../feature-libraries/index.js\";\nimport { mapTreeFromNodeData } from \"../toMapTree.js\";\nimport { getUnhydratedContext } from \"../createContext.js\";\nimport { createUnknownOptionalFieldPolicy } from \"../objectNode.js\";\n\n/**\n * Construct tree content that is compatible with the field defined by the provided `schema`.\n * @param schema - The schema for what to construct. As this is an {@link ImplicitFieldSchema}, a {@link FieldSchema}, {@link TreeNodeSchema} or {@link AllowedTypes} array can be provided.\n * @param data - The data used to construct the field content.\n * @remarks\n * When providing a {@link TreeNodeSchemaClass}, this is the same as invoking its constructor except that an unhydrated node can also be provided.\n * This function exists as a generalization that can be used in other cases as well,\n * such as when `undefined` might be allowed (for an optional field), or when the type should be inferred from the data when more than one type is possible.\n *\n * Like with {@link TreeNodeSchemaClass}'s constructor, its an error to provide an existing node to this API.\n * For that case, use {@link TreeBeta.clone}.\n */\nexport function createFromInsertable<\n\tconst TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema,\n>(\n\tschema: UnsafeUnknownSchema extends TSchema\n\t\t? ImplicitFieldSchema\n\t\t: TSchema & ImplicitFieldSchema,\n\tdata: InsertableField<TSchema>,\n\tcontext?: NodeIdentifierManager | undefined,\n): Unhydrated<\n\tTSchema extends ImplicitFieldSchema\n\t\t? TreeFieldFromImplicitField<TSchema>\n\t\t: TreeNode | TreeLeafValue | undefined\n> {\n\tconst cursor = cursorFromInsertable(schema, data, context);\n\tconst result = cursor === undefined ? undefined : createFromCursor(schema, cursor);\n\treturn result as Unhydrated<\n\t\tTSchema extends ImplicitFieldSchema\n\t\t\t? TreeFieldFromImplicitField<TSchema>\n\t\t\t: TreeNode | TreeLeafValue | undefined\n\t>;\n}\n\n/**\n * Construct tree content that is compatible with the field defined by the provided `schema`.\n * @param schema - The schema for what to construct. As this is an {@link ImplicitFieldSchema}, a {@link FieldSchema}, {@link TreeNodeSchema} or {@link AllowedTypes} array can be provided.\n * @param data - The data used to construct the field content.\n * @remarks\n * When providing a {@link TreeNodeSchemaClass},\n * this is the same as invoking its constructor except that an unhydrated node can also be provided and the returned value is a cursor.\n * When `undefined` is provided (for an optional field), `undefined` is returned.\n */\nexport function cursorFromInsertable<\n\tTSchema extends ImplicitFieldSchema | UnsafeUnknownSchema,\n>(\n\tschema: UnsafeUnknownSchema extends TSchema\n\t\t? ImplicitFieldSchema\n\t\t: TSchema & ImplicitFieldSchema,\n\tdata: InsertableField<TSchema>,\n\tcontext?: NodeIdentifierManager | undefined,\n):\n\t| ITreeCursorSynchronous\n\t| (TSchema extends FieldSchema<FieldKind.Optional> ? undefined : never) {\n\tconst mapTree = mapTreeFromNodeData(\n\t\tdata as InsertableField<UnsafeUnknownSchema>,\n\t\tschema,\n\t\tcontext,\n\t);\n\tif (mapTree === undefined) {\n\t\treturn undefined as TSchema extends FieldSchema<FieldKind.Optional> ? undefined : never;\n\t}\n\treturn cursorForMapTreeNode(mapTree);\n}\n\n/**\n * Creates an unhydrated simple-tree field from a cursor in nodes mode.\n */\nexport function createFromCursor<const TSchema extends ImplicitFieldSchema>(\n\tschema: TSchema,\n\tcursor: ITreeCursorSynchronous | undefined,\n): Unhydrated<TreeFieldFromImplicitField<TSchema>> {\n\tconst mapTrees = cursor === undefined ? [] : [mapTreeFromCursor(cursor)];\n\tconst context = getUnhydratedContext(schema);\n\tconst flexSchema = context.flexContext.schema;\n\n\tconst schemaValidationPolicy: SchemaAndPolicy = {\n\t\tpolicy: {\n\t\t\t...defaultSchemaPolicy,\n\t\t\tallowUnknownOptionalFields: createUnknownOptionalFieldPolicy(schema),\n\t\t},\n\t\tschema: context.flexContext.schema,\n\t};\n\n\tconst maybeError = isFieldInSchema(\n\t\tmapTrees,\n\t\tflexSchema.rootFieldSchema,\n\t\tschemaValidationPolicy,\n\t);\n\tinSchemaOrThrow(maybeError);\n\n\tif (mapTrees.length === 0) {\n\t\treturn undefined as Unhydrated<TreeFieldFromImplicitField<TSchema>>;\n\t}\n\tassert(mapTrees.length === 1, 0xa11 /* unexpected field length */);\n\t// Length asserted above, so this is safe. This assert is done instead of checking for undefined after indexing to ensure a length greater than 1 also errors.\n\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\tconst mapTree = mapTrees[0]!;\n\treturn createFromMapTree(schema, mapTree);\n}\n\n/**\n * Creates an unhydrated simple-tree field from an ExclusiveMapTree.\n */\nexport function createFromMapTree<const TSchema extends ImplicitFieldSchema>(\n\tschema: TSchema,\n\tmapTree: ExclusiveMapTree,\n): Unhydrated<TreeFieldFromImplicitField<TSchema>> {\n\tconst mapTreeNode = UnhydratedFlexTreeNode.getOrCreate(\n\t\tgetUnhydratedContext(schema),\n\t\tmapTree,\n\t);\n\n\tconst result = getOrCreateNodeFromInnerNode(mapTreeNode);\n\treturn result as Unhydrated<TreeFieldFromImplicitField<TSchema>>;\n}\n"]}
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/simple-tree/api/create.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAQ7D,+CAI0B;AAC1B,+DAK0C;AAC1C,0DAA2D;AAC3D,qDAA0E;AAE1E;;GAEG;AACH,SAAgB,gBAAgB,CAC/B,MAAe,EACf,MAA0C;IAE1C,MAAM,QAAQ,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAA,4BAAiB,EAAC,MAAM,CAAC,CAAC,CAAC;IACzE,MAAM,OAAO,GAAG,IAAA,uCAAoB,EAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC;IAE9C,MAAM,sBAAsB,GAAoB;QAC/C,MAAM,EAAE;YACP,GAAG,8BAAmB;YACtB,0BAA0B,EAAE,IAAA,2CAAgC,EAAC,MAAM,CAAC;SACpE;QACD,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,MAAM;KAClC,CAAC;IAEF,MAAM,UAAU,GAAG,IAAA,0BAAe,EACjC,QAAQ,EACR,UAAU,CAAC,eAAe,EAC1B,sBAAsB,CACtB,CAAC;IACF,IAAA,0BAAe,EAAC,UAAU,CAAC,CAAC;IAE5B,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,SAA4D,CAAC;IACrE,CAAC;IACD,IAAA,iBAAM,EAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACnE,8JAA8J;IAC9J,oEAAoE;IACpE,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAE,CAAC;IAC7B,OAAO,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC;AA/BD,4CA+BC;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAChC,MAAe,EACf,OAAyB;IAEzB,MAAM,WAAW,GAAG,iCAAsB,CAAC,WAAW,CACrD,IAAA,uCAAoB,EAAC,MAAM,CAAC,EAC5B,OAAO,CACP,CAAC;IAEF,MAAM,MAAM,GAAG,IAAA,uCAA4B,EAAC,WAAW,CAAC,CAAC;IACzD,OAAO,MAAyD,CAAC;AAClE,CAAC;AAXD,8CAWC","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\";\n\nimport type {\n\tExclusiveMapTree,\n\tITreeCursorSynchronous,\n\tSchemaAndPolicy,\n} from \"../../core/index.js\";\nimport type { ImplicitFieldSchema, TreeFieldFromImplicitField } from \"../schemaTypes.js\";\nimport {\n\tgetOrCreateNodeFromInnerNode,\n\tUnhydratedFlexTreeNode,\n\ttype Unhydrated,\n} from \"../core/index.js\";\nimport {\n\tdefaultSchemaPolicy,\n\tinSchemaOrThrow,\n\tmapTreeFromCursor,\n\tisFieldInSchema,\n} from \"../../feature-libraries/index.js\";\nimport { getUnhydratedContext } from \"../createContext.js\";\nimport { createUnknownOptionalFieldPolicy } from \"../node-kinds/index.js\";\n\n/**\n * Creates an unhydrated simple-tree field from a cursor in nodes mode.\n */\nexport function createFromCursor<const TSchema extends ImplicitFieldSchema>(\n\tschema: TSchema,\n\tcursor: ITreeCursorSynchronous | undefined,\n): Unhydrated<TreeFieldFromImplicitField<TSchema>> {\n\tconst mapTrees = cursor === undefined ? [] : [mapTreeFromCursor(cursor)];\n\tconst context = getUnhydratedContext(schema);\n\tconst flexSchema = context.flexContext.schema;\n\n\tconst schemaValidationPolicy: SchemaAndPolicy = {\n\t\tpolicy: {\n\t\t\t...defaultSchemaPolicy,\n\t\t\tallowUnknownOptionalFields: createUnknownOptionalFieldPolicy(schema),\n\t\t},\n\t\tschema: context.flexContext.schema,\n\t};\n\n\tconst maybeError = isFieldInSchema(\n\t\tmapTrees,\n\t\tflexSchema.rootFieldSchema,\n\t\tschemaValidationPolicy,\n\t);\n\tinSchemaOrThrow(maybeError);\n\n\tif (mapTrees.length === 0) {\n\t\treturn undefined as Unhydrated<TreeFieldFromImplicitField<TSchema>>;\n\t}\n\tassert(mapTrees.length === 1, 0xa11 /* unexpected field length */);\n\t// Length asserted above, so this is safe. This assert is done instead of checking for undefined after indexing to ensure a length greater than 1 also errors.\n\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\tconst mapTree = mapTrees[0]!;\n\treturn createFromMapTree(schema, mapTree);\n}\n\n/**\n * Creates an unhydrated simple-tree field from an ExclusiveMapTree.\n */\nexport function createFromMapTree<const TSchema extends ImplicitFieldSchema>(\n\tschema: TSchema,\n\tmapTree: ExclusiveMapTree,\n): Unhydrated<TreeFieldFromImplicitField<TSchema>> {\n\tconst mapTreeNode = UnhydratedFlexTreeNode.getOrCreate(\n\t\tgetUnhydratedContext(schema),\n\t\tmapTree,\n\t);\n\n\tconst result = getOrCreateNodeFromInnerNode(mapTreeNode);\n\treturn result as Unhydrated<TreeFieldFromImplicitField<TSchema>>;\n}\n"]}
@@ -4,8 +4,8 @@
4
4
  */
5
5
  import type { IFluidHandle } from "@fluidframework/core-interfaces";
6
6
  import { type FieldKey, type ITreeCursor, type TreeNodeSchemaIdentifier, type TreeNodeStoredSchema } from "../../core/index.js";
7
- import type { TreeLeafValue } from "../schemaTypes.js";
8
7
  import { type TreeNodeSchema } from "../core/index.js";
8
+ import type { TreeLeafValue } from "../schemaTypes.js";
9
9
  /**
10
10
  * Options for how to interpret or encode a tree when schema information is available.
11
11
  * @alpha
@@ -1 +1 @@
1
- {"version":3,"file":"customTree.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/customTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAIpE,OAAO,EAON,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAWjE;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;;;;OAMG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC;;OAEG;IACH,YAAY,CAAC,EAAE;QACd,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAC;QAChD,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,MAAM,CAAC;KAC5C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,MAAM,IAAI,cAAc,CAAC,MAAM,CAAC,GAAG,eAAe,CAAC;AAE1E;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,aAAa,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,MAAM,IAAI,MAAM,EAAE,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAE1E;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EACtC,MAAM,EAAE,WA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,EACnE,YAAY,EAAE,CACb,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW,CAAC,wBAAwB,EAAE,oBAAoB,CAAC,KAC/D,MAAM,GACT,UAAU,CAAC,MAAM,CAAC,CAgCpB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,oBAAoB,GAC1B,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAQjC;AAED;;;;;GAKG;AACH,MAAM,MAAM,eAAe,CAAC,OAAO,IAAI,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC;AAEvE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,OAAO,CAStF"}
@@ -5,35 +5,35 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.replaceHandles = exports.tryStoredSchemaAsArray = exports.customFromCursorStored = exports.customFromCursor = void 0;
8
- const internal_1 = require("@fluidframework/runtime-utils/internal");
9
- const internal_2 = require("@fluidframework/core-utils/internal");
8
+ const internal_1 = require("@fluidframework/core-utils/internal");
9
+ const internal_2 = require("@fluidframework/runtime-utils/internal");
10
10
  const index_js_1 = require("../../core/index.js");
11
- const index_js_2 = require("../../util/index.js");
12
- const index_js_3 = require("../core/index.js");
11
+ const index_js_2 = require("../../feature-libraries/index.js");
12
+ const index_js_3 = require("../../util/index.js");
13
+ const index_js_4 = require("../core/index.js");
13
14
  const leafNodeSchema_js_1 = require("../leafNodeSchema.js");
14
- const objectNodeTypes_js_1 = require("../objectNodeTypes.js");
15
- const index_js_4 = require("../../feature-libraries/index.js");
15
+ const index_js_5 = require("../node-kinds/index.js");
16
16
  /**
17
17
  * Builds an {@link CustomTree} from a cursor in Nodes mode.
18
18
  */
19
19
  function customFromCursor(reader, options, schema, childHandler) {
20
20
  const type = reader.type;
21
- const nodeSchema = schema.get(type) ?? (0, internal_2.fail)(0xb2e /* missing schema for type in cursor */);
21
+ const nodeSchema = schema.get(type) ?? (0, internal_1.fail)(0xb2e /* missing schema for type in cursor */);
22
22
  switch (type) {
23
23
  case leafNodeSchema_js_1.numberSchema.identifier:
24
24
  case leafNodeSchema_js_1.booleanSchema.identifier:
25
25
  case leafNodeSchema_js_1.nullSchema.identifier:
26
26
  case leafNodeSchema_js_1.stringSchema.identifier:
27
- (0, internal_2.assert)(reader.value !== undefined, 0xa50 /* out of schema: missing value */);
28
- (0, internal_2.assert)(!(0, internal_1.isFluidHandle)(reader.value), 0xa51 /* out of schema: unexpected FluidHandle */);
27
+ (0, internal_1.assert)(reader.value !== undefined, 0xa50 /* out of schema: missing value */);
28
+ (0, internal_1.assert)(!(0, internal_2.isFluidHandle)(reader.value), 0xa51 /* out of schema: unexpected FluidHandle */);
29
29
  return reader.value;
30
30
  case leafNodeSchema_js_1.handleSchema.identifier:
31
- (0, internal_2.assert)(reader.value !== undefined, 0xa52 /* out of schema: missing value */);
32
- (0, internal_2.assert)((0, internal_1.isFluidHandle)(reader.value), 0xa53 /* out of schema: expected FluidHandle */);
31
+ (0, internal_1.assert)(reader.value !== undefined, 0xa52 /* out of schema: missing value */);
32
+ (0, internal_1.assert)((0, internal_2.isFluidHandle)(reader.value), 0xa53 /* out of schema: expected FluidHandle */);
33
33
  return reader.value;
34
34
  default: {
35
- (0, internal_2.assert)(reader.value === undefined, 0xa54 /* out of schema: unexpected value */);
36
- if (nodeSchema.kind === index_js_3.NodeKind.Array) {
35
+ (0, internal_1.assert)(reader.value === undefined, 0xa54 /* out of schema: unexpected value */);
36
+ if (nodeSchema.kind === index_js_4.NodeKind.Array) {
37
37
  const fields = (0, index_js_1.inCursorField)(reader, index_js_1.EmptyKey, () => (0, index_js_1.mapCursorField)(reader, () => childHandler(reader, options, schema)));
38
38
  return fields;
39
39
  }
@@ -43,16 +43,16 @@ function customFromCursor(reader, options, schema, childHandler) {
43
43
  const children = (0, index_js_1.mapCursorField)(reader, () => childHandler(reader, options, schema));
44
44
  if (children.length === 1) {
45
45
  const storedKey = reader.getFieldKey();
46
- const key = (0, objectNodeTypes_js_1.isObjectNodeSchema)(nodeSchema) && !options.useStoredKeys
46
+ const key = (0, index_js_5.isObjectNodeSchema)(nodeSchema) && !options.useStoredKeys
47
47
  ? (nodeSchema.storedKeyToPropertyKey.get(storedKey) ??
48
- (0, internal_2.fail)(0xb2f /* missing property key */))
48
+ (0, internal_1.fail)(0xb2f /* missing property key */))
49
49
  : storedKey;
50
50
  // Length is checked above.
51
51
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
52
52
  fields[key] = children[0];
53
53
  }
54
54
  else {
55
- (0, internal_2.assert)(children.length === 0, 0xa19 /* invalid children number */);
55
+ (0, internal_1.assert)(children.length === 0, 0xa19 /* invalid children number */);
56
56
  }
57
57
  });
58
58
  return fields;
@@ -68,12 +68,12 @@ exports.customFromCursor = customFromCursor;
68
68
  */
69
69
  function customFromCursorStored(reader, schema, childHandler) {
70
70
  const type = reader.type;
71
- const nodeSchema = schema.get(type) ?? (0, internal_2.fail)(0xb30 /* missing schema for type in cursor */);
71
+ const nodeSchema = schema.get(type) ?? (0, internal_1.fail)(0xb30 /* missing schema for type in cursor */);
72
72
  if (nodeSchema instanceof index_js_1.LeafNodeStoredSchema) {
73
- (0, internal_2.assert)((0, index_js_4.valueSchemaAllows)(nodeSchema.leafValue, reader.value), 0xa9c /* invalid value */);
73
+ (0, internal_1.assert)((0, index_js_2.valueSchemaAllows)(nodeSchema.leafValue, reader.value), 0xa9c /* invalid value */);
74
74
  return reader.value;
75
75
  }
76
- (0, internal_2.assert)(reader.value === undefined, 0xa9d /* out of schema: unexpected value */);
76
+ (0, internal_1.assert)(reader.value === undefined, 0xa9d /* out of schema: unexpected value */);
77
77
  const arrayTypes = tryStoredSchemaAsArray(nodeSchema);
78
78
  if (arrayTypes !== undefined) {
79
79
  const field = (0, index_js_1.inCursorField)(reader, index_js_1.EmptyKey, () => (0, index_js_1.mapCursorField)(reader, () => childHandler(reader, schema)));
@@ -89,7 +89,7 @@ function customFromCursorStored(reader, schema, childHandler) {
89
89
  fields[storedKey] = children[0];
90
90
  }
91
91
  else {
92
- (0, internal_2.assert)(children.length === 0, 0xa9e /* invalid children number */);
92
+ (0, internal_1.assert)(children.length === 0, 0xa9e /* invalid children number */);
93
93
  }
94
94
  });
95
95
  return fields;
@@ -103,8 +103,8 @@ exports.customFromCursorStored = customFromCursorStored;
103
103
  function tryStoredSchemaAsArray(schema) {
104
104
  if (schema instanceof index_js_1.ObjectNodeStoredSchema) {
105
105
  const empty = schema.getFieldSchema(index_js_1.EmptyKey);
106
- if (empty.kind === index_js_4.FieldKinds.sequence.identifier) {
107
- (0, internal_2.assert)(schema.objectNodeFields.size === 1, 0xa9f /* invalid schema */);
106
+ if (empty.kind === index_js_2.FieldKinds.sequence.identifier) {
107
+ (0, internal_1.assert)(schema.objectNodeFields.size === 1, 0xa9f /* invalid schema */);
108
108
  return empty.types;
109
109
  }
110
110
  }
@@ -127,9 +127,9 @@ exports.tryStoredSchemaAsArray = tryStoredSchemaAsArray;
127
127
  * @alpha
128
128
  */
129
129
  function replaceHandles(tree, replacer) {
130
- return (0, index_js_2.cloneWithReplacements)(tree, "", (key, value) => {
130
+ return (0, index_js_3.cloneWithReplacements)(tree, "", (key, value) => {
131
131
  // eslint-disable-next-line unicorn/prefer-ternary
132
- if ((0, internal_1.isFluidHandle)(value)) {
132
+ if ((0, internal_2.isFluidHandle)(value)) {
133
133
  return { clone: false, value: replacer(value) };
134
134
  }
135
135
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"customTree.js","sourceRoot":"","sources":["../../../src/simple-tree/api/customTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,qEAAuE;AACvE,kEAAmE;AAEnE,kDAW6B;AAC7B,kDAA4D;AAE5D,+CAAiE;AACjE,4DAM8B;AAC9B,8DAA2D;AAC3D,+DAAiF;AA6CjF;;GAEG;AACH,SAA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CAAC,6BAA6B,CAAC,CAAC;QACpE,CAAC;IACF,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AACf,CAAC;AAvCD,wDAuCC;AAED;;;;GAIG;AACH,SAAgB,sBAAsB,CACrC,MAA4B;IAE5B,IAAI,MAAM,YAAY,iCAAsB,EAAE,CAAC;QAC9C,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,mBAAQ,CAAC,CAAC;QAC9C,IAAI,KAAK,CAAC,IAAI,KAAK,qBAAU,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;YACnD,IAAA,iBAAM,EAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,KAAK,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC;YACvE,OAAO,KAAK,CAAC,KAAK,CAAC;QACpB,CAAC;IACF,CAAC;AACF,CAAC;AAVD,wDAUC;AAUD;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,cAAc,CAAI,IAAa,EAAE,QAA4B;IAC5E,OAAO,IAAA,gCAAqB,EAAC,IAAI,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QACrD,kDAAkD;QAClD,IAAI,IAAA,wBAAa,EAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,CAAC;aAAM,CAAC;YACP,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QAC/B,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC;AATD,wCASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tEmptyKey,\n\tforEachField,\n\tinCursorField,\n\tLeafNodeStoredSchema,\n\tmapCursorField,\n\tObjectNodeStoredSchema,\n\ttype FieldKey,\n\ttype ITreeCursor,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n} from \"../../core/index.js\";\nimport { cloneWithReplacements } from \"../../util/index.js\";\nimport type { TreeLeafValue } from \"../schemaTypes.js\";\nimport { NodeKind, type TreeNodeSchema } from \"../core/index.js\";\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n} from \"../leafNodeSchema.js\";\nimport { isObjectNodeSchema } from \"../objectNodeTypes.js\";\nimport { FieldKinds, valueSchemaAllows } from \"../../feature-libraries/index.js\";\n\n/**\n * Options for how to interpret or encode a tree when schema information is available.\n * @alpha\n */\nexport interface TreeEncodingOptions {\n\t/**\n\t * If true, use the stored keys of object nodes.\n\t * If false, use the property keys.\n\t * @remarks\n\t * Has no effect on {@link NodeKind}s other than {@link NodeKind.Object}.\n\t * @defaultValue false.\n\t */\n\treadonly useStoredKeys?: boolean;\n}\n\n/**\n * Options for how to interpret a `ConciseTree<TCustom>` without relying on schema.\n */\nexport interface SchemalessParseOptions {\n\t/**\n\t * Converts stored keys into whatever key the tree is using in its encoding.\n\t */\n\tkeyConverter?: {\n\t\tparse(type: string, inputKey: string): FieldKey;\n\t\tencode(type: string, key: FieldKey): string;\n\t};\n}\n\n/**\n * Tree representation with fields as properties and customized handle and child representations.\n */\nexport type CustomTree<TChild> = CustomTreeNode<TChild> | CustomTreeValue;\n\n/**\n * TreeLeafValue except the handle type is customized.\n */\nexport type CustomTreeValue = TreeLeafValue;\n\n/**\n * Tree node representation with fields as properties and customized child representation.\n */\nexport type CustomTreeNode<TChild> = TChild[] | { [key: string]: TChild };\n\n/**\n * Builds an {@link CustomTree} from a cursor in Nodes mode.\n */\nexport function customFromCursor<TChild>(\n\treader: ITreeCursor,\n\toptions: Required<TreeEncodingOptions>,\n\tschema: ReadonlyMap<string, TreeNodeSchema>,\n\tchildHandler: (\n\t\treader: ITreeCursor,\n\t\toptions: Required<TreeEncodingOptions>,\n\t\tschema: ReadonlyMap<string, TreeNodeSchema>,\n\t) => TChild,\n): CustomTree<TChild> {\n\tconst type = reader.type;\n\tconst nodeSchema = schema.get(type) ?? fail(0xb2e /* missing schema for type in cursor */);\n\n\tswitch (type) {\n\t\tcase numberSchema.identifier:\n\t\tcase booleanSchema.identifier:\n\t\tcase nullSchema.identifier:\n\t\tcase stringSchema.identifier:\n\t\t\tassert(reader.value !== undefined, 0xa50 /* out of schema: missing value */);\n\t\t\tassert(!isFluidHandle(reader.value), 0xa51 /* out of schema: unexpected FluidHandle */);\n\t\t\treturn reader.value;\n\t\tcase handleSchema.identifier:\n\t\t\tassert(reader.value !== undefined, 0xa52 /* out of schema: missing value */);\n\t\t\tassert(isFluidHandle(reader.value), 0xa53 /* out of schema: expected FluidHandle */);\n\t\t\treturn reader.value;\n\t\tdefault: {\n\t\t\tassert(reader.value === undefined, 0xa54 /* out of schema: unexpected value */);\n\t\t\tif (nodeSchema.kind === NodeKind.Array) {\n\t\t\t\tconst fields = inCursorField(reader, EmptyKey, () =>\n\t\t\t\t\tmapCursorField(reader, () => childHandler(reader, options, schema)),\n\t\t\t\t);\n\t\t\t\treturn fields;\n\t\t\t} else {\n\t\t\t\tconst fields: Record<string, TChild> = {};\n\t\t\t\tforEachField(reader, () => {\n\t\t\t\t\tconst children = mapCursorField(reader, () => childHandler(reader, options, schema));\n\t\t\t\t\tif (children.length === 1) {\n\t\t\t\t\t\tconst storedKey = reader.getFieldKey();\n\t\t\t\t\t\tconst key =\n\t\t\t\t\t\t\tisObjectNodeSchema(nodeSchema) && !options.useStoredKeys\n\t\t\t\t\t\t\t\t? (nodeSchema.storedKeyToPropertyKey.get(storedKey) ??\n\t\t\t\t\t\t\t\t\tfail(0xb2f /* missing property key */))\n\t\t\t\t\t\t\t\t: storedKey;\n\t\t\t\t\t\t// Length is checked above.\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\tfields[key] = children[0]!;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tassert(children.length === 0, 0xa19 /* invalid children number */);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn fields;\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Builds an {@link CustomTree} from a cursor in Nodes mode.\n * @remarks\n * Uses stored keys and stored schema.\n */\nexport function customFromCursorStored<TChild>(\n\treader: ITreeCursor,\n\tschema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>,\n\tchildHandler: (\n\t\treader: ITreeCursor,\n\t\tschema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>,\n\t) => TChild,\n): CustomTree<TChild> {\n\tconst type = reader.type;\n\tconst nodeSchema = schema.get(type) ?? fail(0xb30 /* missing schema for type in cursor */);\n\n\tif (nodeSchema instanceof LeafNodeStoredSchema) {\n\t\tassert(valueSchemaAllows(nodeSchema.leafValue, reader.value), 0xa9c /* invalid value */);\n\t\treturn reader.value;\n\t}\n\n\tassert(reader.value === undefined, 0xa9d /* out of schema: unexpected value */);\n\n\tconst arrayTypes = tryStoredSchemaAsArray(nodeSchema);\n\tif (arrayTypes !== undefined) {\n\t\tconst field = inCursorField(reader, EmptyKey, () =>\n\t\t\tmapCursorField(reader, () => childHandler(reader, schema)),\n\t\t);\n\t\treturn field;\n\t}\n\n\tconst fields: Record<string, TChild> = {};\n\tforEachField(reader, () => {\n\t\tconst children = mapCursorField(reader, () => childHandler(reader, schema));\n\t\tif (children.length === 1) {\n\t\t\tconst storedKey = reader.getFieldKey();\n\t\t\t// Length is checked above.\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tfields[storedKey] = children[0]!;\n\t\t} else {\n\t\t\tassert(children.length === 0, 0xa9e /* invalid children number */);\n\t\t}\n\t});\n\treturn fields;\n}\n\n/**\n * Assumes `schema` corresponds to a simple-tree schema.\n * If it is an array schema, returns the allowed types for the array field.\n * Otherwise returns `undefined`.\n */\nexport function tryStoredSchemaAsArray(\n\tschema: TreeNodeStoredSchema,\n): ReadonlySet<string> | undefined {\n\tif (schema instanceof ObjectNodeStoredSchema) {\n\t\tconst empty = schema.getFieldSchema(EmptyKey);\n\t\tif (empty.kind === FieldKinds.sequence.identifier) {\n\t\t\tassert(schema.objectNodeFields.size === 1, 0xa9f /* invalid schema */);\n\t\t\treturn empty.types;\n\t\t}\n\t}\n}\n\n/**\n * Options for how to transcode handles.\n * @remarks\n * Can be applied using {@link replaceHandles}.\n * @alpha\n */\nexport type HandleConverter<TCustom> = (data: IFluidHandle) => TCustom;\n\n/**\n * Clones tree, replacing any handles.\n * @remarks\n * This can be useful converting data containing handles to JSON compatible formats,\n * or just asserting that data does not contain handles.\n *\n * Reversing this replacement depends on how the replacer encodes handles, and can often be impossible if the replacer\n * does not have all the necessary context to restore the handles\n * (e.g. if the handles are something insufficiently descriptive,\n * if data referenced by the handle got garbage collected,\n * if the encoded form of the handle can't be differentiated from other data,\n * or the replacer doesn't have access to the correct Fluid container to to restore them from).\n *\n * Code attempting to reverse this replacement may want to use {@link cloneWithReplacements}.\n * @alpha\n */\nexport function replaceHandles<T>(tree: unknown, replacer: HandleConverter<T>): unknown {\n\treturn cloneWithReplacements(tree, \"\", (key, value) => {\n\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\tif (isFluidHandle(value)) {\n\t\t\treturn { clone: false, value: replacer(value) };\n\t\t} else {\n\t\t\treturn { clone: true, value };\n\t\t}\n\t});\n}\n"]}
1
+ {"version":3,"file":"customTree.js","sourceRoot":"","sources":["../../../src/simple-tree/api/customTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAAmE;AACnE,qEAAuE;AAEvE,kDAW6B;AAC7B,+DAAiF;AACjF,kDAA4D;AAC5D,+CAAiE;AACjE,4DAM8B;AAC9B,qDAA4D;AA8C5D;;GAEG;AACH,S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K,CAAC,6BAA6B,CAAC,CAAC;QACpE,CAAC;IACF,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AACf,CAAC;AAvCD,wDAuCC;AAED;;;;GAIG;AACH,SAAgB,sBAAsB,CACrC,MAA4B;IAE5B,IAAI,MAAM,YAAY,iCAAsB,EAAE,CAAC;QAC9C,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,mBAAQ,CAAC,CAAC;QAC9C,IAAI,KAAK,CAAC,IAAI,KAAK,qBAAU,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;YACnD,IAAA,iBAAM,EAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,KAAK,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC;YACvE,OAAO,KAAK,CAAC,KAAK,CAAC;QACpB,CAAC;IACF,CAAC;AACF,CAAC;AAVD,wDAUC;AAUD;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,cAAc,CAAI,IAAa,EAAE,QAA4B;IAC5E,OAAO,IAAA,gCAAqB,EAAC,IAAI,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QACrD,kDAAkD;QAClD,IAAI,IAAA,wBAAa,EAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,CAAC;aAAM,CAAC;YACP,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QAC/B,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC;AATD,wCASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\n\nimport {\n\tEmptyKey,\n\tforEachField,\n\tinCursorField,\n\tLeafNodeStoredSchema,\n\tmapCursorField,\n\tObjectNodeStoredSchema,\n\ttype FieldKey,\n\ttype ITreeCursor,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n} from \"../../core/index.js\";\nimport { FieldKinds, valueSchemaAllows } from \"../../feature-libraries/index.js\";\nimport { cloneWithReplacements } from \"../../util/index.js\";\nimport { NodeKind, type TreeNodeSchema } from \"../core/index.js\";\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n} from \"../leafNodeSchema.js\";\nimport { isObjectNodeSchema } from \"../node-kinds/index.js\";\nimport type { TreeLeafValue } from \"../schemaTypes.js\";\n\n/**\n * Options for how to interpret or encode a tree when schema information is available.\n * @alpha\n */\nexport interface TreeEncodingOptions {\n\t/**\n\t * If true, use the stored keys of object nodes.\n\t * If false, use the property keys.\n\t * @remarks\n\t * Has no effect on {@link NodeKind}s other than {@link NodeKind.Object}.\n\t * @defaultValue false.\n\t */\n\treadonly useStoredKeys?: boolean;\n}\n\n/**\n * Options for how to interpret a `ConciseTree<TCustom>` without relying on schema.\n */\nexport interface SchemalessParseOptions {\n\t/**\n\t * Converts stored keys into whatever key the tree is using in its encoding.\n\t */\n\tkeyConverter?: {\n\t\tparse(type: string, inputKey: string): FieldKey;\n\t\tencode(type: string, key: FieldKey): string;\n\t};\n}\n\n/**\n * Tree representation with fields as properties and customized handle and child representations.\n */\nexport type CustomTree<TChild> = CustomTreeNode<TChild> | CustomTreeValue;\n\n/**\n * TreeLeafValue except the handle type is customized.\n */\nexport type CustomTreeValue = TreeLeafValue;\n\n/**\n * Tree node representation with fields as properties and customized child representation.\n */\nexport type CustomTreeNode<TChild> = TChild[] | { [key: string]: TChild };\n\n/**\n * Builds an {@link CustomTree} from a cursor in Nodes mode.\n */\nexport function customFromCursor<TChild>(\n\treader: ITreeCursor,\n\toptions: Required<TreeEncodingOptions>,\n\tschema: ReadonlyMap<string, TreeNodeSchema>,\n\tchildHandler: (\n\t\treader: ITreeCursor,\n\t\toptions: Required<TreeEncodingOptions>,\n\t\tschema: ReadonlyMap<string, TreeNodeSchema>,\n\t) => TChild,\n): CustomTree<TChild> {\n\tconst type = reader.type;\n\tconst nodeSchema = schema.get(type) ?? fail(0xb2e /* missing schema for type in cursor */);\n\n\tswitch (type) {\n\t\tcase numberSchema.identifier:\n\t\tcase booleanSchema.identifier:\n\t\tcase nullSchema.identifier:\n\t\tcase stringSchema.identifier:\n\t\t\tassert(reader.value !== undefined, 0xa50 /* out of schema: missing value */);\n\t\t\tassert(!isFluidHandle(reader.value), 0xa51 /* out of schema: unexpected FluidHandle */);\n\t\t\treturn reader.value;\n\t\tcase handleSchema.identifier:\n\t\t\tassert(reader.value !== undefined, 0xa52 /* out of schema: missing value */);\n\t\t\tassert(isFluidHandle(reader.value), 0xa53 /* out of schema: expected FluidHandle */);\n\t\t\treturn reader.value;\n\t\tdefault: {\n\t\t\tassert(reader.value === undefined, 0xa54 /* out of schema: unexpected value */);\n\t\t\tif (nodeSchema.kind === NodeKind.Array) {\n\t\t\t\tconst fields = inCursorField(reader, EmptyKey, () =>\n\t\t\t\t\tmapCursorField(reader, () => childHandler(reader, options, schema)),\n\t\t\t\t);\n\t\t\t\treturn fields;\n\t\t\t} else {\n\t\t\t\tconst fields: Record<string, TChild> = {};\n\t\t\t\tforEachField(reader, () => {\n\t\t\t\t\tconst children = mapCursorField(reader, () => childHandler(reader, options, schema));\n\t\t\t\t\tif (children.length === 1) {\n\t\t\t\t\t\tconst storedKey = reader.getFieldKey();\n\t\t\t\t\t\tconst key =\n\t\t\t\t\t\t\tisObjectNodeSchema(nodeSchema) && !options.useStoredKeys\n\t\t\t\t\t\t\t\t? (nodeSchema.storedKeyToPropertyKey.get(storedKey) ??\n\t\t\t\t\t\t\t\t\tfail(0xb2f /* missing property key */))\n\t\t\t\t\t\t\t\t: storedKey;\n\t\t\t\t\t\t// Length is checked above.\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\tfields[key] = children[0]!;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tassert(children.length === 0, 0xa19 /* invalid children number */);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn fields;\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Builds an {@link CustomTree} from a cursor in Nodes mode.\n * @remarks\n * Uses stored keys and stored schema.\n */\nexport function customFromCursorStored<TChild>(\n\treader: ITreeCursor,\n\tschema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>,\n\tchildHandler: (\n\t\treader: ITreeCursor,\n\t\tschema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>,\n\t) => TChild,\n): CustomTree<TChild> {\n\tconst type = reader.type;\n\tconst nodeSchema = schema.get(type) ?? fail(0xb30 /* missing schema for type in cursor */);\n\n\tif (nodeSchema instanceof LeafNodeStoredSchema) {\n\t\tassert(valueSchemaAllows(nodeSchema.leafValue, reader.value), 0xa9c /* invalid value */);\n\t\treturn reader.value;\n\t}\n\n\tassert(reader.value === undefined, 0xa9d /* out of schema: unexpected value */);\n\n\tconst arrayTypes = tryStoredSchemaAsArray(nodeSchema);\n\tif (arrayTypes !== undefined) {\n\t\tconst field = inCursorField(reader, EmptyKey, () =>\n\t\t\tmapCursorField(reader, () => childHandler(reader, schema)),\n\t\t);\n\t\treturn field;\n\t}\n\n\tconst fields: Record<string, TChild> = {};\n\tforEachField(reader, () => {\n\t\tconst children = mapCursorField(reader, () => childHandler(reader, schema));\n\t\tif (children.length === 1) {\n\t\t\tconst storedKey = reader.getFieldKey();\n\t\t\t// Length is checked above.\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tfields[storedKey] = children[0]!;\n\t\t} else {\n\t\t\tassert(children.length === 0, 0xa9e /* invalid children number */);\n\t\t}\n\t});\n\treturn fields;\n}\n\n/**\n * Assumes `schema` corresponds to a simple-tree schema.\n * If it is an array schema, returns the allowed types for the array field.\n * Otherwise returns `undefined`.\n */\nexport function tryStoredSchemaAsArray(\n\tschema: TreeNodeStoredSchema,\n): ReadonlySet<string> | undefined {\n\tif (schema instanceof ObjectNodeStoredSchema) {\n\t\tconst empty = schema.getFieldSchema(EmptyKey);\n\t\tif (empty.kind === FieldKinds.sequence.identifier) {\n\t\t\tassert(schema.objectNodeFields.size === 1, 0xa9f /* invalid schema */);\n\t\t\treturn empty.types;\n\t\t}\n\t}\n}\n\n/**\n * Options for how to transcode handles.\n * @remarks\n * Can be applied using {@link replaceHandles}.\n * @alpha\n */\nexport type HandleConverter<TCustom> = (data: IFluidHandle) => TCustom;\n\n/**\n * Clones tree, replacing any handles.\n * @remarks\n * This can be useful converting data containing handles to JSON compatible formats,\n * or just asserting that data does not contain handles.\n *\n * Reversing this replacement depends on how the replacer encodes handles, and can often be impossible if the replacer\n * does not have all the necessary context to restore the handles\n * (e.g. if the handles are something insufficiently descriptive,\n * if data referenced by the handle got garbage collected,\n * if the encoded form of the handle can't be differentiated from other data,\n * or the replacer doesn't have access to the correct Fluid container to to restore them from).\n *\n * Code attempting to reverse this replacement may want to use {@link cloneWithReplacements}.\n * @alpha\n */\nexport function replaceHandles<T>(tree: unknown, replacer: HandleConverter<T>): unknown {\n\treturn cloneWithReplacements(tree, \"\", (key, value) => {\n\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\tif (isFluidHandle(value)) {\n\t\t\treturn { clone: false, value: replacer(value) };\n\t\t} else {\n\t\t\treturn { clone: true, value };\n\t\t}\n\t});\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getSimpleSchema.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/getSimpleSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAG3D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,mBAAmB,GAAG,gBAAgB,CAE7E"}
1
+ {"version":3,"file":"getSimpleSchema.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/getSimpleSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI3D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,mBAAmB,GAAG,gBAAgB,CAE7E"}
@@ -1 +1 @@
1
- {"version":3,"file":"getSimpleSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/getSimpleSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,+EAAmE;AAEnE;;;;;;;;;;;;;;GAcG;AACH,SAAgB,eAAe,CAAC,MAA2B;IAC1D,OAAO,IAAA,gDAAkB,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC;AAFD,0CAEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ImplicitFieldSchema } from \"../schemaTypes.js\";\nimport type { SimpleTreeSchema } from \"../simpleSchema.js\";\nimport { toSimpleTreeSchema } from \"./viewSchemaToSimpleSchema.js\";\n\n/**\n * Copies data from {@link ImplicitFieldSchema} to create a {@link SimpleTreeSchema} out of new plain JavaScript objects, Sets and Maps.\n *\n * @remarks\n * See also {@link TreeViewConfigurationAlpha} which implements {@link SimpleTreeSchema} as a way to get a `SimpleTreeSchema` without copying the node and field schema and without losing as much type information.\n *\n * @privateRemarks\n * In the future, we may wish to move this to a more discoverable API location.\n * For now, while still an experimental API, it is surfaced as a free function.\n *\n * Note that all TreeNodeSchema get a {@link Context} cached on them as part of one time initialization which contains a map from identifier to all transitively referenced schema.\n * Perhaps exposing access to that would cover this use-case as well.\n *\n * @alpha\n */\nexport function getSimpleSchema(schema: ImplicitFieldSchema): SimpleTreeSchema {\n\treturn toSimpleTreeSchema(schema, true);\n}\n"]}
1
+ {"version":3,"file":"getSimpleSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/getSimpleSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,+EAAmE;AAEnE;;;;;;;;;;;;;;GAcG;AACH,SAAgB,eAAe,CAAC,MAA2B;IAC1D,OAAO,IAAA,gDAAkB,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC;AAFD,0CAEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ImplicitFieldSchema } from \"../schemaTypes.js\";\nimport type { SimpleTreeSchema } from \"../simpleSchema.js\";\n\nimport { toSimpleTreeSchema } from \"./viewSchemaToSimpleSchema.js\";\n\n/**\n * Copies data from {@link ImplicitFieldSchema} to create a {@link SimpleTreeSchema} out of new plain JavaScript objects, Sets and Maps.\n *\n * @remarks\n * See also {@link TreeViewConfigurationAlpha} which implements {@link SimpleTreeSchema} as a way to get a `SimpleTreeSchema` without copying the node and field schema and without losing as much type information.\n *\n * @privateRemarks\n * In the future, we may wish to move this to a more discoverable API location.\n * For now, while still an experimental API, it is surfaced as a free function.\n *\n * Note that all TreeNodeSchema get a {@link Context} cached on them as part of one time initialization which contains a map from identifier to all transitively referenced schema.\n * Perhaps exposing access to that would cover this use-case as well.\n *\n * @alpha\n */\nexport function getSimpleSchema(schema: ImplicitFieldSchema): SimpleTreeSchema {\n\treturn toSimpleTreeSchema(schema, true);\n}\n"]}
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.createIdentifierIndex = void 0;
8
8
  const internal_1 = require("@fluidframework/telemetry-utils/internal");
9
9
  const schemaTypes_js_1 = require("../schemaTypes.js");
10
- const objectNodeTypes_js_1 = require("../objectNodeTypes.js");
10
+ const index_js_1 = require("../node-kinds/index.js");
11
11
  const walkFieldSchema_js_1 = require("../walkFieldSchema.js");
12
12
  const simpleTreeIndex_js_1 = require("./simpleTreeIndex.js");
13
13
  function isStringKey(key) {
@@ -24,7 +24,7 @@ function createIdentifierIndex(view) {
24
24
  const identifierFields = new Map();
25
25
  (0, walkFieldSchema_js_1.walkFieldSchema)(view.schema, {
26
26
  node: (schemus) => {
27
- if (schemus instanceof objectNodeTypes_js_1.ObjectNodeSchema) {
27
+ if (schemus instanceof index_js_1.ObjectNodeSchema) {
28
28
  for (const [fieldKey, fieldSchema] of schemus.fields.entries()) {
29
29
  if (fieldSchema.kind === schemaTypes_js_1.FieldKind.Identifier) {
30
30
  identifierFields.set(schemus.identifier, fieldKey);
@@ -1 +1 @@
1
- {"version":3,"file":"identifierIndex.js","sourceRoot":"","sources":["../../../src/simple-tree/api/identifierIndex.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uEAAsE;AAEtE,sDAAwE;AAExE,8DAAyD;AAEzD,8DAAwD;AACxD,6DAAmF;AASnF,SAAS,WAAW,CAAC,GAAiB;IACrC,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC;AAChC,CAAC;AAED;;;;GAIG;AACH,SAAgB,qBAAqB,CACpC,IAAuB;IAEvB,4EAA4E;IAC5E,yEAAyE;IACzE,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAkB,CAAC;IACnD,IAAA,oCAAe,EAAC,IAAI,CAAC,MAAM,EAAE;QAC5B,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE;YACjB,IAAI,OAAO,YAAY,qCAAgB,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,0BAAS,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,IAAA,0CAAqB,EAC3B,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,qBAAU,CACnB,oFAAoF,CACpF,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC,EACD,WAAW,CACX,CAAC;AACH,CAAC;AAjCD,sDAiCC","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"]}
1
+ {"version":3,"file":"identifierIndex.js","sourceRoot":"","sources":["../../../src/simple-tree/api/identifierIndex.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uEAAsE;AAEtE,sDAAwE;AAExE,qDAA0D;AAE1D,8DAAwD;AACxD,6DAAmF;AASnF,SAAS,WAAW,CAAC,GAAiB;IACrC,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC;AAChC,CAAC;AAED;;;;GAIG;AACH,SAAgB,qBAAqB,CACpC,IAAuB;IAEvB,4EAA4E;IAC5E,yEAAyE;IACzE,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAkB,CAAC;IACnD,IAAA,oCAAe,EAAC,IAAI,CAAC,MAAM,EAAE;QAC5B,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE;YACjB,IAAI,OAAO,YAAY,2BAAgB,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,0BAAS,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,IAAA,0CAAqB,EAC3B,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,qBAAU,CACnB,oFAAoF,CACpF,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC,EACD,WAAW,CACX,CAAC;AACH,CAAC;AAjCD,sDAiCC","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 \"../node-kinds/index.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"]}
@@ -11,8 +11,8 @@ export { SchemaFactoryAlpha } from "./schemaFactoryAlpha.js";
11
11
  export type { ValidateRecursiveSchema, FixRecursiveArraySchema, ValidateRecursiveSchemaTemplate, FixRecursiveRecursionLimit, } from "./schemaFactoryRecursive.js";
12
12
  export { allowUnused } from "./schemaFactoryRecursive.js";
13
13
  export { adaptEnum, enumFromStrings, singletonSchema, } from "./schemaCreationUtilities.js";
14
- export { treeNodeApi, type TreeNodeApi, tryGetSchema, getStoredKey, getPropertyKeyFromStoredKey, } from "./treeNodeApi.js";
15
- export { createFromInsertable, cursorFromInsertable, createFromCursor, createFromMapTree, } from "./create.js";
14
+ export { treeNodeApi, type TreeNodeApi, tryGetSchema, getStoredKey, getPropertyKeyFromStoredKey, getIdentifierFromNode, } from "./treeNodeApi.js";
15
+ export { createFromCursor, createFromMapTree, } from "./create.js";
16
16
  export { type JsonSchemaId, type JsonSchemaType, type JsonObjectNodeSchema, type JsonArrayNodeSchema, type JsonMapNodeSchema, type JsonLeafNodeSchema, type JsonSchemaRef, type JsonRefPath, type JsonNodeSchema, type JsonNodeSchemaBase, type JsonTreeSchema, type JsonFieldSchema, type JsonLeafSchemaType, } from "./jsonSchema.js";
17
17
  export type { TreeSchemaEncodingOptions } from "./getJsonSchema.js";
18
18
  export { getJsonSchema } from "./getJsonSchema.js";
@@ -30,5 +30,4 @@ export { type TransactionConstraint, type NodeInDocumentConstraint, type RunTran
30
30
  export { generateSchemaFromSimpleSchema } from "./schemaFromSimple.js";
31
31
  export { toSimpleTreeSchema } from "./viewSchemaToSimpleSchema.js";
32
32
  export type { TreeChangeEvents } from "./treeChangeEvents.js";
33
- export { RecursiveObject as test_RecursiveObject, base as test_RecursiveObject_base, RecursiveObjectPojoMode as test_RecursiveObjectPojoMode, } from "./testRecursiveDomain.js";
34
33
  //# 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,YAAY,EACX,UAAU,EACV,sBAAsB,EACtB,yBAAyB,GACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,qBAAqB,EACrB,0BAA0B,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACX,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,yBAAyB,EACzB,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,UAAU,GACV,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EACN,aAAa,EACb,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,aAAa,EAClB,aAAa,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,YAAY,EACX,uBAAuB,EACvB,uBAAuB,EACvB,+BAA+B,EAC/B,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AAiC,EACjC,+BAA+B,EAC/B,aAAa,GACb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,0BAA0B,EAC1B,iBAAiB,EACjB,iBAAiB,EACjB,yBAAyB,GACzB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,KAAK,mBAAmB,EACxB,sBAAsB,EACtB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,sBAAsB,EACtB,cAAc,EACd,KAAK,eAAe,GACpB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACN,KAAK,WAAW,EAChB,iBAAiB,EACjB,yBAAyB,GACzB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC1F,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,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACN,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,6BAA6B,EAClC,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,QAAQ,GACR,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.test_RecursiveObjectPojoMode = exports.test_RecursiveObject_base = exports.test_RecursiveObject = exports.toSimpleTreeSchema = exports.generateSchemaFromSimpleSchema = exports.rollback = exports.comparePersistedSchema = exports.extractPersistedSchema = exports.createIdentifierIndex = exports.createSimpleTreeIndex = exports.TreeBeta = exports.replaceConciseTreeHandles = exports.conciseFromCursor = exports.replaceHandles = exports.tryStoredSchemaAsArray = exports.customFromCursorStored = exports.replaceVerboseTreeHandles = exports.verboseFromCursor = exports.cursorFromVerbose = exports.applySchemaToParserOptions = exports.SchemaCompatibilityTester = exports.getSimpleSchema = exports.getJsonSchema = exports.createFromMapTree = exports.createFromCursor = exports.cursorFromInsertable = exports.createFromInsertable = exports.getPropertyKeyFromStoredKey = exports.getStoredKey = exports.tryGetSchema = exports.treeNodeApi = exports.singletonSchema = exports.enumFromStrings = exports.adaptEnum = exports.allowUnused = exports.SchemaFactoryAlpha = exports.schemaStatics = exports.SchemaFactory = exports.asTreeViewAlpha = exports.TreeViewConfigurationAlpha = exports.TreeViewConfiguration = void 0;
7
+ exports.toSimpleTreeSchema = exports.generateSchemaFromSimpleSchema = exports.rollback = exports.comparePersistedSchema = exports.extractPersistedSchema = exports.createIdentifierIndex = exports.createSimpleTreeIndex = exports.TreeBeta = exports.replaceConciseTreeHandles = exports.conciseFromCursor = exports.replaceHandles = exports.tryStoredSchemaAsArray = exports.customFromCursorStored = exports.replaceVerboseTreeHandles = exports.verboseFromCursor = exports.cursorFromVerbose = exports.applySchemaToParserOptions = exports.SchemaCompatibilityTester = exports.getSimpleSchema = exports.getJsonSchema = exports.createFromMapTree = exports.createFromCursor = exports.getIdentifierFromNode = exports.getPropertyKeyFromStoredKey = exports.getStoredKey = exports.tryGetSchema = exports.treeNodeApi = exports.singletonSchema = exports.enumFromStrings = exports.adaptEnum = exports.allowUnused = exports.SchemaFactoryAlpha = exports.schemaStatics = exports.SchemaFactory = exports.asTreeViewAlpha = exports.TreeViewConfigurationAlpha = exports.TreeViewConfiguration = void 0;
8
8
  var configuration_js_1 = require("./configuration.js");
9
9
  Object.defineProperty(exports, "TreeViewConfiguration", { enumerable: true, get: function () { return configuration_js_1.TreeViewConfiguration; } });
10
10
  Object.defineProperty(exports, "TreeViewConfigurationAlpha", { enumerable: true, get: function () { return configuration_js_1.TreeViewConfigurationAlpha; } });
@@ -26,9 +26,8 @@ Object.defineProperty(exports, "treeNodeApi", { enumerable: true, get: function
26
26
  Object.defineProperty(exports, "tryGetSchema", { enumerable: true, get: function () { return treeNodeApi_js_1.tryGetSchema; } });
27
27
  Object.defineProperty(exports, "getStoredKey", { enumerable: true, get: function () { return treeNodeApi_js_1.getStoredKey; } });
28
28
  Object.defineProperty(exports, "getPropertyKeyFromStoredKey", { enumerable: true, get: function () { return treeNodeApi_js_1.getPropertyKeyFromStoredKey; } });
29
+ Object.defineProperty(exports, "getIdentifierFromNode", { enumerable: true, get: function () { return treeNodeApi_js_1.getIdentifierFromNode; } });
29
30
  var create_js_1 = require("./create.js");
30
- Object.defineProperty(exports, "createFromInsertable", { enumerable: true, get: function () { return create_js_1.createFromInsertable; } });
31
- Object.defineProperty(exports, "cursorFromInsertable", { enumerable: true, get: function () { return create_js_1.cursorFromInsertable; } });
32
31
  Object.defineProperty(exports, "createFromCursor", { enumerable: true, get: function () { return create_js_1.createFromCursor; } });
33
32
  Object.defineProperty(exports, "createFromMapTree", { enumerable: true, get: function () { return create_js_1.createFromMapTree; } });
34
33
  var getJsonSchema_js_1 = require("./getJsonSchema.js");
@@ -64,10 +63,4 @@ var schemaFromSimple_js_1 = require("./schemaFromSimple.js");
64
63
  Object.defineProperty(exports, "generateSchemaFromSimpleSchema", { enumerable: true, get: function () { return schemaFromSimple_js_1.generateSchemaFromSimpleSchema; } });
65
64
  var viewSchemaToSimpleSchema_js_1 = require("./viewSchemaToSimpleSchema.js");
66
65
  Object.defineProperty(exports, "toSimpleTreeSchema", { enumerable: true, get: function () { return viewSchemaToSimpleSchema_js_1.toSimpleTreeSchema; } });
67
- // Exporting the schema (RecursiveObject) to test that recursive types are working correctly.
68
- // These are `@internal` so they can't be included in the `InternalClassTreeTypes` due to https://github.com/microsoft/rushstack/issues/3639
69
- var testRecursiveDomain_js_1 = require("./testRecursiveDomain.js");
70
- Object.defineProperty(exports, "test_RecursiveObject", { enumerable: true, get: function () { return testRecursiveDomain_js_1.RecursiveObject; } });
71
- Object.defineProperty(exports, "test_RecursiveObject_base", { enumerable: true, get: function () { return testRecursiveDomain_js_1.base; } });
72
- Object.defineProperty(exports, "test_RecursiveObjectPojoMode", { enumerable: true, get: function () { return testRecursiveDomain_js_1.RecursiveObjectPojoMode; } });
73
66
  //# sourceMappingURL=index.js.map