cojson-storage-indexeddb 0.5.0 → 0.6.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/CHANGELOG.md +11 -0
- package/dist/index.test.js +4 -4
- package/dist/index.test.js.map +1 -1
- package/package.json +2 -2
- package/src/index.test.ts +4 -4
package/CHANGELOG.md
CHANGED
package/dist/index.test.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { expect, test } from "vitest";
|
|
2
|
-
import {
|
|
2
|
+
import { ControlledAgent, LocalNode, cojsonInternals } from "cojson";
|
|
3
3
|
import { IDBStorage } from ".";
|
|
4
4
|
test.skip("Should be able to initialize and load from empty DB", async () => {
|
|
5
5
|
const agentSecret = cojsonInternals.newRandomAgentSecret();
|
|
6
|
-
const node = new LocalNode(new
|
|
6
|
+
const node = new LocalNode(new ControlledAgent(agentSecret), cojsonInternals.newRandomSessionID(cojsonInternals.getAgentID(agentSecret)));
|
|
7
7
|
node.syncManager.addPeer(await IDBStorage.asPeer({ trace: true }));
|
|
8
8
|
console.log("yay!");
|
|
9
9
|
const _group = node.createGroup();
|
|
@@ -12,7 +12,7 @@ test.skip("Should be able to initialize and load from empty DB", async () => {
|
|
|
12
12
|
});
|
|
13
13
|
test("Should be able to sync data to database and then load that from a new node", async () => {
|
|
14
14
|
const agentSecret = cojsonInternals.newRandomAgentSecret();
|
|
15
|
-
const node1 = new LocalNode(new
|
|
15
|
+
const node1 = new LocalNode(new ControlledAgent(agentSecret), cojsonInternals.newRandomSessionID(cojsonInternals.getAgentID(agentSecret)));
|
|
16
16
|
node1.syncManager.addPeer(await IDBStorage.asPeer({ trace: true, localNodeName: "node1" }));
|
|
17
17
|
console.log("yay!");
|
|
18
18
|
const group = node1.createGroup();
|
|
@@ -21,7 +21,7 @@ test("Should be able to sync data to database and then load that from a new node
|
|
|
21
21
|
m.set("hello", "world");
|
|
22
22
|
});
|
|
23
23
|
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
24
|
-
const node2 = new LocalNode(new
|
|
24
|
+
const node2 = new LocalNode(new ControlledAgent(agentSecret), cojsonInternals.newRandomSessionID(cojsonInternals.getAgentID(agentSecret)));
|
|
25
25
|
node2.syncManager.addPeer(await IDBStorage.asPeer({ trace: true, localNodeName: "node2" }));
|
|
26
26
|
const map2 = await node2.load(map.id);
|
|
27
27
|
if (map2 === "unavailable") {
|
package/dist/index.test.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC;AAE/B,IAAI,CAAC,IAAI,CAAC,qDAAqD,EAAE,KAAK,IAAI,EAAE;IACxE,MAAM,WAAW,GAAG,eAAe,CAAC,oBAAoB,EAAE,CAAC;IAE3D,MAAM,IAAI,GAAG,IAAI,SAAS,CACtB,IAAI,eAAe,CAAC,WAAW,CAAC,EAChC,eAAe,CAAC,kBAAkB,CAC9B,eAAe,CAAC,UAAU,CAAC,WAAW,CAAC,CAC1C,CACJ,CAAC;IAEF,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,UAAU,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAEnE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAEpB,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAElC,MAAM,IAAI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,CACrB,MAAM,UAAU,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,CACnE,CAAC;IAEF,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACtC,IAAI,IAAI,KAAK,aAAa,EAAE;QACxB,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;KACzC;IAED,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cojson-storage-indexeddb",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "src/index.ts",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"cojson": "^0.
|
|
8
|
+
"cojson": "^0.6.0",
|
|
9
9
|
"typescript": "^5.1.6"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
package/src/index.test.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { expect, test } from "vitest";
|
|
2
|
-
import {
|
|
2
|
+
import { ControlledAgent, LocalNode, cojsonInternals } from "cojson";
|
|
3
3
|
import { IDBStorage } from ".";
|
|
4
4
|
|
|
5
5
|
test.skip("Should be able to initialize and load from empty DB", async () => {
|
|
6
6
|
const agentSecret = cojsonInternals.newRandomAgentSecret();
|
|
7
7
|
|
|
8
8
|
const node = new LocalNode(
|
|
9
|
-
new
|
|
9
|
+
new ControlledAgent(agentSecret),
|
|
10
10
|
cojsonInternals.newRandomSessionID(
|
|
11
11
|
cojsonInternals.getAgentID(agentSecret)
|
|
12
12
|
)
|
|
@@ -27,7 +27,7 @@ test("Should be able to sync data to database and then load that from a new node
|
|
|
27
27
|
const agentSecret = cojsonInternals.newRandomAgentSecret();
|
|
28
28
|
|
|
29
29
|
const node1 = new LocalNode(
|
|
30
|
-
new
|
|
30
|
+
new ControlledAgent(agentSecret),
|
|
31
31
|
cojsonInternals.newRandomSessionID(
|
|
32
32
|
cojsonInternals.getAgentID(agentSecret)
|
|
33
33
|
)
|
|
@@ -50,7 +50,7 @@ test("Should be able to sync data to database and then load that from a new node
|
|
|
50
50
|
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
51
51
|
|
|
52
52
|
const node2 = new LocalNode(
|
|
53
|
-
new
|
|
53
|
+
new ControlledAgent(agentSecret),
|
|
54
54
|
cojsonInternals.newRandomSessionID(
|
|
55
55
|
cojsonInternals.getAgentID(agentSecret)
|
|
56
56
|
)
|