LokiLab's feed now carries US, French and EuroMillions results with a bonus array (Powerball, N° Chance, étoiles). Bonus balls render after a "+" in gold; the lottery strip gets icons for the new games. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
import 'server-only'
|
|
|
|
/**
|
|
* The one contract between LokiLab and LokiLoto: results, Loki's picks,
|
|
* lifetime win record, and army size. LokiLoto never talks to LokiLab's
|
|
* database or stats engine directly — only this feed.
|
|
*/
|
|
export interface ArmyFeed {
|
|
army: {
|
|
total: number
|
|
byCountry: Record<string, number>
|
|
}
|
|
lotteries: LotteryFeedEntry[]
|
|
}
|
|
|
|
export interface LotteryFeedEntry {
|
|
id: string
|
|
name: string
|
|
country: string
|
|
lifetime: {
|
|
picksTracked: number
|
|
wins: number
|
|
winRate: number
|
|
}
|
|
/** Name of the extra ball(s), e.g. "Powerball", "Étoiles" — international games only. */
|
|
bonusLabel?: string
|
|
lastDraw: {
|
|
date: string
|
|
result: number[]
|
|
bonus?: number[]
|
|
pick: number[] | null
|
|
matched: number | null
|
|
won: boolean | null
|
|
} | null
|
|
/** Last ~30 official draws (date + result only), newest first. */
|
|
recentDraws: { date: string; result: number[]; bonus?: number[]; pick: number[] | null }[]
|
|
/** Loki's resolved picks over time (date + won), oldest first. */
|
|
pickHistory: { date: string; won: boolean }[]
|
|
}
|
|
|
|
const LOKILAB_FEED_URL = process.env.LOKILAB_FEED_URL ?? 'https://goldd.devyouz.net/api/public/army-feed'
|
|
|
|
export async function getArmyFeed(): Promise<ArmyFeed> {
|
|
const res = await fetch(LOKILAB_FEED_URL, { next: { revalidate: 300 } })
|
|
if (!res.ok) throw new Error(`LokiLab feed returned ${res.status}`)
|
|
return res.json()
|
|
}
|