@tmdb-graphql-api/resolvers 0.0.13 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tmdb-graphql-api/resolvers",
3
3
  "description": "The TMDB GraphQL resolvers module.",
4
- "version": "0.0.13",
4
+ "version": "0.0.15",
5
5
  "author": "Dylan Aubrey",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/badbatch/themoviedb-graphql-api",
@@ -40,7 +40,7 @@
40
40
  "query-string": "^8.1.0",
41
41
  "type-fest": "^4.5.0",
42
42
  "@tmdb-graphql-api/rest-client": "0.0.7",
43
- "@tmdb-graphql-api/schema": "0.0.10"
43
+ "@tmdb-graphql-api/schema": "0.0.12"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@babel/runtime": "<8",
@@ -1,5 +1,6 @@
1
1
  import { jest } from '@jest/globals';
2
2
  import { CERTIFICATIONS_PATH, type ShortcutMethodNames } from '@tmdb-graphql-api/rest-client';
3
+ import { ScreenType } from '@tmdb-graphql-api/schema';
3
4
  import movieCertifications from '@tmdb-graphql-api/test-utils/responses/themoviedb/certifications/movie.json';
4
5
  import tvCertifications from '@tmdb-graphql-api/test-utils/responses/themoviedb/certifications/tv.json';
5
6
  import { mockFetch } from 'fetch-mocked';
@@ -7,7 +8,7 @@ import type { Getta, ShortcutProperties } from 'getta';
7
8
  import type { GraphQLResolveInfo } from 'graphql';
8
9
  import { buildEndpoint } from '../__testUtils__/helpers/buildEndpoint.ts';
9
10
  import { createRestClient } from '../__testUtils__/helpers/createRestClient.ts';
10
- import { type Context, ScreenType } from '../types.ts';
11
+ import { type Context } from '../types.ts';
11
12
  import { resolveCertifications } from './certifications.ts';
12
13
 
13
14
  const mockedFetch = mockFetch(jest.fn);
