@fluidframework/sequence 1.4.0-121020 → 2.0.0-dev-rc.1.0.0.225277

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 (350) hide show
  1. package/.eslintrc.js +9 -11
  2. package/.mocharc.js +12 -0
  3. package/CHANGELOG.md +449 -0
  4. package/README.md +364 -183
  5. package/api-extractor-esm.json +4 -0
  6. package/api-extractor-lint.json +4 -0
  7. package/api-extractor.json +2 -2
  8. package/api-report/sequence.api.md +734 -0
  9. package/dist/{defaultMap.js → defaultMap.cjs} +38 -26
  10. package/dist/defaultMap.cjs.map +1 -0
  11. package/dist/defaultMap.d.ts +7 -6
  12. package/dist/defaultMap.d.ts.map +1 -1
  13. package/dist/defaultMapInterfaces.cjs +7 -0
  14. package/dist/defaultMapInterfaces.cjs.map +1 -0
  15. package/dist/defaultMapInterfaces.d.ts +45 -12
  16. package/dist/defaultMapInterfaces.d.ts.map +1 -1
  17. package/dist/index.cjs +60 -0
  18. package/dist/index.cjs.map +1 -0
  19. package/dist/index.d.ts +14 -12
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/intervalCollection.cjs +1193 -0
  22. package/dist/intervalCollection.cjs.map +1 -0
  23. package/dist/intervalCollection.d.ts +448 -162
  24. package/dist/intervalCollection.d.ts.map +1 -1
  25. package/dist/intervalIndex/endpointInRangeIndex.cjs +66 -0
  26. package/dist/intervalIndex/endpointInRangeIndex.cjs.map +1 -0
  27. package/dist/intervalIndex/endpointInRangeIndex.d.ts +34 -0
  28. package/dist/intervalIndex/endpointInRangeIndex.d.ts.map +1 -0
  29. package/dist/intervalIndex/endpointIndex.cjs +47 -0
  30. package/dist/intervalIndex/endpointIndex.cjs.map +1 -0
  31. package/dist/intervalIndex/endpointIndex.d.ts +38 -0
  32. package/dist/intervalIndex/endpointIndex.d.ts.map +1 -0
  33. package/dist/intervalIndex/idIntervalIndex.cjs +44 -0
  34. package/dist/intervalIndex/idIntervalIndex.cjs.map +1 -0
  35. package/dist/intervalIndex/idIntervalIndex.d.ts +18 -0
  36. package/dist/intervalIndex/idIntervalIndex.d.ts.map +1 -0
  37. package/dist/intervalIndex/index.cjs +24 -0
  38. package/dist/intervalIndex/index.cjs.map +1 -0
  39. package/dist/intervalIndex/index.d.ts +13 -0
  40. package/dist/intervalIndex/index.d.ts.map +1 -0
  41. package/dist/{defaultMapInterfaces.js → intervalIndex/intervalIndex.cjs} +1 -1
  42. package/dist/intervalIndex/intervalIndex.cjs.map +1 -0
  43. package/dist/intervalIndex/intervalIndex.d.ts +30 -0
  44. package/dist/intervalIndex/intervalIndex.d.ts.map +1 -0
  45. package/dist/intervalIndex/intervalIndexUtils.cjs +22 -0
  46. package/dist/intervalIndex/intervalIndexUtils.cjs.map +1 -0
  47. package/dist/intervalIndex/intervalIndexUtils.d.ts +17 -0
  48. package/dist/intervalIndex/intervalIndexUtils.d.ts.map +1 -0
  49. package/dist/intervalIndex/overlappingIntervalsIndex.cjs +116 -0
  50. package/dist/intervalIndex/overlappingIntervalsIndex.cjs.map +1 -0
  51. package/dist/intervalIndex/overlappingIntervalsIndex.d.ts +44 -0
  52. package/dist/intervalIndex/overlappingIntervalsIndex.d.ts.map +1 -0
  53. package/dist/intervalIndex/overlappingSequenceIntervalsIndex.cjs +41 -0
  54. package/dist/intervalIndex/overlappingSequenceIntervalsIndex.cjs.map +1 -0
  55. package/dist/intervalIndex/overlappingSequenceIntervalsIndex.d.ts +11 -0
  56. package/dist/intervalIndex/overlappingSequenceIntervalsIndex.d.ts.map +1 -0
  57. package/dist/intervalIndex/sequenceIntervalIndexes.cjs +7 -0
  58. package/dist/intervalIndex/sequenceIntervalIndexes.cjs.map +1 -0
  59. package/dist/intervalIndex/sequenceIntervalIndexes.d.ts +35 -0
  60. package/dist/intervalIndex/sequenceIntervalIndexes.d.ts.map +1 -0
  61. package/dist/intervalIndex/startpointInRangeIndex.cjs +66 -0
  62. package/dist/intervalIndex/startpointInRangeIndex.cjs.map +1 -0
  63. package/dist/intervalIndex/startpointInRangeIndex.d.ts +34 -0
  64. package/dist/intervalIndex/startpointInRangeIndex.d.ts.map +1 -0
  65. package/dist/intervalTree.cjs +80 -0
  66. package/dist/intervalTree.cjs.map +1 -0
  67. package/dist/intervalTree.d.ts +24 -0
  68. package/dist/intervalTree.d.ts.map +1 -0
  69. package/dist/intervals/index.cjs +24 -0
  70. package/dist/intervals/index.cjs.map +1 -0
  71. package/dist/intervals/index.d.ts +8 -0
  72. package/dist/intervals/index.d.ts.map +1 -0
  73. package/dist/intervals/interval.cjs +181 -0
  74. package/dist/intervals/interval.cjs.map +1 -0
  75. package/dist/intervals/interval.d.ts +84 -0
  76. package/dist/intervals/interval.d.ts.map +1 -0
  77. package/dist/intervals/intervalUtils.cjs +90 -0
  78. package/dist/intervals/intervalUtils.cjs.map +1 -0
  79. package/dist/intervals/intervalUtils.d.ts +240 -0
  80. package/dist/intervals/intervalUtils.d.ts.map +1 -0
  81. package/dist/intervals/sequenceInterval.cjs +378 -0
  82. package/dist/intervals/sequenceInterval.cjs.map +1 -0
  83. package/dist/intervals/sequenceInterval.d.ts +137 -0
  84. package/dist/intervals/sequenceInterval.d.ts.map +1 -0
  85. package/dist/{localValues.js → localValues.cjs} +1 -1
  86. package/dist/localValues.cjs.map +1 -0
  87. package/dist/localValues.d.ts +2 -1
  88. package/dist/localValues.d.ts.map +1 -1
  89. package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
  90. package/dist/packageVersion.cjs.map +1 -0
  91. package/dist/packageVersion.d.ts +1 -1
  92. package/dist/packageVersion.d.ts.map +1 -1
  93. package/dist/revertibles.cjs +425 -0
  94. package/dist/revertibles.cjs.map +1 -0
  95. package/dist/revertibles.d.ts +86 -0
  96. package/dist/revertibles.d.ts.map +1 -0
  97. package/dist/sequence-alpha.d.ts +1290 -0
  98. package/dist/sequence-beta.d.ts +244 -0
  99. package/dist/sequence-public.d.ts +244 -0
  100. package/dist/sequence-untrimmed.d.ts +1778 -0
  101. package/dist/{sequence.js → sequence.cjs} +230 -156
  102. package/dist/sequence.cjs.map +1 -0
  103. package/dist/sequence.d.ts +125 -48
  104. package/dist/sequence.d.ts.map +1 -1
  105. package/dist/{sequenceDeltaEvent.js → sequenceDeltaEvent.cjs} +18 -8
  106. package/dist/sequenceDeltaEvent.cjs.map +1 -0
  107. package/dist/sequenceDeltaEvent.d.ts +24 -7
  108. package/dist/sequenceDeltaEvent.d.ts.map +1 -1
  109. package/dist/sequenceFactory.cjs +55 -0
  110. package/dist/sequenceFactory.cjs.map +1 -0
  111. package/dist/sequenceFactory.d.ts +3 -89
  112. package/dist/sequenceFactory.d.ts.map +1 -1
  113. package/dist/{sharedIntervalCollection.js → sharedIntervalCollection.cjs} +17 -22
  114. package/dist/sharedIntervalCollection.cjs.map +1 -0
  115. package/dist/sharedIntervalCollection.d.ts +12 -12
  116. package/dist/sharedIntervalCollection.d.ts.map +1 -1
  117. package/dist/{sharedSequence.js → sharedSequence.cjs} +29 -22
  118. package/dist/sharedSequence.cjs.map +1 -0
  119. package/dist/sharedSequence.d.ts +14 -2
  120. package/dist/sharedSequence.d.ts.map +1 -1
  121. package/dist/sharedString.cjs +274 -0
  122. package/dist/sharedString.cjs.map +1 -0
  123. package/dist/sharedString.d.ts +49 -26
  124. package/dist/sharedString.d.ts.map +1 -1
  125. package/dist/tsdoc-metadata.json +11 -0
  126. package/lib/{defaultMap.d.ts → defaultMap.d.mts} +8 -7
  127. package/lib/defaultMap.d.mts.map +1 -0
  128. package/lib/{defaultMap.js → defaultMap.mjs} +38 -26
  129. package/lib/defaultMap.mjs.map +1 -0
  130. package/lib/{defaultMapInterfaces.d.ts → defaultMapInterfaces.d.mts} +46 -13
  131. package/lib/defaultMapInterfaces.d.mts.map +1 -0
  132. package/lib/defaultMapInterfaces.mjs +6 -0
  133. package/lib/defaultMapInterfaces.mjs.map +1 -0
  134. package/lib/index.d.mts +17 -0
  135. package/lib/index.d.mts.map +1 -0
  136. package/lib/index.mjs +16 -0
  137. package/lib/index.mjs.map +1 -0
  138. package/lib/intervalCollection.d.mts +556 -0
  139. package/lib/intervalCollection.d.mts.map +1 -0
  140. package/lib/intervalCollection.mjs +1178 -0
  141. package/lib/intervalCollection.mjs.map +1 -0
  142. package/lib/intervalIndex/endpointInRangeIndex.d.mts +34 -0
  143. package/lib/intervalIndex/endpointInRangeIndex.d.mts.map +1 -0
  144. package/lib/intervalIndex/endpointInRangeIndex.mjs +61 -0
  145. package/lib/intervalIndex/endpointInRangeIndex.mjs.map +1 -0
  146. package/lib/intervalIndex/endpointIndex.d.mts +38 -0
  147. package/lib/intervalIndex/endpointIndex.d.mts.map +1 -0
  148. package/lib/intervalIndex/endpointIndex.mjs +42 -0
  149. package/lib/intervalIndex/endpointIndex.mjs.map +1 -0
  150. package/lib/intervalIndex/idIntervalIndex.d.mts +18 -0
  151. package/lib/intervalIndex/idIntervalIndex.d.mts.map +1 -0
  152. package/lib/intervalIndex/idIntervalIndex.mjs +40 -0
  153. package/lib/intervalIndex/idIntervalIndex.mjs.map +1 -0
  154. package/lib/intervalIndex/index.d.mts +13 -0
  155. package/lib/intervalIndex/index.d.mts.map +1 -0
  156. package/lib/intervalIndex/index.mjs +11 -0
  157. package/lib/intervalIndex/index.mjs.map +1 -0
  158. package/lib/intervalIndex/intervalIndex.d.mts +30 -0
  159. package/lib/intervalIndex/intervalIndex.d.mts.map +1 -0
  160. package/lib/{defaultMapInterfaces.js → intervalIndex/intervalIndex.mjs} +1 -1
  161. package/lib/intervalIndex/intervalIndex.mjs.map +1 -0
  162. package/lib/intervalIndex/intervalIndexUtils.d.mts +17 -0
  163. package/lib/intervalIndex/intervalIndexUtils.d.mts.map +1 -0
  164. package/lib/intervalIndex/intervalIndexUtils.mjs +18 -0
  165. package/lib/intervalIndex/intervalIndexUtils.mjs.map +1 -0
  166. package/lib/intervalIndex/overlappingIntervalsIndex.d.mts +44 -0
  167. package/lib/intervalIndex/overlappingIntervalsIndex.d.mts.map +1 -0
  168. package/lib/intervalIndex/overlappingIntervalsIndex.mjs +111 -0
  169. package/lib/intervalIndex/overlappingIntervalsIndex.mjs.map +1 -0
  170. package/lib/intervalIndex/overlappingSequenceIntervalsIndex.d.mts +11 -0
  171. package/lib/intervalIndex/overlappingSequenceIntervalsIndex.d.mts.map +1 -0
  172. package/lib/intervalIndex/overlappingSequenceIntervalsIndex.mjs +37 -0
  173. package/lib/intervalIndex/overlappingSequenceIntervalsIndex.mjs.map +1 -0
  174. package/lib/intervalIndex/sequenceIntervalIndexes.d.mts +35 -0
  175. package/lib/intervalIndex/sequenceIntervalIndexes.d.mts.map +1 -0
  176. package/lib/intervalIndex/sequenceIntervalIndexes.mjs +6 -0
  177. package/lib/intervalIndex/sequenceIntervalIndexes.mjs.map +1 -0
  178. package/lib/intervalIndex/startpointInRangeIndex.d.mts +34 -0
  179. package/lib/intervalIndex/startpointInRangeIndex.d.mts.map +1 -0
  180. package/lib/intervalIndex/startpointInRangeIndex.mjs +61 -0
  181. package/lib/intervalIndex/startpointInRangeIndex.mjs.map +1 -0
  182. package/lib/intervalTree.d.mts +24 -0
  183. package/lib/intervalTree.d.mts.map +1 -0
  184. package/lib/intervalTree.mjs +76 -0
  185. package/lib/intervalTree.mjs.map +1 -0
  186. package/lib/intervals/index.d.mts +8 -0
  187. package/lib/intervals/index.d.mts.map +1 -0
  188. package/lib/intervals/index.mjs +8 -0
  189. package/lib/intervals/index.mjs.map +1 -0
  190. package/lib/intervals/interval.d.mts +84 -0
  191. package/lib/intervals/interval.d.mts.map +1 -0
  192. package/lib/intervals/interval.mjs +176 -0
  193. package/lib/intervals/interval.mjs.map +1 -0
  194. package/lib/intervals/intervalUtils.d.mts +240 -0
  195. package/lib/intervals/intervalUtils.d.mts.map +1 -0
  196. package/lib/intervals/intervalUtils.mjs +84 -0
  197. package/lib/intervals/intervalUtils.mjs.map +1 -0
  198. package/lib/intervals/sequenceInterval.d.mts +137 -0
  199. package/lib/intervals/sequenceInterval.d.mts.map +1 -0
  200. package/lib/intervals/sequenceInterval.mjs +370 -0
  201. package/lib/intervals/sequenceInterval.mjs.map +1 -0
  202. package/lib/{localValues.d.ts → localValues.d.mts} +4 -3
  203. package/lib/localValues.d.mts.map +1 -0
  204. package/lib/{localValues.js → localValues.mjs} +2 -2
  205. package/lib/localValues.mjs.map +1 -0
  206. package/lib/{packageVersion.d.ts → packageVersion.d.mts} +2 -2
  207. package/lib/packageVersion.d.mts.map +1 -0
  208. package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
  209. package/lib/packageVersion.mjs.map +1 -0
  210. package/lib/revertibles.d.mts +86 -0
  211. package/lib/revertibles.d.mts.map +1 -0
  212. package/lib/revertibles.mjs +416 -0
  213. package/lib/revertibles.mjs.map +1 -0
  214. package/lib/sequence-alpha.d.mts +1277 -0
  215. package/lib/sequence-beta.d.mts +231 -0
  216. package/lib/sequence-public.d.mts +231 -0
  217. package/lib/sequence-untrimmed.d.mts +1765 -0
  218. package/lib/{sequence.d.ts → sequence.d.mts} +128 -51
  219. package/lib/sequence.d.mts.map +1 -0
  220. package/lib/{sequence.js → sequence.mjs} +229 -152
  221. package/lib/sequence.mjs.map +1 -0
  222. package/lib/{sequenceDeltaEvent.d.ts → sequenceDeltaEvent.d.mts} +25 -8
  223. package/lib/sequenceDeltaEvent.d.mts.map +1 -0
  224. package/lib/{sequenceDeltaEvent.js → sequenceDeltaEvent.mjs} +20 -8
  225. package/lib/sequenceDeltaEvent.mjs.map +1 -0
  226. package/lib/sequenceFactory.d.mts +22 -0
  227. package/lib/sequenceFactory.d.mts.map +1 -0
  228. package/lib/sequenceFactory.mjs +51 -0
  229. package/lib/sequenceFactory.mjs.map +1 -0
  230. package/lib/{sharedIntervalCollection.d.ts → sharedIntervalCollection.d.mts} +13 -13
  231. package/lib/sharedIntervalCollection.d.mts.map +1 -0
  232. package/lib/{sharedIntervalCollection.js → sharedIntervalCollection.mjs} +16 -21
  233. package/lib/sharedIntervalCollection.mjs.map +1 -0
  234. package/lib/{sharedSequence.d.ts → sharedSequence.d.mts} +16 -4
  235. package/lib/sharedSequence.d.mts.map +1 -0
  236. package/lib/{sharedSequence.js → sharedSequence.mjs} +30 -23
  237. package/lib/sharedSequence.mjs.map +1 -0
  238. package/lib/{sharedString.d.ts → sharedString.d.mts} +52 -29
  239. package/lib/sharedString.d.mts.map +1 -0
  240. package/lib/sharedString.mjs +269 -0
  241. package/lib/sharedString.mjs.map +1 -0
  242. package/package.json +168 -75
  243. package/prettier.config.cjs +8 -0
  244. package/src/defaultMap.ts +419 -403
  245. package/src/defaultMapInterfaces.ts +164 -117
  246. package/src/index.ts +86 -26
  247. package/src/intervalCollection.ts +2042 -1563
  248. package/src/intervalIndex/endpointInRangeIndex.ts +116 -0
  249. package/src/intervalIndex/endpointIndex.ts +91 -0
  250. package/src/intervalIndex/idIntervalIndex.ts +64 -0
  251. package/src/intervalIndex/index.ts +25 -0
  252. package/src/intervalIndex/intervalIndex.ts +32 -0
  253. package/src/intervalIndex/intervalIndexUtils.ts +27 -0
  254. package/src/intervalIndex/overlappingIntervalsIndex.ts +187 -0
  255. package/src/intervalIndex/overlappingSequenceIntervalsIndex.ts +80 -0
  256. package/src/intervalIndex/sequenceIntervalIndexes.ts +34 -0
  257. package/src/intervalIndex/startpointInRangeIndex.ts +114 -0
  258. package/src/intervalTree.ts +98 -0
  259. package/src/intervals/index.ts +26 -0
  260. package/src/intervals/interval.ts +238 -0
  261. package/src/intervals/intervalUtils.ts +298 -0
  262. package/src/intervals/sequenceInterval.ts +616 -0
  263. package/src/localValues.ts +68 -73
  264. package/src/packageVersion.ts +1 -1
  265. package/src/revertibles.ts +693 -0
  266. package/src/sequence.ts +850 -690
  267. package/src/sequenceDeltaEvent.ts +164 -131
  268. package/src/sequenceFactory.ts +58 -214
  269. package/src/sharedIntervalCollection.ts +161 -152
  270. package/src/sharedSequence.ts +181 -167
  271. package/src/sharedString.ts +367 -234
  272. package/tsc-multi.test.json +10 -0
  273. package/tsconfig.json +11 -13
  274. package/.editorconfig +0 -7
  275. package/.vscode/launch.json +0 -15
  276. package/dist/defaultMap.js.map +0 -1
  277. package/dist/defaultMapInterfaces.js.map +0 -1
  278. package/dist/index.js +0 -44
  279. package/dist/index.js.map +0 -1
  280. package/dist/intervalCollection.js +0 -1250
  281. package/dist/intervalCollection.js.map +0 -1
  282. package/dist/localValues.js.map +0 -1
  283. package/dist/packageVersion.js.map +0 -1
  284. package/dist/sequence.js.map +0 -1
  285. package/dist/sequenceDeltaEvent.js.map +0 -1
  286. package/dist/sequenceFactory.js +0 -192
  287. package/dist/sequenceFactory.js.map +0 -1
  288. package/dist/sharedIntervalCollection.js.map +0 -1
  289. package/dist/sharedNumberSequence.d.ts +0 -50
  290. package/dist/sharedNumberSequence.d.ts.map +0 -1
  291. package/dist/sharedNumberSequence.js +0 -61
  292. package/dist/sharedNumberSequence.js.map +0 -1
  293. package/dist/sharedObjectSequence.d.ts +0 -50
  294. package/dist/sharedObjectSequence.d.ts.map +0 -1
  295. package/dist/sharedObjectSequence.js +0 -61
  296. package/dist/sharedObjectSequence.js.map +0 -1
  297. package/dist/sharedSequence.js.map +0 -1
  298. package/dist/sharedString.js +0 -187
  299. package/dist/sharedString.js.map +0 -1
  300. package/dist/sparsematrix.d.ts +0 -139
  301. package/dist/sparsematrix.d.ts.map +0 -1
  302. package/dist/sparsematrix.js +0 -332
  303. package/dist/sparsematrix.js.map +0 -1
  304. package/lib/defaultMap.d.ts.map +0 -1
  305. package/lib/defaultMap.js.map +0 -1
  306. package/lib/defaultMapInterfaces.d.ts.map +0 -1
  307. package/lib/defaultMapInterfaces.js.map +0 -1
  308. package/lib/index.d.ts +0 -27
  309. package/lib/index.d.ts.map +0 -1
  310. package/lib/index.js +0 -26
  311. package/lib/index.js.map +0 -1
  312. package/lib/intervalCollection.d.ts +0 -270
  313. package/lib/intervalCollection.d.ts.map +0 -1
  314. package/lib/intervalCollection.js +0 -1238
  315. package/lib/intervalCollection.js.map +0 -1
  316. package/lib/localValues.d.ts.map +0 -1
  317. package/lib/localValues.js.map +0 -1
  318. package/lib/packageVersion.d.ts.map +0 -1
  319. package/lib/packageVersion.js.map +0 -1
  320. package/lib/sequence.d.ts.map +0 -1
  321. package/lib/sequence.js.map +0 -1
  322. package/lib/sequenceDeltaEvent.d.ts.map +0 -1
  323. package/lib/sequenceDeltaEvent.js.map +0 -1
  324. package/lib/sequenceFactory.d.ts +0 -108
  325. package/lib/sequenceFactory.d.ts.map +0 -1
  326. package/lib/sequenceFactory.js +0 -186
  327. package/lib/sequenceFactory.js.map +0 -1
  328. package/lib/sharedIntervalCollection.d.ts.map +0 -1
  329. package/lib/sharedIntervalCollection.js.map +0 -1
  330. package/lib/sharedNumberSequence.d.ts +0 -50
  331. package/lib/sharedNumberSequence.d.ts.map +0 -1
  332. package/lib/sharedNumberSequence.js +0 -57
  333. package/lib/sharedNumberSequence.js.map +0 -1
  334. package/lib/sharedObjectSequence.d.ts +0 -50
  335. package/lib/sharedObjectSequence.d.ts.map +0 -1
  336. package/lib/sharedObjectSequence.js +0 -57
  337. package/lib/sharedObjectSequence.js.map +0 -1
  338. package/lib/sharedSequence.d.ts.map +0 -1
  339. package/lib/sharedSequence.js.map +0 -1
  340. package/lib/sharedString.d.ts.map +0 -1
  341. package/lib/sharedString.js +0 -183
  342. package/lib/sharedString.js.map +0 -1
  343. package/lib/sparsematrix.d.ts +0 -139
  344. package/lib/sparsematrix.d.ts.map +0 -1
  345. package/lib/sparsematrix.js +0 -323
  346. package/lib/sparsematrix.js.map +0 -1
  347. package/src/sharedNumberSequence.ts +0 -62
  348. package/src/sharedObjectSequence.ts +0 -62
  349. package/src/sparsematrix.ts +0 -421
  350. package/tsconfig.esnext.json +0 -7
