jazz-tools 0.7.34 → 0.7.35-guest-auth.3
Sign up to get free protection for your applications and to get access to all the features.
- package/.turbo/turbo-build.log +2 -2
- package/.turbo/turbo-test.log +41 -39
- package/CHANGELOG.md +20 -0
- package/dist/coValues/account.js +20 -35
- package/dist/coValues/account.js.map +1 -1
- package/dist/coValues/coList.js +14 -19
- package/dist/coValues/coList.js.map +1 -1
- package/dist/coValues/coMap.js +28 -19
- package/dist/coValues/coMap.js.map +1 -1
- package/dist/coValues/coStream.js +14 -19
- package/dist/coValues/coStream.js.map +1 -1
- package/dist/coValues/extensions/imageDef.js +3 -8
- package/dist/coValues/extensions/imageDef.js.map +1 -1
- package/dist/coValues/group.js +20 -23
- package/dist/coValues/group.js.map +1 -1
- package/dist/coValues/interfaces.js.map +1 -1
- package/dist/implementation/createContext.js +120 -0
- package/dist/implementation/createContext.js.map +1 -0
- package/dist/implementation/refs.js +11 -2
- package/dist/implementation/refs.js.map +1 -1
- package/dist/implementation/subscriptionScope.js +8 -5
- package/dist/implementation/subscriptionScope.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/internal.js +1 -0
- package/dist/internal.js.map +1 -1
- package/dist/tests/coList.test.js +23 -15
- package/dist/tests/coList.test.js.map +1 -1
- package/dist/tests/coMap.test.js +76 -102
- package/dist/tests/coMap.test.js.map +1 -1
- package/dist/tests/coStream.test.js +26 -22
- package/dist/tests/coStream.test.js.map +1 -1
- package/dist/tests/deepLoading.test.js +24 -36
- package/dist/tests/deepLoading.test.js.map +1 -1
- package/dist/tests/groupsAndAccounts.test.js +8 -22
- package/dist/tests/groupsAndAccounts.test.js.map +1 -1
- package/package.json +2 -2
- package/src/coValues/account.ts +5 -28
- package/src/coValues/coList.ts +4 -4
- package/src/coValues/coMap.ts +44 -6
- package/src/coValues/coStream.ts +4 -4
- package/src/coValues/group.ts +2 -2
- package/src/coValues/interfaces.ts +6 -6
- package/src/implementation/createContext.ts +229 -0
- package/src/implementation/refs.ts +12 -5
- package/src/index.ts +11 -1
- package/src/internal.ts +2 -0
- package/src/tests/coList.test.ts +30 -14
- package/src/tests/coMap.test.ts +113 -84
- package/src/tests/coStream.test.ts +27 -21
- package/src/tests/deepLoading.test.ts +18 -13
- package/tsconfig.json +1 -1
@@ -1,6 +1,5 @@
|
|
1
1
|
import { expect, describe, test } from "vitest";
|
2
2
|
import { connectedPeers } from "cojson/src/streamUtils.js";
|
3
|
-
import { newRandomSessionID } from "cojson/src/coValueCore.js";
|
4
3
|
import {
|
5
4
|
BinaryCoStream,
|
6
5
|
ID,
|
@@ -10,7 +9,10 @@ import {
|
|
10
9
|
WasmCrypto,
|
11
10
|
isControlledAccount,
|
12
11
|
cojsonInternals,
|
12
|
+
createJazzContext,
|
13
|
+
fixedCredentialsAuth,
|
13
14
|
} from "../index.js";
|
15
|
+
import { randomSessionProvider } from "../internal.js";
|
14
16
|
|
15
17
|
const Crypto = await WasmCrypto.create();
|
16
18
|
|
@@ -95,12 +97,13 @@ describe("CoStream resolution", async () => {
|
|
95
97
|
throw "me is not a controlled account";
|
96
98
|
}
|
97
99
|
me._raw.core.node.syncManager.addPeer(secondPeer);
|
98
|
-
const meOnSecondPeer = await
|
99
|
-
|
100
|
-
|
100
|
+
const { account: meOnSecondPeer } = await createJazzContext({
|
101
|
+
auth: fixedCredentialsAuth({
|
102
|
+
accountID: me.id,
|
103
|
+
secret: me._raw.agentSecret,
|
104
|
+
}),
|
105
|
+
sessionProvider: randomSessionProvider,
|
101
106
|
peersToLoadFrom: [initialAsPeer],
|
102
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
103
|
-
sessionID: newRandomSessionID(me.id as any),
|
104
107
|
crypto: Crypto,
|
105
108
|
});
|
106
109
|
|
@@ -191,12 +194,13 @@ describe("CoStream resolution", async () => {
|
|
191
194
|
if (!isControlledAccount(me)) {
|
192
195
|
throw "me is not a controlled account";
|
193
196
|
}
|
194
|
-
const meOnSecondPeer = await
|
195
|
-
|
196
|
-
|
197
|
+
const { account: meOnSecondPeer } = await createJazzContext({
|
198
|
+
auth: fixedCredentialsAuth({
|
199
|
+
accountID: me.id,
|
200
|
+
secret: me._raw.agentSecret,
|
201
|
+
}),
|
202
|
+
sessionProvider: randomSessionProvider,
|
197
203
|
peersToLoadFrom: [initialAsPeer],
|
198
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
199
|
-
sessionID: newRandomSessionID(me.id as any),
|
200
204
|
crypto: Crypto,
|
201
205
|
});
|
202
206
|
|
@@ -334,12 +338,13 @@ describe("BinaryCoStream loading & Subscription", async () => {
|
|
334
338
|
throw "me is not a controlled account";
|
335
339
|
}
|
336
340
|
me._raw.core.node.syncManager.addPeer(secondAsPeer);
|
337
|
-
const meOnSecondPeer = await
|
338
|
-
|
339
|
-
|
341
|
+
const { account: meOnSecondPeer } = await createJazzContext({
|
342
|
+
auth: fixedCredentialsAuth({
|
343
|
+
accountID: me.id,
|
344
|
+
secret: me._raw.agentSecret,
|
345
|
+
}),
|
346
|
+
sessionProvider: randomSessionProvider,
|
340
347
|
peersToLoadFrom: [initialAsPeer],
|
341
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
342
|
-
sessionID: newRandomSessionID(me.id as any),
|
343
348
|
crypto: Crypto,
|
344
349
|
});
|
345
350
|
|
@@ -369,12 +374,13 @@ describe("BinaryCoStream loading & Subscription", async () => {
|
|
369
374
|
if (!isControlledAccount(me)) {
|
370
375
|
throw "me is not a controlled account";
|
371
376
|
}
|
372
|
-
const meOnSecondPeer = await
|
373
|
-
|
374
|
-
|
377
|
+
const { account: meOnSecondPeer } = await createJazzContext({
|
378
|
+
auth: fixedCredentialsAuth({
|
379
|
+
accountID: me.id,
|
380
|
+
secret: me._raw.agentSecret,
|
381
|
+
}),
|
382
|
+
sessionProvider: randomSessionProvider,
|
375
383
|
peersToLoadFrom: [initialAsPeer],
|
376
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
377
|
-
sessionID: newRandomSessionID(me.id as any),
|
378
384
|
crypto: Crypto,
|
379
385
|
});
|
380
386
|
|
@@ -12,8 +12,10 @@ import {
|
|
12
12
|
Profile,
|
13
13
|
isControlledAccount,
|
14
14
|
ID,
|
15
|
+
createJazzContext,
|
16
|
+
fixedCredentialsAuth,
|
15
17
|
} from "../index.js";
|
16
|
-
import {
|
18
|
+
import { randomSessionProvider } from "../internal.js";
|
17
19
|
|
18
20
|
class TestMap extends CoMap {
|
19
21
|
list = co.ref(TestList);
|
@@ -47,12 +49,13 @@ describe("Deep loading with depth arg", async () => {
|
|
47
49
|
throw "me is not a controlled account";
|
48
50
|
}
|
49
51
|
me._raw.core.node.syncManager.addPeer(secondPeer);
|
50
|
-
const meOnSecondPeer = await
|
51
|
-
|
52
|
-
|
52
|
+
const { account: meOnSecondPeer } = await createJazzContext({
|
53
|
+
auth: fixedCredentialsAuth({
|
54
|
+
accountID: me.id,
|
55
|
+
secret: me._raw.agentSecret,
|
56
|
+
}),
|
57
|
+
sessionProvider: randomSessionProvider,
|
53
58
|
peersToLoadFrom: [initialAsPeer],
|
54
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
55
|
-
sessionID: newRandomSessionID(me.id as any),
|
56
59
|
crypto: Crypto,
|
57
60
|
});
|
58
61
|
|
@@ -138,8 +141,9 @@ describe("Deep loading with depth arg", async () => {
|
|
138
141
|
throw new Error("map4 is undefined");
|
139
142
|
}
|
140
143
|
expect(map4.list[0]?.stream).not.toBe(null);
|
141
|
-
|
142
|
-
expect(map4.list[0]?.stream?.
|
144
|
+
// TODO: why is this actually defined?
|
145
|
+
// expect(map4.list[0]?.stream?.[me.id]).toBe(undefined)
|
146
|
+
expect(map4.list[0]?.stream?.byMe?.value).toBe(null);
|
143
147
|
|
144
148
|
const map5 = await TestMap.load(map.id, meOnSecondPeer, {
|
145
149
|
list: [{ stream: [{}] }],
|
@@ -262,12 +266,13 @@ test("Deep loading a record-like coMap", async () => {
|
|
262
266
|
}
|
263
267
|
|
264
268
|
me._raw.core.node.syncManager.addPeer(secondPeer);
|
265
|
-
const meOnSecondPeer = await
|
266
|
-
|
267
|
-
|
269
|
+
const { account: meOnSecondPeer } = await createJazzContext({
|
270
|
+
auth: fixedCredentialsAuth({
|
271
|
+
accountID: me.id,
|
272
|
+
secret: me._raw.agentSecret,
|
273
|
+
}),
|
274
|
+
sessionProvider: randomSessionProvider,
|
268
275
|
peersToLoadFrom: [initialAsPeer],
|
269
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
270
|
-
sessionID: newRandomSessionID(me.id as any),
|
271
276
|
crypto: Crypto,
|
272
277
|
});
|
273
278
|
|