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

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 +364 -364
  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 +10 -10
  28. package/src/helpers/buildArgsResolver.ts +17 -14
  29. package/src/helpers/buildNoObjArgsResolver.ts +10 -8
  30. package/src/helpers/buildObjArgsResolver.ts +11 -9
  31. package/src/helpers/buildObjResolver.ts +12 -9
  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
@@ -10,7 +10,7 @@ export const resolveTvKeywords = buildObjResolver<
10
10
  RawTv | (RawTvWithAppendToResponse & { __headers?: Headers }),
11
11
  RawTvKeywords['results']
12
12
  >(TV, async (obj, ctx) => {
13
- const { requestID, restClient, tmdbGuestSessionId } = ctx;
13
+ const { data: ctxData, restClient } = ctx;
14
14
 
15
15
  if (isRawTvWithKeywords(obj)) {
16
16
  return {
@@ -24,7 +24,7 @@ export const resolveTvKeywords = buildObjResolver<
24
24
  {
25
25
  pathTemplateData: { id: obj.id, type: KEYWORDS },
26
26
  },
27
- { requestID, tmdbGuestSessionId }
27
+ ctxData
28
28
  );
29
29
 
30
30
  return {
@@ -23,10 +23,13 @@ const mockedFetch = mockFetch(jest.fn);
23
23
  const id = 1399;
24
24
 
25
25
  const context = {
26
+ data: {
27
+ requestID: 'mockRequestID',
28
+ tmdbGuestSessionId: 'mockTmdbGuestSessionId',
29
+ },
26
30
  logger: createMockLogger(jest.fn),
27
31
  restClient: createRestClient(),
28
32
  setCacheMetadata: jest.fn(),
29
- tmdbGuestSessionId: 'mock-tmdbGuestSessionId',
30
33
  } as unknown as Context;
31
34
 
32
35
  const info = {} as GraphQLResolveInfo;
@@ -62,7 +65,7 @@ describe('createResourceResolver', () => {
62
65
  pathTemplateData: { id, type: RECOMMENDATIONS },
63
66
  queryParams: { page: 1 },
64
67
  },
65
- { requestID: undefined, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' }
68
+ { requestID: 'mockRequestID', tmdbGuestSessionId: 'mockTmdbGuestSessionId' }
66
69
  );
67
70
  });
68
71
  });
@@ -32,7 +32,7 @@ export const createResourceResolver: CreateResourceResolver<
32
32
  > =
33
33
  (obj, _args, ctx) =>
34
34
  async ({ page }: { page: number }) => {
35
- const { requestID, restClient, tmdbGuestSessionId } = ctx;
35
+ const { data: ctxData, restClient } = ctx;
36
36
 
37
37
  if (isRawTvWithRecommendations(obj, page)) {
38
38
  return {
@@ -46,7 +46,7 @@ export const createResourceResolver: CreateResourceResolver<
46
46
  pathTemplateData: { id: obj.id, type: RECOMMENDATIONS },
47
47
  queryParams: { page },
48
48
  },
49
- { requestID, tmdbGuestSessionId }
49
+ ctxData
50
50
  );
51
51
 
52
52
  return {
@@ -18,10 +18,13 @@ const mockedFetch = mockFetch(jest.fn);
18
18
  const id = 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
  const info = {} as GraphQLResolveInfo;
@@ -66,7 +69,7 @@ describe('createResourceResolver', () => {
66
69
  pathTemplateData: { id, type: REVIEWS },
67
70
  queryParams: { page: 1 },
68
71
  },
69
- { requestID: undefined, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' }
72
+ { requestID: 'mockRequestID', tmdbGuestSessionId: 'mockTmdbGuestSessionId' }
70
73
  );
71
74
  });
72
75
  });
@@ -36,7 +36,7 @@ export const createResourceResolver: CreateResourceResolver<
36
36
  Context,
37
37
  RawTvReviews
38
38
  > =
39
- (obj, _args, { requestID, restClient, tmdbGuestSessionId }) =>
39
+ (obj, _args, { data: ctxData, restClient }) =>
40
40
  async ({ page }: { page: number }) => {
41
41
  if (isRawTvWithReviews(obj, page)) {
42
42
  return {
@@ -50,7 +50,7 @@ export const createResourceResolver: CreateResourceResolver<
50
50
  pathTemplateData: { id: obj.id, type: REVIEWS },
51
51
  queryParams: { page },
52
52
  },
53
- { requestID, tmdbGuestSessionId }
53
+ ctxData
54
54
  );
55
55
 
56
56
  return {
@@ -18,10 +18,13 @@ const mockedFetch = mockFetch(jest.fn);
18
18
  const id = 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
  const info = {} as GraphQLResolveInfo;
@@ -66,7 +69,7 @@ describe('createResourceResolver', () => {
66
69
  pathTemplateData: { id, type: SIMILAR },
67
70
  queryParams: { page: 1 },
68
71
  },
69
- { requestID: undefined, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' }
72
+ { requestID: 'mockRequestID', tmdbGuestSessionId: 'mockTmdbGuestSessionId' }
70
73
  );
71
74
  });
72
75
  });