@@ -1 +0,0 @@
1
- {"version":3,"file":"intervalCollection.js","sourceRoot":"","sources":["../src/intervalCollection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;AAEH,+BAA+B;AAE/B,+DAAyE;AAEzE,qEAA6D;AAC7D,2DAoBoC;AAEpC,qEAA+D;AAC/D,+B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AAI,CAAC,QAAQ,EAAE;YAChB,MAAM,IAAI,8BAAY,CAAC,+BAA+B,CAAC,CAAC;SAC3D;QAED,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC;IAEM,gBAAgB,CAAC,GAAW;QAC/B,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAChB,MAAM,IAAI,8BAAY,CAAC,+BAA+B,CAAC,CAAC;SAC3D;QAED,OAAO,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACtD,CAAC;IAEM,YAAY,CAAC,GAAW;QAC3B,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAChB,MAAM,IAAI,8BAAY,CAAC,+BAA+B,CAAC,CAAC;SAC3D;QAED,OAAO,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IAClD,CAAC;CACJ;AAhmBD,gDAgmBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\nimport { assert, TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport { IEvent } from \"@fluidframework/common-definitions\";\nimport { UsageError } from \"@fluidframework/container-utils\";\nimport {\n addProperties,\n Client,\n ConflictAction,\n createMap,\n ICombiningOp,\n IInterval,\n IntervalConflictResolver,\n IntervalNode,\n IntervalTree,\n ISegment,\n LocalReference,\n MergeTreeDeltaType,\n PropertiesManager,\n PropertySet,\n RedBlackTree,\n ReferenceType,\n refTypeIncludesFlag,\n reservedRangeLabelsKey,\n UnassignedSequenceNumber,\n} from \"@fluidframework/merge-tree\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { LoggingError } from \"@fluidframework/telemetry-utils\";\nimport { v4 as uuid } from \"uuid\";\nimport {\n IMapMessageLocalMetadata,\n IValueFactory,\n IValueOpEmitter,\n IValueOperation,\n IValueType,\n IValueTypeOperationValue,\n} from \"./defaultMapInterfaces\";\n\nconst reservedIntervalIdKey = \"intervalId\";\n\nexport enum IntervalType {\n Simple = 0x0,\n Nest = 0x1,\n /**\n * SlideOnRemove indicates that the ends of the interval will slide if the segment\n * they reference is removed and acked.\n * See `packages\\dds\\merge-tree\\REFERENCEPOSITIONS.md` for details\n * SlideOnRemove is the default interval behavior and does not need to be specified.\n */\n SlideOnRemove = 0x2, // SlideOnRemove is default behavior - all intervals are SlideOnRemove\n /**\n * @internal\n * A temporary interval, used internally\n */\n Transient = 0x4,\n}\n\nexport interface ISerializedInterval {\n sequenceNumber: number;\n start: number;\n end: number;\n intervalType: IntervalType;\n properties?: PropertySet;\n}\n\n/**\n * A size optimization to avoid redundantly storing keys when serializing intervals\n * as JSON. Intervals are of the format:\n *\n * [start, end, sequenceNumber, intervalType, properties]\n */\nexport type CompressedSerializedInterval = [number, number, number, IntervalType, PropertySet];\n\n/**\n * @internal\n */\nexport interface ISerializedIntervalCollectionV2 {\n label: string;\n version: 2;\n intervals: CompressedSerializedInterval[];\n}\n\n/**\n * Decompress an interval after loading a summary from JSON. The exact format\n * of this compression is unspecified and subject to change\n */\nfunction decompressInterval(interval: CompressedSerializedInterval, label?: string): ISerializedInterval {\n return {\n start: interval[0],\n end: interval[1],\n sequenceNumber: interval[2],\n intervalType: interval[3],\n properties: { ...interval[4], [reservedRangeLabelsKey]: label },\n };\n}\n\n/**\n * Compress an interval prior to serialization as JSON. The exact format of this\n * compression is unspecified and subject to change\n */\nfunction compressInterval(interval: ISerializedInterval): CompressedSerializedInterval {\n const { start, end, sequenceNumber, intervalType, properties } = interval;\n\n return [\n start,\n end,\n sequenceNumber,\n intervalType,\n // remove the `referenceRangeLabels` property as it is already stored\n // in the `label` field of the summary\n { ...properties, [reservedRangeLabelsKey]: undefined },\n ];\n}\n\nexport interface ISerializableInterval extends IInterval {\n properties: PropertySet;\n propertyManager: PropertiesManager;\n serialize(client: Client): ISerializedInterval;\n addProperties(props: PropertySet, collaborating?: boolean, seq?: number):\n PropertySet | undefined;\n getIntervalId(): string | undefined;\n}\n\nexport interface IIntervalHelpers<TInterval extends ISerializableInterval> {\n compareEnds(a: TInterval, b: TInterval): number;\n create(label: string, start: number, end: number,\n client: Client, intervalType?: IntervalType, op?: ISequencedDocumentMessage): TInterval;\n}\n\nexport class Interval implements ISerializableInterval {\n public properties: PropertySet;\n public auxProps: PropertySet[];\n public propertyManager: PropertiesManager;\n constructor(\n public start: number,\n public end: number,\n props?: PropertySet,\n ) {\n this.propertyManager = new PropertiesManager();\n this.properties = {};\n\n if (props) {\n this.addProperties(props);\n }\n }\n\n public getIntervalId(): string | undefined {\n const id = this.properties?.[reservedIntervalIdKey];\n if (id === undefined) {\n return undefined;\n }\n return `${id}`;\n }\n\n public getAdditionalPropertySets() {\n return this.auxProps;\n }\n\n public addPropertySet(props: PropertySet) {\n if (this.auxProps === undefined) {\n this.auxProps = [];\n }\n this.auxProps.push(props);\n }\n\n public serialize(client: Client): ISerializedInterval {\n let seq = 0;\n if (client) {\n seq = client.getCurrentSeq();\n }\n\n const serializedInterval: ISerializedInterval = {\n end: this.end,\n intervalType: 0,\n sequenceNumber: seq,\n start: this.start,\n };\n if (this.properties) {\n serializedInterval.properties = this.properties;\n }\n return serializedInterval;\n }\n\n public clone() {\n return new Interval(this.start, this.end, this.properties);\n }\n\n public compare(b: Interval) {\n const startResult = this.compareStart(b);\n if (startResult === 0) {\n const endResult = this.compareEnd(b);\n if (endResult === 0) {\n const thisId = this.getIntervalId();\n if (thisId) {\n const bId = b.getIntervalId();\n if (bId) {\n return thisId > bId ? 1 : thisId < bId ? -1 : 0;\n }\n return 0;\n }\n return 0;\n } else {\n return endResult;\n }\n } else {\n return startResult;\n }\n }\n\n public compareStart(b: Interval) {\n return this.start - b.start;\n }\n\n public compareEnd(b: Interval) {\n return this.end - b.end;\n }\n\n public overlaps(b: Interval) {\n const result = (this.start <= b.end) &&\n (this.end >= b.start);\n return result;\n }\n\n public union(b: Interval) {\n return new Interval(Math.min(this.start, b.start),\n Math.max(this.end, b.end), this.properties);\n }\n\n public getProperties() {\n return this.properties;\n }\n\n public addProperties(\n newProps: PropertySet,\n collaborating: boolean = false,\n seq?: number,\n op?: ICombiningOp,\n ): PropertySet | undefined {\n if (newProps) {\n this.initializeProperties();\n return this.propertyManager.addProperties(this.properties, newProps, op, seq, collaborating);\n }\n }\n\n public modify(label: string, start: number, end: number, op?: ISequencedDocumentMessage) {\n const startPos = start ?? this.start;\n const endPos = end ?? this.end;\n if (this.start === startPos && this.end === endPos) {\n // Return undefined to indicate that no change is necessary.\n return;\n }\n const newInterval = new Interval(startPos, endPos);\n if (this.properties) {\n newInterval.initializeProperties();\n this.propertyManager.copyTo(this.properties, newInterval.properties, newInterval.propertyManager);\n }\n return newInterval;\n }\n\n private initializeProperties(): void {\n if (!this.propertyManager) {\n this.propertyManager = new PropertiesManager();\n }\n if (!this.properties) {\n this.properties = createMap<any>();\n }\n }\n}\n\nexport class SequenceInterval implements ISerializableInterval {\n public properties: PropertySet;\n public propertyManager: PropertiesManager;\n\n constructor(\n public start: LocalReference,\n public end: LocalReference,\n public intervalType: IntervalType,\n props?: PropertySet,\n ) {\n this.propertyManager = new PropertiesManager();\n this.properties = {};\n\n if (props) {\n this.addProperties(props);\n }\n }\n\n private callbacks?: Record<\"beforePositionChange\" | \"afterPositionChange\", () => void>;\n\n /**\n * @internal\n * Subscribes to position change events on this interval if there are no current listeners.\n */\n public addPositionChangeListeners(beforePositionChange: () => void, afterPositionChange: () => void): void {\n if (this.callbacks === undefined) {\n this.callbacks = {\n beforePositionChange,\n afterPositionChange,\n };\n\n const startCbs = this.start.callbacks ??= {};\n const endCbs = this.end.callbacks ??= {};\n startCbs.beforeSlide = endCbs.beforeSlide = beforePositionChange;\n startCbs.afterSlide = endCbs.afterSlide = afterPositionChange;\n }\n }\n\n /**\n * @internal\n * Removes the currently subscribed position change listeners.\n */\n public removePositionChangeListeners(): void {\n if (this.callbacks) {\n this.callbacks = undefined;\n this.start.callbacks = undefined;\n this.end.callbacks = undefined;\n }\n }\n\n public serialize(client: Client): ISerializedInterval {\n const startPosition = this.start.toPosition();\n const endPosition = this.end.toPosition();\n const serializedInterval: ISerializedInterval = {\n end: endPosition,\n intervalType: this.intervalType,\n sequenceNumber: client.getCurrentSeq(),\n start: startPosition,\n };\n\n if (this.properties) {\n serializedInterval.properties = this.properties;\n }\n\n return serializedInterval;\n }\n\n public clone() {\n return new SequenceInterval(this.start, this.end, this.intervalType, this.properties);\n }\n\n public compare(b: SequenceInterval) {\n const startResult = this.compareStart(b);\n if (startResult === 0) {\n const endResult = this.compareEnd(b);\n if (endResult === 0) {\n const thisId = this.getIntervalId();\n if (thisId) {\n const bId = b.getIntervalId();\n if (bId) {\n return thisId > bId ? 1 : thisId < bId ? -1 : 0;\n }\n return 0;\n }\n return 0;\n } else {\n return endResult;\n }\n } else {\n return startResult;\n }\n }\n\n public compareStart(b: SequenceInterval) {\n return this.start.compare(b.start);\n }\n\n public compareEnd(b: SequenceInterval) {\n return this.end.compare(b.end);\n }\n\n public overlaps(b: SequenceInterval) {\n const result = (this.start.compare(b.end) <= 0) &&\n (this.end.compare(b.start) >= 0);\n return result;\n }\n\n public getIntervalId(): string | undefined {\n const id = this.properties?.[reservedIntervalIdKey];\n if (id === undefined) {\n return undefined;\n }\n return `${id}`;\n }\n\n public union(b: SequenceInterval) {\n return new SequenceInterval(this.start.min(b.start),\n this.end.max(b.end), this.intervalType);\n }\n\n public addProperties(\n newProps: PropertySet,\n collab: boolean = false,\n seq?: number,\n op?: ICombiningOp,\n ): PropertySet | undefined {\n this.initializeProperties();\n return this.propertyManager.addProperties(this.properties, newProps, op, seq, collab);\n }\n\n public overlapsPos(bstart: number, bend: number) {\n const startPos = this.start.toPosition();\n const endPos = this.start.toPosition();\n return (endPos > bstart) && (startPos < bend);\n }\n\n public modify(label: string, start: number, end: number, op?: ISequencedDocumentMessage) {\n const getRefType = (baseType: ReferenceType): ReferenceType => {\n let refType = baseType;\n if (op === undefined) {\n refType &= ~ReferenceType.SlideOnRemove;\n refType |= ReferenceType.StayOnRemove;\n }\n return refType;\n };\n\n let startRef = this.start;\n if (start !== undefined) {\n startRef = createPositionReference(this.start.getClient(), start, getRefType(this.start.refType), op);\n startRef.addProperties(this.start.properties);\n }\n\n let endRef = this.end;\n if (end !== undefined) {\n endRef = createPositionReference(this.end.getClient(), end, getRefType(this.end.refType), op);\n endRef.addProperties(this.end.properties);\n }\n\n startRef.pairedRef = endRef;\n endRef.pairedRef = startRef;\n\n const newInterval = new SequenceInterval(startRef, endRef, this.intervalType);\n if (this.properties) {\n newInterval.initializeProperties();\n this.propertyManager.copyTo(this.properties, newInterval.properties, newInterval.propertyManager);\n }\n return newInterval;\n }\n\n private initializeProperties(): void {\n if (!this.propertyManager) {\n this.propertyManager = new PropertiesManager();\n }\n if (!this.properties) {\n this.properties = createMap<any>();\n }\n }\n}\n\nfunction createPositionReferenceFromSegoff(\n client: Client,\n segoff: { segment: ISegment | undefined; offset: number | undefined; },\n refType: ReferenceType,\n op?: ISequencedDocumentMessage): LocalReference {\n if (segoff.segment) {\n const ref = client.createLocalReferencePosition(segoff.segment, segoff.offset, refType, undefined);\n return ref as LocalReference;\n } else {\n if (!op && !refTypeIncludesFlag(refType, ReferenceType.Transient)) {\n throw new UsageError(\"Non-transient references need segment\");\n }\n return new LocalReference(client, undefined, 0, refType);\n }\n}\n\nfunction createPositionReference(\n client: Client,\n pos: number,\n refType: ReferenceType,\n op?: ISequencedDocumentMessage): LocalReference {\n let segoff;\n if (op) {\n assert((refType & ReferenceType.SlideOnRemove) !== 0, 0x2f5 /* op create references must be SlideOnRemove */);\n segoff = client.getContainingSegment(pos, op);\n segoff = client.getSlideToSegment(segoff);\n } else {\n assert((refType & ReferenceType.SlideOnRemove) === 0, 0x2f6 /* SlideOnRemove references must be op created */);\n segoff = client.getContainingSegment(pos);\n }\n return createPositionReferenceFromSegoff(client, segoff, refType, op);\n}\n\nfunction createSequenceInterval(\n label: string,\n start: number,\n end: number,\n client: Client,\n intervalType?: IntervalType,\n op?: ISequencedDocumentMessage): SequenceInterval {\n let beginRefType = ReferenceType.RangeBegin;\n let endRefType = ReferenceType.RangeEnd;\n if (intervalType === IntervalType.Transient) {\n beginRefType = ReferenceType.Transient;\n endRefType = ReferenceType.Transient;\n } else {\n if (intervalType === IntervalType.Nest) {\n beginRefType = ReferenceType.NestBegin;\n endRefType = ReferenceType.NestEnd;\n }\n // All non-transient interval references must eventually be SlideOnRemove\n // To ensure eventual consistency, they must start as StayOnRemove when\n // pending (created locally and creation op is not acked)\n if (op) {\n beginRefType |= ReferenceType.SlideOnRemove;\n endRefType |= ReferenceType.SlideOnRemove;\n } else {\n beginRefType |= ReferenceType.StayOnRemove;\n endRefType |= ReferenceType.StayOnRemove;\n }\n }\n\n const startLref = createPositionReference(client, start, beginRefType, op);\n const endLref = createPositionReference(client, end, endRefType, op);\n startLref.pairedRef = endLref;\n endLref.pairedRef = startLref;\n const rangeProp = {\n [reservedRangeLabelsKey]: [label],\n };\n startLref.addProperties(rangeProp);\n endLref.addProperties(rangeProp);\n\n const ival = new SequenceInterval(startLref, endLref, intervalType, rangeProp);\n return ival;\n}\n\nexport function defaultIntervalConflictResolver(a: Interval, b: Interval) {\n a.addPropertySet(b.properties);\n return a;\n}\n\nexport function createIntervalIndex(conflict?: IntervalConflictResolver<Interval>) {\n const helpers: IIntervalHelpers<Interval> = {\n compareEnds: compareIntervalEnds,\n create: createInterval,\n };\n const lc = new LocalIntervalCollection<Interval>(undefined, \"\", helpers);\n if (conflict) {\n lc.addConflictResolver(conflict);\n } else {\n lc.addConflictResolver(defaultIntervalConflictResolver);\n }\n return lc;\n}\n\nexport class LocalIntervalCollection<TInterval extends ISerializableInterval> {\n private readonly intervalTree = new IntervalTree<TInterval>();\n private readonly endIntervalTree: RedBlackTree<TInterval, TInterval>;\n private readonly intervalIdMap: Map<string, TInterval> = new Map();\n private conflictResolver: IntervalConflictResolver<TInterval> | undefined;\n private endConflictResolver: ConflictAction<TInterval, TInterval> | undefined;\n\n private static readonly legacyIdPrefix = \"legacy\";\n\n constructor(\n private readonly client: Client,\n private readonly label: string,\n private readonly helpers: IIntervalHelpers<TInterval>,\n /** Callback invoked each time one of the endpoints of an interval slides. */\n private readonly onPositionChange?: (interval: TInterval) => void,\n ) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n this.endIntervalTree = new RedBlackTree<TInterval, TInterval>(helpers.compareEnds);\n }\n\n public addConflictResolver(conflictResolver: IntervalConflictResolver<TInterval>) {\n this.conflictResolver = conflictResolver;\n this.endConflictResolver =\n (key: TInterval, currentKey: TInterval) => {\n const ival = conflictResolver(key, currentKey);\n return {\n data: ival,\n key: ival,\n };\n };\n }\n\n public map(fn: (interval: TInterval) => void) {\n this.intervalTree.map(fn);\n }\n\n public createLegacyId(start: number, end: number): string {\n // Create a non-unique ID based on start and end to be used on intervals that come from legacy clients\n // without ID's.\n return `${LocalIntervalCollection.legacyIdPrefix}${start}-${end}`;\n }\n\n /**\n * Validates that a serialized interval has the ID property. Creates an ID\n * if one does not already exist\n *\n * @param serializedInterval - The interval to be checked\n * @returns The interval's existing or newly created id\n */\n public ensureSerializedId(serializedInterval: ISerializedInterval): string {\n let id: string | undefined = serializedInterval.properties?.[reservedIntervalIdKey];\n if (id === undefined) {\n // An interval came over the wire without an ID, so create a non-unique one based on start/end.\n // This will allow all clients to refer to this interval consistently.\n id = this.createLegacyId(serializedInterval.start, serializedInterval.end);\n const newProps = {\n [reservedIntervalIdKey]: id,\n };\n serializedInterval.properties = addProperties(serializedInterval.properties, newProps);\n }\n // Make the ID immutable for safety's sake.\n Object.defineProperty(serializedInterval.properties, reservedIntervalIdKey, {\n configurable: false,\n enumerable: true,\n writable: false,\n });\n\n return id;\n }\n\n public mapUntil(fn: (interval: TInterval) => boolean) {\n this.intervalTree.mapUntil(fn);\n }\n\n public gatherIterationResults(\n results: TInterval[],\n iteratesForward: boolean,\n start?: number,\n end?: number) {\n if (this.intervalTree.intervals.isEmpty()) {\n return;\n }\n\n if (start === undefined && end === undefined) {\n // No start/end provided. Gather the whole tree in the specified order.\n if (iteratesForward) {\n this.intervalTree.map((interval: TInterval) => {\n results.push(interval);\n });\n } else {\n this.intervalTree.mapBackward((interval: TInterval) => {\n results.push(interval);\n });\n }\n } else {\n const transientInterval: TInterval = this.helpers.create(\n \"transient\",\n start,\n end,\n this.client,\n IntervalType.Transient,\n );\n\n if (start === undefined) {\n // Only end position provided. Since the tree is not sorted by end position,\n // walk the whole tree in the specified order, gathering intervals that match the end.\n if (iteratesForward) {\n this.intervalTree.map((interval: TInterval) => {\n if (transientInterval.compareEnd(interval) === 0) {\n results.push(interval);\n }\n });\n } else {\n this.intervalTree.mapBackward((interval: TInterval) => {\n if (transientInterval.compareEnd(interval) === 0) {\n results.push(interval);\n }\n });\n }\n } else {\n // Start and (possibly) end provided. Walk the subtrees that may contain\n // this start position.\n const compareFn =\n end === undefined ?\n (node: IntervalNode<TInterval>) => {\n return transientInterval.compareStart(node.key);\n } :\n (node: IntervalNode<TInterval>) => {\n return transientInterval.compare(node.key);\n };\n const continueLeftFn = (cmpResult: number) => cmpResult <= 0;\n const continueRightFn = (cmpResult: number) => cmpResult >= 0;\n const actionFn = (node: IntervalNode<TInterval>) => {\n results.push(node.key);\n };\n\n if (iteratesForward) {\n this.intervalTree.intervals.walkExactMatchesForward(\n compareFn, actionFn, continueLeftFn, continueRightFn,\n );\n } else {\n this.intervalTree.intervals.walkExactMatchesBackward(\n compareFn, actionFn, continueLeftFn, continueRightFn,\n );\n }\n }\n }\n }\n\n public findOverlappingIntervals(startPosition: number, endPosition: number) {\n if (endPosition < startPosition || this.intervalTree.intervals.isEmpty()) {\n return [];\n }\n const transientInterval =\n this.helpers.create(\n \"transient\",\n startPosition,\n endPosition,\n this.client,\n IntervalType.Transient);\n\n const overlappingIntervalNodes = this.intervalTree.match(transientInterval);\n return overlappingIntervalNodes.map((node) => node.key);\n }\n\n public previousInterval(pos: number) {\n const transientInterval = this.helpers.create(\n \"transient\", pos, pos, this.client, IntervalType.Transient);\n const rbNode = this.endIntervalTree.floor(transientInterval);\n if (rbNode) {\n return rbNode.data;\n }\n }\n\n public nextInterval(pos: number) {\n const transientInterval = this.helpers.create(\n \"transient\", pos, pos, this.client, IntervalType.Transient);\n const rbNode = this.endIntervalTree.ceil(transientInterval);\n if (rbNode) {\n return rbNode.data;\n }\n }\n\n public removeInterval(startPosition: number, endPosition: number) {\n const transientInterval = this.helpers.create(\n \"transient\", startPosition, endPosition, this.client, IntervalType.Transient);\n this.intervalTree.remove(transientInterval);\n this.endIntervalTree.remove(transientInterval);\n return transientInterval;\n }\n\n private removeIntervalFromIndex(interval: TInterval) {\n this.intervalTree.removeExisting(interval);\n this.endIntervalTree.remove(interval);\n\n const id = interval.getIntervalId();\n\n assert(id !== undefined, 0x311 /* expected id to exist on interval */);\n\n this.intervalIdMap.delete(id);\n }\n\n public removeExistingInterval(interval: TInterval) {\n this.removeIntervalFromIndex(interval);\n this.removeIntervalListeners(interval);\n }\n\n public createInterval(\n start: number,\n end: number,\n intervalType: IntervalType,\n op?: ISequencedDocumentMessage): TInterval {\n return this.helpers.create(this.label, start, end, this.client, intervalType, op);\n }\n\n public addInterval(\n start: number,\n end: number,\n intervalType: IntervalType,\n props?: PropertySet,\n op?: ISequencedDocumentMessage) {\n const interval: TInterval = this.createInterval(start, end, intervalType, op);\n if (interval) {\n if (!interval.properties) {\n interval.properties = createMap<any>();\n }\n if (props) {\n interval.addProperties(props);\n }\n if (interval.properties[reservedIntervalIdKey] === undefined) {\n // Create a new ID.\n interval.properties[reservedIntervalIdKey] = uuid();\n }\n this.add(interval);\n }\n return interval;\n }\n\n private addIntervalToIndex(interval: TInterval) {\n const id = interval.getIntervalId();\n assert(id !== undefined, 0x2c0 /* \"ID must be created before adding interval to collection\" */);\n // Make the ID immutable.\n Object.defineProperty(interval.properties, reservedIntervalIdKey, {\n configurable: false,\n enumerable: true,\n writable: false,\n });\n this.intervalTree.put(interval, this.conflictResolver);\n this.endIntervalTree.put(interval, interval, this.endConflictResolver);\n this.intervalIdMap.set(id, interval);\n }\n\n public add(interval: TInterval) {\n this.addIntervalToIndex(interval);\n this.addIntervalListeners(interval);\n }\n\n public getIntervalById(id: string) {\n return this.intervalIdMap.get(id);\n }\n\n public changeInterval(interval: TInterval, start: number, end: number, op?: ISequencedDocumentMessage) {\n const newInterval = interval.modify(this.label, start, end, op) as TInterval | undefined;\n if (newInterval) {\n this.removeExistingInterval(interval);\n this.add(newInterval);\n }\n return newInterval;\n }\n\n public serialize(): ISerializedIntervalCollectionV2 {\n const client = this.client;\n const intervals = this.intervalTree.intervals.keys();\n\n return {\n label: this.label,\n intervals: intervals.map((interval) => compressInterval(interval.serialize(client))),\n version: 2,\n };\n }\n\n private addIntervalListeners(interval: TInterval) {\n if (interval instanceof SequenceInterval) {\n interval.addPositionChangeListeners(\n () => this.removeIntervalFromIndex(interval),\n () => {\n this.addIntervalToIndex(interval);\n this.onPositionChange?.(interval);\n },\n );\n }\n }\n\n private removeIntervalListeners(interval: TInterval) {\n if (interval instanceof SequenceInterval) {\n interval.removePositionChangeListeners();\n }\n }\n}\n\nconst compareSequenceIntervalEnds = (a: SequenceInterval, b: SequenceInterval): number => a.end.compare(b.end);\n\nclass SequenceIntervalCollectionFactory\n implements IValueFactory<IntervalCollection<SequenceInterval>> {\n public load(\n emitter: IValueOpEmitter,\n raw: ISerializedInterval[] | ISerializedIntervalCollectionV2 = [],\n ): IntervalCollection<SequenceInterval> {\n const helpers: IIntervalHelpers<SequenceInterval> = {\n compareEnds: compareSequenceIntervalEnds,\n create: createSequenceInterval,\n };\n return new IntervalCollection<SequenceInterval>(helpers, true, emitter, raw);\n }\n\n public store(value: IntervalCollection<SequenceInterval>): ISerializedIntervalCollectionV2 {\n return value.serializeInternal();\n }\n}\n\nexport class SequenceIntervalCollectionValueType\n implements IValueType<IntervalCollection<SequenceInterval>> {\n public static Name = \"sharedStringIntervalCollection\";\n\n public get name(): string {\n return SequenceIntervalCollectionValueType.Name;\n }\n\n public get factory(): IValueFactory<IntervalCollection<SequenceInterval>> {\n return SequenceIntervalCollectionValueType._factory;\n }\n\n public get ops(): Map<string, IValueOperation<IntervalCollection<SequenceInterval>>> {\n return SequenceIntervalCollectionValueType._ops;\n }\n\n private static readonly _factory: IValueFactory<IntervalCollection<SequenceInterval>> =\n new SequenceIntervalCollectionFactory();\n\n private static readonly _ops = makeOpsMap<SequenceInterval>();\n}\n\nconst compareIntervalEnds = (a: Interval, b: Interval) => a.end - b.end;\n\nfunction createInterval(label: string, start: number, end: number, client: Client): Interval {\n const rangeProp: PropertySet = {};\n\n if (label && label.length > 0) {\n rangeProp[reservedRangeLabelsKey] = [label];\n }\n\n return new Interval(start, end, rangeProp);\n}\n\nclass IntervalCollectionFactory\n implements IValueFactory<IntervalCollection<Interval>> {\n public load(\n emitter: IValueOpEmitter,\n raw: ISerializedInterval[] | ISerializedIntervalCollectionV2 = [],\n ): IntervalCollection<Interval> {\n const helpers: IIntervalHelpers<Interval> = {\n compareEnds: compareIntervalEnds,\n create: createInterval,\n };\n const collection = new IntervalCollection<Interval>(helpers, false, emitter, raw);\n collection.attachGraph(undefined, \"\");\n return collection;\n }\n\n public store(value: IntervalCollection<Interval>): ISerializedIntervalCollectionV2 {\n return value.serializeInternal();\n }\n}\n\nexport class IntervalCollectionValueType\n implements IValueType<IntervalCollection<Interval>> {\n public static Name = \"sharedIntervalCollection\";\n\n public get name(): string {\n return IntervalCollectionValueType.Name;\n }\n\n public get factory(): IValueFactory<IntervalCollection<Interval>> {\n return IntervalCollectionValueType._factory;\n }\n\n public get ops(): Map<string, IValueOperation<IntervalCollection<Interval>>> {\n return IntervalCollectionValueType._ops;\n }\n\n private static readonly _factory: IValueFactory<IntervalCollection<Interval>> =\n new IntervalCollectionFactory();\n private static readonly _ops = makeOpsMap<Interval>();\n}\n\nfunction makeOpsMap<T extends ISerializableInterval>(): Map<string, IValueOperation<IntervalCollection<T>>> {\n const rebase = (\n collection: IntervalCollection<T>,\n op: IValueTypeOperationValue,\n localOpMetadata: IMapMessageLocalMetadata,\n ) => {\n const { localSeq } = localOpMetadata;\n const rebasedValue = collection.rebaseLocalInterval(op.opName, op.value, localSeq);\n const rebasedOp = { ...op, value: rebasedValue };\n return { rebasedOp, rebasedLocalOpMetadata: localOpMetadata };\n };\n\n return new Map<string, IValueOperation<IntervalCollection<T>>>(\n [[\n \"add\",\n {\n process: (collection, params, local, op) => {\n collection.ackAdd(params, local, op);\n },\n rebase,\n },\n ],\n [\n \"delete\",\n {\n process: (collection, params, local, op) => {\n collection.ackDelete(params, local, op);\n },\n rebase: (collection, op, localOpMetadata) => {\n // Deletion of intervals is based on id, so requires no rebasing.\n return { rebasedOp: op, rebasedLocalOpMetadata: localOpMetadata };\n },\n },\n ],\n [\n \"change\",\n {\n process: (collection, params, local, op) => {\n collection.ackChange(params, local, op);\n },\n rebase,\n },\n ]]);\n}\n\nexport type DeserializeCallback = (properties: PropertySet) => void;\n\nexport class IntervalCollectionIterator<TInterval extends ISerializableInterval> {\n private readonly results: TInterval[];\n private index: number;\n\n constructor(\n collection: IntervalCollection<TInterval>,\n iteratesForward: boolean = true,\n start?: number,\n end?: number) {\n this.results = [];\n this.index = 0;\n\n collection.gatherIterationResults(this.results, iteratesForward, start, end);\n }\n\n public next() {\n let _value: TInterval | undefined;\n let _done: boolean = true;\n\n if (this.index < this.results.length) {\n _value = this.results[this.index++];\n _done = false;\n }\n\n return {\n value: _value,\n done: _done,\n };\n }\n}\n\nexport interface IIntervalCollectionEvent<TInterval extends ISerializableInterval> extends IEvent {\n /**\n * This event is invoked whenever the properties or endpoints of an interval may have changed.\n * This can happen on:\n * - endpoint modification (local or remote)\n * - ack of an endpoint modification\n * - property change (local or remote)\n * - position change due to segment sliding (will always appear as a local change)\n * The `interval` argument reflects the new values.\n */\n (event: \"changeInterval\",\n listener: (interval: TInterval, local: boolean, op: ISequencedDocumentMessage | undefined) => void);\n (event: \"addInterval\" | \"deleteInterval\",\n listener: (interval: TInterval, local: boolean, op: ISequencedDocumentMessage) => void);\n (event: \"propertyChanged\", listener: (interval: TInterval, propertyArgs: PropertySet) => void);\n}\n\nexport class IntervalCollection<TInterval extends ISerializableInterval>\n extends TypedEventEmitter<IIntervalCollectionEvent<TInterval>> {\n private savedSerializedIntervals?: ISerializedInterval[];\n private localCollection: LocalIntervalCollection<TInterval>;\n private onDeserialize: DeserializeCallback | undefined;\n private client: Client;\n private readonly pendingChangesStart: Map<string, ISerializedInterval[]> = new Map<string, ISerializedInterval[]>();\n private readonly pendingChangesEnd: Map<string, ISerializedInterval[]> = new Map<string, ISerializedInterval[]>();\n\n public get attached(): boolean {\n return !!this.localCollection;\n }\n\n /** @internal */\n constructor(\n private readonly helpers: IIntervalHelpers<TInterval>,\n private readonly requiresClient: boolean,\n private readonly emitter: IValueOpEmitter,\n serializedIntervals: ISerializedInterval[] | ISerializedIntervalCollectionV2,\n ) {\n super();\n\n if (Array.isArray(serializedIntervals)) {\n this.savedSerializedIntervals = serializedIntervals;\n } else {\n this.savedSerializedIntervals =\n serializedIntervals.intervals.map((i) => decompressInterval(i, serializedIntervals.label));\n }\n }\n\n public attachGraph(client: Client, label: string) {\n if (this.attached) {\n throw new LoggingError(\"Only supports one Sequence attach\");\n }\n\n if ((client === undefined) && (this.requiresClient)) {\n throw new LoggingError(\"Client required for this collection\");\n }\n\n // Instantiate the local interval collection based on the saved intervals\n this.client = client;\n this.localCollection = new LocalIntervalCollection<TInterval>(\n client,\n label,\n this.helpers,\n (interval) => this.emit(\"changeInterval\", interval, true, undefined),\n );\n if (this.savedSerializedIntervals) {\n for (const serializedInterval of this.savedSerializedIntervals) {\n this.localCollection.ensureSerializedId(serializedInterval);\n this.localCollection.addInterval(\n serializedInterval.start,\n serializedInterval.end,\n serializedInterval.intervalType,\n serializedInterval.properties);\n }\n }\n this.savedSerializedIntervals = undefined;\n }\n\n /**\n * Gets the next local sequence number, modifying this client's collab window in doing so.\n */\n private getNextLocalSeq(): number {\n return ++this.client.getCollabWindow().localSeq;\n }\n\n public getIntervalById(id: string) {\n if (!this.attached) {\n throw new LoggingError(\"attach must be called before accessing intervals\");\n }\n return this.localCollection.getIntervalById(id);\n }\n\n /**\n * Create a new interval and add it to the collection\n * @param start - interval start position\n * @param end - interval end position\n * @param intervalType - type of the interval. All intervals are SlideOnRemove. Intervals may not be Transient.\n * @param props - properties of the interval\n * @returns - the created interval\n */\n public add(\n start: number,\n end: number,\n intervalType: IntervalType,\n props?: PropertySet,\n ) {\n if (!this.attached) {\n throw new LoggingError(\"attach must be called prior to adding intervals\");\n }\n if (intervalType & IntervalType.Transient) {\n throw new LoggingError(\"Can not add transient intervals\");\n }\n\n const interval: TInterval = this.localCollection.addInterval(start, end, intervalType, props);\n\n if (interval) {\n const serializedInterval = {\n end,\n intervalType,\n properties: interval.properties,\n sequenceNumber: this.client?.getCurrentSeq() ?? 0,\n start,\n };\n // Local ops get submitted to the server. Remote ops have the deserializer run.\n this.emitter.emit(\"add\", undefined, serializedInterval, { localSeq: this.getNextLocalSeq() });\n }\n\n this.emit(\"addInterval\", interval, true, undefined);\n\n return interval;\n }\n\n private deleteExistingInterval(interval: TInterval, local: boolean, op?: ISequencedDocumentMessage) {\n // The given interval is known to exist in the collection.\n this.localCollection.removeExistingInterval(interval);\n\n if (interval) {\n // Local ops get submitted to the server. Remote ops have the deserializer run.\n if (local) {\n this.emitter.emit(\n \"delete\",\n undefined,\n interval.serialize(this.client),\n { localSeq: this.getNextLocalSeq() },\n );\n } else {\n if (this.onDeserialize) {\n this.onDeserialize(interval);\n }\n }\n }\n\n this.emit(\"deleteInterval\", interval, local, op);\n }\n\n public removeIntervalById(id: string) {\n const interval = this.localCollection.getIntervalById(id);\n if (interval) {\n this.deleteExistingInterval(interval, true, undefined);\n }\n return interval;\n }\n\n public changeProperties(id: string, props: PropertySet) {\n if (!this.attached) {\n throw new LoggingError(\"Attach must be called before accessing intervals\");\n }\n if (typeof (id) !== \"string\") {\n throw new LoggingError(\"Change API requires an ID that is a string\");\n }\n if (!props) {\n throw new LoggingError(\"changeProperties should be called with a property set\");\n }\n\n const interval = this.getIntervalById(id);\n if (interval) {\n // Pass Unassigned as the sequence number to indicate that this is a local op that is waiting for an ack.\n const deltaProps = interval.addProperties(props, true, UnassignedSequenceNumber);\n const serializedInterval: ISerializedInterval = interval.serialize(this.client);\n\n // Emit a change op that will only change properties. Add the ID to\n // the property bag provided by the caller.\n serializedInterval.start = undefined as any;\n serializedInterval.end = undefined as any;\n\n serializedInterval.properties = props;\n serializedInterval.properties[reservedIntervalIdKey] = interval.getIntervalId();\n this.emitter.emit(\"change\", undefined, serializedInterval, { localSeq: this.getNextLocalSeq() });\n this.emit(\"propertyChanged\", interval, deltaProps);\n }\n this.emit(\"changeInterval\", interval, true, undefined);\n }\n\n public change(id: string, start?: number, end?: number): TInterval | undefined {\n if (!this.attached) {\n throw new LoggingError(\"Attach must be called before accessing intervals\");\n }\n\n // Force id to be a string.\n if (typeof (id) !== \"string\") {\n throw new LoggingError(\"Change API requires an ID that is a string\");\n }\n\n const interval = this.getIntervalById(id);\n if (interval) {\n const newInterval = this.localCollection.changeInterval(interval, start, end);\n const serializedInterval: ISerializedInterval = interval.serialize(this.client);\n serializedInterval.start = start;\n serializedInterval.end = end;\n // Emit a property bag containing only the ID, as we don't intend for this op to change any properties.\n serializedInterval.properties =\n {\n [reservedIntervalIdKey]: interval.getIntervalId(),\n };\n this.emitter.emit(\"change\", undefined, serializedInterval, { localSeq: this.getNextLocalSeq() });\n this.addPendingChange(id, serializedInterval);\n this.emit(\"changeInterval\", newInterval, true, undefined);\n return newInterval;\n }\n // No interval to change\n return undefined;\n }\n\n private addPendingChange(id: string, serializedInterval: ISerializedInterval) {\n if (serializedInterval.start !== undefined) {\n this.addPendingChangeHelper(id, this.pendingChangesStart, serializedInterval);\n }\n if (serializedInterval.end !== undefined) {\n this.addPendingChangeHelper(id, this.pendingChangesEnd, serializedInterval);\n }\n }\n\n private addPendingChangeHelper(\n id: string,\n pendingChanges: Map<string, ISerializedInterval[]>,\n serializedInterval: ISerializedInterval,\n ) {\n let entries: ISerializedInterval[] | undefined = pendingChanges.get(id);\n if (!entries) {\n entries = [];\n pendingChanges.set(id, entries);\n }\n entries.push(serializedInterval);\n }\n\n private removePendingChange(serializedInterval: ISerializedInterval) {\n // Change ops always have an ID.\n const id: string = serializedInterval.properties?.[reservedIntervalIdKey];\n if (serializedInterval.start !== undefined) {\n this.removePendingChangeHelper(id, this.pendingChangesStart, serializedInterval);\n }\n if (serializedInterval.end !== undefined) {\n this.removePendingChangeHelper(id, this.pendingChangesEnd, serializedInterval);\n }\n }\n\n private removePendingChangeHelper(\n id: string,\n pendingChanges: Map<string, ISerializedInterval[]>,\n serializedInterval: ISerializedInterval,\n ) {\n const entries = pendingChanges.get(id);\n if (entries) {\n const pendingChange = entries.shift();\n if (entries.length === 0) {\n pendingChanges.delete(id);\n }\n if (pendingChange?.start !== serializedInterval.start ||\n pendingChange?.end !== serializedInterval.end) {\n throw new LoggingError(\"Mismatch in pending changes\");\n }\n }\n }\n\n private hasPendingChangeStart(id: string) {\n const entries = this.pendingChangesStart.get(id);\n return entries && entries.length !== 0;\n }\n\n private hasPendingChangeEnd(id: string) {\n const entries = this.pendingChangesEnd.get(id);\n return entries && entries.length !== 0;\n }\n\n /** @deprecated - use ackChange */\n public changeInterval(serializedInterval: ISerializedInterval, local: boolean, op: ISequencedDocumentMessage) {\n return this.ackChange(serializedInterval, local, op);\n }\n\n /** @internal */\n public ackChange(serializedInterval: ISerializedInterval, local: boolean, op: ISequencedDocumentMessage) {\n if (!this.attached) {\n throw new LoggingError(\"Attach must be called before accessing intervals\");\n }\n\n let interval: TInterval | undefined;\n\n if (local) {\n // This is an ack from the server. Remove the pending change.\n this.removePendingChange(serializedInterval);\n const id: string = serializedInterval.properties?.[reservedIntervalIdKey];\n interval = this.getIntervalById(id);\n if (interval) {\n // Let the propertyManager prune its pending change-properties set.\n interval.propertyManager?.ackPendingProperties(\n {\n type: MergeTreeDeltaType.ANNOTATE,\n props: serializedInterval.properties ?? {},\n });\n\n this.ackInterval(interval, op);\n }\n } else {\n // If there are pending changes with this ID, don't apply the remote start/end change, as the local ack\n // should be the winning change.\n // Note that the ID is in the property bag only to allow us to find the interval.\n // This API cannot change the ID, and writing to the ID property will result in an exception. So we\n // strip it out of the properties here.\n const { [reservedIntervalIdKey]: id, ...newProps } = serializedInterval.properties;\n interval = this.getIntervalById(id);\n if (interval) {\n let start: number | undefined;\n let end: number | undefined;\n // Track pending start/end independently of one another.\n if (!this.hasPendingChangeStart(id)) {\n start = serializedInterval.start;\n }\n if (!this.hasPendingChangeEnd(id)) {\n end = serializedInterval.end;\n }\n if (start !== undefined || end !== undefined) {\n // If changeInterval gives us a new interval, work with that one. Otherwise keep working with\n // the one we originally found in the tree.\n interval = this.localCollection.changeInterval(interval, start, end, op) ?? interval;\n }\n const deltaProps = interval.addProperties(newProps, true, op.sequenceNumber);\n if (this.onDeserialize) {\n this.onDeserialize(interval);\n }\n this.emit(\"propertyChanged\", interval, deltaProps);\n }\n }\n if (interval) {\n this.emit(\"changeInterval\", interval, local, op);\n }\n }\n\n public addConflictResolver(conflictResolver: IntervalConflictResolver<TInterval>): void {\n if (!this.attached) {\n throw new LoggingError(\"attachSequence must be called\");\n }\n this.localCollection.addConflictResolver(conflictResolver);\n }\n\n public attachDeserializer(onDeserialize: DeserializeCallback): void {\n // If no deserializer is specified can skip all processing work\n if (!onDeserialize) {\n return;\n }\n\n // Start by storing the callbacks so that any subsequent modifications make use of them\n this.onDeserialize = onDeserialize;\n\n // Trigger the async prepare work across all values in the collection\n this.localCollection.map((interval) => {\n onDeserialize(interval);\n });\n }\n\n /** @internal */\n public rebaseLocalInterval(\n opName: string,\n serializedInterval: ISerializedInterval,\n localSeq: number,\n ) {\n if (!this.attached) {\n throw new LoggingError(\"attachSequence must be called\");\n }\n\n const { start, end, intervalType, properties, sequenceNumber } = serializedInterval;\n const startRebased = start === undefined ? undefined :\n this.client.rebasePosition(start, sequenceNumber, localSeq);\n const endRebased = end === undefined ? undefined :\n this.client.rebasePosition(end, sequenceNumber, localSeq);\n\n const intervalId = properties?.[reservedIntervalIdKey];\n const rebased: ISerializedInterval = {\n start: startRebased,\n end: endRebased,\n intervalType,\n sequenceNumber: this.client?.getCurrentSeq() ?? 0,\n properties,\n };\n if (opName === \"change\" && (this.hasPendingChangeStart(intervalId) || this.hasPendingChangeEnd(intervalId))) {\n this.removePendingChange(serializedInterval);\n this.addPendingChange(intervalId, rebased);\n }\n return rebased;\n }\n\n private getSlideToSegment(lref: LocalReference) {\n const segoff = { segment: lref.segment, offset: lref.offset };\n const newSegoff = this.client.getSlideToSegment(segoff);\n const value: { segment: ISegment | undefined; offset: number | undefined; } | undefined\n = (segoff.segment === newSegoff.segment && segoff.offset === newSegoff.offset) ? undefined : newSegoff;\n return value;\n }\n\n private setSlideOnRemove(lref: LocalReference) {\n let refType = lref.refType;\n refType = refType & ~ReferenceType.StayOnRemove;\n refType = refType | ReferenceType.SlideOnRemove;\n lref.refType = refType;\n }\n\n private ackInterval(interval: TInterval, op: ISequencedDocumentMessage) {\n // in current usage, interval is always a SequenceInterval\n if (!(interval instanceof SequenceInterval)) {\n return;\n }\n\n if (!refTypeIncludesFlag(interval.start, ReferenceType.StayOnRemove) &&\n !refTypeIncludesFlag(interval.end, ReferenceType.StayOnRemove)) {\n return;\n }\n\n const newStart = this.getSlideToSegment(interval.start);\n const newEnd = this.getSlideToSegment(interval.end);\n\n const id = interval.properties[reservedIntervalIdKey];\n const hasPendingStartChange = this.hasPendingChangeStart(id);\n const hasPendingEndChange = this.hasPendingChangeEnd(id);\n\n if (!hasPendingStartChange) {\n this.setSlideOnRemove(interval.start);\n }\n\n if (!hasPendingEndChange) {\n this.setSlideOnRemove(interval.end);\n }\n\n const needsStartUpdate = newStart !== undefined && !hasPendingStartChange;\n const needsEndUpdate = newEnd !== undefined && !hasPendingEndChange;\n\n if (needsStartUpdate || needsEndUpdate) {\n // In this case, where we change the start or end of an interval,\n // it is necessary to remove and re-add the interval listeners.\n // This ensures that the correct listeners are added to the ReferencePosition.\n this.localCollection.removeExistingInterval(interval);\n\n if (needsStartUpdate) {\n const props = interval.start.properties;\n this.client.removeLocalReferencePosition(interval.start);\n interval.start = createPositionReferenceFromSegoff(this.client, newStart, interval.start.refType, op);\n if (props) {\n interval.start.addProperties(props);\n }\n }\n if (needsEndUpdate) {\n const props = interval.end.properties;\n this.client.removeLocalReferencePosition(interval.end);\n interval.end = createPositionReferenceFromSegoff(this.client, newEnd, interval.end.refType, op);\n if (props) {\n interval.end.addProperties(props);\n }\n }\n this.localCollection.add(interval);\n }\n }\n\n /** @deprecated - use ackAdd */\n public addInternal(\n serializedInterval: ISerializedInterval,\n local: boolean,\n op: ISequencedDocumentMessage) {\n return this.ackAdd(serializedInterval, local, op);\n }\n\n /** @internal */\n public ackAdd(\n serializedInterval: ISerializedInterval,\n local: boolean,\n op: ISequencedDocumentMessage) {\n if (local) {\n const id: string = serializedInterval.properties?.[reservedIntervalIdKey];\n const localInterval = this.getIntervalById(id);\n if (localInterval) {\n this.ackInterval(localInterval, op);\n }\n return;\n }\n\n if (!this.attached) {\n throw new LoggingError(\"attachSequence must be called\");\n }\n\n this.localCollection.ensureSerializedId(serializedInterval);\n\n const interval: TInterval = this.localCollection.addInterval(\n serializedInterval.start,\n serializedInterval.end,\n serializedInterval.intervalType,\n serializedInterval.properties,\n op);\n\n if (interval) {\n if (this.onDeserialize) {\n this.onDeserialize(interval);\n }\n }\n\n this.emit(\"addInterval\", interval, local, op);\n\n return interval;\n }\n\n /** @deprecated - use ackDelete */\n public deleteInterval(\n serializedInterval: ISerializedInterval,\n local: boolean,\n op: ISequencedDocumentMessage): void {\n return this.ackDelete(serializedInterval, local, op);\n }\n\n /** @internal */\n public ackDelete(\n serializedInterval: ISerializedInterval,\n local: boolean,\n op: ISequencedDocumentMessage): void {\n if (local) {\n // Local ops were applied when the message was created and there's no \"pending delete\"\n // state to bookkeep: remote operation application takes into account possibility of\n // locally deleted interval whenever a lookup happens.\n return;\n }\n\n if (!this.attached) {\n throw new LoggingError(\"attach must be called prior to deleting intervals\");\n }\n\n const id = this.localCollection.ensureSerializedId(serializedInterval);\n const interval = this.localCollection.getIntervalById(id);\n if (interval) {\n this.deleteExistingInterval(interval, local, op);\n }\n }\n\n /**\n * @internal\n */\n public serializeInternal(): ISerializedIntervalCollectionV2 {\n if (!this.attached) {\n throw new LoggingError(\"attachSequence must be called\");\n }\n\n return this.localCollection.serialize();\n }\n\n public [Symbol.iterator](): IntervalCollectionIterator<TInterval> {\n const iterator = new IntervalCollectionIterator<TInterval>(this);\n return iterator;\n }\n\n public CreateForwardIteratorWithStartPosition(startPosition: number): IntervalCollectionIterator<TInterval> {\n const iterator = new IntervalCollectionIterator<TInterval>(this, true, startPosition);\n return iterator;\n }\n\n public CreateBackwardIteratorWithStartPosition(startPosition: number): IntervalCollectionIterator<TInterval> {\n const iterator = new IntervalCollectionIterator<TInterval>(this, false, startPosition);\n return iterator;\n }\n\n public CreateForwardIteratorWithEndPosition(endPosition: number): IntervalCollectionIterator<TInterval> {\n const iterator = new IntervalCollectionIterator<TInterval>(this, true, undefined, endPosition);\n return iterator;\n }\n\n public CreateBackwardIteratorWithEndPosition(endPosition: number): IntervalCollectionIterator<TInterval> {\n const iterator = new IntervalCollectionIterator<TInterval>(this, false, undefined, endPosition);\n return iterator;\n }\n\n public gatherIterationResults(\n results: TInterval[],\n iteratesForward: boolean,\n start?: number,\n end?: number) {\n if (!this.attached) {\n return;\n }\n\n this.localCollection.gatherIterationResults(results, iteratesForward, start, end);\n }\n\n public findOverlappingIntervals(startPosition: number, endPosition: number): TInterval[] {\n if (!this.attached) {\n throw new LoggingError(\"attachSequence must be called\");\n }\n\n return this.localCollection.findOverlappingIntervals(startPosition, endPosition);\n }\n\n public map(fn: (interval: TInterval) => void) {\n if (!this.attached) {\n throw new LoggingError(\"attachSequence must be called\");\n }\n\n this.localCollection.map(fn);\n }\n\n public previousInterval(pos: number): TInterval {\n if (!this.attached) {\n throw new LoggingError(\"attachSequence must be called\");\n }\n\n return this.localCollection.previousInterval(pos);\n }\n\n public nextInterval(pos: number): TInterval {\n if (!this.attached) {\n throw new LoggingError(\"attachSequence must be called\");\n }\n\n return this.localCollection.nextInterval(pos);\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"localValues.js","sourceRoot":"","sources":["../src/localValues.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2EAG4C;AAkC5C,SAAgB,gBAAgB,CAC5B,UAAuB,EACvB,UAA4B,EAC5B,IAAkB;IAClB,MAAM,KAAK,GAAG,UAAU,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAC1D,OAAO;QACH,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;KAChD,CAAC;AACN,CAAC;AATD,4CASC;AAED;;;;GAIG;AACH,MAAa,mBAAmB;IAC5B;;;;OAIG;IACH,YAA4B,KAAQ,EAAmB,SAAwB;QAAnD,UAAK,GAAL,KAAK,CAAG;QAAmB,cAAS,GAAT,SAAS,CAAe;IAC/E,CAAC;IAED;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;IAC/B,CAAC;IAED;;OAEG;IACI,cAAc,CACjB,UAA4B,EAC5B,IAAkB;QAElB,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjE,MAAM,KAAK,GAAG,IAAA,qCAAgB,EAAC,eAAe,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;QAElE,OAAO;YACH,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK;SACR,CAAC;IACN,CAAC;IAED;;;;OAIG;IACI,YAAY,CAAC,MAAc;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC/C,IAAI,CAAC,OAAO,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;SAC3C;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AA7CD,kDA6CC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n IFluidSerializer,\n serializeHandles,\n} from \"@fluidframework/shared-object-base\";\nimport {\n ISerializableValue,\n ISerializedValue,\n IValueOperation,\n IValueType,\n} from \"./defaultMapInterfaces\";\n\n/**\n * A local value to be stored in a container type DDS.\n */\nexport interface ILocalValue<T = any> {\n /**\n * Type indicator of the value stored within.\n */\n readonly type: string;\n\n /**\n * The in-memory value stored within.\n */\n readonly value: T;\n\n /**\n * Retrieve the serialized form of the value stored within.\n * @param serializer - Data store runtime's serializer\n * @param bind - Container type's handle\n * @returns The serialized form of the contained value\n */\n makeSerialized(\n serializer: IFluidSerializer,\n bind: IFluidHandle,\n ): ISerializedValue;\n}\n\nexport function makeSerializable(\n localValue: ILocalValue,\n serializer: IFluidSerializer,\n bind: IFluidHandle): ISerializableValue {\n const value = localValue.makeSerialized(serializer, bind);\n return {\n type: value.type,\n value: value.value && JSON.parse(value.value),\n };\n}\n\n/**\n * Manages a contained value type.\n *\n * @alpha\n */\nexport class ValueTypeLocalValue<T> implements ILocalValue<T> {\n /**\n * Create a new ValueTypeLocalValue.\n * @param value - The instance of the value type stored within\n * @param valueType - The type object of the value type stored within\n */\n constructor(public readonly value: T, private readonly valueType: IValueType<T>) {\n }\n\n /**\n * {@inheritDoc ILocalValue.\"type\"}\n */\n public get type(): string {\n return this.valueType.name;\n }\n\n /**\n * {@inheritDoc ILocalValue.makeSerialized}\n */\n public makeSerialized(\n serializer: IFluidSerializer,\n bind: IFluidHandle,\n ): ISerializedValue {\n const storedValueType = this.valueType.factory.store(this.value);\n const value = serializeHandles(storedValueType, serializer, bind);\n\n return {\n type: this.type,\n value,\n };\n }\n\n /**\n * Get the handler for a given op of this value type.\n * @param opName - The name of the operation that needs processing\n * @returns The object which can process the given op\n */\n public getOpHandler(opName: string): IValueOperation<T> {\n const handler = this.valueType.ops.get(opName);\n if (!handler) {\n throw new Error(\"Unknown type message\");\n }\n\n return handler;\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,0BAA0B,CAAC;AACrC,QAAA,UAAU,GAAG,cAAc,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/sequence\";\nexport const pkgVersion = \"1.4.0-121020\";\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sequence.js","sourceRoot":"","sources":["../src/sequence.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,+DAAgF;AAChF,qEAA8D;AAC9D,+EAG8C;AAM9C,2DAyBoC;AACpC,iEAA2F;AAC3F,2EAO4C;AAI5C,6DAI8B;AAC9B,6CAA0C;AAE1C,6DAAoF;AAGpF,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAClC,MAAM,WAAW,GAAG,SAAS,CAAC;AA2C9B,MAAsB,qBAClB,SAAQ,iCAA0C;IAiElD,YACqB,gBAAwC,EAClD,EAAU,EACjB,UAA8B,EACd,eAAiD;QAEjE,KAAK,CAAC,EAAE,EAAE,gBAAgB,EAAE,UAAU,EAAE,iBAAiB,CAAC,CAAC;QAL1C,qBAAgB,GAAhB,gBAAgB,CAAwB;QAClD,OAAE,GAAF,EAAE,CAAQ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,CAAC,MAAM,GAAG,CAAC,CAAC;aAC7C;SACJ;IACL,CAAC;IAEO,6BAA6B;QACjC,sDAAsD;QACtD,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,aAAa,EAAiB,EAAE,KAAc,EAAE,EAAE;YACzG,MAAM,kBAAkB,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7D,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE;gBAC9B,kBAAkB,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;aACpD;YACD,IAAA,qBAAM,EAAC,aAAa,KAAK,SAAS,EAAE,KAAK,CAAC,4DAA4D,CAAC,CAAC;YACxG,IAAI,CAAC,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;QAEH,gDAAgD;QAChD,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE,EAAE;YAC/C,MAAM,kBAAkB,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7D,kBAAkB,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;SACpD;IACL,CAAC;CACJ;AA/nBD,sDA+nBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { Deferred, bufferToString, assert } from \"@fluidframework/common-utils\";\nimport { ChildLogger } from \"@fluidframework/telemetry-utils\";\nimport {\n ISequencedDocumentMessage,\n MessageType,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n Client,\n createAnnotateRangeOp,\n createGroupOp,\n createInsertOp,\n createRemoveRangeOp,\n ICombiningOp,\n IJSONSegment,\n IMergeTreeAnnotateMsg,\n IMergeTreeDeltaOp,\n IMergeTreeGroupMsg,\n IMergeTreeOp,\n IMergeTreeRemoveMsg,\n IRelativePosition,\n ISegment,\n ISegmentAction,\n LocalReference,\n LocalReferencePosition,\n matchProperties,\n MergeTreeDeltaType,\n PropertySet,\n RangeStackMap,\n ReferencePosition,\n ReferenceType,\n SegmentGroup,\n} from \"@fluidframework/merge-tree\";\nimport { ObjectStoragePartition, SummaryTreeBuilder } from \"@fluidframework/runtime-utils\";\nimport {\n IFluidSerializer,\n makeHandlesSerializable,\n parseHandles,\n SharedObject,\n ISharedObjectEvents,\n SummarySerializer,\n} from \"@fluidframework/shared-object-base\";\nimport { IEventThisPlaceHolder } from \"@fluidframework/common-definitions\";\nimport { ISummaryTreeWithStats, ITelemetryContext } from \"@fluidframework/runtime-definitions\";\n\nimport {\n IntervalCollection,\n SequenceInterval,\n SequenceIntervalCollectionValueType,\n} from \"./intervalCollection\";\nimport { DefaultMap } from \"./defaultMap\";\nimport { IMapMessageLocalMetadata, IValueChanged } from \"./defaultMapInterfaces\";\nimport { SequenceDeltaEvent, SequenceMaintenanceEvent } from \"./sequenceDeltaEvent\";\nimport { ISharedIntervalCollection } from \"./sharedIntervalCollection\";\n\nconst snapshotFileName = \"header\";\nconst contentPath = \"content\";\n\n/**\n * Events emitted in response to changes to the sequence data.\n *\n * @remarks\n *\n * The following is the list of events emitted.\n *\n * ### \"sequenceDelta\"\n *\n * The sequenceDelta event is emitted when segments are inserted, annotated, or removed.\n *\n * #### Listener signature\n *\n * ```typescript\n * (event: SequenceDeltaEvent, target: IEventThisPlaceHolder) => void\n * ```\n * - `event` - Various information on the segments that were modified.\n *\n * - `target` - The sequence itself.\n *\n * ### \"maintenance\"\n *\n * The maintenance event is emitted when segments are modified during merge-tree maintenance.\n *\n * #### Listener signature\n *\n * ```typescript\n * (event: SequenceMaintenanceEvent, target: IEventThisPlaceHolder) => void\n * ```\n * - `event` - Various information on the segments that were modified.\n *\n * - `target` - The sequence itself.\n */\nexport interface ISharedSegmentSequenceEvents extends ISharedObjectEvents {\n (event: \"createIntervalCollection\",\n listener: (label: string, local: boolean, target: IEventThisPlaceHolder) => void);\n (event: \"sequenceDelta\", listener: (event: SequenceDeltaEvent, target: IEventThisPlaceHolder) => void);\n (event: \"maintenance\",\n listener: (event: SequenceMaintenanceEvent, target: IEventThisPlaceHolder) => void);\n}\n\nexport abstract class SharedSegmentSequence<T extends ISegment>\n extends SharedObject<ISharedSegmentSequenceEvents>\n implements ISharedIntervalCollection<SequenceInterval> {\n get loaded(): Promise<void> {\n return this.loadedDeferred.promise;\n }\n\n private static createOpsFromDelta(event: SequenceDeltaEvent): IMergeTreeDeltaOp[] {\n const ops: IMergeTreeDeltaOp[] = [];\n for (const r of event.ranges) {\n switch (event.deltaOperation) {\n case MergeTreeDeltaType.ANNOTATE: {\n const lastAnnotate = ops[ops.length - 1] as IMergeTreeAnnotateMsg;\n const props = {};\n for (const key of Object.keys(r.propertyDeltas)) {\n props[key] = r.segment.properties?.[key] ?? null;\n }\n if (lastAnnotate && lastAnnotate.pos2 === r.position &&\n matchProperties(lastAnnotate.props, props)) {\n lastAnnotate.pos2 += r.segment.cachedLength;\n } else {\n ops.push(createAnnotateRangeOp(\n r.position,\n r.position + r.segment.cachedLength,\n props,\n undefined));\n }\n break;\n }\n\n case MergeTreeDeltaType.INSERT:\n ops.push(createInsertOp(\n r.position,\n r.segment.clone().toJSONObject()));\n break;\n\n case MergeTreeDeltaType.REMOVE: {\n const lastRem = ops[ops.length - 1] as IMergeTreeRemoveMsg;\n if (lastRem?.pos1 === r.position) {\n lastRem.pos2 += r.segment.cachedLength;\n } else {\n ops.push(createRemoveRangeOp(\n r.position,\n r.position + r.segment.cachedLength));\n }\n break;\n }\n\n default:\n }\n }\n return ops;\n }\n\n protected client: Client;\n // Deferred that triggers once the object is loaded\n protected loadedDeferred = new Deferred<void>();\n // cache out going ops created when partial loading\n private readonly loadedDeferredOutgoingOps:\n [IMergeTreeOp, SegmentGroup | SegmentGroup[]][] = [];\n // cache incoming ops that arrive when partial loading\n private deferIncomingOps = true;\n private readonly loadedDeferredIncomingOps: ISequencedDocumentMessage[] = [];\n\n private messagesSinceMSNChange: ISequencedDocumentMessage[] = [];\n private readonly intervalCollections: DefaultMap<IntervalCollection<SequenceInterval>>;\n constructor(\n private readonly dataStoreRuntime: IFluidDataStoreRuntime,\n public id: string,\n attributes: IChannelAttributes,\n public readonly segmentFromSpec: (spec: IJSONSegment) => ISegment,\n ) {\n super(id, dataStoreRuntime, attributes, \"fluid_sequence_\");\n\n this.loadedDeferred.promise.catch((error) => {\n this.logger.sendErrorEvent({ eventName: \"SequenceLoadFailed\" }, error);\n });\n\n this.client = new Client(\n segmentFromSpec,\n ChildLogger.create(this.logger, \"SharedSegmentSequence.MergeTreeClient\"),\n dataStoreRuntime.options);\n\n super.on(\"newListener\", (event) => {\n switch (event) {\n case \"sequenceDelta\":\n if (!this.client.mergeTreeDeltaCallback) {\n this.client.mergeTreeDeltaCallback = (opArgs, deltaArgs) => {\n this.emit(\"sequenceDelta\", new SequenceDeltaEvent(opArgs, deltaArgs, this.client), this);\n };\n }\n break;\n case \"maintenance\":\n if (!this.client.mergeTreeMaintenanceCallback) {\n this.client.mergeTreeMaintenanceCallback = (args, opArgs) => {\n this.emit(\"maintenance\", new SequenceMaintenanceEvent(opArgs, args, this.client), this);\n };\n }\n break;\n default:\n }\n });\n super.on(\"removeListener\", (event: string | symbol) => {\n switch (event) {\n case \"sequenceDelta\":\n if (super.listenerCount(event) === 0) {\n this.client.mergeTreeDeltaCallback = undefined;\n }\n break;\n case \"maintenance\":\n if (super.listenerCount(event) === 0) {\n this.client.mergeTreeMaintenanceCallback = undefined;\n }\n break;\n default:\n break;\n }\n });\n\n this.intervalCollections = new DefaultMap(\n this.serializer,\n this.handle,\n (op, localOpMetadata) => this.submitLocalMessage(op, localOpMetadata),\n new SequenceIntervalCollectionValueType(),\n );\n }\n\n /**\n * @param start - The inclusive start of the range to remove\n * @param end - The exclusive end of the range to remove\n */\n public removeRange(start: number, end: number): IMergeTreeRemoveMsg {\n const removeOp = this.client.removeRangeLocal(start, end);\n if (removeOp) {\n this.submitSequenceMessage(removeOp);\n }\n return removeOp;\n }\n\n public groupOperation(groupOp: IMergeTreeGroupMsg) {\n this.client.localTransaction(groupOp);\n this.submitSequenceMessage(groupOp);\n }\n\n public getContainingSegment(pos: number) {\n return this.client.getContainingSegment<T>(pos);\n }\n\n /**\n * Returns the length of the current sequence for the client\n */\n public getLength() {\n return this.client.getLength();\n }\n\n /**\n * Returns the current position of a segment, and -1 if the segment\n * does not exist in this sequence\n * @param segment - The segment to get the position of\n */\n public getPosition(segment: ISegment): number {\n return this.client.getPosition(segment);\n }\n\n /**\n * Annotates the range with the provided properties\n *\n * @param start - The inclusive start position of the range to annotate\n * @param end - The exclusive end position of the range to annotate\n * @param props - The properties to annotate the range with\n * @param combiningOp - Optional. Specifies how to combine values for the property, such as \"incr\" for increment.\n *\n */\n public annotateRange(\n start: number,\n end: number,\n props: PropertySet,\n combiningOp?: ICombiningOp) {\n const annotateOp =\n this.client.annotateRangeLocal(start, end, props, combiningOp);\n if (annotateOp) {\n this.submitSequenceMessage(annotateOp);\n }\n }\n\n public getPropertiesAtPosition(pos: number) {\n return this.client.getPropertiesAtPosition(pos);\n }\n\n public getRangeExtentsOfPosition(pos: number) {\n return this.client.getRangeExtentsOfPosition(pos);\n }\n\n /**\n * @deprecated - use createLocalReferencePosition\n */\n public createPositionReference(\n segment: T,\n offset: number,\n refType: ReferenceType): LocalReference {\n const lref = new LocalReference(this.client, segment, offset, refType);\n if (refType !== ReferenceType.Transient) {\n this.addLocalReference(lref);\n }\n return lref;\n }\n\n public createLocalReferencePosition(\n segment: T,\n offset: number,\n refType: ReferenceType,\n properties: PropertySet | undefined): LocalReferencePosition {\n return this.client.createLocalReferencePosition(\n segment,\n offset,\n refType,\n properties);\n }\n\n /**\n * @deprecated - use localReferencePositionToPosition\n */\n public localRefToPos(localRef: LocalReference) {\n return this.client.localReferencePositionToPosition(localRef);\n }\n\n public localReferencePositionToPosition(lref: ReferencePosition): number {\n return this.client.localReferencePositionToPosition(lref);\n }\n\n /**\n * Resolves a remote client's position against the local sequence\n * and returns the remote client's position relative to the local\n * sequence. The client ref seq must be above the minimum sequence number\n * or the return value will be undefined.\n * Generally this method is used in conjunction with signals which provide\n * point in time values for the below parameters, and is useful for things\n * like displaying user position. It should not be used with persisted values\n * as persisted values will quickly become invalid as the remoteClientRefSeq\n * moves below the minimum sequence number\n * @param remoteClientPosition - The remote client's position to resolve\n * @param remoteClientRefSeq - The reference sequence number of the remote client\n * @param remoteClientId - The client id of the remote client\n */\n public resolveRemoteClientPosition(\n remoteClientPosition: number,\n remoteClientRefSeq: number,\n remoteClientId: string): number {\n return this.client.resolveRemoteClientPosition(\n remoteClientPosition,\n remoteClientRefSeq,\n remoteClientId);\n }\n\n public submitSequenceMessage(message: IMergeTreeOp) {\n if (!this.isAttached()) {\n return;\n }\n const translated = makeHandlesSerializable(message, this.serializer, this.handle);\n const metadata = this.client.peekPendingSegmentGroups(\n message.type === MergeTreeDeltaType.GROUP ? message.ops.length : 1);\n\n // if loading isn't complete, we need to cache\n // local ops until loading is complete, and then\n // they will be resent\n if (!this.loadedDeferred.isCompleted) {\n this.loadedDeferredOutgoingOps.push([translated, metadata]);\n } else {\n this.submitLocalMessage(translated, metadata);\n }\n }\n\n /**\n * @deprecated - use createLocalReferencePosition\n */\n public addLocalReference(lref: LocalReference) {\n return this.client.addLocalReference(lref);\n }\n\n /**\n * @deprecated - use removeLocalReferencePosition\n */\n public removeLocalReference(lref: LocalReference) {\n return this.client.removeLocalReferencePosition(lref);\n }\n\n public removeLocalReferencePosition(lref: LocalReferencePosition) {\n return this.client.removeLocalReferencePosition(lref);\n }\n\n /**\n * Given a position specified relative to a marker id, lookup the marker\n * and convert the position to a character position.\n * @param relativePos - Id of marker (may be indirect) and whether position is before or after marker.\n */\n public posFromRelativePos(relativePos: IRelativePosition) {\n return this.client.posFromRelativePos(relativePos);\n }\n\n /**\n * Walk the underlying segments of the sequence.\n * The walked segments may extend beyond the range\n * if the segments cross the ranges start or end boundaries.\n * Set split range to true to ensure only segments within the\n * range are walked.\n *\n * @param handler - The function to handle each segment\n * @param start - Optional. The start of range walk.\n * @param end - Optional. The end of range walk\n * @param accum - Optional. An object that will be passed to the handler for accumulation\n * @param splitRange - Optional. Splits boundary segments on the range boundaries\n */\n public walkSegments<TClientData>(\n handler: ISegmentAction<TClientData>,\n start?: number, end?: number, accum?: TClientData,\n splitRange: boolean = false) {\n return this.client.walkSegments<TClientData>(handler, start, end, accum, splitRange);\n }\n\n public getStackContext(startPos: number, rangeLabels: string[]): RangeStackMap {\n return this.client.getStackContext(startPos, rangeLabels);\n }\n\n public getCurrentSeq() {\n return this.client.getCurrentSeq();\n }\n\n public insertAtReferencePosition(pos: ReferencePosition, segment: T) {\n const insertOp = this.client.insertAtReferencePositionLocal(pos, segment);\n if (insertOp) {\n this.submitSequenceMessage(insertOp);\n }\n }\n\n /**\n * @deprecated - IntervalCollections are created on a first-write wins basis, and concurrent creates\n * are supported. Use `getIntervalCollection` instead.\n */\n public async waitIntervalCollection(\n label: string,\n ): Promise<IntervalCollection<SequenceInterval>> {\n return this.intervalCollections.get(label);\n }\n\n public getIntervalCollection(label: string): IntervalCollection<SequenceInterval> {\n return this.intervalCollections.get(label);\n }\n\n /**\n * @returns an iterable object that enumerates the IntervalCollection labels\n * Usage:\n * const iter = this.getIntervalCollectionKeys();\n * for (key of iter)\n * const collection = this.getIntervalCollection(key);\n * ...\n */\n public getIntervalCollectionLabels(): IterableIterator<string> {\n return this.intervalCollections.keys();\n }\n\n protected summarizeCore(\n serializer: IFluidSerializer,\n telemetryContext?: ITelemetryContext,\n ): ISummaryTreeWithStats {\n const builder = new SummaryTreeBuilder();\n\n // conditionally write the interval collection blob\n // only if it has entries\n if (this.intervalCollections.size > 0) {\n builder.addBlob(snapshotFileName, this.intervalCollections.serialize(serializer));\n }\n\n builder.addWithStats(contentPath, this.summarizeMergeTree(serializer));\n\n return builder.getSummaryTree();\n }\n\n /**\n * Runs serializer over the GC data for this SharedMatrix.\n * All the IFluidHandle's represent routes to other objects.\n */\n protected processGCDataCore(serializer: SummarySerializer) {\n if (this.intervalCollections.size > 0) {\n this.intervalCollections.serialize(serializer);\n }\n\n this.client.serializeGCData(this.handle, serializer);\n }\n\n /**\n * Replace the range specified from start to end with the provided segment\n * This is done by inserting the segment at the end of the range, followed\n * by removing the contents of the range\n * For a zero or reverse range (start \\>= end), insert at end do not remove anything\n * @param start - The start of the range to replace\n * @param end - The end of the range to replace\n * @param segment - The segment that will replace the range\n */\n protected replaceRange(start: number, end: number, segment: ISegment) {\n // Insert at the max end of the range when start > end, but still remove the range later\n const insertIndex: number = Math.max(start, end);\n\n // Insert first, so local references can slide to the inserted seg if any\n const insert = this.client.insertSegmentLocal(insertIndex, segment);\n if (insert) {\n if (start < end) {\n const remove = this.client.removeRangeLocal(start, end);\n this.submitSequenceMessage(createGroupOp(insert, remove));\n } else {\n this.submitSequenceMessage(insert);\n }\n }\n }\n\n protected onConnect() {\n // Update merge tree collaboration information with new client ID and then resend pending ops\n this.client.startOrUpdateCollaboration(this.runtime.clientId);\n }\n\n protected onDisconnect() { }\n\n protected reSubmitCore(content: any, localOpMetadata: unknown) {\n if (!this.intervalCollections.tryResubmitMessage(content, localOpMetadata as IMapMessageLocalMetadata)) {\n this.submitSequenceMessage(\n this.client.regeneratePendingOp(\n content as IMergeTreeOp,\n localOpMetadata as SegmentGroup | SegmentGroup[]));\n }\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n */\n protected async loadCore(storage: IChannelStorageService) {\n if (await storage.contains(snapshotFileName)) {\n const blob = await storage.readBlob(snapshotFileName);\n const header = bufferToString(blob, \"utf8\");\n this.intervalCollections.populate(header);\n }\n\n try {\n // this will load the header, and return a promise\n // that will resolve when the body is loaded\n // and the catchup ops are available.\n const { catchupOpsP } = await this.client.load(\n this.runtime,\n new ObjectStoragePartition(storage, contentPath),\n this.serializer);\n\n // setup a promise to process the\n // catch up ops, and finishing the loading process\n const loadCatchUpOps = catchupOpsP\n .then((msgs) => {\n msgs.forEach((m) => {\n const collabWindow = this.client.getCollabWindow();\n if (m.minimumSequenceNumber < collabWindow.minSeq\n || m.referenceSequenceNumber < collabWindow.minSeq\n || m.sequenceNumber <= collabWindow.minSeq\n || m.sequenceNumber <= collabWindow.currentSeq) {\n throw new Error(`Invalid catchup operations in snapshot: ${JSON.stringify({\n op: {\n seq: m.sequenceNumber,\n minSeq: m.minimumSequenceNumber,\n refSeq: m.referenceSequenceNumber,\n },\n collabWindow: {\n seq: collabWindow.currentSeq,\n minSeq: collabWindow.minSeq,\n },\n })}`);\n }\n this.processMergeTreeMsg(m);\n });\n this.loadFinished();\n })\n .catch((error) => {\n this.loadFinished(error);\n });\n if (this.dataStoreRuntime.options?.sequenceInitializeFromHeaderOnly !== true) {\n // if we not doing partial load, await the catch up ops,\n // and the finalization of the load\n await loadCatchUpOps;\n }\n } catch (error) {\n this.loadFinished(error);\n }\n }\n\n protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n // if loading isn't complete, we need to cache all\n // incoming ops to be applied after loading is complete\n if (this.deferIncomingOps) {\n assert(!local, 0x072 /* \"Unexpected local op when loading not finished\" */);\n this.loadedDeferredIncomingOps.push(message);\n } else {\n assert(message.type === MessageType.Operation, 0x073 /* \"Sequence message not operation\" */);\n\n const handled = this.intervalCollections.tryProcessMessage(\n message.contents,\n local,\n message,\n localOpMetadata,\n );\n\n if (!handled) {\n this.processMergeTreeMsg(message, local);\n }\n }\n }\n\n protected didAttach() {\n // If we are not local, and we've attached we need to start generating and sending ops\n // so start collaboration and provide a default client id incase we are not connected\n if (this.isAttached()) {\n this.client.startOrUpdateCollaboration(this.runtime.clientId ?? \"attached\");\n }\n }\n\n protected initializeLocalCore() {\n super.initializeLocalCore();\n this.loadFinished();\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n */\n protected applyStashedOp(content: any): unknown {\n return this.client.applyStashedOp(content);\n }\n\n private summarizeMergeTree(serializer: IFluidSerializer): ISummaryTreeWithStats {\n // Are we fully loaded? If not, things will go south\n assert(this.loadedDeferred.isCompleted, 0x074 /* \"Snapshot called when not fully loaded\" */);\n const minSeq = this.runtime.deltaManager.minimumSequenceNumber;\n\n this.processMinSequenceNumberChanged(minSeq);\n\n this.messagesSinceMSNChange.forEach((m) => { m.minimumSequenceNumber = minSeq; });\n\n return this.client.summarize(this.runtime, this.handle, serializer, this.messagesSinceMSNChange);\n }\n\n private processMergeTreeMsg(rawMessage: ISequencedDocumentMessage, local?: boolean) {\n const message = parseHandles(rawMessage, this.serializer);\n\n const ops: IMergeTreeDeltaOp[] = [];\n function transformOps(event: SequenceDeltaEvent) {\n ops.push(...SharedSegmentSequence.createOpsFromDelta(event));\n }\n const needsTransformation = message.referenceSequenceNumber !== message.sequenceNumber - 1;\n let stashMessage: Readonly<ISequencedDocumentMessage> = message;\n if (this.runtime.options?.newMergeTreeSnapshotFormat !== true) {\n if (needsTransformation) {\n this.on(\"sequenceDelta\", transformOps);\n }\n }\n\n this.client.applyMsg(message, local);\n\n if (this.runtime.options?.newMergeTreeSnapshotFormat !== true) {\n if (needsTransformation) {\n this.removeListener(\"sequenceDelta\", transformOps);\n // shallow clone the message as we only overwrite top level properties,\n // like referenceSequenceNumber and content only\n stashMessage = {\n ...message,\n referenceSequenceNumber: stashMessage.sequenceNumber - 1,\n contents: ops.length !== 1 ? createGroupOp(...ops) : ops[0],\n };\n }\n\n this.messagesSinceMSNChange.push(stashMessage);\n\n // Do GC every once in a while...\n if (this.messagesSinceMSNChange.length > 20\n && this.messagesSinceMSNChange[20].sequenceNumber < message.minimumSequenceNumber) {\n this.processMinSequenceNumberChanged(message.minimumSequenceNumber);\n }\n }\n }\n\n private processMinSequenceNumberChanged(minSeq: number) {\n let index = 0;\n for (; index < this.messagesSinceMSNChange.length; index++) {\n if (this.messagesSinceMSNChange[index].sequenceNumber > minSeq) {\n break;\n }\n }\n if (index !== 0) {\n this.messagesSinceMSNChange = this.messagesSinceMSNChange.slice(index);\n }\n }\n\n private loadFinished(error?: any) {\n if (!this.loadedDeferred.isCompleted) {\n // Initialize the interval collections\n this.initializeIntervalCollections();\n if (error) {\n this.loadedDeferred.reject(error);\n throw error;\n } else {\n // it is important this series remains synchronous\n // first we stop deferring incoming ops, and apply then all\n this.deferIncomingOps = false;\n for (const message of this.loadedDeferredIncomingOps) {\n this.processCore(message, false, undefined);\n }\n this.loadedDeferredIncomingOps.length = 0;\n\n // then resolve the loaded promise\n // and resubmit all the outstanding ops, as the snapshot\n // is fully loaded, and all outstanding ops are applied\n this.loadedDeferred.resolve();\n\n for (const [messageContent, opMetadata] of this.loadedDeferredOutgoingOps) {\n this.reSubmitCore(messageContent, opMetadata);\n }\n this.loadedDeferredOutgoingOps.length = 0;\n }\n }\n }\n\n private initializeIntervalCollections() {\n // Listen and initialize new SharedIntervalCollections\n this.intervalCollections.eventEmitter.on(\"create\", ({ key, previousValue }: IValueChanged, local: boolean) => {\n const intervalCollection = this.intervalCollections.get(key);\n if (!intervalCollection.attached) {\n intervalCollection.attachGraph(this.client, key);\n }\n assert(previousValue === undefined, 0x2c1 /* \"Creating an interval collection that already exists?\" */);\n this.emit(\"createIntervalCollection\", key, local, this);\n });\n\n // Initialize existing SharedIntervalCollections\n for (const key of this.intervalCollections.keys()) {\n const intervalCollection = this.intervalCollections.get(key);\n intervalCollection.attachGraph(this.client, key);\n }\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sequenceDeltaEvent.js","sourceRoot":"","sources":["../src/sequenceDeltaEvent.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AACtD,2DAWoC;AAEpC;;;;;;GAMG;AACH,MAAsB,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,CAAC,MAAM,CAAC;IACvB,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport {\n Client,\n IMergeTreeDeltaCallbackArgs,\n IMergeTreeDeltaOpArgs,\n IMergeTreeMaintenanceCallbackArgs,\n ISegment,\n MergeTreeDeltaOperationType,\n MergeTreeDeltaOperationTypes,\n MergeTreeMaintenanceType,\n PropertySet,\n SortedSegmentSet,\n} from \"@fluidframework/merge-tree\";\n\n/**\n * Base class for SequenceDeltaEvent and SequenceMaintenanceEvent.\n *\n * The properties of this object and its sub-objects represent the state of the sequence at the\n * point in time at which the operation was applied.\n * They will not take into any future modifications performed to the underlying sequence and merge tree.\n */\nexport abstract class SequenceEvent<TOperation extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationTypes> {\n /**\n * @deprecated - Events no longer fire when the change they correspond to had no impact (e.g. a remote delete\n * event for a range that had already been deleted locally).\n * Clients can therefore assume this property is false.\n */\n public readonly isEmpty: boolean;\n public readonly deltaOperation: TOperation;\n private readonly sortedRanges: Lazy<SortedSegmentSet<ISequenceDeltaRange<TOperation>>>;\n private readonly pFirst: Lazy<ISequenceDeltaRange<TOperation>>;\n private readonly pLast: Lazy<ISequenceDeltaRange<TOperation>>;\n\n constructor(\n public readonly deltaArgs: IMergeTreeDeltaCallbackArgs<TOperation>,\n private readonly mergeTreeClient: Client,\n ) {\n assert(deltaArgs.deltaSegments.length > 0, 0x2d8 /* \"Empty change event should not be emitted.\" */);\n this.isEmpty = false;\n this.deltaOperation = deltaArgs.operation;\n\n this.sortedRanges = new Lazy<SortedSegmentSet<ISequenceDeltaRange<TOperation>>>(\n () => {\n const set = new SortedSegmentSet<ISequenceDeltaRange<TOperation>>();\n this.deltaArgs.deltaSegments.forEach((delta) => {\n const newRange: ISequenceDeltaRange<TOperation> = {\n operation: this.deltaArgs.operation,\n position: this.mergeTreeClient.getPosition(delta.segment),\n propertyDeltas: delta.propertyDeltas,\n segment: delta.segment,\n };\n set.addOrUpdate(newRange);\n });\n return set;\n });\n\n this.pFirst = new Lazy<ISequenceDeltaRange<TOperation>>(\n () => this.sortedRanges.value.items[0],\n );\n\n this.pLast = new Lazy<ISequenceDeltaRange<TOperation>>(\n () => this.sortedRanges.value.items[this.sortedRanges.value.size - 1],\n );\n }\n\n /**\n * The in-order ranges affected by this delta.\n * These may not be continuous.\n */\n public get ranges(): readonly Readonly<ISequenceDeltaRange<TOperation>>[] {\n return this.sortedRanges.value.items;\n }\n\n /**\n * The client id of the client that made the change which caused the delta event\n */\n public get clientId(): string {\n return this.mergeTreeClient.longClientId;\n }\n\n /**\n * The first of the modified ranges.\n */\n public get first(): Readonly<ISequenceDeltaRange<TOperation>> {\n return this.pFirst.value;\n }\n\n /**\n * The last of the modified ranges.\n */\n public get last(): Readonly<ISequenceDeltaRange<TOperation>> {\n return this.pLast.value;\n }\n}\n\n/**\n * The event object returned on sequenceDelta events.\n *\n * The properties of this object and its sub-objects represent the state of the sequence at the\n * point in time at which the operation was applied.\n * They will not take into consideration any future modifications performed to the underlying sequence and merge tree.\n *\n * For group ops, each op will get its own event, and the group op property will be set on the op args.\n *\n * Ops may get multiple events. For instance, an insert-replace will get a remove then an insert event.\n */\nexport class SequenceDeltaEvent extends SequenceEvent<MergeTreeDeltaOperationType> {\n /**\n * Whether the event was caused by a locally-made change.\n */\n public readonly isLocal: boolean;\n\n constructor(\n public readonly opArgs: IMergeTreeDeltaOpArgs,\n deltaArgs: IMergeTreeDeltaCallbackArgs,\n mergeTreeClient: Client,\n ) {\n super(deltaArgs, mergeTreeClient);\n this.isLocal = opArgs.sequencedMessage === undefined;\n }\n}\n\n/**\n * The event object returned on maintenance events.\n *\n * The properties of this object and its sub-objects represent the state of the sequence at the\n * point in time at which the operation was applied.\n * They will not take into consideration any future modifications performed to the underlying sequence and merge tree.\n */\nexport class SequenceMaintenanceEvent extends SequenceEvent<MergeTreeMaintenanceType> {\n constructor(\n public readonly opArgs: IMergeTreeDeltaOpArgs | undefined,\n deltaArgs: IMergeTreeMaintenanceCallbackArgs,\n mergeTreeClient: Client,\n ) {\n super(deltaArgs, mergeTreeClient);\n }\n}\n\n/**\n * A range that has changed corresponding to a segment modification.\n */\nexport interface ISequenceDeltaRange<TOperation extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationTypes> {\n operation: TOperation;\n /**\n * The index of the start of the range.\n */\n position: number;\n /**\n * The segment that corresponds to the range.\n */\n segment: ISegment;\n propertyDeltas: PropertySet;\n}\n\nclass Lazy<T> {\n private pValue: T;\n private pEvaluated: boolean;\n constructor(private readonly valueGenerator: () => T) {\n this.pEvaluated = false;\n }\n\n public get evaluated(): boolean {\n return this.pEvaluated;\n }\n\n public get value(): T {\n if (!this.pEvaluated) {\n this.pEvaluated = true;\n this.pValue = this.valueGenerator();\n }\n return this.pValue;\n }\n}\n"]}
@@ -1,192 +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.SharedNumberSequenceFactory = exports.SharedObjectSequenceFactory = exports.SharedStringFactory = void 0;
8
- const merge_tree_1 = require("@fluidframework/merge-tree");
9
- const packageVersion_1 = require("./packageVersion");
10
- const sharedNumberSequence_1 = require("./sharedNumberSequence");
11
- const sharedObjectSequence_1 = require("./sharedObjectSequence");
12
- const sharedSequence_1 = require("./sharedSequence");
13
- const sharedString_1 = require("./sharedString");
14
- class SharedStringFactory {
15
- static segmentFromSpec(spec) {
16
- const maybeText = merge_tree_1.TextSegment.fromJSONObject(spec);
17
- if (maybeText) {
18
- return maybeText;
19
- }
20
- const maybeMarker = merge_tree_1.Marker.fromJSONObject(spec);
21
- if (maybeMarker) {
22
- return maybeMarker;
23
- }
24
- }
25
- get type() {
26
- return SharedStringFactory.Type;
27
- }
28
- get attributes() {
29
- return SharedStringFactory.Attributes;
30
- }
31
- /**
32
- * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
33
- */
34
- async load(runtime, id, services, attributes) {
35
- const sharedString = new sharedString_1.SharedString(runtime, id, attributes);
36
- await sharedString.load(services);
37
- return sharedString;
38
- }
39
- create(document, id) {
40
- const sharedString = new sharedString_1.SharedString(document, id, this.attributes);
41
- sharedString.initializeLocal();
42
- return sharedString;
43
- }
44
- }
45
- exports.SharedStringFactory = SharedStringFactory;
46
- // TODO rename back to https://graph.microsoft.com/types/mergeTree/string once paparazzi is able to dynamically
47
- // load code
48
- SharedStringFactory.Type = "https://graph.microsoft.com/types/mergeTree";
49
- SharedStringFactory.Attributes = {
50
- type: SharedStringFactory.Type,
51
- snapshotFormatVersion: "0.1",
52
- packageVersion: packageVersion_1.pkgVersion,
53
- };
54
- /**
55
- * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.
56
- * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)
57
- */
58
- class SharedObjectSequenceFactory {
59
- /**
60
- * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.
61
- * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)
62
- */
63
- static segmentFromSpec(segSpec) {
64
- const runSegment = segSpec;
65
- if (runSegment.items) {
66
- const seg = new sharedSequence_1.SubSequence(runSegment.items);
67
- if (runSegment.props) {
68
- seg.addProperties(runSegment.props);
69
- }
70
- return seg;
71
- }
72
- }
73
- /**
74
- * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.
75
- * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)
76
- */
77
- get type() {
78
- return SharedObjectSequenceFactory.Type;
79
- }
80
- /**
81
- * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.
82
- * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)
83
- */
84
- get attributes() {
85
- return SharedObjectSequenceFactory.Attributes;
86
- }
87
- /**
88
- * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
89
- *
90
- * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.
91
- * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)
92
- */
93
- async load(runtime, id, services, attributes) {
94
- const sharedSeq = new sharedObjectSequence_1.SharedObjectSequence(runtime, id, attributes);
95
- await sharedSeq.load(services);
96
- return sharedSeq;
97
- }
98
- /**
99
- * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.
100
- * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)
101
- */
102
- create(document, id) {
103
- const sharedString = new sharedObjectSequence_1.SharedObjectSequence(document, id, this.attributes);
104
- sharedString.initializeLocal();
105
- return sharedString;
106
- }
107
- }
108
- exports.SharedObjectSequenceFactory = SharedObjectSequenceFactory;
109
- /**
110
- * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.
111
- * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)
112
- */
113
- SharedObjectSequenceFactory.Type = "https://graph.microsoft.com/types/mergeTree/object-sequence";
114
- /**
115
- * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.
116
- * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)
117
- */
118
- SharedObjectSequenceFactory.Attributes = {
119
- type: SharedObjectSequenceFactory.Type,
120
- snapshotFormatVersion: "0.1",
121
- packageVersion: packageVersion_1.pkgVersion,
122
- };
123
- /**
124
- * @deprecated SharedNumberSequence is not recommended for use and will be removed in an upcoming release.
125
- * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)
126
- */
127
- class SharedNumberSequenceFactory {
128
- /**
129
- * @deprecated SharedNumberSequence is not recommended for use and will be removed in an upcoming release.
130
- * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)
131
- */
132
- static segmentFromSpec(segSpec) {
133
- const runSegment = segSpec;
134
- if (runSegment.items) {
135
- const seg = new sharedSequence_1.SubSequence(runSegment.items);
136
- if (runSegment.props) {
137
- seg.addProperties(runSegment.props);
138
- }
139
- return seg;
140
- }
141
- }
142
- /**
143
- * @deprecated SharedNumberSequence is not recommended for use and will be removed in an upcoming release.
144
- * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)
145
- */
146
- get type() {
147
- return SharedNumberSequenceFactory.Type;
148
- }
149
- /**
150
- * @deprecated SharedNumberSequence is not recommended for use and will be removed in an upcoming release.
151
- * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)
152
- */
153
- get attributes() {
154
- return SharedNumberSequenceFactory.Attributes;
155
- }
156
- /**
157
- * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
158
- *
159
- * @deprecated SharedNumberSequence is not recommended for use and will be removed in an upcoming release.
160
- * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)
161
- */
162
- async load(runtime, id, services, attributes) {
163
- const sharedSeq = new sharedNumberSequence_1.SharedNumberSequence(runtime, id, attributes);
164
- await sharedSeq.load(services);
165
- return sharedSeq;
166
- }
167
- /**
168
- * @deprecated SharedNumberSequence is not recommended for use and will be removed in an upcoming release.
169
- * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)
170
- */
171
- create(document, id) {
172
- const sharedString = new sharedNumberSequence_1.SharedNumberSequence(document, id, this.attributes);
173
- sharedString.initializeLocal();
174
- return sharedString;
175
- }
176
- }
177
- exports.SharedNumberSequenceFactory = SharedNumberSequenceFactory;
178
- /**
179
- * @deprecated SharedNumberSequence is not recommended for use and will be removed in an upcoming release.
180
- * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)
181
- */
182
- SharedNumberSequenceFactory.Type = "https://graph.microsoft.com/types/mergeTree/number-sequence";
183
- /**
184
- * @deprecated SharedNumberSequence is not recommended for use and will be removed in an upcoming release.
185
- * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)
186
- */
187
- SharedNumberSequenceFactory.Attributes = {
188
- type: SharedNumberSequenceFactory.Type,
189
- snapshotFormatVersion: "0.1",
190
- packageVersion: packageVersion_1.pkgVersion,
191
- };
192
- //# sourceMappingURL=sequenceFactory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sequenceFactory.js","sourceRoot":"","sources":["../src/sequenceFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,2DAIoC;AAEpC,qDAA8C;AAC9C,iEAA8D;AAC9D,iEAA8D;AAC9D,qDAAgE;AAChE,iDAAmE;AAEnE,MAAa,mBAAmB;IAWrB,MAAM,CAAC,eAAe,CAAC,IAAS;QACnC,MAAM,SAAS,GAAG,wBAAW,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QACnD,IAAI,SAAS,EAAE;YAAE,OAAO,SAAS,CAAC;SAAE;QAEpC,MAAM,WAAW,GAAG,mBAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAChD,IAAI,WAAW,EAAE;YAAE,OAAO,WAAW,CAAC;SAAE;IAC5C,CAAC;IAED,IAAW,IAAI;QACX,OAAO,mBAAmB,CAAC,IAAI,CAAC;IACpC,CAAC;IAED,IAAW,UAAU;QACjB,OAAO,mBAAmB,CAAC,UAAU,CAAC;IAC1C,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CACb,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAC9B,MAAM,YAAY,GAAG,IAAI,2BAAY,CAAC,OAAO,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;QAC/D,MAAM,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClC,OAAO,YAAY,CAAC;IACxB,CAAC;IAEM,MAAM,CAAC,QAAgC,EAAE,EAAU;QACtD,MAAM,YAAY,GAAG,IAAI,2BAAY,CAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,UAAU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AI,CAAC,UAAU,CAAC,CAAC;QAC7E,YAAY,CAAC,eAAe,EAAE,CAAC;QAC/B,OAAO,YAAY,CAAC;IACxB,CAAC;;AAxEL,kEAyEC;AAxEG;;;GAGG;AACW,gCAAI,GAAG,6DAA6D,CAAC;AAEnF;;;GAGG;AACoB,sCAAU,GAAuB;IACpD,IAAI,EAAE,2BAA2B,CAAC,IAAI;IACtC,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,2BAAU;CAC7B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelServices,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n IJSONSegment,\n Marker,\n TextSegment,\n} from \"@fluidframework/merge-tree\";\nimport { ISharedObject } from \"@fluidframework/shared-object-base\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { SharedNumberSequence } from \"./sharedNumberSequence\";\nimport { SharedObjectSequence } from \"./sharedObjectSequence\";\nimport { IJSONRunSegment, SubSequence } from \"./sharedSequence\";\nimport { SharedString, SharedStringSegment } from \"./sharedString\";\n\nexport class SharedStringFactory implements IChannelFactory {\n // TODO rename back to https://graph.microsoft.com/types/mergeTree/string once paparazzi is able to dynamically\n // load code\n public static Type = \"https://graph.microsoft.com/types/mergeTree\";\n\n public static readonly Attributes: IChannelAttributes = {\n type: SharedStringFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: pkgVersion,\n };\n\n public static segmentFromSpec(spec: any): SharedStringSegment {\n const maybeText = TextSegment.fromJSONObject(spec);\n if (maybeText) { return maybeText; }\n\n const maybeMarker = Marker.fromJSONObject(spec);\n if (maybeMarker) { return maybeMarker; }\n }\n\n public get type() {\n return SharedStringFactory.Type;\n }\n\n public get attributes() {\n return SharedStringFactory.Attributes;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n */\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes): Promise<SharedString> {\n const sharedString = new SharedString(runtime, id, attributes);\n await sharedString.load(services);\n return sharedString;\n }\n\n public create(document: IFluidDataStoreRuntime, id: string): SharedString {\n const sharedString = new SharedString(document, id, this.attributes);\n sharedString.initializeLocal();\n return sharedString;\n }\n}\n\n/**\n * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\nexport class SharedObjectSequenceFactory implements IChannelFactory {\n /**\n * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public static Type = \"https://graph.microsoft.com/types/mergeTree/object-sequence\";\n\n /**\n * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public static readonly Attributes: IChannelAttributes = {\n type: SharedObjectSequenceFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: pkgVersion,\n };\n\n /**\n * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public static segmentFromSpec(segSpec: IJSONSegment) {\n const runSegment = segSpec as IJSONRunSegment<object>;\n if (runSegment.items) {\n const seg = new SubSequence<object>(runSegment.items);\n if (runSegment.props) {\n seg.addProperties(runSegment.props);\n }\n return seg;\n }\n }\n\n /**\n * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public get type() {\n return SharedObjectSequenceFactory.Type;\n }\n\n /**\n * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public get attributes() {\n return SharedObjectSequenceFactory.Attributes;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n *\n * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes): Promise<ISharedObject> {\n const sharedSeq = new SharedObjectSequence<object>(runtime, id, attributes);\n await sharedSeq.load(services);\n return sharedSeq;\n }\n\n /**\n * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public create(document: IFluidDataStoreRuntime, id: string): ISharedObject {\n const sharedString = new SharedObjectSequence(document, id, this.attributes);\n sharedString.initializeLocal();\n return sharedString;\n }\n}\n\n/**\n * @deprecated SharedNumberSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\nexport class SharedNumberSequenceFactory implements IChannelFactory {\n /**\n * @deprecated SharedNumberSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public static Type = \"https://graph.microsoft.com/types/mergeTree/number-sequence\";\n\n /**\n * @deprecated SharedNumberSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public static readonly Attributes: IChannelAttributes = {\n type: SharedNumberSequenceFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: pkgVersion,\n };\n\n /**\n * @deprecated SharedNumberSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public static segmentFromSpec(segSpec: IJSONSegment) {\n const runSegment = segSpec as IJSONRunSegment<number>;\n if (runSegment.items) {\n const seg = new SubSequence<number>(runSegment.items);\n if (runSegment.props) {\n seg.addProperties(runSegment.props);\n }\n return seg;\n }\n }\n\n /**\n * @deprecated SharedNumberSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public get type() {\n return SharedNumberSequenceFactory.Type;\n }\n\n /**\n * @deprecated SharedNumberSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public get attributes() {\n return SharedNumberSequenceFactory.Attributes;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n *\n * @deprecated SharedNumberSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes): Promise<ISharedObject> {\n const sharedSeq = new SharedNumberSequence(runtime, id, attributes);\n await sharedSeq.load(services);\n return sharedSeq;\n }\n\n /**\n * @deprecated SharedNumberSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public create(document: IFluidDataStoreRuntime, id: string): ISharedObject {\n const sharedString = new SharedNumberSequence(document, id, this.attributes);\n sharedString.initializeLocal();\n return sharedString;\n }\n}\n"]}