@tmdb-graphql-api/resolvers 0.1.0 → 0.1.1-unstable.1

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 (486) hide show
  1. package/dist/cjs/index.cjs +1 -1
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/esm/index.mjs +1 -1
  4. package/dist/esm/index.mjs.map +1 -1
  5. package/dist/production.analysis.txt +514 -421
  6. package/dist/types/cjs/constants.d.cts +3 -0
  7. package/dist/types/cjs/constants.d.cts.map +1 -1
  8. package/dist/types/cjs/helpers/buildArgsResolver.d.cts +9 -0
  9. package/dist/types/cjs/helpers/buildArgsResolver.d.cts.map +1 -0
  10. package/dist/types/cjs/helpers/buildNoObjArgsResolver.d.cts +9 -0
  11. package/dist/types/cjs/helpers/buildNoObjArgsResolver.d.cts.map +1 -0
  12. package/dist/types/cjs/helpers/buildObjArgsResolver.d.cts +9 -0
  13. package/dist/types/cjs/helpers/buildObjArgsResolver.d.cts.map +1 -0
  14. package/dist/types/cjs/helpers/buildObjResolver.d.cts +11 -0
  15. package/dist/types/cjs/helpers/buildObjResolver.d.cts.map +1 -0
  16. package/dist/types/cjs/helpers/getTvIdSeasonAndEpisode.d.cts +2 -2
  17. package/dist/types/cjs/helpers/getTvIdSeasonAndEpisode.d.cts.map +1 -1
  18. package/dist/types/cjs/main.d.cts.map +1 -1
  19. package/dist/types/cjs/queries/certifications.d.cts +429 -4
  20. package/dist/types/cjs/queries/certifications.d.cts.map +1 -1
  21. package/dist/types/cjs/queries/collection.d.cts +63 -3399
  22. package/dist/types/cjs/queries/collection.d.cts.map +1 -1
  23. package/dist/types/cjs/queries/collectionImages.d.cts +40 -13
  24. package/dist/types/cjs/queries/collectionImages.d.cts.map +1 -1
  25. package/dist/types/cjs/queries/collectionTranslations.d.cts +34 -17
  26. package/dist/types/cjs/queries/collectionTranslations.d.cts.map +1 -1
  27. package/dist/types/cjs/queries/company.d.cts +10 -13
  28. package/dist/types/cjs/queries/company.d.cts.map +1 -1
  29. package/dist/types/cjs/queries/companyAlternativeNames.d.cts +27 -9
  30. package/dist/types/cjs/queries/companyAlternativeNames.d.cts.map +1 -1
  31. package/dist/types/cjs/queries/companyLogos.d.cts +19 -13
  32. package/dist/types/cjs/queries/companyLogos.d.cts.map +1 -1
  33. package/dist/types/cjs/queries/configuration.d.cts +11 -14
  34. package/dist/types/cjs/queries/configuration.d.cts.map +1 -1
  35. package/dist/types/cjs/queries/configurationCountries.d.cts +16 -3
  36. package/dist/types/cjs/queries/configurationCountries.d.cts.map +1 -1
  37. package/dist/types/cjs/queries/configurationJobs.d.cts +15 -3
  38. package/dist/types/cjs/queries/configurationJobs.d.cts.map +1 -1
  39. package/dist/types/cjs/queries/configurationLanguages.d.cts +16 -3
  40. package/dist/types/cjs/queries/configurationLanguages.d.cts.map +1 -1
  41. package/dist/types/cjs/queries/configurationPrimaryTranslations.d.cts +12 -3
  42. package/dist/types/cjs/queries/configurationPrimaryTranslations.d.cts.map +1 -1
  43. package/dist/types/cjs/queries/configurationTimezones.d.cts +15 -3
  44. package/dist/types/cjs/queries/configurationTimezones.d.cts.map +1 -1
  45. package/dist/types/cjs/queries/credit.d.cts +46 -4193
  46. package/dist/types/cjs/queries/credit.d.cts.map +1 -1
  47. package/dist/types/cjs/queries/discoverMovies.d.cts +2 -4
  48. package/dist/types/cjs/queries/discoverMovies.d.cts.map +1 -1
  49. package/dist/types/cjs/queries/discoverTv.d.cts +2 -4
  50. package/dist/types/cjs/queries/discoverTv.d.cts.map +1 -1
  51. package/dist/types/cjs/queries/episode.d.cts +236 -94
  52. package/dist/types/cjs/queries/episode.d.cts.map +1 -1
  53. package/dist/types/cjs/queries/episodeCredits.d.cts +168 -32
  54. package/dist/types/cjs/queries/episodeCredits.d.cts.map +1 -1
  55. package/dist/types/cjs/queries/episodeExternalIds.d.cts +139 -15
  56. package/dist/types/cjs/queries/episodeExternalIds.d.cts.map +1 -1
  57. package/dist/types/cjs/queries/episodeStills.d.cts +140 -5
  58. package/dist/types/cjs/queries/episodeStills.d.cts.map +1 -1
  59. package/dist/types/cjs/queries/episodeTranslations.d.cts +141 -19
  60. package/dist/types/cjs/queries/episodeTranslations.d.cts.map +1 -1
  61. package/dist/types/cjs/queries/episodeVideos.d.cts +142 -14
  62. package/dist/types/cjs/queries/episodeVideos.d.cts.map +1 -1
  63. package/dist/types/cjs/queries/find.d.cts +10 -1801
  64. package/dist/types/cjs/queries/find.d.cts.map +1 -1
  65. package/dist/types/cjs/queries/genres.d.cts +6 -6
  66. package/dist/types/cjs/queries/genres.d.cts.map +1 -1
  67. package/dist/types/cjs/queries/keyword.d.cts +3 -6
  68. package/dist/types/cjs/queries/keyword.d.cts.map +1 -1
  69. package/dist/types/cjs/queries/movie.d.cts +35 -3588
  70. package/dist/types/cjs/queries/movie.d.cts.map +1 -1
  71. package/dist/types/cjs/queries/movieAlternativeTitles.d.cts +1736 -5
  72. package/dist/types/cjs/queries/movieAlternativeTitles.d.cts.map +1 -1
  73. package/dist/types/cjs/queries/movieCredits.d.cts +1757 -32
  74. package/dist/types/cjs/queries/movieCredits.d.cts.map +1 -1
  75. package/dist/types/cjs/queries/movieExternalIds.d.cts +1738 -15
  76. package/dist/types/cjs/queries/movieExternalIds.d.cts.map +1 -1
  77. package/dist/types/cjs/queries/movieImages.d.cts +1756 -5
  78. package/dist/types/cjs/queries/movieImages.d.cts.map +1 -1
  79. package/dist/types/cjs/queries/movieKeywords.d.cts +1735 -5
  80. package/dist/types/cjs/queries/movieKeywords.d.cts.map +1 -1
  81. package/dist/types/cjs/queries/movieRecommendations.d.cts +1729 -1849
  82. package/dist/types/cjs/queries/movieRecommendations.d.cts.map +1 -1
  83. package/dist/types/cjs/queries/movieReleaseDates.d.cts +1742 -12
  84. package/dist/types/cjs/queries/movieReleaseDates.d.cts.map +1 -1
  85. package/dist/types/cjs/queries/movieReviews.d.cts +1729 -1849
  86. package/dist/types/cjs/queries/movieReviews.d.cts.map +1 -1
  87. package/dist/types/cjs/queries/movieSimilarMovies.d.cts +1729 -1849
  88. package/dist/types/cjs/queries/movieSimilarMovies.d.cts.map +1 -1
  89. package/dist/types/cjs/queries/movieTranslations.d.cts +1744 -19
  90. package/dist/types/cjs/queries/movieTranslations.d.cts.map +1 -1
  91. package/dist/types/cjs/queries/movieVideos.d.cts +1742 -14
  92. package/dist/types/cjs/queries/movieVideos.d.cts.map +1 -1
  93. package/dist/types/cjs/queries/movieWatchProviders.d.cts +3205 -1373
  94. package/dist/types/cjs/queries/movieWatchProviders.d.cts.map +1 -1
  95. package/dist/types/cjs/queries/network.d.cts +15 -24
  96. package/dist/types/cjs/queries/network.d.cts.map +1 -1
  97. package/dist/types/cjs/queries/networkAlternativeNames.d.cts +11 -9
  98. package/dist/types/cjs/queries/networkAlternativeNames.d.cts.map +1 -1
  99. package/dist/types/cjs/queries/networkLogos.d.cts +17 -13
  100. package/dist/types/cjs/queries/networkLogos.d.cts.map +1 -1
  101. package/dist/types/cjs/queries/person.d.cts +13 -41
  102. package/dist/types/cjs/queries/person.d.cts.map +1 -1
  103. package/dist/types/cjs/queries/personCombinedCredits.d.cts +233 -5
  104. package/dist/types/cjs/queries/personCombinedCredits.d.cts.map +1 -1
  105. package/dist/types/cjs/queries/personExternalIds.d.cts +203 -5
  106. package/dist/types/cjs/queries/personExternalIds.d.cts.map +1 -1
  107. package/dist/types/cjs/queries/personMovieCredits.d.cts +231 -5
  108. package/dist/types/cjs/queries/personMovieCredits.d.cts.map +1 -1
  109. package/dist/types/cjs/queries/personProfiles.d.cts +200 -5
  110. package/dist/types/cjs/queries/personProfiles.d.cts.map +1 -1
  111. package/dist/types/cjs/queries/personTranslations.d.cts +201 -19
  112. package/dist/types/cjs/queries/personTranslations.d.cts.map +1 -1
  113. package/dist/types/cjs/queries/personTvCredits.d.cts +232 -5
  114. package/dist/types/cjs/queries/personTvCredits.d.cts.map +1 -1
  115. package/dist/types/cjs/queries/rated.d.cts +6 -8
  116. package/dist/types/cjs/queries/rated.d.cts.map +1 -1
  117. package/dist/types/cjs/queries/review.d.cts +38 -24
  118. package/dist/types/cjs/queries/review.d.cts.map +1 -1
  119. package/dist/types/cjs/queries/search.d.cts +6 -8
  120. package/dist/types/cjs/queries/search.d.cts.map +1 -1
  121. package/dist/types/cjs/queries/season.d.cts +233 -279
  122. package/dist/types/cjs/queries/season.d.cts.map +1 -1
  123. package/dist/types/cjs/queries/seasonCredits.d.cts +152 -32
  124. package/dist/types/cjs/queries/seasonCredits.d.cts.map +1 -1
  125. package/dist/types/cjs/queries/seasonEpisodeCount.d.cts.map +1 -1
  126. package/dist/types/cjs/queries/seasonExternalIds.d.cts +134 -5
  127. package/dist/types/cjs/queries/seasonExternalIds.d.cts.map +1 -1
  128. package/dist/types/cjs/queries/seasonPosters.d.cts +136 -5
  129. package/dist/types/cjs/queries/seasonPosters.d.cts.map +1 -1
  130. package/dist/types/cjs/queries/seasonTranslations.d.cts +137 -19
  131. package/dist/types/cjs/queries/seasonTranslations.d.cts.map +1 -1
  132. package/dist/types/cjs/queries/seasonVideos.d.cts +138 -14
  133. package/dist/types/cjs/queries/seasonVideos.d.cts.map +1 -1
  134. package/dist/types/cjs/queries/trending.d.cts +5 -7
  135. package/dist/types/cjs/queries/trending.d.cts.map +1 -1
  136. package/dist/types/cjs/queries/tv.d.cts +79 -10455
  137. package/dist/types/cjs/queries/tv.d.cts.map +1 -1
  138. package/dist/types/cjs/queries/tvAlternativeTitles.d.cts +1273 -10
  139. package/dist/types/cjs/queries/tvAlternativeTitles.d.cts.map +1 -1
  140. package/dist/types/cjs/queries/tvContentRatings.d.cts +1273 -8
  141. package/dist/types/cjs/queries/tvContentRatings.d.cts.map +1 -1
  142. package/dist/types/cjs/queries/tvCredits.d.cts +1294 -32
  143. package/dist/types/cjs/queries/tvCredits.d.cts.map +1 -1
  144. package/dist/types/cjs/queries/tvEpisodeGroups.d.cts +1281 -38
  145. package/dist/types/cjs/queries/tvEpisodeGroups.d.cts.map +1 -1
  146. package/dist/types/cjs/queries/tvExternalIds.d.cts +1280 -15
  147. package/dist/types/cjs/queries/tvExternalIds.d.cts.map +1 -1
  148. package/dist/types/cjs/queries/tvImages.d.cts +1294 -15
  149. package/dist/types/cjs/queries/tvImages.d.cts.map +1 -1
  150. package/dist/types/cjs/queries/tvKeywords.d.cts +1272 -8
  151. package/dist/types/cjs/queries/tvKeywords.d.cts.map +1 -1
  152. package/dist/types/cjs/queries/tvRecommendations.d.cts +1265 -5354
  153. package/dist/types/cjs/queries/tvRecommendations.d.cts.map +1 -1
  154. package/dist/types/cjs/queries/tvReviews.d.cts +1265 -5354
  155. package/dist/types/cjs/queries/tvReviews.d.cts.map +1 -1
  156. package/dist/types/cjs/queries/tvSimilarTvShows.d.cts +1265 -5354
  157. package/dist/types/cjs/queries/tvSimilarTvShows.d.cts.map +1 -1
  158. package/dist/types/cjs/queries/tvTranslations.d.cts +1280 -18
  159. package/dist/types/cjs/queries/tvTranslations.d.cts.map +1 -1
  160. package/dist/types/cjs/queries/tvVideos.d.cts +1280 -14
  161. package/dist/types/cjs/queries/tvVideos.d.cts.map +1 -1
  162. package/dist/types/cjs/queries/tvWatchProviders.d.cts +2174 -1371
  163. package/dist/types/cjs/queries/tvWatchProviders.d.cts.map +1 -1
  164. package/dist/types/cjs/queries/videoType.d.cts +2 -2
  165. package/dist/types/cjs/queries/videoType.d.cts.map +1 -1
  166. package/dist/types/cjs/types.d.cts +130 -295
  167. package/dist/types/cjs/types.d.cts.map +1 -1
  168. package/dist/types/esm/constants.d.ts +3 -0
  169. package/dist/types/esm/constants.d.ts.map +1 -1
  170. package/dist/types/esm/helpers/buildArgsResolver.d.ts +9 -0
  171. package/dist/types/esm/helpers/buildArgsResolver.d.ts.map +1 -0
  172. package/dist/types/esm/helpers/buildNoObjArgsResolver.d.ts +9 -0
  173. package/dist/types/esm/helpers/buildNoObjArgsResolver.d.ts.map +1 -0
  174. package/dist/types/esm/helpers/buildObjArgsResolver.d.ts +9 -0
  175. package/dist/types/esm/helpers/buildObjArgsResolver.d.ts.map +1 -0
  176. package/dist/types/esm/helpers/buildObjResolver.d.ts +11 -0
  177. package/dist/types/esm/helpers/buildObjResolver.d.ts.map +1 -0
  178. package/dist/types/esm/helpers/getTvIdSeasonAndEpisode.d.ts +2 -2
  179. package/dist/types/esm/helpers/getTvIdSeasonAndEpisode.d.ts.map +1 -1
  180. package/dist/types/esm/main.d.ts.map +1 -1
  181. package/dist/types/esm/queries/certifications.d.ts +429 -4
  182. package/dist/types/esm/queries/certifications.d.ts.map +1 -1
  183. package/dist/types/esm/queries/collection.d.ts +63 -3399
  184. package/dist/types/esm/queries/collection.d.ts.map +1 -1
  185. package/dist/types/esm/queries/collectionImages.d.ts +40 -13
  186. package/dist/types/esm/queries/collectionImages.d.ts.map +1 -1
  187. package/dist/types/esm/queries/collectionTranslations.d.ts +34 -17
  188. package/dist/types/esm/queries/collectionTranslations.d.ts.map +1 -1
  189. package/dist/types/esm/queries/company.d.ts +10 -13
  190. package/dist/types/esm/queries/company.d.ts.map +1 -1
  191. package/dist/types/esm/queries/companyAlternativeNames.d.ts +27 -9
  192. package/dist/types/esm/queries/companyAlternativeNames.d.ts.map +1 -1
  193. package/dist/types/esm/queries/companyLogos.d.ts +19 -13
  194. package/dist/types/esm/queries/companyLogos.d.ts.map +1 -1
  195. package/dist/types/esm/queries/configuration.d.ts +11 -14
  196. package/dist/types/esm/queries/configuration.d.ts.map +1 -1
  197. package/dist/types/esm/queries/configurationCountries.d.ts +16 -3
  198. package/dist/types/esm/queries/configurationCountries.d.ts.map +1 -1
  199. package/dist/types/esm/queries/configurationJobs.d.ts +15 -3
  200. package/dist/types/esm/queries/configurationJobs.d.ts.map +1 -1
  201. package/dist/types/esm/queries/configurationLanguages.d.ts +16 -3
  202. package/dist/types/esm/queries/configurationLanguages.d.ts.map +1 -1
  203. package/dist/types/esm/queries/configurationPrimaryTranslations.d.ts +12 -3
  204. package/dist/types/esm/queries/configurationPrimaryTranslations.d.ts.map +1 -1
  205. package/dist/types/esm/queries/configurationTimezones.d.ts +15 -3
  206. package/dist/types/esm/queries/configurationTimezones.d.ts.map +1 -1
  207. package/dist/types/esm/queries/credit.d.ts +46 -4193
  208. package/dist/types/esm/queries/credit.d.ts.map +1 -1
  209. package/dist/types/esm/queries/discoverMovies.d.ts +2 -4
  210. package/dist/types/esm/queries/discoverMovies.d.ts.map +1 -1
  211. package/dist/types/esm/queries/discoverTv.d.ts +2 -4
  212. package/dist/types/esm/queries/discoverTv.d.ts.map +1 -1
  213. package/dist/types/esm/queries/episode.d.ts +236 -94
  214. package/dist/types/esm/queries/episode.d.ts.map +1 -1
  215. package/dist/types/esm/queries/episodeCredits.d.ts +168 -32
  216. package/dist/types/esm/queries/episodeCredits.d.ts.map +1 -1
  217. package/dist/types/esm/queries/episodeExternalIds.d.ts +139 -15
  218. package/dist/types/esm/queries/episodeExternalIds.d.ts.map +1 -1
  219. package/dist/types/esm/queries/episodeStills.d.ts +140 -5
  220. package/dist/types/esm/queries/episodeStills.d.ts.map +1 -1
  221. package/dist/types/esm/queries/episodeTranslations.d.ts +141 -19
  222. package/dist/types/esm/queries/episodeTranslations.d.ts.map +1 -1
  223. package/dist/types/esm/queries/episodeVideos.d.ts +142 -14
  224. package/dist/types/esm/queries/episodeVideos.d.ts.map +1 -1
  225. package/dist/types/esm/queries/find.d.ts +10 -1801
  226. package/dist/types/esm/queries/find.d.ts.map +1 -1
  227. package/dist/types/esm/queries/genres.d.ts +6 -6
  228. package/dist/types/esm/queries/genres.d.ts.map +1 -1
  229. package/dist/types/esm/queries/keyword.d.ts +3 -6
  230. package/dist/types/esm/queries/keyword.d.ts.map +1 -1
  231. package/dist/types/esm/queries/movie.d.ts +35 -3588
  232. package/dist/types/esm/queries/movie.d.ts.map +1 -1
  233. package/dist/types/esm/queries/movieAlternativeTitles.d.ts +1736 -5
  234. package/dist/types/esm/queries/movieAlternativeTitles.d.ts.map +1 -1
  235. package/dist/types/esm/queries/movieCredits.d.ts +1757 -32
  236. package/dist/types/esm/queries/movieCredits.d.ts.map +1 -1
  237. package/dist/types/esm/queries/movieExternalIds.d.ts +1738 -15
  238. package/dist/types/esm/queries/movieExternalIds.d.ts.map +1 -1
  239. package/dist/types/esm/queries/movieImages.d.ts +1756 -5
  240. package/dist/types/esm/queries/movieImages.d.ts.map +1 -1
  241. package/dist/types/esm/queries/movieKeywords.d.ts +1735 -5
  242. package/dist/types/esm/queries/movieKeywords.d.ts.map +1 -1
  243. package/dist/types/esm/queries/movieRecommendations.d.ts +1729 -1849
  244. package/dist/types/esm/queries/movieRecommendations.d.ts.map +1 -1
  245. package/dist/types/esm/queries/movieReleaseDates.d.ts +1742 -12
  246. package/dist/types/esm/queries/movieReleaseDates.d.ts.map +1 -1
  247. package/dist/types/esm/queries/movieReviews.d.ts +1729 -1849
  248. package/dist/types/esm/queries/movieReviews.d.ts.map +1 -1
  249. package/dist/types/esm/queries/movieSimilarMovies.d.ts +1729 -1849
  250. package/dist/types/esm/queries/movieSimilarMovies.d.ts.map +1 -1
  251. package/dist/types/esm/queries/movieTranslations.d.ts +1744 -19
  252. package/dist/types/esm/queries/movieTranslations.d.ts.map +1 -1
  253. package/dist/types/esm/queries/movieVideos.d.ts +1742 -14
  254. package/dist/types/esm/queries/movieVideos.d.ts.map +1 -1
  255. package/dist/types/esm/queries/movieWatchProviders.d.ts +3205 -1373
  256. package/dist/types/esm/queries/movieWatchProviders.d.ts.map +1 -1
  257. package/dist/types/esm/queries/network.d.ts +15 -24
  258. package/dist/types/esm/queries/network.d.ts.map +1 -1
  259. package/dist/types/esm/queries/networkAlternativeNames.d.ts +11 -9
  260. package/dist/types/esm/queries/networkAlternativeNames.d.ts.map +1 -1
  261. package/dist/types/esm/queries/networkLogos.d.ts +17 -13
  262. package/dist/types/esm/queries/networkLogos.d.ts.map +1 -1
  263. package/dist/types/esm/queries/person.d.ts +13 -41
  264. package/dist/types/esm/queries/person.d.ts.map +1 -1
  265. package/dist/types/esm/queries/personCombinedCredits.d.ts +233 -5
  266. package/dist/types/esm/queries/personCombinedCredits.d.ts.map +1 -1
  267. package/dist/types/esm/queries/personExternalIds.d.ts +203 -5
  268. package/dist/types/esm/queries/personExternalIds.d.ts.map +1 -1
  269. package/dist/types/esm/queries/personMovieCredits.d.ts +231 -5
  270. package/dist/types/esm/queries/personMovieCredits.d.ts.map +1 -1
  271. package/dist/types/esm/queries/personProfiles.d.ts +200 -5
  272. package/dist/types/esm/queries/personProfiles.d.ts.map +1 -1
  273. package/dist/types/esm/queries/personTranslations.d.ts +201 -19
  274. package/dist/types/esm/queries/personTranslations.d.ts.map +1 -1
  275. package/dist/types/esm/queries/personTvCredits.d.ts +232 -5
  276. package/dist/types/esm/queries/personTvCredits.d.ts.map +1 -1
  277. package/dist/types/esm/queries/rated.d.ts +6 -8
  278. package/dist/types/esm/queries/rated.d.ts.map +1 -1
  279. package/dist/types/esm/queries/review.d.ts +38 -24
  280. package/dist/types/esm/queries/review.d.ts.map +1 -1
  281. package/dist/types/esm/queries/search.d.ts +6 -8
  282. package/dist/types/esm/queries/search.d.ts.map +1 -1
  283. package/dist/types/esm/queries/season.d.ts +233 -279
  284. package/dist/types/esm/queries/season.d.ts.map +1 -1
  285. package/dist/types/esm/queries/seasonCredits.d.ts +152 -32
  286. package/dist/types/esm/queries/seasonCredits.d.ts.map +1 -1
  287. package/dist/types/esm/queries/seasonEpisodeCount.d.ts.map +1 -1
  288. package/dist/types/esm/queries/seasonExternalIds.d.ts +134 -5
  289. package/dist/types/esm/queries/seasonExternalIds.d.ts.map +1 -1
  290. package/dist/types/esm/queries/seasonPosters.d.ts +136 -5
  291. package/dist/types/esm/queries/seasonPosters.d.ts.map +1 -1
  292. package/dist/types/esm/queries/seasonTranslations.d.ts +137 -19
  293. package/dist/types/esm/queries/seasonTranslations.d.ts.map +1 -1
  294. package/dist/types/esm/queries/seasonVideos.d.ts +138 -14
  295. package/dist/types/esm/queries/seasonVideos.d.ts.map +1 -1
  296. package/dist/types/esm/queries/trending.d.ts +5 -7
  297. package/dist/types/esm/queries/trending.d.ts.map +1 -1
  298. package/dist/types/esm/queries/tv.d.ts +79 -10455
  299. package/dist/types/esm/queries/tv.d.ts.map +1 -1
  300. package/dist/types/esm/queries/tvAlternativeTitles.d.ts +1273 -10
  301. package/dist/types/esm/queries/tvAlternativeTitles.d.ts.map +1 -1
  302. package/dist/types/esm/queries/tvContentRatings.d.ts +1273 -8
  303. package/dist/types/esm/queries/tvContentRatings.d.ts.map +1 -1
  304. package/dist/types/esm/queries/tvCredits.d.ts +1294 -32
  305. package/dist/types/esm/queries/tvCredits.d.ts.map +1 -1
  306. package/dist/types/esm/queries/tvEpisodeGroups.d.ts +1281 -38
  307. package/dist/types/esm/queries/tvEpisodeGroups.d.ts.map +1 -1
  308. package/dist/types/esm/queries/tvExternalIds.d.ts +1280 -15
  309. package/dist/types/esm/queries/tvExternalIds.d.ts.map +1 -1
  310. package/dist/types/esm/queries/tvImages.d.ts +1294 -15
  311. package/dist/types/esm/queries/tvImages.d.ts.map +1 -1
  312. package/dist/types/esm/queries/tvKeywords.d.ts +1272 -8
  313. package/dist/types/esm/queries/tvKeywords.d.ts.map +1 -1
  314. package/dist/types/esm/queries/tvRecommendations.d.ts +1265 -5354
  315. package/dist/types/esm/queries/tvRecommendations.d.ts.map +1 -1
  316. package/dist/types/esm/queries/tvReviews.d.ts +1265 -5354
  317. package/dist/types/esm/queries/tvReviews.d.ts.map +1 -1
  318. package/dist/types/esm/queries/tvSimilarTvShows.d.ts +1265 -5354
  319. package/dist/types/esm/queries/tvSimilarTvShows.d.ts.map +1 -1
  320. package/dist/types/esm/queries/tvTranslations.d.ts +1280 -18
  321. package/dist/types/esm/queries/tvTranslations.d.ts.map +1 -1
  322. package/dist/types/esm/queries/tvVideos.d.ts +1280 -14
  323. package/dist/types/esm/queries/tvVideos.d.ts.map +1 -1
  324. package/dist/types/esm/queries/tvWatchProviders.d.ts +2174 -1371
  325. package/dist/types/esm/queries/tvWatchProviders.d.ts.map +1 -1
  326. package/dist/types/esm/queries/videoType.d.ts +2 -2
  327. package/dist/types/esm/queries/videoType.d.ts.map +1 -1
  328. package/dist/types/esm/types.d.ts +130 -295
  329. package/dist/types/esm/types.d.ts.map +1 -1
  330. package/dist/types/tsconfig.build.tsbuildinfo +1 -1
  331. package/package.json +12 -11
  332. package/src/__testUtils__/helpers/createMockLogger.ts +10 -0
  333. package/src/constants.ts +3 -0
  334. package/src/helpers/buildArgsResolver.ts +37 -0
  335. package/src/helpers/buildNoObjArgsResolver.ts +36 -0
  336. package/src/helpers/buildObjArgsResolver.ts +43 -0
  337. package/src/helpers/buildObjResolver.ts +48 -0
  338. package/src/helpers/getTvIdSeasonAndEpisode.ts +4 -4
  339. package/src/main.ts +5 -11
  340. package/src/queries/certifications.test.ts +13 -20
  341. package/src/queries/certifications.ts +21 -24
  342. package/src/queries/collection.test.ts +13 -16
  343. package/src/queries/collection.ts +20 -23
  344. package/src/queries/collectionImages.test.ts +16 -24
  345. package/src/queries/collectionImages.ts +16 -19
  346. package/src/queries/collectionTranslations.test.ts +29 -17
  347. package/src/queries/collectionTranslations.ts +19 -23
  348. package/src/queries/company.test.ts +13 -16
  349. package/src/queries/company.ts +20 -23
  350. package/src/queries/companyAlternativeNames.test.ts +34 -19
  351. package/src/queries/companyAlternativeNames.ts +19 -23
  352. package/src/queries/companyLogos.test.ts +29 -19
  353. package/src/queries/companyLogos.ts +13 -21
  354. package/src/queries/configuration.test.ts +12 -16
  355. package/src/queries/configuration.ts +11 -15
  356. package/src/queries/configurationCountries.test.ts +27 -17
  357. package/src/queries/configurationCountries.ts +19 -23
  358. package/src/queries/configurationJobs.test.ts +27 -17
  359. package/src/queries/configurationJobs.ts +19 -23
  360. package/src/queries/configurationLanguages.test.ts +27 -17
  361. package/src/queries/configurationLanguages.ts +19 -23
  362. package/src/queries/configurationPrimaryTranslations.test.ts +26 -17
  363. package/src/queries/configurationPrimaryTranslations.ts +14 -18
  364. package/src/queries/configurationTimezones.test.ts +27 -17
  365. package/src/queries/configurationTimezones.ts +19 -23
  366. package/src/queries/credit.test.ts +13 -16
  367. package/src/queries/credit.ts +12 -15
  368. package/src/queries/discoverMovies.test.ts +35 -81
  369. package/src/queries/discoverMovies.ts +21 -20
  370. package/src/queries/discoverTv.test.ts +29 -43
  371. package/src/queries/discoverTv.ts +16 -21
  372. package/src/queries/episode.test.ts +15 -16
  373. package/src/queries/episode.ts +34 -34
  374. package/src/queries/episodeCredits.test.ts +33 -55
  375. package/src/queries/episodeCredits.ts +29 -22
  376. package/src/queries/episodeExternalIds.test.ts +26 -28
  377. package/src/queries/episodeExternalIds.ts +35 -23
  378. package/src/queries/episodeStills.test.ts +26 -29
  379. package/src/queries/episodeStills.ts +32 -22
  380. package/src/queries/episodeTranslations.test.ts +24 -22
  381. package/src/queries/episodeTranslations.ts +29 -22
  382. package/src/queries/episodeVideos.test.ts +26 -29
  383. package/src/queries/episodeVideos.ts +29 -22
  384. package/src/queries/find.test.ts +13 -16
  385. package/src/queries/find.ts +25 -22
  386. package/src/queries/genres.test.ts +13 -22
  387. package/src/queries/genres.ts +13 -19
  388. package/src/queries/keyword.test.ts +13 -16
  389. package/src/queries/keyword.ts +12 -15
  390. package/src/queries/movie.test.ts +16 -20
  391. package/src/queries/movie.ts +20 -21
  392. package/src/queries/movieAlternativeTitles.test.ts +24 -30
  393. package/src/queries/movieAlternativeTitles.ts +34 -22
  394. package/src/queries/movieCredits.test.ts +27 -45
  395. package/src/queries/movieCredits.ts +24 -21
  396. package/src/queries/movieExternalIds.test.ts +22 -29
  397. package/src/queries/movieExternalIds.ts +26 -21
  398. package/src/queries/movieImages.test.ts +28 -46
  399. package/src/queries/movieImages.ts +26 -23
  400. package/src/queries/movieKeywords.test.ts +21 -26
  401. package/src/queries/movieKeywords.ts +24 -21
  402. package/src/queries/movieRecommendations.test.ts +27 -49
  403. package/src/queries/movieRecommendations.ts +27 -23
  404. package/src/queries/movieReleaseDates.test.ts +24 -28
  405. package/src/queries/movieReleaseDates.ts +25 -21
  406. package/src/queries/movieReviews.test.ts +32 -36
  407. package/src/queries/movieReviews.ts +28 -23
  408. package/src/queries/movieSimilarMovies.test.ts +25 -47
  409. package/src/queries/movieSimilarMovies.ts +28 -24
  410. package/src/queries/movieTranslations.test.ts +20 -25
  411. package/src/queries/movieTranslations.ts +24 -21
  412. package/src/queries/movieVideos.test.ts +22 -29
  413. package/src/queries/movieVideos.ts +24 -21
  414. package/src/queries/movieWatchProviders.test.ts +19 -27
  415. package/src/queries/movieWatchProviders.ts +26 -23
  416. package/src/queries/network.test.ts +13 -16
  417. package/src/queries/network.ts +20 -23
  418. package/src/queries/networkAlternativeNames.test.ts +16 -18
  419. package/src/queries/networkAlternativeNames.ts +19 -23
  420. package/src/queries/networkLogos.test.ts +14 -15
  421. package/src/queries/networkLogos.ts +13 -20
  422. package/src/queries/person.test.ts +16 -20
  423. package/src/queries/person.ts +20 -21
  424. package/src/queries/personCombinedCredits.test.ts +26 -26
  425. package/src/queries/personCombinedCredits.ts +27 -21
  426. package/src/queries/personExternalIds.test.ts +26 -26
  427. package/src/queries/personExternalIds.ts +27 -21
  428. package/src/queries/personMovieCredits.test.ts +26 -26
  429. package/src/queries/personMovieCredits.ts +27 -21
  430. package/src/queries/personProfiles.test.ts +22 -26
  431. package/src/queries/personProfiles.ts +25 -22
  432. package/src/queries/personTranslations.test.ts +22 -25
  433. package/src/queries/personTranslations.ts +24 -21
  434. package/src/queries/personTvCredits.test.ts +28 -28
  435. package/src/queries/personTvCredits.ts +26 -21
  436. package/src/queries/rated.test.ts +33 -69
  437. package/src/queries/rated.ts +31 -20
  438. package/src/queries/review.test.ts +13 -16
  439. package/src/queries/review.ts +27 -31
  440. package/src/queries/search.test.ts +53 -107
  441. package/src/queries/search.ts +42 -20
  442. package/src/queries/season.test.ts +15 -16
  443. package/src/queries/season.ts +32 -42
  444. package/src/queries/seasonCredits.test.ts +36 -45
  445. package/src/queries/seasonCredits.ts +27 -23
  446. package/src/queries/seasonEpisodeCount.ts +0 -4
  447. package/src/queries/seasonExternalIds.test.ts +25 -28
  448. package/src/queries/seasonExternalIds.ts +32 -22
  449. package/src/queries/seasonPosters.test.ts +25 -30
  450. package/src/queries/seasonPosters.ts +25 -22
  451. package/src/queries/seasonTranslations.test.ts +21 -27
  452. package/src/queries/seasonTranslations.ts +29 -22
  453. package/src/queries/seasonVideos.test.ts +23 -28
  454. package/src/queries/seasonVideos.ts +25 -22
  455. package/src/queries/trending.test.ts +28 -60
  456. package/src/queries/trending.ts +42 -20
  457. package/src/queries/tv.test.ts +16 -20
  458. package/src/queries/tv.ts +26 -34
  459. package/src/queries/tvAlternativeTitles.test.ts +25 -28
  460. package/src/queries/tvAlternativeTitles.ts +25 -22
  461. package/src/queries/tvContentRatings.test.ts +25 -28
  462. package/src/queries/tvContentRatings.ts +24 -22
  463. package/src/queries/tvCredits.test.ts +38 -44
  464. package/src/queries/tvCredits.ts +24 -21
  465. package/src/queries/tvEpisodeGroups.test.ts +25 -28
  466. package/src/queries/tvEpisodeGroups.ts +24 -21
  467. package/src/queries/tvExternalIds.test.ts +25 -28
  468. package/src/queries/tvExternalIds.ts +26 -21
  469. package/src/queries/tvImages.test.ts +36 -46
  470. package/src/queries/tvImages.ts +26 -23
  471. package/src/queries/tvKeywords.test.ts +24 -28
  472. package/src/queries/tvKeywords.ts +24 -21
  473. package/src/queries/tvRecommendations.test.ts +29 -49
  474. package/src/queries/tvRecommendations.ts +28 -22
  475. package/src/queries/tvReviews.test.ts +37 -48
  476. package/src/queries/tvReviews.ts +27 -23
  477. package/src/queries/tvSimilarTvShows.test.ts +37 -48
  478. package/src/queries/tvSimilarTvShows.ts +28 -24
  479. package/src/queries/tvTranslations.test.ts +24 -28
  480. package/src/queries/tvTranslations.ts +24 -21
  481. package/src/queries/tvVideos.test.ts +24 -28
  482. package/src/queries/tvVideos.ts +24 -21
  483. package/src/queries/tvWatchProviders.test.ts +24 -28
  484. package/src/queries/tvWatchProviders.ts +26 -23
  485. package/src/queries/videoType.ts +2 -2
  486. package/src/types.ts +228 -386
