@fluidframework/matrix 2.30.0 → 2.31.1
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 +144 -140
- package/dist/handlecache.d.ts.map +1 -1
- package/dist/handlecache.js +6 -7
- package/dist/handlecache.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/handlecache.d.ts.map +1 -1
- package/lib/handlecache.js +6 -7
- package/lib/handlecache.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +19 -22
- package/src/handlecache.ts +6 -8
- package/src/packageVersion.ts +1 -1
- package/tsconfig.json +1 -0
- package/prettier.config.cjs +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# @fluidframework/matrix
|
|
2
2
|
|
|
3
|
+
## 2.31.0
|
|
4
|
+
|
|
5
|
+
Dependency updates only.
|
|
6
|
+
|
|
3
7
|
## 2.30.0
|
|
4
8
|
|
|
5
9
|
Dependency updates only.
|
|
@@ -60,58 +64,58 @@ Dependency updates only.
|
|
|
60
64
|
|
|
61
65
|
### Minor Changes
|
|
62
66
|
|
|
63
|
-
-
|
|
67
|
+
- Update to TypeScript 5.4 ([#21214](https://github.com/microsoft/FluidFramework/pull/21214)) [0e6256c722](https://github.com/microsoft/FluidFramework/commit/0e6256c722d8bf024f4325bf02547daeeb18bfa6)
|
|
64
68
|
|
|
65
|
-
|
|
69
|
+
Update package implementations to use TypeScript 5.4.5.
|
|
66
70
|
|
|
67
71
|
## 2.0.0-rc.4.0.0
|
|
68
72
|
|
|
69
73
|
### Minor Changes
|
|
70
74
|
|
|
71
|
-
-
|
|
75
|
+
- Deprecated members of IFluidHandle are split off into new IFluidHandleInternal interface [96872186d0](https://github.com/microsoft/FluidFramework/commit/96872186d0d0f245c1fece7d19b3743e501679b6)
|
|
72
76
|
|
|
73
|
-
|
|
74
|
-
|
|
77
|
+
Split IFluidHandle into two interfaces, `IFluidHandle` and `IFluidHandleInternal`.
|
|
78
|
+
Code depending on the previously deprecated members of IFluidHandle can access them by using `toFluidHandleInternal` from `@fluidframework/runtime-utils/legacy`.
|
|
75
79
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
80
|
+
External implementation of the `IFluidHandle` interface are not supported: this change makes the typing better convey this using the `ErasedType` pattern.
|
|
81
|
+
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.
|
|
82
|
+
Such handle implementation may break in the future and thus should be replaced with use of handles produced by the Fluid Framework client packages.
|
|
79
83
|
|
|
80
|
-
-
|
|
84
|
+
- matrix: SharedMatrix class hidden [96872186d0](https://github.com/microsoft/FluidFramework/commit/96872186d0d0f245c1fece7d19b3743e501679b6)
|
|
81
85
|
|
|
82
|
-
|
|
83
|
-
|
|
86
|
+
The `SharedMatrix` class has been hidden from the alpha API.
|
|
87
|
+
In its place:
|
|
84
88
|
|
|
85
|
-
|
|
86
|
-
|
|
89
|
+
- The constant `SharedMatrix` is exposed as the entrypoint for `SharedMatrix` creation. See documentation on `ISharedObjectKind`.
|
|
90
|
+
- The type `SharedMatrix` is aliased to `ISharedMatrix`, which contains matrix's public API. This API has no semantic changes from previous versions.
|
|
87
91
|
|
|
88
|
-
|
|
92
|
+
Additionally, `SharedMatrixFactory` has been deprecated. Rather than construct the factory directly, use `SharedMatrix.getFactory()` (e.g. for usage in `DataObject` registries).
|
|
89
93
|
|
|
90
|
-
|
|
91
|
-
|
|
94
|
+
This change is part of a larger effort to clean up the API surface of various DDSes we have to leak less implementation details. See e.g. #20030.
|
|
95
|
+
Most code which uses `SharedMatrix` should continue to function without changes.
|
|
92
96
|
|
|
93
97
|
## 2.0.0-rc.3.0.0
|
|
94
98
|
|
|
95
99
|
### Major Changes
|
|
96
100
|
|
|
97
|
-
-
|
|
101
|
+
- Packages now use package.json "exports" and require modern module resolution [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
|
|
98
102
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
103
|
+
Fluid Framework packages have been updated to use the [package.json "exports"
|
|
104
|
+
field](https://nodejs.org/docs/latest-v18.x/api/packages.html#exports) to define explicit entry points for both
|
|
105
|
+
TypeScript types and implementation code.
|
|
102
106
|
|
|
103
|
-
|
|
107
|
+
This means that using Fluid Framework packages require the following TypeScript settings in tsconfig.json:
|
|
104
108
|
|
|
105
|
-
|
|
106
|
-
|
|
109
|
+
- `"moduleResolution": "Node16"` with `"module": "Node16"`
|
|
110
|
+
- `"moduleResolution": "Bundler"` with `"module": "ESNext"`
|
|
107
111
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
+
We recommend using Node16/Node16 unless absolutely necessary. That will produce transpiled JavaScript that is suitable
|
|
113
|
+
for use with modern versions of Node.js _and_ Bundlers.
|
|
114
|
+
[See the TypeScript documentation](https://www.typescriptlang.org/tsconfig#moduleResolution) for more information
|
|
115
|
+
regarding the module and moduleResolution options.
|
|
112
116
|
|
|
113
|
-
|
|
114
|
-
|
|
117
|
+
**Node10 moduleResolution is not supported; it does not support Fluid Framework's API structuring pattern that is used
|
|
118
|
+
to distinguish stable APIs from those that are in development.**
|
|
115
119
|
|
|
116
120
|
## 2.0.0-rc.2.0.0
|
|
117
121
|
|
|
@@ -121,67 +125,67 @@ Dependency updates only.
|
|
|
121
125
|
|
|
122
126
|
### Minor Changes
|
|
123
127
|
|
|
124
|
-
-
|
|
128
|
+
- Updated server dependencies ([#19122](https://github.com/microsoft/FluidFramework/issues/19122)) [25366b4229](https://github.com/microsoft/FluidFramework/commits/25366b422918cb43685c5f328b50450749592902)
|
|
125
129
|
|
|
126
|
-
|
|
130
|
+
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)
|
|
127
131
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
132
|
+
- @fluidframework/gitresources
|
|
133
|
+
- @fluidframework/server-kafka-orderer
|
|
134
|
+
- @fluidframework/server-lambdas
|
|
135
|
+
- @fluidframework/server-lambdas-driver
|
|
136
|
+
- @fluidframework/server-local-server
|
|
137
|
+
- @fluidframework/server-memory-orderer
|
|
138
|
+
- @fluidframework/protocol-base
|
|
139
|
+
- @fluidframework/server-routerlicious
|
|
140
|
+
- @fluidframework/server-routerlicious-base
|
|
141
|
+
- @fluidframework/server-services
|
|
142
|
+
- @fluidframework/server-services-client
|
|
143
|
+
- @fluidframework/server-services-core
|
|
144
|
+
- @fluidframework/server-services-ordering-kafkanode
|
|
145
|
+
- @fluidframework/server-services-ordering-rdkafka
|
|
146
|
+
- @fluidframework/server-services-ordering-zookeeper
|
|
147
|
+
- @fluidframework/server-services-shared
|
|
148
|
+
- @fluidframework/server-services-telemetry
|
|
149
|
+
- @fluidframework/server-services-utils
|
|
150
|
+
- @fluidframework/server-test-utils
|
|
151
|
+
- tinylicious
|
|
148
152
|
|
|
149
|
-
-
|
|
153
|
+
- Updated @fluidframework/protocol-definitions ([#19122](https://github.com/microsoft/FluidFramework/issues/19122)) [25366b4229](https://github.com/microsoft/FluidFramework/commits/25366b422918cb43685c5f328b50450749592902)
|
|
150
154
|
|
|
151
|
-
|
|
152
|
-
|
|
155
|
+
The @fluidframework/protocol-definitions dependency has been upgraded to v3.1.0. [See the full
|
|
156
|
+
changelog.](https://github.com/microsoft/FluidFramework/blob/main/common/lib/protocol-definitions/CHANGELOG.md#310)
|
|
153
157
|
|
|
154
|
-
-
|
|
158
|
+
- shared-object-base: SharedObject processGCDataCore now takes IFluidSerializer rather than SummarySerializer ([#18803](https://github.com/microsoft/FluidFramework/issues/18803)) [396b8e9738](https://github.com/microsoft/FluidFramework/commits/396b8e9738156ff88b62424a0076f09fb5028a32)
|
|
155
159
|
|
|
156
|
-
|
|
160
|
+
This change should be a no-op for consumers, and `SummarySerializer` and `IFluidSerializer` expose the same consumer facing APIs. This change just makes our APIs more consistent by only using interfaces, rather than a mix of interfaces and concrete implementations.
|
|
157
161
|
|
|
158
162
|
## 2.0.0-internal.8.0.0
|
|
159
163
|
|
|
160
164
|
### Major Changes
|
|
161
165
|
|
|
162
|
-
-
|
|
166
|
+
- sequence: Some function return types are now void instead of any [9a451d4946](https://github.com/microsoft/FluidFramework/commits/9a451d4946b5c51a52e4d1ab5bf51e7b285b0d74)
|
|
163
167
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
168
|
+
The return types of some functions have changed from `any` to `void` because the projects are now being compiled with
|
|
169
|
+
the `noImplicitAny` TypeScript compilation option. This does not represent a logic change and only serves to make the
|
|
170
|
+
typing of these functions more accurate.
|
|
167
171
|
|
|
168
|
-
-
|
|
172
|
+
- datastore-definitions: Jsonable and Serializable now require a generic parameter [9a451d4946](https://github.com/microsoft/FluidFramework/commits/9a451d4946b5c51a52e4d1ab5bf51e7b285b0d74)
|
|
169
173
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
174
|
+
The `Jsonable` and `Serializable` types from @fluidframework/datastore-definitions now require a generic parameter and
|
|
175
|
+
if that type is `any` or `unknown`will return a new result `JsonableTypeWith<>` that more accurately represents the
|
|
176
|
+
limitation of serialization.
|
|
173
177
|
|
|
174
|
-
|
|
178
|
+
Additional modifications:
|
|
175
179
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
+
- `Jsonable`'s `TReplacement` parameter default has also been changed from `void` to `never`, which now disallows
|
|
181
|
+
`void`.
|
|
182
|
+
- Unrecognized primitive types like `symbol` are now filtered to `never` instead of `{}`.
|
|
183
|
+
- Recursive types with arrays (`[]`) are now supported.
|
|
180
184
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
+
`Serializable` is commonly used for DDS values and now requires more precision when using them. For example SharedMatrix
|
|
186
|
+
(unqualified) has an `any` default that meant values were `Serializable<any>` (i.e. `any`), but now `Serializable<any>`
|
|
187
|
+
is `JsonableTypeWith<IFluidHandle>` which may be problematic for reading or writing. Preferred correction is to specify
|
|
188
|
+
the value type but casting through `any` may provide a quick fix.
|
|
185
189
|
|
|
186
190
|
## 2.0.0-internal.7.4.0
|
|
187
191
|
|
|
@@ -203,45 +207,45 @@ Dependency updates only.
|
|
|
203
207
|
|
|
204
208
|
### Major Changes
|
|
205
209
|
|
|
206
|
-
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
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
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
-
|
|
243
|
-
|
|
244
|
-
|
|
210
|
+
- Dependencies on @fluidframework/protocol-definitions package updated to 3.0.0 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
211
|
+
|
|
212
|
+
This included the following changes from the protocol-definitions release:
|
|
213
|
+
|
|
214
|
+
- Updating signal interfaces for some planned improvements. The intention is split the interface between signals
|
|
215
|
+
submitted by clients to the server and the resulting signals sent from the server to clients.
|
|
216
|
+
- A new optional type member is available on the ISignalMessage interface and a new ISentSignalMessage interface has
|
|
217
|
+
been added, which will be the typing for signals sent from the client to the server. Both extend a new
|
|
218
|
+
ISignalMessageBase interface that contains common members.
|
|
219
|
+
- The @fluidframework/common-definitions package dependency has been updated to version 1.0.0.
|
|
220
|
+
|
|
221
|
+
- Server upgrade: dependencies on Fluid server packages updated to 2.0.1 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
222
|
+
|
|
223
|
+
Dependencies on the following Fluid server package have been updated to version 2.0.1:
|
|
224
|
+
|
|
225
|
+
- @fluidframework/gitresources: 2.0.1
|
|
226
|
+
- @fluidframework/server-kafka-orderer: 2.0.1
|
|
227
|
+
- @fluidframework/server-lambdas: 2.0.1
|
|
228
|
+
- @fluidframework/server-lambdas-driver: 2.0.1
|
|
229
|
+
- @fluidframework/server-local-server: 2.0.1
|
|
230
|
+
- @fluidframework/server-memory-orderer: 2.0.1
|
|
231
|
+
- @fluidframework/protocol-base: 2.0.1
|
|
232
|
+
- @fluidframework/server-routerlicious: 2.0.1
|
|
233
|
+
- @fluidframework/server-routerlicious-base: 2.0.1
|
|
234
|
+
- @fluidframework/server-services: 2.0.1
|
|
235
|
+
- @fluidframework/server-services-client: 2.0.1
|
|
236
|
+
- @fluidframework/server-services-core: 2.0.1
|
|
237
|
+
- @fluidframework/server-services-ordering-kafkanode: 2.0.1
|
|
238
|
+
- @fluidframework/server-services-ordering-rdkafka: 2.0.1
|
|
239
|
+
- @fluidframework/server-services-ordering-zookeeper: 2.0.1
|
|
240
|
+
- @fluidframework/server-services-shared: 2.0.1
|
|
241
|
+
- @fluidframework/server-services-telemetry: 2.0.1
|
|
242
|
+
- @fluidframework/server-services-utils: 2.0.1
|
|
243
|
+
- @fluidframework/server-test-utils: 2.0.1
|
|
244
|
+
- tinylicious: 2.0.1
|
|
245
|
+
|
|
246
|
+
- Minimum TypeScript version now 5.1.6 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
247
|
+
|
|
248
|
+
The minimum supported TypeScript version for Fluid 2.0 clients is now 5.1.6.
|
|
245
249
|
|
|
246
250
|
## 2.0.0-internal.6.4.0
|
|
247
251
|
|
|
@@ -255,32 +259,32 @@ Dependency updates only.
|
|
|
255
259
|
|
|
256
260
|
### Minor Changes
|
|
257
261
|
|
|
258
|
-
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
262
|
+
- Remove use of @fluidframework/common-definitions ([#16638](https://github.com/microsoft/FluidFramework/issues/16638)) [a8c81509c9](https://github.com/microsoft/FluidFramework/commits/a8c81509c9bf09cfb2092ebcf7265205f9eb6dbf)
|
|
263
|
+
|
|
264
|
+
The **@fluidframework/common-definitions** package is being deprecated, so the following interfaces and types are now
|
|
265
|
+
imported from the **@fluidframework/core-interfaces** package:
|
|
266
|
+
|
|
267
|
+
- interface IDisposable
|
|
268
|
+
- interface IErrorEvent
|
|
269
|
+
- interface IErrorEvent
|
|
270
|
+
- interface IEvent
|
|
271
|
+
- interface IEventProvider
|
|
272
|
+
- interface ILoggingError
|
|
273
|
+
- interface ITaggedTelemetryPropertyType
|
|
274
|
+
- interface ITelemetryBaseEvent
|
|
275
|
+
- interface ITelemetryBaseLogger
|
|
276
|
+
- interface ITelemetryErrorEvent
|
|
277
|
+
- interface ITelemetryGenericEvent
|
|
278
|
+
- interface ITelemetryLogger
|
|
279
|
+
- interface ITelemetryPerformanceEvent
|
|
280
|
+
- interface ITelemetryProperties
|
|
281
|
+
- type ExtendEventProvider
|
|
282
|
+
- type IEventThisPlaceHolder
|
|
283
|
+
- type IEventTransformer
|
|
284
|
+
- type ReplaceIEventThisPlaceHolder
|
|
285
|
+
- type ReplaceIEventThisPlaceHolder
|
|
286
|
+
- type TelemetryEventCategory
|
|
287
|
+
- type TelemetryEventPropertyType
|
|
284
288
|
|
|
285
289
|
## 2.0.0-internal.6.1.0
|
|
286
290
|
|
|
@@ -290,9 +294,9 @@ Dependency updates only.
|
|
|
290
294
|
|
|
291
295
|
### Major Changes
|
|
292
296
|
|
|
293
|
-
-
|
|
297
|
+
- Upgraded typescript transpilation target to ES2020 [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
294
298
|
|
|
295
|
-
|
|
299
|
+
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.
|
|
296
300
|
|
|
297
301
|
## 2.0.0-internal.5.4.0
|
|
298
302
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlecache.d.ts","sourceRoot":"","sources":["../src/handlecache.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAiB,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAsB,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG/E;;;;;GAKG;AACH,qBAAa,WAAY,YAAW,eAAe,CAAC,MAAM,CAAC;aAI9B,MAAM,EAAE,iBAAiB;IAHrD,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,KAAK,CAAK;gBAEU,MAAM,EAAE,iBAAiB;IAErD;;;OAGG;IACH,OAAO,CAAC,QAAQ;IAIhB;;;;;;;OAOG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAa1C;;OAEG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAaxD;;OAEG;IACH,OAAO,CAAC,UAAU;
|
|
1
|
+
{"version":3,"file":"handlecache.d.ts","sourceRoot":"","sources":["../src/handlecache.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAiB,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAsB,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG/E;;;;;GAKG;AACH,qBAAa,WAAY,YAAW,eAAe,CAAC,MAAM,CAAC;aAI9B,MAAM,EAAE,iBAAiB;IAHrD,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,KAAK,CAAK;gBAEU,MAAM,EAAE,iBAAiB;IAErD;;;OAGG;IACH,OAAO,CAAC,QAAQ;IAIhB;;;;;;;OAOG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAa1C;;OAEG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAaxD;;OAEG;IACH,OAAO,CAAC,UAAU;IAgBlB,OAAO,CAAC,SAAS;IA4BjB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI;CAoB9E"}
|
package/dist/handlecache.js
CHANGED
|
@@ -59,10 +59,9 @@ class HandleCache {
|
|
|
59
59
|
/**
|
|
60
60
|
* Used by {@link HandleCache.cacheMiss} to retrieve handles for a range of positions.
|
|
61
61
|
*/
|
|
62
|
-
getHandles(start, end) {
|
|
62
|
+
getHandles(start, end, handles) {
|
|
63
63
|
// TODO: This can be accelerated substantially using 'walkSegments()'. The only catch
|
|
64
64
|
// is that
|
|
65
|
-
const handles = [];
|
|
66
65
|
const { vector } = this;
|
|
67
66
|
for (let pos = start; pos < end; pos++) {
|
|
68
67
|
const { segment, offset } = vector.getContainingSegment(pos);
|
|
@@ -82,16 +81,16 @@ class HandleCache {
|
|
|
82
81
|
// the cache to the next MergeTree segment boundary (within the limits of
|
|
83
82
|
// the handle cache).
|
|
84
83
|
if (_position < this.start) {
|
|
85
|
-
|
|
84
|
+
const handles = [];
|
|
85
|
+
this.getHandles(_position, this.start, handles);
|
|
86
|
+
handles.push(...this.handles);
|
|
87
|
+
this.handles = handles;
|
|
86
88
|
this.start = _position;
|
|
87
89
|
return this.handles[0];
|
|
88
90
|
}
|
|
89
91
|
else {
|
|
90
92
|
(0, range_js_1.ensureRange)(_position, this.vector.getLength());
|
|
91
|
-
this.handles
|
|
92
|
-
...this.handles,
|
|
93
|
-
...this.getHandles(this.start + this.handles.length, _position + 1),
|
|
94
|
-
];
|
|
93
|
+
this.getHandles(this.start + this.handles.length, _position + 1, this.handles);
|
|
95
94
|
return this.handles[this.handles.length - 1];
|
|
96
95
|
}
|
|
97
96
|
}
|
package/dist/handlecache.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlecache.js","sourceRoot":"","sources":["../src/handlecache.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAA+B;AAE/B,kEAA6D;AAG7D,qDAAyD;AAEzD,yCAAyC;AAEzC;;;;;GAKG;AACH,MAAa,WAAW;IAIvB,YAA4B,MAAyB;QAAzB,WAAM,GAAN,MAAM,CAAmB;QAH7C,YAAO,GAAa,EAAE,CAAC;QACvB,UAAK,GAAG,CAAC,CAAC;IAEsC,CAAC;IAEzD;;;OAGG;IACK,QAAQ,CAAC,QAAgB;QAChC,OA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QAC9C,CAAC;IACF,CAAC;IAED,0BAA0B;IAE1B,YAAY,CAAC,KAAa,EAAE,YAAoB,EAAE,aAAqB;QACtE,8EAA8E;QAC9E,6EAA6E;QAC7E,aAAa;QACb,EAAE;QACF,4EAA4E;QAC5E,wBAAwB;QACxB,EAAE;QACF,6FAA6F;QAC7F,2EAA2E;QAC3E,EAAE;QACF,gFAAgF;QAEhF,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACnC,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YACjC,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC;QAC7B,CAAC;IACF,CAAC;CAGD;AAtHD,kCAsHC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { IVectorConsumer } from \"@tiny-calc/nano\";\n\nimport { Handle, isHandleValid } from \"./handletable.js\";\nimport { PermutationSegment, PermutationVector } from \"./permutationvector.js\";\nimport { ensureRange } from \"./range.js\";\n\n/**\n * Used by PermutationVector to cache position -\\> handle lookups.\n *\n * Perf: Possibly, this should eventually be inlined into PermutationVector itself, but\n * so far there's no measurable perf penalty for being a separate object (node 12 x64)\n */\nexport class HandleCache implements IVectorConsumer<Handle> {\n\tprivate handles: Handle[] = [];\n\tprivate start = 0;\n\n\tconstructor(public readonly vector: PermutationVector) {}\n\n\t/**\n\t * Returns the index of the given position in the 'handles' array as a Uint32.\n\t * (If the position is not in the array, returns an integer greater than 'handles.length').\n\t */\n\tprivate getIndex(position: number): number {\n\t\treturn (position - this.start) >>> 0;\n\t}\n\n\t/**\n\t * Returns the handle currently assigned to the given 'position' (if any). Check\n\t * the result with 'isValidHandle(..)' to see if a handle has been allocated for\n\t * the given position.\n\t *\n\t * @throws A 'RangeError' if the provided 'position' is out-of-bounds with regards to the\n\t * PermutationVector's length.\n\t */\n\tpublic getHandle(position: number): Handle {\n\t\tconst index = this.getIndex(position);\n\n\t\t// Perf: To encourage inlining, handling of the 'cacheMiss(..)' case has been extracted\n\t\t// to a separate method.\n\n\t\t// Perf: A cache hit implies that 'position' was in bounds. Therefore, we can defer\n\t\t// checking that 'position' is in bounds until 'cacheMiss(..)'. This yields an\n\t\t// ~40% speedup when the position is in the cache (node v12 x64).\n\n\t\treturn index < this.handles.length ? this.handles[index] : this.cacheMiss(position);\n\t}\n\n\t/**\n\t * Update the cache when a handle has been allocated for a given position.\n\t */\n\tpublic addHandle(position: number, handle: Handle): void {\n\t\tassert(isHandleValid(handle), 0x017 /* \"Trying to add invalid handle!\" */);\n\n\t\tconst index = this.getIndex(position);\n\t\tif (index < this.handles.length) {\n\t\t\tassert(\n\t\t\t\t!isHandleValid(this.handles[index]),\n\t\t\t\t0x018 /* \"Trying to insert handle into position with already valid handle!\" */,\n\t\t\t);\n\t\t\tthis.handles[index] = handle;\n\t\t}\n\t}\n\n\t/**\n\t * Used by {@link HandleCache.cacheMiss} to retrieve handles for a range of positions.\n\t */\n\tprivate getHandles(start: number, end: number, handles: Handle[]): Handle[] {\n\t\t// TODO: This can be accelerated substantially using 'walkSegments()'. The only catch\n\t\t// is that\n\n\t\tconst { vector } = this;\n\n\t\tfor (let pos = start; pos < end; pos++) {\n\t\t\tconst { segment, offset } = vector.getContainingSegment(pos);\n\t\t\tconst asPerm = segment as PermutationSegment;\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\thandles.push(asPerm.start + offset!);\n\t\t}\n\n\t\treturn handles;\n\t}\n\n\tprivate cacheMiss(position: number): Handle {\n\t\t// Coercing 'position' to an Uint32 allows us to handle a negative 'position' value\n\t\t// with the same logic that handles 'position' >= length.\n\t\tconst _position = position >>> 0;\n\n\t\t// TODO: To bound memory usage, there should be a limit on the maximum size of\n\t\t// handle[].\n\n\t\t// TODO: To reduce MergeTree lookups, this code should opportunistically grow\n\t\t// the cache to the next MergeTree segment boundary (within the limits of\n\t\t// the handle cache).\n\n\t\tif (_position < this.start) {\n\t\t\tconst handles: Handle[] = [];\n\t\t\tthis.getHandles(_position, this.start, handles);\n\t\t\thandles.push(...this.handles);\n\t\t\tthis.handles = handles;\n\t\t\tthis.start = _position;\n\t\t\treturn this.handles[0];\n\t\t} else {\n\t\t\tensureRange(_position, this.vector.getLength());\n\t\t\tthis.getHandles(this.start + this.handles.length, _position + 1, this.handles);\n\t\t\treturn this.handles[this.handles.length - 1];\n\t\t}\n\t}\n\n\t// #region IVectorConsumer\n\n\titemsChanged(start: number, removedCount: number, insertedCount: number): void {\n\t\t// If positions were inserted/removed, our current policy is to trim the array\n\t\t// at the beginning of the invalidate range and lazily repopulate the handles\n\t\t// on demand.\n\t\t//\n\t\t// Some alternatives to consider that preserve the previously cached handles\n\t\t// that are still valid:\n\t\t//\n\t\t// * Eagerly populate the 'handles[]' with the newly insert values (currently guaranteed\n\t\t// to be Handle.unallocated, so we don't even need to look them up.)\n\t\t//\n\t\t// * Use a sentinel value or other mechanism to allow \"holes\" in the cache.\n\n\t\tconst index = this.getIndex(start);\n\t\tif (index < this.handles.length) {\n\t\t\tthis.handles.length = index;\n\t\t}\n\t}\n\n\t// #endregion IVectorConsumer\n}\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/matrix";
|
|
11
|
-
exports.pkgVersion = "2.
|
|
11
|
+
exports.pkgVersion = "2.31.1";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,wBAAwB,CAAC;AACnC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/matrix\";\nexport const pkgVersion = \"2.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,wBAAwB,CAAC;AACnC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/matrix\";\nexport const pkgVersion = \"2.31.1\";\n"]}
|
package/lib/handlecache.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlecache.d.ts","sourceRoot":"","sources":["../src/handlecache.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAiB,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAsB,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG/E;;;;;GAKG;AACH,qBAAa,WAAY,YAAW,eAAe,CAAC,MAAM,CAAC;aAI9B,MAAM,EAAE,iBAAiB;IAHrD,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,KAAK,CAAK;gBAEU,MAAM,EAAE,iBAAiB;IAErD;;;OAGG;IACH,OAAO,CAAC,QAAQ;IAIhB;;;;;;;OAOG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAa1C;;OAEG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAaxD;;OAEG;IACH,OAAO,CAAC,UAAU;
|
|
1
|
+
{"version":3,"file":"handlecache.d.ts","sourceRoot":"","sources":["../src/handlecache.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAiB,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAsB,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG/E;;;;;GAKG;AACH,qBAAa,WAAY,YAAW,eAAe,CAAC,MAAM,CAAC;aAI9B,MAAM,EAAE,iBAAiB;IAHrD,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,KAAK,CAAK;gBAEU,MAAM,EAAE,iBAAiB;IAErD;;;OAGG;IACH,OAAO,CAAC,QAAQ;IAIhB;;;;;;;OAOG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAa1C;;OAEG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAaxD;;OAEG;IACH,OAAO,CAAC,UAAU;IAgBlB,OAAO,CAAC,SAAS;IA4BjB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI;CAoB9E"}
|
package/lib/handlecache.js
CHANGED
|
@@ -56,10 +56,9 @@ export class HandleCache {
|
|
|
56
56
|
/**
|
|
57
57
|
* Used by {@link HandleCache.cacheMiss} to retrieve handles for a range of positions.
|
|
58
58
|
*/
|
|
59
|
-
getHandles(start, end) {
|
|
59
|
+
getHandles(start, end, handles) {
|
|
60
60
|
// TODO: This can be accelerated substantially using 'walkSegments()'. The only catch
|
|
61
61
|
// is that
|
|
62
|
-
const handles = [];
|
|
63
62
|
const { vector } = this;
|
|
64
63
|
for (let pos = start; pos < end; pos++) {
|
|
65
64
|
const { segment, offset } = vector.getContainingSegment(pos);
|
|
@@ -79,16 +78,16 @@ export class HandleCache {
|
|
|
79
78
|
// the cache to the next MergeTree segment boundary (within the limits of
|
|
80
79
|
// the handle cache).
|
|
81
80
|
if (_position < this.start) {
|
|
82
|
-
|
|
81
|
+
const handles = [];
|
|
82
|
+
this.getHandles(_position, this.start, handles);
|
|
83
|
+
handles.push(...this.handles);
|
|
84
|
+
this.handles = handles;
|
|
83
85
|
this.start = _position;
|
|
84
86
|
return this.handles[0];
|
|
85
87
|
}
|
|
86
88
|
else {
|
|
87
89
|
ensureRange(_position, this.vector.getLength());
|
|
88
|
-
this.handles
|
|
89
|
-
...this.handles,
|
|
90
|
-
...this.getHandles(this.start + this.handles.length, _position + 1),
|
|
91
|
-
];
|
|
90
|
+
this.getHandles(this.start + this.handles.length, _position + 1, this.handles);
|
|
92
91
|
return this.handles[this.handles.length - 1];
|
|
93
92
|
}
|
|
94
93
|
}
|
package/lib/handlecache.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlecache.js","sourceRoot":"","sources":["../src/handlecache.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,+BAA+B;AAE/B,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAG7D,OAAO,EAAU,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,OAAO,WAAW;IAIvB,YAA4B,MAAyB;QAAzB,WAAM,GAAN,MAAM,CAAmB;QAH7C,YAAO,GAAa,EAAE,CAAC;QACvB,UAAK,GAAG,CAAC,CAAC;IAEsC,CAAC;IAEzD;;;OAGG;IACK,QAAQ,CAAC,QAAgB;QAChC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;OAOG;IACI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C,KAAa,EAAE,YAAoB,EAAE,aAAqB;QACtE,8EAA8E;QAC9E,6EAA6E;QAC7E,aAAa;QACb,EAAE;QACF,4EAA4E;QAC5E,wBAAwB;QACxB,EAAE;QACF,6FAA6F;QAC7F,2EAA2E;QAC3E,EAAE;QACF,gFAAgF;QAEhF,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACnC,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YACjC,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC;QAC7B,CAAC;IACF,CAAC;CAGD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { IVectorConsumer } from \"@tiny-calc/nano\";\n\nimport { Handle, isHandleValid } from \"./handletable.js\";\nimport { PermutationSegment, PermutationVector } from \"./permutationvector.js\";\nimport { ensureRange } from \"./range.js\";\n\n/**\n * Used by PermutationVector to cache position -\\> handle lookups.\n *\n * Perf: Possibly, this should eventually be inlined into PermutationVector itself, but\n * so far there's no measurable perf penalty for being a separate object (node 12 x64)\n */\nexport class HandleCache implements IVectorConsumer<Handle> {\n\tprivate handles: Handle[] = [];\n\tprivate start = 0;\n\n\tconstructor(public readonly vector: PermutationVector) {}\n\n\t/**\n\t * Returns the index of the given position in the 'handles' array as a Uint32.\n\t * (If the position is not in the array, returns an integer greater than 'handles.length').\n\t */\n\tprivate getIndex(position: number): number {\n\t\treturn (position - this.start) >>> 0;\n\t}\n\n\t/**\n\t * Returns the handle currently assigned to the given 'position' (if any). Check\n\t * the result with 'isValidHandle(..)' to see if a handle has been allocated for\n\t * the given position.\n\t *\n\t * @throws A 'RangeError' if the provided 'position' is out-of-bounds with regards to the\n\t * PermutationVector's length.\n\t */\n\tpublic getHandle(position: number): Handle {\n\t\tconst index = this.getIndex(position);\n\n\t\t// Perf: To encourage inlining, handling of the 'cacheMiss(..)' case has been extracted\n\t\t// to a separate method.\n\n\t\t// Perf: A cache hit implies that 'position' was in bounds. Therefore, we can defer\n\t\t// checking that 'position' is in bounds until 'cacheMiss(..)'. This yields an\n\t\t// ~40% speedup when the position is in the cache (node v12 x64).\n\n\t\treturn index < this.handles.length ? this.handles[index] : this.cacheMiss(position);\n\t}\n\n\t/**\n\t * Update the cache when a handle has been allocated for a given position.\n\t */\n\tpublic addHandle(position: number, handle: Handle): void {\n\t\tassert(isHandleValid(handle), 0x017 /* \"Trying to add invalid handle!\" */);\n\n\t\tconst index = this.getIndex(position);\n\t\tif (index < this.handles.length) {\n\t\t\tassert(\n\t\t\t\t!isHandleValid(this.handles[index]),\n\t\t\t\t0x018 /* \"Trying to insert handle into position with already valid handle!\" */,\n\t\t\t);\n\t\t\tthis.handles[index] = handle;\n\t\t}\n\t}\n\n\t/**\n\t * Used by {@link HandleCache.cacheMiss} to retrieve handles for a range of positions.\n\t */\n\tprivate getHandles(start: number, end: number, handles: Handle[]): Handle[] {\n\t\t// TODO: This can be accelerated substantially using 'walkSegments()'. The only catch\n\t\t// is that\n\n\t\tconst { vector } = this;\n\n\t\tfor (let pos = start; pos < end; pos++) {\n\t\t\tconst { segment, offset } = vector.getContainingSegment(pos);\n\t\t\tconst asPerm = segment as PermutationSegment;\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\thandles.push(asPerm.start + offset!);\n\t\t}\n\n\t\treturn handles;\n\t}\n\n\tprivate cacheMiss(position: number): Handle {\n\t\t// Coercing 'position' to an Uint32 allows us to handle a negative 'position' value\n\t\t// with the same logic that handles 'position' >= length.\n\t\tconst _position = position >>> 0;\n\n\t\t// TODO: To bound memory usage, there should be a limit on the maximum size of\n\t\t// handle[].\n\n\t\t// TODO: To reduce MergeTree lookups, this code should opportunistically grow\n\t\t// the cache to the next MergeTree segment boundary (within the limits of\n\t\t// the handle cache).\n\n\t\tif (_position < this.start) {\n\t\t\tconst handles: Handle[] = [];\n\t\t\tthis.getHandles(_position, this.start, handles);\n\t\t\thandles.push(...this.handles);\n\t\t\tthis.handles = handles;\n\t\t\tthis.start = _position;\n\t\t\treturn this.handles[0];\n\t\t} else {\n\t\t\tensureRange(_position, this.vector.getLength());\n\t\t\tthis.getHandles(this.start + this.handles.length, _position + 1, this.handles);\n\t\t\treturn this.handles[this.handles.length - 1];\n\t\t}\n\t}\n\n\t// #region IVectorConsumer\n\n\titemsChanged(start: number, removedCount: number, insertedCount: number): void {\n\t\t// If positions were inserted/removed, our current policy is to trim the array\n\t\t// at the beginning of the invalidate range and lazily repopulate the handles\n\t\t// on demand.\n\t\t//\n\t\t// Some alternatives to consider that preserve the previously cached handles\n\t\t// that are still valid:\n\t\t//\n\t\t// * Eagerly populate the 'handles[]' with the newly insert values (currently guaranteed\n\t\t// to be Handle.unallocated, so we don't even need to look them up.)\n\t\t//\n\t\t// * Use a sentinel value or other mechanism to allow \"holes\" in the cache.\n\n\t\tconst index = this.getIndex(start);\n\t\tif (index < this.handles.length) {\n\t\t\tthis.handles.length = index;\n\t\t}\n\t}\n\n\t// #endregion IVectorConsumer\n}\n"]}
|
package/lib/packageVersion.d.ts
CHANGED
package/lib/packageVersion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,wBAAwB,CAAC;AAChD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/matrix\";\nexport const pkgVersion = \"2.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,wBAAwB,CAAC;AAChD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/matrix\";\nexport const pkgVersion = \"2.31.1\";\n"]}
|
package/lib/tsdoc-metadata.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/matrix",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.31.1",
|
|
4
4
|
"description": "Distributed matrix",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -69,17 +69,17 @@
|
|
|
69
69
|
"temp-directory": "nyc/.nyc_output"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@fluid-internal/client-utils": "~2.
|
|
73
|
-
"@fluidframework/core-interfaces": "~2.
|
|
74
|
-
"@fluidframework/core-utils": "~2.
|
|
75
|
-
"@fluidframework/datastore-definitions": "~2.
|
|
76
|
-
"@fluidframework/driver-definitions": "~2.
|
|
77
|
-
"@fluidframework/driver-utils": "~2.
|
|
78
|
-
"@fluidframework/merge-tree": "~2.
|
|
79
|
-
"@fluidframework/runtime-definitions": "~2.
|
|
80
|
-
"@fluidframework/runtime-utils": "~2.
|
|
81
|
-
"@fluidframework/shared-object-base": "~2.
|
|
82
|
-
"@fluidframework/telemetry-utils": "~2.
|
|
72
|
+
"@fluid-internal/client-utils": "~2.31.1",
|
|
73
|
+
"@fluidframework/core-interfaces": "~2.31.1",
|
|
74
|
+
"@fluidframework/core-utils": "~2.31.1",
|
|
75
|
+
"@fluidframework/datastore-definitions": "~2.31.1",
|
|
76
|
+
"@fluidframework/driver-definitions": "~2.31.1",
|
|
77
|
+
"@fluidframework/driver-utils": "~2.31.1",
|
|
78
|
+
"@fluidframework/merge-tree": "~2.31.1",
|
|
79
|
+
"@fluidframework/runtime-definitions": "~2.31.1",
|
|
80
|
+
"@fluidframework/runtime-utils": "~2.31.1",
|
|
81
|
+
"@fluidframework/shared-object-base": "~2.31.1",
|
|
82
|
+
"@fluidframework/telemetry-utils": "~2.31.1",
|
|
83
83
|
"@tiny-calc/nano": "0.0.0-alpha.5",
|
|
84
84
|
"double-ended-queue": "^2.1.0-0",
|
|
85
85
|
"tslib": "^1.10.0"
|
|
@@ -87,18 +87,18 @@
|
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@arethetypeswrong/cli": "^0.17.1",
|
|
89
89
|
"@biomejs/biome": "~1.9.3",
|
|
90
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
91
|
-
"@fluid-private/stochastic-test-utils": "~2.
|
|
92
|
-
"@fluid-private/test-dds-utils": "~2.
|
|
90
|
+
"@fluid-internal/mocha-test-setup": "~2.31.1",
|
|
91
|
+
"@fluid-private/stochastic-test-utils": "~2.31.1",
|
|
92
|
+
"@fluid-private/test-dds-utils": "~2.31.1",
|
|
93
93
|
"@fluid-tools/benchmark": "^0.50.0",
|
|
94
94
|
"@fluid-tools/build-cli": "^0.54.0",
|
|
95
95
|
"@fluidframework/build-common": "^2.0.3",
|
|
96
96
|
"@fluidframework/build-tools": "^0.54.0",
|
|
97
|
-
"@fluidframework/container-definitions": "~2.
|
|
97
|
+
"@fluidframework/container-definitions": "~2.31.1",
|
|
98
98
|
"@fluidframework/eslint-config-fluid": "^5.7.3",
|
|
99
|
-
"@fluidframework/matrix-previous": "npm:@fluidframework/matrix@2.
|
|
100
|
-
"@fluidframework/test-runtime-utils": "~2.
|
|
101
|
-
"@microsoft/api-extractor": "7.
|
|
99
|
+
"@fluidframework/matrix-previous": "npm:@fluidframework/matrix@2.31.0",
|
|
100
|
+
"@fluidframework/test-runtime-utils": "~2.31.1",
|
|
101
|
+
"@microsoft/api-extractor": "7.50.1",
|
|
102
102
|
"@tiny-calc/micro": "0.0.0-alpha.5",
|
|
103
103
|
"@types/double-ended-queue": "^2.1.0",
|
|
104
104
|
"@types/mocha": "^10.0.10",
|
|
@@ -113,7 +113,6 @@
|
|
|
113
113
|
"mocha": "^10.8.2",
|
|
114
114
|
"mocha-multi-reporters": "^1.5.1",
|
|
115
115
|
"moment": "^2.21.0",
|
|
116
|
-
"prettier": "~3.0.3",
|
|
117
116
|
"replace-in-file": "^6.3.5",
|
|
118
117
|
"rimraf": "^4.4.0",
|
|
119
118
|
"ts-node": "^10.9.1",
|
|
@@ -150,7 +149,6 @@
|
|
|
150
149
|
"check:exports:esm:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.esm.json",
|
|
151
150
|
"check:exports:esm:public": "api-extractor run --config api-extractor/api-extractor-lint-public.esm.json",
|
|
152
151
|
"check:format": "npm run check:biome",
|
|
153
|
-
"check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
|
|
154
152
|
"ci:build:api-reports": "concurrently \"npm:ci:build:api-reports:*\"",
|
|
155
153
|
"ci:build:api-reports:current": "api-extractor run --config api-extractor/api-extractor.current.json",
|
|
156
154
|
"ci:build:api-reports:legacy": "api-extractor run --config api-extractor/api-extractor.legacy.json",
|
|
@@ -160,7 +158,6 @@
|
|
|
160
158
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
161
159
|
"format": "npm run format:biome",
|
|
162
160
|
"format:biome": "biome check . --write",
|
|
163
|
-
"format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
164
161
|
"lint": "fluid-build . --task lint",
|
|
165
162
|
"lint:fix": "fluid-build . --task eslint:fix --task format",
|
|
166
163
|
"test": "npm run test:mocha",
|
package/src/handlecache.ts
CHANGED
|
@@ -72,11 +72,10 @@ export class HandleCache implements IVectorConsumer<Handle> {
|
|
|
72
72
|
/**
|
|
73
73
|
* Used by {@link HandleCache.cacheMiss} to retrieve handles for a range of positions.
|
|
74
74
|
*/
|
|
75
|
-
private getHandles(start: number, end: number): Handle[] {
|
|
75
|
+
private getHandles(start: number, end: number, handles: Handle[]): Handle[] {
|
|
76
76
|
// TODO: This can be accelerated substantially using 'walkSegments()'. The only catch
|
|
77
77
|
// is that
|
|
78
78
|
|
|
79
|
-
const handles: Handle[] = [];
|
|
80
79
|
const { vector } = this;
|
|
81
80
|
|
|
82
81
|
for (let pos = start; pos < end; pos++) {
|
|
@@ -102,16 +101,15 @@ export class HandleCache implements IVectorConsumer<Handle> {
|
|
|
102
101
|
// the handle cache).
|
|
103
102
|
|
|
104
103
|
if (_position < this.start) {
|
|
105
|
-
|
|
104
|
+
const handles: Handle[] = [];
|
|
105
|
+
this.getHandles(_position, this.start, handles);
|
|
106
|
+
handles.push(...this.handles);
|
|
107
|
+
this.handles = handles;
|
|
106
108
|
this.start = _position;
|
|
107
109
|
return this.handles[0];
|
|
108
110
|
} else {
|
|
109
111
|
ensureRange(_position, this.vector.getLength());
|
|
110
|
-
|
|
111
|
-
this.handles = [
|
|
112
|
-
...this.handles,
|
|
113
|
-
...this.getHandles(this.start + this.handles.length, _position + 1),
|
|
114
|
-
];
|
|
112
|
+
this.getHandles(this.start + this.handles.length, _position + 1, this.handles);
|
|
115
113
|
return this.handles[this.handles.length - 1];
|
|
116
114
|
}
|
|
117
115
|
}
|
package/src/packageVersion.ts
CHANGED
package/tsconfig.json
CHANGED