From 79a525cbd3882fb56e7555ad0268f1fe70a8caef Mon Sep 17 00:00:00 2001 From: Tony Date: Wed, 25 Mar 2026 18:34:13 +0800 Subject: [PATCH] refactor: add GraphQL annotation to queries for auto formatting in oxfmt v0.42 0fe46fe3333774dbea22d9e9f5f273be92387cd9 --- lib/routes/afr/query.ts | 4 ++-- lib/routes/behance/queries.ts | 6 +++--- lib/routes/fantube/utils.ts | 2 +- lib/routes/komiic/comic.ts | 4 ++-- lib/routes/leetcode/articles.ts | 4 ++-- lib/routes/leetcode/dailyquestion-cn.ts | 4 ++-- lib/routes/leetcode/dailyquestion-en.ts | 4 ++-- lib/routes/leetcode/dailyquestion-solution-cn.ts | 8 ++++---- lib/routes/leetcode/dailyquestion-solution-en.ts | 8 ++++---- lib/routes/matters/author.ts | 2 +- lib/routes/matters/latest.ts | 2 +- lib/routes/matters/tags.ts | 2 +- lib/routes/medium/graphql.ts | 8 ++++---- lib/routes/mixcloud/index.ts | 2 +- lib/routes/sustainabilitymag/articles.ts | 2 +- 15 files changed, 31 insertions(+), 31 deletions(-) diff --git a/lib/routes/afr/query.ts b/lib/routes/afr/query.ts index a596f8fc4..6e9a74a42 100644 --- a/lib/routes/afr/query.ts +++ b/lib/routes/afr/query.ts @@ -1,4 +1,4 @@ -export const pageByNavigationPathQuery = `query pageByNavigationPath( +export const pageByNavigationPathQuery = /* GraphQL */ `query pageByNavigationPath( $input: PageByNavigationPathInput! $firstStories: Int $afterStories: Cursor @@ -216,7 +216,7 @@ export const pageByNavigationPathQuery = `query pageByNavigationPath( } }`; -export const assetsConnectionByCriteriaQuery = `query assetsConnectionByCriteria( +export const assetsConnectionByCriteriaQuery = /* GraphQL */ `query assetsConnectionByCriteria( $after: ID $brand: Brand! $categories: [Int!] diff --git a/lib/routes/behance/queries.ts b/lib/routes/behance/queries.ts index d8101162c..cc85c54c0 100644 --- a/lib/routes/behance/queries.ts +++ b/lib/routes/behance/queries.ts @@ -1,4 +1,4 @@ -export const getProfileProjectsAndSelectionsQuery = `query GetProfileProjectsAndSections($username: String, $after: String) { +export const getProfileProjectsAndSelectionsQuery = /* GraphQL */ `query GetProfileProjectsAndSections($username: String, $after: String) { user(username: $username) { hasPortfolio profileSections { @@ -172,7 +172,7 @@ export const getProfileProjectsAndSelectionsQuery = `query GetProfileProjectsAnd userId }`; -export const getAppreciatedQuery = `query GetAppreciatedProjects($username: String, $after: String) { +export const getAppreciatedQuery = /* GraphQL */ `query GetAppreciatedProjects($username: String, $after: String) { user(username: $username) { appreciatedProjects(first: 24, after: $after) { nodes { @@ -247,7 +247,7 @@ export const getAppreciatedQuery = `query GetAppreciatedProjects($username: Stri } }`; -export const getProjectPageQuery = `query ProjectPage($projectId: ProjectId!, $projectPassword: String) { +export const getProjectPageQuery = /* GraphQL */ `query ProjectPage($projectId: ProjectId!, $projectPassword: String) { viewer { ...Project_Viewer } diff --git a/lib/routes/fantube/utils.ts b/lib/routes/fantube/utils.ts index bd303aec8..6c312bf43 100644 --- a/lib/routes/fantube/utils.ts +++ b/lib/routes/fantube/utils.ts @@ -39,7 +39,7 @@ export const getCreatorPostReelList = (identifier: string, limit: number): Promi Referer: baseUrl, }, body: JSON.stringify({ - query: `query CreatorPostReelList($identifier: String!, $first: Int, $after: String, $last: Int, $before: String) { + query: /* GraphQL */ `query CreatorPostReelList($identifier: String!, $first: Int, $after: String, $last: Int, $before: String) { posts( where: {status: {equals: PUBLISHED}, creator: {is: {identifier: {equals: $identifier}}}} orderBy: [{pinnedAt: {nulls: last, sort: desc}}, {order: asc}, {createdAt: desc}, {id: desc}] diff --git a/lib/routes/komiic/comic.ts b/lib/routes/komiic/comic.ts index 8f71776e6..a4d964be1 100644 --- a/lib/routes/komiic/comic.ts +++ b/lib/routes/komiic/comic.ts @@ -36,7 +36,7 @@ async function handler(ctx) { json: { operationName: 'comicById', variables: { comicId: id }, - query: `query comicById($comicId: ID!) { + query: /* GraphQL */ `query comicById($comicId: ID!) { comicById(comicId: $comicId) { title imageUrl @@ -51,7 +51,7 @@ async function handler(ctx) { json: { operationName: 'chapterByComicId', variables: { comicId: id }, - query: `query chapterByComicId($comicId: ID!) { + query: /* GraphQL */ `query chapterByComicId($comicId: ID!) { chaptersByComicId(comicId: $comicId) { id serial diff --git a/lib/routes/leetcode/articles.ts b/lib/routes/leetcode/articles.ts index 81ea8ab78..c3c536f39 100644 --- a/lib/routes/leetcode/articles.ts +++ b/lib/routes/leetcode/articles.ts @@ -66,7 +66,7 @@ async function handler() { body: { operationName: 'questionContent', variables: { titleSlug }, - query: `query questionContent($titleSlug: String!) { + query: /* GraphQL */ `query questionContent($titleSlug: String!) { question(titleSlug: $titleSlug) { content mysqlSchemas @@ -81,7 +81,7 @@ async function handler() { body: { operationName: 'officialSolution', variables: { titleSlug }, - query: `query officialSolution($titleSlug: String!) { + query: /* GraphQL */ `query officialSolution($titleSlug: String!) { question(titleSlug: $titleSlug) { solution { content diff --git a/lib/routes/leetcode/dailyquestion-cn.ts b/lib/routes/leetcode/dailyquestion-cn.ts index e0ccacbc1..e714f884a 100644 --- a/lib/routes/leetcode/dailyquestion-cn.ts +++ b/lib/routes/leetcode/dailyquestion-cn.ts @@ -30,7 +30,7 @@ async function handler() { }; const url = host + '/graphql'; const dailyQuestionPayload = { - query: `query questionOfToday { + query: /* GraphQL */ `query questionOfToday { todayRecord { date question { @@ -56,7 +56,7 @@ async function handler() { const detailsPayload = { operationName: 'questionData', - query: `query questionData($titleSlug: String!) { + query: /* GraphQL */ `query questionData($titleSlug: String!) { question(titleSlug: $titleSlug) { questionId questionFrontendId diff --git a/lib/routes/leetcode/dailyquestion-en.ts b/lib/routes/leetcode/dailyquestion-en.ts index cf94c4bf4..e4f9f6c02 100644 --- a/lib/routes/leetcode/dailyquestion-en.ts +++ b/lib/routes/leetcode/dailyquestion-en.ts @@ -30,7 +30,7 @@ async function handler() { }; const url = host + '/graphql'; const dailyQuestionPayload = { - query: `query questionOfToday { + query: /* GraphQL */ `query questionOfToday { activeDailyCodingChallengeQuestion { date link @@ -57,7 +57,7 @@ async function handler() { const detailsPayload = { operationName: 'questionData', - query: `query questionData($titleSlug: String!) { + query: /* GraphQL */ `query questionData($titleSlug: String!) { question(titleSlug: $titleSlug) { questionId questionFrontendId diff --git a/lib/routes/leetcode/dailyquestion-solution-cn.ts b/lib/routes/leetcode/dailyquestion-solution-cn.ts index 8e573b10e..c4538ad6f 100644 --- a/lib/routes/leetcode/dailyquestion-solution-cn.ts +++ b/lib/routes/leetcode/dailyquestion-solution-cn.ts @@ -41,7 +41,7 @@ async function handler() { url, json: { operationName: 'questionOfToday', - query: `query questionOfToday { + query: /* GraphQL */ `query questionOfToday { todayRecord { date userStatus @@ -70,7 +70,7 @@ async function handler() { url, json: { operationName: 'questionData', - query: `query questionData($titleSlug: String!) { + query: /* GraphQL */ `query questionData($titleSlug: String!) { question(titleSlug: $titleSlug) { questionId questionFrontendId @@ -101,7 +101,7 @@ async function handler() { url, json: { operationName: 'questionSolutionArticles', - query: `query questionSolutionArticles($questionSlug: String!, $skip: Int, $first: Int, $orderBy: SolutionArticleOrderBy, $userInput: String, $tagSlugs: [String!]) { + query: /* GraphQL */ `query questionSolutionArticles($questionSlug: String!, $skip: Int, $first: Int, $orderBy: SolutionArticleOrderBy, $userInput: String, $tagSlugs: [String!]) { questionSolutionArticles(questionSlug: $questionSlug, skip: $skip, first: $first, orderBy: $orderBy, userInput: $userInput, tagSlugs: $tagSlugs) { totalNum edges { @@ -144,7 +144,7 @@ async function handler() { url, json: { operationName: 'solutionDetailArticle', - query: `query solutionDetailArticle($slug: String!, $orderBy: SolutionArticleOrderBy!) { + query: /* GraphQL */ `query solutionDetailArticle($slug: String!, $orderBy: SolutionArticleOrderBy!) { solutionArticle(slug: $slug, orderBy: $orderBy) { ...solutionArticle content diff --git a/lib/routes/leetcode/dailyquestion-solution-en.ts b/lib/routes/leetcode/dailyquestion-solution-en.ts index 8155c8a57..f7c7b698a 100644 --- a/lib/routes/leetcode/dailyquestion-solution-en.ts +++ b/lib/routes/leetcode/dailyquestion-solution-en.ts @@ -42,7 +42,7 @@ async function handler() { url, json: { operationName: 'questionOfToday', - query: `query questionOfToday { + query: /* GraphQL */ `query questionOfToday { activeDailyCodingChallengeQuestion { date link @@ -67,7 +67,7 @@ async function handler() { url, json: { operationName: 'questionData', - query: `query questionData($titleSlug: String!) { + query: /* GraphQL */ `query questionData($titleSlug: String!) { question(titleSlug: $titleSlug) { questionId questionFrontendId @@ -98,7 +98,7 @@ async function handler() { url, json: { operationName: 'QuestionNote', - query: `query QuestionNote($titleSlug: String!) { + query: /* GraphQL */ `query QuestionNote($titleSlug: String!) { question(titleSlug: $titleSlug) { questionId article @@ -172,7 +172,7 @@ async function handler() { url, json: { operationName: 'fetchPlayground', - query: `query fetchPlayground { + query: /* GraphQL */ `query fetchPlayground { playground(uuid: "${uuid}") { testcaseInput name diff --git a/lib/routes/matters/author.ts b/lib/routes/matters/author.ts index 60b73d924..b428d4e42 100644 --- a/lib/routes/matters/author.ts +++ b/lib/routes/matters/author.ts @@ -9,7 +9,7 @@ const handler = async (ctx) => { const response = await ofetch(gqlEndpoint, { method: 'POST', body: { - query: `{ + query: /* GraphQL */ `{ user(input: {userName: "${uid}"}) { displayName avatar diff --git a/lib/routes/matters/latest.ts b/lib/routes/matters/latest.ts index 3bfd12d70..0adf0c90c 100644 --- a/lib/routes/matters/latest.ts +++ b/lib/routes/matters/latest.ts @@ -24,7 +24,7 @@ const handler = async (ctx) => { const response = await ofetch(gqlEndpoint, { method: 'POST', body: { - query: `{ + query: /* GraphQL */ `{ viewer { recommendation { feed: ${options[type].apiType}(input: {first: ${limit}}) { diff --git a/lib/routes/matters/tags.ts b/lib/routes/matters/tags.ts index 1ecc26c7e..baae145ee 100644 --- a/lib/routes/matters/tags.ts +++ b/lib/routes/matters/tags.ts @@ -35,7 +35,7 @@ const handler = async (ctx) => { const gqlResponse = await ofetch(gqlEndpoint, { method: 'POST', body: { - query: `{ + query: /* GraphQL */ `{ node(input: {id: "${tagId}"}) { ... on Tag { content diff --git a/lib/routes/medium/graphql.ts b/lib/routes/medium/graphql.ts index 4043e1f06..171d38887 100644 --- a/lib/routes/medium/graphql.ts +++ b/lib/routes/medium/graphql.ts @@ -57,7 +57,7 @@ function newFollowingFeedQuery(pagingLimit = 5) { limit: pagingLimit, }, }, - query: `query LegacyFollowingFeedQuery($paging: PagingOptions) { + query: /* GraphQL */ `query LegacyFollowingFeedQuery($paging: PagingOptions) { followingFeed(paging: $paging) { items { feedId @@ -92,7 +92,7 @@ function newWebInlineRecommendedFeedQuery(pagingLimit = 5) { limit: pagingLimit, }, }, - query: `query LegacyWebInlineRecommendedFeedQuery($paging: PagingOptions, $forceRank: Boolean) { + query: /* GraphQL */ `query LegacyWebInlineRecommendedFeedQuery($paging: PagingOptions, $forceRank: Boolean) { webRecommendedFeed(paging: $paging, forceRank: $forceRank) { items { feedId @@ -127,7 +127,7 @@ function newWebInlineTopicFeedQuery(tagSlug, pagingLimit = 5) { }, skipCache: true, }, - query: `query LegacyWebInlineTopicFeedQuery($tagSlug: String!, $paging: PagingOptions!, $skipCache: Boolean) { + query: /* GraphQL */ `query LegacyWebInlineTopicFeedQuery($tagSlug: String!, $paging: PagingOptions!, $skipCache: Boolean) { personalisedTagFeed(tagSlug: $tagSlug, paging: $paging, skipCache: $skipCache) { items { feedId @@ -162,7 +162,7 @@ function newUserCatalogMainContentQuery(catalogId, pagingLimit = 20) { limit: pagingLimit, }, }, - query: `query UserCatalogMainContentQuery($catalogId: ID!, $pagingOptions: CatalogPagingOptionsInput!) { + query: /* GraphQL */ `query UserCatalogMainContentQuery($catalogId: ID!, $pagingOptions: CatalogPagingOptionsInput!) { catalogById(catalogId: $catalogId) { __typename ... on Catalog { diff --git a/lib/routes/mixcloud/index.ts b/lib/routes/mixcloud/index.ts index 9dd16235e..1e4295a69 100644 --- a/lib/routes/mixcloud/index.ts +++ b/lib/routes/mixcloud/index.ts @@ -44,7 +44,7 @@ async function callApi(objectType: string, objectFields: string, username: strin const headers = MIXCLOUD_CONFIG.headers; const lookupParams = slug ? `, slug: "${slug}"` : ''; - const query = `{ + const query = /* GraphQL */ `{ ${lookupKey}(lookup: {username: "${username}"${lookupParams}}) { ${objectFields} } diff --git a/lib/routes/sustainabilitymag/articles.ts b/lib/routes/sustainabilitymag/articles.ts index 69637e88f..fe7d3cb79 100644 --- a/lib/routes/sustainabilitymag/articles.ts +++ b/lib/routes/sustainabilitymag/articles.ts @@ -71,7 +71,7 @@ async function handler() { const requestEndpoint = `${baseURL}/graphql`; const requestBody = JSON.stringify({ - query: `query PaginatedQuery($url: String!, $page: Int = 1, $widgetType: String!) { + query: /* GraphQL */ `query PaginatedQuery($url: String!, $page: Int = 1, $widgetType: String!) { paginatedWidget(url: $url, widgetType: $widgetType) { ... on SimpleArticleGridWidget { articles(page: $page) {