{"_id":"@alfonsoperez/apollo-link-rest","_rev":"3-3c12642854e71b1e88bbfdd8724c059b","name":"@alfonsoperez/apollo-link-rest","dist-tags":{"latest":"0.8.0"},"versions":{"0.8.0-beta.0":{"name":"@alfonsoperez/apollo-link-rest","version":"0.8.0-beta.0","description":"Query existing REST services with GraphQL","license":"MIT","main":"./lib/bundle.umd.js","module":"./lib/index.js","jsnext:main":"./lib/index.js","typings":"./lib/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","scripts":{"build:browser":"browserify ./lib/bundle.umd.js -o=./lib/bundle.js --i @apollo/client/core --i @apollo/client/utilities --i apollo-utilities --i graphql --i react && npm run minify:browser","build":"tsc -p .","bundle":"rollup -c","clean":"rimraf lib/* coverage/*","coverage:upload":"codecov","danger":"danger run --verbose","deploy":"./scripts/deploy.sh","docs:check":"./scripts/docs_check.sh","docs:pull":"./scripts/docs_pull.sh","docs:push":"./scripts/docs_push.sh","filesize":"npm run build && npm run build:browser && bundlesize","lint":"prettier --write 'src/**/*.{j,t}s*'","lint-staged":"lint-staged","minify:browser":"uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js","postbuild":"npm run bundle","prebuild":"npm run clean","prepublishOnly":"npm run clean && npm run build","prettier":"prettier --config .prettierrc","prettier:diff":"prettier --config .prettierrc --list-different \"src/**/*.{ts,tsx,js,jsx}\" || true","prettier:diff-with-error":"prettier --config .prettierrc --list-different \"src/**/*.{ts,tsx,js,jsx}\"","prettier:all":"yarn prettier --write \"./src/**/*.{ts,tsx,js,jsx}\" ","test":"jest","coverage":"npm run lint && jest --coverage","watch":"tsc -w -p .","check-types":"tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.tests.json"},"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"},"bundlesize":[{"name":"apollo-link-rest","path":"./lib/bundle.min.js","maxSize":"9.5 kb"}],"lint-staged":{"*.ts*":["prettier --write","git add"],"*.js*":["prettier --write","git add"],"*.json*":["prettier --write","git add"]},"pre-commit":"lint-staged","gitHead":"baa67a38cb2b16769958cd5bd51b685fa2d13a2e","_id":"@alfonsoperez/apollo-link-rest@0.8.0-beta.0","_nodeVersion":"14.16.0","_npmVersion":"6.14.11","dist":{"integrity":"sha512-8gtg8tKEKqfZaf/aVmjYslWTSArcm2ove6PoH0W5sTKAfwDMdAOKT6UArKXfZ21VzlxnyaVgjJF/2hKNal2Csw==","shasum":"6b0be56d7c69fb12a017326e185739071a1d718f","tarball":"https://registry.npmjs.org/@alfonsoperez/apollo-link-rest/-/apollo-link-rest-0.8.0-beta.0.tgz","fileCount":72,"unpackedSize":479013,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCejKDUDu87Shc5wTVzJJrtxj6rbKGf+PDOK7mtWKb7WAIgUafq77qXDLl5K3xPUcUi7iYjtKJdtnfEFxOAAm2cN+s="}]},"_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_0.8.0-beta.0_1634276994671_0.8152034816902896"},"_hasShrinkwrap":false},"0.7.0":{"name":"@alfonsoperez/apollo-link-rest","version":"0.7.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-link":">=1","graphql":">=0.11","graphql-anywhere":">=4","qs":">=6"},"devDependencies":{"@babel/core":"7.x","@types/graphql":"14.x","@types/jest":"23.x","@types/node":"10.x","@types/qs":"6.5.x","apollo-cache-inmemory":"1.3.x","apollo-client":"2.4.x","apollo-link":"1.2.x","apollo-link-error":"1.1.x","apollo-link-http":"1.5.x","apollo-link-state":"0.4.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","graphql-tag":"2.10.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@0.7.0","_nodeVersion":"14.16.0","_npmVersion":"6.14.11","dist":{"integrity":"sha512-EAPIpSOiJsaOqEjy5QeMNfR+T9Ch2yOfmpKFp/8u5PbxTmIYOlbSz1CALLeAMqGf4/AUfouQgFLWIrvZofTBlQ==","shasum":"8b1c75bdd82dcb474f311c7f9f4eddbbd40ccc6f","tarball":"https://registry.npmjs.org/@alfonsoperez/apollo-link-rest/-/apollo-link-rest-0.7.0.tgz","fileCount":14,"unpackedSize":188434,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDHEZyQXx6wDjOOUOIzHKU/qf/9YOwut5gvlqs/goAfHAIhAPCPGhzpUga/ELObMeqHwPOexp3hCtkUNUvv9idHVNsY"}]},"_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_0.7.0_1634277351791_0.24883939919725062"},"_hasShrinkwrap":false},"0.8.0":{"name":"@alfonsoperez/apollo-link-rest","version":"0.8.0","description":"Query existing REST services with GraphQL","license":"MIT","main":"./lib/bundle.umd.js","module":"./lib/index.js","jsnext:main":"./lib/index.js","typings":"./lib/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","scripts":{"build:browser":"browserify ./lib/bundle.umd.js -o=./lib/bundle.js --i @apollo/client/core --i @apollo/client/utilities --i apollo-utilities --i graphql --i react && npm run minify:browser","build":"tsc -p .","bundle":"rollup -c","clean":"rimraf lib/* coverage/*","coverage:upload":"codecov","danger":"danger run --verbose","deploy":"./scripts/deploy.sh","docs:check":"./scripts/docs_check.sh","docs:pull":"./scripts/docs_pull.sh","docs:push":"./scripts/docs_push.sh","filesize":"npm run build && npm run build:browser && bundlesize","lint":"prettier --write 'src/**/*.{j,t}s*'","lint-staged":"lint-staged","minify:browser":"uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js","postbuild":"npm run bundle","prebuild":"npm run clean","prepublishOnly":"npm run clean && npm run build","prettier":"prettier --config .prettierrc","prettier:diff":"prettier --config .prettierrc --list-different \"src/**/*.{ts,tsx,js,jsx}\" || true","prettier:diff-with-error":"prettier --config .prettierrc --list-different \"src/**/*.{ts,tsx,js,jsx}\"","prettier:all":"yarn prettier --write \"./src/**/*.{ts,tsx,js,jsx}\" ","test":"jest","coverage":"npm run lint && jest --coverage","watch":"tsc -w -p .","check-types":"tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.tests.json"},"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"},"bundlesize":[{"name":"apollo-link-rest","path":"./lib/bundle.min.js","maxSize":"9.5 kb"}],"lint-staged":{"*.ts*":["prettier --write","git add"],"*.js*":["prettier --write","git add"],"*.json*":["prettier --write","git add"]},"pre-commit":"lint-staged","gitHead":"03a3eb0ffd4ac53817cbcc2dae553d7b021ce2e2","_id":"@alfonsoperez/apollo-link-rest@0.8.0","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-j0qqnihA1o+cj0NRukpVRrdhIQeTvCxIhX7fRzbucpjxHEle1GspWTJaKTt2FIryTGVQC+yMF24DEQftLooqyQ==","shasum":"bac5b8a4f64d01ff3b871b5ba6027723edfbacf1","tarball":"https://registry.npmjs.org/@alfonsoperez/apollo-link-rest/-/apollo-link-rest-0.8.0.tgz","fileCount":60,"unpackedSize":283955,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhqZK4CRA9TVsSAnZWagAASCkP/1UyCN1IDNKPl/GAnCq0\n7gtyaCLRizZUr8Rucu8VsfdEB/Rb194iCVHWDFx2maa+DGorxbh1Y14stVgH\njuMP2jAwLjSDArh0hyaszd3UDr6FuFJNMLYR4w3/E8lS6vAaJhrf7wSxdos9\nePT8RS0nAG5Y5ZKesZyHH/hlqKu+e3twbWl/vgCeIQ5gG7ZGA1pCm8XwAMfK\nMmony8Q016GNoPdxeCZsN7e07ngfIFWd3Bmaxl+lC7K6q8D77GK87IgLNfS1\n2YCTu6+9q/NsCCSCHQ8qHgPZ47uM+elwQYUY9qjgtOyIx4K+lXmwm3UDhl/p\n1wrDcre7faLAIc1yT5y00rR+L8Xtz6DzXoqS8e/8rTsQMk6zexYjkqYBAVI0\nveyd35CDdM3Rm4e4juY7QVtCvkcfgHEuC+cDmysE8KfZx5EOybkQHb2SvVLf\njbibbMQk1i4Td7s9DGSaw7RrDKL9eBpRTY0/mUiEE6NnX4bm2eJzXd9IsxvG\nsAf1I2X8DgdTCjXhKp8RvYaQ0d839bgafBLC79n0EPAiXNaxUTnPVPRHCHLt\n88MWwNUzqNqmyv2q3duAI7iyZOqLtD0ZEleUyKPOCpN5qvRbbaPXPcuux021\nZ5T/1Who7201pH6g0ODBvncME34CtkLNUGu5A6rWffQTqbxc1CmBdL9Cr4GX\nVvJQ\r\n=St+r\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCRKAmGBVAA6+ObwzMPbZz5T2SIW6CpJYMoZDqgRXFINAIhAPfNWvZc4+wHUQ28732GL0zjHNlT/HDZi0YLXDcnyEFh"}]},"_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_0.8.0_1638503096761_0.4760496729794119"},"_hasShrinkwrap":false}},"time":{"created":"2021-10-15T05:49:54.606Z","0.8.0-beta.0":"2021-10-15T05:49:54.881Z","modified":"2022-04-04T12:49:09.404Z","0.7.0":"2021-10-15T05:55:51.986Z","0.8.0":"2021-12-03T03:44:56.923Z"},"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"}