@fluidframework/tree 2.80.0 → 2.81.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 (1138) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/api-report/tree.alpha.api.md +42 -7
  3. package/dist/alpha.d.ts +5 -0
  4. package/dist/codec/codec.d.ts +2 -2
  5. package/dist/codec/codec.d.ts.map +1 -1
  6. package/dist/codec/codec.js +8 -8
  7. package/dist/codec/codec.js.map +1 -1
  8. package/dist/codec/versioned/codec.d.ts +1 -1
  9. package/dist/codec/versioned/codec.d.ts.map +1 -1
  10. package/dist/codec/versioned/codec.js +12 -12
  11. package/dist/codec/versioned/codec.js.map +1 -1
  12. package/dist/core/index.d.ts +1 -1
  13. package/dist/core/index.d.ts.map +1 -1
  14. package/dist/core/index.js.map +1 -1
  15. package/dist/core/rebase/index.d.ts +1 -1
  16. package/dist/core/rebase/index.d.ts.map +1 -1
  17. package/dist/core/rebase/index.js.map +1 -1
  18. package/dist/core/rebase/types.d.ts +44 -7
  19. package/dist/core/rebase/types.d.ts.map +1 -1
  20. package/dist/core/rebase/types.js.map +1 -1
  21. package/dist/core/rebase/utils.d.ts.map +1 -1
  22. package/dist/core/rebase/utils.js +5 -1
  23. package/dist/core/rebase/utils.js.map +1 -1
  24. package/dist/core/schema-stored/formatV2.d.ts.map +1 -1
  25. package/dist/core/schema-stored/formatV2.js +4 -4
  26. package/dist/core/schema-stored/formatV2.js.map +1 -1
  27. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  28. package/dist/core/tree/anchorSet.js +2 -1
  29. package/dist/core/tree/anchorSet.js.map +1 -1
  30. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  31. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  32. package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts +1 -1
  33. package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
  34. package/dist/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
  35. package/dist/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
  36. package/dist/core/tree/detachedFieldIndexCodecV1.js +3 -3
  37. package/dist/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  38. package/dist/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
  39. package/dist/core/tree/detachedFieldIndexCodecV2.js +2 -2
  40. package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  41. package/dist/core/tree/detachedFieldIndexFormatV1.d.ts.map +1 -1
  42. package/dist/core/tree/detachedFieldIndexFormatV1.js +3 -3
  43. package/dist/core/tree/detachedFieldIndexFormatV1.js.map +1 -1
  44. package/dist/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
  45. package/dist/core/tree/detachedFieldIndexFormatV2.js +4 -4
  46. package/dist/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
  47. package/dist/core/tree/visitDelta.d.ts +1 -1
  48. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  49. package/dist/core/tree/visitDelta.js +3 -2
  50. package/dist/core/tree/visitDelta.js.map +1 -1
  51. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  52. package/dist/core/tree/visitorUtils.js +59 -19
  53. package/dist/core/tree/visitorUtils.js.map +1 -1
  54. package/dist/feature-libraries/changeAtomIdBTree.d.ts +6 -1
  55. package/dist/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
  56. package/dist/feature-libraries/changeAtomIdBTree.js.map +1 -1
  57. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +1 -1
  58. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  59. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  60. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  61. package/dist/feature-libraries/chunked-forest/chunkedForest.js +3 -1
  62. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  63. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -1
  64. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  65. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  66. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
  67. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  68. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  69. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +1 -1
  70. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  71. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  72. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +1 -1
  73. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  74. package/dist/feature-libraries/chunked-forest/codec/codecs.js +1 -1
  75. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  76. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
  77. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  78. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -0
  79. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  80. package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  81. package/dist/feature-libraries/chunked-forest/codec/format.js +1 -1
  82. package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  83. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +1 -1
  84. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.js.map +1 -1
  85. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
  86. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  87. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +2 -2
  88. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  89. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  90. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +17 -15
  91. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  92. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +10 -52
  93. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  94. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +23 -64
  95. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  96. package/dist/feature-libraries/default-schema/index.d.ts +1 -1
  97. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  98. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  99. package/dist/feature-libraries/fieldKindIdentifiers.d.ts +9 -0
  100. package/dist/feature-libraries/fieldKindIdentifiers.d.ts.map +1 -0
  101. package/dist/feature-libraries/fieldKindIdentifiers.js +16 -0
  102. package/dist/feature-libraries/fieldKindIdentifiers.js.map +1 -0
  103. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  104. package/dist/feature-libraries/flex-tree/lazyField.js +8 -8
  105. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  106. package/dist/feature-libraries/flex-tree/observer.d.ts +1 -1
  107. package/dist/feature-libraries/flex-tree/observer.d.ts.map +1 -1
  108. package/dist/feature-libraries/flex-tree/observer.js.map +1 -1
  109. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  110. package/dist/feature-libraries/forest-summary/codec.js +1 -1
  111. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  112. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  113. package/dist/feature-libraries/forest-summary/forestSummarizer.js +6 -4
  114. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  115. package/dist/feature-libraries/forest-summary/formatV1.d.ts.map +1 -1
  116. package/dist/feature-libraries/forest-summary/formatV1.js.map +1 -1
  117. package/dist/feature-libraries/forest-summary/formatV2.d.ts.map +1 -1
  118. package/dist/feature-libraries/forest-summary/formatV2.js.map +1 -1
  119. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +4 -4
  120. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  121. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +2 -2
  122. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  123. package/dist/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -1
  124. package/dist/feature-libraries/forest-summary/summaryTypes.js.map +1 -1
  125. package/dist/feature-libraries/index.d.ts +1 -1
  126. package/dist/feature-libraries/index.d.ts.map +1 -1
  127. package/dist/feature-libraries/index.js.map +1 -1
  128. package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  129. package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
  130. package/dist/feature-libraries/modular-schema/fieldKindConfiguration.d.ts.map +1 -1
  131. package/dist/feature-libraries/modular-schema/fieldKindConfiguration.js.map +1 -1
  132. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +1 -1
  133. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  134. package/dist/feature-libraries/modular-schema/genericFieldKind.js +2 -2
  135. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  136. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +1 -1
  137. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  138. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +2 -0
  139. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  140. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
  141. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js +1 -1
  142. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
  143. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  144. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +1 -1
  145. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  146. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +2 -2
  147. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  148. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +52 -43
  149. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  150. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +3 -3
  151. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  152. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  153. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  154. package/dist/feature-libraries/object-forest/objectForest.js +5 -3
  155. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  156. package/dist/feature-libraries/optional-field/index.d.ts +3 -3
  157. package/dist/feature-libraries/optional-field/index.d.ts.map +1 -1
  158. package/dist/feature-libraries/optional-field/index.js +4 -8
  159. package/dist/feature-libraries/optional-field/index.js.map +1 -1
  160. package/dist/feature-libraries/optional-field/optionalField.d.ts +10 -2
  161. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  162. package/dist/feature-libraries/optional-field/optionalField.js +13 -1
  163. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  164. package/dist/feature-libraries/optional-field/requiredField.d.ts +36 -0
  165. package/dist/feature-libraries/optional-field/requiredField.d.ts.map +1 -0
  166. package/dist/feature-libraries/optional-field/requiredField.js +27 -0
  167. package/dist/feature-libraries/optional-field/requiredField.js.map +1 -0
  168. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +1 -1
  169. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  170. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +7 -7
  171. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  172. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
  173. package/dist/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
  174. package/dist/feature-libraries/schemaChecker.d.ts.map +1 -1
  175. package/dist/feature-libraries/schemaChecker.js +1 -1
  176. package/dist/feature-libraries/schemaChecker.js.map +1 -1
  177. package/dist/feature-libraries/sequence-field/index.d.ts +2 -14
  178. package/dist/feature-libraries/sequence-field/index.d.ts.map +1 -1
  179. package/dist/feature-libraries/sequence-field/index.js +3 -30
  180. package/dist/feature-libraries/sequence-field/index.js.map +1 -1
  181. package/dist/feature-libraries/sequence-field/rebase.js +1 -1
  182. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  183. package/dist/feature-libraries/sequence-field/sequenceKind.d.ts +16 -0
  184. package/dist/feature-libraries/sequence-field/sequenceKind.d.ts.map +1 -0
  185. package/dist/feature-libraries/sequence-field/sequenceKind.js +24 -0
  186. package/dist/feature-libraries/sequence-field/sequenceKind.js.map +1 -0
  187. package/dist/index.d.ts +3 -2
  188. package/dist/index.d.ts.map +1 -1
  189. package/dist/index.js +5 -1
  190. package/dist/index.js.map +1 -1
  191. package/dist/packageVersion.d.ts +1 -1
  192. package/dist/packageVersion.js +1 -1
  193. package/dist/packageVersion.js.map +1 -1
  194. package/dist/shared-tree/independentView.d.ts.map +1 -1
  195. package/dist/shared-tree/independentView.js +7 -7
  196. package/dist/shared-tree/independentView.js.map +1 -1
  197. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  198. package/dist/shared-tree/schematizingTreeView.js +12 -10
  199. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  200. package/dist/shared-tree/sharedTree.d.ts +2 -2
  201. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  202. package/dist/shared-tree/sharedTree.js +6 -33
  203. package/dist/shared-tree/sharedTree.js.map +1 -1
  204. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  205. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  206. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts +31 -24
  207. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  208. package/dist/shared-tree/sharedTreeChangeEnricher.js +75 -58
  209. package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  210. package/dist/shared-tree/tree.d.ts.map +1 -1
  211. package/dist/shared-tree/tree.js +14 -14
  212. package/dist/shared-tree/tree.js.map +1 -1
  213. package/dist/shared-tree/treeAlpha.d.ts +1 -1
  214. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  215. package/dist/shared-tree/treeAlpha.js +77 -77
  216. package/dist/shared-tree/treeAlpha.js.map +1 -1
  217. package/dist/shared-tree/treeCheckout.d.ts +21 -6
  218. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  219. package/dist/shared-tree/treeCheckout.js +93 -37
  220. package/dist/shared-tree/treeCheckout.js.map +1 -1
  221. package/dist/shared-tree-core/branch.d.ts +1 -1
  222. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  223. package/dist/shared-tree-core/branch.js +5 -1
  224. package/dist/shared-tree-core/branch.js.map +1 -1
  225. package/dist/shared-tree-core/branchCommitEnricher.d.ts +18 -31
  226. package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  227. package/dist/shared-tree-core/branchCommitEnricher.js +24 -76
  228. package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
  229. package/dist/shared-tree-core/branchIdCodec.d.ts.map +1 -1
  230. package/dist/shared-tree-core/branchIdCodec.js.map +1 -1
  231. package/dist/shared-tree-core/changeEnricher.d.ts +8 -43
  232. package/dist/shared-tree-core/changeEnricher.d.ts.map +1 -1
  233. package/dist/shared-tree-core/changeEnricher.js +0 -13
  234. package/dist/shared-tree-core/changeEnricher.js.map +1 -1
  235. package/dist/shared-tree-core/defaultResubmitMachine.d.ts +4 -12
  236. package/dist/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  237. package/dist/shared-tree-core/defaultResubmitMachine.js +26 -36
  238. package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  239. package/dist/shared-tree-core/editManager.d.ts +1 -1
  240. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  241. package/dist/shared-tree-core/editManager.js +13 -7
  242. package/dist/shared-tree-core/editManager.js.map +1 -1
  243. package/dist/shared-tree-core/editManagerCodecs.d.ts +1 -1
  244. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  245. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  246. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +1 -1
  247. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  248. package/dist/shared-tree-core/editManagerCodecsCommons.js +1 -2
  249. package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  250. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  251. package/dist/shared-tree-core/editManagerCodecsV1toV4.js +1 -1
  252. package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  253. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  254. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js +1 -1
  255. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  256. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  257. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  258. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  259. package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  260. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +1 -1
  261. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
  262. package/dist/shared-tree-core/editManagerFormatVSharedBranches.js +1 -1
  263. package/dist/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
  264. package/dist/shared-tree-core/index.d.ts +2 -2
  265. package/dist/shared-tree-core/index.d.ts.map +1 -1
  266. package/dist/shared-tree-core/index.js +1 -3
  267. package/dist/shared-tree-core/index.js.map +1 -1
  268. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
  269. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  270. package/dist/shared-tree-core/messageCodecV1ToV4.js +1 -1
  271. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  272. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts +1 -1
  273. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  274. package/dist/shared-tree-core/messageCodecVSharedBranches.js +2 -2
  275. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  276. package/dist/shared-tree-core/messageCodecs.d.ts +2 -2
  277. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  278. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  279. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  280. package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  281. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  282. package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
  283. package/dist/shared-tree-core/messageTypes.d.ts.map +1 -1
  284. package/dist/shared-tree-core/messageTypes.js.map +1 -1
  285. package/dist/shared-tree-core/sharedTreeCore.d.ts +8 -4
  286. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  287. package/dist/shared-tree-core/sharedTreeCore.js +13 -13
  288. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  289. package/dist/shared-tree-core/versionedSummarizer.d.ts.map +1 -1
  290. package/dist/shared-tree-core/versionedSummarizer.js +1 -1
  291. package/dist/shared-tree-core/versionedSummarizer.js.map +1 -1
  292. package/dist/simple-tree/api/configuration.d.ts +2 -2
  293. package/dist/simple-tree/api/configuration.d.ts.map +1 -1
  294. package/dist/simple-tree/api/configuration.js +14 -14
  295. package/dist/simple-tree/api/configuration.js.map +1 -1
  296. package/dist/simple-tree/api/create.d.ts +1 -1
  297. package/dist/simple-tree/api/create.d.ts.map +1 -1
  298. package/dist/simple-tree/api/create.js +7 -7
  299. package/dist/simple-tree/api/create.js.map +1 -1
  300. package/dist/simple-tree/api/dirtyIndex.d.ts +1 -1
  301. package/dist/simple-tree/api/dirtyIndex.d.ts.map +1 -1
  302. package/dist/simple-tree/api/dirtyIndex.js.map +1 -1
  303. package/dist/simple-tree/api/discrepancies.d.ts.map +1 -1
  304. package/dist/simple-tree/api/discrepancies.js +23 -23
  305. package/dist/simple-tree/api/discrepancies.js.map +1 -1
  306. package/dist/simple-tree/api/getJsonSchema.d.ts +1 -1
  307. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  308. package/dist/simple-tree/api/getJsonSchema.js +1 -1
  309. package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
  310. package/dist/simple-tree/api/identifierIndex.d.ts +2 -2
  311. package/dist/simple-tree/api/identifierIndex.d.ts.map +1 -1
  312. package/dist/simple-tree/api/identifierIndex.js.map +1 -1
  313. package/dist/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
  314. package/dist/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -1
  315. package/dist/simple-tree/api/incrementalAllowedTypes.js +6 -6
  316. package/dist/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  317. package/dist/simple-tree/api/index.d.ts +1 -1
  318. package/dist/simple-tree/api/index.d.ts.map +1 -1
  319. package/dist/simple-tree/api/index.js +2 -1
  320. package/dist/simple-tree/api/index.js.map +1 -1
  321. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +1 -1
  322. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  323. package/dist/simple-tree/api/schemaCompatibilityTester.js +1 -1
  324. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  325. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +2 -2
  326. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  327. package/dist/simple-tree/api/schemaCreationUtilities.js +7 -7
  328. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  329. package/dist/simple-tree/api/schemaFactory.d.ts +2 -2
  330. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  331. package/dist/simple-tree/api/schemaFactory.js +7 -7
  332. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  333. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +6 -6
  334. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  335. package/dist/simple-tree/api/schemaFactoryAlpha.js +2 -2
  336. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  337. package/dist/simple-tree/api/schemaFactoryBeta.d.ts +2 -2
  338. package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  339. package/dist/simple-tree/api/schemaFactoryBeta.js +2 -1
  340. package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  341. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +1 -1
  342. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  343. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  344. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  345. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  346. package/dist/simple-tree/api/schemaStatics.d.ts.map +1 -1
  347. package/dist/simple-tree/api/schemaStatics.js.map +1 -1
  348. package/dist/simple-tree/api/simpleSchemaCodec.d.ts +1 -1
  349. package/dist/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -1
  350. package/dist/simple-tree/api/simpleSchemaCodec.js +17 -17
  351. package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  352. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts +2 -2
  353. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  354. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +6 -6
  355. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  356. package/dist/simple-tree/api/simpleTreeIndex.d.ts +1 -1
  357. package/dist/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
  358. package/dist/simple-tree/api/simpleTreeIndex.js +1 -1
  359. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  360. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +244 -0
  361. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  362. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +298 -2
  363. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  364. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  365. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  366. package/dist/simple-tree/api/tree.d.ts +5 -3
  367. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  368. package/dist/simple-tree/api/tree.js.map +1 -1
  369. package/dist/simple-tree/api/treeBeta.d.ts +1 -1
  370. package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
  371. package/dist/simple-tree/api/treeBeta.js +2 -2
  372. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  373. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  374. package/dist/simple-tree/api/treeNodeApi.js +4 -4
  375. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  376. package/dist/simple-tree/api/typesUnsafe.d.ts +1 -1
  377. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  378. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  379. package/dist/simple-tree/api/verboseTree.d.ts +1 -1
  380. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  381. package/dist/simple-tree/api/verboseTree.js +22 -22
  382. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  383. package/dist/simple-tree/core/allowedTypes.d.ts +1 -1
  384. package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -1
  385. package/dist/simple-tree/core/allowedTypes.js +7 -7
  386. package/dist/simple-tree/core/allowedTypes.js.map +1 -1
  387. package/dist/simple-tree/core/context.d.ts.map +1 -1
  388. package/dist/simple-tree/core/context.js.map +1 -1
  389. package/dist/simple-tree/core/treeNode.d.ts.map +1 -1
  390. package/dist/simple-tree/core/treeNode.js +1 -1
  391. package/dist/simple-tree/core/treeNode.js.map +1 -1
  392. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  393. package/dist/simple-tree/core/treeNodeKernel.js +7 -5
  394. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  395. package/dist/simple-tree/core/treeNodeSchema.d.ts +5 -5
  396. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  397. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  398. package/dist/simple-tree/core/treeNodeValid.d.ts +3 -3
  399. package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  400. package/dist/simple-tree/core/treeNodeValid.js +2 -2
  401. package/dist/simple-tree/core/treeNodeValid.js.map +1 -1
  402. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +1 -1
  403. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  404. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  405. package/dist/simple-tree/core/withType.d.ts.map +1 -1
  406. package/dist/simple-tree/core/withType.js.map +1 -1
  407. package/dist/simple-tree/createContext.d.ts.map +1 -1
  408. package/dist/simple-tree/createContext.js.map +1 -1
  409. package/dist/simple-tree/fieldSchema.d.ts +1 -1
  410. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  411. package/dist/simple-tree/fieldSchema.js.map +1 -1
  412. package/dist/simple-tree/index.d.ts +1 -1
  413. package/dist/simple-tree/index.d.ts.map +1 -1
  414. package/dist/simple-tree/index.js +3 -2
  415. package/dist/simple-tree/index.js.map +1 -1
  416. package/dist/simple-tree/leafNodeSchema.d.ts +1 -1
  417. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  418. package/dist/simple-tree/leafNodeSchema.js +15 -15
  419. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  420. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +1 -1
  421. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  422. package/dist/simple-tree/node-kinds/array/arrayNode.js +46 -46
  423. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  424. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +1 -1
  425. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  426. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  427. package/dist/simple-tree/node-kinds/common.d.ts.map +1 -1
  428. package/dist/simple-tree/node-kinds/common.js.map +1 -1
  429. package/dist/simple-tree/node-kinds/map/mapNode.d.ts +2 -2
  430. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  431. package/dist/simple-tree/node-kinds/map/mapNode.js +24 -24
  432. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  433. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts +1 -1
  434. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  435. package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  436. package/dist/simple-tree/node-kinds/object/objectNode.d.ts +2 -2
  437. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  438. package/dist/simple-tree/node-kinds/object/objectNode.js +9 -9
  439. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  440. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +3 -3
  441. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  442. package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  443. package/dist/simple-tree/node-kinds/record/recordNode.d.ts +1 -1
  444. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  445. package/dist/simple-tree/node-kinds/record/recordNode.js +34 -34
  446. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  447. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +1 -1
  448. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  449. package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  450. package/dist/simple-tree/prepareForInsertion.d.ts +2 -2
  451. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
  452. package/dist/simple-tree/prepareForInsertion.js +13 -13
  453. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  454. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  455. package/dist/simple-tree/simpleSchema.js.map +1 -1
  456. package/dist/simple-tree/treeSchema.d.ts.map +1 -1
  457. package/dist/simple-tree/treeSchema.js.map +1 -1
  458. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +1 -1
  459. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  460. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +10 -10
  461. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  462. package/dist/tableSchema.d.ts.map +1 -1
  463. package/dist/tableSchema.js +22 -21
  464. package/dist/tableSchema.js.map +1 -1
  465. package/dist/text/index.d.ts +7 -0
  466. package/dist/text/index.d.ts.map +1 -0
  467. package/dist/text/index.js +12 -0
  468. package/dist/text/index.js.map +1 -0
  469. package/dist/text/textDomain.d.ts +146 -0
  470. package/dist/text/textDomain.d.ts.map +1 -0
  471. package/dist/text/textDomain.js +122 -0
  472. package/dist/text/textDomain.js.map +1 -0
  473. package/dist/text/textDomainFormatted.d.ts +572 -0
  474. package/dist/text/textDomainFormatted.d.ts.map +1 -0
  475. package/dist/text/textDomainFormatted.js +183 -0
  476. package/dist/text/textDomainFormatted.js.map +1 -0
  477. package/dist/treeFactory.d.ts.map +1 -1
  478. package/dist/treeFactory.js +9 -9
  479. package/dist/treeFactory.js.map +1 -1
  480. package/dist/util/bTreeUtils.d.ts +12 -4
  481. package/dist/util/bTreeUtils.d.ts.map +1 -1
  482. package/dist/util/bTreeUtils.js +14 -18
  483. package/dist/util/bTreeUtils.js.map +1 -1
  484. package/dist/util/nestedMap.js +12 -12
  485. package/dist/util/nestedMap.js.map +1 -1
  486. package/dist/util/readSnapshotBlob.d.ts +1 -1
  487. package/dist/util/readSnapshotBlob.d.ts.map +1 -1
  488. package/dist/util/readSnapshotBlob.js.map +1 -1
  489. package/docs/user-facing/merge-semantics.md +3 -2
  490. package/eslint.config.mts +8 -36
  491. package/lib/alpha.d.ts +5 -0
  492. package/lib/codec/codec.d.ts +2 -2
  493. package/lib/codec/codec.d.ts.map +1 -1
  494. package/lib/codec/codec.js +1 -1
  495. package/lib/codec/codec.js.map +1 -1
  496. package/lib/codec/versioned/codec.d.ts +1 -1
  497. package/lib/codec/versioned/codec.d.ts.map +1 -1
  498. package/lib/codec/versioned/codec.js +2 -2
  499. package/lib/codec/versioned/codec.js.map +1 -1
  500. package/lib/core/index.d.ts +1 -1
  501. package/lib/core/index.d.ts.map +1 -1
  502. package/lib/core/index.js.map +1 -1
  503. package/lib/core/rebase/index.d.ts +1 -1
  504. package/lib/core/rebase/index.d.ts.map +1 -1
  505. package/lib/core/rebase/index.js.map +1 -1
  506. package/lib/core/rebase/types.d.ts +44 -7
  507. package/lib/core/rebase/types.d.ts.map +1 -1
  508. package/lib/core/rebase/types.js.map +1 -1
  509. package/lib/core/rebase/utils.d.ts.map +1 -1
  510. package/lib/core/rebase/utils.js +5 -1
  511. package/lib/core/rebase/utils.js.map +1 -1
  512. package/lib/core/schema-stored/formatV2.d.ts.map +1 -1
  513. package/lib/core/schema-stored/formatV2.js +1 -1
  514. package/lib/core/schema-stored/formatV2.js.map +1 -1
  515. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  516. package/lib/core/tree/anchorSet.js +2 -1
  517. package/lib/core/tree/anchorSet.js.map +1 -1
  518. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  519. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  520. package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts +1 -1
  521. package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
  522. package/lib/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
  523. package/lib/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
  524. package/lib/core/tree/detachedFieldIndexCodecV1.js +1 -1
  525. package/lib/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  526. package/lib/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
  527. package/lib/core/tree/detachedFieldIndexCodecV2.js +2 -2
  528. package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  529. package/lib/core/tree/detachedFieldIndexFormatV1.d.ts.map +1 -1
  530. package/lib/core/tree/detachedFieldIndexFormatV1.js +2 -2
  531. package/lib/core/tree/detachedFieldIndexFormatV1.js.map +1 -1
  532. package/lib/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
  533. package/lib/core/tree/detachedFieldIndexFormatV2.js +2 -2
  534. package/lib/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
  535. package/lib/core/tree/visitDelta.d.ts +1 -1
  536. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  537. package/lib/core/tree/visitDelta.js +3 -2
  538. package/lib/core/tree/visitDelta.js.map +1 -1
  539. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  540. package/lib/core/tree/visitorUtils.js +59 -19
  541. package/lib/core/tree/visitorUtils.js.map +1 -1
  542. package/lib/feature-libraries/changeAtomIdBTree.d.ts +6 -1
  543. package/lib/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
  544. package/lib/feature-libraries/changeAtomIdBTree.js.map +1 -1
  545. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +1 -1
  546. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  547. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  548. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  549. package/lib/feature-libraries/chunked-forest/chunkedForest.js +3 -1
  550. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  551. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -1
  552. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  553. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  554. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
  555. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  556. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  557. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +1 -1
  558. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  559. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  560. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +1 -1
  561. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  562. package/lib/feature-libraries/chunked-forest/codec/codecs.js +1 -1
  563. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  564. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
  565. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  566. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -0
  567. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  568. package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  569. package/lib/feature-libraries/chunked-forest/codec/format.js +1 -1
  570. package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  571. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +1 -1
  572. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.js.map +1 -1
  573. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
  574. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  575. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +2 -2
  576. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  577. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  578. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +5 -3
  579. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  580. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +10 -52
  581. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  582. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +4 -45
  583. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  584. package/lib/feature-libraries/default-schema/index.d.ts +1 -1
  585. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  586. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  587. package/lib/feature-libraries/fieldKindIdentifiers.d.ts +9 -0
  588. package/lib/feature-libraries/fieldKindIdentifiers.d.ts.map +1 -0
  589. package/lib/feature-libraries/fieldKindIdentifiers.js +13 -0
  590. package/lib/feature-libraries/fieldKindIdentifiers.js.map +1 -0
  591. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  592. package/lib/feature-libraries/flex-tree/lazyField.js +1 -1
  593. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  594. package/lib/feature-libraries/flex-tree/observer.d.ts +1 -1
  595. package/lib/feature-libraries/flex-tree/observer.d.ts.map +1 -1
  596. package/lib/feature-libraries/flex-tree/observer.js.map +1 -1
  597. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  598. package/lib/feature-libraries/forest-summary/codec.js +1 -1
  599. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  600. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  601. package/lib/feature-libraries/forest-summary/forestSummarizer.js +6 -4
  602. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  603. package/lib/feature-libraries/forest-summary/formatV1.d.ts.map +1 -1
  604. package/lib/feature-libraries/forest-summary/formatV1.js.map +1 -1
  605. package/lib/feature-libraries/forest-summary/formatV2.d.ts.map +1 -1
  606. package/lib/feature-libraries/forest-summary/formatV2.js.map +1 -1
  607. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +4 -4
  608. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  609. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +2 -2
  610. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  611. package/lib/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -1
  612. package/lib/feature-libraries/forest-summary/summaryTypes.js.map +1 -1
  613. package/lib/feature-libraries/index.d.ts +1 -1
  614. package/lib/feature-libraries/index.d.ts.map +1 -1
  615. package/lib/feature-libraries/index.js.map +1 -1
  616. package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  617. package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
  618. package/lib/feature-libraries/modular-schema/fieldKindConfiguration.d.ts.map +1 -1
  619. package/lib/feature-libraries/modular-schema/fieldKindConfiguration.js.map +1 -1
  620. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +1 -1
  621. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  622. package/lib/feature-libraries/modular-schema/genericFieldKind.js +2 -2
  623. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  624. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +1 -1
  625. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  626. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +2 -0
  627. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  628. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
  629. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js +1 -1
  630. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
  631. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  632. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +1 -1
  633. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  634. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +2 -2
  635. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  636. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +52 -43
  637. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  638. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +3 -3
  639. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  640. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  641. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  642. package/lib/feature-libraries/object-forest/objectForest.js +5 -3
  643. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  644. package/lib/feature-libraries/optional-field/index.d.ts +3 -3
  645. package/lib/feature-libraries/optional-field/index.d.ts.map +1 -1
  646. package/lib/feature-libraries/optional-field/index.js +2 -2
  647. package/lib/feature-libraries/optional-field/index.js.map +1 -1
  648. package/lib/feature-libraries/optional-field/optionalField.d.ts +10 -2
  649. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  650. package/lib/feature-libraries/optional-field/optionalField.js +14 -2
  651. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  652. package/lib/feature-libraries/optional-field/requiredField.d.ts +36 -0
  653. package/lib/feature-libraries/optional-field/requiredField.d.ts.map +1 -0
  654. package/lib/feature-libraries/optional-field/requiredField.js +24 -0
  655. package/lib/feature-libraries/optional-field/requiredField.js.map +1 -0
  656. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +1 -1
  657. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  658. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +1 -1
  659. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  660. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
  661. package/lib/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
  662. package/lib/feature-libraries/schemaChecker.d.ts.map +1 -1
  663. package/lib/feature-libraries/schemaChecker.js +1 -1
  664. package/lib/feature-libraries/schemaChecker.js.map +1 -1
  665. package/lib/feature-libraries/sequence-field/index.d.ts +2 -14
  666. package/lib/feature-libraries/sequence-field/index.d.ts.map +1 -1
  667. package/lib/feature-libraries/sequence-field/index.js +1 -13
  668. package/lib/feature-libraries/sequence-field/index.js.map +1 -1
  669. package/lib/feature-libraries/sequence-field/rebase.js +1 -1
  670. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  671. package/lib/feature-libraries/sequence-field/sequenceKind.d.ts +16 -0
  672. package/lib/feature-libraries/sequence-field/sequenceKind.d.ts.map +1 -0
  673. package/lib/feature-libraries/sequence-field/sequenceKind.js +21 -0
  674. package/lib/feature-libraries/sequence-field/sequenceKind.js.map +1 -0
  675. package/lib/index.d.ts +3 -2
  676. package/lib/index.d.ts.map +1 -1
  677. package/lib/index.js +2 -1
  678. package/lib/index.js.map +1 -1
  679. package/lib/packageVersion.d.ts +1 -1
  680. package/lib/packageVersion.js +1 -1
  681. package/lib/packageVersion.js.map +1 -1
  682. package/lib/shared-tree/independentView.d.ts.map +1 -1
  683. package/lib/shared-tree/independentView.js +3 -3
  684. package/lib/shared-tree/independentView.js.map +1 -1
  685. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  686. package/lib/shared-tree/schematizingTreeView.js +12 -10
  687. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  688. package/lib/shared-tree/sharedTree.d.ts +2 -2
  689. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  690. package/lib/shared-tree/sharedTree.js +6 -33
  691. package/lib/shared-tree/sharedTree.js.map +1 -1
  692. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  693. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  694. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts +31 -24
  695. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  696. package/lib/shared-tree/sharedTreeChangeEnricher.js +73 -55
  697. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  698. package/lib/shared-tree/tree.d.ts.map +1 -1
  699. package/lib/shared-tree/tree.js +7 -7
  700. package/lib/shared-tree/tree.js.map +1 -1
  701. package/lib/shared-tree/treeAlpha.d.ts +1 -1
  702. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  703. package/lib/shared-tree/treeAlpha.js +3 -3
  704. package/lib/shared-tree/treeAlpha.js.map +1 -1
  705. package/lib/shared-tree/treeCheckout.d.ts +21 -6
  706. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  707. package/lib/shared-tree/treeCheckout.js +67 -11
  708. package/lib/shared-tree/treeCheckout.js.map +1 -1
  709. package/lib/shared-tree-core/branch.d.ts +1 -1
  710. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  711. package/lib/shared-tree-core/branch.js +5 -1
  712. package/lib/shared-tree-core/branch.js.map +1 -1
  713. package/lib/shared-tree-core/branchCommitEnricher.d.ts +18 -31
  714. package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  715. package/lib/shared-tree-core/branchCommitEnricher.js +24 -76
  716. package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
  717. package/lib/shared-tree-core/branchIdCodec.d.ts.map +1 -1
  718. package/lib/shared-tree-core/branchIdCodec.js.map +1 -1
  719. package/lib/shared-tree-core/changeEnricher.d.ts +8 -43
  720. package/lib/shared-tree-core/changeEnricher.d.ts.map +1 -1
  721. package/lib/shared-tree-core/changeEnricher.js +1 -11
  722. package/lib/shared-tree-core/changeEnricher.js.map +1 -1
  723. package/lib/shared-tree-core/defaultResubmitMachine.d.ts +4 -12
  724. package/lib/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  725. package/lib/shared-tree-core/defaultResubmitMachine.js +28 -38
  726. package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  727. package/lib/shared-tree-core/editManager.d.ts +1 -1
  728. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  729. package/lib/shared-tree-core/editManager.js +13 -7
  730. package/lib/shared-tree-core/editManager.js.map +1 -1
  731. package/lib/shared-tree-core/editManagerCodecs.d.ts +1 -1
  732. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  733. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  734. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +1 -1
  735. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  736. package/lib/shared-tree-core/editManagerCodecsCommons.js +1 -2
  737. package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  738. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  739. package/lib/shared-tree-core/editManagerCodecsV1toV4.js +1 -1
  740. package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  741. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  742. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js +1 -1
  743. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  744. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  745. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  746. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  747. package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  748. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +1 -1
  749. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
  750. package/lib/shared-tree-core/editManagerFormatVSharedBranches.js +1 -1
  751. package/lib/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
  752. package/lib/shared-tree-core/index.d.ts +2 -2
  753. package/lib/shared-tree-core/index.d.ts.map +1 -1
  754. package/lib/shared-tree-core/index.js +0 -1
  755. package/lib/shared-tree-core/index.js.map +1 -1
  756. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
  757. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  758. package/lib/shared-tree-core/messageCodecV1ToV4.js +1 -1
  759. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  760. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts +1 -1
  761. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  762. package/lib/shared-tree-core/messageCodecVSharedBranches.js +2 -2
  763. package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  764. package/lib/shared-tree-core/messageCodecs.d.ts +2 -2
  765. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  766. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  767. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  768. package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  769. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  770. package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
  771. package/lib/shared-tree-core/messageTypes.d.ts.map +1 -1
  772. package/lib/shared-tree-core/messageTypes.js.map +1 -1
  773. package/lib/shared-tree-core/sharedTreeCore.d.ts +8 -4
  774. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  775. package/lib/shared-tree-core/sharedTreeCore.js +14 -14
  776. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  777. package/lib/shared-tree-core/versionedSummarizer.d.ts.map +1 -1
  778. package/lib/shared-tree-core/versionedSummarizer.js +1 -1
  779. package/lib/shared-tree-core/versionedSummarizer.js.map +1 -1
  780. package/lib/simple-tree/api/configuration.d.ts +2 -2
  781. package/lib/simple-tree/api/configuration.d.ts.map +1 -1
  782. package/lib/simple-tree/api/configuration.js +4 -4
  783. package/lib/simple-tree/api/configuration.js.map +1 -1
  784. package/lib/simple-tree/api/create.d.ts +1 -1
  785. package/lib/simple-tree/api/create.d.ts.map +1 -1
  786. package/lib/simple-tree/api/create.js +1 -1
  787. package/lib/simple-tree/api/create.js.map +1 -1
  788. package/lib/simple-tree/api/dirtyIndex.d.ts +1 -1
  789. package/lib/simple-tree/api/dirtyIndex.d.ts.map +1 -1
  790. package/lib/simple-tree/api/dirtyIndex.js.map +1 -1
  791. package/lib/simple-tree/api/discrepancies.d.ts.map +1 -1
  792. package/lib/simple-tree/api/discrepancies.js +3 -3
  793. package/lib/simple-tree/api/discrepancies.js.map +1 -1
  794. package/lib/simple-tree/api/getJsonSchema.d.ts +1 -1
  795. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  796. package/lib/simple-tree/api/getJsonSchema.js +1 -1
  797. package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
  798. package/lib/simple-tree/api/identifierIndex.d.ts +2 -2
  799. package/lib/simple-tree/api/identifierIndex.d.ts.map +1 -1
  800. package/lib/simple-tree/api/identifierIndex.js.map +1 -1
  801. package/lib/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
  802. package/lib/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -1
  803. package/lib/simple-tree/api/incrementalAllowedTypes.js +3 -3
  804. package/lib/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  805. package/lib/simple-tree/api/index.d.ts +1 -1
  806. package/lib/simple-tree/api/index.d.ts.map +1 -1
  807. package/lib/simple-tree/api/index.js +1 -1
  808. package/lib/simple-tree/api/index.js.map +1 -1
  809. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +1 -1
  810. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  811. package/lib/simple-tree/api/schemaCompatibilityTester.js +1 -1
  812. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  813. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +2 -2
  814. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  815. package/lib/simple-tree/api/schemaCreationUtilities.js +1 -1
  816. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  817. package/lib/simple-tree/api/schemaFactory.d.ts +2 -2
  818. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  819. package/lib/simple-tree/api/schemaFactory.js +2 -2
  820. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  821. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +6 -6
  822. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  823. package/lib/simple-tree/api/schemaFactoryAlpha.js +2 -2
  824. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  825. package/lib/simple-tree/api/schemaFactoryBeta.d.ts +2 -2
  826. package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  827. package/lib/simple-tree/api/schemaFactoryBeta.js +2 -1
  828. package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  829. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +1 -1
  830. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  831. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  832. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  833. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  834. package/lib/simple-tree/api/schemaStatics.d.ts.map +1 -1
  835. package/lib/simple-tree/api/schemaStatics.js.map +1 -1
  836. package/lib/simple-tree/api/simpleSchemaCodec.d.ts +1 -1
  837. package/lib/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -1
  838. package/lib/simple-tree/api/simpleSchemaCodec.js +3 -3
  839. package/lib/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  840. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts +2 -2
  841. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  842. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +6 -6
  843. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  844. package/lib/simple-tree/api/simpleTreeIndex.d.ts +1 -1
  845. package/lib/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
  846. package/lib/simple-tree/api/simpleTreeIndex.js +1 -1
  847. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  848. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +244 -0
  849. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  850. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +271 -1
  851. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  852. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  853. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  854. package/lib/simple-tree/api/tree.d.ts +5 -3
  855. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  856. package/lib/simple-tree/api/tree.js.map +1 -1
  857. package/lib/simple-tree/api/treeBeta.d.ts +1 -1
  858. package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
  859. package/lib/simple-tree/api/treeBeta.js +2 -2
  860. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  861. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  862. package/lib/simple-tree/api/treeNodeApi.js +4 -4
  863. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  864. package/lib/simple-tree/api/typesUnsafe.d.ts +1 -1
  865. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  866. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  867. package/lib/simple-tree/api/verboseTree.d.ts +1 -1
  868. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  869. package/lib/simple-tree/api/verboseTree.js +3 -3
  870. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  871. package/lib/simple-tree/core/allowedTypes.d.ts +1 -1
  872. package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -1
  873. package/lib/simple-tree/core/allowedTypes.js +2 -2
  874. package/lib/simple-tree/core/allowedTypes.js.map +1 -1
  875. package/lib/simple-tree/core/context.d.ts.map +1 -1
  876. package/lib/simple-tree/core/context.js.map +1 -1
  877. package/lib/simple-tree/core/treeNode.d.ts.map +1 -1
  878. package/lib/simple-tree/core/treeNode.js +1 -1
  879. package/lib/simple-tree/core/treeNode.js.map +1 -1
  880. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  881. package/lib/simple-tree/core/treeNodeKernel.js +7 -5
  882. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  883. package/lib/simple-tree/core/treeNodeSchema.d.ts +5 -5
  884. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  885. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  886. package/lib/simple-tree/core/treeNodeValid.d.ts +3 -3
  887. package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  888. package/lib/simple-tree/core/treeNodeValid.js +2 -2
  889. package/lib/simple-tree/core/treeNodeValid.js.map +1 -1
  890. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +1 -1
  891. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  892. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  893. package/lib/simple-tree/core/withType.d.ts.map +1 -1
  894. package/lib/simple-tree/core/withType.js.map +1 -1
  895. package/lib/simple-tree/createContext.d.ts.map +1 -1
  896. package/lib/simple-tree/createContext.js.map +1 -1
  897. package/lib/simple-tree/fieldSchema.d.ts +1 -1
  898. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  899. package/lib/simple-tree/fieldSchema.js.map +1 -1
  900. package/lib/simple-tree/index.d.ts +1 -1
  901. package/lib/simple-tree/index.d.ts.map +1 -1
  902. package/lib/simple-tree/index.js +1 -1
  903. package/lib/simple-tree/index.js.map +1 -1
  904. package/lib/simple-tree/leafNodeSchema.d.ts +1 -1
  905. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  906. package/lib/simple-tree/leafNodeSchema.js +2 -2
  907. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  908. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +1 -1
  909. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  910. package/lib/simple-tree/node-kinds/array/arrayNode.js +5 -5
  911. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  912. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +1 -1
  913. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  914. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  915. package/lib/simple-tree/node-kinds/common.d.ts.map +1 -1
  916. package/lib/simple-tree/node-kinds/common.js.map +1 -1
  917. package/lib/simple-tree/node-kinds/map/mapNode.d.ts +2 -2
  918. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  919. package/lib/simple-tree/node-kinds/map/mapNode.js +6 -6
  920. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  921. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts +1 -1
  922. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  923. package/lib/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  924. package/lib/simple-tree/node-kinds/object/objectNode.d.ts +2 -2
  925. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  926. package/lib/simple-tree/node-kinds/object/objectNode.js +3 -3
  927. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  928. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +3 -3
  929. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  930. package/lib/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  931. package/lib/simple-tree/node-kinds/record/recordNode.d.ts +1 -1
  932. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  933. package/lib/simple-tree/node-kinds/record/recordNode.js +4 -4
  934. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  935. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +1 -1
  936. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  937. package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  938. package/lib/simple-tree/prepareForInsertion.d.ts +2 -2
  939. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
  940. package/lib/simple-tree/prepareForInsertion.js +4 -4
  941. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  942. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  943. package/lib/simple-tree/simpleSchema.js.map +1 -1
  944. package/lib/simple-tree/treeSchema.d.ts.map +1 -1
  945. package/lib/simple-tree/treeSchema.js.map +1 -1
  946. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +1 -1
  947. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  948. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +2 -2
  949. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  950. package/lib/tableSchema.d.ts.map +1 -1
  951. package/lib/tableSchema.js +2 -1
  952. package/lib/tableSchema.js.map +1 -1
  953. package/lib/text/index.d.ts +7 -0
  954. package/lib/text/index.d.ts.map +1 -0
  955. package/lib/text/index.js +7 -0
  956. package/lib/text/index.js.map +1 -0
  957. package/lib/text/textDomain.d.ts +146 -0
  958. package/lib/text/textDomain.d.ts.map +1 -0
  959. package/lib/text/textDomain.js +118 -0
  960. package/lib/text/textDomain.js.map +1 -0
  961. package/lib/text/textDomainFormatted.d.ts +572 -0
  962. package/lib/text/textDomainFormatted.d.ts.map +1 -0
  963. package/lib/text/textDomainFormatted.js +180 -0
  964. package/lib/text/textDomainFormatted.js.map +1 -0
  965. package/lib/treeFactory.d.ts.map +1 -1
  966. package/lib/treeFactory.js +2 -2
  967. package/lib/treeFactory.js.map +1 -1
  968. package/lib/util/bTreeUtils.d.ts +12 -4
  969. package/lib/util/bTreeUtils.d.ts.map +1 -1
  970. package/lib/util/bTreeUtils.js +15 -19
  971. package/lib/util/bTreeUtils.js.map +1 -1
  972. package/lib/util/nestedMap.js +12 -12
  973. package/lib/util/nestedMap.js.map +1 -1
  974. package/lib/util/readSnapshotBlob.d.ts +1 -1
  975. package/lib/util/readSnapshotBlob.d.ts.map +1 -1
  976. package/lib/util/readSnapshotBlob.js.map +1 -1
  977. package/package.json +25 -25
  978. package/src/codec/codec.ts +10 -7
  979. package/src/codec/versioned/codec.ts +3 -3
  980. package/src/core/index.ts +2 -0
  981. package/src/core/rebase/index.ts +2 -0
  982. package/src/core/rebase/types.ts +57 -20
  983. package/src/core/rebase/utils.ts +8 -4
  984. package/src/core/schema-stored/formatV2.ts +2 -1
  985. package/src/core/tree/anchorSet.ts +2 -1
  986. package/src/core/tree/detachedFieldIndex.ts +1 -1
  987. package/src/core/tree/detachedFieldIndexCodecCommon.ts +2 -1
  988. package/src/core/tree/detachedFieldIndexCodecV1.ts +2 -2
  989. package/src/core/tree/detachedFieldIndexCodecV2.ts +3 -3
  990. package/src/core/tree/detachedFieldIndexFormatV1.ts +3 -2
  991. package/src/core/tree/detachedFieldIndexFormatV2.ts +3 -2
  992. package/src/core/tree/visitDelta.ts +8 -5
  993. package/src/core/tree/visitorUtils.ts +57 -20
  994. package/src/feature-libraries/changeAtomIdBTree.ts +9 -1
  995. package/src/feature-libraries/chunked-forest/chunkTree.ts +1 -1
  996. package/src/feature-libraries/chunked-forest/chunkedForest.ts +3 -1
  997. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +1 -1
  998. package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -1
  999. package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +1 -1
  1000. package/src/feature-libraries/chunked-forest/codec/codecs.ts +2 -2
  1001. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +2 -1
  1002. package/src/feature-libraries/chunked-forest/codec/format.ts +1 -1
  1003. package/src/feature-libraries/chunked-forest/codec/formatGeneric.ts +1 -0
  1004. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +3 -3
  1005. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +5 -10
  1006. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +22 -110
  1007. package/src/feature-libraries/default-schema/index.ts +0 -5
  1008. package/src/feature-libraries/fieldKindIdentifiers.ts +16 -0
  1009. package/src/feature-libraries/flex-tree/lazyField.ts +1 -1
  1010. package/src/feature-libraries/flex-tree/observer.ts +3 -1
  1011. package/src/feature-libraries/forest-summary/codec.ts +1 -1
  1012. package/src/feature-libraries/forest-summary/forestSummarizer.ts +9 -7
  1013. package/src/feature-libraries/forest-summary/formatV1.ts +1 -0
  1014. package/src/feature-libraries/forest-summary/formatV2.ts +1 -0
  1015. package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +9 -7
  1016. package/src/feature-libraries/forest-summary/summaryTypes.ts +1 -0
  1017. package/src/feature-libraries/index.ts +0 -5
  1018. package/src/feature-libraries/mapTreeCursor.ts +1 -1
  1019. package/src/feature-libraries/modular-schema/fieldKindConfiguration.ts +1 -0
  1020. package/src/feature-libraries/modular-schema/genericFieldKind.ts +2 -2
  1021. package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +3 -1
  1022. package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +2 -2
  1023. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +3 -2
  1024. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +83 -74
  1025. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +3 -3
  1026. package/src/feature-libraries/object-forest/objectForest.ts +5 -3
  1027. package/src/feature-libraries/optional-field/index.ts +6 -8
  1028. package/src/feature-libraries/optional-field/optionalField.ts +31 -0
  1029. package/src/feature-libraries/optional-field/requiredField.ts +62 -0
  1030. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +1 -1
  1031. package/src/feature-libraries/schema-edits/schemaChangeFormat.ts +1 -0
  1032. package/src/feature-libraries/schemaChecker.ts +3 -2
  1033. package/src/feature-libraries/sequence-field/index.ts +2 -51
  1034. package/src/feature-libraries/sequence-field/rebase.ts +1 -1
  1035. package/src/feature-libraries/sequence-field/sequenceKind.ts +40 -0
  1036. package/src/index.ts +7 -0
  1037. package/src/packageVersion.ts +1 -1
  1038. package/src/shared-tree/independentView.ts +4 -3
  1039. package/src/shared-tree/schematizingTreeView.ts +17 -13
  1040. package/src/shared-tree/sharedTree.ts +9 -46
  1041. package/src/shared-tree/sharedTreeChangeCodecs.ts +1 -0
  1042. package/src/shared-tree/sharedTreeChangeEnricher.ts +87 -66
  1043. package/src/shared-tree/tree.ts +10 -10
  1044. package/src/shared-tree/treeAlpha.ts +26 -25
  1045. package/src/shared-tree/treeCheckout.ts +119 -23
  1046. package/src/shared-tree-core/branch.ts +9 -5
  1047. package/src/shared-tree-core/branchCommitEnricher.ts +25 -77
  1048. package/src/shared-tree-core/branchIdCodec.ts +1 -0
  1049. package/src/shared-tree-core/changeEnricher.ts +8 -52
  1050. package/src/shared-tree-core/defaultResubmitMachine.ts +39 -51
  1051. package/src/shared-tree-core/editManager.ts +32 -32
  1052. package/src/shared-tree-core/editManagerCodecs.ts +2 -2
  1053. package/src/shared-tree-core/editManagerCodecsCommons.ts +7 -6
  1054. package/src/shared-tree-core/editManagerCodecsV1toV4.ts +1 -1
  1055. package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +2 -2
  1056. package/src/shared-tree-core/editManagerFormatCommons.ts +1 -0
  1057. package/src/shared-tree-core/editManagerFormatV1toV4.ts +1 -0
  1058. package/src/shared-tree-core/editManagerFormatVSharedBranches.ts +3 -2
  1059. package/src/shared-tree-core/index.ts +2 -5
  1060. package/src/shared-tree-core/messageCodecV1ToV4.ts +3 -3
  1061. package/src/shared-tree-core/messageCodecVSharedBranches.ts +4 -4
  1062. package/src/shared-tree-core/messageCodecs.ts +2 -2
  1063. package/src/shared-tree-core/messageFormatV1ToV4.ts +1 -0
  1064. package/src/shared-tree-core/messageFormatVSharedBranches.ts +1 -0
  1065. package/src/shared-tree-core/messageTypes.ts +1 -0
  1066. package/src/shared-tree-core/sharedTreeCore.ts +27 -28
  1067. package/src/shared-tree-core/versionedSummarizer.ts +3 -1
  1068. package/src/simple-tree/api/configuration.ts +9 -9
  1069. package/src/simple-tree/api/create.ts +7 -6
  1070. package/src/simple-tree/api/dirtyIndex.ts +4 -2
  1071. package/src/simple-tree/api/discrepancies.ts +9 -8
  1072. package/src/simple-tree/api/getJsonSchema.ts +4 -3
  1073. package/src/simple-tree/api/identifierIndex.ts +4 -2
  1074. package/src/simple-tree/api/incrementalAllowedTypes.ts +6 -5
  1075. package/src/simple-tree/api/index.ts +3 -0
  1076. package/src/simple-tree/api/schemaCompatibilityTester.ts +3 -3
  1077. package/src/simple-tree/api/schemaCreationUtilities.ts +4 -3
  1078. package/src/simple-tree/api/schemaFactory.ts +16 -17
  1079. package/src/simple-tree/api/schemaFactoryAlpha.ts +22 -22
  1080. package/src/simple-tree/api/schemaFactoryBeta.ts +18 -16
  1081. package/src/simple-tree/api/schemaFactoryRecursive.ts +1 -1
  1082. package/src/simple-tree/api/schemaFromSimple.ts +1 -1
  1083. package/src/simple-tree/api/schemaStatics.ts +2 -0
  1084. package/src/simple-tree/api/simpleSchemaCodec.ts +12 -11
  1085. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +24 -22
  1086. package/src/simple-tree/api/simpleTreeIndex.ts +6 -4
  1087. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +504 -1
  1088. package/src/simple-tree/api/storedSchema.ts +2 -1
  1089. package/src/simple-tree/api/tree.ts +5 -3
  1090. package/src/simple-tree/api/treeBeta.ts +3 -3
  1091. package/src/simple-tree/api/treeNodeApi.ts +14 -13
  1092. package/src/simple-tree/api/typesUnsafe.ts +7 -8
  1093. package/src/simple-tree/api/verboseTree.ts +6 -5
  1094. package/src/simple-tree/core/allowedTypes.ts +4 -4
  1095. package/src/simple-tree/core/context.ts +1 -1
  1096. package/src/simple-tree/core/treeNode.ts +1 -1
  1097. package/src/simple-tree/core/treeNodeKernel.ts +7 -5
  1098. package/src/simple-tree/core/treeNodeSchema.ts +7 -6
  1099. package/src/simple-tree/core/treeNodeValid.ts +9 -9
  1100. package/src/simple-tree/core/unhydratedFlexTree.ts +1 -1
  1101. package/src/simple-tree/core/withType.ts +3 -2
  1102. package/src/simple-tree/createContext.ts +1 -0
  1103. package/src/simple-tree/fieldSchema.ts +1 -2
  1104. package/src/simple-tree/index.ts +3 -0
  1105. package/src/simple-tree/leafNodeSchema.ts +3 -3
  1106. package/src/simple-tree/node-kinds/array/arrayNode.ts +17 -16
  1107. package/src/simple-tree/node-kinds/array/arrayNodeTypes.ts +2 -2
  1108. package/src/simple-tree/node-kinds/common.ts +1 -1
  1109. package/src/simple-tree/node-kinds/map/mapNode.ts +16 -15
  1110. package/src/simple-tree/node-kinds/map/mapNodeTypes.ts +2 -2
  1111. package/src/simple-tree/node-kinds/object/objectNode.ts +11 -11
  1112. package/src/simple-tree/node-kinds/object/objectNodeTypes.ts +8 -7
  1113. package/src/simple-tree/node-kinds/record/recordNode.ts +12 -12
  1114. package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +1 -2
  1115. package/src/simple-tree/prepareForInsertion.ts +10 -8
  1116. package/src/simple-tree/simpleSchema.ts +1 -0
  1117. package/src/simple-tree/treeSchema.ts +1 -0
  1118. package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +2 -2
  1119. package/src/tableSchema.ts +3 -1
  1120. package/src/text/README.md +8 -0
  1121. package/src/text/index.ts +7 -0
  1122. package/src/text/textDomain.ts +199 -0
  1123. package/src/text/textDomainFormatted.ts +309 -0
  1124. package/src/treeFactory.ts +4 -4
  1125. package/src/util/bTreeUtils.ts +33 -22
  1126. package/src/util/nestedMap.ts +12 -12
  1127. package/src/util/readSnapshotBlob.ts +4 -2
  1128. package/.eslintrc.cjs +0 -125
  1129. package/assertTagging.config.mjs +0 -14
  1130. package/dist/shared-tree-core/transactionEnricher.d.ts +0 -23
  1131. package/dist/shared-tree-core/transactionEnricher.d.ts.map +0 -1
  1132. package/dist/shared-tree-core/transactionEnricher.js +0 -74
  1133. package/dist/shared-tree-core/transactionEnricher.js.map +0 -1
  1134. package/lib/shared-tree-core/transactionEnricher.d.ts +0 -23
  1135. package/lib/shared-tree-core/transactionEnricher.d.ts.map +0 -1
  1136. package/lib/shared-tree-core/transactionEnricher.js +0 -70
  1137. package/lib/shared-tree-core/transactionEnricher.js.map +0 -1
  1138. package/src/shared-tree-core/transactionEnricher.ts +0 -74
