@cero-base/core 2.1.5 → 2.1.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cero-base/core",
3
- "version": "2.1.5",
3
+ "version": "2.1.7",
4
4
  "description": "cero p2p primitives — identity, storage, network, database, blobs, rpc, pairing.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -139,32 +139,32 @@
139
139
  "test:node": "brittle-node $(find test -name '*.test.js' | sort)"
140
140
  },
141
141
  "dependencies": {
142
- "@hyperswarm/secret-stream": "^6.9.1",
143
- "autobee": "^2.7.0",
144
- "autobee-encryption": "0.1.3",
142
+ "@hyperswarm/secret-stream": "^6.9.2",
143
+ "autobee": "^2.7.2",
144
+ "autobee-encryption": "0.1.4",
145
145
  "b4a": "^1.8.1",
146
146
  "bare-crypto": "^1.15.3",
147
147
  "bare-fs": "^4.8.1",
148
148
  "bare-path": "^3.1.2",
149
149
  "bip39-mnemonic": "^2.5.0",
150
150
  "blind-pairing": "^2.3.1",
151
- "blind-peering": "^2.7.0",
151
+ "blind-peering": "^2.9.0",
152
152
  "compact-encoding": "^3.5.0",
153
- "corestore": "^7.12.3",
153
+ "corestore": "^7.12.5",
154
154
  "framed-stream": "^1.0.1",
155
155
  "hrpc": "^4.3.1",
156
156
  "hyperblobs": "^2.12.1",
157
- "hypercore": "^11.35.4",
157
+ "hypercore": "^11.36.1",
158
158
  "hypercore-blob-server": "^1.15.0",
159
159
  "hypercore-crypto": "^3.7.0",
160
160
  "hypercore-id-encoding": "^1.3.0",
161
161
  "hypercore-storage": "^3.2.1",
162
162
  "hyperdb": "^6.9.0",
163
163
  "hyperdispatch": "^1.6.0",
164
- "hyperschema": "^1.23.0",
165
- "hyperswarm": "^4.17.0",
164
+ "hyperschema": "^1.26.1",
165
+ "hyperswarm": "^4.17.1",
166
166
  "keet-identity-key": "^3.2.0",
167
- "protomux": "^3.11.0",
167
+ "protomux": "^3.12.0",
168
168
  "protomux-wakeup": "^2.9.0",
169
169
  "ready-resource": "^1.2.0",
170
170
  "safety-catch": "^1.0.3",
@@ -176,11 +176,11 @@
176
176
  "@hyperswarm/testnet": "^3.1.4",
177
177
  "bare-abort-controller": "^1.1.2",
178
178
  "bare-events": "^2.9.2",
179
- "bare-fetch": "^3.2.1",
179
+ "bare-fetch": "^3.3.0",
180
180
  "bare-process": "^4.5.1",
181
181
  "bare-url": "^2.5.4",
182
- "blind-peer": "^3.14.1",
183
- "brittle": "^4.1.1",
182
+ "blind-peer": "^3.15.0",
183
+ "brittle": "^4.2.0",
184
184
  "typescript": "^7.0.2",
185
185
  "which-runtime": "^1.4.0"
186
186
  },
@@ -352,16 +352,25 @@ export class Network extends ReadyResource {
352
352
  for (const stream of this.connections) replicateInto(core, stream)
353
353
  // mirror the core so it stays available while its writers are offline
354
354
  if (this._blindPeering) {
355
- if (Autobee.isAutobee(core)) {
356
- this._blindPeering.addAutobaseBackground(core)
357
- // the bootstrap core leaves the writer set after the local swap, but joiners boot from it
358
- const mirrorBootstrap = () =>
359
- this._blindPeering?.addCoreBackground(core.bootstrap, { referrer: core.key })
360
- core.ready().then(mirrorBootstrap, safetyCatch)
361
- } else this._blindPeering.addCoreBackground(core)
355
+ if (Autobee.isAutobee(core)) core.ready().then(() => this._mirror(core), safetyCatch)
356
+ else this._blindPeering.addCoreBackground(core)
362
357
  }
363
358
  }
364
359
 
360
+ _mirror(bee) {
361
+ const peering = this._blindPeering
362
+ if (!peering || bee.closing) return
363
+ peering.addAutobaseBackground(bee)
364
+ // the bootstrap core leaves the writer set after the local swap, but joiners boot from it
365
+ peering.addCoreBackground(bee.bootstrap, { referrer: bee.key })
366
+ // autobee links views only through a trusted head, which a fresh room's first nodes lack
367
+ const views = bee.views().map((v) => this.store.get({ key: v.key }))
368
+ for (const view of views) peering.addCoreBackground(view, { referrer: bee.key })
369
+ bee.once('close', () => {
370
+ for (const view of views) view.close().catch(safetyCatch)
371
+ })
372
+ }
373
+
365
374
  /**
366
375
  * Unregister a previously attached resource. New connections will no
367
376
  * longer replicate it (existing replication streams continue).
@@ -180,6 +180,7 @@ export declare class Network extends ReadyResource {
180
180
  * @returns {void}
181
181
  */
182
182
  attach(core: Replicable): void;
183
+ _mirror(bee: any): void;
183
184
  /**
184
185
  * Unregister a previously attached resource. New connections will no
185
186
  * longer replicate it (existing replication streams continue).