@fluidframework/tree 2.30.0 → 2.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (660) hide show
  1. package/CHANGELOG.md +1632 -1500
  2. package/api-extractor/api-extractor.current.json +0 -3
  3. package/api-report/tree.alpha.api.md +233 -88
  4. package/api-report/tree.beta.api.md +86 -61
  5. package/api-report/tree.legacy.alpha.api.md +86 -61
  6. package/api-report/tree.legacy.public.api.md +86 -61
  7. package/api-report/tree.public.api.md +86 -61
  8. package/dist/alpha.d.ts +26 -1
  9. package/dist/beta.d.ts +5 -1
  10. package/dist/codec/codec.d.ts +1 -1
  11. package/dist/codec/codec.d.ts.map +1 -1
  12. package/dist/codec/codec.js +3 -4
  13. package/dist/codec/codec.js.map +1 -1
  14. package/dist/codec/discriminatedUnions.d.ts.map +1 -1
  15. package/dist/codec/discriminatedUnions.js +1 -1
  16. package/dist/codec/discriminatedUnions.js.map +1 -1
  17. package/dist/core/rebase/utils.js +1 -1
  18. package/dist/core/rebase/utils.js.map +1 -1
  19. package/dist/core/schema-stored/schema.d.ts +4 -1
  20. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  21. package/dist/core/schema-stored/schema.js +8 -4
  22. package/dist/core/schema-stored/schema.js.map +1 -1
  23. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  24. package/dist/core/tree/anchorSet.js +4 -4
  25. package/dist/core/tree/anchorSet.js.map +1 -1
  26. package/dist/core/tree/treeTextFormat.js +2 -2
  27. package/dist/core/tree/treeTextFormat.js.map +1 -1
  28. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  29. package/dist/feature-libraries/chunked-forest/basicChunk.js +8 -8
  30. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  31. package/dist/feature-libraries/chunked-forest/chunkTree.js +2 -2
  32. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  33. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  34. package/dist/feature-libraries/chunked-forest/chunkedForest.js +3 -3
  35. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  36. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +3 -3
  37. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  38. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +3 -3
  39. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  40. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js +2 -2
  41. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  42. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  43. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +3 -4
  44. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  45. package/dist/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
  46. package/dist/feature-libraries/chunked-forest/emptyChunk.js +15 -15
  47. package/dist/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  48. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  49. package/dist/feature-libraries/chunked-forest/uniformChunk.js +4 -4
  50. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  51. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  52. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +19 -19
  53. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  54. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  55. package/dist/feature-libraries/default-schema/schemaChecker.js +1 -2
  56. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  57. package/dist/feature-libraries/flex-tree/lazyField.js +3 -3
  58. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  59. package/dist/feature-libraries/flex-tree/lazyNode.js +4 -4
  60. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  61. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  62. package/dist/feature-libraries/indexing/anchorTreeIndex.js +1 -1
  63. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  64. package/dist/feature-libraries/modular-schema/comparison.js +4 -4
  65. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  66. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  67. package/dist/feature-libraries/modular-schema/isNeverTree.js +2 -3
  68. package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  69. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  70. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +4 -4
  71. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  72. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  73. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +4 -4
  74. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  75. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js +1 -1
  76. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
  77. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  78. package/dist/feature-libraries/object-forest/objectForest.js +1 -1
  79. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  80. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  81. package/dist/feature-libraries/schema-index/codec.js +2 -1
  82. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  83. package/dist/feature-libraries/sequence-field/compose.d.ts +1 -1
  84. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  85. package/dist/feature-libraries/sequence-field/compose.js +16 -17
  86. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  87. package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  88. package/dist/feature-libraries/sequence-field/invert.js +1 -1
  89. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  90. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  91. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
  92. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  93. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  94. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
  95. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  96. package/dist/feature-libraries/sequence-field/utils.js +1 -1
  97. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  98. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  99. package/dist/feature-libraries/treeCursorUtils.js +4 -5
  100. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  101. package/dist/index.d.ts +4 -3
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.js +8 -4
  104. package/dist/index.js.map +1 -1
  105. package/dist/jsonDomainSchema.d.ts +15 -16
  106. package/dist/jsonDomainSchema.d.ts.map +1 -1
  107. package/dist/jsonDomainSchema.js +10 -5
  108. package/dist/jsonDomainSchema.js.map +1 -1
  109. package/dist/legacy.d.ts +5 -1
  110. package/dist/packageVersion.d.ts +1 -1
  111. package/dist/packageVersion.js +1 -1
  112. package/dist/packageVersion.js.map +1 -1
  113. package/dist/public.d.ts +5 -1
  114. package/dist/serializableDomainSchema.d.ts +8 -14
  115. package/dist/serializableDomainSchema.d.ts.map +1 -1
  116. package/dist/shared-tree/schematizeTree.js +1 -1
  117. package/dist/shared-tree/schematizeTree.js.map +1 -1
  118. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  119. package/dist/shared-tree/sharedTree.js +16 -12
  120. package/dist/shared-tree/sharedTree.js.map +1 -1
  121. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  122. package/dist/shared-tree/sharedTreeChangeFamily.js +1 -1
  123. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  124. package/dist/shared-tree/treeApiAlpha.d.ts +6 -2
  125. package/dist/shared-tree/treeApiAlpha.d.ts.map +1 -1
  126. package/dist/shared-tree/treeApiAlpha.js +20 -17
  127. package/dist/shared-tree/treeApiAlpha.js.map +1 -1
  128. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  129. package/dist/shared-tree/treeCheckout.js +1 -1
  130. package/dist/shared-tree/treeCheckout.js.map +1 -1
  131. package/dist/shared-tree-core/branch.d.ts +4 -3
  132. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  133. package/dist/shared-tree-core/branch.js +2 -2
  134. package/dist/shared-tree-core/branch.js.map +1 -1
  135. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  136. package/dist/shared-tree-core/editManager.js +37 -31
  137. package/dist/shared-tree-core/editManager.js.map +1 -1
  138. package/dist/sharedTreeAttributes.d.ts +18 -0
  139. package/dist/sharedTreeAttributes.d.ts.map +1 -0
  140. package/dist/sharedTreeAttributes.js +25 -0
  141. package/dist/sharedTreeAttributes.js.map +1 -0
  142. package/dist/simple-tree/api/customTree.js +3 -3
  143. package/dist/simple-tree/api/customTree.js.map +1 -1
  144. package/dist/simple-tree/api/getJsonSchema.d.ts +10 -0
  145. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  146. package/dist/simple-tree/api/getJsonSchema.js +10 -0
  147. package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
  148. package/dist/simple-tree/api/getSimpleSchema.d.ts +13 -43
  149. package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  150. package/dist/simple-tree/api/getSimpleSchema.js +13 -43
  151. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
  152. package/dist/simple-tree/api/index.d.ts +3 -3
  153. package/dist/simple-tree/api/index.d.ts.map +1 -1
  154. package/dist/simple-tree/api/index.js +3 -1
  155. package/dist/simple-tree/api/index.js.map +1 -1
  156. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  157. package/dist/simple-tree/api/schemaCreationUtilities.js +2 -2
  158. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  159. package/dist/simple-tree/api/schemaFactory.d.ts +100 -58
  160. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  161. package/dist/simple-tree/api/schemaFactory.js +65 -133
  162. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  163. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +31 -23
  164. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  165. package/dist/simple-tree/api/schemaFactoryAlpha.js +17 -1
  166. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  167. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +40 -5
  168. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  169. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  170. package/dist/simple-tree/api/schemaFromSimple.d.ts +4 -4
  171. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  172. package/dist/simple-tree/api/schemaFromSimple.js +26 -15
  173. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  174. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts +3 -2
  175. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  176. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +7 -6
  177. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  178. package/dist/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
  179. package/dist/simple-tree/api/simpleTreeIndex.js +4 -3
  180. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  181. package/dist/simple-tree/api/testRecursiveDomain.d.ts +10 -10
  182. package/dist/simple-tree/api/tree.d.ts +1 -1
  183. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  184. package/dist/simple-tree/api/tree.js +6 -6
  185. package/dist/simple-tree/api/tree.js.map +1 -1
  186. package/dist/simple-tree/api/treeNodeApi.js +3 -3
  187. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  188. package/dist/simple-tree/api/typesUnsafe.d.ts +87 -21
  189. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  190. package/dist/simple-tree/api/typesUnsafe.js +0 -1
  191. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  192. package/dist/simple-tree/api/verboseTree.js +4 -4
  193. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  194. package/dist/simple-tree/api/view.d.ts.map +1 -1
  195. package/dist/simple-tree/api/view.js +16 -17
  196. package/dist/simple-tree/api/view.js.map +1 -1
  197. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +16 -3
  198. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  199. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +70 -147
  200. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  201. package/dist/simple-tree/arrayNode.d.ts +5 -4
  202. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  203. package/dist/simple-tree/arrayNode.js +13 -9
  204. package/dist/simple-tree/arrayNode.js.map +1 -1
  205. package/dist/simple-tree/arrayNodeTypes.d.ts +46 -0
  206. package/dist/simple-tree/arrayNodeTypes.d.ts.map +1 -0
  207. package/dist/simple-tree/arrayNodeTypes.js +30 -0
  208. package/dist/simple-tree/arrayNodeTypes.js.map +1 -0
  209. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  210. package/dist/simple-tree/core/getOrCreateNode.js +1 -11
  211. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  212. package/dist/simple-tree/core/index.d.ts +1 -2
  213. package/dist/simple-tree/core/index.d.ts.map +1 -1
  214. package/dist/simple-tree/core/index.js +2 -3
  215. package/dist/simple-tree/core/index.js.map +1 -1
  216. package/dist/simple-tree/core/treeNodeKernel.d.ts +12 -5
  217. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  218. package/dist/simple-tree/core/treeNodeKernel.js +36 -20
  219. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  220. package/dist/simple-tree/core/treeNodeSchema.d.ts +14 -7
  221. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  222. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  223. package/dist/simple-tree/core/unhydratedFlexTree.js +5 -5
  224. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  225. package/dist/simple-tree/index.d.ts +9 -2
  226. package/dist/simple-tree/index.d.ts.map +1 -1
  227. package/dist/simple-tree/index.js +9 -1
  228. package/dist/simple-tree/index.js.map +1 -1
  229. package/dist/simple-tree/leafNodeSchema.d.ts +22 -5
  230. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  231. package/dist/simple-tree/leafNodeSchema.js +2 -0
  232. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  233. package/dist/simple-tree/mapNode.d.ts +3 -2
  234. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  235. package/dist/simple-tree/mapNode.js +5 -1
  236. package/dist/simple-tree/mapNode.js.map +1 -1
  237. package/dist/simple-tree/mapNodeTypes.d.ts +46 -0
  238. package/dist/simple-tree/mapNodeTypes.d.ts.map +1 -0
  239. package/dist/simple-tree/mapNodeTypes.js +30 -0
  240. package/dist/simple-tree/mapNodeTypes.js.map +1 -0
  241. package/dist/simple-tree/objectNode.d.ts +10 -3
  242. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  243. package/dist/simple-tree/objectNode.js +10 -5
  244. package/dist/simple-tree/objectNode.js.map +1 -1
  245. package/dist/simple-tree/objectNodeTypes.d.ts +9 -5
  246. package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -1
  247. package/dist/simple-tree/objectNodeTypes.js +3 -0
  248. package/dist/simple-tree/objectNodeTypes.js.map +1 -1
  249. package/dist/simple-tree/proxies.js +2 -1
  250. package/dist/simple-tree/proxies.js.map +1 -1
  251. package/dist/simple-tree/schemaTypes.d.ts +47 -6
  252. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  253. package/dist/simple-tree/schemaTypes.js +40 -4
  254. package/dist/simple-tree/schemaTypes.js.map +1 -1
  255. package/dist/simple-tree/{api/simpleSchema.d.ts → simpleSchema.d.ts} +54 -30
  256. package/dist/simple-tree/simpleSchema.d.ts.map +1 -0
  257. package/dist/simple-tree/simpleSchema.js.map +1 -0
  258. package/dist/simple-tree/toMapTree.js +3 -3
  259. package/dist/simple-tree/toMapTree.js.map +1 -1
  260. package/dist/simple-tree/toStoredSchema.js +1 -1
  261. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  262. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  263. package/dist/simple-tree/treeNodeValid.js +4 -5
  264. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  265. package/dist/treeFactory.d.ts +0 -12
  266. package/dist/treeFactory.d.ts.map +1 -1
  267. package/dist/treeFactory.js +5 -21
  268. package/dist/treeFactory.js.map +1 -1
  269. package/dist/util/idAllocator.d.ts.map +1 -1
  270. package/dist/util/idAllocator.js +1 -2
  271. package/dist/util/idAllocator.js.map +1 -1
  272. package/dist/util/index.d.ts +1 -1
  273. package/dist/util/index.d.ts.map +1 -1
  274. package/dist/util/index.js +2 -3
  275. package/dist/util/index.js.map +1 -1
  276. package/dist/util/typeCheck.d.ts +7 -0
  277. package/dist/util/typeCheck.d.ts.map +1 -1
  278. package/dist/util/typeCheck.js.map +1 -1
  279. package/dist/util/utils.d.ts +0 -1
  280. package/dist/util/utils.d.ts.map +1 -1
  281. package/dist/util/utils.js +1 -4
  282. package/dist/util/utils.js.map +1 -1
  283. package/lib/alpha.d.ts +26 -1
  284. package/lib/beta.d.ts +5 -1
  285. package/lib/codec/codec.d.ts +1 -1
  286. package/lib/codec/codec.d.ts.map +1 -1
  287. package/lib/codec/codec.js +1 -2
  288. package/lib/codec/codec.js.map +1 -1
  289. package/lib/codec/discriminatedUnions.d.ts.map +1 -1
  290. package/lib/codec/discriminatedUnions.js +2 -2
  291. package/lib/codec/discriminatedUnions.js.map +1 -1
  292. package/lib/core/rebase/utils.js +1 -1
  293. package/lib/core/rebase/utils.js.map +1 -1
  294. package/lib/core/schema-stored/schema.d.ts +4 -1
  295. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  296. package/lib/core/schema-stored/schema.js +6 -2
  297. package/lib/core/schema-stored/schema.js.map +1 -1
  298. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  299. package/lib/core/tree/anchorSet.js +2 -2
  300. package/lib/core/tree/anchorSet.js.map +1 -1
  301. package/lib/core/tree/treeTextFormat.js +1 -1
  302. package/lib/core/tree/treeTextFormat.js.map +1 -1
  303. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  304. package/lib/feature-libraries/chunked-forest/basicChunk.js +2 -2
  305. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  306. package/lib/feature-libraries/chunked-forest/chunkTree.js +2 -2
  307. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  308. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  309. package/lib/feature-libraries/chunked-forest/chunkedForest.js +2 -2
  310. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  311. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +1 -1
  312. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  313. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +2 -2
  314. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  315. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js +2 -2
  316. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  317. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  318. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +1 -2
  319. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  320. package/lib/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
  321. package/lib/feature-libraries/chunked-forest/emptyChunk.js +1 -1
  322. package/lib/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  323. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  324. package/lib/feature-libraries/chunked-forest/uniformChunk.js +2 -2
  325. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  326. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  327. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
  328. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  329. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  330. package/lib/feature-libraries/default-schema/schemaChecker.js +1 -2
  331. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  332. package/lib/feature-libraries/flex-tree/lazyField.js +2 -2
  333. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  334. package/lib/feature-libraries/flex-tree/lazyNode.js +2 -2
  335. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  336. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  337. package/lib/feature-libraries/indexing/anchorTreeIndex.js +2 -2
  338. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  339. package/lib/feature-libraries/modular-schema/comparison.js +2 -2
  340. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  341. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  342. package/lib/feature-libraries/modular-schema/isNeverTree.js +1 -2
  343. package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  344. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  345. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +2 -2
  346. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  347. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  348. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +2 -2
  349. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  350. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js +2 -2
  351. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
  352. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  353. package/lib/feature-libraries/object-forest/objectForest.js +2 -2
  354. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  355. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  356. package/lib/feature-libraries/schema-index/codec.js +2 -1
  357. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  358. package/lib/feature-libraries/sequence-field/compose.d.ts +1 -1
  359. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  360. package/lib/feature-libraries/sequence-field/compose.js +1 -2
  361. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  362. package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  363. package/lib/feature-libraries/sequence-field/invert.js +2 -2
  364. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  365. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  366. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +2 -2
  367. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  368. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  369. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +2 -2
  370. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  371. package/lib/feature-libraries/sequence-field/utils.js +2 -2
  372. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  373. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  374. package/lib/feature-libraries/treeCursorUtils.js +1 -2
  375. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  376. package/lib/index.d.ts +4 -3
  377. package/lib/index.d.ts.map +1 -1
  378. package/lib/index.js +4 -3
  379. package/lib/index.js.map +1 -1
  380. package/lib/jsonDomainSchema.d.ts +15 -16
  381. package/lib/jsonDomainSchema.d.ts.map +1 -1
  382. package/lib/jsonDomainSchema.js +11 -6
  383. package/lib/jsonDomainSchema.js.map +1 -1
  384. package/lib/legacy.d.ts +5 -1
  385. package/lib/packageVersion.d.ts +1 -1
  386. package/lib/packageVersion.js +1 -1
  387. package/lib/packageVersion.js.map +1 -1
  388. package/lib/public.d.ts +5 -1
  389. package/lib/serializableDomainSchema.d.ts +8 -14
  390. package/lib/serializableDomainSchema.d.ts.map +1 -1
  391. package/lib/shared-tree/schematizeTree.js +2 -2
  392. package/lib/shared-tree/schematizeTree.js.map +1 -1
  393. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  394. package/lib/shared-tree/sharedTree.js +14 -10
  395. package/lib/shared-tree/sharedTree.js.map +1 -1
  396. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  397. package/lib/shared-tree/sharedTreeChangeFamily.js +2 -2
  398. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  399. package/lib/shared-tree/treeApiAlpha.d.ts +6 -2
  400. package/lib/shared-tree/treeApiAlpha.d.ts.map +1 -1
  401. package/lib/shared-tree/treeApiAlpha.js +10 -7
  402. package/lib/shared-tree/treeApiAlpha.js.map +1 -1
  403. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  404. package/lib/shared-tree/treeCheckout.js +2 -2
  405. package/lib/shared-tree/treeCheckout.js.map +1 -1
  406. package/lib/shared-tree-core/branch.d.ts +4 -3
  407. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  408. package/lib/shared-tree-core/branch.js +2 -2
  409. package/lib/shared-tree-core/branch.js.map +1 -1
  410. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  411. package/lib/shared-tree-core/editManager.js +35 -29
  412. package/lib/shared-tree-core/editManager.js.map +1 -1
  413. package/lib/sharedTreeAttributes.d.ts +18 -0
  414. package/lib/sharedTreeAttributes.d.ts.map +1 -0
  415. package/lib/sharedTreeAttributes.js +22 -0
  416. package/lib/sharedTreeAttributes.js.map +1 -0
  417. package/lib/simple-tree/api/customTree.js +2 -2
  418. package/lib/simple-tree/api/customTree.js.map +1 -1
  419. package/lib/simple-tree/api/getJsonSchema.d.ts +10 -0
  420. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  421. package/lib/simple-tree/api/getJsonSchema.js +10 -0
  422. package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
  423. package/lib/simple-tree/api/getSimpleSchema.d.ts +13 -43
  424. package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  425. package/lib/simple-tree/api/getSimpleSchema.js +13 -43
  426. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
  427. package/lib/simple-tree/api/index.d.ts +3 -3
  428. package/lib/simple-tree/api/index.d.ts.map +1 -1
  429. package/lib/simple-tree/api/index.js +1 -0
  430. package/lib/simple-tree/api/index.js.map +1 -1
  431. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  432. package/lib/simple-tree/api/schemaCreationUtilities.js +1 -1
  433. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  434. package/lib/simple-tree/api/schemaFactory.d.ts +100 -58
  435. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  436. package/lib/simple-tree/api/schemaFactory.js +64 -132
  437. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  438. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +31 -23
  439. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  440. package/lib/simple-tree/api/schemaFactoryAlpha.js +18 -2
  441. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  442. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +40 -5
  443. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  444. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  445. package/lib/simple-tree/api/schemaFromSimple.d.ts +4 -4
  446. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  447. package/lib/simple-tree/api/schemaFromSimple.js +21 -10
  448. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  449. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts +3 -2
  450. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  451. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +6 -6
  452. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  453. package/lib/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
  454. package/lib/simple-tree/api/simpleTreeIndex.js +2 -1
  455. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  456. package/lib/simple-tree/api/testRecursiveDomain.d.ts +10 -10
  457. package/lib/simple-tree/api/tree.d.ts +1 -1
  458. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  459. package/lib/simple-tree/api/tree.js +2 -2
  460. package/lib/simple-tree/api/tree.js.map +1 -1
  461. package/lib/simple-tree/api/treeNodeApi.js +2 -2
  462. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  463. package/lib/simple-tree/api/typesUnsafe.d.ts +87 -21
  464. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  465. package/lib/simple-tree/api/typesUnsafe.js +0 -1
  466. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  467. package/lib/simple-tree/api/verboseTree.js +2 -2
  468. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  469. package/lib/simple-tree/api/view.d.ts.map +1 -1
  470. package/lib/simple-tree/api/view.js +1 -2
  471. package/lib/simple-tree/api/view.js.map +1 -1
  472. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +16 -3
  473. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  474. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +69 -146
  475. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  476. package/lib/simple-tree/arrayNode.d.ts +5 -4
  477. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  478. package/lib/simple-tree/arrayNode.js +7 -3
  479. package/lib/simple-tree/arrayNode.js.map +1 -1
  480. package/lib/simple-tree/arrayNodeTypes.d.ts +46 -0
  481. package/lib/simple-tree/arrayNodeTypes.d.ts.map +1 -0
  482. package/lib/simple-tree/arrayNodeTypes.js +26 -0
  483. package/lib/simple-tree/arrayNodeTypes.js.map +1 -0
  484. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  485. package/lib/simple-tree/core/getOrCreateNode.js +2 -12
  486. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  487. package/lib/simple-tree/core/index.d.ts +1 -2
  488. package/lib/simple-tree/core/index.d.ts.map +1 -1
  489. package/lib/simple-tree/core/index.js +1 -2
  490. package/lib/simple-tree/core/index.js.map +1 -1
  491. package/lib/simple-tree/core/treeNodeKernel.d.ts +12 -5
  492. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  493. package/lib/simple-tree/core/treeNodeKernel.js +28 -14
  494. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  495. package/lib/simple-tree/core/treeNodeSchema.d.ts +14 -7
  496. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  497. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  498. package/lib/simple-tree/core/unhydratedFlexTree.js +2 -2
  499. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  500. package/lib/simple-tree/index.d.ts +9 -2
  501. package/lib/simple-tree/index.d.ts.map +1 -1
  502. package/lib/simple-tree/index.js +3 -0
  503. package/lib/simple-tree/index.js.map +1 -1
  504. package/lib/simple-tree/leafNodeSchema.d.ts +22 -5
  505. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  506. package/lib/simple-tree/leafNodeSchema.js +2 -0
  507. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  508. package/lib/simple-tree/mapNode.d.ts +3 -2
  509. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  510. package/lib/simple-tree/mapNode.js +5 -1
  511. package/lib/simple-tree/mapNode.js.map +1 -1
  512. package/lib/simple-tree/mapNodeTypes.d.ts +46 -0
  513. package/lib/simple-tree/mapNodeTypes.d.ts.map +1 -0
  514. package/lib/simple-tree/mapNodeTypes.js +26 -0
  515. package/lib/simple-tree/mapNodeTypes.js.map +1 -0
  516. package/lib/simple-tree/objectNode.d.ts +10 -3
  517. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  518. package/lib/simple-tree/objectNode.js +10 -5
  519. package/lib/simple-tree/objectNode.js.map +1 -1
  520. package/lib/simple-tree/objectNodeTypes.d.ts +9 -5
  521. package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -1
  522. package/lib/simple-tree/objectNodeTypes.js +3 -0
  523. package/lib/simple-tree/objectNodeTypes.js.map +1 -1
  524. package/lib/simple-tree/proxies.js +2 -1
  525. package/lib/simple-tree/proxies.js.map +1 -1
  526. package/lib/simple-tree/schemaTypes.d.ts +47 -6
  527. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  528. package/lib/simple-tree/schemaTypes.js +37 -3
  529. package/lib/simple-tree/schemaTypes.js.map +1 -1
  530. package/lib/simple-tree/{api/simpleSchema.d.ts → simpleSchema.d.ts} +54 -30
  531. package/lib/simple-tree/simpleSchema.d.ts.map +1 -0
  532. package/lib/simple-tree/simpleSchema.js.map +1 -0
  533. package/lib/simple-tree/toMapTree.js +2 -2
  534. package/lib/simple-tree/toMapTree.js.map +1 -1
  535. package/lib/simple-tree/toStoredSchema.js +2 -2
  536. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  537. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  538. package/lib/simple-tree/treeNodeValid.js +1 -2
  539. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  540. package/lib/treeFactory.d.ts +0 -12
  541. package/lib/treeFactory.d.ts.map +1 -1
  542. package/lib/treeFactory.js +1 -17
  543. package/lib/treeFactory.js.map +1 -1
  544. package/lib/tsdoc-metadata.json +1 -1
  545. package/lib/util/idAllocator.d.ts.map +1 -1
  546. package/lib/util/idAllocator.js +1 -2
  547. package/lib/util/idAllocator.js.map +1 -1
  548. package/lib/util/index.d.ts +1 -1
  549. package/lib/util/index.d.ts.map +1 -1
  550. package/lib/util/index.js +1 -1
  551. package/lib/util/index.js.map +1 -1
  552. package/lib/util/typeCheck.d.ts +7 -0
  553. package/lib/util/typeCheck.d.ts.map +1 -1
  554. package/lib/util/typeCheck.js.map +1 -1
  555. package/lib/util/utils.d.ts +0 -1
  556. package/lib/util/utils.d.ts.map +1 -1
  557. package/lib/util/utils.js +0 -2
  558. package/lib/util/utils.js.map +1 -1
  559. package/package.json +36 -26
  560. package/src/codec/codec.ts +2 -2
  561. package/src/codec/discriminatedUnions.ts +2 -2
  562. package/src/core/rebase/utils.ts +1 -1
  563. package/src/core/schema-stored/schema.ts +6 -2
  564. package/src/core/tree/anchorSet.ts +1 -2
  565. package/src/core/tree/treeTextFormat.ts +1 -1
  566. package/src/feature-libraries/chunked-forest/basicChunk.ts +2 -2
  567. package/src/feature-libraries/chunked-forest/chunkTree.ts +2 -2
  568. package/src/feature-libraries/chunked-forest/chunkedForest.ts +1 -2
  569. package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +1 -1
  570. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +2 -2
  571. package/src/feature-libraries/chunked-forest/codec/nodeShape.ts +2 -2
  572. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +1 -2
  573. package/src/feature-libraries/chunked-forest/emptyChunk.ts +1 -1
  574. package/src/feature-libraries/chunked-forest/uniformChunk.ts +2 -2
  575. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -1
  576. package/src/feature-libraries/default-schema/schemaChecker.ts +1 -2
  577. package/src/feature-libraries/flex-tree/lazyField.ts +2 -2
  578. package/src/feature-libraries/flex-tree/lazyNode.ts +2 -2
  579. package/src/feature-libraries/indexing/anchorTreeIndex.ts +2 -2
  580. package/src/feature-libraries/modular-schema/comparison.ts +2 -2
  581. package/src/feature-libraries/modular-schema/isNeverTree.ts +1 -2
  582. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +1 -2
  583. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +1 -2
  584. package/src/feature-libraries/node-identifier/mockNodeIdentifierManager.ts +2 -2
  585. package/src/feature-libraries/object-forest/objectForest.ts +1 -2
  586. package/src/feature-libraries/schema-index/codec.ts +2 -1
  587. package/src/feature-libraries/sequence-field/compose.ts +2 -2
  588. package/src/feature-libraries/sequence-field/invert.ts +2 -2
  589. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +2 -2
  590. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +2 -2
  591. package/src/feature-libraries/sequence-field/utils.ts +2 -2
  592. package/src/feature-libraries/treeCursorUtils.ts +1 -2
  593. package/src/index.ts +26 -3
  594. package/src/jsonDomainSchema.ts +30 -11
  595. package/src/packageVersion.ts +1 -1
  596. package/src/shared-tree/schematizeTree.ts +2 -2
  597. package/src/shared-tree/sharedTree.ts +16 -10
  598. package/src/shared-tree/sharedTreeChangeFamily.ts +1 -2
  599. package/src/shared-tree/treeApiAlpha.ts +36 -13
  600. package/src/shared-tree/treeCheckout.ts +2 -8
  601. package/src/shared-tree-core/branch.ts +5 -3
  602. package/src/shared-tree-core/editManager.ts +37 -45
  603. package/src/sharedTreeAttributes.ts +25 -0
  604. package/src/simple-tree/api/customTree.ts +2 -2
  605. package/src/simple-tree/api/getJsonSchema.ts +10 -0
  606. package/src/simple-tree/api/getSimpleSchema.ts +14 -44
  607. package/src/simple-tree/api/index.ts +7 -11
  608. package/src/simple-tree/api/schemaCreationUtilities.ts +1 -2
  609. package/src/simple-tree/api/schemaFactory.ts +161 -86
  610. package/src/simple-tree/api/schemaFactoryAlpha.ts +62 -67
  611. package/src/simple-tree/api/schemaFactoryRecursive.ts +44 -12
  612. package/src/simple-tree/api/schemaFromSimple.ts +41 -13
  613. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +7 -7
  614. package/src/simple-tree/api/simpleTreeIndex.ts +2 -1
  615. package/src/simple-tree/api/tree.ts +3 -3
  616. package/src/simple-tree/api/treeNodeApi.ts +2 -2
  617. package/src/simple-tree/api/typesUnsafe.ts +151 -33
  618. package/src/simple-tree/api/verboseTree.ts +2 -2
  619. package/src/simple-tree/api/view.ts +1 -2
  620. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +80 -185
  621. package/src/simple-tree/arrayNode.ts +20 -14
  622. package/src/simple-tree/arrayNodeTypes.ts +93 -0
  623. package/src/simple-tree/core/getOrCreateNode.ts +3 -13
  624. package/src/simple-tree/core/index.ts +1 -1
  625. package/src/simple-tree/core/treeNodeKernel.ts +32 -18
  626. package/src/simple-tree/core/treeNodeSchema.ts +14 -8
  627. package/src/simple-tree/core/unhydratedFlexTree.ts +2 -2
  628. package/src/simple-tree/index.ts +30 -9
  629. package/src/simple-tree/leafNodeSchema.ts +28 -7
  630. package/src/simple-tree/mapNode.ts +13 -11
  631. package/src/simple-tree/mapNodeTypes.ts +90 -0
  632. package/src/simple-tree/objectNode.ts +37 -13
  633. package/src/simple-tree/objectNodeTypes.ts +21 -16
  634. package/src/simple-tree/proxies.ts +2 -2
  635. package/src/simple-tree/schemaTypes.ts +83 -19
  636. package/src/simple-tree/{api/simpleSchema.ts → simpleSchema.ts} +61 -32
  637. package/src/simple-tree/toMapTree.ts +2 -2
  638. package/src/simple-tree/toStoredSchema.ts +2 -2
  639. package/src/simple-tree/treeNodeValid.ts +1 -2
  640. package/src/treeFactory.ts +1 -19
  641. package/src/util/idAllocator.ts +1 -3
  642. package/src/util/index.ts +0 -1
  643. package/src/util/typeCheck.ts +7 -0
  644. package/src/util/utils.ts +0 -3
  645. package/dist/simple-tree/api/simpleSchema.d.ts.map +0 -1
  646. package/dist/simple-tree/api/simpleSchema.js.map +0 -1
  647. package/dist/simple-tree/core/schemaCaching.d.ts +0 -16
  648. package/dist/simple-tree/core/schemaCaching.d.ts.map +0 -1
  649. package/dist/simple-tree/core/schemaCaching.js +0 -32
  650. package/dist/simple-tree/core/schemaCaching.js.map +0 -1
  651. package/lib/simple-tree/api/simpleSchema.d.ts.map +0 -1
  652. package/lib/simple-tree/api/simpleSchema.js.map +0 -1
  653. package/lib/simple-tree/core/schemaCaching.d.ts +0 -16
  654. package/lib/simple-tree/core/schemaCaching.d.ts.map +0 -1
  655. package/lib/simple-tree/core/schemaCaching.js +0 -27
  656. package/lib/simple-tree/core/schemaCaching.js.map +0 -1
  657. package/prettier.config.cjs +0 -8
  658. package/src/simple-tree/core/schemaCaching.ts +0 -35
  659. /package/dist/simple-tree/{api/simpleSchema.js → simpleSchema.js} +0 -0
  660. /package/lib/simple-tree/{api/simpleSchema.js → simpleSchema.js} +0 -0
