@fluidframework/tree 2.90.0 → 2.92.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1006) hide show
  1. package/CHANGELOG.md +365 -0
  2. package/alpha.d.ts +2 -2
  3. package/api-extractor/api-extractor-lint-alpha.cjs.json +1 -1
  4. package/api-extractor/api-extractor-lint-alpha.esm.json +1 -1
  5. package/api-extractor/api-extractor-lint-beta.cjs.json +1 -1
  6. package/api-extractor/api-extractor-lint-beta.esm.json +1 -1
  7. package/api-extractor/api-extractor-lint-bundle.json +1 -1
  8. package/api-extractor/api-extractor-lint-legacy.cjs.json +1 -1
  9. package/api-extractor/api-extractor-lint-legacy.esm.json +1 -1
  10. package/api-extractor/api-extractor-lint-public.cjs.json +1 -1
  11. package/api-extractor/api-extractor-lint-public.esm.json +1 -1
  12. package/api-extractor/api-extractor.current.json +1 -1
  13. package/api-extractor/api-extractor.legacy.json +2 -1
  14. package/api-extractor.json +1 -0
  15. package/api-report/tree.alpha.api.md +141 -37
  16. package/beta.d.ts +2 -2
  17. package/dist/api.d.ts +6 -1
  18. package/dist/api.d.ts.map +1 -1
  19. package/dist/api.js.map +1 -1
  20. package/dist/codec/codec.d.ts +28 -2
  21. package/dist/codec/codec.d.ts.map +1 -1
  22. package/dist/codec/codec.js +1 -0
  23. package/dist/codec/codec.js.map +1 -1
  24. package/dist/codec/index.d.ts +2 -2
  25. package/dist/codec/index.d.ts.map +1 -1
  26. package/dist/codec/index.js +2 -4
  27. package/dist/codec/index.js.map +1 -1
  28. package/dist/codec/versioned/codec.d.ts +18 -36
  29. package/dist/codec/versioned/codec.d.ts.map +1 -1
  30. package/dist/codec/versioned/codec.js +46 -59
  31. package/dist/codec/versioned/codec.js.map +1 -1
  32. package/dist/codec/versioned/index.d.ts +1 -1
  33. package/dist/codec/versioned/index.d.ts.map +1 -1
  34. package/dist/codec/versioned/index.js +2 -4
  35. package/dist/codec/versioned/index.js.map +1 -1
  36. package/dist/core/forest/forest.d.ts +5 -2
  37. package/dist/core/forest/forest.d.ts.map +1 -1
  38. package/dist/core/forest/forest.js.map +1 -1
  39. package/dist/core/index.d.ts +1 -1
  40. package/dist/core/index.d.ts.map +1 -1
  41. package/dist/core/index.js +6 -2
  42. package/dist/core/index.js.map +1 -1
  43. package/dist/core/rebase/changeRebaser.d.ts +8 -1
  44. package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
  45. package/dist/core/rebase/changeRebaser.js.map +1 -1
  46. package/dist/core/rebase/revisionTagCodec.d.ts +4 -3
  47. package/dist/core/rebase/revisionTagCodec.d.ts.map +1 -1
  48. package/dist/core/rebase/revisionTagCodec.js +2 -0
  49. package/dist/core/rebase/revisionTagCodec.js.map +1 -1
  50. package/dist/core/rebase/utils.d.ts +2 -2
  51. package/dist/core/rebase/utils.d.ts.map +1 -1
  52. package/dist/core/rebase/utils.js +4 -4
  53. package/dist/core/rebase/utils.js.map +1 -1
  54. package/dist/core/schema-stored/formatV2.d.ts +1 -1
  55. package/dist/core/schema-stored/formatV2.js +1 -1
  56. package/dist/core/schema-stored/formatV2.js.map +1 -1
  57. package/dist/core/tree/anchorSet.d.ts +8 -0
  58. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  59. package/dist/core/tree/anchorSet.js +42 -7
  60. package/dist/core/tree/anchorSet.js.map +1 -1
  61. package/dist/core/tree/cursor.d.ts +25 -1
  62. package/dist/core/tree/cursor.d.ts.map +1 -1
  63. package/dist/core/tree/cursor.js +45 -1
  64. package/dist/core/tree/cursor.js.map +1 -1
  65. package/dist/core/tree/deltaUtil.d.ts +13 -1
  66. package/dist/core/tree/deltaUtil.d.ts.map +1 -1
  67. package/dist/core/tree/deltaUtil.js +34 -1
  68. package/dist/core/tree/deltaUtil.js.map +1 -1
  69. package/dist/core/tree/detachedFieldIndexCodecs.d.ts +5 -5
  70. package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  71. package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  72. package/dist/core/tree/index.d.ts +2 -2
  73. package/dist/core/tree/index.d.ts.map +1 -1
  74. package/dist/core/tree/index.js +6 -2
  75. package/dist/core/tree/index.js.map +1 -1
  76. package/dist/core/tree/visitDelta.d.ts +11 -0
  77. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  78. package/dist/core/tree/visitDelta.js +1 -1
  79. package/dist/core/tree/visitDelta.js.map +1 -1
  80. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  81. package/dist/core/tree/visitorUtils.js +5 -0
  82. package/dist/core/tree/visitorUtils.js.map +1 -1
  83. package/dist/entrypoints/alpha.d.ts +6 -0
  84. package/dist/entrypoints/alpha.d.ts.map +1 -0
  85. package/dist/entrypoints/alpha.js +91 -0
  86. package/dist/entrypoints/alpha.js.map +1 -0
  87. package/dist/entrypoints/beta.d.ts +6 -0
  88. package/dist/entrypoints/beta.d.ts.map +1 -0
  89. package/dist/entrypoints/beta.js +43 -0
  90. package/dist/entrypoints/beta.js.map +1 -0
  91. package/dist/entrypoints/internal.d.ts +6 -0
  92. package/dist/entrypoints/internal.d.ts.map +1 -0
  93. package/dist/entrypoints/internal.js +28 -0
  94. package/dist/entrypoints/internal.js.map +1 -0
  95. package/dist/entrypoints/legacy.d.ts +6 -0
  96. package/dist/entrypoints/legacy.d.ts.map +1 -0
  97. package/dist/entrypoints/legacy.js +49 -0
  98. package/dist/entrypoints/legacy.js.map +1 -0
  99. package/dist/entrypoints/public.d.ts +6 -0
  100. package/dist/entrypoints/public.d.ts.map +1 -0
  101. package/dist/entrypoints/public.js +27 -0
  102. package/dist/entrypoints/public.js.map +1 -0
  103. package/dist/feature-libraries/changeAtomIdCodec.d.ts +4 -3
  104. package/dist/feature-libraries/changeAtomIdCodec.d.ts.map +1 -1
  105. package/dist/feature-libraries/changeAtomIdCodec.js +2 -0
  106. package/dist/feature-libraries/changeAtomIdCodec.js.map +1 -1
  107. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +2 -1
  108. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  109. package/dist/feature-libraries/chunked-forest/chunkedForest.js +2 -2
  110. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  111. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +4 -4
  112. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  113. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +6 -6
  114. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  115. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
  116. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  117. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  118. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +1 -2
  119. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  120. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  121. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -4
  122. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  123. package/dist/feature-libraries/chunked-forest/codec/codecs.js +6 -6
  124. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  125. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +12 -12
  126. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  127. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +3 -3
  128. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  129. package/dist/feature-libraries/chunked-forest/codec/{formatGeneric.d.ts → format/formatGeneric.d.ts} +1 -1
  130. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -0
  131. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -0
  132. package/dist/feature-libraries/chunked-forest/codec/format/formatV1.d.ts +187 -0
  133. package/dist/feature-libraries/chunked-forest/codec/format/formatV1.d.ts.map +1 -0
  134. package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js +115 -0
  135. package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -0
  136. package/dist/feature-libraries/chunked-forest/codec/format/formatV2.d.ts +33 -0
  137. package/dist/feature-libraries/chunked-forest/codec/format/formatV2.d.ts.map +1 -0
  138. package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js +16 -0
  139. package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -0
  140. package/dist/feature-libraries/chunked-forest/codec/format/index.d.ts +10 -0
  141. package/dist/feature-libraries/chunked-forest/codec/format/index.d.ts.map +1 -0
  142. package/dist/feature-libraries/chunked-forest/codec/format/index.js +18 -0
  143. package/dist/feature-libraries/chunked-forest/codec/format/index.js.map +1 -0
  144. package/dist/feature-libraries/chunked-forest/codec/format/versions.d.ts +93 -0
  145. package/dist/feature-libraries/chunked-forest/codec/format/versions.d.ts.map +1 -0
  146. package/dist/feature-libraries/chunked-forest/codec/format/versions.js +29 -0
  147. package/dist/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -0
  148. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
  149. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  150. package/dist/feature-libraries/chunked-forest/codec/index.js +2 -2
  151. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  152. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +7 -7
  153. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
  154. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
  155. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
  156. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  157. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +6 -4
  158. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  159. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +1 -1
  160. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  161. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +3 -3
  162. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  163. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  164. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  165. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  166. package/dist/feature-libraries/cursorComparator.d.ts +23 -0
  167. package/dist/feature-libraries/cursorComparator.d.ts.map +1 -0
  168. package/dist/feature-libraries/cursorComparator.js +65 -0
  169. package/dist/feature-libraries/cursorComparator.js.map +1 -0
  170. package/dist/feature-libraries/forest-summary/codec.d.ts +1 -1
  171. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +3 -3
  172. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  173. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  174. package/dist/feature-libraries/index.d.ts +3 -2
  175. package/dist/feature-libraries/index.d.ts.map +1 -1
  176. package/dist/feature-libraries/index.js +5 -5
  177. package/dist/feature-libraries/index.js.map +1 -1
  178. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +2 -0
  179. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  180. package/dist/feature-libraries/indexing/anchorTreeIndex.js +12 -7
  181. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  182. package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  183. package/dist/feature-libraries/mitigatedChangeFamily.js +2 -2
  184. package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  185. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +3 -3
  186. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  187. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  188. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +1 -0
  189. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -1
  190. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js +14 -6
  191. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
  192. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +3 -3
  193. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  194. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  195. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  196. package/dist/feature-libraries/modular-schema/genericFieldKind.js +0 -1
  197. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  198. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +10 -10
  199. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  200. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +2 -4
  201. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  202. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +3 -3
  203. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
  204. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
  205. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +3 -3
  206. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  207. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  208. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -1
  209. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  210. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +11 -6
  211. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  212. package/dist/feature-libraries/object-forest/objectForest.d.ts +1 -1
  213. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  214. package/dist/feature-libraries/object-forest/objectForest.js +2 -2
  215. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  216. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +4 -4
  217. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
  218. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
  219. package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts +3 -3
  220. package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  221. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  222. package/dist/feature-libraries/schema-edits/index.d.ts +1 -1
  223. package/dist/feature-libraries/schema-edits/index.d.ts.map +1 -1
  224. package/dist/feature-libraries/schema-edits/index.js +2 -3
  225. package/dist/feature-libraries/schema-edits/index.js.map +1 -1
  226. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -15
  227. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  228. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +8 -54
  229. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  230. package/dist/feature-libraries/schema-index/codec.d.ts +3 -16
  231. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  232. package/dist/feature-libraries/schema-index/codec.js +1 -21
  233. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  234. package/dist/feature-libraries/schema-index/formatV2.d.ts +1 -1
  235. package/dist/feature-libraries/schema-index/formatV2.js +1 -1
  236. package/dist/feature-libraries/schema-index/formatV2.js.map +1 -1
  237. package/dist/feature-libraries/schema-index/index.d.ts +1 -1
  238. package/dist/feature-libraries/schema-index/index.d.ts.map +1 -1
  239. package/dist/feature-libraries/schema-index/index.js +1 -2
  240. package/dist/feature-libraries/schema-index/index.js.map +1 -1
  241. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +1 -1
  242. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  243. package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  244. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -4
  245. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  246. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  247. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +3 -3
  248. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  249. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  250. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +3 -3
  251. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  252. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  253. package/dist/index.d.ts +8 -2
  254. package/dist/index.d.ts.map +1 -1
  255. package/dist/index.js +4 -3
  256. package/dist/index.js.map +1 -1
  257. package/dist/packageVersion.d.ts +1 -1
  258. package/dist/packageVersion.js +1 -1
  259. package/dist/packageVersion.js.map +1 -1
  260. package/dist/shared-tree/independentView.d.ts +1 -1
  261. package/dist/shared-tree/independentView.d.ts.map +1 -1
  262. package/dist/shared-tree/independentView.js +14 -21
  263. package/dist/shared-tree/independentView.js.map +1 -1
  264. package/dist/shared-tree/index.d.ts +2 -2
  265. package/dist/shared-tree/index.d.ts.map +1 -1
  266. package/dist/shared-tree/index.js +1 -2
  267. package/dist/shared-tree/index.js.map +1 -1
  268. package/dist/shared-tree/schematizingTreeView.d.ts +2 -36
  269. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  270. package/dist/shared-tree/schematizingTreeView.js +15 -117
  271. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  272. package/dist/shared-tree/sharedTree.d.ts +3 -22
  273. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  274. package/dist/shared-tree/sharedTree.js +10 -27
  275. package/dist/shared-tree/sharedTree.js.map +1 -1
  276. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +3 -2
  277. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  278. package/dist/shared-tree/sharedTreeChangeCodecs.js +23 -16
  279. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  280. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  281. package/dist/shared-tree/sharedTreeChangeEnricher.js +1 -1
  282. package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  283. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +1 -1
  284. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  285. package/dist/shared-tree/sharedTreeChangeFamily.js +2 -2
  286. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  287. package/dist/shared-tree/sharedTreeChangeFormat.d.ts +8 -7
  288. package/dist/shared-tree/sharedTreeChangeFormat.d.ts.map +1 -1
  289. package/dist/shared-tree/sharedTreeChangeFormat.js +13 -5
  290. package/dist/shared-tree/sharedTreeChangeFormat.js.map +1 -1
  291. package/dist/shared-tree/tree.d.ts.map +1 -1
  292. package/dist/shared-tree/tree.js +2 -1
  293. package/dist/shared-tree/tree.js.map +1 -1
  294. package/dist/shared-tree/treeAlpha.d.ts +13 -1
  295. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  296. package/dist/shared-tree/treeAlpha.js +3 -0
  297. package/dist/shared-tree/treeAlpha.js.map +1 -1
  298. package/dist/shared-tree/treeCheckout.d.ts +34 -69
  299. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  300. package/dist/shared-tree/treeCheckout.js +885 -677
  301. package/dist/shared-tree/treeCheckout.js.map +1 -1
  302. package/dist/shared-tree/unhydratedTreeContext.js +3 -3
  303. package/dist/shared-tree/unhydratedTreeContext.js.map +1 -1
  304. package/dist/shared-tree-core/editManagerCodecs.d.ts +23 -12
  305. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  306. package/dist/shared-tree-core/editManagerCodecs.js +40 -67
  307. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  308. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  309. package/dist/shared-tree-core/editManagerCodecsCommons.js +0 -1
  310. package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  311. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +10 -2
  312. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  313. package/dist/shared-tree-core/editManagerCodecsV1toV4.js +18 -13
  314. package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  315. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +2 -2
  316. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  317. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js +6 -9
  318. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  319. package/dist/shared-tree-core/index.d.ts +3 -3
  320. package/dist/shared-tree-core/index.d.ts.map +1 -1
  321. package/dist/shared-tree-core/index.js +5 -8
  322. package/dist/shared-tree-core/index.js.map +1 -1
  323. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +2 -3
  324. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  325. package/dist/shared-tree-core/messageCodecV1ToV4.js +8 -8
  326. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  327. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts +2 -3
  328. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  329. package/dist/shared-tree-core/messageCodecVSharedBranches.js +5 -4
  330. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  331. package/dist/shared-tree-core/messageCodecs.d.ts +15 -14
  332. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  333. package/dist/shared-tree-core/messageCodecs.js +38 -74
  334. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  335. package/dist/shared-tree-core/messageFormat.d.ts +0 -1
  336. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
  337. package/dist/shared-tree-core/messageFormat.js +1 -2
  338. package/dist/shared-tree-core/messageFormat.js.map +1 -1
  339. package/dist/shared-tree-core/sharedTreeCore.d.ts +1 -3
  340. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  341. package/dist/shared-tree-core/sharedTreeCore.js +12 -2
  342. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  343. package/dist/sharedTreeAttributes.d.ts.map +1 -1
  344. package/dist/sharedTreeAttributes.js +3 -0
  345. package/dist/sharedTreeAttributes.js.map +1 -1
  346. package/dist/simple-tree/api/eraseSchemaDetails.d.ts +43 -0
  347. package/dist/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -1
  348. package/dist/simple-tree/api/eraseSchemaDetails.js.map +1 -1
  349. package/dist/simple-tree/api/index.d.ts +4 -2
  350. package/dist/simple-tree/api/index.d.ts.map +1 -1
  351. package/dist/simple-tree/api/index.js.map +1 -1
  352. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  353. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  354. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +126 -29
  355. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  356. package/dist/simple-tree/api/schemaFactoryAlpha.js +72 -7
  357. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  358. package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  359. package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  360. package/dist/simple-tree/api/schemaStatics.d.ts +10 -11
  361. package/dist/simple-tree/api/schemaStatics.d.ts.map +1 -1
  362. package/dist/simple-tree/api/schemaStatics.js +13 -7
  363. package/dist/simple-tree/api/schemaStatics.js.map +1 -1
  364. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  365. package/dist/simple-tree/api/storedSchema.js +6 -6
  366. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  367. package/dist/simple-tree/api/tree.d.ts +7 -19
  368. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  369. package/dist/simple-tree/api/tree.js.map +1 -1
  370. package/dist/simple-tree/api/treeAlpha.d.ts +69 -0
  371. package/dist/simple-tree/api/treeAlpha.d.ts.map +1 -0
  372. package/dist/simple-tree/api/treeAlpha.js +7 -0
  373. package/dist/simple-tree/api/treeAlpha.js.map +1 -0
  374. package/dist/simple-tree/api/treeBeta.d.ts +1 -1
  375. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  376. package/dist/simple-tree/api/treeChangeEvents.d.ts +3 -0
  377. package/dist/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
  378. package/dist/simple-tree/api/treeChangeEvents.js.map +1 -1
  379. package/dist/simple-tree/api/treeNodeApi.d.ts +49 -0
  380. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  381. package/dist/simple-tree/api/treeNodeApi.js +41 -2
  382. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  383. package/dist/simple-tree/api/typesUnsafe.d.ts +23 -2
  384. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  385. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  386. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  387. package/dist/simple-tree/core/treeNodeKernel.js +45 -8
  388. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  389. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  390. package/dist/simple-tree/core/unhydratedFlexTree.js +5 -1
  391. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  392. package/dist/simple-tree/fieldSchema.d.ts +3 -2
  393. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  394. package/dist/simple-tree/fieldSchema.js +3 -4
  395. package/dist/simple-tree/fieldSchema.js.map +1 -1
  396. package/dist/simple-tree/index.d.ts +2 -2
  397. package/dist/simple-tree/index.d.ts.map +1 -1
  398. package/dist/simple-tree/index.js.map +1 -1
  399. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +16 -0
  400. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  401. package/dist/simple-tree/node-kinds/array/arrayNode.js +23 -0
  402. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  403. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +10 -1
  404. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  405. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  406. package/dist/simple-tree/node-kinds/array/index.d.ts +2 -2
  407. package/dist/simple-tree/node-kinds/array/index.d.ts.map +1 -1
  408. package/dist/simple-tree/node-kinds/array/index.js.map +1 -1
  409. package/dist/simple-tree/node-kinds/index.d.ts +2 -2
  410. package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
  411. package/dist/simple-tree/node-kinds/index.js.map +1 -1
  412. package/dist/simple-tree/node-kinds/object/index.d.ts +2 -2
  413. package/dist/simple-tree/node-kinds/object/index.d.ts.map +1 -1
  414. package/dist/simple-tree/node-kinds/object/index.js.map +1 -1
  415. package/dist/simple-tree/node-kinds/object/objectNode.d.ts +43 -7
  416. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  417. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  418. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +26 -2
  419. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  420. package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  421. package/dist/text/textDomainFormatted.d.ts +321 -13
  422. package/dist/text/textDomainFormatted.d.ts.map +1 -1
  423. package/dist/text/textDomainFormatted.js +100 -25
  424. package/dist/text/textDomainFormatted.js.map +1 -1
  425. package/dist/treeFactory.d.ts.map +1 -1
  426. package/dist/treeFactory.js +5 -2
  427. package/dist/treeFactory.js.map +1 -1
  428. package/dist/util/rangeMap.d.ts +25 -18
  429. package/dist/util/rangeMap.d.ts.map +1 -1
  430. package/dist/util/rangeMap.js +24 -30
  431. package/dist/util/rangeMap.js.map +1 -1
  432. package/dist/util/referenceCounting.d.ts.map +1 -1
  433. package/dist/util/referenceCounting.js +0 -1
  434. package/dist/util/referenceCounting.js.map +1 -1
  435. package/dist/util/typeCheck.d.ts.map +1 -1
  436. package/dist/util/typeCheck.js.map +1 -1
  437. package/dist/util/typeUtils.d.ts.map +1 -1
  438. package/dist/util/typeUtils.js.map +1 -1
  439. package/eslint.config.mts +10 -2
  440. package/internal.d.ts +2 -2
  441. package/legacy.d.ts +2 -2
  442. package/lib/api.d.ts +6 -1
  443. package/lib/api.d.ts.map +1 -1
  444. package/lib/api.js.map +1 -1
  445. package/lib/codec/codec.d.ts +28 -2
  446. package/lib/codec/codec.d.ts.map +1 -1
  447. package/lib/codec/codec.js +1 -0
  448. package/lib/codec/codec.js.map +1 -1
  449. package/lib/codec/index.d.ts +2 -2
  450. package/lib/codec/index.d.ts.map +1 -1
  451. package/lib/codec/index.js +1 -1
  452. package/lib/codec/index.js.map +1 -1
  453. package/lib/codec/versioned/codec.d.ts +18 -36
  454. package/lib/codec/versioned/codec.d.ts.map +1 -1
  455. package/lib/codec/versioned/codec.js +45 -56
  456. package/lib/codec/versioned/codec.js.map +1 -1
  457. package/lib/codec/versioned/index.d.ts +1 -1
  458. package/lib/codec/versioned/index.d.ts.map +1 -1
  459. package/lib/codec/versioned/index.js +1 -1
  460. package/lib/codec/versioned/index.js.map +1 -1
  461. package/lib/core/forest/forest.d.ts +5 -2
  462. package/lib/core/forest/forest.d.ts.map +1 -1
  463. package/lib/core/forest/forest.js.map +1 -1
  464. package/lib/core/index.d.ts +1 -1
  465. package/lib/core/index.d.ts.map +1 -1
  466. package/lib/core/index.js +1 -1
  467. package/lib/core/index.js.map +1 -1
  468. package/lib/core/rebase/changeRebaser.d.ts +8 -1
  469. package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
  470. package/lib/core/rebase/changeRebaser.js.map +1 -1
  471. package/lib/core/rebase/revisionTagCodec.d.ts +4 -3
  472. package/lib/core/rebase/revisionTagCodec.d.ts.map +1 -1
  473. package/lib/core/rebase/revisionTagCodec.js +2 -0
  474. package/lib/core/rebase/revisionTagCodec.js.map +1 -1
  475. package/lib/core/rebase/utils.d.ts +2 -2
  476. package/lib/core/rebase/utils.d.ts.map +1 -1
  477. package/lib/core/rebase/utils.js +4 -4
  478. package/lib/core/rebase/utils.js.map +1 -1
  479. package/lib/core/schema-stored/formatV2.d.ts +1 -1
  480. package/lib/core/schema-stored/formatV2.js +1 -1
  481. package/lib/core/schema-stored/formatV2.js.map +1 -1
  482. package/lib/core/tree/anchorSet.d.ts +8 -0
  483. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  484. package/lib/core/tree/anchorSet.js +42 -7
  485. package/lib/core/tree/anchorSet.js.map +1 -1
  486. package/lib/core/tree/cursor.d.ts +25 -1
  487. package/lib/core/tree/cursor.d.ts.map +1 -1
  488. package/lib/core/tree/cursor.js +43 -0
  489. package/lib/core/tree/cursor.js.map +1 -1
  490. package/lib/core/tree/deltaUtil.d.ts +13 -1
  491. package/lib/core/tree/deltaUtil.d.ts.map +1 -1
  492. package/lib/core/tree/deltaUtil.js +31 -0
  493. package/lib/core/tree/deltaUtil.js.map +1 -1
  494. package/lib/core/tree/detachedFieldIndexCodecs.d.ts +5 -5
  495. package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  496. package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  497. package/lib/core/tree/index.d.ts +2 -2
  498. package/lib/core/tree/index.d.ts.map +1 -1
  499. package/lib/core/tree/index.js +2 -2
  500. package/lib/core/tree/index.js.map +1 -1
  501. package/lib/core/tree/visitDelta.d.ts +11 -0
  502. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  503. package/lib/core/tree/visitDelta.js +1 -1
  504. package/lib/core/tree/visitDelta.js.map +1 -1
  505. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  506. package/lib/core/tree/visitorUtils.js +5 -0
  507. package/lib/core/tree/visitorUtils.js.map +1 -1
  508. package/lib/entrypoints/alpha.d.ts +6 -0
  509. package/lib/entrypoints/alpha.d.ts.map +1 -0
  510. package/lib/entrypoints/alpha.js +12 -0
  511. package/lib/entrypoints/alpha.js.map +1 -0
  512. package/lib/entrypoints/beta.d.ts +6 -0
  513. package/lib/entrypoints/beta.d.ts.map +1 -0
  514. package/lib/entrypoints/beta.js +12 -0
  515. package/lib/entrypoints/beta.js.map +1 -0
  516. package/lib/entrypoints/internal.d.ts +6 -0
  517. package/lib/entrypoints/internal.d.ts.map +1 -0
  518. package/lib/entrypoints/internal.js +12 -0
  519. package/lib/entrypoints/internal.js.map +1 -0
  520. package/lib/entrypoints/legacy.d.ts +6 -0
  521. package/lib/entrypoints/legacy.d.ts.map +1 -0
  522. package/lib/entrypoints/legacy.js +15 -0
  523. package/lib/entrypoints/legacy.js.map +1 -0
  524. package/lib/entrypoints/public.d.ts +6 -0
  525. package/lib/entrypoints/public.d.ts.map +1 -0
  526. package/lib/entrypoints/public.js +10 -0
  527. package/lib/entrypoints/public.js.map +1 -0
  528. package/lib/feature-libraries/changeAtomIdCodec.d.ts +4 -3
  529. package/lib/feature-libraries/changeAtomIdCodec.d.ts.map +1 -1
  530. package/lib/feature-libraries/changeAtomIdCodec.js +2 -0
  531. package/lib/feature-libraries/changeAtomIdCodec.js.map +1 -1
  532. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +2 -1
  533. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  534. package/lib/feature-libraries/chunked-forest/chunkedForest.js +2 -2
  535. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  536. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +4 -4
  537. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  538. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +4 -4
  539. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  540. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
  541. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  542. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  543. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +1 -2
  544. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  545. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  546. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -4
  547. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  548. package/lib/feature-libraries/chunked-forest/codec/codecs.js +1 -1
  549. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  550. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +12 -12
  551. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  552. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
  553. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  554. package/lib/feature-libraries/chunked-forest/codec/{formatGeneric.d.ts → format/formatGeneric.d.ts} +1 -1
  555. package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -0
  556. package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -0
  557. package/lib/feature-libraries/chunked-forest/codec/format/formatV1.d.ts +187 -0
  558. package/lib/feature-libraries/chunked-forest/codec/format/formatV1.d.ts.map +1 -0
  559. package/lib/feature-libraries/chunked-forest/codec/format/formatV1.js +112 -0
  560. package/lib/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -0
  561. package/lib/feature-libraries/chunked-forest/codec/format/formatV2.d.ts +33 -0
  562. package/lib/feature-libraries/chunked-forest/codec/format/formatV2.d.ts.map +1 -0
  563. package/lib/feature-libraries/chunked-forest/codec/format/formatV2.js +13 -0
  564. package/lib/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -0
  565. package/lib/feature-libraries/chunked-forest/codec/format/index.d.ts +10 -0
  566. package/lib/feature-libraries/chunked-forest/codec/format/index.d.ts.map +1 -0
  567. package/lib/feature-libraries/chunked-forest/codec/format/index.js +8 -0
  568. package/lib/feature-libraries/chunked-forest/codec/format/index.js.map +1 -0
  569. package/lib/feature-libraries/chunked-forest/codec/format/versions.d.ts +93 -0
  570. package/lib/feature-libraries/chunked-forest/codec/format/versions.d.ts.map +1 -0
  571. package/lib/feature-libraries/chunked-forest/codec/format/versions.js +26 -0
  572. package/lib/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -0
  573. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
  574. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  575. package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
  576. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  577. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +7 -7
  578. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
  579. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
  580. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
  581. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  582. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +4 -2
  583. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  584. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +1 -1
  585. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  586. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js +1 -1
  587. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  588. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  589. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  590. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  591. package/lib/feature-libraries/cursorComparator.d.ts +23 -0
  592. package/lib/feature-libraries/cursorComparator.d.ts.map +1 -0
  593. package/lib/feature-libraries/cursorComparator.js +61 -0
  594. package/lib/feature-libraries/cursorComparator.js.map +1 -0
  595. package/lib/feature-libraries/forest-summary/codec.d.ts +1 -1
  596. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +3 -3
  597. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  598. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  599. package/lib/feature-libraries/index.d.ts +3 -2
  600. package/lib/feature-libraries/index.d.ts.map +1 -1
  601. package/lib/feature-libraries/index.js +3 -2
  602. package/lib/feature-libraries/index.js.map +1 -1
  603. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +2 -0
  604. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  605. package/lib/feature-libraries/indexing/anchorTreeIndex.js +12 -7
  606. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  607. package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  608. package/lib/feature-libraries/mitigatedChangeFamily.js +2 -2
  609. package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  610. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +3 -3
  611. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  612. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  613. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +1 -0
  614. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -1
  615. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js +14 -6
  616. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
  617. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +3 -3
  618. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  619. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  620. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  621. package/lib/feature-libraries/modular-schema/genericFieldKind.js +0 -1
  622. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  623. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +10 -10
  624. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  625. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +2 -4
  626. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  627. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +3 -3
  628. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
  629. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
  630. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +3 -3
  631. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  632. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  633. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -1
  634. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  635. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +11 -6
  636. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  637. package/lib/feature-libraries/object-forest/objectForest.d.ts +1 -1
  638. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  639. package/lib/feature-libraries/object-forest/objectForest.js +2 -2
  640. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  641. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +4 -4
  642. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
  643. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js +1 -1
  644. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
  645. package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts +3 -3
  646. package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  647. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  648. package/lib/feature-libraries/schema-edits/index.d.ts +1 -1
  649. package/lib/feature-libraries/schema-edits/index.d.ts.map +1 -1
  650. package/lib/feature-libraries/schema-edits/index.js +1 -1
  651. package/lib/feature-libraries/schema-edits/index.js.map +1 -1
  652. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -15
  653. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  654. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +6 -50
  655. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  656. package/lib/feature-libraries/schema-index/codec.d.ts +3 -16
  657. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  658. package/lib/feature-libraries/schema-index/codec.js +0 -19
  659. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  660. package/lib/feature-libraries/schema-index/formatV2.d.ts +1 -1
  661. package/lib/feature-libraries/schema-index/formatV2.js +1 -1
  662. package/lib/feature-libraries/schema-index/formatV2.js.map +1 -1
  663. package/lib/feature-libraries/schema-index/index.d.ts +1 -1
  664. package/lib/feature-libraries/schema-index/index.d.ts.map +1 -1
  665. package/lib/feature-libraries/schema-index/index.js +1 -1
  666. package/lib/feature-libraries/schema-index/index.js.map +1 -1
  667. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +1 -1
  668. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  669. package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  670. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -4
  671. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  672. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  673. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +3 -3
  674. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  675. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +1 -1
  676. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  677. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +3 -3
  678. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  679. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  680. package/lib/index.d.ts +8 -2
  681. package/lib/index.d.ts.map +1 -1
  682. package/lib/index.js +9 -1
  683. package/lib/index.js.map +1 -1
  684. package/lib/packageVersion.d.ts +1 -1
  685. package/lib/packageVersion.js +1 -1
  686. package/lib/packageVersion.js.map +1 -1
  687. package/lib/shared-tree/independentView.d.ts +1 -1
  688. package/lib/shared-tree/independentView.d.ts.map +1 -1
  689. package/lib/shared-tree/independentView.js +4 -11
  690. package/lib/shared-tree/independentView.js.map +1 -1
  691. package/lib/shared-tree/index.d.ts +2 -2
  692. package/lib/shared-tree/index.d.ts.map +1 -1
  693. package/lib/shared-tree/index.js +1 -1
  694. package/lib/shared-tree/index.js.map +1 -1
  695. package/lib/shared-tree/schematizingTreeView.d.ts +2 -36
  696. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  697. package/lib/shared-tree/schematizingTreeView.js +17 -116
  698. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  699. package/lib/shared-tree/sharedTree.d.ts +3 -22
  700. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  701. package/lib/shared-tree/sharedTree.js +11 -27
  702. package/lib/shared-tree/sharedTree.js.map +1 -1
  703. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +3 -2
  704. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  705. package/lib/shared-tree/sharedTreeChangeCodecs.js +19 -12
  706. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  707. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  708. package/lib/shared-tree/sharedTreeChangeEnricher.js +2 -2
  709. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  710. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +1 -1
  711. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  712. package/lib/shared-tree/sharedTreeChangeFamily.js +2 -2
  713. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  714. package/lib/shared-tree/sharedTreeChangeFormat.d.ts +8 -7
  715. package/lib/shared-tree/sharedTreeChangeFormat.d.ts.map +1 -1
  716. package/lib/shared-tree/sharedTreeChangeFormat.js +11 -5
  717. package/lib/shared-tree/sharedTreeChangeFormat.js.map +1 -1
  718. package/lib/shared-tree/tree.d.ts.map +1 -1
  719. package/lib/shared-tree/tree.js +2 -1
  720. package/lib/shared-tree/tree.js.map +1 -1
  721. package/lib/shared-tree/treeAlpha.d.ts +13 -1
  722. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  723. package/lib/shared-tree/treeAlpha.js +3 -0
  724. package/lib/shared-tree/treeAlpha.js.map +1 -1
  725. package/lib/shared-tree/treeCheckout.d.ts +34 -69
  726. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  727. package/lib/shared-tree/treeCheckout.js +889 -682
  728. package/lib/shared-tree/treeCheckout.js.map +1 -1
  729. package/lib/shared-tree/unhydratedTreeContext.js +1 -1
  730. package/lib/shared-tree/unhydratedTreeContext.js.map +1 -1
  731. package/lib/shared-tree-core/editManagerCodecs.d.ts +23 -12
  732. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  733. package/lib/shared-tree-core/editManagerCodecs.js +41 -65
  734. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  735. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  736. package/lib/shared-tree-core/editManagerCodecsCommons.js +0 -1
  737. package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  738. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +10 -2
  739. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  740. package/lib/shared-tree-core/editManagerCodecsV1toV4.js +16 -11
  741. package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  742. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +2 -2
  743. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  744. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js +5 -8
  745. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  746. package/lib/shared-tree-core/index.d.ts +3 -3
  747. package/lib/shared-tree-core/index.d.ts.map +1 -1
  748. package/lib/shared-tree-core/index.js +3 -3
  749. package/lib/shared-tree-core/index.js.map +1 -1
  750. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +2 -3
  751. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  752. package/lib/shared-tree-core/messageCodecV1ToV4.js +8 -8
  753. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  754. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts +2 -3
  755. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  756. package/lib/shared-tree-core/messageCodecVSharedBranches.js +5 -4
  757. package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  758. package/lib/shared-tree-core/messageCodecs.d.ts +15 -14
  759. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  760. package/lib/shared-tree-core/messageCodecs.js +38 -71
  761. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  762. package/lib/shared-tree-core/messageFormat.d.ts +0 -1
  763. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
  764. package/lib/shared-tree-core/messageFormat.js +0 -1
  765. package/lib/shared-tree-core/messageFormat.js.map +1 -1
  766. package/lib/shared-tree-core/sharedTreeCore.d.ts +1 -3
  767. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  768. package/lib/shared-tree-core/sharedTreeCore.js +14 -4
  769. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  770. package/lib/sharedTreeAttributes.d.ts.map +1 -1
  771. package/lib/sharedTreeAttributes.js +3 -0
  772. package/lib/sharedTreeAttributes.js.map +1 -1
  773. package/lib/simple-tree/api/eraseSchemaDetails.d.ts +43 -0
  774. package/lib/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -1
  775. package/lib/simple-tree/api/eraseSchemaDetails.js.map +1 -1
  776. package/lib/simple-tree/api/index.d.ts +4 -2
  777. package/lib/simple-tree/api/index.d.ts.map +1 -1
  778. package/lib/simple-tree/api/index.js +1 -1
  779. package/lib/simple-tree/api/index.js.map +1 -1
  780. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  781. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  782. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +126 -29
  783. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  784. package/lib/simple-tree/api/schemaFactoryAlpha.js +66 -1
  785. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  786. package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  787. package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  788. package/lib/simple-tree/api/schemaStatics.d.ts +10 -11
  789. package/lib/simple-tree/api/schemaStatics.d.ts.map +1 -1
  790. package/lib/simple-tree/api/schemaStatics.js +14 -8
  791. package/lib/simple-tree/api/schemaStatics.js.map +1 -1
  792. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  793. package/lib/simple-tree/api/storedSchema.js +7 -7
  794. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  795. package/lib/simple-tree/api/tree.d.ts +7 -19
  796. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  797. package/lib/simple-tree/api/tree.js.map +1 -1
  798. package/lib/simple-tree/api/treeAlpha.d.ts +69 -0
  799. package/lib/simple-tree/api/treeAlpha.d.ts.map +1 -0
  800. package/lib/simple-tree/api/treeAlpha.js +6 -0
  801. package/lib/simple-tree/api/treeAlpha.js.map +1 -0
  802. package/lib/simple-tree/api/treeBeta.d.ts +1 -1
  803. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  804. package/lib/simple-tree/api/treeChangeEvents.d.ts +3 -0
  805. package/lib/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
  806. package/lib/simple-tree/api/treeChangeEvents.js.map +1 -1
  807. package/lib/simple-tree/api/treeNodeApi.d.ts +49 -0
  808. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  809. package/lib/simple-tree/api/treeNodeApi.js +41 -2
  810. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  811. package/lib/simple-tree/api/typesUnsafe.d.ts +23 -2
  812. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  813. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  814. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  815. package/lib/simple-tree/core/treeNodeKernel.js +45 -8
  816. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  817. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  818. package/lib/simple-tree/core/unhydratedFlexTree.js +5 -1
  819. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  820. package/lib/simple-tree/fieldSchema.d.ts +3 -2
  821. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  822. package/lib/simple-tree/fieldSchema.js +3 -4
  823. package/lib/simple-tree/fieldSchema.js.map +1 -1
  824. package/lib/simple-tree/index.d.ts +2 -2
  825. package/lib/simple-tree/index.d.ts.map +1 -1
  826. package/lib/simple-tree/index.js.map +1 -1
  827. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +16 -0
  828. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  829. package/lib/simple-tree/node-kinds/array/arrayNode.js +23 -0
  830. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  831. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +10 -1
  832. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  833. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  834. package/lib/simple-tree/node-kinds/array/index.d.ts +2 -2
  835. package/lib/simple-tree/node-kinds/array/index.d.ts.map +1 -1
  836. package/lib/simple-tree/node-kinds/array/index.js.map +1 -1
  837. package/lib/simple-tree/node-kinds/index.d.ts +2 -2
  838. package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
  839. package/lib/simple-tree/node-kinds/index.js.map +1 -1
  840. package/lib/simple-tree/node-kinds/object/index.d.ts +2 -2
  841. package/lib/simple-tree/node-kinds/object/index.d.ts.map +1 -1
  842. package/lib/simple-tree/node-kinds/object/index.js.map +1 -1
  843. package/lib/simple-tree/node-kinds/object/objectNode.d.ts +43 -7
  844. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  845. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  846. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +26 -2
  847. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  848. package/lib/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  849. package/lib/text/textDomainFormatted.d.ts +321 -13
  850. package/lib/text/textDomainFormatted.d.ts.map +1 -1
  851. package/lib/text/textDomainFormatted.js +103 -28
  852. package/lib/text/textDomainFormatted.js.map +1 -1
  853. package/lib/treeFactory.d.ts.map +1 -1
  854. package/lib/treeFactory.js +6 -3
  855. package/lib/treeFactory.js.map +1 -1
  856. package/lib/util/rangeMap.d.ts +25 -18
  857. package/lib/util/rangeMap.d.ts.map +1 -1
  858. package/lib/util/rangeMap.js +25 -31
  859. package/lib/util/rangeMap.js.map +1 -1
  860. package/lib/util/referenceCounting.d.ts.map +1 -1
  861. package/lib/util/referenceCounting.js +0 -1
  862. package/lib/util/referenceCounting.js.map +1 -1
  863. package/lib/util/typeCheck.d.ts.map +1 -1
  864. package/lib/util/typeCheck.js.map +1 -1
  865. package/lib/util/typeUtils.d.ts.map +1 -1
  866. package/lib/util/typeUtils.js.map +1 -1
  867. package/package.json +50 -50
  868. package/scripts/generate-entrypoint-sources.sh +31 -0
  869. package/src/api.ts +11 -0
  870. package/src/codec/codec.ts +32 -2
  871. package/src/codec/index.ts +2 -3
  872. package/src/codec/versioned/codec.ts +99 -109
  873. package/src/codec/versioned/index.ts +1 -3
  874. package/src/core/forest/forest.ts +5 -2
  875. package/src/core/index.ts +4 -0
  876. package/src/core/rebase/changeRebaser.ts +8 -0
  877. package/src/core/rebase/revisionTagCodec.ts +4 -4
  878. package/src/core/rebase/utils.ts +9 -2
  879. package/src/core/schema-stored/formatV2.ts +1 -1
  880. package/src/core/tree/anchorSet.ts +67 -10
  881. package/src/core/tree/cursor.ts +52 -1
  882. package/src/core/tree/deltaUtil.ts +37 -1
  883. package/src/core/tree/detachedFieldIndexCodecs.ts +4 -4
  884. package/src/core/tree/index.ts +4 -0
  885. package/src/core/tree/visitDelta.ts +13 -1
  886. package/src/core/tree/visitorUtils.ts +5 -0
  887. package/{dist/alpha.d.ts → src/entrypoints/alpha.ts} +25 -11
  888. package/{lib/beta.d.ts → src/entrypoints/beta.ts} +4 -7
  889. package/src/entrypoints/internal.ts +13 -0
  890. package/{lib/legacy.d.ts → src/entrypoints/legacy.ts} +13 -8
  891. package/{dist/public.d.ts → src/entrypoints/public.ts} +3 -6
  892. package/src/feature-libraries/changeAtomIdCodec.ts +8 -7
  893. package/src/feature-libraries/chunked-forest/chunkedForest.ts +3 -2
  894. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +18 -13
  895. package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -1
  896. package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +1 -2
  897. package/src/feature-libraries/chunked-forest/codec/codecs.ts +16 -10
  898. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +16 -14
  899. package/src/feature-libraries/chunked-forest/codec/{formatGeneric.ts → format/formatGeneric.ts} +1 -1
  900. package/src/feature-libraries/chunked-forest/codec/{format.ts → format/formatV1.ts} +41 -111
  901. package/src/feature-libraries/chunked-forest/codec/format/formatV2.ts +31 -0
  902. package/src/feature-libraries/chunked-forest/codec/format/index.ts +31 -0
  903. package/src/feature-libraries/chunked-forest/codec/format/versions.ts +81 -0
  904. package/src/feature-libraries/chunked-forest/codec/index.ts +6 -2
  905. package/src/feature-libraries/chunked-forest/codec/nodeEncoder.ts +19 -12
  906. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +6 -4
  907. package/src/feature-libraries/chunked-forest/codec/uncompressedEncode.ts +10 -10
  908. package/src/feature-libraries/chunked-forest/index.ts +2 -1
  909. package/src/feature-libraries/cursorComparator.ts +77 -0
  910. package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +5 -5
  911. package/src/feature-libraries/index.ts +5 -3
  912. package/src/feature-libraries/indexing/anchorTreeIndex.ts +20 -10
  913. package/src/feature-libraries/mitigatedChangeFamily.ts +4 -1
  914. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +3 -8
  915. package/src/feature-libraries/modular-schema/defaultRevisionReplacer.ts +16 -8
  916. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +4 -5
  917. package/src/feature-libraries/modular-schema/genericFieldKind.ts +0 -1
  918. package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +19 -26
  919. package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +4 -4
  920. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +4 -5
  921. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +15 -6
  922. package/src/feature-libraries/object-forest/objectForest.ts +8 -2
  923. package/src/feature-libraries/optional-field/optionalFieldCodecV2.ts +11 -13
  924. package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +4 -5
  925. package/src/feature-libraries/schema-edits/index.ts +1 -4
  926. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +10 -78
  927. package/src/feature-libraries/schema-index/codec.ts +0 -25
  928. package/src/feature-libraries/schema-index/formatV2.ts +1 -1
  929. package/src/feature-libraries/schema-index/index.ts +1 -4
  930. package/src/feature-libraries/sequence-field/moveEffectTable.ts +1 -1
  931. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +6 -6
  932. package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +8 -5
  933. package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +4 -5
  934. package/src/index.ts +29 -3
  935. package/src/packageVersion.ts +1 -1
  936. package/src/shared-tree/independentView.ts +5 -18
  937. package/src/shared-tree/index.ts +0 -4
  938. package/src/shared-tree/schematizingTreeView.ts +19 -165
  939. package/src/shared-tree/sharedTree.ts +16 -59
  940. package/src/shared-tree/sharedTreeChangeCodecs.ts +23 -29
  941. package/src/shared-tree/sharedTreeChangeEnricher.ts +1 -2
  942. package/src/shared-tree/sharedTreeChangeFamily.ts +2 -0
  943. package/src/shared-tree/sharedTreeChangeFormat.ts +23 -8
  944. package/src/shared-tree/tree.ts +2 -5
  945. package/src/shared-tree/treeAlpha.ts +26 -0
  946. package/src/shared-tree/treeCheckout.ts +277 -100
  947. package/src/shared-tree/unhydratedTreeContext.ts +1 -1
  948. package/src/shared-tree-core/editManagerCodecs.ts +99 -124
  949. package/src/shared-tree-core/editManagerCodecsCommons.ts +0 -1
  950. package/src/shared-tree-core/editManagerCodecsV1toV4.ts +54 -59
  951. package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +72 -95
  952. package/src/shared-tree-core/index.ts +4 -8
  953. package/src/shared-tree-core/messageCodecV1ToV4.ts +56 -71
  954. package/src/shared-tree-core/messageCodecVSharedBranches.ts +76 -92
  955. package/src/shared-tree-core/messageCodecs.ts +88 -126
  956. package/src/shared-tree-core/messageFormat.ts +0 -3
  957. package/src/shared-tree-core/sharedTreeCore.ts +14 -21
  958. package/src/sharedTreeAttributes.ts +3 -0
  959. package/src/simple-tree/api/eraseSchemaDetails.ts +60 -0
  960. package/src/simple-tree/api/index.ts +22 -1
  961. package/src/simple-tree/api/schemaFactory.ts +8 -3
  962. package/src/simple-tree/api/schemaFactoryAlpha.ts +275 -27
  963. package/src/simple-tree/api/schemaFactoryBeta.ts +10 -1
  964. package/src/simple-tree/api/schemaStatics.ts +79 -21
  965. package/src/simple-tree/api/storedSchema.ts +8 -19
  966. package/src/simple-tree/api/tree.ts +7 -20
  967. package/src/simple-tree/api/treeAlpha.ts +90 -0
  968. package/src/simple-tree/api/treeBeta.ts +1 -1
  969. package/src/simple-tree/api/treeChangeEvents.ts +3 -0
  970. package/src/simple-tree/api/treeNodeApi.ts +95 -3
  971. package/src/simple-tree/api/typesUnsafe.ts +49 -1
  972. package/src/simple-tree/core/treeNodeKernel.ts +53 -7
  973. package/src/simple-tree/core/unhydratedFlexTree.ts +5 -1
  974. package/src/simple-tree/fieldSchema.ts +29 -5
  975. package/src/simple-tree/index.ts +20 -0
  976. package/src/simple-tree/node-kinds/array/arrayNode.ts +64 -0
  977. package/src/simple-tree/node-kinds/array/arrayNodeTypes.ts +25 -1
  978. package/src/simple-tree/node-kinds/array/index.ts +2 -0
  979. package/src/simple-tree/node-kinds/index.ts +5 -0
  980. package/src/simple-tree/node-kinds/object/index.ts +3 -0
  981. package/src/simple-tree/node-kinds/object/objectNode.ts +69 -11
  982. package/src/simple-tree/node-kinds/object/objectNodeTypes.ts +33 -2
  983. package/src/text/textDomainFormatted.ts +113 -11
  984. package/src/treeFactory.ts +10 -5
  985. package/src/util/rangeMap.ts +54 -50
  986. package/src/util/referenceCounting.ts +0 -1
  987. package/src/util/typeCheck.ts +1 -0
  988. package/src/util/typeUtils.ts +4 -7
  989. package/dist/beta.d.ts +0 -152
  990. package/dist/feature-libraries/chunked-forest/codec/format.d.ts +0 -383
  991. package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +0 -1
  992. package/dist/feature-libraries/chunked-forest/codec/format.js +0 -191
  993. package/dist/feature-libraries/chunked-forest/codec/format.js.map +0 -1
  994. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +0 -1
  995. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.js.map +0 -1
  996. package/dist/legacy.d.ts +0 -159
  997. package/lib/alpha.d.ts +0 -304
  998. package/lib/feature-libraries/chunked-forest/codec/format.d.ts +0 -383
  999. package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +0 -1
  1000. package/lib/feature-libraries/chunked-forest/codec/format.js +0 -188
  1001. package/lib/feature-libraries/chunked-forest/codec/format.js.map +0 -1
  1002. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +0 -1
  1003. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.js.map +0 -1
  1004. package/lib/public.d.ts +0 -94
  1005. /package/dist/feature-libraries/chunked-forest/codec/{formatGeneric.js → format/formatGeneric.js} +0 -0
  1006. /package/lib/feature-libraries/chunked-forest/codec/{formatGeneric.js → format/formatGeneric.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"crossFieldQueries.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/crossFieldQueries.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAeH,SAAgB,kBAAkB,CACjC,GAAuB,EACvB,QAAiC,EACjC,EAAoB,EACpB,KAAa;IAEb,kBAAkB,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;AACpD,CAAC;AAPD,gDAOC;AAED,SAAgB,kBAAkB,CACjC,GAAqB,EACrB,QAAiC,EACjC,EAAoB,EACpB,KAAa,EACb,KAAQ;IAER,GAAG,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAClD,CAAC;AARD,gDAQC;AAED,SAAgB,yBAAyB,CACxC,GAAqB,EACrB,QAAiC,EACjC,EAAoB,EACpB,KAAa;IAEb,OAAO,GAAG,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;AACvD,CAAC;AAPD,8DAOC;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC3B,2DAAM,CAAA;IACN,qEAAW,CAAA;AACZ,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tChangeAtomId,\n\tChangeAtomIdRangeMap,\n\tChangesetLocalId,\n\tRevisionTag,\n} from \"../../core/index.js\";\nimport type { RangeQueryResult } from \"../../util/index.js\";\n\nimport type { NodeId } from \"./modularChangeTypes.js\";\n\nexport type CrossFieldMap<T> = ChangeAtomIdRangeMap<T>;\nexport type CrossFieldQuerySet = CrossFieldMap<boolean>;\n\nexport function addCrossFieldQuery(\n\tset: CrossFieldQuerySet,\n\trevision: RevisionTag | undefined,\n\tid: ChangesetLocalId,\n\tcount: number,\n): void {\n\tsetInCrossFieldMap(set, revision, id, count, true);\n}\n\nexport function setInCrossFieldMap<T>(\n\tmap: CrossFieldMap<T>,\n\trevision: RevisionTag | undefined,\n\tid: ChangesetLocalId,\n\tcount: number,\n\tvalue: T,\n): void {\n\tmap.set({ revision, localId: id }, count, value);\n}\n\nexport function getFirstFromCrossFieldMap<T>(\n\tmap: CrossFieldMap<T>,\n\trevision: RevisionTag | undefined,\n\tid: ChangesetLocalId,\n\tcount: number,\n): RangeQueryResult<ChangeAtomId, T> {\n\treturn map.getFirst({ revision, localId: id }, count);\n}\n\nexport enum CrossFieldTarget {\n\tSource,\n\tDestination,\n}\n\n/**\n * Used by {@link FieldChangeHandler} implementations for exchanging information across other fields\n * while rebasing, composing, or inverting a change.\n */\nexport interface CrossFieldManager<T = unknown> {\n\t/**\n\t * Returns the first data range associated with the key of `target`, `revision`, between `id` and `id + count`.\n\t * Calling this records a dependency for the current field on this key if `addDependency` is true.\n\t */\n\tget(\n\t\ttarget: CrossFieldTarget,\n\t\trevision: RevisionTag | undefined,\n\t\tid: ChangesetLocalId,\n\t\tcount: number,\n\t\taddDependency: boolean,\n\t): RangeQueryResult<ChangeAtomId, T>;\n\n\t/**\n\t * Sets the range of keys to `newValue`.\n\t * If `invalidateDependents` is true, all fields which took a dependency on this key will be considered invalidated\n\t * and will be given a chance to address the new data in `amendCompose`, or a second pass of `rebase` or `invert` as appropriate.\n\t */\n\tset(\n\t\ttarget: CrossFieldTarget,\n\t\trevision: RevisionTag | undefined,\n\t\tid: ChangesetLocalId,\n\t\tcount: number,\n\t\tnewValue: T,\n\t\tinvalidateDependents: boolean,\n\t): void;\n\n\t/**\n\t * This must be called whenever a new node is moved into this field as part of the current rebase, compose, or invert.\n\t * Calling this for a node which was already in the field is tolerated.\n\t */\n\tonMoveIn(id: NodeId): void;\n\n\t/**\n\t * This must be called whenever a new cross field key is moved into this field as part of the current rebase or compose.\n\t * Calling this for a key which was already in the field is tolerated.\n\t */\n\tmoveKey(\n\t\ttarget: CrossFieldTarget,\n\t\trevision: RevisionTag | undefined,\n\t\tid: ChangesetLocalId,\n\t\tcount: number,\n\t): void;\n}\n"]}
