{"_id":"@bilgorajskim/ra-data-graphcool","_rev":"3-c78037703c6cf2cd7497626883b4b0a2","name":"@bilgorajskim/ra-data-graphcool","dist-tags":{"latest":"2.1.0-2"},"versions":{"2.1.0-0":{"name":"@bilgorajskim/ra-data-graphcool","version":"2.1.0-0","description":"A Graphcool data provider for react-admin","main":"./lib/index.js","repository":{"type":"git","url":"git+https://github.com/marmelab/react-admin.git"},"bugs":{"url":"https://github.com/marmelab/react-admin/issues"},"homepage":"https://github.com/marmelab/react-admin#readme","authors":["Gildas Garcia"],"keywords":["reactjs","react","@bilgorajskim/react-admin","admin-on-rest","rest","graphql","graphcool"],"license":"MIT","dependencies":{"@bilgorajskim/ra-data-graphql":"^2.1.0-0","graphql-tag":"^2.6.1","lodash":"~4.17.5","pluralize":"~7.0.0"},"peerDependencies":{"@bilgorajskim/react-admin":"^2.0.4","graphql":"^0.13.2"},"devDependencies":{"@bilgorajskim/react-admin":"^2.1.0-0","graphql":"^0.13.2"},"publishConfig":{"access":"public"},"_id":"@bilgorajskim/ra-data-graphcool@2.1.0-0","_npmVersion":"6.1.0","_nodeVersion":"10.4.0","_npmUser":{"name":"bilgorajskim","email":"bilgorajskim@gmail.com"},"dist":{"integrity":"sha512-tNdbR6LTGJfOebFcl0sYBDW6MsGVchjo00zOfcxKsn27OdisM3EvPxpHFaI7l51wtQHwxhtKqGfKY+Bhfg4DiA==","shasum":"9baf17f2d33bfa60dc34006e7604f31c18bf3d85","tarball":"https://registry.npmjs.org/@bilgorajskim/ra-data-graphcool/-/ra-data-graphcool-2.1.0-0.tgz","fileCount":21,"unpackedSize":71492,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbNwQrCRA9TVsSAnZWagAAG2QP/0G8DPXvKLyPbm7ynHyh\nkWPPUEgS2zDs1l8FQAuXFXXpb6b5wk0AoGoE/Z39sGmlCxxU2biohCks27YB\nbjZrVzeLGAcZ+eyMypFhyYDCRlJSW0P0dEgLD9X5HKpzPcOJZUrEmVwDJsqZ\nAx+sI5KtDU4d+DoyB16P0c8GtezxlIMOC0SozxuqfDFpZMfqzbEcdC3zhnJu\nQeSXjQYJ67Lcm2u8CtCZtkBpUmj0HrlsVJ62f1Qkl9AKBXx2EpwHw3pOwe5t\nUNbTvRhgxhnCaNwlFog+zPQR+pgiGa9NOPjrGw7HmoVLbXUh3e8Rjymtt1IZ\nb/zikb3bUvxKBcvWw3wif++WAgikCwEsb8gz9E5g0zQ+ThwL/Cs0/ppisE4e\nh1QbuFX1meIaKvUW807rWJ4NaKx2uVLsCVuWE0iEYH1GIGoC6w8TX6+eoHrz\nZ3AyHFO7u/XmFw68zWC3aXw1t52LFoXn+Ym+uwsG5HPtS2ZQ4WwW7jK4sNTv\nZ6LRrhAxZzz3bROrZc1yHydCpuiESaqK59pMxF8B4N2aQKmsCAlVJIBbf0R6\nbzsid1IwN1jm8m9kTk4sbcc8hFXJifIQOvhwBTEgiZhFlhA3Ajmv/2Gn//66\nO2au698Ssg0VBCoEtKL9rPMVVdMhvhdoBR0hhgra1DDNeqrJ6QD2EcjLYYly\nXnUd\r\n=yTls\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCTnB966gTUnZlLAXYfASsnLBeYNA79jwgpE8MyVKHbdAIhANPTPe5uDe0iak59nigwhp0JhPnGk8a/xjjFcWJYmlTE"}]},"maintainers":[{"name":"bilgorajskim","email":"bilgorajskim@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ra-data-graphcool_2.1.0-0_1530332203692_0.08116428985183632"},"_hasShrinkwrap":false},"2.1.0-1":{"name":"@bilgorajskim/ra-data-graphcool","version":"2.1.0-1","description":"A Graphcool data provider for react-admin","main":"./lib/index.js","repository":{"type":"git","url":"git+https://github.com/marmelab/react-admin.git"},"bugs":{"url":"https://github.com/marmelab/react-admin/issues"},"homepage":"https://github.com/marmelab/react-admin#readme","authors":["Gildas Garcia"],"keywords":["reactjs","react","@bilgorajskim/react-admin","admin-on-rest","rest","graphql","graphcool"],"license":"MIT","dependencies":{"@bilgorajskim/ra-data-graphql":"^2.1.0-1","graphql-tag":"^2.6.1","lodash":"~4.17.5","pluralize":"~7.0.0"},"peerDependencies":{"@bilgorajskim/react-admin":"^2.0.4","graphql":"^0.13.2"},"devDependencies":{"@bilgorajskim/react-admin":"^2.1.0-1","graphql":"^0.13.2"},"publishConfig":{"access":"public"},"_id":"@bilgorajskim/ra-data-graphcool@2.1.0-1","_npmVersion":"6.1.0","_nodeVersion":"10.4.0","_npmUser":{"name":"bilgorajskim","email":"bilgorajskim@gmail.com"},"dist":{"integrity":"sha512-0admLNf9Qv0Lp65ZeCqorEhM7hxLnMhx6tPwNlNfQ195gaIWXN7K/AkBCIQbZUDHyUw1zyj5R/AkCwHSuENU9g==","shasum":"4396484dcc90a7a8ddfb56b16e142d690fb92353","tarball":"https://registry.npmjs.org/@bilgorajskim/ra-data-graphcool/-/ra-data-graphcool-2.1.0-1.tgz","fileCount":21,"unpackedSize":71492,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbNwYECRA9TVsSAnZWagAAzMAP/3vP4zVU1M4T1zVfRn8t\nLfhU7chI9heWpUPMP/aEcicYDRXDibzeK4+Gs8qbOPYO0pFGHz/I1unW6HJB\n9rSpcosSV9R5CPagUHdxeodASgvkaiAjxGdKrjy5LVXAdSXyRDkCmoWpOXWY\nV8yI+mhN/RJKQLH8ucu9ZSgeim6ua7PEiluRaq1JNDedUK8PT6fMQZAVT0Hj\nrRu2LpEB4ogDMiBD+dmjskU6peQjR82lNmWwyM8BO45vIHvFL3AAGCjZOxQe\nVyalL+dL2JCLaU6ozCPeB0peciNcPsiyCaSOYsRWBaFSIBh3DAxBJy+3Q9F4\nsPUuS1vfYxFBYCboPcpoGc3AVipPYZISlfrMjmexuRq1JSl6ZGMgmxirav+V\n97ZwW8ksWXrLjOoLCEfX64th6wf+DjaEG7NH0g9RbsY6V0MjxBuz53Nz6qk+\nDX97gAx5EDGijIRRnQOI8/GMa/q5cmDuJoEFifqkPnDtd7fpAfcgNmVG9AEO\nNG00pmwvl/aBvYgLLROO4vw8ih7FYdPmAH+ufQlXaUB0OCanc6qOdi4+Cmwy\n3amvvucRyxn9i6ZiIjcDEde2idBb3j354Mlm381TNPXqvwBokGf2NEXZzdqc\nA9RWbDreiJCqZ9Qso8NY/7a3Oobour4Ge/kmndJv3Y/k2DNNaB9PF1pA4155\nvZRm\r\n=yQF6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCrA/Z2OHlv2Czxmk2S6RNejyg4KIZW+Erp7qrNRWuJZAIgMlZ8SW7fGaerPzE0moi0CKqmK4aVld2kNeOS7pRieIQ="}]},"maintainers":[{"name":"bilgorajskim","email":"bilgorajskim@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ra-data-graphcool_2.1.0-1_1530332676031_0.05296809911949163"},"_hasShrinkwrap":false},"2.1.0-2":{"name":"@bilgorajskim/ra-data-graphcool","version":"2.1.0-2","description":"A Graphcool data provider for react-admin","main":"./lib/index.js","repository":{"type":"git","url":"git+https://github.com/marmelab/react-admin.git"},"bugs":{"url":"https://github.com/marmelab/react-admin/issues"},"homepage":"https://github.com/marmelab/react-admin#readme","authors":["Gildas Garcia"],"keywords":["reactjs","react","@bilgorajskim/react-admin","admin-on-rest","rest","graphql","graphcool"],"license":"MIT","dependencies":{"@bilgorajskim/ra-data-graphql":"^2.1.0-2","graphql-tag":"^2.6.1","lodash":"~4.17.5","pluralize":"~7.0.0"},"peerDependencies":{"@bilgorajskim/react-admin":"^2.0.4","graphql":"^0.13.2"},"devDependencies":{"@bilgorajskim/react-admin":"^2.1.0-2","graphql":"^0.13.2"},"publishConfig":{"access":"public"},"_id":"@bilgorajskim/ra-data-graphcool@2.1.0-2","_npmVersion":"6.1.0","_nodeVersion":"10.4.0","_npmUser":{"name":"bilgorajskim","email":"bilgorajskim@gmail.com"},"dist":{"integrity":"sha512-PDNhDNoQOqmG33ceXsn6uipq7F/Jv3AmQpWuFbZDo2rXO2nHNL8/xm9mRVOH1QG0d7MMz/R23ZHiC7ERDFMUPg==","shasum":"bc01c9ff1c8d4cd2de7a0eeae6e35e12119ffce2","tarball":"https://registry.npmjs.org/@bilgorajskim/ra-data-graphcool/-/ra-data-graphcool-2.1.0-2.tgz","fileCount":21,"unpackedSize":71492,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbNwbhCRA9TVsSAnZWagAAYncP/2kTVJgiYTFBf/XTwXjk\nkUR2+r1GtBcj9QNAbRAqOW5PSux8BcB+L003S55nnNA+pgdpbK+amhFQD1Ei\nbNBbQaTIZPdUZTjYtlBQZclJ5yuwnX6vRmkSrBJ6x8sFL+hrkWNfahQPlxG0\n+WEpp8NU75FPEGAxvcq23ncOwiRVuNgcdbUk1zPOI6d581EeaD6DtMhTIakL\nbY+A+GrlKhgi1zEn3Gs9noBxH9GlfpMbcyMULh3Ho9G39zSL2dj15RxT49XO\nqa0Sz95Zoxz+2L0bQsjOgSBMIWSMpLrY5LKV0wPdtwCl/EXdQ0k81JNgDTXm\nlREmck1RF1x6o6FW28M76tG8samZowFfQVD6ZNJeotWP9dZ/pdGhhkKuTLvy\n9MRkAfRx/KEZAnXl/FNSRPCF4R3TrtT+ZaMki/SSAazmyp9f31pqS7Jce44y\npKsRVSi07ze5/3aAfZ6A5//COT+D1xzTTc6XrHvaTA813Id55O6iE1Z6q0Gc\nJ51hLJgO3TueMfLoqhEYV6Ts5qKtLEgjpMKbmTEFm6C3NFrbfWwxm0OFoHZg\nLa326aScOXsH1snLxg7nuBIee58nIo/st1l765KbLSQV0URyWf5OolwuAxJp\n6etcIwUZdGcUiHDsULboqqQZcqZaZkmKB7dat73wOszz8Qa/0EPKDF5Y0oKD\nmUAT\r\n=+FiQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDJjtI5IpdmXfSuFlZZA2psgy2X6ZA/MMizREvjkMUmTwIhAI9lvKX3t1n/PTTiZmQeUZ5grblitO/grDSBH+bOCqw3"}]},"maintainers":[{"name":"bilgorajskim","email":"bilgorajskim@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ra-data-graphcool_2.1.0-2_1530332897000_0.469283107685581"},"_hasShrinkwrap":false}},"time":{"created":"2018-06-30T04:16:43.281Z","2.1.0-0":"2018-06-30T04:16:43.787Z","modified":"2022-04-04T18:48:37.438Z","2.1.0-1":"2018-06-30T04:24:36.134Z","2.1.0-2":"2018-06-30T04:28:17.099Z"},"maintainers":[{"name":"bilgorajskim","email":"bilgorajskim@gmail.com"}],"description":"A Graphcool data provider for react-admin","homepage":"https://github.com/marmelab/react-admin#readme","keywords":["reactjs","react","@bilgorajskim/react-admin","admin-on-rest","rest","graphql","graphcool"],"repository":{"type":"git","url":"git+https://github.com/marmelab/react-admin.git"},"bugs":{"url":"https://github.com/marmelab/react-admin/issues"},"license":"MIT","readme":"# ra-data-graphcool\n\nA GraphQL data provider for [react-admin](https://github.com/marmelab/react-admin/)\nbuilt with [Apollo](http://www.apollodata.com/) and tailored to target the [GraphCool](https://www.graph.cool/) service.\n\nA version of the `react-admin` demo using this data provider is available at https://react-admin-graphql.now.sh/.<br>\n\n- [Installation](#installation)\n- [Usage](#installation)\n- [Options](#options)\n\n## Installation\n\nInstall with:\n\n```sh\nnpm install --save graphql ra-data-graphcool\n```\n\nor\n\n```sh\nyarn add graphql ra-data-graphcool\n```\n\n## Usage\n\nThis example assumes a `Post` type is defined in the graphcool schema.\n\n```js\n// in App.js\nimport React, { Component } from 'react';\nimport buildGraphcoolProvider from 'ra-data-graphcool';\nimport { Admin, Resource, Delete } from 'react-admin';\n\nimport { PostCreate, PostEdit, PostList } from './posts';\n\nconst client = new ApolloClient();\n\nclass App extends Component {\n    constructor() {\n        super();\n        this.state = { dataProvider: null };\n    }\n    componentDidMount() {\n        buildGraphcoolProvider({ clientOptions: { uri: 'https://api.graph.cool/simple/v1/graphcool_id' }})\n            .then(dataProvider => this.setState({ dataProvider }));\n    }\n\n    render() {\n        const { dataProvider } = this.state;\n\n        if (!dataProvider) {\n            return <div>Loading</div>;\n        }\n\n        return (\n            <Admin dataProvider={dataProvider}>\n                <Resource name=\"Post\" list={PostList} edit={PostEdit} create={PostCreate} remove={Delete} />\n            </Admin>\n        );\n    }\n}\n\nexport default App;\n```\n\nAnd that's it, `buildGraphcoolProvider` will create a default ApolloClient for you and run an [introspection](http://graphql.org/learn/introspection/) query on your graphcool endpoint, listing all potential resources.\n\nThis works with any GraphCool endpoint, or any GraphQL endpoint modeled after [the GraphCool grammar](https://github.com/graphcool/graphcool-framework/blob/master/docs/0.x/02-Concepts/02-Database-%26-API/03-API-Capabilities.md):\n\n![GraphCool gammar](https://camo.githubusercontent.com/a58fc16d347122afd015c06a96591c5ecc1bed62/68747470733a2f2f696d6775722e636f6d2f4d6f496e665a4d2e706e67) \n\n## Options\n\n### Customize the Apollo client\n\nYou can either supply the client options by calling `buildGraphcoolProvider` like this:\n\n```js\nbuildGraphcoolProvider({ clientOptions: { uri: 'https://api.graph.cool/simple/v1/graphcool_id', ...otherApolloOptions } });\n```\n\nOr supply your client directly with:\n\n```js\nbuildGraphcoolProvider({ client: myClient });\n```\n\n### Customize the introspection\n\nThese are the default options for introspection:\n\n```js\nconst introspectionOptions = {\n    include: [], // Either an array of types to include or a function which will be called for every type discovered through introspection\n    exclude: [], // Either an array of types to exclude or a function which will be called for every type discovered through introspection\n}\n\n// Including types\nconst introspectionOptions = {\n    include: ['Post', 'Comment'],\n};\n\n// Excluding types\nconst introspectionOptions = {\n    exclude: ['CommandItem'],\n};\n\n// Including types with a function\nconst introspectionOptions = {\n    include: type => ['Post', 'Comment'].includes(type.name),\n};\n\n// Including types with a function\nconst introspectionOptions = {\n    exclude: type => !['Post', 'Comment'].includes(type.name),\n};\n```\n\n**Note**: `exclude` and `include` are mutualy exclusives and `include` will take precendance.\n\n**Note**: When using functions, the `type` argument will be a type returned by the introspection query. Refer to the [introspection](http://graphql.org/learn/introspection/) documentation for more information.\n\nPass the introspection options to the `buildApolloProvider` function:\n\n```js\nbuildApolloProvider({ introspection: introspectionOptions });\n```\n\n## `DELETE_MANY` and `UPDATE_MANY` Optimizations\n\nGraphcool does not allow multiple deletions or updates in a single query. This provider simply makes multiple requests to handle those. This is obviously not ideal but can be alleviated by supplying your own `ApolloClient` which could use the [apollo-link-batch-http](https://www.apollographql.com/docs/link/links/batch-http.html) link. Indeed, Graphcool does support query batching.\n\n## Contributing\n\nRun the tests with this command:\n\n```sh\nmake test\n```\n","readmeFilename":"README.md"}