@fluidframework/tree 2.11.0 → 2.13.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 (704) hide show
  1. package/CHANGELOG.md +140 -0
  2. package/api-report/tree.alpha.api.md +88 -12
  3. package/api-report/tree.beta.api.md +23 -11
  4. package/api-report/tree.legacy.alpha.api.md +23 -11
  5. package/api-report/tree.legacy.public.api.md +23 -11
  6. package/api-report/tree.public.api.md +23 -11
  7. package/dist/alpha.d.ts +11 -0
  8. package/dist/beta.d.ts +2 -0
  9. package/dist/core/index.d.ts +2 -2
  10. package/dist/core/index.d.ts.map +1 -1
  11. package/dist/core/index.js +5 -3
  12. package/dist/core/index.js.map +1 -1
  13. package/dist/core/rebase/utils.d.ts.map +1 -1
  14. package/dist/core/rebase/utils.js +2 -9
  15. package/dist/core/rebase/utils.js.map +1 -1
  16. package/dist/core/schema-stored/format.d.ts +0 -3
  17. package/dist/core/schema-stored/format.d.ts.map +1 -1
  18. package/dist/core/schema-stored/format.js.map +1 -1
  19. package/dist/core/schema-stored/schema.d.ts +12 -10
  20. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  21. package/dist/core/schema-stored/schema.js +3 -5
  22. package/dist/core/schema-stored/schema.js.map +1 -1
  23. package/dist/core/schema-view/index.d.ts +1 -1
  24. package/dist/core/schema-view/index.d.ts.map +1 -1
  25. package/dist/core/schema-view/index.js +1 -2
  26. package/dist/core/schema-view/index.js.map +1 -1
  27. package/dist/core/schema-view/view.d.ts +0 -7
  28. package/dist/core/schema-view/view.d.ts.map +1 -1
  29. package/dist/core/schema-view/view.js +1 -12
  30. package/dist/core/schema-view/view.js.map +1 -1
  31. package/dist/{feature-libraries/chunked-forest → core/tree}/chunk.d.ts +2 -1
  32. package/dist/core/tree/chunk.d.ts.map +1 -0
  33. package/dist/{feature-libraries/chunked-forest → core/tree}/chunk.js +2 -2
  34. package/dist/core/tree/chunk.js.map +1 -0
  35. package/dist/core/tree/index.d.ts +1 -0
  36. package/dist/core/tree/index.d.ts.map +1 -1
  37. package/dist/core/tree/index.js +5 -1
  38. package/dist/core/tree/index.js.map +1 -1
  39. package/dist/core/tree/treeTextFormat.d.ts +0 -5
  40. package/dist/core/tree/treeTextFormat.d.ts.map +1 -1
  41. package/dist/core/tree/treeTextFormat.js.map +1 -1
  42. package/dist/core/tree/types.d.ts +0 -5
  43. package/dist/core/tree/types.d.ts.map +1 -1
  44. package/dist/core/tree/types.js +0 -1
  45. package/dist/core/tree/types.js.map +1 -1
  46. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts +1 -2
  47. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  48. package/dist/feature-libraries/chunked-forest/basicChunk.js +14 -14
  49. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  50. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +1 -2
  51. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  52. package/dist/feature-libraries/chunked-forest/chunkTree.js +2 -3
  53. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  54. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -2
  55. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  56. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  57. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts +1 -2
  58. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts.map +1 -1
  59. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  60. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -2
  61. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  62. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  63. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
  64. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  65. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  66. package/dist/feature-libraries/chunked-forest/emptyChunk.d.ts +1 -1
  67. package/dist/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
  68. package/dist/feature-libraries/chunked-forest/emptyChunk.js +2 -3
  69. package/dist/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  70. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  71. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  72. package/dist/feature-libraries/chunked-forest/index.js +5 -5
  73. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  74. package/dist/feature-libraries/chunked-forest/sequenceChunk.d.ts +1 -1
  75. package/dist/feature-libraries/chunked-forest/sequenceChunk.d.ts.map +1 -1
  76. package/dist/feature-libraries/chunked-forest/sequenceChunk.js +2 -2
  77. package/dist/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
  78. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +1 -2
  79. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  80. package/dist/feature-libraries/chunked-forest/uniformChunk.js +13 -13
  81. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  82. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +10 -0
  83. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  84. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +3 -0
  85. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  86. package/dist/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
  87. package/dist/feature-libraries/default-schema/defaultSchema.js +1 -0
  88. package/dist/feature-libraries/default-schema/defaultSchema.js.map +1 -1
  89. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  90. package/dist/feature-libraries/default-schema/schemaChecker.js +2 -1
  91. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  92. package/dist/feature-libraries/index.d.ts +1 -2
  93. package/dist/feature-libraries/index.d.ts.map +1 -1
  94. package/dist/feature-libraries/index.js +6 -4
  95. package/dist/feature-libraries/index.js.map +1 -1
  96. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +8 -1
  97. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  98. package/dist/feature-libraries/indexing/anchorTreeIndex.js +31 -5
  99. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  100. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +1 -1
  101. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  102. package/dist/feature-libraries/modular-schema/crossFieldQueries.js +8 -2
  103. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  104. package/dist/feature-libraries/modular-schema/discrepancies.d.ts +84 -24
  105. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  106. package/dist/feature-libraries/modular-schema/discrepancies.js +32 -33
  107. package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  108. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +12 -5
  109. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  110. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  111. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  112. package/dist/feature-libraries/modular-schema/genericFieldKind.js +2 -1
  113. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  114. package/dist/feature-libraries/modular-schema/index.d.ts +2 -2
  115. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  116. package/dist/feature-libraries/modular-schema/index.js +5 -1
  117. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  118. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts +0 -1
  119. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  120. package/dist/feature-libraries/modular-schema/isNeverTree.js +0 -1
  121. package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  122. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -0
  123. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  124. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +89 -25
  125. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  126. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +12 -0
  127. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  128. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  129. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  130. package/dist/feature-libraries/optional-field/optionalField.js +24 -4
  131. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  132. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
  133. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  134. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
  135. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  136. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +12 -12
  137. package/dist/feature-libraries/sequence-field/formatV1.d.ts +99 -99
  138. package/dist/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
  139. package/dist/feature-libraries/sequence-field/formatV2.d.ts +76 -76
  140. package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  141. package/dist/feature-libraries/sequence-field/formatV3.d.ts +54 -54
  142. package/dist/feature-libraries/sequence-field/types.d.ts +0 -1
  143. package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
  144. package/dist/feature-libraries/sequence-field/types.js.map +1 -1
  145. package/dist/feature-libraries/sequence-field/utils.d.ts +2 -2
  146. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  147. package/dist/feature-libraries/sequence-field/utils.js +14 -5
  148. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  149. package/dist/index.d.ts +4 -5
  150. package/dist/index.d.ts.map +1 -1
  151. package/dist/index.js +2 -14
  152. package/dist/index.js.map +1 -1
  153. package/dist/legacy.d.ts +2 -0
  154. package/dist/packageVersion.d.ts +1 -1
  155. package/dist/packageVersion.js +1 -1
  156. package/dist/packageVersion.js.map +1 -1
  157. package/dist/public.d.ts +2 -0
  158. package/dist/shared-tree/index.d.ts +3 -2
  159. package/dist/shared-tree/index.d.ts.map +1 -1
  160. package/dist/shared-tree/index.js +2 -1
  161. package/dist/shared-tree/index.js.map +1 -1
  162. package/dist/shared-tree/schematizeTree.d.ts +1 -1
  163. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  164. package/dist/shared-tree/schematizeTree.js +6 -6
  165. package/dist/shared-tree/schematizeTree.js.map +1 -1
  166. package/dist/shared-tree/schematizingTreeView.d.ts +10 -1
  167. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  168. package/dist/shared-tree/schematizingTreeView.js +51 -12
  169. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  170. package/dist/shared-tree/sharedTree.d.ts +31 -10
  171. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  172. package/dist/shared-tree/sharedTree.js +106 -15
  173. package/dist/shared-tree/sharedTree.js.map +1 -1
  174. package/dist/shared-tree/transactionTypes.d.ts +105 -0
  175. package/dist/shared-tree/transactionTypes.d.ts.map +1 -0
  176. package/dist/shared-tree/transactionTypes.js +13 -0
  177. package/dist/shared-tree/transactionTypes.js.map +1 -0
  178. package/dist/shared-tree/treeApi.d.ts +1 -25
  179. package/dist/shared-tree/treeApi.d.ts.map +1 -1
  180. package/dist/shared-tree/treeApi.js +4 -8
  181. package/dist/shared-tree/treeApi.js.map +1 -1
  182. package/dist/shared-tree/treeCheckout.d.ts +39 -13
  183. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  184. package/dist/shared-tree/treeCheckout.js +275 -128
  185. package/dist/shared-tree/treeCheckout.js.map +1 -1
  186. package/dist/shared-tree-core/branch.d.ts +13 -35
  187. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  188. package/dist/shared-tree-core/branch.js +12 -77
  189. package/dist/shared-tree-core/branch.js.map +1 -1
  190. package/dist/shared-tree-core/branchCommitEnricher.d.ts +7 -1
  191. package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  192. package/dist/shared-tree-core/branchCommitEnricher.js +16 -18
  193. package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
  194. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  195. package/dist/shared-tree-core/editManager.js +2 -2
  196. package/dist/shared-tree-core/editManager.js.map +1 -1
  197. package/dist/shared-tree-core/index.d.ts +3 -3
  198. package/dist/shared-tree-core/index.d.ts.map +1 -1
  199. package/dist/shared-tree-core/index.js +2 -2
  200. package/dist/shared-tree-core/index.js.map +1 -1
  201. package/dist/shared-tree-core/sharedTreeCore.d.ts +2 -9
  202. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  203. package/dist/shared-tree-core/sharedTreeCore.js +4 -16
  204. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  205. package/dist/shared-tree-core/transaction.d.ts +38 -0
  206. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  207. package/dist/shared-tree-core/transaction.js +118 -6
  208. package/dist/shared-tree-core/transaction.js.map +1 -1
  209. package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
  210. package/dist/simple-tree/api/conciseTree.js +1 -1
  211. package/dist/simple-tree/api/conciseTree.js.map +1 -1
  212. package/dist/simple-tree/api/create.d.ts.map +1 -1
  213. package/dist/simple-tree/api/create.js +5 -1
  214. package/dist/simple-tree/api/create.js.map +1 -1
  215. package/dist/simple-tree/api/customTree.d.ts +14 -2
  216. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  217. package/dist/simple-tree/api/customTree.js +53 -3
  218. package/dist/simple-tree/api/customTree.js.map +1 -1
  219. package/dist/simple-tree/api/index.d.ts +3 -2
  220. package/dist/simple-tree/api/index.d.ts.map +1 -1
  221. package/dist/simple-tree/api/index.js +6 -1
  222. package/dist/simple-tree/api/index.js.map +1 -1
  223. package/dist/simple-tree/api/jsonSchema.d.ts +6 -0
  224. package/dist/simple-tree/api/jsonSchema.d.ts.map +1 -1
  225. package/dist/simple-tree/api/jsonSchema.js.map +1 -1
  226. package/dist/simple-tree/api/schemaFactory.d.ts +65 -8
  227. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  228. package/dist/simple-tree/api/schemaFactory.js +10 -4
  229. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  230. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +83 -0
  231. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -0
  232. package/dist/simple-tree/api/schemaFactoryAlpha.js +90 -0
  233. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -0
  234. package/dist/simple-tree/api/simpleSchema.d.ts +8 -2
  235. package/dist/simple-tree/api/simpleSchema.d.ts.map +1 -1
  236. package/dist/simple-tree/api/simpleSchema.js.map +1 -1
  237. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +13 -10
  238. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  239. package/dist/simple-tree/api/simpleTreeIndex.js +3 -1
  240. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  241. package/dist/simple-tree/api/storedSchema.d.ts +4 -4
  242. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  243. package/dist/simple-tree/api/storedSchema.js +8 -21
  244. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  245. package/dist/simple-tree/api/testRecursiveDomain.d.ts +5 -5
  246. package/dist/simple-tree/api/tree.d.ts +61 -0
  247. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  248. package/dist/simple-tree/api/tree.js.map +1 -1
  249. package/dist/simple-tree/api/verboseTree.js +1 -1
  250. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  251. package/dist/simple-tree/api/view.d.ts +14 -9
  252. package/dist/simple-tree/api/view.d.ts.map +1 -1
  253. package/dist/simple-tree/api/view.js +129 -40
  254. package/dist/simple-tree/api/view.js.map +1 -1
  255. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  256. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +11 -11
  257. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  258. package/dist/simple-tree/arrayNode.d.ts +2 -2
  259. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  260. package/dist/simple-tree/arrayNode.js +2 -1
  261. package/dist/simple-tree/arrayNode.js.map +1 -1
  262. package/dist/simple-tree/core/treeNodeSchema.d.ts +10 -6
  263. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  264. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  265. package/dist/simple-tree/index.d.ts +3 -3
  266. package/dist/simple-tree/index.d.ts.map +1 -1
  267. package/dist/simple-tree/index.js +6 -2
  268. package/dist/simple-tree/index.js.map +1 -1
  269. package/dist/simple-tree/leafNodeSchema.d.ts +5 -20
  270. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  271. package/dist/simple-tree/leafNodeSchema.js +0 -15
  272. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  273. package/dist/simple-tree/mapNode.d.ts +2 -2
  274. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  275. package/dist/simple-tree/mapNode.js +2 -1
  276. package/dist/simple-tree/mapNode.js.map +1 -1
  277. package/dist/simple-tree/objectNode.d.ts +9 -4
  278. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  279. package/dist/simple-tree/objectNode.js +19 -2
  280. package/dist/simple-tree/objectNode.js.map +1 -1
  281. package/dist/simple-tree/objectNodeTypes.d.ts +6 -2
  282. package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -1
  283. package/dist/simple-tree/objectNodeTypes.js.map +1 -1
  284. package/dist/simple-tree/schemaTypes.d.ts +51 -3
  285. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  286. package/dist/simple-tree/schemaTypes.js.map +1 -1
  287. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  288. package/dist/simple-tree/toStoredSchema.js +18 -13
  289. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  290. package/dist/util/brand.d.ts +0 -2
  291. package/dist/util/brand.d.ts.map +1 -1
  292. package/dist/util/brand.js +0 -1
  293. package/dist/util/brand.js.map +1 -1
  294. package/dist/util/index.d.ts +2 -2
  295. package/dist/util/index.d.ts.map +1 -1
  296. package/dist/util/index.js +4 -5
  297. package/dist/util/index.js.map +1 -1
  298. package/dist/util/rangeMap.d.ts +72 -42
  299. package/dist/util/rangeMap.d.ts.map +1 -1
  300. package/dist/util/rangeMap.js +161 -151
  301. package/dist/util/rangeMap.js.map +1 -1
  302. package/dist/util/typeCheck.d.ts +0 -2
  303. package/dist/util/typeCheck.d.ts.map +1 -1
  304. package/dist/util/typeCheck.js.map +1 -1
  305. package/dist/util/utils.d.ts +35 -1
  306. package/dist/util/utils.d.ts.map +1 -1
  307. package/dist/util/utils.js +32 -1
  308. package/dist/util/utils.js.map +1 -1
  309. package/lib/alpha.d.ts +11 -0
  310. package/lib/beta.d.ts +2 -0
  311. package/lib/core/index.d.ts +2 -2
  312. package/lib/core/index.d.ts.map +1 -1
  313. package/lib/core/index.js +2 -2
  314. package/lib/core/index.js.map +1 -1
  315. package/lib/core/rebase/utils.d.ts.map +1 -1
  316. package/lib/core/rebase/utils.js +3 -10
  317. package/lib/core/rebase/utils.js.map +1 -1
  318. package/lib/core/schema-stored/format.d.ts +0 -3
  319. package/lib/core/schema-stored/format.d.ts.map +1 -1
  320. package/lib/core/schema-stored/format.js.map +1 -1
  321. package/lib/core/schema-stored/schema.d.ts +12 -10
  322. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  323. package/lib/core/schema-stored/schema.js +3 -5
  324. package/lib/core/schema-stored/schema.js.map +1 -1
  325. package/lib/core/schema-view/index.d.ts +1 -1
  326. package/lib/core/schema-view/index.d.ts.map +1 -1
  327. package/lib/core/schema-view/index.js +1 -1
  328. package/lib/core/schema-view/index.js.map +1 -1
  329. package/lib/core/schema-view/view.d.ts +0 -7
  330. package/lib/core/schema-view/view.d.ts.map +1 -1
  331. package/lib/core/schema-view/view.js +0 -11
  332. package/lib/core/schema-view/view.js.map +1 -1
  333. package/lib/{feature-libraries/chunked-forest → core/tree}/chunk.d.ts +2 -1
  334. package/lib/core/tree/chunk.d.ts.map +1 -0
  335. package/lib/{feature-libraries/chunked-forest → core/tree}/chunk.js +1 -1
  336. package/lib/core/tree/chunk.js.map +1 -0
  337. package/lib/core/tree/index.d.ts +1 -0
  338. package/lib/core/tree/index.d.ts.map +1 -1
  339. package/lib/core/tree/index.js +1 -0
  340. package/lib/core/tree/index.js.map +1 -1
  341. package/lib/core/tree/treeTextFormat.d.ts +0 -5
  342. package/lib/core/tree/treeTextFormat.d.ts.map +1 -1
  343. package/lib/core/tree/treeTextFormat.js.map +1 -1
  344. package/lib/core/tree/types.d.ts +0 -5
  345. package/lib/core/tree/types.d.ts.map +1 -1
  346. package/lib/core/tree/types.js +0 -1
  347. package/lib/core/tree/types.js.map +1 -1
  348. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts +1 -2
  349. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  350. package/lib/feature-libraries/chunked-forest/basicChunk.js +1 -1
  351. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  352. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +1 -2
  353. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  354. package/lib/feature-libraries/chunked-forest/chunkTree.js +1 -2
  355. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  356. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -2
  357. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  358. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  359. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts +1 -2
  360. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts.map +1 -1
  361. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  362. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -2
  363. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  364. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  365. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
  366. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  367. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  368. package/lib/feature-libraries/chunked-forest/emptyChunk.d.ts +1 -1
  369. package/lib/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
  370. package/lib/feature-libraries/chunked-forest/emptyChunk.js +1 -2
  371. package/lib/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  372. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  373. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  374. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  375. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  376. package/lib/feature-libraries/chunked-forest/sequenceChunk.d.ts +1 -1
  377. package/lib/feature-libraries/chunked-forest/sequenceChunk.d.ts.map +1 -1
  378. package/lib/feature-libraries/chunked-forest/sequenceChunk.js +1 -1
  379. package/lib/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
  380. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +1 -2
  381. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  382. package/lib/feature-libraries/chunked-forest/uniformChunk.js +1 -1
  383. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  384. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +10 -0
  385. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  386. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +3 -0
  387. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  388. package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
  389. package/lib/feature-libraries/default-schema/defaultSchema.js +1 -0
  390. package/lib/feature-libraries/default-schema/defaultSchema.js.map +1 -1
  391. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  392. package/lib/feature-libraries/default-schema/schemaChecker.js +2 -1
  393. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  394. package/lib/feature-libraries/index.d.ts +1 -2
  395. package/lib/feature-libraries/index.d.ts.map +1 -1
  396. package/lib/feature-libraries/index.js +1 -2
  397. package/lib/feature-libraries/index.js.map +1 -1
  398. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +8 -1
  399. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  400. package/lib/feature-libraries/indexing/anchorTreeIndex.js +31 -5
  401. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  402. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +1 -1
  403. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  404. package/lib/feature-libraries/modular-schema/crossFieldQueries.js +9 -3
  405. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  406. package/lib/feature-libraries/modular-schema/discrepancies.d.ts +84 -24
  407. package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  408. package/lib/feature-libraries/modular-schema/discrepancies.js +25 -28
  409. package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  410. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +12 -5
  411. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  412. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  413. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  414. package/lib/feature-libraries/modular-schema/genericFieldKind.js +2 -1
  415. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  416. package/lib/feature-libraries/modular-schema/index.d.ts +2 -2
  417. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  418. package/lib/feature-libraries/modular-schema/index.js +1 -1
  419. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  420. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts +0 -1
  421. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  422. package/lib/feature-libraries/modular-schema/isNeverTree.js +0 -1
  423. package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  424. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -0
  425. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  426. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +89 -25
  427. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  428. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +12 -0
  429. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  430. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  431. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  432. package/lib/feature-libraries/optional-field/optionalField.js +24 -4
  433. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  434. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
  435. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  436. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
  437. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  438. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +12 -12
  439. package/lib/feature-libraries/sequence-field/formatV1.d.ts +99 -99
  440. package/lib/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
  441. package/lib/feature-libraries/sequence-field/formatV2.d.ts +76 -76
  442. package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  443. package/lib/feature-libraries/sequence-field/formatV3.d.ts +54 -54
  444. package/lib/feature-libraries/sequence-field/types.d.ts +0 -1
  445. package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
  446. package/lib/feature-libraries/sequence-field/types.js.map +1 -1
  447. package/lib/feature-libraries/sequence-field/utils.d.ts +2 -2
  448. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  449. package/lib/feature-libraries/sequence-field/utils.js +14 -5
  450. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  451. package/lib/index.d.ts +4 -5
  452. package/lib/index.d.ts.map +1 -1
  453. package/lib/index.js +3 -4
  454. package/lib/index.js.map +1 -1
  455. package/lib/legacy.d.ts +2 -0
  456. package/lib/packageVersion.d.ts +1 -1
  457. package/lib/packageVersion.js +1 -1
  458. package/lib/packageVersion.js.map +1 -1
  459. package/lib/public.d.ts +2 -0
  460. package/lib/shared-tree/index.d.ts +3 -2
  461. package/lib/shared-tree/index.d.ts.map +1 -1
  462. package/lib/shared-tree/index.js +2 -1
  463. package/lib/shared-tree/index.js.map +1 -1
  464. package/lib/shared-tree/schematizeTree.d.ts +1 -1
  465. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  466. package/lib/shared-tree/schematizeTree.js +7 -7
  467. package/lib/shared-tree/schematizeTree.js.map +1 -1
  468. package/lib/shared-tree/schematizingTreeView.d.ts +10 -1
  469. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  470. package/lib/shared-tree/schematizingTreeView.js +56 -17
  471. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  472. package/lib/shared-tree/sharedTree.d.ts +31 -10
  473. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  474. package/lib/shared-tree/sharedTree.js +107 -16
  475. package/lib/shared-tree/sharedTree.js.map +1 -1
  476. package/lib/shared-tree/transactionTypes.d.ts +105 -0
  477. package/lib/shared-tree/transactionTypes.d.ts.map +1 -0
  478. package/lib/shared-tree/transactionTypes.js +10 -0
  479. package/lib/shared-tree/transactionTypes.js.map +1 -0
  480. package/lib/shared-tree/treeApi.d.ts +1 -25
  481. package/lib/shared-tree/treeApi.d.ts.map +1 -1
  482. package/lib/shared-tree/treeApi.js +1 -5
  483. package/lib/shared-tree/treeApi.js.map +1 -1
  484. package/lib/shared-tree/treeCheckout.d.ts +39 -13
  485. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  486. package/lib/shared-tree/treeCheckout.js +277 -130
  487. package/lib/shared-tree/treeCheckout.js.map +1 -1
  488. package/lib/shared-tree-core/branch.d.ts +13 -35
  489. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  490. package/lib/shared-tree-core/branch.js +12 -76
  491. package/lib/shared-tree-core/branch.js.map +1 -1
  492. package/lib/shared-tree-core/branchCommitEnricher.d.ts +7 -1
  493. package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  494. package/lib/shared-tree-core/branchCommitEnricher.js +16 -18
  495. package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
  496. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  497. package/lib/shared-tree-core/editManager.js +3 -3
  498. package/lib/shared-tree-core/editManager.js.map +1 -1
  499. package/lib/shared-tree-core/index.d.ts +3 -3
  500. package/lib/shared-tree-core/index.d.ts.map +1 -1
  501. package/lib/shared-tree-core/index.js +2 -2
  502. package/lib/shared-tree-core/index.js.map +1 -1
  503. package/lib/shared-tree-core/sharedTreeCore.d.ts +2 -9
  504. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  505. package/lib/shared-tree-core/sharedTreeCore.js +4 -16
  506. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  507. package/lib/shared-tree-core/transaction.d.ts +38 -0
  508. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  509. package/lib/shared-tree-core/transaction.js +112 -1
  510. package/lib/shared-tree-core/transaction.js.map +1 -1
  511. package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
  512. package/lib/simple-tree/api/conciseTree.js +2 -2
  513. package/lib/simple-tree/api/conciseTree.js.map +1 -1
  514. package/lib/simple-tree/api/create.d.ts.map +1 -1
  515. package/lib/simple-tree/api/create.js +5 -1
  516. package/lib/simple-tree/api/create.js.map +1 -1
  517. package/lib/simple-tree/api/customTree.d.ts +14 -2
  518. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  519. package/lib/simple-tree/api/customTree.js +50 -2
  520. package/lib/simple-tree/api/customTree.js.map +1 -1
  521. package/lib/simple-tree/api/index.d.ts +3 -2
  522. package/lib/simple-tree/api/index.d.ts.map +1 -1
  523. package/lib/simple-tree/api/index.js +3 -1
  524. package/lib/simple-tree/api/index.js.map +1 -1
  525. package/lib/simple-tree/api/jsonSchema.d.ts +6 -0
  526. package/lib/simple-tree/api/jsonSchema.d.ts.map +1 -1
  527. package/lib/simple-tree/api/jsonSchema.js.map +1 -1
  528. package/lib/simple-tree/api/schemaFactory.d.ts +65 -8
  529. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  530. package/lib/simple-tree/api/schemaFactory.js +9 -3
  531. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  532. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +83 -0
  533. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -0
  534. package/lib/simple-tree/api/schemaFactoryAlpha.js +86 -0
  535. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -0
  536. package/lib/simple-tree/api/simpleSchema.d.ts +8 -2
  537. package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -1
  538. package/lib/simple-tree/api/simpleSchema.js.map +1 -1
  539. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +14 -11
  540. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  541. package/lib/simple-tree/api/simpleTreeIndex.js +3 -1
  542. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  543. package/lib/simple-tree/api/storedSchema.d.ts +4 -4
  544. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  545. package/lib/simple-tree/api/storedSchema.js +5 -18
  546. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  547. package/lib/simple-tree/api/testRecursiveDomain.d.ts +5 -5
  548. package/lib/simple-tree/api/tree.d.ts +61 -0
  549. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  550. package/lib/simple-tree/api/tree.js.map +1 -1
  551. package/lib/simple-tree/api/verboseTree.js +2 -2
  552. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  553. package/lib/simple-tree/api/view.d.ts +14 -9
  554. package/lib/simple-tree/api/view.d.ts.map +1 -1
  555. package/lib/simple-tree/api/view.js +131 -42
  556. package/lib/simple-tree/api/view.js.map +1 -1
  557. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  558. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +12 -12
  559. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  560. package/lib/simple-tree/arrayNode.d.ts +2 -2
  561. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  562. package/lib/simple-tree/arrayNode.js +2 -1
  563. package/lib/simple-tree/arrayNode.js.map +1 -1
  564. package/lib/simple-tree/core/treeNodeSchema.d.ts +10 -6
  565. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  566. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  567. package/lib/simple-tree/index.d.ts +3 -3
  568. package/lib/simple-tree/index.d.ts.map +1 -1
  569. package/lib/simple-tree/index.js +2 -2
  570. package/lib/simple-tree/index.js.map +1 -1
  571. package/lib/simple-tree/leafNodeSchema.d.ts +5 -20
  572. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  573. package/lib/simple-tree/leafNodeSchema.js +0 -15
  574. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  575. package/lib/simple-tree/mapNode.d.ts +2 -2
  576. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  577. package/lib/simple-tree/mapNode.js +2 -1
  578. package/lib/simple-tree/mapNode.js.map +1 -1
  579. package/lib/simple-tree/objectNode.d.ts +9 -4
  580. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  581. package/lib/simple-tree/objectNode.js +17 -1
  582. package/lib/simple-tree/objectNode.js.map +1 -1
  583. package/lib/simple-tree/objectNodeTypes.d.ts +6 -2
  584. package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -1
  585. package/lib/simple-tree/objectNodeTypes.js.map +1 -1
  586. package/lib/simple-tree/schemaTypes.d.ts +51 -3
  587. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  588. package/lib/simple-tree/schemaTypes.js.map +1 -1
  589. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  590. package/lib/simple-tree/toStoredSchema.js +19 -14
  591. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  592. package/lib/util/brand.d.ts +0 -2
  593. package/lib/util/brand.d.ts.map +1 -1
  594. package/lib/util/brand.js +0 -1
  595. package/lib/util/brand.js.map +1 -1
  596. package/lib/util/index.d.ts +2 -2
  597. package/lib/util/index.d.ts.map +1 -1
  598. package/lib/util/index.js +2 -2
  599. package/lib/util/index.js.map +1 -1
  600. package/lib/util/rangeMap.d.ts +72 -42
  601. package/lib/util/rangeMap.d.ts.map +1 -1
  602. package/lib/util/rangeMap.js +159 -146
  603. package/lib/util/rangeMap.js.map +1 -1
  604. package/lib/util/typeCheck.d.ts +0 -2
  605. package/lib/util/typeCheck.d.ts.map +1 -1
  606. package/lib/util/typeCheck.js.map +1 -1
  607. package/lib/util/utils.d.ts +35 -1
  608. package/lib/util/utils.d.ts.map +1 -1
  609. package/lib/util/utils.js +29 -0
  610. package/lib/util/utils.js.map +1 -1
  611. package/package.json +23 -23
  612. package/src/core/index.ts +5 -1
  613. package/src/core/rebase/utils.ts +17 -20
  614. package/src/core/schema-stored/format.ts +0 -3
  615. package/src/core/schema-stored/schema.ts +13 -10
  616. package/src/core/schema-view/index.ts +0 -1
  617. package/src/core/schema-view/view.ts +0 -11
  618. package/src/{feature-libraries/chunked-forest → core/tree}/chunk.ts +4 -4
  619. package/src/core/tree/index.ts +8 -0
  620. package/src/core/tree/treeTextFormat.ts +0 -5
  621. package/src/core/tree/types.ts +0 -5
  622. package/src/feature-libraries/chunked-forest/basicChunk.ts +4 -2
  623. package/src/feature-libraries/chunked-forest/chunkTree.ts +2 -1
  624. package/src/feature-libraries/chunked-forest/chunkedForest.ts +2 -1
  625. package/src/feature-libraries/chunked-forest/codec/chunkCodecUtilities.ts +1 -2
  626. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +6 -2
  627. package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -1
  628. package/src/feature-libraries/chunked-forest/emptyChunk.ts +4 -2
  629. package/src/feature-libraries/chunked-forest/index.ts +1 -1
  630. package/src/feature-libraries/chunked-forest/sequenceChunk.ts +1 -1
  631. package/src/feature-libraries/chunked-forest/uniformChunk.ts +4 -1
  632. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +14 -1
  633. package/src/feature-libraries/default-schema/defaultSchema.ts +1 -0
  634. package/src/feature-libraries/default-schema/schemaChecker.ts +4 -1
  635. package/src/feature-libraries/index.ts +13 -1
  636. package/src/feature-libraries/indexing/anchorTreeIndex.ts +34 -5
  637. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +9 -9
  638. package/src/feature-libraries/modular-schema/discrepancies.ts +76 -38
  639. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +13 -9
  640. package/src/feature-libraries/modular-schema/genericFieldKind.ts +4 -2
  641. package/src/feature-libraries/modular-schema/index.ts +14 -0
  642. package/src/feature-libraries/modular-schema/isNeverTree.ts +0 -2
  643. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +124 -31
  644. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +12 -0
  645. package/src/feature-libraries/optional-field/optionalField.ts +34 -5
  646. package/src/feature-libraries/sequence-field/types.ts +0 -1
  647. package/src/feature-libraries/sequence-field/utils.ts +18 -7
  648. package/src/index.ts +12 -29
  649. package/src/packageVersion.ts +1 -1
  650. package/src/shared-tree/index.ts +13 -2
  651. package/src/shared-tree/schematizeTree.ts +6 -10
  652. package/src/shared-tree/schematizingTreeView.ts +102 -23
  653. package/src/shared-tree/sharedTree.ts +181 -44
  654. package/src/shared-tree/transactionTypes.ts +125 -0
  655. package/src/shared-tree/treeApi.ts +1 -28
  656. package/src/shared-tree/treeCheckout.ts +358 -175
  657. package/src/shared-tree-core/branch.ts +29 -122
  658. package/src/shared-tree-core/branchCommitEnricher.ts +19 -20
  659. package/src/shared-tree-core/editManager.ts +3 -8
  660. package/src/shared-tree-core/index.ts +2 -1
  661. package/src/shared-tree-core/sharedTreeCore.ts +8 -19
  662. package/src/shared-tree-core/transaction.ts +145 -0
  663. package/src/simple-tree/api/conciseTree.ts +2 -2
  664. package/src/simple-tree/api/create.ts +5 -1
  665. package/src/simple-tree/api/customTree.ts +69 -1
  666. package/src/simple-tree/api/index.ts +13 -2
  667. package/src/simple-tree/api/jsonSchema.ts +7 -0
  668. package/src/simple-tree/api/schemaFactory.ts +91 -3
  669. package/src/simple-tree/api/schemaFactoryAlpha.ts +253 -0
  670. package/src/simple-tree/api/simpleSchema.ts +9 -2
  671. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +22 -12
  672. package/src/simple-tree/api/simpleTreeIndex.ts +2 -0
  673. package/src/simple-tree/api/storedSchema.ts +7 -22
  674. package/src/simple-tree/api/tree.ts +78 -0
  675. package/src/simple-tree/api/verboseTree.ts +2 -2
  676. package/src/simple-tree/api/view.ts +197 -51
  677. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +19 -13
  678. package/src/simple-tree/arrayNode.ts +7 -1
  679. package/src/simple-tree/core/treeNodeSchema.ts +51 -7
  680. package/src/simple-tree/index.ts +9 -0
  681. package/src/simple-tree/leafNodeSchema.ts +0 -19
  682. package/src/simple-tree/mapNode.ts +7 -1
  683. package/src/simple-tree/objectNode.ts +33 -3
  684. package/src/simple-tree/objectNodeTypes.ts +9 -1
  685. package/src/simple-tree/schemaTypes.ts +57 -3
  686. package/src/simple-tree/toStoredSchema.ts +25 -19
  687. package/src/util/brand.ts +0 -2
  688. package/src/util/index.ts +3 -6
  689. package/src/util/rangeMap.ts +199 -189
  690. package/src/util/typeCheck.ts +0 -2
  691. package/src/util/utils.ts +73 -1
  692. package/dist/feature-libraries/chunked-forest/chunk.d.ts.map +0 -1
  693. package/dist/feature-libraries/chunked-forest/chunk.js.map +0 -1
  694. package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -38
  695. package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts.map +0 -1
  696. package/dist/feature-libraries/memoizedIdRangeAllocator.js +0 -74
  697. package/dist/feature-libraries/memoizedIdRangeAllocator.js.map +0 -1
  698. package/lib/feature-libraries/chunked-forest/chunk.d.ts.map +0 -1
  699. package/lib/feature-libraries/chunked-forest/chunk.js.map +0 -1
  700. package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -38
  701. package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts.map +0 -1
  702. package/lib/feature-libraries/memoizedIdRangeAllocator.js +0 -71
  703. package/lib/feature-libraries/memoizedIdRangeAllocator.js.map +0 -1
  704. package/src/feature-libraries/memoizedIdRangeAllocator.ts +0 -112
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  export { uniformChunk, ChunkShape } from "./uniformChunk.js";
7
- export { type TreeChunk, dummyRoot } from "./chunk.js";
7
+ export { type TreeChunk, dummyRoot } from "../../core/index.js";
8
8
  export {
9
9
  chunkTree,
10
10
  defaultChunkPolicy,
@@ -6,7 +6,7 @@
6
6
  import { ReferenceCountedBase } from "../../util/index.js";
7
7
 
8
8
  import { BasicChunkCursor } from "./basicChunk.js";
9
- import { type ChunkedCursor, type TreeChunk, dummyRoot } from "./chunk.js";
9
+ import { type ChunkedCursor, type TreeChunk, dummyRoot } from "../../core/index.js";
10
10
 
11
11
  /**
12
12
  * General purpose multi-node sequence chunk.
@@ -14,11 +14,14 @@ import {
14
14
  type TreeValue,
15
15
  type UpPath,
16
16
  type Value,
17
+ type ChunkedCursor,
18
+ type TreeChunk,
19
+ cursorChunk,
20
+ dummyRoot,
17
21
  } from "../../core/index.js";
18
22
  import { ReferenceCountedBase, fail, hasSome } from "../../util/index.js";
19
23
  import { SynchronousCursor, prefixFieldPath, prefixPath } from "../treeCursorUtils.js";
20
24
 
21
- import { type ChunkedCursor, type TreeChunk, cursorChunk, dummyRoot } from "./chunk.js";
22
25
  import type { SessionSpaceCompressedId, IIdCompressor } from "@fluidframework/id-compressor";
23
26
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
24
27
 
@@ -160,8 +160,17 @@ export interface IDefaultEditBuilder {
160
160
  destinationIndex: number,
161
161
  ): void;
162
162
 
163
- // TODO: document
163
+ /**
164
+ * Add a constraint that the node at the given path must exist.
165
+ * @param path - The path to the node that must exist.
166
+ */
164
167
  addNodeExistsConstraint(path: UpPath): void;
168
+
169
+ /**
170
+ * Add a constraint that the node at the given path must exist when reverting a change.
171
+ * @param path - The path to the node that must exist when reverting a change.
172
+ */
173
+ addNodeExistsConstraintOnRevert(path: UpPath): void;
165
174
  }
