@cero-base/core 1.16.0 → 1.16.1

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": "1.16.0",
3
+ "version": "1.16.1",
4
4
  "description": "cero p2p primitives — identity, storage, network, database, blobs, rpc, pairing.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -840,11 +840,19 @@ export class Database extends ReadyResource {
840
840
  for (const op of ops) this.txQueue.push(op)
841
841
  return
842
842
  }
843
+ if (!this.bee) throw CeroError.CLOSED('Database')
843
844
  if (!this.bee.writable) throw CeroError.NOT_WRITABLE('Database')
844
845
  const encoded = ops.map(([op, payload]) =>
845
846
  this.spec.dispatch.encode(`@${this.ns}/${op}`, payload)
846
847
  )
847
- await this._dryRun(encoded)
848
+ try {
849
+ await this._dryRun(encoded)
850
+ } catch (err) {
851
+ if (!this.bee) throw CeroError.CLOSED('Database')
852
+ throw err
853
+ }
854
+ // the dry-run awaits — the bee can close underneath it
855
+ if (!this.bee) throw CeroError.CLOSED('Database')
848
856
  const wrapped = encoded.map((value) => wrap(this.version, value))
849
857
  await this.bee.append(wrapped.length === 1 ? wrapped[0] : wrapped)
850
858
  }