@cr_docs_t/dts 0.25.0 → 0.26.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 +1 -3
- 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 +7 -20
- package/dist/dts/FugueTree/FugueTree.d.ts +2 -2
- package/dist/dts/FugueTree/FugueTree.d.ts.map +1 -1
- package/dist/dts/FugueTree/FugueTree.js +2 -0
- package/dist/dts/Serailizers/FugueTree/Message.d.ts +4 -4
- package/dist/dts/Serailizers/FugueTree/Message.d.ts.map +1 -1
- package/dist/dts/Serailizers/FugueTree/Message.js +1 -1
- package/dist/tests/mocks.d.ts.map +1 -1
- package/dist/tests/mocks.js +1 -1
- package/dist/types/FugueTree/Message.d.ts +17 -19
- package/dist/types/FugueTree/Message.d.ts.map +1 -1
- package/dist/types/FugueTree/Message.js +22 -3
- package/dist/types/Models/Schema.d.ts +18 -0
- package/dist/types/Models/Schema.d.ts.map +1 -1
- package/dist/types/Models/Schema.js +7 -0
- package/package.json +1 -1
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { Operation } from "../../types";
|
|
2
1
|
export declare class FListNode<P> {
|
|
3
2
|
value?: string;
|
|
4
|
-
operation?: Operation;
|
|
5
3
|
position: P;
|
|
6
|
-
constructor(position: P, value?: string
|
|
4
|
+
constructor(position: P, value?: string);
|
|
7
5
|
}
|
|
8
6
|
//# sourceMappingURL=FNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FNode.d.ts","sourceRoot":"","sources":["../../../src/dts/Fugue/FNode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FNode.d.ts","sourceRoot":"","sources":["../../../src/dts/Fugue/FNode.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS,CAAC,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CAAC,CAAC;gBAEA,QAAQ,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM;CAI1C"}
|
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,4BAA4B,CAAC;AACjF,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;gBAGrB,UAAU,EAAE,uBAAuB,CAAC,CAAC,CAAC,EACtC,EAAE,EAAE,SAAS,GAAG,IAAI,EACpB,UAAU,EAAE,MAAM,EAClB,YAAY,CAAC,EAAE,MAAM;IAQzB;;;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;IAenC;;;;;OAKG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAiD3C;;;OAGG;IACH,OAAO,CAAC,gBAAgB;
|
|
1
|
+
{"version":3,"file":"FugueList.d.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AAK,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"}
|
|
@@ -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 FListNode(position, value
|
|
62
|
+
cell.push(new FListNode(position, value));
|
|
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 FListNode(position, value
|
|
68
|
+
this.state.splice(index, 0, [new FListNode(position, value)]);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
@@ -120,7 +120,7 @@ export class FugueList {
|
|
|
120
120
|
for (const c of value) {
|
|
121
121
|
const pos = this.totalOrder.createBetween(cL, rA);
|
|
122
122
|
// Collect new cells
|
|
123
|
-
newCells.push([new FListNode(pos, c
|
|
123
|
+
newCells.push([new FListNode(pos, c)]);
|
|
124
124
|
// Batch propagate
|
|
125
125
|
msgs.push({
|
|
126
126
|
documentID: this.documentID,
|
|
@@ -157,7 +157,6 @@ export class FugueList {
|
|
|
157
157
|
if (node) {
|
|
158
158
|
// Tombstone the node, TODO: Implement garbage collection
|
|
159
159
|
node.value = undefined;
|
|
160
|
-
node.operation = Operation.DELETE;
|
|
161
160
|
return;
|
|
162
161
|
}
|
|
163
162
|
}
|
|
@@ -243,7 +242,6 @@ export class FugueList {
|
|
|
243
242
|
const pos = n.position;
|
|
244
243
|
// Tombstone the node
|
|
245
244
|
n.value = undefined;
|
|
246
|
-
n.operation = Operation.DELETE;
|
|
247
245
|
deletedCount++;
|
|
248
246
|
// Batch
|
|
249
247
|
msgs.push({
|
|
@@ -345,7 +343,6 @@ export class FugueList {
|
|
|
345
343
|
const node = cell.find((n) => this.totalOrder.compare(n.position, pos) === 0);
|
|
346
344
|
if (node && node.value !== undefined) {
|
|
347
345
|
node.value = undefined; // Tombstone
|
|
348
|
-
node.operation = Operation.DELETE;
|
|
349
346
|
}
|
|
350
347
|
}
|
|
351
348
|
}
|
|
@@ -367,7 +364,7 @@ export class FugueList {
|
|
|
367
364
|
const existing = cell.find((n) => this.totalOrder.compare(n.position, position) === 0);
|
|
368
365
|
// Don't insert if it already exists
|
|
369
366
|
if (!existing) {
|
|
370
|
-
cell.push(new FListNode(position, data ? data : undefined
|
|
367
|
+
cell.push(new FListNode(position, data ? data : undefined));
|
|
371
368
|
cell.sort((a, b) => this.totalOrder.compare(a.position, b.position));
|
|
372
369
|
}
|
|
373
370
|
}
|
|
@@ -377,17 +374,11 @@ export class FugueList {
|
|
|
377
374
|
// - This index is not contiguous with the previous group
|
|
378
375
|
if (startIdx === -1) {
|
|
379
376
|
startIdx = idx;
|
|
380
|
-
batchCells = [
|
|
381
|
-
[
|
|
382
|
-
new FListNode(position, data ? data : undefined, data ? Operation.INSERT : Operation.DELETE),
|
|
383
|
-
],
|
|
384
|
-
];
|
|
377
|
+
batchCells = [[new FListNode(position, data ? data : undefined)]];
|
|
385
378
|
}
|
|
386
379
|
// If the index is the same as startIdx, continue the batch
|
|
387
380
|
else if (idx === startIdx) {
|
|
388
|
-
batchCells.push([
|
|
389
|
-
new FListNode(position, data ? data : undefined, data ? Operation.INSERT : Operation.DELETE),
|
|
390
|
-
]);
|
|
381
|
+
batchCells.push([new FListNode(position, data ? data : undefined)]);
|
|
391
382
|
}
|
|
392
383
|
// The index is different, i.e. not contiguous, so flush the current batch,
|
|
393
384
|
// commit it and start a new one
|
|
@@ -400,11 +391,7 @@ export class FugueList {
|
|
|
400
391
|
// we must add the length of the batch we just inserted.
|
|
401
392
|
const shift = idx >= startIdx ? batchCells.length : 0;
|
|
402
393
|
startIdx = idx + shift;
|
|
403
|
-
batchCells = [
|
|
404
|
-
[
|
|
405
|
-
new FListNode(position, data ? data : undefined, data ? Operation.INSERT : Operation.DELETE),
|
|
406
|
-
],
|
|
407
|
-
];
|
|
394
|
+
batchCells = [[new FListNode(position, data ? data : undefined)]];
|
|
408
395
|
}
|
|
409
396
|
}
|
|
410
397
|
}
|
|
@@ -9,10 +9,10 @@ export declare class FugueTree {
|
|
|
9
9
|
ws: WebSocket | null;
|
|
10
10
|
documentID: string;
|
|
11
11
|
readonly replicaID: string;
|
|
12
|
-
userIdentity: string
|
|
12
|
+
userIdentity: string;
|
|
13
13
|
pendingMsgs: Map<string, FugueMessage>;
|
|
14
14
|
readonly batchSize = 100;
|
|
15
|
-
constructor(ws: WebSocket | null, documentID: string, userIdentity
|
|
15
|
+
constructor(ws: WebSocket | null, documentID: string, userIdentity: string);
|
|
16
16
|
/**
|
|
17
17
|
* Make msg key for pending messages map
|
|
18
18
|
* @param msg - the message to make key for
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FugueTree.d.ts","sourceRoot":"","sources":["../../../src/dts/FugueTree/FugueTree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAa,MAAM,kCAAkC,CAAC;AAG3E,OAAO,EAAE,KAAK,EAAS,EAAE,EAAE,MAAM,YAAY,CAAC;AAE9C;;GAEG;AACH,qBAAa,SAAS;IAClB,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,IAAI,CAAQ;IACpB,EAAE,EAAE,SAAS,GAAG,IAAI,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,SAAS,SAAmB;IACrC,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"FugueTree.d.ts","source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AM,IAAI,MAAM;IAIhB;;;OAGG;IACH,OAAO,IAAI,MAAM;IAWjB;;;OAGG;IACH,IAAI,IAAI,UAAU;IAKlB;;;OAGG;IACH,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAK5B;;;;;OAKG;IACH,SAAS,IAAI,MAAM;IAInB;;;;OAIG;IACH,OAAO,CAAC,EAAE,EAAE,EAAE;IAId;;;;OAIG;IACH,eAAe,CAAC,IAAI,EAAE,KAAK;CAG9B"}
|
|
@@ -53,6 +53,7 @@ export class FugueTree {
|
|
|
53
53
|
// leftOrigin has no right children, so the new node becomes
|
|
54
54
|
// a right child of leftOrigin.
|
|
55
55
|
msg = {
|
|
56
|
+
userIdentity: this.userIdentity,
|
|
56
57
|
operation: Operation.INSERT,
|
|
57
58
|
id,
|
|
58
59
|
data: value,
|
|
@@ -73,6 +74,7 @@ export class FugueTree {
|
|
|
73
74
|
// first right child.
|
|
74
75
|
const rightOrigin = this.tree.leftmostDescendant(leftOrigin.rightChildren[0]);
|
|
75
76
|
msg = {
|
|
77
|
+
userIdentity: this.userIdentity,
|
|
76
78
|
operation: Operation.INSERT,
|
|
77
79
|
id,
|
|
78
80
|
data: value,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { FugueMessageType } from "../../../types/FugueTree/index.js";
|
|
2
|
-
declare function serialize(msgs:
|
|
1
|
+
import { BaseFugueMessage, FugueMessageType } from "../../../types/FugueTree/index.js";
|
|
2
|
+
declare function serialize(msgs: BaseFugueMessage[]): Uint8Array<ArrayBuffer>;
|
|
3
3
|
declare function serializeSingleMessage(msg: FugueMessageType): Uint8Array<ArrayBuffer>;
|
|
4
|
-
declare function deserialize(data: Uint8Array):
|
|
5
|
-
declare function deserializeSingleMessage(data: Uint8Array):
|
|
4
|
+
declare function deserialize(data: Uint8Array): BaseFugueMessage[];
|
|
5
|
+
declare function deserializeSingleMessage(data: Uint8Array): BaseFugueMessage;
|
|
6
6
|
export declare const FugueMessageSerialzier: {
|
|
7
7
|
serialize: typeof serialize;
|
|
8
8
|
serializeSingleMessage: typeof serializeSingleMessage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../../src/dts/Serailizers/FugueTree/Message.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../../src/dts/Serailizers/FugueTree/Message.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAEvF,iBAAS,SAAS,CAAC,IAAI,EAAE,gBAAgB,EAAE,2BAE1C;AAED,iBAAS,sBAAsB,CAAC,GAAG,EAAE,gBAAgB,2BAEpD;AAED,iBAAS,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,gBAAgB,EAAE,CAGzD;AAED,iBAAS,wBAAwB,CAAC,IAAI,EAAE,UAAU,GAAG,gBAAgB,CAGpE;AAED,eAAO,MAAM,sBAAsB;;;;;CAKlC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../../src/tests/mocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAoB,MAAM,iBAAiB,CAAC;AAGzE,eAAO,MAAM,cAAc,mBAI1B,CAAC;AAEF,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../../src/tests/mocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAoB,MAAM,iBAAiB,CAAC;AAGzE,eAAO,MAAM,cAAc,mBAI1B,CAAC;AAEF,eAAO,MAAM,cAAc,WAA2E,CAAC"}
|
package/dist/tests/mocks.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { FugueList, FugueTree, StringTotalOrder } from "../dts/index.js";
|
|
2
2
|
import crypto from "crypto";
|
|
3
3
|
export const emptyFugueList = new FugueList(new StringTotalOrder(crypto.randomBytes(3).toString("hex")), null, crypto.randomBytes(24).toString("hex"));
|
|
4
|
-
export const emptyFugueTree = new FugueTree(null, crypto.randomBytes(24).toString("hex"),
|
|
4
|
+
export const emptyFugueTree = new FugueTree(null, crypto.randomBytes(24).toString("hex"), "test-tree");
|
|
@@ -2,42 +2,40 @@ import { ID, NodeSide } from "../../dts/FugueTree/FTree";
|
|
|
2
2
|
export declare enum Operation {
|
|
3
3
|
INSERT = 0,
|
|
4
4
|
DELETE = 1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
INITIAL_SYNC = 2,
|
|
6
|
+
USER_JOIN = 3,
|
|
7
|
+
REJECT = 4,
|
|
8
|
+
LEAVE = 5
|
|
8
9
|
}
|
|
10
|
+
export declare function operationToString(op: Operation): string;
|
|
9
11
|
export type Data = string;
|
|
10
|
-
export interface
|
|
11
|
-
operation:
|
|
12
|
+
export interface BaseFugueMessage<T extends Operation = Operation> {
|
|
13
|
+
operation: T;
|
|
12
14
|
documentID: string;
|
|
13
15
|
replicaId: string;
|
|
16
|
+
userIdentity: string;
|
|
17
|
+
}
|
|
18
|
+
export interface FugueMessage extends BaseFugueMessage<Operation.INSERT | Operation.DELETE> {
|
|
14
19
|
id: ID;
|
|
15
20
|
data: Data | null;
|
|
16
21
|
side: NodeSide;
|
|
17
22
|
parent?: ID;
|
|
18
23
|
rightOrigin?: ID;
|
|
19
|
-
userIdentity?: string;
|
|
20
24
|
}
|
|
21
|
-
export interface FugueJoinMessage {
|
|
22
|
-
operation: Operation.JOIN;
|
|
23
|
-
documentID: string;
|
|
24
|
-
userIdentity?: string;
|
|
25
|
-
collaborators?: string[];
|
|
25
|
+
export interface FugueJoinMessage extends BaseFugueMessage<Operation.INITIAL_SYNC> {
|
|
26
26
|
state: Uint8Array<ArrayBufferLike> | null;
|
|
27
27
|
bufferedOperations?: Buffer<ArrayBuffer>[];
|
|
28
|
-
replicaId?: string;
|
|
29
28
|
}
|
|
30
|
-
export interface FugueRejectMessage {
|
|
31
|
-
|
|
29
|
+
export interface FugueRejectMessage extends BaseFugueMessage<Operation.REJECT> {
|
|
30
|
+
documentID: string;
|
|
32
31
|
reason: string;
|
|
33
32
|
}
|
|
34
|
-
export interface FugueLeaveMessage {
|
|
35
|
-
operation: Operation.LEAVE;
|
|
33
|
+
export interface FugueLeaveMessage extends BaseFugueMessage<Operation.LEAVE> {
|
|
36
34
|
userIdentity: string;
|
|
35
|
+
collaborators: string[];
|
|
37
36
|
}
|
|
38
|
-
export interface FugueUserJoinMessage {
|
|
39
|
-
|
|
40
|
-
userIdentity: string;
|
|
37
|
+
export interface FugueUserJoinMessage extends BaseFugueMessage<Operation.USER_JOIN> {
|
|
38
|
+
collaborators: string[];
|
|
41
39
|
}
|
|
42
40
|
export type FugueMessageType = FugueMessage | FugueJoinMessage | FugueRejectMessage | FugueLeaveMessage | FugueUserJoinMessage;
|
|
43
41
|
export type FugueMutationMessageTypes = Extract<FugueMessageType, FugueMessage | FugueJoinMessage>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../src/types/FugueTree/Message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAEzD,oBAAY,SAAS;IACjB,MAAM,IAAA;IACN,MAAM,IAAA;IACN,
|
|
1
|
+
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../src/types/FugueTree/Message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAEzD,oBAAY,SAAS;IACjB,MAAM,IAAA;IACN,MAAM,IAAA;IACN,YAAY,IAAA;IACZ,SAAS,IAAA;IACT,MAAM,IAAA;IACN,KAAK,IAAA;CACR;AAED,wB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ClB,iBAAiB,GACjB,oBAAoB,CAAC;AAE3B,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAAC,gBAAgB,EAAE,YAAY,GAAG,gBAAgB,CAAC,CAAC"}
|
|
@@ -2,7 +2,26 @@ export var Operation;
|
|
|
2
2
|
(function (Operation) {
|
|
3
3
|
Operation[Operation["INSERT"] = 0] = "INSERT";
|
|
4
4
|
Operation[Operation["DELETE"] = 1] = "DELETE";
|
|
5
|
-
Operation[Operation["
|
|
6
|
-
Operation[Operation["
|
|
7
|
-
Operation[Operation["
|
|
5
|
+
Operation[Operation["INITIAL_SYNC"] = 2] = "INITIAL_SYNC";
|
|
6
|
+
Operation[Operation["USER_JOIN"] = 3] = "USER_JOIN";
|
|
7
|
+
Operation[Operation["REJECT"] = 4] = "REJECT";
|
|
8
|
+
Operation[Operation["LEAVE"] = 5] = "LEAVE";
|
|
8
9
|
})(Operation || (Operation = {}));
|
|
10
|
+
export function operationToString(op) {
|
|
11
|
+
switch (op) {
|
|
12
|
+
case Operation.INSERT:
|
|
13
|
+
return "INSERT";
|
|
14
|
+
case Operation.DELETE:
|
|
15
|
+
return "DELETE";
|
|
16
|
+
case Operation.INITIAL_SYNC:
|
|
17
|
+
return "INITIAL_SYNC";
|
|
18
|
+
case Operation.USER_JOIN:
|
|
19
|
+
return "USER_JOIN";
|
|
20
|
+
case Operation.REJECT:
|
|
21
|
+
return "REJECT";
|
|
22
|
+
case Operation.LEAVE:
|
|
23
|
+
return "LEAVE";
|
|
24
|
+
default:
|
|
25
|
+
return "UNKNOWN_OPERATION";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -20,8 +20,26 @@ export declare const DocumentSchema: z.ZodObject<{
|
|
|
20
20
|
contributorType: z.ZodEnum<typeof ContributorType>;
|
|
21
21
|
email: z.ZodEmail;
|
|
22
22
|
}, z.core.$strip>>>;
|
|
23
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export declare const ProjectSchema: z.ZodObject<{
|
|
26
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
27
|
+
createdAt: z.ZodOptional<z.ZodISODateTime>;
|
|
28
|
+
updatedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
29
|
+
name: z.ZodString;
|
|
30
|
+
ownerId: z.ZodOptional<z.ZodString>;
|
|
31
|
+
documentIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
32
|
+
contributors: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
33
|
+
contributorType: z.ZodEnum<typeof ContributorType>;
|
|
34
|
+
email: z.ZodEmail;
|
|
35
|
+
}, z.core.$strip>>>;
|
|
23
36
|
}, z.core.$strip>;
|
|
24
37
|
export type Identified = z.infer<typeof IdentifiedSchema>;
|
|
25
38
|
export type Contributor = z.infer<typeof ContributorSchema>;
|
|
26
39
|
export type Document = z.infer<typeof DocumentSchema>;
|
|
40
|
+
export type Project = z.infer<typeof ProjectSchema>;
|
|
41
|
+
export type ProjectWithDocuments = {
|
|
42
|
+
project: Project;
|
|
43
|
+
documents: Document[];
|
|
44
|
+
};
|
|
27
45
|
//# sourceMappingURL=Schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../../src/types/Models/Schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,eAAO,MAAM,gBAAgB;;;;iBAI3B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;iBAG5B,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../../src/types/Models/Schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,eAAO,MAAM,gBAAgB;;;;iBAI3B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;iBAG5B,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;iBAMzB,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;iBAKxB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,MAAM,MAAM,oBAAoB,GAAG;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,QAAQ,EAAE,CAAC;CACzB,CAAC"}
|
|
@@ -14,4 +14,11 @@ export const DocumentSchema = IdentifiedSchema.extend({
|
|
|
14
14
|
serializedCRDTState: z.string(),
|
|
15
15
|
ownerId: z.string().optional(),
|
|
16
16
|
contributors: z.array(ContributorSchema).default([]),
|
|
17
|
+
projectId: z.string().optional(),
|
|
18
|
+
});
|
|
19
|
+
export const ProjectSchema = IdentifiedSchema.extend({
|
|
20
|
+
name: z.string().min(1, "Name is required"),
|
|
21
|
+
ownerId: z.string().optional(),
|
|
22
|
+
documentIds: z.array(z.string()).default([]),
|
|
23
|
+
contributors: z.array(ContributorSchema).default([]),
|
|
17
24
|
});
|