@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.
Files changed (57) hide show
  1. package/dist/core/config/urls.js +4 -4
  2. package/dist/core/config/urls.js.map +1 -1
  3. package/dist/core/utils/game.utils.d.ts +2 -0
  4. package/dist/core/utils/game.utils.js +69 -1
  5. package/dist/core/utils/game.utils.js.map +1 -1
  6. package/dist/server/oracle/config/game-periods/providers/lsports.periods.js +3 -3
  7. package/dist/server/oracle/config/game-periods/providers/lsports.periods.js.map +1 -1
  8. package/dist/server/oracle/config/game-periods/providers/optic-odds.periods.d.ts +4 -27
  9. package/dist/server/oracle/config/game-periods/providers/optic-odds.periods.js +4 -27
  10. package/dist/server/oracle/config/game-periods/providers/optic-odds.periods.js.map +1 -1
  11. package/dist/server/oracle/config/game-periods/sports.config.js +8 -73
  12. package/dist/server/oracle/config/game-periods/sports.config.js.map +1 -1
  13. package/dist/server/oracle/config/game-periods/types.d.ts +2 -6
  14. package/dist/server/oracle/config/game-periods/types.js +0 -1
  15. package/dist/server/oracle/config/game-periods/types.js.map +1 -1
  16. package/dist/server/oracle/redis-cache-manager/cache.keys.utils.d.ts +45 -74
  17. package/dist/server/oracle/redis-cache-manager/cache.keys.utils.js +65 -120
  18. package/dist/server/oracle/redis-cache-manager/cache.keys.utils.js.map +1 -1
  19. package/dist/server/oracle/redis-cache-manager/game.query.engine.d.ts +90 -0
  20. package/dist/server/oracle/redis-cache-manager/game.query.engine.js +436 -0
  21. package/dist/server/oracle/redis-cache-manager/game.query.engine.js.map +1 -0
  22. package/dist/server/oracle/redis-cache-manager/index.d.ts +2 -3
  23. package/dist/server/oracle/redis-cache-manager/index.js +2 -3
  24. package/dist/server/oracle/redis-cache-manager/index.js.map +1 -1
  25. package/dist/server/oracle/redis-cache-manager/market.query.engine.d.ts +50 -97
  26. package/dist/server/oracle/redis-cache-manager/market.query.engine.js +310 -467
  27. package/dist/server/oracle/redis-cache-manager/market.query.engine.js.map +1 -1
  28. package/dist/server/oracle/types/providers/game-clock/index.d.ts +1 -1
  29. package/dist/server/oracle/types/providers/game-clock/index.js +1 -1
  30. package/dist/server/oracle/types/providers/game-clock/index.js.map +1 -1
  31. package/dist/server/{utils/game_progress → oracle/types/providers/game-clock}/parser.d.ts +7 -1
  32. package/dist/server/{utils/game_progress → oracle/types/providers/game-clock}/parser.js +13 -2
  33. package/dist/server/oracle/types/providers/game-clock/parser.js.map +1 -0
  34. package/dist/server/utils/index.d.ts +0 -1
  35. package/dist/server/utils/index.js +0 -1
  36. package/dist/server/utils/index.js.map +1 -1
  37. package/package.json +5 -4
  38. package/scripts/setup-prisma.js +0 -0
  39. package/dist/server/oracle/redis-cache-manager/game.cache.service.d.ts +0 -185
  40. package/dist/server/oracle/redis-cache-manager/game.cache.service.js +0 -712
  41. package/dist/server/oracle/redis-cache-manager/game.cache.service.js.map +0 -1
  42. package/dist/server/oracle/redis-cache-manager/game.progress.d.ts +0 -4
  43. package/dist/server/oracle/redis-cache-manager/game.progress.js +0 -27
  44. package/dist/server/oracle/redis-cache-manager/game.progress.js.map +0 -1
  45. package/dist/server/oracle/redis-cache-manager/market.cache.service.d.ts +0 -87
  46. package/dist/server/oracle/redis-cache-manager/market.cache.service.js +0 -139
  47. package/dist/server/oracle/redis-cache-manager/market.cache.service.js.map +0 -1
  48. package/dist/server/utils/game_progress/caclulate.game.progress.d.ts +0 -6
  49. package/dist/server/utils/game_progress/caclulate.game.progress.js +0 -96
  50. package/dist/server/utils/game_progress/caclulate.game.progress.js.map +0 -1
  51. package/dist/server/utils/game_progress/game.utils.d.ts +0 -2
  52. package/dist/server/utils/game_progress/game.utils.js +0 -64
  53. package/dist/server/utils/game_progress/game.utils.js.map +0 -1
  54. package/dist/server/utils/game_progress/index.d.ts +0 -3
  55. package/dist/server/utils/game_progress/index.js +0 -20
  56. package/dist/server/utils/game_progress/index.js.map +0 -1
  57. package/dist/server/utils/game_progress/parser.js.map +0 -1
