applesauce-core 0.0.0-next-20250308114045 → 0.0.0-next-20250308144838
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/dist/event-store/database.d.ts +1 -1
- package/dist/event-store/database.js +1 -1
- package/dist/event-store/event-store.d.ts +2 -0
- package/dist/event-store/event-store.js +6 -2
- package/dist/query-store/query-store.d.ts +2 -0
- package/dist/query-store/query-store.js +4 -0
- package/package.json +1 -1
|
@@ -60,7 +60,7 @@ export declare class Database {
|
|
|
60
60
|
iterateIds(ids: Iterable<string>): Generator<NostrEvent>;
|
|
61
61
|
/** Returns all events that match the filter */
|
|
62
62
|
getEventsForFilter(filter: Filter): Set<NostrEvent>;
|
|
63
|
-
|
|
63
|
+
getEventsForFilters(filters: Filter[]): Set<NostrEvent>;
|
|
64
64
|
/** Remove the oldest events that are not claimed */
|
|
65
65
|
prune(limit?: number): number;
|
|
66
66
|
}
|
|
@@ -36,6 +36,8 @@ export declare class EventStore {
|
|
|
36
36
|
getReplaceable(kind: number, pubkey: string, d?: string): NostrEvent | undefined;
|
|
37
37
|
/** Returns all versions of a replaceable event */
|
|
38
38
|
getReplaceableHistory(kind: number, pubkey: string, d?: string): NostrEvent[] | undefined;
|
|
39
|
+
/** Returns a timeline of events that match filters */
|
|
40
|
+
getTimeline(filters: Filter | Filter[]): NostrEvent[];
|
|
39
41
|
/**
|
|
40
42
|
* Creates an observable that streams all events that match the filter and remains open
|
|
41
43
|
* @param filters
|
|
@@ -117,7 +117,7 @@ export class EventStore {
|
|
|
117
117
|
}
|
|
118
118
|
/** Get all events matching a filter */
|
|
119
119
|
getAll(filters) {
|
|
120
|
-
return this.database.
|
|
120
|
+
return this.database.getEventsForFilters(filters);
|
|
121
121
|
}
|
|
122
122
|
/** Check if the store has an event */
|
|
123
123
|
hasEvent(uid) {
|
|
@@ -138,6 +138,10 @@ export class EventStore {
|
|
|
138
138
|
getReplaceableHistory(kind, pubkey, d) {
|
|
139
139
|
return this.database.getReplaceable(kind, pubkey, d);
|
|
140
140
|
}
|
|
141
|
+
/** Returns a timeline of events that match filters */
|
|
142
|
+
getTimeline(filters) {
|
|
143
|
+
return Array.from(this.database.getEventsForFilters(Array.isArray(filters) ? filters : [filters])).sort(sortDesc);
|
|
144
|
+
}
|
|
141
145
|
/**
|
|
142
146
|
* Creates an observable that streams all events that match the filter and remains open
|
|
143
147
|
* @param filters
|
|
@@ -278,7 +282,7 @@ export class EventStore {
|
|
|
278
282
|
filters = Array.isArray(filters) ? filters : [filters];
|
|
279
283
|
const seen = new Map();
|
|
280
284
|
// get current events
|
|
281
|
-
return defer(() => of(Array.from(this.database.
|
|
285
|
+
return defer(() => of(Array.from(this.database.getEventsForFilters(filters)).sort(sortDesc))).pipe(
|
|
282
286
|
// claim existing events
|
|
283
287
|
claimEvents(this.database),
|
|
284
288
|
// subscribe to newer events
|
|
@@ -45,6 +45,8 @@ export declare class QueryStore {
|
|
|
45
45
|
inboxes: string[];
|
|
46
46
|
outboxes: string[];
|
|
47
47
|
} | undefined>;
|
|
48
|
+
/** Creates a query for a users blossom servers */
|
|
49
|
+
blossomServers(pubkey: string): Observable<URL[] | undefined>;
|
|
48
50
|
/** Creates a ThreadQuery */
|
|
49
51
|
thread(root: string | EventPointer | AddressPointer): Observable<Queries.Thread | undefined>;
|
|
50
52
|
}
|
|
@@ -80,6 +80,10 @@ export class QueryStore {
|
|
|
80
80
|
mailboxes(pubkey) {
|
|
81
81
|
return this.createQuery(Queries.MailboxesQuery, pubkey);
|
|
82
82
|
}
|
|
83
|
+
/** Creates a query for a users blossom servers */
|
|
84
|
+
blossomServers(pubkey) {
|
|
85
|
+
return this.createQuery(Queries.UserBlossomServersQuery, pubkey);
|
|
86
|
+
}
|
|
83
87
|
/** Creates a ThreadQuery */
|
|
84
88
|
thread(root) {
|
|
85
89
|
return this.createQuery(Queries.ThreadQuery, root);
|