@fluidframework/tree 2.81.1 → 2.83.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 (695) hide show
  1. package/CHANGELOG.md +168 -0
  2. package/README.md +33 -5
  3. package/api-report/tree.alpha.api.md +75 -39
  4. package/api-report/tree.beta.api.md +164 -3
  5. package/api-report/tree.legacy.beta.api.md +164 -3
  6. package/api-report/tree.legacy.public.api.md +2 -1
  7. package/api-report/tree.public.api.md +2 -1
  8. package/dist/alpha.d.ts +10 -4
  9. package/dist/beta.d.ts +4 -0
  10. package/dist/codec/codec.d.ts +18 -45
  11. package/dist/codec/codec.d.ts.map +1 -1
  12. package/dist/codec/codec.js +12 -50
  13. package/dist/codec/codec.js.map +1 -1
  14. package/dist/codec/index.d.ts +1 -1
  15. package/dist/codec/index.d.ts.map +1 -1
  16. package/dist/codec/index.js +2 -2
  17. package/dist/codec/index.js.map +1 -1
  18. package/dist/codec/versioned/codec.d.ts +20 -7
  19. package/dist/codec/versioned/codec.d.ts.map +1 -1
  20. package/dist/codec/versioned/codec.js +56 -30
  21. package/dist/codec/versioned/codec.js.map +1 -1
  22. package/dist/core/index.d.ts +1 -1
  23. package/dist/core/index.d.ts.map +1 -1
  24. package/dist/core/index.js +4 -2
  25. package/dist/core/index.js.map +1 -1
  26. package/dist/core/rebase/changeRebaser.d.ts +3 -2
  27. package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
  28. package/dist/core/rebase/changeRebaser.js.map +1 -1
  29. package/dist/core/rebase/index.d.ts +1 -1
  30. package/dist/core/rebase/index.d.ts.map +1 -1
  31. package/dist/core/rebase/index.js +4 -2
  32. package/dist/core/rebase/index.js.map +1 -1
  33. package/dist/core/rebase/types.d.ts +23 -3
  34. package/dist/core/rebase/types.d.ts.map +1 -1
  35. package/dist/core/rebase/types.js +30 -16
  36. package/dist/core/rebase/types.js.map +1 -1
  37. package/dist/core/schema-stored/formatV1.d.ts +2 -2
  38. package/dist/core/schema-stored/formatV1.d.ts.map +1 -1
  39. package/dist/core/schema-stored/formatV1.js +0 -5
  40. package/dist/core/schema-stored/formatV1.js.map +1 -1
  41. package/dist/core/schema-stored/formatV2.d.ts +11 -10
  42. package/dist/core/schema-stored/formatV2.d.ts.map +1 -1
  43. package/dist/core/schema-stored/formatV2.js +1 -6
  44. package/dist/core/schema-stored/formatV2.js.map +1 -1
  45. package/dist/core/schema-stored/index.d.ts.map +1 -1
  46. package/dist/core/schema-stored/index.js.map +1 -1
  47. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  48. package/dist/core/schema-stored/schema.js.map +1 -1
  49. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  50. package/dist/core/tree/anchorSet.js.map +1 -1
  51. package/dist/core/tree/delta.d.ts +9 -7
  52. package/dist/core/tree/delta.d.ts.map +1 -1
  53. package/dist/core/tree/delta.js.map +1 -1
  54. package/dist/core/tree/deltaUtil.js +1 -1
  55. package/dist/core/tree/deltaUtil.js.map +1 -1
  56. package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  57. package/dist/core/tree/detachedFieldIndexCodecs.js +6 -4
  58. package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  59. package/dist/core/tree/visitDelta.js +2 -2
  60. package/dist/core/tree/visitDelta.js.map +1 -1
  61. package/dist/extensibleUnionNode.d.ts +97 -0
  62. package/dist/extensibleUnionNode.d.ts.map +1 -0
  63. package/dist/extensibleUnionNode.js +89 -0
  64. package/dist/extensibleUnionNode.js.map +1 -0
  65. package/dist/feature-libraries/changeAtomIdBTree.d.ts +4 -2
  66. package/dist/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
  67. package/dist/feature-libraries/changeAtomIdBTree.js +9 -1
  68. package/dist/feature-libraries/changeAtomIdBTree.js.map +1 -1
  69. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +1 -1
  70. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  71. package/dist/feature-libraries/chunked-forest/codec/codecs.js +4 -4
  72. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  73. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -3
  74. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  75. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +20 -21
  76. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  77. package/dist/feature-libraries/default-schema/index.d.ts +1 -1
  78. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  79. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  80. package/dist/feature-libraries/forest-summary/codec.d.ts +2 -1
  81. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  82. package/dist/feature-libraries/forest-summary/codec.js +7 -1
  83. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  84. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  85. package/dist/feature-libraries/forest-summary/forestSummarizer.js +5 -2
  86. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  87. package/dist/feature-libraries/forest-summary/formatCommon.d.ts +4 -42
  88. package/dist/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
  89. package/dist/feature-libraries/forest-summary/formatCommon.js +1 -2
  90. package/dist/feature-libraries/forest-summary/formatCommon.js.map +1 -1
  91. package/dist/feature-libraries/forest-summary/formatV1.d.ts +2 -41
  92. package/dist/feature-libraries/forest-summary/formatV1.d.ts.map +1 -1
  93. package/dist/feature-libraries/forest-summary/formatV1.js +1 -2
  94. package/dist/feature-libraries/forest-summary/formatV1.js.map +1 -1
  95. package/dist/feature-libraries/forest-summary/formatV2.d.ts +2 -41
  96. package/dist/feature-libraries/forest-summary/formatV2.d.ts.map +1 -1
  97. package/dist/feature-libraries/forest-summary/formatV2.js +1 -2
  98. package/dist/feature-libraries/forest-summary/formatV2.js.map +1 -1
  99. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +1 -1
  100. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  101. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +1 -1
  102. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  103. package/dist/feature-libraries/index.d.ts +3 -3
  104. package/dist/feature-libraries/index.d.ts.map +1 -1
  105. package/dist/feature-libraries/index.js +4 -3
  106. package/dist/feature-libraries/index.js.map +1 -1
  107. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +2 -2
  108. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -1
  109. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js +42 -22
  110. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
  111. package/dist/feature-libraries/modular-schema/genericFieldKind.js +1 -1
  112. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  113. package/dist/feature-libraries/modular-schema/index.d.ts +1 -1
  114. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  115. package/dist/feature-libraries/modular-schema/index.js +2 -1
  116. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  117. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +3 -3
  118. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  119. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +13 -9
  120. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  121. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +11 -1
  122. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  123. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +30 -7
  124. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  125. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  126. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +38 -27
  127. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  128. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +10 -127
  129. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
  130. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js +2 -4
  131. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
  132. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +3 -79
  133. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
  134. package/dist/feature-libraries/optional-field/optionalField.js +1 -1
  135. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  136. package/dist/feature-libraries/optional-field/requiredField.d.ts.map +1 -1
  137. package/dist/feature-libraries/optional-field/requiredField.js.map +1 -1
  138. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -2
  139. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  140. package/dist/feature-libraries/schema-index/codec.js +6 -4
  141. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  142. package/dist/feature-libraries/schema-index/formatV2.d.ts +4 -4
  143. package/dist/feature-libraries/schema-index/schemaSummarizer.js +1 -1
  144. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  145. package/dist/feature-libraries/sequence-field/invert.js +2 -2
  146. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  147. package/dist/feature-libraries/sequence-field/replaceRevisions.js +16 -16
  148. package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  149. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +1 -1
  150. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  151. package/dist/index.d.ts +5 -5
  152. package/dist/index.d.ts.map +1 -1
  153. package/dist/index.js +5 -2
  154. package/dist/index.js.map +1 -1
  155. package/dist/legacy.d.ts +4 -0
  156. package/dist/packageVersion.d.ts +1 -1
  157. package/dist/packageVersion.js +1 -1
  158. package/dist/packageVersion.js.map +1 -1
  159. package/dist/shared-tree/independentView.d.ts +36 -13
  160. package/dist/shared-tree/independentView.d.ts.map +1 -1
  161. package/dist/shared-tree/independentView.js +1 -0
  162. package/dist/shared-tree/independentView.js.map +1 -1
  163. package/dist/shared-tree/index.d.ts +1 -1
  164. package/dist/shared-tree/index.d.ts.map +1 -1
  165. package/dist/shared-tree/index.js.map +1 -1
  166. package/dist/shared-tree/schematizingTreeView.d.ts +10 -0
  167. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  168. package/dist/shared-tree/schematizingTreeView.js +25 -9
  169. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  170. package/dist/shared-tree/sharedTree.d.ts +3 -3
  171. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  172. package/dist/shared-tree/sharedTree.js +8 -32
  173. package/dist/shared-tree/sharedTree.js.map +1 -1
  174. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +11 -3
  175. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  176. package/dist/shared-tree/sharedTreeChangeCodecs.js +39 -5
  177. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  178. package/dist/shared-tree/sharedTreeChangeFormat.d.ts +4 -4
  179. package/dist/shared-tree/tree.d.ts +1 -1
  180. package/dist/shared-tree/tree.js +1 -1
  181. package/dist/shared-tree/tree.js.map +1 -1
  182. package/dist/shared-tree/treeAlpha.d.ts +1 -1
  183. package/dist/shared-tree/treeAlpha.js.map +1 -1
  184. package/dist/shared-tree/treeCheckout.d.ts +20 -0
  185. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  186. package/dist/shared-tree/treeCheckout.js +41 -7
  187. package/dist/shared-tree/treeCheckout.js.map +1 -1
  188. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +3 -3
  189. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  190. package/dist/shared-tree-core/editManagerCodecsCommons.js +2 -2
  191. package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  192. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +2 -2
  193. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  194. package/dist/shared-tree-core/editManagerCodecsV1toV4.js +1 -1
  195. package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  196. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +2 -2
  197. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  198. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js +1 -1
  199. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  200. package/dist/shared-tree-core/editManagerSummarizer.js +1 -1
  201. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  202. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  203. package/dist/shared-tree-core/messageCodecV1ToV4.js +2 -2
  204. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  205. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  206. package/dist/shared-tree-core/messageCodecs.js +2 -2
  207. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  208. package/dist/shared-tree-core/transaction.d.ts +14 -3
  209. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  210. package/dist/shared-tree-core/transaction.js +59 -16
  211. package/dist/shared-tree-core/transaction.js.map +1 -1
  212. package/dist/shared-tree-core/versionedSummarizer.d.ts.map +1 -1
  213. package/dist/shared-tree-core/versionedSummarizer.js +1 -1
  214. package/dist/shared-tree-core/versionedSummarizer.js.map +1 -1
  215. package/dist/simple-tree/api/index.d.ts +2 -2
  216. package/dist/simple-tree/api/index.d.ts.map +1 -1
  217. package/dist/simple-tree/api/index.js +4 -3
  218. package/dist/simple-tree/api/index.js.map +1 -1
  219. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +9 -0
  220. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  221. package/dist/simple-tree/api/schemaCreationUtilities.js +16 -1
  222. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  223. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  224. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +148 -29
  225. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  226. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +180 -99
  227. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  228. package/dist/simple-tree/api/transactionTypes.d.ts +10 -0
  229. package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
  230. package/dist/simple-tree/api/transactionTypes.js.map +1 -1
  231. package/dist/simple-tree/api/tree.d.ts +82 -7
  232. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  233. package/dist/simple-tree/api/tree.js.map +1 -1
  234. package/dist/simple-tree/api/treeBeta.d.ts +1 -1
  235. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  236. package/dist/simple-tree/core/allowedTypes.d.ts +1 -1
  237. package/dist/simple-tree/core/allowedTypes.js.map +1 -1
  238. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  239. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  240. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +1 -0
  241. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  242. package/dist/simple-tree/core/unhydratedFlexTree.js +29 -0
  243. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  244. package/dist/simple-tree/index.d.ts +2 -2
  245. package/dist/simple-tree/index.d.ts.map +1 -1
  246. package/dist/simple-tree/index.js +5 -3
  247. package/dist/simple-tree/index.js.map +1 -1
  248. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  249. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  250. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +63 -0
  251. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  252. package/dist/simple-tree/node-kinds/array/arrayNode.js +47 -14
  253. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  254. package/dist/simple-tree/node-kinds/array/index.d.ts +1 -1
  255. package/dist/simple-tree/node-kinds/array/index.d.ts.map +1 -1
  256. package/dist/simple-tree/node-kinds/array/index.js +2 -1
  257. package/dist/simple-tree/node-kinds/array/index.js.map +1 -1
  258. package/dist/simple-tree/node-kinds/index.d.ts +1 -1
  259. package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
  260. package/dist/simple-tree/node-kinds/index.js +2 -1
  261. package/dist/simple-tree/node-kinds/index.js.map +1 -1
  262. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  263. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  264. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  265. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +33 -7
  266. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  267. package/dist/tableSchema.d.ts +71 -48
  268. package/dist/tableSchema.d.ts.map +1 -1
  269. package/dist/tableSchema.js +200 -98
  270. package/dist/tableSchema.js.map +1 -1
  271. package/dist/text/textDomainFormatted.d.ts +3 -3
  272. package/dist/text/textDomainFormatted.d.ts.map +1 -1
  273. package/dist/text/textDomainFormatted.js +48 -32
  274. package/dist/text/textDomainFormatted.js.map +1 -1
  275. package/dist/util/bTreeUtils.d.ts +30 -4
  276. package/dist/util/bTreeUtils.d.ts.map +1 -1
  277. package/dist/util/bTreeUtils.js +35 -23
  278. package/dist/util/bTreeUtils.js.map +1 -1
  279. package/dist/util/brand.d.ts.map +1 -1
  280. package/dist/util/brand.js.map +1 -1
  281. package/dist/util/brandedMap.d.ts.map +1 -1
  282. package/dist/util/brandedMap.js.map +1 -1
  283. package/dist/util/breakable.d.ts.map +1 -1
  284. package/dist/util/breakable.js +2 -1
  285. package/dist/util/breakable.js.map +1 -1
  286. package/dist/util/index.d.ts +2 -2
  287. package/dist/util/index.d.ts.map +1 -1
  288. package/dist/util/index.js +6 -3
  289. package/dist/util/index.js.map +1 -1
  290. package/dist/util/opaque.d.ts.map +1 -1
  291. package/dist/util/opaque.js.map +1 -1
  292. package/dist/util/rangeMap.d.ts +3 -2
  293. package/dist/util/rangeMap.d.ts.map +1 -1
  294. package/dist/util/rangeMap.js +12 -7
  295. package/dist/util/rangeMap.js.map +1 -1
  296. package/dist/util/readSnapshotBlob.d.ts +1 -1
  297. package/dist/util/readSnapshotBlob.d.ts.map +1 -1
  298. package/dist/util/readSnapshotBlob.js.map +1 -1
  299. package/dist/util/typeCheck.d.ts.map +1 -1
  300. package/dist/util/typeCheck.js.map +1 -1
  301. package/dist/util/utils.d.ts +20 -16
  302. package/dist/util/utils.d.ts.map +1 -1
  303. package/dist/util/utils.js +49 -17
  304. package/dist/util/utils.js.map +1 -1
  305. package/eslint.config.mts +0 -9
  306. package/lib/alpha.d.ts +10 -4
  307. package/lib/beta.d.ts +4 -0
  308. package/lib/codec/codec.d.ts +18 -45
  309. package/lib/codec/codec.d.ts.map +1 -1
  310. package/lib/codec/codec.js +10 -47
  311. package/lib/codec/codec.js.map +1 -1
  312. package/lib/codec/index.d.ts +1 -1
  313. package/lib/codec/index.d.ts.map +1 -1
  314. package/lib/codec/index.js +1 -1
  315. package/lib/codec/index.js.map +1 -1
  316. package/lib/codec/versioned/codec.d.ts +20 -7
  317. package/lib/codec/versioned/codec.d.ts.map +1 -1
  318. package/lib/codec/versioned/codec.js +59 -33
  319. package/lib/codec/versioned/codec.js.map +1 -1
  320. package/lib/core/index.d.ts +1 -1
  321. package/lib/core/index.d.ts.map +1 -1
  322. package/lib/core/index.js +1 -1
  323. package/lib/core/index.js.map +1 -1
  324. package/lib/core/rebase/changeRebaser.d.ts +3 -2
  325. package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
  326. package/lib/core/rebase/changeRebaser.js.map +1 -1
  327. package/lib/core/rebase/index.d.ts +1 -1
  328. package/lib/core/rebase/index.d.ts.map +1 -1
  329. package/lib/core/rebase/index.js +1 -1
  330. package/lib/core/rebase/index.js.map +1 -1
  331. package/lib/core/rebase/types.d.ts +23 -3
  332. package/lib/core/rebase/types.d.ts.map +1 -1
  333. package/lib/core/rebase/types.js +27 -15
  334. package/lib/core/rebase/types.js.map +1 -1
  335. package/lib/core/schema-stored/formatV1.d.ts +2 -2
  336. package/lib/core/schema-stored/formatV1.d.ts.map +1 -1
  337. package/lib/core/schema-stored/formatV1.js +0 -5
  338. package/lib/core/schema-stored/formatV1.js.map +1 -1
  339. package/lib/core/schema-stored/formatV2.d.ts +11 -10
  340. package/lib/core/schema-stored/formatV2.d.ts.map +1 -1
  341. package/lib/core/schema-stored/formatV2.js +1 -6
  342. package/lib/core/schema-stored/formatV2.js.map +1 -1
  343. package/lib/core/schema-stored/index.d.ts.map +1 -1
  344. package/lib/core/schema-stored/index.js +2 -0
  345. package/lib/core/schema-stored/index.js.map +1 -1
  346. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  347. package/lib/core/schema-stored/schema.js.map +1 -1
  348. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  349. package/lib/core/tree/anchorSet.js.map +1 -1
  350. package/lib/core/tree/delta.d.ts +9 -7
  351. package/lib/core/tree/delta.d.ts.map +1 -1
  352. package/lib/core/tree/delta.js.map +1 -1
  353. package/lib/core/tree/deltaUtil.js +1 -1
  354. package/lib/core/tree/deltaUtil.js.map +1 -1
  355. package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  356. package/lib/core/tree/detachedFieldIndexCodecs.js +6 -4
  357. package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  358. package/lib/core/tree/visitDelta.js +2 -2
  359. package/lib/core/tree/visitDelta.js.map +1 -1
  360. package/lib/extensibleUnionNode.d.ts +97 -0
  361. package/lib/extensibleUnionNode.d.ts.map +1 -0
  362. package/lib/extensibleUnionNode.js +86 -0
  363. package/lib/extensibleUnionNode.js.map +1 -0
  364. package/lib/feature-libraries/changeAtomIdBTree.d.ts +4 -2
  365. package/lib/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
  366. package/lib/feature-libraries/changeAtomIdBTree.js +7 -0
  367. package/lib/feature-libraries/changeAtomIdBTree.js.map +1 -1
  368. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +1 -1
  369. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  370. package/lib/feature-libraries/chunked-forest/codec/codecs.js +5 -5
  371. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  372. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -3
  373. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  374. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +4 -5
  375. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  376. package/lib/feature-libraries/default-schema/index.d.ts +1 -1
  377. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  378. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  379. package/lib/feature-libraries/forest-summary/codec.d.ts +2 -1
  380. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  381. package/lib/feature-libraries/forest-summary/codec.js +8 -2
  382. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  383. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  384. package/lib/feature-libraries/forest-summary/forestSummarizer.js +6 -3
  385. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  386. package/lib/feature-libraries/forest-summary/formatCommon.d.ts +4 -42
  387. package/lib/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
  388. package/lib/feature-libraries/forest-summary/formatCommon.js +2 -3
  389. package/lib/feature-libraries/forest-summary/formatCommon.js.map +1 -1
  390. package/lib/feature-libraries/forest-summary/formatV1.d.ts +2 -41
  391. package/lib/feature-libraries/forest-summary/formatV1.d.ts.map +1 -1
  392. package/lib/feature-libraries/forest-summary/formatV1.js +1 -2
  393. package/lib/feature-libraries/forest-summary/formatV1.js.map +1 -1
  394. package/lib/feature-libraries/forest-summary/formatV2.d.ts +2 -41
  395. package/lib/feature-libraries/forest-summary/formatV2.d.ts.map +1 -1
  396. package/lib/feature-libraries/forest-summary/formatV2.js +1 -2
  397. package/lib/feature-libraries/forest-summary/formatV2.js.map +1 -1
  398. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +1 -1
  399. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  400. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +1 -1
  401. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  402. package/lib/feature-libraries/index.d.ts +3 -3
  403. package/lib/feature-libraries/index.d.ts.map +1 -1
  404. package/lib/feature-libraries/index.js +3 -3
  405. package/lib/feature-libraries/index.js.map +1 -1
  406. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +2 -2
  407. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -1
  408. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js +41 -21
  409. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
  410. package/lib/feature-libraries/modular-schema/genericFieldKind.js +1 -1
  411. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  412. package/lib/feature-libraries/modular-schema/index.d.ts +1 -1
  413. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  414. package/lib/feature-libraries/modular-schema/index.js +1 -1
  415. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  416. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +3 -3
  417. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  418. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +14 -10
  419. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  420. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +11 -1
  421. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  422. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +29 -6
  423. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  424. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  425. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +41 -30
  426. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  427. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +10 -127
  428. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
  429. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js +2 -4
  430. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
  431. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +3 -79
  432. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
  433. package/lib/feature-libraries/optional-field/optionalField.js +1 -1
  434. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  435. package/lib/feature-libraries/optional-field/requiredField.d.ts.map +1 -1
  436. package/lib/feature-libraries/optional-field/requiredField.js.map +1 -1
  437. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -2
  438. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  439. package/lib/feature-libraries/schema-index/codec.js +6 -4
  440. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  441. package/lib/feature-libraries/schema-index/formatV2.d.ts +4 -4
  442. package/lib/feature-libraries/schema-index/schemaSummarizer.js +1 -1
  443. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  444. package/lib/feature-libraries/sequence-field/invert.js +2 -2
  445. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  446. package/lib/feature-libraries/sequence-field/replaceRevisions.js +16 -16
  447. package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  448. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +1 -1
  449. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  450. package/lib/index.d.ts +5 -5
  451. package/lib/index.d.ts.map +1 -1
  452. package/lib/index.js +4 -3
  453. package/lib/index.js.map +1 -1
  454. package/lib/legacy.d.ts +4 -0
  455. package/lib/packageVersion.d.ts +1 -1
  456. package/lib/packageVersion.js +1 -1
  457. package/lib/packageVersion.js.map +1 -1
  458. package/lib/shared-tree/independentView.d.ts +36 -13
  459. package/lib/shared-tree/independentView.d.ts.map +1 -1
  460. package/lib/shared-tree/independentView.js +1 -0
  461. package/lib/shared-tree/independentView.js.map +1 -1
  462. package/lib/shared-tree/index.d.ts +1 -1
  463. package/lib/shared-tree/index.d.ts.map +1 -1
  464. package/lib/shared-tree/index.js.map +1 -1
  465. package/lib/shared-tree/schematizingTreeView.d.ts +10 -0
  466. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  467. package/lib/shared-tree/schematizingTreeView.js +25 -9
  468. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  469. package/lib/shared-tree/sharedTree.d.ts +3 -3
  470. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  471. package/lib/shared-tree/sharedTree.js +10 -34
  472. package/lib/shared-tree/sharedTree.js.map +1 -1
  473. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +11 -3
  474. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  475. package/lib/shared-tree/sharedTreeChangeCodecs.js +40 -6
  476. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  477. package/lib/shared-tree/sharedTreeChangeFormat.d.ts +4 -4
  478. package/lib/shared-tree/tree.d.ts +1 -1
  479. package/lib/shared-tree/tree.js +1 -1
  480. package/lib/shared-tree/tree.js.map +1 -1
  481. package/lib/shared-tree/treeAlpha.d.ts +1 -1
  482. package/lib/shared-tree/treeAlpha.js.map +1 -1
  483. package/lib/shared-tree/treeCheckout.d.ts +20 -0
  484. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  485. package/lib/shared-tree/treeCheckout.js +41 -7
  486. package/lib/shared-tree/treeCheckout.js.map +1 -1
  487. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +3 -3
  488. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  489. package/lib/shared-tree-core/editManagerCodecsCommons.js +2 -2
  490. package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  491. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +2 -2
  492. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  493. package/lib/shared-tree-core/editManagerCodecsV1toV4.js +2 -2
  494. package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  495. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +2 -2
  496. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  497. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js +2 -2
  498. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  499. package/lib/shared-tree-core/editManagerSummarizer.js +1 -1
  500. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  501. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  502. package/lib/shared-tree-core/messageCodecV1ToV4.js +2 -2
  503. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  504. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  505. package/lib/shared-tree-core/messageCodecs.js +2 -2
  506. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  507. package/lib/shared-tree-core/transaction.d.ts +14 -3
  508. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  509. package/lib/shared-tree-core/transaction.js +61 -18
  510. package/lib/shared-tree-core/transaction.js.map +1 -1
  511. package/lib/shared-tree-core/versionedSummarizer.d.ts.map +1 -1
  512. package/lib/shared-tree-core/versionedSummarizer.js +1 -1
  513. package/lib/shared-tree-core/versionedSummarizer.js.map +1 -1
  514. package/lib/simple-tree/api/index.d.ts +2 -2
  515. package/lib/simple-tree/api/index.d.ts.map +1 -1
  516. package/lib/simple-tree/api/index.js +2 -2
  517. package/lib/simple-tree/api/index.js.map +1 -1
  518. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +9 -0
  519. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  520. package/lib/simple-tree/api/schemaCreationUtilities.js +14 -0
  521. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  522. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  523. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +148 -29
  524. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  525. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +179 -98
  526. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  527. package/lib/simple-tree/api/transactionTypes.d.ts +10 -0
  528. package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
  529. package/lib/simple-tree/api/transactionTypes.js.map +1 -1
  530. package/lib/simple-tree/api/tree.d.ts +82 -7
  531. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  532. package/lib/simple-tree/api/tree.js.map +1 -1
  533. package/lib/simple-tree/api/treeBeta.d.ts +1 -1
  534. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  535. package/lib/simple-tree/core/allowedTypes.d.ts +1 -1
  536. package/lib/simple-tree/core/allowedTypes.js.map +1 -1
  537. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  538. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  539. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +1 -0
  540. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  541. package/lib/simple-tree/core/unhydratedFlexTree.js +29 -0
  542. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  543. package/lib/simple-tree/index.d.ts +2 -2
  544. package/lib/simple-tree/index.d.ts.map +1 -1
  545. package/lib/simple-tree/index.js +2 -2
  546. package/lib/simple-tree/index.js.map +1 -1
  547. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  548. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  549. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +63 -0
  550. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  551. package/lib/simple-tree/node-kinds/array/arrayNode.js +46 -14
  552. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  553. package/lib/simple-tree/node-kinds/array/index.d.ts +1 -1
  554. package/lib/simple-tree/node-kinds/array/index.d.ts.map +1 -1
  555. package/lib/simple-tree/node-kinds/array/index.js +1 -1
  556. package/lib/simple-tree/node-kinds/array/index.js.map +1 -1
  557. package/lib/simple-tree/node-kinds/index.d.ts +1 -1
  558. package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
  559. package/lib/simple-tree/node-kinds/index.js +1 -1
  560. package/lib/simple-tree/node-kinds/index.js.map +1 -1
  561. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  562. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  563. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  564. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +34 -8
  565. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  566. package/lib/tableSchema.d.ts +71 -48
  567. package/lib/tableSchema.d.ts.map +1 -1
  568. package/lib/tableSchema.js +201 -99
  569. package/lib/tableSchema.js.map +1 -1
  570. package/lib/text/textDomainFormatted.d.ts +3 -3
  571. package/lib/text/textDomainFormatted.d.ts.map +1 -1
  572. package/lib/text/textDomainFormatted.js +30 -14
  573. package/lib/text/textDomainFormatted.js.map +1 -1
  574. package/lib/util/bTreeUtils.d.ts +30 -4
  575. package/lib/util/bTreeUtils.d.ts.map +1 -1
  576. package/lib/util/bTreeUtils.js +33 -22
  577. package/lib/util/bTreeUtils.js.map +1 -1
  578. package/lib/util/brand.d.ts.map +1 -1
  579. package/lib/util/brand.js.map +1 -1
  580. package/lib/util/brandedMap.d.ts.map +1 -1
  581. package/lib/util/brandedMap.js.map +1 -1
  582. package/lib/util/breakable.d.ts.map +1 -1
  583. package/lib/util/breakable.js +2 -1
  584. package/lib/util/breakable.js.map +1 -1
  585. package/lib/util/index.d.ts +2 -2
  586. package/lib/util/index.d.ts.map +1 -1
  587. package/lib/util/index.js +2 -2
  588. package/lib/util/index.js.map +1 -1
  589. package/lib/util/opaque.d.ts.map +1 -1
  590. package/lib/util/opaque.js.map +1 -1
  591. package/lib/util/rangeMap.d.ts +3 -2
  592. package/lib/util/rangeMap.d.ts.map +1 -1
  593. package/lib/util/rangeMap.js +12 -7
  594. package/lib/util/rangeMap.js.map +1 -1
  595. package/lib/util/readSnapshotBlob.d.ts +1 -1
  596. package/lib/util/readSnapshotBlob.d.ts.map +1 -1
  597. package/lib/util/readSnapshotBlob.js.map +1 -1
  598. package/lib/util/typeCheck.d.ts.map +1 -1
  599. package/lib/util/typeCheck.js.map +1 -1
  600. package/lib/util/utils.d.ts +20 -16
  601. package/lib/util/utils.d.ts.map +1 -1
  602. package/lib/util/utils.js +44 -15
  603. package/lib/util/utils.js.map +1 -1
  604. package/package.json +24 -24
  605. package/src/codec/codec.ts +33 -116
  606. package/src/codec/index.ts +2 -3
  607. package/src/codec/versioned/codec.ts +127 -95
  608. package/src/core/index.ts +3 -1
  609. package/src/core/rebase/changeRebaser.ts +3 -2
  610. package/src/core/rebase/index.ts +3 -1
  611. package/src/core/rebase/types.ts +51 -13
  612. package/src/core/schema-stored/formatV1.ts +2 -4
  613. package/src/core/schema-stored/formatV2.ts +9 -7
  614. package/src/core/schema-stored/index.ts +2 -0
  615. package/src/core/schema-stored/schema.ts +4 -1
  616. package/src/core/tree/anchorSet.ts +1 -3
  617. package/src/core/tree/delta.ts +9 -7
  618. package/src/core/tree/deltaUtil.ts +1 -1
  619. package/src/core/tree/detachedFieldIndexCodecs.ts +6 -4
  620. package/src/core/tree/visitDelta.ts +2 -2
  621. package/src/extensibleUnionNode.ts +177 -0
  622. package/src/feature-libraries/changeAtomIdBTree.ts +17 -2
  623. package/src/feature-libraries/chunked-forest/codec/codecs.ts +5 -11
  624. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +5 -6
  625. package/src/feature-libraries/default-schema/index.ts +0 -1
  626. package/src/feature-libraries/forest-summary/codec.ts +15 -9
  627. package/src/feature-libraries/forest-summary/forestSummarizer.ts +15 -3
  628. package/src/feature-libraries/forest-summary/formatCommon.ts +7 -6
  629. package/src/feature-libraries/forest-summary/formatV1.ts +1 -3
  630. package/src/feature-libraries/forest-summary/formatV2.ts +1 -3
  631. package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +4 -5
  632. package/src/feature-libraries/index.ts +3 -2
  633. package/src/feature-libraries/modular-schema/defaultRevisionReplacer.ts +57 -31
  634. package/src/feature-libraries/modular-schema/genericFieldKind.ts +1 -1
  635. package/src/feature-libraries/modular-schema/index.ts +4 -1
  636. package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +12 -12
  637. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +32 -7
  638. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +54 -33
  639. package/src/feature-libraries/modular-schema/modularChangeFormatV1.ts +2 -4
  640. package/src/feature-libraries/optional-field/optionalField.ts +1 -1
  641. package/src/feature-libraries/optional-field/requiredField.ts +2 -4
  642. package/src/feature-libraries/schema-index/codec.ts +7 -5
  643. package/src/feature-libraries/schema-index/schemaSummarizer.ts +1 -1
  644. package/src/feature-libraries/sequence-field/invert.ts +2 -2
  645. package/src/feature-libraries/sequence-field/replaceRevisions.ts +17 -10
  646. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +1 -1
  647. package/src/index.ts +14 -9
  648. package/src/packageVersion.ts +1 -1
  649. package/src/shared-tree/independentView.ts +42 -6
  650. package/src/shared-tree/index.ts +2 -0
  651. package/src/shared-tree/schematizingTreeView.ts +63 -18
  652. package/src/shared-tree/sharedTree.ts +19 -37
  653. package/src/shared-tree/sharedTreeChangeCodecs.ts +45 -11
  654. package/src/shared-tree/tree.ts +2 -2
  655. package/src/shared-tree/treeAlpha.ts +1 -1
  656. package/src/shared-tree/treeCheckout.ts +52 -7
  657. package/src/shared-tree-core/editManagerCodecsCommons.ts +7 -7
  658. package/src/shared-tree-core/editManagerCodecsV1toV4.ts +3 -10
  659. package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +3 -10
  660. package/src/shared-tree-core/editManagerSummarizer.ts +1 -1
  661. package/src/shared-tree-core/messageCodecV1ToV4.ts +4 -3
  662. package/src/shared-tree-core/messageCodecs.ts +2 -6
  663. package/src/shared-tree-core/transaction.ts +125 -23
  664. package/src/shared-tree-core/versionedSummarizer.ts +3 -2
  665. package/src/simple-tree/api/index.ts +3 -2
  666. package/src/simple-tree/api/schemaCreationUtilities.ts +35 -5
  667. package/src/simple-tree/api/simpleTreeIndex.ts +1 -1
  668. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +344 -142
  669. package/src/simple-tree/api/transactionTypes.ts +10 -0
  670. package/src/simple-tree/api/tree.ts +89 -7
  671. package/src/simple-tree/api/treeBeta.ts +1 -1
  672. package/src/simple-tree/core/allowedTypes.ts +1 -1
  673. package/src/simple-tree/core/treeNodeSchema.ts +5 -8
  674. package/src/simple-tree/core/unhydratedFlexTree.ts +43 -1
  675. package/src/simple-tree/index.ts +5 -2
  676. package/src/simple-tree/leafNodeSchema.ts +3 -2
  677. package/src/simple-tree/node-kinds/array/arrayNode.ts +99 -19
  678. package/src/simple-tree/node-kinds/array/index.ts +2 -0
  679. package/src/simple-tree/node-kinds/index.ts +2 -0
  680. package/src/simple-tree/node-kinds/object/objectNode.ts +19 -18
  681. package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +51 -10
  682. package/src/tableSchema.ts +280 -140
  683. package/src/text/textDomainFormatted.ts +37 -17
  684. package/src/util/bTreeUtils.ts +55 -32
  685. package/src/util/brand.ts +4 -12
  686. package/src/util/brandedMap.ts +2 -6
  687. package/src/util/breakable.ts +3 -2
  688. package/src/util/index.ts +9 -3
  689. package/src/util/opaque.ts +2 -6
  690. package/src/util/rangeMap.ts +20 -11
  691. package/src/util/readSnapshotBlob.ts +3 -3
  692. package/src/util/typeCheck.ts +11 -9
  693. package/src/util/utils.ts +57 -28
  694. package/api-extractor-lint.json +0 -4
  695. package/biome.jsonc +0 -4
