@cr_docs_t/dts 0.20.0 → 0.21.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/FugueList.d.ts +2 -2
- package/dist/dts/Fugue/FugueList.d.ts.map +1 -1
- package/dist/dts/Fugue/FugueList.js +6 -6
- package/dist/dts/Serailizers/Fugue/Message.js +6 -6
- package/dist/types/Fugue/Message.d.ts +4 -3
- package/dist/types/Fugue/Message.d.ts.map +1 -1
- package/package.json +1 -2
|
@@ -9,9 +9,9 @@ export declare class FugueList<P> {
|
|
|
9
9
|
positionCounter: number;
|
|
10
10
|
ws: WebSocket | null;
|
|
11
11
|
documentID: string;
|
|
12
|
-
|
|
12
|
+
userIdentity: string | undefined;
|
|
13
13
|
readonly batchSize = 100;
|
|
14
|
-
constructor(totalOrder: UniquelyDenseTotalOrder<P>, ws: WebSocket | null, documentID: string,
|
|
14
|
+
constructor(totalOrder: UniquelyDenseTotalOrder<P>, ws: WebSocket | null, documentID: string, userIdentity?: string);
|
|
15
15
|
/**
|
|
16
16
|
* Propagates message or messages to replicas
|
|
17
17
|
* @param msg - Message or messages to propagate to replicas
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"Fug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,EAAE,KAAK,EAAE,MAAM;IAqD3C;;;OAGG;IACH,OAAO,IAAI,MAAM;IAmBjB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAcpB;;;OAGG;IACH,OAAO,CAAC,WAAW;IAqGnB;;;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"}
|
|
@@ -5,14 +5,14 @@ import { FugueMessageSerialzier } from "../Serailizers/index.js";
|
|
|
5
5
|
* A Fugue List CRDT, with insert and delete operations
|
|
6
6
|
*/
|
|
7
7
|
export class FugueList {
|
|
8
|
-
constructor(totalOrder, ws, documentID,
|
|
8
|
+
constructor(totalOrder, ws, documentID, userIdentity) {
|
|
9
9
|
this.state = [];
|
|
10
10
|
this.positionCounter = 0;
|
|
11
11
|
this.batchSize = 100;
|
|
12
12
|
this.totalOrder = totalOrder;
|
|
13
13
|
this.ws = ws;
|
|
14
14
|
this.documentID = documentID;
|
|
15
|
-
this.
|
|
15
|
+
this.userIdentity = userIdentity;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Propagates message or messages to replicas
|
|
@@ -95,7 +95,7 @@ export class FugueList {
|
|
|
95
95
|
replicaId: this.totalOrder.getReplicaId(),
|
|
96
96
|
operation: Operation.INSERT,
|
|
97
97
|
position: pos,
|
|
98
|
-
|
|
98
|
+
userIdentity: this.userIdentity,
|
|
99
99
|
data: value,
|
|
100
100
|
});
|
|
101
101
|
}
|
|
@@ -128,7 +128,7 @@ export class FugueList {
|
|
|
128
128
|
replicaId: this.totalOrder.getReplicaId(),
|
|
129
129
|
operation: Operation.INSERT,
|
|
130
130
|
position: pos,
|
|
131
|
-
|
|
131
|
+
userIdentity: this.userIdentity,
|
|
132
132
|
data: c,
|
|
133
133
|
});
|
|
134
134
|
cL = pos;
|
|
@@ -216,7 +216,7 @@ export class FugueList {
|
|
|
216
216
|
replicaId: this.totalOrder.getReplicaId(),
|
|
217
217
|
operation: Operation.DELETE,
|
|
218
218
|
position: position,
|
|
219
|
-
|
|
219
|
+
userIdentity: this.userIdentity,
|
|
220
220
|
data: null,
|
|
221
221
|
});
|
|
222
222
|
}
|
|
@@ -251,7 +251,7 @@ export class FugueList {
|
|
|
251
251
|
replicaId: this.totalOrder.getReplicaId(),
|
|
252
252
|
operation: Operation.DELETE,
|
|
253
253
|
position: pos,
|
|
254
|
-
|
|
254
|
+
userIdentity: this.userIdentity,
|
|
255
255
|
data: null,
|
|
256
256
|
});
|
|
257
257
|
if (msgs.length >= this.batchSize) {
|
|
@@ -14,14 +14,14 @@ 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.
|
|
17
|
+
return [msg.operation, msg.documentID, msg.state, msg.userIdentity, msg.collaborators];
|
|
18
18
|
case Operation.INSERT:
|
|
19
19
|
case Operation.DELETE:
|
|
20
|
-
return [msg.operation, msg.documentID, msg.replicaId, msg.position, msg.data, msg.
|
|
20
|
+
return [msg.operation, msg.documentID, msg.replicaId, msg.position, msg.data, msg.userIdentity];
|
|
21
21
|
case Operation.REJECT:
|
|
22
22
|
return [msg.operation];
|
|
23
23
|
case Operation.LEAVE:
|
|
24
|
-
return [msg.operation, msg.
|
|
24
|
+
return [msg.operation, msg.userIdentity];
|
|
25
25
|
}
|
|
26
26
|
throw new Error("Unknown message type");
|
|
27
27
|
}
|
|
@@ -32,7 +32,7 @@ function fromTuple(tuple) {
|
|
|
32
32
|
operation: tuple[0],
|
|
33
33
|
documentID: tuple[1],
|
|
34
34
|
state: tuple[2],
|
|
35
|
-
|
|
35
|
+
userIdentity: tuple[3],
|
|
36
36
|
collaborators: tuple[4]
|
|
37
37
|
};
|
|
38
38
|
case Operation.INSERT:
|
|
@@ -43,7 +43,7 @@ function fromTuple(tuple) {
|
|
|
43
43
|
replicaId: tuple[2],
|
|
44
44
|
position: tuple[3],
|
|
45
45
|
data: tuple[4],
|
|
46
|
-
|
|
46
|
+
userIdentity: tuple[5],
|
|
47
47
|
};
|
|
48
48
|
case Operation.REJECT:
|
|
49
49
|
return {
|
|
@@ -52,7 +52,7 @@ function fromTuple(tuple) {
|
|
|
52
52
|
case Operation.LEAVE:
|
|
53
53
|
return {
|
|
54
54
|
operation: tuple[0],
|
|
55
|
-
|
|
55
|
+
userIdentity: tuple[1]
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
58
|
throw new Error("Unknown tuple format");
|
|
@@ -13,13 +13,13 @@ export interface FugueMessage<P> {
|
|
|
13
13
|
replicaId: string;
|
|
14
14
|
position: P;
|
|
15
15
|
data: Data | null;
|
|
16
|
-
|
|
16
|
+
userIdentity?: string;
|
|
17
17
|
}
|
|
18
18
|
export interface FugueJoinMessage<P> {
|
|
19
19
|
operation: Operation.JOIN;
|
|
20
20
|
documentID: string;
|
|
21
21
|
state: FugueState<P> | null;
|
|
22
|
-
|
|
22
|
+
userIdentity?: string;
|
|
23
23
|
collaborators?: string[];
|
|
24
24
|
}
|
|
25
25
|
export interface FugueRejectMessage {
|
|
@@ -27,7 +27,8 @@ export interface FugueRejectMessage {
|
|
|
27
27
|
}
|
|
28
28
|
export interface FugueLeaveMessage {
|
|
29
29
|
operation: Operation.LEAVE;
|
|
30
|
-
|
|
30
|
+
userIdentity: string;
|
|
31
31
|
}
|
|
32
32
|
export type FugueMessageType<P> = FugueMessage<P> | FugueJoinMessage<P> | FugueRejectMessage | FugueLeaveMessage;
|
|
33
|
+
export type FugueMutationMessageTypes<P> = Extract<FugueMessageType<P>, FugueMessage<P> | FugueJoinMessage<P>>;
|
|
33
34
|
//# sourceMappingURL=Message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../src/types/Fugue/Message.ts"],"names":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IACtB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAkB;IAC/B,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,iBAAiB;IAC9B,SAAS,EAAE,SAAS,CAAC,KAAK,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,GAAG,kBAAkB,GAAG,iBAAiB,CAAC;AAEjH,MAAM,MAAM,yBAAyB,CAAC,CAAC,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cr_docs_t/dts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"prepublishOnly": "npm run build",
|
|
11
11
|
"ci": "npm install && npm run build",
|
|
12
12
|
"pretest": "npm run build",
|
|
13
|
-
"publish": "npm publish --access public",
|
|
14
13
|
"sest": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
|
|
15
14
|
},
|
|
16
15
|
"exports": {
|