166
175
 
167
176
  /**
@@ -191,6 +200,10 @@ export class DefaultEditBuilder implements ChangeFamilyEditor, IDefaultEditBuild
191
200
  this.modularBuilder.addNodeExistsConstraint(path, this.mintRevisionTag());
192
201
  }
193
202
 
203
+ public addNodeExistsConstraintOnRevert(path: UpPath): void {
204
+ this.modularBuilder.addNodeExistsConstraintOnRevert(path, this.mintRevisionTag());
205
+ }
206
+
194
207
  public valueField(field: FieldUpPath): ValueFieldEditBuilder<ITreeCursorSynchronous> {
195
208
  return {
196
209
  set: (newContent: ITreeCursorSynchronous): void => {
@@ -13,4 +13,5 @@ import { fieldKinds } from "./defaultFieldKinds.js";
13
13
  export const defaultSchemaPolicy: FullSchemaPolicy = {
14
14
  fieldKinds,
15
15
  validateSchema: false,
16
+ allowUnknownOptionalFields: () => false,
16
17
  };
@@ -73,7 +73,10 @@ export function isNodeInSchema(
73
73
  uncheckedFieldsFromNode.delete(fieldKey);
74
74
  }
75
75
  // The node has fields that we did not check as part of looking at every field defined in the node's schema
76
- if (uncheckedFieldsFromNode.size !== 0) {
76
+ if (
77
+ uncheckedFieldsFromNode.size !== 0 &&
78
+ !schemaAndPolicy.policy.allowUnknownOptionalFields(node.type)
79
+ ) {
77
80
  return SchemaValidationErrors.ObjectNode_FieldNotInSchema;
78
81
  }
79
82
  } else if (schema instanceof MapNodeStoredSchema) {
@@ -16,7 +16,6 @@ export {
16
16
  mapTreeFromCursor,
17
17
  mapTreeFieldFromCursor,
18
18
  } from "./mapTreeCursor.js";
19
- export { MemoizedIdRangeAllocator, type IdRange } from "./memoizedIdRangeAllocator.js";
20
19
  export { buildForest } from "./object-forest/index.js";
21
20
  export { SchemaSummarizer, encodeTreeSchema, makeSchemaCodec } from "./schema-index/index.js";
22
21
  export {
@@ -76,7 +75,20 @@ export {
76
75
  type FieldKindConfigurationEntry,
77
76
  getAllowedContentDiscrepancies,
78
77
  isRepoSuperset,
78
+ type AllowedTypeDiscrepancy,
79
+ type FieldKindDiscrepancy,
80
+ type ValueSchemaDiscrepancy,
81
+ type FieldDiscrepancy,
82
+ type NodeDiscrepancy,
83
+ type NodeKindDiscrepancy,
84
+ type NodeFieldsDiscrepancy,
79
85
  isNeverTree,
86
+ type LinearExtension,
87
+ type Realizer,
88
+ fieldRealizer,
89
+ PosetComparisonResult,
90
+ comparePosetElements,
91
+ posetLte,
80
92
  } from "./modular-schema/index.js";
81
93
 
82
94
  export { mapRootChanges } from "./deltaUtils.js";
@@ -82,6 +82,8 @@ export class AnchorTreeIndex<TKey extends TreeIndexKey, TValue>
82
82
  * @param getValue - a pure and functional function that returns the associated value of one or more anchor nodes, can be used to map and filter the indexed anchor nodes
83
83
  * so that the values returned from the index are more usable
84
84
  * @param checkTreeStatus - a function that gets the tree status from an anchor node, used for filtering out detached nodes
85
+ * @param isShallowIndex - indicates if this index is shallow, meaning that it only allows nodes to be keyed off of fields directly under them rather than anywhere in their subtree.
86
+ * As a performance optimization, re-indexing up the spine can be turned off for shallow indexes.
85
87
  */