@@ -3,13 +3,13 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { IIdCompressor, SessionId } from "@fluidframework/id-compressor";
6
+ import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
6
7
  import { type CodecTree, type CodecWriteOptions, type IJsonCodec } from "../../../codec/index.js";
7
8
  import { type ITreeCursorSynchronous, type SchemaAndPolicy, type TreeChunk } from "../../../core/index.js";
8
9
  import { type Brand, type JsonCompatibleReadOnly } from "../../../util/index.js";
9
10
  import { TreeCompressionStrategy } from "../../treeCompressionUtils.js";
10
11
  import type { FieldBatch } from "./fieldBatch.js";
11
12
  import { type EncodedFieldBatch } from "./format.js";
12
- import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
13
13
  import type { IncrementalEncodingPolicy } from "./incrementalEncodingPolicy.js";
14
14
  /**
15
15
  * Reference ID for a chunk that is incrementally encoded.
@@ -1 +1 @@
1
- {"version":3,"file":"codecs.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/codecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAM9E,OAAO,EACN,KAAK,SAAS,EACd,KAAK,iBAAiB,EAEtB,KAAK,UAAU,EAEf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEN,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAGN,KAAK,KAAK,EACV,KAAK,sBAAsB,EAE3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAGxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACN,KAAK,iBAAiB,EAKtB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAIhF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;AAGxE;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IAClC;;;OAGG;IACH,yBAAyB,EAAE,yBAAyB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,eAAe,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,yBAAyB,CAAC,EAAE,yBAAyB,CAAC;CAC/D;AACD;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,CACvC,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,CACzB,CAAC;AAiBF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,GAAG,eAAe,CA+F/E;AAED,wBAAgB,+BAA+B,CAC9C,aAAa,EAAE,uBAAuB,GACpC,SAAS,CAEX"}
@@ -9,8 +9,8 @@ import { brand, brandedNumberType, unbrand, } from "../../../util/index.js";
9
9
  import { TreeCompressionStrategy } from "../../treeCompressionUtils.js";
10
10
  import { decode } from "./chunkDecoding.js";
11
11
  import { validVersions, FieldBatchFormatVersion, EncodedFieldBatchV1, EncodedFieldBatchV2, } from "./format.js";
12
- import { uncompressedEncodeV1, uncompressedEncodeV2 } from "./uncompressedEncode.js";
13
12
  import { schemaCompressedEncodeV1, schemaCompressedEncodeV2 } from "./schemaBasedEncode.js";
13
+ import { uncompressedEncodeV1, uncompressedEncodeV2 } from "./uncompressedEncode.js";
14
14
  const ChunkReferenceId = brandedNumberType({ multipleOf: 1, minimum: 0 });
15
15
  /**
16
16
  * Convert a MinimumVersionForCollab to write version for {@link FieldBatchCodec}.
@@ -1 +1 @@
1
- {"version":3,"file":"codecs.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/codecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,EACN,+BAA+B,EAC/B,yBAAyB,GACzB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAGN,kBAAkB,EAElB,2BAA2B,GAC3B,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EACN,KAAK,EACL,iBAAiB,EAGjB,OAAO,GACP,MAAM,wBAAwB,CAAC;AAChC,OAAO,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AAC;yBAAM,CAAC;wBACP,OAAO,GAAG,wBAAwB,CACjC,OAAO,CAAC,MAAM,CAAC,MAAM,EACrB,OAAO,CAAC,MAAM,CAAC,MAAM,EACrB,IAAI,EACJ,OAAO,CAAC,YAAY,EACpB,kBAAkB,CAClB,CAAC;oBACH,CAAC;oBAED,MAAM;gBACP,CAAC;gBACD,OAAO,CAAC,CAAC,CAAC;oBACT,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;gBACrC,CAAC;YACF,CAAC;YAED,oDAAoD;YACpD,OAAO,OAAO,CAAC;QAChB,CAAC;QACD,MAAM,EAAE,CAAC,IAAuB,EAAE,OAAkC,EAAc,EAAE;YACnF,6CAA6C;YAC7C,OAAO,MAAM,CACZ,IAAI,EACJ;gBACC,YAAY,EAAE,OAAO,CAAC,YAAY;gBAClC,YAAY,EAAE,OAAO,CAAC,YAAY;aAClC,EACD,OAAO,CAAC,yBAAyB,CACjC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QAClC,CAAC;KACD,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC9C,aAAsC;IAEtC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,gCAAgC,CAAC,aAAa,CAAC,EAAE,CAAC;AACzF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor, SessionId } from \"@fluidframework/id-compressor\";\nimport {\n\tgetConfigForMinVersionForCollab,\n\tlowestMinVersionForCollab,\n} from \"@fluidframework/runtime-utils/internal\";\n\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\tFluidClientVersion,\n\ttype IJsonCodec,\n\tmakeVersionedValidatedCodec,\n} from \"../../../codec/index.js\";\nimport {\n\tCursorLocationType,\n\ttype ITreeCursorSynchronous,\n\ttype SchemaAndPolicy,\n\ttype TreeChunk,\n} from \"../../../core/index.js\";\nimport {\n\tbrand,\n\tbrandedNumberType,\n\ttype Brand,\n\ttype JsonCompatibleReadOnly,\n\tunbrand,\n} from \"../../../util/index.js\";\nimport { TreeCompressionStrategy } from \"../../treeCompressionUtils.js\";\n\nimport { decode } from \"./chunkDecoding.js\";\nimport type { FieldBatch } from \"./fieldBatch.js\";\nimport {\n\ttype EncodedFieldBatch,\n\tvalidVersions,\n\tFieldBatchFormatVersion,\n\tEncodedFieldBatchV1,\n\tEncodedFieldBatchV2,\n} from \"./format.js\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport type { IncrementalEncodingPolicy } from \"./incrementalEncodingPolicy.js\";\nimport { uncompressedEncodeV1, uncompressedEncodeV2 } from \"./uncompressedEncode.js\";\nimport { schemaCompressedEncodeV1, schemaCompressedEncodeV2 } from \"./schemaBasedEncode.js\";\n\n/**\n * Reference ID for a chunk that is incrementally encoded.\n */\nexport type ChunkReferenceId = Brand<number, \"forest.ChunkReferenceId\">;\nconst ChunkReferenceId = brandedNumberType<ChunkReferenceId>({ multipleOf: 1, minimum: 0 });\n\n/**\n * Properties for incremental encoding.\n * Fields that support incremental encoding will encode their chunks separately by calling `encodeIncrementalField`.\n * @remarks\n * This supports features like incremental summarization where the summary from these fields can be re-used if\n * unchanged between summaries.\n * Note that each of these chunks that are incrementally encoded is fully self-describing (contain its own shapes\n * list and identifier table) and does not rely on context from its parent.\n */\nexport interface IncrementalEncoder {\n\t/**\n\t * Returns whether a node / field should be incrementally encoded.\n\t * @remarks See {@link IncrementalEncodingPolicy}.\n\t */\n\tshouldEncodeIncrementally: IncrementalEncodingPolicy;\n\t/**\n\t * Called to encode an incremental field at the cursor.\n\t * The chunks for this field are encoded separately from the main buffer.\n\t * @param cursor - The cursor pointing to the field to encode.\n\t * @param chunkEncoder - A function that encodes the contents of the passed chunk in the field.\n\t * @returns The reference IDs of the encoded chunks in the field.\n\t * This is used to retrieve the encoded chunks later.\n\t */\n\tencodeIncrementalField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tchunkEncoder: (chunk: TreeChunk) => EncodedFieldBatch,\n\t): ChunkReferenceId[];\n}\n\n/**\n * Properties for incremental decoding.\n *\n * Fields that had their chunks incrementally encoded will retrieve them by calling `getEncodedIncrementalChunk`.\n * @remarks\n * See {@link IncrementalEncoder} for more details.\n */\nexport interface IncrementalDecoder {\n\t/**\n\t * Called to decode an incremental chunk with the given reference ID.\n\t * @param referenceId - The reference ID of the chunk to decode.\n\t * @param chunkDecoder - A function that decodes the chunk.\n\t * @returns The decoded chunk.\n\t */\n\tdecodeIncrementalChunk(\n\t\treferenceId: ChunkReferenceId,\n\t\tchunkDecoder: (encoded: EncodedFieldBatch) => TreeChunk,\n\t): TreeChunk;\n}\n/**\n * Combines the properties of {@link IncrementalEncoder} and {@link IncrementalDecoder}.\n */\nexport interface IncrementalEncoderDecoder extends IncrementalEncoder, IncrementalDecoder {}\n\nexport interface FieldBatchEncodingContext {\n\treadonly encodeType: TreeCompressionStrategy;\n\treadonly idCompressor: IIdCompressor;\n\treadonly originatorId: SessionId;\n\treadonly schema?: SchemaAndPolicy;\n\t/**\n\t * An encoder / decoder for encoding and decoding of incremental fields.\n\t * This will be defined if incremental encoding is supported and enabled.\n\t */\n\treadonly incrementalEncoderDecoder?: IncrementalEncoderDecoder;\n}\n/**\n * @remarks\n * Fields in this batch currently don't have field schema for the root, which limits optimizations.\n */\nexport type FieldBatchCodec = IJsonCodec<\n\tFieldBatch,\n\tEncodedFieldBatch,\n\tJsonCompatibleReadOnly,\n\tFieldBatchEncodingContext\n>;\n\n/**\n * Convert a MinimumVersionForCollab to write version for {@link FieldBatchCodec}.\n * @param clientVersion - The MinimumVersionForCollab to convert.\n */\nfunction clientVersionToFieldBatchVersion(\n\tclientVersion: MinimumVersionForCollab,\n): FieldBatchFormatVersion {\n\treturn brand(\n\t\tgetConfigForMinVersionForCollab(clientVersion, {\n\t\t\t[lowestMinVersionForCollab]: FieldBatchFormatVersion.v1,\n\t\t\t[FluidClientVersion.v2_73]: FieldBatchFormatVersion.v2,\n\t\t}),\n\t);\n}\n\nexport function makeFieldBatchCodec(options: CodecWriteOptions): FieldBatchCodec {\n\tconst writeVersion = clientVersionToFieldBatchVersion(options.minVersionForCollab);\n\t// Note: it's important that the decode function is schema-agnostic for this strategy/layering to work, since\n\t// the schema that an op was encoded in doesn't necessarily match the current schema for the document (e.g. if\n\t// decode is being run on a client that just submitted a schema change, but the op is from another client who has\n\t// yet to receive that change).\n\tassert(\n\t\tvalidVersions.has(writeVersion),\n\t\t0x935 /* Invalid write version for FieldBatch codec */,\n\t);\n\n\tlet uncompressedEncodeFn: typeof uncompressedEncodeV1 | typeof uncompressedEncodeV2;\n\tlet schemaCompressedEncodeFn:\n\t\t| typeof schemaCompressedEncodeV1\n\t\t| typeof schemaCompressedEncodeV2;\n\tlet encodedFieldBatchType: typeof EncodedFieldBatchV1 | typeof EncodedFieldBatchV2;\n\tswitch (writeVersion) {\n\t\tcase unbrand(FieldBatchFormatVersion.v1): {\n\t\t\tuncompressedEncodeFn = uncompressedEncodeV1;\n\t\t\tschemaCompressedEncodeFn = schemaCompressedEncodeV1;\n\t\t\tencodedFieldBatchType = EncodedFieldBatchV1;\n\t\t\tbreak;\n\t\t}\n\t\tcase unbrand(FieldBatchFormatVersion.v2): {\n\t\t\tuncompressedEncodeFn = uncompressedEncodeV2;\n\t\t\tschemaCompressedEncodeFn = schemaCompressedEncodeV2;\n\t\t\tencodedFieldBatchType = EncodedFieldBatchV2;\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tunreachableCase(writeVersion);\n\t\t}\n\t}\n\n\treturn makeVersionedValidatedCodec(options, validVersions, encodedFieldBatchType, {\n\t\tencode: (data: FieldBatch, context: FieldBatchEncodingContext): EncodedFieldBatch => {\n\t\t\tfor (const cursor of data) {\n\t\t\t\tassert(\n\t\t\t\t\tcursor.mode === CursorLocationType.Fields,\n\t\t\t\t\t0x8a3 /* FieldBatch expects fields cursors */,\n\t\t\t\t);\n\t\t\t}\n\t\t\tlet encoded: EncodedFieldBatch;\n\t\t\tlet incrementalEncoder: IncrementalEncoder | undefined;\n\t\t\tswitch (context.encodeType) {\n\t\t\t\tcase TreeCompressionStrategy.Uncompressed: {\n\t\t\t\t\tencoded = uncompressedEncodeFn(data);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase TreeCompressionStrategy.CompressedIncremental: {\n\t\t\t\t\tassert(\n\t\t\t\t\t\twriteVersion >= FieldBatchFormatVersion.v2,\n\t\t\t\t\t\t0xca0 /* Unsupported FieldBatchFormatVersion for incremental encoding; must be v2 or higher */,\n\t\t\t\t\t);\n\t\t\t\t\t// Incremental encoding is only supported for CompressedIncremental.\n\t\t\t\t\tincrementalEncoder = context.incrementalEncoderDecoder;\n\t\t\t\t}\n\t\t\t\t// fallthrough\n\t\t\t\tcase TreeCompressionStrategy.Compressed: {\n\t\t\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\t\t\tif (context.schema === undefined) {\n\t\t\t\t\t\t// TODO: consider enabling a somewhat compressed but not schema accelerated encode.\n\t\t\t\t\t\tencoded = uncompressedEncodeFn(data);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tencoded = schemaCompressedEncodeFn(\n\t\t\t\t\t\t\tcontext.schema.schema,\n\t\t\t\t\t\t\tcontext.schema.policy,\n\t\t\t\t\t\t\tdata,\n\t\t\t\t\t\t\tcontext.idCompressor,\n\t\t\t\t\t\t\tincrementalEncoder,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tunreachableCase(context.encodeType);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// TODO: consider checking input data was in schema.\n\t\t\treturn encoded;\n\t\t},\n\t\tdecode: (data: EncodedFieldBatch, context: FieldBatchEncodingContext): FieldBatch => {\n\t\t\t// TODO: consider checking data is in schema.\n\t\t\treturn decode(\n\t\t\t\tdata,\n\t\t\t\t{\n\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\toriginatorId: context.originatorId,\n\t\t\t\t},\n\t\t\t\tcontext.incrementalEncoderDecoder,\n\t\t\t).map((chunk) => chunk.cursor());\n\t\t},\n\t});\n}\n\nexport function getCodecTreeForFieldBatchFormat(\n\tclientVersion: MinimumVersionForCollab,\n): CodecTree {\n\treturn { name: \"FieldBatch\", version: clientVersionToFieldBatchVersion(clientVersion) };\n}\n"]}
1
+ {"version":3,"file":"codecs.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/codecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAG9E,OAAO,EACN,+BAA+B,EAC/B,yBAAyB,GACzB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAGN,kBAAkB,EAElB,2BAA2B,GAC3B,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EACN,KAAK,EACL,iBAAiB,EAGjB,OAAO,GACP,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAExE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAEN,aAAa,EACb,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,GACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAC5F,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAMrF,MAAM,gBAAgB,GAAG,iBAAiB,CAAmB,EAAE,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;AA6E5F;;;GAGG;AACH,SAAS,gCA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,IAAI,EACJ;gBACC,YAAY,EAAE,OAAO,CAAC,YAAY;gBAClC,YAAY,EAAE,OAAO,CAAC,YAAY;aAClC,EACD,OAAO,CAAC,yBAAyB,CACjC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QAClC,CAAC;KACD,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC9C,aAAsC;IAEtC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,gCAAgC,CAAC,aAAa,CAAC,EAAE,CAAC;AACzF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor, SessionId } from \"@fluidframework/id-compressor\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tgetConfigForMinVersionForCollab,\n\tlowestMinVersionForCollab,\n} from \"@fluidframework/runtime-utils/internal\";\n\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\tFluidClientVersion,\n\ttype IJsonCodec,\n\tmakeVersionedValidatedCodec,\n} from \"../../../codec/index.js\";\nimport {\n\tCursorLocationType,\n\ttype ITreeCursorSynchronous,\n\ttype SchemaAndPolicy,\n\ttype TreeChunk,\n} from \"../../../core/index.js\";\nimport {\n\tbrand,\n\tbrandedNumberType,\n\ttype Brand,\n\ttype JsonCompatibleReadOnly,\n\tunbrand,\n} from \"../../../util/index.js\";\nimport { TreeCompressionStrategy } from \"../../treeCompressionUtils.js\";\n\nimport { decode } from \"./chunkDecoding.js\";\nimport type { FieldBatch } from \"./fieldBatch.js\";\nimport {\n\ttype EncodedFieldBatch,\n\tvalidVersions,\n\tFieldBatchFormatVersion,\n\tEncodedFieldBatchV1,\n\tEncodedFieldBatchV2,\n} from \"./format.js\";\nimport type { IncrementalEncodingPolicy } from \"./incrementalEncodingPolicy.js\";\nimport { schemaCompressedEncodeV1, schemaCompressedEncodeV2 } from \"./schemaBasedEncode.js\";\nimport { uncompressedEncodeV1, uncompressedEncodeV2 } from \"./uncompressedEncode.js\";\n\n/**\n * Reference ID for a chunk that is incrementally encoded.\n */\nexport type ChunkReferenceId = Brand<number, \"forest.ChunkReferenceId\">;\nconst ChunkReferenceId = brandedNumberType<ChunkReferenceId>({ multipleOf: 1, minimum: 0 });\n\n/**\n * Properties for incremental encoding.\n * Fields that support incremental encoding will encode their chunks separately by calling `encodeIncrementalField`.\n * @remarks\n * This supports features like incremental summarization where the summary from these fields can be re-used if\n * unchanged between summaries.\n * Note that each of these chunks that are incrementally encoded is fully self-describing (contain its own shapes\n * list and identifier table) and does not rely on context from its parent.\n */\nexport interface IncrementalEncoder {\n\t/**\n\t * Returns whether a node / field should be incrementally encoded.\n\t * @remarks See {@link IncrementalEncodingPolicy}.\n\t */\n\tshouldEncodeIncrementally: IncrementalEncodingPolicy;\n\t/**\n\t * Called to encode an incremental field at the cursor.\n\t * The chunks for this field are encoded separately from the main buffer.\n\t * @param cursor - The cursor pointing to the field to encode.\n\t * @param chunkEncoder - A function that encodes the contents of the passed chunk in the field.\n\t * @returns The reference IDs of the encoded chunks in the field.\n\t * This is used to retrieve the encoded chunks later.\n\t */\n\tencodeIncrementalField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tchunkEncoder: (chunk: TreeChunk) => EncodedFieldBatch,\n\t): ChunkReferenceId[];\n}\n\n/**\n * Properties for incremental decoding.\n *\n * Fields that had their chunks incrementally encoded will retrieve them by calling `getEncodedIncrementalChunk`.\n * @remarks\n * See {@link IncrementalEncoder} for more details.\n */\nexport interface IncrementalDecoder {\n\t/**\n\t * Called to decode an incremental chunk with the given reference ID.\n\t * @param referenceId - The reference ID of the chunk to decode.\n\t * @param chunkDecoder - A function that decodes the chunk.\n\t * @returns The decoded chunk.\n\t */\n\tdecodeIncrementalChunk(\n\t\treferenceId: ChunkReferenceId,\n\t\tchunkDecoder: (encoded: EncodedFieldBatch) => TreeChunk,\n\t): TreeChunk;\n}\n/**\n * Combines the properties of {@link IncrementalEncoder} and {@link IncrementalDecoder}.\n */\nexport interface IncrementalEncoderDecoder extends IncrementalEncoder, IncrementalDecoder {}\n\nexport interface FieldBatchEncodingContext {\n\treadonly encodeType: TreeCompressionStrategy;\n\treadonly idCompressor: IIdCompressor;\n\treadonly originatorId: SessionId;\n\treadonly schema?: SchemaAndPolicy;\n\t/**\n\t * An encoder / decoder for encoding and decoding of incremental fields.\n\t * This will be defined if incremental encoding is supported and enabled.\n\t */\n\treadonly incrementalEncoderDecoder?: IncrementalEncoderDecoder;\n}\n/**\n * @remarks\n * Fields in this batch currently don't have field schema for the root, which limits optimizations.\n */\nexport type FieldBatchCodec = IJsonCodec<\n\tFieldBatch,\n\tEncodedFieldBatch,\n\tJsonCompatibleReadOnly,\n\tFieldBatchEncodingContext\n>;\n\n/**\n * Convert a MinimumVersionForCollab to write version for {@link FieldBatchCodec}.\n * @param clientVersion - The MinimumVersionForCollab to convert.\n */\nfunction clientVersionToFieldBatchVersion(\n\tclientVersion: MinimumVersionForCollab,\n): FieldBatchFormatVersion {\n\treturn brand(\n\t\tgetConfigForMinVersionForCollab(clientVersion, {\n\t\t\t[lowestMinVersionForCollab]: FieldBatchFormatVersion.v1,\n\t\t\t[FluidClientVersion.v2_73]: FieldBatchFormatVersion.v2,\n\t\t}),\n\t);\n}\n\nexport function makeFieldBatchCodec(options: CodecWriteOptions): FieldBatchCodec {\n\tconst writeVersion = clientVersionToFieldBatchVersion(options.minVersionForCollab);\n\t// Note: it's important that the decode function is schema-agnostic for this strategy/layering to work, since\n\t// the schema that an op was encoded in doesn't necessarily match the current schema for the document (e.g. if\n\t// decode is being run on a client that just submitted a schema change, but the op is from another client who has\n\t// yet to receive that change).\n\tassert(\n\t\tvalidVersions.has(writeVersion),\n\t\t0x935 /* Invalid write version for FieldBatch codec */,\n\t);\n\n\tlet uncompressedEncodeFn: typeof uncompressedEncodeV1 | typeof uncompressedEncodeV2;\n\tlet schemaCompressedEncodeFn:\n\t\t| typeof schemaCompressedEncodeV1\n\t\t| typeof schemaCompressedEncodeV2;\n\tlet encodedFieldBatchType: typeof EncodedFieldBatchV1 | typeof EncodedFieldBatchV2;\n\tswitch (writeVersion) {\n\t\tcase unbrand(FieldBatchFormatVersion.v1): {\n\t\t\tuncompressedEncodeFn = uncompressedEncodeV1;\n\t\t\tschemaCompressedEncodeFn = schemaCompressedEncodeV1;\n\t\t\tencodedFieldBatchType = EncodedFieldBatchV1;\n\t\t\tbreak;\n\t\t}\n\t\tcase unbrand(FieldBatchFormatVersion.v2): {\n\t\t\tuncompressedEncodeFn = uncompressedEncodeV2;\n\t\t\tschemaCompressedEncodeFn = schemaCompressedEncodeV2;\n\t\t\tencodedFieldBatchType = EncodedFieldBatchV2;\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tunreachableCase(writeVersion);\n\t\t}\n\t}\n\n\treturn makeVersionedValidatedCodec(options, validVersions, encodedFieldBatchType, {\n\t\tencode: (data: FieldBatch, context: FieldBatchEncodingContext): EncodedFieldBatch => {\n\t\t\tfor (const cursor of data) {\n\t\t\t\tassert(\n\t\t\t\t\tcursor.mode === CursorLocationType.Fields,\n\t\t\t\t\t0x8a3 /* FieldBatch expects fields cursors */,\n\t\t\t\t);\n\t\t\t}\n\t\t\tlet encoded: EncodedFieldBatch;\n\t\t\tlet incrementalEncoder: IncrementalEncoder | undefined;\n\t\t\tswitch (context.encodeType) {\n\t\t\t\tcase TreeCompressionStrategy.Uncompressed: {\n\t\t\t\t\tencoded = uncompressedEncodeFn(data);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase TreeCompressionStrategy.CompressedIncremental: {\n\t\t\t\t\tassert(\n\t\t\t\t\t\twriteVersion >= FieldBatchFormatVersion.v2,\n\t\t\t\t\t\t0xca0 /* Unsupported FieldBatchFormatVersion for incremental encoding; must be v2 or higher */,\n\t\t\t\t\t);\n\t\t\t\t\t// Incremental encoding is only supported for CompressedIncremental.\n\t\t\t\t\tincrementalEncoder = context.incrementalEncoderDecoder;\n\t\t\t\t}\n\t\t\t\t// fallthrough\n\t\t\t\tcase TreeCompressionStrategy.Compressed: {\n\t\t\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\t\t\tif (context.schema === undefined) {\n\t\t\t\t\t\t// TODO: consider enabling a somewhat compressed but not schema accelerated encode.\n\t\t\t\t\t\tencoded = uncompressedEncodeFn(data);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tencoded = schemaCompressedEncodeFn(\n\t\t\t\t\t\t\tcontext.schema.schema,\n\t\t\t\t\t\t\tcontext.schema.policy,\n\t\t\t\t\t\t\tdata,\n\t\t\t\t\t\t\tcontext.idCompressor,\n\t\t\t\t\t\t\tincrementalEncoder,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tunreachableCase(context.encodeType);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// TODO: consider checking input data was in schema.\n\t\t\treturn encoded;\n\t\t},\n\t\tdecode: (data: EncodedFieldBatch, context: FieldBatchEncodingContext): FieldBatch => {\n\t\t\t// TODO: consider checking data is in schema.\n\t\t\treturn decode(\n\t\t\t\tdata,\n\t\t\t\t{\n\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\toriginatorId: context.originatorId,\n\t\t\t\t},\n\t\t\t\tcontext.incrementalEncoderDecoder,\n\t\t\t).map((chunk) => chunk.cursor());\n\t\t},\n\t});\n}\n\nexport function getCodecTreeForFieldBatchFormat(\n\tclientVersion: MinimumVersionForCollab,\n): CodecTree {\n\treturn { name: \"FieldBatch\", version: clientVersionToFieldBatchVersion(clientVersion) };\n}\n"]}
@@ -6,9 +6,9 @@ import type { IIdCompressor } from "@fluidframework/id-compressor";
6
6
  import { type FieldKey, type FieldKindData, type FieldKindIdentifier, type ITreeCursorSynchronous, type TreeFieldStoredSchema, type TreeNodeSchemaIdentifier, type Value } from "../../../core/index.js";