1
+ {"version":3,"file":"crossFieldQueries.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/crossFieldQueries.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAUH,SAAgB,kBAAkB,CACjC,GAAuB,EACvB,QAAiC,EACjC,EAAoB,EACpB,KAAa;IAEb,kBAAkB,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;AACpD,CAAC;AAPD,gDAOC;AAED,SAAgB,kBAAkB,CACjC,GAAqB,EACrB,QAAiC,EACjC,EAAoB,EACpB,KAAa,EACb,KAAQ;IAER,GAAG,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAClD,CAAC;AARD,gDAQC;AAED,SAAgB,yBAAyB,CACxC,GAAqB,EACrB,QAAiC,EACjC,EAAoB,EACpB,KAAa;IAEb,OAAO,GAAG,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;AACvD,CAAC;AAPD,8DAOC;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC3B,2DAAM,CAAA;IACN,qEAAW,CAAA;AACZ,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ChangeAtomIdRangeMap, ChangesetLocalId, RevisionTag } from \"../../core/index.js\";\nimport type { RangeQueryResult } from \"../../util/index.js\";\n\nimport type { NodeId } from \"./modularChangeTypes.js\";\n\nexport type CrossFieldMap<T> = ChangeAtomIdRangeMap<T>;\nexport type CrossFieldQuerySet = CrossFieldMap<boolean>;\n\nexport function addCrossFieldQuery(\n\tset: CrossFieldQuerySet,\n\trevision: RevisionTag | undefined,\n\tid: ChangesetLocalId,\n\tcount: number,\n): void {\n\tsetInCrossFieldMap(set, revision, id, count, true);\n}\n\nexport function setInCrossFieldMap<T>(\n\tmap: CrossFieldMap<T>,\n\trevision: RevisionTag | undefined,\n\tid: ChangesetLocalId,\n\tcount: number,\n\tvalue: T,\n): void {\n\tmap.set({ revision, localId: id }, count, value);\n}\n\nexport function getFirstFromCrossFieldMap<T>(\n\tmap: CrossFieldMap<T>,\n\trevision: RevisionTag | undefined,\n\tid: ChangesetLocalId,\n\tcount: number,\n): RangeQueryResult<T | undefined> {\n\treturn map.getFirst({ revision, localId: id }, count);\n}\n\nexport enum CrossFieldTarget {\n\tSource,\n\tDestination,\n}\n\n/**\n * Used by {@link FieldChangeHandler} implementations for exchanging information across other fields\n * while rebasing, composing, or inverting a change.\n */\nexport interface CrossFieldManager<T = unknown> {\n\t/**\n\t * Returns the first data range associated with the key of `target`, `revision`, between `id` and `id + count`.\n\t * Calling this records a dependency for the current field on this key if `addDependency` is true.\n\t */\n\tget(\n\t\ttarget: CrossFieldTarget,\n\t\trevision: RevisionTag | undefined,\n\t\tid: ChangesetLocalId,\n\t\tcount: number,\n\t\taddDependency: boolean,\n\t): RangeQueryResult<T | undefined>;\n\n\t/**\n\t * Sets the range of keys to `newValue`.\n\t * If `invalidateDependents` is true, all fields which took a dependency on this key will be considered invalidated\n\t * and will be given a chance to address the new data in `amendCompose`, or a second pass of `rebase` or `invert` as appropriate.\n\t */\n\tset(\n\t\ttarget: CrossFieldTarget,\n\t\trevision: RevisionTag | undefined,\n\t\tid: ChangesetLocalId,\n\t\tcount: number,\n\t\tnewValue: T,\n\t\tinvalidateDependents: boolean,\n\t): void;\n\n\t/**\n\t * This must be called whenever a new node is moved into this field as part of the current rebase, compose, or invert.\n\t * Calling this for a node which was already in the field is tolerated.\n\t */\n\tonMoveIn(id: NodeId): void;\n\n\t/**\n\t * This must be called whenever a new cross field key is moved into this field as part of the current rebase or compose.\n\t * Calling this for a key which was already in the field is tolerated.\n\t */\n\tmoveKey(\n\t\ttarget: CrossFieldTarget,\n\t\trevision: RevisionTag | undefined,\n\t\tid: ChangesetLocalId,\n\t\tcount: number,\n\t): void;\n}\n"]}
@@ -21,5 +21,6 @@ export declare class DefaultRevisionReplacer implements RevisionReplacer {
21
21
  constructor(updatedRevision: RevisionTag, obsoleteRevisions: Set<RevisionTag | undefined>);
22
22
  isObsolete(revision: RevisionTag | undefined): boolean;
23
23
  getUpdatedAtomId<T extends ChangeAtomId>(id: T, count?: number): T;
24
+ private areAllUnallocated;
24
25
  }
