@fluid-experimental/tree 2.23.0 → 2.31.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.
- package/CHANGELOG.md +135 -122
- package/api-extractor.json +6 -1
- package/api-report/experimental-tree.alpha.api.md +1 -0
- package/dist/EditLog.d.ts +4 -0
- package/dist/EditLog.d.ts.map +1 -1
- package/dist/EditLog.js.map +1 -1
- package/dist/migration-shim/migrationDeltaHandler.d.ts +1 -1
- package/dist/migration-shim/migrationDeltaHandler.d.ts.map +1 -1
- package/dist/migration-shim/migrationDeltaHandler.js +8 -1
- package/dist/migration-shim/migrationDeltaHandler.js.map +1 -1
- package/dist/migration-shim/sharedTreeDeltaHandler.d.ts +1 -2
- package/dist/migration-shim/sharedTreeDeltaHandler.d.ts.map +1 -1
- package/dist/migration-shim/sharedTreeDeltaHandler.js +8 -1
- package/dist/migration-shim/sharedTreeDeltaHandler.js.map +1 -1
- package/lib/EditLog.d.ts +4 -0
- package/lib/EditLog.d.ts.map +1 -1
- package/lib/EditLog.js.map +1 -1
- package/lib/migration-shim/migrationDeltaHandler.d.ts +1 -1
- package/lib/migration-shim/migrationDeltaHandler.d.ts.map +1 -1
- package/lib/migration-shim/migrationDeltaHandler.js +8 -1
- package/lib/migration-shim/migrationDeltaHandler.js.map +1 -1
- package/lib/migration-shim/sharedTreeDeltaHandler.d.ts +1 -2
- package/lib/migration-shim/sharedTreeDeltaHandler.d.ts.map +1 -1
- package/lib/migration-shim/sharedTreeDeltaHandler.js +8 -1
- package/lib/migration-shim/sharedTreeDeltaHandler.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +26 -39
- package/src/EditLog.ts +5 -0
- package/src/migration-shim/migrationDeltaHandler.ts +10 -3
- package/src/migration-shim/sharedTreeDeltaHandler.ts +10 -3
- package/prettier.config.cjs +0 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @fluid-experimental/tree
|
|
2
2
|
|
|
3
|
+
## 2.31.0
|
|
4
|
+
|
|
5
|
+
Dependency updates only.
|
|
6
|
+
|
|
7
|
+
## 2.30.0
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- The OrderedEditSet interface now has a getLocalEdits method ([#23244](https://github.com/microsoft/FluidFramework/pull/23244)) [429c0b717f](https://github.com/microsoft/FluidFramework/commit/429c0b717f37d18da0311dd69fcfc3bd10fea13c)
|
|
12
|
+
|
|
13
|
+
Previously, `EditLog` was imported to cast to this type for access to the `getLocalEdits` method. In addition, the
|
|
14
|
+
`./test/EditLog` export has been removed.
|
|
15
|
+
|
|
3
16
|
## 2.23.0
|
|
4
17
|
|
|
5
18
|
Dependency updates only.
|
|
@@ -56,45 +69,45 @@ Dependency updates only.
|
|
|
56
69
|
|
|
57
70
|
### Minor Changes
|
|
58
71
|
|
|
59
|
-
-
|
|
72
|
+
- Update to TypeScript 5.4 ([#21214](https://github.com/microsoft/FluidFramework/pull/21214)) [0e6256c722](https://github.com/microsoft/FluidFramework/commit/0e6256c722d8bf024f4325bf02547daeeb18bfa6)
|
|
60
73
|
|
|
61
|
-
|
|
74
|
+
Update package implementations to use TypeScript 5.4.5.
|
|
62
75
|
|
|
63
76
|
## 2.0.0-rc.4.0.0
|
|
64
77
|
|
|
65
78
|
### Minor Changes
|
|
66
79
|
|
|
67
|
-
-
|
|
80
|
+
- Deprecated members of IFluidHandle are split off into new IFluidHandleInternal interface [96872186d0](https://github.com/microsoft/FluidFramework/commit/96872186d0d0f245c1fece7d19b3743e501679b6)
|
|
68
81
|
|
|
69
|
-
|
|
70
|
-
|
|
82
|
+
Split IFluidHandle into two interfaces, `IFluidHandle` and `IFluidHandleInternal`.
|
|
83
|
+
Code depending on the previously deprecated members of IFluidHandle can access them by using `toFluidHandleInternal` from `@fluidframework/runtime-utils/legacy`.
|
|
71
84
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
85
|
+
External implementation of the `IFluidHandle` interface are not supported: this change makes the typing better convey this using the `ErasedType` pattern.
|
|
86
|
+
Any existing and previously working, and now broken, external implementations of `IFluidHandle` should still work at runtime, but will need some unsafe type casts to compile.
|
|
87
|
+
Such handle implementation may break in the future and thus should be replaced with use of handles produced by the Fluid Framework client packages.
|
|
75
88
|
|
|
76
89
|
## 2.0.0-rc.3.0.0
|
|
77
90
|
|
|
78
91
|
### Major Changes
|
|
79
92
|
|
|
80
|
-
-
|
|
93
|
+
- Packages now use package.json "exports" and require modern module resolution [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
|
|
81
94
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
95
|
+
Fluid Framework packages have been updated to use the [package.json "exports"
|
|
96
|
+
field](https://nodejs.org/docs/latest-v18.x/api/packages.html#exports) to define explicit entry points for both
|
|
97
|
+
TypeScript types and implementation code.
|
|
85
98
|
|
|
86
|
-
|
|
99
|
+
This means that using Fluid Framework packages require the following TypeScript settings in tsconfig.json:
|
|
87
100
|
|
|
88
|
-
|
|
89
|
-
|
|
101
|
+
- `"moduleResolution": "Node16"` with `"module": "Node16"`
|
|
102
|
+
- `"moduleResolution": "Bundler"` with `"module": "ESNext"`
|
|
90
103
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
104
|
+
We recommend using Node16/Node16 unless absolutely necessary. That will produce transpiled JavaScript that is suitable
|
|
105
|
+
for use with modern versions of Node.js _and_ Bundlers.
|
|
106
|
+
[See the TypeScript documentation](https://www.typescriptlang.org/tsconfig#moduleResolution) for more information
|
|
107
|
+
regarding the module and moduleResolution options.
|
|
95
108
|
|
|
96
|
-
|
|
97
|
-
|
|
109
|
+
**Node10 moduleResolution is not supported; it does not support Fluid Framework's API structuring pattern that is used
|
|
110
|
+
to distinguish stable APIs from those that are in development.**
|
|
98
111
|
|
|
99
112
|
## 2.0.0-rc.2.0.0
|
|
100
113
|
|
|
@@ -104,35 +117,35 @@ Dependency updates only.
|
|
|
104
117
|
|
|
105
118
|
### Minor Changes
|
|
106
119
|
|
|
107
|
-
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
120
|
+
- Updated server dependencies ([#19122](https://github.com/microsoft/FluidFramework/issues/19122)) [25366b4229](https://github.com/microsoft/FluidFramework/commits/25366b422918cb43685c5f328b50450749592902)
|
|
121
|
+
|
|
122
|
+
The following Fluid server dependencies have been updated to the latest version, 3.0.0. [See the full changelog.](https://github.com/microsoft/FluidFramework/releases/tag/server_v3.0.0)
|
|
123
|
+
|
|
124
|
+
- @fluidframework/gitresources
|
|
125
|
+
- @fluidframework/server-kafka-orderer
|
|
126
|
+
- @fluidframework/server-lambdas
|
|
127
|
+
- @fluidframework/server-lambdas-driver
|
|
128
|
+
- @fluidframework/server-local-server
|
|
129
|
+
- @fluidframework/server-memory-orderer
|
|
130
|
+
- @fluidframework/protocol-base
|
|
131
|
+
- @fluidframework/server-routerlicious
|
|
132
|
+
- @fluidframework/server-routerlicious-base
|
|
133
|
+
- @fluidframework/server-services
|
|
134
|
+
- @fluidframework/server-services-client
|
|
135
|
+
- @fluidframework/server-services-core
|
|
136
|
+
- @fluidframework/server-services-ordering-kafkanode
|
|
137
|
+
- @fluidframework/server-services-ordering-rdkafka
|
|
138
|
+
- @fluidframework/server-services-ordering-zookeeper
|
|
139
|
+
- @fluidframework/server-services-shared
|
|
140
|
+
- @fluidframework/server-services-telemetry
|
|
141
|
+
- @fluidframework/server-services-utils
|
|
142
|
+
- @fluidframework/server-test-utils
|
|
143
|
+
- tinylicious
|
|
144
|
+
|
|
145
|
+
- Updated @fluidframework/protocol-definitions ([#19122](https://github.com/microsoft/FluidFramework/issues/19122)) [25366b4229](https://github.com/microsoft/FluidFramework/commits/25366b422918cb43685c5f328b50450749592902)
|
|
146
|
+
|
|
147
|
+
The @fluidframework/protocol-definitions dependency has been upgraded to v3.1.0. [See the full
|
|
148
|
+
changelog.](https://github.com/microsoft/FluidFramework/blob/main/common/lib/protocol-definitions/CHANGELOG.md#310)
|
|
136
149
|
|
|
137
150
|
## 2.0.0-internal.8.0.0
|
|
138
151
|
|
|
@@ -158,45 +171,45 @@ Dependency updates only.
|
|
|
158
171
|
|
|
159
172
|
### Major Changes
|
|
160
173
|
|
|
161
|
-
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
-
|
|
198
|
-
|
|
199
|
-
|
|
174
|
+
- Dependencies on @fluidframework/protocol-definitions package updated to 3.0.0 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
175
|
+
|
|
176
|
+
This included the following changes from the protocol-definitions release:
|
|
177
|
+
|
|
178
|
+
- Updating signal interfaces for some planned improvements. The intention is split the interface between signals
|
|
179
|
+
submitted by clients to the server and the resulting signals sent from the server to clients.
|
|
180
|
+
- A new optional type member is available on the ISignalMessage interface and a new ISentSignalMessage interface has
|
|
181
|
+
been added, which will be the typing for signals sent from the client to the server. Both extend a new
|
|
182
|
+
ISignalMessageBase interface that contains common members.
|
|
183
|
+
- The @fluidframework/common-definitions package dependency has been updated to version 1.0.0.
|
|
184
|
+
|
|
185
|
+
- Server upgrade: dependencies on Fluid server packages updated to 2.0.1 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
186
|
+
|
|
187
|
+
Dependencies on the following Fluid server package have been updated to version 2.0.1:
|
|
188
|
+
|
|
189
|
+
- @fluidframework/gitresources: 2.0.1
|
|
190
|
+
- @fluidframework/server-kafka-orderer: 2.0.1
|
|
191
|
+
- @fluidframework/server-lambdas: 2.0.1
|
|
192
|
+
- @fluidframework/server-lambdas-driver: 2.0.1
|
|
193
|
+
- @fluidframework/server-local-server: 2.0.1
|
|
194
|
+
- @fluidframework/server-memory-orderer: 2.0.1
|
|
195
|
+
- @fluidframework/protocol-base: 2.0.1
|
|
196
|
+
- @fluidframework/server-routerlicious: 2.0.1
|
|
197
|
+
- @fluidframework/server-routerlicious-base: 2.0.1
|
|
198
|
+
- @fluidframework/server-services: 2.0.1
|
|
199
|
+
- @fluidframework/server-services-client: 2.0.1
|
|
200
|
+
- @fluidframework/server-services-core: 2.0.1
|
|
201
|
+
- @fluidframework/server-services-ordering-kafkanode: 2.0.1
|
|
202
|
+
- @fluidframework/server-services-ordering-rdkafka: 2.0.1
|
|
203
|
+
- @fluidframework/server-services-ordering-zookeeper: 2.0.1
|
|
204
|
+
- @fluidframework/server-services-shared: 2.0.1
|
|
205
|
+
- @fluidframework/server-services-telemetry: 2.0.1
|
|
206
|
+
- @fluidframework/server-services-utils: 2.0.1
|
|
207
|
+
- @fluidframework/server-test-utils: 2.0.1
|
|
208
|
+
- tinylicious: 2.0.1
|
|
209
|
+
|
|
210
|
+
- Minimum TypeScript version now 5.1.6 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
211
|
+
|
|
212
|
+
The minimum supported TypeScript version for Fluid 2.0 clients is now 5.1.6.
|
|
200
213
|
|
|
201
214
|
## 2.0.0-internal.6.4.0
|
|
202
215
|
|
|
@@ -210,32 +223,32 @@ Dependency updates only.
|
|
|
210
223
|
|
|
211
224
|
### Minor Changes
|
|
212
225
|
|
|
213
|
-
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
226
|
+
- Remove use of @fluidframework/common-definitions ([#16638](https://github.com/microsoft/FluidFramework/issues/16638)) [a8c81509c9](https://github.com/microsoft/FluidFramework/commits/a8c81509c9bf09cfb2092ebcf7265205f9eb6dbf)
|
|
227
|
+
|
|
228
|
+
The **@fluidframework/common-definitions** package is being deprecated, so the following interfaces and types are now
|
|
229
|
+
imported from the **@fluidframework/core-interfaces** package:
|
|
230
|
+
|
|
231
|
+
- interface IDisposable
|
|
232
|
+
- interface IErrorEvent
|
|
233
|
+
- interface IErrorEvent
|
|
234
|
+
- interface IEvent
|
|
235
|
+
- interface IEventProvider
|
|
236
|
+
- interface ILoggingError
|
|
237
|
+
- interface ITaggedTelemetryPropertyType
|
|
238
|
+
- interface ITelemetryBaseEvent
|
|
239
|
+
- interface ITelemetryBaseLogger
|
|
240
|
+
- interface ITelemetryErrorEvent
|
|
241
|
+
- interface ITelemetryGenericEvent
|
|
242
|
+
- interface ITelemetryLogger
|
|
243
|
+
- interface ITelemetryPerformanceEvent
|
|
244
|
+
- interface ITelemetryProperties
|
|
245
|
+
- type ExtendEventProvider
|
|
246
|
+
- type IEventThisPlaceHolder
|
|
247
|
+
- type IEventTransformer
|
|
248
|
+
- type ReplaceIEventThisPlaceHolder
|
|
249
|
+
- type ReplaceIEventThisPlaceHolder
|
|
250
|
+
- type TelemetryEventCategory
|
|
251
|
+
- type TelemetryEventPropertyType
|
|
239
252
|
|
|
240
253
|
## 2.0.0-internal.6.1.0
|
|
241
254
|
|
|
@@ -245,9 +258,9 @@ Dependency updates only.
|
|
|
245
258
|
|
|
246
259
|
### Major Changes
|
|
247
260
|
|
|
248
|
-
-
|
|
261
|
+
- Upgraded typescript transpilation target to ES2020 [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
249
262
|
|
|
250
|
-
|
|
263
|
+
Upgraded typescript transpilation target to ES2020. This is done in order to decrease the bundle sizes of Fluid Framework packages. This has provided size improvements across the board for ex. Loader, Driver, Runtime etc. Reduced bundle sizes helps to load lesser code in apps and hence also helps to improve the perf.If any app wants to target any older versions of browsers with which this target version is not compatible, then they can use packages like babel to transpile to a older target.
|
|
251
264
|
|
|
252
265
|
## 2.0.0-internal.5.4.0
|
|
253
266
|
|
|
@@ -257,12 +270,12 @@ Dependency updates only.
|
|
|
257
270
|
|
|
258
271
|
### Minor Changes
|
|
259
272
|
|
|
260
|
-
-
|
|
273
|
+
- Move closeAndGetPendingLocalState to IContainerExperimental ([#16302](https://github.com/microsoft/FluidFramework/issues/16302)) [93151af787](https://github.com/microsoft/FluidFramework/commits/93151af787b76e547cf3460df47f81832131db8c)
|
|
261
274
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
275
|
+
This change deprecates the experimental method closeAndGetPendingLocalState on IContainer and moves it to IContainerExperimental.
|
|
276
|
+
IContainerExperimental is an interface that is easily casted to, which enables partners to access experimental features for testing and evaluation.
|
|
277
|
+
Moving the experimental method off IContainer will reduce exposure and churn on that production interface as we iterate on and finalize our experimental features.
|
|
278
|
+
Experimental features should not be used in production environments.
|
|
266
279
|
|
|
267
280
|
## 2.0.0-internal.5.2.0
|
|
268
281
|
|
package/api-extractor.json
CHANGED
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
"extends": "../../../common/build/build-common/api-extractor-base.esm.no-legacy.json",
|
|
4
4
|
"apiReport": {
|
|
5
5
|
"enabled": true,
|
|
6
|
-
// Note: `tree.api.md` is the file used for the
|
|
6
|
+
// Note: `tree.api.md` is the file used for the public tree DDS's API report.
|
|
7
7
|
"reportFileName": "experimental-<unscopedPackageName>.api.md"
|
|
8
|
+
},
|
|
9
|
+
"docModel": {
|
|
10
|
+
"enabled": true,
|
|
11
|
+
// Note: `tree.api.json` is the file used for the public tree DDS's API report.
|
|
12
|
+
"apiJsonFilePath": "<projectFolder>/_api-extractor-temp/doc-models/experimental-<unscopedPackageName>.api.json"
|
|
8
13
|
}
|
|
9
14
|
}
|
|
@@ -496,6 +496,7 @@ export interface OrderedEditSet<TChange = unknown> {
|
|
|
496
496
|
getIdAtIndex(index: number): EditId;
|
|
497
497
|
// (undocumented)
|
|
498
498
|
getIndexOfId(editId: EditId): number;
|
|
499
|
+
getLocalEdits(): Iterable<Edit<TChange>>;
|
|
499
500
|
readonly length: number;
|
|
500
501
|
// @deprecated (undocumented)
|
|
501
502
|
tryGetEdit(editId: EditId): Promise<Edit<TChange> | undefined>;
|
package/dist/EditLog.d.ts
CHANGED
|
@@ -59,6 +59,10 @@ export interface OrderedEditSet<TChange = unknown> {
|
|
|
59
59
|
* @deprecated this will be removed in favor of {@link OrderedEditSet.tryGetEditAtIndex}
|
|
60
60
|
*/
|
|
61
61
|
getEditInSessionAtIndex(index: number): Edit<TChange>;
|
|
62
|
+
/**
|
|
63
|
+
* Gets all local edits.
|
|
64
|
+
*/
|
|
65
|
+
getLocalEdits(): Iterable<Edit<TChange>>;
|
|
62
66
|
}
|
|
63
67
|
/**
|
|
64
68
|
* Server-provided metadata for edits that have been sequenced.
|
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QAC3C,OAAO,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,IAAA,gBAAI,EAAC,gBAAgB,CAAC,CAAC;IAChE,CAAC;CACD;AAjbD,0BAibC","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 type { IEvent } from '@fluidframework/core-interfaces';\nimport { assert, compareArrays } from '@fluidframework/core-utils/internal';\nimport { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils/internal';\nimport { BTree } from '@tylerbu/sorted-btree-es6';\n\nimport type { ChangeCompressor } from './ChangeCompression.js';\nimport { fail } from './Common.js';\nimport type { EditId } from './Identifiers.js';\nimport type { StringInterner } from './StringInterner.js';\nimport { Edit, EditLogSummary, EditWithoutId, FluidEditHandle } from './persisted-types/index.js';\n\n/**\n * An ordered set of Edits associated with a SharedTree.\n * Supports fast lookup of edits by ID and enforces idempotence.\n * @sealed\n * @alpha\n */\nexport interface OrderedEditSet<TChange = unknown> {\n\t/**\n\t * The length of this `OrderedEditSet`.\n\t */\n\treadonly length: number;\n\n\t/**\n\t * The edit IDs of all edits in the log.\n\t */\n\treadonly editIds: readonly EditId[];\n\n\t/**\n\t * @returns the index of the edit with the given editId within this `OrderedEditSet`.\n\t */\n\tgetIndexOfId(editId: EditId): number;\n\n\t/**\n\t * @returns the id of the edit at the given index within this 'OrderedEditSet'.\n\t */\n\tgetIdAtIndex(index: number): EditId;\n\n\t/**\n\t * @returns the index of the edit with the given editId within this `OrderedEditSet`, or `undefined` if no such edit exists.\n\t */\n\ttryGetIndexOfId(editId: EditId): number | undefined;\n\n\t/**\n\t * @returns the edit at the given index within this `OrderedEditSet`.\n\t */\n\ttryGetEditAtIndex(index: number): Edit<TChange> | undefined;\n\n\t/**\n\t * @returns the edit with the given identifier within this `OrderedEditSet`.\n\t */\n\ttryGetEditFromId(editId: EditId): Edit<TChange> | undefined;\n\n\t/**\n\t * @returns the Edit associated with the EditId or undefined if there is no such edit in the set.\n\t * @deprecated Edit virtualization is no longer supported. Don't use the asynchronous APIs. Instead, use {@link OrderedEditSet.tryGetEditFromId}.\n\t */\n\ttryGetEdit(editId: EditId): Promise<Edit<TChange> | undefined>;\n\n\t/**\n\t * @returns the edit at the given index within this `OrderedEditSet`.\n\t * @deprecated Edit virtualization is no longer supported. Don't use the asynchronous APIs.\n\t */\n\tgetEditAtIndex(index: number): Promise<Edit<TChange>>;\n\n\t/**\n\t * @returns the edit at the given index. Must have been added to the log during the current session.\n\t * @deprecated this will be removed in favor of {@link OrderedEditSet.tryGetEditAtIndex}\n\t */\n\tgetEditInSessionAtIndex(index: number): Edit<TChange>;\n}\n\n/**\n * Server-provided metadata for edits that have been sequenced.\n */\nexport interface EditSequencingInfo {\n\t/**\n\t * The server-assigned sequence number of the op.\n\t */\n\treadonly sequenceNumber: number;\n\t/**\n\t * Last known sequenced edit at the time this op was issued.\n\t */\n\treadonly referenceSequenceNumber: number;\n}\n\n/**\n * Server-provided metadata for edits that have been sequenced.\n */\nexport interface MessageSequencingInfo extends EditSequencingInfo {\n\t/**\n\t * Last sequenced edit that all clients are guaranteed to be aware of.\n\t * If not specified, then some clients have not seen any edits yet.\n\t */\n\treadonly minimumSequenceNumber?: number;\n}\n\n/**\n * Metadata for a sequenced edit.\n */\nexport interface SequencedOrderedEditId {\n\treadonly isLocal: false;\n\treadonly index: number;\n\t/**\n\t * Information about the edit's relationship to other sequenced edits.\n\t * Undefined iff the edit was loaded from a summary.\n\t */\n\treadonly sequenceInfo?: EditSequencingInfo;\n}\n\n/**\n * Metadata for a local edit.\n */\nexport interface LocalOrderedEditId {\n\treadonly isLocal: true;\n\treadonly localSequence: number;\n}\n\n/**\n * Metadata for an edit.\n */\nexport type OrderedEditId = SequencedOrderedEditId | LocalOrderedEditId;\n\n/**\n * Compressor+interner pair used for encoding an {@link EditLog} into a summary.\n * @internal\n */\nexport interface EditLogEncoder {\n\tcompressor: ChangeCompressor;\n\tinterner: StringInterner;\n}\n\n/**\n * A sequence of edits that may or may not need to be downloaded into the EditLog from an external service\n * @deprecated Edit virtualization is no longer supported.\n */\nexport interface EditChunk<TChange> {\n\thandle?: EditHandle<TChange>;\n\tedits?: EditWithoutId<TChange>[];\n}\n/**\n * EditHandles are used to load edit chunks stored outside of the EditLog.\n * This is typically implemented by a wrapper around an IFluidHandle<ArrayBufferLike>.\n * @deprecated Edit virtualization is no longer supported.\n * @internal\n */\nexport interface EditHandle<TChange> {\n\treadonly get: () => Promise<EditWithoutId<TChange>[]>;\n\treadonly baseHandle: FluidEditHandle;\n}\n\n/**\n * Returns an object that separates an Edit into two fields, id and editWithoutId.\n */\nexport function separateEditAndId<TChange>(edit: Edit<TChange>): {\n\tid: EditId;\n\teditWithoutId: EditWithoutId<TChange>;\n} {\n\tconst editWithoutId = { ...edit, id: undefined };\n\tdelete editWithoutId.id;\n\treturn { id: edit.id, editWithoutId };\n}\n\n/**\n * @param summary - The edit log summary to parse.\n * @returns the number of handles saved to the provided edit log summary.\n * @deprecated Edit virtualization is no longer supported.\n */\nexport function getNumberOfHandlesFromEditLogSummary(summary: EditLogSummary<unknown, unknown>): number {\n\tconst { editChunks } = summary;\n\n\tlet numberOfHandles = 0;\n\teditChunks.forEach(({ chunk }) => {\n\t\tif (!Array.isArray(chunk)) {\n\t\t\tnumberOfHandles++;\n\t\t}\n\t});\n\n\treturn numberOfHandles;\n}\n\n/**\n * Event fired when an edit is added to an `EditLog`.\n * @param edit - The edit that was added to the log\n * @param isLocal - true iff this edit was generated locally\n */\nexport type EditAddedHandler<TChange> = (edit: Edit<TChange>, isLocal: boolean, wasLocal: boolean) => void;\n\n/**\n * Event fired before edits are evicted from the edit log. It takes in a count of the number of edits to evict\n * starting from the oldest in memory edit. To get the edit itself, call {@link EditLog.getEditAtIndex}.\n * The edit index corresponds to the count + {@link EditLog.earliestAvailableEditIndex}.\n */\nexport type EditEvictionHandler = (editsToEvict: number) => void;\n\n/**\n * Events which may be emitted by {@link EditLog}\n * @alpha\n */\nexport interface IEditLogEvents extends IEvent {\n\t(event: 'unexpectedHistoryChunk', listener: () => void);\n}\n\n/**\n * The edit history log for SharedTree.\n * Contains only completed edits (no in-progress edits).\n * Ordered first by locality (acked or local), then by time of insertion.\n * May not contain more than one edit with the same ID.\n * @sealed\n * @alpha\n */\nexport class EditLog<TChange = unknown> extends TypedEventEmitter<IEditLogEvents> implements OrderedEditSet<TChange> {\n\tprivate localEditSequence = 0;\n\n\tprivate readonly sequenceNumberToIndex?: BTree<number, number>;\n\tprivate _minSequenceNumber = 0;\n\n\tprivate readonly sequencedEdits: Edit<TChange>[] = [];\n\tprivate readonly localEdits: Edit<TChange>[] = [];\n\n\tprivate readonly allEditIds = new Map<EditId, OrderedEditId>();\n\tprivate _earliestAvailableEditIndex = 0;\n\tprivate readonly _editAddedHandlers = new Set<EditAddedHandler<TChange>>();\n\tprivate readonly _editEvictionHandlers = new Set<EditEvictionHandler>();\n\n\t/**\n\t * @returns The index of the earliest edit stored in this log.\n\t * Edit indices are unique and strictly increasing within the session.\n\t */\n\tpublic get earliestAvailableEditIndex(): number {\n\t\treturn this._earliestAvailableEditIndex;\n\t}\n\n\t/**\n\t * @returns The sequence number of the latest edit known by all nodes.\n\t */\n\tpublic get minSequenceNumber(): number {\n\t\treturn this._minSequenceNumber;\n\t}\n\n\t/**\n\t * Construct an `EditLog` using the given options.\n\t * @param summary - An edit log summary used to populate the edit log.\n\t * @param logger - An optional logger to record telemetry/errors\n\t * @param editAddedHandlers - Optional handlers that are called when edits are added.\n\t * @param targetLength - The target number of sequenced edits that the log will try to store in memory.\n\t * Depending on eviction frequency and the collaboration window, there can be more edits in memory at a given time.\n\t * Edits greater than or equal to the `minSequenceNumber` (aka in the collaboration window) are not evicted.\n\t * @param evictionFrequency - The rate at which edits are evicted from memory. This is a factor of the editLogSize.\n\t * For example, with the default frequency of inMemoryHistorySize * 2 and a size of 10, the log will evict once it reaches 20 sequenced edits\n\t * down to 10 edits, also keeping any that are still in the collaboration window.\n\t * @param editEvictionHandlers - Handlers that are called before edits are evicted from memory. This provides a chance for\n\t * callers to work with the edits before they are lost.\n\t */\n\tpublic constructor(\n\t\tsummary: EditLogSummary<TChange, EditHandle<TChange>> = { editIds: [], editChunks: [] },\n\t\tprivate readonly logger?: ITelemetryLoggerExt,\n\t\teditAddedHandlers: readonly EditAddedHandler<TChange>[] = [],\n\t\tprivate readonly targetLength = Infinity,\n\t\tprivate readonly evictionFrequency = targetLength * 2,\n\t\teditEvictionHandlers: readonly EditEvictionHandler[] = []\n\t) {\n\t\tsuper();\n\t\tconst { editChunks, editIds } = summary;\n\n\t\tfor (const handler of editAddedHandlers) {\n\t\t\tthis.registerEditAddedHandler(handler);\n\t\t}\n\n\t\tif (targetLength !== Infinity) {\n\t\t\tif (targetLength < 0 || evictionFrequency < 0) {\n\t\t\t\tfail('targetLength and evictionFrequency should not be negative');\n\t\t\t}\n\t\t\tthis.sequenceNumberToIndex = new BTree([[0, 0]]);\n\t\t\tfor (const handler of editEvictionHandlers) {\n\t\t\t\tthis.registerEditEvictionHandler(handler);\n\t\t\t}\n\t\t}\n\n\t\teditChunks.forEach((editChunkOrHandle) => {\n\t\t\tconst { startRevision, chunk } = editChunkOrHandle;\n\n\t\t\tif (Array.isArray(chunk)) {\n\t\t\t\tfor (const [index, edit] of chunk.entries()) {\n\t\t\t\t\tconst editIndex = startRevision + index;\n\t\t\t\t\tconst id = editIds[editIndex];\n\t\t\t\t\tthis.sequencedEdits.push({ id, ...edit });\n\t\t\t\t\tconst encounteredEditId = this.allEditIds.get(id);\n\t\t\t\t\tassert(encounteredEditId === undefined, 0x60a /* Duplicate acked edit. */);\n\t\t\t\t\tthis.allEditIds.set(id, { isLocal: false, index: editIndex });\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Ignore any edit handles, these edits are now unrecoverable.\n\t\t\t\t// This should instead download the edit chunk and store them but history is not\n\t\t\t\t// being used so we're going with the simpler solution.\n\t\t\t\tthis.logger?.sendErrorEvent({ eventName: 'UnexpectedEditHandleInSummary' });\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Registers a handler for when an edit is added to this `EditLog`.\n\t * @returns A callback which can be invoked to unregister this handler.\n\t */\n\tpublic registerEditAddedHandler(handler: EditAddedHandler<TChange>): () => void {\n\t\tthis._editAddedHandlers.add(handler);\n\t\treturn () => this._editAddedHandlers.delete(handler);\n\t}\n\n\t/**\n\t * @returns the `EditAddedHandler`s registered on this `EditLog`.\n\t */\n\tpublic get editAddedHandlers(): readonly EditAddedHandler<TChange>[] {\n\t\treturn Array.from(this._editAddedHandlers);\n\t}\n\n\t/**\n\t * Registers a handler that is called before an edit is evicted from this `EditLog`.\n\t * @returns A callback which can be invoked to unregister this handler.\n\t */\n\tpublic registerEditEvictionHandler(handler: EditEvictionHandler): () => void {\n\t\tthis._editEvictionHandlers.add(handler);\n\t\treturn () => this._editEvictionHandlers.delete(handler);\n\t}\n\n\t/**\n\t * @returns the `EditEvictedHandler`s registered on this `EditLog`.\n\t */\n\tpublic get editEvictedHandlers(): readonly EditEvictionHandler[] {\n\t\treturn Array.from(this._editEvictionHandlers);\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.length}\n\t */\n\tpublic get length(): number {\n\t\treturn this.numberOfSequencedEdits + this.numberOfLocalEdits;\n\t}\n\n\t/**\n\t * The number of sequenced (acked) edits in the log.\n\t */\n\tpublic get numberOfSequencedEdits(): number {\n\t\treturn this.sequencedEdits.length;\n\t}\n\n\t/**\n\t * The number of local (unacked) edits in the log.\n\t */\n\tpublic get numberOfLocalEdits(): number {\n\t\treturn this.localEdits.length;\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.editIds}\n\t */\n\tpublic get editIds(): EditId[] {\n\t\treturn this.sequencedEdits.map(({ id }) => id).concat(this.localEdits.map(({ id }) => id));\n\t}\n\n\t/**\n\t * @returns true iff the edit is contained in this 'EditLog' and it is a local edit (not sequenced).\n\t */\n\tpublic isLocalEdit(editId: EditId): boolean {\n\t\tconst entry = this.allEditIds.get(editId);\n\t\treturn entry?.isLocal ?? false;\n\t}\n\n\t/**\n\t * @returns true iff the revision is a sequenced revision (not local).\n\t */\n\tpublic isSequencedRevision(revision: number): boolean {\n\t\treturn revision <= this.sequencedEdits.length;\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.tryGetIndexOfId}\n\t */\n\tpublic tryGetIndexOfId(editId: EditId): number | undefined {\n\t\tconst orderedEdit = this.allEditIds.get(editId);\n\t\tif (orderedEdit === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (orderedEdit.isLocal) {\n\t\t\tconst firstLocal = this.allEditIds.get(this.localEdits[0].id) ?? fail('edit not found');\n\t\t\tassert(firstLocal.isLocal, 0x60b /* local edit should be local */);\n\t\t\treturn (\n\t\t\t\tthis._earliestAvailableEditIndex +\n\t\t\t\tthis.numberOfSequencedEdits +\n\t\t\t\torderedEdit.localSequence -\n\t\t\t\tfirstLocal.localSequence\n\t\t\t);\n\t\t}\n\t\treturn orderedEdit.index;\n\t}\n\n\t/**\n\t * @returns Edit metadata for the edit with the given `editId`.\n\t */\n\tpublic getOrderedEditId(editId: EditId): OrderedEditId {\n\t\treturn this.allEditIds.get(editId) ?? fail('All edits should exist in this map');\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.getIndexOfId}\n\t */\n\tpublic getIndexOfId(editId: EditId): number {\n\t\treturn this.tryGetIndexOfId(editId) ?? fail('edit not found');\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.getIdAtIndex}\n\t */\n\tpublic getIdAtIndex(index: number): EditId {\n\t\tif (this._earliestAvailableEditIndex + this.numberOfSequencedEdits <= index) {\n\t\t\treturn this.localEdits[index - this.numberOfSequencedEdits].id;\n\t\t}\n\n\t\treturn this.sequencedEdits[index - this._earliestAvailableEditIndex].id;\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.tryGetEditAtIndex}\n\t */\n\tpublic tryGetEditAtIndex(index: number): Edit<TChange> | undefined {\n\t\tif (this._earliestAvailableEditIndex + this.numberOfSequencedEdits <= index) {\n\t\t\treturn this.localEdits[index - this.numberOfSequencedEdits];\n\t\t}\n\n\t\treturn this.sequencedEdits[index - this._earliestAvailableEditIndex];\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.tryGetEditFromId}\n\t */\n\tpublic tryGetEditFromId(editId: EditId): Edit<TChange> | undefined {\n\t\tconst index = this.tryGetIndexOfId(editId);\n\t\treturn index !== undefined ? this.tryGetEditAtIndex(index) : undefined;\n\t}\n\n\t/**\n\t * Sequences all local edits.\n\t */\n\tpublic sequenceLocalEdits(): void {\n\t\tthis.localEdits.slice().forEach((edit) => this.addSequencedEditInternal(edit));\n\t}\n\n\t/**\n\t * Adds a sequenced (non-local) edit to the edit log.\n\t * If the id of the supplied edit matches a local edit already present in the log, the local edit will be replaced.\n\t *\n\t */\n\tpublic addSequencedEdit(edit: Edit<TChange>, message: MessageSequencingInfo): void {\n\t\tthis.addSequencedEditInternal(edit, message, message.minimumSequenceNumber);\n\t}\n\n\t/**\n\t * Returns all local edits from this EditLog\n\t * This is useful for op format upgrades, which might warrant re-submission of these ops using the new format.\n\t * See the breaking change documentation for more information.\n\t */\n\tpublic *getLocalEdits(): Iterable<Edit<TChange>> {\n\t\tfor (const edit of this.localEdits) {\n\t\t\tyield edit;\n\t\t}\n\t}\n\n\t/**\n\t * Adds a sequenced (non-local) edit to the edit log.\n\t * If the id of the supplied edit matches a local edit already present in the log, the local edit will be replaced.\n\t */\n\tprivate addSequencedEditInternal(\n\t\tedit: Edit<TChange>,\n\t\tinfo?: EditSequencingInfo,\n\t\tminSequenceNumber: number = 0\n\t): void {\n\t\tassert(\n\t\t\tminSequenceNumber >= this._minSequenceNumber,\n\t\t\t0x60c /* Sequenced edits should carry a monotonically increasing min number */\n\t\t);\n\t\tthis._minSequenceNumber = minSequenceNumber;\n\n\t\tconst { id } = edit;\n\t\t// The index of the sequenced edit to add\n\t\tconst index = this._earliestAvailableEditIndex + this.numberOfSequencedEdits;\n\n\t\t// Remove the edit from local edits if it exists.\n\t\tconst encounteredEditId = this.allEditIds.get(id);\n\t\tif (encounteredEditId !== undefined) {\n\t\t\t// New edit already exits: it must have been a local edit.\n\t\t\tassert(encounteredEditId.isLocal, 0x60d /* Duplicate acked edit. */);\n\t\t\t// Remove it from localEdits. Due to ordering requirements, it must be first.\n\t\t\tconst oldLocalEditId = this.localEdits.shift()?.id ?? fail('Local edit should exist');\n\t\t\tassert(oldLocalEditId === id, 0x60e /* Causal ordering should be upheld */);\n\t\t}\n\n\t\tthis.sequencedEdits.push(edit);\n\n\t\tconst sequencedEditId: SequencedOrderedEditId = {\n\t\t\tindex,\n\t\t\tisLocal: false,\n\t\t\tsequenceInfo: info,\n\t\t};\n\t\tthis.allEditIds.set(id, sequencedEditId);\n\t\tif (info !== undefined) {\n\t\t\tthis.sequenceNumberToIndex?.set(info.sequenceNumber, index);\n\t\t}\n\t\tthis.emitAdd(edit, false, encounteredEditId !== undefined);\n\n\t\t// Check if any edits need to be evicted due to this addition\n\t\tif (this.sequenceNumberToIndex !== undefined && this.numberOfSequencedEdits >= this.evictionFrequency) {\n\t\t\tthis.evictEdits();\n\t\t}\n\t}\n\n\t/**\n\t * Adds a non-sequenced (local) edit to the edit log.\n\t * Duplicate edits are ignored.\n\t */\n\tpublic addLocalEdit(edit: Edit<TChange>): void {\n\t\tthis.localEdits.push(edit);\n\t\tconst localEditId: LocalOrderedEditId = {\n\t\t\tlocalSequence: this.localEditSequence++,\n\t\t\tisLocal: true,\n\t\t};\n\t\tthis.allEditIds.set(edit.id, localEditId);\n\t\tthis.emitAdd(edit, true, false);\n\t}\n\n\tprivate emitAdd(editAdded: Edit<TChange>, isLocal: boolean, wasLocal: boolean): void {\n\t\tfor (const handler of this._editAddedHandlers) {\n\t\t\thandler(editAdded, isLocal, wasLocal);\n\t\t}\n\t}\n\n\tprivate evictEdits(): void {\n\t\tassert(\n\t\t\tthis.sequenceNumberToIndex !== undefined,\n\t\t\t0x60f /* Edits should never be evicted if the target length is set to infinity */\n\t\t);\n\n\t\tconst minSequenceIndex =\n\t\t\tthis.sequenceNumberToIndex.getPairOrNextHigher(this._minSequenceNumber)?.[1] ??\n\t\t\tfail('No index associated with that sequence number.');\n\t\t// Exclude any edits in the collab window from being evicted\n\t\tconst numberOfEvictableEdits = minSequenceIndex - this.earliestAvailableEditIndex;\n\n\t\tif (numberOfEvictableEdits > 0) {\n\t\t\t// Evict either all but the target log size or the number of evictable edits, whichever is smaller\n\t\t\tconst numberOfDesiredEditsToEvict = this.numberOfSequencedEdits - this.targetLength;\n\t\t\tconst numberOfEditsToEvict = Math.min(numberOfEvictableEdits, numberOfDesiredEditsToEvict);\n\t\t\tfor (const handler of this._editEvictionHandlers) {\n\t\t\t\thandler(numberOfEditsToEvict);\n\t\t\t}\n\n\t\t\t// Remove the edits and move up the earliest available index\n\t\t\tconst removedEdits = this.sequencedEdits.splice(0, numberOfEditsToEvict);\n\t\t\tthis._earliestAvailableEditIndex += numberOfEditsToEvict;\n\n\t\t\t// On eviction, we need to remove the IDs of edits that have been evicted\n\t\t\tremovedEdits.forEach((edit) => this.allEditIds.delete(edit.id));\n\n\t\t\t// The minSequenceNumber is strictly increasing so we can clear sequence numbers before it\n\t\t\tthis.sequenceNumberToIndex.deleteRange(0, this._minSequenceNumber, false);\n\t\t}\n\t}\n\n\t/**\n\t * @returns true iff this `EditLog` and `other` are equivalent, regardless of locality.\n\t */\n\tpublic equals<TOtherChangeTypesInternal>(other: EditLog<TOtherChangeTypesInternal>): boolean {\n\t\t// TODO #45414: We should also be deep comparing the list of changes in the edit. This is not straightforward.\n\t\t// We can use our edit validation code when we write it since it will need to do deep walks of the changes.\n\t\treturn compareArrays(this.editIds, other.editIds);\n\t}\n\n\t/**\n\t * @returns the summary of this `OrderedEditSet` that can be used to reconstruct the edit set.\n\t */\n\tpublic getEditLogSummary(): EditLogSummary<TChange, FluidEditHandle>;\n\n\t/**\n\t * @param compressEdit - a function which compresses edits\n\t * @returns the summary of this `OrderedEditSet` that can be used to reconstruct the edit set.\n\t */\n\tpublic getEditLogSummary<TCompressedChange>(\n\t\tcompressEdit: (edit: Pick<Edit<TChange>, 'changes'>) => Pick<Edit<TCompressedChange>, 'changes'>\n\t): EditLogSummary<TCompressedChange, FluidEditHandle>;\n\tpublic getEditLogSummary<TCompressedChange>(\n\t\tcompressEdit?: (edit: Pick<Edit<TChange>, 'changes'>) => Pick<Edit<TCompressedChange>, 'changes'>\n\t): EditLogSummary<TChange, FluidEditHandle> | EditLogSummary<TCompressedChange, FluidEditHandle> {\n\t\tconst editIds = this.sequencedEdits.map(({ id }) => id);\n\t\treturn compressEdit !== undefined\n\t\t\t? {\n\t\t\t\t\teditChunks:\n\t\t\t\t\t\tthis.sequencedEdits.length === 0\n\t\t\t\t\t\t\t? []\n\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\t\t// Store all edits within a single \"chunk\"\n\t\t\t\t\t\t\t\t\t\tstartRevision: 0,\n\t\t\t\t\t\t\t\t\t\tchunk: this.sequencedEdits.map((edit) => compressEdit(edit)),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\teditIds,\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\teditChunks:\n\t\t\t\t\t\tthis.sequencedEdits.length === 0\n\t\t\t\t\t\t\t? []\n\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\t\t// Store all edits within a single \"chunk\"\n\t\t\t\t\t\t\t\t\t\tstartRevision: 0,\n\t\t\t\t\t\t\t\t\t\tchunk: this.sequencedEdits.map(({ changes }) => ({ changes })),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\teditIds,\n\t\t\t\t};\n\t}\n\n\t// APIS DEPRECATED DUE TO HISTORY'S PEACEFUL DEATH\n\t/**\n\t * @deprecated Edit virtualization is no longer supported. Don't use the asynchronous APIs. Instead, use {@link OrderedEditSet.tryGetEditFromId}.\n\t */\n\tpublic async tryGetEdit(editId: EditId): Promise<Edit<TChange> | undefined> {\n\t\tconst index = this.tryGetIndexOfId(editId);\n\t\treturn index !== undefined ? this.tryGetEditAtIndex(index) : undefined;\n\t}\n\n\t/**\n\t * @deprecated Edit virtualization is no longer supported. Don't use the asynchronous APIs. Instead, use {@link OrderedEditSet.tryGetEditFromId}.\n\t */\n\tpublic async getEditAtIndex(index: number): Promise<Edit<TChange>> {\n\t\treturn this.tryGetEditAtIndex(index) ?? fail('Edit not found');\n\t}\n\n\t/**\n\t * @deprecated Edit virtualization is no longer supported. Instead, use {@link OrderedEditSet.tryGetEditFromId}.\n\t */\n\tpublic getEditInSessionAtIndex(index: number): Edit<TChange> {\n\t\treturn this.tryGetEditAtIndex(index) ?? fail('Edit not found');\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"EditLog.js","sourceRoot":"","sources":["../src/EditLog.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AAEjE,kEAA4E;AAE5E,gEAAkD;AAGlD,2CAAmC;AAsJnC;;GAEG;AACH,SAAgB,iBAAiB,CAAU,IAAmB;IAI7D,MAAM,aAAa,GAAG,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC;IACjD,OAAO,aAAa,CAAC,EAAE,CAAC;IACxB,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,aAAa,EAAE,CAAC;AACvC,CAAC;AAPD,8CAOC;AAED;;;;GAIG;AACH,SAAgB,oCAAoC,CAAC,OAAyC;IAC7F,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAE/B,IAAI,eAAe,GAAG,CAAC,CAAC;IACxB,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;QAChC,IAAI,CAAC,KAAK,CA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IAChE,CAAC;CACD;AAjbD,0BAibC","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 type { IEvent } from '@fluidframework/core-interfaces';\nimport { assert, compareArrays } from '@fluidframework/core-utils/internal';\nimport { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils/internal';\nimport { BTree } from '@tylerbu/sorted-btree-es6';\n\nimport type { ChangeCompressor } from './ChangeCompression.js';\nimport { fail } from './Common.js';\nimport type { EditId } from './Identifiers.js';\nimport type { StringInterner } from './StringInterner.js';\nimport { Edit, EditLogSummary, EditWithoutId, FluidEditHandle } from './persisted-types/index.js';\n\n/**\n * An ordered set of Edits associated with a SharedTree.\n * Supports fast lookup of edits by ID and enforces idempotence.\n * @sealed\n * @alpha\n */\nexport interface OrderedEditSet<TChange = unknown> {\n\t/**\n\t * The length of this `OrderedEditSet`.\n\t */\n\treadonly length: number;\n\n\t/**\n\t * The edit IDs of all edits in the log.\n\t */\n\treadonly editIds: readonly EditId[];\n\n\t/**\n\t * @returns the index of the edit with the given editId within this `OrderedEditSet`.\n\t */\n\tgetIndexOfId(editId: EditId): number;\n\n\t/**\n\t * @returns the id of the edit at the given index within this 'OrderedEditSet'.\n\t */\n\tgetIdAtIndex(index: number): EditId;\n\n\t/**\n\t * @returns the index of the edit with the given editId within this `OrderedEditSet`, or `undefined` if no such edit exists.\n\t */\n\ttryGetIndexOfId(editId: EditId): number | undefined;\n\n\t/**\n\t * @returns the edit at the given index within this `OrderedEditSet`.\n\t */\n\ttryGetEditAtIndex(index: number): Edit<TChange> | undefined;\n\n\t/**\n\t * @returns the edit with the given identifier within this `OrderedEditSet`.\n\t */\n\ttryGetEditFromId(editId: EditId): Edit<TChange> | undefined;\n\n\t/**\n\t * @returns the Edit associated with the EditId or undefined if there is no such edit in the set.\n\t * @deprecated Edit virtualization is no longer supported. Don't use the asynchronous APIs. Instead, use {@link OrderedEditSet.tryGetEditFromId}.\n\t */\n\ttryGetEdit(editId: EditId): Promise<Edit<TChange> | undefined>;\n\n\t/**\n\t * @returns the edit at the given index within this `OrderedEditSet`.\n\t * @deprecated Edit virtualization is no longer supported. Don't use the asynchronous APIs.\n\t */\n\tgetEditAtIndex(index: number): Promise<Edit<TChange>>;\n\n\t/**\n\t * @returns the edit at the given index. Must have been added to the log during the current session.\n\t * @deprecated this will be removed in favor of {@link OrderedEditSet.tryGetEditAtIndex}\n\t */\n\tgetEditInSessionAtIndex(index: number): Edit<TChange>;\n\n\t/**\n\t * Gets all local edits.\n\t */\n\tgetLocalEdits(): Iterable<Edit<TChange>>;\n}\n\n/**\n * Server-provided metadata for edits that have been sequenced.\n */\nexport interface EditSequencingInfo {\n\t/**\n\t * The server-assigned sequence number of the op.\n\t */\n\treadonly sequenceNumber: number;\n\t/**\n\t * Last known sequenced edit at the time this op was issued.\n\t */\n\treadonly referenceSequenceNumber: number;\n}\n\n/**\n * Server-provided metadata for edits that have been sequenced.\n */\nexport interface MessageSequencingInfo extends EditSequencingInfo {\n\t/**\n\t * Last sequenced edit that all clients are guaranteed to be aware of.\n\t * If not specified, then some clients have not seen any edits yet.\n\t */\n\treadonly minimumSequenceNumber?: number;\n}\n\n/**\n * Metadata for a sequenced edit.\n */\nexport interface SequencedOrderedEditId {\n\treadonly isLocal: false;\n\treadonly index: number;\n\t/**\n\t * Information about the edit's relationship to other sequenced edits.\n\t * Undefined iff the edit was loaded from a summary.\n\t */\n\treadonly sequenceInfo?: EditSequencingInfo;\n}\n\n/**\n * Metadata for a local edit.\n */\nexport interface LocalOrderedEditId {\n\treadonly isLocal: true;\n\treadonly localSequence: number;\n}\n\n/**\n * Metadata for an edit.\n */\nexport type OrderedEditId = SequencedOrderedEditId | LocalOrderedEditId;\n\n/**\n * Compressor+interner pair used for encoding an {@link EditLog} into a summary.\n * @internal\n */\nexport interface EditLogEncoder {\n\tcompressor: ChangeCompressor;\n\tinterner: StringInterner;\n}\n\n/**\n * A sequence of edits that may or may not need to be downloaded into the EditLog from an external service\n * @deprecated Edit virtualization is no longer supported.\n */\nexport interface EditChunk<TChange> {\n\thandle?: EditHandle<TChange>;\n\tedits?: EditWithoutId<TChange>[];\n}\n/**\n * EditHandles are used to load edit chunks stored outside of the EditLog.\n * This is typically implemented by a wrapper around an IFluidHandle<ArrayBufferLike>.\n * @deprecated Edit virtualization is no longer supported.\n * @internal\n */\nexport interface EditHandle<TChange> {\n\treadonly get: () => Promise<EditWithoutId<TChange>[]>;\n\treadonly baseHandle: FluidEditHandle;\n}\n\n/**\n * Returns an object that separates an Edit into two fields, id and editWithoutId.\n */\nexport function separateEditAndId<TChange>(edit: Edit<TChange>): {\n\tid: EditId;\n\teditWithoutId: EditWithoutId<TChange>;\n} {\n\tconst editWithoutId = { ...edit, id: undefined };\n\tdelete editWithoutId.id;\n\treturn { id: edit.id, editWithoutId };\n}\n\n/**\n * @param summary - The edit log summary to parse.\n * @returns the number of handles saved to the provided edit log summary.\n * @deprecated Edit virtualization is no longer supported.\n */\nexport function getNumberOfHandlesFromEditLogSummary(summary: EditLogSummary<unknown, unknown>): number {\n\tconst { editChunks } = summary;\n\n\tlet numberOfHandles = 0;\n\teditChunks.forEach(({ chunk }) => {\n\t\tif (!Array.isArray(chunk)) {\n\t\t\tnumberOfHandles++;\n\t\t}\n\t});\n\n\treturn numberOfHandles;\n}\n\n/**\n * Event fired when an edit is added to an `EditLog`.\n * @param edit - The edit that was added to the log\n * @param isLocal - true iff this edit was generated locally\n */\nexport type EditAddedHandler<TChange> = (edit: Edit<TChange>, isLocal: boolean, wasLocal: boolean) => void;\n\n/**\n * Event fired before edits are evicted from the edit log. It takes in a count of the number of edits to evict\n * starting from the oldest in memory edit. To get the edit itself, call {@link EditLog.getEditAtIndex}.\n * The edit index corresponds to the count + {@link EditLog.earliestAvailableEditIndex}.\n */\nexport type EditEvictionHandler = (editsToEvict: number) => void;\n\n/**\n * Events which may be emitted by {@link EditLog}\n * @alpha\n */\nexport interface IEditLogEvents extends IEvent {\n\t(event: 'unexpectedHistoryChunk', listener: () => void);\n}\n\n/**\n * The edit history log for SharedTree.\n * Contains only completed edits (no in-progress edits).\n * Ordered first by locality (acked or local), then by time of insertion.\n * May not contain more than one edit with the same ID.\n * @sealed\n * @alpha\n */\nexport class EditLog<TChange = unknown> extends TypedEventEmitter<IEditLogEvents> implements OrderedEditSet<TChange> {\n\tprivate localEditSequence = 0;\n\n\tprivate readonly sequenceNumberToIndex?: BTree<number, number>;\n\tprivate _minSequenceNumber = 0;\n\n\tprivate readonly sequencedEdits: Edit<TChange>[] = [];\n\tprivate readonly localEdits: Edit<TChange>[] = [];\n\n\tprivate readonly allEditIds = new Map<EditId, OrderedEditId>();\n\tprivate _earliestAvailableEditIndex = 0;\n\tprivate readonly _editAddedHandlers = new Set<EditAddedHandler<TChange>>();\n\tprivate readonly _editEvictionHandlers = new Set<EditEvictionHandler>();\n\n\t/**\n\t * @returns The index of the earliest edit stored in this log.\n\t * Edit indices are unique and strictly increasing within the session.\n\t */\n\tpublic get earliestAvailableEditIndex(): number {\n\t\treturn this._earliestAvailableEditIndex;\n\t}\n\n\t/**\n\t * @returns The sequence number of the latest edit known by all nodes.\n\t */\n\tpublic get minSequenceNumber(): number {\n\t\treturn this._minSequenceNumber;\n\t}\n\n\t/**\n\t * Construct an `EditLog` using the given options.\n\t * @param summary - An edit log summary used to populate the edit log.\n\t * @param logger - An optional logger to record telemetry/errors\n\t * @param editAddedHandlers - Optional handlers that are called when edits are added.\n\t * @param targetLength - The target number of sequenced edits that the log will try to store in memory.\n\t * Depending on eviction frequency and the collaboration window, there can be more edits in memory at a given time.\n\t * Edits greater than or equal to the `minSequenceNumber` (aka in the collaboration window) are not evicted.\n\t * @param evictionFrequency - The rate at which edits are evicted from memory. This is a factor of the editLogSize.\n\t * For example, with the default frequency of inMemoryHistorySize * 2 and a size of 10, the log will evict once it reaches 20 sequenced edits\n\t * down to 10 edits, also keeping any that are still in the collaboration window.\n\t * @param editEvictionHandlers - Handlers that are called before edits are evicted from memory. This provides a chance for\n\t * callers to work with the edits before they are lost.\n\t */\n\tpublic constructor(\n\t\tsummary: EditLogSummary<TChange, EditHandle<TChange>> = { editIds: [], editChunks: [] },\n\t\tprivate readonly logger?: ITelemetryLoggerExt,\n\t\teditAddedHandlers: readonly EditAddedHandler<TChange>[] = [],\n\t\tprivate readonly targetLength = Infinity,\n\t\tprivate readonly evictionFrequency = targetLength * 2,\n\t\teditEvictionHandlers: readonly EditEvictionHandler[] = []\n\t) {\n\t\tsuper();\n\t\tconst { editChunks, editIds } = summary;\n\n\t\tfor (const handler of editAddedHandlers) {\n\t\t\tthis.registerEditAddedHandler(handler);\n\t\t}\n\n\t\tif (targetLength !== Infinity) {\n\t\t\tif (targetLength < 0 || evictionFrequency < 0) {\n\t\t\t\tfail('targetLength and evictionFrequency should not be negative');\n\t\t\t}\n\t\t\tthis.sequenceNumberToIndex = new BTree([[0, 0]]);\n\t\t\tfor (const handler of editEvictionHandlers) {\n\t\t\t\tthis.registerEditEvictionHandler(handler);\n\t\t\t}\n\t\t}\n\n\t\teditChunks.forEach((editChunkOrHandle) => {\n\t\t\tconst { startRevision, chunk } = editChunkOrHandle;\n\n\t\t\tif (Array.isArray(chunk)) {\n\t\t\t\tfor (const [index, edit] of chunk.entries()) {\n\t\t\t\t\tconst editIndex = startRevision + index;\n\t\t\t\t\tconst id = editIds[editIndex];\n\t\t\t\t\tthis.sequencedEdits.push({ id, ...edit });\n\t\t\t\t\tconst encounteredEditId = this.allEditIds.get(id);\n\t\t\t\t\tassert(encounteredEditId === undefined, 0x60a /* Duplicate acked edit. */);\n\t\t\t\t\tthis.allEditIds.set(id, { isLocal: false, index: editIndex });\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Ignore any edit handles, these edits are now unrecoverable.\n\t\t\t\t// This should instead download the edit chunk and store them but history is not\n\t\t\t\t// being used so we're going with the simpler solution.\n\t\t\t\tthis.logger?.sendErrorEvent({ eventName: 'UnexpectedEditHandleInSummary' });\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Registers a handler for when an edit is added to this `EditLog`.\n\t * @returns A callback which can be invoked to unregister this handler.\n\t */\n\tpublic registerEditAddedHandler(handler: EditAddedHandler<TChange>): () => void {\n\t\tthis._editAddedHandlers.add(handler);\n\t\treturn () => this._editAddedHandlers.delete(handler);\n\t}\n\n\t/**\n\t * @returns the `EditAddedHandler`s registered on this `EditLog`.\n\t */\n\tpublic get editAddedHandlers(): readonly EditAddedHandler<TChange>[] {\n\t\treturn Array.from(this._editAddedHandlers);\n\t}\n\n\t/**\n\t * Registers a handler that is called before an edit is evicted from this `EditLog`.\n\t * @returns A callback which can be invoked to unregister this handler.\n\t */\n\tpublic registerEditEvictionHandler(handler: EditEvictionHandler): () => void {\n\t\tthis._editEvictionHandlers.add(handler);\n\t\treturn () => this._editEvictionHandlers.delete(handler);\n\t}\n\n\t/**\n\t * @returns the `EditEvictedHandler`s registered on this `EditLog`.\n\t */\n\tpublic get editEvictedHandlers(): readonly EditEvictionHandler[] {\n\t\treturn Array.from(this._editEvictionHandlers);\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.length}\n\t */\n\tpublic get length(): number {\n\t\treturn this.numberOfSequencedEdits + this.numberOfLocalEdits;\n\t}\n\n\t/**\n\t * The number of sequenced (acked) edits in the log.\n\t */\n\tpublic get numberOfSequencedEdits(): number {\n\t\treturn this.sequencedEdits.length;\n\t}\n\n\t/**\n\t * The number of local (unacked) edits in the log.\n\t */\n\tpublic get numberOfLocalEdits(): number {\n\t\treturn this.localEdits.length;\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.editIds}\n\t */\n\tpublic get editIds(): EditId[] {\n\t\treturn this.sequencedEdits.map(({ id }) => id).concat(this.localEdits.map(({ id }) => id));\n\t}\n\n\t/**\n\t * @returns true iff the edit is contained in this 'EditLog' and it is a local edit (not sequenced).\n\t */\n\tpublic isLocalEdit(editId: EditId): boolean {\n\t\tconst entry = this.allEditIds.get(editId);\n\t\treturn entry?.isLocal ?? false;\n\t}\n\n\t/**\n\t * @returns true iff the revision is a sequenced revision (not local).\n\t */\n\tpublic isSequencedRevision(revision: number): boolean {\n\t\treturn revision <= this.sequencedEdits.length;\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.tryGetIndexOfId}\n\t */\n\tpublic tryGetIndexOfId(editId: EditId): number | undefined {\n\t\tconst orderedEdit = this.allEditIds.get(editId);\n\t\tif (orderedEdit === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (orderedEdit.isLocal) {\n\t\t\tconst firstLocal = this.allEditIds.get(this.localEdits[0].id) ?? fail('edit not found');\n\t\t\tassert(firstLocal.isLocal, 0x60b /* local edit should be local */);\n\t\t\treturn (\n\t\t\t\tthis._earliestAvailableEditIndex +\n\t\t\t\tthis.numberOfSequencedEdits +\n\t\t\t\torderedEdit.localSequence -\n\t\t\t\tfirstLocal.localSequence\n\t\t\t);\n\t\t}\n\t\treturn orderedEdit.index;\n\t}\n\n\t/**\n\t * @returns Edit metadata for the edit with the given `editId`.\n\t */\n\tpublic getOrderedEditId(editId: EditId): OrderedEditId {\n\t\treturn this.allEditIds.get(editId) ?? fail('All edits should exist in this map');\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.getIndexOfId}\n\t */\n\tpublic getIndexOfId(editId: EditId): number {\n\t\treturn this.tryGetIndexOfId(editId) ?? fail('edit not found');\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.getIdAtIndex}\n\t */\n\tpublic getIdAtIndex(index: number): EditId {\n\t\tif (this._earliestAvailableEditIndex + this.numberOfSequencedEdits <= index) {\n\t\t\treturn this.localEdits[index - this.numberOfSequencedEdits].id;\n\t\t}\n\n\t\treturn this.sequencedEdits[index - this._earliestAvailableEditIndex].id;\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.tryGetEditAtIndex}\n\t */\n\tpublic tryGetEditAtIndex(index: number): Edit<TChange> | undefined {\n\t\tif (this._earliestAvailableEditIndex + this.numberOfSequencedEdits <= index) {\n\t\t\treturn this.localEdits[index - this.numberOfSequencedEdits];\n\t\t}\n\n\t\treturn this.sequencedEdits[index - this._earliestAvailableEditIndex];\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.tryGetEditFromId}\n\t */\n\tpublic tryGetEditFromId(editId: EditId): Edit<TChange> | undefined {\n\t\tconst index = this.tryGetIndexOfId(editId);\n\t\treturn index !== undefined ? this.tryGetEditAtIndex(index) : undefined;\n\t}\n\n\t/**\n\t * Sequences all local edits.\n\t */\n\tpublic sequenceLocalEdits(): void {\n\t\tthis.localEdits.slice().forEach((edit) => this.addSequencedEditInternal(edit));\n\t}\n\n\t/**\n\t * Adds a sequenced (non-local) edit to the edit log.\n\t * If the id of the supplied edit matches a local edit already present in the log, the local edit will be replaced.\n\t *\n\t */\n\tpublic addSequencedEdit(edit: Edit<TChange>, message: MessageSequencingInfo): void {\n\t\tthis.addSequencedEditInternal(edit, message, message.minimumSequenceNumber);\n\t}\n\n\t/**\n\t * Returns all local edits from this EditLog\n\t * This is useful for op format upgrades, which might warrant re-submission of these ops using the new format.\n\t * See the breaking change documentation for more information.\n\t */\n\tpublic *getLocalEdits(): Iterable<Edit<TChange>> {\n\t\tfor (const edit of this.localEdits) {\n\t\t\tyield edit;\n\t\t}\n\t}\n\n\t/**\n\t * Adds a sequenced (non-local) edit to the edit log.\n\t * If the id of the supplied edit matches a local edit already present in the log, the local edit will be replaced.\n\t */\n\tprivate addSequencedEditInternal(\n\t\tedit: Edit<TChange>,\n\t\tinfo?: EditSequencingInfo,\n\t\tminSequenceNumber: number = 0\n\t): void {\n\t\tassert(\n\t\t\tminSequenceNumber >= this._minSequenceNumber,\n\t\t\t0x60c /* Sequenced edits should carry a monotonically increasing min number */\n\t\t);\n\t\tthis._minSequenceNumber = minSequenceNumber;\n\n\t\tconst { id } = edit;\n\t\t// The index of the sequenced edit to add\n\t\tconst index = this._earliestAvailableEditIndex + this.numberOfSequencedEdits;\n\n\t\t// Remove the edit from local edits if it exists.\n\t\tconst encounteredEditId = this.allEditIds.get(id);\n\t\tif (encounteredEditId !== undefined) {\n\t\t\t// New edit already exits: it must have been a local edit.\n\t\t\tassert(encounteredEditId.isLocal, 0x60d /* Duplicate acked edit. */);\n\t\t\t// Remove it from localEdits. Due to ordering requirements, it must be first.\n\t\t\tconst oldLocalEditId = this.localEdits.shift()?.id ?? fail('Local edit should exist');\n\t\t\tassert(oldLocalEditId === id, 0x60e /* Causal ordering should be upheld */);\n\t\t}\n\n\t\tthis.sequencedEdits.push(edit);\n\n\t\tconst sequencedEditId: SequencedOrderedEditId = {\n\t\t\tindex,\n\t\t\tisLocal: false,\n\t\t\tsequenceInfo: info,\n\t\t};\n\t\tthis.allEditIds.set(id, sequencedEditId);\n\t\tif (info !== undefined) {\n\t\t\tthis.sequenceNumberToIndex?.set(info.sequenceNumber, index);\n\t\t}\n\t\tthis.emitAdd(edit, false, encounteredEditId !== undefined);\n\n\t\t// Check if any edits need to be evicted due to this addition\n\t\tif (this.sequenceNumberToIndex !== undefined && this.numberOfSequencedEdits >= this.evictionFrequency) {\n\t\t\tthis.evictEdits();\n\t\t}\n\t}\n\n\t/**\n\t * Adds a non-sequenced (local) edit to the edit log.\n\t * Duplicate edits are ignored.\n\t */\n\tpublic addLocalEdit(edit: Edit<TChange>): void {\n\t\tthis.localEdits.push(edit);\n\t\tconst localEditId: LocalOrderedEditId = {\n\t\t\tlocalSequence: this.localEditSequence++,\n\t\t\tisLocal: true,\n\t\t};\n\t\tthis.allEditIds.set(edit.id, localEditId);\n\t\tthis.emitAdd(edit, true, false);\n\t}\n\n\tprivate emitAdd(editAdded: Edit<TChange>, isLocal: boolean, wasLocal: boolean): void {\n\t\tfor (const handler of this._editAddedHandlers) {\n\t\t\thandler(editAdded, isLocal, wasLocal);\n\t\t}\n\t}\n\n\tprivate evictEdits(): void {\n\t\tassert(\n\t\t\tthis.sequenceNumberToIndex !== undefined,\n\t\t\t0x60f /* Edits should never be evicted if the target length is set to infinity */\n\t\t);\n\n\t\tconst minSequenceIndex =\n\t\t\tthis.sequenceNumberToIndex.getPairOrNextHigher(this._minSequenceNumber)?.[1] ??\n\t\t\tfail('No index associated with that sequence number.');\n\t\t// Exclude any edits in the collab window from being evicted\n\t\tconst numberOfEvictableEdits = minSequenceIndex - this.earliestAvailableEditIndex;\n\n\t\tif (numberOfEvictableEdits > 0) {\n\t\t\t// Evict either all but the target log size or the number of evictable edits, whichever is smaller\n\t\t\tconst numberOfDesiredEditsToEvict = this.numberOfSequencedEdits - this.targetLength;\n\t\t\tconst numberOfEditsToEvict = Math.min(numberOfEvictableEdits, numberOfDesiredEditsToEvict);\n\t\t\tfor (const handler of this._editEvictionHandlers) {\n\t\t\t\thandler(numberOfEditsToEvict);\n\t\t\t}\n\n\t\t\t// Remove the edits and move up the earliest available index\n\t\t\tconst removedEdits = this.sequencedEdits.splice(0, numberOfEditsToEvict);\n\t\t\tthis._earliestAvailableEditIndex += numberOfEditsToEvict;\n\n\t\t\t// On eviction, we need to remove the IDs of edits that have been evicted\n\t\t\tremovedEdits.forEach((edit) => this.allEditIds.delete(edit.id));\n\n\t\t\t// The minSequenceNumber is strictly increasing so we can clear sequence numbers before it\n\t\t\tthis.sequenceNumberToIndex.deleteRange(0, this._minSequenceNumber, false);\n\t\t}\n\t}\n\n\t/**\n\t * @returns true iff this `EditLog` and `other` are equivalent, regardless of locality.\n\t */\n\tpublic equals<TOtherChangeTypesInternal>(other: EditLog<TOtherChangeTypesInternal>): boolean {\n\t\t// TODO #45414: We should also be deep comparing the list of changes in the edit. This is not straightforward.\n\t\t// We can use our edit validation code when we write it since it will need to do deep walks of the changes.\n\t\treturn compareArrays(this.editIds, other.editIds);\n\t}\n\n\t/**\n\t * @returns the summary of this `OrderedEditSet` that can be used to reconstruct the edit set.\n\t */\n\tpublic getEditLogSummary(): EditLogSummary<TChange, FluidEditHandle>;\n\n\t/**\n\t * @param compressEdit - a function which compresses edits\n\t * @returns the summary of this `OrderedEditSet` that can be used to reconstruct the edit set.\n\t */\n\tpublic getEditLogSummary<TCompressedChange>(\n\t\tcompressEdit: (edit: Pick<Edit<TChange>, 'changes'>) => Pick<Edit<TCompressedChange>, 'changes'>\n\t): EditLogSummary<TCompressedChange, FluidEditHandle>;\n\tpublic getEditLogSummary<TCompressedChange>(\n\t\tcompressEdit?: (edit: Pick<Edit<TChange>, 'changes'>) => Pick<Edit<TCompressedChange>, 'changes'>\n\t): EditLogSummary<TChange, FluidEditHandle> | EditLogSummary<TCompressedChange, FluidEditHandle> {\n\t\tconst editIds = this.sequencedEdits.map(({ id }) => id);\n\t\treturn compressEdit !== undefined\n\t\t\t? {\n\t\t\t\t\teditChunks:\n\t\t\t\t\t\tthis.sequencedEdits.length === 0\n\t\t\t\t\t\t\t? []\n\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\t\t// Store all edits within a single \"chunk\"\n\t\t\t\t\t\t\t\t\t\tstartRevision: 0,\n\t\t\t\t\t\t\t\t\t\tchunk: this.sequencedEdits.map((edit) => compressEdit(edit)),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\teditIds,\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\teditChunks:\n\t\t\t\t\t\tthis.sequencedEdits.length === 0\n\t\t\t\t\t\t\t? []\n\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\t\t// Store all edits within a single \"chunk\"\n\t\t\t\t\t\t\t\t\t\tstartRevision: 0,\n\t\t\t\t\t\t\t\t\t\tchunk: this.sequencedEdits.map(({ changes }) => ({ changes })),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\teditIds,\n\t\t\t\t};\n\t}\n\n\t// APIS DEPRECATED DUE TO HISTORY'S PEACEFUL DEATH\n\t/**\n\t * @deprecated Edit virtualization is no longer supported. Don't use the asynchronous APIs. Instead, use {@link OrderedEditSet.tryGetEditFromId}.\n\t */\n\tpublic async tryGetEdit(editId: EditId): Promise<Edit<TChange> | undefined> {\n\t\tconst index = this.tryGetIndexOfId(editId);\n\t\treturn index !== undefined ? this.tryGetEditAtIndex(index) : undefined;\n\t}\n\n\t/**\n\t * @deprecated Edit virtualization is no longer supported. Don't use the asynchronous APIs. Instead, use {@link OrderedEditSet.tryGetEditFromId}.\n\t */\n\tpublic async getEditAtIndex(index: number): Promise<Edit<TChange>> {\n\t\treturn this.tryGetEditAtIndex(index) ?? fail('Edit not found');\n\t}\n\n\t/**\n\t * @deprecated Edit virtualization is no longer supported. Instead, use {@link OrderedEditSet.tryGetEditFromId}.\n\t */\n\tpublic getEditInSessionAtIndex(index: number): Edit<TChange> {\n\t\treturn this.tryGetEditAtIndex(index) ?? fail('Edit not found');\n\t}\n}\n"]}
|
|
@@ -31,7 +31,7 @@ export declare class MigrationShimDeltaHandler implements IShimDeltaHandler {
|
|
|
31
31
|
isUsingOldV1(): boolean;
|
|
32
32
|
isUsingNewV2(): boolean;
|
|
33
33
|
attachTreeDeltaHandler(treeDeltaHandler: IDeltaHandler): void;
|
|
34
|
-
process
|
|
34
|
+
private process;
|
|
35
35
|
processMessages(messagesCollection: IRuntimeMessageCollection): void;
|
|
36
36
|
setConnectionState(connected: boolean): void;
|
|
37
37
|
reSubmit(contents: unknown, localOpMetadata: unknown): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrationDeltaHandler.d.ts","sourceRoot":"","sources":["../../src/migration-shim/migrationDeltaHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAC7G,OAAO,EAAe,KAAK,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAC1G,OAAO,KAAK,EAAE,yBAAyB,
|
|
1
|
+
{"version":3,"file":"migrationDelt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AAI;IAOpE,kBAAkB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI;IAI5C,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAa3D,cAAc,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IAcvC,QAAQ,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAQnE,OAAO,CAAC,yBAAyB;IAIjC;;;;;OAKG;IACH,OAAO,CAAC,YAAY;CAmBpB"}
|
|
@@ -79,8 +79,15 @@ class MigrationShimDeltaHandler {
|
|
|
79
79
|
if (this.shouldDropOp(contents)) {
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
|
+
const messagesContent = [
|
|
83
|
+
{
|
|
84
|
+
contents,
|
|
85
|
+
localOpMetadata,
|
|
86
|
+
clientSequenceNumber: message.clientSequenceNumber,
|
|
87
|
+
},
|
|
88
|
+
];
|
|
82
89
|
// Another thought, flatten the IShimDeltaHandler and the MigrationShim into one class
|
|
83
|
-
return this.treeDeltaHandler.
|
|
90
|
+
return this.treeDeltaHandler.processMessages({ envelope: message, messagesContent, local });
|
|
84
91
|
}
|
|
85
92
|
processMessages(messagesCollection) {
|
|
86
93
|
const { envelope, messagesContent, local } = messagesCollection;
|