@fluidframework/sequence 2.0.0-internal.6.4.0 → 2.0.0-internal.7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +60 -0
- package/README.md +130 -0
- package/dist/defaultMap.d.ts +1 -1
- package/dist/defaultMap.d.ts.map +1 -1
- package/dist/defaultMap.js +6 -6
- package/dist/defaultMap.js.map +1 -1
- package/dist/defaultMapInterfaces.d.ts +21 -2
- package/dist/defaultMapInterfaces.d.ts.map +1 -1
- package/dist/defaultMapInterfaces.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/intervalCollection.d.ts +136 -18
- package/dist/intervalCollection.d.ts.map +1 -1
- package/dist/intervalCollection.js +120 -37
- package/dist/intervalCollection.js.map +1 -1
- package/dist/intervalIndex/endpointInRangeIndex.js +1 -1
- package/dist/intervalIndex/endpointInRangeIndex.js.map +1 -1
- package/dist/intervalIndex/endpointIndex.d.ts.map +1 -1
- package/dist/intervalIndex/endpointIndex.js +1 -2
- package/dist/intervalIndex/endpointIndex.js.map +1 -1
- package/dist/intervalIndex/overlappingIntervalsIndex.d.ts +5 -4
- package/dist/intervalIndex/overlappingIntervalsIndex.d.ts.map +1 -1
- package/dist/intervalIndex/overlappingIntervalsIndex.js +7 -2
- package/dist/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
- package/dist/intervalIndex/startpointInRangeIndex.d.ts.map +1 -1
- package/dist/intervalIndex/startpointInRangeIndex.js +1 -3
- package/dist/intervalIndex/startpointInRangeIndex.js.map +1 -1
- package/dist/intervalTree.d.ts +1 -1
- package/dist/intervalTree.d.ts.map +1 -1
- package/dist/intervals/interval.d.ts +3 -2
- package/dist/intervals/interval.d.ts.map +1 -1
- package/dist/intervals/interval.js +12 -5
- package/dist/intervals/interval.js.map +1 -1
- package/dist/intervals/intervalUtils.d.ts +39 -18
- package/dist/intervals/intervalUtils.d.ts.map +1 -1
- package/dist/intervals/intervalUtils.js +12 -10
- package/dist/intervals/intervalUtils.js.map +1 -1
- package/dist/intervals/sequenceInterval.d.ts +23 -13
- package/dist/intervals/sequenceInterval.d.ts.map +1 -1
- package/dist/intervals/sequenceInterval.js +117 -42
- package/dist/intervals/sequenceInterval.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/dist/revertibles.d.ts +3 -15
- package/dist/revertibles.d.ts.map +1 -1
- package/dist/revertibles.js +6 -17
- package/dist/revertibles.js.map +1 -1
- package/dist/sequence.d.ts +1 -1
- package/dist/sequence.d.ts.map +1 -1
- package/dist/sequence.js +43 -43
- package/dist/sequence.js.map +1 -1
- package/dist/sharedIntervalCollection.js +9 -9
- package/dist/sharedIntervalCollection.js.map +1 -1
- package/dist/sharedSequence.js +6 -6
- package/dist/sharedSequence.js.map +1 -1
- package/dist/sharedString.d.ts +1 -1
- package/dist/sharedString.d.ts.map +1 -1
- package/dist/sharedString.js +5 -5
- package/dist/sharedString.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/defaultMap.d.ts +1 -1
- package/lib/defaultMap.d.ts.map +1 -1
- package/lib/defaultMap.js +6 -6
- package/lib/defaultMap.js.map +1 -1
- package/lib/defaultMapInterfaces.d.ts +21 -2
- package/lib/defaultMapInterfaces.d.ts.map +1 -1
- package/lib/defaultMapInterfaces.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/intervalCollection.d.ts +136 -18
- package/lib/intervalCollection.d.ts.map +1 -1
- package/lib/intervalCollection.js +117 -37
- package/lib/intervalCollection.js.map +1 -1
- package/lib/intervalIndex/endpointInRangeIndex.js +1 -1
- package/lib/intervalIndex/endpointInRangeIndex.js.map +1 -1
- package/lib/intervalIndex/endpointIndex.d.ts.map +1 -1
- package/lib/intervalIndex/endpointIndex.js +1 -2
- package/lib/intervalIndex/endpointIndex.js.map +1 -1
- package/lib/intervalIndex/overlappingIntervalsIndex.d.ts +5 -4
- package/lib/intervalIndex/overlappingIntervalsIndex.d.ts.map +1 -1
- package/lib/intervalIndex/overlappingIntervalsIndex.js +7 -2
- package/lib/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
- package/lib/intervalIndex/startpointInRangeIndex.d.ts.map +1 -1
- package/lib/intervalIndex/startpointInRangeIndex.js +1 -3
- package/lib/intervalIndex/startpointInRangeIndex.js.map +1 -1
- package/lib/intervalTree.d.ts +1 -1
- package/lib/intervalTree.d.ts.map +1 -1
- package/lib/intervals/interval.d.ts +3 -2
- package/lib/intervals/interval.d.ts.map +1 -1
- package/lib/intervals/interval.js +12 -5
- package/lib/intervals/interval.js.map +1 -1
- package/lib/intervals/intervalUtils.d.ts +39 -18
- package/lib/intervals/intervalUtils.d.ts.map +1 -1
- package/lib/intervals/intervalUtils.js +8 -6
- package/lib/intervals/intervalUtils.js.map +1 -1
- package/lib/intervals/sequenceInterval.d.ts +23 -13
- package/lib/intervals/sequenceInterval.d.ts.map +1 -1
- package/lib/intervals/sequenceInterval.js +118 -41
- package/lib/intervals/sequenceInterval.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/revertibles.d.ts +3 -15
- package/lib/revertibles.d.ts.map +1 -1
- package/lib/revertibles.js +6 -17
- package/lib/revertibles.js.map +1 -1
- package/lib/sequence.d.ts +1 -1
- package/lib/sequence.d.ts.map +1 -1
- package/lib/sequence.js +43 -43
- package/lib/sequence.js.map +1 -1
- package/lib/sharedIntervalCollection.js +9 -9
- package/lib/sharedIntervalCollection.js.map +1 -1
- package/lib/sharedSequence.js +6 -6
- package/lib/sharedSequence.js.map +1 -1
- package/lib/sharedString.d.ts +1 -1
- package/lib/sharedString.d.ts.map +1 -1
- package/lib/sharedString.js +5 -5
- package/lib/sharedString.js.map +1 -1
- package/package.json +48 -20
- package/src/defaultMapInterfaces.ts +21 -2
- package/src/index.ts +3 -0
- package/src/intervalCollection.ts +309 -66
- package/src/intervalIndex/endpointInRangeIndex.ts +1 -1
- package/src/intervalIndex/endpointIndex.ts +1 -2
- package/src/intervalIndex/overlappingIntervalsIndex.ts +17 -9
- package/src/intervalIndex/startpointInRangeIndex.ts +1 -7
- package/src/intervals/interval.ts +28 -7
- package/src/intervals/intervalUtils.ts +47 -26
- package/src/intervals/sequenceInterval.ts +190 -46
- package/src/packageVersion.ts +1 -1
- package/src/revertibles.ts +8 -33
- package/src/sequence.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,65 @@
|
|
|
1
1
|
# @fluidframework/sequence
|
|
2
2
|
|
|
3
|
+
## 2.0.0-internal.7.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- sequence: New API for specifying spatial positioning of intervals [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
8
|
+
|
|
9
|
+
Previously intervals were specified with only an index. Now the model is a bit more nuanced in that you can specify positions that lie before or after a given index. This makes it more clear how interval endpoints should interact with changes to the sequence. See the docs for SequencePlace for additional context.
|
|
10
|
+
|
|
11
|
+
- sequence: IIntervalCollection.change must specify both endpoints [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
12
|
+
|
|
13
|
+
IIntervalCollection.change no longer allows an endpoint to be undefined. undefined can unintentionally result in end < start. To adapt to this change, simply use the current position of the endpoint that is not intended to change.
|
|
14
|
+
|
|
15
|
+
- Dependencies on @fluidframework/protocol-definitions package updated to 3.0.0 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
16
|
+
|
|
17
|
+
This included the following changes from the protocol-definitions release:
|
|
18
|
+
|
|
19
|
+
- Updating signal interfaces for some planned improvements. The intention is split the interface between signals
|
|
20
|
+
submitted by clients to the server and the resulting signals sent from the server to clients.
|
|
21
|
+
- A new optional type member is available on the ISignalMessage interface and a new ISentSignalMessage interface has
|
|
22
|
+
been added, which will be the typing for signals sent from the client to the server. Both extend a new
|
|
23
|
+
ISignalMessageBase interface that contains common members.
|
|
24
|
+
- The @fluidframework/common-definitions package dependency has been updated to version 1.0.0.
|
|
25
|
+
|
|
26
|
+
- Server upgrade: dependencies on Fluid server packages updated to 2.0.1 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
27
|
+
|
|
28
|
+
Dependencies on the following Fluid server package have been updated to version 2.0.1:
|
|
29
|
+
|
|
30
|
+
- @fluidframework/gitresources: 2.0.1
|
|
31
|
+
- @fluidframework/server-kafka-orderer: 2.0.1
|
|
32
|
+
- @fluidframework/server-lambdas: 2.0.1
|
|
33
|
+
- @fluidframework/server-lambdas-driver: 2.0.1
|
|
34
|
+
- @fluidframework/server-local-server: 2.0.1
|
|
35
|
+
- @fluidframework/server-memory-orderer: 2.0.1
|
|
36
|
+
- @fluidframework/protocol-base: 2.0.1
|
|
37
|
+
- @fluidframework/server-routerlicious: 2.0.1
|
|
38
|
+
- @fluidframework/server-routerlicious-base: 2.0.1
|
|
39
|
+
- @fluidframework/server-services: 2.0.1
|
|
40
|
+
- @fluidframework/server-services-client: 2.0.1
|
|
41
|
+
- @fluidframework/server-services-core: 2.0.1
|
|
42
|
+
- @fluidframework/server-services-ordering-kafkanode: 2.0.1
|
|
43
|
+
- @fluidframework/server-services-ordering-rdkafka: 2.0.1
|
|
44
|
+
- @fluidframework/server-services-ordering-zookeeper: 2.0.1
|
|
45
|
+
- @fluidframework/server-services-shared: 2.0.1
|
|
46
|
+
- @fluidframework/server-services-telemetry: 2.0.1
|
|
47
|
+
- @fluidframework/server-services-utils: 2.0.1
|
|
48
|
+
- @fluidframework/server-test-utils: 2.0.1
|
|
49
|
+
- tinylicious: 2.0.1
|
|
50
|
+
|
|
51
|
+
- Minimum TypeScript version now 5.1.6 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
52
|
+
|
|
53
|
+
The minimum supported TypeScript version for Fluid 2.0 clients is now 5.1.6.
|
|
54
|
+
|
|
55
|
+
- sequence: Remove `compareStarts` and `compareEnds` from `IIntervalHelpers` [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
56
|
+
|
|
57
|
+
These methods are redudant with the functions `IInterval.compareStart` and `IInterval.compareEnd` respectively.
|
|
58
|
+
|
|
59
|
+
- sequence: Remove the mergeTreeUseNewLengthCalculations flag [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
60
|
+
|
|
61
|
+
The `mergeTreeUseNewLengthCalculations` flag has been removed, because the feature was enabled by default in 2.0.0-internal.6.0.0.
|
|
62
|
+
|
|
3
63
|
## 2.0.0-internal.6.4.0
|
|
4
64
|
|
|
5
65
|
Dependency updates only.
|
package/README.md
CHANGED
|
@@ -387,6 +387,132 @@ comments.changeProperties(comment.getIntervalId(), { status: "resolved" });
|
|
|
387
387
|
comments.removeIntervalById(comment.getIntervalId());
|
|
388
388
|
```
|
|
389
389
|
|
|
390
|
+
### Interval stickiness
|
|
391
|
+
|
|
392
|
+
"Stickiness" refers to the behavior of intervals when text is inserted on either
|
|
393
|
+
side of the interval. A "sticky" interval is one which expands to include text
|
|
394
|
+
inserted directly adjacent to it.
|
|
395
|
+
|
|
396
|
+
A "start sticky" interval is one which expands only to include text inserted to
|
|
397
|
+
the start of it. An "end sticky" interval is the same, but with regard to text
|
|
398
|
+
inserted adjacent to the end.
|
|
399
|
+
|
|
400
|
+
For example, let's look at the string "abc". If we have an interval on the
|
|
401
|
+
character "b", what happens when we insert text on either side of it? In the
|
|
402
|
+
below diagrams, we represent an interval by putting a caret directly underneath
|
|
403
|
+
the characters it contains.
|
|
404
|
+
|
|
405
|
+
#### Example
|
|
406
|
+
|
|
407
|
+
##### Original string
|
|
408
|
+
|
|
409
|
+
```typescript
|
|
410
|
+
abc
|
|
411
|
+
^
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
##### No stickiness
|
|
415
|
+
|
|
416
|
+
```typescript
|
|
417
|
+
aXbYc
|
|
418
|
+
^
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
The interval does not expand to include the newly inserted characters `X` and `Y`.
|
|
422
|
+
|
|
423
|
+
##### Start stickiness
|
|
424
|
+
|
|
425
|
+
```typescript
|
|
426
|
+
aXbYc
|
|
427
|
+
^^
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
##### End stickiness
|
|
431
|
+
|
|
432
|
+
```typescript
|
|
433
|
+
aXbYc
|
|
434
|
+
^^
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
##### Full stickiness
|
|
438
|
+
|
|
439
|
+
```typescript
|
|
440
|
+
aXbYc
|
|
441
|
+
^^^
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
#### Concrete Implementation
|
|
445
|
+
|
|
446
|
+
The above is a description of the abstract semantics of the concept of stickiness.
|
|
447
|
+
In practice, this is implemented using the concept of "sides."
|
|
448
|
+
|
|
449
|
+
For a given sequence of N characters, there are 2N + 2 positions which can be
|
|
450
|
+
referenced: the position immediately before and after each character, and two
|
|
451
|
+
special endpoint segments denoting the position before and after the start and
|
|
452
|
+
end of the sequence respectively.
|
|
453
|
+
|
|
454
|
+
By placing the endpoints of an interval either before or after a character, it
|
|
455
|
+
is possible to make the endpoints inclusive or exclusive. An exclusive endpoint
|
|
456
|
+
in a given direction implies stickiness in that direction. Whether an endpoint
|
|
457
|
+
is inclusive or exclusive depends on both the Side and if it is the start or the
|
|
458
|
+
end.
|
|
459
|
+
|
|
460
|
+
Given the string "ABCD":
|
|
461
|
+
|
|
462
|
+
```typescript
|
|
463
|
+
// Refers to "BC". If any content is inserted before B or after C, this
|
|
464
|
+
// interval will include that content
|
|
465
|
+
//
|
|
466
|
+
// Picture:
|
|
467
|
+
// {start} - A[- B - C -]D - {end}
|
|
468
|
+
// {start} - A - B - C - D - {end}
|
|
469
|
+
collection.add(
|
|
470
|
+
{ pos: 0, side: Side.After },
|
|
471
|
+
{ pos: 3, side: Side.Before },
|
|
472
|
+
IntervalType.SlideOnRemove,
|
|
473
|
+
);
|
|
474
|
+
// Equivalent to specifying the same positions and Side.Before.
|
|
475
|
+
// Refers to "ABC". Content inserted after C will be included in the
|
|
476
|
+
// interval, but content inserted before A will not.
|
|
477
|
+
// {start} -[A - B - C -]D - {end}
|
|
478
|
+
// {start} - A - B - C - D - {end}
|
|
479
|
+
collection.add(0, 3, IntervalType.SlideOnRemove);
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
In the case of the first interval shown, if text is deleted,
|
|
483
|
+
|
|
484
|
+
```typescript
|
|
485
|
+
// Delete the character "B"
|
|
486
|
+
string.removeRange(1, 2);
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
The start point of the interval will slide to the position immediately before
|
|
490
|
+
"C", and the same will be true.
|
|
491
|
+
|
|
492
|
+
```typescript
|
|
493
|
+
{start} - A[- C -]D - {end}
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
In this case, text inserted immediately before "C" would be included in the
|
|
497
|
+
interval.
|
|
498
|
+
|
|
499
|
+
```typescript
|
|
500
|
+
string.insertText(1, "EFG");
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
With the string now being,
|
|
504
|
+
|
|
505
|
+
```typescript
|
|
506
|
+
{start} - A[- E - F - G - C -]D - {end}
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
Note that the endpoint continues to remain with the associated character, except
|
|
510
|
+
when the character is removed. When content containing endpoints is removed,
|
|
511
|
+
`After` endpoints move backward and `Before` endpoints move forward to maintain their
|
|
512
|
+
side value and inclusive/exclusive behavior.
|
|
513
|
+
|
|
514
|
+
<!-- This line ends the content that is copied to the sequences.md README -->
|
|
515
|
+
|
|
390
516
|
## SharedString
|
|
391
517
|
|
|
392
518
|
SharedString is a specialized data structure for handling collaborative text. It is based on a more general
|
|
@@ -460,6 +586,8 @@ For further reading on attribution, see the [@fluid-experimental/attributor READ
|
|
|
460
586
|
|
|
461
587
|
There are plans to make attribution policies more flexible, for example tracking attribution of property changes separately from segment insertion.
|
|
462
588
|
|
|
589
|
+
<!-- This line begins the content that is copied to the string.md README -->
|
|
590
|
+
|
|
463
591
|
### Examples
|
|
464
592
|
|
|
465
593
|
- Rich Text Editor Implementations
|
|
@@ -476,5 +604,7 @@ There are plans to make attribution policies more flexible, for example tracking
|
|
|
476
604
|
- [collaborativeTextArea](https://github.com/microsoft/FluidFramework/blob/main/experimental/framework/react-inputs/src/CollaborativeTextArea.tsx)
|
|
477
605
|
- [collaborativeInput](https://github.com/microsoft/FluidFramework/blob/main/experimental/framework/react-inputs/src/CollaborativeInput.tsx)
|
|
478
606
|
|
|
607
|
+
<!-- This line ends the content that is copied to the string.md README -->
|
|
608
|
+
|
|
479
609
|
[sharedmap]: https://fluidframework.com/docs/data-structures/map/
|
|
480
610
|
[sharedstring]: https://github.com/microsoft/FluidFramework/blob/main/packages/dds/sequence/src/sharedString.ts
|
package/dist/defaultMap.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export interface IMapValueTypeOperation {
|
|
|
28
28
|
/**
|
|
29
29
|
* Description of a map delta operation
|
|
30
30
|
*/
|
|
31
|
-
export
|
|
31
|
+
export type IMapOperation = IMapValueTypeOperation;
|
|
32
32
|
/**
|
|
33
33
|
* Defines the in-memory object structure to be used for the conversion to/from serialized.
|
|
34
34
|
* Directly used in JSON.stringify, direct result from JSON.parse
|
package/dist/defaultMap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultMap.d.ts","sourceRoot":"","sources":["../src/defaultMap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,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,GAAG,IAAI;IAM1F;;OAEG;IACI,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC;IAM1B;;;;OAIG;IACI,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIhC;;;;OAIG;IACI,oBAAoB,CAAC,UAAU,EAAE,gBAAgB,GAAG,wBAAwB;IAQ5E,sBAAsB,CAAC,UAAU,EAAE,gBAAgB,GAAG,0BAA0B;IAQhF,SAAS,CAAC,UAAU,EAAE,gBAAgB,GAAG,MAAM;IAItD;;;OAGG;IACI,wBAAwB,CAAC,IAAI,EAAE,0BAA0B,GAAG,IAAI;IA0BhE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAInC;;;;;;;OAOG;IACI,kBAAkB,CAAC,EAAE,EAAE,GAAG,EAAE,eAAe,EAAE,wBAAwB,GAAG,OAAO;IAU/E,4BAA4B,CAAC,EAAE,EAAE,GAAG,GAAG,OAAO;IASrD;;;;;;;OAOG;IACI,iBAAiB,CACvB,EAAE,EAAE,aAAa,EACjB,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,yBAAyB,GAAG,SAAS,EAC9C,eAAe,EAAE,OAAO,GACtB,OAAO;IASV;;;;;OAKG;IACH,OAAO,CAAC,UAAU;IAYlB;;;;;;;;;OASG;IACH,OAAO,CAAC,SAAS;IAgBjB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IA2C1B;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;CA0B7B"}
|
package/dist/defaultMap.js
CHANGED
|
@@ -17,6 +17,12 @@ const localValues_1 = require("./localValues");
|
|
|
17
17
|
* a collection that wasn't previously known)
|
|
18
18
|
*/
|
|
19
19
|
class DefaultMap {
|
|
20
|
+
/**
|
|
21
|
+
* The number of key/value pairs stored in the map.
|
|
22
|
+
*/
|
|
23
|
+
get size() {
|
|
24
|
+
return this.data.size;
|
|
25
|
+
}
|
|
20
26
|
/**
|
|
21
27
|
* Create a new default map.
|
|
22
28
|
* @param serializer - The serializer to serialize / parse handles
|
|
@@ -42,12 +48,6 @@ class DefaultMap {
|
|
|
42
48
|
this.data = new Map();
|
|
43
49
|
this.messageHandlers = this.getMessageHandlers();
|
|
44
50
|
}
|
|
45
|
-
/**
|
|
46
|
-
* The number of key/value pairs stored in the map.
|
|
47
|
-
*/
|
|
48
|
-
get size() {
|
|
49
|
-
return this.data.size;
|
|
50
|
-
}
|
|
51
51
|
/**
|
|
52
52
|
* Get an iterator over the keys in this map.
|
|
53
53
|
* @returns The iterator
|
package/dist/defaultMap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultMap.js","sourceRoot":"","sources":["../src/defaultMap.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,2EAK4C;AAC5C,+DAAiE;AACjE,2DAAoD;AACpD,+CAAsE;AAiFtE;;;;;;GAMG;AACH,MAAa,UAAU;IAkBtB;;;;;;;OAOG;IACH,YACkB,UAA4B,EAC5B,MAAoB,EACpB,aAGR,EACQ,IAAmB,EACnB,OAAkC,EACnC,eAAe,IAAI,gCAAiB,EAA2B;QAR9D,eAAU,GAAV,UAAU,CAAkB;QAC5B,WAAM,GAAN,MAAM,CAAc;QACpB,kBAAa,GAAb,aAAa,CAGrB;QACQ,SAAI,GAAJ,IAAI,CAAe;QACnB,YAAO,GAAP,OAAO,CAA2B;QACnC,iBAAY,GAAZ,YAAY,CAAmD;QA3BhF;;WAEG;QACc,oBAAe,GAA4C,IAAI,GAAG,EAAE,CAAC;QAEtF;;WAEG;QACc,SAAI,GAAG,IAAI,GAAG,EAAkC,CAAC;QAqBjE,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAClD,CAAC;IArCD;;OAEG;IACH,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI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AM,CAC3D,UAAU,CAAC,KAAK,EAChB,EAAE,CAAC,KAAK,EACR,eAAe,CACf,CAAC;gBACF,IAAI,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,sBAAsB,CAAC,CAAC;YACzE,CAAC;YACD,yBAAyB,EAAE,CAAC,EAA0B,EAAE,EAAE;gBACzD,IAAA,mBAAM,EACL,KAAK,EACL,KAAK,CAAC,kEAAkE,CACxE,CAAC;YACH,CAAC;SACD,CAAC,CAAC;QAEH,OAAO,eAAe,CAAC;IACxB,CAAC;IAED;;;;;OAKG;IACK,qBAAqB,CAAC,GAAW;QACxC,MAAM,IAAI,GAAG,CACZ,MAAc,EACd,aAAkB,EAClB,MAAW,EACX,eAAyC,EACxC,EAAE;YACH,MAAM,gBAAgB,GAAG,IAAA,4CAAuB,EAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAEvF,MAAM,EAAE,GAA2B;gBAClC,GAAG;gBACH,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE;oBACN,MAAM;oBACN,KAAK,EAAE,gBAAgB;iBACvB;aACD,CAAC;YAEF,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,eAAe,CAAC,CAAC;YAExC,MAAM,KAAK,GAAkB,EAAE,GAAG,EAAE,aAAa,EAAE,CAAC;YACpD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC9E,CAAC,CAAC;QAEF,OAAO,EAAE,IAAI,EAAE,CAAC;IACjB,CAAC;CACD;AAnWD,gCAmWC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n\tIFluidSerializer,\n\tmakeHandlesSerializable,\n\tparseHandles,\n\tValueType,\n} from \"@fluidframework/shared-object-base\";\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { makeSerializable, ValueTypeLocalValue } from \"./localValues\";\nimport {\n\tISerializableValue,\n\tISerializedValue,\n\tIValueChanged,\n\tIValueOpEmitter,\n\tIValueType,\n\tIValueTypeOperationValue,\n\tISharedDefaultMapEvents,\n\tIMapMessageLocalMetadata,\n\tSequenceOptions,\n} from \"./defaultMapInterfaces\";\n\n/**\n * Defines the means to process and submit a given op on a map.\n */\ninterface IMapMessageHandler {\n\t/**\n\t * Apply the given operation.\n\t * @param op - The map operation to apply\n\t * @param local - Whether the message originated from the local client\n\t * @param message - The full message. Not provided for stashed ops.\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprocess(\n\t\top: IMapOperation,\n\t\tlocal: boolean,\n\t\tmessage: ISequencedDocumentMessage | undefined,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t): void;\n\n\t/**\n\t * Communicate the operation to remote clients.\n\t * @param op - The map operation to submit\n\t */\n\tsubmit(op: IMapOperation, localOpMetadata: IMapMessageLocalMetadata): void;\n\n\tresubmit(op: IMapOperation, localOpMetadata: IMapMessageLocalMetadata): void;\n\n\tgetStashedOpLocalMetadata(op: IMapOperation): unknown;\n}\n\n/**\n * Describes an operation specific to a value type.\n */\nexport interface IMapValueTypeOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"act\";\n\n\t/**\n\t * Map key being modified.\n\t */\n\tkey: string;\n\n\t/**\n\t * Value of the operation, specific to the value type.\n\t * @alpha\n\t */\n\tvalue: IValueTypeOperationValue;\n}\n\n/**\n * Description of a map delta operation\n */\nexport type IMapOperation = IMapValueTypeOperation;\n\n/**\n * Defines the in-memory object structure to be used for the conversion to/from serialized.\n * Directly used in JSON.stringify, direct result from JSON.parse\n */\nexport interface IMapDataObjectSerializable {\n\t[key: string]: ISerializableValue;\n}\n\nexport interface IMapDataObjectSerialized {\n\t[key: string]: ISerializedValue;\n}\n\n/**\n * A DefaultMap is a map-like distributed data structure, supporting operations on values stored by\n * string key locations.\n *\n * Creation of values is implicit on access (either via `get` or a remote op application referring to\n * a collection that wasn't previously known)\n */\nexport class DefaultMap<T> {\n\t/**\n\t * The number of key/value pairs stored in the map.\n\t */\n\tpublic get size(): number {\n\t\treturn this.data.size;\n\t}\n\n\t/**\n\t * Mapping of op types to message handlers.\n\t */\n\tprivate readonly messageHandlers: ReadonlyMap<string, IMapMessageHandler> = new Map();\n\n\t/**\n\t * The in-memory data the map is storing.\n\t */\n\tprivate readonly data = new Map<string, ValueTypeLocalValue<T>>();\n\n\t/**\n\t * Create a new default map.\n\t * @param serializer - The serializer to serialize / parse handles\n\t * @param handle - The handle of the shared object using the kernel\n\t * @param submitMessage - A callback to submit a message through the shared object\n\t * @param type - The value type to create at values of this map\n\t * @param eventEmitter - The object that will emit map events\n\t */\n\tconstructor(\n\t\tprivate readonly serializer: IFluidSerializer,\n\t\tprivate readonly handle: IFluidHandle,\n\t\tprivate readonly submitMessage: (\n\t\t\top: any,\n\t\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t\t) => void,\n\t\tprivate readonly type: IValueType<T>,\n\t\tprivate readonly options?: Partial<SequenceOptions>,\n\t\tpublic readonly eventEmitter = new TypedEventEmitter<ISharedDefaultMapEvents>(),\n\t) {\n\t\tthis.messageHandlers = this.getMessageHandlers();\n\t}\n\n\t/**\n\t * Get an iterator over the keys in this map.\n\t * @returns The iterator\n\t */\n\tpublic keys(): IterableIterator<string> {\n\t\treturn this.data.keys();\n\t}\n\n\t/**\n\t * Get an iterator over the entries in this map.\n\t * @returns The iterator\n\t */\n\tpublic entries(): IterableIterator<[string, any]> {\n\t\tconst localEntriesIterator = this.data.entries();\n\t\tconst iterator = {\n\t\t\tnext(): IteratorResult<[string, any]> {\n\t\t\t\tconst nextVal = localEntriesIterator.next();\n\t\t\t\treturn nextVal.done\n\t\t\t\t\t? { value: undefined, done: true }\n\t\t\t\t\t: { value: [nextVal.value[0], nextVal.value[1].value], done: false }; // Unpack the stored value\n\t\t\t},\n\t\t\t[Symbol.iterator]() {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * Get an iterator over the values in this map.\n\t * @returns The iterator\n\t */\n\tpublic values(): IterableIterator<any> {\n\t\tconst localValuesIterator = this.data.values();\n\t\tconst iterator = {\n\t\t\tnext(): IteratorResult<any> {\n\t\t\t\tconst nextVal = localValuesIterator.next();\n\t\t\t\treturn nextVal.done\n\t\t\t\t\t? { value: undefined, done: true }\n\t\t\t\t\t: { value: nextVal.value.value, done: false }; // Unpack the stored value\n\t\t\t},\n\t\t\t[Symbol.iterator]() {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * Get an iterator over the entries in this map.\n\t * @returns The iterator\n\t */\n\tpublic [Symbol.iterator](): IterableIterator<[string, any]> {\n\t\treturn this.entries();\n\t}\n\n\t/**\n\t * Executes the given callback on each entry in the map.\n\t * @param callbackFn - Callback function\n\t */\n\tpublic forEach(callbackFn: (value: any, key: string, map: Map<string, any>) => void): void {\n\t\tthis.data.forEach((localValue, key, m) => {\n\t\t\tcallbackFn(localValue.value, key, m);\n\t\t});\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedMap.get}\n\t */\n\tpublic get(key: string): T {\n\t\tconst localValue = this.data.get(key) ?? this.createCore(key, true);\n\n\t\treturn localValue.value;\n\t}\n\n\t/**\n\t * Check if a key exists in the map.\n\t * @param key - The key to check\n\t * @returns True if the key exists, false otherwise\n\t */\n\tpublic has(key: string): boolean {\n\t\treturn this.data.has(key);\n\t}\n\n\t/**\n\t * Serializes the data stored in the shared map to a JSON string\n\t * @param serializer - The serializer to use to serialize handles in its values.\n\t * @returns A JSON string containing serialized map data\n\t */\n\tpublic getSerializedStorage(serializer: IFluidSerializer): IMapDataObjectSerialized {\n\t\tconst serializableMapData: IMapDataObjectSerialized = {};\n\t\tthis.data.forEach((localValue, key) => {\n\t\t\tserializableMapData[key] = localValue.makeSerialized(serializer, this.handle);\n\t\t});\n\t\treturn serializableMapData;\n\t}\n\n\tpublic getSerializableStorage(serializer: IFluidSerializer): IMapDataObjectSerializable {\n\t\tconst serializableMapData: IMapDataObjectSerializable = {};\n\t\tthis.data.forEach((localValue, key) => {\n\t\t\tserializableMapData[key] = makeSerializable(localValue, serializer, this.handle);\n\t\t});\n\t\treturn serializableMapData;\n\t}\n\n\tpublic serialize(serializer: IFluidSerializer): string {\n\t\treturn JSON.stringify(this.getSerializableStorage(serializer));\n\t}\n\n\t/**\n\t * Populate the kernel with the given map data.\n\t * @param data - A JSON string containing serialized map data\n\t */\n\tpublic populateFromSerializable(json: IMapDataObjectSerializable): void {\n\t\tfor (const [key, serializable] of Object.entries(json)) {\n\t\t\t// Back-compat: legacy documents may have handles to an intervalCollection map kernel.\n\t\t\t// These collections should be empty, and ValueTypes are no longer supported.\n\t\t\tif (\n\t\t\t\tserializable.type === ValueType[ValueType.Plain] ||\n\t\t\t\tserializable.type === ValueType[ValueType.Shared]\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Back-compat: Sequence previously arbitrarily prefixed all interval collection keys with\n\t\t\t// \"intervalCollections/\". This would burden users trying to iterate the collection and\n\t\t\t// access its value, as well as those trying to match a create message to its underlying\n\t\t\t// collection. See https://github.com/microsoft/FluidFramework/issues/10557 for more context.\n\t\t\tconst normalizedKey = key.startsWith(\"intervalCollections/\") ? key.substring(20) : key;\n\n\t\t\tconst localValue = {\n\t\t\t\tkey: normalizedKey,\n\t\t\t\tvalue: this.makeLocal(key, serializable),\n\t\t\t};\n\n\t\t\tthis.data.set(localValue.key, localValue.value);\n\t\t}\n\t}\n\n\tpublic populate(json: string): void {\n\t\tthis.populateFromSerializable(JSON.parse(json) as IMapDataObjectSerializable);\n\t}\n\n\t/**\n\t * Submit the given op if a handler is registered.\n\t * @param op - The operation to attempt to submit\n\t * @param localOpMetadata - The local metadata associated with the op. This is kept locally by the runtime\n\t * and not sent to the server. This will be sent back when this message is received back from the server. This is\n\t * also sent if we are asked to resubmit the message.\n\t * @returns True if the operation was submitted, false otherwise.\n\t */\n\tpublic tryResubmitMessage(op: any, localOpMetadata: IMapMessageLocalMetadata): boolean {\n\t\tconst type: string = op.type;\n\t\tconst handler = this.messageHandlers.get(type);\n\t\tif (handler !== undefined) {\n\t\t\thandler.resubmit(op as IMapOperation, localOpMetadata);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic tryGetStashedOpLocalMetadata(op: any): unknown {\n\t\tconst type: string = op.type;\n\t\tif (this.messageHandlers.has(type)) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\treturn this.messageHandlers.get(type)!.getStashedOpLocalMetadata(op as IMapOperation);\n\t\t}\n\t\tthrow new Error(\"no apply stashed op handler\");\n\t}\n\n\t/**\n\t * Process the given op if a handler is registered.\n\t * @param message - The message to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @returns True if the operation was processed, false otherwise.\n\t */\n\tpublic tryProcessMessage(\n\t\top: IMapOperation,\n\t\tlocal: boolean,\n\t\tmessage: ISequencedDocumentMessage | undefined,\n\t\tlocalOpMetadata: unknown,\n\t): boolean {\n\t\tconst handler = this.messageHandlers.get(op.type);\n\t\tif (handler !== undefined) {\n\t\t\thandler.process(op, local, message, localOpMetadata as IMapMessageLocalMetadata);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Initializes a default ValueType at the provided key.\n\t * Should be used when a map operation incurs creation.\n\t * @param key - The key being initialized\n\t * @param local - Whether the message originated from the local client\n\t */\n\tprivate createCore(key: string, local: boolean): ValueTypeLocalValue<T> {\n\t\tconst localValue = new ValueTypeLocalValue(\n\t\t\tthis.type.factory.load(this.makeMapValueOpEmitter(key), undefined, this.options),\n\t\t\tthis.type,\n\t\t);\n\t\tconst previousValue = this.data.get(key);\n\t\tthis.data.set(key, localValue);\n\t\tconst event: IValueChanged = { key, previousValue };\n\t\tthis.eventEmitter.emit(\"create\", event, local, this.eventEmitter);\n\t\treturn localValue;\n\t}\n\n\t/**\n\t * The remote ISerializableValue we're receiving (either as a result of a load or an incoming set op) will\n\t * have the information we need to create a real object, but will not be the real object yet. For example,\n\t * we might know it's a map and the map's ID but not have the actual map or its data yet. makeLocal's\n\t * job is to convert that information into a real object for local usage.\n\t * @param key - The key that the caller intends to store the local value into (used for ops later). But\n\t * doesn't actually store the local value into that key. So better not lie!\n\t * @param serializable - The remote information that we can convert into a real object\n\t * @returns The local value that was produced\n\t */\n\tprivate makeLocal(key: string, serializable: ISerializableValue): ValueTypeLocalValue<T> {\n\t\tassert(\n\t\t\tserializable.type !== ValueType[ValueType.Plain] &&\n\t\t\t\tserializable.type !== ValueType[ValueType.Shared],\n\t\t\t0x2e1 /* \"Support for plain value types removed.\" */,\n\t\t);\n\n\t\tserializable.value = parseHandles(serializable.value, this.serializer);\n\t\tconst localValue = this.type.factory.load(\n\t\t\tthis.makeMapValueOpEmitter(key),\n\t\t\tserializable.value,\n\t\t\tthis.options,\n\t\t);\n\t\treturn new ValueTypeLocalValue(localValue, this.type);\n\t}\n\n\t/**\n\t * Get the message handlers for the map.\n\t * @returns A map of string op names to IMapMessageHandlers for those ops\n\t */\n\tprivate getMessageHandlers() {\n\t\tconst messageHandlers = new Map<string, IMapMessageHandler>();\n\t\t// Ops with type \"act\" describe actions taken by custom value type handlers of whatever item is\n\t\t// being addressed. These custom handlers can be retrieved from the ValueTypeLocalValue which has\n\t\t// stashed its valueType (and therefore its handlers). We also emit a valueChanged for anyone\n\t\t// watching for manipulations of that item.\n\t\tmessageHandlers.set(\"act\", {\n\t\t\tprocess: (op: IMapValueTypeOperation, local, message, localOpMetadata) => {\n\t\t\t\tconst localValue = this.data.get(op.key) ?? this.createCore(op.key, local);\n\t\t\t\tconst handler = localValue.getOpHandler(op.value.opName);\n\t\t\t\tconst previousValue = localValue.value;\n\t\t\t\tconst translatedValue = parseHandles(op.value.value, this.serializer);\n\t\t\t\thandler.process(previousValue, translatedValue, local, message, localOpMetadata);\n\t\t\t\tconst event: IValueChanged = { key: op.key, previousValue };\n\t\t\t\tthis.eventEmitter.emit(\"valueChanged\", event, local, message, this.eventEmitter);\n\t\t\t},\n\t\t\tsubmit: (op: IMapValueTypeOperation, localOpMetadata: IMapMessageLocalMetadata) => {\n\t\t\t\tthis.submitMessage(op, localOpMetadata);\n\t\t\t},\n\t\t\tresubmit: (op: IMapValueTypeOperation, localOpMetadata: IMapMessageLocalMetadata) => {\n\t\t\t\tconst localValue = this.data.get(op.key);\n\n\t\t\t\tassert(localValue !== undefined, 0x3f8 /* Local value expected on resubmission */);\n\n\t\t\t\tconst handler = localValue.getOpHandler(op.value.opName);\n\t\t\t\tconst { rebasedOp, rebasedLocalOpMetadata } = handler.rebase(\n\t\t\t\t\tlocalValue.value,\n\t\t\t\t\top.value,\n\t\t\t\t\tlocalOpMetadata,\n\t\t\t\t);\n\t\t\t\tthis.submitMessage({ ...op, value: rebasedOp }, rebasedLocalOpMetadata);\n\t\t\t},\n\t\t\tgetStashedOpLocalMetadata: (op: IMapValueTypeOperation) => {\n\t\t\t\tassert(\n\t\t\t\t\tfalse,\n\t\t\t\t\t0x016 /* \"apply stashed op not implemented for custom value type ops\" */,\n\t\t\t\t);\n\t\t\t},\n\t\t});\n\n\t\treturn messageHandlers;\n\t}\n\n\t/**\n\t * Create an emitter for a value type to emit ops from the given key.\n\t * @alpha\n\t * @param key - The key of the map that the value type will be stored on\n\t * @returns A value op emitter for the given key\n\t */\n\tprivate makeMapValueOpEmitter(key: string): IValueOpEmitter {\n\t\tconst emit = (\n\t\t\topName: string,\n\t\t\tpreviousValue: any,\n\t\t\tparams: any,\n\t\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t\t) => {\n\t\t\tconst translatedParams = makeHandlesSerializable(params, this.serializer, this.handle);\n\n\t\t\tconst op: IMapValueTypeOperation = {\n\t\t\t\tkey,\n\t\t\t\ttype: \"act\",\n\t\t\t\tvalue: {\n\t\t\t\t\topName,\n\t\t\t\t\tvalue: translatedParams,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tthis.submitMessage(op, localOpMetadata);\n\n\t\t\tconst event: IValueChanged = { key, previousValue };\n\t\t\tthis.eventEmitter.emit(\"valueChanged\", event, true, null, this.eventEmitter);\n\t\t};\n\n\t\treturn { emit };\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"defaultMap.js","sourceRoot":"","sources":["../src/defaultMap.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,2EAK4C;AAC5C,+DAAiE;AACjE,2DAAoD;AACpD,+CAAsE;AAiFtE;;;;;;GAMG;AACH,MAAa,UAAU;IACtB;;OAEG;IACH,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IACvB,CAAC;IAYD;;;;;;;OAOG;IACH,YACkB,UAA4B,EAC5B,MAAoB,EACpB,aAGR,EACQ,IAAmB,EACnB,OAAkC,EACnC,eAAe,IAAI,gCAAiB,EAA2B;QAR9D,eAAU,GAAV,UAAU,CAAkB;QAC5B,WAAM,GAAN,MAAM,CAAc;QACpB,kBAAa,GAAb,aAAa,CAGrB;QACQ,SAAI,GAAJ,IAAI,CAAe;QACnB,YAAO,GAAP,OAAO,CAA2B;QACnC,iBAAY,GAAZ,YAAY,CAAmD;QA3BhF;;WAEG;QACc,oBAAe,GAA4C,IAAI,GAAG,EAAE,CAAC;QAEtF;;WAEG;QACc,SAAI,GAAG,IAAI,GAAG,EAAkC,CAAC;QAqBjE,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,kBAAkB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,MAAM,CAC3D,UAAU,CAAC,KAAK,EAChB,EAAE,CAAC,KAAK,EACR,eAAe,CACf,CAAC;gBACF,IAAI,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,sBAAsB,CAAC,CAAC;YACzE,CAAC;YACD,yBAAyB,EAAE,CAAC,EAA0B,EAAE,EAAE;gBACzD,IAAA,mBAAM,EACL,KAAK,EACL,KAAK,CAAC,kEAAkE,CACxE,CAAC;YACH,CAAC;SACD,CAAC,CAAC;QAEH,OAAO,eAAe,CAAC;IACxB,CAAC;IAED;;;;;OAKG;IACK,qBAAqB,CAAC,GAAW;QACxC,MAAM,IAAI,GAAG,CACZ,MAAc,EACd,aAAkB,EAClB,MAAW,EACX,eAAyC,EACxC,EAAE;YACH,MAAM,gBAAgB,GAAG,IAAA,4CAAuB,EAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAEvF,MAAM,EAAE,GAA2B;gBAClC,GAAG;gBACH,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE;oBACN,MAAM;oBACN,KAAK,EAAE,gBAAgB;iBACvB;aACD,CAAC;YAEF,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,eAAe,CAAC,CAAC;YAExC,MAAM,KAAK,GAAkB,EAAE,GAAG,EAAE,aAAa,EAAE,CAAC;YACpD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC9E,CAAC,CAAC;QAEF,OAAO,EAAE,IAAI,EAAE,CAAC;IACjB,CAAC;CACD;AAnWD,gCAmWC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n\tIFluidSerializer,\n\tmakeHandlesSerializable,\n\tparseHandles,\n\tValueType,\n} from \"@fluidframework/shared-object-base\";\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { makeSerializable, ValueTypeLocalValue } from \"./localValues\";\nimport {\n\tISerializableValue,\n\tISerializedValue,\n\tIValueChanged,\n\tIValueOpEmitter,\n\tIValueType,\n\tIValueTypeOperationValue,\n\tISharedDefaultMapEvents,\n\tIMapMessageLocalMetadata,\n\tSequenceOptions,\n} from \"./defaultMapInterfaces\";\n\n/**\n * Defines the means to process and submit a given op on a map.\n */\ninterface IMapMessageHandler {\n\t/**\n\t * Apply the given operation.\n\t * @param op - The map operation to apply\n\t * @param local - Whether the message originated from the local client\n\t * @param message - The full message. Not provided for stashed ops.\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprocess(\n\t\top: IMapOperation,\n\t\tlocal: boolean,\n\t\tmessage: ISequencedDocumentMessage | undefined,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t): void;\n\n\t/**\n\t * Communicate the operation to remote clients.\n\t * @param op - The map operation to submit\n\t */\n\tsubmit(op: IMapOperation, localOpMetadata: IMapMessageLocalMetadata): void;\n\n\tresubmit(op: IMapOperation, localOpMetadata: IMapMessageLocalMetadata): void;\n\n\tgetStashedOpLocalMetadata(op: IMapOperation): unknown;\n}\n\n/**\n * Describes an operation specific to a value type.\n */\nexport interface IMapValueTypeOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"act\";\n\n\t/**\n\t * Map key being modified.\n\t */\n\tkey: string;\n\n\t/**\n\t * Value of the operation, specific to the value type.\n\t * @alpha\n\t */\n\tvalue: IValueTypeOperationValue;\n}\n\n/**\n * Description of a map delta operation\n */\nexport type IMapOperation = IMapValueTypeOperation;\n\n/**\n * Defines the in-memory object structure to be used for the conversion to/from serialized.\n * Directly used in JSON.stringify, direct result from JSON.parse\n */\nexport interface IMapDataObjectSerializable {\n\t[key: string]: ISerializableValue;\n}\n\nexport interface IMapDataObjectSerialized {\n\t[key: string]: ISerializedValue;\n}\n\n/**\n * A DefaultMap is a map-like distributed data structure, supporting operations on values stored by\n * string key locations.\n *\n * Creation of values is implicit on access (either via `get` or a remote op application referring to\n * a collection that wasn't previously known)\n */\nexport class DefaultMap<T> {\n\t/**\n\t * The number of key/value pairs stored in the map.\n\t */\n\tpublic get size(): number {\n\t\treturn this.data.size;\n\t}\n\n\t/**\n\t * Mapping of op types to message handlers.\n\t */\n\tprivate readonly messageHandlers: ReadonlyMap<string, IMapMessageHandler> = new Map();\n\n\t/**\n\t * The in-memory data the map is storing.\n\t */\n\tprivate readonly data = new Map<string, ValueTypeLocalValue<T>>();\n\n\t/**\n\t * Create a new default map.\n\t * @param serializer - The serializer to serialize / parse handles\n\t * @param handle - The handle of the shared object using the kernel\n\t * @param submitMessage - A callback to submit a message through the shared object\n\t * @param type - The value type to create at values of this map\n\t * @param eventEmitter - The object that will emit map events\n\t */\n\tconstructor(\n\t\tprivate readonly serializer: IFluidSerializer,\n\t\tprivate readonly handle: IFluidHandle,\n\t\tprivate readonly submitMessage: (\n\t\t\top: any,\n\t\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t\t) => void,\n\t\tprivate readonly type: IValueType<T>,\n\t\tprivate readonly options?: Partial<SequenceOptions>,\n\t\tpublic readonly eventEmitter = new TypedEventEmitter<ISharedDefaultMapEvents>(),\n\t) {\n\t\tthis.messageHandlers = this.getMessageHandlers();\n\t}\n\n\t/**\n\t * Get an iterator over the keys in this map.\n\t * @returns The iterator\n\t */\n\tpublic keys(): IterableIterator<string> {\n\t\treturn this.data.keys();\n\t}\n\n\t/**\n\t * Get an iterator over the entries in this map.\n\t * @returns The iterator\n\t */\n\tpublic entries(): IterableIterator<[string, any]> {\n\t\tconst localEntriesIterator = this.data.entries();\n\t\tconst iterator = {\n\t\t\tnext(): IteratorResult<[string, any]> {\n\t\t\t\tconst nextVal = localEntriesIterator.next();\n\t\t\t\treturn nextVal.done\n\t\t\t\t\t? { value: undefined, done: true }\n\t\t\t\t\t: { value: [nextVal.value[0], nextVal.value[1].value], done: false }; // Unpack the stored value\n\t\t\t},\n\t\t\t[Symbol.iterator]() {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * Get an iterator over the values in this map.\n\t * @returns The iterator\n\t */\n\tpublic values(): IterableIterator<any> {\n\t\tconst localValuesIterator = this.data.values();\n\t\tconst iterator = {\n\t\t\tnext(): IteratorResult<any> {\n\t\t\t\tconst nextVal = localValuesIterator.next();\n\t\t\t\treturn nextVal.done\n\t\t\t\t\t? { value: undefined, done: true }\n\t\t\t\t\t: { value: nextVal.value.value, done: false }; // Unpack the stored value\n\t\t\t},\n\t\t\t[Symbol.iterator]() {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * Get an iterator over the entries in this map.\n\t * @returns The iterator\n\t */\n\tpublic [Symbol.iterator](): IterableIterator<[string, any]> {\n\t\treturn this.entries();\n\t}\n\n\t/**\n\t * Executes the given callback on each entry in the map.\n\t * @param callbackFn - Callback function\n\t */\n\tpublic forEach(callbackFn: (value: any, key: string, map: Map<string, any>) => void): void {\n\t\tthis.data.forEach((localValue, key, m) => {\n\t\t\tcallbackFn(localValue.value, key, m);\n\t\t});\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedMap.get}\n\t */\n\tpublic get(key: string): T {\n\t\tconst localValue = this.data.get(key) ?? this.createCore(key, true);\n\n\t\treturn localValue.value;\n\t}\n\n\t/**\n\t * Check if a key exists in the map.\n\t * @param key - The key to check\n\t * @returns True if the key exists, false otherwise\n\t */\n\tpublic has(key: string): boolean {\n\t\treturn this.data.has(key);\n\t}\n\n\t/**\n\t * Serializes the data stored in the shared map to a JSON string\n\t * @param serializer - The serializer to use to serialize handles in its values.\n\t * @returns A JSON string containing serialized map data\n\t */\n\tpublic getSerializedStorage(serializer: IFluidSerializer): IMapDataObjectSerialized {\n\t\tconst serializableMapData: IMapDataObjectSerialized = {};\n\t\tthis.data.forEach((localValue, key) => {\n\t\t\tserializableMapData[key] = localValue.makeSerialized(serializer, this.handle);\n\t\t});\n\t\treturn serializableMapData;\n\t}\n\n\tpublic getSerializableStorage(serializer: IFluidSerializer): IMapDataObjectSerializable {\n\t\tconst serializableMapData: IMapDataObjectSerializable = {};\n\t\tthis.data.forEach((localValue, key) => {\n\t\t\tserializableMapData[key] = makeSerializable(localValue, serializer, this.handle);\n\t\t});\n\t\treturn serializableMapData;\n\t}\n\n\tpublic serialize(serializer: IFluidSerializer): string {\n\t\treturn JSON.stringify(this.getSerializableStorage(serializer));\n\t}\n\n\t/**\n\t * Populate the kernel with the given map data.\n\t * @param data - A JSON string containing serialized map data\n\t */\n\tpublic populateFromSerializable(json: IMapDataObjectSerializable): void {\n\t\tfor (const [key, serializable] of Object.entries(json)) {\n\t\t\t// Back-compat: legacy documents may have handles to an intervalCollection map kernel.\n\t\t\t// These collections should be empty, and ValueTypes are no longer supported.\n\t\t\tif (\n\t\t\t\tserializable.type === ValueType[ValueType.Plain] ||\n\t\t\t\tserializable.type === ValueType[ValueType.Shared]\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Back-compat: Sequence previously arbitrarily prefixed all interval collection keys with\n\t\t\t// \"intervalCollections/\". This would burden users trying to iterate the collection and\n\t\t\t// access its value, as well as those trying to match a create message to its underlying\n\t\t\t// collection. See https://github.com/microsoft/FluidFramework/issues/10557 for more context.\n\t\t\tconst normalizedKey = key.startsWith(\"intervalCollections/\") ? key.substring(20) : key;\n\n\t\t\tconst localValue = {\n\t\t\t\tkey: normalizedKey,\n\t\t\t\tvalue: this.makeLocal(key, serializable),\n\t\t\t};\n\n\t\t\tthis.data.set(localValue.key, localValue.value);\n\t\t}\n\t}\n\n\tpublic populate(json: string): void {\n\t\tthis.populateFromSerializable(JSON.parse(json) as IMapDataObjectSerializable);\n\t}\n\n\t/**\n\t * Submit the given op if a handler is registered.\n\t * @param op - The operation to attempt to submit\n\t * @param localOpMetadata - The local metadata associated with the op. This is kept locally by the runtime\n\t * and not sent to the server. This will be sent back when this message is received back from the server. This is\n\t * also sent if we are asked to resubmit the message.\n\t * @returns True if the operation was submitted, false otherwise.\n\t */\n\tpublic tryResubmitMessage(op: any, localOpMetadata: IMapMessageLocalMetadata): boolean {\n\t\tconst type: string = op.type;\n\t\tconst handler = this.messageHandlers.get(type);\n\t\tif (handler !== undefined) {\n\t\t\thandler.resubmit(op as IMapOperation, localOpMetadata);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic tryGetStashedOpLocalMetadata(op: any): unknown {\n\t\tconst type: string = op.type;\n\t\tif (this.messageHandlers.has(type)) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\treturn this.messageHandlers.get(type)!.getStashedOpLocalMetadata(op as IMapOperation);\n\t\t}\n\t\tthrow new Error(\"no apply stashed op handler\");\n\t}\n\n\t/**\n\t * Process the given op if a handler is registered.\n\t * @param message - The message to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @returns True if the operation was processed, false otherwise.\n\t */\n\tpublic tryProcessMessage(\n\t\top: IMapOperation,\n\t\tlocal: boolean,\n\t\tmessage: ISequencedDocumentMessage | undefined,\n\t\tlocalOpMetadata: unknown,\n\t): boolean {\n\t\tconst handler = this.messageHandlers.get(op.type);\n\t\tif (handler !== undefined) {\n\t\t\thandler.process(op, local, message, localOpMetadata as IMapMessageLocalMetadata);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Initializes a default ValueType at the provided key.\n\t * Should be used when a map operation incurs creation.\n\t * @param key - The key being initialized\n\t * @param local - Whether the message originated from the local client\n\t */\n\tprivate createCore(key: string, local: boolean): ValueTypeLocalValue<T> {\n\t\tconst localValue = new ValueTypeLocalValue(\n\t\t\tthis.type.factory.load(this.makeMapValueOpEmitter(key), undefined, this.options),\n\t\t\tthis.type,\n\t\t);\n\t\tconst previousValue = this.data.get(key);\n\t\tthis.data.set(key, localValue);\n\t\tconst event: IValueChanged = { key, previousValue };\n\t\tthis.eventEmitter.emit(\"create\", event, local, this.eventEmitter);\n\t\treturn localValue;\n\t}\n\n\t/**\n\t * The remote ISerializableValue we're receiving (either as a result of a load or an incoming set op) will\n\t * have the information we need to create a real object, but will not be the real object yet. For example,\n\t * we might know it's a map and the map's ID but not have the actual map or its data yet. makeLocal's\n\t * job is to convert that information into a real object for local usage.\n\t * @param key - The key that the caller intends to store the local value into (used for ops later). But\n\t * doesn't actually store the local value into that key. So better not lie!\n\t * @param serializable - The remote information that we can convert into a real object\n\t * @returns The local value that was produced\n\t */\n\tprivate makeLocal(key: string, serializable: ISerializableValue): ValueTypeLocalValue<T> {\n\t\tassert(\n\t\t\tserializable.type !== ValueType[ValueType.Plain] &&\n\t\t\t\tserializable.type !== ValueType[ValueType.Shared],\n\t\t\t0x2e1 /* \"Support for plain value types removed.\" */,\n\t\t);\n\n\t\tserializable.value = parseHandles(serializable.value, this.serializer);\n\t\tconst localValue = this.type.factory.load(\n\t\t\tthis.makeMapValueOpEmitter(key),\n\t\t\tserializable.value,\n\t\t\tthis.options,\n\t\t);\n\t\treturn new ValueTypeLocalValue(localValue, this.type);\n\t}\n\n\t/**\n\t * Get the message handlers for the map.\n\t * @returns A map of string op names to IMapMessageHandlers for those ops\n\t */\n\tprivate getMessageHandlers() {\n\t\tconst messageHandlers = new Map<string, IMapMessageHandler>();\n\t\t// Ops with type \"act\" describe actions taken by custom value type handlers of whatever item is\n\t\t// being addressed. These custom handlers can be retrieved from the ValueTypeLocalValue which has\n\t\t// stashed its valueType (and therefore its handlers). We also emit a valueChanged for anyone\n\t\t// watching for manipulations of that item.\n\t\tmessageHandlers.set(\"act\", {\n\t\t\tprocess: (op: IMapValueTypeOperation, local, message, localOpMetadata) => {\n\t\t\t\tconst localValue = this.data.get(op.key) ?? this.createCore(op.key, local);\n\t\t\t\tconst handler = localValue.getOpHandler(op.value.opName);\n\t\t\t\tconst previousValue = localValue.value;\n\t\t\t\tconst translatedValue = parseHandles(op.value.value, this.serializer);\n\t\t\t\thandler.process(previousValue, translatedValue, local, message, localOpMetadata);\n\t\t\t\tconst event: IValueChanged = { key: op.key, previousValue };\n\t\t\t\tthis.eventEmitter.emit(\"valueChanged\", event, local, message, this.eventEmitter);\n\t\t\t},\n\t\t\tsubmit: (op: IMapValueTypeOperation, localOpMetadata: IMapMessageLocalMetadata) => {\n\t\t\t\tthis.submitMessage(op, localOpMetadata);\n\t\t\t},\n\t\t\tresubmit: (op: IMapValueTypeOperation, localOpMetadata: IMapMessageLocalMetadata) => {\n\t\t\t\tconst localValue = this.data.get(op.key);\n\n\t\t\t\tassert(localValue !== undefined, 0x3f8 /* Local value expected on resubmission */);\n\n\t\t\t\tconst handler = localValue.getOpHandler(op.value.opName);\n\t\t\t\tconst { rebasedOp, rebasedLocalOpMetadata } = handler.rebase(\n\t\t\t\t\tlocalValue.value,\n\t\t\t\t\top.value,\n\t\t\t\t\tlocalOpMetadata,\n\t\t\t\t);\n\t\t\t\tthis.submitMessage({ ...op, value: rebasedOp }, rebasedLocalOpMetadata);\n\t\t\t},\n\t\t\tgetStashedOpLocalMetadata: (op: IMapValueTypeOperation) => {\n\t\t\t\tassert(\n\t\t\t\t\tfalse,\n\t\t\t\t\t0x016 /* \"apply stashed op not implemented for custom value type ops\" */,\n\t\t\t\t);\n\t\t\t},\n\t\t});\n\n\t\treturn messageHandlers;\n\t}\n\n\t/**\n\t * Create an emitter for a value type to emit ops from the given key.\n\t * @alpha\n\t * @param key - The key of the map that the value type will be stored on\n\t * @returns A value op emitter for the given key\n\t */\n\tprivate makeMapValueOpEmitter(key: string): IValueOpEmitter {\n\t\tconst emit = (\n\t\t\topName: string,\n\t\t\tpreviousValue: any,\n\t\t\tparams: any,\n\t\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t\t) => {\n\t\t\tconst translatedParams = makeHandlesSerializable(params, this.serializer, this.handle);\n\n\t\t\tconst op: IMapValueTypeOperation = {\n\t\t\t\tkey,\n\t\t\t\ttype: \"act\",\n\t\t\t\tvalue: {\n\t\t\t\t\topName,\n\t\t\t\t\tvalue: translatedParams,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tthis.submitMessage(op, localOpMetadata);\n\n\t\t\tconst event: IValueChanged = { key, previousValue };\n\t\t\tthis.eventEmitter.emit(\"valueChanged\", event, true, null, this.eventEmitter);\n\t\t};\n\n\t\treturn { emit };\n\t}\n}\n"]}
|
|
@@ -44,10 +44,29 @@ export interface IMapMessageLocalMetadata {
|
|
|
44
44
|
*/
|
|
45
45
|
export interface SequenceOptions {
|
|
46
46
|
/**
|
|
47
|
-
* Enable
|
|
48
|
-
*
|
|
47
|
+
* Enable the ability to use interval APIs that rely on positions before and
|
|
48
|
+
* after individual characters, referred to as "sides". See {@link SequencePlace}
|
|
49
|
+
* for additional context.
|
|
50
|
+
*
|
|
51
|
+
* This flag must be enabled to pass instances of {@link SequencePlace} to
|
|
52
|
+
* any IIntervalCollection API.
|
|
53
|
+
*
|
|
54
|
+
* Also see the feature flag `mergeTreeReferencesCanSlideToEndpoint` to allow
|
|
55
|
+
* endpoints to slide to the special endpoint segments.
|
|
56
|
+
*
|
|
57
|
+
* The default value is false.
|
|
49
58
|
*/
|
|
50
59
|
intervalStickinessEnabled: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Enable the ability for interval endpoints to slide to the special endpoint
|
|
62
|
+
* segments that exist before and after the bounds of the string. This is
|
|
63
|
+
* primarily useful for workflows involving interval stickiness, and it is
|
|
64
|
+
* suggested to enable both this flag and `intervalStickinessEnabled` at the
|
|
65
|
+
* same time.
|
|
66
|
+
*
|
|
67
|
+
* The default value is false.
|
|
68
|
+
*/
|
|
69
|
+
mergeTreeReferencesCanSlideToEndpoint: boolean;
|
|
51
70
|
[key: string]: boolean;
|
|
52
71
|
}
|
|
53
72
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultMapInterfaces.d.ts","sourceRoot":"","sources":["../src/defaultMapInterfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,aAAa,EAAE,GAAG,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC/B;;;;;;;OAOG;IACH,IAAI,CACH,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,GAAG,EAClB,MAAM,EAAE,GAAG,EACX,eAAe,EAAE,wBAAwB,GACvC,IAAI,CAAC;CACR;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B
|
|
1
|
+
{"version":3,"file":"defaultMapInterfaces.d.ts","sourceRoot":"","sources":["../src/defaultMapInterfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,aAAa,EAAE,GAAG,CAAC;CACnB;AAED;;;GA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AAM,CAAC;IAEb;;;OAGG;IACH,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAE1B;;;OAGG;IACH,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB;IACnE,CACC,KAAK,EAAE,cAAc,GAAG,QAAQ,EAChC,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,qBAAqB,KAAK,IAAI,OACxF;CACF;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB;IAClC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,GAAG,CAAC;CACX;AAED,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,wBAAwB;IACxC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,KAAK,EAAE,GAAG,CAAC;CACX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultMapInterfaces.js","sourceRoot":"","sources":["../src/defaultMapInterfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { ISharedObjectEvents } from \"@fluidframework/shared-object-base\";\nimport { IEventThisPlaceHolder } from \"@fluidframework/core-interfaces\";\n\n/**\n * Type of \"valueChanged\" event parameter.\n */\nexport interface IValueChanged {\n\t/**\n\t * The key storing the value that changed.\n\t */\n\tkey: string;\n\n\t/**\n\t * The value that was stored at the key prior to the change.\n\t */\n\tpreviousValue: any;\n}\n\n/**\n * Value types are given an IValueOpEmitter to emit their ops through the container type that holds them.\n * @internal\n */\nexport interface IValueOpEmitter {\n\t/**\n\t * Called by the value type to emit a value type operation through the container type holding it.\n\t * @param opName - Name of the emitted operation\n\t * @param previousValue - JSONable previous value as defined by the value type\n\t * @param params - JSONable params for the operation as defined by the value type\n\t * @param localOpMetadata - JSONable local metadata which should be submitted with the op\n\t * @internal\n\t */\n\temit(\n\t\topName: string,\n\t\tpreviousValue: any,\n\t\tparams: any,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t): void;\n}\n\n/**\n * @internal\n */\nexport interface IMapMessageLocalMetadata {\n\tlocalSeq: number;\n}\n\n/**\n * Optional flags that configure options for sequence DDSs\n */\nexport interface SequenceOptions {\n\t/**\n\t * Enable {@link
|
|
1
|
+
{"version":3,"file":"defaultMapInterfaces.js","sourceRoot":"","sources":["../src/defaultMapInterfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { ISharedObjectEvents } from \"@fluidframework/shared-object-base\";\nimport { IEventThisPlaceHolder } from \"@fluidframework/core-interfaces\";\n\n/**\n * Type of \"valueChanged\" event parameter.\n */\nexport interface IValueChanged {\n\t/**\n\t * The key storing the value that changed.\n\t */\n\tkey: string;\n\n\t/**\n\t * The value that was stored at the key prior to the change.\n\t */\n\tpreviousValue: any;\n}\n\n/**\n * Value types are given an IValueOpEmitter to emit their ops through the container type that holds them.\n * @internal\n */\nexport interface IValueOpEmitter {\n\t/**\n\t * Called by the value type to emit a value type operation through the container type holding it.\n\t * @param opName - Name of the emitted operation\n\t * @param previousValue - JSONable previous value as defined by the value type\n\t * @param params - JSONable params for the operation as defined by the value type\n\t * @param localOpMetadata - JSONable local metadata which should be submitted with the op\n\t * @internal\n\t */\n\temit(\n\t\topName: string,\n\t\tpreviousValue: any,\n\t\tparams: any,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t): void;\n}\n\n/**\n * @internal\n */\nexport interface IMapMessageLocalMetadata {\n\tlocalSeq: number;\n}\n\n/**\n * Optional flags that configure options for sequence DDSs\n */\nexport interface SequenceOptions {\n\t/**\n\t * Enable the ability to use interval APIs that rely on positions before and\n\t * after individual characters, referred to as \"sides\". See {@link SequencePlace}\n\t * for additional context.\n\t *\n\t * This flag must be enabled to pass instances of {@link SequencePlace} to\n\t * any IIntervalCollection API.\n\t *\n\t * Also see the feature flag `mergeTreeReferencesCanSlideToEndpoint` to allow\n\t * endpoints to slide to the special endpoint segments.\n\t *\n\t * The default value is false.\n\t */\n\tintervalStickinessEnabled: boolean;\n\t/**\n\t * Enable the ability for interval endpoints to slide to the special endpoint\n\t * segments that exist before and after the bounds of the string. This is\n\t * primarily useful for workflows involving interval stickiness, and it is\n\t * suggested to enable both this flag and `intervalStickinessEnabled` at the\n\t * same time.\n\t *\n\t * The default value is false.\n\t */\n\tmergeTreeReferencesCanSlideToEndpoint: boolean;\n\t[key: string]: boolean;\n}\n\n/**\n * A value factory is used to serialize/deserialize value types to a map\n * @alpha\n */\nexport interface IValueFactory<T> {\n\t/**\n\t * Create a new value type. Used both in creation of new value types, as well as in loading existing ones\n\t * from remote.\n\t * @param emitter - Emitter object that the created value type will use to emit operations\n\t * @param raw - Initialization parameters as defined by the value type\n\t * @returns The new value type\n\t * @alpha\n\t */\n\tload(emitter: IValueOpEmitter, raw: any, options?: Partial<SequenceOptions>): T;\n\n\t/**\n\t * Given a value type, provides a JSONable form of its data to be used for snapshotting. This data must be\n\t * loadable using the load method of its factory.\n\t * @param value - The value type to serialize\n\t * @returns The JSONable form of the value type\n\t * @alpha\n\t */\n\tstore(value: T): any;\n}\n\n/**\n * Defines an operation that a value type is able to handle.\n * @alpha\n */\nexport interface IValueOperation<T> {\n\t/**\n\t * Performs the actual processing on the incoming operation.\n\t * @param value - The current value stored at the given key, which should be the value type\n\t * @param params - The params on the incoming operation\n\t * @param local - Whether the operation originated from this client\n\t * @param message - The operation itself\n\t * @param localOpMetadata - any local metadata submitted by `IValueOpEmitter.emit`.\n\t * @alpha\n\t */\n\tprocess(\n\t\tvalue: T,\n\t\tparams: any,\n\t\tlocal: boolean,\n\t\tmessage: ISequencedDocumentMessage | undefined,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata | undefined,\n\t);\n\n\t/**\n\t * Rebases an `op` on `value` from its original perspective (ref/local seq) to the current\n\t * perspective. Should be invoked on reconnection.\n\t * @param value - The current value stored at the given key, which should be the value type.\n\t * @param op - The op to be rebased.\n\t * @param localOpMetadata - Any local metadata that was originally submitted with the op.\n\t * @returns A rebased version of the op and any local metadata that should be submitted with it.\n\t */\n\trebase(\n\t\tvalue: T,\n\t\top: IValueTypeOperationValue,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t): { rebasedOp: IValueTypeOperationValue; rebasedLocalOpMetadata: IMapMessageLocalMetadata };\n}\n\n/**\n * Defines a value type that can be registered on a container type.\n */\nexport interface IValueType<T> {\n\t/**\n\t * Name of the value type.\n\t * @alpha\n\t */\n\tname: string;\n\n\t/**\n\t * Factory method used to convert to/from a JSON form of the type.\n\t * @alpha\n\t */\n\tfactory: IValueFactory<T>;\n\n\t/**\n\t * Operations that can be applied to the value type.\n\t * @alpha\n\t */\n\tops: Map<string, IValueOperation<T>>;\n}\n\nexport interface ISharedDefaultMapEvents extends ISharedObjectEvents {\n\t(\n\t\tevent: \"valueChanged\" | \"create\",\n\t\tlistener: (changed: IValueChanged, local: boolean, target: IEventThisPlaceHolder) => void,\n\t);\n}\n\n/**\n * The _ready-for-serialization_ format of values contained in DDS contents. This allows us to use\n * ISerializableValue.type to understand whether they're storing a Plain JS object, a SharedObject, or a value type.\n * Note that the in-memory equivalent of ISerializableValue is ILocalValue (similarly holding a type, but with\n * the _in-memory representation_ of the value instead). An ISerializableValue is what gets passed to\n * JSON.stringify and comes out of JSON.parse. This format is used both for snapshots (loadCore/populate)\n * and ops (set).\n *\n * The DefaultMap impelmentation for sequence has been specialized to only support a single ValueType, which serializes\n * and deserializes via .store() and .load().\n */\nexport interface ISerializableValue {\n\t/**\n\t * A type annotation to help indicate how the value serializes.\n\t */\n\ttype: string;\n\n\t/**\n\t * The JSONable representation of the value.\n\t */\n\tvalue: any;\n}\n\nexport interface ISerializedValue {\n\t/**\n\t * A type annotation to help indicate how the value serializes.\n\t */\n\ttype: string;\n\n\t/**\n\t * String representation of the value.\n\t */\n\tvalue: string | undefined;\n}\n\n/**\n * ValueTypes handle ops slightly differently from SharedObjects or plain JS objects. Since the Map/Directory doesn't\n * know how to handle the ValueType's ops, those ops are instead passed along to the ValueType for processing.\n * IValueTypeOperationValue is that passed-along op. The opName on it is the ValueType-specific operation and the\n * value is whatever params the ValueType needs to complete that operation. Similar to ISerializableValue, it is\n * serializable via JSON.stringify/parse but differs in that it has no equivalency with an in-memory value - rather\n * it just describes an operation to be applied to an already-in-memory value.\n * @alpha\n */\nexport interface IValueTypeOperationValue {\n\t/**\n\t * The name of the operation.\n\t */\n\topName: string;\n\n\t/**\n\t * The payload that is submitted along with the operation.\n\t */\n\tvalue: any;\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
export { IMapMessageLocalMetadata, IValueOpEmitter, SequenceOptions } from "./defaultMapInterfaces";
|
|
18
18
|
export { IInterval, Interval, IntervalOpType, IntervalType, ISerializableInterval, ISerializedInterval, SequenceInterval, SerializedIntervalDelta, IntervalStickiness, IIntervalHelpers, sequenceIntervalHelpers, } from "./intervals";
|
|
19
|
-
export { DeserializeCallback, IIntervalCollectionEvent, IIntervalCollection, IntervalLocator, intervalLocatorFromEndpoint, } from "./intervalCollection";
|
|
19
|
+
export { DeserializeCallback, IIntervalCollectionEvent, IIntervalCollection, IntervalLocator, intervalLocatorFromEndpoint, Side, InteriorSequencePlace, SequencePlace, } from "./intervalCollection";
|
|
20
20
|
export { IntervalIndex, SequenceIntervalIndexes, IOverlappingIntervalsIndex, createOverlappingIntervalsIndex, createOverlappingSequenceIntervalsIndex, IEndpointInRangeIndex, IStartpointInRangeIndex, createEndpointInRangeIndex, createStartpointInRangeIndex, IIdIntervalIndex, createIdIntervalIndex, IEndpointIndex, createEndpointIndex, } from "./intervalIndex";
|
|
21
21
|
export { appendAddIntervalToRevertibles, appendChangeIntervalToRevertibles, appendDeleteIntervalToRevertibles, appendIntervalPropertyChangedToRevertibles, appendSharedStringDeltaToRevertibles, discardSharedStringRevertibles, IntervalRevertible, revertSharedStringRevertibles, SharedStringRevertible, } from "./revertibles";
|
|
22
22
|
export { ISharedSegmentSequenceEvents, SharedSegmentSequence } from "./sequence";
|
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;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACpG,OAAO,EACN,SAAS,EACT,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,EACf,2BAA2B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACpG,OAAO,EACN,SAAS,EACT,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,EACf,2BAA2B,EAC3B,IAAI,EACJ,qBAAqB,EACrB,aAAa,GACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,aAAa,EACb,uBAAuB,EACvB,0BAA0B,EAC1B,+BAA+B,EAC/B,uCAAuC,EACvC,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,4BAA4B,EAC5B,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,EACd,mBAAmB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,8BAA8B,EAC9B,iCAAiC,EACjC,iCAAiC,EACjC,0CAA0C,EAC1C,oCAAoC,EACpC,8BAA8B,EAC9B,kBAAkB,EAClB,6BAA6B,EAC7B,sBAAsB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACjF,OAAO,EACN,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,wBAAwB,GACxB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EACN,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,mBAAmB,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,yBAAyB,EACzB,wBAAwB,EACxB,+BAA+B,GAC/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.SubSequence = exports.SharedSequence = exports.SharedIntervalCollectionFactory = exports.SharedIntervalCollection = exports.SharedString = exports.getTextAndMarkers = exports.SharedStringFactory = exports.SequenceMaintenanceEvent = exports.SequenceEvent = exports.SequenceDeltaEvent = exports.SharedSegmentSequence = exports.revertSharedStringRevertibles = exports.discardSharedStringRevertibles = exports.appendSharedStringDeltaToRevertibles = exports.appendIntervalPropertyChangedToRevertibles = exports.appendDeleteIntervalToRevertibles = exports.appendChangeIntervalToRevertibles = exports.appendAddIntervalToRevertibles = exports.createEndpointIndex = exports.createIdIntervalIndex = exports.createStartpointInRangeIndex = exports.createEndpointInRangeIndex = exports.createOverlappingSequenceIntervalsIndex = exports.createOverlappingIntervalsIndex = exports.intervalLocatorFromEndpoint = exports.sequenceIntervalHelpers = exports.IntervalStickiness = exports.SequenceInterval = exports.IntervalType = exports.IntervalOpType = exports.Interval = void 0;
|
|
7
|
+
exports.SubSequence = exports.SharedSequence = exports.SharedIntervalCollectionFactory = exports.SharedIntervalCollection = exports.SharedString = exports.getTextAndMarkers = exports.SharedStringFactory = exports.SequenceMaintenanceEvent = exports.SequenceEvent = exports.SequenceDeltaEvent = exports.SharedSegmentSequence = exports.revertSharedStringRevertibles = exports.discardSharedStringRevertibles = exports.appendSharedStringDeltaToRevertibles = exports.appendIntervalPropertyChangedToRevertibles = exports.appendDeleteIntervalToRevertibles = exports.appendChangeIntervalToRevertibles = exports.appendAddIntervalToRevertibles = exports.createEndpointIndex = exports.createIdIntervalIndex = exports.createStartpointInRangeIndex = exports.createEndpointInRangeIndex = exports.createOverlappingSequenceIntervalsIndex = exports.createOverlappingIntervalsIndex = exports.Side = exports.intervalLocatorFromEndpoint = exports.sequenceIntervalHelpers = exports.IntervalStickiness = exports.SequenceInterval = exports.IntervalType = exports.IntervalOpType = exports.Interval = void 0;
|
|
8
8
|
var intervals_1 = require("./intervals");
|
|
9
9
|
Object.defineProperty(exports, "Interval", { enumerable: true, get: function () { return intervals_1.Interval; } });
|
|
10
10
|
Object.defineProperty(exports, "IntervalOpType", { enumerable: true, get: function () { return intervals_1.IntervalOpType; } });
|
|
@@ -14,6 +14,7 @@ Object.defineProperty(exports, "IntervalStickiness", { enumerable: true, get: fu
|
|
|
14
14
|
Object.defineProperty(exports, "sequenceIntervalHelpers", { enumerable: true, get: function () { return intervals_1.sequenceIntervalHelpers; } });
|
|
15
15
|
var intervalCollection_1 = require("./intervalCollection");
|
|
16
16
|
Object.defineProperty(exports, "intervalLocatorFromEndpoint", { enumerable: true, get: function () { return intervalCollection_1.intervalLocatorFromEndpoint; } });
|
|
17
|
+
Object.defineProperty(exports, "Side", { enumerable: true, get: function () { return intervalCollection_1.Side; } });
|
|
17
18
|
var intervalIndex_1 = require("./intervalIndex");
|
|
18
19
|
Object.defineProperty(exports, "createOverlappingIntervalsIndex", { enumerable: true, get: function () { return intervalIndex_1.createOverlappingIntervalsIndex; } });
|
|
19
20
|
Object.defineProperty(exports, "createOverlappingSequenceIntervalsIndex", { enumerable: true, get: function () { return intervalIndex_1.createOverlappingSequenceIntervalsIndex; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAeH,yCAYqB;AAVpB,qGAAA,QAAQ,OAAA;AACR,2GAAA,cAAc,OAAA;AACd,yGAAA,YAAY,OAAA;AAGZ,6GAAA,gBAAgB,OAAA;AAEhB,+GAAA,kBAAkB,OAAA;AAElB,oHAAA,uBAAuB,OAAA;AAExB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAeH,yCAYqB;AAVpB,qGAAA,QAAQ,OAAA;AACR,2GAAA,cAAc,OAAA;AACd,yGAAA,YAAY,OAAA;AAGZ,6GAAA,gBAAgB,OAAA;AAEhB,+GAAA,kBAAkB,OAAA;AAElB,oHAAA,uBAAuB,OAAA;AAExB,2DAS8B;AAJ7B,iIAAA,2BAA2B,OAAA;AAC3B,0GAAA,IAAI,OAAA;AAIL,iDAcyB;AAVxB,gIAAA,+BAA+B,OAAA;AAC/B,wIAAA,uCAAuC,OAAA;AAGvC,2HAAA,0BAA0B,OAAA;AAC1B,6HAAA,4BAA4B,OAAA;AAE5B,sHAAA,qBAAqB,OAAA;AAErB,oHAAA,mBAAmB,OAAA;AAEpB,6CAUuB;AATtB,6HAAA,8BAA8B,OAAA;AAC9B,gIAAA,iCAAiC,OAAA;AACjC,gIAAA,iCAAiC,OAAA;AACjC,yIAAA,0CAA0C,OAAA;AAC1C,mIAAA,oCAAoC,OAAA;AACpC,6HAAA,8BAA8B,OAAA;AAE9B,4HAAA,6BAA6B,OAAA;AAG9B,uCAAiF;AAA1C,iHAAA,qBAAqB,OAAA;AAC5D,2DAK8B;AAH7B,wHAAA,kBAAkB,OAAA;AAClB,mHAAA,aAAa,OAAA;AACb,8HAAA,wBAAwB,OAAA;AAEzB,qDAAwD;AAA/C,sHAAA,mBAAmB,OAAA;AAC5B,+CAKwB;AAJvB,iHAAA,iBAAiB,OAAA;AAEjB,4GAAA,YAAY,OAAA;AAGb,uEAIoC;AAFnC,oIAAA,wBAAwB,OAAA;AACxB,2IAAA,+BAA+B,OAAA;AAEhC,mDAAgF;AAAtD,gHAAA,cAAc,OAAA;AAAE,6GAAA,WAAW,OAAA","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 library's main export is {@link SharedString}, a DDS for storing and simultaneously editing a sequence of\n * text.\n *\n * See the package's README for a high-level introduction to `SharedString`'s feature set.\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 */\nexport { IMapMessageLocalMetadata, IValueOpEmitter, SequenceOptions } from \"./defaultMapInterfaces\";\nexport {\n\tIInterval,\n\tInterval,\n\tIntervalOpType,\n\tIntervalType,\n\tISerializableInterval,\n\tISerializedInterval,\n\tSequenceInterval,\n\tSerializedIntervalDelta,\n\tIntervalStickiness,\n\tIIntervalHelpers,\n\tsequenceIntervalHelpers,\n} from \"./intervals\";\nexport {\n\tDeserializeCallback,\n\tIIntervalCollectionEvent,\n\tIIntervalCollection,\n\tIntervalLocator,\n\tintervalLocatorFromEndpoint,\n\tSide,\n\tInteriorSequencePlace,\n\tSequencePlace,\n} from \"./intervalCollection\";\nexport {\n\tIntervalIndex,\n\tSequenceIntervalIndexes,\n\tIOverlappingIntervalsIndex,\n\tcreateOverlappingIntervalsIndex,\n\tcreateOverlappingSequenceIntervalsIndex,\n\tIEndpointInRangeIndex,\n\tIStartpointInRangeIndex,\n\tcreateEndpointInRangeIndex,\n\tcreateStartpointInRangeIndex,\n\tIIdIntervalIndex,\n\tcreateIdIntervalIndex,\n\tIEndpointIndex,\n\tcreateEndpointIndex,\n} from \"./intervalIndex\";\nexport {\n\tappendAddIntervalToRevertibles,\n\tappendChangeIntervalToRevertibles,\n\tappendDeleteIntervalToRevertibles,\n\tappendIntervalPropertyChangedToRevertibles,\n\tappendSharedStringDeltaToRevertibles,\n\tdiscardSharedStringRevertibles,\n\tIntervalRevertible,\n\trevertSharedStringRevertibles,\n\tSharedStringRevertible,\n} from \"./revertibles\";\nexport { ISharedSegmentSequenceEvents, SharedSegmentSequence } from \"./sequence\";\nexport {\n\tISequenceDeltaRange,\n\tSequenceDeltaEvent,\n\tSequenceEvent,\n\tSequenceMaintenanceEvent,\n} from \"./sequenceDeltaEvent\";\nexport { SharedStringFactory } from \"./sequenceFactory\";\nexport {\n\tgetTextAndMarkers,\n\tISharedString,\n\tSharedString,\n\tSharedStringSegment,\n} from \"./sharedString\";\nexport {\n\tISharedIntervalCollection,\n\tSharedIntervalCollection,\n\tSharedIntervalCollectionFactory,\n} from \"./sharedIntervalCollection\";\nexport { IJSONRunSegment, SharedSequence, SubSequence } from \"./sharedSequence\";\n"]}
|