{"name":"graphql-disable-introspection","version":"1.2.0","description":"Disable introspection in graphql-js with a validation rule","main":"index.js","directories":{"doc":"docs","test":"tests"},"scripts":{"test":"mocha test.js"},"repository":{"type":"git","url":"git+https://github.com/helfer/graphql-disable-introspection.git"},"keywords":["GraphQL","Introspection","Node","disable","query","validation","rule"],"author":{"name":"Jonas Helfer","email":"jonas@helfer.email"},"license":"MIT","bugs":{"url":"https://github.com/helfer/graphql-disable-introspection/issues"},"homepage":"https://github.com/helfer/graphql-disable-introspection#readme","devDependencies":{"body-parser":"^1.17.1","chai":"^3.5.0","express":"^4.15.2","graphql":"^15.0.0","graphql-server-express":"^0.6.0","mocha":"^3.2.0","supertest":"^3.0.0","supertest-as-promised":"^4.0.2"},"peerDependencies":{"graphql":"^0.9.2 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0"},"gitHead":"b06eaa57965fae8dcf669bd7eb81e73367b1abe6","_id":"graphql-disable-introspection@1.2.0","_nodeVersion":"14.16.1","_npmVersion":"6.14.12","dist":{"integrity":"sha512-bRY1LWCOzho/snYsLZ0N2J78zgCDtcFdbdZILxWGi8TifLLYf2bHZ3yw5r1NX42K87AMEOT0d11XScVrcJ+Zig==","shasum":"3813885ea1053c65a7a0090e2cb160388a5575a2","tarball":"http://registry-npm.ywwl.com/graphql-disable-introspection/download/graphql-disable-introspection-1.2.0.tgz","fileCount":5,"unpackedSize":6755,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgim9nCRA9TVsSAnZWagAAzccQAIc+2WcDMMNSzc783svd\nIZlvqTIP/m68MeQLILTySpas6gUmMg7o7OV6o95uGroDfZ6yKteKE6f1RAdv\ndVAyhDl9q0STpXcUQrLqt3lt91nmb51fibK6NQAr2oSxHRbzmdbQeaN07Y/I\nlL+o9PM/hLBitjfTrcgE39ZhgqAfkrnM6/q/4nPi5jO9cMmkpt2c4GlFY3BN\n6dNLVn76Qvu3WfxqW0DSnEvX+O5N2qWAodECGVvuKG4FeIclrlL/wJ6VOLAz\n1cARDzKOlUD2twenbbpB785g0vNJDEHaD5vF/oUrK+kNm3QhWSwIveYfJ3Xd\nlHzvcPqxNwEGMPyQi1smC2Qi+BGq8k6Mj5sso5ASsycMxWG9nlUghrxBqgPM\n/B+BkQICKiAigg9iUin0Ji5GeP8uQSOx6wdFgIFmDq4IU45PvCLCDbyt7HDx\nrhowPsm1Yd7aXg6DuS85ERY3CjCTKQr+QcJY6dGXXrfkVAY+CReaTshuA7EE\nuX227a27SblH+26rk7FsAgI/oNUccm6+qOn9JFO9zmnyZWVMFUQbjmsyqGpM\nce5ik9k7SHke81o5z+7hiyyM3rBh2zShW7U/vpyPBDkYrTwebAwPzvGb9CVt\nNrX/9zX4ftD7cZlcbH1phwQ10WpL87BxO4hb/2pDlEBMOa1kaqGEPEkBEw+f\nDSfo\r\n=Nf+r\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICHf+csZiOmth14cR6IIdAJI+L3b4g0vJA6qNbYxBE2iAiAdWnxGRUFKBw8TEbZpDq39w04IhfgKnCgk9zfHH5s79A=="}],"size":2622,"noattachment":false,"key":"/graphql-disable-introspection/-/graphql-disable-introspection-1.2.0.tgz"},"_npmUser":{"name":"helfer","email":"helfer@protonmail.com"},"maintainers":[{"name":"helfer","email":"helfer@protonmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/graphql-disable-introspection_1.2.0_1619685223043_0.8557936043955754"},"_hasShrinkwrap":false,"readme":"# graphql-disable-introspection\nDisable introspection queries in GraphQL with a simple validation rule. Queries that contain `__schema` or `__type` will fail validation with this rule. For example, the following queries will be rejected:\n\n```graphql\nquery {\n  __schema {\n    queryType {\n      name\n    }\n  }\n}\n\nquery {\n  __type(name: \"Query\") {\n    description\n    fields {\n      name\n    }\n  }\n}\n```\n\n## Usage\n\nThe package can be installed from npm\n\n```sh\nnpm install -save graphql-disable-introspection\n```\n\nIt exports a single validation rule which you can pass to your node GraphQL server with the `validationRules` argument. \n\nHere's an example for `graphql-server-express`:\n\n```diff\nimport express from 'express';\nimport bodyParser from 'body-parser';\nimport { graphqlExpress } from 'graphql-server-express';\n+ import NoIntrospection from 'graphql-disable-introspection';\n\nconst myGraphQLSchema = // ... define or import your schema here!\nconst PORT = 3000;\n\nvar app = express();\n\n// bodyParser is needed just for POST.\napp.use('/graphql', bodyParser.json(), graphqlExpress({\n   schema: myGraphQLSchema,\n+  validationRules: [NoIntrospection]\n}));\n\napp.listen(PORT);\n\n```\n\nIf you're using `express-graphql`, it works exactly the same way:\n\n```diff\napp.use('/graphql', graphqlHTTP({\n  schema: MyGraphQLSchema,\n+ validationRules: [NoIntrospection]\n}));\n```\n","publish_time":1619685223153,"_cnpm_publish_time":1619685223153,"dist-tags":{"latest":"1.2.0"}}