fix: revert back to using typed documents for GraphQL

This commit is contained in:
2025-12-18 08:43:26 -05:00
parent dc60a1e045
commit 4c2d0a9177
3 changed files with 7 additions and 2 deletions

View File

@@ -31,6 +31,7 @@
},
"devDependencies": {
"@cloudflare/vitest-pool-workers": "^0.10.15",
"@graphql-typed-document-node/core": "^3.2.0",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/lodash.mapkeys": "^4.6.9",
"@types/luxon": "^3.6.2",

3
pnpm-lock.yaml generated
View File

@@ -47,6 +47,9 @@ importers:
"@cloudflare/vitest-pool-workers":
specifier: ^0.10.15
version: 0.10.15(@vitest/runner@3.2.4)(@vitest/snapshot@3.2.4)(vitest@3.2.4)
"@graphql-typed-document-node/core":
specifier: ^3.2.0
version: 3.2.0(graphql@16.12.0)
"@trivago/prettier-plugin-sort-imports":
specifier: ^4.3.0
version: 4.3.0(prettier@3.7.4)

View File

@@ -1,3 +1,4 @@
import type { TypedDocumentNode } from "@graphql-typed-document-node/core";
import { DurableObject } from "cloudflare:workers";
import { print } from "graphql";
import { z } from "zod";
@@ -271,7 +272,7 @@ export class AnilistDurableObject extends DurableObject {
}
async fetchFromAnilist<Result = any, Variables = any>(
queryString: string,
query: TypedDocumentNode<Result, Variables>,
variables: Variables,
token?: string | undefined,
): Promise<Result> {
@@ -285,7 +286,7 @@ export class AnilistDurableObject extends DurableObject {
// Use the query passed in, or fallback if needed (though we expect it to be passed)
// We print the query to string
// const queryString = print(query);
const queryString = print(query);
const response = await fetch(`${this.env.PROXY_URL}/proxy`, {
method: "POST",