@@ -30,7 +30,7 @@ export const createResourceResolver: CreateResourceResolver<
30
30
  Context,
31
31
  RawTvSimilarTvShows
32
32
  > =
33
- (obj, _args, { requestID, restClient, tmdbGuestSessionId }) =>
33
+ (obj, _args, { data: ctxData, restClient }) =>
34
34
  async ({ page }: { page: number }) => {
35
35
  if (isRawTvWithSimilarShows(obj, page)) {
36
36
  return {
@@ -44,7 +44,7 @@ export const createResourceResolver: CreateResourceResolver<
44
44
  pathTemplateData: { id: obj.id, type: SIMILAR },
45
45
  queryParams: { page },
46
46
  },
47
- { requestID, tmdbGuestSessionId }
47
+ ctxData
48
48
  );
49
49
 
50
50
  return {
@@ -19,10 +19,13 @@ describe('resolveTvTranslations >', () => {
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
  const info = {} as GraphQLResolveInfo;
@@ -10,7 +10,7 @@ export const resolveTvTranslations = buildObjResolver<
10
10
  RawTv | (RawTvWithAppendToResponse & { __headers?: Headers }),
11
11
  RawTvTranslations['translations']
12
12
  >(TV, async (obj, ctx) => {
13
- const { requestID, restClient, tmdbGuestSessionId } = ctx;
13
+ const { data: ctxData, restClient } = ctx;
14
14
 
15
15
  if (isRawTvWithTranslations(obj)) {
16
16
  return {
@@ -24,7 +24,7 @@ export const resolveTvTranslations = buildObjResolver<
24
24
  {
25
25
  pathTemplateData: { id: obj.id, type: TRANSLATIONS },
26
26
  },
27
- { requestID, tmdbGuestSessionId }
27
+ ctxData
28
28
  );
29
29
 
30
30
  return {
@@ -19,10 +19,13 @@ describe('resolveTvVideos >', () => {
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
  const info = {} as GraphQLResolveInfo;
@@ -10,7 +10,7 @@ export const resolveTvVideos = buildObjResolver<
10
10
  RawTv | (RawTvWithAppendToResponse & { __headers?: Headers }),
11
11
  RawTvVideos['results']
12
12
  >(TV, async (obj, ctx) => {
13
- const { requestID, restClient, tmdbGuestSessionId } = ctx;
13
+ const { data: ctxData, restClient } = ctx;
14
14
 
15
15
  if (isRawTvWithVideos(obj)) {
16
16
  return {
@@ -24,7 +24,7 @@ export const resolveTvVideos = buildObjResolver<
24
24
  {
25
25
  pathTemplateData: { id: obj.id, type: VIDEOS },
26
26
  },
27
- { requestID, tmdbGuestSessionId }
27
+ ctxData
28
28
  );
29
29
 
30
30
  return {
@@ -19,10 +19,13 @@ describe('resolveTvWatchProviders >', () => {
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
  const info = {} as GraphQLResolveInfo;
@@ -10,7 +10,7 @@ export const resolveTvWatchProviders = buildObjResolver<
10
10
  RawTv | (RawTvWithAppendToResponse & { __headers?: Headers }),
11
11
  RawTvWatchProviders['results']
12
12
  >(TV, async (obj, ctx) => {
13
- const { requestID, restClient, tmdbGuestSessionId } = ctx;
13
+ const { data: ctxData, restClient } = ctx;
14
14
 
15
15
  if (isRawTvWithWatchProviders(obj)) {
16
16
  return {
@@ -24,7 +24,7 @@ export const resolveTvWatchProviders = buildObjResolver<
24
24
  {
25
25
  pathTemplateData: { id: obj.id, type: TV },
26
26
  },
27
- { requestID, tmdbGuestSessionId }
27
+ ctxData
28
28
  );
29
29
 
30
30
  return {
package/src/types.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable camelcase */
2
- import { type ExecutionContext } from '@graphql-box/core';
2
+ import { type ExecutionContextValue, type ExecutionContextValueData } from '@graphql-box/core';
3
3
  import { type ShortcutMethodNames } from '@tmdb-graphql-api/rest-client';
4
4
  import {
5
5
  type AlternativeNamesCopyResponses,
@@ -80,13 +80,12 @@ import {
80
80
  import { type Getta, type ShortcutProperties } from 'getta';
81
81
  import { type GraphQLFieldResolver } from 'graphql';
82
82
  import { type Except, type SetRequired } from 'type-fest';
83
- import type { Logger } from 'winston';
83
+ import { type Logger } from 'winston';
84
84
 
85
- export type Context = ExecutionContext & {
85
+ export type Context = ExecutionContextValue & {
86
+ data: ExecutionContextValueData & { tmdbGuestSessionId: string };
86
87
  logger: Logger;
87
- operationName: string;
88
88
  restClient: Getta & ShortcutProperties<ShortcutMethodNames>;
89
- tmdbGuestSessionId: string;
90
89
  };
91
90
 
92
91
  // eslint-disable-next-line @typescript-eslint/no-explicit-any