{"name":"graphql-compose","version":"5.8.1","description":"GraphQL schema builder from different data sources with middleware extensions.","engines":{"node":">= 6"},"main":"lib/index.js","module":"mjs/index.mjs","types":"lib/index.d.ts","repository":{"type":"git","url":"git+https://github.com/graphql-compose/graphql-compose.git"},"keywords":["graphql","compose"],"license":"MIT","bugs":{"url":"https://github.com/graphql-compose/graphql-compose/issues"},"homepage":"https://github.com/graphql-compose/graphql-compose","peerDependencies":{"graphql":">=0.13.0 || >=14.0.0 || >=14.1.0"},"devDependencies":{"@babel/cli":"^7.2.3","@babel/core":"^7.2.2","@babel/plugin-proposal-class-properties":"^7.3.0","@babel/plugin-proposal-object-rest-spread":"^7.3.1","@babel/plugin-transform-flow-strip-types":"^7.2.3","@babel/plugin-transform-runtime":"^7.2.0","@babel/preset-env":"^7.3.1","@babel/preset-flow":"^7.0.0","@types/graphql":"^14.0.5","babel-core":"^7.0.0-bridge.0","babel-eslint":"^10.0.1","babel-jest":"^23.6.0","cz-conventional-changelog":"^2.1.0","eslint":"^5.12.1","eslint-config-airbnb-base":"^13.1.0","eslint-config-prettier":"^4.0.0","eslint-plugin-flowtype":"^3.2.1","eslint-plugin-import":"^2.15.0","eslint-plugin-prettier":"^3.0.1","flow-bin":"0.91.0","graphql":"14.1.1","jest":"^23.6.0","prettier":"^1.16.1","rimraf":"^2.6.3","semantic-release":"^15.13.3","tslint":"^5.12.1","tslint-config-prettier":"^1.17.0","tslint-plugin-prettier":"^2.0.1","typescript":"^3.2.4"},"dependencies":{"graphql-type-json":"^0.2.1","object-path":"^0.11.4"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"jest":{"roots":["<rootDir>/src"]},"scripts":{"build":"npm run build-cjs && npm run build-mjs && npm run build-esm","build-cjs":"rimraf lib && BABEL_ENV=cjs babel src --ignore __tests__,__mocks__ -d lib && COPY_TO_FOLDER=lib npm run build-flow && COPY_TO_FOLDER=lib npm run build-ts","build-esm":"rimraf esm && BABEL_ENV=esm babel src --ignore __tests__,__mocks__ -d esm && COPY_TO_FOLDER=esm npm run build-flow && COPY_TO_FOLDER=esm npm run build-ts","build-mjs":"rimraf mjs && BABEL_ENV=mjs babel src --ignore __tests__,__mocks__ -d mjs && yarn build-mjs-rename && COPY_TO_FOLDER=mjs npm run build-flow","build-mjs-rename":"find ./mjs -name \"*.js\" -exec bash -c 'mv \"$1\" \"${1%.js}\".mjs' - '{}' \\;","build-flow":"find ./src -name '*.js' -not -path '*/__*' | while read filepath; do cp $filepath `echo ./${COPY_TO_FOLDER:-lib}$filepath | sed 's/.\\/src\\//\\//g'`.flow; done","build-ts":"find ./src -name '*.d.ts' -not -path '*/__*' | while read filepath; do cp $filepath `echo ./${COPY_TO_FOLDER:-lib}$filepath | sed 's/.\\/src\\//\\//g'`; done","watch":"jest --watch","coverage":"jest --coverage --maxWorkers 4","lint":"npm run eslint && npm run tslint","eslint":"eslint --ext .js ./src","tslint":"tslint -p . \"src/**/*.d.ts\"","tscheck":"tsc --noEmit","flow":"flow","glow":"glow --watch","test":"npm run coverage && npm run lint && npm run flow && npm run tscheck","link":"yarn link graphql && yarn link","unlink":"yarn unlink graphql && yarn add graphql","semantic-release":"semantic-release","test-vers":"yarn add graphql@0.13.0 --dev && jest && yarn add graphql@14.0.0 --dev && jest"},"collective":{"type":"opencollective","url":"https://opencollective.com/graphql-compose","logo":"https://opencollective.com/graphql-compose/logo.txt"},"contributors":[{"name":"Pavel Chertorogov","email":"pavel.chertorogov@gmail.com"}],"gitHead":"77ac6369c3ffb307efa750d3cbebe950732a5eb5","_id":"graphql-compose@5.8.1","_npmVersion":"6.4.1","_nodeVersion":"10.15.1","_npmUser":{"name":"nodkz","email":"pavel.chertorogov@gmail.com"},"dist":{"integrity":"sha512-veWAR74o5OB5HEmirLDqcl63YSSREjtjvzXgwFcDnhFiyKzkXXy45Nt0xdEr5YNqyLwCwL8OBRXhz9a4nk/x7g==","shasum":"076b8221f8ccfd02765f7508e130bae3b2b05ae8","tarball":"http://registry-npm.ywwl.com/graphql-compose/download/graphql-compose-5.8.1.tgz","fileCount":342,"unpackedSize":2078777,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcWWHPCRA9TVsSAnZWagAA/wAP/RlENc2UnNB5iOImslLh\nBZlK+nMKX8dbH4W1W0vzj2kMCceqJiWOJqPyqfg+D9Ezsz8mqQj9UY4Cic+y\nKOOdDKN5vZct5QBu00te6xGzJPwvK5uSS63EX2BvpXBbz6OiMJYmxOXdtjQ2\ndqzbzkio7LDE0bgJRe+uLgFDI8Cp/y2FXKcylKJcvyJmx2cCZ59aK7LLRHJc\nCJZfXaL+Q0V0fuIvFhuiLKdZBYqIaSI4yrYyv8TUVA/SIn1QMAbkeKAN6kGM\niFkgt2XXc4XvWpMtxmSDF1qmYZXolWQHpx8p71WJ5XFP73tlIAO/DSCHKnvh\nk1V//wh8lnte13eo9qJQ1v5pKz9FfdOpgiMvrspNkVqwOAXA8+nHjoxTpApH\nPzYBdrI7pgzHWPYMV0uOrXITXTi74GPwAFkRKrQO/cA4iFGW4CZKJNqp3ySL\nXASMeXbGsesliVNr7mNd1kv1vWiLhCp90Pppfv2Nf89Xm7PHEc/uExWRrVgW\nUoq6Q2UHDj+7/dfKOqQs9vNE+lB+D4S0gapgzTyxxcFXhCjC0r5GHWt5kFrL\nt4CNSTHmL7pp0TqIywoP8AQt5aqSSHREHBpYETLdI5nH1UE/7t4x6/wREFc9\n9dnX9yJFiVDU78JR9nkPF9TAkuenFfYnJD+69ZZr4yi5QBwZr8+7fRPOxEVA\nZWd6\r\n=r68x\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDxTuOXs+0BtirlRRvYiGgIN0u03AQIGZlpOY4Y7+FoAgIgQpetiCVLl53wzP6IUebyMY5IdpsukRv/f6O2opEYkuY="}],"size":312443,"noattachment":false,"key":"/graphql-compose/-/graphql-compose-5.8.1.tgz"},"maintainers":[{"name":"nodkz","email":"pavel.chertorogov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/graphql-compose_5.8.1_1549361615009_0.49878828996731284"},"_hasShrinkwrap":false,"readme":"<p align=\"center\"><img src=\"https://raw.githubusercontent.com/graphql-compose/graphql-compose/master/docs/logo.png\" width=\"200\" /></p>\n\n# graphql-compose\n\n[![](https://img.shields.io/npm/v/graphql-compose.svg)](https://www.npmjs.com/package/graphql-compose)\n[![codecov coverage](https://img.shields.io/codecov/c/github/graphql-compose/graphql-compose.svg)](https://codecov.io/github/graphql-compose/graphql-compose)\n[![Travis](https://img.shields.io/travis/graphql-compose/graphql-compose.svg?maxAge=2592000)](https://travis-ci.org/graphql-compose/graphql-compose)\n[![npm](https://img.shields.io/npm/dt/graphql-compose.svg)](http://www.npmtrends.com/graphql-compose)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n![TypeScript compatible](https://img.shields.io/badge/typescript-compatible-brightgreen.svg)\n[![Backers on Open Collective](https://opencollective.com/graphql-compose/backers/badge.svg)](#backers)\n[![Sponsors on Open Collective](https://opencollective.com/graphql-compose/sponsors/badge.svg)](#sponsors)\n\n**`graphql-compose`** – provides a type registry with a bunch of methods for programmatic schema construction. It allows not only to extend types but also remove fields, interfaces, args. **If you want to write your graphql schema generator – `graphql-compose` is a good instrument for you.**\n\n* provides methods for editing GraphQL output/input types (add/remove fields/args/interfaces)\n* introduces ```Resolver's``` – the named graphql fieldConfigs, which can be used for finding, updating, removing records\n* provides an easy way for creating relations between types via ```Resolver's```\n* provides converter from `OutputType` to `InputType`\n* provides `projection` parser from AST\n* provides `GraphQL schema language` for defining simple types\n* adds additional types `Date`, `Json`\n\n## And a little bit more\n\n**`graphql-compose-[plugin]`** – are _declarative generators/plugins_ built on top of `graphql-compose`, which take some ORMs, schema definitions and create GraphQL Models from them or modify existing GraphQL Types.\n\n### Type generators built on top `graphql-compose`\n\n* [graphql-compose-json](https://github.com/graphql-compose/graphql-compose-json) - generates GraphQL type from JSON (a good helper for wrapping REST APIs)\n* [graphql-compose-mongoose](https://github.com/graphql-compose/graphql-compose-mongoose) - generates GraphQL types from mongoose (MongoDB models) with Resolvers.\n* [graphql-compose-elasticsearch](https://github.com/graphql-compose/graphql-compose-elasticsearch) - generates GraphQL types from elastic mappings; ElasticSearch REST API proxy via GraphQL.\n* [graphql-compose-aws](https://github.com/graphql-compose/graphql-compose-aws) - expose AWS Cloud API via GraphQL\n\n### Utility plugins:\n\n* [graphql-compose-relay](https://github.com/graphql-compose/graphql-compose-relay) - reassemble GraphQL types with `Relay` specific things, like `Node` type and interface, `globalId`, `clientMutationId`.\n* [graphql-compose-connection](https://github.com/graphql-compose/graphql-compose-connection) - generates `connection` Resolver from `findMany` and `count` Resolvers.\n* [graphql-compose-dataloader](https://github.com/stoffern/graphql-compose-dataloader) - adds DataLoader to graphql-composer resolvers.\n\n## Documentation\n\n[graphql-compose.github.io](https://graphql-compose.github.io/)\n\n## Live Demos\n\n* [graphql-compose.herokuapp.com](https://graphql-compose.herokuapp.com/) - Live demo of GraphQL Server (9 models, 14 files, ~750 LOC)\n* [nodkz.github.io/relay-northwind](https://nodkz.github.io/relay-northwind) - Live demo of Relay client working with the server above (8 crazy pages, 47 files, ~3000 LOC)\n\n## Examples\n\nPlease follow [Quick Start Guide](https://graphql-compose.github.io/docs/intro/quick-start.html) for the complete example.\n\nHere is just a demo of ambiguity ways of types definitions:\n\n```js\nimport { schemaComposer} from 'graphql-compose';\n\n// You may use SDL format for type definition\nconst CityTC = schemaComposer.createObjectTC(`\n  type City {\n    code: String!\n    name: String!\n    population: Number\n    countryCode: String\n    tz: String\n  }\n`);\n\n// Define type via Config object\nconst CountryTC = schemaComposer.createObjectTC({\n  name: 'Country',\n  fields: {\n    title: 'String',\n    geo: `type LonLat { lon: Float, lat: Float }`,\n    hoisting: {\n      type: () => AnotherTC,\n      description: `\n        You may wrap type in thunk for solving\n        hoisting problems when two types cross reference\n        each other.\n      `,\n    }\n  }\n});\n\n// Or via declarative methods define some additional fields\nCityTC.addFields({\n  country: CountryTC, // some another Type\n  ucName: { // standard GraphQL like field definition\n    type: GraphQLString,\n    resolve: (source) => source.name.toUpperCase(),\n  },\n  currentLocalTime: { // extended GraphQL Compose field definition\n    type: 'Date',\n    resolve: (source) => moment().tz(source.tz).format(),\n    projection: { tz: true }, // load `tz` from database, when requested only `localTime` field\n  },\n  counter: 'Int', // shortening for only type definition for field\n  complex: `type ComplexType {\n    subField1: String\n    subField2: Float\n    subField3: Boolean\n    subField4: ID\n    subField5: JSON\n    subField6: Date\n  }`,\n  list0: {\n    type: '[String]',\n    description: 'Array of strings',\n  },\n  list1: '[String]',\n  list2: ['String'],\n  list3: [new GraphQLOutputType(...)],\n  list4: [`type Complex2Type { f1: Float, f2: Int }`],\n});\n\n// Add resolver method\nCityTC.addResolver({\n  kind: 'query',\n  name: 'findMany',\n  args: {\n    filter: `input CityFilterInput {\n      code: String!\n    }`,\n    limit: {\n      type: 'Int',\n      defaultValue: 20,\n    },\n    skip: 'Int',\n    // ... other args if needed\n  },\n  type: [CityTC], // array of cities\n  resolve: async ({ args, context }) => {\n    return context.someCityDB\n      .findMany(args.filter)\n      .limit(args.limit)\n      .skip(args.skip);\n  },\n});\n\n// Remove `tz` field from schema\nCityTC.removeField('tz');\n\n// Add description to field\nCityTC.extendField('name', {\n  description: 'City name',\n});\n\nschemaComposer.Query.addFields({\n  cities: CityTC.getResolver('findMany'),\n  currentTime: {\n    type: 'Date',\n    resolve: () => Date.now(),\n  },\n});\n\nschemaComposer.Mutation.addFields({\n  createCity: CityTC.getResolver('createOne'),\n  updateCity: CityTC.getResolver('updateById'),\n  ...adminAccess({\n    removeCity: CityTC.getResolver('removeById'),\n  }),\n});\n\nfunction adminAccess(resolvers) {\n  Object.keys(resolvers).forEach(k => {\n    resolvers[k] = resolvers[k].wrapResolve(next => rp => {\n      // rp = resolveParams = { source, args, context, info }\n      if (!rp.context.isAdmin) {\n        throw new Error('You should be admin, to have access to this action.');\n      }\n      return next(rp);\n    });\n  });\n  return resolvers;\n}\n\n// construct schema which can be passed to express-graphql, apollo-server or graphql-yoga\nexport const schema = schemaComposer.buildSchema();\n```\n\n## Contributors\n\nThis project exists thanks to all the people who contribute.\n<a href=\"graphs/contributors\"><img src=\"https://opencollective.com/graphql-compose/contributors.svg?width=890&button=false\" /></a>\n\n## Backers\n\nThank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/graphql-compose#backer)]\n\n<a href=\"https://opencollective.com/graphql-compose#backers\" target=\"_blank\"><img src=\"https://opencollective.com/graphql-compose/backers.svg?width=890\"></a>\n\n## Sponsors\n\nSupport this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/graphql-compose#sponsor)]\n\n<a href=\"https://opencollective.com/graphql-compose/sponsor/0/website\" target=\"_blank\"><img src=\"https://opencollective.com/graphql-compose/sponsor/0/avatar.svg\"></a>\n<a href=\"https://opencollective.com/graphql-compose/sponsor/1/website\" target=\"_blank\"><img src=\"https://opencollective.com/graphql-compose/sponsor/1/avatar.svg\"></a>\n<a href=\"https://opencollective.com/graphql-compose/sponsor/2/website\" target=\"_blank\"><img src=\"https://opencollective.com/graphql-compose/sponsor/2/avatar.svg\"></a>\n<a href=\"https://opencollective.com/graphql-compose/sponsor/3/website\" target=\"_blank\"><img src=\"https://opencollective.com/graphql-compose/sponsor/3/avatar.svg\"></a>\n<a href=\"https://opencollective.com/graphql-compose/sponsor/4/website\" target=\"_blank\"><img src=\"https://opencollective.com/graphql-compose/sponsor/4/avatar.svg\"></a>\n<a href=\"https://opencollective.com/graphql-compose/sponsor/5/website\" target=\"_blank\"><img src=\"https://opencollective.com/graphql-compose/sponsor/5/avatar.svg\"></a>\n<a href=\"https://opencollective.com/graphql-compose/sponsor/6/website\" target=\"_blank\"><img src=\"https://opencollective.com/graphql-compose/sponsor/6/avatar.svg\"></a>\n<a href=\"https://opencollective.com/graphql-compose/sponsor/7/website\" target=\"_blank\"><img src=\"https://opencollective.com/graphql-compose/sponsor/7/avatar.svg\"></a>\n<a href=\"https://opencollective.com/graphql-compose/sponsor/8/website\" target=\"_blank\"><img src=\"https://opencollective.com/graphql-compose/sponsor/8/avatar.svg\"></a>\n<a href=\"https://opencollective.com/graphql-compose/sponsor/9/website\" target=\"_blank\"><img src=\"https://opencollective.com/graphql-compose/sponsor/9/avatar.svg\"></a>\n\n## License\n\n[MIT](https://github.com/graphql-compose/graphql-compose/blob/master/LICENSE.md)\n","publish_time":1549361615293,"_cnpm_publish_time":1549361615293,"dist-tags":{"alpha":"8.0.0-alpha.2","latest":"9.3.0","v6-latest":"6.3.8"}}