@fluid-experimental/tree 2.117.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/CHANGELOG.md +24 -2
  2. package/README.md +52 -48
  3. package/{api-extractor.json → api-extractor/api-extractor-model.json} +1 -6
  4. package/api-extractor/api-extractor-report.json +9 -0
  5. package/dist/ChangeCompression.js +4 -3
  6. package/dist/ChangeCompression.js.map +1 -1
  7. package/dist/ChangeTypes.d.ts.map +1 -1
  8. package/dist/Checkout.js +28 -1
  9. package/dist/Checkout.js.map +1 -1
  10. package/dist/Common.js +27 -27
  11. package/dist/Common.js.map +1 -1
  12. package/dist/EditLog.d.ts.map +1 -1
  13. package/dist/EditLog.js +15 -11
  14. package/dist/EditLog.js.map +1 -1
  15. package/dist/EditUtilities.js +18 -18
  16. package/dist/EditUtilities.js.map +1 -1
  17. package/dist/Forest.js +12 -3
  18. package/dist/Forest.js.map +1 -1
  19. package/dist/HistoryEditFactory.js +2 -2
  20. package/dist/HistoryEditFactory.js.map +1 -1
  21. package/dist/IdConversion.js +4 -5
  22. package/dist/IdConversion.js.map +1 -1
  23. package/dist/Identifiers.js +1 -2
  24. package/dist/Identifiers.js.map +1 -1
  25. package/dist/LazyCheckout.js +1 -0
  26. package/dist/LazyCheckout.js.map +1 -1
  27. package/dist/LogViewer.js +50 -16
  28. package/dist/LogViewer.js.map +1 -1
  29. package/dist/MergeHealth.d.ts.map +1 -1
  30. package/dist/MergeHealth.js +123 -124
  31. package/dist/MergeHealth.js.map +1 -1
  32. package/dist/NodeIdUtilities.js +4 -5
  33. package/dist/NodeIdUtilities.js.map +1 -1
  34. package/dist/PayloadUtilities.js +1 -2
  35. package/dist/PayloadUtilities.js.map +1 -1
  36. package/dist/RevisionValueCache.js +18 -6
  37. package/dist/RevisionValueCache.js.map +1 -1
  38. package/dist/RevisionView.js +3 -3
  39. package/dist/RevisionView.js.map +1 -1
  40. package/dist/SerializationUtilities.js +4 -5
  41. package/dist/SerializationUtilities.js.map +1 -1
  42. package/dist/SharedTree.js +69 -33
  43. package/dist/SharedTree.js.map +1 -1
  44. package/dist/SharedTreeEncoder.js +4 -2
  45. package/dist/SharedTreeEncoder.js.map +1 -1
  46. package/dist/StringInterner.js +2 -2
  47. package/dist/StringInterner.js.map +1 -1
  48. package/dist/Summary.js +1 -2
  49. package/dist/Summary.js.map +1 -1
  50. package/dist/SummaryBackCompatibility.js +2 -3
  51. package/dist/SummaryBackCompatibility.js.map +1 -1
  52. package/dist/SummaryTestUtilities.js +2 -3
  53. package/dist/SummaryTestUtilities.js.map +1 -1
  54. package/dist/Transaction.js +4 -0
  55. package/dist/Transaction.js.map +1 -1
  56. package/dist/TransactionInternal.js +8 -7
  57. package/dist/TransactionInternal.js.map +1 -1
  58. package/dist/TreeCompressor.js +2 -0
  59. package/dist/TreeCompressor.js.map +1 -1
  60. package/dist/TreeNodeHandle.js +2 -0
  61. package/dist/TreeNodeHandle.js.map +1 -1
  62. package/dist/TreeView.js +9 -0
  63. package/dist/TreeView.js.map +1 -1
  64. package/dist/TreeViewUtilities.js +3 -4
  65. package/dist/TreeViewUtilities.js.map +1 -1
  66. package/dist/UndoRedoHandler.js +9 -6
  67. package/dist/UndoRedoHandler.js.map +1 -1
  68. package/dist/UuidUtilities.js +6 -6
  69. package/dist/UuidUtilities.js.map +1 -1
  70. package/dist/id-compressor/AppendOnlySortedMap.js +11 -8
  71. package/dist/id-compressor/AppendOnlySortedMap.js.map +1 -1
  72. package/dist/id-compressor/IdCompressor.js +73 -61
  73. package/dist/id-compressor/IdCompressor.js.map +1 -1
  74. package/dist/id-compressor/IdRange.js +1 -2
  75. package/dist/id-compressor/IdRange.js.map +1 -1
  76. package/dist/id-compressor/NumericUuid.js +7 -8
  77. package/dist/id-compressor/NumericUuid.js.map +1 -1
  78. package/dist/id-compressor/SessionIdNormalizer.js +9 -8
  79. package/dist/id-compressor/SessionIdNormalizer.js.map +1 -1
  80. package/dist/migration-shim/migrationDeltaHandler.js +6 -1
  81. package/dist/migration-shim/migrationDeltaHandler.js.map +1 -1
  82. package/dist/migration-shim/migrationShim.js +46 -30
  83. package/dist/migration-shim/migrationShim.js.map +1 -1
  84. package/dist/migration-shim/migrationShimFactory.js +3 -0
  85. package/dist/migration-shim/migrationShimFactory.js.map +1 -1
  86. package/dist/migration-shim/sharedTreeDeltaHandler.js +3 -1
  87. package/dist/migration-shim/sharedTreeDeltaHandler.js.map +1 -1
  88. package/dist/migration-shim/sharedTreeShim.js +7 -0
  89. package/dist/migration-shim/sharedTreeShim.js.map +1 -1
  90. package/dist/migration-shim/sharedTreeShimFactory.js +1 -0
  91. package/dist/migration-shim/sharedTreeShimFactory.js.map +1 -1
  92. package/dist/migration-shim/shimChannelServices.js +1 -0
  93. package/dist/migration-shim/shimChannelServices.js.map +1 -1
  94. package/dist/migration-shim/shimDeltaConnection.js +6 -1
  95. package/dist/migration-shim/shimDeltaConnection.js.map +1 -1
  96. package/dist/migration-shim/shimHandle.js +1 -0
  97. package/dist/migration-shim/shimHandle.js.map +1 -1
  98. package/dist/migration-shim/utils.js +3 -4
  99. package/dist/migration-shim/utils.js.map +1 -1
  100. package/dist/persisted-types/0.1.1.d.ts.map +1 -1
  101. package/lib/ChangeCompression.js +1 -0
  102. package/lib/ChangeCompression.js.map +1 -1
  103. package/lib/ChangeTypes.d.ts.map +1 -1
  104. package/lib/Checkout.js +28 -1
  105. package/lib/Checkout.js.map +1 -1
  106. package/lib/Common.js +1 -1
  107. package/lib/Common.js.map +1 -1
  108. package/lib/EditLog.d.ts.map +1 -1
  109. package/lib/EditLog.js +12 -8
  110. package/lib/EditLog.js.map +1 -1
  111. package/lib/Forest.js +9 -0
  112. package/lib/Forest.js.map +1 -1
  113. package/lib/LazyCheckout.js +1 -0
  114. package/lib/LazyCheckout.js.map +1 -1
  115. package/lib/LogViewer.js +50 -16
  116. package/lib/LogViewer.js.map +1 -1
  117. package/lib/MergeHealth.d.ts.map +1 -1
  118. package/lib/MergeHealth.js +121 -122
  119. package/lib/MergeHealth.js.map +1 -1
  120. package/lib/RevisionValueCache.js +18 -6
  121. package/lib/RevisionValueCache.js.map +1 -1
  122. package/lib/SharedTree.js +69 -33
  123. package/lib/SharedTree.js.map +1 -1
  124. package/lib/SharedTreeEncoder.js +4 -2
  125. package/lib/SharedTreeEncoder.js.map +1 -1
  126. package/lib/StringInterner.js +2 -2
  127. package/lib/StringInterner.js.map +1 -1
  128. package/lib/Transaction.js +4 -0
  129. package/lib/Transaction.js.map +1 -1
  130. package/lib/TransactionInternal.js +8 -7
  131. package/lib/TransactionInternal.js.map +1 -1
  132. package/lib/TreeCompressor.js +2 -0
  133. package/lib/TreeCompressor.js.map +1 -1
  134. package/lib/TreeNodeHandle.js +2 -0
  135. package/lib/TreeNodeHandle.js.map +1 -1
  136. package/lib/TreeView.js +9 -0
  137. package/lib/TreeView.js.map +1 -1
  138. package/lib/UndoRedoHandler.js +9 -6
  139. package/lib/UndoRedoHandler.js.map +1 -1
  140. package/lib/id-compressor/AppendOnlySortedMap.js +11 -8
  141. package/lib/id-compressor/AppendOnlySortedMap.js.map +1 -1
  142. package/lib/id-compressor/IdCompressor.js +69 -57
  143. package/lib/id-compressor/IdCompressor.js.map +1 -1
  144. package/lib/id-compressor/SessionIdNormalizer.js +9 -8
  145. package/lib/id-compressor/SessionIdNormalizer.js.map +1 -1
  146. package/lib/migration-shim/migrationDeltaHandler.js +6 -1
  147. package/lib/migration-shim/migrationDeltaHandler.js.map +1 -1
  148. package/lib/migration-shim/migrationShim.js +46 -30
  149. package/lib/migration-shim/migrationShim.js.map +1 -1
  150. package/lib/migration-shim/migrationShimFactory.js +3 -0
  151. package/lib/migration-shim/migrationShimFactory.js.map +1 -1
  152. package/lib/migration-shim/sharedTreeDeltaHandler.js +3 -1
  153. package/lib/migration-shim/sharedTreeDeltaHandler.js.map +1 -1
  154. package/lib/migration-shim/sharedTreeShim.js +7 -0
  155. package/lib/migration-shim/sharedTreeShim.js.map +1 -1
  156. package/lib/migration-shim/sharedTreeShimFactory.js +1 -0
  157. package/lib/migration-shim/sharedTreeShimFactory.js.map +1 -1
  158. package/lib/migration-shim/shimChannelServices.js +1 -0
  159. package/lib/migration-shim/shimChannelServices.js.map +1 -1
  160. package/lib/migration-shim/shimDeltaConnection.js +6 -1
  161. package/lib/migration-shim/shimDeltaConnection.js.map +1 -1
  162. package/lib/migration-shim/shimHandle.js +1 -0
  163. package/lib/migration-shim/shimHandle.js.map +1 -1
  164. package/lib/persisted-types/0.1.1.d.ts.map +1 -1
  165. package/package.json +37 -41
  166. package/src/MergeHealth.ts +20 -13
  167. package/tsconfig.json +3 -4
@@ -4,7 +4,10 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.convertStablePlaceIds = exports.convertStableRangeIds = exports.convertNodeDataIds = exports.convertEditIds = void 0;
7
+ exports.convertEditIds = convertEditIds;
8
+ exports.convertNodeDataIds = convertNodeDataIds;
9
+ exports.convertStableRangeIds = convertStableRangeIds;
10
+ exports.convertStablePlaceIds = convertStablePlaceIds;
8
11
  const Common_js_1 = require("./Common.js");
9
12
  const EditUtilities_js_1 = require("./EditUtilities.js");
10
13
  const Identifiers_js_1 = require("./Identifiers.js");
@@ -63,20 +66,17 @@ function convertEditIds(edit, convert) {
63
66
  (0, Common_js_1.copyPropertyIfDefined)(edit, newEdit, 'pastAttemptCount');
64
67
  return newEdit;
65
68
  }
66
- exports.convertEditIds = convertEditIds;
67
69
  function convertNodeDataIds(nodeData, convert) {
68
70
  const identifier = convert(nodeData.identifier);
69
71
  const output = { definition: nodeData.definition, identifier };
70
72
  (0, Common_js_1.copyPropertyIfDefined)(nodeData, output, 'payload');
71
73
  return output;
72
74
  }
73
- exports.convertNodeDataIds = convertNodeDataIds;
74
75
  function convertStableRangeIds(range, convert) {
75
76
  const start = convertStablePlaceIds(range.start, convert);
76
77
  const end = convertStablePlaceIds(range.end, convert);
77
78
  return { start, end };
78
79
  }