@@ -1,153 +1,98 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @memberof RedisCacheKeysUtils
4
- * @description Key for storing the mapping of fixture ids to levr ids in redis
5
- *
4
+ * Redis cache key constants and helper functions
6
5
  */
7
6
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.market_index_name = exports.getMarketKeyWithGameUniqueIdMarketType = exports.getRevokedApiKey = exports.getGamesKeyByChainId = exports.getCompletedMarketsField = exports.getCompletedMarketsKey = exports.getGameToMarketsOfOddsInCacheKey = exports.getMarketOddsByGameUniqueIdKeyAndMarketType = exports.getMarketOddsByMarketIdKey = exports.getLevrFixtureIdToProviderIdsKey = exports.getProviderIdsToLevrFixtureIdKey = exports.getMarketOddsField = exports.getCachedLevrByFixtureIdKey = exports.getCacheLevrGameIdKey = exports.getMoneylineByGameIdKey = exports.cacheTimeInvalidation = exports.marketByGameUniqueIdKeyAndMarketType = exports.marketByMarketIdKey = exports.marketOddsKey = exports.baseBallGamePeriodInfo = exports.gameToMarketOfOddsInCache = exports.levrGames = exports.getGameScoreByFixtureIdHash = exports.gameIdsToFixtureIds = exports.gameIdsToLevrFixtureIdsMap = exports.schedulesHash = exports.RedisNumStates = exports.GameCollectionKeys = exports.queueBlockHashKey = exports.levrIdToProviderIds = exports.providerFixtureIdToLevrId = void 0;
9
- exports.providerFixtureIdToLevrId = "provider_fixture_id_to_levrId";
10
- exports.levrIdToProviderIds = "levr_id_to_provider_ids";
11
- exports.queueBlockHashKey = "queue_block_key";
12
- var GameCollectionKeys;
13
- (function (GameCollectionKeys) {
14
- GameCollectionKeys["activeGamesHash"] = "active_games_hash";
15
- GameCollectionKeys["postGamesHash"] = "post_games_hash";
16
- })(GameCollectionKeys || (exports.GameCollectionKeys = GameCollectionKeys = {}));
7
+ exports.getGamesKeyByChainId = exports.getMarketOddsListHashKey = exports.getMarketOddsField = exports.getCachedLevrByFixtureIdKey = exports.marketOddsKey = exports.gameToMarketOfOddsInCache = exports.getGameScoreByFixtureIdHash = exports.gameIdsToFixtureIds = exports.gameIdsToLevrFixtureIdsMap = exports.GameCollectionKeys = exports.queueBlockHashKey = exports.levrIdToProviderIds = exports.providerFixtureIdToLevrId = exports.getMarketKeyWithGameUniqueIdMarketType = exports.getOddsListKey = exports.getGameHashKey = exports.getScoreHashKey = exports.RedisNumStates = exports.game_index_name = exports.market_index_name = exports.levrOddsListKey = exports.levrMarketsHashKey = exports.levrGamesHashKey = void 0;
8
+ // =====================================================
9
+ // ACTIVE KEYS
10
+ // =====================================================
11
+ // Redis hash key prefixes
12
+ exports.levrGamesHashKey = "levr:games:"; // redis hash for games
13
+ exports.levrMarketsHashKey = "levr:markets:"; // redis hash for markets
14
+ exports.levrOddsListKey = "levr:odds:list:"; // redis list for odds
15
+ // Cache Index Names
16
+ exports.market_index_name = "levr:markets_idx";
17
+ exports.game_index_name = "levr:games_idx";
18
+ // Enums
17
19
  var RedisNumStates;
