@liberfi.io/react-predict 0.3.66 → 0.3.68

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/server.mjs CHANGED
@@ -84,6 +84,119 @@ function matchMarketsQueryKey(params) {
84
84
  async function fetchMatchMarketsPage(client, params) {
85
85
  return client.listMatchMarkets(params);
86
86
  }
87
+
88
+ // src/hooks/predict/sports.params.ts
89
+ function sportsTaxonomyQueryKey(params) {
90
+ return ["predict", "sports", "taxonomy", params];
91
+ }
92
+ function sportsMatchesQueryKey(params) {
93
+ return ["predict", "sports", "matches", params];
94
+ }
95
+ function sportsPropsQueryKey(params) {
96
+ return ["predict", "sports", "props", params];
97
+ }
98
+ function resolveSportsTaxonomyParams(params = {}) {
99
+ return { ...params, section: "sports" };
100
+ }
101
+ function resolveSportsMatchesParams(params = {}) {
102
+ return params;
103
+ }
104
+ function resolveSportsPropsParams(params = {}) {
105
+ return params;
106
+ }
107
+ async function fetchSportsTaxonomy(client, params) {
108
+ return client.getSportsTaxonomy(resolveSportsTaxonomyParams(params));
109
+ }
110
+ async function fetchSportsMatches(client, params) {
111
+ return client.getSportsMatches(resolveSportsMatchesParams(params));
112
+ }
113
+ async function fetchSportsProps(client, params) {
114
+ return client.getSportsProps(resolveSportsPropsParams(params));
115
+ }
116
+
117
+ // src/hooks/predict/esports.params.ts
118
+ function esportsTaxonomyQueryKey(params) {
119
+ return ["predict", "esports", "taxonomy", params];
120
+ }
121
+ function esportsMatchesQueryKey(params) {
122
+ return ["predict", "esports", "matches", params];
123
+ }
124
+ function esportsPropsQueryKey(params) {
125
+ return ["predict", "esports", "props", params];
126
+ }
127
+ function resolveEsportsTaxonomyParams(params = {}) {
128
+ return params;
129
+ }
130
+ function resolveEsportsMatchesParams(params = {}) {
131
+ return params;
132
+ }
133
+ function resolveEsportsPropsParams(params = {}) {
134
+ return params;
135
+ }
136
+ async function fetchEsportsTaxonomy(client, params) {
137
+ return client.getEsportsTaxonomy(resolveEsportsTaxonomyParams(params));
138
+ }
139
+ async function fetchEsportsMatches(client, params) {
140
+ return client.getEsportsMatches(resolveEsportsMatchesParams(params));
141
+ }
142
+ async function fetchEsportsProps(client, params) {
143
+ return client.getEsportsProps(resolveEsportsPropsParams(params));
144
+ }
145
+
146
+ // src/hooks/predict/sports-routing.params.ts
147
+ function sportsRoutingQueryKey(slug, params) {
148
+ return ["predict", "sports", "routing", slug, params];
149
+ }
150
+ function resolveSportsRoutingParams(params = {}) {
151
+ return params;
152
+ }
153
+ async function fetchSportsRouting(client, slug, params) {
154
+ return client.getSportsRouting(slug, resolveSportsRoutingParams(params));
155
+ }
156
+
157
+ // src/hooks/predict/sports-match-detail.params.ts
158
+ function sportsMatchDetailQueryKey(section, matchGroupSlug, params) {
159
+ return ["predict", section, "match-detail", matchGroupSlug, params];
160
+ }
161
+ function esportsMatchDetailQueryKey(matchGroupSlug, params) {
162
+ return sportsMatchDetailQueryKey("esports", matchGroupSlug, params);
163
+ }
164
+ function resolveSportsMatchDetailParams(params = {}) {
165
+ return params;
166
+ }
167
+ function resolveEsportsMatchDetailParams(params = {}) {
168
+ return params;
169
+ }
170
+ async function fetchSportsMatchDetail(client, section, matchGroupSlug, params) {
171
+ return client.getSportsMatchDetail(
172
+ section,
173
+ matchGroupSlug,
174
+ resolveSportsMatchDetailParams(params)
175
+ );
176
+ }
177
+ async function fetchEsportsMatchDetail(client, matchGroupSlug, params) {
178
+ return client.getEsportsMatchDetail(
179
+ matchGroupSlug,
180
+ resolveEsportsMatchDetailParams(params)
181
+ );
182
+ }
183
+
184
+ // src/hooks/predict/search.params.ts
185
+ function predictSearchQueryKey(params) {
186
+ return ["predict", "search-documents", params];
187
+ }
188
+ function resolvePredictSearchParams(params = {}) {
189
+ const q = params.q ?? "";
190
+ return {
191
+ ...params,
192
+ q,
193
+ sort_by: params.sort_by ?? (q ? "relevance" : "volume"),
194
+ sort_asc: params.sort_asc ?? (q ? void 0 : false)
195
+ };
196
+ }
197
+ async function fetchPredictSearch(client, params) {
198
+ return client.search(resolvePredictSearchParams(params));
199
+ }
87
200
  function buildQuery(params) {
88
201
  const qs = new URLSearchParams();
89
202
  for (const [key, value] of Object.entries(params)) {
@@ -161,6 +274,67 @@ var PredictClient = class {
161
274
  const url = `${this.endpoint}/api/v1/events/${encodeURIComponent(slug)}/similar${query}`;
162
275
  return await httpGet(url);
163
276
  }
277
+ // -------------------------------------------------------------------------
278
+ // Sports / esports
279
+ // -------------------------------------------------------------------------
280
+ /** Maps to `GET /api/v1/sports/taxonomy`. */
281
+ async getSportsTaxonomy(params) {
282
+ const query = buildQuery(params ?? {});
283
+ const url = `${this.endpoint}/api/v1/sports/taxonomy${query}`;
284
+ return await httpGet(url, this.requestOptions());
285
+ }
286
+ /** Maps to `GET /api/v1/sports/matches`. */
287
+ async getSportsMatches(params) {
288
+ const query = buildQuery(params ?? {});
289
+ const url = `${this.endpoint}/api/v1/sports/matches${query}`;
290
+ return await httpGet(url, this.requestOptions());
291
+ }
292
+ /** Maps to `GET /api/v1/sports/props`. */
293
+ async getSportsProps(params) {
294
+ const query = buildQuery(params ?? {});
295
+ const url = `${this.endpoint}/api/v1/sports/props${query}`;
296
+ return await httpGet(url, this.requestOptions());
297
+ }
298
+ /** Maps to `GET /api/v1/esports/taxonomy`. */
299
+ async getEsportsTaxonomy(params) {
300
+ const query = buildQuery(params ?? {});
301
+ const url = `${this.endpoint}/api/v1/esports/taxonomy${query}`;
302
+ return await httpGet(url, this.requestOptions());
303
+ }
304
+ /** Maps to `GET /api/v1/esports/matches`. */
305
+ async getEsportsMatches(params) {
306
+ const query = buildQuery(params ?? {});
307
+ const url = `${this.endpoint}/api/v1/esports/matches${query}`;
308
+ return await httpGet(url, this.requestOptions());
309
+ }
310
+ /** Maps to `GET /api/v1/esports/props`. */
311
+ async getEsportsProps(params) {
312
+ const query = buildQuery(params ?? {});
313
+ const url = `${this.endpoint}/api/v1/esports/props${query}`;
314
+ return await httpGet(url, this.requestOptions());
315
+ }
316
+ /** Maps to `GET /api/v1/sports/routing/:slug`. */
317
+ async getSportsRouting(slug, params) {
318
+ const query = buildQuery(params ?? {});
319
+ const url = `${this.endpoint}/api/v1/sports/routing/${encodeURIComponent(slug)}${query}`;
320
+ return await httpGet(url, this.requestOptions());
321
+ }
322
+ /** Maps to `GET /api/v1/sports/matches/:match_group_slug`. */
323
+ async getSportsMatchDetail(section, matchGroupSlug, params) {
324
+ const query = buildQuery(params ?? {});
325
+ const url = `${this.endpoint}/api/v1/${encodeURIComponent(section)}/matches/${encodeURIComponent(matchGroupSlug)}${query}`;
326
+ return await httpGet(url, this.requestOptions());
327
+ }
328
+ /** Convenience wrapper for `GET /api/v1/esports/matches/:match_group_slug`. */
329
+ async getEsportsMatchDetail(matchGroupSlug, params) {
330
+ return this.getSportsMatchDetail("esports", matchGroupSlug, params);
331
+ }
332
+ /** Maps to `GET /api/v1/search`. */
333
+ async search(params) {
334
+ const query = buildQuery(params ?? {});
335
+ const url = `${this.endpoint}/api/v1/search${query}`;
336
+ return await httpGet(url, this.requestOptions());
337
+ }
164
338
  /**
165
339
  * List comments for a prediction event.
166
340
  *
@@ -222,8 +396,9 @@ var PredictClient = class {
222
396
  return await httpGet(url);
223
397
  }
224
398
  /** Maps to `GET /api/v1/markets/:slug/price-history?source=...&range=...`. */
225
- async getPriceHistory(slug, source, range) {
226
- const query = buildQuery({ source, range });
399
+ async getPriceHistory(slug, sourceOrParams, range) {
400
+ const params = typeof sourceOrParams === "string" ? { source: sourceOrParams, range } : sourceOrParams;
401
+ const query = buildQuery(params);
227
402
  const url = `${this.endpoint}/api/v1/markets/${encodeURIComponent(slug)}/price-history${query}`;
228
403
  return await httpGet(url);
229
404
  }
@@ -1277,6 +1452,6 @@ function buildClobPayload(signedOrder, owner) {
1277
1452
  };
1278
1453
  }
1279
1454
 
1280
- export { CLOB_AUTH_DOMAIN, CLOB_AUTH_TYPES, CTF_EXCHANGE_ADDRESS, CTF_ORDER_TYPES, DEFAULT_PAGE_SIZE, NEG_RISK_CTF_EXCHANGE_ADDRESS, ORDER_TYPE, POLYGON_CHAIN_ID, PredictClient, PredictWsClient, SIDE, USDC_ADDRESS, buildClobAuthMessage, buildClobPayload, buildCtfExchangeDomain, buildOrderMessage, buildPolymarketL2Headers, buildSignedOrder, createPredictClient, createPredictWsClient, derivePolymarketApiKey, eventQueryKey, fetchEvent, fetchEventsPage, fetchMarket, fetchMatchMarketsPage, fetchMatchesPage, hmacSha256Base64, infiniteEventsQueryKey, marketQueryKey, matchMarketsQueryKey, matchQueryKey, matchesQueryKey, resolveEventsParams, resolveTagSlug };
1455
+ export { CLOB_AUTH_DOMAIN, CLOB_AUTH_TYPES, CTF_EXCHANGE_ADDRESS, CTF_ORDER_TYPES, DEFAULT_PAGE_SIZE, NEG_RISK_CTF_EXCHANGE_ADDRESS, ORDER_TYPE, POLYGON_CHAIN_ID, PredictClient, PredictWsClient, SIDE, USDC_ADDRESS, buildClobAuthMessage, buildClobPayload, buildCtfExchangeDomain, buildOrderMessage, buildPolymarketL2Headers, buildSignedOrder, createPredictClient, createPredictWsClient, derivePolymarketApiKey, esportsMatchDetailQueryKey, esportsMatchesQueryKey, esportsPropsQueryKey, esportsTaxonomyQueryKey, eventQueryKey, fetchEsportsMatchDetail, fetchEsportsMatches, fetchEsportsProps, fetchEsportsTaxonomy, fetchEvent, fetchEventsPage, fetchMarket, fetchMatchMarketsPage, fetchMatchesPage, fetchPredictSearch, fetchSportsMatchDetail, fetchSportsMatches, fetchSportsProps, fetchSportsRouting, fetchSportsTaxonomy, hmacSha256Base64, infiniteEventsQueryKey, marketQueryKey, matchMarketsQueryKey, matchQueryKey, matchesQueryKey, predictSearchQueryKey, resolveEsportsMatchDetailParams, resolveEsportsMatchesParams, resolveEsportsPropsParams, resolveEsportsTaxonomyParams, resolveEventsParams, resolvePredictSearchParams, resolveSportsMatchDetailParams, resolveSportsMatchesParams, resolveSportsPropsParams, resolveSportsRoutingParams, resolveSportsTaxonomyParams, resolveTagSlug, sportsMatchDetailQueryKey, sportsMatchesQueryKey, sportsPropsQueryKey, sportsRoutingQueryKey, sportsTaxonomyQueryKey };
1281
1456
  //# sourceMappingURL=server.mjs.map
1282
1457
  //# sourceMappingURL=server.mjs.map