@@ -27,7 +28,7 @@ describe('resolveCertifications >', () => {
27
28
 
28
29
  describe("when the screenType is 'MOVIE' >", () => {
29
30
  beforeEach(() => {
30
- mockedFetch.mockGetOnce(buildEndpoint(CERTIFICATIONS_PATH, { type: ScreenType.MOVIE.toLowerCase() }), {
31
+ mockedFetch.mockGetOnce(buildEndpoint(CERTIFICATIONS_PATH, { type: ScreenType.Movie.toLowerCase() }), {
31
32
  body: movieCertifications,
32
33
  });
33
34
  });
@@ -36,7 +37,7 @@ describe('resolveCertifications >', () => {
36
37
  await expect(
37
38
  resolveCertifications(
38
39
  undefined,
39
- { screenType: ScreenType.MOVIE },
40
+ { screenType: ScreenType.Movie },
40
41
  { restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
41
42
  {} as GraphQLResolveInfo
42
43
  )
@@ -46,7 +47,7 @@ describe('resolveCertifications >', () => {
46
47
 
47
48
  describe("when the screenType is 'TV' >", () => {
48
49
  beforeEach(() => {
49
- mockedFetch.mockGetOnce(buildEndpoint(CERTIFICATIONS_PATH, { type: ScreenType.TV.toLowerCase() }), {
50
+ mockedFetch.mockGetOnce(buildEndpoint(CERTIFICATIONS_PATH, { type: ScreenType.Tv.toLowerCase() }), {
50
51
  body: tvCertifications,
51
52
  });
52
53
  });
@@ -55,7 +56,7 @@ describe('resolveCertifications >', () => {
55
56
  await expect(
56
57
  resolveCertifications(
57
58
  undefined,
58
- { screenType: ScreenType.TV },
59
+ { screenType: ScreenType.Tv },
59
60
  { restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
60
61
  {} as GraphQLResolveInfo
61
62
  )
@@ -1,13 +1,14 @@
1
1
  import { jest } from '@jest/globals';
2
2
  import { GENRE_PATH, type ShortcutMethodNames } from '@tmdb-graphql-api/rest-client';
3
+ import { ScreenType } from '@tmdb-graphql-api/schema';
3
4
  import movieGenres from '@tmdb-graphql-api/test-utils/responses/themoviedb/genres/movies.json';
4
5
  import tvGenres from '@tmdb-graphql-api/test-utils/responses/themoviedb/genres/tv.json';
5
6
  import { mockFetch } from 'fetch-mocked';
6
- import type { Getta, ShortcutProperties } from 'getta';
7
- import type { GraphQLResolveInfo } from 'graphql';
7
+ import { type Getta, type ShortcutProperties } from 'getta';
8
+ import { type GraphQLResolveInfo } from 'graphql';
8
9
  import { buildEndpoint } from '../__testUtils__/helpers/buildEndpoint.ts';
9
10
  import { createRestClient } from '../__testUtils__/helpers/createRestClient.ts';
10
- import { type Context, ScreenType } from '../types.ts';
11
+ import { type Context } from '../types.ts';
11
12
  import { resolveGenres } from './genres.ts';
12
13
 
13
14
  const mockedFetch = mockFetch(jest.fn);
@@ -27,7 +28,7 @@ describe('resolveGenres >', () => {
27
28
 
28
29
  describe("when the screenType is 'MOVIE' >", () => {
29
30
  beforeEach(() => {
30
- mockedFetch.mockGetOnce(buildEndpoint(GENRE_PATH, { type: ScreenType.MOVIE.toLowerCase() }), {
31
+ mockedFetch.mockGetOnce(buildEndpoint(GENRE_PATH, { type: ScreenType.Movie.toLowerCase() }), {
31
32
  body: movieGenres,
32
33
  });
33
34
  });
@@ -36,7 +37,7 @@ describe('resolveGenres >', () => {
36
37
  await expect(
37
38
  resolveGenres(
38
39
  undefined,
39
- { screenType: ScreenType.MOVIE },
40
+ { screenType: ScreenType.Movie },
40
41
  { restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
41
42
  {} as GraphQLResolveInfo
42
43
  )
@@ -46,7 +47,7 @@ describe('resolveGenres >', () => {
46
47
 
47
48
  describe("when the screenType is 'TV' >", () => {
48
49
  beforeEach(() => {
49
- mockedFetch.mockGetOnce(buildEndpoint(GENRE_PATH, { type: ScreenType.TV.toLowerCase() }), {
50
+ mockedFetch.mockGetOnce(buildEndpoint(GENRE_PATH, { type: ScreenType.Tv.toLowerCase() }), {
50
51
  body: tvGenres,
51
52
  });
52
53
  });
@@ -55,7 +56,7 @@ describe('resolveGenres >', () => {
55
56
  await expect(
56
57
  resolveGenres(
57
58
  undefined,
58
- { screenType: ScreenType.TV },
59
+ { screenType: ScreenType.Tv },
59
60
  { restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
60
61
  {} as GraphQLResolveInfo
61
62
  )
@@ -1,23 +1,24 @@
1
1
  import { removeConnectionInputOptions } from '@graphql-box/connection-resolver';
2
- import type { PlainObject } from '@graphql-box/core';
2
+ import { type PlainObject } from '@graphql-box/core';
3
3
  import { jest } from '@jest/globals';
4
4
  import { RATED_PATH, type ShortcutMethodNames } from '@tmdb-graphql-api/rest-client';
5
+ import { ScreenType } from '@tmdb-graphql-api/schema';
5
6
  import ratedMovies from '@tmdb-graphql-api/test-utils/responses/themoviedb/rated/movies.json';
6
7
  import ratedTv from '@tmdb-graphql-api/test-utils/responses/themoviedb/rated/tv.json';
7
8
  import { type Jsonifiable, mockFetch } from 'fetch-mocked';
8
- import type { Getta, ShortcutProperties } from 'getta';
9
- import type { GraphQLResolveInfo } from 'graphql';
9
+ import { type Getta, type ShortcutProperties } from 'getta';
10
+ import { type GraphQLResolveInfo } from 'graphql';
10
11
  import { decode } from 'js-base64';
11
12
  import { buildEndpoint } from '../__testUtils__/helpers/buildEndpoint.ts';
12
13
  import { createRestClient } from '../__testUtils__/helpers/createRestClient.ts';
13
14
  import { RATED } from '../constants.ts';
14
- import type { Context } from '../types.ts';
15
+ import { type Context } from '../types.ts';
15
16
  import { createMakeCursors, createResourceResolver, cursorCache, resolveRated } from './rated.ts';
16
17
 
17
18
  const mockedFetch = mockFetch(jest.fn);
18
19
 
19
20
  const baseArgs = {
20
- screenType: 'MOVIE' as const,
21
+ screenType: ScreenType.Movie,
21
22
  };
22
23
 
23
24
  describe('createMakeCursors', () => {
@@ -141,7 +142,7 @@ describe('resolveRated', () => {
141
142
  await expect(
142
143
  resolveRated(
143
144
  undefined,
144
- { first: 5, screenType: 'TV' },
145
+ { first: 5, screenType: ScreenType.Tv },
145
146
  { restClient, setCacheMetadata, tmdbGuestSessionId } as unknown as Context,
146
147
  {} as GraphQLResolveInfo
147
148
  )
@@ -158,7 +159,7 @@ describe('resolveRated', () => {
158
159
 
159
160
  await resolveRated(
160
161
  undefined,
161
- { first: 5, screenType: 'TV' },
162
+ { first: 5, screenType: ScreenType.Tv },
162
163
  { restClient, setCacheMetadata, tmdbGuestSessionId } as unknown as Context,
163
164
  {} as GraphQLResolveInfo
164
165
  );
@@ -1,7 +1,7 @@
1
1
  import { removeConnectionInputOptions } from '@graphql-box/connection-resolver';
2
2
  import { jest } from '@jest/globals';
3
3
  import { SEARCH_PATH, type ShortcutMethodNames } from '@tmdb-graphql-api/rest-client';
4
- import type { SearchType } from '@tmdb-graphql-api/schema';
4
+ import { SearchType } from '@tmdb-graphql-api/schema';
5
5
  import searchCollections from '@tmdb-graphql-api/test-utils/responses/themoviedb/search/collections.json';
6
6
  import searchCompanies from '@tmdb-graphql-api/test-utils/responses/themoviedb/search/companies.json';
7
7
  import searchMoviesPage1 from '@tmdb-graphql-api/test-utils/responses/themoviedb/search/movies/page1.json';
@@ -97,7 +97,6 @@ describe('createResourceResolver', () => {
97
97
  describe('resolveSearch > collections', () => {
98
98
  let restClient: Getta & ShortcutProperties<ShortcutMethodNames>;
99
99
  const setCacheMetadata = jest.fn();
100
- const searchType = 'COLLECTION';
101
100
 
102
101
  const args = {
103
102
  query: 'star wars',
@@ -108,10 +107,13 @@ describe('resolveSearch > collections', () => {
108
107
  });
109
108
 
110
109
  beforeEach(() => {
111
- mockedFetch.mockGetOnce(buildEndpoint(SEARCH_PATH, { type: searchType.toLowerCase() }, { ...args, page: 1 }), {
112
- body: searchCollections,
113
- headers: { 'cache-control': 'public, max-age=6000' },
114
- });
110
+ mockedFetch.mockGetOnce(
111
+ buildEndpoint(SEARCH_PATH, { type: SearchType.Collection.toLowerCase() }, { ...args, page: 1 }),
112
+ {
113
+ body: searchCollections,
114
+ headers: { 'cache-control': 'public, max-age=6000' },
115
+ }
116
+ );
115
117
  });
116
118
 
117
119
  afterEach(async () => {
@@ -125,7 +127,7 @@ describe('resolveSearch > collections', () => {
125
127
  await expect(
126
128
  resolveSearch(
127
129
  undefined,
128
- { ...args, first: 5, searchType },
130
+ { ...args, first: 5, searchType: SearchType.Collection },
129
131
  { restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
130
132
  {} as GraphQLResolveInfo
131
133
  )
@@ -137,7 +139,7 @@ describe('resolveSearch > collections', () => {
137
139
  it('should return the correct response', async () => {
138
140
  const { pageInfo } = await resolveSearch(
139
141
  undefined,
140
- { ...args, first: 5, searchType },
142
+ { ...args, first: 5, searchType: SearchType.Collection },
141
143
  { restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
142
144
  {} as GraphQLResolveInfo
143
145
  );
@@ -145,7 +147,7 @@ describe('resolveSearch > collections', () => {
145
147
  await expect(
146
148
  resolveSearch(
147
149
  undefined,
148
- { ...args, after: pageInfo.endCursor, first: 5, searchType },
150
+ { ...args, after: pageInfo.endCursor, first: 5, searchType: SearchType.Collection },
149
151
  { restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
150
152
  {} as GraphQLResolveInfo
151
153
  )
@@ -157,7 +159,6 @@ describe('resolveSearch > collections', () => {
157
159
  describe('resolveSearch > companies', () => {
158
160
  let restClient: Getta & ShortcutProperties<ShortcutMethodNames>;
159
161
  const setCacheMetadata = jest.fn();
160
- const searchType = 'COMPANY';
161
162
 
162
163
  const args = {
163
164
  query: 'orion',
@@ -168,10 +169,13 @@ describe('resolveSearch > companies', () => {
168
169
  });
169
170
 
170
171
  beforeEach(() => {
171
- mockedFetch.mockGetOnce(buildEndpoint(SEARCH_PATH, { type: searchType.toLowerCase() }, { ...args, page: 1 }), {
172
- body: searchCompanies,
173
- headers: { 'cache-control': 'public, max-age=6000' },
174
- });
172
+ mockedFetch.mockGetOnce(
173
+ buildEndpoint(SEARCH_PATH, { type: SearchType.Company.toLowerCase() }, { ...args, page: 1 }),
174
+ {
175
+ body: searchCompanies,
176
+ headers: { 'cache-control': 'public, max-age=6000' },
177
+ }
178
+ );
175
179
  });
176
180
 
177
181
  afterEach(async () => {
@@ -185,7 +189,7 @@ describe('resolveSearch > companies', () => {
185
189
  await expect(
186
190
  resolveSearch(
187
191
  undefined,
188
- { ...args, last: 5, searchType },
192
+ { ...args, last: 5, searchType: SearchType.Company },
189
193
  { restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
190
194
  {} as GraphQLResolveInfo
191
195
  )
@@ -197,7 +201,7 @@ describe('resolveSearch > companies', () => {
197
201
  it('should return the correct response', async () => {
198
202
  const { pageInfo } = await resolveSearch(
199
203
  undefined,
200
- { ...args, last: 5, searchType },
204
+ { ...args, last: 5, searchType: SearchType.Company },
201
205
  { restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
202
206
  {} as GraphQLResolveInfo
203
207
  );
@@ -205,7 +209,7 @@ describe('resolveSearch > companies', () => {
205
209
  await expect(
206
210
  resolveSearch(
207
211
  undefined,
208
- { ...args, before: pageInfo.startCursor, last: 5, searchType },
212
+ { ...args, before: pageInfo.startCursor, last: 5, searchType: SearchType.Company },
209
213
  { restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
210
214
  {} as GraphQLResolveInfo
211
215
  )
@@ -217,7 +221,6 @@ describe('resolveSearch > companies', () => {
217
221
  describe('resolveSearch > movies', () => {
218
222
  let restClient: Getta & ShortcutProperties<ShortcutMethodNames>;
219
223
  const setCacheMetadata = jest.fn();
220
- const searchType = 'MOVIE';
221
224
 
222
225
  const args = {
223
226
  query: 'harry potter',
@@ -228,15 +231,21 @@ describe('resolveSearch > movies', () => {
228
231
  });
229
232
 
230
233
  beforeEach(() => {
231
- mockedFetch.mockGetOnce(buildEndpoint(SEARCH_PATH, { type: searchType.toLowerCase() }, { ...args, page: 1 }), {
232
- body: searchMoviesPage1,
233
- headers: { 'cache-control': 'public, max-age=6000' },
234
- });
234
+ mockedFetch.mockGetOnce(
235
+ buildEndpoint(SEARCH_PATH, { type: SearchType.Movie.toLowerCase() }, { ...args, page: 1 }),
236
+ {
237
+ body: searchMoviesPage1,
238
+ headers: { 'cache-control': 'public, max-age=6000' },
239
+ }
240
+ );
235
241
 
236
- mockedFetch.mockGetOnce(buildEndpoint(SEARCH_PATH, { type: searchType.toLowerCase() }, { ...args, page: 2 }), {
237
- body: searchMoviesPage2,
238
- headers: { 'cache-control': 'public, max-age=6000' },
239
- });
242
+ mockedFetch.mockGetOnce(
243
+ buildEndpoint(SEARCH_PATH, { type: SearchType.Movie.toLowerCase() }, { ...args, page: 2 }),
244
+ {
245
+ body: searchMoviesPage2,
246
+ headers: { 'cache-control': 'public, max-age=6000' },
247
+ }
248
+ );
240
249
  });
241
250
 
242
251
  afterEach(async () => {
@@ -250,7 +259,7 @@ describe('resolveSearch > movies', () => {
250
259
  await expect(
251
260
  resolveSearch(
252
261
  undefined,
253
- { ...args, first: 18, searchType },
262
+ { ...args, first: 18, searchType: SearchType.Movie },
254
263
  { restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
255
264
  {} as GraphQLResolveInfo
256
265
  )
@@ -262,7 +271,7 @@ describe('resolveSearch > movies', () => {
262
271
  it('should return the correct response', async () => {
263
272
  const { pageInfo } = await resolveSearch(
264
273
  undefined,
265
- { ...args, first: 18, searchType },
274
+ { ...args, first: 18, searchType: SearchType.Movie },
266
275
  { restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
267
276
  {} as GraphQLResolveInfo
268
277
  );
@@ -270,7 +279,7 @@ describe('resolveSearch > movies', () => {
270
279
  await expect(
271
280
  resolveSearch(
272
281
  undefined,
273
- { ...args, after: pageInfo.endCursor, first: 18, searchType },
282
+ { ...args, after: pageInfo.endCursor, first: 18, searchType: SearchType.Movie },
274
283
  { restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
275
284
  {} as GraphQLResolveInfo
276
285
  )
@@ -282,7 +291,6 @@ describe('resolveSearch > movies', () => {
282
291
  describe('resolveSearch > multi', () => {
283
292
  let restClient: Getta & ShortcutProperties<ShortcutMethodNames>;
284
293
  const setCacheMetadata = jest.fn();
285
- const searchType = 'MULTI';
286
294
 
287
295
  const args = {
288
296
  query: 'marilyn monroe',
@@ -293,15 +301,21 @@ describe('resolveSearch > multi', () => {
293
301
  });
294
302
 
295
303
  beforeEach(() => {
296
- mockedFetch.mockGetOnce(buildEndpoint(SEARCH_PATH, { type: searchType.toLowerCase() }, { ...args, page: 1 }), {
297
- body: searchMultiPage1,
298
- headers: { 'cache-control': 'public, max-age=6000' },
299
- });
304
+ mockedFetch.mockGetOnce(
305
+ buildEndpoint(SEARCH_PATH, { type: SearchType.Multi.toLowerCase() }, { ...args, page: 1 }),
306
+ {
307
+ body: searchMultiPage1,
308
+ headers: { 'cache-control': 'public, max-age=6000' },
309
+ }
310
+ );
300
311
 
301
- mockedFetch.mockGetOnce(buildEndpoint(SEARCH_PATH, { type: searchType.toLowerCase() }, { ...args, page: 2 }), {
302
- body: searchMultiPage2,
303
- headers: { 'cache-control': 'public, max-age=6000' },
304
- });
312
+ mockedFetch.mockGetOnce(
313
+ buildEndpoint(SEARCH_PATH, { type: SearchType.Multi.toLowerCase() }, { ...args, page: 2 }),
314
+ {
315
+ body: searchMultiPage2,
316
+ headers: { 'cache-control': 'public, max-age=6000' },
317
+ }
318
+ );
305
319
  });
306
320
 
307
321
  afterEach(async () => {
@@ -315,7 +329,7 @@ describe('resolveSearch > multi', () => {
315
329
  await expect(
316
330
  resolveSearch(
317
331
  undefined,
318
- { ...args, last: 5, searchType },
332
+ { ...args, last: 5, searchType: SearchType.Multi },
319
333
  { restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
320
334
  {} as GraphQLResolveInfo
321
335
  )
@@ -327,7 +341,7 @@ describe('resolveSearch > multi', () => {
327
341
  it('should return the correct response', async () => {
328
342
  const { pageInfo } = await resolveSearch(
329
343
  undefined,
330
- { ...args, last: 5, searchType },
344
+ { ...args, last: 5, searchType: SearchType.Multi },
331
345
  { restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
332
346
  {} as GraphQLResolveInfo
333
347
  );
@@ -335,7 +349,7 @@ describe('resolveSearch > multi', () => {
335
349
  await expect(
336
350
  resolveSearch(
337
351
  undefined,
338
- { ...args, before: pageInfo.startCursor, last: 5, searchType },
352
+ { ...args, before: pageInfo.startCursor, last: 5, searchType: SearchType.Multi },
339
353
  { restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
340
354
  {} as GraphQLResolveInfo
341
355
  )
@@ -347,7 +361,6 @@ describe('resolveSearch > multi', () => {
347
361
  describe('resolveSearch > people', () => {
348
362
  let restClient: Getta & ShortcutProperties<ShortcutMethodNames>;
349
363
  const setCacheMetadata = jest.fn();
350
- const searchType = 'PERSON';
351
364
 
352
365
  const args = {
353
366
  query: 'tom cruise',
@@ -358,10 +371,13 @@ describe('resolveSearch > people', () => {
358
371
  });
359
372
 
360
373
  beforeEach(() => {
361
- mockedFetch.mockGetOnce(buildEndpoint(SEARCH_PATH, { type: searchType.toLowerCase() }, { ...args, page: 1 }), {
362
- body: searchPeople,
363
- headers: { 'cache-control': 'public, max-age=6000' },
364
- });
374
+ mockedFetch.mockGetOnce(
375
+ buildEndpoint(SEARCH_PATH, { type: SearchType.Person.toLowerCase() }, { ...args, page: 1 }),
376
+ {
377
+ body: searchPeople,
378
+ headers: { 'cache-control': 'public, max-age=6000' },
379
+ }
380
+ );
365
381
  });
366
382
 
367
383
  afterEach(async () => {
@@ -375,7 +391,7 @@ describe('resolveSearch > people', () => {
375
391
  await expect(
376
392
  resolveSearch(
377
393
  undefined,
378
- { ...args, first: 5, searchType },
394
+ { ...args, first: 5, searchType: SearchType.Person },
379
395
  { restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
380
396
  {} as GraphQLResolveInfo
381
397
  )
@@ -387,7 +403,6 @@ describe('resolveSearch > people', () => {
387
403
  describe('resolveSearch > tv', () => {
388
404
  let restClient: Getta & ShortcutProperties<ShortcutMethodNames>;
389
405
  const setCacheMetadata = jest.fn();
390
- const searchType = 'TV';
391
406
 
392
407
  const args = {
393
408
  query: 'true detective',
@@ -398,7 +413,7 @@ describe('resolveSearch > tv', () => {
398
413
  });
399
414
 
400
415
  beforeEach(() => {
401
- mockedFetch.mockGetOnce(buildEndpoint(SEARCH_PATH, { type: searchType.toLowerCase() }, { ...args, page: 1 }), {
416
+ mockedFetch.mockGetOnce(buildEndpoint(SEARCH_PATH, { type: SearchType.Tv.toLowerCase() }, { ...args, page: 1 }), {
402
417
  body: searchTV,
403
418
  headers: { 'cache-control': 'public, max-age=6000' },
404
419
  });
@@ -415,7 +430,7 @@ describe('resolveSearch > tv', () => {
415
430
  await expect(
416
431
  resolveSearch(
417
432
  undefined,
418
- { ...args, first: 5, searchType },
433
+ { ...args, first: 5, searchType: SearchType.Tv },
419
434
  { restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
420
435
  {} as GraphQLResolveInfo
421
436
  )
@@ -2,7 +2,7 @@ import { removeConnectionInputOptions } from '@graphql-box/connection-resolver';
2
2
  import type { PlainObject } from '@graphql-box/core';
3
3
  import { jest } from '@jest/globals';
4
4
  import { type ShortcutMethodNames, TRENDING_PATH } from '@tmdb-graphql-api/rest-client';
5
- import type { TrendingMediaType, TrendingTimeWindow } from '@tmdb-graphql-api/schema';
5
+ import { TrendingMediaType, TrendingTimeWindow } from '@tmdb-graphql-api/schema';
6
6
  import trendingAllDay from '@tmdb-graphql-api/test-utils/responses/themoviedb/trending/allDay.json';
7
7
  import trendingMovieDay from '@tmdb-graphql-api/test-utils/responses/themoviedb/trending/movieDay.json';
8
8
  import trendingMovieWeek from '@tmdb-graphql-api/test-utils/responses/themoviedb/trending/movieWeek.json';
@@ -146,14 +146,14 @@ describe('resolveTrending', () => {
146
146
 
147
147
  await resolveTrending(
148
148
  undefined,
149
- { ...baseArgs, first: 5, mediaType: 'MOVIE' },
149
+ { ...baseArgs, first: 5, mediaType: TrendingMediaType.Movie },
150
150
  { restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
151
151
  {} as GraphQLResolveInfo
152
152
  );
153
153
 
154
154
  await resolveTrending(
155
155
  undefined,
156
- { ...baseArgs, first: 5, mediaType: 'MOVIE', timeWindow: 'WEEK' },
156
+ { ...baseArgs, first: 5, mediaType: TrendingMediaType.Movie, timeWindow: TrendingTimeWindow.Week },
157
157
  { restClient, setCacheMetadata, tmdbGuestSessionId: 'mock-tmdbGuestSessionId' } as unknown as Context,
158
158
  {} as GraphQLResolveInfo
159
159
  );
package/src/types.ts CHANGED
@@ -1,47 +1,42 @@
1
1
  /* eslint-disable camelcase */
2
- import type { ExecutionContext, PlainObject } from '@graphql-box/core';
3
- import type { ShortcutMethodNames } from '@tmdb-graphql-api/rest-client';
4
- import type {
5
- AlternativeName,
6
- Collection,
7
- Company,
8
- Configuration,
9
- ContentRating,
10
- Credit,
11
- CreditCombinedCast,
12
- CreditCombinedCrew,
13
- CreditMovieCast,
14
- CreditMovieCrew,
15
- CreditTvCast,
16
- CreditTvCrew,
17
- Episode,
18
- EpisodeGroup,
19
- ExternalIds,
20
- Genre,
21
- Keyword,
22
- MediaType,
23
- Movie,
24
- Network,
25
- Person,
26
- RatedMovie,
27
- RatedTvShow,
28
- ReleaseDate,
29
- Review,
30
- Scalars,
31
- SearchType,
32
- Season,
33
- Tv,
34
- Video,
35
- WatchProviderCategories,
2
+ import { type ExecutionContext, type PlainObject } from '@graphql-box/core';
3
+ import { type ShortcutMethodNames } from '@tmdb-graphql-api/rest-client';
4
+ import {
5
+ type AlternativeName,
6
+ type Collection,
7
+ type Company,
8
+ type Configuration,
9
+ type ContentRating,
10
+ type Credit,
11
+ type CreditCombinedCast,
12
+ type CreditCombinedCrew,
13
+ type CreditMovieCast,
14
+ type CreditMovieCrew,
15
+ type CreditTvCast,
16
+ type CreditTvCrew,
17
+ type Episode,
18
+ type EpisodeGroup,
19
+ type ExternalIds,
20
+ type Genre,
21
+ type Keyword,
22
+ type MediaType,
23
+ type Movie,
24
+ type Network,
25
+ type Person,
26
+ type RatedMovie,
27
+ type RatedTvShow,
28
+ type ReleaseDate,
29
+ type Review,
30
+ type Scalars,
31
+ type SearchType,
32
+ type Season,
33
+ type Tv,
34
+ type Video,
35
+ type WatchProviderCategories,
36
36
  } from '@tmdb-graphql-api/schema';
37
- import type { Getta, ShortcutProperties } from 'getta';
38
- import type { GraphQLFieldResolver } from 'graphql';
39
- import type { SnakeCasedPropertiesDeep } from 'type-fest';
40
-
41
- export enum ScreenType {
42
- MOVIE = 'MOVIE',
43
- TV = 'TV',
44
- }
37
+ import { type Getta, type ShortcutProperties } from 'getta';
38
+ import { type GraphQLFieldResolver } from 'graphql';
39
+ import { type SnakeCasedPropertiesDeep } from 'type-fest';
45
40
 
46
41
  export type Context = ExecutionContext & {
47
42
  restClient: Getta & ShortcutProperties<ShortcutMethodNames>;