@cr_docs_t/dts 0.22.0 → 0.23.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.
@@ -1,6 +1,8 @@
1
+ import { Operation } from "../../types";
1
2
  export declare class FNode<P> {
2
3
  value?: string;
4
+ operation?: Operation;
3
5
  position: P;
4
- constructor(position: P, value?: string);
6
+ constructor(position: P, value?: string, operation?: Operation);
5
7
  }
6
8
  //# sourceMappingURL=FNode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FNode.d.ts","sourceRoot":"","sources":["../../../src/dts/Fugue/FNode.ts"],"names":[],"mappings":"AAAA,qBAAa,KAAK,CAAC,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CAAC,CAAC;gBAEA,QAAQ,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM;CAI1C"}
1
+ {"version":3,"file":"FNode.d.ts","sourceRoot":"","sources":["../../../src/dts/Fugue/FNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,qBAAa,KAAK,CAAC,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,EAAE,CAAC,CAAC;gBAEA,QAAQ,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,SAAS;CAIjE"}
@@ -1,5 +1,5 @@
1
1
  export class FNode {
2
- constructor(position, value) {
2
+ constructor(position, value, operation) {
3
3
  this.value = value;
4
4
  this.position = position;
5
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FugueList.d.ts","sourceRoot":"","sources":["../../../src/dts/Fugue/FugueList.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAa,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,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gBAAgB,CAAC,QAAQ,EAAE,CAAC,GAAG,MAAM,GAAG,SAAS;IAejD;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM;IAsBpB;;;;;OAKG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAsD3C;;;OAGG;IACH,OAAO,IAAI,MAAM;IAmBjB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAcpB;;;OAGG;IACH,OAAO,CAAC,WAAW;IAsGnB;;;OAGG;IACH,MAAM,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,EAAE;IAW/C,SAAS,IAAI,MAAM;IAInB;;OAEG;IACH,cAAc;CAOjB"}
@@ -59,13 +59,13 @@ export class FugueList {
59
59
  // Don't insert if it already exists,
60
60
  // TODO: ideally this should trigger a collision resolution
61
61
  if (!existing) {
62
- cell.push(new FNode(position, value));
62
+ cell.push(new FNode(position, value, Operation.INSERT));
63
63
  cell.sort((a, b) => this.totalOrder.compare(a.position, b.position));
64
64
  }
65
65
  }
66
66
  // Insert new cell at index
67
67
  else {
68
- this.state.splice(index, 0, [new FNode(position, value)]);
68
+ this.state.splice(index, 0, [new FNode(position, value, Operation.INSERT)]);
69
69
  }
70
70
  }
71
71
  /**
@@ -121,7 +121,7 @@ export class FugueList {
121
121
  for (const c of value) {
122
122
  const pos = this.totalOrder.createBetween(cL, rA);
123
123
  // Collect new cells
124
- newCells.push([new FNode(pos, c)]);
124
+ newCells.push([new FNode(pos, c, Operation.INSERT)]);
125
125
  // Batch propagate
126
126
  msgs.push({
127
127
  documentID: this.documentID,
@@ -158,6 +158,7 @@ export class FugueList {
158
158
  if (node) {
159
159
  // Tombstone the node, TODO: Implement garbage collection
160
160
  node.value = undefined;
161
+ node.operation = Operation.DELETE;
161
162
  return;
162
163
  }
163
164
  }
@@ -244,6 +245,7 @@ export class FugueList {
244
245
  const pos = n.position;
245
246
  // Tombstone the node
246
247
  n.value = undefined;
248
+ n.operation = Operation.DELETE;
247
249
  deletedCount++;
248
250
  // Batch
249
251
  msgs.push({
@@ -345,6 +347,7 @@ export class FugueList {
345
347
  const node = cell.find((n) => this.totalOrder.compare(n.position, pos) === 0);
346
348
  if (node && node.value !== undefined) {
347
349
  node.value = undefined; // Tombstone
350
+ node.operation = Operation.DELETE;
348
351
  }
349
352
  }
350
353
  }
@@ -366,7 +369,7 @@ export class FugueList {
366
369
  const existing = cell.find((n) => this.totalOrder.compare(n.position, position) === 0);
367
370
  // Don't insert if it already exists
368
371
  if (!existing) {
369
- cell.push(new FNode(position, data ? data : undefined));
372
+ cell.push(new FNode(position, data ? data : undefined, data ? Operation.INSERT : Operation.DELETE));
370
373
  cell.sort((a, b) => this.totalOrder.compare(a.position, b.position));
371
374
  }
372
375
  }
@@ -376,11 +379,11 @@ export class FugueList {
376
379
  // - This index is not contiguous with the previous group
377
380
  if (startIdx === -1) {
378
381
  startIdx = idx;
379
- batchCells = [[new FNode(position, data ? data : undefined)]];
382
+ batchCells = [[new FNode(position, data ? data : undefined, data ? Operation.INSERT : Operation.DELETE)]];
380
383
  }
381
384
  // If the index is the same as startIdx, continue the batch
382
385
  else if (idx === startIdx) {
383
- batchCells.push([new FNode(position, data ? data : undefined)]);
386
+ batchCells.push([new FNode(position, data ? data : undefined, data ? Operation.INSERT : Operation.DELETE)]);
384
387
  }
385
388
  // The index is different, i.e. not contiguous, so flush the current batch,
386
389
  // commit it and start a new one
@@ -393,7 +396,7 @@ export class FugueList {
393
396
  // we must add the length of the batch we just inserted.
394
397
  const shift = idx >= startIdx ? batchCells.length : 0;
395
398
  startIdx = idx + shift;
396
- batchCells = [[new FNode(position, data ? data : undefined)]];
399
+ batchCells = [[new FNode(position, data ? data : undefined, data ? Operation.INSERT : Operation.DELETE)]];
397
400
  }
398
401
  }
399
402
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cr_docs_t/dts",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",