Merge pull request 'chore(Types): improved relay stats types' (#91) from kinds-improvement into staging
All checks were successful
Release to Staging / build_and_release (push) Successful in 1m5s

Reviewed-on: https://git.sigit.io/sig/it/pulls/91
Reviewed-by: Leonardo Davinci <m@noreply.git.sigit.io>
This commit is contained in:
Y 2024-05-29 08:37:36 +00:00
commit 45cb9a2d70
2 changed files with 101 additions and 101 deletions

View File

@ -31,7 +31,7 @@ import {
SignedEvent, SignedEvent,
RelayMap, RelayMap,
RelayStats, RelayStats,
ReadRelay, RelayReadStats,
RelayInfoObject, RelayInfoObject,
RelayConnectionStatus, RelayConnectionStatus,
RelayConnectionState RelayConnectionState
@ -548,7 +548,7 @@ export class NostrController extends EventEmitter {
const apiTopRelays = data.relay_stats.user_picks.read_relays const apiTopRelays = data.relay_stats.user_picks.read_relays
.slice(0, numberOfTopRelays) .slice(0, numberOfTopRelays)
.map((relay: ReadRelay) => relay.d) .map((relay: RelayReadStats) => relay.d)
if (!apiTopRelays.length) { if (!apiTopRelays.length) {
return Promise.reject(`Couldn't fetch popular relays.`) return Promise.reject(`Couldn't fetch popular relays.`)

View File

@ -19,21 +19,21 @@ export interface RelayStats {
posts: number posts: number
zaps: number zaps: number
zap_amount: number zap_amount: number
daily: Daily daily: RelayDailyStats
daily_totals: DailyTotals daily_totals: RelayDailyTotals
relay_stats: RelayStats relay_stats: RelayStats
} }
export interface RelayStats { export interface RelayStats {
user_picks: UserPicks user_picks: RelayUserPicksStats
written: Written written: RelayWrittenStats
} }
export interface Written { export interface RelayWrittenStats {
last_week: LastWeek[] last_week: RelayLastWeekStats[]
} }
export interface LastWeek { export interface RelayLastWeekStats {
d: string d: string
p: number p: number
ps: number ps: number
@ -41,12 +41,12 @@ export interface LastWeek {
es: number es: number
} }
export interface UserPicks { export interface RelayUserPicksStats {
read_relays: ReadRelay[] read_relays: RelayReadStats[]
write_relays: ReadRelay[] write_relays: RelayReadStats[]
} }
export interface ReadRelay { export interface RelayReadStats {
d: string d: string
r: number r: number
w: number w: number
@ -54,100 +54,100 @@ export interface ReadRelay {
ws: number ws: number
} }
export interface DailyTotals { export interface RelayDailyTotals {
datasets: Datasets2 datasets: RelayDailyTotalStatsDataset
} }
export interface Datasets2 { export interface RelayDailyTotalStatsDataset {
kind_0: Kind0[] kind_0: RelayItemStats[]
kind_1: Kind0[] kind_1: RelayItemStats[]
kind_2: Kind0[] kind_2: RelayItemStats[]
kind_3: Kind0[] kind_3: RelayItemStats[]
kind_5: Kind0[] kind_5: RelayItemStats[]
kind_6: Kind0[] kind_6: RelayItemStats[]
kind_7: Kind0[] kind_7: RelayItemStats[]
kind_1984: Kind0[] kind_1984: RelayItemStats[]
kind_9735: Kind0[] kind_9735: RelayItemStats[]
kind_1063: Kind0[] kind_1063: RelayItemStats[]
kind_6969: Kind0[] kind_6969: RelayItemStats[]
kind_9802: Kind0[] kind_9802: RelayItemStats[]
kind_30000: Kind0[] kind_30000: RelayItemStats[]
kind_30001: Kind0[] kind_30001: RelayItemStats[]
kind_30008: Kind0[] kind_30008: RelayItemStats[]
kind_30009: Kind0[] kind_30009: RelayItemStats[]
kind_30017: Kind0[] kind_30017: RelayItemStats[]
kind_30018: Kind0[] kind_30018: RelayItemStats[]
kind_30023: Kind0[] kind_30023: RelayItemStats[]
kind_31337: Kind0[] kind_31337: RelayItemStats[]
totals: Kind0[] totals: RelayItemStats[]
new_profiles: Kind0[] new_profiles: RelayItemStats[]
new_pubkeys: Kind0[] new_pubkeys: RelayItemStats[]
new_contact_lists: Kind0[] new_contact_lists: RelayItemStats[]
new_ln: Kind0[] new_ln: RelayItemStats[]
new_users: Kind0[] new_users: RelayItemStats[]
total_zap_amount: Kind0[] total_zap_amount: RelayItemStats[]
zappers: Kind0[] zappers: RelayItemStats[]
zapped_pubkeys: Kind0[] zapped_pubkeys: RelayItemStats[]
zapped_events: Kind0[] zapped_events: RelayItemStats[]
zap_providers: Kind0[] zap_providers: RelayItemStats[]
} }
export interface Daily { export interface RelayDailyStats {
datasets: Datasets datasets: RelayDailyStatsDataset
} }
export interface Datasets { export interface RelayDailyStatsDataset {
kind_0: Kind0[] kind_0: RelayItemStats[]
kind_1: Kind0[] kind_1: RelayItemStats[]
kind_2: Kind0[] kind_2: RelayItemStats[]
kind_3: Kind0[] kind_3: RelayItemStats[]
kind_5: Kind0[] kind_5: RelayItemStats[]
kind_6: Kind0[] kind_6: RelayItemStats[]
kind_7: Kind0[] kind_7: RelayItemStats[]
kind_1984: Kind0[] kind_1984: RelayItemStats[]
kind_9735: Kind0[] kind_9735: RelayItemStats[]
kind_1063: Kind0[] kind_1063: RelayItemStats[]
kind_6969: Kind0[] kind_6969: RelayItemStats[]
kind_9802: Kind0[] kind_9802: RelayItemStats[]
kind_30000: Kind0[] kind_30000: RelayItemStats[]
kind_30001: Kind0[] kind_30001: RelayItemStats[]
kind_30008: Kind0[] kind_30008: RelayItemStats[]
kind_30009: Kind0[] kind_30009: RelayItemStats[]
kind_30017: Kind0[] kind_30017: RelayItemStats[]
kind_30018: Kind0[] kind_30018: RelayItemStats[]
kind_30023: Kind0[] kind_30023: RelayItemStats[]
kind_31337: Kind0[] kind_31337: RelayItemStats[]
totals: Kind0[] totals: RelayItemStats[]
new_profiles: Kind0[] new_profiles: RelayItemStats[]
new_pubkeys: Kind0[] new_pubkeys: RelayItemStats[]
new_contact_lists: Kind0[] new_contact_lists: RelayItemStats[]
new_ln: Kind0[] new_ln: RelayItemStats[]
new_users: Kind0[] new_users: RelayItemStats[]
max_zap_amount: Kind0[] max_zap_amount: RelayItemStats[]
avg_zap_amount: Kind0[] avg_zap_amount: RelayItemStats[]
total_zap_amount: Kind0[] total_zap_amount: RelayItemStats[]
active_pubkeys: Kind0[] active_pubkeys: RelayItemStats[]
active_pubkeys_total: Kind0[] active_pubkeys_total: RelayItemStats[]
active_pubkeys_week: Kind0[] active_pubkeys_week: RelayItemStats[]
active_pubkeys_total_week: Kind0[] active_pubkeys_total_week: RelayItemStats[]
active_relays: Kind0[] active_relays: RelayItemStats[]
zappers: Kind0[] zappers: RelayItemStats[]
zapped_pubkeys: Kind0[] zapped_pubkeys: RelayItemStats[]
zapped_events: Kind0[] zapped_events: RelayItemStats[]
zap_providers: Kind0[] zap_providers: RelayItemStats[]
retention: Retention retention: RelayRetentionStats
} }
export interface Retention { export interface RelayRetentionStats {
all: All[] all: RelayRetentionAll[]
tr: All[] tr: RelayRetentionAll[]
bio: All[] bio: RelayRetentionAll[]
all_curves: Allcurve[] all_curves: RelayRetentionAllCurve[]
tr_curves: Allcurve[] tr_curves: RelayRetentionAllCurve[]
bio_curves: Allcurve[] bio_curves: RelayRetentionAllCurve[]
} }
export interface Allcurve { export interface RelayRetentionAllCurve {
day: number day: number
'2023-02': number '2023-02': number
'2023-03': number '2023-03': number
@ -157,7 +157,7 @@ export interface Allcurve {
'2023-07': number '2023-07': number
} }
export interface All { export interface RelayRetentionAll {
d: string d: string
signups: number signups: number
retained: number retained: number
@ -191,9 +191,9 @@ export interface All {
lost_followers: number lost_followers: number
} }
export interface Kind0 { export interface RelayItemStats {
d: string d: string // date
c: number c: number // count
} }
export interface RelayFee { export interface RelayFee {