corestore 7.12.2 → 7.12.4
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/index.js +6 -11
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -65,7 +65,8 @@ class SessionTracker {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
gc(id) {
|
|
68
|
-
this.map.
|
|
68
|
+
const existing = this.map.get(id)
|
|
69
|
+
if (existing && existing.length === 0) this.map.delete(id)
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
list(id) {
|
|
@@ -105,7 +106,7 @@ class CoreTracker {
|
|
|
105
106
|
store.watchIndex = -1
|
|
106
107
|
}
|
|
107
108
|
|
|
108
|
-
resume(id
|
|
109
|
+
resume(id) {
|
|
109
110
|
const core = this.map.get(id)
|
|
110
111
|
|
|
111
112
|
if (!core) return null
|
|
@@ -119,8 +120,6 @@ class CoreTracker {
|
|
|
119
120
|
core.gc = 0
|
|
120
121
|
}
|
|
121
122
|
|
|
122
|
-
if (group) resumeGroup(core, group).catch(noop)
|
|
123
|
-
|
|
124
123
|
return core
|
|
125
124
|
}
|
|
126
125
|
|
|
@@ -582,7 +581,8 @@ class Corestore extends ReadyResource {
|
|
|
582
581
|
wait: opts.wait !== false,
|
|
583
582
|
timeout: opts.timeout || 0,
|
|
584
583
|
draft: !!opts.draft,
|
|
585
|
-
writable: opts.writable === undefined && this.readOnly ? false : opts.writable
|
|
584
|
+
writable: opts.writable === undefined && this.readOnly ? false : opts.writable,
|
|
585
|
+
group: opts.group || null
|
|
586
586
|
}
|
|
587
587
|
|
|
588
588
|
// name requires us to rt to storage + ready, so needs preload
|
|
@@ -692,7 +692,7 @@ class Corestore extends ReadyResource {
|
|
|
692
692
|
const auth = this._auth(discoveryKey, opts)
|
|
693
693
|
|
|
694
694
|
const id = toHex(auth.discoveryKey)
|
|
695
|
-
const existing = this.cores.resume(id
|
|
695
|
+
const existing = this.cores.resume(id)
|
|
696
696
|
if (existing && !existing.closing) return existing
|
|
697
697
|
|
|
698
698
|
const core = Hypercore.createCore(this.storage, {
|
|
@@ -767,8 +767,3 @@ function noop() {}
|
|
|
767
767
|
function toHex(discoveryKey) {
|
|
768
768
|
return b4a.toString(discoveryKey, 'hex')
|
|
769
769
|
}
|
|
770
|
-
|
|
771
|
-
async function resumeGroup(core, group) {
|
|
772
|
-
await core.opening
|
|
773
|
-
if (!core.header.group) await core.setGroup(group)
|
|
774
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "corestore",
|
|
3
|
-
"version": "7.12.
|
|
3
|
+
"version": "7.12.4",
|
|
4
4
|
"description": "A Hypercore factory that simplifies managing collections of cores.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"b4a": "^1.6.7",
|
|
18
18
|
"bare-events": "^2.8.3",
|
|
19
|
-
"hypercore": "^11.
|
|
19
|
+
"hypercore": "^11.35.4",
|
|
20
20
|
"hypercore-crypto": "^3.4.2",
|
|
21
21
|
"hypercore-errors": "^1.4.0",
|
|
22
22
|
"hypercore-id-encoding": "^1.3.0",
|