diff --git a/apps/api/package.json b/apps/api/package.json index 45fb70ca..19b615a7 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -43,6 +43,7 @@ "@sentry/node": "^7.56.0", "@sentry/tracing": "^7.56.0", "@serieslist/logger": "workspace:*", + "@serieslist/tmdb": "workspace:*", "bcryptjs": "^2.4.3", "bullmq": "^4.1.0", "dataloader": "^2.2.2", @@ -82,6 +83,7 @@ "@types/node": "^18.15.3", "@types/pg": "^8.6.6", "@vitest/coverage-v8": "^1.1.1", + "just-filter-object": "^3.2.0", "kysely-codegen": "^0.10.0", "madge": "^6.0.0", "nock": "^13.3.1", diff --git a/apps/api/src/config.ts b/apps/api/src/config.ts index 68abbfdd..441ae129 100644 --- a/apps/api/src/config.ts +++ b/apps/api/src/config.ts @@ -46,11 +46,6 @@ export const config = { url: process.env.APP_URL!, }, - tmdb: { - url: process.env.TMDB_URL!, - apiToken: process.env.TMDB_API_TOKEN!, - }, - sentry: { enabled: process.env.NODE_ENV === 'production', dsn: process.env.API_SENTRY_DSN!, diff --git a/apps/api/src/features/series/__tests__/series.schema.test.ts b/apps/api/src/features/series/__tests__/series.schema.test.ts index 894841d0..6424edbd 100644 --- a/apps/api/src/features/series/__tests__/series.schema.test.ts +++ b/apps/api/src/features/series/__tests__/series.schema.test.ts @@ -1,13 +1,16 @@ +import { + tmdbSeasonFactory, + tmdbEpisodeFactory, + tmdbSeriesDetailsFactory, + mockTMDBDetailsRequest, + mockTMDBSearchRequest, + mockTMDBSeasonRequest, +} from '@serieslist/tmdb' import { type NotWorthIt } from '@serieslist/type-utils' import { parseISO, subDays } from 'date-fns' import { type Selectable } from 'kysely' import { nanoid } from 'nanoid' -import { - tmdbEpisodeFactory, - tmdbSeasonFactory, - tmdbSeriesDetailsFactory, -} from '#/features/tmdb' import { userFactory } from '#/features/users' import { type User } from '#/generated/db' import { graphql } from '#/generated/gql' @@ -26,12 +29,6 @@ import { seasonFactory } from '../season.factory' import { seriesFactory } from '../series.factory' import { userSeriesStatusFactory } from '../userSeriesStatus.factory' -import { - mockTMDbDetailsRequest, - mockTMDbSearchRequest, - mockTMDbSeasonRequest, -} from './scopes' - describe('features/series/series.schema', () => { describe('seriesSearch query', () => { const executeSearch = (keyword = 'testing') => @@ -56,7 +53,7 @@ describe('features/series/series.schema', () => { }) it('searches series from the TMDB API', async () => { - const scope = mockTMDbSearchRequest('testing', { + const scope = mockTMDBSearchRequest('testing', { results: [ tmdbSeriesDetailsFactory.build({ name: 'Testing Series', @@ -84,7 +81,7 @@ describe('features/series/series.schema', () => { it('returns an empty list if the TMDB request fails', async () => { // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - const scope = mockTMDbSearchRequest('testing', { + const scope = mockTMDBSearchRequest('testing', { incorrect: 'response format', } as NotWorthIt) @@ -102,7 +99,7 @@ describe('features/series/series.schema', () => { first_air_date: '2022-04-05', poster_path: 'foo.jpg', }) - mockTMDbSearchRequest('testing', { + mockTMDBSearchRequest('testing', { results: [tmdbSeries], }) @@ -128,7 +125,7 @@ describe('features/series/series.schema', () => { title, }) - mockTMDbSearchRequest('testing', { + mockTMDBSearchRequest('testing', { results: [ tmdbSeriesDetailsFactory.build({ name: title, @@ -196,7 +193,7 @@ describe('features/series/series.schema', () => { syncedAt: null, }) - const scope = mockTMDbDetailsRequest( + const scope = mockTMDBDetailsRequest( series.tmdbId, tmdbSeriesDetailsFactory.build({ id: series.tmdbId, @@ -222,7 +219,7 @@ describe('features/series/series.schema', () => { syncedAt: subDays(new Date(Date.now()), 3), }) - const scope = mockTMDbDetailsRequest( + const scope = mockTMDBDetailsRequest( series.tmdbId, tmdbSeriesDetailsFactory.build(), ) @@ -237,11 +234,10 @@ describe('features/series/series.schema', () => { syncedAt: null, }) - mockTMDbDetailsRequest( + mockTMDBDetailsRequest( series.tmdbId, tmdbSeriesDetailsFactory.build({ id: series.tmdbId, - overview: 'Updated plot', number_of_seasons: 1, seasons: [ tmdbSeasonFactory.build({ @@ -259,7 +255,7 @@ describe('features/series/series.schema', () => { episode_number: 2, name: 'Episode 2', }) - const seriesSeasonScope = mockTMDbSeasonRequest( + const seriesSeasonScope = mockTMDBSeasonRequest( { tmdbId: series.tmdbId, seasonNumber: 1, diff --git a/apps/api/src/features/series/__tests__/series.service.test.ts b/apps/api/src/features/series/__tests__/series.service.test.ts index ca9f7349..a6a43a9e 100644 --- a/apps/api/src/features/series/__tests__/series.service.test.ts +++ b/apps/api/src/features/series/__tests__/series.service.test.ts @@ -1,13 +1,14 @@ +import { + tmdbNotFoundResponseFactory, + tmdbSeasonFactory, + mockTMDBDetailsRequest, + mockTMDBSeasonRequest, +} from '@serieslist/tmdb' import { type LiterallyAnything } from '@serieslist/type-utils' import { format, subDays } from 'date-fns' import { seriesProgressFactory } from '#/features/seriesProgress' -import { - tmdbEpisodeFactory, - tmdbNotFoundResponseFactory, - tmdbSeasonFactory, - tmdbSeriesDetailsFactory, -} from '#/features/tmdb' +import { tmdbEpisodeFactory, tmdbSeriesDetailsFactory } from '#/features/tmdb' import { userFactory } from '#/features/users' import { db } from '#/lib/db' import { @@ -26,8 +27,6 @@ import { syncSeriesDetails, } from '../series.service' -import { mockTMDbDetailsRequest, mockTMDbSeasonRequest } from './scopes' - describe('features/series/series.service', () => { describe('syncSeasonsAndEpisodes', () => { it('imports new episodes into existing seasons', async () => { @@ -41,10 +40,10 @@ describe('features/series/series.service', () => { number: 1, }) - const newTMDbEpisode = tmdbEpisodeFactory.build({ + const newTMDBEpisode = tmdbEpisodeFactory.build({ episode_number: 2, }) - mockTMDbSeasonRequest( + mockTMDBSeasonRequest( { tmdbId: series.tmdbId, seasonNumber: 1, @@ -56,7 +55,7 @@ describe('features/series/series.service', () => { {}, { transient: { savedEpisode: existingEpisode } }, ), - newTMDbEpisode, + newTMDBEpisode, ], }), ) @@ -82,7 +81,7 @@ describe('features/series/series.service', () => { .execute() expect(episodes).toHaveLength(2) expect(episodes[0]?.id).toBe(existingEpisode.id) - expect(episodes[1]?.tmdbId).toBe(newTMDbEpisode.id) + expect(episodes[1]?.tmdbId).toBe(newTMDBEpisode.id) }) it('updates existing episodes', async () => { @@ -105,7 +104,7 @@ describe('features/series/series.service', () => { transient: { savedEpisode: s1e1 }, }, ) - mockTMDbSeasonRequest( + mockTMDBSeasonRequest( { tmdbId: series.tmdbId, seasonNumber: 1, @@ -143,7 +142,7 @@ describe('features/series/series.service', () => { number: 1, }) - mockTMDbSeasonRequest( + mockTMDBSeasonRequest( { tmdbId: series.tmdbId, seasonNumber: 1, @@ -207,10 +206,10 @@ describe('features/series/series.service', () => { nextEpisodeId: null, }) - const newTMDbEpisode = tmdbEpisodeFactory.build({ + const newTMDBEpisode = tmdbEpisodeFactory.build({ episode_number: 2, }) - mockTMDbSeasonRequest( + mockTMDBSeasonRequest( { tmdbId: series.tmdbId, seasonNumber: 1, @@ -219,7 +218,7 @@ describe('features/series/series.service', () => { season_number: 1, episodes: [ tmdbEpisodeFactory.build({}, { transient: { savedEpisode: s1e1 } }), - newTMDbEpisode, + newTMDBEpisode, tmdbEpisodeFactory.build({ episode_number: 3, }), @@ -236,7 +235,7 @@ describe('features/series/series.service', () => { const newEpisode = await db .selectFrom('episode') - .where('tmdbId', '=', newTMDbEpisode.id) + .where('tmdbId', '=', newTMDBEpisode.id) .selectAll() .executeTakeFirstOrThrow() const seriesProgresses = await db @@ -254,7 +253,7 @@ describe('features/series/series.service', () => { seasons: [{ season }], } = await createSeriesWithEpisodesAndSeasons([0]) - mockTMDbSeasonRequest( + mockTMDBSeasonRequest( { tmdbId: series.tmdbId, seasonNumber: season.number }, tmdbNotFoundResponseFactory.build(), ) @@ -279,7 +278,7 @@ describe('features/series/series.service', () => { seasons: [{ season }], } = await createSeriesWithEpisodesAndSeasons([0]) - mockTMDbSeasonRequest( + mockTMDBSeasonRequest( { tmdbId: series.tmdbId, seasonNumber: season.number }, // eslint-disable-next-line @typescript-eslint/no-unsafe-argument { not: 'correct' } as LiterallyAnything, @@ -312,7 +311,7 @@ describe('features/series/series.service', () => { ], } = await createSeriesWithEpisodesAndSeasons([2]) - mockTMDbSeasonRequest( + mockTMDBSeasonRequest( { tmdbId: series.tmdbId, seasonNumber: season.number }, tmdbSeasonFactory.build({ season_number: season.number, @@ -346,7 +345,7 @@ describe('features/series/series.service', () => { it('does not sync seasons if there are none', async () => { const series = await seriesFactory.create() - mockTMDbDetailsRequest( + mockTMDBDetailsRequest( series.tmdbId, tmdbSeriesDetailsFactory.build({ id: series.tmdbId, @@ -364,7 +363,7 @@ describe('features/series/series.service', () => { it('deletes a series if it has been deleted in TMDB', async () => { const series = await seriesFactory.create() - mockTMDbDetailsRequest(series.tmdbId, tmdbNotFoundResponseFactory.build()) + mockTMDBDetailsRequest(series.tmdbId, tmdbNotFoundResponseFactory.build()) const returnedSeries = await syncSeriesDetails({ ctx: createContext(), @@ -385,7 +384,7 @@ describe('features/series/series.service', () => { const series = await seriesFactory.create() // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - mockTMDbDetailsRequest(series.tmdbId, { + mockTMDBDetailsRequest(series.tmdbId, { not: 'correct', } as LiterallyAnything) @@ -427,7 +426,7 @@ describe('features/series/series.service', () => { syncedAt: subDays(new Date(), 8), }) - const scope = mockTMDbDetailsRequest( + const scope = mockTMDBDetailsRequest( series.tmdbId, tmdbSeriesDetailsFactory.build( { @@ -456,7 +455,7 @@ describe('features/series/series.service', () => { syncedAt: null, }) - const scope = mockTMDbDetailsRequest( + const scope = mockTMDBDetailsRequest( series.tmdbId, tmdbSeriesDetailsFactory.build( {}, @@ -474,7 +473,7 @@ describe('features/series/series.service', () => { syncedAt: subDays(new Date(), 6), }) - const scope = mockTMDbDetailsRequest( + const scope = mockTMDBDetailsRequest( series.tmdbId, tmdbSeriesDetailsFactory.build( {}, @@ -493,7 +492,7 @@ describe('features/series/series.service', () => { }) const seriesToSyncScopes = seriesToSync.map((series) => - mockTMDbDetailsRequest( + mockTMDBDetailsRequest( series.tmdbId, tmdbSeriesDetailsFactory.build( {}, diff --git a/apps/api/src/features/series/series.repository.ts b/apps/api/src/features/series/series.repository.ts index c4fbbfa3..b8655e9a 100644 --- a/apps/api/src/features/series/series.repository.ts +++ b/apps/api/src/features/series/series.repository.ts @@ -103,7 +103,7 @@ export const createMany = ({ return ctx.db.insertInto('series').values(series).returningAll().execute() } -export const updateOneByTMDbId = ({ +export const updateOneByTMDBId = ({ ctx, tmdbId, series, diff --git a/apps/api/src/features/series/series.service.ts b/apps/api/src/features/series/series.service.ts index 4cf503ec..0f1bce6c 100644 --- a/apps/api/src/features/series/series.service.ts +++ b/apps/api/src/features/series/series.service.ts @@ -1,10 +1,10 @@ +import { tmdbService } from '@serieslist/tmdb' import { addDays, isFuture, subDays } from 'date-fns' import index from 'just-index' import unique from 'just-unique' import { type Insertable } from 'kysely' import { seriesProgressService } from '#/features/seriesProgress' -import { tmdbService } from '#/features/tmdb' import { type Season } from '#/generated/db' import { type SeriesUpdateStatusInput, @@ -255,7 +255,7 @@ export const syncSeriesDetails = async ({ return null } - const savedSeries = await seriesRepository.updateOneByTMDbId({ + const savedSeries = await seriesRepository.updateOneByTMDBId({ ctx, tmdbId, series: { diff --git a/apps/api/src/features/tmdb/index.ts b/apps/api/src/features/tmdb/index.ts index 07193faf..40012bbb 100644 --- a/apps/api/src/features/tmdb/index.ts +++ b/apps/api/src/features/tmdb/index.ts @@ -1,3 +1 @@ -export * from './types' -export * as tmdbService from './tmdb.service' export * from './tmdbSeriesDetails.factory' diff --git a/apps/api/src/features/tmdb/tmdbSeriesDetails.factory.ts b/apps/api/src/features/tmdb/tmdbSeriesDetails.factory.ts index 89139f3b..403501da 100644 --- a/apps/api/src/features/tmdb/tmdbSeriesDetails.factory.ts +++ b/apps/api/src/features/tmdb/tmdbSeriesDetails.factory.ts @@ -1,70 +1,58 @@ -import { subDays } from 'date-fns' +import { + tmdbSeriesDetailsFactory as baseTmdbSeriesDetailsFactory, + tmdbEpisodeFactory as baseTmdbEpisodeFactory, + type TMDBEpisode, + type TMDBSeries, +} from '@serieslist/tmdb' +import { type NotWorthIt } from '@serieslist/type-utils' import { Factory } from 'fishery' +import filterObject from 'just-filter-object' import { type Selectable } from 'kysely' -import { nanoid } from 'nanoid' -import { type z } from 'zod' import { type Series, type Episode } from '#/generated/db' -import { generateRandomInt } from '#/utils/generateRandomInt' -import { type tmdbNotFoundSchema } from './tmdb.schemas' -import { type TMDbSeason, type TMDbEpisode, type TMDbSeries } from './types' +const removeUndefinedKeys = >(obj: T) => { + return filterObject(obj as NotWorthIt, (_key, value) => value !== undefined) +} type TMDBSeriesDetailsTransientParams = { savedSeries?: Selectable } export const tmdbSeriesDetailsFactory = Factory.define< - TMDbSeries, + TMDBSeries, TMDBSeriesDetailsTransientParams ->(({ transientParams: { savedSeries } }) => ({ - id: savedSeries?.tmdbId ?? generateRandomInt(1, 9999999), - name: savedSeries?.title ?? 'Test Series', - poster_path: savedSeries?.poster ?? 'foo.jpg', - overview: savedSeries?.plot ?? 'Test plot.', - first_air_date: `${savedSeries?.startYear ?? 2023}-05-06`, - - // Details - number_of_seasons: 0, - episode_run_time: [22], - last_air_date: null, - status: 'Returning Series', - seasons: [], - external_ids: { - imdb_id: savedSeries?.imdbId ?? `tt${nanoid(12)}`, - }, -})) +>(({ transientParams: { savedSeries } }) => + baseTmdbSeriesDetailsFactory.build( + removeUndefinedKeys({ + id: savedSeries?.tmdbId, + name: savedSeries?.title, + poster_path: savedSeries?.poster, + overview: savedSeries?.plot ?? undefined, + first_air_date: savedSeries?.startYear + ? `${savedSeries.startYear}-05-06` + : undefined, + external_ids: { + imdb_id: savedSeries?.imdbId, + }, + }), + ), +) type TMDBEpisodeTransientParams = { savedEpisode?: Selectable } export const tmdbEpisodeFactory = Factory.define< - TMDbEpisode, + TMDBEpisode, TMDBEpisodeTransientParams ->(({ sequence, transientParams: { savedEpisode } }) => ({ - id: savedEpisode?.tmdbId ?? generateRandomInt(1, 9999999), - episode_number: savedEpisode?.number ? savedEpisode.number : sequence, - name: savedEpisode?.title ?? 'Test Episode', - air_date: savedEpisode?.releasedAt ?? subDays(new Date(Date.now()), 2), -})) - -export const tmdbSeasonFactory = Factory.define( - ({ sequence, params }) => ({ - id: generateRandomInt(1, 9999999), - season_number: sequence, - name: `Season ${params.season_number ?? sequence}`, - air_date: new Date(Date.now()), - - // Details - episodes: [], - }), +>(({ transientParams: { savedEpisode } }) => + baseTmdbEpisodeFactory.build( + removeUndefinedKeys({ + id: savedEpisode?.tmdbId, + episode_number: savedEpisode?.number, + name: savedEpisode?.title, + air_date: savedEpisode?.releasedAt, + }), + ), ) - -export const tmdbNotFoundResponseFactory = Factory.define< - z.infer ->(() => ({ - status_code: 34, - success: false, - status_message: 'The resource you requested could not be found.', -})) diff --git a/apps/api/src/features/tmdb/types.ts b/apps/api/src/features/tmdb/types.ts deleted file mode 100644 index 1cb455cb..00000000 --- a/apps/api/src/features/tmdb/types.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { type z } from 'zod' - -import { - type tmdbSeriesSchema, - type tmdbSearchSeriesSchema, - type tmdbEpisodeSchema, - type tmdbSeasonSchema, - type tmdbSeriesSearchResponseSchema, - type tmdbSeriesResponseSchema, - type tmdbSeasonResponseSchema, -} from './tmdb.schemas' - -export type TMDbSearchResponse = z.infer - -export type TMDbSearchSeries = z.infer - -export type TMDbSeries = z.infer - -export type TMDbSeriesResponse = z.infer - -export type TMDbSeason = z.infer - -export type TMDbSeasonResponse = z.infer - -export type TMDbEpisode = z.infer diff --git a/apps/api/src/test/mockTMDBServer.ts b/apps/api/src/test/mockTMDBServer.ts index c4928a03..01b2e6cf 100644 --- a/apps/api/src/test/mockTMDBServer.ts +++ b/apps/api/src/test/mockTMDBServer.ts @@ -9,32 +9,32 @@ * Feel free to add more series to be returned here. */ -import fastify from 'fastify' -import omit from 'just-omit' - import { tmdbEpisodeFactory, tmdbSeasonFactory, - type TMDbSeries, + type TMDBSeries, tmdbSeriesDetailsFactory, - type TMDbSeason, - type TMDbEpisode, - type TMDbSearchResponse, -} from '#/features/tmdb' + type TMDBSeason, + type TMDBEpisode, + type TMDBSearchResponse, +} from '@serieslist/tmdb' +import fastify from 'fastify' +import omit from 'just-omit' + import { createArrayOfLength } from '#/lib/createArrayOfLength' const app = fastify({ logger: true, }) -type TMDbSeriesWithFullInfo = Omit & { - seasons: TMDbSeason[] +type TMDBSeriesWithFullInfo = Omit & { + seasons: TMDBSeason[] } export const createSeriesWithEpisodesAndSeasons = ( - series: TMDbSeries, + series: TMDBSeries, seasonEpisodesCount: number[], -): TMDbSeriesWithFullInfo => ({ +): TMDBSeriesWithFullInfo => ({ ...series, number_of_seasons: seasonEpisodesCount.length, seasons: seasonEpisodesCount.map((episodesCount, seasonIndex) => @@ -71,9 +71,9 @@ const futurama = createSeriesWithEpisodesAndSeasons( * Keep track of all the created generated here, in memory. */ const db = { - series: {} as Record, - seasons: {} as Record, - episodes: {} as Record, + series: {} as Record, + seasons: {} as Record, + episodes: {} as Record, } const series = [futurama] @@ -100,7 +100,7 @@ app.get('/', (_res, reply) => { app.get( '/3/search/tv', - async (): Promise => ({ + async (): Promise => ({ page: 1, total_pages: 1, total_results: 1, @@ -114,7 +114,7 @@ app.get<{ } }>( '/3/tv/:seriesId', - async (request): Promise => db.series[request.params.seriesId], + async (request): Promise => db.series[request.params.seriesId], ) app.get<{ @@ -124,7 +124,7 @@ app.get<{ } }>( '/3/tv/:seriesId/season/:seasonNumber', - async (request): Promise => { + async (request): Promise => { const { seriesId, seasonNumber } = request.params const season = db.series[seriesId].seasons.find( (season) => season.season_number === parseInt(seasonNumber), diff --git a/apps/webapp/src/generated/gql/fragment-masking.ts b/apps/webapp/src/generated/gql/fragment-masking.ts index c000279a..b6915f8d 100644 --- a/apps/webapp/src/generated/gql/fragment-masking.ts +++ b/apps/webapp/src/generated/gql/fragment-masking.ts @@ -1,66 +1,85 @@ -import type { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; -import type { FragmentDefinitionNode } from 'graphql'; -import type { Incremental } from './graphql'; +import type { + ResultOf, + DocumentTypeDecoration, + TypedDocumentNode, +} from '@graphql-typed-document-node/core' +import type { FragmentDefinitionNode } from 'graphql' +import type { Incremental } from './graphql' - -export type FragmentType> = TDocumentType extends DocumentTypeDecoration< - infer TType, - any -> +export type FragmentType< + TDocumentType extends DocumentTypeDecoration, +> = TDocumentType extends DocumentTypeDecoration ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never : never - : never; + : never // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType> -): TType; + fragmentType: FragmentType>, +): TType // return nullable if `fragmentType` is nullable export function useFragment( _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType> | null | undefined -): TType | null | undefined; + fragmentType: + | FragmentType> + | null + | undefined, +): TType | null | undefined // return array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, - fragmentType: ReadonlyArray>> -): ReadonlyArray; + fragmentType: ReadonlyArray>>, +): ReadonlyArray // return array of nullable if `fragmentType` is array of nullable export function useFragment( _documentNode: DocumentTypeDecoration, - fragmentType: ReadonlyArray>> | null | undefined -): ReadonlyArray | null | undefined; + fragmentType: + | ReadonlyArray>> + | null + | undefined, +): ReadonlyArray | null | undefined export function useFragment( _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType> | ReadonlyArray>> | null | undefined + fragmentType: + | FragmentType> + | ReadonlyArray>> + | null + | undefined, ): TType | ReadonlyArray | null | undefined { - return fragmentType as any; + return fragmentType as any } - export function makeFragmentData< F extends DocumentTypeDecoration, - FT extends ResultOf + FT extends ResultOf, >(data: FT, _fragment: F): FragmentType { - return data as FragmentType; + return data as FragmentType } export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: FragmentType, any>> | null | undefined + data: + | FragmentType, any>> + | null + | undefined, ): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ - ?.deferredFields; + const deferredFields = ( + queryNode as { + __meta__?: { deferredFields: Record } + } + ).__meta__?.deferredFields - if (!deferredFields) return true; + if (!deferredFields) return true - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; + const fragDef = fragmentNode.definitions[0] as + | FragmentDefinitionNode + | undefined + const fragName = fragDef?.name?.value - const fields = (fragName && deferredFields[fragName]) || []; - return fields.length > 0 && fields.every(field => data && field in data); + const fields = (fragName && deferredFields[fragName]) || [] + return fields.length > 0 && fields.every((field) => data && field in data) } diff --git a/apps/webapp/src/generated/gql/gql.ts b/apps/webapp/src/generated/gql/gql.ts index 0361a294..a1646142 100644 --- a/apps/webapp/src/generated/gql/gql.ts +++ b/apps/webapp/src/generated/gql/gql.ts @@ -1,6 +1,6 @@ /* eslint-disable */ -import * as types from './graphql'; -import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core'; +import * as types from './graphql' +import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core' /** * Map of all GraphQL operations in the project. @@ -13,25 +13,43 @@ import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document- * Therefore it is highly recommended to use the babel or swc plugin for production. */ const documents = { - "\n mutation login($input: LoginInput!) {\n login(input: $input) {\n __typename\n ... on User {\n id\n email\n }\n ... on InvalidInputError {\n fieldErrors {\n path\n message\n }\n message\n }\n }\n }\n ": types.LoginDocument, - "\n mutation register($input: RegisterInput!) {\n register(input: $input) {\n __typename\n ... on User {\n id\n email\n }\n ... on InvalidInputError {\n fieldErrors {\n path\n message\n }\n message\n }\n }\n }\n ": types.RegisterDocument, - "\n query currentUser {\n me {\n __typename\n ... on User {\n id\n email\n name\n }\n }\n }\n ": types.CurrentUserDocument, - "\n mutation logOut {\n logOut\n }\n ": types.LogOutDocument, - "\n query search($input: SeriesSearchInput!) {\n seriesSearch(input: $input) {\n id\n imdbId\n title\n startYear\n endYear\n ...SeriesPoster_SeriesFragment\n }\n }\n": types.SearchDocument, - "\n fragment EpisodeLine_EpisodeFragment on Episode {\n id\n number\n title\n isSeen\n releasedAt\n }\n": types.EpisodeLine_EpisodeFragmentFragmentDoc, - "\n fragment EpisodeLine_SeasonFragment on Season {\n number\n }\n": types.EpisodeLine_SeasonFragmentFragmentDoc, - "\n mutation toggleEpisodeSeen($input: ToggleEpisodeSeenInput!) {\n toggleEpisodeSeen(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on Episode {\n id\n isSeen\n season {\n id\n series {\n id\n ...LatestSeenEpisodeCell_SeriesFragment\n }\n }\n }\n }\n }\n ": types.ToggleEpisodeSeenDocument, - "\n query seriesDetailsPage($id: ID!) {\n series(id: $id) {\n __typename\n ... on NotFoundError {\n message\n }\n ... on Series {\n id\n imdbId\n title\n startYear\n endYear\n plot\n ...SeriesPoster_SeriesFragment\n ...SeriesStatusSelect_SeriesFragment\n seasons {\n id\n number\n title\n episodes {\n id\n isSeen\n releasedAt\n ...EpisodeLine_EpisodeFragment\n }\n ...EpisodeLine_SeasonFragment\n }\n }\n }\n }\n ": types.SeriesDetailsPageDocument, - "\n mutation markSeasonEpisodesAsSeen(\n $input: MarkSeasonEpisodesAsSeenInput!\n ) {\n markSeasonEpisodesAsSeen(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on Season {\n id\n episodes {\n id\n isSeen\n }\n series {\n id\n ...LatestSeenEpisodeCell_SeriesFragment\n }\n }\n }\n }\n ": types.MarkSeasonEpisodesAsSeenDocument, - "\n fragment LatestSeenEpisodeCell_SeriesFragment on Series {\n latestSeenEpisode {\n id\n number\n season {\n id\n number\n }\n }\n nextEpisode {\n id\n }\n }\n": types.LatestSeenEpisodeCell_SeriesFragmentFragmentDoc, - "\n mutation LatestSeenEpisodeToggleEpisodeSeen(\n $input: ToggleEpisodeSeenInput!\n ) {\n toggleEpisodeSeen(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on Episode {\n id\n isSeen\n season {\n id\n series {\n id\n ...LatestSeenEpisodeCell_SeriesFragment\n }\n }\n }\n }\n }\n ": types.LatestSeenEpisodeToggleEpisodeSeenDocument, - "\n fragment SeriesRow_SeriesFragment on Series {\n id\n title\n ...SeriesPoster_SeriesFragment\n ...LatestSeenEpisodeCell_SeriesFragment\n }\n": types.SeriesRow_SeriesFragmentFragmentDoc, - "\n query seriesList($input: UserSeriesListInput!) {\n userSeriesList(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on QueryUserSeriesListSuccess {\n data {\n id\n nextEpisode {\n id\n }\n ...SeriesRow_SeriesFragment\n }\n }\n }\n }\n ": types.SeriesListDocument, - "\n fragment SeriesPoster_SeriesFragment on Series {\n poster\n title\n }\n": types.SeriesPoster_SeriesFragmentFragmentDoc, - "\n fragment SeriesStatusSelect_SeriesFragment on Series {\n id\n status\n }\n": types.SeriesStatusSelect_SeriesFragmentFragmentDoc, - "\n mutation seriesUpdateStatus($input: SeriesUpdateStatusInput!) {\n seriesUpdateStatus(input: $input) {\n __typename\n ... on Series {\n id\n status\n }\n }\n }\n ": types.SeriesUpdateStatusDocument, - "\n mutation markSeriesEpisodesAsSeen(\n $input: MarkSeriesEpisodesAsSeenInput!\n ) {\n markSeriesEpisodesAsSeen(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on Series {\n id\n ...LatestSeenEpisodeCell_SeriesFragment\n seasons {\n id\n episodes {\n id\n isSeen\n }\n }\n }\n }\n }\n ": types.MarkSeriesEpisodesAsSeenDocument, -}; + '\n mutation login($input: LoginInput!) {\n login(input: $input) {\n __typename\n ... on User {\n id\n email\n }\n ... on InvalidInputError {\n fieldErrors {\n path\n message\n }\n message\n }\n }\n }\n ': + types.LoginDocument, + '\n mutation register($input: RegisterInput!) {\n register(input: $input) {\n __typename\n ... on User {\n id\n email\n }\n ... on InvalidInputError {\n fieldErrors {\n path\n message\n }\n message\n }\n }\n }\n ': + types.RegisterDocument, + '\n query currentUser {\n me {\n __typename\n ... on User {\n id\n email\n name\n }\n }\n }\n ': + types.CurrentUserDocument, + '\n mutation logOut {\n logOut\n }\n ': + types.LogOutDocument, + '\n query search($input: SeriesSearchInput!) {\n seriesSearch(input: $input) {\n id\n imdbId\n title\n startYear\n endYear\n ...SeriesPoster_SeriesFragment\n }\n }\n': + types.SearchDocument, + '\n fragment EpisodeLine_EpisodeFragment on Episode {\n id\n number\n title\n isSeen\n releasedAt\n }\n': + types.EpisodeLine_EpisodeFragmentFragmentDoc, + '\n fragment EpisodeLine_SeasonFragment on Season {\n number\n }\n': + types.EpisodeLine_SeasonFragmentFragmentDoc, + '\n mutation toggleEpisodeSeen($input: ToggleEpisodeSeenInput!) {\n toggleEpisodeSeen(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on Episode {\n id\n isSeen\n season {\n id\n series {\n id\n ...LatestSeenEpisodeCell_SeriesFragment\n }\n }\n }\n }\n }\n ': + types.ToggleEpisodeSeenDocument, + '\n query seriesDetailsPage($id: ID!) {\n series(id: $id) {\n __typename\n ... on NotFoundError {\n message\n }\n ... on Series {\n id\n imdbId\n title\n startYear\n endYear\n plot\n ...SeriesPoster_SeriesFragment\n ...SeriesStatusSelect_SeriesFragment\n seasons {\n id\n number\n title\n episodes {\n id\n isSeen\n releasedAt\n ...EpisodeLine_EpisodeFragment\n }\n ...EpisodeLine_SeasonFragment\n }\n }\n }\n }\n ': + types.SeriesDetailsPageDocument, + '\n mutation markSeasonEpisodesAsSeen(\n $input: MarkSeasonEpisodesAsSeenInput!\n ) {\n markSeasonEpisodesAsSeen(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on Season {\n id\n episodes {\n id\n isSeen\n }\n series {\n id\n ...LatestSeenEpisodeCell_SeriesFragment\n }\n }\n }\n }\n ': + types.MarkSeasonEpisodesAsSeenDocument, + '\n fragment LatestSeenEpisodeCell_SeriesFragment on Series {\n latestSeenEpisode {\n id\n number\n season {\n id\n number\n }\n }\n nextEpisode {\n id\n }\n }\n': + types.LatestSeenEpisodeCell_SeriesFragmentFragmentDoc, + '\n mutation LatestSeenEpisodeToggleEpisodeSeen(\n $input: ToggleEpisodeSeenInput!\n ) {\n toggleEpisodeSeen(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on Episode {\n id\n isSeen\n season {\n id\n series {\n id\n ...LatestSeenEpisodeCell_SeriesFragment\n }\n }\n }\n }\n }\n ': + types.LatestSeenEpisodeToggleEpisodeSeenDocument, + '\n fragment SeriesRow_SeriesFragment on Series {\n id\n title\n ...SeriesPoster_SeriesFragment\n ...LatestSeenEpisodeCell_SeriesFragment\n }\n': + types.SeriesRow_SeriesFragmentFragmentDoc, + '\n query seriesList($input: UserSeriesListInput!) {\n userSeriesList(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on QueryUserSeriesListSuccess {\n data {\n id\n nextEpisode {\n id\n }\n ...SeriesRow_SeriesFragment\n }\n }\n }\n }\n ': + types.SeriesListDocument, + '\n fragment SeriesPoster_SeriesFragment on Series {\n poster\n title\n }\n': + types.SeriesPoster_SeriesFragmentFragmentDoc, + '\n fragment SeriesStatusSelect_SeriesFragment on Series {\n id\n status\n }\n': + types.SeriesStatusSelect_SeriesFragmentFragmentDoc, + '\n mutation seriesUpdateStatus($input: SeriesUpdateStatusInput!) {\n seriesUpdateStatus(input: $input) {\n __typename\n ... on Series {\n id\n status\n }\n }\n }\n ': + types.SeriesUpdateStatusDocument, + '\n mutation markSeriesEpisodesAsSeen(\n $input: MarkSeriesEpisodesAsSeenInput!\n ) {\n markSeriesEpisodesAsSeen(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on Series {\n id\n ...LatestSeenEpisodeCell_SeriesFragment\n seasons {\n id\n episodes {\n id\n isSeen\n }\n }\n }\n }\n }\n ': + types.MarkSeriesEpisodesAsSeenDocument, +} /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. @@ -45,83 +63,120 @@ const documents = { * The query argument is unknown! * Please regenerate the types. */ -export function graphql(source: string): unknown; +export function graphql(source: string): unknown /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n mutation login($input: LoginInput!) {\n login(input: $input) {\n __typename\n ... on User {\n id\n email\n }\n ... on InvalidInputError {\n fieldErrors {\n path\n message\n }\n message\n }\n }\n }\n "): (typeof documents)["\n mutation login($input: LoginInput!) {\n login(input: $input) {\n __typename\n ... on User {\n id\n email\n }\n ... on InvalidInputError {\n fieldErrors {\n path\n message\n }\n message\n }\n }\n }\n "]; +export function graphql( + source: '\n mutation login($input: LoginInput!) {\n login(input: $input) {\n __typename\n ... on User {\n id\n email\n }\n ... on InvalidInputError {\n fieldErrors {\n path\n message\n }\n message\n }\n }\n }\n ', +): (typeof documents)['\n mutation login($input: LoginInput!) {\n login(input: $input) {\n __typename\n ... on User {\n id\n email\n }\n ... on InvalidInputError {\n fieldErrors {\n path\n message\n }\n message\n }\n }\n }\n '] /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n mutation register($input: RegisterInput!) {\n register(input: $input) {\n __typename\n ... on User {\n id\n email\n }\n ... on InvalidInputError {\n fieldErrors {\n path\n message\n }\n message\n }\n }\n }\n "): (typeof documents)["\n mutation register($input: RegisterInput!) {\n register(input: $input) {\n __typename\n ... on User {\n id\n email\n }\n ... on InvalidInputError {\n fieldErrors {\n path\n message\n }\n message\n }\n }\n }\n "]; +export function graphql( + source: '\n mutation register($input: RegisterInput!) {\n register(input: $input) {\n __typename\n ... on User {\n id\n email\n }\n ... on InvalidInputError {\n fieldErrors {\n path\n message\n }\n message\n }\n }\n }\n ', +): (typeof documents)['\n mutation register($input: RegisterInput!) {\n register(input: $input) {\n __typename\n ... on User {\n id\n email\n }\n ... on InvalidInputError {\n fieldErrors {\n path\n message\n }\n message\n }\n }\n }\n '] /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n query currentUser {\n me {\n __typename\n ... on User {\n id\n email\n name\n }\n }\n }\n "): (typeof documents)["\n query currentUser {\n me {\n __typename\n ... on User {\n id\n email\n name\n }\n }\n }\n "]; +export function graphql( + source: '\n query currentUser {\n me {\n __typename\n ... on User {\n id\n email\n name\n }\n }\n }\n ', +): (typeof documents)['\n query currentUser {\n me {\n __typename\n ... on User {\n id\n email\n name\n }\n }\n }\n '] /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n mutation logOut {\n logOut\n }\n "): (typeof documents)["\n mutation logOut {\n logOut\n }\n "]; +export function graphql( + source: '\n mutation logOut {\n logOut\n }\n ', +): (typeof documents)['\n mutation logOut {\n logOut\n }\n '] /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n query search($input: SeriesSearchInput!) {\n seriesSearch(input: $input) {\n id\n imdbId\n title\n startYear\n endYear\n ...SeriesPoster_SeriesFragment\n }\n }\n"): (typeof documents)["\n query search($input: SeriesSearchInput!) {\n seriesSearch(input: $input) {\n id\n imdbId\n title\n startYear\n endYear\n ...SeriesPoster_SeriesFragment\n }\n }\n"]; +export function graphql( + source: '\n query search($input: SeriesSearchInput!) {\n seriesSearch(input: $input) {\n id\n imdbId\n title\n startYear\n endYear\n ...SeriesPoster_SeriesFragment\n }\n }\n', +): (typeof documents)['\n query search($input: SeriesSearchInput!) {\n seriesSearch(input: $input) {\n id\n imdbId\n title\n startYear\n endYear\n ...SeriesPoster_SeriesFragment\n }\n }\n'] /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n fragment EpisodeLine_EpisodeFragment on Episode {\n id\n number\n title\n isSeen\n releasedAt\n }\n"): (typeof documents)["\n fragment EpisodeLine_EpisodeFragment on Episode {\n id\n number\n title\n isSeen\n releasedAt\n }\n"]; +export function graphql( + source: '\n fragment EpisodeLine_EpisodeFragment on Episode {\n id\n number\n title\n isSeen\n releasedAt\n }\n', +): (typeof documents)['\n fragment EpisodeLine_EpisodeFragment on Episode {\n id\n number\n title\n isSeen\n releasedAt\n }\n'] /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n fragment EpisodeLine_SeasonFragment on Season {\n number\n }\n"): (typeof documents)["\n fragment EpisodeLine_SeasonFragment on Season {\n number\n }\n"]; +export function graphql( + source: '\n fragment EpisodeLine_SeasonFragment on Season {\n number\n }\n', +): (typeof documents)['\n fragment EpisodeLine_SeasonFragment on Season {\n number\n }\n'] /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n mutation toggleEpisodeSeen($input: ToggleEpisodeSeenInput!) {\n toggleEpisodeSeen(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on Episode {\n id\n isSeen\n season {\n id\n series {\n id\n ...LatestSeenEpisodeCell_SeriesFragment\n }\n }\n }\n }\n }\n "): (typeof documents)["\n mutation toggleEpisodeSeen($input: ToggleEpisodeSeenInput!) {\n toggleEpisodeSeen(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on Episode {\n id\n isSeen\n season {\n id\n series {\n id\n ...LatestSeenEpisodeCell_SeriesFragment\n }\n }\n }\n }\n }\n "]; +export function graphql( + source: '\n mutation toggleEpisodeSeen($input: ToggleEpisodeSeenInput!) {\n toggleEpisodeSeen(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on Episode {\n id\n isSeen\n season {\n id\n series {\n id\n ...LatestSeenEpisodeCell_SeriesFragment\n }\n }\n }\n }\n }\n ', +): (typeof documents)['\n mutation toggleEpisodeSeen($input: ToggleEpisodeSeenInput!) {\n toggleEpisodeSeen(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on Episode {\n id\n isSeen\n season {\n id\n series {\n id\n ...LatestSeenEpisodeCell_SeriesFragment\n }\n }\n }\n }\n }\n '] /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n query seriesDetailsPage($id: ID!) {\n series(id: $id) {\n __typename\n ... on NotFoundError {\n message\n }\n ... on Series {\n id\n imdbId\n title\n startYear\n endYear\n plot\n ...SeriesPoster_SeriesFragment\n ...SeriesStatusSelect_SeriesFragment\n seasons {\n id\n number\n title\n episodes {\n id\n isSeen\n releasedAt\n ...EpisodeLine_EpisodeFragment\n }\n ...EpisodeLine_SeasonFragment\n }\n }\n }\n }\n "): (typeof documents)["\n query seriesDetailsPage($id: ID!) {\n series(id: $id) {\n __typename\n ... on NotFoundError {\n message\n }\n ... on Series {\n id\n imdbId\n title\n startYear\n endYear\n plot\n ...SeriesPoster_SeriesFragment\n ...SeriesStatusSelect_SeriesFragment\n seasons {\n id\n number\n title\n episodes {\n id\n isSeen\n releasedAt\n ...EpisodeLine_EpisodeFragment\n }\n ...EpisodeLine_SeasonFragment\n }\n }\n }\n }\n "]; +export function graphql( + source: '\n query seriesDetailsPage($id: ID!) {\n series(id: $id) {\n __typename\n ... on NotFoundError {\n message\n }\n ... on Series {\n id\n imdbId\n title\n startYear\n endYear\n plot\n ...SeriesPoster_SeriesFragment\n ...SeriesStatusSelect_SeriesFragment\n seasons {\n id\n number\n title\n episodes {\n id\n isSeen\n releasedAt\n ...EpisodeLine_EpisodeFragment\n }\n ...EpisodeLine_SeasonFragment\n }\n }\n }\n }\n ', +): (typeof documents)['\n query seriesDetailsPage($id: ID!) {\n series(id: $id) {\n __typename\n ... on NotFoundError {\n message\n }\n ... on Series {\n id\n imdbId\n title\n startYear\n endYear\n plot\n ...SeriesPoster_SeriesFragment\n ...SeriesStatusSelect_SeriesFragment\n seasons {\n id\n number\n title\n episodes {\n id\n isSeen\n releasedAt\n ...EpisodeLine_EpisodeFragment\n }\n ...EpisodeLine_SeasonFragment\n }\n }\n }\n }\n '] /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n mutation markSeasonEpisodesAsSeen(\n $input: MarkSeasonEpisodesAsSeenInput!\n ) {\n markSeasonEpisodesAsSeen(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on Season {\n id\n episodes {\n id\n isSeen\n }\n series {\n id\n ...LatestSeenEpisodeCell_SeriesFragment\n }\n }\n }\n }\n "): (typeof documents)["\n mutation markSeasonEpisodesAsSeen(\n $input: MarkSeasonEpisodesAsSeenInput!\n ) {\n markSeasonEpisodesAsSeen(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on Season {\n id\n episodes {\n id\n isSeen\n }\n series {\n id\n ...LatestSeenEpisodeCell_SeriesFragment\n }\n }\n }\n }\n "]; +export function graphql( + source: '\n mutation markSeasonEpisodesAsSeen(\n $input: MarkSeasonEpisodesAsSeenInput!\n ) {\n markSeasonEpisodesAsSeen(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on Season {\n id\n episodes {\n id\n isSeen\n }\n series {\n id\n ...LatestSeenEpisodeCell_SeriesFragment\n }\n }\n }\n }\n ', +): (typeof documents)['\n mutation markSeasonEpisodesAsSeen(\n $input: MarkSeasonEpisodesAsSeenInput!\n ) {\n markSeasonEpisodesAsSeen(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on Season {\n id\n episodes {\n id\n isSeen\n }\n series {\n id\n ...LatestSeenEpisodeCell_SeriesFragment\n }\n }\n }\n }\n '] /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n fragment LatestSeenEpisodeCell_SeriesFragment on Series {\n latestSeenEpisode {\n id\n number\n season {\n id\n number\n }\n }\n nextEpisode {\n id\n }\n }\n"): (typeof documents)["\n fragment LatestSeenEpisodeCell_SeriesFragment on Series {\n latestSeenEpisode {\n id\n number\n season {\n id\n number\n }\n }\n nextEpisode {\n id\n }\n }\n"]; +export function graphql( + source: '\n fragment LatestSeenEpisodeCell_SeriesFragment on Series {\n latestSeenEpisode {\n id\n number\n season {\n id\n number\n }\n }\n nextEpisode {\n id\n }\n }\n', +): (typeof documents)['\n fragment LatestSeenEpisodeCell_SeriesFragment on Series {\n latestSeenEpisode {\n id\n number\n season {\n id\n number\n }\n }\n nextEpisode {\n id\n }\n }\n'] /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n mutation LatestSeenEpisodeToggleEpisodeSeen(\n $input: ToggleEpisodeSeenInput!\n ) {\n toggleEpisodeSeen(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on Episode {\n id\n isSeen\n season {\n id\n series {\n id\n ...LatestSeenEpisodeCell_SeriesFragment\n }\n }\n }\n }\n }\n "): (typeof documents)["\n mutation LatestSeenEpisodeToggleEpisodeSeen(\n $input: ToggleEpisodeSeenInput!\n ) {\n toggleEpisodeSeen(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on Episode {\n id\n isSeen\n season {\n id\n series {\n id\n ...LatestSeenEpisodeCell_SeriesFragment\n }\n }\n }\n }\n }\n "]; +export function graphql( + source: '\n mutation LatestSeenEpisodeToggleEpisodeSeen(\n $input: ToggleEpisodeSeenInput!\n ) {\n toggleEpisodeSeen(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on Episode {\n id\n isSeen\n season {\n id\n series {\n id\n ...LatestSeenEpisodeCell_SeriesFragment\n }\n }\n }\n }\n }\n ', +): (typeof documents)['\n mutation LatestSeenEpisodeToggleEpisodeSeen(\n $input: ToggleEpisodeSeenInput!\n ) {\n toggleEpisodeSeen(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on Episode {\n id\n isSeen\n season {\n id\n series {\n id\n ...LatestSeenEpisodeCell_SeriesFragment\n }\n }\n }\n }\n }\n '] /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n fragment SeriesRow_SeriesFragment on Series {\n id\n title\n ...SeriesPoster_SeriesFragment\n ...LatestSeenEpisodeCell_SeriesFragment\n }\n"): (typeof documents)["\n fragment SeriesRow_SeriesFragment on Series {\n id\n title\n ...SeriesPoster_SeriesFragment\n ...LatestSeenEpisodeCell_SeriesFragment\n }\n"]; +export function graphql( + source: '\n fragment SeriesRow_SeriesFragment on Series {\n id\n title\n ...SeriesPoster_SeriesFragment\n ...LatestSeenEpisodeCell_SeriesFragment\n }\n', +): (typeof documents)['\n fragment SeriesRow_SeriesFragment on Series {\n id\n title\n ...SeriesPoster_SeriesFragment\n ...LatestSeenEpisodeCell_SeriesFragment\n }\n'] /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n query seriesList($input: UserSeriesListInput!) {\n userSeriesList(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on QueryUserSeriesListSuccess {\n data {\n id\n nextEpisode {\n id\n }\n ...SeriesRow_SeriesFragment\n }\n }\n }\n }\n "): (typeof documents)["\n query seriesList($input: UserSeriesListInput!) {\n userSeriesList(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on QueryUserSeriesListSuccess {\n data {\n id\n nextEpisode {\n id\n }\n ...SeriesRow_SeriesFragment\n }\n }\n }\n }\n "]; +export function graphql( + source: '\n query seriesList($input: UserSeriesListInput!) {\n userSeriesList(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on QueryUserSeriesListSuccess {\n data {\n id\n nextEpisode {\n id\n }\n ...SeriesRow_SeriesFragment\n }\n }\n }\n }\n ', +): (typeof documents)['\n query seriesList($input: UserSeriesListInput!) {\n userSeriesList(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on QueryUserSeriesListSuccess {\n data {\n id\n nextEpisode {\n id\n }\n ...SeriesRow_SeriesFragment\n }\n }\n }\n }\n '] /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n fragment SeriesPoster_SeriesFragment on Series {\n poster\n title\n }\n"): (typeof documents)["\n fragment SeriesPoster_SeriesFragment on Series {\n poster\n title\n }\n"]; +export function graphql( + source: '\n fragment SeriesPoster_SeriesFragment on Series {\n poster\n title\n }\n', +): (typeof documents)['\n fragment SeriesPoster_SeriesFragment on Series {\n poster\n title\n }\n'] /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n fragment SeriesStatusSelect_SeriesFragment on Series {\n id\n status\n }\n"): (typeof documents)["\n fragment SeriesStatusSelect_SeriesFragment on Series {\n id\n status\n }\n"]; +export function graphql( + source: '\n fragment SeriesStatusSelect_SeriesFragment on Series {\n id\n status\n }\n', +): (typeof documents)['\n fragment SeriesStatusSelect_SeriesFragment on Series {\n id\n status\n }\n'] /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n mutation seriesUpdateStatus($input: SeriesUpdateStatusInput!) {\n seriesUpdateStatus(input: $input) {\n __typename\n ... on Series {\n id\n status\n }\n }\n }\n "): (typeof documents)["\n mutation seriesUpdateStatus($input: SeriesUpdateStatusInput!) {\n seriesUpdateStatus(input: $input) {\n __typename\n ... on Series {\n id\n status\n }\n }\n }\n "]; +export function graphql( + source: '\n mutation seriesUpdateStatus($input: SeriesUpdateStatusInput!) {\n seriesUpdateStatus(input: $input) {\n __typename\n ... on Series {\n id\n status\n }\n }\n }\n ', +): (typeof documents)['\n mutation seriesUpdateStatus($input: SeriesUpdateStatusInput!) {\n seriesUpdateStatus(input: $input) {\n __typename\n ... on Series {\n id\n status\n }\n }\n }\n '] /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n mutation markSeriesEpisodesAsSeen(\n $input: MarkSeriesEpisodesAsSeenInput!\n ) {\n markSeriesEpisodesAsSeen(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on Series {\n id\n ...LatestSeenEpisodeCell_SeriesFragment\n seasons {\n id\n episodes {\n id\n isSeen\n }\n }\n }\n }\n }\n "): (typeof documents)["\n mutation markSeriesEpisodesAsSeen(\n $input: MarkSeriesEpisodesAsSeenInput!\n ) {\n markSeriesEpisodesAsSeen(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on Series {\n id\n ...LatestSeenEpisodeCell_SeriesFragment\n seasons {\n id\n episodes {\n id\n isSeen\n }\n }\n }\n }\n }\n "]; +export function graphql( + source: '\n mutation markSeriesEpisodesAsSeen(\n $input: MarkSeriesEpisodesAsSeenInput!\n ) {\n markSeriesEpisodesAsSeen(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on Series {\n id\n ...LatestSeenEpisodeCell_SeriesFragment\n seasons {\n id\n episodes {\n id\n isSeen\n }\n }\n }\n }\n }\n ', +): (typeof documents)['\n mutation markSeriesEpisodesAsSeen(\n $input: MarkSeriesEpisodesAsSeenInput!\n ) {\n markSeriesEpisodesAsSeen(input: $input) {\n __typename\n ... on Error {\n message\n }\n ... on Series {\n id\n ...LatestSeenEpisodeCell_SeriesFragment\n seasons {\n id\n episodes {\n id\n isSeen\n }\n }\n }\n }\n }\n '] export function graphql(source: string) { - return (documents as any)[source] ?? {}; + return (documents as any)[source] ?? {} } -export type DocumentType> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never; \ No newline at end of file +export type DocumentType> = + TDocumentNode extends DocumentNode ? TType : never diff --git a/apps/webapp/src/generated/gql/graphql.ts b/apps/webapp/src/generated/gql/graphql.ts index 8846035d..0ef69894 100644 --- a/apps/webapp/src/generated/gql/graphql.ts +++ b/apps/webapp/src/generated/gql/graphql.ts @@ -1,370 +1,2279 @@ /* eslint-disable */ -import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core'; -export type Maybe = T | null; -export type InputMaybe = Maybe; -export type Exact = { [K in keyof T]: T[K] }; -export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; -export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; -export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; +import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core' +export type Maybe = T | null +export type InputMaybe = Maybe +export type Exact = { + [K in keyof T]: T[K] +} +export type MakeOptional = Omit & { + [SubKey in K]?: Maybe +} +export type MakeMaybe = Omit & { + [SubKey in K]: Maybe +} +export type MakeEmpty< + T extends { [key: string]: unknown }, + K extends keyof T, +> = { [_ in K]?: never } +export type Incremental = + | T + | { + [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never + } /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { - ID: { input: string; output: string; } - String: { input: string; output: string; } - Boolean: { input: boolean; output: boolean; } - Int: { input: number; output: number; } - Float: { input: number; output: number; } + ID: { input: string; output: string } + String: { input: string; output: string } + Boolean: { input: boolean; output: boolean } + Int: { input: number; output: number } + Float: { input: number; output: number } /** A local date string (i.e., with no associated timezone) in `YYYY-MM-DD` format, e.g. `2020-01-01`. */ - Date: { input: string; output: string; } -}; + Date: { input: string; output: string } +} export type BaseError = Error & { - __typename: 'BaseError'; - message: Scalars['String']['output']; -}; + __typename: 'BaseError' + message: Scalars['String']['output'] +} export type Episode = { - __typename: 'Episode'; - id: Scalars['ID']['output']; - imdbId?: Maybe; - imdbRating?: Maybe; - isSeen: Scalars['Boolean']['output']; - number: Scalars['Int']['output']; - releasedAt?: Maybe; - season: Season; - title: Scalars['String']['output']; -}; + __typename: 'Episode' + id: Scalars['ID']['output'] + imdbId?: Maybe + imdbRating?: Maybe + isSeen: Scalars['Boolean']['output'] + number: Scalars['Int']['output'] + releasedAt?: Maybe + season: Season + title: Scalars['String']['output'] +} export type Error = { - message: Scalars['String']['output']; -}; + message: Scalars['String']['output'] +} export type InvalidInputError = Error & { - __typename: 'InvalidInputError'; - fieldErrors: Array; - message: Scalars['String']['output']; -}; + __typename: 'InvalidInputError' + fieldErrors: Array + message: Scalars['String']['output'] +} export type InvalidInputErrorField = { - __typename: 'InvalidInputErrorField'; - message: Scalars['String']['output']; - path: Array; -}; + __typename: 'InvalidInputErrorField' + message: Scalars['String']['output'] + path: Array +} export type LoginInput = { - email: Scalars['String']['input']; - password: Scalars['String']['input']; -}; + email: Scalars['String']['input'] + password: Scalars['String']['input'] +} export type MarkSeasonEpisodesAsSeenInput = { - seasonId: Scalars['Int']['input']; -}; + seasonId: Scalars['Int']['input'] +} export type MarkSeriesEpisodesAsSeenInput = { - seriesId: Scalars['ID']['input']; -}; + seriesId: Scalars['ID']['input'] +} export type Mutation = { - __typename: 'Mutation'; - logOut: Scalars['Boolean']['output']; - login: MutationLoginResult; - markSeasonEpisodesAsSeen: MutationMarkSeasonEpisodesAsSeenResult; - markSeriesEpisodesAsSeen: MutationMarkSeriesEpisodesAsSeenResult; - register: MutationRegisterResult; - seriesUpdateStatus: MutationSeriesUpdateStatusResult; - toggleEpisodeSeen: MutationToggleEpisodeSeenResult; -}; - + __typename: 'Mutation' + logOut: Scalars['Boolean']['output'] + login: MutationLoginResult + markSeasonEpisodesAsSeen: MutationMarkSeasonEpisodesAsSeenResult + markSeriesEpisodesAsSeen: MutationMarkSeriesEpisodesAsSeenResult + register: MutationRegisterResult + seriesUpdateStatus: MutationSeriesUpdateStatusResult + toggleEpisodeSeen: MutationToggleEpisodeSeenResult +} export type MutationLoginArgs = { - input: LoginInput; -}; - + input: LoginInput +} export type MutationMarkSeasonEpisodesAsSeenArgs = { - input: MarkSeasonEpisodesAsSeenInput; -}; - + input: MarkSeasonEpisodesAsSeenInput +} export type MutationMarkSeriesEpisodesAsSeenArgs = { - input: MarkSeriesEpisodesAsSeenInput; -}; - + input: MarkSeriesEpisodesAsSeenInput +} export type MutationRegisterArgs = { - input: RegisterInput; -}; - + input: RegisterInput +} export type MutationSeriesUpdateStatusArgs = { - input: SeriesUpdateStatusInput; -}; - + input: SeriesUpdateStatusInput +} export type MutationToggleEpisodeSeenArgs = { - input: ToggleEpisodeSeenInput; -}; + input: ToggleEpisodeSeenInput +} -export type MutationLoginResult = InvalidInputError | User; +export type MutationLoginResult = InvalidInputError | User -export type MutationMarkSeasonEpisodesAsSeenResult = NotFoundError | Season | UnauthorizedError; +export type MutationMarkSeasonEpisodesAsSeenResult = + | NotFoundError + | Season + | UnauthorizedError -export type MutationMarkSeriesEpisodesAsSeenResult = NotFoundError | Series | UnauthorizedError; +export type MutationMarkSeriesEpisodesAsSeenResult = + | NotFoundError + | Series + | UnauthorizedError -export type MutationRegisterResult = InvalidInputError | User; +export type MutationRegisterResult = InvalidInputError | User -export type MutationSeriesUpdateStatusResult = NotFoundError | Series | UnauthorizedError; +export type MutationSeriesUpdateStatusResult = + | NotFoundError + | Series + | UnauthorizedError -export type MutationToggleEpisodeSeenResult = Episode | NotFoundError | UnauthorizedError; +export type MutationToggleEpisodeSeenResult = + | Episode + | NotFoundError + | UnauthorizedError export type NotFoundError = Error & { - __typename: 'NotFoundError'; - message: Scalars['String']['output']; -}; + __typename: 'NotFoundError' + message: Scalars['String']['output'] +} export type Query = { - __typename: 'Query'; - hello: Scalars['String']['output']; - me: QueryMeResult; - series: QuerySeriesResult; - seriesSearch: Array; - userSeriesList: QueryUserSeriesListResult; -}; - + __typename: 'Query' + hello: Scalars['String']['output'] + me: QueryMeResult + series: QuerySeriesResult + seriesSearch: Array + userSeriesList: QueryUserSeriesListResult +} export type QueryHelloArgs = { - name?: InputMaybe; -}; - + name?: InputMaybe +} export type QuerySeriesArgs = { - id: Scalars['ID']['input']; -}; - + id: Scalars['ID']['input'] +} export type QuerySeriesSearchArgs = { - input: SeriesSearchInput; -}; - + input: SeriesSearchInput +} export type QueryUserSeriesListArgs = { - input: UserSeriesListInput; -}; + input: UserSeriesListInput +} -export type QueryMeResult = UnauthorizedError | User; +export type QueryMeResult = UnauthorizedError | User -export type QuerySeriesResult = InvalidInputError | NotFoundError | Series; +export type QuerySeriesResult = InvalidInputError | NotFoundError | Series -export type QueryUserSeriesListResult = QueryUserSeriesListSuccess | UnauthorizedError; +export type QueryUserSeriesListResult = + | QueryUserSeriesListSuccess + | UnauthorizedError export type QueryUserSeriesListSuccess = { - __typename: 'QueryUserSeriesListSuccess'; - data: Array; -}; + __typename: 'QueryUserSeriesListSuccess' + data: Array +} export type RegisterInput = { - email: Scalars['String']['input']; - name: Scalars['String']['input']; - password: Scalars['String']['input']; -}; + email: Scalars['String']['input'] + name: Scalars['String']['input'] + password: Scalars['String']['input'] +} export type Season = { - __typename: 'Season'; - episodes: Array; - id: Scalars['ID']['output']; - number: Scalars['Int']['output']; - series: Series; - title: Scalars['String']['output']; -}; + __typename: 'Season' + episodes: Array + id: Scalars['ID']['output'] + number: Scalars['Int']['output'] + series: Series + title: Scalars['String']['output'] +} export type Series = { - __typename: 'Series'; - endYear?: Maybe; - id: Scalars['ID']['output']; - imdbId?: Maybe; - latestSeenEpisode?: Maybe; - nextEpisode?: Maybe; - plot?: Maybe; - poster?: Maybe; - seasons: Array; - startYear?: Maybe; - status?: Maybe; - title: Scalars['String']['output']; -}; + __typename: 'Series' + endYear?: Maybe + id: Scalars['ID']['output'] + imdbId?: Maybe + latestSeenEpisode?: Maybe + nextEpisode?: Maybe + plot?: Maybe + poster?: Maybe + seasons: Array + startYear?: Maybe + status?: Maybe + title: Scalars['String']['output'] +} export type SeriesSearchInput = { - keyword: Scalars['String']['input']; -}; + keyword: Scalars['String']['input'] +} export type SeriesUpdateStatusInput = { - seriesId: Scalars['Int']['input']; - status?: InputMaybe; -}; + seriesId: Scalars['Int']['input'] + status?: InputMaybe +} export type ToggleEpisodeSeenInput = { - episodeId: Scalars['Int']['input']; -}; + episodeId: Scalars['Int']['input'] +} export type UnauthorizedError = Error & { - __typename: 'UnauthorizedError'; - message: Scalars['String']['output']; -}; + __typename: 'UnauthorizedError' + message: Scalars['String']['output'] +} export type User = { - __typename: 'User'; - email: Scalars['String']['output']; - id: Scalars['ID']['output']; - name: Scalars['String']['output']; -}; + __typename: 'User' + email: Scalars['String']['output'] + id: Scalars['ID']['output'] + name: Scalars['String']['output'] +} export type UserSeriesListInput = { - status?: InputMaybe; -}; + status?: InputMaybe +} export enum UserSeriesStatus { Completed = 'Completed', InProgress = 'InProgress', OnHold = 'OnHold', - PlanToWatch = 'PlanToWatch' + PlanToWatch = 'PlanToWatch', } export type LoginMutationVariables = Exact<{ - input: LoginInput; -}>; - - -export type LoginMutation = { __typename: 'Mutation', login: { __typename: 'InvalidInputError', message: string, fieldErrors: Array<{ __typename: 'InvalidInputErrorField', path: Array, message: string }> } | { __typename: 'User', id: string, email: string } }; + input: LoginInput +}> + +export type LoginMutation = { + __typename: 'Mutation' + login: + | { + __typename: 'InvalidInputError' + message: string + fieldErrors: Array<{ + __typename: 'InvalidInputErrorField' + path: Array + message: string + }> + } + | { __typename: 'User'; id: string; email: string } +} export type RegisterMutationVariables = Exact<{ - input: RegisterInput; -}>; - - -export type RegisterMutation = { __typename: 'Mutation', register: { __typename: 'InvalidInputError', message: string, fieldErrors: Array<{ __typename: 'InvalidInputErrorField', path: Array, message: string }> } | { __typename: 'User', id: string, email: string } }; - -export type CurrentUserQueryVariables = Exact<{ [key: string]: never; }>; - + input: RegisterInput +}> + +export type RegisterMutation = { + __typename: 'Mutation' + register: + | { + __typename: 'InvalidInputError' + message: string + fieldErrors: Array<{ + __typename: 'InvalidInputErrorField' + path: Array + message: string + }> + } + | { __typename: 'User'; id: string; email: string } +} -export type CurrentUserQuery = { __typename: 'Query', me: { __typename: 'UnauthorizedError' } | { __typename: 'User', id: string, email: string, name: string } }; +export type CurrentUserQueryVariables = Exact<{ [key: string]: never }> -export type LogOutMutationVariables = Exact<{ [key: string]: never; }>; +export type CurrentUserQuery = { + __typename: 'Query' + me: + | { __typename: 'UnauthorizedError' } + | { __typename: 'User'; id: string; email: string; name: string } +} +export type LogOutMutationVariables = Exact<{ [key: string]: never }> -export type LogOutMutation = { __typename: 'Mutation', logOut: boolean }; +export type LogOutMutation = { __typename: 'Mutation'; logOut: boolean } export type SearchQueryVariables = Exact<{ - input: SeriesSearchInput; -}>; - - -export type SearchQuery = { __typename: 'Query', seriesSearch: Array<( - { __typename: 'Series', id: string, imdbId?: string | null, title: string, startYear?: number | null, endYear?: number | null } - & { ' $fragmentRefs'?: { 'SeriesPoster_SeriesFragmentFragment': SeriesPoster_SeriesFragmentFragment } } - )> }; + input: SeriesSearchInput +}> + +export type SearchQuery = { + __typename: 'Query' + seriesSearch: Array< + { + __typename: 'Series' + id: string + imdbId?: string | null + title: string + startYear?: number | null + endYear?: number | null + } & { + ' $fragmentRefs'?: { + SeriesPoster_SeriesFragmentFragment: SeriesPoster_SeriesFragmentFragment + } + } + > +} -export type EpisodeLine_EpisodeFragmentFragment = { __typename: 'Episode', id: string, number: number, title: string, isSeen: boolean, releasedAt?: string | null } & { ' $fragmentName'?: 'EpisodeLine_EpisodeFragmentFragment' }; +export type EpisodeLine_EpisodeFragmentFragment = { + __typename: 'Episode' + id: string + number: number + title: string + isSeen: boolean + releasedAt?: string | null +} & { ' $fragmentName'?: 'EpisodeLine_EpisodeFragmentFragment' } -export type EpisodeLine_SeasonFragmentFragment = { __typename: 'Season', number: number } & { ' $fragmentName'?: 'EpisodeLine_SeasonFragmentFragment' }; +export type EpisodeLine_SeasonFragmentFragment = { + __typename: 'Season' + number: number +} & { ' $fragmentName'?: 'EpisodeLine_SeasonFragmentFragment' } export type ToggleEpisodeSeenMutationVariables = Exact<{ - input: ToggleEpisodeSeenInput; -}>; - - -export type ToggleEpisodeSeenMutation = { __typename: 'Mutation', toggleEpisodeSeen: { __typename: 'Episode', id: string, isSeen: boolean, season: { __typename: 'Season', id: string, series: ( - { __typename: 'Series', id: string } - & { ' $fragmentRefs'?: { 'LatestSeenEpisodeCell_SeriesFragmentFragment': LatestSeenEpisodeCell_SeriesFragmentFragment } } - ) } } | { __typename: 'NotFoundError', message: string } | { __typename: 'UnauthorizedError', message: string } }; + input: ToggleEpisodeSeenInput +}> + +export type ToggleEpisodeSeenMutation = { + __typename: 'Mutation' + toggleEpisodeSeen: + | { + __typename: 'Episode' + id: string + isSeen: boolean + season: { + __typename: 'Season' + id: string + series: { __typename: 'Series'; id: string } & { + ' $fragmentRefs'?: { + LatestSeenEpisodeCell_SeriesFragmentFragment: LatestSeenEpisodeCell_SeriesFragmentFragment + } + } + } + } + | { __typename: 'NotFoundError'; message: string } + | { __typename: 'UnauthorizedError'; message: string } +} export type SeriesDetailsPageQueryVariables = Exact<{ - id: Scalars['ID']['input']; -}>; - - -export type SeriesDetailsPageQuery = { __typename: 'Query', series: { __typename: 'InvalidInputError' } | { __typename: 'NotFoundError', message: string } | ( - { __typename: 'Series', id: string, imdbId?: string | null, title: string, startYear?: number | null, endYear?: number | null, plot?: string | null, seasons: Array<( - { __typename: 'Season', id: string, number: number, title: string, episodes: Array<( - { __typename: 'Episode', id: string, isSeen: boolean, releasedAt?: string | null } - & { ' $fragmentRefs'?: { 'EpisodeLine_EpisodeFragmentFragment': EpisodeLine_EpisodeFragmentFragment } } - )> } - & { ' $fragmentRefs'?: { 'EpisodeLine_SeasonFragmentFragment': EpisodeLine_SeasonFragmentFragment } } - )> } - & { ' $fragmentRefs'?: { 'SeriesPoster_SeriesFragmentFragment': SeriesPoster_SeriesFragmentFragment;'SeriesStatusSelect_SeriesFragmentFragment': SeriesStatusSelect_SeriesFragmentFragment } } - ) }; + id: Scalars['ID']['input'] +}> + +export type SeriesDetailsPageQuery = { + __typename: 'Query' + series: + | { __typename: 'InvalidInputError' } + | { __typename: 'NotFoundError'; message: string } + | ({ + __typename: 'Series' + id: string + imdbId?: string | null + title: string + startYear?: number | null + endYear?: number | null + plot?: string | null + seasons: Array< + { + __typename: 'Season' + id: string + number: number + title: string + episodes: Array< + { + __typename: 'Episode' + id: string + isSeen: boolean + releasedAt?: string | null + } & { + ' $fragmentRefs'?: { + EpisodeLine_EpisodeFragmentFragment: EpisodeLine_EpisodeFragmentFragment + } + } + > + } & { + ' $fragmentRefs'?: { + EpisodeLine_SeasonFragmentFragment: EpisodeLine_SeasonFragmentFragment + } + } + > + } & { + ' $fragmentRefs'?: { + SeriesPoster_SeriesFragmentFragment: SeriesPoster_SeriesFragmentFragment + SeriesStatusSelect_SeriesFragmentFragment: SeriesStatusSelect_SeriesFragmentFragment + } + }) +} export type MarkSeasonEpisodesAsSeenMutationVariables = Exact<{ - input: MarkSeasonEpisodesAsSeenInput; -}>; - - -export type MarkSeasonEpisodesAsSeenMutation = { __typename: 'Mutation', markSeasonEpisodesAsSeen: { __typename: 'NotFoundError', message: string } | { __typename: 'Season', id: string, episodes: Array<{ __typename: 'Episode', id: string, isSeen: boolean }>, series: ( - { __typename: 'Series', id: string } - & { ' $fragmentRefs'?: { 'LatestSeenEpisodeCell_SeriesFragmentFragment': LatestSeenEpisodeCell_SeriesFragmentFragment } } - ) } | { __typename: 'UnauthorizedError', message: string } }; + input: MarkSeasonEpisodesAsSeenInput +}> + +export type MarkSeasonEpisodesAsSeenMutation = { + __typename: 'Mutation' + markSeasonEpisodesAsSeen: + | { __typename: 'NotFoundError'; message: string } + | { + __typename: 'Season' + id: string + episodes: Array<{ __typename: 'Episode'; id: string; isSeen: boolean }> + series: { __typename: 'Series'; id: string } & { + ' $fragmentRefs'?: { + LatestSeenEpisodeCell_SeriesFragmentFragment: LatestSeenEpisodeCell_SeriesFragmentFragment + } + } + } + | { __typename: 'UnauthorizedError'; message: string } +} -export type LatestSeenEpisodeCell_SeriesFragmentFragment = { __typename: 'Series', latestSeenEpisode?: { __typename: 'Episode', id: string, number: number, season: { __typename: 'Season', id: string, number: number } } | null, nextEpisode?: { __typename: 'Episode', id: string } | null } & { ' $fragmentName'?: 'LatestSeenEpisodeCell_SeriesFragmentFragment' }; +export type LatestSeenEpisodeCell_SeriesFragmentFragment = { + __typename: 'Series' + latestSeenEpisode?: { + __typename: 'Episode' + id: string + number: number + season: { __typename: 'Season'; id: string; number: number } + } | null + nextEpisode?: { __typename: 'Episode'; id: string } | null +} & { ' $fragmentName'?: 'LatestSeenEpisodeCell_SeriesFragmentFragment' } export type LatestSeenEpisodeToggleEpisodeSeenMutationVariables = Exact<{ - input: ToggleEpisodeSeenInput; -}>; - - -export type LatestSeenEpisodeToggleEpisodeSeenMutation = { __typename: 'Mutation', toggleEpisodeSeen: { __typename: 'Episode', id: string, isSeen: boolean, season: { __typename: 'Season', id: string, series: ( - { __typename: 'Series', id: string } - & { ' $fragmentRefs'?: { 'LatestSeenEpisodeCell_SeriesFragmentFragment': LatestSeenEpisodeCell_SeriesFragmentFragment } } - ) } } | { __typename: 'NotFoundError', message: string } | { __typename: 'UnauthorizedError', message: string } }; + input: ToggleEpisodeSeenInput +}> + +export type LatestSeenEpisodeToggleEpisodeSeenMutation = { + __typename: 'Mutation' + toggleEpisodeSeen: + | { + __typename: 'Episode' + id: string + isSeen: boolean + season: { + __typename: 'Season' + id: string + series: { __typename: 'Series'; id: string } & { + ' $fragmentRefs'?: { + LatestSeenEpisodeCell_SeriesFragmentFragment: LatestSeenEpisodeCell_SeriesFragmentFragment + } + } + } + } + | { __typename: 'NotFoundError'; message: string } + | { __typename: 'UnauthorizedError'; message: string } +} -export type SeriesRow_SeriesFragmentFragment = ( - { __typename: 'Series', id: string, title: string } - & { ' $fragmentRefs'?: { 'SeriesPoster_SeriesFragmentFragment': SeriesPoster_SeriesFragmentFragment;'LatestSeenEpisodeCell_SeriesFragmentFragment': LatestSeenEpisodeCell_SeriesFragmentFragment } } -) & { ' $fragmentName'?: 'SeriesRow_SeriesFragmentFragment' }; +export type SeriesRow_SeriesFragmentFragment = ({ + __typename: 'Series' + id: string + title: string +} & { + ' $fragmentRefs'?: { + SeriesPoster_SeriesFragmentFragment: SeriesPoster_SeriesFragmentFragment + LatestSeenEpisodeCell_SeriesFragmentFragment: LatestSeenEpisodeCell_SeriesFragmentFragment + } +}) & { ' $fragmentName'?: 'SeriesRow_SeriesFragmentFragment' } export type SeriesListQueryVariables = Exact<{ - input: UserSeriesListInput; -}>; - - -export type SeriesListQuery = { __typename: 'Query', userSeriesList: { __typename: 'QueryUserSeriesListSuccess', data: Array<( - { __typename: 'Series', id: string, nextEpisode?: { __typename: 'Episode', id: string } | null } - & { ' $fragmentRefs'?: { 'SeriesRow_SeriesFragmentFragment': SeriesRow_SeriesFragmentFragment } } - )> } | { __typename: 'UnauthorizedError', message: string } }; + input: UserSeriesListInput +}> + +export type SeriesListQuery = { + __typename: 'Query' + userSeriesList: + | { + __typename: 'QueryUserSeriesListSuccess' + data: Array< + { + __typename: 'Series' + id: string + nextEpisode?: { __typename: 'Episode'; id: string } | null + } & { + ' $fragmentRefs'?: { + SeriesRow_SeriesFragmentFragment: SeriesRow_SeriesFragmentFragment + } + } + > + } + | { __typename: 'UnauthorizedError'; message: string } +} -export type SeriesPoster_SeriesFragmentFragment = { __typename: 'Series', poster?: string | null, title: string } & { ' $fragmentName'?: 'SeriesPoster_SeriesFragmentFragment' }; +export type SeriesPoster_SeriesFragmentFragment = { + __typename: 'Series' + poster?: string | null + title: string +} & { ' $fragmentName'?: 'SeriesPoster_SeriesFragmentFragment' } -export type SeriesStatusSelect_SeriesFragmentFragment = { __typename: 'Series', id: string, status?: UserSeriesStatus | null } & { ' $fragmentName'?: 'SeriesStatusSelect_SeriesFragmentFragment' }; +export type SeriesStatusSelect_SeriesFragmentFragment = { + __typename: 'Series' + id: string + status?: UserSeriesStatus | null +} & { ' $fragmentName'?: 'SeriesStatusSelect_SeriesFragmentFragment' } export type SeriesUpdateStatusMutationVariables = Exact<{ - input: SeriesUpdateStatusInput; -}>; - - -export type SeriesUpdateStatusMutation = { __typename: 'Mutation', seriesUpdateStatus: { __typename: 'NotFoundError' } | { __typename: 'Series', id: string, status?: UserSeriesStatus | null } | { __typename: 'UnauthorizedError' } }; + input: SeriesUpdateStatusInput +}> + +export type SeriesUpdateStatusMutation = { + __typename: 'Mutation' + seriesUpdateStatus: + | { __typename: 'NotFoundError' } + | { __typename: 'Series'; id: string; status?: UserSeriesStatus | null } + | { __typename: 'UnauthorizedError' } +} export type MarkSeriesEpisodesAsSeenMutationVariables = Exact<{ - input: MarkSeriesEpisodesAsSeenInput; -}>; - - -export type MarkSeriesEpisodesAsSeenMutation = { __typename: 'Mutation', markSeriesEpisodesAsSeen: { __typename: 'NotFoundError', message: string } | ( - { __typename: 'Series', id: string, seasons: Array<{ __typename: 'Season', id: string, episodes: Array<{ __typename: 'Episode', id: string, isSeen: boolean }> }> } - & { ' $fragmentRefs'?: { 'LatestSeenEpisodeCell_SeriesFragmentFragment': LatestSeenEpisodeCell_SeriesFragmentFragment } } - ) | { __typename: 'UnauthorizedError', message: string } }; - -export const EpisodeLine_EpisodeFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EpisodeLine_EpisodeFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Episode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"number"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"isSeen"}},{"kind":"Field","name":{"kind":"Name","value":"releasedAt"}}]}}]} as unknown as DocumentNode; -export const EpisodeLine_SeasonFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EpisodeLine_SeasonFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Season"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"number"}}]}}]} as unknown as DocumentNode; -export const SeriesPoster_SeriesFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SeriesPoster_SeriesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Series"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"poster"}},{"kind":"Field","name":{"kind":"Name","value":"title"}}]}}]} as unknown as DocumentNode; -export const LatestSeenEpisodeCell_SeriesFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"LatestSeenEpisodeCell_SeriesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Series"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"latestSeenEpisode"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"number"}},{"kind":"Field","name":{"kind":"Name","value":"season"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"number"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"nextEpisode"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode; -export const SeriesRow_SeriesFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SeriesRow_SeriesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Series"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SeriesPoster_SeriesFragment"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"LatestSeenEpisodeCell_SeriesFragment"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SeriesPoster_SeriesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Series"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"poster"}},{"kind":"Field","name":{"kind":"Name","value":"title"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"LatestSeenEpisodeCell_SeriesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Series"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"latestSeenEpisode"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"number"}},{"kind":"Field","name":{"kind":"Name","value":"season"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"number"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"nextEpisode"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode; -export const SeriesStatusSelect_SeriesFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SeriesStatusSelect_SeriesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Series"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]} as unknown as DocumentNode; -export const LoginDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"login"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"LoginInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"login"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"User"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"email"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"InvalidInputError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fieldErrors"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"path"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}}]} as unknown as DocumentNode; -export const RegisterDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"register"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"RegisterInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"register"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"User"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"email"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"InvalidInputError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fieldErrors"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"path"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}}]} as unknown as DocumentNode; -export const CurrentUserDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"currentUser"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"me"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"User"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode; -export const LogOutDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"logOut"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"logOut"}}]}}]} as unknown as DocumentNode; -export const SearchDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"search"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SeriesSearchInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"seriesSearch"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"imdbId"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"startYear"}},{"kind":"Field","name":{"kind":"Name","value":"endYear"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SeriesPoster_SeriesFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SeriesPoster_SeriesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Series"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"poster"}},{"kind":"Field","name":{"kind":"Name","value":"title"}}]}}]} as unknown as DocumentNode; -export const ToggleEpisodeSeenDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"toggleEpisodeSeen"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ToggleEpisodeSeenInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"toggleEpisodeSeen"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Error"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"message"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Episode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"isSeen"}},{"kind":"Field","name":{"kind":"Name","value":"season"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"series"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"LatestSeenEpisodeCell_SeriesFragment"}}]}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"LatestSeenEpisodeCell_SeriesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Series"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"latestSeenEpisode"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"number"}},{"kind":"Field","name":{"kind":"Name","value":"season"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"number"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"nextEpisode"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode; -export const SeriesDetailsPageDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"seriesDetailsPage"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"series"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"NotFoundError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"message"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Series"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"imdbId"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"startYear"}},{"kind":"Field","name":{"kind":"Name","value":"endYear"}},{"kind":"Field","name":{"kind":"Name","value":"plot"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SeriesPoster_SeriesFragment"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SeriesStatusSelect_SeriesFragment"}},{"kind":"Field","name":{"kind":"Name","value":"seasons"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"number"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"episodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"isSeen"}},{"kind":"Field","name":{"kind":"Name","value":"releasedAt"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"EpisodeLine_EpisodeFragment"}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"EpisodeLine_SeasonFragment"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SeriesPoster_SeriesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Series"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"poster"}},{"kind":"Field","name":{"kind":"Name","value":"title"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SeriesStatusSelect_SeriesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Series"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EpisodeLine_EpisodeFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Episode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"number"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"isSeen"}},{"kind":"Field","name":{"kind":"Name","value":"releasedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EpisodeLine_SeasonFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Season"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"number"}}]}}]} as unknown as DocumentNode; -export const MarkSeasonEpisodesAsSeenDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"markSeasonEpisodesAsSeen"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"MarkSeasonEpisodesAsSeenInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"markSeasonEpisodesAsSeen"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Error"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"message"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Season"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"episodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"isSeen"}}]}},{"kind":"Field","name":{"kind":"Name","value":"series"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"LatestSeenEpisodeCell_SeriesFragment"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"LatestSeenEpisodeCell_SeriesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Series"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"latestSeenEpisode"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"number"}},{"kind":"Field","name":{"kind":"Name","value":"season"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"number"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"nextEpisode"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode; -export const LatestSeenEpisodeToggleEpisodeSeenDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"LatestSeenEpisodeToggleEpisodeSeen"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ToggleEpisodeSeenInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"toggleEpisodeSeen"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Error"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"message"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Episode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"isSeen"}},{"kind":"Field","name":{"kind":"Name","value":"season"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"series"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"LatestSeenEpisodeCell_SeriesFragment"}}]}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"LatestSeenEpisodeCell_SeriesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Series"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"latestSeenEpisode"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"number"}},{"kind":"Field","name":{"kind":"Name","value":"season"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"number"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"nextEpisode"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode; -export const SeriesListDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"seriesList"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UserSeriesListInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userSeriesList"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Error"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"message"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"QueryUserSeriesListSuccess"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nextEpisode"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SeriesRow_SeriesFragment"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SeriesPoster_SeriesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Series"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"poster"}},{"kind":"Field","name":{"kind":"Name","value":"title"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"LatestSeenEpisodeCell_SeriesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Series"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"latestSeenEpisode"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"number"}},{"kind":"Field","name":{"kind":"Name","value":"season"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"number"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"nextEpisode"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SeriesRow_SeriesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Series"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SeriesPoster_SeriesFragment"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"LatestSeenEpisodeCell_SeriesFragment"}}]}}]} as unknown as DocumentNode; -export const SeriesUpdateStatusDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"seriesUpdateStatus"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SeriesUpdateStatusInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"seriesUpdateStatus"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Series"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]}}]}}]} as unknown as DocumentNode; -export const MarkSeriesEpisodesAsSeenDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"markSeriesEpisodesAsSeen"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"MarkSeriesEpisodesAsSeenInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"markSeriesEpisodesAsSeen"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Error"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"message"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Series"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"LatestSeenEpisodeCell_SeriesFragment"}},{"kind":"Field","name":{"kind":"Name","value":"seasons"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"episodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"isSeen"}}]}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"LatestSeenEpisodeCell_SeriesFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Series"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"latestSeenEpisode"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"number"}},{"kind":"Field","name":{"kind":"Name","value":"season"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"number"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"nextEpisode"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file + input: MarkSeriesEpisodesAsSeenInput +}> + +export type MarkSeriesEpisodesAsSeenMutation = { + __typename: 'Mutation' + markSeriesEpisodesAsSeen: + | { __typename: 'NotFoundError'; message: string } + | ({ + __typename: 'Series' + id: string + seasons: Array<{ + __typename: 'Season' + id: string + episodes: Array<{ + __typename: 'Episode' + id: string + isSeen: boolean + }> + }> + } & { + ' $fragmentRefs'?: { + LatestSeenEpisodeCell_SeriesFragmentFragment: LatestSeenEpisodeCell_SeriesFragmentFragment + } + }) + | { __typename: 'UnauthorizedError'; message: string } +} + +export const EpisodeLine_EpisodeFragmentFragmentDoc = { + kind: 'Document', + definitions: [ + { + kind: 'FragmentDefinition', + name: { kind: 'Name', value: 'EpisodeLine_EpisodeFragment' }, + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Episode' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { kind: 'Field', name: { kind: 'Name', value: 'number' } }, + { kind: 'Field', name: { kind: 'Name', value: 'title' } }, + { kind: 'Field', name: { kind: 'Name', value: 'isSeen' } }, + { kind: 'Field', name: { kind: 'Name', value: 'releasedAt' } }, + ], + }, + }, + ], +} as unknown as DocumentNode +export const EpisodeLine_SeasonFragmentFragmentDoc = { + kind: 'Document', + definitions: [ + { + kind: 'FragmentDefinition', + name: { kind: 'Name', value: 'EpisodeLine_SeasonFragment' }, + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Season' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'number' } }, + ], + }, + }, + ], +} as unknown as DocumentNode +export const SeriesPoster_SeriesFragmentFragmentDoc = { + kind: 'Document', + definitions: [ + { + kind: 'FragmentDefinition', + name: { kind: 'Name', value: 'SeriesPoster_SeriesFragment' }, + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Series' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'poster' } }, + { kind: 'Field', name: { kind: 'Name', value: 'title' } }, + ], + }, + }, + ], +} as unknown as DocumentNode +export const LatestSeenEpisodeCell_SeriesFragmentFragmentDoc = { + kind: 'Document', + definitions: [ + { + kind: 'FragmentDefinition', + name: { kind: 'Name', value: 'LatestSeenEpisodeCell_SeriesFragment' }, + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Series' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'latestSeenEpisode' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { kind: 'Field', name: { kind: 'Name', value: 'number' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'season' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'number' }, + }, + ], + }, + }, + ], + }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'nextEpisode' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + ], + }, + }, + ], + }, + }, + ], +} as unknown as DocumentNode< + LatestSeenEpisodeCell_SeriesFragmentFragment, + unknown +> +export const SeriesRow_SeriesFragmentFragmentDoc = { + kind: 'Document', + definitions: [ + { + kind: 'FragmentDefinition', + name: { kind: 'Name', value: 'SeriesRow_SeriesFragment' }, + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Series' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { kind: 'Field', name: { kind: 'Name', value: 'title' } }, + { + kind: 'FragmentSpread', + name: { kind: 'Name', value: 'SeriesPoster_SeriesFragment' }, + }, + { + kind: 'FragmentSpread', + name: { + kind: 'Name', + value: 'LatestSeenEpisodeCell_SeriesFragment', + }, + }, + ], + }, + }, + { + kind: 'FragmentDefinition', + name: { kind: 'Name', value: 'SeriesPoster_SeriesFragment' }, + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Series' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'poster' } }, + { kind: 'Field', name: { kind: 'Name', value: 'title' } }, + ], + }, + }, + { + kind: 'FragmentDefinition', + name: { kind: 'Name', value: 'LatestSeenEpisodeCell_SeriesFragment' }, + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Series' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'latestSeenEpisode' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { kind: 'Field', name: { kind: 'Name', value: 'number' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'season' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'number' }, + }, + ], + }, + }, + ], + }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'nextEpisode' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + ], + }, + }, + ], + }, + }, + ], +} as unknown as DocumentNode +export const SeriesStatusSelect_SeriesFragmentFragmentDoc = { + kind: 'Document', + definitions: [ + { + kind: 'FragmentDefinition', + name: { kind: 'Name', value: 'SeriesStatusSelect_SeriesFragment' }, + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Series' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { kind: 'Field', name: { kind: 'Name', value: 'status' } }, + ], + }, + }, + ], +} as unknown as DocumentNode +export const LoginDocument = { + kind: 'Document', + definitions: [ + { + kind: 'OperationDefinition', + operation: 'mutation', + name: { kind: 'Name', value: 'login' }, + variableDefinitions: [ + { + kind: 'VariableDefinition', + variable: { + kind: 'Variable', + name: { kind: 'Name', value: 'input' }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'LoginInput' }, + }, + }, + }, + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'login' }, + arguments: [ + { + kind: 'Argument', + name: { kind: 'Name', value: 'input' }, + value: { + kind: 'Variable', + name: { kind: 'Name', value: 'input' }, + }, + }, + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, + { + kind: 'InlineFragment', + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'User' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { kind: 'Field', name: { kind: 'Name', value: 'email' } }, + ], + }, + }, + { + kind: 'InlineFragment', + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'InvalidInputError' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'fieldErrors' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'path' }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'message' }, + }, + ], + }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'message' }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], +} as unknown as DocumentNode +export const RegisterDocument = { + kind: 'Document', + definitions: [ + { + kind: 'OperationDefinition', + operation: 'mutation', + name: { kind: 'Name', value: 'register' }, + variableDefinitions: [ + { + kind: 'VariableDefinition', + variable: { + kind: 'Variable', + name: { kind: 'Name', value: 'input' }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'RegisterInput' }, + }, + }, + }, + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'register' }, + arguments: [ + { + kind: 'Argument', + name: { kind: 'Name', value: 'input' }, + value: { + kind: 'Variable', + name: { kind: 'Name', value: 'input' }, + }, + }, + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, + { + kind: 'InlineFragment', + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'User' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { kind: 'Field', name: { kind: 'Name', value: 'email' } }, + ], + }, + }, + { + kind: 'InlineFragment', + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'InvalidInputError' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'fieldErrors' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'path' }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'message' }, + }, + ], + }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'message' }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], +} as unknown as DocumentNode +export const CurrentUserDocument = { + kind: 'Document', + definitions: [ + { + kind: 'OperationDefinition', + operation: 'query', + name: { kind: 'Name', value: 'currentUser' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'me' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, + { + kind: 'InlineFragment', + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'User' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { kind: 'Field', name: { kind: 'Name', value: 'email' } }, + { kind: 'Field', name: { kind: 'Name', value: 'name' } }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], +} as unknown as DocumentNode +export const LogOutDocument = { + kind: 'Document', + definitions: [ + { + kind: 'OperationDefinition', + operation: 'mutation', + name: { kind: 'Name', value: 'logOut' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'logOut' } }, + ], + }, + }, + ], +} as unknown as DocumentNode +export const SearchDocument = { + kind: 'Document', + definitions: [ + { + kind: 'OperationDefinition', + operation: 'query', + name: { kind: 'Name', value: 'search' }, + variableDefinitions: [ + { + kind: 'VariableDefinition', + variable: { + kind: 'Variable', + name: { kind: 'Name', value: 'input' }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'SeriesSearchInput' }, + }, + }, + }, + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'seriesSearch' }, + arguments: [ + { + kind: 'Argument', + name: { kind: 'Name', value: 'input' }, + value: { + kind: 'Variable', + name: { kind: 'Name', value: 'input' }, + }, + }, + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { kind: 'Field', name: { kind: 'Name', value: 'imdbId' } }, + { kind: 'Field', name: { kind: 'Name', value: 'title' } }, + { kind: 'Field', name: { kind: 'Name', value: 'startYear' } }, + { kind: 'Field', name: { kind: 'Name', value: 'endYear' } }, + { + kind: 'FragmentSpread', + name: { kind: 'Name', value: 'SeriesPoster_SeriesFragment' }, + }, + ], + }, + }, + ], + }, + }, + { + kind: 'FragmentDefinition', + name: { kind: 'Name', value: 'SeriesPoster_SeriesFragment' }, + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Series' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'poster' } }, + { kind: 'Field', name: { kind: 'Name', value: 'title' } }, + ], + }, + }, + ], +} as unknown as DocumentNode +export const ToggleEpisodeSeenDocument = { + kind: 'Document', + definitions: [ + { + kind: 'OperationDefinition', + operation: 'mutation', + name: { kind: 'Name', value: 'toggleEpisodeSeen' }, + variableDefinitions: [ + { + kind: 'VariableDefinition', + variable: { + kind: 'Variable', + name: { kind: 'Name', value: 'input' }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'ToggleEpisodeSeenInput' }, + }, + }, + }, + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'toggleEpisodeSeen' }, + arguments: [ + { + kind: 'Argument', + name: { kind: 'Name', value: 'input' }, + value: { + kind: 'Variable', + name: { kind: 'Name', value: 'input' }, + }, + }, + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, + { + kind: 'InlineFragment', + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Error' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'message' }, + }, + ], + }, + }, + { + kind: 'InlineFragment', + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Episode' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'isSeen' }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'season' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'id' }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'series' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'id' }, + }, + { + kind: 'FragmentSpread', + name: { + kind: 'Name', + value: + 'LatestSeenEpisodeCell_SeriesFragment', + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + { + kind: 'FragmentDefinition', + name: { kind: 'Name', value: 'LatestSeenEpisodeCell_SeriesFragment' }, + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Series' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'latestSeenEpisode' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { kind: 'Field', name: { kind: 'Name', value: 'number' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'season' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'number' }, + }, + ], + }, + }, + ], + }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'nextEpisode' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + ], + }, + }, + ], + }, + }, + ], +} as unknown as DocumentNode< + ToggleEpisodeSeenMutation, + ToggleEpisodeSeenMutationVariables +> +export const SeriesDetailsPageDocument = { + kind: 'Document', + definitions: [ + { + kind: 'OperationDefinition', + operation: 'query', + name: { kind: 'Name', value: 'seriesDetailsPage' }, + variableDefinitions: [ + { + kind: 'VariableDefinition', + variable: { kind: 'Variable', name: { kind: 'Name', value: 'id' } }, + type: { + kind: 'NonNullType', + type: { kind: 'NamedType', name: { kind: 'Name', value: 'ID' } }, + }, + }, + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'series' }, + arguments: [ + { + kind: 'Argument', + name: { kind: 'Name', value: 'id' }, + value: { + kind: 'Variable', + name: { kind: 'Name', value: 'id' }, + }, + }, + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, + { + kind: 'InlineFragment', + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'NotFoundError' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'message' }, + }, + ], + }, + }, + { + kind: 'InlineFragment', + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Series' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'imdbId' }, + }, + { kind: 'Field', name: { kind: 'Name', value: 'title' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'startYear' }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'endYear' }, + }, + { kind: 'Field', name: { kind: 'Name', value: 'plot' } }, + { + kind: 'FragmentSpread', + name: { + kind: 'Name', + value: 'SeriesPoster_SeriesFragment', + }, + }, + { + kind: 'FragmentSpread', + name: { + kind: 'Name', + value: 'SeriesStatusSelect_SeriesFragment', + }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'seasons' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'id' }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'number' }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'title' }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'episodes' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'id' }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'isSeen' }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'releasedAt' }, + }, + { + kind: 'FragmentSpread', + name: { + kind: 'Name', + value: 'EpisodeLine_EpisodeFragment', + }, + }, + ], + }, + }, + { + kind: 'FragmentSpread', + name: { + kind: 'Name', + value: 'EpisodeLine_SeasonFragment', + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + { + kind: 'FragmentDefinition', + name: { kind: 'Name', value: 'SeriesPoster_SeriesFragment' }, + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Series' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'poster' } }, + { kind: 'Field', name: { kind: 'Name', value: 'title' } }, + ], + }, + }, + { + kind: 'FragmentDefinition', + name: { kind: 'Name', value: 'SeriesStatusSelect_SeriesFragment' }, + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Series' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { kind: 'Field', name: { kind: 'Name', value: 'status' } }, + ], + }, + }, + { + kind: 'FragmentDefinition', + name: { kind: 'Name', value: 'EpisodeLine_EpisodeFragment' }, + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Episode' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { kind: 'Field', name: { kind: 'Name', value: 'number' } }, + { kind: 'Field', name: { kind: 'Name', value: 'title' } }, + { kind: 'Field', name: { kind: 'Name', value: 'isSeen' } }, + { kind: 'Field', name: { kind: 'Name', value: 'releasedAt' } }, + ], + }, + }, + { + kind: 'FragmentDefinition', + name: { kind: 'Name', value: 'EpisodeLine_SeasonFragment' }, + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Season' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'number' } }, + ], + }, + }, + ], +} as unknown as DocumentNode< + SeriesDetailsPageQuery, + SeriesDetailsPageQueryVariables +> +export const MarkSeasonEpisodesAsSeenDocument = { + kind: 'Document', + definitions: [ + { + kind: 'OperationDefinition', + operation: 'mutation', + name: { kind: 'Name', value: 'markSeasonEpisodesAsSeen' }, + variableDefinitions: [ + { + kind: 'VariableDefinition', + variable: { + kind: 'Variable', + name: { kind: 'Name', value: 'input' }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'MarkSeasonEpisodesAsSeenInput' }, + }, + }, + }, + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'markSeasonEpisodesAsSeen' }, + arguments: [ + { + kind: 'Argument', + name: { kind: 'Name', value: 'input' }, + value: { + kind: 'Variable', + name: { kind: 'Name', value: 'input' }, + }, + }, + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, + { + kind: 'InlineFragment', + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Error' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'message' }, + }, + ], + }, + }, + { + kind: 'InlineFragment', + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Season' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'episodes' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'id' }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'isSeen' }, + }, + ], + }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'series' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'id' }, + }, + { + kind: 'FragmentSpread', + name: { + kind: 'Name', + value: 'LatestSeenEpisodeCell_SeriesFragment', + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + { + kind: 'FragmentDefinition', + name: { kind: 'Name', value: 'LatestSeenEpisodeCell_SeriesFragment' }, + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Series' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'latestSeenEpisode' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { kind: 'Field', name: { kind: 'Name', value: 'number' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'season' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'number' }, + }, + ], + }, + }, + ], + }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'nextEpisode' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + ], + }, + }, + ], + }, + }, + ], +} as unknown as DocumentNode< + MarkSeasonEpisodesAsSeenMutation, + MarkSeasonEpisodesAsSeenMutationVariables +> +export const LatestSeenEpisodeToggleEpisodeSeenDocument = { + kind: 'Document', + definitions: [ + { + kind: 'OperationDefinition', + operation: 'mutation', + name: { kind: 'Name', value: 'LatestSeenEpisodeToggleEpisodeSeen' }, + variableDefinitions: [ + { + kind: 'VariableDefinition', + variable: { + kind: 'Variable', + name: { kind: 'Name', value: 'input' }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'ToggleEpisodeSeenInput' }, + }, + }, + }, + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'toggleEpisodeSeen' }, + arguments: [ + { + kind: 'Argument', + name: { kind: 'Name', value: 'input' }, + value: { + kind: 'Variable', + name: { kind: 'Name', value: 'input' }, + }, + }, + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, + { + kind: 'InlineFragment', + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Error' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'message' }, + }, + ], + }, + }, + { + kind: 'InlineFragment', + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Episode' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'isSeen' }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'season' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'id' }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'series' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'id' }, + }, + { + kind: 'FragmentSpread', + name: { + kind: 'Name', + value: + 'LatestSeenEpisodeCell_SeriesFragment', + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + { + kind: 'FragmentDefinition', + name: { kind: 'Name', value: 'LatestSeenEpisodeCell_SeriesFragment' }, + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Series' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'latestSeenEpisode' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { kind: 'Field', name: { kind: 'Name', value: 'number' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'season' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'number' }, + }, + ], + }, + }, + ], + }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'nextEpisode' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + ], + }, + }, + ], + }, + }, + ], +} as unknown as DocumentNode< + LatestSeenEpisodeToggleEpisodeSeenMutation, + LatestSeenEpisodeToggleEpisodeSeenMutationVariables +> +export const SeriesListDocument = { + kind: 'Document', + definitions: [ + { + kind: 'OperationDefinition', + operation: 'query', + name: { kind: 'Name', value: 'seriesList' }, + variableDefinitions: [ + { + kind: 'VariableDefinition', + variable: { + kind: 'Variable', + name: { kind: 'Name', value: 'input' }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'UserSeriesListInput' }, + }, + }, + }, + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'userSeriesList' }, + arguments: [ + { + kind: 'Argument', + name: { kind: 'Name', value: 'input' }, + value: { + kind: 'Variable', + name: { kind: 'Name', value: 'input' }, + }, + }, + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, + { + kind: 'InlineFragment', + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Error' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'message' }, + }, + ], + }, + }, + { + kind: 'InlineFragment', + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'QueryUserSeriesListSuccess' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'data' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'id' }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'nextEpisode' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'id' }, + }, + ], + }, + }, + { + kind: 'FragmentSpread', + name: { + kind: 'Name', + value: 'SeriesRow_SeriesFragment', + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + { + kind: 'FragmentDefinition', + name: { kind: 'Name', value: 'SeriesPoster_SeriesFragment' }, + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Series' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'poster' } }, + { kind: 'Field', name: { kind: 'Name', value: 'title' } }, + ], + }, + }, + { + kind: 'FragmentDefinition', + name: { kind: 'Name', value: 'LatestSeenEpisodeCell_SeriesFragment' }, + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Series' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'latestSeenEpisode' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { kind: 'Field', name: { kind: 'Name', value: 'number' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'season' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'number' }, + }, + ], + }, + }, + ], + }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'nextEpisode' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + ], + }, + }, + ], + }, + }, + { + kind: 'FragmentDefinition', + name: { kind: 'Name', value: 'SeriesRow_SeriesFragment' }, + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Series' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { kind: 'Field', name: { kind: 'Name', value: 'title' } }, + { + kind: 'FragmentSpread', + name: { kind: 'Name', value: 'SeriesPoster_SeriesFragment' }, + }, + { + kind: 'FragmentSpread', + name: { + kind: 'Name', + value: 'LatestSeenEpisodeCell_SeriesFragment', + }, + }, + ], + }, + }, + ], +} as unknown as DocumentNode +export const SeriesUpdateStatusDocument = { + kind: 'Document', + definitions: [ + { + kind: 'OperationDefinition', + operation: 'mutation', + name: { kind: 'Name', value: 'seriesUpdateStatus' }, + variableDefinitions: [ + { + kind: 'VariableDefinition', + variable: { + kind: 'Variable', + name: { kind: 'Name', value: 'input' }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'SeriesUpdateStatusInput' }, + }, + }, + }, + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'seriesUpdateStatus' }, + arguments: [ + { + kind: 'Argument', + name: { kind: 'Name', value: 'input' }, + value: { + kind: 'Variable', + name: { kind: 'Name', value: 'input' }, + }, + }, + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, + { + kind: 'InlineFragment', + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Series' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'status' }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], +} as unknown as DocumentNode< + SeriesUpdateStatusMutation, + SeriesUpdateStatusMutationVariables +> +export const MarkSeriesEpisodesAsSeenDocument = { + kind: 'Document', + definitions: [ + { + kind: 'OperationDefinition', + operation: 'mutation', + name: { kind: 'Name', value: 'markSeriesEpisodesAsSeen' }, + variableDefinitions: [ + { + kind: 'VariableDefinition', + variable: { + kind: 'Variable', + name: { kind: 'Name', value: 'input' }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'MarkSeriesEpisodesAsSeenInput' }, + }, + }, + }, + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'markSeriesEpisodesAsSeen' }, + arguments: [ + { + kind: 'Argument', + name: { kind: 'Name', value: 'input' }, + value: { + kind: 'Variable', + name: { kind: 'Name', value: 'input' }, + }, + }, + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, + { + kind: 'InlineFragment', + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Error' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'message' }, + }, + ], + }, + }, + { + kind: 'InlineFragment', + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Series' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { + kind: 'FragmentSpread', + name: { + kind: 'Name', + value: 'LatestSeenEpisodeCell_SeriesFragment', + }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'seasons' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'id' }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'episodes' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'id' }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'isSeen' }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + { + kind: 'FragmentDefinition', + name: { kind: 'Name', value: 'LatestSeenEpisodeCell_SeriesFragment' }, + typeCondition: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Series' }, + }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'latestSeenEpisode' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { kind: 'Field', name: { kind: 'Name', value: 'number' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'season' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'number' }, + }, + ], + }, + }, + ], + }, + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'nextEpisode' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + ], + }, + }, + ], + }, + }, + ], +} as unknown as DocumentNode< + MarkSeriesEpisodesAsSeenMutation, + MarkSeriesEpisodesAsSeenMutationVariables +> diff --git a/apps/webapp/src/generated/gql/index.ts b/apps/webapp/src/generated/gql/index.ts index f5159916..f9bc8e59 100644 --- a/apps/webapp/src/generated/gql/index.ts +++ b/apps/webapp/src/generated/gql/index.ts @@ -1,2 +1,2 @@ -export * from "./fragment-masking"; -export * from "./gql"; \ No newline at end of file +export * from './fragment-masking' +export * from './gql' diff --git a/package.json b/package.json index c9ba3cf1..f5b81a96 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ }, "scripts": { "build": "nx run-many -t build", - "generate:package": "nx generate @serieslist/nx-plugin:package", + "generate:package": "nx generate @serieslist/nx-plugin:package && pnpm i", "lint": "nx run-many -t lint", "migrate": "nx run @serieslist/api:migrate", "migrate:test": "nx migrate:test @serieslist/api", diff --git a/packages/tmdb/.eslintrc.json b/packages/tmdb/.eslintrc.json new file mode 100644 index 00000000..1e861a8f --- /dev/null +++ b/packages/tmdb/.eslintrc.json @@ -0,0 +1,4 @@ +{ + "extends": "@serieslist/eslint-config-base", + "root": true +} diff --git a/packages/tmdb/.prettierrc.json b/packages/tmdb/.prettierrc.json new file mode 100644 index 00000000..418db572 --- /dev/null +++ b/packages/tmdb/.prettierrc.json @@ -0,0 +1 @@ +"@serieslist/prettier-config" diff --git a/packages/tmdb/package.json b/packages/tmdb/package.json new file mode 100644 index 00000000..932a67fd --- /dev/null +++ b/packages/tmdb/package.json @@ -0,0 +1,31 @@ +{ + "name": "@serieslist/tmdb", + "version": "1.0.0", + "type": "module", + "main": "./src/index.ts", + "exports": { + ".": { + "import": "./src/index.ts", + "types": "./src/index.ts" + } + }, + "scripts": { + "lint": "eslint src", + "tsc": "tsc --noEmit" + }, + "devDependencies": { + "@serieslist/eslint-config-base": "workspace:*", + "@serieslist/prettier-config": "workspace:*", + "@serieslist/typescript-config-base": "workspace:*", + "date-fns": "^2.30.0", + "fishery": "^2.2.2", + "nanoid": "^4.0.2", + "nock": "^13.3.1", + "typescript": "^5.3.3" + }, + "dependencies": { + "@serieslist/logger": "workspace:^", + "node-fetch": "^3.3.1", + "zod": "^3.22.3" + } +} diff --git a/packages/tmdb/src/config.ts b/packages/tmdb/src/config.ts new file mode 100644 index 00000000..92ab8917 --- /dev/null +++ b/packages/tmdb/src/config.ts @@ -0,0 +1,7 @@ +/* eslint-disable @typescript-eslint/no-non-null-assertion */ +export const config = { + tmdb: { + url: process.env.TMDB_URL!, + apiToken: process.env.TMDB_API_TOKEN!, + }, +} diff --git a/packages/tmdb/src/index.ts b/packages/tmdb/src/index.ts new file mode 100644 index 00000000..157392a7 --- /dev/null +++ b/packages/tmdb/src/index.ts @@ -0,0 +1,6 @@ +export * from './tmdb.schema' +export * from './tmdbRequests.schema' +export * from './tmdb.types' +export * from './tmdbSeriesDetails.factory' +export * as tmdbService from './tmdb.service' +export * from './tmdbRequests.mock' diff --git a/packages/tmdb/src/logger.ts b/packages/tmdb/src/logger.ts new file mode 100644 index 00000000..d2a0fba3 --- /dev/null +++ b/packages/tmdb/src/logger.ts @@ -0,0 +1,3 @@ +import { createLogger } from '@serieslist/logger' + +export const log = createLogger({ name: 'tmdb' }) diff --git a/apps/api/src/features/tmdb/tmdb.schemas.ts b/packages/tmdb/src/tmdb.schema.ts similarity index 71% rename from apps/api/src/features/tmdb/tmdb.schemas.ts rename to packages/tmdb/src/tmdb.schema.ts index 7a0721ac..12b2b7b0 100644 --- a/apps/api/src/features/tmdb/tmdb.schemas.ts +++ b/packages/tmdb/src/tmdb.schema.ts @@ -7,12 +7,6 @@ export const tmdbStatusSchema = z.enum([ 'Canceled', ]) -export const tmdbNotFoundSchema = z.object({ - success: z.literal(false), - status_code: z.literal(34), - status_message: z.string(), -}) - export const tmdbSeriesSchema = z.object({ id: z.number(), name: z.string(), @@ -36,8 +30,6 @@ export const tmdbSeriesSchema = z.object({ ), }) -export const tmdbSeriesResponseSchema = tmdbSeriesSchema.or(tmdbNotFoundSchema) - export const tmdbSearchSeriesSchema = tmdbSeriesSchema.pick({ id: true, overview: true, @@ -46,13 +38,6 @@ export const tmdbSearchSeriesSchema = tmdbSeriesSchema.pick({ poster_path: true, }) -export const tmdbSeriesSearchResponseSchema = z.object({ - page: z.number(), - total_pages: z.number(), - total_results: z.number(), - results: z.array(tmdbSearchSeriesSchema), -}) - export const tmdbEpisodeSchema = z.object({ id: z.number(), name: z.string(), @@ -67,5 +52,3 @@ export const tmdbSeasonSchema = z.object({ episodes: z.array(tmdbEpisodeSchema), air_date: z.coerce.date(), }) - -export const tmdbSeasonResponseSchema = tmdbSeasonSchema.or(tmdbNotFoundSchema) diff --git a/apps/api/src/features/tmdb/tmdb.service.ts b/packages/tmdb/src/tmdb.service.ts similarity index 75% rename from apps/api/src/features/tmdb/tmdb.service.ts rename to packages/tmdb/src/tmdb.service.ts index c153abd3..0c743494 100644 --- a/apps/api/src/features/tmdb/tmdb.service.ts +++ b/packages/tmdb/src/tmdb.service.ts @@ -1,19 +1,22 @@ -import { type Insertable } from 'kysely' import fetch from 'node-fetch' import { type z } from 'zod' -import { config } from '#/config' -import { type Season, type Series } from '#/generated/db' -import { log } from '#/lib/logger' - +import { config } from './config' +import { log } from './logger' +import { + type TMDBSeries, + type TMDBSearchSeries, + type TMDBParsedSeries, + type TMDBParsedSeason, + type TMDBParsedEpisode, +} from './tmdb.types' import { tmdbSeasonResponseSchema, tmdbSeriesResponseSchema, tmdbSeriesSearchResponseSchema, -} from './tmdb.schemas' -import { type TMDbSeries, type TMDbSearchSeries } from './types' +} from './tmdbRequests.schema' -const makeTMDbRequest = async ( +const makeTMDBRequest = async ( url: string, queryParams: Record, schema: z.ZodSchema, @@ -47,9 +50,9 @@ const makeTMDbRequest = async ( } } -const parseSeriesFromTMDbResponse = ( - tmdbSeries: TMDbSearchSeries | TMDbSeries, -): Insertable => ({ +const parseSeriesFromTMDBResponse = ( + tmdbSeries: TMDBSearchSeries | TMDBSeries, +): TMDBParsedSeries => ({ tmdbId: tmdbSeries.id, imdbId: 'external_ids' in tmdbSeries ? tmdbSeries.external_ids.imdb_id : null, title: tmdbSeries.name, @@ -67,7 +70,7 @@ const parseSeriesFromTMDbResponse = ( tmdbSeries.last_air_date ? tmdbSeries.last_air_date.getFullYear() : null - : undefined, + : null, }) /** @@ -77,8 +80,8 @@ export const searchSeries = async ({ keyword, }: { keyword: string -}): Promise[]> => { - const { response } = await makeTMDbRequest( +}): Promise => { + const { response } = await makeTMDBRequest( 'search/tv', { query: keyword }, tmdbSeriesSearchResponseSchema, @@ -89,11 +92,11 @@ export const searchSeries = async ({ return [] } - return response.results.map(parseSeriesFromTMDbResponse) + return response.results.map(parseSeriesFromTMDBResponse) } export const fetchSeriesDetails = async ({ tmdbId }: { tmdbId: number }) => { - const { parsed, response } = await makeTMDbRequest( + const { parsed, response } = await makeTMDBRequest( `tv/${tmdbId}`, { append_to_response: 'external_ids' }, tmdbSeriesResponseSchema, @@ -105,10 +108,10 @@ export const fetchSeriesDetails = async ({ tmdbId }: { tmdbId: number }) => { return { found: true, parsed: true, - series: parseSeriesFromTMDbResponse(response), + series: parseSeriesFromTMDBResponse(response), totalSeasons: response.number_of_seasons, seasons: response.seasons.map( - (season): Omit, 'seriesId'> => ({ + (season): TMDBParsedSeason => ({ tmdbId: season.id, number: season.season_number, title: season.name, @@ -124,7 +127,7 @@ export const fetchEpisodesForSeason = async ({ tmdbId: number seasonNumber: number }) => { - const { response, parsed } = await makeTMDbRequest( + const { response, parsed } = await makeTMDBRequest( `tv/${tmdbId}/season/${seasonNumber}`, {}, tmdbSeasonResponseSchema, @@ -144,11 +147,13 @@ export const fetchEpisodesForSeason = async ({ found: true, seasonNumber: response.season_number, seasonTitle: response.name, - episodes: response.episodes.map((episode) => ({ - tmdbId: episode.id, - number: episode.episode_number, - title: episode.name, - releasedAt: episode.air_date, - })), + episodes: response.episodes.map( + (episode): TMDBParsedEpisode => ({ + tmdbId: episode.id, + number: episode.episode_number, + title: episode.name, + releasedAt: episode.air_date, + }), + ), } } diff --git a/packages/tmdb/src/tmdb.types.ts b/packages/tmdb/src/tmdb.types.ts new file mode 100644 index 00000000..751a842a --- /dev/null +++ b/packages/tmdb/src/tmdb.types.ts @@ -0,0 +1,50 @@ +import { type z } from 'zod' + +import { + type tmdbSeriesSchema, + type tmdbSearchSeriesSchema, + type tmdbEpisodeSchema, + type tmdbSeasonSchema, +} from './tmdb.schema' +import { + type tmdbSeriesSearchResponseSchema, + type tmdbSeriesResponseSchema, + type tmdbSeasonResponseSchema, +} from './tmdbRequests.schema' + +export type TMDBSearchResponse = z.infer + +export type TMDBSearchSeries = z.infer + +export type TMDBSeries = z.infer + +export type TMDBSeriesResponse = z.infer + +export type TMDBSeason = z.infer + +export type TMDBSeasonResponse = z.infer + +export type TMDBEpisode = z.infer + +export type TMDBParsedSeries = { + tmdbId: number + title: string + imdbId: string | null + poster: string | null + plot: string | null + startYear: number | null + endYear: number | null +} + +export type TMDBParsedSeason = { + number: number + tmdbId: number + title: string +} + +export type TMDBParsedEpisode = { + tmdbId: number + number: number + title: string + releasedAt: Date | null +} diff --git a/apps/api/src/features/series/__tests__/scopes.ts b/packages/tmdb/src/tmdbRequests.mock.ts similarity index 69% rename from apps/api/src/features/series/__tests__/scopes.ts rename to packages/tmdb/src/tmdbRequests.mock.ts index f6e2c21a..f99780b0 100644 --- a/apps/api/src/features/series/__tests__/scopes.ts +++ b/packages/tmdb/src/tmdbRequests.mock.ts @@ -1,15 +1,15 @@ import nock from 'nock' -import { config } from '#/config' +import { config } from './config' import { - type TMDbSearchResponse, - type TMDbSeriesResponse, - type TMDbSeasonResponse, -} from '#/features/tmdb' + type TMDBSearchResponse, + type TMDBSeriesResponse, + type TMDBSeasonResponse, +} from './tmdb.types' -export const mockTMDbSearchRequest = ( +export const mockTMDBSearchRequest = ( keyword: string, - response: Pick, + response: Pick, ) => { return nock(config.tmdb.url) .get('/3/search/tv') @@ -27,9 +27,9 @@ export const mockTMDbSearchRequest = ( }) } -export const mockTMDbDetailsRequest = ( +export const mockTMDBDetailsRequest = ( tmdbId: number, - response: TMDbSeriesResponse, + response: TMDBSeriesResponse, ) => { return nock(config.tmdb.url) .get(`/3/tv/${tmdbId}`) @@ -39,7 +39,7 @@ export const mockTMDbDetailsRequest = ( .reply(200, response) } -export const mockTMDbSeasonRequest = ( +export const mockTMDBSeasonRequest = ( { tmdbId, seasonNumber, @@ -47,7 +47,7 @@ export const mockTMDbSeasonRequest = ( tmdbId: number seasonNumber: number }, - response: TMDbSeasonResponse, + response: TMDBSeasonResponse, ) => nock(config.tmdb.url) .get(`/3/tv/${tmdbId}/season/${seasonNumber}`) diff --git a/packages/tmdb/src/tmdbRequests.schema.ts b/packages/tmdb/src/tmdbRequests.schema.ts new file mode 100644 index 00000000..6c2f6a1f --- /dev/null +++ b/packages/tmdb/src/tmdbRequests.schema.ts @@ -0,0 +1,24 @@ +import { z } from 'zod' + +import { + tmdbSeriesSchema, + tmdbSeasonSchema, + tmdbSearchSeriesSchema, +} from './tmdb.schema' + +export const tmdbNotFoundSchema = z.object({ + success: z.literal(false), + status_code: z.literal(34), + status_message: z.string(), +}) + +export const tmdbSeriesResponseSchema = tmdbSeriesSchema.or(tmdbNotFoundSchema) + +export const tmdbSeriesSearchResponseSchema = z.object({ + page: z.number(), + total_pages: z.number(), + total_results: z.number(), + results: z.array(tmdbSearchSeriesSchema), +}) + +export const tmdbSeasonResponseSchema = tmdbSeasonSchema.or(tmdbNotFoundSchema) diff --git a/packages/tmdb/src/tmdbSeriesDetails.factory.ts b/packages/tmdb/src/tmdbSeriesDetails.factory.ts new file mode 100644 index 00000000..ae6cae96 --- /dev/null +++ b/packages/tmdb/src/tmdbSeriesDetails.factory.ts @@ -0,0 +1,62 @@ +import { subDays } from 'date-fns' +import { Factory } from 'fishery' +import { nanoid } from 'nanoid' +import { type z } from 'zod' + +import { + type TMDBSeason, + type TMDBEpisode, + type TMDBSeries, +} from './tmdb.types' +import { type tmdbNotFoundSchema } from './tmdbRequests.schema' + +const generateRandomInt = (min: number, max: number) => { + return Math.floor(Math.random() * (max - min + 1) + min) +} + +export const tmdbSeriesDetailsFactory = Factory.define(() => ({ + id: generateRandomInt(1, 9999999), + name: 'Test Series', + poster_path: 'foo.jpg', + overview: 'Test plot.', + first_air_date: '2023-05-06', + + // Details + number_of_seasons: 0, + episode_run_time: [22], + last_air_date: null, + status: 'Returning Series', + seasons: [], + external_ids: { + imdb_id: `tt${nanoid(12)}`, + }, +})) + +export const tmdbEpisodeFactory = Factory.define( + ({ sequence }) => ({ + id: generateRandomInt(1, 9999999), + episode_number: sequence, + name: 'Test Episode', + air_date: subDays(new Date(Date.now()), 2), + }), +) + +export const tmdbSeasonFactory = Factory.define( + ({ sequence, params }) => ({ + id: generateRandomInt(1, 9999999), + season_number: sequence, + name: `Season ${params.season_number ?? sequence}`, + air_date: new Date(Date.now()), + + // Details + episodes: [], + }), +) + +export const tmdbNotFoundResponseFactory = Factory.define< + z.infer +>(() => ({ + status_code: 34, + success: false, + status_message: 'The resource you requested could not be found.', +})) diff --git a/packages/tmdb/tsconfig.json b/packages/tmdb/tsconfig.json new file mode 100644 index 00000000..b7ae5b01 --- /dev/null +++ b/packages/tmdb/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "@serieslist/typescript-config-base" +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c4cd369f..1ed57017 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -74,6 +74,9 @@ importers: '@serieslist/logger': specifier: workspace:* version: link:../../packages/logger + '@serieslist/tmdb': + specifier: workspace:* + version: link:../../packages/tmdb bcryptjs: specifier: ^2.4.3 version: 2.4.3 @@ -186,6 +189,9 @@ importers: '@vitest/coverage-v8': specifier: ^1.1.1 version: 1.1.1(vitest@1.1.1) + just-filter-object: + specifier: ^3.2.0 + version: 3.2.0 kysely-codegen: specifier: ^0.10.0 version: 0.10.0(kysely@0.27.0)(pg@8.10.0) @@ -554,6 +560,43 @@ importers: specifier: 2.8.4 version: 2.8.4 + packages/tmdb: + dependencies: + '@serieslist/logger': + specifier: workspace:^ + version: link:../logger + node-fetch: + specifier: ^3.3.1 + version: 3.3.1 + zod: + specifier: ^3.22.3 + version: 3.22.3 + devDependencies: + '@serieslist/eslint-config-base': + specifier: workspace:* + version: link:../eslint-config-base + '@serieslist/prettier-config': + specifier: workspace:* + version: link:../prettier-config + '@serieslist/typescript-config-base': + specifier: workspace:* + version: link:../typescript-config-base + date-fns: + specifier: ^2.30.0 + version: 2.30.0 + fishery: + specifier: ^2.2.2 + version: 2.2.2 + nanoid: + specifier: ^4.0.2 + version: 4.0.2 + nock: + specifier: ^13.3.1 + version: 13.3.1 + typescript: + specifier: ^5.3.3 + version: 5.3.3 + packages/type-utils: devDependencies: '@serieslist/eslint-config-base': @@ -9782,7 +9825,6 @@ packages: engines: {node: '>=0.11'} dependencies: '@babel/runtime': 7.22.6 - dev: false /dateformat@4.6.3: resolution: {integrity: sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA==} @@ -11211,7 +11253,6 @@ packages: resolution: {integrity: sha512-jeU0nDhPHJkupmjX+r9niKgVMTBDB8X+U/pktoGHAiWOSyNlMd0HhmqnjrpjUOCDPJYaSSu4Ze16h6dZOKSp2w==} dependencies: lodash.mergewith: 4.6.2 - dev: false /flat-cache@3.0.4: resolution: {integrity: sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==} @@ -12793,6 +12834,10 @@ packages: object.values: 1.1.6 dev: false + /just-filter-object@3.2.0: + resolution: {integrity: sha512-OeorYJxmp2zhy/0LxjS1UjbJ7XMY8M4gVa1RRKxnIVheCYmng2E2hE0lEbDGv4aRh/HI7FgNUXtOMnmNxpoXRQ==} + dev: true + /just-group-by@2.2.0: resolution: {integrity: sha512-brZocDSmkvDYc+FOr07GiTar4cp7K6OB9huVOrj5LX+iXfCe3hTvn2KGM811LE/SBQkCzuYDDEcG8HA/dKDrnw==} dev: false @@ -12948,7 +12993,6 @@ packages: /lodash.mergewith@4.6.2: resolution: {integrity: sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==} - dev: false /lodash.sortby@4.7.0: resolution: {integrity: sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==} @@ -13403,12 +13447,6 @@ packages: resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==} dev: true - /nanoid@3.3.6: - resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==} - engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} - hasBin: true - dev: true - /nanoid@3.3.7: resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} @@ -14136,7 +14174,7 @@ packages: resolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==} engines: {node: ^10 || ^12 || >=14} dependencies: - nanoid: 3.3.6 + nanoid: 3.3.7 picocolors: 1.0.0 source-map-js: 1.0.2 dev: true