Add missing function
This commit is contained in:
parent
4958611cca
commit
45a0ef4445
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@snort/system-react",
|
||||
"version": "1.0.9",
|
||||
"version": "1.0.10",
|
||||
"description": "React hooks for @snort/system",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
@ -16,7 +16,7 @@
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@snort/system": "^1.0.14",
|
||||
"@snort/system": "^1.0.15",
|
||||
"@snort/shared": "^1.0.4",
|
||||
"react": "^18.2.0"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@snort/system",
|
||||
"version": "1.0.14",
|
||||
"version": "1.0.15",
|
||||
"description": "Snort nostr system package",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
@ -4,7 +4,6 @@ import { unwrap, sanitizeRelayUrl, ExternalStore, FeedCache } from "@snort/share
|
||||
import { NostrEvent, TaggedRawEvent } from "./nostr";
|
||||
import { AuthHandler, Connection, RelaySettings, ConnectionStateSnapshot } from "./connection";
|
||||
import { Query } from "./query";
|
||||
import { RelayCache } from "./gossip-model";
|
||||
import { NoteStore } from "./note-collection";
|
||||
import { BuiltRawReqFilter, RequestBuilder } from "./request-builder";
|
||||
import { RelayMetricHandler } from "./relay-metric-handler";
|
||||
@ -16,7 +15,9 @@ import {
|
||||
SystemSnapshot,
|
||||
UserProfileCache,
|
||||
UserRelaysCache,
|
||||
RelayMetricCache
|
||||
RelayMetricCache,
|
||||
db,
|
||||
UsersRelays
|
||||
} from ".";
|
||||
|
||||
/**
|
||||
@ -43,7 +44,7 @@ export class NostrSystem extends ExternalStore<SystemSnapshot> implements System
|
||||
/**
|
||||
* Storage class for user relay lists
|
||||
*/
|
||||
#relayCache: RelayCache;
|
||||
#relayCache: FeedCache<UsersRelays>;
|
||||
|
||||
/**
|
||||
* Storage class for user profiles
|
||||
@ -67,7 +68,7 @@ export class NostrSystem extends ExternalStore<SystemSnapshot> implements System
|
||||
|
||||
constructor(props: {
|
||||
authHandler?: AuthHandler,
|
||||
relayCache?: RelayCache,
|
||||
relayCache?: FeedCache<UsersRelays>,
|
||||
profileCache?: FeedCache<MetadataCache>
|
||||
relayMetrics?: FeedCache<RelayMetrics>
|
||||
}) {
|
||||
@ -93,6 +94,19 @@ export class NostrSystem extends ExternalStore<SystemSnapshot> implements System
|
||||
return [...this.#sockets.values()].map(a => a.snapshot());
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup caches
|
||||
*/
|
||||
async Init() {
|
||||
db.ready = await db.isAvailable();
|
||||
const t = [
|
||||
this.#relayCache.preload(),
|
||||
this.#profileCache.preload(),
|
||||
this.#relayMetricsCache.preload()
|
||||
];
|
||||
await Promise.all(t);
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to a NOSTR relay if not already connected
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user