@fluidframework/sequence 1.2.6 → 1.3.0-97515

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.
@@ -128,26 +128,8 @@ export interface ISerializableInterval extends IInterval {
128
128
 
129
129
  export interface IIntervalHelpers<TInterval extends ISerializableInterval> {
130
130
  compareEnds(a: TInterval, b: TInterval): number;
131
- /**
132
- *
133
- * @param label - label of the interval collection this interval is being added to. This parameter is
134
- * irrelevant for transient intervals.
135
- * @param start - numerical start position of the interval
136
- * @param end - numberical end position of the interval
137
- * @param client - client creating the interval
138
- * @param intervalType - Type of interval to create. Default is SlideOnRemove
139
- * @param op - If this create came from a remote client, op that created it. Default is undefined (i.e. local)
140
- * @param fromSnapshot - If this create came from loading a snapshot. Default is false.
141
- */
142
- create(
143
- label: string,
144
- start: number,
145
- end: number,
146
- client: Client,
147
- intervalType?: IntervalType,
148
- op?: ISequencedDocumentMessage,
149
- fromSnapshot?: boolean,
150
- ): TInterval;
131
+ create(label: string, start: number, end: number,
132
+ client: Client, intervalType?: IntervalType, op?: ISequencedDocumentMessage): TInterval;
151
133
  }
152
134
 
153
135
  export class Interval implements ISerializableInterval {
@@ -489,16 +471,14 @@ function createPositionReference(
489
471
  client: Client,
490
472
  pos: number,
491
473
  refType: ReferenceType,
492
- op?: ISequencedDocumentMessage,
493
- fromSnapshot?: boolean): LocalReference {
474
+ op?: ISequencedDocumentMessage): LocalReference {
494
475
  let segoff;
495
476
  if (op) {
496
477
  assert((refType & ReferenceType.SlideOnRemove) !== 0, 0x2f5 /* op create references must be SlideOnRemove */);
497
478
  segoff = client.getContainingSegment(pos, op);
498
479
  segoff = client.getSlideToSegment(segoff);
499
480
  } else {
500
- assert((refType & ReferenceType.SlideOnRemove) === 0 || fromSnapshot,
501
- 0x2f6 /* SlideOnRemove references must be op created */);
481
+ assert((refType & ReferenceType.SlideOnRemove) === 0, 0x2f6 /* SlideOnRemove references must be op created */);
502
482
  segoff = client.getContainingSegment(pos);
503
483
  }
504
484
  return createPositionReferenceFromSegoff(client, segoff, refType, op);
@@ -510,8 +490,7 @@ function createSequenceInterval(
510
490
  end: number,
511
491
  client: Client,
512
492
  intervalType?: IntervalType,
513
- op?: ISequencedDocumentMessage,
514
- fromSnapshot?: boolean): SequenceInterval {
493
+ op?: ISequencedDocumentMessage): SequenceInterval {
515
494
  let beginRefType = ReferenceType.RangeBegin;
516
495
  let endRefType = ReferenceType.RangeEnd;
517
496
  if (intervalType === IntervalType.Transient) {
@@ -525,7 +504,7 @@ function createSequenceInterval(
525
504
  // All non-transient interval references must eventually be SlideOnRemove
526
505
  // To ensure eventual consistency, they must start as StayOnRemove when
527
506
  // pending (created locally and creation op is not acked)
528
- if (op || fromSnapshot) {
507
+ if (op) {
529
508
  beginRefType |= ReferenceType.SlideOnRemove;
530
509
  endRefType |= ReferenceType.SlideOnRemove;
531
510
  } else {
@@ -534,8 +513,8 @@ function createSequenceInterval(
534
513
  }
535
514
  }
536
515
 
537
- const startLref = createPositionReference(client, start, beginRefType, op, fromSnapshot);
538
- const endLref = createPositionReference(client, end, endRefType, op, fromSnapshot);
516
+ const startLref = createPositionReference(client, start, beginRefType, op);
517
+ const endLref = createPositionReference(client, end, endRefType, op);
539
518
  startLref.pairedRef = endLref;
540
519
  endLref.pairedRef = startLref;
541
520
  const rangeProp = {
@@ -1107,18 +1086,11 @@ export class IntervalCollection<TInterval extends ISerializableInterval>
1107
1086
  if (this.savedSerializedIntervals) {
1108
1087
  for (const serializedInterval of this.savedSerializedIntervals) {
1109
1088
  this.localCollection.ensureSerializedId(serializedInterval);
1110
- const { start, end, intervalType, properties } = serializedInterval;
1111
- const interval = this.helpers.create(
1112
- label,
1113
- start,
1114
- end,
1115
- client,
1116
- intervalType,
1117
- undefined,
1118
- true,
1119
- );
1120
- interval.addProperties(properties);
1121
- this.localCollection.add(interval);
1089
+ this.localCollection.addInterval(
1090
+ serializedInterval.start,
1091
+ serializedInterval.end,
1092
+ serializedInterval.intervalType,
1093
+ serializedInterval.properties);
1122
1094
  }
1123
1095
  }
1124
1096
  this.savedSerializedIntervals = undefined;
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/sequence";
9
- export const pkgVersion = "1.2.6";
9
+ export const pkgVersion = "1.3.0-97515";