@fluid-experimental/tree 0.59.2001 → 0.59.3000

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 (258) hide show
  1. package/.eslintrc.js +2 -0
  2. package/.vscode/SharedTree.code-workspace +15 -0
  3. package/.vscode/settings.json +6 -0
  4. package/dist/ChangeCompression.js +9 -9
  5. package/dist/ChangeCompression.js.map +1 -1
  6. package/dist/ChangeTypes.d.ts +1 -6
  7. package/dist/ChangeTypes.d.ts.map +1 -1
  8. package/dist/ChangeTypes.js +5 -5
  9. package/dist/ChangeTypes.js.map +1 -1
  10. package/dist/Checkout.js +14 -14
  11. package/dist/Checkout.js.map +1 -1
  12. package/dist/Common.d.ts +21 -3
  13. package/dist/Common.d.ts.map +1 -1
  14. package/dist/Common.js +29 -4
  15. package/dist/Common.js.map +1 -1
  16. package/dist/EditLog.js +26 -25
  17. package/dist/EditLog.js.map +1 -1
  18. package/dist/EditUtilities.js +17 -17
  19. package/dist/EditUtilities.js.map +1 -1
  20. package/dist/Forest.js +31 -31
  21. package/dist/Forest.js.map +1 -1
  22. package/dist/HistoryEditFactory.js +9 -9
  23. package/dist/HistoryEditFactory.js.map +1 -1
  24. package/dist/IdConversion.js +9 -9
  25. package/dist/IdConversion.js.map +1 -1
  26. package/dist/Identifiers.d.ts +4 -0
  27. package/dist/Identifiers.d.ts.map +1 -1
  28. package/dist/Identifiers.js.map +1 -1
  29. package/dist/LogViewer.d.ts +1 -5
  30. package/dist/LogViewer.d.ts.map +1 -1
  31. package/dist/LogViewer.js +11 -19
  32. package/dist/LogViewer.js.map +1 -1
  33. package/dist/MergeHealth.js +2 -2
  34. package/dist/MergeHealth.js.map +1 -1
  35. package/dist/NodeIdUtilities.js +2 -2
  36. package/dist/NodeIdUtilities.js.map +1 -1
  37. package/dist/PayloadUtilities.js +1 -1
  38. package/dist/PayloadUtilities.js.map +1 -1
  39. package/dist/RevisionValueCache.d.ts +13 -10
  40. package/dist/RevisionValueCache.d.ts.map +1 -1
  41. package/dist/RevisionValueCache.js +14 -11
  42. package/dist/RevisionValueCache.js.map +1 -1
  43. package/dist/RevisionView.js +4 -4
  44. package/dist/RevisionView.js.map +1 -1
  45. package/dist/SerializationUtilities.js +4 -4
  46. package/dist/SerializationUtilities.js.map +1 -1
  47. package/dist/SharedTree.d.ts +93 -31
  48. package/dist/SharedTree.d.ts.map +1 -1
  49. package/dist/SharedTree.js +160 -131
  50. package/dist/SharedTree.js.map +1 -1
  51. package/dist/SharedTreeEncoder.d.ts +3 -3
  52. package/dist/SharedTreeEncoder.d.ts.map +1 -1
  53. package/dist/SharedTreeEncoder.js +36 -36
  54. package/dist/SharedTreeEncoder.js.map +1 -1
  55. package/dist/StringInterner.js +1 -1
  56. package/dist/StringInterner.js.map +1 -1
  57. package/dist/Summary.js +1 -1
  58. package/dist/Summary.js.map +1 -1
  59. package/dist/SummaryBackCompatibility.js +8 -8
  60. package/dist/SummaryBackCompatibility.js.map +1 -1
  61. package/dist/Transaction.js +1 -1
  62. package/dist/Transaction.js.map +1 -1
  63. package/dist/TransactionInternal.js +17 -17
  64. package/dist/TransactionInternal.js.map +1 -1
  65. package/dist/TreeCompressor.d.ts.map +1 -1
  66. package/dist/TreeCompressor.js +6 -8
  67. package/dist/TreeCompressor.js.map +1 -1
  68. package/dist/TreeNodeHandle.js +4 -4
  69. package/dist/TreeNodeHandle.js.map +1 -1
  70. package/dist/TreeView.js +7 -7
  71. package/dist/TreeView.js.map +1 -1
  72. package/dist/TreeViewUtilities.js +2 -2
  73. package/dist/TreeViewUtilities.js.map +1 -1
  74. package/dist/UndoRedoHandler.js +1 -1
  75. package/dist/UndoRedoHandler.js.map +1 -1
  76. package/dist/UuidUtilities.d.ts +30 -0
  77. package/dist/UuidUtilities.d.ts.map +1 -0
  78. package/dist/UuidUtilities.js +106 -0
  79. package/dist/UuidUtilities.js.map +1 -0
  80. package/dist/id-compressor/AppendOnlySortedMap.d.ts +52 -28
  81. package/dist/id-compressor/AppendOnlySortedMap.d.ts.map +1 -1
  82. package/dist/id-compressor/AppendOnlySortedMap.js +167 -90
  83. package/dist/id-compressor/AppendOnlySortedMap.js.map +1 -1
  84. package/dist/id-compressor/IdCompressor.d.ts +43 -42
  85. package/dist/id-compressor/IdCompressor.d.ts.map +1 -1
  86. package/dist/id-compressor/IdCompressor.js +179 -177
  87. package/dist/id-compressor/IdCompressor.js.map +1 -1
  88. package/dist/id-compressor/IdRange.js +1 -1
  89. package/dist/id-compressor/IdRange.js.map +1 -1
  90. package/dist/id-compressor/NumericUuid.d.ts +6 -14
  91. package/dist/id-compressor/NumericUuid.d.ts.map +1 -1
  92. package/dist/id-compressor/NumericUuid.js +15 -76
  93. package/dist/id-compressor/NumericUuid.js.map +1 -1
  94. package/dist/id-compressor/SessionIdNormalizer.d.ts +122 -0
  95. package/dist/id-compressor/SessionIdNormalizer.d.ts.map +1 -0
  96. package/dist/id-compressor/SessionIdNormalizer.js +418 -0
  97. package/dist/id-compressor/SessionIdNormalizer.js.map +1 -0
  98. package/dist/id-compressor/persisted-types/0.0.1.d.ts +6 -13
  99. package/dist/id-compressor/persisted-types/0.0.1.d.ts.map +1 -1
  100. package/dist/id-compressor/persisted-types/0.0.1.js.map +1 -1
  101. package/dist/index.d.ts +2 -2
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.js.map +1 -1
  104. package/dist/persisted-types/0.1.1.d.ts +1 -6
  105. package/dist/persisted-types/0.1.1.d.ts.map +1 -1
  106. package/dist/persisted-types/0.1.1.js +3 -3
  107. package/dist/persisted-types/0.1.1.js.map +1 -1
  108. package/lib/ChangeTypes.d.ts +1 -6
  109. package/lib/ChangeTypes.d.ts.map +1 -1
  110. package/lib/Checkout.js.map +1 -1
  111. package/lib/Common.d.ts +21 -3
  112. package/lib/Common.d.ts.map +1 -1
  113. package/lib/Common.js +25 -3
  114. package/lib/Common.js.map +1 -1
  115. package/lib/EditLog.js +2 -1
  116. package/lib/EditLog.js.map +1 -1
  117. package/lib/EditUtilities.js.map +1 -1
  118. package/lib/Forest.js.map +1 -1
  119. package/lib/HistoryEditFactory.js.map +1 -1
  120. package/lib/Identifiers.d.ts +4 -0
  121. package/lib/Identifiers.d.ts.map +1 -1
  122. package/lib/Identifiers.js.map +1 -1
  123. package/lib/LogViewer.d.ts +1 -5
  124. package/lib/LogViewer.d.ts.map +1 -1
  125. package/lib/LogViewer.js +5 -13
  126. package/lib/LogViewer.js.map +1 -1
  127. package/lib/MergeHealth.js.map +1 -1
  128. package/lib/NodeIdUtilities.js.map +1 -1
  129. package/lib/RevisionValueCache.d.ts +13 -10
  130. package/lib/RevisionValueCache.d.ts.map +1 -1
  131. package/lib/RevisionValueCache.js +10 -7
  132. package/lib/RevisionValueCache.js.map +1 -1
  133. package/lib/RevisionView.js.map +1 -1
  134. package/lib/SharedTree.d.ts +93 -31
  135. package/lib/SharedTree.d.ts.map +1 -1
  136. package/lib/SharedTree.js +107 -78
  137. package/lib/SharedTree.js.map +1 -1
  138. package/lib/SharedTreeEncoder.d.ts +3 -3
  139. package/lib/SharedTreeEncoder.d.ts.map +1 -1
  140. package/lib/SharedTreeEncoder.js +4 -4
  141. package/lib/SharedTreeEncoder.js.map +1 -1
  142. package/lib/StringInterner.js.map +1 -1
  143. package/lib/Summary.js.map +1 -1
  144. package/lib/TreeCompressor.d.ts.map +1 -1
  145. package/lib/TreeCompressor.js +1 -3
  146. package/lib/TreeCompressor.js.map +1 -1
  147. package/lib/TreeNodeHandle.js.map +1 -1
  148. package/lib/TreeView.js.map +1 -1
  149. package/lib/TreeViewUtilities.js.map +1 -1
  150. package/lib/UuidUtilities.d.ts +30 -0
  151. package/lib/UuidUtilities.d.ts.map +1 -0
  152. package/lib/UuidUtilities.js +98 -0
  153. package/lib/UuidUtilities.js.map +1 -0
  154. package/lib/id-compressor/AppendOnlySortedMap.d.ts +52 -28
  155. package/lib/id-compressor/AppendOnlySortedMap.d.ts.map +1 -1
  156. package/lib/id-compressor/AppendOnlySortedMap.js +165 -88
  157. package/lib/id-compressor/AppendOnlySortedMap.js.map +1 -1
  158. package/lib/id-compressor/IdCompressor.d.ts +43 -42
  159. package/lib/id-compressor/IdCompressor.d.ts.map +1 -1
  160. package/lib/id-compressor/IdCompressor.js +97 -95
  161. package/lib/id-compressor/IdCompressor.js.map +1 -1
  162. package/lib/id-compressor/NumericUuid.d.ts +6 -14
  163. package/lib/id-compressor/NumericUuid.d.ts.map +1 -1
  164. package/lib/id-compressor/NumericUuid.js +11 -70
  165. package/lib/id-compressor/NumericUuid.js.map +1 -1
  166. package/lib/id-compressor/SessionIdNormalizer.d.ts +122 -0
  167. package/lib/id-compressor/SessionIdNormalizer.d.ts.map +1 -0
  168. package/lib/id-compressor/SessionIdNormalizer.js +414 -0
  169. package/lib/id-compressor/SessionIdNormalizer.js.map +1 -0
  170. package/lib/id-compressor/persisted-types/0.0.1.d.ts +6 -13
  171. package/lib/id-compressor/persisted-types/0.0.1.d.ts.map +1 -1
  172. package/lib/id-compressor/persisted-types/0.0.1.js.map +1 -1
  173. package/lib/index.d.ts +2 -2
  174. package/lib/index.d.ts.map +1 -1
  175. package/lib/index.js.map +1 -1
  176. package/lib/persisted-types/0.1.1.d.ts +1 -6
  177. package/lib/persisted-types/0.1.1.d.ts.map +1 -1
  178. package/lib/persisted-types/0.1.1.js.map +1 -1
  179. package/lib/test/AppendOnlySortedMap.perf.tests.d.ts +6 -0
  180. package/lib/test/AppendOnlySortedMap.perf.tests.d.ts.map +1 -0
  181. package/lib/test/AppendOnlySortedMap.perf.tests.js +49 -0
  182. package/lib/test/AppendOnlySortedMap.perf.tests.js.map +1 -0
  183. package/lib/test/AppendOnlySortedMap.tests.js +56 -14
  184. package/lib/test/AppendOnlySortedMap.tests.js.map +1 -1
  185. package/lib/test/Checkout.tests.js +2 -2
  186. package/lib/test/Checkout.tests.js.map +1 -1
  187. package/lib/test/Forest.tests.js.map +1 -1
  188. package/lib/test/IdCompressor.perf.tests.js +8 -2
  189. package/lib/test/IdCompressor.perf.tests.js.map +1 -1
  190. package/lib/test/IdCompressor.tests.js +75 -24
  191. package/lib/test/IdCompressor.tests.js.map +1 -1
  192. package/lib/test/LogViewer.tests.js +3 -5
  193. package/lib/test/LogViewer.tests.js.map +1 -1
  194. package/lib/test/NumericUuid.perf.tests.js +4 -4
  195. package/lib/test/NumericUuid.perf.tests.js.map +1 -1
  196. package/lib/test/NumericUuid.tests.js +5 -4
  197. package/lib/test/NumericUuid.tests.js.map +1 -1
  198. package/lib/test/RevisionValueCache.tests.js.map +1 -1
  199. package/lib/test/RevisionView.tests.js.map +1 -1
  200. package/lib/test/SessionIdNormalizer.tests.d.ts +6 -0
  201. package/lib/test/SessionIdNormalizer.tests.d.ts.map +1 -0
  202. package/lib/test/SessionIdNormalizer.tests.js +299 -0
  203. package/lib/test/SessionIdNormalizer.tests.js.map +1 -0
  204. package/lib/test/Summary.tests.js +1 -1
  205. package/lib/test/Summary.tests.js.map +1 -1
  206. package/lib/test/TreeCompression.tests.js +1 -1
  207. package/lib/test/TreeCompression.tests.js.map +1 -1
  208. package/lib/test/Virtualization.tests.js +1 -1
  209. package/lib/test/Virtualization.tests.js.map +1 -1
  210. package/lib/test/fuzz/Generators.d.ts +3 -14
  211. package/lib/test/fuzz/Generators.d.ts.map +1 -1
  212. package/lib/test/fuzz/Generators.js +60 -151
  213. package/lib/test/fuzz/Generators.js.map +1 -1
  214. package/lib/test/fuzz/SharedTreeFuzzTests.d.ts +10 -7
  215. package/lib/test/fuzz/SharedTreeFuzzTests.d.ts.map +1 -1
  216. package/lib/test/fuzz/SharedTreeFuzzTests.js +94 -104
  217. package/lib/test/fuzz/SharedTreeFuzzTests.js.map +1 -1
  218. package/lib/test/fuzz/Types.d.ts +2 -9
  219. package/lib/test/fuzz/Types.d.ts.map +1 -1
  220. package/lib/test/fuzz/Types.js +1 -1
  221. package/lib/test/fuzz/Types.js.map +1 -1
  222. package/lib/test/utilities/IdCompressorTestUtilities.d.ts +57 -11
  223. package/lib/test/utilities/IdCompressorTestUtilities.d.ts.map +1 -1
  224. package/lib/test/utilities/IdCompressorTestUtilities.js +112 -98
  225. package/lib/test/utilities/IdCompressorTestUtilities.js.map +1 -1
  226. package/lib/test/utilities/PendingLocalStateTests.d.ts.map +1 -1
  227. package/lib/test/utilities/PendingLocalStateTests.js +2 -1
  228. package/lib/test/utilities/PendingLocalStateTests.js.map +1 -1
  229. package/lib/test/utilities/SharedTreeTests.d.ts.map +1 -1
  230. package/lib/test/utilities/SharedTreeTests.js +30 -1
  231. package/lib/test/utilities/SharedTreeTests.js.map +1 -1
  232. package/lib/test/utilities/SharedTreeVersioningTests.d.ts.map +1 -1
  233. package/lib/test/utilities/SharedTreeVersioningTests.js +20 -0
  234. package/lib/test/utilities/SharedTreeVersioningTests.js.map +1 -1
  235. package/lib/test/utilities/SummaryLoadPerfTests.d.ts.map +1 -1
  236. package/lib/test/utilities/SummaryLoadPerfTests.js +6 -3
  237. package/lib/test/utilities/SummaryLoadPerfTests.js.map +1 -1
  238. package/lib/test/utilities/TestNode.js.map +1 -1
  239. package/lib/test/utilities/TestUtilities.d.ts +9 -1
  240. package/lib/test/utilities/TestUtilities.d.ts.map +1 -1
  241. package/lib/test/utilities/TestUtilities.js +27 -13
  242. package/lib/test/utilities/TestUtilities.js.map +1 -1
  243. package/package.json +19 -17
  244. package/src/Common.ts +42 -4
  245. package/src/EditLog.ts +1 -1
  246. package/src/Identifiers.ts +5 -0
  247. package/src/LogViewer.ts +4 -20
  248. package/src/RevisionValueCache.ts +11 -8
  249. package/src/SharedTree.ts +222 -75
  250. package/src/SharedTreeEncoder.ts +17 -11
  251. package/src/TreeCompressor.ts +2 -4
  252. package/src/UuidUtilities.ts +123 -0
  253. package/src/id-compressor/AppendOnlySortedMap.ts +183 -94
  254. package/src/id-compressor/IdCompressor.ts +144 -132
  255. package/src/id-compressor/NumericUuid.ts +11 -80
  256. package/src/id-compressor/SessionIdNormalizer.ts +497 -0
  257. package/src/id-compressor/persisted-types/0.0.1.ts +12 -15
  258. package/src/index.ts +5 -0
