@fluidframework/tree 2.1.0 → 2.3.0-288113

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 (1464) hide show
  1. package/.mocharc.customBenchmarks.cjs +33 -0
  2. package/CHANGELOG.md +297 -0
  3. package/README.md +34 -4
  4. package/api-extractor.json +17 -0
  5. package/api-report/tree.alpha.api.md +158 -28
  6. package/api-report/tree.beta.api.md +59 -28
  7. package/api-report/tree.public.api.md +59 -28
  8. package/dist/beta.d.ts +4 -1
  9. package/dist/codec/discriminatedUnions.d.ts +11 -5
  10. package/dist/codec/discriminatedUnions.d.ts.map +1 -1
  11. package/dist/codec/discriminatedUnions.js.map +1 -1
  12. package/dist/codec/index.d.ts +1 -1
  13. package/dist/codec/index.d.ts.map +1 -1
  14. package/dist/codec/index.js.map +1 -1
  15. package/dist/core/forest/editableForest.d.ts +1 -5
  16. package/dist/core/forest/editableForest.d.ts.map +1 -1
  17. package/dist/core/forest/editableForest.js.map +1 -1
  18. package/dist/core/forest/forest.d.ts +0 -6
  19. package/dist/core/forest/forest.d.ts.map +1 -1
  20. package/dist/core/forest/forest.js +0 -2
  21. package/dist/core/forest/forest.js.map +1 -1
  22. package/dist/core/index.d.ts +2 -2
  23. package/dist/core/index.d.ts.map +1 -1
  24. package/dist/core/index.js +3 -4
  25. package/dist/core/index.js.map +1 -1
  26. package/dist/core/rebase/changeRebaser.d.ts +0 -4
  27. package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
  28. package/dist/core/rebase/changeRebaser.js.map +1 -1
  29. package/dist/core/rebase/index.d.ts +1 -1
  30. package/dist/core/rebase/index.d.ts.map +1 -1
  31. package/dist/core/rebase/index.js +1 -3
  32. package/dist/core/rebase/index.js.map +1 -1
  33. package/dist/core/rebase/types.d.ts +1 -8
  34. package/dist/core/rebase/types.d.ts.map +1 -1
  35. package/dist/core/rebase/types.js +1 -9
  36. package/dist/core/rebase/types.js.map +1 -1
  37. package/dist/core/rebase/utils.d.ts +0 -1
  38. package/dist/core/rebase/utils.d.ts.map +1 -1
  39. package/dist/core/rebase/utils.js +12 -7
  40. package/dist/core/rebase/utils.js.map +1 -1
  41. package/dist/core/schema-stored/multiplicity.d.ts +0 -1
  42. package/dist/core/schema-stored/multiplicity.d.ts.map +1 -1
  43. package/dist/core/schema-stored/multiplicity.js +0 -1
  44. package/dist/core/schema-stored/multiplicity.js.map +1 -1
  45. package/dist/core/schema-stored/schema.d.ts +0 -7
  46. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  47. package/dist/core/schema-stored/schema.js +0 -4
  48. package/dist/core/schema-stored/schema.js.map +1 -1
  49. package/dist/core/schema-stored/storedSchemaRepository.d.ts +0 -3
  50. package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  51. package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
  52. package/dist/core/schema-view/view.d.ts +0 -3
  53. package/dist/core/schema-view/view.d.ts.map +1 -1
  54. package/dist/core/schema-view/view.js +0 -1
  55. package/dist/core/schema-view/view.js.map +1 -1
  56. package/dist/core/tree/anchorSet.d.ts +4 -16
  57. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  58. package/dist/core/tree/anchorSet.js +12 -5
  59. package/dist/core/tree/anchorSet.js.map +1 -1
  60. package/dist/core/tree/cursor.d.ts +1 -6
  61. package/dist/core/tree/cursor.d.ts.map +1 -1
  62. package/dist/core/tree/cursor.js +0 -2
  63. package/dist/core/tree/cursor.js.map +1 -1
  64. package/dist/core/tree/delta.d.ts +0 -11
  65. package/dist/core/tree/delta.d.ts.map +1 -1
  66. package/dist/core/tree/delta.js.map +1 -1
  67. package/dist/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  68. package/dist/core/tree/detachedFieldIndexCodec.js +3 -2
  69. package/dist/core/tree/detachedFieldIndexCodec.js.map +1 -1
  70. package/dist/core/tree/detachedFieldIndexTypes.d.ts +0 -1
  71. package/dist/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
  72. package/dist/core/tree/detachedFieldIndexTypes.js.map +1 -1
  73. package/dist/core/tree/index.d.ts +1 -1
  74. package/dist/core/tree/index.d.ts.map +1 -1
  75. package/dist/core/tree/index.js +3 -1
  76. package/dist/core/tree/index.js.map +1 -1
  77. package/dist/core/tree/mapTree.d.ts +20 -4
  78. package/dist/core/tree/mapTree.d.ts.map +1 -1
  79. package/dist/core/tree/mapTree.js +29 -0
  80. package/dist/core/tree/mapTree.js.map +1 -1
  81. package/dist/core/tree/pathTree.d.ts +0 -11
  82. package/dist/core/tree/pathTree.d.ts.map +1 -1
  83. package/dist/core/tree/pathTree.js.map +1 -1
  84. package/dist/core/tree/treeTextFormat.d.ts.map +1 -1
  85. package/dist/core/tree/treeTextFormat.js +3 -2
  86. package/dist/core/tree/treeTextFormat.js.map +1 -1
  87. package/dist/core/tree/types.d.ts +0 -11
  88. package/dist/core/tree/types.d.ts.map +1 -1
  89. package/dist/core/tree/types.js +0 -4
  90. package/dist/core/tree/types.js.map +1 -1
  91. package/dist/core/tree/visitDelta.d.ts +0 -1
  92. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  93. package/dist/core/tree/visitDelta.js +2 -2
  94. package/dist/core/tree/visitDelta.js.map +1 -1
  95. package/dist/core/tree/visitPath.d.ts +0 -2
  96. package/dist/core/tree/visitPath.d.ts.map +1 -1
  97. package/dist/core/tree/visitPath.js.map +1 -1
  98. package/dist/core/tree/visitorUtils.d.ts +0 -1
  99. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  100. package/dist/core/tree/visitorUtils.js.map +1 -1
  101. package/dist/domains/index.d.ts +1 -1
  102. package/dist/domains/index.d.ts.map +1 -1
  103. package/dist/domains/index.js +2 -1
  104. package/dist/domains/index.js.map +1 -1
  105. package/dist/domains/json/index.d.ts +1 -1
  106. package/dist/domains/json/index.d.ts.map +1 -1
  107. package/dist/domains/json/index.js +2 -1
  108. package/dist/domains/json/index.js.map +1 -1
  109. package/dist/domains/json/jsonCursor.d.ts +36 -2
  110. package/dist/domains/json/jsonCursor.d.ts.map +1 -1
  111. package/dist/domains/json/jsonCursor.js +76 -5
  112. package/dist/domains/json/jsonCursor.js.map +1 -1
  113. package/dist/domains/json/jsonDomainSchema.d.ts +13 -3
  114. package/dist/domains/json/jsonDomainSchema.d.ts.map +1 -1
  115. package/dist/domains/json/jsonDomainSchema.js +12 -4
  116. package/dist/domains/json/jsonDomainSchema.js.map +1 -1
  117. package/dist/domains/leafDomain.d.ts +0 -1
  118. package/dist/domains/leafDomain.d.ts.map +1 -1
  119. package/dist/domains/leafDomain.js +0 -1
  120. package/dist/domains/leafDomain.js.map +1 -1
  121. package/dist/domains/schemaBuilder.d.ts +1 -7
  122. package/dist/domains/schemaBuilder.d.ts.map +1 -1
  123. package/dist/domains/schemaBuilder.js +0 -10
  124. package/dist/domains/schemaBuilder.js.map +1 -1
  125. package/dist/events/events.d.ts +7 -5
  126. package/dist/events/events.d.ts.map +1 -1
  127. package/dist/events/events.js +5 -3
  128. package/dist/events/events.js.map +1 -1
  129. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  130. package/dist/feature-libraries/chunked-forest/basicChunk.js +8 -3
  131. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  132. package/dist/feature-libraries/chunked-forest/chunk.d.ts +1 -1
  133. package/dist/feature-libraries/chunked-forest/chunk.d.ts.map +1 -1
  134. package/dist/feature-libraries/chunked-forest/chunk.js.map +1 -1
  135. package/dist/feature-libraries/chunked-forest/chunkTree.js +3 -3
  136. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  137. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  138. package/dist/feature-libraries/chunked-forest/chunkedForest.js +7 -5
  139. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  140. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +1 -1
  141. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  142. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  143. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +8 -5
  144. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  145. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  146. package/dist/feature-libraries/chunked-forest/uniformChunk.js +5 -3
  147. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  148. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -24
  149. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  150. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +9 -19
  151. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  152. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +0 -6
  153. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  154. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +11 -1
  155. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  156. package/dist/feature-libraries/default-schema/defaultSchema.d.ts +0 -1
  157. package/dist/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
  158. package/dist/feature-libraries/default-schema/defaultSchema.js +0 -1
  159. package/dist/feature-libraries/default-schema/defaultSchema.js.map +1 -1
  160. package/dist/feature-libraries/default-schema/index.d.ts +1 -1
  161. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  162. package/dist/feature-libraries/default-schema/index.js +2 -1
  163. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  164. package/dist/feature-libraries/default-schema/schemaChecker.d.ts +6 -0
  165. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  166. package/dist/feature-libraries/default-schema/schemaChecker.js +6 -0
  167. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  168. package/dist/feature-libraries/editableTreeBinder.d.ts +0 -67
  169. package/dist/feature-libraries/editableTreeBinder.d.ts.map +1 -1
  170. package/dist/feature-libraries/editableTreeBinder.js +5 -24
  171. package/dist/feature-libraries/editableTreeBinder.js.map +1 -1
  172. package/dist/feature-libraries/fieldGenerator.d.ts +0 -3
  173. package/dist/feature-libraries/fieldGenerator.d.ts.map +1 -1
  174. package/dist/feature-libraries/fieldGenerator.js +0 -1
  175. package/dist/feature-libraries/fieldGenerator.js.map +1 -1
  176. package/dist/feature-libraries/flex-map-tree/index.d.ts +1 -1
  177. package/dist/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  178. package/dist/feature-libraries/flex-map-tree/index.js +2 -2
  179. package/dist/feature-libraries/flex-map-tree/index.js.map +1 -1
  180. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +57 -51
  181. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  182. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js +171 -180
  183. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  184. package/dist/feature-libraries/flex-tree/context.d.ts +0 -1
  185. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  186. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  187. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +17 -373
  188. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  189. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +1 -34
  190. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  191. package/dist/feature-libraries/flex-tree/index.d.ts +2 -2
  192. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  193. package/dist/feature-libraries/flex-tree/index.js +1 -3
  194. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  195. package/dist/feature-libraries/flex-tree/lazyField.d.ts +9 -27
  196. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  197. package/dist/feature-libraries/flex-tree/lazyField.js +26 -102
  198. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  199. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +3 -18
  200. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  201. package/dist/feature-libraries/flex-tree/lazyNode.js +2 -126
  202. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  203. package/dist/feature-libraries/flex-tree/treeEvents.d.ts +0 -2
  204. package/dist/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
  205. package/dist/feature-libraries/flex-tree/treeEvents.js.map +1 -1
  206. package/dist/feature-libraries/flex-tree/utilities.d.ts +2 -1
  207. package/dist/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  208. package/dist/feature-libraries/flex-tree/utilities.js +4 -0
  209. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  210. package/dist/feature-libraries/forest-summary/codec.js +2 -2
  211. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  212. package/dist/feature-libraries/index.d.ts +6 -8
  213. package/dist/feature-libraries/index.d.ts.map +1 -1
  214. package/dist/feature-libraries/index.js +7 -20
  215. package/dist/feature-libraries/index.js.map +1 -1
  216. package/dist/feature-libraries/mapTreeCursor.d.ts +6 -2
  217. package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  218. package/dist/feature-libraries/mapTreeCursor.js +9 -1
  219. package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
  220. package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -4
  221. package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts.map +1 -1
  222. package/dist/feature-libraries/memoizedIdRangeAllocator.js +0 -1
  223. package/dist/feature-libraries/memoizedIdRangeAllocator.js.map +1 -1
  224. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +0 -2
  225. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  226. package/dist/feature-libraries/modular-schema/crossFieldQueries.js +0 -1
  227. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  228. package/dist/feature-libraries/modular-schema/discrepancies.d.ts +18 -0
  229. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  230. package/dist/feature-libraries/modular-schema/discrepancies.js +105 -2
  231. package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  232. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +0 -8
  233. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  234. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js +0 -1
  235. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  236. package/dist/feature-libraries/modular-schema/fieldKind.d.ts +1 -3
  237. package/dist/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  238. package/dist/feature-libraries/modular-schema/fieldKind.js +1 -2
  239. package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  240. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +1 -2
  241. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  242. package/dist/feature-libraries/modular-schema/genericFieldKind.js +57 -85
  243. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  244. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts +1 -1
  245. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
  246. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js +5 -8
  247. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  248. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.d.ts +3 -14
  249. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.d.ts.map +1 -1
  250. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js +6 -0
  251. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
  252. package/dist/feature-libraries/modular-schema/index.d.ts +2 -2
  253. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  254. package/dist/feature-libraries/modular-schema/index.js +2 -1
  255. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  256. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  257. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +39 -22
  258. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  259. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +9 -8
  260. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  261. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +192 -228
  262. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  263. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +8 -14
  264. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  265. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  266. package/dist/feature-libraries/node-key/nodeKey.d.ts +0 -4
  267. package/dist/feature-libraries/node-key/nodeKey.d.ts.map +1 -1
  268. package/dist/feature-libraries/node-key/nodeKey.js +0 -2
  269. package/dist/feature-libraries/node-key/nodeKey.js.map +1 -1
  270. package/dist/feature-libraries/node-key/nodeKeyManager.d.ts +0 -1
  271. package/dist/feature-libraries/node-key/nodeKeyManager.d.ts.map +1 -1
  272. package/dist/feature-libraries/node-key/nodeKeyManager.js.map +1 -1
  273. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  274. package/dist/feature-libraries/object-forest/objectForest.js +1 -10
  275. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  276. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
  277. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  278. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
  279. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  280. package/dist/feature-libraries/schemaBuilderBase.d.ts +2 -28
  281. package/dist/feature-libraries/schemaBuilderBase.d.ts.map +1 -1
  282. package/dist/feature-libraries/schemaBuilderBase.js +1 -27
  283. package/dist/feature-libraries/schemaBuilderBase.js.map +1 -1
  284. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  285. package/dist/feature-libraries/sequence-field/compose.js +24 -21
  286. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  287. package/dist/feature-libraries/sequence-field/formatV2.d.ts +3 -3
  288. package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  289. package/dist/feature-libraries/sequence-field/formatV2.js +7 -6
  290. package/dist/feature-libraries/sequence-field/formatV2.js.map +1 -1
  291. package/dist/feature-libraries/sequence-field/formatV3.d.ts +195 -0
  292. package/dist/feature-libraries/sequence-field/formatV3.d.ts.map +1 -0
  293. package/dist/feature-libraries/sequence-field/formatV3.js +23 -0
  294. package/dist/feature-libraries/sequence-field/formatV3.js.map +1 -0
  295. package/dist/feature-libraries/sequence-field/helperTypes.d.ts +11 -0
  296. package/dist/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  297. package/dist/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  298. package/dist/feature-libraries/sequence-field/index.d.ts +1 -1
  299. package/dist/feature-libraries/sequence-field/index.d.ts.map +1 -1
  300. package/dist/feature-libraries/sequence-field/index.js.map +1 -1
  301. package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  302. package/dist/feature-libraries/sequence-field/invert.js +21 -13
  303. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  304. package/dist/feature-libraries/sequence-field/markQueue.js +1 -1
  305. package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
  306. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +2 -2
  307. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  308. package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  309. package/dist/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  310. package/dist/feature-libraries/sequence-field/rebase.js +24 -6
  311. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  312. package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  313. package/dist/feature-libraries/sequence-field/replaceRevisions.js +16 -3
  314. package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  315. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  316. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +38 -4
  317. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  318. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -1
  319. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  320. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +54 -9
  321. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  322. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +11 -0
  323. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -0
  324. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +85 -0
  325. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -0
  326. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  327. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js +2 -0
  328. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  329. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  330. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +4 -1
  331. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  332. package/dist/feature-libraries/sequence-field/types.d.ts +23 -4
  333. package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
  334. package/dist/feature-libraries/sequence-field/types.js.map +1 -1
  335. package/dist/feature-libraries/sequence-field/utils.d.ts +5 -4
  336. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  337. package/dist/feature-libraries/sequence-field/utils.js +70 -42
  338. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  339. package/dist/feature-libraries/storedToViewSchema.d.ts +0 -1
  340. package/dist/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  341. package/dist/feature-libraries/storedToViewSchema.js +0 -1
  342. package/dist/feature-libraries/storedToViewSchema.js.map +1 -1
  343. package/dist/feature-libraries/treeCursorUtils.d.ts +0 -6
  344. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  345. package/dist/feature-libraries/treeCursorUtils.js +8 -6
  346. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  347. package/dist/feature-libraries/treeTextCursor.d.ts +0 -2
  348. package/dist/feature-libraries/treeTextCursor.d.ts.map +1 -1
  349. package/dist/feature-libraries/treeTextCursor.js +0 -2
  350. package/dist/feature-libraries/treeTextCursor.js.map +1 -1
  351. package/dist/feature-libraries/typed-schema/flexList.d.ts +0 -3
  352. package/dist/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
  353. package/dist/feature-libraries/typed-schema/flexList.js.map +1 -1
  354. package/dist/feature-libraries/typed-schema/index.d.ts +1 -1
  355. package/dist/feature-libraries/typed-schema/index.d.ts.map +1 -1
  356. package/dist/feature-libraries/typed-schema/index.js +1 -3
  357. package/dist/feature-libraries/typed-schema/index.js.map +1 -1
  358. package/dist/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  359. package/dist/feature-libraries/typed-schema/schemaCollection.js +0 -4
  360. package/dist/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  361. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +2 -41
  362. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  363. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +1 -40
  364. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  365. package/dist/feature-libraries/typed-schema/view.d.ts +0 -1
  366. package/dist/feature-libraries/typed-schema/view.d.ts.map +1 -1
  367. package/dist/feature-libraries/typed-schema/view.js.map +1 -1
  368. package/dist/index.d.ts +8 -9
  369. package/dist/index.d.ts.map +1 -1
  370. package/dist/index.js +36 -90
  371. package/dist/index.js.map +1 -1
  372. package/dist/internalTypes.d.ts +1 -1
  373. package/dist/internalTypes.d.ts.map +1 -1
  374. package/dist/internalTypes.js.map +1 -1
  375. package/dist/packageVersion.d.ts +1 -1
  376. package/dist/packageVersion.d.ts.map +1 -1
  377. package/dist/packageVersion.js +1 -1
  378. package/dist/packageVersion.js.map +1 -1
  379. package/dist/public.d.ts +4 -1
  380. package/dist/shared-tree/schematizeTree.d.ts +2 -11
  381. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  382. package/dist/shared-tree/schematizeTree.js +13 -2
  383. package/dist/shared-tree/schematizeTree.js.map +1 -1
  384. package/dist/shared-tree/schematizingTreeView.d.ts +4 -4
  385. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  386. package/dist/shared-tree/schematizingTreeView.js +2 -2
  387. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  388. package/dist/shared-tree/sharedTree.d.ts +4 -17
  389. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  390. package/dist/shared-tree/sharedTree.js +4 -8
  391. package/dist/shared-tree/sharedTree.js.map +1 -1
  392. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  393. package/dist/shared-tree/sharedTreeChangeCodecs.js +4 -0
  394. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  395. package/dist/shared-tree/sharedTreeChangeFamily.js +2 -2
  396. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  397. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +0 -2
  398. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  399. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  400. package/dist/shared-tree/treeApi.js +2 -2
  401. package/dist/shared-tree/treeApi.js.map +1 -1
  402. package/dist/shared-tree/treeCheckout.d.ts +0 -5
  403. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  404. package/dist/shared-tree/treeCheckout.js +5 -3
  405. package/dist/shared-tree/treeCheckout.js.map +1 -1
  406. package/dist/shared-tree/treeView.d.ts +3 -6
  407. package/dist/shared-tree/treeView.d.ts.map +1 -1
  408. package/dist/shared-tree/treeView.js.map +1 -1
  409. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  410. package/dist/shared-tree-core/branch.js +11 -6
  411. package/dist/shared-tree-core/branch.js.map +1 -1
  412. package/dist/shared-tree-core/defaultResubmitMachine.js +3 -3
  413. package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  414. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  415. package/dist/shared-tree-core/editManagerCodecs.js +1 -0
  416. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  417. package/dist/shared-tree-core/editManagerFormat.d.ts +2 -2
  418. package/dist/shared-tree-core/editManagerFormat.d.ts.map +1 -1
  419. package/dist/shared-tree-core/editManagerFormat.js +6 -1
  420. package/dist/shared-tree-core/editManagerFormat.js.map +1 -1
  421. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  422. package/dist/shared-tree-core/messageCodecs.js +1 -0
  423. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  424. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  425. package/dist/shared-tree-core/sharedTreeCore.js +3 -1
  426. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  427. package/dist/simple-tree/api/create.d.ts +54 -0
  428. package/dist/simple-tree/api/create.d.ts.map +1 -0
  429. package/dist/simple-tree/api/create.js +99 -0
  430. package/dist/simple-tree/api/create.js.map +1 -0
  431. package/dist/simple-tree/api/index.d.ts +12 -0
  432. package/dist/simple-tree/api/index.d.ts.map +1 -0
  433. package/dist/simple-tree/api/index.js +28 -0
  434. package/dist/simple-tree/api/index.js.map +1 -0
  435. package/{lib/simple-tree → dist/simple-tree/api}/schemaCreationUtilities.d.ts +7 -4
  436. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -0
  437. package/dist/simple-tree/{schemaCreationUtilities.js → api/schemaCreationUtilities.js} +1 -1
  438. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -0
  439. package/dist/simple-tree/{schemaFactory.d.ts → api/schemaFactory.d.ts} +15 -14
  440. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -0
  441. package/dist/simple-tree/{schemaFactory.js → api/schemaFactory.js} +10 -9
  442. package/dist/simple-tree/api/schemaFactory.js.map +1 -0
  443. package/{lib/simple-tree → dist/simple-tree/api}/schemaFactoryRecursive.d.ts +40 -7
  444. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -0
  445. package/dist/simple-tree/{schemaFactoryRecursive.js → api/schemaFactoryRecursive.js} +1 -1
  446. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -0
  447. package/dist/simple-tree/api/testRecursiveDomain.d.ts +62 -0
  448. package/dist/simple-tree/api/testRecursiveDomain.d.ts.map +1 -0
  449. package/dist/simple-tree/api/testRecursiveDomain.js.map +1 -0
  450. package/{lib/simple-tree → dist/simple-tree/api}/tree.d.ts +111 -20
  451. package/dist/simple-tree/api/tree.d.ts.map +1 -0
  452. package/dist/simple-tree/api/tree.js +173 -0
  453. package/dist/simple-tree/api/tree.js.map +1 -0
  454. package/dist/simple-tree/{treeNodeApi.d.ts → api/treeNodeApi.d.ts} +7 -6
  455. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -0
  456. package/dist/simple-tree/{treeNodeApi.js → api/treeNodeApi.js} +57 -21
  457. package/dist/simple-tree/api/treeNodeApi.js.map +1 -0
  458. package/dist/simple-tree/api/verboseTree.d.ts +136 -0
  459. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -0
  460. package/dist/simple-tree/api/verboseTree.js +220 -0
  461. package/dist/simple-tree/api/verboseTree.js.map +1 -0
  462. package/dist/simple-tree/arrayNode.d.ts +3 -3
  463. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  464. package/dist/simple-tree/arrayNode.js +72 -85
  465. package/dist/simple-tree/arrayNode.js.map +1 -1
  466. package/dist/simple-tree/core/index.d.ts +10 -0
  467. package/dist/simple-tree/core/index.d.ts.map +1 -0
  468. package/dist/simple-tree/core/index.js +27 -0
  469. package/dist/simple-tree/core/index.js.map +1 -0
  470. package/{lib/simple-tree → dist/simple-tree/core}/schemaCaching.d.ts +2 -9
  471. package/dist/simple-tree/core/schemaCaching.d.ts.map +1 -0
  472. package/dist/simple-tree/{schemaCaching.js → core/schemaCaching.js} +2 -23
  473. package/dist/simple-tree/core/schemaCaching.js.map +1 -0
  474. package/dist/simple-tree/core/treeNodeKernel.d.ts +70 -0
  475. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -0
  476. package/dist/simple-tree/core/treeNodeKernel.js +164 -0
  477. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -0
  478. package/dist/simple-tree/core/treeNodeSchema.d.ts +149 -0
  479. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -0
  480. package/dist/simple-tree/core/treeNodeSchema.js +35 -0
  481. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -0
  482. package/{lib/simple-tree → dist/simple-tree/core}/types.d.ts +50 -79
  483. package/dist/simple-tree/core/types.d.ts.map +1 -0
  484. package/dist/simple-tree/core/types.js +117 -0
  485. package/dist/simple-tree/core/types.js.map +1 -0
  486. package/dist/simple-tree/core/withType.d.ts +82 -0
  487. package/dist/simple-tree/core/withType.d.ts.map +1 -0
  488. package/dist/simple-tree/core/withType.js +39 -0
  489. package/dist/simple-tree/core/withType.js.map +1 -0
  490. package/dist/simple-tree/getJsonSchema.d.ts +55 -0
  491. package/dist/simple-tree/getJsonSchema.d.ts.map +1 -0
  492. package/dist/simple-tree/getJsonSchema.js +69 -0
  493. package/dist/simple-tree/getJsonSchema.js.map +1 -0
  494. package/dist/simple-tree/getSimpleFieldSchema.d.ts +14 -0
  495. package/dist/simple-tree/getSimpleFieldSchema.d.ts.map +1 -0
  496. package/dist/simple-tree/getSimpleFieldSchema.js +29 -0
  497. package/dist/simple-tree/getSimpleFieldSchema.js.map +1 -0
  498. package/dist/simple-tree/getSimpleSchema.d.ts +58 -0
  499. package/dist/simple-tree/getSimpleSchema.d.ts.map +1 -0
  500. package/dist/simple-tree/getSimpleSchema.js +68 -0
  501. package/dist/simple-tree/getSimpleSchema.js.map +1 -0
  502. package/dist/simple-tree/index.d.ts +12 -13
  503. package/dist/simple-tree/index.d.ts.map +1 -1
  504. package/dist/simple-tree/index.js +26 -23
  505. package/dist/simple-tree/index.js.map +1 -1
  506. package/dist/simple-tree/jsonSchema.d.ts +206 -0
  507. package/dist/simple-tree/jsonSchema.d.ts.map +1 -0
  508. package/dist/{feature-libraries/schema-aware/index.js → simple-tree/jsonSchema.js} +1 -1
  509. package/dist/simple-tree/jsonSchema.js.map +1 -0
  510. package/dist/simple-tree/leafNodeSchema.d.ts +1 -1
  511. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  512. package/dist/simple-tree/leafNodeSchema.js +3 -4
  513. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  514. package/dist/simple-tree/mapNode.d.ts +9 -3
  515. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  516. package/dist/simple-tree/mapNode.js +33 -35
  517. package/dist/simple-tree/mapNode.js.map +1 -1
  518. package/dist/simple-tree/objectNode.d.ts +18 -16
  519. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  520. package/dist/simple-tree/objectNode.js +43 -44
  521. package/dist/simple-tree/objectNode.js.map +1 -1
  522. package/dist/simple-tree/objectNodeTypes.d.ts +38 -0
  523. package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -0
  524. package/dist/simple-tree/objectNodeTypes.js +19 -0
  525. package/dist/simple-tree/objectNodeTypes.js.map +1 -0
  526. package/dist/simple-tree/proxies.d.ts +6 -25
  527. package/dist/simple-tree/proxies.d.ts.map +1 -1
  528. package/dist/simple-tree/proxies.js +50 -63
  529. package/dist/simple-tree/proxies.js.map +1 -1
  530. package/dist/simple-tree/proxyBinding.d.ts +45 -22
  531. package/dist/simple-tree/proxyBinding.d.ts.map +1 -1
  532. package/dist/simple-tree/proxyBinding.js +94 -59
  533. package/dist/simple-tree/proxyBinding.js.map +1 -1
  534. package/dist/simple-tree/schemaTypes.d.ts +10 -159
  535. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  536. package/dist/simple-tree/schemaTypes.js +11 -42
  537. package/dist/simple-tree/schemaTypes.js.map +1 -1
  538. package/dist/simple-tree/simpleSchema.d.ts +124 -0
  539. package/dist/simple-tree/simpleSchema.d.ts.map +1 -0
  540. package/dist/{feature-libraries/schema-aware/schemaAware.js → simple-tree/simpleSchema.js} +1 -1
  541. package/dist/simple-tree/simpleSchema.js.map +1 -0
  542. package/dist/simple-tree/simpleSchemaToJsonSchema.d.ts +12 -0
  543. package/dist/simple-tree/simpleSchemaToJsonSchema.d.ts.map +1 -0
  544. package/dist/simple-tree/simpleSchemaToJsonSchema.js +146 -0
  545. package/dist/simple-tree/simpleSchemaToJsonSchema.js.map +1 -0
  546. package/dist/simple-tree/toFlexSchema.d.ts +4 -12
  547. package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
  548. package/dist/simple-tree/toFlexSchema.js +42 -52
  549. package/dist/simple-tree/toFlexSchema.js.map +1 -1
  550. package/dist/simple-tree/toMapTree.d.ts +39 -39
  551. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  552. package/dist/simple-tree/toMapTree.js +227 -171
  553. package/dist/simple-tree/toMapTree.js.map +1 -1
  554. package/dist/simple-tree/treeNodeValid.d.ts +74 -0
  555. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -0
  556. package/dist/simple-tree/{types.js → treeNodeValid.js} +18 -111
  557. package/dist/simple-tree/treeNodeValid.js.map +1 -0
  558. package/dist/simple-tree/typesUnsafe.d.ts +35 -4
  559. package/dist/simple-tree/typesUnsafe.d.ts.map +1 -1
  560. package/dist/simple-tree/typesUnsafe.js.map +1 -1
  561. package/dist/simple-tree/viewSchemaToSimpleSchema.d.ts +11 -0
  562. package/dist/simple-tree/viewSchemaToSimpleSchema.d.ts.map +1 -0
  563. package/dist/simple-tree/viewSchemaToSimpleSchema.js +171 -0
  564. package/dist/simple-tree/viewSchemaToSimpleSchema.js.map +1 -0
  565. package/dist/util/brand.d.ts +0 -3
  566. package/dist/util/brand.d.ts.map +1 -1
  567. package/dist/util/brand.js +1 -2
  568. package/dist/util/brand.js.map +1 -1
  569. package/dist/util/brandedMap.d.ts +0 -5
  570. package/dist/util/brandedMap.d.ts.map +1 -1
  571. package/dist/util/brandedMap.js +0 -1
  572. package/dist/util/brandedMap.js.map +1 -1
  573. package/dist/util/idAllocator.d.ts +0 -2
  574. package/dist/util/idAllocator.d.ts.map +1 -1
  575. package/dist/util/idAllocator.js +0 -1
  576. package/dist/util/idAllocator.js.map +1 -1
  577. package/dist/util/index.d.ts +2 -2
  578. package/dist/util/index.d.ts.map +1 -1
  579. package/dist/util/index.js +4 -2
  580. package/dist/util/index.js.map +1 -1
  581. package/dist/util/nestedMap.d.ts +5 -19
  582. package/dist/util/nestedMap.d.ts.map +1 -1
  583. package/dist/util/nestedMap.js +17 -17
  584. package/dist/util/nestedMap.js.map +1 -1
  585. package/dist/util/opaque.d.ts +0 -4
  586. package/dist/util/opaque.d.ts.map +1 -1
  587. package/dist/util/opaque.js +0 -2
  588. package/dist/util/opaque.js.map +1 -1
  589. package/dist/util/rangeMap.d.ts +0 -2
  590. package/dist/util/rangeMap.d.ts.map +1 -1
  591. package/dist/util/rangeMap.js +4 -3
  592. package/dist/util/rangeMap.js.map +1 -1
  593. package/dist/util/transactionResult.d.ts +0 -1
  594. package/dist/util/transactionResult.d.ts.map +1 -1
  595. package/dist/util/transactionResult.js +0 -1
  596. package/dist/util/transactionResult.js.map +1 -1
  597. package/dist/util/typeCheck.d.ts +2 -20
  598. package/dist/util/typeCheck.d.ts.map +1 -1
  599. package/dist/util/typeCheck.js.map +1 -1
  600. package/dist/util/typeCheckTests.d.ts +4 -4
  601. package/dist/util/typeCheckTests.d.ts.map +1 -1
  602. package/dist/util/typeCheckTests.js.map +1 -1
  603. package/dist/util/typeUtils.d.ts +0 -7
  604. package/dist/util/typeUtils.d.ts.map +1 -1
  605. package/dist/util/typeUtils.js.map +1 -1
  606. package/dist/util/utils.d.ts +6 -8
  607. package/dist/util/utils.d.ts.map +1 -1
  608. package/dist/util/utils.js +14 -5
  609. package/dist/util/utils.js.map +1 -1
  610. package/lib/beta.d.ts +4 -1
  611. package/lib/codec/discriminatedUnions.d.ts +11 -5
  612. package/lib/codec/discriminatedUnions.d.ts.map +1 -1
  613. package/lib/codec/discriminatedUnions.js.map +1 -1
  614. package/lib/codec/index.d.ts +1 -1
  615. package/lib/codec/index.d.ts.map +1 -1
  616. package/lib/codec/index.js +1 -1
  617. package/lib/codec/index.js.map +1 -1
  618. package/lib/core/forest/editableForest.d.ts +1 -5
  619. package/lib/core/forest/editableForest.d.ts.map +1 -1
  620. package/lib/core/forest/editableForest.js.map +1 -1
  621. package/lib/core/forest/forest.d.ts +0 -6
  622. package/lib/core/forest/forest.d.ts.map +1 -1
  623. package/lib/core/forest/forest.js +0 -2
  624. package/lib/core/forest/forest.js.map +1 -1
  625. package/lib/core/index.d.ts +2 -2
  626. package/lib/core/index.d.ts.map +1 -1
  627. package/lib/core/index.js +2 -2
  628. package/lib/core/index.js.map +1 -1
  629. package/lib/core/rebase/changeRebaser.d.ts +0 -4
  630. package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
  631. package/lib/core/rebase/changeRebaser.js.map +1 -1
  632. package/lib/core/rebase/index.d.ts +1 -1
  633. package/lib/core/rebase/index.d.ts.map +1 -1
  634. package/lib/core/rebase/index.js +1 -1
  635. package/lib/core/rebase/index.js.map +1 -1
  636. package/lib/core/rebase/types.d.ts +1 -8
  637. package/lib/core/rebase/types.d.ts.map +1 -1
  638. package/lib/core/rebase/types.js +1 -7
  639. package/lib/core/rebase/types.js.map +1 -1
  640. package/lib/core/rebase/utils.d.ts +0 -1
  641. package/lib/core/rebase/utils.d.ts.map +1 -1
  642. package/lib/core/rebase/utils.js +13 -8
  643. package/lib/core/rebase/utils.js.map +1 -1
  644. package/lib/core/schema-stored/multiplicity.d.ts +0 -1
  645. package/lib/core/schema-stored/multiplicity.d.ts.map +1 -1
  646. package/lib/core/schema-stored/multiplicity.js +0 -1
  647. package/lib/core/schema-stored/multiplicity.js.map +1 -1
  648. package/lib/core/schema-stored/schema.d.ts +0 -7
  649. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  650. package/lib/core/schema-stored/schema.js +0 -4
  651. package/lib/core/schema-stored/schema.js.map +1 -1
  652. package/lib/core/schema-stored/storedSchemaRepository.d.ts +0 -3
  653. package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  654. package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
  655. package/lib/core/schema-view/view.d.ts +0 -3
  656. package/lib/core/schema-view/view.d.ts.map +1 -1
  657. package/lib/core/schema-view/view.js +0 -1
  658. package/lib/core/schema-view/view.js.map +1 -1
  659. package/lib/core/tree/anchorSet.d.ts +4 -16
  660. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  661. package/lib/core/tree/anchorSet.js +12 -5
  662. package/lib/core/tree/anchorSet.js.map +1 -1
  663. package/lib/core/tree/cursor.d.ts +1 -6
  664. package/lib/core/tree/cursor.d.ts.map +1 -1
  665. package/lib/core/tree/cursor.js +0 -2
  666. package/lib/core/tree/cursor.js.map +1 -1
  667. package/lib/core/tree/delta.d.ts +0 -11
  668. package/lib/core/tree/delta.d.ts.map +1 -1
  669. package/lib/core/tree/delta.js.map +1 -1
  670. package/lib/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  671. package/lib/core/tree/detachedFieldIndexCodec.js +4 -3
  672. package/lib/core/tree/detachedFieldIndexCodec.js.map +1 -1
  673. package/lib/core/tree/detachedFieldIndexTypes.d.ts +0 -1
  674. package/lib/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
  675. package/lib/core/tree/detachedFieldIndexTypes.js.map +1 -1
  676. package/lib/core/tree/index.d.ts +1 -1
  677. package/lib/core/tree/index.d.ts.map +1 -1
  678. package/lib/core/tree/index.js +1 -0
  679. package/lib/core/tree/index.js.map +1 -1
  680. package/lib/core/tree/mapTree.d.ts +20 -4
  681. package/lib/core/tree/mapTree.d.ts.map +1 -1
  682. package/lib/core/tree/mapTree.js +27 -1
  683. package/lib/core/tree/mapTree.js.map +1 -1
  684. package/lib/core/tree/pathTree.d.ts +0 -11
  685. package/lib/core/tree/pathTree.d.ts.map +1 -1
  686. package/lib/core/tree/pathTree.js.map +1 -1
  687. package/lib/core/tree/treeTextFormat.d.ts.map +1 -1
  688. package/lib/core/tree/treeTextFormat.js +3 -2
  689. package/lib/core/tree/treeTextFormat.js.map +1 -1
  690. package/lib/core/tree/types.d.ts +0 -11
  691. package/lib/core/tree/types.d.ts.map +1 -1
  692. package/lib/core/tree/types.js +0 -4
  693. package/lib/core/tree/types.js.map +1 -1
  694. package/lib/core/tree/visitDelta.d.ts +0 -1
  695. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  696. package/lib/core/tree/visitDelta.js +2 -2
  697. package/lib/core/tree/visitDelta.js.map +1 -1
  698. package/lib/core/tree/visitPath.d.ts +0 -2
  699. package/lib/core/tree/visitPath.d.ts.map +1 -1
  700. package/lib/core/tree/visitPath.js.map +1 -1
  701. package/lib/core/tree/visitorUtils.d.ts +0 -1
  702. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  703. package/lib/core/tree/visitorUtils.js.map +1 -1
  704. package/lib/domains/index.d.ts +1 -1
  705. package/lib/domains/index.d.ts.map +1 -1
  706. package/lib/domains/index.js +1 -1
  707. package/lib/domains/index.js.map +1 -1
  708. package/lib/domains/json/index.d.ts +1 -1
  709. package/lib/domains/json/index.d.ts.map +1 -1
  710. package/lib/domains/json/index.js +1 -1
  711. package/lib/domains/json/index.js.map +1 -1
  712. package/lib/domains/json/jsonCursor.d.ts +36 -2
  713. package/lib/domains/json/jsonCursor.d.ts.map +1 -1
  714. package/lib/domains/json/jsonCursor.js +76 -5
  715. package/lib/domains/json/jsonCursor.js.map +1 -1
  716. package/lib/domains/json/jsonDomainSchema.d.ts +13 -3
  717. package/lib/domains/json/jsonDomainSchema.d.ts.map +1 -1
  718. package/lib/domains/json/jsonDomainSchema.js +9 -1
  719. package/lib/domains/json/jsonDomainSchema.js.map +1 -1
  720. package/lib/domains/leafDomain.d.ts +0 -1
  721. package/lib/domains/leafDomain.d.ts.map +1 -1
  722. package/lib/domains/leafDomain.js +0 -1
  723. package/lib/domains/leafDomain.js.map +1 -1
  724. package/lib/domains/schemaBuilder.d.ts +1 -7
  725. package/lib/domains/schemaBuilder.d.ts.map +1 -1
  726. package/lib/domains/schemaBuilder.js +1 -11
  727. package/lib/domains/schemaBuilder.js.map +1 -1
  728. package/lib/events/events.d.ts +7 -5
  729. package/lib/events/events.d.ts.map +1 -1
  730. package/lib/events/events.js +5 -3
  731. package/lib/events/events.js.map +1 -1
  732. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  733. package/lib/feature-libraries/chunked-forest/basicChunk.js +9 -4
  734. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  735. package/lib/feature-libraries/chunked-forest/chunk.d.ts +1 -1
  736. package/lib/feature-libraries/chunked-forest/chunk.d.ts.map +1 -1
  737. package/lib/feature-libraries/chunked-forest/chunk.js.map +1 -1
  738. package/lib/feature-libraries/chunked-forest/chunkTree.js +4 -4
  739. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  740. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  741. package/lib/feature-libraries/chunked-forest/chunkedForest.js +8 -6
  742. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  743. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +2 -2
  744. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  745. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  746. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +9 -6
  747. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  748. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  749. package/lib/feature-libraries/chunked-forest/uniformChunk.js +6 -4
  750. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  751. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -24
  752. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  753. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +6 -16
  754. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  755. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +0 -6
  756. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  757. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +11 -1
  758. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  759. package/lib/feature-libraries/default-schema/defaultSchema.d.ts +0 -1
  760. package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
  761. package/lib/feature-libraries/default-schema/defaultSchema.js +0 -1
  762. package/lib/feature-libraries/default-schema/defaultSchema.js.map +1 -1
  763. package/lib/feature-libraries/default-schema/index.d.ts +1 -1
  764. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  765. package/lib/feature-libraries/default-schema/index.js +1 -1
  766. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  767. package/lib/feature-libraries/default-schema/schemaChecker.d.ts +6 -0
  768. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  769. package/lib/feature-libraries/default-schema/schemaChecker.js +6 -0
  770. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  771. package/lib/feature-libraries/editableTreeBinder.d.ts +0 -67
  772. package/lib/feature-libraries/editableTreeBinder.d.ts.map +1 -1
  773. package/lib/feature-libraries/editableTreeBinder.js +6 -25
  774. package/lib/feature-libraries/editableTreeBinder.js.map +1 -1
  775. package/lib/feature-libraries/fieldGenerator.d.ts +0 -3
  776. package/lib/feature-libraries/fieldGenerator.d.ts.map +1 -1
  777. package/lib/feature-libraries/fieldGenerator.js +0 -1
  778. package/lib/feature-libraries/fieldGenerator.js.map +1 -1
  779. package/lib/feature-libraries/flex-map-tree/index.d.ts +1 -1
  780. package/lib/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  781. package/lib/feature-libraries/flex-map-tree/index.js +1 -1
  782. package/lib/feature-libraries/flex-map-tree/index.js.map +1 -1
  783. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts +57 -51
  784. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  785. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js +172 -180
  786. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  787. package/lib/feature-libraries/flex-tree/context.d.ts +0 -1
  788. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  789. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  790. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +17 -373
  791. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  792. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +0 -33
  793. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  794. package/lib/feature-libraries/flex-tree/index.d.ts +2 -2
  795. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  796. package/lib/feature-libraries/flex-tree/index.js +1 -1
  797. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  798. package/lib/feature-libraries/flex-tree/lazyField.d.ts +9 -27
  799. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  800. package/lib/feature-libraries/flex-tree/lazyField.js +28 -104
  801. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  802. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +3 -18
  803. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  804. package/lib/feature-libraries/flex-tree/lazyNode.js +5 -126
  805. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  806. package/lib/feature-libraries/flex-tree/treeEvents.d.ts +0 -2
  807. package/lib/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
  808. package/lib/feature-libraries/flex-tree/treeEvents.js.map +1 -1
  809. package/lib/feature-libraries/flex-tree/utilities.d.ts +2 -1
  810. package/lib/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  811. package/lib/feature-libraries/flex-tree/utilities.js +4 -0
  812. package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
  813. package/lib/feature-libraries/forest-summary/codec.js +3 -3
  814. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  815. package/lib/feature-libraries/index.d.ts +6 -8
  816. package/lib/feature-libraries/index.d.ts.map +1 -1
  817. package/lib/feature-libraries/index.js +6 -7
  818. package/lib/feature-libraries/index.js.map +1 -1
  819. package/lib/feature-libraries/mapTreeCursor.d.ts +6 -2
  820. package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  821. package/lib/feature-libraries/mapTreeCursor.js +7 -0
  822. package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
  823. package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -4
  824. package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts.map +1 -1
  825. package/lib/feature-libraries/memoizedIdRangeAllocator.js +0 -1
  826. package/lib/feature-libraries/memoizedIdRangeAllocator.js.map +1 -1
  827. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +0 -2
  828. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  829. package/lib/feature-libraries/modular-schema/crossFieldQueries.js +0 -1
  830. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  831. package/lib/feature-libraries/modular-schema/discrepancies.d.ts +18 -0
  832. package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  833. package/lib/feature-libraries/modular-schema/discrepancies.js +103 -1
  834. package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  835. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +0 -8
  836. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  837. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js +0 -1
  838. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  839. package/lib/feature-libraries/modular-schema/fieldKind.d.ts +1 -3
  840. package/lib/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  841. package/lib/feature-libraries/modular-schema/fieldKind.js +1 -2
  842. package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  843. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +1 -2
  844. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  845. package/lib/feature-libraries/modular-schema/genericFieldKind.js +56 -83
  846. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  847. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts +1 -1
  848. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
  849. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js +6 -9
  850. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  851. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.d.ts +3 -14
  852. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.d.ts.map +1 -1
  853. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.js +4 -1
  854. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
  855. package/lib/feature-libraries/modular-schema/index.d.ts +2 -2
  856. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  857. package/lib/feature-libraries/modular-schema/index.js +1 -1
  858. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  859. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  860. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +42 -25
  861. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  862. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +9 -8
  863. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  864. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +169 -206
  865. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  866. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +8 -14
  867. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  868. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  869. package/lib/feature-libraries/node-key/nodeKey.d.ts +0 -4
  870. package/lib/feature-libraries/node-key/nodeKey.d.ts.map +1 -1
  871. package/lib/feature-libraries/node-key/nodeKey.js +0 -2
  872. package/lib/feature-libraries/node-key/nodeKey.js.map +1 -1
  873. package/lib/feature-libraries/node-key/nodeKeyManager.d.ts +0 -1
  874. package/lib/feature-libraries/node-key/nodeKeyManager.d.ts.map +1 -1
  875. package/lib/feature-libraries/node-key/nodeKeyManager.js.map +1 -1
  876. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  877. package/lib/feature-libraries/object-forest/objectForest.js +2 -11
  878. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  879. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
  880. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  881. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
  882. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  883. package/lib/feature-libraries/schemaBuilderBase.d.ts +2 -28
  884. package/lib/feature-libraries/schemaBuilderBase.d.ts.map +1 -1
  885. package/lib/feature-libraries/schemaBuilderBase.js +2 -28
  886. package/lib/feature-libraries/schemaBuilderBase.js.map +1 -1
  887. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  888. package/lib/feature-libraries/sequence-field/compose.js +25 -22
  889. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  890. package/lib/feature-libraries/sequence-field/formatV2.d.ts +3 -3
  891. package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  892. package/lib/feature-libraries/sequence-field/formatV2.js +3 -3
  893. package/lib/feature-libraries/sequence-field/formatV2.js.map +1 -1
  894. package/lib/feature-libraries/sequence-field/formatV3.d.ts +195 -0
  895. package/lib/feature-libraries/sequence-field/formatV3.d.ts.map +1 -0
  896. package/lib/feature-libraries/sequence-field/formatV3.js +19 -0
  897. package/lib/feature-libraries/sequence-field/formatV3.js.map +1 -0
  898. package/lib/feature-libraries/sequence-field/helperTypes.d.ts +11 -0
  899. package/lib/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  900. package/lib/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  901. package/lib/feature-libraries/sequence-field/index.d.ts +1 -1
  902. package/lib/feature-libraries/sequence-field/index.d.ts.map +1 -1
  903. package/lib/feature-libraries/sequence-field/index.js.map +1 -1
  904. package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  905. package/lib/feature-libraries/sequence-field/invert.js +22 -14
  906. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  907. package/lib/feature-libraries/sequence-field/markQueue.js +2 -2
  908. package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
  909. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +2 -2
  910. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  911. package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  912. package/lib/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  913. package/lib/feature-libraries/sequence-field/rebase.js +25 -7
  914. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  915. package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  916. package/lib/feature-libraries/sequence-field/replaceRevisions.js +16 -3
  917. package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  918. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  919. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +40 -6
  920. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  921. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -1
  922. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  923. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +55 -11
  924. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  925. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +11 -0
  926. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -0
  927. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +81 -0
  928. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -0
  929. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  930. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js +2 -0
  931. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  932. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  933. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +5 -2
  934. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  935. package/lib/feature-libraries/sequence-field/types.d.ts +23 -4
  936. package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
  937. package/lib/feature-libraries/sequence-field/types.js.map +1 -1
  938. package/lib/feature-libraries/sequence-field/utils.d.ts +5 -4
  939. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  940. package/lib/feature-libraries/sequence-field/utils.js +67 -41
  941. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  942. package/lib/feature-libraries/storedToViewSchema.d.ts +0 -1
  943. package/lib/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  944. package/lib/feature-libraries/storedToViewSchema.js +0 -1
  945. package/lib/feature-libraries/storedToViewSchema.js.map +1 -1
  946. package/lib/feature-libraries/treeCursorUtils.d.ts +0 -6
  947. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  948. package/lib/feature-libraries/treeCursorUtils.js +9 -7
  949. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  950. package/lib/feature-libraries/treeTextCursor.d.ts +0 -2
  951. package/lib/feature-libraries/treeTextCursor.d.ts.map +1 -1
  952. package/lib/feature-libraries/treeTextCursor.js +0 -2
  953. package/lib/feature-libraries/treeTextCursor.js.map +1 -1
  954. package/lib/feature-libraries/typed-schema/flexList.d.ts +0 -3
  955. package/lib/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
  956. package/lib/feature-libraries/typed-schema/flexList.js.map +1 -1
  957. package/lib/feature-libraries/typed-schema/index.d.ts +1 -1
  958. package/lib/feature-libraries/typed-schema/index.d.ts.map +1 -1
  959. package/lib/feature-libraries/typed-schema/index.js +1 -1
  960. package/lib/feature-libraries/typed-schema/index.js.map +1 -1
  961. package/lib/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  962. package/lib/feature-libraries/typed-schema/schemaCollection.js +1 -5
  963. package/lib/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  964. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +2 -41
  965. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  966. package/lib/feature-libraries/typed-schema/typedTreeSchema.js +1 -38
  967. package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  968. package/lib/feature-libraries/typed-schema/view.d.ts +0 -1
  969. package/lib/feature-libraries/typed-schema/view.d.ts.map +1 -1
  970. package/lib/feature-libraries/typed-schema/view.js.map +1 -1
  971. package/lib/index.d.ts +8 -9
  972. package/lib/index.d.ts.map +1 -1
  973. package/lib/index.js +8 -9
  974. package/lib/index.js.map +1 -1
  975. package/lib/internalTypes.d.ts +1 -1
  976. package/lib/internalTypes.d.ts.map +1 -1
  977. package/lib/internalTypes.js.map +1 -1
  978. package/lib/packageVersion.d.ts +1 -1
  979. package/lib/packageVersion.d.ts.map +1 -1
  980. package/lib/packageVersion.js +1 -1
  981. package/lib/packageVersion.js.map +1 -1
  982. package/lib/public.d.ts +4 -1
  983. package/lib/shared-tree/schematizeTree.d.ts +2 -11
  984. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  985. package/lib/shared-tree/schematizeTree.js +15 -4
  986. package/lib/shared-tree/schematizeTree.js.map +1 -1
  987. package/lib/shared-tree/schematizingTreeView.d.ts +4 -4
  988. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  989. package/lib/shared-tree/schematizingTreeView.js +3 -3
  990. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  991. package/lib/shared-tree/sharedTree.d.ts +4 -17
  992. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  993. package/lib/shared-tree/sharedTree.js +6 -10
  994. package/lib/shared-tree/sharedTree.js.map +1 -1
  995. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  996. package/lib/shared-tree/sharedTreeChangeCodecs.js +4 -0
  997. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  998. package/lib/shared-tree/sharedTreeChangeFamily.js +3 -3
  999. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  1000. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +0 -2
  1001. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  1002. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  1003. package/lib/shared-tree/treeApi.js +3 -3
  1004. package/lib/shared-tree/treeApi.js.map +1 -1
  1005. package/lib/shared-tree/treeCheckout.d.ts +0 -5
  1006. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  1007. package/lib/shared-tree/treeCheckout.js +6 -4
  1008. package/lib/shared-tree/treeCheckout.js.map +1 -1
  1009. package/lib/shared-tree/treeView.d.ts +3 -6
  1010. package/lib/shared-tree/treeView.d.ts.map +1 -1
  1011. package/lib/shared-tree/treeView.js.map +1 -1
  1012. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  1013. package/lib/shared-tree-core/branch.js +12 -7
  1014. package/lib/shared-tree-core/branch.js.map +1 -1
  1015. package/lib/shared-tree-core/defaultResubmitMachine.js +4 -4
  1016. package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  1017. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  1018. package/lib/shared-tree-core/editManagerCodecs.js +1 -0
  1019. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  1020. package/lib/shared-tree-core/editManagerFormat.d.ts +2 -2
  1021. package/lib/shared-tree-core/editManagerFormat.d.ts.map +1 -1
  1022. package/lib/shared-tree-core/editManagerFormat.js +6 -1
  1023. package/lib/shared-tree-core/editManagerFormat.js.map +1 -1
  1024. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  1025. package/lib/shared-tree-core/messageCodecs.js +1 -0
  1026. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  1027. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  1028. package/lib/shared-tree-core/sharedTreeCore.js +4 -2
  1029. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  1030. package/lib/simple-tree/api/create.d.ts +54 -0
  1031. package/lib/simple-tree/api/create.d.ts.map +1 -0
  1032. package/lib/simple-tree/api/create.js +92 -0
  1033. package/lib/simple-tree/api/create.js.map +1 -0
  1034. package/lib/simple-tree/api/index.d.ts +12 -0
  1035. package/lib/simple-tree/api/index.d.ts.map +1 -0
  1036. package/lib/simple-tree/api/index.js +13 -0
  1037. package/lib/simple-tree/api/index.js.map +1 -0
  1038. package/{dist/simple-tree → lib/simple-tree/api}/schemaCreationUtilities.d.ts +7 -4
  1039. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -0
  1040. package/lib/simple-tree/{schemaCreationUtilities.js → api/schemaCreationUtilities.js} +1 -1
  1041. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -0
  1042. package/lib/simple-tree/{schemaFactory.d.ts → api/schemaFactory.d.ts} +15 -14
  1043. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -0
  1044. package/lib/simple-tree/{schemaFactory.js → api/schemaFactory.js} +9 -8
  1045. package/lib/simple-tree/api/schemaFactory.js.map +1 -0
  1046. package/{dist/simple-tree → lib/simple-tree/api}/schemaFactoryRecursive.d.ts +40 -7
  1047. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -0
  1048. package/lib/simple-tree/{schemaFactoryRecursive.js → api/schemaFactoryRecursive.js} +1 -1
  1049. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -0
  1050. package/lib/simple-tree/api/testRecursiveDomain.d.ts +62 -0
  1051. package/lib/simple-tree/api/testRecursiveDomain.d.ts.map +1 -0
  1052. package/lib/simple-tree/api/testRecursiveDomain.js.map +1 -0
  1053. package/{dist/simple-tree → lib/simple-tree/api}/tree.d.ts +111 -20
  1054. package/lib/simple-tree/api/tree.d.ts.map +1 -0
  1055. package/lib/simple-tree/api/tree.js +165 -0
  1056. package/lib/simple-tree/api/tree.js.map +1 -0
  1057. package/lib/simple-tree/{treeNodeApi.d.ts → api/treeNodeApi.d.ts} +7 -6
  1058. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -0
  1059. package/lib/simple-tree/{treeNodeApi.js → api/treeNodeApi.js} +55 -19
  1060. package/lib/simple-tree/api/treeNodeApi.js.map +1 -0
  1061. package/lib/simple-tree/api/verboseTree.d.ts +136 -0
  1062. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -0
  1063. package/lib/simple-tree/api/verboseTree.js +213 -0
  1064. package/lib/simple-tree/api/verboseTree.js.map +1 -0
  1065. package/lib/simple-tree/arrayNode.d.ts +3 -3
  1066. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  1067. package/lib/simple-tree/arrayNode.js +59 -70
  1068. package/lib/simple-tree/arrayNode.js.map +1 -1
  1069. package/lib/simple-tree/core/index.d.ts +10 -0
  1070. package/lib/simple-tree/core/index.d.ts.map +1 -0
  1071. package/lib/simple-tree/core/index.js +10 -0
  1072. package/lib/simple-tree/core/index.js.map +1 -0
  1073. package/{dist/simple-tree → lib/simple-tree/core}/schemaCaching.d.ts +2 -9
  1074. package/lib/simple-tree/core/schemaCaching.d.ts.map +1 -0
  1075. package/lib/simple-tree/{schemaCaching.js → core/schemaCaching.js} +1 -21
  1076. package/lib/simple-tree/core/schemaCaching.js.map +1 -0
  1077. package/lib/simple-tree/core/treeNodeKernel.d.ts +70 -0
  1078. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -0
  1079. package/lib/simple-tree/core/treeNodeKernel.js +157 -0
  1080. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -0
  1081. package/lib/simple-tree/core/treeNodeSchema.d.ts +149 -0
  1082. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -0
  1083. package/lib/simple-tree/core/treeNodeSchema.js +32 -0
  1084. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -0
  1085. package/{dist/simple-tree → lib/simple-tree/core}/types.d.ts +50 -79
  1086. package/lib/simple-tree/core/types.d.ts.map +1 -0
  1087. package/lib/simple-tree/core/types.js +111 -0
  1088. package/lib/simple-tree/core/types.js.map +1 -0
  1089. package/lib/simple-tree/core/withType.d.ts +82 -0
  1090. package/lib/simple-tree/core/withType.d.ts.map +1 -0
  1091. package/lib/simple-tree/core/withType.js +36 -0
  1092. package/lib/simple-tree/core/withType.js.map +1 -0
  1093. package/lib/simple-tree/getJsonSchema.d.ts +55 -0
  1094. package/lib/simple-tree/getJsonSchema.d.ts.map +1 -0
  1095. package/lib/simple-tree/getJsonSchema.js +65 -0
  1096. package/lib/simple-tree/getJsonSchema.js.map +1 -0
  1097. package/lib/simple-tree/getSimpleFieldSchema.d.ts +14 -0
  1098. package/lib/simple-tree/getSimpleFieldSchema.d.ts.map +1 -0
  1099. package/lib/simple-tree/getSimpleFieldSchema.js +25 -0
  1100. package/lib/simple-tree/getSimpleFieldSchema.js.map +1 -0
  1101. package/lib/simple-tree/getSimpleSchema.d.ts +58 -0
  1102. package/lib/simple-tree/getSimpleSchema.d.ts.map +1 -0
  1103. package/lib/simple-tree/getSimpleSchema.js +64 -0
  1104. package/lib/simple-tree/getSimpleSchema.js.map +1 -0
  1105. package/lib/simple-tree/index.d.ts +12 -13
  1106. package/lib/simple-tree/index.d.ts.map +1 -1
  1107. package/lib/simple-tree/index.js +8 -11
  1108. package/lib/simple-tree/index.js.map +1 -1
  1109. package/lib/simple-tree/jsonSchema.d.ts +206 -0
  1110. package/lib/simple-tree/jsonSchema.d.ts.map +1 -0
  1111. package/lib/simple-tree/{nodeKeys.js → jsonSchema.js} +1 -1
  1112. package/lib/simple-tree/jsonSchema.js.map +1 -0
  1113. package/lib/simple-tree/leafNodeSchema.d.ts +1 -1
  1114. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  1115. package/lib/simple-tree/leafNodeSchema.js +1 -2
  1116. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  1117. package/lib/simple-tree/mapNode.d.ts +9 -3
  1118. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  1119. package/lib/simple-tree/mapNode.js +36 -36
  1120. package/lib/simple-tree/mapNode.js.map +1 -1
  1121. package/lib/simple-tree/objectNode.d.ts +18 -16
  1122. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  1123. package/lib/simple-tree/objectNode.js +36 -34
  1124. package/lib/simple-tree/objectNode.js.map +1 -1
  1125. package/lib/simple-tree/objectNodeTypes.d.ts +38 -0
  1126. package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -0
  1127. package/lib/simple-tree/objectNodeTypes.js +15 -0
  1128. package/lib/simple-tree/objectNodeTypes.js.map +1 -0
  1129. package/lib/simple-tree/proxies.d.ts +6 -25
  1130. package/lib/simple-tree/proxies.d.ts.map +1 -1
  1131. package/lib/simple-tree/proxies.js +46 -57
  1132. package/lib/simple-tree/proxies.js.map +1 -1
  1133. package/lib/simple-tree/proxyBinding.d.ts +45 -22
  1134. package/lib/simple-tree/proxyBinding.d.ts.map +1 -1
  1135. package/lib/simple-tree/proxyBinding.js +89 -52
  1136. package/lib/simple-tree/proxyBinding.js.map +1 -1
  1137. package/lib/simple-tree/schemaTypes.d.ts +10 -159
  1138. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  1139. package/lib/simple-tree/schemaTypes.js +9 -41
  1140. package/lib/simple-tree/schemaTypes.js.map +1 -1
  1141. package/lib/simple-tree/simpleSchema.d.ts +124 -0
  1142. package/lib/simple-tree/simpleSchema.d.ts.map +1 -0
  1143. package/lib/{feature-libraries/schema-aware/schemaAware.js → simple-tree/simpleSchema.js} +1 -1
  1144. package/lib/simple-tree/simpleSchema.js.map +1 -0
  1145. package/lib/simple-tree/simpleSchemaToJsonSchema.d.ts +12 -0
  1146. package/lib/simple-tree/simpleSchemaToJsonSchema.d.ts.map +1 -0
  1147. package/lib/simple-tree/simpleSchemaToJsonSchema.js +142 -0
  1148. package/lib/simple-tree/simpleSchemaToJsonSchema.js.map +1 -0
  1149. package/lib/simple-tree/toFlexSchema.d.ts +4 -12
  1150. package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
  1151. package/lib/simple-tree/toFlexSchema.js +9 -18
  1152. package/lib/simple-tree/toFlexSchema.js.map +1 -1
  1153. package/lib/simple-tree/toMapTree.d.ts +39 -39
  1154. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  1155. package/lib/simple-tree/toMapTree.js +214 -158
  1156. package/lib/simple-tree/toMapTree.js.map +1 -1
  1157. package/lib/simple-tree/treeNodeValid.d.ts +74 -0
  1158. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -0
  1159. package/lib/simple-tree/{types.js → treeNodeValid.js} +8 -98
  1160. package/lib/simple-tree/treeNodeValid.js.map +1 -0
  1161. package/lib/simple-tree/typesUnsafe.d.ts +35 -4
  1162. package/lib/simple-tree/typesUnsafe.d.ts.map +1 -1
  1163. package/lib/simple-tree/typesUnsafe.js.map +1 -1
  1164. package/lib/simple-tree/viewSchemaToSimpleSchema.d.ts +11 -0
  1165. package/lib/simple-tree/viewSchemaToSimpleSchema.d.ts.map +1 -0
  1166. package/lib/simple-tree/viewSchemaToSimpleSchema.js +167 -0
  1167. package/lib/simple-tree/viewSchemaToSimpleSchema.js.map +1 -0
  1168. package/lib/util/brand.d.ts +0 -3
  1169. package/lib/util/brand.d.ts.map +1 -1
  1170. package/lib/util/brand.js +1 -2
  1171. package/lib/util/brand.js.map +1 -1
  1172. package/lib/util/brandedMap.d.ts +0 -5
  1173. package/lib/util/brandedMap.d.ts.map +1 -1
  1174. package/lib/util/brandedMap.js +0 -1
  1175. package/lib/util/brandedMap.js.map +1 -1
  1176. package/lib/util/idAllocator.d.ts +0 -2
  1177. package/lib/util/idAllocator.d.ts.map +1 -1
  1178. package/lib/util/idAllocator.js +0 -1
  1179. package/lib/util/idAllocator.js.map +1 -1
  1180. package/lib/util/index.d.ts +2 -2
  1181. package/lib/util/index.d.ts.map +1 -1
  1182. package/lib/util/index.js +2 -2
  1183. package/lib/util/index.js.map +1 -1
  1184. package/lib/util/nestedMap.d.ts +5 -19
  1185. package/lib/util/nestedMap.d.ts.map +1 -1
  1186. package/lib/util/nestedMap.js +15 -16
  1187. package/lib/util/nestedMap.js.map +1 -1
  1188. package/lib/util/opaque.d.ts +0 -4
  1189. package/lib/util/opaque.d.ts.map +1 -1
  1190. package/lib/util/opaque.js +0 -2
  1191. package/lib/util/opaque.js.map +1 -1
  1192. package/lib/util/rangeMap.d.ts +0 -2
  1193. package/lib/util/rangeMap.d.ts.map +1 -1
  1194. package/lib/util/rangeMap.js +4 -3
  1195. package/lib/util/rangeMap.js.map +1 -1
  1196. package/lib/util/transactionResult.d.ts +0 -1
  1197. package/lib/util/transactionResult.d.ts.map +1 -1
  1198. package/lib/util/transactionResult.js +0 -1
  1199. package/lib/util/transactionResult.js.map +1 -1
  1200. package/lib/util/typeCheck.d.ts +2 -20
  1201. package/lib/util/typeCheck.d.ts.map +1 -1
  1202. package/lib/util/typeCheck.js.map +1 -1
  1203. package/lib/util/typeCheckTests.d.ts +4 -4
  1204. package/lib/util/typeCheckTests.d.ts.map +1 -1
  1205. package/lib/util/typeCheckTests.js.map +1 -1
  1206. package/lib/util/typeUtils.d.ts +0 -7
  1207. package/lib/util/typeUtils.d.ts.map +1 -1
  1208. package/lib/util/typeUtils.js.map +1 -1
  1209. package/lib/util/utils.d.ts +6 -8
  1210. package/lib/util/utils.d.ts.map +1 -1
  1211. package/lib/util/utils.js +12 -4
  1212. package/lib/util/utils.js.map +1 -1
  1213. package/package.json +25 -24
  1214. package/src/codec/discriminatedUnions.ts +20 -10
  1215. package/src/codec/index.ts +5 -1
  1216. package/src/core/forest/README.md +4 -2
  1217. package/src/core/forest/editableForest.ts +1 -6
  1218. package/src/core/forest/forest.ts +0 -6
  1219. package/src/core/index.ts +2 -2
  1220. package/src/core/rebase/changeRebaser.ts +0 -4
  1221. package/src/core/rebase/index.ts +0 -2
  1222. package/src/core/rebase/types.ts +1 -23
  1223. package/src/core/rebase/utils.ts +13 -11
  1224. package/src/core/schema-stored/multiplicity.ts +0 -1
  1225. package/src/core/schema-stored/schema.ts +0 -7
  1226. package/src/core/schema-stored/storedSchemaRepository.ts +0 -3
  1227. package/src/core/schema-view/view.ts +0 -3
  1228. package/src/core/tree/anchorSet.ts +27 -26
  1229. package/src/core/tree/cursor.ts +1 -6
  1230. package/src/core/tree/delta.ts +0 -11
  1231. package/src/core/tree/detachedFieldIndexCodec.ts +4 -3
  1232. package/src/core/tree/detachedFieldIndexTypes.ts +0 -1
  1233. package/src/core/tree/index.ts +1 -1
  1234. package/src/core/tree/mapTree.ts +45 -4
  1235. package/src/core/tree/pathTree.ts +0 -11
  1236. package/src/core/tree/treeTextFormat.ts +3 -2
  1237. package/src/core/tree/types.ts +0 -11
  1238. package/src/core/tree/visitDelta.ts +2 -3
  1239. package/src/core/tree/visitPath.ts +0 -2
  1240. package/src/core/tree/visitorUtils.ts +0 -1
  1241. package/src/domains/index.ts +3 -0
  1242. package/src/domains/json/index.ts +7 -1
  1243. package/src/domains/json/jsonCursor.ts +113 -6
  1244. package/src/domains/json/jsonDomainSchema.ts +4 -5
  1245. package/src/domains/leafDomain.ts +0 -1
  1246. package/src/domains/schemaBuilder.ts +0 -22
  1247. package/src/events/events.ts +10 -6
  1248. package/src/feature-libraries/chunked-forest/README.md +9 -1
  1249. package/src/feature-libraries/chunked-forest/basicChunk.ts +14 -9
  1250. package/src/feature-libraries/chunked-forest/chunk.ts +1 -1
  1251. package/src/feature-libraries/chunked-forest/chunkTree.ts +4 -4
  1252. package/src/feature-libraries/chunked-forest/chunkedForest.ts +8 -6
  1253. package/src/feature-libraries/chunked-forest/codec/chunkCodecUtilities.ts +2 -2
  1254. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +9 -6
  1255. package/src/feature-libraries/chunked-forest/uniformChunk.ts +6 -4
  1256. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +18 -46
  1257. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +11 -6
  1258. package/src/feature-libraries/default-schema/defaultSchema.ts +0 -1
  1259. package/src/feature-libraries/default-schema/index.ts +1 -1
  1260. package/src/feature-libraries/default-schema/schemaChecker.ts +6 -0
  1261. package/src/feature-libraries/editableTreeBinder.ts +6 -78
  1262. package/src/feature-libraries/fieldGenerator.ts +0 -3
  1263. package/src/feature-libraries/flex-map-tree/index.ts +2 -1
  1264. package/src/feature-libraries/flex-map-tree/mapTreeNode.ts +238 -288
  1265. package/src/feature-libraries/flex-tree/context.ts +0 -1
  1266. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +27 -524
  1267. package/src/feature-libraries/flex-tree/index.ts +1 -18
  1268. package/src/feature-libraries/flex-tree/lazyField.ts +38 -214
  1269. package/src/feature-libraries/flex-tree/lazyNode.ts +3 -215
  1270. package/src/feature-libraries/flex-tree/treeEvents.ts +0 -2
  1271. package/src/feature-libraries/flex-tree/utilities.ts +6 -1
  1272. package/src/feature-libraries/forest-summary/codec.ts +3 -3
  1273. package/src/feature-libraries/index.ts +5 -49
  1274. package/src/feature-libraries/mapTreeCursor.ts +13 -4
  1275. package/src/feature-libraries/memoizedIdRangeAllocator.ts +0 -4
  1276. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +0 -2
  1277. package/src/feature-libraries/modular-schema/discrepancies.ts +117 -1
  1278. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +0 -8
  1279. package/src/feature-libraries/modular-schema/fieldKind.ts +1 -3
  1280. package/src/feature-libraries/modular-schema/genericFieldKind.ts +69 -92
  1281. package/src/feature-libraries/modular-schema/genericFieldKindCodecs.ts +7 -14
  1282. package/src/feature-libraries/modular-schema/genericFieldKindTypes.ts +6 -15
  1283. package/src/feature-libraries/modular-schema/index.ts +2 -2
  1284. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +68 -34
  1285. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +330 -336
  1286. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +7 -14
  1287. package/src/feature-libraries/node-key/nodeKey.ts +0 -4
  1288. package/src/feature-libraries/node-key/nodeKeyManager.ts +0 -1
  1289. package/src/feature-libraries/object-forest/objectForest.ts +1 -13
  1290. package/src/feature-libraries/schemaBuilderBase.ts +1 -49
  1291. package/src/feature-libraries/sequence-field/compose.ts +41 -20
  1292. package/src/feature-libraries/sequence-field/formatV2.ts +3 -3
  1293. package/src/feature-libraries/sequence-field/formatV3.ts +65 -0
  1294. package/src/feature-libraries/sequence-field/helperTypes.ts +33 -0
  1295. package/src/feature-libraries/sequence-field/index.ts +1 -0
  1296. package/src/feature-libraries/sequence-field/invert.ts +28 -18
  1297. package/src/feature-libraries/sequence-field/markQueue.ts +2 -2
  1298. package/src/feature-libraries/sequence-field/moveEffectTable.ts +2 -2
  1299. package/src/feature-libraries/sequence-field/rebase.ts +30 -13
  1300. package/src/feature-libraries/sequence-field/replaceRevisions.ts +27 -3
  1301. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +52 -7
  1302. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +92 -19
  1303. package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +134 -0
  1304. package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +2 -0
  1305. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +8 -2
  1306. package/src/feature-libraries/sequence-field/types.ts +24 -4
  1307. package/src/feature-libraries/sequence-field/utils.ts +78 -50
  1308. package/src/feature-libraries/storedToViewSchema.ts +0 -1
  1309. package/src/feature-libraries/treeCursorUtils.ts +11 -11
  1310. package/src/feature-libraries/treeTextCursor.ts +0 -2
  1311. package/src/feature-libraries/typed-schema/flexList.ts +0 -3
  1312. package/src/feature-libraries/typed-schema/index.ts +0 -2
  1313. package/src/feature-libraries/typed-schema/schemaCollection.ts +0 -5
  1314. package/src/feature-libraries/typed-schema/typedTreeSchema.ts +2 -68
  1315. package/src/feature-libraries/typed-schema/view.ts +0 -1
  1316. package/src/index.ts +32 -242
  1317. package/src/internalTypes.ts +1 -0
  1318. package/src/packageVersion.ts +1 -1
  1319. package/src/shared-tree/schematizeTree.ts +25 -21
  1320. package/src/shared-tree/schematizingTreeView.ts +6 -6
  1321. package/src/shared-tree/sharedTree.ts +8 -39
  1322. package/src/shared-tree/sharedTreeChangeCodecs.ts +8 -0
  1323. package/src/shared-tree/sharedTreeChangeFamily.ts +3 -3
  1324. package/src/shared-tree/sharedTreeEditBuilder.ts +0 -2
  1325. package/src/shared-tree/treeApi.ts +3 -3
  1326. package/src/shared-tree/treeCheckout.ts +6 -8
  1327. package/src/shared-tree/treeView.ts +3 -6
  1328. package/src/shared-tree-core/branch.ts +20 -8
  1329. package/src/shared-tree-core/defaultResubmitMachine.ts +4 -4
  1330. package/src/shared-tree-core/editManagerCodecs.ts +1 -0
  1331. package/src/shared-tree-core/editManagerFormat.ts +7 -2
  1332. package/src/shared-tree-core/messageCodecs.ts +2 -1
  1333. package/src/shared-tree-core/sharedTreeCore.ts +5 -3
  1334. package/src/simple-tree/ProxyBinding.md +2 -0
  1335. package/src/simple-tree/api/README.md +7 -0
  1336. package/src/simple-tree/api/create.ts +179 -0
  1337. package/src/simple-tree/api/index.ts +36 -0
  1338. package/src/simple-tree/{schemaCreationUtilities.ts → api/schemaCreationUtilities.ts} +13 -5
  1339. package/src/simple-tree/{schemaFactory.ts → api/schemaFactory.ts} +36 -34
  1340. package/src/simple-tree/{schemaFactoryRecursive.ts → api/schemaFactoryRecursive.ts} +47 -10
  1341. package/src/simple-tree/{testRecursiveDomain.ts → api/testRecursiveDomain.ts} +3 -1
  1342. package/src/simple-tree/{tree.ts → api/tree.ts} +246 -34
  1343. package/src/simple-tree/{treeNodeApi.ts → api/treeNodeApi.ts} +84 -41
  1344. package/src/simple-tree/api/verboseTree.ts +415 -0
  1345. package/src/simple-tree/arrayNode.ts +103 -110
  1346. package/src/simple-tree/core/README.md +11 -0
  1347. package/src/simple-tree/core/index.ts +34 -0
  1348. package/src/simple-tree/{schemaCaching.ts → core/schemaCaching.ts} +3 -37
  1349. package/src/simple-tree/core/treeNodeKernel.ts +200 -0
  1350. package/src/simple-tree/core/treeNodeSchema.ts +184 -0
  1351. package/src/simple-tree/core/types.ts +281 -0
  1352. package/src/simple-tree/core/withType.ts +89 -0
  1353. package/src/simple-tree/getJsonSchema.ts +70 -0
  1354. package/src/simple-tree/getSimpleFieldSchema.ts +36 -0
  1355. package/src/simple-tree/getSimpleSchema.ts +69 -0
  1356. package/src/simple-tree/index.ts +59 -33
  1357. package/src/simple-tree/jsonSchema.ts +230 -0
  1358. package/src/simple-tree/leafNodeSchema.ts +6 -3
  1359. package/src/simple-tree/mapNode.ts +56 -55
  1360. package/src/simple-tree/objectNode.ts +66 -90
  1361. package/src/simple-tree/objectNodeTypes.ts +68 -0
  1362. package/src/simple-tree/proxies.ts +52 -68
  1363. package/src/simple-tree/proxyBinding.ts +127 -72
  1364. package/src/simple-tree/schemaTypes.ts +29 -194
  1365. package/src/simple-tree/simpleSchema.ts +138 -0
  1366. package/src/simple-tree/simpleSchemaToJsonSchema.ts +178 -0
  1367. package/src/simple-tree/toFlexSchema.ts +9 -42
  1368. package/src/simple-tree/toMapTree.ts +270 -296
  1369. package/src/simple-tree/{types.ts → treeNodeValid.ts} +16 -232
  1370. package/src/simple-tree/typesUnsafe.ts +51 -5
  1371. package/src/simple-tree/viewSchemaToSimpleSchema.ts +209 -0
  1372. package/src/util/brand.ts +1 -4
  1373. package/src/util/brandedMap.ts +0 -5
  1374. package/src/util/idAllocator.ts +0 -2
  1375. package/src/util/index.ts +2 -0
  1376. package/src/util/nestedMap.ts +23 -20
  1377. package/src/util/opaque.ts +0 -4
  1378. package/src/util/rangeMap.ts +5 -5
  1379. package/src/util/transactionResult.ts +0 -1
  1380. package/src/util/typeCheck.ts +2 -20
  1381. package/src/util/typeCheckTests.ts +4 -4
  1382. package/src/util/typeUtils.ts +0 -7
  1383. package/src/util/utils.ts +13 -8
  1384. package/tsconfig.json +0 -1
  1385. package/dist/feature-libraries/contextuallyTyped.d.ts +0 -209
  1386. package/dist/feature-libraries/contextuallyTyped.d.ts.map +0 -1
  1387. package/dist/feature-libraries/contextuallyTyped.js +0 -328
  1388. package/dist/feature-libraries/contextuallyTyped.js.map +0 -1
  1389. package/dist/feature-libraries/schema-aware/index.d.ts +0 -6
  1390. package/dist/feature-libraries/schema-aware/index.d.ts.map +0 -1
  1391. package/dist/feature-libraries/schema-aware/index.js.map +0 -1
  1392. package/dist/feature-libraries/schema-aware/schemaAware.d.ts +0 -76
  1393. package/dist/feature-libraries/schema-aware/schemaAware.d.ts.map +0 -1
  1394. package/dist/feature-libraries/schema-aware/schemaAware.js.map +0 -1
  1395. package/dist/simple-tree/nodeKeys.d.ts +0 -41
  1396. package/dist/simple-tree/nodeKeys.d.ts.map +0 -1
  1397. package/dist/simple-tree/nodeKeys.js +0 -7
  1398. package/dist/simple-tree/nodeKeys.js.map +0 -1
  1399. package/dist/simple-tree/schemaCaching.d.ts.map +0 -1
  1400. package/dist/simple-tree/schemaCaching.js.map +0 -1
  1401. package/dist/simple-tree/schemaCreationUtilities.d.ts.map +0 -1
  1402. package/dist/simple-tree/schemaCreationUtilities.js.map +0 -1
  1403. package/dist/simple-tree/schemaFactory.d.ts.map +0 -1
  1404. package/dist/simple-tree/schemaFactory.js.map +0 -1
  1405. package/dist/simple-tree/schemaFactoryRecursive.d.ts.map +0 -1
  1406. package/dist/simple-tree/schemaFactoryRecursive.js.map +0 -1
  1407. package/dist/simple-tree/testRecursiveDomain.d.ts +0 -61
  1408. package/dist/simple-tree/testRecursiveDomain.d.ts.map +0 -1
  1409. package/dist/simple-tree/testRecursiveDomain.js.map +0 -1
  1410. package/dist/simple-tree/tree.d.ts.map +0 -1
  1411. package/dist/simple-tree/tree.js +0 -73
  1412. package/dist/simple-tree/tree.js.map +0 -1
  1413. package/dist/simple-tree/treeNodeApi.d.ts.map +0 -1
  1414. package/dist/simple-tree/treeNodeApi.js.map +0 -1
  1415. package/dist/simple-tree/treeNodeKernel.d.ts +0 -26
  1416. package/dist/simple-tree/treeNodeKernel.d.ts.map +0 -1
  1417. package/dist/simple-tree/treeNodeKernel.js +0 -83
  1418. package/dist/simple-tree/treeNodeKernel.js.map +0 -1
  1419. package/dist/simple-tree/types.d.ts.map +0 -1
  1420. package/dist/simple-tree/types.js.map +0 -1
  1421. package/lib/feature-libraries/contextuallyTyped.d.ts +0 -209
  1422. package/lib/feature-libraries/contextuallyTyped.d.ts.map +0 -1
  1423. package/lib/feature-libraries/contextuallyTyped.js +0 -311
  1424. package/lib/feature-libraries/contextuallyTyped.js.map +0 -1
  1425. package/lib/feature-libraries/schema-aware/index.d.ts +0 -6
  1426. package/lib/feature-libraries/schema-aware/index.d.ts.map +0 -1
  1427. package/lib/feature-libraries/schema-aware/index.js +0 -6
  1428. package/lib/feature-libraries/schema-aware/index.js.map +0 -1
  1429. package/lib/feature-libraries/schema-aware/schemaAware.d.ts +0 -76
  1430. package/lib/feature-libraries/schema-aware/schemaAware.d.ts.map +0 -1
  1431. package/lib/feature-libraries/schema-aware/schemaAware.js.map +0 -1
  1432. package/lib/simple-tree/nodeKeys.d.ts +0 -41
  1433. package/lib/simple-tree/nodeKeys.d.ts.map +0 -1
  1434. package/lib/simple-tree/nodeKeys.js.map +0 -1
  1435. package/lib/simple-tree/schemaCaching.d.ts.map +0 -1
  1436. package/lib/simple-tree/schemaCaching.js.map +0 -1
  1437. package/lib/simple-tree/schemaCreationUtilities.d.ts.map +0 -1
  1438. package/lib/simple-tree/schemaCreationUtilities.js.map +0 -1
  1439. package/lib/simple-tree/schemaFactory.d.ts.map +0 -1
  1440. package/lib/simple-tree/schemaFactory.js.map +0 -1
  1441. package/lib/simple-tree/schemaFactoryRecursive.d.ts.map +0 -1
  1442. package/lib/simple-tree/schemaFactoryRecursive.js.map +0 -1
  1443. package/lib/simple-tree/testRecursiveDomain.d.ts +0 -61
  1444. package/lib/simple-tree/testRecursiveDomain.d.ts.map +0 -1
  1445. package/lib/simple-tree/testRecursiveDomain.js.map +0 -1
  1446. package/lib/simple-tree/tree.d.ts.map +0 -1
  1447. package/lib/simple-tree/tree.js +0 -66
  1448. package/lib/simple-tree/tree.js.map +0 -1
  1449. package/lib/simple-tree/treeNodeApi.d.ts.map +0 -1
  1450. package/lib/simple-tree/treeNodeApi.js.map +0 -1
  1451. package/lib/simple-tree/treeNodeKernel.d.ts +0 -26
  1452. package/lib/simple-tree/treeNodeKernel.d.ts.map +0 -1
  1453. package/lib/simple-tree/treeNodeKernel.js +0 -79
  1454. package/lib/simple-tree/treeNodeKernel.js.map +0 -1
  1455. package/lib/simple-tree/types.d.ts.map +0 -1
  1456. package/lib/simple-tree/types.js.map +0 -1
  1457. package/src/feature-libraries/contextuallyTyped.ts +0 -582
  1458. package/src/feature-libraries/schema-aware/README.md +0 -19
  1459. package/src/feature-libraries/schema-aware/index.ts +0 -16
  1460. package/src/feature-libraries/schema-aware/schemaAware.ts +0 -135
  1461. package/src/simple-tree/nodeKeys.ts +0 -42
  1462. package/src/simple-tree/treeNodeKernel.ts +0 -91
  1463. /package/dist/simple-tree/{testRecursiveDomain.js → api/testRecursiveDomain.js} +0 -0
  1464. /package/lib/simple-tree/{testRecursiveDomain.js → api/testRecursiveDomain.js} +0 -0