7
7
  import type { Counter, DeduplicationTable } from "./chunkCodecUtilities.js";
8
8
  import { type BufferFormat as BufferFormatGeneric, Shape as ShapeGeneric } from "./chunkEncodingGeneric.js";
9
+ import type { IncrementalEncoder } from "./codecs.js";
9
10
  import type { FieldBatch } from "./fieldBatch.js";
10
11
  import { type EncodedChunkShape, type EncodedFieldBatch, type EncodedValueShape, FieldBatchFormatVersion } from "./format.js";
11
- import type { IncrementalEncoder } from "./codecs.js";
12
12
  /**
13
13
  * Encode data from `FieldBatch` into an `EncodedFieldBatch`.
14
14
  *
@@ -1 +1 @@
1
- {"version":3,"file":"compressedEncode.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/compressedEncode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAEN,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAE3B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,KAAK,EAEV,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EACN,KAAK,YAAY,IAAI,mBAAmB,EACxC,KAAK,IAAI,YAAY,EAErB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAEN,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EAEtB,KAAK,iBAAiB,EACtB,uBAAuB,EAEvB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,C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Y,CAAC;AAElB;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAC/B,YAAY,EAAE,kBAAkB,EAChC,UAAU,EAAE,wBAAwB,KAChC,WAAW,CAAC"}
1
+ {"version":3,"file":"compressedEncode.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/compressedEncode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAEN,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAE3B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,KAAK,EAEV,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EACN,KAAK,YAAY,IAAI,mBAAmB,EACxC,KAAK,IAAI,YAAY,EAErB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAEN,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EAEtB,KAAK,iBAAiB,EACtB,uBAAuB,EAEvB,MAAM,aAAa,CAAC;AAErB;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC/B,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,cAAc,GACrB,iBAAiB,CAUnB;AAED,MAAM,MAAM,YAAY,GAAG,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;AAClE,MAAM,MAAM,KAAK,GAAG,YAAY,CAAC,iBAAiB,CAAC,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,YAAY,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AC,mBAAmB,EAAE,aAAa,CAAC;aAC5D,YAAY,EAAE,aAAa;IAC3C;;;;OAIG;aACa,kBAAkB,EAAE,kBAAkB,GAAG,SAAS;aAClD,OAAO,EAAE,uBAAuB;IAdjD,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAC5B;IACX,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAmD;gBAErE,qBAAqB,EAAE,iBAAiB,EACxC,sBAAsB,EAAE,kBAAkB,EAC3C,WAAW,EAAE,WAAW,CAAC,mBAAmB,EAAE,aAAa,CAAC,EAC5D,YAAY,EAAE,aAAa;IAC3C;;;;OAIG;IACa,kBAAkB,EAAE,kBAAkB,GAAG,SAAS,EAClD,OAAO,EAAE,uBAAuB;IAG1C,qBAAqB,CAAC,UAAU,EAAE,wBAAwB,GAAG,WAAW;IAMxE,sBAAsB,CAAC,WAAW,EAAE,qBAAqB,GAAG,YAAY;IAIxE,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,kBAAkB;CAGjE;AAED,MAAM,WAAW,iBAAiB;IACjC,qBAAqB,CAAC,UAAU,EAAE,wBAAwB,GAAG,WAAW,CAAC;CACzE;AAED,MAAM,WAAW,kBAAkB;IAClC,sBAAsB,CAAC,MAAM,EAAE,qBAAqB,GAAG,YAAY,CAAC;CACpE;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAChC,WAAW,EAAE,iBAAiB,EAC9B,MAAM,EAAE,qBAAqB,KACzB,YAAY,CAAC;AAElB;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAC/B,YAAY,EAAE,kBAAkB,EAChC,UAAU,EAAE,wBAAwB,KAChC,WAAW,CAAC"}
@@ -326,6 +326,7 @@ class LazyFieldEncoder {
326
326
  this.encoder.encodeField(cursor, context, outputBuffer);
327
327
  }
328
328
  get encoder() {
329
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- using ??= could change behavior if value is falsy
329
330
  if (this.encoderLazy === undefined) {
330
331
  this.encoderLazy = this.fieldEncoderFromPolicy(this.nodeBuilder, this.fieldSchema);
331
332
  }
@@ -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;AAEnC,OAAO,EAMN,uBAAuB,EACvB,YAAY,GACZ,MAAM,aAAa,CAAC;AAGrB;;;;;;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,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,2BAAsB,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,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 { 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\";\nimport type { IncrementalEncoder } from \"./codecs.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\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/compressedEncode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE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,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 +1 @@
1
- {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/format.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAUtD,OAAO,EAAc,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEjE;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;CAGlC,CAAC;AACH,MAAM,MAA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EG;;;YArJH;;eAEG;;;QAqJH;;WAEG;;YA3CH;;eAEG;;;YAGH;;;;eAIG;;YAEH;;;eAGG;;;QA+BH;;WAEG;;QAEH;;WAEG;;;;;;;;QAlBH;;WAEG;;QAEH;;WAEG;;;YArJH;;eAEG;;;QAqJH;;WAEG;;YA3CH;;eAEG;;;YAGH;;;;eAIG;;YAEH;;;eAGG;;;QA+BH;;WAEG;;QAEH;;WAEG;;;IA0BkF,CAAC;AACxF,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -4,8 +4,8 @@
4
4
  */