@@ -1 +1 @@
1
- {"version":3,"file":"RevisionValueCache.js","sourceRoot":"","sources":["../src/RevisionValueCache.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,gEAAiC;AACjC,0DAA4B;AAC5B,qCAA8D;AAY9D;;;;;;;;GAQG;AACH,MAAa,kBAAkB;IAqB9B;IACC;;OAEG;IACH,aAAqB;IACrB;;;OAGG;IACK,oBAA8B;IACtC;;OAEG;IACH,eAAsC;QAJ9B,yBAAoB,GAApB,oBAAoB,CAAU;QA7BvC;;;;WAIG;QACc,kBAAa,GAAG,IAAI,sBAAK,CAAmB,SAAS,EAAE,6BAAoB,CAAC,CAAC;QAU9F;;WAEG;QACc,sBAAiB,GAAG,IAAI,GAAG,EAAY,CAAC;QAiBxD,eAAM,CAAC,oBAAoB,IAAI,CAAC,EAAE,+CAA+C,CAAC,CAAC;QACnF,IAAI,CAAC,kBAAkB,GAAG,IAAI,mBAAG,CAAC;YACjC,GAAG,EAAE,aAAa;YAClB,cAAc,EAAE,IAAI;YACpB,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE;gBACrB,IAAI,QAAQ,IAAI,IAAI,CAAC,oBAAoB,EAAE;oBAC1C,aAAI,CAAC,sDAAsD,CAAC,CAAC;iBAC7D;gBACD,IAAI,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;oBACzC,aAAI,CAAC,wCAAwC,CAAC,CAAC;iBAC/C;gBACD,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACrC,CAAC;SACD,CAAC,CAAC;QACH,IAAI,eAAe,KAAK,SAAS,EAAE;YAClC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;SACzF;IACF,CAAC;IAED;;OAEG;IACI,uBAAuB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kB,CAAC,QAAkB,EAAE,KAAa;QAC1D,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACrC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACzC,CAAC;IAED;;;;;;OAMG;IACI,UAAU,CAAC,QAAkB,EAAE,KAAa;QAClD,IAAI,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YACzC,OAAO;SACP;QACD,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACxC,IAAI,QAAQ,GAAG,IAAI,CAAC,oBAAoB,EAAE;YACzC,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;SAC7C;IACF,CAAC;CACD;AA7HD,gDA6HC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport BTree from 'sorted-btree';\nimport LRU from 'lru-cache';\nimport { assert, fail, compareFiniteNumbers } from './Common';\n\n/**\n * A revision corresponds to an index in an `EditLog`.\n *\n * It is associated with the output `RevisionView` of applying the edit at the index to the previous revision.\n * For example:\n * - revision 0 corresponds to the initialRevision.\n * - revision 1 corresponds to the output of editLog[0] applied to the initialRevision.\n */\nexport type Revision = number;\n\n/**\n * A cache of `TValue`s corresponding to `Revision`s.\n *\n * A value is kept in cache if it meets any of the following criteria:\n * - The revision is >= `retentionWindowStart`\n * - The value has been used recently, meaning getClosestEntry or cacheValue was called with its revision. Note that being returned\n * \t\twhen a large revision was passed to getClosestEntry does not count.\n * - The value is `retained` meaning it was provided to to constructor in retainedEntries or passed to `cacheRetainedValue`\n */\nexport class RevisionValueCache<TValue> {\n\t/**\n\t * A cache of entries for revisions.\n\t * This is sorted to allow efficient access to the nearest preceding entry (see getClosestEntry).\n\t * Contains all cached values, regardless of why they are cached (retained, LRU or window).\n\t */\n\tprivate readonly sortedEntries = new BTree<Revision, TValue>(undefined, compareFiniteNumbers);\n\n\t/**\n\t * Cache of most recently used evictable entries.\n\t * Subset of 'sortedValues` eligible for eviction:\n\t * All entries are also in `sortedValues`, and are removed from `sortedValues` when evicted from this cache.\n\t * Evicts least recently used entries.\n\t */\n\tprivate readonly evictableRevisions: LRU<Revision, TValue>;\n\n\t/**\n\t * Set of all revisions that should never be evicted.\n\t */\n\tprivate readonly retainedRevisions = new Set<Revision>();\n\n\tpublic constructor(\n\t\t/**\n\t\t * Maximum capacity for evictable cache entries (those neither marked as retained nor within the retention window).\n\t\t */\n\t\tevictableSize: number,\n\t\t/**\n\t\t * The first revision within the retention window. All entries with revisions >= retentionWindowStart will be retained.\n\t\t * Must be >= 0.\n\t\t */\n\t\tprivate retentionWindowStart: Revision,\n\t\t/**\n\t\t * Optional list of entries to permanently retain.\n\t\t */\n\t\tretainedEntries?: [Revision, TValue][]\n\t) {\n\t\tassert(retentionWindowStart >= 0, 'retentionWindowStart must be initialized >= 0');\n\t\tthis.evictableRevisions = new LRU({\n\t\t\tmax: evictableSize,\n\t\t\tnoDisposeOnSet: true,\n\t\t\tdispose: (revision) => {\n\t\t\t\tif (revision >= this.retentionWindowStart) {\n\t\t\t\t\tfail('Entries in retention window should never be evicted.');\n\t\t\t\t}\n\t\t\t\tif (this.retainedRevisions.has(revision)) {\n\t\t\t\t\tfail('Retained entries should not be evicted');\n\t\t\t\t}\n\t\t\t\tthis.sortedEntries.delete(revision);\n\t\t\t},\n\t\t});\n\t\tif (retainedEntries !== undefined) {\n\t\t\tretainedEntries.forEach(([revision, entry]) => this.cacheRetainedValue(revision, entry));\n\t\t}\n\t}\n\n\t/**\n\t * @returns if the supplied revision is within the retention window.\n\t */\n\tpublic isWithinRetentionWindow(revision: Revision): boolean {\n\t\treturn revision >= this.retentionWindowStart;\n\t}\n\n\t/**\n\t * Sets the new retention window.\n\t * @param newRetentionWindowStart - defines the trailing edge (inclusive) of the new retention window.\n\t */\n\tpublic updateRetentionWindow(newRetentionWindowStart: Revision): void {\n\t\tif (newRetentionWindowStart < this.retentionWindowStart) {\n\t\t\tfail('retention window boundary must not move backwards');\n\t\t}\n\t\tconst prevRetentionWindowStart = this.retentionWindowStart;\n\t\tthis.retentionWindowStart = newRetentionWindowStart;\n\t\tconst oldWindowEntries: [Revision, TValue][] = [];\n\t\tthis.sortedEntries.forRange(\n\t\t\tprevRetentionWindowStart,\n\t\t\tthis.retentionWindowStart,\n\t\t\tfalse,\n\t\t\t(windowRevision, windowEntry) => {\n\t\t\t\tif (!this.retainedRevisions.has(windowRevision)) {\n\t\t\t\t\t// Adding to the LRU can cause eviction which in turn mutates the b-tree we are enumerating. Thus, store list of\n\t\t\t\t\t// old window entries separately.\n\t\t\t\t\toldWindowEntries.push([windowRevision, windowEntry]);\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\toldWindowEntries.forEach(([revision, value]) => {\n\t\t\tthis.evictableRevisions.set(revision, value);\n\t\t});\n\t}\n\n\t/**\n\t * @returns a [cachedRevision, value] where cachedRevision <= requestedRevision, or undefined if no such revision is cached.\n\t */\n\tpublic getClosestEntry(requestedRevision: Revision): [revision: Revision, value: TValue] | undefined {\n\t\tconst fromLRU = this.evictableRevisions.get(requestedRevision);\n\t\tif (fromLRU !== undefined) {\n\t\t\treturn [requestedRevision, fromLRU];\n\t\t}\n\t\treturn this.sortedEntries.getPairOrNextLower(requestedRevision) ?? undefined;\n\t}\n\n\t/**\n\t * Caches the supplied value and guarantees it will never be evicted.\n\t */\n\tpublic cacheRetainedValue(revision: Revision, value: TValue): void {\n\t\tthis.retainedRevisions.add(revision);\n\t\tthis.sortedEntries.set(revision, value);\n\t}\n\n\t/**\n\t * Caches the supplied value.\n\t * The cached value is subject to eviction unless it is within the retention window or was previously added\n\t * via `cacheRetainedValue`.\n\t * Note that if a non-retained entry starts out within the retention window and passes outside of it due to a call to\n\t * updateRetentionWindow it is then subject to eviction.\n\t */\n\tpublic cacheValue(revision: Revision, value: TValue): void {\n\t\tif (this.retainedRevisions.has(revision)) {\n\t\t\treturn;\n\t\t}\n\t\tthis.sortedEntries.set(revision, value);\n\t\tif (revision < this.retentionWindowStart) {\n\t\t\tthis.evictableRevisions.set(revision, value);\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"RevisionValueCache.js","sourceRoot":"","sources":["../src/RevisionValueCache.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,gEAAiC;AACjC,0DAA4B;AAC5B,qCAA8D;AAY9D;;;;;;;;;;GAUG;AACH,MAAa,kBAAkB;IAqB9B;IACC;;OAEG;IACH,aAAqB;IACrB;;;OAGG;IACK,oBAA8B;IACtC;;OAEG;IACH,eAAsC;QAJ9B,yBAAoB,GAApB,oBAAoB,CAAU;QA7BvC;;;;WAIG;QACc,kBAAa,GAAG,IAAI,sBAAK,CAAmB,SAAS,EAAE,6BAAoB,CAAC,CAAC;QAU9F;;WAEG;QACc,sBAAiB,GAAG,IAAI,GAAG,EAAY,CAAC;QAiBxD,IAAA,eAAM,EAAC,oBAAoB,IAAI,CAAC,EAAE,+CAA+C,CAAC,CAAC;QACnF,IAAI,CAAC,kBAAkB,GAAG,IAAI,mBAAG,CAAC;YACjC,GAAG,EAAE,aAAa;YAClB,cAAc,EAAE,IAAI;YACpB,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE;gBACrB,IAAI,QAAQ,IAAI,IAAI,CAAC,oBAAoB,EAAE;oBAC1C,IAAA,aAAI,EAAC,sDAAsD,CAAC,CAAC;iBAC7D;gBACD,IAAI,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;oBACzC,IAAA,aAAI,EAAC,wCAAwC,CAAC,CAAC;iBAC/C;gBACD,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACrC,CAAC;SACD,CAAC,CAAC;QACH,IAAI,eAAe,KAAK,SAAS,EAAE;YAClC,eAAe,CAAC,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AE;YAC1B,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;SACpC;QACD,OAAO,MAAA,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,mCAAI,SAAS,CAAC;IAC9E,CAAC;IAED;;OAEG;IACI,kBAAkB,CAAC,QAAkB,EAAE,KAAa;QAC1D,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACrC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACzC,CAAC;IAED;;;;;;OAMG;IACI,UAAU,CAAC,QAAkB,EAAE,KAAa;QAClD,IAAI,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YACzC,OAAO;SACP;QACD,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACxC,IAAI,QAAQ,GAAG,IAAI,CAAC,oBAAoB,EAAE;YACzC,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;SAC7C;IACF,CAAC;CACD;AA9HD,gDA8HC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport BTree from 'sorted-btree';\nimport LRU from 'lru-cache';\nimport { assert, fail, compareFiniteNumbers } from './Common';\n\n/**\n * A revision corresponds to an index in an `EditLog`.\n *\n * It is associated with the output `RevisionView` of applying the edit at the index to the previous revision.\n * For example:\n * - revision 0 corresponds to the initialRevision.\n * - revision 1 corresponds to the output of editLog[0] applied to the initialRevision.\n */\nexport type Revision = number;\n\n/**\n * A cache of `TValue`s corresponding to `Revision`s.\n *\n * A value is kept in cache if it meets any of the following criteria:\n *\n * - The revision is \\>= `retentionWindowStart`\n * - The value has been used recently, meaning getClosestEntry or cacheValue was called with its revision. Note that\n * being returned when a large revision was passed to getClosestEntry does not count.\n * - The value is `retained` meaning it was provided to to constructor in retainedEntries or passed to\n * `cacheRetainedValue`\n */\nexport class RevisionValueCache<TValue> {\n\t/**\n\t * A cache of entries for revisions.\n\t * This is sorted to allow efficient access to the nearest preceding entry (see getClosestEntry).\n\t * Contains all cached values, regardless of why they are cached (retained, LRU or window).\n\t */\n\tprivate readonly sortedEntries = new BTree<Revision, TValue>(undefined, compareFiniteNumbers);\n\n\t/**\n\t * Cache of most recently used evictable entries.\n\t * Subset of `sortedValues` eligible for eviction:\n\t * All entries are also in `sortedValues`, and are removed from `sortedValues` when evicted from this cache.\n\t * Evicts least recently used entries.\n\t */\n\tprivate readonly evictableRevisions: LRU<Revision, TValue>;\n\n\t/**\n\t * Set of all revisions that should never be evicted.\n\t */\n\tprivate readonly retainedRevisions = new Set<Revision>();\n\n\tpublic constructor(\n\t\t/**\n\t\t * Maximum capacity for evictable cache entries (those neither marked as retained nor within the retention window).\n\t\t */\n\t\tevictableSize: number,\n\t\t/**\n\t\t * The first revision within the retention window. All entries with revisions \\>= retentionWindowStart will be retained.\n\t\t * Must be \\>= 0.\n\t\t */\n\t\tprivate retentionWindowStart: Revision,\n\t\t/**\n\t\t * Optional list of entries to permanently retain.\n\t\t */\n\t\tretainedEntries?: [Revision, TValue][]\n\t) {\n\t\tassert(retentionWindowStart >= 0, 'retentionWindowStart must be initialized >= 0');\n\t\tthis.evictableRevisions = new LRU({\n\t\t\tmax: evictableSize,\n\t\t\tnoDisposeOnSet: true,\n\t\t\tdispose: (revision) => {\n\t\t\t\tif (revision >= this.retentionWindowStart) {\n\t\t\t\t\tfail('Entries in retention window should never be evicted.');\n\t\t\t\t}\n\t\t\t\tif (this.retainedRevisions.has(revision)) {\n\t\t\t\t\tfail('Retained entries should not be evicted');\n\t\t\t\t}\n\t\t\t\tthis.sortedEntries.delete(revision);\n\t\t\t},\n\t\t});\n\t\tif (retainedEntries !== undefined) {\n\t\t\tretainedEntries.forEach(([revision, entry]) => this.cacheRetainedValue(revision, entry));\n\t\t}\n\t}\n\n\t/**\n\t * @returns if the supplied revision is within the retention window.\n\t */\n\tpublic isWithinRetentionWindow(revision: Revision): boolean {\n\t\treturn revision >= this.retentionWindowStart;\n\t}\n\n\t/**\n\t * Sets the new retention window.\n\t * @param newRetentionWindowStart - defines the trailing edge (inclusive) of the new retention window.\n\t */\n\tpublic updateRetentionWindow(newRetentionWindowStart: Revision): void {\n\t\tif (newRetentionWindowStart < this.retentionWindowStart) {\n\t\t\tfail('retention window boundary must not move backwards');\n\t\t}\n\t\tconst prevRetentionWindowStart = this.retentionWindowStart;\n\t\tthis.retentionWindowStart = newRetentionWindowStart;\n\t\tconst oldWindowEntries: [Revision, TValue][] = [];\n\t\tthis.sortedEntries.forRange(\n\t\t\tprevRetentionWindowStart,\n\t\t\tthis.retentionWindowStart,\n\t\t\tfalse,\n\t\t\t(windowRevision, windowEntry) => {\n\t\t\t\tif (!this.retainedRevisions.has(windowRevision)) {\n\t\t\t\t\t// Adding to the LRU can cause eviction which in turn mutates the b-tree we are enumerating. Thus, store list of\n\t\t\t\t\t// old window entries separately.\n\t\t\t\t\toldWindowEntries.push([windowRevision, windowEntry]);\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\toldWindowEntries.forEach(([revision, value]) => {\n\t\t\tthis.evictableRevisions.set(revision, value);\n\t\t});\n\t}\n\n\t/**\n\t * @returns a [cachedRevision, value] where cachedRevision \\<= requestedRevision, or undefined if no such revision\n\t * is cached.\n\t */\n\tpublic getClosestEntry(requestedRevision: Revision): [revision: Revision, value: TValue] | undefined {\n\t\tconst fromLRU = this.evictableRevisions.get(requestedRevision);\n\t\tif (fromLRU !== undefined) {\n\t\t\treturn [requestedRevision, fromLRU];\n\t\t}\n\t\treturn this.sortedEntries.getPairOrNextLower(requestedRevision) ?? undefined;\n\t}\n\n\t/**\n\t * Caches the supplied value and guarantees it will never be evicted.\n\t */\n\tpublic cacheRetainedValue(revision: Revision, value: TValue): void {\n\t\tthis.retainedRevisions.add(revision);\n\t\tthis.sortedEntries.set(revision, value);\n\t}\n\n\t/**\n\t * Caches the supplied value.\n\t * The cached value is subject to eviction unless it is within the retention window or was previously added\n\t * via `cacheRetainedValue`.\n\t * Note that if a non-retained entry starts out within the retention window and passes outside of it due to a call to\n\t * updateRetentionWindow it is then subject to eviction.\n\t */\n\tpublic cacheValue(revision: Revision, value: TValue): void {\n\t\tif (this.retainedRevisions.has(revision)) {\n\t\t\treturn;\n\t\t}\n\t\tthis.sortedEntries.set(revision, value);\n\t\tif (revision < this.retentionWindowStart) {\n\t\t\tthis.evictableRevisions.set(revision, value);\n\t\t}\n\t}\n}\n"]}
@@ -22,7 +22,7 @@ class RevisionView extends TreeView_1.TreeView {
22
22
  definition: node.definition,
23
23
  identifier,
24
24
  };
25
- Common_1.copyPropertyIfDefined(node, viewNode, 'payload');
25
+ (0, Common_1.copyPropertyIfDefined)(node, viewNode, 'payload');
26
26
  return viewNode;
27
27
  });
28
28
  return new RevisionView(rootId, Forest_1.Forest.create(expensiveValidation).add(treeViewNodes));
@@ -33,7 +33,7 @@ class RevisionView extends TreeView_1.TreeView {
33
33
  definition: node.definition,
34
34
  identifier: node.identifier,
35
35
  };
36
- Common_1.copyPropertyIfDefined(node, viewNode, 'payload');
36
+ (0, Common_1.copyPropertyIfDefined)(node, viewNode, 'payload');
37
37
  return viewNode;
38
38
  })));
39
39
  }
