Implement NStore interface from NLib

This commit is contained in:
Alex Gleason
2024-01-23 14:06:16 -06:00
parent 0a58233b4e
commit c6062874bd
32 changed files with 193 additions and 218 deletions

6
src/utils/abort.ts Normal file
View File

@@ -0,0 +1,6 @@
/** Creates an `AbortError` object matching the Fetch API. */
function abortError() {
return new DOMException('The signal has been aborted', 'AbortError');
}
export { abortError };

View File

@@ -51,7 +51,7 @@ async function updateEvent<K extends number, E extends EventStub>(
fn: (prev: NostrEvent | undefined) => E,
c: AppContext,
): Promise<NostrEvent> {
const [prev] = await eventsDB.filter([filter], { limit: 1 });
const [prev] = await eventsDB.query([filter], { limit: 1 });
return createEvent(fn(prev), c);
}