18
20
  (function (RedisNumStates) {
19
21
  RedisNumStates[RedisNumStates["success"] = 1] = "success";
20
22
  RedisNumStates[RedisNumStates["failure"] = 0] = "failure";
21
23
  })(RedisNumStates || (exports.RedisNumStates = RedisNumStates = {}));
22
- exports.schedulesHash = "schedules_hash";
23
- exports.gameIdsToLevrFixtureIdsMap = "game_ids_to_levr_ids";
24
+ // Score cache key prefix
25
+ const levrScoresKey = "levr:scores:";
24
26
  /**
25
- * @memberof RedisCacheKeysUtils
26
- * @description Key for storing the mapping of levr ids to fixture ids in redis
27
+ * Get the Redis key for a game score by gameObjectId
28
+ * @param gameObjectId - The game object ID
29
+ * @returns Redis key for the score
27
30
  */
28
- exports.gameIdsToFixtureIds = "game_ids_to_fixture_ids";
31
+ const getScoreHashKey = (gameObjectId) => `${levrScoresKey}${gameObjectId}`;
32
+ exports.getScoreHashKey = getScoreHashKey;
29
33
  /**
30
- * @memberof RedisCacheKeysUtils
31
- * @description stores the list moneylines for the given gameId appended to it
34
+ * Get the Redis hash key for a game by gameObjectId
32
35
  */
33
- const moneyLineByGameId = "moneyline_by_game_Id_";
36
+ const getGameHashKey = (gameObjectId) => `${exports.levrGamesHashKey}${gameObjectId}`;
37
+ exports.getGameHashKey = getGameHashKey;
34
38
  /**
35
- * @memberof RedisCacheKeysUtils
36
- * @description stores the list of scores for the given gameId appended to it
39
+ * Get the Redis LIST key for odds by gameMarketId
40
+ * @param gameMarketId - The game market identifier
41
+ * @returns Redis key for the odds list
37
42
  */
38
- exports.getGameScoreByFixtureIdHash = "game_scores_by_fixture_id_hash";
43
+ const getOddsListKey = (gameMarketId) => `${exports.levrOddsListKey}${gameMarketId}`;
44
+ exports.getOddsListKey = getOddsListKey;
39
45
  /**
40
- * @memberof RedisCacheKeysUtils
41
- * @description stores the list of all levr games in cache
46
+ * Get the Redis hash key for market by gameUniqueId and marketType
42
47
  */
