cojson 0.8.19-group-inheritance.0 → 0.8.21
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/CHANGELOG.md +8 -2
- package/dist/native/PeerState.js +5 -0
- package/dist/native/PeerState.js.map +1 -1
- package/dist/native/coValueCore.js +3 -34
- package/dist/native/coValueCore.js.map +1 -1
- package/dist/native/coValues/group.js +3 -89
- package/dist/native/coValues/group.js.map +1 -1
- package/dist/native/permissions.js +145 -174
- package/dist/native/permissions.js.map +1 -1
- package/dist/native/storage/index.js +4 -8
- package/dist/native/storage/index.js.map +1 -1
- package/dist/native/sync.js +17 -11
- package/dist/native/sync.js.map +1 -1
- package/dist/web/PeerState.js +5 -0
- package/dist/web/PeerState.js.map +1 -1
- package/dist/web/coValueCore.js +3 -34
- package/dist/web/coValueCore.js.map +1 -1
- package/dist/web/coValues/group.js +3 -89
- package/dist/web/coValues/group.js.map +1 -1
- package/dist/web/permissions.js +145 -174
- package/dist/web/permissions.js.map +1 -1
- package/dist/web/storage/index.js +4 -8
- package/dist/web/storage/index.js.map +1 -1
- package/dist/web/sync.js +17 -11
- package/dist/web/sync.js.map +1 -1
- package/package.json +1 -1
- package/src/PeerKnownStates.ts +1 -1
- package/src/PeerState.ts +9 -1
- package/src/coValueCore.ts +4 -50
- package/src/coValues/group.ts +4 -159
- package/src/permissions.ts +203 -244
- package/src/storage/index.ts +4 -12
- package/src/sync.ts +20 -12
- package/src/tests/PeerState.test.ts +44 -1
- package/src/tests/permissions.test.ts +0 -748
- package/src/tests/sync.test.ts +17 -10
- package/.turbo/turbo-build.log +0 -12
- package/.turbo/turbo-lint.log +0 -4
- package/.turbo/turbo-test.log +0 -1001
package/src/tests/sync.test.ts
CHANGED
|
@@ -1590,32 +1590,39 @@ function createTwoConnectedNodes() {
|
|
|
1590
1590
|
|
|
1591
1591
|
describe("SyncManager - knownStates vs optimisticKnownStates", () => {
|
|
1592
1592
|
test("knownStates and optimisticKnownStates are the same when the coValue is fully synced", async () => {
|
|
1593
|
-
const { client } = createTwoConnectedNodes();
|
|
1593
|
+
const { client, jazzCloud } = createTwoConnectedNodes();
|
|
1594
1594
|
|
|
1595
1595
|
// Create test data
|
|
1596
1596
|
const group = client.createGroup();
|
|
1597
|
-
const
|
|
1598
|
-
|
|
1597
|
+
const mapOnClient = group.createMap();
|
|
1598
|
+
mapOnClient.set("key1", "value1", "trusting");
|
|
1599
1599
|
|
|
1600
|
-
await client.syncManager.actuallySyncCoValue(
|
|
1600
|
+
await client.syncManager.actuallySyncCoValue(mapOnClient.core);
|
|
1601
1601
|
|
|
1602
1602
|
// Wait for the full sync to complete
|
|
1603
1603
|
await waitFor(() => {
|
|
1604
1604
|
return client.syncManager.syncStateSubscriptionManager.getIsCoValueFullyUploadedIntoPeer(
|
|
1605
1605
|
"jazzCloudConnection",
|
|
1606
|
-
|
|
1606
|
+
mapOnClient.core.id,
|
|
1607
1607
|
);
|
|
1608
1608
|
});
|
|
1609
1609
|
|
|
1610
|
-
const
|
|
1610
|
+
const peerStateClient = client.syncManager.peers["jazzCloudConnection"]!;
|
|
1611
|
+
const peerStateJazzCloud =
|
|
1612
|
+
jazzCloud.syncManager.peers["connectionWithClient"]!;
|
|
1611
1613
|
|
|
1612
1614
|
// The optimisticKnownStates should be the same as the knownStates after the full sync is complete
|
|
1613
|
-
expect(
|
|
1614
|
-
|
|
1615
|
-
);
|
|
1615
|
+
expect(
|
|
1616
|
+
peerStateClient.optimisticKnownStates.get(mapOnClient.core.id),
|
|
1617
|
+
).toEqual(peerStateClient.knownStates.get(mapOnClient.core.id));
|
|
1618
|
+
|
|
1619
|
+
// On the other node the knownStates should be updated correctly based on the messages we received
|
|
1620
|
+
expect(
|
|
1621
|
+
peerStateJazzCloud.optimisticKnownStates.get(mapOnClient.core.id),
|
|
1622
|
+
).toEqual(peerStateJazzCloud.knownStates.get(mapOnClient.core.id));
|
|
1616
1623
|
});
|
|
1617
1624
|
|
|
1618
|
-
test("optimisticKnownStates is updated as new transactions are
|
|
1625
|
+
test("optimisticKnownStates is updated as new transactions are sent, while knownStates only when the updates are acknowledged", async () => {
|
|
1619
1626
|
const { client, jazzCloudConnectionAsPeer } = createTwoConnectedNodes();
|
|
1620
1627
|
|
|
1621
1628
|
// Create test data and sync the first change
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> cojson@0.8.18 build /Users/anselm/jazz/jazz/packages/cojson
|
|
3
|
-
> rm -rf ./dist && pnpm run build:native && pnpm run build:web
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
> cojson@0.8.18 build:native /Users/anselm/jazz/jazz/packages/cojson
|
|
7
|
-
> tsc --sourceMap --outDir dist/native -p tsconfig.native.json
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
> cojson@0.8.18 build:web /Users/anselm/jazz/jazz/packages/cojson
|
|
11
|
-
> tsc --sourceMap --outDir dist/web -p tsconfig.web.json
|
|
12
|
-
|
package/.turbo/turbo-lint.log
DELETED