5
5
  import { Type } from "@sinclair/typebox";
6
6
  import { unionOptions } from "../../../codec/index.js";
7
- import { Count, EncodedFieldBatchGeneric, IdentifierOrIndex, ShapeIndex, } from "./formatGeneric.js";
8
7
  import { strictEnum } from "../../../util/index.js";
8
+ import { Count, EncodedFieldBatchGeneric, IdentifierOrIndex, ShapeIndex, } from "./formatGeneric.js";
9
9
  /**
10
10
  * The format version for the field batch.
11
11
  */
@@ -1 +1 @@
1
- {"version":3,"file":"format.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/format.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EACN,KAAK,EACL,wBAAwB,EACxB,iBAAiB,EACjB,UAAU,GACV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAe,MAAM,wBAAwB,CAAC;AAEjE;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAAC,yBAAyB,EAAE;IAC5E,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;CACL,CAAC,CAAC;AAGH,0DAA0D;AAC1D,mEAAmE;AACnE,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,C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,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC;IACjC;;OAEG;IACH,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,4BAA4B,CAAC;CAC9C,EACD,YAAY,CACZ,CAAC;AAUF,MAAM,CAAC,MAAM,mBAAmB,GAAG,wBAAwB,CAC1D,uBAAuB,CAAC,EAAE,EAC1B,iBAAiB,CACjB,CAAC;AAGF,MAAM,CAAC,MAAM,mBAAmB,GAAG,wBAAwB,CAC1D,uBAAuB,CAAC,EAAE,EAC1B,iBAAiB,CACjB,CAAC;AAGF,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,CAAC,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 {\n\tCount,\n\tEncodedFieldBatchGeneric,\n\tIdentifierOrIndex,\n\tShapeIndex,\n} from \"./formatGeneric.js\";\nimport { strictEnum, type Values } from \"../../../util/index.js\";\n\n/**\n * The format version for the field batch.\n */\nexport const FieldBatchFormatVersion = strictEnum(\"FieldBatchFormatVersion\", {\n\tv1: 1,\n\tv2: 2,\n});\nexport type FieldBatchFormatVersion = Values<typeof FieldBatchFormatVersion>;\n\n// Compatible versions used for format/version validation.\n// TODO: A proper version update policy will need to be documented.\nexport const validVersions = new Set([...Object.values(FieldBatchFormatVersion)]);\n\n/**\n * Top level length is implied from length of data array.\n * All content are of this shape.\n */\nexport const EncodedNestedArrayShape = ShapeIndex;\n\n/**\n * Inline array.\n */\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 const EncodedAnyShape = Type.Literal(0);\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 const EncodedIncrementalChunkShape = 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 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\nexport type EncodedFieldShape = Static<typeof EncodedFieldShape>;\n\nenum CounterRelativeTo {\n\t// Relative to previous node of same type in depth first pre-order traversal.\n\tPreviousNodeOfType_DepthFirstPreOrder,\n\t// TODO: add alternative relative mode relative to previous note at a path to allow delta encoded sequences (like points where x and y are delta encoded relative to previous points).\n}\n\nenum CounterMode {\n\tNumber,\n\t// TODO: document wrap modes and bit skipping. Note UUID subVersion here (ex: UUIDv4)\n\tUUID,\n}\n\n/**\n * Delta encoded value relative to a previous node's value.\n */\nexport const EncodedCounter = Type.Object(\n\t{\n\t\trelativeTo: Type.Enum(CounterRelativeTo),\n\t\t// If not provided, delta inline in data.\n\t\tdelta: Type.Optional(Type.Number()),\n\t\tmode: Type.Enum(CounterMode),\n\t},\n\t{ additionalProperties: false },\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\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 * 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 */\nexport const EncodedChunkShape = Type.Object(\n\t{\n\t\t/**\n\t\t * {@link EncodedNestedArrayShape} union member.\n\t\t */\n\t\ta: Type.Optional(EncodedNestedArrayShape),\n\t\t/**\n\t\t * {@link EncodedInlineArrayShape} union member.\n\t\t */\n\t\tb: Type.Optional(EncodedInlineArrayShape),\n\t\t/**\n\t\t * {@link EncodedNodeShape} union member.\n\t\t */\n\t\tc: Type.Optional(EncodedNodeShape),\n\t\t/**\n\t\t * {@link EncodedAnyShape} union member.\n\t\t */\n\t\td: Type.Optional(EncodedAnyShape),\n\t\t/**\n\t\t * {@link EncodedIncrementalChunkShape} union member.\n\t\t */\n\t\te: Type.Optional(EncodedIncrementalChunkShape),\n\t},\n\tunionOptions,\n);\n\nexport type EncodedChunkShape = Static<typeof EncodedChunkShape>;\n\nexport type EncodedNestedArrayShape = Static<typeof EncodedNestedArrayShape>;\nexport type EncodedInlineArrayShape = Static<typeof EncodedInlineArrayShape>;\nexport type EncodedNodeShape = Static<typeof EncodedNodeShape>;\nexport type EncodedAnyShape = Static<typeof EncodedAnyShape>;\nexport type EncodedIncrementalChunkShape = Static<typeof EncodedIncrementalChunkShape>;\n\nexport const EncodedFieldBatchV1 = EncodedFieldBatchGeneric(\n\tFieldBatchFormatVersion.v1,\n\tEncodedChunkShape,\n);\nexport type EncodedFieldBatchV1 = Static<typeof EncodedFieldBatchV1>;\n\nexport const EncodedFieldBatchV2 = EncodedFieldBatchGeneric(\n\tFieldBatchFormatVersion.v2,\n\tEncodedChunkShape,\n);\nexport type EncodedFieldBatchV2 = Static<typeof EncodedFieldBatchV2>;\n\nexport const EncodedFieldBatch = Type.Union([EncodedFieldBatchV1, EncodedFieldBatchV2]);\nexport type EncodedFieldBatch = Static<typeof EncodedFieldBatch>;\n"]}
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/format.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,y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C;CACtC,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAC/B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAC3C;IACC;;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;IACjC;;OAEG;IACH,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,4BAA4B,CAAC;CAC9C,EACD,YAAY,CACZ,CAAC;AAUF,MAAM,CAAC,MAAM,mBAAmB,GAAG,wBAAwB,CAC1D,uBAAuB,CAAC,EAAE,EAC1B,iBAAiB,CACjB,CAAC;AAGF,MAAM,CAAC,MAAM,mBAAmB,GAAG,wBAAwB,CAC1D,uBAAuB,CAAC,EAAE,EAC1B,iBAAiB,CACjB,CAAC;AAGF,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,CAAC,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\";\nimport { strictEnum, type Values } from \"../../../util/index.js\";\n\nimport {\n\tCount,\n\tEncodedFieldBatchGeneric,\n\tIdentifierOrIndex,\n\tShapeIndex,\n} from \"./formatGeneric.js\";\n\n/**\n * The format version for the field batch.\n */\nexport const FieldBatchFormatVersion = strictEnum(\"FieldBatchFormatVersion\", {\n\tv1: 1,\n\tv2: 2,\n});\nexport type FieldBatchFormatVersion = Values<typeof FieldBatchFormatVersion>;\n\n// Compatible versions used for format/version validation.\n// TODO: A proper version update policy will need to be documented.\nexport const validVersions = new Set([...Object.values(FieldBatchFormatVersion)]);\n\n/**\n * Top level length is implied from length of data array.\n * All content are of this shape.\n */\nexport const EncodedNestedArrayShape = ShapeIndex;\n\n/**\n * Inline array.\n */\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 const EncodedAnyShape = Type.Literal(0);\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 const EncodedIncrementalChunkShape = 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 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\nexport type EncodedFieldShape = Static<typeof EncodedFieldShape>;\n\nenum CounterRelativeTo {\n\t// Relative to previous node of same type in depth first pre-order traversal.\n\tPreviousNodeOfType_DepthFirstPreOrder,\n\t// TODO: add alternative relative mode relative to previous note at a path to allow delta encoded sequences (like points where x and y are delta encoded relative to previous points).\n}\n\nenum CounterMode {\n\tNumber,\n\t// TODO: document wrap modes and bit skipping. Note UUID subVersion here (ex: UUIDv4)\n\tUUID,\n}\n\n/**\n * Delta encoded value relative to a previous node's value.\n */\nexport const EncodedCounter = Type.Object(\n\t{\n\t\trelativeTo: Type.Enum(CounterRelativeTo),\n\t\t// If not provided, delta inline in data.\n\t\tdelta: Type.Optional(Type.Number()),\n\t\tmode: Type.Enum(CounterMode),\n\t},\n\t{ additionalProperties: false },\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\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 * 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 */\nexport const EncodedChunkShape = Type.Object(\n\t{\n\t\t/**\n\t\t * {@link EncodedNestedArrayShape} union member.\n\t\t */\n\t\ta: Type.Optional(EncodedNestedArrayShape),\n\t\t/**\n\t\t * {@link EncodedInlineArrayShape} union member.\n\t\t */\n\t\tb: Type.Optional(EncodedInlineArrayShape),\n\t\t/**\n\t\t * {@link EncodedNodeShape} union member.\n\t\t */\n\t\tc: Type.Optional(EncodedNodeShape),\n\t\t/**\n\t\t * {@link EncodedAnyShape} union member.\n\t\t */\n\t\td: Type.Optional(EncodedAnyShape),\n\t\t/**\n\t\t * {@link EncodedIncrementalChunkShape} union member.\n\t\t */\n\t\te: Type.Optional(EncodedIncrementalChunkShape),\n\t},\n\tunionOptions,\n);\n\nexport type EncodedChunkShape = Static<typeof EncodedChunkShape>;\n\nexport type EncodedNestedArrayShape = Static<typeof EncodedNestedArrayShape>;\nexport type EncodedInlineArrayShape = Static<typeof EncodedInlineArrayShape>;\nexport type EncodedNodeShape = Static<typeof EncodedNodeShape>;\nexport type EncodedAnyShape = Static<typeof EncodedAnyShape>;\nexport type EncodedIncrementalChunkShape = Static<typeof EncodedIncrementalChunkShape>;\n\nexport const EncodedFieldBatchV1 = EncodedFieldBatchGeneric(\n\tFieldBatchFormatVersion.v1,\n\tEncodedChunkShape,\n);\nexport type EncodedFieldBatchV1 = Static<typeof EncodedFieldBatchV1>;\n\nexport const EncodedFieldBatchV2 = EncodedFieldBatchGeneric(\n\tFieldBatchFormatVersion.v2,\n\tEncodedChunkShape,\n);\nexport type EncodedFieldBatchV2 = Static<typeof EncodedFieldBatchV2>;\n\nexport const EncodedFieldBatch = Type.Union([EncodedFieldBatchV1, EncodedFieldBatchV2]);\nexport type EncodedFieldBatch = Static<typeof EncodedFieldBatch>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"formatGeneric.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/formatGeneric.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAQ,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE3D;;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"}
1
+ {"version":3,"file":"formatGeneric.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/formatGeneric.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAQ,MAAM,mBAA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G,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\";\nimport type { FieldBatchFormatVersion } from \"./format.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"]}
1
+ {"version":3,"file":"formatGeneric.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/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 \"./format.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"]}
@@ -4,10 +4,10 @@
4
4
  */
