Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@nostr-dev-kit/cache-sqlite

Package Overview
Dependencies
Maintainers
2
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nostr-dev-kit/cache-sqlite - npm Package Compare versions

Comparing version
5.0.0
to
6.0.0
+2
-0
dist/index.d.mts

@@ -64,2 +64,3 @@ import * as NDK from '@nostr-dev-kit/ndk';

setEvent: (event: NDKEvent, _filters: NDKFilter[], _relay?: NDKRelay | undefined) => Promise<void>;
setEventDup: (event: NDKEvent, relay: NDKRelay) => void;
getEvent: (id: string) => Promise<NDKEvent | null>;

@@ -72,2 +73,3 @@ fetchProfile: (pubkey: string) => Promise<NDK.NDKCacheEntry<NDKUserProfile> | null>;

getRelayStatus: (relayUrl: string) => NDKCacheRelayInfo | undefined;
private _setEventDup;
getDecryptedEvent: (eventId: NDKEventId) => NDKEvent | null;

@@ -74,0 +76,0 @@ addDecryptedEvent: (event: NDKEvent) => void;

@@ -64,2 +64,3 @@ import * as NDK from '@nostr-dev-kit/ndk';

setEvent: (event: NDKEvent, _filters: NDKFilter[], _relay?: NDKRelay | undefined) => Promise<void>;
setEventDup: (event: NDKEvent, relay: NDKRelay) => void;
getEvent: (id: string) => Promise<NDKEvent | null>;

@@ -72,2 +73,3 @@ fetchProfile: (pubkey: string) => Promise<NDK.NDKCacheEntry<NDKUserProfile> | null>;

getRelayStatus: (relayUrl: string) => NDKCacheRelayInfo | undefined;
private _setEventDup;
getDecryptedEvent: (eventId: NDKEventId) => NDKEvent | null;

@@ -74,0 +76,0 @@ addDecryptedEvent: (event: NDKEvent) => void;

@@ -607,2 +607,3 @@ "use strict";

this.setEvent = setEvent.bind(this);
this.setEventDup = this._setEventDup.bind(this);
this.getEvent = getEvent.bind(this);

@@ -690,2 +691,12 @@ this.fetchProfile = fetchProfile.bind(this);

}
_setEventDup(event, relay) {
if (!this.db) throw new Error("Database not initialized");
if (!relay?.url || !event.id) return;
try {
const stmt = this.db.getDatabase().prepare("INSERT OR IGNORE INTO event_relays (event_id, relay_url, seen_at) VALUES (?, ?, ?)");
stmt.run(event.id, relay.url, Date.now());
} catch (e) {
console.error("Error storing duplicate event relay:", e);
}
}
/**

@@ -692,0 +703,0 @@ * Close the database connection

@@ -574,2 +574,3 @@ // src/index.ts

this.setEvent = setEvent.bind(this);
this.setEventDup = this._setEventDup.bind(this);
this.getEvent = getEvent.bind(this);

@@ -657,2 +658,12 @@ this.fetchProfile = fetchProfile.bind(this);

}
_setEventDup(event, relay) {
if (!this.db) throw new Error("Database not initialized");
if (!relay?.url || !event.id) return;
try {
const stmt = this.db.getDatabase().prepare("INSERT OR IGNORE INTO event_relays (event_id, relay_url, seen_at) VALUES (?, ?, ?)");
stmt.run(event.id, relay.url, Date.now());
} catch (e) {
console.error("Error storing duplicate event relay:", e);
}
}
/**

@@ -659,0 +670,0 @@ * Close the database connection

+4
-4
{
"name": "@nostr-dev-kit/cache-sqlite",
"version": "5.0.0",
"version": "6.0.0",
"description": "SQLite cache adapter for NDK using better-sqlite3, compatible with Node.js environments.",

@@ -43,6 +43,6 @@ "keywords": [

"dependencies": {
"better-sqlite3": "^9.0.0"
"better-sqlite3": "^12.4.1"
},
"devDependencies": {
"@nostr-dev-kit/ndk": "^2.17.0",
"@nostr-dev-kit/ndk": "^2.17.2",
"@types/better-sqlite3": "^7.6.8",

@@ -58,4 +58,4 @@ "tsup": "^8.0.0",

"peerDependencies": {
"@nostr-dev-kit/ndk": "^2.17.0"
"@nostr-dev-kit/ndk": "^2.17.2"
}
}