@tmdb-graphql-api/resolvers 0.1.2-unstable.1 → 0.1.2-unstable.11

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 (176) 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 +376 -376
  6. package/dist/types/cjs/helpers/buildArgsResolver.d.cts +1 -1
  7. package/dist/types/cjs/helpers/buildArgsResolver.d.cts.map +1 -1
  8. package/dist/types/cjs/helpers/buildNoObjArgsResolver.d.cts.map +1 -1
  9. package/dist/types/cjs/helpers/buildObjArgsResolver.d.cts.map +1 -1
  10. package/dist/types/cjs/helpers/buildObjResolver.d.cts.map +1 -1
  11. package/dist/types/cjs/queries/configuration.d.cts.map +1 -1
  12. package/dist/types/cjs/queries/movieAlternativeTitles.d.cts.map +1 -1
  13. package/dist/types/cjs/queries/movieReviews.d.cts.map +1 -1
  14. package/dist/types/cjs/types.d.cts +6 -5
  15. package/dist/types/cjs/types.d.cts.map +1 -1
  16. package/dist/types/esm/helpers/buildArgsResolver.d.ts +1 -1
  17. package/dist/types/esm/helpers/buildArgsResolver.d.ts.map +1 -1
  18. package/dist/types/esm/helpers/buildNoObjArgsResolver.d.ts.map +1 -1
  19. package/dist/types/esm/helpers/buildObjArgsResolver.d.ts.map +1 -1
  20. package/dist/types/esm/helpers/buildObjResolver.d.ts.map +1 -1
  21. package/dist/types/esm/queries/configuration.d.ts.map +1 -1
  22. package/dist/types/esm/queries/movieAlternativeTitles.d.ts.map +1 -1
  23. package/dist/types/esm/queries/movieReviews.d.ts.map +1 -1
  24. package/dist/types/esm/types.d.ts +6 -5
  25. package/dist/types/esm/types.d.ts.map +1 -1
  26. package/dist/types/tsconfig.build.tsbuildinfo +1 -1
  27. package/package.json +11 -11
  28. package/src/helpers/buildArgsResolver.ts +17 -15
  29. package/src/helpers/buildNoObjArgsResolver.ts +12 -11
  30. package/src/helpers/buildObjArgsResolver.ts +29 -14
  31. package/src/helpers/buildObjResolver.ts +14 -13
  32. package/src/queries/certifications.test.ts +4 -1
  33. package/src/queries/certifications.ts +2 -2
  34. package/src/queries/collection.test.ts +4 -1
  35. package/src/queries/collection.ts +2 -2
  36. package/src/queries/collectionImages.test.ts +4 -1
  37. package/src/queries/collectionImages.ts +2 -2
  38. package/src/queries/collectionTranslations.test.ts +4 -1
  39. package/src/queries/collectionTranslations.ts +2 -2
  40. package/src/queries/company.test.ts +4 -1
  41. package/src/queries/company.ts +2 -2
  42. package/src/queries/companyAlternativeNames.test.ts +4 -1
  43. package/src/queries/companyAlternativeNames.ts +2 -2
  44. package/src/queries/companyLogos.test.ts +4 -1
  45. package/src/queries/companyLogos.ts +2 -2
  46. package/src/queries/configuration.test.ts +4 -1
  47. package/src/queries/configuration.ts +2 -6
  48. package/src/queries/configurationCountries.test.ts +4 -1
  49. package/src/queries/configurationCountries.ts +2 -2
  50. package/src/queries/configurationJobs.test.ts +4 -1
  51. package/src/queries/configurationJobs.ts +2 -2
  52. package/src/queries/configurationLanguages.test.ts +4 -1
  53. package/src/queries/configurationLanguages.ts +2 -2
  54. package/src/queries/configurationPrimaryTranslations.test.ts +4 -1
  55. package/src/queries/configurationPrimaryTranslations.ts +2 -2
  56. package/src/queries/configurationTimezones.test.ts +4 -1
  57. package/src/queries/configurationTimezones.ts +2 -2
  58. package/src/queries/credit.test.ts +4 -1
  59. package/src/queries/credit.ts +2 -2
  60. package/src/queries/discoverMovies.test.ts +9 -3
  61. package/src/queries/discoverMovies.ts +2 -2
  62. package/src/queries/discoverTv.test.ts +9 -3
  63. package/src/queries/discoverTv.ts +2 -2
  64. package/src/queries/episode.test.ts +4 -1
  65. package/src/queries/episode.ts +2 -2
  66. package/src/queries/episodeCredits.test.ts +4 -1
  67. package/src/queries/episodeCredits.ts +2 -2
  68. package/src/queries/episodeExternalIds.test.ts +4 -1
  69. package/src/queries/episodeExternalIds.ts +2 -2
  70. package/src/queries/episodeStills.test.ts +4 -1
  71. package/src/queries/episodeStills.ts +2 -2
  72. package/src/queries/episodeTranslations.test.ts +4 -1
  73. package/src/queries/episodeTranslations.ts +2 -2
  74. package/src/queries/episodeVideos.test.ts +4 -1
  75. package/src/queries/episodeVideos.ts +2 -2
  76. package/src/queries/find.test.ts +4 -1
  77. package/src/queries/find.ts +2 -2
  78. package/src/queries/genres.test.ts +4 -1
  79. package/src/queries/genres.ts +2 -2
  80. package/src/queries/keyword.test.ts +4 -1
  81. package/src/queries/keyword.ts +2 -2
  82. package/src/queries/movie.test.ts +4 -1
  83. package/src/queries/movie.ts +2 -2
  84. package/src/queries/movieAlternativeTitles.test.ts +4 -1
  85. package/src/queries/movieAlternativeTitles.ts +3 -2
  86. package/src/queries/movieCredits.test.ts +4 -1
  87. package/src/queries/movieCredits.ts +2 -2
  88. package/src/queries/movieExternalIds.test.ts +4 -1
  89. package/src/queries/movieExternalIds.ts +2 -2
  90. package/src/queries/movieImages.test.ts +4 -1
  91. package/src/queries/movieImages.ts +2 -2
  92. package/src/queries/movieKeywords.test.ts +4 -1
  93. package/src/queries/movieKeywords.ts +2 -2
  94. package/src/queries/movieRecommendations.test.ts +5 -2
  95. package/src/queries/movieRecommendations.ts +2 -2
  96. package/src/queries/movieReleaseDates.test.ts +4 -1
  97. package/src/queries/movieReleaseDates.ts +2 -2
  98. package/src/queries/movieReviews.test.ts +9 -4
  99. package/src/queries/movieReviews.ts +3 -2
  100. package/src/queries/movieSimilarMovies.test.ts +5 -2
  101. package/src/queries/movieSimilarMovies.ts +2 -2
  102. package/src/queries/movieTranslations.test.ts +4 -1
  103. package/src/queries/movieTranslations.ts +2 -2
  104. package/src/queries/movieVideos.test.ts +4 -1
  105. package/src/queries/movieVideos.ts +2 -2
  106. package/src/queries/movieWatchProviders.test.ts +4 -1
  107. package/src/queries/movieWatchProviders.ts +2 -2
  108. package/src/queries/network.test.ts +4 -1
  109. package/src/queries/network.ts +2 -2
  110. package/src/queries/networkAlternativeNames.test.ts +4 -1
  111. package/src/queries/networkAlternativeNames.ts +2 -2
  112. package/src/queries/networkLogos.test.ts +4 -1
  113. package/src/queries/networkLogos.ts +2 -2
  114. package/src/queries/person.test.ts +4 -1
  115. package/src/queries/person.ts +2 -2
  116. package/src/queries/personCombinedCredits.test.ts +4 -1
  117. package/src/queries/personCombinedCredits.ts +2 -2
  118. package/src/queries/personExternalIds.test.ts +4 -1
  119. package/src/queries/personExternalIds.ts +2 -2
  120. package/src/queries/personMovieCredits.test.ts +4 -1
  121. package/src/queries/personMovieCredits.ts +2 -2
  122. package/src/queries/personProfiles.test.ts +4 -1
  123. package/src/queries/personProfiles.ts +2 -2
  124. package/src/queries/personTranslations.test.ts +4 -1
  125. package/src/queries/personTranslations.ts +2 -2
  126. package/src/queries/personTvCredits.test.ts +4 -1
  127. package/src/queries/personTvCredits.ts +2 -2
  128. package/src/queries/rated.test.ts +7 -4
  129. package/src/queries/rated.ts +3 -3
  130. package/src/queries/review.test.ts +4 -1
  131. package/src/queries/review.ts +2 -2
  132. package/src/queries/search.test.ts +5 -2
  133. package/src/queries/search.ts +2 -2
  134. package/src/queries/season.test.ts +4 -1
  135. package/src/queries/season.ts +2 -2
  136. package/src/queries/seasonCredits.test.ts +4 -1
  137. package/src/queries/seasonCredits.ts +2 -2
  138. package/src/queries/seasonExternalIds.test.ts +4 -1
  139. package/src/queries/seasonExternalIds.ts +2 -2
  140. package/src/queries/seasonPosters.test.ts +4 -1
  141. package/src/queries/seasonPosters.ts +2 -2
  142. package/src/queries/seasonTranslations.test.ts +4 -1
  143. package/src/queries/seasonTranslations.ts +2 -2
  144. package/src/queries/seasonVideos.test.ts +4 -1
  145. package/src/queries/seasonVideos.ts +2 -2
  146. package/src/queries/trending.test.ts +5 -2
  147. package/src/queries/trending.ts +2 -2
  148. package/src/queries/tv.test.ts +4 -1
  149. package/src/queries/tv.ts +2 -2
  150. package/src/queries/tvAlternativeTitles.test.ts +4 -1
  151. package/src/queries/tvAlternativeTitles.ts +2 -2
  152. package/src/queries/tvContentRatings.test.ts +4 -1
  153. package/src/queries/tvContentRatings.ts +2 -2
  154. package/src/queries/tvCredits.test.ts +4 -1
  155. package/src/queries/tvCredits.ts +2 -2
  156. package/src/queries/tvEpisodeGroups.test.ts +4 -1
  157. package/src/queries/tvEpisodeGroups.ts +2 -2
  158. package/src/queries/tvExternalIds.test.ts +4 -1
  159. package/src/queries/tvExternalIds.ts +2 -2
  160. package/src/queries/tvImages.test.ts +4 -1
  161. package/src/queries/tvImages.ts +2 -2
  162. package/src/queries/tvKeywords.test.ts +4 -1
  163. package/src/queries/tvKeywords.ts +2 -2
  164. package/src/queries/tvRecommendations.test.ts +5 -2
  165. package/src/queries/tvRecommendations.ts +2 -2
  166. package/src/queries/tvReviews.test.ts +5 -2
  167. package/src/queries/tvReviews.ts +2 -2
  168. package/src/queries/tvSimilarTvShows.test.ts +5 -2
  169. package/src/queries/tvSimilarTvShows.ts +2 -2
  170. package/src/queries/tvTranslations.test.ts +4 -1
  171. package/src/queries/tvTranslations.ts +2 -2
  172. package/src/queries/tvVideos.test.ts +4 -1
  173. package/src/queries/tvVideos.ts +2 -2
  174. package/src/queries/tvWatchProviders.test.ts +4 -1
  175. package/src/queries/tvWatchProviders.ts +2 -2
  176. package/src/types.ts +4 -5
