@fluidframework/tree 2.21.0 → 2.22.1

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 (327) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +1 -0
  3. package/api-report/tree.alpha.api.md +29 -4
  4. package/api-report/tree.beta.api.md +29 -4
  5. package/api-report/tree.legacy.alpha.api.md +29 -4
  6. package/api-report/tree.legacy.public.api.md +29 -4
  7. package/api-report/tree.public.api.md +29 -4
  8. package/dist/alpha.d.ts +1 -0
  9. package/dist/beta.d.ts +1 -0
  10. package/dist/core/forest/editableForest.js +1 -1
  11. package/dist/core/forest/editableForest.js.map +1 -1
  12. package/dist/core/index.d.ts +1 -1
  13. package/dist/core/index.d.ts.map +1 -1
  14. package/dist/core/index.js.map +1 -1
  15. package/dist/core/tree/anchorSet.d.ts +2 -5
  16. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  17. package/dist/core/tree/anchorSet.js +1 -151
  18. package/dist/core/tree/anchorSet.js.map +1 -1
  19. package/dist/core/tree/index.d.ts +1 -2
  20. package/dist/core/tree/index.d.ts.map +1 -1
  21. package/dist/core/tree/index.js.map +1 -1
  22. package/dist/core/tree/pathTree.d.ts +0 -11
  23. package/dist/core/tree/pathTree.d.ts.map +1 -1
  24. package/dist/core/tree/pathTree.js.map +1 -1
  25. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
  26. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  27. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
  28. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  29. package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts +1 -2
  30. package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
  31. package/dist/feature-libraries/detachedFieldIndexSummarizer.js +0 -9
  32. package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  33. package/dist/feature-libraries/flex-tree/treeEvents.d.ts +2 -4
  34. package/dist/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
  35. package/dist/feature-libraries/flex-tree/treeEvents.js.map +1 -1
  36. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +1 -2
  37. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  38. package/dist/feature-libraries/forest-summary/forestSummarizer.js +0 -9
  39. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  40. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +6 -2
  41. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  42. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  43. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -4
  44. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  45. package/dist/feature-libraries/modular-schema/genericFieldKind.js +4 -19
  46. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  47. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  48. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +11 -12
  49. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  50. package/dist/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
  51. package/dist/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
  52. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  53. package/dist/feature-libraries/optional-field/optionalField.js +7 -3
  54. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  55. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +3 -5
  56. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  57. package/dist/feature-libraries/schema-index/schemaSummarizer.js +1 -11
  58. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  59. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +1 -1
  60. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  61. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js +13 -1
  62. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  63. package/dist/index.d.ts +3 -3
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +4 -4
  66. package/dist/index.js.map +1 -1
  67. package/dist/legacy.d.ts +1 -0
  68. package/dist/packageVersion.d.ts +1 -1
  69. package/dist/packageVersion.js +1 -1
  70. package/dist/packageVersion.js.map +1 -1
  71. package/dist/public.d.ts +1 -0
  72. package/dist/shared-tree/index.d.ts +1 -3
  73. package/dist/shared-tree/index.d.ts.map +1 -1
  74. package/dist/shared-tree/index.js +1 -7
  75. package/dist/shared-tree/index.js.map +1 -1
  76. package/dist/shared-tree/schematizingTreeView.d.ts +4 -5
  77. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  78. package/dist/shared-tree/schematizingTreeView.js +9 -10
  79. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  80. package/dist/shared-tree/sharedTree.d.ts +39 -39
  81. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  82. package/dist/shared-tree/sharedTree.js +81 -52
  83. package/dist/shared-tree/sharedTree.js.map +1 -1
  84. package/dist/shared-tree/treeApi.d.ts +2 -2
  85. package/dist/shared-tree/treeApi.d.ts.map +1 -1
  86. package/dist/shared-tree/treeApi.js +9 -3
  87. package/dist/shared-tree/treeApi.js.map +1 -1
  88. package/dist/shared-tree/treeCheckout.d.ts +3 -3
  89. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  90. package/dist/shared-tree/treeCheckout.js +3 -2
  91. package/dist/shared-tree/treeCheckout.js.map +1 -1
  92. package/dist/shared-tree-core/editManager.js +1 -1
  93. package/dist/shared-tree-core/editManager.js.map +1 -1
  94. package/dist/shared-tree-core/editManagerSummarizer.d.ts +1 -2
  95. package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  96. package/dist/shared-tree-core/editManagerSummarizer.js +0 -9
  97. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  98. package/dist/shared-tree-core/sequenceIdUtils.d.ts +12 -1
  99. package/dist/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  100. package/dist/shared-tree-core/sequenceIdUtils.js +25 -7
  101. package/dist/shared-tree-core/sequenceIdUtils.js.map +1 -1
  102. package/dist/shared-tree-core/sharedTreeCore.d.ts +25 -30
  103. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  104. package/dist/shared-tree-core/sharedTreeCore.js +20 -49
  105. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  106. package/dist/simple-tree/api/index.d.ts +3 -2
  107. package/dist/simple-tree/api/index.d.ts.map +1 -1
  108. package/dist/simple-tree/api/index.js +3 -1
  109. package/dist/simple-tree/api/index.js.map +1 -1
  110. package/dist/simple-tree/api/schemaFactory.d.ts +156 -63
  111. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  112. package/dist/simple-tree/api/schemaFactory.js +179 -86
  113. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  114. package/dist/{shared-tree → simple-tree/api}/transactionTypes.d.ts +1 -1
  115. package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -0
  116. package/dist/{shared-tree → simple-tree/api}/transactionTypes.js.map +1 -1
  117. package/dist/simple-tree/api/tree.d.ts +23 -2
  118. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  119. package/dist/simple-tree/api/tree.js.map +1 -1
  120. package/dist/simple-tree/index.d.ts +1 -1
  121. package/dist/simple-tree/index.d.ts.map +1 -1
  122. package/dist/simple-tree/index.js +3 -2
  123. package/dist/simple-tree/index.js.map +1 -1
  124. package/dist/simple-tree/schemaTypes.d.ts +2 -2
  125. package/dist/simple-tree/schemaTypes.js +1 -1
  126. package/dist/simple-tree/schemaTypes.js.map +1 -1
  127. package/dist/simple-tree/treeNodeValid.js +1 -2
  128. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  129. package/dist/treeFactory.d.ts +16 -5
  130. package/dist/treeFactory.d.ts.map +1 -1
  131. package/dist/treeFactory.js +21 -12
  132. package/dist/treeFactory.js.map +1 -1
  133. package/dist/util/breakable.d.ts +1 -1
  134. package/dist/util/breakable.d.ts.map +1 -1
  135. package/dist/util/breakable.js.map +1 -1
  136. package/dist/util/rangeMap.d.ts +1 -1
  137. package/dist/util/rangeMap.js +1 -1
  138. package/dist/util/rangeMap.js.map +1 -1
  139. package/lib/alpha.d.ts +1 -0
  140. package/lib/beta.d.ts +1 -0
  141. package/lib/core/forest/editableForest.js +1 -1
  142. package/lib/core/forest/editableForest.js.map +1 -1
  143. package/lib/core/index.d.ts +1 -1
  144. package/lib/core/index.d.ts.map +1 -1
  145. package/lib/core/index.js.map +1 -1
  146. package/lib/core/tree/anchorSet.d.ts +2 -5
  147. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  148. package/lib/core/tree/anchorSet.js +1 -151
  149. package/lib/core/tree/anchorSet.js.map +1 -1
  150. package/lib/core/tree/index.d.ts +1 -2
  151. package/lib/core/tree/index.d.ts.map +1 -1
  152. package/lib/core/tree/index.js.map +1 -1
  153. package/lib/core/tree/pathTree.d.ts +0 -11
  154. package/lib/core/tree/pathTree.d.ts.map +1 -1
  155. package/lib/core/tree/pathTree.js.map +1 -1
  156. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
  157. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  158. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
  159. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  160. package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts +1 -2
  161. package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
  162. package/lib/feature-libraries/detachedFieldIndexSummarizer.js +0 -9
  163. package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  164. package/lib/feature-libraries/flex-tree/treeEvents.d.ts +2 -4
  165. package/lib/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
  166. package/lib/feature-libraries/flex-tree/treeEvents.js.map +1 -1
  167. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +1 -2
  168. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  169. package/lib/feature-libraries/forest-summary/forestSummarizer.js +0 -9
  170. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  171. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +6 -2
  172. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  173. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  174. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -4
  175. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  176. package/lib/feature-libraries/modular-schema/genericFieldKind.js +4 -19
  177. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  178. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  179. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +11 -12
  180. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  181. package/lib/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
  182. package/lib/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
  183. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  184. package/lib/feature-libraries/optional-field/optionalField.js +7 -3
  185. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  186. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +3 -5
  187. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  188. package/lib/feature-libraries/schema-index/schemaSummarizer.js +1 -11
  189. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  190. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +1 -1
  191. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  192. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js +13 -1
  193. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  194. package/lib/index.d.ts +3 -3
  195. package/lib/index.d.ts.map +1 -1
  196. package/lib/index.js +3 -3
  197. package/lib/index.js.map +1 -1
  198. package/lib/legacy.d.ts +1 -0
  199. package/lib/packageVersion.d.ts +1 -1
  200. package/lib/packageVersion.js +1 -1
  201. package/lib/packageVersion.js.map +1 -1
  202. package/lib/public.d.ts +1 -0
  203. package/lib/shared-tree/index.d.ts +1 -3
  204. package/lib/shared-tree/index.d.ts.map +1 -1
  205. package/lib/shared-tree/index.js +1 -3
  206. package/lib/shared-tree/index.js.map +1 -1
  207. package/lib/shared-tree/schematizingTreeView.d.ts +4 -5
  208. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  209. package/lib/shared-tree/schematizingTreeView.js +4 -5
  210. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  211. package/lib/shared-tree/sharedTree.d.ts +39 -39
  212. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  213. package/lib/shared-tree/sharedTree.js +79 -50
  214. package/lib/shared-tree/sharedTree.js.map +1 -1
  215. package/lib/shared-tree/treeApi.d.ts +2 -2
  216. package/lib/shared-tree/treeApi.d.ts.map +1 -1
  217. package/lib/shared-tree/treeApi.js +8 -2
  218. package/lib/shared-tree/treeApi.js.map +1 -1
  219. package/lib/shared-tree/treeCheckout.d.ts +3 -3
  220. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  221. package/lib/shared-tree/treeCheckout.js +4 -3
  222. package/lib/shared-tree/treeCheckout.js.map +1 -1
  223. package/lib/shared-tree-core/editManager.js +2 -2
  224. package/lib/shared-tree-core/editManager.js.map +1 -1
  225. package/lib/shared-tree-core/editManagerSummarizer.d.ts +1 -2
  226. package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  227. package/lib/shared-tree-core/editManagerSummarizer.js +0 -9
  228. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  229. package/lib/shared-tree-core/sequenceIdUtils.d.ts +12 -1
  230. package/lib/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  231. package/lib/shared-tree-core/sequenceIdUtils.js +23 -5
  232. package/lib/shared-tree-core/sequenceIdUtils.js.map +1 -1
  233. package/lib/shared-tree-core/sharedTreeCore.d.ts +25 -30
  234. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  235. package/lib/shared-tree-core/sharedTreeCore.js +19 -48
  236. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  237. package/lib/simple-tree/api/index.d.ts +3 -2
  238. package/lib/simple-tree/api/index.d.ts.map +1 -1
  239. package/lib/simple-tree/api/index.js +1 -0
  240. package/lib/simple-tree/api/index.js.map +1 -1
  241. package/lib/simple-tree/api/schemaFactory.d.ts +156 -63
  242. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  243. package/lib/simple-tree/api/schemaFactory.js +178 -85
  244. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  245. package/lib/{shared-tree → simple-tree/api}/transactionTypes.d.ts +1 -1
  246. package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -0
  247. package/lib/{shared-tree → simple-tree/api}/transactionTypes.js.map +1 -1
  248. package/lib/simple-tree/api/tree.d.ts +23 -2
  249. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  250. package/lib/simple-tree/api/tree.js.map +1 -1
  251. package/lib/simple-tree/index.d.ts +1 -1
  252. package/lib/simple-tree/index.d.ts.map +1 -1
  253. package/lib/simple-tree/index.js +1 -1
  254. package/lib/simple-tree/index.js.map +1 -1
  255. package/lib/simple-tree/schemaTypes.d.ts +2 -2
  256. package/lib/simple-tree/schemaTypes.js +1 -1
  257. package/lib/simple-tree/schemaTypes.js.map +1 -1
  258. package/lib/simple-tree/treeNodeValid.js +1 -2
  259. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  260. package/lib/treeFactory.d.ts +16 -5
  261. package/lib/treeFactory.d.ts.map +1 -1
  262. package/lib/treeFactory.js +20 -11
  263. package/lib/treeFactory.js.map +1 -1
  264. package/lib/util/breakable.d.ts +1 -1
  265. package/lib/util/breakable.d.ts.map +1 -1
  266. package/lib/util/breakable.js.map +1 -1
  267. package/lib/util/rangeMap.d.ts +1 -1
  268. package/lib/util/rangeMap.js +1 -1
  269. package/lib/util/rangeMap.js.map +1 -1
  270. package/package.json +21 -21
  271. package/src/core/forest/editableForest.ts +1 -1
  272. package/src/core/index.ts +0 -3
  273. package/src/core/tree/anchorSet.ts +4 -197
  274. package/src/core/tree/index.ts +0 -3
  275. package/src/core/tree/pathTree.ts +0 -13
  276. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -1
  277. package/src/feature-libraries/detachedFieldIndexSummarizer.ts +0 -11
  278. package/src/feature-libraries/flex-tree/treeEvents.ts +2 -4
  279. package/src/feature-libraries/forest-summary/forestSummarizer.ts +0 -11
  280. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +6 -2
  281. package/src/feature-libraries/modular-schema/genericFieldKind.ts +3 -35
  282. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +9 -42
  283. package/src/feature-libraries/optional-field/optionalField.ts +10 -3
  284. package/src/feature-libraries/schema-index/schemaSummarizer.ts +1 -16
  285. package/src/feature-libraries/sequence-field/sequenceFieldEditor.ts +13 -2
  286. package/src/index.ts +15 -12
  287. package/src/packageVersion.ts +1 -1
  288. package/src/shared-tree/index.ts +3 -19
  289. package/src/shared-tree/schematizingTreeView.ts +18 -16
  290. package/src/shared-tree/sharedTree.ts +203 -100
  291. package/src/shared-tree/treeApi.ts +10 -1
  292. package/src/shared-tree/treeCheckout.ts +11 -8
  293. package/src/shared-tree-core/editManager.ts +2 -2
  294. package/src/shared-tree-core/editManagerSummarizer.ts +0 -11
  295. package/src/shared-tree-core/sequenceIdUtils.ts +26 -5
  296. package/src/shared-tree-core/sharedTreeCore.ts +30 -87
  297. package/src/simple-tree/api/index.ts +15 -0
  298. package/src/simple-tree/api/schemaFactory.ts +203 -89
  299. package/src/{shared-tree → simple-tree/api}/transactionTypes.ts +1 -1
  300. package/src/simple-tree/api/tree.ts +31 -6
  301. package/src/simple-tree/index.ts +12 -0
  302. package/src/simple-tree/schemaTypes.ts +2 -2
  303. package/src/treeFactory.ts +29 -11
  304. package/src/util/breakable.ts +1 -1
  305. package/src/util/rangeMap.ts +1 -1
  306. package/dist/core/tree/visitPath.d.ts +0 -101
  307. package/dist/core/tree/visitPath.d.ts.map +0 -1
  308. package/dist/core/tree/visitPath.js +0 -7
  309. package/dist/core/tree/visitPath.js.map +0 -1
  310. package/dist/shared-tree/publicContracts.d.ts +0 -18
  311. package/dist/shared-tree/publicContracts.d.ts.map +0 -1
  312. package/dist/shared-tree/publicContracts.js +0 -24
  313. package/dist/shared-tree/publicContracts.js.map +0 -1
  314. package/dist/shared-tree/transactionTypes.d.ts.map +0 -1
  315. package/lib/core/tree/visitPath.d.ts +0 -101
  316. package/lib/core/tree/visitPath.d.ts.map +0 -1
  317. package/lib/core/tree/visitPath.js +0 -6
  318. package/lib/core/tree/visitPath.js.map +0 -1
  319. package/lib/shared-tree/publicContracts.d.ts +0 -18
  320. package/lib/shared-tree/publicContracts.d.ts.map +0 -1
  321. package/lib/shared-tree/publicContracts.js +0 -21
  322. package/lib/shared-tree/publicContracts.js.map +0 -1
  323. package/lib/shared-tree/transactionTypes.d.ts.map +0 -1
  324. package/src/core/tree/visitPath.ts +0 -124
  325. package/src/shared-tree/publicContracts.ts +0 -24
  326. /package/dist/{shared-tree → simple-tree/api}/transactionTypes.js +0 -0
  327. /package/lib/{shared-tree → simple-tree/api}/transactionTypes.js +0 -0
@@ -38,7 +38,7 @@ export class MockNodeKeyManager {
38
38
  }
39
39
  getId(offset) {
40
40
  assert(offset >= 0, 0x6e7 /* UUID offset may not be negative */);
41
- assert(offset < 281474976710656, 0x6e8 /* UUID offset must be at most 16^12 */);
41
+ assert(offset < 281_474_976_710_656, 0x6e8 /* UUID offset must be at most 16^12 */);
42
42
  return assertIsStableId(`a110ca7e-add1-4000-8000-${Math.round(offset).toString(16).padStart(12, "0")}`);
43
43
  }