25
26
  //# sourceMappingURL=defaultRevisionReplacer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaultRevisionReplacer.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/defaultRevisionReplacer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAGN,KAAK,YAAY,EAGjB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,MAAM,qBAAqB,CAAC;AAY7B,qBAAa,uBAAwB,YAAW,gBAAgB;aAgB9C,eAAe,EAAE,WAAW;IAC5C,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAhBnC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,eAAe,CACiB;IACjD;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0D;IACnF;;OAEG;IACH,OAAO,CAAC,OAAO,CAAsC;gBAGpC,eAAe,EAAE,WAAW,EAC3B,iBAAiB,EAAE,GAAG,CAAC,WAAW,GAAG,SAAS,CAAC;IAG1D,UAAU,CAAC,QAAQ,EAAE,WAAW,GAAG,SAAS,GAAG,OAAO;IAItD,gBAAgB,CAAC,CAAC,SAAS,YAAY,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,GAAE,MAAU,GAAG,CAAC;CA4C5E"}
1
+ {"version":3,"file":"defaultRevisionReplacer.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/defaultRevisionReplacer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAGN,KAAK,YAAY,EAGjB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,MAAM,qBAAqB,CAAC;AAY7B,qBAAa,uBAAwB,YAAW,gBAAgB;aAgB9C,eAAe,EAAE,WAAW;IAC5C,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAhBnC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,eAAe,CACiB;IACjD;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0D;IACnF;;OAEG;IACH,OAAO,CAAC,OAAO,CAAsC;gBAGpC,eAAe,EAAE,WAAW,EAC3B,iBAAiB,EAAE,GAAG,CAAC,WAAW,GAAG,SAAS,CAAC;IAG1D,UAAU,CAAC,QAAQ,EAAE,WAAW,GAAG,SAAS,GAAG,OAAO;IAItD,gBAAgB,CAAC,CAAC,SAAS,YAAY,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,GAAE,MAAU,GAAG,CAAC;IA4C5E,OAAO,CAAC,iBAAiB;CAQzB"}
@@ -40,13 +40,13 @@ class DefaultRevisionReplacer {
40
40
  const prior = this.updatedLocalIds.getFirst(remainderStart, remainderCount);
41
41
  if (prior.value === undefined) {
42
42
  const defaultOutputId = continuingOutputId ?? remainderStart.localId;
43
- const newLocalId = this.localIds.getAll(defaultOutputId, prior.length).length > 0
44
- ? // Some of the IDs in this range have already been used in the scope of the updated revision.
45
- // We need to allocate new local IDs.
46
- (0, index_js_2.brand)(this.maxSeen + 1)
47
- : // This change atom ID uses a local ID that has not yet been used in the scope of the updated revision.
43
+ const newLocalId = this.areAllUnallocated(defaultOutputId, prior.length)
44
+ ? // This change atom ID uses a local ID that has not yet been used in the scope of the updated revision.
48
45
  // We reuse it as is to minimize the number of IDs that need to be updated.
49
- defaultOutputId;
46
+ defaultOutputId
47
+ : // Some of the IDs in this range have already been used in the scope of the updated revision.
48
+ // We need to allocate new local IDs.
49
+ (0, index_js_2.brand)(this.maxSeen + 1);
50
50
  this.maxSeen = (0, index_js_2.brand)(Math.max(this.maxSeen, newLocalId + prior.length - 1));
51
51
  this.localIds.set(newLocalId, prior.length, true);
52
52
  this.updatedLocalIds.set(remainderStart, prior.length, newLocalId);
@@ -74,6 +74,14 @@ class DefaultRevisionReplacer {
74
74
  }
75
75
  return id;
76
76
  }
77
+ areAllUnallocated(id, count) {
78
+ for (const entry of this.localIds.getAll(id, count)) {
79
+ if (entry.value !== undefined) {
80
+ return false;
81
+ }
82
+ }
83
+ return true;
84
+ }
77
85
  }
78
86
  exports.DefaultRevisionReplacer = DefaultRevisionReplacer;
79
87
  //# sourceMappingURL=defaultRevisionReplacer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaultRevisionReplacer.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/defaultRevisionReplacer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAmE;AAEnE,kDAQ6B;AAC7B,kDAM6B;AAE7B,MAAM,sBAAsB,GAAG,CAAC,KAAuB,EAAE,MAAc,EAAoB,EAAE,CAC5F,IAAA,gBAAK,EAAC,KAAK,GAAG,MAAM,CAAC,CAAC;AAEvB,MAAa,uBAAuB;IAenC,YACiB,eAA4B,EAC3B,iBAA+C;QADhD,oBAAe,GAAf,eAAe,CAAa;QAC3B,sBAAiB,GAAjB,iBAAiB,CAA8B;QAhBjE;;WAEG;QACc,oBAAe,GAC/B,IAAA,kCAAuB,EAAC,sBAAsB,CAAC,CAAC;QACjD;;WAEG;QACc,aAAQ,GAAqC,IAAA,6BAAkB,GAAE,CAAC;QACnF;;WAEG;QACK,YAAO,GAAqB,IAAA,qBAAU,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAKl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IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;oBAClD,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,cAAc,EAAE,KAAK,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;oBACnE,IAAI,kBAAkB,KAAK,SAAS,EAAE,CAAC;wBACtC,OAAO,CAAC,OAAO,GAAG,UAAU,CAAC;oBAC9B,CAAC;yBAAM,IAAI,UAAU,KAAK,kBAAkB,EAAE,CAAC;wBAC9C,IAAA,eAAI,EAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;oBACtD,CAAC;oBACD,kBAAkB,GAAG,sBAAsB,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;gBACvE,CAAC;qBAAM,CAAC;oBACP,IAAI,kBAAkB,KAAK,SAAS,EAAE,CAAC;wBACtC,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC;oBAC/B,CAAC;yBAAM,IAAI,KAAK,CAAC,KAAK,KAAK,kBAAkB,EAAE,CAAC;wBAC/C,IAAA,eAAI,EAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;oBACtD,CAAC;oBACD,kBAAkB,GAAG,sBAAsB,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;gBACxE,CAAC;gBACD,cAAc,GAAG,IAAA,6BAAkB,EAAC,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;gBAClE,cAAc,IAAI,KAAK,CAAC,MAAM,CAAC;YAChC,CAAC;YACD,OAAO,OAAO,CAAC;QAChB,CAAC;QACD,OAAO,EAAE,CAAC;IACX,CAAC;CACD;AApED,0DAoEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tnewChangeAtomIdRangeMap,\n\toffsetChangeAtomId,\n\ttype ChangeAtomId,\n\ttype ChangeAtomIdRangeMap,\n\ttype ChangesetLocalId,\n\ttype RevisionReplacer,\n\ttype RevisionTag,\n} from \"../../core/index.js\";\nimport {\n\tbrand,\n\tbrandConst,\n\tnewIntegerRangeMap,\n\ttype RangeMap,\n\ttype Mutable,\n} from \"../../util/index.js\";\n\nconst offsetChangesetLocalId = (value: ChangesetLocalId, offset: number): ChangesetLocalId =>\n\tbrand(value + offset);\n\nexport class DefaultRevisionReplacer implements RevisionReplacer {\n\t/**\n\t * Mapping from (obsolete revision tag, original local id) to the updated local id.\n\t */\n\tprivate readonly updatedLocalIds: ChangeAtomIdRangeMap<ChangesetLocalId> =\n\t\tnewChangeAtomIdRangeMap(offsetChangesetLocalId);\n\t/**\n\t * The set of local IDs already used in the scope of the updated revision.\n\t */\n\tprivate readonly localIds: RangeMap<ChangesetLocalId, true> = newIntegerRangeMap();\n\t/**\n\t * The maximum local ID seen so far in the scope of the updated revision.\n\t */\n\tprivate maxSeen: ChangesetLocalId = brandConst(-1)();\n\n\tpublic constructor(\n\t\tpublic readonly updatedRevision: RevisionTag,\n\t\tprivate readonly obsoleteRevisions: Set<RevisionTag | undefined>,\n\t) {}\n\n\tpublic isObsolete(revision: RevisionTag | undefined): boolean {\n\t\treturn this.obsoleteRevisions.has(revision);\n\t}\n\n\tpublic getUpdatedAtomId<T extends ChangeAtomId>(id: T, count: number = 1): T {\n\t\tassert(count >= 1, 0xcc9 /* Count must be at least 1 */);\n\t\tif (this.isObsolete(id.revision)) {\n\t\t\tconst updated: Mutable<T> = { ...id, revision: this.updatedRevision };\n\t\t\tlet continuingOutputId: ChangesetLocalId | undefined;\n\t\t\tlet remainderCount = count;\n\t\t\tlet remainderStart = id;\n\t\t\twhile (remainderCount > 0) {\n\t\t\t\tconst prior = this.updatedLocalIds.getFirst(remainderStart, remainderCount);\n\t\t\t\tif (prior.value === undefined) {\n\t\t\t\t\tconst defaultOutputId = continuingOutputId ?? remainderStart.localId;\n\t\t\t\t\tconst newLocalId =\n\t\t\t\t\t\tthis.localIds.getAll(defaultOutputId, prior.length).length > 0\n\t\t\t\t\t\t\t? // Some of the IDs in this range have already been used in the scope of the updated revision.\n\t\t\t\t\t\t\t\t// We need to allocate new local IDs.\n\t\t\t\t\t\t\t\tbrand<ChangesetLocalId>(this.maxSeen + 1)\n\t\t\t\t\t\t\t: // This change atom ID uses a local ID that has not yet been used in the scope of the updated revision.\n\t\t\t\t\t\t\t\t// We reuse it as is to minimize the number of IDs that need to be updated.\n\t\t\t\t\t\t\t\tdefaultOutputId;\n\n\t\t\t\t\tthis.maxSeen = brand(Math.max(this.maxSeen, newLocalId + prior.length - 1));\n\t\t\t\t\tthis.localIds.set(newLocalId, prior.length, true);\n\t\t\t\t\tthis.updatedLocalIds.set(remainderStart, prior.length, newLocalId);\n\t\t\t\t\tif (continuingOutputId === undefined) {\n\t\t\t\t\t\tupdated.localId = newLocalId;\n\t\t\t\t\t} else if (newLocalId !== continuingOutputId) {\n\t\t\t\t\t\tfail(0xcca /* TODO: Handle non-contiguous ranges */);\n\t\t\t\t\t}\n\t\t\t\t\tcontinuingOutputId = offsetChangesetLocalId(newLocalId, prior.length);\n\t\t\t\t} else {\n\t\t\t\t\tif (continuingOutputId === undefined) {\n\t\t\t\t\t\tupdated.localId = prior.value;\n\t\t\t\t\t} else if (prior.value !== continuingOutputId) {\n\t\t\t\t\t\tfail(0xccb /* TODO: Handle non-contiguous ranges */);\n\t\t\t\t\t}\n\t\t\t\t\tcontinuingOutputId = offsetChangesetLocalId(prior.value, prior.length);\n\t\t\t\t}\n\t\t\t\tremainderStart = offsetChangeAtomId(remainderStart, prior.length);\n\t\t\t\tremainderCount -= prior.length;\n\t\t\t}\n\t\t\treturn updated;\n\t\t}\n\t\treturn id;\n\t}\n}\n"]}
1
+ {"version":3,"file":"defaultRevisionReplacer.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/defaultRevisionReplacer.ts"],"names":[],"mappings":";AAAA;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AC;oBACtD,CAAC;oBACD,kBAAkB,GAAG,sBAAsB,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;gBACxE,CAAC;gBACD,cAAc,GAAG,IAAA,6BAAkB,EAAC,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;gBAClE,cAAc,IAAI,KAAK,CAAC,MAAM,CAAC;YAChC,CAAC;YACD,OAAO,OAAO,CAAC;QAChB,CAAC;QACD,OAAO,EAAE,CAAC;IACX,CAAC;IAEO,iBAAiB,CAAC,EAAoB,EAAE,KAAa;QAC5D,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,CAAC;YACrD,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;gBAC/B,OAAO,KAAK,CAAC;YACd,CAAC;QACF,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AA5ED,0DA4EC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tnewChangeAtomIdRangeMap,\n\toffsetChangeAtomId,\n\ttype ChangeAtomId,\n\ttype ChangeAtomIdRangeMap,\n\ttype ChangesetLocalId,\n\ttype RevisionReplacer,\n\ttype RevisionTag,\n} from \"../../core/index.js\";\nimport {\n\tbrand,\n\tbrandConst,\n\tnewIntegerRangeMap,\n\ttype RangeMap,\n\ttype Mutable,\n} from \"../../util/index.js\";\n\nconst offsetChangesetLocalId = (value: ChangesetLocalId, offset: number): ChangesetLocalId =>\n\tbrand(value + offset);\n\nexport class DefaultRevisionReplacer implements RevisionReplacer {\n\t/**\n\t * Mapping from (obsolete revision tag, original local id) to the updated local id.\n\t */\n\tprivate readonly updatedLocalIds: ChangeAtomIdRangeMap<ChangesetLocalId> =\n\t\tnewChangeAtomIdRangeMap(offsetChangesetLocalId);\n\t/**\n\t * The set of local IDs already used in the scope of the updated revision.\n\t */\n\tprivate readonly localIds: RangeMap<ChangesetLocalId, true> = newIntegerRangeMap();\n\t/**\n\t * The maximum local ID seen so far in the scope of the updated revision.\n\t */\n\tprivate maxSeen: ChangesetLocalId = brandConst(-1)();\n\n\tpublic constructor(\n\t\tpublic readonly updatedRevision: RevisionTag,\n\t\tprivate readonly obsoleteRevisions: Set<RevisionTag | undefined>,\n\t) {}\n\n\tpublic isObsolete(revision: RevisionTag | undefined): boolean {\n\t\treturn this.obsoleteRevisions.has(revision);\n\t}\n\n\tpublic getUpdatedAtomId<T extends ChangeAtomId>(id: T, count: number = 1): T {\n\t\tassert(count >= 1, 0xcc9 /* Count must be at least 1 */);\n\t\tif (this.isObsolete(id.revision)) {\n\t\t\tconst updated: Mutable<T> = { ...id, revision: this.updatedRevision };\n\t\t\tlet continuingOutputId: ChangesetLocalId | undefined;\n\t\t\tlet remainderCount = count;\n\t\t\tlet remainderStart = id;\n\t\t\twhile (remainderCount > 0) {\n\t\t\t\tconst prior = this.updatedLocalIds.getFirst(remainderStart, remainderCount);\n\t\t\t\tif (prior.value === undefined) {\n\t\t\t\t\tconst defaultOutputId = continuingOutputId ?? remainderStart.localId;\n\t\t\t\t\tconst newLocalId = this.areAllUnallocated(defaultOutputId, prior.length)\n\t\t\t\t\t\t? // This change atom ID uses a local ID that has not yet been used in the scope of the updated revision.\n\t\t\t\t\t\t\t// We reuse it as is to minimize the number of IDs that need to be updated.\n\t\t\t\t\t\t\tdefaultOutputId\n\t\t\t\t\t\t: // Some of the IDs in this range have already been used in the scope of the updated revision.\n\t\t\t\t\t\t\t// We need to allocate new local IDs.\n\t\t\t\t\t\t\tbrand<ChangesetLocalId>(this.maxSeen + 1);\n\n\t\t\t\t\tthis.maxSeen = brand(Math.max(this.maxSeen, newLocalId + prior.length - 1));\n\t\t\t\t\tthis.localIds.set(newLocalId, prior.length, true);\n\t\t\t\t\tthis.updatedLocalIds.set(remainderStart, prior.length, newLocalId);\n\t\t\t\t\tif (continuingOutputId === undefined) {\n\t\t\t\t\t\tupdated.localId = newLocalId;\n\t\t\t\t\t} else if (newLocalId !== continuingOutputId) {\n\t\t\t\t\t\tfail(0xcca /* TODO: Handle non-contiguous ranges */);\n\t\t\t\t\t}\n\t\t\t\t\tcontinuingOutputId = offsetChangesetLocalId(newLocalId, prior.length);\n\t\t\t\t} else {\n\t\t\t\t\tif (continuingOutputId === undefined) {\n\t\t\t\t\t\tupdated.localId = prior.value;\n\t\t\t\t\t} else if (prior.value !== continuingOutputId) {\n\t\t\t\t\t\tfail(0xccb /* TODO: Handle non-contiguous ranges */);\n\t\t\t\t\t}\n\t\t\t\t\tcontinuingOutputId = offsetChangesetLocalId(prior.value, prior.length);\n\t\t\t\t}\n\t\t\t\tremainderStart = offsetChangeAtomId(remainderStart, prior.length);\n\t\t\t\tremainderCount -= prior.length;\n\t\t\t}\n\t\t\treturn updated;\n\t\t}\n\t\treturn id;\n\t}\n\n\tprivate areAllUnallocated(id: ChangesetLocalId, count: number): boolean {\n\t\tfor (const entry of this.localIds.getAll(id, count)) {\n\t\t\tif (entry.value !== undefined) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\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 { ICodecFamily, IJsonCodec } from "../../codec/index.js";
6
- import type { ChangeEncodingContext, DeltaDetachedNodeChanges, DeltaDetachedNodeId, DeltaDetachedNodeRename, DeltaFieldChanges, DeltaFieldMap, EncodedRevisionTag, RevisionMetadataSource, RevisionReplacer, RevisionTag } from "../../core/index.js";
5
+ import type { ICodecFamily, JsonCodecPart } from "../../codec/index.js";
6
+ import type { ChangeEncodingContext, DeltaDetachedNodeChanges, DeltaDetachedNodeId, DeltaDetachedNodeRename, DeltaFieldChanges, DeltaFieldMap, RevisionMetadataSource, RevisionReplacer, RevisionTag, RevisionTagSchema } from "../../core/index.js";
7
7
  import type { IdAllocator, Invariant } from "../../util/index.js";
