From 2478545cd34be6e0f721deae9ba97966afc40842 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 5 Dec 2023 17:27:52 -0600 Subject: [PATCH] with_authors --> with: With[] --- src/db/events.ts | 2 +- src/filter.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/db/events.ts b/src/db/events.ts index f8583a91..0adb071f 100644 --- a/src/db/events.ts +++ b/src/db/events.ts @@ -172,7 +172,7 @@ async function getFilters( if (!filters.length) return Promise.resolve([]); let query = getFiltersQuery(filters); - if (opts.with_authors) { + if (opts.with?.includes('authors')) { query = query .leftJoin( (eb) => diff --git a/src/filter.ts b/src/filter.ts index 91461867..5c8e70c9 100644 --- a/src/filter.ts +++ b/src/filter.ts @@ -8,6 +8,9 @@ interface DittoFilter extends Filter { local?: boolean; } +/** Additional properties that may be added to events. */ +type With = 'authors'; + /** Additional options to apply to the whole subscription. */ interface GetFiltersOpts { /** How long to wait (in milliseconds) until aborting the request. */ @@ -15,7 +18,7 @@ interface GetFiltersOpts { /** Event limit for the whole subscription. */ limit?: number; /** Whether to include a corresponding kind 0 event in the `authors` key of each event. */ - with_authors?: boolean; + with?: With[]; } function matchDittoFilter(filter: DittoFilter, event: Event, data: EventData): boolean {