44
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mockNodeKeyManager.js","sourceRoot":"","sources":["../../../src/feature-libraries/node-key/mockNodeKeyManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE1E,OAAO,EAAE,eAAe,EAAuB,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAErE;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IAA/B;QACS,UAAK,GAAG,CAAC,CAAC;IAmCnB,CAAC;IAjCO,qBAAqB;QAC3B,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACxC,CAAC;IAEM,oBAAoB;QAC1B,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC;IAC3D,CAAC;IAEM,eAAe,CAAC,GAAkB;QACxC,OAAO,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACxE,CAAC;IAEM,gBAAgB,CAAC,GAAiB;QACxC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC;IAEM,kBAAkB,CAAC,GAAW;QACpC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,0BAA0B,CAAC,EAAE,CAAC;YAC1E,OAAO,SAAS,CAAC;QAClB,CAAC;QACD,MAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAC5D,OAAO,YAAY,GAAG,IAAI,CAAC,KAAK;YAC/B,CAAC,CAAC,KAAK,CAAC,YAAwC,CAAC;YACjD,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,eAAmB,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 { LocalNodeKey, StableNodeKey } from \"./nodeKey.js\";\nimport { isStableNodeKey, type NodeKeyManager } from \"./nodeKeyManager.js\";\nimport { brand, extractFromOpaque, fail } from \"../../util/index.js\";\n\n/**\n * Mock {@link NodeKeyManager} that generates deterministic {@link StableNodeKey}s and {@link LocalNodeKey}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 StableNodeKey}s are not universally unique.\n */\nexport class MockNodeKeyManager implements NodeKeyManager {\n\tprivate count = 0;\n\n\tpublic generateStableNodeKey(): StableNodeKey {\n\t\treturn brand(this.getId(this.count++));\n\t}\n\n\tpublic generateLocalNodeKey(): LocalNodeKey {\n\t\treturn this.localizeNodeKey(this.generateStableNodeKey());\n\t}\n\n\tpublic localizeNodeKey(key: StableNodeKey): LocalNodeKey {\n\t\treturn this.tryLocalizeNodeKey(key) ?? fail(\"Key is not compressible\");\n\t}\n\n\tpublic stabilizeNodeKey(key: LocalNodeKey): StableNodeKey {\n\t\treturn brand(this.getId(extractFromOpaque(key)));\n\t}\n\n\tpublic tryLocalizeNodeKey(key: string): LocalNodeKey | undefined {\n\t\tif (!isStableNodeKey(key) || !key.startsWith(\"a110ca7e-add1-4000-8000-\")) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst localNodeKey = Number.parseInt(key.substring(24), 16);\n\t\treturn localNodeKey < this.count\n\t\t\t? brand(localNodeKey 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":"mockNodeKeyManager.js","sourceRoot":"","sources":["../../../src/feature-libraries/node-key/mockNodeKeyManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE1E,OAAO,EAAE,eAAe,EAAuB,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAErE;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IAA/B;QACS,UAAK,GAAG,CAAC,CAAC;IAmCnB,CAAC;IAjCO,qBAAqB;QAC3B,OAAO,K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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 { LocalNodeKey, StableNodeKey } from \"./nodeKey.js\";\nimport { isStableNodeKey, type NodeKeyManager } from \"./nodeKeyManager.js\";\nimport { brand, extractFromOpaque, fail } from \"../../util/index.js\";\n\n/**\n * Mock {@link NodeKeyManager} that generates deterministic {@link StableNodeKey}s and {@link LocalNodeKey}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 StableNodeKey}s are not universally unique.\n */\nexport class MockNodeKeyManager implements NodeKeyManager {\n\tprivate count = 0;\n\n\tpublic generateStableNodeKey(): StableNodeKey {\n\t\treturn brand(this.getId(this.count++));\n\t}\n\n\tpublic generateLocalNodeKey(): LocalNodeKey {\n\t\treturn this.localizeNodeKey(this.generateStableNodeKey());\n\t}\n\n\tpublic localizeNodeKey(key: StableNodeKey): LocalNodeKey {\n\t\treturn this.tryLocalizeNodeKey(key) ?? fail(\"Key is not compressible\");\n\t}\n\n\tpublic stabilizeNodeKey(key: LocalNodeKey): StableNodeKey {\n\t\treturn brand(this.getId(extractFromOpaque(key)));\n\t}\n\n\tpublic tryLocalizeNodeKey(key: string): LocalNodeKey | undefined {\n\t\tif (!isStableNodeKey(key) || !key.startsWith(\"a110ca7e-add1-4000-8000-\")) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst localNodeKey = Number.parseInt(key.substring(24), 16);\n\t\treturn localNodeKey < this.count\n\t\t\t? brand(localNodeKey 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":"optionalField.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/optional-field/optionalField.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,YAAY,EAMjB,KAAK,WAAW,EAKhB,MAAM,qBAAqB,CAAC;AAU7B,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAOhB,KAAK,OAAO,EAEZ,KAAK,gBAAgB,EACrB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAGX,iBAAiB,EACjB,UAAU,EAEV,MAAM,+BAA+B,CAAC;AAGvC,MAAM,WAAW,YAAY,CAAC,CAAC;IAC9B,GAAG,CAAC,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,GAAG,IAAI,CAAC;IAC1C,GAAG,CAAC,EAAE,EAAE,UAAU,GAAG,CAAC,GAAG,SAAS,CAAC;IACnC,MAAM,CAAC,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC;IAChC,IAAI,IAAI,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC7B,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC;IACtB,OAAO,IAAI,QAAQ,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,WAAW,CAAC,CAAC,CAAE,YAAW,YAAY,CAAC,CAAC,CAAC;IACrD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAI1B;IAEG,KAAK,IAAI,WAAW,CAAC,CAAC,CAAC;IAQvB,GAAG,CAAC,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,GAAG,IAAI;IAQzC,GAAG,CAAC,EAAE,EAAE,UAAU,GAAG,C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M,CAExB;CACD;AAED,eAAO,MAAM,qBAAqB,EAAE,kBAAkB,CAAC,iBAAiB,CA+TvE,CAAC;AAwHF,wBAAgB,cAAc,CAAC,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,GAAG,SAAS,GAAG,UAAU,CAM5F;AAED,MAAM,WAAW,mBAAoB,SAAQ,WAAW,CAAC,iBAAiB,CAAC;IAC1E;;;;;;;OAOG;IACH,GAAG,CACF,QAAQ,EAAE,OAAO,EACjB,GAAG,EAAE;QACJ,IAAI,EAAE,YAAY,CAAC;QACnB,MAAM,EAAE,YAAY,CAAC;KACrB,GACC,iBAAiB,CAAC;IAErB;;;;OAIG;IACH,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,GAAG,iBAAiB,CAAC;CACpE;AAED,eAAO,MAAM,mBAAmB,EAAE,mBAyCjC,CAAC;AAEF,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,iBAAiB,EACzB,cAAc,EAAE,OAAO,GACrB,gBAAgB,CAkDlB;AAED,eAAO,MAAM,qBAAqB,EAAE,kBAAkB,CACrD,iBAAiB,EACjB,mBAAmB,CAkBnB,CAAC"}
@@ -429,11 +429,15 @@ export const optionalFieldEditor = {
429
429
  dst: detachId,
430
430
  },
431
431
  }),
432
- buildChildChange: (index, childChange) => {
433
- assert(index === 0, 0x404 /* Optional fields only support a single child node */);
432
+ buildChildChanges: (changes) => {
433
+ const childChanges = Array.from(changes, ([index, childChange]) => {
434
+ assert(index === 0, 0x404 /* Optional fields only support a single child node */);
435
+ return ["self", childChange];
436
+ });
437
+ assert(childChanges.length <= 1, 0xabd /* Optional fields only support a single child node */);
434
438
  return {
435
439
  moves: [],
436
- childChanges: [["self", childChange]],
440
+ childChanges,
437
441
  };
438
442
  },
439
443
  };
