@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.
Files changed (604) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/dist/cjs/index.cjs +3435 -0
  4. package/dist/cjs/index.cjs.map +1 -0
  5. package/dist/esm/index.mjs +3432 -0
  6. package/dist/esm/index.mjs.map +1 -0
  7. package/dist/types/cjs/constants.d.cts +54 -0
  8. package/dist/types/cjs/constants.d.cts.map +1 -0
  9. package/dist/types/cjs/helpers/decodeId.d.cts +3 -0
  10. package/dist/types/cjs/helpers/decodeId.d.cts.map +1 -0
  11. package/dist/types/cjs/helpers/defaultFieldResolver.d.cts +4 -0
  12. package/dist/types/cjs/helpers/defaultFieldResolver.d.cts.map +1 -0
  13. package/dist/types/cjs/helpers/encodeId.d.cts +3 -0
  14. package/dist/types/cjs/helpers/encodeId.d.cts.map +1 -0
  15. package/dist/types/cjs/helpers/formatDirectionalSuffixes.d.cts +3 -0
  16. package/dist/types/cjs/helpers/formatDirectionalSuffixes.d.cts.map +1 -0
  17. package/dist/types/cjs/helpers/formatQueryParams.d.cts +6 -0
  18. package/dist/types/cjs/helpers/formatQueryParams.d.cts.map +1 -0
  19. package/dist/types/cjs/helpers/getAppendToResponseKeys.d.cts +4 -0
  20. package/dist/types/cjs/helpers/getAppendToResponseKeys.d.cts.map +1 -0
  21. package/dist/types/cjs/helpers/getTvIdSeasonAndEpisode.d.cts +8 -0
  22. package/dist/types/cjs/helpers/getTvIdSeasonAndEpisode.d.cts.map +1 -0
  23. package/dist/types/cjs/helpers/makeFallbackFieldResolvers.d.cts +3 -0
  24. package/dist/types/cjs/helpers/makeFallbackFieldResolvers.d.cts.map +1 -0
  25. package/dist/types/cjs/helpers/removeNullValues.d.cts +3 -0
  26. package/dist/types/cjs/helpers/removeNullValues.d.cts.map +1 -0
  27. package/dist/types/cjs/helpers/snakeCasePropNames.d.cts +4 -0
  28. package/dist/types/cjs/helpers/snakeCasePropNames.d.cts.map +1 -0
  29. package/dist/types/cjs/helpers/typePropNames.d.cts +2 -0
  30. package/dist/types/cjs/helpers/typePropNames.d.cts.map +1 -0
  31. package/dist/types/cjs/index.d.cts +3 -0
  32. package/dist/types/cjs/index.d.cts.map +1 -0
  33. package/dist/types/cjs/main.d.cts +3 -0
  34. package/dist/types/cjs/main.d.cts.map +1 -0
  35. package/dist/types/cjs/queries/certifications.d.cts +5 -0
  36. package/dist/types/cjs/queries/certifications.d.cts.map +1 -0
  37. package/dist/types/cjs/queries/collection.d.cts +3401 -0
  38. package/dist/types/cjs/queries/collection.d.cts.map +1 -0
  39. package/dist/types/cjs/queries/collectionImages.d.cts +14 -0
  40. package/dist/types/cjs/queries/collectionImages.d.cts.map +1 -0
  41. package/dist/types/cjs/queries/collectionTranslations.d.cts +18 -0
  42. package/dist/types/cjs/queries/collectionTranslations.d.cts.map +1 -0
  43. package/dist/types/cjs/queries/company.d.cts +15 -0
  44. package/dist/types/cjs/queries/company.d.cts.map +1 -0
  45. package/dist/types/cjs/queries/companyAlternativeNames.d.cts +10 -0
  46. package/dist/types/cjs/queries/companyAlternativeNames.d.cts.map +1 -0
  47. package/dist/types/cjs/queries/companyLogos.d.cts +14 -0
  48. package/dist/types/cjs/queries/companyLogos.d.cts.map +1 -0
  49. package/dist/types/cjs/queries/configuration.d.cts +16 -0
  50. package/dist/types/cjs/queries/configuration.d.cts.map +1 -0
  51. package/dist/types/cjs/queries/configurationCountries.d.cts +4 -0
  52. package/dist/types/cjs/queries/configurationCountries.d.cts.map +1 -0
  53. package/dist/types/cjs/queries/configurationJobs.d.cts +4 -0
  54. package/dist/types/cjs/queries/configurationJobs.d.cts.map +1 -0
  55. package/dist/types/cjs/queries/configurationLanguages.d.cts +4 -0
  56. package/dist/types/cjs/queries/configurationLanguages.d.cts.map +1 -0
  57. package/dist/types/cjs/queries/configurationPrimaryTranslations.d.cts +4 -0
  58. package/dist/types/cjs/queries/configurationPrimaryTranslations.d.cts.map +1 -0
  59. package/dist/types/cjs/queries/configurationTimezones.d.cts +4 -0
  60. package/dist/types/cjs/queries/configurationTimezones.d.cts.map +1 -0
  61. package/dist/types/cjs/queries/credit.d.cts +4196 -0
  62. package/dist/types/cjs/queries/credit.d.cts.map +1 -0
  63. package/dist/types/cjs/queries/discoverMovies.d.cts +15 -0
  64. package/dist/types/cjs/queries/discoverMovies.d.cts.map +1 -0
  65. package/dist/types/cjs/queries/discoverTv.d.cts +15 -0
  66. package/dist/types/cjs/queries/discoverTv.d.cts.map +1 -0
  67. package/dist/types/cjs/queries/episode.d.cts +98 -0
  68. package/dist/types/cjs/queries/episode.d.cts.map +1 -0
  69. package/dist/types/cjs/queries/episodeCredits.d.cts +33 -0
  70. package/dist/types/cjs/queries/episodeCredits.d.cts.map +1 -0
  71. package/dist/types/cjs/queries/episodeExternalIds.d.cts +16 -0
  72. package/dist/types/cjs/queries/episodeExternalIds.d.cts.map +1 -0
  73. package/dist/types/cjs/queries/episodeStills.d.cts +6 -0
  74. package/dist/types/cjs/queries/episodeStills.d.cts.map +1 -0
  75. package/dist/types/cjs/queries/episodeTranslations.d.cts +20 -0
  76. package/dist/types/cjs/queries/episodeTranslations.d.cts.map +1 -0
  77. package/dist/types/cjs/queries/episodeVideos.d.cts +16 -0
  78. package/dist/types/cjs/queries/episodeVideos.d.cts.map +1 -0
  79. package/dist/types/cjs/queries/find.d.cts +1803 -0
  80. package/dist/types/cjs/queries/find.d.cts.map +1 -0
  81. package/dist/types/cjs/queries/genres.d.cts +9 -0
  82. package/dist/types/cjs/queries/genres.d.cts.map +1 -0
  83. package/dist/types/cjs/queries/keyword.d.cts +9 -0
  84. package/dist/types/cjs/queries/keyword.d.cts.map +1 -0
  85. package/dist/types/cjs/queries/movie.d.cts +3597 -0
  86. package/dist/types/cjs/queries/movie.d.cts.map +1 -0
  87. package/dist/types/cjs/queries/movieAlternativeTitles.d.cts +7 -0
  88. package/dist/types/cjs/queries/movieAlternativeTitles.d.cts.map +1 -0
  89. package/dist/types/cjs/queries/movieCredits.d.cts +33 -0
  90. package/dist/types/cjs/queries/movieCredits.d.cts.map +1 -0
  91. package/dist/types/cjs/queries/movieExternalIds.d.cts +16 -0
  92. package/dist/types/cjs/queries/movieExternalIds.d.cts.map +1 -0
  93. package/dist/types/cjs/queries/movieImages.d.cts +6 -0
  94. package/dist/types/cjs/queries/movieImages.d.cts.map +1 -0
  95. package/dist/types/cjs/queries/movieKeywords.d.cts +6 -0
  96. package/dist/types/cjs/queries/movieKeywords.d.cts.map +1 -0
  97. package/dist/types/cjs/queries/movieRecommendations.d.cts +1866 -0
  98. package/dist/types/cjs/queries/movieRecommendations.d.cts.map +1 -0
  99. package/dist/types/cjs/queries/movieReleaseDates.d.cts +13 -0
  100. package/dist/types/cjs/queries/movieReleaseDates.d.cts.map +1 -0
  101. package/dist/types/cjs/queries/movieReviews.d.cts +1866 -0
  102. package/dist/types/cjs/queries/movieReviews.d.cts.map +1 -0
  103. package/dist/types/cjs/queries/movieSimilarMovies.d.cts +1866 -0
  104. package/dist/types/cjs/queries/movieSimilarMovies.d.cts.map +1 -0
  105. package/dist/types/cjs/queries/movieTranslations.d.cts +20 -0
  106. package/dist/types/cjs/queries/movieTranslations.d.cts.map +1 -0
  107. package/dist/types/cjs/queries/movieVideos.d.cts +16 -0
  108. package/dist/types/cjs/queries/movieVideos.d.cts.map +1 -0
  109. package/dist/types/cjs/queries/movieWatchProviders.d.cts +1375 -0
  110. package/dist/types/cjs/queries/movieWatchProviders.d.cts.map +1 -0
  111. package/dist/types/cjs/queries/network.d.cts +26 -0
  112. package/dist/types/cjs/queries/network.d.cts.map +1 -0
  113. package/dist/types/cjs/queries/networkAlternativeNames.d.cts +10 -0
  114. package/dist/types/cjs/queries/networkAlternativeNames.d.cts.map +1 -0
  115. package/dist/types/cjs/queries/networkLogos.d.cts +14 -0
  116. package/dist/types/cjs/queries/networkLogos.d.cts.map +1 -0
  117. package/dist/types/cjs/queries/person.d.cts +46 -0
  118. package/dist/types/cjs/queries/person.d.cts.map +1 -0
  119. package/dist/types/cjs/queries/personCombinedCredits.d.cts +6 -0
  120. package/dist/types/cjs/queries/personCombinedCredits.d.cts.map +1 -0
  121. package/dist/types/cjs/queries/personExternalIds.d.cts +6 -0
  122. package/dist/types/cjs/queries/personExternalIds.d.cts.map +1 -0
  123. package/dist/types/cjs/queries/personMovieCredits.d.cts +6 -0
  124. package/dist/types/cjs/queries/personMovieCredits.d.cts.map +1 -0
  125. package/dist/types/cjs/queries/personProfiles.d.cts +6 -0
  126. package/dist/types/cjs/queries/personProfiles.d.cts.map +1 -0
  127. package/dist/types/cjs/queries/personTranslations.d.cts +20 -0
  128. package/dist/types/cjs/queries/personTranslations.d.cts.map +1 -0
  129. package/dist/types/cjs/queries/personTvCredits.d.cts +6 -0
  130. package/dist/types/cjs/queries/personTvCredits.d.cts.map +1 -0
  131. package/dist/types/cjs/queries/rated.d.cts +17 -0
  132. package/dist/types/cjs/queries/rated.d.cts.map +1 -0
  133. package/dist/types/cjs/queries/review.d.cts +28 -0
  134. package/dist/types/cjs/queries/review.d.cts.map +1 -0
  135. package/dist/types/cjs/queries/search.d.cts +17 -0
  136. package/dist/types/cjs/queries/search.d.cts.map +1 -0
  137. package/dist/types/cjs/queries/season.d.cts +282 -0
  138. package/dist/types/cjs/queries/season.d.cts.map +1 -0
  139. package/dist/types/cjs/queries/seasonCredits.d.cts +33 -0
  140. package/dist/types/cjs/queries/seasonCredits.d.cts.map +1 -0
  141. package/dist/types/cjs/queries/seasonEpisodeCount.d.cts +3 -0
  142. package/dist/types/cjs/queries/seasonEpisodeCount.d.cts.map +1 -0
  143. package/dist/types/cjs/queries/seasonExternalIds.d.cts +6 -0
  144. package/dist/types/cjs/queries/seasonExternalIds.d.cts.map +1 -0
  145. package/dist/types/cjs/queries/seasonPosters.d.cts +6 -0
  146. package/dist/types/cjs/queries/seasonPosters.d.cts.map +1 -0
  147. package/dist/types/cjs/queries/seasonTranslations.d.cts +20 -0
  148. package/dist/types/cjs/queries/seasonTranslations.d.cts.map +1 -0
  149. package/dist/types/cjs/queries/seasonVideos.d.cts +16 -0
  150. package/dist/types/cjs/queries/seasonVideos.d.cts.map +1 -0
  151. package/dist/types/cjs/queries/trending.d.cts +17 -0
  152. package/dist/types/cjs/queries/trending.d.cts.map +1 -0
  153. package/dist/types/cjs/queries/tv.d.cts +10460 -0
  154. package/dist/types/cjs/queries/tv.d.cts.map +1 -0
  155. package/dist/types/cjs/queries/tvAlternativeTitles.d.cts +12 -0
  156. package/dist/types/cjs/queries/tvAlternativeTitles.d.cts.map +1 -0
  157. package/dist/types/cjs/queries/tvContentRatings.d.cts +10 -0
  158. package/dist/types/cjs/queries/tvContentRatings.d.cts.map +1 -0
  159. package/dist/types/cjs/queries/tvCredits.d.cts +33 -0
  160. package/dist/types/cjs/queries/tvCredits.d.cts.map +1 -0
  161. package/dist/types/cjs/queries/tvEpisodeGroups.d.cts +41 -0
  162. package/dist/types/cjs/queries/tvEpisodeGroups.d.cts.map +1 -0
  163. package/dist/types/cjs/queries/tvExternalIds.d.cts +16 -0
  164. package/dist/types/cjs/queries/tvExternalIds.d.cts.map +1 -0
  165. package/dist/types/cjs/queries/tvImages.d.cts +16 -0
  166. package/dist/types/cjs/queries/tvImages.d.cts.map +1 -0
  167. package/dist/types/cjs/queries/tvKeywords.d.cts +10 -0
  168. package/dist/types/cjs/queries/tvKeywords.d.cts.map +1 -0
  169. package/dist/types/cjs/queries/tvRecommendations.d.cts +5373 -0
  170. package/dist/types/cjs/queries/tvRecommendations.d.cts.map +1 -0
  171. package/dist/types/cjs/queries/tvReviews.d.cts +5373 -0
  172. package/dist/types/cjs/queries/tvReviews.d.cts.map +1 -0
  173. package/dist/types/cjs/queries/tvSimilarTvShows.d.cts +5373 -0
  174. package/dist/types/cjs/queries/tvSimilarTvShows.d.cts.map +1 -0
  175. package/dist/types/cjs/queries/tvTranslations.d.cts +20 -0
  176. package/dist/types/cjs/queries/tvTranslations.d.cts.map +1 -0
  177. package/dist/types/cjs/queries/tvVideos.d.cts +16 -0
  178. package/dist/types/cjs/queries/tvVideos.d.cts.map +1 -0
  179. package/dist/types/cjs/queries/tvWatchProviders.d.cts +1375 -0
  180. package/dist/types/cjs/queries/tvWatchProviders.d.cts.map +1 -0
  181. package/dist/types/cjs/queries/videoType.d.cts +3 -0
  182. package/dist/types/cjs/queries/videoType.d.cts.map +1 -0
  183. package/dist/types/cjs/types.d.cts +326 -0
  184. package/dist/types/cjs/types.d.cts.map +1 -0
  185. package/dist/types/esm/constants.d.ts +54 -0
  186. package/dist/types/esm/constants.d.ts.map +1 -0
  187. package/dist/types/esm/helpers/decodeId.d.ts +3 -0
  188. package/dist/types/esm/helpers/decodeId.d.ts.map +1 -0
  189. package/dist/types/esm/helpers/defaultFieldResolver.d.ts +4 -0
  190. package/dist/types/esm/helpers/defaultFieldResolver.d.ts.map +1 -0
  191. package/dist/types/esm/helpers/encodeId.d.ts +3 -0
  192. package/dist/types/esm/helpers/encodeId.d.ts.map +1 -0
  193. package/dist/types/esm/helpers/formatDirectionalSuffixes.d.ts +3 -0
  194. package/dist/types/esm/helpers/formatDirectionalSuffixes.d.ts.map +1 -0
  195. package/dist/types/esm/helpers/formatQueryParams.d.ts +6 -0
  196. package/dist/types/esm/helpers/formatQueryParams.d.ts.map +1 -0
  197. package/dist/types/esm/helpers/getAppendToResponseKeys.d.ts +4 -0
  198. package/dist/types/esm/helpers/getAppendToResponseKeys.d.ts.map +1 -0
  199. package/dist/types/esm/helpers/getTvIdSeasonAndEpisode.d.ts +8 -0
  200. package/dist/types/esm/helpers/getTvIdSeasonAndEpisode.d.ts.map +1 -0
  201. package/dist/types/esm/helpers/makeFallbackFieldResolvers.d.ts +3 -0
  202. package/dist/types/esm/helpers/makeFallbackFieldResolvers.d.ts.map +1 -0
  203. package/dist/types/esm/helpers/removeNullValues.d.ts +3 -0
  204. package/dist/types/esm/helpers/removeNullValues.d.ts.map +1 -0
  205. package/dist/types/esm/helpers/snakeCasePropNames.d.ts +4 -0
  206. package/dist/types/esm/helpers/snakeCasePropNames.d.ts.map +1 -0
  207. package/dist/types/esm/helpers/typePropNames.d.ts +2 -0
  208. package/dist/types/esm/helpers/typePropNames.d.ts.map +1 -0
  209. package/dist/types/esm/index.d.ts +3 -0
  210. package/dist/types/esm/index.d.ts.map +1 -0
  211. package/dist/types/esm/main.d.ts +3 -0
  212. package/dist/types/esm/main.d.ts.map +1 -0
  213. package/dist/types/esm/queries/certifications.d.ts +5 -0
  214. package/dist/types/esm/queries/certifications.d.ts.map +1 -0
  215. package/dist/types/esm/queries/collection.d.ts +3401 -0
  216. package/dist/types/esm/queries/collection.d.ts.map +1 -0
  217. package/dist/types/esm/queries/collectionImages.d.ts +14 -0
  218. package/dist/types/esm/queries/collectionImages.d.ts.map +1 -0
  219. package/dist/types/esm/queries/collectionTranslations.d.ts +18 -0
  220. package/dist/types/esm/queries/collectionTranslations.d.ts.map +1 -0
  221. package/dist/types/esm/queries/company.d.ts +15 -0
  222. package/dist/types/esm/queries/company.d.ts.map +1 -0
  223. package/dist/types/esm/queries/companyAlternativeNames.d.ts +10 -0
  224. package/dist/types/esm/queries/companyAlternativeNames.d.ts.map +1 -0
  225. package/dist/types/esm/queries/companyLogos.d.ts +14 -0
  226. package/dist/types/esm/queries/companyLogos.d.ts.map +1 -0
  227. package/dist/types/esm/queries/configuration.d.ts +16 -0
  228. package/dist/types/esm/queries/configuration.d.ts.map +1 -0
  229. package/dist/types/esm/queries/configurationCountries.d.ts +4 -0
  230. package/dist/types/esm/queries/configurationCountries.d.ts.map +1 -0
  231. package/dist/types/esm/queries/configurationJobs.d.ts +4 -0
  232. package/dist/types/esm/queries/configurationJobs.d.ts.map +1 -0
  233. package/dist/types/esm/queries/configurationLanguages.d.ts +4 -0
  234. package/dist/types/esm/queries/configurationLanguages.d.ts.map +1 -0
  235. package/dist/types/esm/queries/configurationPrimaryTranslations.d.ts +4 -0
  236. package/dist/types/esm/queries/configurationPrimaryTranslations.d.ts.map +1 -0
  237. package/dist/types/esm/queries/configurationTimezones.d.ts +4 -0
  238. package/dist/types/esm/queries/configurationTimezones.d.ts.map +1 -0
  239. package/dist/types/esm/queries/credit.d.ts +4196 -0
  240. package/dist/types/esm/queries/credit.d.ts.map +1 -0
  241. package/dist/types/esm/queries/discoverMovies.d.ts +15 -0
  242. package/dist/types/esm/queries/discoverMovies.d.ts.map +1 -0
  243. package/dist/types/esm/queries/discoverTv.d.ts +15 -0
  244. package/dist/types/esm/queries/discoverTv.d.ts.map +1 -0
  245. package/dist/types/esm/queries/episode.d.ts +98 -0
  246. package/dist/types/esm/queries/episode.d.ts.map +1 -0
  247. package/dist/types/esm/queries/episodeCredits.d.ts +33 -0
  248. package/dist/types/esm/queries/episodeCredits.d.ts.map +1 -0
  249. package/dist/types/esm/queries/episodeExternalIds.d.ts +16 -0
  250. package/dist/types/esm/queries/episodeExternalIds.d.ts.map +1 -0
  251. package/dist/types/esm/queries/episodeStills.d.ts +6 -0
  252. package/dist/types/esm/queries/episodeStills.d.ts.map +1 -0
  253. package/dist/types/esm/queries/episodeTranslations.d.ts +20 -0
  254. package/dist/types/esm/queries/episodeTranslations.d.ts.map +1 -0
  255. package/dist/types/esm/queries/episodeVideos.d.ts +16 -0
  256. package/dist/types/esm/queries/episodeVideos.d.ts.map +1 -0
  257. package/dist/types/esm/queries/find.d.ts +1803 -0
  258. package/dist/types/esm/queries/find.d.ts.map +1 -0
  259. package/dist/types/esm/queries/genres.d.ts +9 -0
  260. package/dist/types/esm/queries/genres.d.ts.map +1 -0
  261. package/dist/types/esm/queries/keyword.d.ts +9 -0
  262. package/dist/types/esm/queries/keyword.d.ts.map +1 -0
  263. package/dist/types/esm/queries/movie.d.ts +3597 -0
  264. package/dist/types/esm/queries/movie.d.ts.map +1 -0
  265. package/dist/types/esm/queries/movieAlternativeTitles.d.ts +7 -0
  266. package/dist/types/esm/queries/movieAlternativeTitles.d.ts.map +1 -0
  267. package/dist/types/esm/queries/movieCredits.d.ts +33 -0
  268. package/dist/types/esm/queries/movieCredits.d.ts.map +1 -0
  269. package/dist/types/esm/queries/movieExternalIds.d.ts +16 -0
  270. package/dist/types/esm/queries/movieExternalIds.d.ts.map +1 -0
  271. package/dist/types/esm/queries/movieImages.d.ts +6 -0
  272. package/dist/types/esm/queries/movieImages.d.ts.map +1 -0
  273. package/dist/types/esm/queries/movieKeywords.d.ts +6 -0
  274. package/dist/types/esm/queries/movieKeywords.d.ts.map +1 -0
  275. package/dist/types/esm/queries/movieRecommendations.d.ts +1866 -0
  276. package/dist/types/esm/queries/movieRecommendations.d.ts.map +1 -0
  277. package/dist/types/esm/queries/movieReleaseDates.d.ts +13 -0
  278. package/dist/types/esm/queries/movieReleaseDates.d.ts.map +1 -0
  279. package/dist/types/esm/queries/movieReviews.d.ts +1866 -0
  280. package/dist/types/esm/queries/movieReviews.d.ts.map +1 -0
  281. package/dist/types/esm/queries/movieSimilarMovies.d.ts +1866 -0
  282. package/dist/types/esm/queries/movieSimilarMovies.d.ts.map +1 -0
  283. package/dist/types/esm/queries/movieTranslations.d.ts +20 -0
  284. package/dist/types/esm/queries/movieTranslations.d.ts.map +1 -0
  285. package/dist/types/esm/queries/movieVideos.d.ts +16 -0
  286. package/dist/types/esm/queries/movieVideos.d.ts.map +1 -0
  287. package/dist/types/esm/queries/movieWatchProviders.d.ts +1375 -0
  288. package/dist/types/esm/queries/movieWatchProviders.d.ts.map +1 -0
  289. package/dist/types/esm/queries/network.d.ts +26 -0
  290. package/dist/types/esm/queries/network.d.ts.map +1 -0
  291. package/dist/types/esm/queries/networkAlternativeNames.d.ts +10 -0
  292. package/dist/types/esm/queries/networkAlternativeNames.d.ts.map +1 -0
  293. package/dist/types/esm/queries/networkLogos.d.ts +14 -0
  294. package/dist/types/esm/queries/networkLogos.d.ts.map +1 -0
  295. package/dist/types/esm/queries/person.d.ts +46 -0
  296. package/dist/types/esm/queries/person.d.ts.map +1 -0
  297. package/dist/types/esm/queries/personCombinedCredits.d.ts +6 -0
  298. package/dist/types/esm/queries/personCombinedCredits.d.ts.map +1 -0
  299. package/dist/types/esm/queries/personExternalIds.d.ts +6 -0
  300. package/dist/types/esm/queries/personExternalIds.d.ts.map +1 -0
  301. package/dist/types/esm/queries/personMovieCredits.d.ts +6 -0
  302. package/dist/types/esm/queries/personMovieCredits.d.ts.map +1 -0
  303. package/dist/types/esm/queries/personProfiles.d.ts +6 -0
  304. package/dist/types/esm/queries/personProfiles.d.ts.map +1 -0
  305. package/dist/types/esm/queries/personTranslations.d.ts +20 -0
  306. package/dist/types/esm/queries/personTranslations.d.ts.map +1 -0
  307. package/dist/types/esm/queries/personTvCredits.d.ts +6 -0
  308. package/dist/types/esm/queries/personTvCredits.d.ts.map +1 -0
  309. package/dist/types/esm/queries/rated.d.ts +17 -0
  310. package/dist/types/esm/queries/rated.d.ts.map +1 -0
  311. package/dist/types/esm/queries/review.d.ts +28 -0
  312. package/dist/types/esm/queries/review.d.ts.map +1 -0
  313. package/dist/types/esm/queries/search.d.ts +17 -0
  314. package/dist/types/esm/queries/search.d.ts.map +1 -0
  315. package/dist/types/esm/queries/season.d.ts +282 -0
  316. package/dist/types/esm/queries/season.d.ts.map +1 -0
  317. package/dist/types/esm/queries/seasonCredits.d.ts +33 -0
  318. package/dist/types/esm/queries/seasonCredits.d.ts.map +1 -0
  319. package/dist/types/esm/queries/seasonEpisodeCount.d.ts +3 -0
  320. package/dist/types/esm/queries/seasonEpisodeCount.d.ts.map +1 -0
  321. package/dist/types/esm/queries/seasonExternalIds.d.ts +6 -0
  322. package/dist/types/esm/queries/seasonExternalIds.d.ts.map +1 -0
  323. package/dist/types/esm/queries/seasonPosters.d.ts +6 -0
  324. package/dist/types/esm/queries/seasonPosters.d.ts.map +1 -0
  325. package/dist/types/esm/queries/seasonTranslations.d.ts +20 -0
  326. package/dist/types/esm/queries/seasonTranslations.d.ts.map +1 -0
  327. package/dist/types/esm/queries/seasonVideos.d.ts +16 -0
  328. package/dist/types/esm/queries/seasonVideos.d.ts.map +1 -0
  329. package/dist/types/esm/queries/trending.d.ts +17 -0
  330. package/dist/types/esm/queries/trending.d.ts.map +1 -0
  331. package/dist/types/esm/queries/tv.d.ts +10460 -0
  332. package/dist/types/esm/queries/tv.d.ts.map +1 -0
  333. package/dist/types/esm/queries/tvAlternativeTitles.d.ts +12 -0
  334. package/dist/types/esm/queries/tvAlternativeTitles.d.ts.map +1 -0
  335. package/dist/types/esm/queries/tvContentRatings.d.ts +10 -0
  336. package/dist/types/esm/queries/tvContentRatings.d.ts.map +1 -0
  337. package/dist/types/esm/queries/tvCredits.d.ts +33 -0
  338. package/dist/types/esm/queries/tvCredits.d.ts.map +1 -0
  339. package/dist/types/esm/queries/tvEpisodeGroups.d.ts +41 -0
  340. package/dist/types/esm/queries/tvEpisodeGroups.d.ts.map +1 -0
  341. package/dist/types/esm/queries/tvExternalIds.d.ts +16 -0
  342. package/dist/types/esm/queries/tvExternalIds.d.ts.map +1 -0
  343. package/dist/types/esm/queries/tvImages.d.ts +16 -0
  344. package/dist/types/esm/queries/tvImages.d.ts.map +1 -0
  345. package/dist/types/esm/queries/tvKeywords.d.ts +10 -0
  346. package/dist/types/esm/queries/tvKeywords.d.ts.map +1 -0
  347. package/dist/types/esm/queries/tvRecommendations.d.ts +5373 -0
  348. package/dist/types/esm/queries/tvRecommendations.d.ts.map +1 -0
  349. package/dist/types/esm/queries/tvReviews.d.ts +5373 -0
  350. package/dist/types/esm/queries/tvReviews.d.ts.map +1 -0
  351. package/dist/types/esm/queries/tvSimilarTvShows.d.ts +5373 -0
  352. package/dist/types/esm/queries/tvSimilarTvShows.d.ts.map +1 -0
  353. package/dist/types/esm/queries/tvTranslations.d.ts +20 -0
  354. package/dist/types/esm/queries/tvTranslations.d.ts.map +1 -0
  355. package/dist/types/esm/queries/tvVideos.d.ts +16 -0
  356. package/dist/types/esm/queries/tvVideos.d.ts.map +1 -0
  357. package/dist/types/esm/queries/tvWatchProviders.d.ts +1375 -0
  358. package/dist/types/esm/queries/tvWatchProviders.d.ts.map +1 -0
  359. package/dist/types/esm/queries/videoType.d.ts +3 -0
  360. package/dist/types/esm/queries/videoType.d.ts.map +1 -0
  361. package/dist/types/esm/types.d.ts +326 -0
  362. package/dist/types/esm/types.d.ts.map +1 -0
  363. package/dist/types/tsconfig.build.tsbuildinfo +1 -0
  364. package/package.json +71 -0
  365. package/src/__testUtils__/helpers/buildEndpoint.ts +21 -0
  366. package/src/__testUtils__/helpers/buildResolveInfoArg.ts +34 -0
  367. package/src/__testUtils__/helpers/createRestClient.ts +9 -0
  368. package/src/constants.ts +71 -0
  369. package/src/helpers/__snapshots__/typePropNames.test.ts.snap +708 -0
  370. package/src/helpers/decodeId.ts +4 -0
  371. package/src/helpers/defaultFieldResolver.ts +19 -0
  372. package/src/helpers/encodeId.ts +4 -0
  373. package/src/helpers/formatDirectionalSuffixes.ts +15 -0
  374. package/src/helpers/formatQueryParams.ts +8 -0
  375. package/src/helpers/getAppendToResponseKeys.ts +28 -0
  376. package/src/helpers/getTvIdSeasonAndEpisode.ts +25 -0
  377. package/src/helpers/makeFallbackFieldResolvers.ts +11 -0
  378. package/src/helpers/removeNullValues.ts +11 -0
  379. package/src/helpers/snakeCasePropNames.ts +9 -0
  380. package/src/helpers/typePropNames.test.ts +7 -0
  381. package/src/helpers/typePropNames.ts +14 -0
  382. package/src/index.ts +2 -0
  383. package/src/main.ts +215 -0
  384. package/src/queries/__snapshots__/certifications.test.ts.snap +1365 -0
  385. package/src/queries/__snapshots__/collection.test.ts.snap +195 -0
  386. package/src/queries/__snapshots__/collectionImages.test.ts.snap +29 -0
  387. package/src/queries/__snapshots__/collectionTranslations.test.ts.snap +391 -0
  388. package/src/queries/__snapshots__/company.test.ts.snap +14 -0
  389. package/src/queries/__snapshots__/companyAlternativeNames.test.ts.snap +14 -0
  390. package/src/queries/__snapshots__/companyLogos.test.ts.snap +46 -0
  391. package/src/queries/__snapshots__/configuration.test.ts.snap +101 -0
  392. package/src/queries/__snapshots__/configurationCountries.test.ts.snap +1241 -0
  393. package/src/queries/__snapshots__/configurationJobs.test.ts.snap +1007 -0
  394. package/src/queries/__snapshots__/configurationLanguages.test.ts.snap +941 -0
  395. package/src/queries/__snapshots__/configurationPrimaryTranslations.test.ts.snap +76 -0
  396. package/src/queries/__snapshots__/configurationTimezones.test.ts.snap +1678 -0
  397. package/src/queries/__snapshots__/credit.test.ts.snap +106 -0
  398. package/src/queries/__snapshots__/discoverMovies.test.ts.snap +481 -0
  399. package/src/queries/__snapshots__/discoverTv.test.ts.snap +443 -0
  400. package/src/queries/__snapshots__/episode.test.ts.snap +360 -0
  401. package/src/queries/__snapshots__/episodeCredits.test.ts.snap +866 -0
  402. package/src/queries/__snapshots__/episodeExternalIds.test.ts.snap +21 -0
  403. package/src/queries/__snapshots__/episodeStills.test.ts.snap +281 -0
  404. package/src/queries/__snapshots__/episodeTranslations.test.ts.snap +1059 -0
  405. package/src/queries/__snapshots__/episodeVideos.test.ts.snap +5 -0
  406. package/src/queries/__snapshots__/find.test.ts.snap +86 -0
  407. package/src/queries/__snapshots__/genres.test.ts.snap +151 -0
  408. package/src/queries/__snapshots__/keyword.test.ts.snap +8 -0
  409. package/src/queries/__snapshots__/movie.test.ts.snap +73 -0
  410. package/src/queries/__snapshots__/movieAlternativeTitles.test.ts.snap +611 -0
  411. package/src/queries/__snapshots__/movieCredits.test.ts.snap +2690 -0
  412. package/src/queries/__snapshots__/movieExternalIds.test.ts.snap +19 -0
  413. package/src/queries/__snapshots__/movieImages.test.ts.snap +7 -0
  414. package/src/queries/__snapshots__/movieKeywords.test.ts.snap +147 -0
  415. package/src/queries/__snapshots__/movieRecommendations.test.ts.snap +727 -0
  416. package/src/queries/__snapshots__/movieReleaseDates.test.ts.snap +755 -0
  417. package/src/queries/__snapshots__/movieReviews.test.ts.snap +509 -0
  418. package/src/queries/__snapshots__/movieSimilarMovies.test.ts.snap +693 -0
  419. package/src/queries/__snapshots__/movieTranslations.test.ts.snap +1079 -0
  420. package/src/queries/__snapshots__/movieVideos.test.ts.snap +179 -0
  421. package/src/queries/__snapshots__/movieWatchProviders.test.ts.snap +5321 -0
  422. package/src/queries/__snapshots__/network.test.ts.snap +12 -0
  423. package/src/queries/__snapshots__/networkAlternativeNames.test.ts.snap +18 -0
  424. package/src/queries/__snapshots__/networkLogos.test.ts.snap +16 -0
  425. package/src/queries/__snapshots__/person.test.ts.snap +35 -0
  426. package/src/queries/__snapshots__/personCombinedCredits.test.ts.snap +7249 -0
  427. package/src/queries/__snapshots__/personExternalIds.test.ts.snap +25 -0
  428. package/src/queries/__snapshots__/personMovieCredits.test.ts.snap +5595 -0
  429. package/src/queries/__snapshots__/personProfiles.test.ts.snap +155 -0
  430. package/src/queries/__snapshots__/personTranslations.test.ts.snap +389 -0
  431. package/src/queries/__snapshots__/personTvCredits.test.ts.snap +1361 -0
  432. package/src/queries/__snapshots__/rated.test.ts.snap +547 -0
  433. package/src/queries/__snapshots__/review.test.ts.snap +31 -0
  434. package/src/queries/__snapshots__/search.test.ts.snap +2479 -0
  435. package/src/queries/__snapshots__/season.test.ts.snap +4694 -0
  436. package/src/queries/__snapshots__/seasonCredits.test.ts.snap +692 -0
  437. package/src/queries/__snapshots__/seasonExternalIds.test.ts.snap +19 -0
  438. package/src/queries/__snapshots__/seasonPosters.test.ts.snap +5 -0
  439. package/src/queries/__snapshots__/seasonTranslations.test.ts.snap +1073 -0
  440. package/src/queries/__snapshots__/seasonVideos.test.ts.snap +395 -0
  441. package/src/queries/__snapshots__/trending.test.ts.snap +481 -0
  442. package/src/queries/__snapshots__/tv.test.ts.snap +220 -0
  443. package/src/queries/__snapshots__/tvAlternativeTitles.test.ts.snap +211 -0
  444. package/src/queries/__snapshots__/tvContentRatings.test.ts.snap +115 -0
  445. package/src/queries/__snapshots__/tvCredits.test.ts.snap +809 -0
  446. package/src/queries/__snapshots__/tvEpisodeGroups.test.ts.snap +39 -0
  447. package/src/queries/__snapshots__/tvExternalIds.test.ts.snap +27 -0
  448. package/src/queries/__snapshots__/tvImages.test.ts.snap +7 -0
  449. package/src/queries/__snapshots__/tvKeywords.test.ts.snap +59 -0
  450. package/src/queries/__snapshots__/tvRecommendations.test.ts.snap +757 -0
  451. package/src/queries/__snapshots__/tvReviews.test.ts.snap +562 -0
  452. package/src/queries/__snapshots__/tvSimilarTvShows.test.ts.snap +759 -0
  453. package/src/queries/__snapshots__/tvTranslations.test.ts.snap +1267 -0
  454. package/src/queries/__snapshots__/tvVideos.test.ts.snap +107 -0
  455. package/src/queries/__snapshots__/tvWatchProviders.test.ts.snap +2817 -0
  456. package/src/queries/certifications.test.ts +66 -0
  457. package/src/queries/certifications.ts +29 -0
  458. package/src/queries/collection.test.ts +47 -0
  459. package/src/queries/collection.ts +40 -0
  460. package/src/queries/collectionImages.test.ts +90 -0
  461. package/src/queries/collectionImages.ts +30 -0
  462. package/src/queries/collectionTranslations.test.ts +45 -0
  463. package/src/queries/collectionTranslations.ts +28 -0
  464. package/src/queries/company.test.ts +45 -0
  465. package/src/queries/company.ts +40 -0
  466. package/src/queries/companyAlternativeNames.test.ts +45 -0
  467. package/src/queries/companyAlternativeNames.ts +29 -0
  468. package/src/queries/companyLogos.test.ts +45 -0
  469. package/src/queries/companyLogos.ts +28 -0
  470. package/src/queries/configuration.test.ts +44 -0
  471. package/src/queries/configuration.ts +23 -0
  472. package/src/queries/configurationCountries.test.ts +45 -0
  473. package/src/queries/configurationCountries.ts +28 -0
  474. package/src/queries/configurationJobs.test.ts +45 -0
  475. package/src/queries/configurationJobs.ts +28 -0
  476. package/src/queries/configurationLanguages.test.ts +45 -0
  477. package/src/queries/configurationLanguages.ts +28 -0
  478. package/src/queries/configurationPrimaryTranslations.test.ts +45 -0
  479. package/src/queries/configurationPrimaryTranslations.ts +29 -0
  480. package/src/queries/configurationTimezones.test.ts +45 -0
  481. package/src/queries/configurationTimezones.ts +28 -0
  482. package/src/queries/credit.test.ts +45 -0
  483. package/src/queries/credit.ts +26 -0
  484. package/src/queries/discoverMovies.test.ts +202 -0
  485. package/src/queries/discoverMovies.ts +65 -0
  486. package/src/queries/discoverTv.test.ts +142 -0
  487. package/src/queries/discoverTv.ts +66 -0
  488. package/src/queries/episode.test.ts +82 -0
  489. package/src/queries/episode.ts +73 -0
  490. package/src/queries/episodeCredits.test.ts +134 -0
  491. package/src/queries/episodeCredits.ts +41 -0
  492. package/src/queries/episodeExternalIds.test.ts +104 -0
  493. package/src/queries/episodeExternalIds.ts +40 -0
  494. package/src/queries/episodeStills.test.ts +96 -0
  495. package/src/queries/episodeStills.ts +38 -0
  496. package/src/queries/episodeTranslations.test.ts +96 -0
  497. package/src/queries/episodeTranslations.ts +38 -0
  498. package/src/queries/episodeVideos.test.ts +96 -0
  499. package/src/queries/episodeVideos.ts +38 -0
  500. package/src/queries/find.test.ts +48 -0
  501. package/src/queries/find.ts +35 -0
  502. package/src/queries/genres.test.ts +66 -0
  503. package/src/queries/genres.ts +29 -0
  504. package/src/queries/keyword.test.ts +45 -0
  505. package/src/queries/keyword.ts +28 -0
  506. package/src/queries/movie.test.ts +81 -0
  507. package/src/queries/movie.ts +87 -0
  508. package/src/queries/movieAlternativeTitles.test.ts +95 -0
  509. package/src/queries/movieAlternativeTitles.ts +37 -0
  510. package/src/queries/movieCredits.test.ts +118 -0
  511. package/src/queries/movieCredits.ts +35 -0
  512. package/src/queries/movieExternalIds.test.ts +95 -0
  513. package/src/queries/movieExternalIds.ts +35 -0
  514. package/src/queries/movieImages.test.ts +118 -0
  515. package/src/queries/movieImages.ts +35 -0
  516. package/src/queries/movieKeywords.test.ts +95 -0
  517. package/src/queries/movieKeywords.ts +33 -0
  518. package/src/queries/movieRecommendations.test.ts +173 -0
  519. package/src/queries/movieRecommendations.ts +74 -0
  520. package/src/queries/movieReleaseDates.test.ts +103 -0
  521. package/src/queries/movieReleaseDates.ts +34 -0
  522. package/src/queries/movieReviews.test.ts +152 -0
  523. package/src/queries/movieReviews.ts +74 -0
  524. package/src/queries/movieSimilarMovies.test.ts +173 -0
  525. package/src/queries/movieSimilarMovies.ts +74 -0
  526. package/src/queries/movieTranslations.test.ts +99 -0
  527. package/src/queries/movieTranslations.ts +33 -0
  528. package/src/queries/movieVideos.test.ts +95 -0
  529. package/src/queries/movieVideos.ts +33 -0
  530. package/src/queries/movieWatchProviders.test.ts +103 -0
  531. package/src/queries/movieWatchProviders.ts +33 -0
  532. package/src/queries/network.test.ts +45 -0
  533. package/src/queries/network.ts +40 -0
  534. package/src/queries/networkAlternativeNames.test.ts +45 -0
  535. package/src/queries/networkAlternativeNames.ts +29 -0
  536. package/src/queries/networkLogos.test.ts +45 -0
  537. package/src/queries/networkLogos.ts +28 -0
  538. package/src/queries/person.test.ts +81 -0
  539. package/src/queries/person.ts +67 -0
  540. package/src/queries/personCombinedCredits.test.ts +99 -0
  541. package/src/queries/personCombinedCredits.ts +35 -0
  542. package/src/queries/personExternalIds.test.ts +99 -0
  543. package/src/queries/personExternalIds.ts +35 -0
  544. package/src/queries/personMovieCredits.test.ts +99 -0
  545. package/src/queries/personMovieCredits.ts +35 -0
  546. package/src/queries/personProfiles.test.ts +98 -0
  547. package/src/queries/personProfiles.ts +33 -0
  548. package/src/queries/personTranslations.test.ts +99 -0
  549. package/src/queries/personTranslations.ts +33 -0
  550. package/src/queries/personTvCredits.test.ts +99 -0
  551. package/src/queries/personTvCredits.ts +35 -0
  552. package/src/queries/rated.test.ts +170 -0
  553. package/src/queries/rated.ts +70 -0
  554. package/src/queries/review.test.ts +45 -0
  555. package/src/queries/review.ts +40 -0
  556. package/src/queries/search.test.ts +426 -0
  557. package/src/queries/search.ts +73 -0
  558. package/src/queries/season.test.ts +82 -0
  559. package/src/queries/season.ts +78 -0
  560. package/src/queries/seasonCredits.test.ts +118 -0
  561. package/src/queries/seasonCredits.ts +35 -0
  562. package/src/queries/seasonEpisodeCount.ts +9 -0
  563. package/src/queries/seasonExternalIds.test.ts +103 -0
  564. package/src/queries/seasonExternalIds.ts +35 -0
  565. package/src/queries/seasonPosters.test.ts +94 -0
  566. package/src/queries/seasonPosters.ts +33 -0
  567. package/src/queries/seasonTranslations.test.ts +102 -0
  568. package/src/queries/seasonTranslations.ts +33 -0
  569. package/src/queries/seasonVideos.test.ts +102 -0
  570. package/src/queries/seasonVideos.ts +33 -0
  571. package/src/queries/trending.test.ts +165 -0
  572. package/src/queries/trending.ts +70 -0
  573. package/src/queries/tv.test.ts +81 -0
  574. package/src/queries/tv.ts +98 -0
  575. package/src/queries/tvAlternativeTitles.test.ts +103 -0
  576. package/src/queries/tvAlternativeTitles.ts +35 -0
  577. package/src/queries/tvContentRatings.test.ts +103 -0
  578. package/src/queries/tvContentRatings.ts +35 -0
  579. package/src/queries/tvCredits.test.ts +118 -0
  580. package/src/queries/tvCredits.ts +35 -0
  581. package/src/queries/tvEpisodeGroups.test.ts +103 -0
  582. package/src/queries/tvEpisodeGroups.ts +34 -0
  583. package/src/queries/tvExternalIds.test.ts +103 -0
  584. package/src/queries/tvExternalIds.ts +35 -0
  585. package/src/queries/tvImages.test.ts +118 -0
  586. package/src/queries/tvImages.ts +35 -0
  587. package/src/queries/tvKeywords.test.ts +103 -0
  588. package/src/queries/tvKeywords.ts +33 -0
  589. package/src/queries/tvRecommendations.test.ts +173 -0
  590. package/src/queries/tvRecommendations.ts +74 -0
  591. package/src/queries/tvReviews.test.ts +168 -0
  592. package/src/queries/tvReviews.ts +74 -0
  593. package/src/queries/tvSimilarTvShows.test.ts +168 -0
  594. package/src/queries/tvSimilarTvShows.ts +74 -0
  595. package/src/queries/tvTranslations.test.ts +103 -0
  596. package/src/queries/tvTranslations.ts +33 -0
  597. package/src/queries/tvVideos.test.ts +103 -0
  598. package/src/queries/tvVideos.ts +33 -0
  599. package/src/queries/tvWatchProviders.test.ts +103 -0
  600. package/src/queries/tvWatchProviders.ts +33 -0
  601. package/src/queries/videoType.ts +4 -0
  602. package/src/types.ts +476 -0
  603. package/tsconfig.build.json +11 -0
  604. 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
+ });