cojson 0.3.6 → 0.4.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/coValue.d.ts +7 -12
- package/dist/coValue.js.map +1 -1
- package/dist/coValueCore.d.ts +9 -4
- package/dist/coValueCore.js +69 -33
- package/dist/coValueCore.js.map +1 -1
- package/dist/coValues/account.d.ts +62 -0
- package/dist/{account.js → coValues/account.js} +19 -11
- package/dist/coValues/account.js.map +1 -0
- package/dist/coValues/coList.d.ts +19 -19
- package/dist/coValues/coList.js.map +1 -1
- package/dist/coValues/coMap.d.ts +31 -23
- package/dist/coValues/coMap.js +4 -6
- package/dist/coValues/coMap.js.map +1 -1
- package/dist/coValues/coStream.d.ts +19 -19
- package/dist/coValues/coStream.js.map +1 -1
- package/dist/{group.d.ts → coValues/group.d.ts} +27 -38
- package/dist/{group.js → coValues/group.js} +69 -73
- package/dist/coValues/group.js.map +1 -0
- package/dist/ids.d.ts +1 -1
- package/dist/index.d.ts +15 -11
- package/dist/index.js +10 -5
- package/dist/index.js.map +1 -1
- package/dist/localNode.d.ts +20 -7
- package/dist/localNode.js +74 -39
- package/dist/localNode.js.map +1 -1
- package/dist/media.d.ts +1 -1
- package/dist/permissions.d.ts +1 -1
- package/dist/permissions.js +43 -22
- package/dist/permissions.js.map +1 -1
- package/dist/queriedCoValues/queriedAccount.d.ts +13 -0
- package/dist/queriedCoValues/queriedAccount.js +24 -0
- package/dist/queriedCoValues/queriedAccount.js.map +1 -0
- package/dist/queriedCoValues/queriedCoList.d.ts +10 -10
- package/dist/queriedCoValues/queriedCoList.js +11 -15
- package/dist/queriedCoValues/queriedCoList.js.map +1 -1
- package/dist/queriedCoValues/queriedCoMap.d.ts +14 -21
- package/dist/queriedCoValues/queriedCoMap.js +27 -28
- package/dist/queriedCoValues/queriedCoMap.js.map +1 -1
- package/dist/queriedCoValues/queriedCoStream.d.ts +9 -9
- package/dist/queriedCoValues/queriedCoStream.js +44 -20
- package/dist/queriedCoValues/queriedCoStream.js.map +1 -1
- package/dist/queriedCoValues/queriedGroup.d.ts +29 -0
- package/dist/queriedCoValues/queriedGroup.js +54 -0
- package/dist/queriedCoValues/queriedGroup.js.map +1 -0
- package/dist/queries.d.ts +40 -9
- package/dist/queries.js +104 -39
- package/dist/queries.js.map +1 -1
- package/dist/sync.js +1 -0
- package/dist/sync.js.map +1 -1
- package/dist/tests/testUtils.d.ts +15 -7
- package/dist/tests/testUtils.js +16 -17
- package/dist/tests/testUtils.js.map +1 -1
- package/package.json +2 -2
- package/src/coValue.ts +12 -31
- package/src/coValueCore.ts +100 -40
- package/src/{account.ts → coValues/account.ts} +46 -27
- package/src/coValues/coList.ts +24 -28
- package/src/coValues/coMap.ts +42 -68
- package/src/coValues/coStream.ts +20 -26
- package/src/{group.ts → coValues/group.ts} +121 -141
- package/src/ids.ts +1 -1
- package/src/index.ts +25 -10
- package/src/localNode.ts +180 -77
- package/src/media.ts +1 -1
- package/src/permissions.ts +67 -36
- package/src/queriedCoValues/queriedAccount.ts +40 -0
- package/src/queriedCoValues/queriedCoList.ts +22 -30
- package/src/queriedCoValues/queriedCoMap.ts +60 -72
- package/src/queriedCoValues/queriedCoStream.ts +67 -37
- package/src/queriedCoValues/queriedGroup.ts +90 -0
- package/src/queries.ts +181 -60
- package/src/sync.ts +1 -0
- package/src/tests/account.test.ts +14 -9
- package/src/tests/coValueCore.test.ts +2 -2
- package/src/tests/permissions.test.ts +351 -242
- package/src/tests/queries.test.ts +98 -79
- package/src/tests/sync.test.ts +11 -11
- package/src/tests/testUtils.ts +16 -18
- package/dist/account.d.ts +0 -58
- package/dist/account.js.map +0 -1
- package/dist/group.js.map +0 -1
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
BinaryCoStream,
|
|
3
|
+
CoList,
|
|
4
|
+
CoMap,
|
|
5
|
+
CoStream,
|
|
6
|
+
Group,
|
|
7
|
+
LocalNode,
|
|
8
|
+
cojsonReady,
|
|
9
|
+
} from "..";
|
|
2
10
|
|
|
3
11
|
beforeEach(async () => {
|
|
4
12
|
await cojsonReady;
|
|
@@ -6,7 +14,7 @@ beforeEach(async () => {
|
|
|
6
14
|
|
|
7
15
|
test("Queries with maps work", async () => {
|
|
8
16
|
const { node, accountID } =
|
|
9
|
-
LocalNode.withNewlyCreatedAccount("Hermes Puggington");
|
|
17
|
+
LocalNode.withNewlyCreatedAccount({name: "Hermes Puggington"});
|
|
10
18
|
|
|
11
19
|
const group = node.createGroup();
|
|
12
20
|
|
|
@@ -16,7 +24,7 @@ test("Queries with maps work", async () => {
|
|
|
16
24
|
subMap: CoMap<{
|
|
17
25
|
hello: "world" | "moon" | "sun";
|
|
18
26
|
id: string;
|
|
19
|
-
}
|
|
27
|
+
}>["id"];
|
|
20
28
|
}>
|
|
21
29
|
>();
|
|
22
30
|
|
|
@@ -33,18 +41,20 @@ test("Queries with maps work", async () => {
|
|
|
33
41
|
expect(queriedMap.hello).toBe("world");
|
|
34
42
|
expect(Object.keys(queriedMap)).toEqual(["hello", "subMap"]);
|
|
35
43
|
if (queriedMap.edits.hello?.by?.profile?.name) {
|
|
36
|
-
expect(queriedMap.edits.hello).
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
expect(queriedMap.edits.hello.by.id).toEqual(accountID);
|
|
45
|
+
expect(queriedMap.edits.hello.by.profile.id).toEqual(
|
|
46
|
+
node.expectProfileLoaded(accountID).id
|
|
47
|
+
);
|
|
48
|
+
expect(queriedMap.edits.hello.by.profile.name).toEqual(
|
|
49
|
+
"Hermes Puggington"
|
|
50
|
+
);
|
|
51
|
+
expect(queriedMap.edits.hello.by.isMe).toBe(true);
|
|
52
|
+
expect(queriedMap.edits.hello.tx).toEqual(
|
|
53
|
+
map.lastEditAt("hello")!.tx
|
|
54
|
+
);
|
|
55
|
+
expect(queriedMap.edits.hello.at).toEqual(
|
|
56
|
+
new Date(map.lastEditAt("hello")!.at)
|
|
57
|
+
);
|
|
48
58
|
if (queriedMap.subMap) {
|
|
49
59
|
expect(queriedMap.subMap.type).toBe("comap");
|
|
50
60
|
expect(queriedMap.subMap.id).toEqual("foreignID");
|
|
@@ -79,7 +89,7 @@ test("Queries with maps work", async () => {
|
|
|
79
89
|
}>
|
|
80
90
|
>();
|
|
81
91
|
|
|
82
|
-
map = map.set("subMap", subMap);
|
|
92
|
+
map = map.set("subMap", subMap.id);
|
|
83
93
|
|
|
84
94
|
subMap = subMap.mutate((subMap) => {
|
|
85
95
|
subMap.set("hello", "world");
|
|
@@ -93,7 +103,7 @@ test("Queries with maps work", async () => {
|
|
|
93
103
|
|
|
94
104
|
test("Queries with lists work", () => {
|
|
95
105
|
const { node, accountID } =
|
|
96
|
-
LocalNode.withNewlyCreatedAccount("Hermes Puggington");
|
|
106
|
+
LocalNode.withNewlyCreatedAccount({name: "Hermes Puggington"});
|
|
97
107
|
|
|
98
108
|
const group = node.createGroup();
|
|
99
109
|
|
|
@@ -113,20 +123,17 @@ test("Queries with lists work", () => {
|
|
|
113
123
|
expect(queriedList[1]).toBe("world");
|
|
114
124
|
expect(queriedList[2]).toBe("moon");
|
|
115
125
|
if (queriedList.edits[2]?.by?.profile?.name) {
|
|
116
|
-
expect(queriedList.edits[2]).
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
at: expect.any(Date),
|
|
126
|
-
});
|
|
126
|
+
expect(queriedList.edits[2].by.id).toEqual(accountID);
|
|
127
|
+
expect(queriedList.edits[2].by.profile.id).toEqual(
|
|
128
|
+
node.expectProfileLoaded(accountID).id
|
|
129
|
+
);
|
|
130
|
+
expect(queriedList.edits[2].by.profile.name).toEqual(
|
|
131
|
+
"Hermes Puggington"
|
|
132
|
+
);
|
|
133
|
+
expect(queriedList.edits[2].by.isMe).toBe(true);
|
|
134
|
+
expect(queriedList.edits[2].at).toBeInstanceOf(Date);
|
|
127
135
|
if (queriedList.length === 3) {
|
|
128
136
|
queriedList.append("sun");
|
|
129
|
-
|
|
130
137
|
} else if (
|
|
131
138
|
queriedList.length === 4 &&
|
|
132
139
|
queriedList.edits[3]?.by?.profile?.name ===
|
|
@@ -152,11 +159,11 @@ test("Queries with lists work", () => {
|
|
|
152
159
|
});
|
|
153
160
|
|
|
154
161
|
test("List of nested maps works", () => {
|
|
155
|
-
const { node } = LocalNode.withNewlyCreatedAccount("Hermes Puggington");
|
|
162
|
+
const { node } = LocalNode.withNewlyCreatedAccount({name: "Hermes Puggington"});
|
|
156
163
|
|
|
157
164
|
const group = node.createGroup();
|
|
158
165
|
|
|
159
|
-
let list = group.createList<CoList<CoMap<{ hello: "world" }
|
|
166
|
+
let list = group.createList<CoList<CoMap<{ hello: "world" }>["id"]>>();
|
|
160
167
|
|
|
161
168
|
const done = new Promise<void>((resolve) => {
|
|
162
169
|
const unsubQuery = node.query(list.id, (queriedList) => {
|
|
@@ -176,23 +183,21 @@ test("List of nested maps works", () => {
|
|
|
176
183
|
list = list.append(
|
|
177
184
|
group.createMap<CoMap<{ hello: "world" }>>({
|
|
178
185
|
hello: "world",
|
|
179
|
-
})
|
|
186
|
+
}).id
|
|
180
187
|
);
|
|
181
188
|
|
|
182
189
|
return done;
|
|
183
190
|
});
|
|
184
191
|
|
|
185
192
|
test("Can call .map on a quieried coList", async () => {
|
|
186
|
-
const { node } = LocalNode.withNewlyCreatedAccount("Hermes Puggington");
|
|
193
|
+
const { node } = LocalNode.withNewlyCreatedAccount({name: "Hermes Puggington"});
|
|
187
194
|
|
|
188
195
|
const group = node.createGroup();
|
|
189
196
|
|
|
190
197
|
let list = group.createList<CoList<string>>();
|
|
191
198
|
|
|
192
199
|
const done = new Promise<void>((resolve) => {
|
|
193
|
-
|
|
194
200
|
const unsubQuery = node.query(list.id, (queriedList) => {
|
|
195
|
-
|
|
196
201
|
if (queriedList && queriedList[0]) {
|
|
197
202
|
// console.log("update", queriedList);
|
|
198
203
|
expect(queriedList.map((item) => item + "!!!")).toEqual([
|
|
@@ -216,7 +221,7 @@ test("Can call .map on a quieried coList", async () => {
|
|
|
216
221
|
|
|
217
222
|
test("Queries with streams work", () => {
|
|
218
223
|
const { node, accountID } =
|
|
219
|
-
LocalNode.withNewlyCreatedAccount("Hermes Puggington");
|
|
224
|
+
LocalNode.withNewlyCreatedAccount({name: "Hermes Puggington"});
|
|
220
225
|
|
|
221
226
|
const group = node.createGroup();
|
|
222
227
|
|
|
@@ -233,45 +238,58 @@ test("Queries with streams work", () => {
|
|
|
233
238
|
expect(queriedStream.group).toBeInstanceOf(Group);
|
|
234
239
|
expect(queriedStream.group.id).toBe(group.id);
|
|
235
240
|
expect(queriedStream.meta).toBe(null);
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
[
|
|
270
|
-
|
|
271
|
-
expect(queriedStream.perAccount).
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
241
|
+
|
|
242
|
+
expect(queriedStream.perSession[node.currentSessionID].last).toEqual(
|
|
243
|
+
"world"
|
|
244
|
+
);
|
|
245
|
+
expect(queriedStream.perSession[node.currentSessionID].all[0].value).toEqual("hello");
|
|
246
|
+
expect(queriedStream.perSession[node.currentSessionID].all[0].at).toEqual(new Date(
|
|
247
|
+
stream.items[
|
|
248
|
+
node.currentSessionID
|
|
249
|
+
][0].madeAt
|
|
250
|
+
));
|
|
251
|
+
expect(queriedStream.perSession[node.currentSessionID].all[1].value).toEqual("world");
|
|
252
|
+
expect(queriedStream.perSession[node.currentSessionID].all[1].at).toEqual(new Date(
|
|
253
|
+
stream.items[
|
|
254
|
+
node.currentSessionID
|
|
255
|
+
][1].madeAt
|
|
256
|
+
));
|
|
257
|
+
expect(queriedStream.perSession[node.currentSessionID].by?.id).toEqual(accountID);
|
|
258
|
+
expect(queriedStream.perSession[node.currentSessionID].by?.profile?.id).toEqual(
|
|
259
|
+
node.expectProfileLoaded(accountID).id
|
|
260
|
+
);
|
|
261
|
+
expect(queriedStream.perSession[node.currentSessionID].by?.profile?.name).toEqual(
|
|
262
|
+
"Hermes Puggington"
|
|
263
|
+
);
|
|
264
|
+
expect(queriedStream.perSession[node.currentSessionID].by?.isMe).toBe(true);
|
|
265
|
+
expect(queriedStream.perSession[node.currentSessionID].at).toBeInstanceOf(Date);
|
|
266
|
+
|
|
267
|
+
expect(queriedStream.perAccount[accountID].last).toEqual(
|
|
268
|
+
"world"
|
|
269
|
+
);
|
|
270
|
+
expect(queriedStream.perAccount[accountID].all[0].value).toEqual("hello");
|
|
271
|
+
expect(queriedStream.perAccount[accountID].all[0].at).toEqual(new Date(
|
|
272
|
+
stream.items[
|
|
273
|
+
node.currentSessionID
|
|
274
|
+
][0].madeAt
|
|
275
|
+
));
|
|
276
|
+
expect(queriedStream.perAccount[accountID].all[1].value).toEqual("world");
|
|
277
|
+
expect(queriedStream.perAccount[accountID].all[1].at).toEqual(new Date(
|
|
278
|
+
stream.items[
|
|
279
|
+
node.currentSessionID
|
|
280
|
+
][1].madeAt
|
|
281
|
+
));
|
|
282
|
+
expect(queriedStream.perAccount[accountID].by?.id).toEqual(accountID);
|
|
283
|
+
expect(queriedStream.perAccount[accountID].by?.profile?.id).toEqual(
|
|
284
|
+
node.expectProfileLoaded(accountID).id
|
|
285
|
+
);
|
|
286
|
+
expect(queriedStream.perAccount[accountID].by?.profile?.name).toEqual(
|
|
287
|
+
"Hermes Puggington"
|
|
288
|
+
);
|
|
289
|
+
expect(queriedStream.perAccount[accountID].by?.isMe).toBe(true);
|
|
290
|
+
expect(queriedStream.perAccount[accountID].at).toBeInstanceOf(Date);
|
|
291
|
+
|
|
292
|
+
expect(queriedStream.me).toEqual(queriedStream.perAccount[accountID]);
|
|
275
293
|
// console.log("final update", queriedStream);
|
|
276
294
|
resolve();
|
|
277
295
|
unsubQuery();
|
|
@@ -287,11 +305,12 @@ test("Queries with streams work", () => {
|
|
|
287
305
|
});
|
|
288
306
|
|
|
289
307
|
test("Streams of nested maps work", () => {
|
|
290
|
-
const { node } = LocalNode.withNewlyCreatedAccount("Hermes Puggington");
|
|
308
|
+
const { node } = LocalNode.withNewlyCreatedAccount({name:"Hermes Puggington"});
|
|
291
309
|
|
|
292
310
|
const group = node.createGroup();
|
|
293
311
|
|
|
294
|
-
let stream =
|
|
312
|
+
let stream =
|
|
313
|
+
group.createStream<CoStream<CoMap<{ hello: "world" }>["id"]>>();
|
|
295
314
|
|
|
296
315
|
const done = new Promise<void>((resolve) => {
|
|
297
316
|
const unsubQuery = node.query(stream.id, (queriedStream) => {
|
|
@@ -312,7 +331,7 @@ test("Streams of nested maps work", () => {
|
|
|
312
331
|
hello: "world",
|
|
313
332
|
});
|
|
314
333
|
|
|
315
|
-
stream = stream.push(map);
|
|
334
|
+
stream = stream.push(map.id);
|
|
316
335
|
|
|
317
336
|
return done;
|
|
318
|
-
});
|
|
337
|
+
});
|
package/src/tests/sync.test.ts
CHANGED
|
@@ -3,13 +3,13 @@ import { LocalNode } from "../localNode.js";
|
|
|
3
3
|
import { SyncMessage } from "../sync.js";
|
|
4
4
|
import { expectMap } from "../coValue.js";
|
|
5
5
|
import { MapOpPayload } from "../coValues/coMap.js";
|
|
6
|
-
import { Group } from "../group.js";
|
|
6
|
+
import { Group } from "../coValues/group.js";
|
|
7
7
|
import {
|
|
8
8
|
randomAnonymousAccountAndSessionID,
|
|
9
9
|
shouldNotResolve,
|
|
10
10
|
} from "./testUtils.js";
|
|
11
11
|
import { connectedPeers, newStreamPair } from "../streamUtils.js";
|
|
12
|
-
import { AccountID } from "../account.js";
|
|
12
|
+
import { AccountID } from "../coValues/account.js";
|
|
13
13
|
import { cojsonReady } from "../index.js";
|
|
14
14
|
import { stableStringify } from "../jsonStringify.js";
|
|
15
15
|
|
|
@@ -534,7 +534,7 @@ test("If we add a server peer, all updates to all coValues are sent to it, even
|
|
|
534
534
|
// });
|
|
535
535
|
expect((await reader.read()).value).toMatchObject({
|
|
536
536
|
action: "load",
|
|
537
|
-
id: group.
|
|
537
|
+
id: group.core.id,
|
|
538
538
|
});
|
|
539
539
|
|
|
540
540
|
const mapSubscribeMsg = await reader.read();
|
|
@@ -606,7 +606,7 @@ test("If we add a server peer, newly created coValues are auto-subscribed to", a
|
|
|
606
606
|
// });
|
|
607
607
|
expect((await reader.read()).value).toMatchObject({
|
|
608
608
|
action: "load",
|
|
609
|
-
id: group.
|
|
609
|
+
id: group.core.id,
|
|
610
610
|
});
|
|
611
611
|
|
|
612
612
|
const map = group.createMap();
|
|
@@ -660,7 +660,7 @@ test("When we connect a new server peer, we try to sync all existing coValues to
|
|
|
660
660
|
|
|
661
661
|
expect(groupSubscribeMessage.value).toEqual({
|
|
662
662
|
action: "load",
|
|
663
|
-
...group.
|
|
663
|
+
...group.core.knownState(),
|
|
664
664
|
} satisfies SyncMessage);
|
|
665
665
|
|
|
666
666
|
const secondMessage = await reader.read();
|
|
@@ -756,7 +756,7 @@ test.skip("When replaying creation and transactions of a coValue as new content,
|
|
|
756
756
|
const groupSubscribeMsg = await from1.read();
|
|
757
757
|
expect(groupSubscribeMsg.value).toMatchObject({
|
|
758
758
|
action: "load",
|
|
759
|
-
id: group.
|
|
759
|
+
id: group.core.id,
|
|
760
760
|
});
|
|
761
761
|
|
|
762
762
|
await to2.write(adminSubscribeMessage.value!);
|
|
@@ -770,7 +770,7 @@ test.skip("When replaying creation and transactions of a coValue as new content,
|
|
|
770
770
|
|
|
771
771
|
expect(
|
|
772
772
|
node2.syncManager.peers["test1"]!.optimisticKnownStates[
|
|
773
|
-
group.
|
|
773
|
+
group.core.id
|
|
774
774
|
]
|
|
775
775
|
).toBeDefined();
|
|
776
776
|
|
|
@@ -970,7 +970,7 @@ test("When a peer's incoming/readable stream closes, we remove the peer", async
|
|
|
970
970
|
// });
|
|
971
971
|
expect((await reader.read()).value).toMatchObject({
|
|
972
972
|
action: "load",
|
|
973
|
-
id: group.
|
|
973
|
+
id: group.core.id,
|
|
974
974
|
});
|
|
975
975
|
|
|
976
976
|
const map = group.createMap();
|
|
@@ -1024,7 +1024,7 @@ test("When a peer's outgoing/writable stream closes, we remove the peer", async
|
|
|
1024
1024
|
// });
|
|
1025
1025
|
expect((await reader.read()).value).toMatchObject({
|
|
1026
1026
|
action: "load",
|
|
1027
|
-
id: group.
|
|
1027
|
+
id: group.core.id,
|
|
1028
1028
|
});
|
|
1029
1029
|
|
|
1030
1030
|
const map = group.createMap();
|
|
@@ -1098,7 +1098,7 @@ test("If we start loading a coValue before connecting to a peer that has it, it
|
|
|
1098
1098
|
function groupContentEx(group: Group) {
|
|
1099
1099
|
return {
|
|
1100
1100
|
action: "content",
|
|
1101
|
-
id: group.
|
|
1101
|
+
id: group.core.id,
|
|
1102
1102
|
};
|
|
1103
1103
|
}
|
|
1104
1104
|
|
|
@@ -1112,7 +1112,7 @@ function admContEx(adminID: AccountID) {
|
|
|
1112
1112
|
function groupStateEx(group: Group) {
|
|
1113
1113
|
return {
|
|
1114
1114
|
action: "known",
|
|
1115
|
-
id: group.
|
|
1115
|
+
id: group.core.id,
|
|
1116
1116
|
};
|
|
1117
1117
|
}
|
|
1118
1118
|
|
package/src/tests/testUtils.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AgentSecret, createdNowUnique, getAgentID, newRandomAgentSecret } from "../crypto.js";
|
|
2
2
|
import { newRandomSessionID } from "../coValueCore.js";
|
|
3
3
|
import { LocalNode } from "../localNode.js";
|
|
4
|
-
import {
|
|
5
|
-
import { AnonymousControlledAccount } from "../account.js";
|
|
4
|
+
import { expectGroup } from "../coValues/group.js";
|
|
5
|
+
import { AnonymousControlledAccount } from "../coValues/account.js";
|
|
6
6
|
import { SessionID } from "../ids.js";
|
|
7
7
|
// @ts-ignore
|
|
8
8
|
import { expect } from "bun:test";
|
|
@@ -20,43 +20,41 @@ export function newGroup() {
|
|
|
20
20
|
|
|
21
21
|
const node = new LocalNode(admin, sessionID);
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const groupCore = node.createCoValue({
|
|
24
24
|
type: "comap",
|
|
25
25
|
ruleset: { type: "group", initialAdmin: admin.id },
|
|
26
26
|
meta: null,
|
|
27
27
|
...createdNowUnique(),
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
const
|
|
30
|
+
const group = expectGroup(groupCore.getCurrentContent());
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
group.mutate((editable) => {
|
|
33
33
|
editable.set(admin.id, "admin", "trusting");
|
|
34
34
|
expect(editable.get(admin.id)).toEqual("admin");
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
return { node,
|
|
37
|
+
return { node, groupCore, admin };
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export function groupWithTwoAdmins() {
|
|
41
|
-
const {
|
|
41
|
+
const { groupCore, admin, node } = newGroup();
|
|
42
42
|
|
|
43
43
|
const otherAdmin = node.createAccount("otherAdmin");
|
|
44
44
|
|
|
45
|
-
let
|
|
45
|
+
let group = expectGroup(groupCore.getCurrentContent());
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
expect(
|
|
47
|
+
group = group.mutate((mutable) => {
|
|
48
|
+
mutable.set(otherAdmin.id, "admin", "trusting");
|
|
49
|
+
expect(mutable.get(otherAdmin.id)).toEqual("admin");
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (content.type !== "comap") {
|
|
52
|
+
if (group.type !== "comap") {
|
|
55
53
|
throw new Error("Expected map");
|
|
56
54
|
}
|
|
57
55
|
|
|
58
|
-
expect(
|
|
59
|
-
return {
|
|
56
|
+
expect(group.get(otherAdmin.id)).toEqual("admin");
|
|
57
|
+
return { groupCore, admin, otherAdmin, node };
|
|
60
58
|
}
|
|
61
59
|
|
|
62
60
|
export function newGroupHighLevel() {
|
|
@@ -71,11 +69,11 @@ export function newGroupHighLevel() {
|
|
|
71
69
|
}
|
|
72
70
|
|
|
73
71
|
export function groupWithTwoAdminsHighLevel() {
|
|
74
|
-
|
|
72
|
+
let { admin, node, group } = newGroupHighLevel();
|
|
75
73
|
|
|
76
74
|
const otherAdmin = node.createAccount("otherAdmin");
|
|
77
75
|
|
|
78
|
-
group.addMember(otherAdmin.id, "admin");
|
|
76
|
+
group = group.addMember(otherAdmin.id, "admin");
|
|
79
77
|
|
|
80
78
|
return { admin, node, group, otherAdmin };
|
|
81
79
|
}
|
package/dist/account.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { CoValueHeader } from "./coValueCore.js";
|
|
2
|
-
import { CoID } from "./coValue.js";
|
|
3
|
-
import { AgentSecret, SealerID, SealerSecret, SignerID, SignerSecret } from "./crypto.js";
|
|
4
|
-
import { AgentID } from "./ids.js";
|
|
5
|
-
import { CoMap } from "./coValues/coMap.js";
|
|
6
|
-
import { LocalNode } from "./localNode.js";
|
|
7
|
-
import { Group, GroupContent } from "./group.js";
|
|
8
|
-
export declare function accountHeaderForInitialAgentSecret(agentSecret: AgentSecret): CoValueHeader;
|
|
9
|
-
export declare class AccountGroup extends Group {
|
|
10
|
-
get id(): AccountID;
|
|
11
|
-
getCurrentAgentID(): AgentID;
|
|
12
|
-
}
|
|
13
|
-
export interface GeneralizedControlledAccount {
|
|
14
|
-
id: AccountID | AgentID;
|
|
15
|
-
agentSecret: AgentSecret;
|
|
16
|
-
currentAgentID: () => AgentID;
|
|
17
|
-
currentSignerID: () => SignerID;
|
|
18
|
-
currentSignerSecret: () => SignerSecret;
|
|
19
|
-
currentSealerID: () => SealerID;
|
|
20
|
-
currentSealerSecret: () => SealerSecret;
|
|
21
|
-
}
|
|
22
|
-
/** @hidden */
|
|
23
|
-
export declare class ControlledAccount extends AccountGroup implements GeneralizedControlledAccount {
|
|
24
|
-
agentSecret: AgentSecret;
|
|
25
|
-
constructor(agentSecret: AgentSecret, groupMap: CoMap<AccountContent, AccountMeta>, node: LocalNode);
|
|
26
|
-
currentAgentID(): AgentID;
|
|
27
|
-
currentSignerID(): SignerID;
|
|
28
|
-
currentSignerSecret(): SignerSecret;
|
|
29
|
-
currentSealerID(): SealerID;
|
|
30
|
-
currentSealerSecret(): SealerSecret;
|
|
31
|
-
}
|
|
32
|
-
/** @hidden */
|
|
33
|
-
export declare class AnonymousControlledAccount implements GeneralizedControlledAccount {
|
|
34
|
-
agentSecret: AgentSecret;
|
|
35
|
-
constructor(agentSecret: AgentSecret);
|
|
36
|
-
get id(): AgentID;
|
|
37
|
-
currentAgentID(): AgentID;
|
|
38
|
-
currentSignerID(): SignerID;
|
|
39
|
-
currentSignerSecret(): SignerSecret;
|
|
40
|
-
currentSealerID(): SealerID;
|
|
41
|
-
currentSealerSecret(): SealerSecret;
|
|
42
|
-
}
|
|
43
|
-
export type AccountContent = {
|
|
44
|
-
profile: Profile;
|
|
45
|
-
} & GroupContent;
|
|
46
|
-
export type AccountMeta = {
|
|
47
|
-
type: "account";
|
|
48
|
-
};
|
|
49
|
-
export type Account = CoMap<AccountContent, AccountMeta>;
|
|
50
|
-
export type AccountID = CoID<Account>;
|
|
51
|
-
export declare function isAccountID(id: AccountID | AgentID): id is AccountID;
|
|
52
|
-
export type ProfileContent = {
|
|
53
|
-
name: string;
|
|
54
|
-
};
|
|
55
|
-
export type ProfileMeta = {
|
|
56
|
-
type: "profile";
|
|
57
|
-
};
|
|
58
|
-
export type Profile = CoMap<ProfileContent, ProfileMeta>;
|
package/dist/account.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"account.js","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"AAEA,OAAO,EAMH,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,GACvB,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAE,KAAK,EAAgB,MAAM,YAAY,CAAC;AAEjD,MAAM,UAAU,kCAAkC,CAC9C,WAAwB;IAExB,MAAM,KAAK,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACtC,OAAO;QACH,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE;QAC/C,IAAI,EAAE;YACF,IAAI,EAAE,SAAS;SAClB;QACD,SAAS,EAAE,IAAI;QACf,UAAU,EAAE,IAAI;KACnB,CAAC;AACN,CAAC;AAED,MAAM,OAAO,YAAa,SAAQ,KAAK;IACnC,IAAI,EAAE;QACF,OAAO,IAAI,CAAC,aAAa,CAAC,EAAe,CAAC;IAC9C,CAAC;IAED,iBAAiB;QACb,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa;aAC5B,IAAI,EAAE;aACN,MAAM,CAAC,CAAC,CAAC,EAAgB,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;QAE1D,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YACrB,MAAM,IAAI,KAAK,CACX,6CAA6C,GAAG,MAAM,CAAC,MAAM,CAChE,CAAC;SACL;QAED,OAAO,MAAM,CAAC,CAAC,CAAE,CAAC;IACtB,CAAC;CACJ;AAaD,cAAc;AACd,MAAM,OAAO,iBACT,SAAQ,YAAY;IAKpB,YACI,WAAwB,EACxB,QAA4C,EAC5C,IAAe;QAEf,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,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