@@ -20,10 +20,13 @@ describe('resolvePersonTvCredits >', () => {
20
20
  const personId = 3;
21
21
 
22
22
  const context = {
23
+ data: {
24
+ requestID: 'mockRequestID',
25
+ tmdbGuestSessionId: 'mockTmdbGuestSessionId',
26
+ },
23
27
  logger: createMockLogger(jest.fn),
24
28
  restClient: createRestClient(),
25
29
  setCacheMetadata: jest.fn(),
26
- tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
27
30
  } as unknown as Context;
28
31
 
29
32
  const info = { fieldName: TV_CREDITS } as GraphQLResolveInfo;
@@ -12,7 +12,7 @@ export const resolvePersonTvCredits = buildObjResolver<
12
12
  RawPerson | (RawPersonWithAppendToResponse & { __headers?: Headers }),
13
13
  Except<RawPersonTvCredits, 'id'>
14
14
  >(PERSON, async (obj, ctx) => {
15
- const { requestID, restClient, tmdbGuestSessionId } = ctx;
15
+ const { data: ctxData, restClient } = ctx;
16
16
 
17
17
  if (isRawPersonWithTvCredits(obj)) {
18
18
  return {
@@ -26,7 +26,7 @@ export const resolvePersonTvCredits = buildObjResolver<
26
26
  {
27
27
  pathTemplateData: { id: obj.id, type: snakeCase(TV_CREDITS) },
28
28
  },
29
- { requestID, tmdbGuestSessionId }
29
+ ctxData
30
30
  );
31
31
 
32
32
  const { id: personId, ...rest } = data ?? {};
@@ -22,10 +22,13 @@ const baseArgs = {
22
22
  };
23
23
 
24
24
  const context = {
25
+ data: {
26
+ requestID: 'mockRequestID',
27
+ tmdbGuestSessionId: 'mockTmdbGuestSessionId',
28
+ },
25
29
  logger: createMockLogger(jest.fn),
26
30
  restClient: createRestClient(),
27
31
  setCacheMetadata: jest.fn(),
28
- tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
29
32
  } as unknown as Context;
30
33
 
31
34
  const info = {} as GraphQLResolveInfo;
@@ -67,12 +70,12 @@ describe('createResourceResolver', () => {
67
70
 
68
71
  expect(restClient.rated).toHaveBeenCalledWith(
69
72
  {
70
- pathTemplateData: { id: context.tmdbGuestSessionId, type: MOVIE },
73
+ pathTemplateData: { id: context.data.tmdbGuestSessionId, type: MOVIE },
71
74
  queryParams: {
72
75
  page: 1,
73
76
  },
74
77
  },
75
- { requestID: undefined, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' }
78
+ { requestID: 'mockRequestID', tmdbGuestSessionId: 'mockTmdbGuestSessionId' }
76
79
  );
77
80
  });
78
81
  });
@@ -80,7 +83,7 @@ describe('createResourceResolver', () => {
80
83
  describe('resolveRated', () => {
81
84
  const mockEndpoint = ({ screenType }: { screenType: ScreenType }, page: number, body: Jsonifiable) => {
82
85
  mockedFetch.mockGetOnce(
83
- buildEndpoint(RATED_PATH, { id: context.tmdbGuestSessionId, type: screenType.toLowerCase() }, { page }),
86
+ buildEndpoint(RATED_PATH, { id: context.data.tmdbGuestSessionId, type: screenType.toLowerCase() }, { page }),
84
87
  {
85
88
  body,
86
89
  headers: { 'cache-control': 'public, max-age=6000' },
@@ -25,14 +25,14 @@ export const createMakeCursors = (_obj: undefined, args: QueryRatedArgs) => {
25
25
  };
26
26
 
27
27
  export const createResourceResolver: CreateResourceResolver<undefined, QueryRatedArgs, Context, RawRated> =
28
- (_obj, { screenType }: QueryRatedArgs, { requestID, restClient, tmdbGuestSessionId }: Context) =>
28
+ (_obj, { screenType }: QueryRatedArgs, { data: ctxData, restClient }: Context) =>
29
29
  async ({ page }: { page: number }) => {
30
30
  const { data, errors, headers } = await restClient.rated<RawRated>(
31
31
  {
32
- pathTemplateData: { id: tmdbGuestSessionId, type: screenType.toLowerCase() },
32
+ pathTemplateData: { id: ctxData.tmdbGuestSessionId, type: screenType.toLowerCase() },
33
33
  queryParams: { page },
34
34
  },
35
- { requestID, tmdbGuestSessionId }
35
+ ctxData
36
36
  );
37
37
 
38
38
  if (!data) {
@@ -15,10 +15,13 @@ describe('resolveReview >', () => {
15
15
  const id = '58a4ee0ac3a3684ef80000e3';
16
16
 
17
17
  const context = {
18
+ data: {
19
+ requestID: 'mockRequestID',
20
+ tmdbGuestSessionId: 'mockTmdbGuestSessionId',
21
+ },
18
22
  logger: createMockLogger(jest.fn),
19
23
  restClient: createRestClient(),
20
24
  setCacheMetadata: jest.fn(),
21
- tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
22
25
  } as unknown as Context;
23
26
 
24
27
  const info = {} as GraphQLResolveInfo;
@@ -8,7 +8,7 @@ export const resolveReview = buildObjArgsResolver<RawReview, QueryReviewArgs, Ra
8
8
  REVIEW,
9
9
  async (obj, args, ctx, info) => {
10
10
  const id = obj ? obj.id : args.id;
11
- const { requestID, restClient, tmdbGuestSessionId } = ctx;
11
+ const { data: ctxData, restClient } = ctx;
12
12
  const { fieldName } = info;
13
13
  const typedFieldName = snakeCase(fieldName) as keyof RawReview;
14
14
 
@@ -23,7 +23,7 @@ export const resolveReview = buildObjArgsResolver<RawReview, QueryReviewArgs, Ra
23
23
  {
24
24
  pathTemplateData: { id },
25
25
  },
26
- { requestID, tmdbGuestSessionId }
26
+ ctxData
27
27
  );
28
28
 
29
29
  return {
@@ -24,10 +24,13 @@ import { createMakeCursors, createResourceResolver, cursorCache, resolveSearch }
24
24
  const mockedFetch = mockFetch(jest.fn);
25
25
 
26
26
  const context = {
27
+ data: {
28
+ requestID: 'mockRequestID',
29
+ tmdbGuestSessionId: 'mockTmdbGuestSessionId',
30
+ },
27
31
  logger: createMockLogger(jest.fn),
28
32
  restClient: createRestClient(),
29
33
  setCacheMetadata: jest.fn(),
30
- tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
31
34
  } as unknown as Context;
32
35
 
33
36
  const info = {} as GraphQLResolveInfo;
@@ -101,7 +104,7 @@ describe('createResourceResolver', () => {
101
104
  year: 2005,
102
105
  },
103
106
  },
104
- { requestID: undefined, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' }
107
+ { requestID: 'mockRequestID', tmdbGuestSessionId: 'mockTmdbGuestSessionId' }
105
108
  );
106
109
  });
107
110
  });
@@ -28,7 +28,7 @@ export const createMakeCursors = (_obj: undefined, args: QuerySearchArgs) => {
28
28
  export const createResourceResolver: CreateResourceResolver<undefined, QuerySearchArgs, Context, RawSearch> = (
29
29
  _obj,
30
30
  args,
31
- { requestID, restClient, tmdbGuestSessionId }
31
+ { data: ctxData, restClient }
32
32
  ) => {
33
33
  const { searchType, ...rest } = removeConnectionInputOptions(args);
34
34
 
@@ -38,7 +38,7 @@ export const createResourceResolver: CreateResourceResolver<undefined, QuerySear
38
38
  pathTemplateData: { type: (searchType ?? SearchType.Multi).toLowerCase() },
39
39
  queryParams: { ...snakeCasePropNames(rest), page },
40
40
  },
41
- { requestID, tmdbGuestSessionId }
41
+ ctxData
42
42
  );
43
43
 
44
44
  if (!data) {
@@ -22,10 +22,13 @@ describe('resolveSeason >', () => {
22
22
  const id = 1399;
23
23
 
24
24
  const context = {
25
+ data: {
26
+ requestID: 'mockRequestID',
27
+ tmdbGuestSessionId: 'mockTmdbGuestSessionId',
28
+ },
25
29
  logger: createMockLogger(jest.fn),
26
30
  restClient: createRestClient(),
27
31
  setCacheMetadata: jest.fn(),
28
- tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
29
32
  } as unknown as Context;
30
33
 
31
34
  beforeEach(() => {
@@ -22,7 +22,7 @@ export const resolveSeason = buildObjArgsResolver<
22
22
  | (EnrichedRawSeasonWithAppendToResponse & { __headers?: Headers })
23
23
  | EnrichedRawSeasonWithAppendToResponse[keyof EnrichedRawSeasonWithAppendToResponse]
24
24
  >(SEASON, async (obj, args, ctx, info) => {
25
- const { fragmentDefinitions, requestID, restClient, tmdbGuestSessionId } = ctx;
25
+ const { data: ctxData, fragmentDefinitions, restClient } = ctx;
26
26
  const { fieldName, fieldNodes } = info;
27
27
  const typedFieldName = snakeCase(fieldName) as keyof RawSeason;
28
28
  const { id, seasonNumber } = getTvIdSeasonAndEpisode(obj, args);
@@ -47,7 +47,7 @@ export const resolveSeason = buildObjArgsResolver<
47
47
  }
48
48
  : {}),
49
49
  },
50
- { requestID, tmdbGuestSessionId }
50
+ ctxData
51
51
  );
52
52
 
53
53
  const seasonData = {
@@ -18,10 +18,13 @@ describe('resolveSeasonCredits >', () => {
18
18
  const seasonId = 1399;
19
19
 
20
20
  const context = {
21
+ data: {
22
+ requestID: 'mockRequestID',
23
+ tmdbGuestSessionId: 'mockTmdbGuestSessionId',
24
+ },
21
25
  logger: createMockLogger(jest.fn),
22
26
  restClient: createRestClient(),
23
27
  setCacheMetadata: jest.fn(),
24
- tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
25
28
  } as unknown as Context;
26
29
 
27
30
  beforeEach(() => {
@@ -11,7 +11,7 @@ export const resolveSeasonCredits = buildObjResolver<
11
11
  EnrichedRawSeason | (EnrichedRawSeasonWithAppendToResponse & { __headers?: Headers }),
12
12
  RawSeasonCredits['cast'] | RawSeasonCredits['crew']
13
13
  >(SEASON, async (obj, ctx, info) => {
14
- const { requestID, restClient, tmdbGuestSessionId } = ctx;
14
+ const { data: ctxData, restClient } = ctx;
15
15
  const { fieldName } = info;
16
16
  const typedFieldName = snakeCase(fieldName) as 'cast' | 'crew';
17
17
 
@@ -27,7 +27,7 @@ export const resolveSeasonCredits = buildObjResolver<
27
27
  {
28
28
  pathTemplateData: { id: obj.tv_show_id, number: obj.season_number, type: CREDITS },
29
29
  },
30
- { requestID, tmdbGuestSessionId }
30
+ ctxData
31
31
  );
32
32
 
33
33
  return {
@@ -20,10 +20,13 @@ describe('resolveSeasonExternalIds >', () => {
20
20
  const seasonId = 1399;
21
21
 
22
22
  const context = {
23
+ data: {
24
+ requestID: 'mockRequestID',
25
+ tmdbGuestSessionId: 'mockTmdbGuestSessionId',
26
+ },
23
27
  logger: createMockLogger(jest.fn),
24
28
  restClient: createRestClient(),
25
29
  setCacheMetadata: jest.fn(),
26
- tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
27
30
  } as unknown as Context;
28
31
 
29
32
  const info = {} as GraphQLResolveInfo;
@@ -17,7 +17,7 @@ export const resolveSeasonExternalIds = buildObjResolver<
17
17
  EnrichedRawSeason | (EnrichedRawSeasonWithAppendToResponse & { __headers?: Headers }),
18
18
  Except<RawSeasonExternalIds, 'id'>
19
19
  >(SEASON, async (obj, ctx) => {
20
- const { requestID, restClient, tmdbGuestSessionId } = ctx;
20
+ const { data: ctxData, restClient } = ctx;
21
21
 
22
22
  if (isEnrichedRawSeasonWithExternalIds(obj)) {
23
23
  return {
@@ -31,7 +31,7 @@ export const resolveSeasonExternalIds = buildObjResolver<
31
31
  {
32
32
  pathTemplateData: { id: obj.tv_show_id, number: obj.season_number, type: snakeCase(EXTERNAL_IDS) },
33
33
  },
34
- { requestID, tmdbGuestSessionId }
34
+ ctxData
35
35
  );
36
36
 
37
37
  const { id: movieId, ...rest } = data ?? {};
@@ -17,10 +17,13 @@ const mockedFetch = mockFetch(jest.fn);
17
17
 
18
18
  describe('resolveSeasonPosters >', () => {
19
19
  const context = {
20
+ data: {
21
+ requestID: 'mockRequestID',
22
+ tmdbGuestSessionId: 'mockTmdbGuestSessionId',
23
+ },
20
24
  logger: createMockLogger(jest.fn),
21
25
  restClient: createRestClient(),
22
26
  setCacheMetadata: jest.fn(),
23
- tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
24
27
  } as unknown as Context;
25
28
 
26
29
  const info = {} as GraphQLResolveInfo;
@@ -10,7 +10,7 @@ export const resolveSeasonPosters = buildObjResolver<
10
10
  EnrichedRawSeason | (EnrichedRawSeasonWithAppendToResponse & { __headers?: Headers }),
11
11
  RawSeasonPosters['posters']
12
12
  >(SEASON, async (obj, ctx) => {
13
- const { requestID, restClient, tmdbGuestSessionId } = ctx;
13
+ const { data: ctxData, restClient } = ctx;
14
14
 
15
15
  if (isEnrichedRawSeasonWithPosters(obj)) {
16
16
  return {
@@ -24,7 +24,7 @@ export const resolveSeasonPosters = buildObjResolver<
24
24
  {
25
25
  pathTemplateData: { id: obj.tv_show_id, number: obj.season_number, type: IMAGES },
26
26
  },
27
- { requestID, tmdbGuestSessionId }
27
+ ctxData
28
28
  );
29
29
 
30
30
  return {
@@ -16,10 +16,13 @@ const mockedFetch = mockFetch(jest.fn);
16
16
 
17
17
  describe('resolveSeasonTranslations >', () => {
18
18
  const context = {
19
+ data: {
20
+ requestID: 'mockRequestID',
21
+ tmdbGuestSessionId: 'mockTmdbGuestSessionId',
22
+ },
19
23
  logger: createMockLogger(jest.fn),
20
24
  restClient: createRestClient(),
21
25
  setCacheMetadata: jest.fn(),
22
- tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
23
26
  } as unknown as Context;
24
27
 
25
28
  const info = {} as GraphQLResolveInfo;
@@ -14,7 +14,7 @@ export const resolveSeasonTranslations = buildObjResolver<
14
14
  EnrichedRawSeason | (EnrichedRawSeasonWithAppendToResponse & { __headers?: Headers }),
15
15
  RawSeasonTranslations['translations']
16
16
  >(SEASON, async (obj, ctx) => {
17
- const { requestID, restClient, tmdbGuestSessionId } = ctx;
17
+ const { data: ctxData, restClient } = ctx;
18
18
 
19
19
  if (isEnrichedRawSeasonWithTranslations(obj)) {
20
20
  return {
@@ -28,7 +28,7 @@ export const resolveSeasonTranslations = buildObjResolver<
28
28
  {
29
29
  pathTemplateData: { id: obj.tv_show_id, number: obj.season_number, type: TRANSLATIONS },
30
30
  },
31
- { requestID, tmdbGuestSessionId }
31
+ ctxData
32
32
  );
33
33
 
34
34
  return {
@@ -17,10 +17,13 @@ const mockedFetch = mockFetch(jest.fn);
17
17
 
18
18
  describe('resolveSeasonVideos >', () => {
19
19
  const context = {
20
+ data: {
21
+ requestID: 'mockRequestID',
22
+ tmdbGuestSessionId: 'mockTmdbGuestSessionId',
23
+ },
20
24
  logger: createMockLogger(jest.fn),
21
25
  restClient: createRestClient(),
22
26
  setCacheMetadata: jest.fn(),
23
- tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
24
27
  } as unknown as Context;
25
28
 
26
29
  const info = {} as GraphQLResolveInfo;
@@ -10,7 +10,7 @@ export const resolveSeasonVideos = buildObjResolver<
10
10
  EnrichedRawSeason | (EnrichedRawSeasonWithAppendToResponse & { __headers?: Headers }),
11
11
  RawSeasonVideos['results']
12
12
  >(SEASON, async (obj, ctx) => {
13
- const { requestID, restClient, tmdbGuestSessionId } = ctx;
13
+ const { data: ctxData, restClient } = ctx;
14
14
 
15
15
  if (isEnrichedRawSeasonWithVideos(obj)) {
16
16
  return {
@@ -24,7 +24,7 @@ export const resolveSeasonVideos = buildObjResolver<
24
24
  {
25
25
  pathTemplateData: { id: obj.tv_show_id, number: obj.season_number, type: VIDEOS },
26
26
  },
27
- { requestID, tmdbGuestSessionId }
27
+ ctxData
28
28
  );
29
29
 
30
30
  return {
@@ -24,10 +24,13 @@ const baseArgs = {
24
24
  };
25
25
 
26
26
  const context = {
27
+ data: {
28
+ requestID: 'mockRequestID',
29
+ tmdbGuestSessionId: 'mockTmdbGuestSessionId',
30
+ },
27
31
  logger: createMockLogger(jest.fn),
28
32
  restClient: createRestClient(),
29
33
  setCacheMetadata: jest.fn(),
30
- tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
31
34
  } as unknown as Context;
32
35
 
33
36
  const info = {} as GraphQLResolveInfo;
@@ -65,7 +68,7 @@ describe('createResourceResolver', () => {
65
68
  page: 1,
66
69
  },
67
70
  },
68
- { requestID: undefined, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' }
71
+ { requestID: 'mockRequestID', tmdbGuestSessionId: 'mockTmdbGuestSessionId' }
69
72
  );
70
73
  });
71
74
  });
@@ -29,14 +29,14 @@ export const createResourceResolver: CreateResourceResolver<undefined, QueryTren
29
29
  (_obj, args, ctx) =>
30
30
  async ({ page }: { page: number }) => {
31
31
  const { mediaType, timeWindow } = args;
32
- const { requestID, restClient, tmdbGuestSessionId } = ctx;
32
+ const { data: ctxData, restClient } = ctx;
33
33
 
34
34
  const { data, errors, headers } = await restClient.trending<RawTrending>(
35
35
  {
36
36
  pathTemplateData: { subType: timeWindow.toLowerCase(), type: mediaType.toLowerCase() },
37
37
  queryParams: { page },
38
38
  },
39
- { requestID, tmdbGuestSessionId }
39
+ ctxData
40
40
  );
41
41
 
42
42
  if (!data) {
@@ -21,10 +21,13 @@ describe('resolveTv >', () => {
21
21
  const id = 1399;
22
22
 
23
23
  const context = {
24
+ data: {
25
+ requestID: 'mockRequestID',
26
+ tmdbGuestSessionId: 'mockTmdbGuestSessionId',
27
+ },
24
28
  logger: createMockLogger(jest.fn),
25
29
  restClient: createRestClient(),
26
30
  setCacheMetadata: jest.fn(),
27
- tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
28
31
  } as unknown as Context;
29
32
 
30
33
  beforeEach(() => {
package/src/queries/tv.ts CHANGED
@@ -50,7 +50,7 @@ export const resolveTv = buildObjArgsResolver<
50
50
  QueryTvArgs,
51
51
  (RawTvWithAppendToResponse & { __headers?: Headers }) | RawTvWithAppendToResponse[keyof RawTvWithAppendToResponse]
52
52
  >(TV, async (obj, args, ctx, info) => {
53
- const { fragmentDefinitions, requestID, restClient, tmdbGuestSessionId } = ctx;
53
+ const { data: ctxData, fragmentDefinitions, restClient } = ctx;
54
54
  const { fieldName, fieldNodes } = info;
55
55
  const typedFieldName = snakeCase(fieldName) as keyof RawTv;
56
56
 
@@ -75,7 +75,7 @@ export const resolveTv = buildObjArgsResolver<
75
75
  }
76
76
  : {}),
77
77
  },
78
- { requestID, tmdbGuestSessionId }
78
+ ctxData
79
79
  );
80
80
 
81
81
  const tvData = {
@@ -20,10 +20,13 @@ describe('resolveTvAlternativeTitles >', () => {
20
20
  const tvId = 1399;
21
21
 
22
22
  const context = {
23
+ data: {
24
+ requestID: 'mockRequestID',
25
+ tmdbGuestSessionId: 'mockTmdbGuestSessionId',
26
+ },
23
27
  logger: createMockLogger(jest.fn),
24
28
  restClient: createRestClient(),
25
29
  setCacheMetadata: jest.fn(),
26
- tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
27
30
  } as unknown as Context;
28
31
 
29
32
  const info = { fieldName: ALTERNATIVE_TITLES } as GraphQLResolveInfo;
@@ -12,7 +12,7 @@ export const resolveTvAlternativeTitles = buildObjResolver<
12
12
  RawTv | (RawTvWithAppendToResponse & { __headers?: Headers }),
13
13
  RawTvAlternativeTitles['results']
14
14
  >(TV, async (obj, ctx) => {
15
- const { requestID, restClient, tmdbGuestSessionId } = ctx;
15
+ const { data: ctxData, restClient } = ctx;
16
16
 
17
17
  if (isRawTvWithAlternativeTitles(obj)) {
18
18
  return {
@@ -26,7 +26,7 @@ export const resolveTvAlternativeTitles = buildObjResolver<
26
26
  {
27
27
  pathTemplateData: { id: obj.id, type: snakeCase(ALTERNATIVE_TITLES) },
28
28
  },
29
- { requestID, tmdbGuestSessionId }
29
+ ctxData
30
30
  );
31
31
 
32
32
  return {
@@ -20,10 +20,13 @@ describe('resolveTvContentRatings >', () => {
20
20
  const tvId = 1399;
21
21
 
22
22
  const context = {
23
+ data: {
24
+ requestID: 'mockRequestID',
25
+ tmdbGuestSessionId: 'mockTmdbGuestSessionId',
26
+ },
23
27
  logger: createMockLogger(jest.fn),
24
28
  restClient: createRestClient(),
25
29
  setCacheMetadata: jest.fn(),
26
- tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
27
30
  } as unknown as Context;
28
31
 
29
32
  const info = {} as GraphQLResolveInfo;
@@ -11,7 +11,7 @@ export const resolveTvContentRatings = buildObjResolver<
11
11
  RawTv | (RawTvWithAppendToResponse & { __headers?: Headers }),
12
12
  RawTvContentRatings['results']
13
13
  >(TV, async (obj, ctx) => {
14
- const { requestID, restClient, tmdbGuestSessionId } = ctx;
14
+ const { data: ctxData, restClient } = ctx;
15
15
 
16
16
  if (isRawTvWithContentRatings(obj)) {
17
17
  return {
@@ -25,7 +25,7 @@ export const resolveTvContentRatings = buildObjResolver<
25
25
  {
26
26
  pathTemplateData: { id: obj.id, type: snakeCase(CONTENT_RATINGS) },
27
27
  },
28
- { requestID, tmdbGuestSessionId }
28
+ ctxData
29
29
  );
30
30
 
31
31
  return {
@@ -19,10 +19,13 @@ describe('resolveTvCredits >', () => {
19
19
  const tvId = 1399;
20
20
 
21
21
  const context = {
22
+ data: {
23
+ requestID: 'mockRequestID',
24
+ tmdbGuestSessionId: 'mockTmdbGuestSessionId',
25
+ },
22
26
  logger: createMockLogger(jest.fn),
23
27
  restClient: createRestClient(),
24
28
  setCacheMetadata: jest.fn(),
25
- tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
26
29
  } as unknown as Context;
27
30
 
28
31
  beforeEach(() => {
@@ -10,7 +10,7 @@ export const resolveTvCredits = buildObjResolver<
10
10
  RawTv | (RawTvWithAppendToResponse & { __headers?: Headers }),
11
11
  RawTvCredits['cast'] | RawTvCredits['crew']
12
12
  >(TV, async (obj, ctx, info) => {
13
- const { requestID, restClient, tmdbGuestSessionId } = ctx;
13
+ const { data: ctxData, restClient } = ctx;
14
14
  const { fieldName } = info;
15
15
  const typedFieldName = fieldName as 'cast' | 'crew';
16
16
 
@@ -26,7 +26,7 @@ export const resolveTvCredits = buildObjResolver<
26
26
  {
27
27
  pathTemplateData: { id: obj.id, type: CREDITS },
28
28
  },
29
- { requestID, tmdbGuestSessionId }
29
+ ctxData
30
30
  );
31
31
 
32
32
  return {
@@ -20,10 +20,13 @@ describe('resolveTvEpisodeGroups >', () => {
20
20
  const tvId = 1399;
21
21
 
22
22
  const context = {
23
+ data: {
24
+ requestID: 'mockRequestID',
25
+ tmdbGuestSessionId: 'mockTmdbGuestSessionId',
26
+ },
23
27
  logger: createMockLogger(jest.fn),
24
28
  restClient: createRestClient(),
25
29
  setCacheMetadata: jest.fn(),
26
- tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
27
30
  } as unknown as Context;
28
31
 
29
32
  const info = {} as GraphQLResolveInfo;
@@ -11,7 +11,7 @@ export const resolveTvEpisodeGroups = buildObjResolver<
11
11
  RawTv | (RawTvWithAppendToResponse & { __headers?: Headers }),
12
12
  RawTvEpisodeGroups['results']
13
13
  >(TV, async (obj, ctx) => {
14
- const { requestID, restClient, tmdbGuestSessionId } = ctx;
14
+ const { data: ctxData, restClient } = ctx;
15
15
 
16
16
  if (isRawTvWithEpisodeGroups(obj)) {
17
17
  return {
@@ -25,7 +25,7 @@ export const resolveTvEpisodeGroups = buildObjResolver<
25
25
  {
26
26
  pathTemplateData: { id: obj.id, type: snakeCase(EPISODE_GROUPS) },
27
27
  },
28
- { requestID, tmdbGuestSessionId }
28
+ ctxData
29
29
  );
30
30
 
31
31
  return {
@@ -20,10 +20,13 @@ describe('resolveTvExternalIds >', () => {
20
20
  const tvId = 1399;
21
21
 
22
22
  const context = {
23
+ data: {
24
+ requestID: 'mockRequestID',
25
+ tmdbGuestSessionId: 'mockTmdbGuestSessionId',
26
+ },
23
27
  logger: createMockLogger(jest.fn),
24
28
  restClient: createRestClient(),
25
29
  setCacheMetadata: jest.fn(),
26
- tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
27
30
  } as unknown as Context;
28
31
 
29
32
  const info = {} as GraphQLResolveInfo;
@@ -12,7 +12,7 @@ export const resolveTvExternalIds = buildObjResolver<
12
12
  RawTv | (RawTvWithAppendToResponse & { __headers?: Headers }),
13
13
  Except<RawTvExternalIds, 'id'>
14
14
  >(TV, async (obj, ctx) => {
15
- const { requestID, restClient, tmdbGuestSessionId } = ctx;
15
+ const { data: ctxData, restClient } = ctx;
16
16
 
17
17
  if (isRawTvWithExternalIds(obj)) {
18
18
  return {
@@ -26,7 +26,7 @@ export const resolveTvExternalIds = buildObjResolver<
26
26
  {
27
27
  pathTemplateData: { id: obj.id, type: snakeCase(EXTERNAL_IDS) },
28
28
  },
29
- { requestID, tmdbGuestSessionId }
29
+ ctxData
30
30
  );
31
31
 
32
32
  const { id: tvId, ...rest } = data ?? {};
@@ -19,10 +19,13 @@ describe('resolveTvImages >', () => {
19
19
  const tvId = 1399;
20
20
 
21
21
  const context = {
22
+ data: {
23
+ requestID: 'mockRequestID',
24
+ tmdbGuestSessionId: 'mockTmdbGuestSessionId',
25
+ },
22
26
  logger: createMockLogger(jest.fn),
23
27
  restClient: createRestClient(),
24
28
  setCacheMetadata: jest.fn(),
25
- tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
26
29
  } as unknown as Context;
27
30
 
28
31
  beforeEach(() => {