applesauce-core 0.0.0-next-20251231055351 → 0.0.0-next-20251231062646
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.
|
@@ -43,11 +43,11 @@ export declare class AsyncEventStore extends EventModels implements IAsyncEventS
|
|
|
43
43
|
/** Sets the method used to verify events */
|
|
44
44
|
set verifyEvent(method: undefined | ((event: NostrEvent) => boolean));
|
|
45
45
|
/** A stream of new events added to the store */
|
|
46
|
-
insert$: Subject<
|
|
46
|
+
insert$: Subject<NostrEvent>;
|
|
47
47
|
/** A stream of events that have been updated (Warning: this is a very noisy stream, use with caution) */
|
|
48
|
-
update$: Subject<
|
|
48
|
+
update$: Subject<NostrEvent>;
|
|
49
49
|
/** A stream of events that have been removed */
|
|
50
|
-
remove$: Subject<
|
|
50
|
+
remove$: Subject<NostrEvent>;
|
|
51
51
|
/**
|
|
52
52
|
* A method that will be called when an event isn't found in the store
|
|
53
53
|
*/
|
|
@@ -6,16 +6,16 @@ import { IEventMemory } from "./interface.js";
|
|
|
6
6
|
export declare class EventMemory implements IEventMemory {
|
|
7
7
|
protected log: import("debug").Debugger;
|
|
8
8
|
/** Indexes */
|
|
9
|
-
protected kinds: Map<number, Set<
|
|
10
|
-
protected authors: Map<string, Set<
|
|
11
|
-
protected tags: LRU<Set<
|
|
9
|
+
protected kinds: Map<number, Set<NostrEvent>>;
|
|
10
|
+
protected authors: Map<string, Set<NostrEvent>>;
|
|
11
|
+
protected tags: LRU<Set<NostrEvent>>;
|
|
12
12
|
protected created_at: NostrEvent[];
|
|
13
13
|
/** Composite index for kind+author queries (common pattern) */
|
|
14
|
-
protected kindAuthor: Map<string, Set<
|
|
14
|
+
protected kindAuthor: Map<string, Set<NostrEvent>>;
|
|
15
15
|
/** LRU cache of last events touched */
|
|
16
|
-
events: LRU<
|
|
16
|
+
events: LRU<NostrEvent>;
|
|
17
17
|
/** A sorted array of replaceable events by address */
|
|
18
|
-
protected replaceable: Map<string,
|
|
18
|
+
protected replaceable: Map<string, NostrEvent[]>;
|
|
19
19
|
/** The number of events in the database */
|
|
20
20
|
get size(): number;
|
|
21
21
|
/** Checks if the database contains an event without touching it */
|
|
@@ -41,7 +41,7 @@ export declare class EventMemory implements IEventMemory {
|
|
|
41
41
|
/** Notify the database that an event has updated */
|
|
42
42
|
update(_event: NostrEvent): void;
|
|
43
43
|
/** A weak map of events to claim reference counts */
|
|
44
|
-
protected claims: WeakMap<
|
|
44
|
+
protected claims: WeakMap<NostrEvent, number>;
|
|
45
45
|
/** Moves an event to the top of the LRU cache */
|
|
46
46
|
touch(event: NostrEvent): void;
|
|
47
47
|
/** Increments the claim count on the event and touches it */
|
|
@@ -57,10 +57,10 @@ export declare class EventMemory implements IEventMemory {
|
|
|
57
57
|
/** Removes events that are not claimed (free up memory) */
|
|
58
58
|
prune(limit?: number): number;
|
|
59
59
|
/** Index helper methods */
|
|
60
|
-
protected getKindIndex(kind: number): Set<
|
|
61
|
-
protected getAuthorsIndex(author: string): Set<
|
|
62
|
-
protected getKindAuthorIndex(kind: number, pubkey: string): Set<
|
|
63
|
-
protected getTagIndex(tagAndValue: string): Set<
|
|
60
|
+
protected getKindIndex(kind: number): Set<NostrEvent>;
|
|
61
|
+
protected getAuthorsIndex(author: string): Set<NostrEvent>;
|
|
62
|
+
protected getKindAuthorIndex(kind: number, pubkey: string): Set<NostrEvent>;
|
|
63
|
+
protected getTagIndex(tagAndValue: string): Set<NostrEvent>;
|
|
64
64
|
/**
|
|
65
65
|
* Helper method to remove an event from a sorted array using binary search.
|
|
66
66
|
* Falls back to indexOf if binary search doesn't find exact match.
|
|
@@ -43,11 +43,11 @@ export declare class EventStore extends EventModels implements IEventStore {
|
|
|
43
43
|
/** Sets the method used to verify events */
|
|
44
44
|
set verifyEvent(method: undefined | ((event: NostrEvent) => boolean));
|
|
45
45
|
/** A stream of new events added to the store */
|
|
46
|
-
insert$: Subject<
|
|
46
|
+
insert$: Subject<NostrEvent>;
|
|
47
47
|
/** A stream of events that have been updated (Warning: this is a very noisy stream, use with caution) */
|
|
48
|
-
update$: Subject<
|
|
48
|
+
update$: Subject<NostrEvent>;
|
|
49
49
|
/** A stream of events that have been removed */
|
|
50
|
-
remove$: Subject<
|
|
50
|
+
remove$: Subject<NostrEvent>;
|
|
51
51
|
/** A method that will be called when an event isn't found in the store */
|
|
52
52
|
eventLoader?: (pointer: EventPointer | AddressPointer | AddressPointerWithoutD) => Observable<NostrEvent> | Promise<NostrEvent | undefined>;
|
|
53
53
|
constructor(options?: EventStoreOptions);
|
package/dist/helpers/relays.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { NostrEvent } from "./event.js";
|
|
2
2
|
export declare const SeenRelaysSymbol: unique symbol;
|
|
3
|
-
declare module "nostr-tools" {
|
|
4
|
-
interface Event {
|
|
5
|
-
[SeenRelaysSymbol]?: Set<string>;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
3
|
/** Marks an event as being seen on a relay */
|
|
9
4
|
export declare function addSeenRelay(event: NostrEvent, relay: string): Set<string>;
|
|
10
5
|
/** Returns the set of relays this event was seen on */
|
|
@@ -4,4 +4,4 @@ import { IAsyncEventStoreActions, IEventStoreActions } from "../event-store/inte
|
|
|
4
4
|
/** Saves all events to an event store and filters out invalid events */
|
|
5
5
|
export declare function mapEventsToStore(store: IEventStoreActions | IAsyncEventStoreActions, removeDuplicates?: boolean): MonoTypeOperatorFunction<NostrEvent>;
|
|
6
6
|
/** Alias for {@link mapEventsToStore} */
|
|
7
|
-
export declare const filterDuplicateEvents: (store: IEventStoreActions | IAsyncEventStoreActions) => MonoTypeOperatorFunction<
|
|
7
|
+
export declare const filterDuplicateEvents: (store: IEventStoreActions | IAsyncEventStoreActions) => MonoTypeOperatorFunction<NostrEvent>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "applesauce-core",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20251231062646",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"fast-deep-equal": "^3.1.3",
|
|
82
82
|
"hash-sum": "^2.0.0",
|
|
83
83
|
"nanoid": "^5.0.9",
|
|
84
|
-
"nostr-tools": "~2.
|
|
84
|
+
"nostr-tools": "~2.19",
|
|
85
85
|
"rxjs": "^7.8.1"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|