Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@automerge/automerge-repo

Package Overview
Dependencies
Maintainers
0
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@automerge/automerge-repo - npm Package Compare versions

Comparing version 2.0.0-alpha.5 to 2.0.0-alpha.6

10

dist/storage/StorageSubsystem.js

@@ -181,4 +181,10 @@ import * as A from "@automerge/automerge/slim/next";

const key = [documentId, "sync-state", storageId];
const loaded = await this.#storageAdapter.load(key);
return loaded ? A.decodeSyncState(loaded) : undefined;
try {
const loaded = await this.#storageAdapter.load(key);
return loaded ? A.decodeSyncState(loaded) : undefined;
}
catch (e) {
this.#log(`Error loading sync state for ${documentId} from ${storageId}`);
return undefined;
}
}

@@ -185,0 +191,0 @@ async saveSyncState(documentId, storageId, syncState) {

4

package.json
{
"name": "@automerge/automerge-repo",
"version": "2.0.0-alpha.5",
"version": "2.0.0-alpha.6",
"description": "A repository object to manage a collection of automerge documents",

@@ -63,3 +63,3 @@ "repository": "https://github.com/automerge/automerge-repo/tree/master/packages/automerge-repo",

},
"gitHead": "9f10cdceb172f92cdf2dc1be361a940dfd3c5858"
"gitHead": "87353a94d2e5d8facc1db359d9e6fa74e2ab8888"
}

@@ -235,4 +235,9 @@ import * as A from "@automerge/automerge/slim/next"

const key = [documentId, "sync-state", storageId]
const loaded = await this.#storageAdapter.load(key)
return loaded ? A.decodeSyncState(loaded) : undefined
try {
const loaded = await this.#storageAdapter.load(key)
return loaded ? A.decodeSyncState(loaded) : undefined
} catch (e) {
this.#log(`Error loading sync state for ${documentId} from ${storageId}`)
return undefined
}
}

@@ -239,0 +244,0 @@

@@ -214,2 +214,19 @@ import { NodeFSStorageAdapter } from "../../automerge-repo-storage-nodefs/src/index.js"

})
it("returns a undefined if loading an existing sync state fails", async () => {
const storage = new StorageSubsystem(adapter)
const { documentId } = parseAutomergeUrl(generateAutomergeUrl())
const bobStorageId = Uuid.v4() as StorageId
const syncStateKey = [documentId, "sync-state", bobStorageId]
// Save garbage data to simulate a corrupted sync state
await adapter.save(syncStateKey, Buffer.from("invalid data"))
const loadedSyncState = await storage.loadSyncState(
documentId,
bobStorageId
)
assert.strictEqual(loadedSyncState, undefined)
})
})

@@ -216,0 +233,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc