jazz-tools 0.7.0-alpha.9 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.cjs +3 -10
- package/.prettierrc.js +9 -0
- package/.turbo/turbo-build.log +14 -15
- package/.turbo/turbo-lint.log +4 -0
- package/.turbo/turbo-test.log +140 -0
- package/CHANGELOG.md +331 -27
- package/LICENSE.txt +1 -1
- package/README.md +10 -2
- package/dist/coValues/account.js +86 -41
- package/dist/coValues/account.js.map +1 -1
- package/dist/coValues/coList.js +75 -48
- package/dist/coValues/coList.js.map +1 -1
- package/dist/coValues/coMap.js +167 -44
- package/dist/coValues/coMap.js.map +1 -1
- package/dist/coValues/coStream.js +192 -35
- package/dist/coValues/coStream.js.map +1 -1
- package/dist/coValues/deepLoading.js +60 -0
- package/dist/coValues/deepLoading.js.map +1 -0
- package/dist/coValues/extensions/imageDef.js +10 -7
- package/dist/coValues/extensions/imageDef.js.map +1 -1
- package/dist/coValues/group.js +73 -13
- package/dist/coValues/group.js.map +1 -1
- package/dist/coValues/interfaces.js +58 -35
- package/dist/coValues/interfaces.js.map +1 -1
- package/dist/implementation/devtoolsFormatters.js +114 -0
- package/dist/implementation/devtoolsFormatters.js.map +1 -0
- package/dist/implementation/refs.js +58 -18
- package/dist/implementation/refs.js.map +1 -1
- package/dist/implementation/schema.js +58 -0
- package/dist/implementation/schema.js.map +1 -0
- package/dist/implementation/subscriptionScope.js +19 -1
- package/dist/implementation/subscriptionScope.js.map +1 -1
- package/dist/implementation/symbols.js +5 -0
- package/dist/implementation/symbols.js.map +1 -0
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/dist/internal.js +5 -2
- package/dist/internal.js.map +1 -1
- package/dist/tests/coList.test.js +51 -48
- package/dist/tests/coList.test.js.map +1 -1
- package/dist/tests/coMap.test.js +131 -74
- package/dist/tests/coMap.test.js.map +1 -1
- package/dist/tests/coStream.test.js +56 -41
- package/dist/tests/coStream.test.js.map +1 -1
- package/dist/tests/deepLoading.test.js +188 -0
- package/dist/tests/deepLoading.test.js.map +1 -0
- package/dist/tests/groupsAndAccounts.test.js +83 -0
- package/dist/tests/groupsAndAccounts.test.js.map +1 -0
- package/package.json +17 -9
- package/src/coValues/account.ts +186 -128
- package/src/coValues/coList.ts +156 -107
- package/src/coValues/coMap.ts +272 -148
- package/src/coValues/coStream.ts +388 -87
- package/src/coValues/deepLoading.ts +229 -0
- package/src/coValues/extensions/imageDef.ts +17 -13
- package/src/coValues/group.ts +166 -59
- package/src/coValues/interfaces.ts +189 -160
- package/src/implementation/devtoolsFormatters.ts +110 -0
- package/src/implementation/inspect.ts +1 -1
- package/src/implementation/refs.ts +80 -28
- package/src/implementation/schema.ts +141 -0
- package/src/implementation/subscriptionScope.ts +48 -12
- package/src/implementation/symbols.ts +11 -0
- package/src/index.ts +19 -8
- package/src/internal.ts +7 -3
- package/src/tests/coList.test.ts +77 -62
- package/src/tests/coMap.test.ts +201 -114
- package/src/tests/coStream.test.ts +113 -84
- package/src/tests/deepLoading.test.ts +304 -0
- package/src/tests/groupsAndAccounts.test.ts +91 -0
- package/dist/implementation/encoding.js +0 -26
- package/dist/implementation/encoding.js.map +0 -1
- package/src/implementation/encoding.ts +0 -105
@@ -1,23 +1,20 @@
|
|
1
|
-
import { expect, describe, test
|
2
|
-
import { webcrypto } from "node:crypto";
|
1
|
+
import { expect, describe, test } from "vitest";
|
3
2
|
import { connectedPeers } from "cojson/src/streamUtils.js";
|
4
3
|
import { newRandomSessionID } from "cojson/src/coValueCore.js";
|
5
4
|
import { Effect, Queue } from "effect";
|
6
|
-
import { BinaryCoStream, Account,
|
7
|
-
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
9
|
-
globalThis.crypto = webcrypto;
|
10
|
-
}
|
11
|
-
beforeEach(async () => {
|
12
|
-
await jazzReady;
|
13
|
-
});
|
5
|
+
import { BinaryCoStream, Account, CoStream, co, WasmCrypto, isControlledAccount, } from "../index.js";
|
6
|
+
const Crypto = await WasmCrypto.create();
|
14
7
|
describe("Simple CoStream operations", async () => {
|
15
8
|
const me = await Account.create({
|
16
|
-
name: "Hermes Puggington",
|
9
|
+
creationProps: { name: "Hermes Puggington" },
|
10
|
+
crypto: Crypto,
|
17
11
|
});
|
18
|
-
|
12
|
+
if (!isControlledAccount(me)) {
|
13
|
+
throw "me is not a controlled account";
|
14
|
+
}
|
15
|
+
class TestStream extends CoStream.Of(co.string) {
|
19
16
|
}
|
20
|
-
const stream =
|
17
|
+
const stream = TestStream.create(["milk"], { owner: me });
|
21
18
|
test("Construction", () => {
|
22
19
|
expect(stream[me.id]?.value).toEqual("milk");
|
23
20
|
expect(stream.perSession[me.sessionID]?.value).toEqual("milk");
|
@@ -34,21 +31,22 @@ describe("Simple CoStream operations", async () => {
|
|
34
31
|
});
|
35
32
|
});
|
36
33
|
describe("CoStream resolution", async () => {
|
37
|
-
class TwiceNestedStream extends CoStream.Of(
|
34
|
+
class TwiceNestedStream extends CoStream.Of(co.string) {
|
38
35
|
fancyValueOf(account) {
|
39
36
|
return "Sir " + this[account]?.value;
|
40
37
|
}
|
41
38
|
}
|
42
|
-
class NestedStream extends CoStream.Of(
|
39
|
+
class NestedStream extends CoStream.Of(co.ref(TwiceNestedStream)) {
|
43
40
|
}
|
44
|
-
class TestStream extends CoStream.Of(
|
41
|
+
class TestStream extends CoStream.Of(co.ref(NestedStream)) {
|
45
42
|
}
|
46
43
|
const initNodeAndStream = async () => {
|
47
44
|
const me = await Account.create({
|
48
|
-
name: "Hermes Puggington",
|
45
|
+
creationProps: { name: "Hermes Puggington" },
|
46
|
+
crypto: Crypto,
|
49
47
|
});
|
50
|
-
const stream =
|
51
|
-
|
48
|
+
const stream = TestStream.create([
|
49
|
+
NestedStream.create([TwiceNestedStream.create(["milk"], { owner: me })], { owner: me }),
|
52
50
|
], { owner: me });
|
53
51
|
return { me, stream };
|
54
52
|
};
|
@@ -59,26 +57,29 @@ describe("CoStream resolution", async () => {
|
|
59
57
|
test("Loading and availability", async () => {
|
60
58
|
const { me, stream } = await initNodeAndStream();
|
61
59
|
const [initialAsPeer, secondPeer] = connectedPeers("initial", "second", { peer1role: "server", peer2role: "client" });
|
60
|
+
if (!isControlledAccount(me)) {
|
61
|
+
throw "me is not a controlled account";
|
62
|
+
}
|
62
63
|
me._raw.core.node.syncManager.addPeer(secondPeer);
|
63
64
|
const meOnSecondPeer = await Account.become({
|
64
65
|
accountID: me.id,
|
65
66
|
accountSecret: me._raw.agentSecret,
|
66
67
|
peersToLoadFrom: [initialAsPeer],
|
68
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
67
69
|
sessionID: newRandomSessionID(me.id),
|
70
|
+
crypto: Crypto,
|
68
71
|
});
|
69
|
-
const loadedStream = await TestStream.load(stream.id,
|
70
|
-
as: meOnSecondPeer,
|
71
|
-
});
|
72
|
+
const loadedStream = await TestStream.load(stream.id, meOnSecondPeer, []);
|
72
73
|
expect(loadedStream?.[me.id]?.value).toEqual(null);
|
73
74
|
expect(loadedStream?.[me.id]?.ref?.id).toEqual(stream[me.id]?.value?.id);
|
74
|
-
const loadedNestedStream = await NestedStream.load(stream[me.id].value.id,
|
75
|
+
const loadedNestedStream = await NestedStream.load(stream[me.id].value.id, meOnSecondPeer, []);
|
75
76
|
// expect(loadedStream?.[me.id]?.value).toEqual(loadedNestedStream);
|
76
77
|
expect(loadedStream?.[me.id]?.value?.id).toEqual(loadedNestedStream?.id);
|
77
78
|
expect(loadedStream?.[me.id]?.value?.[me.id]?.value).toEqual(null);
|
78
79
|
// expect(loadedStream?.[me.id]?.ref?.value).toEqual(loadedNestedStream);
|
79
80
|
expect(loadedStream?.[me.id]?.ref?.value?.id).toEqual(loadedNestedStream?.id);
|
80
81
|
expect(loadedStream?.[me.id]?.value?.[me.id]?.ref?.id).toEqual(stream[me.id]?.value?.[me.id]?.value?.id);
|
81
|
-
const loadedTwiceNestedStream = await TwiceNestedStream.load(stream[me.id].value[me.id].value.id,
|
82
|
+
const loadedTwiceNestedStream = await TwiceNestedStream.load(stream[me.id].value[me.id].value.id, meOnSecondPeer, []);
|
82
83
|
// expect(loadedStream?.[me.id]?.value?.[me.id]?.value).toEqual(
|
83
84
|
// loadedTwiceNestedStream
|
84
85
|
// );
|
@@ -87,7 +88,7 @@ describe("CoStream resolution", async () => {
|
|
87
88
|
// expect(loadedStream?.[me.id]?.ref?.value).toEqual(loadedNestedStream);
|
88
89
|
expect(loadedStream?.[me.id]?.ref?.value?.id).toEqual(loadedNestedStream?.id);
|
89
90
|
expect(loadedStream?.[me.id]?.value?.[me.id]?.ref?.value?.id).toEqual(loadedTwiceNestedStream?.id);
|
90
|
-
const otherNestedStream =
|
91
|
+
const otherNestedStream = NestedStream.create([TwiceNestedStream.create(["butter"], { owner: meOnSecondPeer })], { owner: meOnSecondPeer });
|
91
92
|
loadedStream?.push(otherNestedStream);
|
92
93
|
// expect(loadedStream?.[me.id]?.value).toEqual(otherNestedStream);
|
93
94
|
expect(loadedStream?.[me.id]?.value?.id).toEqual(otherNestedStream?.id);
|
@@ -99,21 +100,25 @@ describe("CoStream resolution", async () => {
|
|
99
100
|
const { me, stream } = await initNodeAndStream();
|
100
101
|
const [initialAsPeer, secondAsPeer] = connectedPeers("initial", "second", { peer1role: "server", peer2role: "client" });
|
101
102
|
me._raw.core.node.syncManager.addPeer(secondAsPeer);
|
103
|
+
if (!isControlledAccount(me)) {
|
104
|
+
throw "me is not a controlled account";
|
105
|
+
}
|
102
106
|
const meOnSecondPeer = await Account.become({
|
103
107
|
accountID: me.id,
|
104
108
|
accountSecret: me._raw.agentSecret,
|
105
109
|
peersToLoadFrom: [initialAsPeer],
|
110
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
106
111
|
sessionID: newRandomSessionID(me.id),
|
112
|
+
crypto: Crypto,
|
107
113
|
});
|
108
114
|
await Effect.runPromise(Effect.gen(function* ($) {
|
109
115
|
const queue = yield* $(Queue.unbounded());
|
110
|
-
TestStream.subscribe(stream.id,
|
116
|
+
TestStream.subscribe(stream.id, meOnSecondPeer, [], (subscribedStream) => {
|
111
117
|
console.log("subscribedStream[me.id]", subscribedStream[me.id]);
|
112
118
|
console.log("subscribedStream[me.id]?.value?.[me.id]?.value", subscribedStream[me.id]?.value?.[me.id]?.value);
|
113
119
|
console.log("subscribedStream[me.id]?.value?.[me.id]?.value?.[me.id]?.value", subscribedStream[me.id]?.value?.[me.id]?.value?.[me.id]?.value);
|
114
|
-
Effect.runPromise(Queue.offer(queue, subscribedStream));
|
120
|
+
void Effect.runPromise(Queue.offer(queue, subscribedStream));
|
115
121
|
});
|
116
|
-
const te = stream;
|
117
122
|
const update1 = yield* $(Queue.take(queue));
|
118
123
|
expect(update1[me.id]?.value).toEqual(null);
|
119
124
|
const update2 = yield* $(Queue.take(queue));
|
@@ -126,10 +131,10 @@ describe("CoStream resolution", async () => {
|
|
126
131
|
const update4 = yield* $(Queue.take(queue));
|
127
132
|
expect(update4[me.id]?.value?.[me.id]?.value?.[me.id]?.value).toBe("bread");
|
128
133
|
// When assigning a new nested stream, we get an update
|
129
|
-
const newTwiceNested =
|
134
|
+
const newTwiceNested = TwiceNestedStream.create(["butter"], {
|
130
135
|
owner: meOnSecondPeer,
|
131
136
|
});
|
132
|
-
const newNested =
|
137
|
+
const newNested = NestedStream.create([newTwiceNested], {
|
133
138
|
owner: meOnSecondPeer,
|
134
139
|
});
|
135
140
|
update4.push(newNested);
|
@@ -144,9 +149,10 @@ describe("CoStream resolution", async () => {
|
|
144
149
|
});
|
145
150
|
describe("Simple BinaryCoStream operations", async () => {
|
146
151
|
const me = await Account.create({
|
147
|
-
name: "Hermes Puggington",
|
152
|
+
creationProps: { name: "Hermes Puggington" },
|
153
|
+
crypto: Crypto,
|
148
154
|
});
|
149
|
-
const stream =
|
155
|
+
const stream = BinaryCoStream.create({ owner: me });
|
150
156
|
test("Construction", () => {
|
151
157
|
expect(stream.getChunks()).toBe(undefined);
|
152
158
|
});
|
@@ -167,9 +173,10 @@ describe("Simple BinaryCoStream operations", async () => {
|
|
167
173
|
describe("BinaryCoStream loading & Subscription", async () => {
|
168
174
|
const initNodeAndStream = async () => {
|
169
175
|
const me = await Account.create({
|
170
|
-
name: "Hermes Puggington",
|
176
|
+
creationProps: { name: "Hermes Puggington" },
|
177
|
+
crypto: Crypto,
|
171
178
|
});
|
172
|
-
const stream =
|
179
|
+
const stream = BinaryCoStream.create({ owner: me });
|
173
180
|
stream.start({ mimeType: "text/plain" });
|
174
181
|
stream.push(new Uint8Array([1, 2, 3]));
|
175
182
|
stream.push(new Uint8Array([4, 5, 6]));
|
@@ -177,7 +184,7 @@ describe("BinaryCoStream loading & Subscription", async () => {
|
|
177
184
|
return { me, stream };
|
178
185
|
};
|
179
186
|
test("Construction", async () => {
|
180
|
-
const {
|
187
|
+
const { stream } = await initNodeAndStream();
|
181
188
|
expect(stream.getChunks()).toEqual({
|
182
189
|
mimeType: "text/plain",
|
183
190
|
chunks: [new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6])],
|
@@ -187,16 +194,19 @@ describe("BinaryCoStream loading & Subscription", async () => {
|
|
187
194
|
test("Loading and availability", async () => {
|
188
195
|
const { me, stream } = await initNodeAndStream();
|
189
196
|
const [initialAsPeer, secondAsPeer] = connectedPeers("initial", "second", { peer1role: "server", peer2role: "client" });
|
197
|
+
if (!isControlledAccount(me)) {
|
198
|
+
throw "me is not a controlled account";
|
199
|
+
}
|
190
200
|
me._raw.core.node.syncManager.addPeer(secondAsPeer);
|
191
201
|
const meOnSecondPeer = await Account.become({
|
192
202
|
accountID: me.id,
|
193
203
|
accountSecret: me._raw.agentSecret,
|
194
204
|
peersToLoadFrom: [initialAsPeer],
|
205
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
195
206
|
sessionID: newRandomSessionID(me.id),
|
207
|
+
crypto: Crypto,
|
196
208
|
});
|
197
|
-
const loadedStream = await BinaryCoStream.load(stream.id,
|
198
|
-
as: meOnSecondPeer,
|
199
|
-
});
|
209
|
+
const loadedStream = await BinaryCoStream.load(stream.id, meOnSecondPeer, []);
|
200
210
|
expect(loadedStream?.getChunks()).toEqual({
|
201
211
|
mimeType: "text/plain",
|
202
212
|
chunks: [new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6])],
|
@@ -205,19 +215,24 @@ describe("BinaryCoStream loading & Subscription", async () => {
|
|
205
215
|
});
|
206
216
|
test("Subscription", async () => {
|
207
217
|
const { me } = await initNodeAndStream();
|
208
|
-
const stream =
|
218
|
+
const stream = BinaryCoStream.create({ owner: me });
|
209
219
|
const [initialAsPeer, secondAsPeer] = connectedPeers("initial", "second", { peer1role: "server", peer2role: "client" });
|
210
220
|
me._raw.core.node.syncManager.addPeer(secondAsPeer);
|
221
|
+
if (!isControlledAccount(me)) {
|
222
|
+
throw "me is not a controlled account";
|
223
|
+
}
|
211
224
|
const meOnSecondPeer = await Account.become({
|
212
225
|
accountID: me.id,
|
213
226
|
accountSecret: me._raw.agentSecret,
|
214
227
|
peersToLoadFrom: [initialAsPeer],
|
228
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
215
229
|
sessionID: newRandomSessionID(me.id),
|
230
|
+
crypto: Crypto,
|
216
231
|
});
|
217
232
|
await Effect.runPromise(Effect.gen(function* ($) {
|
218
233
|
const queue = yield* $(Queue.unbounded());
|
219
|
-
BinaryCoStream.subscribe(stream.id,
|
220
|
-
Effect.runPromise(Queue.offer(queue, subscribedStream));
|
234
|
+
BinaryCoStream.subscribe(stream.id, meOnSecondPeer, [], (subscribedStream) => {
|
235
|
+
void Effect.runPromise(Queue.offer(queue, subscribedStream));
|
221
236
|
});
|
222
237
|
const update1 = yield* $(Queue.take(queue));
|
223
238
|
expect(update1.getChunks()).toBe(undefined);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"coStream.test.js","sourceRoot":"","sources":["../../src/tests/coStream.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAE5D,OAAO,EAAE,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e, test, expectTypeOf } from "vitest";
|
3
|
+
import { connectedPeers } from "cojson/src/streamUtils.js";
|
4
|
+
import { Account, CoList, CoMap, CoStream, WasmCrypto, co, Profile, isControlledAccount, } from "../index.js";
|
5
|
+
import { newRandomSessionID } from "cojson/src/coValueCore.js";
|
6
|
+
class TestMap extends CoMap {
|
7
|
+
constructor() {
|
8
|
+
super(...arguments);
|
9
|
+
this.list = co.ref(TestList);
|
10
|
+
this.optionalRef = co.ref(InnermostMap, { optional: true });
|
11
|
+
}
|
12
|
+
}
|
13
|
+
class TestList extends CoList.Of(co.ref(() => InnerMap)) {
|
14
|
+
}
|
15
|
+
class InnerMap extends CoMap {
|
16
|
+
constructor() {
|
17
|
+
super(...arguments);
|
18
|
+
this.stream = co.ref(TestStream);
|
19
|
+
}
|
20
|
+
}
|
21
|
+
class TestStream extends CoStream.Of(co.ref(() => InnermostMap)) {
|
22
|
+
}
|
23
|
+
class InnermostMap extends CoMap {
|
24
|
+
constructor() {
|
25
|
+
super(...arguments);
|
26
|
+
this.value = co.string;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
describe("Deep loading with depth arg", async () => {
|
30
|
+
const me = await Account.create({
|
31
|
+
creationProps: { name: "Hermes Puggington" },
|
32
|
+
crypto: Crypto,
|
33
|
+
});
|
34
|
+
const [initialAsPeer, secondPeer] = connectedPeers("initial", "second", {
|
35
|
+
peer1role: "server",
|
36
|
+
peer2role: "client",
|
37
|
+
});
|
38
|
+
if (!isControlledAccount(me)) {
|
39
|
+
throw "me is not a controlled account";
|
40
|
+
}
|
41
|
+
me._raw.core.node.syncManager.addPeer(secondPeer);
|
42
|
+
const meOnSecondPeer = await Account.become({
|
43
|
+
accountID: me.id,
|
44
|
+
accountSecret: me._raw.agentSecret,
|
45
|
+
peersToLoadFrom: [initialAsPeer],
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
47
|
+
sessionID: newRandomSessionID(me.id),
|
48
|
+
crypto: Crypto,
|
49
|
+
});
|
50
|
+
test("loading a deeply nested object will wait until all required refs are loaded", async () => {
|
51
|
+
const map = TestMap.create({
|
52
|
+
list: TestList.create([
|
53
|
+
InnerMap.create({
|
54
|
+
stream: TestStream.create([
|
55
|
+
InnermostMap.create({ value: "hello" }, { owner: me }),
|
56
|
+
], { owner: me }),
|
57
|
+
}, { owner: me }),
|
58
|
+
], { owner: me }),
|
59
|
+
}, { owner: me });
|
60
|
+
const map1 = await TestMap.load(map.id, meOnSecondPeer, {});
|
61
|
+
expectTypeOf(map1).toEqualTypeOf();
|
62
|
+
if (map1 === undefined) {
|
63
|
+
throw new Error("map1 is undefined");
|
64
|
+
}
|
65
|
+
expect(map1.list).toBe(null);
|
66
|
+
const map2 = await TestMap.load(map.id, meOnSecondPeer, { list: [] });
|
67
|
+
expectTypeOf(map2).toEqualTypeOf();
|
68
|
+
if (map2 === undefined) {
|
69
|
+
throw new Error("map2 is undefined");
|
70
|
+
}
|
71
|
+
expect(map2.list).not.toBe(null);
|
72
|
+
expect(map2.list[0]).toBe(null);
|
73
|
+
const map3 = await TestMap.load(map.id, meOnSecondPeer, { list: [{}] });
|
74
|
+
expectTypeOf(map3).toEqualTypeOf();
|
75
|
+
if (map3 === undefined) {
|
76
|
+
throw new Error("map3 is undefined");
|
77
|
+
}
|
78
|
+
expect(map3.list[0]).not.toBe(null);
|
79
|
+
expect(map3.list[0]?.stream).toBe(null);
|
80
|
+
const map3a = await TestMap.load(map.id, meOnSecondPeer, {
|
81
|
+
optionalRef: {},
|
82
|
+
});
|
83
|
+
expectTypeOf(map3a).toEqualTypeOf();
|
84
|
+
const map4 = await TestMap.load(map.id, meOnSecondPeer, {
|
85
|
+
list: [{ stream: [] }],
|
86
|
+
});
|
87
|
+
expectTypeOf(map4).toEqualTypeOf();
|
88
|
+
if (map4 === undefined) {
|
89
|
+
throw new Error("map4 is undefined");
|
90
|
+
}
|
91
|
+
expect(map4.list[0]?.stream).not.toBe(null);
|
92
|
+
// TODO: we should expect null here, but apparently we don't even have the id/ref?
|
93
|
+
expect(map4.list[0]?.stream?.[me.id]?.value).not.toBeDefined();
|
94
|
+
expect(map4.list[0]?.stream?.byMe?.value).not.toBeDefined();
|
95
|
+
const map5 = await TestMap.load(map.id, meOnSecondPeer, {
|
96
|
+
list: [{ stream: [{}] }],
|
97
|
+
});
|
98
|
+
expectTypeOf(map5).toEqualTypeOf();
|
99
|
+
if (map5 === undefined) {
|
100
|
+
throw new Error("map5 is undefined");
|
101
|
+
}
|
102
|
+
expect(map5.list[0]?.stream?.[me.id]?.value).not.toBe(null);
|
103
|
+
expect(map5.list[0]?.stream?.byMe?.value).not.toBe(null);
|
104
|
+
});
|
105
|
+
});
|
106
|
+
class CustomProfile extends Profile {
|
107
|
+
constructor() {
|
108
|
+
super(...arguments);
|
109
|
+
this.stream = co.ref(TestStream);
|
110
|
+
}
|
111
|
+
}
|
112
|
+
class CustomAccount extends Account {
|
113
|
+
constructor() {
|
114
|
+
super(...arguments);
|
115
|
+
this.profile = co.ref(CustomProfile);
|
116
|
+
this.root = co.ref(TestMap);
|
117
|
+
}
|
118
|
+
async migrate(creationProps) {
|
119
|
+
if (creationProps) {
|
120
|
+
this.profile = CustomProfile.create({
|
121
|
+
name: creationProps.name,
|
122
|
+
stream: TestStream.create([], { owner: this }),
|
123
|
+
}, { owner: this });
|
124
|
+
this.root = TestMap.create({ list: TestList.create([], { owner: this }) }, { owner: this });
|
125
|
+
}
|
126
|
+
const thisLoaded = await this.ensureLoaded({
|
127
|
+
profile: { stream: [] },
|
128
|
+
root: { list: [] },
|
129
|
+
});
|
130
|
+
expectTypeOf(thisLoaded).toEqualTypeOf();
|
131
|
+
}
|
132
|
+
}
|
133
|
+
test("Deep loading within account", async () => {
|
134
|
+
const me = await CustomAccount.create({
|
135
|
+
creationProps: { name: "Hermes Puggington" },
|
136
|
+
crypto: Crypto,
|
137
|
+
});
|
138
|
+
const meLoaded = await me.ensureLoaded({
|
139
|
+
profile: { stream: [] },
|
140
|
+
root: { list: [] },
|
141
|
+
});
|
142
|
+
expectTypeOf(meLoaded).toEqualTypeOf();
|
143
|
+
if (meLoaded === undefined) {
|
144
|
+
throw new Error("meLoaded is undefined");
|
145
|
+
}
|
146
|
+
expect(meLoaded.profile.stream).not.toBe(null);
|
147
|
+
expect(meLoaded.root.list).not.toBe(null);
|
148
|
+
});
|
149
|
+
class RecordLike extends CoMap.Record(co.ref(TestMap)) {
|
150
|
+
}
|
151
|
+
test("Deep loading a record-like coMap", async () => {
|
152
|
+
const me = await Account.create({
|
153
|
+
creationProps: { name: "Hermes Puggington" },
|
154
|
+
crypto: Crypto,
|
155
|
+
});
|
156
|
+
const [initialAsPeer, secondPeer] = connectedPeers("initial", "second", {
|
157
|
+
peer1role: "server",
|
158
|
+
peer2role: "client",
|
159
|
+
});
|
160
|
+
if (!isControlledAccount(me)) {
|
161
|
+
throw "me is not a controlled account";
|
162
|
+
}
|
163
|
+
me._raw.core.node.syncManager.addPeer(secondPeer);
|
164
|
+
const meOnSecondPeer = await Account.become({
|
165
|
+
accountID: me.id,
|
166
|
+
accountSecret: me._raw.agentSecret,
|
167
|
+
peersToLoadFrom: [initialAsPeer],
|
168
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
169
|
+
sessionID: newRandomSessionID(me.id),
|
170
|
+
crypto: Crypto,
|
171
|
+
});
|
172
|
+
const record = RecordLike.create({
|
173
|
+
key1: TestMap.create({ list: TestList.create([], { owner: me }) }, { owner: me }),
|
174
|
+
key2: TestMap.create({ list: TestList.create([], { owner: me }) }, { owner: me }),
|
175
|
+
}, { owner: me });
|
176
|
+
const recordLoaded = await RecordLike.load(record.id, meOnSecondPeer, [
|
177
|
+
{ list: [{}] },
|
178
|
+
]);
|
179
|
+
expectTypeOf(recordLoaded).toEqualTypeOf();
|
180
|
+
if (recordLoaded === undefined) {
|
181
|
+
throw new Error("recordLoaded is undefined");
|
182
|
+
}
|
183
|
+
expect(recordLoaded.key1?.list).not.toBe(null);
|
184
|
+
expect(recordLoaded.key1?.list).not.toBe(undefined);
|
185
|
+
expect(recordLoaded.key2?.list).not.toBe(null);
|
186
|
+
expect(recordLoaded.key2?.list).not.toBe(undefined);
|
187
|
+
});
|
188
|
+
//# sourceMappingURL=deepLoading.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"deepLoading.test.js","sourceRoot":"","sources":["../../src/tests/deepLoading.test.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EACH,OAAO,EACP,MAAM,EACN,KAAK,EACL,QAAQ,EAER,UAAU,EACV,EAAE,EACF,OAAO,EACP,mBAAmB,GAEtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,OAAQ,SAAQ,KAAK;IAA3B;;QACI,SAAI,GAAG,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACxB,gBAAW,GAAG,EAAE,CAAC,GAAG,CAAC,YAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3D,CAAC;CAAA;AAED,MAAM,QAAS,SAAQ,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC;CAAG;AAE3D,MAAM,QAAS,SAAQ,KAAK;IAA5B;;QACI,WAAM,GAAG,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAChC,CAAC;CAAA;AAED,MAAM,UAAW,SAAQ,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC;CAAG;AAEnE,MAAM,YAAa,SAAQ,KAAK;I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AAO,CAAC,MAAM,CAChB,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,EAAE,EAC5C,EAAE,KAAK,EAAE,EAAE,EAAE,CAChB;KACJ,EACD,EAAE,KAAK,EAAE,EAAE,EAAE,CAChB,CAAC;IAEF,MAAM,YAAY,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,cAAc,EAAE;QAClE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE;KACjB,CAAC,CAAC;IACH,YAAY,CAAC,YAAY,CAAC,CAAC,aAAa,EAOrC,CAAC;IACJ,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IACjD,CAAC;IACD,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpD,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACxD,CAAC,CAAC,CAAC"}
|
@@ -0,0 +1,83 @@
|
|
1
|
+
import { expect, describe, test } from "vitest";
|
2
|
+
import { Account, CoMap, co, Group, WasmCrypto } from "../index.js";
|
3
|
+
const Crypto = await WasmCrypto.create();
|
4
|
+
describe("Custom accounts and groups", async () => {
|
5
|
+
var _a;
|
6
|
+
class CustomProfile extends CoMap {
|
7
|
+
constructor() {
|
8
|
+
super(...arguments);
|
9
|
+
this.name = co.string;
|
10
|
+
this.color = co.string;
|
11
|
+
}
|
12
|
+
}
|
13
|
+
class CustomAccount extends Account {
|
14
|
+
constructor() {
|
15
|
+
super(...arguments);
|
16
|
+
this.profile = co.ref(CustomProfile);
|
17
|
+
this.root = co.ref(CoMap);
|
18
|
+
}
|
19
|
+
migrate(creationProps) {
|
20
|
+
if (creationProps) {
|
21
|
+
const profileGroup = Group.create({ owner: this });
|
22
|
+
profileGroup.addMember("everyone", "reader");
|
23
|
+
this.profile = CustomProfile.create({ name: creationProps.name, color: "blue" }, { owner: this });
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
class CustomGroup extends Group {
|
28
|
+
constructor() {
|
29
|
+
super(...arguments);
|
30
|
+
this.profile = co.null;
|
31
|
+
this.root = co.null;
|
32
|
+
this[_a] = co.ref(CustomAccount);
|
33
|
+
}
|
34
|
+
get nMembers() {
|
35
|
+
return this.members.length;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
_a = co.members;
|
39
|
+
test("Custom account and group", async () => {
|
40
|
+
const me = await CustomAccount.create({
|
41
|
+
creationProps: { name: "Hermes Puggington" },
|
42
|
+
crypto: Crypto,
|
43
|
+
});
|
44
|
+
expect(me.profile).toBeDefined();
|
45
|
+
expect(me.profile?.name).toBe("Hermes Puggington");
|
46
|
+
expect(me.profile?.color).toBe("blue");
|
47
|
+
const group = new CustomGroup({ owner: me });
|
48
|
+
group.addMember("everyone", "reader");
|
49
|
+
expect(group.members).toMatchObject([
|
50
|
+
{ id: me.id, role: "admin" },
|
51
|
+
{ id: "everyone", role: "reader" },
|
52
|
+
]);
|
53
|
+
expect(group.nMembers).toBe(2);
|
54
|
+
await new Promise((resolve) => {
|
55
|
+
group.subscribe({}, (update) => {
|
56
|
+
const meAsMember = update.members.find((member) => {
|
57
|
+
return member.id === me.id && member.account?.profile;
|
58
|
+
});
|
59
|
+
if (meAsMember) {
|
60
|
+
expect(meAsMember.account?.profile?.name).toBe("Hermes Puggington");
|
61
|
+
expect(meAsMember.account?.profile?.color).toBe("blue");
|
62
|
+
resolve();
|
63
|
+
}
|
64
|
+
});
|
65
|
+
});
|
66
|
+
class MyMap extends CoMap {
|
67
|
+
constructor() {
|
68
|
+
super(...arguments);
|
69
|
+
this.name = co.string;
|
70
|
+
}
|
71
|
+
}
|
72
|
+
const map = MyMap.create({ name: "test" }, { owner: group });
|
73
|
+
const meAsCastMember = map._owner
|
74
|
+
.castAs(CustomGroup)
|
75
|
+
.members.find((member) => member.id === me.id);
|
76
|
+
expect(meAsCastMember?.account?.profile?.name).toBe("Hermes Puggington");
|
77
|
+
expect(meAsCastMember?.account?.profile?.color).toBe("blue");
|
78
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
79
|
+
expect(map._owner.nMembers).toBeUndefined();
|
80
|
+
expect(map._owner.castAs(CustomGroup).nMembers).toBe(2);
|
81
|
+
});
|
82
|
+
});
|
83
|
+
//# sourceMappingURL=groupsAndAccounts.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"groupsAndAccounts.test.js","sourceRoot":"","sources":["../../src/tests/groupsAndAccounts.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEpE,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC;AAEzC,QAAQ,CAAC,4BAA4B,EAAE,KAAK,IAAI,EAAE;;IAC9C,MAAM,aAAc,SAAQ,KAAK;QAAjC;;YACI,SAAI,GAAG,EAAE,CAAC,MAAM,CAAC;YACjB,UAAK,GAAG,EAAE,CAAC,MAAM,CAAC;QACtB,CAAC;KAAA;IAED,MAAM,aAAc,SAAQ,OAAO;QAAnC;;YACI,YAAO,GAAG,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,CA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AAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QAE7D,MAAM,cAAc,GAAG,GAAG,CAAC,MAAM;aAC5B,MAAM,CAAC,WAAW,CAAC;aACnB,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;QACnD,MAAM,CAAC,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI,CAC/C,mBAAmB,CACtB,CAAC;QACF,MAAM,CAAC,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE7D,8DAA8D;QAC9D,MAAM,CAAE,GAAG,CAAC,MAAc,CAAC,QAAQ,CAAC,CAAC,aAAa,EAAE,CAAC;QACrD,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
{
|
2
2
|
"name": "jazz-tools",
|
3
|
-
"module": "dist/index.js",
|
4
|
-
"main": "dist/index.js",
|
5
|
-
"types": "src/index.ts",
|
3
|
+
"module": "./dist/index.js",
|
4
|
+
"main": "./dist/index.js",
|
5
|
+
"types": "./src/index.ts",
|
6
6
|
"type": "module",
|
7
7
|
"license": "MIT",
|
8
|
-
"version": "0.7.
|
8
|
+
"version": "0.7.3",
|
9
9
|
"dependencies": {
|
10
|
-
"@effect/schema": "^0.
|
11
|
-
"effect": "^
|
12
|
-
"
|
10
|
+
"@effect/schema": "^0.66.16",
|
11
|
+
"effect": "^3.1.5",
|
12
|
+
"fast-check": "^3.17.2",
|
13
|
+
"cojson": "0.7.0",
|
14
|
+
"cojson-transport-nodejs-ws": "0.7.0"
|
13
15
|
},
|
14
16
|
"devDependencies": {
|
15
17
|
"typescript": "^5.3.3",
|
@@ -22,9 +24,15 @@
|
|
22
24
|
}
|
23
25
|
}
|
24
26
|
},
|
27
|
+
"lint-staged": {
|
28
|
+
"*.{ts,tsx}": "eslint --fix",
|
29
|
+
"*.{js,jsx,mdx,json}": "prettier --write"
|
30
|
+
},
|
25
31
|
"scripts": {
|
26
|
-
"test": "vitest",
|
27
|
-
"
|
32
|
+
"test": "vitest --run",
|
33
|
+
"test-watch": "vitest",
|
34
|
+
"lint": "eslint . --ext ts,tsx",
|
35
|
+
"format": "prettier --write './src/**/*.{ts,tsx}'",
|
28
36
|
"build": "npm run lint && rm -rf ./dist && tsc --sourceMap --outDir dist"
|
29
37
|
}
|
30
38
|
}
|