mirror of
https://github.com/aljazceru/ditto.git
synced 2025-12-20 06:54:20 +01:00
Add DittoEvent and DittoFilter dedicated interface modules
This commit is contained in:
@@ -91,6 +91,8 @@ export {
|
|||||||
type LNURLDetails,
|
type LNURLDetails,
|
||||||
type MapCache,
|
type MapCache,
|
||||||
NIP05,
|
NIP05,
|
||||||
|
type NostrEvent,
|
||||||
|
type NostrFilter,
|
||||||
} from 'https://gitlab.com/soapbox-pub/nlib/-/raw/5d711597f3b2a163817cc1fb0f1f3ce8cede7cf7/mod.ts';
|
} from 'https://gitlab.com/soapbox-pub/nlib/-/raw/5d711597f3b2a163817cc1fb0f1f3ce8cede7cf7/mod.ts';
|
||||||
|
|
||||||
export type * as TypeFest from 'npm:type-fest@^4.3.0';
|
export type * as TypeFest from 'npm:type-fest@^4.3.0';
|
||||||
|
|||||||
24
src/interfaces/DittoEvent.ts
Normal file
24
src/interfaces/DittoEvent.ts
Normal file
@@ -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;
|
||||||
|
}
|
||||||
14
src/interfaces/DittoFilter.ts
Normal file
14
src/interfaces/DittoFilter.ts
Normal file
@@ -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<keyof DittoEvent, keyof NostrEvent>;
|
||||||
|
|
||||||
|
/** 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[];
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user