43
- exports.levrGames = "levr_games";
44
- /**
45
- * @memberof RedisCacheKeysUtils
46
- * @description stores the levr game for the given gameId appended to it
47
-
48
- *
49
- */
50
- const levrGame = "levr_game_";
48
+ const getMarketKeyWithGameUniqueIdMarketType = (gameUniqueId, marketType) => {
49
+ return `${exports.levrMarketsHashKey}${gameUniqueId}:${marketType}`;
50
+ };
51
+ exports.getMarketKeyWithGameUniqueIdMarketType = getMarketKeyWithGameUniqueIdMarketType;
52
+ // =====================================================
53
+ // REDUNDANT KEYS - No longer used after game.cache.service removal
54
+ // TODO: Remove once confirmed not needed elsewhere
55
+ // =====================================================
56
+ /** @deprecated Not used after game.cache.service removal */
57
+ exports.providerFixtureIdToLevrId = "provider_fixture_id_to_levrId";
58
+ /** @deprecated Not used after game.cache.service removal */
59
+ exports.levrIdToProviderIds = "levr_id_to_provider_ids";
60
+ /** @deprecated Not used after game.cache.service removal */
61
+ exports.queueBlockHashKey = "queue_block_key";
62
+ /** @deprecated Not used after game.cache.service removal */
63
+ var GameCollectionKeys;
64
+ (function (GameCollectionKeys) {
65
+ GameCollectionKeys["activeGamesHash"] = "active_games_hash";
66
+ GameCollectionKeys["postGamesHash"] = "post_games_hash";
67
+ })(GameCollectionKeys || (exports.GameCollectionKeys = GameCollectionKeys = {}));
68
+ /** @deprecated Not used after game.cache.service removal */
69
+ exports.gameIdsToLevrFixtureIdsMap = "game_ids_to_levr_ids";
70
+ /** @deprecated Not used after game.cache.service removal */
71
+ exports.gameIdsToFixtureIds = "game_ids_to_fixture_ids";
72
+ /** @deprecated Not used after game.cache.service removal - replaced by getScoreHashKey */
73
+ exports.getGameScoreByFixtureIdHash = "game_scores_by_fixture_id_hash";
74
+ /** @deprecated Not used after game.cache.service removal */
51
75
  exports.gameToMarketOfOddsInCache = "game_to_market_ids_of_odds_in_cache_";
52
- /**
53
- * @memberof RedisCacheKeysUtils
54
- * @description stores the game period info for the given gameId appended to it
55
- * @example {
56
- * gameId: 1,
57
- * period: 1,
58
- * timeUpdated: 1714857600
59
- * }
60
- */
61
- exports.baseBallGamePeriodInfo = "baseball_game_period_info";
62
- /**
63
- * @memberof RedisCacheKeysUtils
64
- * @description stores the full time odds for the given gameId appended to it
65
- * @example {
66
- * gameId: 1,
67
- * odds:
68
- * }
69
- */
76
+ /** @deprecated Not used after game.cache.service removal */
70
77
  exports.marketOddsKey = "market_odds";
71
- exports.marketByMarketIdKey = "market_by_market_id_";
72
- exports.marketByGameUniqueIdKeyAndMarketType = "market_by_game_unique_id_";
73
- /**
74
- * @memberof RedisCacheKeysUtils
75
- * @description stores the time invalidation for the cache
76
- */
77
- exports.cacheTimeInvalidation = 60; // 1 minute.
78
- /** @audit levr fixture ids must be the same for games across all chains */
79
- /**
80
- * @memberof RedisCacheKeysUtils
81
- * @param gameId
82
- * @returns
83
- */
84
- const getMoneylineByGameIdKey = (gameId) => {
85
- return `${moneyLineByGameId}${gameId.toString()}`;
86
- };
87
- exports.getMoneylineByGameIdKey = getMoneylineByGameIdKey;
88
- /**
89
- * @memberof RedisCacheKeysUtils
90
- * @param gameId
91
- * @returns
92
- */
93
- const getCacheLevrGameIdKey = (gameId) => {
94
- return `${levrGame}${gameId.toString()}`;
95
- };
96
- exports.getCacheLevrGameIdKey = getCacheLevrGameIdKey;
97
- /**
98
- * @memberof RedisCacheKeysUtils
99
- * @param fixtureId
100
- * @returns
101
- */
78
+ /** @deprecated Not used after game.cache.service removal */
79
+ const levrGame = "levr_game_";
80
+ /** @deprecated Not used after game.cache.service removal */
102
81
  const getCachedLevrByFixtureIdKey = (fixtureId, chainId) => {
103
82
  return `${levrGame}${fixtureId}_${chainId.toString()}`;
104
83
  };
105
84
  exports.getCachedLevrByFixtureIdKey = getCachedLevrByFixtureIdKey;