5
5
  import type { IIdCompressor } from "@fluidframework/id-compressor";
6
6
  import { type StoredSchemaCollection, type TreeFieldStoredSchema, type TreeNodeSchemaIdentifier, type SchemaPolicy } from "../../../core/index.js";
7
+ import type { IncrementalEncoder } from "./codecs.js";
7
8
  import { EncoderContext, type FieldEncoder, type FieldEncodeBuilder, type NodeEncodeBuilder } from "./compressedEncode.js";
8
9
  import type { FieldBatch } from "./fieldBatch.js";
9
10
  import { type EncodedFieldBatchV1, type EncodedFieldBatchV2, FieldBatchFormatVersion } from "./format.js";
10
- import type { IncrementalEncoder } from "./codecs.js";
11
11
  import { NodeShapeBasedEncoder } from "./nodeEncoder.js";
12
12
  /**
13
13
  * Encode data from `fieldBatch` in into an `EncodedChunk` using {@link FieldBatchFormatVersion.v1}.
@@ -1 +1 @@
1
- {"version":3,"file":"schemaBasedEncode.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAIN,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAI7B,KAAK,YAAY,EACjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACN,cAAc,EACd,KAAK,YAAY,EACjB,KAAK,kBAAkB,EAEvB,KAAK,iBAAiB,EAKtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAEN,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EAExB,uBAAuB,EAEvB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAIzD;;;;GAIG;AACH,wBAAgB,wBAAwB,CACvC,MAAM,EAAE,sBAAsB,EAC9B,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,aAAa,GACzB,mBAAmB,CASrB;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACvC,MAAM,EAAE,sBAAsB,EAC9B,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,aAAa,EAC3B,kBAAkB,EAAE,kBAAkB,GAAG,SAAS,GAChD,mBAAmB,CASrB;AA0BD,wBAAgB,YAAY,CAC3B,YAAY,EAAE,sBAAsB,EACpC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,aAAa,EAC3B,kBAAkB,EAAE,kBAAkB,GAAG,SAAS,EAClD,OAAO,EAAE,uBAAuB,GAC9B,cAAc,CAYhB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC9B,WAAW,EAAE,iBAAiB,EAC9B,KAAK,EAAE,qBAAqB,EAC5B,OAAO,EAAE,cAAc,EACvB,YAAY,EAAE,sBAAsB,GAClC,YAAY,CA8Bd;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC7B,YAAY,EAAE,kBAAkB,EAChC,YAAY,EAAE,sBAAsB,EACpC,UAAU,EAAE,wBAAwB,EACpC,kBAAkB,CAAC,EAAE,kBAAkB,GACrC,qBAAqB,CA4CvB"}
1
+ {"version":3,"file":"schemaBasedEncode.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAIN,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAI7B,KAAK,YAAY,EACjB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EACN,cAAc,EACd,KAAK,YAAY,EACjB,KAAK,kBAAkB,EAEvB,KAAK,iBAAiB,EAKtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAEN,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EAExB,uBAAuB,EAEvB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;;;GAIG;AACH,wBAAgB,wBAAwB,CACvC,MAAM,EAAE,sBAAsB,EAC9B,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,aAAa,GACzB,mBAAmB,CASrB;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACvC,MAAM,EAAE,sBAAsB,EAC9B,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,aAAa,EAC3B,kBAAkB,EAAE,kBAAkB,GAAG,SAAS,GAChD,mBAAmB,CASrB;AA0BD,wBAAgB,YAAY,CAC3B,YAAY,EAAE,sBAAsB,EACpC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,aAAa,EAC3B,kBAAkB,EAAE,kBAAkB,GAAG,SAAS,EAClD,OAAO,EAAE,uBAAuB,GAC9B,cAAc,CAYhB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC9B,WAAW,EAAE,iBAAiB,EAC9B,KAAK,EAAE,qBAAqB,EAC5B,OAAO,EAAE,cAAc,EACvB,YAAY,EAAE,sBAAsB,GAClC,YAAY,CA8Bd;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC7B,YAAY,EAAE,kBAAkB,EAChC,YAAY,EAAE,sBAAsB,EACpC,UAAU,EAAE,wBAAwB,EACpC,kBAAkB,CAAC,EAAE,kBAAkB,GACrC,qBAAqB,CA4CvB"}
@@ -4,11 +4,11 @@
4
4
  */
