Add getSubFeeds to feeds

This commit is contained in:
Jon Staab
2024-04-15 17:19:29 -07:00
parent 0ae07735a9
commit efa5307df1
6 changed files with 28 additions and 30 deletions
+18 -3
View File
@@ -13,10 +13,11 @@ export enum FeedType {
}
export enum Scope {
Self = "self",
Global = "global",
Follows = "follows",
Followers = "followers",
Follows = "follows",
Global = "global",
Network = "network",
Self = "self",
}
export type DynamicFilter = Filter & {
@@ -59,6 +60,20 @@ export const listFeed = (...addresses: string[]) => [FeedType.List, ...addresses
export const lolFeed = (...addresses: string[]) => [FeedType.LOL, ...addresses] as Feed
export const dvmFeed = (...requests: DVMItem[]) => [FeedType.DVM, ...requests] as Feed
export const getSubFeeds = ([type, ...feed]: Feed): Feed[] => {
switch (type) {
case FeedType.Relay:
return feed.slice(1) as Feed[]
case FeedType.Difference:
case FeedType.Intersection:
case FeedType.SymmetricDifference:
case FeedType.Union:
return feed as Feed[]
default:
return []
}
}
export type RequestItem = {
relays: string[]
filters: Filter[]