@@ -1 +1 @@
1
- {"version":3,"file":"optionalField.js","sourceRoot":"","sources":["../../../src/feature-libraries/optional-field/optionalField.ts"],"names":[],"mappings":"AAAA;;;GAGG;A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M,CAAC,YAAY,EAAE,CAAC;QACrD,yGAAyG;QACzG,kBAAkB;QAClB,IAAI,EAAE,KAAK,MAAM,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;YAC9C,cAAc,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;YAC7B,MAAM,oBAAoB,CAAC,EAAE,CAAC,CAAC;QAChC,CAAC;QACD,KAAK,CAAC,CAAC,6BAA6B,CAAC,WAAW,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,YAAY,EAAE,GAAG,CAAC;IACzC,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,MAAM,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;QACjF,MAAM,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;AACF,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\";\n\nimport {\n\ttype ChangeAtomId,\n\ttype ChangeAtomIdMap,\n\ttype ChangesetLocalId,\n\ttype DeltaDetachedNodeChanges,\n\ttype DeltaDetachedNodeId,\n\ttype DeltaMark,\n\ttype RevisionTag,\n\tareEqualChangeAtomIds,\n\tmakeChangeAtomId,\n\treplaceAtomRevisions,\n\ttaggedAtomId,\n} from \"../../core/index.js\";\nimport {\n\ttype IdAllocator,\n\ttype Mutable,\n\tSizedNestedMap,\n\tdeleteFromNestedMap,\n\tsetInNestedMap,\n\ttryGetFromNestedMap,\n} from \"../../util/index.js\";\nimport { nodeIdFromChangeAtom } from \"../deltaUtils.js\";\nimport {\n\ttype FieldChangeHandler,\n\ttype FieldChangeRebaser,\n\ttype FieldEditor,\n\ttype NodeChangeComposer,\n\ttype NodeChangePruner,\n\ttype NodeChangeRebaser,\n\tNodeAttachState,\n\ttype NodeId,\n\ttype RelevantRemovedRootsFromChild,\n\ttype ToDelta,\n\ttype NestedChangesIndices,\n\ttype FieldChangeDelta,\n} from \"../modular-schema/index.js\";\n\nimport type {\n\tChildChange,\n\tMove,\n\tOptionalChangeset,\n\tRegisterId,\n\tReplace,\n} from \"./optionalFieldChangeTypes.js\";\nimport { makeOptionalFieldCodecFamily } from \"./optionalFieldCodecs.js\";\n\nexport interface IRegisterMap<T> {\n\tset(id: RegisterId, childChange: T): void;\n\tget(id: RegisterId): T | undefined;\n\tdelete(id: RegisterId): boolean;\n\tkeys(): Iterable<RegisterId>;\n\tvalues(): Iterable<T>;\n\tentries(): Iterable<[RegisterId, T]>;\n\treadonly size: number;\n}\n\nexport class RegisterMap<T> implements IRegisterMap<T> {\n\tprivate readonly nestedMapData = new SizedNestedMap<\n\t\tChangesetLocalId | \"self\",\n\t\tRevisionTag | undefined,\n\t\tT\n\t>();\n\n\tpublic clone(): RegisterMap<T> {\n\t\tconst clone = new RegisterMap<T>();\n\t\tfor (const [id, t] of this.entries()) {\n\t\t\tclone.set(id, t);\n\t\t}\n\t\treturn clone;\n\t}\n\n\tpublic set(id: RegisterId, childChange: T): void {\n\t\tif (id === \"self\") {\n\t\t\tthis.nestedMapData.set(\"self\", undefined, childChange);\n\t\t} else {\n\t\t\tthis.nestedMapData.set(id.localId, id.revision, childChange);\n\t\t}\n\t}\n\n\tpublic get(id: RegisterId): T | undefined {\n\t\treturn id === \"self\"\n\t\t\t? this.nestedMapData.tryGet(id, undefined)\n\t\t\t: this.nestedMapData.tryGet(id.localId, id.revision);\n\t}\n\n\tpublic has(id: RegisterId): boolean {\n\t\treturn this.get(id) !== undefined;\n\t}\n\n\tpublic delete(id: RegisterId): boolean {\n\t\treturn id === \"self\"\n\t\t\t? this.nestedMapData.delete(\"self\", undefined)\n\t\t\t: this.nestedMapData.delete(id.localId, id.revision);\n\t}\n\n\tpublic keys(): Iterable<RegisterId> {\n\t\tconst changeIds: RegisterId[] = [];\n\t\tfor (const [localId, nestedMap] of this.nestedMapData) {\n\t\t\tif (localId === \"self\") {\n\t\t\t\tchangeIds.push(\"self\");\n\t\t\t} else {\n\t\t\t\tfor (const [revisionTag, _] of nestedMap) {\n\t\t\t\t\tchangeIds.push(\n\t\t\t\t\t\trevisionTag === undefined ? { localId } : { localId, revision: revisionTag },\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn changeIds;\n\t}\n\tpublic values(): Iterable<T> {\n\t\treturn this.nestedMapData.values();\n\t}\n\tpublic entries(): Iterable<[RegisterId, T]> {\n\t\tconst entries: [RegisterId, T][] = [];\n\t\tfor (const changeId of this.keys()) {\n\t\t\tif (changeId === \"self\") {\n\t\t\t\tconst entry = this.nestedMapData.tryGet(\"self\", undefined);\n\t\t\t\tassert(\n\t\t\t\t\tentry !== undefined,\n\t\t\t\t\t0x770 /* Entry should not be undefined when iterating keys. */,\n\t\t\t\t);\n\t\t\t\tentries.push([\"self\", entry]);\n\t\t\t} else {\n\t\t\t\tconst entry = this.nestedMapData.tryGet(changeId.localId, changeId.revision);\n\t\t\t\tassert(\n\t\t\t\t\tentry !== undefined,\n\t\t\t\t\t0x771 /* Entry should not be undefined when iterating keys. */,\n\t\t\t\t);\n\t\t\t\tentries.push([changeId, entry]);\n\t\t\t}\n\t\t}\n\n\t\treturn entries;\n\t}\n\tpublic get size(): number {\n\t\treturn this.nestedMapData.size;\n\t}\n}\n\nexport const optionalChangeRebaser: FieldChangeRebaser<OptionalChangeset> = {\n\tcompose: (\n\t\tchange1: OptionalChangeset,\n\t\tchange2: OptionalChangeset,\n\t\tcomposeChild: NodeChangeComposer,\n\t): OptionalChangeset => {\n\t\tconst { srcToDst, dstToSrc } = getBidirectionalMaps(change1.moves);\n\t\tconst change1FieldSrc = change1.valueReplace?.src;\n\t\tconst change1FieldDst = getEffectfulDst(change1.valueReplace);\n\n\t\tconst change2FieldSrc = change2.valueReplace?.src;\n\t\tlet composedFieldSrc: RegisterId | undefined;\n\t\tif (change2FieldSrc !== undefined) {\n\t\t\tif (change2FieldSrc === \"self\") {\n\t\t\t\tcomposedFieldSrc = change1FieldSrc ?? change2FieldSrc;\n\t\t\t} else if (\n\t\t\t\tchange1FieldDst !== undefined &&\n\t\t\t\tareEqualRegisterIds(change1FieldDst, change2FieldSrc)\n\t\t\t) {\n\t\t\t\tcomposedFieldSrc = \"self\";\n\t\t\t} else {\n\t\t\t\tcomposedFieldSrc =\n\t\t\t\t\ttryGetFromNestedMap(dstToSrc, change2FieldSrc.revision, change2FieldSrc.localId) ??\n\t\t\t\t\tchange2FieldSrc;\n\t\t\t}\n\t\t} else if (change1FieldSrc !== undefined && change2.valueReplace === undefined) {\n\t\t\tcomposedFieldSrc = change1FieldSrc;\n\t\t}\n\n\t\tconst childChanges2ByOriginalId = new RegisterMap<NodeId>();\n\t\tfor (const [id, change] of change2.childChanges) {\n\t\t\tif (id === \"self\") {\n\t\t\t\tif (change1FieldSrc !== undefined) {\n\t\t\t\t\tchildChanges2ByOriginalId.set(change1FieldSrc, change);\n\t\t\t\t} else {\n\t\t\t\t\tchildChanges2ByOriginalId.set(\"self\", change);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (change1FieldDst !== undefined && areEqualChangeAtomIds(change1FieldDst, id)) {\n\t\t\t\t\tchildChanges2ByOriginalId.set(\"self\", change);\n\t\t\t\t} else {\n\t\t\t\t\tconst originalId = tryGetFromNestedMap(dstToSrc, id.revision, id.localId);\n\t\t\t\t\tchildChanges2ByOriginalId.set(originalId ?? id, change);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst composedMoves: Move[] = [];\n\t\tconst composedChildChanges: ChildChange[] = [];\n\t\tconst composed: Mutable<OptionalChangeset> = {\n\t\t\tmoves: composedMoves,\n\t\t\tchildChanges: composedChildChanges,\n\t\t};\n\n\t\tfor (const [id, childChange1] of change1.childChanges) {\n\t\t\tconst childChange2 = childChanges2ByOriginalId.get(id);\n\t\t\tcomposedChildChanges.push([id, composeChild(childChange1, childChange2)]);\n\t\t\tchildChanges2ByOriginalId.delete(id);\n\t\t}\n\n\t\tfor (const [id, childChange2] of childChanges2ByOriginalId.entries()) {\n\t\t\tcomposedChildChanges.push([id, composeChild(undefined, childChange2)]);\n\t\t}\n\n\t\tfor (const [leg2Src, leg2Dst] of change2.moves) {\n\t\t\tconst leg1Src = tryGetFromNestedMap(dstToSrc, leg2Src.revision, leg2Src.localId);\n\t\t\tif (leg1Src !== undefined) {\n\t\t\t\tcomposedMoves.push([leg1Src, leg2Dst]);\n\t\t\t\tdeleteFromNestedMap(srcToDst, leg1Src.revision, leg1Src.localId);\n\t\t\t\tdeleteFromNestedMap(dstToSrc, leg2Src.revision, leg2Src.localId);\n\t\t\t} else if (\n\t\t\t\tchange1FieldDst === undefined ||\n\t\t\t\t!areEqualChangeAtomIds(change1FieldDst, leg2Src)\n\t\t\t) {\n\t\t\t\tcomposedMoves.push([leg2Src, leg2Dst]);\n\t\t\t}\n\t\t}\n\n\t\tfor (const [revision, innerMap] of srcToDst.entries()) {\n\t\t\tfor (const [localId, dst] of innerMap.entries()) {\n\t\t\t\tconst src = makeChangeAtomId(localId, revision);\n\t\t\t\tif (composedFieldSrc === undefined || !areEqualRegisterIds(src, composedFieldSrc)) {\n\t\t\t\t\tcomposedMoves.push([src, dst]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tchange1FieldSrc !== undefined &&\n\t\t\tchange1FieldSrc !== \"self\" &&\n\t\t\tchange2.valueReplace !== undefined\n\t\t) {\n\t\t\tconst change2FieldDst = change2.valueReplace.dst;\n\t\t\tif (\n\t\t\t\tisReplaceEffectful(change2.valueReplace) &&\n\t\t\t\t!areEqualChangeAtomIds(change1FieldSrc, change2FieldDst)\n\t\t\t) {\n\t\t\t\tcomposedMoves.push([change1FieldSrc, change2FieldDst]);\n\t\t\t}\n\t\t}\n\n\t\tconst firstChange = change1.valueReplace ?? change2.valueReplace;\n\t\tif (firstChange === undefined) {\n\t\t\treturn composed;\n\t\t}\n\n\t\tconst replace: Mutable<Replace> = {\n\t\t\tisEmpty: firstChange.isEmpty,\n\t\t\tdst: getComposedReplaceDst(change1.valueReplace, change2),\n\t\t};\n\t\tif (composedFieldSrc !== undefined) {\n\t\t\treplace.src = composedFieldSrc;\n\t\t}\n\t\tcomposed.valueReplace = replace;\n\t\treturn composed;\n\t},\n\n\tinvert: (\n\t\tchange: OptionalChangeset,\n\t\tisRollback: boolean,\n\t\tgenId: IdAllocator<ChangesetLocalId>,\n\t\trevision: RevisionTag | undefined,\n\t): OptionalChangeset => {\n\t\tconst { moves, childChanges } = change;\n\n\t\tconst invertIdMap = new RegisterMap<RegisterId>();\n\t\tconst invertedMoves: Move[] = [];\n\t\tfor (const [src, dst] of moves) {\n\t\t\tinvertIdMap.set(src, dst);\n\t\t\tinvertedMoves.push([dst, src]);\n\t\t}\n\t\tif (change.valueReplace !== undefined) {\n\t\t\tconst effectfulDst = getEffectfulDst(change.valueReplace);\n\t\t\tif (effectfulDst !== undefined) {\n\t\t\t\tinvertIdMap.set(\"self\", change.valueReplace.dst);\n\t\t\t}\n\t\t\tif (change.valueReplace.src !== undefined) {\n\t\t\t\tinvertIdMap.set(change.valueReplace.src, \"self\");\n\t\t\t}\n\t\t}\n\n\t\tconst inverted: Mutable<OptionalChangeset> = {\n\t\t\tmoves: invertedMoves,\n\t\t\tchildChanges: childChanges.map(([id, childChange]) => {\n\t\t\t\treturn [invertIdMap.get(id) ?? id, childChange];\n\t\t\t}),\n\t\t};\n\n\t\tif (change.valueReplace !== undefined) {\n\t\t\tif (isReplaceEffectful(change.valueReplace)) {\n\t\t\t\tconst replace: Mutable<Replace> =\n\t\t\t\t\tchange.valueReplace.src === undefined\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tisEmpty: true,\n\t\t\t\t\t\t\t\tdst: makeChangeAtomId(genId.allocate(), revision),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tisEmpty: false,\n\t\t\t\t\t\t\t\tdst: isRollback\n\t\t\t\t\t\t\t\t\t? change.valueReplace.src\n\t\t\t\t\t\t\t\t\t: makeChangeAtomId(genId.allocate(), revision),\n\t\t\t\t\t\t\t};\n\t\t\t\tif (change.valueReplace.isEmpty === false) {\n\t\t\t\t\treplace.src = change.valueReplace.dst;\n\t\t\t\t}\n\t\t\t\tinverted.valueReplace = replace;\n\t\t\t} else if (!isRollback && change.valueReplace.src === \"self\") {\n\t\t\t\tinverted.valueReplace = {\n\t\t\t\t\tisEmpty: false,\n\t\t\t\t\tsrc: \"self\",\n\t\t\t\t\tdst: makeChangeAtomId(genId.allocate(), revision),\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\treturn inverted;\n\t},\n\n\trebase: (\n\t\tchange: OptionalChangeset,\n\t\toverChange: OptionalChangeset,\n\t\trebaseChild: NodeChangeRebaser,\n\t): OptionalChangeset => {\n\t\tconst { moves, childChanges, valueReplace: field } = change;\n\n\t\t// TODO: avoid computing the dstToSrc map if it's not needed.\n\t\t// TODO: de-dupe overSrcToDst and forwardMap\n\t\tconst { srcToDst: overSrcToDst } = getBidirectionalMaps(overChange.moves);\n\n\t\tconst forwardMap = new RegisterMap<RegisterId>();\n\t\tfor (const [src, dst] of overChange.moves) {\n\t\t\tforwardMap.set(src, dst);\n\t\t}\n\t\tif (overChange.valueReplace !== undefined) {\n\t\t\tconst effectfulDst = getEffectfulDst(overChange.valueReplace);\n\t\t\tif (effectfulDst !== undefined) {\n\t\t\t\tforwardMap.set(\"self\", overChange.valueReplace.dst);\n\t\t\t}\n\t\t\tif (overChange.valueReplace.src !== undefined) {\n\t\t\t\tforwardMap.set(overChange.valueReplace.src, \"self\");\n\t\t\t}\n\t\t}\n\n\t\tconst rebasedMoves: Move[] = [];\n\t\tfor (const [src, dst] of moves) {\n\t\t\tconst newDst = tryGetFromNestedMap(overSrcToDst, src.revision, src.localId);\n\t\t\trebasedMoves.push([src, newDst ?? dst]);\n\t\t}\n\n\t\tconst overChildChangesBySrc = new RegisterMap<NodeId>();\n\t\tfor (const [id, childChange] of overChange.childChanges) {\n\t\t\toverChildChangesBySrc.set(id, childChange);\n\t\t}\n\n\t\tconst rebasedChildChanges: ChildChange[] = [];\n\t\tfor (const [id, childChange] of childChanges) {\n\t\t\tconst overChildChange = overChildChangesBySrc.get(id);\n\t\t\tif (overChildChange !== undefined) {\n\t\t\t\toverChildChangesBySrc.delete(id);\n\t\t\t}\n\n\t\t\tconst rebasedId = forwardMap.get(id) ?? id;\n\t\t\tconst rebasedChildChange = rebaseChild(\n\t\t\t\tchildChange,\n\t\t\t\toverChildChange,\n\t\t\t\trebasedId === \"self\" ? NodeAttachState.Attached : NodeAttachState.Detached,\n\t\t\t);\n\t\t\tif (rebasedChildChange !== undefined) {\n\t\t\t\trebasedChildChanges.push([rebasedId, rebasedChildChange]);\n\t\t\t}\n\t\t}\n\n\t\tfor (const [id, overChildChange] of overChildChangesBySrc.entries()) {\n\t\t\tconst rebasedId = forwardMap.get(id) ?? id;\n\t\t\tconst rebasedChildChange = rebaseChild(\n\t\t\t\tundefined,\n\t\t\t\toverChildChange,\n\t\t\t\trebasedId === \"self\" ? NodeAttachState.Attached : NodeAttachState.Detached,\n\t\t\t);\n\t\t\tif (rebasedChildChange !== undefined) {\n\t\t\t\trebasedChildChanges.push([rebasedId, rebasedChildChange]);\n\t\t\t}\n\t\t}\n\n\t\tconst rebased: Mutable<OptionalChangeset> = {\n\t\t\tmoves: rebasedMoves,\n\t\t\tchildChanges: rebasedChildChanges,\n\t\t};\n\n\t\tif (field !== undefined) {\n\t\t\tconst replace: Mutable<Replace> = {\n\t\t\t\tisEmpty:\n\t\t\t\t\toverChange.valueReplace === undefined\n\t\t\t\t\t\t? field.isEmpty\n\t\t\t\t\t\t: overChange.valueReplace.src === undefined,\n\t\t\t\tdst: field.dst,\n\t\t\t};\n\t\t\tif (field.src !== undefined) {\n\t\t\t\treplace.src = forwardMap.get(field.src) ?? field.src;\n\t\t\t}\n\t\t\trebased.valueReplace = replace;\n\t\t}\n\n\t\treturn rebased;\n\t},\n\n\tprune: (change: OptionalChangeset, pruneChild: NodeChangePruner): OptionalChangeset => {\n\t\tconst childChanges: ChildChange[] = [];\n\t\tconst prunedChange: Mutable<OptionalChangeset> = {\n\t\t\tmoves: change.moves,\n\t\t\tchildChanges,\n\t\t};\n\t\tif (change.valueReplace !== undefined) {\n\t\t\tprunedChange.valueReplace = change.valueReplace;\n\t\t}\n\n\t\tfor (const [id, childChange] of change.childChanges) {\n\t\t\tconst prunedChildChange = pruneChild(childChange);\n\t\t\tif (prunedChildChange !== undefined) {\n\t\t\t\tchildChanges.push([id, prunedChildChange]);\n\t\t\t}\n\t\t}\n\n\t\treturn prunedChange;\n\t},\n\n\treplaceRevisions: (\n\t\tchange: OptionalChangeset,\n\t\toldRevisions: Set<RevisionTag | undefined>,\n\t\tnewRevision: RevisionTag | undefined,\n\t): OptionalChangeset => {\n\t\tconst valueReplace = replaceReplaceRevisions(\n\t\t\tchange.valueReplace,\n\t\t\toldRevisions,\n\t\t\tnewRevision,\n\t\t);\n\n\t\tconst childChanges: ChildChange[] = [];\n\t\tfor (const [id, childChange] of change.childChanges) {\n\t\t\tchildChanges.push([\n\t\t\t\treplaceRegisterRevisions(id, oldRevisions, newRevision),\n\t\t\t\treplaceAtomRevisions(childChange, oldRevisions, newRevision),\n\t\t\t]);\n\t\t}\n\n\t\tconst moves: Move[] = [];\n\t\tfor (const [src, dst] of change.moves) {\n\t\t\tmoves.push([\n\t\t\t\treplaceAtomRevisions(src, oldRevisions, newRevision),\n\t\t\t\treplaceAtomRevisions(dst, oldRevisions, newRevision),\n\t\t\t]);\n\t\t}\n\n\t\tconst updated: Mutable<OptionalChangeset> = { childChanges, moves };\n\t\tif (valueReplace !== undefined) {\n\t\t\tupdated.valueReplace = valueReplace;\n\t\t}\n\n\t\treturn updated;\n\t},\n};\n\nfunction replaceReplaceRevisions(\n\treplace: Replace | undefined,\n\toldRevisions: Set<RevisionTag | undefined>,\n\tnewRevision: RevisionTag | undefined,\n): Replace | undefined {\n\tif (replace === undefined) {\n\t\treturn undefined;\n\t}\n\n\tconst updated: Mutable<Replace> = {\n\t\t...replace,\n\t\tdst: replaceAtomRevisions(replace.dst, oldRevisions, newRevision),\n\t};\n\n\tif (replace.src !== undefined) {\n\t\tupdated.src = replaceRegisterRevisions(replace.src, oldRevisions, newRevision);\n\t}\n\n\treturn updated;\n}\n\nfunction replaceRegisterRevisions(\n\tregister: RegisterId,\n\toldRevisions: Set<RevisionTag | undefined>,\n\tnewRevision: RevisionTag | undefined,\n): RegisterId {\n\treturn register === \"self\"\n\t\t? register\n\t\t: replaceAtomRevisions(register, oldRevisions, newRevision);\n}\n\nfunction getComposedReplaceDst(\n\tchange1: Replace | undefined,\n\tchange2: OptionalChangeset,\n): ChangeAtomId {\n\tconst dst1 = change1?.dst;\n\tif (change2.valueReplace === undefined) {\n\t\tassert(dst1 !== undefined, 0x8ce /* Both replace replaces should not be undefined */);\n\t\treturn getIdAfterMoves(dst1, change2.moves);\n\t}\n\n\tif (\n\t\tdst1 === undefined ||\n\t\tchange1?.src === \"self\" ||\n\t\t(change2.valueReplace.src !== undefined &&\n\t\t\tareEqualRegisterIds(change2.valueReplace.src, dst1))\n\t) {\n\t\tassert(\n\t\t\tchange2.valueReplace !== undefined,\n\t\t\t0x8cf /* Both replace replaces should not be undefined */,\n\t\t);\n\t\treturn change2.valueReplace.dst;\n\t} else {\n\t\treturn getIdAfterMoves(dst1, change2.moves);\n\t}\n}\n\nfunction getIdAfterMoves(id: ChangeAtomId, moves: readonly Move[]): ChangeAtomId {\n\tfor (const [src, dst] of moves) {\n\t\tif (areEqualChangeAtomIds(id, src)) {\n\t\t\treturn dst;\n\t\t}\n\t}\n\treturn id;\n}\n\nfunction areEqualRegisterIds(id1: RegisterId, id2: RegisterId): boolean {\n\treturn id1 === \"self\" || id2 === \"self\" ? id1 === id2 : areEqualChangeAtomIds(id1, id2);\n}\n\nfunction areEqualRegisterIdsOpt(\n\tid1: RegisterId | undefined,\n\tid2: RegisterId | undefined,\n): boolean {\n\tif (id1 === undefined || id2 === undefined) {\n\t\treturn id1 === id2;\n\t}\n\treturn areEqualRegisterIds(id1, id2);\n}\n\nfunction getBidirectionalMaps(moves: OptionalChangeset[\"moves\"]): {\n\tsrcToDst: ChangeAtomIdMap<ChangeAtomId>;\n\tdstToSrc: ChangeAtomIdMap<ChangeAtomId>;\n} {\n\tconst srcToDst: ChangeAtomIdMap<ChangeAtomId> = new Map();\n\tconst dstToSrc: ChangeAtomIdMap<ChangeAtomId> = new Map();\n\tfor (const [src, dst] of moves) {\n\t\tsetInNestedMap(srcToDst, src.revision, src.localId, dst);\n\t\tsetInNestedMap(dstToSrc, dst.revision, dst.localId, src);\n\t}\n\treturn { srcToDst, dstToSrc };\n}\n\ntype EffectfulReplace =\n\t| {\n\t\t\tisEmpty: true;\n\t\t\tsrc?: ChangeAtomId;\n\t\t\tdst: ChangeAtomId;\n\t }\n\t| {\n\t\t\tisEmpty: boolean;\n\t\t\tsrc: ChangeAtomId;\n\t\t\tdst: ChangeAtomId;\n\t };\n\nfunction isReplaceEffectful(replace: Replace): replace is EffectfulReplace {\n\tif (replace.src === \"self\") {\n\t\treturn false;\n\t}\n\treturn !replace.isEmpty || replace.src !== undefined;\n}\n\nfunction getEffectfulDst(replace: Replace | undefined): ChangeAtomId | undefined {\n\treturn replace === undefined || replace.isEmpty || replace.src === \"self\"\n\t\t? undefined\n\t\t: replace.dst;\n}\n\nexport function taggedRegister(id: RegisterId, revision: RevisionTag | undefined): RegisterId {\n\tif (id === \"self\") {\n\t\treturn id;\n\t}\n\n\treturn taggedAtomId(id, revision);\n}\n\nexport interface OptionalFieldEditor extends FieldEditor<OptionalChangeset> {\n\t/**\n\t * Creates a change which will replace the content already in the field (if any at the time the change applies)\n\t * with new content.\n\t * The content in the field will be moved to the `ids.detach` register.\n\t * The content in the `ids.detach` register will be moved to into the field.\n\t * @param wasEmpty - whether the field is empty when creating this change\n\t * @param ids - the \"fill\" and \"detach\" ids associated with the change.\n\t */\n\tset(\n\t\twasEmpty: boolean,\n\t\tids: {\n\t\t\tfill: ChangeAtomId;\n\t\t\tdetach: ChangeAtomId;\n\t\t},\n\t): OptionalChangeset;\n\n\t/**\n\t * Creates a change which clears the field's contents (if any).\n\t * @param wasEmpty - whether the field is empty when creating this change\n\t * @param detachId - the ID of the register that existing field content (if any) will be moved to.\n\t */\n\tclear(wasEmpty: boolean, detachId: ChangeAtomId): OptionalChangeset;\n}\n\nexport const optionalFieldEditor: OptionalFieldEditor = {\n\tset: (\n\t\twasEmpty: boolean,\n\t\tids: {\n\t\t\tfill: ChangeAtomId;\n\t\t\t// Should be interpreted as a set of an empty field if undefined.\n\t\t\tdetach: ChangeAtomId;\n\t\t},\n\t): OptionalChangeset => ({\n\t\tmoves: [],\n\t\tchildChanges: [],\n\t\tvalueReplace: {\n\t\t\tisEmpty: wasEmpty,\n\t\t\tsrc: ids.fill,\n\t\t\tdst: ids.detach,\n\t\t},\n\t}),\n\n\tclear: (wasEmpty: boolean, detachId: ChangeAtomId): OptionalChangeset => ({\n\t\tmoves: [],\n\t\tchildChanges: [],\n\t\tvalueReplace: {\n\t\t\tisEmpty: wasEmpty,\n\t\t\tdst: detachId,\n\t\t},\n\t}),\n\n\tbuildChildChange: (index: number, childChange: NodeId): OptionalChangeset => {\n\t\tassert(index === 0, 0x404 /* Optional fields only support a single child node */);\n\t\treturn {\n\t\t\tmoves: [],\n\t\t\tchildChanges: [[\"self\", childChange]],\n\t\t};\n\t},\n};\n\nexport function optionalFieldIntoDelta(\n\tchange: OptionalChangeset,\n\tdeltaFromChild: ToDelta,\n): FieldChangeDelta {\n\tconst delta: Mutable<FieldChangeDelta> = {};\n\n\tlet markIsANoop = true;\n\tconst mark: Mutable<DeltaMark> = { count: 1 };\n\n\tif (change.valueReplace !== undefined && isReplaceEffectful(change.valueReplace)) {\n\t\tif (!change.valueReplace.isEmpty) {\n\t\t\tmark.detach = nodeIdFromChangeAtom(change.valueReplace.dst);\n\t\t}\n\t\tif (change.valueReplace.src !== undefined) {\n\t\t\tmark.attach = nodeIdFromChangeAtom(change.valueReplace.src);\n\t\t}\n\t\tmarkIsANoop = false;\n\t}\n\n\tif (change.moves.length > 0) {\n\t\tdelta.rename = change.moves.map(([src, dst]) => ({\n\t\t\tcount: 1,\n\t\t\toldId: nodeIdFromChangeAtom(src),\n\t\t\tnewId: nodeIdFromChangeAtom(dst),\n\t\t}));\n\t}\n\n\tif (change.childChanges.length > 0) {\n\t\tconst globals: DeltaDetachedNodeChanges[] = [];\n\t\tfor (const [id, childChange] of change.childChanges) {\n\t\t\tconst childDelta = deltaFromChild(childChange);\n\t\t\tif (id !== \"self\") {\n\t\t\t\tconst fields = childDelta;\n\t\t\t\tglobals.push({\n\t\t\t\t\tid: { major: id.revision, minor: id.localId },\n\t\t\t\t\tfields,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tmark.fields = childDelta;\n\t\t\t\tmarkIsANoop = false;\n\t\t\t}\n\t\t}\n\n\t\tif (globals.length > 0) {\n\t\t\tdelta.global = globals;\n\t\t}\n\t}\n\n\tif (!markIsANoop) {\n\t\tdelta.local = [mark];\n\t}\n\n\treturn delta;\n}\n\nexport const optionalChangeHandler: FieldChangeHandler<\n\tOptionalChangeset,\n\tOptionalFieldEditor\n> = {\n\trebaser: optionalChangeRebaser,\n\tcodecsFactory: makeOptionalFieldCodecFamily,\n\teditor: optionalFieldEditor,\n\n\tintoDelta: optionalFieldIntoDelta,\n\trelevantRemovedRoots,\n\n\tisEmpty: (change: OptionalChangeset) =>\n\t\tchange.childChanges.length === 0 &&\n\t\tchange.moves.length === 0 &&\n\t\tchange.valueReplace === undefined,\n\n\tgetNestedChanges,\n\n\tcreateEmpty: () => ({ moves: [], childChanges: [] }),\n\tgetCrossFieldKeys: (_change) => [],\n};\n\nfunction getNestedChanges(change: OptionalChangeset): NestedChangesIndices {\n\t// True iff the content of the field changes in some way\n\tconst isFieldContentChanged =\n\t\tchange.valueReplace !== undefined && change.valueReplace.src !== \"self\";\n\n\t// The node that is moved into the field (if any).\n\tconst nodeMovedIntoField = change.valueReplace?.src;\n\n\treturn change.childChanges.map(([register, nodeId]) => {\n\t\t// The node is removed in the input context iif register is not self.\n\t\tconst inputIndex = register === \"self\" ? 0 : undefined;\n\t\tconst outputIndex =\n\t\t\tregister === \"self\"\n\t\t\t\t? // If the node starts out as not-removed, it is removed in the output context iff the field content is changed\n\t\t\t\t\tisFieldContentChanged\n\t\t\t\t\t? undefined\n\t\t\t\t\t: 0\n\t\t\t\t: // If the node starts out as removed, then it remains removed in the output context iff it is not the node that is moved into the field\n\t\t\t\t\t!areEqualRegisterIdsOpt(register, nodeMovedIntoField)\n\t\t\t\t\t? undefined\n\t\t\t\t\t: 0;\n\t\treturn [nodeId, inputIndex, outputIndex];\n\t});\n}\n\nfunction* relevantRemovedRoots(\n\tchange: OptionalChangeset,\n\trelevantRemovedRootsFromChild: RelevantRemovedRootsFromChild,\n): Iterable<DeltaDetachedNodeId> {\n\tconst alreadyYielded = new RegisterMap<boolean>();\n\n\tfor (const [src] of change.moves) {\n\t\tif (!alreadyYielded.has(src)) {\n\t\t\talreadyYielded.set(src, true);\n\t\t\tyield nodeIdFromChangeAtom(src);\n\t\t}\n\t}\n\n\tfor (const [id, childChange] of change.childChanges) {\n\t\t// Child changes make the tree they apply to relevant unless that tree existed in the starting context of\n\t\t// of this change.\n\t\tif (id !== \"self\" && !alreadyYielded.has(id)) {\n\t\t\talreadyYielded.set(id, true);\n\t\t\tyield nodeIdFromChangeAtom(id);\n\t\t}\n\t\tyield* relevantRemovedRootsFromChild(childChange);\n\t}\n\n\tconst selfSrc = change.valueReplace?.src;\n\tif (selfSrc !== undefined && selfSrc !== \"self\" && !alreadyYielded.has(selfSrc)) {\n\t\tyield nodeIdFromChangeAtom(selfSrc);\n\t}\n}\n"]}
1
+ {"version":3,"file":"optionalField.js","sourceRoot":"","sources":["../../../src/feature-libraries/optional-field/optionalField.ts"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C,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAC9B,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YAC9B,MAAM,oBAAoB,CAAC,GAAG,CAAC,CAAC;QACjC,CAAC;IACF,CAAC;IAED,KAAK,MAAM,CAAC,EAAE,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QACrD,yGAAyG;QACzG,kBAAkB;QAClB,IAAI,EAAE,KAAK,MAAM,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;YAC9C,cAAc,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;YAC7B,MAAM,oBAAoB,CAAC,EAAE,CAAC,CAAC;QAChC,CAAC;QACD,KAAK,CAAC,CAAC,6BAA6B,CAAC,WAAW,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,YAAY,EAAE,GAAG,CAAC;IACzC,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,MAAM,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;QACjF,MAAM,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;AACF,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\";\n\nimport {\n\ttype ChangeAtomId,\n\ttype ChangeAtomIdMap,\n\ttype ChangesetLocalId,\n\ttype DeltaDetachedNodeChanges,\n\ttype DeltaDetachedNodeId,\n\ttype DeltaMark,\n\ttype RevisionTag,\n\tareEqualChangeAtomIds,\n\tmakeChangeAtomId,\n\treplaceAtomRevisions,\n\ttaggedAtomId,\n} from \"../../core/index.js\";\nimport {\n\ttype IdAllocator,\n\ttype Mutable,\n\tSizedNestedMap,\n\tdeleteFromNestedMap,\n\tsetInNestedMap,\n\ttryGetFromNestedMap,\n} from \"../../util/index.js\";\nimport { nodeIdFromChangeAtom } from \"../deltaUtils.js\";\nimport {\n\ttype FieldChangeHandler,\n\ttype FieldChangeRebaser,\n\ttype FieldEditor,\n\ttype NodeChangeComposer,\n\ttype NodeChangePruner,\n\ttype NodeChangeRebaser,\n\tNodeAttachState,\n\ttype NodeId,\n\ttype RelevantRemovedRootsFromChild,\n\ttype ToDelta,\n\ttype NestedChangesIndices,\n\ttype FieldChangeDelta,\n} from \"../modular-schema/index.js\";\n\nimport type {\n\tChildChange,\n\tMove,\n\tOptionalChangeset,\n\tRegisterId,\n\tReplace,\n} from \"./optionalFieldChangeTypes.js\";\nimport { makeOptionalFieldCodecFamily } from \"./optionalFieldCodecs.js\";\n\nexport interface IRegisterMap<T> {\n\tset(id: RegisterId, childChange: T): void;\n\tget(id: RegisterId): T | undefined;\n\tdelete(id: RegisterId): boolean;\n\tkeys(): Iterable<RegisterId>;\n\tvalues(): Iterable<T>;\n\tentries(): Iterable<[RegisterId, T]>;\n\treadonly size: number;\n}\n\nexport class RegisterMap<T> implements IRegisterMap<T> {\n\tprivate readonly nestedMapData = new SizedNestedMap<\n\t\tChangesetLocalId | \"self\",\n\t\tRevisionTag | undefined,\n\t\tT\n\t>();\n\n\tpublic clone(): RegisterMap<T> {\n\t\tconst clone = new RegisterMap<T>();\n\t\tfor (const [id, t] of this.entries()) {\n\t\t\tclone.set(id, t);\n\t\t}\n\t\treturn clone;\n\t}\n\n\tpublic set(id: RegisterId, childChange: T): void {\n\t\tif (id === \"self\") {\n\t\t\tthis.nestedMapData.set(\"self\", undefined, childChange);\n\t\t} else {\n\t\t\tthis.nestedMapData.set(id.localId, id.revision, childChange);\n\t\t}\n\t}\n\n\tpublic get(id: RegisterId): T | undefined {\n\t\treturn id === \"self\"\n\t\t\t? this.nestedMapData.tryGet(id, undefined)\n\t\t\t: this.nestedMapData.tryGet(id.localId, id.revision);\n\t}\n\n\tpublic has(id: RegisterId): boolean {\n\t\treturn this.get(id) !== undefined;\n\t}\n\n\tpublic delete(id: RegisterId): boolean {\n\t\treturn id === \"self\"\n\t\t\t? this.nestedMapData.delete(\"self\", undefined)\n\t\t\t: this.nestedMapData.delete(id.localId, id.revision);\n\t}\n\n\tpublic keys(): Iterable<RegisterId> {\n\t\tconst changeIds: RegisterId[] = [];\n\t\tfor (const [localId, nestedMap] of this.nestedMapData) {\n\t\t\tif (localId === \"self\") {\n\t\t\t\tchangeIds.push(\"self\");\n\t\t\t} else {\n\t\t\t\tfor (const [revisionTag, _] of nestedMap) {\n\t\t\t\t\tchangeIds.push(\n\t\t\t\t\t\trevisionTag === undefined ? { localId } : { localId, revision: revisionTag },\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn changeIds;\n\t}\n\tpublic values(): Iterable<T> {\n\t\treturn this.nestedMapData.values();\n\t}\n\tpublic entries(): Iterable<[RegisterId, T]> {\n\t\tconst entries: [RegisterId, T][] = [];\n\t\tfor (const changeId of this.keys()) {\n\t\t\tif (changeId === \"self\") {\n\t\t\t\tconst entry = this.nestedMapData.tryGet(\"self\", undefined);\n\t\t\t\tassert(\n\t\t\t\t\tentry !== undefined,\n\t\t\t\t\t0x770 /* Entry should not be undefined when iterating keys. */,\n\t\t\t\t);\n\t\t\t\tentries.push([\"self\", entry]);\n\t\t\t} else {\n\t\t\t\tconst entry = this.nestedMapData.tryGet(changeId.localId, changeId.revision);\n\t\t\t\tassert(\n\t\t\t\t\tentry !== undefined,\n\t\t\t\t\t0x771 /* Entry should not be undefined when iterating keys. */,\n\t\t\t\t);\n\t\t\t\tentries.push([changeId, entry]);\n\t\t\t}\n\t\t}\n\n\t\treturn entries;\n\t}\n\tpublic get size(): number {\n\t\treturn this.nestedMapData.size;\n\t}\n}\n\nexport const optionalChangeRebaser: FieldChangeRebaser<OptionalChangeset> = {\n\tcompose: (\n\t\tchange1: OptionalChangeset,\n\t\tchange2: OptionalChangeset,\n\t\tcomposeChild: NodeChangeComposer,\n\t): OptionalChangeset => {\n\t\tconst { srcToDst, dstToSrc } = getBidirectionalMaps(change1.moves);\n\t\tconst change1FieldSrc = change1.valueReplace?.src;\n\t\tconst change1FieldDst = getEffectfulDst(change1.valueReplace);\n\n\t\tconst change2FieldSrc = change2.valueReplace?.src;\n\t\tlet composedFieldSrc: RegisterId | undefined;\n\t\tif (change2FieldSrc !== undefined) {\n\t\t\tif (change2FieldSrc === \"self\") {\n\t\t\t\tcomposedFieldSrc = change1FieldSrc ?? change2FieldSrc;\n\t\t\t} else if (\n\t\t\t\tchange1FieldDst !== undefined &&\n\t\t\t\tareEqualRegisterIds(change1FieldDst, change2FieldSrc)\n\t\t\t) {\n\t\t\t\tcomposedFieldSrc = \"self\";\n\t\t\t} else {\n\t\t\t\tcomposedFieldSrc =\n\t\t\t\t\ttryGetFromNestedMap(dstToSrc, change2FieldSrc.revision, change2FieldSrc.localId) ??\n\t\t\t\t\tchange2FieldSrc;\n\t\t\t}\n\t\t} else if (change1FieldSrc !== undefined && change2.valueReplace === undefined) {\n\t\t\tcomposedFieldSrc = change1FieldSrc;\n\t\t}\n\n\t\tconst childChanges2ByOriginalId = new RegisterMap<NodeId>();\n\t\tfor (const [id, change] of change2.childChanges) {\n\t\t\tif (id === \"self\") {\n\t\t\t\tif (change1FieldSrc !== undefined) {\n\t\t\t\t\tchildChanges2ByOriginalId.set(change1FieldSrc, change);\n\t\t\t\t} else {\n\t\t\t\t\tchildChanges2ByOriginalId.set(\"self\", change);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (change1FieldDst !== undefined && areEqualChangeAtomIds(change1FieldDst, id)) {\n\t\t\t\t\tchildChanges2ByOriginalId.set(\"self\", change);\n\t\t\t\t} else {\n\t\t\t\t\tconst originalId = tryGetFromNestedMap(dstToSrc, id.revision, id.localId);\n\t\t\t\t\tchildChanges2ByOriginalId.set(originalId ?? id, change);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst composedMoves: Move[] = [];\n\t\tconst composedChildChanges: ChildChange[] = [];\n\t\tconst composed: Mutable<OptionalChangeset> = {\n\t\t\tmoves: composedMoves,\n\t\t\tchildChanges: composedChildChanges,\n\t\t};\n\n\t\tfor (const [id, childChange1] of change1.childChanges) {\n\t\t\tconst childChange2 = childChanges2ByOriginalId.get(id);\n\t\t\tcomposedChildChanges.push([id, composeChild(childChange1, childChange2)]);\n\t\t\tchildChanges2ByOriginalId.delete(id);\n\t\t}\n\n\t\tfor (const [id, childChange2] of childChanges2ByOriginalId.entries()) {\n\t\t\tcomposedChildChanges.push([id, composeChild(undefined, childChange2)]);\n\t\t}\n\n\t\tfor (const [leg2Src, leg2Dst] of change2.moves) {\n\t\t\tconst leg1Src = tryGetFromNestedMap(dstToSrc, leg2Src.revision, leg2Src.localId);\n\t\t\tif (leg1Src !== undefined) {\n\t\t\t\tcomposedMoves.push([leg1Src, leg2Dst]);\n\t\t\t\tdeleteFromNestedMap(srcToDst, leg1Src.revision, leg1Src.localId);\n\t\t\t\tdeleteFromNestedMap(dstToSrc, leg2Src.revision, leg2Src.localId);\n\t\t\t} else if (\n\t\t\t\tchange1FieldDst === undefined ||\n\t\t\t\t!areEqualChangeAtomIds(change1FieldDst, leg2Src)\n\t\t\t) {\n\t\t\t\tcomposedMoves.push([leg2Src, leg2Dst]);\n\t\t\t}\n\t\t}\n\n\t\tfor (const [revision, innerMap] of srcToDst.entries()) {\n\t\t\tfor (const [localId, dst] of innerMap.entries()) {\n\t\t\t\tconst src = makeChangeAtomId(localId, revision);\n\t\t\t\tif (composedFieldSrc === undefined || !areEqualRegisterIds(src, composedFieldSrc)) {\n\t\t\t\t\tcomposedMoves.push([src, dst]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tchange1FieldSrc !== undefined &&\n\t\t\tchange1FieldSrc !== \"self\" &&\n\t\t\tchange2.valueReplace !== undefined\n\t\t) {\n\t\t\tconst change2FieldDst = change2.valueReplace.dst;\n\t\t\tif (\n\t\t\t\tisReplaceEffectful(change2.valueReplace) &&\n\t\t\t\t!areEqualChangeAtomIds(change1FieldSrc, change2FieldDst)\n\t\t\t) {\n\t\t\t\tcomposedMoves.push([change1FieldSrc, change2FieldDst]);\n\t\t\t}\n\t\t}\n\n\t\tconst firstChange = change1.valueReplace ?? change2.valueReplace;\n\t\tif (firstChange === undefined) {\n\t\t\treturn composed;\n\t\t}\n\n\t\tconst replace: Mutable<Replace> = {\n\t\t\tisEmpty: firstChange.isEmpty,\n\t\t\tdst: getComposedReplaceDst(change1.valueReplace, change2),\n\t\t};\n\t\tif (composedFieldSrc !== undefined) {\n\t\t\treplace.src = composedFieldSrc;\n\t\t}\n\t\tcomposed.valueReplace = replace;\n\t\treturn composed;\n\t},\n\n\tinvert: (\n\t\tchange: OptionalChangeset,\n\t\tisRollback: boolean,\n\t\tgenId: IdAllocator<ChangesetLocalId>,\n\t\trevision: RevisionTag | undefined,\n\t): OptionalChangeset => {\n\t\tconst { moves, childChanges } = change;\n\n\t\tconst invertIdMap = new RegisterMap<RegisterId>();\n\t\tconst invertedMoves: Move[] = [];\n\t\tfor (const [src, dst] of moves) {\n\t\t\tinvertIdMap.set(src, dst);\n\t\t\tinvertedMoves.push([dst, src]);\n\t\t}\n\t\tif (change.valueReplace !== undefined) {\n\t\t\tconst effectfulDst = getEffectfulDst(change.valueReplace);\n\t\t\tif (effectfulDst !== undefined) {\n\t\t\t\tinvertIdMap.set(\"self\", change.valueReplace.dst);\n\t\t\t}\n\t\t\tif (change.valueReplace.src !== undefined) {\n\t\t\t\tinvertIdMap.set(change.valueReplace.src, \"self\");\n\t\t\t}\n\t\t}\n\n\t\tconst inverted: Mutable<OptionalChangeset> = {\n\t\t\tmoves: invertedMoves,\n\t\t\tchildChanges: childChanges.map(([id, childChange]) => {\n\t\t\t\treturn [invertIdMap.get(id) ?? id, childChange];\n\t\t\t}),\n\t\t};\n\n\t\tif (change.valueReplace !== undefined) {\n\t\t\tif (isReplaceEffectful(change.valueReplace)) {\n\t\t\t\tconst replace: Mutable<Replace> =\n\t\t\t\t\tchange.valueReplace.src === undefined\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tisEmpty: true,\n\t\t\t\t\t\t\t\tdst: makeChangeAtomId(genId.allocate(), revision),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tisEmpty: false,\n\t\t\t\t\t\t\t\tdst: isRollback\n\t\t\t\t\t\t\t\t\t? change.valueReplace.src\n\t\t\t\t\t\t\t\t\t: makeChangeAtomId(genId.allocate(), revision),\n\t\t\t\t\t\t\t};\n\t\t\t\tif (change.valueReplace.isEmpty === false) {\n\t\t\t\t\treplace.src = change.valueReplace.dst;\n\t\t\t\t}\n\t\t\t\tinverted.valueReplace = replace;\n\t\t\t} else if (!isRollback && change.valueReplace.src === \"self\") {\n\t\t\t\tinverted.valueReplace = {\n\t\t\t\t\tisEmpty: false,\n\t\t\t\t\tsrc: \"self\",\n\t\t\t\t\tdst: makeChangeAtomId(genId.allocate(), revision),\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\treturn inverted;\n\t},\n\n\trebase: (\n\t\tchange: OptionalChangeset,\n\t\toverChange: OptionalChangeset,\n\t\trebaseChild: NodeChangeRebaser,\n\t): OptionalChangeset => {\n\t\tconst { moves, childChanges, valueReplace: field } = change;\n\n\t\t// TODO: avoid computing the dstToSrc map if it's not needed.\n\t\t// TODO: de-dupe overSrcToDst and forwardMap\n\t\tconst { srcToDst: overSrcToDst } = getBidirectionalMaps(overChange.moves);\n\n\t\tconst forwardMap = new RegisterMap<RegisterId>();\n\t\tfor (const [src, dst] of overChange.moves) {\n\t\t\tforwardMap.set(src, dst);\n\t\t}\n\t\tif (overChange.valueReplace !== undefined) {\n\t\t\tconst effectfulDst = getEffectfulDst(overChange.valueReplace);\n\t\t\tif (effectfulDst !== undefined) {\n\t\t\t\tforwardMap.set(\"self\", overChange.valueReplace.dst);\n\t\t\t}\n\t\t\tif (overChange.valueReplace.src !== undefined) {\n\t\t\t\tforwardMap.set(overChange.valueReplace.src, \"self\");\n\t\t\t}\n\t\t}\n\n\t\tconst rebasedMoves: Move[] = [];\n\t\tfor (const [src, dst] of moves) {\n\t\t\tconst newDst = tryGetFromNestedMap(overSrcToDst, src.revision, src.localId);\n\t\t\trebasedMoves.push([src, newDst ?? dst]);\n\t\t}\n\n\t\tconst overChildChangesBySrc = new RegisterMap<NodeId>();\n\t\tfor (const [id, childChange] of overChange.childChanges) {\n\t\t\toverChildChangesBySrc.set(id, childChange);\n\t\t}\n\n\t\tconst rebasedChildChanges: ChildChange[] = [];\n\t\tfor (const [id, childChange] of childChanges) {\n\t\t\tconst overChildChange = overChildChangesBySrc.get(id);\n\t\t\tif (overChildChange !== undefined) {\n\t\t\t\toverChildChangesBySrc.delete(id);\n\t\t\t}\n\n\t\t\tconst rebasedId = forwardMap.get(id) ?? id;\n\t\t\tconst rebasedChildChange = rebaseChild(\n\t\t\t\tchildChange,\n\t\t\t\toverChildChange,\n\t\t\t\trebasedId === \"self\" ? NodeAttachState.Attached : NodeAttachState.Detached,\n\t\t\t);\n\t\t\tif (rebasedChildChange !== undefined) {\n\t\t\t\trebasedChildChanges.push([rebasedId, rebasedChildChange]);\n\t\t\t}\n\t\t}\n\n\t\tfor (const [id, overChildChange] of overChildChangesBySrc.entries()) {\n\t\t\tconst rebasedId = forwardMap.get(id) ?? id;\n\t\t\tconst rebasedChildChange = rebaseChild(\n\t\t\t\tundefined,\n\t\t\t\toverChildChange,\n\t\t\t\trebasedId === \"self\" ? NodeAttachState.Attached : NodeAttachState.Detached,\n\t\t\t);\n\t\t\tif (rebasedChildChange !== undefined) {\n\t\t\t\trebasedChildChanges.push([rebasedId, rebasedChildChange]);\n\t\t\t}\n\t\t}\n\n\t\tconst rebased: Mutable<OptionalChangeset> = {\n\t\t\tmoves: rebasedMoves,\n\t\t\tchildChanges: rebasedChildChanges,\n\t\t};\n\n\t\tif (field !== undefined) {\n\t\t\tconst replace: Mutable<Replace> = {\n\t\t\t\tisEmpty:\n\t\t\t\t\toverChange.valueReplace === undefined\n\t\t\t\t\t\t? field.isEmpty\n\t\t\t\t\t\t: overChange.valueReplace.src === undefined,\n\t\t\t\tdst: field.dst,\n\t\t\t};\n\t\t\tif (field.src !== undefined) {\n\t\t\t\treplace.src = forwardMap.get(field.src) ?? field.src;\n\t\t\t}\n\t\t\trebased.valueReplace = replace;\n\t\t}\n\n\t\treturn rebased;\n\t},\n\n\tprune: (change: OptionalChangeset, pruneChild: NodeChangePruner): OptionalChangeset => {\n\t\tconst childChanges: ChildChange[] = [];\n\t\tconst prunedChange: Mutable<OptionalChangeset> = {\n\t\t\tmoves: change.moves,\n\t\t\tchildChanges,\n\t\t};\n\t\tif (change.valueReplace !== undefined) {\n\t\t\tprunedChange.valueReplace = change.valueReplace;\n\t\t}\n\n\t\tfor (const [id, childChange] of change.childChanges) {\n\t\t\tconst prunedChildChange = pruneChild(childChange);\n\t\t\tif (prunedChildChange !== undefined) {\n\t\t\t\tchildChanges.push([id, prunedChildChange]);\n\t\t\t}\n\t\t}\n\n\t\treturn prunedChange;\n\t},\n\n\treplaceRevisions: (\n\t\tchange: OptionalChangeset,\n\t\toldRevisions: Set<RevisionTag | undefined>,\n\t\tnewRevision: RevisionTag | undefined,\n\t): OptionalChangeset => {\n\t\tconst valueReplace = replaceReplaceRevisions(\n\t\t\tchange.valueReplace,\n\t\t\toldRevisions,\n\t\t\tnewRevision,\n\t\t);\n\n\t\tconst childChanges: ChildChange[] = [];\n\t\tfor (const [id, childChange] of change.childChanges) {\n\t\t\tchildChanges.push([\n\t\t\t\treplaceRegisterRevisions(id, oldRevisions, newRevision),\n\t\t\t\treplaceAtomRevisions(childChange, oldRevisions, newRevision),\n\t\t\t]);\n\t\t}\n\n\t\tconst moves: Move[] = [];\n\t\tfor (const [src, dst] of change.moves) {\n\t\t\tmoves.push([\n\t\t\t\treplaceAtomRevisions(src, oldRevisions, newRevision),\n\t\t\t\treplaceAtomRevisions(dst, oldRevisions, newRevision),\n\t\t\t]);\n\t\t}\n\n\t\tconst updated: Mutable<OptionalChangeset> = { childChanges, moves };\n\t\tif (valueReplace !== undefined) {\n\t\t\tupdated.valueReplace = valueReplace;\n\t\t}\n\n\t\treturn updated;\n\t},\n};\n\nfunction replaceReplaceRevisions(\n\treplace: Replace | undefined,\n\toldRevisions: Set<RevisionTag | undefined>,\n\tnewRevision: RevisionTag | undefined,\n): Replace | undefined {\n\tif (replace === undefined) {\n\t\treturn undefined;\n\t}\n\n\tconst updated: Mutable<Replace> = {\n\t\t...replace,\n\t\tdst: replaceAtomRevisions(replace.dst, oldRevisions, newRevision),\n\t};\n\n\tif (replace.src !== undefined) {\n\t\tupdated.src = replaceRegisterRevisions(replace.src, oldRevisions, newRevision);\n\t}\n\n\treturn updated;\n}\n\nfunction replaceRegisterRevisions(\n\tregister: RegisterId,\n\toldRevisions: Set<RevisionTag | undefined>,\n\tnewRevision: RevisionTag | undefined,\n): RegisterId {\n\treturn register === \"self\"\n\t\t? register\n\t\t: replaceAtomRevisions(register, oldRevisions, newRevision);\n}\n\nfunction getComposedReplaceDst(\n\tchange1: Replace | undefined,\n\tchange2: OptionalChangeset,\n): ChangeAtomId {\n\tconst dst1 = change1?.dst;\n\tif (change2.valueReplace === undefined) {\n\t\tassert(dst1 !== undefined, 0x8ce /* Both replace replaces should not be undefined */);\n\t\treturn getIdAfterMoves(dst1, change2.moves);\n\t}\n\n\tif (\n\t\tdst1 === undefined ||\n\t\tchange1?.src === \"self\" ||\n\t\t(change2.valueReplace.src !== undefined &&\n\t\t\tareEqualRegisterIds(change2.valueReplace.src, dst1))\n\t) {\n\t\tassert(\n\t\t\tchange2.valueReplace !== undefined,\n\t\t\t0x8cf /* Both replace replaces should not be undefined */,\n\t\t);\n\t\treturn change2.valueReplace.dst;\n\t} else {\n\t\treturn getIdAfterMoves(dst1, change2.moves);\n\t}\n}\n\nfunction getIdAfterMoves(id: ChangeAtomId, moves: readonly Move[]): ChangeAtomId {\n\tfor (const [src, dst] of moves) {\n\t\tif (areEqualChangeAtomIds(id, src)) {\n\t\t\treturn dst;\n\t\t}\n\t}\n\treturn id;\n}\n\nfunction areEqualRegisterIds(id1: RegisterId, id2: RegisterId): boolean {\n\treturn id1 === \"self\" || id2 === \"self\" ? id1 === id2 : areEqualChangeAtomIds(id1, id2);\n}\n\nfunction areEqualRegisterIdsOpt(\n\tid1: RegisterId | undefined,\n\tid2: RegisterId | undefined,\n): boolean {\n\tif (id1 === undefined || id2 === undefined) {\n\t\treturn id1 === id2;\n\t}\n\treturn areEqualRegisterIds(id1, id2);\n}\n\nfunction getBidirectionalMaps(moves: OptionalChangeset[\"moves\"]): {\n\tsrcToDst: ChangeAtomIdMap<ChangeAtomId>;\n\tdstToSrc: ChangeAtomIdMap<ChangeAtomId>;\n} {\n\tconst srcToDst: ChangeAtomIdMap<ChangeAtomId> = new Map();\n\tconst dstToSrc: ChangeAtomIdMap<ChangeAtomId> = new Map();\n\tfor (const [src, dst] of moves) {\n\t\tsetInNestedMap(srcToDst, src.revision, src.localId, dst);\n\t\tsetInNestedMap(dstToSrc, dst.revision, dst.localId, src);\n\t}\n\treturn { srcToDst, dstToSrc };\n}\n\ntype EffectfulReplace =\n\t| {\n\t\t\tisEmpty: true;\n\t\t\tsrc?: ChangeAtomId;\n\t\t\tdst: ChangeAtomId;\n\t }\n\t| {\n\t\t\tisEmpty: boolean;\n\t\t\tsrc: ChangeAtomId;\n\t\t\tdst: ChangeAtomId;\n\t };\n\nfunction isReplaceEffectful(replace: Replace): replace is EffectfulReplace {\n\tif (replace.src === \"self\") {\n\t\treturn false;\n\t}\n\treturn !replace.isEmpty || replace.src !== undefined;\n}\n\nfunction getEffectfulDst(replace: Replace | undefined): ChangeAtomId | undefined {\n\treturn replace === undefined || replace.isEmpty || replace.src === \"self\"\n\t\t? undefined\n\t\t: replace.dst;\n}\n\nexport function taggedRegister(id: RegisterId, revision: RevisionTag | undefined): RegisterId {\n\tif (id === \"self\") {\n\t\treturn id;\n\t}\n\n\treturn taggedAtomId(id, revision);\n}\n\nexport interface OptionalFieldEditor extends FieldEditor<OptionalChangeset> {\n\t/**\n\t * Creates a change which will replace the content already in the field (if any at the time the change applies)\n\t * with new content.\n\t * The content in the field will be moved to the `ids.detach` register.\n\t * The content in the `ids.detach` register will be moved to into the field.\n\t * @param wasEmpty - whether the field is empty when creating this change\n\t * @param ids - the \"fill\" and \"detach\" ids associated with the change.\n\t */\n\tset(\n\t\twasEmpty: boolean,\n\t\tids: {\n\t\t\tfill: ChangeAtomId;\n\t\t\tdetach: ChangeAtomId;\n\t\t},\n\t): OptionalChangeset;\n\n\t/**\n\t * Creates a change which clears the field's contents (if any).\n\t * @param wasEmpty - whether the field is empty when creating this change\n\t * @param detachId - the ID of the register that existing field content (if any) will be moved to.\n\t */\n\tclear(wasEmpty: boolean, detachId: ChangeAtomId): OptionalChangeset;\n}\n\nexport const optionalFieldEditor: OptionalFieldEditor = {\n\tset: (\n\t\twasEmpty: boolean,\n\t\tids: {\n\t\t\tfill: ChangeAtomId;\n\t\t\t// Should be interpreted as a set of an empty field if undefined.\n\t\t\tdetach: ChangeAtomId;\n\t\t},\n\t): OptionalChangeset => ({\n\t\tmoves: [],\n\t\tchildChanges: [],\n\t\tvalueReplace: {\n\t\t\tisEmpty: wasEmpty,\n\t\t\tsrc: ids.fill,\n\t\t\tdst: ids.detach,\n\t\t},\n\t}),\n\n\tclear: (wasEmpty: boolean, detachId: ChangeAtomId): OptionalChangeset => ({\n\t\tmoves: [],\n\t\tchildChanges: [],\n\t\tvalueReplace: {\n\t\t\tisEmpty: wasEmpty,\n\t\t\tdst: detachId,\n\t\t},\n\t}),\n\n\tbuildChildChanges: (changes: Iterable<[number, NodeId]>): OptionalChangeset => {\n\t\tconst childChanges: ChildChange[] = Array.from(changes, ([index, childChange]) => {\n\t\t\tassert(index === 0, 0x404 /* Optional fields only support a single child node */);\n\t\t\treturn [\"self\", childChange];\n\t\t});\n\t\tassert(\n\t\t\tchildChanges.length <= 1,\n\t\t\t0xabd /* Optional fields only support a single child node */,\n\t\t);\n\t\treturn {\n\t\t\tmoves: [],\n\t\t\tchildChanges,\n\t\t};\n\t},\n};\n\nexport function optionalFieldIntoDelta(\n\tchange: OptionalChangeset,\n\tdeltaFromChild: ToDelta,\n): FieldChangeDelta {\n\tconst delta: Mutable<FieldChangeDelta> = {};\n\n\tlet markIsANoop = true;\n\tconst mark: Mutable<DeltaMark> = { count: 1 };\n\n\tif (change.valueReplace !== undefined && isReplaceEffectful(change.valueReplace)) {\n\t\tif (!change.valueReplace.isEmpty) {\n\t\t\tmark.detach = nodeIdFromChangeAtom(change.valueReplace.dst);\n\t\t}\n\t\tif (change.valueReplace.src !== undefined) {\n\t\t\tmark.attach = nodeIdFromChangeAtom(change.valueReplace.src);\n\t\t}\n\t\tmarkIsANoop = false;\n\t}\n\n\tif (change.moves.length > 0) {\n\t\tdelta.rename = change.moves.map(([src, dst]) => ({\n\t\t\tcount: 1,\n\t\t\toldId: nodeIdFromChangeAtom(src),\n\t\t\tnewId: nodeIdFromChangeAtom(dst),\n\t\t}));\n\t}\n\n\tif (change.childChanges.length > 0) {\n\t\tconst globals: DeltaDetachedNodeChanges[] = [];\n\t\tfor (const [id, childChange] of change.childChanges) {\n\t\t\tconst childDelta = deltaFromChild(childChange);\n\t\t\tif (id !== \"self\") {\n\t\t\t\tconst fields = childDelta;\n\t\t\t\tglobals.push({\n\t\t\t\t\tid: { major: id.revision, minor: id.localId },\n\t\t\t\t\tfields,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tmark.fields = childDelta;\n\t\t\t\tmarkIsANoop = false;\n\t\t\t}\n\t\t}\n\n\t\tif (globals.length > 0) {\n\t\t\tdelta.global = globals;\n\t\t}\n\t}\n\n\tif (!markIsANoop) {\n\t\tdelta.local = [mark];\n\t}\n\n\treturn delta;\n}\n\nexport const optionalChangeHandler: FieldChangeHandler<\n\tOptionalChangeset,\n\tOptionalFieldEditor\n> = {\n\trebaser: optionalChangeRebaser,\n\tcodecsFactory: makeOptionalFieldCodecFamily,\n\teditor: optionalFieldEditor,\n\n\tintoDelta: optionalFieldIntoDelta,\n\trelevantRemovedRoots,\n\n\tisEmpty: (change: OptionalChangeset) =>\n\t\tchange.childChanges.length === 0 &&\n\t\tchange.moves.length === 0 &&\n\t\tchange.valueReplace === undefined,\n\n\tgetNestedChanges,\n\n\tcreateEmpty: () => ({ moves: [], childChanges: [] }),\n\tgetCrossFieldKeys: (_change) => [],\n};\n\nfunction getNestedChanges(change: OptionalChangeset): NestedChangesIndices {\n\t// True iff the content of the field changes in some way\n\tconst isFieldContentChanged =\n\t\tchange.valueReplace !== undefined && change.valueReplace.src !== \"self\";\n\n\t// The node that is moved into the field (if any).\n\tconst nodeMovedIntoField = change.valueReplace?.src;\n\n\treturn change.childChanges.map(([register, nodeId]) => {\n\t\t// The node is removed in the input context iif register is not self.\n\t\tconst inputIndex = register === \"self\" ? 0 : undefined;\n\t\tconst outputIndex =\n\t\t\tregister === \"self\"\n\t\t\t\t? // If the node starts out as not-removed, it is removed in the output context iff the field content is changed\n\t\t\t\t\tisFieldContentChanged\n\t\t\t\t\t? undefined\n\t\t\t\t\t: 0\n\t\t\t\t: // If the node starts out as removed, then it remains removed in the output context iff it is not the node that is moved into the field\n\t\t\t\t\t!areEqualRegisterIdsOpt(register, nodeMovedIntoField)\n\t\t\t\t\t? undefined\n\t\t\t\t\t: 0;\n\t\treturn [nodeId, inputIndex, outputIndex];\n\t});\n}\n\nfunction* relevantRemovedRoots(\n\tchange: OptionalChangeset,\n\trelevantRemovedRootsFromChild: RelevantRemovedRootsFromChild,\n): Iterable<DeltaDetachedNodeId> {\n\tconst alreadyYielded = new RegisterMap<boolean>();\n\n\tfor (const [src] of change.moves) {\n\t\tif (!alreadyYielded.has(src)) {\n\t\t\talreadyYielded.set(src, true);\n\t\t\tyield nodeIdFromChangeAtom(src);\n\t\t}\n\t}\n\n\tfor (const [id, childChange] of change.childChanges) {\n\t\t// Child changes make the tree they apply to relevant unless that tree existed in the starting context of\n\t\t// of this change.\n\t\tif (id !== \"self\" && !alreadyYielded.has(id)) {\n\t\t\talreadyYielded.set(id, true);\n\t\t\tyield nodeIdFromChangeAtom(id);\n\t\t}\n\t\tyield* relevantRemovedRootsFromChild(childChange);\n\t}\n\n\tconst selfSrc = change.valueReplace?.src;\n\tif (selfSrc !== undefined && selfSrc !== \"self\" && !alreadyYielded.has(selfSrc)) {\n\t\tyield nodeIdFromChangeAtom(selfSrc);\n\t}\n}\n"]}
@@ -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 type { IFluidDataStoreRuntime, IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
6
- import type { IExperimentalIncrementalSummaryContext, IGarbageCollectionData, ISummaryTreeWithStats, ITelemetryContext } from "@fluidframework/runtime-definitions/internal";
5
+ import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
6
+ import type { IExperimentalIncrementalSummaryContext, ISummaryTreeWithStats, ITelemetryContext } from "@fluidframework/runtime-definitions/internal";
7
7
  import type { ICodecOptions } from "../../codec/index.js";
8
8
  import { type MutableTreeStoredSchema, type TreeStoredSchema } from "../../core/index.js";
9
9
  import type { Summarizable, SummaryElementParser, SummaryElementStringifier } from "../../shared-tree-core/index.js";
@@ -13,15 +13,13 @@ import type { Format } from "./format.js";
13
13
  * Provides methods for summarizing and loading a schema repository.
14
14
  */
15
15
  export declare class SchemaSummarizer implements Summarizable {
16
- private readonly runtime;
17
16
  private readonly schema;
18
17
  readonly key = "Schema";
19
18
  private readonly codec;
20
19
  private schemaIndexLastChangedSeq;
21
- constructor(runtime: IFluidDataStoreRuntime, schema: MutableTreeStoredSchema, options: ICodecOptions, collabWindow: CollabWindow);
20
+ constructor(schema: MutableTreeStoredSchema, options: ICodecOptions, collabWindow: CollabWindow);
22
21
  getAttachSummary(stringify: SummaryElementStringifier, fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext, incrementalSummaryContext?: IExperimentalIncrementalSummaryContext | undefined): ISummaryTreeWithStats;
23
22
  summarize(stringify: SummaryElementStringifier, fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext, incrementalSummaryContext?: IExperimentalIncrementalSummaryContext | undefined): Promise<ISummaryTreeWithStats>;
24
- getGCData(fullGC?: boolean): IGarbageCollectionData;
25
23
  load(services: IChannelStorageService, parse: SummaryElementParser): Promise<void>;
26
24
  }
27
25
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"schemaSummarizer.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/schema-index/schemaSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EACX,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,gDAAgD,CAAC;AAExD,OAAO,KAAK,EACX,sCAAsC,EACtC,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,8CAA8C,CAAC;AAGtD,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,sBAAsB,CAAC;AACtE,OAAO,EACN,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EAErB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACX,YAAY,EACZ,oBAAoB,EACpB,yBAAyB,EACzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAGxE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C;;GAEG;AACH,qBAAa,gBAAiB,YAAW,YAAY;IAQnD,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IARxB,SAAgB,GAAG,YAAY;IAE/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAuC;IAE7D,OAAO,CAAC,yBAAyB,CAAqB;gBAGpC,OAAO,EAAE,sBAAsB,EAC/B,MAAM,EAAE,uBAAuB,EAChD,OAAO,EAAE,aAAa,EACtB,YAAY,EAAE,YAAY;IAUpB,gBAAgB,CACtB,SAAS,EAAE,yBAAyB,EACpC,QAAQ,CAAC,EAAE,OAAO,EAClB,UAAU,CAAC,EAAE,OAAO,EACpB,gBAAgB,CAAC,EAAE,iBAAiB,EACpC,yBAAyB,CAAC,EAAE,sCAAsC,GAAG,SAAS,GAC5E,qBAAqB;IAmBX,SAAS,CACrB,SAAS,EAAE,yBAAyB,EACpC,QAAQ,CAAC,EAAE,OAAO,EAClB,UAAU,CAAC,EAAE,OAAO,EACpB,gBAAgB,CAAC,EAAE,iBAAiB,EACpC,yBAAyB,CAAC,EAAE,sCAAsC,GAAG,SAAS,GAC5E,OAAO,CAAC,qBAAqB,CAAC;IAI1B,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,sBAAsB;IAU7C,IAAI,CAChB,QAAQ,EAAE,sBAAsB,EAChC,KAAK,EAAE,oBAAoB,GACzB,OAAO,CAAC,IAAI,CAAC;CAgBhB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAEjE"}
1
+ {"version":3,"file":"schemaSummarizer.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/schema-index/schemaSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAE7F,OAAO,KAAK,EACX,sCAAsC,EACtC,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,8CAA8C,CAAC;AAGtD,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,sBAAsB,CAAC;AACtE,OAAO,EACN,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EAErB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACX,YAAY,EACZ,oBAAoB,EACpB,yBAAyB,EACzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAGxE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C;;GAEG;AACH,qBAAa,gBAAiB,YAAW,YAAY;IAQnD,OAAO,CAAC,QAAQ,CAAC,MAAM;IAPxB,SAAgB,GAAG,YAAY;IAE/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAuC;IAE7D,OAAO,CAAC,yBAAyB,CAAqB;gBAGpC,MAAM,EAAE,uBAAuB,EAChD,OAAO,EAAE,aAAa,EACtB,YAAY,EAAE,YAAY;IAUpB,gBAAgB,CACtB,SAAS,EAAE,yBAAyB,EACpC,QAAQ,CAAC,EAAE,OAAO,EAClB,UAAU,CAAC,EAAE,OAAO,EACpB,gBAAgB,CAAC,EAAE,iBAAiB,EACpC,yBAAyB,CAAC,EAAE,sCAAsC,GAAG,SAAS,GAC5E,qBAAqB;IAmBX,SAAS,CACrB,SAAS,EAAE,yBAAyB,EACpC,QAAQ,CAAC,EAAE,OAAO,EAClB,UAAU,CAAC,EAAE,OAAO,EACpB,gBAAgB,CAAC,EAAE,iBAAiB,EACpC,yBAAyB,CAAC,EAAE,sCAAsC,GAAG,SAAS,GAC5E,OAAO,CAAC,qBAAqB,CAAC;IAIpB,IAAI,CAChB,QAAQ,EAAE,sBAAsB,EAChC,KAAK,EAAE,oBAAoB,GACzB,OAAO,CAAC,IAAI,CAAC;CAgBhB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAEjE"}
@@ -13,8 +13,7 @@ const schemaStringKey = "SchemaString";
13
13
  * Provides methods for summarizing and loading a schema repository.
