@fluidframework/tree 2.13.0 → 2.20.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 (303) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/api-report/tree.alpha.api.md +22 -12
  3. package/api-report/tree.beta.api.md +9 -5
  4. package/api-report/tree.legacy.alpha.api.md +9 -5
  5. package/api-report/tree.legacy.public.api.md +9 -5
  6. package/api-report/tree.public.api.md +9 -5
  7. package/assertTagging.config.mjs +14 -0
  8. package/dist/alpha.d.ts +3 -0
  9. package/dist/core/index.d.ts +2 -2
  10. package/dist/core/index.d.ts.map +1 -1
  11. package/dist/core/index.js +6 -4
  12. package/dist/core/index.js.map +1 -1
  13. package/dist/core/rebase/index.d.ts +2 -2
  14. package/dist/core/rebase/index.d.ts.map +1 -1
  15. package/dist/core/rebase/index.js +5 -1
  16. package/dist/core/rebase/index.js.map +1 -1
  17. package/dist/core/rebase/types.d.ts +5 -4
  18. package/dist/core/rebase/types.d.ts.map +1 -1
  19. package/dist/core/rebase/types.js +29 -1
  20. package/dist/core/rebase/types.js.map +1 -1
  21. package/dist/core/rebase/utils.d.ts +10 -0
  22. package/dist/core/rebase/utils.d.ts.map +1 -1
  23. package/dist/core/rebase/utils.js +22 -1
  24. package/dist/core/rebase/utils.js.map +1 -1
  25. package/dist/core/tree/delta.d.ts +21 -26
  26. package/dist/core/tree/delta.d.ts.map +1 -1
  27. package/dist/core/tree/delta.js.map +1 -1
  28. package/dist/core/tree/deltaUtil.d.ts +1 -3
  29. package/dist/core/tree/deltaUtil.d.ts.map +1 -1
  30. package/dist/core/tree/deltaUtil.js +2 -14
  31. package/dist/core/tree/deltaUtil.js.map +1 -1
  32. package/dist/core/tree/index.d.ts +1 -1
  33. package/dist/core/tree/index.d.ts.map +1 -1
  34. package/dist/core/tree/index.js +1 -3
  35. package/dist/core/tree/index.js.map +1 -1
  36. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  37. package/dist/core/tree/visitDelta.js +82 -80
  38. package/dist/core/tree/visitDelta.js.map +1 -1
  39. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  40. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  41. package/dist/feature-libraries/deltaUtils.d.ts.map +1 -1
  42. package/dist/feature-libraries/deltaUtils.js +13 -0
  43. package/dist/feature-libraries/deltaUtils.js.map +1 -1
  44. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  45. package/dist/feature-libraries/forest-summary/forestSummarizer.js +1 -6
  46. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  47. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +5 -5
  48. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  49. package/dist/feature-libraries/modular-schema/crossFieldQueries.js +2 -9
  50. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  51. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +19 -2
  52. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  53. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  54. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  55. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  56. package/dist/feature-libraries/modular-schema/index.d.ts +2 -2
  57. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  58. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  59. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +1 -1
  60. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  61. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +8 -8
  62. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  63. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +4 -4
  64. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  65. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +105 -199
  66. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  67. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +11 -20
  68. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  69. package/dist/feature-libraries/modular-schema/modularChangeTypes.js +20 -0
  70. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  71. package/dist/feature-libraries/optional-field/optionalField.d.ts +3 -3
  72. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  73. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  74. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +1 -1
  75. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  76. package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  77. package/dist/feature-libraries/sequence-field/rebase.js +4 -4
  78. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  79. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
  80. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  81. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
  82. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  83. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +2 -3
  84. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  85. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  86. package/dist/feature-libraries/sequence-field/utils.js +36 -4
  87. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  88. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  89. package/dist/feature-libraries/treeCursorUtils.js +4 -1
  90. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  91. package/dist/index.d.ts +26 -2
  92. package/dist/index.d.ts.map +1 -1
  93. package/dist/index.js +4 -2
  94. package/dist/index.js.map +1 -1
  95. package/dist/package.json +2 -1
  96. package/dist/packageVersion.d.ts +1 -1
  97. package/dist/packageVersion.js +1 -1
  98. package/dist/packageVersion.js.map +1 -1
  99. package/dist/shared-tree/index.d.ts +1 -1
  100. package/dist/shared-tree/index.d.ts.map +1 -1
  101. package/dist/shared-tree/index.js +4 -2
  102. package/dist/shared-tree/index.js.map +1 -1
  103. package/dist/shared-tree/sharedTree.d.ts +38 -18
  104. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  105. package/dist/shared-tree/sharedTree.js +38 -34
  106. package/dist/shared-tree/sharedTree.js.map +1 -1
  107. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  108. package/dist/shared-tree/treeCheckout.js +12 -8
  109. package/dist/shared-tree/treeCheckout.js.map +1 -1
  110. package/dist/simple-tree/api/treeNodeApi.js +1 -1
  111. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  112. package/dist/simple-tree/arrayNode.js +1 -1
  113. package/dist/simple-tree/arrayNode.js.map +1 -1
  114. package/dist/simple-tree/toMapTree.js +1 -1
  115. package/dist/simple-tree/toMapTree.js.map +1 -1
  116. package/dist/util/bTreeUtils.d.ts +10 -0
  117. package/dist/util/bTreeUtils.d.ts.map +1 -0
  118. package/dist/util/bTreeUtils.js +52 -0
  119. package/dist/util/bTreeUtils.js.map +1 -0
  120. package/dist/util/idAllocator.d.ts +0 -2
  121. package/dist/util/idAllocator.d.ts.map +1 -1
  122. package/dist/util/idAllocator.js +0 -2
  123. package/dist/util/idAllocator.js.map +1 -1
  124. package/dist/util/index.d.ts +2 -1
  125. package/dist/util/index.d.ts.map +1 -1
  126. package/dist/util/index.js +5 -1
  127. package/dist/util/index.js.map +1 -1
  128. package/dist/util/rangeMap.d.ts +52 -30
  129. package/dist/util/rangeMap.d.ts.map +1 -1
  130. package/dist/util/rangeMap.js +161 -117
  131. package/dist/util/rangeMap.js.map +1 -1
  132. package/dist/util/utils.d.ts +4 -1
  133. package/dist/util/utils.d.ts.map +1 -1
  134. package/dist/util/utils.js +7 -1
  135. package/dist/util/utils.js.map +1 -1
  136. package/lib/alpha.d.ts +3 -0
  137. package/lib/core/index.d.ts +2 -2
  138. package/lib/core/index.d.ts.map +1 -1
  139. package/lib/core/index.js +2 -2
  140. package/lib/core/index.js.map +1 -1
  141. package/lib/core/rebase/index.d.ts +2 -2
  142. package/lib/core/rebase/index.d.ts.map +1 -1
  143. package/lib/core/rebase/index.js +2 -2
  144. package/lib/core/rebase/index.js.map +1 -1
  145. package/lib/core/rebase/types.d.ts +5 -4
  146. package/lib/core/rebase/types.d.ts.map +1 -1
  147. package/lib/core/rebase/types.js +26 -1
  148. package/lib/core/rebase/types.js.map +1 -1
  149. package/lib/core/rebase/utils.d.ts +10 -0
  150. package/lib/core/rebase/utils.d.ts.map +1 -1
  151. package/lib/core/rebase/utils.js +20 -0
  152. package/lib/core/rebase/utils.js.map +1 -1
  153. package/lib/core/tree/delta.d.ts +21 -26
  154. package/lib/core/tree/delta.d.ts.map +1 -1
  155. package/lib/core/tree/delta.js.map +1 -1
  156. package/lib/core/tree/deltaUtil.d.ts +1 -3
  157. package/lib/core/tree/deltaUtil.d.ts.map +1 -1
  158. package/lib/core/tree/deltaUtil.js +1 -12
  159. package/lib/core/tree/deltaUtil.js.map +1 -1
  160. package/lib/core/tree/index.d.ts +1 -1
  161. package/lib/core/tree/index.d.ts.map +1 -1
  162. package/lib/core/tree/index.js +1 -1
  163. package/lib/core/tree/index.js.map +1 -1
  164. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  165. package/lib/core/tree/visitDelta.js +82 -80
  166. package/lib/core/tree/visitDelta.js.map +1 -1
  167. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  168. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  169. package/lib/feature-libraries/deltaUtils.d.ts.map +1 -1
  170. package/lib/feature-libraries/deltaUtils.js +13 -0
  171. package/lib/feature-libraries/deltaUtils.js.map +1 -1
  172. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  173. package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -6
  174. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  175. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +5 -5
  176. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  177. package/lib/feature-libraries/modular-schema/crossFieldQueries.js +2 -9
  178. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  179. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +19 -2
  180. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  181. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  182. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  183. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  184. package/lib/feature-libraries/modular-schema/index.d.ts +2 -2
  185. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  186. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  187. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +1 -1
  188. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  189. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +4 -4
  190. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  191. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +4 -4
  192. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  193. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +74 -166
  194. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  195. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +11 -20
  196. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  197. package/lib/feature-libraries/modular-schema/modularChangeTypes.js +18 -1
  198. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  199. package/lib/feature-libraries/optional-field/optionalField.d.ts +3 -3
  200. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  201. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  202. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +1 -1
  203. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  204. package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  205. package/lib/feature-libraries/sequence-field/rebase.js +4 -4
  206. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  207. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
  208. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  209. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
  210. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  211. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +2 -3
  212. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  213. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  214. package/lib/feature-libraries/sequence-field/utils.js +36 -4
  215. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  216. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  217. package/lib/feature-libraries/treeCursorUtils.js +4 -1
  218. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  219. package/lib/index.d.ts +26 -2
  220. package/lib/index.d.ts.map +1 -1
  221. package/lib/index.js +1 -1
  222. package/lib/index.js.map +1 -1
  223. package/lib/packageVersion.d.ts +1 -1
  224. package/lib/packageVersion.js +1 -1
  225. package/lib/packageVersion.js.map +1 -1
  226. package/lib/shared-tree/index.d.ts +1 -1
  227. package/lib/shared-tree/index.d.ts.map +1 -1
  228. package/lib/shared-tree/index.js +1 -1
  229. package/lib/shared-tree/index.js.map +1 -1
  230. package/lib/shared-tree/sharedTree.d.ts +38 -18
  231. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  232. package/lib/shared-tree/sharedTree.js +37 -33
  233. package/lib/shared-tree/sharedTree.js.map +1 -1
  234. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  235. package/lib/shared-tree/treeCheckout.js +13 -9
  236. package/lib/shared-tree/treeCheckout.js.map +1 -1
  237. package/lib/simple-tree/api/treeNodeApi.js +1 -1
  238. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  239. package/lib/simple-tree/arrayNode.js +1 -1
  240. package/lib/simple-tree/arrayNode.js.map +1 -1
  241. package/lib/simple-tree/toMapTree.js +1 -1
  242. package/lib/simple-tree/toMapTree.js.map +1 -1
  243. package/lib/util/bTreeUtils.d.ts +10 -0
  244. package/lib/util/bTreeUtils.d.ts.map +1 -0
  245. package/lib/util/bTreeUtils.js +47 -0
  246. package/lib/util/bTreeUtils.js.map +1 -0
  247. package/lib/util/idAllocator.d.ts +0 -2
  248. package/lib/util/idAllocator.d.ts.map +1 -1
  249. package/lib/util/idAllocator.js +0 -2
  250. package/lib/util/idAllocator.js.map +1 -1
  251. package/lib/util/index.d.ts +2 -1
  252. package/lib/util/index.d.ts.map +1 -1
  253. package/lib/util/index.js +2 -1
  254. package/lib/util/index.js.map +1 -1
  255. package/lib/util/rangeMap.d.ts +52 -30
  256. package/lib/util/rangeMap.d.ts.map +1 -1
  257. package/lib/util/rangeMap.js +160 -117
  258. package/lib/util/rangeMap.js.map +1 -1
  259. package/lib/util/utils.d.ts +4 -1
  260. package/lib/util/utils.d.ts.map +1 -1
  261. package/lib/util/utils.js +7 -1
  262. package/lib/util/utils.js.map +1 -1
  263. package/package.json +23 -23
  264. package/src/core/index.ts +5 -2
  265. package/src/core/rebase/index.ts +5 -0
  266. package/src/core/rebase/types.ts +33 -5
  267. package/src/core/rebase/utils.ts +27 -0
  268. package/src/core/tree/delta.ts +21 -26
  269. package/src/core/tree/deltaUtil.ts +1 -16
  270. package/src/core/tree/index.ts +0 -2
  271. package/src/core/tree/visitDelta.ts +108 -97
  272. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +2 -2
  273. package/src/feature-libraries/deltaUtils.ts +13 -0
  274. package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -6
  275. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +12 -13
  276. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +21 -1
  277. package/src/feature-libraries/modular-schema/genericFieldKind.ts +2 -2
  278. package/src/feature-libraries/modular-schema/index.ts +2 -0
  279. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +12 -11
  280. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +138 -225
  281. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +40 -27
  282. package/src/feature-libraries/optional-field/optionalField.ts +3 -3
  283. package/src/feature-libraries/sequence-field/moveEffectTable.ts +1 -1
  284. package/src/feature-libraries/sequence-field/rebase.ts +9 -3
  285. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +1 -1
  286. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +1 -1
  287. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +3 -4
  288. package/src/feature-libraries/sequence-field/utils.ts +36 -4
  289. package/src/feature-libraries/treeCursorUtils.ts +6 -1
  290. package/src/index.ts +34 -6
  291. package/src/packageVersion.ts +1 -1
  292. package/src/shared-tree/index.ts +4 -1
  293. package/src/shared-tree/sharedTree.ts +60 -40
  294. package/src/shared-tree/treeCheckout.ts +19 -12
  295. package/src/simple-tree/api/treeNodeApi.ts +1 -1
  296. package/src/simple-tree/arrayNode.ts +1 -1
  297. package/src/simple-tree/toMapTree.ts +1 -1
  298. package/src/util/bTreeUtils.ts +60 -0
  299. package/src/util/idAllocator.ts +0 -2
  300. package/src/util/index.ts +3 -0
  301. package/src/util/rangeMap.ts +208 -143
  302. package/src/util/utils.ts +10 -3
  303. package/lib/package.json +0 -3
