@tmdb-graphql-api/resolvers 0.0.6
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/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/cjs/index.cjs +3435 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/esm/index.mjs +3432 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/types/cjs/constants.d.cts +54 -0
- package/dist/types/cjs/constants.d.cts.map +1 -0
- package/dist/types/cjs/helpers/decodeId.d.cts +3 -0
- package/dist/types/cjs/helpers/decodeId.d.cts.map +1 -0
- package/dist/types/cjs/helpers/defaultFieldResolver.d.cts +4 -0
- package/dist/types/cjs/helpers/defaultFieldResolver.d.cts.map +1 -0
- package/dist/types/cjs/helpers/encodeId.d.cts +3 -0
- package/dist/types/cjs/helpers/encodeId.d.cts.map +1 -0
- package/dist/types/cjs/helpers/formatDirectionalSuffixes.d.cts +3 -0
- package/dist/types/cjs/helpers/formatDirectionalSuffixes.d.cts.map +1 -0
- package/dist/types/cjs/helpers/formatQueryParams.d.cts +6 -0
- package/dist/types/cjs/helpers/formatQueryParams.d.cts.map +1 -0
- package/dist/types/cjs/helpers/getAppendToResponseKeys.d.cts +4 -0
- package/dist/types/cjs/helpers/getAppendToResponseKeys.d.cts.map +1 -0
- package/dist/types/cjs/helpers/getTvIdSeasonAndEpisode.d.cts +8 -0
- package/dist/types/cjs/helpers/getTvIdSeasonAndEpisode.d.cts.map +1 -0
- package/dist/types/cjs/helpers/makeFallbackFieldResolvers.d.cts +3 -0
- package/dist/types/cjs/helpers/makeFallbackFieldResolvers.d.cts.map +1 -0
- package/dist/types/cjs/helpers/removeNullValues.d.cts +3 -0
- package/dist/types/cjs/helpers/removeNullValues.d.cts.map +1 -0
- package/dist/types/cjs/helpers/snakeCasePropNames.d.cts +4 -0
- package/dist/types/cjs/helpers/snakeCasePropNames.d.cts.map +1 -0
- package/dist/types/cjs/helpers/typePropNames.d.cts +2 -0
- package/dist/types/cjs/helpers/typePropNames.d.cts.map +1 -0
- package/dist/types/cjs/index.d.cts +3 -0
- package/dist/types/cjs/index.d.cts.map +1 -0
- package/dist/types/cjs/main.d.cts +3 -0
- package/dist/types/cjs/main.d.cts.map +1 -0
- package/dist/types/cjs/queries/certifications.d.cts +5 -0
- package/dist/types/cjs/queries/certifications.d.cts.map +1 -0
- package/dist/types/cjs/queries/collection.d.cts +3401 -0
- package/dist/types/cjs/queries/collection.d.cts.map +1 -0
- package/dist/types/cjs/queries/collectionImages.d.cts +14 -0
- package/dist/types/cjs/queries/collectionImages.d.cts.map +1 -0
- package/dist/types/cjs/queries/collectionTranslations.d.cts +18 -0
- package/dist/types/cjs/queries/collectionTranslations.d.cts.map +1 -0
- package/dist/types/cjs/queries/company.d.cts +15 -0
- package/dist/types/cjs/queries/company.d.cts.map +1 -0
- package/dist/types/cjs/queries/companyAlternativeNames.d.cts +10 -0
- package/dist/types/cjs/queries/companyAlternativeNames.d.cts.map +1 -0
- package/dist/types/cjs/queries/companyLogos.d.cts +14 -0
- package/dist/types/cjs/queries/companyLogos.d.cts.map +1 -0
- package/dist/types/cjs/queries/configuration.d.cts +16 -0
- package/dist/types/cjs/queries/configuration.d.cts.map +1 -0
- package/dist/types/cjs/queries/configurationCountries.d.cts +4 -0
- package/dist/types/cjs/queries/configurationCountries.d.cts.map +1 -0
- package/dist/types/cjs/queries/configurationJobs.d.cts +4 -0
- package/dist/types/cjs/queries/configurationJobs.d.cts.map +1 -0
- package/dist/types/cjs/queries/configurationLanguages.d.cts +4 -0
- package/dist/types/cjs/queries/configurationLanguages.d.cts.map +1 -0
- package/dist/types/cjs/queries/configurationPrimaryTranslations.d.cts +4 -0
- package/dist/types/cjs/queries/configurationPrimaryTranslations.d.cts.map +1 -0
- package/dist/types/cjs/queries/configurationTimezones.d.cts +4 -0
- package/dist/types/cjs/queries/configurationTimezones.d.cts.map +1 -0
- package/dist/types/cjs/queries/credit.d.cts +4196 -0
- package/dist/types/cjs/queries/credit.d.cts.map +1 -0
- package/dist/types/cjs/queries/discoverMovies.d.cts +15 -0
- package/dist/types/cjs/queries/discoverMovies.d.cts.map +1 -0
- package/dist/types/cjs/queries/discoverTv.d.cts +15 -0
- package/dist/types/cjs/queries/discoverTv.d.cts.map +1 -0
- package/dist/types/cjs/queries/episode.d.cts +98 -0
- package/dist/types/cjs/queries/episode.d.cts.map +1 -0
- package/dist/types/cjs/queries/episodeCredits.d.cts +33 -0
- package/dist/types/cjs/queries/episodeCredits.d.cts.map +1 -0
- package/dist/types/cjs/queries/episodeExternalIds.d.cts +16 -0
- package/dist/types/cjs/queries/episodeExternalIds.d.cts.map +1 -0
- package/dist/types/cjs/queries/episodeStills.d.cts +6 -0
- package/dist/types/cjs/queries/episodeStills.d.cts.map +1 -0
- package/dist/types/cjs/queries/episodeTranslations.d.cts +20 -0
- package/dist/types/cjs/queries/episodeTranslations.d.cts.map +1 -0
- package/dist/types/cjs/queries/episodeVideos.d.cts +16 -0
- package/dist/types/cjs/queries/episodeVideos.d.cts.map +1 -0
- package/dist/types/cjs/queries/find.d.cts +1803 -0
- package/dist/types/cjs/queries/find.d.cts.map +1 -0
- package/dist/types/cjs/queries/genres.d.cts +9 -0
- package/dist/types/cjs/queries/genres.d.cts.map +1 -0
- package/dist/types/cjs/queries/keyword.d.cts +9 -0
- package/dist/types/cjs/queries/keyword.d.cts.map +1 -0
- package/dist/types/cjs/queries/movie.d.cts +3597 -0
- package/dist/types/cjs/queries/movie.d.cts.map +1 -0
- package/dist/types/cjs/queries/movieAlternativeTitles.d.cts +7 -0
- package/dist/types/cjs/queries/movieAlternativeTitles.d.cts.map +1 -0
- package/dist/types/cjs/queries/movieCredits.d.cts +33 -0
- package/dist/types/cjs/queries/movieCredits.d.cts.map +1 -0
- package/dist/types/cjs/queries/movieExternalIds.d.cts +16 -0
- package/dist/types/cjs/queries/movieExternalIds.d.cts.map +1 -0
- package/dist/types/cjs/queries/movieImages.d.cts +6 -0
- package/dist/types/cjs/queries/movieImages.d.cts.map +1 -0
- package/dist/types/cjs/queries/movieKeywords.d.cts +6 -0
- package/dist/types/cjs/queries/movieKeywords.d.cts.map +1 -0
- package/dist/types/cjs/queries/movieRecommendations.d.cts +1866 -0
- package/dist/types/cjs/queries/movieRecommendations.d.cts.map +1 -0
- package/dist/types/cjs/queries/movieReleaseDates.d.cts +13 -0
- package/dist/types/cjs/queries/movieReleaseDates.d.cts.map +1 -0
- package/dist/types/cjs/queries/movieReviews.d.cts +1866 -0
- package/dist/types/cjs/queries/movieReviews.d.cts.map +1 -0
- package/dist/types/cjs/queries/movieSimilarMovies.d.cts +1866 -0
- package/dist/types/cjs/queries/movieSimilarMovies.d.cts.map +1 -0
- package/dist/types/cjs/queries/movieTranslations.d.cts +20 -0
- package/dist/types/cjs/queries/movieTranslations.d.cts.map +1 -0
- package/dist/types/cjs/queries/movieVideos.d.cts +16 -0
- package/dist/types/cjs/queries/movieVideos.d.cts.map +1 -0
- package/dist/types/cjs/queries/movieWatchProviders.d.cts +1375 -0
- package/dist/types/cjs/queries/movieWatchProviders.d.cts.map +1 -0
- package/dist/types/cjs/queries/network.d.cts +26 -0
- package/dist/types/cjs/queries/network.d.cts.map +1 -0
- package/dist/types/cjs/queries/networkAlternativeNames.d.cts +10 -0
- package/dist/types/cjs/queries/networkAlternativeNames.d.cts.map +1 -0
- package/dist/types/cjs/queries/networkLogos.d.cts +14 -0
- package/dist/types/cjs/queries/networkLogos.d.cts.map +1 -0
- package/dist/types/cjs/queries/person.d.cts +46 -0
- package/dist/types/cjs/queries/person.d.cts.map +1 -0
- package/dist/types/cjs/queries/personCombinedCredits.d.cts +6 -0
- package/dist/types/cjs/queries/personCombinedCredits.d.cts.map +1 -0
- package/dist/types/cjs/queries/personExternalIds.d.cts +6 -0
- package/dist/types/cjs/queries/personExternalIds.d.cts.map +1 -0
- package/dist/types/cjs/queries/personMovieCredits.d.cts +6 -0
- package/dist/types/cjs/queries/personMovieCredits.d.cts.map +1 -0
- package/dist/types/cjs/queries/personProfiles.d.cts +6 -0
- package/dist/types/cjs/queries/personProfiles.d.cts.map +1 -0
- package/dist/types/cjs/queries/personTranslations.d.cts +20 -0
- package/dist/types/cjs/queries/personTranslations.d.cts.map +1 -0
- package/dist/types/cjs/queries/personTvCredits.d.cts +6 -0
- package/dist/types/cjs/queries/personTvCredits.d.cts.map +1 -0
- package/dist/types/cjs/queries/rated.d.cts +17 -0
- package/dist/types/cjs/queries/rated.d.cts.map +1 -0
- package/dist/types/cjs/queries/review.d.cts +28 -0
- package/dist/types/cjs/queries/review.d.cts.map +1 -0
- package/dist/types/cjs/queries/search.d.cts +17 -0
- package/dist/types/cjs/queries/search.d.cts.map +1 -0
- package/dist/types/cjs/queries/season.d.cts +282 -0
- package/dist/types/cjs/queries/season.d.cts.map +1 -0
- package/dist/types/cjs/queries/seasonCredits.d.cts +33 -0
- package/dist/types/cjs/queries/seasonCredits.d.cts.map +1 -0
- package/dist/types/cjs/queries/seasonEpisodeCount.d.cts +3 -0
- package/dist/types/cjs/queries/seasonEpisodeCount.d.cts.map +1 -0
- package/dist/types/cjs/queries/seasonExternalIds.d.cts +6 -0
- package/dist/types/cjs/queries/seasonExternalIds.d.cts.map +1 -0
- package/dist/types/cjs/queries/seasonPosters.d.cts +6 -0
- package/dist/types/cjs/queries/seasonPosters.d.cts.map +1 -0
- package/dist/types/cjs/queries/seasonTranslations.d.cts +20 -0
- package/dist/types/cjs/queries/seasonTranslations.d.cts.map +1 -0
- package/dist/types/cjs/queries/seasonVideos.d.cts +16 -0
- package/dist/types/cjs/queries/seasonVideos.d.cts.map +1 -0
- package/dist/types/cjs/queries/trending.d.cts +17 -0
- package/dist/types/cjs/queries/trending.d.cts.map +1 -0
- package/dist/types/cjs/queries/tv.d.cts +10460 -0
- package/dist/types/cjs/queries/tv.d.cts.map +1 -0
- package/dist/types/cjs/queries/tvAlternativeTitles.d.cts +12 -0
- package/dist/types/cjs/queries/tvAlternativeTitles.d.cts.map +1 -0
- package/dist/types/cjs/queries/tvContentRatings.d.cts +10 -0
- package/dist/types/cjs/queries/tvContentRatings.d.cts.map +1 -0
- package/dist/types/cjs/queries/tvCredits.d.cts +33 -0
- package/dist/types/cjs/queries/tvCredits.d.cts.map +1 -0
- package/dist/types/cjs/queries/tvEpisodeGroups.d.cts +41 -0
- package/dist/types/cjs/queries/tvEpisodeGroups.d.cts.map +1 -0
- package/dist/types/cjs/queries/tvExternalIds.d.cts +16 -0
- package/dist/types/cjs/queries/tvExternalIds.d.cts.map +1 -0
- package/dist/types/cjs/queries/tvImages.d.cts +16 -0
- package/dist/types/cjs/queries/tvImages.d.cts.map +1 -0
- package/dist/types/cjs/queries/tvKeywords.d.cts +10 -0
- package/dist/types/cjs/queries/tvKeywords.d.cts.map +1 -0
- package/dist/types/cjs/queries/tvRecommendations.d.cts +5373 -0
- package/dist/types/cjs/queries/tvRecommendations.d.cts.map +1 -0
- package/dist/types/cjs/queries/tvReviews.d.cts +5373 -0
- package/dist/types/cjs/queries/tvReviews.d.cts.map +1 -0
- package/dist/types/cjs/queries/tvSimilarTvShows.d.cts +5373 -0
- package/dist/types/cjs/queries/tvSimilarTvShows.d.cts.map +1 -0
- package/dist/types/cjs/queries/tvTranslations.d.cts +20 -0
- package/dist/types/cjs/queries/tvTranslations.d.cts.map +1 -0
- package/dist/types/cjs/queries/tvVideos.d.cts +16 -0
- package/dist/types/cjs/queries/tvVideos.d.cts.map +1 -0
- package/dist/types/cjs/queries/tvWatchProviders.d.cts +1375 -0
- package/dist/types/cjs/queries/tvWatchProviders.d.cts.map +1 -0
- package/dist/types/cjs/queries/videoType.d.cts +3 -0
- package/dist/types/cjs/queries/videoType.d.cts.map +1 -0
- package/dist/types/cjs/types.d.cts +326 -0
- package/dist/types/cjs/types.d.cts.map +1 -0
- package/dist/types/esm/constants.d.ts +54 -0
- package/dist/types/esm/constants.d.ts.map +1 -0
- package/dist/types/esm/helpers/decodeId.d.ts +3 -0
- package/dist/types/esm/helpers/decodeId.d.ts.map +1 -0
- package/dist/types/esm/helpers/defaultFieldResolver.d.ts +4 -0
- package/dist/types/esm/helpers/defaultFieldResolver.d.ts.map +1 -0
- package/dist/types/esm/helpers/encodeId.d.ts +3 -0
- package/dist/types/esm/helpers/encodeId.d.ts.map +1 -0
- package/dist/types/esm/helpers/formatDirectionalSuffixes.d.ts +3 -0
- package/dist/types/esm/helpers/formatDirectionalSuffixes.d.ts.map +1 -0
- package/dist/types/esm/helpers/formatQueryParams.d.ts +6 -0
- package/dist/types/esm/helpers/formatQueryParams.d.ts.map +1 -0
- package/dist/types/esm/helpers/getAppendToResponseKeys.d.ts +4 -0
- package/dist/types/esm/helpers/getAppendToResponseKeys.d.ts.map +1 -0
- package/dist/types/esm/helpers/getTvIdSeasonAndEpisode.d.ts +8 -0
- package/dist/types/esm/helpers/getTvIdSeasonAndEpisode.d.ts.map +1 -0
- package/dist/types/esm/helpers/makeFallbackFieldResolvers.d.ts +3 -0
- package/dist/types/esm/helpers/makeFallbackFieldResolvers.d.ts.map +1 -0
- package/dist/types/esm/helpers/removeNullValues.d.ts +3 -0
- package/dist/types/esm/helpers/removeNullValues.d.ts.map +1 -0
- package/dist/types/esm/helpers/snakeCasePropNames.d.ts +4 -0
- package/dist/types/esm/helpers/snakeCasePropNames.d.ts.map +1 -0
- package/dist/types/esm/helpers/typePropNames.d.ts +2 -0
- package/dist/types/esm/helpers/typePropNames.d.ts.map +1 -0
- package/dist/types/esm/index.d.ts +3 -0
- package/dist/types/esm/index.d.ts.map +1 -0
- package/dist/types/esm/main.d.ts +3 -0
- package/dist/types/esm/main.d.ts.map +1 -0
- package/dist/types/esm/queries/certifications.d.ts +5 -0
- package/dist/types/esm/queries/certifications.d.ts.map +1 -0
- package/dist/types/esm/queries/collection.d.ts +3401 -0
- package/dist/types/esm/queries/collection.d.ts.map +1 -0
- package/dist/types/esm/queries/collectionImages.d.ts +14 -0
- package/dist/types/esm/queries/collectionImages.d.ts.map +1 -0
- package/dist/types/esm/queries/collectionTranslations.d.ts +18 -0
- package/dist/types/esm/queries/collectionTranslations.d.ts.map +1 -0
- package/dist/types/esm/queries/company.d.ts +15 -0
- package/dist/types/esm/queries/company.d.ts.map +1 -0
- package/dist/types/esm/queries/companyAlternativeNames.d.ts +10 -0
- package/dist/types/esm/queries/companyAlternativeNames.d.ts.map +1 -0
- package/dist/types/esm/queries/companyLogos.d.ts +14 -0
- package/dist/types/esm/queries/companyLogos.d.ts.map +1 -0
- package/dist/types/esm/queries/configuration.d.ts +16 -0
- package/dist/types/esm/queries/configuration.d.ts.map +1 -0
- package/dist/types/esm/queries/configurationCountries.d.ts +4 -0
- package/dist/types/esm/queries/configurationCountries.d.ts.map +1 -0
- package/dist/types/esm/queries/configurationJobs.d.ts +4 -0
- package/dist/types/esm/queries/configurationJobs.d.ts.map +1 -0
- package/dist/types/esm/queries/configurationLanguages.d.ts +4 -0
- package/dist/types/esm/queries/configurationLanguages.d.ts.map +1 -0
- package/dist/types/esm/queries/configurationPrimaryTranslations.d.ts +4 -0
- package/dist/types/esm/queries/configurationPrimaryTranslations.d.ts.map +1 -0
- package/dist/types/esm/queries/configurationTimezones.d.ts +4 -0
- package/dist/types/esm/queries/configurationTimezones.d.ts.map +1 -0
- package/dist/types/esm/queries/credit.d.ts +4196 -0
- package/dist/types/esm/queries/credit.d.ts.map +1 -0
- package/dist/types/esm/queries/discoverMovies.d.ts +15 -0
- package/dist/types/esm/queries/discoverMovies.d.ts.map +1 -0
- package/dist/types/esm/queries/discoverTv.d.ts +15 -0
- package/dist/types/esm/queries/discoverTv.d.ts.map +1 -0
- package/dist/types/esm/queries/episode.d.ts +98 -0
- package/dist/types/esm/queries/episode.d.ts.map +1 -0
- package/dist/types/esm/queries/episodeCredits.d.ts +33 -0
- package/dist/types/esm/queries/episodeCredits.d.ts.map +1 -0
- package/dist/types/esm/queries/episodeExternalIds.d.ts +16 -0
- package/dist/types/esm/queries/episodeExternalIds.d.ts.map +1 -0
- package/dist/types/esm/queries/episodeStills.d.ts +6 -0
- package/dist/types/esm/queries/episodeStills.d.ts.map +1 -0
- package/dist/types/esm/queries/episodeTranslations.d.ts +20 -0
- package/dist/types/esm/queries/episodeTranslations.d.ts.map +1 -0
- package/dist/types/esm/queries/episodeVideos.d.ts +16 -0
- package/dist/types/esm/queries/episodeVideos.d.ts.map +1 -0
- package/dist/types/esm/queries/find.d.ts +1803 -0
- package/dist/types/esm/queries/find.d.ts.map +1 -0
- package/dist/types/esm/queries/genres.d.ts +9 -0
- package/dist/types/esm/queries/genres.d.ts.map +1 -0
- package/dist/types/esm/queries/keyword.d.ts +9 -0
- package/dist/types/esm/queries/keyword.d.ts.map +1 -0
- package/dist/types/esm/queries/movie.d.ts +3597 -0
- package/dist/types/esm/queries/movie.d.ts.map +1 -0
- package/dist/types/esm/queries/movieAlternativeTitles.d.ts +7 -0
- package/dist/types/esm/queries/movieAlternativeTitles.d.ts.map +1 -0
- package/dist/types/esm/queries/movieCredits.d.ts +33 -0
- package/dist/types/esm/queries/movieCredits.d.ts.map +1 -0
- package/dist/types/esm/queries/movieExternalIds.d.ts +16 -0
- package/dist/types/esm/queries/movieExternalIds.d.ts.map +1 -0
- package/dist/types/esm/queries/movieImages.d.ts +6 -0
- package/dist/types/esm/queries/movieImages.d.ts.map +1 -0
- package/dist/types/esm/queries/movieKeywords.d.ts +6 -0
- package/dist/types/esm/queries/movieKeywords.d.ts.map +1 -0
- package/dist/types/esm/queries/movieRecommendations.d.ts +1866 -0
- package/dist/types/esm/queries/movieRecommendations.d.ts.map +1 -0
- package/dist/types/esm/queries/movieReleaseDates.d.ts +13 -0
- package/dist/types/esm/queries/movieReleaseDates.d.ts.map +1 -0
- package/dist/types/esm/queries/movieReviews.d.ts +1866 -0
- package/dist/types/esm/queries/movieReviews.d.ts.map +1 -0
- package/dist/types/esm/queries/movieSimilarMovies.d.ts +1866 -0
- package/dist/types/esm/queries/movieSimilarMovies.d.ts.map +1 -0
- package/dist/types/esm/queries/movieTranslations.d.ts +20 -0
- package/dist/types/esm/queries/movieTranslations.d.ts.map +1 -0
- package/dist/types/esm/queries/movieVideos.d.ts +16 -0
- package/dist/types/esm/queries/movieVideos.d.ts.map +1 -0
- package/dist/types/esm/queries/movieWatchProviders.d.ts +1375 -0
- package/dist/types/esm/queries/movieWatchProviders.d.ts.map +1 -0
- package/dist/types/esm/queries/network.d.ts +26 -0
- package/dist/types/esm/queries/network.d.ts.map +1 -0
- package/dist/types/esm/queries/networkAlternativeNames.d.ts +10 -0
- package/dist/types/esm/queries/networkAlternativeNames.d.ts.map +1 -0
- package/dist/types/esm/queries/networkLogos.d.ts +14 -0
- package/dist/types/esm/queries/networkLogos.d.ts.map +1 -0
- package/dist/types/esm/queries/person.d.ts +46 -0
- package/dist/types/esm/queries/person.d.ts.map +1 -0
- package/dist/types/esm/queries/personCombinedCredits.d.ts +6 -0
- package/dist/types/esm/queries/personCombinedCredits.d.ts.map +1 -0
- package/dist/types/esm/queries/personExternalIds.d.ts +6 -0
- package/dist/types/esm/queries/personExternalIds.d.ts.map +1 -0
- package/dist/types/esm/queries/personMovieCredits.d.ts +6 -0
- package/dist/types/esm/queries/personMovieCredits.d.ts.map +1 -0
- package/dist/types/esm/queries/personProfiles.d.ts +6 -0
- package/dist/types/esm/queries/personProfiles.d.ts.map +1 -0
- package/dist/types/esm/queries/personTranslations.d.ts +20 -0
- package/dist/types/esm/queries/personTranslations.d.ts.map +1 -0
- package/dist/types/esm/queries/personTvCredits.d.ts +6 -0
- package/dist/types/esm/queries/personTvCredits.d.ts.map +1 -0
- package/dist/types/esm/queries/rated.d.ts +17 -0
- package/dist/types/esm/queries/rated.d.ts.map +1 -0
- package/dist/types/esm/queries/review.d.ts +28 -0
- package/dist/types/esm/queries/review.d.ts.map +1 -0
- package/dist/types/esm/queries/search.d.ts +17 -0
- package/dist/types/esm/queries/search.d.ts.map +1 -0
- package/dist/types/esm/queries/season.d.ts +282 -0
- package/dist/types/esm/queries/season.d.ts.map +1 -0
- package/dist/types/esm/queries/seasonCredits.d.ts +33 -0
- package/dist/types/esm/queries/seasonCredits.d.ts.map +1 -0
- package/dist/types/esm/queries/seasonEpisodeCount.d.ts +3 -0
- package/dist/types/esm/queries/seasonEpisodeCount.d.ts.map +1 -0
- package/dist/types/esm/queries/seasonExternalIds.d.ts +6 -0
- package/dist/types/esm/queries/seasonExternalIds.d.ts.map +1 -0
- package/dist/types/esm/queries/seasonPosters.d.ts +6 -0
- package/dist/types/esm/queries/seasonPosters.d.ts.map +1 -0
- package/dist/types/esm/queries/seasonTranslations.d.ts +20 -0
- package/dist/types/esm/queries/seasonTranslations.d.ts.map +1 -0
- package/dist/types/esm/queries/seasonVideos.d.ts +16 -0
- package/dist/types/esm/queries/seasonVideos.d.ts.map +1 -0
- package/dist/types/esm/queries/trending.d.ts +17 -0
- package/dist/types/esm/queries/trending.d.ts.map +1 -0
- package/dist/types/esm/queries/tv.d.ts +10460 -0
- package/dist/types/esm/queries/tv.d.ts.map +1 -0
- package/dist/types/esm/queries/tvAlternativeTitles.d.ts +12 -0
- package/dist/types/esm/queries/tvAlternativeTitles.d.ts.map +1 -0
- package/dist/types/esm/queries/tvContentRatings.d.ts +10 -0
- package/dist/types/esm/queries/tvContentRatings.d.ts.map +1 -0
- package/dist/types/esm/queries/tvCredits.d.ts +33 -0
- package/dist/types/esm/queries/tvCredits.d.ts.map +1 -0
- package/dist/types/esm/queries/tvEpisodeGroups.d.ts +41 -0
- package/dist/types/esm/queries/tvEpisodeGroups.d.ts.map +1 -0
- package/dist/types/esm/queries/tvExternalIds.d.ts +16 -0
- package/dist/types/esm/queries/tvExternalIds.d.ts.map +1 -0
- package/dist/types/esm/queries/tvImages.d.ts +16 -0
- package/dist/types/esm/queries/tvImages.d.ts.map +1 -0
- package/dist/types/esm/queries/tvKeywords.d.ts +10 -0
- package/dist/types/esm/queries/tvKeywords.d.ts.map +1 -0
- package/dist/types/esm/queries/tvRecommendations.d.ts +5373 -0
- package/dist/types/esm/queries/tvRecommendations.d.ts.map +1 -0
- package/dist/types/esm/queries/tvReviews.d.ts +5373 -0
- package/dist/types/esm/queries/tvReviews.d.ts.map +1 -0
- package/dist/types/esm/queries/tvSimilarTvShows.d.ts +5373 -0
- package/dist/types/esm/queries/tvSimilarTvShows.d.ts.map +1 -0
- package/dist/types/esm/queries/tvTranslations.d.ts +20 -0
- package/dist/types/esm/queries/tvTranslations.d.ts.map +1 -0
- package/dist/types/esm/queries/tvVideos.d.ts +16 -0
- package/dist/types/esm/queries/tvVideos.d.ts.map +1 -0
- package/dist/types/esm/queries/tvWatchProviders.d.ts +1375 -0
- package/dist/types/esm/queries/tvWatchProviders.d.ts.map +1 -0
- package/dist/types/esm/queries/videoType.d.ts +3 -0
- package/dist/types/esm/queries/videoType.d.ts.map +1 -0
- package/dist/types/esm/types.d.ts +326 -0
- package/dist/types/esm/types.d.ts.map +1 -0
- package/dist/types/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +71 -0
- package/src/__testUtils__/helpers/buildEndpoint.ts +21 -0
- package/src/__testUtils__/helpers/buildResolveInfoArg.ts +34 -0
- package/src/__testUtils__/helpers/createRestClient.ts +9 -0
- package/src/constants.ts +71 -0
- package/src/helpers/__snapshots__/typePropNames.test.ts.snap +708 -0
- package/src/helpers/decodeId.ts +4 -0
- package/src/helpers/defaultFieldResolver.ts +19 -0
- package/src/helpers/encodeId.ts +4 -0
- package/src/helpers/formatDirectionalSuffixes.ts +15 -0
- package/src/helpers/formatQueryParams.ts +8 -0
- package/src/helpers/getAppendToResponseKeys.ts +28 -0
- package/src/helpers/getTvIdSeasonAndEpisode.ts +25 -0
- package/src/helpers/makeFallbackFieldResolvers.ts +11 -0
- package/src/helpers/removeNullValues.ts +11 -0
- package/src/helpers/snakeCasePropNames.ts +9 -0
- package/src/helpers/typePropNames.test.ts +7 -0
- package/src/helpers/typePropNames.ts +14 -0
- package/src/index.ts +2 -0
- package/src/main.ts +215 -0
- package/src/queries/__snapshots__/certifications.test.ts.snap +1365 -0
- package/src/queries/__snapshots__/collection.test.ts.snap +195 -0
- package/src/queries/__snapshots__/collectionImages.test.ts.snap +29 -0
- package/src/queries/__snapshots__/collectionTranslations.test.ts.snap +391 -0
- package/src/queries/__snapshots__/company.test.ts.snap +14 -0
- package/src/queries/__snapshots__/companyAlternativeNames.test.ts.snap +14 -0
- package/src/queries/__snapshots__/companyLogos.test.ts.snap +46 -0
- package/src/queries/__snapshots__/configuration.test.ts.snap +101 -0
- package/src/queries/__snapshots__/configurationCountries.test.ts.snap +1241 -0
- package/src/queries/__snapshots__/configurationJobs.test.ts.snap +1007 -0
- package/src/queries/__snapshots__/configurationLanguages.test.ts.snap +941 -0
- package/src/queries/__snapshots__/configurationPrimaryTranslations.test.ts.snap +76 -0
- package/src/queries/__snapshots__/configurationTimezones.test.ts.snap +1678 -0
- package/src/queries/__snapshots__/credit.test.ts.snap +106 -0
- package/src/queries/__snapshots__/discoverMovies.test.ts.snap +481 -0
- package/src/queries/__snapshots__/discoverTv.test.ts.snap +443 -0
- package/src/queries/__snapshots__/episode.test.ts.snap +360 -0
- package/src/queries/__snapshots__/episodeCredits.test.ts.snap +866 -0
- package/src/queries/__snapshots__/episodeExternalIds.test.ts.snap +21 -0
- package/src/queries/__snapshots__/episodeStills.test.ts.snap +281 -0
- package/src/queries/__snapshots__/episodeTranslations.test.ts.snap +1059 -0
- package/src/queries/__snapshots__/episodeVideos.test.ts.snap +5 -0
- package/src/queries/__snapshots__/find.test.ts.snap +86 -0
- package/src/queries/__snapshots__/genres.test.ts.snap +151 -0
- package/src/queries/__snapshots__/keyword.test.ts.snap +8 -0
- package/src/queries/__snapshots__/movie.test.ts.snap +73 -0
- package/src/queries/__snapshots__/movieAlternativeTitles.test.ts.snap +611 -0
- package/src/queries/__snapshots__/movieCredits.test.ts.snap +2690 -0
- package/src/queries/__snapshots__/movieExternalIds.test.ts.snap +19 -0
- package/src/queries/__snapshots__/movieImages.test.ts.snap +7 -0
- package/src/queries/__snapshots__/movieKeywords.test.ts.snap +147 -0
- package/src/queries/__snapshots__/movieRecommendations.test.ts.snap +727 -0
- package/src/queries/__snapshots__/movieReleaseDates.test.ts.snap +755 -0
- package/src/queries/__snapshots__/movieReviews.test.ts.snap +509 -0
- package/src/queries/__snapshots__/movieSimilarMovies.test.ts.snap +693 -0
- package/src/queries/__snapshots__/movieTranslations.test.ts.snap +1079 -0
- package/src/queries/__snapshots__/movieVideos.test.ts.snap +179 -0
- package/src/queries/__snapshots__/movieWatchProviders.test.ts.snap +5321 -0
- package/src/queries/__snapshots__/network.test.ts.snap +12 -0
- package/src/queries/__snapshots__/networkAlternativeNames.test.ts.snap +18 -0
- package/src/queries/__snapshots__/networkLogos.test.ts.snap +16 -0
- package/src/queries/__snapshots__/person.test.ts.snap +35 -0
- package/src/queries/__snapshots__/personCombinedCredits.test.ts.snap +7249 -0
- package/src/queries/__snapshots__/personExternalIds.test.ts.snap +25 -0
- package/src/queries/__snapshots__/personMovieCredits.test.ts.snap +5595 -0
- package/src/queries/__snapshots__/personProfiles.test.ts.snap +155 -0
- package/src/queries/__snapshots__/personTranslations.test.ts.snap +389 -0
- package/src/queries/__snapshots__/personTvCredits.test.ts.snap +1361 -0
- package/src/queries/__snapshots__/rated.test.ts.snap +547 -0
- package/src/queries/__snapshots__/review.test.ts.snap +31 -0
- package/src/queries/__snapshots__/search.test.ts.snap +2479 -0
- package/src/queries/__snapshots__/season.test.ts.snap +4694 -0
- package/src/queries/__snapshots__/seasonCredits.test.ts.snap +692 -0
- package/src/queries/__snapshots__/seasonExternalIds.test.ts.snap +19 -0
- package/src/queries/__snapshots__/seasonPosters.test.ts.snap +5 -0
- package/src/queries/__snapshots__/seasonTranslations.test.ts.snap +1073 -0
- package/src/queries/__snapshots__/seasonVideos.test.ts.snap +395 -0
- package/src/queries/__snapshots__/trending.test.ts.snap +481 -0
- package/src/queries/__snapshots__/tv.test.ts.snap +220 -0
- package/src/queries/__snapshots__/tvAlternativeTitles.test.ts.snap +211 -0
- package/src/queries/__snapshots__/tvContentRatings.test.ts.snap +115 -0
- package/src/queries/__snapshots__/tvCredits.test.ts.snap +809 -0
- package/src/queries/__snapshots__/tvEpisodeGroups.test.ts.snap +39 -0
- package/src/queries/__snapshots__/tvExternalIds.test.ts.snap +27 -0
- package/src/queries/__snapshots__/tvImages.test.ts.snap +7 -0
- package/src/queries/__snapshots__/tvKeywords.test.ts.snap +59 -0
- package/src/queries/__snapshots__/tvRecommendations.test.ts.snap +757 -0
- package/src/queries/__snapshots__/tvReviews.test.ts.snap +562 -0
- package/src/queries/__snapshots__/tvSimilarTvShows.test.ts.snap +759 -0
- package/src/queries/__snapshots__/tvTranslations.test.ts.snap +1267 -0
- package/src/queries/__snapshots__/tvVideos.test.ts.snap +107 -0
- package/src/queries/__snapshots__/tvWatchProviders.test.ts.snap +2817 -0
- package/src/queries/certifications.test.ts +66 -0
- package/src/queries/certifications.ts +29 -0
- package/src/queries/collection.test.ts +47 -0
- package/src/queries/collection.ts +40 -0
- package/src/queries/collectionImages.test.ts +90 -0
- package/src/queries/collectionImages.ts +30 -0
- package/src/queries/collectionTranslations.test.ts +45 -0
- package/src/queries/collectionTranslations.ts +28 -0
- package/src/queries/company.test.ts +45 -0
- package/src/queries/company.ts +40 -0
- package/src/queries/companyAlternativeNames.test.ts +45 -0
- package/src/queries/companyAlternativeNames.ts +29 -0
- package/src/queries/companyLogos.test.ts +45 -0
- package/src/queries/companyLogos.ts +28 -0
- package/src/queries/configuration.test.ts +44 -0
- package/src/queries/configuration.ts +23 -0
- package/src/queries/configurationCountries.test.ts +45 -0
- package/src/queries/configurationCountries.ts +28 -0
- package/src/queries/configurationJobs.test.ts +45 -0
- package/src/queries/configurationJobs.ts +28 -0
- package/src/queries/configurationLanguages.test.ts +45 -0
- package/src/queries/configurationLanguages.ts +28 -0
- package/src/queries/configurationPrimaryTranslations.test.ts +45 -0
- package/src/queries/configurationPrimaryTranslations.ts +29 -0
- package/src/queries/configurationTimezones.test.ts +45 -0
- package/src/queries/configurationTimezones.ts +28 -0
- package/src/queries/credit.test.ts +45 -0
- package/src/queries/credit.ts +26 -0
- package/src/queries/discoverMovies.test.ts +202 -0
- package/src/queries/discoverMovies.ts +65 -0
- package/src/queries/discoverTv.test.ts +142 -0
- package/src/queries/discoverTv.ts +66 -0
- package/src/queries/episode.test.ts +82 -0
- package/src/queries/episode.ts +73 -0
- package/src/queries/episodeCredits.test.ts +134 -0
- package/src/queries/episodeCredits.ts +41 -0
- package/src/queries/episodeExternalIds.test.ts +104 -0
- package/src/queries/episodeExternalIds.ts +40 -0
- package/src/queries/episodeStills.test.ts +96 -0
- package/src/queries/episodeStills.ts +38 -0
- package/src/queries/episodeTranslations.test.ts +96 -0
- package/src/queries/episodeTranslations.ts +38 -0
- package/src/queries/episodeVideos.test.ts +96 -0
- package/src/queries/episodeVideos.ts +38 -0
- package/src/queries/find.test.ts +48 -0
- package/src/queries/find.ts +35 -0
- package/src/queries/genres.test.ts +66 -0
- package/src/queries/genres.ts +29 -0
- package/src/queries/keyword.test.ts +45 -0
- package/src/queries/keyword.ts +28 -0
- package/src/queries/movie.test.ts +81 -0
- package/src/queries/movie.ts +87 -0
- package/src/queries/movieAlternativeTitles.test.ts +95 -0
- package/src/queries/movieAlternativeTitles.ts +37 -0
- package/src/queries/movieCredits.test.ts +118 -0
- package/src/queries/movieCredits.ts +35 -0
- package/src/queries/movieExternalIds.test.ts +95 -0
- package/src/queries/movieExternalIds.ts +35 -0
- package/src/queries/movieImages.test.ts +118 -0
- package/src/queries/movieImages.ts +35 -0
- package/src/queries/movieKeywords.test.ts +95 -0
- package/src/queries/movieKeywords.ts +33 -0
- package/src/queries/movieRecommendations.test.ts +173 -0
- package/src/queries/movieRecommendations.ts +74 -0
- package/src/queries/movieReleaseDates.test.ts +103 -0
- package/src/queries/movieReleaseDates.ts +34 -0
- package/src/queries/movieReviews.test.ts +152 -0
- package/src/queries/movieReviews.ts +74 -0
- package/src/queries/movieSimilarMovies.test.ts +173 -0
- package/src/queries/movieSimilarMovies.ts +74 -0
- package/src/queries/movieTranslations.test.ts +99 -0
- package/src/queries/movieTranslations.ts +33 -0
- package/src/queries/movieVideos.test.ts +95 -0
- package/src/queries/movieVideos.ts +33 -0
- package/src/queries/movieWatchProviders.test.ts +103 -0
- package/src/queries/movieWatchProviders.ts +33 -0
- package/src/queries/network.test.ts +45 -0
- package/src/queries/network.ts +40 -0
- package/src/queries/networkAlternativeNames.test.ts +45 -0
- package/src/queries/networkAlternativeNames.ts +29 -0
- package/src/queries/networkLogos.test.ts +45 -0
- package/src/queries/networkLogos.ts +28 -0
- package/src/queries/person.test.ts +81 -0
- package/src/queries/person.ts +67 -0
- package/src/queries/personCombinedCredits.test.ts +99 -0
- package/src/queries/personCombinedCredits.ts +35 -0
- package/src/queries/personExternalIds.test.ts +99 -0
- package/src/queries/personExternalIds.ts +35 -0
- package/src/queries/personMovieCredits.test.ts +99 -0
- package/src/queries/personMovieCredits.ts +35 -0
- package/src/queries/personProfiles.test.ts +98 -0
- package/src/queries/personProfiles.ts +33 -0
- package/src/queries/personTranslations.test.ts +99 -0
- package/src/queries/personTranslations.ts +33 -0
- package/src/queries/personTvCredits.test.ts +99 -0
- package/src/queries/personTvCredits.ts +35 -0
- package/src/queries/rated.test.ts +170 -0
- package/src/queries/rated.ts +70 -0
- package/src/queries/review.test.ts +45 -0
- package/src/queries/review.ts +40 -0
- package/src/queries/search.test.ts +426 -0
- package/src/queries/search.ts +73 -0
- package/src/queries/season.test.ts +82 -0
- package/src/queries/season.ts +78 -0
- package/src/queries/seasonCredits.test.ts +118 -0
- package/src/queries/seasonCredits.ts +35 -0
- package/src/queries/seasonEpisodeCount.ts +9 -0
- package/src/queries/seasonExternalIds.test.ts +103 -0
- package/src/queries/seasonExternalIds.ts +35 -0
- package/src/queries/seasonPosters.test.ts +94 -0
- package/src/queries/seasonPosters.ts +33 -0
- package/src/queries/seasonTranslations.test.ts +102 -0
- package/src/queries/seasonTranslations.ts +33 -0
- package/src/queries/seasonVideos.test.ts +102 -0
- package/src/queries/seasonVideos.ts +33 -0
- package/src/queries/trending.test.ts +165 -0
- package/src/queries/trending.ts +70 -0
- package/src/queries/tv.test.ts +81 -0
- package/src/queries/tv.ts +98 -0
- package/src/queries/tvAlternativeTitles.test.ts +103 -0
- package/src/queries/tvAlternativeTitles.ts +35 -0
- package/src/queries/tvContentRatings.test.ts +103 -0
- package/src/queries/tvContentRatings.ts +35 -0
- package/src/queries/tvCredits.test.ts +118 -0
- package/src/queries/tvCredits.ts +35 -0
- package/src/queries/tvEpisodeGroups.test.ts +103 -0
- package/src/queries/tvEpisodeGroups.ts +34 -0
- package/src/queries/tvExternalIds.test.ts +103 -0
- package/src/queries/tvExternalIds.ts +35 -0
- package/src/queries/tvImages.test.ts +118 -0
- package/src/queries/tvImages.ts +35 -0
- package/src/queries/tvKeywords.test.ts +103 -0
- package/src/queries/tvKeywords.ts +33 -0
- package/src/queries/tvRecommendations.test.ts +173 -0
- package/src/queries/tvRecommendations.ts +74 -0
- package/src/queries/tvReviews.test.ts +168 -0
- package/src/queries/tvReviews.ts +74 -0
- package/src/queries/tvSimilarTvShows.test.ts +168 -0
- package/src/queries/tvSimilarTvShows.ts +74 -0
- package/src/queries/tvTranslations.test.ts +103 -0
- package/src/queries/tvTranslations.ts +33 -0
- package/src/queries/tvVideos.test.ts +103 -0
- package/src/queries/tvVideos.ts +33 -0
- package/src/queries/tvWatchProviders.test.ts +103 -0
- package/src/queries/tvWatchProviders.ts +33 -0
- package/src/queries/videoType.ts +4 -0
- package/src/types.ts +476 -0
- package/tsconfig.build.json +11 -0
- package/tsconfig.json +18 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import { CERTIFICATIONS_PATH, type ShortcutMethodNames } from '@tmdb-graphql-api/rest-client';
|
|
3
|
+
import movieCertifications from '@tmdb-graphql-api/test-utils/responses/themoviedb/certifications/movie.json';
|
|
4
|
+
import tvCertifications from '@tmdb-graphql-api/test-utils/responses/themoviedb/certifications/tv.json';
|
|
5
|
+
import { mockFetch, polyfillFetch } from 'fetch-mocked';
|
|
6
|
+
import type { Getta, ShortcutProperties } from 'getta';
|
|
7
|
+
import type { GraphQLResolveInfo } from 'graphql';
|
|
8
|
+
import { buildEndpoint } from '../__testUtils__/helpers/buildEndpoint.ts';
|
|
9
|
+
import { createRestClient } from '../__testUtils__/helpers/createRestClient.ts';
|
|
10
|
+
import { type Context, ScreenType } from '../types.ts';
|
|
11
|
+
import { resolveCertifications } from './certifications.ts';
|
|
12
|
+
|
|
13
|
+
polyfillFetch();
|
|
14
|
+
const mockedFetch = mockFetch(jest.fn);
|
|
15
|
+
|
|
16
|
+
describe('resolveCertifications >', () => {
|
|
17
|
+
let restClient: Getta & ShortcutProperties<ShortcutMethodNames>;
|
|
18
|
+
const setCacheMetadata = jest.fn();
|
|
19
|
+
|
|
20
|
+
beforeAll(() => {
|
|
21
|
+
restClient = createRestClient();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
afterEach(async () => {
|
|
25
|
+
mockedFetch.mockReset();
|
|
26
|
+
await restClient.cache?.clear();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
describe("when the screenType is 'MOVIE' >", () => {
|
|
30
|
+
beforeEach(() => {
|
|
31
|
+
mockedFetch.mockGetOnce(buildEndpoint(CERTIFICATIONS_PATH, { type: ScreenType.MOVIE.toLowerCase() }), {
|
|
32
|
+
body: movieCertifications,
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('should return the movie certifications', async () => {
|
|
37
|
+
await expect(
|
|
38
|
+
resolveCertifications(
|
|
39
|
+
undefined,
|
|
40
|
+
{ screenType: ScreenType.MOVIE },
|
|
41
|
+
{ restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
|
|
42
|
+
{} as GraphQLResolveInfo
|
|
43
|
+
)
|
|
44
|
+
).resolves.toMatchSnapshot();
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
describe("when the screenType is 'TV' >", () => {
|
|
49
|
+
beforeEach(() => {
|
|
50
|
+
mockedFetch.mockGetOnce(buildEndpoint(CERTIFICATIONS_PATH, { type: ScreenType.TV.toLowerCase() }), {
|
|
51
|
+
body: tvCertifications,
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('should return the tv certifications', async () => {
|
|
56
|
+
await expect(
|
|
57
|
+
resolveCertifications(
|
|
58
|
+
undefined,
|
|
59
|
+
{ screenType: ScreenType.TV },
|
|
60
|
+
{ restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
|
|
61
|
+
{} as GraphQLResolveInfo
|
|
62
|
+
)
|
|
63
|
+
).resolves.toMatchSnapshot();
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Certifications, QueryCertificationsArgs } from '@tmdb-graphql-api/schema';
|
|
2
|
+
import { GraphQLError } from 'graphql';
|
|
3
|
+
import type { GraphQLResolveInfo } from 'graphql';
|
|
4
|
+
import { CERTIFICATIONS } from '../constants.ts';
|
|
5
|
+
import type { Context } from '../types.ts';
|
|
6
|
+
|
|
7
|
+
export const resolveCertifications = async (
|
|
8
|
+
_obj: undefined,
|
|
9
|
+
{ screenType }: QueryCertificationsArgs,
|
|
10
|
+
{ requestID, restClient, setCacheMetadata, tmdbGuestSessionId }: Context,
|
|
11
|
+
{ fieldNodes }: GraphQLResolveInfo
|
|
12
|
+
) => {
|
|
13
|
+
const { data, errors } = await restClient.certifications<{ certifications: Certifications }>(
|
|
14
|
+
{
|
|
15
|
+
pathTemplateData: { type: screenType.toLowerCase() },
|
|
16
|
+
},
|
|
17
|
+
{ requestID, tmdbGuestSessionId }
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
if (errors?.length) {
|
|
21
|
+
throw new GraphQLError(`Failed to resolve ${screenType} ${CERTIFICATIONS}.`, {
|
|
22
|
+
nodes: fieldNodes,
|
|
23
|
+
originalError: errors[0],
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
setCacheMetadata(CERTIFICATIONS, { cacheControl: 'public, max-age=28800' } as unknown as Headers);
|
|
28
|
+
return data?.certifications;
|
|
29
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import { COLLECTION_PATH, type ShortcutMethodNames } from '@tmdb-graphql-api/rest-client';
|
|
3
|
+
import collectionDetails from '@tmdb-graphql-api/test-utils/responses/themoviedb/collection/details.json';
|
|
4
|
+
import { mockFetch, polyfillFetch } from 'fetch-mocked';
|
|
5
|
+
import type { Getta, ShortcutProperties } from 'getta';
|
|
6
|
+
import type { GraphQLResolveInfo } from 'graphql';
|
|
7
|
+
import { buildEndpoint } from '../__testUtils__/helpers/buildEndpoint.ts';
|
|
8
|
+
import { createRestClient } from '../__testUtils__/helpers/createRestClient.ts';
|
|
9
|
+
import type { Context } from '../types.ts';
|
|
10
|
+
import { resolveCollection } from './collection.ts';
|
|
11
|
+
|
|
12
|
+
polyfillFetch();
|
|
13
|
+
const mockedFetch = mockFetch(jest.fn);
|
|
14
|
+
|
|
15
|
+
describe('resolveCollection >', () => {
|
|
16
|
+
let restClient: Getta & ShortcutProperties<ShortcutMethodNames>;
|
|
17
|
+
const setCacheMetadata = jest.fn();
|
|
18
|
+
const id = 10;
|
|
19
|
+
|
|
20
|
+
beforeAll(() => {
|
|
21
|
+
restClient = createRestClient();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
beforeEach(() => {
|
|
25
|
+
mockedFetch.mockGetOnce(buildEndpoint(COLLECTION_PATH, { id }), {
|
|
26
|
+
body: collectionDetails,
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
afterEach(async () => {
|
|
31
|
+
mockedFetch.mockReset();
|
|
32
|
+
await restClient.cache?.clear();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe('when a collection id >', () => {
|
|
36
|
+
it('should return the collection details', async () => {
|
|
37
|
+
await expect(
|
|
38
|
+
resolveCollection(
|
|
39
|
+
undefined,
|
|
40
|
+
{ id },
|
|
41
|
+
{ restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
|
|
42
|
+
{} as GraphQLResolveInfo
|
|
43
|
+
)
|
|
44
|
+
).resolves.toMatchSnapshot();
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { QueryCollectionArgs } from '@tmdb-graphql-api/schema';
|
|
2
|
+
import { GraphQLError } from 'graphql';
|
|
3
|
+
import type { GraphQLResolveInfo } from 'graphql';
|
|
4
|
+
import { isUndefined, snakeCase } from 'lodash-es';
|
|
5
|
+
import { COLLECTION } from '../constants.ts';
|
|
6
|
+
import type { Context, RawCollection } from '../types.ts';
|
|
7
|
+
|
|
8
|
+
export const resolveCollection = async (
|
|
9
|
+
obj: RawCollection | undefined,
|
|
10
|
+
args: QueryCollectionArgs,
|
|
11
|
+
{ requestID, restClient, setCacheMetadata, tmdbGuestSessionId }: Context,
|
|
12
|
+
{ fieldName, fieldNodes }: GraphQLResolveInfo
|
|
13
|
+
) => {
|
|
14
|
+
const typedFieldName = snakeCase(fieldName) as keyof RawCollection;
|
|
15
|
+
|
|
16
|
+
if (obj && !isUndefined(obj[typedFieldName])) {
|
|
17
|
+
return obj[typedFieldName];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const id = obj ? obj.id : args.id;
|
|
21
|
+
|
|
22
|
+
const { data, errors, headers } = await restClient.collection<RawCollection>(
|
|
23
|
+
{
|
|
24
|
+
pathTemplateData: { id },
|
|
25
|
+
},
|
|
26
|
+
{ requestID, tmdbGuestSessionId }
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
if (errors?.length) {
|
|
30
|
+
throw new GraphQLError(`Failed to resolve ${COLLECTION} ${id}.`, { nodes: fieldNodes, originalError: errors[0] });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (obj) {
|
|
34
|
+
setCacheMetadata(`${COLLECTION}.${fieldName}`, headers);
|
|
35
|
+
return data![typedFieldName];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
setCacheMetadata(COLLECTION, headers);
|
|
39
|
+
return data;
|
|
40
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import { COLLECTION_PATH, type ShortcutMethodNames } from '@tmdb-graphql-api/rest-client';
|
|
3
|
+
import collectionDetails from '@tmdb-graphql-api/test-utils/responses/themoviedb/collection/details.json';
|
|
4
|
+
import collectionImages from '@tmdb-graphql-api/test-utils/responses/themoviedb/collection/images.json';
|
|
5
|
+
import { mockFetch, polyfillFetch } from 'fetch-mocked';
|
|
6
|
+
import type { Getta, ShortcutProperties } from 'getta';
|
|
7
|
+
import { buildEndpoint } from '../__testUtils__/helpers/buildEndpoint.ts';
|
|
8
|
+
import { buildResolveInfoArgument } from '../__testUtils__/helpers/buildResolveInfoArg.ts';
|
|
9
|
+
import { createRestClient } from '../__testUtils__/helpers/createRestClient.ts';
|
|
10
|
+
import type { Context, RawCollection } from '../types.ts';
|
|
11
|
+
import { resolveCollectionImages } from './collectionImages.ts';
|
|
12
|
+
|
|
13
|
+
polyfillFetch();
|
|
14
|
+
const mockedFetch = mockFetch(jest.fn);
|
|
15
|
+
|
|
16
|
+
describe('resolveCollectionImages >', () => {
|
|
17
|
+
let restClient: Getta & ShortcutProperties<ShortcutMethodNames>;
|
|
18
|
+
const setCacheMetadata = jest.fn();
|
|
19
|
+
|
|
20
|
+
beforeAll(() => {
|
|
21
|
+
restClient = createRestClient();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
beforeEach(() => {
|
|
25
|
+
mockedFetch.mockGetOnce(buildEndpoint(COLLECTION_PATH, { id: 10, type: 'images' }), {
|
|
26
|
+
body: collectionImages,
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
afterEach(async () => {
|
|
31
|
+
mockedFetch.mockReset();
|
|
32
|
+
await restClient.cache?.clear();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe('when a query has specified backdrops >', () => {
|
|
36
|
+
it('should return the collection images', async () => {
|
|
37
|
+
const resolveInfo = buildResolveInfoArgument(
|
|
38
|
+
`
|
|
39
|
+
{
|
|
40
|
+
collection(id: "10") {
|
|
41
|
+
backdrops {
|
|
42
|
+
filePath
|
|
43
|
+
}
|
|
44
|
+
id
|
|
45
|
+
name
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
`,
|
|
49
|
+
['collection', 'backdrops']
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
await expect(
|
|
53
|
+
resolveCollectionImages(
|
|
54
|
+
collectionDetails as unknown as RawCollection,
|
|
55
|
+
undefined,
|
|
56
|
+
{ restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
|
|
57
|
+
resolveInfo
|
|
58
|
+
)
|
|
59
|
+
).resolves.toMatchSnapshot();
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
describe('when a query has specified posters >', () => {
|
|
64
|
+
it('should return the collection images', async () => {
|
|
65
|
+
const resolveInfo = buildResolveInfoArgument(
|
|
66
|
+
`
|
|
67
|
+
{
|
|
68
|
+
collection(id: "10") {
|
|
69
|
+
id
|
|
70
|
+
name
|
|
71
|
+
posters {
|
|
72
|
+
filePath
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
`,
|
|
77
|
+
['collection', 'posters']
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
await expect(
|
|
81
|
+
resolveCollectionImages(
|
|
82
|
+
collectionDetails as unknown as RawCollection,
|
|
83
|
+
undefined,
|
|
84
|
+
{ restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
|
|
85
|
+
resolveInfo
|
|
86
|
+
)
|
|
87
|
+
).resolves.toMatchSnapshot();
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { GraphQLResolveInfo } from 'graphql';
|
|
2
|
+
import { GraphQLError } from 'graphql';
|
|
3
|
+
import { COLLECTION, IMAGES } from '../constants.ts';
|
|
4
|
+
import type { Context, RawCollection, RawCollectionImages } from '../types.ts';
|
|
5
|
+
|
|
6
|
+
export const resolveCollectionImages = async (
|
|
7
|
+
{ id }: RawCollection,
|
|
8
|
+
_args: undefined,
|
|
9
|
+
{ requestID, restClient, setCacheMetadata, tmdbGuestSessionId }: Context,
|
|
10
|
+
{ fieldName, fieldNodes }: GraphQLResolveInfo
|
|
11
|
+
) => {
|
|
12
|
+
const typedFieldName = fieldName as 'backdrops' | 'posters';
|
|
13
|
+
|
|
14
|
+
const { data, errors, headers } = await restClient.collection<RawCollectionImages>(
|
|
15
|
+
{
|
|
16
|
+
pathTemplateData: { id, type: IMAGES },
|
|
17
|
+
},
|
|
18
|
+
{ requestID, tmdbGuestSessionId }
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
if (errors?.length) {
|
|
22
|
+
throw new GraphQLError(`Failed to resolve ${COLLECTION} ${id} ${fieldName}.`, {
|
|
23
|
+
nodes: fieldNodes,
|
|
24
|
+
originalError: errors[0],
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
setCacheMetadata(`${COLLECTION}.${typedFieldName}`, headers);
|
|
29
|
+
return data![typedFieldName];
|
|
30
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import { COLLECTION_PATH, type ShortcutMethodNames } from '@tmdb-graphql-api/rest-client';
|
|
3
|
+
import collectionDetails from '@tmdb-graphql-api/test-utils/responses/themoviedb/collection/details.json';
|
|
4
|
+
import collectionTranslations from '@tmdb-graphql-api/test-utils/responses/themoviedb/collection/translations.json';
|
|
5
|
+
import { mockFetch, polyfillFetch } from 'fetch-mocked';
|
|
6
|
+
import type { Getta, ShortcutProperties } from 'getta';
|
|
7
|
+
import type { GraphQLResolveInfo } from 'graphql';
|
|
8
|
+
import { buildEndpoint } from '../__testUtils__/helpers/buildEndpoint.ts';
|
|
9
|
+
import { createRestClient } from '../__testUtils__/helpers/createRestClient.ts';
|
|
10
|
+
import type { Context, RawCollection } from '../types.ts';
|
|
11
|
+
import { resolveCollectionTranslations } from './collectionTranslations.ts';
|
|
12
|
+
|
|
13
|
+
polyfillFetch();
|
|
14
|
+
const mockedFetch = mockFetch(jest.fn);
|
|
15
|
+
|
|
16
|
+
describe('resolveCollectionTranslations >', () => {
|
|
17
|
+
let restClient: Getta & ShortcutProperties<ShortcutMethodNames>;
|
|
18
|
+
const setCacheMetadata = jest.fn();
|
|
19
|
+
|
|
20
|
+
beforeAll(() => {
|
|
21
|
+
restClient = createRestClient();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
beforeEach(() => {
|
|
25
|
+
mockedFetch.mockGetOnce(buildEndpoint(COLLECTION_PATH, { id: 10, type: 'translations' }), {
|
|
26
|
+
body: collectionTranslations,
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
afterEach(async () => {
|
|
31
|
+
mockedFetch.mockReset();
|
|
32
|
+
await restClient.cache?.clear();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('should return the collection translations', async () => {
|
|
36
|
+
await expect(
|
|
37
|
+
resolveCollectionTranslations(
|
|
38
|
+
collectionDetails as unknown as RawCollection,
|
|
39
|
+
undefined,
|
|
40
|
+
{ restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
|
|
41
|
+
{} as GraphQLResolveInfo
|
|
42
|
+
)
|
|
43
|
+
).resolves.toMatchSnapshot();
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { GraphQLError } from 'graphql';
|
|
2
|
+
import type { GraphQLResolveInfo } from 'graphql';
|
|
3
|
+
import { COLLECTION, TRANSLATIONS } from '../constants.ts';
|
|
4
|
+
import type { Context, RawCollection, RawCollectionTranslations } from '../types.ts';
|
|
5
|
+
|
|
6
|
+
export const resolveCollectionTranslations = async (
|
|
7
|
+
{ id }: RawCollection,
|
|
8
|
+
_args: undefined,
|
|
9
|
+
{ requestID, restClient, setCacheMetadata, tmdbGuestSessionId }: Context,
|
|
10
|
+
{ fieldNodes }: GraphQLResolveInfo
|
|
11
|
+
) => {
|
|
12
|
+
const { data, errors, headers } = await restClient.collection<RawCollectionTranslations>(
|
|
13
|
+
{
|
|
14
|
+
pathTemplateData: { id, type: 'translations' },
|
|
15
|
+
},
|
|
16
|
+
{ requestID, tmdbGuestSessionId }
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
if (errors?.length) {
|
|
20
|
+
throw new GraphQLError(`Failed to resolve ${COLLECTION} ${id} ${TRANSLATIONS}.`, {
|
|
21
|
+
nodes: fieldNodes,
|
|
22
|
+
originalError: errors[0],
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
setCacheMetadata(`${COLLECTION}.${TRANSLATIONS}`, headers);
|
|
27
|
+
return data?.translations;
|
|
28
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import { COMPANY_PATH, type ShortcutMethodNames } from '@tmdb-graphql-api/rest-client';
|
|
3
|
+
import companyDetails from '@tmdb-graphql-api/test-utils/responses/themoviedb/company/details.json';
|
|
4
|
+
import { mockFetch, polyfillFetch } from 'fetch-mocked';
|
|
5
|
+
import type { Getta, ShortcutProperties } from 'getta';
|
|
6
|
+
import type { GraphQLResolveInfo } from 'graphql';
|
|
7
|
+
import { buildEndpoint } from '../__testUtils__/helpers/buildEndpoint.ts';
|
|
8
|
+
import { createRestClient } from '../__testUtils__/helpers/createRestClient.ts';
|
|
9
|
+
import type { Context } from '../types.ts';
|
|
10
|
+
import { resolveCompany } from './company.ts';
|
|
11
|
+
|
|
12
|
+
polyfillFetch();
|
|
13
|
+
const mockedFetch = mockFetch(jest.fn);
|
|
14
|
+
|
|
15
|
+
describe('resolveCompany >', () => {
|
|
16
|
+
let restClient: Getta & ShortcutProperties<ShortcutMethodNames>;
|
|
17
|
+
const setCacheMetadata = jest.fn();
|
|
18
|
+
const id = 2;
|
|
19
|
+
|
|
20
|
+
beforeAll(() => {
|
|
21
|
+
restClient = createRestClient();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
beforeEach(() => {
|
|
25
|
+
mockedFetch.mockGetOnce(buildEndpoint(COMPANY_PATH, { id }), {
|
|
26
|
+
body: companyDetails,
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
afterEach(async () => {
|
|
31
|
+
mockedFetch.mockReset();
|
|
32
|
+
await restClient.cache?.clear();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('should return the correct company details', async () => {
|
|
36
|
+
await expect(
|
|
37
|
+
resolveCompany(
|
|
38
|
+
undefined,
|
|
39
|
+
{ id },
|
|
40
|
+
{ restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
|
|
41
|
+
{} as GraphQLResolveInfo
|
|
42
|
+
)
|
|
43
|
+
).resolves.toMatchSnapshot();
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { QueryCompanyArgs } from '@tmdb-graphql-api/schema';
|
|
2
|
+
import { GraphQLError } from 'graphql';
|
|
3
|
+
import type { GraphQLResolveInfo } from 'graphql';
|
|
4
|
+
import { isUndefined, snakeCase } from 'lodash-es';
|
|
5
|
+
import { COMPANY } from '../constants.ts';
|
|
6
|
+
import type { Context, RawCompany } from '../types.ts';
|
|
7
|
+
|
|
8
|
+
export const resolveCompany = async (
|
|
9
|
+
obj: RawCompany | undefined,
|
|
10
|
+
args: QueryCompanyArgs,
|
|
11
|
+
{ requestID, restClient, setCacheMetadata, tmdbGuestSessionId }: Context,
|
|
12
|
+
{ fieldName, fieldNodes }: GraphQLResolveInfo
|
|
13
|
+
) => {
|
|
14
|
+
const typedFieldName = snakeCase(fieldName) as keyof RawCompany;
|
|
15
|
+
|
|
16
|
+
if (obj && !isUndefined(obj[typedFieldName])) {
|
|
17
|
+
return obj[typedFieldName];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const id = obj ? obj.id : args.id;
|
|
21
|
+
|
|
22
|
+
const { data, errors, headers } = await restClient.company<RawCompany>(
|
|
23
|
+
{
|
|
24
|
+
pathTemplateData: { id },
|
|
25
|
+
},
|
|
26
|
+
{ requestID, tmdbGuestSessionId }
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
if (errors?.length) {
|
|
30
|
+
throw new GraphQLError(`Failed to resolve ${COMPANY} ${id}.`, { nodes: fieldNodes, originalError: errors[0] });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (obj) {
|
|
34
|
+
setCacheMetadata(`${COMPANY}.${fieldName}`, headers);
|
|
35
|
+
return data![typedFieldName];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
setCacheMetadata(COMPANY, headers);
|
|
39
|
+
return data;
|
|
40
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import { COMPANY_PATH, type ShortcutMethodNames } from '@tmdb-graphql-api/rest-client';
|
|
3
|
+
import companyAlterativeNames from '@tmdb-graphql-api/test-utils/responses/themoviedb/company/alternativeNames.json';
|
|
4
|
+
import companyDetails from '@tmdb-graphql-api/test-utils/responses/themoviedb/company/details.json';
|
|
5
|
+
import { mockFetch, polyfillFetch } from 'fetch-mocked';
|
|
6
|
+
import type { Getta, ShortcutProperties } from 'getta';
|
|
7
|
+
import type { GraphQLResolveInfo } from 'graphql';
|
|
8
|
+
import { buildEndpoint } from '../__testUtils__/helpers/buildEndpoint.ts';
|
|
9
|
+
import { createRestClient } from '../__testUtils__/helpers/createRestClient.ts';
|
|
10
|
+
import type { Context, RawCompany } from '../types.ts';
|
|
11
|
+
import { resolveCompanyAlternativeNames } from './companyAlternativeNames.ts';
|
|
12
|
+
|
|
13
|
+
polyfillFetch();
|
|
14
|
+
const mockedFetch = mockFetch(jest.fn);
|
|
15
|
+
|
|
16
|
+
describe('resolveCompanyAlternativeNames >', () => {
|
|
17
|
+
let restClient: Getta & ShortcutProperties<ShortcutMethodNames>;
|
|
18
|
+
const setCacheMetadata = jest.fn();
|
|
19
|
+
|
|
20
|
+
beforeAll(() => {
|
|
21
|
+
restClient = createRestClient();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
beforeEach(() => {
|
|
25
|
+
mockedFetch.mockGetOnce(buildEndpoint(COMPANY_PATH, { id: 2, type: 'alternative_names' }), {
|
|
26
|
+
body: companyAlterativeNames,
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
afterEach(async () => {
|
|
31
|
+
mockedFetch.mockReset();
|
|
32
|
+
await restClient.cache?.clear();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('should return the company alternative names', async () => {
|
|
36
|
+
await expect(
|
|
37
|
+
resolveCompanyAlternativeNames(
|
|
38
|
+
companyDetails as unknown as RawCompany,
|
|
39
|
+
undefined,
|
|
40
|
+
{ restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
|
|
41
|
+
{} as GraphQLResolveInfo
|
|
42
|
+
)
|
|
43
|
+
).resolves.toMatchSnapshot();
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { GraphQLError } from 'graphql';
|
|
2
|
+
import type { GraphQLResolveInfo } from 'graphql';
|
|
3
|
+
import { snakeCase } from 'lodash-es';
|
|
4
|
+
import { ALTERNATIVE_NAMES, COMPANY } from '../constants.ts';
|
|
5
|
+
import type { Context, RawCompany, RawCompanyAlternativeNames } from '../types.ts';
|
|
6
|
+
|
|
7
|
+
export const resolveCompanyAlternativeNames = async (
|
|
8
|
+
{ id }: RawCompany,
|
|
9
|
+
_args: undefined,
|
|
10
|
+
{ requestID, restClient, setCacheMetadata, tmdbGuestSessionId }: Context,
|
|
11
|
+
{ fieldNodes }: GraphQLResolveInfo
|
|
12
|
+
) => {
|
|
13
|
+
const { data, errors, headers } = await restClient.company<RawCompanyAlternativeNames>(
|
|
14
|
+
{
|
|
15
|
+
pathTemplateData: { id, type: snakeCase(ALTERNATIVE_NAMES) },
|
|
16
|
+
},
|
|
17
|
+
{ requestID, tmdbGuestSessionId }
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
if (errors?.length) {
|
|
21
|
+
throw new GraphQLError(`Failed to resolve ${COMPANY} ${id} ${ALTERNATIVE_NAMES}.`, {
|
|
22
|
+
nodes: fieldNodes,
|
|
23
|
+
originalError: errors[0],
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
setCacheMetadata(`${COMPANY}.${ALTERNATIVE_NAMES}`, headers);
|
|
28
|
+
return data!.results;
|
|
29
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import { COMPANY_PATH, type ShortcutMethodNames } from '@tmdb-graphql-api/rest-client';
|
|
3
|
+
import companyDetails from '@tmdb-graphql-api/test-utils/responses/themoviedb/company/details.json';
|
|
4
|
+
import companyLogos from '@tmdb-graphql-api/test-utils/responses/themoviedb/company/images.json';
|
|
5
|
+
import { mockFetch, polyfillFetch } from 'fetch-mocked';
|
|
6
|
+
import type { Getta, ShortcutProperties } from 'getta';
|
|
7
|
+
import type { GraphQLResolveInfo } from 'graphql';
|
|
8
|
+
import { buildEndpoint } from '../__testUtils__/helpers/buildEndpoint.ts';
|
|
9
|
+
import { createRestClient } from '../__testUtils__/helpers/createRestClient.ts';
|
|
10
|
+
import type { Context, RawCompany } from '../types.ts';
|
|
11
|
+
import { resolveCompanyLogos } from './companyLogos.ts';
|
|
12
|
+
|
|
13
|
+
polyfillFetch();
|
|
14
|
+
const mockedFetch = mockFetch(jest.fn);
|
|
15
|
+
|
|
16
|
+
describe('resolveCompanyImages >', () => {
|
|
17
|
+
let restClient: Getta & ShortcutProperties<ShortcutMethodNames>;
|
|
18
|
+
const setCacheMetadata = jest.fn();
|
|
19
|
+
|
|
20
|
+
beforeAll(() => {
|
|
21
|
+
restClient = createRestClient();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
beforeEach(() => {
|
|
25
|
+
mockedFetch.mockGetOnce(buildEndpoint(COMPANY_PATH, { id: 2, type: 'images' }), {
|
|
26
|
+
body: companyLogos,
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
afterEach(async () => {
|
|
31
|
+
mockedFetch.mockReset();
|
|
32
|
+
await restClient.cache?.clear();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('should return the company logos', async () => {
|
|
36
|
+
await expect(
|
|
37
|
+
resolveCompanyLogos(
|
|
38
|
+
companyDetails as unknown as RawCompany,
|
|
39
|
+
undefined,
|
|
40
|
+
{ restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
|
|
41
|
+
{} as GraphQLResolveInfo
|
|
42
|
+
)
|
|
43
|
+
).resolves.toMatchSnapshot();
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { GraphQLResolveInfo } from 'graphql';
|
|
2
|
+
import { GraphQLError } from 'graphql';
|
|
3
|
+
import { COMPANY, IMAGES, LOGOS } from '../constants.ts';
|
|
4
|
+
import type { Context, RawCompany, RawCompanyLogos } from '../types.ts';
|
|
5
|
+
|
|
6
|
+
export const resolveCompanyLogos = async (
|
|
7
|
+
{ id }: RawCompany,
|
|
8
|
+
_args: undefined,
|
|
9
|
+
{ requestID, restClient, setCacheMetadata, tmdbGuestSessionId }: Context,
|
|
10
|
+
{ fieldNodes }: GraphQLResolveInfo
|
|
11
|
+
) => {
|
|
12
|
+
const { data, errors, headers } = await restClient.company<RawCompanyLogos>(
|
|
13
|
+
{
|
|
14
|
+
pathTemplateData: { id, type: IMAGES },
|
|
15
|
+
},
|
|
16
|
+
{ requestID, tmdbGuestSessionId }
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
if (errors?.length) {
|
|
20
|
+
throw new GraphQLError(`Failed to resolve ${COMPANY} ${id} ${LOGOS}.`, {
|
|
21
|
+
nodes: fieldNodes,
|
|
22
|
+
originalError: errors[0],
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
setCacheMetadata(`${COMPANY}.${LOGOS}`, headers);
|
|
27
|
+
return data!.logos;
|
|
28
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import { CONFIGURATION_PATH, type ShortcutMethodNames } from '@tmdb-graphql-api/rest-client';
|
|
3
|
+
import configurationBase from '@tmdb-graphql-api/test-utils/responses/themoviedb/configuration/base.json';
|
|
4
|
+
import { mockFetch, polyfillFetch } from 'fetch-mocked';
|
|
5
|
+
import type { Getta, ShortcutProperties } from 'getta';
|
|
6
|
+
import type { GraphQLResolveInfo } from 'graphql';
|
|
7
|
+
import { buildEndpoint } from '../__testUtils__/helpers/buildEndpoint.ts';
|
|
8
|
+
import { createRestClient } from '../__testUtils__/helpers/createRestClient.ts';
|
|
9
|
+
import type { Context } from '../types.ts';
|
|
10
|
+
import { resolveConfiguration } from './configuration.ts';
|
|
11
|
+
|
|
12
|
+
polyfillFetch();
|
|
13
|
+
const mockedFetch = mockFetch(jest.fn);
|
|
14
|
+
|
|
15
|
+
describe('resolveConfiguration >', () => {
|
|
16
|
+
let restClient: Getta & ShortcutProperties<ShortcutMethodNames>;
|
|
17
|
+
const setCacheMetadata = jest.fn();
|
|
18
|
+
|
|
19
|
+
beforeAll(() => {
|
|
20
|
+
restClient = createRestClient();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
beforeEach(() => {
|
|
24
|
+
mockedFetch.mockGetOnce(buildEndpoint(CONFIGURATION_PATH), {
|
|
25
|
+
body: configurationBase,
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
afterEach(async () => {
|
|
30
|
+
mockedFetch.mockReset();
|
|
31
|
+
await restClient.cache?.clear();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('should return the correct configuration base', async () => {
|
|
35
|
+
await expect(
|
|
36
|
+
resolveConfiguration(
|
|
37
|
+
undefined,
|
|
38
|
+
undefined,
|
|
39
|
+
{ restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
|
|
40
|
+
{} as GraphQLResolveInfo
|
|
41
|
+
)
|
|
42
|
+
).resolves.toMatchSnapshot();
|
|
43
|
+
});
|
|
44
|
+
});
|