@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":"compressedEncode.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/compressedEncode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAGpF,OAAO,EAUN,WAAW,GACX,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD,OAAO,EAEN,KAAK,IAAI,YAAY,EACrB,kCAAkC,GAClC,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAMN,uBAAuB,EACvB,YAAY,GACZ,MAAM,aAAa,CAAC;AAErB;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC/B,UAAsB,EACtB,OAAuB;IAEvB,MAAM,WAAW,GAAmB,EAAE,CAAC;IAEvC,6DAA6D;IAC7D,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE,CAAC;QACjC,MAAM,MAAM,GAAiB,EAAE,CAAC;QAChC,eAAe,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACrD,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,kCAAkC,CAAC,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;AACzE,CAAC;AAoED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,OAAoB;IAClD,OAAO;QACN,WAAW,CACV,MAA8B,EAC9B,OAAuB,EACvB,YAA0B;YAE1B,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;QAC9E,CAAC;QACD,KAAK,EAAE,OAAO,CAAC,KAAK;KACpB,CAAC;AACH,CAAC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AsB,GAAtB,sBAAsB,CAAoB;IACzD,CAAC;IACG,WAAW,CACjB,MAA8B,EAC9B,OAAuB,EACvB,YAA0B;QAE1B,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;IACzD,CAAC;IAED,IAAY,OAAO;QAClB,6HAA6H;QAC7H,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACpC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACpF,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAED,IAAW,KAAK;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;IAC3B,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase, fail } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport {\n\tCursorLocationType,\n\ttype FieldKey,\n\ttype FieldKindData,\n\ttype FieldKindIdentifier,\n\ttype ITreeCursorSynchronous,\n\ttype TreeChunk,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype Value,\n\tforEachNode,\n} from \"../../../core/index.js\";\nimport { getOrCreate } from \"../../../util/index.js\";\n\nimport type { Counter, DeduplicationTable } from \"./chunkCodecUtilities.js\";\nimport {\n\ttype BufferFormat as BufferFormatGeneric,\n\tShape as ShapeGeneric,\n\tupdateShapesAndIdentifiersEncoding,\n} from \"./chunkEncodingGeneric.js\";\nimport type { IncrementalEncoder } from \"./codecs.js\";\nimport type { FieldBatch } from \"./fieldBatch.js\";\nimport {\n\ttype EncodedAnyShape,\n\ttype EncodedChunkShape,\n\ttype EncodedFieldBatch,\n\ttype EncodedNestedArrayShape,\n\ttype EncodedValueShape,\n\tFieldBatchFormatVersion,\n\tSpecialField,\n} from \"./format.js\";\n\n/**\n * Encode data from `FieldBatch` into an `EncodedFieldBatch`.\n *\n * Optimized for encoded size and encoding performance.\n *\n * Most of the compression strategy comes from the policy provided via `context`.\n */\nexport function compressedEncode(\n\tfieldBatch: FieldBatch,\n\tcontext: EncoderContext,\n): EncodedFieldBatch {\n\tconst batchBuffer: BufferFormat[] = [];\n\n\t// Populate buffer, including shape and identifier references\n\tfor (const cursor of fieldBatch) {\n\t\tconst buffer: BufferFormat = [];\n\t\tanyFieldEncoder.encodeField(cursor, context, buffer);\n\t\tbatchBuffer.push(buffer);\n\t}\n\treturn updateShapesAndIdentifiersEncoding(context.version, batchBuffer);\n}\n\nexport type BufferFormat = BufferFormatGeneric<EncodedChunkShape>;\nexport type Shape = ShapeGeneric<EncodedChunkShape>;\n\n/**\n * Like {@link FieldEncoder}, except data will be prefixed with the key.\n */\nexport interface KeyedFieldEncoder {\n\treadonly key: FieldKey;\n\treadonly encoder: FieldEncoder;\n}\n\n/**\n * An encoder with an associated shape.\n */\nexport interface Encoder {\n\t/**\n\t * The shape which describes how the encoded data is laid out.\n\t * Used by decoders to interpret the output of `encodeNode`.\n\t */\n\treadonly shape: Shape;\n}\n\n/**\n * An encoder for a specific shape of node.\n *\n * Can only be used with compatible nodes.\n */\nexport interface NodeEncoder extends Encoder {\n\t/**\n\t * @param cursor - in Nodes mode. Does not move cursor.\n\t */\n\tencodeNode(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void;\n}\n\n/**\n * Like {@link NodeEncoder}, except encodes a run of nodes.\n */\nexport interface NodesEncoder extends Encoder {\n\t/**\n\t * @param cursor - in Nodes mode. Moves cursor however many nodes it encodes.\n\t */\n\tencodeNodes(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void;\n}\n\n/**\n * Like {@link NodeEncoder}, except encodes a field.\n */\nexport interface FieldEncoder extends Encoder {\n\t/**\n\t * @param cursor - in Fields mode. Encodes entire field.\n\t */\n\tencodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void;\n}\n\n/**\n * Makes a {@link FieldEncoder} which runs `encoder` on every node in the field.\n * This does not encode the number nodes: the user of this may need to encode that elsewhere.\n */\nexport function asFieldEncoder(encoder: NodeEncoder): FieldEncoder {\n\treturn {\n\t\tencodeField(\n\t\t\tcursor: ITreeCursorSynchronous,\n\t\t\tcontext: EncoderContext,\n\t\t\toutputBuffer: BufferFormat,\n\t\t): void {\n\t\t\tforEachNode(cursor, () => encoder.encodeNode(cursor, context, outputBuffer));\n\t\t},\n\t\tshape: encoder.shape,\n\t};\n}\n\n/**\n * Adapt a {@link NodeEncoder} to a {@link NodesEncoder} which invokes `encoder` once.\n */\nexport function asNodesEncoder(encoder: NodeEncoder): NodesEncoder {\n\treturn {\n\t\tencodeNodes(\n\t\t\tcursor: ITreeCursorSynchronous,\n\t\t\tcontext: EncoderContext,\n\t\t\toutputBuffer: BufferFormat,\n\t\t): void {\n\t\t\tencoder.encodeNode(cursor, context, outputBuffer);\n\t\t\tcursor.nextNode();\n\t\t},\n\t\tshape: encoder.shape,\n\t};\n}\n\n/**\n * Encodes a chunk with {@link EncodedAnyShape} by prefixing the data with its shape.\n */\nexport class AnyShape extends ShapeGeneric<EncodedChunkShape> {\n\tprivate constructor() {\n\t\tsuper();\n\t}\n\tpublic static readonly instance = new AnyShape();\n\n\tpublic encodeShape(\n\t\tidentifiers: DeduplicationTable<string>,\n\t\tshapes: DeduplicationTable<Shape>,\n\t): EncodedChunkShape {\n\t\tconst encodedAnyShape: EncodedAnyShape = 0;\n\t\treturn { d: encodedAnyShape };\n\t}\n\n\tpublic countReferencedShapesAndIdentifiers(\n\t\tidentifiers: Counter<string>,\n\t\tshapeDiscovered: (shape: Shape) => void,\n\t): void {}\n\n\tpublic static encodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t\tencoder: FieldEncoder,\n\t): void {\n\t\toutputBuffer.push(encoder.shape);\n\t\tencoder.encodeField(cursor, context, outputBuffer);\n\t}\n\n\tpublic static encodeNode(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t\tencoder: NodeEncoder,\n\t): void {\n\t\toutputBuffer.push(encoder.shape);\n\t\tencoder.encodeNode(cursor, context, outputBuffer);\n\t}\n\n\tpublic static encodeNodes(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t\tencoder: NodesEncoder,\n\t): void {\n\t\toutputBuffer.push(encoder.shape);\n\t\tencoder.encodeNodes(cursor, context, outputBuffer);\n\t}\n}\n\n/**\n * Encodes a single node polymorphically.\n */\nexport const anyNodeEncoder: NodeEncoder = {\n\tencodeNode(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\t// TODO: Fast path uniform chunk content.\n\t\tconst nodeEncoder = context.nodeEncoderFromSchema(cursor.type);\n\t\tAnyShape.encodeNode(cursor, context, outputBuffer, nodeEncoder);\n\t},\n\n\tshape: AnyShape.instance,\n};\n\n/**\n * Encodes a field polymorphically.\n */\nexport const anyFieldEncoder: FieldEncoder = {\n\tencodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\t// TODO: Fast path uniform chunks.\n\n\t\tif (cursor.getFieldLength() === 0) {\n\t\t\tconst shape = InlineArrayEncoder.empty;\n\t\t\tAnyShape.encodeField(cursor, context, outputBuffer, shape);\n\t\t} else if (cursor.getFieldLength() === 1) {\n\t\t\t// Fast path chunk of size one size one at least: skip nested array.\n\t\t\tcursor.enterNode(0);\n\t\t\tanyNodeEncoder.encodeNode(cursor, context, outputBuffer);\n\t\t\tcursor.exitNode();\n\t\t} else {\n\t\t\t// TODO: more efficient encoding for common cases.\n\t\t\t// Could try to find more specific shape compatible with all children than `anyNodeEncoder`.\n\n\t\t\tconst shape = context.nestedArrayEncoder(anyNodeEncoder);\n\t\t\tAnyShape.encodeField(cursor, context, outputBuffer, shape);\n\t\t}\n\t},\n\n\tshape: AnyShape.instance,\n};\n\n/**\n * Encodes a chunk using {@link EncodedInlineArrayShape}.\n * @remarks\n * The fact this is also a Shape is an implementation detail of the encoder: that allows the shape it uses to be itself,\n * which is an easy way to keep all the related code together without extra objects.\n */\nexport class InlineArrayEncoder\n\textends ShapeGeneric<EncodedChunkShape>\n\timplements NodesEncoder, FieldEncoder\n{\n\tpublic static readonly empty: InlineArrayEncoder = new InlineArrayEncoder(0, {\n\t\tget shape() {\n\t\t\t// Not actually used, makes count work without adding an additional shape.\n\t\t\treturn InlineArrayEncoder.empty;\n\t\t},\n\t\tencodeNodes(\n\t\t\tcursor: ITreeCursorSynchronous,\n\t\t\tcontext: EncoderContext,\n\t\t\toutputBuffer: BufferFormat,\n\t\t): void {\n\t\t\tfail(0xb4d /* Empty array should not encode any nodes */);\n\t\t},\n\t});\n\n\t/**\n\t * @param length - number of invocations of `inner`.\n\t */\n\tpublic constructor(\n\t\tpublic readonly length: number,\n\t\tpublic readonly inner: NodesEncoder,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic encodeNodes(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\t// Linter is wrong about this loop being for-of compatible.\n\t\t// eslint-disable-next-line @typescript-eslint/prefer-for-of\n\t\tfor (let index = 0; index < this.length; index++) {\n\t\t\tthis.inner.encodeNodes(cursor, context, outputBuffer);\n\t\t}\n\t}\n\n\tpublic encodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\t// Its possible individual items from this array encode multiple nodes, so don't assume === here.\n\t\tassert(\n\t\t\tcursor.getFieldLength() >= this.length,\n\t\t\t0x73c /* unexpected length for fixed length array */,\n\t\t);\n\t\tcursor.firstNode();\n\t\tthis.encodeNodes(cursor, context, outputBuffer);\n\t\tassert(\n\t\t\tcursor.mode === CursorLocationType.Fields,\n\t\t\t0x73d /* should return to fields mode when finished encoding */,\n\t\t);\n\t}\n\n\tpublic encodeShape(\n\t\tidentifiers: DeduplicationTable<string>,\n\t\tshapes: DeduplicationTable<Shape>,\n\t): EncodedChunkShape {\n\t\treturn {\n\t\t\tb: {\n\t\t\t\tlength: this.length,\n\t\t\t\tshape: shapes.valueToIndex.get(this.inner.shape) ?? fail(0xb4e /* missing shape */),\n\t\t\t},\n\t\t};\n\t}\n\n\tpublic countReferencedShapesAndIdentifiers(\n\t\tidentifiers: Counter<string>,\n\t\tshapeDiscovered: (shape: Shape) => void,\n\t): void {\n\t\tshapeDiscovered(this.inner.shape);\n\t}\n\n\tpublic get shape(): this {\n\t\treturn this;\n\t}\n}\n\n/**\n * Encodes the shape for a nested array as {@link EncodedNestedArrayShape} shape.\n */\nexport class NestedArrayShape extends ShapeGeneric<EncodedChunkShape> {\n\t/**\n\t * @param innerShape - The shape of each item in this nested array.\n\t */\n\tpublic constructor(public readonly innerShape: Shape) {\n\t\tsuper();\n\t}\n\n\tpublic encodeShape(\n\t\tidentifiers: DeduplicationTable<string>,\n\t\tshapes: DeduplicationTable<Shape>,\n\t): EncodedChunkShape {\n\t\tconst shape: EncodedNestedArrayShape =\n\t\t\tshapes.valueToIndex.get(this.innerShape) ??\n\t\t\tfail(0xb4f /* index for shape not found in table */);\n\t\treturn {\n\t\t\ta: shape,\n\t\t};\n\t}\n\n\tpublic countReferencedShapesAndIdentifiers(\n\t\tidentifiers: Counter<string>,\n\t\tshapeDiscovered: (shape: Shape) => void,\n\t): void {\n\t\tshapeDiscovered(this.innerShape);\n\t}\n}\n\n/**\n * Encodes a field as a nested array with the {@link EncodedNestedArrayShape} shape.\n * @remarks\n * The fact this is also exposes a Shape is an implementation detail: it allows the shape it uses to be itself\n * which is an easy way to keep all the related code together without extra objects.\n */\nexport class NestedArrayEncoder implements FieldEncoder {\n\tpublic constructor(\n\t\tpublic readonly innerEncoder: NodeEncoder,\n\t\tpublic readonly shape: NestedArrayShape = new NestedArrayShape(innerEncoder.shape),\n\t) {}\n\n\tpublic encodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\tconst buffer: BufferFormat = [];\n\t\tlet allNonZeroSize = true;\n\t\tconst length = cursor.getFieldLength();\n\t\tforEachNode(cursor, () => {\n\t\t\tconst before = buffer.length;\n\t\t\tthis.innerEncoder.encodeNode(cursor, context, buffer);\n\t\t\tallNonZeroSize &&= buffer.length - before !== 0;\n\t\t});\n\t\tif (buffer.length === 0) {\n\t\t\t// This relies on the number of inner chunks being the same as the number of nodes.\n\t\t\t// If making inner a `NodesEncoder`, this code will have to be adjusted accordingly.\n\t\t\toutputBuffer.push(length);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\tallNonZeroSize,\n\t\t\t\t0x73e /* either all or none of the members of a nested array must be 0 sized, or there is no way the decoder could process the content correctly. */,\n\t\t\t);\n\t\t\toutputBuffer.push(buffer);\n\t\t}\n\t}\n}\n\n/**\n * Encodes the shape for an incremental chunk as {@link EncodedIncrementalChunkShape} shape.\n */\nexport class IncrementalChunkShape extends ShapeGeneric<EncodedChunkShape> {\n\tpublic encodeShape(\n\t\tidentifiers: DeduplicationTable<string>,\n\t\tshapes: DeduplicationTable<Shape>,\n\t): EncodedChunkShape {\n\t\treturn {\n\t\t\te: 0 /* EncodedIncrementalChunkShape */,\n\t\t};\n\t}\n\n\tpublic countReferencedShapesAndIdentifiers(\n\t\tidentifiers: Counter<string>,\n\t\tshapeDiscovered: (shape: Shape) => void,\n\t): void {}\n\n\tpublic get shape(): this {\n\t\treturn this;\n\t}\n}\n\n/**\n * Encodes an incremental field whose tree chunks are encoded separately and referenced by their {@link ChunkReferenceId}.\n * The shape of the content of this field is {@link NestedArrayShape}.\n * The inner items of the array have shape {@link IncrementalChunkShape} and are {@link ChunkReferenceId}s\n * of the encoded chunks.\n */\nexport const incrementalFieldEncoder: FieldEncoder = {\n\tencodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\tassert(\n\t\t\tcontext.incrementalEncoder !== undefined,\n\t\t\t0xc88 /* incremental encoder must be defined to use incrementalFieldEncoder */,\n\t\t);\n\t\tassert(\n\t\t\tcontext.version >= FieldBatchFormatVersion.v2,\n\t\t\t0xca1 /* Unsupported FieldBatchFormatVersion for incremental encoding; must be v2 or higher */,\n\t\t);\n\n\t\tconst chunkReferenceIds = context.incrementalEncoder.encodeIncrementalField(\n\t\t\tcursor,\n\t\t\t(chunk: TreeChunk) => compressedEncode([chunk.cursor()], context),\n\t\t);\n\t\toutputBuffer.push(chunkReferenceIds);\n\t},\n\n\tshape: new NestedArrayShape(new IncrementalChunkShape() /* innerShape */),\n};\n\n/**\n * Encode `value` with `shape` into `outputBuffer`.\n *\n * Requires that `value` is compatible with `shape`.\n */\nexport function encodeValue(\n\tvalue: Value,\n\tshape: EncodedValueShape,\n\toutputBuffer: BufferFormat,\n): void {\n\tif (shape === undefined) {\n\t\tif (value === undefined) {\n\t\t\toutputBuffer.push(false);\n\t\t} else {\n\t\t\toutputBuffer.push(true, value);\n\t\t}\n\t} else {\n\t\tif (shape === true) {\n\t\t\tassert(value !== undefined, 0x78d /* required value must not be missing */);\n\t\t\toutputBuffer.push(value);\n\t\t} else if (shape === false) {\n\t\t\tassert(value === undefined, 0x73f /* incompatible value shape: expected no value */);\n\t\t} else if (Array.isArray(shape)) {\n\t\t\tassert(shape.length === 1, 0x740 /* expected a single constant for value */);\n\t\t} else if (shape === SpecialField.Identifier) {\n\t\t\t// This case is a special case handling the encoding of identifier fields.\n\t\t\tassert(value !== undefined, 0x998 /* required value must not be missing */);\n\t\t\toutputBuffer.push(value);\n\t\t} else {\n\t\t\t// EncodedCounter case:\n\t\t\tunreachableCase(shape, \"Encoding values as deltas is not yet supported\");\n\t\t}\n\t}\n}\n\n/**\n * Provides common contextual information during encoding, like schema and policy settings.\n * Also, provides a cache to avoid duplicating equivalent shapes during a batch of encode operations.\n * @remarks\n * To avoid Shape duplication, any Shapes used in the encoding should either be:\n * - Singletons defined in a static scope.\n * - Cached in this object for future reuse such that all equivalent Shapes are deduplicated.\n */\nexport class EncoderContext implements NodeEncodeBuilder, FieldEncodeBuilder {\n\tprivate readonly nodeEncodersFromSchema: Map<TreeNodeSchemaIdentifier, NodeEncoder> =\n\t\tnew Map();\n\tprivate readonly nestedArrayEncoders: Map<NodeEncoder, NestedArrayEncoder> = new Map();\n\tpublic constructor(\n\t\tprivate readonly nodeEncoderFromPolicy: NodeEncoderPolicy,\n\t\tprivate readonly fieldEncoderFromPolicy: FieldEncoderPolicy,\n\t\tpublic readonly fieldShapes: ReadonlyMap<FieldKindIdentifier, FieldKindData>,\n\t\tpublic readonly idCompressor: IIdCompressor,\n\t\t/**\n\t\t * To be used to encode incremental chunks, if any.\n\t\t * @remarks\n\t\t * See {@link IncrementalEncoder} for more information.\n\t\t */\n\t\tpublic readonly incrementalEncoder: IncrementalEncoder | undefined,\n\t\tpublic readonly version: FieldBatchFormatVersion,\n\t) {}\n\n\tpublic nodeEncoderFromSchema(schemaName: TreeNodeSchemaIdentifier): NodeEncoder {\n\t\treturn getOrCreate(this.nodeEncodersFromSchema, schemaName, () =>\n\t\t\tthis.nodeEncoderFromPolicy(this, schemaName),\n\t\t);\n\t}\n\n\tpublic fieldEncoderFromSchema(fieldSchema: TreeFieldStoredSchema): FieldEncoder {\n\t\treturn new LazyFieldEncoder(this, fieldSchema, this.fieldEncoderFromPolicy);\n\t}\n\n\tpublic nestedArrayEncoder(inner: NodeEncoder): NestedArrayEncoder {\n\t\treturn getOrCreate(this.nestedArrayEncoders, inner, () => new NestedArrayEncoder(inner));\n\t}\n}\n\nexport interface NodeEncodeBuilder {\n\tnodeEncoderFromSchema(schemaName: TreeNodeSchemaIdentifier): NodeEncoder;\n}\n\nexport interface FieldEncodeBuilder {\n\tfieldEncoderFromSchema(schema: TreeFieldStoredSchema): FieldEncoder;\n}\n\n/**\n * The policy for building a {@link FieldEncoder} for a field.\n */\nexport type FieldEncoderPolicy = (\n\tnodeBuilder: NodeEncodeBuilder,\n\tschema: TreeFieldStoredSchema,\n) => FieldEncoder;\n\n/**\n * The policy for building a {@link NodeEncoder} for a node.\n */\nexport type NodeEncoderPolicy = (\n\tfieldBuilder: FieldEncodeBuilder,\n\tschemaName: TreeNodeSchemaIdentifier,\n) => NodeEncoder;\n\nclass LazyFieldEncoder implements FieldEncoder {\n\tprivate encoderLazy: FieldEncoder | undefined;\n\n\tpublic constructor(\n\t\tpublic readonly nodeBuilder: NodeEncodeBuilder,\n\t\tpublic readonly fieldSchema: TreeFieldStoredSchema,\n\t\tprivate readonly fieldEncoderFromPolicy: FieldEncoderPolicy,\n\t) {}\n\tpublic encodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\tthis.encoder.encodeField(cursor, context, outputBuffer);\n\t}\n\n\tprivate get encoder(): FieldEncoder {\n\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- using ??= could change behavior if value is falsy\n\t\tif (this.encoderLazy === undefined) {\n\t\t\tthis.encoderLazy = this.fieldEncoderFromPolicy(this.nodeBuilder, this.fieldSchema);\n\t\t}\n\t\treturn this.encoderLazy;\n\t}\n\n\tpublic get shape(): Shape {\n\t\treturn this.encoder.shape;\n\t}\n}\n"]}
1
+ {"version":3,"file":"compressedEncode.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/compressedE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,OAAO,EAAE,YAAY,CAAC,CAAC;IACzD,CAAC;IAED,IAAY,OAAO;QAClB,6HAA6H;QAC7H,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACpC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACpF,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAED,IAAW,KAAK;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;IAC3B,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase, fail } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport {\n\tCursorLocationType,\n\ttype FieldKey,\n\ttype FieldKindData,\n\ttype FieldKindIdentifier,\n\ttype ITreeCursorSynchronous,\n\ttype TreeChunk,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype Value,\n\tforEachNode,\n} from \"../../../core/index.js\";\nimport { getOrCreate } from \"../../../util/index.js\";\n\nimport type { Counter, DeduplicationTable } from \"./chunkCodecUtilities.js\";\nimport {\n\ttype BufferFormat as BufferFormatGeneric,\n\tShape as ShapeGeneric,\n\tupdateShapesAndIdentifiersEncoding,\n} from \"./chunkEncodingGeneric.js\";\nimport type { IncrementalEncoder } from \"./codecs.js\";\nimport type { FieldBatch } from \"./fieldBatch.js\";\nimport {\n\ttype EncodedAnyShape,\n\ttype EncodedChunkShapeV1,\n\ttype EncodedChunkShapeV1OrV2,\n\ttype EncodedChunkShapeV2,\n\ttype EncodedFieldBatchV1OrV2,\n\ttype EncodedNestedArrayShape,\n\ttype EncodedValueShape,\n\tFieldBatchFormatVersion,\n\tSpecialField,\n} from \"./format/index.js\";\n\n/**\n * Encode data from `FieldBatch` into an `EncodedFieldBatch`.\n *\n * Optimized for encoded size and encoding performance.\n *\n * Most of the compression strategy comes from the policy provided via `context`.\n */\nexport function compressedEncode(\n\tfieldBatch: FieldBatch,\n\tcontext: EncoderContext,\n): EncodedFieldBatchV1OrV2 {\n\tconst batchBuffer: BufferFormat[] = [];\n\n\t// Populate buffer, including shape and identifier references\n\tfor (const cursor of fieldBatch) {\n\t\tconst buffer: BufferFormat = [];\n\t\tanyFieldEncoder.encodeField(cursor, context, buffer);\n\t\tbatchBuffer.push(buffer);\n\t}\n\treturn updateShapesAndIdentifiersEncoding(context.version, batchBuffer);\n}\n\nexport type BufferFormat = BufferFormatGeneric<EncodedChunkShapeV1OrV2>;\nexport type Shape = ShapeGeneric<EncodedChunkShapeV1OrV2>;\n\n/**\n * Like {@link FieldEncoder}, except data will be prefixed with the key.\n */\nexport interface KeyedFieldEncoder {\n\treadonly key: FieldKey;\n\treadonly encoder: FieldEncoder;\n}\n\n/**\n * An encoder with an associated shape.\n */\nexport interface Encoder {\n\t/**\n\t * The shape which describes how the encoded data is laid out.\n\t * Used by decoders to interpret the output of `encodeNode`.\n\t */\n\treadonly shape: Shape;\n}\n\n/**\n * An encoder for a specific shape of node.\n *\n * Can only be used with compatible nodes.\n */\nexport interface NodeEncoder extends Encoder {\n\t/**\n\t * @param cursor - in Nodes mode. Does not move cursor.\n\t */\n\tencodeNode(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void;\n}\n\n/**\n * Like {@link NodeEncoder}, except encodes a run of nodes.\n */\nexport interface NodesEncoder extends Encoder {\n\t/**\n\t * @param cursor - in Nodes mode. Moves cursor however many nodes it encodes.\n\t */\n\tencodeNodes(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void;\n}\n\n/**\n * Like {@link NodeEncoder}, except encodes a field.\n */\nexport interface FieldEncoder extends Encoder {\n\t/**\n\t * @param cursor - in Fields mode. Encodes entire field.\n\t */\n\tencodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void;\n}\n\n/**\n * Makes a {@link FieldEncoder} which runs `encoder` on every node in the field.\n * This does not encode the number nodes: the user of this may need to encode that elsewhere.\n */\nexport function asFieldEncoder(encoder: NodeEncoder): FieldEncoder {\n\treturn {\n\t\tencodeField(\n\t\t\tcursor: ITreeCursorSynchronous,\n\t\t\tcontext: EncoderContext,\n\t\t\toutputBuffer: BufferFormat,\n\t\t): void {\n\t\t\tforEachNode(cursor, () => encoder.encodeNode(cursor, context, outputBuffer));\n\t\t},\n\t\tshape: encoder.shape,\n\t};\n}\n\n/**\n * Adapt a {@link NodeEncoder} to a {@link NodesEncoder} which invokes `encoder` once.\n */\nexport function asNodesEncoder(encoder: NodeEncoder): NodesEncoder {\n\treturn {\n\t\tencodeNodes(\n\t\t\tcursor: ITreeCursorSynchronous,\n\t\t\tcontext: EncoderContext,\n\t\t\toutputBuffer: BufferFormat,\n\t\t): void {\n\t\t\tencoder.encodeNode(cursor, context, outputBuffer);\n\t\t\tcursor.nextNode();\n\t\t},\n\t\tshape: encoder.shape,\n\t};\n}\n\n/**\n * Encodes a chunk with {@link EncodedAnyShape} by prefixing the data with its shape.\n */\nexport class AnyShape extends ShapeGeneric<EncodedChunkShapeV1OrV2> {\n\tprivate constructor() {\n\t\tsuper();\n\t}\n\tpublic static readonly instance = new AnyShape();\n\n\tpublic encodeShape(\n\t\tidentifiers: DeduplicationTable<string>,\n\t\tshapes: DeduplicationTable<Shape>,\n\t): EncodedChunkShapeV1 {\n\t\tconst encodedAnyShape: EncodedAnyShape = 0;\n\t\treturn { d: encodedAnyShape };\n\t}\n\n\tpublic countReferencedShapesAndIdentifiers(\n\t\tidentifiers: Counter<string>,\n\t\tshapeDiscovered: (shape: Shape) => void,\n\t): void {}\n\n\tpublic static encodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t\tencoder: FieldEncoder,\n\t): void {\n\t\toutputBuffer.push(encoder.shape);\n\t\tencoder.encodeField(cursor, context, outputBuffer);\n\t}\n\n\tpublic static encodeNode(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t\tencoder: NodeEncoder,\n\t): void {\n\t\toutputBuffer.push(encoder.shape);\n\t\tencoder.encodeNode(cursor, context, outputBuffer);\n\t}\n\n\tpublic static encodeNodes(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t\tencoder: NodesEncoder,\n\t): void {\n\t\toutputBuffer.push(encoder.shape);\n\t\tencoder.encodeNodes(cursor, context, outputBuffer);\n\t}\n}\n\n/**\n * Encodes a single node polymorphically.\n */\nexport const anyNodeEncoder: NodeEncoder = {\n\tencodeNode(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\t// TODO: Fast path uniform chunk content.\n\t\tconst nodeEncoder = context.nodeEncoderFromSchema(cursor.type);\n\t\tAnyShape.encodeNode(cursor, context, outputBuffer, nodeEncoder);\n\t},\n\n\tshape: AnyShape.instance,\n};\n\n/**\n * Encodes a field polymorphically.\n */\nexport const anyFieldEncoder: FieldEncoder = {\n\tencodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\t// TODO: Fast path uniform chunks.\n\n\t\tif (cursor.getFieldLength() === 0) {\n\t\t\tconst shape = InlineArrayEncoder.empty;\n\t\t\tAnyShape.encodeField(cursor, context, outputBuffer, shape);\n\t\t} else if (cursor.getFieldLength() === 1) {\n\t\t\t// Fast path chunk of size one size one at least: skip nested array.\n\t\t\tcursor.enterNode(0);\n\t\t\tanyNodeEncoder.encodeNode(cursor, context, outputBuffer);\n\t\t\tcursor.exitNode();\n\t\t} else {\n\t\t\t// TODO: more efficient encoding for common cases.\n\t\t\t// Could try to find more specific shape compatible with all children than `anyNodeEncoder`.\n\n\t\t\tconst shape = context.nestedArrayEncoder(anyNodeEncoder);\n\t\t\tAnyShape.encodeField(cursor, context, outputBuffer, shape);\n\t\t}\n\t},\n\n\tshape: AnyShape.instance,\n};\n\n/**\n * Encodes a chunk using {@link EncodedInlineArrayShape}.\n * @remarks\n * The fact this is also a Shape is an implementation detail of the encoder: that allows the shape it uses to be itself,\n * which is an easy way to keep all the related code together without extra objects.\n */\nexport class InlineArrayEncoder\n\textends ShapeGeneric<EncodedChunkShapeV1OrV2>\n\timplements NodesEncoder, FieldEncoder\n{\n\tpublic static readonly empty: InlineArrayEncoder = new InlineArrayEncoder(0, {\n\t\tget shape() {\n\t\t\t// Not actually used, makes count work without adding an additional shape.\n\t\t\treturn InlineArrayEncoder.empty;\n\t\t},\n\t\tencodeNodes(\n\t\t\tcursor: ITreeCursorSynchronous,\n\t\t\tcontext: EncoderContext,\n\t\t\toutputBuffer: BufferFormat,\n\t\t): void {\n\t\t\tfail(0xb4d /* Empty array should not encode any nodes */);\n\t\t},\n\t});\n\n\t/**\n\t * @param length - number of invocations of `inner`.\n\t */\n\tpublic constructor(\n\t\tpublic readonly length: number,\n\t\tpublic readonly inner: NodesEncoder,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic encodeNodes(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\t// Linter is wrong about this loop being for-of compatible.\n\t\t// eslint-disable-next-line @typescript-eslint/prefer-for-of\n\t\tfor (let index = 0; index < this.length; index++) {\n\t\t\tthis.inner.encodeNodes(cursor, context, outputBuffer);\n\t\t}\n\t}\n\n\tpublic encodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\t// Its possible individual items from this array encode multiple nodes, so don't assume === here.\n\t\tassert(\n\t\t\tcursor.getFieldLength() >= this.length,\n\t\t\t0x73c /* unexpected length for fixed length array */,\n\t\t);\n\t\tcursor.firstNode();\n\t\tthis.encodeNodes(cursor, context, outputBuffer);\n\t\tassert(\n\t\t\tcursor.mode === CursorLocationType.Fields,\n\t\t\t0x73d /* should return to fields mode when finished encoding */,\n\t\t);\n\t}\n\n\tpublic encodeShape(\n\t\tidentifiers: DeduplicationTable<string>,\n\t\tshapes: DeduplicationTable<Shape>,\n\t): EncodedChunkShapeV1 {\n\t\treturn {\n\t\t\tb: {\n\t\t\t\tlength: this.length,\n\t\t\t\tshape: shapes.valueToIndex.get(this.inner.shape) ?? fail(0xb4e /* missing shape */),\n\t\t\t},\n\t\t};\n\t}\n\n\tpublic countReferencedShapesAndIdentifiers(\n\t\tidentifiers: Counter<string>,\n\t\tshapeDiscovered: (shape: Shape) => void,\n\t): void {\n\t\tshapeDiscovered(this.inner.shape);\n\t}\n\n\tpublic get shape(): this {\n\t\treturn this;\n\t}\n}\n\n/**\n * Encodes the shape for a nested array as {@link EncodedNestedArrayShape} shape.\n */\nexport class NestedArrayShape extends ShapeGeneric<EncodedChunkShapeV1OrV2> {\n\t/**\n\t * @param innerShape - The shape of each item in this nested array.\n\t */\n\tpublic constructor(public readonly innerShape: Shape) {\n\t\tsuper();\n\t}\n\n\tpublic encodeShape(\n\t\tidentifiers: DeduplicationTable<string>,\n\t\tshapes: DeduplicationTable<Shape>,\n\t): EncodedChunkShapeV1OrV2 {\n\t\tconst shape: EncodedNestedArrayShape =\n\t\t\tshapes.valueToIndex.get(this.innerShape) ??\n\t\t\tfail(0xb4f /* index for shape not found in table */);\n\t\treturn {\n\t\t\ta: shape,\n\t\t};\n\t}\n\n\tpublic countReferencedShapesAndIdentifiers(\n\t\tidentifiers: Counter<string>,\n\t\tshapeDiscovered: (shape: Shape) => void,\n\t): void {\n\t\tshapeDiscovered(this.innerShape);\n\t}\n}\n\n/**\n * Encodes a field as a nested array with the {@link EncodedNestedArrayShape} shape.\n * @remarks\n * The fact this is also exposes a Shape is an implementation detail: it allows the shape it uses to be itself\n * which is an easy way to keep all the related code together without extra objects.\n */\nexport class NestedArrayEncoder implements FieldEncoder {\n\tpublic constructor(\n\t\tpublic readonly innerEncoder: NodeEncoder,\n\t\tpublic readonly shape: NestedArrayShape = new NestedArrayShape(innerEncoder.shape),\n\t) {}\n\n\tpublic encodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\tconst buffer: BufferFormat = [];\n\t\tlet allNonZeroSize = true;\n\t\tconst length = cursor.getFieldLength();\n\t\tforEachNode(cursor, () => {\n\t\t\tconst before = buffer.length;\n\t\t\tthis.innerEncoder.encodeNode(cursor, context, buffer);\n\t\t\tallNonZeroSize &&= buffer.length - before !== 0;\n\t\t});\n\t\tif (buffer.length === 0) {\n\t\t\t// This relies on the number of inner chunks being the same as the number of nodes.\n\t\t\t// If making inner a `NodesEncoder`, this code will have to be adjusted accordingly.\n\t\t\toutputBuffer.push(length);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\tallNonZeroSize,\n\t\t\t\t0x73e /* either all or none of the members of a nested array must be 0 sized, or there is no way the decoder could process the content correctly. */,\n\t\t\t);\n\t\t\toutputBuffer.push(buffer);\n\t\t}\n\t}\n}\n\n/**\n * Encodes the shape for an incremental chunk as {@link EncodedIncrementalChunkShape} shape.\n */\nexport class IncrementalChunkShape extends ShapeGeneric<EncodedChunkShapeV2> {\n\tpublic encodeShape(\n\t\tidentifiers: DeduplicationTable<string>,\n\t\tshapes: DeduplicationTable<Shape>,\n\t): EncodedChunkShapeV2 {\n\t\treturn {\n\t\t\te: 0 /* EncodedIncrementalChunkShape */,\n\t\t};\n\t}\n\n\tpublic countReferencedShapesAndIdentifiers(\n\t\tidentifiers: Counter<string>,\n\t\tshapeDiscovered: (shape: Shape) => void,\n\t): void {}\n\n\tpublic get shape(): this {\n\t\treturn this;\n\t}\n}\n\n/**\n * Encodes an incremental field whose tree chunks are encoded separately and referenced by their {@link ChunkReferenceId}.\n * The shape of the content of this field is {@link NestedArrayShape}.\n * The inner items of the array have shape {@link IncrementalChunkShape} and are {@link ChunkReferenceId}s\n * of the encoded chunks.\n */\nexport const incrementalFieldEncoder: FieldEncoder = {\n\tencodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\tassert(\n\t\t\tcontext.incrementalEncoder !== undefined,\n\t\t\t0xc88 /* incremental encoder must be defined to use incrementalFieldEncoder */,\n\t\t);\n\t\tassert(\n\t\t\tcontext.version >= FieldBatchFormatVersion.v2,\n\t\t\t0xca1 /* Unsupported FieldBatchFormatVersion for incremental encoding; must be v2 or higher */,\n\t\t);\n\n\t\tconst chunkReferenceIds = context.incrementalEncoder.encodeIncrementalField(\n\t\t\tcursor,\n\t\t\t(chunk: TreeChunk) => compressedEncode([chunk.cursor()], context),\n\t\t);\n\t\toutputBuffer.push(chunkReferenceIds);\n\t},\n\n\tshape: new NestedArrayShape(new IncrementalChunkShape() /* innerShape */),\n};\n\n/**\n * Encode `value` with `shape` into `outputBuffer`.\n *\n * Requires that `value` is compatible with `shape`.\n */\nexport function encodeValue(\n\tvalue: Value,\n\tshape: EncodedValueShape,\n\toutputBuffer: BufferFormat,\n): void {\n\tif (shape === undefined) {\n\t\tif (value === undefined) {\n\t\t\toutputBuffer.push(false);\n\t\t} else {\n\t\t\toutputBuffer.push(true, value);\n\t\t}\n\t} else {\n\t\tif (shape === true) {\n\t\t\tassert(value !== undefined, 0x78d /* required value must not be missing */);\n\t\t\toutputBuffer.push(value);\n\t\t} else if (shape === false) {\n\t\t\tassert(value === undefined, 0x73f /* incompatible value shape: expected no value */);\n\t\t} else if (Array.isArray(shape)) {\n\t\t\tassert(shape.length === 1, 0x740 /* expected a single constant for value */);\n\t\t} else if (shape === SpecialField.Identifier) {\n\t\t\t// This case is a special case handling the encoding of identifier fields.\n\t\t\tassert(value !== undefined, 0x998 /* required value must not be missing */);\n\t\t\toutputBuffer.push(value);\n\t\t} else {\n\t\t\t// EncodedCounter case:\n\t\t\tunreachableCase(shape, \"Encoding values as deltas is not yet supported\");\n\t\t}\n\t}\n}\n\n/**\n * Provides common contextual information during encoding, like schema and policy settings.\n * Also, provides a cache to avoid duplicating equivalent shapes during a batch of encode operations.\n * @remarks\n * To avoid Shape duplication, any Shapes used in the encoding should either be:\n * - Singletons defined in a static scope.\n * - Cached in this object for future reuse such that all equivalent Shapes are deduplicated.\n */\nexport class EncoderContext implements NodeEncodeBuilder, FieldEncodeBuilder {\n\tprivate readonly nodeEncodersFromSchema: Map<TreeNodeSchemaIdentifier, NodeEncoder> =\n\t\tnew Map();\n\tprivate readonly nestedArrayEncoders: Map<NodeEncoder, NestedArrayEncoder> = new Map();\n\tpublic constructor(\n\t\tprivate readonly nodeEncoderFromPolicy: NodeEncoderPolicy,\n\t\tprivate readonly fieldEncoderFromPolicy: FieldEncoderPolicy,\n\t\tpublic readonly fieldShapes: ReadonlyMap<FieldKindIdentifier, FieldKindData>,\n\t\tpublic readonly idCompressor: IIdCompressor,\n\t\t/**\n\t\t * To be used to encode incremental chunks, if any.\n\t\t * @remarks\n\t\t * See {@link IncrementalEncoder} for more information.\n\t\t */\n\t\tpublic readonly incrementalEncoder: IncrementalEncoder | undefined,\n\t\tpublic readonly version: FieldBatchFormatVersion,\n\t) {}\n\n\tpublic nodeEncoderFromSchema(schemaName: TreeNodeSchemaIdentifier): NodeEncoder {\n\t\treturn getOrCreate(this.nodeEncodersFromSchema, schemaName, () =>\n\t\t\tthis.nodeEncoderFromPolicy(this, schemaName),\n\t\t);\n\t}\n\n\tpublic fieldEncoderFromSchema(fieldSchema: TreeFieldStoredSchema): FieldEncoder {\n\t\treturn new LazyFieldEncoder(this, fieldSchema, this.fieldEncoderFromPolicy);\n\t}\n\n\tpublic nestedArrayEncoder(inner: NodeEncoder): NestedArrayEncoder {\n\t\treturn getOrCreate(this.nestedArrayEncoders, inner, () => new NestedArrayEncoder(inner));\n\t}\n}\n\nexport interface NodeEncodeBuilder {\n\tnodeEncoderFromSchema(schemaName: TreeNodeSchemaIdentifier): NodeEncoder;\n}\n\nexport interface FieldEncodeBuilder {\n\tfieldEncoderFromSchema(schema: TreeFieldStoredSchema): FieldEncoder;\n}\n\n/**\n * The policy for building a {@link FieldEncoder} for a field.\n */\nexport type FieldEncoderPolicy = (\n\tnodeBuilder: NodeEncodeBuilder,\n\tschema: TreeFieldStoredSchema,\n) => FieldEncoder;\n\n/**\n * The policy for building a {@link NodeEncoder} for a node.\n */\nexport type NodeEncoderPolicy = (\n\tfieldBuilder: FieldEncodeBuilder,\n\tschemaName: TreeNodeSchemaIdentifier,\n) => NodeEncoder;\n\nclass LazyFieldEncoder implements FieldEncoder {\n\tprivate encoderLazy: FieldEncoder | undefined;\n\n\tpublic constructor(\n\t\tpublic readonly nodeBuilder: NodeEncodeBuilder,\n\t\tpublic readonly fieldSchema: TreeFieldStoredSchema,\n\t\tprivate readonly fieldEncoderFromPolicy: FieldEncoderPolicy,\n\t) {}\n\tpublic encodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\tthis.encoder.encodeField(cursor, context, outputBuffer);\n\t}\n\n\tprivate get encoder(): FieldEncoder {\n\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- using ??= could change behavior if value is falsy\n\t\tif (this.encoderLazy === undefined) {\n\t\t\tthis.encoderLazy = this.fieldEncoderFromPolicy(this.nodeBuilder, this.fieldSchema);\n\t\t}\n\t\treturn this.encoderLazy;\n\t}\n\n\tpublic get shape(): Shape {\n\t\treturn this.encoder.shape;\n\t}\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { type Static, type TSchema } from "@sinclair/typebox";
6
- import type { FieldBatchFormatVersion } from "./format.js";
6
+ import type { FieldBatchFormatVersion } from "./versions.js";
7
7
  /**
8
8
  * Identifier OR Index of an identifier in the identifier list.
9
9
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatGeneric.d.ts","sourceRoot":"","sources":["../../../../../src/feature-libraries/chunked-forest/codec/format/formatGeneric.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAQ,MAAM,mBAAmB,CAAC;AAEpE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,iBAAiB,gHAG5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,UAAU,qCAA6C,CAAC;AACrE,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;AAEnD,eAAO,MAAM,KAAK,qCAA6C,CAAC;AAEhE,QAAA,MAAM,qBAAqB;;;IAIzB;;;OAGG;;EAIJ,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,0CAC3B,uBAAuB,SACzB,YAAY;;;;;EAalB,CAAC;AAEH,MAAM,WAAW,wBAAwB,CAAC,aAAa,CACtD,SAAQ,MAAM,CAAC,OAAO,qBAAqB,CAAC;IAC5C,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,OAAO,EAAE,uBAAuB,CAAC;CACjC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatGeneric.js","sourceRoot":"","sources":["../../../../../src/feature-libraries/chunked-forest/codec/format/formatGeneric.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA6B,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAIpE;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC;IAC3C,IAAI,CAAC,MAAM,EAAE;IACb,IAAI,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;CAC1C,CAAC,CAAC;AAGH;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;AAGrE,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;AAEhE,MAAM,qBAAqB,GAAG,IAAI,CAAC,MAAM,CACxC;IACC,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE;IACtB,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IACtC;;;OAGG;IACH,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;CACxC,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAC/B,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACvC,OAAgC,EAChC,KAAmB,EAGlB,EAAE,CACH,IAAI,CAAC,SAAS,CACb;IACC,qBAAqB;IACrB,IAAI,CAAC,MAAM,CAAC;QACX,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;QAC9B,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;KACzB,CAAC;CACF,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAC/B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type Static, type TSchema, Type } from \"@sinclair/typebox\";\n\nimport type { FieldBatchFormatVersion } from \"./versions.js\";\n\n/**\n * Identifier OR Index of an identifier in the identifier list.\n */\nexport const IdentifierOrIndex = Type.Union([\n\tType.String(),\n\tType.Number({ multipleOf: 1, minimum: 0 }),\n]);\nexport type IdentifierOrIndex = Static<typeof IdentifierOrIndex>;\n\n/**\n * Reference to a shape, by index.\n *\n * Shapes use a dictionary encoding where they are referenced by their index in a shape array.\n */\nexport const ShapeIndex = Type.Number({ multipleOf: 1, minimum: 0 });\nexport type ShapeIndex = Static<typeof ShapeIndex>;\n\nexport const Count = Type.Number({ multipleOf: 1, minimum: 0 });\n\nconst EncodedFieldBatchBase = Type.Object(\n\t{\n\t\tversion: Type.Number(),\n\t\tidentifiers: Type.Array(Type.String()),\n\t\t/**\n\t\t * Top level array is list of field from batch.\n\t\t * Inner are TreeValues mixed with indexes into \"shapes\" and nested arrays where lengths are needed.\n\t\t */\n\t\tdata: Type.Array(Type.Array(Type.Any())),\n\t},\n\t{ additionalProperties: false },\n);\n\n/**\n * Format for encoding a tree chunk.\n * @param version - format version.\n * Must be changed if the previously existing decode logic will not correctly handle the new encoding.\n * If adding a new encoding version which does not use this format,\n * this parameter should be retyped to be a union of the subset of FieldBatchFormatVersion values which this supports.\n * @param shape - schema for union of shape format, see {@link DiscriminatedUnionDispatcher}.\n */\nexport const EncodedFieldBatchGeneric = <TShapeSchema extends TSchema>(\n\tversion: FieldBatchFormatVersion,\n\tshape: TShapeSchema,\n\t// Return type is intentionally derived.\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n) =>\n\tType.Composite(\n\t\t[\n\t\t\tEncodedFieldBatchBase,\n\t\t\tType.Object({\n\t\t\t\tversion: Type.Literal(version),\n\t\t\t\tshapes: Type.Array(shape),\n\t\t\t}),\n\t\t],\n\t\t{ additionalProperties: false },\n\t);\n\nexport interface EncodedFieldBatchGeneric<TEncodedShape>\n\textends Static<typeof EncodedFieldBatchBase> {\n\tshapes: TEncodedShape[];\n\tversion: FieldBatchFormatVersion;\n}\n"]}
@@ -0,0 +1,187 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { type Static } from "@sinclair/typebox";
6
+ /**
7
+ * Top level length is implied from length of data array.
8
+ * All content are of this shape.
9
+ */
10
+ export type EncodedNestedArrayShape = Static<typeof EncodedNestedArrayShape>;
11
+ export declare const EncodedNestedArrayShape: import("@sinclair/typebox").TNumber;
12
+ /**
13
+ * Inline array.
14
+ */
15
+ export type EncodedInlineArrayShape = Static<typeof EncodedInlineArrayShape>;
16
+ export declare const EncodedInlineArrayShape: import("@sinclair/typebox").TObject<{
17
+ length: import("@sinclair/typebox").TNumber;
18
+ /**
19
+ * All entries are this shape.
20
+ */
21
+ shape: import("@sinclair/typebox").TNumber;
22
+ }>;
23
+ /**
24
+ * Encoded as `shape, ...[data for shape]`.
25
+ *
26
+ * Used for polymorphism.
27
+ */
28
+ export type EncodedAnyShape = Static<typeof EncodedAnyShape>;
29
+ export declare const EncodedAnyShape: import("@sinclair/typebox").TLiteral<0>;
30
+ /**
31
+ * Content of the encoded field is specified by the Shape referenced by the ShapeIndex.
32
+ * This is a tuple for conciseness.
33
+ */
34
+ export type EncodedFieldShape = Static<typeof EncodedFieldShape>;
35
+ export declare const EncodedFieldShape: import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNumber]>;
36
+ /**
37
+ * Used in {@link EncodedValueShape} for special field kind handling.
38
+ */
39
+ export declare enum SpecialField {
40
+ /**
41
+ * Special case for Identifier field kind.
42
+ */
43
+ Identifier = 0
44
+ }
45
+ /**
46
+ * Shape of a value on a node.
47
+ *
48
+ * Due to limitations of TypeBox and differences between JavaScript objects, TypeScript types and JSON,
49
+ * the case where no information about the value is captured in the shape is a bit confusing.
50
+ * In TypeBox this is allowed by the user of this type putting it in an optional property.
51
+ * In TypeScript it is modeled using `undefined`.
52
+ * In JavaScript the property may be missing or explicitly `undefined`.
53
+ * In JSON this will serialize as the property being omitted.
54
+ * In this case, the value will be encoded as either:
55
+ * - `false` (when there is no value) OR
56
+ * - `true, value` when there is a value.
57
+ *
58
+ * For a more compact encoding, there are 4 options for the shape:
59
+ * - `true`: there is a value, and it will simply be encoded by putting it in the output buffer (so `value`).
60
+ * - `false`: there is never a value, and it takes up no space in the output buffer.
61
+ * - `[value]`: there is a value, and its always the same.
62
+ * - `SpecialField.Identifier`: special case for node identifier handling.
63
+ * Takes up no space in the output buffer: the value comes from the shape arrays's content.
64
+ * It is wrapped in an array to differentiate value shape types.
65
+ *
66
+ * In the future other value shape formats may be added, likely as objects.
67
+ *
68
+ * @remarks
69
+ * See {@link EncodedNodeShape} for usage.
70
+ */
71
+ export declare const EncodedValueShape: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>, import("@sinclair/typebox").TEnum<typeof SpecialField>]>;
72
+ export type EncodedValueShape = undefined | Static<typeof EncodedValueShape>;
73
+ /**
74
+ * The encoded form of a {@link Shape} for a node.
75
+ */
76
+ export type EncodedNodeShape = Static<typeof EncodedNodeShape>;
77
+ export declare const EncodedNodeShape: import("@sinclair/typebox").TObject<{
78
+ /**
79
+ * If not provided, inlined in data.
80
+ */
81
+ type: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>>;
82
+ value: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>, import("@sinclair/typebox").TEnum<typeof SpecialField>]>>;
83
+ /**
84
+ * Fields with fixed (per key) shapes.
85
+ * They are encoded in the order they are specified here.
86
+ * To ensure the order is preserved, this is an array instead of an object with keys.
87
+ */
88
+ fields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNumber]>>>;
89
+ /**
90
+ * If undefined, no data. Otherwise, nested array of `[key, ...data]*`
91
+ * Covers any fields beyond those in `fields`.
92
+ */
93
+ extraFields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
94
+ }>;
95
+ /**
96
+ * The chunk shapes supported by the V1 format.
97
+ * @remarks
98
+ * See {@link EncodedChunkShapeV1}.
99
+ */
100
+ export declare const shapesV1: {
101
+ /**
102
+ * {@link EncodedNestedArrayShape} union member.
103
+ */
104
+ readonly a: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
105
+ /**
106
+ * {@link EncodedInlineArrayShape} union member.
107
+ */
108
+ readonly b: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
109
+ length: import("@sinclair/typebox").TNumber;
110
+ /**
111
+ * All entries are this shape.
112
+ */
113
+ shape: import("@sinclair/typebox").TNumber;
114
+ }>>;
115
+ /**
116
+ * {@link EncodedNodeShape} union member.
117
+ */
118
+ readonly c: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
119
+ /**
120
+ * If not provided, inlined in data.
121
+ */
122
+ type: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>>;
123
+ value: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>, import("@sinclair/typebox").TEnum<typeof SpecialField>]>>;
124
+ /**
125
+ * Fields with fixed (per key) shapes.
126
+ * They are encoded in the order they are specified here.
127
+ * To ensure the order is preserved, this is an array instead of an object with keys.
128
+ */
129
+ fields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNumber]>>>;
130
+ /**
131
+ * If undefined, no data. Otherwise, nested array of `[key, ...data]*`
132
+ * Covers any fields beyond those in `fields`.
133
+ */
134
+ extraFields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
135
+ }>>;
136
+ /**
137
+ * {@link EncodedAnyShape} union member.
138
+ */
139
+ readonly d: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TLiteral<0>>;
140
+ };
141
+ /**
142
+ * Discriminated union that represents the shapes of chunks in the encoded data.
143
+ * "Chunk" here refers to a chunk of tree data, rooted at a range of nodes, that is encoded as a
144
+ * single unit in a specific format represented by one of the shapes in this union.
145
+ *
146
+ * The concept of "chunk" is same for the tree data in memory and in the encoded wire format.
147
+ * The physical representation of the chunk may differ, but the logical structure remains the same.
148
+ * This is similar to other such concepts in the system.
149
+ *
150
+ * See {@link DiscriminatedUnionDispatcher} for more information on this pattern.
151
+ * @privateRemarks
152
+ * Because the TypeScript types for how we model these unions don't require exactly one property,
153
+ * to prevent a union with more options from being assignable to this one, we include Never.
154
+ * This matters in this case because the V2 format only differs in that it has another entry in this Union.
155
+ */
156
+ export type EncodedChunkShapeV1 = Static<typeof EncodedChunkShapeV1>;
157
+ export declare const EncodedChunkShapeV1: import("@sinclair/typebox").TObject<{
158
+ e: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNever>;
159
+ a: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
160
+ b: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
161
+ length: import("@sinclair/typebox").TNumber;
162
+ /**
163
+ * All entries are this shape.
164
+ */
165
+ shape: import("@sinclair/typebox").TNumber;
166
+ }>>;
167
+ c: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
168
+ /**
169
+ * If not provided, inlined in data.
170
+ */
171
+ type: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>>;
172
+ value: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>, import("@sinclair/typebox").TEnum<typeof SpecialField>]>>;
173
+ /**
174
+ * Fields with fixed (per key) shapes.
175
+ * They are encoded in the order they are specified here.
176
+ * To ensure the order is preserved, this is an array instead of an object with keys.
177
+ */
178
+ fields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNumber]>>>;
179
+ /**
180
+ * If undefined, no data. Otherwise, nested array of `[key, ...data]*`
181
+ * Covers any fields beyond those in `fields`.
182
+ */
183
+ extraFields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
184
+ }>>;
185
+ d: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TLiteral<0>>;
186
+ }>;
187
+ //# sourceMappingURL=formatV1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatV1.d.ts","sourceRoot":"","sources":["../../../../../src/feature-libraries/chunked-forest/codec/format/formatV1.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAMtD;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAC7E,eAAO,MAAM,uBAAuB,qCAAa,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAC7E,eAAO,MAAM,uBAAuB;;IAGlC;;OAEG;;EAIJ,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,eAAe,CAAC,CAAC;AAC7D,eAAO,MAAM,eAAe,yCAAkB,CAAC;AAE/C;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AACjE,eAAO,MAAM,iBAAiB,2LAS5B,CAAC;AAEH;;GAEG;AACH,oBAAY,YAAY;IACvB;;OAEG;IACH,UAAU,IAAI;CACd;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,iBAAiB,0MAM5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE7E;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC/D,eAAO,MAAM,gBAAgB;IAE3B;;OAEG;;;IAGH;;;;OAIG;;IAEH;;;OAGG;;EAIJ,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,QAAQ;IACpB;;OAEG;;IAEH;;OAEG;;;QAnHF;;WAEG;;;IAmHJ;;OAEG;;QApCF;;WAEG;;;QAGH;;;;WAIG;;QAEH;;;WAGG;;;IAwBJ;;OAEG;;CAEM,CAAC;AAEX;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACrE,eAAO,MAAM,mBAAmB;;;;;QA/I9B;;WAEG;;;;QAiFH;;WAEG;;;QAGH;;;;WAIG;;QAEH;;;WAGG;;;;EAiDJ,CAAC"}
@@ -0,0 +1,112 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { Type } from "@sinclair/typebox";
6
+ import { unionOptions } from "../../../../codec/index.js";
7
+ import { Count, IdentifierOrIndex, ShapeIndex } from "./formatGeneric.js";
8
+ export const EncodedNestedArrayShape = ShapeIndex;
9
+ export const EncodedInlineArrayShape = Type.Object({
10
+ length: Count,
11
+ /**
12
+ * All entries are this shape.
13
+ */
14
+ shape: ShapeIndex,
15
+ }, { additionalProperties: false });
16
+ export const EncodedAnyShape = Type.Literal(0);
17
+ export const EncodedFieldShape = Type.Tuple([
18
+ /**
19
+ * Field key for this field.
20
+ */
21
+ IdentifierOrIndex,
22
+ /**
23
+ * Shape of data in this field.
24
+ */
25
+ ShapeIndex,
26
+ ]);
27
+ /**
28
+ * Used in {@link EncodedValueShape} for special field kind handling.
29
+ */
30
+ export var SpecialField;
31
+ (function (SpecialField) {
32
+ /**
33
+ * Special case for Identifier field kind.
34
+ */
35
+ SpecialField[SpecialField["Identifier"] = 0] = "Identifier";
36
+ })(SpecialField || (SpecialField = {}));
37
+ /**
38
+ * Shape of a value on a node.
39
+ *
40
+ * Due to limitations of TypeBox and differences between JavaScript objects, TypeScript types and JSON,
41
+ * the case where no information about the value is captured in the shape is a bit confusing.
42
+ * In TypeBox this is allowed by the user of this type putting it in an optional property.
43
+ * In TypeScript it is modeled using `undefined`.
44
+ * In JavaScript the property may be missing or explicitly `undefined`.
45
+ * In JSON this will serialize as the property being omitted.
46
+ * In this case, the value will be encoded as either:
47
+ * - `false` (when there is no value) OR
48
+ * - `true, value` when there is a value.
49
+ *
50
+ * For a more compact encoding, there are 4 options for the shape:
51
+ * - `true`: there is a value, and it will simply be encoded by putting it in the output buffer (so `value`).
52
+ * - `false`: there is never a value, and it takes up no space in the output buffer.
53
+ * - `[value]`: there is a value, and its always the same.
54
+ * - `SpecialField.Identifier`: special case for node identifier handling.
55
+ * Takes up no space in the output buffer: the value comes from the shape arrays's content.
56
+ * It is wrapped in an array to differentiate value shape types.
57
+ *
58
+ * In the future other value shape formats may be added, likely as objects.
59
+ *
60
+ * @remarks
61
+ * See {@link EncodedNodeShape} for usage.
62
+ */
63
+ export const EncodedValueShape = Type.Union([
64
+ Type.Boolean(),
65
+ Type.Array(Type.Any(), { minItems: 1, maxItems: 1 }),
66
+ Type.Enum(SpecialField),
67
+ // TODO: support delta encoding and/or special node identifier handling
68
+ // EncodedCounter,
69
+ ]);
70
+ export const EncodedNodeShape = Type.Object({
71
+ /**
72
+ * If not provided, inlined in data.
73
+ */
74
+ type: Type.Optional(IdentifierOrIndex),
75
+ value: Type.Optional(EncodedValueShape),
76
+ /**
77
+ * Fields with fixed (per key) shapes.
78
+ * They are encoded in the order they are specified here.
79
+ * To ensure the order is preserved, this is an array instead of an object with keys.
80
+ */
81
+ fields: Type.Optional(Type.Array(EncodedFieldShape)),
82
+ /**
83
+ * If undefined, no data. Otherwise, nested array of `[key, ...data]*`
84
+ * Covers any fields beyond those in `fields`.
85
+ */
86
+ extraFields: Type.Optional(ShapeIndex),
87
+ }, { additionalProperties: false });
88
+ /**
89
+ * The chunk shapes supported by the V1 format.
90
+ * @remarks
91
+ * See {@link EncodedChunkShapeV1}.
92
+ */
93
+ export const shapesV1 = {
94
+ /**
95
+ * {@link EncodedNestedArrayShape} union member.
96
+ */
97
+ a: Type.Optional(EncodedNestedArrayShape),
98
+ /**
99
+ * {@link EncodedInlineArrayShape} union member.
100
+ */
101
+ b: Type.Optional(EncodedInlineArrayShape),
102
+ /**
103
+ * {@link EncodedNodeShape} union member.
104
+ */
105
+ c: Type.Optional(EncodedNodeShape),
106
+ /**
107
+ * {@link EncodedAnyShape} union member.
108
+ */
109
+ d: Type.Optional(EncodedAnyShape),
110
+ };
111
+ export const EncodedChunkShapeV1 = Type.Object({ ...shapesV1, e: Type.Optional(Type.Never()) }, unionOptions);
112
+ //# sourceMappingURL=formatV1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatV1.js","sourceRoot":"","sources":["../../../../../src/feature-libraries/chunked-forest/codec/format/formatV1.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,oB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GG;IACH,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;CACtC,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAC/B,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACvB;;OAEG;IACH,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC;IACzC;;OAEG;IACH,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC;IACzC;;OAEG;IACH,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IAClC;;OAEG;IACH,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC;CACxB,CAAC;AAkBX,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,MAAM,CAC7C,EAAE,GAAG,QAAQ,EAAE,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,EAC/C,YAAY,CACZ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type Static, Type } from \"@sinclair/typebox\";\n\nimport { unionOptions } from \"../../../../codec/index.js\";\n\nimport { Count, IdentifierOrIndex, ShapeIndex } from \"./formatGeneric.js\";\n\n/**\n * Top level length is implied from length of data array.\n * All content are of this shape.\n */\nexport type EncodedNestedArrayShape = Static<typeof EncodedNestedArrayShape>;\nexport const EncodedNestedArrayShape = ShapeIndex;\n\n/**\n * Inline array.\n */\nexport type EncodedInlineArrayShape = Static<typeof EncodedInlineArrayShape>;\nexport const EncodedInlineArrayShape = Type.Object(\n\t{\n\t\tlength: Count,\n\t\t/**\n\t\t * All entries are this shape.\n\t\t */\n\t\tshape: ShapeIndex,\n\t},\n\t{ additionalProperties: false },\n);\n\n/**\n * Encoded as `shape, ...[data for shape]`.\n *\n * Used for polymorphism.\n */\nexport type EncodedAnyShape = Static<typeof EncodedAnyShape>;\nexport const EncodedAnyShape = Type.Literal(0);\n\n/**\n * Content of the encoded field is specified by the Shape referenced by the ShapeIndex.\n * This is a tuple for conciseness.\n */\nexport type EncodedFieldShape = Static<typeof EncodedFieldShape>;\nexport const EncodedFieldShape = Type.Tuple([\n\t/**\n\t * Field key for this field.\n\t */\n\tIdentifierOrIndex,\n\t/**\n\t * Shape of data in this field.\n\t */\n\tShapeIndex,\n]);\n\n/**\n * Used in {@link EncodedValueShape} for special field kind handling.\n */\nexport enum SpecialField {\n\t/**\n\t * Special case for Identifier field kind.\n\t */\n\tIdentifier = 0,\n}\n\n/**\n * Shape of a value on a node.\n *\n * Due to limitations of TypeBox and differences between JavaScript objects, TypeScript types and JSON,\n * the case where no information about the value is captured in the shape is a bit confusing.\n * In TypeBox this is allowed by the user of this type putting it in an optional property.\n * In TypeScript it is modeled using `undefined`.\n * In JavaScript the property may be missing or explicitly `undefined`.\n * In JSON this will serialize as the property being omitted.\n * In this case, the value will be encoded as either:\n * - `false` (when there is no value) OR\n * - `true, value` when there is a value.\n *\n * For a more compact encoding, there are 4 options for the shape:\n * - `true`: there is a value, and it will simply be encoded by putting it in the output buffer (so `value`).\n * - `false`: there is never a value, and it takes up no space in the output buffer.\n * - `[value]`: there is a value, and its always the same.\n * - `SpecialField.Identifier`: special case for node identifier handling.\n * Takes up no space in the output buffer: the value comes from the shape arrays's content.\n * It is wrapped in an array to differentiate value shape types.\n *\n * In the future other value shape formats may be added, likely as objects.\n *\n * @remarks\n * See {@link EncodedNodeShape} for usage.\n */\nexport const EncodedValueShape = Type.Union([\n\tType.Boolean(),\n\tType.Array(Type.Any(), { minItems: 1, maxItems: 1 }),\n\tType.Enum(SpecialField),\n\t// TODO: support delta encoding and/or special node identifier handling\n\t// EncodedCounter,\n]);\nexport type EncodedValueShape = undefined | Static<typeof EncodedValueShape>;\n\n/**\n * The encoded form of a {@link Shape} for a node.\n */\nexport type EncodedNodeShape = Static<typeof EncodedNodeShape>;\nexport const EncodedNodeShape = Type.Object(\n\t{\n\t\t/**\n\t\t * If not provided, inlined in data.\n\t\t */\n\t\ttype: Type.Optional(IdentifierOrIndex),\n\t\tvalue: Type.Optional(EncodedValueShape),\n\t\t/**\n\t\t * Fields with fixed (per key) shapes.\n\t\t * They are encoded in the order they are specified here.\n\t\t * To ensure the order is preserved, this is an array instead of an object with keys.\n\t\t */\n\t\tfields: Type.Optional(Type.Array(EncodedFieldShape)),\n\t\t/**\n\t\t * If undefined, no data. Otherwise, nested array of `[key, ...data]*`\n\t\t * Covers any fields beyond those in `fields`.\n\t\t */\n\t\textraFields: Type.Optional(ShapeIndex),\n\t},\n\t{ additionalProperties: false },\n);\n\n/**\n * The chunk shapes supported by the V1 format.\n * @remarks\n * See {@link EncodedChunkShapeV1}.\n */\nexport const shapesV1 = {\n\t/**\n\t * {@link EncodedNestedArrayShape} union member.\n\t */\n\ta: Type.Optional(EncodedNestedArrayShape),\n\t/**\n\t * {@link EncodedInlineArrayShape} union member.\n\t */\n\tb: Type.Optional(EncodedInlineArrayShape),\n\t/**\n\t * {@link EncodedNodeShape} union member.\n\t */\n\tc: Type.Optional(EncodedNodeShape),\n\t/**\n\t * {@link EncodedAnyShape} union member.\n\t */\n\td: Type.Optional(EncodedAnyShape),\n} as const;\n\n/**\n * Discriminated union that represents the shapes of chunks in the encoded data.\n * \"Chunk\" here refers to a chunk of tree data, rooted at a range of nodes, that is encoded as a\n * single unit in a specific format represented by one of the shapes in this union.\n *\n * The concept of \"chunk\" is same for the tree data in memory and in the encoded wire format.\n * The physical representation of the chunk may differ, but the logical structure remains the same.\n * This is similar to other such concepts in the system.\n *\n * See {@link DiscriminatedUnionDispatcher} for more information on this pattern.\n * @privateRemarks\n * Because the TypeScript types for how we model these unions don't require exactly one property,\n * to prevent a union with more options from being assignable to this one, we include Never.\n * This matters in this case because the V2 format only differs in that it has another entry in this Union.\n */\nexport type EncodedChunkShapeV1 = Static<typeof EncodedChunkShapeV1>;\nexport const EncodedChunkShapeV1 = Type.Object(\n\t{ ...shapesV1, e: Type.Optional(Type.Never()) },\n\tunionOptions,\n);\n"]}
@@ -0,0 +1,33 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { type Static } from "@sinclair/typebox";
6
+ /**
7
+ * Encoded content is a {@link ChunkReferenceId}.
8
+ * This represents the shape of a chunk that is encoded separately and is referenced by its {@link ChunkReferenceId}.
9
+ */
10
+ export type EncodedIncrementalChunkShape = Static<typeof EncodedIncrementalChunkShape>;
11
+ export declare const EncodedIncrementalChunkShape: import("@sinclair/typebox").TLiteral<0>;
12
+ /**
13
+ * V2 extension of {@link EncodedChunkShapeV1}.
14
+ * @remarks
15
+ * See {@link DiscriminatedUnionDispatcher} for more information on this pattern.
16
+ */
17
+ export type EncodedChunkShapeV2 = Static<typeof EncodedChunkShapeV2>;
18
+ export declare const EncodedChunkShapeV2: import("@sinclair/typebox").TObject<{
19
+ e: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TLiteral<0>>;
20
+ a: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
21
+ b: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
22
+ length: import("@sinclair/typebox").TNumber;
23
+ shape: import("@sinclair/typebox").TNumber;
24
+ }>>;
25
+ c: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
26
+ type: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>>;
27
+ value: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>, import("@sinclair/typebox").TEnum<typeof import("./formatV1.js").SpecialField>]>>;
28
+ fields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNumber]>>>;
29
+ extraFields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
30
+ }>>;
31
+ d: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TLiteral<0>>;
32
+ }>;
33
+ //# sourceMappingURL=formatV2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatV2.d.ts","sourceRoot":"","sources":["../../../../../src/feature-libraries/chunked-forest/codec/format/formatV2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAMtD;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GAAG,MAAM,CAAC,OAAO,4BAA4B,CAAC,CAAC;AACvF,eAAO,MAAM,4BAA4B,yCAAkB,CAAC;AAE5D;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACrE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;EAM/B,CAAC"}
@@ -0,0 +1,13 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { Type } from "@sinclair/typebox";
6
+ import { unionOptions } from "../../../../codec/index.js";
7
+ import { shapesV1 } from "./formatV1.js";
8
+ export const EncodedIncrementalChunkShape = Type.Literal(0);
9
+ export const EncodedChunkShapeV2 = Type.Object({
10
+ ...shapesV1,
11
+ e: Type.Optional(EncodedIncrementalChunkShape),
12
+ }, unionOptions);
13
+ //# sourceMappingURL=formatV2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatV2.js","sourceRoot":"","sources":["../../../../../src/feature-libraries/chunked-forest/codec/format/formatV2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAOzC,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAQ5D,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,MAAM,CAC7C;IACC,GAAG,QAAQ;IACX,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,4BAA4B,CAAC;CAC9C,EACD,YAAY,CACZ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type Static, Type } from \"@sinclair/typebox\";\n\nimport { unionOptions } from \"../../../../codec/index.js\";\n\nimport { shapesV1 } from \"./formatV1.js\";\n\n/**\n * Encoded content is a {@link ChunkReferenceId}.\n * This represents the shape of a chunk that is encoded separately and is referenced by its {@link ChunkReferenceId}.\n */\nexport type EncodedIncrementalChunkShape = Static<typeof EncodedIncrementalChunkShape>;\nexport const EncodedIncrementalChunkShape = Type.Literal(0);\n\n/**\n * V2 extension of {@link EncodedChunkShapeV1}.\n * @remarks\n * See {@link DiscriminatedUnionDispatcher} for more information on this pattern.\n */\nexport type EncodedChunkShapeV2 = Static<typeof EncodedChunkShapeV2>;\nexport const EncodedChunkShapeV2 = Type.Object(\n\t{\n\t\t...shapesV1,\n\t\te: Type.Optional(EncodedIncrementalChunkShape),\n\t},\n\tunionOptions,\n);\n"]}
@@ -0,0 +1,10 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export type { EncodedChunkShapeV1, EncodedInlineArrayShape, EncodedNestedArrayShape, EncodedNodeShape, EncodedValueShape, EncodedFieldShape, } from "./formatV1.js";
6
+ export { EncodedAnyShape, SpecialField, } from "./formatV1.js";
7
+ export { EncodedIncrementalChunkShape, EncodedChunkShapeV2 } from "./formatV2.js";
8
+ export { FieldBatchFormatVersion, EncodedFieldBatchV1, EncodedFieldBatchV2, type EncodedFieldBatchV1OrV2, type EncodedFieldBatchV1AndV2, type EncodedChunkShapeV1OrV2, } from "./versions.js";
9
+ export type { ShapeIndex, IdentifierOrIndex, EncodedFieldBatchGeneric, } from "./formatGeneric.js";
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/feature-libraries/chunked-forest/codec/format/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EACX,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,eAAe,EACf,YAAY,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,4BAA4B,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,EACN,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,GAC5B,MAAM,eAAe,CAAC;AACvB,YAAY,EACX,UAAU,EACV,iBAAiB,EACjB,wBAAwB,GACxB,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export { EncodedAnyShape, SpecialField, } from "./formatV1.js";
6
+ export { EncodedIncrementalChunkShape, EncodedChunkShapeV2 } from "./formatV2.js";
7
+ export { FieldBatchFormatVersion, EncodedFieldBatchV1, EncodedFieldBatchV2, } from "./versions.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/feature-libraries/chunked-forest/codec/format/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,EACN,eAAe,EACf,YAAY,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,4BAA4B,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,EACN,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,GAInB,MAAM,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport type {\n\tEncodedChunkShapeV1,\n\tEncodedInlineArrayShape,\n\tEncodedNestedArrayShape,\n\tEncodedNodeShape,\n\tEncodedValueShape,\n\tEncodedFieldShape,\n} from \"./formatV1.js\";\nexport {\n\tEncodedAnyShape,\n\tSpecialField,\n} from \"./formatV1.js\";\nexport { EncodedIncrementalChunkShape, EncodedChunkShapeV2 } from \"./formatV2.js\";\nexport {\n\tFieldBatchFormatVersion,\n\tEncodedFieldBatchV1,\n\tEncodedFieldBatchV2,\n\ttype EncodedFieldBatchV1OrV2,\n\ttype EncodedFieldBatchV1AndV2,\n\ttype EncodedChunkShapeV1OrV2,\n} from \"./versions.js\";\nexport type {\n\tShapeIndex,\n\tIdentifierOrIndex,\n\tEncodedFieldBatchGeneric,\n} from \"./formatGeneric.js\";\n"]}