@@ -1 +1 @@
1
- {"version":3,"file":"rangeMap.js","sourceRoot":"","sources":["../../src/util/rangeMap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAE1D;;;GAGG;AACH,MAAM,OAAO,QAAQ;IAGpB,YAAmB,cAAgC;QAClD,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1D,CAAC;IAED;;;OAGG;IACI,aAAa;QACnB,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAED;;;;;;;OAOG;IACI,GAAG,CAAC,KAAa,EAAE,MAAc;QACvC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAClC,IAAI,KAAK,CAAC,KAAK,GAAG,KAAK,EAAE,CAAC;gBACzB,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC;YAC5E,CAAC;YAED,MAAM,YAAY,GAAG,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;YACpD,IAAI,YAAY,IAAI,KAAK,EAAE,CAAC;gBAC3B,MAAM,aAAa,GAAG,YAAY,GAAG,KAAK,GAAG,CAAC,CAAC;gBAC/C,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,EAAE,CAAC;YACxE,CAAC;QACF,CAAC;QAED,qGAAqG;QACrG,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;IACrC,CAAC;IAED;;;;;;OAMG;IACI,G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I,KAAK,CAAC,KAAK,IAAI,KAAK,IAAI,YAAY,IAAI,GAAG,EAAE,CAAC;gBACjD,8DAA8D;gBAC9D,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC3B,CAAC;iBAAM,CAAC;gBACP,6EAA6E;gBAC7E,IAAI,KAAK,CAAC,KAAK,GAAG,KAAK,EAAE,CAAC;oBACzB,+EAA+E;oBAC/E,MAAM,YAAY,GAAG,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;oBACzC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;oBACrD,OAAO,GAAG,IAAI,CAAC;gBAChB,CAAC;gBAED,IAAI,YAAY,GAAG,GAAG,EAAE,CAAC;oBACxB,gFAAgF;oBAChF,MAAM,QAAQ,GAAG,GAAG,GAAG,CAAC,CAAC;oBACzB,MAAM,SAAS,GAAG,YAAY,GAAG,GAAG,CAAC;oBACrC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;wBACzD,KAAK,EAAE,QAAQ;wBACf,MAAM,EAAE,SAAS;wBACjB,KAAK,EAAE,KAAK,CAAC,KAAK;qBAClB,CAAC,CAAC;gBACJ,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { oob } from \"@fluidframework/core-utils/internal\";\n\n/**\n * RangeMap represents a mapping from integers to values of type T or undefined.\n * The values for a range of consecutive keys can be changed or queried in a single operation.\n */\nexport class RangeMap<T> {\n\tprivate readonly entries: RangeEntry<T>[];\n\n\tpublic constructor(initialEntries?: RangeEntry<T>[]) {\n\t\tthis.entries = initialEntries ? [...initialEntries] : [];\n\t}\n\n\t/**\n\t * Retrieves all entries from the rangeMap.\n\t * @returns An array of RangeEntryResult objects, each containing the start index, length, and value of a contiguous range.\n\t */\n\tpublic getAllEntries(): readonly RangeQueryResult<T>[] {\n\t\treturn this.entries;\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.\n\t */\n\tpublic get(start: number, length: number): RangeQueryResult<T> {\n\t\tfor (const entry of this.entries) {\n\t\t\tif (entry.start > start) {\n\t\t\t\treturn { value: undefined, length: Math.min(entry.start - start, length) };\n\t\t\t}\n\n\t\t\tconst lastRangeKey = entry.start + entry.length - 1;\n\t\t\tif (lastRangeKey >= start) {\n\t\t\t\tconst overlapLength = lastRangeKey - start + 1;\n\t\t\t\treturn { value: entry.value, length: Math.min(overlapLength, length) };\n\t\t\t}\n\t\t}\n\n\t\t// There were no entries intersecting the query range, so the entire query range has undefined value.\n\t\treturn { value: undefined, length };\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: number, length: number, value: T | undefined): void {\n\t\tif (value === undefined) {\n\t\t\tthis.delete(start, length);\n\t\t\treturn;\n\t\t}\n\n\t\tconst end = start + length - 1;\n\t\tconst newEntry: RangeEntry<T> = { start, length, value };\n\n\t\tlet iBefore = -1;\n\t\tlet iAfter = this.entries.length;\n\t\tfor (const [i, entry] of this.entries.entries()) {\n\t\t\tconst entryLastKey = entry.start + entry.length - 1;\n\t\t\tif (entryLastKey < start) {\n\t\t\t\tiBefore = i;\n\t\t\t} else if (entry.start > end) {\n\t\t\t\tiAfter = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tconst numOverlappingEntries = iAfter - iBefore - 1;\n\t\tif (numOverlappingEntries === 0) {\n\t\t\tthis.entries.splice(iAfter, 0, newEntry);\n\t\t\treturn;\n\t\t}\n\n\t\tconst iFirst = iBefore + 1;\n\t\tconst firstEntry = this.entries[iFirst] ?? oob();\n\t\tconst iLast = iAfter - 1;\n\t\tconst lastEntry = this.entries[iLast] ?? oob();\n\t\tconst lengthBeforeFirst = start - firstEntry.start;\n\t\tconst lastEntryKey = lastEntry.start + lastEntry.length - 1;\n\t\tconst lengthAfterLast = lastEntryKey - end;\n\n\t\tif (lengthBeforeFirst > 0 && lengthAfterLast > 0 && iFirst === iLast) {\n\t\t\t// The new entry fits in the middle of an existing entry.\n\t\t\t// We replace the existing entry with:\n\t\t\t// 1) the portion which comes before `newEntry`\n\t\t\t// 2) `newEntry`\n\t\t\t// 3) the portion which comes after `newEntry`\n\t\t\tthis.entries.splice(iFirst, 1, { ...firstEntry, length: lengthBeforeFirst }, newEntry, {\n\t\t\t\t...lastEntry,\n\t\t\t\tstart: end + 1,\n\t\t\t\tlength: lengthAfterLast,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tif (lengthBeforeFirst > 0) {\n\t\t\tthis.entries[iFirst] = { ...firstEntry, length: lengthBeforeFirst };\n\t\t\t// The entry at `iFirst` is no longer overlapping with `newEntry`.\n\t\t\tiBefore = iFirst;\n\t\t}\n\n\t\tif (lengthAfterLast > 0) {\n\t\t\tthis.entries[iLast] = {\n\t\t\t\t...lastEntry,\n\t\t\t\tstart: end + 1,\n\t\t\t\tlength: lengthAfterLast,\n\t\t\t};\n\n\t\t\t// The entry at `iLast` is no longer overlapping with `newEntry`.\n\t\t\tiAfter = iLast;\n\t\t}\n\n\t\tconst numContainedEntries = iAfter - iBefore - 1;\n\t\tthis.entries.splice(iBefore + 1, numContainedEntries, newEntry);\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 */\n\tpublic delete(start: number, length: number): void {\n\t\tconst end = start + length - 1;\n\n\t\tlet iBefore = -1;\n\t\tlet iAfter = this.entries.length;\n\n\t\tfor (const [i, entry] of this.entries.entries()) {\n\t\t\tconst entryLastKey = entry.start + entry.length - 1;\n\t\t\tif (entryLastKey < start) {\n\t\t\t\tiBefore = i;\n\t\t\t} else if (entry.start > end) {\n\t\t\t\tiAfter = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tconst numOverlappingEntries = iAfter - iBefore - 1;\n\n\t\tif (numOverlappingEntries === 0) {\n\t\t\t// No entry will be removed\n\t\t\treturn;\n\t\t}\n\n\t\tconst iFirst = iBefore + 1;\n\t\tconst iLast = iAfter - 1;\n\n\t\tfor (let i = iFirst; i <= iLast; ++i) {\n\t\t\tconst entry = this.entries[i] ?? oob();\n\t\t\tconst entryLastKey = entry.start + entry.length - 1;\n\t\t\tlet isDirty = false;\n\n\t\t\tif (entry.start >= start && entryLastKey <= end) {\n\t\t\t\t// If the entry lies within the range to be deleted, remove it\n\t\t\t\tthis.entries.splice(i, 1);\n\t\t\t} else {\n\t\t\t\t// If the entry partially or completely overlaps with the range to be deleted\n\t\t\t\tif (entry.start < start) {\n\t\t\t\t\t// Update the endpoint and length of the portion before the range to be deleted\n\t\t\t\t\tconst lengthBefore = start - entry.start;\n\t\t\t\t\tthis.entries[i] = { ...entry, length: lengthBefore };\n\t\t\t\t\tisDirty = true;\n\t\t\t\t}\n\n\t\t\t\tif (entryLastKey > end) {\n\t\t\t\t\t// Update the startpoint and length of the portion after the range to be deleted\n\t\t\t\t\tconst newStart = end + 1;\n\t\t\t\t\tconst newLength = entryLastKey - end;\n\t\t\t\t\tthis.entries.splice(isDirty ? i + 1 : i, isDirty ? 0 : 1, {\n\t\t\t\t\t\tstart: newStart,\n\t\t\t\t\t\tlength: newLength,\n\t\t\t\t\t\tvalue: entry.value,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Represents a contiguous range of values in the RangeMap.\n * This interface is used internally and should not be exposed to consumers.\n */\ninterface RangeEntry<T> {\n\t/**\n\t * The starting index of the range (inclusive).\n\t */\n\treadonly start: number;\n\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: T;\n}\n\n/**\n * Describes the result of a range query, including the value and length of the matching prefix.\n */\nexport interface RangeQueryResult<T> {\n\t/**\n\t * The value of the first key in the query range.\n\t * If no matching range is found, this will be undefined.\n\t */\n\treadonly value: T | undefined;\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"]}
1
+ {"version":3,"file":"rangeMap.js","sourceRoot":"","sources":["../../src/util/rangeMap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,OAAO,QAAQ;IAGpB;;;;;;;;OAQG;IACH,YACkB,SAAwC,EACxC,YAAoC;QADpC,cAAS,GAAT,SAAS,CAA+B;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,MAAM,CAAC;AACrB,CAAC;AAED,SAAS,gBAAgB,CAAC,CAAS,EAAE,CAAS;IAC7C,OAAO,CAAC,GAAG,CAAC,CAAC;AACd,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob } 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\tpublic constructor(\n\t\tprivate readonly offsetKey: (key: K, offset: number) => K,\n\t\tprivate readonly subtractKeys: (a: K, b: K) => number,\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(): RangeQueryEntry<K, V>[] {\n\t\tconst entries: RangeQueryEntry<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 entries, each describing the value for some subrange of the query.\n\t * The entries are in the same order as the keys, and there is an entry for every key with a non `undefined` value.\n\t */\n\tpublic getAll(start: K, length: number): RangeQueryEntry<K, V>[] {\n\t\tconst entries = this.getIntersectingEntries(start, length);\n\t\tif (entries.length === 0) {\n\t\t\treturn entries;\n\t\t}\n\n\t\tconst firstEntry = entries[0] ?? oob();\n\t\tconst lengthBefore = this.subtractKeys(start, firstEntry.start);\n\t\tif (lengthBefore > 0) {\n\t\t\tentries[0] = { ...firstEntry, start, length: firstEntry.length - lengthBefore };\n\t\t}\n\n\t\tconst lastEntry = entries[entries.length - 1] ?? oob();\n\t\tconst lastEntryKey = this.offsetKey(lastEntry.start, lastEntry.length - 1);\n\t\tconst lastQueryKey = this.offsetKey(start, length - 1);\n\t\tconst lengthAfter = this.subtractKeys(lastEntryKey, lastQueryKey);\n\t\tif (lengthAfter > 0) {\n\t\t\tentries[entries.length - 1] = { ...lastEntry, length: lastEntry.length - lengthAfter };\n\t\t}\n\n\t\treturn entries;\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<K, V> {\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 overlappingLength = Math.min(this.subtractKeys(entryLastKey, start) + 1, length);\n\t\t\t\tif (overlappingLength > 0) {\n\t\t\t\t\treturn { value, start, length: overlappingLength };\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, start, length: this.subtractKeys(entryKey, start) };\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn { value: undefined, start, 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 */\n\tpublic delete(start: K, length: number): void {\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\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}\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\tthis.tree.set(this.offsetKey(lastDeleteKey, 1), { length: lengthAfter, value });\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic clone(): RangeMap<K, V> {\n\t\tconst cloned = new RangeMap<K, V>(this.offsetKey, this.subtractKeys);\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 */\n\tpublic static union<K, V>(a: RangeMap<K, V>, b: RangeMap<K, V>): RangeMap<K, V> {\n\t\tassert(\n\t\t\ta.offsetKey === b.offsetKey && a.subtractKeys === b.subtractKeys,\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);\n\n\t\t// TODO: Is there a good pattern that lets us make `tree` readonly?\n\t\tmerged.tree = a.tree.clone();\n\t\tfor (const [key, value] of b.tree.entries()) {\n\t\t\t// TODO: Handle key collisions\n\t\t\tmerged.tree.set(key, value);\n\t\t}\n\n\t\treturn merged;\n\t}\n\n\tprivate getIntersectingEntries(start: K, length: number): RangeQueryEntry<K, V>[] {\n\t\tconst entries: RangeQueryEntry<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<K, V> {\n\t/**\n\t * The key for the first element in the range.\n\t */\n\treadonly start: K;\n\n\t/**\n\t * The value of the first key in the query range.\n\t * If no matching range is found, this will be undefined.\n\t */\n\treadonly value: V | undefined;\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 RangeQueryEntry<K, V> extends RangeQueryResult<K, V> {\n\treadonly value: V;\n}\n\nexport function newIntegerRangeMap<V>(): RangeMap<number, V> {\n\treturn new RangeMap(offsetInteger, subtractIntegers);\n}\n\nfunction offsetInteger(key: number, offset: number): number {\n\treturn key + offset;\n}\n\nfunction subtractIntegers(a: number, b: number): number {\n\treturn a - b;\n}\n"]}
@@ -38,8 +38,11 @@ export type Populated<T> = {
38
38
  export declare function asMutable<T>(readonly: T): Mutable<T>;
39
39
  export declare const clone: typeof structuredClone;
40
40
  /**
41
+ * Throw an error with a constant message.
42
+ * @remarks
43
+ * Works like {@link @fluidframework/core-utils/internal#assert}.
41
44
  */
42
- export declare function fail(message: string): never;
45
+ export declare function fail(message: string | number): never;
43
46
  /**
44
47
  * Checks whether or not the given object is a `readonly` array.
45
48
  *
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/util/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,eAAe,MAAM,yBAAyB,CAAC;AAEtD;;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,C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wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,CAEnE;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACvC,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAClC,CAAC,EACA,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,OAAO,GAAG,GAAG;KAAG,CAAC,IAAI,CAAC,GAAG,CAAC;CAAE,CAU5D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,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"}
package/lib/util/utils.js CHANGED
@@ -16,9 +16,15 @@ export function asMutable(readonly) {
16
16
  }
17
17
  export const clone = structuredClone;
18
18
  /**
19
+ * Throw an error with a constant message.
20
+ * @remarks
21
+ * Works like {@link @fluidframework/core-utils/internal#assert}.
19
22
  */
20
23
  export function fail(message) {
21
- throw new Error(message);
24
+ // Declaring this here aliased to a different name avoids the assert tagging objecting to the usages of `assert` below.
25
+ // Since users of `fail` do the assert message tagging instead, suppressing tagging errors here makes sense.
26
+ const assertNoTag = assert;
27
+ assertNoTag(false, message);
22
28
  }
23
29
  /**
24
30
  * Checks whether or not the given object is a `readonly` array.
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/util/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,eAAe,MAAM,yBAAyB,CAAC;AA8BtD;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAI,QAAW;IACvC,OAAO,QAAsB,CAAC;AAC/B,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,eAAe,CAAC;AAErC;GACG;AACH,MAAM,UAAU,IAAI,CAAC,OAAe;IACnC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;AAC1B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAI,CAAyB;IAC3D,+EAA+E;IAC/E,wEAAwE;IACxE,oEAAoE;IACpE,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACzB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAI,IAAY,EAAE,MAA4B;IACtE,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC;QAC/B,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAUD,MAAM,UAAU,OAAO,C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CAAC,QAAQ,CAAC,CAAC;QAC3D,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,WAAqC,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;QAC1D,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { Type } from \"@sinclair/typebox\";\nimport structuredClone from \"@ungap/structured-clone\";\n\n/**\n * Subset of Map interface.\n */\nexport interface MapGetSet<K, V> {\n\tget(key: K): V | undefined;\n\tset(key: K, value: V): void;\n}\n\n/**\n * Make all transitive properties in `T` readonly\n */\nexport type RecursiveReadonly<T> = {\n\treadonly [P in keyof T]: RecursiveReadonly<T[P]>;\n};\n\n/**\n * Remove `readonly` from all fields.\n */\nexport type Mutable<T> = { -readonly [P in keyof T]: T[P] };\n\n/**\n * Make all field required and omits fields whose ony valid value would be `undefined`.\n * This is analogous to `Required<T>` except it tolerates 'optional undefined'.\n */\nexport type Populated<T> = {\n\t[P in keyof T as Exclude<P, T[P] extends undefined ? P : never>]-?: T[P];\n};\n\n/**\n * Casts a readonly object to a mutable one.\n * Better than casting to `Mutable<Foo>` because it doesn't risk casting a non-`Foo` to a `Mutable<Foo>`.\n * @param readonly - The object with readonly fields.\n * @returns The same object but with a type that makes all fields mutable.\n */\nexport function asMutable<T>(readonly: T): Mutable<T> {\n\treturn readonly as Mutable<T>;\n}\n\nexport const clone = structuredClone;\n\n/**\n */\nexport function fail(message: string): never {\n\tthrow new Error(message);\n}\n\n/**\n * Checks whether or not the given object is a `readonly` array.\n *\n * Note that this does NOT indicate if a given array should be treated as readonly.\n * This instead indicates if an object is an Array, and is typed to tolerate the readonly case.\n */\nexport function isReadonlyArray<T>(x: readonly T[] | unknown): x is readonly T[] {\n\t// `Array.isArray()` does not properly narrow `readonly` array types by itself,\n\t// so we wrap it in this type guard. This may become unnecessary if/when\n\t// https://github.com/microsoft/TypeScript/issues/17002 is resolved.\n\treturn Array.isArray(x);\n}\n\n/**\n * Creates and populates a new array.\n * @param size - The size of the array to be created.\n * @param filler - Callback for populating the array with a value for a given index\n */\nexport function makeArray<T>(size: number, filler: (index: number) => T): T[] {\n\tconst array = [];\n\tfor (let i = 0; i < size; ++i) {\n\t\tarray.push(filler(i));\n\t}\n\treturn array;\n}\n\n/**\n * Returns the last element of an array, or `undefined` if the array has no elements.\n * @param array - The array to get the last element from.\n * @remarks\n * If the type of the array has been narrowed by e.g. {@link hasSome | hasSome(array)} or {@link hasSingle | hasOne(array)} then the return type will be `T` rather than `T | undefined`.\n */\nexport function getLast<T>(array: readonly [T, ...T[]]): T;\nexport function getLast<T>(array: { [index: number]: T; length: number }): T | undefined;\nexport function getLast<T>(array: { [index: number]: T; length: number }): T | undefined {\n\treturn array[array.length - 1];\n}\n\n/**\n * Returns true if and only if the given array has at least one element.\n * @param array - The array to check.\n * @remarks\n * If `array` contains at least one element, its type will be narrowed and can benefit from improved typing from e.g. `array[0]` and {@link getLast | getLast(array)}.\n * This is especially useful when \"noUncheckedIndexedAccess\" is enabled in the TypeScript compiler options, since the return type of `array[0]` will be `T` rather than `T | undefined`.\n */\nexport function hasSome<T>(array: T[]): array is [T, ...T[]];\nexport function hasSome<T>(array: readonly T[]): array is readonly [T, ...T[]];\nexport function hasSome<T>(array: readonly T[]): array is [T, ...T[]] {\n\treturn array.length > 0;\n}\n\n/**\n * Returns true if and only if the given array has exactly one element.\n * @param array - The array to check.\n * @remarks\n * If `array` contains exactly one element, its type will be narrowed and can benefit from improved typing from e.g. `array[0]` and {@link getLast | getLast(array)}.\n * This is especially useful when \"noUncheckedIndexedAccess\" is enabled in the TypeScript compiler options, since the return type of `array[0]` will be `T` rather than `T | undefined`.\n */\nexport function hasSingle<T>(array: T[]): array is [T];\nexport function hasSingle<T>(array: readonly T[]): array is readonly [T];\nexport function hasSingle<T>(array: readonly T[]): array is [T] {\n\treturn array.length === 1;\n}\n\n/**\n * Compares two sets using callbacks.\n * Early returns on first false comparison.\n *\n * @param a - One Set.\n * @param b - The other Set.\n * @param aExtra - Called for items in `a` but not `b`.\n * @param bExtra - Called for items in `b` but not `a`.\n * @param same - Called for items in `a` and `b`.\n * @returns false iff any of the call backs returned false.\n */\nexport function compareSets<T>({\n\ta,\n\tb,\n\taExtra,\n\tbExtra,\n\tsame,\n}: {\n\ta: ReadonlySet<T> | ReadonlyMap<T, unknown>;\n\tb: ReadonlySet<T> | ReadonlyMap<T, unknown>;\n\taExtra?: (t: T) => boolean;\n\tbExtra?: (t: T) => boolean;\n\tsame?: (t: T) => boolean;\n}): boolean {\n\tfor (const item of a.keys()) {\n\t\tif (!b.has(item)) {\n\t\t\tif (aExtra !== undefined) {\n\t\t\t\tif (!aExtra(item)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} else {\n\t\t\tif (same !== undefined && !same(item)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\tfor (const item of b.keys()) {\n\t\tif (!a.has(item)) {\n\t\t\tif (bExtra !== undefined) {\n\t\t\t\tif (!bExtra(item)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\treturn true;\n}\n\n/**\n * Retrieve a value from a map with the given key, or create a new entry if the key is not in the map.\n * @param map - The map to query/update\n * @param key - The key to lookup in the map\n * @param defaultValue - a function which returns a default value. This is called and used to set an initial value for the given key in the map if none exists\n * @returns either the existing value for the given key, or the newly-created value (the result of `defaultValue`)\n */\nexport function getOrCreate<K, V>(\n\tmap: MapGetSet<K, V>,\n\tkey: K,\n\tdefaultValue: (key: K) => V,\n): V {\n\tlet value = map.get(key);\n\tif (value === undefined) {\n\t\tvalue = defaultValue(key);\n\t\tmap.set(key, value);\n\t}\n\treturn value;\n}\n\n/**\n * Utility for dictionaries whose values are lists.\n * Gets the list associated with the provided key, if it exists.\n * Otherwise, creates an entry with an empty list, and returns that list.\n */\nexport function getOrAddEmptyToMap<K, V>(map: MapGetSet<K, V[]>, key: K): V[] {\n\tlet collection = map.get(key);\n\tif (collection === undefined) {\n\t\tcollection = [];\n\t\tmap.set(key, collection);\n\t}\n\treturn collection;\n}\n\n/**\n * Map one iterable to another by transforming each element one at a time\n * @param iterable - the iterable to transform\n * @param map - the transformation function to run on each element of the iterable\n * @returns a new iterable of elements which have been transformed by the `map` function\n */\nexport function* mapIterable<T, U>(\n\titerable: Iterable<T>,\n\tmap: (t: T) => U,\n): IterableIterator<U> {\n\tfor (const t of iterable) {\n\t\tyield map(t);\n\t}\n}\n\n/**\n * Filter one iterable into another\n * @param iterable - the iterable to filter\n * @param filter - the predicate function to run on each element of the iterable\n * @returns a new iterable including only the elements that passed the filter predicate\n */\nexport function* filterIterable<T>(\n\titerable: Iterable<T>,\n\tfilter: (t: T) => boolean,\n): IterableIterator<T> {\n\tfor (const t of iterable) {\n\t\tif (filter(t)) {\n\t\t\tyield t;\n\t\t}\n\t}\n}\n\n/**\n * Finds the first element in the given iterable that satisfies a predicate.\n * @param iterable - The iterable to search for an eligible element\n * @param predicate - The predicate to run against each element\n * @returns The first element in the iterable that satisfies the predicate, or undefined if the iterable contains no such element\n */\nexport function find<T>(iterable: Iterable<T>, predicate: (t: T) => boolean): T | undefined {\n\tfor (const t of iterable) {\n\t\tif (predicate(t)) {\n\t\t\treturn t;\n\t\t}\n\t}\n}\n\n/**\n * Counts the number of elements in the given iterable.\n * @param iterable - the iterable to enumerate\n * @returns the number of elements that were iterated after exhausting the iterable\n */\nexport function count(iterable: Iterable<unknown>): number {\n\tlet n = 0;\n\tfor (const _ of iterable) {\n\t\tn += 1;\n\t}\n\treturn n;\n}\n\n/**\n * Use for Json compatible data.\n *\n * @typeparam TExtra - Type permitted in addition to the normal JSON types.\n * Commonly used for to allow {@link @fluidframework/core-interfaces#IFluidHandle} within the otherwise JSON compatible content.\n *\n * @remarks\n * This does not robustly forbid non json comparable data via type checking,\n * but instead mostly restricts access to it.\n * @alpha\n */\nexport type JsonCompatible<TExtra = never> =\n\t| string\n\t| number\n\t| boolean\n\t// eslint-disable-next-line @rushstack/no-new-null\n\t| null\n\t| JsonCompatible<TExtra>[]\n\t| JsonCompatibleObject<TExtra>\n\t| TExtra;\n\n/**\n * Use for Json object compatible data.\n * @remarks\n * This does not robustly forbid non json comparable data via type checking,\n * but instead mostly restricts access to it.\n * @alpha\n */\nexport type JsonCompatibleObject<TExtra = never> = { [P in string]?: JsonCompatible<TExtra> };\n\n/**\n * Use for readonly view of Json compatible data.\n * @remarks\n * This does not robustly forbid non json comparable data via type checking,\n * but instead mostly restricts access to it.\n */\nexport type JsonCompatibleReadOnly =\n\t| string\n\t| number\n\t| boolean\n\t// eslint-disable-next-line @rushstack/no-new-null\n\t| null\n\t| readonly JsonCompatibleReadOnly[]\n\t| JsonCompatibleReadOnlyObject;\n\n/**\n * Use for readonly view of Json compatible data.\n * @remarks\n * This does not robustly forbid non json comparable data via type checking,\n * but instead mostly restricts access to it.\n */\nexport type JsonCompatibleReadOnlyObject = { readonly [P in string]?: JsonCompatibleReadOnly };\n\n/**\n * @remarks TODO: Audit usage of this type in schemas, evaluating whether it is necessary and performance\n * of alternatives.\n *\n * True \"arbitrary serializable data\" is probably fine, but some persisted types declarations might be better\n * expressed using composition of schemas for runtime validation, even if we don't think making the types\n * generic is worth the maintenance cost.\n */\nexport const JsonCompatibleReadOnlySchema = Type.Any();\n\n/**\n * Returns if a particular json compatible value is an object.\n * Does not include `null` or arrays.\n */\nexport function isJsonObject(\n\tvalue: JsonCompatibleReadOnly,\n): value is { readonly [P in string]?: JsonCompatibleReadOnly } {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/**\n * Verifies that the supplied indices are valid within the supplied array.\n * @param startIndex - The starting index in the range. Must be in [0, length).\n * @param endIndex - The ending index in the range. Must be within (start, length].\n * @param array - The array the indices refer to\n */\nexport function assertValidRangeIndices(\n\tstartIndex: number,\n\tendIndex: number,\n\tarray: { readonly length: number },\n): void {\n\tassert(endIndex >= startIndex, 0x79c /* Range indices are malformed. */);\n\tassertValidIndex(startIndex, array, false);\n\tassertValidIndex(endIndex, array, true);\n}\n\nexport function assertValidIndex(\n\tindex: number,\n\tarray: { readonly length: number },\n\tallowOnePastEnd: boolean = false,\n): void {\n\tassertNonNegativeSafeInteger(index);\n\tif (allowOnePastEnd) {\n\t\tassert(index <= array.length, 0x378 /* index must be less than or equal to length */);\n\t} else {\n\t\tassert(index < array.length, 0x379 /* index must be less than length */);\n\t}\n}\n\nexport function assertValidRange(\n\t{ start, end }: { start: number; end: number },\n\tarray: { readonly length: number },\n): void {\n\tassertNonNegativeSafeInteger(start);\n\tassertNonNegativeSafeInteger(end);\n\tassert(end <= array.length, 0x79d /* Range end must be less than or equal to length */);\n\tassert(start <= end, 0x79e /* Range start must be less than or equal to range start */);\n}\n\nexport function assertNonNegativeSafeInteger(index: number): void {\n\tassert(Number.isSafeInteger(index), 0x376 /* index must be an integer */);\n\tassert(index >= 0, 0x377 /* index must be non-negative */);\n}\n\n/**\n * Convert an object into a Map.\n *\n * This function must only be used with objects specifically intended to encode map like information.\n * The only time such objects should be used is for encoding maps as object literals to allow for developer ergonomics or JSON compatibility.\n * Even those two use-cases need to be carefully considered as using objects as maps can have a lot of issues\n * (including but not limited to unintended access to __proto__ and other non-owned keys).\n * This function helps these few cases get into using an actual map in as safe of was as is practical.\n */\nexport function objectToMap<MapKey extends string | number | symbol, MapValue>(\n\tobjectMap: Record<MapKey, MapValue>,\n): Map<MapKey, MapValue> {\n\tconst map = new Map<MapKey, MapValue>();\n\t// This function must only be used with objects specifically intended to encode map like information.\n\tfor (const key of Object.keys(objectMap)) {\n\t\tconst element = objectMap[key as MapKey];\n\t\tmap.set(key as MapKey, element);\n\t}\n\treturn map;\n}\n\n/**\n * Convert an object used as a map into a new object used like a map.\n *\n * @remarks\n * This function must only be used with objects specifically intended to encode map like information.\n * The only time such objects should be used is for encoding maps as object literals to allow for developer ergonomics or JSON compatibility.\n * Even those two use-cases need to be carefully considered as using objects as maps can have a lot of issues\n * (including but not limited to unintended access to __proto__ and other non-owned keys).\n * {@link objectToMap} helps these few cases get into using an actual map in as safe of a way as is practical.\n */\nexport function transformObjectMap<\n\tMapKey extends string | number | symbol,\n\tMapValue,\n\tNewMapValue,\n>(\n\tobjectMap: Record<MapKey, MapValue>,\n\ttransformer: (value: MapValue, key: MapKey) => NewMapValue,\n): Record<MapKey, MapValue> {\n\tconst output: Record<MapKey, MapValue> = Object.create(null);\n\t// This function must only be used with objects specifically intended to encode map like information.\n\tfor (const key of Object.keys(objectMap)) {\n\t\tconst element = objectMap[key as MapKey];\n\t\tObject.defineProperty(output, key, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: transformer(element, key as MapKey),\n\t\t});\n\t}\n\treturn output;\n}\n\n/**\n * Make an inverted copy of a map.\n *\n * @returns a map which can look up the keys from the values of the original map.\n */\nexport function invertMap<Key, Value>(input: Map<Key, Value>): Map<Value, Key> {\n\tconst result = new Map<Value, Key>(mapIterable(input, ([key, value]) => [value, key]));\n\tassert(\n\t\tresult.size === input.size,\n\t\t0x88a /* all values in a map must be unique to invert it */,\n\t);\n\treturn result;\n}\n\n/**\n * Returns the value from `set` if it contains exactly one item, otherwise `undefined`.\n */\nexport function oneFromSet<T>(set: ReadonlySet<T> | undefined): T | undefined {\n\tif (set === undefined) {\n\t\treturn undefined;\n\t}\n\tif (set.size !== 1) {\n\t\treturn undefined;\n\t}\n\tfor (const item of set) {\n\t\treturn item;\n\t}\n}\n\n/**\n * Type with a name describing what it is.\n * Typically used with values (like schema) that can be stored in a map, but in some representations have their name/key as a field.\n */\nexport interface Named<TName> {\n\treadonly name: TName;\n}\n\n/**\n * Order {@link Named} objects by their name.\n */\nexport function compareNamed(a: Named<string>, b: Named<string>): -1 | 0 | 1 {\n\tif (a.name < b.name) {\n\t\treturn -1;\n\t}\n\tif (a.name > b.name) {\n\t\treturn 1;\n\t}\n\treturn 0;\n}\n\n/**\n * Placeholder for `Symbol.dispose`.\n * @privateRemarks\n * TODO: replace this with `Symbol.dispose` when it is available or make it a valid polyfill.\n */\nexport const disposeSymbol: unique symbol = Symbol(\"Symbol.dispose placeholder\");\n\n/**\n * An object with an explicit lifetime that can be ended.\n * @privateRemarks\n * Simpler alternative to core-utils/IDisposable for internal use in this package.\n * This avoids adding a named \"dispose\" method, and will eventually be replaced with\n * {@link https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management| TypeScript's Disposable}.\n *\n * Once this is replaced with TypeScript's Disposable, core-utils/IDisposable can extend it, bringing the APIs into a reasonable alignment.\n */\nexport interface IDisposable {\n\t/**\n\t * Call to end the lifetime of this object.\n\t *\n\t * It is invalid to use this object after this,\n\t * except for operations which explicitly document they are valid after disposal.\n\t *\n\t * @remarks\n\t * May cleanup resources retained by this object.\n\t * Often includes un-registering from events and thus preventing other objects from retaining a reference to this indefinably.\n\t *\n\t * Usually the only operations allowed after disposal are querying if an object is already disposed,\n\t * but this can vary between implementations.\n\t */\n\t[disposeSymbol](): void;\n}\n\n/**\n * Capitalize a string.\n */\nexport function capitalize<S extends string>(s: S): Capitalize<S> {\n\t// To avoid splitting characters which are made of multiple UTF-16 code units,\n\t// use iteration instead of indexing to separate the first character.\n\tconst iterated = s[Symbol.iterator]().next();\n\tif (iterated.done === true) {\n\t\t// Empty string case.\n\t\treturn \"\" as Capitalize<S>;\n\t}\n\n\treturn (iterated.value.toUpperCase() + s.slice(iterated.value.length)) as Capitalize<S>;\n}\n\n/**\n * Compares strings lexically to form a strict partial ordering.\n */\nexport function compareStrings<T extends string>(a: T, b: T): number {\n\treturn a > b ? 1 : a === b ? 0 : -1;\n}\n\n/**\n * Defines a property on an object that is lazily initialized and cached.\n * @remarks This is useful for properties that are expensive to compute and it is not guaranteed that they will be accessed.\n * This function initially defines a getter on the object, but after first read it replaces the getter with a value property.\n * @param obj - The object on which to define the property.\n * @param key - The key of the property to define.\n * @param get - The function (called either once or not at all) to compute the value of the property.\n * @returns `obj`, typed such that it has the new property.\n * This allows for the new property to be read off of `obj` in a type-safe manner after calling this function.\n */\nexport function defineLazyCachedProperty<\n\tT extends object,\n\tK extends string | number | symbol,\n\tV,\n>(obj: T, key: K, get: () => V): typeof obj & { [P in K]: V } {\n\tReflect.defineProperty(obj, key, {\n\t\tget() {\n\t\t\tconst value = get();\n\t\t\tReflect.defineProperty(obj, key, { value });\n\t\t\treturn value;\n\t\t},\n\t\tconfigurable: true,\n\t});\n\treturn obj as typeof obj & { [P in K]: V };\n}\n\n/**\n * Copies a given property from one object to another if and only if the property is defined.\n * @param source - The object to copy the property from.\n * If `source` is undefined or does not have the property defined, then this function will do nothing.\n * @param property - The property to copy.\n * @param destination - The object to copy the property to.\n * @remarks This function is useful for copying properties from one object to another while minimizing the presence of `undefined` values.\n * If `property` is not present on `source` - or if `property` is present, but has a value of `undefined` - then this function will not modify `destination`.\n * This is different from doing `destination.foo = source.foo`, which would define a `\"foo\"` property on `destination` with the value `undefined`.\n *\n * If the type of `source` is known to have `property`, then this function asserts that the type of `destination` has `property` as well after the call.\n *\n * This function first reads the property value (if present) from `source` and then sets it on `destination`, as opposed to e.g. directly copying the property descriptor.\n * @privateRemarks The first overload of this function allows auto-complete to suggest property names from `source`, but by having the second overload we still allow for arbitrary property names.\n */\nexport function copyPropertyIfDefined<S extends object, K extends keyof S, D extends object>(\n\tsource: S | undefined,\n\tproperty: K,\n\tdestination: D,\n): asserts destination is K extends keyof S ? D & { [P in K]: S[K] } : D;\nexport function copyPropertyIfDefined<\n\tS extends object,\n\tK extends string | number | symbol,\n\tD extends object,\n>(\n\tsource: S | undefined,\n\tproperty: K,\n\tdestination: D,\n): asserts destination is K extends keyof S ? D & { [P in K]: S[K] } : D;\nexport function copyPropertyIfDefined<\n\tS extends object,\n\tK extends string | number | symbol,\n\tD extends object,\n>(\n\tsource: S | undefined,\n\tproperty: K,\n\tdestination: D,\n): asserts destination is K extends keyof S ? D & { [P in K]: S[K] } : D {\n\tif (source !== undefined) {\n\t\tconst value = (source as { [P in K]?: unknown })[property];\n\t\tif (value !== undefined) {\n\t\t\t(destination as { [P in K]: unknown })[property] = value;\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/util/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,eAAe,MAAM,yBAAyB,CAAC;AA8BtD;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAI,QAAW;IACvC,OAAO,QAAsB,CAAC;AAC/B,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,eAAe,CAAC;AAErC;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAAC,OAAwB;IAC5C,uHAAuH;IACvH,4GAA4G;IAC5G,MAAM,WAAW,GAChB,MAAM,CAAC;IACR,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAI,CAAyB;IAC3D,+EAA+E;IAC/E,wEAAwE;IACxE,oEAAoE;IACpE,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACzB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAI,IAAY,EAAE,MAA4B;IACtE,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC;QAC/B,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAUD,MAAM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,GAAI,MAAiC,CAAC,QAAQ,CAAC,CAAC;QAC3D,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,WAAqC,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;QAC1D,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { Type } from \"@sinclair/typebox\";\nimport structuredClone from \"@ungap/structured-clone\";\n\n/**\n * Subset of Map interface.\n */\nexport interface MapGetSet<K, V> {\n\tget(key: K): V | undefined;\n\tset(key: K, value: V): void;\n}\n\n/**\n * Make all transitive properties in `T` readonly\n */\nexport type RecursiveReadonly<T> = {\n\treadonly [P in keyof T]: RecursiveReadonly<T[P]>;\n};\n\n/**\n * Remove `readonly` from all fields.\n */\nexport type Mutable<T> = { -readonly [P in keyof T]: T[P] };\n\n/**\n * Make all field required and omits fields whose ony valid value would be `undefined`.\n * This is analogous to `Required<T>` except it tolerates 'optional undefined'.\n */\nexport type Populated<T> = {\n\t[P in keyof T as Exclude<P, T[P] extends undefined ? P : never>]-?: T[P];\n};\n\n/**\n * Casts a readonly object to a mutable one.\n * Better than casting to `Mutable<Foo>` because it doesn't risk casting a non-`Foo` to a `Mutable<Foo>`.\n * @param readonly - The object with readonly fields.\n * @returns The same object but with a type that makes all fields mutable.\n */\nexport function asMutable<T>(readonly: T): Mutable<T> {\n\treturn readonly as Mutable<T>;\n}\n\nexport const clone = structuredClone;\n\n/**\n * Throw an error with a constant message.\n * @remarks\n * Works like {@link @fluidframework/core-utils/internal#assert}.\n */\nexport function fail(message: string | number): never {\n\t// Declaring this here aliased to a different name avoids the assert tagging objecting to the usages of `assert` below.\n\t// Since users of `fail` do the assert message tagging instead, suppressing tagging errors here makes sense.\n\tconst assertNoTag: (condition: boolean, message: string | number) => asserts condition =\n\t\tassert;\n\tassertNoTag(false, message);\n}\n\n/**\n * Checks whether or not the given object is a `readonly` array.\n *\n * Note that this does NOT indicate if a given array should be treated as readonly.\n * This instead indicates if an object is an Array, and is typed to tolerate the readonly case.\n */\nexport function isReadonlyArray<T>(x: readonly T[] | unknown): x is readonly T[] {\n\t// `Array.isArray()` does not properly narrow `readonly` array types by itself,\n\t// so we wrap it in this type guard. This may become unnecessary if/when\n\t// https://github.com/microsoft/TypeScript/issues/17002 is resolved.\n\treturn Array.isArray(x);\n}\n\n/**\n * Creates and populates a new array.\n * @param size - The size of the array to be created.\n * @param filler - Callback for populating the array with a value for a given index\n */\nexport function makeArray<T>(size: number, filler: (index: number) => T): T[] {\n\tconst array = [];\n\tfor (let i = 0; i < size; ++i) {\n\t\tarray.push(filler(i));\n\t}\n\treturn array;\n}\n\n/**\n * Returns the last element of an array, or `undefined` if the array has no elements.\n * @param array - The array to get the last element from.\n * @remarks\n * If the type of the array has been narrowed by e.g. {@link hasSome | hasSome(array)} or {@link hasSingle | hasOne(array)} then the return type will be `T` rather than `T | undefined`.\n */\nexport function getLast<T>(array: readonly [T, ...T[]]): T;\nexport function getLast<T>(array: { [index: number]: T; length: number }): T | undefined;\nexport function getLast<T>(array: { [index: number]: T; length: number }): T | undefined {\n\treturn array[array.length - 1];\n}\n\n/**\n * Returns true if and only if the given array has at least one element.\n * @param array - The array to check.\n * @remarks\n * If `array` contains at least one element, its type will be narrowed and can benefit from improved typing from e.g. `array[0]` and {@link getLast | getLast(array)}.\n * This is especially useful when \"noUncheckedIndexedAccess\" is enabled in the TypeScript compiler options, since the return type of `array[0]` will be `T` rather than `T | undefined`.\n */\nexport function hasSome<T>(array: T[]): array is [T, ...T[]];\nexport function hasSome<T>(array: readonly T[]): array is readonly [T, ...T[]];\nexport function hasSome<T>(array: readonly T[]): array is [T, ...T[]] {\n\treturn array.length > 0;\n}\n\n/**\n * Returns true if and only if the given array has exactly one element.\n * @param array - The array to check.\n * @remarks\n * If `array` contains exactly one element, its type will be narrowed and can benefit from improved typing from e.g. `array[0]` and {@link getLast | getLast(array)}.\n * This is especially useful when \"noUncheckedIndexedAccess\" is enabled in the TypeScript compiler options, since the return type of `array[0]` will be `T` rather than `T | undefined`.\n */\nexport function hasSingle<T>(array: T[]): array is [T];\nexport function hasSingle<T>(array: readonly T[]): array is readonly [T];\nexport function hasSingle<T>(array: readonly T[]): array is [T] {\n\treturn array.length === 1;\n}\n\n/**\n * Compares two sets using callbacks.\n * Early returns on first false comparison.\n *\n * @param a - One Set.\n * @param b - The other Set.\n * @param aExtra - Called for items in `a` but not `b`.\n * @param bExtra - Called for items in `b` but not `a`.\n * @param same - Called for items in `a` and `b`.\n * @returns false iff any of the call backs returned false.\n */\nexport function compareSets<T>({\n\ta,\n\tb,\n\taExtra,\n\tbExtra,\n\tsame,\n}: {\n\ta: ReadonlySet<T> | ReadonlyMap<T, unknown>;\n\tb: ReadonlySet<T> | ReadonlyMap<T, unknown>;\n\taExtra?: (t: T) => boolean;\n\tbExtra?: (t: T) => boolean;\n\tsame?: (t: T) => boolean;\n}): boolean {\n\tfor (const item of a.keys()) {\n\t\tif (!b.has(item)) {\n\t\t\tif (aExtra !== undefined) {\n\t\t\t\tif (!aExtra(item)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} else {\n\t\t\tif (same !== undefined && !same(item)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\tfor (const item of b.keys()) {\n\t\tif (!a.has(item)) {\n\t\t\tif (bExtra !== undefined) {\n\t\t\t\tif (!bExtra(item)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\treturn true;\n}\n\n/**\n * Retrieve a value from a map with the given key, or create a new entry if the key is not in the map.\n * @param map - The map to query/update\n * @param key - The key to lookup in the map\n * @param defaultValue - a function which returns a default value. This is called and used to set an initial value for the given key in the map if none exists\n * @returns either the existing value for the given key, or the newly-created value (the result of `defaultValue`)\n */\nexport function getOrCreate<K, V>(\n\tmap: MapGetSet<K, V>,\n\tkey: K,\n\tdefaultValue: (key: K) => V,\n): V {\n\tlet value = map.get(key);\n\tif (value === undefined) {\n\t\tvalue = defaultValue(key);\n\t\tmap.set(key, value);\n\t}\n\treturn value;\n}\n\n/**\n * Utility for dictionaries whose values are lists.\n * Gets the list associated with the provided key, if it exists.\n * Otherwise, creates an entry with an empty list, and returns that list.\n */\nexport function getOrAddEmptyToMap<K, V>(map: MapGetSet<K, V[]>, key: K): V[] {\n\tlet collection = map.get(key);\n\tif (collection === undefined) {\n\t\tcollection = [];\n\t\tmap.set(key, collection);\n\t}\n\treturn collection;\n}\n\n/**\n * Map one iterable to another by transforming each element one at a time\n * @param iterable - the iterable to transform\n * @param map - the transformation function to run on each element of the iterable\n * @returns a new iterable of elements which have been transformed by the `map` function\n */\nexport function* mapIterable<T, U>(\n\titerable: Iterable<T>,\n\tmap: (t: T) => U,\n): IterableIterator<U> {\n\tfor (const t of iterable) {\n\t\tyield map(t);\n\t}\n}\n\n/**\n * Filter one iterable into another\n * @param iterable - the iterable to filter\n * @param filter - the predicate function to run on each element of the iterable\n * @returns a new iterable including only the elements that passed the filter predicate\n */\nexport function* filterIterable<T>(\n\titerable: Iterable<T>,\n\tfilter: (t: T) => boolean,\n): IterableIterator<T> {\n\tfor (const t of iterable) {\n\t\tif (filter(t)) {\n\t\t\tyield t;\n\t\t}\n\t}\n}\n\n/**\n * Finds the first element in the given iterable that satisfies a predicate.\n * @param iterable - The iterable to search for an eligible element\n * @param predicate - The predicate to run against each element\n * @returns The first element in the iterable that satisfies the predicate, or undefined if the iterable contains no such element\n */\nexport function find<T>(iterable: Iterable<T>, predicate: (t: T) => boolean): T | undefined {\n\tfor (const t of iterable) {\n\t\tif (predicate(t)) {\n\t\t\treturn t;\n\t\t}\n\t}\n}\n\n/**\n * Counts the number of elements in the given iterable.\n * @param iterable - the iterable to enumerate\n * @returns the number of elements that were iterated after exhausting the iterable\n */\nexport function count(iterable: Iterable<unknown>): number {\n\tlet n = 0;\n\tfor (const _ of iterable) {\n\t\tn += 1;\n\t}\n\treturn n;\n}\n\n/**\n * Use for Json compatible data.\n *\n * @typeparam TExtra - Type permitted in addition to the normal JSON types.\n * Commonly used for to allow {@link @fluidframework/core-interfaces#IFluidHandle} within the otherwise JSON compatible content.\n *\n * @remarks\n * This does not robustly forbid non json comparable data via type checking,\n * but instead mostly restricts access to it.\n * @alpha\n */\nexport type JsonCompatible<TExtra = never> =\n\t| string\n\t| number\n\t| boolean\n\t// eslint-disable-next-line @rushstack/no-new-null\n\t| null\n\t| JsonCompatible<TExtra>[]\n\t| JsonCompatibleObject<TExtra>\n\t| TExtra;\n\n/**\n * Use for Json object compatible data.\n * @remarks\n * This does not robustly forbid non json comparable data via type checking,\n * but instead mostly restricts access to it.\n * @alpha\n */\nexport type JsonCompatibleObject<TExtra = never> = { [P in string]?: JsonCompatible<TExtra> };\n\n/**\n * Use for readonly view of Json compatible data.\n * @remarks\n * This does not robustly forbid non json comparable data via type checking,\n * but instead mostly restricts access to it.\n */\nexport type JsonCompatibleReadOnly =\n\t| string\n\t| number\n\t| boolean\n\t// eslint-disable-next-line @rushstack/no-new-null\n\t| null\n\t| readonly JsonCompatibleReadOnly[]\n\t| JsonCompatibleReadOnlyObject;\n\n/**\n * Use for readonly view of Json compatible data.\n * @remarks\n * This does not robustly forbid non json comparable data via type checking,\n * but instead mostly restricts access to it.\n */\nexport type JsonCompatibleReadOnlyObject = { readonly [P in string]?: JsonCompatibleReadOnly };\n\n/**\n * @remarks TODO: Audit usage of this type in schemas, evaluating whether it is necessary and performance\n * of alternatives.\n *\n * True \"arbitrary serializable data\" is probably fine, but some persisted types declarations might be better\n * expressed using composition of schemas for runtime validation, even if we don't think making the types\n * generic is worth the maintenance cost.\n */\nexport const JsonCompatibleReadOnlySchema = Type.Any();\n\n/**\n * Returns if a particular json compatible value is an object.\n * Does not include `null` or arrays.\n */\nexport function isJsonObject(\n\tvalue: JsonCompatibleReadOnly,\n): value is { readonly [P in string]?: JsonCompatibleReadOnly } {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/**\n * Verifies that the supplied indices are valid within the supplied array.\n * @param startIndex - The starting index in the range. Must be in [0, length).\n * @param endIndex - The ending index in the range. Must be within (start, length].\n * @param array - The array the indices refer to\n */\nexport function assertValidRangeIndices(\n\tstartIndex: number,\n\tendIndex: number,\n\tarray: { readonly length: number },\n): void {\n\tassert(endIndex >= startIndex, 0x79c /* Range indices are malformed. */);\n\tassertValidIndex(startIndex, array, false);\n\tassertValidIndex(endIndex, array, true);\n}\n\nexport function assertValidIndex(\n\tindex: number,\n\tarray: { readonly length: number },\n\tallowOnePastEnd: boolean = false,\n): void {\n\tassertNonNegativeSafeInteger(index);\n\tif (allowOnePastEnd) {\n\t\tassert(index <= array.length, 0x378 /* index must be less than or equal to length */);\n\t} else {\n\t\tassert(index < array.length, 0x379 /* index must be less than length */);\n\t}\n}\n\nexport function assertValidRange(\n\t{ start, end }: { start: number; end: number },\n\tarray: { readonly length: number },\n): void {\n\tassertNonNegativeSafeInteger(start);\n\tassertNonNegativeSafeInteger(end);\n\tassert(end <= array.length, 0x79d /* Range end must be less than or equal to length */);\n\tassert(start <= end, 0x79e /* Range start must be less than or equal to range start */);\n}\n\nexport function assertNonNegativeSafeInteger(index: number): void {\n\tassert(Number.isSafeInteger(index), 0x376 /* index must be an integer */);\n\tassert(index >= 0, 0x377 /* index must be non-negative */);\n}\n\n/**\n * Convert an object into a Map.\n *\n * This function must only be used with objects specifically intended to encode map like information.\n * The only time such objects should be used is for encoding maps as object literals to allow for developer ergonomics or JSON compatibility.\n * Even those two use-cases need to be carefully considered as using objects as maps can have a lot of issues\n * (including but not limited to unintended access to __proto__ and other non-owned keys).\n * This function helps these few cases get into using an actual map in as safe of was as is practical.\n */\nexport function objectToMap<MapKey extends string | number | symbol, MapValue>(\n\tobjectMap: Record<MapKey, MapValue>,\n): Map<MapKey, MapValue> {\n\tconst map = new Map<MapKey, MapValue>();\n\t// This function must only be used with objects specifically intended to encode map like information.\n\tfor (const key of Object.keys(objectMap)) {\n\t\tconst element = objectMap[key as MapKey];\n\t\tmap.set(key as MapKey, element);\n\t}\n\treturn map;\n}\n\n/**\n * Convert an object used as a map into a new object used like a map.\n *\n * @remarks\n * This function must only be used with objects specifically intended to encode map like information.\n * The only time such objects should be used is for encoding maps as object literals to allow for developer ergonomics or JSON compatibility.\n * Even those two use-cases need to be carefully considered as using objects as maps can have a lot of issues\n * (including but not limited to unintended access to __proto__ and other non-owned keys).\n * {@link objectToMap} helps these few cases get into using an actual map in as safe of a way as is practical.\n */\nexport function transformObjectMap<\n\tMapKey extends string | number | symbol,\n\tMapValue,\n\tNewMapValue,\n>(\n\tobjectMap: Record<MapKey, MapValue>,\n\ttransformer: (value: MapValue, key: MapKey) => NewMapValue,\n): Record<MapKey, MapValue> {\n\tconst output: Record<MapKey, MapValue> = Object.create(null);\n\t// This function must only be used with objects specifically intended to encode map like information.\n\tfor (const key of Object.keys(objectMap)) {\n\t\tconst element = objectMap[key as MapKey];\n\t\tObject.defineProperty(output, key, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: transformer(element, key as MapKey),\n\t\t});\n\t}\n\treturn output;\n}\n\n/**\n * Make an inverted copy of a map.\n *\n * @returns a map which can look up the keys from the values of the original map.\n */\nexport function invertMap<Key, Value>(input: Map<Key, Value>): Map<Value, Key> {\n\tconst result = new Map<Value, Key>(mapIterable(input, ([key, value]) => [value, key]));\n\tassert(\n\t\tresult.size === input.size,\n\t\t0x88a /* all values in a map must be unique to invert it */,\n\t);\n\treturn result;\n}\n\n/**\n * Returns the value from `set` if it contains exactly one item, otherwise `undefined`.\n */\nexport function oneFromSet<T>(set: ReadonlySet<T> | undefined): T | undefined {\n\tif (set === undefined) {\n\t\treturn undefined;\n\t}\n\tif (set.size !== 1) {\n\t\treturn undefined;\n\t}\n\tfor (const item of set) {\n\t\treturn item;\n\t}\n}\n\n/**\n * Type with a name describing what it is.\n * Typically used with values (like schema) that can be stored in a map, but in some representations have their name/key as a field.\n */\nexport interface Named<TName> {\n\treadonly name: TName;\n}\n\n/**\n * Order {@link Named} objects by their name.\n */\nexport function compareNamed(a: Named<string>, b: Named<string>): -1 | 0 | 1 {\n\tif (a.name < b.name) {\n\t\treturn -1;\n\t}\n\tif (a.name > b.name) {\n\t\treturn 1;\n\t}\n\treturn 0;\n}\n\n/**\n * Placeholder for `Symbol.dispose`.\n * @privateRemarks\n * TODO: replace this with `Symbol.dispose` when it is available or make it a valid polyfill.\n */\nexport const disposeSymbol: unique symbol = Symbol(\"Symbol.dispose placeholder\");\n\n/**\n * An object with an explicit lifetime that can be ended.\n * @privateRemarks\n * Simpler alternative to core-utils/IDisposable for internal use in this package.\n * This avoids adding a named \"dispose\" method, and will eventually be replaced with\n * {@link https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management| TypeScript's Disposable}.\n *\n * Once this is replaced with TypeScript's Disposable, core-utils/IDisposable can extend it, bringing the APIs into a reasonable alignment.\n */\nexport interface IDisposable {\n\t/**\n\t * Call to end the lifetime of this object.\n\t *\n\t * It is invalid to use this object after this,\n\t * except for operations which explicitly document they are valid after disposal.\n\t *\n\t * @remarks\n\t * May cleanup resources retained by this object.\n\t * Often includes un-registering from events and thus preventing other objects from retaining a reference to this indefinably.\n\t *\n\t * Usually the only operations allowed after disposal are querying if an object is already disposed,\n\t * but this can vary between implementations.\n\t */\n\t[disposeSymbol](): void;\n}\n\n/**\n * Capitalize a string.\n */\nexport function capitalize<S extends string>(s: S): Capitalize<S> {\n\t// To avoid splitting characters which are made of multiple UTF-16 code units,\n\t// use iteration instead of indexing to separate the first character.\n\tconst iterated = s[Symbol.iterator]().next();\n\tif (iterated.done === true) {\n\t\t// Empty string case.\n\t\treturn \"\" as Capitalize<S>;\n\t}\n\n\treturn (iterated.value.toUpperCase() + s.slice(iterated.value.length)) as Capitalize<S>;\n}\n\n/**\n * Compares strings lexically to form a strict partial ordering.\n */\nexport function compareStrings<T extends string>(a: T, b: T): number {\n\treturn a > b ? 1 : a === b ? 0 : -1;\n}\n\n/**\n * Defines a property on an object that is lazily initialized and cached.\n * @remarks This is useful for properties that are expensive to compute and it is not guaranteed that they will be accessed.\n * This function initially defines a getter on the object, but after first read it replaces the getter with a value property.\n * @param obj - The object on which to define the property.\n * @param key - The key of the property to define.\n * @param get - The function (called either once or not at all) to compute the value of the property.\n * @returns `obj`, typed such that it has the new property.\n * This allows for the new property to be read off of `obj` in a type-safe manner after calling this function.\n */\nexport function defineLazyCachedProperty<\n\tT extends object,\n\tK extends string | number | symbol,\n\tV,\n>(obj: T, key: K, get: () => V): typeof obj & { [P in K]: V } {\n\tReflect.defineProperty(obj, key, {\n\t\tget() {\n\t\t\tconst value = get();\n\t\t\tReflect.defineProperty(obj, key, { value });\n\t\t\treturn value;\n\t\t},\n\t\tconfigurable: true,\n\t});\n\treturn obj as typeof obj & { [P in K]: V };\n}\n\n/**\n * Copies a given property from one object to another if and only if the property is defined.\n * @param source - The object to copy the property from.\n * If `source` is undefined or does not have the property defined, then this function will do nothing.\n * @param property - The property to copy.\n * @param destination - The object to copy the property to.\n * @remarks This function is useful for copying properties from one object to another while minimizing the presence of `undefined` values.\n * If `property` is not present on `source` - or if `property` is present, but has a value of `undefined` - then this function will not modify `destination`.\n * This is different from doing `destination.foo = source.foo`, which would define a `\"foo\"` property on `destination` with the value `undefined`.\n *\n * If the type of `source` is known to have `property`, then this function asserts that the type of `destination` has `property` as well after the call.\n *\n * This function first reads the property value (if present) from `source` and then sets it on `destination`, as opposed to e.g. directly copying the property descriptor.\n * @privateRemarks The first overload of this function allows auto-complete to suggest property names from `source`, but by having the second overload we still allow for arbitrary property names.\n */\nexport function copyPropertyIfDefined<S extends object, K extends keyof S, D extends object>(\n\tsource: S | undefined,\n\tproperty: K,\n\tdestination: D,\n): asserts destination is K extends keyof S ? D & { [P in K]: S[K] } : D;\nexport function copyPropertyIfDefined<\n\tS extends object,\n\tK extends string | number | symbol,\n\tD extends object,\n>(\n\tsource: S | undefined,\n\tproperty: K,\n\tdestination: D,\n): asserts destination is K extends keyof S ? D & { [P in K]: S[K] } : D;\nexport function copyPropertyIfDefined<\n\tS extends object,\n\tK extends string | number | symbol,\n\tD extends object,\n>(\n\tsource: S | undefined,\n\tproperty: K,\n\tdestination: D,\n): asserts destination is K extends keyof S ? D & { [P in K]: S[K] } : D {\n\tif (source !== undefined) {\n\t\tconst value = (source as { [P in K]?: unknown })[property];\n\t\tif (value !== undefined) {\n\t\t\t(destination as { [P in K]: unknown })[property] = value;\n\t\t}\n\t}\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/tree",
3
- "version": "2.13.0",
3
+ "version": "2.20.0",
4
4
  "description": "Distributed tree",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -89,18 +89,18 @@
89
89
  "temp-directory": "nyc/.nyc_output"
90
90
  },
91
91
  "dependencies": {
92
- "@fluid-internal/client-utils": "~2.13.0",
93
- "@fluidframework/container-runtime": "~2.13.0",
94
- "@fluidframework/core-interfaces": "~2.13.0",
95
- "@fluidframework/core-utils": "~2.13.0",
96
- "@fluidframework/datastore-definitions": "~2.13.0",
97
- "@fluidframework/driver-definitions": "~2.13.0",
98
- "@fluidframework/id-compressor": "~2.13.0",
99
- "@fluidframework/runtime-definitions": "~2.13.0",
100
- "@fluidframework/runtime-utils": "~2.13.0",
101
- "@fluidframework/shared-object-base": "~2.13.0",
102
- "@fluidframework/telemetry-utils": "~2.13.0",
103
- "@sinclair/typebox": "^0.32.29",
92
+ "@fluid-internal/client-utils": "~2.20.0",
93
+ "@fluidframework/container-runtime": "~2.20.0",
94
+ "@fluidframework/core-interfaces": "~2.20.0",
95
+ "@fluidframework/core-utils": "~2.20.0",
96
+ "@fluidframework/datastore-definitions": "~2.20.0",
97
+ "@fluidframework/driver-definitions": "~2.20.0",
98
+ "@fluidframework/id-compressor": "~2.20.0",
99
+ "@fluidframework/runtime-definitions": "~2.20.0",
100
+ "@fluidframework/runtime-utils": "~2.20.0",
101
+ "@fluidframework/shared-object-base": "~2.20.0",
102
+ "@fluidframework/telemetry-utils": "~2.20.0",
103
+ "@sinclair/typebox": "^0.34.13",
104
104
  "@tylerbu/sorted-btree-es6": "^1.8.0",
105
105
  "@types/ungap__structured-clone": "^1.2.0",
106
106
  "@ungap/structured-clone": "^1.2.0",
@@ -109,20 +109,20 @@
109
109
  "devDependencies": {
110
110
  "@arethetypeswrong/cli": "^0.17.1",
111
111
  "@biomejs/biome": "~1.9.3",
112
- "@fluid-internal/mocha-test-setup": "~2.13.0",
113
- "@fluid-private/stochastic-test-utils": "~2.13.0",
114
- "@fluid-private/test-dds-utils": "~2.13.0",
115
- "@fluid-private/test-drivers": "~2.13.0",
112
+ "@fluid-internal/mocha-test-setup": "~2.20.0",
113
+ "@fluid-private/stochastic-test-utils": "~2.20.0",
114
+ "@fluid-private/test-dds-utils": "~2.20.0",
115
+ "@fluid-private/test-drivers": "~2.20.0",
116
116
  "@fluid-tools/benchmark": "^0.50.0",
117
117
  "@fluid-tools/build-cli": "^0.51.0",
118
118
  "@fluidframework/build-common": "^2.0.3",
119
119
  "@fluidframework/build-tools": "^0.51.0",
120
- "@fluidframework/container-definitions": "~2.13.0",
121
- "@fluidframework/container-loader": "~2.13.0",
120
+ "@fluidframework/container-definitions": "~2.20.0",
121
+ "@fluidframework/container-loader": "~2.20.0",
122
122
  "@fluidframework/eslint-config-fluid": "^5.6.0",
123
- "@fluidframework/test-runtime-utils": "~2.13.0",
124
- "@fluidframework/test-utils": "~2.13.0",
125
- "@fluidframework/tree-previous": "npm:@fluidframework/tree@2.12.0",
123
+ "@fluidframework/test-runtime-utils": "~2.20.0",
124
+ "@fluidframework/test-utils": "~2.20.0",
125
+ "@fluidframework/tree-previous": "npm:@fluidframework/tree@2.13.0",
126
126
  "@microsoft/api-extractor": "7.47.8",
127
127
  "@types/diff": "^3.5.1",
128
128
  "@types/easy-table": "^0.0.32",
@@ -179,7 +179,7 @@
179
179
  "build:commonjs": "fluid-build . --task commonjs",
180
180
  "build:compile": "fluid-build . --task compile",
181
181
  "build:docs": "api-extractor run --local",
182
- "build:esnext": "tsc --project ./tsconfig.json && copyfiles -f ../../../common/build/build-common/src/esm/package.json ./lib",
182
+ "build:esnext": "tsc --project ./tsconfig.json",
183
183
  "build:genver": "gen-version",
184
184
  "build:test": "npm run build:test:esm && npm run build:test:cjs",
185
185
  "build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
package/src/core/index.ts CHANGED
@@ -67,8 +67,6 @@ export {
67
67
  forEachField,
68
68
  type PathRootPrefix,
69
69
  deltaForRootInitialization,
70
- emptyFieldChanges,
71
- isEmptyFieldChanges,
72
70
  makeDetachedNodeId,
73
71
  offsetDetachId,
74
72
  emptyDelta,
@@ -198,10 +196,15 @@ export {
198
196
  taggedAtomId,
199
197
  taggedOptAtomId,
200
198
  offsetChangeAtomId,
199
+ subtractChangeAtomIds,
201
200
  replaceAtomRevisions,
202
201
  replaceChange,
203
202
  type RebaseStats,
204
203
  type RebaseStatsWithDuration,
204
+ isAncestor,
205
+ type ChangeAtomIdRangeMap,
206
+ newChangeAtomIdRangeMap,
207
+ compareRevisions,
205
208
  } from "./rebase/index.js";
206
209
 
207
210
  export {
@@ -23,7 +23,11 @@ export {
23
23
  taggedAtomId,
24
24
  taggedOptAtomId,
25
25
  offsetChangeAtomId,
26
+ subtractChangeAtomIds,
26
27
  replaceAtomRevisions,
28
+ type ChangeAtomIdRangeMap,
29
+ newChangeAtomIdRangeMap,
30
+ compareRevisions,
27
31
  } from "./types.js";
28
32
  export { RevisionTagCodec } from "./revisionTagCodec.js";
29
33
  export {
@@ -49,4 +53,5 @@ export {
49
53
  type RebaseStats,
50
54
  type RebaseStatsWithDuration,
51
55
  replaceChange,
56
+ isAncestor,
52
57
  } from "./utils.js";
@@ -13,7 +13,7 @@ import { Type } from "@sinclair/typebox";
13
13
  import {
14
14
  type Brand,
15
15
  type NestedMap,
16
- type RangeMap,
16
+ RangeMap,
17
17
  brand,
18
18
  brandedNumberType,
19
19
  brandedStringType,
@@ -69,10 +69,6 @@ export type EncodedChangeAtomId = [ChangesetLocalId, EncodedRevisionTag] | Chang
69
69
  */
70
70
  export type ChangeAtomIdMap<T> = NestedMap<RevisionTag | undefined, ChangesetLocalId, T>;
71
71
 
72
- /**
73
- */
74
- export type ChangeAtomIdRangeMap<T> = Map<RevisionTag | undefined, RangeMap<T>>;
75
-
76
72
  /**
77
73
  * @returns true iff `a` and `b` are the same.
78
74
  */
@@ -204,3 +200,35 @@ export function mintCommit<TChange>(
204
200
  parent,
205
201
  };
206
202
  }
203
+
204
+ export type ChangeAtomIdRangeMap<V> = RangeMap<ChangeAtomId, V>;
205
+
206
+ export function newChangeAtomIdRangeMap<V>(): ChangeAtomIdRangeMap<V> {
207
+ return new RangeMap(offsetChangeAtomId, subtractChangeAtomIds);
208
+ }
209
+
210
+ export function subtractChangeAtomIds(a: ChangeAtomId, b: ChangeAtomId): number {
211
+ const cmp = compareRevisions(a.revision, b.revision);
212
+ if (cmp !== 0) {
213
+ return cmp * Number.POSITIVE_INFINITY;
214
+ }
215
+
216
+ return a.localId - b.localId;
217
+ }
218
+
219
+ export function compareRevisions(
220
+ a: RevisionTag | undefined,
221
+ b: RevisionTag | undefined,
222
+ ): number {
223
+ if (a === undefined) {
224
+ return b === undefined ? 0 : -1;
225
+ } else if (b === undefined) {
226
+ return 1;
227
+ } else if (a < b) {
228
+ return -1;
229
+ } else if (a > b) {
230
+ return 1;
231
+ }
232
+
233
+ return 0;
234
+ }
@@ -651,3 +651,30 @@ namespace Rollback {
651
651
  }
652
652
  }
653
653
  }
654
+
655
+ /**
656
+ * Checks if one node is an ancestor of another in a parent-linked tree structure.
657
+ * @param ancestor - The potential ancestor node
658
+ * @param descendant - The potential descendant node
659
+ * @param allowEqual - If true, returns true when ancestor === descendant
660
+ * @returns true if ancestor is an ancestor of descendant (or equal if allowEqual is true)
661
+ */
662
+ export function isAncestor<TNode extends { readonly parent?: TNode }>(
663
+ ancestor: TNode,
664
+ descendant: TNode,
665
+ allowEqual: boolean,
666
+ ): boolean {
667
+ if (allowEqual && ancestor === descendant) {
668
+ return true;
669
+ }
670
+
671
+ let current = descendant.parent;
672
+ while (current !== undefined) {
673
+ if (current === ancestor) {
674
+ return true;
675
+ }
676
+ current = current.parent;
677
+ }
678
+
679
+ return false;
680
+ }
@@ -98,6 +98,22 @@ export interface Root<TTree = ProtoNode> {
98
98
  * The ordering has no significance.
99
99
  */
100
100
  readonly refreshers?: readonly DetachedNodeBuild<TTree>[];
101
+ /**
102
+ * Changes to apply to detached nodes.
103
+ * The ordering has no significance.
104
+ *
105
+ * Nested changes for a root that is undergoing a rename should be listed under the starting name.
106
+ * For example, if one wishes to change a tree which is being renamed from ID A to ID B,
107
+ * then the changes should be listed under ID A.
108
+ */
109
+ readonly global?: readonly DetachedNodeChanges[];
110
+ /**
111
+ * Detached roots whose associated ID needs to be updated.
112
+ * The ordering has no significance.
113
+ * Note that the renames may need to be performed in a specific order to avoid collisions.
114
+ * This ordering problem is left to the consumer of this format.
115
+ */
116
+ readonly rename?: readonly DetachedNodeRename[];
101
117
  }
102
118
 
103
119
  /**
@@ -199,30 +215,9 @@ export interface DetachedNodeRename {
199
215
  }
200
216
 
201
217
  /**
202
- * Represents the changes to perform on a given field.
218
+ * Represents a list of changes to the nodes in the field.
219
+ * The index of each mark within the range of nodes, before
220
+ * applying any of the changes, is not represented explicitly.
221
+ * It corresponds to the sum of `mark.count` values for all previous marks for which `isAttachMark(mark)` is false.
203
222
  */
204
- export interface FieldChanges {
205
- /**
206
- * Represents a list of changes to the nodes in the field.
207
- * The index of each mark within the range of nodes, before
208
- * applying any of the changes, is not represented explicitly.
209
- * It corresponds to the sum of `mark.count` values for all previous marks for which `isAttachMark(mark)` is false.
210
- */
211
- readonly local?: readonly Mark[];
212
- /**
213
- * Changes to apply to detached nodes.
214
- * The ordering has no significance.
215
- *
216
- * Nested changes for a root that is undergoing a rename should be listed under the starting name.
217
- * For example, if one wishes to change a tree which is being renamed from ID A to ID B,
218
- * then the changes should be listed under ID A.
219
- */
220
- readonly global?: readonly DetachedNodeChanges[];
221
- /**
222
- * Detached whose associated ID needs to be updated.
223
- * The ordering has no significance.
224
- * Note that the renames may need to be performed in a specific order to avoid collisions.
225
- * This ordering problem is left to the consumer of this format.
226
- */
227
- readonly rename?: readonly DetachedNodeRename[];
228
- }
223
+ export type FieldChanges = readonly Mark[];
@@ -12,8 +12,6 @@ import { rootFieldKey } from "./types.js";
12
12
 
13
13
  export const emptyDelta: Root<never> = {};
14
14
 
15
- export const emptyFieldChanges: FieldChanges = {};
16
-
17
15
  export function isAttachMark(mark: Mark): boolean {
18
16
  return mark.attach !== undefined && mark.detach === undefined;
19
17
  }
@@ -26,14 +24,6 @@ export function isReplaceMark(mark: Mark): boolean {
26
24
  return mark.detach !== undefined && mark.attach !== undefined;
27
25
  }
28
26
 
29
- export function isEmptyFieldChanges(fieldChanges: FieldChanges): boolean {
30
- return (
31
- fieldChanges.local === undefined &&
32
- fieldChanges.global === undefined &&
33
- fieldChanges.rename === undefined
34
- );
35
- }
36
-
37
27
  export function deltaForRootInitialization(content: readonly ITreeCursorSynchronous[]): Root {
38
28
  if (content.length === 0) {
39
29
  return emptyDelta;
@@ -42,12 +32,7 @@ export function deltaForRootInitialization(content: readonly ITreeCursorSynchron
42
32
  const delta: Root = {
43
33
  build: [{ id: buildId, trees: content }],
44
34
  fields: new Map<FieldKey, FieldChanges>([
45
- [
46
- rootFieldKey,
47
- {
48
- local: [{ count: content.length, attach: buildId }],
49
- },
50
- ],
35
+ [rootFieldKey, [{ count: content.length, attach: buildId }]],
51
36
  ]),
52
37
  };
53
38
  return delta;
@@ -104,8 +104,6 @@ export { SparseNode, getDescendant } from "./sparseTree.js";
104
104
 
105
105
  export {
106
106
  deltaForRootInitialization,
107
- emptyFieldChanges,
108
- isEmptyFieldChanges,
109
107
  makeDetachedNodeId,
110
108
  offsetDetachId,
111
109
  emptyDelta,