fix some fields not creating subfields

This commit is contained in:
DrakeTDL 2023-10-09 16:05:36 -07:00
parent 65b925f260
commit 4f7d744afa
No known key found for this signature in database
1 changed files with 26 additions and 21 deletions

View File

@ -398,7 +398,7 @@ const Markdown = ({ query, level }: Fields<typeof updateOperation>) => ({
})
const AniChartUser = ({ query, level }: Fields<typeof updateOperation>) => ({
withUser(fn: Fn<typeof User>) {
query[0] = query[0].set({ subField: "user", level })
query[0] = query[0].set({ subField: "user", level, hasSubField: true })
let tmpQuery
fn(User({ query: tmpQuery = [query[0]], level: level + 1 }))
query[0] = tmpQuery[0]
@ -572,7 +572,7 @@ const ActivityReply = ({ query, level }: Fields<typeof updateOperation>) => ({
const MediaListGroup = ({ query, level }: Fields<typeof updateOperation>) => ({
/** Media list entries */
withEntries(fn: (fields: ReturnType<typeof MediaList>) => void) {
query[0] = query[0].set({ subField: "entries", level })
query[0] = query[0].set({ subField: "entries", level, hasSubField: true })
let tmpQuery
fn(MediaList({ query: tmpQuery = [query[0]], level: level + 1 }))
query[0] = tmpQuery[0]
@ -598,7 +598,7 @@ const MediaListGroup = ({ query, level }: Fields<typeof updateOperation>) => ({
const MediaListCollection = ({ query, level }: Fields<typeof updateOperation>) => ({
/** Grouped media list entries */
withLists(fn: (fields: ReturnType<typeof MediaListGroup>) => void) {
query[0] = query[0].set({ subField: "lists", level })
query[0] = query[0].set({ subField: "lists", level, hasSubField: true })
let tmpQuery
fn(MediaListGroup({ query: tmpQuery = [query[0]], level: level + 1 }))
query[0] = tmpQuery[0]
@ -825,7 +825,7 @@ const Thread = ({ query, level }: Fields<typeof updateOperation>) => ({
},
/** The owner of the thread */
withUser(fn?: (fields: ReturnType<typeof User>) => void) {
query[0] = query[0].set({ subField: "user", level })
query[0] = query[0].set({ subField: "user", level, hasSubField: true })
if (!fn) query[0] = query[0].set({ subField: "id", level: level + 1 })
else {
let tmpQuery
@ -836,7 +836,7 @@ const Thread = ({ query, level }: Fields<typeof updateOperation>) => ({
},
/** The user to last reply to the thread */
withReplyUser(fn?: (fields: ReturnType<typeof User>) => void) {
query[0] = query[0].set({ subField: "replayUser", level })
query[0] = query[0].set({ subField: "replayUser", level, hasSubField: true })
if (!fn) query[0] = query[0].set({ subField: "id", level: level + 1 })
else {
let tmpQuery
@ -847,7 +847,7 @@ const Thread = ({ query, level }: Fields<typeof updateOperation>) => ({
},
/** The users who liked the thread */
withLikes(fn?: (fields: ReturnType<typeof User>) => void) {
query[0] = query[0].set({ subField: "likes", level })
query[0] = query[0].set({ subField: "likes", level, hasSubField: true })
if (!fn) query[0] = query[0].set({ subField: "id", level: level + 1 })
else {
let tmpQuery
@ -873,7 +873,7 @@ const Thread = ({ query, level }: Fields<typeof updateOperation>) => ({
},
/** The media categories of the thread */
withMediaCategories(fn: (fields: ReturnType<typeof Media>) => void) {
query[0] = query[0].set({ subField: "mediaCategories", level })
query[0] = query[0].set({ subField: "mediaCategories", level, hasSubField: true })
let tmpQuery
fn(Media({ query: tmpQuery = [query[0]], level: level + 1 }))
query[0] = tmpQuery[0]
@ -954,7 +954,7 @@ const ThreadComment = (query: ReturnType<typeof updateOperation>[], level: numbe
},
/** The user who created the comment */
withUser(fn?: (fields: ReturnType<typeof User>) => void) {
query[0] = query[0].set({ subField: "user", level })
query[0] = query[0].set({ subField: "user", level, hasSubField: true })
if (!fn) query[0] = query[0].set({ subField: "id", level: level + 1 })
else {
let tmpQuery
@ -965,7 +965,7 @@ const ThreadComment = (query: ReturnType<typeof updateOperation>[], level: numbe
},
/** The users who liked the comment */
withLikes(fn?: (fields: ReturnType<typeof User>) => void) {
query[0] = query[0].set({ subField: "likes", level })
query[0] = query[0].set({ subField: "likes", level, hasSubField: true })
if (!fn) query[0] = query[0].set({ subField: "id", level: level + 1 })
else {
let tmpQuery
@ -1151,8 +1151,11 @@ const Media = ({ query, level }: Fields<typeof updateOperation>) => ({
return this
},
/** The media's next episode airing schedule */
withNextAiringEpisode() {
query[0] = query[0].set({ subField: "nextAiringEpisode", level })
withNextAiringEpisode(fn: (fields: ReturnType<typeof AiringSchedule>) => void) {
query[0] = query[0].set({ subField: "nextAiringEpisode", level, hasSubField: true })
let tmpQuery
fn(AiringSchedule({ query: tmpQuery = [query[0]], level: level + 1 }))
query[0] = tmpQuery[0]
return this
},
/** The url for the media page on the AniList website */
@ -1200,7 +1203,7 @@ const Media = ({ query, level }: Fields<typeof updateOperation>) => ({
args: MediaStaffArgs | undefined,
fn: (fields: ReturnType<typeof StaffConnection>) => void,
) {
query[0] = query[0].set({ subField: "staff", level, variables: args })
query[0] = query[0].set({ subField: "staff", level, variables: args, hasSubField: true })
let tmpQuery
fn(StaffConnection({ query: tmpQuery = [query[0]], level: level + 1 }))
query[0] = tmpQuery[0]
@ -1215,6 +1218,7 @@ const Media = ({ query, level }: Fields<typeof updateOperation>) => ({
subField: "recommendations",
level,
variables: args,
hasSubField: true,
})
let tmpQuery
fn(RecommendationConnection({ query: tmpQuery = [query[0]], level: level + 1 }))
@ -1254,6 +1258,7 @@ const Media = ({ query, level }: Fields<typeof updateOperation>) => ({
subField: "airingSchedule",
level,
variables: args,
hasSubField: true,
})
let tmpQuery
fn(AiringScheduleConnection({ query: tmpQuery = [query[0]], level: level + 1 }))
@ -1276,7 +1281,7 @@ const Media = ({ query, level }: Fields<typeof updateOperation>) => ({
args: MediaReviewsArgs | undefined,
fn: (fields: ReturnType<typeof ReviewConnection>) => void,
) {
query[0] = query[0].set({ subField: "reviews", level, variables: args })
query[0] = query[0].set({ subField: "reviews", level, variables: args, hasSubField: true })
let tmpQuery
fn(ReviewConnection({ query: tmpQuery = [query[0]], level: level + 1 }))
query[0] = tmpQuery[0]
@ -1292,7 +1297,7 @@ const Media = ({ query, level }: Fields<typeof updateOperation>) => ({
},
/** The first official release date of the media */
withStartDate(fn: (fields: ReturnType<typeof FuzzyDate>) => void) {
query[0] = query[0].set({ subField: "startDate", level })
query[0] = query[0].set({ subField: "startDate", level, hasSubField: true })
let tmpQuery
fn(FuzzyDate({ query: tmpQuery = [query[0]], level: level + 1 }))
query[0] = tmpQuery[0]
@ -1300,7 +1305,7 @@ const Media = ({ query, level }: Fields<typeof updateOperation>) => ({
},
/** The last official release date of the media */
withEndDate(fn: (fields: ReturnType<typeof FuzzyDate>) => void) {
query[0] = query[0].set({ subField: "endDate", level })
query[0] = query[0].set({ subField: "endDate", level, hasSubField: true })
let tmpQuery
fn(FuzzyDate({ query: tmpQuery = [query[0]], level: level + 1 }))
query[0] = tmpQuery[0]
@ -1316,7 +1321,7 @@ const Media = ({ query, level }: Fields<typeof updateOperation>) => ({
},
/** The cover images of the media */
withCoverImage(fn: (fields: ReturnType<typeof MediaCoverImage>) => void) {
query[0] = query[0].set({ subField: "coverImage", level })
query[0] = query[0].set({ subField: "coverImage", level, hasSubField: true })
let tmpQuery
fn(MediaCoverImage({ query: tmpQuery = [query[0]], level: level + 1 }))
query[0] = tmpQuery[0]
@ -1332,7 +1337,7 @@ const Media = ({ query, level }: Fields<typeof updateOperation>) => ({
},
/** Other media in the same or connecting franchise */
withRelations(fn: (fields: ReturnType<typeof MediaConnection>) => void) {
query[0] = query[0].set({ subField: "relations", level })
query[0] = query[0].set({ subField: "relations", level, hasSubField: true })
let tmpQuery
fn(MediaConnection({ query: tmpQuery = [query[0]], level: level + 1 }))
query[0] = tmpQuery[0]
@ -1342,7 +1347,7 @@ const Media = ({ query, level }: Fields<typeof updateOperation>) => ({
withExternalLinks(
fn: (fields: ReturnType<typeof MediaExternalLink>) => void,
) {
query[0] = query[0].set({ subField: "externalLinks", level })
query[0] = query[0].set({ subField: "externalLinks", level, hasSubField: true })
let tmpQuery
fn(MediaExternalLink({ query: tmpQuery = [query[0]], level: level + 1 }))
query[0] = tmpQuery[0]
@ -1360,7 +1365,7 @@ const Media = ({ query, level }: Fields<typeof updateOperation>) => ({
},
/** The ranking of the media in a particular time span and format compared to other media */
withRankings(fn: (fields: ReturnType<typeof MediaRank>) => void) {
query[0] = query[0].set({ subField: "rankings", level })
query[0] = query[0].set({ subField: "rankings", level, hasSubField: true })
let tmpQuery
fn(MediaRank({ query: tmpQuery = [query[0]], level: level + 1 }))
query[0] = tmpQuery[0]
@ -1370,14 +1375,14 @@ const Media = ({ query, level }: Fields<typeof updateOperation>) => ({
withMediaListEntry(
fn: (fields: ReturnType<typeof MediaList>) => void,
) {
query[0] = query[0].set({ subField: "mediaListEntry", level })
query[0] = query[0].set({ subField: "mediaListEntry", level, hasSubField: true })
let tmpQuery
fn(MediaList({ query: tmpQuery = [query[0]], level: level + 1 }))
query[0] = tmpQuery[0]
return this
},
withStats(fn: (fields: ReturnType<typeof MediaStats>) => void) {
query[0] = query[0].set({ subField: "stats", level })
query[0] = query[0].set({ subField: "stats", level, hasSubField: true })
let tmpQuery
fn(MediaStats({ query: tmpQuery = [query[0]], level: level + 1 }))
query[0] = tmpQuery[0]