@@ -7,6 +7,7 @@ import { assert } from "@fluidframework/core-utils/internal";
7
7
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
8
8
 
9
9
  import { EmptyKey } from "../core/index.js";
10
+ import { TreeAlpha } from "../shared-tree/index.js";
10
11
  import {
11
12
  enumFromStrings,
12
13
  eraseSchemaDetails,
@@ -83,25 +84,44 @@ class TextNode
83
84
  length: number,
84
85
  format: Partial<FormattedTextAsTree.CharacterFormat>,
85
86
  ): void {
86
- for (let i = startIndex; i < startIndex + length; i++) {
87
- const atom = this.content[i];
88
- if (atom === undefined) {
89
- throw new UsageError("Index out of bounds while formatting text range.");
90
- }
91
- for (const [key, value] of Object.entries(format) as [
92
- keyof FormattedTextAsTree.CharacterFormat,
93
- unknown,
94
- ][]) {
95
- // Object.entries should only return string keyed enumerable own properties.
96
- // The TypeScript typing does not account for this, and thus this assertion is necessary for this code to compile.
97
- assert(typeof key === "string", "Object.entries returned a non-string key.");
98
- const f = FormattedTextAsTree.CharacterFormat.fields.get(key);
99
- if (f === undefined) {
100
- throw new UsageError(`Unknown format key: ${key}`);
87
+ const branch = TreeAlpha.branch(this);
88
+
89
+ const applyFormatting = (): void => {
90
+ for (let i = startIndex; i < startIndex + length; i++) {
91
+ const atom = this.content[i];
92
+ if (atom === undefined) {
93
+ throw new UsageError("Index out of bounds while formatting text range.");
94
+ }
95
+ for (const [key, value] of Object.entries(format) as [
96
+ keyof FormattedTextAsTree.CharacterFormat,
97
+ unknown,
98
+ ][]) {
99
+ // Object.entries should only return string keyed enumerable own properties.
100
+ // The TypeScript typing does not account for this, and thus this assertion is necessary for this code to compile.
101
+ assert(
102
+ typeof key === "string",
103
+ 0xcc8 /* Object.entries returned a non-string key. */,
104
+ );
105
+ const f = FormattedTextAsTree.CharacterFormat.fields.get(key);
106
+ if (f === undefined) {
107
+ throw new UsageError(`Unknown format key: ${key}`);
108
+ }
109
+ // Ensures that if the input is a node, it is cloned before being inserted into the tree.
110
+ atom.format[key] = TreeBeta.clone(TreeBeta.create(f, value as never)) as never;
101
111
  }
102
- // Ensures that if the input is a node, it is cloned before being inserted into the tree.
103
- atom.format[key] = TreeBeta.clone(TreeBeta.create(f, value as never)) as never;
104
112
  }
113
+ };
114
+
115
+ if (branch === undefined) {
116
+ // If this node does not have a corresponding branch, then it is unhydrated.
117
+ // I.e., it is not part of a collaborative session yet.
118
+ // Therefore, we don't need to run the edits as a transaction.
119
+ applyFormatting();
120
+ } else {
121
+ // Wrap all formatting operations in a single transaction for atomicity.
122
+ branch.runTransaction(() => {
123
+ applyFormatting();
124
+ });
105
125
  }
106
126
  }
107
127
  }
@@ -5,13 +5,14 @@
5
5
 
6
6
  import { debugAssert } from "@fluidframework/core-utils/internal";
7
7
  import { BTree, defaultComparator, type DefaultComparable } from "@tylerbu/sorted-btree-es6";
8
+ // eslint-disable-next-line import-x/no-internal-modules
9
+ import { union } from "@tylerbu/sorted-btree-es6/extended/union";
8
10
 
9
11
  import { brand, type Brand } from "./brand.js";
10
12
 
11
13
  /**
12
14
  * A BTree which uses tuples (arrays) as the key.
13
- * @remarks
14
- * All keys must be the same length.
15
+ * @remarks All keys must be the same length.
15
16
  */
16
17
  export type TupleBTree<K extends readonly DefaultComparable[], V> = Brand<
17
18
  BTree<K, V>,
@@ -20,53 +21,75 @@ export type TupleBTree<K extends readonly DefaultComparable[], V> = Brand<
20
21
 
21
22
  /**
22
23
  * Create a new {@link TupleBTree}.
24
+ * @param comparator - Either a single {@link TupleComparator | comparator} for all pairs of elements in the tuple or a {@link TupleComparators | tuple of comparators} that compares each pair of corresponding elements individually.
25
+ * @param entries - Optional initial entries for the btree.
23
26
  */
24
27
  export function newTupleBTree<const K extends readonly DefaultComparable[], V>(
28
+ comparator: (a: K, b: K) => number,
25
29
  entries?: [K, V][],
26
30
  ): TupleBTree<K, V> {
27
- return brand(new BTree<K, V>(entries, compareTuples));
31
+ return brand(new BTree<K, V>(entries, comparator));
28
32
  }
29
33
 
34
+ /** A comparator which can compare any pair of corresponding elements in the key of a {@link TupleBTree} */
35
+ type TupleComparator<T extends DefaultComparable> = (a: T, b: T) => number;
36
+
37
+ /**
38
+ * A list of comparators for a {@link TupleBTree}.
39
+ * @remarks For each comparator _C_ at index _i_, C compares the pair of corresponding elements at index _i_ in the key of the btree.
40
+ */
41
+ type TupleComparators<T extends readonly DefaultComparable[]> = {
42
+ [P in keyof T]: TupleComparator<T[P]>;
43
+ };
44
+
30
45
  /**
31
46
  * Compares two tuples (arrays) element by element.
32
- * @param arrayA - The first tuple to compare.
33
- * @param arrayB - The second tuple to compare.
34
- * @returns A negative number if arrayA \< arrayB, a positive number if arrayA \> arrayB, or 0 if they are equal.
47
+ * @param a - The first tuple to compare.
48
+ * @param b - The second tuple to compare.
49
+ * @returns The comparison of the first pair of elements at the same index that differ, or 0 if all elements are equal.
50
+ * @remarks The tuples must be the same length and have the same type of elements in the same order.
35
51
  */
36
- function compareTuples(
37
- arrayA: readonly DefaultComparable[],
38
- arrayB: readonly DefaultComparable[],
39
- ): number {
40
- debugAssert(
41
- () =>
42
- arrayA.length === arrayB.length || "compareTuples requires arrays of the same length",
43
- );
44
- for (let i = 0; i < arrayA.length; i++) {
45
- const result = defaultComparator(arrayA[i], arrayB[i]);
46
- if (result !== 0) {
47
- return result;
52
+ export function createTupleComparator<const K extends readonly DefaultComparable[]>(
53
+ compare: TupleComparator<K[number]> | TupleComparators<K> = defaultComparator,
54
+ ): (a: K, b: K) => number {
55
+ return (a: K, b: K): number => {
56
+ debugAssert(
57
+ () => a.length === b.length || "compareTuples requires arrays of the same length",
58
+ );
59
+ const comparators = typeof compare === "function" ? undefined : compare;
60
+ for (let i = 0; i < a.length; i++) {
61
+ const comparator = comparators?.[i] ?? (compare as TupleComparator<K[number]>);
62
+ const result = comparator(a[i], b[i]);
63
+ if (result !== 0) {
64
+ return result;
65
+ }
48
66
  }
49
- }
50
- return 0;
67
+ return 0;
68
+ };
51
69
  }
52
70
 
53
- export function mergeTupleBTrees<K extends readonly DefaultComparable[], V>(
54
- tree1: TupleBTree<K, V> | undefined,
71
+ /**
72
+ * Merge the entries of two {@link TupleBTree}s.
73
+ * @param tree1 - The first btree.
74
+ * @param tree2 - The second btree.
75
+ * This always returns a new btree and does not modify either input.
76
+ * @param preferLeft - If true, colliding keys will use the value from `tree1`, otherwise the value from `tree2` is used.
77
+ */
78
+ export function mergeTupleBTrees<const K extends readonly DefaultComparable[], V>(
79
+ tree1: TupleBTree<K, V>,
55
80
  tree2: TupleBTree<K, V> | undefined,
56
81
  preferLeft = true,
57
82
  ): TupleBTree<K, V> {
58
- if (tree1 === undefined) {
59
- return tree2 === undefined ? newTupleBTree<K, V>() : brand(tree2.clone());
60
- }
61
-
62
- const result: TupleBTree<K, V> = brand(tree1.clone());
63
83
  if (tree2 === undefined) {
64
- return result;
84
+ return brand(tree1.clone());
65
85
  }
66
86
 
67
- for (const [key, value] of tree2.entries()) {
68
- result.set(key, value, !preferLeft);
69
- }
87
+ // Use efficient union operation from sorted-btree 2.x
88
+ const result = union<BTree<K, V>, K, V>(
89
+ tree1 as BTree<K, V>,
90
+ tree2 as BTree<K, V>,
91
+ (_key, val1, val2) => (preferLeft ? val1 : val2),
92
+ );
70
93
 
71
- return result;
94
+ return brand(result);
72
95
  }
package/src/util/brand.ts CHANGED
@@ -82,23 +82,15 @@ export abstract class BrandedType<out ValueType, Name> {
82
82
  * Implementation detail of type branding. Should not be used directly outside this file,
83
83
  * but shows up as part of branded types so API-Extractor requires it to be exported.
84
84
  */
85
- export type ValueFromBranded<T extends BrandedType<unknown, unknown>> = T extends BrandedType<
86
- infer ValueType,
87
- unknown
88
- >
89
- ? ValueType
90
- : never;
85
+ export type ValueFromBranded<T extends BrandedType<unknown, unknown>> =
86
+ T extends BrandedType<infer ValueType, unknown> ? ValueType : never;
91
87
 
92
88
  /**
93
89
  * Implementation detail of type branding. Should not be used directly outside this file,
94
90
  * but shows up as part of branded types so API-Extractor requires it to be exported.
95
91
  */
96
- export type NameFromBranded<T extends BrandedType<unknown, unknown>> = T extends BrandedType<
97
- unknown,
98
- infer Name
99
- >
100
- ? Name
101
- : never;
92
+ export type NameFromBranded<T extends BrandedType<unknown, unknown>> =
93
+ T extends BrandedType<unknown, infer Name> ? Name : never;
102
94
 
103
95
  /**
104
96
  * Adds a type {@link Brand} to a value.
@@ -19,12 +19,8 @@ import { getOrCreate } from "./utils.js";
19
19
  export type BrandedKey<TKey, TContent> = Brand<TKey, ["BrandedKey", Invariant<TContent>]>;
20
20
 
21
21
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
- export type BrandedKeyContent<TKey extends BrandedKey<unknown, any>> = TKey extends BrandedKey<
23
- unknown,
24
- infer TContent
25
- >
26
- ? TContent
27
- : never;
22
+ export type BrandedKeyContent<TKey extends BrandedKey<unknown, any>> =
23
+ TKey extends BrandedKey<unknown, infer TContent> ? TContent : never;
28
24
 
29
25
  /**
30
26
  * A Map where the keys carry the types of values which they correspond to.
@@ -215,7 +215,7 @@ export function breakingClass<Target extends abstract new (...args: any[]) => Wi
215
215
  // Avoiding wrapping the constructor also avoids messing up the displayed name in the debugger.
216
216
  const doNotWrap: Set<string | symbol> = new Set(["constructor"]);
217
217
 
218
- let prototype: object | null = target.prototype;
218
+ let prototype: object | null = target.prototype as object;
219
219
  while (prototype !== null) {
220
220
  for (const key of Reflect.ownKeys(prototype)) {
221
221
  if (!doNotWrap.has(key)) {
@@ -228,7 +228,8 @@ export function breakingClass<Target extends abstract new (...args: any[]) => Wi
228
228
  !isBreaker(descriptor.value)
229
229
  ) {
230
230
  // This does not affect the original class, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor
231
- descriptor.value = breakingMethod(descriptor.value);
231
+ const method = descriptor.value as (...args: unknown[]) => unknown;
232
+ descriptor.value = breakingMethod(method);
232
233
  Object.defineProperty(DecoratedBreakable.prototype, key, descriptor);
233
234
  }
234
235
  }
package/src/util/index.ts CHANGED
@@ -89,14 +89,15 @@ export {
89
89
  objectToMap,
90
90
  invertMap,
91
91
  oneFromIterable,
92
- type Named,
93
- compareNamed,
94
92
  disposeSymbol,
95
93
  type IDisposable,
96
94
  capitalize,
97
95
  assertValidRangeIndices,
98
96
  transformObjectMap,
97
+ compareNumbers,
98
+ comparePartialNumbers,
99
99
  compareStrings,
100
+ comparePartialStrings,
100
101
  find,
101
102
  count,
102
103
  getLast,
@@ -153,7 +154,12 @@ export {
153
154
  breakingClass,
154
155
  } from "./breakable.js";
155
156
 
156
- export { type TupleBTree, newTupleBTree, mergeTupleBTrees } from "./bTreeUtils.js";
157
+ export {
158
+ type TupleBTree,
159
+ newTupleBTree,
160
+ mergeTupleBTrees,
161
+ createTupleComparator,
162
+ } from "./bTreeUtils.js";
157
163
 
158
164
  export { cloneWithReplacements } from "./cloneWithReplacements.js";
159
165
 
@@ -24,12 +24,8 @@ import type { isAny } from "./typeCheck.js";
24
24
  * ```
25
25
  */
26
26
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
- export type Opaque<T extends Brand<any, unknown>> = T extends BrandedType<
28
- infer ValueType,
29
- infer Name
30
- >
31
- ? BrandedType<ValueType, Name>
32
- : never;
27
+ export type Opaque<T extends Brand<any, unknown>> =
28
+ T extends BrandedType<infer ValueType, infer Name> ? BrandedType<ValueType, Name> : never;
33
29
 
34
30
  /**
35
31
  * See {@link extractFromOpaque}.
@@ -5,6 +5,8 @@
5
5
 
6
6
  import { assert, oob } from "@fluidframework/core-utils/internal";
7
7
  import { BTree } from "@tylerbu/sorted-btree-es6";
8
+ // eslint-disable-next-line import-x/no-internal-modules
9
+ import { union } from "@tylerbu/sorted-btree-es6/extended/union";
8
10
 
9
11
  /**
10
12
  * RangeMap represents a mapping from keys of type K to values of type V or undefined.
@@ -171,18 +173,22 @@ export class RangeMap<K, V> {
171
173
  *
172
174
  * @param start - The start of the range to delete (inclusive).
173
175
  * @param length - The length of the range to delete.
176
+ * @returns The number of keys/value pairs deleted (integer between 0 and `length`, inclusive).
174
177
  */
175
- public delete(start: K, length: number): void {
178
+ public delete(start: K, length: number): number {
179
+ let deleteCount = 0;
176
180
  const lastDeleteKey = this.offsetKey(start, length - 1);
177
181
  for (const { start: key, length: entryLength, value } of this.getIntersectingEntries(
178
182
  start,
179
183
  length,
180
184
  )) {
185
+ deleteCount += entryLength;
181
186
  this.tree.delete(key);
182
187
  const lengthBefore = this.subtractKeys(start, key);
183
188
  if (lengthBefore > 0) {
184
189
  // A portion of this entry comes before the deletion range, so we reinsert that portion.
185
190
  this.tree.set(key, { length: lengthBefore, value });
191
+ deleteCount -= lengthBefore;
186
192
  }
187
193
 
188
194
  const lastEntryKey = this.offsetKey(key, entryLength - 1);
@@ -195,8 +201,10 @@ export class RangeMap<K, V> {
195
201
  length: lengthAfter,
196
202
  value: this.offsetValue(value, difference),
197
203
  });
204
+ deleteCount -= lengthAfter;
198
205
  }
199
206
  }
207
+ return deleteCount;
200
208
  }
201
209
 
202
210
  public clone(): RangeMap<K, V> {
@@ -218,12 +226,13 @@ export class RangeMap<K, V> {
218
226
 
219
227
  const merged = new RangeMap<K, V>(a.offsetKey, a.subtractKeys, a.offsetValue);
220
228
 
221
- // TODO: Is there a good pattern that lets us make `tree` readonly?
222
- merged.tree = a.tree.clone();
223
- for (const [key, value] of b.tree.entries()) {
224
- // TODO: Handle key collisions
225
- merged.tree.set(key, value);
226
- }
229
+ merged.tree = union<BTree<K, RangeEntry<V>>, K, RangeEntry<V>>(
230
+ a.tree,
231
+ b.tree,
232
+ (_key, _val1, val2) => {
233
+ return val2;
234
+ },
235
+ );
227
236
 
228
237
  return merged;
229
238
  }
@@ -321,15 +330,15 @@ export interface RangeQueryEntry<K, V> extends RangeQueryResult<K, V> {
321
330
  readonly value: V;
322
331
  }
323
332
 
324
- export function newIntegerRangeMap<V>(): RangeMap<number, V> {
333
+ export function newIntegerRangeMap<V, K extends number = number>(): RangeMap<K, V> {
325
334
  return new RangeMap(offsetInteger, subtractIntegers);
326
335
  }
327
336
 
328
- function offsetInteger(key: number, offset: number): number {
329
- return key + offset;
337
+ function offsetInteger<K extends number>(key: K, offset: number): K {
338
+ return (key + offset) as K;
330
339
  }
331
340
 
332
- function subtractIntegers(a: number, b: number): number {
341
+ function subtractIntegers<K extends number>(a: K, b: K): number {
333
342
  return a - b;
334
343
  }
335
344
 
@@ -14,12 +14,12 @@ import type { JsonCompatible } from "./utils.js";
14
14
  /**
15
15
  * Reads and parses a snapshot blob from storage service.
16
16
  */
17
- export const readAndParseSnapshotBlob = async <T extends JsonCompatible<IFluidHandle>>(
17
+ export const readAndParseSnapshotBlob = async (
18
18
  blobPath: string,
19
19
  service: IChannelStorageService,
20
20
  parse: SummaryElementParser,
21
- ): Promise<T> => {
21
+ ): Promise<JsonCompatible<IFluidHandle>> => {
22
22
  const treeBuffer = await service.readBlob(blobPath);
23
23
  const treeBufferString = bufferToString(treeBuffer, "utf8");
24
- return parse(treeBufferString) as T;
24
+ return parse(treeBufferString) as JsonCompatible<IFluidHandle>;
25
25
  };
@@ -154,22 +154,24 @@ export type isAssignableTo<Source, Destination> = [Source] extends [Destination]
154
154
  /**
155
155
  * Returns a type parameter that is true iff Subset is a strict subset of Superset.
156
156
  */
157
- export type isStrictSubset<Subset, Superset> = isAssignableTo<Subset, Superset> extends false
158
- ? false
159
- : isAssignableTo<Superset, Subset> extends true
157
+ export type isStrictSubset<Subset, Superset> =
158
+ isAssignableTo<Subset, Superset> extends false
160
159
  ? false
161
- : true;
160
+ : isAssignableTo<Superset, Subset> extends true
161
+ ? false
162
+ : true;
162
163
 
163
164
  /**
164
165
  * Returns a type parameter that is true iff A and B are assignable to each other, and neither is any.
165
166
  * This is useful for checking if the output of a type meta-function is the expected type.
166
167
  * @internal
167
168
  */
168
- export type areSafelyAssignable<A, B> = eitherIsAny<A, B> extends true
169
- ? false
170
- : isAssignableTo<A, B> extends true
171
- ? isAssignableTo<B, A>
172
- : false;
169
+ export type areSafelyAssignable<A, B> =
170
+ eitherIsAny<A, B> extends true
171
+ ? false
172
+ : isAssignableTo<A, B> extends true
173
+ ? isAssignableTo<B, A>
174
+ : false;
173
175
 
174
176
  /**
175
177
  * Returns a type parameter that is true iff A is any or B is any.
package/src/util/utils.ts CHANGED
@@ -4,8 +4,7 @@
4
4
  */
5
5
 
6
6
  import { assert } from "@fluidframework/core-utils/internal";
7
- import { Type } from "@sinclair/typebox";
8
- import structuredClone from "@ungap/structured-clone";
7
+ import { Type, type TUnsafe } from "@sinclair/typebox";
9
8
 
10
9
  /**
11
10
  * Subset of Map interface.
@@ -45,7 +44,7 @@ export function asMutable<T>(readonly: T): Mutable<T> {
45
44
  return readonly as Mutable<T>;
46
45
  }
47
46
 
48
- export const clone = structuredClone;
47
+ export { default as clone } from "@ungap/structured-clone";
49
48
 
50
49
  /**
51
50
  * Checks whether or not the given object is a `readonly` array.
@@ -377,7 +376,8 @@ export type JsonCompatibleReadOnlyObject = { readonly [P in string]?: JsonCompat
377
376
  * expressed using composition of schemas for runtime validation, even if we don't think making the types
378
377
  * generic is worth the maintenance cost.
379
378
  */
380
- export const JsonCompatibleReadOnlySchema = Type.Any();
379
+ export const JsonCompatibleReadOnlySchema =
380
+ Type.Any() as unknown as TUnsafe<JsonCompatibleReadOnly>;
381
381
 
382
382
  /**
383
383
  * Returns if a particular json compatible value is an object.
@@ -471,8 +471,11 @@ export function transformObjectMap<
471
471
  >(
472
472
  objectMap: Record<MapKey, MapValue>,
473
473
  transformer: (value: MapValue, key: MapKey) => NewMapValue,
474
- ): Record<MapKey, MapValue> {
475
- const output: Record<MapKey, MapValue> = Object.create(null);
474
+ ): Record<MapKey, NewMapValue> {
475
+ const output: Record<MapKey, NewMapValue> = Object.create(null) as Record<
476
+ MapKey,
477
+ NewMapValue
478
+ >;
476
479
  // This function must only be used with objects specifically intended to encode map like information.
477
480
  for (const key of Object.keys(objectMap)) {
478
481
  const element = objectMap[key as MapKey];
@@ -500,27 +503,6 @@ export function invertMap<Key, Value>(input: Map<Key, Value>): Map<Value, Key> {
500
503
  return result;
501
504
  }
502
505
 
503
- /**
504
- * Type with a name describing what it is.
505
- * Typically used with values (like schema) that can be stored in a map, but in some representations have their name/key as a field.
506
- */
507
- export interface Named<TName> {
508
- readonly name: TName;
509
- }
510
-
511
- /**
512
- * Order {@link Named} objects by their name.
513
- */
514
- export function compareNamed(a: Named<string>, b: Named<string>): -1 | 0 | 1 {
515
- if (a.name < b.name) {
516
- return -1;
517
- }
518
- if (a.name > b.name) {
519
- return 1;
520
- }
521
- return 0;
522
- }
523
-
524
506
  /**
525
507
  * Placeholder for `Symbol.dispose`.
526
508
  * @privateRemarks
@@ -570,12 +552,59 @@ export function capitalize<S extends string>(s: S): Capitalize<S> {
570
552
  }
571
553
 
572
554
  /**
573
- * Compares strings lexically to form a strict partial ordering.
555
+ * Compares two numbers to form a strict total ordering.
556
+ * @remarks NaN is treated as less than all other numbers and equal to itself.
557
+ * Infinity is considered equal to itself.
574
558
  */
559
+ export function compareNumbers<T extends number>(a: T, b: T): number {
560
+ if (Number.isNaN(a)) {
561
+ return Number.isNaN(b) ? 0 : -1;
562
+ } else if (Number.isNaN(b)) {
563
+ return 1;
564
+ } else if (a === b) {
565
+ return 0; // Infinity - Infinity = NaN (not 0), so use explicit comparison
566
+ }
567
+ return a - b;
568
+ }
569
+
570
+ /**
571
+ * Compares two numbers to form a strict total ordering while allowing for `undefined` values.
572
+ * @remarks `undefined` is considered less than any number and equal to itself.
573
+ * NaN is treated as less than all other numbers (but greater than undefined) and equal to itself.
574
+ */
575
+ export function comparePartialNumbers<T extends number>(
576
+ a: T | undefined,
577
+ b: T | undefined,
578
+ ): number {
579
+ if (a === undefined) {
580
+ return b === undefined ? 0 : -1;
581
+ } else if (b === undefined) {
582
+ return 1;
583
+ }
584
+ return compareNumbers(a, b);
585
+ }
586
+
587
+ /** Compares two strings lexically to form a strict total ordering. */
575
588
  export function compareStrings<T extends string>(a: T, b: T): number {
576
589
  return a > b ? 1 : a === b ? 0 : -1;
577
590
  }
578
591
 
592
+ /**
593
+ * Compares two strings lexically to form a strict total ordering while allowing for `undefined` values.
594
+ * @remarks `undefined` is considered less than any string and equal to itself.
595
+ */
596
+ export function comparePartialStrings<T extends string>(
597
+ a: T | undefined,
598
+ b: T | undefined,
599
+ ): number {
600
+ if (a === undefined) {
601
+ return b === undefined ? 0 : -1;
602
+ } else if (b === undefined) {
603
+ return 1;
604
+ }
605
+ return compareStrings(a, b);
606
+ }
607
+
579
608
  /**
580
609
  * Defines a property on an object that is lazily initialized and cached.
581
610
  * @remarks This is useful for properties that are expensive to compute and it is not guaranteed that they will be accessed.
@@ -1,4 +0,0 @@
1
- {
2
- "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "../../../common/build/build-common/api-extractor-lint.esm.primary.json"
4
- }
package/biome.jsonc DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3
- "extends": ["../../../biome.jsonc"]
4
- }