86
88
  public constructor(
87
89
  private readonly forest: IForestSubscription,
@@ -90,6 +92,7 @@ export class AnchorTreeIndex<TKey extends TreeIndexKey, TValue>
90
92
  ) => KeyFinder<TKey> | undefined,
91
93
  private readonly getValue: (anchorNodes: TreeIndexNodes<AnchorNode>) => TValue | undefined,
92
94
  private readonly checkTreeStatus: (node: AnchorNode) => TreeStatus | undefined,
95
+ private readonly isShallowIndex = false,
93
96
  ) {
94
97
  this.forest.registerAnnouncedVisitor(this.keyFinder);
95
98
 
@@ -132,6 +135,14 @@ export class AnchorTreeIndex<TKey extends TreeIndexKey, TValue>
132
135
  this.indexField(detachedCursor);
133
136
  detachedCursor.free();
134
137
  },
138
+ afterAttach: () => {
139
+ assert(parent !== undefined, 0xa99 /* must have a parent */);
140
+ this.reIndexSpine(parent);
141
+ },
142
+ afterDetach: () => {
143
+ assert(parent !== undefined, 0xa9a /* must have a parent */);
144
+ this.reIndexSpine(parent);
145
+ },
135
146
  // when a replace happens, the keys of previously indexed nodes could be changed so we must re-index them