8
8
  import type { CrossFieldManager } from "./crossFieldQueries.js";
9
9
  import type { EncodedNodeChangeset } from "./modularChangeFormatV1.js";
@@ -37,7 +37,7 @@ export interface FieldChangeDelta {
37
37
  export interface FieldChangeHandler<TChangeset, TEditor extends FieldEditor<TChangeset> = FieldEditor<TChangeset>> {
38
38
  _typeCheck?: Invariant<TChangeset>;
39
39
  readonly rebaser: FieldChangeRebaser<TChangeset>;
40
- readonly codecsFactory: (revisionTagCodec: IJsonCodec<RevisionTag, EncodedRevisionTag, EncodedRevisionTag, ChangeEncodingContext>) => ICodecFamily<TChangeset, FieldChangeEncodingContext>;
40
+ readonly codecsFactory: (revisionTagCodec: JsonCodecPart<RevisionTag, typeof RevisionTagSchema, ChangeEncodingContext>) => ICodecFamily<TChangeset, FieldChangeEncodingContext>;
41
41
  readonly editor: TEditor;
42
42
  intoDelta(change: TChangeset, deltaFromChild: ToDelta): FieldChangeDelta;
43
43
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"fieldChangeHandler.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/fieldChangeHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EACX,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,WAAW,EACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,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MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;KACnC,CAAC,CAAC;AACJ,CAAC;AAZD,0EAYC;AAED,SAAgB,0BAA0B,CAAa,IAKtD;IACA,OAAO;QACN,GAAG,IAAI;QACP,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM;QACzB,gBAAgB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM;KACpC,CAAC;AACH,CAAC;AAXD,gEAWC;AAqBD,IAAY,eAGX;AAHD,WAAY,eAAe;IAC1B,6DAAQ,CAAA;IACR,6DAAQ,CAAA;AACT,CAAC,EAHW,eAAe,+BAAf,eAAe,QAG1B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ICodecFamily, IJsonCodec } from \"../../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tDeltaDetachedNodeChanges,\n\tDeltaDetachedNodeId,\n\tDeltaDetachedNodeRename,\n\tDeltaFieldChanges,\n\tDeltaFieldMap,\n\tEncodedRevisionTag,\n\tRevisionMetadataSource,\n\tRevisionReplacer,\n\tRevisionTag,\n} from \"../../core/index.js\";\nimport type { IdAllocator, Invariant } from \"../../util/index.js\";\n\nimport type { CrossFieldManager } from \"./crossFieldQueries.js\";\nimport type { EncodedNodeChangeset } from \"./modularChangeFormatV1.js\";\nimport type { CrossFieldKeyRange, NodeId } from \"./modularChangeTypes.js\";\n\nexport type NestedChangesIndices = [\n\tNodeId,\n\tnumber | undefined /* inputIndex */,\n\tnumber | undefined /* outputIndex */,\n][];\n\n/**\n * The return value of calling {@link FieldChangeHandler.intoDelta}.\n */\nexport interface FieldChangeDelta {\n\t/**\n\t * {@inheritdoc DeltaFieldChanges}\n\t */\n\treadonly local?: DeltaFieldChanges;\n\t/**\n\t * {@inheritdoc DeltaRoot.global}\n\t */\n\treadonly global?: readonly DeltaDetachedNodeChanges[];\n\t/**\n\t * {@inheritdoc DeltaRoot.rename}\n\t */\n\treadonly rename?: readonly DeltaDetachedNodeRename[];\n}\n\n/**\n * Functionality provided by a field kind which will be composed with other `FieldChangeHandler`s to\n * implement a unified ChangeFamily supporting documents with multiple field kinds.\n */\nexport interface FieldChangeHandler<\n\tTChangeset,\n\tTEditor extends FieldEditor<TChangeset> = FieldEditor<TChangeset>,\n> {\n\t_typeCheck?: Invariant<TChangeset>;\n\treadonly rebaser: FieldChangeRebaser<TChangeset>;\n\treadonly codecsFactory: (\n\t\trevisionTagCodec: IJsonCodec<\n\t\t\tRevisionTag,\n\t\t\tEncodedRevisionTag,\n\t\t\tEncodedRevisionTag,\n\t\t\tChangeEncodingContext\n\t\t>,\n\t) => ICodecFamily<TChangeset, FieldChangeEncodingContext>;\n\treadonly editor: TEditor;\n\tintoDelta(change: TChangeset, deltaFromChild: ToDelta): FieldChangeDelta;\n\t/**\n\t * Returns the set of removed roots that should be in memory for the given change to be applied.\n\t * A removed root is relevant if any of the following is true:\n\t * - It is being inserted\n\t * - It is being restored\n\t * - It is being edited\n\t * - The ID it is associated with is being changed\n\t *\n\t * Implementations are allowed to be conservative by returning more removed roots than strictly necessary\n\t * (though they should, for the sake of performance, try to avoid doing so).\n\t *\n\t * Implementations are not allowed to return IDs for non-root trees, even if they are removed.\n\t *\n\t * @param change - The change to be applied.\n\t * @param relevantRemovedRootsFromChild - Delegate for collecting relevant removed roots from child changes.\n\t */\n\treadonly relevantRemovedRoots: (\n\t\tchange: TChangeset,\n\t\trelevantRemovedRootsFromChild: RelevantRemovedRootsFromChild,\n\t) => Iterable<DeltaDetachedNodeId>;\n\n\t/**\n\t * Returns whether this change is empty, meaning that it represents no modifications to the field\n\t * and could be removed from the ModularChangeset tree without changing its behavior.\n\t */\n\tisEmpty(change: TChangeset): boolean;\n\n\t/**\n\t * @param change - The field change to get the child changes from.\n\t *\n\t * @returns The set of `NodeId`s that correspond to nested changes in the given `change`.\n\t * Each `NodeId` is associated with the following:\n\t * - index of the node in the field in the input context of the changeset (or `undefined` if the node is not\n\t * attached in the input context).\n\t * - index of the node in the field in the output context of the changeset (or `undefined` if the node is not\n\t * attached in the output context).\n\t * For all returned entries where the index is defined,\n\t * the indices are are ordered from smallest to largest (with no duplicates).\n\t * The returned array is owned by the caller.\n\t */\n\tgetNestedChanges(change: TChangeset): NestedChangesIndices;\n\n\t/**\n\t * @returns A list of all cross-field keys contained in the change.\n\t * This should not include cross-field keys in descendant fields.\n\t */\n\tgetCrossFieldKeys(change: TChangeset): CrossFieldKeyRange[];\n\n\tcreateEmpty(): TChangeset;\n}\n\nexport interface FieldChangeRebaser<TChangeset> {\n\t/**\n\t * Compose a collection of changesets into a single one.\n\t * For each node which has a change in both changesets, `composeChild` must be called\n\t * and the result used as the composite node change.\n\t * Calling `composeChild` when one of the changesets has no node change is unnecessary but tolerated.\n\t * See `ChangeRebaser` for more details.\n\t */\n\tcompose(\n\t\tchange1: TChangeset,\n\t\tchange2: TChangeset,\n\t\tcomposeChild: NodeChangeComposer,\n\t\tgenId: IdAllocator,\n\t\tcrossFieldManager: CrossFieldManager,\n\t\trevisionMetadata: RevisionMetadataSource,\n\t): TChangeset;\n\n\t/**\n\t * @returns the inverse of `changes`.\n\t * See `ChangeRebaser` for details.\n\t */\n\tinvert(\n\t\tchange: TChangeset,\n\t\tisRollback: boolean,\n\t\tgenId: IdAllocator,\n\t\trevision: RevisionTag | undefined,\n\t\tcrossFieldManager: CrossFieldManager,\n\t\trevisionMetadata: RevisionMetadataSource,\n\t): TChangeset;\n\n\t/**\n\t * Rebase `change` over `over`.\n\t * See `ChangeRebaser` for details.\n\t */\n\trebase(\n\t\tchange: TChangeset,\n\t\tover: TChangeset,\n\t\trebaseChild: NodeChangeRebaser,\n\t\tgenId: IdAllocator,\n\t\tcrossFieldManager: CrossFieldManager,\n\t\trevisionMetadata: RebaseRevisionMetadata,\n\t): TChangeset;\n\n\t/**\n\t * @returns `change` with any empty child node changesets removed.\n\t */\n\tprune(change: TChangeset, pruneChild: NodeChangePruner): TChangeset;\n\n\treplaceRevisions(change: TChangeset, replacer: RevisionReplacer): TChangeset;\n\n\t/**\n\t * Returns a copy of the given changeset with the same declarations (e.g., new cells) but no actual changes.\n\t * This is a kludge. TODO: remove once AB#46104 is completed.\n\t */\n\tmute(change: TChangeset): TChangeset;\n}\n\n/**\n * Helper for creating a {@link FieldChangeRebaser} which does not need access to revision tags.\n * This should only be used for fields where the child nodes cannot be edited.\n */\nexport function referenceFreeFieldChangeRebaser<TChangeset>(data: {\n\tcompose: (change1: TChangeset, change2: TChangeset) => TChangeset;\n\tinvert: (change: TChangeset) => TChangeset;\n\trebase: (change: TChangeset, over: TChangeset) => TChangeset;\n\tmute: (change: TChangeset) => TChangeset;\n}): FieldChangeRebaser<TChangeset> {\n\treturn isolatedFieldChangeRebaser({\n\t\tcompose: (change1, change2, _composeChild, _genId) => data.compose(change1, change2),\n\t\tinvert: (change, _invertChild, _genId) => data.invert(change),\n\t\trebase: (change, over, _rebaseChild, _genId) => data.rebase(change, over),\n\t\tmute: (change) => data.mute(change),\n\t});\n}\n\nexport function isolatedFieldChangeRebaser<TChangeset>(data: {\n\tcompose: FieldChangeRebaser<TChangeset>[\"compose\"];\n\tinvert: FieldChangeRebaser<TChangeset>[\"invert\"];\n\trebase: FieldChangeRebaser<TChangeset>[\"rebase\"];\n\tmute: FieldChangeRebaser<TChangeset>[\"mute\"];\n}): FieldChangeRebaser<TChangeset> {\n\treturn {\n\t\t...data,\n\t\tprune: (change) => change,\n\t\treplaceRevisions: (change) => change,\n\t};\n}\n\nexport interface FieldEditor<TChangeset> {\n\t/**\n\t * Creates a changeset which represents the given changes to the children of this editor's field.\n\t * For each element in the given iterable\n\t * - The number represents the index of the child node in the field.\n\t * - The `NodeId` represents the nested changes for that child node.\n\t * Note: The indices in the iterable must be ordered from smallest to largest (with no duplicates).\n\t */\n\tbuildChildChanges(changes: Iterable<[index: number, change: NodeId]>): TChangeset;\n}\n\n/**\n * The `index` represents the index of the child node in the input context.\n * The `index` should be `undefined` iff the child node does not exist in the input context (e.g., an inserted node).\n */\nexport type ToDelta = (child: NodeId) => DeltaFieldMap;\n\nexport type NodeChangeInverter = (change: NodeId) => NodeId;\n\nexport enum NodeAttachState {\n\tAttached,\n\tDetached,\n}\n\nexport type NodeChangeRebaser = (\n\tchange: NodeId | undefined,\n\tbaseChange: NodeId | undefined,\n\t/**\n\t * Whether the node is attached to this field in the output context of the base change.\n\t * Defaults to attached if undefined.\n\t */\n\tstate?: NodeAttachState,\n) => NodeId | undefined;\n\nexport type NodeChangeComposer = (\n\tchange1: NodeId | undefined,\n\tchange2: NodeId | undefined,\n) => NodeId;\n\nexport type NodeChangePruner = (change: NodeId) => NodeId | undefined;\n\n/**\n * A function that returns the set of removed roots that should be in memory for a given node changeset to be applied.\n */\nexport type RelevantRemovedRootsFromChild = (child: NodeId) => Iterable<DeltaDetachedNodeId>;\n\nexport interface RebaseRevisionMetadata extends RevisionMetadataSource {\n\treadonly getRevisionToRebase: () => RevisionTag | undefined;\n\treadonly getBaseRevisions: () => RevisionTag[];\n}\n\nexport interface FieldChangeEncodingContext {\n\treadonly baseContext: ChangeEncodingContext;\n\tencodeNode(nodeId: NodeId): EncodedNodeChangeset;\n\tdecodeNode(encodedNode: EncodedNodeChangeset): NodeId;\n}\n"]}
1
+ {"version":3,"file":"fieldChangeHandler.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/fieldChangeHandler.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA4KH;;;GAGG;AACH,SAAgB,+BAA+B,CAAa,IAK3D;IACA,OAAO,0BAA0B,CAAC;QACjC,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC;QACpF,MAAM,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QAC7D,MAAM,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC;QACzE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;KACnC,CAAC,CAAC;AACJ,CAAC;AAZD,0EAYC;AAED,SAAgB,0BAA0B,CAAa,IAKtD;IACA,OAAO;QACN,GAAG,IAAI;QACP,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM;QACzB,gBAAgB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM;KACpC,CAAC;AACH,CAAC;AAXD,gEAWC;AAqBD,IAAY,eAGX;AAHD,WAAY,eAAe;IAC1B,6DAAQ,CAAA;IACR,6DAAQ,CAAA;AACT,CAAC,EAHW,eAAe,+BAAf,eAAe,QAG1B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ICodecFamily, JsonCodecPart } from \"../../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tDeltaDetachedNodeChanges,\n\tDeltaDetachedNodeId,\n\tDeltaDetachedNodeRename,\n\tDeltaFieldChanges,\n\tDeltaFieldMap,\n\tRevisionMetadataSource,\n\tRevisionReplacer,\n\tRevisionTag,\n\tRevisionTagSchema,\n} from \"../../core/index.js\";\nimport type { IdAllocator, Invariant } from \"../../util/index.js\";\n\nimport type { CrossFieldManager } from \"./crossFieldQueries.js\";\nimport type { EncodedNodeChangeset } from \"./modularChangeFormatV1.js\";\nimport type { CrossFieldKeyRange, NodeId } from \"./modularChangeTypes.js\";\n\nexport type NestedChangesIndices = [\n\tNodeId,\n\tnumber | undefined /* inputIndex */,\n\tnumber | undefined /* outputIndex */,\n][];\n\n/**\n * The return value of calling {@link FieldChangeHandler.intoDelta}.\n */\nexport interface FieldChangeDelta {\n\t/**\n\t * {@inheritdoc DeltaFieldChanges}\n\t */\n\treadonly local?: DeltaFieldChanges;\n\t/**\n\t * {@inheritdoc DeltaRoot.global}\n\t */\n\treadonly global?: readonly DeltaDetachedNodeChanges[];\n\t/**\n\t * {@inheritdoc DeltaRoot.rename}\n\t */\n\treadonly rename?: readonly DeltaDetachedNodeRename[];\n}\n\n/**\n * Functionality provided by a field kind which will be composed with other `FieldChangeHandler`s to\n * implement a unified ChangeFamily supporting documents with multiple field kinds.\n */\nexport interface FieldChangeHandler<\n\tTChangeset,\n\tTEditor extends FieldEditor<TChangeset> = FieldEditor<TChangeset>,\n> {\n\t_typeCheck?: Invariant<TChangeset>;\n\treadonly rebaser: FieldChangeRebaser<TChangeset>;\n\treadonly codecsFactory: (\n\t\trevisionTagCodec: JsonCodecPart<\n\t\t\tRevisionTag,\n\t\t\ttypeof RevisionTagSchema,\n\t\t\tChangeEncodingContext\n\t\t>,\n\t) => ICodecFamily<TChangeset, FieldChangeEncodingContext>;\n\treadonly editor: TEditor;\n\tintoDelta(change: TChangeset, deltaFromChild: ToDelta): FieldChangeDelta;\n\t/**\n\t * Returns the set of removed roots that should be in memory for the given change to be applied.\n\t * A removed root is relevant if any of the following is true:\n\t * - It is being inserted\n\t * - It is being restored\n\t * - It is being edited\n\t * - The ID it is associated with is being changed\n\t *\n\t * Implementations are allowed to be conservative by returning more removed roots than strictly necessary\n\t * (though they should, for the sake of performance, try to avoid doing so).\n\t *\n\t * Implementations are not allowed to return IDs for non-root trees, even if they are removed.\n\t *\n\t * @param change - The change to be applied.\n\t * @param relevantRemovedRootsFromChild - Delegate for collecting relevant removed roots from child changes.\n\t */\n\treadonly relevantRemovedRoots: (\n\t\tchange: TChangeset,\n\t\trelevantRemovedRootsFromChild: RelevantRemovedRootsFromChild,\n\t) => Iterable<DeltaDetachedNodeId>;\n\n\t/**\n\t * Returns whether this change is empty, meaning that it represents no modifications to the field\n\t * and could be removed from the ModularChangeset tree without changing its behavior.\n\t */\n\tisEmpty(change: TChangeset): boolean;\n\n\t/**\n\t * @param change - The field change to get the child changes from.\n\t *\n\t * @returns The set of `NodeId`s that correspond to nested changes in the given `change`.\n\t * Each `NodeId` is associated with the following:\n\t * - index of the node in the field in the input context of the changeset (or `undefined` if the node is not\n\t * attached in the input context).\n\t * - index of the node in the field in the output context of the changeset (or `undefined` if the node is not\n\t * attached in the output context).\n\t * For all returned entries where the index is defined,\n\t * the indices are are ordered from smallest to largest (with no duplicates).\n\t * The returned array is owned by the caller.\n\t */\n\tgetNestedChanges(change: TChangeset): NestedChangesIndices;\n\n\t/**\n\t * @returns A list of all cross-field keys contained in the change.\n\t * This should not include cross-field keys in descendant fields.\n\t */\n\tgetCrossFieldKeys(change: TChangeset): CrossFieldKeyRange[];\n\n\tcreateEmpty(): TChangeset;\n}\n\nexport interface FieldChangeRebaser<TChangeset> {\n\t/**\n\t * Compose a collection of changesets into a single one.\n\t * For each node which has a change in both changesets, `composeChild` must be called\n\t * and the result used as the composite node change.\n\t * Calling `composeChild` when one of the changesets has no node change is unnecessary but tolerated.\n\t * See `ChangeRebaser` for more details.\n\t */\n\tcompose(\n\t\tchange1: TChangeset,\n\t\tchange2: TChangeset,\n\t\tcomposeChild: NodeChangeComposer,\n\t\tgenId: IdAllocator,\n\t\tcrossFieldManager: CrossFieldManager,\n\t\trevisionMetadata: RevisionMetadataSource,\n\t): TChangeset;\n\n\t/**\n\t * @returns the inverse of `changes`.\n\t * See `ChangeRebaser` for details.\n\t */\n\tinvert(\n\t\tchange: TChangeset,\n\t\tisRollback: boolean,\n\t\tgenId: IdAllocator,\n\t\trevision: RevisionTag | undefined,\n\t\tcrossFieldManager: CrossFieldManager,\n\t\trevisionMetadata: RevisionMetadataSource,\n\t): TChangeset;\n\n\t/**\n\t * Rebase `change` over `over`.\n\t * See `ChangeRebaser` for details.\n\t */\n\trebase(\n\t\tchange: TChangeset,\n\t\tover: TChangeset,\n\t\trebaseChild: NodeChangeRebaser,\n\t\tgenId: IdAllocator,\n\t\tcrossFieldManager: CrossFieldManager,\n\t\trevisionMetadata: RebaseRevisionMetadata,\n\t): TChangeset;\n\n\t/**\n\t * @returns `change` with any empty child node changesets removed.\n\t */\n\tprune(change: TChangeset, pruneChild: NodeChangePruner): TChangeset;\n\n\treplaceRevisions(change: TChangeset, replacer: RevisionReplacer): TChangeset;\n\n\t/**\n\t * Returns a copy of the given changeset with the same declarations (e.g., new cells) but no actual changes.\n\t * This is a kludge. TODO: remove once AB#46104 is completed.\n\t */\n\tmute(change: TChangeset): TChangeset;\n}\n\n/**\n * Helper for creating a {@link FieldChangeRebaser} which does not need access to revision tags.\n * This should only be used for fields where the child nodes cannot be edited.\n */\nexport function referenceFreeFieldChangeRebaser<TChangeset>(data: {\n\tcompose: (change1: TChangeset, change2: TChangeset) => TChangeset;\n\tinvert: (change: TChangeset) => TChangeset;\n\trebase: (change: TChangeset, over: TChangeset) => TChangeset;\n\tmute: (change: TChangeset) => TChangeset;\n}): FieldChangeRebaser<TChangeset> {\n\treturn isolatedFieldChangeRebaser({\n\t\tcompose: (change1, change2, _composeChild, _genId) => data.compose(change1, change2),\n\t\tinvert: (change, _invertChild, _genId) => data.invert(change),\n\t\trebase: (change, over, _rebaseChild, _genId) => data.rebase(change, over),\n\t\tmute: (change) => data.mute(change),\n\t});\n}\n\nexport function isolatedFieldChangeRebaser<TChangeset>(data: {\n\tcompose: FieldChangeRebaser<TChangeset>[\"compose\"];\n\tinvert: FieldChangeRebaser<TChangeset>[\"invert\"];\n\trebase: FieldChangeRebaser<TChangeset>[\"rebase\"];\n\tmute: FieldChangeRebaser<TChangeset>[\"mute\"];\n}): FieldChangeRebaser<TChangeset> {\n\treturn {\n\t\t...data,\n\t\tprune: (change) => change,\n\t\treplaceRevisions: (change) => change,\n\t};\n}\n\nexport interface FieldEditor<TChangeset> {\n\t/**\n\t * Creates a changeset which represents the given changes to the children of this editor's field.\n\t * For each element in the given iterable\n\t * - The number represents the index of the child node in the field.\n\t * - The `NodeId` represents the nested changes for that child node.\n\t * Note: The indices in the iterable must be ordered from smallest to largest (with no duplicates).\n\t */\n\tbuildChildChanges(changes: Iterable<[index: number, change: NodeId]>): TChangeset;\n}\n\n/**\n * The `index` represents the index of the child node in the input context.\n * The `index` should be `undefined` iff the child node does not exist in the input context (e.g., an inserted node).\n */\nexport type ToDelta = (child: NodeId) => DeltaFieldMap;\n\nexport type NodeChangeInverter = (change: NodeId) => NodeId;\n\nexport enum NodeAttachState {\n\tAttached,\n\tDetached,\n}\n\nexport type NodeChangeRebaser = (\n\tchange: NodeId | undefined,\n\tbaseChange: NodeId | undefined,\n\t/**\n\t * Whether the node is attached to this field in the output context of the base change.\n\t * Defaults to attached if undefined.\n\t */\n\tstate?: NodeAttachState,\n) => NodeId | undefined;\n\nexport type NodeChangeComposer = (\n\tchange1: NodeId | undefined,\n\tchange2: NodeId | undefined,\n) => NodeId;\n\nexport type NodeChangePruner = (change: NodeId) => NodeId | undefined;\n\n/**\n * A function that returns the set of removed roots that should be in memory for a given node changeset to be applied.\n */\nexport type RelevantRemovedRootsFromChild = (child: NodeId) => Iterable<DeltaDetachedNodeId>;\n\nexport interface RebaseRevisionMetadata extends RevisionMetadataSource {\n\treadonly getRevisionToRebase: () => RevisionTag | undefined;\n\treadonly getBaseRevisions: () => RevisionTag[];\n}\n\nexport interface FieldChangeEncodingContext {\n\treadonly baseContext: ChangeEncodingContext;\n\tencodeNode(nodeId: NodeId): EncodedNodeChangeset;\n\tdecodeNode(encodedNode: EncodedNodeChangeset): NodeId;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"genericFieldKind.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/genericFieldKind.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,OAAO,KAAK,EAEX,kBAAkB,EAOlB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAGxF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,kBAAkB,CAAC,gBAAgB,CAkCrE,CAAC;AA8FF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAO9B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAC3C,SAAS,EAAE,gBAAgB,EAC3B,MAAM,EAAE,kBAAkB,CAAC,OAAO,CAAC,GACjC,OAAO,CAET"}
1
+ {"version":3,"file":"genericFieldKind.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/genericFieldKind.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,OAAO,KAAK,EAEX,kBAAkB,EAOlB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAGxF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,kBAAkB,CAAC,gBAAgB,CAkCrE,CAAC;AA6FF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAO9B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAC3C,SAAS,EAAE,gBAAgB,EAC3B,MAAM,EAAE,kBAAkB,CAAC,OAAO,CAAC,GACjC,OAAO,CAET"}
@@ -66,7 +66,6 @@ function getNestedChanges(change) {
66
66
  function rebaseGenericChange(change, over, rebaseChild) {
67
67
  const rebased = new sorted_btree_es6_1.BTree();
68
68
  let nextIndex = 0;
69
- // eslint-disable-next-line no-constant-condition
70
69
  while (true) {
71
70
  const newEntry = change.getPairOrNextHigher(nextIndex);
72
71
  const baseEntry = over.getPairOrNextHigher(nextIndex);
@@ -1 +1 @@
1
- {"version":3,"file":"genericFieldKind.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/genericFieldKind.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH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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\";\nimport { BTree } from \"@tylerbu/sorted-btree-es6\";\n\nimport {\n\ttype DeltaDetachedNodeId,\n\ttype DeltaMark,\n\ttype FieldKindIdentifier,\n\tMultiplicity,\n\ttype RevisionReplacer,\n} from \"../../core/index.js\";\nimport { brandConst } from \"../../util/index.js\";\n\nimport type {\n\tFieldChangeDelta,\n\tFieldChangeHandler,\n\tNestedChangesIndices,\n\tNodeChangeComposer,\n\tNodeChangePruner,\n\tNodeChangeRebaser,\n\tRelevantRemovedRootsFromChild,\n\tToDelta,\n} from \"./fieldChangeHandler.js\";\nimport { FlexFieldKind } from \"./fieldKind.js\";\nimport { makeGenericChangeCodec } from \"./genericFieldKindCodecs.js\";\nimport { newGenericChangeset, type GenericChangeset } from \"./genericFieldKindTypes.js\";\nimport type { NodeId } from \"./modularChangeTypes.js\";\n\n/**\n * {@link FieldChangeHandler} implementation for {@link GenericChangeset}.\n */\nexport const genericChangeHandler: FieldChangeHandler<GenericChangeset> = {\n\trebaser: {\n\t\tcompose,\n\t\tinvert: (change: GenericChangeset): GenericChangeset => change,\n\t\trebase: rebaseGenericChange,\n\t\tprune: pruneGenericChange,\n\t\treplaceRevisions,\n\t\tmute: (change: GenericChangeset): GenericChangeset => change,\n\t},\n\tcodecsFactory: makeGenericChangeCodec,\n\teditor: {\n\t\tbuildChildChanges(changes: Iterable<[number, NodeId]>): GenericChangeset {\n\t\t\treturn newGenericChangeset([...changes]);\n\t\t},\n\t},\n\tintoDelta: (change: GenericChangeset, deltaFromChild: ToDelta): FieldChangeDelta => {\n\t\tlet nodeIndex = 0;\n\t\tconst markList: DeltaMark[] = [];\n\t\tfor (const [index, nodeChange] of change.entries()) {\n\t\t\tif (nodeIndex < index) {\n\t\t\t\tconst offset = index - nodeIndex;\n\t\t\t\tmarkList.push({ count: offset });\n\t\t\t\tnodeIndex = index;\n\t\t\t}\n\t\t\tmarkList.push({ count: 1, fields: deltaFromChild(nodeChange) });\n\t\t\tnodeIndex += 1;\n\t\t}\n\t\treturn { local: { marks: markList } };\n\t},\n\trelevantRemovedRoots,\n\tisEmpty: (change: GenericChangeset): boolean => change.length === 0,\n\tgetNestedChanges,\n\tcreateEmpty: newGenericChangeset,\n\tgetCrossFieldKeys: (_change) => [],\n};\n\nfunction compose(\n\tchange1: GenericChangeset,\n\tchange2: GenericChangeset,\n\tcomposeChildren: NodeChangeComposer,\n): GenericChangeset {\n\tconst composed = change1.clone();\n\tfor (const [index, id2] of change2.entries()) {\n\t\tconst id1 = composed.get(index);\n\t\tconst idComposed = id1 === undefined ? id2 : composeChildren(id1, id2);\n\t\tcomposed.set(index, idComposed);\n\t}\n\n\treturn composed;\n}\n\nfunction getNestedChanges(change: GenericChangeset): NestedChangesIndices {\n\t// For generic changeset, the indices in the input and output contexts are the same.\n\treturn change.toArray().map(([index, nodeChange]) => [nodeChange, index, index]);\n}\n\nfunction rebaseGenericChange(\n\tchange: GenericChangeset,\n\tover: GenericChangeset,\n\trebaseChild: NodeChangeRebaser,\n): GenericChangeset {\n\tconst rebased: GenericChangeset = new BTree();\n\tlet nextIndex = 0;\n\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\tconst newEntry = change.getPairOrNextHigher(nextIndex);\n\t\tconst baseEntry = over.getPairOrNextHigher(nextIndex);\n\n\t\tif (baseEntry === undefined && newEntry === undefined) {\n\t\t\tbreak;\n\t\t}\n\n\t\tconst newIndex = newEntry?.[0] ?? Number.POSITIVE_INFINITY;\n\t\tconst baseIndex = baseEntry?.[0] ?? Number.POSITIVE_INFINITY;\n\t\tlet newNodeChange: NodeId | undefined;\n\t\tlet baseNodeChange: NodeId | undefined;\n\t\tlet index: number;\n\t\tif (newIndex === baseIndex) {\n\t\t\tassert(\n\t\t\t\tnewEntry !== undefined && baseEntry !== undefined,\n\t\t\t\t0xa0d /* Entries should be defined */,\n\t\t\t);\n\t\t\tindex = newIndex;\n\t\t\tnewNodeChange = newEntry[1];\n\t\t\tbaseNodeChange = baseEntry[1];\n\t\t} else if (newIndex < baseIndex) {\n\t\t\tassert(newEntry !== undefined, 0xa0e /* Entry should be defined */);\n\t\t\tindex = newIndex;\n\t\t\tnewNodeChange = newEntry[1];\n\t\t} else {\n\t\t\tassert(baseEntry !== undefined, 0xa0f /* Entry should be defined */);\n\t\t\tindex = baseIndex;\n\t\t\tbaseNodeChange = baseEntry[1];\n\t\t}\n\n\t\tconst nodeChange = rebaseChild(newNodeChange, baseNodeChange);\n\t\tif (nodeChange !== undefined) {\n\t\t\trebased.set(index, nodeChange);\n\t\t}\n\n\t\tnextIndex = index + 1;\n\t}\n\n\treturn rebased;\n}\n\nfunction pruneGenericChange(\n\tchangeset: GenericChangeset,\n\tpruneChild: NodeChangePruner,\n): GenericChangeset {\n\tconst pruned: GenericChangeset = new BTree();\n\tfor (const [index, node] of changeset.entries()) {\n\t\tconst prunedNode = pruneChild(node);\n\t\tif (prunedNode !== undefined) {\n\t\t\tpruned.set(index, node);\n\t\t}\n\t}\n\treturn pruned;\n}\n\nfunction replaceRevisions(\n\tchangeset: GenericChangeset,\n\treplacer: RevisionReplacer,\n): GenericChangeset {\n\treturn changeset.mapValues((node) => replacer.getUpdatedAtomId(node));\n}\n\n/**\n * {@link FieldKind} used to represent changes to elements of a field in a field-kind-agnostic format.\n */\nexport const genericFieldKind: FlexFieldKind = new FlexFieldKind(\n\tbrandConst(\"ModularEditBuilder.Generic\")<FieldKindIdentifier>(),\n\tMultiplicity.Sequence,\n\t{\n\t\tchangeHandler: genericChangeHandler,\n\t\tallowMonotonicUpgradeFrom: new Set(),\n\t},\n);\n\n/**\n * Converts a {@link GenericChangeset} into a field-kind-specific `TChange`.\n * @param changeset - The generic changeset to convert.\n * @param target - The {@link FieldChangeHandler} for the `FieldKind` that the returned change should target.\n * @param composeChild - A delegate to compose {@link NodeChangeset}s.\n * @returns An equivalent changeset as represented by the `target` field-kind.\n */\nexport function convertGenericChange<TChange>(\n\tchangeset: GenericChangeset,\n\ttarget: FieldChangeHandler<TChange>,\n): TChange {\n\treturn target.editor.buildChildChanges(changeset.entries());\n}\n\nfunction* relevantRemovedRoots(\n\tchange: GenericChangeset,\n\trelevantRemovedRootsFromChild: RelevantRemovedRootsFromChild,\n): Iterable<DeltaDetachedNodeId> {\n\tfor (const nodeChange of change.values()) {\n\t\tyield* relevantRemovedRootsFromChild(nodeChange);\n\t}\n}\n"]}
1
+ {"version":3,"file":"genericFieldKind.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/genericFieldKind.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAC7D,gEAAkD;AAElD,kDAM6B;AAC7B,kDAAiD;AAYjD,iDAA+C;AAC/C,2EAAqE;AACrE,yEAAwF;AAGxF;;GAEG;AACU,QAAA,oBAAoB,GAAyC;IACzE,OAAO,EAAE;QACR,OAAO;QACP,MAAM,EAAE,CAAC,MAAwB,EAAoB,EAAE,CAAC,MAAM;QAC9D,MAAM,EAAE,mBAAmB;QAC3B,KAAK,EAAE,kBAAkB;QACzB,gBAAgB;QAChB,IAAI,EAAE,CAAC,MAAwB,EAAoB,EAAE,CAAC,MAAM;KAC5D;IACD,aAAa,EAAE,kDAAsB;IACrC,MAAM,EAAE;QACP,iBAAiB,CAAC,OAAmC;YACpD,OAAO,IAAA,8CAAmB,EAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;QAC1C,CAAC;KACD;IACD,SAAS,EAAE,CAAC,MAAwB,EAAE,cAAuB,EAAoB,EAAE;QAClF,IAAI,SAAS,GAAG,CAAC,CAAC;QAClB,MAAM,QAAQ,GAAgB,EAAE,CAAC;QACjC,KAAK,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;YACpD,IAAI,SAAS,GAAG,KAAK,EAAE,CAAC;gBACvB,M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B;IACnC,yBAAyB,EAAE,IAAI,GAAG,EAAE;CACpC,CACD,CAAC;AAEF;;;;;;GAMG;AACH,SAAgB,oBAAoB,CACnC,SAA2B,EAC3B,MAAmC;IAEnC,OAAO,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;AAC7D,CAAC;AALD,oDAKC;AAED,QAAQ,CAAC,CAAC,oBAAoB,CAC7B,MAAwB,EACxB,6BAA4D;IAE5D,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;QAC1C,KAAK,CAAC,CAAC,6BAA6B,CAAC,UAAU,CAAC,CAAC;IAClD,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\";\nimport { BTree } from \"@tylerbu/sorted-btree-es6\";\n\nimport {\n\ttype DeltaDetachedNodeId,\n\ttype DeltaMark,\n\ttype FieldKindIdentifier,\n\tMultiplicity,\n\ttype RevisionReplacer,\n} from \"../../core/index.js\";\nimport { brandConst } from \"../../util/index.js\";\n\nimport type {\n\tFieldChangeDelta,\n\tFieldChangeHandler,\n\tNestedChangesIndices,\n\tNodeChangeComposer,\n\tNodeChangePruner,\n\tNodeChangeRebaser,\n\tRelevantRemovedRootsFromChild,\n\tToDelta,\n} from \"./fieldChangeHandler.js\";\nimport { FlexFieldKind } from \"./fieldKind.js\";\nimport { makeGenericChangeCodec } from \"./genericFieldKindCodecs.js\";\nimport { newGenericChangeset, type GenericChangeset } from \"./genericFieldKindTypes.js\";\nimport type { NodeId } from \"./modularChangeTypes.js\";\n\n/**\n * {@link FieldChangeHandler} implementation for {@link GenericChangeset}.\n */\nexport const genericChangeHandler: FieldChangeHandler<GenericChangeset> = {\n\trebaser: {\n\t\tcompose,\n\t\tinvert: (change: GenericChangeset): GenericChangeset => change,\n\t\trebase: rebaseGenericChange,\n\t\tprune: pruneGenericChange,\n\t\treplaceRevisions,\n\t\tmute: (change: GenericChangeset): GenericChangeset => change,\n\t},\n\tcodecsFactory: makeGenericChangeCodec,\n\teditor: {\n\t\tbuildChildChanges(changes: Iterable<[number, NodeId]>): GenericChangeset {\n\t\t\treturn newGenericChangeset([...changes]);\n\t\t},\n\t},\n\tintoDelta: (change: GenericChangeset, deltaFromChild: ToDelta): FieldChangeDelta => {\n\t\tlet nodeIndex = 0;\n\t\tconst markList: DeltaMark[] = [];\n\t\tfor (const [index, nodeChange] of change.entries()) {\n\t\t\tif (nodeIndex < index) {\n\t\t\t\tconst offset = index - nodeIndex;\n\t\t\t\tmarkList.push({ count: offset });\n\t\t\t\tnodeIndex = index;\n\t\t\t}\n\t\t\tmarkList.push({ count: 1, fields: deltaFromChild(nodeChange) });\n\t\t\tnodeIndex += 1;\n\t\t}\n\t\treturn { local: { marks: markList } };\n\t},\n\trelevantRemovedRoots,\n\tisEmpty: (change: GenericChangeset): boolean => change.length === 0,\n\tgetNestedChanges,\n\tcreateEmpty: newGenericChangeset,\n\tgetCrossFieldKeys: (_change) => [],\n};\n\nfunction compose(\n\tchange1: GenericChangeset,\n\tchange2: GenericChangeset,\n\tcomposeChildren: NodeChangeComposer,\n): GenericChangeset {\n\tconst composed = change1.clone();\n\tfor (const [index, id2] of change2.entries()) {\n\t\tconst id1 = composed.get(index);\n\t\tconst idComposed = id1 === undefined ? id2 : composeChildren(id1, id2);\n\t\tcomposed.set(index, idComposed);\n\t}\n\n\treturn composed;\n}\n\nfunction getNestedChanges(change: GenericChangeset): NestedChangesIndices {\n\t// For generic changeset, the indices in the input and output contexts are the same.\n\treturn change.toArray().map(([index, nodeChange]) => [nodeChange, index, index]);\n}\n\nfunction rebaseGenericChange(\n\tchange: GenericChangeset,\n\tover: GenericChangeset,\n\trebaseChild: NodeChangeRebaser,\n): GenericChangeset {\n\tconst rebased: GenericChangeset = new BTree();\n\tlet nextIndex = 0;\n\n\twhile (true) {\n\t\tconst newEntry = change.getPairOrNextHigher(nextIndex);\n\t\tconst baseEntry = over.getPairOrNextHigher(nextIndex);\n\n\t\tif (baseEntry === undefined && newEntry === undefined) {\n\t\t\tbreak;\n\t\t}\n\n\t\tconst newIndex = newEntry?.[0] ?? Number.POSITIVE_INFINITY;\n\t\tconst baseIndex = baseEntry?.[0] ?? Number.POSITIVE_INFINITY;\n\t\tlet newNodeChange: NodeId | undefined;\n\t\tlet baseNodeChange: NodeId | undefined;\n\t\tlet index: number;\n\t\tif (newIndex === baseIndex) {\n\t\t\tassert(\n\t\t\t\tnewEntry !== undefined && baseEntry !== undefined,\n\t\t\t\t0xa0d /* Entries should be defined */,\n\t\t\t);\n\t\t\tindex = newIndex;\n\t\t\tnewNodeChange = newEntry[1];\n\t\t\tbaseNodeChange = baseEntry[1];\n\t\t} else if (newIndex < baseIndex) {\n\t\t\tassert(newEntry !== undefined, 0xa0e /* Entry should be defined */);\n\t\t\tindex = newIndex;\n\t\t\tnewNodeChange = newEntry[1];\n\t\t} else {\n\t\t\tassert(baseEntry !== undefined, 0xa0f /* Entry should be defined */);\n\t\t\tindex = baseIndex;\n\t\t\tbaseNodeChange = baseEntry[1];\n\t\t}\n\n\t\tconst nodeChange = rebaseChild(newNodeChange, baseNodeChange);\n\t\tif (nodeChange !== undefined) {\n\t\t\trebased.set(index, nodeChange);\n\t\t}\n\n\t\tnextIndex = index + 1;\n\t}\n\n\treturn rebased;\n}\n\nfunction pruneGenericChange(\n\tchangeset: GenericChangeset,\n\tpruneChild: NodeChangePruner,\n): GenericChangeset {\n\tconst pruned: GenericChangeset = new BTree();\n\tfor (const [index, node] of changeset.entries()) {\n\t\tconst prunedNode = pruneChild(node);\n\t\tif (prunedNode !== undefined) {\n\t\t\tpruned.set(index, node);\n\t\t}\n\t}\n\treturn pruned;\n}\n\nfunction replaceRevisions(\n\tchangeset: GenericChangeset,\n\treplacer: RevisionReplacer,\n): GenericChangeset {\n\treturn changeset.mapValues((node) => replacer.getUpdatedAtomId(node));\n}\n\n/**\n * {@link FieldKind} used to represent changes to elements of a field in a field-kind-agnostic format.\n */\nexport const genericFieldKind: FlexFieldKind = new FlexFieldKind(\n\tbrandConst(\"ModularEditBuilder.Generic\")<FieldKindIdentifier>(),\n\tMultiplicity.Sequence,\n\t{\n\t\tchangeHandler: genericChangeHandler,\n\t\tallowMonotonicUpgradeFrom: new Set(),\n\t},\n);\n\n/**\n * Converts a {@link GenericChangeset} into a field-kind-specific `TChange`.\n * @param changeset - The generic changeset to convert.\n * @param target - The {@link FieldChangeHandler} for the `FieldKind` that the returned change should target.\n * @param composeChild - A delegate to compose {@link NodeChangeset}s.\n * @returns An equivalent changeset as represented by the `target` field-kind.\n */\nexport function convertGenericChange<TChange>(\n\tchangeset: GenericChangeset,\n\ttarget: FieldChangeHandler<TChange>,\n): TChange {\n\treturn target.editor.buildChildChanges(changeset.entries());\n}\n\nfunction* relevantRemovedRoots(\n\tchange: GenericChangeset,\n\trelevantRemovedRootsFromChild: RelevantRemovedRootsFromChild,\n): Iterable<DeltaDetachedNodeId> {\n\tfor (const nodeChange of change.values()) {\n\t\tyield* relevantRemovedRootsFromChild(nodeChange);\n\t}\n}\n"]}
@@ -3,8 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { TAnySchema } from "@sinclair/typebox";
6
- import { type ICodecOptions, type IJsonCodec, type SchemaValidationFunction } from "../../codec/index.js";
7
- import type { ChangeEncodingContext, EncodedRevisionTag, FieldKindIdentifier, RevisionInfo, RevisionTag } from "../../core/index.js";
6
+ import { type ICodecOptions, type IJsonCodec, type JsonCodecPart, type SchemaValidationFunction } from "../../codec/index.js";
7
+ import type { ChangeEncodingContext, FieldKindIdentifier, RevisionInfo, RevisionTag, RevisionTagSchema } from "../../core/index.js";
8
8
  import { type IdAllocator, type JsonCompatibleReadOnly, type Mutable } from "../../util/index.js";
9
9
  import { type ChangeAtomIdBTree } from "../changeAtomIdBTree.js";
10
10
  import { type FieldBatchCodec, type TreeChunk } from "../chunked-forest/index.js";
@@ -28,22 +28,22 @@ export declare function encodeFieldChangesForJsonI(change: FieldChangeMap, conte
28
28
  export declare function encodeNodeChangesForJson(change: NodeChangeset, context: FieldChangeEncodingContext, fieldChangesetCodecs: FieldChangesetCodecs): EncodedNodeChangeset;
29
29
  export declare function decodeFieldChangesFromJson(encodedChange: EncodedFieldChangeMap, parentId: NodeId | undefined, decoded: ModularChangeset, context: ChangeEncodingContext, idAllocator: IdAllocator, fieldKinds: FieldKindConfiguration, fieldChangesetCodecs: FieldChangesetCodecs): FieldChangeMap;
30
30
  export declare function decodeNodeChangesetFromJson(encodedChange: EncodedNodeChangeset, id: NodeId, decoded: ModularChangeset, context: ChangeEncodingContext, idAllocator: IdAllocator, fieldKinds: FieldKindConfiguration, fieldChangesetCodecs: FieldChangesetCodecs): NodeChangeset;
31
- export declare function encodeDetachedNodes(detachedNodes: ChangeAtomIdBTree<TreeChunk> | undefined, context: ChangeEncodingContext, revisionTagCodec: IJsonCodec<RevisionTag, EncodedRevisionTag, EncodedRevisionTag, ChangeEncodingContext>, fieldsCodec: FieldBatchCodec, chunkCompressionStrategy: TreeCompressionStrategy): EncodedBuilds | undefined;
32
- export declare function decodeDetachedNodes(encoded: EncodedBuilds | undefined, context: ChangeEncodingContext, revisionTagCodec: IJsonCodec<RevisionTag, EncodedRevisionTag, EncodedRevisionTag, ChangeEncodingContext>, fieldsCodec: FieldBatchCodec, chunkCompressionStrategy: TreeCompressionStrategy): ChangeAtomIdBTree<TreeChunk> | undefined;
33
- export declare function encodeRevisionInfos(revisions: readonly RevisionInfo[], context: ChangeEncodingContext, revisionTagCodec: IJsonCodec<RevisionTag, EncodedRevisionTag, EncodedRevisionTag, ChangeEncodingContext>): EncodedRevisionInfo[] | undefined;
34
- export declare function decodeRevisionInfos(revisions: readonly EncodedRevisionInfo[] | undefined, context: ChangeEncodingContext, revisionTagCodec: IJsonCodec<RevisionTag, EncodedRevisionTag, EncodedRevisionTag, ChangeEncodingContext>): RevisionInfo[] | undefined;
31
+ export declare function encodeDetachedNodes(detachedNodes: ChangeAtomIdBTree<TreeChunk> | undefined, context: ChangeEncodingContext, revisionTagCodec: JsonCodecPart<RevisionTag, typeof RevisionTagSchema, ChangeEncodingContext>, fieldsCodec: FieldBatchCodec, chunkCompressionStrategy: TreeCompressionStrategy): EncodedBuilds | undefined;
32
+ export declare function decodeDetachedNodes(encoded: EncodedBuilds | undefined, context: ChangeEncodingContext, revisionTagCodec: JsonCodecPart<RevisionTag, typeof RevisionTagSchema, ChangeEncodingContext>, fieldsCodec: FieldBatchCodec, chunkCompressionStrategy: TreeCompressionStrategy): ChangeAtomIdBTree<TreeChunk> | undefined;
33
+ export declare function encodeRevisionInfos(revisions: readonly RevisionInfo[], context: ChangeEncodingContext, revisionTagCodec: JsonCodecPart<RevisionTag, typeof RevisionTagSchema, ChangeEncodingContext>): EncodedRevisionInfo[] | undefined;
34
+ export declare function decodeRevisionInfos(revisions: readonly EncodedRevisionInfo[] | undefined, context: ChangeEncodingContext, revisionTagCodec: JsonCodecPart<RevisionTag, typeof RevisionTagSchema, ChangeEncodingContext>): RevisionInfo[] | undefined;
35
35
  export declare function encodeChange(change: ModularChangeset, context: ChangeEncodingContext, fieldChangesetCodecs: Map<FieldKindIdentifier, {
36
36
  compiledSchema?: SchemaValidationFunction<TAnySchema>;
37
37
  codec: FieldCodec;
38
- }>, revisionTagCodec: IJsonCodec<RevisionTag, EncodedRevisionTag, EncodedRevisionTag, ChangeEncodingContext>, fieldsCodec: FieldBatchCodec, chunkCompressionStrategy: TreeCompressionStrategy): EncodedModularChangesetV1;
38
+ }>, revisionTagCodec: JsonCodecPart<RevisionTag, typeof RevisionTagSchema, ChangeEncodingContext>, fieldsCodec: FieldBatchCodec, chunkCompressionStrategy: TreeCompressionStrategy): EncodedModularChangesetV1;
39
39
  export declare function decodeChange(encodedChange: EncodedModularChangesetV1, context: ChangeEncodingContext, fieldKinds: FieldKindConfiguration, fieldChangesetCodecs: Map<FieldKindIdentifier, {
40
40
  compiledSchema?: SchemaValidationFunction<TAnySchema>;
41
41
  codec: FieldCodec;
42
- }>, revisionTagCodec: IJsonCodec<RevisionTag, EncodedRevisionTag, EncodedRevisionTag, ChangeEncodingContext>, fieldsCodec: FieldBatchCodec, chunkCompressionStrategy: TreeCompressionStrategy): Mutable<ModularChangeset>;
43
- export declare function getFieldChangesetCodecs(fieldKinds: FieldKindConfiguration, revisionTagCodec: IJsonCodec<RevisionTag, EncodedRevisionTag, EncodedRevisionTag, ChangeEncodingContext>, codecOptions: ICodecOptions): Map<FieldKindIdentifier, {
42
+ }>, revisionTagCodec: JsonCodecPart<RevisionTag, typeof RevisionTagSchema, ChangeEncodingContext>, fieldsCodec: FieldBatchCodec, chunkCompressionStrategy: TreeCompressionStrategy): Mutable<ModularChangeset>;
43
+ export declare function getFieldChangesetCodecs(fieldKinds: FieldKindConfiguration, revisionTagCodec: JsonCodecPart<RevisionTag, typeof RevisionTagSchema, ChangeEncodingContext>, codecOptions: ICodecOptions): Map<FieldKindIdentifier, {
44
44
  compiledSchema?: SchemaValidationFunction<TAnySchema>;
45
45
  codec: FieldCodec;
46
46
  }>;