85
+ /** @deprecated Not used after game.cache.service removal */
106
86
  const getMarketOddsField = (gameUniqueId, marketType) => {
107
87
  return `${gameUniqueId}:${marketType}`;
108
88
  };
109
89
  exports.getMarketOddsField = getMarketOddsField;
110
- const getProviderIdsToLevrFixtureIdKey = (providerId) => {
111
- return `${exports.providerFixtureIdToLevrId}${providerId}`;
112
- };
113
- exports.getProviderIdsToLevrFixtureIdKey = getProviderIdsToLevrFixtureIdKey;
114
- const getLevrFixtureIdToProviderIdsKey = (levrFixtureId) => {
115
- return `${exports.levrIdToProviderIds}${levrFixtureId}`;
116
- };
117
- exports.getLevrFixtureIdToProviderIdsKey = getLevrFixtureIdToProviderIdsKey;
118
- const getMarketOddsByMarketIdKey = (marketId) => {
119
- return `${exports.marketByMarketIdKey}${marketId}`;
120
- };
121
- exports.getMarketOddsByMarketIdKey = getMarketOddsByMarketIdKey;
122
- const getMarketOddsByGameUniqueIdKeyAndMarketType = (gameUniqueId) => {
123
- return `${exports.marketByGameUniqueIdKeyAndMarketType}${gameUniqueId}`;
124
- };
125
- exports.getMarketOddsByGameUniqueIdKeyAndMarketType = getMarketOddsByGameUniqueIdKeyAndMarketType;
126
- const getGameToMarketsOfOddsInCacheKey = (gameUniqueId) => {
127
- return `${exports.gameToMarketOfOddsInCache}${gameUniqueId}`;
128
- };
129
- exports.getGameToMarketsOfOddsInCacheKey = getGameToMarketsOfOddsInCacheKey;
130
- const getCompletedMarketsKey = (marketType) => {
131
- return `completed_markets:${marketType}`;
132
- };
133
- exports.getCompletedMarketsKey = getCompletedMarketsKey;
134
- const getCompletedMarketsField = (gameUniqueId, marketType) => {
135
- return `${gameUniqueId}:${marketType}:completed`;
136
- };
137
- exports.getCompletedMarketsField = getCompletedMarketsField;
90
+ /** @deprecated Not used after game.cache.service removal */
91
+ const getMarketOddsListHashKey = (marketObjectId) => `${exports.levrOddsListKey}${marketObjectId}`;
92
+ exports.getMarketOddsListHashKey = getMarketOddsListHashKey;
93
+ /** @deprecated Not used after game.cache.service removal */
138
94
  const getGamesKeyByChainId = (gameCollectionKey, chainId) => {
139
95
  return `${gameCollectionKey}_${chainId.toString()}`;
140
96
  };
141
97
  exports.getGamesKeyByChainId = getGamesKeyByChainId;