@@ -10,6 +10,7 @@ const internal_2 = require("@fluidframework/telemetry-utils/internal");
10
10
  const index_js_1 = require("../core/index.js");
11
11
  const index_js_2 = require("../events/index.js");
12
12
  const transactionStack_js_1 = require("./transactionStack.js");
13
+ const index_js_3 = require("../util/index.js");
13
14
  /**
14
15
  * Returns the operation that caused the given {@link SharedTreeBranchChange}.
15
16
  */
@@ -27,6 +28,8 @@ function getChangeReplaceType(change) {
27
28
  // └─ B' (branch Y) └─ (branch Y)
28
29
  //
29
30
  // B' is removed and replaced by B because both have the same revision.
31
+ (0, internal_1.assert)(change.removedCommits[0] !== undefined, 0x9e4 /* This wont run due to the length check above */);
32
+ (0, internal_1.assert)(change.newCommits[0] !== undefined, 0x9e5 /* This wont run because a replace operation always has new commits */);
30
33
  if (change.removedCommits.length === 1 &&
31
34
  change.removedCommits[0].revision === change.newCommits[0].revision) {
32
35
  return "rebase";
@@ -200,8 +203,9 @@ class SharedTreeBranch extends index_js_2.EventEmitter {
200
203
  const inverses = [];
201
204
  for (let i = commits.length - 1; i >= 0; i--) {
202
205
  const revision = this.mintRevisionTag();
203
- const inverse = this.changeFamily.rebaser.changeRevision(this.changeFamily.rebaser.invert(commits[i], false), revision, commits[i].revision);
204
- inverses.push((0, index_js_1.tagRollbackInverse)(inverse, revision, commits[i].revision));
206
+ const commit = commits[i] ?? (0, index_js_3.fail)("This wont run because we are iterating through commits");
207
+ const inverse = this.changeFamily.rebaser.changeRevision(this.changeFamily.rebaser.invert(commit, false), revision, commit.revision);
208
+ inverses.push((0, index_js_1.tagRollbackInverse)(inverse, revision, commit.revision));
205
209
  }
206
210
  const change = inverses.length > 0 ? this.changeFamily.rebaser.compose(inverses) : undefined;
207
211
  const changeEvent = {
@@ -225,8 +229,7 @@ class SharedTreeBranch extends index_js_2.EventEmitter {
225
229
  const { startRevision: startRevisionOriginal } = this.transactions.pop();
226
230
  let startRevision = startRevisionOriginal;
227
231
  while (this.initialTransactionRevToRebasedRev.has(startRevision)) {
228
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
229
- startRevision = this.initialTransactionRevToRebasedRev.get(startRevision);
232
+ startRevision = this.initialTransactionRevToRebasedRev.get(startRevision) ?? (0, internal_1.oob)();
230
233
  }
231
234
  if (!this.isTransacting()) {
232
235
  this.initialTransactionRevToRebasedRev.clear();
@@ -268,8 +271,10 @@ class SharedTreeBranch extends index_js_2.EventEmitter {
268
271
  const { deletedSourceCommits, targetCommits, sourceCommits } = commits;
269
272
  const newCommits = targetCommits.concat(sourceCommits);
270
273
  if (this.isTransacting()) {
271
- const src = targetCommits[0].parent?.revision;
272
- const dst = targetCommits[targetCommits.length - 1].revision;
274
+ const firstCommit = targetCommits[0] ?? (0, internal_1.oob)();
275
+ const lastCommit = targetCommits[targetCommits.length - 1] ?? (0, internal_1.oob)();
276
+ const src = firstCommit.parent?.revision;
277
+ const dst = lastCommit.revision;
273
278
  if (src !== undefined && dst !== undefined) {
274
279
  this.initialTransactionRevToRebasedRev.set(src, dst);
275
280
  }
@@ -1 +1 @@
1
- {"version":3,"file":"branch.js","sourceRoot":"","sources":["../../src/shared-tree-core/branch.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAC7D,uEAA+F;AAE/F,+CAgB0B;AAC1B,iDAAmE;AAEnE,+DAAyD;AAmCzD;;GAEG;AACH,SAAgB,oBAAoB,CACnC,MAA6D;IAE7D,uHAAuH;IACvH,oGAAoG;IACpG,2DAA2D;IAC3D,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1E,OAAO,QAAQ,CAAC;IACjB,CAAC;IAED,iGAAiG;IACjG,0FAA0F;IAC1F,EAAE;IACF,+DAA+D;IAC/D,gEAAgE;IAChE,EAAE;IACF,uEAAuE;IACvE,IACC,MAAM,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC;QAClC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAK,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,EAClE,CAAC;QACF,OAAO,QAAQ,CAAC;IACjB,CAAC;IAED,OAAO,mBAAmB,CAAC;AAC5B,CAAC;AAzBD,oDAyBC;AAiFD;;GAEG;AACH,MAAa,gBAGX,SAAQ,uBAAsD;IA4B/D;;;;;;OAMG;IACH,YACS,IAA0B,EAClB,YAA4C,EAC3C,eAAkC,EAClC,aAAgD,EAChD,qBAEhB;QAED,KAAK,EAAE,CAAC;QARA,SAAI,GAAJ,IAAI,CAAsB;QAClB,iBAAY,GAAZ,YAAY,CAAgC;QAC3C,oBAAe,GAAf,eAAe,CAAmB;QAClC,kBAAa,GAAb,aAAa,CAAmC;QAChD,0BAAqB,GAArB,qBAAqB,CAErC;QAxCe,iBAAY,GAA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AAC;QAE1F,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,aAAa,EAAE,CAAC;YACxC,OAAO,SAAS,CAAC;QAClB,CAAC;QAED,OAAO,MAAM,CAAC;IACf,CAAC;IAED;;;;;;;OAOG;IACI,OAAO;QACb,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,OAAO;QACR,CAAC;QAED,OAAO,IAAI,CAAC,aAAa,EAAE,EAAE,CAAC;YAC7B,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACzB,CAAC;QAED,IAAI,CAAC,wBAAwB,EAAE,EAAE,CAAC;QAElC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACtB,CAAC;IAEO,iBAAiB;QACxB,IAAA,iBAAM,EAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;IACxD,CAAC;CACD;AAraD,4CAqaC;AAED;;;;;;;GAOG;AACH,SAAgB,gBAAgB,CAC/B,QAAW,EACX,MAAyB;IAEzB,MAAM,IAAI,GAAmB,EAAE,CAAC;IAChC,IAAI,CAAC,IAAI,CACR,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;QAC5B,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,CAAC;IACd,CAAC,CAAC,CACF,CAAC;IACF,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;AAC3C,CAAC;AAZD,4CAYC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { type TelemetryEventBatcher, measure } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype BranchRebaseResult,\n\ttype ChangeFamily,\n\ttype ChangeFamilyEditor,\n\tCommitKind,\n\ttype CommitMetadata,\n\ttype GraphCommit,\n\ttype RevisionTag,\n\ttype TaggedChange,\n\tfindAncestor,\n\tmakeAnonChange,\n\tmintCommit,\n\trebaseBranch,\n\ttagChange,\n\ttagRollbackInverse,\n\ttype RebaseStatsWithDuration,\n} from \"../core/index.js\";\nimport { EventEmitter, type Listenable } from \"../events/index.js\";\n\nimport { TransactionStack } from \"./transactionStack.js\";\n\n/**\n * Describes a change to a `SharedTreeBranch`. Various operations can mutate the head of the branch;\n * this change format describes each in terms of the \"removed commits\" (all commits which were present\n * on the branch before the operation but are no longer present after) and the \"new commits\" (all\n * commits which are present on the branch after the operation that were not present before). Each of\n * the following event types also provides a `change` which contains the net change to the branch\n * (or is undefined if there was no net change):\n * * Append - when one or more commits are appended to the head of the branch, for example via\n * a change applied by the branch's editor, or as a result of merging another branch into this one\n * * Remove - when one or more commits are removed from the head of the branch. This occurs\n * when a transaction is aborted and all commits pending in that transaction are removed.\n * * Replace - when an operation simultaneously removes and appends commits. For example, when this\n * branch is rebased and some commits are removed and replaced with rebased versions, or when a\n * transaction completes and all pending commits are replaced with a single squash commit.\n */\nexport type SharedTreeBranchChange<TChange> =\n\t| {\n\t\t\ttype: \"append\";\n\t\t\tchange: TaggedChange<TChange>;\n\t\t\tnewCommits: readonly GraphCommit<TChange>[];\n\t }\n\t| {\n\t\t\ttype: \"remove\";\n\t\t\tchange: TaggedChange<TChange> | undefined;\n\t\t\tremovedCommits: readonly GraphCommit<TChange>[];\n\t }\n\t| {\n\t\t\ttype: \"replace\";\n\t\t\tchange: TaggedChange<TChange> | undefined;\n\t\t\tremovedCommits: readonly GraphCommit<TChange>[];\n\t\t\tnewCommits: readonly GraphCommit<TChange>[];\n\t };\n\n/**\n * Returns the operation that caused the given {@link SharedTreeBranchChange}.\n */\nexport function getChangeReplaceType(\n\tchange: SharedTreeBranchChange<unknown> & { type: \"replace\" },\n): \"transactionCommit\" | \"rebase\" {\n\t// The \"replace\" variant of the change event is emitted by two operations: committing a transaction and doing a rebase.\n\t// Committing a transaction will always remove one or more commits (the commits that were squashed),\n\t// and will add exactly one new commit (the squash commit).\n\tif (change.removedCommits.length === 0 || change.newCommits.length !== 1) {\n\t\treturn \"rebase\";\n\t}\n\n\t// There is only one case in which a rebase both removes commits and adds exactly one new commit.\n\t// This occurs when there is exactly one divergent, but equivalent, commit on each branch:\n\t//\n\t// A ─ B (branch X)\t -- rebase Y onto X --> A ─ B (branch X)\n\t// └─ B' (branch Y) └─ (branch Y)\n\t//\n\t// B' is removed and replaced by B because both have the same revision.\n\tif (\n\t\tchange.removedCommits.length === 1 &&\n\t\tchange.removedCommits[0].revision === change.newCommits[0].revision\n\t) {\n\t\treturn \"rebase\";\n\t}\n\n\treturn \"transactionCommit\";\n}\n\n/**\n * The events emitted by a `SharedTreeBranch`\n */\nexport interface SharedTreeBranchEvents<TEditor extends ChangeFamilyEditor, TChange>\n\textends BranchTrimmingEvents {\n\t/**\n\t * Fired just before the head of this branch changes.\n\t * @param change - the change to this branch's state and commits\n\t */\n\tbeforeChange(change: SharedTreeBranchChange<TChange>): void;\n\n\t/**\n\t * Fired just after the head of this branch changes.\n\t * @param change - the change to this branch's state and commits\n\t */\n\tafterChange(change: SharedTreeBranchChange<TChange>): void;\n\n\t/**\n\t * {@inheritdoc TreeViewEvents.commitApplied}\n\t */\n\tcommitApplied(data: CommitMetadata): void;\n\n\t/**\n\t * Fired when this branch forks\n\t * @param fork - the new branch that forked off of this branch\n\t */\n\tfork(fork: SharedTreeBranch<TEditor, TChange>): void;\n\n\t/**\n\t * Fired after this branch is disposed\n\t */\n\tdispose(): void;\n\n\t/**\n\t * Fired after a new transaction is started.\n\t * @param isOuterTransaction - true iff the transaction being started is the outermost transaction\n\t * as opposed to a nested transaction.\n\t */\n\ttransactionStarted(isOuterTransaction: boolean): void;\n\n\t/**\n\t * Fired after the current transaction is aborted.\n\t * @param isOuterTransaction - true iff the transaction being aborted is the outermost transaction\n\t * as opposed to a nested transaction.\n\t */\n\ttransactionAborted(isOuterTransaction: boolean): void;\n\n\t/**\n\t * Fired after the current transaction is completely rolled back.\n\t * @param isOuterTransaction - true iff the transaction being aborted is the outermost transaction\n\t * as opposed to a nested transaction.\n\t */\n\ttransactionRolledBack(isOuterTransaction: boolean): void;\n\n\t/**\n\t * Fired after the current transaction is committed.\n\t * @param isOuterTransaction - true iff the transaction being committed is the outermost transaction\n\t * as opposed to a nested transaction.\n\t */\n\ttransactionCommitted(isOuterTransaction: boolean): void;\n}\n\n/**\n * Events related to branch trimming.\n *\n * @remarks\n * Trimming is a very specific kind of mutation which is the only allowed mutations to branches.\n * References to commits from other commits are removed so that the commit objects can be GC'd by the JS engine.\n * This happens by changing a commit's parent property to undefined, which drops all commits that are in its \"ancestry\".\n * It is done as a performance optimization when it is determined that commits are no longer needed for future computation.\n */\nexport interface BranchTrimmingEvents {\n\t/**\n\t * Fired when some contiguous range of commits beginning with the \"global tail\" of this branch are trimmed from the branch.\n\t * This happens by deleting the parent pointer to the last commit in that range. This event can be fired at any time.\n\t */\n\tancestryTrimmed(trimmedRevisions: RevisionTag[]): void;\n}\n\n/**\n * A branch of changes that can be applied to a SharedTree.\n */\nexport class SharedTreeBranch<\n\tTEditor extends ChangeFamilyEditor,\n\tTChange,\n> extends EventEmitter<SharedTreeBranchEvents<TEditor, TChange>> {\n\tpublic readonly editor: TEditor;\n\tprivate readonly transactions = new TransactionStack();\n\t/**\n\t * After pushing a starting revision to the transaction stack, this branch might be rebased\n\t * over commits which are children of that starting revision. When the transaction is committed,\n\t * those rebased-over commits should not be included in the transaction's squash commit, even though\n\t * they exist between the starting revision and the final commit within the transaction.\n\t *\n\t * Whenever `rebaseOnto` is called during a transaction, this map is augmented with an entry from the\n\t * original merge-base to the new merge-base.\n\t *\n\t * This state need only be retained for the lifetime of the transaction.\n\t *\n\t * TODO: This strategy might need to be revisited when adding better support for async transactions.\n\t * Since:\n\t *\n\t * 1. Transactionality is guaranteed primarily by squashing at commit time\n\t * 2. Branches may be rebased with an ongoing transaction\n\t *\n\t * a rebase operation might invalidate only a portion of a transaction's commits, thus defeating the\n\t * purpose of transactionality.\n\t *\n\t * AB#6483 and children items track this work.\n\t */\n\tprivate readonly initialTransactionRevToRebasedRev = new Map<RevisionTag, RevisionTag>();\n\tprivate disposed = false;\n\tprivate readonly unsubscribeBranchTrimmer?: () => void;\n\t/**\n\t * Construct a new branch.\n\t * @param head - the head of the branch\n\t * @param changeFamily - determines the set of changes that this branch can commit\n\t * @param branchTrimmer - an optional event emitter that informs the branch it has been trimmed. If this is not supplied, then the branch must\n\t * never be trimmed. See {@link BranchTrimmingEvents} for details on trimming.\n\t */\n\tpublic constructor(\n\t\tprivate head: GraphCommit<TChange>,\n\t\tpublic readonly changeFamily: ChangeFamily<TEditor, TChange>,\n\t\tprivate readonly mintRevisionTag: () => RevisionTag,\n\t\tprivate readonly branchTrimmer?: Listenable<BranchTrimmingEvents>,\n\t\tprivate readonly telemetryEventBatcher?: TelemetryEventBatcher<\n\t\t\tkeyof RebaseStatsWithDuration\n\t\t>,\n\t) {\n\t\tsuper();\n\t\tthis.editor = this.changeFamily.buildEditor((change) =>\n\t\t\tthis.apply(change, mintRevisionTag()),\n\t\t);\n\t\tthis.unsubscribeBranchTrimmer = branchTrimmer?.on(\"ancestryTrimmed\", (commit) => {\n\t\t\tthis.emit(\"ancestryTrimmed\", commit);\n\t\t});\n\t}\n\n\t/**\n\t * Sets the head of this branch. Emits no change events.\n\t */\n\tpublic setHead(head: GraphCommit<TChange>): void {\n\t\tthis.assertNotDisposed();\n\t\tassert(!this.isTransacting(), 0x685 /* Cannot set head during a transaction */);\n\t\tthis.head = head;\n\t}\n\n\t/**\n\t * Apply a change to this branch.\n\t * @param change - the change to apply\n\t * @param revision - the revision of the new head commit of the branch that contains `change`\n\t * @param changeKind - the kind of change to apply\n\t * @returns the change that was applied and the new head commit of the branch\n\t */\n\tpublic apply(\n\t\tchange: TChange,\n\t\trevision: RevisionTag,\n\t\tchangeKind: CommitKind = CommitKind.Default,\n\t): [change: TChange, newCommit: GraphCommit<TChange>] {\n\t\tthis.assertNotDisposed();\n\n\t\t// TODO: This should not be necessary when receiving changes from other clients.\n\t\tconst changeWithRevision = this.changeFamily.rebaser.changeRevision(change, revision);\n\n\t\tconst newHead = mintCommit(this.head, {\n\t\t\trevision,\n\t\t\tchange: changeWithRevision,\n\t\t});\n\n\t\tconst changeEvent = {\n\t\t\ttype: \"append\",\n\t\t\tchange: tagChange(changeWithRevision, revision),\n\t\t\tnewCommits: [newHead],\n\t\t} as const;\n\n\t\tthis.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = newHead;\n\n\t\t// If this is not part of a transaction, emit a commitApplied event\n\t\tif (!this.isTransacting()) {\n\t\t\tthis.emit(\"commitApplied\", { isLocal: true, kind: changeKind });\n\t\t}\n\n\t\tthis.emit(\"afterChange\", changeEvent);\n\t\treturn [changeWithRevision, newHead];\n\t}\n\n\t/**\n\t * @returns the commit at the head of this branch.\n\t */\n\tpublic getHead(): GraphCommit<TChange> {\n\t\treturn this.head;\n\t}\n\n\t/**\n\t * Begin a transaction on this branch. If the transaction is committed via {@link commitTransaction},\n\t * all commits made since this call will be squashed into a single head commit.\n\t */\n\tpublic startTransaction(): void {\n\t\tthis.assertNotDisposed();\n\t\tconst forks = new Set<SharedTreeBranch<TEditor, TChange>>();\n\t\tconst onDisposeUnSubscribes: (() => void)[] = [];\n\t\tconst onForkUnSubscribe = onForkTransitive(this, (fork) => {\n\t\t\tforks.add(fork);\n\t\t\tonDisposeUnSubscribes.push(fork.on(\"dispose\", () => forks.delete(fork)));\n\t\t});\n\t\tthis.transactions.push(this.head.revision, () => {\n\t\t\tforks.forEach((fork) => fork.dispose());\n\t\t\tonDisposeUnSubscribes.forEach((unsubscribe) => unsubscribe());\n\t\t\tonForkUnSubscribe();\n\t\t});\n\t\tthis.editor.enterTransaction();\n\t\tthis.emit(\"transactionStarted\", this.transactions.size === 1);\n\t}\n\n\t/**\n\t * Commit the current transaction. There must be a transaction in progress that was begun via {@link startTransaction}.\n\t * If there are commits in the current transaction, they will be squashed into a new single head commit.\n\t * @returns the commits that were squashed and the new squash commit if a squash occurred, otherwise `undefined`.\n\t * @remarks If the transaction had no changes applied during its lifetime, then no squash occurs (i.e. this method is a no-op).\n\t * Even if the transaction contained only one change, it will still be replaced with an (equivalent) squash change.\n\t */\n\tpublic commitTransaction():\n\t\t| [squashedCommits: GraphCommit<TChange>[], newCommit: GraphCommit<TChange>]\n\t\t| undefined {\n\t\tthis.assertNotDisposed();\n\t\tconst [startCommit, commits] = this.popTransaction();\n\t\tthis.editor.exitTransaction();\n\n\t\tthis.emit(\"transactionCommitted\", this.transactions.size === 0);\n\t\tif (commits.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Squash the changes and make the squash commit the new head of this branch\n\t\tconst squashedChange = this.changeFamily.rebaser.compose(commits);\n\t\tconst revision = this.mintRevisionTag();\n\n\t\tconst newHead = mintCommit(startCommit, {\n\t\t\trevision,\n\t\t\tchange: this.changeFamily.rebaser.changeRevision(squashedChange, revision),\n\t\t});\n\n\t\tconst changeEvent = {\n\t\t\ttype: \"replace\",\n\t\t\tchange: undefined,\n\t\t\tremovedCommits: commits,\n\t\t\tnewCommits: [newHead],\n\t\t} as const;\n\n\t\tthis.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = newHead;\n\n\t\t// If this transaction is not nested, emit a commitApplied event\n\t\tif (!this.isTransacting()) {\n\t\t\tthis.emit(\"commitApplied\", { isLocal: true, kind: CommitKind.Default });\n\t\t}\n\n\t\tthis.emit(\"afterChange\", changeEvent);\n\t\treturn [commits, newHead];\n\t}\n\n\t/**\n\t * Cancel the current transaction. There must be a transaction in progress that was begun via\n\t * {@link startTransaction}. All commits made during the transaction will be removed.\n\t * @returns the change to this branch resulting in the removal of the commits, and a list of the\n\t * commits that were removed.\n\t */\n\tpublic abortTransaction(): [\n\t\tchange: TChange | undefined,\n\t\tabortedCommits: GraphCommit<TChange>[],\n\t] {\n\t\tthis.assertNotDisposed();\n\t\tconst [startCommit, commits] = this.popTransaction();\n\t\tthis.editor.exitTransaction();\n\n\t\tthis.emit(\"transactionAborted\", this.transactions.size === 0);\n\t\tif (commits.length === 0) {\n\t\t\tthis.emit(\"transactionRolledBack\", this.transactions.size === 0);\n\t\t\treturn [undefined, []];\n\t\t}\n\n\t\tconst inverses: TaggedChange<TChange>[] = [];\n\t\tfor (let i = commits.length - 1; i >= 0; i--) {\n\t\t\tconst revision = this.mintRevisionTag();\n\t\t\tconst inverse = this.changeFamily.rebaser.changeRevision(\n\t\t\t\tthis.changeFamily.rebaser.invert(commits[i], false),\n\t\t\t\trevision,\n\t\t\t\tcommits[i].revision,\n\t\t\t);\n\n\t\t\tinverses.push(tagRollbackInverse(inverse, revision, commits[i].revision));\n\t\t}\n\t\tconst change =\n\t\t\tinverses.length > 0 ? this.changeFamily.rebaser.compose(inverses) : undefined;\n\n\t\tconst changeEvent = {\n\t\t\ttype: \"remove\",\n\t\t\tchange: change === undefined ? undefined : makeAnonChange(change),\n\t\t\tremovedCommits: commits,\n\t\t} as const;\n\n\t\tthis.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = startCommit;\n\t\tthis.emit(\"afterChange\", changeEvent);\n\t\tthis.emit(\"transactionRolledBack\", this.transactions.size === 0);\n\t\treturn [change, commits];\n\t}\n\n\t/**\n\t * True iff this branch is in the middle of a transaction that was begin via {@link startTransaction}\n\t */\n\tpublic isTransacting(): boolean {\n\t\treturn this.transactions.size !== 0;\n\t}\n\n\tprivate popTransaction(): [GraphCommit<TChange>, GraphCommit<TChange>[]] {\n\t\tconst { startRevision: startRevisionOriginal } = this.transactions.pop();\n\t\tlet startRevision = startRevisionOriginal;\n\t\twhile (this.initialTransactionRevToRebasedRev.has(startRevision)) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tstartRevision = this.initialTransactionRevToRebasedRev.get(startRevision)!;\n\t\t}\n\n\t\tif (!this.isTransacting()) {\n\t\t\tthis.initialTransactionRevToRebasedRev.clear();\n\t\t}\n\n\t\tconst commits: GraphCommit<TChange>[] = [];\n\t\tconst startCommit = findAncestor(\n\t\t\t[this.head, commits],\n\t\t\t(c) => c.revision === startRevision,\n\t\t);\n\t\tassert(\n\t\t\tstartCommit !== undefined,\n\t\t\t0x593 /* Expected branch to be ahead of transaction start revision */,\n\t\t);\n\t\treturn [startCommit, commits];\n\t}\n\n\t/**\n\t * Spawn a new branch that is based off of the current state of this branch.\n\t * Changes made to the new branch will not be applied to this branch until the new branch is merged back in.\n\t *\n\t * @remarks Forks created during a transaction will be disposed when the transaction ends.\n\t */\n\tpublic fork(): SharedTreeBranch<TEditor, TChange> {\n\t\tthis.assertNotDisposed();\n\t\tconst fork = new SharedTreeBranch(\n\t\t\tthis.head,\n\t\t\tthis.changeFamily,\n\t\t\tthis.mintRevisionTag,\n\t\t\tthis.branchTrimmer,\n\t\t);\n\t\tthis.emit(\"fork\", fork);\n\t\treturn fork;\n\t}\n\n\t/**\n\t * Rebase the changes that have been applied to this branch over divergent changes in the given branch.\n\t * After this operation completes, this branch will be based off of `branch`.\n\t *\n\t * @param branch - the branch to rebase onto\n\t * @param upTo - the furthest commit on `branch` over which to rebase (inclusive). Defaults to the head commit of `branch`.\n\t * @returns the result of the rebase or undefined if nothing changed\n\t */\n\tpublic rebaseOnto(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t\tupTo = branch.getHead(),\n\t): BranchRebaseResult<TChange> | undefined {\n\t\tthis.assertNotDisposed();\n\n\t\t// Rebase this branch onto the given branch\n\t\tconst rebaseResult = this.rebaseBranch(this, branch, upTo);\n\t\tif (rebaseResult === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// The net change to this branch is provided by the `rebaseBranch` API\n\t\tconst { newSourceHead, commits } = rebaseResult;\n\t\tconst { deletedSourceCommits, targetCommits, sourceCommits } = commits;\n\n\t\tconst newCommits = targetCommits.concat(sourceCommits);\n\t\tif (this.isTransacting()) {\n\t\t\tconst src = targetCommits[0].parent?.revision;\n\t\t\tconst dst = targetCommits[targetCommits.length - 1].revision;\n\t\t\tif (src !== undefined && dst !== undefined) {\n\t\t\t\tthis.initialTransactionRevToRebasedRev.set(src, dst);\n\t\t\t}\n\t\t}\n\t\tconst changeEvent = {\n\t\t\ttype: \"replace\",\n\t\t\tget change() {\n\t\t\t\tconst change = rebaseResult.sourceChange;\n\t\t\t\treturn change === undefined ? undefined : makeAnonChange(change);\n\t\t\t},\n\t\t\tremovedCommits: deletedSourceCommits,\n\t\t\tnewCommits,\n\t\t} as const;\n\t\tthis.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = newSourceHead;\n\n\t\tthis.emit(\"afterChange\", changeEvent);\n\t\treturn rebaseResult;\n\t}\n\n\t/**\n\t * Apply all the divergent changes on the given branch to this branch.\n\t *\n\t * @param branch - the branch to merge into this branch\n\t * @returns the net change to this branch and the commits that were added to this branch by the merge,\n\t * or undefined if nothing changed\n\t */\n\tpublic merge(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t): [change: TChange, newCommits: GraphCommit<TChange>[]] | undefined {\n\t\tthis.assertNotDisposed();\n\t\tbranch.assertNotDisposed();\n\t\tassert(\n\t\t\t!branch.isTransacting(),\n\t\t\t0x597 /* Branch may not be merged while transaction is in progress */,\n\t\t);\n\n\t\t// Rebase the given branch onto this branch\n\t\tconst rebaseResult = this.rebaseBranch(branch, this);\n\t\tif (rebaseResult === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Compute the net change to this branch\n\t\tconst sourceCommits = rebaseResult.commits.sourceCommits;\n\t\tconst change = this.changeFamily.rebaser.compose(sourceCommits);\n\t\tconst taggedChange = makeAnonChange(change);\n\t\tconst changeEvent = {\n\t\t\ttype: \"append\",\n\t\t\tget change(): TaggedChange<TChange> {\n\t\t\t\treturn taggedChange;\n\t\t\t},\n\t\t\tnewCommits: sourceCommits,\n\t\t} as const;\n\n\t\tthis.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = rebaseResult.newSourceHead;\n\t\tthis.emit(\"afterChange\", changeEvent);\n\t\treturn [change, sourceCommits];\n\t}\n\n\t/** Rebase `branchHead` onto `onto`, but return undefined if nothing changed */\n\tprivate rebaseBranch(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t\tonto: SharedTreeBranch<TEditor, TChange>,\n\t\tupTo = onto.getHead(),\n\t): BranchRebaseResult<TChange> | undefined {\n\t\tconst { head } = branch;\n\t\tif (head === upTo) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst { duration, output } = measure(() =>\n\t\t\trebaseBranch(\n\t\t\t\tthis.mintRevisionTag,\n\t\t\t\tthis.changeFamily.rebaser,\n\t\t\t\thead,\n\t\t\t\tupTo,\n\t\t\t\tonto.getHead(),\n\t\t\t),\n\t\t);\n\n\t\tthis.telemetryEventBatcher?.accumulateAndLog({ duration, ...output.telemetryProperties });\n\n\t\tif (this.head === output.newSourceHead) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn output;\n\t}\n\n\t/**\n\t * Dispose this branch, freezing its state.\n\t *\n\t * @remarks\n\t * Attempts to further mutate the branch will error.\n\t * Any transactions in progress will be aborted.\n\t * Calling dispose more than once has no effect.\n\t */\n\tpublic dispose(): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\twhile (this.isTransacting()) {\n\t\t\tthis.abortTransaction();\n\t\t}\n\n\t\tthis.unsubscribeBranchTrimmer?.();\n\n\t\tthis.disposed = true;\n\t\tthis.emit(\"dispose\");\n\t}\n\n\tprivate assertNotDisposed(): void {\n\t\tassert(!this.disposed, 0x66e /* Branch is disposed */);\n\t}\n}\n\n/**\n * Registers an event listener that fires when the given forkable object forks.\n * The listener will also fire when any of those forks fork, and when those forks of forks fork, and so on.\n * @param forkable - an object that emits an event when it is forked\n * @param onFork - the fork event listener\n * @returns a function which when called will deregister all registrations (including transitive) created by this function.\n * The deregister function has undefined behavior if called more than once.\n */\nexport function onForkTransitive<T extends Listenable<{ fork: (t: T) => void }>>(\n\tforkable: T,\n\tonFork: (fork: T) => void,\n): () => void {\n\tconst offs: (() => void)[] = [];\n\toffs.push(\n\t\tforkable.on(\"fork\", (fork) => {\n\t\t\toffs.push(onForkTransitive(fork, onFork));\n\t\t\tonFork(fork);\n\t\t}),\n\t);\n\treturn () => offs.forEach((off) => off());\n}\n"]}
1
+ {"version":3,"file":"branch.js","sourceRoot":"","sources":["../../src/shared-tree-core/branch.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAkE;AAClE,uEAA+F;AAE/F,+CAgB0B;AAC1B,iDAAmE;AAEnE,+DAAyD;AACzD,+CAAwC;AAmCxC;;GAEG;AACH,SAAgB,oBAAoB,CACnC,MAA6D;IAE7D,uHAAuH;IACvH,oGAAoG;IACpG,2DAA2D;IAC3D,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1E,OAAO,QAAQ,CAAC;IACjB,CAAC;IAED,iGAAiG;IACjG,0FAA0F;IAC1F,EAAE;IACF,+DAA+D;IAC/D,gEAAgE;IAChE,EAAE;IACF,uEAAuE;IACvE,IAAA,iBAAM,EACL,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,SAAS,EACtC,KAAK,CAAC,iDAAiD,CACvD,CAAC;IACF,IAAA,iBAAM,EACL,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,SAAS,EAClC,KAAK,CAAC,sEAAsE,CAC5E,CAAC;IACF,IACC,MAAM,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC;QAClC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAK,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,EAClE,CA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;;;GAOG;AACH,SAAgB,gBAAgB,CAC/B,QAAW,EACX,MAAyB;IAEzB,MAAM,IAAI,GAAmB,EAAE,CAAC;IAChC,IAAI,CAAC,IAAI,CACR,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;QAC5B,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,CAAC;IACd,CAAC,CAAC,CACF,CAAC;IACF,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;AAC3C,CAAC;AAZD,4CAYC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob } from \"@fluidframework/core-utils/internal\";\nimport { type TelemetryEventBatcher, measure } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype BranchRebaseResult,\n\ttype ChangeFamily,\n\ttype ChangeFamilyEditor,\n\tCommitKind,\n\ttype CommitMetadata,\n\ttype GraphCommit,\n\ttype RevisionTag,\n\ttype TaggedChange,\n\tfindAncestor,\n\tmakeAnonChange,\n\tmintCommit,\n\trebaseBranch,\n\ttagChange,\n\ttagRollbackInverse,\n\ttype RebaseStatsWithDuration,\n} from \"../core/index.js\";\nimport { EventEmitter, type Listenable } from \"../events/index.js\";\n\nimport { TransactionStack } from \"./transactionStack.js\";\nimport { fail } from \"../util/index.js\";\n\n/**\n * Describes a change to a `SharedTreeBranch`. Various operations can mutate the head of the branch;\n * this change format describes each in terms of the \"removed commits\" (all commits which were present\n * on the branch before the operation but are no longer present after) and the \"new commits\" (all\n * commits which are present on the branch after the operation that were not present before). Each of\n * the following event types also provides a `change` which contains the net change to the branch\n * (or is undefined if there was no net change):\n * * Append - when one or more commits are appended to the head of the branch, for example via\n * a change applied by the branch's editor, or as a result of merging another branch into this one\n * * Remove - when one or more commits are removed from the head of the branch. This occurs\n * when a transaction is aborted and all commits pending in that transaction are removed.\n * * Replace - when an operation simultaneously removes and appends commits. For example, when this\n * branch is rebased and some commits are removed and replaced with rebased versions, or when a\n * transaction completes and all pending commits are replaced with a single squash commit.\n */\nexport type SharedTreeBranchChange<TChange> =\n\t| {\n\t\t\ttype: \"append\";\n\t\t\tchange: TaggedChange<TChange>;\n\t\t\tnewCommits: readonly GraphCommit<TChange>[];\n\t }\n\t| {\n\t\t\ttype: \"remove\";\n\t\t\tchange: TaggedChange<TChange> | undefined;\n\t\t\tremovedCommits: readonly GraphCommit<TChange>[];\n\t }\n\t| {\n\t\t\ttype: \"replace\";\n\t\t\tchange: TaggedChange<TChange> | undefined;\n\t\t\tremovedCommits: readonly GraphCommit<TChange>[];\n\t\t\tnewCommits: readonly GraphCommit<TChange>[];\n\t };\n\n/**\n * Returns the operation that caused the given {@link SharedTreeBranchChange}.\n */\nexport function getChangeReplaceType(\n\tchange: SharedTreeBranchChange<unknown> & { type: \"replace\" },\n): \"transactionCommit\" | \"rebase\" {\n\t// The \"replace\" variant of the change event is emitted by two operations: committing a transaction and doing a rebase.\n\t// Committing a transaction will always remove one or more commits (the commits that were squashed),\n\t// and will add exactly one new commit (the squash commit).\n\tif (change.removedCommits.length === 0 || change.newCommits.length !== 1) {\n\t\treturn \"rebase\";\n\t}\n\n\t// There is only one case in which a rebase both removes commits and adds exactly one new commit.\n\t// This occurs when there is exactly one divergent, but equivalent, commit on each branch:\n\t//\n\t// A ─ B (branch X)\t -- rebase Y onto X --> A ─ B (branch X)\n\t// └─ B' (branch Y) └─ (branch Y)\n\t//\n\t// B' is removed and replaced by B because both have the same revision.\n\tassert(\n\t\tchange.removedCommits[0] !== undefined,\n\t\t0x9e4 /* This wont run due to the length check above */,\n\t);\n\tassert(\n\t\tchange.newCommits[0] !== undefined,\n\t\t0x9e5 /* This wont run because a replace operation always has new commits */,\n\t);\n\tif (\n\t\tchange.removedCommits.length === 1 &&\n\t\tchange.removedCommits[0].revision === change.newCommits[0].revision\n\t) {\n\t\treturn \"rebase\";\n\t}\n\n\treturn \"transactionCommit\";\n}\n\n/**\n * The events emitted by a `SharedTreeBranch`\n */\nexport interface SharedTreeBranchEvents<TEditor extends ChangeFamilyEditor, TChange>\n\textends BranchTrimmingEvents {\n\t/**\n\t * Fired just before the head of this branch changes.\n\t * @param change - the change to this branch's state and commits\n\t */\n\tbeforeChange(change: SharedTreeBranchChange<TChange>): void;\n\n\t/**\n\t * Fired just after the head of this branch changes.\n\t * @param change - the change to this branch's state and commits\n\t */\n\tafterChange(change: SharedTreeBranchChange<TChange>): void;\n\n\t/**\n\t * {@inheritdoc TreeViewEvents.commitApplied}\n\t */\n\tcommitApplied(data: CommitMetadata): void;\n\n\t/**\n\t * Fired when this branch forks\n\t * @param fork - the new branch that forked off of this branch\n\t */\n\tfork(fork: SharedTreeBranch<TEditor, TChange>): void;\n\n\t/**\n\t * Fired after this branch is disposed\n\t */\n\tdispose(): void;\n\n\t/**\n\t * Fired after a new transaction is started.\n\t * @param isOuterTransaction - true iff the transaction being started is the outermost transaction\n\t * as opposed to a nested transaction.\n\t */\n\ttransactionStarted(isOuterTransaction: boolean): void;\n\n\t/**\n\t * Fired after the current transaction is aborted.\n\t * @param isOuterTransaction - true iff the transaction being aborted is the outermost transaction\n\t * as opposed to a nested transaction.\n\t */\n\ttransactionAborted(isOuterTransaction: boolean): void;\n\n\t/**\n\t * Fired after the current transaction is completely rolled back.\n\t * @param isOuterTransaction - true iff the transaction being aborted is the outermost transaction\n\t * as opposed to a nested transaction.\n\t */\n\ttransactionRolledBack(isOuterTransaction: boolean): void;\n\n\t/**\n\t * Fired after the current transaction is committed.\n\t * @param isOuterTransaction - true iff the transaction being committed is the outermost transaction\n\t * as opposed to a nested transaction.\n\t */\n\ttransactionCommitted(isOuterTransaction: boolean): void;\n}\n\n/**\n * Events related to branch trimming.\n *\n * @remarks\n * Trimming is a very specific kind of mutation which is the only allowed mutations to branches.\n * References to commits from other commits are removed so that the commit objects can be GC'd by the JS engine.\n * This happens by changing a commit's parent property to undefined, which drops all commits that are in its \"ancestry\".\n * It is done as a performance optimization when it is determined that commits are no longer needed for future computation.\n */\nexport interface BranchTrimmingEvents {\n\t/**\n\t * Fired when some contiguous range of commits beginning with the \"global tail\" of this branch are trimmed from the branch.\n\t * This happens by deleting the parent pointer to the last commit in that range. This event can be fired at any time.\n\t */\n\tancestryTrimmed(trimmedRevisions: RevisionTag[]): void;\n}\n\n/**\n * A branch of changes that can be applied to a SharedTree.\n */\nexport class SharedTreeBranch<\n\tTEditor extends ChangeFamilyEditor,\n\tTChange,\n> extends EventEmitter<SharedTreeBranchEvents<TEditor, TChange>> {\n\tpublic readonly editor: TEditor;\n\tprivate readonly transactions = new TransactionStack();\n\t/**\n\t * After pushing a starting revision to the transaction stack, this branch might be rebased\n\t * over commits which are children of that starting revision. When the transaction is committed,\n\t * those rebased-over commits should not be included in the transaction's squash commit, even though\n\t * they exist between the starting revision and the final commit within the transaction.\n\t *\n\t * Whenever `rebaseOnto` is called during a transaction, this map is augmented with an entry from the\n\t * original merge-base to the new merge-base.\n\t *\n\t * This state need only be retained for the lifetime of the transaction.\n\t *\n\t * TODO: This strategy might need to be revisited when adding better support for async transactions.\n\t * Since:\n\t *\n\t * 1. Transactionality is guaranteed primarily by squashing at commit time\n\t * 2. Branches may be rebased with an ongoing transaction\n\t *\n\t * a rebase operation might invalidate only a portion of a transaction's commits, thus defeating the\n\t * purpose of transactionality.\n\t *\n\t * AB#6483 and children items track this work.\n\t */\n\tprivate readonly initialTransactionRevToRebasedRev = new Map<RevisionTag, RevisionTag>();\n\tprivate disposed = false;\n\tprivate readonly unsubscribeBranchTrimmer?: () => void;\n\t/**\n\t * Construct a new branch.\n\t * @param head - the head of the branch\n\t * @param changeFamily - determines the set of changes that this branch can commit\n\t * @param branchTrimmer - an optional event emitter that informs the branch it has been trimmed. If this is not supplied, then the branch must\n\t * never be trimmed. See {@link BranchTrimmingEvents} for details on trimming.\n\t */\n\tpublic constructor(\n\t\tprivate head: GraphCommit<TChange>,\n\t\tpublic readonly changeFamily: ChangeFamily<TEditor, TChange>,\n\t\tprivate readonly mintRevisionTag: () => RevisionTag,\n\t\tprivate readonly branchTrimmer?: Listenable<BranchTrimmingEvents>,\n\t\tprivate readonly telemetryEventBatcher?: TelemetryEventBatcher<\n\t\t\tkeyof RebaseStatsWithDuration\n\t\t>,\n\t) {\n\t\tsuper();\n\t\tthis.editor = this.changeFamily.buildEditor((change) =>\n\t\t\tthis.apply(change, mintRevisionTag()),\n\t\t);\n\t\tthis.unsubscribeBranchTrimmer = branchTrimmer?.on(\"ancestryTrimmed\", (commit) => {\n\t\t\tthis.emit(\"ancestryTrimmed\", commit);\n\t\t});\n\t}\n\n\t/**\n\t * Sets the head of this branch. Emits no change events.\n\t */\n\tpublic setHead(head: GraphCommit<TChange>): void {\n\t\tthis.assertNotDisposed();\n\t\tassert(!this.isTransacting(), 0x685 /* Cannot set head during a transaction */);\n\t\tthis.head = head;\n\t}\n\n\t/**\n\t * Apply a change to this branch.\n\t * @param change - the change to apply\n\t * @param revision - the revision of the new head commit of the branch that contains `change`\n\t * @param changeKind - the kind of change to apply\n\t * @returns the change that was applied and the new head commit of the branch\n\t */\n\tpublic apply(\n\t\tchange: TChange,\n\t\trevision: RevisionTag,\n\t\tchangeKind: CommitKind = CommitKind.Default,\n\t): [change: TChange, newCommit: GraphCommit<TChange>] {\n\t\tthis.assertNotDisposed();\n\n\t\t// TODO: This should not be necessary when receiving changes from other clients.\n\t\tconst changeWithRevision = this.changeFamily.rebaser.changeRevision(change, revision);\n\n\t\tconst newHead = mintCommit(this.head, {\n\t\t\trevision,\n\t\t\tchange: changeWithRevision,\n\t\t});\n\n\t\tconst changeEvent = {\n\t\t\ttype: \"append\",\n\t\t\tchange: tagChange(changeWithRevision, revision),\n\t\t\tnewCommits: [newHead],\n\t\t} as const;\n\n\t\tthis.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = newHead;\n\n\t\t// If this is not part of a transaction, emit a commitApplied event\n\t\tif (!this.isTransacting()) {\n\t\t\tthis.emit(\"commitApplied\", { isLocal: true, kind: changeKind });\n\t\t}\n\n\t\tthis.emit(\"afterChange\", changeEvent);\n\t\treturn [changeWithRevision, newHead];\n\t}\n\n\t/**\n\t * @returns the commit at the head of this branch.\n\t */\n\tpublic getHead(): GraphCommit<TChange> {\n\t\treturn this.head;\n\t}\n\n\t/**\n\t * Begin a transaction on this branch. If the transaction is committed via {@link commitTransaction},\n\t * all commits made since this call will be squashed into a single head commit.\n\t */\n\tpublic startTransaction(): void {\n\t\tthis.assertNotDisposed();\n\t\tconst forks = new Set<SharedTreeBranch<TEditor, TChange>>();\n\t\tconst onDisposeUnSubscribes: (() => void)[] = [];\n\t\tconst onForkUnSubscribe = onForkTransitive(this, (fork) => {\n\t\t\tforks.add(fork);\n\t\t\tonDisposeUnSubscribes.push(fork.on(\"dispose\", () => forks.delete(fork)));\n\t\t});\n\t\tthis.transactions.push(this.head.revision, () => {\n\t\t\tforks.forEach((fork) => fork.dispose());\n\t\t\tonDisposeUnSubscribes.forEach((unsubscribe) => unsubscribe());\n\t\t\tonForkUnSubscribe();\n\t\t});\n\t\tthis.editor.enterTransaction();\n\t\tthis.emit(\"transactionStarted\", this.transactions.size === 1);\n\t}\n\n\t/**\n\t * Commit the current transaction. There must be a transaction in progress that was begun via {@link startTransaction}.\n\t * If there are commits in the current transaction, they will be squashed into a new single head commit.\n\t * @returns the commits that were squashed and the new squash commit if a squash occurred, otherwise `undefined`.\n\t * @remarks If the transaction had no changes applied during its lifetime, then no squash occurs (i.e. this method is a no-op).\n\t * Even if the transaction contained only one change, it will still be replaced with an (equivalent) squash change.\n\t */\n\tpublic commitTransaction():\n\t\t| [squashedCommits: GraphCommit<TChange>[], newCommit: GraphCommit<TChange>]\n\t\t| undefined {\n\t\tthis.assertNotDisposed();\n\t\tconst [startCommit, commits] = this.popTransaction();\n\t\tthis.editor.exitTransaction();\n\n\t\tthis.emit(\"transactionCommitted\", this.transactions.size === 0);\n\t\tif (commits.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Squash the changes and make the squash commit the new head of this branch\n\t\tconst squashedChange = this.changeFamily.rebaser.compose(commits);\n\t\tconst revision = this.mintRevisionTag();\n\n\t\tconst newHead = mintCommit(startCommit, {\n\t\t\trevision,\n\t\t\tchange: this.changeFamily.rebaser.changeRevision(squashedChange, revision),\n\t\t});\n\n\t\tconst changeEvent = {\n\t\t\ttype: \"replace\",\n\t\t\tchange: undefined,\n\t\t\tremovedCommits: commits,\n\t\t\tnewCommits: [newHead],\n\t\t} as const;\n\n\t\tthis.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = newHead;\n\n\t\t// If this transaction is not nested, emit a commitApplied event\n\t\tif (!this.isTransacting()) {\n\t\t\tthis.emit(\"commitApplied\", { isLocal: true, kind: CommitKind.Default });\n\t\t}\n\n\t\tthis.emit(\"afterChange\", changeEvent);\n\t\treturn [commits, newHead];\n\t}\n\n\t/**\n\t * Cancel the current transaction. There must be a transaction in progress that was begun via\n\t * {@link startTransaction}. All commits made during the transaction will be removed.\n\t * @returns the change to this branch resulting in the removal of the commits, and a list of the\n\t * commits that were removed.\n\t */\n\tpublic abortTransaction(): [\n\t\tchange: TChange | undefined,\n\t\tabortedCommits: GraphCommit<TChange>[],\n\t] {\n\t\tthis.assertNotDisposed();\n\t\tconst [startCommit, commits] = this.popTransaction();\n\t\tthis.editor.exitTransaction();\n\n\t\tthis.emit(\"transactionAborted\", this.transactions.size === 0);\n\t\tif (commits.length === 0) {\n\t\t\tthis.emit(\"transactionRolledBack\", this.transactions.size === 0);\n\t\t\treturn [undefined, []];\n\t\t}\n\n\t\tconst inverses: TaggedChange<TChange>[] = [];\n\t\tfor (let i = commits.length - 1; i >= 0; i--) {\n\t\t\tconst revision = this.mintRevisionTag();\n\t\t\tconst commit =\n\t\t\t\tcommits[i] ?? fail(\"This wont run because we are iterating through commits\");\n\t\t\tconst inverse = this.changeFamily.rebaser.changeRevision(\n\t\t\t\tthis.changeFamily.rebaser.invert(commit, false),\n\t\t\t\trevision,\n\t\t\t\tcommit.revision,\n\t\t\t);\n\n\t\t\tinverses.push(tagRollbackInverse(inverse, revision, commit.revision));\n\t\t}\n\t\tconst change =\n\t\t\tinverses.length > 0 ? this.changeFamily.rebaser.compose(inverses) : undefined;\n\n\t\tconst changeEvent = {\n\t\t\ttype: \"remove\",\n\t\t\tchange: change === undefined ? undefined : makeAnonChange(change),\n\t\t\tremovedCommits: commits,\n\t\t} as const;\n\n\t\tthis.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = startCommit;\n\t\tthis.emit(\"afterChange\", changeEvent);\n\t\tthis.emit(\"transactionRolledBack\", this.transactions.size === 0);\n\t\treturn [change, commits];\n\t}\n\n\t/**\n\t * True iff this branch is in the middle of a transaction that was begin via {@link startTransaction}\n\t */\n\tpublic isTransacting(): boolean {\n\t\treturn this.transactions.size !== 0;\n\t}\n\n\tprivate popTransaction(): [GraphCommit<TChange>, GraphCommit<TChange>[]] {\n\t\tconst { startRevision: startRevisionOriginal } = this.transactions.pop();\n\t\tlet startRevision = startRevisionOriginal;\n\t\twhile (this.initialTransactionRevToRebasedRev.has(startRevision)) {\n\t\t\tstartRevision = this.initialTransactionRevToRebasedRev.get(startRevision) ?? oob();\n\t\t}\n\n\t\tif (!this.isTransacting()) {\n\t\t\tthis.initialTransactionRevToRebasedRev.clear();\n\t\t}\n\n\t\tconst commits: GraphCommit<TChange>[] = [];\n\t\tconst startCommit = findAncestor(\n\t\t\t[this.head, commits],\n\t\t\t(c) => c.revision === startRevision,\n\t\t);\n\t\tassert(\n\t\t\tstartCommit !== undefined,\n\t\t\t0x593 /* Expected branch to be ahead of transaction start revision */,\n\t\t);\n\t\treturn [startCommit, commits];\n\t}\n\n\t/**\n\t * Spawn a new branch that is based off of the current state of this branch.\n\t * Changes made to the new branch will not be applied to this branch until the new branch is merged back in.\n\t *\n\t * @remarks Forks created during a transaction will be disposed when the transaction ends.\n\t */\n\tpublic fork(): SharedTreeBranch<TEditor, TChange> {\n\t\tthis.assertNotDisposed();\n\t\tconst fork = new SharedTreeBranch(\n\t\t\tthis.head,\n\t\t\tthis.changeFamily,\n\t\t\tthis.mintRevisionTag,\n\t\t\tthis.branchTrimmer,\n\t\t);\n\t\tthis.emit(\"fork\", fork);\n\t\treturn fork;\n\t}\n\n\t/**\n\t * Rebase the changes that have been applied to this branch over divergent changes in the given branch.\n\t * After this operation completes, this branch will be based off of `branch`.\n\t *\n\t * @param branch - the branch to rebase onto\n\t * @param upTo - the furthest commit on `branch` over which to rebase (inclusive). Defaults to the head commit of `branch`.\n\t * @returns the result of the rebase or undefined if nothing changed\n\t */\n\tpublic rebaseOnto(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t\tupTo = branch.getHead(),\n\t): BranchRebaseResult<TChange> | undefined {\n\t\tthis.assertNotDisposed();\n\n\t\t// Rebase this branch onto the given branch\n\t\tconst rebaseResult = this.rebaseBranch(this, branch, upTo);\n\t\tif (rebaseResult === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// The net change to this branch is provided by the `rebaseBranch` API\n\t\tconst { newSourceHead, commits } = rebaseResult;\n\t\tconst { deletedSourceCommits, targetCommits, sourceCommits } = commits;\n\n\t\tconst newCommits = targetCommits.concat(sourceCommits);\n\t\tif (this.isTransacting()) {\n\t\t\tconst firstCommit = targetCommits[0] ?? oob();\n\t\t\tconst lastCommit = targetCommits[targetCommits.length - 1] ?? oob();\n\t\t\tconst src = firstCommit.parent?.revision;\n\t\t\tconst dst = lastCommit.revision;\n\t\t\tif (src !== undefined && dst !== undefined) {\n\t\t\t\tthis.initialTransactionRevToRebasedRev.set(src, dst);\n\t\t\t}\n\t\t}\n\t\tconst changeEvent = {\n\t\t\ttype: \"replace\",\n\t\t\tget change() {\n\t\t\t\tconst change = rebaseResult.sourceChange;\n\t\t\t\treturn change === undefined ? undefined : makeAnonChange(change);\n\t\t\t},\n\t\t\tremovedCommits: deletedSourceCommits,\n\t\t\tnewCommits,\n\t\t} as const;\n\t\tthis.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = newSourceHead;\n\n\t\tthis.emit(\"afterChange\", changeEvent);\n\t\treturn rebaseResult;\n\t}\n\n\t/**\n\t * Apply all the divergent changes on the given branch to this branch.\n\t *\n\t * @param branch - the branch to merge into this branch\n\t * @returns the net change to this branch and the commits that were added to this branch by the merge,\n\t * or undefined if nothing changed\n\t */\n\tpublic merge(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t): [change: TChange, newCommits: GraphCommit<TChange>[]] | undefined {\n\t\tthis.assertNotDisposed();\n\t\tbranch.assertNotDisposed();\n\t\tassert(\n\t\t\t!branch.isTransacting(),\n\t\t\t0x597 /* Branch may not be merged while transaction is in progress */,\n\t\t);\n\n\t\t// Rebase the given branch onto this branch\n\t\tconst rebaseResult = this.rebaseBranch(branch, this);\n\t\tif (rebaseResult === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Compute the net change to this branch\n\t\tconst sourceCommits = rebaseResult.commits.sourceCommits;\n\t\tconst change = this.changeFamily.rebaser.compose(sourceCommits);\n\t\tconst taggedChange = makeAnonChange(change);\n\t\tconst changeEvent = {\n\t\t\ttype: \"append\",\n\t\t\tget change(): TaggedChange<TChange> {\n\t\t\t\treturn taggedChange;\n\t\t\t},\n\t\t\tnewCommits: sourceCommits,\n\t\t} as const;\n\n\t\tthis.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = rebaseResult.newSourceHead;\n\t\tthis.emit(\"afterChange\", changeEvent);\n\t\treturn [change, sourceCommits];\n\t}\n\n\t/** Rebase `branchHead` onto `onto`, but return undefined if nothing changed */\n\tprivate rebaseBranch(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t\tonto: SharedTreeBranch<TEditor, TChange>,\n\t\tupTo = onto.getHead(),\n\t): BranchRebaseResult<TChange> | undefined {\n\t\tconst { head } = branch;\n\t\tif (head === upTo) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst { duration, output } = measure(() =>\n\t\t\trebaseBranch(\n\t\t\t\tthis.mintRevisionTag,\n\t\t\t\tthis.changeFamily.rebaser,\n\t\t\t\thead,\n\t\t\t\tupTo,\n\t\t\t\tonto.getHead(),\n\t\t\t),\n\t\t);\n\n\t\tthis.telemetryEventBatcher?.accumulateAndLog({ duration, ...output.telemetryProperties });\n\n\t\tif (this.head === output.newSourceHead) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn output;\n\t}\n\n\t/**\n\t * Dispose this branch, freezing its state.\n\t *\n\t * @remarks\n\t * Attempts to further mutate the branch will error.\n\t * Any transactions in progress will be aborted.\n\t * Calling dispose more than once has no effect.\n\t */\n\tpublic dispose(): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\twhile (this.isTransacting()) {\n\t\t\tthis.abortTransaction();\n\t\t}\n\n\t\tthis.unsubscribeBranchTrimmer?.();\n\n\t\tthis.disposed = true;\n\t\tthis.emit(\"dispose\");\n\t}\n\n\tprivate assertNotDisposed(): void {\n\t\tassert(!this.disposed, 0x66e /* Branch is disposed */);\n\t}\n}\n\n/**\n * Registers an event listener that fires when the given forkable object forks.\n * The listener will also fire when any of those forks fork, and when those forks of forks fork, and so on.\n * @param forkable - an object that emits an event when it is forked\n * @param onFork - the fork event listener\n * @returns a function which when called will deregister all registrations (including transitive) created by this function.\n * The deregister function has undefined behavior if called more than once.\n */\nexport function onForkTransitive<T extends Listenable<{ fork: (t: T) => void }>>(\n\tforkable: T,\n\tonFork: (fork: T) => void,\n): () => void {\n\tconst offs: (() => void)[] = [];\n\toffs.push(\n\t\tforkable.on(\"fork\", (fork) => {\n\t\t\toffs.push(onForkTransitive(fork, onFork));\n\t\t\tonFork(fork);\n\t\t}),\n\t);\n\treturn () => offs.forEach((off) => off());\n}\n"]}
@@ -62,7 +62,7 @@ class DefaultResubmitMachine {
62
62
  const checkout = this.tip.fork();
63
63
  // Roll back the checkout to the state before the oldest commit
64
64
  for (let iCommit = toResubmit.length - 1; iCommit >= 0; iCommit -= 1) {
65
- const commit = toResubmit[iCommit];
65
+ const commit = toResubmit[iCommit] ?? (0, internal_1.oob)();
66
66
  const rollback = this.inverter(commit, true);
67
67
  // WARNING: it's not currently possible to roll back past a schema change (see AB#7265).
68
68
  // Either we have to make it possible to do so, or this logic will have to change to work
@@ -71,7 +71,7 @@ class DefaultResubmitMachine {
71
71
  }
72
72
  // Update the enrichments of the stale commits
73
73
  for (let iCommit = 0; iCommit <= this.latestInFlightCommitWithStaleEnrichments; iCommit += 1) {
74
- const commit = toResubmit[iCommit];
74
+ const commit = toResubmit[iCommit] ?? (0, internal_1.oob)();
75
75
  const enrichedChange = checkout.updateChangeEnrichments(commit.change, commit.revision);
76
76
  const enrichedCommit = { ...commit, change: enrichedChange };
77
77
  this.resubmitQueue.push(enrichedCommit);
@@ -91,7 +91,7 @@ class DefaultResubmitMachine {
91
91
  }
92
92
  peekNextCommit() {
93
93
  (0, internal_1.assert)(this.isInResubmitPhase, 0x982 /* No available commit to resubmit outside of resubmit phase */);
94
- return this.resubmitQueue[0];
94
+ return this.resubmitQueue[0] ?? (0, internal_1.oob)();
95
95
  }
96
96
  get isInResubmitPhase() {
97
97
  return this.resubmitQueue.length !== 0;
@@ -1 +1 @@
1
- {"version":3,"file":"defaultResubmitMachine.js","sourceRoot":"","sources":["../../src/shared-tree-core/defaultResubmitMachine.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAE7D,+CAAiD;AAGjD;;GAEG;AACH,MAAa,sBAAsB;IAuBlC;IACC;;OAEG;IACc,QAA0C;IAC3D;;;OAGG;IACc,GAA4C;QAL5C,aAAQ,GAAR,QAAQ,CAAkC;QAK1C,QAAG,GAAH,GAAG,CAAyC;QA/B9D;;WAEG;QACK,kBAAa,GAA2B,EAAE,CAAC;QAEnD;;WAEG;QACK,kBAAa,GAA2B,EAAE,CAA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,CAAC;IAEM,wBAAwB,CAAC,OAAgB;QAC/C,IAAI,OAAO,EAAE,CAAC;YACb,iDAAiD;YACjD,IAAA,iBAAM,EAAC,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,CAAC,wCAAwC,CAAC,CAAC;YACtF,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;YAC3B,IAAI,IAAI,CAAC,wCAAwC,IAAI,CAAC,EAAE,CAAC;gBACxD,IAAI,CAAC,wCAAwC,IAAI,CAAC,CAAC;YACpD,CAAC;QACF,CAAC;aAAM,CAAC;YACP,mCAAmC;YACnC,IAAI,CAAC,wCAAwC,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;QAC/E,CAAC;IACF,CAAC;CACD;AA3HD,wDA2HC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { ChangeRebaser, GraphCommit } from \"../core/index.js\";\nimport { disposeSymbol } from \"../util/index.js\";\nimport type { ChangeEnricherReadonlyCheckout, ResubmitMachine } from \"./index.js\";\n\n/**\n * Default implementation of {@link ResubmitMachine}.\n */\nexport class DefaultResubmitMachine<TChange> implements ResubmitMachine<TChange> {\n\t/**\n\t * The list of commits (from oldest to most recent) that have been submitted but not sequenced.\n\t */\n\tprivate inFlightQueue: GraphCommit<TChange>[] = [];\n\n\t/**\n\t * The list of commits (from oldest to most recent) that should be resubmitted.\n\t */\n\tprivate resubmitQueue: GraphCommit<TChange>[] = [];\n\n\t/**\n\t * Represents the index in the `inFlightQueue` array of the most recent in flight commit that has\n\t * undergone rebasing but whose enrichments have not been updated.\n\t * All in-flight commits with an index inferior or equal to this number have stale enrichments.\n\t *\n\t * Is -1 when *any* of the following is true:\n\t * - There are no in-flight commits (i.e., no local commits have been made or they have all been sequenced)\n\t * - None of the in-flight commits have been rebased\n\t * - In-flight commits that have been rebased have all had their enrichments updated\n\t */\n\tprivate latestInFlightCommitWithStaleEnrichments: number = -1;\n\n\tpublic constructor(\n\t\t/**\n\t\t * A function that can invert a change.\n\t\t */\n\t\tprivate readonly inverter: ChangeRebaser<TChange>[\"invert\"],\n\t\t/**\n\t\t * Change enricher that represent the tip of the top-level local branch (i.e., the branch on which in-flight\n\t\t * commits are applied and automatically rebased).\n\t\t */\n\t\tprivate readonly tip: ChangeEnricherReadonlyCheckout<TChange>,\n\t) {}\n\n\tpublic onCommitSubmitted(commit: GraphCommit<TChange>): void {\n\t\tif (this.isInResubmitPhase) {\n\t\t\tconst toResubmit = this.resubmitQueue.shift();\n\t\t\tassert(\n\t\t\t\ttoResubmit === commit,\n\t\t\t\t0x981 /* Unexpected commit submitted during resubmit phase */,\n\t\t\t);\n\t\t}\n\t\tthis.inFlightQueue.push(commit);\n\t}\n\n\tpublic prepareForResubmit(toResubmit: readonly GraphCommit<TChange>[]): void {\n\t\tassert(\n\t\t\t!this.isInResubmitPhase,\n\t\t\t0x957 /* Invalid resubmit phase start during incomplete resubmit phase */,\n\t\t);\n\t\tassert(\n\t\t\ttoResubmit.length === this.inFlightQueue.length,\n\t\t\t0x958 /* Unexpected resubmit of more or fewer commits than are in flight */,\n\t\t);\n\t\tif (this.latestInFlightCommitWithStaleEnrichments === -1) {\n\t\t\t// No in-flight commits have stale enrichments, so we can resubmit them as is\n\t\t\tthis.resubmitQueue = this.inFlightQueue;\n\t\t\tthis.inFlightQueue = [];\n\t\t} else {\n\t\t\tconst checkout = this.tip.fork();\n\t\t\t// Roll back the checkout to the state before the oldest commit\n\t\t\tfor (let iCommit = toResubmit.length - 1; iCommit >= 0; iCommit -= 1) {\n\t\t\t\tconst commit = toResubmit[iCommit];\n\t\t\t\tconst rollback = this.inverter(commit, true);\n\t\t\t\t// WARNING: it's not currently possible to roll back past a schema change (see AB#7265).\n\t\t\t\t// Either we have to make it possible to do so, or this logic will have to change to work\n\t\t\t\t// forwards from an earlier fork instead of backwards.\n\t\t\t\tcheckout.applyTipChange(rollback);\n\t\t\t}\n\t\t\t// Update the enrichments of the stale commits\n\t\t\tfor (\n\t\t\t\tlet iCommit = 0;\n\t\t\t\tiCommit <= this.latestInFlightCommitWithStaleEnrichments;\n\t\t\t\tiCommit += 1\n\t\t\t) {\n\t\t\t\tconst commit = toResubmit[iCommit];\n\t\t\t\tconst enrichedChange = checkout.updateChangeEnrichments(\n\t\t\t\t\tcommit.change,\n\t\t\t\t\tcommit.revision,\n\t\t\t\t);\n\t\t\t\tconst enrichedCommit = { ...commit, change: enrichedChange };\n\t\t\t\tthis.resubmitQueue.push(enrichedCommit);\n\t\t\t\tif (iCommit < this.latestInFlightCommitWithStaleEnrichments) {\n\t\t\t\t\tcheckout.applyTipChange(enrichedChange, commit.revision);\n\t\t\t\t}\n\t\t\t\tthis.inFlightQueue.shift();\n\t\t\t}\n\t\t\tcheckout[disposeSymbol]();\n\t\t\t// Whatever commits are left do not have stale enrichments\n\t\t\tfor (const commit of this.inFlightQueue) {\n\t\t\t\tthis.resubmitQueue.push(commit);\n\t\t\t}\n\t\t\tthis.inFlightQueue.length = 0;\n\t\t}\n\t\tthis.latestInFlightCommitWithStaleEnrichments = -1;\n\t}\n\n\tpublic peekNextCommit(): GraphCommit<TChange> {\n\t\tassert(\n\t\t\tthis.isInResubmitPhase,\n\t\t\t0x982 /* No available commit to resubmit outside of resubmit phase */,\n\t\t);\n\t\treturn this.resubmitQueue[0];\n\t}\n\n\tpublic get isInResubmitPhase(): boolean {\n\t\treturn this.resubmitQueue.length !== 0;\n\t}\n\n\tpublic onSequencedCommitApplied(isLocal: boolean): void {\n\t\tif (isLocal) {\n\t\t\t// The oldest in-flight commit has been sequenced\n\t\t\tassert(this.inFlightQueue.length > 0, 0x959 /* Sequencing of unknown local commit */);\n\t\t\tthis.inFlightQueue.shift();\n\t\t\tif (this.latestInFlightCommitWithStaleEnrichments >= 0) {\n\t\t\t\tthis.latestInFlightCommitWithStaleEnrichments -= 1;\n\t\t\t}\n\t\t} else {\n\t\t\t// A peer commit has been sequenced\n\t\t\tthis.latestInFlightCommitWithStaleEnrichments = this.inFlightQueue.length - 1;\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"defaultResubmitMachine.js","sourceRoot":"","sources":["../../src/shared-tree-core/defaultResubmitMachine.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAkE;AAElE,+CAAiD;AAGjD;;GAEG;AACH,MAAa,sBAAsB;IAuBlC;IACC;;OAEG;IACc,QAA0C;IAC3D;;;OAGG;IACc,GAA4C;QAL5C,aAAQ,GAAR,QAAQ,CAAkC;QAK1C,QAAG,GAAH,GAAG,CAAyC;QA/B9D;;WAEG;QACK,kBAAa,GAA2B,EAAE,CAAC;QAEnD;;WAEG;QACK,kBAAa,GAA2B,EAAE,CAAC;QAEnD;;;;;;;;;WASG;QACK,6CAAwC,GAAW,CAAC,CAAC,CAAC;IAY3D,CAAC;IAEG,iBAAiB,CAAC,MAA4B;QACpD,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC5B,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;YAC9C,IAAA,iBAAM,EACL,UAAU,KAAK,MAAM,EACrB,KAAK,CAAC,uDAAuD,CAC7D,CAAC;QACH,CAAC;QACD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IAEM,kBAAkB,CAAC,UAA2C;QACpE,IAAA,iBAAM,EACL,CAAC,IAAI,CAAC,iBAAiB,EACvB,KAAK,CAAC,mEAAmE,CACzE,CAAC;QACF,IAAA,iBAAM,EACL,UAAU,CAAC,MAAM,KAAK,IAAI,CAAC,aAAa,CAAC,MAAM,EAC/C,KAAK,CAAC,qEAAqE,CAC3E,CAAC;QACF,IAAI,IAAI,CAAC,wCAAwC,KAAK,CAAC,CAAC,EAAE,CAAC;YAC1D,6EAA6E;YAC7E,IAAI,CAAC,aAAa,GAAG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AAQ,CAAC,wBAAa,CAAC,EAAE,CAAC;YAC1B,0DAA0D;YAC1D,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;gBACzC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACjC,CAAC;YACD,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;QAC/B,CAAC;QACD,IAAI,CAAC,wCAAwC,GAAG,CAAC,CAAC,CAAC;IACpD,CAAC;IAEM,cAAc;QACpB,IAAA,iBAAM,EACL,IAAI,CAAC,iBAAiB,EACtB,KAAK,CAAC,+DAA+D,CACrE,CAAC;QACF,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,IAAA,cAAG,GAAE,CAAC;IACvC,CAAC;IAED,IAAW,iBAAiB;QAC3B,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC,CAAC;IACxC,CAAC;IAEM,wBAAwB,CAAC,OAAgB;QAC/C,IAAI,OAAO,EAAE,CAAC;YACb,iDAAiD;YACjD,IAAA,iBAAM,EAAC,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,CAAC,wCAAwC,CAAC,CAAC;YACtF,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;YAC3B,IAAI,IAAI,CAAC,wCAAwC,IAAI,CAAC,EAAE,CAAC;gBACxD,IAAI,CAAC,wCAAwC,IAAI,CAAC,CAAC;YACpD,CAAC;QACF,CAAC;aAAM,CAAC;YACP,mCAAmC;YACnC,IAAI,CAAC,wCAAwC,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;QAC/E,CAAC;IACF,CAAC;CACD;AA3HD,wDA2HC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob } from \"@fluidframework/core-utils/internal\";\nimport type { ChangeRebaser, GraphCommit } from \"../core/index.js\";\nimport { disposeSymbol } from \"../util/index.js\";\nimport type { ChangeEnricherReadonlyCheckout, ResubmitMachine } from \"./index.js\";\n\n/**\n * Default implementation of {@link ResubmitMachine}.\n */\nexport class DefaultResubmitMachine<TChange> implements ResubmitMachine<TChange> {\n\t/**\n\t * The list of commits (from oldest to most recent) that have been submitted but not sequenced.\n\t */\n\tprivate inFlightQueue: GraphCommit<TChange>[] = [];\n\n\t/**\n\t * The list of commits (from oldest to most recent) that should be resubmitted.\n\t */\n\tprivate resubmitQueue: GraphCommit<TChange>[] = [];\n\n\t/**\n\t * Represents the index in the `inFlightQueue` array of the most recent in flight commit that has\n\t * undergone rebasing but whose enrichments have not been updated.\n\t * All in-flight commits with an index inferior or equal to this number have stale enrichments.\n\t *\n\t * Is -1 when *any* of the following is true:\n\t * - There are no in-flight commits (i.e., no local commits have been made or they have all been sequenced)\n\t * - None of the in-flight commits have been rebased\n\t * - In-flight commits that have been rebased have all had their enrichments updated\n\t */\n\tprivate latestInFlightCommitWithStaleEnrichments: number = -1;\n\n\tpublic constructor(\n\t\t/**\n\t\t * A function that can invert a change.\n\t\t */\n\t\tprivate readonly inverter: ChangeRebaser<TChange>[\"invert\"],\n\t\t/**\n\t\t * Change enricher that represent the tip of the top-level local branch (i.e., the branch on which in-flight\n\t\t * commits are applied and automatically rebased).\n\t\t */\n\t\tprivate readonly tip: ChangeEnricherReadonlyCheckout<TChange>,\n\t) {}\n\n\tpublic onCommitSubmitted(commit: GraphCommit<TChange>): void {\n\t\tif (this.isInResubmitPhase) {\n\t\t\tconst toResubmit = this.resubmitQueue.shift();\n\t\t\tassert(\n\t\t\t\ttoResubmit === commit,\n\t\t\t\t0x981 /* Unexpected commit submitted during resubmit phase */,\n\t\t\t);\n\t\t}\n\t\tthis.inFlightQueue.push(commit);\n\t}\n\n\tpublic prepareForResubmit(toResubmit: readonly GraphCommit<TChange>[]): void {\n\t\tassert(\n\t\t\t!this.isInResubmitPhase,\n\t\t\t0x957 /* Invalid resubmit phase start during incomplete resubmit phase */,\n\t\t);\n\t\tassert(\n\t\t\ttoResubmit.length === this.inFlightQueue.length,\n\t\t\t0x958 /* Unexpected resubmit of more or fewer commits than are in flight */,\n\t\t);\n\t\tif (this.latestInFlightCommitWithStaleEnrichments === -1) {\n\t\t\t// No in-flight commits have stale enrichments, so we can resubmit them as is\n\t\t\tthis.resubmitQueue = this.inFlightQueue;\n\t\t\tthis.inFlightQueue = [];\n\t\t} else {\n\t\t\tconst checkout = this.tip.fork();\n\t\t\t// Roll back the checkout to the state before the oldest commit\n\t\t\tfor (let iCommit = toResubmit.length - 1; iCommit >= 0; iCommit -= 1) {\n\t\t\t\tconst commit = toResubmit[iCommit] ?? oob();\n\t\t\t\tconst rollback = this.inverter(commit, true);\n\t\t\t\t// WARNING: it's not currently possible to roll back past a schema change (see AB#7265).\n\t\t\t\t// Either we have to make it possible to do so, or this logic will have to change to work\n\t\t\t\t// forwards from an earlier fork instead of backwards.\n\t\t\t\tcheckout.applyTipChange(rollback);\n\t\t\t}\n\t\t\t// Update the enrichments of the stale commits\n\t\t\tfor (\n\t\t\t\tlet iCommit = 0;\n\t\t\t\tiCommit <= this.latestInFlightCommitWithStaleEnrichments;\n\t\t\t\tiCommit += 1\n\t\t\t) {\n\t\t\t\tconst commit = toResubmit[iCommit] ?? oob();\n\t\t\t\tconst enrichedChange = checkout.updateChangeEnrichments(\n\t\t\t\t\tcommit.change,\n\t\t\t\t\tcommit.revision,\n\t\t\t\t);\n\t\t\t\tconst enrichedCommit = { ...commit, change: enrichedChange };\n\t\t\t\tthis.resubmitQueue.push(enrichedCommit);\n\t\t\t\tif (iCommit < this.latestInFlightCommitWithStaleEnrichments) {\n\t\t\t\t\tcheckout.applyTipChange(enrichedChange, commit.revision);\n\t\t\t\t}\n\t\t\t\tthis.inFlightQueue.shift();\n\t\t\t}\n\t\t\tcheckout[disposeSymbol]();\n\t\t\t// Whatever commits are left do not have stale enrichments\n\t\t\tfor (const commit of this.inFlightQueue) {\n\t\t\t\tthis.resubmitQueue.push(commit);\n\t\t\t}\n\t\t\tthis.inFlightQueue.length = 0;\n\t\t}\n\t\tthis.latestInFlightCommitWithStaleEnrichments = -1;\n\t}\n\n\tpublic peekNextCommit(): GraphCommit<TChange> {\n\t\tassert(\n\t\t\tthis.isInResubmitPhase,\n\t\t\t0x982 /* No available commit to resubmit outside of resubmit phase */,\n\t\t);\n\t\treturn this.resubmitQueue[0] ?? oob();\n\t}\n\n\tpublic get isInResubmitPhase(): boolean {\n\t\treturn this.resubmitQueue.length !== 0;\n\t}\n\n\tpublic onSequencedCommitApplied(isLocal: boolean): void {\n\t\tif (isLocal) {\n\t\t\t// The oldest in-flight commit has been sequenced\n\t\t\tassert(this.inFlightQueue.length > 0, 0x959 /* Sequencing of unknown local commit */);\n\t\t\tthis.inFlightQueue.shift();\n\t\t\tif (this.latestInFlightCommitWithStaleEnrichments >= 0) {\n\t\t\t\tthis.latestInFlightCommitWithStaleEnrichments -= 1;\n\t\t\t}\n\t\t} else {\n\t\t\t// A peer commit has been sequenced\n\t\t\tthis.latestInFlightCommitWithStaleEnrichments = this.inFlightQueue.length - 1;\n\t\t}\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"editManagerCodecs.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,UAAU,EAIf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EACX,qBAAqB,EACrB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,KAAK,sBAAsB,EAG3B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAQpD,MAAM,WAAW,0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AAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;CAClC;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAC9C,YAAY,EAAE,YAAY,CAAC,UAAU,EAAE,qBAAqB,CAAC,EAC7D,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,OAAO,EAAE,aAAa,EACtB,YAAY,EAAE,MAAM,GAClB,UAAU,CACZ,WAAW,CAAC,UAAU,CAAC,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,CAC1B,CAGA;AAED,wBAAgB,qBAAqB,CAAC,UAAU,EAC/C,YAAY,EAAE,YAAY,CAAC,UAAU,EAAE,qBAAqB,CAAC,EAC7D,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,OAAO,EAAE,aAAa,GACpB,YAAY,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,0BAA0B,CAAC,CAOnE"}
@@ -19,6 +19,7 @@ function makeEditManagerCodecs(changeCodecs, revisionTagCodec, options) {
19
19
  [1, makeV1CodecWithVersion(changeCodecs.resolve(1), revisionTagCodec, options, 1)],
20
20
  [2, makeV1CodecWithVersion(changeCodecs.resolve(2), revisionTagCodec, options, 2)],
21
21
  [3, makeV1CodecWithVersion(changeCodecs.resolve(3), revisionTagCodec, options, 3)],
22
+ [4, makeV1CodecWithVersion(changeCodecs.resolve(4), revisionTagCodec, options, 4)],
22
23
  ]);
23
24
  }
24
25
  exports.makeEditManagerCodecs = makeEditManagerCodecs;
@@ -1 +1 @@
1
- {"version":3,"file":"editManagerCodecs.js","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerCodecs.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,gDAO2B;AAC3B,gDAAgE;AAOhE,+CAI0B;AAG1B,iEAKgC;AAOhC,SAAgB,oBAAoB,CACnC,YAA6D,EAC7D,g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;wBACjF,YAAY,CAAC,MAA+C,EAAE;4BAC7D,YAAY,EAAE,MAAM,CAAC,SAAS;4BAC9B,YAAY,EAAE,OAAO,CAAC,YAAY;4BAClC,QAAQ,EAAE,SAAS;yBACnB,CAAC,CACF;qBACD;iBACD,CAAC,CACF;aACD,CAAC;QACH,CAAC;KACD,EACD,OAAO,CAAC,aAAa,CACrB,CAAC;IACF,2JAA2J;IAC3J,+DAA+D;IAC/D,mDAAmD;IACnD,OAAO,KAKN,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport {\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\ttype IMultiFormatCodec,\n\tmakeCodecFamily,\n\twithSchemaValidation,\n} from \"../codec/index.js\";\nimport { makeVersionDispatchingCodec } from \"../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tEncodedRevisionTag,\n\tRevisionTag,\n\tSchemaAndPolicy,\n} from \"../core/index.js\";\nimport {\n\ttype JsonCompatibleReadOnly,\n\tJsonCompatibleReadOnlySchema,\n\tmapIterable,\n} from \"../util/index.js\";\n\nimport type { SummaryData } from \"./editManager.js\";\nimport {\n\ttype Commit,\n\ttype EncodedCommit,\n\tEncodedEditManager,\n\ttype SequencedCommit,\n} from \"./editManagerFormat.js\";\n\nexport interface EditManagerEncodingContext {\n\tidCompressor: IIdCompressor;\n\treadonly schema?: SchemaAndPolicy;\n}\n\nexport function makeEditManagerCodec<TChangeset>(\n\tchangeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: ICodecOptions,\n\twriteVersion: number,\n): IJsonCodec<\n\tSummaryData<TChangeset>,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tEditManagerEncodingContext\n> {\n\tconst family = makeEditManagerCodecs(changeCodecs, revisionTagCodec, options);\n\treturn makeVersionDispatchingCodec(family, { ...options, writeVersion });\n}\n\nexport function makeEditManagerCodecs<TChangeset>(\n\tchangeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: ICodecOptions,\n): ICodecFamily<SummaryData<TChangeset>, EditManagerEncodingContext> {\n\treturn makeCodecFamily([\n\t\t[1, makeV1CodecWithVersion(changeCodecs.resolve(1), revisionTagCodec, options, 1)],\n\t\t[2, makeV1CodecWithVersion(changeCodecs.resolve(2), revisionTagCodec, options, 2)],\n\t\t[3, makeV1CodecWithVersion(changeCodecs.resolve(3), revisionTagCodec, options, 3)],\n\t]);\n}\n\nfunction makeV1CodecWithVersion<TChangeset>(\n\tchangeCodec: IMultiFormatCodec<\n\t\tTChangeset,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tChangeEncodingContext\n\t>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: ICodecOptions,\n\tversion: EncodedEditManager<TChangeset>[\"version\"],\n): IJsonCodec<\n\tSummaryData<TChangeset>,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tEditManagerEncodingContext\n> {\n\tconst format = EncodedEditManager(\n\t\tchangeCodec.json.encodedSchema ?? JsonCompatibleReadOnlySchema,\n\t);\n\n\tconst encodeCommit = <T extends Commit<TChangeset>>(\n\t\tcommit: T,\n\t\tcontext: ChangeEncodingContext,\n\t\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\t) => ({\n\t\t...commit,\n\t\trevision: revisionTagCodec.encode(commit.revision, {\n\t\t\toriginatorId: commit.sessionId,\n\t\t\tidCompressor: context.idCompressor,\n\t\t\trevision: undefined,\n\t\t}),\n\t\tchange: changeCodec.json.encode(commit.change, { ...context, revision: commit.revision }),\n\t});\n\n\tconst decodeCommit = <T extends EncodedCommit<JsonCompatibleReadOnly>>(\n\t\tcommit: T,\n\t\tcontext: ChangeEncodingContext,\n\t\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\t) => {\n\t\tconst revision = revisionTagCodec.decode(commit.revision, {\n\t\t\toriginatorId: commit.sessionId,\n\t\t\tidCompressor: context.idCompressor,\n\t\t\trevision: undefined,\n\t\t});\n\n\t\treturn {\n\t\t\t...commit,\n\t\t\trevision,\n\t\t\tchange: changeCodec.json.decode(commit.change, { ...context, revision }),\n\t\t};\n\t};\n\n\tconst codec: IJsonCodec<\n\t\tSummaryData<TChangeset>,\n\t\tEncodedEditManager<TChangeset>,\n\t\tEncodedEditManager<TChangeset>,\n\t\tEditManagerEncodingContext\n\t> = withSchemaValidation(\n\t\tformat,\n\t\t{\n\t\t\tencode: (data, context: EditManagerEncodingContext) => {\n\t\t\t\tconst json: EncodedEditManager<TChangeset> = {\n\t\t\t\t\ttrunk: data.trunk.map((commit) =>\n\t\t\t\t\t\tencodeCommit(commit, {\n\t\t\t\t\t\t\toriginatorId: commit.sessionId,\n\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t\tschema: context.schema,\n\t\t\t\t\t\t\trevision: undefined,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\tbranches: Array.from(data.peerLocalBranches.entries(), ([sessionId, branch]) => [\n\t\t\t\t\t\tsessionId,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tbase: revisionTagCodec.encode(branch.base, {\n\t\t\t\t\t\t\t\toriginatorId: sessionId,\n\t\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t\t\trevision: undefined,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tcommits: branch.commits.map((commit) =>\n\t\t\t\t\t\t\t\tencodeCommit(commit, {\n\t\t\t\t\t\t\t\t\toriginatorId: commit.sessionId,\n\t\t\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t\t\t\tschema: context.schema,\n\t\t\t\t\t\t\t\t\trevision: undefined,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t]),\n\t\t\t\t\tversion,\n\t\t\t\t};\n\t\t\t\treturn json;\n\t\t\t},\n\t\t\tdecode: (\n\t\t\t\tjson: EncodedEditManager<TChangeset>,\n\t\t\t\tcontext: EditManagerEncodingContext,\n\t\t\t): SummaryData<TChangeset> => {\n\t\t\t\t// TODO: sort out EncodedCommit vs Commit, and make this type check without `any`.\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\tconst trunk: readonly any[] = json.trunk;\n\t\t\t\treturn {\n\t\t\t\t\ttrunk: trunk.map(\n\t\t\t\t\t\t(commit): SequencedCommit<TChangeset> =>\n\t\t\t\t\t\t\t// TODO: sort out EncodedCommit vs Commit, and make this type check without `as`.\n\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\t\t\t\t\tdecodeCommit(commit, {\n\t\t\t\t\t\t\t\toriginatorId: commit.sessionId,\n\t\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t\t\trevision: undefined,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\tpeerLocalBranches: new Map(\n\t\t\t\t\t\tmapIterable(json.branches, ([sessionId, branch]) => [\n\t\t\t\t\t\t\tsessionId,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tbase: revisionTagCodec.decode(branch.base, {\n\t\t\t\t\t\t\t\t\toriginatorId: sessionId,\n\t\t\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t\t\t\trevision: undefined,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\tcommits: branch.commits.map((commit) =>\n\t\t\t\t\t\t\t\t\t// TODO: sort out EncodedCommit vs Commit, and make this type check without `as`.\n\t\t\t\t\t\t\t\t\tdecodeCommit(commit as EncodedCommit<JsonCompatibleReadOnly>, {\n\t\t\t\t\t\t\t\t\t\toriginatorId: commit.sessionId,\n\t\t\t\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t\t\t\t\trevision: undefined,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t\toptions.jsonValidator,\n\t);\n\t// TODO: makeVersionedValidatedCodec and withSchemaValidation should allow the codec to decode JsonCompatibleReadOnly, or Versioned or something like that,\n\t// and not leak the internal encoded format in the API surface.\n\t// Fixing that would remove the need for this cast.\n\treturn codec as unknown as IJsonCodec<\n\t\tSummaryData<TChangeset>,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tEditManagerEncodingContext\n\t>;\n}\n"]}
1
+ {"version":3,"file":"editManagerCodecs.js","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerCodecs.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,gDAO2B;AAC3B,gDAAgE;AAOhE,+CAI0B;AAG1B,iEAKgC;AAOhC,SAAgB,oBAAoB,CACnC,YAA6D,EAC7D,gBAKC,EACD,OAAsB,EACtB,YAAoB;IAOpB,MAAM,MAAM,GAAG,qBAAqB,CAAC,YAAY,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAAC;IAC9E,OAAO,IAAA,sCAA2B,EAAC,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;AAC1E,CAAC;AAlBD,oDAkBC;AAED,SAAgB,qBAAq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E,SAAS;yBACnB,CAAC,CACF;qBACD;iBACD,CAAC,CACF;aACD,CAAC;QACH,CAAC;KACD,EACD,OAAO,CAAC,aAAa,CACrB,CAAC;IACF,2JAA2J;IAC3J,+DAA+D;IAC/D,mDAAmD;IACnD,OAAO,KAKN,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport {\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\ttype IMultiFormatCodec,\n\tmakeCodecFamily,\n\twithSchemaValidation,\n} from \"../codec/index.js\";\nimport { makeVersionDispatchingCodec } from \"../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tEncodedRevisionTag,\n\tRevisionTag,\n\tSchemaAndPolicy,\n} from \"../core/index.js\";\nimport {\n\ttype JsonCompatibleReadOnly,\n\tJsonCompatibleReadOnlySchema,\n\tmapIterable,\n} from \"../util/index.js\";\n\nimport type { SummaryData } from \"./editManager.js\";\nimport {\n\ttype Commit,\n\ttype EncodedCommit,\n\tEncodedEditManager,\n\ttype SequencedCommit,\n} from \"./editManagerFormat.js\";\n\nexport interface EditManagerEncodingContext {\n\tidCompressor: IIdCompressor;\n\treadonly schema?: SchemaAndPolicy;\n}\n\nexport function makeEditManagerCodec<TChangeset>(\n\tchangeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: ICodecOptions,\n\twriteVersion: number,\n): IJsonCodec<\n\tSummaryData<TChangeset>,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tEditManagerEncodingContext\n> {\n\tconst family = makeEditManagerCodecs(changeCodecs, revisionTagCodec, options);\n\treturn makeVersionDispatchingCodec(family, { ...options, writeVersion });\n}\n\nexport function makeEditManagerCodecs<TChangeset>(\n\tchangeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: ICodecOptions,\n): ICodecFamily<SummaryData<TChangeset>, EditManagerEncodingContext> {\n\treturn makeCodecFamily([\n\t\t[1, makeV1CodecWithVersion(changeCodecs.resolve(1), revisionTagCodec, options, 1)],\n\t\t[2, makeV1CodecWithVersion(changeCodecs.resolve(2), revisionTagCodec, options, 2)],\n\t\t[3, makeV1CodecWithVersion(changeCodecs.resolve(3), revisionTagCodec, options, 3)],\n\t\t[4, makeV1CodecWithVersion(changeCodecs.resolve(4), revisionTagCodec, options, 4)],\n\t]);\n}\n\nfunction makeV1CodecWithVersion<TChangeset>(\n\tchangeCodec: IMultiFormatCodec<\n\t\tTChangeset,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tChangeEncodingContext\n\t>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: ICodecOptions,\n\tversion: EncodedEditManager<TChangeset>[\"version\"],\n): IJsonCodec<\n\tSummaryData<TChangeset>,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tEditManagerEncodingContext\n> {\n\tconst format = EncodedEditManager(\n\t\tchangeCodec.json.encodedSchema ?? JsonCompatibleReadOnlySchema,\n\t);\n\n\tconst encodeCommit = <T extends Commit<TChangeset>>(\n\t\tcommit: T,\n\t\tcontext: ChangeEncodingContext,\n\t\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\t) => ({\n\t\t...commit,\n\t\trevision: revisionTagCodec.encode(commit.revision, {\n\t\t\toriginatorId: commit.sessionId,\n\t\t\tidCompressor: context.idCompressor,\n\t\t\trevision: undefined,\n\t\t}),\n\t\tchange: changeCodec.json.encode(commit.change, { ...context, revision: commit.revision }),\n\t});\n\n\tconst decodeCommit = <T extends EncodedCommit<JsonCompatibleReadOnly>>(\n\t\tcommit: T,\n\t\tcontext: ChangeEncodingContext,\n\t\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\t) => {\n\t\tconst revision = revisionTagCodec.decode(commit.revision, {\n\t\t\toriginatorId: commit.sessionId,\n\t\t\tidCompressor: context.idCompressor,\n\t\t\trevision: undefined,\n\t\t});\n\n\t\treturn {\n\t\t\t...commit,\n\t\t\trevision,\n\t\t\tchange: changeCodec.json.decode(commit.change, { ...context, revision }),\n\t\t};\n\t};\n\n\tconst codec: IJsonCodec<\n\t\tSummaryData<TChangeset>,\n\t\tEncodedEditManager<TChangeset>,\n\t\tEncodedEditManager<TChangeset>,\n\t\tEditManagerEncodingContext\n\t> = withSchemaValidation(\n\t\tformat,\n\t\t{\n\t\t\tencode: (data, context: EditManagerEncodingContext) => {\n\t\t\t\tconst json: EncodedEditManager<TChangeset> = {\n\t\t\t\t\ttrunk: data.trunk.map((commit) =>\n\t\t\t\t\t\tencodeCommit(commit, {\n\t\t\t\t\t\t\toriginatorId: commit.sessionId,\n\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t\tschema: context.schema,\n\t\t\t\t\t\t\trevision: undefined,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\tbranches: Array.from(data.peerLocalBranches.entries(), ([sessionId, branch]) => [\n\t\t\t\t\t\tsessionId,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tbase: revisionTagCodec.encode(branch.base, {\n\t\t\t\t\t\t\t\toriginatorId: sessionId,\n\t\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t\t\trevision: undefined,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tcommits: branch.commits.map((commit) =>\n\t\t\t\t\t\t\t\tencodeCommit(commit, {\n\t\t\t\t\t\t\t\t\toriginatorId: commit.sessionId,\n\t\t\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t\t\t\tschema: context.schema,\n\t\t\t\t\t\t\t\t\trevision: undefined,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t]),\n\t\t\t\t\tversion,\n\t\t\t\t};\n\t\t\t\treturn json;\n\t\t\t},\n\t\t\tdecode: (\n\t\t\t\tjson: EncodedEditManager<TChangeset>,\n\t\t\t\tcontext: EditManagerEncodingContext,\n\t\t\t): SummaryData<TChangeset> => {\n\t\t\t\t// TODO: sort out EncodedCommit vs Commit, and make this type check without `any`.\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\tconst trunk: readonly any[] = json.trunk;\n\t\t\t\treturn {\n\t\t\t\t\ttrunk: trunk.map(\n\t\t\t\t\t\t(commit): SequencedCommit<TChangeset> =>\n\t\t\t\t\t\t\t// TODO: sort out EncodedCommit vs Commit, and make this type check without `as`.\n\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\t\t\t\t\tdecodeCommit(commit, {\n\t\t\t\t\t\t\t\toriginatorId: commit.sessionId,\n\t\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t\t\trevision: undefined,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\tpeerLocalBranches: new Map(\n\t\t\t\t\t\tmapIterable(json.branches, ([sessionId, branch]) => [\n\t\t\t\t\t\t\tsessionId,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tbase: revisionTagCodec.decode(branch.base, {\n\t\t\t\t\t\t\t\t\toriginatorId: sessionId,\n\t\t\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t\t\t\trevision: undefined,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\tcommits: branch.commits.map((commit) =>\n\t\t\t\t\t\t\t\t\t// TODO: sort out EncodedCommit vs Commit, and make this type check without `as`.\n\t\t\t\t\t\t\t\t\tdecodeCommit(commit as EncodedCommit<JsonCompatibleReadOnly>, {\n\t\t\t\t\t\t\t\t\t\toriginatorId: commit.sessionId,\n\t\t\t\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t\t\t\t\trevision: undefined,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t\toptions.jsonValidator,\n\t);\n\t// TODO: makeVersionedValidatedCodec and withSchemaValidation should allow the codec to decode JsonCompatibleReadOnly, or Versioned or something like that,\n\t// and not leak the internal encoded format in the API surface.\n\t// Fixing that would remove the need for this cast.\n\treturn codec as unknown as IJsonCodec<\n\t\tSummaryData<TChangeset>,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tEditManagerEncodingContext\n\t>;\n}\n"]}
@@ -51,10 +51,10 @@ export interface EncodedSummarySessionBranch<TChangeset> {
51
51
  export interface EncodedEditManager<TChangeset> {
52
52
  readonly trunk: readonly Readonly<SequencedCommit<TChangeset>>[];
53
53
  readonly branches: readonly [SessionId, Readonly<EncodedSummarySessionBranch<TChangeset>>][];
54
- readonly version: 1 | 2 | 3;
54
+ readonly version: 1 | 2 | 3 | 4;
55
55
  }
56
56
  export declare const EncodedEditManager: <ChangeSchema extends TSchema>(tChange: ChangeSchema) => import("@sinclair/typebox").TObject<{
57
- version: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<1>, import("@sinclair/typebox").TLiteral<2>, import("@sinclair/typebox").TLiteral<3>]>;
57
+ version: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<1>, import("@sinclair/typebox").TLiteral<2>, import("@sinclair/typebox").TLiteral<3>, import("@sinclair/typebox").TLiteral<4>]>;
58
58
  trunk: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
59
59
  revision: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"root">, import("@sinclair/typebox").TUnsafe<Brand<import("@fluidframework/id-compressor").OpSpaceCompressedId, "EncodedRevisionTag">>]>;
60
60
  change: import("@sinclair/typebox").TIntersectEvaluated<import("@sinclair/typebox").Assert<ChangeSchema, TSchema> extends infer T ? T extends import("@sinclair/typebox").Assert<ChangeSchema, TSchema> ? T extends import("@sinclair/typebox").TNever ? [] : [T] : never : never>;
@@ -1 +1 @@
1
- {"version":3,"file":"editManagerFormat.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerFormat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAsB,KAAK,MAAM,EAAE,KAAK,OAAO,EAAQ,MAAM,mBAAmB,CAAC;AAExF,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAGhB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,KAAK,EAAqB,MAAM,kBAAkB,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,WAAW,MAAM,CAAC,UAAU;IACjC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,+EAA+E;IAC/E,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;CAC9B;AAGD,MAAM,MAAM,aAAa,CAAC,UAAU,IAAI;IACvC,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;CAC9B,CAAC;AAoBF,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,EAAE,wBAAwB,C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AC,EAAE,CAAC;IACjE,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,SAAS,EAAE,QAAQ,CAAC,2BAA2B,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7F,QAAQ,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CAChC;AAED,eAAO,MAAM,kBAAkB,0CAA2C,YAAY;;;;;;;;;;;;;;;;;EAapF,CAAC"}
@@ -32,7 +32,12 @@ const SummarySessionBranch = (tChange) => typebox_1.Type.Object({
32
32
  commits: typebox_1.Type.Array(Commit(tChange)),
33
33
  }, noAdditionalProps);
34
34
  const EncodedEditManager = (tChange) => typebox_1.Type.Object({
35
- version: typebox_1.Type.Union([typebox_1.Type.Literal(1), typebox_1.Type.Literal(2), typebox_1.Type.Literal(3)]),
35
+ version: typebox_1.Type.Union([
36
+ typebox_1.Type.Literal(1),
37
+ typebox_1.Type.Literal(2),
38
+ typebox_1.Type.Literal(3),
39
+ typebox_1.Type.Literal(4),
40
+ ]),
36
41
  trunk: typebox_1.Type.Array(SequencedCommit(tChange)),
37
42
  branches: typebox_1.Type.Array(typebox_1.Type.Tuple([index_js_1.SessionIdSchema, SummarySessionBranch(tChange)])),
38
43
  }, noAdditionalProps);
@@ -1 +1 @@
1
- {"version":3,"file":"editManagerFormat.js","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerFormat.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+CAAwF;AAExF,+CAK0B;AAC1B,+CAAiE;AAsBjE,MAAM,iBAAiB,GAAkB,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC;AAEzE,uGAAuG;AACvG,qEAAqE;AAErE,MAAM,UAAU,GAAG,CAA+B,OAAqB,EAAE,EAAE,CAC1E,cAAI,CAAC,MAAM,CAAC;IACX,QAAQ,EAAE,4BAAiB;IAC3B,MAAM,EAAE,OAAO;IACf,SAAS,EAAE,0BAAe;CAC1B,CAAC,CAA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AK,CAAC,CAAC,0BAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;CAClF,EACD,iBAAiB,CACjB,CAAC;AARU,QAAA,kBAAkB,sBAQ5B;AAEH,oEAAoE","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SessionId } from \"@fluidframework/id-compressor\";\nimport { type ObjectOptions, type Static, type TSchema, Type } from \"@sinclair/typebox\";\n\nimport {\n\ttype EncodedRevisionTag,\n\ttype RevisionTag,\n\tRevisionTagSchema,\n\tSessionIdSchema,\n} from \"../core/index.js\";\nimport { type Brand, brandedNumberType } from \"../util/index.js\";\n\n/**\n * Contains a single change to the `SharedTree` and associated metadata.\n *\n * TODO: if this type is not used in the encoded format, move it out of this file, and stop using it in EncodedEditManager.\n * If this is an encoded format, clarify the difference between it and EncodedCommit.\n */\nexport interface Commit<TChangeset> {\n\treadonly revision: RevisionTag;\n\treadonly change: TChangeset;\n\t/** An identifier representing the session/user/client that made this commit */\n\treadonly sessionId: SessionId;\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type EncodedCommit<TChangeset> = {\n\treadonly revision: EncodedRevisionTag;\n\treadonly change: TChangeset;\n\treadonly sessionId: SessionId;\n};\n\nconst noAdditionalProps: ObjectOptions = { additionalProperties: false };\n\n// Many of the return types in this module are intentionally derived, rather than explicitly specified.\n/* eslint-disable @typescript-eslint/explicit-function-return-type */\n\nconst CommitBase = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Object({\n\t\trevision: RevisionTagSchema,\n\t\tchange: tChange,\n\t\tsessionId: SessionIdSchema,\n\t});\n/**\n * @privateRemarks Commits are generally encoded from `GraphCommit`s, which often contain extra data.\n * This `noAdditionalProps` is especially important in that light.\n */\nconst Commit = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Composite([CommitBase(tChange)], noAdditionalProps);\n\nexport type SeqNumber = Brand<number, \"edit-manager.SeqNumber\">;\nconst SeqNumber = brandedNumberType<SeqNumber>({ multipleOf: 1 });\n\nconst SequenceId = Type.Object({\n\tsequenceNumber: SeqNumber,\n\tindexInBatch: Type.Optional(Type.Number({ multipleOf: 1, minimum: 0 })),\n});\n\nexport type SequenceId = Static<typeof SequenceId>;\n\n/**\n * A commit with a sequence number but no parentage; used for serializing the `EditManager` into a summary\n */\nexport interface SequencedCommit<TChangeset> extends Commit<TChangeset>, SequenceId {}\n\nconst SequencedCommit = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Composite([CommitBase(tChange), SequenceId], noAdditionalProps);\n\n/**\n * A branch off of the trunk for use in summaries.\n *\n * TODO: if this type is not used in the encoded format, move it out of this file, and stop using it in EncodedEditManager.\n * If this is an encoded format, use EncodedCommit instead of Commit or clarify that Commit is also an encoded format.\n */\nexport interface SummarySessionBranch<TChangeset> {\n\treadonly base: RevisionTag;\n\treadonly commits: Commit<TChangeset>[];\n}\n\nexport interface EncodedSummarySessionBranch<TChangeset> {\n\treadonly base: EncodedRevisionTag;\n\treadonly commits: Commit<TChangeset>[];\n}\n\nconst SummarySessionBranch = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Object(\n\t\t{\n\t\t\tbase: RevisionTagSchema,\n\t\t\tcommits: Type.Array(Commit(tChange)),\n\t\t},\n\t\tnoAdditionalProps,\n\t);\n\nexport interface EncodedEditManager<TChangeset> {\n\treadonly trunk: readonly Readonly<SequencedCommit<TChangeset>>[];\n\treadonly branches: readonly [SessionId, Readonly<EncodedSummarySessionBranch<TChangeset>>][];\n\treadonly version: 1 | 2 | 3;\n}\n\nexport const EncodedEditManager = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Object(\n\t\t{\n\t\t\tversion: Type.Union([Type.Literal(1), Type.Literal(2), Type.Literal(3)]),\n\t\t\ttrunk: Type.Array(SequencedCommit(tChange)),\n\t\t\tbranches: Type.Array(Type.Tuple([SessionIdSchema, SummarySessionBranch(tChange)])),\n\t\t},\n\t\tnoAdditionalProps,\n\t);\n\n/* eslint-enable @typescript-eslint/explicit-function-return-type */\n"]}
1
+ {"version":3,"file":"editManagerFormat.js","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerFormat.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+CAAwF;AAExF,+CAK0B;AAC1B,+CAAiE;AAsBjE,MAAM,iBAAiB,GAAkB,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC;AAEzE,uGAAuG;AACvG,qEAAqE;AAErE,MAAM,UAAU,GAAG,CAA+B,OAAqB,EAAE,EAAE,CAC1E,cAAI,CAAC,MAAM,CAAC;IACX,QAAQ,EAAE,4BAAiB;IAC3B,MAAM,EAAE,OAAO;IACf,SAAS,EAAE,0BAAe;CAC1B,CAAC,CAAC;AACJ;;;GAGG;AACH,MAAM,MAAM,GAAG,CAA+B,OAAqB,EAAE,EAAE,CACtE,cAAI,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC;AAG1D,MAAM,SAAS,GAAG,IAAA,4BAAiB,EAAY,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;AAElE,MAAM,UAAU,GAAG,cAAI,CAAC,MAAM,CAAC;IAC9B,cAAc,EAAE,SAAS;IACzB,YAAY,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;CACvE,CAAC,CAAC;AASH,MAAM,eAAe,GAAG,CAA+B,OAAqB,EAAE,EAAE,CAC/E,cAAI,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,EAAE,iBAAiB,CAAC,CAAC;AAkBtE,MAAM,oBAAoB,GAAG,CAA+B,OAAqB,EAAE,EAAE,CACpF,cAAI,CAAC,MAAM,CACV;IACC,IAAI,EAAE,4BAAiB;IACvB,OAAO,EAAE,cAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;CACpC,EACD,iBAAiB,CACjB,CAAC;AAQI,MAAM,kBAAkB,GAAG,CAA+B,OAAqB,EAAE,EAAE,CACzF,cAAI,CAAC,MAAM,CACV;IACC,OAAO,EAAE,cAAI,CAAC,KAAK,CAAC;QACnB,cAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QACf,cAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QACf,cAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QACf,cAAI,CAAC,OAAO,CAAC,CAAC,CAAC;KACf,CAAC;IACF,KAAK,EAAE,cAAI,CAAC,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IAC3C,QAAQ,EAAE,cAAI,CAAC,KAAK,CAAC,cAAI,CAAC,KAAK,CAAC,CAAC,0BAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;CAClF,EACD,iBAAiB,CACjB,CAAC;AAbU,QAAA,kBAAkB,sBAa5B;AAEH,oEAAoE","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SessionId } from \"@fluidframework/id-compressor\";\nimport { type ObjectOptions, type Static, type TSchema, Type } from \"@sinclair/typebox\";\n\nimport {\n\ttype EncodedRevisionTag,\n\ttype RevisionTag,\n\tRevisionTagSchema,\n\tSessionIdSchema,\n} from \"../core/index.js\";\nimport { type Brand, brandedNumberType } from \"../util/index.js\";\n\n/**\n * Contains a single change to the `SharedTree` and associated metadata.\n *\n * TODO: if this type is not used in the encoded format, move it out of this file, and stop using it in EncodedEditManager.\n * If this is an encoded format, clarify the difference between it and EncodedCommit.\n */\nexport interface Commit<TChangeset> {\n\treadonly revision: RevisionTag;\n\treadonly change: TChangeset;\n\t/** An identifier representing the session/user/client that made this commit */\n\treadonly sessionId: SessionId;\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type EncodedCommit<TChangeset> = {\n\treadonly revision: EncodedRevisionTag;\n\treadonly change: TChangeset;\n\treadonly sessionId: SessionId;\n};\n\nconst noAdditionalProps: ObjectOptions = { additionalProperties: false };\n\n// Many of the return types in this module are intentionally derived, rather than explicitly specified.\n/* eslint-disable @typescript-eslint/explicit-function-return-type */\n\nconst CommitBase = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Object({\n\t\trevision: RevisionTagSchema,\n\t\tchange: tChange,\n\t\tsessionId: SessionIdSchema,\n\t});\n/**\n * @privateRemarks Commits are generally encoded from `GraphCommit`s, which often contain extra data.\n * This `noAdditionalProps` is especially important in that light.\n */\nconst Commit = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Composite([CommitBase(tChange)], noAdditionalProps);\n\nexport type SeqNumber = Brand<number, \"edit-manager.SeqNumber\">;\nconst SeqNumber = brandedNumberType<SeqNumber>({ multipleOf: 1 });\n\nconst SequenceId = Type.Object({\n\tsequenceNumber: SeqNumber,\n\tindexInBatch: Type.Optional(Type.Number({ multipleOf: 1, minimum: 0 })),\n});\n\nexport type SequenceId = Static<typeof SequenceId>;\n\n/**\n * A commit with a sequence number but no parentage; used for serializing the `EditManager` into a summary\n */\nexport interface SequencedCommit<TChangeset> extends Commit<TChangeset>, SequenceId {}\n\nconst SequencedCommit = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Composite([CommitBase(tChange), SequenceId], noAdditionalProps);\n\n/**\n * A branch off of the trunk for use in summaries.\n *\n * TODO: if this type is not used in the encoded format, move it out of this file, and stop using it in EncodedEditManager.\n * If this is an encoded format, use EncodedCommit instead of Commit or clarify that Commit is also an encoded format.\n */\nexport interface SummarySessionBranch<TChangeset> {\n\treadonly base: RevisionTag;\n\treadonly commits: Commit<TChangeset>[];\n}\n\nexport interface EncodedSummarySessionBranch<TChangeset> {\n\treadonly base: EncodedRevisionTag;\n\treadonly commits: Commit<TChangeset>[];\n}\n\nconst SummarySessionBranch = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Object(\n\t\t{\n\t\t\tbase: RevisionTagSchema,\n\t\t\tcommits: Type.Array(Commit(tChange)),\n\t\t},\n\t\tnoAdditionalProps,\n\t);\n\nexport interface EncodedEditManager<TChangeset> {\n\treadonly trunk: readonly Readonly<SequencedCommit<TChangeset>>[];\n\treadonly branches: readonly [SessionId, Readonly<EncodedSummarySessionBranch<TChangeset>>][];\n\treadonly version: 1 | 2 | 3 | 4;\n}\n\nexport const EncodedEditManager = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Object(\n\t\t{\n\t\t\tversion: Type.Union([\n\t\t\t\tType.Literal(1),\n\t\t\t\tType.Literal(2),\n\t\t\t\tType.Literal(3),\n\t\t\t\tType.Literal(4),\n\t\t\t]),\n\t\t\ttrunk: Type.Array(SequencedCommit(tChange)),\n\t\t\tbranches: Type.Array(Type.Tuple([SessionIdSchema, SummarySessionBranch(tChange)])),\n\t\t},\n\t\tnoAdditionalProps,\n\t);\n\n/* eslint-enable @typescript-eslint/explicit-function-return-type */\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"messageCodecs.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/messageCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,UAAU,EAIf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACX,qBAAqB,EAErB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAG/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,MAAM,WAAW,sBAAsB;IAC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Ae,CAAC;CACzB;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAC1C,YAAY,EAAE,YAAY,CAAC,UAAU,EAAE,qBAAqB,CAAC,EAC7D,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,OAAO,EAAE,aAAa,EACtB,YAAY,EAAE,MAAM,GAClB,UAAU,CACZ,cAAc,CAAC,UAAU,CAAC,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,CACtB,CAGA;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAC3C,YAAY,EAAE,YAAY,CAAC,UAAU,EAAE,qBAAqB,CAAC,EAC7D,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,OAAO,EAAE,aAAa,GACpB,YAAY,CAAC,cAAc,CAAC,UAAU,CAAC,EAAE,sBAAsB,CAAC,CAelE"}
@@ -24,6 +24,7 @@ function makeMessageCodecs(changeCodecs, revisionTagCodec, options) {
24
24
  [1, v1Codec],
25
25
  [2, makeV1CodecWithVersion(changeCodecs.resolve(2).json, revisionTagCodec, options, 2)],
26
26
  [3, makeV1CodecWithVersion(changeCodecs.resolve(3).json, revisionTagCodec, options, 3)],
27
+ [4, makeV1CodecWithVersion(changeCodecs.resolve(4).json, revisionTagCodec, options, 4)],
27
28
  ]);
28
29
  }
29
30
  exports.makeMessageCodecs = makeMessageCodecs;
@@ -1 +1 @@
1
- {"version":3,"file":"messageCodecs.js","sourceRoot":"","sources":["../../src/shared-tree-core/messageCodecs.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAA0D;AAE1D,gDAO2B;AAU3B,yDAA6C;AAS7C,SAAgB,gBAAgB,CAC/B,YAA6D,EAC7D,gBAKC,EACD,OAAsB,EACtB,YAAoB;IAOpB,MAAM,MAAM,GAAG,iBAAiB,CAAC,YAAY,EAAE,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ClC,QAAQ,EAAE,SAAS;iBACnB,CAAC;gBACF,YAAY;gBACZ,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;oBAC5C,YAAY;oBACZ,MAAM,EAAE,OAAO,CAAC,MAAM;oBACtB,YAAY,EAAE,OAAO,CAAC,YAAY;oBAClC,QAAQ,EAAE,MAAM,CAAC,QAAQ;iBACzB,CAAC;gBACF,OAAO;aACP,CAAC;YACF,OAAO,OAA4C,CAAC;QACrD,CAAC;QACD,MAAM,EAAE,CAAC,OAA+B,EAAE,OAA+B,EAAE,EAAE;YAC5E,MAAM,EACL,QAAQ,EAAE,eAAe,EACzB,YAAY,EACZ,SAAS,GACT,GAAG,OAA6B,CAAC;YAElC,MAAM,QAAQ,GAAG,gBAAgB,CAAC,MAAM,CAAC,eAAe,EAAE;gBACzD,YAAY;gBACZ,QAAQ,EAAE,SAAS;gBACnB,YAAY,EAAE,OAAO,CAAC,YAAY;aAClC,CAAC,CAAC;YAEH,OAAO;gBACN,MAAM,EAAE;oBACP,QAAQ;oBACR,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,SAAS,EAAE;wBACrC,YAAY;wBACZ,QAAQ;wBACR,YAAY,EAAE,OAAO,CAAC,YAAY;qBAClC,CAAC;iBACF;gBACD,SAAS,EAAE,YAAY;aACvB,CAAC;QACH,CAAC;KACD,EACD,OAAO,CAAC,aAAa,CACrB,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type TAnySchema, Type } from \"@sinclair/typebox\";\n\nimport {\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\tmakeCodecFamily,\n\tmakeVersionDispatchingCodec,\n\twithSchemaValidation,\n} from \"../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tChangeFamilyCodec,\n\tEncodedRevisionTag,\n\tRevisionTag,\n\tSchemaAndPolicy,\n} from \"../core/index.js\";\nimport type { JsonCompatibleReadOnly } from \"../util/index.js\";\n\nimport { Message } from \"./messageFormat.js\";\nimport type { DecodedMessage } from \"./messageTypes.js\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nexport interface MessageEncodingContext {\n\tidCompressor: IIdCompressor;\n\tschema?: SchemaAndPolicy;\n}\n\nexport function makeMessageCodec<TChangeset>(\n\tchangeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: ICodecOptions,\n\twriteVersion: number,\n): IJsonCodec<\n\tDecodedMessage<TChangeset>,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tMessageEncodingContext\n> {\n\tconst family = makeMessageCodecs(changeCodecs, revisionTagCodec, options);\n\treturn makeVersionDispatchingCodec(family, { ...options, writeVersion });\n}\n\n/**\n * @privateRemarks - Exported for testing.\n */\nexport function makeMessageCodecs<TChangeset>(\n\tchangeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: ICodecOptions,\n): ICodecFamily<DecodedMessage<TChangeset>, MessageEncodingContext> {\n\tconst v1Codec = makeV1CodecWithVersion(\n\t\tchangeCodecs.resolve(1).json,\n\t\trevisionTagCodec,\n\t\toptions,\n\t\t1,\n\t);\n\treturn makeCodecFamily([\n\t\t// Back-compat: messages weren't always written with an explicit version field.\n\t\t[undefined, v1Codec],\n\t\t[1, v1Codec],\n\t\t[2, makeV1CodecWithVersion(changeCodecs.resolve(2).json, revisionTagCodec, options, 2)],\n\t\t[3, makeV1CodecWithVersion(changeCodecs.resolve(3).json, revisionTagCodec, options, 3)],\n\t]);\n}\n\nfunction makeV1CodecWithVersion<TChangeset>(\n\tchangeCodec: ChangeFamilyCodec<TChangeset>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: ICodecOptions,\n\tversion: 1 | 2 | 3,\n): IJsonCodec<\n\tDecodedMessage<TChangeset>,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tMessageEncodingContext\n> {\n\treturn withSchemaValidation<\n\t\tDecodedMessage<TChangeset>,\n\t\tTAnySchema,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tMessageEncodingContext\n\t>(\n\t\tMessage(changeCodec.encodedSchema ?? Type.Any()),\n\t\t{\n\t\t\tencode: (\n\t\t\t\t{ commit, sessionId: originatorId }: DecodedMessage<TChangeset>,\n\t\t\t\tcontext: MessageEncodingContext,\n\t\t\t) => {\n\t\t\t\tconst message: Message = {\n\t\t\t\t\trevision: revisionTagCodec.encode(commit.revision, {\n\t\t\t\t\t\toriginatorId,\n\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\trevision: undefined,\n\t\t\t\t\t}),\n\t\t\t\t\toriginatorId,\n\t\t\t\t\tchangeset: changeCodec.encode(commit.change, {\n\t\t\t\t\t\toriginatorId,\n\t\t\t\t\t\tschema: context.schema,\n\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\trevision: commit.revision,\n\t\t\t\t\t}),\n\t\t\t\t\tversion,\n\t\t\t\t};\n\t\t\t\treturn message as unknown as JsonCompatibleReadOnly;\n\t\t\t},\n\t\t\tdecode: (encoded: JsonCompatibleReadOnly, context: MessageEncodingContext) => {\n\t\t\t\tconst {\n\t\t\t\t\trevision: encodedRevision,\n\t\t\t\t\toriginatorId,\n\t\t\t\t\tchangeset,\n\t\t\t\t} = encoded as unknown as Message;\n\n\t\t\t\tconst revision = revisionTagCodec.decode(encodedRevision, {\n\t\t\t\t\toriginatorId,\n\t\t\t\t\trevision: undefined,\n\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t});\n\n\t\t\t\treturn {\n\t\t\t\t\tcommit: {\n\t\t\t\t\t\trevision,\n\t\t\t\t\t\tchange: changeCodec.decode(changeset, {\n\t\t\t\t\t\t\toriginatorId,\n\t\t\t\t\t\t\trevision,\n\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t\tsessionId: originatorId,\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t\toptions.jsonValidator,\n\t);\n}\n"]}
1
+ {"version":3,"file":"messageCodecs.js","sourceRoot":"","sources":["../../src/shared-tree-core/messageCodecs.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAA0D;AAE1D,gDAO2B;AAU3B,yDAA6C;AAS7C,SAAgB,gBAAgB,CAC/B,YAA6D,EAC7D,gBAKC,EACD,OAAsB,EACtB,YAAoB;IAOpB,MAAM,MAAM,GAAG,iBAAiB,CAAC,YAAY,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAAC;IAC1E,OAAO,IAAA,sCAA2B,EAAC,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;AAC1E,CAAC;AAlBD,4CAkBC;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAChC,YAA6D,EAC7D,gBAKC,EACD,OAAsB;IAEtB,MAAM,OAAO,GAAG,sBAAsB,CACrC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAC5B,gBAAgB,EAChB,OAAO,EACP,CAAC,CACD,CAAC;IACF,OAAO,IAAA,0BAAe,EAAC;QACtB,+EAA+E;QAC/E,CAAC,SAAS,EAAE,OAAO,CAAC;QACpB,CAAC,CAAC,EAAE,OAAO,CAAC;QACZ,CAAC,CAAC,EAAE,sBAAsB,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CA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ACZ,SAAS,GACT,GAAG,OAA6B,CAAC;YAElC,MAAM,QAAQ,GAAG,gBAAgB,CAAC,MAAM,CAAC,eAAe,EAAE;gBACzD,YAAY;gBACZ,QAAQ,EAAE,SAAS;gBACnB,YAAY,EAAE,OAAO,CAAC,YAAY;aAClC,CAAC,CAAC;YAEH,OAAO;gBACN,MAAM,EAAE;oBACP,QAAQ;oBACR,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,SAAS,EAAE;wBACrC,YAAY;wBACZ,QAAQ;wBACR,YAAY,EAAE,OAAO,CAAC,YAAY;qBAClC,CAAC;iBACF;gBACD,SAAS,EAAE,YAAY;aACvB,CAAC;QACH,CAAC;KACD,EACD,OAAO,CAAC,aAAa,CACrB,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type TAnySchema, Type } from \"@sinclair/typebox\";\n\nimport {\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\tmakeCodecFamily,\n\tmakeVersionDispatchingCodec,\n\twithSchemaValidation,\n} from \"../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tChangeFamilyCodec,\n\tEncodedRevisionTag,\n\tRevisionTag,\n\tSchemaAndPolicy,\n} from \"../core/index.js\";\nimport type { JsonCompatibleReadOnly } from \"../util/index.js\";\n\nimport { Message } from \"./messageFormat.js\";\nimport type { DecodedMessage } from \"./messageTypes.js\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nexport interface MessageEncodingContext {\n\tidCompressor: IIdCompressor;\n\tschema?: SchemaAndPolicy;\n}\n\nexport function makeMessageCodec<TChangeset>(\n\tchangeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: ICodecOptions,\n\twriteVersion: number,\n): IJsonCodec<\n\tDecodedMessage<TChangeset>,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tMessageEncodingContext\n> {\n\tconst family = makeMessageCodecs(changeCodecs, revisionTagCodec, options);\n\treturn makeVersionDispatchingCodec(family, { ...options, writeVersion });\n}\n\n/**\n * @privateRemarks - Exported for testing.\n */\nexport function makeMessageCodecs<TChangeset>(\n\tchangeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: ICodecOptions,\n): ICodecFamily<DecodedMessage<TChangeset>, MessageEncodingContext> {\n\tconst v1Codec = makeV1CodecWithVersion(\n\t\tchangeCodecs.resolve(1).json,\n\t\trevisionTagCodec,\n\t\toptions,\n\t\t1,\n\t);\n\treturn makeCodecFamily([\n\t\t// Back-compat: messages weren't always written with an explicit version field.\n\t\t[undefined, v1Codec],\n\t\t[1, v1Codec],\n\t\t[2, makeV1CodecWithVersion(changeCodecs.resolve(2).json, revisionTagCodec, options, 2)],\n\t\t[3, makeV1CodecWithVersion(changeCodecs.resolve(3).json, revisionTagCodec, options, 3)],\n\t\t[4, makeV1CodecWithVersion(changeCodecs.resolve(4).json, revisionTagCodec, options, 4)],\n\t]);\n}\n\nfunction makeV1CodecWithVersion<TChangeset>(\n\tchangeCodec: ChangeFamilyCodec<TChangeset>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: ICodecOptions,\n\tversion: 1 | 2 | 3 | 4,\n): IJsonCodec<\n\tDecodedMessage<TChangeset>,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tMessageEncodingContext\n> {\n\treturn withSchemaValidation<\n\t\tDecodedMessage<TChangeset>,\n\t\tTAnySchema,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tMessageEncodingContext\n\t>(\n\t\tMessage(changeCodec.encodedSchema ?? Type.Any()),\n\t\t{\n\t\t\tencode: (\n\t\t\t\t{ commit, sessionId: originatorId }: DecodedMessage<TChangeset>,\n\t\t\t\tcontext: MessageEncodingContext,\n\t\t\t) => {\n\t\t\t\tconst message: Message = {\n\t\t\t\t\trevision: revisionTagCodec.encode(commit.revision, {\n\t\t\t\t\t\toriginatorId,\n\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\trevision: undefined,\n\t\t\t\t\t}),\n\t\t\t\t\toriginatorId,\n\t\t\t\t\tchangeset: changeCodec.encode(commit.change, {\n\t\t\t\t\t\toriginatorId,\n\t\t\t\t\t\tschema: context.schema,\n\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\trevision: commit.revision,\n\t\t\t\t\t}),\n\t\t\t\t\tversion,\n\t\t\t\t};\n\t\t\t\treturn message as unknown as JsonCompatibleReadOnly;\n\t\t\t},\n\t\t\tdecode: (encoded: JsonCompatibleReadOnly, context: MessageEncodingContext) => {\n\t\t\t\tconst {\n\t\t\t\t\trevision: encodedRevision,\n\t\t\t\t\toriginatorId,\n\t\t\t\t\tchangeset,\n\t\t\t\t} = encoded as unknown as Message;\n\n\t\t\t\tconst revision = revisionTagCodec.decode(encodedRevision, {\n\t\t\t\t\toriginatorId,\n\t\t\t\t\trevision: undefined,\n\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t});\n\n\t\t\t\treturn {\n\t\t\t\t\tcommit: {\n\t\t\t\t\t\trevision,\n\t\t\t\t\t\tchange: changeCodec.decode(changeset, {\n\t\t\t\t\t\t\toriginatorId,\n\t\t\t\t\t\t\trevision,\n\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t\tsessionId: originatorId,\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t\toptions.jsonValidator,\n\t);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeCore.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/sharedTreeCore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACX,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,gDAAgD,CAAC;AAExD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAC7F,OAAO,KAAK,EACX,sCAAsC,EACtC,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,8CAA8C,CAAC;AAEtD,OAAO,EACN,KAAK,gBAAgB,EACrB,YAAY,EACZ,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,mBAAmB,CAAC;AACnE,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,kBAAkB,EAEvB,KAAK,WAAW,EAEhB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAC/B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,KAAK,sBAAsB,EAE3B,SAAS,EACT,KAAK,aAAa,EAGlB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,KAAK,gBAAgB,EAAwB,MAAM,aAAa,CAAC;AAO1E,OAAO,EAAE,KAAK,8BAA8B,EAAsB,MAAM,qBAAqB,CAAC;AAC9F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAMjE,MAAM,WAAW,yBAAyB;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,uBAAwB,SAAQ,eAAe;IAC/D,MAAM,EAAE,0BAA0B,CAAC;CACnC;AAED;;GAEG;AACH,qBACa,cAAc,CAAC,OAAO,SAAS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GH,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,sBAAsB,CAAC;IAEpD;;;;;OAKG;IACH,IAAI,CAAC,OAAO,EAAE,sBAAsB,EAAE,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClF;AAED;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,QAAQ,EAAE,OAAO,KAAK,MAAM,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC"}
@@ -153,7 +153,7 @@ let SharedTreeCore = (() => {
153
153
  (0, branch_js_1.getChangeReplaceType)(change) === "transactionCommit" &&
154
154
  !this.getLocalBranch().isTransacting()) {
155
155
  (0, internal_1.assert)(change.newCommits.length === 1, 0x983 /* Unexpected number of commits when committing transaction */);
156
- this.commitEnricher.prepareCommit(change.newCommits[0], true);
156
+ this.commitEnricher.prepareCommit(change.newCommits[0] ?? (0, internal_1.oob)(), true);
157
157
  }
158
158
  });
159
159
  this.editManager.localBranch.on("afterChange", (change) => {
@@ -291,6 +291,8 @@ let SharedTreeCore = (() => {
291
291
  for (const [id, routes] of Object.entries(s.getGCData(fullGC).gcNodes)) {
292
292
  gcNodes[id] ?? (gcNodes[id] = []);
293
293
  for (const route of routes) {
294
+ // Non null asserting here because we are creating an array at gcNodes[id] if it is undefined
295
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
294
296
  gcNodes[id].push(route);
295
297
  }
296
298
  }