47
- export declare function makeModularChangeCodecV1(fieldKinds: FieldKindConfiguration, revisionTagCodec: IJsonCodec<RevisionTag, EncodedRevisionTag, EncodedRevisionTag, ChangeEncodingContext>, fieldsCodec: FieldBatchCodec, codecOptions: ICodecOptions, chunkCompressionStrategy?: TreeCompressionStrategy): ModularChangeCodec;
47
+ export declare function makeModularChangeCodecV1(fieldKinds: FieldKindConfiguration, revisionTagCodec: JsonCodecPart<RevisionTag, typeof RevisionTagSchema, ChangeEncodingContext>, fieldsCodec: FieldBatchCodec, codecOptions: ICodecOptions, chunkCompressionStrategy?: TreeCompressionStrategy): ModularChangeCodec;
48
48
  export {};
49
49
  //# sourceMappingURL=modularChangeCodecV1.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"modularChangeCodecV1.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-sch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BAAqB,CACrB,EACD,WAAW,EAAE,eAAe,EAC5B,wBAAwB,EAAE,uBAAuB,GAC/C,yBAAyB,CA+B3B;AAED,wBAAgB,YAAY,CAC3B,aAAa,EAAE,yBAAyB,EACxC,OAAO,EAAE,qBAAqB,EAC9B,UAAU,EAAE,sBAAsB,EAClC,oBAAoB,EAAE,GAAG,CACxB,mBAAmB,EACnB;IACC,cAAc,CAAC,EAAE,wBAAwB,CAAC,UAAU,CAAC,CAAC;IACtD,KAAK,EAAE,UAAU,CAAC;CAClB,CACD,EACD,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,WAAW,EAAE,eAAe,EAC5B,wBAAwB,EAAE,uBAAuB,GAC/C,OAAO,CAAC,gBAAgB,CAAC,CAsD3B;AAED,wBAAgB,uBAAuB,CACtC,UAAU,EAAE,sBAAsB,EAClC,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,YAAY,EAAE,aAAa,GACzB,GAAG,CACL,mBAAmB,EACnB;IAAE,cAAc,CAAC,EAAE,wBAAwB,CAAC,UAAU,CAAC,CAAC;IAAC,KAAK,EAAE,UAAU,CAAA;CAAE,CAC5E,CAmCA;AAED,wBAAgB,wBAAwB,CACvC,UAAU,EAAE,sBAAsB,EAClC,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,WAAW,EAAE,eAAe,EAC5B,YAAY,EAAE,aAAa,EAC3B,wBAAwB,GAAE,uBAA4D,GACpF,kBAAkB,CAkCpB"}