14
14
  */
15
15
  export class SchemaSummarizer {
16
- constructor(runtime, schema, options, collabWindow) {
17
- this.runtime = runtime;
16
+ constructor(schema, options, collabWindow) {
18
17
  this.schema = schema;
19
18
  this.key = "Schema";
20
19
  this.codec = makeSchemaCodec(options);
@@ -40,15 +39,6 @@ export class SchemaSummarizer {
40
39
  async summarize(stringify, fullTree, trackState, telemetryContext, incrementalSummaryContext) {
41
40
  throw new Error("Method not implemented.");
42
41
  }
43
- getGCData(fullGC) {
44
- // TODO: Properly implement garbage collection. Right now, garbage collection is performed automatically
45
- // by the code in SharedObject (from which SharedTreeCore extends). The `runtime.uploadBlob` API delegates
46
- // to the `BlobManager`, which automatically populates the summary with ISummaryAttachment entries for each
47
- // blob.
48
- return {
49
- gcNodes: {},
50
- };
51
- }
52
42
  async load(services, parse) {
53
43
  const schemaBuffer = await services.readBlob(schemaStringKey);
54
44
  // After the awaits, validate that the schema is in a clean state.
@@ -1 +1 @@
1
- {"version":3,"file":"schemaSummarizer.js","sourceRoot":"","sources":["../../../src/feature-libraries/schema-index/schemaSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAK7D,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAOjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAG5E,OAAO,EAGN,iBAAiB,GACjB,MAAM,qBAAqB,CAAC;AAQ7B,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGzD,MAAM,eAAe,GAAG,cAAc,CAAC;AACvC;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAO5B,YACkB,OAA+B,EAC/B,MAA+B,EAChD,OAAsB,EACtB,YAA0B;QAHT,YAAO,GAAP,OAAO,CAAwB;QAC/B,WAAM,GAAN,MAAM,CAAyB;QARjC,QAAG,GAAG,QAAQ,CAAC;QAY9B,IAAI,CAAC,KAAK,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;QACtC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;YAC/C,gFAAgF;YAChF,uGAAuG;YACvG,IAAI,CAA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iDAAiD;QACjD,MAAM,CACL,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,EAC9B,KAAK,CAAC,0EAA0E,CAChF,CAAC;QAEF,MAAM,YAAY,GAAG,cAAc,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QAC3D,+DAA+D;QAC/D,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;QAC5D,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,IAAI,CAAC,yBAAyB,GAAG,CAAC,CAAC;IACpC,CAAC;CACD;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAwB;IACxD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport { SummaryType } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIExperimentalIncrementalSummaryContext,\n\tIGarbageCollectionData,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils/internal\";\n\nimport type { ICodecOptions, IJsonCodec } from \"../../codec/index.js\";\nimport {\n\ttype MutableTreeStoredSchema,\n\ttype TreeStoredSchema,\n\tschemaDataIsEmpty,\n} from \"../../core/index.js\";\nimport type {\n\tSummarizable,\n\tSummaryElementParser,\n\tSummaryElementStringifier,\n} from \"../../shared-tree-core/index.js\";\nimport type { CollabWindow } from \"../incrementalSummarizationUtils.js\";\n\nimport { encodeRepo, makeSchemaCodec } from \"./codec.js\";\nimport type { Format } from \"./format.js\";\n\nconst schemaStringKey = \"SchemaString\";\n/**\n * Provides methods for summarizing and loading a schema repository.\n */\nexport class SchemaSummarizer implements Summarizable {\n\tpublic readonly key = \"Schema\";\n\n\tprivate readonly codec: IJsonCodec<TreeStoredSchema, Format>;\n\n\tprivate schemaIndexLastChangedSeq: number | undefined;\n\n\tpublic constructor(\n\t\tprivate readonly runtime: IFluidDataStoreRuntime,\n\t\tprivate readonly schema: MutableTreeStoredSchema,\n\t\toptions: ICodecOptions,\n\t\tcollabWindow: CollabWindow,\n\t) {\n\t\tthis.codec = makeSchemaCodec(options);\n\t\tthis.schema.events.on(\"afterSchemaChange\", () => {\n\t\t\t// Invalidate the cache, as we need to regenerate the blob if the schema changes\n\t\t\t// We are assuming that schema changes from remote ops are valid, as we are in a summarization context.\n\t\t\tthis.schemaIndexLastChangedSeq = collabWindow.getCurrentSeq();\n\t\t});\n\t}\n\n\tpublic getAttachSummary(\n\t\tstringify: SummaryElementStringifier,\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext | undefined,\n\t): ISummaryTreeWithStats {\n\t\tconst builder = new SummaryTreeBuilder();\n\t\tif (\n\t\t\tincrementalSummaryContext !== undefined &&\n\t\t\tthis.schemaIndexLastChangedSeq !== undefined &&\n\t\t\tincrementalSummaryContext.latestSummarySequenceNumber >= this.schemaIndexLastChangedSeq\n\t\t) {\n\t\t\tbuilder.addHandle(\n\t\t\t\tschemaStringKey,\n\t\t\t\tSummaryType.Blob,\n\t\t\t\t`${incrementalSummaryContext.summaryPath}/indexes/${this.key}/${schemaStringKey}`,\n\t\t\t);\n\t\t} else {\n\t\t\tconst dataString = JSON.stringify(this.codec.encode(this.schema));\n\t\t\tbuilder.addBlob(schemaStringKey, dataString);\n\t\t}\n\t\treturn builder.getSummaryTree();\n\t}\n\n\tpublic async summarize(\n\t\tstringify: SummaryElementStringifier,\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext | undefined,\n\t): Promise<ISummaryTreeWithStats> {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\tpublic getGCData(fullGC?: boolean): IGarbageCollectionData {\n\t\t// TODO: Properly implement garbage collection. Right now, garbage collection is performed automatically\n\t\t// by the code in SharedObject (from which SharedTreeCore extends). The `runtime.uploadBlob` API delegates\n\t\t// to the `BlobManager`, which automatically populates the summary with ISummaryAttachment entries for each\n\t\t// blob.\n\t\treturn {\n\t\t\tgcNodes: {},\n\t\t};\n\t}\n\n\tpublic async load(\n\t\tservices: IChannelStorageService,\n\t\tparse: SummaryElementParser,\n\t): Promise<void> {\n\t\tconst schemaBuffer: ArrayBufferLike = await services.readBlob(schemaStringKey);\n\t\t// After the awaits, validate that the schema is in a clean state.\n\t\t// This detects any schema that could have been accidentally added through\n\t\t// invalid means and are about to be overwritten.\n\t\tassert(\n\t\t\tschemaDataIsEmpty(this.schema),\n\t\t\t0x3da /* there should not already be stored schema when loading stored schema */,\n\t\t);\n\n\t\tconst schemaString = bufferToString(schemaBuffer, \"utf-8\");\n\t\t// Currently no Fluid handles are used, so just use JSON.parse.\n\t\tconst decoded = this.codec.decode(JSON.parse(schemaString));\n\t\tthis.schema.apply(decoded);\n\t\tthis.schemaIndexLastChangedSeq = 0;\n\t}\n}\n\n/**\n * Dumps schema into a deterministic JSON compatible semi-human readable format.\n *\n * @remarks\n * This can be used to help inspect schema for debugging, and to save a snapshot of schema to help detect and review changes to an applications schema.\n */\nexport function encodeTreeSchema(schema: TreeStoredSchema): Format {\n\treturn encodeRepo(schema);\n}\n"]}
1
+ {"version":3,"file":"schemaSummarizer.js","sourceRoot":"","sources":["../../../src/feature-libraries/schema-index/schemaSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BA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AAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;YAClE,OAAO,CAAC,OAAO,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,OAAO,CAAC,cAAc,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,SAAS,CACrB,SAAoC,EACpC,QAAkB,EAClB,UAAoB,EACpB,gBAAoC,EACpC,yBAA8E;QAE9E,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAEM,KAAK,CAAC,IAAI,CAChB,QAAgC,EAChC,KAA2B;QAE3B,MAAM,YAAY,GAAoB,MAAM,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;QAC/E,kEAAkE;QAClE,0EAA0E;QAC1E,iDAAiD;QACjD,MAAM,CACL,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,EAC9B,KAAK,CAAC,0EAA0E,CAChF,CAAC;QAEF,MAAM,YAAY,GAAG,cAAc,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QAC3D,+DAA+D;QAC/D,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;QAC5D,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,IAAI,CAAC,yBAAyB,GAAG,CAAC,CAAC;IACpC,CAAC;CACD;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAwB;IACxD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport { SummaryType } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIExperimentalIncrementalSummaryContext,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils/internal\";\n\nimport type { ICodecOptions, IJsonCodec } from \"../../codec/index.js\";\nimport {\n\ttype MutableTreeStoredSchema,\n\ttype TreeStoredSchema,\n\tschemaDataIsEmpty,\n} from \"../../core/index.js\";\nimport type {\n\tSummarizable,\n\tSummaryElementParser,\n\tSummaryElementStringifier,\n} from \"../../shared-tree-core/index.js\";\nimport type { CollabWindow } from \"../incrementalSummarizationUtils.js\";\n\nimport { encodeRepo, makeSchemaCodec } from \"./codec.js\";\nimport type { Format } from \"./format.js\";\n\nconst schemaStringKey = \"SchemaString\";\n/**\n * Provides methods for summarizing and loading a schema repository.\n */\nexport class SchemaSummarizer implements Summarizable {\n\tpublic readonly key = \"Schema\";\n\n\tprivate readonly codec: IJsonCodec<TreeStoredSchema, Format>;\n\n\tprivate schemaIndexLastChangedSeq: number | undefined;\n\n\tpublic constructor(\n\t\tprivate readonly schema: MutableTreeStoredSchema,\n\t\toptions: ICodecOptions,\n\t\tcollabWindow: CollabWindow,\n\t) {\n\t\tthis.codec = makeSchemaCodec(options);\n\t\tthis.schema.events.on(\"afterSchemaChange\", () => {\n\t\t\t// Invalidate the cache, as we need to regenerate the blob if the schema changes\n\t\t\t// We are assuming that schema changes from remote ops are valid, as we are in a summarization context.\n\t\t\tthis.schemaIndexLastChangedSeq = collabWindow.getCurrentSeq();\n\t\t});\n\t}\n\n\tpublic getAttachSummary(\n\t\tstringify: SummaryElementStringifier,\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext | undefined,\n\t): ISummaryTreeWithStats {\n\t\tconst builder = new SummaryTreeBuilder();\n\t\tif (\n\t\t\tincrementalSummaryContext !== undefined &&\n\t\t\tthis.schemaIndexLastChangedSeq !== undefined &&\n\t\t\tincrementalSummaryContext.latestSummarySequenceNumber >= this.schemaIndexLastChangedSeq\n\t\t) {\n\t\t\tbuilder.addHandle(\n\t\t\t\tschemaStringKey,\n\t\t\t\tSummaryType.Blob,\n\t\t\t\t`${incrementalSummaryContext.summaryPath}/indexes/${this.key}/${schemaStringKey}`,\n\t\t\t);\n\t\t} else {\n\t\t\tconst dataString = JSON.stringify(this.codec.encode(this.schema));\n\t\t\tbuilder.addBlob(schemaStringKey, dataString);\n\t\t}\n\t\treturn builder.getSummaryTree();\n\t}\n\n\tpublic async summarize(\n\t\tstringify: SummaryElementStringifier,\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext | undefined,\n\t): Promise<ISummaryTreeWithStats> {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\tpublic async load(\n\t\tservices: IChannelStorageService,\n\t\tparse: SummaryElementParser,\n\t): Promise<void> {\n\t\tconst schemaBuffer: ArrayBufferLike = await services.readBlob(schemaStringKey);\n\t\t// After the awaits, validate that the schema is in a clean state.\n\t\t// This detects any schema that could have been accidentally added through\n\t\t// invalid means and are about to be overwritten.\n\t\tassert(\n\t\t\tschemaDataIsEmpty(this.schema),\n\t\t\t0x3da /* there should not already be stored schema when loading stored schema */,\n\t\t);\n\n\t\tconst schemaString = bufferToString(schemaBuffer, \"utf-8\");\n\t\t// Currently no Fluid handles are used, so just use JSON.parse.\n\t\tconst decoded = this.codec.decode(JSON.parse(schemaString));\n\t\tthis.schema.apply(decoded);\n\t\tthis.schemaIndexLastChangedSeq = 0;\n\t}\n}\n\n/**\n * Dumps schema into a deterministic JSON compatible semi-human readable format.\n *\n * @remarks\n * This can be used to help inspect schema for debugging, and to save a snapshot of schema to help detect and review changes to an applications schema.\n */\nexport function encodeTreeSchema(schema: TreeStoredSchema): Format {\n\treturn encodeRepo(schema);\n}\n"]}
@@ -24,7 +24,7 @@ export interface SequenceFieldEditor extends FieldEditor<Changeset> {
24
24
  return(sourceIndex: number, count: number, destIndex: number, detachCellId: CellId, attachCellId: CellId, revision: RevisionTag): Changeset;
25
25
  }
26
26
  export declare const sequenceFieldEditor: {
27
- buildChildChange: (index: number, change: NodeId) => MarkList;
27
+ buildChildChanges: (changes: Iterable<[number, NodeId]>) => MarkList;
28
28
  insert: (index: number, count: number, firstId: CellId, revision: RevisionTag | undefined) => MarkList;
29
29
  remove: (index: number, count: number, id: ChangesetLocalId, revision: RevisionTag | undefined) => MarkList;
30
30
  revive: (index: number, count: number, detachEvent: CellId, revision: RevisionTag | undefined) => MarkList;
@@ -1 +1 @@
1
- {"version":3,"file":"sequenceFieldEditor.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/sequence-field/sequenceFieldEditor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGtE,OAAO,KAAK,EACX,MAAM,EAEN,SAAS,EAGT,QAAQ,EAGR,MAAM,YAAY,CAAC;AAGpB,MAAM,WAAW,mBAAoB,SAAQ,WAAW,CAAC,SAAS,CAAC;IAClE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,GAAG,SAAS,CAAC;IACxF,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,gBAAgB,EAAE,QAAQ,EAAE,WAAW,GAAG,SAAS,CAAC;IAC7F,MAAM,CACL,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,WAAW,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1
+ {"version":3,"file":"sequenceFieldEditor.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/sequence-field/sequenceFieldEditor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGtE,OAAO,KAAK,EACX,MAAM,EAEN,SAAS,EAGT,QAAQ,EAGR,MAAM,YAAY,CAAC;AAGpB,MAAM,WAAW,mBAAoB,SAAQ,WAAW,CAAC,SAAS,CAAC;IAClE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,GAAG,SAAS,CAAC;IACxF,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,gBAAgB,EAAE,QAAQ,EAAE,WAAW,GAAG,SAAS,CAAC;IAC7F,MAAM,CACL,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,WAAW,EACrB,WAAW,CAAC,EAAE,IAAI,GAChB,SAAS,CAAC;IAEb;;;;;;;;OAQG;IACH,IAAI,CACH,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,gBAAgB,EAC9B,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,WAAW,GACnB,SAAS,CAAC;IAEb,OAAO,CACN,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,gBAAgB,EACpB,QAAQ,EAAE,WAAW,GACnB,SAAS,CAAC;IACb,MAAM,CACL,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,gBAAgB,EACxB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,WAAW,GACnB,SAAS,CAAC;IAEb,MAAM,CACL,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,WAAW,GACnB,SAAS,CAAC;CACb;AAED,eAAO,MAAM,mBAAmB;iCACF,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;oBAc/C,MAAM,SACN,MAAM,WACJ,MAAM,YACL,WAAW,GAAG,SAAS;oBAY1B,MAAM,SACN,MAAM,MACT,gBAAgB,YACV,WAAW,GAAG,SAAS;oBAK1B,MAAM,SACN,MAAM,eACA,MAAM,YACT,WAAW,GAAG,SAAS;sBAcpB,MAAM,SACZ,MAAM,aACF,MAAM,gBACH,gBAAgB,gBAChB,MAAM,YACV,WAAW,GAAG,SAAS;yBAmBpB,MAAM,SACZ,MAAM,gBACC,gBAAgB,YACpB,WAAW;sBAYV,MAAM,SACV,MAAM,UACL,gBAAgB,gBACV,MAAM,YACV,WAAW;wBAaR,MAAM,SACZ,MAAM,aACF,MAAM,gBACH,MAAM,gBACN,MAAM,YACV,WAAW,GAAG,SAAS;CAoBJ,CAAC"}
@@ -6,7 +6,19 @@ import { assert } from "@fluidframework/core-utils/internal";
6
6
  import { MarkListFactory } from "./markListFactory.js";
7
7
  import { splitMark } from "./utils.js";
8
8
  export const sequenceFieldEditor = {
9
- buildChildChange: (index, change) => markAtIndex(index, { count: 1, changes: change }),
9
+ buildChildChanges: (changes) => {
10
+ const changeset = [];
11
+ let currentIndex = 0;
12
+ for (const [index, change] of changes) {
13
+ assert(index >= currentIndex, 0xabe /* Child changes must be in order. */);
14
+ if (index > currentIndex) {
15
+ changeset.push({ count: index - currentIndex });
16
+ }
17
+ changeset.push({ count: 1, changes: change });
18
+ currentIndex = index + 1;
19
+ }
20
+ return changeset;
21
+ },
10
22
  insert: (index, count, firstId, revision) => {
11
23
  const mark = {
12
24
  type: "Insert",
@@ -1 +1 @@
1
- {"version":3,"file":"sequenceFieldEditor.js","sourceRoot":"","sources":["../../../src/feature-libraries/sequence-field/sequenceFieldEditor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAK7D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAWvD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAuDvC,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAClC,gBAAgB,EAAE,CAAC,KAAa,EAAE,MAAc,EAAa,EAAE,CAC9D,WAAW,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClD,MAAM,EAAE,CACP,KAAa,EACb,KAAa,EACb,OAAe,EACf,QAAiC,EACrB,EAAE;QACd,MAAM,IAAI,GAAqB;YAC9B,IAAI,EAAE,QAAQ;YACd,EAAE,EAAE,OAAO,CAAC,OAAO;YACnB,KAAK;YACL,MAAM,EAAE,OAAO;YACf,QAAQ;SACR,CAAC;QACF,OAAO,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;IACD,MAAM,EAAE,CACP,KAAa,EACb,KAAa,EACb,EAAoB,EACpB,QAAiC,EACrB,EAAE,CACd,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC;IAE/E,MAAM,EAAE,CACP,KAAa,EACb,KAAa,EACb,WAAmB,EACnB,QAAiC,EACrB,EAAE;QACd,MAAM,CAAC,WAAW,CAAC,QAAQ,KAAK,SAAS,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC1F,MAAM,IAAI,GAAqB;YAC9B,IAAI,EAAE,Q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AAC;SAAM,CAAC;QACP,MAAM,kBAAkB,GAAG,SAAS,GAAG,WAAW,CAAC;QACnD,iDAAiD;QACjD,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;QACjE,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC3B,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAC1B,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC;AACnB,CAAC;AAED,SAAS,WAAW,CAAC,KAAa,EAAE,IAAU;IAC7C,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,CAAC;AACxD,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\";\n\nimport type { ChangesetLocalId, RevisionTag } from \"../../core/index.js\";\nimport type { FieldEditor, NodeId } from \"../modular-schema/index.js\";\n\nimport { MarkListFactory } from \"./markListFactory.js\";\nimport type {\n\tCellId,\n\tCellMark,\n\tChangeset,\n\tInsert,\n\tMark,\n\tMarkList,\n\tMoveIn,\n\tMoveOut,\n} from \"./types.js\";\nimport { splitMark } from \"./utils.js\";\n\nexport interface SequenceFieldEditor extends FieldEditor<Changeset> {\n\tinsert(index: number, count: number, firstId: CellId, revision: RevisionTag): Changeset;\n\tremove(index: number, count: number, id: ChangesetLocalId, revision: RevisionTag): Changeset;\n\trevive(\n\t\tindex: number,\n\t\tcount: number,\n\t\tdetachEvent: CellId,\n\t\trevision: RevisionTag,\n\t\tisIntention?: true,\n\t): Changeset;\n\n\t/**\n\t *\n\t * @param sourceIndex - The index of the first node move\n\t * @param count - The number of nodes to move\n\t * @param destIndex - The index the nodes should be moved to, interpreted before detaching the moved nodes\n\t * @param detachCellId - The local ID to assign to the first cell being emptied by the move\n\t * @param attachCellId - The ID to assign to the first cell being filled by the move\n\t * @param revision - The revision to assign to the move marks\n\t */\n\tmove(\n\t\tsourceIndex: number,\n\t\tcount: number,\n\t\tdestIndex: number,\n\t\tdetachCellId: ChangesetLocalId,\n\t\tattachCellId: CellId,\n\t\trevision: RevisionTag,\n\t): Changeset;\n\n\tmoveOut(\n\t\tsourceIndex: number,\n\t\tcount: number,\n\t\tid: ChangesetLocalId,\n\t\trevision: RevisionTag,\n\t): Changeset;\n\tmoveIn(\n\t\tdestIndex: number,\n\t\tcount: number,\n\t\tmoveId: ChangesetLocalId,\n\t\tattachCellId: CellId,\n\t\trevision: RevisionTag,\n\t): Changeset;\n\n\treturn(\n\t\tsourceIndex: number,\n\t\tcount: number,\n\t\tdestIndex: number,\n\t\tdetachCellId: CellId,\n\t\tattachCellId: CellId,\n\t\trevision: RevisionTag,\n\t): Changeset;\n}\n\nexport const sequenceFieldEditor = {\n\tbuildChildChange: (index: number, change: NodeId): Changeset =>\n\t\tmarkAtIndex(index, { count: 1, changes: change }),\n\tinsert: (\n\t\tindex: number,\n\t\tcount: number,\n\t\tfirstId: CellId,\n\t\trevision: RevisionTag | undefined,\n\t): Changeset => {\n\t\tconst mark: CellMark<Insert> = {\n\t\t\ttype: \"Insert\",\n\t\t\tid: firstId.localId,\n\t\t\tcount,\n\t\t\tcellId: firstId,\n\t\t\trevision,\n\t\t};\n\t\treturn markAtIndex(index, mark);\n\t},\n\tremove: (\n\t\tindex: number,\n\t\tcount: number,\n\t\tid: ChangesetLocalId,\n\t\trevision: RevisionTag | undefined,\n\t): Changeset =>\n\t\tcount === 0 ? [] : markAtIndex(index, { type: \"Remove\", count, id, revision }),\n\n\trevive: (\n\t\tindex: number,\n\t\tcount: number,\n\t\tdetachEvent: CellId,\n\t\trevision: RevisionTag | undefined,\n\t): Changeset => {\n\t\tassert(detachEvent.revision !== undefined, 0x724 /* Detach event must have a revision */);\n\t\tconst mark: CellMark<Insert> = {\n\t\t\ttype: \"Insert\",\n\t\t\tid: detachEvent.localId,\n\t\t\tcount,\n\t\t\tcellId: detachEvent,\n\t\t\trevision,\n\t\t};\n\t\treturn count === 0 ? [] : markAtIndex(index, mark);\n\t},\n\n\tmove(\n\t\tsourceIndex: number,\n\t\tcount: number,\n\t\tdestIndex: number,\n\t\tdetachCellId: ChangesetLocalId,\n\t\tattachCellId: CellId,\n\t\trevision: RevisionTag | undefined,\n\t): Changeset {\n\t\tconst moveIn: Mark = {\n\t\t\ttype: \"MoveIn\",\n\t\t\tid: detachCellId,\n\t\t\tcount,\n\t\t\tcellId: attachCellId,\n\t\t\trevision,\n\t\t};\n\t\tconst moveOut: Mark = {\n\t\t\ttype: \"MoveOut\",\n\t\t\tid: detachCellId,\n\t\t\tcount,\n\t\t\trevision,\n\t\t};\n\t\treturn moveMarksToMarkList(sourceIndex, count, destIndex, moveOut, moveIn);\n\t},\n\n\tmoveOut(\n\t\tsourceIndex: number,\n\t\tcount: number,\n\t\tdetachCellId: ChangesetLocalId,\n\t\trevision: RevisionTag,\n\t): Changeset {\n\t\tconst moveOut: Mark = {\n\t\t\ttype: \"MoveOut\",\n\t\t\tid: detachCellId,\n\t\t\tcount,\n\t\t\trevision,\n\t\t};\n\t\treturn markAtIndex(sourceIndex, moveOut);\n\t},\n\n\tmoveIn(\n\t\tdestIndex: number,\n\t\tcount: number,\n\t\tmoveId: ChangesetLocalId,\n\t\tattachCellId: CellId,\n\t\trevision: RevisionTag,\n\t): Changeset {\n\t\tconst moveIn: Mark = {\n\t\t\ttype: \"MoveIn\",\n\t\t\tid: moveId,\n\t\t\tcount,\n\t\t\tcellId: attachCellId,\n\t\t\trevision,\n\t\t};\n\t\treturn markAtIndex(destIndex, moveIn);\n\t},\n\n\treturn(\n\t\tsourceIndex: number,\n\t\tcount: number,\n\t\tdestIndex: number,\n\t\tdetachCellId: CellId,\n\t\tattachCellId: CellId,\n\t\trevision: RevisionTag | undefined,\n\t): Changeset {\n\t\tconst moveOut: CellMark<MoveOut> = {\n\t\t\ttype: \"MoveOut\",\n\t\t\tid: attachCellId.localId,\n\t\t\tidOverride: detachCellId,\n\t\t\tcount,\n\t\t\trevision,\n\t\t};\n\n\t\tconst returnTo: CellMark<MoveIn> = {\n\t\t\ttype: \"MoveIn\",\n\t\t\tid: attachCellId.localId,\n\t\t\tcount,\n\t\t\tcellId: attachCellId,\n\t\t\trevision,\n\t\t};\n\n\t\treturn moveMarksToMarkList(sourceIndex, count, destIndex, moveOut, returnTo);\n\t},\n} satisfies SequenceFieldEditor;\n\nfunction moveMarksToMarkList(\n\tsourceIndex: number,\n\tcount: number,\n\tdestIndex: number,\n\tdetach: CellMark<MoveOut>,\n\tattach: CellMark<MoveIn>,\n): MarkList {\n\tif (count === 0) {\n\t\treturn [];\n\t}\n\tconst firstIndexBeyondMoveOut = sourceIndex + count;\n\tconst marks = new MarkListFactory();\n\tmarks.pushOffset(Math.min(sourceIndex, destIndex));\n\tif (destIndex <= sourceIndex) {\n\t\t// The destination is fully before the source\n\t\tmarks.pushContent(attach);\n\t\tmarks.pushOffset(sourceIndex - destIndex);\n\t\tmarks.pushContent(detach);\n\t} else if (firstIndexBeyondMoveOut <= destIndex) {\n\t\t// The destination is fully after the source\n\t\tmarks.pushContent(detach);\n\t\tmarks.pushOffset(destIndex - firstIndexBeyondMoveOut);\n\t\tmarks.pushContent(attach);\n\t} else {\n\t\tconst firstSectionLength = destIndex - sourceIndex;\n\t\t// The destination is in the middle of the source\n\t\tconst [detach1, detach2] = splitMark(detach, firstSectionLength);\n\t\tmarks.pushContent(detach1);\n\t\tmarks.pushContent(attach);\n\t\tmarks.pushContent(detach2);\n\t}\n\treturn marks.list;\n}\n\nfunction markAtIndex(index: number, mark: Mark): Changeset {\n\treturn index === 0 ? [mark] : [{ count: index }, mark];\n}\n"]}
1
+ {"version":3,"file":"sequenceFieldEditor.js","sourceRoot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AC,CAAC;QAC1B,KAAK,CAAC,UAAU,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC;QAC1C,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;SAAM,IAAI,uBAAuB,IAAI,SAAS,EAAE,CAAC;QACjD,4CAA4C;QAC5C,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAC1B,KAAK,CAAC,UAAU,CAAC,SAAS,GAAG,uBAAuB,CAAC,CAAC;QACtD,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;SAAM,CAAC;QACP,MAAM,kBAAkB,GAAG,SAAS,GAAG,WAAW,CAAC;QACnD,iDAAiD;QACjD,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;QACjE,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC3B,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAC1B,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC;AACnB,CAAC;AAED,SAAS,WAAW,CAAC,KAAa,EAAE,IAAU;IAC7C,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,CAAC;AACxD,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\";\n\nimport type { ChangesetLocalId, RevisionTag } from \"../../core/index.js\";\nimport type { FieldEditor, NodeId } from \"../modular-schema/index.js\";\n\nimport { MarkListFactory } from \"./markListFactory.js\";\nimport type {\n\tCellId,\n\tCellMark,\n\tChangeset,\n\tInsert,\n\tMark,\n\tMarkList,\n\tMoveIn,\n\tMoveOut,\n} from \"./types.js\";\nimport { splitMark } from \"./utils.js\";\n\nexport interface SequenceFieldEditor extends FieldEditor<Changeset> {\n\tinsert(index: number, count: number, firstId: CellId, revision: RevisionTag): Changeset;\n\tremove(index: number, count: number, id: ChangesetLocalId, revision: RevisionTag): Changeset;\n\trevive(\n\t\tindex: number,\n\t\tcount: number,\n\t\tdetachEvent: CellId,\n\t\trevision: RevisionTag,\n\t\tisIntention?: true,\n\t): Changeset;\n\n\t/**\n\t *\n\t * @param sourceIndex - The index of the first node move\n\t * @param count - The number of nodes to move\n\t * @param destIndex - The index the nodes should be moved to, interpreted before detaching the moved nodes\n\t * @param detachCellId - The local ID to assign to the first cell being emptied by the move\n\t * @param attachCellId - The ID to assign to the first cell being filled by the move\n\t * @param revision - The revision to assign to the move marks\n\t */\n\tmove(\n\t\tsourceIndex: number,\n\t\tcount: number,\n\t\tdestIndex: number,\n\t\tdetachCellId: ChangesetLocalId,\n\t\tattachCellId: CellId,\n\t\trevision: RevisionTag,\n\t): Changeset;\n\n\tmoveOut(\n\t\tsourceIndex: number,\n\t\tcount: number,\n\t\tid: ChangesetLocalId,\n\t\trevision: RevisionTag,\n\t): Changeset;\n\tmoveIn(\n\t\tdestIndex: number,\n\t\tcount: number,\n\t\tmoveId: ChangesetLocalId,\n\t\tattachCellId: CellId,\n\t\trevision: RevisionTag,\n\t): Changeset;\n\n\treturn(\n\t\tsourceIndex: number,\n\t\tcount: number,\n\t\tdestIndex: number,\n\t\tdetachCellId: CellId,\n\t\tattachCellId: CellId,\n\t\trevision: RevisionTag,\n\t): Changeset;\n}\n\nexport const sequenceFieldEditor = {\n\tbuildChildChanges: (changes: Iterable<[number, NodeId]>): Changeset => {\n\t\tconst changeset: Changeset = [];\n\t\tlet currentIndex = 0;\n\t\tfor (const [index, change] of changes) {\n\t\t\tassert(index >= currentIndex, 0xabe /* Child changes must be in order. */);\n\t\t\tif (index > currentIndex) {\n\t\t\t\tchangeset.push({ count: index - currentIndex });\n\t\t\t}\n\t\t\tchangeset.push({ count: 1, changes: change });\n\t\t\tcurrentIndex = index + 1;\n\t\t}\n\t\treturn changeset;\n\t},\n\tinsert: (\n\t\tindex: number,\n\t\tcount: number,\n\t\tfirstId: CellId,\n\t\trevision: RevisionTag | undefined,\n\t): Changeset => {\n\t\tconst mark: CellMark<Insert> = {\n\t\t\ttype: \"Insert\",\n\t\t\tid: firstId.localId,\n\t\t\tcount,\n\t\t\tcellId: firstId,\n\t\t\trevision,\n\t\t};\n\t\treturn markAtIndex(index, mark);\n\t},\n\tremove: (\n\t\tindex: number,\n\t\tcount: number,\n\t\tid: ChangesetLocalId,\n\t\trevision: RevisionTag | undefined,\n\t): Changeset =>\n\t\tcount === 0 ? [] : markAtIndex(index, { type: \"Remove\", count, id, revision }),\n\n\trevive: (\n\t\tindex: number,\n\t\tcount: number,\n\t\tdetachEvent: CellId,\n\t\trevision: RevisionTag | undefined,\n\t): Changeset => {\n\t\tassert(detachEvent.revision !== undefined, 0x724 /* Detach event must have a revision */);\n\t\tconst mark: CellMark<Insert> = {\n\t\t\ttype: \"Insert\",\n\t\t\tid: detachEvent.localId,\n\t\t\tcount,\n\t\t\tcellId: detachEvent,\n\t\t\trevision,\n\t\t};\n\t\treturn count === 0 ? [] : markAtIndex(index, mark);\n\t},\n\n\tmove(\n\t\tsourceIndex: number,\n\t\tcount: number,\n\t\tdestIndex: number,\n\t\tdetachCellId: ChangesetLocalId,\n\t\tattachCellId: CellId,\n\t\trevision: RevisionTag | undefined,\n\t): Changeset {\n\t\tconst moveIn: Mark = {\n\t\t\ttype: \"MoveIn\",\n\t\t\tid: detachCellId,\n\t\t\tcount,\n\t\t\tcellId: attachCellId,\n\t\t\trevision,\n\t\t};\n\t\tconst moveOut: Mark = {\n\t\t\ttype: \"MoveOut\",\n\t\t\tid: detachCellId,\n\t\t\tcount,\n\t\t\trevision,\n\t\t};\n\t\treturn moveMarksToMarkList(sourceIndex, count, destIndex, moveOut, moveIn);\n\t},\n\n\tmoveOut(\n\t\tsourceIndex: number,\n\t\tcount: number,\n\t\tdetachCellId: ChangesetLocalId,\n\t\trevision: RevisionTag,\n\t): Changeset {\n\t\tconst moveOut: Mark = {\n\t\t\ttype: \"MoveOut\",\n\t\t\tid: detachCellId,\n\t\t\tcount,\n\t\t\trevision,\n\t\t};\n\t\treturn markAtIndex(sourceIndex, moveOut);\n\t},\n\n\tmoveIn(\n\t\tdestIndex: number,\n\t\tcount: number,\n\t\tmoveId: ChangesetLocalId,\n\t\tattachCellId: CellId,\n\t\trevision: RevisionTag,\n\t): Changeset {\n\t\tconst moveIn: Mark = {\n\t\t\ttype: \"MoveIn\",\n\t\t\tid: moveId,\n\t\t\tcount,\n\t\t\tcellId: attachCellId,\n\t\t\trevision,\n\t\t};\n\t\treturn markAtIndex(destIndex, moveIn);\n\t},\n\n\treturn(\n\t\tsourceIndex: number,\n\t\tcount: number,\n\t\tdestIndex: number,\n\t\tdetachCellId: CellId,\n\t\tattachCellId: CellId,\n\t\trevision: RevisionTag | undefined,\n\t): Changeset {\n\t\tconst moveOut: CellMark<MoveOut> = {\n\t\t\ttype: \"MoveOut\",\n\t\t\tid: attachCellId.localId,\n\t\t\tidOverride: detachCellId,\n\t\t\tcount,\n\t\t\trevision,\n\t\t};\n\n\t\tconst returnTo: CellMark<MoveIn> = {\n\t\t\ttype: \"MoveIn\",\n\t\t\tid: attachCellId.localId,\n\t\t\tcount,\n\t\t\tcellId: attachCellId,\n\t\t\trevision,\n\t\t};\n\n\t\treturn moveMarksToMarkList(sourceIndex, count, destIndex, moveOut, returnTo);\n\t},\n} satisfies SequenceFieldEditor;\n\nfunction moveMarksToMarkList(\n\tsourceIndex: number,\n\tcount: number,\n\tdestIndex: number,\n\tdetach: CellMark<MoveOut>,\n\tattach: CellMark<MoveIn>,\n): MarkList {\n\tif (count === 0) {\n\t\treturn [];\n\t}\n\tconst firstIndexBeyondMoveOut = sourceIndex + count;\n\tconst marks = new MarkListFactory();\n\tmarks.pushOffset(Math.min(sourceIndex, destIndex));\n\tif (destIndex <= sourceIndex) {\n\t\t// The destination is fully before the source\n\t\tmarks.pushContent(attach);\n\t\tmarks.pushOffset(sourceIndex - destIndex);\n\t\tmarks.pushContent(detach);\n\t} else if (firstIndexBeyondMoveOut <= destIndex) {\n\t\t// The destination is fully after the source\n\t\tmarks.pushContent(detach);\n\t\tmarks.pushOffset(destIndex - firstIndexBeyondMoveOut);\n\t\tmarks.pushContent(attach);\n\t} else {\n\t\tconst firstSectionLength = destIndex - sourceIndex;\n\t\t// The destination is in the middle of the source\n\t\tconst [detach1, detach2] = splitMark(detach, firstSectionLength);\n\t\tmarks.pushContent(detach1);\n\t\tmarks.pushContent(attach);\n\t\tmarks.pushContent(detach2);\n\t}\n\treturn marks.list;\n}\n\nfunction markAtIndex(index: number, mark: Mark): Changeset {\n\treturn index === 0 ? [mark] : [{ count: index }, mark];\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -29,9 +29,9 @@ export type Listenable<T extends object> = EventListenable<T>;
29
29
  */
30
30
  export type Off = EventOff;
31
31
  export { TreeStatus, TreeCompressionStrategy, type TreeIndex, type TreeIndexKey, type TreeIndexNodes, } from "./feature-libraries/index.js";
32
- export { type ITreeInternal, type SharedTreeOptions, type ForestType, type SharedTreeFormatOptions, SharedTreeFormatVersion, Tree, type TransactionConstraint, type NodeInDocumentConstraint, type RunTransaction, rollback, type ForestOptions, getBranch, type BranchableTree, type TreeBranchFork, independentInitializedView, type ViewContent, TreeAlpha, independentView, type RunTransactionParams, type VoidTransactionCallbackStatus, type TransactionCallbackStatus, type TransactionResult, type TransactionResultExt, type TransactionResultSuccess, type TransactionResultFailed, ForestTypeOptimized, ForestTypeExpensiveDebug, ForestTypeReference, SharedTreeAttributes, SharedTreeFactoryType, } from "./shared-tree/index.js";
33
- export { TreeArrayNode, type Unhydrated, IterableTreeArrayContent, TreeNode, type ViewableTree, type ITree, type TreeNodeSchema, TreeViewConfiguration, type ITreeViewConfiguration, type ITreeConfigurationOptions, type TreeView, type TreeViewEvents, SchemaFactory, SchemaFactoryAlpha, type SchemaFactoryObjectOptions, type ImplicitFieldSchema, type TreeFieldFromImplicitField, type TreeChangeEvents, type NodeFromSchema, type TreeMapNode, type InsertableTreeNodeFromImplicitAllowedTypes, type TreeLeafValue, FieldKind, FieldSchema, type FieldSchemaMetadata, type ImplicitAllowedTypes, type InsertableTreeFieldFromImplicitField, type InsertableTypedNode, NodeKind, type TreeObjectNode, type TreeNodeFromImplicitAllowedTypes, type TreeNodeSchemaClass, type SchemaCompatibilityStatus, type FieldProps, type InternalTreeNode, type WithType, type NodeChangedData, type TreeNodeApi, type TreeNodeSchemaCore, type AllowedTypes, type TreeObjectNodeUnsafe, type InsertableTreeNodeFromImplicitAllowedTypesUnsafe, type TreeArrayNodeUnsafe, type TreeMapNodeUnsafe, type InsertableObjectFromSchemaRecordUnsafe, type InsertableTreeFieldFromImplicitFieldUnsafe, type FieldSchemaUnsafe, type TreeNodeSchemaClassUnsafe, type InsertableTreeNodeFromAllowedTypesUnsafe, type typeSchemaSymbol, type TreeNodeSchemaNonClass, type ValidateRecursiveSchema, type FixRecursiveArraySchema, type SimpleTreeIndex, type IdentifierIndex, createSimpleTreeIndex, createIdentifierIndex, adaptEnum, enumFromStrings, singletonSchema, type UnsafeUnknownSchema, type TreeViewAlpha, type InsertableField, type Insertable, type InsertableContent, type FactoryContent, type FactoryContentObject, type ReadableField, type ReadSchema, test_RecursiveObject, test_RecursiveObject_base, test_RecursiveObjectPojoMode, TreeBeta, type TreeChangeEventsBeta, type VerboseTreeNode, type EncodeOptions, type ParseOptions, type VerboseTree, extractPersistedSchema, comparePersistedSchema, type ConciseTree, type JsonTreeSchema, type JsonSchemaId, type JsonNodeSchema, type JsonNodeSchemaBase, type JsonLeafNodeSchema, type JsonMapNodeSchema, type JsonArrayNodeSchema, type JsonObjectNodeSchema, type JsonFieldSchema, type JsonSchemaRef, type JsonRefPath, type JsonSchemaType, type JsonLeafSchemaType, getJsonSchema, type LazyItem, type Unenforced, type SimpleNodeSchemaBase, type SimpleTreeSchema, type SimpleNodeSchema, type SimpleFieldSchema, type SimpleLeafNodeSchema, type SimpleMapNodeSchema, type SimpleArrayNodeSchema, type SimpleObjectNodeSchema, normalizeAllowedTypes, getSimpleSchema, type ReadonlyArrayNode, type InsertableTreeNodeFromAllowedTypes, type Input, type TreeBranch, type TreeBranchEvents, asTreeViewAlpha, type NodeSchemaOptions, type NodeSchemaMetadata, } from "./simple-tree/index.js";
34
- export { SharedTree, configuredSharedTree, } from "./treeFactory.js";
32
+ export { type ITreeInternal, type SharedTreeOptions, type ForestType, type SharedTreeFormatOptions, SharedTreeFormatVersion, Tree, type RunTransaction, type ForestOptions, getBranch, type BranchableTree, type TreeBranchFork, independentInitializedView, type ViewContent, TreeAlpha, independentView, ForestTypeOptimized, ForestTypeExpensiveDebug, ForestTypeReference, type IChannelView, } from "./shared-tree/index.js";
33
+ export { TreeArrayNode, type Unhydrated, IterableTreeArrayContent, TreeNode, type ViewableTree, type ITree, type TreeNodeSchema, TreeViewConfiguration, type ITreeViewConfiguration, type ITreeConfigurationOptions, type TreeView, type TreeViewEvents, SchemaFactory, SchemaFactoryAlpha, type SchemaFactoryObjectOptions, type ImplicitFieldSchema, type TreeFieldFromImplicitField, type TreeChangeEvents, type NodeFromSchema, type TreeMapNode, type InsertableTreeNodeFromImplicitAllowedTypes, type TreeLeafValue, FieldKind, FieldSchema, type FieldSchemaMetadata, type ImplicitAllowedTypes, type InsertableTreeFieldFromImplicitField, type InsertableTypedNode, NodeKind, type TreeObjectNode, type TreeNodeFromImplicitAllowedTypes, type TreeNodeSchemaClass, type SchemaCompatibilityStatus, type FieldProps, type InternalTreeNode, type WithType, type NodeChangedData, type TreeNodeApi, type TreeNodeSchemaCore, type AllowedTypes, type TreeObjectNodeUnsafe, type InsertableTreeNodeFromImplicitAllowedTypesUnsafe, type TreeArrayNodeUnsafe, type TreeMapNodeUnsafe, type InsertableObjectFromSchemaRecordUnsafe, type InsertableTreeFieldFromImplicitFieldUnsafe, type FieldSchemaUnsafe, type TreeNodeSchemaClassUnsafe, type InsertableTreeNodeFromAllowedTypesUnsafe, type typeSchemaSymbol, type TreeNodeSchemaNonClass, type ValidateRecursiveSchema, type FixRecursiveArraySchema, type SimpleTreeIndex, type IdentifierIndex, createSimpleTreeIndex, createIdentifierIndex, adaptEnum, enumFromStrings, singletonSchema, type UnsafeUnknownSchema, type TreeViewAlpha, type InsertableField, type Insertable, type InsertableContent, type FactoryContent, type FactoryContentObject, type ReadableField, type ReadSchema, test_RecursiveObject, test_RecursiveObject_base, test_RecursiveObjectPojoMode, TreeBeta, type TreeChangeEventsBeta, type VerboseTreeNode, type EncodeOptions, type ParseOptions, type VerboseTree, extractPersistedSchema, comparePersistedSchema, type ConciseTree, type JsonTreeSchema, type JsonSchemaId, type JsonNodeSchema, type JsonNodeSchemaBase, type JsonLeafNodeSchema, type JsonMapNodeSchema, type JsonArrayNodeSchema, type JsonObjectNodeSchema, type JsonFieldSchema, type JsonSchemaRef, type JsonRefPath, type JsonSchemaType, type JsonLeafSchemaType, getJsonSchema, type LazyItem, type Unenforced, type SimpleNodeSchemaBase, type SimpleTreeSchema, type SimpleNodeSchema, type SimpleFieldSchema, type SimpleLeafNodeSchema, type SimpleMapNodeSchema, type SimpleArrayNodeSchema, type SimpleObjectNodeSchema, normalizeAllowedTypes, getSimpleSchema, type ReadonlyArrayNode, type InsertableTreeNodeFromAllowedTypes, type Input, type TreeBranch, type TreeBranchEvents, asTreeViewAlpha, type NodeSchemaOptions, type NodeSchemaMetadata, type schemaStatics, type ITreeAlpha, type TransactionConstraint, type NodeInDocumentConstraint, type RunTransactionParams, type VoidTransactionCallbackStatus, type TransactionCallbackStatus, type TransactionResult, type TransactionResultExt, type TransactionResultSuccess, type TransactionResultFailed, rollback, } from "./simple-tree/index.js";
34
+ export { SharedTree, configuredSharedTree, SharedTreeAttributes, SharedTreeFactoryType, } from "./treeFactory.js";
35
35
  export { type ICodecOptions, type JsonValidator, type SchemaValidationFunction, FluidClientVersion, } from "./codec/index.js";
36
36
  export { noopValidator } from "./codec/index.js";
37
37
  export { typeboxValidator } from "./external-utilities/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,EACX,KAAK,UAAU,EACf,UAAU,EACV,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,GACpB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EACX,SAAS,IAAI,cAAc,EAC3B,UAAU,IAAI,eAAe,EAC7B,UAAU,IAAI,eAAe,EAC7B,GAAG,IAAI,QAAQ,EACf,MAAM,iCAAiC,CAAC;AAEzC;;;;GAIG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC;AAC5D;;;;GAIG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC;AAC/C;;;;GAIG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC;AAC9D;;;;GAIG;AACH,MAAM,MAAM,GAAG,GAAG,QAAQ,CAAC;AAE3B,OAAO,EACN,UAAU,EACV,uBAAuB,EACvB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,cAAc,GACnB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,KAAK,uBAAuB,EAC5B,uBAAuB,EACvB,IAAI,EACJ,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,QAAQ,EACR,KAAK,aAAa,EAClB,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,cAAc,E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  export { ValueSchema, CommitKind, RevertibleStatus, } from "./core/index.js";
6
6
  export { TreeStatus, TreeCompressionStrategy, } from "./feature-libraries/index.js";
7
- export { SharedTreeFormatVersion, Tree, rollback, getBranch, independentInitializedView, TreeAlpha, independentView, ForestTypeOptimized, ForestTypeExpensiveDebug, ForestTypeReference, SharedTreeAttributes, SharedTreeFactoryType, } from "./shared-tree/index.js";
7
+ export { SharedTreeFormatVersion, Tree, getBranch, independentInitializedView, TreeAlpha, independentView, ForestTypeOptimized, ForestTypeExpensiveDebug, ForestTypeReference, } from "./shared-tree/index.js";
8
8
  export { TreeArrayNode, IterableTreeArrayContent, TreeViewConfiguration, SchemaFactory, SchemaFactoryAlpha, FieldKind, FieldSchema, NodeKind, createSimpleTreeIndex, createIdentifierIndex,
9
9
  // experimental @alpha APIs:
10
10
  adaptEnum, enumFromStrings, singletonSchema,
11
11
  // test recursive schema for checking that d.ts files handles schema correctly
12
12
  test_RecursiveObject, test_RecursiveObject_base, test_RecursiveObjectPojoMode,
13
13
  // Beta APIs
14
- TreeBeta, extractPersistedSchema, comparePersistedSchema, getJsonSchema, normalizeAllowedTypes, getSimpleSchema, asTreeViewAlpha, } from "./simple-tree/index.js";
15
- export { SharedTree, configuredSharedTree, } from "./treeFactory.js";
14
+ TreeBeta, extractPersistedSchema, comparePersistedSchema, getJsonSchema, normalizeAllowedTypes, getSimpleSchema, asTreeViewAlpha, rollback, } from "./simple-tree/index.js";
15
+ export { SharedTree, configuredSharedTree, SharedTreeAttributes, SharedTreeFactoryType, } from "./treeFactory.js";
16
16
  export { FluidClientVersion, } from "./codec/index.js";
17
17
  export { noopValidator } from "./codec/index.js";
18
18
  export { typeboxValidator } from "./external-utilities/index.js";