{"id":18930107,"url":"https://github.com/labd/node-graphql-fetcher","last_synced_at":"2026-04-01T20:03:45.608Z","repository":{"id":208211241,"uuid":"716678792","full_name":"labd/node-graphql-fetcher","owner":"labd","description":"node-graphql-fetcher","archived":false,"fork":false,"pushed_at":"2024-04-22T13:53:32.000Z","size":162,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-05-01T09:49:12.369Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/labd.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-09T16:33:11.000Z","updated_at":"2024-07-18T16:25:33.057Z","dependencies_parsed_at":"2024-03-19T11:34:56.286Z","dependency_job_id":"b41c3a10-4423-46c2-8fac-140878ecf112","html_url":"https://github.com/labd/node-graphql-fetcher","commit_stats":null,"previous_names":["labd/react-query-opal","labd/node-graphql-fetcher"],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labd%2Fnode-graphql-fetcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labd%2Fnode-graphql-fetcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labd%2Fnode-graphql-fetcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labd%2Fnode-graphql-fetcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/labd","download_url":"https://codeload.github.com/labd/node-graphql-fetcher/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239786250,"owners_count":19696772,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T11:36:33.635Z","updated_at":"2026-04-01T20:03:45.577Z","avatar_url":"https://github.com/labd.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @labdigital/graphql-fetcher\n\u003ca href=\"https://npm.im/@labdigital/graphql-fetcher\"\u003e\u003cimg src=\"https://badgen.net/npm/v/@labdigital/graphql-fetcher\"\u003e\u003c/a\u003e \u003ca href=\"https://npm.im/@labdigital/graphql-fetcher\"\u003e\n\nOpinionated `fetch` wrappers for our client and server side queries in our Next.js frontends.\nOnly used for fetching from GraphQL endpoints.\n\n## Features\n\n- GraphQL support using `TypedDocumentString` as the query\n- Persisted queries support using either pregenerated hashes or on the fly hashing\n- Fallback when persisted query fails\n- Client fetcher with React context support when the endpoint is only known at runtime\n- Next data cache support\n\n\n## Usage\n\n```ts\nimport { initClientFetcher } from \"@labdigital/graphql-fetcher\";\n\nconst fetcher = initClientFetcher(\"https://localhost/graphql\");\n\nconst gqlResponse = await fetcher(query, {\n\tmyVar: \"baz\",\n}, {\n\tsignal: AbortSignal.timeout(10),\n\theaders: {\n\t\t\"X-extra-header\": \"foo\",\n\t}\n});\n```\n\n## Notes\n\n### Node 18.x requires webcrypto on globalThis\n\nFrom node 20.x onwards the WebCrypto API is available on globalThis, versions before 20.x will need a small polyfill:\n\n```\n\tif (typeof window === \"undefined\" \u0026\u0026 !globalThis.crypto) {\n\t\tglobalThis.crypto = require(\"node:crypto\").webcrypto;\n\t}\n```\n\n### Old browsers might need a AbortSignal.timeout() polyfill\n\nOld browsers might not have AbortSignal.timeout() available. We do not support these versions but you can add a polyfill using the following code:\n\n```typescript\n// Polyfill for AbortSignal.timeout() for older browsers\nif (typeof AbortSignal !== \"undefined\" \u0026\u0026 !AbortSignal.timeout) {\n\tAbortSignal.timeout = function timeout(ms: number) {\n\t\tconst controller = new AbortController();\n\t\tsetTimeout(() =\u003e controller.abort(), ms);\n\t\treturn controller.signal;\n\t};\n}\n\nexport {};\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabd%2Fnode-graphql-fetcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flabd%2Fnode-graphql-fetcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabd%2Fnode-graphql-fetcher/lists"}