{"_id":"@alfonsoperez/apollo-link-rest-fork","_rev":"2-59d9945f160ed86fd2f805c57dbff982","name":"@alfonsoperez/apollo-link-rest-fork","dist-tags":{"latest":"0.8.0-beta.0"},"versions":{"0.8.0-beta.0":{"name":"@alfonsoperez/apollo-link-rest-fork","version":"0.8.0-beta.0","description":"Query existing REST services with GraphQL","license":"MIT","main":"bundle.umd.js","module":"index.js","jsnext:main":"index.js","typings":"index.d.ts","repository":{"type":"git","url":"git+https://github.com/apollographql/apollo-link-rest.git"},"bugs":{"url":"https://github.com/apollographql/apollo-link-rest/issues"},"homepage":"https://github.com/apollographql/apollo-link-rest#readme","peerDependencies":{"@apollo/client":">=3","graphql":">=0.11","graphql-anywhere":">=4","qs":">=6"},"devDependencies":{"@apollo/client":"^3.0.0-beta.29","@apollo/link-error":"^2.0.0-beta.3","@babel/core":"7.x","@types/graphql":"14.x","@types/jest":"23.x","@types/node":"10.x","@types/qs":"6.5.x","browserify":"16.2.x","bundlesize":"0.17.x","camelcase":"5.0.x","codecov":"3.x","danger":"6.x","fetch-mock":"7.x","graphql":"14.x","graphql-anywhere":"4.1.x","isomorphic-fetch":"2.2.x","jest":"23.x","jest-fetch-mock":"2.x","lerna":"3.6.x","lint-staged":"8.1.x","lodash":"4.17.x","pre-commit":"1.2.x","prettier":"1.15.x","qs":"6.6.x","rimraf":"2.6.x","rollup":"0.67.x","rollup-plugin-local-resolve":"1.0.x","rollup-plugin-sourcemaps":"0.4.x","snake-case":"2.1.x","ts-jest":"23.10.x","typescript":"3.x","uglify-js":"3.4.x"},"resolutions":{"babel-core":"7.0.0-bridge.0","babel-jest":"23.6.0"},"pre-commit":"lint-staged","browser":"bundle.umd.js","react-native":"index.js","_id":"@alfonsoperez/apollo-link-rest-fork@0.8.0-beta.0","_nodeVersion":"14.16.0","_npmVersion":"6.14.11","dist":{"integrity":"sha512-0ibJsG2mmgU2KJorY4daCT2iQUUfZUtKepK8Qxf6ebXQk/tbeNfoQ6pKBhu2ZdHjP0bMzLGpZ5ueQV6Hul52jw==","shasum":"f2e13d3c5b22b83f45d6de4a3c084f0f692434c0","tarball":"https://registry.npmjs.org/@alfonsoperez/apollo-link-rest-fork/-/apollo-link-rest-fork-0.8.0-beta.0.tgz","fileCount":12,"unpackedSize":195008,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhxJEbCRA9TVsSAnZWagAApRMP/RmNJDiioN19Hf/NIZZV\nM9Pj+utCX4+V0mtAKj04xh1CZHqptKHTierwXRXgRhcEa1jabp8EBN9u1knh\nLChGB+uVae9JL+voFQ85J2a9DETCmLy8z+X/78XkA7L4RTdwiMR+lkOH3pxn\nU6AObjitxnaBDOQ59RkwmZ+kuKdbtRWvYpSC1oGYFPrI/jMExBr9KLs7dO87\nf2WD7tHuctxCEIjsLwbpQ3t1K2jOsyhwS+o4jlPmGEE9HsYsM8mInZTjDwgd\nZ3J7M5TFO9vLzKR0W3333MFyn6LoOCeVk6TAJh5tReUZ7qN11Mxh4FY1eQst\n9tc9rWphhTpKUahwmI0Qp08zlgdlxR3M+0NGAZTiFpB1i8HoCwDd9pLhD3/1\nySVMa5NoSN2dwOW6EhymnMvtOsAjFK9VYzaxlUYsSoT4lGXubS9zws+NI3PS\noSQccV1MeK/A4ZZzN/htUkLeyy9dLe4Mg9TOkKoJItD8tIDsBcBzZ3Ew+oxi\ns4scbkiHZ+dMlpXmnvZFUzDgfWr9p57Xc7zcZDM1ivV2M/LXBczJSWU4lghB\nziWDPcAbFW4/b3KDunDXnrSI2/7RdaCp8VSCJaMV1AqNc3fE4wHx+5shWLcD\nTpRWf4OC/WifixyZBBoHARQBj2fssrxzlYKPeBO+OCN/cDefUHBvUL/ZZc+X\neDtm\r\n=u/dT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDWNAbqVw6VZX+wQ6+6gxrF1nrvHPAJVkVpDuH3JRyQ3QIgQ262jN7d1rTAYEraU11Sp6nfe3fEX8O61UmoGSTQR6c="}]},"_npmUser":{"name":"alfonsoperez","email":"alfperata@gmail.com"},"directories":{},"maintainers":[{"name":"alfonsoperez","email":"alfperata@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/apollo-link-rest-fork_0.8.0-beta.0_1634276472528_0.8732266012331356"},"_hasShrinkwrap":false}},"time":{"created":"2021-10-15T05:41:12.489Z","0.8.0-beta.0":"2021-10-15T05:41:12.758Z","modified":"2022-04-04T12:49:09.578Z"},"maintainers":[{"name":"alfonsoperez","email":"alfperata@gmail.com"}],"description":"Query existing REST services with GraphQL","homepage":"https://github.com/apollographql/apollo-link-rest#readme","repository":{"type":"git","url":"git+https://github.com/apollographql/apollo-link-rest.git"},"bugs":{"url":"https://github.com/apollographql/apollo-link-rest/issues"},"license":"MIT","readme":"---\ntitle: REST Link\n---\n\n## ⚠️ This library is under active development ⚠️\n\nThis library is under active development. For information on progress check out [this issues](https://github.com/apollographql/apollo-link-rest/issues) or [the design](./designs/initial.md). We would love your help with writing docs, testing, anything! We would love for you, yes you, to be a part of the Apollo community!\n\n## Purpose\nAn Apollo Link to easily try out GraphQL without a full server. It can be used to prototype, with third-party services that don't have a GraphQL endpoint or in a transition from REST to GraphQL.\n\n## Installation\n\n```bash\nnpm install apollo-link-rest apollo-link graphql graphql-anywhere qs --save\nor\nyarn add apollo-link-rest apollo-link graphql graphql-anywhere qs\n```\n\n`apollo-link`, `graphql`, `qs` and `graphql-anywhere` are peer dependencies needed by `apollo-link-rest`.\n\n## Usage\n\n### Basics\n\n```js\nimport { RestLink } from \"apollo-link-rest\";\n// Other necessary imports...\n\n// Create a RestLink for the REST API\n// If you are using multiple link types, restLink should go before httpLink,\n// as httpLink will swallow any calls that should be routed through rest!\nconst restLink = new RestLink({\n  uri: 'https://swapi.co/api/',\n});\n\n// Configure the ApolloClient with the default cache and RestLink\nconst client = new ApolloClient({\n  link: restLink,\n  cache: new InMemoryCache(),\n});\n\n// A simple query to retrieve data about the first person\nconst query = gql`\n  query luke {\n    person @rest(type: \"Person\", path: \"people/1/\") {\n      name\n    }\n  }\n`;\n\n// Invoke the query and log the person's name\nclient.query({ query }).then(response => {\n  console.log(response.data.person.name);\n});\n```\n\n[![Edit Basic Example](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/apollographql/apollo-link-rest/tree/master/examples/simple)\n\n### Apollo Client & React Apollo\n\nFor an example of using REST Link with Apollo Client and React Apollo view this CodeSandbox:\n\n[![Edit Advanced Example](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/apollographql/apollo-link-rest/tree/master/examples/advanced)\n\n### TypeScript\n\nFor an example of using REST Link with Apollo Client, React Apollo and TypeScript view this CodeSandbox:\n\n[![Edit TypeScript Example](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/apollographql/apollo-link-rest/tree/master/examples/typescript)\n\n## Options\n\nREST Link takes an object with some options on it to customize the behavior of the link. The options you can pass are outlined below:\n\n- `uri`: the URI key is a string endpoint (optional when `endpoints` provides a default)\n- `endpoints`: root endpoint (uri) to apply paths to or a map of endpoints\n- `customFetch`: a custom `fetch` to handle REST calls\n- `headers`: an object representing values to be sent as headers on the request\n- `credentials`: a string representing the credentials policy you want for the fetch call\n- `fieldNameNormalizer`: function that takes the response field name and converts it into a GraphQL compliant name\n\n## Context\n\nREST Link uses the `headers` field on the context to allow passing headers to the HTTP request. It also supports the `credentials` field for defining credentials policy.\n\n- `headers`: an object representing values to be sent as headers on the request\n- `credentials`: a string representing the credentials policy you want for the fetch call\n\n## Documentation\n\nFor a complete `apollo-link-rest` reference visit the documentation website at: https://www.apollographql.com/docs/link/links/rest.html\n\n## Contributing\n\nThis project uses TypeScript to bring static types to JavaScript and uses Jest for testing. To get started, clone the repo and run the following commands:\n\n```bash\nnpm install # or `yarn`\n\nnpm test # or `yarn test` to run tests\nnpm test -- --watch # run tests in watch mode\n\nnpm run check-types # or `yarn check-types` to check TypeScript types\n```\n\nTo run the library locally in another project, you can do the following:\n\n```bash\nnpm link\n\n# in the project you want to run this in\nnpm link apollo-link-rest\n```\n\n## Related Libraries\n\n- [JSON API Link](https://github.com/Rsullivan00/apollo-link-json-api/) provides\ntooling for using GraphQL with JSON API compliant APIs.\n- [apollo-type-patcher](https://github.com/mpgon/apollo-type-patcher) declarative type definitions for your REST API with zero dependencies. \n","readmeFilename":"README.md"}