@charliehess/tmdb
Advanced tools
Comparing version 1.5.3 to 1.6.0
@@ -5,2 +5,3 @@ "use strict"; | ||
}; | ||
var _a; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -12,2 +13,3 @@ exports.TMDbAPI = void 0; | ||
const utils_1 = require("./utils"); | ||
const fetchImpl = (_a = window.fetch) !== null && _a !== void 0 ? _a : require('node-fetch'); | ||
const TMDB_URL = 'https://api.themoviedb.org/3'; | ||
@@ -83,3 +85,3 @@ const SEARCH_PATH = 'search'; | ||
const [movies, tvShows] = await Promise.all([interfaces_1.MediaType.MOVIE, interfaces_1.MediaType.TV_SHOW].map(async (type) => { | ||
const { results } = await fetch(this.searchQueryURL(query, type), { | ||
const { results } = await fetchImpl(this.searchQueryURL(query, type), { | ||
headers: this.headers, | ||
@@ -110,3 +112,3 @@ }).then((r) => r.json()); | ||
}); | ||
const response = await fetch(url.href, { | ||
const response = await fetchImpl(url.href, { | ||
headers: this.headers, | ||
@@ -133,3 +135,3 @@ }).then((r) => r.json()); | ||
throw new Error('Missing argument'); | ||
const media = await fetch(`${TMDB_URL}/${type}/${id}`, { | ||
const media = await fetchImpl(`${TMDB_URL}/${type}/${id}`, { | ||
headers: this.headers, | ||
@@ -147,3 +149,3 @@ }).then((r) => r.json()); | ||
: `${TMDB_URL}/${type}/${path}`; | ||
const response = await fetch(url, { | ||
const response = await fetchImpl(url, { | ||
headers: this.headers, | ||
@@ -158,3 +160,3 @@ }).then((r) => r.json()); | ||
async getMediaCredits(id, type) { | ||
const { cast, crew } = await fetch(`${TMDB_URL}/${type}/${id}/${CREDITS}`, { | ||
const { cast, crew } = await fetchImpl(`${TMDB_URL}/${type}/${id}/${CREDITS}`, { | ||
headers: this.headers, | ||
@@ -174,3 +176,3 @@ }).then((r) => r.json()); | ||
async getWatchProviders(id, type, locale = 'US') { | ||
const { results } = await fetch(`${TMDB_URL}/${type}/${id}/${WATCH_PROVIDERS}`, { | ||
const { results } = await fetchImpl(`${TMDB_URL}/${type}/${id}/${WATCH_PROVIDERS}`, { | ||
headers: this.headers, | ||
@@ -177,0 +179,0 @@ }).then((r) => r.json()); |
{ | ||
"name": "@charliehess/tmdb", | ||
"version": "1.5.3", | ||
"version": "1.6.0", | ||
"description": "Helpers for TheMovieDB", | ||
@@ -30,3 +30,4 @@ "main": "dist/index.js", | ||
"date-fns": "^2.16.1", | ||
"lodash": "^4.17.19" | ||
"lodash": "^4.17.19", | ||
"node-fetch": "^2.6.1" | ||
}, | ||
@@ -33,0 +34,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
50043
881
0
3
+ Addednode-fetch@^2.6.1
+ Addednode-fetch@2.7.0(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)