@fluidframework/tree 2.12.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 (496) hide show
  1. package/CHANGELOG.md +154 -0
  2. package/api-report/tree.alpha.api.md +108 -22
  3. package/api-report/tree.beta.api.md +31 -15
  4. package/api-report/tree.legacy.alpha.api.md +31 -15
  5. package/api-report/tree.legacy.public.api.md +31 -15
  6. package/api-report/tree.public.api.md +31 -15
  7. package/assertTagging.config.mjs +14 -0
  8. package/dist/alpha.d.ts +14 -0
  9. package/dist/beta.d.ts +2 -0
  10. package/dist/core/index.d.ts +2 -2
  11. package/dist/core/index.d.ts.map +1 -1
  12. package/dist/core/index.js +6 -4
  13. package/dist/core/index.js.map +1 -1
  14. package/dist/core/rebase/index.d.ts +2 -2
  15. package/dist/core/rebase/index.d.ts.map +1 -1
  16. package/dist/core/rebase/index.js +5 -1
  17. package/dist/core/rebase/index.js.map +1 -1
  18. package/dist/core/rebase/types.d.ts +5 -4
  19. package/dist/core/rebase/types.d.ts.map +1 -1
  20. package/dist/core/rebase/types.js +29 -1
  21. package/dist/core/rebase/types.js.map +1 -1
  22. package/dist/core/rebase/utils.d.ts +10 -0
  23. package/dist/core/rebase/utils.d.ts.map +1 -1
  24. package/dist/core/rebase/utils.js +22 -1
  25. package/dist/core/rebase/utils.js.map +1 -1
  26. package/dist/core/tree/delta.d.ts +21 -26
  27. package/dist/core/tree/delta.d.ts.map +1 -1
  28. package/dist/core/tree/delta.js.map +1 -1
  29. package/dist/core/tree/deltaUtil.d.ts +1 -3
  30. package/dist/core/tree/deltaUtil.d.ts.map +1 -1
  31. package/dist/core/tree/deltaUtil.js +2 -14
  32. package/dist/core/tree/deltaUtil.js.map +1 -1
  33. package/dist/core/tree/index.d.ts +1 -1
  34. package/dist/core/tree/index.d.ts.map +1 -1
  35. package/dist/core/tree/index.js +1 -3
  36. package/dist/core/tree/index.js.map +1 -1
  37. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  38. package/dist/core/tree/visitDelta.js +82 -80
  39. package/dist/core/tree/visitDelta.js.map +1 -1
  40. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +10 -0
  41. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  42. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +3 -0
  43. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  44. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  45. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  46. package/dist/feature-libraries/deltaUtils.d.ts.map +1 -1
  47. package/dist/feature-libraries/deltaUtils.js +13 -0
  48. package/dist/feature-libraries/deltaUtils.js.map +1 -1
  49. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  50. package/dist/feature-libraries/forest-summary/forestSummarizer.js +1 -6
  51. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  52. package/dist/feature-libraries/index.d.ts +0 -1
  53. package/dist/feature-libraries/index.d.ts.map +1 -1
  54. package/dist/feature-libraries/index.js +2 -4
  55. package/dist/feature-libraries/index.js.map +1 -1
  56. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +5 -5
  57. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  58. package/dist/feature-libraries/modular-schema/crossFieldQueries.js +2 -3
  59. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  60. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +30 -6
  61. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  62. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  63. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  64. package/dist/feature-libraries/modular-schema/genericFieldKind.js +2 -1
  65. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  66. package/dist/feature-libraries/modular-schema/index.d.ts +2 -2
  67. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  68. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  69. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +1 -1
  70. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  71. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +8 -8
  72. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  73. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +5 -4
  74. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  75. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +186 -216
  76. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  77. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +23 -20
  78. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  79. package/dist/feature-libraries/modular-schema/modularChangeTypes.js +20 -0
  80. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  81. package/dist/feature-libraries/optional-field/optionalField.d.ts +3 -3
  82. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  83. package/dist/feature-libraries/optional-field/optionalField.js +24 -4
  84. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  85. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +1 -1
  86. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  87. package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  88. package/dist/feature-libraries/sequence-field/rebase.js +4 -4
  89. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  90. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
  91. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  92. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
  93. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  94. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +2 -3
  95. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  96. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  97. package/dist/feature-libraries/sequence-field/utils.d.ts +2 -2
  98. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  99. package/dist/feature-libraries/sequence-field/utils.js +50 -9
  100. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  101. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  102. package/dist/feature-libraries/treeCursorUtils.js +4 -1
  103. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  104. package/dist/index.d.ts +27 -3
  105. package/dist/index.d.ts.map +1 -1
  106. package/dist/index.js +5 -2
  107. package/dist/index.js.map +1 -1
  108. package/dist/legacy.d.ts +2 -0
  109. package/dist/package.json +2 -1
  110. package/dist/packageVersion.d.ts +1 -1
  111. package/dist/packageVersion.js +1 -1
  112. package/dist/packageVersion.js.map +1 -1
  113. package/dist/public.d.ts +2 -0
  114. package/dist/shared-tree/index.d.ts +3 -2
  115. package/dist/shared-tree/index.d.ts.map +1 -1
  116. package/dist/shared-tree/index.js +6 -3
  117. package/dist/shared-tree/index.js.map +1 -1
  118. package/dist/shared-tree/schematizingTreeView.d.ts +10 -1
  119. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  120. package/dist/shared-tree/schematizingTreeView.js +43 -0
  121. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  122. package/dist/shared-tree/sharedTree.d.ts +44 -21
  123. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  124. package/dist/shared-tree/sharedTree.js +41 -35
  125. package/dist/shared-tree/sharedTree.js.map +1 -1
  126. package/dist/shared-tree/transactionTypes.d.ts +105 -0
  127. package/dist/shared-tree/transactionTypes.d.ts.map +1 -0
  128. package/dist/shared-tree/transactionTypes.js +13 -0
  129. package/dist/shared-tree/transactionTypes.js.map +1 -0
  130. package/dist/shared-tree/treeApi.d.ts +1 -25
  131. package/dist/shared-tree/treeApi.d.ts.map +1 -1
  132. package/dist/shared-tree/treeApi.js +4 -8
  133. package/dist/shared-tree/treeApi.js.map +1 -1
  134. package/dist/shared-tree/treeCheckout.d.ts +4 -1
  135. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  136. package/dist/shared-tree/treeCheckout.js +142 -23
  137. package/dist/shared-tree/treeCheckout.js.map +1 -1
  138. package/dist/shared-tree-core/sharedTreeCore.js +1 -1
  139. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  140. package/dist/simple-tree/api/index.d.ts +1 -0
  141. package/dist/simple-tree/api/index.d.ts.map +1 -1
  142. package/dist/simple-tree/api/index.js +3 -1
  143. package/dist/simple-tree/api/index.js.map +1 -1
  144. package/dist/simple-tree/api/jsonSchema.d.ts +6 -0
  145. package/dist/simple-tree/api/jsonSchema.d.ts.map +1 -1
  146. package/dist/simple-tree/api/jsonSchema.js.map +1 -1
  147. package/dist/simple-tree/api/schemaFactory.d.ts +21 -12
  148. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  149. package/dist/simple-tree/api/schemaFactory.js +5 -2
  150. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  151. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +83 -0
  152. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -0
  153. package/dist/simple-tree/api/schemaFactoryAlpha.js +90 -0
  154. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -0
  155. package/dist/simple-tree/api/simpleSchema.d.ts +5 -1
  156. package/dist/simple-tree/api/simpleSchema.d.ts.map +1 -1
  157. package/dist/simple-tree/api/simpleSchema.js.map +1 -1
  158. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +13 -10
  159. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  160. package/dist/simple-tree/api/testRecursiveDomain.d.ts +5 -5
  161. package/dist/simple-tree/api/tree.d.ts +60 -0
  162. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  163. package/dist/simple-tree/api/tree.js.map +1 -1
  164. package/dist/simple-tree/api/treeNodeApi.js +1 -1
  165. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  166. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  167. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +11 -11
  168. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  169. package/dist/simple-tree/arrayNode.d.ts +2 -2
  170. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  171. package/dist/simple-tree/arrayNode.js +3 -2
  172. package/dist/simple-tree/arrayNode.js.map +1 -1
  173. package/dist/simple-tree/core/treeNodeSchema.d.ts +10 -6
  174. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  175. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  176. package/dist/simple-tree/index.d.ts +2 -2
  177. package/dist/simple-tree/index.d.ts.map +1 -1
  178. package/dist/simple-tree/index.js +3 -2
  179. package/dist/simple-tree/index.js.map +1 -1
  180. package/dist/simple-tree/leafNodeSchema.d.ts +5 -5
  181. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  182. package/dist/simple-tree/mapNode.d.ts +2 -2
  183. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  184. package/dist/simple-tree/mapNode.js +2 -1
  185. package/dist/simple-tree/mapNode.js.map +1 -1
  186. package/dist/simple-tree/objectNode.d.ts +2 -2
  187. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  188. package/dist/simple-tree/objectNode.js +2 -1
  189. package/dist/simple-tree/objectNode.js.map +1 -1
  190. package/dist/simple-tree/objectNodeTypes.d.ts +2 -2
  191. package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -1
  192. package/dist/simple-tree/objectNodeTypes.js.map +1 -1
  193. package/dist/simple-tree/schemaTypes.d.ts +47 -1
  194. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  195. package/dist/simple-tree/schemaTypes.js.map +1 -1
  196. package/dist/simple-tree/toMapTree.js +1 -1
  197. package/dist/simple-tree/toMapTree.js.map +1 -1
  198. package/dist/util/bTreeUtils.d.ts +10 -0
  199. package/dist/util/bTreeUtils.d.ts.map +1 -0
  200. package/dist/util/bTreeUtils.js +52 -0
  201. package/dist/util/bTreeUtils.js.map +1 -0
  202. package/dist/util/idAllocator.d.ts +0 -2
  203. package/dist/util/idAllocator.d.ts.map +1 -1
  204. package/dist/util/idAllocator.js +0 -2
  205. package/dist/util/idAllocator.js.map +1 -1
  206. package/dist/util/index.d.ts +3 -2
  207. package/dist/util/index.d.ts.map +1 -1
  208. package/dist/util/index.js +7 -5
  209. package/dist/util/index.js.map +1 -1
  210. package/dist/util/rangeMap.d.ts +95 -43
  211. package/dist/util/rangeMap.d.ts.map +1 -1
  212. package/dist/util/rangeMap.js +202 -148
  213. package/dist/util/rangeMap.js.map +1 -1
  214. package/dist/util/utils.d.ts +26 -2
  215. package/dist/util/utils.d.ts.map +1 -1
  216. package/dist/util/utils.js +17 -2
  217. package/dist/util/utils.js.map +1 -1
  218. package/lib/alpha.d.ts +14 -0
  219. package/lib/beta.d.ts +2 -0
  220. package/lib/core/index.d.ts +2 -2
  221. package/lib/core/index.d.ts.map +1 -1
  222. package/lib/core/index.js +2 -2
  223. package/lib/core/index.js.map +1 -1
  224. package/lib/core/rebase/index.d.ts +2 -2
  225. package/lib/core/rebase/index.d.ts.map +1 -1
  226. package/lib/core/rebase/index.js +2 -2
  227. package/lib/core/rebase/index.js.map +1 -1
  228. package/lib/core/rebase/types.d.ts +5 -4
  229. package/lib/core/rebase/types.d.ts.map +1 -1
  230. package/lib/core/rebase/types.js +26 -1
  231. package/lib/core/rebase/types.js.map +1 -1
  232. package/lib/core/rebase/utils.d.ts +10 -0
  233. package/lib/core/rebase/utils.d.ts.map +1 -1
  234. package/lib/core/rebase/utils.js +20 -0
  235. package/lib/core/rebase/utils.js.map +1 -1
  236. package/lib/core/tree/delta.d.ts +21 -26
  237. package/lib/core/tree/delta.d.ts.map +1 -1
  238. package/lib/core/tree/delta.js.map +1 -1
  239. package/lib/core/tree/deltaUtil.d.ts +1 -3
  240. package/lib/core/tree/deltaUtil.d.ts.map +1 -1
  241. package/lib/core/tree/deltaUtil.js +1 -12
  242. package/lib/core/tree/deltaUtil.js.map +1 -1
  243. package/lib/core/tree/index.d.ts +1 -1
  244. package/lib/core/tree/index.d.ts.map +1 -1
  245. package/lib/core/tree/index.js +1 -1
  246. package/lib/core/tree/index.js.map +1 -1
  247. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  248. package/lib/core/tree/visitDelta.js +82 -80
  249. package/lib/core/tree/visitDelta.js.map +1 -1
  250. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +10 -0
  251. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  252. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +3 -0
  253. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  254. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  255. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  256. package/lib/feature-libraries/deltaUtils.d.ts.map +1 -1
  257. package/lib/feature-libraries/deltaUtils.js +13 -0
  258. package/lib/feature-libraries/deltaUtils.js.map +1 -1
  259. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  260. package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -6
  261. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  262. package/lib/feature-libraries/index.d.ts +0 -1
  263. package/lib/feature-libraries/index.d.ts.map +1 -1
  264. package/lib/feature-libraries/index.js +0 -1
  265. package/lib/feature-libraries/index.js.map +1 -1
  266. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +5 -5
  267. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  268. package/lib/feature-libraries/modular-schema/crossFieldQueries.js +2 -3
  269. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  270. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +30 -6
  271. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  272. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  273. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  274. package/lib/feature-libraries/modular-schema/genericFieldKind.js +2 -1
  275. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  276. package/lib/feature-libraries/modular-schema/index.d.ts +2 -2
  277. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  278. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  279. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +1 -1
  280. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  281. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +4 -4
  282. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  283. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +5 -4
  284. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  285. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +158 -186
  286. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  287. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +23 -20
  288. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  289. package/lib/feature-libraries/modular-schema/modularChangeTypes.js +18 -1
  290. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  291. package/lib/feature-libraries/optional-field/optionalField.d.ts +3 -3
  292. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  293. package/lib/feature-libraries/optional-field/optionalField.js +24 -4
  294. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  295. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +1 -1
  296. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  297. package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  298. package/lib/feature-libraries/sequence-field/rebase.js +4 -4
  299. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  300. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
  301. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  302. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
  303. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  304. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +2 -3
  305. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  306. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  307. package/lib/feature-libraries/sequence-field/utils.d.ts +2 -2
  308. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  309. package/lib/feature-libraries/sequence-field/utils.js +50 -9
  310. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  311. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  312. package/lib/feature-libraries/treeCursorUtils.js +4 -1
  313. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  314. package/lib/index.d.ts +27 -3
  315. package/lib/index.d.ts.map +1 -1
  316. package/lib/index.js +2 -2
  317. package/lib/index.js.map +1 -1
  318. package/lib/legacy.d.ts +2 -0
  319. package/lib/packageVersion.d.ts +1 -1
  320. package/lib/packageVersion.js +1 -1
  321. package/lib/packageVersion.js.map +1 -1
  322. package/lib/public.d.ts +2 -0
  323. package/lib/shared-tree/index.d.ts +3 -2
  324. package/lib/shared-tree/index.d.ts.map +1 -1
  325. package/lib/shared-tree/index.js +3 -2
  326. package/lib/shared-tree/index.js.map +1 -1
  327. package/lib/shared-tree/schematizingTreeView.d.ts +10 -1
  328. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  329. package/lib/shared-tree/schematizingTreeView.js +46 -3
  330. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  331. package/lib/shared-tree/sharedTree.d.ts +44 -21
  332. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  333. package/lib/shared-tree/sharedTree.js +40 -34
  334. package/lib/shared-tree/sharedTree.js.map +1 -1
  335. package/lib/shared-tree/transactionTypes.d.ts +105 -0
  336. package/lib/shared-tree/transactionTypes.d.ts.map +1 -0
  337. package/lib/shared-tree/transactionTypes.js +10 -0
  338. package/lib/shared-tree/transactionTypes.js.map +1 -0
  339. package/lib/shared-tree/treeApi.d.ts +1 -25
  340. package/lib/shared-tree/treeApi.d.ts.map +1 -1
  341. package/lib/shared-tree/treeApi.js +1 -5
  342. package/lib/shared-tree/treeApi.js.map +1 -1
  343. package/lib/shared-tree/treeCheckout.d.ts +4 -1
  344. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  345. package/lib/shared-tree/treeCheckout.js +143 -24
  346. package/lib/shared-tree/treeCheckout.js.map +1 -1
  347. package/lib/shared-tree-core/sharedTreeCore.js +1 -1
  348. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  349. package/lib/simple-tree/api/index.d.ts +1 -0
  350. package/lib/simple-tree/api/index.d.ts.map +1 -1
  351. package/lib/simple-tree/api/index.js +1 -0
  352. package/lib/simple-tree/api/index.js.map +1 -1
  353. package/lib/simple-tree/api/jsonSchema.d.ts +6 -0
  354. package/lib/simple-tree/api/jsonSchema.d.ts.map +1 -1
  355. package/lib/simple-tree/api/jsonSchema.js.map +1 -1
  356. package/lib/simple-tree/api/schemaFactory.d.ts +21 -12
  357. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  358. package/lib/simple-tree/api/schemaFactory.js +5 -2
  359. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  360. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +83 -0
  361. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -0
  362. package/lib/simple-tree/api/schemaFactoryAlpha.js +86 -0
  363. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -0
  364. package/lib/simple-tree/api/simpleSchema.d.ts +5 -1
  365. package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -1
  366. package/lib/simple-tree/api/simpleSchema.js.map +1 -1
  367. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +14 -11
  368. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  369. package/lib/simple-tree/api/testRecursiveDomain.d.ts +5 -5
  370. package/lib/simple-tree/api/tree.d.ts +60 -0
  371. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  372. package/lib/simple-tree/api/tree.js.map +1 -1
  373. package/lib/simple-tree/api/treeNodeApi.js +1 -1
  374. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  375. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  376. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +12 -12
  377. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  378. package/lib/simple-tree/arrayNode.d.ts +2 -2
  379. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  380. package/lib/simple-tree/arrayNode.js +3 -2
  381. package/lib/simple-tree/arrayNode.js.map +1 -1
  382. package/lib/simple-tree/core/treeNodeSchema.d.ts +10 -6
  383. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  384. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  385. package/lib/simple-tree/index.d.ts +2 -2
  386. package/lib/simple-tree/index.d.ts.map +1 -1
  387. package/lib/simple-tree/index.js +1 -1
  388. package/lib/simple-tree/index.js.map +1 -1
  389. package/lib/simple-tree/leafNodeSchema.d.ts +5 -5
  390. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  391. package/lib/simple-tree/mapNode.d.ts +2 -2
  392. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  393. package/lib/simple-tree/mapNode.js +2 -1
  394. package/lib/simple-tree/mapNode.js.map +1 -1
  395. package/lib/simple-tree/objectNode.d.ts +2 -2
  396. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  397. package/lib/simple-tree/objectNode.js +2 -1
  398. package/lib/simple-tree/objectNode.js.map +1 -1
  399. package/lib/simple-tree/objectNodeTypes.d.ts +2 -2
  400. package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -1
  401. package/lib/simple-tree/objectNodeTypes.js.map +1 -1
  402. package/lib/simple-tree/schemaTypes.d.ts +47 -1
  403. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  404. package/lib/simple-tree/schemaTypes.js.map +1 -1
  405. package/lib/simple-tree/toMapTree.js +1 -1
  406. package/lib/simple-tree/toMapTree.js.map +1 -1
  407. package/lib/util/bTreeUtils.d.ts +10 -0
  408. package/lib/util/bTreeUtils.d.ts.map +1 -0
  409. package/lib/util/bTreeUtils.js +47 -0
  410. package/lib/util/bTreeUtils.js.map +1 -0
  411. package/lib/util/idAllocator.d.ts +0 -2
  412. package/lib/util/idAllocator.d.ts.map +1 -1
  413. package/lib/util/idAllocator.js +0 -2
  414. package/lib/util/idAllocator.js.map +1 -1
  415. package/lib/util/index.d.ts +3 -2
  416. package/lib/util/index.d.ts.map +1 -1
  417. package/lib/util/index.js +3 -2
  418. package/lib/util/index.js.map +1 -1
  419. package/lib/util/rangeMap.d.ts +95 -43
  420. package/lib/util/rangeMap.d.ts.map +1 -1
  421. package/lib/util/rangeMap.js +200 -144
  422. package/lib/util/rangeMap.js.map +1 -1
  423. package/lib/util/utils.d.ts +26 -2
  424. package/lib/util/utils.d.ts.map +1 -1
  425. package/lib/util/utils.js +15 -1
  426. package/lib/util/utils.js.map +1 -1
  427. package/package.json +24 -24
  428. package/src/core/index.ts +5 -2
  429. package/src/core/rebase/index.ts +5 -0
  430. package/src/core/rebase/types.ts +33 -5
  431. package/src/core/rebase/utils.ts +27 -0
  432. package/src/core/tree/delta.ts +21 -26
  433. package/src/core/tree/deltaUtil.ts +1 -16
  434. package/src/core/tree/index.ts +0 -2
  435. package/src/core/tree/visitDelta.ts +108 -97
  436. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +14 -1
  437. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +2 -2
  438. package/src/feature-libraries/deltaUtils.ts +13 -0
  439. package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -6
  440. package/src/feature-libraries/index.ts +0 -1
  441. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +12 -13
  442. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +33 -9
  443. package/src/feature-libraries/modular-schema/genericFieldKind.ts +6 -4
  444. package/src/feature-libraries/modular-schema/index.ts +3 -0
  445. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +12 -11
  446. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +254 -248
  447. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +51 -26
  448. package/src/feature-libraries/optional-field/optionalField.ts +37 -8
  449. package/src/feature-libraries/sequence-field/moveEffectTable.ts +1 -1
  450. package/src/feature-libraries/sequence-field/rebase.ts +9 -3
  451. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +1 -1
  452. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +1 -1
  453. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +3 -4
  454. package/src/feature-libraries/sequence-field/utils.ts +54 -11
  455. package/src/feature-libraries/treeCursorUtils.ts +6 -1
  456. package/src/index.ts +45 -6
  457. package/src/packageVersion.ts +1 -1
  458. package/src/shared-tree/index.ts +16 -3
  459. package/src/shared-tree/schematizingTreeView.ts +91 -2
  460. package/src/shared-tree/sharedTree.ts +69 -44
  461. package/src/shared-tree/transactionTypes.ts +125 -0
  462. package/src/shared-tree/treeApi.ts +1 -28
  463. package/src/shared-tree/treeCheckout.ts +166 -25
  464. package/src/shared-tree-core/sharedTreeCore.ts +1 -1
  465. package/src/simple-tree/api/index.ts +1 -0
  466. package/src/simple-tree/api/jsonSchema.ts +7 -0
  467. package/src/simple-tree/api/schemaFactory.ts +33 -6
  468. package/src/simple-tree/api/schemaFactoryAlpha.ts +253 -0
  469. package/src/simple-tree/api/simpleSchema.ts +6 -1
  470. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +22 -12
  471. package/src/simple-tree/api/tree.ts +76 -4
  472. package/src/simple-tree/api/treeNodeApi.ts +1 -1
  473. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +19 -13
  474. package/src/simple-tree/arrayNode.ts +8 -2
  475. package/src/simple-tree/core/treeNodeSchema.ts +51 -7
  476. package/src/simple-tree/index.ts +3 -0
  477. package/src/simple-tree/mapNode.ts +7 -1
  478. package/src/simple-tree/objectNode.ts +7 -1
  479. package/src/simple-tree/objectNodeTypes.ts +4 -1
  480. package/src/simple-tree/schemaTypes.ts +50 -1
  481. package/src/simple-tree/toMapTree.ts +1 -1
  482. package/src/util/bTreeUtils.ts +60 -0
  483. package/src/util/idAllocator.ts +0 -2
  484. package/src/util/index.ts +5 -6
  485. package/src/util/rangeMap.ts +259 -184
  486. package/src/util/utils.ts +57 -4
  487. package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -38
  488. package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts.map +0 -1
  489. package/dist/feature-libraries/memoizedIdRangeAllocator.js +0 -74
  490. package/dist/feature-libraries/memoizedIdRangeAllocator.js.map +0 -1
  491. package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -38
  492. package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts.map +0 -1
  493. package/lib/feature-libraries/memoizedIdRangeAllocator.js +0 -71
  494. package/lib/feature-libraries/memoizedIdRangeAllocator.js.map +0 -1
  495. package/lib/package.json +0 -3
  496. package/src/feature-libraries/memoizedIdRangeAllocator.ts +0 -112
