@tmdb-graphql-api/resolvers 0.0.16 → 0.0.17

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.16",
4
+ "version": "0.0.17",
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.8",
43
- "@tmdb-graphql-api/schema": "0.0.13"
43
+ "@tmdb-graphql-api/schema": "0.0.14"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@babel/runtime": "<8",
@@ -17,8 +17,10 @@ const appendToResponse = {
17
17
  };
18
18
 
19
19
  const enrichEpisodeData = (obj: RawSeason) => {
20
- for (const episode of obj.episodes) {
21
- episode.tv_show_id = obj.tv_show_id;
20
+ if (obj.episodes) {
21
+ for (const episode of obj.episodes) {
22
+ episode.tv_show_id = obj.tv_show_id;
23
+ }
22
24
  }
23
25
  };
24
26
 
@@ -5,5 +5,5 @@ export const resolveSeasonEpisodeCount = (obj: RawSeason) => {
5
5
  return obj.episode_count;
6
6
  }
7
7
 
8
- return obj.episodes.length;
8
+ return obj.episodes?.length ?? 0;
9
9
  };
package/src/types.ts CHANGED
@@ -305,7 +305,7 @@ export type RawMedia = RawMovie | RawTv | RawPerson;
305
305
 
306
306
  export type RawSeason = SnakeCasedPropertiesDeep<
307
307
  Omit<Season, 'cast' | 'crew' | 'externalIds' | 'posters' | 'translations' | 'videos'>
308
- > & { episodes: RawEpisode[]; tv_show_id: Scalars['ID'] };
308
+ > & { episodes?: RawEpisode[]; tv_show_id: Scalars['ID'] };
309
309
 
310
310
  export type RawSeasonCredits = SnakeCasedPropertiesDeep<Pick<Season, 'id' | 'cast' | 'crew'>>;
311
311