79
- exports.convertStableRangeIds = convertStableRangeIds;
80
80
  function convertStablePlaceIds({ side, referenceSibling, referenceTrait }, convert) {
81
81
  const stablePlaceNew = {
82
82
  side,
@@ -94,5 +94,4 @@ function convertStablePlaceIds({ side, referenceSibling, referenceTrait }, conve
94
94
  }
95
95
  return stablePlaceNew;
96
96
  }
97
- exports.convertStablePlaceIds = convertStablePlaceIds;
98
97
  //# sourceMappingURL=IdConversion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IdConversion.js","sourceRoot":"","sources":["../src/IdConversion.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2CAAqF;AACrF,yDAAsD;AACtD,qDAAoF;AACpF,yDAWoC;AAEpC,SAAgB,cAAc,CAC7B,IAA4D,EAC5D,OAA6B;IAE7B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAkD,EAAE;QAC3F,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;YACrB,KAAK,6BAAkB,CAAC,KAAK;gBAC5B,OAAO;oBACN,IAAI,EAAE,6BAAkB,CAAC,KAAK;oBAC9B,WAAW,EAAE,MAAM,CAAC,WAAW;oBAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;wBAClC,OAAO,IAAA,mCAAgB,EAIrB,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,qCAAoB,CAAC,CAAC;oBAC5E,CAAC,CAAC;iBACF,CAAC;YACH,KAAK,6BAAkB,CAAC,MAAM;gBAC7B,OAAO;oBACN,IAAI,EAAE,6BAAkB,CAAC,MAAM;oBAC/B,MAAM,EAAE,MAAM,CAAC,MAAM;oBACrB,WAAW,EAAE,qBAAqB,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC;iBAC/D,CAAC;YACH,KAAK,6BAAkB,CA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AC,CAAC;QAC9C,cAAc,CAAC,cAAc,GAAG;YAC/B,KAAK,EAAE,cAAc,CAAC,KAAK;YAC3B,MAAM;SACN,CAAC;IACH,CAAC;IAED,OAAO,cAAc,CAAC;AACvB,CAAC;AAtBD,sDAsBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Mutable, ReplaceRecursive, copyPropertyIfDefined, fail } from './Common.js';\nimport { convertTreeNodes } from './EditUtilities.js';\nimport { DetachedSequenceId, NodeId, isDetachedSequenceId } from './Identifiers.js';\nimport {\n\tBuildNodeInternal,\n\tChangeInternal,\n\tChangeTypeInternal,\n\tConstraintInternal,\n\tDetachInternal,\n\tEdit,\n\tNodeData,\n\tStablePlaceInternal,\n\tStableRangeInternal,\n\tTreeNode,\n} from './persisted-types/index.js';\n\nexport function convertEditIds<IdFrom, IdTo>(\n\tedit: ReplaceRecursive<Edit<ChangeInternal>, NodeId, IdFrom>,\n\tconvert: (id: IdFrom) => IdTo\n): Edit<ReplaceRecursive<ChangeInternal, NodeId, IdTo>> {\n\tconst changes = edit.changes.map((change): ReplaceRecursive<ChangeInternal, NodeId, IdTo> => {\n\t\tswitch (change.type) {\n\t\t\tcase ChangeTypeInternal.Build:\n\t\t\t\treturn {\n\t\t\t\t\ttype: ChangeTypeInternal.Build,\n\t\t\t\t\tdestination: change.destination,\n\t\t\t\t\tsource: change.source.map((tree) => {\n\t\t\t\t\t\treturn convertTreeNodes<\n\t\t\t\t\t\t\tTreeNode<ReplaceRecursive<BuildNodeInternal, NodeId, IdFrom>, IdFrom>,\n\t\t\t\t\t\t\tTreeNode<ReplaceRecursive<BuildNodeInternal, NodeId, IdTo>, IdTo>,\n\t\t\t\t\t\t\tDetachedSequenceId\n\t\t\t\t\t\t>(tree, (node) => convertNodeDataIds(node, convert), isDetachedSequenceId);\n\t\t\t\t\t}),\n\t\t\t\t};\n\t\t\tcase ChangeTypeInternal.Insert:\n\t\t\t\treturn {\n\t\t\t\t\ttype: ChangeTypeInternal.Insert,\n\t\t\t\t\tsource: change.source,\n\t\t\t\t\tdestination: convertStablePlaceIds(change.destination, convert),\n\t\t\t\t};\n\t\t\tcase ChangeTypeInternal.Detach: {\n\t\t\t\tconst detach: ReplaceRecursive<DetachInternal, NodeId, IdTo> = {\n\t\t\t\t\ttype: ChangeTypeInternal.Detach,\n\t\t\t\t\tsource: convertStableRangeIds(change.source, convert),\n\t\t\t\t};\n\t\t\t\tcopyPropertyIfDefined(change, detach, 'destination');\n\t\t\t\treturn detach;\n\t\t\t}\n\t\t\tcase ChangeTypeInternal.SetValue:\n\t\t\t\treturn {\n\t\t\t\t\ttype: ChangeTypeInternal.SetValue,\n\t\t\t\t\tnodeToModify: convert(change.nodeToModify),\n\t\t\t\t\tpayload: change.payload,\n\t\t\t\t};\n\t\t\tcase ChangeTypeInternal.Constraint: {\n\t\t\t\tconst constraint: Mutable<ReplaceRecursive<ConstraintInternal, NodeId, IdTo>> = {\n\t\t\t\t\ttype: ChangeTypeInternal.Constraint,\n\t\t\t\t\teffect: change.effect,\n\t\t\t\t\ttoConstrain: convertStableRangeIds(change.toConstrain, convert),\n\t\t\t\t};\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'identityHash');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'label');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'length');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'contentHash');\n\t\t\t\tif (change.parentNode !== undefined) {\n\t\t\t\t\tconstraint.parentNode = convert(change.parentNode);\n\t\t\t\t}\n\t\t\t\treturn constraint;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tfail('Unknown change type.');\n\t\t}\n\t});\n\tconst newEdit = { id: edit.id, changes };\n\tcopyPropertyIfDefined(edit, newEdit, 'pastAttemptCount');\n\treturn newEdit;\n}\n\nexport function convertNodeDataIds<IdFrom, IdTo>(\n\tnodeData: NodeData<IdFrom>,\n\tconvert: (id: IdFrom) => IdTo\n): NodeData<IdTo> {\n\tconst identifier = convert(nodeData.identifier);\n\tconst output = { definition: nodeData.definition, identifier };\n\tcopyPropertyIfDefined(nodeData, output, 'payload');\n\treturn output;\n}\n\nexport function convertStableRangeIds<IdFrom, IdTo>(\n\trange: ReplaceRecursive<StableRangeInternal, NodeId, IdFrom>,\n\tconvert: (id: IdFrom) => IdTo\n): ReplaceRecursive<StableRangeInternal, NodeId, IdTo> {\n\tconst start = convertStablePlaceIds(range.start, convert);\n\tconst end = convertStablePlaceIds(range.end, convert);\n\treturn { start, end };\n}\n\nexport function convertStablePlaceIds<IdFrom, IdTo>(\n\t{ side, referenceSibling, referenceTrait }: ReplaceRecursive<StablePlaceInternal, NodeId, IdFrom>,\n\tconvert: (id: IdFrom) => IdTo\n): ReplaceRecursive<StablePlaceInternal, NodeId, IdTo> {\n\tconst stablePlaceNew: Mutable<ReplaceRecursive<StablePlaceInternal, NodeId, IdTo>> = {\n\t\tside,\n\t};\n\n\tif (referenceSibling !== undefined) {\n\t\tconst nodeId = convert(referenceSibling);\n\t\tstablePlaceNew.referenceSibling = nodeId;\n\t}\n\n\tif (referenceTrait !== undefined) {\n\t\tconst parent = convert(referenceTrait.parent);\n\t\tstablePlaceNew.referenceTrait = {\n\t\t\tlabel: referenceTrait.label,\n\t\t\tparent,\n\t\t};\n\t}\n\n\treturn stablePlaceNew;\n}\n"]}
1
+ {"version":3,"file":"IdConversion.js","sourceRoot":"","sources":["../src/IdConversion.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAkBH,wCA4DC;AAED,gDAQC;AAED,sDAOC;AAED,sDAsBC;AAvHD,2CAAqF;AACrF,yDAAsD;AACtD,qDAAoF;AACpF,yDAWoC;AAEpC,SAAgB,cAAc,CAC7B,IAA4D,EAC5D,OAA6B;IAE7B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAkD,EAAE;QAC3F,QAAQ,MAAM,CAAC,IAAI,EA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KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC1D,MAAM,GAAG,GAAG,qBAAqB,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACtD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;AACvB,CAAC;AAED,SAAgB,qBAAqB,CACpC,EAAE,IAAI,EAAE,gBAAgB,EAAE,cAAc,EAAyD,EACjG,OAA6B;IAE7B,MAAM,cAAc,GAAiE;QACpF,IAAI;KACJ,CAAC;IAEF,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;QACpC,MAAM,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;QACzC,cAAc,CAAC,gBAAgB,GAAG,MAAM,CAAC;IAC1C,CAAC;IAED,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;QAClC,MAAM,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAC9C,cAAc,CAAC,cAAc,GAAG;YAC/B,KAAK,EAAE,cAAc,CAAC,KAAK;YAC3B,MAAM;SACN,CAAC;IACH,CAAC;IAED,OAAO,cAAc,CAAC;AACvB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Mutable, ReplaceRecursive, copyPropertyIfDefined, fail } from './Common.js';\nimport { convertTreeNodes } from './EditUtilities.js';\nimport { DetachedSequenceId, NodeId, isDetachedSequenceId } from './Identifiers.js';\nimport {\n\tBuildNodeInternal,\n\tChangeInternal,\n\tChangeTypeInternal,\n\tConstraintInternal,\n\tDetachInternal,\n\tEdit,\n\tNodeData,\n\tStablePlaceInternal,\n\tStableRangeInternal,\n\tTreeNode,\n} from './persisted-types/index.js';\n\nexport function convertEditIds<IdFrom, IdTo>(\n\tedit: ReplaceRecursive<Edit<ChangeInternal>, NodeId, IdFrom>,\n\tconvert: (id: IdFrom) => IdTo\n): Edit<ReplaceRecursive<ChangeInternal, NodeId, IdTo>> {\n\tconst changes = edit.changes.map((change): ReplaceRecursive<ChangeInternal, NodeId, IdTo> => {\n\t\tswitch (change.type) {\n\t\t\tcase ChangeTypeInternal.Build:\n\t\t\t\treturn {\n\t\t\t\t\ttype: ChangeTypeInternal.Build,\n\t\t\t\t\tdestination: change.destination,\n\t\t\t\t\tsource: change.source.map((tree) => {\n\t\t\t\t\t\treturn convertTreeNodes<\n\t\t\t\t\t\t\tTreeNode<ReplaceRecursive<BuildNodeInternal, NodeId, IdFrom>, IdFrom>,\n\t\t\t\t\t\t\tTreeNode<ReplaceRecursive<BuildNodeInternal, NodeId, IdTo>, IdTo>,\n\t\t\t\t\t\t\tDetachedSequenceId\n\t\t\t\t\t\t>(tree, (node) => convertNodeDataIds(node, convert), isDetachedSequenceId);\n\t\t\t\t\t}),\n\t\t\t\t};\n\t\t\tcase ChangeTypeInternal.Insert:\n\t\t\t\treturn {\n\t\t\t\t\ttype: ChangeTypeInternal.Insert,\n\t\t\t\t\tsource: change.source,\n\t\t\t\t\tdestination: convertStablePlaceIds(change.destination, convert),\n\t\t\t\t};\n\t\t\tcase ChangeTypeInternal.Detach: {\n\t\t\t\tconst detach: ReplaceRecursive<DetachInternal, NodeId, IdTo> = {\n\t\t\t\t\ttype: ChangeTypeInternal.Detach,\n\t\t\t\t\tsource: convertStableRangeIds(change.source, convert),\n\t\t\t\t};\n\t\t\t\tcopyPropertyIfDefined(change, detach, 'destination');\n\t\t\t\treturn detach;\n\t\t\t}\n\t\t\tcase ChangeTypeInternal.SetValue:\n\t\t\t\treturn {\n\t\t\t\t\ttype: ChangeTypeInternal.SetValue,\n\t\t\t\t\tnodeToModify: convert(change.nodeToModify),\n\t\t\t\t\tpayload: change.payload,\n\t\t\t\t};\n\t\t\tcase ChangeTypeInternal.Constraint: {\n\t\t\t\tconst constraint: Mutable<ReplaceRecursive<ConstraintInternal, NodeId, IdTo>> = {\n\t\t\t\t\ttype: ChangeTypeInternal.Constraint,\n\t\t\t\t\teffect: change.effect,\n\t\t\t\t\ttoConstrain: convertStableRangeIds(change.toConstrain, convert),\n\t\t\t\t};\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'identityHash');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'label');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'length');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'contentHash');\n\t\t\t\tif (change.parentNode !== undefined) {\n\t\t\t\t\tconstraint.parentNode = convert(change.parentNode);\n\t\t\t\t}\n\t\t\t\treturn constraint;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tfail('Unknown change type.');\n\t\t}\n\t});\n\tconst newEdit = { id: edit.id, changes };\n\tcopyPropertyIfDefined(edit, newEdit, 'pastAttemptCount');\n\treturn newEdit;\n}\n\nexport function convertNodeDataIds<IdFrom, IdTo>(\n\tnodeData: NodeData<IdFrom>,\n\tconvert: (id: IdFrom) => IdTo\n): NodeData<IdTo> {\n\tconst identifier = convert(nodeData.identifier);\n\tconst output = { definition: nodeData.definition, identifier };\n\tcopyPropertyIfDefined(nodeData, output, 'payload');\n\treturn output;\n}\n\nexport function convertStableRangeIds<IdFrom, IdTo>(\n\trange: ReplaceRecursive<StableRangeInternal, NodeId, IdFrom>,\n\tconvert: (id: IdFrom) => IdTo\n): ReplaceRecursive<StableRangeInternal, NodeId, IdTo> {\n\tconst start = convertStablePlaceIds(range.start, convert);\n\tconst end = convertStablePlaceIds(range.end, convert);\n\treturn { start, end };\n}\n\nexport function convertStablePlaceIds<IdFrom, IdTo>(\n\t{ side, referenceSibling, referenceTrait }: ReplaceRecursive<StablePlaceInternal, NodeId, IdFrom>,\n\tconvert: (id: IdFrom) => IdTo\n): ReplaceRecursive<StablePlaceInternal, NodeId, IdTo> {\n\tconst stablePlaceNew: Mutable<ReplaceRecursive<StablePlaceInternal, NodeId, IdTo>> = {\n\t\tside,\n\t};\n\n\tif (referenceSibling !== undefined) {\n\t\tconst nodeId = convert(referenceSibling);\n\t\tstablePlaceNew.referenceSibling = nodeId;\n\t}\n\n\tif (referenceTrait !== undefined) {\n\t\tconst parent = convert(referenceTrait.parent);\n\t\tstablePlaceNew.referenceTrait = {\n\t\t\tlabel: referenceTrait.label,\n\t\t\tparent,\n\t\t};\n\t}\n\n\treturn stablePlaceNew;\n}\n"]}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.isDetachedSequenceId = void 0;
7
+ exports.isDetachedSequenceId = isDetachedSequenceId;
8
8
  /**
9
9
  * Determine if a node is a DetachedSequenceId.
10
10
  * @internal
@@ -13,5 +13,4 @@ exports.isDetachedSequenceId = void 0;
13
13
  function isDetachedSequenceId(node) {
14
14
  return typeof node !== 'object';
15
15
  }
16
- exports.isDetachedSequenceId = isDetachedSequenceId;
17
16
  //# sourceMappingURL=Identifiers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Identifiers.js","sourceRoot":"","sources":["../src/Identifiers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAwKH;;;GAGG;AACH,wDAAwD;AACxD,SAAgB,oBAAoB,CAAC,IAAiC;IACrE,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC;AACjC,CAAC;AAFD,oDAEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Type-safe identifiers for specific use cases.\n */\n\n/**\n * A 128-bit Universally Unique IDentifier. Represented here\n * with a string of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,\n * where x is a lowercase hex digit.\n * @alpha\n */\nexport type UuidString = string & {\n\treadonly UuidString: '9d40d0ae-90d9-44b1-9482-9f55d59d5465';\n};\n\n/**\n * An identifier associated with a session for the purpose of attributing its created content to some user/entity.\n * @alpha\n */\nexport type AttributionId = UuidString;\n\n/**\n * A {@link https://datatracker.ietf.org/doc/html/rfc4122 | version 4, variant 2 uuid}.\n * @internal\n */\nexport type StableId = UuidString & {\n\treadonly StableId: '53172b0d-a3d5-41ea-bd75-b43839c97f5a';\n};\n\n/**\n * A StableId which is suitable for use as a session identifier\n * @internal\n */\nexport type SessionId = StableId & {\n\treadonly SessionId: '4498f850-e14e-4be9-8db0-89ec00997e58';\n};\n\n/**\n * Edit identifier\n * @alpha\n */\nexport type EditId = UuidString & { readonly EditId: '56897beb-53e4-4e66-85da-4bf5cd5d0d49' };\n\n/**\n * Scoped to a single edit: identifies a sequences of nodes that can be moved into a trait.\n *\n * Within a given Edit, any DetachedSequenceId must be a source at most once, and a destination at most once.\n * If used as a source, it must be after it is used as a destination.\n * If this is violated, the Edit is considered malformed.\n * @alpha\n */\nexport type DetachedSequenceId = number & {\n\treadonly DetachedSequenceId: 'f7d7903a-194e-45e7-8e82-c9ef4333577d';\n};\n\n/**\n * An identifier (UUID) that has been shortened by a distributed compression algorithm.\n * @alpha\n */\nexport type CompressedId = FinalCompressedId | LocalCompressedId;\n\n/**\n * The ID of the string that has been interned, which can be used by a {@link StringInterner} to retrieve the original string.\n * @internal\n */\nexport type InternedStringId = number & {\n\treadonly InternedStringId: 'e221abc9-9d17-4493-8db0-70c871a1c27c';\n};\n\n/**\n * A brand for identity types that are unique within a particular session (SharedTree instance).\n * @alpha\n */\nexport interface SessionUnique {\n\treadonly SessionUnique: 'cea55054-6b82-4cbf-ad19-1fa645ea3b3e';\n}\n\n/**\n * A compressed ID that has been normalized into \"session space\" (see `IdCompressor` for more).\n * Consumer-facing APIs and data structures should use session-space IDs as their lifetime and equality is stable and tied to the\n * compressor that produced them.\n * @alpha\n */\nexport type SessionSpaceCompressedId = CompressedId & SessionUnique;\n\n/**\n * A compressed ID that has been normalized into \"op space\" (see `IdCompressor` for more).\n * Serialized/persisted structures (e.g. ops) should use op-space IDs as a performance optimization, as they require no normalizing when\n * received by a remote client due to the fact that op space for a given compressor is session space for all other compressors.\n * @internal\n */\nexport type OpSpaceCompressedId = CompressedId & {\n\treadonly OpNormalized: '9209432d-a959-4df7-b2ad-767ead4dbcae';\n};\n\n/**\n * A compressed ID that is local to a document. Stable across all revisions of a document starting from the one in which it was created.\n * It should not be persisted outside of the history as it can only be decompressed in the context of the originating document.\n * If external persistence is needed (e.g. by a client), a StableId should be used instead.\n * @alpha\n */\nexport type FinalCompressedId = number & {\n\treadonly FinalCompressedId: '5d83d1e2-98b7-4e4e-a889-54c855cfa73d';\n\n\t// Same brand as OpNormalizedCompressedId, as final IDs are always finally normalized\n\treadonly OpNormalized: '9209432d-a959-4df7-b2ad-767ead4dbcae';\n};\n\n/**\n * A compressed ID that is local to a session (can only be decompressed when paired with a SessionId).\n * It should not be persisted outside of the history as it can only be decompressed in the context of the originating session.\n * If external persistence is needed (e.g. by a client), a StableId should be used instead.\n * @alpha\n */\nexport type LocalCompressedId = number & {\n\treadonly LocalCompressedId: '6fccb42f-e2a4-4243-bd29-f13d12b9c6d1';\n} & SessionUnique; // Same brand as CompressedId, as local IDs are always locally normalized\n\n/**\n * @alpha\n */\nexport interface NodeIdBrand {\n\treadonly NodeId: 'e53e7d6b-c8b9-431a-8805-4843fc639342';\n}\n\n/**\n * Node identifier.\n * Identifies a node within a document.\n * @alpha\n */\nexport type NodeId = number & SessionSpaceCompressedId & NodeIdBrand;\n\nexport type FinalNodeId = FinalCompressedId & NodeIdBrand;\n\n/**\n * A Node identifier which is persisted by SharedTree internals. Not usable as a {@link NodeId}.\n * @internal\n */\nexport type OpSpaceNodeId = number & OpSpaceCompressedId & NodeIdBrand;\n\n/**\n * Globally unique node identifier.\n * Uniquely identifies a node within and across documents. Can be used across SharedTree instances.\n * @alpha\n */\nexport type StableNodeId = string & {\n\treadonly StableNodeId: 'a0843b38-699d-4bb2-aa7a-16c502a71151';\n};\n\n/**\n * Definition.\n * A full (Uuid) persistable definition.\n * @alpha\n */\nexport type Definition = UuidString & {\n\treadonly Definition: 'c0ef9488-2a78-482d-aeed-37fba996354c';\n};\n\n/**\n * Definition.\n * A full (Uuid) persistable label for a trait.\n * @alpha\n */\nexport type TraitLabel = UuidString & {\n\treadonly TraitLabel: '613826ed-49cc-4df3-b2b8-bfc6866af8e3';\n};\n\n/**\n * Determine if a node is a DetachedSequenceId.\n * @internal\n */\n// Nodes can be an `object` type which is a banned type.\nexport function isDetachedSequenceId(node: DetachedSequenceId | object): node is DetachedSequenceId {\n\treturn typeof node !== 'object';\n}\n"]}
1
+ {"version":3,"file":"Identifiers.js","sourceRoot":"","sources":["../src/Identifiers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AA6KH,oDAEC;AAPD;;;GAGG;AACH,wDAAwD;AACxD,SAAgB,oBAAoB,CAAC,IAAiC;IACrE,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC;AACjC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Type-safe identifiers for specific use cases.\n */\n\n/**\n * A 128-bit Universally Unique IDentifier. Represented here\n * with a string of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,\n * where x is a lowercase hex digit.\n * @alpha\n */\nexport type UuidString = string & {\n\treadonly UuidString: '9d40d0ae-90d9-44b1-9482-9f55d59d5465';\n};\n\n/**\n * An identifier associated with a session for the purpose of attributing its created content to some user/entity.\n * @alpha\n */\nexport type AttributionId = UuidString;\n\n/**\n * A {@link https://datatracker.ietf.org/doc/html/rfc4122 | version 4, variant 2 uuid}.\n * @internal\n */\nexport type StableId = UuidString & {\n\treadonly StableId: '53172b0d-a3d5-41ea-bd75-b43839c97f5a';\n};\n\n/**\n * A StableId which is suitable for use as a session identifier\n * @internal\n */\nexport type SessionId = StableId & {\n\treadonly SessionId: '4498f850-e14e-4be9-8db0-89ec00997e58';\n};\n\n/**\n * Edit identifier\n * @alpha\n */\nexport type EditId = UuidString & { readonly EditId: '56897beb-53e4-4e66-85da-4bf5cd5d0d49' };\n\n/**\n * Scoped to a single edit: identifies a sequences of nodes that can be moved into a trait.\n *\n * Within a given Edit, any DetachedSequenceId must be a source at most once, and a destination at most once.\n * If used as a source, it must be after it is used as a destination.\n * If this is violated, the Edit is considered malformed.\n * @alpha\n */\nexport type DetachedSequenceId = number & {\n\treadonly DetachedSequenceId: 'f7d7903a-194e-45e7-8e82-c9ef4333577d';\n};\n\n/**\n * An identifier (UUID) that has been shortened by a distributed compression algorithm.\n * @alpha\n */\nexport type CompressedId = FinalCompressedId | LocalCompressedId;\n\n/**\n * The ID of the string that has been interned, which can be used by a {@link StringInterner} to retrieve the original string.\n * @internal\n */\nexport type InternedStringId = number & {\n\treadonly InternedStringId: 'e221abc9-9d17-4493-8db0-70c871a1c27c';\n};\n\n/**\n * A brand for identity types that are unique within a particular session (SharedTree instance).\n * @alpha\n */\nexport interface SessionUnique {\n\treadonly SessionUnique: 'cea55054-6b82-4cbf-ad19-1fa645ea3b3e';\n}\n\n/**\n * A compressed ID that has been normalized into \"session space\" (see `IdCompressor` for more).\n * Consumer-facing APIs and data structures should use session-space IDs as their lifetime and equality is stable and tied to the\n * compressor that produced them.\n * @alpha\n */\nexport type SessionSpaceCompressedId = CompressedId & SessionUnique;\n\n/**\n * A compressed ID that has been normalized into \"op space\" (see `IdCompressor` for more).\n * Serialized/persisted structures (e.g. ops) should use op-space IDs as a performance optimization, as they require no normalizing when\n * received by a remote client due to the fact that op space for a given compressor is session space for all other compressors.\n * @internal\n */\nexport type OpSpaceCompressedId = CompressedId & {\n\treadonly OpNormalized: '9209432d-a959-4df7-b2ad-767ead4dbcae';\n};\n\n/**\n * A compressed ID that is local to a document. Stable across all revisions of a document starting from the one in which it was created.\n * It should not be persisted outside of the history as it can only be decompressed in the context of the originating document.\n * If external persistence is needed (e.g. by a client), a StableId should be used instead.\n * @alpha\n */\nexport type FinalCompressedId = number & {\n\treadonly FinalCompressedId: '5d83d1e2-98b7-4e4e-a889-54c855cfa73d';\n\n\t// Same brand as OpNormalizedCompressedId, as final IDs are always finally normalized\n\treadonly OpNormalized: '9209432d-a959-4df7-b2ad-767ead4dbcae';\n};\n\n/**\n * A compressed ID that is local to a session (can only be decompressed when paired with a SessionId).\n * It should not be persisted outside of the history as it can only be decompressed in the context of the originating session.\n * If external persistence is needed (e.g. by a client), a StableId should be used instead.\n * @alpha\n */\nexport type LocalCompressedId = number & {\n\treadonly LocalCompressedId: '6fccb42f-e2a4-4243-bd29-f13d12b9c6d1';\n} & SessionUnique; // Same brand as CompressedId, as local IDs are always locally normalized\n\n/**\n * @alpha\n */\nexport interface NodeIdBrand {\n\treadonly NodeId: 'e53e7d6b-c8b9-431a-8805-4843fc639342';\n}\n\n/**\n * Node identifier.\n * Identifies a node within a document.\n * @alpha\n */\nexport type NodeId = number & SessionSpaceCompressedId & NodeIdBrand;\n\nexport type FinalNodeId = FinalCompressedId & NodeIdBrand;\n\n/**\n * A Node identifier which is persisted by SharedTree internals. Not usable as a {@link NodeId}.\n * @internal\n */\nexport type OpSpaceNodeId = number & OpSpaceCompressedId & NodeIdBrand;\n\n/**\n * Globally unique node identifier.\n * Uniquely identifies a node within and across documents. Can be used across SharedTree instances.\n * @alpha\n */\nexport type StableNodeId = string & {\n\treadonly StableNodeId: 'a0843b38-699d-4bb2-aa7a-16c502a71151';\n};\n\n/**\n * Definition.\n * A full (Uuid) persistable definition.\n * @alpha\n */\nexport type Definition = UuidString & {\n\treadonly Definition: 'c0ef9488-2a78-482d-aeed-37fba996354c';\n};\n\n/**\n * Definition.\n * A full (Uuid) persistable label for a trait.\n * @alpha\n */\nexport type TraitLabel = UuidString & {\n\treadonly TraitLabel: '613826ed-49cc-4df3-b2b8-bfc6866af8e3';\n};\n\n/**\n * Determine if a node is a DetachedSequenceId.\n * @internal\n */\n// Nodes can be an `object` type which is a banned type.\nexport function isDetachedSequenceId(node: DetachedSequenceId | object): node is DetachedSequenceId {\n\treturn typeof node !== 'object';\n}\n"]}
@@ -13,6 +13,7 @@ const Checkout_js_1 = require("./Checkout.js");
13
13
  * @internal
14
14
  */
15
15
  class LazyCheckout extends Checkout_js_1.Checkout {
16
+ latestView;
16
17
  /**
17
18
  * @param tree - the tree
18
19
  */
@@ -1 +1 @@
1
- {"version":3,"file":"LazyCheckout.js","sourceRoot":"","sources":["../src/LazyCheckout.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAAyC;AAMzC;;;;;GAKG;AACH,MAAa,YAAa,SAAQ,sBAAQ;IAGzC;;OAEG;IACH,YAAmB,IAAgB;QAClC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,IAAiC,EAAE,EAAE,GAAE,CAAC,CAAC,CAAC;QACzE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC;IACpC,CAAC;IAES,aAAa,CAAC,EAAU,EAAE,MAA0B;QAC7D,KAAK,CAAC,aAAa,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;QAChC,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC;IAChC,CAAC;IAED,IAAc,mBAAmB;QAChC,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;IAEM,KAAK,CAAC,qBAAqB;QACjC,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;YAC/C,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC;YACxC,IAAI,CAAC,UAAU,EAAE,CAAC;QACnB,CAAC;QACD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;IAEM,KAAK,CAAC,oBAAoB;QAChC,qGAAqG;QACrG,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;CACD;AAhCD,oCAgCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Checkout } from './Checkout.js';\nimport { EditId } from './Identifiers.js';\nimport { RevisionView } from './RevisionView.js';\nimport { EditCommittedEventArguments, SharedTree } from './SharedTree.js';\nimport { ValidEditingResult } from './TransactionInternal.js';\n\n/**\n * Checkout that only updates its view of the tree when explicitly requested.\n * This means that the {@link Checkout.currentView} field will never change unless {@link LazyCheckout.waitForPendingUpdates} is called.\n * @sealed\n * @internal\n */\nexport class LazyCheckout extends Checkout {\n\tprivate latestView: RevisionView;\n\n\t/**\n\t * @param tree - the tree\n\t */\n\tpublic constructor(tree: SharedTree) {\n\t\tsuper(tree, tree.currentView, (args: EditCommittedEventArguments) => {});\n\t\tthis.latestView = tree.currentView;\n\t}\n\n\tprotected handleNewEdit(id: EditId, result: ValidEditingResult): void {\n\t\tsuper.handleNewEdit(id, result);\n\t\tthis.latestView = result.after;\n\t}\n\n\tprotected get latestCommittedView(): RevisionView {\n\t\treturn this.latestView;\n\t}\n\n\tpublic async waitForPendingUpdates(): Promise<void> {\n\t\tif (this.tree.currentView !== this.latestView) {\n\t\t\tthis.latestView = this.tree.currentView;\n\t\t\tthis.emitChange();\n\t\t}\n\t\treturn Promise.resolve();\n\t}\n\n\tpublic async waitForEditsToSubmit(): Promise<void> {\n\t\t// This checkout is only lazy on updates, not edit application, so it does not need to wait for here.\n\t\treturn Promise.resolve();\n\t}\n}\n"]}
1
+ {"version":3,"file":"LazyCheckout.js","sourceRoot":"","sources":["../src/LazyCheckout.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAAyC;AAMzC;;;;;GAKG;AACH,MAAa,YAAa,SAAQ,sBAAQ;IACjC,UAAU,CAAe;IAEjC;;OAEG;IACH,YAAmB,IAAgB;QAClC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,IAAiC,EAAE,EAAE,GAAE,CAAC,CAAC,CAAC;QACzE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC;IACpC,CAAC;IAES,aAAa,CAAC,EAAU,EAAE,MAA0B;QAC7D,KAAK,CAAC,aAAa,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;QAChC,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC;IAChC,CAAC;IAED,IAAc,mBAAmB;QAChC,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;IAEM,KAAK,CAAC,qBAAqB;QACjC,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;YAC/C,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC;YACxC,IAAI,CAAC,UAAU,EAAE,CAAC;QACnB,CAAC;QACD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;IAEM,KAAK,CAAC,oBAAoB;QAChC,qGAAqG;QACrG,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;CACD;AAhCD,oCAgCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Checkout } from './Checkout.js';\nimport { EditId } from './Identifiers.js';\nimport { RevisionView } from './RevisionView.js';\nimport { EditCommittedEventArguments, SharedTree } from './SharedTree.js';\nimport { ValidEditingResult } from './TransactionInternal.js';\n\n/**\n * Checkout that only updates its view of the tree when explicitly requested.\n * This means that the {@link Checkout.currentView} field will never change unless {@link LazyCheckout.waitForPendingUpdates} is called.\n * @sealed\n * @internal\n */\nexport class LazyCheckout extends Checkout {\n\tprivate latestView: RevisionView;\n\n\t/**\n\t * @param tree - the tree\n\t */\n\tpublic constructor(tree: SharedTree) {\n\t\tsuper(tree, tree.currentView, (args: EditCommittedEventArguments) => {});\n\t\tthis.latestView = tree.currentView;\n\t}\n\n\tprotected handleNewEdit(id: EditId, result: ValidEditingResult): void {\n\t\tsuper.handleNewEdit(id, result);\n\t\tthis.latestView = result.after;\n\t}\n\n\tprotected get latestCommittedView(): RevisionView {\n\t\treturn this.latestView;\n\t}\n\n\tpublic async waitForPendingUpdates(): Promise<void> {\n\t\tif (this.tree.currentView !== this.latestView) {\n\t\t\tthis.latestView = this.tree.currentView;\n\t\t\tthis.emitChange();\n\t\t}\n\t\treturn Promise.resolve();\n\t}\n\n\tpublic async waitForEditsToSubmit(): Promise<void> {\n\t\t// This checkout is only lazy on updates, not edit application, so it does not need to wait for here.\n\t\treturn Promise.resolve();\n\t}\n}\n"]}
package/dist/LogViewer.js CHANGED
@@ -30,6 +30,56 @@ var CachingLogViewerDiagnosticEvents;
30
30
  * @alpha
31
31
  */
32
32
  class CachingLogViewer extends client_utils_1.TypedEventEmitter {
33
+ log;
34
+ /**
35
+ * Maximum size of the sequenced revision cache.
36
+ */
37
+ static sequencedCacheSizeMax = 50;
38
+ /**
39
+ * A cache for local revisions.
40
+ * It is invalidated whenever a new sequenced edit (that was not already a local edit) is added to the log.
41
+ * When a previously local edit is sequenced, this cache is adjusted to account for it, not invalidated.
42
+ */
43
+ localRevisionCache = new denque_1.default();
44
+ /**
45
+ * Cache of sequenced revisions.
46
+ */
47
+ sequencedRevisionCache;
48
+ /**
49
+ * Called whenever a sequenced edit is applied.
50
+ * This will have been called at least once for any edit if a revision after than edit has been requested.
51
+ * It may be called multiple times: the number of calls and when they occur depends on caching and is an implementation detail.
52
+ */
53
+ processSequencedEditResult;
54
+ /**
55
+ * Called whenever an edit is processed.
56
+ * This will have been called at least once for any edit if a revision after than edit has been requested.
57
+ * It may be called multiple times: the number of calls and when they occur depends on caching and is an implementation detail.
58
+ */
59
+ processEditStatus;
60
+ /**
61
+ * The ordered queue of edits that originated from this client that have never been applied (by this log viewer) in a sequenced state.
62
+ * This means these edits may be local or sequenced, and may have been applied (possibly multiple times) while still local.
63
+ * Used to log telemetry about the result of edit application. Edits are removed when first applied after being sequenced.
64
+ */
65
+ unappliedSelfEdits = new denque_1.default();
66
+ /**
67
+ * Cache of applying a edit.
68
+ * Due to use of Transactions in checkouts, a common pattern involves applying an edit
69
+ * as part of the transaction, then submitting it.
70
+ * This cache helps optimize that case by avoiding recomputing the edit if no other edits were added during the transaction.
71
+ */
72
+ cachedEditResult;
73
+ /**
74
+ * Cache entry for the highest revision.
75
+ * `undefined` when not cached.
76
+ */
77
+ highestRevisionCacheEntry;
78
+ /**
79
+ * Removes this log viewer from the set of handleEditAdded listeners on its underlying log.
80
+ * This should be called if the underlying log or its listeners are re-used past the lifetime of this log viewer.
81
+ */
82
+ detachFromEditLog;
33
83
  /**
34
84
  * @returns true if the highest revision is cached.
35
85
  */
@@ -48,18 +98,6 @@ class CachingLogViewer extends client_utils_1.TypedEventEmitter {
48
98
  */
49
99
  constructor(log, baseView, initialRevision, processEditStatus = Common_js_1.noop, processSequencedEditResult = Common_js_1.noop, minimumSequenceNumber = 0) {
50
100
  super();
51
- /**
52
- * A cache for local revisions.
53
- * It is invalidated whenever a new sequenced edit (that was not already a local edit) is added to the log.
54
- * When a previously local edit is sequenced, this cache is adjusted to account for it, not invalidated.
55
- */
56
- this.localRevisionCache = new denque_1.default();
57
- /**
58
- * The ordered queue of edits that originated from this client that have never been applied (by this log viewer) in a sequenced state.
59
- * This means these edits may be local or sequenced, and may have been applied (possibly multiple times) while still local.
60
- * Used to log telemetry about the result of edit application. Edits are removed when first applied after being sequenced.
61
- */
62
- this.unappliedSelfEdits = new denque_1.default();
63
101
  this.log = log;
64
102
  if (initialRevision !== undefined) {
65
103
  (0, internal_1.assert)(Number.isInteger(initialRevision[0]), 0x628 /* revision must be an integer */);
@@ -439,8 +477,4 @@ class CachingLogViewer extends client_utils_1.TypedEventEmitter {
439
477
  }
440
478
  }
441
479
  exports.CachingLogViewer = CachingLogViewer;
442
- /**
443
- * Maximum size of the sequenced revision cache.
444
- */
445
- CachingLogViewer.sequencedCacheSizeMax = 50;
446
480
  //# sourceMappingURL=LogViewer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LogViewer.js","sourceRoot":"","sources":["../src/LogViewer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,+DAAiE;AAEjE,kEAA6D;AAC7D,oDAA4B;AAE5B,2CAAyC;AAIzC,mEAAuE;AAEvE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ACA,EAAE,EAAE,IAAI,CAAC,EAAE;gCACX,MAAM,EAAE,WAAW,CAAC,MAAM;gCAC1B,OAAO,EAAE,WAAW,CAAC,OAAO;gCAC5B,MAAM;gCACN,IAAI,EAAE,WAAW,CAAC,IAAI;gCACtB,OAAO,EAAE,IAAI,CAAC,OAAO;6BACrB,CAAC;oBACL,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,kBAAkB;IAElB;;OAEG;IACI,KAAK,CAAC,aAAa,CAAC,QAAkB;QAC5C,OAAO,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,eAAe,CAAC,QAAkB;QAC9C,OAAO,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC;IAClD,CAAC;IAED;;OAEG;IACI,sBAAsB,CAAC,QAAkB;QAC/C,OAAO,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACI,wBAAwB,CAAC,QAAkB;QACjD,OAAO,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC;IAClD,CAAC;;AApgBF,4CAqgBC;AAlgBA;;GAEG;AACoB,sCAAqB,GAAG,EAAE,AAAL,CAAM","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from '@fluid-internal/client-utils';\nimport { IEvent } from '@fluidframework/core-interfaces';\nimport { assert } from '@fluidframework/core-utils/internal';\nimport Denque from 'denque';\n\nimport { fail, noop } from './Common.js';\nimport { EditLog, SequencedOrderedEditId } from './EditLog.js';\nimport { EditId } from './Identifiers.js';\nimport { ReconciliationChange, ReconciliationEdit, ReconciliationPath } from './ReconciliationPath.js';\nimport { Revision, RevisionValueCache } from './RevisionValueCache.js';\nimport { RevisionView } from './RevisionView.js';\nimport { EditingResult, TransactionInternal } from './TransactionInternal.js';\nimport { ChangeInternal, Edit, EditStatus } from './persisted-types/index.js';\n\n/**\n * Callback for when an edit is applied (meaning the result of applying it to a particular revision is computed).\n *\n * Edits may be applied any time a TreeView is computed that includes them.\n * Depending on the caching policy of the LogViewer, a given edit may or may not be applied in order to compute a TreeView containing it.\n *\n * If the same edit occurs in different contexts (ex: a local edit is adjusted for a new remote edit),\n * that it will be reapplied, and this may result in different results.\n *\n * Edits may additionally be reapplied at other times since their previous output might not be cached.\n *\n * If an application requests the current view, this will force all edits to be applied.\n * Such an application can use this callback can be log each edit as it comes it to see its status,\n * however this may include duplicates, as well as entries for reapplications in modified contexts.\n *\n * In the context of this callback,\n * skipping the first evaluation of an edit in a particular context due to setKnownEditingResult is still considered applying.\n * To use this call back to track when the actual computational work of applying edits is done, only count cases when `wasCached` is false.\n */\nexport type EditStatusCallback = (editResult: EditStatus, editId: EditId, wasCached: boolean) => void;\n\n/**\n * Callback for when a sequenced edit is applied.\n * This includes local edits though the callback is only invoked once the sequenced version is received.\n *\n * For edits that were local (see {@link SequencedEditResult.wasLocal}, this callback will only be called once.\n * For non-local edits, it may be called multiple times: the number of calls and when they occur depends on caching and is an implementation\n * detail.\n */\nexport type SequencedEditResultCallback = (args: SequencedEditResult) => void;\n\n/**\n * The relevant information pertaining to the application of a sequenced edit.\n */\nexport interface SequencedEditResult {\n\t/**\n\t * The edit that was applied.\n\t */\n\tedit: Edit<ChangeInternal>;\n\t/**\n\t * true iff the edit was local.\n\t */\n\twasLocal: boolean;\n\t/**\n\t * The result of applying the edit.\n\t */\n\tresult: AttemptedEditResultCacheEntry;\n\t/**\n\t * The reconciliation path for the edit.\n\t */\n\treconciliationPath: ReconciliationPath;\n}\n\n/**\n * The data cached by `CachingLogViewer` for an edit.\n */\nexport type EditCacheEntry = SuccessfulEditCacheEntry | UnsuccessfulEditCacheEntry | SummarizedEditResultCacheEntry;\n\n/**\n * The data cached by `CachingLogViewer` for an edit that it has attempted to apply locally.\n */\nexport type AttemptedEditResultCacheEntry = SuccessfulEditCacheEntry | UnsuccessfulEditCacheEntry;\n\n/**\n * The data cached by `CachingLogViewer` for an edit that it has successfully applied locally.\n */\nexport interface SuccessfulEditCacheEntry {\n\t/**\n\t * The revision view resulting from the edit.\n\t */\n\treadonly view: RevisionView;\n\t/**\n\t * The status code for the edit that produced the revision.\n\t */\n\treadonly status: EditStatus.Applied;\n\t/**\n\t * The resolved changes that were applied during the edit and their associated outcome.\n\t */\n\treadonly steps: readonly ReconciliationChange[];\n}\n\n/**\n * The data cached by `CachingLogViewer` for an edit that it has unsuccessfully attempted to apply locally.\n */\nexport interface UnsuccessfulEditCacheEntry {\n\t/**\n\t * The revision view resulting from the edit.\n\t */\n\treadonly view: RevisionView;\n\t/**\n\t * The status code for the edit that produced the revision.\n\t */\n\treadonly status: EditStatus.Invalid | EditStatus.Malformed;\n\t/**\n\t * Information about the failure encountered by the edit\n\t */\n\treadonly failure: TransactionInternal.Failure;\n}\n\n/**\n * The data cached by `CachingLogViewer` for an edit that it has retrieved from a summary.\n * TODO:#57176: once summarized edits carry enough information remove this interface and use `AttemptedEditResultCacheEntry` instead.\n */\nexport interface SummarizedEditResultCacheEntry {\n\t/**\n\t * The revision view resulting from the edit.\n\t */\n\treadonly view: RevisionView;\n\t/**\n\t * Not specified on `SummarizedEditResultCacheEntry`.\n\t * Declared to allow checking `entry.status` against undefined.\n\t */\n\treadonly status?: never;\n}\n\nexport type CachedEditingResult = AttemptedEditResultCacheEntry & {\n\t/**\n\t * Unique identifier for this edit. Must never be reused.\n\t * Used for referencing and de-duplicating edits.\n\t */\n\treadonly id: EditId;\n\treadonly before: RevisionView;\n\treadonly changes: readonly ChangeInternal[];\n};\n\n/**\n * Creates `RevisionView`s for the revisions in an `EditLog`\n * @alpha\n */\nexport interface LogViewer {\n\t/**\n\t * Returns the `TreeView` output associated with the largest revision in `editLog` less than (but not equal to) the supplied revision.\n\t *\n\t * For example:\n\t *\n\t * - revision 0 returns the initialRevision.\n\t *\n\t * - revision 1 returns the output of editLog[0] (or initialRevision if there is no edit 0).\n\t *\n\t * - revision Number.POSITIVE_INFINITY returns the newest revision.\n\t *\n\t * @deprecated Edit virtualization is no longer supported, use {@link LogViewer.getRevisionViewInMemory}\n\t */\n\tgetRevisionView(revision: Revision): Promise<RevisionView>;\n\n\t/**\n\t * Returns the `TreeView` output associated with the largest revision in `editLog` less than (but not equal to) the supplied revision.\n\t * Can only be used to retrieve revisions added during the current sessions.\n\t *\n\t * For example:\n\t *\n\t * - revision 0 returns the initialRevision.\n\t *\n\t * - revision 1 returns the output of editLog[0] (or initialRevision if there is no edit 0).\n\t *\n\t * - revision Number.POSITIVE_INFINITY returns the newest revision.\n\t *\n\t * @deprecated Edit virtualization is no longer supported so the 'inSession' APIs will be removed, use {@link LogViewer.getRevisionViewInMemory}\n\t */\n\tgetRevisionViewInSession(revision: Revision): RevisionView;\n\n\t/**\n\t * Returns the `TreeView` output associated with the largest revision in `editLog` less than (but not equal to) the supplied revision.\n\t * Can only be used to retrieve revisions added during the current session that have not been evicted from `editLog`.\n\t *\n\t * For example:\n\t *\n\t * - revision 0 returns the oldest edit in the log (which might be initialRevision).\n\t *\n\t * - revision 1 returns the output of editLog[0] (or initialRevision if there is no edit 0).\n\t *\n\t * - revision Number.POSITIVE_INFINITY returns the newest revision.\n\t */\n\tgetRevisionViewInMemory(revision: Revision): RevisionView;\n}\n\n/**\n * Events reported by {@link CachingLogViewer} for diagnostics or testing purposes.\n */\nexport enum CachingLogViewerDiagnosticEvents {\n\tRevisionRetained = 'revisionRetained',\n}\n\n/**\n * Events which may be emitted by {@link CachingLogViewer}\n * @public\n */\nexport interface ICachingLogViewerEvents extends IEvent {\n\t(event: CachingLogViewerDiagnosticEvents.RevisionRetained, listener: (revision: Revision) => void);\n}\n\n/**\n * Creates views for revisions associated with an EditLog and caches the results.\n *\n * Does so by listening for edits added to the log. If the underlying EditLog or its listeners need to be reused beyond the lifetime of\n * a CachingLogViewer instance, that instance should be disposed with `detachFromEditLog` to ensure it is garbage-collectable.\n * @alpha\n */\nexport class CachingLogViewer extends TypedEventEmitter<ICachingLogViewerEvents> implements LogViewer {\n\tpublic readonly log: EditLog<ChangeInternal>;\n\n\t/**\n\t * Maximum size of the sequenced revision cache.\n\t */\n\tpublic static readonly sequencedCacheSizeMax = 50;\n\n\t/**\n\t * A cache for local revisions.\n\t * It is invalidated whenever a new sequenced edit (that was not already a local edit) is added to the log.\n\t * When a previously local edit is sequenced, this cache is adjusted to account for it, not invalidated.\n\t */\n\tprivate readonly localRevisionCache = new Denque<AttemptedEditResultCacheEntry>();\n\n\t/**\n\t * Cache of sequenced revisions.\n\t */\n\tprivate readonly sequencedRevisionCache: RevisionValueCache<EditCacheEntry>;\n\n\t/**\n\t * Called whenever a sequenced edit is applied.\n\t * This will have been called at least once for any edit if a revision after than edit has been requested.\n\t * It may be called multiple times: the number of calls and when they occur depends on caching and is an implementation detail.\n\t */\n\tprivate readonly processSequencedEditResult: SequencedEditResultCallback;\n\n\t/**\n\t * Called whenever an edit is processed.\n\t * This will have been called at least once for any edit if a revision after than edit has been requested.\n\t * It may be called multiple times: the number of calls and when they occur depends on caching and is an implementation detail.\n\t */\n\tprivate readonly processEditStatus: EditStatusCallback;\n\n\t/**\n\t * The ordered queue of edits that originated from this client that have never been applied (by this log viewer) in a sequenced state.\n\t * This means these edits may be local or sequenced, and may have been applied (possibly multiple times) while still local.\n\t * Used to log telemetry about the result of edit application. Edits are removed when first applied after being sequenced.\n\t */\n\tprivate readonly unappliedSelfEdits = new Denque<EditId>();\n\n\t/**\n\t * Cache of applying a edit.\n\t * Due to use of Transactions in checkouts, a common pattern involves applying an edit\n\t * as part of the transaction, then submitting it.\n\t * This cache helps optimize that case by avoiding recomputing the edit if no other edits were added during the transaction.\n\t */\n\tprivate cachedEditResult?: { editId: EditId; result: EditingResult };\n\n\t/**\n\t * Cache entry for the highest revision.\n\t * `undefined` when not cached.\n\t */\n\tprivate highestRevisionCacheEntry?: EditCacheEntry;\n\n\t/**\n\t * Removes this log viewer from the set of handleEditAdded listeners on its underlying log.\n\t * This should be called if the underlying log or its listeners are re-used past the lifetime of this log viewer.\n\t */\n\tpublic readonly detachFromEditLog: () => void;\n\n\t/**\n\t * @returns true if the highest revision is cached.\n\t */\n\tpublic highestRevisionCached(): boolean {\n\t\treturn this.highestRevisionCacheEntry !== undefined;\n\t}\n\n\t/**\n\t * Create a new LogViewer\n\t * @param log - the edit log which revisions will be based on.\n\t * @param baseTree - the tree used in the view corresponding to the 0th revision.\n\t * @param initialRevision - a [sequencedRevision, view] pair that is known (been precomputed) at construction time.\n\t * This revision is guaranteed to never be evicted from the cache unless it is replaced as the oldest in memory revision.\n\t * @param expensiveValidation - Iff true, additional correctness assertions will be run during LogViewer operations.\n\t * @param processEditStatus - called after applying an edit.\n\t * @param processSequencedEditResult - called after applying a sequenced edit.\n\t */\n\tpublic constructor(\n\t\tlog: EditLog<ChangeInternal>,\n\t\tbaseView: RevisionView,\n\t\tinitialRevision?: [Revision, EditCacheEntry],\n\t\tprocessEditStatus: EditStatusCallback = noop,\n\t\tprocessSequencedEditResult: SequencedEditResultCallback = noop,\n\t\tminimumSequenceNumber = 0\n\t) {\n\t\tsuper();\n\t\tthis.log = log;\n\t\tif (initialRevision !== undefined) {\n\t\t\tassert(Number.isInteger(initialRevision[0]), 0x628 /* revision must be an integer */);\n\t\t\tassert(\n\t\t\t\tthis.log.isSequencedRevision(initialRevision[0]),\n\t\t\t\t0x629 /* revision must correspond to the result of a SequencedEdit */\n\t\t\t);\n\t\t}\n\n\t\tthis.sequencedRevisionCache = new RevisionValueCache(\n\t\t\tCachingLogViewer.sequencedCacheSizeMax,\n\t\t\tminimumSequenceNumber,\n\t\t\tinitialRevision ?? [0, { view: baseView }]\n\t\t);\n\t\tthis.processEditStatus = processEditStatus ?? noop;\n\t\tthis.processSequencedEditResult = processSequencedEditResult ?? noop;\n\t\tthis.detachFromEditLog = this.log.registerEditAddedHandler(this.handleEditAdded.bind(this));\n\n\t\t// Registers a handler that is called when edits are evicted\n\t\tthis.log.registerEditEvictionHandler(this.evictCachedRevisions.bind(this));\n\t}\n\n\t/**\n\t * As a performance optimization, this method caches views generated by local edits if they are sequenced without\n\t * being interleaved with remote edits.\n\t */\n\tprivate handleEditAdded(edit: Edit<ChangeInternal>, isLocal: boolean, wasLocal: boolean): void {\n\t\t// Clear highestRevisionCacheEntry, since what revision is highest might change.\n\t\t// Note that as an optimization we could skip clearing this when a local edit is sequenced.\n\t\tthis.highestRevisionCacheEntry = undefined;\n\n\t\tif (isLocal) {\n\t\t\tthis.unappliedSelfEdits.push(edit.id);\n\t\t} else if (wasLocal) {\n\t\t\t// If the new sequenced edit was generated by this client, the corresponding cache entry (if there is one)\n\t\t\t// will be at the front of the queue. If the queue is empty, then a concurrent sequenced edit from remote client\n\t\t\t// must have invalidated the queue cache.\n\t\t\tconst entry = this.localRevisionCache.shift();\n\t\t\tif (entry !== undefined) {\n\t\t\t\tconst revision = this.log.numberOfSequencedEdits;\n\t\t\t\tconst { view } = entry;\n\t\t\t\tthis.sequencedRevisionCache.cacheValue(\n\t\t\t\t\trevision,\n\t\t\t\t\tentry.status === EditStatus.Applied\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tview,\n\t\t\t\t\t\t\t\tstatus: entry.status,\n\t\t\t\t\t\t\t\tsteps: entry.steps,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tview,\n\t\t\t\t\t\t\t\tstatus: entry.status,\n\t\t\t\t\t\t\t\tfailure: entry.failure,\n\t\t\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tthis.handleSequencedEditResult(edit, entry, []);\n\t\t\t}\n\t\t} else {\n\t\t\t// Invalidate any cached results of applying edits which are ordered after `edit` (which are all remaining local edits)\n\t\t\tthis.localRevisionCache.clear();\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc LogViewer.getRevisionViewInMemory}\n\t */\n\tpublic getRevisionViewInMemory(revision: number): RevisionView {\n\t\treturn this.getEditResultInMemory(revision).view;\n\t}\n\n\t/**\n\t * @returns the {@link EditCacheEntry} for the requested revision\n\t */\n\tpublic getEditResultInMemory(revision: Revision): EditCacheEntry {\n\t\tassert(revision >= this.log.earliestAvailableEditIndex, 0x62a /* revision not stored in memory */);\n\t\tconst startingPoint = this.getStartingPoint(revision);\n\t\tconst { startRevision } = startingPoint;\n\t\tlet current: EditCacheEntry = startingPoint;\n\t\tfor (let i = startRevision; i < revision && i < this.log.length; i++) {\n\t\t\tconst edit = this.log.tryGetEditAtIndex(i) ?? fail('edit not found');\n\t\t\tcurrent = this.applyEdit(current.view, edit, i);\n\t\t}\n\t\treturn current;\n\t}\n\n\t/**\n\t * Informs the CachingLogViewer of the latest known minimumSequenceNumber for all connected clients.\n\t * This can be used to provide more aggressive caching of revisions within the collaboration window, as those revisions\n\t * are more likely to be demanded to resolve conflicts.\n\t * @param minSequenceNumber - the minimum known sequence number of all connected clients.\n\t */\n\tpublic setMinimumSequenceNumber(minimumSequenceNumber: number): void {\n\t\t// Sequence numbers in Fluid are 1-indexed, meaning they correspond to revisions, and can be used as revisions.\n\t\t// This ensures that all revisions >= minimumSequenceNumber are kept in the cache, meaning that even if all clients are caught up\n\t\t// the most recent sequenced revision will be cached.\n\t\tthis.sequencedRevisionCache.updateRetentionWindow(minimumSequenceNumber);\n\t}\n\n\t/**\n\t * Inform the CachingLogViewer that a particular edit is known to have a specific result when applied to a particular TreeView.\n\t * CachingLogViewer may use this information as an optimization to avoid re-running the edit if re-applied to the same TreeView.\n\t */\n\tpublic setKnownEditingResult(edit: Edit<ChangeInternal>, result: EditingResult): void {\n\t\tthis.cachedEditResult = { editId: edit.id, result };\n\t}\n\n\t/**\n\t * Handler that is called before the stored edit log evicts any edits.\n\t * This caches the revision that corresponds to the edit that will be the oldest in memory after eviction\n\t * to ensure that there is always a base revision that any in memory edit can be applied to.\n\t */\n\tprivate evictCachedRevisions(editsToEvict: number): void {\n\t\tconst revisionToRetain = this.log.earliestAvailableEditIndex + editsToEvict;\n\t\tconst cacheEntry: EditCacheEntry = this.getEditResultInMemory(revisionToRetain);\n\t\tthis.sequencedRevisionCache.cacheRetainedValue(revisionToRetain, cacheEntry);\n\t\tthis.emit(CachingLogViewerDiagnosticEvents.RevisionRetained, revisionToRetain);\n\t}\n\n\t/**\n\t * @returns the cached revision view closest to the requested `revision`.\n\t */\n\tprivate getStartingPoint(revision: Revision): { startRevision: Revision } & EditCacheEntry {\n\t\t// Per the documentation for revision, the returned view should be the output of the edit at the largest index <= `revision`.\n\t\tconst revisionClamped = Math.min(revision, this.log.length);\n\n\t\t// If the highest revision is requested, and it's cached, use highestRevisionCacheEntry.\n\t\tif (revisionClamped === this.log.length && this.highestRevisionCacheEntry !== undefined) {\n\t\t\treturn { ...this.highestRevisionCacheEntry, startRevision: revisionClamped };\n\t\t}\n\n\t\tlet current: EditCacheEntry;\n\t\tlet startRevision: Revision;\n\t\tconst { numberOfSequencedEdits } = this.log;\n\t\tconst isLocalRevision = revisionClamped > numberOfSequencedEdits;\n\t\tif (isLocalRevision && !this.localRevisionCache.isEmpty()) {\n\t\t\tconst { length } = this.localRevisionCache;\n\t\t\t// Local revision view cache is indexed such that the view for revision 0 (a local edit) is stored at index 0 in the cache.\n\t\t\t// This is because the local cache does not contain an entry for the implicit initial tree edit.\n\t\t\tconst localCacheIndex = revisionClamped - 1 - numberOfSequencedEdits;\n\t\t\tif (localCacheIndex < length) {\n\t\t\t\tconst cached =\n\t\t\t\t\tthis.localRevisionCache.peekAt(localCacheIndex) ?? fail('missing tail of localRevisionViewCache');\n\t\t\t\treturn {\n\t\t\t\t\t...cached,\n\t\t\t\t\tstartRevision: revisionClamped,\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tcurrent = this.localRevisionCache.peekAt(length - 1) ?? fail('missing tail of localRevisionViewCache');\n\t\t\t\tstartRevision = numberOfSequencedEdits + length;\n\t\t\t}\n\t\t} else {\n\t\t\tconst [cachedRevision, cachedView] =\n\t\t\t\tthis.sequencedRevisionCache.getClosestEntry(revisionClamped) ?? fail('No preceding revision view cached.');\n\n\t\t\tstartRevision = cachedRevision;\n\t\t\tcurrent = cachedView;\n\t\t}\n\t\treturn { startRevision, ...current };\n\t}\n\n\t/**\n\t * Helper for applying an edit at the supplied revision view.\n\t * Must only be called in the order that edits appear in the log.\n\t * Must only be called once for a given local edit as long as the local cache has not been invalidated.\n\t * Must only be called once for a given sequenced edit.\n\t * @returns the resulting revision view and the outcome of edit that produced it.\n\t */\n\tprivate applyEdit(\n\t\tprevView: RevisionView,\n\t\tedit: Edit<ChangeInternal>,\n\t\teditIndex: number\n\t): AttemptedEditResultCacheEntry {\n\t\tlet editingResult: EditingResult;\n\t\tlet cached;\n\t\tlet reconciliationPath: ReconciliationPath = [];\n\t\tif (\n\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- TODO: ADO#58517 Code owners should verify if this code change is safe and make it if so or update this comment otherwise\n\t\t\tthis.cachedEditResult !== undefined &&\n\t\t\tthis.cachedEditResult.editId === edit.id &&\n\t\t\tthis.cachedEditResult.result.before === prevView\n\t\t) {\n\t\t\teditingResult = this.cachedEditResult.result;\n\t\t\tcached = true;\n\t\t} else {\n\t\t\treconciliationPath = this.reconciliationPathFromEdit(edit.id);\n\t\t\teditingResult = TransactionInternal.factory(prevView).applyChanges(edit.changes, reconciliationPath).close();\n\t\t\tcached = false;\n\t\t}\n\n\t\tconst revision = editIndex + 1;\n\t\tconst nextView: RevisionView = editingResult.status === EditStatus.Applied ? editingResult.after : prevView;\n\n\t\tconst computedCacheEntry =\n\t\t\teditingResult.status === EditStatus.Applied\n\t\t\t\t? { view: nextView, status: editingResult.status, steps: editingResult.steps }\n\t\t\t\t: { view: nextView, status: editingResult.status, failure: editingResult.failure };\n\n\t\tif (this.log.isSequencedRevision(revision)) {\n\t\t\tthis.sequencedRevisionCache.cacheValue(revision, computedCacheEntry);\n\t\t\tthis.handleSequencedEditResult(edit, computedCacheEntry, reconciliationPath);\n\t\t} else {\n\t\t\t// This relies on local edits being append only, and that generating the view for a local revision requires generating\n\t\t\t// the views for all local revisions before it in the log. Thus, generating such a view will necessarily require\n\t\t\t// calls to this method for all local revisions prior, guaranteeing the correct push order.\n\t\t\tassert(\n\t\t\t\trevision === this.log.numberOfSequencedEdits + this.localRevisionCache.length + 1,\n\t\t\t\t0x62b /* Local revision view cached out of order. */\n\t\t\t);\n\t\t\tthis.localRevisionCache.push(computedCacheEntry);\n\t\t}\n\n\t\t// Only update highestRevisionCacheEntry if this snapshot is the highest revision.\n\t\tif (revision >= this.log.length) {\n\t\t\tthis.highestRevisionCacheEntry = computedCacheEntry;\n\t\t}\n\n\t\tthis.processEditStatus(editingResult.status, this.log.getIdAtIndex(editIndex), cached);\n\t\treturn computedCacheEntry;\n\t}\n\n\t/**\n\t * Helper for performing caching when a sequenced local edit is first applied.\n\t * Invokes the `processSequencedEditResult` handler that was passed to the constructor (if any).\n\t * Must only be called for non-cached sequenced edits.\n\t */\n\tprivate handleSequencedEditResult(\n\t\tedit: Edit<ChangeInternal>,\n\t\tresult: AttemptedEditResultCacheEntry,\n\t\treconciliationPath: ReconciliationPath\n\t): void {\n\t\tlet wasLocal = false;\n\t\t// This is the first time this sequenced edit has been processed by this LogViewer. If it was a local edit, log telemetry\n\t\t// in the event that it was invalid or malformed.\n\t\tif (this.unappliedSelfEdits.length > 0) {\n\t\t\tif (edit.id === this.unappliedSelfEdits.peekFront()) {\n\t\t\t\twasLocal = true;\n\t\t\t\tthis.unappliedSelfEdits.shift();\n\t\t\t}\n\t\t}\n\t\tthis.processSequencedEditResult({ edit, wasLocal, result, reconciliationPath });\n\t}\n\n\t/**\n\t * We currently compute only the \"main branch\" part of the reconciliation path (meaning we don't include inverts of the edits\n\t * that occurred on the rebased branch). Doing so is only needed for the sequential anchor resolution approach which is not\n\t * yet supported.\n\t * @param editId - The ID for the edit to get the reconciliation path for.\n\t */\n\tpublic reconciliationPathFromEdit(editId: EditId): ReconciliationPath {\n\t\tconst reconciliationPath: ReconciliationEdit[] = [];\n\t\tlet cached = false;\n\t\treturn new Proxy(reconciliationPath, {\n\t\t\tget: (target, prop): unknown => {\n\t\t\t\tif (!cached) {\n\t\t\t\t\tcached = true;\n\t\t\t\t\tconst orderedId = this.log.getOrderedEditId(editId);\n\t\t\t\t\tif (orderedId.isLocal === false && orderedId.sequenceInfo !== undefined) {\n\t\t\t\t\t\tconst earliestSequenced = this.earliestSequencedEditInMemory();\n\t\t\t\t\t\tif (earliestSequenced !== undefined) {\n\t\t\t\t\t\t\tconst earliestEditSequenceNumber = earliestSequenced.sequenceNumber;\n\t\t\t\t\t\t\tconst targetSequenceNumber = Math.max(\n\t\t\t\t\t\t\t\tearliestEditSequenceNumber,\n\t\t\t\t\t\t\t\torderedId.sequenceInfo.referenceSequenceNumber\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif (targetSequenceNumber < orderedId.sequenceInfo.sequenceNumber) {\n\t\t\t\t\t\t\t\tconst firstEdit = this.getEditResultFromSequenceNumber(targetSequenceNumber);\n\t\t\t\t\t\t\t\tif (firstEdit !== undefined) {\n\t\t\t\t\t\t\t\t\tif (firstEdit.status === EditStatus.Applied) {\n\t\t\t\t\t\t\t\t\t\tconst firstEditInfo = this.log.getOrderedEditId(firstEdit.id) as SequencedOrderedEditId;\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\tfirstEditInfo.sequenceInfo !== undefined &&\n\t\t\t\t\t\t\t\t\t\t\tfirstEditInfo.sequenceInfo.sequenceNumber > orderedId.sequenceInfo.referenceSequenceNumber\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\treconciliationPath.push({\n\t\t\t\t\t\t\t\t\t\t\t\t...firstEdit.steps,\n\t\t\t\t\t\t\t\t\t\t\t\tbefore: firstEdit.before,\n\t\t\t\t\t\t\t\t\t\t\t\tafter: firstEdit.view,\n\t\t\t\t\t\t\t\t\t\t\t\tlength: firstEdit.steps.length,\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tconst lowestIndex = this.log.getIndexOfId(firstEdit.id) + 1;\n\t\t\t\t\t\t\t\t\tconst highestIndex = this.log.getIndexOfId(editId) - 1;\n\t\t\t\t\t\t\t\t\tfor (let index = lowestIndex; index <= highestIndex; ++index) {\n\t\t\t\t\t\t\t\t\t\tconst edit = this.getEditResultFromIndex(index);\n\t\t\t\t\t\t\t\t\t\tif (edit.status === EditStatus.Applied) {\n\t\t\t\t\t\t\t\t\t\t\treconciliationPath.push({\n\t\t\t\t\t\t\t\t\t\t\t\t...edit.steps,\n\t\t\t\t\t\t\t\t\t\t\t\tbefore: edit.before,\n\t\t\t\t\t\t\t\t\t\t\t\tafter: edit.view,\n\t\t\t\t\t\t\t\t\t\t\t\tlength: edit.steps.length,\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn target[prop];\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * @returns Edit information for the earliest known sequenced edit.\n\t */\n\tpublic earliestSequencedEditInMemory(): { edit: Edit<ChangeInternal>; sequenceNumber: number } | undefined {\n\t\tconst earliestEditIndex = this.log.earliestAvailableEditIndex;\n\t\tconst lastSequencedEdit = this.log.numberOfSequencedEdits + earliestEditIndex - 1;\n\t\tfor (let index = earliestEditIndex; index <= lastSequencedEdit; ++index) {\n\t\t\tconst edit = this.log.tryGetEditAtIndex(index);\n\t\t\tif (edit !== undefined) {\n\t\t\t\tconst editOrderedId = this.log.getOrderedEditId(edit.id) as SequencedOrderedEditId;\n\t\t\t\tif (editOrderedId.sequenceInfo !== undefined) {\n\t\t\t\t\treturn { edit, sequenceNumber: editOrderedId.sequenceInfo.sequenceNumber };\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * @returns Edit result information for the edit at the given `index`.\n\t */\n\tprivate getEditResultFromIndex(index: number): CachedEditingResult {\n\t\tconst edit = this.log.tryGetEditAtIndex(index) ?? fail('edit does not exist in memory');\n\t\tconst before = this.getRevisionViewInMemory(index);\n\t\tconst resultAfter = this.getEditResultInMemory(index + 1);\n\t\tif (resultAfter.status === undefined) {\n\t\t\tfail('The status of every edit in memory should be known');\n\t\t}\n\t\treturn resultAfter.status === EditStatus.Applied\n\t\t\t? {\n\t\t\t\t\tid: edit.id,\n\t\t\t\t\tstatus: EditStatus.Applied,\n\t\t\t\t\tbefore,\n\t\t\t\t\tchanges: edit.changes,\n\t\t\t\t\tview: resultAfter.view,\n\t\t\t\t\tsteps: resultAfter.steps,\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\tid: edit.id,\n\t\t\t\t\tstatus: resultAfter.status,\n\t\t\t\t\tfailure: resultAfter.failure,\n\t\t\t\t\tbefore,\n\t\t\t\t\tview: resultAfter.view,\n\t\t\t\t\tchanges: edit.changes,\n\t\t\t\t};\n\t}\n\n\t/**\n\t * @param sequenceNumber - The server-assigned sequenced number assigned to the edit of interest.\n\t * @returns Edit result information for the edit with the given sequence number or the nearest sequenced edit before that.\n\t * Undefined if no sequenced edit occurred at or prior to the given sequenceNumber.\n\t */\n\tpublic getEditResultFromSequenceNumber(sequenceNumber: number): CachedEditingResult | undefined {\n\t\tconst earliestSequenced = this.earliestSequencedEditInMemory();\n\t\tif (earliestSequenced !== undefined && sequenceNumber >= earliestSequenced.sequenceNumber) {\n\t\t\tconst lowestIndex = this.log.getIndexOfId(earliestSequenced.edit.id);\n\t\t\tconst highestIndex = this.log.numberOfSequencedEdits - 1;\n\t\t\tfor (let index = highestIndex; index >= lowestIndex; --index) {\n\t\t\t\tconst edit = this.log.tryGetEditAtIndex(index);\n\t\t\t\tif (edit !== undefined) {\n\t\t\t\t\tconst orderedId = this.log.getOrderedEditId(edit.id) as SequencedOrderedEditId;\n\t\t\t\t\t// If `orderedId.sequenceInfo.sequenceNumber` is equal to the requested `sequenceNumber` then we have found the edit of\n\t\t\t\t\t// interest and simply return its associated information.\n\t\t\t\t\t// Note that the check bellow also is also satisfied if `orderedId.sequenceInfo.sequenceNumber`is lower than the requested\n\t\t\t\t\t// `sequenceNumber`. This can happen when the edit for the requested `sequenceNumber` has either not yet been received or\n\t\t\t\t\t// has been processed by a different DDS (several DDSes can share the same stream of operations and will only see those\n\t\t\t\t\t// relevant to them). In such cases, we return the edit info for the last known edit before that.\n\t\t\t\t\tif (orderedId.sequenceInfo && orderedId.sequenceInfo.sequenceNumber <= sequenceNumber) {\n\t\t\t\t\t\tconst before = this.getRevisionViewInMemory(index);\n\t\t\t\t\t\tconst resultAfter = this.getEditResultInMemory(index + 1);\n\t\t\t\t\t\tif (resultAfter.status === undefined) {\n\t\t\t\t\t\t\tfail('The status of every edit in session should be known');\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn resultAfter.status === EditStatus.Applied\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tid: edit.id,\n\t\t\t\t\t\t\t\t\tstatus: EditStatus.Applied,\n\t\t\t\t\t\t\t\t\tbefore,\n\t\t\t\t\t\t\t\t\tchanges: edit.changes,\n\t\t\t\t\t\t\t\t\tview: resultAfter.view,\n\t\t\t\t\t\t\t\t\tsteps: resultAfter.steps,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\tid: edit.id,\n\t\t\t\t\t\t\t\t\tstatus: resultAfter.status,\n\t\t\t\t\t\t\t\t\tfailure: resultAfter.failure,\n\t\t\t\t\t\t\t\t\tbefore,\n\t\t\t\t\t\t\t\t\tview: resultAfter.view,\n\t\t\t\t\t\t\t\t\tchanges: edit.changes,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t// DEPRECATED APIS\n\n\t/**\n\t * @deprecated Edit virtualization is no longer supported, do not use the asynchronous APIs.\n\t */\n\tpublic async getEditResult(revision: Revision): Promise<EditCacheEntry> {\n\t\treturn this.getEditResultInMemory(revision);\n\t}\n\n\t/**\n\t * @deprecated Edit virtualization is no longer supported, use {@link LogViewer.getRevisionViewInMemory}\n\t */\n\tpublic async getRevisionView(revision: Revision): Promise<RevisionView> {\n\t\treturn this.getEditResultInMemory(revision).view;\n\t}\n\n\t/**\n\t * @deprecated Edit virtualization is no longer supported, do not use the 'InSession' APIs.\n\t */\n\tpublic getEditResultInSession(revision: Revision): EditCacheEntry {\n\t\treturn this.getEditResultInMemory(revision);\n\t}\n\n\t/**\n\t * @deprecated Edit virtualization is no longer supported, use {@link LogViewer.getRevisionViewInMemory}\n\t */\n\tpublic getRevisionViewInSession(revision: Revision): RevisionView {\n\t\treturn this.getEditResultInMemory(revision).view;\n\t}\n}\n"]}
1
+ {"version":3,"file":"LogViewer.js","sourceRoot":"","sources":["../src/LogViewer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,+DAAiE;AAEjE,kEAA6D;AAC7D,oDAA4B;AAE5B,2CAAyC;AAIzC,mEAAuE;AAEvE,qEAA8E;AAC9E,yDAA8E;AAkL9E;;GAEG;AACH,IAAY,gCAEX;AAFD,WAAY,gCAAgC;IAC3C,yEAAqC,CAAA;AACtC,CAAC,EAFW,gCAAgC,gDAAhC,gCAAgC,QAE3C;AAUD;;;;;;GAMG;AACH,MAAa,gBAAiB,SAAQ,gCAA0C;IAC/D,GAAG,CAA0B;IAE7C;;OAEG;IACI,MAAM,CAAU,qBAAqB,GAAG,EAAE,CAAC;IAElD;;;;OAIG;IACc,kBAAkB,GAAG,IAAI,gBAAM,EAAiC,CAAC;IAElF;;OAEG;IACc,sBAAsB,CAAqC;IAE5E;;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AC,OAAO;gCAC5B,MAAM;gCACN,IAAI,EAAE,WAAW,CAAC,IAAI;gCACtB,OAAO,EAAE,IAAI,CAAC,OAAO;6BACrB,CAAC;oBACL,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,kBAAkB;IAElB;;OAEG;IACI,KAAK,CAAC,aAAa,CAAC,QAAkB;QAC5C,OAAO,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,eAAe,CAAC,QAAkB;QAC9C,OAAO,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC;IAClD,CAAC;IAED;;OAEG;IACI,sBAAsB,CAAC,QAAkB;QAC/C,OAAO,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACI,wBAAwB,CAAC,QAAkB;QACjD,OAAO,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC;IAClD,CAAC;;AApgBF,4CAqgBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from '@fluid-internal/client-utils';\nimport { IEvent } from '@fluidframework/core-interfaces';\nimport { assert } from '@fluidframework/core-utils/internal';\nimport Denque from 'denque';\n\nimport { fail, noop } from './Common.js';\nimport { EditLog, SequencedOrderedEditId } from './EditLog.js';\nimport { EditId } from './Identifiers.js';\nimport { ReconciliationChange, ReconciliationEdit, ReconciliationPath } from './ReconciliationPath.js';\nimport { Revision, RevisionValueCache } from './RevisionValueCache.js';\nimport { RevisionView } from './RevisionView.js';\nimport { EditingResult, TransactionInternal } from './TransactionInternal.js';\nimport { ChangeInternal, Edit, EditStatus } from './persisted-types/index.js';\n\n/**\n * Callback for when an edit is applied (meaning the result of applying it to a particular revision is computed).\n *\n * Edits may be applied any time a TreeView is computed that includes them.\n * Depending on the caching policy of the LogViewer, a given edit may or may not be applied in order to compute a TreeView containing it.\n *\n * If the same edit occurs in different contexts (ex: a local edit is adjusted for a new remote edit),\n * that it will be reapplied, and this may result in different results.\n *\n * Edits may additionally be reapplied at other times since their previous output might not be cached.\n *\n * If an application requests the current view, this will force all edits to be applied.\n * Such an application can use this callback can be log each edit as it comes it to see its status,\n * however this may include duplicates, as well as entries for reapplications in modified contexts.\n *\n * In the context of this callback,\n * skipping the first evaluation of an edit in a particular context due to setKnownEditingResult is still considered applying.\n * To use this call back to track when the actual computational work of applying edits is done, only count cases when `wasCached` is false.\n */\nexport type EditStatusCallback = (editResult: EditStatus, editId: EditId, wasCached: boolean) => void;\n\n/**\n * Callback for when a sequenced edit is applied.\n * This includes local edits though the callback is only invoked once the sequenced version is received.\n *\n * For edits that were local (see {@link SequencedEditResult.wasLocal}, this callback will only be called once.\n * For non-local edits, it may be called multiple times: the number of calls and when they occur depends on caching and is an implementation\n * detail.\n */\nexport type SequencedEditResultCallback = (args: SequencedEditResult) => void;\n\n/**\n * The relevant information pertaining to the application of a sequenced edit.\n */\nexport interface SequencedEditResult {\n\t/**\n\t * The edit that was applied.\n\t */\n\tedit: Edit<ChangeInternal>;\n\t/**\n\t * true iff the edit was local.\n\t */\n\twasLocal: boolean;\n\t/**\n\t * The result of applying the edit.\n\t */\n\tresult: AttemptedEditResultCacheEntry;\n\t/**\n\t * The reconciliation path for the edit.\n\t */\n\treconciliationPath: ReconciliationPath;\n}\n\n/**\n * The data cached by `CachingLogViewer` for an edit.\n */\nexport type EditCacheEntry = SuccessfulEditCacheEntry | UnsuccessfulEditCacheEntry | SummarizedEditResultCacheEntry;\n\n/**\n * The data cached by `CachingLogViewer` for an edit that it has attempted to apply locally.\n */\nexport type AttemptedEditResultCacheEntry = SuccessfulEditCacheEntry | UnsuccessfulEditCacheEntry;\n\n/**\n * The data cached by `CachingLogViewer` for an edit that it has successfully applied locally.\n */\nexport interface SuccessfulEditCacheEntry {\n\t/**\n\t * The revision view resulting from the edit.\n\t */\n\treadonly view: RevisionView;\n\t/**\n\t * The status code for the edit that produced the revision.\n\t */\n\treadonly status: EditStatus.Applied;\n\t/**\n\t * The resolved changes that were applied during the edit and their associated outcome.\n\t */\n\treadonly steps: readonly ReconciliationChange[];\n}\n\n/**\n * The data cached by `CachingLogViewer` for an edit that it has unsuccessfully attempted to apply locally.\n */\nexport interface UnsuccessfulEditCacheEntry {\n\t/**\n\t * The revision view resulting from the edit.\n\t */\n\treadonly view: RevisionView;\n\t/**\n\t * The status code for the edit that produced the revision.\n\t */\n\treadonly status: EditStatus.Invalid | EditStatus.Malformed;\n\t/**\n\t * Information about the failure encountered by the edit\n\t */\n\treadonly failure: TransactionInternal.Failure;\n}\n\n/**\n * The data cached by `CachingLogViewer` for an edit that it has retrieved from a summary.\n * TODO:#57176: once summarized edits carry enough information remove this interface and use `AttemptedEditResultCacheEntry` instead.\n */\nexport interface SummarizedEditResultCacheEntry {\n\t/**\n\t * The revision view resulting from the edit.\n\t */\n\treadonly view: RevisionView;\n\t/**\n\t * Not specified on `SummarizedEditResultCacheEntry`.\n\t * Declared to allow checking `entry.status` against undefined.\n\t */\n\treadonly status?: never;\n}\n\nexport type CachedEditingResult = AttemptedEditResultCacheEntry & {\n\t/**\n\t * Unique identifier for this edit. Must never be reused.\n\t * Used for referencing and de-duplicating edits.\n\t */\n\treadonly id: EditId;\n\treadonly before: RevisionView;\n\treadonly changes: readonly ChangeInternal[];\n};\n\n/**\n * Creates `RevisionView`s for the revisions in an `EditLog`\n * @alpha\n */\nexport interface LogViewer {\n\t/**\n\t * Returns the `TreeView` output associated with the largest revision in `editLog` less than (but not equal to) the supplied revision.\n\t *\n\t * For example:\n\t *\n\t * - revision 0 returns the initialRevision.\n\t *\n\t * - revision 1 returns the output of editLog[0] (or initialRevision if there is no edit 0).\n\t *\n\t * - revision Number.POSITIVE_INFINITY returns the newest revision.\n\t *\n\t * @deprecated Edit virtualization is no longer supported, use {@link LogViewer.getRevisionViewInMemory}\n\t */\n\tgetRevisionView(revision: Revision): Promise<RevisionView>;\n\n\t/**\n\t * Returns the `TreeView` output associated with the largest revision in `editLog` less than (but not equal to) the supplied revision.\n\t * Can only be used to retrieve revisions added during the current sessions.\n\t *\n\t * For example:\n\t *\n\t * - revision 0 returns the initialRevision.\n\t *\n\t * - revision 1 returns the output of editLog[0] (or initialRevision if there is no edit 0).\n\t *\n\t * - revision Number.POSITIVE_INFINITY returns the newest revision.\n\t *\n\t * @deprecated Edit virtualization is no longer supported so the 'inSession' APIs will be removed, use {@link LogViewer.getRevisionViewInMemory}\n\t */\n\tgetRevisionViewInSession(revision: Revision): RevisionView;\n\n\t/**\n\t * Returns the `TreeView` output associated with the largest revision in `editLog` less than (but not equal to) the supplied revision.\n\t * Can only be used to retrieve revisions added during the current session that have not been evicted from `editLog`.\n\t *\n\t * For example:\n\t *\n\t * - revision 0 returns the oldest edit in the log (which might be initialRevision).\n\t *\n\t * - revision 1 returns the output of editLog[0] (or initialRevision if there is no edit 0).\n\t *\n\t * - revision Number.POSITIVE_INFINITY returns the newest revision.\n\t */\n\tgetRevisionViewInMemory(revision: Revision): RevisionView;\n}\n\n/**\n * Events reported by {@link CachingLogViewer} for diagnostics or testing purposes.\n */\nexport enum CachingLogViewerDiagnosticEvents {\n\tRevisionRetained = 'revisionRetained',\n}\n\n/**\n * Events which may be emitted by {@link CachingLogViewer}\n * @public\n */\nexport interface ICachingLogViewerEvents extends IEvent {\n\t(event: CachingLogViewerDiagnosticEvents.RevisionRetained, listener: (revision: Revision) => void);\n}\n\n/**\n * Creates views for revisions associated with an EditLog and caches the results.\n *\n * Does so by listening for edits added to the log. If the underlying EditLog or its listeners need to be reused beyond the lifetime of\n * a CachingLogViewer instance, that instance should be disposed with `detachFromEditLog` to ensure it is garbage-collectable.\n * @alpha\n */\nexport class CachingLogViewer extends TypedEventEmitter<ICachingLogViewerEvents> implements LogViewer {\n\tpublic readonly log: EditLog<ChangeInternal>;\n\n\t/**\n\t * Maximum size of the sequenced revision cache.\n\t */\n\tpublic static readonly sequencedCacheSizeMax = 50;\n\n\t/**\n\t * A cache for local revisions.\n\t * It is invalidated whenever a new sequenced edit (that was not already a local edit) is added to the log.\n\t * When a previously local edit is sequenced, this cache is adjusted to account for it, not invalidated.\n\t */\n\tprivate readonly localRevisionCache = new Denque<AttemptedEditResultCacheEntry>();\n\n\t/**\n\t * Cache of sequenced revisions.\n\t */\n\tprivate readonly sequencedRevisionCache: RevisionValueCache<EditCacheEntry>;\n\n\t/**\n\t * Called whenever a sequenced edit is applied.\n\t * This will have been called at least once for any edit if a revision after than edit has been requested.\n\t * It may be called multiple times: the number of calls and when they occur depends on caching and is an implementation detail.\n\t */\n\tprivate readonly processSequencedEditResult: SequencedEditResultCallback;\n\n\t/**\n\t * Called whenever an edit is processed.\n\t * This will have been called at least once for any edit if a revision after than edit has been requested.\n\t * It may be called multiple times: the number of calls and when they occur depends on caching and is an implementation detail.\n\t */\n\tprivate readonly processEditStatus: EditStatusCallback;\n\n\t/**\n\t * The ordered queue of edits that originated from this client that have never been applied (by this log viewer) in a sequenced state.\n\t * This means these edits may be local or sequenced, and may have been applied (possibly multiple times) while still local.\n\t * Used to log telemetry about the result of edit application. Edits are removed when first applied after being sequenced.\n\t */\n\tprivate readonly unappliedSelfEdits = new Denque<EditId>();\n\n\t/**\n\t * Cache of applying a edit.\n\t * Due to use of Transactions in checkouts, a common pattern involves applying an edit\n\t * as part of the transaction, then submitting it.\n\t * This cache helps optimize that case by avoiding recomputing the edit if no other edits were added during the transaction.\n\t */\n\tprivate cachedEditResult?: { editId: EditId; result: EditingResult };\n\n\t/**\n\t * Cache entry for the highest revision.\n\t * `undefined` when not cached.\n\t */\n\tprivate highestRevisionCacheEntry?: EditCacheEntry;\n\n\t/**\n\t * Removes this log viewer from the set of handleEditAdded listeners on its underlying log.\n\t * This should be called if the underlying log or its listeners are re-used past the lifetime of this log viewer.\n\t */\n\tpublic readonly detachFromEditLog: () => void;\n\n\t/**\n\t * @returns true if the highest revision is cached.\n\t */\n\tpublic highestRevisionCached(): boolean {\n\t\treturn this.highestRevisionCacheEntry !== undefined;\n\t}\n\n\t/**\n\t * Create a new LogViewer\n\t * @param log - the edit log which revisions will be based on.\n\t * @param baseTree - the tree used in the view corresponding to the 0th revision.\n\t * @param initialRevision - a [sequencedRevision, view] pair that is known (been precomputed) at construction time.\n\t * This revision is guaranteed to never be evicted from the cache unless it is replaced as the oldest in memory revision.\n\t * @param expensiveValidation - Iff true, additional correctness assertions will be run during LogViewer operations.\n\t * @param processEditStatus - called after applying an edit.\n\t * @param processSequencedEditResult - called after applying a sequenced edit.\n\t */\n\tpublic constructor(\n\t\tlog: EditLog<ChangeInternal>,\n\t\tbaseView: RevisionView,\n\t\tinitialRevision?: [Revision, EditCacheEntry],\n\t\tprocessEditStatus: EditStatusCallback = noop,\n\t\tprocessSequencedEditResult: SequencedEditResultCallback = noop,\n\t\tminimumSequenceNumber = 0\n\t) {\n\t\tsuper();\n\t\tthis.log = log;\n\t\tif (initialRevision !== undefined) {\n\t\t\tassert(Number.isInteger(initialRevision[0]), 0x628 /* revision must be an integer */);\n\t\t\tassert(\n\t\t\t\tthis.log.isSequencedRevision(initialRevision[0]),\n\t\t\t\t0x629 /* revision must correspond to the result of a SequencedEdit */\n\t\t\t);\n\t\t}\n\n\t\tthis.sequencedRevisionCache = new RevisionValueCache(\n\t\t\tCachingLogViewer.sequencedCacheSizeMax,\n\t\t\tminimumSequenceNumber,\n\t\t\tinitialRevision ?? [0, { view: baseView }]\n\t\t);\n\t\tthis.processEditStatus = processEditStatus ?? noop;\n\t\tthis.processSequencedEditResult = processSequencedEditResult ?? noop;\n\t\tthis.detachFromEditLog = this.log.registerEditAddedHandler(this.handleEditAdded.bind(this));\n\n\t\t// Registers a handler that is called when edits are evicted\n\t\tthis.log.registerEditEvictionHandler(this.evictCachedRevisions.bind(this));\n\t}\n\n\t/**\n\t * As a performance optimization, this method caches views generated by local edits if they are sequenced without\n\t * being interleaved with remote edits.\n\t */\n\tprivate handleEditAdded(edit: Edit<ChangeInternal>, isLocal: boolean, wasLocal: boolean): void {\n\t\t// Clear highestRevisionCacheEntry, since what revision is highest might change.\n\t\t// Note that as an optimization we could skip clearing this when a local edit is sequenced.\n\t\tthis.highestRevisionCacheEntry = undefined;\n\n\t\tif (isLocal) {\n\t\t\tthis.unappliedSelfEdits.push(edit.id);\n\t\t} else if (wasLocal) {\n\t\t\t// If the new sequenced edit was generated by this client, the corresponding cache entry (if there is one)\n\t\t\t// will be at the front of the queue. If the queue is empty, then a concurrent sequenced edit from remote client\n\t\t\t// must have invalidated the queue cache.\n\t\t\tconst entry = this.localRevisionCache.shift();\n\t\t\tif (entry !== undefined) {\n\t\t\t\tconst revision = this.log.numberOfSequencedEdits;\n\t\t\t\tconst { view } = entry;\n\t\t\t\tthis.sequencedRevisionCache.cacheValue(\n\t\t\t\t\trevision,\n\t\t\t\t\tentry.status === EditStatus.Applied\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tview,\n\t\t\t\t\t\t\t\tstatus: entry.status,\n\t\t\t\t\t\t\t\tsteps: entry.steps,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tview,\n\t\t\t\t\t\t\t\tstatus: entry.status,\n\t\t\t\t\t\t\t\tfailure: entry.failure,\n\t\t\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tthis.handleSequencedEditResult(edit, entry, []);\n\t\t\t}\n\t\t} else {\n\t\t\t// Invalidate any cached results of applying edits which are ordered after `edit` (which are all remaining local edits)\n\t\t\tthis.localRevisionCache.clear();\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc LogViewer.getRevisionViewInMemory}\n\t */\n\tpublic getRevisionViewInMemory(revision: number): RevisionView {\n\t\treturn this.getEditResultInMemory(revision).view;\n\t}\n\n\t/**\n\t * @returns the {@link EditCacheEntry} for the requested revision\n\t */\n\tpublic getEditResultInMemory(revision: Revision): EditCacheEntry {\n\t\tassert(revision >= this.log.earliestAvailableEditIndex, 0x62a /* revision not stored in memory */);\n\t\tconst startingPoint = this.getStartingPoint(revision);\n\t\tconst { startRevision } = startingPoint;\n\t\tlet current: EditCacheEntry = startingPoint;\n\t\tfor (let i = startRevision; i < revision && i < this.log.length; i++) {\n\t\t\tconst edit = this.log.tryGetEditAtIndex(i) ?? fail('edit not found');\n\t\t\tcurrent = this.applyEdit(current.view, edit, i);\n\t\t}\n\t\treturn current;\n\t}\n\n\t/**\n\t * Informs the CachingLogViewer of the latest known minimumSequenceNumber for all connected clients.\n\t * This can be used to provide more aggressive caching of revisions within the collaboration window, as those revisions\n\t * are more likely to be demanded to resolve conflicts.\n\t * @param minSequenceNumber - the minimum known sequence number of all connected clients.\n\t */\n\tpublic setMinimumSequenceNumber(minimumSequenceNumber: number): void {\n\t\t// Sequence numbers in Fluid are 1-indexed, meaning they correspond to revisions, and can be used as revisions.\n\t\t// This ensures that all revisions >= minimumSequenceNumber are kept in the cache, meaning that even if all clients are caught up\n\t\t// the most recent sequenced revision will be cached.\n\t\tthis.sequencedRevisionCache.updateRetentionWindow(minimumSequenceNumber);\n\t}\n\n\t/**\n\t * Inform the CachingLogViewer that a particular edit is known to have a specific result when applied to a particular TreeView.\n\t * CachingLogViewer may use this information as an optimization to avoid re-running the edit if re-applied to the same TreeView.\n\t */\n\tpublic setKnownEditingResult(edit: Edit<ChangeInternal>, result: EditingResult): void {\n\t\tthis.cachedEditResult = { editId: edit.id, result };\n\t}\n\n\t/**\n\t * Handler that is called before the stored edit log evicts any edits.\n\t * This caches the revision that corresponds to the edit that will be the oldest in memory after eviction\n\t * to ensure that there is always a base revision that any in memory edit can be applied to.\n\t */\n\tprivate evictCachedRevisions(editsToEvict: number): void {\n\t\tconst revisionToRetain = this.log.earliestAvailableEditIndex + editsToEvict;\n\t\tconst cacheEntry: EditCacheEntry = this.getEditResultInMemory(revisionToRetain);\n\t\tthis.sequencedRevisionCache.cacheRetainedValue(revisionToRetain, cacheEntry);\n\t\tthis.emit(CachingLogViewerDiagnosticEvents.RevisionRetained, revisionToRetain);\n\t}\n\n\t/**\n\t * @returns the cached revision view closest to the requested `revision`.\n\t */\n\tprivate getStartingPoint(revision: Revision): { startRevision: Revision } & EditCacheEntry {\n\t\t// Per the documentation for revision, the returned view should be the output of the edit at the largest index <= `revision`.\n\t\tconst revisionClamped = Math.min(revision, this.log.length);\n\n\t\t// If the highest revision is requested, and it's cached, use highestRevisionCacheEntry.\n\t\tif (revisionClamped === this.log.length && this.highestRevisionCacheEntry !== undefined) {\n\t\t\treturn { ...this.highestRevisionCacheEntry, startRevision: revisionClamped };\n\t\t}\n\n\t\tlet current: EditCacheEntry;\n\t\tlet startRevision: Revision;\n\t\tconst { numberOfSequencedEdits } = this.log;\n\t\tconst isLocalRevision = revisionClamped > numberOfSequencedEdits;\n\t\tif (isLocalRevision && !this.localRevisionCache.isEmpty()) {\n\t\t\tconst { length } = this.localRevisionCache;\n\t\t\t// Local revision view cache is indexed such that the view for revision 0 (a local edit) is stored at index 0 in the cache.\n\t\t\t// This is because the local cache does not contain an entry for the implicit initial tree edit.\n\t\t\tconst localCacheIndex = revisionClamped - 1 - numberOfSequencedEdits;\n\t\t\tif (localCacheIndex < length) {\n\t\t\t\tconst cached =\n\t\t\t\t\tthis.localRevisionCache.peekAt(localCacheIndex) ?? fail('missing tail of localRevisionViewCache');\n\t\t\t\treturn {\n\t\t\t\t\t...cached,\n\t\t\t\t\tstartRevision: revisionClamped,\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tcurrent = this.localRevisionCache.peekAt(length - 1) ?? fail('missing tail of localRevisionViewCache');\n\t\t\t\tstartRevision = numberOfSequencedEdits + length;\n\t\t\t}\n\t\t} else {\n\t\t\tconst [cachedRevision, cachedView] =\n\t\t\t\tthis.sequencedRevisionCache.getClosestEntry(revisionClamped) ?? fail('No preceding revision view cached.');\n\n\t\t\tstartRevision = cachedRevision;\n\t\t\tcurrent = cachedView;\n\t\t}\n\t\treturn { startRevision, ...current };\n\t}\n\n\t/**\n\t * Helper for applying an edit at the supplied revision view.\n\t * Must only be called in the order that edits appear in the log.\n\t * Must only be called once for a given local edit as long as the local cache has not been invalidated.\n\t * Must only be called once for a given sequenced edit.\n\t * @returns the resulting revision view and the outcome of edit that produced it.\n\t */\n\tprivate applyEdit(\n\t\tprevView: RevisionView,\n\t\tedit: Edit<ChangeInternal>,\n\t\teditIndex: number\n\t): AttemptedEditResultCacheEntry {\n\t\tlet editingResult: EditingResult;\n\t\tlet cached;\n\t\tlet reconciliationPath: ReconciliationPath = [];\n\t\tif (\n\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- TODO: ADO#58517 Code owners should verify if this code change is safe and make it if so or update this comment otherwise\n\t\t\tthis.cachedEditResult !== undefined &&\n\t\t\tthis.cachedEditResult.editId === edit.id &&\n\t\t\tthis.cachedEditResult.result.before === prevView\n\t\t) {\n\t\t\teditingResult = this.cachedEditResult.result;\n\t\t\tcached = true;\n\t\t} else {\n\t\t\treconciliationPath = this.reconciliationPathFromEdit(edit.id);\n\t\t\teditingResult = TransactionInternal.factory(prevView).applyChanges(edit.changes, reconciliationPath).close();\n\t\t\tcached = false;\n\t\t}\n\n\t\tconst revision = editIndex + 1;\n\t\tconst nextView: RevisionView = editingResult.status === EditStatus.Applied ? editingResult.after : prevView;\n\n\t\tconst computedCacheEntry =\n\t\t\teditingResult.status === EditStatus.Applied\n\t\t\t\t? { view: nextView, status: editingResult.status, steps: editingResult.steps }\n\t\t\t\t: { view: nextView, status: editingResult.status, failure: editingResult.failure };\n\n\t\tif (this.log.isSequencedRevision(revision)) {\n\t\t\tthis.sequencedRevisionCache.cacheValue(revision, computedCacheEntry);\n\t\t\tthis.handleSequencedEditResult(edit, computedCacheEntry, reconciliationPath);\n\t\t} else {\n\t\t\t// This relies on local edits being append only, and that generating the view for a local revision requires generating\n\t\t\t// the views for all local revisions before it in the log. Thus, generating such a view will necessarily require\n\t\t\t// calls to this method for all local revisions prior, guaranteeing the correct push order.\n\t\t\tassert(\n\t\t\t\trevision === this.log.numberOfSequencedEdits + this.localRevisionCache.length + 1,\n\t\t\t\t0x62b /* Local revision view cached out of order. */\n\t\t\t);\n\t\t\tthis.localRevisionCache.push(computedCacheEntry);\n\t\t}\n\n\t\t// Only update highestRevisionCacheEntry if this snapshot is the highest revision.\n\t\tif (revision >= this.log.length) {\n\t\t\tthis.highestRevisionCacheEntry = computedCacheEntry;\n\t\t}\n\n\t\tthis.processEditStatus(editingResult.status, this.log.getIdAtIndex(editIndex), cached);\n\t\treturn computedCacheEntry;\n\t}\n\n\t/**\n\t * Helper for performing caching when a sequenced local edit is first applied.\n\t * Invokes the `processSequencedEditResult` handler that was passed to the constructor (if any).\n\t * Must only be called for non-cached sequenced edits.\n\t */\n\tprivate handleSequencedEditResult(\n\t\tedit: Edit<ChangeInternal>,\n\t\tresult: AttemptedEditResultCacheEntry,\n\t\treconciliationPath: ReconciliationPath\n\t): void {\n\t\tlet wasLocal = false;\n\t\t// This is the first time this sequenced edit has been processed by this LogViewer. If it was a local edit, log telemetry\n\t\t// in the event that it was invalid or malformed.\n\t\tif (this.unappliedSelfEdits.length > 0) {\n\t\t\tif (edit.id === this.unappliedSelfEdits.peekFront()) {\n\t\t\t\twasLocal = true;\n\t\t\t\tthis.unappliedSelfEdits.shift();\n\t\t\t}\n\t\t}\n\t\tthis.processSequencedEditResult({ edit, wasLocal, result, reconciliationPath });\n\t}\n\n\t/**\n\t * We currently compute only the \"main branch\" part of the reconciliation path (meaning we don't include inverts of the edits\n\t * that occurred on the rebased branch). Doing so is only needed for the sequential anchor resolution approach which is not\n\t * yet supported.\n\t * @param editId - The ID for the edit to get the reconciliation path for.\n\t */\n\tpublic reconciliationPathFromEdit(editId: EditId): ReconciliationPath {\n\t\tconst reconciliationPath: ReconciliationEdit[] = [];\n\t\tlet cached = false;\n\t\treturn new Proxy(reconciliationPath, {\n\t\t\tget: (target, prop): unknown => {\n\t\t\t\tif (!cached) {\n\t\t\t\t\tcached = true;\n\t\t\t\t\tconst orderedId = this.log.getOrderedEditId(editId);\n\t\t\t\t\tif (orderedId.isLocal === false && orderedId.sequenceInfo !== undefined) {\n\t\t\t\t\t\tconst earliestSequenced = this.earliestSequencedEditInMemory();\n\t\t\t\t\t\tif (earliestSequenced !== undefined) {\n\t\t\t\t\t\t\tconst earliestEditSequenceNumber = earliestSequenced.sequenceNumber;\n\t\t\t\t\t\t\tconst targetSequenceNumber = Math.max(\n\t\t\t\t\t\t\t\tearliestEditSequenceNumber,\n\t\t\t\t\t\t\t\torderedId.sequenceInfo.referenceSequenceNumber\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif (targetSequenceNumber < orderedId.sequenceInfo.sequenceNumber) {\n\t\t\t\t\t\t\t\tconst firstEdit = this.getEditResultFromSequenceNumber(targetSequenceNumber);\n\t\t\t\t\t\t\t\tif (firstEdit !== undefined) {\n\t\t\t\t\t\t\t\t\tif (firstEdit.status === EditStatus.Applied) {\n\t\t\t\t\t\t\t\t\t\tconst firstEditInfo = this.log.getOrderedEditId(firstEdit.id) as SequencedOrderedEditId;\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\tfirstEditInfo.sequenceInfo !== undefined &&\n\t\t\t\t\t\t\t\t\t\t\tfirstEditInfo.sequenceInfo.sequenceNumber > orderedId.sequenceInfo.referenceSequenceNumber\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\treconciliationPath.push({\n\t\t\t\t\t\t\t\t\t\t\t\t...firstEdit.steps,\n\t\t\t\t\t\t\t\t\t\t\t\tbefore: firstEdit.before,\n\t\t\t\t\t\t\t\t\t\t\t\tafter: firstEdit.view,\n\t\t\t\t\t\t\t\t\t\t\t\tlength: firstEdit.steps.length,\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tconst lowestIndex = this.log.getIndexOfId(firstEdit.id) + 1;\n\t\t\t\t\t\t\t\t\tconst highestIndex = this.log.getIndexOfId(editId) - 1;\n\t\t\t\t\t\t\t\t\tfor (let index = lowestIndex; index <= highestIndex; ++index) {\n\t\t\t\t\t\t\t\t\t\tconst edit = this.getEditResultFromIndex(index);\n\t\t\t\t\t\t\t\t\t\tif (edit.status === EditStatus.Applied) {\n\t\t\t\t\t\t\t\t\t\t\treconciliationPath.push({\n\t\t\t\t\t\t\t\t\t\t\t\t...edit.steps,\n\t\t\t\t\t\t\t\t\t\t\t\tbefore: edit.before,\n\t\t\t\t\t\t\t\t\t\t\t\tafter: edit.view,\n\t\t\t\t\t\t\t\t\t\t\t\tlength: edit.steps.length,\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn target[prop];\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * @returns Edit information for the earliest known sequenced edit.\n\t */\n\tpublic earliestSequencedEditInMemory(): { edit: Edit<ChangeInternal>; sequenceNumber: number } | undefined {\n\t\tconst earliestEditIndex = this.log.earliestAvailableEditIndex;\n\t\tconst lastSequencedEdit = this.log.numberOfSequencedEdits + earliestEditIndex - 1;\n\t\tfor (let index = earliestEditIndex; index <= lastSequencedEdit; ++index) {\n\t\t\tconst edit = this.log.tryGetEditAtIndex(index);\n\t\t\tif (edit !== undefined) {\n\t\t\t\tconst editOrderedId = this.log.getOrderedEditId(edit.id) as SequencedOrderedEditId;\n\t\t\t\tif (editOrderedId.sequenceInfo !== undefined) {\n\t\t\t\t\treturn { edit, sequenceNumber: editOrderedId.sequenceInfo.sequenceNumber };\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * @returns Edit result information for the edit at the given `index`.\n\t */\n\tprivate getEditResultFromIndex(index: number): CachedEditingResult {\n\t\tconst edit = this.log.tryGetEditAtIndex(index) ?? fail('edit does not exist in memory');\n\t\tconst before = this.getRevisionViewInMemory(index);\n\t\tconst resultAfter = this.getEditResultInMemory(index + 1);\n\t\tif (resultAfter.status === undefined) {\n\t\t\tfail('The status of every edit in memory should be known');\n\t\t}\n\t\treturn resultAfter.status === EditStatus.Applied\n\t\t\t? {\n\t\t\t\t\tid: edit.id,\n\t\t\t\t\tstatus: EditStatus.Applied,\n\t\t\t\t\tbefore,\n\t\t\t\t\tchanges: edit.changes,\n\t\t\t\t\tview: resultAfter.view,\n\t\t\t\t\tsteps: resultAfter.steps,\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\tid: edit.id,\n\t\t\t\t\tstatus: resultAfter.status,\n\t\t\t\t\tfailure: resultAfter.failure,\n\t\t\t\t\tbefore,\n\t\t\t\t\tview: resultAfter.view,\n\t\t\t\t\tchanges: edit.changes,\n\t\t\t\t};\n\t}\n\n\t/**\n\t * @param sequenceNumber - The server-assigned sequenced number assigned to the edit of interest.\n\t * @returns Edit result information for the edit with the given sequence number or the nearest sequenced edit before that.\n\t * Undefined if no sequenced edit occurred at or prior to the given sequenceNumber.\n\t */\n\tpublic getEditResultFromSequenceNumber(sequenceNumber: number): CachedEditingResult | undefined {\n\t\tconst earliestSequenced = this.earliestSequencedEditInMemory();\n\t\tif (earliestSequenced !== undefined && sequenceNumber >= earliestSequenced.sequenceNumber) {\n\t\t\tconst lowestIndex = this.log.getIndexOfId(earliestSequenced.edit.id);\n\t\t\tconst highestIndex = this.log.numberOfSequencedEdits - 1;\n\t\t\tfor (let index = highestIndex; index >= lowestIndex; --index) {\n\t\t\t\tconst edit = this.log.tryGetEditAtIndex(index);\n\t\t\t\tif (edit !== undefined) {\n\t\t\t\t\tconst orderedId = this.log.getOrderedEditId(edit.id) as SequencedOrderedEditId;\n\t\t\t\t\t// If `orderedId.sequenceInfo.sequenceNumber` is equal to the requested `sequenceNumber` then we have found the edit of\n\t\t\t\t\t// interest and simply return its associated information.\n\t\t\t\t\t// Note that the check bellow also is also satisfied if `orderedId.sequenceInfo.sequenceNumber`is lower than the requested\n\t\t\t\t\t// `sequenceNumber`. This can happen when the edit for the requested `sequenceNumber` has either not yet been received or\n\t\t\t\t\t// has been processed by a different DDS (several DDSes can share the same stream of operations and will only see those\n\t\t\t\t\t// relevant to them). In such cases, we return the edit info for the last known edit before that.\n\t\t\t\t\tif (orderedId.sequenceInfo && orderedId.sequenceInfo.sequenceNumber <= sequenceNumber) {\n\t\t\t\t\t\tconst before = this.getRevisionViewInMemory(index);\n\t\t\t\t\t\tconst resultAfter = this.getEditResultInMemory(index + 1);\n\t\t\t\t\t\tif (resultAfter.status === undefined) {\n\t\t\t\t\t\t\tfail('The status of every edit in session should be known');\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn resultAfter.status === EditStatus.Applied\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tid: edit.id,\n\t\t\t\t\t\t\t\t\tstatus: EditStatus.Applied,\n\t\t\t\t\t\t\t\t\tbefore,\n\t\t\t\t\t\t\t\t\tchanges: edit.changes,\n\t\t\t\t\t\t\t\t\tview: resultAfter.view,\n\t\t\t\t\t\t\t\t\tsteps: resultAfter.steps,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\tid: edit.id,\n\t\t\t\t\t\t\t\t\tstatus: resultAfter.status,\n\t\t\t\t\t\t\t\t\tfailure: resultAfter.failure,\n\t\t\t\t\t\t\t\t\tbefore,\n\t\t\t\t\t\t\t\t\tview: resultAfter.view,\n\t\t\t\t\t\t\t\t\tchanges: edit.changes,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t// DEPRECATED APIS\n\n\t/**\n\t * @deprecated Edit virtualization is no longer supported, do not use the asynchronous APIs.\n\t */\n\tpublic async getEditResult(revision: Revision): Promise<EditCacheEntry> {\n\t\treturn this.getEditResultInMemory(revision);\n\t}\n\n\t/**\n\t * @deprecated Edit virtualization is no longer supported, use {@link LogViewer.getRevisionViewInMemory}\n\t */\n\tpublic async getRevisionView(revision: Revision): Promise<RevisionView> {\n\t\treturn this.getEditResultInMemory(revision).view;\n\t}\n\n\t/**\n\t * @deprecated Edit virtualization is no longer supported, do not use the 'InSession' APIs.\n\t */\n\tpublic getEditResultInSession(revision: Revision): EditCacheEntry {\n\t\treturn this.getEditResultInMemory(revision);\n\t}\n\n\t/**\n\t * @deprecated Edit virtualization is no longer supported, use {@link LogViewer.getRevisionViewInMemory}\n\t */\n\tpublic getRevisionViewInSession(revision: Revision): RevisionView {\n\t\treturn this.getEditResultInMemory(revision).view;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MergeHealth.d.ts","sourceRoot":"","sources":["../src/MergeHealth.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAsC,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAIjF;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,UAAU,GAAG;IAAE,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CAezF;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAChC,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;;;;;;;;;OAaG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;;;;;;;;OASG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;;;;;;;;;;OAaG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,4BAA4B,EAAE,MAAM,CAAC;IAErC;;;OAGG;IACH,4BAA4B,EAAE,MAAM,CAAC;IAErC;;;OAGG;IACH,2BAA2B,EAAE,MAAM,CAAC;IAEpC;;;;OAIG;IACH,2BAA2B,EAAE,MAAM,CAAC;IAEpC;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