142
- // auth
143
- const getRevokedApiKey = (keyId) => {
144
- return `revoked:${keyId}`;
145
- };
146
- exports.getRevokedApiKey = getRevokedApiKey;
147
- /// new key
148
- const getMarketKeyWithGameUniqueIdMarketType = (gameUniqueId, marketType) => {
149
- return `markets_unique_id:${gameUniqueId}:${marketType}`;
150
- };
151
- exports.getMarketKeyWithGameUniqueIdMarketType = getMarketKeyWithGameUniqueIdMarketType;
152
- exports.market_index_name = "markets_unique_id_idx";
153
98
  //# sourceMappingURL=cache.keys.utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cache.keys.utils.js","sourceRoot":"","sources":["../../../../src/server/oracle/redis-cache-manager/cache.keys.utils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAIU,QAAA,yBAAyB,GAAG,+BAA+B,CAAA;AAE3D,QAAA,mBAAmB,GAAG,yBAAyB,CAAA;AAE/C,QAAA,iBAAiB,GAAG,iBAAiB,CAAA;AAElD,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC1B,2DAAqC,CAAA;IACrC,uDAAiC,CAAA;AACrC,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B;AAED,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,yDAAW,CAAA;IACX,yDAA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pD,CAAC,CAAA;AAFY,QAAA,wBAAwB,4BAEpC;AAEM,MAAM,oBAAoB,GAAG,CAAC,iBAAqC,EAAE,OAAe,EAAU,EAAE;IACnG,OAAO,GAAG,iBAAiB,IAAI,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAA;AACvD,CAAC,CAAA;AAFY,QAAA,oBAAoB,wBAEhC;AAED,OAAO;AAEA,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAU,EAAE;IACtD,OAAO,WAAW,KAAK,EAAE,CAAA;AAC7B,CAAC,CAAA;AAFY,QAAA,gBAAgB,oBAE5B;AAED,WAAW;AACJ,MAAM,sCAAsC,GAAG,CAAC,YAAoB,EAAE,UAAsB,EAAU,EAAE;IAC3G,OAAO,qBAAqB,YAAY,IAAI,UAAU,EAAE,CAAA;AAC5D,CAAC,CAAA;AAFY,QAAA,sCAAsC,0CAElD;AAEY,QAAA,iBAAiB,GAAG,uBAAuB,CAAA"}