1
+ {"version":3,"file":"modularChangeCodecV1.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/modularChangeCodecV1.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE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AAyB,EACxC,OAAO,EAAE,qBAAqB,EAC9B,UAAU,EAAE,sBAAsB,EAClC,oBAAoB,EAAE,GAAG,CACxB,mBAAmB,EACnB;IACC,cAAc,CAAC,EAAE,wBAAwB,CAAC,UAAU,CAAC,CAAC;IACtD,KAAK,EAAE,UAAU,CAAC;CAClB,CACD,EACD,gBAAgB,EAAE,aAAa,CAC9B,WAAW,EACX,OAAO,iBAAiB,EACxB,qBAAqB,CACrB,EACD,WAAW,EAAE,eAAe,EAC5B,wBAAwB,EAAE,uBAAuB,GAC/C,OAAO,CAAC,gBAAgB,CAAC,CAsD3B;AAED,wBAAgB,uBAAuB,CACtC,UAAU,EAAE,sBAAsB,EAClC,gBAAgB,EAAE,aAAa,CAC9B,WAAW,EACX,OAAO,iBAAiB,EACxB,qBAAqB,CACrB,EACD,YAAY,EAAE,aAAa,GACzB,GAAG,CACL,mBAAmB,EACnB;IAAE,cAAc,CAAC,EAAE,wBAAwB,CAAC,UAAU,CAAC,CAAC;IAAC,KAAK,EAAE,UAAU,CAAA;CAAE,CAC5E,CAmCA;AAED,wBAAgB,wBAAwB,CACvC,UAAU,EAAE,sBAAsB,EAClC,gBAAgB,EAAE,aAAa,CAC9B,WAAW,EACX,OAAO,iBAAiB,EACxB,qBAAqB,CACrB,EACD,WAAW,EAAE,eAAe,EAC5B,YAAY,EAAE,aAAa,EAC3B,wBAAwB,GAAE,uBAA4D,GACpF,kBAAkB,CAkCpB"}
@@ -185,10 +185,8 @@ function decodeDetachedNodes(encoded, context, revisionTagCodec, fieldsCodec, ch
185
185
  exports.decodeDetachedNodes = decodeDetachedNodes;
186
186
  function encodeRevisionInfos(revisions, context, revisionTagCodec) {
187
187
  if (context.revision !== undefined) {
188
- (0, internal_1.assert)(
189
- // eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- Using optional chaining here would change behavior: `revisions[0]?.rollbackOf === undefined` is true when revisions[0] is undefined, but this check requires revisions[0] to be defined. As currently written, such a change would be safe because context.revision is included in the check and from a couple lines above is confirmed not undefined. But this more verbose form is clearer.
190
- revisions.length === 1 &&
191
- // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
188
+ (0, internal_1.assert)(revisions.length === 1 &&
189
+ // eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- Using optional chaining here would change behavior: `revisions[0]?.rollbackOf === undefined` is true when revisions[0] is undefined, but this check requires revisions[0] to be defined. As currently written, such a change would be safe because context.revision is included in the check and from a couple lines above is confirmed not undefined. But this more verbose form is clearer.
192
190
  revisions[0] !== undefined &&
193
191
  revisions[0].revision === context.revision &&
194
192
  revisions[0].rollbackOf === undefined, 0x964 /* A tagged change should only contain the tagged revision */);
@@ -1 +1 @@
1
- {"version":3,"file":"modularChangeCodecV1.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/modularChangeCodecV1.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAwE;AAGxE,mDAM8B;AAW9B,kDAM6B;AAC7B,kEAAuF;AACvF,yDAKoC;AACpC,wEAAqE;AAOrE,+DAAyD;AACzD,yEAQoC;AACpC,mEAQiC;AAwBjC,SAAgB,sBAAsB,CACrC,SAA8B,EAC9B,oBAA0C;IAK1C,MAAM,KAAK,GAAG,oBAAoB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAClD,IAAA,iBAAM,EAAC,KAAK,KAAK,SAAS,EAAE,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/E,OAAO,KAAK,CAAC;AACd,CAAC;AAVD,wDAUC;AAED,SAAgB,yBAAyB,CACxC,MAAsB,EACtB,OAA8B,EAC9B,WAA6C,EAC7C,oBAA0C;IAE1C,MAAM,YAAY,GAA+B;QAChD,WAAW,EAAE,OAAO;QAEpB,UAAU,EAAE,CAAC,MAAc,EAAwB,EAAE;YACpD,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;YAChE,IAAA,iB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EACpB,gBAAgB,EAChB,WAAW,EACX,wBAAwB,CACxB;QACF,MAAM,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,EAAE,CAClC,YAAY,CACX,aAAa,EACb,OAAO,EACP,UAAU,EACV,oBAAoB,EACpB,gBAAgB,EAChB,WAAW,EACX,wBAAwB,CACxB;KACF,CAAC;IAEF,OAAO,IAAA,+BAAoB,EAC1B,oDAAyB,EACzB,kBAAkB,EAClB,YAAY,CAAC,aAAa,CAC1B,CAAC;AACH,CAAC;AA7CD,4DA6CC;AAED,SAAS,gBAAgB,CACxB,UAAkC,EAClC,SAA8B;IAE9B,IAAI,SAAS,KAAK,sCAAgB,CAAC,UAAU,EAAE,CAAC;QAC/C,OAAO,sCAAgB,CAAC,aAAa,CAAC;IACvC,CAAC;IAED,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC;IAC9D,IAAA,iBAAM,EAAC,OAAO,KAAK,SAAS,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC9D,OAAO,OAAO,CAAC;AAChB,CAAC;AAED,SAAS,iBAAiB,CACzB,aAKC,EACD,QAAiC,EACjC,OAA8B;IAE9B,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,OAAO,QAAQ,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC5F,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob, fail } from \"@fluidframework/core-utils/internal\";\nimport type { TAnySchema } from \"@sinclair/typebox\";\n\nimport {\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\ttype SchemaValidationFunction,\n\textractJsonValidator,\n\twithSchemaValidation,\n} from \"../../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tChangesetLocalId,\n\tEncodedRevisionTag,\n\tFieldKey,\n\tFieldKindIdentifier,\n\tITreeCursorSynchronous,\n\tRevisionInfo,\n\tRevisionTag,\n} from \"../../core/index.js\";\nimport {\n\ttype IdAllocator,\n\ttype JsonCompatibleReadOnly,\n\ttype Mutable,\n\tbrand,\n\tidAllocatorFromMaxId,\n} from \"../../util/index.js\";\nimport { newChangeAtomIdBTree, type ChangeAtomIdBTree } from \"../changeAtomIdBTree.js\";\nimport {\n\ttype FieldBatchCodec,\n\ttype TreeChunk,\n\tchunkFieldSingle,\n\tdefaultChunkPolicy,\n} from \"../chunked-forest/index.js\";\nimport { TreeCompressionStrategy } from \"../treeCompressionUtils.js\";\n\nimport type { FieldChangeEncodingContext, FieldChangeHandler } from \"./fieldChangeHandler.js\";\nimport type {\n\tFieldKindConfiguration,\n\tFieldKindConfigurationEntry,\n} from \"./fieldKindConfiguration.js\";\nimport { genericFieldKind } from \"./genericFieldKind.js\";\nimport {\n\ttype EncodedBuilds,\n\ttype EncodedBuildsArray,\n\ttype EncodedFieldChange,\n\ttype EncodedFieldChangeMap,\n\tEncodedModularChangesetV1,\n\ttype EncodedNodeChangeset,\n\ttype EncodedRevisionInfo,\n} from \"./modularChangeFormatV1.js\";\nimport {\n\ttype FieldChangeset,\n\tnewCrossFieldKeyTable,\n\ttype FieldChangeMap,\n\ttype FieldId,\n\ttype ModularChangeset,\n\ttype NodeChangeset,\n\ttype NodeId,\n} from \"./modularChangeTypes.js\";\n\ntype ModularChangeCodec = IJsonCodec<\n\tModularChangeset,\n\tEncodedModularChangesetV1,\n\tEncodedModularChangesetV1,\n\tChangeEncodingContext\n>;\n\ntype FieldCodec = IJsonCodec<\n\tFieldChangeset,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tFieldChangeEncodingContext\n>;\n\ntype FieldChangesetCodecs = Map<\n\tFieldKindIdentifier,\n\t{\n\t\tcompiledSchema?: SchemaValidationFunction<TAnySchema>;\n\t\tcodec: FieldCodec;\n\t}\n>;\n\nexport function getFieldChangesetCodec(\n\tfieldKind: FieldKindIdentifier,\n\tfieldChangesetCodecs: FieldChangesetCodecs,\n): {\n\tcompiledSchema?: SchemaValidationFunction<TAnySchema>;\n\tcodec: FieldCodec;\n} {\n\tconst entry = fieldChangesetCodecs.get(fieldKind);\n\tassert(entry !== undefined, 0x5ea /* Tried to encode unsupported fieldKind */);\n\treturn entry;\n}\n\nexport function encodeFieldChangesForJson(\n\tchange: FieldChangeMap,\n\tcontext: ChangeEncodingContext,\n\tnodeChanges: ChangeAtomIdBTree<NodeChangeset>,\n\tfieldChangesetCodecs: FieldChangesetCodecs,\n): EncodedFieldChangeMap {\n\tconst fieldContext: FieldChangeEncodingContext = {\n\t\tbaseContext: context,\n\n\t\tencodeNode: (nodeId: NodeId): EncodedNodeChangeset => {\n\t\t\tconst node = nodeChanges.get([nodeId.revision, nodeId.localId]);\n\t\t\tassert(node !== undefined, 0x92e /* Unknown node ID */);\n\t\t\treturn encodeNodeChangesForJson(node, fieldContext, fieldChangesetCodecs);\n\t\t},\n\n\t\tdecodeNode: () => fail(0xb1e /* Should not decode nodes during field encoding */),\n\t};\n\n\treturn encodeFieldChangesForJsonI(change, fieldContext, fieldChangesetCodecs);\n}\n\nexport function encodeFieldChangesForJsonI(\n\tchange: FieldChangeMap,\n\tcontext: FieldChangeEncodingContext,\n\tfieldChangesetCodecs: FieldChangesetCodecs,\n): EncodedFieldChangeMap {\n\tconst encodedFields: EncodedFieldChangeMap = [];\n\n\tfor (const [field, fieldChange] of change) {\n\t\tconst { codec, compiledSchema } = getFieldChangesetCodec(\n\t\t\tfieldChange.fieldKind,\n\t\t\tfieldChangesetCodecs,\n\t\t);\n\t\tconst encodedChange = codec.encode(fieldChange.change, context);\n\t\tif (compiledSchema !== undefined && !compiledSchema.check(encodedChange)) {\n\t\t\tfail(0xb1f /* Encoded change didn't pass schema validation. */);\n\t\t}\n\n\t\tconst fieldKey: FieldKey = field;\n\t\tconst encodedField: EncodedFieldChange = {\n\t\t\tfieldKey,\n\t\t\tfieldKind: fieldChange.fieldKind,\n\t\t\tchange: encodedChange,\n\t\t};\n\n\t\tencodedFields.push(encodedField);\n\t}\n\n\treturn encodedFields;\n}\n\nexport function encodeNodeChangesForJson(\n\tchange: NodeChangeset,\n\tcontext: FieldChangeEncodingContext,\n\tfieldChangesetCodecs: FieldChangesetCodecs,\n): EncodedNodeChangeset {\n\tconst encodedChange: EncodedNodeChangeset = {};\n\t// Note: revert constraints are ignored for now because they would only be needed if we supported reverting changes made by peers.\n\tconst { fieldChanges, nodeExistsConstraint } = change;\n\n\tif (fieldChanges !== undefined) {\n\t\tencodedChange.fieldChanges = encodeFieldChangesForJsonI(\n\t\t\tfieldChanges,\n\t\t\tcontext,\n\t\t\tfieldChangesetCodecs,\n\t\t);\n\t}\n\n\tif (nodeExistsConstraint !== undefined) {\n\t\tencodedChange.nodeExistsConstraint = nodeExistsConstraint;\n\t}\n\n\treturn encodedChange;\n}\n\nexport function decodeFieldChangesFromJson(\n\tencodedChange: EncodedFieldChangeMap,\n\tparentId: NodeId | undefined,\n\tdecoded: ModularChangeset,\n\tcontext: ChangeEncodingContext,\n\tidAllocator: IdAllocator,\n\tfieldKinds: FieldKindConfiguration,\n\tfieldChangesetCodecs: FieldChangesetCodecs,\n): FieldChangeMap {\n\tconst decodedFields: FieldChangeMap = new Map();\n\tfor (const field of encodedChange) {\n\t\tconst { codec, compiledSchema } = getFieldChangesetCodec(\n\t\t\tfield.fieldKind,\n\t\t\tfieldChangesetCodecs,\n\t\t);\n\t\tif (compiledSchema !== undefined && !compiledSchema.check(field.change)) {\n\t\t\tfail(0xb20 /* Encoded change didn't pass schema validation. */);\n\t\t}\n\n\t\tconst fieldId: FieldId = {\n\t\t\tnodeId: parentId,\n\t\t\tfield: field.fieldKey,\n\t\t};\n\n\t\tconst fieldContext: FieldChangeEncodingContext = {\n\t\t\tbaseContext: context,\n\n\t\t\tencodeNode: () => fail(0xb21 /* Should not encode nodes during field decoding */),\n\n\t\t\tdecodeNode: (encodedNode: EncodedNodeChangeset): NodeId => {\n\t\t\t\tconst nodeId: NodeId = {\n\t\t\t\t\trevision: context.revision,\n\t\t\t\t\tlocalId: brand(idAllocator.allocate()),\n\t\t\t\t};\n\n\t\t\t\tconst node = decodeNodeChangesetFromJson(\n\t\t\t\t\tencodedNode,\n\t\t\t\t\tnodeId,\n\t\t\t\t\tdecoded,\n\t\t\t\t\tcontext,\n\t\t\t\t\tidAllocator,\n\t\t\t\t\tfieldKinds,\n\t\t\t\t\tfieldChangesetCodecs,\n\t\t\t\t);\n\n\t\t\t\tdecoded.nodeChanges.set([nodeId.revision, nodeId.localId], node);\n\t\t\t\tdecoded.nodeToParent.set([nodeId.revision, nodeId.localId], fieldId);\n\t\t\t\treturn nodeId;\n\t\t\t},\n\t\t};\n\n\t\tconst fieldChangeset = codec.decode(field.change, fieldContext);\n\n\t\tconst crossFieldKeys = getChangeHandler(fieldKinds, field.fieldKind).getCrossFieldKeys(\n\t\t\tfieldChangeset,\n\t\t);\n\n\t\tfor (const { key, count } of crossFieldKeys) {\n\t\t\tdecoded.crossFieldKeys.set(key, count, fieldId);\n\t\t}\n\n\t\tconst fieldKey: FieldKey = brand<FieldKey>(field.fieldKey);\n\n\t\tdecodedFields.set(fieldKey, {\n\t\t\tfieldKind: field.fieldKind,\n\t\t\tchange: brand(fieldChangeset),\n\t\t});\n\t}\n\n\treturn decodedFields;\n}\n\nexport function decodeNodeChangesetFromJson(\n\tencodedChange: EncodedNodeChangeset,\n\tid: NodeId,\n\tdecoded: ModularChangeset,\n\tcontext: ChangeEncodingContext,\n\tidAllocator: IdAllocator,\n\tfieldKinds: FieldKindConfiguration,\n\tfieldChangesetCodecs: FieldChangesetCodecs,\n): NodeChangeset {\n\tconst decodedChange: NodeChangeset = {};\n\tconst { fieldChanges, nodeExistsConstraint } = encodedChange;\n\n\tif (fieldChanges !== undefined) {\n\t\tdecodedChange.fieldChanges = decodeFieldChangesFromJson(\n\t\t\tfieldChanges,\n\t\t\tid,\n\t\t\tdecoded,\n\t\t\tcontext,\n\t\t\tidAllocator,\n\t\t\tfieldKinds,\n\t\t\tfieldChangesetCodecs,\n\t\t);\n\t}\n\n\tif (nodeExistsConstraint !== undefined) {\n\t\tdecodedChange.nodeExistsConstraint = nodeExistsConstraint;\n\t}\n\n\treturn decodedChange;\n}\n\nexport function encodeDetachedNodes(\n\tdetachedNodes: ChangeAtomIdBTree<TreeChunk> | undefined,\n\tcontext: ChangeEncodingContext,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\tfieldsCodec: FieldBatchCodec,\n\tchunkCompressionStrategy: TreeCompressionStrategy,\n): EncodedBuilds | undefined {\n\tif (detachedNodes === undefined) {\n\t\treturn undefined;\n\t}\n\n\tconst treesToEncode: ITreeCursorSynchronous[] = [];\n\tconst buildsArray: EncodedBuildsArray = [];\n\n\tlet buildsForRevision:\n\t\t| [[ChangesetLocalId, number][], EncodedRevisionTag]\n\t\t| [[ChangesetLocalId, number][]]\n\t\t| undefined;\n\n\tfor (const [[revision, id], chunk] of detachedNodes.entries()) {\n\t\tconst encodedRevision = encodeRevisionOpt(revisionTagCodec, revision, context);\n\n\t\tif (buildsForRevision === undefined || buildsForRevision[1] !== encodedRevision) {\n\t\t\tif (buildsForRevision !== undefined) {\n\t\t\t\tbuildsArray.push(buildsForRevision);\n\t\t\t}\n\n\t\t\tbuildsForRevision = encodedRevision === undefined ? [[]] : [[], encodedRevision];\n\t\t}\n\n\t\ttreesToEncode.push(chunk.cursor());\n\t\tconst treeIndexInBatch = treesToEncode.length - 1;\n\t\tbuildsForRevision?.[0].push([id, treeIndexInBatch]);\n\t}\n\n\tif (buildsForRevision !== undefined) {\n\t\tbuildsArray.push(buildsForRevision);\n\t}\n\n\treturn buildsArray.length === 0\n\t\t? undefined\n\t\t: {\n\t\t\t\tbuilds: buildsArray,\n\t\t\t\ttrees: fieldsCodec.encode(treesToEncode, {\n\t\t\t\t\tencodeType: chunkCompressionStrategy,\n\t\t\t\t\tschema: context.schema,\n\t\t\t\t\toriginatorId: context.originatorId,\n\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t}),\n\t\t\t};\n}\n\nexport function decodeDetachedNodes(\n\tencoded: EncodedBuilds | undefined,\n\tcontext: ChangeEncodingContext,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\tfieldsCodec: FieldBatchCodec,\n\tchunkCompressionStrategy: TreeCompressionStrategy,\n): ChangeAtomIdBTree<TreeChunk> | undefined {\n\tif (encoded === undefined || encoded.builds.length === 0) {\n\t\treturn undefined;\n\t}\n\n\tconst chunks = fieldsCodec.decode(encoded.trees, {\n\t\tencodeType: chunkCompressionStrategy,\n\t\toriginatorId: context.originatorId,\n\t\tidCompressor: context.idCompressor,\n\t});\n\tconst getChunk = (index: number): TreeChunk => {\n\t\tassert(index < chunks.length, 0x898 /* out of bounds index for build chunk */);\n\t\treturn chunkFieldSingle(chunks[index] ?? oob(), {\n\t\t\tpolicy: defaultChunkPolicy,\n\t\t\tidCompressor: context.idCompressor,\n\t\t});\n\t};\n\n\tconst map: ModularChangeset[\"builds\"] = newChangeAtomIdBTree();\n\t// eslint-disable-next-line unicorn/no-array-for-each -- Codec internals: minimizing changes to serialization logic\n\tencoded.builds.forEach((build) => {\n\t\t// EncodedRevisionTag cannot be an array so this ensures that we can isolate the tuple\n\t\tconst revision =\n\t\t\tbuild[1] === undefined ? context.revision : revisionTagCodec.decode(build[1], context);\n\n\t\tconst decodedChunks: [ChangesetLocalId, TreeChunk][] = build[0].map(([i, n]) => [\n\t\t\ti,\n\t\t\tgetChunk(n),\n\t\t]);\n\n\t\tfor (const [id, chunk] of decodedChunks) {\n\t\t\tmap.set([revision, id], chunk);\n\t\t}\n\t});\n\n\treturn map;\n}\n\nexport function encodeRevisionInfos(\n\trevisions: readonly RevisionInfo[],\n\tcontext: ChangeEncodingContext,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n): EncodedRevisionInfo[] | undefined {\n\tif (context.revision !== undefined) {\n\t\tassert(\n\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- Using optional chaining here would change behavior: `revisions[0]?.rollbackOf === undefined` is true when revisions[0] is undefined, but this check requires revisions[0] to be defined. As currently written, such a change would be safe because context.revision is included in the check and from a couple lines above is confirmed not undefined. But this more verbose form is clearer.\n\t\t\trevisions.length === 1 &&\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n\t\t\t\trevisions[0] !== undefined &&\n\t\t\t\trevisions[0].revision === context.revision &&\n\t\t\t\trevisions[0].rollbackOf === undefined,\n\t\t\t0x964 /* A tagged change should only contain the tagged revision */,\n\t\t);\n\n\t\treturn undefined;\n\t}\n\n\tconst encodedRevisions = [];\n\tfor (const revision of revisions) {\n\t\tconst encodedRevision: Mutable<EncodedRevisionInfo> = {\n\t\t\trevision: revisionTagCodec.encode(revision.revision, context),\n\t\t};\n\n\t\tif (revision.rollbackOf !== undefined) {\n\t\t\tencodedRevision.rollbackOf = revisionTagCodec.encode(revision.rollbackOf, context);\n\t\t}\n\n\t\tencodedRevisions.push(encodedRevision);\n\t}\n\n\treturn encodedRevisions;\n}\n\nexport function decodeRevisionInfos(\n\trevisions: readonly EncodedRevisionInfo[] | undefined,\n\tcontext: ChangeEncodingContext,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n): RevisionInfo[] | undefined {\n\tif (revisions === undefined) {\n\t\treturn context.revision === undefined ? undefined : [{ revision: context.revision }];\n\t}\n\n\tconst decodedRevisions = [];\n\tfor (const revision of revisions) {\n\t\tconst decodedRevision: Mutable<RevisionInfo> = {\n\t\t\trevision: revisionTagCodec.decode(revision.revision, context),\n\t\t};\n\n\t\tif (revision.rollbackOf !== undefined) {\n\t\t\tdecodedRevision.rollbackOf = revisionTagCodec.decode(revision.rollbackOf, context);\n\t\t}\n\n\t\tdecodedRevisions.push(decodedRevision);\n\t}\n\n\treturn decodedRevisions;\n}\n\nexport function encodeChange(\n\tchange: ModularChangeset,\n\tcontext: ChangeEncodingContext,\n\tfieldChangesetCodecs: Map<\n\t\tFieldKindIdentifier,\n\t\t{\n\t\t\tcompiledSchema?: SchemaValidationFunction<TAnySchema>;\n\t\t\tcodec: FieldCodec;\n\t\t}\n\t>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\tfieldsCodec: FieldBatchCodec,\n\tchunkCompressionStrategy: TreeCompressionStrategy,\n): EncodedModularChangesetV1 {\n\t// Destroys only exist in rollback changesets, which are never sent.\n\tassert(change.destroys === undefined, 0x899 /* Unexpected changeset with destroys */);\n\treturn {\n\t\tmaxId: change.maxId,\n\t\trevisions:\n\t\t\tchange.revisions === undefined\n\t\t\t\t? undefined\n\t\t\t\t: encodeRevisionInfos(change.revisions, context, revisionTagCodec),\n\t\tchanges: encodeFieldChangesForJson(\n\t\t\tchange.fieldChanges,\n\t\t\tcontext,\n\t\t\tchange.nodeChanges,\n\t\t\tfieldChangesetCodecs,\n\t\t),\n\t\tbuilds: encodeDetachedNodes(\n\t\t\tchange.builds,\n\t\t\tcontext,\n\t\t\trevisionTagCodec,\n\t\t\tfieldsCodec,\n\t\t\tchunkCompressionStrategy,\n\t\t),\n\t\trefreshers: encodeDetachedNodes(\n\t\t\tchange.refreshers,\n\t\t\tcontext,\n\t\t\trevisionTagCodec,\n\t\t\tfieldsCodec,\n\t\t\tchunkCompressionStrategy,\n\t\t),\n\t\tviolations: change.constraintViolationCount,\n\t};\n}\n\nexport function decodeChange(\n\tencodedChange: EncodedModularChangesetV1,\n\tcontext: ChangeEncodingContext,\n\tfieldKinds: FieldKindConfiguration,\n\tfieldChangesetCodecs: Map<\n\t\tFieldKindIdentifier,\n\t\t{\n\t\t\tcompiledSchema?: SchemaValidationFunction<TAnySchema>;\n\t\t\tcodec: FieldCodec;\n\t\t}\n\t>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\tfieldsCodec: FieldBatchCodec,\n\tchunkCompressionStrategy: TreeCompressionStrategy,\n): Mutable<ModularChangeset> {\n\tconst decoded: Mutable<ModularChangeset> = {\n\t\tfieldChanges: new Map(),\n\t\tnodeChanges: newChangeAtomIdBTree(),\n\t\tnodeToParent: newChangeAtomIdBTree(),\n\t\tnodeAliases: newChangeAtomIdBTree(),\n\t\tcrossFieldKeys: newCrossFieldKeyTable(),\n\t};\n\n\tdecoded.fieldChanges = decodeFieldChangesFromJson(\n\t\tencodedChange.changes,\n\t\tundefined,\n\t\tdecoded,\n\t\tcontext,\n\t\tidAllocatorFromMaxId(encodedChange.maxId),\n\t\tfieldKinds,\n\t\tfieldChangesetCodecs,\n\t);\n\n\tif (encodedChange.builds !== undefined) {\n\t\tdecoded.builds = decodeDetachedNodes(\n\t\t\tencodedChange.builds,\n\t\t\tcontext,\n\t\t\trevisionTagCodec,\n\t\t\tfieldsCodec,\n\t\t\tchunkCompressionStrategy,\n\t\t);\n\t}\n\tif (encodedChange.refreshers !== undefined) {\n\t\tdecoded.refreshers = decodeDetachedNodes(\n\t\t\tencodedChange.refreshers,\n\t\t\tcontext,\n\t\t\trevisionTagCodec,\n\t\t\tfieldsCodec,\n\t\t\tchunkCompressionStrategy,\n\t\t);\n\t}\n\n\tif (encodedChange.violations !== undefined) {\n\t\tdecoded.constraintViolationCount = encodedChange.violations;\n\t}\n\n\tconst decodedRevInfos = decodeRevisionInfos(\n\t\tencodedChange.revisions,\n\t\tcontext,\n\t\trevisionTagCodec,\n\t);\n\tif (decodedRevInfos !== undefined) {\n\t\tdecoded.revisions = decodedRevInfos;\n\t}\n\tif (encodedChange.maxId !== undefined) {\n\t\tdecoded.maxId = encodedChange.maxId;\n\t}\n\treturn decoded;\n}\n\nexport function getFieldChangesetCodecs(\n\tfieldKinds: FieldKindConfiguration,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\tcodecOptions: ICodecOptions,\n): Map<\n\tFieldKindIdentifier,\n\t{ compiledSchema?: SchemaValidationFunction<TAnySchema>; codec: FieldCodec }\n> {\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tconst getMapEntry = ({ kind, formatVersion }: FieldKindConfigurationEntry) => {\n\t\tconst codec = kind.changeHandler.codecsFactory(revisionTagCodec).resolve(formatVersion);\n\t\treturn {\n\t\t\tcodec,\n\t\t\tcompiledSchema: codec.encodedSchema\n\t\t\t\t? extractJsonValidator(codecOptions.jsonValidator).compile(codec.encodedSchema)\n\t\t\t\t: undefined,\n\t\t};\n\t};\n\n\t/**\n\t * The codec version for the generic field kind.\n\t */\n\tconst genericFieldKindFormatVersion = 1;\n\tconst fieldChangesetCodecs: Map<\n\t\tFieldKindIdentifier,\n\t\t{\n\t\t\tcompiledSchema?: SchemaValidationFunction<TAnySchema>;\n\t\t\tcodec: FieldCodec;\n\t\t}\n\t> = new Map([\n\t\t[\n\t\t\tgenericFieldKind.identifier,\n\t\t\tgetMapEntry({ kind: genericFieldKind, formatVersion: genericFieldKindFormatVersion }),\n\t\t],\n\t]);\n\n\t// eslint-disable-next-line unicorn/no-array-for-each -- Map.forEach with (value, key) signature; codec initialization\n\tfieldKinds.forEach((entry, identifier) => {\n\t\tfieldChangesetCodecs.set(identifier, getMapEntry(entry));\n\t});\n\n\treturn fieldChangesetCodecs;\n}\n\nexport function makeModularChangeCodecV1(\n\tfieldKinds: FieldKindConfiguration,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\tfieldsCodec: FieldBatchCodec,\n\tcodecOptions: ICodecOptions,\n\tchunkCompressionStrategy: TreeCompressionStrategy = TreeCompressionStrategy.Compressed,\n): ModularChangeCodec {\n\tconst fieldChangesetCodecs = getFieldChangesetCodecs(\n\t\tfieldKinds,\n\t\trevisionTagCodec,\n\t\tcodecOptions,\n\t);\n\n\tconst modularChangeCodec: ModularChangeCodec = {\n\t\tencode: (change, context) =>\n\t\t\tencodeChange(\n\t\t\t\tchange,\n\t\t\t\tcontext,\n\t\t\t\tfieldChangesetCodecs,\n\t\t\t\trevisionTagCodec,\n\t\t\t\tfieldsCodec,\n\t\t\t\tchunkCompressionStrategy,\n\t\t\t),\n\t\tdecode: (encodedChange, context) =>\n\t\t\tdecodeChange(\n\t\t\t\tencodedChange,\n\t\t\t\tcontext,\n\t\t\t\tfieldKinds,\n\t\t\t\tfieldChangesetCodecs,\n\t\t\t\trevisionTagCodec,\n\t\t\t\tfieldsCodec,\n\t\t\t\tchunkCompressionStrategy,\n\t\t\t),\n\t};\n\n\treturn withSchemaValidation(\n\t\tEncodedModularChangesetV1,\n\t\tmodularChangeCodec,\n\t\tcodecOptions.jsonValidator,\n\t);\n}\n\nfunction getChangeHandler(\n\tfieldKinds: FieldKindConfiguration,\n\tfieldKind: FieldKindIdentifier,\n): FieldChangeHandler<unknown> {\n\tif (fieldKind === genericFieldKind.identifier) {\n\t\treturn genericFieldKind.changeHandler;\n\t}\n\n\tconst handler = fieldKinds.get(fieldKind)?.kind.changeHandler;\n\tassert(handler !== undefined, 0x9c1 /* Unknown field kind */);\n\treturn handler;\n}\n\nfunction encodeRevisionOpt(\n\trevisionCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\trevision: RevisionTag | undefined,\n\tcontext: ChangeEncodingContext,\n): EncodedRevisionTag | undefined {\n\tif (revision === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn revision === context.revision ? undefined : revisionCodec.encode(revision, context);\n}\n"]}
1
+ {"version":3,"file":"modularChangeCodecV1.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/modularChangeCodecV1.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAwE;AAGxE,mDAO8B;AAY9B,kDAM6B;AAC7B,kEAAuF;AACvF,yDAKoC;AACpC,wEAAqE;AAOrE,+DAAyD;AACzD,yEAQoC;AACpC,mEAQiC;AAwBjC,SAAgB,sBAAsB,CACrC,SAA8B,EAC9B,oBAA0C;IAK1C,MAAM,KAAK,GAAG,oBAAoB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAClD,IAAA,iBAAM,EAAC,KAAK,KAAK,SAAS,EAAE,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/E,OAAO,KAAK,CAAC;AACd,CAAC;AAVD,wDAUC;AAED,SAAgB,yBAAyB,CACxC,MAAsB,EACtB,OAA8B,EAC9B,WAA6C,EAC7C,oBAA0C;IAE1C,MAAM,YAAY,GAA+B;QAChD,WAAW,EAAE,OAAO;QAEpB,UAAU,EAAE,CAAC,MAAc,EAAwB,EAAE;YACpD,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;YAChE,IAAA,iBAAM,EAAC,IAAI,KAAK,SAAS,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAC;YACxD,OAAO,wBAAwB,CAAC,IAAI,EAAE,YAAY,EAAE,oBAAoB,CAAC,CAAC;QAC3E,CAAC;QAED,UAAU,EAAE,GAAG,EAAE,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CACxB;KACF,CAAC;IAEF,OAAO,IAAA,+BAAoB,EAC1B,oDAAyB,EACzB,kBAAkB,EAClB,YAAY,CAAC,aAAa,CAC1B,CAAC;AACH,CAAC;AA5CD,4DA4CC;AAED,SAAS,gBAAgB,CACxB,UAAkC,EAClC,SAA8B;IAE9B,IAAI,SAAS,KAAK,sCAAgB,CAAC,UAAU,EAAE,CAAC;QAC/C,OAAO,sCAAgB,CAAC,aAAa,CAAC;IACvC,CAAC;IAED,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC;IAC9D,IAAA,iBAAM,EAAC,OAAO,KAAK,SAAS,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC9D,OAAO,OAAO,CAAC;AAChB,CAAC;AAED,SAAS,iBAAiB,CACzB,aAKC,EACD,QAAiC,EACjC,OAA8B;IAE9B,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,OAAO,QAAQ,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC5F,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob, fail } from \"@fluidframework/core-utils/internal\";\nimport type { TAnySchema } from \"@sinclair/typebox\";\n\nimport {\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\ttype JsonCodecPart,\n\ttype SchemaValidationFunction,\n\textractJsonValidator,\n\twithSchemaValidation,\n} from \"../../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tChangesetLocalId,\n\tEncodedRevisionTag,\n\tFieldKey,\n\tFieldKindIdentifier,\n\tITreeCursorSynchronous,\n\tRevisionInfo,\n\tRevisionTag,\n\tRevisionTagSchema,\n} from \"../../core/index.js\";\nimport {\n\ttype IdAllocator,\n\ttype JsonCompatibleReadOnly,\n\ttype Mutable,\n\tbrand,\n\tidAllocatorFromMaxId,\n} from \"../../util/index.js\";\nimport { newChangeAtomIdBTree, type ChangeAtomIdBTree } from \"../changeAtomIdBTree.js\";\nimport {\n\ttype FieldBatchCodec,\n\ttype TreeChunk,\n\tchunkFieldSingle,\n\tdefaultChunkPolicy,\n} from \"../chunked-forest/index.js\";\nimport { TreeCompressionStrategy } from \"../treeCompressionUtils.js\";\n\nimport type { FieldChangeEncodingContext, FieldChangeHandler } from \"./fieldChangeHandler.js\";\nimport type {\n\tFieldKindConfiguration,\n\tFieldKindConfigurationEntry,\n} from \"./fieldKindConfiguration.js\";\nimport { genericFieldKind } from \"./genericFieldKind.js\";\nimport {\n\ttype EncodedBuilds,\n\ttype EncodedBuildsArray,\n\ttype EncodedFieldChange,\n\ttype EncodedFieldChangeMap,\n\tEncodedModularChangesetV1,\n\ttype EncodedNodeChangeset,\n\ttype EncodedRevisionInfo,\n} from \"./modularChangeFormatV1.js\";\nimport {\n\ttype FieldChangeset,\n\tnewCrossFieldKeyTable,\n\ttype FieldChangeMap,\n\ttype FieldId,\n\ttype ModularChangeset,\n\ttype NodeChangeset,\n\ttype NodeId,\n} from \"./modularChangeTypes.js\";\n\ntype ModularChangeCodec = IJsonCodec<\n\tModularChangeset,\n\tEncodedModularChangesetV1,\n\tEncodedModularChangesetV1,\n\tChangeEncodingContext\n>;\n\ntype FieldCodec = IJsonCodec<\n\tFieldChangeset,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tFieldChangeEncodingContext\n>;\n\ntype FieldChangesetCodecs = Map<\n\tFieldKindIdentifier,\n\t{\n\t\tcompiledSchema?: SchemaValidationFunction<TAnySchema>;\n\t\tcodec: FieldCodec;\n\t}\n>;\n\nexport function getFieldChangesetCodec(\n\tfieldKind: FieldKindIdentifier,\n\tfieldChangesetCodecs: FieldChangesetCodecs,\n): {\n\tcompiledSchema?: SchemaValidationFunction<TAnySchema>;\n\tcodec: FieldCodec;\n} {\n\tconst entry = fieldChangesetCodecs.get(fieldKind);\n\tassert(entry !== undefined, 0x5ea /* Tried to encode unsupported fieldKind */);\n\treturn entry;\n}\n\nexport function encodeFieldChangesForJson(\n\tchange: FieldChangeMap,\n\tcontext: ChangeEncodingContext,\n\tnodeChanges: ChangeAtomIdBTree<NodeChangeset>,\n\tfieldChangesetCodecs: FieldChangesetCodecs,\n): EncodedFieldChangeMap {\n\tconst fieldContext: FieldChangeEncodingContext = {\n\t\tbaseContext: context,\n\n\t\tencodeNode: (nodeId: NodeId): EncodedNodeChangeset => {\n\t\t\tconst node = nodeChanges.get([nodeId.revision, nodeId.localId]);\n\t\t\tassert(node !== undefined, 0x92e /* Unknown node ID */);\n\t\t\treturn encodeNodeChangesForJson(node, fieldContext, fieldChangesetCodecs);\n\t\t},\n\n\t\tdecodeNode: () => fail(0xb1e /* Should not decode nodes during field encoding */),\n\t};\n\n\treturn encodeFieldChangesForJsonI(change, fieldContext, fieldChangesetCodecs);\n}\n\nexport function encodeFieldChangesForJsonI(\n\tchange: FieldChangeMap,\n\tcontext: FieldChangeEncodingContext,\n\tfieldChangesetCodecs: FieldChangesetCodecs,\n): EncodedFieldChangeMap {\n\tconst encodedFields: EncodedFieldChangeMap = [];\n\n\tfor (const [field, fieldChange] of change) {\n\t\tconst { codec, compiledSchema } = getFieldChangesetCodec(\n\t\t\tfieldChange.fieldKind,\n\t\t\tfieldChangesetCodecs,\n\t\t);\n\t\tconst encodedChange = codec.encode(fieldChange.change, context);\n\t\tif (compiledSchema !== undefined && !compiledSchema.check(encodedChange)) {\n\t\t\tfail(0xb1f /* Encoded change didn't pass schema validation. */);\n\t\t}\n\n\t\tconst fieldKey: FieldKey = field;\n\t\tconst encodedField: EncodedFieldChange = {\n\t\t\tfieldKey,\n\t\t\tfieldKind: fieldChange.fieldKind,\n\t\t\tchange: encodedChange,\n\t\t};\n\n\t\tencodedFields.push(encodedField);\n\t}\n\n\treturn encodedFields;\n}\n\nexport function encodeNodeChangesForJson(\n\tchange: NodeChangeset,\n\tcontext: FieldChangeEncodingContext,\n\tfieldChangesetCodecs: FieldChangesetCodecs,\n): EncodedNodeChangeset {\n\tconst encodedChange: EncodedNodeChangeset = {};\n\t// Note: revert constraints are ignored for now because they would only be needed if we supported reverting changes made by peers.\n\tconst { fieldChanges, nodeExistsConstraint } = change;\n\n\tif (fieldChanges !== undefined) {\n\t\tencodedChange.fieldChanges = encodeFieldChangesForJsonI(\n\t\t\tfieldChanges,\n\t\t\tcontext,\n\t\t\tfieldChangesetCodecs,\n\t\t);\n\t}\n\n\tif (nodeExistsConstraint !== undefined) {\n\t\tencodedChange.nodeExistsConstraint = nodeExistsConstraint;\n\t}\n\n\treturn encodedChange;\n}\n\nexport function decodeFieldChangesFromJson(\n\tencodedChange: EncodedFieldChangeMap,\n\tparentId: NodeId | undefined,\n\tdecoded: ModularChangeset,\n\tcontext: ChangeEncodingContext,\n\tidAllocator: IdAllocator,\n\tfieldKinds: FieldKindConfiguration,\n\tfieldChangesetCodecs: FieldChangesetCodecs,\n): FieldChangeMap {\n\tconst decodedFields: FieldChangeMap = new Map();\n\tfor (const field of encodedChange) {\n\t\tconst { codec, compiledSchema } = getFieldChangesetCodec(\n\t\t\tfield.fieldKind,\n\t\t\tfieldChangesetCodecs,\n\t\t);\n\t\tif (compiledSchema !== undefined && !compiledSchema.check(field.change)) {\n\t\t\tfail(0xb20 /* Encoded change didn't pass schema validation. */);\n\t\t}\n\n\t\tconst fieldId: FieldId = {\n\t\t\tnodeId: parentId,\n\t\t\tfield: field.fieldKey,\n\t\t};\n\n\t\tconst fieldContext: FieldChangeEncodingContext = {\n\t\t\tbaseContext: context,\n\n\t\t\tencodeNode: () => fail(0xb21 /* Should not encode nodes during field decoding */),\n\n\t\t\tdecodeNode: (encodedNode: EncodedNodeChangeset): NodeId => {\n\t\t\t\tconst nodeId: NodeId = {\n\t\t\t\t\trevision: context.revision,\n\t\t\t\t\tlocalId: brand(idAllocator.allocate()),\n\t\t\t\t};\n\n\t\t\t\tconst node = decodeNodeChangesetFromJson(\n\t\t\t\t\tencodedNode,\n\t\t\t\t\tnodeId,\n\t\t\t\t\tdecoded,\n\t\t\t\t\tcontext,\n\t\t\t\t\tidAllocator,\n\t\t\t\t\tfieldKinds,\n\t\t\t\t\tfieldChangesetCodecs,\n\t\t\t\t);\n\n\t\t\t\tdecoded.nodeChanges.set([nodeId.revision, nodeId.localId], node);\n\t\t\t\tdecoded.nodeToParent.set([nodeId.revision, nodeId.localId], fieldId);\n\t\t\t\treturn nodeId;\n\t\t\t},\n\t\t};\n\n\t\tconst fieldChangeset = codec.decode(field.change, fieldContext);\n\n\t\tconst crossFieldKeys = getChangeHandler(fieldKinds, field.fieldKind).getCrossFieldKeys(\n\t\t\tfieldChangeset,\n\t\t);\n\n\t\tfor (const { key, count } of crossFieldKeys) {\n\t\t\tdecoded.crossFieldKeys.set(key, count, fieldId);\n\t\t}\n\n\t\tconst fieldKey: FieldKey = brand<FieldKey>(field.fieldKey);\n\n\t\tdecodedFields.set(fieldKey, {\n\t\t\tfieldKind: field.fieldKind,\n\t\t\tchange: brand(fieldChangeset),\n\t\t});\n\t}\n\n\treturn decodedFields;\n}\n\nexport function decodeNodeChangesetFromJson(\n\tencodedChange: EncodedNodeChangeset,\n\tid: NodeId,\n\tdecoded: ModularChangeset,\n\tcontext: ChangeEncodingContext,\n\tidAllocator: IdAllocator,\n\tfieldKinds: FieldKindConfiguration,\n\tfieldChangesetCodecs: FieldChangesetCodecs,\n): NodeChangeset {\n\tconst decodedChange: NodeChangeset = {};\n\tconst { fieldChanges, nodeExistsConstraint } = encodedChange;\n\n\tif (fieldChanges !== undefined) {\n\t\tdecodedChange.fieldChanges = decodeFieldChangesFromJson(\n\t\t\tfieldChanges,\n\t\t\tid,\n\t\t\tdecoded,\n\t\t\tcontext,\n\t\t\tidAllocator,\n\t\t\tfieldKinds,\n\t\t\tfieldChangesetCodecs,\n\t\t);\n\t}\n\n\tif (nodeExistsConstraint !== undefined) {\n\t\tdecodedChange.nodeExistsConstraint = nodeExistsConstraint;\n\t}\n\n\treturn decodedChange;\n}\n\nexport function encodeDetachedNodes(\n\tdetachedNodes: ChangeAtomIdBTree<TreeChunk> | undefined,\n\tcontext: ChangeEncodingContext,\n\trevisionTagCodec: JsonCodecPart<\n\t\tRevisionTag,\n\t\ttypeof RevisionTagSchema,\n\t\tChangeEncodingContext\n\t>,\n\tfieldsCodec: FieldBatchCodec,\n\tchunkCompressionStrategy: TreeCompressionStrategy,\n): EncodedBuilds | undefined {\n\tif (detachedNodes === undefined) {\n\t\treturn undefined;\n\t}\n\n\tconst treesToEncode: ITreeCursorSynchronous[] = [];\n\tconst buildsArray: EncodedBuildsArray = [];\n\n\tlet buildsForRevision:\n\t\t| [[ChangesetLocalId, number][], EncodedRevisionTag]\n\t\t| [[ChangesetLocalId, number][]]\n\t\t| undefined;\n\n\tfor (const [[revision, id], chunk] of detachedNodes.entries()) {\n\t\tconst encodedRevision = encodeRevisionOpt(revisionTagCodec, revision, context);\n\n\t\tif (buildsForRevision === undefined || buildsForRevision[1] !== encodedRevision) {\n\t\t\tif (buildsForRevision !== undefined) {\n\t\t\t\tbuildsArray.push(buildsForRevision);\n\t\t\t}\n\n\t\t\tbuildsForRevision = encodedRevision === undefined ? [[]] : [[], encodedRevision];\n\t\t}\n\n\t\ttreesToEncode.push(chunk.cursor());\n\t\tconst treeIndexInBatch = treesToEncode.length - 1;\n\t\tbuildsForRevision?.[0].push([id, treeIndexInBatch]);\n\t}\n\n\tif (buildsForRevision !== undefined) {\n\t\tbuildsArray.push(buildsForRevision);\n\t}\n\n\treturn buildsArray.length === 0\n\t\t? undefined\n\t\t: {\n\t\t\t\tbuilds: buildsArray,\n\t\t\t\ttrees: fieldsCodec.encode(treesToEncode, {\n\t\t\t\t\tencodeType: chunkCompressionStrategy,\n\t\t\t\t\tschema: context.schema,\n\t\t\t\t\toriginatorId: context.originatorId,\n\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t}),\n\t\t\t};\n}\n\nexport function decodeDetachedNodes(\n\tencoded: EncodedBuilds | undefined,\n\tcontext: ChangeEncodingContext,\n\trevisionTagCodec: JsonCodecPart<\n\t\tRevisionTag,\n\t\ttypeof RevisionTagSchema,\n\t\tChangeEncodingContext\n\t>,\n\tfieldsCodec: FieldBatchCodec,\n\tchunkCompressionStrategy: TreeCompressionStrategy,\n): ChangeAtomIdBTree<TreeChunk> | undefined {\n\tif (encoded === undefined || encoded.builds.length === 0) {\n\t\treturn undefined;\n\t}\n\n\tconst chunks = fieldsCodec.decode(encoded.trees, {\n\t\tencodeType: chunkCompressionStrategy,\n\t\toriginatorId: context.originatorId,\n\t\tidCompressor: context.idCompressor,\n\t});\n\tconst getChunk = (index: number): TreeChunk => {\n\t\tassert(index < chunks.length, 0x898 /* out of bounds index for build chunk */);\n\t\treturn chunkFieldSingle(chunks[index] ?? oob(), {\n\t\t\tpolicy: defaultChunkPolicy,\n\t\t\tidCompressor: context.idCompressor,\n\t\t});\n\t};\n\n\tconst map: ModularChangeset[\"builds\"] = newChangeAtomIdBTree();\n\t// eslint-disable-next-line unicorn/no-array-for-each -- Codec internals: minimizing changes to serialization logic\n\tencoded.builds.forEach((build) => {\n\t\t// EncodedRevisionTag cannot be an array so this ensures that we can isolate the tuple\n\t\tconst revision =\n\t\t\tbuild[1] === undefined ? context.revision : revisionTagCodec.decode(build[1], context);\n\n\t\tconst decodedChunks: [ChangesetLocalId, TreeChunk][] = build[0].map(([i, n]) => [\n\t\t\ti,\n\t\t\tgetChunk(n),\n\t\t]);\n\n\t\tfor (const [id, chunk] of decodedChunks) {\n\t\t\tmap.set([revision, id], chunk);\n\t\t}\n\t});\n\n\treturn map;\n}\n\nexport function encodeRevisionInfos(\n\trevisions: readonly RevisionInfo[],\n\tcontext: ChangeEncodingContext,\n\trevisionTagCodec: JsonCodecPart<\n\t\tRevisionTag,\n\t\ttypeof RevisionTagSchema,\n\t\tChangeEncodingContext\n\t>,\n): EncodedRevisionInfo[] | undefined {\n\tif (context.revision !== undefined) {\n\t\tassert(\n\t\t\trevisions.length === 1 &&\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- Using optional chaining here would change behavior: `revisions[0]?.rollbackOf === undefined` is true when revisions[0] is undefined, but this check requires revisions[0] to be defined. As currently written, such a change would be safe because context.revision is included in the check and from a couple lines above is confirmed not undefined. But this more verbose form is clearer.\n\t\t\t\trevisions[0] !== undefined &&\n\t\t\t\trevisions[0].revision === context.revision &&\n\t\t\t\trevisions[0].rollbackOf === undefined,\n\t\t\t0x964 /* A tagged change should only contain the tagged revision */,\n\t\t);\n\n\t\treturn undefined;\n\t}\n\n\tconst encodedRevisions = [];\n\tfor (const revision of revisions) {\n\t\tconst encodedRevision: Mutable<EncodedRevisionInfo> = {\n\t\t\trevision: revisionTagCodec.encode(revision.revision, context),\n\t\t};\n\n\t\tif (revision.rollbackOf !== undefined) {\n\t\t\tencodedRevision.rollbackOf = revisionTagCodec.encode(revision.rollbackOf, context);\n\t\t}\n\n\t\tencodedRevisions.push(encodedRevision);\n\t}\n\n\treturn encodedRevisions;\n}\n\nexport function decodeRevisionInfos(\n\trevisions: readonly EncodedRevisionInfo[] | undefined,\n\tcontext: ChangeEncodingContext,\n\trevisionTagCodec: JsonCodecPart<\n\t\tRevisionTag,\n\t\ttypeof RevisionTagSchema,\n\t\tChangeEncodingContext\n\t>,\n): RevisionInfo[] | undefined {\n\tif (revisions === undefined) {\n\t\treturn context.revision === undefined ? undefined : [{ revision: context.revision }];\n\t}\n\n\tconst decodedRevisions = [];\n\tfor (const revision of revisions) {\n\t\tconst decodedRevision: Mutable<RevisionInfo> = {\n\t\t\trevision: revisionTagCodec.decode(revision.revision, context),\n\t\t};\n\n\t\tif (revision.rollbackOf !== undefined) {\n\t\t\tdecodedRevision.rollbackOf = revisionTagCodec.decode(revision.rollbackOf, context);\n\t\t}\n\n\t\tdecodedRevisions.push(decodedRevision);\n\t}\n\n\treturn decodedRevisions;\n}\n\nexport function encodeChange(\n\tchange: ModularChangeset,\n\tcontext: ChangeEncodingContext,\n\tfieldChangesetCodecs: Map<\n\t\tFieldKindIdentifier,\n\t\t{\n\t\t\tcompiledSchema?: SchemaValidationFunction<TAnySchema>;\n\t\t\tcodec: FieldCodec;\n\t\t}\n\t>,\n\trevisionTagCodec: JsonCodecPart<\n\t\tRevisionTag,\n\t\ttypeof RevisionTagSchema,\n\t\tChangeEncodingContext\n\t>,\n\tfieldsCodec: FieldBatchCodec,\n\tchunkCompressionStrategy: TreeCompressionStrategy,\n): EncodedModularChangesetV1 {\n\t// Destroys only exist in rollback changesets, which are never sent.\n\tassert(change.destroys === undefined, 0x899 /* Unexpected changeset with destroys */);\n\treturn {\n\t\tmaxId: change.maxId,\n\t\trevisions:\n\t\t\tchange.revisions === undefined\n\t\t\t\t? undefined\n\t\t\t\t: encodeRevisionInfos(change.revisions, context, revisionTagCodec),\n\t\tchanges: encodeFieldChangesForJson(\n\t\t\tchange.fieldChanges,\n\t\t\tcontext,\n\t\t\tchange.nodeChanges,\n\t\t\tfieldChangesetCodecs,\n\t\t),\n\t\tbuilds: encodeDetachedNodes(\n\t\t\tchange.builds,\n\t\t\tcontext,\n\t\t\trevisionTagCodec,\n\t\t\tfieldsCodec,\n\t\t\tchunkCompressionStrategy,\n\t\t),\n\t\trefreshers: encodeDetachedNodes(\n\t\t\tchange.refreshers,\n\t\t\tcontext,\n\t\t\trevisionTagCodec,\n\t\t\tfieldsCodec,\n\t\t\tchunkCompressionStrategy,\n\t\t),\n\t\tviolations: change.constraintViolationCount,\n\t};\n}\n\nexport function decodeChange(\n\tencodedChange: EncodedModularChangesetV1,\n\tcontext: ChangeEncodingContext,\n\tfieldKinds: FieldKindConfiguration,\n\tfieldChangesetCodecs: Map<\n\t\tFieldKindIdentifier,\n\t\t{\n\t\t\tcompiledSchema?: SchemaValidationFunction<TAnySchema>;\n\t\t\tcodec: FieldCodec;\n\t\t}\n\t>,\n\trevisionTagCodec: JsonCodecPart<\n\t\tRevisionTag,\n\t\ttypeof RevisionTagSchema,\n\t\tChangeEncodingContext\n\t>,\n\tfieldsCodec: FieldBatchCodec,\n\tchunkCompressionStrategy: TreeCompressionStrategy,\n): Mutable<ModularChangeset> {\n\tconst decoded: Mutable<ModularChangeset> = {\n\t\tfieldChanges: new Map(),\n\t\tnodeChanges: newChangeAtomIdBTree(),\n\t\tnodeToParent: newChangeAtomIdBTree(),\n\t\tnodeAliases: newChangeAtomIdBTree(),\n\t\tcrossFieldKeys: newCrossFieldKeyTable(),\n\t};\n\n\tdecoded.fieldChanges = decodeFieldChangesFromJson(\n\t\tencodedChange.changes,\n\t\tundefined,\n\t\tdecoded,\n\t\tcontext,\n\t\tidAllocatorFromMaxId(encodedChange.maxId),\n\t\tfieldKinds,\n\t\tfieldChangesetCodecs,\n\t);\n\n\tif (encodedChange.builds !== undefined) {\n\t\tdecoded.builds = decodeDetachedNodes(\n\t\t\tencodedChange.builds,\n\t\t\tcontext,\n\t\t\trevisionTagCodec,\n\t\t\tfieldsCodec,\n\t\t\tchunkCompressionStrategy,\n\t\t);\n\t}\n\tif (encodedChange.refreshers !== undefined) {\n\t\tdecoded.refreshers = decodeDetachedNodes(\n\t\t\tencodedChange.refreshers,\n\t\t\tcontext,\n\t\t\trevisionTagCodec,\n\t\t\tfieldsCodec,\n\t\t\tchunkCompressionStrategy,\n\t\t);\n\t}\n\n\tif (encodedChange.violations !== undefined) {\n\t\tdecoded.constraintViolationCount = encodedChange.violations;\n\t}\n\n\tconst decodedRevInfos = decodeRevisionInfos(\n\t\tencodedChange.revisions,\n\t\tcontext,\n\t\trevisionTagCodec,\n\t);\n\tif (decodedRevInfos !== undefined) {\n\t\tdecoded.revisions = decodedRevInfos;\n\t}\n\tif (encodedChange.maxId !== undefined) {\n\t\tdecoded.maxId = encodedChange.maxId;\n\t}\n\treturn decoded;\n}\n\nexport function getFieldChangesetCodecs(\n\tfieldKinds: FieldKindConfiguration,\n\trevisionTagCodec: JsonCodecPart<\n\t\tRevisionTag,\n\t\ttypeof RevisionTagSchema,\n\t\tChangeEncodingContext\n\t>,\n\tcodecOptions: ICodecOptions,\n): Map<\n\tFieldKindIdentifier,\n\t{ compiledSchema?: SchemaValidationFunction<TAnySchema>; codec: FieldCodec }\n> {\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tconst getMapEntry = ({ kind, formatVersion }: FieldKindConfigurationEntry) => {\n\t\tconst codec = kind.changeHandler.codecsFactory(revisionTagCodec).resolve(formatVersion);\n\t\treturn {\n\t\t\tcodec,\n\t\t\tcompiledSchema: codec.encodedSchema\n\t\t\t\t? extractJsonValidator(codecOptions.jsonValidator).compile(codec.encodedSchema)\n\t\t\t\t: undefined,\n\t\t};\n\t};\n\n\t/**\n\t * The codec version for the generic field kind.\n\t */\n\tconst genericFieldKindFormatVersion = 1;\n\tconst fieldChangesetCodecs: Map<\n\t\tFieldKindIdentifier,\n\t\t{\n\t\t\tcompiledSchema?: SchemaValidationFunction<TAnySchema>;\n\t\t\tcodec: FieldCodec;\n\t\t}\n\t> = new Map([\n\t\t[\n\t\t\tgenericFieldKind.identifier,\n\t\t\tgetMapEntry({ kind: genericFieldKind, formatVersion: genericFieldKindFormatVersion }),\n\t\t],\n\t]);\n\n\t// eslint-disable-next-line unicorn/no-array-for-each -- Map.forEach with (value, key) signature; codec initialization\n\tfieldKinds.forEach((entry, identifier) => {\n\t\tfieldChangesetCodecs.set(identifier, getMapEntry(entry));\n\t});\n\n\treturn fieldChangesetCodecs;\n}\n\nexport function makeModularChangeCodecV1(\n\tfieldKinds: FieldKindConfiguration,\n\trevisionTagCodec: JsonCodecPart<\n\t\tRevisionTag,\n\t\ttypeof RevisionTagSchema,\n\t\tChangeEncodingContext\n\t>,\n\tfieldsCodec: FieldBatchCodec,\n\tcodecOptions: ICodecOptions,\n\tchunkCompressionStrategy: TreeCompressionStrategy = TreeCompressionStrategy.Compressed,\n): ModularChangeCodec {\n\tconst fieldChangesetCodecs = getFieldChangesetCodecs(\n\t\tfieldKinds,\n\t\trevisionTagCodec,\n\t\tcodecOptions,\n\t);\n\n\tconst modularChangeCodec: ModularChangeCodec = {\n\t\tencode: (change, context) =>\n\t\t\tencodeChange(\n\t\t\t\tchange,\n\t\t\t\tcontext,\n\t\t\t\tfieldChangesetCodecs,\n\t\t\t\trevisionTagCodec,\n\t\t\t\tfieldsCodec,\n\t\t\t\tchunkCompressionStrategy,\n\t\t\t),\n\t\tdecode: (encodedChange, context) =>\n\t\t\tdecodeChange(\n\t\t\t\tencodedChange,\n\t\t\t\tcontext,\n\t\t\t\tfieldKinds,\n\t\t\t\tfieldChangesetCodecs,\n\t\t\t\trevisionTagCodec,\n\t\t\t\tfieldsCodec,\n\t\t\t\tchunkCompressionStrategy,\n\t\t\t),\n\t};\n\n\treturn withSchemaValidation(\n\t\tEncodedModularChangesetV1,\n\t\tmodularChangeCodec,\n\t\tcodecOptions.jsonValidator,\n\t);\n}\n\nfunction getChangeHandler(\n\tfieldKinds: FieldKindConfiguration,\n\tfieldKind: FieldKindIdentifier,\n): FieldChangeHandler<unknown> {\n\tif (fieldKind === genericFieldKind.identifier) {\n\t\treturn genericFieldKind.changeHandler;\n\t}\n\n\tconst handler = fieldKinds.get(fieldKind)?.kind.changeHandler;\n\tassert(handler !== undefined, 0x9c1 /* Unknown field kind */);\n\treturn handler;\n}\n\nfunction encodeRevisionOpt(\n\trevisionCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\trevision: RevisionTag | undefined,\n\tcontext: ChangeEncodingContext,\n): EncodedRevisionTag | undefined {\n\tif (revision === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn revision === context.revision ? undefined : revisionCodec.encode(revision, context);\n}\n"]}
@@ -2,14 +2,14 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type ICodecOptions, type IJsonCodec } from "../../codec/index.js";
6
- import type { ChangeEncodingContext, EncodedRevisionTag, RevisionTag } from "../../core/index.js";
5
+ import { type ICodecOptions, type IJsonCodec, type JsonCodecPart } from "../../codec/index.js";
6
+ import type { ChangeEncodingContext, RevisionTag, RevisionTagSchema } from "../../core/index.js";
7
7
  import type { FieldBatchCodec } from "../chunked-forest/index.js";
8
8
  import { TreeCompressionStrategy } from "../treeCompressionUtils.js";
9
9
  import type { FieldKindConfiguration } from "./fieldKindConfiguration.js";
10
10
  import { EncodedModularChangesetV2 } from "./modularChangeFormatV2.js";
11
11
  import type { ModularChangeset } from "./modularChangeTypes.js";
12
12
  type ModularChangeCodec = IJsonCodec<ModularChangeset, EncodedModularChangesetV2, EncodedModularChangesetV2, ChangeEncodingContext>;
13
- export declare function makeModularChangeCodecV2(fieldKinds: FieldKindConfiguration, revisionTagCodec: IJsonCodec<RevisionTag, EncodedRevisionTag, EncodedRevisionTag, ChangeEncodingContext>, fieldsCodec: FieldBatchCodec, codecOptions: ICodecOptions, chunkCompressionStrategy?: TreeCompressionStrategy): ModularChangeCodec;
13
+ export declare function makeModularChangeCodecV2(fieldKinds: FieldKindConfiguration, revisionTagCodec: JsonCodecPart<RevisionTag, typeof RevisionTagSchema, ChangeEncodingContext>, fieldsCodec: FieldBatchCodec, codecOptions: ICodecOptions, chunkCompressionStrategy?: TreeCompressionStrategy): ModularChangeCodec;
14
14
  export {};
15
15
  //# sourceMappingURL=modularChangeCodecV2.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"modularChangeCodecV2.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/modularChangeCodecV2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,UAAU,EAEf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACX,qBAAqB,EACrB,kBAAkB,EAClB,WAAW,EACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAM1E,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,KAAK,kBAAkB,GAAG,UAAU,CACnC,gBAAgB,EAChB,yBAAyB,EACzB,yBAAyB,EACzB,qBAAqB,CACrB,CAAC;AAEF,wBAAgB,wBAAwB,CACvC,UAAU,EAAE,sBAAsB,EAClC,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,WAAW,EAAE,eAAe,EAC5B,YAAY,EAAE,aAAa,EAC3B,wBAAwB,GAAE,uBAA4D,GACpF,kBAAkB,CA2CpB"}
1
+ {"version":3,"file":"modularChangeCodecV2.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/modularChangeCodecV2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,aAAa,EAElB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACX,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAM1E,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,KAAK,kBAAkB,GAAG,UAAU,CACnC,gBAAgB,EAChB,yBAAyB,EACzB,yBAAyB,EACzB,qBAAqB,CACrB,CAAC;AAEF,wBAAgB,wBAAwB,CACvC,UAAU,EAAE,sBAAsB,EAClC,gBAAgB,EAAE,aAAa,CAC9B,WAAW,EACX,OAAO,iBAAiB,EACxB,qBAAqB,CACrB,EACD,WAAW,EAAE,eAAe,EAC5B,YAAY,EAAE,aAAa,EAC3B,wBAAwB,GAAE,uBAA4D,GACpF,kBAAkB,CA2CpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"modularChangeCodecV2.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/modularChangeCodecV2.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,mDAI8B;AAO9B,wEAAqE;AAGrE,uEAImC;AACnC,yEAAuE;AAUvE,SAAgB,wBAAwB,CACvC,UAAkC,EAClC,gBAKC,EACD,WAA4B,EAC5B,YAA2B,EAC3B,2BAAoD,iDAAuB,CAAC,UAAU;IAEtF,MAAM,oBAAoB,GAAG,IAAA,iDAAuB,EACnD,UAAU,EACV,gBAAgB,EAChB,YAAY,CACZ,CAAC;IAEF,MAAM,kBAAkB,GAAuB;QAC9C,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;YAC3B,MAAM,OAAO,GAAG,IAAA,sCAAY,EAC3B,MAAM,EACN,OAAO,EACP,oBAAoB,EACpB,gBAAgB,EAChB,WAAW,EACX,wBAAwB,CACK,CAAC;YAC/B,OAAO,CAAC,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC;YACvD,OAAO,OAAO,CAAC;QAChB,CAAC;QAED,MAAM,EAAE,CAAC,aAAwC,EAAE,OAAO,EAAE,EAAE;YAC7D,MAAM,OAAO,GAAG,IAAA,sCAAY,EAC3B,aAAa,EACb,OAAO,EACP,UAAU,EACV,oBAAoB,EACpB,gBAAgB,EAChB,WAAW,EACX,wBAAwB,CACxB,CAAC;YACF,IAAI,aAAa,CAAC,kBAAkB,KAAK,SAAS,EAAE,CAAC;gBACpD,OAAO,CAAC,kBAAkB,GAAG,aAAa,CAAC,kBAAkB,CAAC;YAC/D,CAAC;YACD,OAAO,OAAO,CAAC;QAChB,CAAC;KACD,CAAC;IAEF,OAAO,IAAA,+BAAoB,EAC1B,oDAAyB,EACzB,kBAAkB,EAClB,YAAY,CAAC,aAAa,CAC1B,CAAC;AACH,CAAC;AAtDD,4DAsDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\twithSchemaValidation,\n} from \"../../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tEncodedRevisionTag,\n\tRevisionTag,\n} from \"../../core/index.js\";\nimport type { FieldBatchCodec } from \"../chunked-forest/index.js\";\nimport { TreeCompressionStrategy } from \"../treeCompressionUtils.js\";\n\nimport type { FieldKindConfiguration } from \"./fieldKindConfiguration.js\";\nimport {\n\tencodeChange,\n\tdecodeChange,\n\tgetFieldChangesetCodecs,\n} from \"./modularChangeCodecV1.js\";\nimport { EncodedModularChangesetV2 } from \"./modularChangeFormatV2.js\";\nimport type { ModularChangeset } from \"./modularChangeTypes.js\";\n\ntype ModularChangeCodec = IJsonCodec<\n\tModularChangeset,\n\tEncodedModularChangesetV2,\n\tEncodedModularChangesetV2,\n\tChangeEncodingContext\n>;\n\nexport function makeModularChangeCodecV2(\n\tfieldKinds: FieldKindConfiguration,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\tfieldsCodec: FieldBatchCodec,\n\tcodecOptions: ICodecOptions,\n\tchunkCompressionStrategy: TreeCompressionStrategy = TreeCompressionStrategy.Compressed,\n): ModularChangeCodec {\n\tconst fieldChangesetCodecs = getFieldChangesetCodecs(\n\t\tfieldKinds,\n\t\trevisionTagCodec,\n\t\tcodecOptions,\n\t);\n\n\tconst modularChangeCodec: ModularChangeCodec = {\n\t\tencode: (change, context) => {\n\t\t\tconst encoded = encodeChange(\n\t\t\t\tchange,\n\t\t\t\tcontext,\n\t\t\t\tfieldChangesetCodecs,\n\t\t\t\trevisionTagCodec,\n\t\t\t\tfieldsCodec,\n\t\t\t\tchunkCompressionStrategy,\n\t\t\t) as EncodedModularChangesetV2;\n\t\t\tencoded.noChangeConstraint = change.noChangeConstraint;\n\t\t\treturn encoded;\n\t\t},\n\n\t\tdecode: (encodedChange: EncodedModularChangesetV2, context) => {\n\t\t\tconst decoded = decodeChange(\n\t\t\t\tencodedChange,\n\t\t\t\tcontext,\n\t\t\t\tfieldKinds,\n\t\t\t\tfieldChangesetCodecs,\n\t\t\t\trevisionTagCodec,\n\t\t\t\tfieldsCodec,\n\t\t\t\tchunkCompressionStrategy,\n\t\t\t);\n\t\t\tif (encodedChange.noChangeConstraint !== undefined) {\n\t\t\t\tdecoded.noChangeConstraint = encodedChange.noChangeConstraint;\n\t\t\t}\n\t\t\treturn decoded;\n\t\t},\n\t};\n\n\treturn withSchemaValidation(\n\t\tEncodedModularChangesetV2,\n\t\tmodularChangeCodec,\n\t\tcodecOptions.jsonValidator,\n\t);\n}\n"]}
1
+ {"version":3,"file":"modularChangeCodecV2.js","sourceRoot":"","sources":["../../../src/feature-libraries/modular-schema/modularChangeCodecV2.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,mDAK8B;AAO9B,wEAAqE;AAGrE,uEAImC;AACnC,yEAAuE;AAUvE,SAAgB,wBAAwB,CACvC,UAAkC,EAClC,gBAIC,EACD,WAA4B,EAC5B,YAA2B,EAC3B,2BAAoD,iDAAuB,CAAC,UAAU;IAEtF,MAAM,oBAAoB,GAAG,IAAA,iDAAuB,EACnD,UAAU,EACV,gBAAgB,EAChB,YAAY,CACZ,CAAC;IAEF,MAAM,kBAAkB,GAAuB;QAC9C,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;YAC3B,MAAM,OAAO,GAAG,IAAA,sCAAY,EAC3B,MAAM,EACN,OAAO,EACP,oBAAoB,EACpB,gBAAgB,EAChB,WAAW,EACX,wBAAwB,CACK,CAAC;YAC/B,OAAO,CAAC,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC;YACvD,OAAO,OAAO,CAAC;QAChB,CAAC;QAED,MAAM,EAAE,CAAC,aAAwC,EAAE,OAAO,EAAE,EAAE;YAC7D,MAAM,OAAO,GAAG,IAAA,sCAAY,EAC3B,aAAa,EACb,OAAO,EACP,UAAU,EACV,oBAAoB,EACpB,gBAAgB,EAChB,WAAW,EACX,wBAAwB,CACxB,CAAC;YACF,IAAI,aAAa,CAAC,kBAAkB,KAAK,SAAS,EAAE,CAAC;gBACpD,OAAO,CAAC,kBAAkB,GAAG,aAAa,CAAC,kBAAkB,CAAC;YAC/D,CAAC;YACD,OAAO,OAAO,CAAC;QAChB,CAAC;KACD,CAAC;IAEF,OAAO,IAAA,+BAAoB,EAC1B,oDAAyB,EACzB,kBAAkB,EAClB,YAAY,CAAC,aAAa,CAC1B,CAAC;AACH,CAAC;AArDD,4DAqDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\ttype JsonCodecPart,\n\twithSchemaValidation,\n} from \"../../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tRevisionTag,\n\tRevisionTagSchema,\n} from \"../../core/index.js\";\nimport type { FieldBatchCodec } from \"../chunked-forest/index.js\";\nimport { TreeCompressionStrategy } from \"../treeCompressionUtils.js\";\n\nimport type { FieldKindConfiguration } from \"./fieldKindConfiguration.js\";\nimport {\n\tencodeChange,\n\tdecodeChange,\n\tgetFieldChangesetCodecs,\n} from \"./modularChangeCodecV1.js\";\nimport { EncodedModularChangesetV2 } from \"./modularChangeFormatV2.js\";\nimport type { ModularChangeset } from \"./modularChangeTypes.js\";\n\ntype ModularChangeCodec = IJsonCodec<\n\tModularChangeset,\n\tEncodedModularChangesetV2,\n\tEncodedModularChangesetV2,\n\tChangeEncodingContext\n>;\n\nexport function makeModularChangeCodecV2(\n\tfieldKinds: FieldKindConfiguration,\n\trevisionTagCodec: JsonCodecPart<\n\t\tRevisionTag,\n\t\ttypeof RevisionTagSchema,\n\t\tChangeEncodingContext\n\t>,\n\tfieldsCodec: FieldBatchCodec,\n\tcodecOptions: ICodecOptions,\n\tchunkCompressionStrategy: TreeCompressionStrategy = TreeCompressionStrategy.Compressed,\n): ModularChangeCodec {\n\tconst fieldChangesetCodecs = getFieldChangesetCodecs(\n\t\tfieldKinds,\n\t\trevisionTagCodec,\n\t\tcodecOptions,\n\t);\n\n\tconst modularChangeCodec: ModularChangeCodec = {\n\t\tencode: (change, context) => {\n\t\t\tconst encoded = encodeChange(\n\t\t\t\tchange,\n\t\t\t\tcontext,\n\t\t\t\tfieldChangesetCodecs,\n\t\t\t\trevisionTagCodec,\n\t\t\t\tfieldsCodec,\n\t\t\t\tchunkCompressionStrategy,\n\t\t\t) as EncodedModularChangesetV2;\n\t\t\tencoded.noChangeConstraint = change.noChangeConstraint;\n\t\t\treturn encoded;\n\t\t},\n\n\t\tdecode: (encodedChange: EncodedModularChangesetV2, context) => {\n\t\t\tconst decoded = decodeChange(\n\t\t\t\tencodedChange,\n\t\t\t\tcontext,\n\t\t\t\tfieldKinds,\n\t\t\t\tfieldChangesetCodecs,\n\t\t\t\trevisionTagCodec,\n\t\t\t\tfieldsCodec,\n\t\t\t\tchunkCompressionStrategy,\n\t\t\t);\n\t\t\tif (encodedChange.noChangeConstraint !== undefined) {\n\t\t\t\tdecoded.noChangeConstraint = encodedChange.noChangeConstraint;\n\t\t\t}\n\t\t\treturn decoded;\n\t\t},\n\t};\n\n\treturn withSchemaValidation(\n\t\tEncodedModularChangesetV2,\n\t\tmodularChangeCodec,\n\t\tcodecOptions.jsonValidator,\n\t);\n}\n"]}