@@ -2,10 +2,10 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { assert } from "@fluidframework/core-utils/internal";
5
+ import { assert, fail } from "@fluidframework/core-utils/internal";
6
6
  import { assertIsStableId } from "@fluidframework/id-compressor/internal";
7
7
  import { isStableNodeIdentifier, } from "./nodeIdentifierManager.js";
8
- import { brand, extractFromOpaque, fail } from "../../util/index.js";
8
+ import { brand, extractFromOpaque } from "../../util/index.js";
9
9
  /**
10
10
  * Mock {@link NodeIdentifierManager} that generates deterministic {@link StableNodeIdentifier}s and {@link LocalNodeIdentifier}s.
11
11
  * @remarks This is useful for test environments because it will always yield the same keys in the same order.
@@ -1 +1 @@
1
- {"version":3,"file":"mockNodeIdentifierManager.js","sourceRoot":"","sources":["../../../src/feature-libraries/node-identifier/mockNodeIdentifierManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE1E,OAAO,EACN,sBAAsB,GAEtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAErE;;;;GAIG;AACH,MAAM,OAAO,yBAAyB;IAAtC;QACS,UAAK,GAAG,CAAC,CAAC;IAqCnB,CAAC;IAnCO,4BAA4B;QAClC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACxC,CAAC;IAEM,2BAA2B;QACjC,OAAO,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,4BAA4B,EAAE,CAAC,CAAC;IACzE,CAAC;IAEM,sBAAsB,CAAC,GAAyB;QACtD,OAAO,CACN,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,oCAAoC,CAAC,CACvF,CAAC;IACH,CAAC;IAEM,uBAAuB,CAAC,GAAwB;QACtD,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC;IAEM,yBAAyB,CAAC,GAAW;QAC3C,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,0BAA0B,CAAC,EAAE,CAAC;YACjF,OAAO,SAAS,CAAC;QAClB,CAAC;QACD,MAAM,mBAAmB,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACnE,OAAO,mBAAmB,GAAG,IAAI,CAAC,KAAK;YACtC,CAAC,CAAC,KAAK,CAAC,mBAA+C,CAAC;YACxD,CAAC,CAAC,SAAS,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,MAAc;QAC1B,MAAM,CAAC,MAAM,IAAI,CAAC,EAAE,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACjE,MAAM,CAAC,MAAM,GAAG,mBAAmB,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;QACpF,OAAO,gBAAgB,CACtB,2BAA2B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,CAC9E,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { SessionSpaceCompressedId, StableId } from \"@fluidframework/id-compressor\";\nimport { assertIsStableId } from \"@fluidframework/id-compressor/internal\";\nimport type { LocalNodeIdentifier, StableNodeIdentifier } from \"./nodeIdentifier.js\";\nimport {\n\tisStableNodeIdentifier,\n\ttype NodeIdentifierManager,\n} from \"./nodeIdentifierManager.js\";\nimport { brand, extractFromOpaque, fail } from \"../../util/index.js\";\n\n/**\n * Mock {@link NodeIdentifierManager} that generates deterministic {@link StableNodeIdentifier}s and {@link LocalNodeIdentifier}s.\n * @remarks This is useful for test environments because it will always yield the same keys in the same order.\n * It should not be used for production environments for the same reason; the {@link StableNodeIdentifier}s are not universally unique.\n */\nexport class MockNodeIdentifierManager implements NodeIdentifierManager {\n\tprivate count = 0;\n\n\tpublic generateStableNodeIdentifier(): StableNodeIdentifier {\n\t\treturn brand(this.getId(this.count++));\n\t}\n\n\tpublic generateLocalNodeIdentifier(): LocalNodeIdentifier {\n\t\treturn this.localizeNodeIdentifier(this.generateStableNodeIdentifier());\n\t}\n\n\tpublic localizeNodeIdentifier(key: StableNodeIdentifier): LocalNodeIdentifier {\n\t\treturn (\n\t\t\tthis.tryLocalizeNodeIdentifier(key) ?? fail(0xb26 /* Identifier is not compressible */)\n\t\t);\n\t}\n\n\tpublic stabilizeNodeIdentifier(key: LocalNodeIdentifier): StableNodeIdentifier {\n\t\treturn brand(this.getId(extractFromOpaque(key)));\n\t}\n\n\tpublic tryLocalizeNodeIdentifier(key: string): LocalNodeIdentifier | undefined {\n\t\tif (!isStableNodeIdentifier(key) || !key.startsWith(\"a110ca7e-add1-4000-8000-\")) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst localNodeIdentifier = Number.parseInt(key.substring(24), 16);\n\t\treturn localNodeIdentifier < this.count\n\t\t\t? brand(localNodeIdentifier as SessionSpaceCompressedId)\n\t\t\t: undefined;\n\t}\n\n\tpublic getId(offset: number): StableId {\n\t\tassert(offset >= 0, 0x6e7 /* UUID offset may not be negative */);\n\t\tassert(offset < 281_474_976_710_656, 0x6e8 /* UUID offset must be at most 16^12 */);\n\t\treturn assertIsStableId(\n\t\t\t`a110ca7e-add1-4000-8000-${Math.round(offset).toString(16).padStart(12, \"0\")}`,\n\t\t);\n\t}\n}\n"]}
1
+ {"version":3,"file":"mockNodeIdentifierManager.js","sourceRoot":"","sources":["../../../src/feature-libraries/node-identifier/mockNodeIdentifierManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAEnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE1E,OAAO,EACN,sBAAsB,GAEtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE/D;;;;GAIG;AACH,MAAM,OAAO,yBAAyB;IAAtC;QACS,UAAK,GAAG,CAAC,CAAC;IAqCnB,CAAC;IAnCO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EAAE,CAC9E,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { SessionSpaceCompressedId, StableId } from \"@fluidframework/id-compressor\";\nimport { assertIsStableId } from \"@fluidframework/id-compressor/internal\";\nimport type { LocalNodeIdentifier, StableNodeIdentifier } from \"./nodeIdentifier.js\";\nimport {\n\tisStableNodeIdentifier,\n\ttype NodeIdentifierManager,\n} from \"./nodeIdentifierManager.js\";\nimport { brand, extractFromOpaque } from \"../../util/index.js\";\n\n/**\n * Mock {@link NodeIdentifierManager} that generates deterministic {@link StableNodeIdentifier}s and {@link LocalNodeIdentifier}s.\n * @remarks This is useful for test environments because it will always yield the same keys in the same order.\n * It should not be used for production environments for the same reason; the {@link StableNodeIdentifier}s are not universally unique.\n */\nexport class MockNodeIdentifierManager implements NodeIdentifierManager {\n\tprivate count = 0;\n\n\tpublic generateStableNodeIdentifier(): StableNodeIdentifier {\n\t\treturn brand(this.getId(this.count++));\n\t}\n\n\tpublic generateLocalNodeIdentifier(): LocalNodeIdentifier {\n\t\treturn this.localizeNodeIdentifier(this.generateStableNodeIdentifier());\n\t}\n\n\tpublic localizeNodeIdentifier(key: StableNodeIdentifier): LocalNodeIdentifier {\n\t\treturn (\n\t\t\tthis.tryLocalizeNodeIdentifier(key) ?? fail(0xb26 /* Identifier is not compressible */)\n\t\t);\n\t}\n\n\tpublic stabilizeNodeIdentifier(key: LocalNodeIdentifier): StableNodeIdentifier {\n\t\treturn brand(this.getId(extractFromOpaque(key)));\n\t}\n\n\tpublic tryLocalizeNodeIdentifier(key: string): LocalNodeIdentifier | undefined {\n\t\tif (!isStableNodeIdentifier(key) || !key.startsWith(\"a110ca7e-add1-4000-8000-\")) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst localNodeIdentifier = Number.parseInt(key.substring(24), 16);\n\t\treturn localNodeIdentifier < this.count\n\t\t\t? brand(localNodeIdentifier as SessionSpaceCompressedId)\n\t\t\t: undefined;\n\t}\n\n\tpublic getId(offset: number): StableId {\n\t\tassert(offset >= 0, 0x6e7 /* UUID offset may not be negative */);\n\t\tassert(offset < 281_474_976_710_656, 0x6e8 /* UUID offset must be at most 16^12 */);\n\t\treturn assertIsStableId(\n\t\t\t`a110ca7e-add1-4000-8000-${Math.round(offset).toString(16).padStart(12, \"0\")}`,\n\t\t);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"objectForest.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/object-forest/objectForest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,EACN,KAAK,MAAM,EACX,SAAS,EACT,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EAEvB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,eAAe,EAEpB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,4BAA4B,EAC5B,KAAK,OAAO,EACZ,KAAK,cAAc,EAGnB,KAAK,SAAS,EACd,oBAAoB,EACpB,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EACjC,KAAK,MAAM,EACX,KAAK,KAAK,EAIV,MAAM,qBAAqB,CAAC;AAS7B,OAAO,EAAE,KAAK,cAAc,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG/E,sCAAsC;AACtC,UAAU,cAAe,SAAQ,OAAO;IACvC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,EAAE,cAAc,EAAE,CAAC,CAAC;CACjD;AAcD;;;;;GAKG;AACH,qBAAa,YAAa,YAAW,eAAe;;aAgBlC,OAAO,EAAE,SAAS;aAClB,iBAAiB,EAAE,OAAO;IAhB3C,OAAO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,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,WAAW;IAIzD,IAAW,IAAI,IAAI,kBAAkB,CAGpC;IAEM,SAAS,IAAI,OAAO;IAIpB,SAAS,IAAI,IAAI;IAIR,iBAAiB,IAAI,OAAO;IAIrC,WAAW,IAAI,QAAQ;IAIvB,cAAc,IAAI,MAAM;IAIxB,SAAS,IAAI,OAAO;IAIpB,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAInC,OAAO,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,MAAM;IAI/C,IAAW,UAAU,IAAI,MAAM,CAG9B;IACD,IAAW,UAAU,IAAI,MAAM,CAG9B;IACD,IAAW,WAAW,IAAI,MAAM,CAG/B;IACM,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAIlC,QAAQ,IAAI,OAAO;IAInB,QAAQ,IAAI,IAAI;IAIhB,UAAU,IAAI,OAAO;IAIrB,UAAU,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI;IAItC,IAAW,IAAI,IAAI,wBAAwB,CAG1C;IACD,IAAW,KAAK,IAAI,KAAK,CAGxB;IAGM,KAAK,IAAI,IAAI;IAUpB;;;OAGG;IACI,2BAA2B,IAAI,IAAI;IAcnC,OAAO,IAAI,cAAc;IAKzB,SAAS,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC;IAUvC,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,uBAAuB;IAK9C,IAAI,IAAI,IAAI;IASZ,WAAW,IAAI,MAAM;CAO5B;AAKD;;GAEG;AACH,wBAAgB,WAAW,CAC1B,OAAO,CAAC,EAAE,SAAS,EACnB,iBAAiB,GAAE,OAAe,GAChC,YAAY,CAEd"}
@@ -14,10 +14,10 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
14
14
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
15
15
  };
16
16
  var _ObjectForest_events, _ObjectForest_roots;
17
- import { assert } from "@fluidframework/core-utils/internal";
17
+ import { assert, fail } from "@fluidframework/core-utils/internal";
18
18
  import { createEmitter } from "@fluid-internal/client-utils";
19
19
  import { AnchorSet, ITreeSubscriptionCursorState, aboveRootPlaceholder, combineVisitors, deepCopyMapTree, } from "../../core/index.js";
20
- import { assertNonNegativeSafeInteger, assertValidIndex, assertValidRange, brand, fail, } from "../../util/index.js";
20
+ import { assertNonNegativeSafeInteger, assertValidIndex, assertValidRange, brand, } from "../../util/index.js";
21
21
  import { cursorForMapTreeNode, mapTreeFromCursor } from "../mapTreeCursor.js";
22
22
  import { SynchronousCursor } from "../treeCursorUtils.js";
23
23
  import { chunkFieldSingle, defaultChunkPolicy } from "../chunked-forest/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"objectForest.js","sourceRoot":"","sources":["../../../src/feature-libraries/object-forest/objectForest.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAG7D,OAAO,EAEN,SAAS,EAcT,4BAA4B,EAW5B,oBAAoB,EACpB,eAAe,EACf,eAAe,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,4BAA4B,EAC5B,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,EACL,IAAI,GACJ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAuB,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAOlF,kGAAkG;AAClG,SAAS,gBAAgB,CAAC,OAAuB,EAAE,GAAa;IAC/D,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACtC,IA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AC;IAEM,IAAI;QACV,MAAM,CACL,IAAI,CAAC,KAAK,KAAK,4BAA4B,CAAC,KAAK,EACjD,KAAK,CAAC,qCAAqC,CAC3C,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,KAAK,GAAG,4BAA4B,CAAC,KAAK,CAAC;IACjD,CAAC;IAEM,WAAW;QACjB,MAAM,CACL,IAAI,CAAC,KAAK,KAAK,4BAA4B,CAAC,OAAO,EACnD,KAAK,CAAC,uCAAuC,CAC7C,CAAC;QACF,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IAClD,CAAC;CACD;AAED,qGAAqG;AACrG,sEAAsE;AACtE,yFAAyF;AACzF;;GAEG;AACH,MAAM,UAAU,WAAW,CAC1B,OAAmB,EACnB,oBAA6B,KAAK;IAElC,OAAO,IAAI,YAAY,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;AACrD,CAAC","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 { createEmitter } from \"@fluid-internal/client-utils\";\nimport type { Listenable } from \"@fluidframework/core-interfaces\";\n\nimport {\n\ttype Anchor,\n\tAnchorSet,\n\ttype AnnouncedVisitor,\n\ttype CursorLocationType,\n\ttype DeltaDetachedNodeId,\n\ttype DeltaVisitor,\n\ttype DetachedField,\n\ttype FieldAnchor,\n\ttype FieldKey,\n\ttype FieldUpPath,\n\ttype ForestEvents,\n\ttype IEditableForest,\n\ttype ITreeCursor,\n\ttype ITreeCursorSynchronous,\n\ttype ITreeSubscriptionCursor,\n\tITreeSubscriptionCursorState,\n\ttype MapTree,\n\ttype PathRootPrefix,\n\ttype PlaceIndex,\n\ttype Range,\n\ttype TreeChunk,\n\tTreeNavigationResult,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeStoredSchemaSubscription,\n\ttype UpPath,\n\ttype Value,\n\taboveRootPlaceholder,\n\tcombineVisitors,\n\tdeepCopyMapTree,\n} from \"../../core/index.js\";\nimport {\n\tassertNonNegativeSafeInteger,\n\tassertValidIndex,\n\tassertValidRange,\n\tbrand,\n\tfail,\n} from \"../../util/index.js\";\nimport { cursorForMapTreeNode, mapTreeFromCursor } from \"../mapTreeCursor.js\";\nimport { type CursorWithNode, SynchronousCursor } from \"../treeCursorUtils.js\";\nimport { chunkFieldSingle, defaultChunkPolicy } from \"../chunked-forest/index.js\";\n\n/** A `MapTree` with mutable fields */\ninterface MutableMapTree extends MapTree {\n\treadonly fields: Map<FieldKey, MutableMapTree[]>;\n}\n\n/** Get a field from a `MutableMapTree`, optionally modifying the tree to create it if missing. */\nfunction getOrCreateField(mapTree: MutableMapTree, key: FieldKey): MutableMapTree[] {\n\tconst field = mapTree.fields.get(key);\n\tif (field !== undefined) {\n\t\treturn field;\n\t}\n\n\tconst newField: MutableMapTree[] = [];\n\tmapTree.fields.set(key, newField);\n\treturn newField;\n}\n\n/**\n * Reference implementation of IEditableForest.\n *\n * This implementation focuses on correctness and simplicity, not performance.\n * It does not use compressed chunks: instead nodes are implemented using objects.\n */\nexport class ObjectForest implements IEditableForest {\n\tprivate activeVisitor?: DeltaVisitor;\n\n\t// All cursors that are in the \"Current\" state. Must be empty when editing.\n\tpublic readonly currentCursors: Set<Cursor> = new Set();\n\tprivate readonly deltaVisitors: Set<() => AnnouncedVisitor> = new Set();\n\n\treadonly #events = createEmitter<ForestEvents>();\n\tpublic readonly events: Listenable<ForestEvents> = this.#events;\n\n\treadonly #roots: MutableMapTree;\n\tpublic get roots(): MapTree {\n\t\treturn this.#roots;\n\t}\n\n\tpublic constructor(\n\t\tpublic readonly anchors: AnchorSet = new AnchorSet(),\n\t\tpublic readonly additionalAsserts: boolean = false,\n\t\troots?: MapTree,\n\t) {\n\t\tthis.#roots =\n\t\t\troots !== undefined\n\t\t\t\t? deepCopyMapTree(roots)\n\t\t\t\t: {\n\t\t\t\t\t\ttype: aboveRootPlaceholder,\n\t\t\t\t\t\tfields: new Map(),\n\t\t\t\t\t};\n\t}\n\n\tpublic get isEmpty(): boolean {\n\t\treturn this.roots.fields.size === 0;\n\t}\n\n\tpublic clone(_: TreeStoredSchemaSubscription, anchors: AnchorSet): ObjectForest {\n\t\treturn new ObjectForest(anchors, this.additionalAsserts, this.roots);\n\t}\n\n\tpublic chunkField(cursor: ITreeCursorSynchronous): TreeChunk {\n\t\treturn chunkFieldSingle(cursor, { idCompressor: undefined, policy: defaultChunkPolicy });\n\t}\n\n\tpublic forgetAnchor(anchor: Anchor): void {\n\t\tthis.anchors.forget(anchor);\n\t}\n\n\tpublic acquireVisitor(): DeltaVisitor {\n\t\tassert(\n\t\t\tthis.activeVisitor === undefined,\n\t\t\t0x76c /* Must release existing visitor before acquiring another */,\n\t\t);\n\n\t\t// Note: This code uses cursors, however it also modifies the tree.\n\t\t// In general this is not safe, but this code happens to only modify the tree below the current cursor location,\n\t\t// which happens to work.\n\t\t// This pattern could be generalized/formalized with a concept of an exclusive cursor,\n\t\t// which can edit, but is the only cursor allowed at the time.\n\n\t\tconst cursor: Cursor = this.allocateCursor(\"acquireVisitor\");\n\t\tcursor.setToAboveDetachedSequences();\n\n\t\t/**\n\t\t * Called before each edit to allow cursor cleanup to happen and ensure that there are no unexpected cursors.\n\t\t * This is required for each change since there may be app facing change event handlers which create cursors.\n\t\t */\n\t\tconst preEdit = (): void => {\n\t\t\tthis.#events.emit(\"beforeChange\");\n\t\t\tassert(\n\t\t\t\tthis.currentCursors.has(cursor),\n\t\t\t\t0x995 /* missing visitor cursor while editing */,\n\t\t\t);\n\t\t\tif (this.currentCursors.size > 1) {\n\t\t\t\tconst unexpectedSources = [...this.currentCursors].flatMap((c) =>\n\t\t\t\t\tc === cursor ? [] : (c.source ?? null),\n\t\t\t\t);\n\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Found unexpected cursors when editing with the following annotations: ${JSON.stringify(\n\t\t\t\t\t\tunexpectedSources,\n\t\t\t\t\t)}`,\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\tclass Visitor implements DeltaVisitor {\n\t\t\tpublic constructor(private readonly forest: ObjectForest) {}\n\t\t\tpublic free(): void {\n\t\t\t\tcursor.free();\n\t\t\t\tassert(\n\t\t\t\t\tthis.forest.activeVisitor !== undefined,\n\t\t\t\t\t0x76d /* Multiple free calls for same visitor */,\n\t\t\t\t);\n\t\t\t\tthis.forest.activeVisitor = undefined;\n\t\t\t}\n\t\t\tpublic destroy(detachedField: FieldKey, count: number): void {\n\t\t\t\tpreEdit();\n\t\t\t\tthis.forest.delete(detachedField);\n\t\t\t}\n\t\t\tpublic create(content: readonly ITreeCursorSynchronous[], destination: FieldKey): void {\n\t\t\t\tpreEdit();\n\t\t\t\tthis.forest.add(content, destination);\n\t\t\t\tthis.forest.#events.emit(\"afterRootFieldCreated\", destination);\n\t\t\t}\n\t\t\tpublic attach(source: FieldKey, count: number, destination: PlaceIndex): void {\n\t\t\t\tpreEdit();\n\t\t\t\tthis.attachEdit(source, count, destination);\n\t\t\t}\n\t\t\tpublic detach(source: Range, destination: FieldKey, id: DeltaDetachedNodeId): void {\n\t\t\t\tpreEdit();\n\t\t\t\tthis.detachEdit(source, destination);\n\t\t\t}\n\t\t\t/**\n\t\t\t * Attaches the nodes from the given source field into the current field.\n\t\t\t * Does not invalidate dependents.\n\t\t\t * @param source - The the range to be attached.\n\t\t\t * @param count - The number of nodes being attached.\n\t\t\t * Expected to match the number of nodes in the source detached field.\n\t\t\t * @param destination - The index in the current field at which to attach the content.\n\t\t\t */\n\t\t\tprivate attachEdit(source: FieldKey, count: number, destination: PlaceIndex): void {\n\t\t\t\tassertNonNegativeSafeInteger(count);\n\t\t\t\tif (count === 0) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst [parent, key] = cursor.getParent();\n\t\t\t\tassert(\n\t\t\t\t\tparent !== this.forest.roots || key !== source,\n\t\t\t\t\t0x7b6 /* Attach source field must be different from current field */,\n\t\t\t\t);\n\t\t\t\tconst currentField = getOrCreateField(parent, key);\n\t\t\t\tassertValidIndex(destination, currentField, true);\n\t\t\t\tconst sourceField = this.forest.#roots.fields.get(source) ?? [];\n\t\t\t\tassert(sourceField !== undefined, 0x7b7 /* Attach source field must exist */);\n\t\t\t\tassert(\n\t\t\t\t\tsourceField.length === count,\n\t\t\t\t\t0x7b8 /* Attach must consume all nodes in source field */,\n\t\t\t\t);\n\t\t\t\t// TODO: this will fail for very large insertions due to argument limits.\n\t\t\t\tcurrentField.splice(destination, 0, ...sourceField);\n\t\t\t\tthis.forest.delete(source);\n\t\t\t}\n\t\t\t/**\n\t\t\t * Detaches the range from the current field and transfers it to the given destination if any.\n\t\t\t * Does not invalidate dependents.\n\t\t\t * @param source - The bounds of the range to be detached from the current field.\n\t\t\t * @param destination - If specified, the destination to transfer the detached range to.\n\t\t\t * If not specified, the detached range is destroyed.\n\t\t\t */\n\t\t\tprivate detachEdit(source: Range, destination: FieldKey | undefined): void {\n\t\t\t\tconst [parent, key] = cursor.getParent();\n\t\t\t\tassert(\n\t\t\t\t\tdestination === undefined || parent !== this.forest.roots || key !== destination,\n\t\t\t\t\t0x7b9 /* Detach destination field must be different from current field */,\n\t\t\t\t);\n\t\t\t\tconst currentField = getOrCreateField(parent, key);\n\t\t\t\tassertValidRange(source, currentField);\n\t\t\t\tconst content = currentField.splice(source.start, source.end - source.start);\n\t\t\t\tif (destination !== undefined) {\n\t\t\t\t\tthis.forest.addFieldAsDetached(content, destination);\n\t\t\t\t}\n\t\t\t\t// This check is performed after the transfer to ensure that the field is not removed in scenarios\n\t\t\t\t// where the source and destination are the same.\n\t\t\t\tif (currentField.length === 0) {\n\t\t\t\t\tparent.fields.delete(key);\n\t\t\t\t}\n\t\t\t}\n\t\t\tpublic replace(\n\t\t\t\tnewContentSource: FieldKey,\n\t\t\t\trange: Range,\n\t\t\t\toldContentDestination: FieldKey,\n\t\t\t\toldContentId: DeltaDetachedNodeId,\n\t\t\t): void {\n\t\t\t\tpreEdit();\n\t\t\t\tassert(\n\t\t\t\t\tnewContentSource !== oldContentDestination,\n\t\t\t\t\t0x7ba /* Replace detached source field and detached destination field must be different */,\n\t\t\t\t);\n\t\t\t\tthis.detachEdit(range, oldContentDestination);\n\t\t\t\tthis.attachEdit(newContentSource, range.end - range.start, range.start);\n\t\t\t}\n\t\t\tpublic enterNode(index: number): void {\n\t\t\t\tcursor.enterNode(index);\n\t\t\t}\n\t\t\tpublic exitNode(index: number): void {\n\t\t\t\tcursor.exitNode();\n\t\t\t}\n\t\t\tpublic enterField(key: FieldKey): void {\n\t\t\t\tcursor.enterField(key);\n\t\t\t}\n\t\t\tpublic exitField(key: FieldKey): void {\n\t\t\t\tcursor.exitField();\n\t\t\t}\n\t\t}\n\n\t\tconst forestVisitor = new Visitor(this);\n\t\tconst announcedVisitors: AnnouncedVisitor[] = [];\n\t\tthis.deltaVisitors.forEach((getVisitor) => announcedVisitors.push(getVisitor()));\n\t\tconst combinedVisitor = combineVisitors(\n\t\t\t[forestVisitor, ...announcedVisitors],\n\t\t\tannouncedVisitors,\n\t\t);\n\t\tthis.activeVisitor = combinedVisitor;\n\t\treturn combinedVisitor;\n\t}\n\n\tpublic registerAnnouncedVisitor(visitor: () => AnnouncedVisitor): void {\n\t\tthis.deltaVisitors.add(visitor);\n\t}\n\n\tpublic deregisterAnnouncedVisitor(visitor: () => AnnouncedVisitor): void {\n\t\tthis.deltaVisitors.delete(visitor);\n\t}\n\n\tprivate nextRange = 0;\n\tpublic newDetachedField(): DetachedField {\n\t\tconst range: DetachedField = brand(String(this.nextRange));\n\t\tthis.nextRange += 1;\n\t\treturn range;\n\t}\n\n\tprivate add(nodes: Iterable<ITreeCursor>, key: FieldKey): void {\n\t\tconst field = Array.from(nodes, mapTreeFromCursor) as MutableMapTree[];\n\t\tthis.addFieldAsDetached(field, key);\n\t}\n\n\tprivate addFieldAsDetached(field: MutableMapTree[], key: FieldKey): void {\n\t\tassert(!this.roots.fields.has(key), 0x370 /* new range must not already exist */);\n\t\tif (field.length > 0) {\n\t\t\tthis.#roots.fields.set(key, field);\n\t\t}\n\t}\n\n\tprivate delete(field: FieldKey): void {\n\t\tthis.#roots.fields.delete(field);\n\t}\n\n\tpublic allocateCursor(source?: string): Cursor {\n\t\treturn new Cursor(this, source);\n\t}\n\n\tpublic tryMoveCursorToNode(\n\t\tdestination: Anchor,\n\t\tcursorToMove: ITreeSubscriptionCursor,\n\t): TreeNavigationResult {\n\t\tconst path = this.anchors.locate(destination);\n\t\tif (path === undefined) {\n\t\t\treturn TreeNavigationResult.NotFound;\n\t\t}\n\t\tthis.moveCursorToPath(path, cursorToMove);\n\t\treturn TreeNavigationResult.Ok;\n\t}\n\n\tpublic tryMoveCursorToField(\n\t\tdestination: FieldAnchor,\n\t\tcursorToMove: ITreeSubscriptionCursor,\n\t): TreeNavigationResult {\n\t\tif (destination.parent === undefined) {\n\t\t\tthis.moveCursorToPath(undefined, cursorToMove);\n\t\t} else {\n\t\t\tconst result = this.tryMoveCursorToNode(destination.parent, cursorToMove);\n\t\t\tif (result !== TreeNavigationResult.Ok) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\tcursorToMove.enterField(destination.fieldKey);\n\t\treturn TreeNavigationResult.Ok;\n\t}\n\n\tpublic moveCursorToPath(\n\t\tdestination: UpPath | undefined,\n\t\tcursorToMove: ITreeSubscriptionCursor,\n\t): void {\n\t\tassert(\n\t\t\tcursorToMove instanceof Cursor,\n\t\t\t0x337 /* ObjectForest must only be given its own Cursor type */,\n\t\t);\n\t\tassert(\n\t\t\tcursorToMove.forest === this,\n\t\t\t0x338 /* ObjectForest must only be given its own Cursor */,\n\t\t);\n\n\t\tconst indexStack: number[] = [];\n\t\tconst keyStack: FieldKey[] = [];\n\n\t\tlet path: UpPath | undefined = destination;\n\t\twhile (path !== undefined) {\n\t\t\tindexStack.push(path.parentIndex);\n\t\t\tkeyStack.push(path.parentField);\n\t\t\tpath = path.parent;\n\t\t}\n\t\tcursorToMove.setToAboveDetachedSequences();\n\t\twhile (keyStack.length > 0) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tcursorToMove.enterField(keyStack.pop()!);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tcursorToMove.enterNode(indexStack.pop()!);\n\t\t}\n\n\t\treturn;\n\t}\n\n\tpublic getCursorAboveDetachedFields(): ITreeCursorSynchronous {\n\t\treturn cursorForMapTreeNode(this.roots);\n\t}\n}\n\n/**\n * Cursor implementation for ObjectForest.\n */\nclass Cursor extends SynchronousCursor implements ITreeSubscriptionCursor {\n\tpublic state: ITreeSubscriptionCursorState;\n\n\t/**\n\t * @param forest - forest this cursor navigates\n\t * @param innerCursor - underlying cursor implementation this wraps. `undefined` when state is not `Current`\n\t */\n\tpublic constructor(\n\t\tpublic readonly forest: ObjectForest,\n\t\tpublic readonly source: string | undefined,\n\t\tprivate innerCursor?: CursorWithNode<MutableMapTree>,\n\t) {\n\t\tsuper();\n\t\tif (innerCursor === undefined) {\n\t\t\tthis.state = ITreeSubscriptionCursorState.Cleared;\n\t\t} else {\n\t\t\tthis.state = ITreeSubscriptionCursorState.Current;\n\t\t\tthis.forest.currentCursors.add(this);\n\t\t}\n\t}\n\n\tpublic buildFieldAnchor(): FieldAnchor {\n\t\tconst path = this.getFieldPath();\n\t\tconst anchor =\n\t\t\tpath.parent === undefined ? undefined : this.forest.anchors.track(path.parent);\n\t\treturn { parent: anchor, fieldKey: path.field };\n\t}\n\tpublic getFieldPath(prefix?: PathRootPrefix): FieldUpPath {\n\t\tassert(this.innerCursor !== undefined, 0x45f /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.getFieldPath(prefix);\n\t}\n\tpublic get mode(): CursorLocationType {\n\t\tassert(this.innerCursor !== undefined, 0x42e /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.mode;\n\t}\n\n\tpublic nextField(): boolean {\n\t\tassert(this.innerCursor !== undefined, 0x42f /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.nextField();\n\t}\n\tpublic exitField(): void {\n\t\tassert(this.innerCursor !== undefined, 0x430 /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.exitField();\n\t}\n\tpublic override skipPendingFields(): boolean {\n\t\tassert(this.innerCursor !== undefined, 0x431 /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.skipPendingFields();\n\t}\n\tpublic getFieldKey(): FieldKey {\n\t\tassert(this.innerCursor !== undefined, 0x432 /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.getFieldKey();\n\t}\n\tpublic getFieldLength(): number {\n\t\tassert(this.innerCursor !== undefined, 0x433 /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.getFieldLength();\n\t}\n\tpublic firstNode(): boolean {\n\t\tassert(this.innerCursor !== undefined, 0x434 /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.firstNode();\n\t}\n\tpublic enterNode(childIndex: number): void {\n\t\tassert(this.innerCursor !== undefined, 0x435 /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.enterNode(childIndex);\n\t}\n\tpublic getPath(prefix?: PathRootPrefix): UpPath {\n\t\tassert(this.innerCursor !== undefined, 0x436 /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.getPath(prefix) ?? fail(0xb27 /* no path when at root */);\n\t}\n\tpublic get fieldIndex(): number {\n\t\tassert(this.innerCursor !== undefined, 0x437 /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.fieldIndex;\n\t}\n\tpublic get chunkStart(): number {\n\t\tassert(this.innerCursor !== undefined, 0x438 /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.chunkStart;\n\t}\n\tpublic get chunkLength(): number {\n\t\tassert(this.innerCursor !== undefined, 0x439 /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.chunkLength;\n\t}\n\tpublic seekNodes(offset: number): boolean {\n\t\tassert(this.innerCursor !== undefined, 0x43a /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.seekNodes(offset);\n\t}\n\tpublic nextNode(): boolean {\n\t\tassert(this.innerCursor !== undefined, 0x43b /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.nextNode();\n\t}\n\tpublic exitNode(): void {\n\t\tassert(this.innerCursor !== undefined, 0x43c /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.exitNode();\n\t}\n\tpublic firstField(): boolean {\n\t\tassert(this.innerCursor !== undefined, 0x43d /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.firstField();\n\t}\n\tpublic enterField(key: FieldKey): void {\n\t\tassert(this.innerCursor !== undefined, 0x43e /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.enterField(key);\n\t}\n\tpublic get type(): TreeNodeSchemaIdentifier {\n\t\tassert(this.innerCursor !== undefined, 0x43f /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.type;\n\t}\n\tpublic get value(): Value {\n\t\tassert(this.innerCursor !== undefined, 0x440 /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.value;\n\t}\n\n\t// TODO: tests for clear when not at root.\n\tpublic clear(): void {\n\t\tassert(\n\t\t\tthis.state !== ITreeSubscriptionCursorState.Freed,\n\t\t\t0x33b /* Cursor must not be freed */,\n\t\t);\n\t\tthis.state = ITreeSubscriptionCursorState.Cleared;\n\t\tthis.innerCursor = undefined;\n\t\tthis.forest.currentCursors.delete(this);\n\t}\n\n\t/**\n\t * Move this cursor to the special dummy node above the detached sequences.\n\t * Can be used when cleared (but not freed).\n\t */\n\tpublic setToAboveDetachedSequences(): void {\n\t\tassert(\n\t\t\tthis.state !== ITreeSubscriptionCursorState.Freed,\n\t\t\t0x33c /* Cursor must not be freed */,\n\t\t);\n\t\tthis.clear();\n\t\tthis.state = ITreeSubscriptionCursorState.Current;\n\t\t// Cast to a cursor of _mutable_ trees to allow direct manipulation of the tree data which is more efficient than doing immutable copies.\n\t\tthis.innerCursor = cursorForMapTreeNode(\n\t\t\tthis.forest.roots,\n\t\t) as CursorWithNode<MutableMapTree>;\n\t\tthis.forest.currentCursors.add(this);\n\t}\n\n\tpublic getNode(): MutableMapTree {\n\t\tassert(this.innerCursor !== undefined, 0x33e /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.getNode();\n\t}\n\n\tpublic getParent(): [MutableMapTree, FieldKey] {\n\t\tassert(this.innerCursor !== undefined, 0x441 /* Cursor must be current to be used */);\n\t\t// This could be optimized to skip moving it accessing internals of cursor.\n\t\tconst key = this.innerCursor.getFieldKey();\n\t\tthis.innerCursor.exitField();\n\t\tconst node = this.innerCursor.getNode();\n\t\tthis.innerCursor.enterField(key);\n\t\treturn [node, key];\n\t}\n\n\tpublic fork(source?: string): ITreeSubscriptionCursor {\n\t\tassert(this.innerCursor !== undefined, 0x460 /* Cursor must be current to be used */);\n\t\treturn new Cursor(this.forest, source ?? `fork: ${this.source}`, this.innerCursor.fork());\n\t}\n\n\tpublic free(): void {\n\t\tassert(\n\t\t\tthis.state !== ITreeSubscriptionCursorState.Freed,\n\t\t\t0x33f /* Cursor must not be double freed */,\n\t\t);\n\t\tthis.forest.currentCursors.delete(this);\n\t\tthis.state = ITreeSubscriptionCursorState.Freed;\n\t}\n\n\tpublic buildAnchor(): Anchor {\n\t\tassert(\n\t\t\tthis.state === ITreeSubscriptionCursorState.Current,\n\t\t\t0x37a /* Cursor must be current to be used */,\n\t\t);\n\t\treturn this.forest.anchors.track(this.getPath());\n\t}\n}\n\n// This function is the folder level export for objectForest, and hides all the implementation types.\n// When other forest implementations are created (ex: optimized ones),\n// this function should likely be moved and updated to (at least conditionally) use them.\n/**\n * @returns an implementation of {@link IEditableForest} with no data or schema.\n */\nexport function buildForest(\n\tanchors?: AnchorSet,\n\tadditionalAsserts: boolean = false,\n): ObjectForest {\n\treturn new ObjectForest(anchors, additionalAsserts);\n}\n"]}
1
+ {"version":3,"file":"objectForest.js","sourceRoot":"","sources":["../../../src/feature-libraries/object-forest/objectForest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EG;AACH,MAAM,UAAU,WAAW,CAC1B,OAAmB,EACnB,oBAA6B,KAAK;IAElC,OAAO,IAAI,YAAY,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;AACrD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type { Listenable } from \"@fluidframework/core-interfaces\";\n\nimport {\n\ttype Anchor,\n\tAnchorSet,\n\ttype AnnouncedVisitor,\n\ttype CursorLocationType,\n\ttype DeltaDetachedNodeId,\n\ttype DeltaVisitor,\n\ttype DetachedField,\n\ttype FieldAnchor,\n\ttype FieldKey,\n\ttype FieldUpPath,\n\ttype ForestEvents,\n\ttype IEditableForest,\n\ttype ITreeCursor,\n\ttype ITreeCursorSynchronous,\n\ttype ITreeSubscriptionCursor,\n\tITreeSubscriptionCursorState,\n\ttype MapTree,\n\ttype PathRootPrefix,\n\ttype PlaceIndex,\n\ttype Range,\n\ttype TreeChunk,\n\tTreeNavigationResult,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeStoredSchemaSubscription,\n\ttype UpPath,\n\ttype Value,\n\taboveRootPlaceholder,\n\tcombineVisitors,\n\tdeepCopyMapTree,\n} from \"../../core/index.js\";\nimport {\n\tassertNonNegativeSafeInteger,\n\tassertValidIndex,\n\tassertValidRange,\n\tbrand,\n} from \"../../util/index.js\";\nimport { cursorForMapTreeNode, mapTreeFromCursor } from \"../mapTreeCursor.js\";\nimport { type CursorWithNode, SynchronousCursor } from \"../treeCursorUtils.js\";\nimport { chunkFieldSingle, defaultChunkPolicy } from \"../chunked-forest/index.js\";\n\n/** A `MapTree` with mutable fields */\ninterface MutableMapTree extends MapTree {\n\treadonly fields: Map<FieldKey, MutableMapTree[]>;\n}\n\n/** Get a field from a `MutableMapTree`, optionally modifying the tree to create it if missing. */\nfunction getOrCreateField(mapTree: MutableMapTree, key: FieldKey): MutableMapTree[] {\n\tconst field = mapTree.fields.get(key);\n\tif (field !== undefined) {\n\t\treturn field;\n\t}\n\n\tconst newField: MutableMapTree[] = [];\n\tmapTree.fields.set(key, newField);\n\treturn newField;\n}\n\n/**\n * Reference implementation of IEditableForest.\n *\n * This implementation focuses on correctness and simplicity, not performance.\n * It does not use compressed chunks: instead nodes are implemented using objects.\n */\nexport class ObjectForest implements IEditableForest {\n\tprivate activeVisitor?: DeltaVisitor;\n\n\t// All cursors that are in the \"Current\" state. Must be empty when editing.\n\tpublic readonly currentCursors: Set<Cursor> = new Set();\n\tprivate readonly deltaVisitors: Set<() => AnnouncedVisitor> = new Set();\n\n\treadonly #events = createEmitter<ForestEvents>();\n\tpublic readonly events: Listenable<ForestEvents> = this.#events;\n\n\treadonly #roots: MutableMapTree;\n\tpublic get roots(): MapTree {\n\t\treturn this.#roots;\n\t}\n\n\tpublic constructor(\n\t\tpublic readonly anchors: AnchorSet = new AnchorSet(),\n\t\tpublic readonly additionalAsserts: boolean = false,\n\t\troots?: MapTree,\n\t) {\n\t\tthis.#roots =\n\t\t\troots !== undefined\n\t\t\t\t? deepCopyMapTree(roots)\n\t\t\t\t: {\n\t\t\t\t\t\ttype: aboveRootPlaceholder,\n\t\t\t\t\t\tfields: new Map(),\n\t\t\t\t\t};\n\t}\n\n\tpublic get isEmpty(): boolean {\n\t\treturn this.roots.fields.size === 0;\n\t}\n\n\tpublic clone(_: TreeStoredSchemaSubscription, anchors: AnchorSet): ObjectForest {\n\t\treturn new ObjectForest(anchors, this.additionalAsserts, this.roots);\n\t}\n\n\tpublic chunkField(cursor: ITreeCursorSynchronous): TreeChunk {\n\t\treturn chunkFieldSingle(cursor, { idCompressor: undefined, policy: defaultChunkPolicy });\n\t}\n\n\tpublic forgetAnchor(anchor: Anchor): void {\n\t\tthis.anchors.forget(anchor);\n\t}\n\n\tpublic acquireVisitor(): DeltaVisitor {\n\t\tassert(\n\t\t\tthis.activeVisitor === undefined,\n\t\t\t0x76c /* Must release existing visitor before acquiring another */,\n\t\t);\n\n\t\t// Note: This code uses cursors, however it also modifies the tree.\n\t\t// In general this is not safe, but this code happens to only modify the tree below the current cursor location,\n\t\t// which happens to work.\n\t\t// This pattern could be generalized/formalized with a concept of an exclusive cursor,\n\t\t// which can edit, but is the only cursor allowed at the time.\n\n\t\tconst cursor: Cursor = this.allocateCursor(\"acquireVisitor\");\n\t\tcursor.setToAboveDetachedSequences();\n\n\t\t/**\n\t\t * Called before each edit to allow cursor cleanup to happen and ensure that there are no unexpected cursors.\n\t\t * This is required for each change since there may be app facing change event handlers which create cursors.\n\t\t */\n\t\tconst preEdit = (): void => {\n\t\t\tthis.#events.emit(\"beforeChange\");\n\t\t\tassert(\n\t\t\t\tthis.currentCursors.has(cursor),\n\t\t\t\t0x995 /* missing visitor cursor while editing */,\n\t\t\t);\n\t\t\tif (this.currentCursors.size > 1) {\n\t\t\t\tconst unexpectedSources = [...this.currentCursors].flatMap((c) =>\n\t\t\t\t\tc === cursor ? [] : (c.source ?? null),\n\t\t\t\t);\n\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Found unexpected cursors when editing with the following annotations: ${JSON.stringify(\n\t\t\t\t\t\tunexpectedSources,\n\t\t\t\t\t)}`,\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\tclass Visitor implements DeltaVisitor {\n\t\t\tpublic constructor(private readonly forest: ObjectForest) {}\n\t\t\tpublic free(): void {\n\t\t\t\tcursor.free();\n\t\t\t\tassert(\n\t\t\t\t\tthis.forest.activeVisitor !== undefined,\n\t\t\t\t\t0x76d /* Multiple free calls for same visitor */,\n\t\t\t\t);\n\t\t\t\tthis.forest.activeVisitor = undefined;\n\t\t\t}\n\t\t\tpublic destroy(detachedField: FieldKey, count: number): void {\n\t\t\t\tpreEdit();\n\t\t\t\tthis.forest.delete(detachedField);\n\t\t\t}\n\t\t\tpublic create(content: readonly ITreeCursorSynchronous[], destination: FieldKey): void {\n\t\t\t\tpreEdit();\n\t\t\t\tthis.forest.add(content, destination);\n\t\t\t\tthis.forest.#events.emit(\"afterRootFieldCreated\", destination);\n\t\t\t}\n\t\t\tpublic attach(source: FieldKey, count: number, destination: PlaceIndex): void {\n\t\t\t\tpreEdit();\n\t\t\t\tthis.attachEdit(source, count, destination);\n\t\t\t}\n\t\t\tpublic detach(source: Range, destination: FieldKey, id: DeltaDetachedNodeId): void {\n\t\t\t\tpreEdit();\n\t\t\t\tthis.detachEdit(source, destination);\n\t\t\t}\n\t\t\t/**\n\t\t\t * Attaches the nodes from the given source field into the current field.\n\t\t\t * Does not invalidate dependents.\n\t\t\t * @param source - The the range to be attached.\n\t\t\t * @param count - The number of nodes being attached.\n\t\t\t * Expected to match the number of nodes in the source detached field.\n\t\t\t * @param destination - The index in the current field at which to attach the content.\n\t\t\t */\n\t\t\tprivate attachEdit(source: FieldKey, count: number, destination: PlaceIndex): void {\n\t\t\t\tassertNonNegativeSafeInteger(count);\n\t\t\t\tif (count === 0) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst [parent, key] = cursor.getParent();\n\t\t\t\tassert(\n\t\t\t\t\tparent !== this.forest.roots || key !== source,\n\t\t\t\t\t0x7b6 /* Attach source field must be different from current field */,\n\t\t\t\t);\n\t\t\t\tconst currentField = getOrCreateField(parent, key);\n\t\t\t\tassertValidIndex(destination, currentField, true);\n\t\t\t\tconst sourceField = this.forest.#roots.fields.get(source) ?? [];\n\t\t\t\tassert(sourceField !== undefined, 0x7b7 /* Attach source field must exist */);\n\t\t\t\tassert(\n\t\t\t\t\tsourceField.length === count,\n\t\t\t\t\t0x7b8 /* Attach must consume all nodes in source field */,\n\t\t\t\t);\n\t\t\t\t// TODO: this will fail for very large insertions due to argument limits.\n\t\t\t\tcurrentField.splice(destination, 0, ...sourceField);\n\t\t\t\tthis.forest.delete(source);\n\t\t\t}\n\t\t\t/**\n\t\t\t * Detaches the range from the current field and transfers it to the given destination if any.\n\t\t\t * Does not invalidate dependents.\n\t\t\t * @param source - The bounds of the range to be detached from the current field.\n\t\t\t * @param destination - If specified, the destination to transfer the detached range to.\n\t\t\t * If not specified, the detached range is destroyed.\n\t\t\t */\n\t\t\tprivate detachEdit(source: Range, destination: FieldKey | undefined): void {\n\t\t\t\tconst [parent, key] = cursor.getParent();\n\t\t\t\tassert(\n\t\t\t\t\tdestination === undefined || parent !== this.forest.roots || key !== destination,\n\t\t\t\t\t0x7b9 /* Detach destination field must be different from current field */,\n\t\t\t\t);\n\t\t\t\tconst currentField = getOrCreateField(parent, key);\n\t\t\t\tassertValidRange(source, currentField);\n\t\t\t\tconst content = currentField.splice(source.start, source.end - source.start);\n\t\t\t\tif (destination !== undefined) {\n\t\t\t\t\tthis.forest.addFieldAsDetached(content, destination);\n\t\t\t\t}\n\t\t\t\t// This check is performed after the transfer to ensure that the field is not removed in scenarios\n\t\t\t\t// where the source and destination are the same.\n\t\t\t\tif (currentField.length === 0) {\n\t\t\t\t\tparent.fields.delete(key);\n\t\t\t\t}\n\t\t\t}\n\t\t\tpublic replace(\n\t\t\t\tnewContentSource: FieldKey,\n\t\t\t\trange: Range,\n\t\t\t\toldContentDestination: FieldKey,\n\t\t\t\toldContentId: DeltaDetachedNodeId,\n\t\t\t): void {\n\t\t\t\tpreEdit();\n\t\t\t\tassert(\n\t\t\t\t\tnewContentSource !== oldContentDestination,\n\t\t\t\t\t0x7ba /* Replace detached source field and detached destination field must be different */,\n\t\t\t\t);\n\t\t\t\tthis.detachEdit(range, oldContentDestination);\n\t\t\t\tthis.attachEdit(newContentSource, range.end - range.start, range.start);\n\t\t\t}\n\t\t\tpublic enterNode(index: number): void {\n\t\t\t\tcursor.enterNode(index);\n\t\t\t}\n\t\t\tpublic exitNode(index: number): void {\n\t\t\t\tcursor.exitNode();\n\t\t\t}\n\t\t\tpublic enterField(key: FieldKey): void {\n\t\t\t\tcursor.enterField(key);\n\t\t\t}\n\t\t\tpublic exitField(key: FieldKey): void {\n\t\t\t\tcursor.exitField();\n\t\t\t}\n\t\t}\n\n\t\tconst forestVisitor = new Visitor(this);\n\t\tconst announcedVisitors: AnnouncedVisitor[] = [];\n\t\tthis.deltaVisitors.forEach((getVisitor) => announcedVisitors.push(getVisitor()));\n\t\tconst combinedVisitor = combineVisitors(\n\t\t\t[forestVisitor, ...announcedVisitors],\n\t\t\tannouncedVisitors,\n\t\t);\n\t\tthis.activeVisitor = combinedVisitor;\n\t\treturn combinedVisitor;\n\t}\n\n\tpublic registerAnnouncedVisitor(visitor: () => AnnouncedVisitor): void {\n\t\tthis.deltaVisitors.add(visitor);\n\t}\n\n\tpublic deregisterAnnouncedVisitor(visitor: () => AnnouncedVisitor): void {\n\t\tthis.deltaVisitors.delete(visitor);\n\t}\n\n\tprivate nextRange = 0;\n\tpublic newDetachedField(): DetachedField {\n\t\tconst range: DetachedField = brand(String(this.nextRange));\n\t\tthis.nextRange += 1;\n\t\treturn range;\n\t}\n\n\tprivate add(nodes: Iterable<ITreeCursor>, key: FieldKey): void {\n\t\tconst field = Array.from(nodes, mapTreeFromCursor) as MutableMapTree[];\n\t\tthis.addFieldAsDetached(field, key);\n\t}\n\n\tprivate addFieldAsDetached(field: MutableMapTree[], key: FieldKey): void {\n\t\tassert(!this.roots.fields.has(key), 0x370 /* new range must not already exist */);\n\t\tif (field.length > 0) {\n\t\t\tthis.#roots.fields.set(key, field);\n\t\t}\n\t}\n\n\tprivate delete(field: FieldKey): void {\n\t\tthis.#roots.fields.delete(field);\n\t}\n\n\tpublic allocateCursor(source?: string): Cursor {\n\t\treturn new Cursor(this, source);\n\t}\n\n\tpublic tryMoveCursorToNode(\n\t\tdestination: Anchor,\n\t\tcursorToMove: ITreeSubscriptionCursor,\n\t): TreeNavigationResult {\n\t\tconst path = this.anchors.locate(destination);\n\t\tif (path === undefined) {\n\t\t\treturn TreeNavigationResult.NotFound;\n\t\t}\n\t\tthis.moveCursorToPath(path, cursorToMove);\n\t\treturn TreeNavigationResult.Ok;\n\t}\n\n\tpublic tryMoveCursorToField(\n\t\tdestination: FieldAnchor,\n\t\tcursorToMove: ITreeSubscriptionCursor,\n\t): TreeNavigationResult {\n\t\tif (destination.parent === undefined) {\n\t\t\tthis.moveCursorToPath(undefined, cursorToMove);\n\t\t} else {\n\t\t\tconst result = this.tryMoveCursorToNode(destination.parent, cursorToMove);\n\t\t\tif (result !== TreeNavigationResult.Ok) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\tcursorToMove.enterField(destination.fieldKey);\n\t\treturn TreeNavigationResult.Ok;\n\t}\n\n\tpublic moveCursorToPath(\n\t\tdestination: UpPath | undefined,\n\t\tcursorToMove: ITreeSubscriptionCursor,\n\t): void {\n\t\tassert(\n\t\t\tcursorToMove instanceof Cursor,\n\t\t\t0x337 /* ObjectForest must only be given its own Cursor type */,\n\t\t);\n\t\tassert(\n\t\t\tcursorToMove.forest === this,\n\t\t\t0x338 /* ObjectForest must only be given its own Cursor */,\n\t\t);\n\n\t\tconst indexStack: number[] = [];\n\t\tconst keyStack: FieldKey[] = [];\n\n\t\tlet path: UpPath | undefined = destination;\n\t\twhile (path !== undefined) {\n\t\t\tindexStack.push(path.parentIndex);\n\t\t\tkeyStack.push(path.parentField);\n\t\t\tpath = path.parent;\n\t\t}\n\t\tcursorToMove.setToAboveDetachedSequences();\n\t\twhile (keyStack.length > 0) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tcursorToMove.enterField(keyStack.pop()!);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tcursorToMove.enterNode(indexStack.pop()!);\n\t\t}\n\n\t\treturn;\n\t}\n\n\tpublic getCursorAboveDetachedFields(): ITreeCursorSynchronous {\n\t\treturn cursorForMapTreeNode(this.roots);\n\t}\n}\n\n/**\n * Cursor implementation for ObjectForest.\n */\nclass Cursor extends SynchronousCursor implements ITreeSubscriptionCursor {\n\tpublic state: ITreeSubscriptionCursorState;\n\n\t/**\n\t * @param forest - forest this cursor navigates\n\t * @param innerCursor - underlying cursor implementation this wraps. `undefined` when state is not `Current`\n\t */\n\tpublic constructor(\n\t\tpublic readonly forest: ObjectForest,\n\t\tpublic readonly source: string | undefined,\n\t\tprivate innerCursor?: CursorWithNode<MutableMapTree>,\n\t) {\n\t\tsuper();\n\t\tif (innerCursor === undefined) {\n\t\t\tthis.state = ITreeSubscriptionCursorState.Cleared;\n\t\t} else {\n\t\t\tthis.state = ITreeSubscriptionCursorState.Current;\n\t\t\tthis.forest.currentCursors.add(this);\n\t\t}\n\t}\n\n\tpublic buildFieldAnchor(): FieldAnchor {\n\t\tconst path = this.getFieldPath();\n\t\tconst anchor =\n\t\t\tpath.parent === undefined ? undefined : this.forest.anchors.track(path.parent);\n\t\treturn { parent: anchor, fieldKey: path.field };\n\t}\n\tpublic getFieldPath(prefix?: PathRootPrefix): FieldUpPath {\n\t\tassert(this.innerCursor !== undefined, 0x45f /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.getFieldPath(prefix);\n\t}\n\tpublic get mode(): CursorLocationType {\n\t\tassert(this.innerCursor !== undefined, 0x42e /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.mode;\n\t}\n\n\tpublic nextField(): boolean {\n\t\tassert(this.innerCursor !== undefined, 0x42f /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.nextField();\n\t}\n\tpublic exitField(): void {\n\t\tassert(this.innerCursor !== undefined, 0x430 /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.exitField();\n\t}\n\tpublic override skipPendingFields(): boolean {\n\t\tassert(this.innerCursor !== undefined, 0x431 /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.skipPendingFields();\n\t}\n\tpublic getFieldKey(): FieldKey {\n\t\tassert(this.innerCursor !== undefined, 0x432 /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.getFieldKey();\n\t}\n\tpublic getFieldLength(): number {\n\t\tassert(this.innerCursor !== undefined, 0x433 /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.getFieldLength();\n\t}\n\tpublic firstNode(): boolean {\n\t\tassert(this.innerCursor !== undefined, 0x434 /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.firstNode();\n\t}\n\tpublic enterNode(childIndex: number): void {\n\t\tassert(this.innerCursor !== undefined, 0x435 /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.enterNode(childIndex);\n\t}\n\tpublic getPath(prefix?: PathRootPrefix): UpPath {\n\t\tassert(this.innerCursor !== undefined, 0x436 /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.getPath(prefix) ?? fail(0xb27 /* no path when at root */);\n\t}\n\tpublic get fieldIndex(): number {\n\t\tassert(this.innerCursor !== undefined, 0x437 /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.fieldIndex;\n\t}\n\tpublic get chunkStart(): number {\n\t\tassert(this.innerCursor !== undefined, 0x438 /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.chunkStart;\n\t}\n\tpublic get chunkLength(): number {\n\t\tassert(this.innerCursor !== undefined, 0x439 /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.chunkLength;\n\t}\n\tpublic seekNodes(offset: number): boolean {\n\t\tassert(this.innerCursor !== undefined, 0x43a /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.seekNodes(offset);\n\t}\n\tpublic nextNode(): boolean {\n\t\tassert(this.innerCursor !== undefined, 0x43b /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.nextNode();\n\t}\n\tpublic exitNode(): void {\n\t\tassert(this.innerCursor !== undefined, 0x43c /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.exitNode();\n\t}\n\tpublic firstField(): boolean {\n\t\tassert(this.innerCursor !== undefined, 0x43d /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.firstField();\n\t}\n\tpublic enterField(key: FieldKey): void {\n\t\tassert(this.innerCursor !== undefined, 0x43e /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.enterField(key);\n\t}\n\tpublic get type(): TreeNodeSchemaIdentifier {\n\t\tassert(this.innerCursor !== undefined, 0x43f /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.type;\n\t}\n\tpublic get value(): Value {\n\t\tassert(this.innerCursor !== undefined, 0x440 /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.value;\n\t}\n\n\t// TODO: tests for clear when not at root.\n\tpublic clear(): void {\n\t\tassert(\n\t\t\tthis.state !== ITreeSubscriptionCursorState.Freed,\n\t\t\t0x33b /* Cursor must not be freed */,\n\t\t);\n\t\tthis.state = ITreeSubscriptionCursorState.Cleared;\n\t\tthis.innerCursor = undefined;\n\t\tthis.forest.currentCursors.delete(this);\n\t}\n\n\t/**\n\t * Move this cursor to the special dummy node above the detached sequences.\n\t * Can be used when cleared (but not freed).\n\t */\n\tpublic setToAboveDetachedSequences(): void {\n\t\tassert(\n\t\t\tthis.state !== ITreeSubscriptionCursorState.Freed,\n\t\t\t0x33c /* Cursor must not be freed */,\n\t\t);\n\t\tthis.clear();\n\t\tthis.state = ITreeSubscriptionCursorState.Current;\n\t\t// Cast to a cursor of _mutable_ trees to allow direct manipulation of the tree data which is more efficient than doing immutable copies.\n\t\tthis.innerCursor = cursorForMapTreeNode(\n\t\t\tthis.forest.roots,\n\t\t) as CursorWithNode<MutableMapTree>;\n\t\tthis.forest.currentCursors.add(this);\n\t}\n\n\tpublic getNode(): MutableMapTree {\n\t\tassert(this.innerCursor !== undefined, 0x33e /* Cursor must be current to be used */);\n\t\treturn this.innerCursor.getNode();\n\t}\n\n\tpublic getParent(): [MutableMapTree, FieldKey] {\n\t\tassert(this.innerCursor !== undefined, 0x441 /* Cursor must be current to be used */);\n\t\t// This could be optimized to skip moving it accessing internals of cursor.\n\t\tconst key = this.innerCursor.getFieldKey();\n\t\tthis.innerCursor.exitField();\n\t\tconst node = this.innerCursor.getNode();\n\t\tthis.innerCursor.enterField(key);\n\t\treturn [node, key];\n\t}\n\n\tpublic fork(source?: string): ITreeSubscriptionCursor {\n\t\tassert(this.innerCursor !== undefined, 0x460 /* Cursor must be current to be used */);\n\t\treturn new Cursor(this.forest, source ?? `fork: ${this.source}`, this.innerCursor.fork());\n\t}\n\n\tpublic free(): void {\n\t\tassert(\n\t\t\tthis.state !== ITreeSubscriptionCursorState.Freed,\n\t\t\t0x33f /* Cursor must not be double freed */,\n\t\t);\n\t\tthis.forest.currentCursors.delete(this);\n\t\tthis.state = ITreeSubscriptionCursorState.Freed;\n\t}\n\n\tpublic buildAnchor(): Anchor {\n\t\tassert(\n\t\t\tthis.state === ITreeSubscriptionCursorState.Current,\n\t\t\t0x37a /* Cursor must be current to be used */,\n\t\t);\n\t\treturn this.forest.anchors.track(this.getPath());\n\t}\n}\n\n// This function is the folder level export for objectForest, and hides all the implementation types.\n// When other forest implementations are created (ex: optimized ones),\n// this function should likely be moved and updated to (at least conditionally) use them.\n/**\n * @returns an implementation of {@link IEditableForest} with no data or schema.\n */\nexport function buildForest(\n\tanchors?: AnchorSet,\n\tadditionalAsserts: boolean = false,\n): ObjectForest {\n\treturn new ObjectForest(anchors, additionalAsserts);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/schema-index/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,UAAU,EAEf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAGN,KAAK,gBAAgB,EAMrB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,wBAAgB,UAAU,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAkBzD;AAaD;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,UAAU,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAK5F"}
1
+ {"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/schema-index/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,UAAU,EAEf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAGN,KAAK,gBAAgB,EAMrB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,wBAAgB,UAAU,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAkBzD;AAaD;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,UAAU,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAK5F"}
@@ -2,9 +2,10 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ import { fail } from "@fluidframework/core-utils/internal";
5
6
  import { makeVersionedValidatedCodec, } from "../../codec/index.js";
6
7
  import { decodeFieldSchema, encodeFieldSchema, schemaFormat, storedSchemaDecodeDispatcher, toTreeNodeSchemaDataFormat, } from "../../core/index.js";
7
- import { brand, fail } from "../../util/index.js";
8
+ import { brand } from "../../util/index.js";
8
9
  import { Format } from "./format.js";
9
10
  export function encodeRepo(repo) {
10
11
  const nodeSchema = Object.create(null);
@@ -1 +1 @@
1
- {"version":3,"file":"codec.js","sourceRoot":"","sources":["../../../src/feature-libraries/schema-index/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGN,2BAA2B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAIN,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,4BAA4B,EAC5B,0BAA0B,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,UAAU,UAAU,CAAC,IAAsB;IAChD,MAAM,UAAU,GACf,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACrB,MAAM,eAAe,GAAG,iBAAiB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,CAAC,UAAU,CAAC,IAAI,CAAC;QACpD,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC;KACtC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\tmakeVersionedValidatedCodec,\n} from \"../../codec/index.js\";\nimport {\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n\ttype TreeStoredSchema,\n\tdecodeFieldSchema,\n\tencodeFieldSchema,\n\tschemaFormat,\n\tstoredSchemaDecodeDispatcher,\n\ttoTreeNodeSchemaDataFormat,\n} from \"../../core/index.js\";\nimport { brand, fail } from \"../../util/index.js\";\n\nimport { Format } from \"./format.js\";\n\nexport function encodeRepo(repo: TreeStoredSchema): Format {\n\tconst nodeSchema: Record<string, schemaFormat.TreeNodeSchemaDataFormat> =\n\t\tObject.create(null);\n\tconst rootFieldSchema = encodeFieldSchema(repo.rootFieldSchema);\n\tfor (const name of [...repo.nodeSchema.keys()].sort()) {\n\t\tconst schema = repo.nodeSchema.get(name) ?? fail(0xb28 /* missing schema */);\n\t\tObject.defineProperty(nodeSchema, name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: toTreeNodeSchemaDataFormat(schema.encode()),\n\t\t});\n\t}\n\treturn {\n\t\tversion: schemaFormat.version,\n\t\tnodes: nodeSchema,\n\t\troot: rootFieldSchema,\n\t};\n}\n\nfunction decode(f: Format): TreeStoredSchema {\n\tconst nodeSchema: Map<TreeNodeSchemaIdentifier, TreeNodeStoredSchema> = new Map();\n\tfor (const [key, schema] of Object.entries(f.nodes)) {\n\t\tnodeSchema.set(brand(key), storedSchemaDecodeDispatcher.dispatch(schema));\n\t}\n\treturn {\n\t\trootFieldSchema: decodeFieldSchema(f.root),\n\t\tnodeSchema,\n\t};\n}\n\n/**\n * Creates a codec which performs synchronous monolithic encoding of schema content.\n */\nexport function makeSchemaCodec(options: ICodecOptions): IJsonCodec<TreeStoredSchema, Format> {\n\treturn makeVersionedValidatedCodec(options, new Set([schemaFormat.version]), Format, {\n\t\tencode: (data: TreeStoredSchema) => encodeRepo(data),\n\t\tdecode: (data: Format) => decode(data),\n\t});\n}\n"]}
1
+ {"version":3,"file":"codec.js","sourceRoot":"","sources":["../../../src/feature-libraries/schema-index/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAC3D,OAAO,EAGN,2BAA2B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAIN,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,4BAA4B,EAC5B,0BAA0B,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,UAAU,UAAU,CAAC,IAAsB;IAChD,MAAM,UAAU,GACf,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACrB,MAAM,eAAe,GAAG,iBAAiB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAChE,KAAK,MAAM,IAAI,IAAI,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QACvD,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;QAC7E,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE;YACvC,UAAU,EAAE,IAAI;YAChB,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,0BAA0B,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;SAClD,CAAC,CAAC;IACJ,CAAC;IACD,OAAO;QACN,OAAO,EAAE,YAAY,CAAC,OAAO;QAC7B,KAAK,EAAE,UAAU;QACjB,IAAI,EAAE,eAAe;KACrB,CAAC;AACH,CAAC;AAED,SAAS,MAAM,CAAC,CAAS;IACxB,MAAM,UAAU,GAAwD,IAAI,GAAG,EAAE,CAAC;IAClF,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;QACrD,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,4BAA4B,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO;QACN,eAAe,EAAE,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC;QAC1C,UAAU;KACV,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,OAAsB;IACrD,OAAO,2BAA2B,CAAC,OAAO,EAAE,IAAI,GAAG,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE;QACpF,MAAM,EAAE,CAAC,IAAsB,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;QACpD,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC;KACtC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fail } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\tmakeVersionedValidatedCodec,\n} from \"../../codec/index.js\";\nimport {\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n\ttype TreeStoredSchema,\n\tdecodeFieldSchema,\n\tencodeFieldSchema,\n\tschemaFormat,\n\tstoredSchemaDecodeDispatcher,\n\ttoTreeNodeSchemaDataFormat,\n} from \"../../core/index.js\";\nimport { brand } from \"../../util/index.js\";\n\nimport { Format } from \"./format.js\";\n\nexport function encodeRepo(repo: TreeStoredSchema): Format {\n\tconst nodeSchema: Record<string, schemaFormat.TreeNodeSchemaDataFormat> =\n\t\tObject.create(null);\n\tconst rootFieldSchema = encodeFieldSchema(repo.rootFieldSchema);\n\tfor (const name of [...repo.nodeSchema.keys()].sort()) {\n\t\tconst schema = repo.nodeSchema.get(name) ?? fail(0xb28 /* missing schema */);\n\t\tObject.defineProperty(nodeSchema, name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: toTreeNodeSchemaDataFormat(schema.encode()),\n\t\t});\n\t}\n\treturn {\n\t\tversion: schemaFormat.version,\n\t\tnodes: nodeSchema,\n\t\troot: rootFieldSchema,\n\t};\n}\n\nfunction decode(f: Format): TreeStoredSchema {\n\tconst nodeSchema: Map<TreeNodeSchemaIdentifier, TreeNodeStoredSchema> = new Map();\n\tfor (const [key, schema] of Object.entries(f.nodes)) {\n\t\tnodeSchema.set(brand(key), storedSchemaDecodeDispatcher.dispatch(schema));\n\t}\n\treturn {\n\t\trootFieldSchema: decodeFieldSchema(f.root),\n\t\tnodeSchema,\n\t};\n}\n\n/**\n * Creates a codec which performs synchronous monolithic encoding of schema content.\n */\nexport function makeSchemaCodec(options: ICodecOptions): IJsonCodec<TreeStoredSchema, Format> {\n\treturn makeVersionedValidatedCodec(options, new Set([schemaFormat.version]), Format, {\n\t\tencode: (data: TreeStoredSchema) => encodeRepo(data),\n\t\tdecode: (data: Format) => decode(data),\n\t});\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { type RevisionMetadataSource } from "../../core/index.js";
6
- import { type IdAllocator } from "../../util/index.js";
6
+ import type { IdAllocator } from "../../util/index.js";
7
7
  import { type CrossFieldManager, type NodeChangeComposer } from "../modular-schema/index.js";
8
8
  import { type MoveEffectTable } from "./moveEffectTable.js";
9
9
  import { type Changeset, type Mark } from "./types.js";
@@ -1 +1 @@
1
- {"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/sequence-field/compose.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAEN,KAAK,sBAAsB,EAG3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,WAAW,EAAQ,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EACN,KAAK,iBAAiB,EAEtB,KAAK,kBAAkB,EAEvB,MAAM,4BAA4B,CAAC;AAKpC,OAAO,EAEN,KAAK,eAAe,EAQpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAGN,KAAK,SAAS,EAEd,KAAK,IAAI,EAMT,MAAM,YAAY,CAAC;AA6BpB;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,CACtB,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,SAAS,EAClB,YAAY,EAAE,kBAAkB,EAChC,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,iBAAiB,EAC1B,gBAAgB,EAAE,sBAAsB,GACtC,SAAS,CAQX;AAuZD,qBAAa,YAAY;IASvB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IATlC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;IACtC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAY;IACrC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAuC;IAC5E,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAuC;gBAG1E,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,SAAS,EACF,WAAW,EAAE,eAAe,EAC5B,gBAAgB,EAAE,sBAAsB;IAQnD,OAAO,IAAI,OAAO;IAIlB,GAAG,IAAI,YAAY;IAqD1B,OAAO,CAAC,WAAW;IAWnB,OAAO,C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lB,GAAG,IAAI,YAAY;IAqD1B,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,UAAU;IAUlB,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,aAAa;CAUrB;AAED,UAAU,YAAY;IACrB,QAAQ,CAAC,EAAE,IAAI,CAAC;IAChB,OAAO,CAAC,EAAE,IAAI,CAAC;CACf"}
@@ -2,9 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
5
+ import { assert, unreachableCase, fail } from "@fluidframework/core-utils/internal";
6
6
  import { offsetChangeAtomId, } from "../../core/index.js";
7
- import { fail } from "../../util/index.js";
8
7
  import { CrossFieldTarget, } from "../modular-schema/index.js";
9
8
  import { MarkListFactory } from "./markListFactory.js";
10
9
  import { MarkQueue } from "./markQueue.js";
@@ -1 +1 @@
1
- {"version":3,"file":"compose.js","sourceRoot":"","sources":["../../../src/feature-libraries/sequence-field/compose.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,EAIN,kBAAkB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAoB,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAEN,gBAAgB,GAGhB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAGN,2BAA2B,EAC3B,aAAa,EACb,SAAS,EACT,QAAQ,EACR,UAAU,EACV,SAAS,EACT,aAAa,GACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAUN,YAAY,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,mBAAm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AAK,CAAC,0CAA0C,CAAC,CAAC;IAClF,OAAO,MAAM,CAAC,KAAK,EAAE,yBAAyB,CAAC;AAChD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype ChangeAtomId,\n\ttype RevisionMetadataSource,\n\ttype RevisionTag,\n\toffsetChangeAtomId,\n} from \"../../core/index.js\";\nimport { type IdAllocator, fail } from \"../../util/index.js\";\nimport {\n\ttype CrossFieldManager,\n\tCrossFieldTarget,\n\ttype NodeChangeComposer,\n\ttype NodeId,\n} from \"../modular-schema/index.js\";\n\nimport type { MoveMarkEffect } from \"./helperTypes.js\";\nimport { MarkListFactory } from \"./markListFactory.js\";\nimport { MarkQueue } from \"./markQueue.js\";\nimport {\n\ttype MoveEffect,\n\ttype MoveEffectTable,\n\tgetCrossFieldTargetFromMove,\n\tgetMoveEffect,\n\tgetMoveIn,\n\tisMoveIn,\n\tisMoveMark,\n\tisMoveOut,\n\tsetMoveEffect,\n} from \"./moveEffectTable.js\";\nimport {\n\ttype Attach,\n\ttype CellMark,\n\ttype Changeset,\n\ttype Detach,\n\ttype Mark,\n\ttype MarkEffect,\n\ttype MarkList,\n\ttype MoveId,\n\ttype NoopMark,\n\tNoopMarkType,\n} from \"./types.js\";\nimport {\n\tCellOrder,\n\tareEqualCellIds,\n\tareInputCellsEmpty,\n\tareOutputCellsEmpty,\n\tasAttachAndDetach,\n\tcellSourcesFromMarks,\n\tcompareCellPositionsUsingTombstones,\n\textractMarkEffect,\n\tgetEndpoint,\n\tgetInputCellId,\n\tgetOutputCellId,\n\tisAttach,\n\tisAttachAndDetachEffect,\n\tisDetach,\n\tisImpactfulCellRename,\n\tisNewAttach,\n\tisNoopMark,\n\tisRename,\n\tmarkEmptiesCells,\n\tmarkFillsCells,\n\tmarkHasCellEffect,\n\tnormalizeCellRename,\n\tsettleMark,\n\twithNodeChange,\n\twithRevision,\n} from \"./utils.js\";\n\n/**\n * Composes a sequence of changesets into a single changeset.\n * @param changes - The changesets to be applied.\n * Parts of the input may be reused in the output, but the input is not mutated.\n * Each changeset in the list is assumed to be applicable after the previous one.\n * @returns A changeset that is equivalent to applying each of the given `changes` in order.\n *\n * WARNING! This implementation is incomplete:\n * - Tombstone information is ignored.\n * - Support for moves is not implemented.\n * - Support for slices is not implemented.\n */\nexport function compose(\n\tchange1: Changeset,\n\tchange2: Changeset,\n\tcomposeChild: NodeChangeComposer,\n\t_genId: IdAllocator,\n\tmanager: CrossFieldManager,\n\trevisionMetadata: RevisionMetadataSource,\n): Changeset {\n\treturn composeMarkLists(\n\t\tchange1,\n\t\tchange2,\n\t\tcomposeChild,\n\t\tmanager as MoveEffectTable,\n\t\trevisionMetadata,\n\t);\n}\n\nfunction composeMarkLists(\n\tbaseMarkList: MarkList,\n\tnewMarkList: MarkList,\n\tcomposeChild: NodeChangeComposer,\n\tmoveEffects: MoveEffectTable,\n\trevisionMetadata: RevisionMetadataSource,\n): MarkList {\n\tconst factory = new MarkListFactory();\n\tconst queue = new ComposeQueue(baseMarkList, newMarkList, moveEffects, revisionMetadata);\n\twhile (!queue.isEmpty()) {\n\t\tconst { baseMark, newMark } = queue.pop();\n\t\tif (newMark === undefined) {\n\t\t\tassert(\n\t\t\t\tbaseMark !== undefined,\n\t\t\t\t0x4db /* Non-empty queue should not return two undefined marks */,\n\t\t\t);\n\t\t\tfactory.push(\n\t\t\t\tcomposeMark(baseMark, moveEffects, (node: NodeId) =>\n\t\t\t\t\tcomposeChildChanges(node, undefined, composeChild),\n\t\t\t\t),\n\t\t\t);\n\t\t} else {\n\t\t\t// We only compose changesets that will not be further rebased.\n\t\t\t// It is therefore safe to remove any intentions that have no impact in the context they apply to.\n\t\t\tconst settledNewMark = settleMark(newMark);\n\t\t\tif (baseMark === undefined) {\n\t\t\t\tfactory.push(\n\t\t\t\t\tcomposeMark(settledNewMark, moveEffects, (node: NodeId) =>\n\t\t\t\t\t\tcomposeChildChanges(undefined, node, composeChild),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// Past this point, we are guaranteed that `settledNewMark` and `baseMark` have the same length and\n\t\t\t\t// start at the same location in the revision after the base changes.\n\t\t\t\t// They therefore refer to the same range for that revision.\n\t\t\t\tconst settledBaseMark = settleMark(baseMark);\n\t\t\t\tconst composedMark = composeMarks(\n\t\t\t\t\tsettledBaseMark,\n\t\t\t\t\tsettledNewMark,\n\t\t\t\t\tcomposeChild,\n\t\t\t\t\tmoveEffects,\n\t\t\t\t);\n\t\t\t\tfactory.push(composedMark);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn factory.list;\n}\n\n/**\n * Composes two marks where `newMark` is based on the state produced by `baseMark`.\n * @param baseMark - The mark to compose with `newMark`.\n * Its output range should be the same as `newMark`'s input range.\n * @param newRev - The revision the new mark is part of.\n * @param newMark - The mark to compose with `baseMark`.\n * Its input range should be the same as `baseMark`'s output range.\n * @returns A mark that is equivalent to applying both `baseMark` and `newMark` successively.\n */\nfunction composeMarks(\n\tbaseMark: Mark,\n\tnewMark: Mark,\n\tcomposeChild: NodeChangeComposer,\n\tmoveEffects: MoveEffectTable,\n): Mark {\n\tconst nodeChange = handleNodeChanges(baseMark, newMark, composeChild, moveEffects);\n\n\treturn withUpdatedEndpoint(\n\t\twithNodeChange(composeMarksIgnoreChild(baseMark, newMark, moveEffects), nodeChange),\n\t\tbaseMark.count,\n\t\tmoveEffects,\n\t);\n}\n\nfunction composeMarksIgnoreChild(\n\tbaseMark: Mark,\n\tnewMark: Mark,\n\tmoveEffects: MoveEffectTable,\n): Mark {\n\tif (isNoopMark(baseMark)) {\n\t\treturn newMark;\n\t} else if (isNoopMark(newMark)) {\n\t\treturn baseMark;\n\t}\n\n\tif (isRename(baseMark) && isRename(newMark)) {\n\t\treturn { ...baseMark, idOverride: newMark.idOverride };\n\t} else if (isRename(baseMark)) {\n\t\tassert(\n\t\t\tisAttach(newMark) || isAttachAndDetachEffect(newMark),\n\t\t\t0x9f1 /* Unexpected mark type */,\n\t\t);\n\t\treturn { ...newMark, cellId: baseMark.cellId };\n\t} else if (isRename(newMark)) {\n\t\tassert(\n\t\t\tisDetach(baseMark) || isAttachAndDetachEffect(baseMark),\n\t\t\t0x9f2 /* Unexpected mark type */,\n\t\t);\n\t\treturn isDetach(baseMark)\n\t\t\t? { ...baseMark, idOverride: newMark.idOverride }\n\t\t\t: { ...baseMark, detach: { ...baseMark.detach, idOverride: newMark.idOverride } };\n\t}\n\n\tif (isImpactfulCellRename(newMark)) {\n\t\tconst newAttachAndDetach = asAttachAndDetach(newMark);\n\t\tassert(\n\t\t\tnewAttachAndDetach.cellId !== undefined,\n\t\t\t0x9f3 /* Impactful cell rename must target empty cell */,\n\t\t);\n\t\tconst newDetachRevision = newAttachAndDetach.detach.revision;\n\t\tif (markEmptiesCells(baseMark)) {\n\t\t\t// baseMark is a detach which cancels with the attach portion of the AttachAndDetach,\n\t\t\t// so we are just left with the detach portion of the AttachAndDetach.\n\t\t\tconst newDetach: CellMark<Detach> = {\n\t\t\t\t...newAttachAndDetach.detach,\n\t\t\t\tcount: baseMark.count,\n\t\t\t};\n\n\t\t\tif (isMoveIn(newAttachAndDetach.attach) && isMoveOut(newAttachAndDetach.detach)) {\n\t\t\t\tassert(isMoveOut(baseMark), 0x808 /* Unexpected mark type */);\n\n\t\t\t\t// The base changeset and new changeset both move these nodes.\n\t\t\t\t// Call the original position of the nodes A, the position after the base changeset is applied B,\n\t\t\t\t// and the position after the new changeset is applied C.\n\t\t\t\t// The new changeset moves the nodes from B, temporarily returns them to A, and then moves them to C.\n\t\t\t\t// The composition of the base and new changesets will be a move directly from A to C,\n\t\t\t\t// since the move from A to B cancels out with the return from B to A.\n\t\t\t\t// This if-block is handling marks at A.\n\t\t\t\t// When we compose the marks at B we will link the start of the base move (A to B)\n\t\t\t\t// with the end of the new move (B to C).\n\t\t\t\t// Because we are replacing the mark representing the start of the move with the new changeset's\n\t\t\t\t// move-out from A, we update the base move-in at B to consider that its start point.\n\t\t\t\tconst newDetachId = {\n\t\t\t\t\trevision: newDetachRevision,\n\t\t\t\t\tlocalId: newAttachAndDetach.detach.id,\n\t\t\t\t};\n\n\t\t\t\tsetTruncatedEndpointForInner(\n\t\t\t\t\tmoveEffects,\n\t\t\t\t\tCrossFieldTarget.Destination,\n\t\t\t\t\tgetEndpoint(baseMark),\n\t\t\t\t\tbaseMark.count,\n\t\t\t\t\tnewDetachId,\n\t\t\t\t);\n\n\t\t\t\tconst newEndpoint = getComposedEndpoint(\n\t\t\t\t\tmoveEffects,\n\t\t\t\t\tCrossFieldTarget.Source,\n\t\t\t\t\tbaseMark.revision,\n\t\t\t\t\tbaseMark.id,\n\t\t\t\t\tbaseMark.count,\n\t\t\t\t);\n\n\t\t\t\tif (newEndpoint !== undefined) {\n\t\t\t\t\tchangeFinalEndpoint(newDetach as MoveMarkEffect, newEndpoint);\n\t\t\t\t\tsetTruncatedEndpoint(\n\t\t\t\t\t\tmoveEffects,\n\t\t\t\t\t\tCrossFieldTarget.Destination,\n\t\t\t\t\t\tnewEndpoint,\n\t\t\t\t\t\tbaseMark.count,\n\t\t\t\t\t\tnewDetachId,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn newDetach;\n\t\t}\n\n\t\tif (isImpactfulCellRename(baseMark)) {\n\t\t\tassert(\n\t\t\t\tbaseMark.cellId !== undefined,\n\t\t\t\t0x9f4 /* Impactful cell rename must target empty cell */,\n\t\t\t);\n\t\t\tconst baseAttachAndDetach = asAttachAndDetach(baseMark);\n\t\t\tconst newOutputId = getOutputCellId(newAttachAndDetach);\n\n\t\t\tconst originalAttach = { ...baseAttachAndDetach.attach };\n\t\t\tconst finalDetach = { ...newAttachAndDetach.detach };\n\n\t\t\thandleMovePivot(baseMark.count, originalAttach, finalDetach, moveEffects);\n\n\t\t\tif (areEqualCellIds(newOutputId, baseAttachAndDetach.cellId)) {\n\t\t\t\treturn { count: baseAttachAndDetach.count, cellId: baseAttachAndDetach.cellId };\n\t\t\t}\n\n\t\t\t// `newMark`'s attach portion cancels with `baseMark`'s detach portion.\n\t\t\tconst detachRevision = finalDetach.revision;\n\t\t\tif (detachRevision !== undefined) {\n\t\t\t\tfinalDetach.revision = detachRevision;\n\t\t\t}\n\n\t\t\treturn normalizeCellRename(baseMark.cellId, baseMark.count, originalAttach, finalDetach);\n\t\t}\n\n\t\treturn normalizeCellRename(\n\t\t\tnewAttachAndDetach.cellId,\n\t\t\tnewAttachAndDetach.count,\n\t\t\tnewAttachAndDetach.attach,\n\t\t\tnewAttachAndDetach.detach,\n\t\t);\n\t}\n\tif (isImpactfulCellRename(baseMark)) {\n\t\tconst baseAttachAndDetach = asAttachAndDetach(baseMark);\n\t\tif (markFillsCells(newMark)) {\n\t\t\tconst originalAttach = withRevision(\n\t\t\t\t{\n\t\t\t\t\t...baseAttachAndDetach.attach,\n\t\t\t\t\tcellId: baseAttachAndDetach.cellId,\n\t\t\t\t\tcount: baseAttachAndDetach.count,\n\t\t\t\t},\n\t\t\t\tbaseAttachAndDetach.attach.revision,\n\t\t\t);\n\n\t\t\tif (isMoveIn(baseAttachAndDetach.attach) && isMoveOut(baseAttachAndDetach.detach)) {\n\t\t\t\tassert(isMoveIn(newMark), 0x809 /* Unexpected mark type */);\n\n\t\t\t\tconst originalAttachId = {\n\t\t\t\t\trevision: baseAttachAndDetach.attach.revision,\n\t\t\t\t\tlocalId: baseAttachAndDetach.attach.id,\n\t\t\t\t};\n\n\t\t\t\tsetTruncatedEndpointForInner(\n\t\t\t\t\tmoveEffects,\n\t\t\t\t\tCrossFieldTarget.Source,\n\t\t\t\t\tgetEndpoint(newMark),\n\t\t\t\t\tbaseAttachAndDetach.count,\n\t\t\t\t\toriginalAttachId,\n\t\t\t\t);\n\n\t\t\t\tconst newEndpoint = getComposedEndpoint(\n\t\t\t\t\tmoveEffects,\n\t\t\t\t\tCrossFieldTarget.Destination,\n\t\t\t\t\tnewMark.revision,\n\t\t\t\t\tnewMark.id,\n\t\t\t\t\tnewMark.count,\n\t\t\t\t);\n\n\t\t\t\tif (newEndpoint !== undefined) {\n\t\t\t\t\tchangeFinalEndpoint(originalAttach as MoveMarkEffect, newEndpoint);\n\t\t\t\t\tsetTruncatedEndpoint(\n\t\t\t\t\t\tmoveEffects,\n\t\t\t\t\t\tCrossFieldTarget.Source,\n\t\t\t\t\t\tnewEndpoint,\n\t\t\t\t\t\tbaseMark.count,\n\t\t\t\t\t\toriginalAttachId,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn originalAttach;\n\t\t} else {\n\t\t\t// Other mark types have been handled by previous conditional branches.\n\t\t\tassert(newMark.type === NoopMarkType, 0x80a /* Unexpected mark type */);\n\t\t\treturn baseMark;\n\t\t}\n\t}\n\n\tif (!markHasCellEffect(baseMark) && !markHasCellEffect(newMark)) {\n\t\treturn createNoopMark(newMark.count, undefined, getInputCellId(baseMark));\n\t} else if (!markHasCellEffect(baseMark)) {\n\t\treturn newMark;\n\t} else if (!markHasCellEffect(newMark)) {\n\t\treturn baseMark;\n\t} else if (areInputCellsEmpty(baseMark)) {\n\t\tassert(isDetach(newMark), 0x71c /* Unexpected mark type */);\n\t\tassert(isAttach(baseMark), 0x71d /* Expected generative mark */);\n\n\t\tconst attach = extractMarkEffect(baseMark);\n\t\tconst detach = extractMarkEffect(newMark);\n\n\t\thandleMovePivot(baseMark.count, attach, detach, moveEffects);\n\n\t\tif (areEqualCellIds(getOutputCellId(newMark), baseMark.cellId)) {\n\t\t\t// The output and input cell IDs are the same, so this mark has no effect.\n\t\t\treturn { count: baseMark.count, cellId: baseMark.cellId };\n\t\t}\n\t\treturn normalizeCellRename(baseMark.cellId, baseMark.count, attach, detach);\n\t} else {\n\t\tconst length = baseMark.count;\n\t\treturn createNoopMark(length, undefined);\n\t}\n}\n\n/**\n * Checks if `baseAttach` and `newDetach` are both moves, and if so updates their move endpoints as appropriate,\n * and removes their `finalEndpoint` endpoint fields. Note that can mutate `baseAttach` and `newDetach`.\n * If the effects are not both moves this function does nothing.\n * @param count - The number of cells targeted\n * @param baseAttach - The base attach effect at this location\n * @param newDetach - The new detach effect at this location\n */\nfunction handleMovePivot(\n\tcount: number,\n\tbaseAttach: Attach,\n\tnewDetach: Detach,\n\tmoveEffects: MoveEffectTable,\n): void {\n\tif (isMoveIn(baseAttach) && isMoveOut(newDetach)) {\n\t\tconst finalSource = getEndpoint(baseAttach);\n\t\tconst finalDest = getEndpoint(newDetach);\n\n\t\tsetEndpoint(moveEffects, CrossFieldTarget.Source, finalSource, count, finalDest);\n\n\t\tconst truncatedEndpoint1 = getTruncatedEndpointForInner(\n\t\t\tmoveEffects,\n\t\t\tCrossFieldTarget.Destination,\n\t\t\tbaseAttach.revision,\n\t\t\tbaseAttach.id,\n\t\t\tcount,\n\t\t);\n\n\t\tif (truncatedEndpoint1 !== undefined) {\n\t\t\tsetTruncatedEndpoint(\n\t\t\t\tmoveEffects,\n\t\t\t\tCrossFieldTarget.Destination,\n\t\t\t\tfinalDest,\n\t\t\t\tcount,\n\t\t\t\ttruncatedEndpoint1,\n\t\t\t);\n\t\t}\n\n\t\tsetEndpoint(moveEffects, CrossFieldTarget.Destination, finalDest, count, finalSource);\n\n\t\tconst truncatedEndpoint2 = getTruncatedEndpointForInner(\n\t\t\tmoveEffects,\n\t\t\tCrossFieldTarget.Source,\n\t\t\tnewDetach.revision,\n\t\t\tnewDetach.id,\n\t\t\tcount,\n\t\t);\n\n\t\tif (truncatedEndpoint2 !== undefined) {\n\t\t\tsetTruncatedEndpoint(\n\t\t\t\tmoveEffects,\n\t\t\t\tCrossFieldTarget.Source,\n\t\t\t\tfinalSource,\n\t\t\t\tcount,\n\t\t\t\ttruncatedEndpoint2,\n\t\t\t);\n\t\t}\n\n\t\t// The `finalEndpoint` field of AttachAndDetach move effect pairs is not used,\n\t\t// so we remove it as a normalization.\n\t\tdelete baseAttach.finalEndpoint;\n\t\tdelete newDetach.finalEndpoint;\n\t}\n}\n\nfunction createNoopMark(\n\tlength: number,\n\tnodeChange: NodeId | undefined,\n\tcellId?: ChangeAtomId,\n): Mark {\n\tconst mark: CellMark<NoopMark> = { count: length };\n\tif (nodeChange !== undefined) {\n\t\tassert(length === 1, 0x692 /* A mark with a node change must have length one */);\n\t\tmark.changes = nodeChange;\n\t}\n\tif (cellId !== undefined) {\n\t\tmark.cellId = cellId;\n\t}\n\treturn mark;\n}\n\nfunction handleNodeChanges(\n\tbaseMark: Mark,\n\tnewMark: Mark,\n\tcomposeChild: NodeChangeComposer,\n\tmoveEffects: MoveEffectTable,\n): NodeId | undefined {\n\tif (newMark.changes !== undefined) {\n\t\tconst baseSource = getMoveIn(baseMark);\n\n\t\t// TODO: Make sure composeChild is not called twice on the node changes.\n\t\tif (baseSource !== undefined) {\n\t\t\tsetModifyAfter(moveEffects, getEndpoint(baseSource), newMark.changes);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\treturn composeChildChanges(baseMark.changes, newMark.changes, composeChild);\n}\n\nfunction composeChildChanges(\n\tbaseChange: NodeId | undefined,\n\tnewChange: NodeId | undefined,\n\tcomposeChild: NodeChangeComposer,\n): NodeId | undefined {\n\tif (baseChange === undefined && newChange === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn composeChild(baseChange, newChange);\n}\n\nfunction composeMark<TMark extends Mark>(\n\tmark: TMark,\n\tmoveEffects: MoveEffectTable,\n\tcomposeChild: (node: NodeId) => NodeId | undefined,\n): TMark {\n\tconst nodeChanges = mark.changes !== undefined ? composeChild(mark.changes) : undefined;\n\tconst updatedMark = withUpdatedEndpoint(mark, mark.count, moveEffects);\n\treturn withNodeChange(updatedMark, nodeChanges);\n}\n\nexport class ComposeQueue {\n\tprivate readonly baseMarks: MarkQueue;\n\tprivate readonly newMarks: MarkQueue;\n\tprivate readonly baseMarksCellSources: ReadonlySet<RevisionTag | undefined>;\n\tprivate readonly newMarksCellSources: ReadonlySet<RevisionTag | undefined>;\n\n\tpublic constructor(\n\t\tbaseMarks: Changeset,\n\t\tnewMarks: Changeset,\n\t\tprivate readonly moveEffects: MoveEffectTable,\n\t\tprivate readonly revisionMetadata: RevisionMetadataSource,\n\t) {\n\t\tthis.baseMarks = new MarkQueue(baseMarks, moveEffects);\n\t\tthis.newMarks = new MarkQueue(newMarks, moveEffects);\n\t\tthis.baseMarksCellSources = cellSourcesFromMarks(baseMarks, getOutputCellId);\n\t\tthis.newMarksCellSources = cellSourcesFromMarks(newMarks, getInputCellId);\n\t}\n\n\tpublic isEmpty(): boolean {\n\t\treturn this.baseMarks.isEmpty() && this.newMarks.isEmpty();\n\t}\n\n\tpublic pop(): ComposeMarks {\n\t\tconst baseMark = this.baseMarks.peek();\n\t\tconst newMark = this.newMarks.peek();\n\t\tif (baseMark === undefined && newMark === undefined) {\n\t\t\treturn {};\n\t\t} else if (baseMark === undefined) {\n\t\t\treturn this.dequeueNew();\n\t\t} else if (newMark === undefined) {\n\t\t\treturn this.dequeueBase();\n\t\t} else if (areOutputCellsEmpty(baseMark) && areInputCellsEmpty(newMark)) {\n\t\t\tconst baseCellId: ChangeAtomId =\n\t\t\t\tgetOutputCellId(baseMark) ?? fail(0xb29 /* Expected defined output ID */);\n\n\t\t\tif (markEmptiesCells(baseMark) && baseCellId.revision === undefined) {\n\t\t\t\t// The base revision should always be defined except when squashing changes into a transaction.\n\t\t\t\t// In the future, we want to support reattaches in the new change here.\n\t\t\t\t// We will need to be able to order the base mark relative to the new mark\n\t\t\t\t// (which requires the local changes to have a revision tag))\n\t\t\t\tassert(\n\t\t\t\t\tisNewAttach(newMark),\n\t\t\t\t\t0x695 /* TODO: Assign revision tags to each change in a transaction */,\n\t\t\t\t);\n\t\t\t\treturn this.dequeueNew();\n\t\t\t}\n\n\t\t\tconst newCellId = getInputCellId(newMark);\n\t\t\tassert(newCellId !== undefined, 0x89d /* Both marks should have cell IDs */);\n\t\t\tconst comparison = compareCellPositionsUsingTombstones(\n\t\t\t\tbaseCellId,\n\t\t\t\tnewCellId,\n\t\t\t\tthis.baseMarksCellSources,\n\t\t\t\tthis.newMarksCellSources,\n\t\t\t\tthis.revisionMetadata,\n\t\t\t);\n\t\t\tswitch (comparison) {\n\t\t\t\tcase CellOrder.SameCell:\n\t\t\t\t\treturn this.dequeueBoth();\n\t\t\t\tcase CellOrder.OldThenNew:\n\t\t\t\t\treturn this.dequeueBase();\n\t\t\t\tcase CellOrder.NewThenOld:\n\t\t\t\t\treturn this.dequeueNew();\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(comparison);\n\t\t\t}\n\t\t} else if (areOutputCellsEmpty(baseMark)) {\n\t\t\treturn this.dequeueBase();\n\t\t} else if (areInputCellsEmpty(newMark)) {\n\t\t\treturn this.dequeueNew();\n\t\t} else {\n\t\t\treturn this.dequeueBoth();\n\t\t}\n\t}\n\n\tprivate dequeueBase(length: number = Number.POSITIVE_INFINITY): ComposeMarks {\n\t\tconst baseMark = this.baseMarks.dequeueUpTo(length);\n\t\tconst movedChanges = getMovedChangesFromMark(this.moveEffects, baseMark);\n\t\tif (movedChanges !== undefined) {\n\t\t\tthis.moveEffects.onMoveIn(movedChanges);\n\t\t}\n\n\t\tconst newMark = createNoopMark(baseMark.count, movedChanges, getOutputCellId(baseMark));\n\t\treturn { baseMark, newMark };\n\t}\n\n\tprivate dequeueNew(length: number = Number.POSITIVE_INFINITY): ComposeMarks {\n\t\tconst newMark = this.newMarks.dequeueUpTo(length);\n\t\tconst baseMark = createNoopMark(newMark.count, undefined, getInputCellId(newMark));\n\n\t\treturn {\n\t\t\tbaseMark,\n\t\t\tnewMark,\n\t\t};\n\t}\n\n\tprivate dequeueBoth(): ComposeMarks {\n\t\tconst length = this.peekMinLength();\n\t\tconst baseMark = this.baseMarks.dequeueUpTo(length);\n\t\tlet newMark = this.newMarks.dequeueUpTo(length);\n\t\tconst movedChanges = getMovedChangesFromMark(this.moveEffects, baseMark);\n\n\t\tif (movedChanges !== undefined) {\n\t\t\tassert(newMark.changes === undefined, 0x8da /* Unexpected node changeset collision */);\n\t\t\tnewMark = withNodeChange(newMark, movedChanges);\n\t\t}\n\n\t\treturn {\n\t\t\tbaseMark,\n\t\t\tnewMark,\n\t\t};\n\t}\n\n\tprivate peekMinLength(): number {\n\t\tconst baseMark = this.baseMarks.peek();\n\t\tconst newMark = this.newMarks.peek();\n\t\tassert(\n\t\t\tbaseMark !== undefined && newMark !== undefined,\n\t\t\t0x8db /* Cannot peek length unless both mark queues are non-empty */,\n\t\t);\n\n\t\treturn Math.min(newMark.count, baseMark.count);\n\t}\n}\n\ninterface ComposeMarks {\n\tbaseMark?: Mark;\n\tnewMark?: Mark;\n}\n\nfunction getMovedChangesFromMark(\n\tmoveEffects: MoveEffectTable,\n\tmarkEffect: MarkEffect,\n): NodeId | undefined {\n\tif (isAttachAndDetachEffect(markEffect)) {\n\t\treturn getMovedChangesFromMark(moveEffects, markEffect.detach);\n\t}\n\tif (!isMoveOut(markEffect)) {\n\t\treturn undefined;\n\t}\n\n\treturn getModifyAfter(moveEffects, markEffect.revision, markEffect.id);\n}\n\n// It is expected that the range from `id` to `id + count - 1` has the same move effect.\n// The call sites to this function are making queries about a mark which has already been split by a `MarkQueue`\n// to match the ranges in `moveEffects`.\n// TODO: Reduce the duplication between this and other MoveEffect helpers\nfunction getModifyAfter(\n\tmoveEffects: MoveEffectTable,\n\trevision: RevisionTag | undefined,\n\tid: MoveId,\n): NodeId | undefined {\n\tconst target = CrossFieldTarget.Source;\n\tconst effect = getMoveEffect(moveEffects, target, revision, id, 1);\n\n\tif (effect.value?.modifyAfter !== undefined) {\n\t\treturn effect.value.modifyAfter;\n\t}\n\n\treturn undefined;\n}\n\n// TODO: Reduce the duplication between this and other MoveEffect helpers\nfunction setModifyAfter(\n\tmoveEffects: MoveEffectTable,\n\t{ revision, localId: id }: ChangeAtomId,\n\tmodifyAfter: NodeId,\n): void {\n\tconst target = CrossFieldTarget.Source;\n\tconst count = 1;\n\tconst effect = getMoveEffect(moveEffects, target, revision, id, count, false);\n\tconst newEffect: MoveEffect =\n\t\teffect.value !== undefined ? { ...effect.value, modifyAfter } : { modifyAfter };\n\tsetMoveEffect(moveEffects, target, revision, id, count, newEffect);\n}\n\nfunction setEndpoint(\n\tmoveEffects: MoveEffectTable,\n\ttarget: CrossFieldTarget,\n\tid: ChangeAtomId,\n\tcount: number,\n\tendpoint: ChangeAtomId,\n): void {\n\tconst effect = getMoveEffect(moveEffects, target, id.revision, id.localId, count, false);\n\tconst newEffect = effect.value !== undefined ? { ...effect.value, endpoint } : { endpoint };\n\tsetMoveEffect(moveEffects, target, id.revision, id.localId, effect.length, newEffect);\n\n\tconst remainingCount = count - effect.length;\n\tif (remainingCount > 0) {\n\t\tsetEndpoint(\n\t\t\tmoveEffects,\n\t\t\ttarget,\n\t\t\toffsetChangeAtomId(id, effect.length),\n\t\t\tremainingCount,\n\t\t\toffsetChangeAtomId(endpoint, effect.length),\n\t\t);\n\t}\n}\n\nfunction setTruncatedEndpoint(\n\tmoveEffects: MoveEffectTable,\n\ttarget: CrossFieldTarget,\n\tid: ChangeAtomId,\n\tcount: number,\n\ttruncatedEndpoint: ChangeAtomId,\n): void {\n\tconst effect = getMoveEffect(moveEffects, target, id.revision, id.localId, count);\n\tconst newEffect =\n\t\teffect.value !== undefined\n\t\t\t? { ...effect.value, truncatedEndpoint }\n\t\t\t: { truncatedEndpoint };\n\n\tsetMoveEffect(moveEffects, target, id.revision, id.localId, effect.length, newEffect);\n\n\tconst remainingCount = count - effect.length;\n\tif (remainingCount > 0) {\n\t\tsetTruncatedEndpoint(\n\t\t\tmoveEffects,\n\t\t\ttarget,\n\t\t\toffsetChangeAtomId(id, effect.length),\n\t\t\tremainingCount,\n\t\t\toffsetChangeAtomId(truncatedEndpoint, effect.length),\n\t\t);\n\t}\n}\n\nfunction setTruncatedEndpointForInner(\n\tmoveEffects: MoveEffectTable,\n\ttarget: CrossFieldTarget,\n\tid: ChangeAtomId,\n\tcount: number,\n\ttruncatedEndpointForInner: ChangeAtomId,\n): void {\n\tconst effect = getMoveEffect(moveEffects, target, id.revision, id.localId, count);\n\tconst newEffect =\n\t\teffect.value !== undefined\n\t\t\t? { ...effect.value, truncatedEndpointForInner }\n\t\t\t: { truncatedEndpointForInner };\n\tsetMoveEffect(moveEffects, target, id.revision, id.localId, effect.length, newEffect);\n\n\tconst remainingCount = count - effect.length;\n\tif (remainingCount > 0) {\n\t\tsetTruncatedEndpointForInner(\n\t\t\tmoveEffects,\n\t\t\ttarget,\n\t\t\toffsetChangeAtomId(id, effect.length),\n\t\t\tremainingCount,\n\t\t\toffsetChangeAtomId(truncatedEndpointForInner, effect.length),\n\t\t);\n\t}\n}\n\nfunction withUpdatedEndpoint<TMark extends MarkEffect>(\n\tmark: TMark,\n\tcount: number,\n\teffects: MoveEffectTable,\n): TMark {\n\tif (isAttachAndDetachEffect(mark)) {\n\t\treturn {\n\t\t\t...mark,\n\t\t\tattach: withUpdatedEndpoint(mark.attach, count, effects),\n\t\t\tdetach: withUpdatedEndpoint(mark.detach, count, effects),\n\t\t};\n\t}\n\n\tif (!isMoveMark(mark)) {\n\t\treturn mark;\n\t}\n\tconst finalDest = getComposedEndpoint(\n\t\teffects,\n\t\tgetCrossFieldTargetFromMove(mark),\n\t\tmark.revision,\n\t\tmark.id,\n\t\tcount,\n\t);\n\n\tif (finalDest === undefined) {\n\t\treturn mark;\n\t}\n\n\tconst output = { ...mark };\n\tchangeFinalEndpoint(output, finalDest);\n\n\treturn output;\n}\n\nfunction changeFinalEndpoint(mark: MoveMarkEffect, endpoint: ChangeAtomId): void {\n\tif (areEqualCellIds(endpoint, { revision: mark.revision, localId: mark.id })) {\n\t\tdelete mark.finalEndpoint;\n\t} else {\n\t\tmark.finalEndpoint = endpoint;\n\t}\n}\n\nfunction getComposedEndpoint(\n\tmoveEffects: MoveEffectTable,\n\ttarget: CrossFieldTarget,\n\trevision: RevisionTag | undefined,\n\tid: MoveId,\n\tcount: number,\n): ChangeAtomId | undefined {\n\tconst effect = getMoveEffect(moveEffects, target, revision, id, count);\n\tassert(effect.length === count, 0x815 /* Expected effect to cover entire mark */);\n\treturn effect.value?.truncatedEndpoint ?? effect.value?.endpoint;\n}\n\nfunction getTruncatedEndpointForInner(\n\tmoveEffects: MoveEffectTable,\n\ttarget: CrossFieldTarget,\n\trevision: RevisionTag | undefined,\n\tid: MoveId,\n\tcount: number,\n): ChangeAtomId | undefined {\n\tconst effect = getMoveEffect(moveEffects, target, revision, id, count);\n\tassert(effect.length === count, 0x934 /* Expected effect to cover entire mark */);\n\treturn effect.value?.truncatedEndpointForInner;\n}\n"]}
1
+ {"version":3,"file":"compose.js","sourceRoot":"","sources":["../../../src/feature-libraries/sequence-field/compose.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAEpF,OAAO,EAIN,kBAAkB,GAClB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAEN,gBAAgB,GAGhB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAGN,2BAA2B,EAC3B,aAAa,EACb,SAAS,EACT,QAAQ,EACR,UAAU,EACV,SAAS,EACT,aAAa,GACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAUN,YAAY,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,mCAAmC,EACnC,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,eAAe,EACf,QAAQ,EACR,uBAAuB,EACvB,QAAQ,EACR,qBAAqB,EACrB,WAAW,EACX,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACV,cAAc,E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CAAC,CAAC;IAEvC,OAAO,MAAM,CAAC;AACf,CAAC;AAED,SAAS,mBAAmB,CAAC,IAAoB,EAAE,QAAsB;IACxE,IAAI,eAAe,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;QAC9E,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;SAAM,CAAC;QACP,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC;IAC/B,CAAC;AACF,CAAC;AAED,SAAS,mBAAmB,CAC3B,WAA4B,EAC5B,MAAwB,EACxB,QAAiC,EACjC,EAAU,EACV,KAAa;IAEb,MAAM,MAAM,GAAG,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IACvE,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,KAAK,EAAE,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAClF,OAAO,MAAM,CAAC,KAAK,EAAE,iBAAiB,IAAI,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC;AAClE,CAAC;AAED,SAAS,4BAA4B,CACpC,WAA4B,EAC5B,MAAwB,EACxB,QAAiC,EACjC,EAAU,EACV,KAAa;IAEb,MAAM,MAAM,GAAG,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IACvE,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,KAAK,EAAE,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAClF,OAAO,MAAM,CAAC,KAAK,EAAE,yBAAyB,CAAC;AAChD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase, fail } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype ChangeAtomId,\n\ttype RevisionMetadataSource,\n\ttype RevisionTag,\n\toffsetChangeAtomId,\n} from \"../../core/index.js\";\nimport type { IdAllocator } from \"../../util/index.js\";\nimport {\n\ttype CrossFieldManager,\n\tCrossFieldTarget,\n\ttype NodeChangeComposer,\n\ttype NodeId,\n} from \"../modular-schema/index.js\";\n\nimport type { MoveMarkEffect } from \"./helperTypes.js\";\nimport { MarkListFactory } from \"./markListFactory.js\";\nimport { MarkQueue } from \"./markQueue.js\";\nimport {\n\ttype MoveEffect,\n\ttype MoveEffectTable,\n\tgetCrossFieldTargetFromMove,\n\tgetMoveEffect,\n\tgetMoveIn,\n\tisMoveIn,\n\tisMoveMark,\n\tisMoveOut,\n\tsetMoveEffect,\n} from \"./moveEffectTable.js\";\nimport {\n\ttype Attach,\n\ttype CellMark,\n\ttype Changeset,\n\ttype Detach,\n\ttype Mark,\n\ttype MarkEffect,\n\ttype MarkList,\n\ttype MoveId,\n\ttype NoopMark,\n\tNoopMarkType,\n} from \"./types.js\";\nimport {\n\tCellOrder,\n\tareEqualCellIds,\n\tareInputCellsEmpty,\n\tareOutputCellsEmpty,\n\tasAttachAndDetach,\n\tcellSourcesFromMarks,\n\tcompareCellPositionsUsingTombstones,\n\textractMarkEffect,\n\tgetEndpoint,\n\tgetInputCellId,\n\tgetOutputCellId,\n\tisAttach,\n\tisAttachAndDetachEffect,\n\tisDetach,\n\tisImpactfulCellRename,\n\tisNewAttach,\n\tisNoopMark,\n\tisRename,\n\tmarkEmptiesCells,\n\tmarkFillsCells,\n\tmarkHasCellEffect,\n\tnormalizeCellRename,\n\tsettleMark,\n\twithNodeChange,\n\twithRevision,\n} from \"./utils.js\";\n\n/**\n * Composes a sequence of changesets into a single changeset.\n * @param changes - The changesets to be applied.\n * Parts of the input may be reused in the output, but the input is not mutated.\n * Each changeset in the list is assumed to be applicable after the previous one.\n * @returns A changeset that is equivalent to applying each of the given `changes` in order.\n *\n * WARNING! This implementation is incomplete:\n * - Tombstone information is ignored.\n * - Support for moves is not implemented.\n * - Support for slices is not implemented.\n */\nexport function compose(\n\tchange1: Changeset,\n\tchange2: Changeset,\n\tcomposeChild: NodeChangeComposer,\n\t_genId: IdAllocator,\n\tmanager: CrossFieldManager,\n\trevisionMetadata: RevisionMetadataSource,\n): Changeset {\n\treturn composeMarkLists(\n\t\tchange1,\n\t\tchange2,\n\t\tcomposeChild,\n\t\tmanager as MoveEffectTable,\n\t\trevisionMetadata,\n\t);\n}\n\nfunction composeMarkLists(\n\tbaseMarkList: MarkList,\n\tnewMarkList: MarkList,\n\tcomposeChild: NodeChangeComposer,\n\tmoveEffects: MoveEffectTable,\n\trevisionMetadata: RevisionMetadataSource,\n): MarkList {\n\tconst factory = new MarkListFactory();\n\tconst queue = new ComposeQueue(baseMarkList, newMarkList, moveEffects, revisionMetadata);\n\twhile (!queue.isEmpty()) {\n\t\tconst { baseMark, newMark } = queue.pop();\n\t\tif (newMark === undefined) {\n\t\t\tassert(\n\t\t\t\tbaseMark !== undefined,\n\t\t\t\t0x4db /* Non-empty queue should not return two undefined marks */,\n\t\t\t);\n\t\t\tfactory.push(\n\t\t\t\tcomposeMark(baseMark, moveEffects, (node: NodeId) =>\n\t\t\t\t\tcomposeChildChanges(node, undefined, composeChild),\n\t\t\t\t),\n\t\t\t);\n\t\t} else {\n\t\t\t// We only compose changesets that will not be further rebased.\n\t\t\t// It is therefore safe to remove any intentions that have no impact in the context they apply to.\n\t\t\tconst settledNewMark = settleMark(newMark);\n\t\t\tif (baseMark === undefined) {\n\t\t\t\tfactory.push(\n\t\t\t\t\tcomposeMark(settledNewMark, moveEffects, (node: NodeId) =>\n\t\t\t\t\t\tcomposeChildChanges(undefined, node, composeChild),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// Past this point, we are guaranteed that `settledNewMark` and `baseMark` have the same length and\n\t\t\t\t// start at the same location in the revision after the base changes.\n\t\t\t\t// They therefore refer to the same range for that revision.\n\t\t\t\tconst settledBaseMark = settleMark(baseMark);\n\t\t\t\tconst composedMark = composeMarks(\n\t\t\t\t\tsettledBaseMark,\n\t\t\t\t\tsettledNewMark,\n\t\t\t\t\tcomposeChild,\n\t\t\t\t\tmoveEffects,\n\t\t\t\t);\n\t\t\t\tfactory.push(composedMark);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn factory.list;\n}\n\n/**\n * Composes two marks where `newMark` is based on the state produced by `baseMark`.\n * @param baseMark - The mark to compose with `newMark`.\n * Its output range should be the same as `newMark`'s input range.\n * @param newRev - The revision the new mark is part of.\n * @param newMark - The mark to compose with `baseMark`.\n * Its input range should be the same as `baseMark`'s output range.\n * @returns A mark that is equivalent to applying both `baseMark` and `newMark` successively.\n */\nfunction composeMarks(\n\tbaseMark: Mark,\n\tnewMark: Mark,\n\tcomposeChild: NodeChangeComposer,\n\tmoveEffects: MoveEffectTable,\n): Mark {\n\tconst nodeChange = handleNodeChanges(baseMark, newMark, composeChild, moveEffects);\n\n\treturn withUpdatedEndpoint(\n\t\twithNodeChange(composeMarksIgnoreChild(baseMark, newMark, moveEffects), nodeChange),\n\t\tbaseMark.count,\n\t\tmoveEffects,\n\t);\n}\n\nfunction composeMarksIgnoreChild(\n\tbaseMark: Mark,\n\tnewMark: Mark,\n\tmoveEffects: MoveEffectTable,\n): Mark {\n\tif (isNoopMark(baseMark)) {\n\t\treturn newMark;\n\t} else if (isNoopMark(newMark)) {\n\t\treturn baseMark;\n\t}\n\n\tif (isRename(baseMark) && isRename(newMark)) {\n\t\treturn { ...baseMark, idOverride: newMark.idOverride };\n\t} else if (isRename(baseMark)) {\n\t\tassert(\n\t\t\tisAttach(newMark) || isAttachAndDetachEffect(newMark),\n\t\t\t0x9f1 /* Unexpected mark type */,\n\t\t);\n\t\treturn { ...newMark, cellId: baseMark.cellId };\n\t} else if (isRename(newMark)) {\n\t\tassert(\n\t\t\tisDetach(baseMark) || isAttachAndDetachEffect(baseMark),\n\t\t\t0x9f2 /* Unexpected mark type */,\n\t\t);\n\t\treturn isDetach(baseMark)\n\t\t\t? { ...baseMark, idOverride: newMark.idOverride }\n\t\t\t: { ...baseMark, detach: { ...baseMark.detach, idOverride: newMark.idOverride } };\n\t}\n\n\tif (isImpactfulCellRename(newMark)) {\n\t\tconst newAttachAndDetach = asAttachAndDetach(newMark);\n\t\tassert(\n\t\t\tnewAttachAndDetach.cellId !== undefined,\n\t\t\t0x9f3 /* Impactful cell rename must target empty cell */,\n\t\t);\n\t\tconst newDetachRevision = newAttachAndDetach.detach.revision;\n\t\tif (markEmptiesCells(baseMark)) {\n\t\t\t// baseMark is a detach which cancels with the attach portion of the AttachAndDetach,\n\t\t\t// so we are just left with the detach portion of the AttachAndDetach.\n\t\t\tconst newDetach: CellMark<Detach> = {\n\t\t\t\t...newAttachAndDetach.detach,\n\t\t\t\tcount: baseMark.count,\n\t\t\t};\n\n\t\t\tif (isMoveIn(newAttachAndDetach.attach) && isMoveOut(newAttachAndDetach.detach)) {\n\t\t\t\tassert(isMoveOut(baseMark), 0x808 /* Unexpected mark type */);\n\n\t\t\t\t// The base changeset and new changeset both move these nodes.\n\t\t\t\t// Call the original position of the nodes A, the position after the base changeset is applied B,\n\t\t\t\t// and the position after the new changeset is applied C.\n\t\t\t\t// The new changeset moves the nodes from B, temporarily returns them to A, and then moves them to C.\n\t\t\t\t// The composition of the base and new changesets will be a move directly from A to C,\n\t\t\t\t// since the move from A to B cancels out with the return from B to A.\n\t\t\t\t// This if-block is handling marks at A.\n\t\t\t\t// When we compose the marks at B we will link the start of the base move (A to B)\n\t\t\t\t// with the end of the new move (B to C).\n\t\t\t\t// Because we are replacing the mark representing the start of the move with the new changeset's\n\t\t\t\t// move-out from A, we update the base move-in at B to consider that its start point.\n\t\t\t\tconst newDetachId = {\n\t\t\t\t\trevision: newDetachRevision,\n\t\t\t\t\tlocalId: newAttachAndDetach.detach.id,\n\t\t\t\t};\n\n\t\t\t\tsetTruncatedEndpointForInner(\n\t\t\t\t\tmoveEffects,\n\t\t\t\t\tCrossFieldTarget.Destination,\n\t\t\t\t\tgetEndpoint(baseMark),\n\t\t\t\t\tbaseMark.count,\n\t\t\t\t\tnewDetachId,\n\t\t\t\t);\n\n\t\t\t\tconst newEndpoint = getComposedEndpoint(\n\t\t\t\t\tmoveEffects,\n\t\t\t\t\tCrossFieldTarget.Source,\n\t\t\t\t\tbaseMark.revision,\n\t\t\t\t\tbaseMark.id,\n\t\t\t\t\tbaseMark.count,\n\t\t\t\t);\n\n\t\t\t\tif (newEndpoint !== undefined) {\n\t\t\t\t\tchangeFinalEndpoint(newDetach as MoveMarkEffect, newEndpoint);\n\t\t\t\t\tsetTruncatedEndpoint(\n\t\t\t\t\t\tmoveEffects,\n\t\t\t\t\t\tCrossFieldTarget.Destination,\n\t\t\t\t\t\tnewEndpoint,\n\t\t\t\t\t\tbaseMark.count,\n\t\t\t\t\t\tnewDetachId,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn newDetach;\n\t\t}\n\n\t\tif (isImpactfulCellRename(baseMark)) {\n\t\t\tassert(\n\t\t\t\tbaseMark.cellId !== undefined,\n\t\t\t\t0x9f4 /* Impactful cell rename must target empty cell */,\n\t\t\t);\n\t\t\tconst baseAttachAndDetach = asAttachAndDetach(baseMark);\n\t\t\tconst newOutputId = getOutputCellId(newAttachAndDetach);\n\n\t\t\tconst originalAttach = { ...baseAttachAndDetach.attach };\n\t\t\tconst finalDetach = { ...newAttachAndDetach.detach };\n\n\t\t\thandleMovePivot(baseMark.count, originalAttach, finalDetach, moveEffects);\n\n\t\t\tif (areEqualCellIds(newOutputId, baseAttachAndDetach.cellId)) {\n\t\t\t\treturn { count: baseAttachAndDetach.count, cellId: baseAttachAndDetach.cellId };\n\t\t\t}\n\n\t\t\t// `newMark`'s attach portion cancels with `baseMark`'s detach portion.\n\t\t\tconst detachRevision = finalDetach.revision;\n\t\t\tif (detachRevision !== undefined) {\n\t\t\t\tfinalDetach.revision = detachRevision;\n\t\t\t}\n\n\t\t\treturn normalizeCellRename(baseMark.cellId, baseMark.count, originalAttach, finalDetach);\n\t\t}\n\n\t\treturn normalizeCellRename(\n\t\t\tnewAttachAndDetach.cellId,\n\t\t\tnewAttachAndDetach.count,\n\t\t\tnewAttachAndDetach.attach,\n\t\t\tnewAttachAndDetach.detach,\n\t\t);\n\t}\n\tif (isImpactfulCellRename(baseMark)) {\n\t\tconst baseAttachAndDetach = asAttachAndDetach(baseMark);\n\t\tif (markFillsCells(newMark)) {\n\t\t\tconst originalAttach = withRevision(\n\t\t\t\t{\n\t\t\t\t\t...baseAttachAndDetach.attach,\n\t\t\t\t\tcellId: baseAttachAndDetach.cellId,\n\t\t\t\t\tcount: baseAttachAndDetach.count,\n\t\t\t\t},\n\t\t\t\tbaseAttachAndDetach.attach.revision,\n\t\t\t);\n\n\t\t\tif (isMoveIn(baseAttachAndDetach.attach) && isMoveOut(baseAttachAndDetach.detach)) {\n\t\t\t\tassert(isMoveIn(newMark), 0x809 /* Unexpected mark type */);\n\n\t\t\t\tconst originalAttachId = {\n\t\t\t\t\trevision: baseAttachAndDetach.attach.revision,\n\t\t\t\t\tlocalId: baseAttachAndDetach.attach.id,\n\t\t\t\t};\n\n\t\t\t\tsetTruncatedEndpointForInner(\n\t\t\t\t\tmoveEffects,\n\t\t\t\t\tCrossFieldTarget.Source,\n\t\t\t\t\tgetEndpoint(newMark),\n\t\t\t\t\tbaseAttachAndDetach.count,\n\t\t\t\t\toriginalAttachId,\n\t\t\t\t);\n\n\t\t\t\tconst newEndpoint = getComposedEndpoint(\n\t\t\t\t\tmoveEffects,\n\t\t\t\t\tCrossFieldTarget.Destination,\n\t\t\t\t\tnewMark.revision,\n\t\t\t\t\tnewMark.id,\n\t\t\t\t\tnewMark.count,\n\t\t\t\t);\n\n\t\t\t\tif (newEndpoint !== undefined) {\n\t\t\t\t\tchangeFinalEndpoint(originalAttach as MoveMarkEffect, newEndpoint);\n\t\t\t\t\tsetTruncatedEndpoint(\n\t\t\t\t\t\tmoveEffects,\n\t\t\t\t\t\tCrossFieldTarget.Source,\n\t\t\t\t\t\tnewEndpoint,\n\t\t\t\t\t\tbaseMark.count,\n\t\t\t\t\t\toriginalAttachId,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn originalAttach;\n\t\t} else {\n\t\t\t// Other mark types have been handled by previous conditional branches.\n\t\t\tassert(newMark.type === NoopMarkType, 0x80a /* Unexpected mark type */);\n\t\t\treturn baseMark;\n\t\t}\n\t}\n\n\tif (!markHasCellEffect(baseMark) && !markHasCellEffect(newMark)) {\n\t\treturn createNoopMark(newMark.count, undefined, getInputCellId(baseMark));\n\t} else if (!markHasCellEffect(baseMark)) {\n\t\treturn newMark;\n\t} else if (!markHasCellEffect(newMark)) {\n\t\treturn baseMark;\n\t} else if (areInputCellsEmpty(baseMark)) {\n\t\tassert(isDetach(newMark), 0x71c /* Unexpected mark type */);\n\t\tassert(isAttach(baseMark), 0x71d /* Expected generative mark */);\n\n\t\tconst attach = extractMarkEffect(baseMark);\n\t\tconst detach = extractMarkEffect(newMark);\n\n\t\thandleMovePivot(baseMark.count, attach, detach, moveEffects);\n\n\t\tif (areEqualCellIds(getOutputCellId(newMark), baseMark.cellId)) {\n\t\t\t// The output and input cell IDs are the same, so this mark has no effect.\n\t\t\treturn { count: baseMark.count, cellId: baseMark.cellId };\n\t\t}\n\t\treturn normalizeCellRename(baseMark.cellId, baseMark.count, attach, detach);\n\t} else {\n\t\tconst length = baseMark.count;\n\t\treturn createNoopMark(length, undefined);\n\t}\n}\n\n/**\n * Checks if `baseAttach` and `newDetach` are both moves, and if so updates their move endpoints as appropriate,\n * and removes their `finalEndpoint` endpoint fields. Note that can mutate `baseAttach` and `newDetach`.\n * If the effects are not both moves this function does nothing.\n * @param count - The number of cells targeted\n * @param baseAttach - The base attach effect at this location\n * @param newDetach - The new detach effect at this location\n */\nfunction handleMovePivot(\n\tcount: number,\n\tbaseAttach: Attach,\n\tnewDetach: Detach,\n\tmoveEffects: MoveEffectTable,\n): void {\n\tif (isMoveIn(baseAttach) && isMoveOut(newDetach)) {\n\t\tconst finalSource = getEndpoint(baseAttach);\n\t\tconst finalDest = getEndpoint(newDetach);\n\n\t\tsetEndpoint(moveEffects, CrossFieldTarget.Source, finalSource, count, finalDest);\n\n\t\tconst truncatedEndpoint1 = getTruncatedEndpointForInner(\n\t\t\tmoveEffects,\n\t\t\tCrossFieldTarget.Destination,\n\t\t\tbaseAttach.revision,\n\t\t\tbaseAttach.id,\n\t\t\tcount,\n\t\t);\n\n\t\tif (truncatedEndpoint1 !== undefined) {\n\t\t\tsetTruncatedEndpoint(\n\t\t\t\tmoveEffects,\n\t\t\t\tCrossFieldTarget.Destination,\n\t\t\t\tfinalDest,\n\t\t\t\tcount,\n\t\t\t\ttruncatedEndpoint1,\n\t\t\t);\n\t\t}\n\n\t\tsetEndpoint(moveEffects, CrossFieldTarget.Destination, finalDest, count, finalSource);\n\n\t\tconst truncatedEndpoint2 = getTruncatedEndpointForInner(\n\t\t\tmoveEffects,\n\t\t\tCrossFieldTarget.Source,\n\t\t\tnewDetach.revision,\n\t\t\tnewDetach.id,\n\t\t\tcount,\n\t\t);\n\n\t\tif (truncatedEndpoint2 !== undefined) {\n\t\t\tsetTruncatedEndpoint(\n\t\t\t\tmoveEffects,\n\t\t\t\tCrossFieldTarget.Source,\n\t\t\t\tfinalSource,\n\t\t\t\tcount,\n\t\t\t\ttruncatedEndpoint2,\n\t\t\t);\n\t\t}\n\n\t\t// The `finalEndpoint` field of AttachAndDetach move effect pairs is not used,\n\t\t// so we remove it as a normalization.\n\t\tdelete baseAttach.finalEndpoint;\n\t\tdelete newDetach.finalEndpoint;\n\t}\n}\n\nfunction createNoopMark(\n\tlength: number,\n\tnodeChange: NodeId | undefined,\n\tcellId?: ChangeAtomId,\n): Mark {\n\tconst mark: CellMark<NoopMark> = { count: length };\n\tif (nodeChange !== undefined) {\n\t\tassert(length === 1, 0x692 /* A mark with a node change must have length one */);\n\t\tmark.changes = nodeChange;\n\t}\n\tif (cellId !== undefined) {\n\t\tmark.cellId = cellId;\n\t}\n\treturn mark;\n}\n\nfunction handleNodeChanges(\n\tbaseMark: Mark,\n\tnewMark: Mark,\n\tcomposeChild: NodeChangeComposer,\n\tmoveEffects: MoveEffectTable,\n): NodeId | undefined {\n\tif (newMark.changes !== undefined) {\n\t\tconst baseSource = getMoveIn(baseMark);\n\n\t\t// TODO: Make sure composeChild is not called twice on the node changes.\n\t\tif (baseSource !== undefined) {\n\t\t\tsetModifyAfter(moveEffects, getEndpoint(baseSource), newMark.changes);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\treturn composeChildChanges(baseMark.changes, newMark.changes, composeChild);\n}\n\nfunction composeChildChanges(\n\tbaseChange: NodeId | undefined,\n\tnewChange: NodeId | undefined,\n\tcomposeChild: NodeChangeComposer,\n): NodeId | undefined {\n\tif (baseChange === undefined && newChange === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn composeChild(baseChange, newChange);\n}\n\nfunction composeMark<TMark extends Mark>(\n\tmark: TMark,\n\tmoveEffects: MoveEffectTable,\n\tcomposeChild: (node: NodeId) => NodeId | undefined,\n): TMark {\n\tconst nodeChanges = mark.changes !== undefined ? composeChild(mark.changes) : undefined;\n\tconst updatedMark = withUpdatedEndpoint(mark, mark.count, moveEffects);\n\treturn withNodeChange(updatedMark, nodeChanges);\n}\n\nexport class ComposeQueue {\n\tprivate readonly baseMarks: MarkQueue;\n\tprivate readonly newMarks: MarkQueue;\n\tprivate readonly baseMarksCellSources: ReadonlySet<RevisionTag | undefined>;\n\tprivate readonly newMarksCellSources: ReadonlySet<RevisionTag | undefined>;\n\n\tpublic constructor(\n\t\tbaseMarks: Changeset,\n\t\tnewMarks: Changeset,\n\t\tprivate readonly moveEffects: MoveEffectTable,\n\t\tprivate readonly revisionMetadata: RevisionMetadataSource,\n\t) {\n\t\tthis.baseMarks = new MarkQueue(baseMarks, moveEffects);\n\t\tthis.newMarks = new MarkQueue(newMarks, moveEffects);\n\t\tthis.baseMarksCellSources = cellSourcesFromMarks(baseMarks, getOutputCellId);\n\t\tthis.newMarksCellSources = cellSourcesFromMarks(newMarks, getInputCellId);\n\t}\n\n\tpublic isEmpty(): boolean {\n\t\treturn this.baseMarks.isEmpty() && this.newMarks.isEmpty();\n\t}\n\n\tpublic pop(): ComposeMarks {\n\t\tconst baseMark = this.baseMarks.peek();\n\t\tconst newMark = this.newMarks.peek();\n\t\tif (baseMark === undefined && newMark === undefined) {\n\t\t\treturn {};\n\t\t} else if (baseMark === undefined) {\n\t\t\treturn this.dequeueNew();\n\t\t} else if (newMark === undefined) {\n\t\t\treturn this.dequeueBase();\n\t\t} else if (areOutputCellsEmpty(baseMark) && areInputCellsEmpty(newMark)) {\n\t\t\tconst baseCellId: ChangeAtomId =\n\t\t\t\tgetOutputCellId(baseMark) ?? fail(0xb29 /* Expected defined output ID */);\n\n\t\t\tif (markEmptiesCells(baseMark) && baseCellId.revision === undefined) {\n\t\t\t\t// The base revision should always be defined except when squashing changes into a transaction.\n\t\t\t\t// In the future, we want to support reattaches in the new change here.\n\t\t\t\t// We will need to be able to order the base mark relative to the new mark\n\t\t\t\t// (which requires the local changes to have a revision tag))\n\t\t\t\tassert(\n\t\t\t\t\tisNewAttach(newMark),\n\t\t\t\t\t0x695 /* TODO: Assign revision tags to each change in a transaction */,\n\t\t\t\t);\n\t\t\t\treturn this.dequeueNew();\n\t\t\t}\n\n\t\t\tconst newCellId = getInputCellId(newMark);\n\t\t\tassert(newCellId !== undefined, 0x89d /* Both marks should have cell IDs */);\n\t\t\tconst comparison = compareCellPositionsUsingTombstones(\n\t\t\t\tbaseCellId,\n\t\t\t\tnewCellId,\n\t\t\t\tthis.baseMarksCellSources,\n\t\t\t\tthis.newMarksCellSources,\n\t\t\t\tthis.revisionMetadata,\n\t\t\t);\n\t\t\tswitch (comparison) {\n\t\t\t\tcase CellOrder.SameCell:\n\t\t\t\t\treturn this.dequeueBoth();\n\t\t\t\tcase CellOrder.OldThenNew:\n\t\t\t\t\treturn this.dequeueBase();\n\t\t\t\tcase CellOrder.NewThenOld:\n\t\t\t\t\treturn this.dequeueNew();\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(comparison);\n\t\t\t}\n\t\t} else if (areOutputCellsEmpty(baseMark)) {\n\t\t\treturn this.dequeueBase();\n\t\t} else if (areInputCellsEmpty(newMark)) {\n\t\t\treturn this.dequeueNew();\n\t\t} else {\n\t\t\treturn this.dequeueBoth();\n\t\t}\n\t}\n\n\tprivate dequeueBase(length: number = Number.POSITIVE_INFINITY): ComposeMarks {\n\t\tconst baseMark = this.baseMarks.dequeueUpTo(length);\n\t\tconst movedChanges = getMovedChangesFromMark(this.moveEffects, baseMark);\n\t\tif (movedChanges !== undefined) {\n\t\t\tthis.moveEffects.onMoveIn(movedChanges);\n\t\t}\n\n\t\tconst newMark = createNoopMark(baseMark.count, movedChanges, getOutputCellId(baseMark));\n\t\treturn { baseMark, newMark };\n\t}\n\n\tprivate dequeueNew(length: number = Number.POSITIVE_INFINITY): ComposeMarks {\n\t\tconst newMark = this.newMarks.dequeueUpTo(length);\n\t\tconst baseMark = createNoopMark(newMark.count, undefined, getInputCellId(newMark));\n\n\t\treturn {\n\t\t\tbaseMark,\n\t\t\tnewMark,\n\t\t};\n\t}\n\n\tprivate dequeueBoth(): ComposeMarks {\n\t\tconst length = this.peekMinLength();\n\t\tconst baseMark = this.baseMarks.dequeueUpTo(length);\n\t\tlet newMark = this.newMarks.dequeueUpTo(length);\n\t\tconst movedChanges = getMovedChangesFromMark(this.moveEffects, baseMark);\n\n\t\tif (movedChanges !== undefined) {\n\t\t\tassert(newMark.changes === undefined, 0x8da /* Unexpected node changeset collision */);\n\t\t\tnewMark = withNodeChange(newMark, movedChanges);\n\t\t}\n\n\t\treturn {\n\t\t\tbaseMark,\n\t\t\tnewMark,\n\t\t};\n\t}\n\n\tprivate peekMinLength(): number {\n\t\tconst baseMark = this.baseMarks.peek();\n\t\tconst newMark = this.newMarks.peek();\n\t\tassert(\n\t\t\tbaseMark !== undefined && newMark !== undefined,\n\t\t\t0x8db /* Cannot peek length unless both mark queues are non-empty */,\n\t\t);\n\n\t\treturn Math.min(newMark.count, baseMark.count);\n\t}\n}\n\ninterface ComposeMarks {\n\tbaseMark?: Mark;\n\tnewMark?: Mark;\n}\n\nfunction getMovedChangesFromMark(\n\tmoveEffects: MoveEffectTable,\n\tmarkEffect: MarkEffect,\n): NodeId | undefined {\n\tif (isAttachAndDetachEffect(markEffect)) {\n\t\treturn getMovedChangesFromMark(moveEffects, markEffect.detach);\n\t}\n\tif (!isMoveOut(markEffect)) {\n\t\treturn undefined;\n\t}\n\n\treturn getModifyAfter(moveEffects, markEffect.revision, markEffect.id);\n}\n\n// It is expected that the range from `id` to `id + count - 1` has the same move effect.\n// The call sites to this function are making queries about a mark which has already been split by a `MarkQueue`\n// to match the ranges in `moveEffects`.\n// TODO: Reduce the duplication between this and other MoveEffect helpers\nfunction getModifyAfter(\n\tmoveEffects: MoveEffectTable,\n\trevision: RevisionTag | undefined,\n\tid: MoveId,\n): NodeId | undefined {\n\tconst target = CrossFieldTarget.Source;\n\tconst effect = getMoveEffect(moveEffects, target, revision, id, 1);\n\n\tif (effect.value?.modifyAfter !== undefined) {\n\t\treturn effect.value.modifyAfter;\n\t}\n\n\treturn undefined;\n}\n\n// TODO: Reduce the duplication between this and other MoveEffect helpers\nfunction setModifyAfter(\n\tmoveEffects: MoveEffectTable,\n\t{ revision, localId: id }: ChangeAtomId,\n\tmodifyAfter: NodeId,\n): void {\n\tconst target = CrossFieldTarget.Source;\n\tconst count = 1;\n\tconst effect = getMoveEffect(moveEffects, target, revision, id, count, false);\n\tconst newEffect: MoveEffect =\n\t\teffect.value !== undefined ? { ...effect.value, modifyAfter } : { modifyAfter };\n\tsetMoveEffect(moveEffects, target, revision, id, count, newEffect);\n}\n\nfunction setEndpoint(\n\tmoveEffects: MoveEffectTable,\n\ttarget: CrossFieldTarget,\n\tid: ChangeAtomId,\n\tcount: number,\n\tendpoint: ChangeAtomId,\n): void {\n\tconst effect = getMoveEffect(moveEffects, target, id.revision, id.localId, count, false);\n\tconst newEffect = effect.value !== undefined ? { ...effect.value, endpoint } : { endpoint };\n\tsetMoveEffect(moveEffects, target, id.revision, id.localId, effect.length, newEffect);\n\n\tconst remainingCount = count - effect.length;\n\tif (remainingCount > 0) {\n\t\tsetEndpoint(\n\t\t\tmoveEffects,\n\t\t\ttarget,\n\t\t\toffsetChangeAtomId(id, effect.length),\n\t\t\tremainingCount,\n\t\t\toffsetChangeAtomId(endpoint, effect.length),\n\t\t);\n\t}\n}\n\nfunction setTruncatedEndpoint(\n\tmoveEffects: MoveEffectTable,\n\ttarget: CrossFieldTarget,\n\tid: ChangeAtomId,\n\tcount: number,\n\ttruncatedEndpoint: ChangeAtomId,\n): void {\n\tconst effect = getMoveEffect(moveEffects, target, id.revision, id.localId, count);\n\tconst newEffect =\n\t\teffect.value !== undefined\n\t\t\t? { ...effect.value, truncatedEndpoint }\n\t\t\t: { truncatedEndpoint };\n\n\tsetMoveEffect(moveEffects, target, id.revision, id.localId, effect.length, newEffect);\n\n\tconst remainingCount = count - effect.length;\n\tif (remainingCount > 0) {\n\t\tsetTruncatedEndpoint(\n\t\t\tmoveEffects,\n\t\t\ttarget,\n\t\t\toffsetChangeAtomId(id, effect.length),\n\t\t\tremainingCount,\n\t\t\toffsetChangeAtomId(truncatedEndpoint, effect.length),\n\t\t);\n\t}\n}\n\nfunction setTruncatedEndpointForInner(\n\tmoveEffects: MoveEffectTable,\n\ttarget: CrossFieldTarget,\n\tid: ChangeAtomId,\n\tcount: number,\n\ttruncatedEndpointForInner: ChangeAtomId,\n): void {\n\tconst effect = getMoveEffect(moveEffects, target, id.revision, id.localId, count);\n\tconst newEffect =\n\t\teffect.value !== undefined\n\t\t\t? { ...effect.value, truncatedEndpointForInner }\n\t\t\t: { truncatedEndpointForInner };\n\tsetMoveEffect(moveEffects, target, id.revision, id.localId, effect.length, newEffect);\n\n\tconst remainingCount = count - effect.length;\n\tif (remainingCount > 0) {\n\t\tsetTruncatedEndpointForInner(\n\t\t\tmoveEffects,\n\t\t\ttarget,\n\t\t\toffsetChangeAtomId(id, effect.length),\n\t\t\tremainingCount,\n\t\t\toffsetChangeAtomId(truncatedEndpointForInner, effect.length),\n\t\t);\n\t}\n}\n\nfunction withUpdatedEndpoint<TMark extends MarkEffect>(\n\tmark: TMark,\n\tcount: number,\n\teffects: MoveEffectTable,\n): TMark {\n\tif (isAttachAndDetachEffect(mark)) {\n\t\treturn {\n\t\t\t...mark,\n\t\t\tattach: withUpdatedEndpoint(mark.attach, count, effects),\n\t\t\tdetach: withUpdatedEndpoint(mark.detach, count, effects),\n\t\t};\n\t}\n\n\tif (!isMoveMark(mark)) {\n\t\treturn mark;\n\t}\n\tconst finalDest = getComposedEndpoint(\n\t\teffects,\n\t\tgetCrossFieldTargetFromMove(mark),\n\t\tmark.revision,\n\t\tmark.id,\n\t\tcount,\n\t);\n\n\tif (finalDest === undefined) {\n\t\treturn mark;\n\t}\n\n\tconst output = { ...mark };\n\tchangeFinalEndpoint(output, finalDest);\n\n\treturn output;\n}\n\nfunction changeFinalEndpoint(mark: MoveMarkEffect, endpoint: ChangeAtomId): void {\n\tif (areEqualCellIds(endpoint, { revision: mark.revision, localId: mark.id })) {\n\t\tdelete mark.finalEndpoint;\n\t} else {\n\t\tmark.finalEndpoint = endpoint;\n\t}\n}\n\nfunction getComposedEndpoint(\n\tmoveEffects: MoveEffectTable,\n\ttarget: CrossFieldTarget,\n\trevision: RevisionTag | undefined,\n\tid: MoveId,\n\tcount: number,\n): ChangeAtomId | undefined {\n\tconst effect = getMoveEffect(moveEffects, target, revision, id, count);\n\tassert(effect.length === count, 0x815 /* Expected effect to cover entire mark */);\n\treturn effect.value?.truncatedEndpoint ?? effect.value?.endpoint;\n}\n\nfunction getTruncatedEndpointForInner(\n\tmoveEffects: MoveEffectTable,\n\ttarget: CrossFieldTarget,\n\trevision: RevisionTag | undefined,\n\tid: MoveId,\n\tcount: number,\n): ChangeAtomId | undefined {\n\tconst effect = getMoveEffect(moveEffects, target, revision, id, count);\n\tassert(effect.length === count, 0x934 /* Expected effect to cover entire mark */);\n\treturn effect.value?.truncatedEndpointForInner;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"invert.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/sequence-field/invert.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,KAAK,WAAW,EAAiC,MAAM,qBAAqB,CAAC;AACtF,OAAO,EACN,KAAK,iBAAiB,EAGtB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAGN,KAAK,SAAS,EAWd,MAAM,YAAY,CAAC;AAepB;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CACrB,MAAM,EAAE,SAAS,EACjB,UAAU,EAAE,OAAO,EACnB,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,WAAW,GAAG,SAAS,EACjC,iBAAiB,EAAE,iBAAiB,GAClC,SAAS,CAOX"}
1
+ {"version":3,"file":"invert.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/sequence-field/invert.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,KAAK,WAAW,EAA2B,MAAM,qBAAqB,CAAC;AAChF,OAAO,EACN,KAAK,iBAAiB,EAGtB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAGN,KAAK,SAAS,EAWd,MAAM,YAAY,CAAC;AAepB;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CACrB,MAAM,EAAE,SAAS,EACjB,UAAU,EAAE,OAAO,EACnB,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,WAAW,GAAG,SAAS,EACjC,iBAAiB,EAAE,iBAAiB,GAClC,SAAS,CAOX"}
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
6
- import { fail, hasSingle } from "../../util/index.js";
5
+ import { assert, unreachableCase, fail } from "@fluidframework/core-utils/internal";
6
+ import { hasSingle } from "../../util/index.js";
7
7
  import { CrossFieldTarget, } from "../modular-schema/index.js";
8
8
  import { MarkListFactory } from "./markListFactory.js";
9
9
  import { NoopMarkType, } from "./types.js";