cojson 0.2.2 → 0.3.0-alpha.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/.eslintrc.cjs +1 -0
- package/dist/account.d.ts +8 -8
- package/dist/account.js +2 -2
- package/dist/account.js.map +1 -1
- package/dist/coValue.d.ts +22 -27
- package/dist/coValue.js +21 -0
- package/dist/coValue.js.map +1 -1
- package/dist/coValueCore.d.ts +7 -7
- package/dist/coValueCore.js +11 -14
- package/dist/coValueCore.js.map +1 -1
- package/dist/coValues/coList.d.ts +107 -42
- package/dist/coValues/coList.js +163 -72
- package/dist/coValues/coList.js.map +1 -1
- package/dist/coValues/coMap.d.ts +109 -50
- package/dist/coValues/coMap.js +161 -109
- package/dist/coValues/coMap.js.map +1 -1
- package/dist/coValues/coStream.d.ts +78 -33
- package/dist/coValues/coStream.js +134 -53
- package/dist/coValues/coStream.js.map +1 -1
- package/dist/crypto.d.ts +8 -3
- package/dist/crypto.js +6 -6
- package/dist/crypto.js.map +1 -1
- package/dist/group.d.ts +59 -23
- package/dist/group.js +83 -25
- package/dist/group.js.map +1 -1
- package/dist/index.d.ts +14 -11
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/{node.d.ts → localNode.d.ts} +23 -11
- package/dist/{node.js → localNode.js} +80 -42
- package/dist/localNode.js.map +1 -0
- package/dist/media.d.ts +1 -2
- package/dist/permissions.js +6 -3
- package/dist/permissions.js.map +1 -1
- package/dist/queriedCoValues/queriedCoList.d.ts +66 -0
- package/dist/queriedCoValues/queriedCoList.js +120 -0
- package/dist/queriedCoValues/queriedCoList.js.map +1 -0
- package/dist/queriedCoValues/queriedCoMap.d.ts +47 -0
- package/dist/queriedCoValues/queriedCoMap.js +83 -0
- package/dist/queriedCoValues/queriedCoMap.js.map +1 -0
- package/dist/queriedCoValues/queriedCoStream.d.ts +40 -0
- package/dist/queriedCoValues/queriedCoStream.js +72 -0
- package/dist/queriedCoValues/queriedCoStream.js.map +1 -0
- package/dist/queries.d.ts +31 -0
- package/dist/queries.js +77 -0
- package/dist/queries.js.map +1 -0
- package/dist/sync.d.ts +1 -1
- package/dist/sync.js +1 -1
- package/dist/sync.js.map +1 -1
- package/dist/{testUtils.d.ts → tests/testUtils.d.ts} +9 -9
- package/dist/{testUtils.js → tests/testUtils.js} +9 -7
- package/dist/tests/testUtils.js.map +1 -0
- package/package.json +2 -2
- package/src/account.ts +6 -6
- package/src/coValue.ts +65 -34
- package/src/coValueCore.ts +18 -22
- package/src/coValues/coList.ts +272 -122
- package/src/coValues/coMap.ts +349 -152
- package/src/coValues/coStream.ts +258 -94
- package/src/crypto.ts +37 -24
- package/src/group.ts +112 -46
- package/src/index.ts +42 -30
- package/src/{node.ts → localNode.ts} +117 -66
- package/src/media.ts +1 -2
- package/src/permissions.ts +15 -18
- package/src/queriedCoValues/queriedCoList.ts +248 -0
- package/src/queriedCoValues/queriedCoMap.ts +180 -0
- package/src/queriedCoValues/queriedCoStream.ts +125 -0
- package/src/queries.ts +142 -0
- package/src/sync.ts +2 -2
- package/src/{account.test.ts → tests/account.test.ts} +6 -9
- package/src/{coValue.test.ts → tests/coValue.test.ts} +120 -114
- package/src/{coValueCore.test.ts → tests/coValueCore.test.ts} +7 -7
- package/src/{crypto.test.ts → tests/crypto.test.ts} +19 -21
- package/src/{group.test.ts → tests/group.test.ts} +2 -2
- package/src/{permissions.test.ts → tests/permissions.test.ts} +260 -247
- package/src/tests/queries.test.ts +318 -0
- package/src/{sync.test.ts → tests/sync.test.ts} +39 -39
- package/src/{testUtils.ts → tests/testUtils.ts} +10 -8
- package/dist/coValues/static.d.ts +0 -14
- package/dist/coValues/static.js +0 -20
- package/dist/coValues/static.js.map +0 -1
- package/dist/node.js.map +0 -1
- package/dist/testUtils.js.map +0 -1
- package/src/coValues/static.ts +0 -31
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import { BinaryCoStream, CoList, CoMap, CoStream, Group, LocalNode, cojsonReady } from "..";
|
|
2
|
+
|
|
3
|
+
beforeEach(async () => {
|
|
4
|
+
await cojsonReady;
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
test("Queries with maps work", async () => {
|
|
8
|
+
const { node, accountID } =
|
|
9
|
+
LocalNode.withNewlyCreatedAccount("Hermes Puggington");
|
|
10
|
+
|
|
11
|
+
const group = node.createGroup();
|
|
12
|
+
|
|
13
|
+
let map = group.createMap<
|
|
14
|
+
CoMap<{
|
|
15
|
+
hello: "world";
|
|
16
|
+
subMap: CoMap<{
|
|
17
|
+
hello: "world" | "moon" | "sun";
|
|
18
|
+
id: string;
|
|
19
|
+
}>;
|
|
20
|
+
}>
|
|
21
|
+
>();
|
|
22
|
+
|
|
23
|
+
const done = new Promise<void>((resolve) => {
|
|
24
|
+
const unsubQuery = node.query(map.id, (queriedMap) => {
|
|
25
|
+
// console.log("update", update);
|
|
26
|
+
if (queriedMap) {
|
|
27
|
+
expect(queriedMap.type).toBe("comap");
|
|
28
|
+
expect(queriedMap.id).toEqual(map.id);
|
|
29
|
+
expect(queriedMap.core).toEqual(map.core);
|
|
30
|
+
expect(queriedMap.group).toBeInstanceOf(Group);
|
|
31
|
+
expect(queriedMap.group.id).toBe(group.id);
|
|
32
|
+
expect(queriedMap.meta).toBe(null);
|
|
33
|
+
expect(queriedMap.hello).toBe("world");
|
|
34
|
+
expect(Object.keys(queriedMap)).toEqual(["hello", "subMap"]);
|
|
35
|
+
if (queriedMap.edits.hello?.by?.profile?.name) {
|
|
36
|
+
expect(queriedMap.edits.hello).toMatchObject({
|
|
37
|
+
by: {
|
|
38
|
+
id: accountID,
|
|
39
|
+
profile: {
|
|
40
|
+
id: node.expectProfileLoaded(accountID).id,
|
|
41
|
+
name: "Hermes Puggington",
|
|
42
|
+
},
|
|
43
|
+
isMe: true,
|
|
44
|
+
},
|
|
45
|
+
tx: map.lastEditAt("hello")!.tx,
|
|
46
|
+
at: new Date(map.lastEditAt("hello")!.at),
|
|
47
|
+
});
|
|
48
|
+
if (queriedMap.subMap) {
|
|
49
|
+
expect(queriedMap.subMap.type).toBe("comap");
|
|
50
|
+
expect(queriedMap.subMap.id).toEqual("foreignID");
|
|
51
|
+
expect(queriedMap.subMap.core).toEqual(subMap.core);
|
|
52
|
+
expect(queriedMap.subMap.group).toBeInstanceOf(Group);
|
|
53
|
+
expect(queriedMap.subMap.group.id).toBe(group.id);
|
|
54
|
+
expect(queriedMap.subMap.meta).toBe(null);
|
|
55
|
+
if (queriedMap.subMap.hello === "moon") {
|
|
56
|
+
// console.log("got to 'moon'");
|
|
57
|
+
queriedMap.subMap.set("hello", "sun");
|
|
58
|
+
} else if (
|
|
59
|
+
queriedMap.subMap.hello === "sun" &&
|
|
60
|
+
queriedMap.subMap.edits.hello?.by?.profile?.name ===
|
|
61
|
+
"Hermes Puggington"
|
|
62
|
+
) {
|
|
63
|
+
// console.log("final update", queriedMap);
|
|
64
|
+
resolve();
|
|
65
|
+
unsubQuery();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
map = map.set("hello", "world");
|
|
74
|
+
|
|
75
|
+
let subMap = group.createMap<
|
|
76
|
+
CoMap<{
|
|
77
|
+
hello: "world" | "moon" | "sun";
|
|
78
|
+
id: string;
|
|
79
|
+
}>
|
|
80
|
+
>();
|
|
81
|
+
|
|
82
|
+
map = map.set("subMap", subMap);
|
|
83
|
+
|
|
84
|
+
subMap = subMap.mutate((subMap) => {
|
|
85
|
+
subMap.set("hello", "world");
|
|
86
|
+
subMap.set("id", "foreignID");
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
subMap = subMap.set("hello", "moon");
|
|
90
|
+
|
|
91
|
+
await done;
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test("Queries with lists work", () => {
|
|
95
|
+
const { node, accountID } =
|
|
96
|
+
LocalNode.withNewlyCreatedAccount("Hermes Puggington");
|
|
97
|
+
|
|
98
|
+
const group = node.createGroup();
|
|
99
|
+
|
|
100
|
+
let list = group.createList<CoList<string>>();
|
|
101
|
+
|
|
102
|
+
const done = new Promise<void>((resolve) => {
|
|
103
|
+
const unsubQuery = node.query(list.id, (queriedList) => {
|
|
104
|
+
if (queriedList) {
|
|
105
|
+
// console.log("update", queriedList, queriedList.edits);
|
|
106
|
+
expect(queriedList.type).toBe("colist");
|
|
107
|
+
expect(queriedList.id).toEqual(list.id);
|
|
108
|
+
expect(queriedList.core).toEqual(list.core);
|
|
109
|
+
expect(queriedList.group).toBeInstanceOf(Group);
|
|
110
|
+
expect(queriedList.group.id).toBe(group.id);
|
|
111
|
+
expect(queriedList.meta).toBe(null);
|
|
112
|
+
expect(queriedList[0]).toBe("hello");
|
|
113
|
+
expect(queriedList[1]).toBe("world");
|
|
114
|
+
expect(queriedList[2]).toBe("moon");
|
|
115
|
+
if (queriedList.edits[2]?.by?.profile?.name) {
|
|
116
|
+
expect(queriedList.edits[2]).toMatchObject({
|
|
117
|
+
by: {
|
|
118
|
+
id: accountID,
|
|
119
|
+
profile: {
|
|
120
|
+
id: node.expectProfileLoaded(accountID).id,
|
|
121
|
+
name: "Hermes Puggington",
|
|
122
|
+
},
|
|
123
|
+
isMe: true,
|
|
124
|
+
},
|
|
125
|
+
at: expect.any(Date),
|
|
126
|
+
});
|
|
127
|
+
if (queriedList.length === 3) {
|
|
128
|
+
queriedList.append("sun");
|
|
129
|
+
|
|
130
|
+
} else if (
|
|
131
|
+
queriedList.length === 4 &&
|
|
132
|
+
queriedList.edits[3]?.by?.profile?.name ===
|
|
133
|
+
"Hermes Puggington"
|
|
134
|
+
) {
|
|
135
|
+
expect(queriedList[3]).toBe("sun");
|
|
136
|
+
// console.log("final update", queriedList);
|
|
137
|
+
resolve();
|
|
138
|
+
unsubQuery();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
list = list.mutate((list) => {
|
|
146
|
+
list.append("hello");
|
|
147
|
+
list.append("world");
|
|
148
|
+
list.append("moon");
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
return done;
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
test("List of nested maps works", () => {
|
|
155
|
+
const { node } = LocalNode.withNewlyCreatedAccount("Hermes Puggington");
|
|
156
|
+
|
|
157
|
+
const group = node.createGroup();
|
|
158
|
+
|
|
159
|
+
let list = group.createList<CoList<CoMap<{ hello: "world" }>>>();
|
|
160
|
+
|
|
161
|
+
const done = new Promise<void>((resolve) => {
|
|
162
|
+
const unsubQuery = node.query(list.id, (queriedList) => {
|
|
163
|
+
if (queriedList && queriedList[0]) {
|
|
164
|
+
// console.log("update", queriedList);
|
|
165
|
+
expect(queriedList[0]).toMatchObject({
|
|
166
|
+
hello: "world",
|
|
167
|
+
id: list.get(0)!,
|
|
168
|
+
});
|
|
169
|
+
// console.log("final update", queriedList);
|
|
170
|
+
resolve();
|
|
171
|
+
unsubQuery();
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
list = list.append(
|
|
177
|
+
group.createMap<CoMap<{ hello: "world" }>>({
|
|
178
|
+
hello: "world",
|
|
179
|
+
})
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
return done;
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
test("Can call .map on a quieried coList", async () => {
|
|
186
|
+
const { node } = LocalNode.withNewlyCreatedAccount("Hermes Puggington");
|
|
187
|
+
|
|
188
|
+
const group = node.createGroup();
|
|
189
|
+
|
|
190
|
+
let list = group.createList<CoList<string>>();
|
|
191
|
+
|
|
192
|
+
const done = new Promise<void>((resolve) => {
|
|
193
|
+
|
|
194
|
+
const unsubQuery = node.query(list.id, (queriedList) => {
|
|
195
|
+
|
|
196
|
+
if (queriedList && queriedList[0]) {
|
|
197
|
+
// console.log("update", queriedList);
|
|
198
|
+
expect(queriedList.map((item) => item + "!!!")).toEqual([
|
|
199
|
+
"hello!!!",
|
|
200
|
+
"world!!!",
|
|
201
|
+
]);
|
|
202
|
+
// console.log("final update", queriedList);
|
|
203
|
+
resolve();
|
|
204
|
+
unsubQuery();
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
list = list.mutate((list) => {
|
|
210
|
+
list.append("hello");
|
|
211
|
+
list.append("world");
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
await done;
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
test("Queries with streams work", () => {
|
|
218
|
+
const { node, accountID } =
|
|
219
|
+
LocalNode.withNewlyCreatedAccount("Hermes Puggington");
|
|
220
|
+
|
|
221
|
+
const group = node.createGroup();
|
|
222
|
+
|
|
223
|
+
let stream = group.createStream<CoStream<string>>();
|
|
224
|
+
|
|
225
|
+
const done = new Promise<void>((resolve) => {
|
|
226
|
+
const unsubQuery = node.query(stream.id, (queriedStream) => {
|
|
227
|
+
if (queriedStream) {
|
|
228
|
+
// console.log("update", queriedStream);
|
|
229
|
+
if (queriedStream.me?.by?.profile?.name) {
|
|
230
|
+
expect(queriedStream.type).toBe("costream");
|
|
231
|
+
expect(queriedStream.id).toEqual(stream.id);
|
|
232
|
+
expect(queriedStream.core).toEqual(stream.core);
|
|
233
|
+
expect(queriedStream.group).toBeInstanceOf(Group);
|
|
234
|
+
expect(queriedStream.group.id).toBe(group.id);
|
|
235
|
+
expect(queriedStream.meta).toBe(null);
|
|
236
|
+
const expectedEntry = {
|
|
237
|
+
last: "world",
|
|
238
|
+
by: {
|
|
239
|
+
id: accountID,
|
|
240
|
+
isMe: true,
|
|
241
|
+
profile: {
|
|
242
|
+
id: node.expectProfileLoaded(accountID).id,
|
|
243
|
+
name: "Hermes Puggington",
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
at: new Date(
|
|
247
|
+
stream.items[node.currentSessionID][1].madeAt
|
|
248
|
+
),
|
|
249
|
+
all: [
|
|
250
|
+
{
|
|
251
|
+
value: "hello",
|
|
252
|
+
at: new Date(
|
|
253
|
+
stream.items[
|
|
254
|
+
node.currentSessionID
|
|
255
|
+
][0].madeAt
|
|
256
|
+
),
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
value: "world",
|
|
260
|
+
at: new Date(
|
|
261
|
+
stream.items[
|
|
262
|
+
node.currentSessionID
|
|
263
|
+
][1].madeAt
|
|
264
|
+
),
|
|
265
|
+
},
|
|
266
|
+
],
|
|
267
|
+
};
|
|
268
|
+
expect(queriedStream.perSession).toMatchObject({
|
|
269
|
+
[node.currentSessionID]: expectedEntry,
|
|
270
|
+
});
|
|
271
|
+
expect(queriedStream.perAccount).toMatchObject({
|
|
272
|
+
[accountID]: expectedEntry,
|
|
273
|
+
});
|
|
274
|
+
expect(queriedStream.me).toMatchObject(expectedEntry);
|
|
275
|
+
// console.log("final update", queriedStream);
|
|
276
|
+
resolve();
|
|
277
|
+
unsubQuery();
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
stream = stream.push("hello");
|
|
284
|
+
stream = stream.push("world");
|
|
285
|
+
|
|
286
|
+
return done;
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
test("Streams of nested maps work", () => {
|
|
290
|
+
const { node } = LocalNode.withNewlyCreatedAccount("Hermes Puggington");
|
|
291
|
+
|
|
292
|
+
const group = node.createGroup();
|
|
293
|
+
|
|
294
|
+
let stream = group.createStream<CoStream<CoMap<{ hello: "world" }>>>();
|
|
295
|
+
|
|
296
|
+
const done = new Promise<void>((resolve) => {
|
|
297
|
+
const unsubQuery = node.query(stream.id, (queriedStream) => {
|
|
298
|
+
if (queriedStream && queriedStream.me?.last) {
|
|
299
|
+
// console.log("update", queriedList);
|
|
300
|
+
expect(queriedStream.me.last).toMatchObject({
|
|
301
|
+
hello: "world",
|
|
302
|
+
id: map.id,
|
|
303
|
+
});
|
|
304
|
+
// console.log("final update", queriedList);
|
|
305
|
+
resolve();
|
|
306
|
+
unsubQuery();
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
const map = group.createMap<CoMap<{ hello: "world" }>>({
|
|
312
|
+
hello: "world",
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
stream = stream.push(map);
|
|
316
|
+
|
|
317
|
+
return done;
|
|
318
|
+
});
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { newRandomSessionID } from "
|
|
2
|
-
import { LocalNode } from "
|
|
3
|
-
import { SyncMessage } from "
|
|
4
|
-
import { expectMap } from "
|
|
5
|
-
import { MapOpPayload } from "
|
|
6
|
-
import { Group } from "
|
|
1
|
+
import { newRandomSessionID } from "../coValueCore.js";
|
|
2
|
+
import { LocalNode } from "../localNode.js";
|
|
3
|
+
import { SyncMessage } from "../sync.js";
|
|
4
|
+
import { expectMap } from "../coValue.js";
|
|
5
|
+
import { MapOpPayload } from "../coValues/coMap.js";
|
|
6
|
+
import { Group } from "../group.js";
|
|
7
7
|
import {
|
|
8
8
|
randomAnonymousAccountAndSessionID,
|
|
9
9
|
shouldNotResolve,
|
|
10
10
|
} from "./testUtils.js";
|
|
11
|
-
import { connectedPeers, newStreamPair } from "
|
|
12
|
-
import { AccountID } from "
|
|
13
|
-
import { cojsonReady } from "
|
|
14
|
-
import { stableStringify } from "
|
|
11
|
+
import { connectedPeers, newStreamPair } from "../streamUtils.js";
|
|
12
|
+
import { AccountID } from "../account.js";
|
|
13
|
+
import { cojsonReady } from "../index.js";
|
|
14
|
+
import { stableStringify } from "../jsonStringify.js";
|
|
15
15
|
|
|
16
16
|
beforeEach(async () => {
|
|
17
17
|
await cojsonReady;
|
|
@@ -32,7 +32,7 @@ test("Node replies with initial tx and header to empty subscribe", async () => {
|
|
|
32
32
|
const [inRx, inTx] = newStreamPair<SyncMessage>();
|
|
33
33
|
const [outRx, outTx] = newStreamPair<SyncMessage>();
|
|
34
34
|
|
|
35
|
-
node.
|
|
35
|
+
node.syncManager.addPeer({
|
|
36
36
|
id: "test",
|
|
37
37
|
incoming: inRx,
|
|
38
38
|
outgoing: outTx,
|
|
@@ -114,7 +114,7 @@ test("Node replies with only new tx to subscribe with some known state", async (
|
|
|
114
114
|
const [inRx, inTx] = newStreamPair<SyncMessage>();
|
|
115
115
|
const [outRx, outTx] = newStreamPair<SyncMessage>();
|
|
116
116
|
|
|
117
|
-
node.
|
|
117
|
+
node.syncManager.addPeer({
|
|
118
118
|
id: "test",
|
|
119
119
|
incoming: inRx,
|
|
120
120
|
outgoing: outTx,
|
|
@@ -191,7 +191,7 @@ test("After subscribing, node sends own known state and new txs to peer", async
|
|
|
191
191
|
const [inRx, inTx] = newStreamPair<SyncMessage>();
|
|
192
192
|
const [outRx, outTx] = newStreamPair<SyncMessage>();
|
|
193
193
|
|
|
194
|
-
node.
|
|
194
|
+
node.syncManager.addPeer({
|
|
195
195
|
id: "test",
|
|
196
196
|
incoming: inRx,
|
|
197
197
|
outgoing: outTx,
|
|
@@ -312,7 +312,7 @@ test("Client replies with known new content to tellKnownState from server", asyn
|
|
|
312
312
|
const [inRx, inTx] = newStreamPair<SyncMessage>();
|
|
313
313
|
const [outRx, outTx] = newStreamPair<SyncMessage>();
|
|
314
314
|
|
|
315
|
-
node.
|
|
315
|
+
node.syncManager.addPeer({
|
|
316
316
|
id: "test",
|
|
317
317
|
incoming: inRx,
|
|
318
318
|
outgoing: outTx,
|
|
@@ -387,7 +387,7 @@ test("No matter the optimistic known state, node respects invalid known state me
|
|
|
387
387
|
const [inRx, inTx] = newStreamPair<SyncMessage>();
|
|
388
388
|
const [outRx, outTx] = newStreamPair<SyncMessage>();
|
|
389
389
|
|
|
390
|
-
node.
|
|
390
|
+
node.syncManager.addPeer({
|
|
391
391
|
id: "test",
|
|
392
392
|
incoming: inRx,
|
|
393
393
|
outgoing: outTx,
|
|
@@ -491,7 +491,7 @@ test("If we add a peer, but it never subscribes to a coValue, it won't get any m
|
|
|
491
491
|
const [inRx, _inTx] = newStreamPair<SyncMessage>();
|
|
492
492
|
const [outRx, outTx] = newStreamPair<SyncMessage>();
|
|
493
493
|
|
|
494
|
-
node.
|
|
494
|
+
node.syncManager.addPeer({
|
|
495
495
|
id: "test",
|
|
496
496
|
incoming: inRx,
|
|
497
497
|
outgoing: outTx,
|
|
@@ -520,7 +520,7 @@ test("If we add a server peer, all updates to all coValues are sent to it, even
|
|
|
520
520
|
const [inRx, _inTx] = newStreamPair<SyncMessage>();
|
|
521
521
|
const [outRx, outTx] = newStreamPair<SyncMessage>();
|
|
522
522
|
|
|
523
|
-
node.
|
|
523
|
+
node.syncManager.addPeer({
|
|
524
524
|
id: "test",
|
|
525
525
|
incoming: inRx,
|
|
526
526
|
outgoing: outTx,
|
|
@@ -592,7 +592,7 @@ test("If we add a server peer, newly created coValues are auto-subscribed to", a
|
|
|
592
592
|
const [inRx, _inTx] = newStreamPair<SyncMessage>();
|
|
593
593
|
const [outRx, outTx] = newStreamPair<SyncMessage>();
|
|
594
594
|
|
|
595
|
-
node.
|
|
595
|
+
node.syncManager.addPeer({
|
|
596
596
|
id: "test",
|
|
597
597
|
incoming: inRx,
|
|
598
598
|
outgoing: outTx,
|
|
@@ -646,7 +646,7 @@ test("When we connect a new server peer, we try to sync all existing coValues to
|
|
|
646
646
|
const [inRx, _inTx] = newStreamPair<SyncMessage>();
|
|
647
647
|
const [outRx, outTx] = newStreamPair<SyncMessage>();
|
|
648
648
|
|
|
649
|
-
node.
|
|
649
|
+
node.syncManager.addPeer({
|
|
650
650
|
id: "test",
|
|
651
651
|
incoming: inRx,
|
|
652
652
|
outgoing: outTx,
|
|
@@ -682,7 +682,7 @@ test("When receiving a subscribe with a known state that is ahead of our own, pe
|
|
|
682
682
|
const [inRx, inTx] = newStreamPair<SyncMessage>();
|
|
683
683
|
const [outRx, outTx] = newStreamPair<SyncMessage>();
|
|
684
684
|
|
|
685
|
-
node.
|
|
685
|
+
node.syncManager.addPeer({
|
|
686
686
|
id: "test",
|
|
687
687
|
incoming: inRx,
|
|
688
688
|
outgoing: outTx,
|
|
@@ -723,7 +723,7 @@ test.skip("When replaying creation and transactions of a coValue as new content,
|
|
|
723
723
|
const [inRx1, inTx1] = newStreamPair<SyncMessage>();
|
|
724
724
|
const [outRx1, outTx1] = newStreamPair<SyncMessage>();
|
|
725
725
|
|
|
726
|
-
node1.
|
|
726
|
+
node1.syncManager.addPeer({
|
|
727
727
|
id: "test2",
|
|
728
728
|
incoming: inRx1,
|
|
729
729
|
outgoing: outTx1,
|
|
@@ -738,7 +738,7 @@ test.skip("When replaying creation and transactions of a coValue as new content,
|
|
|
738
738
|
const [inRx2, inTx2] = newStreamPair<SyncMessage>();
|
|
739
739
|
const [outRx2, outTx2] = newStreamPair<SyncMessage>();
|
|
740
740
|
|
|
741
|
-
node2.
|
|
741
|
+
node2.syncManager.addPeer({
|
|
742
742
|
id: "test1",
|
|
743
743
|
incoming: inRx2,
|
|
744
744
|
outgoing: outTx2,
|
|
@@ -769,7 +769,7 @@ test.skip("When replaying creation and transactions of a coValue as new content,
|
|
|
769
769
|
expect(groupTellKnownStateMsg.value).toMatchObject(groupStateEx(group));
|
|
770
770
|
|
|
771
771
|
expect(
|
|
772
|
-
node2.
|
|
772
|
+
node2.syncManager.peers["test1"]!.optimisticKnownStates[
|
|
773
773
|
group.underlyingMap.core.id
|
|
774
774
|
]
|
|
775
775
|
).toBeDefined();
|
|
@@ -850,8 +850,8 @@ test.skip("When loading a coValue on one node, the server node it is requested f
|
|
|
850
850
|
|
|
851
851
|
const [node1asPeer, node2asPeer] = connectedPeers("peer1", "peer2");
|
|
852
852
|
|
|
853
|
-
node1.
|
|
854
|
-
node2.
|
|
853
|
+
node1.syncManager.addPeer(node2asPeer);
|
|
854
|
+
node2.syncManager.addPeer(node1asPeer);
|
|
855
855
|
|
|
856
856
|
await node2.loadCoValue(map.core.id);
|
|
857
857
|
|
|
@@ -883,8 +883,8 @@ test("Can sync a coValue through a server to another client", async () => {
|
|
|
883
883
|
peer2role: "client",
|
|
884
884
|
});
|
|
885
885
|
|
|
886
|
-
client1.
|
|
887
|
-
server.
|
|
886
|
+
client1.syncManager.addPeer(serverAsPeer);
|
|
887
|
+
server.syncManager.addPeer(client1AsPeer);
|
|
888
888
|
|
|
889
889
|
const client2 = new LocalNode(admin, newRandomSessionID(admin.id));
|
|
890
890
|
|
|
@@ -894,8 +894,8 @@ test("Can sync a coValue through a server to another client", async () => {
|
|
|
894
894
|
{ peer1role: "server", peer2role: "client" }
|
|
895
895
|
);
|
|
896
896
|
|
|
897
|
-
client2.
|
|
898
|
-
server.
|
|
897
|
+
client2.syncManager.addPeer(serverAsOtherPeer);
|
|
898
|
+
server.syncManager.addPeer(client2AsPeer);
|
|
899
899
|
|
|
900
900
|
const mapOnClient2 = await client2.loadCoValue(map.core.id);
|
|
901
901
|
|
|
@@ -926,8 +926,8 @@ test("Can sync a coValue with private transactions through a server to another c
|
|
|
926
926
|
peer2role: "client",
|
|
927
927
|
});
|
|
928
928
|
|
|
929
|
-
client1.
|
|
930
|
-
server.
|
|
929
|
+
client1.syncManager.addPeer(serverAsPeer);
|
|
930
|
+
server.syncManager.addPeer(client1AsPeer);
|
|
931
931
|
|
|
932
932
|
const client2 = new LocalNode(admin, newRandomSessionID(admin.id));
|
|
933
933
|
|
|
@@ -937,8 +937,8 @@ test("Can sync a coValue with private transactions through a server to another c
|
|
|
937
937
|
{ trace: true, peer1role: "server", peer2role: "client" }
|
|
938
938
|
);
|
|
939
939
|
|
|
940
|
-
client2.
|
|
941
|
-
server.
|
|
940
|
+
client2.syncManager.addPeer(serverAsOtherPeer);
|
|
941
|
+
server.syncManager.addPeer(client2AsPeer);
|
|
942
942
|
|
|
943
943
|
const mapOnClient2 = await client2.loadCoValue(map.core.id);
|
|
944
944
|
|
|
@@ -956,7 +956,7 @@ test("When a peer's incoming/readable stream closes, we remove the peer", async
|
|
|
956
956
|
const [inRx, inTx] = newStreamPair<SyncMessage>();
|
|
957
957
|
const [outRx, outTx] = newStreamPair<SyncMessage>();
|
|
958
958
|
|
|
959
|
-
node.
|
|
959
|
+
node.syncManager.addPeer({
|
|
960
960
|
id: "test",
|
|
961
961
|
incoming: inRx,
|
|
962
962
|
outgoing: outTx,
|
|
@@ -998,7 +998,7 @@ test("When a peer's incoming/readable stream closes, we remove the peer", async
|
|
|
998
998
|
|
|
999
999
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
1000
1000
|
|
|
1001
|
-
expect(node.
|
|
1001
|
+
expect(node.syncManager.peers["test"]).toBeUndefined();
|
|
1002
1002
|
});
|
|
1003
1003
|
|
|
1004
1004
|
test("When a peer's outgoing/writable stream closes, we remove the peer", async () => {
|
|
@@ -1010,7 +1010,7 @@ test("When a peer's outgoing/writable stream closes, we remove the peer", async
|
|
|
1010
1010
|
const [inRx, inTx] = newStreamPair<SyncMessage>();
|
|
1011
1011
|
const [outRx, outTx] = newStreamPair<SyncMessage>();
|
|
1012
1012
|
|
|
1013
|
-
node.
|
|
1013
|
+
node.syncManager.addPeer({
|
|
1014
1014
|
id: "test",
|
|
1015
1015
|
incoming: inRx,
|
|
1016
1016
|
outgoing: outTx,
|
|
@@ -1057,7 +1057,7 @@ test("When a peer's outgoing/writable stream closes, we remove the peer", async
|
|
|
1057
1057
|
|
|
1058
1058
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
1059
1059
|
|
|
1060
|
-
expect(node.
|
|
1060
|
+
expect(node.syncManager.peers["test"]).toBeUndefined();
|
|
1061
1061
|
});
|
|
1062
1062
|
|
|
1063
1063
|
test("If we start loading a coValue before connecting to a peer that has it, it will load it once we connect", async () => {
|
|
@@ -1080,13 +1080,13 @@ test("If we start loading a coValue before connecting to a peer that has it, it
|
|
|
1080
1080
|
trace: true,
|
|
1081
1081
|
});
|
|
1082
1082
|
|
|
1083
|
-
node1.
|
|
1083
|
+
node1.syncManager.addPeer(node2asPeer);
|
|
1084
1084
|
|
|
1085
1085
|
const mapOnNode2Promise = node2.loadCoValue(map.core.id);
|
|
1086
1086
|
|
|
1087
1087
|
expect(node2.coValues[map.core.id]?.state).toEqual("loading");
|
|
1088
1088
|
|
|
1089
|
-
node2.
|
|
1089
|
+
node2.syncManager.addPeer(node1asPeer);
|
|
1090
1090
|
|
|
1091
1091
|
const mapOnNode2 = await mapOnNode2Promise;
|
|
1092
1092
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { AgentSecret, createdNowUnique, getAgentID, newRandomAgentSecret } from "
|
|
2
|
-
import { newRandomSessionID } from "
|
|
3
|
-
import { LocalNode } from "
|
|
4
|
-
import { expectGroupContent } from "
|
|
5
|
-
import { AnonymousControlledAccount } from "
|
|
6
|
-
import { SessionID } from "
|
|
1
|
+
import { AgentSecret, createdNowUnique, getAgentID, newRandomAgentSecret } from "../crypto.js";
|
|
2
|
+
import { newRandomSessionID } from "../coValueCore.js";
|
|
3
|
+
import { LocalNode } from "../localNode.js";
|
|
4
|
+
import { expectGroupContent } from "../group.js";
|
|
5
|
+
import { AnonymousControlledAccount } from "../account.js";
|
|
6
|
+
import { SessionID } from "../ids.js";
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
import { expect } from "bun:test";
|
|
7
9
|
|
|
8
10
|
export function randomAnonymousAccountAndSessionID(): [AnonymousControlledAccount, SessionID] {
|
|
9
11
|
const agentSecret = newRandomAgentSecret();
|
|
@@ -27,7 +29,7 @@ export function newGroup() {
|
|
|
27
29
|
|
|
28
30
|
const groupContent = expectGroupContent(group.getCurrentContent());
|
|
29
31
|
|
|
30
|
-
groupContent.
|
|
32
|
+
groupContent.mutate((editable) => {
|
|
31
33
|
editable.set(admin.id, "admin", "trusting");
|
|
32
34
|
expect(editable.get(admin.id)).toEqual("admin");
|
|
33
35
|
});
|
|
@@ -42,7 +44,7 @@ export function groupWithTwoAdmins() {
|
|
|
42
44
|
|
|
43
45
|
let content = expectGroupContent(group.getCurrentContent());
|
|
44
46
|
|
|
45
|
-
content.
|
|
47
|
+
content.mutate((editable) => {
|
|
46
48
|
editable.set(otherAdmin.id, "admin", "trusting");
|
|
47
49
|
expect(editable.get(otherAdmin.id)).toEqual("admin");
|
|
48
50
|
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { JsonObject } from '../jsonValue.js';
|
|
2
|
-
import { CoID, ReadableCoValue } from '../coValue.js';
|
|
3
|
-
import { CoValueCore } from '../coValueCore.js';
|
|
4
|
-
import { Group } from '../index.js';
|
|
5
|
-
export declare class Static<T extends JsonObject> implements ReadableCoValue {
|
|
6
|
-
id: CoID<Static<T>>;
|
|
7
|
-
type: "static";
|
|
8
|
-
core: CoValueCore;
|
|
9
|
-
constructor(core: CoValueCore);
|
|
10
|
-
get meta(): T;
|
|
11
|
-
get group(): Group;
|
|
12
|
-
toJSON(): JsonObject;
|
|
13
|
-
subscribe(_listener: (coMap: Static<T>) => void): () => void;
|
|
14
|
-
}
|
package/dist/coValues/static.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export class Static {
|
|
2
|
-
constructor(core) {
|
|
3
|
-
this.type = "static";
|
|
4
|
-
this.id = core.id;
|
|
5
|
-
this.core = core;
|
|
6
|
-
}
|
|
7
|
-
get meta() {
|
|
8
|
-
return this.core.header.meta;
|
|
9
|
-
}
|
|
10
|
-
get group() {
|
|
11
|
-
return this.core.getGroup();
|
|
12
|
-
}
|
|
13
|
-
toJSON() {
|
|
14
|
-
throw new Error("Method not implemented.");
|
|
15
|
-
}
|
|
16
|
-
subscribe(_listener) {
|
|
17
|
-
throw new Error("Method not implemented.");
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=static.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"static.js","sourceRoot":"","sources":["../../src/coValues/static.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,MAAM;IAKf,YAAY,IAAiB;QAH7B,SAAI,GAAG,QAAiB,CAAC;QAIrB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAqB,CAAC;Q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