5
5
  import { assert, unreachableCase, fail } from "@fluidframework/core-utils/internal";
6
6
  import { LeafNodeStoredSchema, MapNodeStoredSchema, ObjectNodeStoredSchema, ValueSchema, Multiplicity, identifierFieldKindIdentifier, } from "../../../core/index.js";
7
+ import { brand, oneFromIterable } from "../../../util/index.js";
7
8
  import { EncoderContext, anyNodeEncoder, asFieldEncoder, compressedEncode, incrementalFieldEncoder, } from "./compressedEncode.js";
8
9
  import { FieldBatchFormatVersion, SpecialField, } from "./format.js";
9
- import { NodeShapeBasedEncoder } from "./nodeEncoder.js";
10
10
  import { defaultIncrementalEncodingPolicy } from "./incrementalEncodingPolicy.js";
11
- import { brand, oneFromIterable } from "../../../util/index.js";
11
+ import { NodeShapeBasedEncoder } from "./nodeEncoder.js";
12
12
  /**
13
13
  * Encode data from `fieldBatch` in into an `EncodedChunk` using {@link FieldBatchFormatVersion.v1}.
14
14
  * @remarks See {@link schemaCompressedEncode} for more details.
@@ -1 +1 @@
1
- {"version":3,"file":"schemaBasedEncode.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAGpF,OAAO,EACN,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EAItB,WAAW,EACX,YAAY,EACZ,6BAA6B,GAE7B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACN,cAAc,EAKd,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,uBAAuB,GACvB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAKN,uBAAuB,EACvB,YAAY,GACZ,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,gCAAgC,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEhE;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CACvC,MAA8B,EAC9B,MAAoB,EACpB,UAAsB,EACtB,YAA2B;IAE3B,OAAO,sBAAsB,CAC5B,MAAM,EACN,MAAM,EACN,UA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AAM,KAAK,GAAG,IAAI,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE,EAAE,YAAY,CAAC,CAAC;QAC7E,OAAO,KAAK,CAAC;IACd,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;AACzC,CAAC;AAED,SAAS,oBAAoB,CAAC,MAA+B;IAC5D,QAAQ,MAAM,EAAE,CAAC;QAChB,KAAK,SAAS,CAAC,CAAC,CAAC;YAChB,OAAO,KAAK,CAAC;QACd,CAAC;QACD,KAAK,WAAW,CAAC,MAAM,CAAC;QACxB,KAAK,WAAW,CAAC,MAAM,CAAC;QACxB,KAAK,WAAW,CAAC,OAAO,CAAC;QACzB,KAAK,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;YAC9B,OAAO,IAAI,CAAC;QACb,CAAC;QACD,KAAK,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;YACvB,OAAO,CAAC,IAAI,CAAC,CAAC;QACf,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACT,eAAe,CAAC,MAAM,CAAC,CAAC;QACzB,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase, fail } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport {\n\tLeafNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\ttype StoredSchemaCollection,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\tValueSchema,\n\tMultiplicity,\n\tidentifierFieldKindIdentifier,\n\ttype SchemaPolicy,\n} from \"../../../core/index.js\";\n\nimport {\n\tEncoderContext,\n\ttype FieldEncoder,\n\ttype FieldEncodeBuilder,\n\ttype KeyedFieldEncoder,\n\ttype NodeEncodeBuilder,\n\tanyNodeEncoder,\n\tasFieldEncoder,\n\tcompressedEncode,\n\tincrementalFieldEncoder,\n} from \"./compressedEncode.js\";\nimport type { FieldBatch } from \"./fieldBatch.js\";\nimport {\n\ttype EncodedFieldBatch,\n\ttype EncodedFieldBatchV1,\n\ttype EncodedFieldBatchV2,\n\ttype EncodedValueShape,\n\tFieldBatchFormatVersion,\n\tSpecialField,\n} from \"./format.js\";\nimport type { IncrementalEncoder } from \"./codecs.js\";\nimport { NodeShapeBasedEncoder } from \"./nodeEncoder.js\";\nimport { defaultIncrementalEncodingPolicy } from \"./incrementalEncodingPolicy.js\";\nimport { brand, oneFromIterable } from \"../../../util/index.js\";\n\n/**\n * Encode data from `fieldBatch` in into an `EncodedChunk` using {@link FieldBatchFormatVersion.v1}.\n * @remarks See {@link schemaCompressedEncode} for more details.\n * This version does not support incremental encoding.\n */\nexport function schemaCompressedEncodeV1(\n\tschema: StoredSchemaCollection,\n\tpolicy: SchemaPolicy,\n\tfieldBatch: FieldBatch,\n\tidCompressor: IIdCompressor,\n): EncodedFieldBatchV1 {\n\treturn schemaCompressedEncode(\n\t\tschema,\n\t\tpolicy,\n\t\tfieldBatch,\n\t\tidCompressor,\n\t\tundefined /* incrementalEncoder */,\n\t\tbrand(FieldBatchFormatVersion.v1),\n\t);\n}\n\n/**\n * Encode data from `fieldBatch` in into an `EncodedChunk` using {@link FieldBatchFormatVersion.v2}.\n * @remarks See {@link schemaCompressedEncode} for more details.\n * Incremental encoding is supported from this version onwards.\n */\nexport function schemaCompressedEncodeV2(\n\tschema: StoredSchemaCollection,\n\tpolicy: SchemaPolicy,\n\tfieldBatch: FieldBatch,\n\tidCompressor: IIdCompressor,\n\tincrementalEncoder: IncrementalEncoder | undefined,\n): EncodedFieldBatchV2 {\n\treturn schemaCompressedEncode(\n\t\tschema,\n\t\tpolicy,\n\t\tfieldBatch,\n\t\tidCompressor,\n\t\tincrementalEncoder,\n\t\tbrand(FieldBatchFormatVersion.v2),\n\t);\n}\n\n/**\n * Encode data from `fieldBatch` in into an `EncodedChunk`.\n * @remarks\n * If `incrementalEncoder` is provided,\n * fields that support incremental encoding will encode their chunks separately via the `incrementalEncoder`.\n * See {@link IncrementalEncoder} for more details.\n *\n * Optimized for encoded size and encoding performance.\n * TODO: This function should eventually also take in the root FieldSchema to more efficiently compress the nodes.\n */\nfunction schemaCompressedEncode(\n\tschema: StoredSchemaCollection,\n\tpolicy: SchemaPolicy,\n\tfieldBatch: FieldBatch,\n\tidCompressor: IIdCompressor,\n\tincrementalEncoder: IncrementalEncoder | undefined,\n\tversion: FieldBatchFormatVersion,\n): EncodedFieldBatch {\n\treturn compressedEncode(\n\t\tfieldBatch,\n\t\tbuildContext(schema, policy, idCompressor, incrementalEncoder, version),\n\t);\n}\n\nexport function buildContext(\n\tstoredSchema: StoredSchemaCollection,\n\tpolicy: SchemaPolicy,\n\tidCompressor: IIdCompressor,\n\tincrementalEncoder: IncrementalEncoder | undefined,\n\tversion: FieldBatchFormatVersion,\n): EncoderContext {\n\tconst context: EncoderContext = new EncoderContext(\n\t\t(fieldBuilder: FieldEncodeBuilder, schemaName: TreeNodeSchemaIdentifier) =>\n\t\t\tgetNodeEncoder(fieldBuilder, storedSchema, schemaName, incrementalEncoder),\n\t\t(nodeBuilder: NodeEncodeBuilder, fieldSchema: TreeFieldStoredSchema) =>\n\t\t\tgetFieldEncoder(nodeBuilder, fieldSchema, context, storedSchema),\n\t\tpolicy.fieldKinds,\n\t\tidCompressor,\n\t\tincrementalEncoder,\n\t\tversion,\n\t);\n\treturn context;\n}\n\n/**\n * Selects an encoder to use to encode fields.\n */\nexport function getFieldEncoder(\n\tnodeBuilder: NodeEncodeBuilder,\n\tfield: TreeFieldStoredSchema,\n\tcontext: EncoderContext,\n\tstoredSchema: StoredSchemaCollection,\n): FieldEncoder {\n\tconst kind = context.fieldShapes.get(field.kind) ?? fail(0xb52 /* missing FieldKind */);\n\tconst type = oneFromIterable(field.types);\n\tconst nodeEncoder =\n\t\ttype === undefined ? anyNodeEncoder : nodeBuilder.nodeEncoderFromSchema(type);\n\tif (kind.multiplicity === Multiplicity.Single) {\n\t\tif (field.kind === identifierFieldKindIdentifier) {\n\t\t\tassert(type !== undefined, 0x999 /* field type must be defined in identifier field */);\n\t\t\tconst nodeSchema = storedSchema.nodeSchema.get(type);\n\t\t\tassert(nodeSchema !== undefined, 0x99a /* nodeSchema must be defined */);\n\t\t\tassert(\n\t\t\t\tnodeSchema instanceof LeafNodeStoredSchema,\n\t\t\t\t0x99b /* nodeSchema must be LeafNodeStoredSchema */,\n\t\t\t);\n\t\t\tassert(\n\t\t\t\tnodeSchema.leafValue === ValueSchema.String,\n\t\t\t\t0x99c /* identifier field can only be type string */,\n\t\t\t);\n\t\t\tconst identifierNodeEncoder = new NodeShapeBasedEncoder(\n\t\t\t\ttype,\n\t\t\t\tSpecialField.Identifier,\n\t\t\t\t[],\n\t\t\t\tundefined,\n\t\t\t);\n\t\t\treturn asFieldEncoder(identifierNodeEncoder);\n\t\t}\n\t\treturn asFieldEncoder(nodeEncoder);\n\t} else {\n\t\treturn context.nestedArrayEncoder(nodeEncoder);\n\t}\n}\n\n/**\n * Selects an encoder to use to encode nodes.\n */\nexport function getNodeEncoder(\n\tfieldBuilder: FieldEncodeBuilder,\n\tstoredSchema: StoredSchemaCollection,\n\tschemaName: TreeNodeSchemaIdentifier,\n\tincrementalEncoder?: IncrementalEncoder,\n): NodeShapeBasedEncoder {\n\tconst shouldEncodeIncrementally =\n\t\tincrementalEncoder?.shouldEncodeIncrementally ?? defaultIncrementalEncodingPolicy;\n\tconst schema =\n\t\tstoredSchema.nodeSchema.get(schemaName) ?? fail(0xb53 /* missing node schema */);\n\n\t// This handles both object and array nodes.\n\tif (schema instanceof ObjectNodeStoredSchema) {\n\t\t// TODO:Performance:\n\t\t// consider moving some optional and sequence fields to extra fields if they are commonly empty\n\t\t// to reduce encoded size.\n\t\tconst objectNodeFields: KeyedFieldEncoder[] = [];\n\t\tfor (const [key, field] of schema.objectNodeFields ?? []) {\n\t\t\tconst fieldEncoder = shouldEncodeIncrementally(schemaName, key)\n\t\t\t\t? incrementalFieldEncoder\n\t\t\t\t: fieldBuilder.fieldEncoderFromSchema(field);\n\t\t\tobjectNodeFields.push({\n\t\t\t\tkey,\n\t\t\t\tencoder: fieldEncoder,\n\t\t\t});\n\t\t}\n\n\t\tconst shape = new NodeShapeBasedEncoder(schemaName, false, objectNodeFields, undefined);\n\t\treturn shape;\n\t}\n\tif (schema instanceof LeafNodeStoredSchema) {\n\t\tconst shape = new NodeShapeBasedEncoder(\n\t\t\tschemaName,\n\t\t\tvalueShapeFromSchema(schema.leafValue),\n\t\t\t[],\n\t\t\tundefined,\n\t\t);\n\t\treturn shape;\n\t}\n\n\t// This handles both maps and record nodes.\n\tif (schema instanceof MapNodeStoredSchema) {\n\t\tconst fieldEncoder = shouldEncodeIncrementally(schemaName)\n\t\t\t? incrementalFieldEncoder\n\t\t\t: fieldBuilder.fieldEncoderFromSchema(schema.mapFields);\n\t\tconst shape = new NodeShapeBasedEncoder(schemaName, false, [], fieldEncoder);\n\t\treturn shape;\n\t}\n\tfail(0xb54 /* unsupported node kind */);\n}\n\nfunction valueShapeFromSchema(schema: ValueSchema | undefined): undefined | EncodedValueShape {\n\tswitch (schema) {\n\t\tcase undefined: {\n\t\t\treturn false;\n\t\t}\n\t\tcase ValueSchema.Number:\n\t\tcase ValueSchema.String:\n\t\tcase ValueSchema.Boolean:\n\t\tcase ValueSchema.FluidHandle: {\n\t\t\treturn true;\n\t\t}\n\t\tcase ValueSchema.Null: {\n\t\t\treturn [null];\n\t\t}\n\t\tdefault: {\n\t\t\tunreachableCase(schema);\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"schemaBasedEncode.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAGpF,OAAO,EACN,oBAAoB,EACpB,mB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AC,CAAC;QACzB,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase, fail } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport {\n\tLeafNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\ttype StoredSchemaCollection,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\tValueSchema,\n\tMultiplicity,\n\tidentifierFieldKindIdentifier,\n\ttype SchemaPolicy,\n} from \"../../../core/index.js\";\nimport { brand, oneFromIterable } from \"../../../util/index.js\";\n\nimport type { IncrementalEncoder } from \"./codecs.js\";\nimport {\n\tEncoderContext,\n\ttype FieldEncoder,\n\ttype FieldEncodeBuilder,\n\ttype KeyedFieldEncoder,\n\ttype NodeEncodeBuilder,\n\tanyNodeEncoder,\n\tasFieldEncoder,\n\tcompressedEncode,\n\tincrementalFieldEncoder,\n} from \"./compressedEncode.js\";\nimport type { FieldBatch } from \"./fieldBatch.js\";\nimport {\n\ttype EncodedFieldBatch,\n\ttype EncodedFieldBatchV1,\n\ttype EncodedFieldBatchV2,\n\ttype EncodedValueShape,\n\tFieldBatchFormatVersion,\n\tSpecialField,\n} from \"./format.js\";\nimport { defaultIncrementalEncodingPolicy } from \"./incrementalEncodingPolicy.js\";\nimport { NodeShapeBasedEncoder } from \"./nodeEncoder.js\";\n\n/**\n * Encode data from `fieldBatch` in into an `EncodedChunk` using {@link FieldBatchFormatVersion.v1}.\n * @remarks See {@link schemaCompressedEncode} for more details.\n * This version does not support incremental encoding.\n */\nexport function schemaCompressedEncodeV1(\n\tschema: StoredSchemaCollection,\n\tpolicy: SchemaPolicy,\n\tfieldBatch: FieldBatch,\n\tidCompressor: IIdCompressor,\n): EncodedFieldBatchV1 {\n\treturn schemaCompressedEncode(\n\t\tschema,\n\t\tpolicy,\n\t\tfieldBatch,\n\t\tidCompressor,\n\t\tundefined /* incrementalEncoder */,\n\t\tbrand(FieldBatchFormatVersion.v1),\n\t);\n}\n\n/**\n * Encode data from `fieldBatch` in into an `EncodedChunk` using {@link FieldBatchFormatVersion.v2}.\n * @remarks See {@link schemaCompressedEncode} for more details.\n * Incremental encoding is supported from this version onwards.\n */\nexport function schemaCompressedEncodeV2(\n\tschema: StoredSchemaCollection,\n\tpolicy: SchemaPolicy,\n\tfieldBatch: FieldBatch,\n\tidCompressor: IIdCompressor,\n\tincrementalEncoder: IncrementalEncoder | undefined,\n): EncodedFieldBatchV2 {\n\treturn schemaCompressedEncode(\n\t\tschema,\n\t\tpolicy,\n\t\tfieldBatch,\n\t\tidCompressor,\n\t\tincrementalEncoder,\n\t\tbrand(FieldBatchFormatVersion.v2),\n\t);\n}\n\n/**\n * Encode data from `fieldBatch` in into an `EncodedChunk`.\n * @remarks\n * If `incrementalEncoder` is provided,\n * fields that support incremental encoding will encode their chunks separately via the `incrementalEncoder`.\n * See {@link IncrementalEncoder} for more details.\n *\n * Optimized for encoded size and encoding performance.\n * TODO: This function should eventually also take in the root FieldSchema to more efficiently compress the nodes.\n */\nfunction schemaCompressedEncode(\n\tschema: StoredSchemaCollection,\n\tpolicy: SchemaPolicy,\n\tfieldBatch: FieldBatch,\n\tidCompressor: IIdCompressor,\n\tincrementalEncoder: IncrementalEncoder | undefined,\n\tversion: FieldBatchFormatVersion,\n): EncodedFieldBatch {\n\treturn compressedEncode(\n\t\tfieldBatch,\n\t\tbuildContext(schema, policy, idCompressor, incrementalEncoder, version),\n\t);\n}\n\nexport function buildContext(\n\tstoredSchema: StoredSchemaCollection,\n\tpolicy: SchemaPolicy,\n\tidCompressor: IIdCompressor,\n\tincrementalEncoder: IncrementalEncoder | undefined,\n\tversion: FieldBatchFormatVersion,\n): EncoderContext {\n\tconst context: EncoderContext = new EncoderContext(\n\t\t(fieldBuilder: FieldEncodeBuilder, schemaName: TreeNodeSchemaIdentifier) =>\n\t\t\tgetNodeEncoder(fieldBuilder, storedSchema, schemaName, incrementalEncoder),\n\t\t(nodeBuilder: NodeEncodeBuilder, fieldSchema: TreeFieldStoredSchema) =>\n\t\t\tgetFieldEncoder(nodeBuilder, fieldSchema, context, storedSchema),\n\t\tpolicy.fieldKinds,\n\t\tidCompressor,\n\t\tincrementalEncoder,\n\t\tversion,\n\t);\n\treturn context;\n}\n\n/**\n * Selects an encoder to use to encode fields.\n */\nexport function getFieldEncoder(\n\tnodeBuilder: NodeEncodeBuilder,\n\tfield: TreeFieldStoredSchema,\n\tcontext: EncoderContext,\n\tstoredSchema: StoredSchemaCollection,\n): FieldEncoder {\n\tconst kind = context.fieldShapes.get(field.kind) ?? fail(0xb52 /* missing FieldKind */);\n\tconst type = oneFromIterable(field.types);\n\tconst nodeEncoder =\n\t\ttype === undefined ? anyNodeEncoder : nodeBuilder.nodeEncoderFromSchema(type);\n\tif (kind.multiplicity === Multiplicity.Single) {\n\t\tif (field.kind === identifierFieldKindIdentifier) {\n\t\t\tassert(type !== undefined, 0x999 /* field type must be defined in identifier field */);\n\t\t\tconst nodeSchema = storedSchema.nodeSchema.get(type);\n\t\t\tassert(nodeSchema !== undefined, 0x99a /* nodeSchema must be defined */);\n\t\t\tassert(\n\t\t\t\tnodeSchema instanceof LeafNodeStoredSchema,\n\t\t\t\t0x99b /* nodeSchema must be LeafNodeStoredSchema */,\n\t\t\t);\n\t\t\tassert(\n\t\t\t\tnodeSchema.leafValue === ValueSchema.String,\n\t\t\t\t0x99c /* identifier field can only be type string */,\n\t\t\t);\n\t\t\tconst identifierNodeEncoder = new NodeShapeBasedEncoder(\n\t\t\t\ttype,\n\t\t\t\tSpecialField.Identifier,\n\t\t\t\t[],\n\t\t\t\tundefined,\n\t\t\t);\n\t\t\treturn asFieldEncoder(identifierNodeEncoder);\n\t\t}\n\t\treturn asFieldEncoder(nodeEncoder);\n\t} else {\n\t\treturn context.nestedArrayEncoder(nodeEncoder);\n\t}\n}\n\n/**\n * Selects an encoder to use to encode nodes.\n */\nexport function getNodeEncoder(\n\tfieldBuilder: FieldEncodeBuilder,\n\tstoredSchema: StoredSchemaCollection,\n\tschemaName: TreeNodeSchemaIdentifier,\n\tincrementalEncoder?: IncrementalEncoder,\n): NodeShapeBasedEncoder {\n\tconst shouldEncodeIncrementally =\n\t\tincrementalEncoder?.shouldEncodeIncrementally ?? defaultIncrementalEncodingPolicy;\n\tconst schema =\n\t\tstoredSchema.nodeSchema.get(schemaName) ?? fail(0xb53 /* missing node schema */);\n\n\t// This handles both object and array nodes.\n\tif (schema instanceof ObjectNodeStoredSchema) {\n\t\t// TODO:Performance:\n\t\t// consider moving some optional and sequence fields to extra fields if they are commonly empty\n\t\t// to reduce encoded size.\n\t\tconst objectNodeFields: KeyedFieldEncoder[] = [];\n\t\tfor (const [key, field] of schema.objectNodeFields ?? []) {\n\t\t\tconst fieldEncoder = shouldEncodeIncrementally(schemaName, key)\n\t\t\t\t? incrementalFieldEncoder\n\t\t\t\t: fieldBuilder.fieldEncoderFromSchema(field);\n\t\t\tobjectNodeFields.push({\n\t\t\t\tkey,\n\t\t\t\tencoder: fieldEncoder,\n\t\t\t});\n\t\t}\n\n\t\tconst shape = new NodeShapeBasedEncoder(schemaName, false, objectNodeFields, undefined);\n\t\treturn shape;\n\t}\n\tif (schema instanceof LeafNodeStoredSchema) {\n\t\tconst shape = new NodeShapeBasedEncoder(\n\t\t\tschemaName,\n\t\t\tvalueShapeFromSchema(schema.leafValue),\n\t\t\t[],\n\t\t\tundefined,\n\t\t);\n\t\treturn shape;\n\t}\n\n\t// This handles both maps and record nodes.\n\tif (schema instanceof MapNodeStoredSchema) {\n\t\tconst fieldEncoder = shouldEncodeIncrementally(schemaName)\n\t\t\t? incrementalFieldEncoder\n\t\t\t: fieldBuilder.fieldEncoderFromSchema(schema.mapFields);\n\t\tconst shape = new NodeShapeBasedEncoder(schemaName, false, [], fieldEncoder);\n\t\treturn shape;\n\t}\n\tfail(0xb54 /* unsupported node kind */);\n}\n\nfunction valueShapeFromSchema(schema: ValueSchema | undefined): undefined | EncodedValueShape {\n\tswitch (schema) {\n\t\tcase undefined: {\n\t\t\treturn false;\n\t\t}\n\t\tcase ValueSchema.Number:\n\t\tcase ValueSchema.String:\n\t\tcase ValueSchema.Boolean:\n\t\tcase ValueSchema.FluidHandle: {\n\t\t\treturn true;\n\t\t}\n\t\tcase ValueSchema.Null: {\n\t\t\treturn [null];\n\t\t}\n\t\tdefault: {\n\t\t\tunreachableCase(schema);\n\t\t}\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"defaultEditBuilder.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/defaultEditBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAEN,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,MAAM,EAGX,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAKN,KAAK,gBAAgB,EAIrB,MAAM,4BAA4B,CAAC;AAWpC,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAEhD;;;;GAIG;AACH,qBAAa,mBACZ,YAAW,YAAY,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;IAE7D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAsB;gBAGnD,MAAM,EAAE,YAAY,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,EAC7D,YAAY,EAAE,iBAAiB;IAKhC,IAAW,OAAO,IAAI,aAAa,CAAC,gBAAgB,CAAC,CAEpD;IAED,IAAW,MAAM,IAA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,7 +7,9 @@ import { UsageError } from "@fluidframework/telemetry-utils/internal";
7
7
  import { compareFieldUpPaths, topDownPath, } from "../../core/index.js";
8
8
  import { brand } from "../../util/index.js";
9
9
  import { ModularChangeFamily, ModularEditBuilder, intoDelta as intoModularDelta, relevantRemovedRoots as relevantModularRemovedRoots, } from "../modular-schema/index.js";
10
- import { fieldKinds, optional, sequence, required as valueFieldKind, } from "./defaultFieldKinds.js";
10
+ import { optional, required } from "../optional-field/index.js";
11
+ import { sequence } from "../sequence-field/index.js";
12
+ import { fieldKinds } from "./defaultFieldKinds.js";
11
13
  /**
12
14
  * Implementation of {@link ChangeFamily} based on the default set of supported field kinds.
13
15
  *
@@ -85,14 +87,14 @@ export class DefaultEditBuilder {
85
87
  const fill = { localId: this.modularBuilder.generateId(), revision };
86
88
  const detach = { localId: this.modularBuilder.generateId(), revision };
87
89
  const build = this.modularBuilder.buildTrees(fill.localId, newContent, revision);
88
- const change = brand(valueFieldKind.changeHandler.editor.set({
90
+ const change = brand(required.changeHandler.editor.set({
89
91
  fill,
90
92
  detach,
91
93
  }));
92
94
  const edit = {
93
95
  type: "field",
94
96
  field,
95
- fieldKind: valueFieldKind.identifier,
97
+ fieldKind: required.identifier,
96
98
  change,
97
99
  revision,
98
100
  };