nostr-idb 2.0.0 → 2.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # nostr-idb
2
2
 
3
+ ## 2.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - e4ec1d1: Fix multiple filters being interpreted as and
8
+
3
9
  ## 2.0.0
4
10
 
5
11
  ### Major Changes
@@ -166,18 +166,12 @@ export async function getIdsForFilter(db, filter, indexCache) {
166
166
  export async function getIdsForFilters(db, filters, indexCache) {
167
167
  if (filters.length === 0)
168
168
  throw new Error("No Filters");
169
- let ids = null;
169
+ let ids = new Set();
170
170
  for (const filter of filters) {
171
171
  const filterIds = await getIdsForFilter(db, filter, indexCache);
172
- if (!ids)
173
- ids = filterIds;
174
- else
175
- for (const id of ids)
176
- if (!filterIds.has(id))
177
- ids.delete(id);
172
+ for (const id of filterIds)
173
+ ids.add(id);
178
174
  }
179
- if (ids === null)
180
- throw new Error("Empty filters");
181
175
  return ids;
182
176
  }
183
177
  async function loadEventsByUID(db, uids, filters) {
@@ -11,7 +11,7 @@ const defaultOptions = {
11
11
  writeInterval: 100,
12
12
  cacheIndexes: 1000,
13
13
  pruneInterval: 1000 * 60,
14
- maxEvents: 50000,
14
+ maxEvents: 10000,
15
15
  };
16
16
  const log = logger.extend("relay");
17
17
  /** Main class that implements the relay logic */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nostr-idb",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "A collection of helper methods for storing nostr events in IndexedDB",
5
5
  "author": "hzrd149",
6
6
  "license": "MIT",