@fluidframework/tree 2.102.0 → 2.110.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 (495) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/api-report/tree.alpha.api.md +12 -3
  3. package/api-report/tree.beta.api.md +11 -3
  4. package/api-report/tree.legacy.beta.api.md +11 -3
  5. package/dist/codec/versioned/format.d.ts +5 -4
  6. package/dist/codec/versioned/format.d.ts.map +1 -1
  7. package/dist/codec/versioned/format.js +4 -3
  8. package/dist/codec/versioned/format.js.map +1 -1
  9. package/dist/core/rebase/types.d.ts +4 -3
  10. package/dist/core/rebase/types.d.ts.map +1 -1
  11. package/dist/core/rebase/types.js +5 -4
  12. package/dist/core/rebase/types.js.map +1 -1
  13. package/dist/core/schema-stored/formatV1.d.ts +16 -15
  14. package/dist/core/schema-stored/formatV1.d.ts.map +1 -1
  15. package/dist/core/schema-stored/formatV1.js +9 -8
  16. package/dist/core/schema-stored/formatV1.js.map +1 -1
  17. package/dist/core/schema-stored/formatV2.d.ts +29 -28
  18. package/dist/core/schema-stored/formatV2.d.ts.map +1 -1
  19. package/dist/core/schema-stored/formatV2.js +11 -10
  20. package/dist/core/schema-stored/formatV2.js.map +1 -1
  21. package/dist/core/schema-stored/index.js +3 -25
  22. package/dist/core/schema-stored/index.js.map +1 -1
  23. package/dist/core/tree/anchorSet.js +4 -8
  24. package/dist/core/tree/anchorSet.js.map +1 -1
  25. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts +11 -10
  26. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  27. package/dist/core/tree/detachedFieldIndexFormatCommon.js +11 -10
  28. package/dist/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
  29. package/dist/core/tree/detachedFieldIndexFormatV2.d.ts +7 -6
  30. package/dist/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
  31. package/dist/core/tree/detachedFieldIndexFormatV2.js +3 -2
  32. package/dist/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
  33. package/dist/core/tree/persistedTreeTextFormat.d.ts +19 -18
  34. package/dist/core/tree/persistedTreeTextFormat.d.ts.map +1 -1
  35. package/dist/core/tree/persistedTreeTextFormat.js +11 -10
  36. package/dist/core/tree/persistedTreeTextFormat.js.map +1 -1
  37. package/dist/entrypoints/internal.js +2 -15
  38. package/dist/entrypoints/internal.js.map +1 -1
  39. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  40. package/dist/feature-libraries/chunked-forest/chunkTree.js +1 -1
  41. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  42. package/dist/feature-libraries/chunked-forest/chunkedForest.js +7 -11
  43. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  44. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts +13 -12
  45. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -1
  46. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js +14 -13
  47. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -1
  48. package/dist/feature-libraries/chunked-forest/codec/format/formatV1.d.ts +36 -35
  49. package/dist/feature-libraries/chunked-forest/codec/format/formatV1.d.ts.map +1 -1
  50. package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js +19 -18
  51. package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -1
  52. package/dist/feature-libraries/chunked-forest/codec/format/formatV2.d.ts +26 -25
  53. package/dist/feature-libraries/chunked-forest/codec/format/formatV2.d.ts.map +1 -1
  54. package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js +5 -4
  55. package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -1
  56. package/dist/feature-libraries/chunked-forest/codec/format/formatVText.d.ts +24 -23
  57. package/dist/feature-libraries/chunked-forest/codec/format/formatVText.d.ts.map +1 -1
  58. package/dist/feature-libraries/chunked-forest/codec/format/formatVText.js +8 -7
  59. package/dist/feature-libraries/chunked-forest/codec/format/formatVText.js.map +1 -1
  60. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +66 -14
  61. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  62. package/dist/feature-libraries/chunked-forest/uniformChunk.js +101 -36
  63. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  64. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  65. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +36 -14
  66. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  67. package/dist/feature-libraries/flex-tree/lazyEntity.js +9 -19
  68. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  69. package/dist/feature-libraries/flex-tree/lazyNode.js +3 -13
  70. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  71. package/dist/feature-libraries/forest-summary/formatCommon.d.ts +6 -5
  72. package/dist/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
  73. package/dist/feature-libraries/forest-summary/formatCommon.js +4 -3
  74. package/dist/feature-libraries/forest-summary/formatCommon.js.map +1 -1
  75. package/dist/feature-libraries/index.js +2 -24
  76. package/dist/feature-libraries/index.js.map +1 -1
  77. package/dist/feature-libraries/modular-schema/genericFieldKindFormat.d.ts +4 -3
  78. package/dist/feature-libraries/modular-schema/genericFieldKindFormat.d.ts.map +1 -1
  79. package/dist/feature-libraries/modular-schema/genericFieldKindFormat.js +4 -3
  80. package/dist/feature-libraries/modular-schema/genericFieldKindFormat.js.map +1 -1
  81. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  82. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +10 -30
  83. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  84. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +45 -44
  85. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
  86. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js +26 -25
  87. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
  88. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +23 -22
  89. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
  90. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js +7 -6
  91. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -1
  92. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +0 -5
  93. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  94. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  95. package/dist/feature-libraries/object-forest/objectForest.js +11 -55
  96. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  97. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +9 -8
  98. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  99. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.js +9 -8
  100. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.js.map +1 -1
  101. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +14 -13
  102. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  103. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.js +12 -11
  104. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.js.map +1 -1
  105. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +5 -4
  106. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
  107. package/dist/feature-libraries/schema-edits/schemaChangeFormat.js +3 -2
  108. package/dist/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
  109. package/dist/feature-libraries/schema-index/formatV1.d.ts +15 -14
  110. package/dist/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
  111. package/dist/feature-libraries/schema-index/formatV1.js +5 -4
  112. package/dist/feature-libraries/schema-index/formatV1.js.map +1 -1
  113. package/dist/feature-libraries/schema-index/formatV2.d.ts +20 -19
  114. package/dist/feature-libraries/schema-index/formatV2.d.ts.map +1 -1
  115. package/dist/feature-libraries/schema-index/formatV2.js +5 -4
  116. package/dist/feature-libraries/schema-index/formatV2.js.map +1 -1
  117. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  118. package/dist/feature-libraries/sequence-field/compose.js +1 -3
  119. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  120. package/dist/feature-libraries/sequence-field/formatV1.d.ts +283 -282
  121. package/dist/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
  122. package/dist/feature-libraries/sequence-field/formatV1.js +41 -40
  123. package/dist/feature-libraries/sequence-field/formatV1.js.map +1 -1
  124. package/dist/feature-libraries/sequence-field/formatV2.d.ts +180 -179
  125. package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  126. package/dist/feature-libraries/sequence-field/formatV2.js +33 -32
  127. package/dist/feature-libraries/sequence-field/formatV2.js.map +1 -1
  128. package/dist/feature-libraries/sequence-field/formatV3.d.ts +126 -125
  129. package/dist/feature-libraries/sequence-field/formatV3.d.ts.map +1 -1
  130. package/dist/feature-libraries/sequence-field/formatV3.js +5 -4
  131. package/dist/feature-libraries/sequence-field/formatV3.js.map +1 -1
  132. package/dist/index.js +2 -24
  133. package/dist/index.js.map +1 -1
  134. package/dist/packageVersion.d.ts +1 -1
  135. package/dist/packageVersion.js +1 -1
  136. package/dist/packageVersion.js.map +1 -1
  137. package/dist/shared-tree/schematizingTreeView.d.ts +1 -0
  138. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  139. package/dist/shared-tree/schematizingTreeView.js +7 -41
  140. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  141. package/dist/shared-tree/sharedTree.d.ts +2 -3
  142. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  143. package/dist/shared-tree/sharedTree.js +6 -45
  144. package/dist/shared-tree/sharedTree.js.map +1 -1
  145. package/dist/shared-tree/sharedTreeChangeFormat.d.ts +8 -7
  146. package/dist/shared-tree/sharedTreeChangeFormat.d.ts.map +1 -1
  147. package/dist/shared-tree/sharedTreeChangeFormat.js +6 -5
  148. package/dist/shared-tree/sharedTreeChangeFormat.js.map +1 -1
  149. package/dist/shared-tree/treeCheckout.d.ts +14 -5
  150. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  151. package/dist/shared-tree/treeCheckout.js +106 -136
  152. package/dist/shared-tree/treeCheckout.js.map +1 -1
  153. package/dist/shared-tree-core/branch.js +13 -17
  154. package/dist/shared-tree-core/branch.js.map +1 -1
  155. package/dist/shared-tree-core/editManager.d.ts +2 -2
  156. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  157. package/dist/shared-tree-core/editManager.js.map +1 -1
  158. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +35 -34
  159. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  160. package/dist/shared-tree-core/editManagerFormatCommons.js +17 -16
  161. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  162. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +15 -15
  163. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  164. package/dist/shared-tree-core/editManagerFormatV1toV4.js +11 -10
  165. package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  166. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +40 -40
  167. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
  168. package/dist/shared-tree-core/editManagerFormatVSharedBranches.js +5 -4
  169. package/dist/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
  170. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  171. package/dist/shared-tree-core/messageCodecVSharedBranches.js +3 -2
  172. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  173. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +5 -5
  174. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  175. package/dist/shared-tree-core/messageFormatV1ToV4.js +9 -8
  176. package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  177. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts +7 -7
  178. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  179. package/dist/shared-tree-core/messageFormatVSharedBranches.js +7 -6
  180. package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
  181. package/dist/shared-tree-core/sharedTreeCore.js +6 -43
  182. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  183. package/dist/shared-tree-core/transaction.js +20 -30
  184. package/dist/shared-tree-core/transaction.js.map +1 -1
  185. package/dist/simple-tree/api/simpleSchemaCodec.js +2 -24
  186. package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  187. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +2 -24
  188. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  189. package/dist/simple-tree/api/tree.d.ts +10 -0
  190. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  191. package/dist/simple-tree/api/tree.js.map +1 -1
  192. package/dist/simple-tree/core/treeNodeKernel.d.ts +5 -0
  193. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  194. package/dist/simple-tree/core/treeNodeKernel.js +119 -105
  195. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  196. package/dist/simple-tree/core/unhydratedFlexTree.js +6 -10
  197. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  198. package/dist/simple-tree/leafNodeSchema.js +2 -12
  199. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  200. package/dist/simple-tree/node-kinds/array/arrayNode.js +2 -6
  201. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  202. package/dist/simple-tree/simpleSchemaFormatV1.d.ts +121 -120
  203. package/dist/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -1
  204. package/dist/simple-tree/simpleSchemaFormatV1.js +32 -31
  205. package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -1
  206. package/dist/tableSchema.d.ts +50 -4
  207. package/dist/tableSchema.d.ts.map +1 -1
  208. package/dist/tableSchema.js +202 -106
  209. package/dist/tableSchema.js.map +1 -1
  210. package/dist/util/arrayUtilities.d.ts +20 -0
  211. package/dist/util/arrayUtilities.d.ts.map +1 -1
  212. package/dist/util/arrayUtilities.js +24 -1
  213. package/dist/util/arrayUtilities.js.map +1 -1
  214. package/dist/util/index.d.ts +1 -1
  215. package/dist/util/index.d.ts.map +1 -1
  216. package/dist/util/index.js +3 -2
  217. package/dist/util/index.js.map +1 -1
  218. package/dist/util/rangeMap.d.ts +13 -0
  219. package/dist/util/rangeMap.d.ts.map +1 -1
  220. package/dist/util/rangeMap.js +69 -8
  221. package/dist/util/rangeMap.js.map +1 -1
  222. package/dist/util/typeboxBrand.d.ts +1 -1
  223. package/dist/util/typeboxBrand.d.ts.map +1 -1
  224. package/dist/util/typeboxBrand.js +4 -3
  225. package/dist/util/typeboxBrand.js.map +1 -1
  226. package/dist/util/utils.d.ts +2 -2
  227. package/dist/util/utils.d.ts.map +1 -1
  228. package/dist/util/utils.js +3 -2
  229. package/dist/util/utils.js.map +1 -1
  230. package/eslint.config.mts +14 -0
  231. package/lib/codec/versioned/format.d.ts +5 -4
  232. package/lib/codec/versioned/format.d.ts.map +1 -1
  233. package/lib/codec/versioned/format.js +1 -1
  234. package/lib/codec/versioned/format.js.map +1 -1
  235. package/lib/core/rebase/types.d.ts +4 -3
  236. package/lib/core/rebase/types.d.ts.map +1 -1
  237. package/lib/core/rebase/types.js +1 -1
  238. package/lib/core/rebase/types.js.map +1 -1
  239. package/lib/core/schema-stored/formatV1.d.ts +16 -15
  240. package/lib/core/schema-stored/formatV1.d.ts.map +1 -1
  241. package/lib/core/schema-stored/formatV1.js +1 -1
  242. package/lib/core/schema-stored/formatV1.js.map +1 -1
  243. package/lib/core/schema-stored/formatV2.d.ts +29 -28
  244. package/lib/core/schema-stored/formatV2.d.ts.map +1 -1
  245. package/lib/core/schema-stored/formatV2.js +1 -1
  246. package/lib/core/schema-stored/formatV2.js.map +1 -1
  247. package/lib/core/tree/anchorSet.js +1 -5
  248. package/lib/core/tree/anchorSet.js.map +1 -1
  249. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts +11 -10
  250. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  251. package/lib/core/tree/detachedFieldIndexFormatCommon.js +1 -1
  252. package/lib/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
  253. package/lib/core/tree/detachedFieldIndexFormatV2.d.ts +7 -6
  254. package/lib/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
  255. package/lib/core/tree/detachedFieldIndexFormatV2.js +1 -1
  256. package/lib/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
  257. package/lib/core/tree/persistedTreeTextFormat.d.ts +19 -18
  258. package/lib/core/tree/persistedTreeTextFormat.d.ts.map +1 -1
  259. package/lib/core/tree/persistedTreeTextFormat.js +1 -1
  260. package/lib/core/tree/persistedTreeTextFormat.js.map +1 -1
  261. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  262. package/lib/feature-libraries/chunked-forest/chunkTree.js +1 -1
  263. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  264. package/lib/feature-libraries/chunked-forest/chunkedForest.js +1 -5
  265. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  266. package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts +13 -12
  267. package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -1
  268. package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.js +1 -1
  269. package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -1
  270. package/lib/feature-libraries/chunked-forest/codec/format/formatV1.d.ts +36 -35
  271. package/lib/feature-libraries/chunked-forest/codec/format/formatV1.d.ts.map +1 -1
  272. package/lib/feature-libraries/chunked-forest/codec/format/formatV1.js +1 -1
  273. package/lib/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -1
  274. package/lib/feature-libraries/chunked-forest/codec/format/formatV2.d.ts +26 -25
  275. package/lib/feature-libraries/chunked-forest/codec/format/formatV2.d.ts.map +1 -1
  276. package/lib/feature-libraries/chunked-forest/codec/format/formatV2.js +1 -1
  277. package/lib/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -1
  278. package/lib/feature-libraries/chunked-forest/codec/format/formatVText.d.ts +24 -23
  279. package/lib/feature-libraries/chunked-forest/codec/format/formatVText.d.ts.map +1 -1
  280. package/lib/feature-libraries/chunked-forest/codec/format/formatVText.js +1 -1
  281. package/lib/feature-libraries/chunked-forest/codec/format/formatVText.js.map +1 -1
  282. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +66 -14
  283. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  284. package/lib/feature-libraries/chunked-forest/uniformChunk.js +101 -36
  285. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  286. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  287. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +36 -14
  288. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  289. package/lib/feature-libraries/flex-tree/lazyEntity.js +1 -11
  290. package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  291. package/lib/feature-libraries/flex-tree/lazyNode.js +1 -11
  292. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  293. package/lib/feature-libraries/forest-summary/formatCommon.d.ts +6 -5
  294. package/lib/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
  295. package/lib/feature-libraries/forest-summary/formatCommon.js +1 -1
  296. package/lib/feature-libraries/forest-summary/formatCommon.js.map +1 -1
  297. package/lib/feature-libraries/modular-schema/genericFieldKindFormat.d.ts +4 -3
  298. package/lib/feature-libraries/modular-schema/genericFieldKindFormat.d.ts.map +1 -1
  299. package/lib/feature-libraries/modular-schema/genericFieldKindFormat.js +1 -1
  300. package/lib/feature-libraries/modular-schema/genericFieldKindFormat.js.map +1 -1
  301. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  302. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +10 -30
  303. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  304. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +45 -44
  305. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
  306. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js +1 -1
  307. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
  308. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +23 -22
  309. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
  310. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js +1 -1
  311. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -1
  312. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +0 -5
  313. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  314. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  315. package/lib/feature-libraries/object-forest/objectForest.js +1 -45
  316. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  317. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +9 -8
  318. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  319. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.js +1 -1
  320. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.js.map +1 -1
  321. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +14 -13
  322. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  323. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.js +1 -1
  324. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.js.map +1 -1
  325. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +5 -4
  326. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
  327. package/lib/feature-libraries/schema-edits/schemaChangeFormat.js +1 -1
  328. package/lib/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
  329. package/lib/feature-libraries/schema-index/formatV1.d.ts +15 -14
  330. package/lib/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
  331. package/lib/feature-libraries/schema-index/formatV1.js +1 -1
  332. package/lib/feature-libraries/schema-index/formatV1.js.map +1 -1
  333. package/lib/feature-libraries/schema-index/formatV2.d.ts +20 -19
  334. package/lib/feature-libraries/schema-index/formatV2.d.ts.map +1 -1
  335. package/lib/feature-libraries/schema-index/formatV2.js +1 -1
  336. package/lib/feature-libraries/schema-index/formatV2.js.map +1 -1
  337. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  338. package/lib/feature-libraries/sequence-field/compose.js +1 -3
  339. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  340. package/lib/feature-libraries/sequence-field/formatV1.d.ts +283 -282
  341. package/lib/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
  342. package/lib/feature-libraries/sequence-field/formatV1.js +1 -1
  343. package/lib/feature-libraries/sequence-field/formatV1.js.map +1 -1
  344. package/lib/feature-libraries/sequence-field/formatV2.d.ts +180 -179
  345. package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  346. package/lib/feature-libraries/sequence-field/formatV2.js +1 -1
  347. package/lib/feature-libraries/sequence-field/formatV2.js.map +1 -1
  348. package/lib/feature-libraries/sequence-field/formatV3.d.ts +126 -125
  349. package/lib/feature-libraries/sequence-field/formatV3.d.ts.map +1 -1
  350. package/lib/feature-libraries/sequence-field/formatV3.js +1 -1
  351. package/lib/feature-libraries/sequence-field/formatV3.js.map +1 -1
  352. package/lib/packageVersion.d.ts +1 -1
  353. package/lib/packageVersion.js +1 -1
  354. package/lib/packageVersion.js.map +1 -1
  355. package/lib/shared-tree/schematizingTreeView.d.ts +1 -0
  356. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  357. package/lib/shared-tree/schematizingTreeView.js +4 -38
  358. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  359. package/lib/shared-tree/sharedTree.d.ts +2 -3
  360. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  361. package/lib/shared-tree/sharedTree.js +2 -41
  362. package/lib/shared-tree/sharedTree.js.map +1 -1
  363. package/lib/shared-tree/sharedTreeChangeFormat.d.ts +8 -7
  364. package/lib/shared-tree/sharedTreeChangeFormat.d.ts.map +1 -1
  365. package/lib/shared-tree/sharedTreeChangeFormat.js +1 -1
  366. package/lib/shared-tree/sharedTreeChangeFormat.js.map +1 -1
  367. package/lib/shared-tree/treeCheckout.d.ts +14 -5
  368. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  369. package/lib/shared-tree/treeCheckout.js +63 -93
  370. package/lib/shared-tree/treeCheckout.js.map +1 -1
  371. package/lib/shared-tree-core/branch.js +1 -5
  372. package/lib/shared-tree-core/branch.js.map +1 -1
  373. package/lib/shared-tree-core/editManager.d.ts +2 -2
  374. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  375. package/lib/shared-tree-core/editManager.js.map +1 -1
  376. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +35 -34
  377. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  378. package/lib/shared-tree-core/editManagerFormatCommons.js +1 -1
  379. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  380. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +15 -15
  381. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  382. package/lib/shared-tree-core/editManagerFormatV1toV4.js +1 -1
  383. package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  384. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +40 -40
  385. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
  386. package/lib/shared-tree-core/editManagerFormatVSharedBranches.js +1 -1
  387. package/lib/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
  388. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  389. package/lib/shared-tree-core/messageCodecVSharedBranches.js +1 -1
  390. package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  391. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +5 -5
  392. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  393. package/lib/shared-tree-core/messageFormatV1ToV4.js +1 -1
  394. package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  395. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts +7 -7
  396. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  397. package/lib/shared-tree-core/messageFormatVSharedBranches.js +1 -1
  398. package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
  399. package/lib/shared-tree-core/sharedTreeCore.js +1 -38
  400. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  401. package/lib/shared-tree-core/transaction.js +1 -11
  402. package/lib/shared-tree-core/transaction.js.map +1 -1
  403. package/lib/simple-tree/api/tree.d.ts +10 -0
  404. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  405. package/lib/simple-tree/api/tree.js.map +1 -1
  406. package/lib/simple-tree/core/treeNodeKernel.d.ts +5 -0
  407. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  408. package/lib/simple-tree/core/treeNodeKernel.js +36 -23
  409. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  410. package/lib/simple-tree/core/unhydratedFlexTree.js +1 -5
  411. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  412. package/lib/simple-tree/leafNodeSchema.js +1 -11
  413. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  414. package/lib/simple-tree/node-kinds/array/arrayNode.js +1 -5
  415. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  416. package/lib/simple-tree/simpleSchemaFormatV1.d.ts +121 -120
  417. package/lib/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -1
  418. package/lib/simple-tree/simpleSchemaFormatV1.js +1 -1
  419. package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -1
  420. package/lib/tableSchema.d.ts +50 -4
  421. package/lib/tableSchema.d.ts.map +1 -1
  422. package/lib/tableSchema.js +171 -75
  423. package/lib/tableSchema.js.map +1 -1
  424. package/lib/util/arrayUtilities.d.ts +20 -0
  425. package/lib/util/arrayUtilities.d.ts.map +1 -1
  426. package/lib/util/arrayUtilities.js +22 -0
  427. package/lib/util/arrayUtilities.js.map +1 -1
  428. package/lib/util/index.d.ts +1 -1
  429. package/lib/util/index.d.ts.map +1 -1
  430. package/lib/util/index.js +1 -1
  431. package/lib/util/index.js.map +1 -1
  432. package/lib/util/rangeMap.d.ts +13 -0
  433. package/lib/util/rangeMap.d.ts.map +1 -1
  434. package/lib/util/rangeMap.js +69 -8
  435. package/lib/util/rangeMap.js.map +1 -1
  436. package/lib/util/typeboxBrand.d.ts +1 -1
  437. package/lib/util/typeboxBrand.d.ts.map +1 -1
  438. package/lib/util/typeboxBrand.js +1 -1
  439. package/lib/util/typeboxBrand.js.map +1 -1
  440. package/lib/util/utils.d.ts +2 -2
  441. package/lib/util/utils.d.ts.map +1 -1
  442. package/lib/util/utils.js +1 -1
  443. package/lib/util/utils.js.map +1 -1
  444. package/package.json +24 -23
  445. package/src/codec/versioned/format.ts +2 -1
  446. package/src/core/rebase/types.ts +1 -1
  447. package/src/core/schema-stored/formatV1.ts +2 -1
  448. package/src/core/schema-stored/formatV2.ts +2 -1
  449. package/src/core/tree/detachedFieldIndexFormatCommon.ts +2 -1
  450. package/src/core/tree/detachedFieldIndexFormatV2.ts +2 -1
  451. package/src/core/tree/persistedTreeTextFormat.ts +2 -1
  452. package/src/feature-libraries/chunked-forest/chunkTree.ts +3 -2
  453. package/src/feature-libraries/chunked-forest/codec/format/formatGeneric.ts +2 -1
  454. package/src/feature-libraries/chunked-forest/codec/format/formatV1.ts +2 -1
  455. package/src/feature-libraries/chunked-forest/codec/format/formatV2.ts +2 -1
  456. package/src/feature-libraries/chunked-forest/codec/format/formatVText.ts +2 -1
  457. package/src/feature-libraries/chunked-forest/uniformChunk.ts +131 -44
  458. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +36 -14
  459. package/src/feature-libraries/forest-summary/formatCommon.ts +2 -1
  460. package/src/feature-libraries/modular-schema/genericFieldKindFormat.ts +2 -1
  461. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +14 -47
  462. package/src/feature-libraries/modular-schema/modularChangeFormatV1.ts +2 -1
  463. package/src/feature-libraries/modular-schema/modularChangeFormatV2.ts +2 -1
  464. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +0 -5
  465. package/src/feature-libraries/optional-field/optionalFieldChangeFormatV1.ts +2 -1
  466. package/src/feature-libraries/optional-field/optionalFieldChangeFormatV2.ts +2 -1
  467. package/src/feature-libraries/schema-edits/schemaChangeFormat.ts +2 -1
  468. package/src/feature-libraries/schema-index/formatV1.ts +2 -1
  469. package/src/feature-libraries/schema-index/formatV2.ts +2 -1
  470. package/src/feature-libraries/sequence-field/compose.ts +1 -4
  471. package/src/feature-libraries/sequence-field/formatV1.ts +2 -1
  472. package/src/feature-libraries/sequence-field/formatV2.ts +2 -1
  473. package/src/feature-libraries/sequence-field/formatV3.ts +2 -1
  474. package/src/packageVersion.ts +1 -1
  475. package/src/shared-tree/schematizingTreeView.ts +4 -0
  476. package/src/shared-tree/sharedTree.ts +3 -10
  477. package/src/shared-tree/sharedTreeChangeFormat.ts +2 -1
  478. package/src/shared-tree/treeCheckout.ts +61 -56
  479. package/src/shared-tree-core/editManager.ts +2 -2
  480. package/src/shared-tree-core/editManagerFormatCommons.ts +2 -1
  481. package/src/shared-tree-core/editManagerFormatV1toV4.ts +2 -1
  482. package/src/shared-tree-core/editManagerFormatVSharedBranches.ts +2 -1
  483. package/src/shared-tree-core/messageCodecVSharedBranches.ts +2 -1
  484. package/src/shared-tree-core/messageFormatV1ToV4.ts +2 -1
  485. package/src/shared-tree-core/messageFormatVSharedBranches.ts +2 -1
  486. package/src/simple-tree/api/tree.ts +11 -0
  487. package/src/simple-tree/core/treeNodeKernel.ts +39 -15
  488. package/src/simple-tree/simpleSchemaFormatV1.ts +2 -1
  489. package/src/tableSchema.ts +306 -80
  490. package/src/util/arrayUtilities.ts +35 -0
  491. package/src/util/index.ts +2 -0
  492. package/src/util/rangeMap.ts +108 -9
  493. package/src/util/typeboxBrand.ts +2 -1
  494. package/src/util/utils.ts +2 -1
  495. package/tsconfig.json +5 -0
