cojson-storage-indexeddb 0.8.35 → 0.8.37
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 +18 -0
- package/dist/idbClient.js +9 -6
- package/dist/idbClient.js.map +1 -1
- package/dist/idbNode.js +2 -2
- package/dist/idbNode.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/src/idbClient.ts +30 -43
- package/src/idbNode.ts +4 -4
- package/src/index.ts +1 -1
- package/dist/syncManager.js +0 -198
- package/dist/syncManager.js.map +0 -1
- package/dist/syncUtils.js +0 -95
- package/dist/syncUtils.js.map +0 -1
- package/dist/tests/fixtureMessages.js +0 -83
- package/dist/tests/fixtureMessages.js.map +0 -1
- package/dist/tests/getDependedOnCoValues.test.js +0 -149
- package/dist/tests/getDependedOnCoValues.test.js.map +0 -1
- package/dist/tests/syncManager.test.js +0 -251
- package/dist/tests/syncManager.test.js.map +0 -1
- package/src/syncManager.ts +0 -336
- package/src/syncUtils.ts +0 -146
- package/src/tests/fixtureMessages.ts +0 -95
- package/src/tests/getDependedOnCoValues.test.ts +0 -179
- package/src/tests/syncManager.test.ts +0 -337
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
export const fixtures = {
|
|
2
|
-
co_zKwG8NyfZ8GXqcjDHY4NS3SbU2m: {
|
|
3
|
-
getContent: ({ after = 0 }) => ({
|
|
4
|
-
action: "content",
|
|
5
|
-
id: "co_zKwG8NyfZ8GXqcjDHY4NS3SbU2m",
|
|
6
|
-
header: {
|
|
7
|
-
type: "comap",
|
|
8
|
-
ruleset: {
|
|
9
|
-
type: "group",
|
|
10
|
-
initialAdmin: "sealer_zRKetKBH6tdGP8poA2rV9JDejXqTyAmpusCT4jRcXa4m/signer_z6bcctDRiWxtgmuqLRR6rVhM54DA3xJ2pWCEs6DVf4PSy",
|
|
11
|
-
},
|
|
12
|
-
meta: {
|
|
13
|
-
type: "account",
|
|
14
|
-
},
|
|
15
|
-
createdAt: null,
|
|
16
|
-
uniqueness: null,
|
|
17
|
-
},
|
|
18
|
-
new: {
|
|
19
|
-
"sealer_zRKetKBH6tdGP8poA2rV9JDejXqTyAmpusCT4jRcXa4m/signer_z6bcctDRiWxtgmuqLRR6rVhM54DA3xJ2pWCEs6DVf4PSy_session_zbcBS6rHy8kA": {
|
|
20
|
-
after,
|
|
21
|
-
lastSignature: "signature_z2kcFHUPe1qGFYDY4ayvvFR2unFc4jeYph93nSCSjZYS14vnGN4uAw7pKZx1PEhwnspJcDizMRbLaFC8v13i6S79A",
|
|
22
|
-
newTransactions: [
|
|
23
|
-
{
|
|
24
|
-
privacy: "trusting",
|
|
25
|
-
madeAt: 1732368535089,
|
|
26
|
-
changes: '[{"key":"sealer_zRKetKBH6tdGP8poA2rV9JDejXqTyAmpusCT4jRcXa4m/signer_z6bcctDRiWxtgmuqLRR6rVhM54DA3xJ2pWCEs6DVf4PSy","op":"set","value":"admin"}]',
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
privacy: "trusting",
|
|
30
|
-
madeAt: 1732368535096,
|
|
31
|
-
changes: '[{"key":"key_z2YMuLXEfXG44Z2jGk_for_sealer_zRKetKBH6tdGP8poA2rV9JDejXqTyAmpusCT4jRcXa4m/signer_z6bcctDRiWxtgmuqLRR6rVhM54DA3xJ2pWCEs6DVf4PSy","op":"set","value":"sealed_UAIpJTby8EovZW6WPtAqdaczA2_r6PEWRBuEtLN93-Dh9xDJFaGUNTXK1Cck61tjvA3GoGn9EyQdNN2fU6tnmWP2M09a83dG41Q=="}]',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
privacy: "trusting",
|
|
35
|
-
madeAt: 1732368535099,
|
|
36
|
-
changes: '[{"key":"readKey","op":"set","value":"key_z2YMuLXEfXG44Z2jGk"}]',
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
},
|
|
40
|
-
"sealer_zRKetKBH6tdGP8poA2rV9JDejXqTyAmpusCT4jRcXa4m/signer_z6bcctDRiWxtgmuqLRR6rVhM54DA3xJ2pWCEs6DVf4PSy_session_zXgW54i2cCNA": {
|
|
41
|
-
after,
|
|
42
|
-
lastSignature: "signature_z5FsinkJCpqZfozVBkEMSchCQarsAjvMYpWN4d227PZtqCiM7KRBNukND3B25Q73idBLdY2MsghbmYFz5JHXk3d4D",
|
|
43
|
-
newTransactions: [
|
|
44
|
-
{
|
|
45
|
-
privacy: "trusting",
|
|
46
|
-
madeAt: 1732368535113,
|
|
47
|
-
changes: '[{"key":"profile","op":"set","value":"co_zMKhQJs5rAeGjta3JX2qEdBS6hS"}]',
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
priority: 0,
|
|
53
|
-
}),
|
|
54
|
-
known: {
|
|
55
|
-
action: "known",
|
|
56
|
-
id: "co_zKwG8NyfZ8GXqcjDHY4NS3SbU2m",
|
|
57
|
-
header: true,
|
|
58
|
-
sessions: {
|
|
59
|
-
"sealer_zRKetKBH6tdGP8poA2rV9JDejXqTyAmpusCT4jRcXa4m/signer_z6bcctDRiWxtgmuqLRR6rVhM54DA3xJ2pWCEs6DVf4PSy_session_zbcBS6rHy8kA": 3,
|
|
60
|
-
"sealer_zRKetKBH6tdGP8poA2rV9JDejXqTyAmpusCT4jRcXa4m/signer_z6bcctDRiWxtgmuqLRR6rVhM54DA3xJ2pWCEs6DVf4PSy_session_zXgW54i2cCNA": 1,
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
sessionRecords: [
|
|
64
|
-
{
|
|
65
|
-
bytesSinceLastSignature: 479,
|
|
66
|
-
coValue: 2,
|
|
67
|
-
lastIdx: 3,
|
|
68
|
-
lastSignature: "signature_z2kcFHUPe1qGFYDY4ayvvFR2unFc4jeYph93nSCSjZYS14vnGN4uAw7pKZx1PEhwnspJcDizMRbLaFC8v13i6S79A",
|
|
69
|
-
rowID: 2,
|
|
70
|
-
sessionID: "sealer_zRKetKBH6tdGP8poA2rV9JDejXqTyAmpusCT4jRcXa4m/signer_z6bcctDRiWxtgmuqLRR6rVhM54DA3xJ2pWCEs6DVf4PSy_session_zbcBS6rHy8kA",
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
bytesSinceLastSignature: 71,
|
|
74
|
-
coValue: 2,
|
|
75
|
-
lastIdx: 1,
|
|
76
|
-
lastSignature: "signature_z5FsinkJCpqZfozVBkEMSchCQarsAjvMYpWN4d227PZtqCiM7KRBNukND3B25Q73idBLdY2MsghbmYFz5JHXk3d4D",
|
|
77
|
-
rowID: 3,
|
|
78
|
-
sessionID: "sealer_zRKetKBH6tdGP8poA2rV9JDejXqTyAmpusCT4jRcXa4m/signer_z6bcctDRiWxtgmuqLRR6rVhM54DA3xJ2pWCEs6DVf4PSy_session_zXgW54i2cCNA",
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
//# sourceMappingURL=fixtureMessages.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fixtureMessages.js","sourceRoot":"","sources":["../../src/tests/fixtureMessages.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,8BAA8B,EAAE;QAC9B,UAAU,EAAE,CAAC,EAAE,KAAK,GAAG,CAAC,EAAsB,EAAE,EAAE,CAAC,CAAC;YAClD,MAAM,EAAE,SAAS;YACjB,EAAE,EAAE,gCAAgC;YACpC,MAAM,EAAE;gBACN,IAAI,EAAE,OAAO;gBACb,OAAO,EAAE;oBACP,IAAI,EAAE,OAAO;oBACb,YAAY,EACV,0GAA0G;iBAC7G;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,SAAS;iBAChB;gBACD,SAAS,EAAE,IAAI;gBACf,UAAU,EAAE,IAAI;aACjB;YACD,GAAG,EAAE;gBACH,+HAA+H,EAC7H;oBACE,KAAK;oBACL,aAAa,EACX,qGAAqG;oBACvG,eAAe,EAAE;wBACf;4BACE,OAAO,EAAE,UAAU;4BACnB,MAAM,EAAE,aAAa;4BACrB,OAAO,EACL,iJAAiJ;yBACpJ;wBACD;4BACE,OAAO,EAAE,UAAU;4BACnB,MAAM,EAAE,aAAa;4BACrB,OAAO,EACL,mRAAmR;yBACtR;wBACD;4BACE,OAAO,EAAE,UAAU;4BACnB,MAAM,EAAE,aAAa;4BACrB,OAAO,EACL,iEAAiE;yBACpE;qBACF;iBACF;gBACH,+HAA+H,EAC7H;oBACE,KAAK;oBACL,aAAa,EACX,qGAAqG;oBACvG,eAAe,EAAE;wBACf;4BACE,OAAO,EAAE,UAAU;4BACnB,MAAM,EAAE,aAAa;4BACrB,OAAO,EACL,yEAAyE;yBAC5E;qBACF;iBACF;aACJ;YACD,QAAQ,EAAE,CAAC;SACZ,CAAC;QACF,KAAK,EAAE;YACL,MAAM,EAAE,OAAO;YACf,EAAE,EAAE,gCAAgC;YACpC,MAAM,EAAE,IAAI;YACZ,QAAQ,EAAE;gBACR,+HAA+H,EAAE,CAAC;gBAClI,+HAA+H,EAAE,CAAC;aACnI;SACF;QACD,cAAc,EAAE;YACd;gBACE,uBAAuB,EAAE,GAAG;gBAC5B,OAAO,EAAE,CAAC;gBACV,OAAO,EAAE,CAAC;gBACV,aAAa,EACX,qGAAqG;gBACvG,KAAK,EAAE,CAAC;gBACR,SAAS,EACP,+HAA+H;aAClI;YACD;gBACE,uBAAuB,EAAE,EAAE;gBAC3B,OAAO,EAAE,CAAC;gBACV,OAAO,EAAE,CAAC;gBACV,aAAa,EACX,qGAAqG;gBACvG,KAAK,EAAE,CAAC;gBACR,SAAS,EACP,+HAA+H;aAClI;SACF;KACF;CACF,CAAC"}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { getDependedOnCoValues } from "../syncUtils";
|
|
3
|
-
function getMockedSessionID(accountId) {
|
|
4
|
-
return `${accountId ?? getMockedCoValueId()}_session_z${Math.random().toString(36).substring(2, 15)}`;
|
|
5
|
-
}
|
|
6
|
-
function getMockedCoValueId() {
|
|
7
|
-
return `co_z${Math.random().toString(36).substring(2, 15)}`;
|
|
8
|
-
}
|
|
9
|
-
function generateNewContentMessage(privacy, changes, accountId) {
|
|
10
|
-
return {
|
|
11
|
-
action: "content",
|
|
12
|
-
id: getMockedCoValueId(),
|
|
13
|
-
new: {
|
|
14
|
-
[getMockedSessionID(accountId)]: {
|
|
15
|
-
after: 0,
|
|
16
|
-
lastSignature: "signature_z123",
|
|
17
|
-
newTransactions: [
|
|
18
|
-
{
|
|
19
|
-
privacy,
|
|
20
|
-
madeAt: 0,
|
|
21
|
-
changes: JSON.stringify(changes),
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
priority: 0,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
describe("getDependedOnCoValues", () => {
|
|
30
|
-
it("should return dependencies for group ruleset", () => {
|
|
31
|
-
const coValueRow = {
|
|
32
|
-
id: "co_test",
|
|
33
|
-
header: {
|
|
34
|
-
ruleset: {
|
|
35
|
-
type: "group",
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
const result = getDependedOnCoValues({
|
|
40
|
-
coValueRow,
|
|
41
|
-
newContentMessages: [
|
|
42
|
-
generateNewContentMessage("trusting", [
|
|
43
|
-
{ op: "set", key: "co_zabc123", value: "test" },
|
|
44
|
-
{ op: "set", key: "parent_co_zdef456", value: "test" },
|
|
45
|
-
{ op: "set", key: "normal_key", value: "test" },
|
|
46
|
-
]),
|
|
47
|
-
],
|
|
48
|
-
});
|
|
49
|
-
expect(result).toEqual(["co_zabc123", "co_zdef456"]);
|
|
50
|
-
});
|
|
51
|
-
it("should not throw on malformed JSON", () => {
|
|
52
|
-
const coValueRow = {
|
|
53
|
-
id: "co_test",
|
|
54
|
-
header: {
|
|
55
|
-
ruleset: {
|
|
56
|
-
type: "group",
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
const message = generateNewContentMessage("trusting", [
|
|
61
|
-
{ op: "set", key: "co_zabc123", value: "test" },
|
|
62
|
-
]);
|
|
63
|
-
message.new["invalid_session"] = {
|
|
64
|
-
after: 0,
|
|
65
|
-
lastSignature: "signature_z123",
|
|
66
|
-
newTransactions: [
|
|
67
|
-
{
|
|
68
|
-
privacy: "trusting",
|
|
69
|
-
madeAt: 0,
|
|
70
|
-
changes: "}{-:)",
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
};
|
|
74
|
-
const result = getDependedOnCoValues({
|
|
75
|
-
coValueRow,
|
|
76
|
-
newContentMessages: [message],
|
|
77
|
-
});
|
|
78
|
-
expect(result).toEqual(["co_zabc123"]);
|
|
79
|
-
});
|
|
80
|
-
it("should return dependencies for ownedByGroup ruleset", () => {
|
|
81
|
-
const groupId = getMockedCoValueId();
|
|
82
|
-
const coValueRow = {
|
|
83
|
-
id: "co_owner",
|
|
84
|
-
header: {
|
|
85
|
-
ruleset: {
|
|
86
|
-
type: "ownedByGroup",
|
|
87
|
-
group: groupId,
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
};
|
|
91
|
-
const accountId = getMockedCoValueId();
|
|
92
|
-
const message = generateNewContentMessage("trusting", [
|
|
93
|
-
{ op: "set", key: "co_zabc123", value: "test" },
|
|
94
|
-
{ op: "set", key: "parent_co_zdef456", value: "test" },
|
|
95
|
-
{ op: "set", key: "normal_key", value: "test" },
|
|
96
|
-
], accountId);
|
|
97
|
-
message.new["invalid_session"] = {
|
|
98
|
-
after: 0,
|
|
99
|
-
lastSignature: "signature_z123",
|
|
100
|
-
newTransactions: [],
|
|
101
|
-
};
|
|
102
|
-
const result = getDependedOnCoValues({
|
|
103
|
-
coValueRow,
|
|
104
|
-
newContentMessages: [message],
|
|
105
|
-
});
|
|
106
|
-
expect(result).toEqual([groupId, accountId]);
|
|
107
|
-
});
|
|
108
|
-
it("should return empty array for other ruleset types", () => {
|
|
109
|
-
const coValueRow = {
|
|
110
|
-
id: "co_test",
|
|
111
|
-
header: {
|
|
112
|
-
ruleset: {
|
|
113
|
-
type: "other",
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
};
|
|
117
|
-
const result = getDependedOnCoValues({
|
|
118
|
-
coValueRow,
|
|
119
|
-
newContentMessages: [
|
|
120
|
-
generateNewContentMessage("trusting", [
|
|
121
|
-
{ op: "set", key: "co_zabc123", value: "test" },
|
|
122
|
-
{ op: "set", key: "parent_co_zdef456", value: "test" },
|
|
123
|
-
{ op: "set", key: "normal_key", value: "test" },
|
|
124
|
-
]),
|
|
125
|
-
],
|
|
126
|
-
});
|
|
127
|
-
expect(result).toEqual([]);
|
|
128
|
-
});
|
|
129
|
-
it("should ignore non-trusting transactions in group ruleset", () => {
|
|
130
|
-
const coValueRow = {
|
|
131
|
-
id: "co_test",
|
|
132
|
-
header: {
|
|
133
|
-
ruleset: {
|
|
134
|
-
type: "group",
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
};
|
|
138
|
-
const result = getDependedOnCoValues({
|
|
139
|
-
coValueRow,
|
|
140
|
-
newContentMessages: [
|
|
141
|
-
generateNewContentMessage("private", [
|
|
142
|
-
{ op: "set", key: "co_zabc123", value: "test" },
|
|
143
|
-
]),
|
|
144
|
-
],
|
|
145
|
-
});
|
|
146
|
-
expect(result).toEqual([]);
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
//# sourceMappingURL=getDependedOnCoValues.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getDependedOnCoValues.test.js","sourceRoot":"","sources":["../../src/tests/getDependedOnCoValues.test.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAM,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,SAAS,kBAAkB,CAAC,SAA2B;IACrD,OAA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E,EAAE,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE;iBAChD,CAAC;aACH;SACF,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;QAClE,MAAM,UAAU,GAAG;YACjB,EAAE,EAAE,SAAS;YACb,MAAM,EAAE;gBACN,OAAO,EAAE;oBACP,IAAI,EAAE,OAAO;iBACd;aACF;SACK,CAAC;QAET,MAAM,MAAM,GAAG,qBAAqB,CAAC;YACnC,UAAU;YACV,kBAAkB,EAAE;gBAClB,yBAAyB,CAAC,SAAS,EAAE;oBACnC,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE;iBAChD,CAAC;aACH;SACF,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, test, vi, } from "vitest";
|
|
2
|
-
import { SyncManager } from "../syncManager";
|
|
3
|
-
import { getDependedOnCoValues } from "../syncUtils";
|
|
4
|
-
import { fixtures } from "./fixtureMessages";
|
|
5
|
-
vi.mock("../syncUtils");
|
|
6
|
-
const coValueIdToLoad = "co_zKwG8NyfZ8GXqcjDHY4NS3SbU2m";
|
|
7
|
-
const createEmptyLoadMsg = (id) => ({
|
|
8
|
-
action: "load",
|
|
9
|
-
id,
|
|
10
|
-
header: false,
|
|
11
|
-
sessions: {},
|
|
12
|
-
});
|
|
13
|
-
const sessionsData = fixtures[coValueIdToLoad].sessionRecords;
|
|
14
|
-
const coValueHeader = fixtures[coValueIdToLoad].getContent({ after: 0 }).header;
|
|
15
|
-
const incomingContentMessage = fixtures[coValueIdToLoad].getContent({
|
|
16
|
-
after: 0,
|
|
17
|
-
});
|
|
18
|
-
describe("IDB sync manager", () => {
|
|
19
|
-
let syncManager;
|
|
20
|
-
let queue = {};
|
|
21
|
-
const IDBClient = vi.fn();
|
|
22
|
-
IDBClient.prototype.getCoValue = vi.fn();
|
|
23
|
-
IDBClient.prototype.getCoValueSessions = vi.fn();
|
|
24
|
-
IDBClient.prototype.addSessionUpdate = vi.fn();
|
|
25
|
-
IDBClient.prototype.addTransaction = vi.fn();
|
|
26
|
-
beforeEach(async () => {
|
|
27
|
-
const idbClient = new IDBClient();
|
|
28
|
-
syncManager = new SyncManager(idbClient, queue);
|
|
29
|
-
syncManager.sendStateMessage = vi.fn();
|
|
30
|
-
// No dependencies found
|
|
31
|
-
vi.mocked(getDependedOnCoValues).mockReturnValue([]);
|
|
32
|
-
});
|
|
33
|
-
afterEach(() => {
|
|
34
|
-
vi.clearAllMocks();
|
|
35
|
-
});
|
|
36
|
-
test("Incoming known messages are not processed", async () => {
|
|
37
|
-
await syncManager.handleSyncMessage({ action: "known" });
|
|
38
|
-
expect(syncManager.sendStateMessage).not.toBeCalled();
|
|
39
|
-
});
|
|
40
|
-
describe("Handle load incoming message", () => {
|
|
41
|
-
test("sends empty known message for unknown coValue", async () => {
|
|
42
|
-
const loadMsg = createEmptyLoadMsg(coValueIdToLoad);
|
|
43
|
-
IDBClient.prototype.getCoValue.mockResolvedValueOnce(undefined);
|
|
44
|
-
await syncManager.handleSyncMessage(loadMsg);
|
|
45
|
-
expect(syncManager.sendStateMessage).toBeCalledWith({
|
|
46
|
-
action: "known",
|
|
47
|
-
header: false,
|
|
48
|
-
id: coValueIdToLoad,
|
|
49
|
-
sessions: {},
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
test("Sends known and content message for known coValue with no sessions", async () => {
|
|
53
|
-
const loadMsg = createEmptyLoadMsg(coValueIdToLoad);
|
|
54
|
-
IDBClient.prototype.getCoValue.mockResolvedValueOnce({
|
|
55
|
-
id: coValueIdToLoad,
|
|
56
|
-
header: coValueHeader,
|
|
57
|
-
rowID: 3,
|
|
58
|
-
});
|
|
59
|
-
IDBClient.prototype.getCoValueSessions.mockResolvedValueOnce([]);
|
|
60
|
-
await syncManager.handleSyncMessage(loadMsg);
|
|
61
|
-
expect(syncManager.sendStateMessage).toBeCalledTimes(2);
|
|
62
|
-
expect(syncManager.sendStateMessage).toBeCalledWith({
|
|
63
|
-
action: "known",
|
|
64
|
-
header: true,
|
|
65
|
-
id: coValueIdToLoad,
|
|
66
|
-
sessions: {},
|
|
67
|
-
});
|
|
68
|
-
expect(syncManager.sendStateMessage).toBeCalledWith({
|
|
69
|
-
action: "content",
|
|
70
|
-
header: expect.objectContaining({
|
|
71
|
-
type: expect.any(String),
|
|
72
|
-
ruleset: expect.any(Object),
|
|
73
|
-
}),
|
|
74
|
-
id: coValueIdToLoad,
|
|
75
|
-
new: {},
|
|
76
|
-
priority: 0,
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
test("Sends both known and content messages when we have new sessions info for the requested coValue ", async () => {
|
|
80
|
-
const loadMsg = createEmptyLoadMsg(coValueIdToLoad);
|
|
81
|
-
IDBClient.prototype.getCoValue.mockResolvedValueOnce({
|
|
82
|
-
id: coValueIdToLoad,
|
|
83
|
-
header: coValueHeader,
|
|
84
|
-
rowID: 3,
|
|
85
|
-
});
|
|
86
|
-
IDBClient.prototype.getCoValueSessions.mockResolvedValueOnce(sessionsData);
|
|
87
|
-
const newTxData = {
|
|
88
|
-
newTransactions: [
|
|
89
|
-
{
|
|
90
|
-
privacy: "trusting",
|
|
91
|
-
madeAt: 1732368535089,
|
|
92
|
-
changes: "",
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
after: 0,
|
|
96
|
-
lastSignature: "signature_z111",
|
|
97
|
-
};
|
|
98
|
-
// mock content data combined with session updates
|
|
99
|
-
syncManager.handleSessionUpdate = vi.fn(async ({ sessionRow, newContentMessages }) => {
|
|
100
|
-
newContentMessages[0].new[sessionRow.sessionID] = newTxData;
|
|
101
|
-
});
|
|
102
|
-
await syncManager.handleSyncMessage(loadMsg);
|
|
103
|
-
expect(syncManager.sendStateMessage).toBeCalledTimes(2);
|
|
104
|
-
expect(syncManager.sendStateMessage).toHaveBeenNthCalledWith(1, {
|
|
105
|
-
action: "known",
|
|
106
|
-
header: true,
|
|
107
|
-
id: coValueIdToLoad,
|
|
108
|
-
sessions: sessionsData.reduce((acc, sessionRow) => ({
|
|
109
|
-
...acc,
|
|
110
|
-
[sessionRow.sessionID]: sessionRow.lastIdx,
|
|
111
|
-
}), {}),
|
|
112
|
-
});
|
|
113
|
-
expect(syncManager.sendStateMessage).toHaveBeenNthCalledWith(2, {
|
|
114
|
-
action: "content",
|
|
115
|
-
header: coValueHeader,
|
|
116
|
-
id: coValueIdToLoad,
|
|
117
|
-
new: sessionsData.reduce((acc, sessionRow) => ({
|
|
118
|
-
...acc,
|
|
119
|
-
[sessionRow.sessionID]: {
|
|
120
|
-
after: expect.any(Number),
|
|
121
|
-
lastSignature: expect.any(String),
|
|
122
|
-
newTransactions: expect.any(Array),
|
|
123
|
-
},
|
|
124
|
-
}), {}),
|
|
125
|
-
priority: 0,
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
test("Sends messages for unique coValue dependencies only, leaving out circular dependencies", async () => {
|
|
129
|
-
const loadMsg = createEmptyLoadMsg(coValueIdToLoad);
|
|
130
|
-
const dependency1 = "co_zMKhQJs5rAeGjta3JX2qEdBS6hS";
|
|
131
|
-
const dependency2 = "co_zP51HdyAVCuRY9ptq5iu8DhMyAb";
|
|
132
|
-
const dependency3 = "co_zGyBniuJmKkcirCKYrccWpjQEFY";
|
|
133
|
-
const dependenciesTreeWithLoop = {
|
|
134
|
-
[coValueIdToLoad]: [dependency1, dependency2],
|
|
135
|
-
[dependency1]: [],
|
|
136
|
-
[dependency2]: [coValueIdToLoad, dependency3],
|
|
137
|
-
[dependency3]: [dependency1],
|
|
138
|
-
};
|
|
139
|
-
IDBClient.prototype.getCoValue.mockImplementation((coValueId) => ({
|
|
140
|
-
id: coValueId,
|
|
141
|
-
header: coValueHeader,
|
|
142
|
-
rowID: 3,
|
|
143
|
-
}));
|
|
144
|
-
IDBClient.prototype.getCoValueSessions.mockResolvedValue([]);
|
|
145
|
-
// Fetch dependencies of the current dependency for the future recursion iterations
|
|
146
|
-
vi.mocked(getDependedOnCoValues).mockImplementation(({ coValueRow }) => dependenciesTreeWithLoop[coValueRow.id] || []);
|
|
147
|
-
await syncManager.handleSyncMessage(loadMsg);
|
|
148
|
-
// We send out pairs (known + content) messages only FOUR times - as many as the coValues number
|
|
149
|
-
// and less than amount of interconnected dependencies to loop through in dependenciesTreeWithLoop
|
|
150
|
-
expect(syncManager.sendStateMessage).toBeCalledTimes(4 * 2);
|
|
151
|
-
const knownExpected = {
|
|
152
|
-
action: "known",
|
|
153
|
-
header: true,
|
|
154
|
-
sessions: {},
|
|
155
|
-
};
|
|
156
|
-
const contentExpected = {
|
|
157
|
-
action: "content",
|
|
158
|
-
header: expect.any(Object),
|
|
159
|
-
new: {},
|
|
160
|
-
priority: 0,
|
|
161
|
-
};
|
|
162
|
-
expect(syncManager.sendStateMessage).toHaveBeenNthCalledWith(1, {
|
|
163
|
-
...knownExpected,
|
|
164
|
-
id: dependency3,
|
|
165
|
-
asDependencyOf: coValueIdToLoad,
|
|
166
|
-
});
|
|
167
|
-
expect(syncManager.sendStateMessage).toHaveBeenNthCalledWith(2, {
|
|
168
|
-
...contentExpected,
|
|
169
|
-
id: dependency3,
|
|
170
|
-
});
|
|
171
|
-
expect(syncManager.sendStateMessage).toHaveBeenNthCalledWith(3, {
|
|
172
|
-
...knownExpected,
|
|
173
|
-
id: dependency2,
|
|
174
|
-
asDependencyOf: coValueIdToLoad,
|
|
175
|
-
});
|
|
176
|
-
expect(syncManager.sendStateMessage).toHaveBeenNthCalledWith(4, {
|
|
177
|
-
...contentExpected,
|
|
178
|
-
id: dependency2,
|
|
179
|
-
});
|
|
180
|
-
expect(syncManager.sendStateMessage).toHaveBeenNthCalledWith(5, {
|
|
181
|
-
...knownExpected,
|
|
182
|
-
id: dependency1,
|
|
183
|
-
asDependencyOf: coValueIdToLoad,
|
|
184
|
-
});
|
|
185
|
-
expect(syncManager.sendStateMessage).toHaveBeenNthCalledWith(6, {
|
|
186
|
-
...contentExpected,
|
|
187
|
-
id: dependency1,
|
|
188
|
-
});
|
|
189
|
-
expect(syncManager.sendStateMessage).toHaveBeenNthCalledWith(7, {
|
|
190
|
-
...knownExpected,
|
|
191
|
-
id: coValueIdToLoad,
|
|
192
|
-
});
|
|
193
|
-
expect(syncManager.sendStateMessage).toHaveBeenNthCalledWith(8, {
|
|
194
|
-
...contentExpected,
|
|
195
|
-
id: coValueIdToLoad,
|
|
196
|
-
});
|
|
197
|
-
});
|
|
198
|
-
});
|
|
199
|
-
describe("Handle content incoming message", () => {
|
|
200
|
-
test("Sends correction message for unknown coValue", async () => {
|
|
201
|
-
IDBClient.prototype.getCoValue.mockResolvedValueOnce(undefined);
|
|
202
|
-
await syncManager.handleSyncMessage({
|
|
203
|
-
...incomingContentMessage,
|
|
204
|
-
header: undefined,
|
|
205
|
-
});
|
|
206
|
-
expect(syncManager.sendStateMessage).toBeCalledWith({
|
|
207
|
-
action: "known",
|
|
208
|
-
header: false,
|
|
209
|
-
id: coValueIdToLoad,
|
|
210
|
-
isCorrection: true,
|
|
211
|
-
sessions: {},
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
test("Saves new transaction without sending message when IDB has fewer transactions", async () => {
|
|
215
|
-
IDBClient.prototype.getCoValue.mockResolvedValueOnce({
|
|
216
|
-
id: coValueIdToLoad,
|
|
217
|
-
header: coValueHeader,
|
|
218
|
-
rowID: 3,
|
|
219
|
-
});
|
|
220
|
-
IDBClient.prototype.getCoValueSessions.mockResolvedValueOnce([]);
|
|
221
|
-
const msg = {
|
|
222
|
-
...incomingContentMessage,
|
|
223
|
-
header: undefined,
|
|
224
|
-
};
|
|
225
|
-
await syncManager.handleSyncMessage(msg);
|
|
226
|
-
const incomingTxCount = Object.keys(msg.new).reduce((acc, sessionID) => acc + msg.new[sessionID].newTransactions.length, 0);
|
|
227
|
-
expect(IDBClient.prototype.addTransaction).toBeCalledTimes(incomingTxCount);
|
|
228
|
-
expect(syncManager.sendStateMessage).not.toBeCalled();
|
|
229
|
-
});
|
|
230
|
-
test("Sends correction message when peer sends a message far ahead of our state due to invalid assumption", async () => {
|
|
231
|
-
IDBClient.prototype.getCoValue.mockResolvedValueOnce({
|
|
232
|
-
id: coValueIdToLoad,
|
|
233
|
-
header: coValueHeader,
|
|
234
|
-
rowID: 3,
|
|
235
|
-
});
|
|
236
|
-
IDBClient.prototype.getCoValueSessions.mockResolvedValueOnce(sessionsData);
|
|
237
|
-
const farAheadContentMessage = fixtures[coValueIdToLoad].getContent({
|
|
238
|
-
after: 10000,
|
|
239
|
-
});
|
|
240
|
-
await syncManager.handleSyncMessage(farAheadContentMessage);
|
|
241
|
-
expect(syncManager.sendStateMessage).toBeCalledWith({
|
|
242
|
-
action: "known",
|
|
243
|
-
header: true,
|
|
244
|
-
id: coValueIdToLoad,
|
|
245
|
-
isCorrection: true,
|
|
246
|
-
sessions: expect.any(Object),
|
|
247
|
-
});
|
|
248
|
-
});
|
|
249
|
-
});
|
|
250
|
-
});
|
|
251
|
-
//# sourceMappingURL=syncManager.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"syncManager.test.js","sourceRoot":"","sources":["../../src/tests/syncManager.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,EAAE,GACH,MAAM,QAAQ,CAAC;AAShB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAA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