diff --git a/src/deps.ts b/src/deps.ts index fa7ff6f..53a07e9 100644 --- a/src/deps.ts +++ b/src/deps.ts @@ -91,6 +91,8 @@ export { type LNURLDetails, type MapCache, NIP05, + type NostrEvent, + type NostrFilter, } from 'https://gitlab.com/soapbox-pub/nlib/-/raw/5d711597f3b2a163817cc1fb0f1f3ce8cede7cf7/mod.ts'; export type * as TypeFest from 'npm:type-fest@^4.3.0'; diff --git a/src/interfaces/DittoEvent.ts b/src/interfaces/DittoEvent.ts new file mode 100644 index 0000000..ed327d4 --- /dev/null +++ b/src/interfaces/DittoEvent.ts @@ -0,0 +1,24 @@ +import { type NostrEvent } from '@/deps.ts'; + +/** Ditto internal stats for the event's author. */ +export interface AuthorStats { + followers_count: number; + following_count: number; + notes_count: number; +} + +/** Ditto internal stats for the event. */ +export interface EventStats { + replies_count: number; + reposts_count: number; + reactions_count: number; +} + +/** Internal Event representation used by Ditto, including extra keys. */ +export interface DittoEvent extends NostrEvent { + author?: DittoEvent; + author_stats?: AuthorStats; + event_stats?: EventStats; + d_author?: DittoEvent; + user?: DittoEvent; +} diff --git a/src/interfaces/DittoFilter.ts b/src/interfaces/DittoFilter.ts new file mode 100644 index 0000000..4ecda96 --- /dev/null +++ b/src/interfaces/DittoFilter.ts @@ -0,0 +1,14 @@ +import { type NostrEvent, type NostrFilter } from '@/deps.ts'; + +import { type DittoEvent } from './DittoEvent.ts'; + +/** Additional properties that may be added by Ditto to events. */ +export type DittoRelation = Exclude; + +/** Custom filter interface that extends Nostr filters with extra options for Ditto. */ +export interface DittoFilter extends NostrFilter { + /** Whether the event was authored by a local user. */ + local?: boolean; + /** Additional fields to add to the returned event. */ + relations?: DittoRelation[]; +}