@@ -1,28 +1,24 @@
1
- import { GraphQLError, type GraphQLResolveInfo } from 'graphql';
2
1
  import { snakeCase } from 'lodash-es';
3
2
  import { ALTERNATIVE_NAMES, NETWORK } from '../constants.ts';
4
- import { type Context, type RawNetwork, type RawNetworkAlternativeNames } from '../types.ts';
3
+ import { buildObjResolver } from '../helpers/buildObjResolver.ts';
4
+ import { type RawNetwork, type RawNetworkAlternativeNames } from '../types.ts';
5
5
 
6
- export const resolveNetworkAlternativeNames = async (
7
- { id }: RawNetwork,
8
- _args: undefined,
9
- { requestID, restClient, setCacheMetadata, tmdbGuestSessionId }: Context,
10
- { fieldNodes }: GraphQLResolveInfo
11
- ) => {
12
- const { data, errors, headers } = await restClient.network<RawNetworkAlternativeNames>(
13
- {
14
- pathTemplateData: { id, type: snakeCase(ALTERNATIVE_NAMES) },
15
- },
16
- { requestID, tmdbGuestSessionId }
17
- );
6
+ export const resolveNetworkAlternativeNames = buildObjResolver<RawNetwork, RawNetworkAlternativeNames['results']>(
7
+ NETWORK,
8
+ async (obj, ctx) => {
9
+ const { requestID, restClient, tmdbGuestSessionId } = ctx;
18
10
 
19
- if (errors?.length) {
20
- throw new GraphQLError(`Failed to resolve ${NETWORK} ${id} ${ALTERNATIVE_NAMES}.`, {
21
- nodes: fieldNodes,
22
- originalError: errors[0],
23
- });
24
- }
11
+ const { data, errors, headers } = await restClient.network<RawNetworkAlternativeNames>(
12
+ {
13
+ pathTemplateData: { id: obj.id, type: snakeCase(ALTERNATIVE_NAMES) },
14
+ },
15
+ { requestID, tmdbGuestSessionId }
16
+ );
25
17
 
26
- setCacheMetadata(`${NETWORK}.${ALTERNATIVE_NAMES}`, headers);
27
- return data!.results;
28
- };
18
+ return {
19
+ data: data?.results,
20
+ errors,
21
+ headers,
22
+ };
23
+ }
24
+ );
@@ -1,44 +1,43 @@
1
1
  import { jest } from '@jest/globals';