@@ -1,74 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.MemoizedIdRangeAllocator = void 0;
8
- const index_js_1 = require("../util/index.js");
9
- /**
10
- */
11
- exports.MemoizedIdRangeAllocator = {
12
- fromNextId(nextId = 0) {
13
- const rangeMap = new Map();
14
- let _nextId = nextId;
15
- return {
16
- allocate(key, startId, length) {
17
- let count = length ?? 1;
18
- const out = [];
19
- const ranges = (0, index_js_1.getOrAddEmptyToMap)(rangeMap, key);
20
- let currId = startId;
21
- while (count > 0) {
22
- const firstRange = (0, index_js_1.getFirstEntryFromRangeMap)(ranges, currId, count);
23
- if (firstRange === undefined) {
24
- const newId = _nextId;
25
- _nextId += count;
26
- (0, index_js_1.setInRangeMap)(ranges, currId, count, newId);
27
- out.push({ first: (0, index_js_1.brand)(newId), count });
28
- count = 0;
29
- }
30
- else {
31
- const idRange = {
32
- first: (0, index_js_1.brand)(firstRange.value),
33
- count: firstRange.length,
34
- };
35
- if (currId < firstRange.start) {
36
- const countToAdd = firstRange.start - currId;
37
- (0, index_js_1.setInRangeMap)(ranges, currId, countToAdd, _nextId);
38
- out.push({ first: (0, index_js_1.brand)(_nextId), count: countToAdd });
39
- _nextId += countToAdd;
40
- currId += countToAdd;
41
- count -= countToAdd;
42
- }
43
- else if (firstRange.start < currId) {
44
- const countToTrim = currId - firstRange.start;
45
- idRange.first = (0, index_js_1.brand)(idRange.first + countToTrim);
46
- idRange.count -= countToTrim;
47
- }
48
- if (idRange.count > count) {
49
- idRange.count = count;
50
- }
51
- else if (idRange.count < count &&
52
- firstRange.value + firstRange.length === _nextId) {
53
- // The existing range can be extended
54
- _nextId += count - idRange.count;
55
- firstRange.length = count;
56
- idRange.count = count;
57
- }
58
- out.push(idRange);
59
- count -= idRange.count;
60
- currId += idRange.count;
61
- }
62
- }
63
- return out;
64
- },
65
- mint(length) {
66
- const count = length ?? 1;
67
- const out = _nextId;
68
- _nextId += count;
69
- return (0, index_js_1.brand)(out);
70
- },
71
- };
72
- },
73
- };
74
- //# sourceMappingURL=memoizedIdRangeAllocator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memoizedIdRangeAllocator.js","sourceRoot":"","sources":["../../src/feature-libraries/memoizedIdRangeAllocator.ts"],"names":[],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ChangesetLocalId, RevisionTag } from \"../core/index.js\";\nimport {\n\ttype Mutable,\n\ttype RangeMap,\n\tbrand,\n\tgetFirstEntryFromRangeMap,\n\tgetOrAddEmptyToMap,\n\tsetInRangeMap,\n} from \"../util/index.js\";\n\n/**\n * A unique ID allocator that returns the output ID for the same input ID.\n */\nexport interface MemoizedIdRangeAllocator {\n\t/**\n\t * A unique ID allocator that returns the output ID for the same input ID.\n\t *\n\t * \"The same\" here includes cases where a prior call allocated a range of IDs that partially or fully overlap with the\n\t * current call.\n\t * @param revision - The revision associated with the range of IDs to allocate.\n\t * @param startId - The first ID to allocate.\n\t * @param count - The number of IDs to allocate. Interpreted as 1 if undefined.\n\t */\n\tallocate(\n\t\trevision: RevisionTag | undefined,\n\t\tstartId: ChangesetLocalId,\n\t\tcount?: number,\n\t): IdRange[];\n\t/**\n\t * Allocates a new range of IDs.\n\t *\n\t * @param count - The number of IDs to allocate. Interpreted as 1 if undefined.\n\t */\n\tmint(count?: number): ChangesetLocalId;\n}\n\n/**\n */\nexport interface IdRange {\n\treadonly first: ChangesetLocalId;\n\treadonly count: number;\n}\n\n/**\n */\nexport const MemoizedIdRangeAllocator = {\n\tfromNextId(nextId: number = 0): MemoizedIdRangeAllocator {\n\t\tconst rangeMap: Map<RevisionTag | undefined, RangeMap<number>> = new Map();\n\t\tlet _nextId = nextId;\n\t\treturn {\n\t\t\tallocate(key: string | number | undefined, startId: number, length?: number): IdRange[] {\n\t\t\t\tlet count = length ?? 1;\n\t\t\t\tconst out: IdRange[] = [];\n\t\t\t\tconst ranges = getOrAddEmptyToMap(rangeMap, key);\n\t\t\t\tlet currId = startId;\n\t\t\t\twhile (count > 0) {\n\t\t\t\t\tconst firstRange = getFirstEntryFromRangeMap(ranges, currId, count);\n\t\t\t\t\tif (firstRange === undefined) {\n\t\t\t\t\t\tconst newId = _nextId;\n\t\t\t\t\t\t_nextId += count;\n\t\t\t\t\t\tsetInRangeMap(ranges, currId, count, newId);\n\t\t\t\t\t\tout.push({ first: brand(newId), count });\n\t\t\t\t\t\tcount = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst idRange: Mutable<IdRange> = {\n\t\t\t\t\t\t\tfirst: brand(firstRange.value),\n\t\t\t\t\t\t\tcount: firstRange.length,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (currId < firstRange.start) {\n\t\t\t\t\t\t\tconst countToAdd = firstRange.start - currId;\n\t\t\t\t\t\t\tsetInRangeMap(ranges, currId, countToAdd, _nextId);\n\t\t\t\t\t\t\tout.push({ first: brand(_nextId), count: countToAdd });\n\t\t\t\t\t\t\t_nextId += countToAdd;\n\t\t\t\t\t\t\tcurrId += countToAdd;\n\t\t\t\t\t\t\tcount -= countToAdd;\n\t\t\t\t\t\t} else if (firstRange.start < currId) {\n\t\t\t\t\t\t\tconst countToTrim = currId - firstRange.start;\n\t\t\t\t\t\t\tidRange.first = brand((idRange.first as number) + countToTrim);\n\t\t\t\t\t\t\tidRange.count -= countToTrim;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (idRange.count > count) {\n\t\t\t\t\t\t\tidRange.count = count;\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\tidRange.count < count &&\n\t\t\t\t\t\t\tfirstRange.value + firstRange.length === _nextId\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// The existing range can be extended\n\t\t\t\t\t\t\t_nextId += count - idRange.count;\n\t\t\t\t\t\t\tfirstRange.length = count;\n\t\t\t\t\t\t\tidRange.count = count;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tout.push(idRange);\n\t\t\t\t\t\tcount -= idRange.count;\n\t\t\t\t\t\tcurrId += idRange.count;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn out;\n\t\t\t},\n\t\t\tmint(length?: number): ChangesetLocalId {\n\t\t\t\tconst count = length ?? 1;\n\t\t\t\tconst out = _nextId;\n\t\t\t\t_nextId += count;\n\t\t\t\treturn brand(out);\n\t\t\t},\n\t\t};\n\t},\n};\n"]}
@@ -1,38 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import type { ChangesetLocalId, RevisionTag } from "../core/index.js";
6
- /**
7
- * A unique ID allocator that returns the output ID for the same input ID.
8
- */
9
- export interface MemoizedIdRangeAllocator {
10
- /**
11
- * A unique ID allocator that returns the output ID for the same input ID.
12
- *
13
- * "The same" here includes cases where a prior call allocated a range of IDs that partially or fully overlap with the
14
- * current call.
15
- * @param revision - The revision associated with the range of IDs to allocate.
16
- * @param startId - The first ID to allocate.
17
- * @param count - The number of IDs to allocate. Interpreted as 1 if undefined.
18
- */
19
- allocate(revision: RevisionTag | undefined, startId: ChangesetLocalId, count?: number): IdRange[];
20
- /**
21
- * Allocates a new range of IDs.
22
- *
23
- * @param count - The number of IDs to allocate. Interpreted as 1 if undefined.
24
- */
25
- mint(count?: number): ChangesetLocalId;
26
- }
27
- /**
28
- */
29
- export interface IdRange {
30
- readonly first: ChangesetLocalId;
31
- readonly count: number;
32
- }
33
- /**
34
- */
35
- export declare const MemoizedIdRangeAllocator: {
36
- fromNextId(nextId?: number): MemoizedIdRangeAllocator;
37
- };
38
- //# sourceMappingURL=memoizedIdRangeAllocator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memoizedIdRangeAllocator.d.ts","sourceRoot":"","sources":["../../src/feature-libraries/memoizedIdRangeAllocator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAUtE;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC;;;;;;;;OAQG;IACH,QAAQ,CACP,QAAQ,EAAE,WAAW,GAAG,SAAS,EACjC,OAAO,EAAE,gBAAgB,EACzB,KAAK,CAAC,EAAE,MAAM,GACZ,OAAO,EAAE,CAAC;IACb;;;;OAIG;IACH,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;CACvC;AAED;GACG;AACH,MAAM,WAAW,OAAO;IACvB,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACvB;AAED;GACG;AACH,eAAO,MAAM,wBAAwB;wBACjB,MAAM,GAAO,wBAAwB;CA4DxD,CAAC"}
@@ -1,71 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { brand, getFirstEntryFromRangeMap, getOrAddEmptyToMap, setInRangeMap, } from "../util/index.js";
6
- /**
7
- */
8
- export const MemoizedIdRangeAllocator = {
9
- fromNextId(nextId = 0) {
10
- const rangeMap = new Map();
11
- let _nextId = nextId;
12
- return {
13
- allocate(key, startId, length) {
14
- let count = length ?? 1;
15
- const out = [];
16
- const ranges = getOrAddEmptyToMap(rangeMap, key);
17
- let currId = startId;
18
- while (count > 0) {
19
- const firstRange = getFirstEntryFromRangeMap(ranges, currId, count);
20
- if (firstRange === undefined) {
21
- const newId = _nextId;
22
- _nextId += count;
23
- setInRangeMap(ranges, currId, count, newId);
24
- out.push({ first: brand(newId), count });
25
- count = 0;
26
- }
27
- else {
28
- const idRange = {
29
- first: brand(firstRange.value),
30
- count: firstRange.length,
31
- };
32
- if (currId < firstRange.start) {
33
- const countToAdd = firstRange.start - currId;
34
- setInRangeMap(ranges, currId, countToAdd, _nextId);
35
- out.push({ first: brand(_nextId), count: countToAdd });
36
- _nextId += countToAdd;
37
- currId += countToAdd;
38
- count -= countToAdd;
39
- }
40
- else if (firstRange.start < currId) {
41
- const countToTrim = currId - firstRange.start;
42
- idRange.first = brand(idRange.first + countToTrim);
43
- idRange.count -= countToTrim;
44
- }
45
- if (idRange.count > count) {
46
- idRange.count = count;
47
- }
48
- else if (idRange.count < count &&
49
- firstRange.value + firstRange.length === _nextId) {
50
- // The existing range can be extended
51
- _nextId += count - idRange.count;
52
- firstRange.length = count;
53
- idRange.count = count;
54
- }
55
- out.push(idRange);
56
- count -= idRange.count;
57
- currId += idRange.count;
58
- }
59
- }
60
- return out;
61
- },
62
- mint(length) {
63
- const count = length ?? 1;
64
- const out = _nextId;
65
- _nextId += count;
66
- return brand(out);
67
- },
68
- };
69
- },
70
- };
71
- //# sourceMappingURL=memoizedIdRangeAllocator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memoizedIdRangeAllocator.js","sourceRoot":"","sources":["../../src/feature-libraries/memoizedIdRangeAllocator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAGN,KAAK,EACL,yBAAyB,EACzB,kBAAkB,EAClB,aAAa,GACb,MAAM,kBAAkB,CAAC;AAmC1B;GACG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACvC,UAAU,CAAC,SAAiB,CAAC;QAC5B,MAAM,QAAQ,GAAmD,IAAI,GAAG,EAAE,CAAC;QAC3E,IAAI,OAAO,GAAG,MAAM,CAAC;QACrB,OAAO;YACN,QAAQ,CAAC,GAAgC,EAAE,OAAe,EAAE,MAAe;gBAC1E,IAAI,KAAK,GAAG,MAAM,IAAI,CAAC,CAAC;gBACxB,MAAM,GAAG,GAAc,EAAE,CAAC;gBAC1B,MAAM,MAAM,GAAG,kBAAkB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;gBACjD,IAAI,MAAM,GAAG,OAAO,CAAC;gBACrB,OAAO,KAAK,GAAG,CAAC,EAAE,CAAC;oBAClB,MAAM,UAAU,GAAG,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;oBACpE,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;wBAC9B,MAAM,KAAK,GAAG,OAAO,CAAC;wBACtB,OAAO,IAAI,KAAK,CAAC;wBACjB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;wBAC5C,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;wBACzC,KAAK,GAAG,CAAC,CAAC;oBACX,CAAC;yBAAM,CAAC;wBACP,MAAM,OAAO,GAAqB;4BACjC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC;4BAC9B,KAAK,EAAE,UAAU,CAAC,MAAM;yBACxB,CAAC;wBACF,IAAI,MAAM,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC;4BAC/B,MAAM,UAAU,GAAG,UAAU,CAAC,KAAK,GAAG,MAAM,CAAC;4BAC7C,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;4BACnD,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;4BACvD,OAAO,IAAI,UAAU,CAAC;4BACtB,MAAM,IAAI,UAAU,CAAC;4BACrB,KAAK,IAAI,UAAU,CAAC;wBACrB,CAAC;6BAAM,IAAI,UAAU,CAAC,KAAK,GAAG,MAAM,EAAE,CAAC;4BACtC,MAAM,WAAW,GAAG,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC;4BAC9C,OAAO,CAAC,KAAK,GAAG,KAAK,CAAE,OAAO,CAAC,KAAgB,GAAG,WAAW,CAAC,CAAC;4BAC/D,OAAO,CAAC,KAAK,IAAI,WAAW,CAAC;wBAC9B,CAAC;wBACD,IAAI,OAAO,CAAC,KAAK,GAAG,KAAK,EAAE,CAAC;4BAC3B,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;wBACvB,CAAC;6BAAM,IACN,OAAO,CAAC,KAAK,GAAG,KAAK;4BACrB,UAAU,CAAC,KAAK,GAAG,UAAU,CAAC,MAAM,KAAK,OAAO,EAC/C,CAAC;4BACF,qCAAqC;4BACrC,OAAO,IAAI,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;4BACjC,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC;4BAC1B,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;wBACvB,CAAC;wBACD,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;wBAClB,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC;wBACvB,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC;oBACzB,CAAC;gBACF,CAAC;gBACD,OAAO,GAAG,CAAC;YACZ,CAAC;YACD,IAAI,CAAC,MAAe;gBACnB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,CAAC;gBAC1B,MAAM,GAAG,GAAG,OAAO,CAAC;gBACpB,OAAO,IAAI,KAAK,CAAC;gBACjB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;YACnB,CAAC;SACD,CAAC;IACH,CAAC;CACD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ChangesetLocalId, RevisionTag } from \"../core/index.js\";\nimport {\n\ttype Mutable,\n\ttype RangeMap,\n\tbrand,\n\tgetFirstEntryFromRangeMap,\n\tgetOrAddEmptyToMap,\n\tsetInRangeMap,\n} from \"../util/index.js\";\n\n/**\n * A unique ID allocator that returns the output ID for the same input ID.\n */\nexport interface MemoizedIdRangeAllocator {\n\t/**\n\t * A unique ID allocator that returns the output ID for the same input ID.\n\t *\n\t * \"The same\" here includes cases where a prior call allocated a range of IDs that partially or fully overlap with the\n\t * current call.\n\t * @param revision - The revision associated with the range of IDs to allocate.\n\t * @param startId - The first ID to allocate.\n\t * @param count - The number of IDs to allocate. Interpreted as 1 if undefined.\n\t */\n\tallocate(\n\t\trevision: RevisionTag | undefined,\n\t\tstartId: ChangesetLocalId,\n\t\tcount?: number,\n\t): IdRange[];\n\t/**\n\t * Allocates a new range of IDs.\n\t *\n\t * @param count - The number of IDs to allocate. Interpreted as 1 if undefined.\n\t */\n\tmint(count?: number): ChangesetLocalId;\n}\n\n/**\n */\nexport interface IdRange {\n\treadonly first: ChangesetLocalId;\n\treadonly count: number;\n}\n\n/**\n */\nexport const MemoizedIdRangeAllocator = {\n\tfromNextId(nextId: number = 0): MemoizedIdRangeAllocator {\n\t\tconst rangeMap: Map<RevisionTag | undefined, RangeMap<number>> = new Map();\n\t\tlet _nextId = nextId;\n\t\treturn {\n\t\t\tallocate(key: string | number | undefined, startId: number, length?: number): IdRange[] {\n\t\t\t\tlet count = length ?? 1;\n\t\t\t\tconst out: IdRange[] = [];\n\t\t\t\tconst ranges = getOrAddEmptyToMap(rangeMap, key);\n\t\t\t\tlet currId = startId;\n\t\t\t\twhile (count > 0) {\n\t\t\t\t\tconst firstRange = getFirstEntryFromRangeMap(ranges, currId, count);\n\t\t\t\t\tif (firstRange === undefined) {\n\t\t\t\t\t\tconst newId = _nextId;\n\t\t\t\t\t\t_nextId += count;\n\t\t\t\t\t\tsetInRangeMap(ranges, currId, count, newId);\n\t\t\t\t\t\tout.push({ first: brand(newId), count });\n\t\t\t\t\t\tcount = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst idRange: Mutable<IdRange> = {\n\t\t\t\t\t\t\tfirst: brand(firstRange.value),\n\t\t\t\t\t\t\tcount: firstRange.length,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (currId < firstRange.start) {\n\t\t\t\t\t\t\tconst countToAdd = firstRange.start - currId;\n\t\t\t\t\t\t\tsetInRangeMap(ranges, currId, countToAdd, _nextId);\n\t\t\t\t\t\t\tout.push({ first: brand(_nextId), count: countToAdd });\n\t\t\t\t\t\t\t_nextId += countToAdd;\n\t\t\t\t\t\t\tcurrId += countToAdd;\n\t\t\t\t\t\t\tcount -= countToAdd;\n\t\t\t\t\t\t} else if (firstRange.start < currId) {\n\t\t\t\t\t\t\tconst countToTrim = currId - firstRange.start;\n\t\t\t\t\t\t\tidRange.first = brand((idRange.first as number) + countToTrim);\n\t\t\t\t\t\t\tidRange.count -= countToTrim;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (idRange.count > count) {\n\t\t\t\t\t\t\tidRange.count = count;\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\tidRange.count < count &&\n\t\t\t\t\t\t\tfirstRange.value + firstRange.length === _nextId\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// The existing range can be extended\n\t\t\t\t\t\t\t_nextId += count - idRange.count;\n\t\t\t\t\t\t\tfirstRange.length = count;\n\t\t\t\t\t\t\tidRange.count = count;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tout.push(idRange);\n\t\t\t\t\t\tcount -= idRange.count;\n\t\t\t\t\t\tcurrId += idRange.count;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn out;\n\t\t\t},\n\t\t\tmint(length?: number): ChangesetLocalId {\n\t\t\t\tconst count = length ?? 1;\n\t\t\t\tconst out = _nextId;\n\t\t\t\t_nextId += count;\n\t\t\t\treturn brand(out);\n\t\t\t},\n\t\t};\n\t},\n};\n"]}
package/lib/package.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }
@@ -1,112 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
-
6
- import type { ChangesetLocalId, RevisionTag } from "../core/index.js";
7
- import {
8
- type Mutable,
9
- type RangeMap,
10
- brand,
11
- getFirstEntryFromRangeMap,
12
- getOrAddEmptyToMap,
13
- setInRangeMap,
14
- } from "../util/index.js";
15
-
16
- /**
17
- * A unique ID allocator that returns the output ID for the same input ID.
18
- */
19
- export interface MemoizedIdRangeAllocator {
20
- /**
21
- * A unique ID allocator that returns the output ID for the same input ID.
22
- *
23
- * "The same" here includes cases where a prior call allocated a range of IDs that partially or fully overlap with the
24
- * current call.
25
- * @param revision - The revision associated with the range of IDs to allocate.
26
- * @param startId - The first ID to allocate.
27
- * @param count - The number of IDs to allocate. Interpreted as 1 if undefined.
28
- */
29
- allocate(
30
- revision: RevisionTag | undefined,
31
- startId: ChangesetLocalId,
32
- count?: number,
33
- ): IdRange[];
34
- /**
35
- * Allocates a new range of IDs.
36
- *
37
- * @param count - The number of IDs to allocate. Interpreted as 1 if undefined.
38
- */
39
- mint(count?: number): ChangesetLocalId;
40
- }
41
-
42
- /**
43
- */
44
- export interface IdRange {
45
- readonly first: ChangesetLocalId;
46
- readonly count: number;
47
- }
48
-
49
- /**
50
- */
51
- export const MemoizedIdRangeAllocator = {
52
- fromNextId(nextId: number = 0): MemoizedIdRangeAllocator {
53
- const rangeMap: Map<RevisionTag | undefined, RangeMap<number>> = new Map();
54
- let _nextId = nextId;
55
- return {
56
- allocate(key: string | number | undefined, startId: number, length?: number): IdRange[] {
57
- let count = length ?? 1;
58
- const out: IdRange[] = [];
59
- const ranges = getOrAddEmptyToMap(rangeMap, key);
60
- let currId = startId;
61
- while (count > 0) {
62
- const firstRange = getFirstEntryFromRangeMap(ranges, currId, count);
63
- if (firstRange === undefined) {
64
- const newId = _nextId;
65
- _nextId += count;
66
- setInRangeMap(ranges, currId, count, newId);
67
- out.push({ first: brand(newId), count });
68
- count = 0;
69
- } else {
70
- const idRange: Mutable<IdRange> = {
71
- first: brand(firstRange.value),
72
- count: firstRange.length,
73
- };
74
- if (currId < firstRange.start) {
75
- const countToAdd = firstRange.start - currId;
76
- setInRangeMap(ranges, currId, countToAdd, _nextId);
77
- out.push({ first: brand(_nextId), count: countToAdd });
78
- _nextId += countToAdd;
79
- currId += countToAdd;
80
- count -= countToAdd;
81
- } else if (firstRange.start < currId) {
82
- const countToTrim = currId - firstRange.start;
83
- idRange.first = brand((idRange.first as number) + countToTrim);
84
- idRange.count -= countToTrim;
85
- }
86
- if (idRange.count > count) {
87
- idRange.count = count;
88
- } else if (
89
- idRange.count < count &&
90
- firstRange.value + firstRange.length === _nextId
91
- ) {
92
- // The existing range can be extended
93
- _nextId += count - idRange.count;
94
- firstRange.length = count;
95
- idRange.count = count;
96
- }
97
- out.push(idRange);
98
- count -= idRange.count;
99
- currId += idRange.count;
100
- }
101
- }
102
- return out;
103
- },
104
- mint(length?: number): ChangesetLocalId {
105
- const count = length ?? 1;
106
- const out = _nextId;
107
- _nextId += count;
108
- return brand(out);
109
- },
110
- };
111
- },
112
- };