Sessions 5-7a: 955 tests, deployment ready
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* OddsAdapter — common interface every odds source must implement.
|
||||
*
|
||||
* The UnifiedOddsProvider calls these methods on every adapter via
|
||||
* Promise.allSettled, so adapters should never throw at the module boundary
|
||||
* — surface failures as a fulfilled result with `error` set, or a rejected
|
||||
* promise that the orchestrator can attribute to a specific source.
|
||||
*
|
||||
* Return shapes:
|
||||
* getGames(sport): Game[]
|
||||
* getPlayerProps(sport): PlayerProp[]
|
||||
*
|
||||
* Game = {
|
||||
* game_id, sport, away, home, start_time, status, score?,
|
||||
* moneyline?: { away, home }, spread?: { line, juice }, total?: { line, juice }
|
||||
* }
|
||||
*
|
||||
* PlayerProp = {
|
||||
* game_id, player_name, player_id?, stat_type, line,
|
||||
* odds_over, odds_under, book, fetched_at
|
||||
* }
|
||||
*/
|
||||
|
||||
class NotImplementedAdapter {
|
||||
constructor(name) {
|
||||
this.name = name;
|
||||
}
|
||||
async getGames(/* sport */) {
|
||||
return this._notImplemented('getGames');
|
||||
}
|
||||
async getPlayerProps(/* sport */) {
|
||||
return this._notImplemented('getPlayerProps');
|
||||
}
|
||||
_notImplemented(method) {
|
||||
const err = new Error(`${this.name}.${method} not implemented`);
|
||||
err.code = 'NOT_IMPLEMENTED';
|
||||
err.skipBreaker = true; // don't penalize the breaker for missing impls
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { NotImplementedAdapter };
|
||||
Reference in New Issue
Block a user