@labdigital/graphql-fetcher
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

@labdigital/graphql-fetcher

Opinionated fetch wrappers for our client and server side queries in our Next.js frontends. Only used for fetching from GraphQL endpoints.

Features

  • GraphQL support using TypedDocumentString as the query
  • Persisted queries support using either pregenerated hashes or on the fly hashing
  • Fallback when persisted query fails
  • Client fetcher with React context support when the endpoint is only known at runtime
  • Next data cache support

Notes

Node 18.x requires webcrypto on globalThis

From node 20.x onwards the WebCrypto API is available on globalThis, versions before 20.x will need a small polyfill:

	if (typeof window === "undefined" && !globalThis.crypto) {
		globalThis.crypto = require("node:crypto").webcrypto;
	}

Readme

Keywords

Package Sidebar

Install

npm i @labdigital/graphql-fetcher

Weekly Downloads

601

Version

1.0.1

License

MIT

Unpacked Size

81.7 kB

Total Files

22

Last publish

Collaborators

  • pimvernooij
  • mvantellingen
  • korsvanloon
  • blurrah
  • bramkaashoek