@@ -125,10 +125,10 @@ function convertTreeNodesToViewNodes(root, convert) {
125
125
  const pendingNodes = [{ childIterator: iterateChildren(rootTraits)[Symbol.iterator](), newNode: convertedRoot }];
126
126
  const resultNodes = [];
127
127
  while (pendingNodes.length > 0) {
128
- const { childIterator, newNode } = (_a = pendingNodes[pendingNodes.length - 1]) !== null && _a !== void 0 ? _a : Common_1.fail('Undefined node');
128
+ const { childIterator, newNode } = (_a = pendingNodes[pendingNodes.length - 1]) !== null && _a !== void 0 ? _a : (0, Common_1.fail)('Undefined node');
129
129
  const { value, done } = childIterator.next();
130
130
  if (done === true) {
131
- resultNodes.push((_c = (_b = pendingNodes.pop()) === null || _b === void 0 ? void 0 : _b.newNode) !== null && _c !== void 0 ? _c : Common_1.fail('covertTreeNodesToViewNodes incorrectly coordinated parentage'));
131
+ resultNodes.push((_c = (_b = pendingNodes.pop()) === null || _b === void 0 ? void 0 : _b.newNode) !== null && _c !== void 0 ? _c : (0, Common_1.fail)('covertTreeNodesToViewNodes incorrectly coordinated parentage'));
132
132
  }
133
133
  else {
134
134
  const [traitLabel, child] = value;
@@ -1 +1 @@
1
- {"version":3,"file":"RevisionView.js","sourceRoot":"","sources":["../src/RevisionView.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qCAA4E;AAC5E,qCAAkC;AAIlC,yCAAkF;AAGlF;;;GAGG;AACH,MAAa,YAAa,SAAQ,mBAAQ;IAmBlC,MAAM,CAAC,QAAQ,CACrB,IAAO,EACP,gCAA4D,EAC5D,mBAAmB,GAAG,KAAK;QAE3B,IAAI,OAAO,gCAAgC,KAAK,QAAQ,EAAE;YACzD,MAAM,MAAM,GAAG,gCAAgC,CAAC,eAAe,CAAC,IAAI,CAAC,UAA0B,CAAC,CAAC;YAEjG,MAAM,aAAa,GAAG,2BAA2B,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE;gBAChE,MAAM,UAAU,GAAG,gCAAgC,CAAC,eAAe,CAAC,IAAI,CAAC,UAA0B,CAAC,CAAC;gBACrG,MAAM,QAAQ,GAAG;oBAChB,UAAU,EAAE,IAAI,CAAC,UAAU;oBAC3B,UAAU;iBACV,CAAC;gBACF,8BAAqB,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;gBACjD,OAAO,QAAQ,CAAC;YACjB,CAAC,CAAC,CAAC;YAEH,OAAO,IAAI,YAAY,CAAC,MAAM,EAAE,eAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;SACvF;aAAM;YACN,OAAO,IAAI,YAAY,CACtB,IAAI,CAAC,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EAAE;wBAC1B,MAAM,CAAC,KAAmB,EAAE,KAAK,CAAC,CAAC;qBACnC;iBACD;qBAAM;oBACN,MAAM,CAAC,KAAmB,EAAE,KAAK,CAAC,CAAC;iBACnC;aACD;SACD;KACD;AACF,CAAC;AAdD,0CAcC;AAED,SAAS,kBAAkB,CAAS,QAA2C;IAC9E,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAChC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { copyPropertyIfDefined, fail, Mutable, MutableMap } from './Common';\nimport { Forest } from './Forest';\nimport { NodeId, StableNodeId, TraitLabel } from './Identifiers';\nimport { NodeIdConverter } from './NodeIdUtilities';\nimport { Payload, TreeNode, TreeNodeSequence } from './persisted-types';\nimport { TreeView, TreeViewNode, TreeViewPlace, TreeViewRange } from './TreeView';\nimport { HasVariadicTraits } from './ChangeTypes';\n\n/**\n * An immutable view of a distributed tree.\n * @public\n */\nexport class RevisionView extends TreeView {\n\t/**\n\t * Constructs a {@link RevisionView} using the supplied tree.\n\t * @param root - the root of the tree to use as the contents of the {@link RevisionView}\n\t * @param expensiveValidation - whether or not to perform additional validation, e.g. to catch errors when testing\n\t */\n\tpublic static fromTree<T extends TreeNode<T, NodeId>>(root: T, expensiveValidation?: boolean): RevisionView;\n\t/**\n\t * Constructs a {@link RevisionView} using the supplied tree.\n\t * @param root - the root of the tree to use as the contents of the `RevisionView`\n\t * @param idConverter - the {@link NodeIdConverter} that will recompress the IDs the in the tree\n\t * @param expensiveValidation - whether or not to perform additional validation, e.g. to catch errors when testing\n\t */\n\tpublic static fromTree<T extends TreeNode<T, StableNodeId>>(\n\t\troot: T,\n\t\tidConverter: NodeIdConverter,\n\t\texpensiveValidation?: boolean\n\t): RevisionView;\n\n\tpublic static fromTree<T extends TreeNode<T, NodeId> | TreeNode<T, StableNodeId>>(\n\t\troot: T,\n\t\tidConverterOrExpensiveValidation?: NodeIdConverter | boolean,\n\t\texpensiveValidation = false\n\t): RevisionView {\n\t\tif (typeof idConverterOrExpensiveValidation === 'object') {\n\t\t\tconst rootId = idConverterOrExpensiveValidation.convertToNodeId(root.identifier as StableNodeId);\n\n\t\t\tconst treeViewNodes = convertTreeNodesToViewNodes(root, (node) => {\n\t\t\t\tconst identifier = idConverterOrExpensiveValidation.convertToNodeId(node.identifier as StableNodeId);\n\t\t\t\tconst viewNode = {\n\t\t\t\t\tdefinition: node.definition,\n\t\t\t\t\tidentifier,\n\t\t\t\t};\n\t\t\t\tcopyPropertyIfDefined(node, viewNode, 'payload');\n\t\t\t\treturn viewNode;\n\t\t\t});\n\n\t\t\treturn new RevisionView(rootId, Forest.create(expensiveValidation).add(treeViewNodes));\n\t\t} else {\n\t\t\treturn new RevisionView(\n\t\t\t\troot.identifier as NodeId,\n\t\t\t\tForest.create(expensiveValidation).add(\n\t\t\t\t\tconvertTreeNodesToViewNodes(root, (node) => {\n\t\t\t\t\t\tconst viewNode = {\n\t\t\t\t\t\t\tdefinition: node.definition,\n\t\t\t\t\t\t\tidentifier: node.identifier as NodeId,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tcopyPropertyIfDefined(node, viewNode, 'payload');\n\t\t\t\t\t\treturn viewNode;\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}\n\n\t/** Begin a transaction by generating a mutable `TransactionView` from this view */\n\tpublic openForTransaction(): TransactionView {\n\t\treturn new TransactionView(this.root, this.forest);\n\t}\n\n\tpublic equals(view: TreeView): boolean {\n\t\tif (!(view instanceof RevisionView)) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn this.hasEqualForest(view);\n\t}\n}\n\n/**\n * An view of a distributed tree that is part of an ongoing transaction between `RevisionView`s.\n * @public\n */\nexport class TransactionView extends TreeView {\n\t/** Conclude a transaction by generating an immutable `RevisionView` from this view */\n\tpublic close(): RevisionView {\n\t\treturn new RevisionView(this.root, this.forest);\n\t}\n\n\t/** Inserts all nodes in a NodeSequence into the view */\n\tpublic addNodes(sequence: Iterable<TreeViewNode>): TransactionView {\n\t\treturn new TransactionView(this.root, this.forest.add(sequence));\n\t}\n\n\t/** Remove all nodes with the given ids from the view */\n\tpublic deleteNodes(nodes: Iterable<NodeId>): TransactionView {\n\t\treturn new TransactionView(this.root, this.forest.delete(nodes, true));\n\t}\n\n\t/**\n\t * Parents a set of detached nodes at a specified place.\n\t * @param nodesToAttach - the nodes to parent in the specified place. The nodes must already be present in the view.\n\t * @param place - the location to insert the nodes.\n\t */\n\tpublic attachRange(nodesToAttach: readonly NodeId[], place: TreeViewPlace): TransactionView {\n\t\tconst { parent, label } = place.trait;\n\t\tconst index = this.findIndexWithinTrait(place);\n\t\treturn new TransactionView(this.root, this.forest.attachRangeOfChildren(parent, label, index, nodesToAttach));\n\t}\n\n\t/**\n\t * Detaches a range of nodes from their parent. The detached nodes remain in the view.\n\t * @param rangeToDetach - the range of nodes to detach\n\t */\n\tpublic detachRange(rangeToDetach: TreeViewRange): { view: TransactionView; detached: readonly NodeId[] } {\n\t\tconst { start, end } = rangeToDetach;\n\t\tconst { trait: traitLocation } = start;\n\t\tconst { parent, label } = traitLocation;\n\t\tconst startIndex = this.findIndexWithinTrait(start);\n\t\tconst endIndex = this.findIndexWithinTrait(end);\n\t\tconst { forest, detached } = this.forest.detachRangeOfChildren(parent, label, startIndex, endIndex);\n\t\treturn { view: new TransactionView(this.root, forest), detached };\n\t}\n\n\t/**\n\t * Sets or overwrites a node's value. The node must exist in this view.\n\t * @param nodeId - the id of the node\n\t * @param value - the new value\n\t */\n\tpublic setNodeValue(nodeId: NodeId, value: Payload): TransactionView {\n\t\treturn new TransactionView(this.root, this.forest.setValue(nodeId, value));\n\t}\n\n\tpublic equals(view: TreeView): boolean {\n\t\tif (!(view instanceof TransactionView)) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn this.hasEqualForest(view);\n\t}\n}\n\n/**\n * Transform an input tree into a list of {@link TreeViewNode}s.\n * @param tree - the input tree\n * @param convert - a conversion function that will run on each node in the input tree to produce the output nodes.\n * Returning undefined means that conversion for the given node was impossible, at which time the entire tree conversion will be aborted\n * and return undefined.\n */\nexport function convertTreeNodesToViewNodes<\n\tTIn extends HasVariadicTraits<TIn>,\n\tTOut extends TreeViewNode = TreeViewNode\n>(root: TIn, convert: (node: TIn) => Omit<TOut, 'traits'>): TOut[];\n\n/**\n * Transform an input tree into a list of {@link TreeViewNode}s.\n * @param tree - the input tree\n * @param convert - a conversion function that will run on each node in the input tree to produce the output nodes.\n */\nexport function convertTreeNodesToViewNodes<\n\tTIn extends HasVariadicTraits<TIn>,\n\tTOut extends TreeViewNode = TreeViewNode\n>(root: TIn, convert: (node: TIn) => Omit<TOut, 'traits'> | undefined): TOut[] | undefined;\n\n/**\n * Transform an input tree into a list of {@link TreeViewNode}s.\n * @param tree - the input tree\n * @param convert - a conversion function that will run on each node in the input tree to produce the output nodes.\n * Returning undefined means that conversion for the given node was impossible, at which time the entire tree conversion will be aborted\n * and return undefined.\n */\nexport function convertTreeNodesToViewNodes<\n\tTIn extends HasVariadicTraits<TIn>,\n\tTOut extends TreeViewNode = TreeViewNode\n>(root: TIn, convert: (node: TIn) => Omit<TOut, 'traits'> | undefined): TOut[] | undefined {\n\tconst convertedRoot = convert(root) as Mutable<TOut>;\n\tif (convertedRoot === undefined || root.traits === undefined) {\n\t\treturn undefined;\n\t}\n\t// `convertedRoot` might be the same as `root`, in which case stash the children of `root` before wiping them from `convertedRoot`\n\tconst rootTraits = (root as unknown as TOut) === convertedRoot ? { traits: root.traits } : root;\n\tconvertedRoot.traits = new Map();\n\tconst pendingNodes: {\n\t\tchildIterator: Iterator<[TraitLabel, TIn]>;\n\t\tnewNode: Mutable<TOut>;\n\t}[] = [{ childIterator: iterateChildren(rootTraits)[Symbol.iterator](), newNode: convertedRoot }];\n\tconst resultNodes: TOut[] = [];\n\n\twhile (pendingNodes.length > 0) {\n\t\tconst { childIterator, newNode } = pendingNodes[pendingNodes.length - 1] ?? fail('Undefined node');\n\t\tconst { value, done } = childIterator.next();\n\t\tif (done === true) {\n\t\t\tresultNodes.push(\n\t\t\t\tpendingNodes.pop()?.newNode ?? fail('covertTreeNodesToViewNodes incorrectly coordinated parentage')\n\t\t\t);\n\t\t} else {\n\t\t\tconst [traitLabel, child] = value as [TraitLabel, TIn];\n\t\t\tconst convertedChild = convert(child) as TOut;\n\t\t\tif (convertedChild === undefined) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tif (child.traits !== undefined) {\n\t\t\t\tconst childTraits = (child as unknown as TOut) === convertedChild ? { traits: child.traits } : child;\n\t\t\t\t(convertedChild as Mutable<TOut>).traits = new Map();\n\t\t\t\tpendingNodes.push({\n\t\t\t\t\tchildIterator: iterateChildren(childTraits)[Symbol.iterator](),\n\t\t\t\t\tnewNode: convertedChild,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst newTraits = newNode.traits as MutableMap<TOut['traits']>;\n\t\t\tlet newTrait = newTraits.get(traitLabel);\n\t\t\tif (newTrait === undefined) {\n\t\t\t\tnewTrait = [];\n\t\t\t\tnewTraits.set(traitLabel, newTrait);\n\t\t\t}\n\t\t\t(newTrait as NodeId[]).push(convertedChild.identifier);\n\t\t}\n\t}\n\n\treturn resultNodes;\n}\n\n/**\n * Returns an iterable of the supplied node's traits in a stable order.\n */\nexport function* iterateChildren<T>(hasTraits: HasVariadicTraits<T>): Iterable<[TraitLabel, T]> {\n\tif (hasTraits.traits !== undefined) {\n\t\tfor (const [label, trait] of Object.entries(hasTraits.traits).sort()) {\n\t\t\tif (trait !== undefined) {\n\t\t\t\tif (isTreeNodeSequence(trait)) {\n\t\t\t\t\tfor (const child of trait) {\n\t\t\t\t\t\tyield [label as TraitLabel, child];\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tyield [label as TraitLabel, trait];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction isTreeNodeSequence<TChild>(sequence: TreeNodeSequence<TChild> | TChild): sequence is TreeNodeSequence<TChild> {\n\treturn Array.isArray(sequence);\n}\n"]}
1
+ {"version":3,"file":"RevisionView.js","sourceRoot":"","sources":["../src/RevisionView.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qCAA4E;AAC5E,qCAAkC;AAIlC,yCAAkF;AAGlF;;;GAGG;AACH,MAAa,YAAa,SAAQ,mBAAQ;IAmBlC,MAAM,CAAC,QAAQ,CACrB,IAAO,EACP,gCAA4D,EAC5D,mBAAmB,GAAG,KAAK;QAE3B,IAAI,OAAO,gCAAgC,KAAK,QAAQ,EAAE;YACzD,MAAM,MAAM,GAAG,gCAAgC,CAAC,eAAe,CAAC,IAAI,CAAC,UAA0B,CAAC,CAAC;YAEjG,MAAM,aAAa,GAAG,2BAA2B,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE;gBAChE,MAAM,UAAU,GAAG,gCAAgC,CAAC,eAAe,CAAC,IAAI,CAAC,UAA0B,CAAC,CAAC;gBACrG,MAAM,QAAQ,GAAG;oBAChB,UAAU,EAAE,IAAI,CAAC,UAAU;oBAC3B,UAAU;iBACV,CAAC;gBACF,IAAA,8BAAqB,EAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;gBACjD,OAAO,QAAQ,CAAC;YACjB,CAAC,CAAC,CAAC;YAEH,OAAO,IAAI,YAAY,CAAC,MAAM,EAAE,eAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;SACvF;aAAM;YACN,OAAO,IAAI,YAAY,CACtB,IAAI,CAAC,UAAoB,EACzB,eAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,GAAG,CACrC,2BAA2B,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE;gBAC1C,MAAM,QAAQ,GAAG;oBAChB,UAAU,EAAE,IAAI,CAAC,UAAU;oBAC3B,UAAU,EAAE,IAAI,CAAC,UAAoB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AkB,CAAS,QAA2C;IAC9E,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAChC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { copyPropertyIfDefined, fail, Mutable, MutableMap } from './Common';\nimport { Forest } from './Forest';\nimport { NodeId, StableNodeId, TraitLabel } from './Identifiers';\nimport { NodeIdConverter } from './NodeIdUtilities';\nimport { Payload, TreeNode, TreeNodeSequence } from './persisted-types';\nimport { TreeView, TreeViewNode, TreeViewPlace, TreeViewRange } from './TreeView';\nimport { HasVariadicTraits } from './ChangeTypes';\n\n/**\n * An immutable view of a distributed tree.\n * @public\n */\nexport class RevisionView extends TreeView {\n\t/**\n\t * Constructs a {@link RevisionView} using the supplied tree.\n\t * @param root - the root of the tree to use as the contents of the {@link RevisionView}\n\t * @param expensiveValidation - whether or not to perform additional validation, e.g. to catch errors when testing\n\t */\n\tpublic static fromTree<T extends TreeNode<T, NodeId>>(root: T, expensiveValidation?: boolean): RevisionView;\n\t/**\n\t * Constructs a {@link RevisionView} using the supplied tree.\n\t * @param root - the root of the tree to use as the contents of the `RevisionView`\n\t * @param idConverter - the {@link NodeIdConverter} that will recompress the IDs the in the tree\n\t * @param expensiveValidation - whether or not to perform additional validation, e.g. to catch errors when testing\n\t */\n\tpublic static fromTree<T extends TreeNode<T, StableNodeId>>(\n\t\troot: T,\n\t\tidConverter: NodeIdConverter,\n\t\texpensiveValidation?: boolean\n\t): RevisionView;\n\n\tpublic static fromTree<T extends TreeNode<T, NodeId> | TreeNode<T, StableNodeId>>(\n\t\troot: T,\n\t\tidConverterOrExpensiveValidation?: NodeIdConverter | boolean,\n\t\texpensiveValidation = false\n\t): RevisionView {\n\t\tif (typeof idConverterOrExpensiveValidation === 'object') {\n\t\t\tconst rootId = idConverterOrExpensiveValidation.convertToNodeId(root.identifier as StableNodeId);\n\n\t\t\tconst treeViewNodes = convertTreeNodesToViewNodes(root, (node) => {\n\t\t\t\tconst identifier = idConverterOrExpensiveValidation.convertToNodeId(node.identifier as StableNodeId);\n\t\t\t\tconst viewNode = {\n\t\t\t\t\tdefinition: node.definition,\n\t\t\t\t\tidentifier,\n\t\t\t\t};\n\t\t\t\tcopyPropertyIfDefined(node, viewNode, 'payload');\n\t\t\t\treturn viewNode;\n\t\t\t});\n\n\t\t\treturn new RevisionView(rootId, Forest.create(expensiveValidation).add(treeViewNodes));\n\t\t} else {\n\t\t\treturn new RevisionView(\n\t\t\t\troot.identifier as NodeId,\n\t\t\t\tForest.create(expensiveValidation).add(\n\t\t\t\t\tconvertTreeNodesToViewNodes(root, (node) => {\n\t\t\t\t\t\tconst viewNode = {\n\t\t\t\t\t\t\tdefinition: node.definition,\n\t\t\t\t\t\t\tidentifier: node.identifier as NodeId,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tcopyPropertyIfDefined(node, viewNode, 'payload');\n\t\t\t\t\t\treturn viewNode;\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}\n\n\t/** Begin a transaction by generating a mutable `TransactionView` from this view */\n\tpublic openForTransaction(): TransactionView {\n\t\treturn new TransactionView(this.root, this.forest);\n\t}\n\n\tpublic equals(view: TreeView): boolean {\n\t\tif (!(view instanceof RevisionView)) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn this.hasEqualForest(view);\n\t}\n}\n\n/**\n * An view of a distributed tree that is part of an ongoing transaction between `RevisionView`s.\n * @public\n */\nexport class TransactionView extends TreeView {\n\t/** Conclude a transaction by generating an immutable `RevisionView` from this view */\n\tpublic close(): RevisionView {\n\t\treturn new RevisionView(this.root, this.forest);\n\t}\n\n\t/** Inserts all nodes in a NodeSequence into the view */\n\tpublic addNodes(sequence: Iterable<TreeViewNode>): TransactionView {\n\t\treturn new TransactionView(this.root, this.forest.add(sequence));\n\t}\n\n\t/** Remove all nodes with the given ids from the view */\n\tpublic deleteNodes(nodes: Iterable<NodeId>): TransactionView {\n\t\treturn new TransactionView(this.root, this.forest.delete(nodes, true));\n\t}\n\n\t/**\n\t * Parents a set of detached nodes at a specified place.\n\t * @param nodesToAttach - the nodes to parent in the specified place. The nodes must already be present in the view.\n\t * @param place - the location to insert the nodes.\n\t */\n\tpublic attachRange(nodesToAttach: readonly NodeId[], place: TreeViewPlace): TransactionView {\n\t\tconst { parent, label } = place.trait;\n\t\tconst index = this.findIndexWithinTrait(place);\n\t\treturn new TransactionView(this.root, this.forest.attachRangeOfChildren(parent, label, index, nodesToAttach));\n\t}\n\n\t/**\n\t * Detaches a range of nodes from their parent. The detached nodes remain in the view.\n\t * @param rangeToDetach - the range of nodes to detach\n\t */\n\tpublic detachRange(rangeToDetach: TreeViewRange): { view: TransactionView; detached: readonly NodeId[] } {\n\t\tconst { start, end } = rangeToDetach;\n\t\tconst { trait: traitLocation } = start;\n\t\tconst { parent, label } = traitLocation;\n\t\tconst startIndex = this.findIndexWithinTrait(start);\n\t\tconst endIndex = this.findIndexWithinTrait(end);\n\t\tconst { forest, detached } = this.forest.detachRangeOfChildren(parent, label, startIndex, endIndex);\n\t\treturn { view: new TransactionView(this.root, forest), detached };\n\t}\n\n\t/**\n\t * Sets or overwrites a node's value. The node must exist in this view.\n\t * @param nodeId - the id of the node\n\t * @param value - the new value\n\t */\n\tpublic setNodeValue(nodeId: NodeId, value: Payload): TransactionView {\n\t\treturn new TransactionView(this.root, this.forest.setValue(nodeId, value));\n\t}\n\n\tpublic equals(view: TreeView): boolean {\n\t\tif (!(view instanceof TransactionView)) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn this.hasEqualForest(view);\n\t}\n}\n\n/**\n * Transform an input tree into a list of {@link TreeViewNode}s.\n * @param tree - the input tree\n * @param convert - a conversion function that will run on each node in the input tree to produce the output nodes.\n * Returning undefined means that conversion for the given node was impossible, at which time the entire tree conversion will be aborted\n * and return undefined.\n */\nexport function convertTreeNodesToViewNodes<\n\tTIn extends HasVariadicTraits<TIn>,\n\tTOut extends TreeViewNode = TreeViewNode\n>(root: TIn, convert: (node: TIn) => Omit<TOut, 'traits'>): TOut[];\n\n/**\n * Transform an input tree into a list of {@link TreeViewNode}s.\n * @param tree - the input tree\n * @param convert - a conversion function that will run on each node in the input tree to produce the output nodes.\n */\nexport function convertTreeNodesToViewNodes<\n\tTIn extends HasVariadicTraits<TIn>,\n\tTOut extends TreeViewNode = TreeViewNode\n>(root: TIn, convert: (node: TIn) => Omit<TOut, 'traits'> | undefined): TOut[] | undefined;\n\n/**\n * Transform an input tree into a list of {@link TreeViewNode}s.\n * @param tree - the input tree\n * @param convert - a conversion function that will run on each node in the input tree to produce the output nodes.\n * Returning undefined means that conversion for the given node was impossible, at which time the entire tree conversion will be aborted\n * and return undefined.\n */\nexport function convertTreeNodesToViewNodes<\n\tTIn extends HasVariadicTraits<TIn>,\n\tTOut extends TreeViewNode = TreeViewNode\n>(root: TIn, convert: (node: TIn) => Omit<TOut, 'traits'> | undefined): TOut[] | undefined {\n\tconst convertedRoot = convert(root) as Mutable<TOut>;\n\tif (convertedRoot === undefined || root.traits === undefined) {\n\t\treturn undefined;\n\t}\n\t// `convertedRoot` might be the same as `root`, in which case stash the children of `root` before wiping them from `convertedRoot`\n\tconst rootTraits = (root as unknown as TOut) === convertedRoot ? { traits: root.traits } : root;\n\tconvertedRoot.traits = new Map();\n\tconst pendingNodes: {\n\t\tchildIterator: Iterator<[TraitLabel, TIn]>;\n\t\tnewNode: Mutable<TOut>;\n\t}[] = [{ childIterator: iterateChildren(rootTraits)[Symbol.iterator](), newNode: convertedRoot }];\n\tconst resultNodes: TOut[] = [];\n\n\twhile (pendingNodes.length > 0) {\n\t\tconst { childIterator, newNode } = pendingNodes[pendingNodes.length - 1] ?? fail('Undefined node');\n\t\tconst { value, done } = childIterator.next();\n\t\tif (done === true) {\n\t\t\tresultNodes.push(\n\t\t\t\tpendingNodes.pop()?.newNode ?? fail('covertTreeNodesToViewNodes incorrectly coordinated parentage')\n\t\t\t);\n\t\t} else {\n\t\t\tconst [traitLabel, child] = value as [TraitLabel, TIn];\n\t\t\tconst convertedChild = convert(child) as TOut;\n\t\t\tif (convertedChild === undefined) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tif (child.traits !== undefined) {\n\t\t\t\tconst childTraits = (child as unknown as TOut) === convertedChild ? { traits: child.traits } : child;\n\t\t\t\t(convertedChild as Mutable<TOut>).traits = new Map();\n\t\t\t\tpendingNodes.push({\n\t\t\t\t\tchildIterator: iterateChildren(childTraits)[Symbol.iterator](),\n\t\t\t\t\tnewNode: convertedChild,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst newTraits = newNode.traits as MutableMap<TOut['traits']>;\n\t\t\tlet newTrait = newTraits.get(traitLabel);\n\t\t\tif (newTrait === undefined) {\n\t\t\t\tnewTrait = [];\n\t\t\t\tnewTraits.set(traitLabel, newTrait);\n\t\t\t}\n\t\t\t(newTrait as NodeId[]).push(convertedChild.identifier);\n\t\t}\n\t}\n\n\treturn resultNodes;\n}\n\n/**\n * Returns an iterable of the supplied node's traits in a stable order.\n */\nexport function* iterateChildren<T>(hasTraits: HasVariadicTraits<T>): Iterable<[TraitLabel, T]> {\n\tif (hasTraits.traits !== undefined) {\n\t\tfor (const [label, trait] of Object.entries(hasTraits.traits).sort()) {\n\t\t\tif (trait !== undefined) {\n\t\t\t\tif (isTreeNodeSequence(trait)) {\n\t\t\t\t\tfor (const child of trait) {\n\t\t\t\t\t\tyield [label as TraitLabel, child];\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tyield [label as TraitLabel, trait];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction isTreeNodeSequence<TChild>(sequence: TreeNodeSequence<TChild> | TChild): sequence is TreeNodeSequence<TChild> {\n\treturn Array.isArray(sequence);\n}\n"]}
@@ -27,10 +27,10 @@ function getChangeNodeFromViewNode(view, id, lazyTraits = false) {
27
27
  definition: node.definition,
28
28
  identifier: node.identifier,
29
29
  };
30
- Common_1.copyPropertyIfDefined(node, nodeData, 'payload');
30
+ (0, Common_1.copyPropertyIfDefined)(node, nodeData, 'payload');
31
31
  if (lazyTraits) {
32
32
  return Object.assign(Object.assign({}, nodeData), { get traits() {
33
- return Common_1.memoizeGetter(this, 'traits', makeTraits(view, node.traits, lazyTraits));
33
+ return (0, Common_1.memoizeGetter)(this, 'traits', makeTraits(view, node.traits, lazyTraits));
34
34
  } });
35
35
  }
36
36
  return Object.assign(Object.assign({}, nodeData), { traits: makeTraits(view, node.traits, lazyTraits) });
@@ -44,7 +44,7 @@ function makeTraits(view, traits, lazyTraits = false) {
44
44
  Object.defineProperty(traitMap, label, {
45
45
  get() {
46
46
  const treeNodeTrait = trait.map((id) => getChangeNodeFromViewNode(view, id, lazyTraits));
47
- return Common_1.memoizeGetter(this, label, treeNodeTrait);
47
+ return (0, Common_1.memoizeGetter)(this, label, treeNodeTrait);
48
48
  },
49
49
  configurable: true,
50
50
  enumerable: true,
@@ -81,7 +81,7 @@ function getChangeNode_0_0_2FromViewNode(view, id, idConverter) {
81
81
  definition: node.definition,
82
82
  identifier: idConverter.convertToStableNodeId(node.identifier),
83
83
  };
84
- Common_1.copyPropertyIfDefined(node, nodeData, 'payload');
84
+ (0, Common_1.copyPropertyIfDefined)(node, nodeData, 'payload');
85
85
  return Object.assign(Object.assign({}, nodeData), { traits: makeTraits_0_0_2(view, node.traits, idConverter) });
86
86
  }
87
87
  exports.getChangeNode_0_0_2FromViewNode = getChangeNode_0_0_2FromViewNode;
@@ -1 +1 @@
1
- {"version":3,"file":"SerializationUtilities.js","sourceRoot":"","sources":["../src/SerializationUtilities.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qCAAgE;AAMhE;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,IAAc;IACnD,OAAO,yBAAyB,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;AACnD,CAAC;AAFD,sDAEC;AAED;;;;;;GAMG;AACH,SAAgB,yBAAyB,CAAC,IAA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AI,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC;YAChF,UAAU,EAAE,IAAI;SAChB,CAAC,CAAC;KACH;IAED,OAAO,QAAQ,CAAC;AACjB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { copyPropertyIfDefined, memoizeGetter } from './Common';\nimport { NodeId, TraitLabel } from './Identifiers';\nimport { NodeIdConverter } from './NodeIdUtilities';\nimport { ChangeNode, ChangeNode_0_0_2, TraitMap } from './persisted-types';\nimport { TreeView } from './TreeView';\n\n/**\n * Converts this tree view to an equivalent `ChangeNode`.\n * @param view - the view to convert\n */\nexport function getChangeNodeFromView(view: TreeView): ChangeNode {\n\treturn getChangeNodeFromViewNode(view, view.root);\n}\n\n/**\n * Converts a node in this tree view to an equivalent `ChangeNode`.\n * @param view - the view of the tree that contains the node to convert\n * @param id - the id of the node to convert\n * @param lazyTraits - whether or not traits should be populated lazily. If true, the subtrees under each trait will not be read until\n * the trait is first accessed.\n */\nexport function getChangeNodeFromViewNode(view: TreeView, id: NodeId, lazyTraits = false): ChangeNode {\n\tconst node = view.getViewNode(id);\n\tconst nodeData = {\n\t\tdefinition: node.definition,\n\t\tidentifier: node.identifier,\n\t};\n\tcopyPropertyIfDefined(node, nodeData, 'payload');\n\n\tif (lazyTraits) {\n\t\treturn {\n\t\t\t...nodeData,\n\t\t\tget traits() {\n\t\t\t\treturn memoizeGetter(this, 'traits', makeTraits(view, node.traits, lazyTraits));\n\t\t\t},\n\t\t};\n\t}\n\n\treturn {\n\t\t...nodeData,\n\t\ttraits: makeTraits(view, node.traits, lazyTraits),\n\t};\n}\n\n/** Given the traits of a TreeViewNode, return the corresponding traits on a Node */\nfunction makeTraits(\n\tview: TreeView,\n\ttraits: ReadonlyMap<TraitLabel, readonly NodeId[]>,\n\tlazyTraits = false\n): TraitMap<ChangeNode> {\n\tconst traitMap = {};\n\tfor (const [label, trait] of traits.entries()) {\n\t\tif (lazyTraits) {\n\t\t\tObject.defineProperty(traitMap, label, {\n\t\t\t\tget() {\n\t\t\t\t\tconst treeNodeTrait = trait.map((id) => getChangeNodeFromViewNode(view, id, lazyTraits));\n\t\t\t\t\treturn memoizeGetter(this as TraitMap<ChangeNode>, label, treeNodeTrait);\n\t\t\t\t},\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t});\n\t\t} else {\n\t\t\tObject.defineProperty(traitMap, label, {\n\t\t\t\tvalue: trait.map((id) => getChangeNodeFromViewNode(view, id, lazyTraits)),\n\t\t\t\tenumerable: true,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn traitMap;\n}\n\n/**\n * Converts this tree view to an equivalent `ChangeNode`.\n * @param view - the view to convert\n */\nexport function getChangeNode_0_0_2FromView(view: TreeView, idConverter: NodeIdConverter): ChangeNode_0_0_2 {\n\treturn getChangeNode_0_0_2FromViewNode(view, view.root, idConverter);\n}\n\n/**\n * Converts a node in this tree view to an equivalent `ChangeNode`.\n * @param view - the view of the tree that contains the node to convert\n * @param id - the id of the node to convert\n * @param lazyTraits - whether or not traits should be populated lazily. If true, the subtrees under each trait will not be read until\n * the trait is first accessed.\n * @deprecated Remove by March 2022\n */\nexport function getChangeNode_0_0_2FromViewNode(\n\tview: TreeView,\n\tid: NodeId,\n\tidConverter: NodeIdConverter\n): ChangeNode_0_0_2 {\n\tconst node = view.getViewNode(id);\n\tconst nodeData = {\n\t\tdefinition: node.definition,\n\t\tidentifier: idConverter.convertToStableNodeId(node.identifier),\n\t};\n\tcopyPropertyIfDefined(node, nodeData, 'payload');\n\n\treturn {\n\t\t...nodeData,\n\t\ttraits: makeTraits_0_0_2(view, node.traits, idConverter),\n\t};\n}\n\n/**\n * Given the traits of a TreeViewNode, return the corresponding traits on a Node\n * @deprecated Remove by march 2022\n */\nfunction makeTraits_0_0_2(\n\tview: TreeView,\n\ttraits: ReadonlyMap<TraitLabel, readonly NodeId[]>,\n\tidConverter: NodeIdConverter\n): TraitMap<ChangeNode_0_0_2> {\n\tconst traitMap = {};\n\tfor (const [label, trait] of traits.entries()) {\n\t\tObject.defineProperty(traitMap, label, {\n\t\t\tvalue: trait.map((id) => getChangeNode_0_0_2FromViewNode(view, id, idConverter)),\n\t\t\tenumerable: true,\n\t\t});\n\t}\n\n\treturn traitMap;\n}\n"]}
1
+ {"version":3,"file":"SerializationUtilities.js","sourceRoot":"","sources":["../src/SerializationUtilities.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qCAAgE;AAMhE;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,IAAc;IACnD,OAAO,yBAAyB,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;AACnD,CAAC;AAFD,sDAEC;AAED;;;;;;GAMG;AACH,SAAgB,yBAAyB,CAAC,IAAc,EAAE,EAAU,EAAE,UAAU,GAAG,KAAK;IACvF,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAClC,MAAM,QAAQ,GAAG;QAChB,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,UAAU,EAAE,IAAI,CAAC,UAAU;KAC3B,CAAC;IACF,IAAA,8BAAqB,EAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IAEjD,IAAI,UAAU,EAAE;QACf,uCACI,QAAQ,KACX,IAAI,MAAM;gBACT,OAAO,IAAA,sBAAa,EAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;YACjF,CAAC,IACA;KACF;IAED,uCACI,QAAQ,KACX,MAAM,EAAE,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,IAChD;AACH,CAAC;AArBD,8DAqBC;AAED,oFAAoF;AACpF,SAAS,UAAU,CAClB,IAAc,EACd,MAAkD,EAClD,UAAU,GAAG,KAAK;IAElB,MAAM,QAAQ,GAAG,E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8BAAqB,EAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IAEjD,uCACI,QAAQ,KACX,MAAM,EAAE,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,IACvD;AACH,CAAC;AAhBD,0EAgBC;AAED;;;GAGG;AACH,SAAS,gBAAgB,CACxB,IAAc,EACd,MAAkD,EAClD,WAA4B;IAE5B,MAAM,QAAQ,GAAG,EAAE,CAAC;IACpB,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,EAAE;QAC9C,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,KAAK,EAAE;YACtC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,+BAA+B,CAAC,IAAI,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC;YAChF,UAAU,EAAE,IAAI;SAChB,CAAC,CAAC;KACH;IAED,OAAO,QAAQ,CAAC;AACjB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { copyPropertyIfDefined, memoizeGetter } from './Common';\nimport { NodeId, TraitLabel } from './Identifiers';\nimport { NodeIdConverter } from './NodeIdUtilities';\nimport { ChangeNode, ChangeNode_0_0_2, TraitMap } from './persisted-types';\nimport { TreeView } from './TreeView';\n\n/**\n * Converts this tree view to an equivalent `ChangeNode`.\n * @param view - the view to convert\n */\nexport function getChangeNodeFromView(view: TreeView): ChangeNode {\n\treturn getChangeNodeFromViewNode(view, view.root);\n}\n\n/**\n * Converts a node in this tree view to an equivalent `ChangeNode`.\n * @param view - the view of the tree that contains the node to convert\n * @param id - the id of the node to convert\n * @param lazyTraits - whether or not traits should be populated lazily. If true, the subtrees under each trait will not be read until\n * the trait is first accessed.\n */\nexport function getChangeNodeFromViewNode(view: TreeView, id: NodeId, lazyTraits = false): ChangeNode {\n\tconst node = view.getViewNode(id);\n\tconst nodeData = {\n\t\tdefinition: node.definition,\n\t\tidentifier: node.identifier,\n\t};\n\tcopyPropertyIfDefined(node, nodeData, 'payload');\n\n\tif (lazyTraits) {\n\t\treturn {\n\t\t\t...nodeData,\n\t\t\tget traits() {\n\t\t\t\treturn memoizeGetter(this, 'traits', makeTraits(view, node.traits, lazyTraits));\n\t\t\t},\n\t\t};\n\t}\n\n\treturn {\n\t\t...nodeData,\n\t\ttraits: makeTraits(view, node.traits, lazyTraits),\n\t};\n}\n\n/** Given the traits of a TreeViewNode, return the corresponding traits on a Node */\nfunction makeTraits(\n\tview: TreeView,\n\ttraits: ReadonlyMap<TraitLabel, readonly NodeId[]>,\n\tlazyTraits = false\n): TraitMap<ChangeNode> {\n\tconst traitMap = {};\n\tfor (const [label, trait] of traits.entries()) {\n\t\tif (lazyTraits) {\n\t\t\tObject.defineProperty(traitMap, label, {\n\t\t\t\tget() {\n\t\t\t\t\tconst treeNodeTrait = trait.map((id) => getChangeNodeFromViewNode(view, id, lazyTraits));\n\t\t\t\t\treturn memoizeGetter(this as TraitMap<ChangeNode>, label, treeNodeTrait);\n\t\t\t\t},\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t});\n\t\t} else {\n\t\t\tObject.defineProperty(traitMap, label, {\n\t\t\t\tvalue: trait.map((id) => getChangeNodeFromViewNode(view, id, lazyTraits)),\n\t\t\t\tenumerable: true,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn traitMap;\n}\n\n/**\n * Converts this tree view to an equivalent `ChangeNode`.\n * @param view - the view to convert\n */\nexport function getChangeNode_0_0_2FromView(view: TreeView, idConverter: NodeIdConverter): ChangeNode_0_0_2 {\n\treturn getChangeNode_0_0_2FromViewNode(view, view.root, idConverter);\n}\n\n/**\n * Converts a node in this tree view to an equivalent `ChangeNode`.\n * @param view - the view of the tree that contains the node to convert\n * @param id - the id of the node to convert\n * @param lazyTraits - whether or not traits should be populated lazily. If true, the subtrees under each trait will not be read until\n * the trait is first accessed.\n * @deprecated Remove by March 2022\n */\nexport function getChangeNode_0_0_2FromViewNode(\n\tview: TreeView,\n\tid: NodeId,\n\tidConverter: NodeIdConverter\n): ChangeNode_0_0_2 {\n\tconst node = view.getViewNode(id);\n\tconst nodeData = {\n\t\tdefinition: node.definition,\n\t\tidentifier: idConverter.convertToStableNodeId(node.identifier),\n\t};\n\tcopyPropertyIfDefined(node, nodeData, 'payload');\n\n\treturn {\n\t\t...nodeData,\n\t\ttraits: makeTraits_0_0_2(view, node.traits, idConverter),\n\t};\n}\n\n/**\n * Given the traits of a TreeViewNode, return the corresponding traits on a Node\n * @deprecated Remove by march 2022\n */\nfunction makeTraits_0_0_2(\n\tview: TreeView,\n\ttraits: ReadonlyMap<TraitLabel, readonly NodeId[]>,\n\tidConverter: NodeIdConverter\n): TraitMap<ChangeNode_0_0_2> {\n\tconst traitMap = {};\n\tfor (const [label, trait] of traits.entries()) {\n\t\tObject.defineProperty(traitMap, label, {\n\t\t\tvalue: trait.map((id) => getChangeNode_0_0_2FromViewNode(view, id, idConverter)),\n\t\t\tenumerable: true,\n\t\t});\n\t}\n\n\treturn traitMap;\n}\n"]}
@@ -7,7 +7,7 @@ import { IFluidSerializer, ISharedObjectEvents, SharedObject } from '@fluidframe
7
7
  import { ITelemetryLogger, ITelemetryProperties } from '@fluidframework/common-definitions';
8
8
  import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
9
9
  import { OrderedEditSet } from './EditLog';
10
- import { EditId, NodeId, StableNodeId } from './Identifiers';
10
+ import { EditId, NodeId, StableNodeId, AttributionId } from './Identifiers';
11
11
  import { LogViewer } from './LogViewer';
12
12
  import { ReconciliationPath } from './ReconciliationPath';
13
13
  import { ChangeInternal, Edit, EditStatus, SharedTreeSummaryBase, WriteFormat, InternalizedChange } from './persisted-types';
@@ -15,15 +15,68 @@ import { NodeIdContext } from './NodeIdUtilities';
15
15
  import { RevisionView } from './RevisionView';
16
16
  import { Change } from './ChangeTypes';
17
17
  import { TransactionInternal } from './TransactionInternal';
18
+ /**
19
+ * The write format and associated options used to construct a `SharedTree`
20
+ * @public
21
+ */
22
+ export declare type SharedTreeArgs<WF extends WriteFormat = WriteFormat> = [writeFormat: WF, options?: SharedTreeOptions<WF>];
23
+ /**
24
+ * The type of shared tree options for a given write format
25
+ * @public
26
+ */
27
+ export declare type SharedTreeOptions<WF extends WriteFormat, HistoryCompatibility extends 'Forwards' | 'None' = 'Forwards'> = Omit<WF extends WriteFormat.v0_0_2 ? SharedTreeOptions_0_0_2 : WF extends WriteFormat.v0_1_1 ? SharedTreeOptions_0_1_1 : never, HistoryCompatibility extends 'Forwards' ? 'summarizeHistory' : never>;
28
+ /**
29
+ * Configuration options for a SharedTree with write format 0.0.2
30
+ * @public
31
+ */
32
+ export interface SharedTreeOptions_0_0_2 {
33
+ /**
34
+ * Determines if the history is included in summaries.
35
+ *
36
+ * Warning: enabling history summarization incurs a permanent cost in the document. It is not possible to disable history summarization
37
+ * later once it has been enabled, and thus the history cannot be safely deleted.
38
+ *
39
+ * On 0.1.1 documents, due to current code limitations, this parameter is only impactful for newly created documents.
40
+ * `SharedTree`s which load existing documents will summarize history if and only if the loaded summary included history.
41
+ *
42
+ * The technical limitations here relate to clients with mixed versions collaborating.
43
+ * In the future we may allow modification of whether or not a particular document saves history, but only via a consensus mechanism.
44
+ * See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.
45
+ * See docs/Breaking-Change-Migration for more details on the consensus scheme.
46
+ */
47
+ summarizeHistory?: boolean;
48
+ }
49
+ /**
50
+ * Configuration options for a SharedTree with write format 0.1.1
51
+ * @public
52
+ */
53
+ export interface SharedTreeOptions_0_1_1 {
54
+ /**
55
+ * Determines if the history is included in summaries and if edit chunks are uploaded when they are full.
56
+ *
57
+ * Warning: enabling history summarization incurs a permanent cost in the document. It is not possible to disable history summarization
58
+ * later once it has been enabled, and thus the history cannot be safely deleted.
59
+ *
60
+ * On 0.1.1 documents, due to current code limitations, this parameter is only impactful for newly created documents.
61
+ * `SharedTree`s which load existing documents will summarize history if and only if the loaded summary included history.
62
+ *
63
+ * The technical limitations here relate to clients with mixed versions collaborating.
64
+ * In the future we may allow modification of whether or not a particular document saves history, but only via a consensus mechanism.
65
+ * See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.
66
+ * See docs/Breaking-Change-Migration for more details on the consensus scheme.
67
+ */
68
+ summarizeHistory?: false | {
69
+ uploadEditChunks: boolean;
70
+ };
71
+ /** a UUID that identifies the user of this tree; all node IDs generated by this tree will be associated with this UUID */
72
+ attributionId?: AttributionId;
73
+ }
18
74
  /**
19
75
  * Factory for SharedTree.
20
76
  * Includes history in the summary.
21
77
  * @public
22
78
  */
23
79
  export declare class SharedTreeFactory implements IChannelFactory {
24
- private readonly writeFormat;
25
- private readonly summarizeHistory;
26
- private expensiveValidation;
27
80
  /**
28
81
  * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory."type"}
29
82
  */
@@ -32,18 +85,16 @@ export declare class SharedTreeFactory implements IChannelFactory {
32
85
  * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.attributes}
33
86
  */
34
87
  static Attributes: IChannelAttributes;
88
+ private readonly args;
35
89
  /**
36
90
  * Get a factory for SharedTree to register with the data store.
37
91
  * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See [the write format
38
92
  * documentation](../docs/Write-Format.md) for more information.
39
- * @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.
40
- * See the [breaking change migration documentation](docs/Breaking-Change-Migration) for more details on this scheme.
41
- * @param expensiveValidation - Enables expensive asserts on SharedTree.
93
+ * @param options - Configuration options for this tree
42
94
  * @returns A factory that creates `SharedTree`s and loads them from storage.
43
95
  */
44
- constructor(writeFormat: WriteFormat, summarizeHistory?: false | {
45
- uploadEditChunks: boolean;
46
- }, expensiveValidation?: boolean);
96
+ constructor(...args: SharedTreeArgs<WriteFormat.v0_0_2>);
97
+ constructor(...args: SharedTreeArgs<WriteFormat.v0_1_1>);
47
98
  /**
48
99
  * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory."type"}
49
100
  */
@@ -61,7 +112,7 @@ export declare class SharedTreeFactory implements IChannelFactory {
61
112
  * @param runtime - data store runtime that owns the new SharedTree
62
113
  * @param id - optional name for the SharedTree
63
114
  */
64
- create(runtime: IFluidDataStoreRuntime, id: string, expensiveValidation?: boolean): SharedTree;
115
+ create(runtime: IFluidDataStoreRuntime, id: string): SharedTree;
65
116
  private createSharedTree;
66
117
  }
67
118
  /**
@@ -141,33 +192,30 @@ export declare type SequencedEditAppliedHandler = (args: SequencedEditAppliedEve
141
192
  */
142
193
  export declare class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeIdContext {
143
194
  private writeFormat;
144
- private readonly expensiveValidation;
145
195
  /**
146
196
  * Create a new SharedTree. It will contain the default value (see initialTree).
147
197
  */
148
198
  static create(runtime: IFluidDataStoreRuntime, id?: string): SharedTree;
149
199
  /**
150
200
  * Get a factory for SharedTree to register with the data store.
151
- * @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.
152
- *
153
- * On 0.1.1 documents, due to current code limitations, this parameter is only impactful for newly created documents.
154
- * `SharedTree`s which load existing documents will summarize history if and only if the loaded summary included history.
155
- *
156
- * The technical limitations here relate to clients with mixed versions collaborating.
157
- * In the future we may allow modification of whether or not a particular document saves history, but only via a consensus mechanism.
158
- * See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.
159
- * See docs/Breaking-Change-Migration for more details on the consensus scheme.
160
201
  * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in.
161
202
  * This format may be updated to a newer (supported) version at runtime if a collaborating shared-tree
162
203
  * that was initialized with a newer write version connects to the session. Care must be taken when changing this value,
163
204
  * as a staged rollout must of occurred such that all collaborating clients must have the code to read at least the version
164
205
  * written.
165
206
  * See [the write format documentation](../docs/Write-Format.md) for more information.
207
+ * @param options - Configuration options for this tree
166
208
  * @returns A factory that creates `SharedTree`s and loads them from storage.
167
209
  */
168
- static getFactory(writeFormat: WriteFormat, summarizeHistory?: false | {
169
- uploadEditChunks: boolean;
170
- }): SharedTreeFactory;
210
+ static getFactory(...args: SharedTreeArgs<WriteFormat.v0_0_2>): SharedTreeFactory;
211
+ static getFactory(...args: SharedTreeArgs<WriteFormat.v0_1_1>): SharedTreeFactory;
212
+ /**
213
+ * The UUID used for attribution of nodes created by this SharedTree. All shared trees with a write format of 0.1.1 or
214
+ * greater have a unique attribution ID which may be configured in the constructor. All other shared trees (i.e. those
215
+ * with a write format of 0.0.2) use the nil UUID as their attribution ID.
216
+ * @public
217
+ */
218
+ get attributionId(): AttributionId;
171
219
  private idCompressor;
172
220
  private readonly idNormalizer;
173
221
  private interner;
@@ -195,18 +243,22 @@ export declare class SharedTree extends SharedObject<ISharedTreeEvents> implemen
195
243
  private readonly processSequencedEditResult;
196
244
  private summarizeHistory;
197
245
  private uploadEditChunks;
246
+ private getHistoryPolicy;
198
247
  /**
199
- * Create a new SharedTreeFactory.
248
+ * Create a new SharedTree.
200
249
  * @param runtime - The runtime the SharedTree will be associated with
201
250
  * @param id - Unique ID for the SharedTree
202
251
  * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See [the write format
203
252
  * documentation](../docs/Write-Format.md) for more information.
204
- * @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.
205
- * @param expensiveValidation - Enable expensive asserts.
253
+ * @param options - Configuration options for this tree
254
+ */
255
+ constructor(runtime: IFluidDataStoreRuntime, id: string, ...args: SharedTreeArgs<WriteFormat.v0_0_2>);
256
+ constructor(runtime: IFluidDataStoreRuntime, id: string, ...args: SharedTreeArgs<WriteFormat.v0_1_1>);
257
+ /**
258
+ * The write format version currently used by this `SharedTree`. This is always initialized to the write format
259
+ * passed to the tree's constructor, but it may automatically upgrade over time (e.g. when connected to another
260
+ * SharedTree with a higher write format, or when loading a summary with a higher write format).
206
261
  */
207
- constructor(runtime: IFluidDataStoreRuntime, id: string, writeFormat: WriteFormat, summarizeHistory?: false | {
208
- uploadEditChunks: boolean;
209
- }, expensiveValidation?: boolean);
210
262
  getWriteFormat(): WriteFormat;
211
263
  /**
212
264
  * Re-computes currentIsOldest and emits an event if it has changed.
@@ -268,6 +320,13 @@ export declare class SharedTree extends SharedObject<ISharedTreeEvents> implemen
268
320
  * @public
269
321
  */
270
322
  tryConvertToNodeId(id: StableNodeId): NodeId | undefined;
323
+ /**
324
+ * Returns the attribution ID associated with the SharedTree that generated the given node ID. This is generally only useful for clients
325
+ * with a write format of 0.1.1 or greater since older clients cannot be given an attribution ID and will always use the default
326
+ * `attributionId` of the tree.
327
+ * @public
328
+ */
329
+ attributeNodeId(id: NodeId): AttributionId;
271
330
  /**
272
331
  * @returns the edit history of the tree.
273
332
  * @public
@@ -275,9 +334,12 @@ export declare class SharedTree extends SharedObject<ISharedTreeEvents> implemen
275
334
  get edits(): OrderedEditSet<InternalizedChange>;
276
335
  private deserializeHandle;
277
336
  /**
278
- * Uploads the edit chunk and sends the chunk starting revision along with the resulting handle as an op.
337
+ * Uploads the edit chunk and submits a `SharedTreeHandleOp`.
338
+ * This method is fire-and-forget and will swallow any errors that occur during upload or the `onUploadComplete` hook.
339
+ * If the upload or op submission does fail then a future client will attempt the submission instead.
279
340
  */
280
341
  private uploadEditChunk;
342
+ private uploadEditChunkAsync;
281
343
  /**
282
344
  * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}
283
345
  */
@@ -1 +1 @@
1
- {"version":3,"file":"SharedTree.d.ts","sourceRoot":"","sources":["../src/SharedTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,QAAQ,EACR,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAEN,gBAAgB,EAChB,mBAAmB,EAEnB,YAAY,EACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,oBA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