@fluidframework/sequence 1.2.0-77818 → 1.2.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/README.md +158 -9
- package/api-extractor.json +1 -9
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/intervalCollection.d.ts +12 -1
- package/dist/intervalCollection.d.ts.map +1 -1
- package/dist/intervalCollection.js +10 -7
- package/dist/intervalCollection.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/index.d.ts +11 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +11 -0
- package/lib/index.js.map +1 -1
- package/lib/intervalCollection.d.ts +12 -1
- package/lib/intervalCollection.d.ts.map +1 -1
- package/lib/intervalCollection.js +10 -7
- package/lib/intervalCollection.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/package.json +15 -15
- package/src/index.ts +12 -0
- package/src/intervalCollection.ts +41 -13
- package/src/packageVersion.ts +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
# @fluidframework/sequence
|
|
2
2
|
|
|
3
|
-
The **@fluidframework/sequence**
|
|
4
|
-
|
|
3
|
+
The **@fluidframework/sequence** package supports distributed data structures which are list-like.
|
|
4
|
+
Its main export is [SharedString][], a DDS for storing and simultaneously editing a sequence of text.
|
|
5
|
+
|
|
5
6
|
Note that SharedString is a sequence DDS but it has additional specialized features and behaviors for working with text.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
This package historically contained several other sequence-based DDSes, but because they have unintuitive behaviors,
|
|
9
|
+
they are deprecated and being moved to the *experimental* folder.
|
|
10
|
+
|
|
11
|
+
The main reason for this is the lack of *move* semantics within the sequence, which becomes crucial when dealing with sequences of
|
|
12
|
+
complex content.
|
|
13
|
+
For that reason, all of the examples in this README use `SharedString`. However, the APIs discussed are available on the common base class: `SharedSegmentSequence`.
|
|
14
|
+
|
|
8
15
|
For the remainder of this document, the term *sequence* will refer to this base class.
|
|
9
16
|
|
|
10
17
|
*Item*s are the individual units that are stored within the sequence (e.g. in a SharedString, the items are characters),
|
|
@@ -43,8 +50,11 @@ farther position is closer to the length. -->
|
|
|
43
50
|
|
|
44
51
|
## Using a Sequence
|
|
45
52
|
|
|
46
|
-
Sequences support three basic operations: insert, remove, and annotate.
|
|
47
|
-
items from the sequence, while annotate is used to add metadata to items.
|
|
53
|
+
Sequences support three basic operations: insert, remove, and annotate.
|
|
54
|
+
Insert and remove are used to add and remove items from the sequence, while annotate is used to add metadata to items.
|
|
55
|
+
Notably, sequences do not support a notion of "moving" a range of content.
|
|
56
|
+
|
|
57
|
+
If "move" semantics are a hard requirement for your scenario, [this github issue](https://github.com/microsoft/FluidFramework/issues/8518) outlines some reasonable alternatives.
|
|
48
58
|
|
|
49
59
|
### Insert
|
|
50
60
|
|
|
@@ -148,6 +158,27 @@ specified range. Setting a property key to null will remove that property from t
|
|
|
148
158
|
Whenever an operation is performed on a sequence a *sequenceDelta* event will be raised. This event provides the ranges
|
|
149
159
|
affected by the operation, the type of the operation, and the properties that were changes by the operation.
|
|
150
160
|
|
|
161
|
+
```typescript
|
|
162
|
+
sharedString.on("sequenceDelta", ({ deltaOperation, ranges, isLocal }) => {
|
|
163
|
+
if (isLocal) {
|
|
164
|
+
// undo-redo implementations frequently will only concern themselves with local ops: only operations submitted
|
|
165
|
+
// by the local client should be undoable by the current user
|
|
166
|
+
addOperationToUndoStack(deltaOperation, ranges);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (deltaOperation === MergeTreeDeltaType.INSERT) {
|
|
170
|
+
syncInsertSegmentToModel(deltaOperation, ranges);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// realistic app code would likely handle the other deltaOperation types as well here.
|
|
174
|
+
});
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Internally, the sequence package depends on `@fluidframework/merge-tree`, and also raises `MergeTreeMaintenance` events on that tree as *maintenance* events.
|
|
178
|
+
These events don't correspond directly to APIs invoked on a sequence DDS, but may be useful for advanced users.
|
|
179
|
+
|
|
180
|
+
Both sequenceDelta and maintenance events are commonly used to synchronize or invalidate a view an application might have over a backing sequence DDS.
|
|
181
|
+
|
|
151
182
|
## Sequence merge strategy
|
|
152
183
|
|
|
153
184
|
The Fluid sequence data structures are eventually consistent, which means all editors will end up in the same
|
|
@@ -245,6 +276,124 @@ As mentioned above, annotate operations behave like operations on SharedMaps. Th
|
|
|
245
276
|
wins. If two collaborators set the same key on the annotate properties the operation that gets ordered last will
|
|
246
277
|
determine the value.
|
|
247
278
|
|
|
279
|
+
## Local references
|
|
280
|
+
|
|
281
|
+
Sequences support addition and manipulation of *local references* to locally track positions in the sequence over time.
|
|
282
|
+
As the name suggests, any created references will only exist locally; other clients will not see them.
|
|
283
|
+
This can be used to implement user interactions with sequence data in a way that is robust to concurrent editing.
|
|
284
|
+
For example, consider a text editor which tracks a user's cursor state.
|
|
285
|
+
The application can store a local reference to the character after the cursor position:
|
|
286
|
+
|
|
287
|
+
```typescript
|
|
288
|
+
// content: hi world!
|
|
289
|
+
// positions: 012345678
|
|
290
|
+
const { segment, offset } = sharedString.getContainingSegment(5)
|
|
291
|
+
const cursor = sharedString.createLocalReferencePosition(
|
|
292
|
+
segment,
|
|
293
|
+
offset,
|
|
294
|
+
ReferenceType.SlideOnRemove,
|
|
295
|
+
/* any additional properties */ { cursorColor: 'blue' }
|
|
296
|
+
);
|
|
297
|
+
|
|
298
|
+
// cursor: x
|
|
299
|
+
// content: hi world!
|
|
300
|
+
// positions: 012345678
|
|
301
|
+
|
|
302
|
+
// ... in some view code, retrieve the position of the local reference for rendering:
|
|
303
|
+
const pos = sharedString.localReferencePositionToPosition(cursor); // 5
|
|
304
|
+
|
|
305
|
+
// meanwhile, some other client submits an edit which gets applied to our string:
|
|
306
|
+
otherSharedString.replaceText(1, 2, "ello");
|
|
307
|
+
|
|
308
|
+
// The local sharedString state will now look like this:
|
|
309
|
+
// cursor: x
|
|
310
|
+
// content: hello world!
|
|
311
|
+
// positions: 0123456789AB (hex)
|
|
312
|
+
|
|
313
|
+
// ... in some view code, retrieve the position of the local reference for rendering:
|
|
314
|
+
const pos = sharedString.localReferencePositionToPosition(cursor); // 8
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
Notice that even though another client concurrently edited the string, the local reference representing the cursor is still in the correct location with no further work for the API consumer.
|
|
318
|
+
The `ReferenceType.SlideOnRemove` parameter changes what happens when the segment that reference is associated with is removed.
|
|
319
|
+
`SlideOnRemove` instructs the sequence to attempt to *slide* the reference to the start of the next furthest segment, or if no such segment exists (i.e. the end of the string has been removed), the end of the next nearest one.
|
|
320
|
+
|
|
321
|
+
The [webflow](https://github.com/microsoft/FluidFramework/blob/main/examples/data-objects/webflow/src/editor/caret.ts) example demonstrates this idea in more detail.
|
|
322
|
+
|
|
323
|
+
Unlike segments, it *is* safe to persist local references in auxiliary data structures, such as an undo-redo stack.
|
|
324
|
+
|
|
325
|
+
## Interval collections
|
|
326
|
+
|
|
327
|
+
Sequences support creation of *interval collections*, an auxiliary collection of intervals associated with positions in the sequence.
|
|
328
|
+
Like segments, intervals support adding arbitrary properties, including handles (references) to other DDSes.
|
|
329
|
+
The interval collection implementation uses local references, and so benefits from all of the robustness to concurrent editing
|
|
330
|
+
described in the previous section.
|
|
331
|
+
Unlike local references, operations on interval collections are sent to all clients and updated in an eventually consistent way.
|
|
332
|
+
This makes them suitable for implementing features like comment threads on a text-based documents.
|
|
333
|
+
The following example illustrates these properties and highlights the major APIs supported by IntervalCollection.
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
```typescript
|
|
337
|
+
// content: hi world!
|
|
338
|
+
// positions: 012345678
|
|
339
|
+
|
|
340
|
+
const comments = sharedString.getIntervalCollection("comments");
|
|
341
|
+
const comment = comments.add(
|
|
342
|
+
3,
|
|
343
|
+
7, // (inclusive range): references "world"
|
|
344
|
+
IntervalType.SlideOnRemove,
|
|
345
|
+
{
|
|
346
|
+
creator: 'my-user-id',
|
|
347
|
+
handle: myCommentThreadDDS.handle
|
|
348
|
+
}
|
|
349
|
+
);
|
|
350
|
+
// content: hi world!
|
|
351
|
+
// positions: 012345678
|
|
352
|
+
// comment: [ ]
|
|
353
|
+
|
|
354
|
+
// Interval collection supports iterating over all intervals via Symbol.iterator or `.map()`:
|
|
355
|
+
const allIntervalsInCollection = Array.from(comments);
|
|
356
|
+
const allProperties = comments.map((comment) => comment.properties);
|
|
357
|
+
// or iterating over intervals overlapping a region:
|
|
358
|
+
const intervalsOverlappingFirstHalf = comments.findOverlappingIntervals(0, 4);
|
|
359
|
+
|
|
360
|
+
// Interval endpoints are LocalReferencePositions, so all APIs in the above section can be used:
|
|
361
|
+
const startPosition = sharedString.localReferencePositionToPosition(comment.start);
|
|
362
|
+
const endPosition = sharedString.localReferencePositionToPosition(comment.end);
|
|
363
|
+
|
|
364
|
+
// Intervals can be modified:
|
|
365
|
+
comments.change(comment.getIntervalId(), 0, 1);
|
|
366
|
+
// content: hi world!
|
|
367
|
+
// positions: 012345678
|
|
368
|
+
// comment: []
|
|
369
|
+
|
|
370
|
+
// their properties can be changed:
|
|
371
|
+
comments.changeProperties(comment.getIntervalId(), { status: "resolved" });
|
|
372
|
+
// comment.properties === { creator: 'my-user-id', handle: <some DDS handle object>, status: "resolved" }
|
|
373
|
+
|
|
374
|
+
// and they can be removed:
|
|
375
|
+
comments.removeIntervalById(comment.getIntervalId());
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### Intervals vs. markers
|
|
379
|
+
|
|
380
|
+
Interval endpoints and markers both implement *ReferencePosition* and seem to serve a similar function so it's not obvious how they differ and why you would choose one or the other.
|
|
381
|
+
|
|
382
|
+
Using the interval collection API has two main benefits:
|
|
383
|
+
|
|
384
|
+
1. Efficient spatial querying
|
|
385
|
+
- Interval collections support iterating all intervals overlapping the region `[start, end]` in `O(log N) + O(overlap size)` time, where `N` is the total number of intervals in the collection.
|
|
386
|
+
This may be critical for applications that display only a small view of the document contents.
|
|
387
|
+
On the other hand, using markers to implement intervals would require a linear scan from the start or end of the sequence to determine which intervals overlap.
|
|
388
|
+
|
|
389
|
+
2. More ergonomic modification APIs
|
|
390
|
+
- Interval collections natively support a modify operation on the intervals, which allows moving the endpoints of the interval to a different place in the sequence.
|
|
391
|
+
This operation is atomic, whereas with markers one would have to submit a delete operation for the existing position and an insert for the new one.
|
|
392
|
+
In order to achieve the same atomicity, those operations would need to leverage the `SharedSegmentSequence.groupOperation` API,
|
|
393
|
+
which is less user-friendly.
|
|
394
|
+
If the ops were submitted using standard insert and delete APIs instead, there would be some potential for data loss if the delete
|
|
395
|
+
operation ended up acknowledged by the server but the insert operation did not.
|
|
396
|
+
|
|
248
397
|
## SharedString
|
|
249
398
|
|
|
250
399
|
The SharedString is a specialized data structure for handling collaborative text. It is based on a more general
|
|
@@ -266,15 +415,15 @@ to 0, and the farther position is closer to the length.
|
|
|
266
415
|
|
|
267
416
|
- Rich Text Editor Implementations
|
|
268
417
|
- [webflow](https://github.com/microsoft/FluidFramework/tree/main/examples/data-objects/webflow)
|
|
269
|
-
- [flowView](https://github.com/microsoft/FluidFramework/blob/main/examples/data-objects/client-ui-lib/
|
|
418
|
+
- [flowView](https://github.com/microsoft/FluidFramework/blob/main/examples/data-objects/shared-text/src/client-ui-lib/controls/flowView.ts)
|
|
270
419
|
|
|
271
420
|
- Integrations with Open Source Rich Text Editors
|
|
272
421
|
- [prosemirror](https://github.com/microsoft/FluidFramework/tree/main/examples/data-objects/prosemirror)
|
|
273
422
|
- [smde](https://github.com/microsoft/FluidFramework/tree/main/examples/data-objects/smde)
|
|
274
|
-
- [draft-js](https://github.com/microsoft/FluidExamples/tree/main/draft-js)
|
|
275
423
|
|
|
276
424
|
- Plain Text Editor Implementations
|
|
277
|
-
- [collaborativeTextArea](https://github.com/microsoft/FluidFramework/blob/main/
|
|
278
|
-
- [collaborativeInput](https://github.com/microsoft/FluidFramework/blob/main/
|
|
425
|
+
- [collaborativeTextArea](https://github.com/microsoft/FluidFramework/blob/main/experimental/framework/react-inputs/src/CollaborativeTextArea.tsx)
|
|
426
|
+
- [collaborativeInput](https://github.com/microsoft/FluidFramework/blob/main/experimental/framework/react-inputs/src/CollaborativeInput.tsx)
|
|
279
427
|
|
|
280
428
|
[SharedMap]: https://fluidframework.com/docs/data-structures/map/
|
|
429
|
+
[SharedString]: https://github.com/microsoft/FluidFramework/blob/main/packages/dds/sequence/src/sharedString.ts
|
package/api-extractor.json
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "@fluidframework/build-common/api-extractor-common-
|
|
4
|
-
"messages": {
|
|
5
|
-
"extractorMessageReporting": {
|
|
6
|
-
"ae-internal-missing-underscore": {
|
|
7
|
-
"logLevel": "none",
|
|
8
|
-
"addToApiReportFile": false
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
}
|
|
3
|
+
"extends": "@fluidframework/build-common/api-extractor-common-strict.json"
|
|
12
4
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
/**
|
|
6
|
+
* Supports distributed data structures which are list-like.
|
|
7
|
+
*
|
|
8
|
+
* This package's main export is {@link SharedSequence}, a DDS for storing and simultaneously editing a sequence of
|
|
9
|
+
* text.
|
|
10
|
+
*
|
|
11
|
+
* @remarks Note that SharedString is a sequence DDS but it has additional specialized features and behaviors for
|
|
12
|
+
* working with text.
|
|
13
|
+
*
|
|
14
|
+
* @packageDocumentation
|
|
15
|
+
*/
|
|
5
16
|
export { DeserializeCallback, IIntervalCollectionEvent, IIntervalHelpers, Interval, IntervalCollection, IntervalCollectionIterator, IntervalType, ISerializableInterval, ISerializedInterval, SequenceInterval, ISerializedIntervalCollectionV2, CompressedSerializedInterval, } from "./intervalCollection";
|
|
6
17
|
export { IMapMessageLocalMetadata, IValueOpEmitter, } from "./defaultMapInterfaces";
|
|
7
18
|
export * from "./sharedString";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,mBAAmB,EACnB,wBAAwB,EACxB,gBAAgB,EAChB,QAAQ,EACR,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,+BAA+B,EAC/B,4BAA4B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACH,wBAAwB,EACxB,eAAe,GAClB,MAAM,wBAAwB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;GAUG;AAEH,OAAO,EACH,mBAAmB,EACnB,wBAAwB,EACxB,gBAAgB,EAChB,QAAQ,EACR,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,+BAA+B,EAC/B,4BAA4B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACH,wBAAwB,EACxB,eAAe,GAClB,MAAM,wBAAwB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -15,6 +15,17 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.SequenceInterval = exports.IntervalType = exports.IntervalCollectionIterator = exports.IntervalCollection = exports.Interval = void 0;
|
|
18
|
+
/**
|
|
19
|
+
* Supports distributed data structures which are list-like.
|
|
20
|
+
*
|
|
21
|
+
* This package's main export is {@link SharedSequence}, a DDS for storing and simultaneously editing a sequence of
|
|
22
|
+
* text.
|
|
23
|
+
*
|
|
24
|
+
* @remarks Note that SharedString is a sequence DDS but it has additional specialized features and behaviors for
|
|
25
|
+
* working with text.
|
|
26
|
+
*
|
|
27
|
+
* @packageDocumentation
|
|
28
|
+
*/
|
|
18
29
|
var intervalCollection_1 = require("./intervalCollection");
|
|
19
30
|
Object.defineProperty(exports, "Interval", { enumerable: true, get: function () { return intervalCollection_1.Interval; } });
|
|
20
31
|
Object.defineProperty(exports, "IntervalCollection", { enumerable: true, get: function () { return intervalCollection_1.IntervalCollection; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;AAEH,2DAa8B;AAT1B,8GAAA,QAAQ,OAAA;AACR,wHAAA,kBAAkB,OAAA;AAClB,gIAAA,0BAA0B,OAAA;AAC1B,kHAAA,YAAY,OAAA;AAGZ,sHAAA,gBAAgB,OAAA;AAQpB,iDAA+B;AAC/B,6CAA2B;AAC3B,oDAAkC;AAClC,uDAAqC;AACrC,mDAAiC;AACjC,yDAAuC;AACvC,yDAAuC;AACvC,iDAA+B;AAC/B,6DAA2C","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n DeserializeCallback,\n IIntervalCollectionEvent,\n IIntervalHelpers,\n Interval,\n IntervalCollection,\n IntervalCollectionIterator,\n IntervalType,\n ISerializableInterval,\n ISerializedInterval,\n SequenceInterval,\n ISerializedIntervalCollectionV2,\n CompressedSerializedInterval,\n} from \"./intervalCollection\";\nexport {\n IMapMessageLocalMetadata,\n IValueOpEmitter,\n} from \"./defaultMapInterfaces\";\nexport * from \"./sharedString\";\nexport * from \"./sequence\";\nexport * from \"./sequenceFactory\";\nexport * from \"./sequenceDeltaEvent\";\nexport * from \"./sharedSequence\";\nexport * from \"./sharedObjectSequence\";\nexport * from \"./sharedNumberSequence\";\nexport * from \"./sparsematrix\";\nexport * from \"./sharedIntervalCollection\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;AAEH;;;;;;;;;;GAUG;AAEH,2DAa8B;AAT1B,8GAAA,QAAQ,OAAA;AACR,wHAAA,kBAAkB,OAAA;AAClB,gIAAA,0BAA0B,OAAA;AAC1B,kHAAA,YAAY,OAAA;AAGZ,sHAAA,gBAAgB,OAAA;AAQpB,iDAA+B;AAC/B,6CAA2B;AAC3B,oDAAkC;AAClC,uDAAqC;AACrC,mDAAiC;AACjC,yDAAuC;AACvC,yDAAuC;AACvC,iDAA+B;AAC/B,6DAA2C","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Supports distributed data structures which are list-like.\n *\n * This package's main export is {@link SharedSequence}, a DDS for storing and simultaneously editing a sequence of\n * text.\n *\n * @remarks Note that SharedString is a sequence DDS but it has additional specialized features and behaviors for\n * working with text.\n *\n * @packageDocumentation\n */\n\nexport {\n DeserializeCallback,\n IIntervalCollectionEvent,\n IIntervalHelpers,\n Interval,\n IntervalCollection,\n IntervalCollectionIterator,\n IntervalType,\n ISerializableInterval,\n ISerializedInterval,\n SequenceInterval,\n ISerializedIntervalCollectionV2,\n CompressedSerializedInterval,\n} from \"./intervalCollection\";\nexport {\n IMapMessageLocalMetadata,\n IValueOpEmitter,\n} from \"./defaultMapInterfaces\";\nexport * from \"./sharedString\";\nexport * from \"./sequence\";\nexport * from \"./sequenceFactory\";\nexport * from \"./sequenceDeltaEvent\";\nexport * from \"./sharedSequence\";\nexport * from \"./sharedObjectSequence\";\nexport * from \"./sharedNumberSequence\";\nexport * from \"./sparsematrix\";\nexport * from \"./sharedIntervalCollection\";\n"]}
|
|
@@ -54,7 +54,18 @@ export interface ISerializableInterval extends IInterval {
|
|
|
54
54
|
}
|
|
55
55
|
export interface IIntervalHelpers<TInterval extends ISerializableInterval> {
|
|
56
56
|
compareEnds(a: TInterval, b: TInterval): number;
|
|
57
|
-
|
|
57
|
+
/**
|
|
58
|
+
*
|
|
59
|
+
* @param label - label of the interval collection this interval is being added to. This parameter is
|
|
60
|
+
* irrelevant for transient intervals.
|
|
61
|
+
* @param start - numerical start position of the interval
|
|
62
|
+
* @param end - numberical end position of the interval
|
|
63
|
+
* @param client - client creating the interval
|
|
64
|
+
* @param intervalType - Type of interval to create. Default is SlideOnRemove
|
|
65
|
+
* @param op - If this create came from a remote client, op that created it. Default is undefined (i.e. local)
|
|
66
|
+
* @param fromSnapshot - If this create came from loading a snapshot. Default is false.
|
|
67
|
+
*/
|
|
68
|
+
create(label: string, start: number, end: number, client: Client, intervalType?: IntervalType, op?: ISequencedDocumentMessage, fromSnapshot?: boolean): TInterval;
|
|
58
69
|
}
|
|
59
70
|
export declare class Interval implements ISerializableInterval {
|
|
60
71
|
start: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intervalCollection.d.ts","sourceRoot":"","sources":["../src/intervalCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAU,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAE5D,OAAO,EAEH,MAAM,EAGN,YAAY,EACZ,SAAS,EACT,wBAAwB,EAIxB,cAAc,EAEd,iBAAiB,EACjB,WAAW,EAMd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAGjF,OAAO,EAEH,aAAa,EACb,eAAe,EACf,eAAe,EACf,UAAU,EAEb,MAAM,wBAAwB,CAAC;AAIhC,oBAAY,YAAY;IACpB,MAAM,IAAM;IACZ,IAAI,IAAM;IACV;;;;;OAKG;IACH,aAAa,IAAM;IACnB;;;OAGG;IACH,SAAS,IAAM;CAClB;AAED,MAAM,WAAW,mBAAmB;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,YAAY,CAAC;IAC3B,UAAU,CAAC,EAAE,WAAW,CAAC;CAC5B;AAED;;;;;GAKG;AACH,oBAAY,4BAA4B,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;AAE/F;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,CAAC;IACX,SAAS,EAAE,4BAA4B,EAAE,CAAC;CAC7C;AAkCD,MAAM,WAAW,qBAAsB,SAAQ,SAAS;IACpD,UAAU,EAAE,WAAW,CAAC;IACxB,eAAe,EAAE,iBAAi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AQrC,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS;IAQxC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS;CAO9C"}
|
|
@@ -344,7 +344,7 @@ function createPositionReferenceFromSegoff(client, segoff, refType, op) {
|
|
|
344
344
|
return new merge_tree_1.LocalReference(client, undefined, 0, refType);
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
|
-
function createPositionReference(client, pos, refType, op) {
|
|
347
|
+
function createPositionReference(client, pos, refType, op, fromSnapshot) {
|
|
348
348
|
let segoff;
|
|
349
349
|
if (op) {
|
|
350
350
|
(0, common_utils_1.assert)((refType & merge_tree_1.ReferenceType.SlideOnRemove) !== 0, 0x2f5 /* op create references must be SlideOnRemove */);
|
|
@@ -352,12 +352,12 @@ function createPositionReference(client, pos, refType, op) {
|
|
|
352
352
|
segoff = client.getSlideToSegment(segoff);
|
|
353
353
|
}
|
|
354
354
|
else {
|
|
355
|
-
(0, common_utils_1.assert)((refType & merge_tree_1.ReferenceType.SlideOnRemove) === 0, 0x2f6 /* SlideOnRemove references must be op created */);
|
|
355
|
+
(0, common_utils_1.assert)((refType & merge_tree_1.ReferenceType.SlideOnRemove) === 0 || fromSnapshot, 0x2f6 /* SlideOnRemove references must be op created */);
|
|
356
356
|
segoff = client.getContainingSegment(pos);
|
|
357
357
|
}
|
|
358
358
|
return createPositionReferenceFromSegoff(client, segoff, refType, op);
|
|
359
359
|
}
|
|
360
|
-
function createSequenceInterval(label, start, end, client, intervalType, op) {
|
|
360
|
+
function createSequenceInterval(label, start, end, client, intervalType, op, fromSnapshot) {
|
|
361
361
|
let beginRefType = merge_tree_1.ReferenceType.RangeBegin;
|
|
362
362
|
let endRefType = merge_tree_1.ReferenceType.RangeEnd;
|
|
363
363
|
if (intervalType === IntervalType.Transient) {
|
|
@@ -372,7 +372,7 @@ function createSequenceInterval(label, start, end, client, intervalType, op) {
|
|
|
372
372
|
// All non-transient interval references must eventually be SlideOnRemove
|
|
373
373
|
// To ensure eventual consistency, they must start as StayOnRemove when
|
|
374
374
|
// pending (created locally and creation op is not acked)
|
|
375
|
-
if (op) {
|
|
375
|
+
if (op || fromSnapshot) {
|
|
376
376
|
beginRefType |= merge_tree_1.ReferenceType.SlideOnRemove;
|
|
377
377
|
endRefType |= merge_tree_1.ReferenceType.SlideOnRemove;
|
|
378
378
|
}
|
|
@@ -381,8 +381,8 @@ function createSequenceInterval(label, start, end, client, intervalType, op) {
|
|
|
381
381
|
endRefType |= merge_tree_1.ReferenceType.StayOnRemove;
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
|
-
const startLref = createPositionReference(client, start, beginRefType, op);
|
|
385
|
-
const endLref = createPositionReference(client, end, endRefType, op);
|
|
384
|
+
const startLref = createPositionReference(client, start, beginRefType, op, fromSnapshot);
|
|
385
|
+
const endLref = createPositionReference(client, end, endRefType, op, fromSnapshot);
|
|
386
386
|
startLref.pairedRef = endLref;
|
|
387
387
|
endLref.pairedRef = startLref;
|
|
388
388
|
const rangeProp = {
|
|
@@ -805,7 +805,10 @@ class IntervalCollection extends common_utils_1.TypedEventEmitter {
|
|
|
805
805
|
if (this.savedSerializedIntervals) {
|
|
806
806
|
for (const serializedInterval of this.savedSerializedIntervals) {
|
|
807
807
|
this.localCollection.ensureSerializedId(serializedInterval);
|
|
808
|
-
|
|
808
|
+
const { start, end, intervalType, properties } = serializedInterval;
|
|
809
|
+
const interval = this.helpers.create(label, start, end, client, intervalType, undefined, true);
|
|
810
|
+
interval.addProperties(properties);
|
|
811
|
+
this.localCollection.add(interval);
|
|
809
812
|
}
|
|
810
813
|
}
|
|
811
814
|
this.savedSerializedIntervals = undefined;
|