136
147
  afterReplace: () => {
137
148
  assert(parent !== undefined, 0xa8b /* must have a parent */);
@@ -142,9 +153,12 @@ export class AnchorTreeIndex<TKey extends TreeIndexKey, TValue>
142
153
  0xa8c /* replace should happen in a node */,
143
154
  );
144
155
  cursor.exitNode();
145
- // we must re-index the spine because the key finders allow for any value under a subtree to be the key
146
- // this means that a replace can cause the key for any node up its spine to be changed
147
- this.indexSpine(cursor);
156
+ this.indexField(cursor);
157
+ if (!this.isShallowIndex) {
158
+ // we must also re-index the spine if the key finders allow for any value under a subtree to be the key
159
+ // this means that a replace can cause the key for any node up its spine to be changed
160
+ this.indexSpine(cursor);
161
+ }
148
162
  cursor.clear();
149
163
  },
150
164
  // the methods below are used to keep track of the path that has been traversed by the visitor
@@ -297,6 +311,23 @@ export class AnchorTreeIndex<TKey extends TreeIndexKey, TValue>
297
311
  this.disposed = true;
298
312
  }
299
313
 
314
+ /**
315
+ * Checks if the spine needs to be re-indexed and if so, re-indexes it starting from the given path.
316
+ */
317
+ private reIndexSpine(path: UpPath): void {
318
+ if (!this.isShallowIndex) {
319
+ const cursor = this.forest.allocateCursor();
320
+ this.forest.moveCursorToPath(path, cursor);
321
+ assert(
322
+ cursor.mode === CursorLocationType.Nodes,
323
+ 0xa9b /* attach should happen in a node */,
324
+ );
325
+ cursor.exitNode();
326
+ this.indexSpine(cursor);
327
+ cursor.clear();
328
+ }
329
+ }
330
+
300
331
  private checkNotDisposed(errorMessage?: string): void {
301
332
  if (this.disposed) {
302
333
  if (errorMessage !== undefined) {
@@ -371,8 +402,6 @@ export class AnchorTreeIndex<TKey extends TreeIndexKey, TValue>
371
402
  * Given a cursor in field mode, indexes all nodes under the field and then indexes all nodes up the spine.
372
403
  */
373
404
  private indexSpine(cursor: ITreeSubscriptionCursor): void {
374
- this.indexField(cursor);
375
-
376
405
  if (keyAsDetachedField(cursor.getFieldKey()) !== rootField) {
377
406
  cursor.exitField();
378
407
  cursor.exitNode();
@@ -4,13 +4,7 @@
4
4
  */
5
5
 
6
6
  import type { ChangesetLocalId, RevisionTag } from "../../core/index.js";
7
- import {
8
- type RangeMap,
9
- type RangeQueryResult,
10
- getFromRangeMap,
11
- getOrAddInMap,
12
- setInRangeMap,
13
- } from "../../util/index.js";
7
+ import { RangeMap, type RangeQueryResult } from "../../util/index.js";
14
8
  import type { NodeId } from "./modularChangeTypes.js";
15
9
 
16
10
  export type CrossFieldMap<T> = Map<RevisionTag | undefined, RangeMap<T>>;
@@ -32,7 +26,12 @@ export function setInCrossFieldMap<T>(
32
26
  count: number,
33
27
  value: T,
34
28
  ): void {
35
- setInRangeMap(getOrAddInMap(map, revision, []), id, count, value);
29
+ let rangeMap = map.get(revision);
30
+ if (rangeMap === undefined) {
31
+ rangeMap = new RangeMap();
32
+ map.set(revision, rangeMap);
33
+ }
34
+ rangeMap.set(id, count, value);
36
35
  }
37
36
 
38
37
  export function getFirstFromCrossFieldMap<T>(
@@ -41,7 +40,8 @@ export function getFirstFromCrossFieldMap<T>(
41
40
  id: ChangesetLocalId,
42
41
  count: number,
43
42
  ): RangeQueryResult<T> {
44
- return getFromRangeMap(map.get(revision) ?? [], id, count);
43
+ const rangeMap = map.has(revision) ? (map.get(revision) as RangeMap<T>) : new RangeMap<T>();
44
+ return rangeMap.get(id, count);
45
45
  }
46
46
 
47
47
  /**
@@ -6,6 +6,7 @@
6
6
  import { assert } from "@fluidframework/core-utils/internal";
7
7
 
8
8
  import {
9
+ type FieldKey,
9
10
  type FieldKindIdentifier,
10
11
  LeafNodeStoredSchema,
11
12
  MapNodeStoredSchema,
@@ -25,6 +26,7 @@ import { brand } from "../../util/index.js";
25
26
  // Rather than both existing, one of which just returns boolean and the other which returns additional details, a simple comparison which returns everything needed should be used.
26
27
 
27
28
  /**
29
+ * Discriminated union (keyed on `mismatch`) of discrepancies between a view and stored schema.
28
30
  * @remarks
29
31
  *
30
32
  * 1. FieldDiscrepancy
@@ -60,47 +62,73 @@ export type Discrepancy = FieldDiscrepancy | NodeDiscrepancy;
60
62
 
61
63
  export type NodeDiscrepancy = NodeKindDiscrepancy | NodeFieldsDiscrepancy;
62
64
 
65
+ /**
66
+ * A discrepancy in the declaration of a field.
67
+ */
63
68
  export type FieldDiscrepancy =
64
69
  | AllowedTypeDiscrepancy
65
70
  | FieldKindDiscrepancy
66
71
  | ValueSchemaDiscrepancy;
67
72
 
68
- export interface AllowedTypeDiscrepancy {
69
- identifier: string | undefined; // undefined indicates root field schema
73
+ /**
74
+ * Information about where a field discrepancy is located within a collection of schema.
75
+ */
76
+ export interface FieldDiscrepancyLocation {
77
+ /**
78
+ * The {@link TreeNodeSchemaIdentifier} that contains the discrepancy.
79
+ *
80
+ * Undefined iff the discrepancy is part of the root field schema.
81
+ */
82
+ identifier: TreeNodeSchemaIdentifier | undefined;
83
+ /**
84
+ * The {@link FieldKey} for the field that contains the discrepancy.
85
+ * Undefined when:
86
+ * - the discrepancy is part of the root field schema
87
+ * - the discrepancy is for 'all fields' of a map node
88
+ */
89
+ fieldKey: FieldKey | undefined;
90
+ }
91
+
92
+ /**
93
+ * A discrepancy in the allowed types of a field.
94
+ *
95
+ * @remarks
96
+ * This reports the symmetric difference of allowed types in view/stored to enable more efficient checks for compatibility
97
+ */
98
+ export interface AllowedTypeDiscrepancy extends FieldDiscrepancyLocation {
70
99
  mismatch: "allowedTypes";
71
100
  /**
72
- * List of allowed type identifiers in viewed schema
101
+ * List of allowed type identifiers in viewed schema which are not allowed in stored schema
73
102
  */
74
- view: string[];
103
+ view: TreeNodeSchemaIdentifier[];
75
104
  /**
76
- * List of allowed type identifiers in stored schema
105
+ * List of allowed type identifiers in stored schema which are not allowed in view schema
77
106
  */
78
- stored: string[];
107
+ stored: TreeNodeSchemaIdentifier[];
79
108
  }
80
109
 
81
- export interface FieldKindDiscrepancy {
82
- identifier: string | undefined; // undefined indicates root field schema
110
+ export interface FieldKindDiscrepancy extends FieldDiscrepancyLocation {
83
111
  mismatch: "fieldKind";
84
112
  view: FieldKindIdentifier;
85
113
  stored: FieldKindIdentifier;
86
114
  }
87
115
 
88
116
  export interface ValueSchemaDiscrepancy {
89
- identifier: string;
117
+ identifier: TreeNodeSchemaIdentifier;
90
118
  mismatch: "valueSchema";
91
119
  view: ValueSchema | undefined;
92
120
  stored: ValueSchema | undefined;
93
121
  }
94
122
 
95
123
  export interface NodeKindDiscrepancy {
96
- identifier: string;
124
+ identifier: TreeNodeSchemaIdentifier;
97
125
  mismatch: "nodeKind";
98
126
  view: SchemaFactoryNodeKind | undefined;
99
127
  stored: SchemaFactoryNodeKind | undefined;
100
128
  }
101
129
 
102
130
  export interface NodeFieldsDiscrepancy {
103
- identifier: string;
131
+ identifier: TreeNodeSchemaIdentifier;
104
132
  mismatch: "fields";
105
133
  differences: FieldDiscrepancy[];
106
134
  }
@@ -121,26 +149,25 @@ function getNodeSchemaType(nodeSchema: TreeNodeStoredSchema): SchemaFactoryNodeK
121
149
  /**
122
150
  * Finds and reports discrepancies between a view schema and a stored schema.
123
151
  *
124
- * The workflow for finding schema incompatibilities:
125
- * 1. Compare the two root schemas to identify any `FieldDiscrepancy`.
126
- *
127
- * 2. For each node schema in the `view`:
128
- * - Verify if the node schema exists in the stored. If it does, ensure that the `SchemaFactoryNodeKind` are
129
- * consistent. Otherwise this difference is treated as `NodeKindDiscrepancy`
130
- * - If a node schema with the same identifier exists in both view and stored, and their `SchemaFactoryNodeKind`
131
- * are consistent, perform a exhaustive validation to identify all `FieldDiscrepancy`.
132
- *
133
- * 3. For each node schema in the stored, verify if it exists in the view. The overlapping parts were already
134
- * addressed in the previous step.
152
+ * See documentation on {@link Discrepancy} for details of possible discrepancies.
153
+ * @remarks
154
+ * This function does not attempt to distinguish between equivalent representations of a node/field involving extraneous never trees.
155
+ * For example, a Forbidden field with allowed type set `[]` is equivalent to an optional field with allowed type set `[]`,
156
+ * as well as an optional field with an allowed type set containing only unconstructable types.
135
157
  *
136
- * @returns the discrepancies between two TreeStoredSchema objects
158
+ * It is up to the caller to determine whether such discrepancies matter.
137
159
  */
138
160
  export function* getAllowedContentDiscrepancies(
139
161
  view: TreeStoredSchema,
140
162
  stored: TreeStoredSchema,
141
163
  ): Iterable<Discrepancy> {
142
164
  // check root schema discrepancies
143
- yield* getFieldDiscrepancies(view.rootFieldSchema, stored.rootFieldSchema);
165
+ yield* getFieldDiscrepancies(
166
+ view.rootFieldSchema,
167
+ stored.rootFieldSchema,
168
+ undefined,
169
+ undefined,
170
+ );
144
171
 
145
172
  for (const result of compareMaps(view.nodeSchema, stored.nodeSchema)) {
146
173
  switch (result.type) {
@@ -195,6 +222,7 @@ function* getNodeDiscrepancies(
195
222
  case "object": {
196
223
  const differences = Array.from(
197
224
  trackObjectNodeDiscrepancies(
225
+ identifier,
198
226
  view as ObjectNodeStoredSchema,
199
227
  stored as ObjectNodeStoredSchema,
200
228
  ),
@@ -213,6 +241,7 @@ function* getNodeDiscrepancies(
213
241
  (view as MapNodeStoredSchema).mapFields,
214
242
  (stored as MapNodeStoredSchema).mapFields,
215
243
  identifier,
244
+ undefined,
216
245
  );
217
246
  break;
218
247
  case "leaf": {
@@ -241,7 +270,8 @@ function* getNodeDiscrepancies(
241
270
  function* getFieldDiscrepancies(
242
271
  view: TreeFieldStoredSchema,
243
272
  stored: TreeFieldStoredSchema,
244
- keyOrRoot?: string,
273
+ identifier: TreeNodeSchemaIdentifier | undefined,
274
+ fieldKey: FieldKey | undefined,
245
275
  ): Iterable<FieldDiscrepancy> {
246
276
  // Only track the symmetric differences of two sets.
247
277
  const findSetDiscrepancies = (
@@ -256,7 +286,8 @@ function* getFieldDiscrepancies(
256
286
  const [viewExtra, storedExtra] = findSetDiscrepancies(view.types, stored.types);
257
287
  if (viewExtra.length > 0 || storedExtra.length > 0) {
258
288
  yield {
259
- identifier: keyOrRoot,
289
+ identifier,
290
+ fieldKey,
260
291
  mismatch: "allowedTypes",
261
292
  view: viewExtra,
262
293
  stored: storedExtra,
@@ -265,7 +296,8 @@ function* getFieldDiscrepancies(
265
296
 
266
297
  if (view.kind !== stored.kind) {
267
298
  yield {
268
- identifier: keyOrRoot,
299
+ identifier,
300
+ fieldKey,
269
301
  mismatch: "fieldKind",
270
302
  view: view.kind,
271
303
  stored: stored.kind,
@@ -274,6 +306,7 @@ function* getFieldDiscrepancies(
274
306
  }
275
307
 
276
308
  function* trackObjectNodeDiscrepancies(
309
+ identifier: TreeNodeSchemaIdentifier,
277
310
  view: ObjectNodeStoredSchema,
278
311
  stored: ObjectNodeStoredSchema,
279
312
  ): Iterable<FieldDiscrepancy> {
@@ -298,7 +331,8 @@ function* trackObjectNodeDiscrepancies(
298
331
  break;
299
332
  }
300
333
  yield {
301
- identifier: fieldKey,
334
+ identifier,
335
+ fieldKey,
302
336
  mismatch: "fieldKind",
303
337
  view: result.value.kind,
304
338
  stored: storedEmptyFieldSchema.kind,
@@ -312,7 +346,8 @@ function* trackObjectNodeDiscrepancies(
312
346
  break;
313
347
  }
314
348
  yield {
315
- identifier: fieldKey,
349
+ identifier,
350
+ fieldKey,
316
351
  mismatch: "fieldKind",
317
352
  view: storedEmptyFieldSchema.kind,
318
353
  stored: result.value.kind,
@@ -320,12 +355,11 @@ function* trackObjectNodeDiscrepancies(
320
355
  break;
321
356
  }
322
357
  case "both": {
323
- yield* getFieldDiscrepancies(result.valueA, result.valueB, fieldKey);
358
+ yield* getFieldDiscrepancies(result.valueA, result.valueB, identifier, fieldKey);
324
359
  break;
325
360
  }
326
- default: {
361
+ default:
327
362
  break;
328
- }
329
363
  }
330
364
  }
331
365
  }
@@ -428,13 +462,13 @@ function isFieldDiscrepancyCompatible(discrepancy: FieldDiscrepancy): boolean {
428
462
  *
429
463
  * The linear extension is represented as a lookup from each poset element to its index in the linear extension.
430
464
  */
431
- type LinearExtension<T> = Map<T, number>;
465
+ export type LinearExtension<T> = Map<T, number>;
432
466
 
433
467
  /**
434
468
  * A realizer for a partially-ordered set. See:
435
469
  * https://en.wikipedia.org/wiki/Order_dimension
436
470
  */
437
- type Realizer<T> = LinearExtension<T>[];
471
+ export type Realizer<T> = LinearExtension<T>[];
438
472
 
439
473
  /**
440
474
  * @privateRemarks
@@ -468,7 +502,7 @@ const FieldKindIdentifiers = {
468
502
  * identifier
469
503
  * ```
470
504
  */
471
- const fieldRealizer: Realizer<FieldKindIdentifier> = [
505
+ export const fieldRealizer: Realizer<FieldKindIdentifier> = [
472
506
  [
473
507
  FieldKindIdentifiers.forbidden,
474
508
  FieldKindIdentifiers.identifier,
@@ -485,7 +519,7 @@ const fieldRealizer: Realizer<FieldKindIdentifier> = [
485
519
  ],
486
520
  ].map((extension) => new Map(extension.map((identifier, index) => [identifier, index])));
487
521
 
488
- const PosetComparisonResult = {
522
+ export const PosetComparisonResult = {
489
523
  Less: "<",
490
524
  Greater: ">",
491
525
  Equal: "=",
@@ -494,7 +528,11 @@ const PosetComparisonResult = {
494
528
  type PosetComparisonResult =
495
529
  (typeof PosetComparisonResult)[keyof typeof PosetComparisonResult];
496
530
 
497
- function comparePosetElements<T>(a: T, b: T, realizer: Realizer<T>): PosetComparisonResult {
531
+ export function comparePosetElements<T>(
532
+ a: T,
533
+ b: T,
534
+ realizer: Realizer<T>,
535
+ ): PosetComparisonResult {
498
536
  let hasLessThanResult = false;
499
537
  let hasGreaterThanResult = false;
500
538
  for (const extension of realizer) {
@@ -517,7 +555,7 @@ function comparePosetElements<T>(a: T, b: T, realizer: Realizer<T>): PosetCompar
517
555
  : PosetComparisonResult.Equal;
518
556
  }
519
557
 
520
- function posetLte<T>(a: T, b: T, realizer: Realizer<T>): boolean {
558
+ export function posetLte<T>(a: T, b: T, realizer: Realizer<T>): boolean {
521
559
  const comparison = comparePosetElements(a, b, realizer);
522
560
  return (
523
561
  comparison === PosetComparisonResult.Less || comparison === PosetComparisonResult.Equal
@@ -14,12 +14,17 @@ import type {
14
14
  RevisionTag,
15
15
  } from "../../core/index.js";
16
16
  import type { IdAllocator, Invariant } from "../../util/index.js";
17
- import type { MemoizedIdRangeAllocator } from "../memoizedIdRangeAllocator.js";
18
17
 
19
18
  import type { CrossFieldManager } from "./crossFieldQueries.js";
20
19
  import type { CrossFieldKeyRange, NodeId } from "./modularChangeTypes.js";
21
20
  import type { EncodedNodeChangeset } from "./modularChangeFormat.js";
22
21
 
22
+ export type NestedChangesIndices = [
23
+ NodeId,
24
+ number | undefined /* inputIndex */,
25
+ number | undefined /* outputIndex */,
26
+ ][];
27
+
23
28
  /**
24
29
  * Functionality provided by a field kind which will be composed with other `FieldChangeHandler`s to
25
30
  * implement a unified ChangeFamily supporting documents with multiple field kinds.
@@ -39,11 +44,7 @@ export interface FieldChangeHandler<
39
44
  >,
40
45
  ) => ICodecFamily<TChangeset, FieldChangeEncodingContext>;
41
46
  readonly editor: TEditor;
42
- intoDelta(
43
- change: TChangeset,
44
- deltaFromChild: ToDelta,
45
- idAllocator: MemoizedIdRangeAllocator,
46
- ): DeltaFieldChanges;
47
+ intoDelta(change: TChangeset, deltaFromChild: ToDelta): DeltaFieldChanges;
47
48
  /**
48
49
  * Returns the set of removed roots that should be in memory for the given change to be applied.
49
50
  * A removed root is relevant if any of the following is true:
@@ -75,13 +76,16 @@ export interface FieldChangeHandler<
75
76
  * @param change - The field change to get the child changes from.
76
77
  *
77
78
  * @returns The set of `NodeId`s that correspond to nested changes in the given `change`.
78
- * Each `NodeId` is associated with the index of the node in the field in the input context of the changeset
79
- * (or `undefined` if the node is not attached in the input context).
79
+ * Each `NodeId` is associated with the following:
80
+ * - index of the node in the field in the input context of the changeset (or `undefined` if the node is not
81
+ * attached in the input context).
82
+ * - index of the node in the field in the output context of the changeset (or `undefined` if the node is not
83
+ * attached in the output context).
80
84
  * For all returned entries where the index is defined,
81
85
  * the indices are are ordered from smallest to largest (with no duplicates).
82
86
  * The returned array is owned by the caller.
83
87
  */
84
- getNestedChanges(change: TChangeset): [NodeId, number | undefined][];
88
+ getNestedChanges(change: TChangeset): NestedChangesIndices;
85
89
 
86
90
  /**
87
91
  * @returns A list of all cross-field keys contained in the change.
@@ -17,6 +17,7 @@ import { assert } from "@fluidframework/core-utils/internal";
17
17
  import type { CrossFieldManager } from "./crossFieldQueries.js";
18
18
  import type {
19
19
  FieldChangeHandler,
20
+ NestedChangesIndices,
20
21
  NodeChangeComposer,
21
22
  NodeChangePruner,
22
23
  NodeChangeRebaser,
@@ -82,8 +83,9 @@ function compose(
82
83
  return composed;
83
84
  }
84
85
 
85
- function getNestedChanges(change: GenericChangeset): [NodeId, number | undefined][] {
86
- return change.toArray().map(([index, nodeChange]) => [nodeChange, index]);
86
+ function getNestedChanges(change: GenericChangeset): NestedChangesIndices {
87
+ // For generic changeset, the indices in the input and output contexts are the same.
88
+ return change.toArray().map(([index, nodeChange]) => [nodeChange, index, index]);
87
89
  }
88
90
 
89
91
  function rebaseGenericChange(
@@ -41,6 +41,7 @@ export {
41
41
  type ToDelta,
42
42
  NodeAttachState,
43
43
  type FieldChangeEncodingContext,
44
+ type NestedChangesIndices,
44
45
  } from "./fieldChangeHandler.js";
45
46
  export type {
46
47
  CrossFieldKeyRange,
@@ -77,4 +78,17 @@ export type {
77
78
  export {
78
79
  getAllowedContentDiscrepancies,
79
80
  isRepoSuperset,
81
+ type AllowedTypeDiscrepancy,
82
+ type FieldKindDiscrepancy,
83
+ type ValueSchemaDiscrepancy,
84
+ type FieldDiscrepancy,
85
+ type NodeDiscrepancy,
86
+ type NodeKindDiscrepancy,
87
+ type NodeFieldsDiscrepancy,
88
+ type LinearExtension,
89
+ type Realizer,
90
+ fieldRealizer,
91
+ PosetComparisonResult,
92
+ comparePosetElements,
93
+ posetLte,
80
94
  } from "./discrepancies.js";
@@ -19,9 +19,7 @@ import { fail } from "../../util/index.js";
19
19
  import type { FullSchemaPolicy } from "./fieldKind.js";
20
20
 
21
21
  /**
22
- * @internal
23
22
  */
24
-
25
23
  export function isNeverField(
26
24
  policy: FullSchemaPolicy,
27
25
  originalData: TreeStoredSchema,