1
+ {"version":3,"file":"cache.keys.utils.js","sourceRoot":"","sources":["../../../../src/server/oracle/redis-cache-manager/cache.keys.utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,wDAAwD;AACxD,cAAc;AACd,wDAAwD;AAExD,0BAA0B;AACb,QAAA,gBAAgB,GAAG,aAAa,CAAA,CAAC,uBAAuB;AACxD,QAAA,kBAAkB,GAAG,eAAe,CAAA,CAAC,yBAAyB;AAC9D,QAAA,eAAe,GAAG,iBAAiB,CAAA,CAAC,sBAAsB;AAEvE,oBAAoB;AACP,QAAA,iBAAiB,GAAG,kBAAkB,CAAA;AACtC,QAAA,eAAe,GAAG,gBAAgB,CAAA;AAE/C,QAAQ;AACR,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,yDAAW,CAAA;IACX,yDAAW,CAAA;AACf,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED,yBAAyB;AACzB,MAAM,aAAa,GAAG,cAAc,CAAA;AAEpC;;;;GAIG;AACI,MAAM,eAAe,GAAG,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MAAM,QAAQ,GAAG,YAAY,CAAA;AAE7B,4DAA4D;AACrD,MAAM,2BAA2B,GAAG,CAAC,SAAiB,EAAE,OAAe,EAAU,EAAE;IACtF,OAAO,GAAG,QAAQ,GAAG,SAAS,IAAI,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAA;AAC1D,CAAC,CAAA;AAFY,QAAA,2BAA2B,+BAEvC;AAED,4DAA4D;AACrD,MAAM,kBAAkB,GAAG,CAAC,YAAoB,EAAE,UAAsB,EAAU,EAAE;IACvF,OAAO,GAAG,YAAY,IAAI,UAAU,EAAE,CAAA;AAC1C,CAAC,CAAA;AAFY,QAAA,kBAAkB,sBAE9B;AAED,4DAA4D;AACrD,MAAM,wBAAwB,GAAG,CAAC,cAAsB,EAAE,EAAE,CAAC,GAAG,uBAAe,GAAG,cAAc,EAAE,CAAA;AAA5F,QAAA,wBAAwB,4BAAoE;AAEzG,4DAA4D;AACrD,MAAM,oBAAoB,GAAG,CAAC,iBAAqC,EAAE,OAAe,EAAU,EAAE;IACnG,OAAO,GAAG,iBAAiB,IAAI,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAA;AACvD,CAAC,CAAA;AAFY,QAAA,oBAAoB,wBAEhC"}
@@ -0,0 +1,90 @@
1
+ import type { LevrGame } from "@prisma/client";
2
+ import type { Redis } from "ioredis";
3
+ import type { LevrScores } from "../../../core";
4
+ export interface GameSearchQuery {
5
+ gameId?: number;
6
+ objectId?: string;
7
+ gamePhase?: string;
8
+ sportGroup?: string;
9
+ levrFixtureId?: string;
10
+ opticOddsFixtureId?: string;
11
+ liveScoreMatchId?: string;
12
+ tournamentObjectId?: string;
13
+ leagueObjectId?: string;
14
+ fixtureObjectId?: string;
15
+ paused?: 0 | 1;
16
+ lsportsFixtureId?: number;
17
+ chainId?: number;
18
+ limit?: number;
19
+ offset?: number;
20
+ }
21
+ /**
22
+ * Create game index with proper schema.
23
+ * Validates existing index schema and recreates if schema has changed.
24
+ */
25
+ export declare const createGameIndex: (redis: Redis) => Promise<void>;
26
+ export interface UpdateGameCacheResult {
27
+ success: number;
28
+ failed: string[];
29
+ total: number;
30
+ }
31
+ /**
32
+ * Updates the Redis cache with an array of LevrGame objects using pipelined batch operations.
33
+ *
34
+ * @param redis - The Redis client instance used for cache operations
35
+ * @param games - An array of LevrGame objects to be cached
36
+ * @returns A Promise resolving to UpdateGameCacheResult with success/failure counts
37
+ *
38
+ * @remarks
39
+ * This function uses Redis pipelining to efficiently batch multiple HSET operations,
40
+ * reducing network round trips. Large arrays are chunked to avoid memory/timeout issues.
41
+ * Each game is stored as a Redis hash with a key generated from the game's objectId.
42
+ * Date fields are converted to timestamps, booleans to "1"/"0" strings, and numbers to strings.
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * const redis = new Redis();
47
+ * const games: LevrGame[] = [...];
48
+ * const result = await updateGameCache(redis, games);
49
+ * console.log(`Updated ${result.success}/${result.total} games`);
50
+ * ```
51
+ */
52
+ export declare const updateGameCache: (redis: Redis, games: LevrGame[]) => Promise<UpdateGameCacheResult>;
53
+ /**
54
+ * Set a game score in the Redis cache
55
+ * @param redis - Redis client instance
56
+ * @param gameObjectId - The game object ID to key the score
57
+ * @param score - The LevrScores object to cache
58
+ */
59
+ export declare const setScoreCache: (redis: Redis, gameObjectId: string, score: LevrScores) => Promise<void>;
60
+ /**
61
+ * Get a game score from the Redis cache
62
+ * @param redis - Redis client instance
63
+ * @param gameObjectId - The game object ID to retrieve
64
+ * @returns The LevrScores object or null if not found
65
+ */
66
+ export declare const getScoreCache: (redis: Redis, gameObjectId: string) => Promise<LevrScores | null>;
67
+ /**
68
+ * Get multiple game scores from the Redis cache
69
+ * @param redis - Redis client instance
70
+ * @param gameObjectIds - Array of game object IDs to retrieve
71
+ * @returns Map of gameObjectId to LevrScores
72
+ */
73
+ export declare const getScoresCacheBatch: (redis: Redis, gameObjectIds: string[]) => Promise<Map<string, LevrScores>>;
74
+ export interface GameSearchResult {
75
+ games: LevrGame[];
76
+ total: number;
77
+ error?: string;
78
+ }
79
+ export declare const searchGames: (redis: Redis, params: GameSearchQuery) => Promise<GameSearchResult>;
80
+ export interface DropIndicesResult {
81
+ dropped: string[];
82
+ notFound: string[];
83
+ failed: string[];
84
+ }
85
+ /**
86
+ * Drop game search index
87
+ * @param redis - Redis client instance
88
+ * @returns Result object with dropped, notFound, and failed indices
89
+ */
90
+ export declare const dropGameIndex: (redis: Redis) => Promise<DropIndicesResult>;