improve diff filters

fix tests
expander/compressor filter mangler
This commit is contained in:
2023-06-01 22:03:28 +01:00
parent 25e7f68dce
commit ae6618f0ed
39 changed files with 504 additions and 261 deletions

View File

@ -1,13 +1,13 @@
import { RawEvent } from "System";
import { NostrEvent } from "System";
import { db } from "Db";
import FeedCache from "./FeedCache";
class DMCache extends FeedCache<RawEvent> {
class DMCache extends FeedCache<NostrEvent> {
constructor() {
super("DMCache", db.dms);
}
key(of: RawEvent): string {
key(of: NostrEvent): string {
return of.id;
}
@ -23,11 +23,11 @@ class DMCache extends FeedCache<RawEvent> {
return ret;
}
allDms(): Array<RawEvent> {
allDms(): Array<NostrEvent> {
return [...this.cache.values()];
}
takeSnapshot(): Array<RawEvent> {
takeSnapshot(): Array<NostrEvent> {
return this.allDms();
}
}

View File

@ -1,4 +1,4 @@
import { HexKey, RawEvent, UserMetadata } from "System";
import { HexKey, NostrEvent, UserMetadata } from "System";
import { hexToBech32, unixNowMs } from "SnortUtils";
import { DmCache } from "./DMCache";
import { InteractionCache } from "./EventInteractionCache";
@ -37,7 +37,7 @@ export interface MetadataCache extends UserMetadata {
isNostrAddressValid: boolean;
}
export function mapEventToProfile(ev: RawEvent) {
export function mapEventToProfile(ev: NostrEvent) {
try {
const data: UserMetadata = JSON.parse(ev.content);
return {