@zivue/zuuid 0.2.2 → 0.2.5
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 +17 -0
- package/README.md +123 -6
- package/dist/client.d.ts +36 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +142 -0
- package/dist/providers/comicvine/client.d.ts +40 -0
- package/dist/providers/comicvine/client.d.ts.map +1 -0
- package/dist/providers/comicvine/client.js +190 -0
- package/dist/providers/comicvine/constants.d.ts +2 -0
- package/dist/providers/comicvine/constants.d.ts.map +1 -1
- package/dist/providers/comicvine/constants.js +2 -0
- package/dist/providers/comicvine/index.d.ts +2 -0
- package/dist/providers/comicvine/index.d.ts.map +1 -1
- package/dist/providers/comicvine/index.js +2 -0
- package/dist/providers/comicvine/types.d.ts +26 -0
- package/dist/providers/comicvine/types.d.ts.map +1 -0
- package/dist/providers/comicvine/types.js +1 -0
- package/dist/providers/imdb/client.d.ts +1 -0
- package/dist/providers/imdb/client.d.ts.map +1 -1
- package/dist/providers/imdb/client.js +4 -2
- package/dist/providers/imdb/constants.d.ts +1 -0
- package/dist/providers/imdb/constants.d.ts.map +1 -1
- package/dist/providers/imdb/constants.js +1 -0
- package/dist/providers/imdb/movie.js +51 -6
- package/dist/providers/imdb/types.d.ts +2 -0
- package/dist/providers/imdb/types.d.ts.map +1 -1
- 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/openstreetmap/city.d.ts +2 -0
- package/dist/providers/openstreetmap/city.d.ts.map +1 -0
- package/dist/providers/openstreetmap/city.js +1 -0
- package/dist/providers/openstreetmap/client.d.ts +31 -0
- package/dist/providers/openstreetmap/client.d.ts.map +1 -0
- package/dist/providers/openstreetmap/client.js +146 -0
- package/dist/providers/openstreetmap/constants.d.ts +2 -0
- package/dist/providers/openstreetmap/constants.d.ts.map +1 -1
- package/dist/providers/openstreetmap/constants.js +2 -0
- package/dist/providers/openstreetmap/country.d.ts +2 -0
- package/dist/providers/openstreetmap/country.d.ts.map +1 -0
- package/dist/providers/openstreetmap/country.js +1 -0
- package/dist/providers/openstreetmap/index.d.ts +4 -0
- package/dist/providers/openstreetmap/index.d.ts.map +1 -1
- package/dist/providers/openstreetmap/index.js +4 -0
- package/dist/providers/openstreetmap/types.d.ts +16 -0
- package/dist/providers/openstreetmap/types.d.ts.map +1 -0
- package/dist/providers/openstreetmap/types.js +1 -0
- package/package.json +21 -1
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { providerZuuid } from "../../identity.js";
|
|
2
|
+
import { createSourceRecord } from "../../source.js";
|
|
3
|
+
import { datePrefix, nestedString, stringField, valueAsString } from "../common.js";
|
|
4
|
+
import { COMICVINE_API_BASE, COMICVINE_CHARACTER_CATEGORY, COMICVINE_DEFAULT_USER_AGENT, COMICVINE_ISSUE_CATEGORY, COMICVINE_PERSON_CATEGORY, COMICVINE_PROVIDER, COMICVINE_PUBLISHER_CATEGORY, COMICVINE_STORY_ARC_CATEGORY, COMICVINE_VOLUME_CATEGORY } from "./constants.js";
|
|
5
|
+
import { transformComicVine } from "./transform.js";
|
|
6
|
+
const CATEGORY_CONFIG = {
|
|
7
|
+
[COMICVINE_VOLUME_CATEGORY]: { detailPath: "volume", searchResource: "volume", idPrefix: "4050", publicCategory: "comic" },
|
|
8
|
+
[COMICVINE_ISSUE_CATEGORY]: { detailPath: "issue", searchResource: "issue", idPrefix: "4000", publicCategory: "comic" },
|
|
9
|
+
[COMICVINE_STORY_ARC_CATEGORY]: { detailPath: "story_arc", searchResource: "story_arc", idPrefix: "4045", publicCategory: "comic" },
|
|
10
|
+
[COMICVINE_CHARACTER_CATEGORY]: { detailPath: "character", searchResource: "character", idPrefix: "4005", publicCategory: "person" },
|
|
11
|
+
[COMICVINE_PERSON_CATEGORY]: { detailPath: "person", searchResource: "person", idPrefix: "4040", publicCategory: "person" },
|
|
12
|
+
[COMICVINE_PUBLISHER_CATEGORY]: { detailPath: "publisher", searchResource: "publisher", idPrefix: "4010", publicCategory: "organization" }
|
|
13
|
+
};
|
|
14
|
+
export class ComicVineProvider {
|
|
15
|
+
apiBase;
|
|
16
|
+
userAgent;
|
|
17
|
+
apiKey;
|
|
18
|
+
fetchImpl;
|
|
19
|
+
constructor(options) {
|
|
20
|
+
this.apiKey = options.apiKey.trim();
|
|
21
|
+
if (!this.apiKey)
|
|
22
|
+
throw new Error("ComicVine API key must not be empty");
|
|
23
|
+
this.apiBase = options.apiBase ?? COMICVINE_API_BASE;
|
|
24
|
+
this.fetchImpl = options.fetch ?? globalThis.fetch.bind(globalThis);
|
|
25
|
+
this.userAgent = options.userAgent ?? COMICVINE_DEFAULT_USER_AGENT;
|
|
26
|
+
}
|
|
27
|
+
async getJson(path, params) {
|
|
28
|
+
const url = new URL(`${this.apiBase.replace(/\/$/, "")}/${path.replace(/^\//, "")}`);
|
|
29
|
+
url.searchParams.set("api_key", this.apiKey);
|
|
30
|
+
url.searchParams.set("format", "json");
|
|
31
|
+
for (const [key, value] of Object.entries(params))
|
|
32
|
+
url.searchParams.set(key, value);
|
|
33
|
+
const response = await this.fetchImpl(url, { headers: { accept: "application/json", "user-agent": this.userAgent } });
|
|
34
|
+
if (response.status === 404)
|
|
35
|
+
return undefined;
|
|
36
|
+
if (!response.ok) {
|
|
37
|
+
const body = await response.text().catch(() => "");
|
|
38
|
+
throw new Error(`ComicVine API returned ${response.status}: ${body}`);
|
|
39
|
+
}
|
|
40
|
+
const payload = await response.json();
|
|
41
|
+
if (payload.status_code === 101)
|
|
42
|
+
return undefined;
|
|
43
|
+
if (payload.status_code !== undefined && payload.status_code !== 1) {
|
|
44
|
+
throw new Error(`ComicVine API returned status ${payload.status_code}: ${payload.error ?? "unknown error"}`);
|
|
45
|
+
}
|
|
46
|
+
return payload.results;
|
|
47
|
+
}
|
|
48
|
+
async getEnvelope(path, params) {
|
|
49
|
+
const url = new URL(`${this.apiBase.replace(/\/$/, "")}/${path.replace(/^\//, "")}`);
|
|
50
|
+
url.searchParams.set("api_key", this.apiKey);
|
|
51
|
+
url.searchParams.set("format", "json");
|
|
52
|
+
for (const [key, value] of Object.entries(params))
|
|
53
|
+
url.searchParams.set(key, value);
|
|
54
|
+
const response = await this.fetchImpl(url, { headers: { accept: "application/json", "user-agent": this.userAgent } });
|
|
55
|
+
if (!response.ok) {
|
|
56
|
+
const body = await response.text().catch(() => "");
|
|
57
|
+
throw new Error(`ComicVine API returned ${response.status}: ${body}`);
|
|
58
|
+
}
|
|
59
|
+
const payload = await response.json();
|
|
60
|
+
if (payload.status_code !== undefined && payload.status_code !== 1) {
|
|
61
|
+
throw new Error(`ComicVine API returned status ${payload.status_code}: ${payload.error ?? "unknown error"}`);
|
|
62
|
+
}
|
|
63
|
+
return payload;
|
|
64
|
+
}
|
|
65
|
+
async fetchVolumeSourceRecord(input) { return fetchComicVineSourceRecord(this, COMICVINE_VOLUME_CATEGORY, input); }
|
|
66
|
+
async fetchVolume(input) { const source = await this.fetchVolumeSourceRecord(input); return source ? transformComicVine(source) : undefined; }
|
|
67
|
+
async searchVolumeSourceRecords(input) { return searchComicVineSourceRecords(this, COMICVINE_VOLUME_CATEGORY, input); }
|
|
68
|
+
async searchVolumes(input) { return searchComicVine(this, COMICVINE_VOLUME_CATEGORY, input); }
|
|
69
|
+
async fetchIssueSourceRecord(input) { return fetchComicVineSourceRecord(this, COMICVINE_ISSUE_CATEGORY, input); }
|
|
70
|
+
async fetchIssue(input) { const source = await this.fetchIssueSourceRecord(input); return source ? transformComicVine(source) : undefined; }
|
|
71
|
+
async searchIssueSourceRecords(input) { return searchComicVineSourceRecords(this, COMICVINE_ISSUE_CATEGORY, input); }
|
|
72
|
+
async searchIssues(input) { return searchComicVine(this, COMICVINE_ISSUE_CATEGORY, input); }
|
|
73
|
+
async fetchStoryArcSourceRecord(input) { return fetchComicVineSourceRecord(this, COMICVINE_STORY_ARC_CATEGORY, input); }
|
|
74
|
+
async fetchStoryArc(input) { const source = await this.fetchStoryArcSourceRecord(input); return source ? transformComicVine(source) : undefined; }
|
|
75
|
+
async searchStoryArcSourceRecords(input) { return searchComicVineSourceRecords(this, COMICVINE_STORY_ARC_CATEGORY, input); }
|
|
76
|
+
async searchStoryArcs(input) { return searchComicVine(this, COMICVINE_STORY_ARC_CATEGORY, input); }
|
|
77
|
+
async fetchCharacterSourceRecord(input) { return fetchComicVineSourceRecord(this, COMICVINE_CHARACTER_CATEGORY, input); }
|
|
78
|
+
async fetchCharacter(input) { const source = await this.fetchCharacterSourceRecord(input); return source ? transformComicVine(source) : undefined; }
|
|
79
|
+
async searchCharacterSourceRecords(input) { return searchComicVineSourceRecords(this, COMICVINE_CHARACTER_CATEGORY, input); }
|
|
80
|
+
async searchCharacters(input) { return searchComicVine(this, COMICVINE_CHARACTER_CATEGORY, input); }
|
|
81
|
+
async fetchPersonSourceRecord(input) { return fetchComicVineSourceRecord(this, COMICVINE_PERSON_CATEGORY, input); }
|
|
82
|
+
async fetchPerson(input) { const source = await this.fetchPersonSourceRecord(input); return source ? transformComicVine(source) : undefined; }
|
|
83
|
+
async searchPersonSourceRecords(input) { return searchComicVineSourceRecords(this, COMICVINE_PERSON_CATEGORY, input); }
|
|
84
|
+
async searchPeople(input) { return searchComicVine(this, COMICVINE_PERSON_CATEGORY, input); }
|
|
85
|
+
async fetchPublisherSourceRecord(input) { return fetchComicVineSourceRecord(this, COMICVINE_PUBLISHER_CATEGORY, input); }
|
|
86
|
+
async fetchPublisher(input) { const source = await this.fetchPublisherSourceRecord(input); return source ? transformComicVine(source) : undefined; }
|
|
87
|
+
async searchPublisherSourceRecords(input) { return searchComicVineSourceRecords(this, COMICVINE_PUBLISHER_CATEGORY, input); }
|
|
88
|
+
async searchPublishers(input) { return searchComicVine(this, COMICVINE_PUBLISHER_CATEGORY, input); }
|
|
89
|
+
}
|
|
90
|
+
export async function fetchComicVineSourceRecord(provider, category, input) {
|
|
91
|
+
const comicCategory = requireCategory(category);
|
|
92
|
+
const id = comicVineId(input.id);
|
|
93
|
+
const config = CATEGORY_CONFIG[comicCategory];
|
|
94
|
+
const payload = await provider.getJson(`/${config.detailPath}/${config.idPrefix}-${id}/`, {});
|
|
95
|
+
if (!payload)
|
|
96
|
+
return undefined;
|
|
97
|
+
return createSourceRecord({ source: { provider: COMICVINE_PROVIDER, category, externalId: id }, payload });
|
|
98
|
+
}
|
|
99
|
+
export async function searchComicVineSourceRecords(provider, category, input) {
|
|
100
|
+
const payload = await searchPayload(provider, category, input);
|
|
101
|
+
const comicCategory = requireCategory(category);
|
|
102
|
+
return {
|
|
103
|
+
results: await Promise.all(searchItems(payload).map((item) => createSourceRecord({ source: { provider: COMICVINE_PROVIDER, category, externalId: resultId(item, comicCategory) ?? "" }, payload: item }))),
|
|
104
|
+
pagination: pagination(payload)
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
export async function searchComicVine(provider, category, input) {
|
|
108
|
+
const payload = await searchPayload(provider, category, input);
|
|
109
|
+
const comicCategory = requireCategory(category);
|
|
110
|
+
const results = [];
|
|
111
|
+
for (const item of searchItems(payload)) {
|
|
112
|
+
const externalId = resultId(item, comicCategory);
|
|
113
|
+
const title = stringField(item, "name") ?? stringField(item, "title");
|
|
114
|
+
if (!externalId || !title)
|
|
115
|
+
continue;
|
|
116
|
+
const zuuid = await providerZuuid({ provider: COMICVINE_PROVIDER, category, externalId });
|
|
117
|
+
results.push({
|
|
118
|
+
id: zuuid,
|
|
119
|
+
zuuid,
|
|
120
|
+
category: CATEGORY_CONFIG[comicCategory].publicCategory,
|
|
121
|
+
title,
|
|
122
|
+
date: dateFor(item),
|
|
123
|
+
cover: nestedString(item, ["image", "super_url"]) ?? nestedString(item, ["image", "original_url"]) ?? nestedString(item, ["image", "medium_url"]) ?? null,
|
|
124
|
+
rating: null,
|
|
125
|
+
weight: numberValue(item, "score"),
|
|
126
|
+
relationType: null,
|
|
127
|
+
attribute: attributeFor(item, comicCategory),
|
|
128
|
+
order: null,
|
|
129
|
+
source: { source: COMICVINE_PROVIDER, category, value: externalId }
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return { results, pagination: pagination(payload) };
|
|
133
|
+
}
|
|
134
|
+
async function searchPayload(provider, category, input) {
|
|
135
|
+
const comicCategory = requireCategory(category);
|
|
136
|
+
const query = input.query.trim();
|
|
137
|
+
if (!query)
|
|
138
|
+
throw new Error("ComicVine search query must not be empty");
|
|
139
|
+
return provider.getEnvelope("/search/", {
|
|
140
|
+
query,
|
|
141
|
+
resources: CATEGORY_CONFIG[comicCategory].searchResource,
|
|
142
|
+
limit: String(input.limit ?? 25),
|
|
143
|
+
offset: String(input.offset ?? 0),
|
|
144
|
+
...(input.fieldList?.length ? { field_list: input.fieldList.join(",") } : {})
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function searchItems(payload) {
|
|
148
|
+
return Array.isArray(payload.results) ? payload.results.filter(isObject) : [];
|
|
149
|
+
}
|
|
150
|
+
function pagination(payload) {
|
|
151
|
+
const total = payload.number_of_total_results ?? searchItems(payload).length;
|
|
152
|
+
const offset = payload.offset ?? 0;
|
|
153
|
+
const limit = payload.limit ?? payload.number_of_page_results ?? searchItems(payload).length;
|
|
154
|
+
return { page: limit > 0 ? Math.floor(offset / limit) + 1 : 1, totalPages: limit > 0 ? Math.ceil(total / limit) : 0, totalResults: total };
|
|
155
|
+
}
|
|
156
|
+
function requireCategory(category) {
|
|
157
|
+
if (category in CATEGORY_CONFIG)
|
|
158
|
+
return category;
|
|
159
|
+
throw new Error(`unsupported ComicVine category: ${category}`);
|
|
160
|
+
}
|
|
161
|
+
function comicVineId(value) {
|
|
162
|
+
const id = String(value).trim();
|
|
163
|
+
const normalized = id.includes("-") ? id.split("-").pop() ?? "" : id;
|
|
164
|
+
if (!/^\d+$/.test(normalized))
|
|
165
|
+
throw new Error(`ComicVine id must be numeric: ${value}`);
|
|
166
|
+
return normalized;
|
|
167
|
+
}
|
|
168
|
+
function resultId(item, category) {
|
|
169
|
+
const raw = valueAsString(item.id);
|
|
170
|
+
if (!raw)
|
|
171
|
+
return undefined;
|
|
172
|
+
return raw.startsWith(`${CATEGORY_CONFIG[category].idPrefix}-`) ? raw.slice(CATEGORY_CONFIG[category].idPrefix.length + 1) : raw;
|
|
173
|
+
}
|
|
174
|
+
function dateFor(item) {
|
|
175
|
+
return datePrefix(stringField(item, "cover_date")) ?? datePrefix(stringField(item, "store_date")) ?? stringField(item, "start_year") ?? null;
|
|
176
|
+
}
|
|
177
|
+
function attributeFor(item, category) {
|
|
178
|
+
if (category === COMICVINE_ISSUE_CATEGORY)
|
|
179
|
+
return stringField(item, "issue_number") ?? null;
|
|
180
|
+
if (category === COMICVINE_PERSON_CATEGORY || category === COMICVINE_CHARACTER_CATEGORY)
|
|
181
|
+
return stringField(item, "real_name") ?? null;
|
|
182
|
+
return stringField(item, "deck") ?? null;
|
|
183
|
+
}
|
|
184
|
+
function numberValue(item, key) {
|
|
185
|
+
const value = item[key];
|
|
186
|
+
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
187
|
+
}
|
|
188
|
+
function isObject(value) {
|
|
189
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
190
|
+
}
|
|
@@ -5,4 +5,6 @@ export declare const COMICVINE_STORY_ARC_CATEGORY = "story_arc";
|
|
|
5
5
|
export declare const COMICVINE_CHARACTER_CATEGORY = "character";
|
|
6
6
|
export declare const COMICVINE_PERSON_CATEGORY = "person";
|
|
7
7
|
export declare const COMICVINE_PUBLISHER_CATEGORY = "publisher";
|
|
8
|
+
export declare const COMICVINE_API_BASE = "https://comicvine.gamespot.com/api";
|
|
9
|
+
export declare const COMICVINE_DEFAULT_USER_AGENT = "@zivue/zuuid ComicVine client (+https://github.com/zivue/zuuid)";
|
|
8
10
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/providers/comicvine/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,cAAc,CAAC;AAC9C,eAAO,MAAM,yBAAyB,WAAW,CAAC;AAClD,eAAO,MAAM,wBAAwB,UAAU,CAAC;AAChD,eAAO,MAAM,4BAA4B,cAAc,CAAC;AACxD,eAAO,MAAM,4BAA4B,cAAc,CAAC;AACxD,eAAO,MAAM,yBAAyB,WAAW,CAAC;AAClD,eAAO,MAAM,4BAA4B,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/providers/comicvine/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,cAAc,CAAC;AAC9C,eAAO,MAAM,yBAAyB,WAAW,CAAC;AAClD,eAAO,MAAM,wBAAwB,UAAU,CAAC;AAChD,eAAO,MAAM,4BAA4B,cAAc,CAAC;AACxD,eAAO,MAAM,4BAA4B,cAAc,CAAC;AACxD,eAAO,MAAM,yBAAyB,WAAW,CAAC;AAClD,eAAO,MAAM,4BAA4B,cAAc,CAAC;AACxD,eAAO,MAAM,kBAAkB,uCAAuC,CAAC;AACvE,eAAO,MAAM,4BAA4B,oEAAoE,CAAC"}
|
|
@@ -5,3 +5,5 @@ export const COMICVINE_STORY_ARC_CATEGORY = "story_arc";
|
|
|
5
5
|
export const COMICVINE_CHARACTER_CATEGORY = "character";
|
|
6
6
|
export const COMICVINE_PERSON_CATEGORY = "person";
|
|
7
7
|
export const COMICVINE_PUBLISHER_CATEGORY = "publisher";
|
|
8
|
+
export const COMICVINE_API_BASE = "https://comicvine.gamespot.com/api";
|
|
9
|
+
export const COMICVINE_DEFAULT_USER_AGENT = "@zivue/zuuid ComicVine client (+https://github.com/zivue/zuuid)";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/comicvine/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/comicvine/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type ComicVineFetchLike = (input: string | URL, init?: RequestInit) => Promise<Response>;
|
|
2
|
+
export type ComicVineProviderOptions = {
|
|
3
|
+
apiKey: string;
|
|
4
|
+
apiBase?: string;
|
|
5
|
+
fetch?: ComicVineFetchLike;
|
|
6
|
+
userAgent?: string;
|
|
7
|
+
};
|
|
8
|
+
export type FetchComicVineInput = {
|
|
9
|
+
id: string | number;
|
|
10
|
+
};
|
|
11
|
+
export type ComicVineSearchInput = {
|
|
12
|
+
query: string;
|
|
13
|
+
limit?: number;
|
|
14
|
+
offset?: number;
|
|
15
|
+
fieldList?: string[];
|
|
16
|
+
};
|
|
17
|
+
export type ComicVineApiResponse<T> = {
|
|
18
|
+
error?: string;
|
|
19
|
+
limit?: number;
|
|
20
|
+
offset?: number;
|
|
21
|
+
number_of_page_results?: number;
|
|
22
|
+
number_of_total_results?: number;
|
|
23
|
+
status_code?: number;
|
|
24
|
+
results?: T;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/providers/comicvine/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEhG,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,CAAC;CACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,6 +5,7 @@ import type { ImdbFetchLike, ImdbProviderOptions, ImdbTransformOptions } from ".
|
|
|
5
5
|
export declare class ImdbProvider {
|
|
6
6
|
readonly fetcher: ImdbFetchLike;
|
|
7
7
|
readonly titleBaseUrl: string | null;
|
|
8
|
+
readonly suggestionBaseUrl: string | null;
|
|
8
9
|
readonly userAgent: string;
|
|
9
10
|
constructor(options?: ImdbProviderOptions);
|
|
10
11
|
transformOptions(): ImdbTransformOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/providers/imdb/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAA4F,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAChJ,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE3F,qBAAa,YAAY;IACvB,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAEf,OAAO,GAAE,mBAAwB;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/providers/imdb/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAA4F,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAChJ,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE3F,qBAAa,YAAY;IACvB,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAEf,OAAO,GAAE,mBAAwB;IAO7C,gBAAgB,IAAI,oBAAoB;IAIlC,sBAAsB,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IAIrF,UAAU,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAKtE,mBAAmB,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IAIlF,OAAO,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;CAI1E"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { IMDB_DEFAULT_USER_AGENT, IMDB_TITLE_BASE_URL } from "./constants.js";
|
|
1
|
+
import { IMDB_DEFAULT_USER_AGENT, IMDB_SUGGESTION_BASE_URL, IMDB_TITLE_BASE_URL } from "./constants.js";
|
|
2
2
|
import { fetchImdbMovieSourceRecord, fetchImdbTvSourceRecord, transformImdbMovie, transformImdbTv } from "./movie.js";
|
|
3
3
|
export class ImdbProvider {
|
|
4
4
|
fetcher;
|
|
5
5
|
titleBaseUrl;
|
|
6
|
+
suggestionBaseUrl;
|
|
6
7
|
userAgent;
|
|
7
8
|
constructor(options = {}) {
|
|
8
9
|
this.fetcher = options.fetch ?? fetch;
|
|
9
10
|
this.titleBaseUrl = options.titleBaseUrl === undefined ? IMDB_TITLE_BASE_URL : options.titleBaseUrl;
|
|
11
|
+
this.suggestionBaseUrl = options.suggestionBaseUrl === undefined ? IMDB_SUGGESTION_BASE_URL : options.suggestionBaseUrl;
|
|
10
12
|
this.userAgent = options.userAgent ?? IMDB_DEFAULT_USER_AGENT;
|
|
11
13
|
}
|
|
12
14
|
transformOptions() {
|
|
13
|
-
return { titleBaseUrl: this.titleBaseUrl };
|
|
15
|
+
return { titleBaseUrl: this.titleBaseUrl, suggestionBaseUrl: this.suggestionBaseUrl };
|
|
14
16
|
}
|
|
15
17
|
async fetchMovieSourceRecord(input) {
|
|
16
18
|
return fetchImdbMovieSourceRecord(this, input);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const IMDB_PROVIDER = "imdb";
|
|
2
2
|
export declare const IMDB_TITLE_BASE_URL = "https://www.imdb.com/title";
|
|
3
3
|
export declare const IMDB_DEFAULT_USER_AGENT = "@zivue/zuuid IMDb scraper (+https://github.com/zivue/zuuid)";
|
|
4
|
+
export declare const IMDB_SUGGESTION_BASE_URL = "https://v3.sg.media-imdb.com/suggestion";
|
|
4
5
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/providers/imdb/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,SAAS,CAAC;AACpC,eAAO,MAAM,mBAAmB,+BAA+B,CAAC;AAChE,eAAO,MAAM,uBAAuB,gEAAgE,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/providers/imdb/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,SAAS,CAAC;AACpC,eAAO,MAAM,mBAAmB,+BAA+B,CAAC;AAChE,eAAO,MAAM,uBAAuB,gEAAgE,CAAC;AACrG,eAAO,MAAM,wBAAwB,4CAA4C,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export const IMDB_PROVIDER = "imdb";
|
|
2
2
|
export const IMDB_TITLE_BASE_URL = "https://www.imdb.com/title";
|
|
3
3
|
export const IMDB_DEFAULT_USER_AGENT = "@zivue/zuuid IMDb scraper (+https://github.com/zivue/zuuid)";
|
|
4
|
+
export const IMDB_SUGGESTION_BASE_URL = "https://v3.sg.media-imdb.com/suggestion";
|
|
@@ -37,22 +37,25 @@ async function fetchImdbTitleSourceRecord(provider, input, category) {
|
|
|
37
37
|
throw new Error(`IMDb title request failed with status ${response.status}`);
|
|
38
38
|
}
|
|
39
39
|
const html = await response.text();
|
|
40
|
+
const pagePayload = extractImdbPayload(url, html);
|
|
41
|
+
const suggestion = await fetchSuggestionPayload(provider, id);
|
|
40
42
|
return createSourceRecord({
|
|
41
43
|
source: { provider: IMDB_PROVIDER, category, externalId: id },
|
|
42
|
-
payload:
|
|
44
|
+
payload: { ...objectPayload(pagePayload), suggestion: suggestion ?? null }
|
|
43
45
|
});
|
|
44
46
|
}
|
|
45
47
|
async function transformImdbTitle(source, fallbackCategory, options = {}) {
|
|
46
48
|
const payload = objectPayload(source.payload);
|
|
47
49
|
const jsonLd = objectPayload(payload.jsonLd ?? {});
|
|
48
50
|
const externalId = normalizeImdbTitleId(source.source.externalId);
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
+
const suggestion = suggestionItem(payload, externalId);
|
|
52
|
+
const category = source.source.category === "tv" || schemaType(jsonLd).includes("TVSeries") || stringField(suggestion, "qid")?.startsWith("tv") ? "tv" : fallbackCategory;
|
|
53
|
+
const title = stringField(jsonLd, "name") ?? stringField(suggestion, "l") ?? fallbackTitle(payload) ?? externalId;
|
|
51
54
|
const data = await baseDataFromSource(source, IMDB_PROVIDER, category, category, externalId, title);
|
|
52
|
-
data.primaryDate = datePrefix(stringField(jsonLd, "datePublished"));
|
|
55
|
+
data.primaryDate = datePrefix(stringField(jsonLd, "datePublished")) ?? suggestionYearDate(suggestion);
|
|
53
56
|
addAlias(data, title, "primary", true, IMDB_PROVIDER);
|
|
54
57
|
addDescription(data, IMDB_PROVIDER, stringField(jsonLd, "description"));
|
|
55
|
-
addMedia(data, IMDB_PROVIDER, stringField(jsonLd, "image"), "poster");
|
|
58
|
+
addMedia(data, IMDB_PROVIDER, stringField(jsonLd, "image") ?? nestedSuggestionImage(suggestion), "poster");
|
|
56
59
|
const aggregateRating = objectPayload(jsonLd.aggregateRating ?? {});
|
|
57
60
|
const nativeRating = numericValue(aggregateRating.ratingValue);
|
|
58
61
|
const normalizedRating = normalizeRating(nativeRating, 0, 10);
|
|
@@ -66,6 +69,12 @@ async function transformImdbTitle(source, fallbackCategory, options = {}) {
|
|
|
66
69
|
addDetail(data, IMDB_PROVIDER, "duration", stringField(jsonLd, "duration"));
|
|
67
70
|
addDetail(data, IMDB_PROVIDER, "schema_type", valueAsString(jsonLd["@type"]));
|
|
68
71
|
addDetail(data, IMDB_PROVIDER, "url", stringField(payload, "url") ?? imdbTitleUrl(externalId, options.titleBaseUrl));
|
|
72
|
+
addDetail(data, IMDB_PROVIDER, "page_status", payload.challenge === true ? "challenge" : undefined);
|
|
73
|
+
addDetail(data, IMDB_PROVIDER, "imdb_type", stringField(suggestion, "q"));
|
|
74
|
+
addDetail(data, IMDB_PROVIDER, "imdb_type_id", stringField(suggestion, "qid"));
|
|
75
|
+
addDetail(data, IMDB_PROVIDER, "rank", numericValue(suggestion.rank));
|
|
76
|
+
addDetail(data, IMDB_PROVIDER, "year", numericValue(suggestion.y));
|
|
77
|
+
addDetail(data, IMDB_PROVIDER, "cast_summary", stringField(suggestion, "s"));
|
|
69
78
|
for (const genre of stringArray(jsonLd.genre)) {
|
|
70
79
|
addTag(data, genre);
|
|
71
80
|
}
|
|
@@ -86,9 +95,31 @@ function extractImdbPayload(url, html) {
|
|
|
86
95
|
html,
|
|
87
96
|
title: cleanPageTitle(decodeHtml(textFromMatch(html.match(/<title[^>]*>([\s\S]*?)<\/title>/i)?.[1]))) ?? null,
|
|
88
97
|
jsonLd: parseJsonScript(html, /<script[^>]+type=["']application\/ld\+json["'][^>]*>([\s\S]*?)<\/script>/i) ?? null,
|
|
89
|
-
nextData: parseJsonScript(html, /<script[^>]+id=["']__NEXT_DATA__["'][^>]*>([\s\S]*?)<\/script>/i) ?? null
|
|
98
|
+
nextData: parseJsonScript(html, /<script[^>]+id=["']__NEXT_DATA__["'][^>]*>([\s\S]*?)<\/script>/i) ?? null,
|
|
99
|
+
challenge: isChallengePage(html)
|
|
90
100
|
};
|
|
91
101
|
}
|
|
102
|
+
async function fetchSuggestionPayload(provider, id) {
|
|
103
|
+
const baseUrl = provider.suggestionBaseUrl?.replace(/\/$/, "");
|
|
104
|
+
if (!baseUrl) {
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
const bucket = id.slice(0, 1);
|
|
108
|
+
const response = await provider.fetcher(`${baseUrl}/${bucket}/${id}.json`, {
|
|
109
|
+
headers: {
|
|
110
|
+
Accept: "application/json",
|
|
111
|
+
"Accept-Language": "en-US,en;q=0.9",
|
|
112
|
+
"User-Agent": provider.userAgent
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
if (!response.ok) {
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
return response.json();
|
|
119
|
+
}
|
|
120
|
+
function isChallengePage(html) {
|
|
121
|
+
return html.includes("AwsWafIntegration") || html.includes("awsWafCookieDomainList") || html.includes("challenge-container");
|
|
122
|
+
}
|
|
92
123
|
function parseJsonScript(html, pattern) {
|
|
93
124
|
const raw = html.match(pattern)?.[1];
|
|
94
125
|
const text = textFromMatch(raw);
|
|
@@ -124,6 +155,20 @@ function imdbTitleUrl(id, titleBaseUrl) {
|
|
|
124
155
|
const base = titleBaseUrl?.replace(/\/$/, "");
|
|
125
156
|
return base ? `${base}/${id}/` : undefined;
|
|
126
157
|
}
|
|
158
|
+
function suggestionItem(payload, externalId) {
|
|
159
|
+
const suggestion = objectPayload(payload.suggestion ?? {});
|
|
160
|
+
const items = Array.isArray(suggestion.d) ? suggestion.d : [];
|
|
161
|
+
const matched = items.find((item) => item && typeof item === "object" && !Array.isArray(item) && stringField(item, "id") === externalId);
|
|
162
|
+
return matched && typeof matched === "object" && !Array.isArray(matched) ? matched : {};
|
|
163
|
+
}
|
|
164
|
+
function nestedSuggestionImage(suggestion) {
|
|
165
|
+
const image = objectPayload(suggestion.i ?? {});
|
|
166
|
+
return stringField(image, "imageUrl");
|
|
167
|
+
}
|
|
168
|
+
function suggestionYearDate(suggestion) {
|
|
169
|
+
const year = numericValue(suggestion.y);
|
|
170
|
+
return year ? `${Math.trunc(year)}-01-01` : undefined;
|
|
171
|
+
}
|
|
127
172
|
function schemaType(jsonLd) {
|
|
128
173
|
const value = jsonLd["@type"];
|
|
129
174
|
return Array.isArray(value) ? value.map((item) => valueAsString(item)).filter(Boolean).join(",") : valueAsString(value) ?? "";
|
|
@@ -2,9 +2,11 @@ export type ImdbFetchLike = (input: string | URL, init?: RequestInit) => Promise
|
|
|
2
2
|
export type ImdbProviderOptions = {
|
|
3
3
|
fetch?: ImdbFetchLike;
|
|
4
4
|
titleBaseUrl?: string | null;
|
|
5
|
+
suggestionBaseUrl?: string | null;
|
|
5
6
|
userAgent?: string;
|
|
6
7
|
};
|
|
7
8
|
export type ImdbTransformOptions = {
|
|
8
9
|
titleBaseUrl?: string | null;
|
|
10
|
+
suggestionBaseUrl?: string | null;
|
|
9
11
|
};
|
|
10
12
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/providers/imdb/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE3F,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/providers/imdb/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE3F,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { SearchResponse, ZuuidData, ZuuidSearchResult } from "../../entity.js";
|
|
2
|
+
import { type SourceRecord } from "../../source.js";
|
|
3
|
+
import type { FetchMusicBrainzInput, MusicBrainzProviderOptions, MusicBrainzSearchInput, MusicBrainzProviderTransformOptions } from "./types.js";
|
|
4
|
+
export declare class MusicBrainzProvider {
|
|
5
|
+
readonly apiBase: string;
|
|
6
|
+
readonly coverArtBaseUrl: string | null;
|
|
7
|
+
readonly releaseGroupCoverArtBaseUrl: string | null;
|
|
8
|
+
readonly userAgent: string;
|
|
9
|
+
private readonly fetchImpl;
|
|
10
|
+
constructor(options?: MusicBrainzProviderOptions);
|
|
11
|
+
getJson<T>(path: string, params: Record<string, string>): Promise<T | undefined>;
|
|
12
|
+
transformOptions(): MusicBrainzProviderTransformOptions;
|
|
13
|
+
fetchReleaseSourceRecord(input: FetchMusicBrainzInput): Promise<SourceRecord | undefined>;
|
|
14
|
+
fetchRelease(input: FetchMusicBrainzInput): Promise<ZuuidData | undefined>;
|
|
15
|
+
searchReleaseSourceRecords(input: MusicBrainzSearchInput): Promise<SearchResponse<SourceRecord>>;
|
|
16
|
+
searchReleases(input: MusicBrainzSearchInput): Promise<SearchResponse<ZuuidSearchResult>>;
|
|
17
|
+
fetchReleaseGroupSourceRecord(input: FetchMusicBrainzInput): Promise<SourceRecord | undefined>;
|
|
18
|
+
fetchReleaseGroup(input: FetchMusicBrainzInput): Promise<ZuuidData | undefined>;
|
|
19
|
+
searchReleaseGroupSourceRecords(input: MusicBrainzSearchInput): Promise<SearchResponse<SourceRecord>>;
|
|
20
|
+
searchReleaseGroups(input: MusicBrainzSearchInput): Promise<SearchResponse<ZuuidSearchResult>>;
|
|
21
|
+
fetchRecordingSourceRecord(input: FetchMusicBrainzInput): Promise<SourceRecord | undefined>;
|
|
22
|
+
fetchRecording(input: FetchMusicBrainzInput): Promise<ZuuidData | undefined>;
|
|
23
|
+
searchRecordingSourceRecords(input: MusicBrainzSearchInput): Promise<SearchResponse<SourceRecord>>;
|
|
24
|
+
searchRecordings(input: MusicBrainzSearchInput): Promise<SearchResponse<ZuuidSearchResult>>;
|
|
25
|
+
fetchArtistSourceRecord(input: FetchMusicBrainzInput): Promise<SourceRecord | undefined>;
|
|
26
|
+
fetchArtist(input: FetchMusicBrainzInput): Promise<ZuuidData | undefined>;
|
|
27
|
+
searchArtistSourceRecords(input: MusicBrainzSearchInput): Promise<SearchResponse<SourceRecord>>;
|
|
28
|
+
searchArtists(input: MusicBrainzSearchInput): Promise<SearchResponse<ZuuidSearchResult>>;
|
|
29
|
+
fetchLabelSourceRecord(input: FetchMusicBrainzInput): Promise<SourceRecord | undefined>;
|
|
30
|
+
fetchLabel(input: FetchMusicBrainzInput): Promise<ZuuidData | undefined>;
|
|
31
|
+
searchLabelSourceRecords(input: MusicBrainzSearchInput): Promise<SearchResponse<SourceRecord>>;
|
|
32
|
+
searchLabels(input: MusicBrainzSearchInput): Promise<SearchResponse<ZuuidSearchResult>>;
|
|
33
|
+
fetchWorkSourceRecord(input: FetchMusicBrainzInput): Promise<SourceRecord | undefined>;
|
|
34
|
+
fetchWork(input: FetchMusicBrainzInput): Promise<ZuuidData | undefined>;
|
|
35
|
+
searchWorkSourceRecords(input: MusicBrainzSearchInput): Promise<SearchResponse<SourceRecord>>;
|
|
36
|
+
searchWorks(input: MusicBrainzSearchInput): Promise<SearchResponse<ZuuidSearchResult>>;
|
|
37
|
+
}
|
|
38
|
+
export declare function fetchMusicBrainzSourceRecord(provider: MusicBrainzProvider, category: string, input: FetchMusicBrainzInput): Promise<SourceRecord | undefined>;
|
|
39
|
+
export declare function searchMusicBrainzSourceRecords(provider: MusicBrainzProvider, category: string, input: MusicBrainzSearchInput): Promise<SearchResponse<SourceRecord>>;
|
|
40
|
+
export declare function searchMusicBrainz(provider: MusicBrainzProvider, category: string, input: MusicBrainzSearchInput, options?: MusicBrainzProviderTransformOptions): Promise<SearchResponse<ZuuidSearchResult>>;
|
|
41
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/providers/musicbrainz/client.ts"],"names":[],"mappings":"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"}
|