@le-space/orbitdb-storage-bridge 0.16.0 → 0.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.
@@ -350,8 +350,13 @@ export async function restoreFromBlocks(orbitdb, blocks, metadata, options = {})
350
350
  let joined = 0;
351
351
  for (const head of heads) {
352
352
  try {
353
+ // The log decodes its own entry: an encrypted database's entry is not
354
+ // the raw dag-cbor fields, and joining those throws (an `undefined`
355
+ // the IPLD data model refuses). The raw fields stay as the fallback for
356
+ // a log storage that does not have the block.
357
+ const entry = await database.log.get(head.hash).catch(() => undefined);
353
358
  const { v, id, key, sig, next, refs, clock, payload, identity } = head.value;
354
- if (await database.log.joinEntry({ hash: head.hash, v, id, key, sig, next, refs, clock, payload, identity })) {
359
+ if (await database.log.joinEntry(entry ?? { hash: head.hash, v, id, key, sig, next, refs, clock, payload, identity })) {
355
360
  joined++;
356
361
  }
357
362
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@le-space/orbitdb-storage-bridge",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "description": "Back up, restore and replicate OrbitDB databases through pluggable storage backends, with hash and identity preservation",
5
5
  "main": "lib/orbitdb-storacha-bridge.js",
6
6
  "svelte": "dist/components/",