@weekendgoals/weekendgoals-common 1.1744.20369243197 → 1.1745.20381107768

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.
@@ -0,0 +1,41 @@
1
+ export interface TheSportsDBVenueResult {
2
+ idVenue: string;
3
+ strVenue: string;
4
+ strVenueAlternate?: string;
5
+ strSport?: string;
6
+ strDescriptionEN?: string;
7
+ intCapacity?: string;
8
+ strCountry?: string;
9
+ strLocation?: string;
10
+ strTimezone?: string;
11
+ intFormedYear?: string;
12
+ strThumb?: string;
13
+ strLogo?: string;
14
+ strFanart1?: string;
15
+ strFanart2?: string;
16
+ strFanart3?: string;
17
+ strFanart4?: string;
18
+ strMap?: string;
19
+ strWebsite?: string;
20
+ }
21
+ export interface TheSportsDBSearchResponse {
22
+ venues: TheSportsDBVenueResult[] | null;
23
+ }
24
+ export declare class TheSportsDBClient {
25
+ private client;
26
+ private apiKey;
27
+ constructor(apiKey?: string);
28
+ /**
29
+ * Search for a venue by name
30
+ * @param venueName The name of the venue to search for
31
+ * @returns The first matching venue or null if not found
32
+ */
33
+ searchVenueByName(venueName: string): Promise<TheSportsDBVenueResult | null>;
34
+ /**
35
+ * Get the best available image URL for a venue
36
+ * Priority: strThumb > strLogo > strFanart1
37
+ */
38
+ getBestImageUrl(venue: TheSportsDBVenueResult): string | null;
39
+ }
40
+ export declare function createTheSportsDBClient(apiKey?: string): TheSportsDBClient;
41
+ //# sourceMappingURL=thesportsdb-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thesportsdb-client.d.ts","sourceRoot":"","sources":["../../../src/providers/thesportsdb/thesportsdb-client.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,sBAAsB,EAAE,GAAG,IAAI,CAAC;CACzC;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,GAAE,MAAc;IAWlC;;;;OAIG;IACG,iBAAiB,CACrB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC;IA0CzC;;;OAGG;IACH,eAAe,CAAC,KAAK,EAAE,sBAAsB,GAAG,MAAM,GAAG,IAAI;CAG9D;AAED,wBAAgB,uBAAuB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAE1E"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.TheSportsDBClient = void 0;
13
+ exports.createTheSportsDBClient = createTheSportsDBClient;
14
+ const axios_1 = require("axios");
15
+ const retry = require("async-retry");
16
+ class TheSportsDBClient {
17
+ constructor(apiKey = "123") {
18
+ this.apiKey = apiKey;
19
+ this.client = axios_1.default.create({
20
+ baseURL: "https://www.thesportsdb.com/api/v1/json",
21
+ timeout: 10000,
22
+ headers: {
23
+ "User-Agent": "WeekendGoals/1.0 (contact@weekendgoals.com)",
24
+ },
25
+ });
26
+ }
27
+ /**
28
+ * Search for a venue by name
29
+ * @param venueName The name of the venue to search for
30
+ * @returns The first matching venue or null if not found
31
+ */
32
+ searchVenueByName(venueName) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ var _a;
35
+ try {
36
+ const response = yield retry(() => __awaiter(this, void 0, void 0, function* () {
37
+ const result = yield this.client.get(`/${this.apiKey}/searchvenues.php`, {
38
+ params: {
39
+ v: venueName,
40
+ },
41
+ });
42
+ return result;
43
+ }), {
44
+ retries: 2,
45
+ factor: 2,
46
+ minTimeout: 1000,
47
+ maxTimeout: 3000,
48
+ onRetry: (error, attempt) => {
49
+ console.log(`TheSportsDB request failed, attempt ${attempt}:`, error.message);
50
+ },
51
+ });
52
+ if (((_a = response.data) === null || _a === void 0 ? void 0 : _a.venues) && response.data.venues.length > 0) {
53
+ return response.data.venues[0];
54
+ }
55
+ return null;
56
+ }
57
+ catch (error) {
58
+ console.error(`Failed to search venue "${venueName}" in TheSportsDB:`, error.message);
59
+ return null;
60
+ }
61
+ });
62
+ }
63
+ /**
64
+ * Get the best available image URL for a venue
65
+ * Priority: strThumb > strLogo > strFanart1
66
+ */
67
+ getBestImageUrl(venue) {
68
+ return venue.strThumb || venue.strLogo || venue.strFanart1 || null;
69
+ }
70
+ }
71
+ exports.TheSportsDBClient = TheSportsDBClient;
72
+ function createTheSportsDBClient(apiKey) {
73
+ return new TheSportsDBClient(apiKey);
74
+ }
75
+ //# sourceMappingURL=thesportsdb-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thesportsdb-client.js","sourceRoot":"","sources":["../../../src/providers/thesportsdb/thesportsdb-client.ts"],"names":[],"mappings":";;;;;;;;;;;;AAqGA,0DAEC;AAvGD,iCAA6C;AAC7C,qCAAqC;AA2BrC,MAAa,iBAAiB;IAI5B,YAAY,SAAiB,KAAK;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,eAAK,CAAC,MAAM,CAAC;YACzB,OAAO,EAAE,yCAAyC;YAClD,OAAO,EAAE,KAAK;YACd,OAAO,EAAE;gBACP,YAAY,EAAE,6CAA6C;aAC5D;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACG,iBAAiB,CACrB,SAAiB;;;YAEjB,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,GAAS,EAAE;oBACT,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAClC,IAAI,IAAI,CAAC,MAAM,mBAAmB,EAClC;wBACE,MAAM,EAAE;4BACN,CAAC,EAAE,SAAS;yBACb;qBACF,CACF,CAAC;oBACF,OAAO,MAAM,CAAC;gBAChB,CAAC,CAAA,EACD;oBACE,OAAO,EAAE,CAAC;oBACV,MAAM,EAAE,CAAC;oBACT,UAAU,EAAE,IAAI;oBAChB,UAAU,EAAE,IAAI;oBAChB,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;wBAC1B,OAAO,CAAC,GAAG,CACT,uCAAuC,OAAO,GAAG,EACjD,KAAK,CAAC,OAAO,CACd,CAAC;oBACJ,CAAC;iBACF,CACF,CAAC;gBAEF,IAAI,CAAA,MAAA,QAAQ,CAAC,IAAI,0CAAE,MAAM,KAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC7D,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBACjC,CAAC;gBAED,OAAO,IAAI,CAAC;YACd,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CACX,2BAA2B,SAAS,mBAAmB,EACvD,KAAK,CAAC,OAAO,CACd,CAAC;gBACF,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;KAAA;IAED;;;OAGG;IACH,eAAe,CAAC,KAA6B;QAC3C,OAAO,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC;IACrE,CAAC;CACF;AAvED,8CAuEC;AAED,SAAgB,uBAAuB,CAAC,MAAe;IACrD,OAAO,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC;AACvC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weekendgoals/weekendgoals-common",
3
- "version": "1.1744.20369243197",
3
+ "version": "1.1745.20381107768",
4
4
  "description": "Weekend Goals Common",
5
5
  "private": false,
6
6
  "files": [