{"_id":"@cardiv/gatsby-source-apiserver","_rev":"1-a0208c04218d900f033ee967c1ecb507","name":"@cardiv/gatsby-source-apiserver","dist-tags":{"latest":"2.1.0"},"versions":{"2.1.0":{"name":"@cardiv/gatsby-source-apiserver","version":"2.1.0","description":"Gatsby plugin to handle any third party api data intake.","main":"index.js","scripts":{"build":"babel src --out-dir . --ignore __tests__","watch":"babel -w src --out-dir . --ignore __tests__","prepare":"cross-env NODE_ENV=production npm run build"},"homepage":"https://github.com/thinhle-agilityio/gatsby-source-apiserver#readme","keywords":["gatsby","gatsby-plugin","gatsby-source-plugin"],"author":{"name":"Thinh Le","email":"thinh.le@asnet.com.vn"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/thinhle-agilityio/gatsby-source-apiserver.git"},"devDependencies":{"babel-preset-es2015":"^6.24.1","babel-preset-react":"^6.24.1","babel-preset-stage-2":"^6.24.1","cross-env":"^5.1.4"},"dependencies":{"axios":"^0.18.0","babel-cli":"^6.26.0","babel-runtime":"^6.26.0","chalk":"^2.3.2","crypto":"^1.0.1","deep-map-keys":"^1.2.0","json-stringify-safe":"^5.0.1","nanoid":"^1.0.2"},"gitHead":"122ce735bc17cffc0f911b3f24ca7051fa7c9f44","bugs":{"url":"https://github.com/thinhle-agilityio/gatsby-source-apiserver/issues"},"_id":"@cardiv/gatsby-source-apiserver@2.1.0","_npmVersion":"6.5.0","_nodeVersion":"10.7.0","_npmUser":{"name":"cardiv","email":"jaksch.carsten@gmail.com"},"dist":{"integrity":"sha512-NyStQu0AudwUH5TC2fYDqqq+g5VRDMfAbamoe+mKHsEa9l8+W6lm6yemZwMv2jGquaQJQCaAccyJEQ3E9043tA==","shasum":"aa7ac0ae334a97e4d927344f02076e4bb89560c8","tarball":"https://registry.npmjs.org/@cardiv/gatsby-source-apiserver/-/gatsby-source-apiserver-2.1.0.tgz","fileCount":14,"unpackedSize":29790,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcQ3JwCRA9TVsSAnZWagAAfLoQAIntuSn72DvllMI1RQye\nM2X71TzEKoKMKeuuYfz7/GGjL9eRpdn04YNToFybaIf+h+z/0dazJON6rj5b\n32u20wwQ+OfICKoXK7OrWVchnCTcuIHIEy8kZWxBCPhOWo3j07d3P/bEe4YR\n2oUyd3vlkQAYlo0+XPuu5fmmDnob26o8nVqJWhNKZSbWCAx3Lyb0WsowrFj2\nCZcDCojjulW5rt3We4IpYS1Hztw8Qs0RWTVFDM8sXKAXFD1X2CouyWR85rMV\norpSEO0T21vyL6HIP/vFjWxtK6ipabkwNRN8rjPzokwFy6UiY1koCLbX6CmS\nryZpop/ci465d6aavR7fhkM1aOfyrWWfC1yYgBdgfKgKtgYujUQNG2z1eSAJ\nKvTrUi3QFVzfl8hUNSshUsao8OF95AwjoEOS/o5sNhe6xZW3q2z/xzrgAJk1\nWKMtNJDalxVNHyfIE4QT7w1oZH5w2NTVkCyG2npkID8cxWSDvgwV82BGYAjB\n0MnWn0E5qNZvAw0aloE4RM+Y2a6vFRVn4jfsjICg1/am8kS08n3tXt1N5c4o\nJjixW9vrlqXpSIIEugIJRgBQpcmxAkd+WRntdm+bKWaPhxzP5N87eMPk79sh\nNQV01TPLCuS/sdTiJepSaAD+BKorlslMSlRaM/AKXZNUH0OaUd7HmYjt8Fbr\noknZ\r\n=i+w1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDciGR1q9iKAgGRecdRlyivo9r74YkdaUpZwk7VZOHqTwIgU0a/hethERQw/6fQvYJhudnXFZ0O2dHcLJTWw0SikuM="}]},"maintainers":[{"name":"cardiv","email":"jaksch.carsten@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/gatsby-source-apiserver_2.1.0_1547924080036_0.9373205804107565"},"_hasShrinkwrap":false}},"time":{"created":"2019-01-19T18:54:39.808Z","2.1.0":"2019-01-19T18:54:40.148Z","modified":"2022-04-04T21:51:24.561Z"},"maintainers":[{"name":"cardiv","email":"jaksch.carsten@gmail.com"}],"description":"Gatsby plugin to handle any third party api data intake.","homepage":"https://github.com/thinhle-agilityio/gatsby-source-apiserver#readme","keywords":["gatsby","gatsby-plugin","gatsby-source-plugin"],"repository":{"type":"git","url":"git+https://github.com/thinhle-agilityio/gatsby-source-apiserver.git"},"author":{"name":"Thinh Le","email":"thinh.le@asnet.com.vn"},"bugs":{"url":"https://github.com/thinhle-agilityio/gatsby-source-apiserver/issues"},"license":"MIT","readme":"# gatsby-source-apiserver\n\nA gatsby source plugin for pulling in third party api data.\n\n## Features\n\n* Pulls data from configured api url\n* Uses custom name to allow for multiple instances of plugin\n* Option to download the json data to a configurable path\n* Option to only download the json data, and skip inserting it into GraphQL\n* Supports simple authentication through axios\n\n## Install\n\n```\nnpm install --save gatsby-source-apiserver\n```\n\nMigrate for Gatsby-v2 release:\n\nPlease checkout version `2.0.0` or `next`\n\n```\nnpm install --save gatsby-source-apiserver@next\n```\n\n## Change logs\n\n- `2.1.0`:\n   - Support multiple entities for multiple api servers, pls take a look at attribute `entitiesArray`\n   - Add request params\n   - Support Auth0\n- `2.0.0`: Support gatsby-v2\n\n## How to use\n\n```javascript\n// Place configuration options in your gatsby-config.js\n\nplugins: [\n  {\n    resolve: 'gatsby-source-apiserver',\n    options: {\n      // Type prefix of entities from server\n      typePrefix: 'internal__',\n\n      // The url, this should be the endpoint you are attempting to pull data from\n      url: `http://yourapi.com/api/v1/posts`,\n\n      method: 'post',\n\n      headers: {\n        'Content-Type': 'application/json'\n      },\n  \n      // Request body\n      data: {\n\n      },\n\n      // Name of the data to be downloaded.  Will show in graphQL or be saved to a file\n      // using this name. i.e. posts.json\n      name: `posts`,\n\n      // Nested level of entities in response object, example: `data.posts`\n      entityLevel: `data.posts`,\n\n      // Define schemaType to normalize blank values\n      // example:\n      // const postType = {\n      //   id: 1,\n      //   name: 'String',\n      //   published: true,\n      //   object: {a: 1, b: '2', c: false},\n      //   array: [{a: 1, b: '2', c: false}]\n      // }\n      schemaType: postType,\n\n      // Request parameters\n      // Only available from version 2.1.0\n      params: {\n        per_page: 1\n      },\n\n      // Simple authentication, optional\n      auth: {\n        username: 'myusername',\n        password: 'supersecretpassword1234'\n      },\n\n      // Advanced authentication for Auth0\n      // Only available from version 2.1.0\n      auth0Config: {\n        method: 'POST',\n        url: 'https://MyAuth0Domain/oauth/token',\n        headers: { 'content-type': 'application/json' },\n        data: { \n          grant_type: 'password',\n          username: 'myusername',\n          password: 'PassAWordHere',\n          audience: 'Auth0APIAudience',\n          scope: 'openid',\n          client_id: 'AUTH0_CLIENT_ID',\n          client_secret: 'AUTH0_SECRET'\n        },\n        json: true\n      },\n\n      // Optional payload key name if your api returns your payload in a different key\n      // Default will use the full response from the http request of the url\n      payloadKey: `body`,\n\n      // Optionally save the JSON data to a file locally\n      // Default is false\n      localSave: false,\n\n      //  Required folder path where the data should be saved if using localSave option\n      //  This folder must already exist\n      path: `${__dirname}/src/data/auth/`,\n\n      // Optionally include some output when building\n      // Default is false\n      verboseOutput: true, // For debugging purposes\n\n      // Optionally skip creating nodes in graphQL.  Use this if you only want\n      // The data to be saved locally\n      // Default is false\n      skipCreateNode: false, // skip import to graphQL, only use if localSave is all you want\n      \n      // Pass an array containing any number of the entity configuration properties (except verbose, auth0Config),\n      // any not specified are defaulted to the general properties that are specified \n      // Only available from version 2.1.0\n      entitiesArray: [{\n        url: `http://yourapi.com/api/v1/posts`,\n        method: 'post',\n        headers: {\n        'Content-Type': 'application/json'\n        },\n        name: `posts`,\n      }]\n    }\n  }\n];\n\n```\n\n## How to query\n\nData will be available at the following points in GraphQL.\n\n`all<TypePrefix><Name>` or `<TypePrefix><Name>` where `TypePrefix` and `Name` is replaced by the name entered in the\nconfiguration options.\n\n## Dummy Node\n\nThis plugin will automatically add the dummy node for initialize Gatsby Graphql Schema (for handling graphql error if some field is missing). The dummy node will have field `id: 'dummy'`, you should exclude dummy node from `createPage()`\n\n```\negdes.node.id === 'dummy'\n```\n\nNote: make sure you pass option `schemaType` to make dummy node works.\n\n### Conflicting keys\n\nSome of the returned keys may be transformed if they conflict with restricted keys used for\nGraphQL such as the following `['id', 'children', 'parent', 'fields', 'internal']`\n\nThese conflicting keys will now show up as `alternative_id`\n","readmeFilename":"README.md"}