@levrbet/shared 0.2.82 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/config/urls.js +4 -4
- package/dist/core/config/urls.js.map +1 -1
- package/dist/core/utils/game.utils.d.ts +2 -0
- package/dist/core/utils/game.utils.js +69 -1
- package/dist/core/utils/game.utils.js.map +1 -1
- package/dist/server/oracle/config/game-periods/providers/lsports.periods.js +3 -3
- package/dist/server/oracle/config/game-periods/providers/lsports.periods.js.map +1 -1
- package/dist/server/oracle/config/game-periods/providers/optic-odds.periods.d.ts +4 -27
- package/dist/server/oracle/config/game-periods/providers/optic-odds.periods.js +4 -27
- package/dist/server/oracle/config/game-periods/providers/optic-odds.periods.js.map +1 -1
- package/dist/server/oracle/config/game-periods/sports.config.js +8 -73
- package/dist/server/oracle/config/game-periods/sports.config.js.map +1 -1
- package/dist/server/oracle/config/game-periods/types.d.ts +2 -6
- package/dist/server/oracle/config/game-periods/types.js +0 -1
- package/dist/server/oracle/config/game-periods/types.js.map +1 -1
- package/dist/server/oracle/redis-cache-manager/cache.keys.utils.d.ts +45 -74
- package/dist/server/oracle/redis-cache-manager/cache.keys.utils.js +65 -120
- package/dist/server/oracle/redis-cache-manager/cache.keys.utils.js.map +1 -1
- package/dist/server/oracle/redis-cache-manager/game.query.engine.d.ts +90 -0
- package/dist/server/oracle/redis-cache-manager/game.query.engine.js +436 -0
- package/dist/server/oracle/redis-cache-manager/game.query.engine.js.map +1 -0
- package/dist/server/oracle/redis-cache-manager/index.d.ts +2 -3
- package/dist/server/oracle/redis-cache-manager/index.js +2 -3
- package/dist/server/oracle/redis-cache-manager/index.js.map +1 -1
- package/dist/server/oracle/redis-cache-manager/market.query.engine.d.ts +50 -97
- package/dist/server/oracle/redis-cache-manager/market.query.engine.js +310 -467
- package/dist/server/oracle/redis-cache-manager/market.query.engine.js.map +1 -1
- package/dist/server/oracle/types/providers/game-clock/index.d.ts +1 -1
- package/dist/server/oracle/types/providers/game-clock/index.js +1 -1
- package/dist/server/oracle/types/providers/game-clock/index.js.map +1 -1
- package/dist/server/{utils/game_progress → oracle/types/providers/game-clock}/parser.d.ts +7 -1
- package/dist/server/{utils/game_progress → oracle/types/providers/game-clock}/parser.js +13 -2
- package/dist/server/oracle/types/providers/game-clock/parser.js.map +1 -0
- package/dist/server/utils/index.d.ts +0 -1
- package/dist/server/utils/index.js +0 -1
- package/dist/server/utils/index.js.map +1 -1
- package/package.json +5 -4
- package/scripts/setup-prisma.js +0 -0
- package/dist/server/oracle/redis-cache-manager/game.cache.service.d.ts +0 -185
- package/dist/server/oracle/redis-cache-manager/game.cache.service.js +0 -712
- package/dist/server/oracle/redis-cache-manager/game.cache.service.js.map +0 -1
- package/dist/server/oracle/redis-cache-manager/game.progress.d.ts +0 -4
- package/dist/server/oracle/redis-cache-manager/game.progress.js +0 -27
- package/dist/server/oracle/redis-cache-manager/game.progress.js.map +0 -1
- package/dist/server/oracle/redis-cache-manager/market.cache.service.d.ts +0 -87
- package/dist/server/oracle/redis-cache-manager/market.cache.service.js +0 -139
- package/dist/server/oracle/redis-cache-manager/market.cache.service.js.map +0 -1
- package/dist/server/utils/game_progress/caclulate.game.progress.d.ts +0 -6
- package/dist/server/utils/game_progress/caclulate.game.progress.js +0 -96
- package/dist/server/utils/game_progress/caclulate.game.progress.js.map +0 -1
- package/dist/server/utils/game_progress/game.utils.d.ts +0 -2
- package/dist/server/utils/game_progress/game.utils.js +0 -64
- package/dist/server/utils/game_progress/game.utils.js.map +0 -1
- package/dist/server/utils/game_progress/index.d.ts +0 -3
- package/dist/server/utils/game_progress/index.js +0 -20
- package/dist/server/utils/game_progress/index.js.map +0 -1
- package/dist/server/utils/game_progress/parser.js.map +0 -1
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { Market, MarketStatus, MarketType, Odds } from "@prisma/client";
|
|
2
|
-
import { Redis } from "ioredis";
|
|
3
|
-
import { LevrChain, MarketWithRelations } from "../../../core";
|
|
4
|
-
/**
|
|
5
|
-
* Redis Query Engine using RediSearch
|
|
6
|
-
* Provides advanced querying capabilities for markets and odds using Prisma types
|
|
7
|
-
*/
|
|
1
|
+
import type { Market, MarketStatus, MarketType, Odds } from "@prisma/client";
|
|
2
|
+
import type { Redis } from "ioredis";
|
|
3
|
+
import type { LevrChain, MarketWithRelations } from "../../../core";
|
|
8
4
|
export interface SearchQuery {
|
|
9
5
|
marketType?: MarketType;
|
|
10
6
|
levrGameObjectId?: string;
|
|
@@ -24,129 +20,86 @@ export interface SearchResult<T> {
|
|
|
24
20
|
results: T[];
|
|
25
21
|
duration: number;
|
|
26
22
|
}
|
|
23
|
+
export interface UpdateMarketCacheResult {
|
|
24
|
+
success: number;
|
|
25
|
+
failed: number;
|
|
26
|
+
total: number;
|
|
27
|
+
}
|
|
27
28
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* @param gameUniqueId - Unique game identifier
|
|
31
|
-
* @param marketType - Market type
|
|
32
|
-
* @param limit - Number of latest odds to return (from the end)
|
|
33
|
-
* @returns Array of Odds objects
|
|
34
|
-
*/
|
|
35
|
-
export declare const getOddsList: (redis: Redis, gameUniqueId: string, marketType: MarketType) => Promise<Odds[]>;
|
|
36
|
-
/**
|
|
37
|
-
* Fallback market query engine for Redis instances without RediSearch support
|
|
38
|
-
* Uses simple hash operations instead of full-text search indexing
|
|
39
|
-
*/
|
|
40
|
-
export declare const searchMarketsFallback: (redis: Redis, levrGameObjectId: string, marketType: MarketType) => Promise<Market | null>;
|
|
41
|
-
/**
|
|
42
|
-
* Add a new market to cache with RediSearch indexing
|
|
43
|
-
* @param redis - Redis client instance
|
|
44
|
-
* @param market - Array of Market objects to cache
|
|
45
|
-
*/
|
|
46
|
-
export declare const updateMarketCache: (redis: Redis, market: Market[]) => Promise<void>;
|
|
47
|
-
/**
|
|
48
|
-
* Create market index with proper schema
|
|
29
|
+
* Create market index with proper schema and versioning
|
|
30
|
+
* Validates existing index schema and recreates if mismatched
|
|
49
31
|
*/
|
|
50
32
|
export declare const createMarketIndex: (redis: Redis) => Promise<void>;
|
|
51
33
|
/**
|
|
52
|
-
*
|
|
34
|
+
* Drop market search index
|
|
53
35
|
* @param redis - Redis client instance
|
|
54
36
|
*/
|
|
55
|
-
export declare const
|
|
37
|
+
export declare const dropMarketIndex: (redis: Redis) => Promise<void>;
|
|
56
38
|
/**
|
|
57
|
-
*
|
|
39
|
+
* Add markets to cache with RediSearch indexing
|
|
58
40
|
* @param redis - Redis client instance
|
|
59
|
-
* @param
|
|
60
|
-
* @returns
|
|
41
|
+
* @param markets - Array of Market objects to cache
|
|
42
|
+
* @returns Result object with success/failed counts
|
|
61
43
|
*/
|
|
62
|
-
export declare const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
* @param marketType - Market type
|
|
68
|
-
* @returns Market object or null if not found
|
|
69
|
-
*/
|
|
70
|
-
export declare const getMarketByGameAndType: (redis: Redis, gameUniqueId: string, marketType: MarketType) => Promise<Market | null>;
|
|
44
|
+
export declare const updateMarketCache: (redis: Redis, markets: Market[]) => Promise<UpdateMarketCacheResult>;
|
|
45
|
+
export interface MarketSearchResult {
|
|
46
|
+
markets: Market[];
|
|
47
|
+
total: number;
|
|
48
|
+
}
|
|
71
49
|
/**
|
|
72
|
-
*
|
|
73
|
-
* Uses simple hash operations when RediSearch is unavailable
|
|
50
|
+
* Get markets using RediSearch query engine
|
|
74
51
|
* @param redis - Redis client instance
|
|
75
|
-
* @param
|
|
76
|
-
* @
|
|
77
|
-
* @returns Markets with their odds
|
|
52
|
+
* @param params - Search parameters
|
|
53
|
+
* @returns Search result with markets array and total count
|
|
78
54
|
*/
|
|
79
|
-
export declare const
|
|
55
|
+
export declare const getGameMarkets: (redis: Redis, params: SearchQuery) => Promise<MarketSearchResult>;
|
|
80
56
|
/**
|
|
81
|
-
*
|
|
57
|
+
* Get markets with their associated odds
|
|
82
58
|
* @param redis - Redis client instance
|
|
83
59
|
* @param query - Search query parameters
|
|
84
|
-
* @returns
|
|
60
|
+
* @returns Results with markets and their odds
|
|
85
61
|
*/
|
|
86
|
-
export declare const
|
|
62
|
+
export declare const getGameMarketsWithOdds: (redis: Redis, query: SearchQuery) => Promise<SearchResult<MarketWithRelations>>;
|
|
87
63
|
/**
|
|
88
|
-
*
|
|
89
|
-
* Uses simple hash operations when RediSearch is unavailable
|
|
90
|
-
* @param redis - Redis client instance
|
|
91
|
-
* @param queries - Array of search query parameters with gameUniqueIdentifier and marketType
|
|
92
|
-
* @returns Combined search results with markets and their odds
|
|
93
|
-
*/
|
|
94
|
-
export declare const searchMultipleMarketsWithOddsFallback: (redis: Redis, queries: Array<{
|
|
95
|
-
gameUniqueIdentifier: string;
|
|
96
|
-
marketType: MarketType;
|
|
97
|
-
}>) => Promise<{
|
|
98
|
-
total: number;
|
|
99
|
-
results: Record<string, MarketWithRelations[]>;
|
|
100
|
-
duration: number;
|
|
101
|
-
}>;
|
|
102
|
-
/**
|
|
103
|
-
* Search multiple markets with their associated odds using multiple queries
|
|
64
|
+
* Get multiple markets with their associated odds using multiple queries
|
|
104
65
|
* @param redis - Redis client instance
|
|
105
66
|
* @param queries - Array of search query parameters
|
|
106
|
-
* @returns Combined
|
|
67
|
+
* @returns Combined results with markets and their odds
|
|
107
68
|
*/
|
|
108
|
-
export declare const
|
|
69
|
+
export declare const getMultipleMarketsWithOdds: (redis: Redis, queries: SearchQuery[]) => Promise<{
|
|
109
70
|
total: number;
|
|
110
71
|
results: Record<string, MarketWithRelations[]>;
|
|
111
72
|
duration: number;
|
|
112
73
|
}>;
|
|
113
74
|
/**
|
|
114
|
-
*
|
|
115
|
-
* @param redis - Redis client instance
|
|
116
|
-
* @param gameUniqueId - Unique game identifier
|
|
117
|
-
* @param marketType - Market type
|
|
118
|
-
* @param odds - Array of Odds objects to cache
|
|
119
|
-
*/
|
|
120
|
-
export declare const addOddsToOddsCache: (redis: Redis, gameUniqueId: string, marketType: MarketType, odds: Odds[]) => Promise<void>;
|
|
121
|
-
/**
|
|
122
|
-
* Search odds lists by market identifiers using RediSearch
|
|
75
|
+
* Get market data with associated odds for multiple games and market types
|
|
123
76
|
* @param redis - Redis client instance
|
|
124
|
-
* @param
|
|
125
|
-
* @
|
|
126
|
-
* @param levrGameObjectId - Levr game object ID to search
|
|
127
|
-
* @returns Array of odds lists matching the query
|
|
77
|
+
* @param query - Array of query objects with gameUniqueIdentifier and marketType
|
|
78
|
+
* @returns Map of game IDs to their markets with odds
|
|
128
79
|
*/
|
|
129
|
-
export declare const
|
|
80
|
+
export declare const getMarketDataCacheWithOdds: (redis: Redis, query: Array<{
|
|
81
|
+
gameUniqueIdentifier: string;
|
|
82
|
+
marketType: MarketType;
|
|
83
|
+
}>) => Promise<Record<string, MarketWithRelations[]>>;
|
|
130
84
|
/**
|
|
131
|
-
* Get
|
|
85
|
+
* Get odds for a specific gameMarketId with pagination using Redis LIST
|
|
132
86
|
* @param redis - Redis client instance
|
|
133
|
-
* @param
|
|
134
|
-
* @param
|
|
135
|
-
* @returns
|
|
87
|
+
* @param gameMarketId - The game market identifier (key suffix)
|
|
88
|
+
* @param limit - Number of latest odds to return (from the end). Use -1 for all.
|
|
89
|
+
* @returns Array of Odds objects (most recent last)
|
|
136
90
|
*/
|
|
137
|
-
export declare const
|
|
91
|
+
export declare const getOddsList: (redis: Redis, gameMarketId: string, limit?: number) => Promise<Odds[]>;
|
|
138
92
|
/**
|
|
139
|
-
*
|
|
93
|
+
* Add odds to cache using Redis LIST (RPUSH)
|
|
140
94
|
* @param redis - Redis client instance
|
|
141
|
-
* @param
|
|
142
|
-
* @param
|
|
143
|
-
* @returns Odds with related market or null if not found
|
|
95
|
+
* @param gameMarketId - The game market identifier (used as key suffix)
|
|
96
|
+
* @param odds - Array of Odds objects to append to the list
|
|
144
97
|
*/
|
|
145
|
-
export declare const
|
|
146
|
-
market?: Market;
|
|
147
|
-
}) | null>;
|
|
98
|
+
export declare const addOddsToOddsCache: (redis: Redis, gameMarketId: string, odds: Odds[]) => Promise<void>;
|
|
148
99
|
/**
|
|
149
|
-
*
|
|
100
|
+
* Get the latest odds for a specific gameMarketId
|
|
150
101
|
* @param redis - Redis client instance
|
|
102
|
+
* @param gameMarketId - The game market identifier
|
|
103
|
+
* @returns Latest Odds object or null if not found
|
|
151
104
|
*/
|
|
152
|
-
export declare const
|
|
105
|
+
export declare const getLatestOdds: (redis: Redis, gameMarketId: string) => Promise<Odds | null>;
|