@cr_docs_t/dts 0.20.1 → 0.22.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.
@@ -9,9 +9,9 @@ export declare class FugueList<P> {
9
9
  positionCounter: number;
10
10
  ws: WebSocket | null;
11
11
  documentID: string;
12
- email: string | undefined;
12
+ userIdentity: string | undefined;
13
13
  readonly batchSize = 100;
14
- constructor(totalOrder: UniquelyDenseTotalOrder<P>, ws: WebSocket | null, documentID: string, email?: 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,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,QAAQ,CAAC,SAAS,OAAO;gBAEb,UAAU,EAAE,uBAAuB,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,SAAS,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;IAO5G;;;OAGG;IACH,OAAO,CAAC,SAAS;IAQjB,OAAO,CAAC,oBAAoB;IAmB5B;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAqBxB;;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ACnB,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;IAcxB;;;;OAIG;IACH,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAajD;;;;;OAKG;IACH,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;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, email) {
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.email = email;
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
- email: this.email,
98
+ userIdentity: this.userIdentity,
99
99
  data: value,
100
100
  });
101
101
  }
@@ -106,9 +106,9 @@ export class FugueList {
106
106
  * @param value - Value to insert
107
107
  */
108
108
  insertMultiple(index, value) {
109
- if (value.length == 0)
109
+ if (value.length === 0)
110
110
  return;
111
- if (value.length == 1) {
111
+ if (value.length === 1) {
112
112
  this.insert(index, value);
113
113
  return;
114
114
  }
@@ -128,7 +128,7 @@ export class FugueList {
128
128
  replicaId: this.totalOrder.getReplicaId(),
129
129
  operation: Operation.INSERT,
130
130
  position: pos,
131
- email: this.email,
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
- email: this.email,
219
+ userIdentity: this.userIdentity,
220
220
  data: null,
221
221
  });
222
222
  }
@@ -229,7 +229,7 @@ export class FugueList {
229
229
  deleteMultiple(index, count) {
230
230
  if (count <= 0)
231
231
  return;
232
- if (count == 1) {
232
+ if (count === 1) {
233
233
  this.delete(index);
234
234
  return;
235
235
  }
@@ -251,7 +251,7 @@ export class FugueList {
251
251
  replicaId: this.totalOrder.getReplicaId(),
252
252
  operation: Operation.DELETE,
253
253
  position: pos,
254
- email: this.email,
254
+ userIdentity: this.userIdentity,
255
255
  data: null,
256
256
  });
257
257
  if (msgs.length >= this.batchSize) {
@@ -297,7 +297,7 @@ export class FugueList {
297
297
  */
298
298
  singleEffect(msg) {
299
299
  const { replicaId, operation, data, position } = msg;
300
- if (replicaId == this.totalOrder.getReplicaId())
300
+ if (replicaId === this.totalOrder.getReplicaId())
301
301
  return;
302
302
  switch (operation) {
303
303
  case Operation.INSERT:
@@ -319,7 +319,7 @@ export class FugueList {
319
319
  // Separate operations
320
320
  for (const msg of msgs) {
321
321
  const { replicaId, operation, position, data } = msg;
322
- if (replicaId == this.totalOrder.getReplicaId())
322
+ if (replicaId === this.totalOrder.getReplicaId())
323
323
  continue;
324
324
  switch (operation) {
325
325
  case Operation.INSERT:
@@ -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;AAmDD,eAAO,MAAM,sBAAsB;;;CAGlC,CAAC"}
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;AAoDD,eAAO,MAAM,sBAAsB;;;CAGlC,CAAC"}
@@ -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.email, msg.collaborators];
17
+ return [msg.operation, msg.documentID, msg.state, msg.userIdentity, msg.collaborators, msg.offlineChanges];
18
18
  case Operation.INSERT:
19
19
  case Operation.DELETE:
20
- return [msg.operation, msg.documentID, msg.replicaId, msg.position, msg.data, msg.email];
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.email];
24
+ return [msg.operation, msg.userIdentity];
25
25
  }
26
26
  throw new Error("Unknown message type");
27
27
  }
@@ -32,8 +32,9 @@ function fromTuple(tuple) {
32
32
  operation: tuple[0],
33
33
  documentID: tuple[1],
34
34
  state: tuple[2],
35
- email: tuple[3],
36
- collaborators: tuple[4]
35
+ userIdentity: tuple[3],
36
+ collaborators: tuple[4],
37
+ offlineChanges: tuple[5]
37
38
  };
38
39
  case Operation.INSERT:
39
40
  case Operation.DELETE:
@@ -43,7 +44,7 @@ function fromTuple(tuple) {
43
44
  replicaId: tuple[2],
44
45
  position: tuple[3],
45
46
  data: tuple[4],
46
- email: tuple[5],
47
+ userIdentity: tuple[5],
47
48
  };
48
49
  case Operation.REJECT:
49
50
  return {
@@ -52,7 +53,7 @@ function fromTuple(tuple) {
52
53
  case Operation.LEAVE:
53
54
  return {
54
55
  operation: tuple[0],
55
- email: tuple[1]
56
+ userIdentity: tuple[1]
56
57
  };
57
58
  }
58
59
  throw new Error("Unknown tuple format");
@@ -13,21 +13,22 @@ export interface FugueMessage<P> {
13
13
  replicaId: string;
14
14
  position: P;
15
15
  data: Data | null;
16
- email?: string;
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
- email?: string;
22
+ userIdentity?: string;
23
23
  collaborators?: string[];
24
+ offlineChanges?: FugueState<P> | null;
24
25
  }
25
26
  export interface FugueRejectMessage {
26
27
  operation: Operation.REJECT;
27
28
  }
28
29
  export interface FugueLeaveMessage {
29
30
  operation: Operation.LEAVE;
30
- email: string;
31
+ userIdentity: string;
31
32
  }
32
33
  export type FugueMessageType<P> = FugueMessage<P> | FugueJoinMessage<P> | FugueRejectMessage | FugueLeaveMessage;
33
34
  export type FugueMutationMessageTypes<P> = Extract<FugueMessageType<P>, FugueMessage<P> | FugueJoinMessage<P>>;
@@ -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,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;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,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAkB;IAC/B,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC;CA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