@@ -1 +1 @@
1
- {"version":3,"file":"arrayUtilities.d.ts","sourceRoot":"","sources":["../../src/util/arrayUtilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAIxE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAK1E;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC5B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAClC,OAAO,EAAE,MAAM,EACf,eAAe,GAAE,OAAe,GAC9B,IAAI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AAC,CAAA;CAAE,EAC/D,aAAa,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,GACjC,SAAS,UAAU,EAAE,CAavB"}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.validateIndexRange = exports.validateIndex = exports.validatePositiveIndex = exports.validateSafeInteger = void 0;
7
+ exports.collectContiguousRanges = exports.validateIndexRange = exports.validateIndex = exports.validatePositiveIndex = exports.validateSafeInteger = void 0;
8
8
  const internal_1 = require("@fluidframework/telemetry-utils/internal");
9
9
  /**
10
10
  * Validates that the provided index is a safe integer.
@@ -73,4 +73,27 @@ function validateIndexRange(startIndex, endIndex, array, apiName) {
73
73
  validateIndex(endIndex, array, apiName, true);
74
74
  }
75
75
  exports.validateIndexRange = validateIndexRange;
76
+ /**
77
+ * Walks `array` in order and collects the indices of every element for which `predicate` returns
78
+ * `true` into contiguous `[start, end)` ranges.
79
+ * @param array - The array (or array-like) to scan.
80
+ * @param shouldInclude - Returns `true` for elements whose indices should be included.
81
+ * @returns The collected ranges in ascending order. The returned array is empty if no elements match.
82
+ */
83
+ function collectContiguousRanges(array, shouldInclude) {
84
+ const ranges = [];
85
+ for (let i = 0; i < array.length; i++) {
86
+ if (shouldInclude(array[i])) {
87
+ const last = ranges[ranges.length - 1];
88
+ if (last?.end === i) {
89
+ last.end = i + 1;
90
+ }
91
+ else {
92
+ ranges.push({ start: i, end: i + 1 });
93
+ }
94
+ }
95
+ }
96
+ return ranges;
97
+ }
98
+ exports.collectContiguousRanges = collectContiguousRanges;
76
99
  //# sourceMappingURL=arrayUtilities.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"arrayUtilities.js","sourceRoot":"","sources":["../../src/util/arrayUtilities.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uEAAsE;AAEtE;;;;;;GAMG;AACH,SAAgB,mBAAmB,CAAC,KAAa,EAAE,OAAe;IACjE,IAAI,CA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,CAAC;IACH,CAAC;IACD,aAAa,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAChD,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AAC/C,CAAC;AAbD,gDAaC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * Validates that the provided index is a safe integer.\n * @throws If the index is invalid.\n * @param index - The index to validate.\n * @param apiName - The name of the API performing the validation.\n * @throws If the index is invalid.\n */\nexport function validateSafeInteger(index: number, apiName: string): void {\n\tif (!Number.isSafeInteger(index)) {\n\t\tthrow new UsageError(`Expected a safe integer passed to ${apiName}, got ${index}.`);\n\t}\n}\n\n/**\n * Validates that the provided index is a 0 or greater safe integer.\n * @param index - The index to validate.\n * @param apiName - The name of the API performing the validation.\n * @throws If the index is invalid.\n */\nexport function validatePositiveIndex(index: number, apiName: string): void {\n\tvalidateSafeInteger(index, apiName);\n\tif (index < 0) {\n\t\tthrow new UsageError(`Expected non-negative index passed to ${apiName}, got ${index}.`);\n\t}\n}\n\n/**\n * Validates that the provided index is a non-negative safe integer within the bounds of the provided array (or, optionally, 1 past its end).\n * @throws If the index is invalid.\n * @param index - The index to validate.\n * @param array - The array to validate against.\n * @param apiName - The name of the API performing the validation.\n * @param allowOnePastEnd - Whether to allow the index to be one past the end of the array.\n */\nexport function validateIndex(\n\tindex: number,\n\tarray: { readonly length: number },\n\tapiName: string,\n\tallowOnePastEnd: boolean = false,\n): void {\n\tvalidatePositiveIndex(index, apiName);\n\tif (allowOnePastEnd) {\n\t\tif (index > array.length) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Index value passed to ${apiName} is out of bounds. Expected at most ${array.length}, got ${index}.`,\n\t\t\t);\n\t\t}\n\t} else {\n\t\tif (index >= array.length) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Index value passed to ${apiName} is out of bounds. Expected at most ${array.length - 1}, got ${index}.`,\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * Validates that the provided range `[startIndex, endIndex)` is valid and within the bounds of the provided array.\n * @remarks\n * This is intended for ranges which are inclusive for the lower bound, and exclusive for the upper bound,\n * and permits 0 length ranges, even `[array.length, array.length)`.\n * @throws If the index is invalid.\n * @param startIndex - The index that starts the range (inclusive).\n * @param endIndex - The index that ends the range (exclusive).\n * @param array - The array to validate against.\n * @param apiName - The name of the API performing the validation.\n */\nexport function validateIndexRange(\n\tstartIndex: number,\n\tendIndex: number,\n\tarray: { readonly length: number },\n\tapiName: string,\n): void {\n\tif (startIndex > endIndex) {\n\t\tthrow new UsageError(\n\t\t\t`Malformed range passed to ${apiName}. Start index ${startIndex} is greater than end index ${endIndex}.`,\n\t\t);\n\t}\n\tvalidateIndex(startIndex, array, apiName, true);\n\tvalidateIndex(endIndex, array, apiName, true);\n}\n"]}
1
+ {"version":3,"file":"arrayUtilities.js","sourceRoot":"","sources":["../../src/util/arrayUtilities.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uEAAsE;AAEtE;;;;;;GAMG;AACH,SAAgB,mBAAmB,CAAC,KAAa,EAAE,OAAe;IACjE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,qBAAU,CAAC,qCAAqC,OAAO,SAAS,KAAK,GAAG,CAAC,CAAC;IACrF,CAAC;AACF,CAAC;AAJD,kDAIC;AAED;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAC,KAAa,EAAE,OAAe;IACnE,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACpC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACf,MAAM,IAAI,qBAAU,CAAC,yCAAyC,OAAO,SAAS,KAAK,GAAG,CAAC,CAAC;IACzF,CAAC;AACF,CAAC;AALD,sDAKC;AAED;;;;;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C,CAAM,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACvC,IAAI,IAAI,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;gBACrB,IAAI,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;YAClB,CAAC;iBAAM,CAAC;gBACP,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACvC,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC;AAhBD,0DAgBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * Validates that the provided index is a safe integer.\n * @throws If the index is invalid.\n * @param index - The index to validate.\n * @param apiName - The name of the API performing the validation.\n * @throws If the index is invalid.\n */\nexport function validateSafeInteger(index: number, apiName: string): void {\n\tif (!Number.isSafeInteger(index)) {\n\t\tthrow new UsageError(`Expected a safe integer passed to ${apiName}, got ${index}.`);\n\t}\n}\n\n/**\n * Validates that the provided index is a 0 or greater safe integer.\n * @param index - The index to validate.\n * @param apiName - The name of the API performing the validation.\n * @throws If the index is invalid.\n */\nexport function validatePositiveIndex(index: number, apiName: string): void {\n\tvalidateSafeInteger(index, apiName);\n\tif (index < 0) {\n\t\tthrow new UsageError(`Expected non-negative index passed to ${apiName}, got ${index}.`);\n\t}\n}\n\n/**\n * Validates that the provided index is a non-negative safe integer within the bounds of the provided array (or, optionally, 1 past its end).\n * @throws If the index is invalid.\n * @param index - The index to validate.\n * @param array - The array to validate against.\n * @param apiName - The name of the API performing the validation.\n * @param allowOnePastEnd - Whether to allow the index to be one past the end of the array.\n */\nexport function validateIndex(\n\tindex: number,\n\tarray: { readonly length: number },\n\tapiName: string,\n\tallowOnePastEnd: boolean = false,\n): void {\n\tvalidatePositiveIndex(index, apiName);\n\tif (allowOnePastEnd) {\n\t\tif (index > array.length) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Index value passed to ${apiName} is out of bounds. Expected at most ${array.length}, got ${index}.`,\n\t\t\t);\n\t\t}\n\t} else {\n\t\tif (index >= array.length) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Index value passed to ${apiName} is out of bounds. Expected at most ${array.length - 1}, got ${index}.`,\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * Validates that the provided range `[startIndex, endIndex)` is valid and within the bounds of the provided array.\n * @remarks\n * This is intended for ranges which are inclusive for the lower bound, and exclusive for the upper bound,\n * and permits 0 length ranges, even `[array.length, array.length)`.\n * @throws If the index is invalid.\n * @param startIndex - The index that starts the range (inclusive).\n * @param endIndex - The index that ends the range (exclusive).\n * @param array - The array to validate against.\n * @param apiName - The name of the API performing the validation.\n */\nexport function validateIndexRange(\n\tstartIndex: number,\n\tendIndex: number,\n\tarray: { readonly length: number },\n\tapiName: string,\n): void {\n\tif (startIndex > endIndex) {\n\t\tthrow new UsageError(\n\t\t\t`Malformed range passed to ${apiName}. Start index ${startIndex} is greater than end index ${endIndex}.`,\n\t\t);\n\t}\n\tvalidateIndex(startIndex, array, apiName, true);\n\tvalidateIndex(endIndex, array, apiName, true);\n}\n\n/**\n * A half-open `[start, end)` range of array indices.\n */\nexport interface IndexRange {\n\t/** Start index, inclusive. */\n\treadonly start: number;\n\t/** End index, exclusive. */\n\treadonly end: number;\n}\n\n/**\n * Walks `array` in order and collects the indices of every element for which `predicate` returns\n * `true` into contiguous `[start, end)` ranges.\n * @param array - The array (or array-like) to scan.\n * @param shouldInclude - Returns `true` for elements whose indices should be included.\n * @returns The collected ranges in ascending order. The returned array is empty if no elements match.\n */\nexport function collectContiguousRanges<T>(\n\tarray: { readonly length: number; readonly [index: number]: T },\n\tshouldInclude: (item: T) => boolean,\n): readonly IndexRange[] {\n\tconst ranges: { start: number; end: number }[] = [];\n\tfor (let i = 0; i < array.length; i++) {\n\t\tif (shouldInclude(array[i] as T)) {\n\t\t\tconst last = ranges[ranges.length - 1];\n\t\t\tif (last?.end === i) {\n\t\t\t\tlast.end = i + 1;\n\t\t\t} else {\n\t\t\t\tranges.push({ start: i, end: i + 1 });\n\t\t\t}\n\t\t}\n\t}\n\treturn ranges;\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { validateIndex, validateIndexRange, validatePositiveIndex, validateSafeInteger, } from "./arrayUtilities.js";
5
+ export { collectContiguousRanges, type IndexRange, validateIndex, validateIndexRange, validatePositiveIndex, validateSafeInteger, } from "./arrayUtilities.js";
6
6
  export { brand, type Brand, BrandedType, type NameFromBranded, type ValueFromBranded, brandConst, type Values, strictEnum, unbrand, } from "./brand.js";
7
7
  export { brandedNumberType, brandedStringType } from "./typeboxBrand.js";
8
8
  export { brandOpaque, extractFromOpaque, type ExtractFromOpaque, type Opaque, } from "./opaque.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,aAAa,EACb,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,KAAK,EACL,KAAK,KAAK,EACV,WAAW,EACX,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,UAAU,EACV,KAAK,MAAM,EACX,UAAU,EACV,OAAO,GACP,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACN,WAAW,EACX,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,KAAK,MAAM,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,mBAAmB,EACnB,mBAAmB,E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ACpB,OAAO,EAAE,oBAAoB,EAAE,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAErF,YAAY,EACX,eAAe,EACf,yBAAyB,EACzB,uBAAuB,EACvB,YAAY,EACZ,WAAW,EACX,OAAO,EACP,mBAAmB,EACnB,YAAY,EACZ,QAAQ,GACR,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EACN,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,WAAW,GACX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACN,QAAQ,EACR,KAAK,gBAAgB,EACrB,kBAAkB,GAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACN,KAAK,WAAW,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,eAAe,GACf,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,SAAS,EACT,KAAK,aAAa,EAClB,cAAc,EACd,aAAa,EACb,aAAa,GACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACN,KAAK,UAAU,EACf,aAAa,EACb,gBAAgB,EAChB,qBAAqB,GACrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,uBAAuB,EACvB,KAAK,UAAU,EACf,aAAa,EACb,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,KAAK,EACL,KAAK,KAAK,EACV,WAAW,EACX,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,UAAU,EACV,KAAK,MAAM,EACX,UAA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K,WAAW,EAChB,UAAU,EACV,uBAAuB,EACvB,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,qBAAqB,EACrB,IAAI,EACJ,KAAK,EACL,OAAO,EACP,OAAO,EACP,SAAS,EACT,wBAAwB,EACxB,qBAAqB,IAAI,YAAY,EACrC,aAAa,EACb,eAAe,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAErF,YAAY,EACX,eAAe,EACf,yBAAyB,EACzB,uBAAuB,EACvB,YAAY,EACZ,WAAW,EACX,OAAO,EACP,mBAAmB,EACnB,YAAY,EACZ,QAAQ,GACR,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EACN,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,WAAW,GACX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACN,QAAQ,EACR,KAAK,gBAAgB,EACrB,kBAAkB,GAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACN,KAAK,WAAW,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,eAAe,GACf,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,SAAS,EACT,KAAK,aAAa,EAClB,cAAc,EACd,aAAa,EACb,aAAa,GACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACN,KAAK,UAAU,EACf,aAAa,EACb,gBAAgB,EAChB,qBAAqB,GACrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -4,9 +4,10 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.assertValidRangeIndices = exports.capitalize = exports.disposeSymbol = exports.oneFromIterable = exports.invertMap = exports.objectToMap = exports.assertNonNegativeSafeInteger = exports.assertValidRange = exports.assertValidIndex = exports.filterIterable = exports.mapIterable = exports.makeArray = exports.JsonCompatibleReadOnlySchema = exports.isReadonlyArray = exports.isJsonObject = exports.getOrCreate = exports.getOrAddEmptyToMap = exports.compareSets = exports.balancedReduce = exports.asMutable = exports.StackyIterator = exports.OffsetListFactory = exports.nestedSetContains = exports.addToNestedSet = exports.getOrCreateInNestedMap = exports.nestedMapFromFlatList = exports.nestedMapToFlatList = exports.mapNestedMap = exports.tryGetFromNestedMap = exports.tryAddToNestedMap = exports.setInNestedMap = exports.populateNestedMap = exports.SizedNestedMap = exports.forEachInNestedMap = exports.getOrDefaultInNestedMap = exports.getOrAddInNestedMap = exports.deleteFromNestedMap = exports.extractFromOpaque = exports.brandOpaque = exports.brandedStringType = exports.brandedNumberType = exports.unbrand = exports.strictEnum = exports.brandConst = exports.BrandedType = exports.brand = exports.validateSafeInteger = exports.validatePositiveIndex = exports.validateIndexRange = exports.validateIndex = void 0;
8
- exports.readAndParseSnapshotBlob = exports.cloneWithReplacements = exports.createTupleComparator = exports.mergeTupleBTrees = exports.newTupleBTree = exports.breakingClass = exports.throwIfBroken = exports.breakingMethod = exports.Breakable = exports.fakeIdAllocator = exports.idAllocatorFromState = exports.idAllocatorFromMaxId = exports.newIntegerRangeMap = exports.RangeMap = exports.brandedSlot = exports.getOrCreateSlotContent = exports.unsafeArrayToTuple = exports.ReferenceCountedBase = exports.iterableHasSome = exports.getOrAddInMap = exports.copyProperty = exports.defineLazyCachedProperty = exports.hasSingle = exports.hasSome = exports.getLast = exports.count = exports.find = exports.comparePartialStrings = exports.compareStrings = exports.comparePartialNumbers = exports.compareNumbers = exports.transformObjectMap = void 0;
7
+ exports.capitalize = exports.disposeSymbol = exports.oneFromIterable = exports.invertMap = exports.objectToMap = exports.assertNonNegativeSafeInteger = exports.assertValidRange = exports.assertValidIndex = exports.filterIterable = exports.mapIterable = exports.makeArray = exports.JsonCompatibleReadOnlySchema = exports.isReadonlyArray = exports.isJsonObject = exports.getOrCreate = exports.getOrAddEmptyToMap = exports.compareSets = exports.balancedReduce = exports.asMutable = exports.StackyIterator = exports.OffsetListFactory = exports.nestedSetContains = exports.addToNestedSet = exports.getOrCreateInNestedMap = exports.nestedMapFromFlatList = exports.nestedMapToFlatList = exports.mapNestedMap = exports.tryGetFromNestedMap = exports.tryAddToNestedMap = exports.setInNestedMap = exports.populateNestedMap = exports.SizedNestedMap = exports.forEachInNestedMap = exports.getOrDefaultInNestedMap = exports.getOrAddInNestedMap = exports.deleteFromNestedMap = exports.extractFromOpaque = exports.brandOpaque = exports.brandedStringType = exports.brandedNumberType = exports.unbrand = exports.strictEnum = exports.brandConst = exports.BrandedType = exports.brand = exports.validateSafeInteger = exports.validatePositiveIndex = exports.validateIndexRange = exports.validateIndex = exports.collectContiguousRanges = void 0;
8
+ exports.readAndParseSnapshotBlob = exports.cloneWithReplacements = exports.createTupleComparator = exports.mergeTupleBTrees = exports.newTupleBTree = exports.breakingClass = exports.throwIfBroken = exports.breakingMethod = exports.Breakable = exports.fakeIdAllocator = exports.idAllocatorFromState = exports.idAllocatorFromMaxId = exports.newIntegerRangeMap = exports.RangeMap = exports.brandedSlot = exports.getOrCreateSlotContent = exports.unsafeArrayToTuple = exports.ReferenceCountedBase = exports.iterableHasSome = exports.getOrAddInMap = exports.copyProperty = exports.defineLazyCachedProperty = exports.hasSingle = exports.hasSome = exports.getLast = exports.count = exports.find = exports.comparePartialStrings = exports.compareStrings = exports.comparePartialNumbers = exports.compareNumbers = exports.transformObjectMap = exports.assertValidRangeIndices = void 0;
9
9
  var arrayUtilities_js_1 = require("./arrayUtilities.js");
10
+ Object.defineProperty(exports, "collectContiguousRanges", { enumerable: true, get: function () { return arrayUtilities_js_1.collectContiguousRanges; } });
10
11
  Object.defineProperty(exports, "validateIndex", { enumerable: true, get: function () { return arrayUtilities_js_1.validateIndex; } });
11
12
  Object.defineProperty(exports, "validateIndexRange", { enumerable: true, get: function () { return arrayUtilities_js_1.validateIndexRange; } });
12
13
  Object.defineProperty(exports, "validatePositiveIndex", { enumerable: true, get: function () { return arrayUtilities_js_1.validatePositiveIndex; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,yDAK6B;AAJ5B,kHAAA,aAAa,OAAA;AACb,uHAAA,kBAAkB,OAAA;AAClB,0HAAA,qBAAqB,OAAA;AACrB,wHAAA,mBAAmB,OAAA;AAEpB,uCAUoB;AATnB,iGAAA,KAAK,OAAA;AAEL,uGAAA,WAAW,OAAA;AAGX,sGAAA,UAAU,OAAA;AAEV,sGAAA,UAAU,OAAA;AACV,mGAAA,OAAO,OAAA;AAER,qDAAyE;AAAhE,oHAAA,iBAAiB,OAAA;AAAE,oHAAA,iBAAiB,OAAA;AAC7C,yCAKqB;AAJpB,wGAAA,WAAW,OAAA;AACX,8GAAA,iBAAiB,OAAA;AAIlB,+CAgBwB;AAfvB,mHAAA,mBAAmB,OAAA;AACnB,mHAAA,mBAAmB,OAAA;AACnB,uHAAA,uBAAuB,OAAA;AACvB,kHAAA,kBAAkB,OAAA;AAGlB,8GAAA,cAAc,OAAA;AACd,iHAAA,iBAAiB,OAAA;AACjB,8GAAA,cAAc,OAAA;AACd,iHAAA,iBAAiB,OAAA;AACjB,mHAAA,mBAAmB,OAAA;AACnB,4GAAA,YAAY,OAAA;AACZ,mHAAA,mBAAmB,OAAA;AACnB,qHAAA,qBAAqB,OAAA;AACrB,sHAAA,sBAAsB,OAAA;AAEvB,+CAAmF;AAA1E,8GAAA,cAAc,OAAA;AAAkB,iHAAA,iBAAiB,OAAA;AAC1D,iDAAqE;AAA3C,kHAAA,iBAAiB,OAAA;AAiB3C,yDAAqD;AAA5C,mHAAA,cAAc,OAAA;AACvB,uCA2CoB;AA1CnB,qGAAA,SAAS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Ac,OAAA;AACd,6GAAA,aAAa,OAAA;AACb,6GAAA,aAAa,OAAA;AAGd,iDAKyB;AAHxB,8GAAA,aAAa,OAAA;AACb,iHAAA,gBAAgB,OAAA;AAChB,sHAAA,qBAAqB,OAAA;AAGtB,uEAAmE;AAA1D,iIAAA,qBAAqB,OAAA;AAE9B,6DAAiE;AAAxD,+HAAA,wBAAwB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tvalidateIndex,\n\tvalidateIndexRange,\n\tvalidatePositiveIndex,\n\tvalidateSafeInteger,\n} from \"./arrayUtilities.js\";\nexport {\n\tbrand,\n\ttype Brand,\n\tBrandedType,\n\ttype NameFromBranded,\n\ttype ValueFromBranded,\n\tbrandConst,\n\ttype Values,\n\tstrictEnum,\n\tunbrand,\n} from \"./brand.js\";\nexport { brandedNumberType, brandedStringType } from \"./typeboxBrand.js\";\nexport {\n\tbrandOpaque,\n\textractFromOpaque,\n\ttype ExtractFromOpaque,\n\ttype Opaque,\n} from \"./opaque.js\";\nexport {\n\tdeleteFromNestedMap,\n\tgetOrAddInNestedMap,\n\tgetOrDefaultInNestedMap,\n\tforEachInNestedMap,\n\ttype NestedMap,\n\ttype ReadonlyNestedMap,\n\tSizedNestedMap,\n\tpopulateNestedMap,\n\tsetInNestedMap,\n\ttryAddToNestedMap,\n\ttryGetFromNestedMap,\n\tmapNestedMap,\n\tnestedMapToFlatList,\n\tnestedMapFromFlatList,\n\tgetOrCreateInNestedMap,\n} from \"./nestedMap.js\";\nexport { addToNestedSet, type NestedSet, nestedSetContains } from \"./nestedSet.js\";\nexport { type OffsetList, OffsetListFactory } from \"./offsetList.js\";\nexport type {\n\tareSafelyAssignable,\n\tContravariant,\n\tCovariant,\n\teitherIsAny,\n\tEnforceTypeCheckTests,\n\tInvariant,\n\tisAny,\n\tisAssignableTo,\n\tisStrictSubset,\n\tMakeNominal,\n\trequireFalse,\n\trequireTrue,\n\trequireAssignableTo,\n\tareOnlyKeys,\n} from \"./typeCheck.js\";\nexport { StackyIterator } from \"./stackyIterator.js\";\nexport {\n\tasMutable,\n\tbalancedReduce,\n\tcompareSets,\n\tgetOrAddEmptyToMap,\n\tgetOrCreate,\n\tisJsonObject,\n\tisReadonlyArray,\n\ttype JsonCompatible,\n\ttype JsonCompatibleObject,\n\ttype JsonCompatibleReadOnly,\n\ttype JsonCompatibleReadOnlyObject,\n\tJsonCompatibleReadOnlySchema,\n\tmakeArray,\n\tmapIterable,\n\tfilterIterable,\n\ttype Mutable,\n\ttype Populated,\n\ttype RecursiveReadonly,\n\tassertValidIndex,\n\tassertValidRange,\n\tassertNonNegativeSafeInteger,\n\tobjectToMap,\n\tinvertMap,\n\toneFromIterable,\n\tdisposeSymbol,\n\ttype IDisposable,\n\tcapitalize,\n\tassertValidRangeIndices,\n\ttransformObjectMap,\n\tcompareNumbers,\n\tcomparePartialNumbers,\n\tcompareStrings,\n\tcomparePartialStrings,\n\tfind,\n\tcount,\n\tgetLast,\n\thasSome,\n\thasSingle,\n\tdefineLazyCachedProperty,\n\tcopyPropertyIfDefined as copyProperty,\n\tgetOrAddInMap,\n\titerableHasSome,\n} from \"./utils.js\";\nexport { ReferenceCountedBase, type ReferenceCounted } from \"./referenceCounting.js\";\n\nexport type {\n\t_RecursiveTrick,\n\tRestrictiveReadonlyRecord,\n\tRestrictiveStringRecord,\n\t_InlineTrick,\n\tFlattenKeys,\n\tIsUnion,\n\tUnionToIntersection,\n\tUnionToTuple,\n\tPopUnion,\n} from \"./typeUtils.js\";\n\nexport { unsafeArrayToTuple } from \"./typeUtils.js\";\n\nexport {\n\ttype BrandedKey,\n\ttype BrandedKeyContent,\n\ttype BrandedMapSubset,\n\tgetOrCreateSlotContent,\n\tbrandedSlot,\n} from \"./brandedMap.js\";\n\nexport {\n\tRangeMap,\n\ttype RangeQueryResult,\n\tnewIntegerRangeMap,\n} from \"./rangeMap.js\";\n\nexport {\n\ttype IdAllocator,\n\tidAllocatorFromMaxId,\n\tidAllocatorFromState,\n\ttype IdAllocationState,\n\tfakeIdAllocator,\n} from \"./idAllocator.js\";\n\nexport {\n\tBreakable,\n\ttype WithBreakable,\n\tbreakingMethod,\n\tthrowIfBroken,\n\tbreakingClass,\n} from \"./breakable.js\";\n\nexport {\n\ttype TupleBTree,\n\tnewTupleBTree,\n\tmergeTupleBTrees,\n\tcreateTupleComparator,\n} from \"./bTreeUtils.js\";\n\nexport { cloneWithReplacements } from \"./cloneWithReplacements.js\";\n\nexport { readAndParseSnapshotBlob } from \"./readSnapshotBlob.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,yDAO6B;AAN5B,4HAAA,uBAAuB,OAAA;AAEvB,kHAAA,aAAa,OAAA;AACb,uHAAA,kBAAkB,OAAA;AAClB,0HAAA,qBAAqB,OAAA;AACrB,wHAAA,mBAAmB,OAAA;AAEpB,uCAUoB;AATnB,iGAAA,KAAK,OAAA;AAEL,uGAAA,WAAW,OAAA;AAGX,sGAAA,UAAU,OAAA;AAEV,sGAAA,UAAU,OAAA;AACV,mGAAA,OAAO,OAAA;AAER,qDAAyE;AAAhE,oHAAA,iBAAiB,OAAA;AAAE,oHAAA,iBAAiB,OAAA;AAC7C,yCAKqB;AAJpB,wGAAA,WAAW,OAAA;AACX,8GAAA,iBAAiB,OAAA;AAIlB,+CAgBwB;AAfvB,mHAAA,mBAAmB,OAAA;AACnB,mHAAA,mBAAmB,OAAA;AACnB,uHAAA,uBAAuB,OAAA;AACvB,kHAAA,kBAAkB,OAAA;AAGlB,8GAAA,cAAc,OAAA;AACd,iHAAA,iBAAiB,OAAA;AACjB,8GAAA,cAAc,OAAA;AACd,iHAAA,iBAAiB,OAAA;AACjB,mHAAA,mBAAmB,OAAA;AACnB,4GAAA,YAAY,OAAA;AACZ,mHAAA,mBAAmB,OAAA;AACnB,qHAAA,qBAAqB,OAAA;AACr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,6CAIuB;AAHtB,uGAAA,QAAQ,OAAA;AAER,iHAAA,kBAAkB,OAAA;AAGnB,mDAM0B;AAJzB,sHAAA,oBAAoB,OAAA;AACpB,sHAAA,oBAAoB,OAAA;AAEpB,iHAAA,eAAe,OAAA;AAGhB,+CAMwB;AALvB,yGAAA,SAAS,OAAA;AAET,8GAAA,cAAc,OAAA;AACd,6GAAA,aAAa,OAAA;AACb,6GAAA,aAAa,OAAA;AAGd,iDAKyB;AAHxB,8GAAA,aAAa,OAAA;AACb,iHAAA,gBAAgB,OAAA;AAChB,sHAAA,qBAAqB,OAAA;AAGtB,uEAAmE;AAA1D,iIAAA,qBAAqB,OAAA;AAE9B,6DAAiE;AAAxD,+HAAA,wBAAwB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tcollectContiguousRanges,\n\ttype IndexRange,\n\tvalidateIndex,\n\tvalidateIndexRange,\n\tvalidatePositiveIndex,\n\tvalidateSafeInteger,\n} from \"./arrayUtilities.js\";\nexport {\n\tbrand,\n\ttype Brand,\n\tBrandedType,\n\ttype NameFromBranded,\n\ttype ValueFromBranded,\n\tbrandConst,\n\ttype Values,\n\tstrictEnum,\n\tunbrand,\n} from \"./brand.js\";\nexport { brandedNumberType, brandedStringType } from \"./typeboxBrand.js\";\nexport {\n\tbrandOpaque,\n\textractFromOpaque,\n\ttype ExtractFromOpaque,\n\ttype Opaque,\n} from \"./opaque.js\";\nexport {\n\tdeleteFromNestedMap,\n\tgetOrAddInNestedMap,\n\tgetOrDefaultInNestedMap,\n\tforEachInNestedMap,\n\ttype NestedMap,\n\ttype ReadonlyNestedMap,\n\tSizedNestedMap,\n\tpopulateNestedMap,\n\tsetInNestedMap,\n\ttryAddToNestedMap,\n\ttryGetFromNestedMap,\n\tmapNestedMap,\n\tnestedMapToFlatList,\n\tnestedMapFromFlatList,\n\tgetOrCreateInNestedMap,\n} from \"./nestedMap.js\";\nexport { addToNestedSet, type NestedSet, nestedSetContains } from \"./nestedSet.js\";\nexport { type OffsetList, OffsetListFactory } from \"./offsetList.js\";\nexport type {\n\tareSafelyAssignable,\n\tContravariant,\n\tCovariant,\n\teitherIsAny,\n\tEnforceTypeCheckTests,\n\tInvariant,\n\tisAny,\n\tisAssignableTo,\n\tisStrictSubset,\n\tMakeNominal,\n\trequireFalse,\n\trequireTrue,\n\trequireAssignableTo,\n\tareOnlyKeys,\n} from \"./typeCheck.js\";\nexport { StackyIterator } from \"./stackyIterator.js\";\nexport {\n\tasMutable,\n\tbalancedReduce,\n\tcompareSets,\n\tgetOrAddEmptyToMap,\n\tgetOrCreate,\n\tisJsonObject,\n\tisReadonlyArray,\n\ttype JsonCompatible,\n\ttype JsonCompatibleObject,\n\ttype JsonCompatibleReadOnly,\n\ttype JsonCompatibleReadOnlyObject,\n\tJsonCompatibleReadOnlySchema,\n\tmakeArray,\n\tmapIterable,\n\tfilterIterable,\n\ttype Mutable,\n\ttype Populated,\n\ttype RecursiveReadonly,\n\tassertValidIndex,\n\tassertValidRange,\n\tassertNonNegativeSafeInteger,\n\tobjectToMap,\n\tinvertMap,\n\toneFromIterable,\n\tdisposeSymbol,\n\ttype IDisposable,\n\tcapitalize,\n\tassertValidRangeIndices,\n\ttransformObjectMap,\n\tcompareNumbers,\n\tcomparePartialNumbers,\n\tcompareStrings,\n\tcomparePartialStrings,\n\tfind,\n\tcount,\n\tgetLast,\n\thasSome,\n\thasSingle,\n\tdefineLazyCachedProperty,\n\tcopyPropertyIfDefined as copyProperty,\n\tgetOrAddInMap,\n\titerableHasSome,\n} from \"./utils.js\";\nexport { ReferenceCountedBase, type ReferenceCounted } from \"./referenceCounting.js\";\n\nexport type {\n\t_RecursiveTrick,\n\tRestrictiveReadonlyRecord,\n\tRestrictiveStringRecord,\n\t_InlineTrick,\n\tFlattenKeys,\n\tIsUnion,\n\tUnionToIntersection,\n\tUnionToTuple,\n\tPopUnion,\n} from \"./typeUtils.js\";\n\nexport { unsafeArrayToTuple } from \"./typeUtils.js\";\n\nexport {\n\ttype BrandedKey,\n\ttype BrandedKeyContent,\n\ttype BrandedMapSubset,\n\tgetOrCreateSlotContent,\n\tbrandedSlot,\n} from \"./brandedMap.js\";\n\nexport {\n\tRangeMap,\n\ttype RangeQueryResult,\n\tnewIntegerRangeMap,\n} from \"./rangeMap.js\";\n\nexport {\n\ttype IdAllocator,\n\tidAllocatorFromMaxId,\n\tidAllocatorFromState,\n\ttype IdAllocationState,\n\tfakeIdAllocator,\n} from \"./idAllocator.js\";\n\nexport {\n\tBreakable,\n\ttype WithBreakable,\n\tbreakingMethod,\n\tthrowIfBroken,\n\tbreakingClass,\n} from \"./breakable.js\";\n\nexport {\n\ttype TupleBTree,\n\tnewTupleBTree,\n\tmergeTupleBTrees,\n\tcreateTupleComparator,\n} from \"./bTreeUtils.js\";\n\nexport { cloneWithReplacements } from \"./cloneWithReplacements.js\";\n\nexport { readAndParseSnapshotBlob } from \"./readSnapshotBlob.js\";\n"]}
@@ -93,6 +93,19 @@ export declare class RangeMap<K, V> {
93
93
  * By default, `mergeFunc` chooses the value from `b`.
94
94
  */
95
95
  static union<K, V>(a: RangeMap<K, V>, b: RangeMap<K, V>, mergeFunc?: (key: K, valueA: V, valueB: V) => V): RangeMap<K, V>;
96
+ /**
97
+ * Calls provided handlers on intersecting portions of `mapA` and `mapB`.
98
+ * @param intersectionCallback - called once for each key range which has an entry in both `mapA` and `mapB`.
99
+ * @param residualCallback - called for each key range which only has an entry in one of the input maps,
100
+ * but which is part of a range entry that overlaps an entry in the other map.
101
+ * This may also be called for entries which are not part of an overlapping range.
102
+ */
103
+ private static forEachIntersection;
104
+ private static getOrNextEntry;
105
+ /**
106
+ * @returns a range entry representing the first defined key range greater than or equal to `key`.
107
+ */
108
+ private getOrNextEntry;
96
109
  private getIntersectingEntries;
97
110
  private gt;
98
111
  private ge;
@@ -1 +1 @@
1
- {"version":3,"file":"rangeMap.d.ts","sourceRoot":"","sources":["../../src/util/r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
7
  exports.newIntegerRangeMap = exports.RangeMap = void 0;
8
8
  const internal_1 = require("@fluidframework/core-utils/internal");
9
9
  const sorted_btree_es6_1 = require("@tylerbu/sorted-btree-es6");
10
+ // eslint-disable-next-line import-x/no-internal-modules
11
+ const union_1 = require("@tylerbu/sorted-btree-es6/extended/union");
10
12
  /**
11
13
  * RangeMap represents a mapping from keys of type K to values of type V or undefined.
12
14
  * The set of all possible keys is assumed to be fully ordered,
@@ -186,16 +188,75 @@ class RangeMap {
186
188
  (0, internal_1.assert)(a.offsetKey === b.offsetKey &&
187
189
  a.subtractKeys === b.subtractKeys &&
188
190
  a.offsetValue === b.offsetValue, 0xaae /* Maps should have the same behavior */);
189
- const merged = a.clone();
190
- for (const entryB of b.entries()) {
191
- for (const entryA of a.getAll(entryB.start, entryB.length)) {
192
- const key = b.offsetKey(entryB.start, entryA.offset);
193
- const valueB = b.offsetValue(entryB.value, entryA.offset);
194
- const mergedValue = entryA.value === undefined ? valueB : mergeFunc(key, entryA.value, valueB);
195
- merged.set(key, entryA.length, mergedValue);
191
+ const merged = new RangeMap(a.offsetKey, a.subtractKeys, a.offsetValue);
192
+ // We first union the underlying B-trees, possibly resulting in a malformed range map.
193
+ merged.tree = (0, union_1.union)(a.tree, b.tree, (key, v1, v2) => v1);
194
+ // We split the overlapping tree entries into ranges which are either fully overlapping (intersections),
195
+ // or fully non-overlapping (residuals).
196
+ // We create an entry for each of these ranges.
197
+ // After this, the merged map should be well-formed.
198
+ RangeMap.forEachIntersection(a, b, (key, length, valueA, valueB) => merged.tree.set(key, { value: mergeFunc(key, valueA, valueB), length }), (key, length, value) => merged.tree.set(key, { value, length }));
199
+ return merged;
200
+ }
201
+ /**
202
+ * Calls provided handlers on intersecting portions of `mapA` and `mapB`.
203
+ * @param intersectionCallback - called once for each key range which has an entry in both `mapA` and `mapB`.
204
+ * @param residualCallback - called for each key range which only has an entry in one of the input maps,
205
+ * but which is part of a range entry that overlaps an entry in the other map.
206
+ * This may also be called for entries which are not part of an overlapping range.
207
+ */
208
+ static forEachIntersection(mapA, mapB, intersectionCallback, residualCallback) {
209
+ let [entry1, map1, map2] = this.getOrNextEntry(mapA, mapB, undefined);
210
+ while (entry1 !== undefined) {
211
+ const entry2 = map2.getOrNextEntry(entry1.start);
212
+ if (entry2 !== undefined) {
213
+ // This is the number of keys in `entry1` that come before the first key in `entry2`.
214
+ const offset = Math.min(mapA.subtractKeys(entry2.start, entry1.start), entry1.length);
215
+ if (offset > 0) {
216
+ residualCallback(entry1.start, offset, entry1.value);
217
+ }
218
+ const intersectionLength = Math.min(entry1.length - offset, entry2.length);
219
+ if (intersectionLength > 0) {
220
+ const value1Offset = mapA.offsetValue(entry1.value, offset);
221
+ const [valueA, valueB] = map1 === mapA ? [value1Offset, entry2.value] : [entry2.value, value1Offset];
222
+ intersectionCallback(entry2.start, intersectionLength, valueA, valueB);
223
+ [entry1, map1, map2] = this.getOrNextEntry(mapA, mapB, mapA.offsetKey(entry2.start, intersectionLength));
224
+ continue;
225
+ }
196
226
  }
227
+ residualCallback(entry1.start, entry1.length, entry1.value);
228
+ [entry1, map1, map2] = this.getOrNextEntry(mapA, mapB, mapA.offsetKey(entry1.start, entry1.length));
197
229
  }
198
- return merged;
230
+ return;
231
+ }
232
+ static getOrNextEntry(mapA, mapB, key) {
233
+ const entryA = mapA.getOrNextEntry(key);
234
+ const entryB = mapB.getOrNextEntry(key);
235
+ if (entryA === undefined) {
236
+ return [entryB, mapB, mapA];
237
+ }
238
+ else if (entryB === undefined) {
239
+ return [entryA, mapA, mapB];
240
+ }
241
+ return mapA.le(entryA.start, entryB.start) ? [entryA, mapA, mapB] : [entryB, mapB, mapA];
242
+ }
243
+ /**
244
+ * @returns a range entry representing the first defined key range greater than or equal to `key`.
245
+ */
246
+ getOrNextEntry(minKey) {
247
+ const key = minKey ?? this.tree.minKey();
248
+ if (key === undefined) {
249
+ return undefined;
250
+ }
251
+ const result = this.getFirst(key, Infinity);
252
+ if (result.value !== undefined) {
253
+ return { start: key, value: result.value, length: result.length };
254
+ }
255
+ const entry = this.tree.nextHigherPair(key);
256
+ if (entry === undefined) {
257
+ return undefined;
258
+ }
259
+ return { start: entry[0], value: entry[1].value, length: entry[1].length };
199
260
  }
200
261
  getIntersectingEntries(start, length) {
201
262
  const entries = [];
@@ -1 +1 @@
1
- {"version":3,"file":"rangeMap.js","sourceRoot":"","sources":["../../src/util/rangeMap.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAC7D,gEAAkD;AAElD;;;;;;GAMG;AACH,MAAa,QAAQ;IAGpB;;;;;;;;;;;;;;;;OAgBG;IACH,YACiB,SAAwC,EACxC,YAAoC,EACpC,cAA+C,oBAAoB;QAFnE,cAAS,GAAT,SAAS,CAA+B;QACxC,iBAAY,GAAZ,YAAY,CAAwB;QACpC,gBAAW,GAAX,WAAW,CAAwD;QAEnF,IAAI,CAAC,IAAI,GAAG,IAAI,wBAAK,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACI,OAAO;QACb,MAAM,OAAO,GAA0B,EAAE,CAAC;QAC1C,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;YAClD,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;QACnE,CAAC;QAED,OAAO,OAAO,CAAC;IAChB,CAAC;IAEM,KAAK;QACX,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACnB,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,KAAQ,EAAE,MAAc;QACrC,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,MAAM,OAAO,GAA8C,EAAE,CAAC;QAE9D,OAAO,MAAM,GAAG,MAAM,EAAE,CAAC;YACxB,MAAM,GAAG,GAA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C;gBACzD,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;YAChD,CAAC;QACF,CAAC;QAED,OAAO,OAAO,CAAC;IAChB,CAAC;IAEO,EAAE,CAAC,CAAI,EAAE,CAAI;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;IAEO,EAAE,CAAC,CAAI,EAAE,CAAI;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAEO,EAAE,CAAC,CAAI,EAAE,CAAI;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;IAEO,EAAE,CAAC,CAAI,EAAE,CAAI;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;CACD;AA1QD,4BA0QC;AAiDD,SAAgB,kBAAkB;IACjC,OAAO,IAAI,QAAQ,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;AACtD,CAAC;AAFD,gDAEC;AAED,SAAS,aAAa,CAAmB,GAAM,EAAE,MAAc;IAC9D,OAAO,CAAC,GAAG,GAAG,MAAM,CAAM,CAAC;AAC5B,CAAC;AAED,SAAS,gBAAgB,CAAmB,CAAI,EAAE,CAAI;IACrD,OAAO,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;AAED,SAAS,oBAAoB,CAAI,KAAQ,EAAE,MAAc;IACxD,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { BTree } from \"@tylerbu/sorted-btree-es6\";\n\n/**\n * RangeMap represents a mapping from keys of type K to values of type V or undefined.\n * The set of all possible keys is assumed to be fully ordered,\n * and for each key there should be a single next higher key.\n * The values for a range of consecutive keys can be changed or queried in a single operation.\n * The structure of the keys is described by the `offsetKey` and `subtractKeys` functions provided in the constructor.\n */\nexport class RangeMap<K, V> {\n\tprivate tree: BTree<K, RangeEntry<V>>;\n\n\t/**\n\t * @param offsetKey - Function which returns a new key which is `offset` keys after `key`.\n\t * When `offset` is negative, the returned key should come before `key`.\n\t *\n\t * @param subtractKeys - Function which returns the difference between `b` and `a`.\n\t * Offsetting `b` by this difference should return `a`.\n\t * The difference can be infinite if `a` cannot be reached from `b` by offsetting,\n\t * but the difference should still be positive if `a` is larger than `b` and negative if smaller.\n\t *\n\t * @param offsetValue - Function used to associate a range of values with a range of keys.\n\t * When writing to a range of keys starting with `start`, the value of the nth key is interpreted to be\n\t * `offsetValue(firstValue, n - 1)`.\n\t * The same logic should be used when interpreting the values for keys after the first in a\n\t * `RangeQueryResult` or `RangeMapEntry`.\n\t *\n\t * If `offsetValue` is left unspecified, all keys in a block will be given the same value.\n\t */\n\tpublic constructor(\n\t\tpublic readonly offsetKey: (key: K, offset: number) => K,\n\t\tpublic readonly subtractKeys: (a: K, b: K) => number,\n\t\tpublic readonly offsetValue: (value: V, offset: number) => V = defaultValueOffsetFn,\n\t) {\n\t\tthis.tree = new BTree(undefined, subtractKeys);\n\t}\n\n\t/**\n\t * Retrieves all entries from the RangeMap.\n\t */\n\tpublic entries(): RangeMapEntry<K, V>[] {\n\t\tconst entries: RangeMapEntry<K, V>[] = [];\n\t\tfor (const [start, entry] of this.tree.entries()) {\n\t\t\tentries.push({ start, length: entry.length, value: entry.value });\n\t\t}\n\n\t\treturn entries;\n\t}\n\n\tpublic clear(): void {\n\t\tthis.tree.clear();\n\t}\n\n\t/**\n\t * Retrieves the values for all keys in the query range.\n\t *\n\t * @param start - The first key in the range being queried\n\t * @param length - The length of the query range\n\t * @returns A list of fragments, each describing the value for a subrange of the query.\n\t * The fragments are in the same order as the keys.\n\t * The key for each fragment is `start` offset by `fragment.offset`.\n\t */\n\tpublic getAll(start: K, length: number): RangeQueryResultFragment<V | undefined>[] {\n\t\tlet offset = 0;\n\t\tconst results: RangeQueryResultFragment<V | undefined>[] = [];\n\n\t\twhile (offset < length) {\n\t\t\tconst key = this.offsetKey(start, offset);\n\t\t\tconst result = this.getFirst(key, length - offset);\n\t\t\tresults.push({ offset, value: result.value, length: result.length });\n\t\t\toffset += result.length;\n\t\t}\n\n\t\treturn results;\n\t}\n\n\t/**\n\t * Retrieves the value for some prefix of the query range.\n\t *\n\t * @param start - The first key in the query range.\n\t * @param length - The length of the query range.\n\t * @returns A RangeQueryResult containing the value associated with `start`,\n\t * and the number of consecutive keys with that same value (at least 1, at most `length`).\n\t */\n\tpublic getFirst(start: K, length: number): RangeQueryResult<V | undefined> {\n\t\t{\n\t\t\t// We first check for an entry with a key less than or equal to `start`.\n\t\t\tconst entry = this.tree.getPairOrNextLower(start);\n\t\t\tif (entry !== undefined) {\n\t\t\t\tconst entryKey = entry[0];\n\t\t\t\tconst { value, length: entryLength } = entry[1];\n\n\t\t\t\tconst entryLastKey = this.offsetKey(entryKey, entryLength - 1);\n\t\t\t\tconst lengthBeforeQuery = this.subtractKeys(start, entryKey);\n\t\t\t\tconst overlappingLength = Math.min(this.subtractKeys(entryLastKey, start) + 1, length);\n\t\t\t\tif (overlappingLength > 0) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tvalue: this.offsetValue(value, lengthBeforeQuery),\n\t\t\t\t\t\tlength: overlappingLength,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t{\n\t\t\t// There is no value associated with `start`.\n\t\t\t// Now we need to determine how many of the following keys are also undefined.\n\t\t\tconst key = this.tree.nextHigherKey(start);\n\t\t\tif (key !== undefined) {\n\t\t\t\tconst entryKey = key;\n\n\t\t\t\tconst lastQueryKey = this.offsetKey(start, length - 1);\n\t\t\t\tif (this.le(entryKey, lastQueryKey)) {\n\t\t\t\t\treturn { value: undefined, length: this.subtractKeys(entryKey, start) };\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn { value: undefined, length };\n\t\t}\n\t}\n\n\t/**\n\t * Sets the value for a specified range.\n\t *\n\t * @param start - The first key in the range being set.\n\t * @param length - The length of the range.\n\t * @param value - The value to associate with the range.\n\t */\n\tpublic set(start: K, length: number, value: V | undefined): void {\n\t\tthis.delete(start, length);\n\t\tif (value !== undefined) {\n\t\t\tthis.tree.set(start, { value, length });\n\t\t}\n\t}\n\n\t/**\n\t * Deletes values within a specified range, updating or removing existing entries.\n\t *\n\t * 1. If an entry is completely included in the deletion range, the whole entry will be deleted\n\t * e.g.: map = [[1, 2], [4, 6]], delete range: [3, 6]\n\t * map becomes [[1, 2]] after deletion\n\t * (Note: the notation [a, b] represents start = a, end = b for simpler visualization, instead of `b`\n\t * representing the length)\n\t *\n\t * 2. If an entry is partially overlapped with the deletion range, the start or end point will be shifted\n\t * e.g.: map = [[1, 2], [4, 6]], delete range: [2, 4]\n\t * map becomes [[1, 1], [5, 6]] after deletion\n\t *\n\t * 3. If an entry completely includes the deletion range, the original entry may be split into two.\n\t * e.g.: map = [[1, 6]], delete range: [2, 4]\n\t * map becomes [[1, 1], [5, 6]]\n\t *\n\t * @param start - The start of the range to delete (inclusive).\n\t * @param length - The length of the range to delete.\n\t * @returns The number of keys/value pairs deleted (integer between 0 and `length`, inclusive).\n\t */\n\tpublic delete(start: K, length: number): number {\n\t\tlet deleteCount = 0;\n\t\tconst lastDeleteKey = this.offsetKey(start, length - 1);\n\t\tfor (const { start: key, length: entryLength, value } of this.getIntersectingEntries(\n\t\t\tstart,\n\t\t\tlength,\n\t\t)) {\n\t\t\tdeleteCount += entryLength;\n\t\t\tthis.tree.delete(key);\n\t\t\tconst lengthBefore = this.subtractKeys(start, key);\n\t\t\tif (lengthBefore > 0) {\n\t\t\t\t// A portion of this entry comes before the deletion range, so we reinsert that portion.\n\t\t\t\tthis.tree.set(key, { length: lengthBefore, value });\n\t\t\t\tdeleteCount -= lengthBefore;\n\t\t\t}\n\n\t\t\tconst lastEntryKey = this.offsetKey(key, entryLength - 1);\n\t\t\tconst lengthAfter = this.subtractKeys(lastEntryKey, lastDeleteKey);\n\t\t\tif (lengthAfter > 0) {\n\t\t\t\t// A portion of this entry comes after the deletion range, so we reinsert that portion.\n\t\t\t\tconst newKey = this.offsetKey(lastDeleteKey, 1);\n\t\t\t\tconst difference = this.subtractKeys(newKey, key);\n\t\t\t\tthis.tree.set(newKey, {\n\t\t\t\t\tlength: lengthAfter,\n\t\t\t\t\tvalue: this.offsetValue(value, difference),\n\t\t\t\t});\n\t\t\t\tdeleteCount -= lengthAfter;\n\t\t\t}\n\t\t}\n\t\treturn deleteCount;\n\t}\n\n\tpublic clone(): RangeMap<K, V> {\n\t\tconst cloned = new RangeMap<K, V>(this.offsetKey, this.subtractKeys, this.offsetValue);\n\t\tcloned.tree = this.tree.clone();\n\t\treturn cloned;\n\t}\n\n\t/**\n\t * Returns a new map which contains the entries from both input maps.\n\t * Whenever both maps contain entries for the same keys, the value is determined by calling `mergeFunc`.\n\t * By default, `mergeFunc` chooses the value from `b`.\n\t */\n\tpublic static union<K, V>(\n\t\ta: RangeMap<K, V>,\n\t\tb: RangeMap<K, V>,\n\t\tmergeFunc: (key: K, valueA: V, valueB: V) => V = (_k, _a, valB) => valB,\n\t): RangeMap<K, V> {\n\t\tassert(\n\t\t\ta.offsetKey === b.offsetKey &&\n\t\t\t\ta.subtractKeys === b.subtractKeys &&\n\t\t\t\ta.offsetValue === b.offsetValue,\n\t\t\t0xaae /* Maps should have the same behavior */,\n\t\t);\n\n\t\tconst merged = a.clone();\n\t\tfor (const entryB of b.entries()) {\n\t\t\tfor (const entryA of a.getAll(entryB.start, entryB.length)) {\n\t\t\t\tconst key = b.offsetKey(entryB.start, entryA.offset);\n\t\t\t\tconst valueB = b.offsetValue(entryB.value, entryA.offset);\n\t\t\t\tconst mergedValue =\n\t\t\t\t\tentryA.value === undefined ? valueB : mergeFunc(key, entryA.value, valueB);\n\n\t\t\t\tmerged.set(key, entryA.length, mergedValue);\n\t\t\t}\n\t\t}\n\n\t\treturn merged;\n\t}\n\n\tprivate getIntersectingEntries(start: K, length: number): RangeMapEntry<K, V>[] {\n\t\tconst entries: RangeMapEntry<K, V>[] = [];\n\t\tconst lastQueryKey = this.offsetKey(start, length - 1);\n\t\t{\n\t\t\tconst entry = this.tree.getPairOrNextLower(start);\n\t\t\tif (entry !== undefined) {\n\t\t\t\tconst key = entry[0];\n\t\t\t\tconst { length: entryLength, value } = entry[1];\n\t\t\t\tconst lastEntryKey = this.offsetKey(key, entryLength - 1);\n\t\t\t\tif (this.ge(lastEntryKey, start)) {\n\t\t\t\t\tentries.push({ start: key, length: entryLength, value });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t{\n\t\t\tlet entry = this.tree.nextHigherPair(start);\n\t\t\twhile (entry !== undefined) {\n\t\t\t\tconst key = entry[0];\n\t\t\t\tif (this.gt(key, lastQueryKey)) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tconst { length: entryLength, value } = entry[1];\n\t\t\t\tconst lastEntryKey = this.offsetKey(key, entryLength - 1);\n\n\t\t\t\tentries.push({ start: key, length: entryLength, value });\n\t\t\t\tentry = this.tree.nextHigherPair(lastEntryKey);\n\t\t\t}\n\t\t}\n\n\t\treturn entries;\n\t}\n\n\tprivate gt(a: K, b: K): boolean {\n\t\treturn this.subtractKeys(a, b) > 0;\n\t}\n\n\tprivate ge(a: K, b: K): boolean {\n\t\treturn this.subtractKeys(a, b) >= 0;\n\t}\n\n\tprivate lt(a: K, b: K): boolean {\n\t\treturn this.subtractKeys(a, b) < 0;\n\t}\n\n\tprivate le(a: K, b: K): boolean {\n\t\treturn this.subtractKeys(a, b) <= 0;\n\t}\n}\n\n/**\n * Represents a contiguous range of values in the RangeMap.\n */\ninterface RangeEntry<V> {\n\t/**\n\t * The length of the range.\n\t */\n\treadonly length: number;\n\n\t/**\n\t * The value associated with this range.\n\t */\n\treadonly value: V;\n}\n\n/**\n * Describes the result of a range query, including the value and length of the matching prefix.\n */\nexport interface RangeQueryResult<V> {\n\t/**\n\t * The value of the first key in the query range.\n\t */\n\treadonly value: V;\n\n\t/**\n\t * The length of the prefix of the query range which has the same value.\n\t * For example, if a RangeMap has the same value for keys 5, 6, and 7,\n\t * a query about the range [5, 10] would give a result with length 3.\n\t */\n\treadonly length: number;\n}\n\nexport interface RangeQueryResultFragment<V> extends RangeQueryResult<V> {\n\t/**\n\t * The offset from the query key to the key this result is associated with.\n\t * This is useful in the case where a query returns multiple `RangeQueryResults`\n\t * addressing the key range.\n\t */\n\treadonly offset: number;\n}\n\nexport interface RangeMapEntry<K, V> {\n\treadonly start: K;\n\treadonly value: V;\n\treadonly length: number;\n}\n\nexport function newIntegerRangeMap<V, K extends number = number>(): RangeMap<K, V> {\n\treturn new RangeMap(offsetInteger, subtractIntegers);\n}\n\nfunction offsetInteger<K extends number>(key: K, offset: number): K {\n\treturn (key + offset) as K;\n}\n\nfunction subtractIntegers<K extends number>(a: K, b: K): number {\n\treturn a - b;\n}\n\nfunction defaultValueOffsetFn<T>(value: T, offset: number): T {\n\treturn value;\n}\n"]}
1
+ {"version":3,"file":"rangeMap.js","sourceRoot":"","sources":["../../src/util/rangeMap.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAC7D,gEAAkD;AAClD,wDAAwD;AACxD,oEAAiE;AAEjE;;;;;;GAMG;AACH,MAAa,QAAQ;IAGpB;;;;;;;;;;;;;;;;OAgBG;IACH,YACiB,SAAwC,EACxC,YAAoC,EACpC,cAA+C,oBAAoB;QAFnE,cAAS,GAAT,SAAS,CAA+B;QACxC,iBAAY,GAAZ,YAAY,CAAwB;QACpC,gBAAW,GAAX,WAAW,CAAwD;QAEnF,IAAI,CAAC,IAAI,GAAG,IAAI,wBAAK,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACI,OAAO;Q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AC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { BTree } from \"@tylerbu/sorted-btree-es6\";\n// eslint-disable-next-line import-x/no-internal-modules\nimport { union } from \"@tylerbu/sorted-btree-es6/extended/union\";\n\n/**\n * RangeMap represents a mapping from keys of type K to values of type V or undefined.\n * The set of all possible keys is assumed to be fully ordered,\n * and for each key there should be a single next higher key.\n * The values for a range of consecutive keys can be changed or queried in a single operation.\n * The structure of the keys is described by the `offsetKey` and `subtractKeys` functions provided in the constructor.\n */\nexport class RangeMap<K, V> {\n\tprivate tree: BTree<K, RangeEntry<V>>;\n\n\t/**\n\t * @param offsetKey - Function which returns a new key which is `offset` keys after `key`.\n\t * When `offset` is negative, the returned key should come before `key`.\n\t *\n\t * @param subtractKeys - Function which returns the difference between `b` and `a`.\n\t * Offsetting `b` by this difference should return `a`.\n\t * The difference can be infinite if `a` cannot be reached from `b` by offsetting,\n\t * but the difference should still be positive if `a` is larger than `b` and negative if smaller.\n\t *\n\t * @param offsetValue - Function used to associate a range of values with a range of keys.\n\t * When writing to a range of keys starting with `start`, the value of the nth key is interpreted to be\n\t * `offsetValue(firstValue, n - 1)`.\n\t * The same logic should be used when interpreting the values for keys after the first in a\n\t * `RangeQueryResult` or `RangeMapEntry`.\n\t *\n\t * If `offsetValue` is left unspecified, all keys in a block will be given the same value.\n\t */\n\tpublic constructor(\n\t\tpublic readonly offsetKey: (key: K, offset: number) => K,\n\t\tpublic readonly subtractKeys: (a: K, b: K) => number,\n\t\tpublic readonly offsetValue: (value: V, offset: number) => V = defaultValueOffsetFn,\n\t) {\n\t\tthis.tree = new BTree(undefined, subtractKeys);\n\t}\n\n\t/**\n\t * Retrieves all entries from the RangeMap.\n\t */\n\tpublic entries(): RangeMapEntry<K, V>[] {\n\t\tconst entries: RangeMapEntry<K, V>[] = [];\n\t\tfor (const [start, entry] of this.tree.entries()) {\n\t\t\tentries.push({ start, length: entry.length, value: entry.value });\n\t\t}\n\n\t\treturn entries;\n\t}\n\n\tpublic clear(): void {\n\t\tthis.tree.clear();\n\t}\n\n\t/**\n\t * Retrieves the values for all keys in the query range.\n\t *\n\t * @param start - The first key in the range being queried\n\t * @param length - The length of the query range\n\t * @returns A list of fragments, each describing the value for a subrange of the query.\n\t * The fragments are in the same order as the keys.\n\t * The key for each fragment is `start` offset by `fragment.offset`.\n\t */\n\tpublic getAll(start: K, length: number): RangeQueryResultFragment<V | undefined>[] {\n\t\tlet offset = 0;\n\t\tconst results: RangeQueryResultFragment<V | undefined>[] = [];\n\n\t\twhile (offset < length) {\n\t\t\tconst key = this.offsetKey(start, offset);\n\t\t\tconst result = this.getFirst(key, length - offset);\n\t\t\tresults.push({ offset, value: result.value, length: result.length });\n\t\t\toffset += result.length;\n\t\t}\n\n\t\treturn results;\n\t}\n\n\t/**\n\t * Retrieves the value for some prefix of the query range.\n\t *\n\t * @param start - The first key in the query range.\n\t * @param length - The length of the query range.\n\t * @returns A RangeQueryResult containing the value associated with `start`,\n\t * and the number of consecutive keys with that same value (at least 1, at most `length`).\n\t */\n\tpublic getFirst(start: K, length: number): RangeQueryResult<V | undefined> {\n\t\t{\n\t\t\t// We first check for an entry with a key less than or equal to `start`.\n\t\t\tconst entry = this.tree.getPairOrNextLower(start);\n\t\t\tif (entry !== undefined) {\n\t\t\t\tconst entryKey = entry[0];\n\t\t\t\tconst { value, length: entryLength } = entry[1];\n\n\t\t\t\tconst entryLastKey = this.offsetKey(entryKey, entryLength - 1);\n\t\t\t\tconst lengthBeforeQuery = this.subtractKeys(start, entryKey);\n\t\t\t\tconst overlappingLength = Math.min(this.subtractKeys(entryLastKey, start) + 1, length);\n\t\t\t\tif (overlappingLength > 0) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tvalue: this.offsetValue(value, lengthBeforeQuery),\n\t\t\t\t\t\tlength: overlappingLength,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t{\n\t\t\t// There is no value associated with `start`.\n\t\t\t// Now we need to determine how many of the following keys are also undefined.\n\t\t\tconst key = this.tree.nextHigherKey(start);\n\t\t\tif (key !== undefined) {\n\t\t\t\tconst entryKey = key;\n\n\t\t\t\tconst lastQueryKey = this.offsetKey(start, length - 1);\n\t\t\t\tif (this.le(entryKey, lastQueryKey)) {\n\t\t\t\t\treturn { value: undefined, length: this.subtractKeys(entryKey, start) };\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn { value: undefined, length };\n\t\t}\n\t}\n\n\t/**\n\t * Sets the value for a specified range.\n\t *\n\t * @param start - The first key in the range being set.\n\t * @param length - The length of the range.\n\t * @param value - The value to associate with the range.\n\t */\n\tpublic set(start: K, length: number, value: V | undefined): void {\n\t\tthis.delete(start, length);\n\t\tif (value !== undefined) {\n\t\t\tthis.tree.set(start, { value, length });\n\t\t}\n\t}\n\n\t/**\n\t * Deletes values within a specified range, updating or removing existing entries.\n\t *\n\t * 1. If an entry is completely included in the deletion range, the whole entry will be deleted\n\t * e.g.: map = [[1, 2], [4, 6]], delete range: [3, 6]\n\t * map becomes [[1, 2]] after deletion\n\t * (Note: the notation [a, b] represents start = a, end = b for simpler visualization, instead of `b`\n\t * representing the length)\n\t *\n\t * 2. If an entry is partially overlapped with the deletion range, the start or end point will be shifted\n\t * e.g.: map = [[1, 2], [4, 6]], delete range: [2, 4]\n\t * map becomes [[1, 1], [5, 6]] after deletion\n\t *\n\t * 3. If an entry completely includes the deletion range, the original entry may be split into two.\n\t * e.g.: map = [[1, 6]], delete range: [2, 4]\n\t * map becomes [[1, 1], [5, 6]]\n\t *\n\t * @param start - The start of the range to delete (inclusive).\n\t * @param length - The length of the range to delete.\n\t * @returns The number of keys/value pairs deleted (integer between 0 and `length`, inclusive).\n\t */\n\tpublic delete(start: K, length: number): number {\n\t\tlet deleteCount = 0;\n\t\tconst lastDeleteKey = this.offsetKey(start, length - 1);\n\t\tfor (const { start: key, length: entryLength, value } of this.getIntersectingEntries(\n\t\t\tstart,\n\t\t\tlength,\n\t\t)) {\n\t\t\tdeleteCount += entryLength;\n\t\t\tthis.tree.delete(key);\n\t\t\tconst lengthBefore = this.subtractKeys(start, key);\n\t\t\tif (lengthBefore > 0) {\n\t\t\t\t// A portion of this entry comes before the deletion range, so we reinsert that portion.\n\t\t\t\tthis.tree.set(key, { length: lengthBefore, value });\n\t\t\t\tdeleteCount -= lengthBefore;\n\t\t\t}\n\n\t\t\tconst lastEntryKey = this.offsetKey(key, entryLength - 1);\n\t\t\tconst lengthAfter = this.subtractKeys(lastEntryKey, lastDeleteKey);\n\t\t\tif (lengthAfter > 0) {\n\t\t\t\t// A portion of this entry comes after the deletion range, so we reinsert that portion.\n\t\t\t\tconst newKey = this.offsetKey(lastDeleteKey, 1);\n\t\t\t\tconst difference = this.subtractKeys(newKey, key);\n\t\t\t\tthis.tree.set(newKey, {\n\t\t\t\t\tlength: lengthAfter,\n\t\t\t\t\tvalue: this.offsetValue(value, difference),\n\t\t\t\t});\n\t\t\t\tdeleteCount -= lengthAfter;\n\t\t\t}\n\t\t}\n\t\treturn deleteCount;\n\t}\n\n\tpublic clone(): RangeMap<K, V> {\n\t\tconst cloned = new RangeMap<K, V>(this.offsetKey, this.subtractKeys, this.offsetValue);\n\t\tcloned.tree = this.tree.clone();\n\t\treturn cloned;\n\t}\n\n\t/**\n\t * Returns a new map which contains the entries from both input maps.\n\t * Whenever both maps contain entries for the same keys, the value is determined by calling `mergeFunc`.\n\t * By default, `mergeFunc` chooses the value from `b`.\n\t */\n\tpublic static union<K, V>(\n\t\ta: RangeMap<K, V>,\n\t\tb: RangeMap<K, V>,\n\t\tmergeFunc: (key: K, valueA: V, valueB: V) => V = (_k, _a, valB) => valB,\n\t): RangeMap<K, V> {\n\t\tassert(\n\t\t\ta.offsetKey === b.offsetKey &&\n\t\t\t\ta.subtractKeys === b.subtractKeys &&\n\t\t\t\ta.offsetValue === b.offsetValue,\n\t\t\t0xaae /* Maps should have the same behavior */,\n\t\t);\n\n\t\tconst merged = new RangeMap<K, V>(a.offsetKey, a.subtractKeys, a.offsetValue);\n\n\t\t// We first union the underlying B-trees, possibly resulting in a malformed range map.\n\t\tmerged.tree = union<BTree<K, RangeEntry<V>>, K, RangeEntry<V>>(\n\t\t\ta.tree,\n\t\t\tb.tree,\n\t\t\t(key, v1, v2) => v1,\n\t\t);\n\n\t\t// We split the overlapping tree entries into ranges which are either fully overlapping (intersections),\n\t\t// or fully non-overlapping (residuals).\n\t\t// We create an entry for each of these ranges.\n\t\t// After this, the merged map should be well-formed.\n\t\tRangeMap.forEachIntersection(\n\t\t\ta,\n\t\t\tb,\n\t\t\t(key, length, valueA, valueB) =>\n\t\t\t\tmerged.tree.set(key, { value: mergeFunc(key, valueA, valueB), length }),\n\t\t\t(key, length, value) => merged.tree.set(key, { value, length }),\n\t\t);\n\n\t\treturn merged;\n\t}\n\n\t/**\n\t * Calls provided handlers on intersecting portions of `mapA` and `mapB`.\n\t * @param intersectionCallback - called once for each key range which has an entry in both `mapA` and `mapB`.\n\t * @param residualCallback - called for each key range which only has an entry in one of the input maps,\n\t * but which is part of a range entry that overlaps an entry in the other map.\n\t * This may also be called for entries which are not part of an overlapping range.\n\t */\n\tprivate static forEachIntersection<K, V>(\n\t\tmapA: RangeMap<K, V>,\n\t\tmapB: RangeMap<K, V>,\n\t\tintersectionCallback: (key: K, length: number, valueA: V, valueB: V) => void,\n\t\tresidualCallback: (key: K, length: number, value: V) => void,\n\t): void {\n\t\tlet [entry1, map1, map2] = this.getOrNextEntry(mapA, mapB, undefined);\n\t\twhile (entry1 !== undefined) {\n\t\t\tconst entry2 = map2.getOrNextEntry(entry1.start);\n\t\t\tif (entry2 !== undefined) {\n\t\t\t\t// This is the number of keys in `entry1` that come before the first key in `entry2`.\n\t\t\t\tconst offset = Math.min(mapA.subtractKeys(entry2.start, entry1.start), entry1.length);\n\t\t\t\tif (offset > 0) {\n\t\t\t\t\tresidualCallback(entry1.start, offset, entry1.value);\n\t\t\t\t}\n\n\t\t\t\tconst intersectionLength = Math.min(entry1.length - offset, entry2.length);\n\t\t\t\tif (intersectionLength > 0) {\n\t\t\t\t\tconst value1Offset = mapA.offsetValue(entry1.value, offset);\n\t\t\t\t\tconst [valueA, valueB] =\n\t\t\t\t\t\tmap1 === mapA ? [value1Offset, entry2.value] : [entry2.value, value1Offset];\n\n\t\t\t\t\tintersectionCallback(entry2.start, intersectionLength, valueA, valueB);\n\t\t\t\t\t[entry1, map1, map2] = this.getOrNextEntry(\n\t\t\t\t\t\tmapA,\n\t\t\t\t\t\tmapB,\n\t\t\t\t\t\tmapA.offsetKey(entry2.start, intersectionLength),\n\t\t\t\t\t);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tresidualCallback(entry1.start, entry1.length, entry1.value);\n\t\t\t[entry1, map1, map2] = this.getOrNextEntry(\n\t\t\t\tmapA,\n\t\t\t\tmapB,\n\t\t\t\tmapA.offsetKey(entry1.start, entry1.length),\n\t\t\t);\n\t\t}\n\n\t\treturn;\n\t}\n\n\tprivate static getOrNextEntry<K, V>(\n\t\tmapA: RangeMap<K, V>,\n\t\tmapB: RangeMap<K, V>,\n\t\tkey: K | undefined,\n\t): [RangeMapEntry<K, V> | undefined, firstMap: RangeMap<K, V>, secondMap: RangeMap<K, V>] {\n\t\tconst entryA = mapA.getOrNextEntry(key);\n\t\tconst entryB = mapB.getOrNextEntry(key);\n\t\tif (entryA === undefined) {\n\t\t\treturn [entryB, mapB, mapA];\n\t\t} else if (entryB === undefined) {\n\t\t\treturn [entryA, mapA, mapB];\n\t\t}\n\n\t\treturn mapA.le(entryA.start, entryB.start) ? [entryA, mapA, mapB] : [entryB, mapB, mapA];\n\t}\n\n\t/**\n\t * @returns a range entry representing the first defined key range greater than or equal to `key`.\n\t */\n\tprivate getOrNextEntry(minKey: K | undefined): RangeMapEntry<K, V> | undefined {\n\t\tconst key = minKey ?? this.tree.minKey();\n\t\tif (key === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst result = this.getFirst(key, Infinity);\n\t\tif (result.value !== undefined) {\n\t\t\treturn { start: key, value: result.value, length: result.length };\n\t\t}\n\n\t\tconst entry = this.tree.nextHigherPair(key);\n\t\tif (entry === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn { start: entry[0], value: entry[1].value, length: entry[1].length };\n\t}\n\n\tprivate getIntersectingEntries(start: K, length: number): RangeMapEntry<K, V>[] {\n\t\tconst entries: RangeMapEntry<K, V>[] = [];\n\t\tconst lastQueryKey = this.offsetKey(start, length - 1);\n\t\t{\n\t\t\tconst entry = this.tree.getPairOrNextLower(start);\n\t\t\tif (entry !== undefined) {\n\t\t\t\tconst key = entry[0];\n\t\t\t\tconst { length: entryLength, value } = entry[1];\n\t\t\t\tconst lastEntryKey = this.offsetKey(key, entryLength - 1);\n\t\t\t\tif (this.ge(lastEntryKey, start)) {\n\t\t\t\t\tentries.push({ start: key, length: entryLength, value });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t{\n\t\t\tlet entry = this.tree.nextHigherPair(start);\n\t\t\twhile (entry !== undefined) {\n\t\t\t\tconst key = entry[0];\n\t\t\t\tif (this.gt(key, lastQueryKey)) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tconst { length: entryLength, value } = entry[1];\n\t\t\t\tconst lastEntryKey = this.offsetKey(key, entryLength - 1);\n\n\t\t\t\tentries.push({ start: key, length: entryLength, value });\n\t\t\t\tentry = this.tree.nextHigherPair(lastEntryKey);\n\t\t\t}\n\t\t}\n\n\t\treturn entries;\n\t}\n\n\tprivate gt(a: K, b: K): boolean {\n\t\treturn this.subtractKeys(a, b) > 0;\n\t}\n\n\tprivate ge(a: K, b: K): boolean {\n\t\treturn this.subtractKeys(a, b) >= 0;\n\t}\n\n\tprivate lt(a: K, b: K): boolean {\n\t\treturn this.subtractKeys(a, b) < 0;\n\t}\n\n\tprivate le(a: K, b: K): boolean {\n\t\treturn this.subtractKeys(a, b) <= 0;\n\t}\n}\n\n/**\n * Represents a contiguous range of values in the RangeMap.\n */\ninterface RangeEntry<V> {\n\t/**\n\t * The length of the range.\n\t */\n\treadonly length: number;\n\n\t/**\n\t * The value associated with this range.\n\t */\n\treadonly value: V;\n}\n\n/**\n * Describes the result of a range query, including the value and length of the matching prefix.\n */\nexport interface RangeQueryResult<V> {\n\t/**\n\t * The value of the first key in the query range.\n\t */\n\treadonly value: V;\n\n\t/**\n\t * The length of the prefix of the query range which has the same value.\n\t * For example, if a RangeMap has the same value for keys 5, 6, and 7,\n\t * a query about the range [5, 10] would give a result with length 3.\n\t */\n\treadonly length: number;\n}\n\nexport interface RangeQueryResultFragment<V> extends RangeQueryResult<V> {\n\t/**\n\t * The offset from the query key to the key this result is associated with.\n\t * This is useful in the case where a query returns multiple `RangeQueryResults`\n\t * addressing the key range.\n\t */\n\treadonly offset: number;\n}\n\nexport interface RangeMapEntry<K, V> {\n\treadonly start: K;\n\treadonly value: V;\n\treadonly length: number;\n}\n\nexport function newIntegerRangeMap<V, K extends number = number>(): RangeMap<K, V> {\n\treturn new RangeMap(offsetInteger, subtractIntegers);\n}\n\nfunction offsetInteger<K extends number>(key: K, offset: number): K {\n\treturn (key + offset) as K;\n}\n\nfunction subtractIntegers<K extends number>(a: K, b: K): number {\n\treturn a - b;\n}\n\nfunction defaultValueOffsetFn<T>(value: T, offset: number): T {\n\treturn value;\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type NumberOptions, type TUnsafe } from "@sinclair/typebox";
5
+ import type { NumberOptions, TUnsafe } from "@sinclair/typebox";
6
6
  /**
7
7
  * Create a TypeBox string schema for a branded string type.
8
8
  * This only validates that the value is a string,
@@ -1 +1 @@
1
- {"version":3,"file":"typeboxBrand.d.ts","sourceRoot":"","sources":["../../src/util/typeboxBrand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,OAAO,EAAQ,MAAM,mBAAmB,CAAC;AAE3E;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,CAOhE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EACjD,OAAO,CAAC,EAAE,aAAa,GAAG,SAAS,GACjC,OAAO,CAAC,CAAC,CAAC,CAGZ"}
1
+ {"version":3,"file":"typeboxBrand.d.ts","sourceRoot":"","sources":["../../src/util/typeboxBrand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEhE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,CAOhE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EACjD,OAAO,CAAC,EAAE,aAAa,GAAG,SAAS,GACjC,OAAO,CAAC,CAAC,CAAC,CAGZ"}
@@ -5,7 +5,8 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.brandedNumberType = exports.brandedStringType = void 0;
8
- const typebox_1 = require("@sinclair/typebox");
8
+ const tslib_1 = require("tslib");
9
+ const Type = tslib_1.__importStar(require("@sinclair/typebox"));
9
10
  /**
10
11
  * Create a TypeBox string schema for a branded string type.
11
12
  * This only validates that the value is a string,
@@ -17,7 +18,7 @@ function brandedStringType() {
17
18
  // Since there isn't any useful custom validation to do and
18
19
  // TUnsafe is documented as unsupported in `typebox/compiler`,
19
20
  // opt for the compile time behavior like the above, but the runtime behavior of the built in string type.
20
- return typebox_1.Type.String();
21
+ return Type.String();
21
22
  }
22
23
  exports.brandedStringType = brandedStringType;
23
24
  /**
@@ -26,7 +27,7 @@ exports.brandedStringType = brandedStringType;
26
27
  */
27
28
  function brandedNumberType(options) {
28
29
  // See comments on `brandedStringType`.
29
- return typebox_1.Type.Number(options);
30
+ return Type.Number(options);
30
31
  }
31
32
  exports.brandedNumberType = brandedNumberType;
32
33
  //# sourceMappingURL=typeboxBrand.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"typeboxBrand.js","sourceRoot":"","sources":["../../src/util/typeboxBrand.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAA2E;AAE3E;;;;GAIG;AACH,SAAgB,iBAAiB;IAChC,kBAAkB;IAClB,0FAA0F;IAC1F,2DAA2D;IAC3D,8DAA8D;IAC9D,0GAA0G;IAC1G,OAAO,cAAI,CAAC,MAAM,EAA2B,CAAC;AAC/C,CAAC;AAPD,8CAOC;AAED;;;GAGG;AACH,SAAgB,iBAAiB,CAChC,OAAmC;IAEnC,uCAAuC;IACvC,OAAO,cAAI,CAAC,MAAM,CAAC,OAAO,CAA0B,CAAC;AACtD,CAAC;AALD,8CAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type NumberOptions, type TUnsafe, Type } from \"@sinclair/typebox\";\n\n/**\n * Create a TypeBox string schema for a branded string type.\n * This only validates that the value is a string,\n * and not that it came from the correct branded type (that information is lost when serialized).\n */\nexport function brandedStringType<T extends string>(): TUnsafe<T> {\n\t// This could use:\n\t// return TypeSystem.CreateType<T>(name, (options, value) => typeof value === \"string\")();\n\t// Since there isn't any useful custom validation to do and\n\t// TUnsafe is documented as unsupported in `typebox/compiler`,\n\t// opt for the compile time behavior like the above, but the runtime behavior of the built in string type.\n\treturn Type.String() as unknown as TUnsafe<T>;\n}\n\n/**\n * Create a TypeBox number schema for a branded number type.\n * {@link brandedStringType} but for numbers.\n */\nexport function brandedNumberType<T extends number>(\n\toptions?: NumberOptions | undefined,\n): TUnsafe<T> {\n\t// See comments on `brandedStringType`.\n\treturn Type.Number(options) as unknown as TUnsafe<T>;\n}\n"]}
1
+ {"version":3,"file":"typeboxBrand.js","sourceRoot":"","sources":["../../src/util/typeboxBrand.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,gEAA0C;AAG1C;;;;GAIG;AACH,SAAgB,iBAAiB;IAChC,kBAAkB;IAClB,0FAA0F;IAC1F,2DAA2D;IAC3D,8DAA8D;IAC9D,0GAA0G;IAC1G,OAAO,IAAI,CAAC,MAAM,EAA2B,CAAC;AAC/C,CAAC;AAPD,8CAOC;AAED;;;GAGG;AACH,SAAgB,iBAAiB,CAChC,OAAmC;IAEnC,uCAAuC;IACvC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAA0B,CAAC;AACtD,CAAC;AALD,8CAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as Type from \"@sinclair/typebox\";\nimport type { NumberOptions, TUnsafe } from \"@sinclair/typebox\";\n\n/**\n * Create a TypeBox string schema for a branded string type.\n * This only validates that the value is a string,\n * and not that it came from the correct branded type (that information is lost when serialized).\n */\nexport function brandedStringType<T extends string>(): TUnsafe<T> {\n\t// This could use:\n\t// return TypeSystem.CreateType<T>(name, (options, value) => typeof value === \"string\")();\n\t// Since there isn't any useful custom validation to do and\n\t// TUnsafe is documented as unsupported in `typebox/compiler`,\n\t// opt for the compile time behavior like the above, but the runtime behavior of the built in string type.\n\treturn Type.String() as unknown as TUnsafe<T>;\n}\n\n/**\n * Create a TypeBox number schema for a branded number type.\n * {@link brandedStringType} but for numbers.\n */\nexport function brandedNumberType<T extends number>(\n\toptions?: NumberOptions | undefined,\n): TUnsafe<T> {\n\t// See comments on `brandedStringType`.\n\treturn Type.Number(options) as unknown as TUnsafe<T>;\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type TUnsafe } from "@sinclair/typebox";
5
+ import * as Type from "@sinclair/typebox";
6
6
  /**
7
7
  * Subset of Map interface.
8
8
  */
@@ -211,7 +211,7 @@ export type JsonCompatibleReadOnlyObject = {
211
211
  * expressed using composition of schemas for runtime validation, even if we don't think making the types
212
212
  * generic is worth the maintenance cost.
213
213
  */
214
- export declare const JsonCompatibleReadOnlySchema: TUnsafe<JsonCompatibleReadOnly>;
214
+ export declare const JsonCompatibleReadOnlySchema: Type.TUnsafe<JsonCompatibleReadOnly>;
215
215
  /**
216
216
  * Returns if a particular json compatible value is an object.
217
217
  * Does not include `null` or arrays.
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/util/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAQ,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC,EAAE,CAAC;IAC9B,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAC3B,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;IAClC,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAChD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI;IAAE,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAE5D;;;GAGG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI;KACzB,CAAC,IAAI,MAAM,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,C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qB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,CAAC,SAAS,MAAM,EAC1F,MAAM,EAAE,CAAC,GAAG,SAAS,EACrB,QAAQ,EAAE,CAAC,EACX,WAAW,EAAE,CAAC,GACZ,OAAO,CAAC,WAAW,IAAI,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,GAAG;KAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,CAAC,CAAC;AACzE,wBAAgB,qBAAqB,CACpC,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAClC,CAAC,SAAS,MAAM,EAEhB,MAAM,EAAE,CAAC,GAAG,SAAS,EACrB,QAAQ,EAAE,CAAC,EACX,WAAW,EAAE,CAAC,GACZ,OAAO,CAAC,WAAW,IAAI,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,GAAG;KAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,CAAC,CAAC;AAkBzE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC/B,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,EACpC,SAAS,EAAE,MAAM,CAAC,GAChB,CAAC,CAWH"}
@@ -5,8 +5,9 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.balancedReduce = exports.copyPropertyIfDefined = exports.defineLazyCachedProperty = exports.comparePartialStrings = exports.compareStrings = exports.comparePartialNumbers = exports.compareNumbers = exports.capitalize = exports.disposeSymbol = exports.invertMap = exports.transformObjectMap = exports.objectToMap = exports.assertNonNegativeSafeInteger = exports.assertValidRange = exports.assertValidIndex = exports.assertValidRangeIndices = exports.isJsonObject = exports.JsonCompatibleReadOnlySchema = exports.count = exports.find = exports.filterIterable = exports.mapIterable = exports.getOrAddEmptyToMap = exports.getOrCreate = exports.getOrAddInMap = exports.compareSets = exports.hasSingle = exports.oneFromIterable = exports.iterableHasSome = exports.hasSome = exports.getLast = exports.makeArray = exports.isReadonlyArray = exports.asMutable = void 0;
8
+ const tslib_1 = require("tslib");
8
9
  const internal_1 = require("@fluidframework/core-utils/internal");
9
- const typebox_1 = require("@sinclair/typebox");
10
+ const Type = tslib_1.__importStar(require("@sinclair/typebox"));
10
11
  /**
11
12
  * Casts a readonly object to a mutable one.
12
13
  * Better than casting to `Mutable<Foo>` because it doesn't risk casting a non-`Foo` to a `Mutable<Foo>`.
@@ -234,7 +235,7 @@ exports.count = count;
234
235
  * expressed using composition of schemas for runtime validation, even if we don't think making the types
235
236
  * generic is worth the maintenance cost.
236
237
  */
237
- exports.JsonCompatibleReadOnlySchema = typebox_1.Type.Any();
238
+ exports.JsonCompatibleReadOnlySchema = Type.Any();
238
239
  /**
239
240
  * Returns if a particular json compatible value is an object.
240
241
  * Does not include `null` or arrays.