Service worker precache

Yarn upgrades / cleanup
This commit is contained in:
2023-08-26 22:48:15 +01:00
parent 6fae5accde
commit 5cd1ad070a
26 changed files with 2885 additions and 4336 deletions

View File

@ -1,4 +1,4 @@
import { EventKind, NostrEvent, RequestBuilder, TaggedRawEvent } from "@snort/system";
import { EventKind, NostrEvent, RequestBuilder, TaggedNostrEvent } from "@snort/system";
import { RefreshFeedCache, TWithCreated } from "./RefreshFeedCache";
import { LoginSession } from "Login";
import { unixNow } from "SnortUtils";
@ -21,7 +21,7 @@ export class NotificationsCache extends RefreshFeedCache<NostrEvent> {
}
}
async onEvent(evs: readonly TaggedRawEvent[]) {
async onEvent(evs: readonly TaggedNostrEvent[]) {
const filtered = evs.filter(a => this.#kinds.includes(a.kind) && a.tags.some(b => b[0] === "p"));
if (filtered.length > 0) {
await this.bulkSet(filtered);

View File

@ -1,12 +1,12 @@
import { FeedCache } from "@snort/shared";
import { RequestBuilder, TaggedRawEvent } from "@snort/system";
import { RequestBuilder, TaggedNostrEvent } from "@snort/system";
import { LoginSession } from "Login";
export type TWithCreated<T> = T & { created_at: number };
export abstract class RefreshFeedCache<T> extends FeedCache<TWithCreated<T>> {
abstract buildSub(session: LoginSession, rb: RequestBuilder): void;
abstract onEvent(evs: Readonly<Array<TaggedRawEvent>>): void;
abstract onEvent(evs: Readonly<Array<TaggedNostrEvent>>): void;
/**
* Get latest event