@cr_docs_t/dts 0.22.0 → 0.24.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/dist/dts/Fugue/FNode.d.ts +3 -1
- package/dist/dts/Fugue/FNode.d.ts.map +1 -1
- package/dist/dts/Fugue/FNode.js +1 -1
- package/dist/dts/Fugue/FugueList.d.ts.map +1 -1
- package/dist/dts/Fugue/FugueList.js +10 -7
- package/dist/dts/Serailizers/Fugue/Message.d.ts.map +1 -1
- package/dist/dts/Serailizers/Fugue/Message.js +3 -2
- package/dist/types/Fugue/Message.d.ts +1 -0
- package/dist/types/Fugue/Message.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -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;
|
|
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"}
|
package/dist/dts/Fugue/FNode.js
CHANGED
|
@@ -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,0CAA0C,CAAC;AAGnF;;GAEG;AACH,qBAAa,SAAS,CAAC,CAAC;IACpB,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,CAAM;IAC1B,UAAU,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC;IACvC,eAAe,SAAK;IACpB,EAAE,EAAE,SAAS,GAAG,IAAI,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,QAAQ,CAAC,SAAS,OAAO;gBAEb,UAAU,EAAE,uBAAuB,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,SAAS,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM;IAOnH;;;OAGG;IACH,OAAO,CAAC,SAAS;IAQjB,OAAO,CAAC,oBAAoB;IAmB5B;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAqBxB;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IASxB;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAgBnC;;;;;OAKG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAiD3C;;;OAGG;IACH,OAAO,CAAC,gBAAgB;
|
|
1
|
+
{"version":3,"file":"FugueList.d.ts","sourceRoot":"","sources":["../../../src/dts/Fugue/FugueList.ts"],"names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AI,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
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../../src/dts/Serailizers/Fugue/Message.ts"],"names":[],"mappings":"AACA,OAAO,EAGH,gBAAgB,EAInB,MAAM,yBAAyB,CAAC;AAEjC,iBAAS,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,2BAEhD;AAED,iBAAS,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,GAAG,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAM/D;
|
|
1
|
+
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../../src/dts/Serailizers/Fugue/Message.ts"],"names":[],"mappings":"AACA,OAAO,EAGH,gBAAgB,EAInB,MAAM,yBAAyB,CAAC;AAEjC,iBAAS,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,2BAEhD;AAED,iBAAS,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,GAAG,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAM/D;AAqDD,eAAO,MAAM,sBAAsB;;;CAGlC,CAAC"}
|
|
@@ -14,7 +14,7 @@ function toTuple(msg) {
|
|
|
14
14
|
// Check if msg is of FugueJoinMessage type
|
|
15
15
|
switch (msg.operation) {
|
|
16
16
|
case Operation.JOIN:
|
|
17
|
-
return [msg.operation, msg.documentID, msg.state, msg.userIdentity, msg.collaborators, msg.offlineChanges];
|
|
17
|
+
return [msg.operation, msg.documentID, msg.state, msg.userIdentity, msg.collaborators, msg.offlineChanges, msg.replicaId];
|
|
18
18
|
case Operation.INSERT:
|
|
19
19
|
case Operation.DELETE:
|
|
20
20
|
return [msg.operation, msg.documentID, msg.replicaId, msg.position, msg.data, msg.userIdentity];
|
|
@@ -34,7 +34,8 @@ function fromTuple(tuple) {
|
|
|
34
34
|
state: tuple[2],
|
|
35
35
|
userIdentity: tuple[3],
|
|
36
36
|
collaborators: tuple[4],
|
|
37
|
-
offlineChanges: tuple[5]
|
|
37
|
+
offlineChanges: tuple[5],
|
|
38
|
+
replicaId: tuple[6]
|
|
38
39
|
};
|
|
39
40
|
case Operation.INSERT:
|
|
40
41
|
case Operation.DELETE:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../src/types/Fugue/Message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,oBAAY,SAAS;IACjB,MAAM,IAAA;IACN,MAAM,IAAA;IACN,IAAI,IAAA;IACJ,MAAM,IAAA;IACN,KAAK,IAAA;CACR;AAED,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC;AAE1B,MAAM,WAAW,YAAY,CAAC,CAAC;IAC3B,SAAS,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;IAC/C,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,CAAC,CAAC;IACZ,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB,CAAC,CAAC;IAC/B,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,EAAE,CAA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