2
- import { NETWORK_PATH, type ShortcutMethodNames } from '@tmdb-graphql-api/rest-client';
2
+ import { NETWORK_PATH } from '@tmdb-graphql-api/rest-client';
3
3
  import networkDetails from '@tmdb-graphql-api/test-utils/responses/themoviedb/network/details.json';
4
4
  import networkLogos from '@tmdb-graphql-api/test-utils/responses/themoviedb/network/images.json';
5
5
  import { mockFetch } from 'fetch-mocked';
6
- import { type Getta, type ShortcutProperties } from 'getta';
7
6
  import { type GraphQLResolveInfo } from 'graphql';
8
7
  import { buildEndpoint } from '../__testUtils__/helpers/buildEndpoint.ts';
8
+ import { createMockLogger } from '../__testUtils__/helpers/createMockLogger.ts';
9
9
  import { createRestClient } from '../__testUtils__/helpers/createRestClient.ts';
10
+ import { IMAGES, LOGOS } from '../constants.ts';
10
11
  import { type Context, type RawNetwork } from '../types.ts';
11
12
  import { resolveNetworkLogos } from './networkLogos.ts';
12
13
 
13
14
  const mockedFetch = mockFetch(jest.fn);
14
15
 
15
16
  describe('resolveNetworkLogos >', () => {
16
- let restClient: Getta & ShortcutProperties<ShortcutMethodNames>;
17
- const setCacheMetadata = jest.fn();
17
+ const context = {
18
+ logger: createMockLogger(jest.fn),
19
+ restClient: createRestClient(),
20
+ setCacheMetadata: jest.fn(),
21
+ tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
22
+ } as unknown as Context;
18
23
 
19
- beforeAll(() => {
20
- restClient = createRestClient();
21
- });
24
+ const info = { fieldName: LOGOS } as GraphQLResolveInfo;
22
25
 
23
26
  beforeEach(() => {
24
- mockedFetch.mockGetOnce(buildEndpoint(NETWORK_PATH, { id: 213, type: 'images' }), {
27
+ mockedFetch.mockGetOnce(buildEndpoint(NETWORK_PATH, { id: 213, type: IMAGES }), {
25
28
  body: networkLogos,
26
29
  });
27
30
  });
28
31
 
29
32
  afterEach(async () => {
30
33
  mockedFetch.mockReset();
31
- await restClient.cache?.clear();
34
+ await context.restClient.cache?.clear();
35
+ jest.clearAllMocks();
32
36
  });
33
37
 
34
38
  it('should return the network logos', async () => {
35
39
  await expect(
36
- resolveNetworkLogos(
37
- networkDetails as unknown as RawNetwork,
38
- undefined,
39
- { restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
40
- {} as GraphQLResolveInfo
41
- )
40
+ resolveNetworkLogos(networkDetails as unknown as RawNetwork, undefined, context, info)
42
41
  ).resolves.toMatchSnapshot();
43
42
  });
44
43
  });
@@ -1,27 +1,20 @@
1
- import { GraphQLError, type GraphQLResolveInfo } from 'graphql';
2
- import { IMAGES, LOGOS, NETWORK } from '../constants.ts';
3
- import { type Context, type RawNetwork, type RawNetworkLogos } from '../types.ts';
1
+ import { IMAGES, NETWORK } from '../constants.ts';
2
+ import { buildObjResolver } from '../helpers/buildObjResolver.ts';
3
+ import { type RawNetwork, type RawNetworkLogos } from '../types.ts';
4
+
5
+ export const resolveNetworkLogos = buildObjResolver<RawNetwork, RawNetworkLogos['logos']>(NETWORK, async (obj, ctx) => {
6
+ const { requestID, restClient, tmdbGuestSessionId } = ctx;
4
7
 
5
- export const resolveNetworkLogos = async (
6
- { id }: RawNetwork,
7
- _args: undefined,
8
- { requestID, restClient, setCacheMetadata, tmdbGuestSessionId }: Context,
9
- { fieldNodes }: GraphQLResolveInfo
10
- ) => {
11
8
  const { data, errors, headers } = await restClient.network<RawNetworkLogos>(
12
9
  {
13
- pathTemplateData: { id, type: IMAGES },
10
+ pathTemplateData: { id: obj.id, type: IMAGES },
14
11
  },
15
12
  { requestID, tmdbGuestSessionId }
16
13
  );
17
14
 
18
- if (errors?.length) {
19
- throw new GraphQLError(`Failed to resolve ${NETWORK} ${id} ${LOGOS}.`, {
20
- nodes: fieldNodes,
21
- originalError: errors[0],
22
- });
23
- }
24
-
25
- setCacheMetadata(`${NETWORK}.${LOGOS}`, headers);
26
- return data!.logos;
27
- };
15
+ return {
16
+ data: data?.logos,
17
+ errors,
18
+ headers,
19
+ };
20
+ });
@@ -9,6 +9,7 @@ import { mockFetch } from 'fetch-mocked';
9
9
  import { type FetchResponse, type Getta, type ShortcutProperties } from 'getta';
10
10
  import { type GraphQLResolveInfo, OperationTypeNode, parse } from 'graphql';
11
11
  import { buildEndpoint } from '../__testUtils__/helpers/buildEndpoint.ts';
12
+ import { createMockLogger } from '../__testUtils__/helpers/createMockLogger.ts';
12
13
  import { createRestClient } from '../__testUtils__/helpers/createRestClient.ts';
13
14
  import { PERSON } from '../constants.ts';
14
15
  import { type Context } from '../types.ts';
@@ -17,13 +18,14 @@ import { resolvePerson } from './person.ts';
17
18
  const mockedFetch = mockFetch(jest.fn);
18
19
 
19
20
  describe('resolvePerson >', () => {
20
- let restClient: Getta & ShortcutProperties<ShortcutMethodNames>;
21
- const setCacheMetadata = jest.fn();
22
21
  const id = 3;
23
22
 
24
- beforeAll(() => {
25
- restClient = createRestClient();
26
- });
23
+ const context = {
24
+ logger: createMockLogger(jest.fn),
25
+ restClient: createRestClient(),
26
+ setCacheMetadata: jest.fn(),
27
+ tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
28
+ } as unknown as Context;
27
29
 
28
30
  beforeEach(() => {
29
31
  mockedFetch.mockGetOnce(buildEndpoint(PERSON_PATH, { id }), {
@@ -33,26 +35,21 @@ describe('resolvePerson >', () => {
33
35
 
34
36
  afterEach(async () => {
35
37
  mockedFetch.mockReset();
36
- await restClient.cache?.clear();
38
+ await context.restClient.cache?.clear();
39
+ jest.clearAllMocks();
37
40
  });
38
41
 
39
42
  it('should return the correct person details', async () => {
40
43
  const operationDefinition = getOperationDefinitions(parse(personDetailsQuery()), OperationTypeNode.QUERY)[0]!;
41
44
  const { fieldNode } = getChildFields(operationDefinition, { name: PERSON })![0]!;
42
-
43
- await expect(
44
- resolvePerson(
45
- undefined,
46
- { id },
47
- { restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
48
- { fieldNodes: [fieldNode] } as unknown as GraphQLResolveInfo
49
- )
50
- ).resolves.toMatchSnapshot();
45
+ const info = { fieldNodes: [fieldNode] } as unknown as GraphQLResolveInfo;
46
+ await expect(resolvePerson(undefined, { id: String(id) }, context, info)).resolves.toMatchSnapshot();
51
47
  });
52
48
 
53
49
  it('should request the correct resources when append to response fields are found', async () => {
54
50
  const operationDefinition = getOperationDefinitions(parse(personDetailsLgQuery()), OperationTypeNode.QUERY)[0]!;
55
51
  const { fieldNode } = getChildFields(operationDefinition, { name: PERSON })![0]!;
52
+ const info = { fieldNodes: [fieldNode] } as unknown as GraphQLResolveInfo;
56
53
 
57
54
  const personFetchMock = jest
58
55
  .fn<(...args: PlainArray) => Promise<FetchResponse>>()
@@ -60,13 +57,12 @@ describe('resolvePerson >', () => {
60
57
 
61
58
  await resolvePerson(
62
59
  undefined,
63
- { id },
60
+ { id: String(id) },
64
61
  {
62
+ ...context,
65
63
  restClient: { person: personFetchMock } as unknown as Getta & ShortcutProperties<ShortcutMethodNames>,
66
- setCacheMetadata,
67
- tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
68
- } as unknown as Context,
69
- { fieldNodes: [fieldNode] } as unknown as GraphQLResolveInfo
64
+ },
65
+ info
70
66
  );
71
67
 
72
68
  expect(personFetchMock.mock.calls[0]![0]).toEqual(
@@ -1,5 +1,4 @@
1
1
  import { type QueryPersonArgs } from '@tmdb-graphql-api/schema/types';
2
- import { GraphQLError, type GraphQLResolveInfo } from 'graphql';
3
2
  import { isUndefined, snakeCase } from 'lodash-es';
4
3
  import {
5
4
  COMBINED_CREDITS,
@@ -11,8 +10,9 @@ import {
11
10
  TRANSLATIONS,
12
11
  TV_CREDITS,
13
12
  } from '../constants.ts';
13
+ import { buildObjArgsResolver } from '../helpers/buildObjArgsResolver.ts';
14
14
  import { getAppendToResponseKeys } from '../helpers/getAppendToResponseKeys.ts';
15
- import { type Context, type RawPerson, type RawPersonWithAppendToResponse } from '../types.ts';
15
+ import { type RawPerson, type RawPersonWithAppendToResponse } from '../types.ts';
16
16
 
17
17
  const appendToResponse = {
18
18
  [COMBINED_CREDITS]: snakeCase(COMBINED_CREDITS),
@@ -23,16 +23,21 @@ const appendToResponse = {
23
23
  [TV_CREDITS]: snakeCase(TV_CREDITS),
24
24
  };
25
25
 
26
- export const resolvePerson = async (
27
- obj: RawPerson | undefined,
28
- args: QueryPersonArgs,
29
- { fragmentDefinitions, requestID, restClient, setCacheMetadata, tmdbGuestSessionId }: Context,
30
- { fieldName, fieldNodes }: GraphQLResolveInfo
31
- ) => {
26
+ export const resolvePerson = buildObjArgsResolver<
27
+ RawPerson,
28
+ QueryPersonArgs,
29
+ | (RawPersonWithAppendToResponse & { __headers?: Headers })
30
+ | RawPersonWithAppendToResponse[keyof RawPersonWithAppendToResponse]
31
+ >(PERSON, async (obj, args, ctx, info) => {
32
+ const { fragmentDefinitions, requestID, restClient, tmdbGuestSessionId } = ctx;
33
+ const { fieldName, fieldNodes } = info;
32
34
  const typedFieldName = snakeCase(fieldName) as keyof RawPerson;
33
35
 
34
36
  if (obj && !isUndefined(obj[typedFieldName])) {
35
- return obj[typedFieldName];
37
+ return {
38
+ data: obj[typedFieldName],
39
+ source: 'parentNode',
40
+ };
36
41
  }
37
42
 
38
43
  const id = obj ? obj.id : args.id;
@@ -52,15 +57,9 @@ export const resolvePerson = async (
52
57
  { requestID, tmdbGuestSessionId }
53
58
  );
54
59
 
55
- if (errors?.length) {
56
- throw new GraphQLError(`Failed to resolve ${PERSON} ${id}.`, { nodes: fieldNodes, originalError: errors[0] });
57
- }
58
-
59
- if (obj) {
60
- setCacheMetadata(`${PERSON}.${fieldName}`, headers);
61
- return data![typedFieldName];
62
- }
63
-
64
- setCacheMetadata(PERSON, headers);
65
- return appendToResponseKeys.length > 0 ? { ...data, __headers: headers } : data;
66
- };
60
+ return {
61
+ data: obj ? data?.[typedFieldName] : appendToResponseKeys.length > 0 ? { ...data, __headers: headers } : data,
62
+ errors,
63
+ headers,
64
+ };
65
+ });
@@ -6,42 +6,42 @@ import personDetails from '@tmdb-graphql-api/test-utils/responses/themoviedb/per
6
6
  import { mockFetch } from 'fetch-mocked';
7
7
  import { type FetchResponse, type Getta, type ShortcutProperties } from 'getta';
8
8
  import { type GraphQLResolveInfo } from 'graphql';
9
+ import { snakeCase } from 'lodash-es';
9
10
  import { buildEndpoint } from '../__testUtils__/helpers/buildEndpoint.ts';
11
+ import { createMockLogger } from '../__testUtils__/helpers/createMockLogger.ts';
10
12
  import { createRestClient } from '../__testUtils__/helpers/createRestClient.ts';
11
- import { type Context, type RawPerson, type RawPersonWithAppendToResponse } from '../types.ts';
13
+ import { COMBINED_CREDITS } from '../constants.ts';
14
+ import { type Context } from '../types.ts';
12
15
  import { resolvePersonCombinedCredits } from './personCombinedCredits.ts';
13
16
 
14
17
  const mockedFetch = mockFetch(jest.fn);
15
18
 
16
19
  describe('resolvePersonCombinedCredits >', () => {
17
- let restClient: Getta & ShortcutProperties<ShortcutMethodNames>;
18
- const setCacheMetadata = jest.fn();
19
20
  const personId = 3;
20
21
 
21
- beforeAll(() => {
22
- restClient = createRestClient();
23
- });
22
+ const context = {
23
+ logger: createMockLogger(jest.fn),
24
+ restClient: createRestClient(),
25
+ setCacheMetadata: jest.fn(),
26
+ tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
27
+ } as unknown as Context;
28
+
29
+ const info = { fieldName: COMBINED_CREDITS } as GraphQLResolveInfo;
24
30
 
25
31
  beforeEach(() => {
26
- mockedFetch.mockGetOnce(buildEndpoint(PERSON_PATH, { id: personId, type: 'combined_credits' }), {
32
+ mockedFetch.mockGetOnce(buildEndpoint(PERSON_PATH, { id: personId, type: snakeCase(COMBINED_CREDITS) }), {
27
33
  body: personCombinedCredits,
28
34
  });
29
35
  });
30
36
 
31
37
  afterEach(async () => {
32
38
  mockedFetch.mockReset();
33
- await restClient.cache?.clear();
39
+ await context.restClient.cache?.clear();
40
+ jest.clearAllMocks();
34
41
  });
35
42
 
36
43
  it('should return the person combined credits', async () => {
37
- await expect(
38
- resolvePersonCombinedCredits(
39
- personDetails as RawPerson,
40
- undefined,
41
- { restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
42
- {} as GraphQLResolveInfo
43
- )
44
- ).resolves.toMatchSnapshot();
44
+ await expect(resolvePersonCombinedCredits(personDetails, undefined, context, info)).resolves.toMatchSnapshot();
45
45
  });
46
46
 
47
47
  describe('when raw person data has combined credits', () => {
@@ -57,15 +57,15 @@ describe('resolvePersonCombinedCredits >', () => {
57
57
  {
58
58
  ...personDetails,
59
59
  __headers: new Headers(),
60
+ // @ts-expect-error minor type mismatch
60
61
  combined_credits: rest,
61
- } as unknown as RawPersonWithAppendToResponse,
62
+ },
62
63
  undefined,
63
64
  {
65
+ ...context,
64
66
  restClient: { person: personFetchMock } as unknown as Getta & ShortcutProperties<ShortcutMethodNames>,
65
- setCacheMetadata,
66
- tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
67
- } as unknown as Context,
68
- {} as GraphQLResolveInfo
67
+ },
68
+ info
69
69
  )
70
70
  ).resolves.toMatchSnapshot();
71
71
  });
@@ -81,15 +81,15 @@ describe('resolvePersonCombinedCredits >', () => {
81
81
  {
82
82
  ...personDetails,
83
83
  __headers: new Headers(),
84
+ // @ts-expect-error minor type mismatch
84
85
  combined_credits: rest,
85
- } as unknown as RawPersonWithAppendToResponse,
86
+ },
86
87
  undefined,
87
88
  {
89
+ ...context,
88
90
  restClient: { person: personFetchMock } as unknown as Getta & ShortcutProperties<ShortcutMethodNames>,
89
- setCacheMetadata,
90
- tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
91
- } as unknown as Context,
92
- {} as GraphQLResolveInfo
91
+ },
92
+ info
93
93
  );
94
94
 
95
95
  expect(personFetchMock).not.toHaveBeenCalled();
@@ -1,17 +1,26 @@
1
- import { GraphQLError, type GraphQLResolveInfo } from 'graphql';
2
1
  import { snakeCase } from 'lodash-es';
2
+ import type { Except } from 'type-fest';
3
3
  import { COMBINED_CREDITS, PERSON } from '../constants.ts';
4
- import { type Context, type RawPersonCombinedCredits, type RawPersonWithAppendToResponse } from '../types.ts';
4
+ import { buildObjResolver } from '../helpers/buildObjResolver.ts';
5
+ import { type RawPerson, type RawPersonCombinedCredits, type RawPersonWithAppendToResponse } from '../types.ts';
5
6
 
6
- export const resolvePersonCombinedCredits = async (
7
- obj: RawPersonWithAppendToResponse & { __headers?: Headers },
8
- _args: undefined,
9
- { requestID, restClient, setCacheMetadata, tmdbGuestSessionId }: Context,
10
- { fieldNodes }: GraphQLResolveInfo
11
- ) => {
12
- if (obj.combined_credits && obj.__headers) {
13
- setCacheMetadata(`${PERSON}.${COMBINED_CREDITS}`, obj.__headers);
14
- return obj.combined_credits;
7
+ const isRawPersonWithCombinedCredits = (
8
+ obj: RawPerson | (RawPersonWithAppendToResponse & { __headers?: Headers })
9
+ ): obj is RawPersonWithAppendToResponse & { __headers: Headers } =>
10
+ snakeCase(COMBINED_CREDITS) in obj && '__headers' in obj;
11
+
12
+ export const resolvePersonCombinedCredits = buildObjResolver<
13
+ RawPerson | (RawPersonWithAppendToResponse & { __headers?: Headers }),
14
+ Except<RawPersonCombinedCredits, 'id'>
15
+ >(PERSON, async (obj, ctx) => {
16
+ const { requestID, restClient, tmdbGuestSessionId } = ctx;
17
+
18
+ if (isRawPersonWithCombinedCredits(obj)) {
19
+ return {
20
+ data: obj.combined_credits,
21
+ headers: obj.__headers,
22
+ source: 'parentNode',
23
+ };
15
24
  }
16
25
 
17
26
  const { data, errors, headers } = await restClient.person<RawPersonCombinedCredits>(
@@ -21,14 +30,11 @@ export const resolvePersonCombinedCredits = async (
21
30
  { requestID, tmdbGuestSessionId }
22
31
  );
23
32
 
24
- if (errors?.length) {
25
- throw new GraphQLError(`Failed to resolve ${PERSON} ${obj.id} ${COMBINED_CREDITS}.`, {
26
- nodes: fieldNodes,
27
- originalError: errors[0],
28
- });
29
- }
33
+ const { id: personId, ...rest } = data ?? {};
30
34
 
31
- setCacheMetadata(`${PERSON}.${COMBINED_CREDITS}`, headers);
32
- const { id: personId, ...rest } = data!;
33
- return rest;
34
- };
35
+ return {
36
+ data: rest,
37
+ errors,
38
+ headers,
39
+ };
40
+ });
@@ -6,42 +6,42 @@ import personExternalIds from '@tmdb-graphql-api/test-utils/responses/themoviedb
6
6
  import { mockFetch } from 'fetch-mocked';
7
7
  import { type FetchResponse, type Getta, type ShortcutProperties } from 'getta';
8
8
  import { type GraphQLResolveInfo } from 'graphql';
9
+ import { snakeCase } from 'lodash-es';
9
10
  import { buildEndpoint } from '../__testUtils__/helpers/buildEndpoint.ts';
11
+ import { createMockLogger } from '../__testUtils__/helpers/createMockLogger.ts';
10
12
  import { createRestClient } from '../__testUtils__/helpers/createRestClient.ts';
11
- import { type Context, type RawPerson, type RawPersonWithAppendToResponse } from '../types.ts';
13
+ import { EXTERNAL_IDS } from '../constants.ts';
14
+ import { type Context } from '../types.ts';
12
15
  import { resolvePersonExternalIds } from './personExternalIds.ts';
13
16
 
14
17
  const mockedFetch = mockFetch(jest.fn);
15
18
 
16
19
  describe('resolvePersonExternalIds >', () => {
17
- let restClient: Getta & ShortcutProperties<ShortcutMethodNames>;
18
- const setCacheMetadata = jest.fn();
19
20
  const personId = 3;
20
21
 
21
- beforeAll(() => {
22
- restClient = createRestClient();
23
- });
22
+ const context = {
23
+ logger: createMockLogger(jest.fn),
24
+ restClient: createRestClient(),
25
+ setCacheMetadata: jest.fn(),
26
+ tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
27
+ } as unknown as Context;
28
+
29
+ const info = { fieldName: EXTERNAL_IDS } as GraphQLResolveInfo;
24
30
 
25
31
  beforeEach(() => {
26
- mockedFetch.mockGetOnce(buildEndpoint(PERSON_PATH, { id: personId, type: 'external_ids' }), {
32
+ mockedFetch.mockGetOnce(buildEndpoint(PERSON_PATH, { id: personId, type: snakeCase(EXTERNAL_IDS) }), {
27
33
  body: personExternalIds,
28
34
  });
29
35
  });
30
36
 
31
37
  afterEach(async () => {
32
38
  mockedFetch.mockReset();
33
- await restClient.cache?.clear();
39
+ await context.restClient.cache?.clear();
40
+ jest.clearAllMocks();
34
41
  });
35
42
 
36
43
  it('should return the person external IDs', async () => {
37
- await expect(
38
- resolvePersonExternalIds(
39
- personDetails as unknown as RawPerson,
40
- undefined,
41
- { restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
42
- {} as GraphQLResolveInfo
43
- )
44
- ).resolves.toMatchSnapshot();
44
+ await expect(resolvePersonExternalIds(personDetails, undefined, context, info)).resolves.toMatchSnapshot();
45
45
  });
46
46
 
47
47
  describe('when raw person data has external IDs', () => {
@@ -57,15 +57,15 @@ describe('resolvePersonExternalIds >', () => {
57
57
  {
58
58
  ...personDetails,
59
59
  __headers: new Headers(),
60
+ // @ts-expect-error minor type mismatch
60
61
  external_ids: rest,
61
- } as unknown as RawPersonWithAppendToResponse,
62
+ },
62
63
  undefined,
63
64
  {
65
+ ...context,
64
66
  restClient: { person: personFetchMock } as unknown as Getta & ShortcutProperties<ShortcutMethodNames>,
65
- setCacheMetadata,
66
- tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
67
- } as unknown as Context,
68
- {} as GraphQLResolveInfo
67
+ },
68
+ info
69
69
  )
70
70
  ).resolves.toMatchSnapshot();
71
71
  });
@@ -81,15 +81,15 @@ describe('resolvePersonExternalIds >', () => {
81
81
  {
82
82
  ...personDetails,
83
83
  __headers: new Headers(),
84
+ // @ts-expect-error minor type mismatch
84
85
  external_ids: rest,
85
- } as unknown as RawPersonWithAppendToResponse,
86
+ },
86
87
  undefined,
87
88
  {
89
+ ...context,
88
90
  restClient: { person: personFetchMock } as unknown as Getta & ShortcutProperties<ShortcutMethodNames>,
89
- setCacheMetadata,
90
- tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
91
- } as unknown as Context,
92
- {} as GraphQLResolveInfo
91
+ },
92
+ info
93
93
  );
94
94
 
95
95
  expect(personFetchMock).not.toHaveBeenCalled();
@@ -1,17 +1,26 @@
1
- import { GraphQLError, type GraphQLResolveInfo } from 'graphql';
2
1
  import { snakeCase } from 'lodash-es';
2
+ import type { Except } from 'type-fest';
3
3
  import { EXTERNAL_IDS, PERSON } from '../constants.ts';
4
- import { type Context, type RawPersonExternalIds, type RawPersonWithAppendToResponse } from '../types.ts';
4
+ import { buildObjResolver } from '../helpers/buildObjResolver.ts';
5
+ import { type RawPerson, type RawPersonExternalIds, type RawPersonWithAppendToResponse } from '../types.ts';
5
6
 
6
- export const resolvePersonExternalIds = async (
7
- obj: RawPersonWithAppendToResponse & { __headers?: Headers },
8
- _args: undefined,
9
- { requestID, restClient, setCacheMetadata, tmdbGuestSessionId }: Context,
10
- { fieldNodes }: GraphQLResolveInfo
11
- ) => {
12
- if (obj.external_ids && obj.__headers) {
13
- setCacheMetadata(`${PERSON}.${EXTERNAL_IDS}`, obj.__headers);
14
- return obj.external_ids;
7
+ const isRawPersonWithExternalIds = (
8
+ obj: RawPerson | (RawPersonWithAppendToResponse & { __headers?: Headers })
9
+ ): obj is RawPersonWithAppendToResponse & { __headers: Headers } =>
10
+ snakeCase(EXTERNAL_IDS) in obj && '__headers' in obj;
11
+
12
+ export const resolvePersonExternalIds = buildObjResolver<
13
+ RawPerson | (RawPersonWithAppendToResponse & { __headers?: Headers }),
14
+ Except<RawPersonExternalIds, 'id'>
15
+ >(PERSON, async (obj, ctx) => {
16
+ const { requestID, restClient, tmdbGuestSessionId } = ctx;
17
+
18
+ if (isRawPersonWithExternalIds(obj)) {
19
+ return {
20
+ data: obj.external_ids,
21
+ headers: obj.__headers,
22
+ source: 'parentNode',
23
+ };
15
24
  }
16
25
 
17
26
  const { data, errors, headers } = await restClient.person<RawPersonExternalIds>(
@@ -21,14 +30,11 @@ export const resolvePersonExternalIds = async (
21
30
  { requestID, tmdbGuestSessionId }
22
31
  );
23
32
 
24
- if (errors?.length) {
25
- throw new GraphQLError(`Failed to resolve ${PERSON} ${obj.id} ${EXTERNAL_IDS}.`, {
26
- nodes: fieldNodes,
27
- originalError: errors[0],
28
- });
29
- }
33
+ const { id: personId, ...rest } = data ?? {};
30
34
 
31
- setCacheMetadata(`${PERSON}.${EXTERNAL_IDS}`, headers);
32
- const { id: personId, ...rest } = data!;
33
- return rest;
34
- };
35
+ return {
36
+ data: rest,
37
+ errors,
38
+ headers,
39
+ };
40
+ });