{"id":15506024,"url":"https://github.com/mxstbr/urql-exchange-schema","last_synced_at":"2025-07-26T20:14:39.560Z","repository":{"id":52614312,"uuid":"197169715","full_name":"mxstbr/urql-exchange-schema","owner":"mxstbr","description":"Hey Berlin! This is new","archived":false,"fork":false,"pushed_at":"2020-02-20T09:40:52.000Z","size":103,"stargazers_count":32,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-20T07:59:58.791Z","etag":null,"topics":["graphql","urql","wonka"],"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/mxstbr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-16T10:07:24.000Z","updated_at":"2023-12-11T10:25:55.000Z","dependencies_parsed_at":"2022-09-25T03:01:23.090Z","dependency_job_id":null,"html_url":"https://github.com/mxstbr/urql-exchange-schema","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mxstbr%2Furql-exchange-schema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mxstbr%2Furql-exchange-schema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mxstbr%2Furql-exchange-schema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mxstbr%2Furql-exchange-schema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mxstbr","download_url":"https://codeload.github.com/mxstbr/urql-exchange-schema/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250354301,"owners_count":21416751,"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":["graphql","urql","wonka"],"created_at":"2024-10-02T09:25:14.404Z","updated_at":"2025-04-23T01:55:49.745Z","avatar_url":"https://github.com/mxstbr.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `urql-exchange-schema`\n\nFetch data from a local GraphQL schema with [urql](https://github.com/FormidableLabs/urql). Useful for testing apps using urql.\n\n```\nnpm install urql-exchange-schema\n```\n\n## Usage\n\n```JS\nimport { createClient } from 'urql';\nimport { schemaExchange } from 'urql-exchange-schema';\n\nconst client = createClient({\n  url: '', // note that this will not be used, but is required by createClient so just pass anything into here\n  exchanges: [schemaExchange(schema)]\n});\n```\n\nThis is useful for testing your apps using urql. Instead of mocking `window.fetch`, you can mock your entire GraphQL schema and get sensible responses for any query with `graphql-tools`!\n\n```JS\nimport { Provider, createClient } from 'urql';\nimport { schemaExchange } from 'urql-exchange-schema';\nimport { makeExecutableSchema, addMockFunctionsToSchema } from \"graphql-tools\";\n\n// Create your schema and add mock functions to it\nconst schema = makeExecutableSchema({ typeDefs: yourTypeDefs });\naddMockFunctionsToSchema({\n  schema,\n  mocks: yourMockFunctions,\n});\n\n// Pass the mock schema to the schemaExchange\nconst client = createClient({\n  url: '',\n  exchanges: [schemaExchange(schema)]\n});\n\n// Now you can test all your components that fetch data!\nit('should fetch some data', () =\u003e {\n  const bla = render(\n    \u003cProvider client={client}\u003e\n      \u003cSomeComponentThatFetchesData /\u003e\n    \u003c/Provider\u003e\n  )\n})\n```\n\n## Contributing\n\nThis package uses [tsdx](https://github.com/palmerhq/tsdx) for development. Below is a list of commands you will probably find useful.\n\n- `npm run dev`: Runs the project in development/watch mode.\n- `npm run build`: Bundles the package to the `dist` folder.\n- `npm run test`: Runs tests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmxstbr%2Furql-exchange-schema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmxstbr%2Furql-exchange-schema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmxstbr%2Furql-exchange-schema/lists"}