@zivue/zuuid 0.2.1 → 0.2.3
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/CHANGELOG.md +15 -0
- package/README.md +104 -16
- package/dist/client.d.ts +31 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +90 -0
- package/dist/identity.d.ts +1 -1
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/providers/gamesdb/client.d.ts +19 -0
- package/dist/providers/gamesdb/client.d.ts.map +1 -0
- package/dist/providers/gamesdb/client.js +57 -0
- package/dist/providers/gamesdb/constants.d.ts +2 -0
- package/dist/providers/gamesdb/constants.d.ts.map +1 -1
- package/dist/providers/gamesdb/constants.js +2 -0
- package/dist/providers/gamesdb/game.d.ts +7 -5
- package/dist/providers/gamesdb/game.d.ts.map +1 -1
- package/dist/providers/gamesdb/game.js +203 -22
- package/dist/providers/gamesdb/index.d.ts +2 -0
- package/dist/providers/gamesdb/index.d.ts.map +1 -1
- package/dist/providers/gamesdb/index.js +2 -0
- package/dist/providers/gamesdb/platform.d.ts +5 -2
- package/dist/providers/gamesdb/platform.d.ts.map +1 -1
- package/dist/providers/gamesdb/platform.js +87 -4
- package/dist/providers/gamesdb/types.d.ts +21 -0
- package/dist/providers/gamesdb/types.d.ts.map +1 -0
- package/dist/providers/gamesdb/types.js +1 -0
- package/dist/providers/imdb/client.d.ts +17 -0
- package/dist/providers/imdb/client.d.ts.map +1 -0
- package/dist/providers/imdb/client.js +31 -0
- package/dist/providers/imdb/constants.d.ts +5 -0
- package/dist/providers/imdb/constants.d.ts.map +1 -0
- package/dist/providers/imdb/constants.js +4 -0
- package/dist/providers/imdb/index.d.ts +4 -0
- package/dist/providers/imdb/index.d.ts.map +1 -0
- package/dist/providers/imdb/index.js +3 -0
- package/dist/providers/imdb/movie.d.ts +16 -0
- package/dist/providers/imdb/movie.d.ts.map +1 -0
- package/dist/providers/imdb/movie.js +228 -0
- package/dist/providers/imdb/types.d.ts +12 -0
- package/dist/providers/imdb/types.d.ts.map +1 -0
- package/dist/providers/imdb/types.js +1 -0
- package/dist/providers/musicbrainz/client.d.ts +41 -0
- package/dist/providers/musicbrainz/client.d.ts.map +1 -0
- package/dist/providers/musicbrainz/client.js +169 -0
- package/dist/providers/musicbrainz/constants.d.ts +2 -0
- package/dist/providers/musicbrainz/constants.d.ts.map +1 -1
- package/dist/providers/musicbrainz/constants.js +2 -0
- package/dist/providers/musicbrainz/index.d.ts +2 -0
- package/dist/providers/musicbrainz/index.d.ts.map +1 -1
- package/dist/providers/musicbrainz/index.js +2 -0
- package/dist/providers/musicbrainz/types.d.ts +21 -0
- package/dist/providers/musicbrainz/types.d.ts.map +1 -0
- package/dist/providers/musicbrainz/types.js +1 -0
- package/dist/providers/tmdb/tv.d.ts.map +1 -1
- package/dist/providers/tmdb/tv.js +0 -1
- package/package.json +17 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.3 - 2026-05-25
|
|
4
|
+
|
|
5
|
+
- Added live MusicBrainz lookup/search support for releases, release groups, recordings, artists, labels, and works.
|
|
6
|
+
- Added MusicBrainz category-first client facades under `listen.musicbrainz` and `people.musicbrainz`, plus a `providers/musicbrainz/client` subpath export.
|
|
7
|
+
- Added MusicBrainz fetch/search examples and README usage documentation.
|
|
8
|
+
- Added an IMDb suggestion-data fallback for challenge pages so known title IDs still resolve core metadata such as title, year, poster, type, rank, and cast summary.
|
|
9
|
+
|
|
10
|
+
## 0.2.2 - 2026-05-25
|
|
11
|
+
|
|
12
|
+
- Added IMDb fetch-by-ID scraper support for movie and TV title pages.
|
|
13
|
+
- Added GamesDB live game search/fetch, platform fetch, `play.gamesdb` client support, and native API envelope/image handling.
|
|
14
|
+
- Removed hardcoded fixture payloads from the fetch example; examples now cover live fetch-capable providers only.
|
|
15
|
+
- Removed duplicate transformed TMDB TV `content_ratings` details while keeping normalized `certifications`.
|
|
16
|
+
- Added `AGENTS.md` guidance for AI coding agents working in this repository.
|
|
17
|
+
|
|
3
18
|
## 0.2.1 - 2026-05-24
|
|
4
19
|
|
|
5
20
|
- Normalized provider ratings to a shared `0-5` scale while preserving native provider scores in `provider_rating` details.
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Search, fetch, and normalize media metadata from external providers into a share
|
|
|
4
4
|
|
|
5
5
|
This package is meant to be used by apps that need provider-backed lookup and transformation, but do not want provider-specific response shapes leaking through the app.
|
|
6
6
|
|
|
7
|
-
TMDB
|
|
7
|
+
TMDB, Open Library, GamesDB, and MusicBrainz include live search/fetch clients. IMDb includes a fetch-by-ID title-page scraper for movie and TV titles. Additional providers currently expose source-record transformers: you provide the raw provider payload, and this package normalizes it into `ZuuidData`.
|
|
8
8
|
|
|
9
9
|
Storage, caching, indexing, review state, object-store keys, and persistence belong in a layer outside this package.
|
|
10
10
|
|
|
@@ -110,9 +110,11 @@ Ratings are normalized to a `0-5` scale when the provider exposes a compatible n
|
|
|
110
110
|
| Open Library | book | yes | yes | yes |
|
|
111
111
|
| Open Library | author | yes | yes | yes |
|
|
112
112
|
| ComicVine | volume, issue, story_arc, character, person, publisher | no | no | yes |
|
|
113
|
-
|
|
|
113
|
+
| IMDb | movie, tv | no | yes | yes |
|
|
114
|
+
| GamesDB | game | yes | yes | yes |
|
|
115
|
+
| GamesDB | platform | no | yes | yes |
|
|
114
116
|
| Jikan | anime, manga, producer, magazine, character, person | no | no | yes |
|
|
115
|
-
| MusicBrainz | release, release-group, recording, artist, label, work |
|
|
117
|
+
| MusicBrainz | release, release-group, recording, artist, label, work | yes | yes | yes |
|
|
116
118
|
| OpenFoodFacts | product | no | no | yes |
|
|
117
119
|
| OpenStreetMap | city, country, place, venue | no | no | yes |
|
|
118
120
|
| Podcast / iTunes | podcast | no | no | yes |
|
|
@@ -120,7 +122,82 @@ Ratings are normalized to a `0-5` scale when the provider exposes a compatible n
|
|
|
120
122
|
| Ticketmaster | event, attraction, venue | no | no | yes |
|
|
121
123
|
| Wger | exercise, equipment | no | no | yes |
|
|
122
124
|
|
|
123
|
-
For transformer-only providers, "Search" and "Fetch" are marked `no` because this package does not perform those HTTP requests yet. Use your own provider client or stored payloads, wrap the payload in a `SourceRecord`, and call the category transformer.
|
|
125
|
+
For IMDb, search is marked `no` because the scraper fetches known title IDs such as `tt0137523`; it does not implement IMDb search. GamesDB platform search is marked `no` because only game search and ID fetches are currently implemented. For transformer-only providers, "Search" and "Fetch" are marked `no` because this package does not perform those HTTP requests yet. Use your own provider client or stored payloads, wrap the payload in a `SourceRecord`, and call the category transformer.
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
## GamesDB Credentials
|
|
130
|
+
|
|
131
|
+
`GamesDbProvider` uses TheGamesDB v1 API and requires an API key:
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
import { GamesDbProvider } from "@zivue/zuuid/providers/gamesdb";
|
|
135
|
+
|
|
136
|
+
const gamesdb = new GamesDbProvider({
|
|
137
|
+
apiKey: process.env.GAMESDB_API_KEY!
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
const game = await gamesdb.fetchGame({ id: 17444 });
|
|
141
|
+
const search = await gamesdb.searchGames({ query: "Chrono Trigger" });
|
|
142
|
+
const platform = await gamesdb.fetchPlatform({ id: 6 });
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
The category-first client exposes GamesDB under `play.gamesdb`:
|
|
146
|
+
|
|
147
|
+
```ts
|
|
148
|
+
const zuuid = createZuuidClient({
|
|
149
|
+
providers: { gamesdb: { apiKey: process.env.GAMESDB_API_KEY! } }
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
const game = await zuuid.play.gamesdb?.game.fetch({ id: 17444 });
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
GamesDB transforms accept both simple flat payloads and native TheGamesDB API envelopes with `data.games`, `data.platforms`, lookup maps, and `boxart` image metadata.
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
## MusicBrainz
|
|
159
|
+
|
|
160
|
+
`MusicBrainzProvider` uses the public MusicBrainz JSON web service. No API key is required, but the provider sends a descriptive `User-Agent` by default and lets you override it.
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
import { MusicBrainzProvider } from "@zivue/zuuid/providers/musicbrainz";
|
|
164
|
+
|
|
165
|
+
const musicbrainz = new MusicBrainzProvider({
|
|
166
|
+
userAgent: "your-app/1.0 (you@example.com)"
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
const release = await musicbrainz.fetchRelease({ id: "f5093c06-23e3-404f-aeaa-40f72885ee3a" });
|
|
170
|
+
const releaseGroups = await musicbrainz.searchReleaseGroups({ query: "Kind of Blue" });
|
|
171
|
+
const artist = await musicbrainz.fetchArtist({ id: "561d854a-6a28-4aa7-8c99-323e6ce46c2a" });
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
The category-first client exposes MusicBrainz under `listen.musicbrainz` and `people.musicbrainz`:
|
|
175
|
+
|
|
176
|
+
```ts
|
|
177
|
+
const zuuid = createZuuidClient({ providers: { musicbrainz: {} } });
|
|
178
|
+
|
|
179
|
+
const album = await zuuid.listen.musicbrainz?.releaseGroup.search({ query: "Kind of Blue" });
|
|
180
|
+
const artist = await zuuid.people.musicbrainz?.artist.search({ query: "Miles Davis" });
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## IMDb Scraper
|
|
184
|
+
|
|
185
|
+
IMDb can be used as a credential-free alternative source when you already have an IMDb title ID. It scrapes the title page, preserves the fetched HTML and extracted JSON-LD in the raw `SourceRecord`, and transforms the JSON-LD into normalized `ZuuidData`. If IMDb serves a challenge page instead of title HTML, the provider falls back to IMDb suggestion data for core fields such as title, year, poster, type, rank, and cast summary.
|
|
186
|
+
|
|
187
|
+
```ts
|
|
188
|
+
import { ImdbProvider } from "@zivue/zuuid/providers/imdb";
|
|
189
|
+
|
|
190
|
+
const imdb = new ImdbProvider();
|
|
191
|
+
const movie = await imdb.fetchMovie({ id: "tt0137523" });
|
|
192
|
+
const tv = await imdb.fetchTv({ id: "tt0944947" });
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
The category-first client exposes the same fetch-only provider under `movie.imdb` and `tv.imdb`:
|
|
196
|
+
|
|
197
|
+
```ts
|
|
198
|
+
const zuuid = createZuuidClient({ providers: { imdb: {} } });
|
|
199
|
+
const movie = await zuuid.movie.imdb?.fetch({ id: "tt0137523" });
|
|
200
|
+
```
|
|
124
201
|
|
|
125
202
|
## TMDB Credentials
|
|
126
203
|
|
|
@@ -323,6 +400,11 @@ zuuid.people.openlibrary?.fetch({ id: "OL23919A" });
|
|
|
323
400
|
|
|
324
401
|
zuuid.read.openlibrary?.search({ query: "The Lord of the Rings" });
|
|
325
402
|
zuuid.read.openlibrary?.fetch({ id: "OL82563W" });
|
|
403
|
+
|
|
404
|
+
zuuid.listen.musicbrainz?.release.search({ query: "Kind of Blue" });
|
|
405
|
+
zuuid.listen.musicbrainz?.releaseGroup.fetch({ id: "aaa50249-1e6b-3910-b830-7e2fb622a8c4" });
|
|
406
|
+
zuuid.listen.musicbrainz?.recording.search({ query: "So What" });
|
|
407
|
+
zuuid.people.musicbrainz?.artist.search({ query: "Miles Davis" });
|
|
326
408
|
```
|
|
327
409
|
|
|
328
410
|
## Example Scripts
|
|
@@ -345,6 +427,9 @@ npm run example:search -- tv "Game of Thrones"
|
|
|
345
427
|
npm run example:search -- people "Brad Pitt"
|
|
346
428
|
npm run example:search -- book "The Lord of the Rings"
|
|
347
429
|
npm run example:search -- author "J. K. Rowling"
|
|
430
|
+
npm run example:search -- release-group "Kind of Blue"
|
|
431
|
+
npm run example:search -- recording "So What"
|
|
432
|
+
npm run example:search -- artist "Miles Davis"
|
|
348
433
|
```
|
|
349
434
|
|
|
350
435
|
Fetch and transform a selected provider ID:
|
|
@@ -357,22 +442,20 @@ npm run example:fetch -- book OL82563W
|
|
|
357
442
|
npm run example:fetch -- author OL23919A
|
|
358
443
|
```
|
|
359
444
|
|
|
360
|
-
Fetch
|
|
445
|
+
Fetch live provider examples:
|
|
361
446
|
|
|
362
447
|
```sh
|
|
363
|
-
npm run example:fetch --
|
|
364
|
-
npm run example:fetch --
|
|
448
|
+
npm run example:fetch -- imdb:movie tt0137523
|
|
449
|
+
npm run example:fetch -- imdb:tv tt0944947
|
|
450
|
+
GAMESDB_API_KEY=... npm run example:fetch -- gamesdb:game 17444
|
|
451
|
+
GAMESDB_API_KEY=... npm run example:fetch -- gamesdb:platform 6
|
|
452
|
+
npm run example:fetch -- musicbrainz:release f5093c06-23e3-404f-aeaa-40f72885ee3a
|
|
365
453
|
npm run example:fetch -- musicbrainz:release-group aaa50249-1e6b-3910-b830-7e2fb622a8c4
|
|
366
|
-
npm run example:fetch -- musicbrainz:
|
|
367
|
-
npm run example:fetch -- comicvine:issue 101
|
|
368
|
-
npm run example:fetch -- comicvine:story_arc 201
|
|
369
|
-
npm run example:fetch -- jikan:producer 14
|
|
370
|
-
npm run example:fetch -- jikan:magazine 1
|
|
371
|
-
npm run example:fetch -- openfoodfacts:product 3017620422003
|
|
372
|
-
npm run example:fetch -- openstreetmap:venue W123456
|
|
373
|
-
npm run example:fetch -- wger:equipment 7
|
|
454
|
+
npm run example:fetch -- musicbrainz:artist 561d854a-6a28-4aa7-8c99-323e6ce46c2a
|
|
374
455
|
```
|
|
375
456
|
|
|
457
|
+
Transformer-only providers do not have fetch examples. Wrap a real payload from your own provider client in a `SourceRecord` and call the transformer directly.
|
|
458
|
+
|
|
376
459
|
`example:fetch` writes both raw and transformed JSON:
|
|
377
460
|
|
|
378
461
|
```text
|
|
@@ -403,14 +486,19 @@ Provider exports:
|
|
|
403
486
|
|
|
404
487
|
- `TmdbProvider`
|
|
405
488
|
- `OpenLibraryProvider`
|
|
489
|
+
- `ImdbProvider`
|
|
490
|
+
- `GamesDbProvider`
|
|
491
|
+
- `MusicBrainzProvider`
|
|
406
492
|
- `transformTmdbMovie(sourceRecord, options?)`
|
|
407
493
|
- `transformTmdbTv(sourceRecord, options?)`
|
|
408
494
|
- `transformTmdbPerson(sourceRecord, options?)`
|
|
495
|
+
- `transformImdbMovie(sourceRecord, options?)`
|
|
496
|
+
- `transformImdbTv(sourceRecord, options?)`
|
|
409
497
|
- `transformOpenLibraryBook(sourceRecord, options?)`
|
|
410
498
|
- `transformOpenLibraryAuthor(sourceRecord, options?)`
|
|
411
499
|
- `transformComicVine(sourceRecord)`
|
|
412
500
|
- `transformGamesDbGame(sourceRecord, options?)`
|
|
413
|
-
- `transformGamesDbPlatform(sourceRecord)`
|
|
501
|
+
- `transformGamesDbPlatform(sourceRecord, options?)`
|
|
414
502
|
- `transformJikan(sourceRecord)`
|
|
415
503
|
- `transformMusicBrainzRelease(sourceRecord, options?)`
|
|
416
504
|
- `transformMusicBrainzReleaseGroup(sourceRecord, options?)`
|
package/dist/client.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import type { SearchResponse, ZuuidData, ZuuidSearchResult } from "./entity.js";
|
|
2
|
+
import { type FetchMusicBrainzInput, type MusicBrainzProviderOptions, type MusicBrainzSearchInput } from "./providers/musicbrainz/index.js";
|
|
2
3
|
import { type FetchOpenLibraryAuthorInput, type FetchOpenLibraryBookInput, type OpenLibraryProviderOptions, type OpenLibrarySearchInput } from "./providers/openlibrary/index.js";
|
|
3
4
|
import { type FetchTmdbMovieInput, type FetchTmdbPersonInput, type FetchTmdbTvInput, type TmdbProviderOptions, type TmdbSearchInput } from "./providers/tmdb/index.js";
|
|
5
|
+
import { type FetchGamesDbGameInput, type FetchGamesDbPlatformInput, type GamesDbProviderOptions, type GamesDbSearchInput } from "./providers/gamesdb/index.js";
|
|
6
|
+
import { type FetchImdbTitleInput, type ImdbProviderOptions } from "./providers/imdb/index.js";
|
|
4
7
|
import type { SourceRecord } from "./source.js";
|
|
5
8
|
export type ProviderConfigs = {
|
|
9
|
+
gamesdb?: GamesDbProviderOptions;
|
|
10
|
+
imdb?: ImdbProviderOptions;
|
|
11
|
+
musicbrainz?: MusicBrainzProviderOptions;
|
|
6
12
|
openlibrary?: OpenLibraryProviderOptions;
|
|
7
13
|
tmdb?: TmdbProviderOptions;
|
|
8
14
|
};
|
|
@@ -16,6 +22,11 @@ export type MovieProviderClient<TFetchInput> = {
|
|
|
16
22
|
searchSourceRecords(input: TmdbSearchInput): Promise<SearchResponse<SourceRecord>>;
|
|
17
23
|
transform(source: SourceRecord): Promise<ZuuidData>;
|
|
18
24
|
};
|
|
25
|
+
export type FetchOnlyProviderClient<TFetchInput> = {
|
|
26
|
+
fetch(input: TFetchInput): Promise<ZuuidData | undefined>;
|
|
27
|
+
fetchSourceRecord(input: TFetchInput): Promise<SourceRecord | undefined>;
|
|
28
|
+
transform(source: SourceRecord): Promise<ZuuidData>;
|
|
29
|
+
};
|
|
19
30
|
export type ProviderClient<TFetchInput, TSearchInput> = {
|
|
20
31
|
fetch(input: TFetchInput): Promise<ZuuidData | undefined>;
|
|
21
32
|
fetchSourceRecord(input: TFetchInput): Promise<SourceRecord | undefined>;
|
|
@@ -25,18 +36,38 @@ export type ProviderClient<TFetchInput, TSearchInput> = {
|
|
|
25
36
|
};
|
|
26
37
|
export type ZuuidClient = {
|
|
27
38
|
movie: {
|
|
39
|
+
imdb?: FetchOnlyProviderClient<FetchImdbTitleInput>;
|
|
28
40
|
tmdb?: ProviderClient<FetchTmdbMovieInput, TmdbSearchInput>;
|
|
29
41
|
};
|
|
30
42
|
tv: {
|
|
43
|
+
imdb?: FetchOnlyProviderClient<FetchImdbTitleInput>;
|
|
31
44
|
tmdb?: ProviderClient<FetchTmdbTvInput, TmdbSearchInput>;
|
|
32
45
|
};
|
|
33
46
|
people: {
|
|
34
47
|
tmdb?: ProviderClient<FetchTmdbPersonInput, TmdbSearchInput>;
|
|
35
48
|
openlibrary?: ProviderClient<FetchOpenLibraryAuthorInput, OpenLibrarySearchInput>;
|
|
49
|
+
musicbrainz?: {
|
|
50
|
+
artist: ProviderClient<FetchMusicBrainzInput, MusicBrainzSearchInput>;
|
|
51
|
+
label: ProviderClient<FetchMusicBrainzInput, MusicBrainzSearchInput>;
|
|
52
|
+
};
|
|
36
53
|
};
|
|
37
54
|
read: {
|
|
38
55
|
openlibrary?: ProviderClient<FetchOpenLibraryBookInput, OpenLibrarySearchInput>;
|
|
39
56
|
};
|
|
57
|
+
listen: {
|
|
58
|
+
musicbrainz?: {
|
|
59
|
+
release: ProviderClient<FetchMusicBrainzInput, MusicBrainzSearchInput>;
|
|
60
|
+
releaseGroup: ProviderClient<FetchMusicBrainzInput, MusicBrainzSearchInput>;
|
|
61
|
+
recording: ProviderClient<FetchMusicBrainzInput, MusicBrainzSearchInput>;
|
|
62
|
+
work: ProviderClient<FetchMusicBrainzInput, MusicBrainzSearchInput>;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
play: {
|
|
66
|
+
gamesdb?: {
|
|
67
|
+
game: ProviderClient<FetchGamesDbGameInput, GamesDbSearchInput>;
|
|
68
|
+
platform: FetchOnlyProviderClient<FetchGamesDbPlatformInput>;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
40
71
|
};
|
|
41
72
|
export declare function createZuuidClient(config?: ZuuidClientConfig): ZuuidClient;
|
|
42
73
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAIL,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,EAC5B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAKL,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,E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AAE,cAAc,CAAC,qBAAqB,EAAE,sBAAsB,CAAC,CAAC;YACvE,YAAY,EAAE,cAAc,CAAC,qBAAqB,EAAE,sBAAsB,CAAC,CAAC;YAC5E,SAAS,EAAE,cAAc,CAAC,qBAAqB,EAAE,sBAAsB,CAAC,CAAC;YACzE,IAAI,EAAE,cAAc,CAAC,qBAAqB,EAAE,sBAAsB,CAAC,CAAC;SACrE,CAAC;KACH,CAAC;IACF,IAAI,EAAE;QACJ,OAAO,CAAC,EAAE;YACR,IAAI,EAAE,cAAc,CAAC,qBAAqB,EAAE,kBAAkB,CAAC,CAAC;YAChE,QAAQ,EAAE,uBAAuB,CAAC,yBAAyB,CAAC,CAAC;SAC9D,CAAC;KACH,CAAC;CACH,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,iBAAsB,GAAG,WAAW,CAkJ7E"}
|
package/dist/client.js
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
|
+
import { MusicBrainzProvider, transformMusicBrainzArtist, transformMusicBrainzLabel, transformMusicBrainzRecording, transformMusicBrainzRelease, transformMusicBrainzReleaseGroup, transformMusicBrainzWork } from "./providers/musicbrainz/index.js";
|
|
1
2
|
import { OpenLibraryProvider, transformOpenLibraryAuthor, transformOpenLibraryBook } from "./providers/openlibrary/index.js";
|
|
2
3
|
import { TmdbProvider, transformTmdbMovie, transformTmdbPerson, transformTmdbTv } from "./providers/tmdb/index.js";
|
|
4
|
+
import { GamesDbProvider, transformGamesDbGame, transformGamesDbPlatform } from "./providers/gamesdb/index.js";
|
|
5
|
+
import { ImdbProvider, transformImdbMovie, transformImdbTv } from "./providers/imdb/index.js";
|
|
3
6
|
export function createZuuidClient(config = {}) {
|
|
7
|
+
const gamesdb = config.providers?.gamesdb ? new GamesDbProvider(config.providers.gamesdb) : undefined;
|
|
8
|
+
const imdb = config.providers?.imdb ? new ImdbProvider(config.providers.imdb) : undefined;
|
|
9
|
+
const musicbrainz = config.providers?.musicbrainz ? new MusicBrainzProvider(config.providers.musicbrainz) : undefined;
|
|
4
10
|
const openlibrary = config.providers?.openlibrary ? new OpenLibraryProvider(config.providers.openlibrary) : undefined;
|
|
5
11
|
const tmdb = config.providers?.tmdb ? new TmdbProvider(config.providers.tmdb) : undefined;
|
|
6
12
|
return Object.freeze({
|
|
7
13
|
movie: Object.freeze({
|
|
14
|
+
imdb: imdb
|
|
15
|
+
? Object.freeze({
|
|
16
|
+
fetch: (input) => imdb.fetchMovie(input),
|
|
17
|
+
fetchSourceRecord: (input) => imdb.fetchMovieSourceRecord(input),
|
|
18
|
+
transform: (source) => transformImdbMovie(source, imdb.transformOptions())
|
|
19
|
+
})
|
|
20
|
+
: undefined,
|
|
8
21
|
tmdb: tmdb
|
|
9
22
|
? Object.freeze({
|
|
10
23
|
fetch: (input) => tmdb.fetchMovie(input),
|
|
@@ -16,6 +29,13 @@ export function createZuuidClient(config = {}) {
|
|
|
16
29
|
: undefined
|
|
17
30
|
}),
|
|
18
31
|
tv: Object.freeze({
|
|
32
|
+
imdb: imdb
|
|
33
|
+
? Object.freeze({
|
|
34
|
+
fetch: (input) => imdb.fetchTv(input),
|
|
35
|
+
fetchSourceRecord: (input) => imdb.fetchTvSourceRecord(input),
|
|
36
|
+
transform: (source) => transformImdbTv(source, imdb.transformOptions())
|
|
37
|
+
})
|
|
38
|
+
: undefined,
|
|
19
39
|
tmdb: tmdb
|
|
20
40
|
? Object.freeze({
|
|
21
41
|
fetch: (input) => tmdb.fetchTv(input),
|
|
@@ -44,6 +64,24 @@ export function createZuuidClient(config = {}) {
|
|
|
44
64
|
searchSourceRecords: (input) => openlibrary.searchAuthorSourceRecords(input),
|
|
45
65
|
transform: (source) => transformOpenLibraryAuthor(source, openlibrary.transformOptions())
|
|
46
66
|
})
|
|
67
|
+
: undefined,
|
|
68
|
+
musicbrainz: musicbrainz
|
|
69
|
+
? Object.freeze({
|
|
70
|
+
artist: Object.freeze({
|
|
71
|
+
fetch: (input) => musicbrainz.fetchArtist(input),
|
|
72
|
+
fetchSourceRecord: (input) => musicbrainz.fetchArtistSourceRecord(input),
|
|
73
|
+
search: (input) => musicbrainz.searchArtists(input),
|
|
74
|
+
searchSourceRecords: (input) => musicbrainz.searchArtistSourceRecords(input),
|
|
75
|
+
transform: (source) => transformMusicBrainzArtist(source)
|
|
76
|
+
}),
|
|
77
|
+
label: Object.freeze({
|
|
78
|
+
fetch: (input) => musicbrainz.fetchLabel(input),
|
|
79
|
+
fetchSourceRecord: (input) => musicbrainz.fetchLabelSourceRecord(input),
|
|
80
|
+
search: (input) => musicbrainz.searchLabels(input),
|
|
81
|
+
searchSourceRecords: (input) => musicbrainz.searchLabelSourceRecords(input),
|
|
82
|
+
transform: (source) => transformMusicBrainzLabel(source)
|
|
83
|
+
})
|
|
84
|
+
})
|
|
47
85
|
: undefined
|
|
48
86
|
}),
|
|
49
87
|
read: Object.freeze({
|
|
@@ -56,6 +94,58 @@ export function createZuuidClient(config = {}) {
|
|
|
56
94
|
transform: (source) => transformOpenLibraryBook(source, openlibrary.transformOptions())
|
|
57
95
|
})
|
|
58
96
|
: undefined
|
|
97
|
+
}),
|
|
98
|
+
listen: Object.freeze({
|
|
99
|
+
musicbrainz: musicbrainz
|
|
100
|
+
? Object.freeze({
|
|
101
|
+
release: Object.freeze({
|
|
102
|
+
fetch: (input) => musicbrainz.fetchRelease(input),
|
|
103
|
+
fetchSourceRecord: (input) => musicbrainz.fetchReleaseSourceRecord(input),
|
|
104
|
+
search: (input) => musicbrainz.searchReleases(input),
|
|
105
|
+
searchSourceRecords: (input) => musicbrainz.searchReleaseSourceRecords(input),
|
|
106
|
+
transform: (source) => transformMusicBrainzRelease(source, { coverArtBaseUrl: musicbrainz.coverArtBaseUrl })
|
|
107
|
+
}),
|
|
108
|
+
releaseGroup: Object.freeze({
|
|
109
|
+
fetch: (input) => musicbrainz.fetchReleaseGroup(input),
|
|
110
|
+
fetchSourceRecord: (input) => musicbrainz.fetchReleaseGroupSourceRecord(input),
|
|
111
|
+
search: (input) => musicbrainz.searchReleaseGroups(input),
|
|
112
|
+
searchSourceRecords: (input) => musicbrainz.searchReleaseGroupSourceRecords(input),
|
|
113
|
+
transform: (source) => transformMusicBrainzReleaseGroup(source, { coverArtBaseUrl: musicbrainz.releaseGroupCoverArtBaseUrl })
|
|
114
|
+
}),
|
|
115
|
+
recording: Object.freeze({
|
|
116
|
+
fetch: (input) => musicbrainz.fetchRecording(input),
|
|
117
|
+
fetchSourceRecord: (input) => musicbrainz.fetchRecordingSourceRecord(input),
|
|
118
|
+
search: (input) => musicbrainz.searchRecordings(input),
|
|
119
|
+
searchSourceRecords: (input) => musicbrainz.searchRecordingSourceRecords(input),
|
|
120
|
+
transform: (source) => transformMusicBrainzRecording(source)
|
|
121
|
+
}),
|
|
122
|
+
work: Object.freeze({
|
|
123
|
+
fetch: (input) => musicbrainz.fetchWork(input),
|
|
124
|
+
fetchSourceRecord: (input) => musicbrainz.fetchWorkSourceRecord(input),
|
|
125
|
+
search: (input) => musicbrainz.searchWorks(input),
|
|
126
|
+
searchSourceRecords: (input) => musicbrainz.searchWorkSourceRecords(input),
|
|
127
|
+
transform: (source) => transformMusicBrainzWork(source)
|
|
128
|
+
})
|
|
129
|
+
})
|
|
130
|
+
: undefined
|
|
131
|
+
}),
|
|
132
|
+
play: Object.freeze({
|
|
133
|
+
gamesdb: gamesdb
|
|
134
|
+
? Object.freeze({
|
|
135
|
+
game: Object.freeze({
|
|
136
|
+
fetch: (input) => gamesdb.fetchGame(input),
|
|
137
|
+
fetchSourceRecord: (input) => gamesdb.fetchGameSourceRecord(input),
|
|
138
|
+
search: (input) => gamesdb.searchGames(input),
|
|
139
|
+
searchSourceRecords: (input) => gamesdb.searchGameSourceRecords(input),
|
|
140
|
+
transform: (source) => transformGamesDbGame(source, gamesdb.transformOptions())
|
|
141
|
+
}),
|
|
142
|
+
platform: Object.freeze({
|
|
143
|
+
fetch: (input) => gamesdb.fetchPlatform(input),
|
|
144
|
+
fetchSourceRecord: (input) => gamesdb.fetchPlatformSourceRecord(input),
|
|
145
|
+
transform: (source) => transformGamesDbPlatform(source, gamesdb.transformOptions())
|
|
146
|
+
})
|
|
147
|
+
})
|
|
148
|
+
: undefined
|
|
59
149
|
})
|
|
60
150
|
});
|
|
61
151
|
}
|
package/dist/identity.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ProviderName = "musicbrainz" | "gamesdb" | "openlibrary" | "tmdb" | "jikan" | "comicvine" | "setlistfm" | "ticketmaster" | "podcast" | "openstreetmap" | "wger" | "openfoodfacts" | "goodreads" | "rss" | "web";
|
|
1
|
+
export type ProviderName = "musicbrainz" | "gamesdb" | "openlibrary" | "imdb" | "tmdb" | "jikan" | "comicvine" | "setlistfm" | "ticketmaster" | "podcast" | "openstreetmap" | "wger" | "openfoodfacts" | "goodreads" | "rss" | "web";
|
|
2
2
|
export type ProviderNamespace = {
|
|
3
3
|
provider: ProviderName;
|
|
4
4
|
namespace: string;
|
package/dist/identity.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GACpB,aAAa,GACb,SAAS,GACT,aAAa,GACb,MAAM,GACN,OAAO,GACP,WAAW,GACX,WAAW,GACX,cAAc,GACd,SAAS,GACT,eAAe,GACf,MAAM,GACN,eAAe,GACf,WAAW,GACX,KAAK,GACL,KAAK,CAAC;AAEV,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,YAAY,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GACpB,aAAa,GACb,SAAS,GACT,aAAa,GACb,MAAM,GACN,MAAM,GACN,OAAO,GACP,WAAW,GACX,WAAW,GACX,cAAc,GACd,SAAS,GACT,eAAe,GACf,MAAM,GACN,eAAe,GACf,WAAW,GACX,KAAK,GACL,KAAK,CAAC;AAEV,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,YAAY,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,iBAAiB,EAiBlD,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEtE;AAED,wBAAsB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAkB9E"}
|
package/dist/identity.js
CHANGED
|
@@ -3,6 +3,7 @@ export const PROVIDER_NAMESPACES = [
|
|
|
3
3
|
{ provider: "musicbrainz", namespace: "9e4a2c71-f528-4d83-b710-a40c3e917f2a" },
|
|
4
4
|
{ provider: "gamesdb", namespace: "7ca1b820-aebc-41d2-90c5-00d05fe440d9" },
|
|
5
5
|
{ provider: "openlibrary", namespace: "3ea1c742-b50f-4a93-912d-7c8e1fa364d1" },
|
|
6
|
+
{ provider: "imdb", namespace: "0a29a9f5-9d8f-45d7-8d18-03d966bdadfb" },
|
|
6
7
|
{ provider: "tmdb", namespace: "6ba7b810-9dad-11d1-80b4-00c04fd430c8" },
|
|
7
8
|
{ provider: "jikan", namespace: "7ca8b920-aebe-22e2-91c5-01d15ee541d9" },
|
|
8
9
|
{ provider: "comicvine", namespace: "8db9ca31-bfcf-33f3-a2d6-12e26ff652ea" },
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from "./entity.js";
|
|
|
4
4
|
export * from "./identity.js";
|
|
5
5
|
export * from "./providers/comicvine/index.js";
|
|
6
6
|
export * from "./providers/gamesdb/index.js";
|
|
7
|
+
export * from "./providers/imdb/index.js";
|
|
7
8
|
export * from "./providers/jikan/index.js";
|
|
8
9
|
export * from "./providers/musicbrainz/index.js";
|
|
9
10
|
export * from "./providers/openlibrary/index.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export * from "./entity.js";
|
|
|
4
4
|
export * from "./identity.js";
|
|
5
5
|
export * from "./providers/comicvine/index.js";
|
|
6
6
|
export * from "./providers/gamesdb/index.js";
|
|
7
|
+
export * from "./providers/imdb/index.js";
|
|
7
8
|
export * from "./providers/jikan/index.js";
|
|
8
9
|
export * from "./providers/musicbrainz/index.js";
|
|
9
10
|
export * from "./providers/openlibrary/index.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { SearchResponse, ZuuidData, ZuuidSearchResult } from "../../entity.js";
|
|
2
|
+
import type { SourceRecord } from "../../source.js";
|
|
3
|
+
import type { FetchGamesDbGameInput, FetchGamesDbPlatformInput, GamesDbProviderOptions, GamesDbSearchInput, GamesDbTransformOptions } from "./types.js";
|
|
4
|
+
export declare class GamesDbProvider {
|
|
5
|
+
readonly apiBase: string;
|
|
6
|
+
readonly imageBaseUrl: string | null;
|
|
7
|
+
private readonly apiKey;
|
|
8
|
+
private readonly fetchImpl;
|
|
9
|
+
constructor(options: GamesDbProviderOptions);
|
|
10
|
+
getJson<T>(path: string, params: Record<string, string>): Promise<T | undefined>;
|
|
11
|
+
transformOptions(): GamesDbTransformOptions;
|
|
12
|
+
fetchGameSourceRecord(input: FetchGamesDbGameInput): Promise<SourceRecord | undefined>;
|
|
13
|
+
fetchGame(input: FetchGamesDbGameInput): Promise<ZuuidData | undefined>;
|
|
14
|
+
searchGameSourceRecords(input: GamesDbSearchInput): Promise<SearchResponse<SourceRecord>>;
|
|
15
|
+
searchGames(input: GamesDbSearchInput): Promise<SearchResponse<ZuuidSearchResult>>;
|
|
16
|
+
fetchPlatformSourceRecord(input: FetchGamesDbPlatformInput): Promise<SourceRecord | undefined>;
|
|
17
|
+
fetchPlatform(input: FetchGamesDbPlatformInput): Promise<ZuuidData | undefined>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/providers/gamesdb/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AASpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,yBAAyB,EAAoB,sBAAsB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAE1K,qBAAa,eAAe;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmB;gBAEjC,OAAO,EAAE,sBAAsB;IAUrC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAmBtF,gBAAgB,IAAI,uBAAuB;IAIrC,qBAAqB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IAItF,SAAS,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAKvE,uBAAuB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;IAIzF,WAAW,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;IAIlF,yBAAyB,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IAI9F,aAAa,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;CAItF"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { GAMESDB_API_BASE, GAMESDB_IMAGE_BASE_URL } from "./constants.js";
|
|
2
|
+
import { fetchGamesDbGameSourceRecord, searchGamesDbGameSourceRecords, searchGamesDbGames, transformGamesDbGame } from "./game.js";
|
|
3
|
+
import { fetchGamesDbPlatformSourceRecord, transformGamesDbPlatform } from "./platform.js";
|
|
4
|
+
export class GamesDbProvider {
|
|
5
|
+
apiBase;
|
|
6
|
+
imageBaseUrl;
|
|
7
|
+
apiKey;
|
|
8
|
+
fetchImpl;
|
|
9
|
+
constructor(options) {
|
|
10
|
+
this.apiKey = options.apiKey.trim();
|
|
11
|
+
if (!this.apiKey) {
|
|
12
|
+
throw new Error("GamesDB API key must not be empty");
|
|
13
|
+
}
|
|
14
|
+
this.apiBase = options.apiBase ?? GAMESDB_API_BASE;
|
|
15
|
+
this.fetchImpl = options.fetch ?? globalThis.fetch.bind(globalThis);
|
|
16
|
+
this.imageBaseUrl = options.imageBaseUrl === undefined ? GAMESDB_IMAGE_BASE_URL : options.imageBaseUrl;
|
|
17
|
+
}
|
|
18
|
+
async getJson(path, params) {
|
|
19
|
+
const url = new URL(`${this.apiBase.replace(/\/$/, "")}/${path.replace(/^\//, "")}`);
|
|
20
|
+
url.searchParams.set("apikey", this.apiKey);
|
|
21
|
+
for (const [key, value] of Object.entries(params)) {
|
|
22
|
+
url.searchParams.set(key, value);
|
|
23
|
+
}
|
|
24
|
+
const response = await this.fetchImpl(url, { headers: { accept: "application/json" } });
|
|
25
|
+
if (response.status === 404) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
if (!response.ok) {
|
|
29
|
+
const body = await response.text().catch(() => "");
|
|
30
|
+
throw new Error(`GamesDB API returned ${response.status}: ${body}`);
|
|
31
|
+
}
|
|
32
|
+
return response.json();
|
|
33
|
+
}
|
|
34
|
+
transformOptions() {
|
|
35
|
+
return { imageBaseUrl: this.imageBaseUrl };
|
|
36
|
+
}
|
|
37
|
+
async fetchGameSourceRecord(input) {
|
|
38
|
+
return fetchGamesDbGameSourceRecord(this, input);
|
|
39
|
+
}
|
|
40
|
+
async fetchGame(input) {
|
|
41
|
+
const source = await this.fetchGameSourceRecord(input);
|
|
42
|
+
return source ? transformGamesDbGame(source, this.transformOptions()) : undefined;
|
|
43
|
+
}
|
|
44
|
+
async searchGameSourceRecords(input) {
|
|
45
|
+
return searchGamesDbGameSourceRecords(this, input);
|
|
46
|
+
}
|
|
47
|
+
async searchGames(input) {
|
|
48
|
+
return searchGamesDbGames(this, input, this.transformOptions());
|
|
49
|
+
}
|
|
50
|
+
async fetchPlatformSourceRecord(input) {
|
|
51
|
+
return fetchGamesDbPlatformSourceRecord(this, input);
|
|
52
|
+
}
|
|
53
|
+
async fetchPlatform(input) {
|
|
54
|
+
const source = await this.fetchPlatformSourceRecord(input);
|
|
55
|
+
return source ? transformGamesDbPlatform(source, this.transformOptions()) : undefined;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare const GAMESDB_PROVIDER = "gamesdb";
|
|
2
|
+
export declare const GAMESDB_API_BASE = "https://api.thegamesdb.net/v1";
|
|
3
|
+
export declare const GAMESDB_IMAGE_BASE_URL = "https://cdn.thegamesdb.net/images";
|
|
2
4
|
export declare const GAMESDB_GAME_CATEGORY = "game";
|
|
3
5
|
export declare const GAMESDB_PLATFORM_CATEGORY = "platform";
|
|
4
6
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/providers/gamesdb/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAC1C,eAAO,MAAM,qBAAqB,SAAS,CAAC;AAC5C,eAAO,MAAM,yBAAyB,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/providers/gamesdb/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAC1C,eAAO,MAAM,gBAAgB,kCAAkC,CAAC;AAChE,eAAO,MAAM,sBAAsB,sCAAsC,CAAC;AAC1E,eAAO,MAAM,qBAAqB,SAAS,CAAC;AAC5C,eAAO,MAAM,yBAAyB,aAAa,CAAC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export const GAMESDB_PROVIDER = "gamesdb";
|
|
2
|
+
export const GAMESDB_API_BASE = "https://api.thegamesdb.net/v1";
|
|
3
|
+
export const GAMESDB_IMAGE_BASE_URL = "https://cdn.thegamesdb.net/images";
|
|
2
4
|
export const GAMESDB_GAME_CATEGORY = "game";
|
|
3
5
|
export const GAMESDB_PLATFORM_CATEGORY = "platform";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { ZuuidData } from "../../entity.js";
|
|
2
|
-
import type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { SearchResponse, ZuuidData, ZuuidSearchResult } from "../../entity.js";
|
|
2
|
+
import { type SourceRecord } from "../../source.js";
|
|
3
|
+
import type { GamesDbProvider } from "./client.js";
|
|
4
|
+
import type { FetchGamesDbGameInput, GamesDbSearchInput, GamesDbTransformOptions } from "./types.js";
|
|
5
|
+
export declare function fetchGamesDbGameSourceRecord(provider: GamesDbProvider, input: FetchGamesDbGameInput): Promise<SourceRecord | undefined>;
|
|
6
|
+
export declare function searchGamesDbGameSourceRecords(provider: GamesDbProvider, input: GamesDbSearchInput): Promise<SearchResponse<SourceRecord>>;
|
|
7
|
+
export declare function searchGamesDbGames(provider: GamesDbProvider, input: GamesDbSearchInput, options?: GamesDbTransformOptions): Promise<SearchResponse<ZuuidSearchResult>>;
|
|
6
8
|
export declare function transformGamesDbGame(source: SourceRecord, options?: GamesDbTransformOptions): Promise<ZuuidData>;
|
|
7
9
|
//# sourceMappingURL=game.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"game.d.ts","sourceRoot":"","sources":["../../../src/providers/gamesdb/game.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"game.d.ts","sourceRoot":"","sources":["../../../src/providers/gamesdb/game.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpF,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAmBrG,wBAAsB,4BAA4B,CAChD,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CASnC;AAED,wBAAsB,8BAA8B,CAClD,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,CAOvC;AAED,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE,kBAAkB,EACzB,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC,CAyB5C;AAED,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,YAAY,EACpB,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,SAAS,CAAC,CAoCpB"}
|